@carbonstopper/agent-mcp 0.1.65 → 0.1.68

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,186 @@
1
+ import { z } from "zod";
2
+ import * as dto from "./monitor-dto-schemas.js";
3
+ import { CbamMonitorSkill } from "./apipath.js";
4
+ // 新监测工具单独维护契约,避免旧 CBAM 全量保存的 body 转换改变增量语义。
5
+ const text = (max) => z.string().min(1).max(max).refine(value => value.trim().length > 0);
6
+ const read = {
7
+ sessionId: text(128).describe("可信 Agent 调用提供的 sessionId。"),
8
+ lang: z.enum(["zh", "en"]).optional(),
9
+ messageId: text(128).optional(), traceId: text(128).optional(),
10
+ taskId: text(128).optional(), eventId: text(128).optional(),
11
+ };
12
+ const write = { ...read, idempotencyKey: text(128).describe("同一逻辑动作跨天或网络重试保持相同键;业务内容改变时使用新键。") };
13
+ const planRead = { ...read, planId: dto.monitorLongId };
14
+ const planWrite = { ...write, planId: dto.monitorLongId };
15
+ const confirmed = z.boolean().optional().describe("只能由可信 Agent wrapper 在现有用户确认流程完成后注入;模型不能自行批准。");
16
+ const itemKey = text(64).describe("真实服务端对象键;禁止名称、CN 码或数组位置代替。");
17
+ const year = z.number().int().min(1900).max(9999);
18
+ const pageNum = z.number().int().min(1).max(100000).optional();
19
+ const pageSize = z.number().int().min(1).max(50).optional().describe("默认 20,明细每页最多 50 条。");
20
+ const fields = z.array(text(100)).max(20).optional();
21
+ const cursor = text(1500).optional().describe("原样传回服务端 textCursor;版本变化后重新定位,不拼接新旧快照。");
22
+ const moduleCode = z.enum(["facility", "goods_boundary", "direct_emission", "condition", "control_confirmation"]);
23
+ export const monitorCollections = {
24
+ facility: [],
25
+ goods_boundary: ["products", "precursors", "processes", "nonCbamGoods"],
26
+ direct_emission: ["processMonitors", "factorSamplings", "pfcMonitors"],
27
+ condition: ["heatFlows", "generators", "wasteGasFlows"],
28
+ control_confirmation: ["responsibilities", "manageEvaluateProcedures", "dataFlowProcedures", "controlActivityProcedures", "otherProcedures"],
29
+ };
30
+ const collection = z.enum([...monitorCollections.goods_boundary, ...monitorCollections.direct_emission,
31
+ ...monitorCollections.condition, ...monitorCollections.control_confirmation]);
32
+ function checkClears(value, context) {
33
+ const seen = new Set();
34
+ for (const field of value.clearFields || []) {
35
+ if (seen.has(field) || Object.prototype.hasOwnProperty.call(value.changes || {}, field)) {
36
+ context.addIssue({ code: "custom", path: ["clearFields"], message: "clearFields 不得重复或与 changes 指定同一字段。" });
37
+ }
38
+ seen.add(field);
39
+ }
40
+ }
41
+ function fieldShape(values) {
42
+ return {
43
+ changes: values.optional().describe("仅提交本次明确修改字段。省略保留,0/false 有效;不接受 null 或空数组作为清空。"),
44
+ clearFields: z.array(z.enum(Object.keys(values.shape))).max(100).optional()
45
+ .describe("明确清空的普通字段,不支持任意路径;不得与 changes 重复。"),
46
+ };
47
+ }
48
+ function patchFields(values) {
49
+ return z.strictObject(fieldShape(values)).superRefine(checkClears);
50
+ }
51
+ function patchItems(values) {
52
+ return z.strictObject({
53
+ add: z.array(z.strictObject({ clientItemKey: text(64), values: values.refine(value => Object.keys(value).length > 0, "新增对象需要业务字段") })).max(100).optional(),
54
+ update: z.array(z.strictObject({ itemKey, ...fieldShape(values) }).superRefine(checkClears)).max(100).optional(),
55
+ }).superRefine((value, context) => {
56
+ for (const [key, rows] of [["clientItemKey", value.add], ["itemKey", value.update]]) {
57
+ const seen = new Set();
58
+ for (const row of rows || []) {
59
+ const id = String(row[key]);
60
+ if (seen.has(id))
61
+ context.addIssue({ code: "custom", message: `${key} 在同一集合请求中不能重复` });
62
+ seen.add(id);
63
+ }
64
+ }
65
+ });
66
+ }
67
+ export const monitorMainValues = z.strictObject({
68
+ factoryId: dto.monitorLongId.optional(), planName: text(100).optional(),
69
+ planDate: z.string().regex(/^\d{4}-\d{2}-\d{2}$/).optional(),
70
+ versionNo: text(40).refine(value => value.trim().startsWith("V"), "业务版本需以 V 开头").optional(),
71
+ effectiveDate: z.string().regex(/^\d{4}-\d{2}-\d{2}$/).optional(), changeReason: text(200).optional(),
72
+ });
73
+ // 凭证使用判别联合放在 operation 字段内:当前 SDK 只发布根 Object schema。
74
+ // body 构建时明确展开 operation,Java 接收 action 及其严格对应参数。
75
+ const evidenceOperation = z.discriminatedUnion("action", [
76
+ z.strictObject({ action: z.literal("create"), evidence: dto.monitorEvidenceDTOValues.required({ evidenceType: true }) }),
77
+ z.strictObject({ action: z.literal("update"), evidenceId: dto.monitorLongId, patch: patchFields(dto.monitorEvidenceDTOValues) }),
78
+ z.strictObject({ action: z.literal("bind"), evidenceId: dto.monitorLongId, partCode: z.number().int().min(1).max(8), itemKey }),
79
+ z.strictObject({ action: z.literal("unbind"), relationId: dto.monitorLongId }),
80
+ ]);
81
+ export const monitorSchemas = {
82
+ cbam_monitor_session_select: z.strictObject({ ...write, mode: z.enum(["existing", "new"]), planId: dto.monitorLongId.optional(), year: year.optional() })
83
+ .superRefine((value, context) => {
84
+ if (value.mode === "existing" ? value.planId === undefined || value.year !== undefined : value.planId !== undefined) {
85
+ context.addIssue({ code: "custom", path: ["mode"], message: "existing 必须且只指定 planId;new 只接受可选 year。" });
86
+ }
87
+ }),
88
+ cbam_monitor_material_advice: z.strictObject({ ...read, planId: dto.monitorLongId.optional(), intakeId: text(128).optional() })
89
+ .refine(value => value.planId === undefined || value.intakeId === undefined, "planId 与 intakeId 二选一,也可均省略读取首次建议"),
90
+ cbam_monitor_plan_create: z.strictObject({ ...write, intakeId: text(128), extractionResultId: text(128), year,
91
+ changes: monitorMainValues.optional(), facility: z.strictObject({ facilityJson: dto.facilityJsonValues.optional() }).optional() }),
92
+ cbam_monitor_plan_query: z.strictObject({ ...read, view: z.enum(["page", "summary"]), planId: dto.monitorLongId.optional(), pageNum,
93
+ pageSize: z.number().int().min(1).max(100).optional(), name: text(100).optional(), status: z.number().int().min(0).max(2).optional(), year: year.optional() })
94
+ .superRefine((value, context) => {
95
+ if (value.view === "summary" ? value.planId === undefined || [value.pageNum, value.pageSize, value.name, value.status, value.year].some(v => v !== undefined) : value.planId !== undefined) {
96
+ context.addIssue({ code: "custom", path: ["view"], message: "summary 只接收 planId;page 接收名称/状态/年度筛选及分页。" });
97
+ }
98
+ }),
99
+ cbam_monitor_section_read: z.strictObject({ ...planRead, moduleCode, fields, textCursor: cursor }),
100
+ cbam_monitor_item_query: z.strictObject({ ...planRead, view: z.enum(["page", "detail"]), moduleCode, collection,
101
+ itemKey: itemKey.optional(), fields, textCursor: cursor, keyword: text(100).optional(), pageNum, pageSize })
102
+ .superRefine((value, context) => {
103
+ checkCollection(value, context);
104
+ if (value.view === "detail" ? value.itemKey === undefined || [value.keyword, value.pageNum, value.pageSize].some(v => v !== undefined)
105
+ : [value.itemKey, value.fields, value.textCursor].some(v => v !== undefined)) {
106
+ context.addIssue({ code: "custom", path: ["view"], message: "detail 需要 itemKey,可选 fields/textCursor;page 只接收关键词和分页。" });
107
+ }
108
+ }),
109
+ cbam_monitor_facility_patch: z.strictObject({ ...planWrite, ...fieldShape(monitorMainValues), facilityJson: patchFields(dto.facilityJsonValues).optional() }).superRefine(checkClears),
110
+ cbam_monitor_goods_boundary_patch: z.strictObject({ ...planWrite,
111
+ systemBoundaryJson: patchFields(dto.systemBoundaryJsonValues).optional(), products: patchItems(dto.productItemValues).optional(),
112
+ precursors: patchItems(dto.precursorItemValues).optional(), processes: patchItems(dto.processItemValues).optional(), nonCbamGoods: patchItems(dto.nonCbamGoodsItemValues).optional() }),
113
+ cbam_monitor_direct_emission_patch: z.strictObject({ ...planWrite,
114
+ pfcMonitorJson: patchFields(dto.pfcMonitorJsonValues).optional(), processMonitors: patchItems(dto.processMonitorItemValues).optional(),
115
+ factorSamplings: patchItems(dto.factorSamplingItemValues).optional(), pfcMonitors: patchItems(dto.pfcMonitorItemValues).optional() }),
116
+ cbam_monitor_condition_patch: z.strictObject({ ...planWrite,
117
+ zeroRatedFuelJson: patchFields(dto.zeroRatedFuelJsonValues).optional(), measurableHeatJson: patchFields(dto.measurableHeatJsonValues).optional(),
118
+ facilityElectricityJson: patchFields(dto.facilityElectricityJsonValues).optional(), electricityFactorJson: patchFields(dto.electricityFactorJsonValues).optional(),
119
+ wasteGasJson: patchFields(dto.wasteGasJsonValues).optional(), co2StageJson: patchFields(dto.co2StageJsonValues).optional(),
120
+ heatFlows: patchItems(dto.heatFlowItemValues).optional(), generators: patchItems(dto.facilityElectricityItemValues).optional(), wasteGasFlows: patchItems(dto.wasteGasItemValues).optional() }),
121
+ cbam_monitor_control_confirmation_patch: z.strictObject({ ...planWrite,
122
+ controlActivityJson: patchFields(dto.controlActivityJsonValues).optional(), responsibilities: patchItems(dto.responsibilityItemValues).optional(),
123
+ manageEvaluateProcedures: patchItems(dto.manageEvaluateItemValues).optional(), dataFlowProcedures: patchItems(dto.dataFlowItemValues).optional(),
124
+ controlActivityProcedures: patchItems(dto.controlActivityItemValues).optional(), otherProcedures: patchItems(dto.otherProcedureItemValues).optional() }),
125
+ cbam_monitor_item_delete: z.strictObject({ ...planWrite, confirmed, moduleCode, collection, itemKeys: z.array(itemKey).min(1).max(100).refine(keys => new Set(keys).size === keys.length) }).superRefine(checkCollection),
126
+ cbam_monitor_evidence_read: z.strictObject({ ...planRead, evidenceId: dto.monitorLongId.optional(), partCode: z.number().int().min(1).max(8).optional(),
127
+ excludeRelated: z.boolean().optional(), pageNum, pageSize }),
128
+ cbam_monitor_evidence_manage: z.strictObject({ ...planWrite, operation: evidenceOperation }),
129
+ cbam_monitor_plan_save: z.strictObject(planWrite),
130
+ cbam_monitor_plan_progress: z.strictObject({ ...planRead, gapPageNum: pageNum, gapPageSize: pageSize }),
131
+ cbam_monitor_report_generate: z.strictObject({ ...planWrite, confirmed, language: z.enum(["ZH", "EN"]) }),
132
+ };
133
+ function checkCollection(value, context) {
134
+ const allowed = monitorCollections[value.moduleCode];
135
+ if (!allowed.includes(value.collection))
136
+ context.addIssue({ code: "custom", path: ["collection"], message: "集合不属于指定模块" });
137
+ }
138
+ export const monitorToolNames = Object.keys(monitorSchemas);
139
+ const paths = {
140
+ cbam_monitor_session_select: "session/select", cbam_monitor_material_advice: "material/advice", cbam_monitor_plan_create: "plan/create",
141
+ cbam_monitor_plan_query: "plan/query", cbam_monitor_section_read: "plan/section/read", cbam_monitor_item_query: "plan/item/query",
142
+ cbam_monitor_facility_patch: "plan/patch/facility", cbam_monitor_goods_boundary_patch: "plan/patch/goods-boundary",
143
+ cbam_monitor_direct_emission_patch: "plan/patch/direct-emission", cbam_monitor_condition_patch: "plan/patch/condition",
144
+ cbam_monitor_control_confirmation_patch: "plan/patch/control-confirmation", cbam_monitor_item_delete: "plan/item/delete",
145
+ cbam_monitor_evidence_read: "evidence/read", cbam_monitor_evidence_manage: "evidence/manage", cbam_monitor_plan_save: "plan/submit",
146
+ cbam_monitor_plan_progress: "plan/progress", cbam_monitor_report_generate: "report/generate",
147
+ };
148
+ export const monitorRoutes = Object.fromEntries(Object.entries(paths).map(([name, path]) => [name, {
149
+ method: "POST", path: CbamMonitorSkill(path), bodyKind: "cbamMonitor",
150
+ ...(name === "cbam_monitor_report_generate" ? { timeoutSeconds: 180, exactTimeout: true, maxRetries: 0 } : {}),
151
+ }]));
152
+ const patchDescription = "Apply only explicitly requested changes to the exact planId. Omitted fields keep their latest saved values; 0 and false are valid. Clear only through clearFields. Use stable itemKey for updates and clientItemKey for additions; first locate existing objects across all candidate pages to avoid duplicate additions. Never pass dataVersion or year. Manage evidenceIds only through evidence_manage bind/unbind. The extract- action-key prefix is reserved for the exact durable extraction candidate and its linked plan. A module saves atomically with at most 3 server-side merge attempts. Reuse the original idempotencyKey after a retryable failure. Query progress once after a batch. ";
153
+ export const monitorDescriptions = {
154
+ cbam_monitor_session_select: "Choose an exact existing monitoring plan or start a new material intake. mode=new does not create a business plan; year alone is not valid business data. Every subsequent write still needs an explicit planId. One session may contain multiple plans.",
155
+ cbam_monitor_material_advice: "Read the server-maintained initial materials advice. Returns a short summary and cardId; the frontend reads the complete card. planId/intakeId are mutually exclusive and both may be omitted for first advice. File upload does not itself create a plan.",
156
+ cbam_monitor_plan_create: "Initialize one monitoring plan from a durable, verified extractionResultId in the selected intake. Requires a known year and valid confirmed business candidates, including conversational sources. Recover an existing planId after interrupted creation; retry pending AI binding before applying pending modules. Never create an empty plan or create one plan per module.",
157
+ cbam_monitor_plan_query: "Search accessible monitoring plans as a flat plan page (max 100), or read one exact plan summary. Excludes full product/precursor/process arrays. status: 0 editing, 1 effective, 2 archived. Preserve planId and business versionNo; year is not a unique identifier.",
158
+ cbam_monitor_section_read: "Read ordinary fields of one monitoring module and collection counts. fields uses exact sectionJson.field names. Collections are queried separately. Long text and arrays return continuations bound to the snapshot version; read all required pages before deciding an object is absent.",
159
+ cbam_monitor_item_query: "Find stable itemKey in the selected module/collection. page returns identity summaries (20 default, max 50); detail returns selected DTO fields and bounded continuations. Multiple matching candidates require disambiguation. Collection names are fixed by module; do not use array indexes.",
160
+ cbam_monitor_facility_patch: patchDescription + "Facility operator/registration/descriptions and main plan fields only. Business versionNo follows the existing factory + trimmed planName + versionNo uniqueness rule; year is excluded from that key.",
161
+ cbam_monitor_goods_boundary_patch: patchDescription + "Products, precursors, processes, non-CBAM goods and system boundary. CN alone is not a precursor identity. quantity is not a precursor DTO field.",
162
+ cbam_monitor_direct_emission_patch: patchDescription + "Process monitoring, factor sampling and PFC monitoring. Supply exact enum codes and real process keys.",
163
+ cbam_monitor_condition_patch: patchDescription + "Zero-rated fuel, measurable heat, own electricity, electricity factor, waste gas and CO2 stages. Do not assume missing means not applicable.",
164
+ cbam_monitor_control_confirmation_patch: patchDescription + "Responsibilities, evaluation/data-flow/control/other procedures and control summary fields.",
165
+ cbam_monitor_item_delete: "Delete explicitly selected stable itemKeys after the existing trusted approval flow. Any incoming reference blocks the entire batch. No cascade, name matching or partial deletion. Reuse the same action key on retry.",
166
+ cbam_monitor_evidence_read: "Read bounded evidence metadata. Pass evidenceId to read that evidence and its relation page. Relation IDs can change after an aggregate save; re-query a stale relationId before unbinding.",
167
+ cbam_monitor_evidence_manage: "Manage evidence with operation.action=create/update/bind/unbind. The discriminated operation schema enforces separate parameters. update merges explicit fields; unbind removes the relation and embedded evidenceIds but keeps the evidence/file. Files require name/url and must satisfy the backend 100MB evidence limit.",
168
+ cbam_monitor_plan_save: "Formally save the latest strictly read monitoring plan using existing validation. Does not generate a file. No model dataVersion/year and no additional ordinary-save approval requirement. A failed save must not be reported as a successful update.",
169
+ cbam_monitor_plan_progress: "Read existing 22-group completion and one gap page from the same snapshot. completionRate is 0..100. Full details are in the frontend cardId. Missing explanation rules are explicitly marked pending. Resume failed first-batch saves before automatically showing progress; explicit user progress requests may show current saved data.",
170
+ cbam_monitor_report_generate: "Generate a synchronous ZH/EN DOCX from the saved monitoring plan using the existing backend renderer and file service, after the existing trusted confirmation flow. Returns file metadata and controlled access, never binary/base64/jobId. Same action key recovers the original file/sourceDataVersion. An unknown upload result must be reconciled; never switch automatically to the old Agent generator.",
171
+ };
172
+ /** 新工具不调用旧 normalizeIds:数值字符串直接交给 Java Long,避免先变成不安全 Number。 */
173
+ export function buildMonitorBody(args) {
174
+ const { operation, ...body } = args;
175
+ return operation === undefined ? body : { ...body, ...operation };
176
+ }
177
+ /** 在 JSON.parse 前保护异常/兼容响应中的超大整数;字符串内的数字完全不改。 */
178
+ export function preserveMonitorIntegers(body) {
179
+ return body.replace(/"(?:\\.|[^"\\])*"|-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?/g, token => {
180
+ if (token.startsWith('"') || /[.eE]/.test(token))
181
+ return token;
182
+ const integer = BigInt(token);
183
+ return integer > BigInt(Number.MAX_SAFE_INTEGER) || integer < BigInt(Number.MIN_SAFE_INTEGER) ? JSON.stringify(token) : token;
184
+ });
185
+ }
186
+ //# sourceMappingURL=monitor-tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"monitor-tools.js","sourceRoot":"","sources":["../src/monitor-tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,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,CAAC,IAA6B;IAC5D,MAAM,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,GAAG,IAAI,CAAC;IACpC,OAAO,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,GAAI,SAAqC,EAAE,CAAC;AACjG,CAAC;AAED,iDAAiD;AACjD,MAAM,UAAU,uBAAuB,CAAC,IAAY;IAClD,OAAO,IAAI,CAAC,OAAO,CAAC,gEAAgE,EAAE,KAAK,CAAC,EAAE;QAC5F,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC;YAAE,OAAO,KAAK,CAAC;QAC/D,MAAM,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;QAC9B,OAAO,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,IAAI,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IAChI,CAAC,CAAC,CAAC;AACL,CAAC"}
package/dist/server.js CHANGED
@@ -5,7 +5,10 @@ import { normalizeBackendErrorResponse, normalizeBackendSuccessResponse } from "
5
5
  import { ToolInputValidationError } from "./tool-validation.js";
