feat(bill): 引入费控单据与费用明细检索(支持按单号精准查询与 DataLink 字典自动还原)并发布 v0.3.0
🚀 Release / 🚀 Build & Publish Multi-Platform Binaries (push) Has been cancelled

This commit is contained in:
gitea committed 2026-08-27 11:48:20 +08:00
1 parent 0372698ff9
commit 5cf6c9e014
19 files changed
+1141 -14

No files matched your search

+24 -2
View File
@@ -12,6 +12,7 @@ import { getEasoClient } from "./core/auth/easo.js";
import { AuthenticationError, EkbError, NotLoggedInError } from "./core/errors.js";
import { authTools } from "./core/auth/tools.js";
import { platformTools } from "./domains/platform/tools.js";
import { billTools } from "./domains/bill/tools.js";
function formatError(error: unknown): {
content: Array<{ type: "text"; text: string }>;
@@ -70,7 +71,7 @@ async function main() {
);
// 聚合所有工具
const allTools = [...authTools, ...platformTools];
const allTools = [...authTools, ...platformTools, ...billTools];
// 注册工具列表
server.setRequestHandler(ListToolsRequestSchema, async () => {
@@ -109,7 +110,28 @@ async function main() {
};
}
// 2. 检查 Domain 业务工具(需要当前企业上下文)
// 2. 检查 Bill 工具
const billTool = billTools.find((t) => t.name === name);
if (billTool) {
const parsed = billTool.parameters.safeParse(args || {});
if (!parsed.success) {
return {
content: [{ type: "text", text: `参数错误: ${parsed.error.message}` }],
isError: true,
};
}
const result = await billTool.handler({ corpContext }, parsed.data as never);
return {
content: [
{
type: "text",
text: typeof result === "string" ? result : JSON.stringify(result, null, 2),
},
],
};
}
// 3. 检查 Domain 业务工具(需要当前企业上下文)
const currentCorp = corpContext.getCurrent();
if (!currentCorp) {
return {