@sema-agent/server 7.147.0 → 7.148.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 +1039 -24
- package/README.md +20 -7
- package/README.zh-CN.md +14 -8
- package/USAGE.md +380 -163
- package/deploy/sema-up/README.md +16 -5
- package/deploy/sema-up/chart/templates/NOTES.txt +1 -1
- package/deploy/sema-up/chart/templates/_helpers.tpl +20 -4
- package/deploy/sema-up/chart/values.yaml +3 -2
- package/deploy/sema-up/cluster-up.sh +74 -176
- package/deploy/sema-up/kube-up.sh +29 -49
- package/deploy/sema-up/lib/chart-run.sh +23 -0
- package/deploy/sema-up/lib/dataroot.sh +3 -3
- package/deploy/sema-up/lib/health.sh +62 -13
- package/deploy/sema-up/lib/helm-values-cluster.py +18 -0
- package/deploy/sema-up/lib/helm-values-kube.py +35 -0
- package/deploy/sema-up/lib/regcred.py +8 -0
- package/deploy/sema-up/lib/remote/helm-install.sh +3 -0
- package/deploy/sema-up/lib/remote/image-import.sh +6 -0
- package/deploy/sema-up/lib/remote/machine-precheck.sh +11 -0
- package/deploy/sema-up/lib/remote/region-probe.sh +3 -0
- package/deploy/sema-up/lib/remote/stack-ready.sh +26 -0
- package/deploy/sema-up/lib/remote/vxlan-guard.sh +8 -0
- package/deploy/sema-up/lib/render-stack.py +17 -0
- package/deploy/sema-up/lib/shell-text.sh +87 -0
- package/deploy/sema-up/lib/usage-flags.txt +10 -0
- package/deploy/sema-up/lib/usage-head.txt +1 -0
- package/deploy/sema-up/lib/usage-tail.txt +13 -0
- package/deploy/sema-up/preflight.sh +10 -8
- package/deploy/sema-up/sema-up.sh +14 -39
- package/deploy/sema-up/smoke.sh +7 -6
- package/deploy/sema-up/stack/compose.dataroot.yaml +3 -0
- package/deploy/sema-up/stack/compose.yaml +13 -1
- package/deploy/sema-up/stack/sema-stack-cluster.yaml +21 -0
- package/dist/adoption/plan.d.ts +24 -0
- package/dist/adoption/plan.js +53 -1
- package/dist/adoption/runner.d.ts +10 -1
- package/dist/adoption/runner.js +36 -16
- package/dist/adoption/wire.d.ts +3 -3
- package/dist/approval-card.d.ts +28 -30
- package/dist/approval-gate-currency.js +3 -2
- package/dist/approval-reconciler.d.ts +4 -13
- package/dist/approval-reconciler.js +2 -2
- package/dist/approval.d.ts +13 -11
- package/dist/approval.js +3 -3
- package/dist/audit.d.ts +10 -3
- package/dist/audit.js +15 -7
- package/dist/auth-bridge.d.ts +0 -14
- package/dist/auth-bridge.js +0 -7
- package/dist/auto-mode-face.d.ts +10 -7
- package/dist/auto-mode-face.js +7 -4
- package/dist/background-agent-name.d.ts +19 -1
- package/dist/background-agent-name.js +12 -2
- package/dist/background-session-reap.d.ts +1 -1
- package/dist/bake-runner/main.js +9 -6
- package/dist/bench/s1/arms.js +6 -5
- package/dist/bench/s1/live-deps.js +5 -2
- package/dist/bench/s1/run-firm.js +6 -5
- package/dist/bind-host.d.ts +25 -0
- package/dist/bind-host.js +25 -0
- package/dist/boot/adoption.d.ts +3 -0
- package/dist/boot/adoption.js +1 -0
- package/dist/boot/deployment-mods.d.ts +1 -1
- package/dist/boot/execution-env.d.ts +17 -7
- package/dist/boot/execution-env.js +37 -31
- package/dist/boot/exit-boundary.d.ts +2 -2
- package/dist/boot/exit-boundary.js +6 -5
- package/dist/boot/fatal-exit.d.ts +3 -5
- package/dist/boot/fatal-exit.js +2 -2
- package/dist/boot/leader.d.ts +15 -0
- package/dist/boot/leader.js +17 -15
- package/dist/boot/memory-consolidation.d.ts +37 -29
- package/dist/boot/memory-consolidation.js +11 -5
- package/dist/boot/org-memory.js +1 -1
- package/dist/boot/parked-revive-gate.js +2 -2
- package/dist/boot/reapers.d.ts +4 -3
- package/dist/boot/reapers.js +19 -16
- package/dist/boot/resolve-spec.d.ts +5 -3
- package/dist/boot/resolve-spec.js +55 -67
- package/dist/boot/retention-lane.d.ts +4 -4
- package/dist/boot/retention-lane.js +2 -2
- package/dist/boot/runner-deps.d.ts +28 -7
- package/dist/boot/runner-deps.js +11 -4
- package/dist/boot/runtime-caps.d.ts +2 -2
- package/dist/boot/runtime-caps.js +16 -2
- package/dist/boot/session-faces.d.ts +16 -7
- package/dist/boot/session-faces.js +114 -94
- package/dist/boot/shutdown.d.ts +5 -4
- package/dist/boot/shutdown.js +6 -4
- package/dist/boot/stage-01-config.js +9 -1
- package/dist/boot/stage-02-web-admin-pull.d.ts +1 -0
- package/dist/boot/stage-02-web-admin-pull.js +6 -1
- package/dist/boot/stage-03-store-backend.d.ts +3 -0
- package/dist/boot/stage-03-store-backend.js +4 -3
- package/dist/boot/stage-04-stores.d.ts +2 -0
- package/dist/boot/stage-04-stores.js +2 -2
- package/dist/boot/stage-05-execution-env.d.ts +7 -3
- package/dist/boot/stage-05-execution-env.js +2 -2
- package/dist/boot/stage-06-runners.d.ts +10 -12
- package/dist/boot/stage-06-runners.js +23 -15
- package/dist/boot/stage-07-capability-layer.d.ts +11 -8
- package/dist/boot/stage-07-capability-layer.js +5 -3
- package/dist/boot/stage-08-reapers.d.ts +11 -8
- package/dist/boot/stage-08-reapers.js +3 -3
- package/dist/boot/stage-09-leader.d.ts +12 -15
- package/dist/boot/stage-09-leader.js +12 -4
- package/dist/boot/stage-10-http-server.d.ts +12 -15
- package/dist/boot/stage-10-http-server.js +7 -4
- package/dist/boot/store-evidence.d.ts +20 -0
- package/dist/boot/store-evidence.js +13 -0
- package/dist/boot/stores.d.ts +3 -0
- package/dist/boot/stores.js +21 -10
- package/dist/boot/task-list-lane.d.ts +4 -4
- package/dist/boot/web-admin.d.ts +4 -2
- package/dist/boot/web-admin.js +55 -35
- package/dist/boot/webfetch-summarize-lane.d.ts +1 -1
- package/dist/boot-reclaim.d.ts +3 -1
- package/dist/boot-reclaim.js +1 -1
- package/dist/brain.d.ts +7 -18
- package/dist/brain.js +5 -17
- package/dist/budget.js +6 -6
- package/dist/capabilities/center-plugins.d.ts +7 -1
- package/dist/capabilities/center-plugins.js +32 -10
- package/dist/capabilities/center-wiring.js +1 -1
- package/dist/capabilities/composite-members.d.ts +2 -2
- package/dist/capabilities/composite-members.js +2 -2
- package/dist/capabilities/repo-tools.d.ts +2 -0
- package/dist/capabilities/repo-tools.js +14 -12
- package/dist/capabilities/scenarios.d.ts +6 -15
- package/dist/capabilities/scenarios.js +11 -16
- package/dist/capabilities/skills.d.ts +1 -1
- package/dist/capabilities/tool-defer.d.ts +1 -1
- package/dist/capability-facts.d.ts +38 -11
- package/dist/capability-facts.js +47 -8
- package/dist/card-void.d.ts +4 -4
- package/dist/card-void.js +1 -1
- package/dist/center-credential-renewer.d.ts +6 -2
- package/dist/center-credential-renewer.js +7 -3
- package/dist/config-catalog.d.ts +16 -1
- package/dist/config-catalog.js +62 -56
- package/dist/config-dir-trust.d.ts +37 -4
- package/dist/config-dir-trust.js +88 -44
- package/dist/config-invariants.d.ts +42 -3
- package/dist/config-invariants.js +69 -5
- package/dist/config-lkg.d.ts +23 -1
- package/dist/config-lkg.js +17 -3
- package/dist/config-provider.d.ts +9 -9
- package/dist/config-provider.js +25 -110
- package/dist/config-pull-failure.d.ts +50 -0
- package/dist/config-pull-failure.js +48 -0
- package/dist/config-types.d.ts +26 -17
- package/dist/config.d.ts +8 -16
- package/dist/config.js +113 -47
- package/dist/delegated-session-owner.d.ts +1 -1
- package/dist/deleted-session-ids.d.ts +3 -2
- package/dist/deployment-governance.d.ts +3 -3
- package/dist/deployment-shape.d.ts +30 -4
- package/dist/deployment-shape.js +7 -0
- package/dist/egress-redirect.d.ts +25 -7
- package/dist/egress-redirect.js +20 -2
- package/dist/elicitation.d.ts +6 -5
- package/dist/elicitation.js +23 -22
- package/dist/engine-identity.d.ts +28 -0
- package/dist/engine-identity.js +10 -0
- package/dist/entry-problems.d.ts +5 -7
- package/dist/entry-problems.js +1 -1
- package/dist/env-facts.js +2 -1
- package/dist/env-witness.d.ts +7 -0
- package/dist/env-witness.js +16 -0
- package/dist/execution-lane-caps.d.ts +5 -18
- package/dist/execution-lane-caps.js +0 -22
- package/dist/execution-placement.d.ts +58 -18
- package/dist/execution-placement.js +41 -2
- package/dist/field-conflict.d.ts +7 -11
- package/dist/field-conflict.js +3 -3
- package/dist/file-history-capture.d.ts +3 -3
- package/dist/file-history-disclosure.js +1 -0
- package/dist/fleet/fleet-bus.d.ts +21 -3
- package/dist/fleet/fleet-bus.js +35 -25
- package/dist/fleet/fleet-reconciler.js +2 -2
- package/dist/fleet/serving-lease.js +3 -3
- package/dist/fleet-client.js +3 -3
- package/dist/fleet-lease.d.ts +0 -1
- package/dist/fleet-lease.js +4 -5
- package/dist/history-anchor.d.ts +23 -3
- package/dist/history-anchor.js +24 -4
- package/dist/hitl-delivery.d.ts +90 -0
- package/dist/hitl-delivery.js +98 -0
- package/dist/hooks/classic-stations.d.ts +8 -11
- package/dist/hooks/classic-stations.js +0 -7
- package/dist/hooks/hook-llm.d.ts +5 -1
- package/dist/hooks/hook-llm.js +24 -15
- package/dist/hooks/hook-runner.d.ts +67 -57
- package/dist/hooks/hook-runner.js +260 -186
- package/dist/host-lsp-manager.d.ts +22 -8
- package/dist/host-lsp-manager.js +4 -1
- package/dist/http/active-run-conflict.d.ts +2 -43
- package/dist/http/active-run-conflict.js +3 -7
- package/dist/http/admission.d.ts +4 -18
- package/dist/http/admission.js +75 -78
- package/dist/http/approval-sweeps.d.ts +3 -3
- package/dist/http/approval-sweeps.js +54 -30
- package/dist/http/caller-trust.d.ts +8 -10
- package/dist/http/caller-trust.js +1 -2
- package/dist/http/claim-heartbeat.d.ts +49 -0
- package/dist/http/claim-heartbeat.js +46 -0
- package/dist/http/claimed-run.d.ts +4 -3
- package/dist/http/dispatch.d.ts +8 -1
- package/dist/http/dispatch.js +76 -30
- package/dist/http/durable-run-leg.d.ts +3 -3
- package/dist/http/durable-run-leg.js +17 -12
- package/dist/http/execution-context.d.ts +17 -43
- package/dist/http/execution-context.js +7 -5
- package/dist/http/health-reader.d.ts +36 -0
- package/dist/http/health-reader.js +21 -0
- package/dist/http/health-self-report.d.ts +9 -9
- package/dist/http/health-self-report.js +4 -4
- package/dist/http/idempotency.d.ts +9 -5
- package/dist/http/idempotency.js +4 -4
- package/dist/http/memory-compliance-failure-reply.d.ts +15 -16
- package/dist/http/memory-compliance-failure-reply.js +4 -2
- package/dist/http/memory-face-fault-reply.d.ts +67 -0
- package/dist/http/memory-face-fault-reply.js +71 -0
- package/dist/http/memory-store-refusal-reply.d.ts +1 -1
- package/dist/http/memory-store-refusal-reply.js +3 -0
- package/dist/http/owner-access.d.ts +391 -67
- package/dist/http/owner-access.js +371 -35
- package/dist/http/principal-gate.d.ts +24 -81
- package/dist/http/principal-gate.js +24 -68
- package/dist/http/refusal-body.d.ts +35 -2
- package/dist/http/refusal-body.js +34 -0
- package/dist/http/request-guards.d.ts +9 -13
- package/dist/http/request-guards.js +34 -68
- package/dist/http/resume-composition.d.ts +37 -0
- package/dist/http/resume-composition.js +18 -0
- package/dist/http/resume-ctx-read.d.ts +35 -12
- package/dist/http/resume-ctx-read.js +25 -6
- package/dist/http/resume-legs.d.ts +21 -18
- package/dist/http/resume-legs.js +189 -129
- package/dist/http/retired-skill-manifest.d.ts +1 -1
- package/dist/http/route-ctx.d.ts +25 -32
- package/dist/http/routes/a2a-serve.d.ts +43 -5
- package/dist/http/routes/a2a-serve.js +58 -37
- package/dist/http/routes/admin-config-refresh.js +2 -2
- package/dist/http/routes/admin-drain.js +2 -2
- package/dist/http/routes/admin-memory-optout.js +4 -3
- package/dist/http/routes/adoption.d.ts +3 -0
- package/dist/http/routes/adoption.js +17 -10
- package/dist/http/routes/agents-roster.js +13 -7
- package/dist/http/routes/approvals-assistant.js +70 -65
- package/dist/http/routes/attachments.js +2 -2
- package/dist/http/routes/background.d.ts +3 -3
- package/dist/http/routes/background.js +9 -17
- package/dist/http/routes/capabilities.js +15 -18
- package/dist/http/routes/config-catalog.js +2 -2
- package/dist/http/routes/devices.d.ts +3 -3
- package/dist/http/routes/devices.js +4 -4
- package/dist/http/routes/diagnostics.d.ts +27 -3
- package/dist/http/routes/diagnostics.js +27 -21
- package/dist/http/routes/engine.js +2 -2
- package/dist/http/routes/fleet.js +5 -3
- package/dist/http/routes/images.js +10 -6
- package/dist/http/routes/leader.d.ts +7 -2
- package/dist/http/routes/leader.js +12 -3
- package/dist/http/routes/mcp-reconnect.d.ts +1 -1
- package/dist/http/routes/mcp-reconnect.js +7 -15
- package/dist/http/routes/memory-bundle.js +4 -7
- package/dist/http/routes/memory-compliance.js +4 -4
- package/dist/http/routes/memory-consolidation.js +6 -9
- package/dist/http/routes/memory-origin.d.ts +2 -0
- package/dist/http/routes/memory-origin.js +7 -8
- package/dist/http/routes/memory-policy.js +17 -12
- package/dist/http/routes/notify-wake.js +10 -19
- package/dist/http/routes/observability.js +3 -3
- package/dist/http/routes/principal-inbox.d.ts +1 -1
- package/dist/http/routes/principal-inbox.js +2 -2
- package/dist/http/routes/projects.d.ts +1 -1
- package/dist/http/routes/projects.js +3 -2
- package/dist/http/routes/retention-ops.js +6 -9
- package/dist/http/routes/rules.js +20 -5
- package/dist/http/routes/run-memory-capture.d.ts +2 -2
- package/dist/http/routes/run-memory-capture.js +6 -12
- package/dist/http/routes/run-permission-mode.d.ts +2 -2
- package/dist/http/routes/run-permission-mode.js +10 -17
- package/dist/http/routes/runs.js +146 -231
- package/dist/http/routes/session-memory-sync.d.ts +2 -2
- package/dist/http/routes/session-memory-sync.js +7 -13
- package/dist/http/routes/session-sync.d.ts +4 -2
- package/dist/http/routes/session-sync.js +21 -20
- package/dist/http/routes/sessions-list.d.ts +3 -3
- package/dist/http/routes/sessions-list.js +9 -9
- package/dist/http/routes/sessions.js +87 -124
- package/dist/http/routes/shared-memory.js +6 -6
- package/dist/http/routes/side-query.js +2 -2
- package/dist/http/routes/tasks.js +136 -120
- package/dist/http/routes/trace-usage.d.ts +0 -12
- package/dist/http/routes/trace-usage.js +40 -46
- package/dist/http/routes/workflows.d.ts +39 -4
- package/dist/http/routes/workflows.js +42 -14
- package/dist/http/run-concurrency-cap.d.ts +20 -12
- package/dist/http/run-concurrency-cap.js +39 -26
- package/dist/http/run-read-face.d.ts +3 -5
- package/dist/http/run-read-face.js +8 -13
- package/dist/http/send.d.ts +12 -3
- package/dist/http/send.js +42 -6
- package/dist/http/server.d.ts +39 -40
- package/dist/http/server.js +36 -11
- package/dist/http/sse-log.d.ts +17 -10
- package/dist/http/sse-log.js +7 -7
- package/dist/http/stored-body-replay.d.ts +12 -0
- package/dist/http/stored-body-replay.js +2 -2
- package/dist/http/submit-ctx.d.ts +16 -8
- package/dist/http/submit-ctx.js +6 -2
- package/dist/http/submit-replay.d.ts +19 -6
- package/dist/http/submit-replay.js +18 -6
- package/dist/http/sync-submit-body.d.ts +3 -4
- package/dist/http/sync-submit-body.js +4 -5
- package/dist/http/wire-types.d.ts +4 -3
- package/dist/identity-source.d.ts +36 -5
- package/dist/identity-source.js +27 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/key-resolver.d.ts +32 -0
- package/dist/key-resolver.js +23 -9
- package/dist/leader/diffup.js +2 -1
- package/dist/leader/endpoint.d.ts +26 -5
- package/dist/leader/endpoint.js +154 -14
- package/dist/leader/fanout.d.ts +3 -0
- package/dist/leader/fanout.js +78 -63
- package/dist/leader/leader.d.ts +16 -0
- package/dist/leader/leader.js +43 -3
- package/dist/leader/merge.d.ts +9 -1
- package/dist/leader/merge.js +16 -1
- package/dist/leader/repair-wire.js +1 -1
- package/dist/leader/wire.d.ts +36 -3
- package/dist/leader/wire.js +59 -18
- package/dist/lsp-evict.d.ts +6 -4
- package/dist/lsp-evict.js +2 -3
- package/dist/memory-operator-faces.d.ts +5 -4
- package/dist/memory-operator-faces.js +1 -1
- package/dist/memory-scope.d.ts +29 -2
- package/dist/memory-scope.js +64 -15
- package/dist/memory-store-refusal.d.ts +5 -2
- package/dist/memory-sync-client.d.ts +3 -2
- package/dist/memory-sync-client.js +6 -3
- package/dist/model-compat.d.ts +17 -8
- package/dist/model-compat.js +6 -2
- package/dist/model-context-window.d.ts +18 -0
- package/dist/model-context-window.js +2 -0
- package/dist/model-entry-headers.d.ts +46 -4
- package/dist/model-entry-headers.js +2 -2
- package/dist/model-entry-refusal.d.ts +35 -16
- package/dist/model-entry-refusal.js +40 -27
- package/dist/model-plane-face.d.ts +19 -11
- package/dist/model-plane-face.js +9 -1
- package/dist/model-plane-probe.d.ts +2 -0
- package/dist/model-plane-probe.js +17 -0
- package/dist/model-provider.d.ts +3 -3
- package/dist/model-route-endpoint.d.ts +9 -5
- package/dist/model-route-endpoint.js +29 -7
- package/dist/model-select.d.ts +16 -0
- package/dist/model-select.js +4 -0
- package/dist/mountinfo.d.ts +37 -0
- package/dist/mountinfo.js +47 -0
- package/dist/namespaced-rule-name.d.ts +23 -14
- package/dist/namespaced-rule-name.js +8 -11
- package/dist/net-address.d.ts +1 -1
- package/dist/observability/corrupt-read-seat.d.ts +4 -4
- package/dist/observability/corrupt-read-seat.js +5 -3
- package/dist/observability/fail-open.d.ts +58 -38
- package/dist/observability/fail-open.js +60 -38
- package/dist/observability/logger.d.ts +22 -1
- package/dist/observability/logger.js +89 -12
- package/dist/observability/metrics.js +3 -4
- package/dist/observability/otel-exporter.js +2 -1
- package/dist/observability/principal-context.d.ts +14 -7
- package/dist/observability/principal-context.js +8 -3
- package/dist/observability/run-terminal.d.ts +7 -1
- package/dist/observability/run-terminal.js +5 -2
- package/dist/orchestration/hardened-vm-runner.d.ts +1 -0
- package/dist/orchestration/hardened-vm-runner.js +11 -5
- package/dist/orchestration/hardened-vm-worker-runner.d.ts +0 -14
- package/dist/orchestration/hardened-vm-worker-runner.js +5 -0
- package/dist/orchestration/hardened-vm-worker.js +2 -1
- package/dist/orchestration/workflow-completion-inbox.d.ts +3 -3
- package/dist/orchestration/workflow-completion-inbox.js +3 -2
- package/dist/org-delivery-gate.d.ts +5 -4
- package/dist/org-delivery-gate.js +7 -6
- package/dist/outbound-dispatcher.d.ts +1 -1
- package/dist/outbound-dispatcher.js +6 -12
- package/dist/owner-brands.d.ts +81 -0
- package/dist/owner-brands.js +42 -0
- package/dist/owner-faces.d.ts +531 -0
- package/dist/owner-faces.js +126 -0
- package/dist/parked-decide.d.ts +67 -5
- package/dist/parked-decide.js +127 -5
- package/dist/parked-revive-surface.d.ts +14 -4
- package/dist/parked-revive-surface.js +5 -4
- package/dist/peer-directory.d.ts +6 -8
- package/dist/peer-directory.js +3 -2
- package/dist/permission-rule-vocab.d.ts +53 -8
- package/dist/permission-rule-vocab.js +30 -2
- package/dist/plugins/adoption-log-sql.d.ts +0 -22
- package/dist/plugins/adoption-log-sql.js +5 -3
- package/dist/plugins/approval-ask-retired-delete-by-task-m50.d.ts +7 -0
- package/dist/plugins/approval-ask-retired-delete-by-task-m50.js +17 -0
- package/dist/plugins/approval-ask-store-file.d.ts +18 -7
- package/dist/plugins/approval-ask-store-file.js +37 -14
- package/dist/plugins/approval-ask-store-memory.d.ts +12 -4
- package/dist/plugins/approval-ask-store-memory.js +24 -10
- package/dist/plugins/approval-ask-store-sql.d.ts +39 -20
- package/dist/plugins/approval-ask-store-sql.js +41 -10
- package/dist/plugins/approval-exemption-skill-m46.d.ts +20 -0
- package/dist/plugins/approval-exemption-skill-m46.js +25 -0
- package/dist/plugins/approval-exemption-store.d.ts +6 -1
- package/dist/plugins/approval-exemption-store.js +14 -0
- package/dist/plugins/approval-nonce-store.d.ts +39 -12
- package/dist/plugins/approval-nonce-store.js +72 -23
- package/dist/plugins/blob-backend.d.ts +2 -0
- package/dist/plugins/blob-backend.js +9 -6
- package/dist/plugins/caching-session-store.d.ts +13 -1
- package/dist/plugins/caching-session-store.js +43 -4
- package/dist/plugins/checkpoint-index-columns.d.ts +32 -5
- package/dist/plugins/checkpoint-index-columns.js +36 -1
- package/dist/plugins/checkpoint-store-face.d.ts +83 -10
- package/dist/plugins/checkpoint-store-face.js +18 -1
- package/dist/plugins/device-store-sql.js +1 -0
- package/dist/plugins/ensure-index.d.ts +13 -1
- package/dist/plugins/ensure-index.js +154 -21
- package/dist/plugins/ensure-schema-lock-policy.d.ts +0 -15
- package/dist/plugins/ensure-schema-lock-policy.js +3 -2
- package/dist/plugins/file-run-store.d.ts +63 -23
- package/dist/plugins/file-run-store.js +138 -83
- package/dist/plugins/host-platform.d.ts +24 -3
- package/dist/plugins/host-platform.js +15 -1
- package/dist/plugins/image-bake-store-sql.js +2 -0
- package/dist/plugins/imported-layer-root-retirement.d.ts +2 -2
- package/dist/plugins/k8s-pod-reaper.d.ts +1 -3
- package/dist/plugins/k8s-pod-reaper.js +0 -1
- package/dist/plugins/leader-run-store-sql.d.ts +22 -0
- package/dist/plugins/leader-run-store-sql.js +34 -4
- package/dist/plugins/local-checkpoint-store.d.ts +58 -23
- package/dist/plugins/local-checkpoint-store.js +195 -76
- package/dist/plugins/local-data-dir-modes-m39.js +2 -1
- package/dist/plugins/local-docker-capacity.d.ts +93 -0
- package/dist/plugins/local-docker-capacity.js +194 -0
- package/dist/plugins/local-docker-reaper.d.ts +92 -0
- package/dist/plugins/local-docker-reaper.js +102 -0
- package/dist/plugins/local-engine-high-water.d.ts +4 -2
- package/dist/plugins/local-engine-high-water.js +4 -1
- package/dist/plugins/local-session-store.d.ts +358 -125
- package/dist/plugins/local-session-store.js +824 -251
- package/dist/plugins/local-session-window.d.ts +3 -2
- package/dist/plugins/local-session-window.js +3 -2
- package/dist/plugins/local-sidecar-quarantine.js +3 -2
- package/dist/plugins/local-task-attachment-store.d.ts +18 -1
- package/dist/plugins/local-task-attachment-store.js +22 -1
- package/dist/plugins/memory-embedder.js +9 -7
- package/dist/plugins/memory-engine-pg.d.ts +3 -2
- package/dist/plugins/memory-engine-pg.js +14 -5
- package/dist/plugins/memory-engine-sql-apply.d.ts +8 -4
- package/dist/plugins/memory-engine-sql-apply.js +6 -8
- package/dist/plugins/memory-engine-tidb.d.ts +4 -2
- package/dist/plugins/memory-engine-tidb.js +11 -2
- package/dist/plugins/memory-optout-grant-store-sql.d.ts +1 -1
- package/dist/plugins/memory-optout-grant-store-sql.js +3 -3
- package/dist/plugins/memory-run-store.d.ts +39 -27
- package/dist/plugins/memory-run-store.js +72 -70
- package/dist/plugins/one-time-migration-marker.d.ts +10 -0
- package/dist/plugins/one-time-migration-marker.js +7 -0
- package/dist/plugins/one-time-migrations.d.ts +186 -45
- package/dist/plugins/one-time-migrations.js +442 -119
- package/dist/plugins/org-delivery-quota-store.js +2 -1
- package/dist/plugins/permission-rule-store-file.d.ts +3 -3
- package/dist/plugins/permission-rule-store-sql.d.ts +4 -63
- package/dist/plugins/permission-rule-store-sql.js +6 -86
- package/dist/plugins/pg-pool.d.ts +1 -31
- package/dist/plugins/pg-pool.js +16 -7
- package/dist/plugins/remote-env-e2b.d.ts +7 -25
- package/dist/plugins/remote-env-e2b.js +34 -25
- package/dist/plugins/remote-env-host.d.ts +2 -9
- package/dist/plugins/remote-env-host.js +34 -22
- package/dist/plugins/remote-env-k8s.d.ts +40 -45
- package/dist/plugins/remote-env-k8s.js +107 -58
- package/dist/plugins/remote-env-local-docker.d.ts +148 -14
- package/dist/plugins/remote-env-local-docker.js +367 -72
- package/dist/plugins/remote-scratchpad.js +4 -0
- package/dist/plugins/retention-deployment.d.ts +49 -17
- package/dist/plugins/retention-deployment.js +39 -8
- package/dist/plugins/run-preview-m45.d.ts +11 -0
- package/dist/plugins/run-preview-m45.js +19 -0
- package/dist/plugins/run-store-sql.d.ts +56 -68
- package/dist/plugins/run-store-sql.js +127 -116
- package/dist/plugins/s3-answer.d.ts +2 -1
- package/dist/plugins/sandbox-reaper.d.ts +26 -0
- package/dist/plugins/sandbox-reaper.js +2 -0
- package/dist/plugins/scenario-prefix-switch-m42.d.ts +54 -0
- package/dist/plugins/scenario-prefix-switch-m42.js +55 -0
- package/dist/plugins/scheduler-support.d.ts +16 -1
- package/dist/plugins/scheduler-support.js +22 -2
- package/dist/plugins/schema-consistency.d.ts +42 -9
- package/dist/plugins/schema-consistency.js +212 -11
- package/dist/plugins/schema-drift-sentence.d.ts +4 -1
- package/dist/plugins/schema-drift-sentence.js +4 -4
- package/dist/plugins/schema-ensure-legs.d.ts +9 -0
- package/dist/plugins/schema-ensure-legs.js +1 -1
- package/dist/plugins/schema-indexes.js +3 -0
- package/dist/plugins/schema-live-columns.d.ts +14 -5
- package/dist/plugins/schema-live-columns.js +10 -10
- package/dist/plugins/send-user-file.js +2 -1
- package/dist/plugins/session-birth.d.ts +37 -0
- package/dist/plugins/session-birth.js +38 -0
- package/dist/plugins/session-epoch-anchor.d.ts +40 -12
- package/dist/plugins/session-epoch-anchor.js +33 -11
- package/dist/plugins/session-ext-table.d.ts +27 -3
- package/dist/plugins/session-ext-table.js +19 -6
- package/dist/plugins/session-fork.d.ts +15 -1
- package/dist/plugins/session-fork.js +3 -0
- package/dist/plugins/session-ownership.d.ts +1 -1
- package/dist/plugins/session-placement.d.ts +22 -16
- package/dist/plugins/session-placement.js +15 -12
- package/dist/plugins/session-row-sql.d.ts +12 -0
- package/dist/plugins/session-row-sql.js +3 -3
- package/dist/plugins/session-run-rollup.d.ts +29 -0
- package/dist/plugins/session-run-rollup.js +40 -0
- package/dist/plugins/session-store-sql.d.ts +38 -12
- package/dist/plugins/session-store-sql.js +130 -30
- package/dist/plugins/session-withdraw-sql.d.ts +36 -0
- package/dist/plugins/session-withdraw-sql.js +42 -0
- package/dist/plugins/shared-memory-store-sql.d.ts +0 -69
- package/dist/plugins/shared-memory-store-sql.js +2 -1
- package/dist/plugins/shell-sentinel-owner-m48.d.ts +20 -0
- package/dist/plugins/shell-sentinel-owner-m48.js +3 -0
- package/dist/plugins/snapshot-bucket-presence.d.ts +2 -1
- package/dist/plugins/sql-driver.d.ts +1 -1
- package/dist/plugins/sql-driver.js +2 -1
- package/dist/plugins/sql-errors.d.ts +32 -5
- package/dist/plugins/sql-errors.js +55 -7
- package/dist/plugins/sql-json-column.d.ts +8 -7
- package/dist/plugins/sql-json-column.js +10 -6
- package/dist/plugins/store-backend.d.ts +84 -15
- package/dist/plugins/store-backend.js +186 -55
- package/dist/plugins/store-contracts.d.ts +90 -30
- package/dist/plugins/store-contracts.js +22 -1
- package/dist/plugins/store-fault.d.ts +28 -2
- package/dist/plugins/store-fault.js +20 -2
- package/dist/plugins/task-attachment-store.d.ts +15 -3
- package/dist/plugins/task-attachment-store.js +22 -9
- package/dist/plugins/tidb-pool.js +23 -8
- package/dist/plugins/web-search.js +5 -3
- package/dist/plugins/workflow-run-store-sql.d.ts +6 -1
- package/dist/plugins/workflow-run-store-sql.js +11 -5
- package/dist/principal-jwt.d.ts +4 -4
- package/dist/principal-jwt.js +20 -5
- package/dist/principal-shape.d.ts +41 -0
- package/dist/principal-shape.js +19 -0
- package/dist/question.d.ts +13 -23
- package/dist/question.js +21 -39
- package/dist/request-declaration-refusal.d.ts +35 -12
- package/dist/request-declaration-refusal.js +21 -9
- package/dist/request-form.d.ts +58 -0
- package/dist/request-form.js +72 -0
- package/dist/request-image-urls.d.ts +8 -2
- package/dist/request-image-urls.js +2 -1
- package/dist/request-images.d.ts +20 -0
- package/dist/request-images.js +59 -0
- package/dist/request-key-closure.d.ts +6 -7
- package/dist/request-key-closure.js +15 -2
- package/dist/resource-suspend.d.ts +7 -16
- package/dist/resource-suspend.js +1 -1
- package/dist/retired-name-host-notice.d.ts +21 -0
- package/dist/retired-name-host-notice.js +12 -0
- package/dist/rule-entry-list.d.ts +2 -2
- package/dist/rule-entry-list.js +3 -4
- package/dist/rule-issue-reading.d.ts +58 -0
- package/dist/rule-issue-reading.js +14 -0
- package/dist/rules-consent.d.ts +5 -3
- package/dist/rules-consent.js +1 -0
- package/dist/run-acceptance.d.ts +3 -1
- package/dist/run-acceptance.js +3 -0
- package/dist/run-local.d.ts +14 -6
- package/dist/run-local.js +92 -80
- package/dist/run-stale-default.d.ts +7 -0
- package/dist/run-stale-default.js +2 -0
- package/dist/runs.d.ts +26 -15
- package/dist/runs.js +39 -27
- package/dist/runtime-caps-resolver.d.ts +21 -6
- package/dist/runtime-caps-resolver.js +17 -4
- package/dist/runtime-governance.d.ts +2 -2
- package/dist/runtime-governance.js +5 -3
- package/dist/sealed-key-layout.d.ts +12 -5
- package/dist/sealed-key-layout.js +5 -0
- package/dist/sealed-key.d.ts +12 -2
- package/dist/sealed-key.js +115 -27
- package/dist/security.d.ts +128 -158
- package/dist/security.js +163 -59
- package/dist/sema-config-dir.d.ts +20 -0
- package/dist/sema-config-dir.js +25 -0
- package/dist/server-secret-env.d.ts +21 -5
- package/dist/server-secret-env.js +14 -4
- package/dist/session-children-retire.d.ts +7 -5
- package/dist/session-children-retire.js +7 -2
- package/dist/session-deletion.d.ts +88 -0
- package/dist/session-deletion.js +8 -0
- package/dist/session-erase.d.ts +145 -0
- package/dist/session-erase.js +115 -0
- package/dist/session-error-wire.d.ts +5 -5
- package/dist/session-error-wire.js +1 -1
- package/dist/session-incarnation.d.ts +52 -5
- package/dist/session-incarnation.js +19 -2
- package/dist/session-policy-wire.d.ts +6 -3
- package/dist/session-policy-wire.js +11 -1
- package/dist/session-resident-background.d.ts +0 -71
- package/dist/session-resident-background.js +4 -3
- package/dist/session-row.d.ts +2 -1
- package/dist/session-rules-seat.d.ts +12 -0
- package/dist/session-rules-seat.js +19 -0
- package/dist/session-titler.d.ts +7 -15
- package/dist/session-titler.js +1 -1
- package/dist/spec-fields.d.ts +57 -3
- package/dist/spec-fields.js +72 -51
- package/dist/store-posture.d.ts +136 -20
- package/dist/store-posture.js +188 -3
- package/dist/stored-request-hooks-m20.js +2 -2
- package/dist/stores-sql/background-agent-store-sql.d.ts +11 -2
- package/dist/stores-sql/background-agent-store-sql.js +73 -20
- package/dist/stores-sql/checkpoint-store-sql.d.ts +33 -28
- package/dist/stores-sql/checkpoint-store-sql.js +75 -44
- package/dist/stores-sql/mailbox-store-sql.d.ts +7 -4
- package/dist/stores-sql/mailbox-store-sql.js +31 -32
- package/dist/stores-sql/pg-session-storage.d.ts +7 -5
- package/dist/stores-sql/pg-session-storage.js +54 -46
- package/dist/stores-sql/retention-store-sql.d.ts +87 -19
- package/dist/stores-sql/retention-store-sql.js +92 -27
- package/dist/stores-sql/session-policy-store-sql.d.ts +32 -10
- package/dist/stores-sql/session-policy-store-sql.js +44 -36
- package/dist/stores-sql/session-write-hooks.d.ts +12 -6
- package/dist/stores-sql/tidb-session-storage.d.ts +4 -4
- package/dist/stores-sql/tidb-session-storage.js +13 -8
- package/dist/stores-sql/tidb-session-store.d.ts +36 -17
- package/dist/stores-sql/tidb-session-store.js +69 -39
- package/dist/stores-sql/windowed-session-storage.d.ts +5 -0
- package/dist/stores-sql/windowed-session-storage.js +9 -0
- package/dist/submission-exit.d.ts +50 -0
- package/dist/submission-exit.js +108 -0
- package/dist/task-a2a.d.ts +1 -1
- package/dist/task-a2a.js +3 -3
- package/dist/task-cwd.d.ts +20 -0
- package/dist/task-cwd.js +8 -0
- package/dist/task-mcp.d.ts +1 -1
- package/dist/task-mcp.js +3 -3
- package/dist/task-settings.d.ts +14 -10
- package/dist/task-settings.js +18 -7
- package/dist/terminal.d.ts +25 -43
- package/dist/terminal.js +31 -11
- package/dist/tool-approval.d.ts +131 -129
- package/dist/tool-approval.js +189 -193
- package/dist/trace/core-keyset-guard.d.ts +13 -6
- package/dist/trace/core-vocab-wire.d.ts +95 -0
- package/dist/trace/core-vocab-wire.js +15 -0
- package/dist/trace/exit-seat.d.ts +30 -4
- package/dist/trace/exit-seat.js +40 -36
- package/dist/trace/extension-call-face.d.ts +3 -2
- package/dist/trace/extension-call-face.js +3 -1
- package/dist/trace/ledger-events.d.ts +4 -7
- package/dist/trace/ledger-sink.d.ts +1 -30
- package/dist/trace/ledger-sink.js +0 -11
- package/dist/trace/model-segment.d.ts +5 -5
- package/dist/trace/model-segment.js +5 -5
- package/dist/trace/project.d.ts +55 -42
- package/dist/trace/project.js +52 -19
- package/dist/trace/redact.d.ts +123 -27
- package/dist/trace/redact.js +880 -260
- package/dist/trace/self-minted-wire.d.ts +487 -19
- package/dist/trace/self-minted-wire.js +172 -23
- package/dist/trace/wire-projection-faces.d.ts +5 -6
- package/dist/trace/wire-projection-faces.js +2 -2
- package/dist/upstream-body.d.ts +23 -0
- package/dist/upstream-body.js +16 -0
- package/dist/url-refusal.d.ts +3 -3
- package/dist/url-refusal.js +11 -4
- package/dist/user-authored-text.d.ts +1 -1
- package/dist/user-input-ledger.d.ts +7 -8
- package/dist/user-input-ledger.js +1 -1
- package/dist/web-admin-client/apply-effective.d.ts +6 -3
- package/dist/web-admin-client/apply-effective.js +13 -16
- package/dist/web-admin-client/apply-ledger.d.ts +16 -7
- package/dist/web-admin-client/apply-ledger.js +5 -2
- package/dist/web-admin-client/center-request.d.ts +2 -2
- package/dist/web-admin-client/center-request.js +15 -15
- package/dist/web-admin-client/effective-keys.d.ts +1 -1
- package/dist/web-admin-client/effective-keys.js +1 -1
- package/dist/web-admin-client/entry-metadata.d.ts +8 -0
- package/dist/web-admin-client/entry-metadata.js +13 -0
- package/dist/web-admin-client/http-client.d.ts +1 -1
- package/dist/web-admin-client/http-client.js +23 -4
- package/dist/web-admin-client/mcp-revocation.d.ts +1 -1
- package/dist/web-admin-client/mcp-revocation.js +2 -1
- package/dist/web-admin-client/read-warnings.d.ts +1 -0
- package/dist/web-admin-client/read-warnings.js +1 -0
- package/dist/web-admin-client/restart-signal.js +8 -4
- package/dist/web-admin-client/skills-mcp.d.ts +2 -2
- package/dist/web-admin-client/types.d.ts +1 -2
- package/dist/workspace-space.d.ts +3 -2
- package/docs/DEVICE-EXECUTOR-PROTOCOL.md +4 -4
- package/package.json +6 -3
- package/scripts/drain-check-local.mjs +118 -147
- package/scripts/drain-check.mysql.sql +22 -2
- package/scripts/drain-check.pg.sql +22 -2
- package/wire-changes/server@7.148.0.json +1517 -0
- package/dist/http/memory-control-plane-corrupt-reply.d.ts +0 -25
- package/dist/http/memory-control-plane-corrupt-reply.js +0 -19
- package/dist/http/memory-layer-reply.d.ts +0 -30
- package/dist/http/memory-layer-reply.js +0 -24
- package/dist/lsp/e2b-bridge.d.ts +0 -57
- package/dist/lsp/e2b-bridge.js +0 -139
- package/dist/lsp/e2b-manager.d.ts +0 -93
- package/dist/lsp/e2b-manager.js +0 -178
- package/dist/lsp/lsp-frames.d.ts +0 -14
- package/dist/lsp/lsp-frames.js +0 -25
- package/dist/lsp/manager.d.ts +0 -129
- package/dist/lsp/manager.js +0 -127
- package/dist/lsp/types.d.ts +0 -12
- package/dist/lsp/types.js +0 -2
- package/dist/lsp/ws-transport.d.ts +0 -40
- package/dist/lsp/ws-transport.js +0 -210
package/dist/config.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { writeLogText } from "./observability/logger.js";
|
|
1
2
|
import { readFileSync } from "node:fs";
|
|
2
3
|
import { DEFAULT_AT_MENTION, DEFAULT_MODEL_REF, mintCapabilityKeys } from "./model-select.js";
|
|
3
4
|
import { homedir } from "node:os";
|
|
4
5
|
import { isAbsolute, join, posix as posixPath } from "node:path";
|
|
5
6
|
import { fileURLToPath } from "node:url";
|
|
6
|
-
import { compileAllowList, inheritEnvPolicyProblem, BUILTIN_COMPLIANCE_DENIES, COMPLIANCE_CAPABILITIES, CROSS_SESSION_INBOUND_SETTINGS, CROSS_SESSION_DIALOG_EXPIRY_VALUES, compileReadDeny, resolveReadDenyBuiltins, isModelPriced, PROTOCOL_TABLE, RECOMMENDED_SENSITIVE_PATTERNS, judgeRuleToolName, resolveFileHistoryRetention, resolveLockedKeys, validatePermissionRules, WRITE_PROTECTED_DEFAULT_TABLE, resolveWriteProtectedTable, principalInboxConsumerOf, carriesCredential, isReplicableScope, resolveBashTimeoutCaps } from "@sema-agent/core";
|
|
7
|
+
import { hostOfUrl, HOST_UNREADABLE_SENTENCE, compileAllowList, inheritEnvPolicyProblem, BUILTIN_COMPLIANCE_DENIES, COMPLIANCE_CAPABILITIES, CROSS_SESSION_INBOUND_SETTINGS, CROSS_SESSION_DIALOG_EXPIRY_VALUES, compileReadDeny, resolveReadDenyBuiltins, isModelPriced, PROTOCOL_TABLE, RECOMMENDED_SENSITIVE_PATTERNS, judgeRuleToolName, resolveFileHistoryRetention, resolveLockedKeys, validatePermissionRules, WRITE_PROTECTED_DEFAULT_TABLE, resolveWriteProtectedTable, principalInboxConsumerOf, carriesCredential, isReplicableScope, resolveBashTimeoutCaps } from "@sema-agent/core";
|
|
7
8
|
import { ROSTER_PRIMARY_ROLES, ROSTER_CHEAP_ROLES, WEB_ADMIN_ENV, retiredEnvRefusal, stripControlAndBidi } from "@sema-agent/settings-schema";
|
|
8
9
|
import { parseApprovalHmacKeys, parsePrincipalJwks } from "./auth-keys.js";
|
|
9
10
|
import { DEFAULT_ELICITATION_THROTTLE } from "./elicitation.js";
|
|
@@ -24,11 +25,13 @@ import { ScopeId } from "@sema-agent/settings-schema/api/scopes";
|
|
|
24
25
|
import { centerLaneConfigured, pathBaseUrlRefusal } from "./web-admin-client/center-request.js";
|
|
25
26
|
import { resolveLocalDataRoot } from "./local-data-root.js";
|
|
26
27
|
import { buildWriteProtectionPosture } from "./write-protection.js";
|
|
28
|
+
import { RUN_STALE_SEC_DEFAULT } from "./run-stale-default.js";
|
|
27
29
|
import { normalizeSshFingerprint } from "./ssh-host-key.js";
|
|
28
|
-
import {
|
|
30
|
+
import { ASSUMED_CONTEXT_WINDOW } from "./model-context-window.js";
|
|
31
|
+
import { MODEL_THINKING_LEVELS, THINKING_LEVELS, THINKING_FORMATS, buildModelCompat, isModelThinkingLevel, isThinkingFormat, isThinkingTier } from "./model-compat.js";
|
|
29
32
|
import {} from "./posture-source.js";
|
|
30
33
|
import { COST_QUOTA_WINDOW_SEC_RANGE, costQuotaWindowSecInRange } from "./observability/cost-quota.js";
|
|
31
|
-
import { NAME_TABLE_BEHAVIOR, TOOL_NAME_ROSTER, describeUnmatchableRuleName,
|
|
34
|
+
import { NAME_TABLE_BEHAVIOR, TOOL_NAME_ROSTER, describeUnmatchableRuleName, isRetiredLeftOut, retiredLeftOutEntries, ruleEntryToolName, unmatchableRuleNameOf } from "./namespaced-rule-name.js";
|
|
32
35
|
import { bakeOperatorPrincipalsRefusal, bakeRunnerCredentialRefusal, centerIdentityRefusal, halfOpenDirectDoorRefusal, leaderDurableStoreRefusal, operatorPrincipalsRequiredRefusal, operatorSingleUserRefusal, remoteConfigProviderUrlRefusal, retentionLaneRefusal, workflowParkDecisionDomainRefusal } from "./config-invariants.js";
|
|
33
36
|
import { declaredSemaConfigDir } from "./sema-config-dir.js";
|
|
34
37
|
import { lkgPathOverrideOf } from "./config-lkg.js";
|
|
@@ -42,11 +45,12 @@ import { sandboxForwardedEnvOf } from "./execution-config-root.js";
|
|
|
42
45
|
import { SANDBOX_READ_FLOOR_DEFAULT, SANDBOX_READ_FLOOR_WORDS, laneMissingEnv, readDeclaredLaneTable } from "./execution-lane-caps.js";
|
|
43
46
|
import { MEMORY_ENGINE_BACKENDS, SESSION_BACKENDS, STORE_BACKENDS } from "@sema-agent/settings-schema/execution-lanes";
|
|
44
47
|
import { AUTONOMY_MODES } from "./runtime-governance.js";
|
|
48
|
+
import { deploymentRuleRefusal } from "./rule-issue-reading.js";
|
|
45
49
|
import { MAX_NAMED_INERT_ENTRIES, allowLayerEntryCountIssue, describeInertRuleEntries, inertRuleEntriesOf, inertRuleEntryGuidance, ruleEntryListShapeOk } from "./rule-entry-list.js";
|
|
46
50
|
import { readReadDenyEntry } from "./read-deny-entry.js";
|
|
47
51
|
import { createCenterCredentialSource, readCenterCredentialDeclaration } from "./center-credential.js";
|
|
48
52
|
import { parseCenterCredentialRenewLeadMs } from "./center-credential-renewer.js";
|
|
49
|
-
import { modelProviderRefusal } from "./model-provider.js";
|
|
53
|
+
import { catalogBrainLane, modelProviderRefusal } from "./model-provider.js";
|
|
50
54
|
import { modelRouteUrlRefusal } from "./model-route-url.js";
|
|
51
55
|
import { DEVICE_RELAY_NONE, DEVICE_RELAY_RULE, deviceRelayFlaws, httpUrlFlaws } from "@sema-agent/settings-schema";
|
|
52
56
|
import { buildHttpUrlRefusal, buildRefusalShownUrl } from "./url-refusal.js";
|
|
@@ -54,9 +58,10 @@ import { customPkgSourceFromEnv } from "./sandbox-pkg-source.js";
|
|
|
54
58
|
import { anthropicCredentialRefusal, csvOf, declaredCredential, envLaneTable, mintedCheapId, readModelRouteEnv } from "./model-route-gap.js";
|
|
55
59
|
import { displayListEntry } from "./list-entry-display.js";
|
|
56
60
|
import { echoCallerText } from "./caller-text-echo.js";
|
|
61
|
+
import { PRINCIPAL_MAX_BYTES, principalShapeProblem } from "./principal-shape.js";
|
|
57
62
|
import { buildDisplaySafeUrl, redactSecrets } from "./trace/redact.js";
|
|
58
63
|
import { parseConfigLocalOwnerUid } from "./config-dir-trust.js";
|
|
59
|
-
import { allowlistedEnv } from "./server-secret-env.js";
|
|
64
|
+
import { allowlistedEnv, ownCredentialDeclarationRefusal } from "./server-secret-env.js";
|
|
60
65
|
import { ENV_NAME_ALLOWLIST_KNOBS, ENV_NAME_ALLOWLIST_KNOB_NAMES, describeAllowlistPostures } from "./env-name-allowlist-knobs.js";
|
|
61
66
|
import { APPROVAL_ASK_RETENTION_DEFAULT_MS, APPROVAL_ASK_RETENTION_FLOOR_MS } from "./approval-ask-retention.js";
|
|
62
67
|
import { parseModsDeclaration } from "./mods-declaration.js";
|
|
@@ -170,6 +175,10 @@ function nonNegativeIntEnv(name, role, fallback = "0") {
|
|
|
170
175
|
throw new Error(`env ${name}=${n} must be an integer(${role};计数轴不接受小数——单位写漏了?)`);
|
|
171
176
|
return n;
|
|
172
177
|
}
|
|
178
|
+
function parseLocalDockerCapacityEnv() {
|
|
179
|
+
const maxContainers = nonNegativeIntEnv("DOCKER_MAX_CONTAINERS", "local-docker 车道同时在跑的容器数上限");
|
|
180
|
+
return maxContainers > 0 ? { maxContainers } : undefined;
|
|
181
|
+
}
|
|
173
182
|
function numEnvBounded(name, fallback, min, max) {
|
|
174
183
|
const n = numEnv(name, fallback);
|
|
175
184
|
if (n < min || n > max)
|
|
@@ -1061,13 +1070,22 @@ function parseModelDomain() {
|
|
|
1061
1070
|
}
|
|
1062
1071
|
const extraBody = buildExtraBody();
|
|
1063
1072
|
const thinkingDefault = parseDefaultThinking(process.env.MODEL_DEFAULT_THINKING);
|
|
1064
|
-
const
|
|
1073
|
+
const envLaneWire = ((lane) => {
|
|
1074
|
+
switch (lane) {
|
|
1075
|
+
case "anthropic":
|
|
1076
|
+
return { api: "anthropic-messages", promptCacheFamily: "input-excludes-cached" };
|
|
1077
|
+
case "gateway":
|
|
1078
|
+
return { api: "openai-completions", promptCacheFamily: "input-includes-cached" };
|
|
1079
|
+
}
|
|
1080
|
+
})(catalogBrainLane(provider));
|
|
1081
|
+
const envApi = envLaneWire.api;
|
|
1065
1082
|
const envCompatDeclared = buildModelCompat("openai-completions", {
|
|
1066
1083
|
reasoningEffortLevels: parseReasoningEffortLevels(csv("MODEL_REASONING_EFFORT_LEVELS")),
|
|
1067
1084
|
thinkingFormat: parseThinkingFormat(process.env.MODEL_THINKING_FORMAT),
|
|
1068
1085
|
});
|
|
1069
1086
|
const envCompat = envApi === "openai-completions" ? envCompatDeclared : undefined;
|
|
1070
1087
|
const modelCapability = { reasoning: parseBoolWord("MODEL_REASONING", process.env.MODEL_REASONING), vision: parseBoolWord("MODEL_VISION", process.env.MODEL_VISION) };
|
|
1088
|
+
const contextWindow = numEnv("MODEL_CONTEXT_WINDOW", String(ASSUMED_CONTEXT_WINDOW));
|
|
1071
1089
|
const model = {
|
|
1072
1090
|
id: modelId,
|
|
1073
1091
|
name: modelId,
|
|
@@ -1081,12 +1099,12 @@ function parseModelDomain() {
|
|
|
1081
1099
|
cacheRead: costEnv("MODEL_COST_CACHE_READ", "unset"),
|
|
1082
1100
|
cacheWrite: costEnv("MODEL_COST_CACHE_WRITE", "unset"),
|
|
1083
1101
|
}, undefined)),
|
|
1084
|
-
contextWindow
|
|
1102
|
+
contextWindow,
|
|
1085
1103
|
maxTokens: process.env.MODEL_MAX_TOKENS !== undefined && process.env.MODEL_MAX_TOKENS !== ""
|
|
1086
1104
|
? parseNumOrFail("MODEL_MAX_TOKENS", process.env.MODEL_MAX_TOKENS)
|
|
1087
|
-
: Math.min(32000,
|
|
1105
|
+
: Math.min(32000, contextWindow),
|
|
1088
1106
|
...(optFinitePositiveEnv("MODEL_CHARS_PER_TOKEN") !== undefined ? { charsPerToken: optFinitePositiveEnv("MODEL_CHARS_PER_TOKEN") } : {}),
|
|
1089
|
-
params: { promptCacheFamily:
|
|
1107
|
+
params: { promptCacheFamily: envLaneWire.promptCacheFamily },
|
|
1090
1108
|
...(thinkingDefault ? { defaultThinking: thinkingDefault } : {}),
|
|
1091
1109
|
...(envCompat ? { compat: envCompat } : {}),
|
|
1092
1110
|
...(extraBody ? { extraBody } : {}),
|
|
@@ -1249,11 +1267,9 @@ function parseDefaultThinking(raw) {
|
|
|
1249
1267
|
const v = raw?.trim();
|
|
1250
1268
|
if (v === undefined || v === "")
|
|
1251
1269
|
return undefined;
|
|
1252
|
-
if (v
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
throw new Error(`env MODEL_DEFAULT_THINKING="${v}" is not a thinking tier — valid: ${THINKING_LEVELS.join(" | ")} | off ` +
|
|
1256
|
-
`("off" = no model-level default). A typo used to be dropped SILENTLY, leaving the deployment on no default at all (#210 A 档).`);
|
|
1270
|
+
if (!isModelThinkingLevel(v)) {
|
|
1271
|
+
throw new Error(`env MODEL_DEFAULT_THINKING="${v}" is not a model thinking tier — valid: ${MODEL_THINKING_LEVELS.join(" | ")} ` +
|
|
1272
|
+
`("off" = the model's requests default to thinking off; leave it unset for no model-level default). A typo used to be dropped SILENTLY, leaving the deployment on no default at all (#210 A 档).`);
|
|
1257
1273
|
}
|
|
1258
1274
|
return v;
|
|
1259
1275
|
}
|
|
@@ -1263,7 +1279,7 @@ function parseReasoningEffortLevels(words) {
|
|
|
1263
1279
|
const bad = words.filter((w) => !isThinkingTier(w));
|
|
1264
1280
|
if (bad.length > 0) {
|
|
1265
1281
|
throw new Error(`env MODEL_REASONING_EFFORT_LEVELS has unknown tier(s): ${bad.join(", ")} (valid: ${THINKING_LEVELS.join(" | ")})` +
|
|
1266
|
-
`${bad.includes("off") ? ' — "off" belongs to MODEL_DEFAULT_THINKING (
|
|
1282
|
+
`${bad.includes("off") ? ' — "off" belongs to MODEL_DEFAULT_THINKING (the model default tier), it is not an effort tier an endpoint can accept' : ""}. ` +
|
|
1267
1283
|
`Bad words used to be dropped SILENTLY, narrowing the declared ladder without a word (#210 A 档).`);
|
|
1268
1284
|
}
|
|
1269
1285
|
return words.filter(isThinkingTier);
|
|
@@ -1301,7 +1317,7 @@ function uncompilableRuleGuidance(name, behavior, pathBases) {
|
|
|
1301
1317
|
const issue = issues[0];
|
|
1302
1318
|
if (issue === undefined)
|
|
1303
1319
|
return undefined;
|
|
1304
|
-
return
|
|
1320
|
+
return deploymentRuleRefusal(issue);
|
|
1305
1321
|
}
|
|
1306
1322
|
function findUnmatchableToolNames(names, opts) {
|
|
1307
1323
|
const out = [];
|
|
@@ -1315,7 +1331,7 @@ function findUnmatchableToolNames(names, opts) {
|
|
|
1315
1331
|
}
|
|
1316
1332
|
const subject = opts.consumer === "tool-name-table" ? name : ruleEntryToolName(name);
|
|
1317
1333
|
const judged = unmatchableRuleNameOf(subject, opts.behavior);
|
|
1318
|
-
const verdict = opts.noticeSeat !== undefined &&
|
|
1334
|
+
const verdict = opts.noticeSeat !== undefined && isRetiredLeftOut(name) ? undefined : judged;
|
|
1319
1335
|
if (verdict?.kind === "retired") {
|
|
1320
1336
|
out.push({ name, guidance: describeUnmatchableRuleName(verdict, subject), reason: verdict.kind });
|
|
1321
1337
|
continue;
|
|
@@ -1421,7 +1437,7 @@ function parseApprovalDomain(ctx) {
|
|
|
1421
1437
|
windowMsSource: streamAskWindowMsSource,
|
|
1422
1438
|
onPostureYield: (facts) => {
|
|
1423
1439
|
streamAskWindowMsEffectiveSource = "engine-default";
|
|
1424
|
-
|
|
1440
|
+
writeLogText("stderr", `[config] stream_ask_window_posture_yielded: the single-user posture default STREAM_ASK_WINDOW_MS=${facts.windowMs} would violate the explicit STREAM_APPROVAL_ORPHAN_TTL_MS=${facts.orphanTtlMs} (window + ADHOC_GRACE ${facts.adhocGraceMs} must be strictly less) — falling back to 300000; set STREAM_ASK_WINDOW_MS explicitly to choose`);
|
|
1425
1441
|
},
|
|
1426
1442
|
});
|
|
1427
1443
|
const directApprovalDoor = boolEnv("DIRECT_APPROVAL_DOOR", false);
|
|
@@ -1431,7 +1447,7 @@ function parseApprovalDomain(ctx) {
|
|
|
1431
1447
|
const unmatchable = unmatchableToolNamesRefusal(envName, names, { consumer: "tool-name-table", behavior: NAME_TABLE_BEHAVIOR, noticeSeat: "server" });
|
|
1432
1448
|
if (unmatchable !== undefined)
|
|
1433
1449
|
throw new Error(unmatchable.message);
|
|
1434
|
-
const skipped =
|
|
1450
|
+
const skipped = retiredLeftOutEntries(envName, names);
|
|
1435
1451
|
if (skipped.length > 0) {
|
|
1436
1452
|
CONFIG_NOTICES.push({
|
|
1437
1453
|
level: "warn",
|
|
@@ -2009,13 +2025,8 @@ function parseOrchestrationDomain(ctx) {
|
|
|
2009
2025
|
const bakeRunnerPrincipal = env("BAKE_RUNNER_PRINCIPAL", "system:bake-runner");
|
|
2010
2026
|
hostBackgroundShellEnabled();
|
|
2011
2027
|
hostExecSpoolEnabled();
|
|
2012
|
-
const lspHostEnabled = (
|
|
2013
|
-
|
|
2014
|
-
throw new Error("LSP_ENABLED=false no longer drives the HOST lane (removed in server 3.0.0) — set LSP_HOST_ENABLED=false " +
|
|
2015
|
-
"for the host lane; LSP_ENABLED remains the SANDBOX-lane opt-in only (migration table in USAGE.md)");
|
|
2016
|
-
}
|
|
2017
|
-
return boolEnv("LSP_HOST_ENABLED", true);
|
|
2018
|
-
})();
|
|
2028
|
+
const lspHostEnabled = boolEnv("LSP_HOST_ENABLED", true);
|
|
2029
|
+
const autoBackgroundOnTimeout = boolEnv("AUTO_BACKGROUND_ON_TIMEOUT", true);
|
|
2019
2030
|
const lspEnvAllow = parseEnvNameAllowlist("LSP_ENV_ALLOW", singleUserTurnkey) ?? [];
|
|
2020
2031
|
const declaredLane = declaredExecutionLane(process.env.REMOTE_EXEC);
|
|
2021
2032
|
const readFaceFacts = process.env.READ_FACE !== undefined
|
|
@@ -2121,6 +2132,7 @@ function parseOrchestrationDomain(ctx) {
|
|
|
2121
2132
|
: {}),
|
|
2122
2133
|
...((n) => (n !== undefined ? { commandTimeoutMs: n } : {}))(optNumEnvStrict("DOCKER_COMMAND_TIMEOUT_MS")),
|
|
2123
2134
|
...((names) => (names !== undefined ? { env: allowlistedEnv(names, process.env) } : {}))(parseEnvNameAllowlist("DOCKER_SANDBOX_ENV", singleUserTurnkey)),
|
|
2135
|
+
...((capacity) => (capacity !== undefined ? { capacity } : {}))(parseLocalDockerCapacityEnv()),
|
|
2124
2136
|
}
|
|
2125
2137
|
:
|
|
2126
2138
|
declaredLane === "device"
|
|
@@ -2188,8 +2200,8 @@ function parseOrchestrationDomain(ctx) {
|
|
|
2188
2200
|
selectEnvironmentTool: boolEnv("SELECT_ENVIRONMENT_TOOL", true),
|
|
2189
2201
|
envFactsEnabled: boolEnv("SANDBOX_ENV_FACTS", true),
|
|
2190
2202
|
toolDeferLongtail: boolEnv("TOOL_DEFER_LONGTAIL", false),
|
|
2191
|
-
lspEnabled: boolEnv("LSP_ENABLED", false),
|
|
2192
2203
|
lspHostEnabled,
|
|
2204
|
+
autoBackgroundOnTimeout,
|
|
2193
2205
|
lspEnvAllow,
|
|
2194
2206
|
workflowAgentsReadOnly: boolEnv("WORKFLOW_AGENTS_READONLY", false),
|
|
2195
2207
|
imageBakes: {
|
|
@@ -2274,7 +2286,7 @@ function parseLimitsHttpDomain() {
|
|
|
2274
2286
|
return sec;
|
|
2275
2287
|
})(),
|
|
2276
2288
|
reapIntervalSec: numEnv("REAP_INTERVAL_SEC", "60"),
|
|
2277
|
-
runStaleSec: numEnv("REAP_RUN_STALE_SEC",
|
|
2289
|
+
runStaleSec: numEnv("REAP_RUN_STALE_SEC", String(RUN_STALE_SEC_DEFAULT)),
|
|
2278
2290
|
toolResultTtlSec: (() => {
|
|
2279
2291
|
const ttl = numEnv("TOOL_RESULT_TTL_SEC", "86400");
|
|
2280
2292
|
if (ttl <= 0) {
|
|
@@ -2315,7 +2327,11 @@ function parseGitApiKind(raw, baseUrl) {
|
|
|
2315
2327
|
throw new Error(`GIT_API_BASEURL="${buildDisplaySafeUrl(baseUrl)}" is not a valid URL (expected e.g. https://git.example.com)`);
|
|
2316
2328
|
}
|
|
2317
2329
|
const u = new URL(baseUrl);
|
|
2318
|
-
const
|
|
2330
|
+
const reading = hostOfUrl(baseUrl);
|
|
2331
|
+
if ("unreadable" in reading) {
|
|
2332
|
+
throw new Error(`GIT_API_BASEURL names no host — ${HOST_UNREADABLE_SENTENCE[reading.unreadable]} (expected e.g. https://git.example.com; the token goes in GIT_API_TOKEN)`);
|
|
2333
|
+
}
|
|
2334
|
+
const host = reading.host;
|
|
2319
2335
|
const githubFamily = host === "github.com" || host === "api.github.com" || host.endsWith(".github.com");
|
|
2320
2336
|
if (kind === "gitea" && githubFamily) {
|
|
2321
2337
|
throw new Error(`GIT_API_BASEURL points at ${host} but GIT_API_KIND is "gitea" — the Gitea API shapes 404 on GitHub. Set GIT_API_KIND=github (base url should be https://api.github.com, or your GHE /api/v3 root).`);
|
|
@@ -2504,6 +2520,11 @@ function parseA2aServe() {
|
|
|
2504
2520
|
blockingWaitMs: numEnvBounded("A2A_SERVE_BLOCKING_WAIT_MS", "45000", 0, 300_000),
|
|
2505
2521
|
};
|
|
2506
2522
|
}
|
|
2523
|
+
const A2A_SERVE_SKILLS_VERSION = 2;
|
|
2524
|
+
const A2A_SERVE_SKILL_KEYS = ["id", "name", "description", "scenario", "audience"];
|
|
2525
|
+
const A2A_SERVE_SKILL_ENTRY_SHAPE = "{id, name?, description?, scenario, audience?}";
|
|
2526
|
+
const A2A_SERVE_SKILLS_SHAPE = `{"version":${A2A_SERVE_SKILLS_VERSION},"skills":[${A2A_SERVE_SKILL_ENTRY_SHAPE}, …]}`;
|
|
2527
|
+
const A2A_SERVE_MAX_AUDIENCE = 64;
|
|
2507
2528
|
function parseA2aServeSkills(raw) {
|
|
2508
2529
|
if (raw === undefined || raw.trim() === "")
|
|
2509
2530
|
return [];
|
|
@@ -2512,18 +2533,38 @@ function parseA2aServeSkills(raw) {
|
|
|
2512
2533
|
parsed = JSON.parse(raw);
|
|
2513
2534
|
}
|
|
2514
2535
|
catch (e) {
|
|
2515
|
-
throw new Error(`A2A_SERVE_SKILLS must be a JSON
|
|
2516
|
-
}
|
|
2517
|
-
if (
|
|
2518
|
-
throw new Error(`A2A_SERVE_SKILLS
|
|
2519
|
-
|
|
2520
|
-
|
|
2536
|
+
throw new Error(`A2A_SERVE_SKILLS must be a JSON object ${A2A_SERVE_SKILLS_SHAPE} — it did not parse as JSON (${e.message})`);
|
|
2537
|
+
}
|
|
2538
|
+
if (Array.isArray(parsed)) {
|
|
2539
|
+
throw new Error(`A2A_SERVE_SKILLS is a bare JSON array — that form is retired: the value is now a versioned envelope ${A2A_SERVE_SKILLS_SHAPE}. ` +
|
|
2540
|
+
`Migrate by wrapping the old value unchanged: {"version":${A2A_SERVE_SKILLS_VERSION},"skills":<the old array>} (an \`audience\` member is only read inside the envelope).`);
|
|
2541
|
+
}
|
|
2542
|
+
if (typeof parsed !== "object" || parsed === null)
|
|
2543
|
+
throw new Error(`A2A_SERVE_SKILLS must be a JSON object ${A2A_SERVE_SKILLS_SHAPE}; got ${parsed === null ? "null" : typeof parsed}`);
|
|
2544
|
+
const envelope = parsed;
|
|
2545
|
+
for (const key of Object.keys(envelope)) {
|
|
2546
|
+
if (key !== "version" && key !== "skills")
|
|
2547
|
+
throw new Error(`A2A_SERVE_SKILLS carries an unknown key ${JSON.stringify(key.slice(0, 64))} — the envelope's keys are exactly "version" and "skills"`);
|
|
2548
|
+
}
|
|
2549
|
+
if (envelope.version !== A2A_SERVE_SKILLS_VERSION) {
|
|
2550
|
+
throw new Error(`A2A_SERVE_SKILLS.version must be the number ${A2A_SERVE_SKILLS_VERSION} — this build reads exactly that envelope version (a different or missing version is refused rather than guessed: the version is what keeps a build from misreading a shape it does not know)`);
|
|
2551
|
+
}
|
|
2552
|
+
const skills = envelope.skills;
|
|
2553
|
+
if (!Array.isArray(skills))
|
|
2554
|
+
throw new Error(`A2A_SERVE_SKILLS.skills must be a JSON array of ${A2A_SERVE_SKILL_ENTRY_SHAPE} objects`);
|
|
2555
|
+
if (skills.length > A2A_SERVE_MAX_SKILLS)
|
|
2556
|
+
throw new Error(`A2A_SERVE_SKILLS declares ${skills.length} skills — at most ${A2A_SERVE_MAX_SKILLS} are accepted (the card is a public document fetched by anonymous callers)`);
|
|
2521
2557
|
const seen = new Set();
|
|
2522
|
-
return
|
|
2523
|
-
const at = `A2A_SERVE_SKILLS[${i}]`;
|
|
2558
|
+
return skills.map((entry, i) => {
|
|
2559
|
+
const at = `A2A_SERVE_SKILLS.skills[${i}]`;
|
|
2524
2560
|
if (typeof entry !== "object" || entry === null || Array.isArray(entry))
|
|
2525
|
-
throw new Error(`${at} must be an object {
|
|
2561
|
+
throw new Error(`${at} must be an object ${A2A_SERVE_SKILL_ENTRY_SHAPE}`);
|
|
2526
2562
|
const e = entry;
|
|
2563
|
+
for (const key of Object.keys(e)) {
|
|
2564
|
+
if (!A2A_SERVE_SKILL_KEYS.includes(key)) {
|
|
2565
|
+
throw new Error(`${at} carries an unknown key ${JSON.stringify(key.slice(0, 64))} — an entry's keys are exactly ${A2A_SERVE_SKILL_KEYS.map((k) => JSON.stringify(k)).join(", ")} (an unknown key is refused, never dropped: a misspelt "audience" would otherwise publish the skill to everyone)`);
|
|
2566
|
+
}
|
|
2567
|
+
}
|
|
2527
2568
|
const str = (key, required, max) => {
|
|
2528
2569
|
const v = e[key];
|
|
2529
2570
|
if (v === undefined) {
|
|
@@ -2544,7 +2585,36 @@ function parseA2aServeSkills(raw) {
|
|
|
2544
2585
|
const name = str("name", false, A2A_SERVE_MAX_TEXT_CHARS);
|
|
2545
2586
|
const description = str("description", false, A2A_SERVE_MAX_TEXT_CHARS);
|
|
2546
2587
|
const scenario = str("scenario", true, A2A_SERVE_MAX_ID_CHARS);
|
|
2547
|
-
|
|
2588
|
+
const audience = parseA2aServeAudience(e.audience, at);
|
|
2589
|
+
return { id, ...(name !== undefined ? { name } : {}), ...(description !== undefined ? { description } : {}), scenario, ...(audience !== undefined ? { audience } : {}) };
|
|
2590
|
+
});
|
|
2591
|
+
}
|
|
2592
|
+
function parseA2aServeAudience(v, at) {
|
|
2593
|
+
if (v === undefined)
|
|
2594
|
+
return undefined;
|
|
2595
|
+
const rule = `must be a non-empty JSON array of at most ${A2A_SERVE_MAX_AUDIENCE} principal names (omit the key to publish the skill to every caller)`;
|
|
2596
|
+
if (!Array.isArray(v) || v.length === 0)
|
|
2597
|
+
throw new Error(`${at}.audience ${rule}`);
|
|
2598
|
+
if (v.length > A2A_SERVE_MAX_AUDIENCE)
|
|
2599
|
+
throw new Error(`${at}.audience lists ${v.length} principals — it ${rule}`);
|
|
2600
|
+
return v.map((item, j) => {
|
|
2601
|
+
if (typeof item !== "string")
|
|
2602
|
+
throw new Error(`${at}.audience[${j}] must be a string (a principal name)`);
|
|
2603
|
+
const problem = principalShapeProblem(item);
|
|
2604
|
+
switch (problem) {
|
|
2605
|
+
case undefined:
|
|
2606
|
+
return item;
|
|
2607
|
+
case "not_a_name":
|
|
2608
|
+
throw new Error(`${at}.audience[${j}] is not a principal name (empty, or carries characters no verified identity can have) — list the exact principal names this skill is published to`);
|
|
2609
|
+
case "reserved":
|
|
2610
|
+
throw new Error(`${at}.audience[${j}] is a reserved internal identifier (an internal scope sentinel or a reserved prefix), which no caller can authenticate as — list real principal names`);
|
|
2611
|
+
case "too_long":
|
|
2612
|
+
throw new Error(`${at}.audience[${j}] exceeds ${PRINCIPAL_MAX_BYTES} UTF-8 bytes, longer than any principal a caller can authenticate as`);
|
|
2613
|
+
default: {
|
|
2614
|
+
const unknownProblem = problem;
|
|
2615
|
+
throw new Error(`${at}.audience[${j}]: unknown principal-shape verdict ${String(unknownProblem)}`);
|
|
2616
|
+
}
|
|
2617
|
+
}
|
|
2548
2618
|
});
|
|
2549
2619
|
}
|
|
2550
2620
|
const STORE_GROUP_KEYS = [
|
|
@@ -2580,7 +2650,7 @@ const ORCHESTRATION_GROUP_KEYS = [
|
|
|
2580
2650
|
"workflowOrphanGraceMs", "workflowJournalRetentionMs", "workflowRunRetentionMs", "usageWindows", "workflowAgentsReadOnly",
|
|
2581
2651
|
"workflowSizeGuideline", "backgroundAgentRetentionMs", "backgroundAgentStaleRunningMs", "backgroundAgentStallMs",
|
|
2582
2652
|
"backgroundAgentParkClaimStaleMs", "delegationEntryCaps", "rosterRetentionMs", "leaderRunStaleMs", "scratchpadSweepTtlMs", "sandboxPkgSource", "sandboxPkgSourceCustom",
|
|
2583
|
-
"sessionAutoTitle", "sessionAutoTitleSource", "selectEnvironmentTool", "envFactsEnabled", "toolDeferLongtail", "
|
|
2653
|
+
"sessionAutoTitle", "sessionAutoTitleSource", "selectEnvironmentTool", "envFactsEnabled", "toolDeferLongtail", "lspHostEnabled", "lspEnvAllow", "autoBackgroundOnTimeout",
|
|
2584
2654
|
"imageBakes", "readFace", "readFaceSource", "taskWriteFaceEscalation", "readDenyPatterns", "readDenyBuiltinTiers", "readDenyBuiltinExclude", "readDenyFloorRequired", "sandboxReadFloor",
|
|
2585
2655
|
"agentConfigDir", "configLkgPath", "configLkgEnabled",
|
|
2586
2656
|
];
|
|
@@ -2705,6 +2775,9 @@ function k8sWorkspaceCache() {
|
|
|
2705
2775
|
return { mount, size };
|
|
2706
2776
|
}
|
|
2707
2777
|
export function loadConfig() {
|
|
2778
|
+
const undeclared = ownCredentialDeclarationRefusal();
|
|
2779
|
+
if (undeclared !== undefined)
|
|
2780
|
+
throw new Error(undeclared);
|
|
2708
2781
|
rejectRetiredEnvs();
|
|
2709
2782
|
CONFIG_WARNINGS.length = 0;
|
|
2710
2783
|
CONFIG_NOTICES.length = 0;
|
|
@@ -2816,11 +2889,4 @@ export function splitLocalRoots(a) {
|
|
|
2816
2889
|
return undefined;
|
|
2817
2890
|
return { dataRoot: a.localDataRoot, configRoot };
|
|
2818
2891
|
}
|
|
2819
|
-
export function resolveBindHost(config) {
|
|
2820
|
-
const anyServiceAuth = Boolean(config.authToken) || Object.keys(config.authTokens ?? {}).length > 0;
|
|
2821
|
-
const mustNarrow = Boolean(config.allowUnauthedWrites) && !anyServiceAuth;
|
|
2822
|
-
if (config.bindHost && !(mustNarrow && config.bindHostSource === "HOST"))
|
|
2823
|
-
return config.bindHost;
|
|
2824
|
-
return mustNarrow ? "127.0.0.1" : undefined;
|
|
2825
|
-
}
|
|
2826
2892
|
//# sourceMappingURL=config.js.map
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
import type { SessionPlacement } from "@sema-agent/core";
|
|
30
30
|
import type { SessionFace } from "./session-incarnation.js";
|
|
31
31
|
import type { SqlDialect } from "./plugins/sql-driver.js";
|
|
32
|
-
/** 孤行哨兵属主的前缀(保留主体前缀:`
|
|
32
|
+
/** 孤行哨兵属主的前缀(保留主体前缀:`principal-shape.ts` 的 `RESERVED_PRINCIPAL_PREFIXES` 登记它,任何身份来源报出带它的主体都在鉴权边界被拒)。 */
|
|
33
33
|
export declare const ORPHAN_SESSION_OWNER_PREFIX = "_orphan:";
|
|
34
34
|
/** 一只推不出属主的子代会话的哨兵属主(每只会话一个值:即便哪天有谁误配出这个串,也只够得着这一只)。 */
|
|
35
35
|
export declare function orphanSessionOwner(sessionId: string): string;
|
|
@@ -2,10 +2,11 @@ import type { DeploymentShapeInput } from "./deployment-shape.js";
|
|
|
2
2
|
/** 表的条数上限(一条约百字节量级)。引擎的会话暂存自己按会话数有上限(超了整会话驱逐最旧);本表的上限比它宽得多。 */
|
|
3
3
|
export declare const DELETED_SESSION_ID_CAP = 50000;
|
|
4
4
|
/**
|
|
5
|
-
* **铸点**(
|
|
5
|
+
* **铸点**(唯一的函数;两处调用者):本进程的在线删除协调器在删除会话本体之前记一笔 —— 围栏先立,id 才空出来;提交出口撤回一只被拒提交铸下的会话之后同步记一笔
|
|
6
|
+
* (`submission-exit.ts`,判撤才记)。删除随后失败也无害:
|
|
6
7
|
* 这一笔只拒「别的属主」,而会话还在时别的属主本来就用不了它。
|
|
7
8
|
* 同一只 id 再删一次:这一次的删前属主对已记的每一位都等价(同一只等价律判)⇒ 收进集合(前几位一位不丢 —— 等价律有方向、不传递,只记最新一位会让
|
|
8
|
-
*
|
|
9
|
+
* 「无主删 → `default` 重登再删 → 无主体的调用方用」绕过「`default` 的行 ≢ 无主体的调用方」);对某一位不等价 ⇒ 记成「谁都不是」。后一次删除从不覆盖前一位(前一位的暂存仍可能在本进程)。
|
|
9
10
|
* `deployment` = 部署形(等价律的窄互认臂读它;调用方递 `ServiceConfig` 整份)。
|
|
10
11
|
*/
|
|
11
12
|
export declare function retireSessionId(sessionId: string, owner: string | null, deployment: DeploymentShapeInput<"principal">): void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FileError, StubExecutionEnv, type ExecutionEnv, type PathFamily, type Result, type ToolPolicy } from "@sema-agent/core";
|
|
2
|
-
import { type
|
|
2
|
+
import { type SessionExemptionRead } from "./approval.js";
|
|
3
3
|
import type { ServiceConfig } from "./config.js";
|
|
4
4
|
import type { applyRuntimeGovernance } from "./runtime-governance.js";
|
|
5
5
|
/** `applyRuntimeGovernance` 的 governance 实参 —— 从折叠属主的签名位**推导**,不复制形状
|
|
@@ -84,8 +84,8 @@ export interface DurableApprovalSeat {
|
|
|
84
84
|
readonly kind: "durable";
|
|
85
85
|
/** 活体问答面;`undefined` ⇒ 恒 durable park 的原形门。 */
|
|
86
86
|
readonly question: LiveQuestionFace | undefined;
|
|
87
|
-
/** 本会话的「本会话放行」读面(部署名单那一问的站着的答案;铸点 `approval.ts` 的 `
|
|
88
|
-
readonly exemption?:
|
|
87
|
+
/** 本会话的「本会话放行」读面(部署名单那一问的站着的答案;铸点 `approval.ts` 的 `createSessionExemptionRead`)。缺席 = 这条腿没有会话 / 没有豁免店 ⇒ 名单照问。 */
|
|
88
|
+
readonly exemption?: SessionExemptionRead;
|
|
89
89
|
}
|
|
90
90
|
/** live 席:Runner 的活 onAsk 当场服 ask(无 park、无会话豁免店:run-local 一次性腿)。 */
|
|
91
91
|
export interface LiveApprovalSeat {
|
|
@@ -6,8 +6,9 @@
|
|
|
6
6
|
* `DEPLOYMENT_SHAPE_PREDICATES.<行>.holds(config)`,不 import 散落函数;表外不许再长出一只自读部署形事实的布尔判据
|
|
7
7
|
* (反向门 `test/deployment-shape-gate.test.ts` 按语法树判,判据逐字写在那份门的头注里)。
|
|
8
8
|
*
|
|
9
|
-
* ##
|
|
9
|
+
* ## 三根轴,每根轴一个读口(原始配置键只在这三个函数里被读)
|
|
10
10
|
* · `principal` —— 运维的 `REQUIRE_PRINCIPAL` 声明({@link readPrincipalAxis})。
|
|
11
|
+
* · `identity` —— 这台部署在**配置**上接了哪几个已验身份来源(唯一读法 `configuredIdentitySources`,`identity-source.ts`)+ 有没有声明只读 trace 凭据({@link readIdentityAxis})。
|
|
11
12
|
* · `lane` —— `REMOTE_EXEC` 的归一车道词(`executionLaneOf`,认不出 ⇒ `undefined`,行必须 fail-closed)+ 那条车道的能力表行 +
|
|
12
13
|
* 这份部署上执行环境的能力块(唯一作者 `capabilitiesFor`;k8s 的快照店是它的输入)+ 车道子旋钮(k8s 运行时类)({@link readLaneAxis})。
|
|
13
14
|
*
|
|
@@ -16,15 +17,16 @@
|
|
|
16
17
|
* `holds` 的入参型 = 所声明轴读入形的交叉({@link DeploymentShapeInput}),所以调用方递完整 `ServiceConfig` 或只递那几键的窄形都行。
|
|
17
18
|
*
|
|
18
19
|
* ## 什么进表、什么不进
|
|
19
|
-
* 进表的是**形规则**:只由部署形事实决定的布尔(去重后
|
|
20
|
+
* 进表的是**形规则**:只由部署形事实决定的布尔(去重后 15 行;同一条规则的多个消费者读同一行,不各成一行)。
|
|
20
21
|
* 把一行与**非形事实**(锁键、合规档位、审批意图、请求身份、请求体)合取的能力判据是**消费者**,住在它自己的模块
|
|
21
22
|
* (`mcpInjectionHonored` = 锁 ∧ 合规 ∧ `!multiTenant`;`taskHooksHonored`;身份门 …),读行、不读原始键。
|
|
22
23
|
* 车道表(`execution-lane-caps.ts`)按车道词键控的布尔列(`laneIsolated` 等)是车道轴自己的事实表,不是「部署」的谓词;行读它们。
|
|
23
24
|
*
|
|
24
|
-
* 依赖纪律:叶模块 —— 值导入只有 `execution-lane-caps.ts`(
|
|
25
|
+
* 依赖纪律:叶模块 —— 值导入只有 `execution-lane-caps.ts` 与 `identity-source.ts`(两者本身是叶),零运行期环(引擎只 type-import)。
|
|
25
26
|
*/
|
|
26
27
|
import type { ExecutionEnvCapabilities } from "@sema-agent/core";
|
|
27
28
|
import { type ExecutionLane, type ExecutionLaneCaps } from "./execution-lane-caps.js";
|
|
29
|
+
import { type IdentitySource, type IdentitySourceConfig } from "./identity-source.js";
|
|
28
30
|
/** `principal` 轴读的配置键(`ServiceConfig` 结构上满足)。 */
|
|
29
31
|
export interface PrincipalAxisInput {
|
|
30
32
|
readonly requirePrincipal?: boolean | undefined;
|
|
@@ -34,6 +36,17 @@ export interface PrincipalAxisFacts {
|
|
|
34
36
|
/** 运维声明了 `REQUIRE_PRINCIPAL=true`。 */
|
|
35
37
|
readonly declared: boolean;
|
|
36
38
|
}
|
|
39
|
+
/** `identity` 轴读的配置键(`ServiceConfig` 结构上满足):身份来源的配置面 + 只读 trace 凭据。 */
|
|
40
|
+
export interface IdentityAxisInput extends IdentitySourceConfig {
|
|
41
|
+
readonly traceToken?: string | undefined;
|
|
42
|
+
}
|
|
43
|
+
/** `identity` 轴的事实。 */
|
|
44
|
+
export interface IdentityAxisFacts {
|
|
45
|
+
/** 配置接了线的已验身份来源(`configuredIdentitySources`,序同 `IDENTITY_SOURCES`)。鉴权桥那一格 = 配置里有 issuer(显式或中心回退)—— 验签器由起服第 9 段按同一个读数建。 */
|
|
46
|
+
readonly sources: readonly IdentitySource[];
|
|
47
|
+
/** 声明了只读 trace 凭据(不是身份来源:它不验任何主体,但这台部署因此有一道凭据门)。 */
|
|
48
|
+
readonly traceTokenDeclared: boolean;
|
|
49
|
+
}
|
|
37
50
|
/** `lane` 轴读的配置键:**已合成**的 `remoteExec` 里本表用得到的那几键(`ServiceConfig` 的判别联合每一臂结构上都满足;车道必在 ——
|
|
38
51
|
* 没有声明的部署在执行车道合成步拒启)。`provider` 收开放串:手搓的部署形 / 外部输入上认不出的词 ⇒ 行在 `lane` 那一格 fail-closed。 */
|
|
39
52
|
export interface LaneAxisInput {
|
|
@@ -60,6 +73,10 @@ interface AxisShapes {
|
|
|
60
73
|
readonly input: PrincipalAxisInput;
|
|
61
74
|
readonly facts: PrincipalAxisFacts;
|
|
62
75
|
};
|
|
76
|
+
readonly identity: {
|
|
77
|
+
readonly input: IdentityAxisInput;
|
|
78
|
+
readonly facts: IdentityAxisFacts;
|
|
79
|
+
};
|
|
63
80
|
readonly lane: {
|
|
64
81
|
readonly input: LaneAxisInput;
|
|
65
82
|
readonly facts: LaneAxisFacts;
|
|
@@ -86,6 +103,14 @@ export interface DeploymentShapePredicate<A extends DeploymentShapeAxis> {
|
|
|
86
103
|
export declare const DEPLOYMENT_SHAPE_PREDICATES: Readonly<{
|
|
87
104
|
/** 身份门的问法。读者:请求面的身份 / 属主门(`http/principal-gate.ts`、`http/request-guards.ts`、`security.ts`)。 */
|
|
88
105
|
principalRequired: DeploymentShapePredicate<"principal">;
|
|
106
|
+
/**
|
|
107
|
+
* 「这台部署有没有身份边界」的问法 —— 有 = 请求里有东西替主体作保或拦在门外:声明了 `REQUIRE_PRINCIPAL`,或配置接了任一已验身份来源
|
|
108
|
+
* (service 凭据 / 鉴权桥 issuer,含中心回退 / 直连门),或声明了只读 trace 凭据。没有 = dev-open:主体头是谁都能自报的标签。
|
|
109
|
+
* 只读配置(验签器在起服第 9 段按同一个配置读数建 ⇒「验签器在场」≡「配置里有桥」),所以先于验签器的起服段(第 3 段的一次性迁移)与请求面读到同一个答案。
|
|
110
|
+
* 读者:请求面的 dev-open 判据(`http/principal-gate.ts` 的 `devOpenDeployment`:属主存取器的 fleet 一格与 `/metrics` 族的免凭据臂)、
|
|
111
|
+
* 一次性迁移 M48 的输入(`plugins/store-backend.ts`:有边界 ⇒ 不改写哨兵属主)。
|
|
112
|
+
*/
|
|
113
|
+
identityBoundary: DeploymentShapePredicate<"identity" | "principal">;
|
|
89
114
|
/**
|
|
90
115
|
* 租户轴的问法。今天与 {@link DEPLOYMENT_SHAPE_PREDICATES.principalRequired} 读**同一个声明**([ref] ①:托管 / 多租 ⇔ `REQUIRE_PRINCIPAL=true`,
|
|
91
116
|
* 签发方配置是身份验签轴、不算租户证据)—— 两个问题、一根轴、一个读口;「鉴权必需」与「多租形」拆成两个声明时只改这一行的判官。
|
|
@@ -93,7 +118,8 @@ export declare const DEPLOYMENT_SHAPE_PREDICATES: Readonly<{
|
|
|
93
118
|
multiTenant: DeploymentShapePredicate<"principal">;
|
|
94
119
|
/** 读能力表 `callerCwd` 位(host = 单主才开;device = 路径落在发起者自己的设备上,归属由根会话行执行格上的设备绑定验过,不要求单主)。 */
|
|
95
120
|
callerCwd: DeploymentShapePredicate<"lane" | "principal">;
|
|
96
|
-
/** 调用方给的宿主绝对路径(附加目录 / 项目上下文 / 本机 SendUserFile / 指令文件探针)只在「手就在本 worker 的盘上 ∧
|
|
121
|
+
/** 调用方给的宿主绝对路径(附加目录 / 项目上下文 / 本机 SendUserFile / 指令文件探针)只在「手就在本 worker 的盘上 ∧ 单主」时指向调用方自己的东西;
|
|
122
|
+
* 本机语言服务器(`createLspManager`:本机子进程、在 worker 盘上找根)同问这一句,读这一行 × `LSP_HOST_ENABLED`。 */
|
|
97
123
|
callerOwnsWorkerDisk: DeploymentShapePredicate<"lane" | "principal">;
|
|
98
124
|
/** wire `executionLane.toolsOnThisHost` 与出厂 / 中心技能的 `baseDir`:只问文件系统同一性,与租户无关(出厂内容每个租户拿到同一份)。 */
|
|
99
125
|
toolsOnThisHost: DeploymentShapePredicate<"lane">;
|
package/dist/deployment-shape.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { capabilitiesFor, executionLaneCaps, executionLaneOf, handsOnWorkerFilePlane, laneWiresExecutionEnv } from "./execution-lane-caps.js";
|
|
2
|
+
import { configuredIdentitySources } from "./identity-source.js";
|
|
2
3
|
function readPrincipalAxis(deployment) {
|
|
3
4
|
return { declared: deployment.requirePrincipal === true };
|
|
4
5
|
}
|
|
6
|
+
function readIdentityAxis(deployment) {
|
|
7
|
+
return { sources: configuredIdentitySources(deployment), traceTokenDeclared: Boolean(deployment.traceToken) };
|
|
8
|
+
}
|
|
5
9
|
function readLaneAxis(deployment) {
|
|
6
10
|
const declaration = deployment.remoteExec;
|
|
7
11
|
const lane = executionLaneOf(declaration.provider);
|
|
@@ -16,6 +20,8 @@ function readAxis(axis, deployment) {
|
|
|
16
20
|
switch (axis) {
|
|
17
21
|
case "principal":
|
|
18
22
|
return readPrincipalAxis(deployment);
|
|
23
|
+
case "identity":
|
|
24
|
+
return readIdentityAxis(deployment);
|
|
19
25
|
case "lane":
|
|
20
26
|
return readLaneAxis(deployment);
|
|
21
27
|
}
|
|
@@ -47,6 +53,7 @@ function capabilityHolds(cap, principal) {
|
|
|
47
53
|
const VM_ISOLATION_RUNTIME_CLASSES = new Set(["kata", "kata-qemu", "kata-clh", "kata-fc", "gvisor", "runsc"]);
|
|
48
54
|
export const DEPLOYMENT_SHAPE_PREDICATES = Object.freeze({
|
|
49
55
|
principalRequired: createPredicate(["principal"], "身份轴:运维声明了 REQUIRE_PRINCIPAL=true —— 每个调用方都必须带一个验过的主体。", ({ principal }) => principal.declared),
|
|
56
|
+
identityBoundary: createPredicate(["principal", "identity"], "身份轴:这台部署有身份边界 —— 声明了 REQUIRE_PRINCIPAL,或配置接了任一已验身份来源(service 凭据 / 鉴权桥 / 直连门),或声明了只读 trace 凭据。", ({ principal, identity }) => principal.declared || identity.sources.length > 0 || identity.traceTokenDeclared),
|
|
50
57
|
multiTenant: createPredicate(["principal"], "租户轴:这台部署服务不止一个主人(托管 / 多租;C-R100 ① 由 REQUIRE_PRINCIPAL=true 声明)。", ({ principal }) => principal.declared),
|
|
51
58
|
callerCwd: createPredicate(["lane", "principal"], "车道 × 租户 / 设备归属:调用方送来的 cwd(与 settings.env)被尊重 —— host 车道且单主,或 device 车道。", ({ lane, principal }) => lane.caps !== undefined && capabilityHolds(lane.caps.callerCwd, principal)),
|
|
52
59
|
callerOwnsWorkerDisk: createPredicate(["lane", "principal"], "车道 × 租户:手就在本 worker 的盘上且部署只有一个主人 —— 这块盘上的路径就是调用方自己的。", ({ lane, principal }) => lane.lane !== undefined && handsOnWorkerFilePlane(lane.lane) && !principal.declared),
|
|
@@ -1,12 +1,30 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* 不跟、不重试、拒句不点名目标。
|
|
2
|
+
* 本服务**自己**发出的每一个出站 HTTP 请求的重定向律 —— 与 core 7.51.0([ref])一方 brain 的请求同一条:
|
|
3
|
+
* 请求以 `redirect: "manual"` 发出,对端回重定向 ⇒ 拒;不跟、不重试,拒句不点名目标。
|
|
5
4
|
*
|
|
6
5
|
* 为什么:请求只去被判过的那个根。传输层(undici)跟随 POST 307 / 308 时把请求体(用户内容 / 记忆正文)原样送到
|
|
7
|
-
* `Location`,跨 origin 只剥 `authorization` ——
|
|
8
|
-
*
|
|
6
|
+
* `Location`,跨 origin 只剥 `authorization` —— 自定义凭据头(`x-api-key` / `X-Subscription-Token` / OTLP 的 `headers` / S3 预签名的 query)
|
|
7
|
+
* 随行,同 origin 的跟随连 `authorization` 一起带走(`test/hook-llm.test.ts` 的 G1 格在 7.128.x 上实测送达重定向目标)。
|
|
8
|
+
*
|
|
9
|
+
* **一只出口**:{@link createEgressFetch} 是本仓里全局 `fetch` 的**唯一**值引用(`test/egress-redirect-surfaces.test.ts` 的语法树门:
|
|
10
|
+
* 全树零第二处全局 `fetch`、`redirect` 选项只写这里一处、`createEgressFetch(` 调用点闭集登记 —— 新加出站面必登)。
|
|
11
|
+
* 每个出站面各自造一只带「出路」句的出口,请求只经它发出;注入的 `fetchImpl`(测试座 / 嵌入方)同样被它包住 ——
|
|
12
|
+
* 注入不是绕过判据的门。判据 {@link egressRedirectRefusal} 不导出:没有「自己设 `redirect: manual` 再自己判」的第二种写法。
|
|
13
|
+
*
|
|
14
|
+
* 响亮:对端回重定向 ⇒ 抛 {@link EgressRedirectRefusedError}(带对端回的码),拒句前面由各面的失败臂冠上自己的面名。
|
|
15
|
+
* 各面既有的失败臂(日志 / 失败码 / 终态)照旧收它 —— 没有哪一面把它吞成「没拿到结果」而不留话。
|
|
16
|
+
*/
|
|
17
|
+
/** 对端回了重定向、本服务按律不跟:`status` 是对端回的码(0 = `opaqueredirect`)。`message` = 拒句,不回显 `Location` / 凭据 / 请求体。 */
|
|
18
|
+
export declare class EgressRedirectRefusedError extends Error {
|
|
19
|
+
readonly status: number;
|
|
20
|
+
constructor(status: number, message: string);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* 造一只出站 `fetch`:`redirect: "manual"` 强制(调用方传的 `redirect` 不作数),回重定向 ⇒ 抛 {@link EgressRedirectRefusedError}。
|
|
24
|
+
*
|
|
25
|
+
* · `fix` = 出路一句(「把最终地址写进哪一席」),由各面按自己打的那一席给;拼进拒句。
|
|
26
|
+
* · `fetchImpl` 缺席 ⇒ 调用时现取全局 `fetch`(不在造出口时捕获:测试对全局 `fetch` 的替换在造出口之后也生效);在场 ⇒ 用它,同样被判。
|
|
27
|
+
* · 其余答复(2xx / 4xx / 5xx / 304)原样交回,各面自己的失败臂照旧。
|
|
9
28
|
*/
|
|
10
|
-
|
|
11
|
-
export declare function egressRedirectRefusal(res: Response, fix: string): string | undefined;
|
|
29
|
+
export declare function createEgressFetch(fix: string, fetchImpl?: typeof fetch): typeof fetch;
|
|
12
30
|
//# sourceMappingURL=egress-redirect.d.ts.map
|
package/dist/egress-redirect.js
CHANGED
|
@@ -1,7 +1,25 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
1
|
+
export class EgressRedirectRefusedError extends Error {
|
|
2
|
+
status;
|
|
3
|
+
constructor(status, message) {
|
|
4
|
+
super(message);
|
|
5
|
+
this.name = "EgressRedirectRefusedError";
|
|
6
|
+
this.status = status;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
const NOT_MODIFIED = 304;
|
|
10
|
+
function egressRedirectRefusal(res, fix) {
|
|
11
|
+
if (res.type !== "opaqueredirect" && !(res.status >= 300 && res.status < 400 && res.status !== NOT_MODIFIED))
|
|
3
12
|
return undefined;
|
|
4
13
|
void res.body?.cancel().catch(() => undefined);
|
|
5
14
|
return `endpoint answered with a redirect${res.status > 0 ? ` (HTTP ${res.status})` : ""}; it was not followed and no credential was sent anywhere else — ${fix}`;
|
|
6
15
|
}
|
|
16
|
+
export function createEgressFetch(fix, fetchImpl) {
|
|
17
|
+
return async (input, init) => {
|
|
18
|
+
const res = await (fetchImpl ?? fetch)(input, { ...init, redirect: "manual" });
|
|
19
|
+
const refusal = egressRedirectRefusal(res, fix);
|
|
20
|
+
if (refusal !== undefined)
|
|
21
|
+
throw new EgressRedirectRefusedError(res.status, refusal);
|
|
22
|
+
return res;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
7
25
|
//# sourceMappingURL=egress-redirect.js.map
|
package/dist/elicitation.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type McpElicitRequest, type McpElicitResponse } from "@sema-agent/core";
|
|
2
|
+
import { type HitlTransport } from "./hitl-delivery.js";
|
|
2
3
|
/** A live elicitation frame delivered to whoever is tailing this run's stream. `type` IS the SSE event name
|
|
3
4
|
* (mirrors the named-event convention: the payload also carries `type` so a proxy that strips event names still
|
|
4
5
|
* works). The shell renders the `elicitation` frame as a dialog and dismisses on `elicitation_complete`. */
|
|
@@ -27,13 +28,13 @@ export interface ElicitationFrame {
|
|
|
27
28
|
/** "elicitation" only: `serverNowMs + expiresInMs` — the absolute deadline on the server's clock. */
|
|
28
29
|
expiresAtMs?: number;
|
|
29
30
|
}
|
|
30
|
-
/** The per-run context `onElicit` recovers via ALS. `
|
|
31
|
-
* `abortSignal` (the run's own cancel signal) lets a run-abort promptly cancel an
|
|
32
|
-
* human, since the MCP per-request signal may not be chained to the run abort. */
|
|
31
|
+
/** The per-run context `onElicit` recovers via ALS. `transport` = the leg's ONE HITL transport (shared with the question and
|
|
32
|
+
* approval contexts of the same leg); `abortSignal` (the run's own cancel signal) lets a run-abort promptly cancel an
|
|
33
|
+
* elicitation parked awaiting a human, since the MCP per-request signal may not be chained to the run abort. */
|
|
33
34
|
export interface ElicitationRunContext {
|
|
34
35
|
taskId: string;
|
|
35
36
|
owner: string | null;
|
|
36
|
-
|
|
37
|
+
transport: HitlTransport<ElicitationFrame>;
|
|
37
38
|
abortSignal?: AbortSignal;
|
|
38
39
|
}
|
|
39
40
|
export interface ElicitationThrottle {
|
|
@@ -81,7 +82,7 @@ export declare class ElicitationCoordinator {
|
|
|
81
82
|
elicit: (req: McpElicitRequest, signal?: AbortSignal) => Promise<McpElicitResponse>;
|
|
82
83
|
/** `POST /v1/elicitations/:id/respond` — resolve a parked elicitation with the shell's answer. Owner-gated with a
|
|
83
84
|
* 404 (no existence oracle): a non-owner AND an unknown id (answered / expired / wrong replica) both get 404.
|
|
84
|
-
* Returns the HTTP {status, body}; the HTTP layer owns auth (
|
|
85
|
+
* Returns the HTTP {status, body}; the HTTP layer owns auth (gatedSubject + REQUIRE_PRINCIPAL) before calling. */
|
|
85
86
|
respond(id: string, principal: string | undefined, body: unknown): {
|
|
86
87
|
status: number;
|
|
87
88
|
body: unknown;
|