@sema-agent/server 7.141.0 → 7.143.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 +657 -0
- package/USAGE.md +102 -30
- package/dist/adoption/plan.js +22 -0
- package/dist/approval-ask-audit-store.d.ts +61 -43
- package/dist/approval-ask-audit-store.js +69 -44
- package/dist/approval-ask-machine.d.ts +15 -7
- package/dist/approval-ask-machine.js +10 -4
- package/dist/approval-card.d.ts +126 -27
- package/dist/approval-card.js +103 -23
- package/dist/approval-crash-convergence.d.ts +17 -7
- package/dist/approval-crash-convergence.js +94 -22
- package/dist/approval-deny-reasons.d.ts +34 -30
- package/dist/approval-deny-reasons.js +21 -6
- package/dist/approval-policy-settlement.d.ts +1 -1
- package/dist/approval-queue-kind.d.ts +27 -0
- package/dist/approval-queue-kind.js +6 -0
- package/dist/approval-reconciler.d.ts +41 -9
- package/dist/approval-reconciler.js +45 -42
- package/dist/audit.js +4 -2
- package/dist/auth-bridge.d.ts +9 -6
- package/dist/auth-bridge.js +9 -3
- package/dist/boot/adoption.js +2 -1
- package/dist/boot/budget-tracing.d.ts +17 -1
- package/dist/boot/budget-tracing.js +10 -6
- package/dist/boot/device-lane.d.ts +1 -1
- package/dist/boot/execution-env.d.ts +24 -4
- package/dist/boot/execution-env.js +26 -23
- package/dist/boot/execution-lane.js +2 -1
- package/dist/boot/exit-boundary.js +5 -4
- package/dist/boot/governance-seams.d.ts +26 -41
- package/dist/boot/governance-seams.js +61 -28
- package/dist/boot/late-binds.d.ts +7 -4
- package/dist/boot/late-binds.js +3 -1
- package/dist/boot/leader.js +2 -4
- package/dist/boot/memory-consolidation.d.ts +0 -8
- package/dist/boot/memory-consolidation.js +5 -4
- package/dist/boot/parked-revive-gate.js +2 -1
- package/dist/boot/permission-rules-audit.d.ts +0 -28
- package/dist/boot/permission-rules-audit.js +2 -1
- package/dist/boot/read-deny-anchor-audit.js +2 -1
- package/dist/boot/reapers.js +9 -7
- package/dist/boot/resolve-spec.d.ts +1 -1
- package/dist/boot/resolve-spec.js +19 -10
- package/dist/boot/retention-lane.js +5 -3
- package/dist/boot/runner-deps.d.ts +10 -7
- package/dist/boot/runner-deps.js +20 -29
- package/dist/boot/runtime-caps.js +3 -2
- package/dist/boot/session-faces.js +4 -3
- package/dist/boot/shutdown.d.ts +9 -0
- package/dist/boot/shutdown.js +19 -4
- package/dist/boot/stage-02-web-admin-pull.js +3 -0
- package/dist/boot/stage-03-store-backend.d.ts +4 -1
- package/dist/boot/stage-03-store-backend.js +1 -2
- package/dist/boot/stage-04-stores.d.ts +5 -2
- package/dist/boot/stage-04-stores.js +6 -7
- package/dist/boot/stage-05-execution-env.d.ts +6 -3
- package/dist/boot/stage-05-execution-env.js +8 -6
- package/dist/boot/stage-06-runners.d.ts +6 -3
- package/dist/boot/stage-06-runners.js +3 -4
- package/dist/boot/stage-07-capability-layer.d.ts +6 -3
- package/dist/boot/stage-07-capability-layer.js +7 -2
- package/dist/boot/stage-08-reapers.d.ts +6 -3
- package/dist/boot/stage-08-reapers.js +3 -2
- package/dist/boot/stage-09-leader.d.ts +6 -3
- package/dist/boot/stage-10-http-server.d.ts +6 -3
- package/dist/boot/stage-10-http-server.js +14 -5
- package/dist/boot/stores.d.ts +5 -2
- package/dist/boot/stores.js +10 -9
- package/dist/boot/web-admin.d.ts +5 -1
- package/dist/boot/web-admin.js +48 -36
- package/dist/boot/webfetch-summarize-lane.js +2 -1
- package/dist/boot/workflow-orchestration.js +3 -2
- package/dist/capabilities/builtin-tools.d.ts +2 -1
- package/dist/capabilities/builtin-tools.js +2 -4
- package/dist/capabilities/composite-members.d.ts +2 -1
- package/dist/capabilities/composite-members.js +2 -1
- package/dist/capabilities/hands-lane.d.ts +9 -39
- package/dist/capabilities/hands-lane.js +8 -13
- package/dist/capabilities/mcp-probe.d.ts +3 -2
- package/dist/capabilities/scenarios.d.ts +11 -1
- package/dist/capabilities/scenarios.js +1 -0
- package/dist/capabilities/skills.d.ts +1 -17
- package/dist/capabilities/skills.js +0 -8
- package/dist/capability-facts.d.ts +31 -7
- package/dist/capability-facts.js +27 -4
- package/dist/card-void.d.ts +6 -9
- package/dist/config-catalog.js +2 -1
- package/dist/config-dir-trust.js +58 -29
- package/dist/config-invariants.d.ts +7 -1
- package/dist/config-invariants.js +7 -0
- package/dist/config-provider.d.ts +10 -0
- package/dist/config-provider.js +15 -4
- package/dist/config-root-migration.d.ts +13 -0
- package/dist/config-root-migration.js +99 -0
- package/dist/config-types.d.ts +19 -8
- package/dist/config.d.ts +10 -3
- package/dist/config.js +18 -4
- package/dist/delegated-session-owner.d.ts +5 -3
- package/dist/delegated-session-owner.js +1 -1
- package/dist/device-ws-protocol.d.ts +1 -0
- package/dist/device-ws-protocol.js +2 -1
- package/dist/env-model-table-gate.d.ts +53 -0
- package/dist/env-model-table-gate.js +53 -0
- package/dist/execution-lane-caps.d.ts +2 -1
- package/dist/fleet/fleet-bus.d.ts +34 -55
- package/dist/fleet/fleet-bus.js +35 -100
- package/dist/fleet/fleet-reconciler.d.ts +4 -4
- package/dist/fleet/fleet-reconciler.js +1 -1
- package/dist/fleet/subagent-tail-bus.d.ts +14 -11
- package/dist/fleet/subagent-tail-bus.js +15 -28
- package/dist/hooks/hook-runner.d.ts +6 -0
- package/dist/hooks/hook-runner.js +58 -8
- package/dist/host-decision.d.ts +54 -20
- package/dist/host-decision.js +42 -14
- package/dist/http/admission.d.ts +1 -1
- package/dist/http/admission.js +7 -3
- package/dist/http/approval-sweeps.js +11 -8
- package/dist/http/caller-trust.d.ts +1 -1
- package/dist/http/dispatch.js +4 -2
- package/dist/http/durable-run-leg.js +2 -2
- package/dist/http/engine-refusal.d.ts +16 -0
- package/dist/http/engine-refusal.js +17 -0
- package/dist/http/execution-context.d.ts +2 -2
- package/dist/http/idempotency.d.ts +1 -1
- package/dist/http/memory-compliance-failure-reply.d.ts +1 -3
- package/dist/http/memory-compliance-failure-reply.js +4 -6
- package/dist/http/owner-access.d.ts +11 -0
- package/dist/http/owner-access.js +13 -0
- package/dist/http/principal-gate.d.ts +3 -1
- package/dist/http/principal-gate.js +17 -8
- package/dist/http/resume-legs.d.ts +21 -7
- package/dist/http/resume-legs.js +76 -58
- package/dist/http/resume-restatement.d.ts +39 -0
- package/dist/http/resume-restatement.js +25 -0
- package/dist/http/route-ctx.d.ts +35 -10
- package/dist/http/route-ctx.js +1 -1
- package/dist/http/route-table.js +2 -0
- package/dist/http/routes/approvals-assistant.d.ts +9 -1
- package/dist/http/routes/approvals-assistant.js +142 -31
- package/dist/http/routes/attachments.js +18 -0
- package/dist/http/routes/capabilities.js +16 -4
- package/dist/http/routes/memory-policy.d.ts +2 -2
- package/dist/http/routes/memory-policy.js +27 -7
- package/dist/http/routes/notify-wake.js +23 -25
- package/dist/http/routes/rules.js +48 -13
- package/dist/http/routes/runs.js +12 -11
- package/dist/http/routes/session-memory-sync.d.ts +91 -0
- package/dist/http/routes/session-memory-sync.js +174 -0
- package/dist/http/routes/session-sync.js +13 -20
- package/dist/http/routes/sessions-list.d.ts +2 -1
- package/dist/http/routes/sessions.d.ts +2 -2
- package/dist/http/routes/sessions.js +22 -23
- package/dist/http/routes/tasks.js +34 -54
- package/dist/http/run-read-face.d.ts +7 -0
- package/dist/http/run-read-face.js +9 -3
- package/dist/http/send.d.ts +5 -0
- package/dist/http/send.js +9 -2
- package/dist/http/server.d.ts +27 -15
- package/dist/http/server.js +4 -6
- package/dist/http/stored-body-replay.js +15 -4
- package/dist/http/submit-replay.d.ts +4 -3
- package/dist/http/submit-replay.js +2 -2
- package/dist/http/sync-submit-body.d.ts +21 -4
- package/dist/http/sync-submit-body.js +13 -0
- package/dist/http/wire-types.d.ts +17 -7
- package/dist/identity-source.d.ts +21 -2
- package/dist/identity-source.js +6 -0
- package/dist/leader/leader.js +5 -2
- package/dist/leader/wire.d.ts +7 -1
- package/dist/leader/wire.js +6 -5
- package/dist/leg-facts.d.ts +37 -0
- package/dist/leg-facts.js +15 -0
- package/dist/memory-bundle-engine.d.ts +1 -4
- package/dist/memory-bundle-engine.js +2 -2
- package/dist/memory-incident-sink.d.ts +19 -6
- package/dist/memory-incident-sink.js +8 -4
- package/dist/memory-operator-faces.d.ts +30 -66
- package/dist/memory-operator-faces.js +17 -88
- package/dist/memory-scope-stores.d.ts +38 -40
- package/dist/memory-scope-stores.js +51 -36
- package/dist/memory-scope.d.ts +0 -9
- package/dist/memory-scope.js +0 -9
- package/dist/memory-sync-client.d.ts +21 -21
- package/dist/memory-sync-client.js +62 -43
- package/dist/memory-sync-identity.d.ts +24 -0
- package/dist/memory-sync-identity.js +57 -0
- package/dist/memory-sync.d.ts +27 -5
- package/dist/memory-sync.js +29 -7
- package/dist/model-plane-face.d.ts +13 -7
- package/dist/model-plane-face.js +2 -1
- package/dist/observability/fail-open.d.ts +47 -14
- package/dist/observability/fail-open.js +37 -11
- package/dist/observability/run-terminal.d.ts +92 -34
- package/dist/observability/run-terminal.js +171 -162
- package/dist/orchestration/workflow-completion-inbox.d.ts +5 -19
- package/dist/orchestration/workflow-completion-inbox.js +0 -12
- package/dist/orchestration/workflow-notify-journal.d.ts +3 -2
- package/dist/orchestration/workflow-park-decision.d.ts +8 -3
- package/dist/orchestration/workflow-park-decision.js +5 -3
- package/dist/org-delivery-gate.d.ts +11 -0
- package/dist/org-delivery-gate.js +19 -1
- package/dist/parked-decide.d.ts +13 -9
- package/dist/parked-decide.js +7 -7
- package/dist/parked-revive-surface.js +1 -1
- package/dist/peer-inbound-face.d.ts +127 -0
- package/dist/peer-inbound-face.js +158 -0
- package/dist/permission-rule-list.d.ts +13 -9
- package/dist/permission-rule-list.js +7 -3
- package/dist/plugins/approval-ask-store-file.d.ts +14 -4
- package/dist/plugins/approval-ask-store-file.js +64 -11
- package/dist/plugins/approval-ask-store-memory.d.ts +2 -1
- package/dist/plugins/approval-ask-store-memory.js +17 -14
- package/dist/plugins/approval-ask-store-sql.d.ts +70 -23
- package/dist/plugins/approval-ask-store-sql.js +79 -30
- package/dist/plugins/checkpoint-store-sql.d.ts +4 -4
- package/dist/plugins/checkpoint-store-sql.js +9 -7
- package/dist/plugins/file-history-store-sql.d.ts +24 -18
- package/dist/plugins/file-history-store-sql.js +24 -19
- package/dist/plugins/file-run-store.d.ts +35 -1
- package/dist/plugins/file-run-store.js +108 -9
- package/dist/plugins/imported-layer-root-retirement.d.ts +82 -0
- package/dist/plugins/imported-layer-root-retirement.js +96 -0
- package/dist/plugins/local-checkpoint-store.d.ts +1 -1
- package/dist/plugins/local-checkpoint-store.js +2 -2
- package/dist/plugins/local-session-store.d.ts +42 -9
- package/dist/plugins/local-session-store.js +83 -33
- package/dist/plugins/local-task-attachment-store.d.ts +12 -2
- package/dist/plugins/local-task-attachment-store.js +67 -43
- package/dist/plugins/mailbox-recipient-lifecycle.d.ts +9 -31
- package/dist/plugins/mailbox-recipient-lifecycle.js +4 -0
- package/dist/plugins/mailbox-store-sql.d.ts +12 -8
- package/dist/plugins/mailbox-store-sql.js +76 -7
- package/dist/plugins/memory-key-guards.d.ts +3 -3
- package/dist/plugins/memory-run-store.d.ts +6 -1
- package/dist/plugins/memory-run-store.js +11 -1
- package/dist/plugins/memory-sync-store-pg.d.ts +15 -0
- package/dist/plugins/memory-sync-store-pg.js +21 -0
- package/dist/plugins/memory-sync-store-tidb.d.ts +2 -0
- package/dist/plugins/memory-sync-store-tidb.js +13 -1
- package/dist/plugins/one-time-migrations.d.ts +58 -2
- package/dist/plugins/one-time-migrations.js +161 -4
- package/dist/plugins/org-delivery-quota-store.d.ts +1 -1
- package/dist/plugins/org-delivery-quota-store.js +2 -12
- package/dist/plugins/park-commit-watch.d.ts +1 -1
- package/dist/plugins/permission-rule-store-file.d.ts +10 -1
- package/dist/plugins/permission-rule-store-file.js +15 -2
- package/dist/plugins/permission-rule-store-sql.d.ts +31 -1
- package/dist/plugins/permission-rule-store-sql.js +35 -2
- package/dist/plugins/remote-env-device.d.ts +8 -11
- package/dist/plugins/remote-env-device.js +6 -3
- package/dist/plugins/remote-env-e2b.d.ts +23 -4
- package/dist/plugins/remote-env-e2b.js +111 -28
- package/dist/plugins/remote-env-k8s.d.ts +61 -22
- package/dist/plugins/remote-env-k8s.js +133 -33
- package/dist/plugins/remote-env-local-docker.d.ts +15 -3
- package/dist/plugins/remote-env-local-docker.js +40 -12
- package/dist/plugins/retention-store-sql.d.ts +2 -2
- package/dist/plugins/run-store-sql.d.ts +9 -1
- package/dist/plugins/run-store-sql.js +9 -1
- package/dist/plugins/sandbox-read-floor.d.ts +5 -7
- package/dist/plugins/sandbox-read-floor.js +2 -7
- package/dist/plugins/sql-errors.d.ts +10 -1
- package/dist/plugins/sql-errors.js +13 -0
- package/dist/plugins/store-backend.d.ts +33 -35
- package/dist/plugins/store-backend.js +10 -1
- package/dist/plugins/store-contracts.d.ts +50 -1
- package/dist/plugins/store-contracts.js +6 -0
- package/dist/plugins/task-attachment-store.d.ts +112 -14
- package/dist/plugins/task-attachment-store.js +207 -29
- package/dist/plugins/tool-result-store-sql.d.ts +9 -8
- package/dist/plugins/tool-result-store-sql.js +23 -2
- package/dist/plugins/wiring-section-codec.d.ts +32 -0
- package/dist/plugins/wiring-section-codec.js +55 -0
- package/dist/plugins/workspace-fill.d.ts +60 -0
- package/dist/plugins/workspace-fill.js +106 -0
- package/dist/project-bundle.d.ts +38 -0
- package/dist/project-bundle.js +609 -0
- package/dist/rule-entry-list.d.ts +3 -2
- package/dist/rule-entry-list.js +5 -1
- package/dist/rules-consent.d.ts +28 -5
- package/dist/rules-consent.js +40 -28
- package/dist/run-local.js +11 -13
- package/dist/runs.d.ts +12 -8
- package/dist/runs.js +6 -8
- package/dist/runtime-governance.d.ts +1 -1
- package/dist/sandbox-egress-policy.d.ts +4 -1
- package/dist/sandbox-egress-policy.js +3 -1
- package/dist/sandbox-git-plane.d.ts +31 -12
- package/dist/sandbox-git-plane.js +24 -4
- package/dist/security.d.ts +9 -0
- package/dist/security.js +8 -0
- package/dist/server-secret-env.d.ts +4 -0
- package/dist/session-error-wire.d.ts +36 -0
- package/dist/session-error-wire.js +13 -0
- package/dist/session-incarnation.d.ts +1 -1
- package/dist/session-notify-door.d.ts +106 -0
- package/dist/session-notify-door.js +93 -0
- package/dist/session-sync.d.ts +9 -14
- package/dist/session-sync.js +5 -5
- package/dist/session-workspace.d.ts +3 -13
- package/dist/session-workspace.js +0 -9
- package/dist/standing-answer-grant.d.ts +5 -0
- package/dist/standing-answer-grant.js +10 -0
- package/dist/stores-sql/session-policy-store-sql.d.ts +4 -2
- package/dist/stores-sql/session-policy-store-sql.js +3 -13
- package/dist/task-mcp.d.ts +1 -1
- package/dist/task-settings.d.ts +21 -10
- package/dist/task-settings.js +46 -13
- package/dist/terminal.d.ts +39 -19
- package/dist/terminal.js +65 -22
- package/dist/tool-approval.d.ts +56 -37
- package/dist/tool-approval.js +78 -71
- package/dist/trace/core-keyset-guard.d.ts +134 -14
- package/dist/trace/engine-notice-wire.d.ts +9 -3
- package/dist/trace/engine-notice-wire.js +7 -3
- package/dist/trace/exit-seat.d.ts +9 -2
- package/dist/trace/exit-seat.js +1 -0
- package/dist/trace/ledger-sink.d.ts +10 -6
- package/dist/trace/ledger-sink.js +2 -2
- package/dist/trace/model-segment.d.ts +55 -25
- package/dist/trace/model-segment.js +101 -33
- package/dist/trace/project.d.ts +25 -5
- package/dist/trace/project.js +22 -0
- package/dist/trace/redact.d.ts +61 -9
- package/dist/trace/redact.js +1490 -468
- package/dist/trace/self-minted-wire.d.ts +745 -24
- package/dist/trace/self-minted-wire.js +239 -9
- package/dist/trace/wire-projection-faces.d.ts +2 -2
- package/dist/trace/wire-projection-faces.js +2 -2
- package/dist/verifier-pause-card.d.ts +33 -5
- package/dist/verifier-pause-card.js +15 -10
- package/dist/web-admin-client/apply-effective.d.ts +12 -16
- package/dist/web-admin-client/apply-effective.js +109 -9
- package/dist/web-admin-client/effective-keys.js +2 -0
- package/dist/web-admin-client/types.d.ts +4 -0
- package/dist/workspace-space.d.ts +19 -3
- package/dist/workspace-space.js +8 -4
- package/docs/DEVICE-EXECUTOR-PROTOCOL.md +3 -1
- package/package.json +3 -2
- package/wire-changes/server@7.142.0.json +639 -0
- package/wire-changes/server@7.143.0.json +1167 -0
|
@@ -29,15 +29,22 @@
|
|
|
29
29
|
* 补偿是这条 env 旋钮本身:要档位的部署显式写下它。将来 center 真有了档位下发面,「多租户必须能解析出
|
|
30
30
|
* 档位」才是一条有对象可指的判据,那时再立。
|
|
31
31
|
*
|
|
32
|
-
* ##
|
|
32
|
+
* ## 装配相容性:一条判据、一个时点(见 {@link assertGovernanceAssemblable})
|
|
33
33
|
*
|
|
34
|
-
* core 的锁按「spec
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
* · `spec.mcp` —— 部署自带的 MCP
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
* `
|
|
34
|
+
* core 的锁按「spec 是否占了这个字段」判、合规否决按「被禁能力是否已在 spec 上」判 —— 占了 / 在场都是**整拒 prepare**
|
|
35
|
+
* (`config.locked_key` / `config.compliance_denied`),不是「不挂载」。而本仓有几张 spec 面是**部署自己**在铸:
|
|
36
|
+
* · `spec.toolPolicy` —— 治理拍(`applyRuntimeGovernance`)在**任何**客户端表态下都铸(敏感路径守卫集默认非空)⇒ 恒在;
|
|
37
|
+
* · `spec.mcp` / `spec.a2a` —— 部署自带的 MCP 服务器 / A2A 对端(config.d 或中心下发)经同一字段进 core(引擎没有部署级的服务器 / 对端席)⇒ 配了就在;
|
|
38
|
+
* · WebFetch 工具面 —— 单用户花名册恒挂(多租户 roster 才摘)。
|
|
39
|
+
* 判据只有一条:**锁住的键 / 否决的能力所守的面 ∩ 本部署装配的面 ≠ ∅ ⇒ 起服拒**(安全控件不得半开 §3.4 C 行)—— 那不是「配得比较严」,
|
|
40
|
+
* 是这台部署的每条腿(或某场景的每条腿)必失败,而运维手里没有任何线索指向那把锁 / 那条否决。两张对照表是 core 两个闭集的 `Record`:
|
|
41
|
+
* 引擎加一个锁键或合规能力 ⇒ 这里缺行 ⇒ tsc 红,逼人当场判它守不守本部署铸的面(修前是两只 `has()` 判据,引擎后加的 `a2a` 锁与
|
|
42
|
+
* `a2a_peers` 否决静默不判)。
|
|
43
|
+
*
|
|
44
|
+
* **时点**:部署 MCP / A2A 基线在能力层才物化(server = 第 7 段的 `applyCenterCapabilities`;run-local = 候选采纳段的同一行),所以这道门
|
|
45
|
+
* 在**物化之后**由每个起服入口调恰好一次,出口只有一个:抛 ⇒ 起服拒(退出码 1)。座席铸点 {@link createGovernanceSeams}(第 6 段)**不判**:
|
|
46
|
+
* 那一刻两格基线恒空(修前判据就跑在那里,于是 `mcp` 锁 / `mcp_servers` 否决对 config.d 与中心声明的服务器从不拒启,任务腿各自在引擎门口
|
|
47
|
+
* 撞拒);它的 config 窄口里也就没有那两格 —— 「物化之前判」这一形在编译期就写不出来。没有运行期补判:不留每腿 400 臂、不留静默卸臂。
|
|
41
48
|
*
|
|
42
49
|
* ## 件D 的边界(成文,别读成「数据会被删」)
|
|
43
50
|
*
|
|
@@ -62,7 +69,8 @@ export interface GovernanceSeams {
|
|
|
62
69
|
}
|
|
63
70
|
/** 依赖收窄到真实消费面(接口隔离 —— 测试用真形字面量,零铸形)。 */
|
|
64
71
|
export interface GovernanceSeamsCtx {
|
|
65
|
-
|
|
72
|
+
/** 没有 `mcpServers` / `a2aPeers`:座席铸在部署基线物化之前,装配相容性判据不在这里(见文件头「时点」)。 */
|
|
73
|
+
config: Pick<ServiceConfig, "compliancePosture" | "lockedConfigKeys" | "retentionPolicy" | "retentionSweep">;
|
|
66
74
|
logger: Pick<Logger, "info" | "warn">;
|
|
67
75
|
/**
|
|
68
76
|
* core 留存能力校验的对象集(名字进拒启文案)。喂的是**装配现场的真店**,不是「我以为装了什么」——
|
|
@@ -79,41 +87,18 @@ export interface GovernanceSeamsCtx {
|
|
|
79
87
|
*/
|
|
80
88
|
retentionExecutor: ManagedRetentionCapability | null;
|
|
81
89
|
}
|
|
90
|
+
/** 装配相容性门的输入 = **装配完成后**的部署事实(部署 MCP / A2A 基线物化之后读;见文件头「时点」)。 */
|
|
91
|
+
export type GovernanceAssemblyFacts = Pick<ServiceConfig, "lockedConfigKeys" | "compliancePosture" | "mcpServers" | "a2aPeers" | "requirePrincipal">;
|
|
82
92
|
/**
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
93
|
+
* **装配相容性门**(见文件头「一条判据、一个时点」):锁住的键 / 否决的能力所守的面撞上本部署装配的面 ⇒ 抛(起服拒)。
|
|
94
|
+
* 🔴 时点即契约:调用方必须在部署 MCP / A2A 基线**物化之后**调它(server 第 7 段紧跟 `applyCenterCapabilities`;run-local 在候选采纳段之后),
|
|
95
|
+
* 每个起服入口恰好一次。中心侧后来加了 MCP 服务器 / A2A 对端:那一族是 restart-to-apply 面,变更翻 `restartRequired` 让编排器滚动重启 ——
|
|
96
|
+
* 重启就撞上这道门,所以没有第二条热路径判据。
|
|
87
97
|
*/
|
|
88
|
-
export declare function
|
|
89
|
-
lockedKeys: ReadonlySet<LockedKey>;
|
|
90
|
-
deploymentMcpConfigured: boolean;
|
|
91
|
-
}): void;
|
|
92
|
-
/**
|
|
93
|
-
* 治理面的**装配相容性**总判据(codex 交叉复审 R2-F2 起扩面)——锁与合规档位在这条轴上是同一件事:
|
|
94
|
-
* 两者都可能把「本部署自己的装配」判成 core 门口的违规,而那不是「配得更严」,是**这台从此每条腿必失败**。
|
|
95
|
-
*
|
|
96
|
-
* 合规半场的判据来自亲核 core 的 prepare 门(`prepare-task` 的 compliance 段):被否决的能力若**已在
|
|
97
|
-
* spec 上**,core 是**整拒 prepare**(`config.compliance_denied`),不是「不挂载」。于是:
|
|
98
|
-
* · `mcp_servers` 被禁 ∧ 部署自带 MCP 基线 ⇒ 每条腿的 `spec.mcp` 都在 ⇒ 必拒;
|
|
99
|
-
* · `web_fetch` 被禁 ∧ 花名册挂了 WebFetch ⇒ 必拒。⚠️ `hipaa` 的**内建 floor 就含 `web_fetch`**,而本仓
|
|
100
|
-
* 的单用户花名册**恒挂** WebFetch(`capabilities/scenarios.ts` 的 roster 过滤只在多租户下摘它)——
|
|
101
|
-
* 也就是说「单用户 + hipaa」在本仓是一个每条腿必失败的组合。这条判据的全部价值就在这儿:让它在
|
|
102
|
-
* 启动期说出来,而不是让运维看着一台"启动成功、任务全失败"的 worker 猜。
|
|
103
|
-
* · `workflows` 被禁只在 `spec.selfOrchestration === true` 的腿上拒(per-task,不是部署恒真)⇒ 不在本
|
|
104
|
-
* 判据内,由那条腿自己响亮拒;`org_memory_mount` 走件A 的准入面。**成文定界,不留白。**
|
|
105
|
-
*/
|
|
106
|
-
export declare function assertGovernanceAssemblable(input: {
|
|
107
|
-
lockedKeys: ReadonlySet<LockedKey>;
|
|
108
|
-
/** 已解析的合规否决集(空集 = 无档位)。 */
|
|
109
|
-
complianceDenies: ReadonlySet<string>;
|
|
110
|
-
deploymentMcpConfigured: boolean;
|
|
111
|
-
/** 本部署的花名册是否会挂 WebFetch(= 单用户形;多租户下 roster 过滤掉它)。 */
|
|
112
|
-
webFetchMounted: boolean;
|
|
113
|
-
}): void;
|
|
98
|
+
export declare function assertGovernanceAssemblable(facts: GovernanceAssemblyFacts): void;
|
|
114
99
|
/**
|
|
115
|
-
*
|
|
116
|
-
* (
|
|
100
|
+
* 装配三座席(件B/C/D)与 core 的留存能力校验 —— **不**判装配相容性:座席铸在部署 MCP / A2A 基线物化之前,那道门由起服入口在物化之后调
|
|
101
|
+
* {@link assertGovernanceAssemblable}(见文件头「时点」)。
|
|
117
102
|
*/
|
|
118
103
|
export declare function createGovernanceSeams(ctx: GovernanceSeamsCtx): GovernanceSeams;
|
|
119
104
|
//# sourceMappingURL=governance-seams.d.ts.map
|
|
@@ -1,44 +1,77 @@
|
|
|
1
1
|
import { assertRetentionCapability, resolveComplianceDenies, resolveLockedKeys } from "@sema-agent/core";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import { DEPLOYMENT_SHAPE_PREDICATES } from "../deployment-shape.js";
|
|
3
|
+
const FACE_ASSEMBLED = {
|
|
4
|
+
toolPolicy: () => true,
|
|
5
|
+
mcp: (facts) => (facts.mcpServers?.servers.length ?? 0) > 0,
|
|
6
|
+
a2a: (facts) => (facts.a2aPeers?.length ?? 0) > 0,
|
|
7
|
+
webFetch: (facts) => !DEPLOYMENT_SHAPE_PREDICATES.multiTenant.holds(facts),
|
|
8
|
+
};
|
|
9
|
+
const LOCK_CONFLICTS = {
|
|
10
|
+
toolPolicy: {
|
|
11
|
+
face: "toolPolicy",
|
|
12
|
+
refusal: 'LOCKED_CONFIG_KEYS contains "toolPolicy", which this server cannot arm: it COMPOSES the effective tool policy itself on ' +
|
|
5
13
|
"every leg (deployment approval baseline + the tighten-only governance pass over the sensitive-path guard set), so " +
|
|
6
14
|
"`TaskSpec.toolPolicy` is always present at the engine's prepare door and the lock would refuse EVERY task with " +
|
|
7
15
|
"config.locked_key. The policy is already deployment-owned and no request can loosen it (the fold is deny-wins), so " +
|
|
8
|
-
"this lock has nothing to guard here — remove it from LOCKED_CONFIG_KEYS."
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
|
|
16
|
+
"this lock has nothing to guard here — remove it from LOCKED_CONFIG_KEYS.",
|
|
17
|
+
},
|
|
18
|
+
mcp: {
|
|
19
|
+
face: "mcp",
|
|
20
|
+
refusal: 'LOCKED_CONFIG_KEYS contains "mcp" while this deployment configures MCP servers of its own (config.d/mcp.json or the center\'s mcp domain): the ' +
|
|
12
21
|
"deployment's servers ride the SAME `TaskSpec.mcp` field the lock guards (the engine has no deployment-level MCP seat), " +
|
|
13
22
|
"so every task would be refused at prepare with config.locked_key. Either drop the `mcp` lock, or remove the configured " +
|
|
14
|
-
"MCP servers — a locked deployment mounts no MCP at all."
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
23
|
+
"MCP servers — a locked deployment mounts no MCP at all.",
|
|
24
|
+
},
|
|
25
|
+
a2a: {
|
|
26
|
+
face: "a2a",
|
|
27
|
+
refusal: 'LOCKED_CONFIG_KEYS contains "a2a" while this deployment configures A2A peers of its own (the center\'s a2a domain): the ' +
|
|
28
|
+
"deployment's peers ride the SAME `TaskSpec.a2a` field the lock guards (the engine has no deployment-level A2A peer seat), " +
|
|
29
|
+
"so every task would be refused at prepare with config.locked_key. Either drop the `a2a` lock, or remove the configured " +
|
|
30
|
+
"A2A peers — a locked deployment dials no A2A peer at all.",
|
|
31
|
+
},
|
|
32
|
+
compliancePosture: null,
|
|
33
|
+
retentionPolicy: null,
|
|
34
|
+
};
|
|
35
|
+
const DENY_CONFLICTS = {
|
|
36
|
+
mcp_servers: {
|
|
37
|
+
face: "mcp",
|
|
38
|
+
refusal: 'the compliance posture denies "mcp_servers" while this deployment configures MCP servers of its own: the engine REFUSES ' +
|
|
21
39
|
"(not silently narrows) every prepare whose TaskSpec.mcp is non-empty, so every task would fail with config.compliance_denied. " +
|
|
22
|
-
"Remove the configured MCP servers, or drop mcp_servers from the posture."
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
|
|
40
|
+
"Remove the configured MCP servers, or drop mcp_servers from the posture.",
|
|
41
|
+
},
|
|
42
|
+
a2a_peers: {
|
|
43
|
+
face: "a2a",
|
|
44
|
+
refusal: 'the compliance posture denies "a2a_peers" while this deployment configures A2A peers of its own: the engine REFUSES ' +
|
|
45
|
+
"(not silently narrows) every prepare whose TaskSpec.a2a is non-empty, so every task would fail with config.compliance_denied. " +
|
|
46
|
+
"Remove the configured A2A peers, or drop a2a_peers from the posture.",
|
|
47
|
+
},
|
|
48
|
+
web_fetch: {
|
|
49
|
+
face: "webFetch",
|
|
50
|
+
refusal: 'the compliance posture denies "web_fetch" while this deployment mounts the WebFetch tool: the engine REFUSES every prepare ' +
|
|
26
51
|
"whose roster carries it, so every task on the default roster would fail with config.compliance_denied. This server drops " +
|
|
27
52
|
"WebFetch from the roster only on a MULTI-TENANT deployment (REQUIRE_PRINCIPAL=true) — a single-user deployment cannot " +
|
|
28
|
-
"currently honor a web_fetch denial. Run the posture multi-tenant, or drop the profile/deny."
|
|
29
|
-
}
|
|
53
|
+
"currently honor a web_fetch denial. Run the posture multi-tenant, or drop the profile/deny.",
|
|
54
|
+
},
|
|
55
|
+
workflows: null,
|
|
56
|
+
org_memory_mount: null,
|
|
57
|
+
};
|
|
58
|
+
function resolveGovernanceDeclarations(config) {
|
|
59
|
+
return {
|
|
60
|
+
lockedKeys: resolveLockedKeys(config.lockedConfigKeys !== undefined ? { keys: config.lockedConfigKeys } : undefined),
|
|
61
|
+
complianceDenies: config.compliancePosture !== undefined ? resolveComplianceDenies(config.compliancePosture) : new Set(),
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
export function assertGovernanceAssemblable(facts) {
|
|
65
|
+
const { lockedKeys, complianceDenies } = resolveGovernanceDeclarations(facts);
|
|
66
|
+
const conflicts = [...[...lockedKeys].map((key) => LOCK_CONFLICTS[key]), ...[...complianceDenies].map((cap) => DENY_CONFLICTS[cap])];
|
|
67
|
+
for (const conflict of conflicts)
|
|
68
|
+
if (conflict !== null && FACE_ASSEMBLED[conflict.face](facts))
|
|
69
|
+
throw new Error(conflict.refusal);
|
|
30
70
|
}
|
|
31
71
|
export function createGovernanceSeams(ctx) {
|
|
32
72
|
const { config, logger, retentionStores } = ctx;
|
|
33
|
-
const
|
|
73
|
+
const { lockedKeys, complianceDenies } = resolveGovernanceDeclarations(config);
|
|
34
74
|
const posture = config.compliancePosture;
|
|
35
|
-
const complianceDenies = posture !== undefined ? resolveComplianceDenies(posture) : new Set();
|
|
36
|
-
assertGovernanceAssemblable({
|
|
37
|
-
lockedKeys,
|
|
38
|
-
complianceDenies,
|
|
39
|
-
deploymentMcpConfigured: (config.mcpServers?.servers.length ?? 0) > 0,
|
|
40
|
-
webFetchMounted: config.requirePrincipal !== true,
|
|
41
|
-
});
|
|
42
75
|
const lockedConfig = config.lockedConfigKeys !== undefined && config.lockedConfigKeys.length > 0 ? { keys: config.lockedConfigKeys } : undefined;
|
|
43
76
|
if (lockedConfig)
|
|
44
77
|
logger.info("locked_config_enabled", { keys: [...lockedKeys].sort() });
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* 晚绑席([ref] 十段切分的**唯一**跨段可变面)——
|
|
2
|
+
* 晚绑席([ref] 十段切分的**唯一**跨段可变面)—— 五只 cell,读点在前段、写点在后段。
|
|
3
3
|
*
|
|
4
4
|
* 为什么是模块级 live binding 而不是 ctx 字段:读点的原文是**裸标识符**(`() => runStore`、
|
|
5
5
|
* `() => parkedAskRedeem`),而 ctx 字段是**快照** —— 把读点改成 `ctx.runStore` 就是正文改写,
|
|
@@ -8,9 +8,10 @@
|
|
|
8
8
|
* · `runStore` / `rateLimiter` —— 声明行留在第 7 段原位,紧随一行 `bindX(...)` 把值交过来;
|
|
9
9
|
* · `parkedAskRedeem` / `runDenySweep` —— 它们的**声明行本身**就是 `let`(逐字搬进本文件,含缩进),
|
|
10
10
|
* 赋值点(server 造出来之后那两处)也随之搬进 `bindServerLateSeats` —— 跨模块给 import 赋值是非法的,
|
|
11
|
-
* 所以 cell
|
|
11
|
+
* 所以 cell 与它的写点必须同居一个模块;
|
|
12
|
+
* · `sessionNotifyDoor` —— 同上一形(server 的产物,写点在 `bindServerLateSeats`)。
|
|
12
13
|
*
|
|
13
|
-
*
|
|
14
|
+
* 时序与修前逐字相同:五只 cell 的读点全是 `() => x` 取值闭包(boot 期不求值,最早的求值发生在
|
|
14
15
|
* listen 之后的请求/tick 上),写点仍在各自原来的那一拍。未绑窗内取值得到 `undefined` —— 这正是
|
|
15
16
|
* 各消费座既有的 fail-closed 臂(device 限速座:`gate()` 取不到就抛,见 boot/device-lane.ts:68)。
|
|
16
17
|
*/
|
|
@@ -20,11 +21,13 @@ import type { RateGate } from "../observability/rate-limit.js";
|
|
|
20
21
|
import type { ServiceConfig } from "../config.js";
|
|
21
22
|
import type { StoreBackend } from "../plugins/store-backend.js";
|
|
22
23
|
import type { createHttpServer } from "../http/server.js";
|
|
24
|
+
import type { SessionNotifyDoor } from "../session-notify-door.js";
|
|
23
25
|
declare let runStore: ReturnType<StoreBackend["run"]> | undefined;
|
|
24
26
|
declare let rateLimiter: RateGate | undefined;
|
|
25
27
|
declare let parkedAskRedeem: ParkedAskRedeem | undefined;
|
|
26
28
|
declare let runDenySweep: ((now: number) => Promise<void>) | undefined;
|
|
27
|
-
|
|
29
|
+
declare let sessionNotifyDoor: SessionNotifyDoor | undefined;
|
|
30
|
+
export { runStore, rateLimiter, parkedAskRedeem, runDenySweep, sessionNotifyDoor };
|
|
28
31
|
export declare function bindRunStore(v: ReturnType<StoreBackend["run"]> | undefined): void;
|
|
29
32
|
export declare function bindRateLimiter(v: RateGate): void;
|
|
30
33
|
export declare function bindServerLateSeats(ctx: {
|
package/dist/boot/late-binds.js
CHANGED
|
@@ -2,7 +2,8 @@ let runStore;
|
|
|
2
2
|
let rateLimiter;
|
|
3
3
|
let parkedAskRedeem;
|
|
4
4
|
let runDenySweep;
|
|
5
|
-
|
|
5
|
+
let sessionNotifyDoor;
|
|
6
|
+
export { runStore, rateLimiter, parkedAskRedeem, runDenySweep, sessionNotifyDoor };
|
|
6
7
|
export function bindRunStore(v) {
|
|
7
8
|
runStore = v;
|
|
8
9
|
}
|
|
@@ -12,6 +13,7 @@ export function bindRateLimiter(v) {
|
|
|
12
13
|
export function bindServerLateSeats(ctx) {
|
|
13
14
|
const { config, logger, server } = ctx;
|
|
14
15
|
runDenySweep = server.denyExpiredApprovals;
|
|
16
|
+
sessionNotifyDoor = server.sessionNotifyDoor;
|
|
15
17
|
if (!config.directDoorActive)
|
|
16
18
|
parkedAskRedeem = server.redeemParkedAsk;
|
|
17
19
|
else
|
package/dist/boot/leader.js
CHANGED
|
@@ -45,7 +45,7 @@ export function createLeaderFace(ctx) {
|
|
|
45
45
|
(leaderProvider === "k8s" && "s3" in leaderMinio && executionEnvFactory) ||
|
|
46
46
|
(leaderProvider === "host" && executionEnvFactory))
|
|
47
47
|
? createLeaderEndpoint(createLeaderRunner({
|
|
48
|
-
brain, models: config.models, roles: config.roles, pricing, logger,
|
|
48
|
+
brain, models: config.models, roles: config.roles, tiers: config.tiers, pricing, logger,
|
|
49
49
|
governance: {
|
|
50
50
|
compliancePostureResolver: governanceSeams.compliancePostureResolver,
|
|
51
51
|
lockedConfig: governanceSeams.lockedConfig,
|
|
@@ -61,9 +61,7 @@ export function createLeaderFace(ctx) {
|
|
|
61
61
|
...(ctx.onError ? { onError: ctx.onError } : {}),
|
|
62
62
|
mods: ctx.deploymentMods,
|
|
63
63
|
fanoutEnabled: config.leaderFanoutEnabled,
|
|
64
|
-
...(
|
|
65
|
-
? { routerModel: (process.env.MODEL_ROUTER_ID || process.env.MODEL_CHEAP_ID) }
|
|
66
|
-
: {}),
|
|
64
|
+
...(process.env.MODEL_ROUTER_ID ? { routerModel: process.env.MODEL_ROUTER_ID } : {}),
|
|
67
65
|
...(leaderProvider === "e2b" ? { e2bApiKey: config.remoteExec.apiKey } : {}),
|
|
68
66
|
...(executionEnvFactory ? { envFactory: executionEnvFactory } : {}),
|
|
69
67
|
...leaderMinio,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { type LaneHomeDeployment } from "../execution-lane-caps.js";
|
|
2
2
|
import { type MemoryScopeStores } from "../memory-scope-stores.js";
|
|
3
|
-
import type { SessionCaptureRecordSource } from "../plugins/store-backend.js";
|
|
4
3
|
import type { RestartSliceCtx } from "../web-admin-client/restart-signal.js";
|
|
5
4
|
import type { MemoryConsolidationDriverConfig, ServiceConfig } from "../config-types.js";
|
|
6
5
|
import { resolveMemoryConsolidationDriver, type ConsolidationWriteJudge, type ConsolidationWriteJudgeInput, type EngineNotice, type ConsolidationDriverRunRow, type ConsolidationRunReceipt, type MemoryConsolidationDriverDeps, type PermissionRuleStoreProvider } from "@sema-agent/core";
|
|
@@ -500,13 +499,6 @@ export declare function createMemoryConsolidationFaces(stores: MemoryScopeStores
|
|
|
500
499
|
/** 停因自由文本的**运维日志**座(缺席 = 没人听,不影响任何行为)。载荷由 {@link buildStopDetailAudit}
|
|
501
500
|
* 铸,调用点在单飞回调**之内** ⇒ 一轮真 run 一行,并入的等待者不各落一行。 */
|
|
502
501
|
onStopDetail?: (audit: ReturnType<typeof buildStopDetailAudit>) => void;
|
|
503
|
-
/** [ref]②(383 §2.1b):capture opt-out 记录的按平面取用源(main.ts 取一次,与 Runner 同源;每只引擎按它那只店的控制面取)。
|
|
504
|
-
* 🔴 这只引擎是四只 operator 面里**真读名册**的那只:`consolidationEligibility` 第四臂
|
|
505
|
-
* (engine.js `listCaptureOptOutSessions`)拿它筛掉 opt-out 会话的贡献条目 —— SQL 部署上漏喂
|
|
506
|
-
* = 驱动器读文件空名册 ⇒ 蒸馏器放大用户明说不要记的内容(S-5 真实失效形;全站同批注入律,
|
|
507
|
-
* 机器钉 capture-optout-lane ②)。[ref] 起 local 车道在引擎接线时也供(core 文件三腿,同一只控制面);
|
|
508
|
-
* 缺席 ⇒ 记忆面暗(引擎未接线),与 Runner 同本。 */
|
|
509
|
-
captureRecords?: SessionCaptureRecordSource;
|
|
510
502
|
/** core 7.50.0:整理跑的**写判官座**(必填 —— 缺席不是「没有规则」,core 也拒)。操作面不判任何东西,只把它原样递给驱动动词:
|
|
511
503
|
* 早问库目录一次、应用时问每个产物文件,答 `no_objection` 以外一律拒写。装配层给哪一只见 {@link createOperatorValveWriteJudge}。 */
|
|
512
504
|
writeJudge: ConsolidationWriteJudge;
|
|
@@ -4,9 +4,10 @@ import { buildOperatorRosterWayOut } from "../http/principal-gate.js";
|
|
|
4
4
|
import { memoryMountRootOf } from "../memory-scope.js";
|
|
5
5
|
import { executionLaneHomeDir } from "../execution-lane-caps.js";
|
|
6
6
|
import { DEFAULT_MODEL_REF, resolveMainModel } from "../model-select.js";
|
|
7
|
-
import {
|
|
8
|
-
import { memoryStoreForRequest } from "../memory-scope-stores.js";
|
|
7
|
+
import { captureRecordStoreOf } from "../memory-operator-faces.js";
|
|
8
|
+
import { backendOwnsControlPlane, memoryStoreForRequest } from "../memory-scope-stores.js";
|
|
9
9
|
import { createConsolidationWriteJudge, deliverWriteRefusal, expandTiers, MemoryEngine, modelOriginOf, readConsolidationDriverRun, resolveMemoryConsolidationDriver, runMemoryConsolidationDriver, } from "@sema-agent/core";
|
|
10
|
+
import { seatText } from "../trace/exit-seat.js";
|
|
10
11
|
export function resolveConsolidationDriverSeat(deps) {
|
|
11
12
|
let options;
|
|
12
13
|
try {
|
|
@@ -238,7 +239,7 @@ function decideConsolidationValve(input) {
|
|
|
238
239
|
return { valve: { enabled: true, source: "derived", catalogDependent: true } };
|
|
239
240
|
const seatFact = billing.kind === "main-model"
|
|
240
241
|
? `Here the seat resolves to the main model "${billing.mainModel}" (no MODEL_CHEAP_ID naming another model, and no catalog roles.consolidate / roles.summarize / "flash" tier binding to another model)`
|
|
241
|
-
: `Here no consolidation seat resolves at all (${billing.fault})`;
|
|
242
|
+
: `Here no consolidation seat resolves at all (${seatText("operator-log-text", billing.fault)})`;
|
|
242
243
|
return {
|
|
243
244
|
valve: {
|
|
244
245
|
enabled: false,
|
|
@@ -341,7 +342,7 @@ export function createMemoryConsolidationFaces(stores, input) {
|
|
|
341
342
|
const known = engines.get(store);
|
|
342
343
|
if (known !== undefined)
|
|
343
344
|
return known;
|
|
344
|
-
const records = captureRecordStoreOf(
|
|
345
|
+
const records = captureRecordStoreOf(stores.captureRecords, store);
|
|
345
346
|
const engine = new MemoryEngine({
|
|
346
347
|
backend: store,
|
|
347
348
|
memoryDir: memoryMountRootOf(store, stores.root),
|
|
@@ -8,6 +8,7 @@ import { DeferredSandboxPathEnv, sandboxPathEnvSlots } from "./deferred-sandbox-
|
|
|
8
8
|
import { DEPLOYMENT_SHAPE_PREDICATES } from "../deployment-shape.js";
|
|
9
9
|
import { executionLaneHomeDir } from "../execution-lane-caps.js";
|
|
10
10
|
import { createDeploymentListExemption } from "../approval.js";
|
|
11
|
+
import { seatText } from "../trace/exit-seat.js";
|
|
11
12
|
function hostGateCwd(config, localRoot) {
|
|
12
13
|
return join(config.localDataRoot ?? localRoot, "parked-revive-unrooted");
|
|
13
14
|
}
|
|
@@ -63,7 +64,7 @@ async function resolveCapsFor(deps, identity) {
|
|
|
63
64
|
return await deps.resolveRuntimeCaps(identity.principal);
|
|
64
65
|
}
|
|
65
66
|
catch (err) {
|
|
66
|
-
deps.logger.warn("parked_revive_caps_unresolved", { principal: identity.principal ?? null, err: err instanceof Error ? err.message : String(err) });
|
|
67
|
+
deps.logger.warn("parked_revive_caps_unresolved", { principal: identity.principal ?? null, err: seatText("operator-log-text", err instanceof Error ? err.message : String(err)) });
|
|
67
68
|
return undefined;
|
|
68
69
|
}
|
|
69
70
|
}
|
|
@@ -1,31 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* [ref] §3([ref] v2 §6 F4 的**残余采纳**)—— 默认 ON 的**休眠行审计**。
|
|
3
|
-
*
|
|
4
|
-
* 🔴 这条审计存在的唯一理由:`PERMISSION_RULES_ENABLED` 的默认值在本车从 OFF 翻成 ON,而**旋钮翻转
|
|
5
|
-
* 与规则行的寿命是两条独立的时间线**。三张表自 [ref] 车二起就随中央 `ensureSchema` 建、并且从来没有被
|
|
6
|
-
* 清过,所以下面这两类部署在升级的那一刻会突然带着**既有**规则行开始放行:
|
|
7
|
-
* · 曾经把旋钮开过一段时间又关掉的部署(行留在库里,只是没人读);
|
|
8
|
-
* · 从旧库恢复/克隆出来的部署(行跟着数据一起来的)。
|
|
9
|
-
* 对运维来说,这是「我什么都没改,worker 却开始少问我了」——一次**放宽面**上的静默变化。审计做的事
|
|
10
|
-
* 很小但是承重:在启动日志里把它说出来,让「少问」是一条能被读到的因果,而不是一次玄学。
|
|
11
|
-
*
|
|
12
|
-
* ── 三条判据,逐条有理由 ────────────────────────────────────────────────────────────────────────
|
|
13
|
-
* ① **店缺席 ⇒ 整条不上场**(零 I/O、零行)。店缺席包括:显式关旋钮、`local` 车道没接 File 店的旧
|
|
14
|
-
* 部署、以及压根没有 backend 的 env-only worker。没有店就没有行,谈不上唤醒。
|
|
15
|
-
* ② **零桶 ⇒ 不打行**。一条「0 条既有规则随默认 ON 激活」的行是纯噪音:它对读日志的人不传递任何
|
|
16
|
-
* 可行动的信息,却让真正有东西被唤醒的那一行变得不显眼。
|
|
17
|
-
* ③ **运维**显式**表过态(`PERMISSION_RULES_ENABLED` 被设成 true 或 false)⇒ 不打行**。那些行本来
|
|
18
|
-
* 就是活的(或者旋钮被显式关着、店根本没装配),默认值翻不翻转对它们零影响 —— 说「随默认 ON
|
|
19
|
-
* 激活」是**假话**,而在启动日志里说假话比不说更坏。判据用 `permissionRulesEnabledExplicit`
|
|
20
|
-
* (config.ts 与 `dbBackendExplicit` 同姿势),不是猜。
|
|
21
|
-
*
|
|
22
|
-
* ── 失败方向 ────────────────────────────────────────────────────────────────────────────────────
|
|
23
|
-
* 数不出来(库抖动 / 文件读不了)⇒ **不拒启、也不编一个 0 出来**:返回 `undefined` + 一条 warn。
|
|
24
|
-
* 这是一条纯诊断面(它不参与任何放行/拒绝判决),所以它的降级方向是「安静地不知道」而不是「谎报
|
|
25
|
-
* 零」——`{ buckets: 0 }` 会被下游读成「确认没有休眠行」,那是把一次读失败伪装成一个结论。
|
|
26
|
-
* 因为它零判决,这条 fail-open 不属于 `docs/FAIL-OPEN-CENSUS.md` 的安全轴 P 类,故不占 `recordFailOpen`
|
|
27
|
-
* 的标签;它的可见性由那条 warn 承担。
|
|
28
|
-
*/
|
|
29
1
|
/** 审计只需要一只桶计数口——**刻意**不吃整个 `PermissionRuleStoreBundle`:诊断面对店的其余能力
|
|
30
2
|
* 一无所知也不该知道,窄口让测试能用四行 fixture 驱动真实现同一段代码。 */
|
|
31
3
|
export interface DormantRuleCounter {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { seatText } from "../trace/exit-seat.js";
|
|
1
2
|
export async function auditDormantPermissionRules(ctx) {
|
|
2
3
|
if (ctx.stores === undefined)
|
|
3
4
|
return undefined;
|
|
@@ -7,7 +8,7 @@ export async function auditDormantPermissionRules(ctx) {
|
|
|
7
8
|
}
|
|
8
9
|
catch (err) {
|
|
9
10
|
ctx.logger.warn?.("permission_rules_dormant_audit_failed", {
|
|
10
|
-
error: err instanceof Error ? err.message : String(err),
|
|
11
|
+
error: seatText("operator-log-text", err instanceof Error ? err.message : String(err)),
|
|
11
12
|
note: "the boot audit could not count pre-existing permission-rule buckets; the lane itself is unaffected",
|
|
12
13
|
});
|
|
13
14
|
return undefined;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { compileReadDeny, readDenyRowAnchor } from "@sema-agent/core";
|
|
2
2
|
import { echoCallerText } from "../caller-text-echo.js";
|
|
3
|
+
import { seatText } from "../trace/exit-seat.js";
|
|
3
4
|
export const READ_DENY_AUDIT_MAX_NAMED_ROWS = 20;
|
|
4
5
|
const NAMED_ROW_ECHO_CHARS = 200;
|
|
5
6
|
function isAnchoredCanonicalRow(canonical) {
|
|
@@ -14,7 +15,7 @@ export function auditReadDenyAnchoring(ctx) {
|
|
|
14
15
|
}
|
|
15
16
|
catch (err) {
|
|
16
17
|
ctx.logger.warn("read_deny_anchor_audit_failed", {
|
|
17
|
-
error:
|
|
18
|
+
error: seatText("operator-log-text", err instanceof Error ? err.message : String(err)),
|
|
18
19
|
note: "the boot audit could not read the deployment read-deny rows, so it names none and changes nothing; the engine itself refuses a row it cannot read when the Runner is built",
|
|
19
20
|
});
|
|
20
21
|
return [];
|
package/dist/boot/reapers.js
CHANGED
|
@@ -6,6 +6,7 @@ import { createApprovalReconciler } from "../approval-reconciler.js";
|
|
|
6
6
|
import { createE2bOrphanSandboxProvider, reclaimOrphanE2bSandboxes, E2B_ORPHAN_GRACE_MS } from "../plugins/e2b-orphan-reclaim.js";
|
|
7
7
|
import { SANDBOX_POD_REAP_PERIOD_MS } from "../plugins/k8s-pod-reaper.js";
|
|
8
8
|
import { APPROVAL_ASK_RETENTION_PASS_MS, runApprovalAskRetentionPass } from "../approval-ask-retention.js";
|
|
9
|
+
import { seatText } from "../trace/exit-seat.js";
|
|
9
10
|
export const REAPER_FAILURE_WARN_THRESHOLD = 5;
|
|
10
11
|
export function createThrottledReaperCatch(name, logger, threshold = REAPER_FAILURE_WARN_THRESHOLD) {
|
|
11
12
|
let streak = 0;
|
|
@@ -21,7 +22,7 @@ export function createThrottledReaperCatch(name, logger, threshold = REAPER_FAIL
|
|
|
21
22
|
logger.warn("reaper_leg_repeated_failure", {
|
|
22
23
|
reaper: name,
|
|
23
24
|
consecutiveFailures: streak,
|
|
24
|
-
lastError: err instanceof Error ? err.message : String(err),
|
|
25
|
+
lastError: seatText("operator-log-text", err instanceof Error ? err.message : String(err)),
|
|
25
26
|
});
|
|
26
27
|
}
|
|
27
28
|
catch {
|
|
@@ -90,7 +91,7 @@ export function startReapers(ctx) {
|
|
|
90
91
|
const runDenySweepGuard = createThrottledReaperCatch("run_deny_sweep", logger);
|
|
91
92
|
const runsReapSuspendedGuard = createThrottledReaperCatch("runs_reap_suspended", logger);
|
|
92
93
|
const checkpointReapCtxGuard = createThrottledReaperCatch("checkpoint_reap_ctx", logger);
|
|
93
|
-
const
|
|
94
|
+
const toolResultReapGuard = createThrottledReaperCatch("tool_result_reap", logger);
|
|
94
95
|
const fileHistorySweepOrphanBlobsGuard = createThrottledReaperCatch("file_history_sweep_orphan_blobs", logger);
|
|
95
96
|
const legacySnapshotBlobSweepGuard = createThrottledReaperCatch("legacy_snapshot_blob_sweep", logger);
|
|
96
97
|
const attachmentReapUnboundGuard = createThrottledReaperCatch("attachment_reap_unbound", logger);
|
|
@@ -169,7 +170,7 @@ export function startReapers(ctx) {
|
|
|
169
170
|
catch (err) {
|
|
170
171
|
failedScopes++;
|
|
171
172
|
try {
|
|
172
|
-
logger.warn("bg_agent_reap_scope_failed", { scope, err: err instanceof Error ? err.message : String(err) });
|
|
173
|
+
logger.warn("bg_agent_reap_scope_failed", { scope, err: seatText("operator-log-text", err instanceof Error ? err.message : String(err)) });
|
|
173
174
|
}
|
|
174
175
|
catch {
|
|
175
176
|
}
|
|
@@ -243,9 +244,10 @@ export function startReapers(ctx) {
|
|
|
243
244
|
rateLimiter?.sweep();
|
|
244
245
|
if (costQuota instanceof CostQuota)
|
|
245
246
|
costQuota.reap();
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
247
|
+
const reapToolResults = toolResultStore?.reap?.bind(toolResultStore);
|
|
248
|
+
leg(reapToolResults && Promise.resolve()
|
|
249
|
+
.then(() => reapToolResults(Date.now(), { maxAgeMs: config.toolResultTtlSec * 1000 }))
|
|
250
|
+
.then(() => toolResultReapGuard.onSuccess(), toolResultReapGuard.onError));
|
|
249
251
|
leg(fileHistoryErasure
|
|
250
252
|
?.sweepOrphanBlobs?.()
|
|
251
253
|
.then(() => fileHistorySweepOrphanBlobsGuard.onSuccess(), fileHistorySweepOrphanBlobsGuard.onError));
|
|
@@ -266,7 +268,7 @@ export function startReapers(ctx) {
|
|
|
266
268
|
} })
|
|
267
269
|
.catch((err) => {
|
|
268
270
|
try {
|
|
269
|
-
logger.warn("attachment_orphan_sweep_failed", { err: err instanceof Error ? err.message : String(err) });
|
|
271
|
+
logger.warn("attachment_orphan_sweep_failed", { err: seatText("operator-log-text", err instanceof Error ? err.message : String(err)) });
|
|
270
272
|
}
|
|
271
273
|
catch {
|
|
272
274
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SessionEnvironmentSelection, selectEnvironmentTool } from "../capabilities/select-environment-tool.js";
|
|
2
2
|
import { sendUserFileTool } from "../capabilities/send-user-file-tool.js";
|
|
3
3
|
import { selectScenario } from "../capabilities/scenarios.js";
|
|
4
|
-
import {
|
|
4
|
+
import type { LoadedSkill } from "../capabilities/skills.js";
|
|
5
5
|
import type { ServiceConfig } from "../config.js";
|
|
6
6
|
import { type LiveQuestionFace } from "../deployment-governance.js";
|
|
7
7
|
import { FleetEventBus } from "../fleet/fleet-bus.js";
|
|
@@ -6,8 +6,8 @@ import { recordFailOpen } from "../observability/fail-open.js";
|
|
|
6
6
|
import { SessionEnvironmentSelection, selectEnvironmentTool } from "../capabilities/select-environment-tool.js";
|
|
7
7
|
import { sendUserFileTool } from "../capabilities/send-user-file-tool.js";
|
|
8
8
|
import { buildExcludeToolsSeat, buildPromptSeats, buildRunSkills, createScenarioGate, selectScenario } from "../capabilities/scenarios.js";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
9
|
+
import { toolPolicyForHands } from "../capabilities/hands-lane.js";
|
|
10
|
+
import { mintLegFacts } from "../leg-facts.js";
|
|
11
11
|
import { applyLongtailDefer } from "../capabilities/tool-defer.js";
|
|
12
12
|
import { assertGuardPatternsUsable, buildApprovalGrantNotice, buildOnlySensitiveBaselineWarning, createApprovalBaselinePolicy, createDeploymentGovernanceInputs } from "../deployment-governance.js";
|
|
13
13
|
import { createDeploymentListExemption, gateIntentUnserviceableReason, singleUserAutoAcceptBaselineApplies } from "../approval.js";
|
|
@@ -21,14 +21,14 @@ import { isAtMentionable, matchCatalogModel, refusedCatalogEntry, resolveTaskMod
|
|
|
21
21
|
import { echoModelRef, modelUnavailableMessage } from "../model-entry-refusal.js";
|
|
22
22
|
import { PerTaskImageRegistry, resolveSandboxImageRef } from "../per-task-image.js";
|
|
23
23
|
import { remoteScratchpadDirFor } from "../plugins/remote-scratchpad.js";
|
|
24
|
-
import { bindAttachmentsForTask } from "../plugins/task-attachment-store.js";
|
|
24
|
+
import { attachmentBindRefusalAnswer, bindAttachmentsForTask } from "../plugins/task-attachment-store.js";
|
|
25
25
|
import { resourceSuspendOptIn } from "../resource-suspend.js";
|
|
26
26
|
import { routeServiceTask, supPostureOverrides } from "../router/route-orchestration.js";
|
|
27
27
|
import { tightenGoverned } from "../governance-overrides.js";
|
|
28
28
|
import { applyRuntimeGovernance } from "../runtime-governance.js";
|
|
29
29
|
import { HttpError, createCodedHttpError, encodeCheckpointScope } from "../security.js";
|
|
30
30
|
import { headReadOf, sessionFaceOfHead } from "../session-incarnation.js";
|
|
31
|
-
import { legProjectIdOf, sessionWorkspaceStoreOf
|
|
31
|
+
import { legProjectIdOf, sessionWorkspaceStoreOf } from "../session-workspace.js";
|
|
32
32
|
import { memorySpecForRequest } from "../memory-scope.js";
|
|
33
33
|
import { createMemoryProjectLayers } from "../memory-project-layer.js";
|
|
34
34
|
import { inheritEnvFacts, inheritEnvFieldIssue, singleMemberOffFieldIssue } from "../request-value-closure.js";
|
|
@@ -50,7 +50,7 @@ import { inertToolListEntryOf } from "../rule-entry-list.js";
|
|
|
50
50
|
import { TENANCY_WALL_CLOCK_BASE_SEC, enableForkFromBody, normalizeRetainSubagentSessions, selfOrchestrationFromBody } from "../task-workflow.js";
|
|
51
51
|
import { redactSecrets } from "../trace/redact.js";
|
|
52
52
|
import { DeferredSandboxPathEnv, sandboxPathEnvSlots } from "./deferred-sandbox-path-env.js";
|
|
53
|
-
import { executionLaneHomeDir, executionLaneOf, laneWiresExecutionEnv } from "../execution-lane-caps.js";
|
|
53
|
+
import { executionLaneHomeDir, executionLaneOf, laneIsolated, laneWiresExecutionEnv } from "../execution-lane-caps.js";
|
|
54
54
|
import { executionConfigRootOf } from "../execution-config-root.js";
|
|
55
55
|
import { withUnattendedLeg } from "../unattended-permission-mode.js";
|
|
56
56
|
import { fieldConflictFacts } from "../field-conflict.js";
|
|
@@ -177,13 +177,13 @@ export function createResolveSpec(ctx) {
|
|
|
177
177
|
scratchpadDir: folded.scratchpadDir,
|
|
178
178
|
hostSemanticsLane: folded.hostSemanticsLane,
|
|
179
179
|
});
|
|
180
|
-
|
|
181
|
-
return stampLegSessionWitness(stampRunSkills(stamped, runSkills.roster), gated.sessionWitness);
|
|
180
|
+
return { spec: final, facts: { hands: gated.hands, skills: runSkills.roster, sessionWitness: gated.sessionWitness } };
|
|
182
181
|
};
|
|
183
182
|
const gateScenarioAndAppend = async (body, auth, opts) => {
|
|
184
183
|
const scenarioName = await scenarioGate(auth?.principal, body.scenario);
|
|
185
184
|
const root = opts.execution.root;
|
|
186
|
-
const
|
|
185
|
+
const rootFace = sessionHeadOf === undefined ? undefined : sessionFaceOfHead(root, await sessionHeadOf(root));
|
|
186
|
+
const sessionWitness = { sessionId: root, owner: rootFace?.owner ?? null, incarnation: rootFace?.incarnation ?? null };
|
|
187
187
|
const cap = selectScenario(scenarios, scenarioName)(body, auth?.principal, { sessionId: sessionWitness.sessionId, delegationRoot: sessionWitness });
|
|
188
188
|
const acceptedAppend = acceptAppendSystemPrompt(body.appendSystemPrompt, (detail) => logger.warn("append_system_prompt_dropped", { detail, sessionId: auth?.sessionId ?? null }));
|
|
189
189
|
const objective = typeof body.objective === "string" ? body.objective : "";
|
|
@@ -217,11 +217,13 @@ export function createResolveSpec(ctx) {
|
|
|
217
217
|
if (!auth?.sessionId)
|
|
218
218
|
throw new HttpError(400, "`attachmentIds` requires a session-resolving deployment (no authorizer session)");
|
|
219
219
|
const sid = auth.sessionId;
|
|
220
|
+
const lane = opts.execution.lane;
|
|
220
221
|
const r = await bindAttachmentsForTask({
|
|
221
222
|
store: taskAttachmentStore,
|
|
222
223
|
owner: auth?.principal ?? "default",
|
|
223
224
|
ids: reqAtt,
|
|
224
225
|
sessionId: sid,
|
|
226
|
+
lane: { word: lane, isolated: laneIsolated(lane) },
|
|
225
227
|
leg: opts?.leg === "fresh" ? "fresh" : "resume",
|
|
226
228
|
nowMs: Date.now(),
|
|
227
229
|
onMissing: (id) => {
|
|
@@ -229,6 +231,12 @@ export function createResolveSpec(ctx) {
|
|
|
229
231
|
throw new HttpError(400, `attachment not found: ${id}`);
|
|
230
232
|
logger.warn("attachment_missing_on_resume", { sessionId: sid, id });
|
|
231
233
|
},
|
|
234
|
+
onRefused: (refusal) => {
|
|
235
|
+
const answer = attachmentBindRefusalAnswer(refusal);
|
|
236
|
+
if (opts?.leg === "fresh")
|
|
237
|
+
throw createCodedHttpError(answer.status, answer.errorCode, answer.message, answer.extra);
|
|
238
|
+
logger.warn("attachment_refused_on_resume", { sessionId: sid, errorCode: answer.errorCode, ...answer.extra });
|
|
239
|
+
},
|
|
232
240
|
});
|
|
233
241
|
attachmentNotice = r.notice;
|
|
234
242
|
}
|
|
@@ -277,6 +285,7 @@ export function createResolveSpec(ctx) {
|
|
|
277
285
|
sessionId: auth?.sessionId ?? "",
|
|
278
286
|
cwd: (auth?.sessionId ? perSessionCwd.get(auth.sessionId) : undefined) ?? process.cwd(),
|
|
279
287
|
...(parsedSettings.settings?.shellEnv ? { shellEnv: parsedSettings.settings.shellEnv } : {}),
|
|
288
|
+
httpHookAllowlistLayers: parsedSettings.settings?.httpHookAllowlist !== undefined ? [parsedSettings.settings.httpHookAllowlist] : [],
|
|
280
289
|
hookLlm,
|
|
281
290
|
hookAgent,
|
|
282
291
|
onHookNotice: (n) => fleetBus.publishHookNotice({
|
|
@@ -671,8 +680,8 @@ export function createResolveSpec(ctx) {
|
|
|
671
680
|
return governed;
|
|
672
681
|
};
|
|
673
682
|
const resolveSpecForLeg = async (body, req, auth, opts) => {
|
|
674
|
-
const spec = await resolveSpec(body, req, auth, opts);
|
|
675
|
-
return unrooted(opts.unattendedLeg !== true ? spec : withUnattendedLeg(spec));
|
|
683
|
+
const { spec, facts } = await resolveSpec(body, req, auth, opts);
|
|
684
|
+
return mintLegFacts(unrooted(opts.unattendedLeg !== true ? spec : withUnattendedLeg(spec)), facts);
|
|
676
685
|
};
|
|
677
686
|
return resolveSpecForLeg;
|
|
678
687
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { recordFailOpen } from "../observability/fail-open.js";
|
|
2
|
+
import { seatText } from "../trace/exit-seat.js";
|
|
2
3
|
export const RETENTION_SWEEP_STUCK_THRESHOLD = 5;
|
|
3
4
|
export const RETENTION_LEASE_TTL_FACTOR = 2;
|
|
4
5
|
const DAY_MS = 86_400_000;
|
|
@@ -137,15 +138,16 @@ async function recordDomainFailure(ctx, d) {
|
|
|
137
138
|
}
|
|
138
139
|
const streaks = ctx.streaks;
|
|
139
140
|
const streak = (streaks?.get(d.domain) ?? 0) + 1;
|
|
141
|
+
const shown = seatText("operator-log-text", message);
|
|
140
142
|
streaks?.set(d.domain, streak);
|
|
141
143
|
try {
|
|
142
|
-
ctx.logger.warn("retention_sweep_domain_failed", { domain: d.domain, fencingToken: d.fencingToken, consecutiveFailures: streak, auditRowWritten, err:
|
|
144
|
+
ctx.logger.warn("retention_sweep_domain_failed", { domain: d.domain, fencingToken: d.fencingToken, consecutiveFailures: streak, auditRowWritten, err: shown });
|
|
143
145
|
if (streak >= RETENTION_SWEEP_STUCK_THRESHOLD) {
|
|
144
146
|
ctx.metrics.inc("retention_sweep_stuck", {}, 1);
|
|
145
147
|
ctx.logger.warn("retention_sweep_stuck", {
|
|
146
148
|
domain: d.domain,
|
|
147
149
|
consecutiveFailures: streak,
|
|
148
|
-
lastError:
|
|
150
|
+
lastError: shown,
|
|
149
151
|
note: "this retention domain has failed its sweep for RETENTION_SWEEP_STUCK_THRESHOLD consecutive rounds — its data is NOT being retained per policy. Check retention_audit rows with action='failed' for this domain.",
|
|
150
152
|
});
|
|
151
153
|
streaks?.set(d.domain, 0);
|
|
@@ -168,7 +170,7 @@ export function startRetentionLane(ctx) {
|
|
|
168
170
|
.then(() => undefined)
|
|
169
171
|
.catch((err) => {
|
|
170
172
|
try {
|
|
171
|
-
ctx.logger.warn("retention_sweep_round_failed", { err: err instanceof Error ? err.message : String(err) });
|
|
173
|
+
ctx.logger.warn("retention_sweep_round_failed", { err: seatText("operator-log-text", err instanceof Error ? err.message : String(err)) });
|
|
172
174
|
}
|
|
173
175
|
catch {
|
|
174
176
|
recordFailOpen("server.retention.sweep-report-dropped", "round");
|