@sema-agent/server 7.134.0 → 7.136.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 +197 -1
- package/USAGE.md +147 -42
- package/deploy/sema-up/README.md +1 -1
- package/deploy/sema-up/chart/templates/NOTES.txt +1 -1
- package/deploy/sema-up/chart/values.yaml +1 -1
- 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 +122 -154
- package/dist/approval-card.js +50 -51
- package/dist/approval-content-kind.d.ts +23 -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 +35 -6
- package/dist/auth-bridge.js +20 -3
- 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/budget-tracing.d.ts +1 -2
- package/dist/boot/budget-tracing.js +2 -2
- 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/org-memory.js +1 -1
- 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 +36 -29
- package/dist/boot/runner-deps.d.ts +11 -11
- package/dist/boot/runner-deps.js +7 -4
- 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-04-stores.d.ts +1 -1
- package/dist/boot/stage-05-execution-env.d.ts +1 -1
- package/dist/boot/stage-05-execution-env.js +4 -4
- package/dist/boot/stage-06-runners.d.ts +1 -1
- package/dist/boot/stage-06-runners.js +0 -2
- package/dist/boot/stage-07-capability-layer.d.ts +1 -1
- package/dist/boot/stage-08-reapers.d.ts +1 -1
- package/dist/boot/stage-09-leader.d.ts +1 -1
- package/dist/boot/stage-10-http-server.d.ts +1 -1
- package/dist/boot/stores.js +4 -4
- package/dist/boot/web-admin.d.ts +17 -17
- package/dist/boot/web-admin.js +15 -27
- package/dist/boot/workflow-orchestration.js +2 -9
- package/dist/brain.d.ts +11 -11
- package/dist/brain.js +12 -3
- package/dist/budget.d.ts +7 -7
- package/dist/budget.js +4 -0
- 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 +11 -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 +29 -32
- package/dist/capability-facts.js +17 -21
- package/dist/center-config-tier.d.ts +1 -1
- package/dist/center-credential.d.ts +22 -8
- package/dist/center-credential.js +18 -3
- 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-catalog.js +12 -10
- package/dist/config-d-migration.js +1 -1
- package/dist/config-invariants.d.ts +5 -5
- package/dist/config-invariants.js +11 -2
- package/dist/config-lkg.d.ts +1 -39
- package/dist/config-lkg.js +1 -83
- package/dist/config-provider.d.ts +13 -13
- package/dist/config-provider.js +2 -1
- package/dist/config-types.d.ts +95 -87
- package/dist/config.d.ts +26 -24
- package/dist/config.js +38 -18
- 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/elicitation.d.ts +8 -7
- package/dist/elicitation.js +9 -8
- 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 +25 -11
- package/dist/file-history-disclosure.js +25 -14
- 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 +45 -14
- package/dist/fleet-client.js +24 -4
- package/dist/fleet-lease.d.ts +23 -19
- package/dist/fleet-lease.js +31 -23
- package/dist/governance-http-status.d.ts +2 -2
- package/dist/hooks/hook-llm.d.ts +7 -7
- package/dist/hooks/hook-llm.js +14 -8
- package/dist/hooks/hook-runner.d.ts +58 -31
- package/dist/hooks/hook-runner.js +37 -19
- 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 +62 -17
- package/dist/http/checkpoint-ctx.js +78 -35
- package/dist/http/dispatch.d.ts +3 -3
- package/dist/http/dispatch.js +9 -9
- 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 +9 -23
- package/dist/http/resume-ctx-read.js +2 -3
- 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 -7
- package/dist/http/routes/approvals-assistant.js +101 -26
- 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 +23 -11
- package/dist/http/routes/session-sync.d.ts +1 -1
- package/dist/http/routes/session-sync.js +97 -46
- package/dist/http/routes/sessions-list.js +1 -1
- package/dist/http/routes/sessions.js +43 -53
- 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 +33 -24
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- 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-gap.d.ts +49 -4
- package/dist/model-route-gap.js +34 -1
- 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/object-store-buckets.d.ts +13 -0
- package/dist/object-store-buckets.js +3 -0
- 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 +17 -13
- package/dist/observability/fail-open.js +17 -13
- package/dist/observability/metrics.d.ts +3 -3
- package/dist/observability/metrics.js +1 -1
- package/dist/observability/principal-context.d.ts +4 -1
- package/dist/observability/principal-context.js +6 -1
- 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 +20 -18
- package/dist/parked-decide.js +31 -11
- package/dist/parked-revive-surface.d.ts +7 -7
- package/dist/parked-revive-surface.js +2 -3
- package/dist/peer-directory.d.ts +5 -4
- package/dist/peer-directory.js +6 -6
- 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 +42 -15
- package/dist/plugins/approval-ask-store-sql.js +21 -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/blob-backend.js +2 -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 +130 -0
- package/dist/plugins/checkpoint-index-columns.js +90 -0
- package/dist/plugins/checkpoint-store-sql.d.ts +71 -69
- package/dist/plugins/checkpoint-store-sql.js +109 -127
- 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 +15 -7
- package/dist/plugins/file-history-store-sql.js +55 -36
- 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 +7 -7
- 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 +73 -54
- package/dist/plugins/one-time-migrations.js +131 -134
- 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 +26 -13
- package/dist/plugins/remote-env-k8s.js +24 -7
- 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/s3-answer.d.ts +15 -0
- package/dist/plugins/s3-answer.js +5 -0
- 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/snapshot-bucket-presence.d.ts +39 -4
- package/dist/plugins/snapshot-bucket-presence.js +35 -7
- package/dist/plugins/sql-driver.d.ts +8 -8
- package/dist/plugins/sql-errors.d.ts +40 -1
- package/dist/plugins/sql-errors.js +49 -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/store-fault.d.ts +4 -0
- package/dist/plugins/store-fault.js +8 -0
- 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 +10 -3
- 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 +20 -5
- 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-declaration-refusal.d.ts +94 -0
- package/dist/request-declaration-refusal.js +78 -0
- package/dist/request-image-urls.d.ts +6 -0
- package/dist/request-image-urls.js +27 -0
- package/dist/request-key-closure.d.ts +6 -1
- package/dist/request-key-closure.js +5 -2
- 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-caps-resolver.js +1 -1
- package/dist/runtime-governance.d.ts +9 -9
- package/dist/sandbox-pkg-source.d.ts +17 -12
- package/dist/sandbox-pkg-source.js +14 -9
- package/dist/sealed-key.d.ts +22 -3
- package/dist/sealed-key.js +47 -4
- 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 +65 -37
- package/dist/session-incarnation.js +30 -12
- 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-row.d.ts +3 -17
- package/dist/session-row.js +4 -0
- package/dist/session-sync-kernel.d.ts +4 -4
- package/dist/session-sync.d.ts +61 -6
- package/dist/session-sync.js +55 -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 +52 -79
- package/dist/task-a2a.js +224 -62
- package/dist/task-cwd.d.ts +7 -88
- package/dist/task-cwd.js +2 -15
- package/dist/task-mcp.d.ts +13 -17
- package/dist/task-mcp.js +29 -49
- 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 +166 -207
- package/dist/tool-approval.js +61 -61
- package/dist/tool-rule-names.d.ts +2 -2
- package/dist/trace/core-keyset-guard.d.ts +13 -8
- 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 +69 -67
- 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 +61 -31
- package/dist/trace/redact.js +394 -153
- package/dist/trace/self-minted-wire.d.ts +302 -14
- package/dist/trace/self-minted-wire.js +87 -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-refusal.d.ts +52 -0
- package/dist/url-credential-refusal.js +14 -0
- package/dist/url-refusal.d.ts +16 -3
- package/dist/url-refusal.js +15 -2
- 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 +32 -3
- package/dist/workspace-space.js +26 -0
- package/dist/write-protection.d.ts +2 -2
- package/package.json +5 -3
- package/scripts/drain-check-local.mjs +4 -2
- package/scripts/drain-check.mysql.sql +6 -2
- package/scripts/drain-check.pg.sql +6 -2
- package/skills/loop.md +1 -1
- package/skills/schedule.md +1 -1
- package/wire-changes/server@7.104.0.json +134 -0
- package/wire-changes/server@7.105.0.json +53 -0
- package/wire-changes/server@7.106.0.json +475 -0
- package/wire-changes/server@7.107.0.json +64 -0
- package/wire-changes/server@7.108.0.json +153 -0
- package/wire-changes/server@7.109.0.json +46 -0
- package/wire-changes/server@7.110.0.json +90 -0
- package/wire-changes/server@7.111.0.json +86 -0
- package/wire-changes/server@7.112.0.json +60 -0
- package/wire-changes/server@7.113.0.json +26 -0
- package/wire-changes/server@7.114.0.json +26 -0
- package/wire-changes/server@7.115.0.json +97 -0
- package/wire-changes/server@7.116.0.json +218 -0
- package/wire-changes/server@7.116.1.json +26 -0
- package/wire-changes/server@7.117.0.json +65 -0
- package/wire-changes/server@7.118.0.json +129 -0
- package/wire-changes/server@7.119.0.json +65 -0
- package/wire-changes/server@7.120.0.json +89 -0
- package/wire-changes/server@7.121.0.json +219 -0
- package/wire-changes/server@7.122.0.json +54 -0
- package/wire-changes/server@7.123.0.json +26 -0
- package/wire-changes/server@7.124.0.json +336 -0
- package/wire-changes/server@7.124.1.json +26 -0
- package/wire-changes/server@7.125.0.json +111 -0
- package/wire-changes/server@7.126.0.json +285 -0
- package/wire-changes/server@7.127.0.json +77 -0
- package/wire-changes/server@7.127.1.json +26 -0
- package/wire-changes/server@7.127.2.json +53 -0
- package/wire-changes/server@7.128.0.json +26 -0
- package/wire-changes/server@7.129.0.json +106 -0
- package/wire-changes/server@7.129.1.json +26 -0
- package/wire-changes/server@7.130.0.json +26 -0
- package/wire-changes/server@7.131.0.json +118 -0
- package/wire-changes/server@7.132.0.json +226 -0
- package/wire-changes/server@7.133.0.json +1155 -0
- package/wire-changes/server@7.134.0.json +107 -0
- package/wire-changes/server@7.135.0.json +174 -0
- package/wire-changes/server@7.136.0.json +448 -0
- 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
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { httpUrlFlaws } from "@sema-agent/settings-schema";
|
|
2
|
-
import { buildHttpUrlRefusal } from "./url-refusal.js";
|
|
1
|
+
import { findUrlCredential, httpUrlFlaws } from "@sema-agent/settings-schema";
|
|
2
|
+
import { buildHttpUrlRefusal, buildUrlCredentialRefusal } from "./url-refusal.js";
|
|
3
3
|
const GLOBAL_ENV = {
|
|
4
4
|
PIP_INDEX_URL: "https://pypi.org/simple",
|
|
5
5
|
UV_DEFAULT_INDEX: "https://pypi.org/simple",
|
|
@@ -45,14 +45,17 @@ export function derivePkgSourceEnv(profile, custom) {
|
|
|
45
45
|
return { SEMA_PKG_SOURCE: profile };
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
-
export function buildCustomPkgSourceRefusal(envName, raw,
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
export function buildCustomPkgSourceRefusal(envName, raw, problem) {
|
|
49
|
+
const head = problem === "not-http-url" ? buildHttpUrlRefusal(envName, raw, ["not-http-url"]) : buildUrlCredentialRefusal(envName, raw, problem);
|
|
50
|
+
const drop = problem !== "not-http-url" && problem.reason === "url_credential_param" ? `drop the "${problem.name}" parameter` : "drop the userinfo";
|
|
51
|
+
return (`${head} — with SANDBOX_PKG_SOURCE=custom this address is written verbatim into the environment of every sandbox ` +
|
|
52
|
+
`(e2b VM / k8s pod), where any process the model can run reads it back with \`env\`; an address that carries a credential (userinfo, or a query / fragment ` +
|
|
53
|
+
`parameter named like one — the names the service's log redactor treats as credentials), or whose shape cannot be judged ` +
|
|
51
54
|
`credential-free (not http(s)://host[:port][/path], or containing a backslash — the URL standard reads it as "/", package managers do not), would hand ` +
|
|
52
55
|
`the deployment's package-source credential to the model, so the server refuses to start rather than forward or rewrite it. ` +
|
|
53
56
|
`Way out: (1) set ${envName} to the credential-free address and give the package manager its credential through its own channel — a token variable ` +
|
|
54
57
|
`named in the lane's name list (E2B_SANDBOX_ENV / K8S_SANDBOX_ENV; naming it accepts that every process in the sandbox, the model included, can read it) ` +
|
|
55
|
-
`or a credential file baked into the sandbox image; (2) if the source needs no authentication, drop
|
|
58
|
+
`or a credential file baked into the sandbox image; (2) if the source needs no authentication, ${drop}.`);
|
|
56
59
|
}
|
|
57
60
|
export function customPkgSourceFromEnv(env = process.env) {
|
|
58
61
|
const addresses = {
|
|
@@ -68,9 +71,11 @@ export function customPkgSourceFromEnv(env = process.env) {
|
|
|
68
71
|
const [name, raw] = addresses[field];
|
|
69
72
|
if (!raw)
|
|
70
73
|
continue;
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
+
if (raw.includes("\\") || httpUrlFlaws(raw, []).length > 0)
|
|
75
|
+
throw new Error(buildCustomPkgSourceRefusal(name, raw, "not-http-url"));
|
|
76
|
+
const credential = findUrlCredential(raw);
|
|
77
|
+
if (credential !== undefined)
|
|
78
|
+
throw new Error(buildCustomPkgSourceRefusal(name, raw, credential));
|
|
74
79
|
out[field] = raw;
|
|
75
80
|
}
|
|
76
81
|
return out;
|
package/dist/sealed-key.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export interface SealedKeyOpener {
|
|
|
15
15
|
open(ciphertextB64: string, publicKeyId: string): string;
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
18
|
-
*
|
|
18
|
+
* [ref] —— the store's **discovery-safe face**: ONLY the newest public key. This is what the HTTP layer is handed
|
|
19
19
|
* (`ServiceDeps.sealedKeyPublic` → `GET /v1/capabilities` `sealedKey`) — never the whole store — so private-key
|
|
20
20
|
* material, the custody path and the held-id list are structurally unreachable from that layer (not merely
|
|
21
21
|
* "not read"). Built from a live store by {@link buildSealedKeyPublicFace}, which copies out `latest` alone.
|
|
@@ -37,7 +37,7 @@ export interface SealedKeyStore extends SealedKeyOpener, SealedKeyPublicFace {
|
|
|
37
37
|
* reachable through it, whatever the caller later casts it to). Plain data ⇒ `build*`. */
|
|
38
38
|
export declare function buildSealedKeyPublicFace(store: SealedKeyPublicFace): SealedKeyPublicFace;
|
|
39
39
|
/**
|
|
40
|
-
*
|
|
40
|
+
* [ref] —— the `GET /v1/capabilities` `sealedKey` segment: exactly three keys — the algorithm (the pinned v1
|
|
41
41
|
* {@link SEALED_KEY_ALG}, never a hand-copied literal), the id to write into `sealedApiKey.publicKeyId`, and the
|
|
42
42
|
* base64 X25519 public key to `crypto_box_seal` against. `createdAt` is deliberately NOT projected (it answers
|
|
43
43
|
* nothing a sealer needs; the wire keeps to the three keys the contract names).
|
|
@@ -54,6 +54,25 @@ export declare function projectSealedKeyCapability(face: SealedKeyPublicFace | u
|
|
|
54
54
|
/** Default id = fingerprint of the RAW public-key bytes: `exec-<sha256(pk)[0..12) hex>`.
|
|
55
55
|
* Deterministic → regenerating the id from the same key file is stable across boots. */
|
|
56
56
|
export declare function deriveKeyId(publicKeyRaw: Uint8Array): string;
|
|
57
|
+
/** {@link judgeSealedKeyPublicKey} 的拒因(闭集)。 */
|
|
58
|
+
export type SealedKeyPublicKeyFlaw = "non_canonical_base64" | "bad_length" | "small_order";
|
|
59
|
+
/** 公钥判官的拒(类型化;`flaw` 闭集)。公钥是公开材料,句子里点名它无妨;从不带私钥 / 密文。 */
|
|
60
|
+
export declare class SealedKeyPublicKeyRefusedError extends Error {
|
|
61
|
+
readonly flaw: SealedKeyPublicKeyFlaw;
|
|
62
|
+
constructor(flaw: SealedKeyPublicKeyFlaw);
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* **X25519 公钥的唯一判官** —— 保管店装载({@link ensureSealedKeyStore},每份钥匙文件)、向中心登记({@link reportExecutionPublicKey})、
|
|
66
|
+
* 封之前({@link createCheckpointCtxSealing},对着最新那把)三处同读这一只;过了交回原始 32 字节,不过抛 {@link SealedKeyPublicKeyRefusedError}。
|
|
67
|
+
* 1. **规范 base64**:解出来的字节再编码回去必须逐字等于原串 —— 一句话盖住字母表、补齐、填充位三件(一把钥匙只有一种写法);
|
|
68
|
+
* 2. **32 字节**;
|
|
69
|
+
* 3. **不是小阶点**:对 {@link SMALL_ORDER_PROBE_SCALAR} 做 `crypto_scalarmult`,结果全零 ⇔ 小阶(libsodium 此时不交结果、抛 `weak public key`)。
|
|
70
|
+
* 判法取「标量乘结果全零」而不是手抄小阶点表:与 noble 同一判(`x25519.getSharedSecret` 零结果即抛,包侧 `bad_public_key` 读的就是它)、
|
|
71
|
+
* 就是 RFC 7748 §6.1 要求的那一检;非规范编码(p、p+1)与第 255 位置位的写法由 X25519 自己的约化 / 掩位盖住,不必逐个列;
|
|
72
|
+
* 高位别名(第 255 位置位、掩掉后是同一个非小阶点)照收 —— 两边同口径。依赖已在树里(libsodium),不新增一张要人维护的表。
|
|
73
|
+
* 前置:libsodium 已就绪(三处调用方都先等过它);没就绪 ⇒ 当场抛普通错误(不是判决)。
|
|
74
|
+
*/
|
|
75
|
+
export declare function judgeSealedKeyPublicKey(publicKeyB64: string): Uint8Array;
|
|
57
76
|
/**
|
|
58
77
|
* Load every keypair under `dir` (creating dir + ONE fresh keypair when none exist) and return the
|
|
59
78
|
* custody store. Invalid/corrupt files are skipped with a warn (they may be an OLD format or a
|
|
@@ -79,7 +98,7 @@ export type CheckpointCtxKeyStore = SealedKeyStore & {
|
|
|
79
98
|
*/
|
|
80
99
|
export declare function ensureCheckpointCtxSealing(sealedKeyDir: string, logger?: Logger): Promise<CheckpointCtxSealing>;
|
|
81
100
|
/**
|
|
82
|
-
* 停驻行凭据的**封签器**(
|
|
101
|
+
* 停驻行凭据的**封签器**([ref];形与规则的属主 = `http/checkpoint-ctx.ts` 末段「凭据位密封」)—— 从**这一域自己的**保管店派生(生产 = {@link ensureCheckpointCtxSealing};
|
|
83
102
|
* 入参型 {@link CheckpointCtxKeyStore}:模型钥匙那只店进不来),信封是:封进密文的明文是 `JSON.stringify([CHECKPOINT_CTX_SEAL_ALG, sessionId, value])`。
|
|
84
103
|
* · **封**:对着保管店**最新**那把公钥 `crypto_box_seal`(只用公钥);封签记下那把钥匙的 id。
|
|
85
104
|
* · **开**:按封签上的 id **精确**选私钥(保管店的 `open`,不逐把试),再判信封:三元数组、首元是本信封的词、第二元是**这一行的会话 id**,交回第三元(封进去的 JSON 值,任何类型) ——
|
package/dist/sealed-key.js
CHANGED
|
@@ -27,6 +27,37 @@ function b64ToBytes(b64, what) {
|
|
|
27
27
|
throw new Error(`${what}: not valid base64`);
|
|
28
28
|
return new Uint8Array(Buffer.from(b64, "base64"));
|
|
29
29
|
}
|
|
30
|
+
export class SealedKeyPublicKeyRefusedError extends Error {
|
|
31
|
+
flaw;
|
|
32
|
+
constructor(flaw) {
|
|
33
|
+
super(`sealed-key public key refused (${flaw}): ${SEALED_KEY_PUBLIC_KEY_FLAW_TEXT[flaw]}`);
|
|
34
|
+
this.name = "SealedKeyPublicKeyRefusedError";
|
|
35
|
+
this.flaw = flaw;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
const SEALED_KEY_PUBLIC_KEY_FLAW_TEXT = {
|
|
39
|
+
non_canonical_base64: "not the canonical standard-base64 spelling of 32 bytes (alphabet A-Z a-z 0-9 + /, `=` padding, zero padding bits)",
|
|
40
|
+
bad_length: "does not decode to 32 bytes",
|
|
41
|
+
small_order: "an X25519 small-order point — anything sealed against it can be opened without the private key",
|
|
42
|
+
};
|
|
43
|
+
const SMALL_ORDER_PROBE_SCALAR = new Uint8Array(32).fill(7);
|
|
44
|
+
export function judgeSealedKeyPublicKey(publicKeyB64) {
|
|
45
|
+
const sodium = _sodium;
|
|
46
|
+
if (typeof sodium.crypto_scalarmult !== "function")
|
|
47
|
+
throw new Error("judgeSealedKeyPublicKey: libsodium is not initialized — await its ready promise first");
|
|
48
|
+
const bytes = new Uint8Array(Buffer.from(publicKeyB64, "base64"));
|
|
49
|
+
if (Buffer.from(bytes).toString("base64") !== publicKeyB64)
|
|
50
|
+
throw new SealedKeyPublicKeyRefusedError("non_canonical_base64");
|
|
51
|
+
if (bytes.length !== sodium.crypto_box_PUBLICKEYBYTES)
|
|
52
|
+
throw new SealedKeyPublicKeyRefusedError("bad_length");
|
|
53
|
+
try {
|
|
54
|
+
sodium.crypto_scalarmult(SMALL_ORDER_PROBE_SCALAR, bytes);
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
throw new SealedKeyPublicKeyRefusedError("small_order");
|
|
58
|
+
}
|
|
59
|
+
return bytes;
|
|
60
|
+
}
|
|
30
61
|
export async function ensureSealedKeyStore(dir, logger) {
|
|
31
62
|
await _sodium.ready;
|
|
32
63
|
const sodium = _sodium;
|
|
@@ -40,9 +71,9 @@ export async function ensureSealedKeyStore(dir, logger) {
|
|
|
40
71
|
if (raw.alg !== SEALED_KEY_ALG || typeof raw.publicKey !== "string" || typeof raw.privateKey !== "string" || typeof raw.publicKeyId !== "string") {
|
|
41
72
|
throw new Error("missing/unsupported fields");
|
|
42
73
|
}
|
|
43
|
-
const publicKey =
|
|
74
|
+
const publicKey = judgeSealedKeyPublicKey(raw.publicKey);
|
|
44
75
|
const privateKey = b64ToBytes(raw.privateKey, "privateKey");
|
|
45
|
-
if (
|
|
76
|
+
if (privateKey.length !== sodium.crypto_box_SECRETKEYBYTES)
|
|
46
77
|
throw new Error("bad key length");
|
|
47
78
|
if (name !== `${raw.publicKeyId}.json`)
|
|
48
79
|
logger?.warn("sealed_key_filename_drift", { file: name, publicKeyId: raw.publicKeyId, note: "content publicKeyId wins; rename the file to silence this" });
|
|
@@ -53,7 +84,7 @@ export async function ensureSealedKeyStore(dir, logger) {
|
|
|
53
84
|
keys.set(raw.publicKeyId, { publicKey, privateKey, publicKeyB64: raw.publicKey, createdAt: typeof raw.createdAt === "string" ? raw.createdAt : "" });
|
|
54
85
|
}
|
|
55
86
|
catch (err) {
|
|
56
|
-
logger?.warn("sealed_key_file_unreadable", { file: path, errKind: err instanceof Error ? err.name : "unknown", note: "skipped (NOT deleted) — ciphertexts sealed for this key will fail loud per-model" });
|
|
87
|
+
logger?.warn("sealed_key_file_unreadable", { file: path, errKind: err instanceof Error ? err.name : "unknown", ...(err instanceof SealedKeyPublicKeyRefusedError ? { flaw: err.flaw } : {}), note: "skipped (NOT deleted) — ciphertexts sealed for this key will fail loud per-model" });
|
|
57
88
|
}
|
|
58
89
|
}
|
|
59
90
|
if (keys.size === 0) {
|
|
@@ -101,7 +132,7 @@ export function createCheckpointCtxSealing(store) {
|
|
|
101
132
|
if (typeof sodium.crypto_box_seal !== "function")
|
|
102
133
|
throw new Error("createCheckpointCtxSealing: libsodium is not initialized — build the store with ensureSealedKeyStore() first");
|
|
103
134
|
const { publicKeyId } = store.latest;
|
|
104
|
-
const publicKey =
|
|
135
|
+
const publicKey = judgeSealedKeyPublicKey(store.latest.publicKey);
|
|
105
136
|
const sealing = createUncheckedCheckpointCtxSealing(store, publicKeyId, publicKey);
|
|
106
137
|
const probeSession = "sealed-key-self-test";
|
|
107
138
|
let roundTrip;
|
|
@@ -144,6 +175,18 @@ function createUncheckedCheckpointCtxSealing(store, publicKeyId, publicKey) {
|
|
|
144
175
|
}
|
|
145
176
|
export async function reportExecutionPublicKey(opts) {
|
|
146
177
|
const { baseUrl, adminToken, key, notes, logger } = opts;
|
|
178
|
+
await _sodium.ready;
|
|
179
|
+
try {
|
|
180
|
+
judgeSealedKeyPublicKey(key.publicKey);
|
|
181
|
+
}
|
|
182
|
+
catch (err) {
|
|
183
|
+
logger?.warn("sealed_key_public_key_refused", {
|
|
184
|
+
publicKeyId: key.publicKeyId,
|
|
185
|
+
...(err instanceof SealedKeyPublicKeyRefusedError ? { flaw: err.flaw } : { errKind: err instanceof Error ? err.name : "unknown" }),
|
|
186
|
+
note: "this public key is not registered with the center and not printed for manual registration — fix or remove the key file in the sealed-key directory and restart",
|
|
187
|
+
});
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
147
190
|
const manual = (why) => {
|
|
148
191
|
logger?.warn("sealed_key_public_key", {
|
|
149
192
|
publicKeyId: key.publicKeyId,
|
package/dist/security.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { IncomingMessage } from "node:http";
|
|
2
2
|
import { type SessionPlacementRecord, type SessionStore, type SessionTreeEntry } from "@sema-agent/core";
|
|
3
3
|
import type { ServiceConfig } from "./config-types.js";
|
|
4
|
+
import { type DeploymentShapeInput } from "./deployment-shape.js";
|
|
4
5
|
import type { TaskRequestBody } from "./http/wire-types.js";
|
|
5
6
|
import type { StagingHandle } from "./session-sync-kernel.js";
|
|
6
|
-
import type
|
|
7
|
+
import { type SessionFace } from "./session-incarnation.js";
|
|
7
8
|
import type { SessionRowPatch } from "./session-row.js";
|
|
8
9
|
import { type OwnerlessClaim } from "./delegated-session-owner.js";
|
|
9
10
|
/** One row of the session-list projection (CC /resume picker) — the durable session abstraction's enumeration
|
|
@@ -19,7 +20,7 @@ export interface SessionListItem {
|
|
|
19
20
|
/** K-5c (shell §K): the latest run's task_id — the shell's one-hop live-tail re-attach anchor on resume. */
|
|
20
21
|
lastRunId: string | null;
|
|
21
22
|
/** [ref]([ref]/[ref]):the LATEST run's **engine run id**(`TaskResult.runId`)when known —— OMIT-when-absent,
|
|
22
|
-
* 恒不铸 null。所有 lister(SQL 双生、local 会话店 —— 它的 run 店是必填位)从 latest run 的 `result` JSON 提取(终局与 park 时写、认领续跑即清空 ——
|
|
23
|
+
* 恒不铸 null。所有 lister(SQL 双生、local 会话店 —— 它的 run 店是必填位)从 latest run 的 `result` JSON 提取(终局与 park 时写、认领续跑即清空 —— [ref]
|
|
23
24
|
* ⇒ 在跑 latest 键诚实缺席)。
|
|
24
25
|
* 读法一致:缺席 = 「此行无已知 engine runId」,禁读成其它含义。⚠️ 与 `lastRunId`(= latest run 的 **task_id**)
|
|
25
26
|
* 是两条身份轴,命名对齐 core `SessionStoreSummary.lastTaskRunId`。wire:additive 键零投影透传
|
|
@@ -55,7 +56,7 @@ export declare function isDestructiveSessionWrite(method: string, url: string):
|
|
|
55
56
|
declare const principalBrand: unique symbol;
|
|
56
57
|
declare const durableOwnerKeyBrand: unique symbol;
|
|
57
58
|
/**
|
|
58
|
-
* 🔴 **两个 owner 不是同一个东西**(
|
|
59
|
+
* 🔴 **两个 owner 不是同一个东西**([ref] RH-3,类型事实):
|
|
59
60
|
* · {@link Principal} —— **这次请求**验过的调用方身份。铸点闭集:`http/principal-gate.ts` 的 `gatedPrincipal`(验身份的那一只),以及属主存取器
|
|
60
61
|
* (`http/owner-access.ts`)里一只「上游已验」的适配口(调用方身份经一只纯串结构转手过来的腿 —— 第二期随那只结构带品牌而删);
|
|
61
62
|
* · {@link DurableOwnerKey} —— **行上 / 存储键里**落下的属主(run 行、会话行的 `owner` 列)。铸点闭集:属主存取器读行处与 {@link sessionOwnerCellOf}。
|
|
@@ -73,7 +74,7 @@ export declare function mintPrincipal(verified: string): Principal;
|
|
|
73
74
|
/** {@link DurableOwnerKey} 的铸造口(只在铸点闭集里调,见上)。 */
|
|
74
75
|
export declare function mintDurableOwnerKey(persisted: string): DurableOwnerKey;
|
|
75
76
|
/**
|
|
76
|
-
* 会话行属主门读的那一格(
|
|
77
|
+
* 会话行属主门读的那一格([ref]):有主的行只有属主;**无主的行**另带「它是不是委派子代的 placed 行」(店的 `placementOf` 答,{@link sessionOwnerCellOf} 读;
|
|
77
78
|
* 不实现 placement 的店没有 placed 行)。`placed` 只在无主时存在 —— 有主的行属主门不看它。
|
|
78
79
|
*/
|
|
79
80
|
export type SessionOwnerCell = {
|
|
@@ -89,7 +90,7 @@ export interface SessionCaller {
|
|
|
89
90
|
readonly fleet: boolean;
|
|
90
91
|
}
|
|
91
92
|
/**
|
|
92
|
-
* 🔴 **会话行属主门上「无主行放行」臂的唯一判据**(
|
|
93
|
+
* 🔴 **会话行属主门上「无主行放行」臂的唯一判据**([ref] 读面律;会话面谓词 `sessionOwnerReadable`、fork / 删除 / 同步族的存量互认臂 {@link legacyUnownedSessionOk}、
|
|
93
94
|
* 审批豁免面、notify 面的无主臂都经它,不各写一份):
|
|
94
95
|
* · 无主的**普通**会话行 ⇒ 成立(各臂照它自己的其余条件);
|
|
95
96
|
* · 无主的 **placed** 行(委派子代:属主 = 委派树根的属主,`delegated-session-owner.ts`)⇒ 只对 **fleet 调用方**成立({@link SessionCaller}:dev-open 部署上的任何调用方,
|
|
@@ -114,7 +115,7 @@ export declare const LEGACY_UNOWNED_AMNESTY_TENANT = "default";
|
|
|
114
115
|
* fleet 面与 run 读面天然连续,面1/面2 零施工)。
|
|
115
116
|
*
|
|
116
117
|
* 🔒 **三条件缺一不放行**(与第一臂同源,不是兼容臂):
|
|
117
|
-
* ① 单机形
|
|
118
|
+
* ① 单机形(部署形表行 `multiTenant` 不成立)—— 多租部署本臂**死路**(header 必到、键必具名);
|
|
118
119
|
* ② 存量行恰为无主 `owner === null`、且不是委派子代的 placed 行(无主臂的唯一判据 {@link ownerlessRowOpen})—— 任何具名 owner 的行不受影响;
|
|
119
120
|
* ③ 调用方恰为 `default` 主 —— 非 default 的具名主对无主行仍走原门(404 / deleted:false)。
|
|
120
121
|
* 反向风险有界:①限定的单机形本就单用户,把无主行判给 default 主不产生跨租外泄。
|
|
@@ -137,11 +138,11 @@ export declare const LEGACY_UNOWNED_AMNESTY_TENANT = "default";
|
|
|
137
138
|
* 它们存在当初那个属主的键下,那个 principal 的 run 照读照生效(7.119.0 前 local 后端重启即把属主忘掉,于是那些规则
|
|
138
139
|
* 在跑、却读不到也删不掉 —— 修在属主落盘,不在放宽本门)。放宽它等于制造一条 fail-open,不在本臂辖域。
|
|
139
140
|
*
|
|
140
|
-
* @param
|
|
141
|
+
* @param deployment 部署形(条件①;读表行 `multiTenant`)
|
|
141
142
|
* @param caller 调用方(条件③ 读它验过的主体;fleet-wide 面不经本臂)
|
|
142
|
-
* @param cell 存量行那一格(条件②:无主,且经无主臂的唯一判据 {@link ownerlessRowOpen} —— 无主的委派子代 placed 行不在本臂,
|
|
143
|
+
* @param cell 存量行那一格(条件②:无主,且经无主臂的唯一判据 {@link ownerlessRowOpen} —— 无主的委派子代 placed 行不在本臂,[ref])
|
|
143
144
|
*/
|
|
144
|
-
export declare function legacyUnownedSessionOk(
|
|
145
|
+
export declare function legacyUnownedSessionOk(deployment: DeploymentShapeInput<"principal">, caller: SessionCaller, cell: SessionOwnerCell): boolean;
|
|
145
146
|
/**
|
|
146
147
|
* {@link legacyUnownedSessionOk} 的**条件①③**半支 —— 只判「这个部署形 × 这个调用方」是否落在窄臂辖域内。
|
|
147
148
|
*
|
|
@@ -150,14 +151,18 @@ export declare function legacyUnownedSessionOk(requirePrincipal: boolean, caller
|
|
|
150
151
|
* (`listSessions({ owner, includeUnowned })` 的 `includeUnowned` 位即本函数的返回值)。
|
|
151
152
|
* 单实体读/写点(fork/delete/同步族/workspace)**一律**用三条件齐的 {@link legacyUnownedSessionOk},不要用本函数。
|
|
152
153
|
*/
|
|
153
|
-
export declare function legacyUnownedAmnestyOpen(
|
|
154
|
+
export declare function legacyUnownedAmnestyOpen(deployment: DeploymentShapeInput<"principal">, gateOwner: string | null): boolean;
|
|
155
|
+
/**
|
|
156
|
+
* 本仓会话店的面 = core `SessionStore` + 本仓的行面(登记 / 列表 / 换装 / 同步……)。
|
|
157
|
+
* 🔴 **按 id 读一行只有一只**:core 的 `headOf(id)`(`{ owner, incarnation, leafId }`,同一行一次读;core 7.55.0 [ref] S2)。
|
|
158
|
+
* 属主 = `headOf(id)?.owner`、住客 = 头的 `incarnation`(比较用 core `compareOccupants`,拿令牌去写用 `sessionFaceOfHead`)、叶子 = 头的 `leafId`
|
|
159
|
+
* —— 此前本面另有五只按 id 读(`ownerOf` / `incarnationOf` / `sessionFaceOf` / `getHead` / `getLeafId`),全部退役;规则在 `src/session-incarnation.ts` 头注,
|
|
160
|
+
* 「店有没有这只读」只判 `headReadOf` 一处。
|
|
161
|
+
*/
|
|
154
162
|
export type OwnerAwareSessionStore = SessionStore & {
|
|
155
|
-
|
|
156
|
-
/** S-790 / S-506([ref] §2)—— 属主 + **化身**一次读(`undefined` = 无此会话;行在而化身为空 ⇒ 响亮拒)。规则的唯一属主
|
|
157
|
-
* 是 `src/session-incarnation.ts`。只关心属主的消费点照旧读 `ownerOf`;判「这还是不是同一位住客」的读它。 */
|
|
158
|
-
sessionFaceOf?: SessionFaceReader;
|
|
163
|
+
/** 属主登记(core `SessionStore.register` 的契约:对没有行的 id 建行并记下属主,首写赢;对已有的行什么都不做)。读回走 `headOf`。 */
|
|
159
164
|
register?: (sessionId: string, owner: string | null) => Promise<void>;
|
|
160
|
-
/**
|
|
165
|
+
/** [ref] 委派继承律的**认领口** —— 只在记录委派树的店上(SQL 两店,只命中 placed 行;local 店没有):判断时读到的那一位住客仍是无主的 placed 行 ⇒ 写 `owner`,
|
|
161
166
|
* 返回是否写成(只 CAS 子行自己)。唯一调用方 = 停驻挂点的 `settleDelegatedOwner`(`delegated-session-owner.ts`;M23 走同一句 SQL);规则写在那个模块。 */
|
|
162
167
|
claimOwnerless?: OwnerlessClaim;
|
|
163
168
|
/** [ref] placed 分区的元组读口(店的既有读口,一行 PK 读;`undefined` = 普通会话或无此行)。店不交它 = 不实现 placement = 没有 placed 行(local 店)。两个读者:
|
|
@@ -184,23 +189,15 @@ export type OwnerAwareSessionStore = SessionStore & {
|
|
|
184
189
|
sessionSummaryOf?: (sessionId: string) => Promise<SessionListItem | undefined>;
|
|
185
190
|
/** The session row's writable bits (`title` / `pinned`) — the ONLY writer of a user-set title or pin (`title: null` clears it back
|
|
186
191
|
* to the automatic title; the auto-titler's `setTitleIfNull` fills a NULL title only; the law of the two writers is written in
|
|
187
|
-
* `session-row.ts`). **Written on the occupant the caller verified, and only on it**: `face` is the
|
|
192
|
+
* `session-row.ts`). **Written on the occupant the caller verified, and only on it**: `face` is the live occupant (`sessionFaceOfHead` over the `headOf` read)
|
|
188
193
|
* the caller's gate judged; the write and the read-back are both conditioned on that occupant's incarnation (the same law as
|
|
189
194
|
* the parked decide leg's two reads, `session-incarnation.ts`). Answers that occupant's list row after the write
|
|
190
195
|
* ({@link sessionSummaryOf}'s projection); `undefined` = no list row for that occupant (deleted, re-registered by anyone in the
|
|
191
196
|
* meantime, or a placed session) — nothing was written. A failed write throws. */
|
|
192
197
|
patchSessionMeta?: (sessionId: string, patch: SessionRowPatch, face: SessionFace) => Promise<SessionListItem | undefined>;
|
|
193
|
-
/** E17 — fork a session's whole history to a NEW session
|
|
198
|
+
/** E17 — fork a session's whole history to a NEW session; null if the source is unknown. The fork row records `owner` when it is a
|
|
199
|
+
* string, else (`null`) the SOURCE row's owner — a copy of an owned history is never anonymous (core `SessionStore.fork`, 7.55.0 S2). */
|
|
194
200
|
fork?: (sourceId: string, owner: string | null) => Promise<string | null>;
|
|
195
|
-
/** E18 — the session's current leaf `SessionTreeEntry.id` (a cache-bypassing single read), so the resume-at
|
|
196
|
-
* turn-capture can pair it with the turn's message eventId. null when the session has no leaf / does not exist. */
|
|
197
|
-
getLeafId?: (sessionId: string) => Promise<string | null>;
|
|
198
|
-
/** [ref] 六轮复审:owner+leafId 单行原子快照(SSE watch 探针租户围栏读;两独立读在 delete/reclaim
|
|
199
|
-
* 缝里可拼出混世代组合)。undefined=无此会话。 */
|
|
200
|
-
getHead?: (sessionId: string) => Promise<{
|
|
201
|
-
owner: string | null;
|
|
202
|
-
leafId: string | null;
|
|
203
|
-
} | undefined>;
|
|
204
201
|
/** E21 — purge a session's conversation history (session_meta/session_event); idempotent (false if absent).
|
|
205
202
|
* `owner` is the single-DB-fleet null-safe SQL owner guard on `session_meta.owner` (defense-in-depth — the
|
|
206
203
|
* route already owner-gates; this pins the DELETE to the authenticated tenant so even a buggy gate can't purge
|
package/dist/security.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { uuidv7, PROJECT_ID_REGEX } from "@sema-agent/core";
|
|
2
|
+
import { DEPLOYMENT_SHAPE_PREDICATES } from "./deployment-shape.js";
|
|
3
|
+
import { headReadOf } from "./session-incarnation.js";
|
|
2
4
|
import { memoryScopeFor } from "./memory-scope.js";
|
|
3
5
|
import { verifyPrincipalJwt } from "./principal-jwt.js";
|
|
4
6
|
import { fieldConflictFacts } from "./field-conflict.js";
|
|
@@ -30,11 +32,11 @@ export async function sessionOwnerCellOf(store, sessionId, owner) {
|
|
|
30
32
|
return { owner: null, placed: placementOf !== undefined && (await placementOf.call(store, sessionId)) !== undefined };
|
|
31
33
|
}
|
|
32
34
|
export const LEGACY_UNOWNED_AMNESTY_TENANT = "default";
|
|
33
|
-
export function legacyUnownedSessionOk(
|
|
34
|
-
return legacyUnownedAmnestyOpen(
|
|
35
|
+
export function legacyUnownedSessionOk(deployment, caller, cell) {
|
|
36
|
+
return legacyUnownedAmnestyOpen(deployment, caller.principal ?? null) && ownerlessRowOpen(cell, caller);
|
|
35
37
|
}
|
|
36
|
-
export function legacyUnownedAmnestyOpen(
|
|
37
|
-
return !
|
|
38
|
+
export function legacyUnownedAmnestyOpen(deployment, gateOwner) {
|
|
39
|
+
return !DEPLOYMENT_SHAPE_PREDICATES.multiTenant.holds(deployment) && gateOwner === LEGACY_UNOWNED_AMNESTY_TENANT;
|
|
38
40
|
}
|
|
39
41
|
const UUIDV7_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/;
|
|
40
42
|
export function isUuidV7(s) {
|
|
@@ -80,20 +82,21 @@ export function createAuthorizer(config, sessionStore) {
|
|
|
80
82
|
projectId = body.projectId.toLowerCase();
|
|
81
83
|
}
|
|
82
84
|
const requireExisting = body.requireExistingSession === true;
|
|
83
|
-
const
|
|
85
|
+
const headOf = headReadOf(sessionStore);
|
|
86
|
+
const readOwner = headOf === undefined ? undefined : async (id) => (await headOf(id))?.owner;
|
|
84
87
|
const register = sessionStore.register?.bind(sessionStore);
|
|
85
88
|
const requested = typeof body.sessionId === "string" && body.sessionId ? body.sessionId : undefined;
|
|
86
89
|
let sessionId;
|
|
87
90
|
if (requested) {
|
|
88
|
-
if (
|
|
89
|
-
let owner = await
|
|
91
|
+
if (readOwner) {
|
|
92
|
+
let owner = await readOwner(requested);
|
|
90
93
|
if (owner === undefined) {
|
|
91
94
|
if (requireExisting) {
|
|
92
95
|
throw createCodedHttpError(404, "resume.session_not_found", "requireExistingSession: session does not exist (resume.session_not_found)");
|
|
93
96
|
}
|
|
94
97
|
if (register) {
|
|
95
98
|
await register(requested, principal ?? null);
|
|
96
|
-
owner = await
|
|
99
|
+
owner = await readOwner(requested);
|
|
97
100
|
}
|
|
98
101
|
else if (config.requirePrincipal) {
|
|
99
102
|
throw new HttpError(403, "cannot claim a caller-supplied sessionId on a multi-tenant deployment: this worker's session store cannot record session ownership, so the id would stay unowned and the next caller could attach to it. Configure a durable session backend (SESSION_BACKEND), or omit sessionId to start a new session.");
|
|
@@ -101,7 +104,7 @@ export function createAuthorizer(config, sessionStore) {
|
|
|
101
104
|
}
|
|
102
105
|
else if (owner === null && principal !== undefined && !config.requirePrincipal && register) {
|
|
103
106
|
await register(requested, principal);
|
|
104
|
-
owner = await
|
|
107
|
+
owner = await readOwner(requested);
|
|
105
108
|
}
|
|
106
109
|
const legacyShellOwner = !config.requirePrincipal && owner === "anon:shell-live" && principal === undefined;
|
|
107
110
|
if (!legacyShellOwner && owner != null && owner !== principal) {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* 宿主子进程 env 的**唯一组合点**(7.103.0 起,
|
|
2
|
+
* 宿主子进程 env 的**唯一组合点**(7.103.0 起,[ref] 残余按类收口)+ 本进程**自有凭据名的唯一声明点**(7.129.0 起,core 7.51.1)。
|
|
3
3
|
*
|
|
4
4
|
* ## 病(沿革)
|
|
5
|
-
* 7.99.0 合并复审 F7(web-admin [ref] 实测;安全轴;DEBTS
|
|
5
|
+
* 7.99.0 合并复审 F7(web-admin [ref] 实测;安全轴;DEBTS [ref]):core 的形状剥(`*_KEY` / `*_TOKEN` …)认不出本仓自己的凭据键
|
|
6
6
|
* (`SERVICE_AUTH_TOKENS` / `APPROVAL_HMAC_KEYS` / `OTEL_EXPORTER_OTLP_HEADERS`)⇒ 本仓在 `scrub` 腿上另加目录臂按名剥。7.129.0(web-client
|
|
7
7
|
* 实测):目录臂只在 `scrub` 腿施,`inheritEnv:"all"` 是 `{ ...process.env }` 零剥除、`[names]` 点到目录 secret 名照放 —— 单用户 host 上 cli 交互 lane
|
|
8
8
|
* 每次提交发 `"all"`,引擎自己的 `SERVICE_AUTH_TOKEN(S)` / `APPROVAL_HMAC_KEYS` / `MODEL_API_KEY` 逐字进模型 shell,模型一条 `curl` 可自批自己的 HITL 卡。
|
|
9
9
|
* 病根是本仓自判三个继承词、而只在其中一个词上减自有凭据。
|
|
10
10
|
*
|
|
11
|
-
* ## 律(一句;core
|
|
11
|
+
* ## 律(一句;core [ref] 定,本仓只传事实、不判)
|
|
12
12
|
* 本包任何进程在宿主上 spawn 的子进程:env = 引擎 `inheritedHostEnv(policy, findings)` ∪ 部署方点名放回的键(只在运维真可能要传东西的腿上有旋钮),
|
|
13
13
|
* 剥掉的键经一个登记过的 `SecretEnvScrubSite` 留痕(现场按**腿**命名);git 腿再叠 git 自己的两件({@link gitSubprocessEnv})。射程 = **每一条**宿主腿:
|
|
14
14
|
* src 里每一只值引 `node:child_process` 的文件都是登记腿、其中每一次起子进程都显式交组合出的 env(普查门在 `test/secret-env-scrub-host-legs.test.ts`)。
|
|
@@ -28,13 +28,13 @@
|
|
|
28
28
|
* 抛同路)。能力词 `inherit_env.own_credentials_withheld` 在本进程的事实 =
|
|
29
29
|
* {@link ownCredentialsWithheld}:最近一次成功声明的集合 ⊇ 当前生效配置应声明的集合(活配置经 {@link bindOwnCredentialsConfig} 在 `loadConfig()` 之后绑一次;
|
|
30
30
|
* 未绑 / 未声明 ⇒ false,事实读不到应声明集合就不答 true)。
|
|
31
|
-
* · **值臂**(core 7.52.0
|
|
31
|
+
* · **值臂**(core 7.52.0 [ref]):声明是一张表 `{ names, values }`。`values` = 本进程持有凭据的变量此刻的值(目录 secret 名 ∪ 模型条目 `apiKeyEnv`,{@link serverCredentialValueSources}),
|
|
32
32
|
* 逐个交给引擎的同一只判;引擎判「不是凭据值」的那一个不扣、名照扣、不拒启、点名一次。能力词 `inherit_env.own_credential_values_withheld` 的事实 = {@link ownCredentialValuesWithheld}(位真 ⇔ 值臂真扣)。
|
|
33
33
|
* · 调用方显式传入的 env(`cfg.env` / 单次命令的 `env` / 沙箱的点名放回)不是继承,照旧原样叠在组合结果之上 —— 那是适配器自己的凭据通道。
|
|
34
34
|
* 各腿只调 {@link hostSubprocessEnv} / {@link gitSubprocessEnv} —— 不许再有内联拼装、不许再有 `{ ...process.env }`、不许本仓再判任何一个继承词、不许起子进程不交 env
|
|
35
35
|
* (类级门与普查门在 `test/secret-env-scrub-host-legs.test.ts`)。
|
|
36
36
|
*
|
|
37
|
-
* ## 点名放行(
|
|
37
|
+
* ## 点名放行([ref] / [ref],一只谓词各处用)
|
|
38
38
|
* {@link allowlistedEnv} 是本仓「一张名单点到哪些 env 键,就把它们从源 env **原样**交给沙箱」的唯一实现。调用:沙箱带外 env 的 `E2B_SANDBOX_ENV` / `DOCKER_SANDBOX_ENV` /
|
|
39
39
|
* `K8S_SANDBOX_ENV`(`config.ts`)与名单解析器的「在不在」判。宿主子进程的剥后放回(`LSP_ENV_ALLOW` / `BAKE_ENV_ALLOW`)不经它 —— 那是引擎的严格名单臂(上一段)。
|
|
40
40
|
* host shell 的 `inheritEnv:[names]`(hermetic 形)7.129.0 起由引擎读(与 core `NodeExecutionEnv` 同名选项同义,点到自有凭据名即拒),不经本谓词。
|
|
@@ -57,7 +57,7 @@ export type ModelApiKeyEnvTable = Readonly<Record<string, string>>;
|
|
|
57
57
|
*/
|
|
58
58
|
export declare function serverWithheldEnvNames(modelApiKeyEnv?: ModelApiKeyEnvTable): readonly string[];
|
|
59
59
|
/**
|
|
60
|
-
* 本进程**持有凭据值**的变量名(值臂的来源;core 7.52.0
|
|
60
|
+
* 本进程**持有凭据值**的变量名(值臂的来源;core 7.52.0 [ref]):目录 secret 名 ∪ 模型条目 `apiKeyEnv` 的值 —— 名单与值臂两臂同一张表派生,只少名单型旋钮名(它们的值是
|
|
61
61
|
* 一张变量名单,不是凭据)。纯函数,排序只为读数稳定。
|
|
62
62
|
*/
|
|
63
63
|
export declare function serverCredentialValueSources(modelApiKeyEnv?: ModelApiKeyEnvTable): readonly string[];
|
|
@@ -111,7 +111,7 @@ export interface HostSubprocessEnvRequest {
|
|
|
111
111
|
* 调用时机 = 每次要交 env 时现算一次(`process.env` 在本仓是 boot 期输入,各次同值;计数因此是「每组合一次」)。
|
|
112
112
|
* 引擎对坏策略 / 点到自有凭据名的白名单在这里**抛**(spawn 时的拒是不变量;构造时的拒由各构造点自己先问 `inheritEnvPolicyProblem`)。
|
|
113
113
|
*
|
|
114
|
-
* 🔴 **git 的 env 配置族与代理变量一族只有 core 一只写手**:core 7.35.0
|
|
114
|
+
* 🔴 **git 的 env 配置族与代理变量一族只有 core 一只写手**:core 7.35.0 [ref]([ref])起它们是 core 的**豁免族** —— `GIT_CONFIG_COUNT` / `GIT_CONFIG_PARAMETERS` /
|
|
115
115
|
* `GIT_CONFIG_KEY_<数字>` / `GIT_CONFIG_VALUE_<数字>`(大写)与 `http(s)_proxy` / `all_proxy` / `no_proxy` / `npm_config_*proxy` …(任意大小写),名与值都不读、
|
|
116
116
|
* **原样交出,凭据在内**(部署面:凭据不放本进程 env —— `docs/DEPLOY-PREREQS.md`)。本仓不重判;本进程自有凭据名单不含这两族的名字
|
|
117
117
|
* (钉:`test/secret-env-git-config-pair.test.ts`「一只写手」格)。
|
|
@@ -120,7 +120,7 @@ export interface HostSubprocessEnvRequest {
|
|
|
120
120
|
export declare function hostSubprocessEnv(o: HostSubprocessEnvRequest): NodeJS.ProcessEnv;
|
|
121
121
|
/**
|
|
122
122
|
* {@link hostSubprocessEnv} 的**组合本体**(不披露、不计数)—— 同一只组合,两个入口:真要交给子进程的现场经 `hostSubprocessEnv`(组合 + 披露);
|
|
123
|
-
* 只想知道「子进程**会**拿到什么」的读者(core 7.49.0
|
|
123
|
+
* 只想知道「子进程**会**拿到什么」的读者(core 7.49.0 [ref]:host 车道的 `ExecutionEnv.cdPath` 要报子进程真拿到的 `CDPATH`)读这一只 ——
|
|
124
124
|
* 既不另写一份组合(第二份会漂),也不把一次没发生的 spawn 记进剥除计数。`findings` 是组合点自己的收集器(引擎把形状臂与自有凭据臂的每一条扣下都推进去)。
|
|
125
125
|
*/
|
|
126
126
|
export declare function composeHostSubprocessEnv(o: Omit<HostSubprocessEnvRequest, "site">, findings?: SecretEnvFinding[]): NodeJS.ProcessEnv;
|
|
@@ -143,10 +143,10 @@ export declare function gitSubprocessEnv(o: {
|
|
|
143
143
|
isolateConfig: boolean;
|
|
144
144
|
}): NodeJS.ProcessEnv;
|
|
145
145
|
/**
|
|
146
|
-
*
|
|
146
|
+
* [ref] —— **点名放行**的唯一谓词:从 `env` 里把 `names` 点到的键**原样**取出(值逐字,空串照带;源里没有的名不产生
|
|
147
147
|
* 条目)。密钥形的键点到了也照取 —— 点名即部署方显式承担;要不要在这之上再叠别的基底,是调用方的事(见文件头「点名放行」节)。
|
|
148
148
|
* 纯函数,不留痕:点名放回的键不是剥除,不进 `secret_env_scrubbed` 的键表与计数。
|
|
149
|
-
* 返回形 `Record<string, string>`(
|
|
149
|
+
* 返回形 `Record<string, string>`([ref]):只装源里在的键,值恒是字符串 —— 沙箱两腿(`sandboxEnv` / docker `env`)要的正是这个形,
|
|
150
150
|
* 不必在调用点再过滤一遍 `undefined`。
|
|
151
151
|
*/
|
|
152
152
|
export declare function allowlistedEnv(names: readonly string[], env: NodeJS.ProcessEnv): Record<string, string>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* [ref] 件B([ref] §3)—— **删会话带走以它为根的后台子代**:一只会话被删,以它为根的子代跟着结束 —— parked 的作废
|
|
3
3
|
* (行转终态,审批卡随之离开待决面),在跑的停掉。**这件事做完,才删会话元数据**(调用方:`boot/session-faces.ts` 的删除协调器)。
|
|
4
4
|
*
|
|
5
5
|
* ## 两步、两种失败,类型上分开(合并复审 gpt-6 腿 [high] 之后的形,裁定 2026-09-28)
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* 🔴 **core `SessionError` 闭集 → HTTP 的唯一映射**(
|
|
2
|
+
* 🔴 **core `SessionError` 闭集 → HTTP 的唯一映射**([ref],server 7.104.0;设计稿 [ref] §2.1)。
|
|
3
3
|
*
|
|
4
4
|
* ## 为什么要一只属主
|
|
5
5
|
* 修前 wire 上只有**一处**认得 `SessionError` 的码:`http/routes/session-sync.ts` 的暂存导入腿把 `invalid_session`
|
|
6
|
-
* 手写成 422。其余每一条路都把它交给全局兜底 ⇒ `500 internal.error "internal error"`,码丢。core 7.30.0(
|
|
6
|
+
* 手写成 422。其余每一条路都把它交给全局兜底 ⇒ `500 internal.error "internal error"`,码丢。core 7.30.0([ref])
|
|
7
7
|
* 给文件会话店铸了 `corrupt_session`(存档没有会话头 ⇒ 这只会话唤不醒),而它在 wire 上一个名字都没有
|
|
8
|
-
* (真跑读数见
|
|
8
|
+
* (真跑读数见 [ref] 收车档 §0:冷启动时三条提交口与每一条经归属探针 / 读存档碰到它的口都答 500 `internal.error`;
|
|
9
9
|
* owner 已知时同步口是 200 + failed 体、并照常走计费收尾)。
|
|
10
10
|
*
|
|
11
11
|
* ## 为什么多一个 `face` 参数(而不是单参)
|
|
12
12
|
* core 的 `invalid_session` 是**同词两义**(亲读 dist:`engine/session/import-validate.js` 的导入门拒调用方交来的
|
|
13
|
-
* 日志,`engine/session/storage-base.js` 的建树 / 走根拒**已存**日志里指向缺席条目的叶子或祖先 —— 后者即 core
|
|
13
|
+
* 日志,`engine/session/storage-base.js` 的建树 / 走根拒**已存**日志里指向缺席条目的叶子或祖先 —— 后者即 core [ref])。
|
|
14
14
|
* 本仓对它的成文义是前者(调用方的日志没过校验 ⇒ 422),而后者今天在打开会话的各口上答的是通用 500 / 同步口
|
|
15
|
-
* 200 + failed(
|
|
16
|
-
* 打开面的每个消费点都写一句 `code === "corrupt_session"` 特判,要么把
|
|
15
|
+
* 200 + failed([ref] 的 3b 负控格钉住这一形,[ref] 落地后按 core 的新码再对一次)。单参签名装不下这件事:要么
|
|
16
|
+
* 打开面的每个消费点都写一句 `code === "corrupt_session"` 特判,要么把 [ref] 形从今天的应答改成「你交的日志坏了」。
|
|
17
17
|
* ⇒ 面是映射的一维,写进属主,不散在消费点。
|
|
18
18
|
* · `"open"` —— 为某只会话**打开它已存的日志**(提交各腿的引擎 prepare、鉴权门的归属探针、直接读会话的口);
|
|
19
19
|
* · `"import"` —— 校验 / 写入**调用方交来的**日志(2c session-sync 的暂存导入)。
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
* 原样上 wire,契约既有立场:不为上游码铸孪生码)。三种会话后端同词:文件店由 core 铸,两只 SQL 店由
|
|
25
25
|
* `plugins/session-event-payload.ts` 铸(坏的 `session_event.payload` 行)。
|
|
26
26
|
* · `invalid_session` —— `import` 面 **422 `invalid_entries`**(修前 session-sync 的那一行,码位 / 状态逐字不变);
|
|
27
|
-
* `open` 面留白(
|
|
27
|
+
* `open` 面留白([ref] 形,见上)。
|
|
28
28
|
* · `not_found` —— 留白:每一面各有自己的「不存在」答法(404 `not_found.session` / 同步口的 `resume.session_not_found` /
|
|
29
29
|
* 列表里的缺席),码位各不相同,不由本表统一。
|
|
30
30
|
* · `placement_refused` —— `import` 面 **409 `conflict.session_placed`**(机读位 `detail.placement_kind`,固定句);`open` 面留白。
|