@sema-agent/server 7.134.0 → 7.135.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 +134 -0
- package/USAGE.md +98 -30
- package/dist/adoption/plan.d.ts +1 -1
- package/dist/approval-ask-audit-store.d.ts +24 -24
- package/dist/approval-ask-machine.d.ts +2 -2
- package/dist/approval-card.d.ts +62 -150
- package/dist/approval-card.js +33 -51
- package/dist/approval-content-kind.d.ts +22 -5
- package/dist/approval-content-kind.js +8 -1
- package/dist/approval-deny-reasons.d.ts +1 -1
- package/dist/approval-gate-currency.d.ts +22 -3
- package/dist/approval-gate-currency.js +44 -18
- package/dist/approval-hmac.d.ts +7 -7
- package/dist/approval-policy-settlement.d.ts +2 -2
- package/dist/approval-reconciler.d.ts +3 -3
- package/dist/approval.d.ts +8 -8
- package/dist/approval.js +4 -2
- package/dist/auth-bridge.d.ts +1 -1
- package/dist/auto-mode-face.d.ts +4 -4
- package/dist/background-session-reap.d.ts +2 -2
- package/dist/bake-runner/main.d.ts +2 -2
- package/dist/bake-runner/runner.d.ts +4 -4
- package/dist/bench/s1/live-deps.d.ts +1 -1
- package/dist/bench/s1/run-firm.d.ts +1 -1
- package/dist/boot/coordinators.d.ts +2 -2
- package/dist/boot/coordinators.js +2 -2
- package/dist/boot/deferred-sandbox-path-env.d.ts +0 -6
- package/dist/boot/deferred-sandbox-path-env.js +0 -5
- package/dist/boot/engine-lease.d.ts +5 -5
- package/dist/boot/execution-env.d.ts +16 -15
- package/dist/boot/execution-env.js +19 -21
- package/dist/boot/fatal-exit.d.ts +2 -2
- package/dist/boot/late-binds.d.ts +1 -1
- package/dist/boot/leader.d.ts +1 -1
- package/dist/boot/memory-boundary.d.ts +2 -2
- package/dist/boot/memory-consolidation.d.ts +15 -15
- package/dist/boot/parked-revive-gate.d.ts +3 -3
- package/dist/boot/parked-revive-gate.js +3 -2
- package/dist/boot/reapers.d.ts +4 -4
- package/dist/boot/resolve-spec.d.ts +1 -1
- package/dist/boot/resolve-spec.js +28 -24
- package/dist/boot/runner-deps.d.ts +11 -11
- package/dist/boot/runner-deps.js +3 -2
- package/dist/boot/session-faces.d.ts +3 -3
- package/dist/boot/session-faces.js +11 -30
- package/dist/boot/shutdown.d.ts +5 -5
- package/dist/boot/side-query-lane.d.ts +2 -2
- package/dist/boot/stage-05-execution-env.js +4 -4
- package/dist/boot/stage-06-runners.js +0 -2
- package/dist/boot/stores.js +2 -1
- package/dist/boot/web-admin.d.ts +17 -17
- package/dist/boot/web-admin.js +5 -10
- package/dist/boot/workflow-orchestration.js +2 -9
- package/dist/brain.d.ts +11 -11
- package/dist/budget.d.ts +4 -4
- package/dist/capabilities/approvals-push.d.ts +4 -4
- package/dist/capabilities/builtin-tools.d.ts +5 -5
- package/dist/capabilities/center-plugins.d.ts +5 -5
- package/dist/capabilities/center-plugins.js +1 -1
- package/dist/capabilities/center-prompts.d.ts +1 -1
- package/dist/capabilities/center-wiring.d.ts +1 -1
- package/dist/capabilities/composite-members.d.ts +1 -1
- package/dist/capabilities/execution-lane.d.ts +5 -5
- package/dist/capabilities/execution-lane.js +2 -2
- package/dist/capabilities/hands-lane.d.ts +5 -5
- package/dist/capabilities/mcp-probe.d.ts +10 -7
- package/dist/capabilities/sandbox-file-send.d.ts +1 -18
- package/dist/capabilities/sandbox-file-send.js +0 -7
- package/dist/capabilities/scenarios.d.ts +28 -10
- package/dist/capabilities/scenarios.js +15 -5
- package/dist/capabilities/send-user-file-tool.d.ts +1 -1
- package/dist/capabilities/skills.d.ts +31 -12
- package/dist/capabilities/skills.js +23 -17
- package/dist/capabilities/tool-defer.d.ts +1 -1
- package/dist/capability-facts.d.ts +26 -25
- package/dist/capability-facts.js +14 -16
- package/dist/center-config-tier.d.ts +1 -1
- package/dist/center-credential.d.ts +4 -4
- package/dist/checkpoint-identity.d.ts +5 -0
- package/dist/checkpoint-identity.js +14 -0
- package/dist/config-catalog.d.ts +12 -12
- package/dist/config-invariants.d.ts +4 -4
- package/dist/config-invariants.js +3 -2
- package/dist/config-lkg.d.ts +1 -1
- package/dist/config-provider.d.ts +13 -13
- package/dist/config-provider.js +2 -1
- package/dist/config-types.d.ts +83 -83
- package/dist/config.d.ts +26 -24
- package/dist/config.js +12 -10
- package/dist/cross-session-settings.d.ts +1 -1
- package/dist/delegated-session-owner.d.ts +16 -13
- package/dist/delegated-session-owner.js +9 -10
- package/dist/deployment-governance.d.ts +16 -16
- package/dist/deployment-shape.d.ts +127 -0
- package/dist/deployment-shape.js +72 -0
- package/dist/device-store.d.ts +1 -1
- package/dist/device-ws-hub.d.ts +1 -1
- package/dist/egress-redirect.d.ts +1 -1
- package/dist/entry-mode-clamp-notice.d.ts +2 -2
- package/dist/env-facts.d.ts +10 -9
- package/dist/env-facts.js +1 -1
- package/dist/env-name-allowlist-knobs.d.ts +5 -5
- package/dist/exec-bounds.d.ts +2 -2
- package/dist/execution-lane-caps.d.ts +31 -43
- package/dist/execution-lane-caps.js +0 -13
- package/dist/file-history-capture.d.ts +9 -9
- package/dist/file-history-disclosure.d.ts +23 -11
- package/dist/file-history-disclosure.js +7 -12
- package/dist/fleet/drain-entry.d.ts +2 -2
- package/dist/fleet/fleet-bus.d.ts +22 -14
- package/dist/fleet/fleet-bus.js +5 -5
- package/dist/fleet/fleet-reconciler.d.ts +9 -9
- package/dist/fleet/subagent-tail-bus.d.ts +4 -4
- package/dist/fleet-client.d.ts +13 -13
- package/dist/fleet-lease.d.ts +16 -16
- package/dist/governance-http-status.d.ts +2 -2
- package/dist/hooks/hook-llm.d.ts +7 -7
- package/dist/hooks/hook-runner.d.ts +57 -30
- package/dist/hooks/hook-runner.js +36 -18
- package/dist/host-decision.d.ts +5 -5
- package/dist/host-lsp-manager.d.ts +5 -5
- package/dist/hosted-posture.d.ts +23 -13
- package/dist/hosted-posture.js +4 -9
- package/dist/http/admission.d.ts +2 -2
- package/dist/http/admission.js +20 -5
- package/dist/http/approval-sweeps.d.ts +1 -1
- package/dist/http/approval-sweeps.js +2 -1
- package/dist/http/checkpoint-ctx.d.ts +39 -13
- package/dist/http/checkpoint-ctx.js +74 -35
- package/dist/http/dispatch.d.ts +3 -3
- package/dist/http/durable-run-leg.js +4 -3
- package/dist/http/idempotency.d.ts +2 -2
- package/dist/http/mcp-dial-deadline.d.ts +7 -5
- package/dist/http/memory-compliance-failure-reply.d.ts +4 -4
- package/dist/http/owner-access.d.ts +4 -6
- package/dist/http/owner-access.js +1 -1
- package/dist/http/principal-gate.d.ts +7 -7
- package/dist/http/principal-gate.js +3 -2
- package/dist/http/readiness.d.ts +1 -1
- package/dist/http/request-guards.d.ts +4 -4
- package/dist/http/request-guards.js +2 -1
- package/dist/http/resume-ctx-read.d.ts +7 -7
- package/dist/http/resume-ctx-read.js +1 -1
- package/dist/http/resume-legs.d.ts +3 -3
- package/dist/http/resume-legs.js +11 -8
- package/dist/http/route-ctx.d.ts +29 -29
- package/dist/http/route-table.d.ts +9 -9
- package/dist/http/routes/agents-roster.d.ts +1 -1
- package/dist/http/routes/approvals-assistant.d.ts +5 -5
- package/dist/http/routes/approvals-assistant.js +55 -15
- package/dist/http/routes/background.d.ts +3 -3
- package/dist/http/routes/background.js +2 -2
- package/dist/http/routes/capabilities.d.ts +1 -1
- package/dist/http/routes/capabilities.js +16 -8
- package/dist/http/routes/config-catalog.d.ts +1 -1
- package/dist/http/routes/devices.d.ts +1 -1
- package/dist/http/routes/diagnostics.d.ts +3 -3
- package/dist/http/routes/fleet.d.ts +1 -1
- package/dist/http/routes/fleet.js +2 -1
- package/dist/http/routes/mcp-reconnect.d.ts +4 -4
- package/dist/http/routes/mcp-reconnect.js +3 -3
- package/dist/http/routes/memory-consolidation.d.ts +1 -1
- package/dist/http/routes/notify-wake.d.ts +1 -1
- package/dist/http/routes/notify-wake.js +2 -2
- package/dist/http/routes/rules.d.ts +1 -1
- package/dist/http/routes/runs.js +22 -10
- package/dist/http/routes/session-sync.d.ts +1 -1
- package/dist/http/routes/session-sync.js +73 -44
- package/dist/http/routes/sessions-list.js +1 -1
- package/dist/http/routes/sessions.js +30 -44
- package/dist/http/routes/tasks.d.ts +1 -1
- package/dist/http/routes/trace-usage.d.ts +1 -1
- package/dist/http/routes/workflows.d.ts +3 -0
- package/dist/http/routes/workflows.js +31 -28
- package/dist/http/send.d.ts +5 -5
- package/dist/http/server.d.ts +34 -34
- package/dist/http/session-inherit-env.d.ts +3 -3
- package/dist/http/sse-lifecycle.d.ts +1 -1
- package/dist/http/sse-log.d.ts +2 -2
- package/dist/http/submit-ctx.js +1 -1
- package/dist/http/sync-submit-body.d.ts +1 -1
- package/dist/http/verify-rounds.d.ts +1 -1
- package/dist/http/wire-types.d.ts +28 -21
- package/dist/instruction-source-notice.d.ts +2 -2
- package/dist/key-resolver.d.ts +3 -3
- package/dist/lane-home-probe.d.ts +1 -1
- package/dist/leader/diffout.d.ts +1 -1
- package/dist/leader/diffup.d.ts +2 -2
- package/dist/leader/endpoint.d.ts +1 -1
- package/dist/leader/fanout.d.ts +1 -1
- package/dist/leader/leader.d.ts +4 -4
- package/dist/leader/merge.d.ts +3 -3
- package/dist/leader/repair-wire.d.ts +1 -1
- package/dist/leader/wire.d.ts +6 -6
- package/dist/list-entry-display.d.ts +1 -1
- package/dist/lsp-evict.d.ts +1 -1
- package/dist/mcp-assertion-header.d.ts +1 -1
- package/dist/memory-layer-legacy-lock.d.ts +1 -1
- package/dist/memory-operator-faces.d.ts +1 -1
- package/dist/memory-posture.js +4 -2
- package/dist/memory-project-layer.d.ts +1 -1
- package/dist/memory-scope.d.ts +19 -19
- package/dist/memory-store-refusal.d.ts +4 -4
- package/dist/model-entry-headers.d.ts +2 -2
- package/dist/model-entry-refusal.d.ts +17 -17
- package/dist/model-provider.d.ts +10 -10
- package/dist/model-reach-scope.d.ts +1 -1
- package/dist/model-route-endpoint.d.ts +6 -6
- package/dist/model-route-url.d.ts +5 -5
- package/dist/model-select.d.ts +15 -6
- package/dist/model-select.js +5 -0
- package/dist/model-unreachable-notice.d.ts +3 -3
- package/dist/namespaced-rule-name.d.ts +15 -5
- package/dist/namespaced-rule-name.js +3 -2
- package/dist/observability/corrupt-read-seat.d.ts +9 -9
- package/dist/observability/cost-taxonomy.d.ts +1 -1
- package/dist/observability/err-text.d.ts +1 -1
- package/dist/observability/fail-open.d.ts +12 -8
- package/dist/observability/fail-open.js +12 -8
- package/dist/observability/metrics.d.ts +3 -3
- package/dist/observability/run-terminal.d.ts +36 -36
- package/dist/observability/secret-env-scrub.d.ts +3 -3
- package/dist/observability/tool-trace.d.ts +1 -1
- package/dist/operator-ask.d.ts +4 -4
- package/dist/orchestration/workflow-agent-session-index.d.ts +3 -3
- package/dist/orchestration/workflow-completion-inbox.d.ts +20 -5
- package/dist/orchestration/workflow-completion-inbox.js +29 -7
- package/dist/orchestration/workflow-notify-journal.d.ts +43 -19
- package/dist/orchestration/workflow-notify-journal.js +17 -0
- package/dist/outbound-dispatcher.d.ts +4 -4
- package/dist/parent-watch.d.ts +4 -4
- package/dist/parked-decide.d.ts +16 -15
- package/dist/parked-decide.js +5 -4
- package/dist/parked-revive-surface.d.ts +7 -7
- package/dist/parked-revive-surface.js +2 -3
- package/dist/peer-directory.d.ts +3 -3
- package/dist/peer-directory.js +1 -1
- package/dist/permission-rule-list.d.ts +10 -1
- package/dist/permission-rule-list.js +7 -5
- package/dist/permission-rule-vocab.d.ts +2 -2
- package/dist/plugins/adoption-log-sql.d.ts +1 -1
- package/dist/plugins/approval-ask-store-file.d.ts +8 -1
- package/dist/plugins/approval-ask-store-file.js +6 -3
- package/dist/plugins/approval-ask-store-memory.d.ts +11 -7
- package/dist/plugins/approval-ask-store-memory.js +11 -7
- package/dist/plugins/approval-ask-store-sql.d.ts +34 -15
- package/dist/plugins/approval-ask-store-sql.js +18 -5
- package/dist/plugins/approval-exemption-store.d.ts +3 -3
- package/dist/plugins/approval-nonce-store.d.ts +3 -3
- package/dist/plugins/background-agent-store-sql.d.ts +1 -1
- package/dist/plugins/background-shell-support.d.ts +2 -2
- package/dist/plugins/blob-backend.d.ts +1 -1
- package/dist/plugins/caching-session-store.d.ts +23 -32
- package/dist/plugins/caching-session-store.js +5 -17
- package/dist/plugins/checkpoint-index-columns.d.ts +81 -0
- package/dist/plugins/checkpoint-index-columns.js +62 -0
- package/dist/plugins/checkpoint-store-sql.d.ts +44 -66
- package/dist/plugins/checkpoint-store-sql.js +55 -102
- package/dist/plugins/device-store-sql.d.ts +7 -6
- package/dist/plugins/e2b-orphan-reclaim.d.ts +1 -1
- package/dist/plugins/ensure-schema-lock-policy.d.ts +1 -1
- package/dist/plugins/file-history-store-sql.d.ts +9 -7
- package/dist/plugins/file-history-store-sql.js +27 -15
- package/dist/plugins/file-run-store.d.ts +8 -8
- package/dist/plugins/fork-routing-session-store.d.ts +2 -2
- package/dist/plugins/fork-routing-session-store.js +1 -1
- package/dist/plugins/host-platform.d.ts +10 -10
- package/dist/plugins/image-bake-store-sql.d.ts +1 -1
- package/dist/plugins/image-index-sql.d.ts +1 -1
- package/dist/plugins/leader-run-store-sql.d.ts +1 -1
- package/dist/plugins/local-checkpoint-store.d.ts +10 -10
- package/dist/plugins/local-checkpoint-store.js +3 -4
- package/dist/plugins/local-session-store.d.ts +34 -38
- package/dist/plugins/local-session-store.js +20 -39
- package/dist/plugins/local-session-window.d.ts +1 -1
- package/dist/plugins/mailbox-store-sql.d.ts +2 -2
- package/dist/plugins/memory-engine-pg.d.ts +1 -1
- package/dist/plugins/memory-run-store.d.ts +4 -4
- package/dist/plugins/memory-sync-store-pg.d.ts +3 -3
- package/dist/plugins/one-time-migrations.d.ts +66 -40
- package/dist/plugins/one-time-migrations.js +115 -34
- package/dist/plugins/outcome-ledger-sql.d.ts +1 -1
- package/dist/plugins/park-commit-watch.d.ts +3 -3
- package/dist/plugins/permission-rule-store-file.d.ts +5 -5
- package/dist/plugins/permission-rule-store-file.js +12 -19
- package/dist/plugins/permission-rule-store-sql.d.ts +38 -4
- package/dist/plugins/permission-rule-store-sql.js +67 -24
- package/dist/plugins/pg-cost-quota.d.ts +1 -1
- package/dist/plugins/pg-pool.d.ts +2 -2
- package/dist/plugins/pg-pool.js +5 -2
- package/dist/plugins/pg-rate-limiter.d.ts +1 -1
- package/dist/plugins/pg-session-storage.d.ts +8 -20
- package/dist/plugins/pg-session-storage.js +14 -27
- package/dist/plugins/remote-env-adb.d.ts +10 -10
- package/dist/plugins/remote-env-device.d.ts +10 -9
- package/dist/plugins/remote-env-device.js +6 -2
- package/dist/plugins/remote-env-e2b.d.ts +3 -3
- package/dist/plugins/remote-env-host.d.ts +16 -16
- package/dist/plugins/remote-env-k8s.d.ts +8 -8
- package/dist/plugins/remote-env-local-docker.d.ts +2 -2
- package/dist/plugins/remote-env-ssh.d.ts +4 -4
- package/dist/plugins/remote-scratchpad.d.ts +2 -3
- package/dist/plugins/remote-scratchpad.js +0 -4
- package/dist/plugins/remote-shell.d.ts +6 -6
- package/dist/plugins/retention-lane-store-sql.d.ts +4 -4
- package/dist/plugins/retention-store-sql.d.ts +4 -4
- package/dist/plugins/roster-store-sql.d.ts +1 -1
- package/dist/plugins/run-store-sql.d.ts +8 -8
- package/dist/plugins/schema-consistency.d.ts +2 -2
- package/dist/plugins/schema-ensure-legs.d.ts +3 -3
- package/dist/plugins/schema-indexes.d.ts +1 -1
- package/dist/plugins/schema-live-columns.d.ts +1 -1
- package/dist/plugins/session-event-payload.d.ts +4 -4
- package/dist/plugins/session-fork.d.ts +34 -0
- package/dist/plugins/session-fork.js +29 -0
- package/dist/plugins/session-ownership.js +1 -1
- package/dist/plugins/session-placement.d.ts +1 -1
- package/dist/plugins/session-policy-store-sql.d.ts +12 -12
- package/dist/plugins/session-store.d.ts +2 -2
- package/dist/plugins/session-store.js +2 -2
- package/dist/plugins/shared-memory-store-sql.d.ts +2 -2
- package/dist/plugins/sql-driver.d.ts +8 -8
- package/dist/plugins/sql-errors.d.ts +1 -1
- package/dist/plugins/sql-json-column.d.ts +21 -21
- package/dist/plugins/sql-row-helpers.d.ts +2 -2
- package/dist/plugins/store-backend.d.ts +17 -16
- package/dist/plugins/store-backend.js +3 -3
- package/dist/plugins/store-contracts.d.ts +21 -21
- package/dist/plugins/task-attachment-store.d.ts +2 -2
- package/dist/plugins/task-list-store-sql.d.ts +1 -1
- package/dist/plugins/tidb-pool.d.ts +2 -2
- package/dist/plugins/tidb-pool.js +9 -2
- package/dist/plugins/tidb-session-store.d.ts +16 -26
- package/dist/plugins/tidb-session-store.js +15 -27
- package/dist/plugins/tool-result-store-sql.d.ts +1 -1
- package/dist/plugins/usage-window-store-sql.d.ts +3 -3
- package/dist/plugins/user-input-ledger-file.d.ts +1 -1
- package/dist/plugins/user-input-ledger-sql.d.ts +3 -3
- package/dist/plugins/web-search.d.ts +19 -5
- package/dist/plugins/web-search.js +19 -4
- package/dist/{orchestration/workflow-journal-entry.d.ts → plugins/workflow-journal-payload.d.ts} +23 -32
- package/dist/plugins/workflow-journal-payload.js +32 -0
- package/dist/plugins/workflow-journal-store-sql.d.ts +28 -14
- package/dist/plugins/workflow-journal-store-sql.js +34 -15
- package/dist/plugins/workflow-run-store-sql.d.ts +4 -4
- package/dist/posture-source.d.ts +11 -11
- package/dist/principal-jwt.d.ts +6 -6
- package/dist/project-identity.d.ts +3 -3
- package/dist/project-memory.d.ts +4 -4
- package/dist/read-face-posture.d.ts +7 -7
- package/dist/request-key-closure.d.ts +1 -1
- package/dist/request-key-closure.js +1 -1
- package/dist/request-value-closure.d.ts +15 -8
- package/dist/request-value-closure.js +2 -0
- package/dist/router/route-orchestration.d.ts +11 -16
- package/dist/router/route-orchestration.js +2 -12
- package/dist/rule-entry-list.d.ts +8 -7
- package/dist/rule-entry-list.js +2 -9
- package/dist/rules-consent.d.ts +6 -6
- package/dist/rules-consent.js +2 -0
- package/dist/run-cancel-context.d.ts +5 -5
- package/dist/run-local.d.ts +10 -10
- package/dist/runs.d.ts +13 -11
- package/dist/runs.js +15 -1
- package/dist/runtime-caps-resolver.d.ts +6 -6
- package/dist/runtime-governance.d.ts +9 -9
- package/dist/sandbox-pkg-source.d.ts +9 -31
- package/dist/sandbox-pkg-source.js +14 -8
- package/dist/sealed-key.d.ts +3 -3
- package/dist/security.d.ts +23 -26
- package/dist/security.js +12 -9
- package/dist/server-secret-env.d.ts +10 -10
- package/dist/session-children-retire.d.ts +1 -1
- package/dist/session-error-wire.d.ts +7 -7
- package/dist/session-incarnation.d.ts +52 -35
- package/dist/session-incarnation.js +23 -8
- package/dist/session-policy-wire.d.ts +27 -5
- package/dist/session-policy-wire.js +15 -1
- package/dist/session-records-skipped-notice.d.ts +1 -1
- package/dist/session-sync-kernel.d.ts +4 -4
- package/dist/session-sync.d.ts +49 -6
- package/dist/session-sync.js +52 -10
- package/dist/session-titler.d.ts +7 -6
- package/dist/session-titler.js +8 -13
- package/dist/session-watch.d.ts +3 -3
- package/dist/session-watch.js +4 -4
- package/dist/sighup-idle.d.ts +2 -2
- package/dist/spec-fields.d.ts +4 -4
- package/dist/sql-engine-posture.d.ts +3 -3
- package/dist/store-posture.d.ts +2 -2
- package/dist/stored-request-tool-axes-m19.d.ts +1 -1
- package/dist/task-a2a.d.ts +3 -1
- package/dist/task-a2a.js +34 -2
- package/dist/task-cwd.d.ts +7 -88
- package/dist/task-cwd.js +2 -15
- package/dist/task-mcp.d.ts +12 -8
- package/dist/task-mcp.js +19 -4
- package/dist/task-settings.d.ts +30 -18
- package/dist/task-settings.js +33 -3
- package/dist/task-workflow.d.ts +0 -24
- package/dist/task-workflow.js +2 -1
- package/dist/terminal.d.ts +5 -5
- package/dist/tighten-only-seats.d.ts +7 -6
- package/dist/tighten-only-seats.js +1 -1
- package/dist/tool-approval.d.ts +143 -197
- package/dist/tool-approval.js +13 -28
- package/dist/tool-rule-names.d.ts +2 -2
- package/dist/trace/core-keyset-guard.d.ts +12 -7
- package/dist/trace/engine-notice-wire.d.ts +5 -5
- package/dist/trace/engine-notice-wire.js +1 -0
- package/dist/trace/exit-seat.d.ts +31 -4
- package/dist/trace/exit-seat.js +41 -63
- package/dist/trace/ledger-events.d.ts +3 -3
- package/dist/trace/ledger-sink.d.ts +1 -1
- package/dist/trace/model-segment.d.ts +3 -3
- package/dist/trace/project.d.ts +47 -45
- package/dist/trace/project.js +33 -1
- package/dist/trace/redact.d.ts +44 -30
- package/dist/trace/redact.js +191 -89
- package/dist/trace/self-minted-wire.d.ts +35 -14
- package/dist/trace/self-minted-wire.js +8 -0
- package/dist/trace/sema-provenance.d.ts +1 -1
- package/dist/trace/task-notification-facets.d.ts +4 -4
- package/dist/trace/wire-projection-faces.d.ts +3 -3
- package/dist/trace/wire-projection-faces.js +1 -1
- package/dist/unattended-permission-mode.d.ts +5 -5
- package/dist/url-credential.d.ts +52 -0
- package/dist/url-credential.js +49 -0
- package/dist/url-refusal.d.ts +6 -2
- package/dist/url-refusal.js +8 -1
- package/dist/usage-analytics.d.ts +2 -2
- package/dist/user-input-ledger.d.ts +23 -23
- package/dist/web-admin-client/apply-effective.d.ts +5 -5
- package/dist/web-admin-client/apply-effective.js +2 -1
- package/dist/web-admin-client/apply-ledger.d.ts +2 -2
- package/dist/web-admin-client/center-request.d.ts +2 -2
- package/dist/web-admin-client/facade.d.ts +5 -5
- package/dist/web-admin-client/facade.js +1 -1
- package/dist/web-admin-client/hot-keys-registry.d.ts +2 -2
- package/dist/web-admin-client/http-client.d.ts +4 -4
- package/dist/web-admin-client/mcp-revocation.d.ts +1 -1
- package/dist/web-admin-client/pull-state.d.ts +1 -1
- package/dist/web-admin-client/read-face.d.ts +2 -2
- package/dist/web-admin-client/read-warnings.d.ts +5 -5
- package/dist/web-admin-client/restart-signal.d.ts +6 -6
- package/dist/web-admin-client/skills-mcp.d.ts +28 -3
- package/dist/web-admin-client/skills-mcp.js +29 -1
- package/dist/web-admin-client/types.d.ts +16 -9
- package/dist/workspace-space.d.ts +5 -3
- package/dist/write-protection.d.ts +2 -2
- package/package.json +4 -3
- package/scripts/drain-check-local.mjs +2 -1
- package/scripts/drain-check.mysql.sql +4 -2
- package/scripts/drain-check.pg.sql +4 -2
- package/skills/loop.md +1 -1
- package/dist/http/run-declared-families.d.ts +0 -16
- package/dist/http/run-declared-families.js +0 -12
- package/dist/orchestration/workflow-journal-entry.js +0 -27
|
@@ -11,11 +11,13 @@ import { MAX_HOOK_NOTICE_TEXT_CHARS, boundedNoticeText } from "../fleet/fleet-bu
|
|
|
11
11
|
import { recordFailOpen } from "../observability/fail-open.js";
|
|
12
12
|
import { LIMIT_REASONS } from "../limit-refusal.js";
|
|
13
13
|
import { clipDataText, echoCallerText } from "../caller-text-echo.js";
|
|
14
|
+
import { seatText } from "../trace/exit-seat.js";
|
|
14
15
|
import { redactSecrets, buildDisplaySafeUrl } from "../trace/redact.js";
|
|
15
16
|
import { canonicalJsonStringify } from "@sema-agent/core";
|
|
16
17
|
import { ccPromptSystemFor, wrapCondition, parseCcVerdict, CC_EVALUATOR_MAX_OUTPUT_TOKENS } from "./cc-stop-prompt.js";
|
|
17
18
|
import { ccAgentHookSystemFor } from "./cc-agent-hook-prompt.js";
|
|
18
19
|
import { renderBranchTranscript } from "./branch-transcript.js";
|
|
20
|
+
import { buildRequestUrlCredentialRefusal, findUrlCredential, urlCredentialHeaderExit } from "../url-credential.js";
|
|
19
21
|
import { HOOK_PHASES, HOOK_SOURCE_VOCABULARY_SENTENCE, hookPhaseOf, readHookGroupSource } from "./hook-source.js";
|
|
20
22
|
import { commandLineChars, composeHookEnvLayer, hookPluginChars, planCommandSpawn, readHookArgs, readHookPlugin } from "./command-spawn.js";
|
|
21
23
|
export const MAX_HOOK_ENTRIES_PER_EVENT = 32;
|
|
@@ -102,9 +104,7 @@ export const MAX_MATCHER_EVAL_CHARS = MAX_HOOK_COMMAND_CHARS;
|
|
|
102
104
|
export const ADMISSION_MATCHER_BUDGET = { budgetMs: 1_000, totalMs: 5_000 };
|
|
103
105
|
export const MATCHER_ECHO_CHARS = 200;
|
|
104
106
|
export const IF_ECHO_CHARS = 200;
|
|
105
|
-
const
|
|
106
|
-
const LOG_ERROR_ECHO_CHARS = 300;
|
|
107
|
-
const LOG_MESSAGE_ECHO_CHARS = 500;
|
|
107
|
+
const BLANKED_HEADER_ECHO_CHARS = 200;
|
|
108
108
|
const MATCHER_UNJUDGED_TAG = "server.hooks.matcher-unjudged";
|
|
109
109
|
function matcherReadsWireToolName(event) {
|
|
110
110
|
return HOOK_EVENT_OWNER[event] === "engine" && HOOK_EVENT_MATCHER_FIELD[event] === "tool_name";
|
|
@@ -331,6 +331,24 @@ export function hooksMatcherIssue(config, depth, budget = {}) {
|
|
|
331
331
|
}
|
|
332
332
|
return undefined;
|
|
333
333
|
}
|
|
334
|
+
export function hooksUrlCredentialIssue(config) {
|
|
335
|
+
for (const [event, groups] of Object.entries(config)) {
|
|
336
|
+
for (const [groupIndex, group] of (groups ?? []).entries()) {
|
|
337
|
+
for (const [entryIndex, entry] of group.hooks.entries()) {
|
|
338
|
+
if (entry.type !== "http")
|
|
339
|
+
continue;
|
|
340
|
+
const credential = findUrlCredential(entry.url);
|
|
341
|
+
if (credential !== undefined)
|
|
342
|
+
return { event, groupIndex, entryIndex, credential };
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
return undefined;
|
|
347
|
+
}
|
|
348
|
+
export function buildHooksUrlCredentialRefusal(issue) {
|
|
349
|
+
const entry = `settings.hooks.${issue.event}[${issue.groupIndex}].hooks[${issue.entryIndex}]`;
|
|
350
|
+
return buildRequestUrlCredentialRefusal(`${entry}.url`, issue.credential, urlCredentialHeaderExit(`${entry}.headers`));
|
|
351
|
+
}
|
|
334
352
|
const HOOKS_PIECE_MEANING = {
|
|
335
353
|
"hooks-not-object": "`hooks` must be an object keyed by hook event name",
|
|
336
354
|
"unknown-event": "not a hook event name",
|
|
@@ -504,10 +522,10 @@ const MAX_LLM_ENTRIES_PER_EVENT = 4;
|
|
|
504
522
|
const DEFAULT_PROMPT_HOOK_TIMEOUT_SECONDS = 30;
|
|
505
523
|
const DEFAULT_AGENT_HOOK_TIMEOUT_SECONDS = 120;
|
|
506
524
|
function logHookCommandFailed(ctx, event, run) {
|
|
507
|
-
ctx.logger.warn("hook_command_failed", { event, code: run.code, stderr:
|
|
525
|
+
ctx.logger.warn("hook_command_failed", { event, code: run.code, stderr: seatText("operator-log-error", run.stderr) });
|
|
508
526
|
}
|
|
509
527
|
function logHookSystemMessage(ctx, event, message) {
|
|
510
|
-
ctx.logger.info("hook_system_message", { event, message:
|
|
528
|
+
ctx.logger.info("hook_system_message", { event, message: seatText("operator-log-message", message) });
|
|
511
529
|
}
|
|
512
530
|
function hookDisplayName(entry) {
|
|
513
531
|
if (typeof entry.statusMessage === "string" && entry.statusMessage.length > 0)
|
|
@@ -536,7 +554,7 @@ function emitHookNotice(ctx, n) {
|
|
|
536
554
|
}
|
|
537
555
|
catch (e) {
|
|
538
556
|
recordFailOpen("server.hooks.notice-sink-threw", `kind=${n.kind} event=${n.event}`);
|
|
539
|
-
ctx.logger.warn("hook_notice_sink_threw", { kind: n.kind, event: n.event, error:
|
|
557
|
+
ctx.logger.warn("hook_notice_sink_threw", { kind: n.kind, event: n.event, error: seatText("operator-log-text", String(e)) });
|
|
540
558
|
}
|
|
541
559
|
}
|
|
542
560
|
function noteHookFailure(ctx, args) {
|
|
@@ -557,7 +575,7 @@ function noteHookFailure(ctx, args) {
|
|
|
557
575
|
}
|
|
558
576
|
function noteMatcherOverBudget(ctx, args) {
|
|
559
577
|
const budgetMs = ADMISSION_MATCHER_BUDGET.budgetMs;
|
|
560
|
-
const shown = (text) =>
|
|
578
|
+
const shown = (text) => seatText("operator-log-text", text);
|
|
561
579
|
const expression = shown(args.expression);
|
|
562
580
|
const value = shown(args.value);
|
|
563
581
|
ctx.logger.warn("hook_matcher_over_budget", { event: args.event, scope: args.scope, expression, value, budgetMs, selected: true });
|
|
@@ -879,7 +897,7 @@ async function fireAsyncCommandHook(entry, payload, ctx, event, halt) {
|
|
|
879
897
|
}
|
|
880
898
|
child.on("error", (e) => {
|
|
881
899
|
clearTimeout(timer);
|
|
882
|
-
ctx.logger.warn("hook_async_failed", { event, reason: "spawn_failed", error:
|
|
900
|
+
ctx.logger.warn("hook_async_failed", { event, reason: "spawn_failed", error: seatText("operator-log-error", String(e)) });
|
|
883
901
|
noteHookFailure(ctx, { event, entry, reason: "spawn_failed", stderr: String(e), toolName: toolNameOf(payload) });
|
|
884
902
|
});
|
|
885
903
|
child.on("close", (code) => {
|
|
@@ -902,14 +920,14 @@ async function fireAsyncCommandHook(entry, payload, ctx, event, halt) {
|
|
|
902
920
|
ctx.logger.info("hook_async_rewake_delivered", { event, chars: text.length });
|
|
903
921
|
else
|
|
904
922
|
ctx.logger.warn("hook_async_rewake_dropped", { event, reason: "no_live_stream" });
|
|
905
|
-
}, (e) => ctx.logger.warn("hook_async_rewake_dropped", { event, reason: "wake_failed", error:
|
|
923
|
+
}, (e) => ctx.logger.warn("hook_async_rewake_dropped", { event, reason: "wake_failed", error: seatText("operator-log-text", String(e)) }));
|
|
906
924
|
});
|
|
907
925
|
child.stdin?.on("error", () => { });
|
|
908
926
|
child.stdin?.end(`${JSON.stringify(boundedToolInputPayload(payload))}\n`);
|
|
909
927
|
child.unref();
|
|
910
928
|
}
|
|
911
929
|
catch (e) {
|
|
912
|
-
ctx.logger.warn("hook_async_failed", { event, reason: "spawn_failed", error:
|
|
930
|
+
ctx.logger.warn("hook_async_failed", { event, reason: "spawn_failed", error: seatText("operator-log-error", String(e)) });
|
|
913
931
|
noteHookFailure(ctx, { event, entry, reason: "spawn_failed", stderr: String(e), toolName: toolNameOf(payload) });
|
|
914
932
|
}
|
|
915
933
|
}
|
|
@@ -996,7 +1014,7 @@ async function runHttpHook(entry, payload, ctx, event) {
|
|
|
996
1014
|
blankedCount: interpolated.blanked.length,
|
|
997
1015
|
blanked: interpolated.blanked
|
|
998
1016
|
.slice(0, MAX_BLANKED_REFERENCES_LOGGED)
|
|
999
|
-
.map(({ header, name, reason }) => ({ header: echoCallerText(header, { maxChars:
|
|
1017
|
+
.map(({ header, name, reason }) => ({ header: echoCallerText(header, { maxChars: BLANKED_HEADER_ECHO_CHARS }), name: echoCallerText(name, { maxChars: BLANKED_HEADER_ECHO_CHARS }), reason })),
|
|
1000
1018
|
});
|
|
1001
1019
|
}
|
|
1002
1020
|
const headers = { "content-type": "application/json", ...interpolated.headers };
|
|
@@ -1034,7 +1052,7 @@ async function runHttpHook(entry, payload, ctx, event) {
|
|
|
1034
1052
|
if (trimmed === "")
|
|
1035
1053
|
return { code: 0, stdout: "{}", stderr: "", timedOut: false };
|
|
1036
1054
|
if (!parseHookStdout(body)) {
|
|
1037
|
-
ctx.logger.warn("hook_http_non_json_response", { url: buildDisplaySafeUrl(entry.url), preview:
|
|
1055
|
+
ctx.logger.warn("hook_http_non_json_response", { url: buildDisplaySafeUrl(entry.url), preview: seatText("operator-log-text", trimmed) });
|
|
1038
1056
|
noteHookFailure(ctx, {
|
|
1039
1057
|
event: eventOfPayload(payload),
|
|
1040
1058
|
entry,
|
|
@@ -1086,7 +1104,7 @@ function readHookStdout(ran, event, ctx, payload, ledger) {
|
|
|
1086
1104
|
return out;
|
|
1087
1105
|
const t = run.stdout.trim();
|
|
1088
1106
|
if (t.startsWith("{") || t.startsWith("[")) {
|
|
1089
|
-
ctx.logger.warn("hook_bad_json_output", { event, type: entry.type, preview:
|
|
1107
|
+
ctx.logger.warn("hook_bad_json_output", { event, type: entry.type, preview: seatText("operator-log-text", t) });
|
|
1090
1108
|
noteHookFailure(ctx, { event, entry, reason: "bad_json", exitCode: run.code, stderr: run.stderr, toolName: toolNameOf(payload) });
|
|
1091
1109
|
ledger.unrun(ran.source, entry, "bad_json");
|
|
1092
1110
|
}
|
|
@@ -1193,7 +1211,7 @@ async function runMatchingEntries(event, groups, matchValue, payload, ctx, onceF
|
|
|
1193
1211
|
return { kind: "halted" };
|
|
1194
1212
|
}
|
|
1195
1213
|
if (run.spawnError) {
|
|
1196
|
-
ctx.logger.warn(entry.type === "http" ? "hook_http_request_failed" : entry.type === "prompt" || entry.type === "agent" ? "hook_llm_failed" : "hook_command_spawn_failed", { event, type: entry.type, error:
|
|
1214
|
+
ctx.logger.warn(entry.type === "http" ? "hook_http_request_failed" : entry.type === "prompt" || entry.type === "agent" ? "hook_llm_failed" : "hook_command_spawn_failed", { event, type: entry.type, error: seatText("operator-log-error", run.spawnError) });
|
|
1197
1215
|
if (!run.noticed)
|
|
1198
1216
|
noteHookFailure(ctx, { event, entry, reason: "spawn_failed", exitCode: run.code, stderr: run.spawnError, ...(toolName !== undefined ? { toolName } : {}) });
|
|
1199
1217
|
return { kind: "unrun", reason: "spawn_failed" };
|
|
@@ -1411,7 +1429,7 @@ export function createSettingsHooksRegistration(config, ctx, budgetMs) {
|
|
|
1411
1429
|
unknownDecision = true;
|
|
1412
1430
|
ctx.logger.warn("hook_permission_decision_unknown", {
|
|
1413
1431
|
event: "PreToolUse",
|
|
1414
|
-
decision:
|
|
1432
|
+
decision: seatText("operator-log-text", typeof decision === "string" ? decision : typeof decision),
|
|
1415
1433
|
tool: toolName,
|
|
1416
1434
|
effect: "hook ruling not honored (closed word set is allow|deny|ask); this call falls back to the engine gate",
|
|
1417
1435
|
});
|
|
@@ -1675,7 +1693,7 @@ export function createSettingsHooksRegistration(config, ctx, budgetMs) {
|
|
|
1675
1693
|
branch = await sctx.getBranch?.();
|
|
1676
1694
|
}
|
|
1677
1695
|
catch (e) {
|
|
1678
|
-
ctx.logger.warn("hook_stop_branch_failed", { error:
|
|
1696
|
+
ctx.logger.warn("hook_stop_branch_failed", { error: seatText("operator-log-error", e instanceof Error ? e.message : String(e)) });
|
|
1679
1697
|
}
|
|
1680
1698
|
const rendered = renderBranchTranscript(branch);
|
|
1681
1699
|
if (rendered.sufficient) {
|
|
@@ -1718,7 +1736,7 @@ export function createSettingsHooksRegistration(config, ctx, budgetMs) {
|
|
|
1718
1736
|
if (v.ok)
|
|
1719
1737
|
continue;
|
|
1720
1738
|
if (v.impossible) {
|
|
1721
|
-
ctx.logger.warn("hook_stop_condition_impossible", { event: "Stop", reason:
|
|
1739
|
+
ctx.logger.warn("hook_stop_condition_impossible", { event: "Stop", reason: seatText("operator-log-message", v.reason?.trim() ?? "") });
|
|
1722
1740
|
continue;
|
|
1723
1741
|
}
|
|
1724
1742
|
if (block === undefined)
|
|
@@ -1728,7 +1746,7 @@ export function createSettingsHooksRegistration(config, ctx, budgetMs) {
|
|
|
1728
1746
|
const out = llmExtra && entry.type === "prompt" ? parseHookStdout(run.stdout) : readHookStdout(ran, "Stop", ctx, payload, ledger);
|
|
1729
1747
|
if (!out) {
|
|
1730
1748
|
if (llmExtra && entry.type === "prompt") {
|
|
1731
|
-
ctx.logger.warn("hook_llm_unparsed_verdict", { event: "Stop", head:
|
|
1749
|
+
ctx.logger.warn("hook_llm_unparsed_verdict", { event: "Stop", head: seatText("operator-log-text", run.stdout.trim()) });
|
|
1732
1750
|
emitHookNotice(ctx, { kind: "hook_decision_unavailable", event: "Stop", reason: "unparsed" });
|
|
1733
1751
|
ledger.unrun(ran.source, entry, "bad_json", "the prompt hook's answer could not be read as a verdict");
|
|
1734
1752
|
}
|
package/dist/host-decision.d.ts
CHANGED
|
@@ -44,7 +44,7 @@ import { type AskOutcome, type HostDecider, type PermissionResult, type ResumeOu
|
|
|
44
44
|
* 这个事实铸(`human_refused` / `approval_window_expired` / `policy_refused`)。core 若改这一格的词表,
|
|
45
45
|
* 读它的每一处编译期先红。
|
|
46
46
|
*
|
|
47
|
-
* 🔴 **
|
|
47
|
+
* 🔴 **[ref]:为什么这一格住在本叶子模块**(此前是 `tool-approval.ts` 的模块私有型):来源位随决议
|
|
48
48
|
* **落持久行**之后,店(`src/plugins/approval-ask-store-sql.ts` 的 `AskRow.settledBy` /
|
|
49
49
|
* `DecideAskInput.settledBy`)与协调器都要说同一个型 —— 而店不能反向依赖协调器。本模块只依赖
|
|
50
50
|
* `@sema-agent/core`,与同住的 {@link HostDecision}(耐久腿的同位事实)恰好是一对:一条决议的来源
|
|
@@ -54,7 +54,7 @@ export type HostSettledBy = NonNullable<Extract<AskOutcome, {
|
|
|
54
54
|
allow: boolean;
|
|
55
55
|
}>["settledBy"]>;
|
|
56
56
|
/** 直接取 core `ResumeOutcome` policy_ask 臂的 `hostDecision` 型 —— 本仓不复述那几个词(第二铸点)。它的 `decidedBy` 就是 core 的 `HostDecider`
|
|
57
|
-
* (core 7.45.0
|
|
57
|
+
* (core 7.45.0 [ref]:三个型位读同一只闭集)。**谁结束了这次等待**的闭集只有 core 包根那一只(`HOST_DECIDERS` / `HostDecider` / `isHostDecider`)。 */
|
|
58
58
|
export type HostDecision = Extract<ResumeOutcome, {
|
|
59
59
|
gate: "policy_ask";
|
|
60
60
|
}>["hostDecision"];
|
|
@@ -72,14 +72,14 @@ export type HostDecision = Extract<ResumeOutcome, {
|
|
|
72
72
|
* · `plan_review` 不读这只键:引擎的 plan_review 结局形没有决定者位(core 的结局规整会把别的键整只重建掉),收下它就是
|
|
73
73
|
* 一句「已记」的空话。那一门照兄弟门字段那一族拒(`approvals-assistant.ts` 的回决门族派生),候 core 给座。
|
|
74
74
|
*
|
|
75
|
-
* 词表的来源:core 包根的 `HOST_DECIDERS` / `HostDecider` / `isHostDecider`(core 7.45.0
|
|
75
|
+
* 词表的来源:core 包根的 `HOST_DECIDERS` / `HostDecider` / `isHostDecider`(core 7.45.0 [ref];此前包根只有型,本仓手写一只闭集常量 + 两道
|
|
76
76
|
* 编译门双向咬它 —— 那份手抄随本版退役)。wire 闭集 = 那只词表去掉扫的那一个词,运行期值与型都从它派生,没有第二份词表。
|
|
77
77
|
*/
|
|
78
78
|
/** 只有本服务自己的截止扫说得出的那一个词 —— core 词表里唯一不上 wire 的成员(`satisfies`:core 改名 / 退役它 ⇒ 这里编译红)。 */
|
|
79
79
|
declare const SWEEP_ONLY_DECIDER = "sla_timeout";
|
|
80
80
|
/** wire 上的出处词(决定体 `decidedBy` 的值域)= core 闭集去掉扫的那一个。 */
|
|
81
81
|
export type ApprovalDecidedBy = Exclude<HostDecider, typeof SWEEP_ONLY_DECIDER>;
|
|
82
|
-
/** wire 闭集的运行期值:core `HOST_DECIDERS`(
|
|
82
|
+
/** wire 闭集的运行期值:core `HOST_DECIDERS`([ref])去掉扫的那一个,顺序随 core。core 加一个词 ⇒ 它在这里自动在场(决定口的门照收;两只座的映射
|
|
83
83
|
* {@link liveSettledBy} 的穷举 `switch` 编译红,由人裁它在同步座上怎么落)。 */
|
|
84
84
|
export declare const APPROVAL_DECIDED_BY: readonly ApprovalDecidedBy[];
|
|
85
85
|
/** 闭集外的拒句(三条决定口同一句;码按各口既有约定,见 {@link readDecidedBy})。成员表派生自 {@link APPROVAL_DECIDED_BY}(词表一个来源;今天字节与 7.118.0 同)。 */
|
|
@@ -141,7 +141,7 @@ export declare function readDecidedBy(raw: unknown, directDoorActive: boolean):
|
|
|
141
141
|
*/
|
|
142
142
|
export declare function liveSettledBy(decidedBy: ApprovalDecidedBy): Extract<HostSettledBy, "policy"> | undefined;
|
|
143
143
|
/**
|
|
144
|
-
* 引擎自己的那一条例外:**一张要人的卡不归策略答** —— 判官是 core 的 `policyCannotAnswer(question, decidedBy)`(
|
|
144
|
+
* 引擎自己的那一条例外:**一张要人的卡不归策略答** —— 判官是 core 的 `policyCannotAnswer(question, decidedBy)`([ref] 包根导出;引擎的续跑入口、
|
|
145
145
|
* 执行带与同步座读同一条)。本仓**只在自己的副作用先于引擎落地的两条口**上于裁决之前问它(live `/respond`:会话放行 / 常驻规则 / 一条按 approve
|
|
146
146
|
* 回放的 DECIDED 行;耐久 ask 账:一条宣称 approve 的 DECIDED 行),并且只问**放行**那一向(与引擎续跑入口同:拒永远答得了)。耐久 `/decide` 不判:
|
|
147
147
|
* 引擎在 CAS 之前就拒(`checkpoint.invalid_outcome`,卡留 pending),本口的副作用全在引擎受理之后 —— 在那里再问一次就是第二个判官。
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* [ref](core 7.30.1 [ref] 提货)—— **宿主车道本地语言服务器**的唯一构造点。
|
|
3
3
|
*
|
|
4
|
-
* ## 病(DEBTS
|
|
4
|
+
* ## 病(DEBTS [ref] 同轴的第二条,7.99.0 修复验证 opus 腿普查带出)
|
|
5
5
|
* core 的 `NodeLspManager` 默认 spawn(`defaultLspSpawn`)在 7.30.1 之前**不带 env** ⇒ 语言服务器整份继承本进程的
|
|
6
6
|
* `process.env`,脑钥 / 仓库令牌 / 本仓自己的凭据键全在里面,而语言服务器会执行仓里的代码(构建脚本、插件、
|
|
7
7
|
* 工作区配置)。7.30.1 起 core 默认改成 `scrubSecretEnv(process.env)`(按键名**形状**剥),并开了
|
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
* 本仓唯一组合 `hostSubprocessEnv` 的结果 —— 引擎 `inheritedHostEnv("scrub")` ∪ 点名放回)。
|
|
10
10
|
*
|
|
11
11
|
* ## 规则(一句)
|
|
12
|
-
* 语言服务器子进程的 env = 引擎 `inheritedHostEnv("scrub")`(形状剥 ∪ 本进程起服声明的自有凭据名)∪ 部署方点名放回的键(
|
|
12
|
+
* 语言服务器子进程的 env = 引擎 `inheritedHostEnv("scrub")`(形状剥 ∪ 本进程起服声明的自有凭据名)∪ 部署方点名放回的键([ref],见下节;缺省空名单)——
|
|
13
13
|
* 剥除与模型可驱动的 host shell(`inheritEnv:"scrub"`)
|
|
14
14
|
* 和 project-memory 的 git 子进程**同一只函数**:目录 `type:"secret"` 键按名剥 ∘ core 形状规则按形剥。只交 core 的默认
|
|
15
|
-
* 会漏掉形状规则认不出的本仓凭据键(当时是 `OTEL_EXPORTER_OTLP_HEADERS`,core 7.33.7
|
|
15
|
+
* 会漏掉形状规则认不出的本仓凭据键(当时是 `OTEL_EXPORTER_OTLP_HEADERS`,core 7.33.7 [ref] 起 core 按名剥它;今天只剩名单型旋钮三只),那正是 [ref] 当初的病形。
|
|
16
16
|
* 剥掉了什么经既有观测面留痕(site = `server.lsp.spawn-env`,每 site×key 一次披露 + 逐次计数)—— core 那侧
|
|
17
17
|
* 刻意不报(无收集器,KL),本仓这一格补上。
|
|
18
18
|
*
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
* env 在**构造时**取一次快照(boot / run-local 起腿时),而不是 core 默认那样每次 spawn 现取:`NodeLspManagerOptions.env`
|
|
21
21
|
* 是一份静态记录。本仓的 `process.env` 是 boot 期输入(热配置走 web-admin,不改 `process.env`),两者在本仓部署上同值。
|
|
22
22
|
*
|
|
23
|
-
* ## 点名放行(
|
|
23
|
+
* ## 点名放行([ref],`LSP_ENV_ALLOW`)
|
|
24
24
|
* 剥除会连语言服务器自己的真实依赖一起剥掉(`.npmrc` 的 `${NPM_TOKEN}` 插值、rust-analyzer `cargo metadata` 私有 registry 的
|
|
25
25
|
* `CARGO_REGISTRIES_<名>_TOKEN` —— 形状规则按名判,分不出「给语言服务器用的令牌」与「编排器的令牌」)。出路 = 部署方点名:
|
|
26
26
|
* env = 引擎 `inheritedHostEnv("scrub")` 之上把 `config.lspEnvAllow` 点到的键经 `allowlistedEnv`(与沙箱三腿
|
package/dist/hosted-posture.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* [ref] / [ref](车LT,7.95.0)→ [ref] / B-10(车NB,7.99.0)—— **「这台部署是不是托管 / 多租」的单一铸点**。
|
|
3
3
|
*
|
|
4
4
|
* ## 为什么是一处
|
|
5
5
|
*
|
|
@@ -11,14 +11,12 @@
|
|
|
11
11
|
* ⚠️ 这句话此前在本仓被抄成「`boot/resolve-spec.ts` 阶段④ 的 `partitions` 字面量」——`src/` 里**没有**
|
|
12
12
|
* 那个字面量(全仓 `partitions` 的 src 命中全是注释;尺子:同目录 `config` 3721 命中)。手抄的**坐标**
|
|
13
13
|
* 比手抄的值更难发现烂掉,[ref] 的第一排查点就是它;
|
|
14
|
-
* ·
|
|
15
|
-
* (
|
|
16
|
-
* · `settings.hooks` —— `task-settings.ts` 的 `taskHooksHonored`(唯一属主;resolve-spec 装配 / 受理面 / 能力位三处同调)
|
|
17
|
-
* `
|
|
18
|
-
* · `additionalDirectories` / `additionalReadDirectories` ——
|
|
19
|
-
*
|
|
20
|
-
* · `settings.env` / `cwd` —— `cwdHonored ‖ deviceCwdHonored`,而
|
|
21
|
-
* **`deviceCwdHonored` 这一臂里没有 `requirePrincipal` 项**(`task-cwd.ts`:device 车道上那条路径落在
|
|
14
|
+
* · 能力授予面的赦免挂在「单主」上 —— 但**三条面读的是部署形表(`deployment-shape.ts`)里三个不同的行**
|
|
15
|
+
* (异源复核实测,别照「它们都一样」写;[ref] 起三行并排在一张表里,轴列即差异):
|
|
16
|
+
* · `settings.hooks` —— `task-settings.ts` 的 `taskHooksHonored`(唯一属主;resolve-spec 装配 / 受理面 / 能力位三处同调)= 表行
|
|
17
|
+
* `multiTenant` 的反面 ⇒ 采纳,否则忽略(**不看车道**,任何 `REMOTE_EXEC` 都一样);
|
|
18
|
+
* · `additionalDirectories` / `additionalReadDirectories` —— 表行 `callerOwnsWorkerDisk`(手在本 worker 盘上 ∧ 单主 = 今天只有 host);
|
|
19
|
+
* · `settings.env` / `cwd` —— 表行 `callerCwd`(读能力表 `callerCwd` 位:host 单主才开,**device 不读租户**:那条路径落在
|
|
22
20
|
* **发起者自己的设备**上,归属由 `device_session` 绑定行验过 ⇒ 跨租户面结构性不存在)。
|
|
23
21
|
*
|
|
24
22
|
* ⇒ 先把这个判定位铸成**一处**,再让各条腿都读它(clay 裁定③,2026-09-22):**不许各自加特判**——
|
|
@@ -36,7 +34,7 @@
|
|
|
36
34
|
* ⇒ 签发方配置是**身份验签轴**(谁的 JWT 算数),不是租户轴(这台机器有几个主人)。「受控于控制面」
|
|
37
35
|
* (`SEMA_WEB_ADMIN_*`,含 worker 名)同理是 fleet 管理轴,本判据同样不读。
|
|
38
36
|
*
|
|
39
|
-
* 随两臂一起删掉的(按类删干净,规则集变小):
|
|
37
|
+
* 随两臂一起删掉的(按类删干净,规则集变小):[ref] 腿①「托管 ∧ 未开 `REQUIRE_PRINCIPAL` ⇒ 拒启」
|
|
40
38
|
* (判据只剩读 `requirePrincipal` 的那一臂之后,那条合取恒假 ⇒ 结构上不可达)及其跨键不变量行;
|
|
41
39
|
* `run-local.ts` 为那两臂清 env 的清除口。
|
|
42
40
|
*
|
|
@@ -85,7 +83,7 @@ export interface HostedPostureFacts {
|
|
|
85
83
|
readonly evidence: readonly HostedEvidence[];
|
|
86
84
|
}
|
|
87
85
|
/**
|
|
88
|
-
* 判定位的**唯一**铸点(纯数据 ⇒ `build*`)。托管 ⇔ `
|
|
86
|
+
* 判定位的**唯一**铸点(纯数据 ⇒ `build*`)。托管 ⇔ 部署形表行 `multiTenant`(= 运维声明 `REQUIRE_PRINCIPAL=true`,[ref] ①)。
|
|
89
87
|
*
|
|
90
88
|
* `evidence` 仍是数组(按词表顺序收**全部**命中):拒因逐字点它们,运维才知道改哪儿;词表是闭集,
|
|
91
89
|
* 形状不随词数变。
|
|
@@ -99,7 +97,19 @@ export declare function hostedEvidenceNote(e: HostedEvidence): string;
|
|
|
99
97
|
export type TaskWriteFaceInput = TaskHostPostureScope & Readonly<Pick<ServiceConfigFlat, "taskWriteFaceEscalation">>;
|
|
100
98
|
/** 任务层宿主姿态声明被拒时的 wire 子码(附录 A 的 `request.` 族)。 */
|
|
101
99
|
export declare const HOST_POSTURE_REFUSED_CODE = "request.host_posture_refused";
|
|
102
|
-
/**
|
|
100
|
+
/**
|
|
101
|
+
* **射程判据** —— 这台部署认不认「任务层替它声明的宿主姿态」?
|
|
102
|
+
*
|
|
103
|
+
* 两条腿读它,都是**真的开门**的声明 ⇒ 都响亮拒(同码 {@link HOST_POSTURE_REFUSED_CODE}、同状态 422):
|
|
104
|
+
* · 腿② 写容纳面(bypassPermissions 开的写面)—— {@link taskWriteFaceRefusal};
|
|
105
|
+
* · 腿④ [ref] host shell 继承整份用户环境(`inheritEnv:"all"`)—— {@link taskInheritEnvRefusal}。
|
|
106
|
+
* [ref] 前还有腿③(`approverPosture`,忽略 + 留声),随那个请求键一起退役。射程只铸在这一处,同族声明读同一只。
|
|
107
|
+
*
|
|
108
|
+
* 🔴 **device 车道不适用(clay 裁定③ 2026-09-22)**:device 车道上 host 闸防的那个跨租户宿主穿越**结构性不存在**
|
|
109
|
+
* (路径落在**发起者自己的设备**上,归属由 `device_session` 绑定行 + 准入链的 owner 谓词验过),叠加 clay [ref]
|
|
110
|
+
* 「device 零额外审批」⇒ 在那条车道上拿租户声明当判据就是**用错轴**。与 `settings.env` / `cwd` 两键在那条车道上的既有臂同源同形。
|
|
111
|
+
* [ref] 起射程判据 = 部署形表行 `taskHostPostureDeclarations`(device 车道 ∨ 单主;轴列 lane + principal);下面是它读的键集(托管证据 + 车道)。
|
|
112
|
+
*/
|
|
103
113
|
export type TaskHostPostureScope = HostedPostureInput & Readonly<Pick<ServiceConfigFlat, "remoteExec">>;
|
|
104
114
|
/**
|
|
105
115
|
* **腿②** —— 这条请求要掀开写围栏,这台部署给不给?返回拒因;`undefined` = 放行。
|
|
@@ -109,7 +119,7 @@ export type TaskHostPostureScope = HostedPostureInput & Readonly<Pick<ServiceCon
|
|
|
109
119
|
* governance 的 `overrides.writeFace="roots"` 去压——实测 core 的 `tightenTaskSpec` 在
|
|
110
120
|
* base `open` × override `roots` 上**静默**取 `roots`(该函数零回调形参 ⇒ 没有留痕通道)。
|
|
111
121
|
*
|
|
112
|
-
* 🔴 **射程(含 device 车道那条对位臂)
|
|
122
|
+
* 🔴 **射程(含 device 车道那条对位臂)在部署形表行 `taskHostPostureDeclarations` 上** ——
|
|
113
123
|
* 两条腿同射程、不同处置,射程只有一处答案。
|
|
114
124
|
*/
|
|
115
125
|
export declare function taskWriteFaceRefusal(c: TaskWriteFaceInput): string | undefined;
|
package/dist/hosted-posture.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { TASK_WRITE_FACE_ESCALATIONS } from "./config-types.js";
|
|
2
|
-
import {
|
|
2
|
+
import { DEPLOYMENT_SHAPE_PREDICATES } from "./deployment-shape.js";
|
|
3
3
|
export const HOSTED_EVIDENCE_WORDS = ["require-principal"];
|
|
4
4
|
export function buildHostedPosture(c) {
|
|
5
5
|
const evidence = [];
|
|
6
|
-
if (c
|
|
6
|
+
if (DEPLOYMENT_SHAPE_PREDICATES.multiTenant.holds(c))
|
|
7
7
|
evidence.push("require-principal");
|
|
8
8
|
return { hosted: evidence.length > 0, evidence };
|
|
9
9
|
}
|
|
@@ -17,11 +17,6 @@ function hostedBecause(facts) {
|
|
|
17
17
|
return facts.evidence.map(hostedEvidenceNote).join("; ");
|
|
18
18
|
}
|
|
19
19
|
export const HOST_POSTURE_REFUSED_CODE = "request.host_posture_refused";
|
|
20
|
-
function hostPostureDeclarationsHonored(c) {
|
|
21
|
-
if (deviceCwdHonored(c))
|
|
22
|
-
return true;
|
|
23
|
-
return !buildHostedPosture(c).hosted;
|
|
24
|
-
}
|
|
25
20
|
export function taskWriteFaceRefusal(c) {
|
|
26
21
|
switch (c.taskWriteFaceEscalation) {
|
|
27
22
|
case "allow":
|
|
@@ -39,7 +34,7 @@ export function taskWriteFaceRefusal(c) {
|
|
|
39
34
|
`Set TASK_WRITE_FACE_ESCALATION to one of ${TASK_WRITE_FACE_ESCALATIONS.join(" | ")}, or unset it to let the deployment posture decide.`);
|
|
40
35
|
}
|
|
41
36
|
}
|
|
42
|
-
if (
|
|
37
|
+
if (DEPLOYMENT_SHAPE_PREDICATES.taskHostPostureDeclarations.holds(c))
|
|
43
38
|
return undefined;
|
|
44
39
|
const facts = buildHostedPosture(c);
|
|
45
40
|
return (`permissionMode:"bypassPermissions" opens the WRITE containment face (the engine's bypassPermissions mode writes outside the write roots) — the run could write outside the task root. ` +
|
|
@@ -47,7 +42,7 @@ export function taskWriteFaceRefusal(c) {
|
|
|
47
42
|
`Set TASK_WRITE_FACE_ESCALATION=allow if the DEPLOYMENT permits the task layer to open it, or omit permissionMode:"bypassPermissions".`);
|
|
48
43
|
}
|
|
49
44
|
export function taskInheritEnvRefusal(c) {
|
|
50
|
-
if (
|
|
45
|
+
if (DEPLOYMENT_SHAPE_PREDICATES.taskHostPostureDeclarations.holds(c))
|
|
51
46
|
return undefined;
|
|
52
47
|
const facts = buildHostedPosture(c);
|
|
53
48
|
return (`inheritEnv:"all" hands the model-driven host shell this machine's WHOLE environment (credential-shaped variables included — the host lane scrubs them by default). ` +
|
package/dist/http/admission.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* 提交准入(
|
|
2
|
+
* 提交准入([ref] 切片:`http/server.ts` 的 `prepareSpec` 与它的模块级校验词表逐字搬家,正文一字未改)。
|
|
3
3
|
* 读体 → 验型 → 授权 → 建 spec 的**唯一**一条链;tasks / runs / A2A 三个提交面共用它(抄一份 = 抄一份会漂的 400)。
|
|
4
4
|
* ctx 字段 3 只(`deps` / `readJson` / `runnerFor`),机器算(closure-free-vars)与手抄一致。
|
|
5
5
|
*/
|
|
@@ -59,7 +59,7 @@ export interface UserSkillsRefusal {
|
|
|
59
59
|
readonly facts?: LimitFacts;
|
|
60
60
|
}
|
|
61
61
|
/**
|
|
62
|
-
* core 7.41.0
|
|
62
|
+
* core 7.41.0 [ref] —— 顶层技能带 `manifest` 的拒因句(单铸点)。出路只点本服务上**真存在**的旋钮:技能的两只清单
|
|
63
63
|
* (`allowedTools` / `disallowedTools`)、圈工具 = deny 规则(请求 `settings.permissions.deny` / 运维 `APPROVAL_DENY`)或子代定义的
|
|
64
64
|
* `agents[].allowTools`、圈写路径 = 会话规则 `allowDirs`(`PUT /v1/sessions/:id/policy`)。
|
|
65
65
|
*/
|
package/dist/http/admission.js
CHANGED
|
@@ -2,7 +2,7 @@ import { APPROVAL_REACH, MCP_IMAGE_MAX_BASE64, isApprovalReach, isPermissionMode
|
|
|
2
2
|
import { isAtMentionable, matchCatalogModel, refusedCatalogEntry, selectableCatalog } from "../model-select.js";
|
|
3
3
|
import { echoModelRef, modelUnavailableMessage } from "../model-entry-refusal.js";
|
|
4
4
|
import { HttpError, sessionIdShapeIssue } from "../security.js";
|
|
5
|
-
import { MAX_SETTINGS_OUTPUT_STYLE_CHARS, MAX_SETTINGS_ENV_VARS, MAX_SETTINGS_ENV_KEY_CHARS, MAX_SETTINGS_ENV_VALUE_CHARS, PERMISSION_MODE_WORDS, parseTaskSettings, settingsPermissionBucketIssue, skillListingBudgetFractionOk, skillListingMaxDescOk, stampEntryPermissionMode, taskHooksHonored, taskSettingsKeyIssue } from "../task-settings.js";
|
|
5
|
+
import { MAX_SETTINGS_OUTPUT_STYLE_CHARS, MAX_SETTINGS_ENV_VARS, MAX_SETTINGS_ENV_KEY_CHARS, MAX_SETTINGS_ENV_VALUE_CHARS, PERMISSION_MODE_WORDS, parseTaskSettings, settingsPermissionBucketIssue, skillListingBudgetFractionOk, skillListingMaxDescOk, hooksKeyIssue, stampEntryPermissionMode, taskHooksHonored, taskSettingsKeyIssue } from "../task-settings.js";
|
|
6
6
|
import { tightenOnlySeatIssue } from "../tighten-only-seats.js";
|
|
7
7
|
import { approvalFrameFamiliesIssue } from "../tool-approval.js";
|
|
8
8
|
import { buildEntryModeClampNotice } from "../entry-mode-clamp-notice.js";
|
|
@@ -10,8 +10,8 @@ import { autonomyModeFloor } from "../runtime-governance.js";
|
|
|
10
10
|
import { taskBodyKeyIssue } from "../request-key-closure.js";
|
|
11
11
|
import { FILE_HISTORY_DISABLED_NO_RESTORE, fileHistoryRestoreConflict, fileHistoryRestoreKeysInBody, inheritEnvFieldIssue, singleMemberOffFieldIssue } from "../request-value-closure.js";
|
|
12
12
|
import * as facts from "../capability-facts.js";
|
|
13
|
-
import { buildHooksRefusal, parseHooksConfig, hooksMatcherIssue } from "../hooks/hook-runner.js";
|
|
14
|
-
import {
|
|
13
|
+
import { buildHooksRefusal, buildHooksUrlCredentialRefusal, parseHooksConfig, hooksMatcherIssue, hooksUrlCredentialIssue } from "../hooks/hook-runner.js";
|
|
14
|
+
import { judgeFreshRequestWebSearch } from "../plugins/web-search.js";
|
|
15
15
|
import { normalizeApproachNotice, skillToolListOk, unknownTaskAgentModelRef, validateTaskAgents } from "../spec-fields.js";
|
|
16
16
|
import { allowSelectorWarningsOf, skillToolListsOverCap } from "../rule-entry-list.js";
|
|
17
17
|
import { limitFacts, limitRefusal } from "../limit-refusal.js";
|
|
@@ -300,6 +300,21 @@ export function createAdmission(ctx) {
|
|
|
300
300
|
sendError(res, 400, "request.field_invalid", refusal.message, { field: refusal.field, detail: refusal.detail });
|
|
301
301
|
return null;
|
|
302
302
|
}
|
|
303
|
+
{
|
|
304
|
+
const hooksKeys = hooksKeyIssue(st.hooks, hooksParsed.config);
|
|
305
|
+
if (hooksKeys) {
|
|
306
|
+
sendError(res, 400, "request.body_shape", hooksKeys.message, { unknownKeys: hooksKeys.unknownKeys, unsupportedKeys: hooksKeys.unsupportedKeys });
|
|
307
|
+
return null;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
{
|
|
311
|
+
const hookUrl = hooksUrlCredentialIssue(hooksParsed.config);
|
|
312
|
+
if (hookUrl !== undefined) {
|
|
313
|
+
const refusal = buildHooksUrlCredentialRefusal(hookUrl);
|
|
314
|
+
sendError(res, 400, "request.field_invalid", refusal.message, refusal.facts);
|
|
315
|
+
return null;
|
|
316
|
+
}
|
|
317
|
+
}
|
|
303
318
|
const toolMatcher = hooksMatcherIssue(hooksParsed.config, taskHooksHonored(deps.config) ? "regex" : "literal");
|
|
304
319
|
if (toolMatcher !== undefined) {
|
|
305
320
|
const refusal = buildHooksRefusal(toolMatcher);
|
|
@@ -308,9 +323,9 @@ export function createAdmission(ctx) {
|
|
|
308
323
|
}
|
|
309
324
|
}
|
|
310
325
|
{
|
|
311
|
-
const webSearchVerdict =
|
|
326
|
+
const webSearchVerdict = judgeFreshRequestWebSearch(st.webSearch);
|
|
312
327
|
if (webSearchVerdict.kind === "malformed") {
|
|
313
|
-
sendError(res, 400, "request.field_invalid", webSearchVerdict.issue);
|
|
328
|
+
sendError(res, 400, "request.field_invalid", webSearchVerdict.issue, webSearchVerdict.facts);
|
|
314
329
|
return null;
|
|
315
330
|
}
|
|
316
331
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* 审批扫腿(
|
|
2
|
+
* 审批扫腿([ref] 切片:`http/server.ts` 5196–5488 逐字搬家,正文一字未改)——两条不经 HTTP 路由的赎回口:
|
|
3
3
|
* ①`denyExpiredApprovals`([ref] D-D,SLA 到期的 deny-sweep,main.ts 的 reaper 按拍调);
|
|
4
4
|
* ②`redeemParkedAsk`([ref],live 回决腿的 PARKED 赎回席,装配层接进协调器的晚绑座)。
|
|
5
5
|
* 两者都走 resume 家族的 `resumeCheckpoint`,所以它们的属主是「谁在无 HTTP 请求的情况下替人做决定」这件事,
|
|
@@ -3,7 +3,8 @@ const errText = (e) => redactHead(e instanceof Error ? e.message : String(e), 20
|
|
|
3
3
|
import { findParkOrigin } from "../parked-decide.js";
|
|
4
4
|
import { decodeCheckpointScope } from "../security.js";
|
|
5
5
|
import { hostDecisionFacts } from "../host-decision.js";
|
|
6
|
-
import {
|
|
6
|
+
import {} from "../tool-approval.js";
|
|
7
|
+
import { APPROVAL_GATE_KINDS } from "../approval-content-kind.js";
|
|
7
8
|
import { createWallClockJumpGuard } from "../wall-clock-jump-guard.js";
|
|
8
9
|
import { gatedPrincipal, hasServiceAuth } from "./principal-gate.js";
|
|
9
10
|
import { costQuotaRefusalOf } from "./request-guards.js";
|
|
@@ -223,13 +223,17 @@ export declare function storedBodyReplayAnswer(refusal: StoredBodyReplayRefusal,
|
|
|
223
223
|
* 封签里装的是那个 JSON 值本身,开封逐字还原。字典位上的容器本身不是字典(串 / 数组 / `null` / 封签形对象)⇒ 整只容器当一个值封。
|
|
224
224
|
* 于是落盘形里凭据位上**只有本封口铸的封签**,没有哪个值能「原样存下、续跑时被开成别的东西」(调用方送一只封签形对象 ⇒ 存的是再封一层,
|
|
225
225
|
* 开出来还是那只对象 —— 与新提交腿看到的同一个值)。没有封签器而有值要封 ⇒ 抛 {@link CheckpointCtxUnsealableError}(`no_key_store`,调用方在写之前拒)。
|
|
226
|
-
* · **读法记号**(与本文件另两只记号同一条「写的人盖章」):封口铸出的每一份落盘形都带 `credentialSeal: CHECKPOINT_CTX_SEAL_ALG`
|
|
227
|
-
*
|
|
226
|
+
* · **读法记号**(与本文件另两只记号同一条「写的人盖章」):封口铸出的每一份落盘形都带 `credentialSeal: CHECKPOINT_CTX_SEAL_ALG` 与
|
|
227
|
+
* `credentialSlotGeneration`(= 这一行里**带值的**凭据位最新的那一代,最小 1)—— 这一行的凭据位全部由本封口封过,且它用到的位不比这一代新。
|
|
228
|
+
* 代数取「用到的」而不取「本版的」:不带新位值的行与上一代的写者写下的同形,回滚到上一代照读;代数比读者新 ⇒ 这一行**一定**带着读者不认识的位 ⇒ 读者整行拒。没有记号的行是 7.134.0 之前的写者写下的:
|
|
229
|
+
* 那时没有任何写者封值,所以它凭据位上的封签形对象只可能是调用方原样送来的,不是封签。代数缺席的带记号行是 7.134.0 的写者写下的 —— 它封的是第 1 代
|
|
230
|
+
* (闭集每行的 `since`);某一位的 `since` 大于这一行封过的代数 ⇒ 那一位上的值不论长什么样都没被封过(一只恰好长成封签形的明文字典也是明文)。
|
|
228
231
|
* 记号只在落盘形上(开口交出的开封形里没有它;写回再封时重新盖)。
|
|
229
232
|
* · **读**:一只开口 {@link openCheckpointCtx},唯一调用方 = 续跑上下文唯一读口 `resume-ctx-read.ts` 的 `readResumeCtx`(读出的 ctx 在任何消费者
|
|
230
|
-
* 看到之前已开封)
|
|
231
|
-
*
|
|
232
|
-
*
|
|
233
|
+
* 看到之前已开封)。逐值判词 = {@link credentialValueReading}(开口与 M28 同一只):行带当前记号、这一位在它封过的那一代里:凭据位上封签 ⇒ 开(开不开 ⇒ 拒);
|
|
234
|
+
* 带 `sealed` 键却不是本闭集的封签形(含将来的 `alg`)⇒ 拒 `unrecognized_seal`;其余任何值 ⇒ 拒 `plaintext`。这一位比行封过的代数新 ⇒ 任何值 ⇒ 拒 `plaintext`。
|
|
235
|
+
* 行没有记号 ⇒ 凭据位上**任何**值(含封签形对象)⇒ 拒 `plaintext`(更早版本写下、M28 还没扫到);记号认不得(将来的格式)⇒
|
|
236
|
+
* 凭据位上任何值 ⇒ 拒 `unrecognized_seal`,凭据位上没有值的行不论记号照常开;代数认不得(比本版新 / 不是正整数)⇒ **整行**拒 `unrecognized_seal`(`field` = 记号位名),不看已知位上有没有值。
|
|
233
237
|
* **拒** = 读口第四态 `unsealable`(`field` = 哪一个凭据位,`reason` ∈ {@link CHECKPOINT_CTX_UNSEALABLE_REASONS}),各续跑入口答
|
|
234
238
|
* `409 conflict.checkpoint_ctx_unsealable`(`resume-ctx-read.ts` 的 `resumeCtxUnsealableAnswer`)。**没有**明文回落臂、**没有**静默丢键臂。
|
|
235
239
|
* · **装配**:`checkpointStore` 在场而封签器缺席 ⇒ 拒启({@link CHECKPOINT_CTX_SEALING_REQUIRED};`createHttpServer` 与起服第 6 段同一句)。
|
|
@@ -266,31 +270,47 @@ export interface CheckpointCtxSealing extends CheckpointCtxSealer, CheckpointCtx
|
|
|
266
270
|
* **凭据位闭集**(提交体里值为凭据的位置)。路径段 `*` = 那一格容器的**每一个成员**:数组的每一项、字典的每一个值(一只走法,不分容器种类 —— 字典成员的点名形
|
|
267
271
|
* `field` 是 `.<键>`,数组是 `[<下标>]`)。`map` = 那一格是串值字典,**每一个值**都是凭据(不分哪一键);`value` = 那一格本身是凭据。
|
|
268
272
|
* 入表判据(一条):请求面上**为承载凭据而设**的字段 —— 静态请求头(MCP http 传输、A2A 对端〔引擎型注:「e.g. an auth bearer」〕、http hook 条目)、
|
|
269
|
-
* 交给子进程的 env(MCP stdio 传输、任务 shell 的 `settings.env
|
|
273
|
+
* 交给子进程的 env(MCP stdio 传输、任务 shell 的 `settings.env`、command hook 条目的插件选项)、请求自带的搜索后端钥匙。http hook 的头与另两种静态头同判:契约包的条目形是
|
|
270
274
|
* `headers: Record<string, string>`、受理面(`parseHooksConfig`)只判条数与字数、`interpolateHookEnvVars` 只换 `$NAME` 引用而字面值原样上 wire ——
|
|
271
|
-
* 头值可以就是字面的 `Authorization: Bearer
|
|
275
|
+
* 头值可以就是字面的 `Authorization: Bearer …`。插件选项与 `settings.env` 同判:`plugin.options` 的每一个值就是 hook 子进程环境里的 `CLAUDE_PLUGIN_OPTION_<KEY>`
|
|
276
|
+
* (`hooks/command-spawn.ts` 的 `hookPluginEnv`),参照实现也把 sensitive 选项照样交进这一族环境变量 —— 值是不是秘密不是本层能判的,所以整格封,不判值形。
|
|
277
|
+
* hooks 的形 = 事件名 → 匹配组数组 → 组的 `hooks` 数组 → 条目;只有 `type:"http"` 的条目有 `headers`、只有带 `plugin` 的 command 条目有 `plugin.options`,
|
|
272
278
|
* 别的条目在那一段缺席、走法照常不往下走。**不入表**:命令行 / URL / 工具实参之类自由文本(不是凭据字段;它们里有没有秘密不是本层能判的)。
|
|
273
|
-
* 加一位 = 加一行,读写两侧与一次性迁移 M28 共用 {@link mapCredentialSlots}
|
|
279
|
+
* 加一位 = 加一行,读写两侧与一次性迁移 M28 共用 {@link mapCredentialSlots} 一只走法:写侧与读侧立即覆盖;已落盘的行由 M28 补封 ——
|
|
280
|
+
* 新行的 `since` 取下一代:封口铸的落盘形盖「这一行里带值的位最新的那一代」(`credentialSlotGeneration`),读者据它判那一行用到、封过哪几位 —— 代数更早的行上新位的值一律是明文(记号本身不证明它封过新位)。
|
|
281
|
+
* M28 封的是「读口会答 `plaintext` 的每一个值」({@link credentialValueReading}),所以新加的一位上的明文在带记号的行里也被补封(只在 M28 的窗内;窗外加位要另起迁移)。
|
|
274
282
|
*/
|
|
275
283
|
export declare const CHECKPOINT_CTX_CREDENTIAL_SLOTS: readonly [{
|
|
276
284
|
readonly path: readonly ["mcpServers", "*", "transport", "headers"];
|
|
277
285
|
readonly holds: "map";
|
|
286
|
+
readonly since: 1;
|
|
278
287
|
}, {
|
|
279
288
|
readonly path: readonly ["mcpServers", "*", "transport", "env"];
|
|
280
289
|
readonly holds: "map";
|
|
290
|
+
readonly since: 1;
|
|
281
291
|
}, {
|
|
282
292
|
readonly path: readonly ["a2aPeers", "*", "headers"];
|
|
283
293
|
readonly holds: "map";
|
|
294
|
+
readonly since: 1;
|
|
284
295
|
}, {
|
|
285
296
|
readonly path: readonly ["settings", "env"];
|
|
286
297
|
readonly holds: "map";
|
|
298
|
+
readonly since: 1;
|
|
287
299
|
}, {
|
|
288
300
|
readonly path: readonly ["settings", "webSearch", "apiKey"];
|
|
289
301
|
readonly holds: "value";
|
|
302
|
+
readonly since: 1;
|
|
290
303
|
}, {
|
|
291
304
|
readonly path: readonly ["settings", "hooks", "*", "*", "hooks", "*", "headers"];
|
|
292
305
|
readonly holds: "map";
|
|
306
|
+
readonly since: 1;
|
|
307
|
+
}, {
|
|
308
|
+
readonly path: readonly ["settings", "hooks", "*", "*", "hooks", "*", "plugin", "options"];
|
|
309
|
+
readonly holds: "map";
|
|
310
|
+
readonly since: 2;
|
|
293
311
|
}];
|
|
312
|
+
/** 本版闭集的代数 = 表里最大的 `since`(读者认得的最新一代)。落盘形的 `credentialSlotGeneration` 不大于它;大于它的行是更新的写者带着本版不认识的位写下的。 */
|
|
313
|
+
export declare const CHECKPOINT_CTX_CREDENTIAL_GENERATION: number;
|
|
294
314
|
/** 开不开 / 封不了的成因(闭集):`no_key_store` = 这台副本没有封签器(没有保管店);`key_not_held` = 封它的那把钥匙不在这台副本的保管店里
|
|
295
315
|
* (多副本不共享 `<数据根>/sealed-key/`,或保管目录被换过);`unopenable` = 钥匙在、开不开(密文坏 / 不是这一行封的 / 不是停驻行信封);
|
|
296
316
|
* `plaintext` = 凭据位上是明文(更早版本的写者);`unrecognized_seal` = 带 `sealed` 键却不是本闭集的封签形(含将来的 `alg`)。 */
|
|
@@ -312,6 +332,8 @@ export type StoredCheckpointCtx = Omit<CheckpointCtx, "body"> & {
|
|
|
312
332
|
readonly [key: string]: unknown;
|
|
313
333
|
};
|
|
314
334
|
readonly credentialSeal?: typeof CHECKPOINT_CTX_SEAL_ALG;
|
|
335
|
+
/** 这一行的写者封过的闭集代数(读法记号的另一半;缺席 + 带 `credentialSeal` = 7.134.0 的写者 = 第 1 代)。 */
|
|
336
|
+
readonly credentialSlotGeneration?: number;
|
|
315
337
|
};
|
|
316
338
|
declare const sealedCheckpointCtxBrand: unique symbol;
|
|
317
339
|
/**
|
|
@@ -323,7 +345,7 @@ export type SealedCheckpointCtx = StoredCheckpointCtx & {
|
|
|
323
345
|
readonly [sealedCheckpointCtxBrand]: true;
|
|
324
346
|
};
|
|
325
347
|
/** 装配期拒启的那一句(`createHttpServer` 与起服第 6 段同调;一句、一个出口)。 */
|
|
326
|
-
export declare const CHECKPOINT_CTX_SEALING_REQUIRED = "a durable checkpoint store is wired but checkpointCtxSealing is not: suspended tasks keep the request's credentials (MCP / A2A headers and env values, settings.env, settings.webSearch.apiKey, http hook headers) in their resume context, and they are stored sealed or not at all \u2014 give the service a sealed-key store for them (this service builds it under <data root>/sealed-key/checkpoint-ctx-keys/ at boot; a failure there is the earlier checkpoint_ctx_sealing_unavailable warning \u2014 make that directory creatable and chmod-able by the service, or repair or remove a key file there whose public and private halves do not belong together), or, when embedding, pass checkpointCtxSealing: await ensureCheckpointCtxSealing(sealedKeyDir); refusing to start rather than write credentials in plaintext";
|
|
348
|
+
export declare const CHECKPOINT_CTX_SEALING_REQUIRED = "a durable checkpoint store is wired but checkpointCtxSealing is not: suspended tasks keep the request's credentials (MCP / A2A headers and env values, settings.env, settings.webSearch.apiKey, http hook headers, command hook plugin options) in their resume context, and they are stored sealed or not at all \u2014 give the service a sealed-key store for them (this service builds it under <data root>/sealed-key/checkpoint-ctx-keys/ at boot; a failure there is the earlier checkpoint_ctx_sealing_unavailable warning \u2014 make that directory creatable and chmod-able by the service, or repair or remove a key file there whose public and private halves do not belong together), or, when embedding, pass checkpointCtxSealing: await ensureCheckpointCtxSealing(sealedKeyDir); refusing to start rather than write credentials in plaintext";
|
|
327
349
|
/** 封签形的判官(恰三键、三值皆串、`alg` 是本闭集那一个词)。 */
|
|
328
350
|
export declare function isSealedCheckpointValue(v: unknown): v is SealedCheckpointValue;
|
|
329
351
|
/**
|
|
@@ -343,7 +365,7 @@ export type OpenedCheckpointCtx = {
|
|
|
343
365
|
};
|
|
344
366
|
/**
|
|
345
367
|
* **开口**(读的一侧唯一的一只;唯一调用方 = 续跑上下文读口 `readResumeCtx`):落盘形 ⇒ 开封形。`opener` 缺席 = 这台副本没有保管店(体里有封签就
|
|
346
|
-
* `no_key_store`;没有凭据的行照常开)
|
|
368
|
+
* `no_key_store`;没有凭据的行照常开)。判词见本段头注与 {@link credentialValueReading}。
|
|
347
369
|
*/
|
|
348
370
|
export declare function openCheckpointCtx(stored: StoredCheckpointCtx, opener: CheckpointCtxOpener | undefined, sessionId: string): OpenedCheckpointCtx;
|
|
349
371
|
/**
|
|
@@ -354,9 +376,13 @@ export declare function openCheckpointCtx(stored: StoredCheckpointCtx, opener: C
|
|
|
354
376
|
export declare function sealedCredentialFieldOf(stored: unknown): string | undefined;
|
|
355
377
|
/**
|
|
356
378
|
* 🔴 **一次性迁移 M28 的行改写**(窗与删法见 `plugins/one-time-migrations.ts` 登记表 M28;编排 = `checkpoint-ctx-seal-m28.ts`):一行存量 ctx
|
|
357
|
-
* (持久化 JSON,不信型面)
|
|
358
|
-
* 与写侧 {@link sealCheckpointCtx}
|
|
359
|
-
*
|
|
379
|
+
* (持久化 JSON,不信型面)凭据位上**读口会答 `plaintext` 的每一个值**({@link credentialValueReading},与开口同一只判词)用同一只封口封好、盖记号 ——
|
|
380
|
+
* 与写侧 {@link sealCheckpointCtx} 同一条规则。两种存量行落在这一条里:
|
|
381
|
+
* · 没有读法记号的行(7.134.0 之前的写者)—— 每一个值都是 `plaintext`(含调用方原样送来的封签形对象)⇒ 全封;
|
|
382
|
+
* · 带当前记号、而某一位比行封过的代数新的行(7.134.0 的写者封第 1 代,没封第 2 代的 `plugin.options`)—— 那一位上的值不论长什么样都是明文 ⇒ 封
|
|
383
|
+
* (恰好长成封签形的选项字典按字典容器整只封,开出来还是那只字典);行封过的那一代里的封签不动。改写后的行盖「带值的位最新的那一代」(与封口同一条)。
|
|
384
|
+
* 读口会答 `seal` / `unrecognized_seal` 的值不动(认不得的留给读口拒);一个值都没封 ⇒ `undefined`(不写:第二跑零命中;记号认不得的行因此一个字节不动);
|
|
385
|
+
* 体不是对象 ⇒ `undefined`(读口自己的形判接住)。其余位(另两只记号、写者版本、非凭据字段)原样。
|
|
360
386
|
*/
|
|
361
387
|
export declare function sealStoredCheckpointCtxM28(stored: object, sealer: CheckpointCtxSealer, sessionId: string): {
|
|
362
388
|
readonly ctx: SealedCheckpointCtx;
|