refactor(core): 全量语义化客户端迁移并移除历史兼容桥接层

This commit is contained in:
gitea committed 2026-09-17 15:44:25 +08:00
1 parent 29ac24248e
commit d0f3d2738a
34 files changed
+89 -141

No files matched your search

+5 -5
View File
@@ -1,7 +1,7 @@
import { booleanOption, numberOption, stringOption } from "../parser.js";
import { printJson, printTable } from "../printer.js";
import type { CliParsedArgs, CliResult, CliRuntime } from "../types.js";
import { createEkbClient } from "../../core/auth/ekb.js";
import { createSessionClient } from "../../core/http/session-client.js";
import { filterMessages, listMessages, mergeMessages, readMessage } from "../../domains/message/tools.js";
import type { MessageItem } from "../../domains/message/types.js";
import { isDryRun, mutationPreview, requireMutationConfirmation } from "../mutation.js";
@@ -30,7 +30,7 @@ export async function handleMessageCommand(parsed: CliParsedArgs, runtime: CliRu
const corpId = corp.corpId || corp.id;
if (action === "count" || action === "unread") {
const client = await createEkbClient(corp);
const client = await createSessionClient(corp);
const result = await listMessages(client, corpId, { start: 0, count: 1, read: false });
if (runtime.jsonMode) return { stdout: printJson({ corpId, unread: result.total }, runtime.outputOptions), stderr: "", exitCode: 0 };
return { stdout: `未读消息: ${result.total}\n`, stderr: "", exitCode: 0 };
@@ -43,7 +43,7 @@ export async function handleMessageCommand(parsed: CliParsedArgs, runtime: CliRu
return mutationPreview(parsed, runtime, "标记消息为已读", messageId, { read: true });
}
requireMutationConfirmation(parsed, runtime, "标记消息为已读", `hose-use message read ${messageId} --yes`);
const client = await createEkbClient(corp);
const client = await createSessionClient(corp);
await readMessage(client, corpId, messageId);
if (runtime.jsonMode) return { stdout: printJson({ corpId, id: messageId, read: true }, runtime.outputOptions), stderr: "", exitCode: 0 };
return { stdout: `已标记消息为已读: ${messageId}\n`, stderr: "", exitCode: 0 };
@@ -54,7 +54,7 @@ export async function handleMessageCommand(parsed: CliParsedArgs, runtime: CliRu
return mutationPreview(parsed, runtime, "批量标记未读消息为已读", `corp:${corpId}`, { read: true, allUnread: true });
}
requireMutationConfirmation(parsed, runtime, "批量标记未读消息为已读", "hose-use message read-all --yes");
const client = await createEkbClient(corp);
const client = await createSessionClient(corp);
const ids: string[] = [];
let start = 0;
let total = 0;
@@ -74,7 +74,7 @@ export async function handleMessageCommand(parsed: CliParsedArgs, runtime: CliRu
return { stdout: "", stderr: `未知消息子命令: ${action}。支持: list, count, read <messageId>, read-all\n`, exitCode: 1 };
}
const client = await createEkbClient(corp);
const client = await createSessionClient(corp);
const read = booleanOption(parsed.options, ["read"]);
const unread = booleanOption(parsed.options, ["unread"]);