@sema-agent/server 7.149.0 → 7.151.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 +307 -9
- package/README.md +1 -1
- package/README.zh-CN.md +1 -1
- package/USAGE.md +92 -40
- package/deploy/sema-up/README.md +7 -1
- package/deploy/sema-up/chart/Chart.yaml +1 -1
- package/deploy/sema-up/chart/templates/NOTES.txt +5 -0
- package/deploy/sema-up/chart/templates/_helpers.tpl +15 -16
- package/deploy/sema-up/chart/templates/server-v4pro.yaml +5 -3
- package/deploy/sema-up/chart/templates/server.yaml +5 -3
- package/deploy/sema-up/chart/values-full-single.yaml +3 -1
- package/deploy/sema-up/chart/values.yaml +8 -1
- package/deploy/sema-up/cluster-up.sh +1 -0
- package/deploy/sema-up/kube-up.sh +1 -1
- package/deploy/sema-up/lib/flagshape.sh +1 -1
- package/deploy/sema-up/lib/helm-values-cluster.py +2 -0
- package/deploy/sema-up/lib/helm-values-kube.py +2 -0
- package/dist/adoption/import.js +3 -3
- package/dist/approval-ask-machine.d.ts +1 -1
- package/dist/approval-card.d.ts +3 -3
- package/dist/approval-gate-currency.d.ts +2 -2
- package/dist/audit.d.ts +1 -1
- package/dist/audit.js +2 -2
- package/dist/auth-bridge.d.ts +20 -0
- package/dist/auth-bridge.js +9 -0
- package/dist/background-session-reap.d.ts +2 -2
- package/dist/bake-runner/main.d.ts +4 -2
- package/dist/bind-host.d.ts +2 -3
- package/dist/bind-host.js +2 -4
- package/dist/boot/budget-tracing.js +1 -1
- package/dist/boot/deferred-sandbox-path-env.d.ts +5 -3
- package/dist/boot/deferred-sandbox-path-env.js +1 -2
- package/dist/boot/engine-lease.d.ts +5 -0
- package/dist/boot/engine-lease.js +1 -0
- package/dist/boot/execution-env.d.ts +8 -14
- package/dist/boot/execution-env.js +54 -17
- package/dist/boot/execution-lane.js +32 -5
- package/dist/boot/late-binds.d.ts +8 -4
- package/dist/boot/late-binds.js +7 -1
- package/dist/boot/memory-consolidation.d.ts +3 -2
- package/dist/boot/memory-consolidation.js +6 -6
- package/dist/boot/parked-revive-gate.d.ts +5 -5
- package/dist/boot/parked-revive-gate.js +2 -3
- package/dist/boot/reapers.d.ts +5 -0
- package/dist/boot/reapers.js +12 -1
- package/dist/boot/resolve-spec.d.ts +7 -8
- package/dist/boot/resolve-spec.js +80 -35
- package/dist/boot/retention-lane.d.ts +1 -1
- package/dist/boot/runner-deps.d.ts +9 -2
- package/dist/boot/runner-deps.js +3 -3
- package/dist/boot/session-age-out.d.ts +36 -0
- package/dist/boot/session-age-out.js +101 -0
- package/dist/boot/session-faces.d.ts +5 -14
- package/dist/boot/session-faces.js +28 -24
- package/dist/boot/stage-01-config.js +2 -0
- package/dist/boot/stage-03-store-backend.js +2 -2
- package/dist/boot/stage-05-execution-env.d.ts +5 -3
- package/dist/boot/stage-05-execution-env.js +2 -2
- package/dist/boot/stage-06-runners.d.ts +7 -4
- package/dist/boot/stage-06-runners.js +16 -8
- package/dist/boot/stage-07-capability-layer.d.ts +7 -4
- package/dist/boot/stage-07-capability-layer.js +3 -2
- package/dist/boot/stage-08-reapers.d.ts +7 -4
- package/dist/boot/stage-08-reapers.js +4 -2
- package/dist/boot/stage-09-leader.d.ts +11 -5
- package/dist/boot/stage-09-leader.js +12 -3
- package/dist/boot/stage-10-http-server.d.ts +44 -6
- package/dist/boot/stage-10-http-server.js +12 -10
- package/dist/boot/web-admin.d.ts +1 -1
- package/dist/boot/web-admin.js +3 -1
- package/dist/boot/workflow-orchestration.d.ts +7 -2
- package/dist/boot/workflow-orchestration.js +24 -7
- package/dist/bounded-rotation.d.ts +29 -0
- package/dist/bounded-rotation.js +24 -0
- package/dist/capability-facts.d.ts +84 -66
- package/dist/capability-facts.js +58 -41
- package/dist/center-credential.d.ts +25 -6
- package/dist/center-credential.js +25 -5
- package/dist/config-catalog.d.ts +26 -7
- package/dist/config-catalog.js +15 -12
- package/dist/config-invariants.d.ts +2 -1
- package/dist/config-invariants.js +4 -4
- package/dist/config-types.d.ts +22 -15
- package/dist/config.d.ts +51 -2
- package/dist/config.js +35 -24
- package/dist/deployment-governance.d.ts +7 -28
- package/dist/deployment-governance.js +1 -14
- package/dist/deployment-shape.d.ts +9 -1
- package/dist/deployment-shape.js +2 -1
- package/dist/device-protocol.d.ts +5 -4
- package/dist/device-protocol.js +1 -1
- package/dist/device-ws-hub.d.ts +1 -0
- package/dist/device-ws-hub.js +66 -29
- package/dist/device-ws-protocol.d.ts +79 -12
- package/dist/device-ws-protocol.js +64 -26
- package/dist/engine-identity.d.ts +23 -5
- package/dist/engine-identity.js +13 -0
- package/dist/entry-mode-clamp-notice.d.ts +2 -1
- package/dist/execution-env-refusal.d.ts +23 -0
- package/dist/execution-env-refusal.js +5 -0
- package/dist/execution-lane-caps.d.ts +3 -1
- package/dist/field-conflict.d.ts +3 -3
- package/dist/file-history-capture.d.ts +11 -4
- package/dist/file-history-capture.js +9 -6
- package/dist/file-history-disclosure.d.ts +7 -5
- package/dist/file-history-disclosure.js +7 -5
- package/dist/fleet/drain-entry.d.ts +4 -0
- package/dist/fleet/engine-signal.d.ts +14 -1
- package/dist/fleet/engine-signal.js +5 -1
- package/dist/fleet/fleet-reconciler.d.ts +1 -1
- package/dist/fleet/serving-lease.d.ts +18 -3
- package/dist/fleet/serving-lease.js +81 -35
- package/dist/fleet-client.d.ts +13 -11
- package/dist/fleet-client.js +53 -33
- package/dist/history-anchor.js +1 -1
- package/dist/hitl-delivery.d.ts +1 -3
- package/dist/hitl-delivery.js +1 -1
- package/dist/hooks/hook-runner.js +2 -2
- package/dist/host-lsp-manager.d.ts +2 -2
- package/dist/http/active-run-conflict.d.ts +3 -7
- package/dist/http/active-run-conflict.js +2 -2
- package/dist/http/admission.js +19 -4
- package/dist/http/approval-sweeps.js +7 -6
- package/dist/http/caller-trust.d.ts +2 -2
- package/dist/http/caller-trust.js +3 -3
- package/dist/http/checkpoint-ctx.d.ts +20 -63
- package/dist/http/checkpoint-ctx.js +2 -24
- package/dist/http/claim-heartbeat.d.ts +4 -4
- package/dist/http/claim-heartbeat.js +3 -3
- package/dist/http/dispatch.d.ts +2 -1
- package/dist/http/dispatch.js +36 -29
- package/dist/http/durable-run-leg.js +17 -17
- package/dist/http/health-self-report.d.ts +9 -1
- package/dist/http/health-self-report.js +2 -0
- package/dist/http/owner-access.d.ts +264 -20
- package/dist/http/owner-access.js +215 -5
- package/dist/http/readiness.d.ts +4 -2
- package/dist/http/resume-ctx-read.js +38 -1
- package/dist/http/resume-legs.d.ts +2 -1
- package/dist/http/resume-legs.js +273 -89
- package/dist/http/route-ctx.d.ts +41 -19
- package/dist/http/route-table.d.ts +1 -1
- package/dist/http/routes/a2a-serve.js +15 -14
- package/dist/http/routes/admin-memory-optout.d.ts +1 -1
- package/dist/http/routes/agents-roster.js +2 -3
- package/dist/http/routes/approvals-assistant.d.ts +3 -2
- package/dist/http/routes/approvals-assistant.js +12 -12
- package/dist/http/routes/background.d.ts +3 -3
- package/dist/http/routes/capabilities.js +10 -6
- package/dist/http/routes/config-catalog.d.ts +1 -1
- package/dist/http/routes/fleet.js +10 -8
- package/dist/http/routes/mcp-reconnect.js +2 -2
- package/dist/http/routes/memory-origin.d.ts +1 -1
- package/dist/http/routes/notify-wake.js +2 -3
- package/dist/http/routes/projects.d.ts +4 -2
- package/dist/http/routes/projects.js +7 -6
- package/dist/http/routes/retention-ops.d.ts +1 -1
- package/dist/http/routes/run-permission-mode.d.ts +1 -1
- package/dist/http/routes/run-permission-mode.js +2 -2
- package/dist/http/routes/runs.d.ts +1 -1
- package/dist/http/routes/runs.js +125 -66
- package/dist/http/routes/session-memory-sync.js +4 -5
- package/dist/http/routes/session-sync.d.ts +4 -3
- package/dist/http/routes/session-sync.js +174 -83
- package/dist/http/routes/sessions-list.js +13 -7
- package/dist/http/routes/sessions.d.ts +1 -1
- package/dist/http/routes/sessions.js +26 -48
- package/dist/http/routes/tasks.js +38 -23
- package/dist/http/routes/trace-usage.js +14 -14
- package/dist/http/routes/workflows.d.ts +1 -0
- package/dist/http/routes/workflows.js +20 -38
- package/dist/http/server.d.ts +28 -30
- package/dist/http/server.js +7 -3
- package/dist/http/stored-body-replay.d.ts +3 -24
- package/dist/http/stored-body-replay.js +2 -12
- package/dist/http/submit-ctx.d.ts +1 -2
- package/dist/http/submit-ctx.js +8 -6
- package/dist/http/submit-replay.d.ts +15 -2
- package/dist/http/submit-replay.js +10 -4
- package/dist/http/wire-types.d.ts +19 -6
- package/dist/identity-source.d.ts +20 -3
- package/dist/identity-source.js +14 -0
- package/dist/index.d.ts +4 -0
- package/dist/lane-home-probe.d.ts +3 -7
- package/dist/lane-home-probe.js +0 -1
- package/dist/leader/endpoint.js +9 -8
- package/dist/leader/leader.d.ts +2 -1
- package/dist/leg-facts.d.ts +19 -5
- package/dist/leg-facts.js +3 -1
- package/dist/mcp-authorization-face.d.ts +18 -14
- package/dist/mcp-authorization-face.js +3 -2
- package/dist/memory-scope.d.ts +5 -4
- package/dist/memory-scope.js +4 -4
- package/dist/memory-store-refusal.d.ts +1 -1
- package/dist/memory-sync-client.d.ts +30 -2
- package/dist/memory-sync-client.js +16 -9
- package/dist/observability/corrupt-read-seat.d.ts +1 -1
- package/dist/observability/err-text.d.ts +7 -0
- package/dist/observability/err-text.js +5 -0
- package/dist/observability/fail-open.d.ts +12 -8
- package/dist/observability/fail-open.js +12 -8
- package/dist/observability/logger.d.ts +7 -0
- package/dist/observability/logger.js +3 -1
- package/dist/observability/metrics.js +1 -0
- package/dist/observability/run-terminal.d.ts +1 -1
- package/dist/orchestration/workflow-notify-journal.d.ts +18 -1
- package/dist/orchestration/workflow-notify-journal.js +12 -1
- package/dist/orchestration/workflow-park-decision.d.ts +70 -18
- package/dist/orchestration/workflow-park-decision.js +49 -10
- package/dist/orchestration/workflow-park-holder.d.ts +65 -0
- package/dist/orchestration/workflow-park-holder.js +98 -0
- package/dist/orchestration/workflow-record-fence.d.ts +36 -0
- package/dist/orchestration/workflow-record-fence.js +42 -0
- package/dist/owner-faces.d.ts +28 -4
- package/dist/owner-faces.js +2 -0
- package/dist/parked-decide.d.ts +104 -53
- package/dist/parked-decide.js +153 -117
- package/dist/peer-directory.d.ts +2 -2
- package/dist/peer-inbound-face.d.ts +2 -6
- package/dist/peer-inbound-face.js +0 -3
- package/dist/peer-seat.d.ts +1 -1
- package/dist/peer-seat.js +52 -59
- package/dist/permission-mode-admission.d.ts +41 -5
- package/dist/permission-mode-admission.js +29 -3
- package/dist/plugins/adoption-log-sql.d.ts +3 -1
- package/dist/plugins/adoption-log-sql.js +7 -1
- package/dist/plugins/approval-ask-store-file.d.ts +10 -2
- package/dist/plugins/approval-ask-store-file.js +8 -0
- package/dist/plugins/approval-ask-store-memory.d.ts +6 -1
- package/dist/plugins/approval-ask-store-memory.js +28 -9
- package/dist/plugins/approval-ask-store-sql.d.ts +43 -2
- package/dist/plugins/approval-ask-store-sql.js +34 -5
- package/dist/plugins/approval-exemption-store.js +3 -0
- package/dist/plugins/approval-nonce-store.js +2 -0
- package/dist/plugins/breaker-state-sql.js +2 -0
- package/dist/plugins/caching-session-store.d.ts +9 -15
- package/dist/plugins/caching-session-store.js +6 -0
- package/dist/plugins/device-store-sql.js +6 -0
- package/dist/plugins/error-origin.d.ts +18 -0
- package/dist/plugins/error-origin.js +10 -0
- package/dist/plugins/exec-path-law.d.ts +34 -0
- package/dist/plugins/exec-path-law.js +13 -0
- package/dist/plugins/execution-placement-sql.js +6 -6
- package/dist/plugins/file-run-store.js +1 -1
- package/dist/plugins/image-bake-store-sql.js +6 -0
- package/dist/plugins/image-index-sql.js +4 -0
- package/dist/plugins/landed-attendants.d.ts +212 -0
- package/dist/plugins/landed-attendants.js +161 -0
- package/dist/plugins/leader-run-store-sql.js +4 -0
- package/dist/plugins/local-checkpoint-store.d.ts +4 -1
- package/dist/plugins/local-checkpoint-store.js +3 -0
- package/dist/plugins/local-session-live-reference.d.ts +40 -0
- package/dist/plugins/local-session-live-reference.js +39 -0
- package/dist/plugins/local-session-store.d.ts +71 -33
- package/dist/plugins/local-session-store.js +129 -27
- package/dist/plugins/memory-engine-pg.js +4 -0
- package/dist/plugins/memory-engine-sql-apply.js +5 -2
- package/dist/plugins/memory-engine-tidb.js +4 -0
- package/dist/plugins/memory-optout-grant-store-sql.js +4 -0
- package/dist/plugins/memory-run-store.js +1 -1
- package/dist/plugins/memory-sync-store-pg.js +5 -0
- package/dist/plugins/memory-sync-store-tidb.js +5 -0
- package/dist/plugins/one-time-migrations.d.ts +80 -61
- package/dist/plugins/one-time-migrations.js +241 -104
- package/dist/plugins/org-delivery-quota-store.js +4 -1
- package/dist/plugins/outcome-ledger-sql.js +2 -0
- package/dist/plugins/permission-rule-store-sql.js +11 -4
- package/dist/plugins/pg-cost-quota.js +4 -0
- package/dist/plugins/pg-pool.js +28 -1
- package/dist/plugins/pg-rate-limiter.js +2 -0
- package/dist/plugins/posix-shell-fs.d.ts +6 -1
- package/dist/plugins/posix-shell-fs.js +8 -3
- package/dist/plugins/remote-env-adb.d.ts +19 -15
- package/dist/plugins/remote-env-adb.js +44 -17
- package/dist/plugins/remote-env-connect-seat.d.ts +105 -0
- package/dist/plugins/remote-env-connect-seat.js +72 -0
- package/dist/plugins/remote-env-device.d.ts +22 -5
- package/dist/plugins/remote-env-device.js +114 -14
- package/dist/plugins/remote-env-e2b.d.ts +18 -7
- package/dist/plugins/remote-env-e2b.js +53 -40
- package/dist/plugins/remote-env-file-error.js +6 -2
- package/dist/plugins/remote-env-host.d.ts +18 -1
- package/dist/plugins/remote-env-host.js +48 -47
- package/dist/plugins/remote-env-k8s.d.ts +41 -39
- package/dist/plugins/remote-env-k8s.js +56 -32
- package/dist/plugins/remote-env-local-docker.d.ts +13 -8
- package/dist/plugins/remote-env-local-docker.js +37 -43
- package/dist/plugins/remote-env-ssh.d.ts +18 -12
- package/dist/plugins/remote-env-ssh.js +64 -62
- package/dist/plugins/remote-shell.d.ts +101 -2
- package/dist/plugins/remote-shell.js +221 -3
- package/dist/plugins/replica-registration.d.ts +35 -0
- package/dist/plugins/replica-registration.js +48 -0
- package/dist/plugins/resume-anchor-store-sql.d.ts +11 -2
- package/dist/plugins/resume-anchor-store-sql.js +12 -5
- package/dist/plugins/retention-lane-store-sql.d.ts +1 -1
- package/dist/plugins/retention-lane-store-sql.js +4 -0
- package/dist/plugins/retention-sql.d.ts +20 -2
- package/dist/plugins/retention-sql.js +11 -0
- package/dist/plugins/run-store-sql.d.ts +22 -3
- package/dist/plugins/run-store-sql.js +33 -9
- package/dist/plugins/scenario-prefix-switch-m42.d.ts +6 -12
- package/dist/plugins/scenario-prefix-switch-m42.js +7 -5
- package/dist/plugins/schema-consistency.d.ts +9 -5
- package/dist/plugins/schema-consistency.js +48 -18
- package/dist/plugins/schema-drift-sentence.js +1 -1
- package/dist/plugins/send-file-ledger.js +3 -0
- package/dist/plugins/serving-requirement.d.ts +68 -0
- package/dist/plugins/serving-requirement.js +60 -0
- package/dist/plugins/session-birth.d.ts +6 -2
- package/dist/plugins/session-capture-record-store-sql.js +2 -0
- package/dist/plugins/session-ext-table.d.ts +14 -1
- package/dist/plugins/session-ext-table.js +5 -1
- package/dist/plugins/session-row-sql.d.ts +49 -2
- package/dist/plugins/session-row-sql.js +56 -13
- package/dist/plugins/session-store-sql.d.ts +34 -18
- package/dist/plugins/session-store-sql.js +98 -17
- package/dist/plugins/shared-memory-store-sql.d.ts +1 -0
- package/dist/plugins/shared-memory-store-sql.js +6 -2
- package/dist/plugins/sql-driver.d.ts +2 -1
- package/dist/plugins/sql-driver.js +18 -3
- package/dist/plugins/sql-errors.d.ts +11 -6
- package/dist/plugins/sql-errors.js +5 -6
- package/dist/plugins/stop-then-start-sentence.d.ts +48 -3
- package/dist/plugins/stop-then-start-sentence.js +48 -0
- package/dist/plugins/stop-then-start.d.ts +109 -0
- package/dist/plugins/stop-then-start.js +104 -0
- package/dist/plugins/store-backend.d.ts +40 -13
- package/dist/plugins/store-backend.js +169 -27
- package/dist/plugins/store-boundary.d.ts +57 -0
- package/dist/plugins/store-boundary.js +139 -0
- package/dist/plugins/store-contracts.d.ts +29 -2
- package/dist/plugins/store-contracts.js +3 -0
- package/dist/plugins/store-fault-sentence-m53.d.ts +7 -0
- package/dist/plugins/store-fault-sentence-m53.js +25 -0
- package/dist/plugins/store-fault.d.ts +26 -7
- package/dist/plugins/store-fault.js +18 -2
- package/dist/plugins/task-attachment-store.js +9 -0
- package/dist/plugins/task-list-store-sql.d.ts +2 -2
- package/dist/plugins/task-list-store-sql.js +10 -8
- package/dist/plugins/tidb-cost-quota.js +4 -0
- package/dist/plugins/tidb-pool.js +6 -1
- package/dist/plugins/tidb-rate-limiter.js +4 -0
- package/dist/plugins/user-input-ledger-sql.js +4 -0
- package/dist/plugins/workflow-run-store-sql.d.ts +28 -10
- package/dist/plugins/workflow-run-store-sql.js +64 -4
- package/dist/plugins/workspace-fill.d.ts +4 -7
- package/dist/plugins/workspace-fill.js +2 -1
- package/dist/plugins/write-behind-counter.js +5 -0
- package/dist/process-instance.d.ts +3 -0
- package/dist/process-instance.js +7 -0
- package/dist/project-context.d.ts +64 -0
- package/dist/project-context.js +66 -0
- package/dist/project-registry.d.ts +46 -0
- package/dist/project-registry.js +44 -0
- package/dist/question.d.ts +9 -21
- package/dist/question.js +28 -19
- package/dist/request-key-closure.js +1 -1
- package/dist/request-value-closure.d.ts +4 -0
- package/dist/request-value-closure.js +10 -0
- package/dist/run-acceptance.d.ts +3 -2
- package/dist/run-acceptance.js +4 -6
- package/dist/run-cancel-card.d.ts +1 -1
- package/dist/run-cancel-card.js +2 -1
- package/dist/run-local.js +1 -0
- package/dist/runs.d.ts +37 -8
- package/dist/runs.js +53 -12
- package/dist/runtime-governance.d.ts +5 -4
- package/dist/security.d.ts +31 -33
- package/dist/security.js +41 -7
- package/dist/server-secret-env.d.ts +12 -10
- package/dist/server-secret-env.js +24 -15
- package/dist/session-agent.d.ts +1 -10
- package/dist/session-agent.js +0 -6
- package/dist/session-bindings.d.ts +82 -0
- package/dist/session-bindings.js +18 -0
- package/dist/session-children-retire.d.ts +2 -2
- package/dist/session-children-retire.js +2 -6
- package/dist/session-deletion.d.ts +16 -1
- package/dist/session-error-wire.d.ts +3 -3
- package/dist/session-error-wire.js +3 -3
- package/dist/session-incarnation.d.ts +28 -4
- package/dist/session-incarnation.js +14 -2
- package/dist/session-kind.d.ts +57 -0
- package/dist/session-kind.js +22 -0
- package/dist/session-notify-door.d.ts +4 -4
- package/dist/session-notify-door.js +5 -6
- package/dist/session-row.d.ts +21 -1
- package/dist/session-row.js +7 -1
- package/dist/session-rules-seat.d.ts +4 -3
- package/dist/session-rules-seat.js +3 -11
- package/dist/session-sync-kernel.d.ts +24 -14
- package/dist/session-sync-kernel.js +3 -6
- package/dist/session-sync.d.ts +4 -98
- package/dist/session-sync.js +4 -74
- package/dist/session-titler.d.ts +10 -3
- package/dist/session-titler.js +19 -6
- package/dist/ssh-host-key.d.ts +5 -0
- package/dist/ssh-host-key.js +3 -0
- package/dist/stores-sql/checkpoint-store-sql.d.ts +21 -2
- package/dist/stores-sql/checkpoint-store-sql.js +106 -18
- package/dist/stores-sql/file-history-store-sql.d.ts +52 -2
- package/dist/stores-sql/file-history-store-sql.js +108 -70
- package/dist/stores-sql/pg-session-storage.d.ts +34 -7
- package/dist/stores-sql/pg-session-storage.js +37 -13
- package/dist/stores-sql/retention-store-sql.d.ts +2 -10
- package/dist/stores-sql/retention-store-sql.js +2 -10
- package/dist/stores-sql/session-policy-store-sql.d.ts +30 -7
- package/dist/stores-sql/session-policy-store-sql.js +61 -44
- package/dist/stores-sql/session-write-hooks.d.ts +11 -0
- package/dist/stores-sql/tidb-session-store.d.ts +58 -7
- package/dist/stores-sql/tidb-session-store.js +37 -13
- package/dist/submission-exit.d.ts +3 -2
- package/dist/submission-exit.js +9 -1
- package/dist/task-cwd.d.ts +6 -5
- package/dist/task-settings.d.ts +19 -5
- package/dist/task-settings.js +13 -7
- package/dist/terminal.d.ts +33 -2
- package/dist/terminal.js +139 -9
- package/dist/tool-approval.d.ts +147 -12
- package/dist/tool-approval.js +206 -109
- package/dist/trace/engine-notice-wire.d.ts +14 -0
- package/dist/trace/engine-notice-wire.js +18 -1
- package/dist/trace/project.d.ts +4 -3
- package/dist/trace/project.js +3 -2
- package/dist/trace/projection-table.d.ts +33 -2
- package/dist/trace/self-minted-wire.d.ts +422 -26
- package/dist/trace/self-minted-wire.js +149 -23
- package/dist/trace/tool-card.d.ts +3 -0
- package/dist/trace/tool-card.js +24 -0
- package/dist/trace/tool-output-media.d.ts +2 -1
- package/dist/unattended-permission-mode.d.ts +1 -1
- package/dist/web-admin-client/apply-effective.d.ts +1 -1
- package/dist/web-admin-client/effective-keys.d.ts +1 -1
- package/dist/web-admin-client/skills-mcp.d.ts +1 -1
- package/docs/DEVICE-EXECUTOR-PROTOCOL.md +120 -41
- package/package.json +3 -3
- package/wire-changes/server@7.150.0.json +335 -0
- package/wire-changes/server@7.151.0.json +762 -0
- package/dist/http/session-inherit-env.d.ts +0 -36
- package/dist/http/session-inherit-env.js +0 -6
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { sessionKindFaceOf } from "../session-kind.js";
|
|
1
2
|
import { buildRewindHandles, buildSessionAudit, buildSessionAuditLocal, buildSessionAuditPg } from "../audit.js";
|
|
2
|
-
import { readSessionAgent } from "../
|
|
3
|
+
import { readSessionAgent } from "../http/owner-access.js";
|
|
3
4
|
import { readSessionProjectId, sessionWorkspaceStoreOf } from "../session-workspace.js";
|
|
4
5
|
import { makeDegenerateInstrument } from "../degenerate-instrument.js";
|
|
5
6
|
import { PlanCacheProbe } from "../plan-cache-probe.js";
|
|
@@ -24,27 +25,30 @@ export function createSessionFaces(ctx) {
|
|
|
24
25
|
const ownerAware = sessionStore;
|
|
25
26
|
const headOf = headReadOf(sessionStore);
|
|
26
27
|
const workspaceStore = sessionWorkspaceStoreOf(sessionStore);
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
: undefined;
|
|
28
|
+
const kindFace = sessionKindFaceOf(sessionStore);
|
|
29
|
+
const readSessionView = async (sessionId, opts) => {
|
|
30
|
+
const handles = opts !== undefined && resumeAnchorStore !== undefined ? buildRewindHandles(await resumeAnchorStore.listBySession(sessionId), opts.reader) : undefined;
|
|
31
|
+
const audit = mysqlPool
|
|
32
|
+
? await buildSessionAudit(mysqlPool, sessionId, handles)
|
|
33
|
+
: auditPgPool
|
|
34
|
+
? await buildSessionAuditPg(auditPgPool, sessionId, handles)
|
|
35
|
+
: await buildSessionAuditLocal(auditLocalRows, sessionId, handles);
|
|
36
|
+
if (!audit)
|
|
37
|
+
return undefined;
|
|
38
|
+
const [head, agent, projectId, kindRead] = await Promise.all([
|
|
39
|
+
headOf?.(sessionId),
|
|
40
|
+
opts !== undefined ? readSessionAgent(ownerAware, sessionId) : undefined,
|
|
41
|
+
opts !== undefined ? readSessionProjectId(workspaceStore, sessionId) : undefined,
|
|
42
|
+
opts !== undefined ? kindFace?.sessionKindOf(sessionId) : undefined,
|
|
43
|
+
]);
|
|
44
|
+
const owner = head?.owner;
|
|
45
|
+
const sessionKind = kindRead !== undefined && head !== undefined && kindRead.incarnation === head.incarnation ? kindRead.kind : undefined;
|
|
46
|
+
return { ...audit, owner: owner ?? null, ...(agent !== undefined ? { agent } : {}), ...(projectId !== undefined ? { projectId } : {}), ...(sessionKind !== undefined ? { sessionKind } : {}) };
|
|
47
|
+
};
|
|
48
|
+
const sessionAudit = mysqlPool || auditPgPool || auditLocalRows ? readSessionView : undefined;
|
|
49
|
+
const probeWatchedHead = async (sid) => (headOf === undefined ? { owner: undefined, leafId: null } : ((await headOf(sid)) ?? { owner: undefined, leafId: null }));
|
|
46
50
|
const sessionWatchRegistry = headOf
|
|
47
|
-
? new SessionWatchRegistry(
|
|
51
|
+
? new SessionWatchRegistry(probeWatchedHead, {
|
|
48
52
|
hotMs: posIntEnv(process.env.SESSION_EVENTS_HOT_MS, 200),
|
|
49
53
|
warmMs: posIntEnv(process.env.SESSION_EVENTS_WARM_MS, 2000),
|
|
50
54
|
maxWatchedSessions: posIntEnv(process.env.SESSION_EVENTS_MAX_PROBES, 512, 100_000),
|
|
@@ -64,7 +68,7 @@ export function createSessionFaces(ctx) {
|
|
|
64
68
|
const attempts = new Map();
|
|
65
69
|
const holder = (token) => attempts.get(token) ?? "elsewhere";
|
|
66
70
|
const purge = eraser !== undefined && deletion !== undefined
|
|
67
|
-
? async (sessionId, owner, expect) => {
|
|
71
|
+
? async (sessionId, owner, expect, ageOut) => {
|
|
68
72
|
const tenantScope = sessionTenantScope(owner);
|
|
69
73
|
const reach = await probeSessionChildren({ agentStore: backgroundAgentStore, checkpointStore, registry: defaultTaskRegistry }, sessionId, tenantScope);
|
|
70
74
|
if (!reach.reachable) {
|
|
@@ -73,7 +77,7 @@ export function createSessionFaces(ctx) {
|
|
|
73
77
|
}
|
|
74
78
|
let fence;
|
|
75
79
|
try {
|
|
76
|
-
fence = await deletion.fence(sessionId, owner, expect
|
|
80
|
+
fence = await deletion.fence(sessionId, owner, { holder, ...(expect !== undefined ? { expect } : {}), ...(ageOut !== undefined ? { ageOut } : {}) });
|
|
77
81
|
}
|
|
78
82
|
catch (err) {
|
|
79
83
|
if (err instanceof SessionActiveRunError)
|
|
@@ -143,7 +147,7 @@ export function createSessionFaces(ctx) {
|
|
|
143
147
|
return { deleted: true };
|
|
144
148
|
}
|
|
145
149
|
: undefined;
|
|
146
|
-
const purgeSession = purge !== undefined ? (sessionId, owner) => purge(sessionId, owner) : undefined;
|
|
150
|
+
const purgeSession = purge !== undefined ? (sessionId, owner, opts) => purge(sessionId, owner, undefined, opts?.ageOut) : undefined;
|
|
147
151
|
const recoverOne = async (sessionId, owner, token) => {
|
|
148
152
|
const unfinished = "the session stays in the deleting state (it reads as gone everywhere); the next start or a repeated DELETE by its owner finishes it";
|
|
149
153
|
try {
|
|
@@ -12,6 +12,7 @@ import { installFileHistoryFailureRecorder } from "../file-history-disclosure.js
|
|
|
12
12
|
import { installSecretEnvScrubRecorder } from "../observability/secret-env-scrub.js";
|
|
13
13
|
import { setRunTerminalLogObserver } from "../observability/run-terminal.js";
|
|
14
14
|
import { setRedactionObserver } from "../trace/redact.js";
|
|
15
|
+
import { setStoreBoundaryObserver } from "../terminal.js";
|
|
15
16
|
import { installOutboundDispatcher } from "../outbound-dispatcher.js";
|
|
16
17
|
import { bindOwnCredentialsConfig, declareServerWithheldEnv } from "../server-secret-env.js";
|
|
17
18
|
import { admitLocalDataRoot } from "../plugins/local-data-root-admission.js";
|
|
@@ -53,6 +54,7 @@ export function runStage01() {
|
|
|
53
54
|
});
|
|
54
55
|
}
|
|
55
56
|
setRedactionObserver((pattern, n, meta) => metrics.inc("redactions_applied_total", { pattern, arm: meta.arm }, n));
|
|
57
|
+
setStoreBoundaryObserver((site, faultClass) => metrics.inc("store_boundary_fault_total", { site, class: faultClass }));
|
|
56
58
|
setWebSearchBadPayloadObserver((provider) => {
|
|
57
59
|
metrics.inc("web_search_bad_payload_total", { provider });
|
|
58
60
|
logger.warn("web_search_non_array_payload", { provider });
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { processInstanceId } from "../process-instance.js";
|
|
2
2
|
import { openStores } from "./stores.js";
|
|
3
3
|
export async function runStage03(ctx) {
|
|
4
4
|
const { config, localAdmission, localRoot, logger, metrics, storeEvidence } = ctx;
|
|
5
5
|
const { backend, storePosture, memoryEngine, engineDataRoot, memorySyncCursors, rosterStore, backgroundAgentStore, sessionCaptureRecords, taskAttachmentStore, mailboxStore, mailboxRecipientLifecycle, memoryExportStores, memorySyncRunner, sessionStore, breakerState, usageWindowStore, memoryPosture, taskListLane, sqlEngine, storeSweep, } = await openStores({ config, logger, metrics, localRoot, storeEvidence, localAdmission });
|
|
6
6
|
const adoptionWiring = { memoryEngine: memoryExportStores !== undefined, taskAttachment: taskAttachmentStore !== undefined };
|
|
7
|
-
const instanceId =
|
|
7
|
+
const instanceId = processInstanceId();
|
|
8
8
|
return { ...ctx, adoptionWiring, backend, backgroundAgentStore, breakerState, engineDataRoot, instanceId, mailboxRecipientLifecycle, mailboxStore, memoryEngine, memoryExportStores, memoryPosture, memorySyncCursors, memorySyncRunner, rosterStore, sessionCaptureRecords, sessionStore, sqlEngine, storePosture, storeSweep, taskAttachmentStore, taskListLane, usageWindowStore };
|
|
9
9
|
}
|
|
10
10
|
//# sourceMappingURL=stage-03-store-backend.js.map
|
|
@@ -18,10 +18,12 @@ export declare function runStage05(ctx: Awaited<ReturnType<typeof runStage04>>):
|
|
|
18
18
|
perSessionCwd: Map<string, string>;
|
|
19
19
|
perTaskImage: import("../per-task-image.js").PerTaskImageRegistry;
|
|
20
20
|
sendUserFileTaskEnvs: import("../capabilities/sandbox-file-send.js").TaskEnvRegistry | undefined;
|
|
21
|
+
sessionBindings: {
|
|
22
|
+
commitSessionBindings: (sessionId: string, bindings: import("../session-bindings.js").SessionBindings) => import("../session-bindings.js").SessionBindingReceipt;
|
|
23
|
+
withdrawSessionBindings: (receipt: import("../session-bindings.js").SessionBindingReceipt) => boolean;
|
|
24
|
+
settleSessionBindings: (receipt: import("../session-bindings.js").SessionBindingReceipt) => boolean;
|
|
25
|
+
};
|
|
21
26
|
sessionEnvSelection: import("../capabilities/select-environment-tool.js").SessionEnvironmentSelection;
|
|
22
|
-
setSessionCwd: (sid: string, cwd: string) => void;
|
|
23
|
-
setSessionInheritEnv: (sid: string, policy: import("../request-value-closure.js").TaskInheritEnv | undefined) => void;
|
|
24
|
-
setSessionShellEnv: (sid: string, env: Record<string, string>) => void;
|
|
25
27
|
worktreeReap: (() => Promise<void>) | undefined;
|
|
26
28
|
brain: import("@sema-agent/core").Brain;
|
|
27
29
|
consolidationSeatWatch: import("./memory-consolidation.js").ConsolidationSeatWatch | undefined;
|
|
@@ -13,7 +13,7 @@ export async function runStage05(ctx) {
|
|
|
13
13
|
const deviceLane = config.remoteExec.provider === "device" ? createDeviceLane({ config, logger, metrics, backend, seat: sessionStore.executionPlacement, replicaId: instanceId }) : undefined;
|
|
14
14
|
const headOf = headReadOf(sessionStore);
|
|
15
15
|
const spaceCommits = backend !== undefined ? () => runStore : undefined;
|
|
16
|
-
const { perTaskImage, sessionEnvSelection, perSessionCwd,
|
|
16
|
+
const { perTaskImage, sessionEnvSelection, perSessionCwd, sessionBindings, fenceSessionOwner, dropSessionScoped, sessionResidentBackground, dropSessionScopedOf, executionEnvFactory, worktreeReap, sendUserFileTaskEnvs, lspManager, spaceReclaimer, sandboxSecretSeatGate, sandboxReaper, sandboxGitPlane: sandboxGitPlaneSeat, sandboxCapacity, } = createExecutionEnv({ config, logger, metrics, taskAttachmentStore, ...(deviceLane ? { deviceLane } : {}), ...(spaceCommits !== undefined ? { spaceCommits } : {}), ...(headOf !== undefined ? { headOf } : {}), ...(backend !== undefined ? { runRows: () => runStore } : {}) });
|
|
17
17
|
assertDeviceLaneWired(config.remoteExec.provider === "device", deviceLane, executionEnvFactory !== undefined);
|
|
18
18
|
if (deviceLane !== undefined && config.remoteExec.provider === "device")
|
|
19
19
|
await noteDeviceRelayBindings(config.remoteExec.relay, deviceLane.store, logger);
|
|
@@ -34,6 +34,6 @@ export async function runStage05(ctx) {
|
|
|
34
34
|
const peerDesk = createPeerDesk({ log: logger });
|
|
35
35
|
metrics.dynamicGauge("peer_registry_entries", "Peer desk entries (declared peer credentials registered for in-flight legs and the roster)", () => peerDesk.size().entries);
|
|
36
36
|
metrics.dynamicGauge("peer_registry_holders", "Peer desk holders of entries (host leases and engine holds), summed across entries", () => peerDesk.size().holders);
|
|
37
|
-
return { ...ctx, deploymentMods, deploymentModsLoaded, belowTaskChainPatterns, deviceLane, peerDesk, dropSessionScoped, dropSessionScopedOf, executionEnvFactory, fenceSessionOwner, sessionResidentBackground, lspManager, spaceReclaimer, sandboxReaper, sandboxGitPlane, sandboxCapacity, perSessionCwd, perTaskImage, sendUserFileTaskEnvs,
|
|
37
|
+
return { ...ctx, deploymentMods, deploymentModsLoaded, belowTaskChainPatterns, deviceLane, peerDesk, dropSessionScoped, dropSessionScopedOf, executionEnvFactory, fenceSessionOwner, sessionResidentBackground, lspManager, spaceReclaimer, sandboxReaper, sandboxGitPlane, sandboxCapacity, perSessionCwd, perTaskImage, sendUserFileTaskEnvs, sessionBindings, sessionEnvSelection, worktreeReap };
|
|
38
38
|
}
|
|
39
39
|
//# sourceMappingURL=stage-05-execution-env.js.map
|
|
@@ -34,7 +34,7 @@ export declare function runStage06(ctx: Awaited<ReturnType<typeof runStage05>>):
|
|
|
34
34
|
sendUserFileToolSpec: import("@sema-agent/core").ToolSpec<import("@sema-agent/core").TSchema> | undefined;
|
|
35
35
|
sessionTitler: import("../session-titler.js").SessionTitler | undefined;
|
|
36
36
|
sharedMemoryStore: import("../plugins/shared-memory-store-sql.js").SqlSharedMemoryStore | undefined;
|
|
37
|
-
sqlWorkflowRunStore: import("
|
|
37
|
+
sqlWorkflowRunStore: import("../plugins/workflow-run-store-sql.js").SqlWorkflowRunStore | undefined;
|
|
38
38
|
streamApprovalGate: import("../tool-approval.js").StreamApprovalGate<import("../approval-gate-currency.js").GateCurrencyStore>;
|
|
39
39
|
subRunner: Runner;
|
|
40
40
|
subagentSteerRegistry: import("../orchestration/subagent-steer.js").SubagentSteerRegistry;
|
|
@@ -45,6 +45,7 @@ export declare function runStage06(ctx: Awaited<ReturnType<typeof runStage05>>):
|
|
|
45
45
|
workflowJournalStore: import("../plugins/store-backend.js").ServiceWorkflowJournalStore | undefined;
|
|
46
46
|
workflowModelAllowlistSnapshot: readonly string[];
|
|
47
47
|
workflowParkDecisions: import("../orchestration/workflow-park-decision.js").WorkflowParkDecisionStore | undefined;
|
|
48
|
+
workflowParkHolderPull: (() => Promise<import("../orchestration/workflow-park-holder.js").HolderPullTally>) | undefined;
|
|
48
49
|
workflowNotifyGate: import("../orchestration/workflow-notify-journal.js").WorkflowNotifyGate | undefined;
|
|
49
50
|
workflowNotifyJournal: import("../orchestration/workflow-notify-journal.js").WorkflowNotifyJournalStore | undefined;
|
|
50
51
|
workflowRecoverOpts: {
|
|
@@ -73,10 +74,12 @@ export declare function runStage06(ctx: Awaited<ReturnType<typeof runStage05>>):
|
|
|
73
74
|
perSessionCwd: Map<string, string>;
|
|
74
75
|
perTaskImage: import("../per-task-image.js").PerTaskImageRegistry;
|
|
75
76
|
sendUserFileTaskEnvs: import("../capabilities/sandbox-file-send.js").TaskEnvRegistry | undefined;
|
|
77
|
+
sessionBindings: {
|
|
78
|
+
commitSessionBindings: (sessionId: string, bindings: import("../session-bindings.js").SessionBindings) => import("../session-bindings.js").SessionBindingReceipt;
|
|
79
|
+
withdrawSessionBindings: (receipt: import("../session-bindings.js").SessionBindingReceipt) => boolean;
|
|
80
|
+
settleSessionBindings: (receipt: import("../session-bindings.js").SessionBindingReceipt) => boolean;
|
|
81
|
+
};
|
|
76
82
|
sessionEnvSelection: import("../capabilities/select-environment-tool.js").SessionEnvironmentSelection;
|
|
77
|
-
setSessionCwd: (sid: string, cwd: string) => void;
|
|
78
|
-
setSessionInheritEnv: (sid: string, policy: import("../request-value-closure.js").TaskInheritEnv | undefined) => void;
|
|
79
|
-
setSessionShellEnv: (sid: string, env: Record<string, string>) => void;
|
|
80
83
|
worktreeReap: (() => Promise<void>) | undefined;
|
|
81
84
|
brain: import("@sema-agent/core").Brain;
|
|
82
85
|
consolidationSeatWatch: import("./memory-consolidation.js").ConsolidationSeatWatch | undefined;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { createSessionEraseSettler } from "../session-erase.js";
|
|
2
2
|
import { Runner, InMemoryToolResultStore, TtlSessionStore, uuidv7, createAllowDenyPolicy, workflowsCapability } from "@sema-agent/core";
|
|
3
3
|
import { createEngineSessionRulesSeat } from "../session-rules-seat.js";
|
|
4
|
-
import { headReadOf } from "../session-incarnation.js";
|
|
5
4
|
import { outwardPlane } from "../terminal.js";
|
|
6
5
|
import { createSessionTitler } from "../session-titler.js";
|
|
6
|
+
import { sessionOccupantReadOf } from "../http/owner-access.js";
|
|
7
7
|
import { cardRuleScopeRoot } from "../task-cwd.js";
|
|
8
8
|
import { ForkRoutingSessionStore } from "../plugins/fork-routing-session-store.js";
|
|
9
9
|
import { withoutHands } from "../capabilities/hands-lane.js";
|
|
10
10
|
import { isBrandedDeployment } from "../capabilities/brand-identity.js";
|
|
11
|
-
import {
|
|
11
|
+
import { DEPLOYMENT_SHAPE_PREDICATES } from "../deployment-shape.js";
|
|
12
12
|
import { workflowModelAllowlistFor } from "../task-workflow.js";
|
|
13
13
|
import { createHookLlm, buildHookFailureText } from "../hooks/hook-llm.js";
|
|
14
14
|
import { assertRetentionLaneWirable } from "./retention-lane.js";
|
|
@@ -27,16 +27,21 @@ import { createOrgMemoryAdmissionWiring } from "./org-memory.js";
|
|
|
27
27
|
import { createGovernanceSeams } from "./governance-seams.js";
|
|
28
28
|
import { createSharedMemoryScopeAuthorizer } from "../shared-memory-scope-authorizer.js";
|
|
29
29
|
import { mountOrgDeliveryGate } from "./org-delivery.js";
|
|
30
|
-
import { parkedAskRedeem, runStore } from "./late-binds.js";
|
|
30
|
+
import { parkedAskRedeem, runEndedHandoff, runStore } from "./late-binds.js";
|
|
31
|
+
import { createWorkflowParkHolderPull } from "../orchestration/workflow-park-holder.js";
|
|
31
32
|
import { withInternalRunEnvs } from "../internal-run-env.js";
|
|
32
33
|
import { retentionSweepRuns } from "../plugins/retention-declaration.js";
|
|
33
34
|
import { createOperatorFaceIncidentSink } from "../memory-incident-sink.js";
|
|
34
35
|
export async function runStage06(ctx) {
|
|
35
36
|
const { backend, backgroundAgentStore, brain, engineDataRoot, peerDesk, config, webAdmin, consolidationValve, deploymentMods, executionEnvFactory, fileHistoryStore, localRoot, logger, lspManager, mailboxRecipientLifecycle, mailboxStore, memoryEngine, memorySyncRunner, metrics, perSessionCwd, permissionRuleProvider, pricing, rosterStore, ruleConsent, sendUserFileTaskEnvs, sessionCaptureRecords, sessionPolicyStore, sessionStore, spaceReclaimer, taskAttachmentStore, taskListLane, toolResultStore, tracer, usageWindowStore } = ctx;
|
|
36
|
-
const { sqlWorkflowRunStore, workflowNotifyJournal, workflowCompletionInbox, deliverWorkflowCompletion, workflowNotifyGate, fleetBus, workflowRunStore, workflowJournalStore, outcomeSink, workflowRecoverOpts, workflowAgentRegistry, subagentSteerRegistry, workflowAgentSessionIndex, workflowParkDecisions, } = createWorkflowOrchestration({ config, logger, metrics, localRoot, backend, getRunStore: () => runStore });
|
|
37
|
+
const { sqlWorkflowRunStore, workflowNotifyJournal, workflowCompletionInbox, deliverWorkflowCompletion, workflowNotifyGate, fleetBus, workflowRunStore, workflowJournalStore, outcomeSink, workflowRecoverOpts, workflowAgentRegistry, subagentSteerRegistry, workflowAgentSessionIndex, workflowParkDecisions, heldParksHere, } = createWorkflowOrchestration({ config, logger, metrics, localRoot, backend, getRunStore: () => runStore, getRunEndedHandoff: () => runEndedHandoff });
|
|
38
|
+
backend?.bindWorkflowRunReader?.(workflowRunStore ?? "none");
|
|
37
39
|
const parkCommitted = backend?.checkpoint && config.durableApproval ? createParkCommitWatch(backend.checkpoint(logger)) : undefined;
|
|
38
40
|
const checkpointStore = parkCommitted?.store;
|
|
39
41
|
const parkCommits = parkCommitted?.watch;
|
|
42
|
+
const workflowParkHolderPull = heldParksHere !== undefined && workflowParkDecisions !== undefined && workflowAgentSessionIndex !== undefined && workflowRunStore !== undefined && checkpointStore !== undefined
|
|
43
|
+
? createWorkflowParkHolderPull({ held: heldParksHere, decisions: workflowParkDecisions, checkpointStore, workflowAgentSessionIndex, workflowRunStore, warn: (event, fields) => logger.warn(event, fields) })
|
|
44
|
+
: undefined;
|
|
40
45
|
const checkpointCtxSealing = webAdmin.checkpointCtxSealing;
|
|
41
46
|
if (checkpointStore !== undefined) {
|
|
42
47
|
if (checkpointCtxSealing === undefined)
|
|
@@ -116,7 +121,7 @@ export async function runStage06(ctx) {
|
|
|
116
121
|
: undefined;
|
|
117
122
|
for (const w of buildConsolidationValveAudit({
|
|
118
123
|
valve: consolidationValve,
|
|
119
|
-
|
|
124
|
+
credentialGateSource: DEPLOYMENT_SHAPE_PREDICATES.credentialGateSource.holds(config),
|
|
120
125
|
allowUnauthedWrites: config.allowUnauthedWrites ?? false,
|
|
121
126
|
}).warnings) {
|
|
122
127
|
logger.warn(w.tag, { detail: w.detail });
|
|
@@ -133,7 +138,7 @@ export async function runStage06(ctx) {
|
|
|
133
138
|
}
|
|
134
139
|
const mcpRevocations = webAdmin.takeMcpRevocations();
|
|
135
140
|
const workflowModelAllowlistSnapshot = workflowModelAllowlistFor(config) ?? [];
|
|
136
|
-
const engineSessionRules = sessionPolicyStore ? createEngineSessionRulesSeat(sessionPolicyStore,
|
|
141
|
+
const engineSessionRules = sessionPolicyStore ? createEngineSessionRulesSeat(sessionPolicyStore, sessionStore) : undefined;
|
|
137
142
|
const runnerDeps = createRunnerDeps({
|
|
138
143
|
consolidationSeat,
|
|
139
144
|
commitCoAuthor,
|
|
@@ -187,9 +192,11 @@ export async function runStage06(ctx) {
|
|
|
187
192
|
};
|
|
188
193
|
const clipHookErr = (s) => (s ?? "").slice(0, 300);
|
|
189
194
|
const titleCapable = sessionStore;
|
|
190
|
-
const
|
|
195
|
+
const titleOccupantOf = sessionOccupantReadOf(sessionStore);
|
|
196
|
+
const sessionTitler = config.sessionAutoTitle && titleCapable.setTitleIfNull && titleCapable.probeTitle && titleOccupantOf
|
|
191
197
|
? createSessionTitler({
|
|
192
198
|
setTitleIfNull: titleCapable.setTitleIfNull.bind(sessionStore),
|
|
199
|
+
occupantOf: titleOccupantOf,
|
|
193
200
|
probeTitle: titleCapable.probeTitle.bind(sessionStore),
|
|
194
201
|
llm: hookLlm,
|
|
195
202
|
logger,
|
|
@@ -227,6 +234,7 @@ export async function runStage06(ctx) {
|
|
|
227
234
|
sharedMemoryStores: sharedMemoryStore ? sharedMemoryStore : undefined,
|
|
228
235
|
engineDataRoot,
|
|
229
236
|
peerDesk,
|
|
237
|
+
runtimeCapsResolver,
|
|
230
238
|
}),
|
|
231
239
|
sessionStore: subRunnerSessions,
|
|
232
240
|
onBackgroundChildEvent: runnerDeps.onBackgroundChildEvent ? runnerDeps.onBackgroundChildEvent : undefined,
|
|
@@ -236,6 +244,6 @@ export async function runStage06(ctx) {
|
|
|
236
244
|
};
|
|
237
245
|
const subRunner = new Runner(subRunnerDeps);
|
|
238
246
|
const settleErasedSessions = createSessionEraseSettler({ attachments: taskAttachmentStore, spaceReclaimer, logger });
|
|
239
|
-
return { ...ctx, sessionEraser, settleErasedSessions, approvalAskAudit, approvalExemptionStore, centerRuntimeCapsResolver, checkpointStore, checkpointCtxSealing, parkCommits, durableEnabled, elicitation, fleetBus, governanceSeams, handslessRunner, hookAgent, hookAgentRunner, hookLlm, mcpRevocations, memoryConsolidationFaces, memoryOptOutGrantStore, orgMemoryAdmission, outcomeSink, principalCaps, question, retentionExecutor, retentionLaneStore, runner, runnerDeps, runtimeCapsPeekReading, sendFileLedger, sendUserFileEmitter, sendUserFileToolSpec, sessionTitler, sharedMemoryStore, sqlWorkflowRunStore, streamApprovalGate, subRunner, subagentSteerRegistry, toolApproval, workflowAgentRegistry, workflowAgentSessionIndex, workflowCompletionInbox, workflowJournalStore, workflowModelAllowlistSnapshot, workflowParkDecisions, workflowNotifyGate, workflowNotifyJournal, workflowRecoverOpts, workflowRunStore, workflowsCapable, orgDeliveryGate };
|
|
247
|
+
return { ...ctx, sessionEraser, settleErasedSessions, approvalAskAudit, approvalExemptionStore, centerRuntimeCapsResolver, checkpointStore, checkpointCtxSealing, parkCommits, durableEnabled, elicitation, fleetBus, governanceSeams, handslessRunner, hookAgent, hookAgentRunner, hookLlm, mcpRevocations, memoryConsolidationFaces, memoryOptOutGrantStore, orgMemoryAdmission, outcomeSink, principalCaps, question, retentionExecutor, retentionLaneStore, runner, runnerDeps, runtimeCapsPeekReading, sendFileLedger, sendUserFileEmitter, sendUserFileToolSpec, sessionTitler, sharedMemoryStore, sqlWorkflowRunStore, streamApprovalGate, subRunner, subagentSteerRegistry, toolApproval, workflowAgentRegistry, workflowAgentSessionIndex, workflowCompletionInbox, workflowJournalStore, workflowModelAllowlistSnapshot, workflowParkDecisions, workflowParkHolderPull, workflowNotifyGate, workflowNotifyJournal, workflowRecoverOpts, workflowRunStore, workflowsCapable, orgDeliveryGate };
|
|
240
248
|
}
|
|
241
249
|
//# sourceMappingURL=stage-06-runners.js.map
|
|
@@ -56,7 +56,7 @@ export declare function runStage07(ctx: Awaited<ReturnType<typeof runStage06>>):
|
|
|
56
56
|
sendUserFileToolSpec: import("@sema-agent/core").ToolSpec<import("@sema-agent/core").TSchema> | undefined;
|
|
57
57
|
sessionTitler: import("../session-titler.js").SessionTitler | undefined;
|
|
58
58
|
sharedMemoryStore: import("../plugins/shared-memory-store-sql.js").SqlSharedMemoryStore | undefined;
|
|
59
|
-
sqlWorkflowRunStore: import("
|
|
59
|
+
sqlWorkflowRunStore: import("../plugins/workflow-run-store-sql.js").SqlWorkflowRunStore | undefined;
|
|
60
60
|
streamApprovalGate: import("../tool-approval.js").StreamApprovalGate<import("../approval-gate-currency.js").GateCurrencyStore>;
|
|
61
61
|
subRunner: import("@sema-agent/core").Runner;
|
|
62
62
|
subagentSteerRegistry: import("../orchestration/subagent-steer.js").SubagentSteerRegistry;
|
|
@@ -67,6 +67,7 @@ export declare function runStage07(ctx: Awaited<ReturnType<typeof runStage06>>):
|
|
|
67
67
|
workflowJournalStore: import("../plugins/store-backend.js").ServiceWorkflowJournalStore | undefined;
|
|
68
68
|
workflowModelAllowlistSnapshot: readonly string[];
|
|
69
69
|
workflowParkDecisions: import("../orchestration/workflow-park-decision.js").WorkflowParkDecisionStore | undefined;
|
|
70
|
+
workflowParkHolderPull: (() => Promise<import("../orchestration/workflow-park-holder.js").HolderPullTally>) | undefined;
|
|
70
71
|
workflowNotifyGate: import("../orchestration/workflow-notify-journal.js").WorkflowNotifyGate | undefined;
|
|
71
72
|
workflowNotifyJournal: import("../orchestration/workflow-notify-journal.js").WorkflowNotifyJournalStore | undefined;
|
|
72
73
|
workflowRecoverOpts: {
|
|
@@ -95,10 +96,12 @@ export declare function runStage07(ctx: Awaited<ReturnType<typeof runStage06>>):
|
|
|
95
96
|
perSessionCwd: Map<string, string>;
|
|
96
97
|
perTaskImage: import("../per-task-image.js").PerTaskImageRegistry;
|
|
97
98
|
sendUserFileTaskEnvs: import("../capabilities/sandbox-file-send.js").TaskEnvRegistry | undefined;
|
|
99
|
+
sessionBindings: {
|
|
100
|
+
commitSessionBindings: (sessionId: string, bindings: import("../session-bindings.js").SessionBindings) => import("../session-bindings.js").SessionBindingReceipt;
|
|
101
|
+
withdrawSessionBindings: (receipt: import("../session-bindings.js").SessionBindingReceipt) => boolean;
|
|
102
|
+
settleSessionBindings: (receipt: import("../session-bindings.js").SessionBindingReceipt) => boolean;
|
|
103
|
+
};
|
|
98
104
|
sessionEnvSelection: import("../capabilities/select-environment-tool.js").SessionEnvironmentSelection;
|
|
99
|
-
setSessionCwd: (sid: string, cwd: string) => void;
|
|
100
|
-
setSessionInheritEnv: (sid: string, policy: import("../request-value-closure.js").TaskInheritEnv | undefined) => void;
|
|
101
|
-
setSessionShellEnv: (sid: string, env: Record<string, string>) => void;
|
|
102
105
|
worktreeReap: (() => Promise<void>) | undefined;
|
|
103
106
|
brain: import("@sema-agent/core").Brain;
|
|
104
107
|
consolidationSeatWatch: import("./memory-consolidation.js").ConsolidationSeatWatch | undefined;
|
|
@@ -33,6 +33,7 @@ import { buildDisplaySafeUrl } from "../trace/redact.js";
|
|
|
33
33
|
import * as facts from "../capability-facts.js";
|
|
34
34
|
import { WEB_ADMIN_ENV } from "@sema-agent/settings-schema";
|
|
35
35
|
import { seatText } from "../trace/exit-seat.js";
|
|
36
|
+
import { hasServiceAuth } from "../identity-source.js";
|
|
36
37
|
export async function runStage07(ctx) {
|
|
37
38
|
const { approvalAskAudit, approvalExemptionStore, backend, backgroundAgentStore, brain, checkpointStore, config, webAdmin, counterDegradeHook, peerDesk, durableEnabled, instanceId, localRoot, logger, question, runner, runnerDeps, sendUserFileToolSpec, sessionEnvSelection, sessionStore, subRunner, taskListLane, toolApproval } = ctx;
|
|
38
39
|
const authorize = createAuthorizer(config, sessionStore, logger);
|
|
@@ -149,7 +150,7 @@ export async function runStage07(ctx) {
|
|
|
149
150
|
if (inert)
|
|
150
151
|
logger.warn(inert.event, inert.fields);
|
|
151
152
|
}
|
|
152
|
-
if (config.requirePrincipal && !
|
|
153
|
+
if (config.requirePrincipal && !hasServiceAuth(config) && !config.traceToken)
|
|
153
154
|
logger.warn("multi_tenant_no_service_token", { detail: "REQUIRE_PRINCIPAL is on but no SERVICE_AUTH_TOKEN/authTokens/TRACE_TOKEN — fleet/trace/session-list are owner-gated only (never fleet-wide, tenant-isolation safe). Set a token for cross-tenant ops visibility." });
|
|
154
155
|
const rateLimiter = backend?.rateLimiter
|
|
155
156
|
? backend.rateLimiter(config.rateLimitPerMin, counterDegradeHook).startRefresh()
|
|
@@ -193,7 +194,7 @@ export async function runStage07(ctx) {
|
|
|
193
194
|
const parkedReviveSurface = checkpointStore && backgroundAgentStore && builtinDefaultScenario ? createParkedReviveSurface(builtinDefaultScenario, { onBackgroundChildEvent: runnerDeps.onBackgroundChildEvent }) : undefined;
|
|
194
195
|
const parkedReviveInheritedGate = parkedReviveSurface && config.durableApproval
|
|
195
196
|
? createParkedReviveInheritedGate({
|
|
196
|
-
config, question, logger, localRoot,
|
|
197
|
+
config, questionSeat: question !== undefined, logger, localRoot,
|
|
197
198
|
approverSeat: createRunnerDepsOnAsk(toolApproval),
|
|
198
199
|
approvalExemptionStore,
|
|
199
200
|
...(runnerDeps.runtimeCapsResolver ? { resolveRuntimeCaps: runnerDeps.runtimeCapsResolver } : {}),
|
|
@@ -69,7 +69,7 @@ export declare function runStage08(ctx: Awaited<ReturnType<typeof runStage07>>):
|
|
|
69
69
|
sendUserFileToolSpec: import("@sema-agent/core").ToolSpec<import("@sema-agent/core").TSchema> | undefined;
|
|
70
70
|
sessionTitler: import("../session-titler.js").SessionTitler | undefined;
|
|
71
71
|
sharedMemoryStore: import("../plugins/shared-memory-store-sql.js").SqlSharedMemoryStore | undefined;
|
|
72
|
-
sqlWorkflowRunStore: import("
|
|
72
|
+
sqlWorkflowRunStore: import("../plugins/workflow-run-store-sql.js").SqlWorkflowRunStore | undefined;
|
|
73
73
|
streamApprovalGate: import("../tool-approval.js").StreamApprovalGate<import("../approval-gate-currency.js").GateCurrencyStore>;
|
|
74
74
|
subRunner: Runner;
|
|
75
75
|
subagentSteerRegistry: import("../orchestration/subagent-steer.js").SubagentSteerRegistry;
|
|
@@ -80,6 +80,7 @@ export declare function runStage08(ctx: Awaited<ReturnType<typeof runStage07>>):
|
|
|
80
80
|
workflowJournalStore: import("../plugins/store-backend.js").ServiceWorkflowJournalStore | undefined;
|
|
81
81
|
workflowModelAllowlistSnapshot: readonly string[];
|
|
82
82
|
workflowParkDecisions: import("../orchestration/workflow-park-decision.js").WorkflowParkDecisionStore | undefined;
|
|
83
|
+
workflowParkHolderPull: (() => Promise<import("../orchestration/workflow-park-holder.js").HolderPullTally>) | undefined;
|
|
83
84
|
workflowNotifyGate: import("../orchestration/workflow-notify-journal.js").WorkflowNotifyGate | undefined;
|
|
84
85
|
workflowNotifyJournal: import("../orchestration/workflow-notify-journal.js").WorkflowNotifyJournalStore | undefined;
|
|
85
86
|
workflowRecoverOpts: {
|
|
@@ -108,10 +109,12 @@ export declare function runStage08(ctx: Awaited<ReturnType<typeof runStage07>>):
|
|
|
108
109
|
perSessionCwd: Map<string, string>;
|
|
109
110
|
perTaskImage: import("../per-task-image.js").PerTaskImageRegistry;
|
|
110
111
|
sendUserFileTaskEnvs: import("../capabilities/sandbox-file-send.js").TaskEnvRegistry | undefined;
|
|
112
|
+
sessionBindings: {
|
|
113
|
+
commitSessionBindings: (sessionId: string, bindings: import("../session-bindings.js").SessionBindings) => import("../session-bindings.js").SessionBindingReceipt;
|
|
114
|
+
withdrawSessionBindings: (receipt: import("../session-bindings.js").SessionBindingReceipt) => boolean;
|
|
115
|
+
settleSessionBindings: (receipt: import("../session-bindings.js").SessionBindingReceipt) => boolean;
|
|
116
|
+
};
|
|
111
117
|
sessionEnvSelection: import("../capabilities/select-environment-tool.js").SessionEnvironmentSelection;
|
|
112
|
-
setSessionCwd: (sid: string, cwd: string) => void;
|
|
113
|
-
setSessionInheritEnv: (sid: string, policy: import("../request-value-closure.js").TaskInheritEnv | undefined) => void;
|
|
114
|
-
setSessionShellEnv: (sid: string, env: Record<string, string>) => void;
|
|
115
118
|
worktreeReap: (() => Promise<void>) | undefined;
|
|
116
119
|
brain: import("@sema-agent/core").Brain;
|
|
117
120
|
consolidationSeatWatch: import("./memory-consolidation.js").ConsolidationSeatWatch | undefined;
|
|
@@ -3,10 +3,10 @@ import { startOtlpExporter } from "../observability/otel-exporter.js";
|
|
|
3
3
|
import { startReapers } from "./reapers.js";
|
|
4
4
|
import { startRetentionLane, RETENTION_LEASE_TTL_FACTOR } from "./retention-lane.js";
|
|
5
5
|
import { createLimitSync } from "./limit-sync.js";
|
|
6
|
-
import { runDenySweep } from "./late-binds.js";
|
|
6
|
+
import { runDenySweep, sessionAgeOut } from "./late-binds.js";
|
|
7
7
|
import { seatText } from "../trace/exit-seat.js";
|
|
8
8
|
export function runStage08(ctx) {
|
|
9
|
-
const { approvalAskAudit, approvalNonceStore, backend, backgroundAgentStore, ceilingVerdict, checkpointStore, parkCommits, config, webAdmin, consolidationSeatWatch, costQuota, degradeRouteWatch, fileHistoryErasure, settleErasedSessions, sandboxReaper, handslessRunner, hookAgentRunner, imageBakes, instanceId, localRoot, logger, mailboxStore, metrics, permissionRuleStores, pricing, rateLimiter, retentionExecutor, retentionLaneStore, runStore, runner, sqlWorkflowRunStore, storeSweep, subRunner, taskAttachmentStore, toolApproval, userInputLedger, workflowNotifyGate, workflowNotifyJournal, workflowRecoverOpts, worktreeReap } = ctx;
|
|
9
|
+
const { approvalAskAudit, approvalNonceStore, backend, backgroundAgentStore, ceilingVerdict, checkpointStore, parkCommits, config, webAdmin, consolidationSeatWatch, costQuota, degradeRouteWatch, fileHistoryErasure, settleErasedSessions, sandboxReaper, handslessRunner, hookAgentRunner, imageBakes, instanceId, localRoot, logger, mailboxStore, metrics, permissionRuleStores, pricing, rateLimiter, retentionExecutor, retentionLaneStore, runStore, runner, sqlWorkflowRunStore, storeSweep, subRunner, taskAttachmentStore, toolApproval, userInputLedger, workflowNotifyGate, workflowNotifyJournal, workflowRecoverOpts, worktreeReap, workflowParkHolderPull } = ctx;
|
|
10
10
|
const reaper = startReapers({
|
|
11
11
|
config, logger, metrics, localRoot, backend, subRunner, runStore, checkpointStore, parkCommits,
|
|
12
12
|
rateLimiter, costQuota, storeSweep, fileHistoryErasure, taskAttachmentStore, imageBakes, worktreeReap,
|
|
@@ -14,6 +14,8 @@ export function runStage08(ctx) {
|
|
|
14
14
|
backgroundAgentStore, mailboxStore, toolApproval, permissionRuleStores, approvalNonceStore, userInputLedger, approvalAskAudit,
|
|
15
15
|
...(sandboxReaper !== undefined ? { sandboxReaper } : {}),
|
|
16
16
|
getRunDenySweep: () => runDenySweep,
|
|
17
|
+
getSessionAgeOut: () => sessionAgeOut,
|
|
18
|
+
...(workflowParkHolderPull !== undefined ? { workflowParkHolderPull } : {}),
|
|
17
19
|
});
|
|
18
20
|
const ttlMs = config.retentionSweep.intervalSec * 1000 * RETENTION_LEASE_TTL_FACTOR;
|
|
19
21
|
const retentionLaneStarted = retentionExecutor !== undefined && retentionLaneStore !== undefined && config.retentionPolicy !== undefined
|
|
@@ -9,9 +9,12 @@ export declare function runStage09(ctx: Awaited<ReturnType<typeof runStage08>>):
|
|
|
9
9
|
leaderEndpoint: import("../leader/endpoint.js").LeaderEndpoint | undefined;
|
|
10
10
|
ownerAware: import("../security.js").OwnerAwareSessionStore;
|
|
11
11
|
planCacheProbe: import("../plan-cache-probe.js").PlanCacheProbe;
|
|
12
|
-
purgeSession: ((sessionId: string, owner: string | null
|
|
12
|
+
purgeSession: ((sessionId: string, owner: string | null, opts?: {
|
|
13
|
+
readonly ageOut?: import("../session-deletion.js").SessionAgeOutExpectation;
|
|
14
|
+
}) => Promise<import("../session-deletion.js").SessionPurgeOutcome>) | undefined;
|
|
13
15
|
webAdminJwtVerifier: import("../auth-bridge.js").WebAdminJwtVerifier | undefined;
|
|
14
16
|
sessionAudit: ((sessionId: string, opts?: import("../audit.js").SessionAuditReadOpts) => Promise<{
|
|
17
|
+
sessionKind?: "sidechain" | undefined;
|
|
15
18
|
projectId?: string | undefined;
|
|
16
19
|
agent?: import("../session-agent.js").SessionAgent | undefined;
|
|
17
20
|
owner: string | null;
|
|
@@ -88,7 +91,7 @@ export declare function runStage09(ctx: Awaited<ReturnType<typeof runStage08>>):
|
|
|
88
91
|
sendUserFileToolSpec: import("@sema-agent/core").ToolSpec<import("@sema-agent/core").TSchema> | undefined;
|
|
89
92
|
sessionTitler: import("../session-titler.js").SessionTitler | undefined;
|
|
90
93
|
sharedMemoryStore: import("../plugins/shared-memory-store-sql.js").SqlSharedMemoryStore | undefined;
|
|
91
|
-
sqlWorkflowRunStore: import("
|
|
94
|
+
sqlWorkflowRunStore: import("../plugins/workflow-run-store-sql.js").SqlWorkflowRunStore | undefined;
|
|
92
95
|
streamApprovalGate: import("../tool-approval.js").StreamApprovalGate<import("../approval-gate-currency.js").GateCurrencyStore>;
|
|
93
96
|
subRunner: import("@sema-agent/core").Runner;
|
|
94
97
|
subagentSteerRegistry: import("../orchestration/subagent-steer.js").SubagentSteerRegistry;
|
|
@@ -99,6 +102,7 @@ export declare function runStage09(ctx: Awaited<ReturnType<typeof runStage08>>):
|
|
|
99
102
|
workflowJournalStore: import("../plugins/store-backend.js").ServiceWorkflowJournalStore | undefined;
|
|
100
103
|
workflowModelAllowlistSnapshot: readonly string[];
|
|
101
104
|
workflowParkDecisions: import("../orchestration/workflow-park-decision.js").WorkflowParkDecisionStore | undefined;
|
|
105
|
+
workflowParkHolderPull: (() => Promise<import("../orchestration/workflow-park-holder.js").HolderPullTally>) | undefined;
|
|
102
106
|
workflowNotifyGate: import("../orchestration/workflow-notify-journal.js").WorkflowNotifyGate | undefined;
|
|
103
107
|
workflowNotifyJournal: import("../orchestration/workflow-notify-journal.js").WorkflowNotifyJournalStore | undefined;
|
|
104
108
|
workflowRecoverOpts: {
|
|
@@ -127,10 +131,12 @@ export declare function runStage09(ctx: Awaited<ReturnType<typeof runStage08>>):
|
|
|
127
131
|
perSessionCwd: Map<string, string>;
|
|
128
132
|
perTaskImage: import("../per-task-image.js").PerTaskImageRegistry;
|
|
129
133
|
sendUserFileTaskEnvs: import("../capabilities/sandbox-file-send.js").TaskEnvRegistry | undefined;
|
|
134
|
+
sessionBindings: {
|
|
135
|
+
commitSessionBindings: (sessionId: string, bindings: import("../session-bindings.js").SessionBindings) => import("../session-bindings.js").SessionBindingReceipt;
|
|
136
|
+
withdrawSessionBindings: (receipt: import("../session-bindings.js").SessionBindingReceipt) => boolean;
|
|
137
|
+
settleSessionBindings: (receipt: import("../session-bindings.js").SessionBindingReceipt) => boolean;
|
|
138
|
+
};
|
|
130
139
|
sessionEnvSelection: import("../capabilities/select-environment-tool.js").SessionEnvironmentSelection;
|
|
131
|
-
setSessionCwd: (sid: string, cwd: string) => void;
|
|
132
|
-
setSessionInheritEnv: (sid: string, policy: import("../request-value-closure.js").TaskInheritEnv | undefined) => void;
|
|
133
|
-
setSessionShellEnv: (sid: string, env: Record<string, string>) => void;
|
|
134
140
|
worktreeReap: (() => Promise<void>) | undefined;
|
|
135
141
|
brain: import("@sema-agent/core").Brain;
|
|
136
142
|
consolidationSeatWatch: import("./memory-consolidation.js").ConsolidationSeatWatch | undefined;
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { describeStaticWiring } from "@sema-agent/core";
|
|
2
2
|
import { encodeCheckpointScope } from "../security.js";
|
|
3
|
-
import { createWebAdminJwtVerifier } from "../auth-bridge.js";
|
|
3
|
+
import { createWebAdminJwtVerifier, ssoBoundScopeOf } from "../auth-bridge.js";
|
|
4
4
|
import { authBridgeIssuerOf } from "../identity-source.js";
|
|
5
5
|
import { createSessionFaces } from "./session-faces.js";
|
|
6
|
+
import { createSessionAgeOut } from "./session-age-out.js";
|
|
7
|
+
import { bindSessionAgeOut } from "./late-binds.js";
|
|
8
|
+
import * as facts from "../capability-facts.js";
|
|
6
9
|
import { createLeaderFace } from "./leader.js";
|
|
7
10
|
import { assertStaticWiringConsistent } from "../http/routes/diagnostics.js";
|
|
8
11
|
import { seatText } from "../trace/exit-seat.js";
|
|
@@ -24,6 +27,10 @@ export function runStage09(ctx) {
|
|
|
24
27
|
if (recoverPendingDeletions !== undefined) {
|
|
25
28
|
void recoverPendingDeletions().catch((err) => logger.warn("session_delete_recovery_unfinished", { outcome: "pending_unreadable", err: seatText("operator-log-text", String(err)), effect: "sessions left in the deleting state by an earlier process stay so (they read as gone); the next start or a repeated DELETE finishes them" }));
|
|
26
29
|
}
|
|
30
|
+
const ageOutStore = ownerAware.listIdleOfKind !== undefined ? { listIdleOfKind: ownerAware.listIdleOfKind.bind(ownerAware) } : undefined;
|
|
31
|
+
bindSessionAgeOut(purgeSession !== undefined && ageOutStore !== undefined && facts.sessionKinds({ sessionStorage: ownerAware, purgeSession }).available
|
|
32
|
+
? createSessionAgeOut({ store: ageOutStore, purge: purgeSession, retentionMs: () => config.backgroundAgentRetentionMs, logger, metrics })
|
|
33
|
+
: undefined);
|
|
27
34
|
const leaderEndpoint = createLeaderFace({ config, logger, brain, pricing, executionEnvFactory, toolResultStore, sessionStore, checkpointStore, checkpointCtxSealing, governanceSeams, backend, tracer, usageWindowStore, promptSource: webAdmin.promptSource, onError: runnerDeps.onError, deploymentMods });
|
|
28
35
|
const drainState = { draining: false };
|
|
29
36
|
const authBridgeIssuer = authBridgeIssuerOf(config)?.issuer;
|
|
@@ -36,8 +43,10 @@ export function runStage09(ctx) {
|
|
|
36
43
|
metrics,
|
|
37
44
|
})
|
|
38
45
|
: undefined;
|
|
39
|
-
if (webAdminJwtVerifier)
|
|
40
|
-
|
|
46
|
+
if (webAdminJwtVerifier) {
|
|
47
|
+
const boundScope = ssoBoundScopeOf(config);
|
|
48
|
+
logger.info("auth_bridge_enabled", { issuer: buildDisplaySafeUrl(authBridgeIssuer ?? ""), scopeAdmission: boundScope === undefined ? { judged: false } : { judged: true, scope: boundScope } });
|
|
49
|
+
}
|
|
41
50
|
const hookWakeBus = {};
|
|
42
51
|
const wiringSpecTemplate = durableEnabled
|
|
43
52
|
? { checkpointStore, durableApproval: { scope: encodeCheckpointScope(undefined) } }
|
|
@@ -1,4 +1,36 @@
|
|
|
1
|
+
import { brainSummary } from "../brain.js";
|
|
2
|
+
import { type ServiceConfig } from "../config.js";
|
|
1
3
|
import type { runStage09 } from "./stage-09-leader.js";
|
|
4
|
+
/**
|
|
5
|
+
* 启动协议行 `listening` 的字段(行本身是 `observability/logger.ts` 的 {@link import("../observability/logger.js").STARTUP_PROTOCOL_EVENTS} 一员:不随 `LOG_LEVEL`)。
|
|
6
|
+
* 铸点 = 本文件 listen 之后那一行(全仓唯一,`test/source-hygiene-gate.test.ts` M7),字面量过 {@link exactListeningLine}(键集恰等于本型,可选键与条件展开同算);
|
|
7
|
+
* 键集登记在自铸登记表 `listeningLineKey`(`satisfies Record<keyof ListeningLine, …>`:键加一个而登记表没跟 / 多一个 ⇒ tsc 红)。只登顶层键;`brain` 段里的键随 `brainSummary` 走,不在本型。
|
|
8
|
+
*
|
|
9
|
+
* 绑址两格,一格一个事实:`bindHost` = 本进程**请求**绑的地址(`resolveBindHost` 的答案 —— `BIND_HOST` 经无鉴权自收窄之后的那一只;答案缺席 = 全接口时是说明串);`boundAddress` = 内核**实际**绑上的地址
|
|
10
|
+
* (`server.address().address` 原样:`::` / `0.0.0.0` / `127.0.0.1` / `::1` …;配置写 `localhost` 时它是解析出的那一只)。口同理:`port` 读的也是绑定者自己的答案。
|
|
11
|
+
*/
|
|
12
|
+
export interface ListeningLine {
|
|
13
|
+
readonly port: number;
|
|
14
|
+
readonly bindHost: string;
|
|
15
|
+
readonly bindHostNote?: string;
|
|
16
|
+
readonly boundAddress: string;
|
|
17
|
+
readonly model: ServiceConfig["model"]["id"];
|
|
18
|
+
readonly brain: ReturnType<typeof brainSummary>;
|
|
19
|
+
readonly breakerState: string;
|
|
20
|
+
readonly session: string;
|
|
21
|
+
readonly memory: string;
|
|
22
|
+
readonly instanceId: string;
|
|
23
|
+
readonly rateLimitPerMin: number;
|
|
24
|
+
readonly rateLimit: string;
|
|
25
|
+
readonly maxPrincipalCostUsd: number | null;
|
|
26
|
+
readonly costQuota: string;
|
|
27
|
+
readonly toolResultStore: string;
|
|
28
|
+
readonly otel: string | null;
|
|
29
|
+
readonly perModelKeys: number;
|
|
30
|
+
readonly sealedModelKeys: number;
|
|
31
|
+
readonly sealedPoisonedModels: number;
|
|
32
|
+
readonly workflowRunStore: string;
|
|
33
|
+
}
|
|
2
34
|
export declare function runStage10(ctx: Awaited<ReturnType<typeof runStage09>>): Promise<{
|
|
3
35
|
drainState: import("../fleet/drain-entry.js").DrainState;
|
|
4
36
|
hookWakeBus: {
|
|
@@ -8,9 +40,12 @@ export declare function runStage10(ctx: Awaited<ReturnType<typeof runStage09>>):
|
|
|
8
40
|
leaderEndpoint: import("../leader/endpoint.js").LeaderEndpoint | undefined;
|
|
9
41
|
ownerAware: import("../security.js").OwnerAwareSessionStore;
|
|
10
42
|
planCacheProbe: import("../plan-cache-probe.js").PlanCacheProbe;
|
|
11
|
-
purgeSession: ((sessionId: string, owner: string | null
|
|
43
|
+
purgeSession: ((sessionId: string, owner: string | null, opts?: {
|
|
44
|
+
readonly ageOut?: import("../session-deletion.js").SessionAgeOutExpectation;
|
|
45
|
+
}) => Promise<import("../session-deletion.js").SessionPurgeOutcome>) | undefined;
|
|
12
46
|
webAdminJwtVerifier: import("../auth-bridge.js").WebAdminJwtVerifier | undefined;
|
|
13
47
|
sessionAudit: ((sessionId: string, opts?: import("../audit.js").SessionAuditReadOpts) => Promise<{
|
|
48
|
+
sessionKind?: "sidechain" | undefined;
|
|
14
49
|
projectId?: string | undefined;
|
|
15
50
|
agent?: import("../session-agent.js").SessionAgent | undefined;
|
|
16
51
|
owner: string | null;
|
|
@@ -87,7 +122,7 @@ export declare function runStage10(ctx: Awaited<ReturnType<typeof runStage09>>):
|
|
|
87
122
|
sendUserFileToolSpec: import("@sema-agent/core").ToolSpec<import("@sema-agent/core").TSchema> | undefined;
|
|
88
123
|
sessionTitler: import("../session-titler.js").SessionTitler | undefined;
|
|
89
124
|
sharedMemoryStore: import("../plugins/shared-memory-store-sql.js").SqlSharedMemoryStore | undefined;
|
|
90
|
-
sqlWorkflowRunStore: import("
|
|
125
|
+
sqlWorkflowRunStore: import("../plugins/workflow-run-store-sql.js").SqlWorkflowRunStore | undefined;
|
|
91
126
|
streamApprovalGate: import("../tool-approval.js").StreamApprovalGate<import("../approval-gate-currency.js").GateCurrencyStore>;
|
|
92
127
|
subRunner: import("@sema-agent/core").Runner;
|
|
93
128
|
subagentSteerRegistry: import("../orchestration/subagent-steer.js").SubagentSteerRegistry;
|
|
@@ -98,6 +133,7 @@ export declare function runStage10(ctx: Awaited<ReturnType<typeof runStage09>>):
|
|
|
98
133
|
workflowJournalStore: import("../plugins/store-backend.js").ServiceWorkflowJournalStore | undefined;
|
|
99
134
|
workflowModelAllowlistSnapshot: readonly string[];
|
|
100
135
|
workflowParkDecisions: import("../orchestration/workflow-park-decision.js").WorkflowParkDecisionStore | undefined;
|
|
136
|
+
workflowParkHolderPull: (() => Promise<import("../orchestration/workflow-park-holder.js").HolderPullTally>) | undefined;
|
|
101
137
|
workflowNotifyGate: import("../orchestration/workflow-notify-journal.js").WorkflowNotifyGate | undefined;
|
|
102
138
|
workflowNotifyJournal: import("../orchestration/workflow-notify-journal.js").WorkflowNotifyJournalStore | undefined;
|
|
103
139
|
workflowRecoverOpts: {
|
|
@@ -126,10 +162,12 @@ export declare function runStage10(ctx: Awaited<ReturnType<typeof runStage09>>):
|
|
|
126
162
|
perSessionCwd: Map<string, string>;
|
|
127
163
|
perTaskImage: import("../per-task-image.js").PerTaskImageRegistry;
|
|
128
164
|
sendUserFileTaskEnvs: import("../capabilities/sandbox-file-send.js").TaskEnvRegistry | undefined;
|
|
165
|
+
sessionBindings: {
|
|
166
|
+
commitSessionBindings: (sessionId: string, bindings: import("../session-bindings.js").SessionBindings) => import("../session-bindings.js").SessionBindingReceipt;
|
|
167
|
+
withdrawSessionBindings: (receipt: import("../session-bindings.js").SessionBindingReceipt) => boolean;
|
|
168
|
+
settleSessionBindings: (receipt: import("../session-bindings.js").SessionBindingReceipt) => boolean;
|
|
169
|
+
};
|
|
129
170
|
sessionEnvSelection: import("../capabilities/select-environment-tool.js").SessionEnvironmentSelection;
|
|
130
|
-
setSessionCwd: (sid: string, cwd: string) => void;
|
|
131
|
-
setSessionInheritEnv: (sid: string, policy: import("../request-value-closure.js").TaskInheritEnv | undefined) => void;
|
|
132
|
-
setSessionShellEnv: (sid: string, env: Record<string, string>) => void;
|
|
133
171
|
worktreeReap: (() => Promise<void>) | undefined;
|
|
134
172
|
brain: import("@sema-agent/core").Brain;
|
|
135
173
|
consolidationSeatWatch: import("./memory-consolidation.js").ConsolidationSeatWatch | undefined;
|
|
@@ -186,7 +224,7 @@ export declare function runStage10(ctx: Awaited<ReturnType<typeof runStage09>>):
|
|
|
186
224
|
taskAttachmentStore: import("../plugins/task-attachment-store.js").TaskAttachmentStore | undefined;
|
|
187
225
|
taskListLane: import("./task-list-lane.js").TaskListLane;
|
|
188
226
|
usageWindowStore: import("@sema-agent/core").UsageWindowStore | undefined;
|
|
189
|
-
config:
|
|
227
|
+
config: ServiceConfig;
|
|
190
228
|
ceilingVerdict: import("./unpriced-ceiling-verdict.js").UnpricedCeilingVerdict;
|
|
191
229
|
storeEvidence: import("../store-posture.js").StoreEvidence;
|
|
192
230
|
webAdmin: import("./web-admin.js").WebAdminRuntime;
|