@sema-agent/server 7.136.0 → 7.138.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 +501 -139
- package/README.md +1 -0
- package/README.zh-CN.md +1 -0
- package/USAGE.md +149 -34
- package/deploy/sema-up/README.md +14 -0
- package/deploy/sema-up/chart/templates/sandbox-rbac.yaml +7 -1
- package/deploy/sema-up/stack/sema-stack-cluster.yaml +7 -1
- package/dist/approval-card.d.ts +21 -14
- package/dist/approval-card.js +1 -0
- package/dist/approval-content-kind.d.ts +6 -0
- package/dist/approval-content-kind.js +7 -0
- package/dist/approval-gate-currency.d.ts +48 -6
- package/dist/approval-gate-currency.js +16 -9
- package/dist/approval-hmac.d.ts +13 -1
- package/dist/approval-hmac.js +1 -1
- package/dist/approval.js +3 -3
- package/dist/audit.js +1 -0
- package/dist/auth-bridge.js +2 -2
- package/dist/background-agent-name.d.ts +5 -0
- package/dist/background-agent-name.js +5 -0
- package/dist/boot/budget-tracing.d.ts +1 -12
- package/dist/boot/deployment-mods.d.ts +46 -16
- package/dist/boot/deployment-mods.js +82 -6
- package/dist/boot/execution-env.d.ts +24 -1
- package/dist/boot/execution-env.js +69 -6
- package/dist/boot/governance-seams.d.ts +10 -17
- package/dist/boot/governance-seams.js +5 -17
- package/dist/boot/leader.d.ts +3 -0
- package/dist/boot/leader.js +1 -0
- package/dist/boot/org-delivery.js +15 -2
- package/dist/boot/reapers.d.ts +3 -0
- package/dist/boot/reapers.js +15 -1
- package/dist/boot/resolve-spec.d.ts +7 -0
- package/dist/boot/resolve-spec.js +36 -26
- package/dist/boot/retention-lane.d.ts +11 -5
- package/dist/boot/retention-lane.js +2 -2
- package/dist/boot/runner-deps.d.ts +7 -3
- package/dist/boot/runner-deps.js +1 -0
- package/dist/boot/stage-03-store-backend.d.ts +1 -1
- package/dist/boot/stage-04-stores.d.ts +2 -13
- package/dist/boot/stage-05-execution-env.d.ts +6 -13
- package/dist/boot/stage-05-execution-env.js +17 -5
- package/dist/boot/stage-06-runners.d.ts +6 -13
- package/dist/boot/stage-06-runners.js +10 -3
- package/dist/boot/stage-07-capability-layer.d.ts +7 -13
- package/dist/boot/stage-07-capability-layer.js +3 -3
- package/dist/boot/stage-08-reapers.d.ts +7 -13
- package/dist/boot/stage-08-reapers.js +2 -1
- package/dist/boot/stage-09-leader.d.ts +7 -13
- package/dist/boot/stage-09-leader.js +2 -2
- package/dist/boot/stage-10-http-server.d.ts +7 -13
- package/dist/boot/stage-10-http-server.js +6 -3
- package/dist/boot/stores.d.ts +1 -1
- package/dist/boot/web-admin.d.ts +5 -2
- package/dist/boot/web-admin.js +3 -3
- package/dist/brain.js +5 -5
- package/dist/broker/broker.d.ts +89 -0
- package/dist/broker/broker.js +287 -0
- package/dist/broker/constants.d.ts +39 -0
- package/dist/broker/constants.js +15 -0
- package/dist/broker/http1.d.ts +111 -0
- package/dist/broker/http1.js +256 -0
- package/dist/broker/lease-book.d.ts +87 -0
- package/dist/broker/lease-book.js +142 -0
- package/dist/broker/lease-file.d.ts +60 -0
- package/dist/broker/lease-file.js +127 -0
- package/dist/broker/main.d.ts +2 -0
- package/dist/broker/main.js +20 -0
- package/dist/budget.d.ts +17 -15
- package/dist/budget.js +2 -2
- package/dist/capabilities/composite-members.d.ts +2 -1
- package/dist/capabilities/composite-members.js +2 -1
- package/dist/capabilities/engine-capabilities.js +1 -0
- package/dist/capabilities/mcp-probe.d.ts +36 -11
- package/dist/capabilities/mcp-probe.js +44 -5
- package/dist/capabilities/scenarios.d.ts +23 -8
- package/dist/capabilities/scenarios.js +13 -8
- package/dist/capabilities/skills.d.ts +28 -5
- package/dist/capabilities/skills.js +8 -0
- package/dist/capability-facts.d.ts +6 -0
- package/dist/capability-facts.js +5 -0
- package/dist/center-credential-renewer.js +5 -1
- package/dist/checkpoint-ctx-seal-m28.d.ts +3 -10
- package/dist/checkpoint-ctx-seal-m28.js +1 -1
- package/dist/checkpoint-identity.d.ts +13 -6
- package/dist/config-catalog.js +16 -7
- package/dist/config-types.d.ts +24 -7
- package/dist/config.d.ts +1 -1
- package/dist/config.js +42 -13
- package/dist/deployment-governance.d.ts +2 -2
- package/dist/deployment-governance.js +7 -9
- package/dist/deployment-shape.d.ts +6 -6
- package/dist/device-ws-protocol.d.ts +1 -0
- package/dist/device-ws-protocol.js +2 -1
- package/dist/file-history-disclosure.d.ts +4 -2
- package/dist/file-history-disclosure.js +2 -0
- package/dist/gate-settlement.d.ts +71 -0
- package/dist/gate-settlement.js +40 -0
- package/dist/hooks/classic-stations.d.ts +12 -54
- package/dist/hooks/classic-stations.js +1 -0
- package/dist/hooks/command-spawn.d.ts +2 -2
- package/dist/hooks/hook-runner.js +14 -14
- package/dist/http/admission.js +14 -9
- package/dist/http/approval-sweeps.js +4 -3
- package/dist/http/caller-trust.d.ts +2 -1
- package/dist/http/caller-trust.js +1 -3
- package/dist/http/checkpoint-ctx.d.ts +48 -7
- package/dist/http/checkpoint-ctx.js +40 -0
- package/dist/http/dispatch.d.ts +4 -0
- package/dist/http/dispatch.js +18 -10
- package/dist/http/durable-run-leg.d.ts +5 -1
- package/dist/http/durable-run-leg.js +5 -3
- package/dist/http/health-self-report.d.ts +2 -2
- package/dist/http/memory-compliance-failure-reply.js +3 -0
- package/dist/http/principal-gate.d.ts +15 -10
- package/dist/http/principal-gate.js +48 -9
- package/dist/http/resume-legs.d.ts +7 -31
- package/dist/http/resume-legs.js +185 -126
- package/dist/http/route-ctx.d.ts +38 -53
- package/dist/http/route-ctx.js +2 -5
- package/dist/http/routes/a2a-serve.js +10 -4
- package/dist/http/routes/agents-roster.d.ts +1 -1
- package/dist/http/routes/agents-roster.js +5 -1
- package/dist/http/routes/approvals-assistant.js +24 -10
- package/dist/http/routes/capabilities.js +23 -11
- package/dist/http/routes/mcp-reconnect.d.ts +3 -2
- package/dist/http/routes/mcp-reconnect.js +7 -7
- package/dist/http/routes/memory-consolidation.d.ts +1 -1
- package/dist/http/routes/memory-origin.d.ts +1 -1
- package/dist/http/routes/rules.js +3 -3
- package/dist/http/routes/runs.js +13 -8
- package/dist/http/routes/session-sync.js +42 -6
- package/dist/http/routes/sessions.js +6 -3
- package/dist/http/routes/side-query.js +2 -3
- package/dist/http/routes/tasks.js +794 -780
- package/dist/http/server.d.ts +35 -25
- package/dist/http/stored-body-replay.d.ts +3 -3
- package/dist/http/stored-body-replay.js +6 -1
- package/dist/http/wire-types.d.ts +66 -33
- package/dist/identity-source.d.ts +65 -0
- package/dist/identity-source.js +45 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/leader/wire.d.ts +7 -0
- package/dist/leader/wire.js +5 -4
- package/dist/mcp-assertion-header.d.ts +51 -40
- package/dist/mcp-assertion-header.js +10 -11
- package/dist/mcp-authorization-face.d.ts +27 -0
- package/dist/mcp-authorization-face.js +15 -0
- package/dist/memory-operator-faces.d.ts +13 -4
- package/dist/memory-operator-faces.js +1 -17
- package/dist/memory-store-refusal.d.ts +3 -3
- package/dist/memory-sync-client.js +72 -57
- package/dist/memory-sync.d.ts +1 -1
- package/dist/model-entry-refusal.d.ts +2 -0
- package/dist/model-entry-refusal.js +11 -0
- package/dist/model-route-gap.d.ts +6 -22
- package/dist/model-route-gap.js +7 -5
- package/dist/model-select.d.ts +6 -17
- package/dist/model-select.js +0 -3
- package/dist/mods-declaration.d.ts +110 -0
- package/dist/mods-declaration.js +109 -0
- package/dist/namespaced-rule-name.d.ts +1 -1
- package/dist/observability/err-text.d.ts +5 -0
- package/dist/observability/err-text.js +9 -0
- package/dist/observability/fail-open.d.ts +17 -1
- package/dist/observability/fail-open.js +17 -1
- package/dist/observability/metrics.js +1 -1
- package/dist/observability/run-terminal.js +1 -0
- package/dist/observability/secret-env-scrub.d.ts +1 -1
- package/dist/observability/secret-env-scrub.js +1 -1
- package/dist/operator-ask.d.ts +2 -2
- package/dist/org-delivery-gate.js +1 -1
- package/dist/org-memory-admission.d.ts +2 -2
- package/dist/org-memory-admission.js +39 -2
- package/dist/parked-decide.d.ts +15 -2
- package/dist/parked-decide.js +17 -10
- package/dist/peer-directory.js +2 -0
- package/dist/peer-seat.d.ts +150 -0
- package/dist/peer-seat.js +239 -0
- package/dist/permission-rule-list.d.ts +2 -2
- package/dist/permission-rule-vocab.d.ts +7 -7
- package/dist/permission-rule-vocab.js +3 -3
- package/dist/plain-string-record.d.ts +38 -0
- package/dist/plain-string-record.js +38 -0
- package/dist/plugins/background-agent-store-sql.js +6 -3
- package/dist/plugins/caching-session-store.d.ts +5 -0
- package/dist/plugins/caching-session-store.js +6 -0
- package/dist/plugins/checkpoint-store-sql.d.ts +34 -29
- package/dist/plugins/checkpoint-store-sql.js +14 -14
- package/dist/plugins/file-history-store-sql.js +10 -16
- package/dist/plugins/file-run-store.js +8 -2
- package/dist/plugins/k8s-exec-protocol.d.ts +69 -13
- package/dist/plugins/k8s-exec-protocol.js +116 -28
- package/dist/plugins/k8s-pod-delete-failure.d.ts +25 -0
- package/dist/plugins/k8s-pod-delete-failure.js +17 -0
- package/dist/plugins/k8s-pod-reaper.d.ts +106 -0
- package/dist/plugins/k8s-pod-reaper.js +122 -0
- package/dist/plugins/local-checkpoint-store.d.ts +4 -17
- package/dist/plugins/local-checkpoint-store.js +3 -4
- package/dist/plugins/local-session-store.d.ts +66 -27
- package/dist/plugins/local-session-store.js +60 -28
- package/dist/plugins/mailbox-store-sql.d.ts +11 -3
- package/dist/plugins/mailbox-store-sql.js +103 -15
- package/dist/plugins/memory-run-store.js +2 -0
- package/dist/plugins/memory-sync-store-pg.d.ts +16 -5
- package/dist/plugins/memory-sync-store-tidb.d.ts +3 -3
- package/dist/plugins/one-time-migrations.d.ts +34 -12
- package/dist/plugins/one-time-migrations.js +51 -9
- package/dist/plugins/permission-rule-store-file.js +2 -2
- package/dist/plugins/permission-rule-store-sql.d.ts +17 -17
- package/dist/plugins/permission-rule-store-sql.js +37 -30
- package/dist/plugins/pg-pool.js +4 -0
- package/dist/plugins/pg-session-storage.d.ts +10 -2
- package/dist/plugins/pg-session-storage.js +20 -7
- package/dist/plugins/remote-env-adb.d.ts +6 -1
- package/dist/plugins/remote-env-adb.js +2 -1
- package/dist/plugins/remote-env-device.d.ts +6 -1
- package/dist/plugins/remote-env-device.js +5 -1
- package/dist/plugins/remote-env-e2b.d.ts +5 -0
- package/dist/plugins/remote-env-e2b.js +2 -1
- package/dist/plugins/remote-env-file-error.d.ts +8 -1
- package/dist/plugins/remote-env-file-error.js +7 -1
- package/dist/plugins/remote-env-host.d.ts +10 -2
- package/dist/plugins/remote-env-host.js +8 -2
- package/dist/plugins/remote-env-k8s.d.ts +140 -11
- package/dist/plugins/remote-env-k8s.js +277 -15
- package/dist/plugins/remote-env-local-docker.d.ts +5 -0
- package/dist/plugins/remote-env-local-docker.js +2 -1
- package/dist/plugins/remote-env-ssh.d.ts +6 -1
- package/dist/plugins/remote-env-ssh.js +2 -1
- package/dist/plugins/retention-store-sql.d.ts +14 -2
- package/dist/plugins/retention-store-sql.js +6 -0
- package/dist/plugins/run-store-sql.js +10 -4
- package/dist/plugins/session-fork.d.ts +10 -13
- package/dist/plugins/session-fork.js +5 -25
- package/dist/plugins/session-ownership.d.ts +24 -3
- package/dist/plugins/session-ownership.js +24 -5
- package/dist/plugins/session-workspace-cell.d.ts +17 -0
- package/dist/plugins/session-workspace-cell.js +38 -0
- package/dist/plugins/sql-errors.d.ts +23 -2
- package/dist/plugins/sql-errors.js +15 -0
- package/dist/plugins/store-backend.js +7 -7
- package/dist/plugins/store-contracts.d.ts +10 -1
- package/dist/plugins/store-fault.d.ts +2 -2
- package/dist/plugins/store-fault.js +4 -2
- package/dist/plugins/tidb-pool.js +13 -0
- package/dist/plugins/tidb-session-store.d.ts +17 -2
- package/dist/plugins/tidb-session-store.js +18 -7
- package/dist/plugins/tool-result-store-sql.d.ts +13 -6
- package/dist/plugins/tool-result-store-sql.js +8 -7
- package/dist/plugins/worktree-isolation.d.ts +3 -2
- package/dist/plugins/worktree-isolation.js +1 -7
- package/dist/project-identity.d.ts +1 -14
- package/dist/project-identity.js +0 -4
- package/dist/request-key-closure.js +1 -1
- package/dist/request-value-closure.d.ts +31 -2
- package/dist/request-value-closure.js +7 -1
- package/dist/rule-entry-list.d.ts +3 -2
- package/dist/rule-entry-list.js +2 -2
- package/dist/rules-consent.js +12 -7
- package/dist/run-local.d.ts +2 -2
- package/dist/run-local.js +12 -6
- package/dist/runs.d.ts +7 -1
- package/dist/runs.js +8 -2
- package/dist/runtime-governance.d.ts +5 -5
- package/dist/sandbox-git-lease.d.ts +49 -0
- package/dist/sandbox-git-lease.js +60 -0
- package/dist/sandbox-git-plane.d.ts +84 -0
- package/dist/sandbox-git-plane.js +105 -0
- package/dist/security.d.ts +16 -4
- package/dist/security.js +8 -3
- package/dist/server-secret-env.d.ts +12 -3
- package/dist/server-secret-env.js +18 -2
- package/dist/session-error-wire.d.ts +14 -6
- package/dist/session-error-wire.js +2 -1
- package/dist/session-incarnation.d.ts +4 -5
- package/dist/session-incarnation.js +2 -2
- package/dist/session-policy-wire.d.ts +1 -1
- package/dist/session-policy-wire.js +2 -2
- package/dist/session-sync.d.ts +1 -1
- package/dist/session-workspace.d.ts +130 -0
- package/dist/session-workspace.js +83 -0
- package/dist/spec-fields.d.ts +44 -14
- package/dist/spec-fields.js +33 -12
- package/dist/standing-answer-grant.d.ts +2 -13
- package/dist/standing-answer-grant.js +0 -7
- package/dist/stored-request-prompt-profile-m30.d.ts +49 -0
- package/dist/stored-request-prompt-profile-m30.js +25 -0
- package/dist/task-a2a.d.ts +44 -14
- package/dist/task-a2a.js +46 -20
- package/dist/task-mcp.d.ts +34 -21
- package/dist/task-mcp.js +46 -22
- package/dist/task-settings.d.ts +2 -2
- package/dist/tool-approval.d.ts +43 -9
- package/dist/tool-approval.js +57 -15
- package/dist/tool-rule-names.d.ts +5 -0
- package/dist/trace/core-keyset-guard.d.ts +34 -19
- package/dist/trace/engine-notice-wire.d.ts +1 -1
- package/dist/trace/engine-notice-wire.js +4 -0
- package/dist/trace/exit-seat.d.ts +20 -1
- package/dist/trace/exit-seat.js +5 -2
- package/dist/trace/extension-call-face.d.ts +33 -0
- package/dist/trace/extension-call-face.js +39 -0
- package/dist/trace/ledger-sink.d.ts +4 -5
- package/dist/trace/ledger-sink.js +3 -7
- package/dist/trace/project.d.ts +62 -10
- package/dist/trace/project.js +49 -9
- package/dist/trace/redact.d.ts +18 -6
- package/dist/trace/redact.js +154 -60
- package/dist/trace/self-minted-wire.d.ts +500 -7
- package/dist/trace/self-minted-wire.js +182 -1
- package/dist/trace/wire-projection-faces.d.ts +7 -5
- package/dist/trace/wire-projection-faces.js +9 -4
- package/dist/user-authored-text.d.ts +2 -2
- package/dist/user-authored-text.js +16 -1
- package/dist/web-admin-client/apply-effective.js +0 -1
- package/dist/web-admin-client/center-request.d.ts +23 -4
- package/dist/web-admin-client/center-request.js +42 -8
- package/dist/web-admin-client/http-client.js +6 -6
- package/dist/web-admin-client/skills-mcp.d.ts +8 -4
- package/dist/web-admin-client/skills-mcp.js +31 -18
- package/dist/web-admin-client/types.d.ts +10 -5
- package/docs/DEVICE-EXECUTOR-PROTOCOL.md +11 -5
- package/package.json +3 -3
- package/wire-changes/server@7.137.0.json +825 -0
- package/wire-changes/server@7.138.0.json +446 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type A2aServerSpec, type McpServerSpec, type SkillSpec } from "@sema-agent/core";
|
|
2
2
|
import type { CenterMcp, ScopedA2aPeer } from "../config-types.js";
|
|
3
3
|
import type { Logger } from "../observability/logger.js";
|
|
4
|
+
import { type PeerDesk, type PeerLease } from "../peer-seat.js";
|
|
4
5
|
import type { LoadedSkill } from "../capabilities/skills.js";
|
|
5
6
|
import type { ConfigProvider } from "../config-provider.js";
|
|
6
7
|
import type { CenterA2aPeer, CenterMcpServer, CenterSkillManifest } from "./types.js";
|
|
@@ -53,14 +54,16 @@ export declare function applySkillsManifest(baseline: LoadedSkill[], manifest: {
|
|
|
53
54
|
}, bodies: SkillBodySource, logger?: Logger): Promise<LoadedSkill[]>;
|
|
54
55
|
/**
|
|
55
56
|
* Resolve center MCP servers (`/effective.mcp`) into core `McpServerSpec`s + the scenarios each applies to.
|
|
56
|
-
* env-NAME refs → real values from THIS service's env (secret boundary unchanged)
|
|
57
|
+
* env-NAME refs → real values from THIS service's env (secret boundary unchanged), registered on `desk` under `rosterLease`
|
|
58
|
+
* (the desk's one minting point `mintDeclaration`, called only for an entry that mounts — after every judge below has passed, so a skipped
|
|
59
|
+
* entry never holds a registration): the spec carries the minted reference, never the values. A server with any missing
|
|
57
60
|
* ref is skipped (`resolveRefs` → null). `enabled:false` skipped. A server whose `toolFaces` / `toolAxes` declaration is
|
|
58
61
|
* malformed is skipped whole (both are trust-root declarations — the engine's `readToolFaces` / `readMcpToolAxes` judge them). Restart-to-apply
|
|
59
62
|
* (filtered per scenario in `resolveSpec` via `mcpForScenario`).
|
|
60
63
|
*/
|
|
61
64
|
export declare function resolveMcpServers(mcp: {
|
|
62
65
|
servers: CenterMcpServer[];
|
|
63
|
-
}, logger?: Logger): CenterMcp;
|
|
66
|
+
}, desk: Pick<PeerDesk, "declare">, rosterLease: PeerLease, logger?: Logger): CenterMcp;
|
|
64
67
|
/** The MCP servers applicable to a scenario: tagged with it, or untagged (global). undefined when none.
|
|
65
68
|
* [ref]:alias 窗撤销,单键命中(同 `skillsForScenario`)。 */
|
|
66
69
|
export declare function mcpForScenario(center: CenterMcp | undefined, scenario: string): McpServerSpec[] | undefined;
|
|
@@ -68,7 +71,8 @@ export declare function mcpForScenario(center: CenterMcp | undefined, scenario:
|
|
|
68
71
|
* DESIGN-269 §2.1 —— resolve center A2A peers (`/effective.a2a`) into core `A2aServerSpec`s + the scenarios
|
|
69
72
|
* each applies to. Exact sibling of {@link resolveMcpServers}, same three rules:
|
|
70
73
|
* · header-NAME refs → real values from THIS service's env (the secret boundary is unchanged — the center
|
|
71
|
-
* never holds the bearer)
|
|
74
|
+
* never holds the bearer), registered on `desk` under `rosterLease` (`mintDeclaration`, only for a peer that mounts); the spec carries the minted
|
|
75
|
+
* reference, never the values. A peer with ANY missing ref is SKIPPED wholesale (`resolveRefs` → null):
|
|
72
76
|
* dialing a remote AGENT with half the credentials is the wrong failure direction.
|
|
73
77
|
* · `enabled:false` skipped.
|
|
74
78
|
* · restart-to-apply (filtered per scenario in `resolveSpec` via {@link a2aForScenario}).
|
|
@@ -83,7 +87,7 @@ export declare function mcpForScenario(center: CenterMcp | undefined, scenario:
|
|
|
83
87
|
*/
|
|
84
88
|
export declare function resolveA2aPeers(a2a: {
|
|
85
89
|
peers: CenterA2aPeer[];
|
|
86
|
-
}, logger?: Logger): ScopedA2aPeer[];
|
|
90
|
+
}, desk: Pick<PeerDesk, "declare">, rosterLease: PeerLease, logger?: Logger): ScopedA2aPeer[];
|
|
87
91
|
/** The A2A peers applicable to a scenario: tagged with it, or untagged (global). undefined when none.
|
|
88
92
|
* Twin of {@link mcpForScenario} — `undefined` (not `[]`) is load-bearing: an empty array would put an
|
|
89
93
|
* `a2a: []` key on the spec, i.e. "this deployment declares an empty peer set", where absence means
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { readMcpSourceLabel } from "../mcp-source-label.js";
|
|
2
2
|
import { skillContentHash } from "@sema-agent/settings-schema";
|
|
3
|
-
import { readMcpToolAxes, readToolFaces } from "@sema-agent/core";
|
|
3
|
+
import { judgeSessionMetaKey, readMcpToolAxes, readToolFaces } from "@sema-agent/core";
|
|
4
4
|
import { MCP_CONTENT_ORIGINS, describeBadContentOrigin, describeBadWireName, isContentOriginWord, isUsableWireName } from "@sema-agent/settings-schema";
|
|
5
|
-
import { noteMcpAssertionHeaderNotSent,
|
|
5
|
+
import { noteMcpAssertionHeaderNotSent, withholdsMcpAssertionHeader } from "../mcp-assertion-header.js";
|
|
6
|
+
import { mintDeclaration, peerSentence } from "../peer-seat.js";
|
|
6
7
|
import { SHA256_HEX_RE } from "../digest-form.js";
|
|
7
8
|
export function skillToolListsOf(source) {
|
|
8
9
|
return {
|
|
@@ -115,7 +116,7 @@ function resolveRefs(refs, server, kind, logger, event = "web_admin_mcp_env_miss
|
|
|
115
116
|
}
|
|
116
117
|
return out;
|
|
117
118
|
}
|
|
118
|
-
export function resolveMcpServers(mcp, logger) {
|
|
119
|
+
export function resolveMcpServers(mcp, desk, rosterLease, logger) {
|
|
119
120
|
const out = [];
|
|
120
121
|
const reservedNames = (mcp.servers ?? []).map((s) => s.name);
|
|
121
122
|
for (const s of mcp.servers ?? []) {
|
|
@@ -147,7 +148,7 @@ export function resolveMcpServers(mcp, logger) {
|
|
|
147
148
|
if (!facesRead.ok) {
|
|
148
149
|
logger?.warn("web_admin_mcp_tool_faces_invalid", {
|
|
149
150
|
server: s.name,
|
|
150
|
-
problem: facesRead.problem,
|
|
151
|
+
problem: peerSentence(facesRead.problem),
|
|
151
152
|
note: "server SKIPPED — a toolFaces overlay is a NARROWING declaration (its pathTarget is what the sensitive-path / write fences read); mounting the server without it would silently drop the protection you declared. Fix the entry and republish.",
|
|
152
153
|
});
|
|
153
154
|
continue;
|
|
@@ -157,20 +158,31 @@ export function resolveMcpServers(mcp, logger) {
|
|
|
157
158
|
if (!axesRead.ok) {
|
|
158
159
|
logger?.warn("web_admin_mcp_tool_axes_invalid", {
|
|
159
160
|
server: s.name,
|
|
160
|
-
problem: axesRead.problem,
|
|
161
|
+
problem: peerSentence(axesRead.problem),
|
|
161
162
|
note: "server SKIPPED — a toolAxes declaration is a TRUST-ROOT declaration (it can lower an effect so a call skips the approval fence, or raise one); mounting the server without it, or with a half of it, would silently change what you declared. Fix the entry and republish.",
|
|
162
163
|
});
|
|
163
164
|
continue;
|
|
164
165
|
}
|
|
165
166
|
const toolAxes = axesRead.toolAxes === undefined ? {} : { toolAxes: axesRead.toolAxes };
|
|
167
|
+
const metaKey = judgeSessionMetaKey(s.sessionMetaKey);
|
|
168
|
+
if ("problem" in metaKey) {
|
|
169
|
+
logger?.warn("web_admin_mcp_session_meta_key_invalid", {
|
|
170
|
+
server: s.name,
|
|
171
|
+
problem: peerSentence(metaKey.problem),
|
|
172
|
+
note: "server SKIPPED — its sessionMetaKey cannot ride (the engine's judge refused it); mounting the server without the key would silently drop the session id it declared it needs. Fix the entry and republish.",
|
|
173
|
+
});
|
|
174
|
+
continue;
|
|
175
|
+
}
|
|
176
|
+
const sessionMetaKey = metaKey.key === undefined ? {} : { sessionMetaKey: metaKey.key };
|
|
166
177
|
if (s.transport.kind === "stdio") {
|
|
167
178
|
const env = resolveRefs(s.transport.envRefs, s.name, "env", logger);
|
|
168
179
|
if (env === null)
|
|
169
180
|
continue;
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
}
|
|
181
|
+
const draft = {
|
|
182
|
+
spec: { name: s.name, transport: { kind: "stdio", command: s.transport.command, args: s.transport.args }, ...allow, ...elicit, ...contentOrigin, ...source, ...toolFaces, ...toolAxes, ...sessionMetaKey },
|
|
183
|
+
pieces: env,
|
|
184
|
+
};
|
|
185
|
+
out.push({ scenarios: s.scenarios ?? [], spec: mintDeclaration(desk, draft, rosterLease) });
|
|
174
186
|
}
|
|
175
187
|
else {
|
|
176
188
|
const headers = resolveRefs(s.transport.headerRefs, s.name, "header", logger);
|
|
@@ -178,10 +190,11 @@ export function resolveMcpServers(mcp, logger) {
|
|
|
178
190
|
continue;
|
|
179
191
|
if (withholdsMcpAssertionHeader(s.transport.assertionHeader))
|
|
180
192
|
noteMcpAssertionHeaderNotSent(logger, s.name);
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
}
|
|
193
|
+
const draft = {
|
|
194
|
+
spec: { name: s.name, transport: { kind: "http", url: s.transport.url, ...(s.transport.principalHeader ? { principalHeader: s.transport.principalHeader } : {}) }, ...allow, ...elicit, ...contentOrigin, ...source, ...toolFaces, ...toolAxes, ...sessionMetaKey },
|
|
195
|
+
pieces: headers,
|
|
196
|
+
};
|
|
197
|
+
out.push({ scenarios: s.scenarios ?? [], spec: mintDeclaration(desk, draft, rosterLease) });
|
|
185
198
|
}
|
|
186
199
|
}
|
|
187
200
|
if (out.length > 0)
|
|
@@ -195,7 +208,7 @@ export function mcpForScenario(center, scenario) {
|
|
|
195
208
|
const hit = servers.filter((s) => s.scenarios.length === 0 || s.scenarios.includes(scenario)).map((s) => s.spec);
|
|
196
209
|
return hit.length > 0 ? hit : undefined;
|
|
197
210
|
}
|
|
198
|
-
export function resolveA2aPeers(a2a, logger) {
|
|
211
|
+
export function resolveA2aPeers(a2a, desk, rosterLease, logger) {
|
|
199
212
|
const out = [];
|
|
200
213
|
for (const p of a2a.peers ?? []) {
|
|
201
214
|
if (p.enabled === false)
|
|
@@ -210,17 +223,17 @@ export function resolveA2aPeers(a2a, logger) {
|
|
|
210
223
|
const headers = resolveRefs(p.headerRefs, p.name, "header", logger, "web_admin_a2a_env_missing", "skipping this A2A peer — referenced env var is unset in this service");
|
|
211
224
|
if (headers === null)
|
|
212
225
|
continue;
|
|
213
|
-
|
|
214
|
-
scenarios: p.scenarios ?? [],
|
|
226
|
+
const draft = {
|
|
215
227
|
spec: {
|
|
216
228
|
name: p.name,
|
|
217
229
|
url: p.url,
|
|
218
230
|
...(p.cardUrl ? { cardUrl: p.cardUrl } : {}),
|
|
219
|
-
...(Object.keys(headers).length ? { headers } : {}),
|
|
220
231
|
...(p.principalHeader ? { principalHeader: p.principalHeader } : {}),
|
|
221
232
|
...(p.allowSkills && p.allowSkills.length > 0 ? { allowSkills: p.allowSkills } : {}),
|
|
222
233
|
},
|
|
223
|
-
|
|
234
|
+
pieces: headers,
|
|
235
|
+
};
|
|
236
|
+
out.push({ scenarios: p.scenarios ?? [], spec: mintDeclaration(desk, draft, rosterLease) });
|
|
224
237
|
}
|
|
225
238
|
if (out.length > 0)
|
|
226
239
|
logger?.info("web_admin_a2a", { peers: out.map((p) => p.spec.name) });
|
|
@@ -75,11 +75,11 @@ export interface CenterModel {
|
|
|
75
75
|
* the ONLY way to keep per-model tuning that lived in env (`MODEL_FREQUENCY_PENALTY` etc.) — see the
|
|
76
76
|
* review-gw heterogeneous-roster migration. MUST be static per published version (prompt-cache prefix). */
|
|
77
77
|
extraBody?: Record<string, unknown>;
|
|
78
|
-
/** registry-core 0.10.13 ([ref]/[ref]⑤c): per-model behavior-slot
|
|
79
|
-
* `Model.promptGuidance
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
78
|
+
/** registry-core 0.10.13 ([ref]/[ref]⑤c): per-model behavior-slot sentences. core 7.56.0 ([ref]) retired the engine seat
|
|
79
|
+
* (`Model.promptGuidance`; per-model guidance is now a prompt overlay keyed on the model's declared traits), while the
|
|
80
|
+
* settings-schema `ModelEntry` still accepts the key. It is carried here ONLY so the [ref] judge (`judgeCatalogEntry`)
|
|
81
|
+
* can see it: a non-empty list refuses the entry (`config.model_entry_invalid`, field `promptGuidance`) instead of the
|
|
82
|
+
* sentences being silently dropped; `toModel` never mints it onto a core `Model`. */
|
|
83
83
|
promptGuidance?: string[];
|
|
84
84
|
/**
|
|
85
85
|
* [ref](7.108.0)—— 这条条目发给供应商的**附加请求头**(部署 ↔ 供应商的契约;今天只有 `anthropic-beta`),上 core 的 per-model
|
|
@@ -170,6 +170,11 @@ export interface CenterMcpServer {
|
|
|
170
170
|
* (同批解析透明键 `authForm` / `entryKind` 的语义归连接器,本层仍只承载。)
|
|
171
171
|
*/
|
|
172
172
|
toolAxes?: unknown;
|
|
173
|
+
/**
|
|
174
|
+
* core 7.58.0 `McpServerSpec.sessionMetaKey` —— 声明了它的服务器,引擎在每次 `tools/call` 的 `_meta` 下以这把键放这条腿的会话 id。
|
|
175
|
+
* 承载形 `unknown`(与 {@link CenterMcpServer.toolAxes} 同姿):判官只有引擎根导出的 `judgeSessionMetaKey`(`resolveMcpServers` 在铸 spec 那一刻问它;坏形整条 server 不进)。
|
|
176
|
+
*/
|
|
177
|
+
sessionMetaKey?: unknown;
|
|
173
178
|
transport: {
|
|
174
179
|
kind: "stdio";
|
|
175
180
|
command: string;
|
|
@@ -18,8 +18,11 @@ dials the device, so the device needs no inbound port, no public address and no
|
|
|
18
18
|
|
|
19
19
|
**Discovery before you connect**: `GET /v1/capabilities` carries a `deviceExecutor` key — either `false`
|
|
20
20
|
(this deployment has no device lane) or an object `{ enabled: true, protocolVersion, maxInflightPerDevice,
|
|
21
|
-
wsPath, management }`. Read `wsPath` from there rather than hardcoding it: the path is part of the wire
|
|
22
|
-
contract and reading it means a future path change is not a cross-repo break. `
|
|
21
|
+
wsPath, management, relayUrl? }`. Read `wsPath` from there rather than hardcoding it: the path is part of the wire
|
|
22
|
+
contract and reading it means a future path change is not a cross-repo break. `relayUrl` (server 7.137.0+) is present
|
|
23
|
+
only when the operator declared one (`DEVICE_RELAY_URL`): the engine sits behind a relay or gateway and the device
|
|
24
|
+
must dial that absolute `ws://` / `wss://` URL verbatim instead of the engine's own address — do not rebuild it from
|
|
25
|
+
the engine address and `wsPath`. Absent ⇒ dial the engine's own address at `wsPath`, as before. `protocolVersion` tells you
|
|
23
26
|
which protocol **revision** the server speaks before you spend a handshake finding out (§2.1: the revision decides
|
|
24
27
|
which `errorCode` words the server accepts from you).
|
|
25
28
|
|
|
@@ -136,7 +139,8 @@ Ask for a new enrollment token and try again."* Do not retry the same token afte
|
|
|
136
139
|
|
|
137
140
|
### 1.2 Connecting
|
|
138
141
|
|
|
139
|
-
Open a WebSocket to `
|
|
142
|
+
Open a WebSocket to `relayUrl` when the capability carries one, otherwise to `wsPath` on the engine's own
|
|
143
|
+
address (`GET`, standard upgrade). The server refuses the upgrade with `404` for any
|
|
140
144
|
other path, and with `503` while the replica is draining or when its pre-auth connection caps are full.
|
|
141
145
|
There is no authentication in the upgrade headers — the handshake happens **inside** the protocol.
|
|
142
146
|
|
|
@@ -336,7 +340,7 @@ base64 inside JSON fields.
|
|
|
336
340
|
| Constant | Value | Meaning |
|
|
337
341
|
|---|---|---|
|
|
338
342
|
| `DEVICE_WS_PATH` | `/v1/device/ws` | the upgrade path (prefer the `wsPath` from `/v1/capabilities`) |
|
|
339
|
-
| `DEVICE_PROTOCOL_VERSION` | `
|
|
343
|
+
| `DEVICE_PROTOCOL_VERSION` | `3` | the protocol revision this server speaks (the highest it accepts) |
|
|
340
344
|
| `DEVICE_MIN_PROTOCOL_VERSION` | `1` | the lowest revision it accepts; below it (or above the highest), a loud `helloReject` — never a silent downgrade |
|
|
341
345
|
| `DEVICE_HELLO_DOMAIN_TAG` | `sema.device.hello.v1` | the handshake signature domain tag (§1.3) |
|
|
342
346
|
|
|
@@ -365,6 +369,7 @@ the union of the rows up to *N*, and the full set at the current revision is the
|
|
|
365
369
|
|---|---|
|
|
366
370
|
| `1` | `aborted`, `already_exists`, `auth_failed`, `callback_error`, `invalid`, `is_directory`, `not_directory`, `not_found`, `not_supported`, `outcome_unknown`, `permission_denied`, `precondition_failed`, `shell_unavailable`, `spawn_error`, `suspended`, `target_unavailable`, `timeout`, `transport_lost`, `unknown` |
|
|
367
371
|
| `2` | `liveness_no_output` |
|
|
372
|
+
| `3` | `name_too_long` |
|
|
368
373
|
|
|
369
374
|
Rules: adding a frame or a field is additive and does not raise the revision; adding a word to a closed set the
|
|
370
375
|
server *accepts from you* (today: the `errorCode` set) raises `DEVICE_PROTOCOL_VERSION` and adds a row here; a
|
|
@@ -560,7 +565,7 @@ a moment ago. If you omit `created`, the consumer reports the weaker of the two
|
|
|
560
565
|
|
|
561
566
|
`message` is required on the failure arm and is shown to the model — make it specific.
|
|
562
567
|
|
|
563
|
-
This is the full set at the current revision (`
|
|
568
|
+
This is the full set at the current revision (`3`); the revision table in §2.1 says which revision each word arrived
|
|
564
569
|
with, and an executor sends only the words of the revision it declared (§1.2).
|
|
565
570
|
|
|
566
571
|
<!-- closed-set: DEVICE_OUTCOME_ERROR_CODES -->
|
|
@@ -574,6 +579,7 @@ with, and an executor sends only the words of the revision it declared (§1.2).
|
|
|
574
579
|
| `invalid` | the arguments do not make sense for this target (e.g. `readLink` on a non-symlink) |
|
|
575
580
|
| `is_directory` | a file operation hit a directory |
|
|
576
581
|
| `liveness_no_output` | **you** killed the command because it produced no output for your own silence window (a hung command); the wall-clock budget `timeoutMs` running out stays `timeout`. The frame has no field for the window length — do not invent one |
|
|
582
|
+
| `name_too_long` | a component of the path is longer than the filesystem's name limit (`NAME_MAX`, 255 bytes; POSIX `ENAMETOOLONG` for such a component) — no directory can hold that name, so it is read upstream as an absence, like `not_found`. A path that is only too long as a whole while every component is short stays `unknown` (such a file may exist, reached from a directory below it). On an exec instruction it is a protocol violation (use `spawn_error` when the process could not be started) and the server reads it as `unknown` |
|
|
577
583
|
| `not_directory` | a directory operation hit a non-directory |
|
|
578
584
|
| `not_found` | the path does not exist |
|
|
579
585
|
| `not_supported` | you do not implement this face (prefer simply not declaring it) |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sema-agent/server",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.138.0",
|
|
4
4
|
"description": "Sema Server — the server/API implementation layer for Sema, wiring core, registry, model providers, and cloud agent execution. Built on @sema-agent/core.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "BUSL-1.1",
|
|
@@ -69,8 +69,8 @@
|
|
|
69
69
|
"build:binary:run-local:darwin-arm64": "bun build --compile --target=bun-darwin-arm64 src/run-local.ts --outfile dist/run-local-darwin-arm64"
|
|
70
70
|
},
|
|
71
71
|
"dependencies": {
|
|
72
|
-
"@sema-agent/core": "7.
|
|
73
|
-
"@sema-agent/settings-schema": "14.
|
|
72
|
+
"@sema-agent/core": "7.59.0",
|
|
73
|
+
"@sema-agent/settings-schema": "14.7.0",
|
|
74
74
|
"e2b": "^2.28.0",
|
|
75
75
|
"libsodium-wrappers": "^0.8.4",
|
|
76
76
|
"mysql2": "^3.22.4",
|