6
6
  import { schemas, descriptions, exposedToolNames, toolRoutes, buildBody, getSessionId, resolveRoutePath, buildFactorSearchBody, validateToolArgs, } from "./tools.js";
7
7
  import { Version } from "./version.js";
8
+ import { preserveMonitorIntegers } from "./monitor-tools.js";
9
+ import { factorResultContent } from "./factor-result.js";
8
10
  import { cbamReportPollTimeoutMs, cbamReportStatusTimeoutMs, cbamReportTotalTimeoutMs, waitForCbamReportGeneration, } from "./cbam-report-generation.js";
11
+ import { isAnonymousSessionId, resolveAnonymousToolPolicy, } from "./anonymous-policy.js";
9
12
  export function assertConfig(config) {
10
13
  if (!config.baseURL) {
11
14
  throw new Error("CARBONSTOP_AGENT_BASE_URL is required");
@@ -20,6 +23,24 @@ function textContent(text) {
20
23
  function errorContent(text) {
21
24
  return { content: [{ type: "text", text }], isError: true };
22
25
  }
26
+ function anonymousToolForbiddenContent(toolName, policy) {
27
+ const payload = {
28
+ code: "ANONYMOUS_TOOL_FORBIDDEN",
29
+ detailCode: policy.detailCode,
30
+ message: policy.message,
31
+ messageKey: policy.messageKey,
32
+ restrictionType: policy.category,
33
+ toolName,
34
+ requiresLogin: true,
35
+ retryable: false,
36
+ executionState: "not_dispatched",
37
+ };
38
+ return {
39
+ content: [{ type: "text", text: JSON.stringify(payload, null, 2) }],
40
+ structuredContent: payload,
41
+ isError: true,
42
+ };
43
+ }
23
44
  function validationErrorContent(error) {
24
45
  const payload = error.toPayload();
25
46
  const text = JSON.stringify(payload, null, 2);
@@ -40,7 +61,9 @@ export function createAgentMcpServer(config) {
40
61
  if (!schema)
41
62
  continue;
42
63
  server.registerTool(name, {
43
- description: descriptions[name] || "",
64
+ description: (descriptions[name] || "") + (name === "factor_search"
65
+ ? " Results include factorId (exact string) and detailUrl. When presenting a factor, link its name/value to that returned detailUrl so Carbon Agent can open the factor detail panel. Preserve the backend value and source; do not invent verification status or links."
66
+ : ""),
44
67
  inputSchema: schema,
45
68
  }, async (args) => {
46
69
  const startedAt = Date.now();
@@ -54,6 +77,21 @@ export function createAgentMcpServer(config) {
54
77
  return errorContent(`Unknown tool: ${name}`);
55
78
  }
56
79
  try {
80
+ const rawSessionId = typeof args?.sessionId === "string"
81
+ ? args.sessionId.trim()
82
+ : "";
83
+ const anonymousToolPolicy = resolveAnonymousToolPolicy(name);
84
+ if (isAnonymousSessionId(rawSessionId) && !anonymousToolPolicy.allowed) {
85
+ log("warn", "anonymous_tool_forbidden", {
86
+ detailCode: anonymousToolPolicy.detailCode,
87
+ restrictionType: anonymousToolPolicy.category,
88
+ tool: name,
89
+ sessionId: rawSessionId,
90
+ messageId: args.messageId,
91
+ traceId: args.traceId,
92
+ });
93
+ return anonymousToolForbiddenContent(name, anonymousToolPolicy);
94
+ }
57
95
  validateToolArgs(name, args || {});
58
96
  const sessionId = getSessionId(args);
59
97
  const path = resolveRoutePath(route, args);
@@ -113,6 +151,8 @@ export function createAgentMcpServer(config) {
113
151
  return client.postOnceWithExactTimeout(resolveRoutePath(statusRoute, statusBody), sessionId, statusBody, Math.max(1, Math.min(cbamReportStatusTimeoutMs, remainingPollMs)) / 1000);
114
152
  }, { timeoutMs: pollTimeoutMs });
115
153
  }
154
+ if (name.startsWith("cbam_monitor_"))
155
+ result.body = preserveMonitorIntegers(result.body);
116
156
  const durationMs = Date.now() - startedAt;
117
157
  const batchResult = responseBatchResult(result.body);
118
158
  const businessError = responseBusinessError(result.body);
@@ -157,6 +197,9 @@ export function createAgentMcpServer(config) {
157
197
  try {
158
198
  const parsed = JSON.parse(result.body);
159
199
  const normalized = normalizeBackendSuccessResponse(parsed, route.responseKind);
200
+ if (name === "factor_search" && normalized && typeof normalized === "object" && !Array.isArray(normalized)) {
201
+ return factorResultContent(normalized);
202
+ }
160
203
  return textContent(JSON.stringify(normalized, null, 2));
161
204
  }
162
205
  catch {
@@ -1 +1 @@
1
- {"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,OAAO,EAAE,YAAY,EAAE,GAAG,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAClI,OAAO,EAAE,6BAA6B,EAAE,+BAA+B,EAAE,MAAM,eAAe,CAAC;AAC/F,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EACL,OAAO,EACP,YAAY,EACZ,gBAAgB,EAChB,UAAU,EACV,SAAS,EACT,YAAY,EACZ,gBAAgB,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,CAAC,CAAC,SAAS;oBAC7D,UAAU,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS;oBAClC,WAAW,EAAE,aAAa,CAAC,IAAI,IAAI,EAAE,CAAC;oBACtC,KAAK,EAAE,YAAY,CAAC,GAAG,CAAC;iBACzB,CAAC,CAAC;gBACH,OAAO,YAAY,CACjB,UAAU,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAC7D,CAAC;YACJ,CAAC;QACH,CAAC,CACF,CAAC;IACJ,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
package/dist/tools.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { z } from "zod";
2
2
  export declare const schemas: Record<string, z.ZodObject<any> | undefined>;
3
- export declare const exposedToolNames: readonly ["session_carbon_objects", "cbam_reference_search", "cbam_report_search", "cbam_report_read", "cbam_factory_read", "cbam_factory_save", "cbam_report_save", "cbam_process_manage", "cbam_precursor_manage", "cbam_source_flow_manage", "cbam_heat_power_update", "cbam_product_data_update", "cbam_sale_product_manage", "cbam_carbon_tax_manage", "cbam_data_quality_update", "cbam_report_generate", "cbam_document_read", "cbam_document_publish", "user_memory_recall", "user_memory_get", "user_memory_upsert", "user_memory_forget", "project_memory_recall", "project_memory_get", "project_memory_upsert", "project_memory_forget", "project_overview", "project_member_list", "project_task_search", "project_task_read", "project_session_search", "project_session_read", "project_calculation_search", "project_calculation_read", "project_emission_source_read", "project_enterprise_source_search", "project_enterprise_source_read", "project_enterprise_task_create", "modeling_re_modeling", "modeling_detail", "modeling_account_detail", "modeling_account_update_structured", "modeling_emission_detail", "modeling_emission_add_structured", "modeling_emission_batch_add_structured", "modeling_emission_update_structured", "modeling_emission_batch_update_structured", "modeling_emission_delete_structured", "modeling_execute_structured", "report_generate", "report_regenerate", "report_detail", "factor_search", "unit_list", "company_org_subject_query", "company_org_subject_batch_add", "company_org_subject_batch_update", "enterprise_computation_exists", "enterprise_computation_create_or_update", "enterprise_computation_batch_add", "enterprise_computation_batch_delete", "enterprise_computation_update_base_info", "enterprise_computation_detail", "enterprise_computation_period_list", "enterprise_emission_category_list", "enterprise_report_org_tree", "enterprise_report_generate", "enterprise_report_regenerate", "enterprise_report_file_record_retry", "enterprise_emission_batch_save", "enterprise_emission_batch_update", "enterprise_emission_batch_delete"];
3
+ export declare const exposedToolNames: readonly [...string[], "session_carbon_objects", "cbam_reference_search", "cbam_report_search", "cbam_report_read", "cbam_factory_read", "cbam_factory_save", "cbam_report_save", "cbam_process_manage", "cbam_precursor_manage", "cbam_source_flow_manage", "cbam_heat_power_update", "cbam_product_data_update", "cbam_sale_product_manage", "cbam_carbon_tax_manage", "cbam_data_quality_update", "cbam_report_generate", "cbam_document_read", "cbam_document_publish", "user_memory_recall", "user_memory_get", "user_memory_upsert", "user_memory_forget", "project_memory_recall", "project_memory_get", "project_memory_upsert", "project_memory_forget", "project_overview", "project_member_list", "project_task_search", "project_task_read", "project_session_search", "project_session_read", "project_calculation_search", "project_calculation_read", "project_emission_source_read", "project_enterprise_source_search", "project_enterprise_source_read", "project_enterprise_task_create", "modeling_re_modeling", "modeling_detail", "modeling_account_detail", "modeling_account_update_structured", "modeling_emission_detail", "modeling_emission_add_structured", "modeling_emission_batch_add_structured", "modeling_emission_update_structured", "modeling_emission_batch_update_structured", "modeling_emission_delete_structured", "modeling_execute_structured", "report_generate", "report_regenerate", "report_detail", "factor_search", "unit_list", "company_org_subject_query", "company_org_subject_batch_add", "company_org_subject_batch_update", "enterprise_computation_exists", "enterprise_computation_create_or_update", "enterprise_computation_batch_add", "enterprise_computation_batch_delete", "enterprise_computation_update_base_info", "enterprise_computation_detail", "enterprise_computation_period_list", "enterprise_emission_category_list", "enterprise_report_org_tree", "enterprise_report_generate", "enterprise_report_regenerate", "enterprise_report_file_record_retry", "enterprise_emission_batch_save", "enterprise_emission_batch_update", "enterprise_emission_batch_delete"];
4
4
  export declare const descriptions: Record<string, string>;
5
- export type BodyKind = "agentSkill" | "cbam" | "sessionContext" | "projectRead" | "projectEnterpriseTaskCreate" | "userMemoryRecall" | "userMemoryGet" | "userMemoryUpsert" | "projectMemoryUpsert" | "userMemoryForget" | "workspaceFile" | "multipartArtifact" | "factorSearch" | "singleEmissionAdd" | "enterpriseReport" | "enterpriseEmissionSave" | "enterpriseEmissionUpdate" | "enterprisePeriodList";
5
+ export type BodyKind = "agentSkill" | "cbam" | "cbamMonitor" | "sessionContext" | "projectRead" | "projectEnterpriseTaskCreate" | "userMemoryRecall" | "userMemoryGet" | "userMemoryUpsert" | "projectMemoryUpsert" | "userMemoryForget" | "workspaceFile" | "multipartArtifact" | "factorSearch" | "singleEmissionAdd" | "enterpriseReport" | "enterpriseEmissionSave" | "enterpriseEmissionUpdate" | "enterprisePeriodList";
6
6
  export type RoutePath = string | ((args: Record<string, unknown>) => string);
7
7
  export interface ToolRoute {
8
8
  method: "GET" | "POST";
@@ -24,7 +24,7 @@ export declare function buildFactorSearchBody(args: Record<string, unknown>): {
24
24
  messageId: unknown;
25
25
  traceId: unknown;
26
26
  taskId: unknown;
27
- accountingType: unknown;
27
+ accountingType: string;
28
28
  name: string;
29
29
  lang: string;
30
30
  };
package/dist/tools.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { z } from "zod";
2
2
  import { createHash } from "node:crypto";
3
3
  import * as apipath from "./apipath.js";
4
+ import { monitorSchemas, monitorToolNames, monitorRoutes, monitorDescriptions, buildMonitorBody } from "./monitor-tools.js";
4
5
  import { enterpriseEmissionSaveFactorContract, enterpriseEmissionUpdateFactorContract, ToolInputValidationError, validateEnterpriseFactorContract, } from "./tool-validation.js";
5
6
  const sessionId = z
6
7
  .string()
@@ -993,8 +994,11 @@ const cbamDataQuality = z.object({
993
994
  supplement: optionalBlankableString(z.string().max(5000)),
994
995
  });
995
996
  export const schemas = {
997
+ ...monitorSchemas,
996
998
  session_carbon_objects: z.object({
997
999
  sessionId,
1000
+ monitorPageNum: z.number().int().min(1).max(100000).optional().describe("监测计划/材料任务独立分页,从 1 开始。"),
1001
+ monitorPageSize: z.number().int().min(1).max(50).optional().describe("监测摘要默认 20、最多 50;不影响其他业务数组。"),
998
1002
  module: z
999
1003
  .enum(["all", "footprint3", "enterprise", "cbam"])
1000
1004
  .optional()
@@ -1437,8 +1441,8 @@ export const schemas = {
1437
1441
  factor_search: z.object({
1438
1442
  sessionId,
1439
1443
  ...skillTraceFields,
1440
- accountingType: z.enum(["PRODUCT", "ENTERPRISE"]).describe("Required accounting context for factor-source priority. Use PRODUCT for product-carbon/PCF modeling and ENTERPRISE for enterprise-carbon/GHG accounting. Never omit this field: the backend defaults an omitted value to product-carbon priority."),
1441
- name: z.string().min(1).describe("Single CCDB factor search keyword. The backend accepts one keyword per call. Call factor_search only when the user has not provided a suitable reference factor for the emission source or transport segment. If the user provided a suitable factor, pass it directly as factor instead of searching. For normal factors, call factor_search repeatedly with Chinese keywords, English keywords, material synonyms, process names, and product category terms. For transport factors, do not search as a generic carbon Q&A. If the user provides a specific transport tool, search that exact tool first. For road freight with no explicit tool, default to 中型柴油货车运输(载重8t); useful road freight keywords are 中型柴油货车运输(载重8t), 轻型柴油货车运输(载重2t), 重型柴油货车运输. For PRODUCT, use the selected result id as factor.factorId or transport[].factor.factorId. For ENTERPRISE, use it as sourceList[].factorId in enterprise_emission_batch_save or enterprise_emission_batch_update and omit custom factorGasList. If the selected result is Ecoinvent or its factor value is encrypted/masked, do not copy the factor value into modeling or update requests; pass the authoritative library factorId only."),
1444
+ accountingType: z.enum(["PRODUCT", "ENTERPRISE"]).default("PRODUCT").describe("Optional factor-source priority context. Omit it for a standalone CCDB lookup or use PRODUCT for product-carbon/PCF work; use ENTERPRISE only for enterprise-carbon/GHG accounting. Standalone lookup defaults to PRODUCT."),
1445
+ name: z.string().min(1).describe("Single CCDB factor search keyword. Use factor_search whenever the user asks to find, query, match, compare, verify, or select an emission factor, including standalone factor questions outside a modeling workflow. The backend accepts one keyword per call. For normal factors, search useful Chinese/English names, material synonyms, process names, or product category terms and compare returned rows when needed. For transport factors, use a specific vehicle or transport-factor name; when road freight has no explicit vehicle, start with 中型柴油货车运输(载重8t). For PRODUCT modeling, use the selected result id as factor.factorId or transport[].factor.factorId. For ENTERPRISE, use it as sourceList[].factorId and omit custom factorGasList. If the selected result is Ecoinvent or its value is encrypted/masked, use the authoritative library factorId without copying or guessing the value."),
1442
1446
  factorScope: z.union([z.number(), z.string().regex(/^\d+$/, "Expected a numeric factorScope string")]).optional().describe("Optional factor source preference. Use code values only: 1=Ecoinvent, 2=domestic factors, 3=any source. If omitted, the backend defaults to 3. When 1 or 2 has no result, the backend automatically falls back to 3; the Agent must not retry fallback itself."),
1443
1447
  lang: z.string().optional().describe("Result language. Use zh by default, or en for English results."),
1444
1448
  }),
@@ -1595,6 +1599,7 @@ export const schemas = {
1595
1599
  };
1596
1600
  schemas.enterprise_report_regenerate = schemas.enterprise_report_generate;
1597
1601
  export const exposedToolNames = [
1602
+ ...monitorToolNames,
1598
1603
  "session_carbon_objects",
1599
1604
  "cbam_reference_search",
1600
1605
  "cbam_report_search",
@@ -1669,7 +1674,8 @@ export const exposedToolNames = [
1669
1674
  "enterprise_emission_batch_delete",
1670
1675
  ];
1671
1676
  export const descriptions = {
1672
- session_carbon_objects: "Recover product-carbon accounts, enterprise-carbon computations, and CBAM reports bound to the current Agent session. Call this before guessing a lost business id. Omit module or use all for every family; module=footprint3 returns productCarbonAccounts, module=enterprise returns enterpriseCarbonComputations, and module=cbam returns cbamReports. One session may contain multiple CBAM reports, so match by reportName/org/factory and then pass the exact cbamReports[].reportId to every report-specific tool. Never substitute an enterprise year, product accountId, or another report id. This tool is read-only and requires sessionId.",
1677
+ ...monitorDescriptions,
1678
+ session_carbon_objects: "Recover product-carbon accounts, enterprise-carbon computations, and CBAM reports bound to the current Agent session. Call this before guessing a lost business id. Omit module or use all for every family; module=footprint3 returns productCarbonAccounts, module=enterprise returns enterpriseCarbonComputations, and module=cbam returns cbamReports. One session may contain multiple CBAM reports, so match by reportName/org/factory and then pass the exact cbamReports[].reportId to every report-specific tool. Never substitute an enterprise year, product accountId, or another report id. When monitoring v1.1 is enabled, all/cbam also returns monitorPlans, monitorIntakes, activeMonitorPlanId and activeIntakeId; use monitorPageNum/monitorPageSize for their independent page metadata. Resume pending binding and failed material application steps before automatic progress display. Truncated intake steps expose an internal recovery reference for the host Agent. monitorPlans[].planId is a separate monitoring-plan identity. This tool is read-only and requires sessionId.",
1673
1679
  cbam_reference_search: "Read CBAM reference data needed for the current step: accessible organizations and factories, countries, currencies, enum codes, product categories, default processes/precursors/products/CN/sale data, or report-scoped carbon-tax candidates. Request only needed types. Use returned ids/codes exactly and never invent dictionary or organization values. CARBON_TAX_CANDIDATE requires reportId and is returned directly at carbonTaxCandidates (not data.data). It includes products, emission/benchmark type mappings, benchmark rows, taxTypeOptions, offsetMethodOptions, currencyOptions, report-year inputDefaults, requiredUserInputs, and conditionalRules. Apply inputDefaults and continue without asking when requiredUserInputs is empty. currencyOptions.value is the request dictionary code and currencyOptions.unit is the displayed ISO unit. Pass a selected saleProductId to receive precursorOptions; also pass emissionValueType=1 (actual) or 2 (default) to receive valid emissionOptions. Benchmark record id and type are independent: type=1 reads bmgStar/BMg*, type=2 reads bmg/BMg. Large reference tables are paginated with pageNum/pageSize. Read-only.",
1674
1680
  cbam_report_search: "Search CBAM reports accessible to the current user by optional name, organization, factory, year, and pagination. Use this or session_carbon_objects to resolve an exact reportId. A single Agent session can create and work with multiple CBAM reports; never silently select the first result when several reports match. Read-only.",
1675
1681
  cbam_report_read: "Unified read-only CBAM report inspection. view=snapshot returns workflow overview/counts/readiness; section returns one complete editable section and requires section; item reads one child record and requires itemType+itemId; result returns result analysis; readiness returns generation blockers/warnings; carbon_tax_status returns the authoritative result-calculation state. itemId must belong to reportId. Call the corresponding read view before a full-form update so unchanged fields are preserved. CRITICAL STATUS RULES: readiness.canGenerate=true means report generation is allowed even when complete=false or warnings exist; only readiness.blockers prevent generation. Sale-product unit and unitName are read-only display values derived by the backend from the linked process/category and are never sale-product persistence inputs; null values from a legacy projection must not be treated as missing user input or a generation blocker. In sale-product results, calVersion is a status enum (0=not calculated, 1=running, 2=completed, 3=stale/version inconsistent), not a numeric calculation version and must never be compared numerically with updateVersion. If sale-product emissions are null or carbon_tax_status is NOT_CALCULATED/STALE, do not declare the workflow blocked: request approval and call cbam_carbon_tax_manage action=calculate, then poll this tool with view=carbon_tax_status and reread view=result.",
@@ -1724,7 +1730,7 @@ export const descriptions = {
1724
1730
  report_generate: "为已有产品碳足迹账户生成新的报告。仅当用户明确要求生成报告、报告文件,或明确要求将排放源清单、生命周期阶段占比、材料占比、图表、结论、分析等内容整理进报告时调用本工具。不要用于普通查询、口头分析、查看清单或查看占比。需要 accountId 和 idempotencyKey;用户对报告内容的自然语言要求放入 input.content。",
1725
1731
  report_regenerate: "重新生成已有产品碳足迹报告。仅当用户明确要求重新生成报告、更新报告文件,或明确要求将排放源清单、生命周期阶段占比、材料占比、图表、结论、分析等内容补充进已有报告时调用本工具。不要用于普通查询、口头分析、查看清单或查看占比。需要 reportId 和 idempotencyKey;用户对重新生成报告的自然语言要求放入 input.content。",
1726
1732
  report_detail: "Get product carbon report detail and latest report URL.",
1727
- factor_search: "Search CCDB emission factors before selecting factorId for structured modeling. accountingType is required: use PRODUCT for product-carbon/PCF workflows and ENTERPRISE for enterprise-carbon/GHG workflows so the backend applies the correct factor-source priority profile; never omit it or use the other workflow's value. Call this tool only when the user has not provided a suitable reference factor for the emission source or transport segment. If the user provided a suitable factor, pass that factor directly to the corresponding structured write tool and do not search. The backend accepts one keyword per call. Pass factorScope when the modeling task has a factor source preference: 1=Ecoinvent, 2=domestic factors, 3=any source. Do not implement fallback in Agent; when factorScope=1 or 2 returns no result, the backend automatically falls back to factorScope=3. For normal factors, call this tool multiple times with Chinese keywords, English keywords, material synonyms, process names, and product category terms, then compare returned rows. For transport factors, use transport-specific keywords instead of generic Q&A terms: if the user gives a specific transport tool, search that tool; otherwise for default road freight search 中型柴油货车运输(载重8t) first, then 轻型柴油货车运输(载重2t) or 重型柴油货车运输 if context indicates light/heavy truck. For PRODUCT, use a returned id as factor.factorId or transport[].factor.factorId in modeling_execute_structured or the product structured update tools. For ENTERPRISE, use a returned id as sourceList[].factorId in enterprise_emission_batch_save or enterprise_emission_batch_update; a library factorId is authoritative, so omit factorGasList and custom factor snapshot fields. In product update tools, normal library factors still need full snapshot fields; Ecoinvent or encrypted/masked factor rows must be passed as sourceType=library plus factorId only, optionally factorPattern=2, without copying or guessing factor values. The MCP server signs requests for /queryFactorListAgent.",
1733
+ factor_search: "Search CCDB emission factors for standalone lookup, comparison, verification, selection, and structured modeling. Use this tool whenever the user asks for an emission/carbon factor instead of substituting a general web search. accountingType is optional: omit it for standalone lookup or use PRODUCT for product-carbon/PCF work; use ENTERPRISE only for enterprise-carbon/GHG work. Standalone lookup defaults to PRODUCT so the backend applies a stable factor-source priority profile. The backend accepts one keyword per call. Pass factorScope when the user has a source preference: 1=Ecoinvent, 2=domestic factors, 3=any source; the backend handles fallback from 1 or 2 to 3. Search Chinese/English names, material synonyms, process names, or product categories and compare rows when needed. For transport factors, prefer a specific vehicle/tool; when road freight has no explicit vehicle, search 中型柴油货车运输(载重8t) first. For PRODUCT modeling, use a returned id as factor.factorId or transport[].factor.factorId. For ENTERPRISE modeling, use it in enterprise_emission_batch_save or enterprise_emission_batch_update as sourceList[].factorId and omit factorGasList/custom snapshot fields. Ecoinvent or encrypted/masked rows must be referenced by authoritative factorId without copying or guessing values. Results include exact string factorId and Carbon Agent detailUrl for the UI. The MCP server signs requests for /queryFactorListAgent.",
1728
1734
  unit_list: "Get the Agent unit dictionary before product-carbon or enterprise-carbon structured modeling. The backend returns factorUnitM items: dictLabel=preferred unit label, dictValue=unit code, id=unit dictionary id, and sourceName=unit category. Prefer dictLabel or dictValue for product unitName, product emission source unitName, enterprise activityUnit, or enterprise custom factorUnitM. Enterprise emission APIs also normalize common aliases, but do not invent units when the dictionary already provides one. For product transport unitName, choose only mass units by sourceName; transport distance remains kilometer. Supports optional lang.",
1729
1735
  company_org_subject_query: "List existing enterprise carbon organization subjects for the current Agent session. Call this first in enterprise carbon workflows to confirm whether a user-mentioned subject already exists. Calls /companyOrg/agent/orgNames. Requires sessionId.",
1730
1736
  company_org_subject_batch_add: "Batch create or match enterprise carbon organization subjects. Use this when a user names a subject that does not exist yet. Each orgList item may include superiorsShares as the superior ownership percentage; omit it to default to 100. Use orgList with one item for a single subject; /companyOrg/agent/add is not exposed. Calls /companyOrg/agent/batchAdd. Requires idempotencyKey.",
@@ -1752,6 +1758,7 @@ const enterpriseReportPeriodRule = "CRITICAL PERIOD RULE: calculatePeriod is the
1752
1758
  descriptions.enterprise_report_generate = enterpriseReportPeriodRule + descriptions.enterprise_report_generate;
1753
1759
  descriptions.enterprise_report_regenerate = enterpriseReportPeriodRule + descriptions.enterprise_report_regenerate;
1754
1760
  export const toolRoutes = {
1761
+ ...monitorRoutes,
1755
1762
  session_carbon_objects: {
1756
1763
  method: "POST",
1757
1764
  path: apipath.SessionBusinessRefs(),
@@ -2222,6 +2229,8 @@ export const toolRoutes = {
2222
2229
  },
2223
2230
  };
2224
2231
  export function buildBody(route, args) {
2232
+ if (route.bodyKind === "cbamMonitor")
2233
+ return buildMonitorBody(args);
2225
2234
  if (route.bodyKind === "cbam") {
2226
2235
  const body = { ...args };
2227
2236
  const action = body.action;
@@ -2271,6 +2280,8 @@ export function buildBody(route, args) {
2271
2280
  sessionId: args.sessionId,
2272
2281
  // The Agent-facing module is CBAM; the existing Java contract still uses cbam2.
2273
2282
  module: args.module === "cbam" ? "cbam2" : args.module,
2283
+ monitorPageNum: args.monitorPageNum,
2284
+ monitorPageSize: args.monitorPageSize,
2274
2285
  });
2275
2286
  }
2276
2287
  if (route.bodyKind === "projectRead") {
@@ -2577,6 +2588,10 @@ function normalizeDecimalValue(value) {
2577
2588
  return Number(normalized);
2578
2589
  }
2579
2590
  export function validateToolArgs(name, args) {
2591
+ if (name.startsWith("cbam_monitor_")) {
2592
+ schemas[name]?.parse(args);
2593
+ return;
2594
+ }
2580
2595
  if (name.startsWith("cbam_")) {
2581
2596
  validateCbamArgs(name, args);
2582
2597
  return;
@@ -3070,7 +3085,7 @@ export function buildFactorSearchBody(args) {
3070
3085
  messageId: args.messageId,
3071
3086
  traceId: args.traceId,
3072
3087
  taskId: args.taskId,
3073
- accountingType: args.accountingType,
3088
+ accountingType: args.accountingType === "ENTERPRISE" ? "ENTERPRISE" : "PRODUCT",
3074
3089
  name,
3075
3090
  lang,
3076
3091
  ...(factorScope !== undefined && factorScope !== null ? { factorScope } : {}),