@sema-agent/server 7.133.0 → 7.134.0
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.
- package/MIGRATION.md +87 -0
- package/README.md +2 -2
- package/README.zh-CN.md +2 -2
- package/USAGE.md +129 -11
- package/deploy/sema-up/README.md +16 -0
- package/deploy/sema-up/chart/Chart.yaml +1 -1
- package/deploy/sema-up/chart/templates/NOTES.txt +15 -0
- package/deploy/sema-up/chart/templates/_helpers.tpl +129 -0
- package/deploy/sema-up/chart/templates/sealed-key.yaml +24 -0
- package/deploy/sema-up/chart/templates/server-v4pro.yaml +14 -0
- package/deploy/sema-up/chart/templates/server.yaml +14 -0
- package/deploy/sema-up/chart/values-full-single.yaml +5 -1
- package/deploy/sema-up/chart/values.yaml +34 -0
- package/dist/approval-ask-audit-store.d.ts +1 -1
- package/dist/approval-card.d.ts +4 -4
- package/dist/approval-card.js +1 -2
- package/dist/approval-content-kind.d.ts +5 -2
- package/dist/approval-content-kind.js +16 -3
- package/dist/approval-gate-currency.d.ts +72 -0
- package/dist/approval-gate-currency.js +94 -0
- package/dist/approval.d.ts +6 -0
- package/dist/approval.js +31 -14
- package/dist/boot/coordinators.d.ts +6 -1
- package/dist/boot/coordinators.js +6 -3
- package/dist/boot/leader.d.ts +2 -0
- package/dist/boot/leader.js +2 -1
- package/dist/boot/read-deny-anchor-audit.js +2 -2
- package/dist/boot/runner-deps.d.ts +18 -5
- package/dist/boot/runner-deps.js +9 -0
- package/dist/boot/stage-06-runners.d.ts +4 -3
- package/dist/boot/stage-06-runners.js +15 -2
- package/dist/boot/stage-07-capability-layer.d.ts +2 -1
- package/dist/boot/stage-08-reapers.d.ts +2 -1
- package/dist/boot/stage-09-leader.d.ts +2 -1
- package/dist/boot/stage-09-leader.js +2 -2
- package/dist/boot/stage-10-http-server.d.ts +2 -1
- package/dist/boot/stage-10-http-server.js +2 -1
- package/dist/boot/stores.d.ts +8 -0
- package/dist/boot/stores.js +8 -12
- package/dist/boot/web-admin.d.ts +6 -0
- package/dist/boot/web-admin.js +11 -2
- package/dist/budget.js +5 -1
- package/dist/caller-text-echo.d.ts +2 -0
- package/dist/caller-text-echo.js +2 -1
- package/dist/canonical-json.d.ts +2 -41
- package/dist/canonical-json.js +2 -13
- package/dist/capabilities/composite-members.d.ts +1 -1
- package/dist/capabilities/composite-members.js +1 -1
- package/dist/capabilities/mcp-probe.js +2 -2
- package/dist/capability-facts.d.ts +2 -0
- package/dist/capability-facts.js +4 -4
- package/dist/checkpoint-ctx-seal-m28.d.ts +42 -0
- package/dist/checkpoint-ctx-seal-m28.js +19 -0
- package/dist/field-conflict.d.ts +2 -1
- package/dist/field-conflict.js +1 -0
- package/dist/file-history-disclosure.d.ts +34 -5
- package/dist/file-history-disclosure.js +2 -2
- package/dist/fleet/fleet-bus.d.ts +4 -0
- package/dist/fleet/fleet-bus.js +1 -0
- package/dist/hooks/hook-runner.js +2 -2
- package/dist/http/admission.js +8 -0
- package/dist/http/approval-sweeps.js +3 -1
- package/dist/http/checkpoint-ctx.d.ts +157 -2
- package/dist/http/checkpoint-ctx.js +158 -2
- package/dist/http/dispatch.js +3 -3
- package/dist/http/durable-run-leg.js +3 -2
- package/dist/http/idempotency.d.ts +2 -2
- package/dist/http/idempotency.js +2 -2
- package/dist/http/principal-gate.d.ts +32 -6
- package/dist/http/principal-gate.js +27 -4
- package/dist/http/refusal-body.d.ts +12 -0
- package/dist/http/refusal-body.js +11 -0
- package/dist/http/request-guards.d.ts +0 -9
- package/dist/http/request-guards.js +2 -16
- package/dist/http/resume-ctx-read.d.ts +48 -1
- package/dist/http/resume-ctx-read.js +26 -3
- package/dist/http/resume-legs.d.ts +2 -1
- package/dist/http/resume-legs.js +37 -22
- package/dist/http/route-ctx.d.ts +0 -9
- package/dist/http/routes/agents-roster.js +2 -3
- package/dist/http/routes/approvals-assistant.js +43 -9
- package/dist/http/routes/capabilities.js +1 -1
- package/dist/http/routes/diagnostics.d.ts +3 -3
- package/dist/http/routes/diagnostics.js +1 -1
- package/dist/http/routes/fleet.js +4 -4
- package/dist/http/routes/memory-origin.d.ts +1 -1
- package/dist/http/routes/rules.js +4 -4
- package/dist/http/routes/runs.js +30 -9
- package/dist/http/routes/session-sync.d.ts +3 -2
- package/dist/http/routes/session-sync.js +38 -20
- package/dist/http/routes/sessions-list.d.ts +1 -1
- package/dist/http/routes/sessions-list.js +3 -4
- package/dist/http/routes/sessions.js +4 -4
- package/dist/http/routes/tasks.js +21 -16
- package/dist/http/routes/trace-usage.js +7 -9
- package/dist/http/run-declared-families.d.ts +16 -0
- package/dist/http/run-declared-families.js +12 -0
- package/dist/http/server.d.ts +6 -0
- package/dist/http/server.js +5 -2
- package/dist/http/submit-ctx.d.ts +4 -3
- package/dist/http/submit-ctx.js +19 -3
- package/dist/http/wire-types.d.ts +7 -3
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/leader/wire.d.ts +4 -0
- package/dist/leader/wire.js +8 -7
- package/dist/main.js +1 -1
- package/dist/memory-origin-fence.js +2 -2
- package/dist/model-compat.d.ts +1 -1
- package/dist/observability/prompt-manifest.d.ts +19 -8
- package/dist/observability/prompt-manifest.js +9 -8
- package/dist/observability/tool-trace.js +8 -9
- package/dist/orchestration/workflow-park-decision.d.ts +1 -1
- package/dist/orchestration/workflow-park-decision.js +1 -0
- package/dist/parked-decide.d.ts +4 -5
- package/dist/parked-decide.js +3 -1
- package/dist/permission-rule-vocab.d.ts +1 -23
- package/dist/permission-rule-vocab.js +0 -13
- package/dist/plugins/approval-payload-fingerprint.d.ts +14 -6
- package/dist/plugins/approval-payload-fingerprint.js +1 -1
- package/dist/plugins/caching-session-store.d.ts +1 -1
- package/dist/plugins/caching-session-store.js +4 -3
- package/dist/plugins/checkpoint-store-sql.d.ts +22 -1
- package/dist/plugins/checkpoint-store-sql.js +45 -1
- package/dist/plugins/local-checkpoint-store.d.ts +13 -2
- package/dist/plugins/local-checkpoint-store.js +26 -0
- package/dist/plugins/local-session-store.d.ts +12 -9
- package/dist/plugins/local-session-store.js +23 -14
- package/dist/plugins/local-session-window.d.ts +12 -6
- package/dist/plugins/local-session-window.js +1 -17
- package/dist/plugins/one-time-migrations.d.ts +11 -0
- package/dist/plugins/one-time-migrations.js +12 -0
- package/dist/plugins/permission-rule-store-file.js +10 -6
- package/dist/plugins/permission-rule-store-sql.js +8 -8
- package/dist/plugins/pg-session-storage.d.ts +1 -1
- package/dist/plugins/pg-session-storage.js +39 -17
- package/dist/plugins/remote-env-device.d.ts +14 -7
- package/dist/plugins/remote-env-device.js +23 -15
- package/dist/plugins/session-ownership.d.ts +11 -0
- package/dist/plugins/session-ownership.js +11 -0
- package/dist/plugins/session-placement.d.ts +12 -14
- package/dist/plugins/session-placement.js +2 -15
- package/dist/plugins/tidb-session-store.d.ts +1 -1
- package/dist/plugins/tidb-session-store.js +39 -17
- package/dist/request-tool-axes.d.ts +12 -0
- package/dist/request-tool-axes.js +20 -0
- package/dist/run-local.js +1 -0
- package/dist/runs.d.ts +2 -1
- package/dist/runs.js +4 -3
- package/dist/sealed-key.d.ts +32 -0
- package/dist/sealed-key.js +55 -1
- package/dist/security.d.ts +9 -7
- package/dist/session-error-wire.d.ts +12 -5
- package/dist/session-error-wire.js +4 -1
- package/dist/session-sync-kernel.d.ts +37 -10
- package/dist/session-sync-kernel.js +10 -0
- package/dist/task-a2a.js +4 -3
- package/dist/task-mcp.d.ts +2 -2
- package/dist/task-mcp.js +20 -8
- package/dist/task-settings.d.ts +5 -1
- package/dist/task-settings.js +1 -1
- package/dist/tool-approval.d.ts +151 -52
- package/dist/tool-approval.js +113 -20
- package/dist/tool-rule-names.d.ts +6 -0
- package/dist/trace/core-keyset-guard.d.ts +4 -3
- package/dist/trace/exit-seat.d.ts +13 -1
- package/dist/trace/exit-seat.js +55 -1
- package/dist/trace/ledger-events.d.ts +3 -1
- package/dist/trace/project.d.ts +18 -1
- package/dist/trace/project.js +16 -4
- package/dist/trace/redact.d.ts +6 -3
- package/dist/trace/redact.js +191 -23
- package/dist/trace/self-minted-wire.d.ts +4 -0
- package/dist/trace/self-minted-wire.js +1 -0
- package/dist/trace/wire-projection-faces.d.ts +6 -0
- package/dist/trace/wire-projection-faces.js +6 -0
- package/dist/web-admin-client/skills-mcp.d.ts +1 -1
- package/dist/web-admin-client/skills-mcp.js +2 -3
- package/dist/web-admin-client/types.d.ts +1 -1
- package/package.json +2 -2
- package/scripts/drain-check-local.mjs +34 -2
- package/scripts/drain-check.mysql.sql +20 -2
- package/scripts/drain-check.pg.sql +20 -2
- package/dist/mcp-tool-faces.d.ts +0 -69
- package/dist/mcp-tool-faces.js +0 -104
package/dist/mcp-tool-faces.d.ts
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `McpServerSpec.toolFaces` —— MCP 工具的**面覆盖层**(core 7.8.0 [ref] §1.1/§2.7;声明面
|
|
3
|
-
* settings-schema 1.9.0)。一条规则、三条腿共用(请求腿 `task-mcp.ts normalizeServer` / center 腿
|
|
4
|
-
* `web-admin-client/skills-mcp.ts resolveMcpServers` / 本地 config.d 腿 `config-provider.ts` 只做承载),
|
|
5
|
-
* 与 {@link import("./mcp-source-label.js").readMcpSourceLabel} 同一个「判据单点、三腿一致」的形。
|
|
6
|
-
*
|
|
7
|
-
* ## 分工(为什么本层**不**复述 core 的那张表)
|
|
8
|
-
* 覆盖层的**语义**校验属 core 的摄入侧,而且只有它做得了:`pathTarget.param` 是不是这只工具**物化后
|
|
9
|
-
* schema** 的顶层属性、审批卡要的键在不在、`ruleFace` 指的是不是标量键 —— 三件都要看远端 server 真发
|
|
10
|
-
* 回来的 schema,本层手里根本没有。core 的处置也已经定死:不合 ⇒ **这只工具在这条腿上不挂**,并通告
|
|
11
|
-
* 一次 `config.tool_face_invalid`(亲读 `dist/core/runner/tool-face-overlay.js` 的 `return undefined` 臂 ——
|
|
12
|
-
* 该文件 d.ts 头注里那句「the tool mounts BARE」是**过期**的,以实现为准)。
|
|
13
|
-
*
|
|
14
|
-
* 本层因此只做 core 的校验器**假定成立**的那一件事:**JSON 结构合不合 TS 型**。理由是硬的 —— core 的
|
|
15
|
-
* `toolFaceProblem` 是按 TS 型写的,`renderHints.summaryParams` 是个字符串时它会 `.find is not a function`
|
|
16
|
-
* 地把 prepare 整条炸掉,`ruleFace.params` 是个数字时 `for...of` 直接抛。原样透传一份任意 JSON 不是
|
|
17
|
-
* 「解析透明」,是把类型错误变成运行期崩溃。
|
|
18
|
-
*
|
|
19
|
-
* 闭词(`family` / `pathTarget.access` / `renderHints.approvalCard`)判据**取自 core 的导出常量**
|
|
20
|
-
* (`TOOL_FAMILIES` / `TOOL_PATH_ACCESSES` / `TOOL_APPROVAL_CARDS`),本仓一个词都不枚举 —— 与
|
|
21
|
-
* `MCP_DELIVERY_VERDICTS` 的消费姿势同款:词表单一属主在 core,抄一遍就是抄了一张会漂的表。
|
|
22
|
-
*
|
|
23
|
-
* ## 坏形的方向:**整条 server 不进**(fail-closed)
|
|
24
|
-
* 🔴 这一条被 codex 对抗复审 r1 的 [high] **翻正过一次**,把翻正的理由留在这里,因为它是本模块最容易
|
|
25
|
-
* 想错的一格:初版按 `contentOrigin` 的先例判「丢声明、留 server + 留痕」,而那条先例管的是**放宽**键
|
|
26
|
-
* (丢它 ⇒ 回落到过度标记 = fail-closed 的那一侧)。`toolFaces` 是**收窄**声明:它声明的 `pathTarget`
|
|
27
|
-
* 正是敏感路径策略、写围栏、编辑跟踪读的那一格 —— 丢掉它,那只工具就**无面挂载**,运维声明的保护
|
|
28
|
-
* 静默失效。codex 实测(同一只 MCP 写工具、同一个 `/work/.env` 目标,仅把 `renderHints.summaryParams`
|
|
29
|
-
* 从数组写成字符串):`createSensitivePathPolicy` 从 deny 变成 allow。一条 warn 补偿不了这个方向。
|
|
30
|
-
*
|
|
31
|
-
* 所以判据回到本仓对**收窄键**已经成文的那一条(`task-mcp.ts` 的 `allowTools`,[ref] / [ref] codex F1):
|
|
32
|
-
* **一个键在场就必须合法,否则这条 server 整条不进**。三问逐条:
|
|
33
|
-
* ① 谁需要 —— 在部署侧给 MCP 工具声明写围栏 / 审批卡 / 显示名的运维;
|
|
34
|
-
* ② 谁受伤 —— 覆盖层写错的那台 server:它**整条**不挂(请求腿进 `dropped` 并点名上报,center 腿跳过
|
|
35
|
-
* 该条、兄弟 server 照挂)。代价是真的(少一套工具),但它**响亮且立刻**;反方向的代价是一条
|
|
36
|
-
* **静默失效的安全声明**,而后者按 [ref] 不许存在于安全轴上;
|
|
37
|
-
* ③ 拿什么补偿 —— 报出来的名字本身:请求腿 `mcp_injection_dropped{dropped:[name]}`、center 腿
|
|
38
|
-
* `web_admin_mcp_tool_faces_invalid{server,problem,note}` 一条点名 warn(`problem` 里带工具名与哪一段不合;运维照着改那一行即可)。
|
|
39
|
-
* 每只工具的面是**整只**判(core 明写 "applied whole or not at all");而**任一只**判不出形 ⇒ 整条 server
|
|
40
|
-
* 不进 —— 「留下好的那几只」同样是让坏的那一只无面挂载,与整张丢没有区别。
|
|
41
|
-
*/
|
|
42
|
-
import { type McpServerSpec } from "@sema-agent/core";
|
|
43
|
-
type ToolFaces = NonNullable<McpServerSpec["toolFaces"]>;
|
|
44
|
-
/**
|
|
45
|
-
* 一条 server 条目的 `toolFaces` 判形结果:
|
|
46
|
-
* · `{ ok: true, faces }` —— 合形(`faces` 缺席 = 这台 server 没有覆盖层,或声明了一个**空**覆盖层:
|
|
47
|
-
* 两者对 core 同义,都不铸键);
|
|
48
|
-
* · `{ ok: false, problem }` —— 判不出形,**整条 server 不进**(方向与理由见模块头注),`problem` 是
|
|
49
|
-
* 给运维的一句点名(只带工具名与哪一段不合,不带面的值)。
|
|
50
|
-
*/
|
|
51
|
-
export type McpToolFacesRead = {
|
|
52
|
-
ok: true;
|
|
53
|
-
faces?: ToolFaces;
|
|
54
|
-
} | {
|
|
55
|
-
ok: false;
|
|
56
|
-
problem: string;
|
|
57
|
-
};
|
|
58
|
-
/**
|
|
59
|
-
* 从任一腿的原始条目里读出 `toolFaces` —— **三条腿共用的唯一判据点**。
|
|
60
|
-
* 缺席 ⇒ 合形无覆盖层;整只不是对象 / **任一只**工具的面判不出形 ⇒ `ok:false`(调用方整条 server 不收)。
|
|
61
|
-
*
|
|
62
|
-
* 🔴 工具名是 `__proto__` ⇒ 同样判不出形,**响亮拒**:按名存面的记录装不下它 —— JSON 的自有键 `"__proto__"` 写进记录那一步走的是原型的设置器,
|
|
63
|
-
* 键从结果里消失而判官答 `ok`,那条 server 照挂、收窄面叠层被无声丢掉。方向与本模块头注同(收窄声明在场就必须原样可用)。
|
|
64
|
-
* 只拒这一个名字:`constructor` / `toString` 等其余根原型成员名写进记录是普通自有键、不丢,引擎按名查面也取得到 —— 拒它们是给重放存量 body 的腿
|
|
65
|
-
* 新添一条「整条 server 不进」,不是修这个病。
|
|
66
|
-
*/
|
|
67
|
-
export declare function readMcpToolFaces(v: unknown): McpToolFacesRead;
|
|
68
|
-
export {};
|
|
69
|
-
//# sourceMappingURL=mcp-tool-faces.d.ts.map
|
package/dist/mcp-tool-faces.js
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import { TOOL_APPROVAL_CARDS, TOOL_FAMILIES, TOOL_PATH_ABSENCES, TOOL_PATH_ACCESSES, TOOL_PATH_BASES } from "@sema-agent/core";
|
|
2
|
-
import { isStringArray } from "@sema-agent/settings-schema";
|
|
3
|
-
import { quotedCallerText } from "./caller-text-echo.js";
|
|
4
|
-
function isRecord(v) {
|
|
5
|
-
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
6
|
-
}
|
|
7
|
-
function memberOf(table, v) {
|
|
8
|
-
return typeof v === "string" && table.includes(v);
|
|
9
|
-
}
|
|
10
|
-
function onlyKeys(rec, allowed) {
|
|
11
|
-
return Object.keys(rec).every((k) => allowed.includes(k));
|
|
12
|
-
}
|
|
13
|
-
function readOneFace(raw) {
|
|
14
|
-
if (!isRecord(raw))
|
|
15
|
-
return undefined;
|
|
16
|
-
if (!onlyKeys(raw, ["family", "pathTarget", "renderHints", "ruleFace"]))
|
|
17
|
-
return undefined;
|
|
18
|
-
const out = {};
|
|
19
|
-
if (raw.family !== undefined) {
|
|
20
|
-
if (!memberOf(TOOL_FAMILIES, raw.family))
|
|
21
|
-
return undefined;
|
|
22
|
-
out.family = raw.family;
|
|
23
|
-
}
|
|
24
|
-
if (raw.pathTarget !== undefined) {
|
|
25
|
-
const pt = raw.pathTarget;
|
|
26
|
-
if (!isRecord(pt) || typeof pt.param !== "string" || !memberOf(TOOL_PATH_ACCESSES, pt.access))
|
|
27
|
-
return undefined;
|
|
28
|
-
if (!onlyKeys(pt, ["param", "access", "aliases", "skillScopeEligible", "base", "absent", "patternParam"]))
|
|
29
|
-
return undefined;
|
|
30
|
-
if (pt.aliases !== undefined && !isStringArray(pt.aliases))
|
|
31
|
-
return undefined;
|
|
32
|
-
if (pt.skillScopeEligible !== undefined && typeof pt.skillScopeEligible !== "boolean")
|
|
33
|
-
return undefined;
|
|
34
|
-
if (pt.base !== undefined && !memberOf(TOOL_PATH_BASES, pt.base))
|
|
35
|
-
return undefined;
|
|
36
|
-
if (pt.absent !== undefined && !memberOf(TOOL_PATH_ABSENCES, pt.absent))
|
|
37
|
-
return undefined;
|
|
38
|
-
if (pt.patternParam !== undefined && typeof pt.patternParam !== "string")
|
|
39
|
-
return undefined;
|
|
40
|
-
out.pathTarget = {
|
|
41
|
-
param: pt.param,
|
|
42
|
-
access: pt.access,
|
|
43
|
-
...(pt.aliases !== undefined ? { aliases: pt.aliases } : {}),
|
|
44
|
-
...(pt.skillScopeEligible === true ? { skillScopeEligible: true } : {}),
|
|
45
|
-
...(pt.base !== undefined ? { base: pt.base } : {}),
|
|
46
|
-
...(pt.absent !== undefined ? { absent: pt.absent } : {}),
|
|
47
|
-
...(pt.patternParam !== undefined ? { patternParam: pt.patternParam } : {}),
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
if (raw.renderHints !== undefined) {
|
|
51
|
-
const rh = raw.renderHints;
|
|
52
|
-
if (!isRecord(rh) || !onlyKeys(rh, ["userFacingName", "activity", "summaryParams", "resultCards", "approvalCard"]))
|
|
53
|
-
return undefined;
|
|
54
|
-
if (rh.userFacingName !== undefined && typeof rh.userFacingName !== "string")
|
|
55
|
-
return undefined;
|
|
56
|
-
if (rh.activity !== undefined && typeof rh.activity !== "string")
|
|
57
|
-
return undefined;
|
|
58
|
-
if (rh.summaryParams !== undefined && !isStringArray(rh.summaryParams))
|
|
59
|
-
return undefined;
|
|
60
|
-
if (rh.resultCards !== undefined && !isStringArray(rh.resultCards))
|
|
61
|
-
return undefined;
|
|
62
|
-
if (rh.approvalCard !== undefined && !memberOf(TOOL_APPROVAL_CARDS, rh.approvalCard))
|
|
63
|
-
return undefined;
|
|
64
|
-
out.renderHints = {
|
|
65
|
-
...(rh.userFacingName !== undefined ? { userFacingName: rh.userFacingName } : {}),
|
|
66
|
-
...(rh.activity !== undefined ? { activity: rh.activity } : {}),
|
|
67
|
-
...(rh.summaryParams !== undefined ? { summaryParams: rh.summaryParams } : {}),
|
|
68
|
-
...(rh.resultCards !== undefined ? { resultCards: rh.resultCards } : {}),
|
|
69
|
-
...(rh.approvalCard !== undefined ? { approvalCard: rh.approvalCard } : {}),
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
if (raw.ruleFace !== undefined) {
|
|
73
|
-
const rf = raw.ruleFace;
|
|
74
|
-
if (!isRecord(rf) || !onlyKeys(rf, ["primaryParams", "params"]))
|
|
75
|
-
return undefined;
|
|
76
|
-
if (rf.primaryParams !== undefined && !isStringArray(rf.primaryParams))
|
|
77
|
-
return undefined;
|
|
78
|
-
if (rf.params !== undefined && !isStringArray(rf.params))
|
|
79
|
-
return undefined;
|
|
80
|
-
out.ruleFace = {
|
|
81
|
-
...(rf.primaryParams !== undefined ? { primaryParams: rf.primaryParams } : {}),
|
|
82
|
-
...(rf.params !== undefined ? { params: rf.params } : {}),
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
return out;
|
|
86
|
-
}
|
|
87
|
-
export function readMcpToolFaces(v) {
|
|
88
|
-
if (v === undefined)
|
|
89
|
-
return { ok: true };
|
|
90
|
-
if (!isRecord(v))
|
|
91
|
-
return { ok: false, problem: `toolFaces is ${Array.isArray(v) ? "an array" : typeof v}, not an object of per-tool faces` };
|
|
92
|
-
const faces = {};
|
|
93
|
-
for (const [tool, raw] of Object.entries(v)) {
|
|
94
|
-
if (tool === "__proto__") {
|
|
95
|
-
return { ok: false, problem: `toolFaces names tool "__proto__" — a per-tool record cannot hold a face under that name (writing it sets the record's prototype instead of a key), so the declaration would silently vanish` };
|
|
96
|
-
}
|
|
97
|
-
const face = readOneFace(raw);
|
|
98
|
-
if (face === undefined)
|
|
99
|
-
return { ok: false, problem: `the declared face for tool ${quotedCallerText(tool)} does not fit the tool-face shape` };
|
|
100
|
-
faces[tool] = face;
|
|
101
|
-
}
|
|
102
|
-
return Object.keys(faces).length > 0 ? { ok: true, faces } : { ok: true };
|
|
103
|
-
}
|
|
104
|
-
//# sourceMappingURL=mcp-tool-faces.js.map
|