@sema-agent/server 7.150.0 → 7.152.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 +451 -0
- package/README.md +15 -3
- package/README.zh-CN.md +10 -2
- package/USAGE.md +144 -87
- package/deploy/sema-up/README.md +11 -4
- 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 +7 -6
- package/deploy/sema-up/kube-up.sh +6 -6
- package/deploy/sema-up/lib/flagshape.sh +36 -8
- package/deploy/sema-up/lib/helm-values-cluster.py +2 -0
- package/deploy/sema-up/lib/helm-values-kube.py +2 -0
- package/deploy/sema-up/machines.example.yaml +3 -1
- package/deploy/sema-up/sema-up.sh +22 -16
- package/dist/adoption/import.js +3 -3
- package/dist/approval-ask-audit-store.d.ts +1 -1
- package/dist/approval-ask-machine.d.ts +4 -10
- package/dist/approval-ask-retention.d.ts +1 -1
- package/dist/approval-card.d.ts +12 -14
- package/dist/approval-gate-currency.d.ts +9 -9
- package/dist/approval-gate-currency.js +3 -4
- package/dist/approval-hmac.d.ts +17 -1
- package/dist/approval-hmac.js +7 -1
- package/dist/approval-queue-kind.d.ts +1 -1
- package/dist/approval.d.ts +2 -2
- package/dist/approval.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 +1 -1
- package/dist/bake-runner/main.d.ts +4 -2
- package/dist/bind-host.d.ts +3 -6
- package/dist/bind-host.js +4 -7
- package/dist/boot/budget-tracing.js +1 -1
- package/dist/boot/coordinators.d.ts +1 -1
- package/dist/boot/coordinators.js +9 -10
- package/dist/boot/device-lane.js +2 -0
- package/dist/boot/engine-lease.d.ts +5 -0
- package/dist/boot/engine-lease.js +1 -0
- package/dist/boot/execution-env.d.ts +9 -14
- package/dist/boot/execution-env.js +85 -22
- 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/leader.d.ts +31 -30
- package/dist/boot/leader.js +38 -28
- package/dist/boot/leg-path-adjudication.d.ts +40 -0
- package/dist/boot/leg-path-adjudication.js +18 -0
- package/dist/boot/memory-consolidation.d.ts +3 -2
- package/dist/boot/memory-consolidation.js +6 -6
- package/dist/boot/parked-revive-gate.js +3 -15
- package/dist/boot/reapers.d.ts +6 -1
- package/dist/boot/reapers.js +13 -2
- package/dist/boot/resolve-spec.d.ts +3 -3
- package/dist/boot/resolve-spec.js +43 -48
- package/dist/boot/runner-deps.d.ts +46 -35
- package/dist/boot/runner-deps.js +94 -91
- 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 +9 -5
- package/dist/boot/shutdown.d.ts +6 -0
- package/dist/boot/shutdown.js +10 -4
- package/dist/boot/stage-01-config.js +2 -0
- package/dist/boot/stage-02-web-admin-pull.js +4 -5
- package/dist/boot/stage-05-execution-env.d.ts +5 -3
- package/dist/boot/stage-05-execution-env.js +3 -2
- package/dist/boot/stage-06-runners.d.ts +9 -4
- package/dist/boot/stage-06-runners.js +24 -9
- package/dist/boot/stage-07-capability-layer.d.ts +8 -4
- package/dist/boot/stage-07-capability-layer.js +3 -2
- package/dist/boot/stage-08-reapers.d.ts +8 -4
- package/dist/boot/stage-08-reapers.js +4 -2
- package/dist/boot/stage-09-leader.d.ts +12 -5
- package/dist/boot/stage-09-leader.js +14 -5
- package/dist/boot/stage-10-http-server.d.ts +19 -5
- package/dist/boot/stage-10-http-server.js +14 -21
- package/dist/boot/stores.js +7 -4
- package/dist/boot/web-admin.js +5 -8
- 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/capabilities/approvals-push.d.ts +3 -3
- package/dist/capabilities/scenarios.d.ts +28 -13
- package/dist/capabilities/scenarios.js +2 -2
- package/dist/capability-facts.d.ts +43 -32
- package/dist/capability-facts.js +45 -51
- package/dist/card-rule-offers.d.ts +32 -0
- package/dist/card-rule-offers.js +130 -0
- 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 +26 -22
- package/dist/config-dir-trust.js +4 -2
- package/dist/config-invariants.d.ts +20 -8
- package/dist/config-invariants.js +55 -12
- package/dist/config-lkg.d.ts +5 -19
- package/dist/config-lkg.js +8 -62
- package/dist/config-provider.d.ts +1 -1
- package/dist/config-root-migration.d.ts +2 -2
- package/dist/config-types.d.ts +38 -42
- package/dist/config.d.ts +58 -7
- package/dist/config.js +90 -40
- package/dist/control-socket.d.ts +51 -0
- package/dist/control-socket.js +115 -0
- package/dist/deployment-governance.d.ts +2 -1
- 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 +7 -0
- package/dist/device-ws-hub.js +10 -3
- package/dist/device-ws-protocol.d.ts +63 -10
- package/dist/device-ws-protocol.js +56 -25
- package/dist/elicitation.js +2 -2
- package/dist/engine-identity.d.ts +19 -7
- package/dist/engine-identity.js +10 -2
- package/dist/entry-mode-clamp-notice.d.ts +2 -1
- package/dist/entry-problems.d.ts +40 -3
- package/dist/entry-problems.js +3 -1
- package/dist/execution-env-refusal.d.ts +29 -0
- package/dist/execution-env-refusal.js +8 -0
- package/dist/execution-lane-caps.d.ts +3 -1
- package/dist/field-conflict.d.ts +1 -1
- 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 +12 -29
- package/dist/fleet/engine-signal.js +1 -7
- package/dist/fleet-client.js +2 -5
- package/dist/gate-settlement.d.ts +1 -8
- package/dist/gate-settlement.js +0 -4
- package/dist/history-anchor.js +1 -1
- package/dist/hitl-delivery.d.ts +2 -3
- package/dist/hitl-delivery.js +0 -2
- package/dist/hooks/hook-llm.js +4 -2
- package/dist/hooks/hook-runner.d.ts +3 -2
- package/dist/hooks/hook-runner.js +18 -3
- package/dist/host-decision.d.ts +11 -11
- package/dist/host-lsp-manager.d.ts +2 -2
- package/dist/http/active-run-conflict.d.ts +35 -2
- package/dist/http/active-run-conflict.js +48 -19
- package/dist/http/admission.js +17 -2
- package/dist/http/approval-sweeps.d.ts +1 -1
- package/dist/http/approval-sweeps.js +10 -7
- package/dist/http/checkpoint-ctx.d.ts +4 -0
- package/dist/http/checkpoint-ctx.js +2 -0
- package/dist/http/dispatch.d.ts +8 -3
- package/dist/http/dispatch.js +59 -32
- package/dist/http/durable-run-leg.js +16 -17
- package/dist/http/health-reader.d.ts +16 -9
- package/dist/http/health-reader.js +2 -1
- package/dist/http/health-self-report.d.ts +9 -1
- package/dist/http/health-self-report.js +3 -1
- package/dist/http/owner-access.d.ts +33 -14
- package/dist/http/owner-access.js +40 -10
- package/dist/http/principal-gate.d.ts +49 -21
- package/dist/http/principal-gate.js +61 -11
- package/dist/http/request-channel.d.ts +23 -0
- package/dist/http/request-channel.js +9 -0
- package/dist/http/request-guards.js +17 -2
- package/dist/http/resume-ctx-read.js +42 -3
- package/dist/http/resume-legs.d.ts +4 -3
- package/dist/http/resume-legs.js +367 -117
- package/dist/http/route-ctx.d.ts +91 -15
- package/dist/http/route-ctx.js +17 -0
- package/dist/http/route-table.d.ts +5 -1
- package/dist/http/route-table.js +4 -0
- package/dist/http/routes/admin-config-refresh.js +3 -3
- package/dist/http/routes/admin-drain.d.ts +3 -0
- package/dist/http/routes/admin-drain.js +7 -7
- package/dist/http/routes/admin-memory-optout.d.ts +1 -1
- package/dist/http/routes/admin-memory-optout.js +3 -3
- package/dist/http/routes/adoption.js +3 -5
- package/dist/http/routes/agents-roster.js +2 -3
- package/dist/http/routes/approvals-assistant.d.ts +2 -1
- package/dist/http/routes/approvals-assistant.js +99 -51
- package/dist/http/routes/background.d.ts +3 -3
- package/dist/http/routes/capabilities.d.ts +4 -0
- package/dist/http/routes/capabilities.js +38 -10
- package/dist/http/routes/config-catalog.js +2 -2
- package/dist/http/routes/devices.js +1 -1
- package/dist/http/routes/diagnostics.d.ts +3 -3
- package/dist/http/routes/diagnostics.js +19 -7
- package/dist/http/routes/fleet.js +10 -8
- package/dist/http/routes/images.js +10 -10
- package/dist/http/routes/memory-bundle.js +3 -3
- package/dist/http/routes/memory-compliance.js +3 -3
- package/dist/http/routes/memory-consolidation.js +2 -2
- package/dist/http/routes/memory-origin.js +3 -3
- package/dist/http/routes/memory-policy.js +2 -2
- package/dist/http/routes/observability.js +3 -3
- package/dist/http/routes/projects.d.ts +3 -2
- package/dist/http/routes/projects.js +4 -5
- package/dist/http/routes/retention-ops.js +3 -3
- package/dist/http/routes/rules.js +5 -5
- package/dist/http/routes/run-permission-mode.d.ts +2 -1
- package/dist/http/routes/run-permission-mode.js +2 -2
- package/dist/http/routes/runs.d.ts +4 -9
- package/dist/http/routes/runs.js +171 -65
- package/dist/http/routes/session-sync.d.ts +22 -9
- package/dist/http/routes/session-sync.js +204 -107
- package/dist/http/routes/sessions-list.js +13 -7
- package/dist/http/routes/sessions.js +30 -15
- package/dist/http/routes/tasks.js +46 -41
- package/dist/http/routes/trace-usage.js +2 -2
- package/dist/http/routes/workflows.js +1 -1
- package/dist/http/server.d.ts +30 -30
- package/dist/http/server.js +16 -4
- package/dist/http/submit-ctx.d.ts +1 -1
- package/dist/http/submit-ctx.js +7 -4
- package/dist/http/wire-types.d.ts +14 -4
- package/dist/human-facing-args.d.ts +33 -0
- package/dist/human-facing-args.js +33 -0
- package/dist/identity-source.d.ts +20 -3
- package/dist/identity-source.js +14 -0
- package/dist/index.d.ts +5 -1
- package/dist/k8s-api-credentials.d.ts +29 -0
- package/dist/k8s-api-credentials.js +25 -0
- package/dist/lane-home-probe.d.ts +3 -7
- package/dist/lane-home-probe.js +2 -2
- package/dist/leader/diffup.d.ts +19 -0
- package/dist/leader/diffup.js +7 -0
- package/dist/leader/leader.d.ts +116 -11
- package/dist/leader/leader.js +69 -5
- package/dist/leader/repair-wire.js +2 -2
- package/dist/leader/run-entry.d.ts +2 -1
- package/dist/leader/run-entry.js +1 -1
- package/dist/leader/wire.d.ts +42 -132
- package/dist/leader/wire.js +81 -67
- package/dist/leg-facts.d.ts +13 -5
- package/dist/leg-facts.js +2 -1
- package/dist/memory-scope.d.ts +23 -11
- package/dist/memory-scope.js +18 -6
- package/dist/memory-sync-client.d.ts +30 -2
- package/dist/memory-sync-client.js +16 -9
- package/dist/model-entry-headers.d.ts +9 -10
- package/dist/model-entry-headers.js +0 -4
- package/dist/model-entry-refusal.d.ts +7 -4
- package/dist/model-entry-refusal.js +11 -5
- package/dist/model-plane-face.d.ts +1 -1
- package/dist/model-plane-face.js +3 -1
- package/dist/model-route-endpoint.d.ts +13 -7
- package/dist/model-route-endpoint.js +14 -11
- package/dist/model-select.d.ts +22 -0
- package/dist/model-select.js +9 -0
- package/dist/model-unreachable-notice.d.ts +11 -0
- package/dist/model-unreachable-notice.js +4 -4
- package/dist/object-store-buckets.d.ts +640 -6
- package/dist/object-store-buckets.js +166 -0
- package/dist/observability/err-text.d.ts +7 -0
- package/dist/observability/err-text.js +5 -0
- package/dist/observability/fail-open.d.ts +25 -17
- package/dist/observability/fail-open.js +25 -17
- package/dist/observability/logger.js +3 -1
- package/dist/observability/metrics.js +1 -0
- package/dist/operator-roster.d.ts +68 -0
- package/dist/operator-roster.js +32 -0
- 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/outbound-dispatcher.d.ts +71 -8
- package/dist/outbound-dispatcher.js +48 -7
- package/dist/owner-faces.d.ts +2 -2
- package/dist/parked-decide.d.ts +106 -55
- 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/permission-mode-admission.d.ts +74 -5
- package/dist/permission-mode-admission.js +56 -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 +14 -2
- package/dist/plugins/approval-ask-store-file.js +11 -0
- package/dist/plugins/approval-ask-store-memory.d.ts +10 -1
- package/dist/plugins/approval-ask-store-memory.js +35 -10
- package/dist/plugins/approval-ask-store-sql.d.ts +69 -4
- package/dist/plugins/approval-ask-store-sql.js +45 -5
- package/dist/plugins/approval-exemption-store.js +3 -0
- package/dist/plugins/approval-nonce-store.js +2 -0
- package/dist/plugins/blob-backend.d.ts +83 -7
- package/dist/plugins/blob-backend.js +57 -6
- 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/checkpoint-index-columns.d.ts +20 -16
- package/dist/plugins/checkpoint-index-columns.js +3 -6
- package/dist/plugins/checkpoint-store-face.d.ts +119 -61
- package/dist/plugins/checkpoint-store-face.js +134 -55
- 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/execution-placement-sql.js +6 -6
- 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 +13 -3
- package/dist/plugins/local-checkpoint-store.js +38 -49
- 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-sync-store-pg.js +5 -0
- package/dist/plugins/memory-sync-store-tidb.js +5 -0
- package/dist/plugins/one-time-migrations.d.ts +104 -80
- package/dist/plugins/one-time-migrations.js +226 -132
- 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 +35 -10
- 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 +4 -1
- package/dist/plugins/remote-env-adb.d.ts +19 -15
- package/dist/plugins/remote-env-adb.js +41 -15
- 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 +106 -8
- package/dist/plugins/remote-env-e2b.d.ts +15 -6
- package/dist/plugins/remote-env-e2b.js +42 -32
- package/dist/plugins/remote-env-file-error.js +6 -2
- package/dist/plugins/remote-env-host.d.ts +46 -10
- package/dist/plugins/remote-env-host.js +124 -52
- package/dist/plugins/remote-env-k8s.d.ts +109 -41
- package/dist/plugins/remote-env-k8s.js +160 -54
- package/dist/plugins/remote-env-local-docker.d.ts +13 -8
- package/dist/plugins/remote-env-local-docker.js +34 -41
- package/dist/plugins/remote-env-ssh.d.ts +18 -12
- package/dist/plugins/remote-env-ssh.js +60 -59
- package/dist/plugins/remote-shell.d.ts +98 -1
- package/dist/plugins/remote-shell.js +218 -0
- package/dist/plugins/replica-registration.d.ts +1 -1
- package/dist/plugins/replica-registration.js +1 -1
- 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.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 +21 -2
- package/dist/plugins/run-store-sql.js +31 -7
- package/dist/plugins/s3-presign.d.ts +23 -0
- package/dist/plugins/s3-presign.js +37 -3
- package/dist/plugins/scenario-prefix-switch-m42.d.ts +1 -1
- package/dist/plugins/scenario-prefix-switch-m42.js +2 -2
- package/dist/plugins/scheduler-support.d.ts +2 -2
- package/dist/plugins/scheduler-support.js +0 -3
- package/dist/plugins/schema-consistency.d.ts +4 -2
- package/dist/plugins/schema-consistency.js +19 -2
- package/dist/plugins/schema-indexes.js +2 -0
- package/dist/plugins/send-file-ledger.d.ts +2 -2
- package/dist/plugins/send-file-ledger.js +5 -2
- package/dist/plugins/send-user-file.d.ts +3 -4
- package/dist/plugins/send-user-file.js +56 -52
- package/dist/plugins/serving-requirement.d.ts +26 -7
- package/dist/plugins/serving-requirement.js +11 -4
- package/dist/plugins/session-birth.d.ts +6 -2
- package/dist/plugins/session-blob-claim-token.d.ts +15 -0
- package/dist/plugins/session-blob-claim-token.js +20 -0
- package/dist/plugins/session-blob-namespace.d.ts +46 -0
- package/dist/plugins/session-blob-namespace.js +116 -0
- 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/snapshot-bucket-presence.d.ts +25 -2
- package/dist/plugins/snapshot-bucket-presence.js +8 -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/sql-json-column.d.ts +1 -1
- package/dist/plugins/stop-then-start-sentence.d.ts +10 -4
- package/dist/plugins/stop-then-start-sentence.js +14 -10
- 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 +84 -15
- package/dist/plugins/store-backend.js +236 -72
- package/dist/plugins/store-boundary.d.ts +57 -0
- package/dist/plugins/store-boundary.js +139 -0
- package/dist/plugins/store-contracts.d.ts +17 -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.d.ts +2 -1
- package/dist/plugins/task-attachment-store.js +14 -1
- 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 +21 -25
- 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-custody.d.ts +4 -3
- 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/project-context.d.ts +0 -2
- package/dist/project-context.js +4 -8
- package/dist/project-registry.d.ts +46 -0
- package/dist/project-registry.js +44 -0
- package/dist/question.d.ts +2 -1
- package/dist/question.js +5 -13
- package/dist/request-form.d.ts +6 -1
- package/dist/request-form.js +4 -1
- 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/rule-issue-reading.d.ts +1 -1
- package/dist/rules-consent.d.ts +1 -1
- package/dist/run-acceptance.d.ts +3 -2
- package/dist/run-acceptance.js +4 -6
- package/dist/run-local.js +9 -9
- package/dist/runs.d.ts +54 -16
- package/dist/runs.js +67 -13
- package/dist/runtime-governance.d.ts +5 -4
- package/dist/security.d.ts +30 -32
- package/dist/security.js +41 -7
- package/dist/sema-config-dir.d.ts +2 -1
- package/dist/server-secret-env.d.ts +12 -10
- package/dist/server-secret-env.js +24 -15
- 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 +10 -0
- package/dist/session-incarnation.js +10 -1
- package/dist/session-kind.d.ts +57 -0
- package/dist/session-kind.js +22 -0
- package/dist/session-row.d.ts +21 -1
- package/dist/session-row.js +7 -1
- package/dist/session-sync-kernel.d.ts +24 -14
- package/dist/session-sync-kernel.js +3 -6
- package/dist/session-sync.d.ts +25 -103
- package/dist/session-sync.js +14 -76
- 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/blob-index-sql.d.ts +30 -9
- package/dist/stores-sql/blob-index-sql.js +40 -21
- package/dist/stores-sql/checkpoint-store-sql.d.ts +54 -27
- package/dist/stores-sql/checkpoint-store-sql.js +70 -146
- package/dist/stores-sql/file-history-store-sql.d.ts +113 -15
- package/dist/stores-sql/file-history-store-sql.js +205 -95
- 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 +1 -9
- package/dist/stores-sql/retention-store-sql.js +5 -19
- 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 +2 -2
- package/dist/task-settings.d.ts +7 -5
- package/dist/task-settings.js +3 -3
- package/dist/terminal.d.ts +33 -2
- package/dist/terminal.js +139 -9
- package/dist/tool-approval.d.ts +465 -507
- package/dist/tool-approval.js +606 -1222
- package/dist/trace/core-keyset-guard.d.ts +1 -1
- package/dist/trace/ledger-events.d.ts +3 -3
- package/dist/trace/project.d.ts +2 -3
- package/dist/trace/redact.js +3 -2
- package/dist/trace/self-minted-wire.d.ts +571 -178
- package/dist/trace/self-minted-wire.js +189 -56
- package/dist/web-admin-client/apply-effective.js +2 -2
- package/dist/web-admin-client/read-warnings.d.ts +2 -2
- package/dist/web-admin-client/read-warnings.js +1 -1
- package/dist/web-admin-client/types.d.ts +1 -1
- package/dist/workspace-space.d.ts +10 -4
- package/dist/workspace-space.js +4 -1
- package/docs/DEVICE-EXECUTOR-PROTOCOL.md +79 -28
- package/package.json +7 -3
- package/scripts/embed-minimal.mjs +3 -3
- package/wire-changes/server@7.151.0.json +762 -0
- package/wire-changes/server@7.152.0.json +900 -0
- package/dist/config-d-migration.d.ts +0 -37
- package/dist/config-d-migration.js +0 -60
- package/dist/http/session-inherit-env.d.ts +0 -36
- package/dist/http/session-inherit-env.js +0 -6
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Runner } from "@sema-agent/core";
|
|
2
|
+
import { type DeploymentPlaneDeps, type DeploymentPlaneLane } from "./runner-deps.js";
|
|
2
3
|
import type { runStage05 } from "./stage-05-execution-env.js";
|
|
3
4
|
export declare function runStage06(ctx: Awaited<ReturnType<typeof runStage05>>): Promise<{
|
|
5
|
+
deploymentPlane: (lane: DeploymentPlaneLane) => DeploymentPlaneDeps;
|
|
4
6
|
sessionEraser: import("../session-erase.js").SessionEraser | undefined;
|
|
5
7
|
settleErasedSessions: import("../session-erase.js").SessionEraseSettler;
|
|
6
8
|
approvalAskAudit: import("../approval-ask-audit-store.js").FileApprovalAskAuditStore | undefined;
|
|
@@ -34,7 +36,7 @@ export declare function runStage06(ctx: Awaited<ReturnType<typeof runStage05>>):
|
|
|
34
36
|
sendUserFileToolSpec: import("@sema-agent/core").ToolSpec<import("@sema-agent/core").TSchema> | undefined;
|
|
35
37
|
sessionTitler: import("../session-titler.js").SessionTitler | undefined;
|
|
36
38
|
sharedMemoryStore: import("../plugins/shared-memory-store-sql.js").SqlSharedMemoryStore | undefined;
|
|
37
|
-
sqlWorkflowRunStore: import("
|
|
39
|
+
sqlWorkflowRunStore: import("../plugins/workflow-run-store-sql.js").SqlWorkflowRunStore | undefined;
|
|
38
40
|
streamApprovalGate: import("../tool-approval.js").StreamApprovalGate<import("../approval-gate-currency.js").GateCurrencyStore>;
|
|
39
41
|
subRunner: Runner;
|
|
40
42
|
subagentSteerRegistry: import("../orchestration/subagent-steer.js").SubagentSteerRegistry;
|
|
@@ -45,6 +47,7 @@ export declare function runStage06(ctx: Awaited<ReturnType<typeof runStage05>>):
|
|
|
45
47
|
workflowJournalStore: import("../plugins/store-backend.js").ServiceWorkflowJournalStore | undefined;
|
|
46
48
|
workflowModelAllowlistSnapshot: readonly string[];
|
|
47
49
|
workflowParkDecisions: import("../orchestration/workflow-park-decision.js").WorkflowParkDecisionStore | undefined;
|
|
50
|
+
workflowParkHolderPull: (() => Promise<import("../orchestration/workflow-park-holder.js").HolderPullTally>) | undefined;
|
|
48
51
|
workflowNotifyGate: import("../orchestration/workflow-notify-journal.js").WorkflowNotifyGate | undefined;
|
|
49
52
|
workflowNotifyJournal: import("../orchestration/workflow-notify-journal.js").WorkflowNotifyJournalStore | undefined;
|
|
50
53
|
workflowRecoverOpts: {
|
|
@@ -73,10 +76,12 @@ export declare function runStage06(ctx: Awaited<ReturnType<typeof runStage05>>):
|
|
|
73
76
|
perSessionCwd: Map<string, string>;
|
|
74
77
|
perTaskImage: import("../per-task-image.js").PerTaskImageRegistry;
|
|
75
78
|
sendUserFileTaskEnvs: import("../capabilities/sandbox-file-send.js").TaskEnvRegistry | undefined;
|
|
79
|
+
sessionBindings: {
|
|
80
|
+
commitSessionBindings: (sessionId: string, bindings: import("../session-bindings.js").SessionBindings) => import("../session-bindings.js").SessionBindingReceipt;
|
|
81
|
+
withdrawSessionBindings: (receipt: import("../session-bindings.js").SessionBindingReceipt) => boolean;
|
|
82
|
+
settleSessionBindings: (receipt: import("../session-bindings.js").SessionBindingReceipt) => boolean;
|
|
83
|
+
};
|
|
76
84
|
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
85
|
worktreeReap: (() => Promise<void>) | undefined;
|
|
81
86
|
brain: import("@sema-agent/core").Brain;
|
|
82
87
|
consolidationSeatWatch: import("./memory-consolidation.js").ConsolidationSeatWatch | undefined;
|
|
@@ -3,11 +3,13 @@ import { Runner, InMemoryToolResultStore, TtlSessionStore, uuidv7, createAllowDe
|
|
|
3
3
|
import { createEngineSessionRulesSeat } from "../session-rules-seat.js";
|
|
4
4
|
import { outwardPlane } from "../terminal.js";
|
|
5
5
|
import { createSessionTitler } from "../session-titler.js";
|
|
6
|
+
import { createPerModelAuthSeat } from "./side-query-lane.js";
|
|
7
|
+
import { sessionOccupantReadOf } from "../http/owner-access.js";
|
|
6
8
|
import { cardRuleScopeRoot } from "../task-cwd.js";
|
|
7
9
|
import { ForkRoutingSessionStore } from "../plugins/fork-routing-session-store.js";
|
|
8
10
|
import { withoutHands } from "../capabilities/hands-lane.js";
|
|
9
11
|
import { isBrandedDeployment } from "../capabilities/brand-identity.js";
|
|
10
|
-
import {
|
|
12
|
+
import { DEPLOYMENT_SHAPE_PREDICATES } from "../deployment-shape.js";
|
|
11
13
|
import { workflowModelAllowlistFor } from "../task-workflow.js";
|
|
12
14
|
import { createHookLlm, buildHookFailureText } from "../hooks/hook-llm.js";
|
|
13
15
|
import { assertRetentionLaneWirable } from "./retention-lane.js";
|
|
@@ -20,22 +22,29 @@ import { CHECKPOINT_CTX_SEALING_REQUIRED } from "../http/checkpoint-ctx.js";
|
|
|
20
22
|
import { sealCheckpointCtxCredentialsM28 } from "../checkpoint-ctx-seal-m28.js";
|
|
21
23
|
import { retirePromptProfileM30 } from "../stored-request-prompt-profile-m30.js";
|
|
22
24
|
import { createRuntimeCaps } from "./runtime-caps.js";
|
|
23
|
-
import { createEngineNoticeForwarder, createRunnerDeps, createSharedRunnerDeps, localOwnerRulesDeclared } from "./runner-deps.js";
|
|
25
|
+
import { createDeploymentPlaneDeps, createEngineNoticeForwarder, createRunnerDeps, createSharedRunnerDeps, localOwnerRulesDeclared } from "./runner-deps.js";
|
|
24
26
|
import { defaultEngineNoticeRouter } from "../trace/engine-notice-wire.js";
|
|
25
27
|
import { createOrgMemoryAdmissionWiring } from "./org-memory.js";
|
|
26
28
|
import { createGovernanceSeams } from "./governance-seams.js";
|
|
27
29
|
import { createSharedMemoryScopeAuthorizer } from "../shared-memory-scope-authorizer.js";
|
|
28
30
|
import { mountOrgDeliveryGate } from "./org-delivery.js";
|
|
29
|
-
import { parkedAskRedeem, runStore } from "./late-binds.js";
|
|
31
|
+
import { parkedAskRedeem, runEndedHandoff, runStore } from "./late-binds.js";
|
|
32
|
+
import { createWorkflowParkHolderPull } from "../orchestration/workflow-park-holder.js";
|
|
30
33
|
import { withInternalRunEnvs } from "../internal-run-env.js";
|
|
31
34
|
import { retentionSweepRuns } from "../plugins/retention-declaration.js";
|
|
32
35
|
import { createOperatorFaceIncidentSink } from "../memory-incident-sink.js";
|
|
33
36
|
export async function runStage06(ctx) {
|
|
34
37
|
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;
|
|
35
|
-
const { sqlWorkflowRunStore, workflowNotifyJournal, workflowCompletionInbox, deliverWorkflowCompletion, workflowNotifyGate, fleetBus, workflowRunStore, workflowJournalStore, outcomeSink, workflowRecoverOpts, workflowAgentRegistry, subagentSteerRegistry, workflowAgentSessionIndex, workflowParkDecisions, } = createWorkflowOrchestration({ config, logger, metrics, localRoot, backend, getRunStore: () => runStore });
|
|
38
|
+
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 });
|
|
39
|
+
backend?.bindWorkflowRunReader?.(workflowRunStore ?? "none");
|
|
40
|
+
const cardScopeRootOf = (sessionId) => cardRuleScopeRoot(sessionId !== undefined ? perSessionCwd.get(sessionId) : undefined, config);
|
|
41
|
+
backend?.bindCardScopeRoot?.(cardScopeRootOf);
|
|
36
42
|
const parkCommitted = backend?.checkpoint && config.durableApproval ? createParkCommitWatch(backend.checkpoint(logger)) : undefined;
|
|
37
43
|
const checkpointStore = parkCommitted?.store;
|
|
38
44
|
const parkCommits = parkCommitted?.watch;
|
|
45
|
+
const workflowParkHolderPull = heldParksHere !== undefined && workflowParkDecisions !== undefined && workflowAgentSessionIndex !== undefined && workflowRunStore !== undefined && checkpointStore !== undefined
|
|
46
|
+
? createWorkflowParkHolderPull({ held: heldParksHere, decisions: workflowParkDecisions, checkpointStore, workflowAgentSessionIndex, workflowRunStore, warn: (event, fields) => logger.warn(event, fields) })
|
|
47
|
+
: undefined;
|
|
39
48
|
const checkpointCtxSealing = webAdmin.checkpointCtxSealing;
|
|
40
49
|
if (checkpointStore !== undefined) {
|
|
41
50
|
if (checkpointCtxSealing === undefined)
|
|
@@ -50,7 +59,7 @@ export async function runStage06(ctx) {
|
|
|
50
59
|
config, logger, backend, sendUserFileTaskEnvs, ruleConsent, parkCommits,
|
|
51
60
|
...(checkpointStore !== undefined ? { checkpointStore } : {}),
|
|
52
61
|
getParkedRedeem: () => parkedAskRedeem,
|
|
53
|
-
ruleScopeRootFor:
|
|
62
|
+
ruleScopeRootFor: cardScopeRootOf,
|
|
54
63
|
});
|
|
55
64
|
if (streamApprovalGate.active)
|
|
56
65
|
await assertApprovalAskRuleMaterialOnBackend(backend);
|
|
@@ -115,7 +124,7 @@ export async function runStage06(ctx) {
|
|
|
115
124
|
: undefined;
|
|
116
125
|
for (const w of buildConsolidationValveAudit({
|
|
117
126
|
valve: consolidationValve,
|
|
118
|
-
|
|
127
|
+
credentialGateSource: DEPLOYMENT_SHAPE_PREDICATES.credentialGateSource.holds(config),
|
|
119
128
|
allowUnauthedWrites: config.allowUnauthedWrites ?? false,
|
|
120
129
|
}).warnings) {
|
|
121
130
|
logger.warn(w.tag, { detail: w.detail });
|
|
@@ -158,11 +167,13 @@ export async function runStage06(ctx) {
|
|
|
158
167
|
const pick = hookModelFor(model);
|
|
159
168
|
if (!pick.ok)
|
|
160
169
|
return pick;
|
|
170
|
+
const resolver = webAdmin.getKeyResolver();
|
|
161
171
|
try {
|
|
162
172
|
const result = await hookAgentRunner.runTask({
|
|
163
173
|
objective: prompt,
|
|
164
174
|
sessionId: uuidv7(),
|
|
165
175
|
model: pick.catalogRef,
|
|
176
|
+
getApiKeyAndHeaders: createPerModelAuthSeat(() => resolver),
|
|
166
177
|
...(system !== undefined ? { systemPrompt: system } : {}),
|
|
167
178
|
handsReadOnly: true,
|
|
168
179
|
enableFork: false,
|
|
@@ -186,9 +197,11 @@ export async function runStage06(ctx) {
|
|
|
186
197
|
};
|
|
187
198
|
const clipHookErr = (s) => (s ?? "").slice(0, 300);
|
|
188
199
|
const titleCapable = sessionStore;
|
|
189
|
-
const
|
|
200
|
+
const titleOccupantOf = sessionOccupantReadOf(sessionStore);
|
|
201
|
+
const sessionTitler = config.sessionAutoTitle && titleCapable.setTitleIfNull && titleCapable.probeTitle && titleOccupantOf
|
|
190
202
|
? createSessionTitler({
|
|
191
203
|
setTitleIfNull: titleCapable.setTitleIfNull.bind(sessionStore),
|
|
204
|
+
occupantOf: titleOccupantOf,
|
|
192
205
|
probeTitle: titleCapable.probeTitle.bind(sessionStore),
|
|
193
206
|
llm: hookLlm,
|
|
194
207
|
logger,
|
|
@@ -226,15 +239,17 @@ export async function runStage06(ctx) {
|
|
|
226
239
|
sharedMemoryStores: sharedMemoryStore ? sharedMemoryStore : undefined,
|
|
227
240
|
engineDataRoot,
|
|
228
241
|
peerDesk,
|
|
242
|
+
runtimeCapsResolver,
|
|
243
|
+
onError: runnerDeps.onError,
|
|
229
244
|
}),
|
|
230
245
|
sessionStore: subRunnerSessions,
|
|
231
246
|
onBackgroundChildEvent: runnerDeps.onBackgroundChildEvent ? runnerDeps.onBackgroundChildEvent : undefined,
|
|
232
247
|
loadProjectMemory: runnerDeps.loadProjectMemory ? runnerDeps.loadProjectMemory : undefined,
|
|
233
248
|
probeInstructionSources: runnerDeps.probeInstructionSources ? runnerDeps.probeInstructionSources : undefined,
|
|
234
|
-
onError: runnerDeps.onError ? runnerDeps.onError : undefined,
|
|
235
249
|
};
|
|
236
250
|
const subRunner = new Runner(subRunnerDeps);
|
|
251
|
+
const deploymentPlane = (lane) => createDeploymentPlaneDeps({ config, logger, metrics, brain, pricing, tracer, promptSource: webAdmin.promptSource, deploymentMods, usageWindowStore, governanceSeams, mcpRevocations, engineDataRoot, runtimeCapsResolver, onError: runnerDeps.onError }, lane);
|
|
237
252
|
const settleErasedSessions = createSessionEraseSettler({ attachments: taskAttachmentStore, spaceReclaimer, logger });
|
|
238
|
-
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 };
|
|
253
|
+
return { ...ctx, deploymentPlane, 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 };
|
|
239
254
|
}
|
|
240
255
|
//# sourceMappingURL=stage-06-runners.js.map
|
|
@@ -24,6 +24,7 @@ export declare function runStage07(ctx: Awaited<ReturnType<typeof runStage06>>):
|
|
|
24
24
|
userInputLedger: import("../user-input-ledger.js").UserInputLedger | undefined;
|
|
25
25
|
userInputLedgerStore: import("../user-input-ledger.js").UserInputLedgerStore | undefined;
|
|
26
26
|
webSearchProvider: "brave" | "tavily" | "searxng" | undefined;
|
|
27
|
+
deploymentPlane: (lane: import("./runner-deps.js").DeploymentPlaneLane) => import("./runner-deps.js").DeploymentPlaneDeps;
|
|
27
28
|
sessionEraser: import("../session-erase.js").SessionEraser | undefined;
|
|
28
29
|
settleErasedSessions: import("../session-erase.js").SessionEraseSettler;
|
|
29
30
|
approvalAskAudit: import("../approval-ask-audit-store.js").FileApprovalAskAuditStore | undefined;
|
|
@@ -56,7 +57,7 @@ export declare function runStage07(ctx: Awaited<ReturnType<typeof runStage06>>):
|
|
|
56
57
|
sendUserFileToolSpec: import("@sema-agent/core").ToolSpec<import("@sema-agent/core").TSchema> | undefined;
|
|
57
58
|
sessionTitler: import("../session-titler.js").SessionTitler | undefined;
|
|
58
59
|
sharedMemoryStore: import("../plugins/shared-memory-store-sql.js").SqlSharedMemoryStore | undefined;
|
|
59
|
-
sqlWorkflowRunStore: import("
|
|
60
|
+
sqlWorkflowRunStore: import("../plugins/workflow-run-store-sql.js").SqlWorkflowRunStore | undefined;
|
|
60
61
|
streamApprovalGate: import("../tool-approval.js").StreamApprovalGate<import("../approval-gate-currency.js").GateCurrencyStore>;
|
|
61
62
|
subRunner: import("@sema-agent/core").Runner;
|
|
62
63
|
subagentSteerRegistry: import("../orchestration/subagent-steer.js").SubagentSteerRegistry;
|
|
@@ -67,6 +68,7 @@ export declare function runStage07(ctx: Awaited<ReturnType<typeof runStage06>>):
|
|
|
67
68
|
workflowJournalStore: import("../plugins/store-backend.js").ServiceWorkflowJournalStore | undefined;
|
|
68
69
|
workflowModelAllowlistSnapshot: readonly string[];
|
|
69
70
|
workflowParkDecisions: import("../orchestration/workflow-park-decision.js").WorkflowParkDecisionStore | undefined;
|
|
71
|
+
workflowParkHolderPull: (() => Promise<import("../orchestration/workflow-park-holder.js").HolderPullTally>) | undefined;
|
|
70
72
|
workflowNotifyGate: import("../orchestration/workflow-notify-journal.js").WorkflowNotifyGate | undefined;
|
|
71
73
|
workflowNotifyJournal: import("../orchestration/workflow-notify-journal.js").WorkflowNotifyJournalStore | undefined;
|
|
72
74
|
workflowRecoverOpts: {
|
|
@@ -95,10 +97,12 @@ export declare function runStage07(ctx: Awaited<ReturnType<typeof runStage06>>):
|
|
|
95
97
|
perSessionCwd: Map<string, string>;
|
|
96
98
|
perTaskImage: import("../per-task-image.js").PerTaskImageRegistry;
|
|
97
99
|
sendUserFileTaskEnvs: import("../capabilities/sandbox-file-send.js").TaskEnvRegistry | undefined;
|
|
100
|
+
sessionBindings: {
|
|
101
|
+
commitSessionBindings: (sessionId: string, bindings: import("../session-bindings.js").SessionBindings) => import("../session-bindings.js").SessionBindingReceipt;
|
|
102
|
+
withdrawSessionBindings: (receipt: import("../session-bindings.js").SessionBindingReceipt) => boolean;
|
|
103
|
+
settleSessionBindings: (receipt: import("../session-bindings.js").SessionBindingReceipt) => boolean;
|
|
104
|
+
};
|
|
98
105
|
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
106
|
worktreeReap: (() => Promise<void>) | undefined;
|
|
103
107
|
brain: import("@sema-agent/core").Brain;
|
|
104
108
|
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);
|
|
@@ -93,7 +94,7 @@ export async function runStage07(ctx) {
|
|
|
93
94
|
? selectEnvironmentTool({
|
|
94
95
|
catalog: imageIndex,
|
|
95
96
|
selection: sessionEnvSelection,
|
|
96
|
-
viewerFor: (principal) => ({ operator: explicitOperatorOk(principal === undefined ? undefined : personOf(recoveredSubject(principal)), config), tenantId: principal ?? null }),
|
|
97
|
+
viewerFor: (principal) => ({ operator: explicitOperatorOk(principal === undefined ? undefined : personOf(recoveredSubject(principal)), config, "operate"), tenantId: principal ?? null }),
|
|
97
98
|
})
|
|
98
99
|
: undefined;
|
|
99
100
|
const imageBakes = backend?.imageBake && config.imageBakes.enabled ? backend.imageBake() : undefined;
|
|
@@ -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()
|
|
@@ -37,6 +37,7 @@ export declare function runStage08(ctx: Awaited<ReturnType<typeof runStage07>>):
|
|
|
37
37
|
userInputLedger: import("../user-input-ledger.js").UserInputLedger | undefined;
|
|
38
38
|
userInputLedgerStore: import("../user-input-ledger.js").UserInputLedgerStore | undefined;
|
|
39
39
|
webSearchProvider: "brave" | "tavily" | "searxng" | undefined;
|
|
40
|
+
deploymentPlane: (lane: import("./runner-deps.js").DeploymentPlaneLane) => import("./runner-deps.js").DeploymentPlaneDeps;
|
|
40
41
|
sessionEraser: import("../session-erase.js").SessionEraser | undefined;
|
|
41
42
|
settleErasedSessions: import("../session-erase.js").SessionEraseSettler;
|
|
42
43
|
approvalAskAudit: import("../approval-ask-audit-store.js").FileApprovalAskAuditStore | undefined;
|
|
@@ -69,7 +70,7 @@ export declare function runStage08(ctx: Awaited<ReturnType<typeof runStage07>>):
|
|
|
69
70
|
sendUserFileToolSpec: import("@sema-agent/core").ToolSpec<import("@sema-agent/core").TSchema> | undefined;
|
|
70
71
|
sessionTitler: import("../session-titler.js").SessionTitler | undefined;
|
|
71
72
|
sharedMemoryStore: import("../plugins/shared-memory-store-sql.js").SqlSharedMemoryStore | undefined;
|
|
72
|
-
sqlWorkflowRunStore: import("
|
|
73
|
+
sqlWorkflowRunStore: import("../plugins/workflow-run-store-sql.js").SqlWorkflowRunStore | undefined;
|
|
73
74
|
streamApprovalGate: import("../tool-approval.js").StreamApprovalGate<import("../approval-gate-currency.js").GateCurrencyStore>;
|
|
74
75
|
subRunner: Runner;
|
|
75
76
|
subagentSteerRegistry: import("../orchestration/subagent-steer.js").SubagentSteerRegistry;
|
|
@@ -80,6 +81,7 @@ export declare function runStage08(ctx: Awaited<ReturnType<typeof runStage07>>):
|
|
|
80
81
|
workflowJournalStore: import("../plugins/store-backend.js").ServiceWorkflowJournalStore | undefined;
|
|
81
82
|
workflowModelAllowlistSnapshot: readonly string[];
|
|
82
83
|
workflowParkDecisions: import("../orchestration/workflow-park-decision.js").WorkflowParkDecisionStore | undefined;
|
|
84
|
+
workflowParkHolderPull: (() => Promise<import("../orchestration/workflow-park-holder.js").HolderPullTally>) | undefined;
|
|
83
85
|
workflowNotifyGate: import("../orchestration/workflow-notify-journal.js").WorkflowNotifyGate | undefined;
|
|
84
86
|
workflowNotifyJournal: import("../orchestration/workflow-notify-journal.js").WorkflowNotifyJournalStore | undefined;
|
|
85
87
|
workflowRecoverOpts: {
|
|
@@ -108,10 +110,12 @@ export declare function runStage08(ctx: Awaited<ReturnType<typeof runStage07>>):
|
|
|
108
110
|
perSessionCwd: Map<string, string>;
|
|
109
111
|
perTaskImage: import("../per-task-image.js").PerTaskImageRegistry;
|
|
110
112
|
sendUserFileTaskEnvs: import("../capabilities/sandbox-file-send.js").TaskEnvRegistry | undefined;
|
|
113
|
+
sessionBindings: {
|
|
114
|
+
commitSessionBindings: (sessionId: string, bindings: import("../session-bindings.js").SessionBindings) => import("../session-bindings.js").SessionBindingReceipt;
|
|
115
|
+
withdrawSessionBindings: (receipt: import("../session-bindings.js").SessionBindingReceipt) => boolean;
|
|
116
|
+
settleSessionBindings: (receipt: import("../session-bindings.js").SessionBindingReceipt) => boolean;
|
|
117
|
+
};
|
|
111
118
|
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
119
|
worktreeReap: (() => Promise<void>) | undefined;
|
|
116
120
|
brain: import("@sema-agent/core").Brain;
|
|
117
121
|
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;
|
|
@@ -56,6 +59,7 @@ export declare function runStage09(ctx: Awaited<ReturnType<typeof runStage08>>):
|
|
|
56
59
|
userInputLedger: import("../user-input-ledger.js").UserInputLedger | undefined;
|
|
57
60
|
userInputLedgerStore: import("../user-input-ledger.js").UserInputLedgerStore | undefined;
|
|
58
61
|
webSearchProvider: "brave" | "tavily" | "searxng" | undefined;
|
|
62
|
+
deploymentPlane: (lane: import("./runner-deps.js").DeploymentPlaneLane) => import("./runner-deps.js").DeploymentPlaneDeps;
|
|
59
63
|
sessionEraser: import("../session-erase.js").SessionEraser | undefined;
|
|
60
64
|
settleErasedSessions: import("../session-erase.js").SessionEraseSettler;
|
|
61
65
|
approvalAskAudit: import("../approval-ask-audit-store.js").FileApprovalAskAuditStore | undefined;
|
|
@@ -88,7 +92,7 @@ export declare function runStage09(ctx: Awaited<ReturnType<typeof runStage08>>):
|
|
|
88
92
|
sendUserFileToolSpec: import("@sema-agent/core").ToolSpec<import("@sema-agent/core").TSchema> | undefined;
|
|
89
93
|
sessionTitler: import("../session-titler.js").SessionTitler | undefined;
|
|
90
94
|
sharedMemoryStore: import("../plugins/shared-memory-store-sql.js").SqlSharedMemoryStore | undefined;
|
|
91
|
-
sqlWorkflowRunStore: import("
|
|
95
|
+
sqlWorkflowRunStore: import("../plugins/workflow-run-store-sql.js").SqlWorkflowRunStore | undefined;
|
|
92
96
|
streamApprovalGate: import("../tool-approval.js").StreamApprovalGate<import("../approval-gate-currency.js").GateCurrencyStore>;
|
|
93
97
|
subRunner: import("@sema-agent/core").Runner;
|
|
94
98
|
subagentSteerRegistry: import("../orchestration/subagent-steer.js").SubagentSteerRegistry;
|
|
@@ -99,6 +103,7 @@ export declare function runStage09(ctx: Awaited<ReturnType<typeof runStage08>>):
|
|
|
99
103
|
workflowJournalStore: import("../plugins/store-backend.js").ServiceWorkflowJournalStore | undefined;
|
|
100
104
|
workflowModelAllowlistSnapshot: readonly string[];
|
|
101
105
|
workflowParkDecisions: import("../orchestration/workflow-park-decision.js").WorkflowParkDecisionStore | undefined;
|
|
106
|
+
workflowParkHolderPull: (() => Promise<import("../orchestration/workflow-park-holder.js").HolderPullTally>) | undefined;
|
|
102
107
|
workflowNotifyGate: import("../orchestration/workflow-notify-journal.js").WorkflowNotifyGate | undefined;
|
|
103
108
|
workflowNotifyJournal: import("../orchestration/workflow-notify-journal.js").WorkflowNotifyJournalStore | undefined;
|
|
104
109
|
workflowRecoverOpts: {
|
|
@@ -127,10 +132,12 @@ export declare function runStage09(ctx: Awaited<ReturnType<typeof runStage08>>):
|
|
|
127
132
|
perSessionCwd: Map<string, string>;
|
|
128
133
|
perTaskImage: import("../per-task-image.js").PerTaskImageRegistry;
|
|
129
134
|
sendUserFileTaskEnvs: import("../capabilities/sandbox-file-send.js").TaskEnvRegistry | undefined;
|
|
135
|
+
sessionBindings: {
|
|
136
|
+
commitSessionBindings: (sessionId: string, bindings: import("../session-bindings.js").SessionBindings) => import("../session-bindings.js").SessionBindingReceipt;
|
|
137
|
+
withdrawSessionBindings: (receipt: import("../session-bindings.js").SessionBindingReceipt) => boolean;
|
|
138
|
+
settleSessionBindings: (receipt: import("../session-bindings.js").SessionBindingReceipt) => boolean;
|
|
139
|
+
};
|
|
130
140
|
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
141
|
worktreeReap: (() => Promise<void>) | undefined;
|
|
135
142
|
brain: import("@sema-agent/core").Brain;
|
|
136
143
|
consolidationSeatWatch: import("./memory-consolidation.js").ConsolidationSeatWatch | undefined;
|
|
@@ -1,14 +1,17 @@
|
|
|
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";
|
|
9
12
|
import { buildDisplaySafeUrl } from "../trace/redact.js";
|
|
10
13
|
export function runStage09(ctx) {
|
|
11
|
-
const { approvalExemptionStore, backend, backgroundAgentStore,
|
|
14
|
+
const { approvalExemptionStore, deploymentPlane, backend, backgroundAgentStore, checkpointStore, checkpointCtxSealing, config, dropSessionScoped, durableEnabled, executionEnvFactory, fileHistoryErasure, localRoot, logger, mailboxRecipientLifecycle, mailboxStore, metrics, resumeAnchorStore, runStore, runnerDeps, sessionEraser, sessionPolicyStore, sessionStore, settleErasedSessions, storePosture, streamApprovalGate, taskAttachmentStore, spaceReclaimer, taskListLane, toolResultStore, userInputLedgerStore, webAdmin, workflowCompletionInbox } = ctx;
|
|
12
15
|
const { ownerAware, sessionAudit, sessionWatchRegistry, purgeSession, recoverPendingDeletions, instrumentDegenerate, planCacheProbe } = createSessionFaces({
|
|
13
16
|
dropSessionScoped,
|
|
14
17
|
config, logger, metrics, localRoot, backend, sessionStore, runStore, checkpointStore, toolResultStore,
|
|
@@ -24,7 +27,11 @@ 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
|
}
|
|
27
|
-
const
|
|
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);
|
|
34
|
+
const leaderEndpoint = createLeaderFace({ config, logger, localRoot, executionEnvFactory, toolResultStore, sessionStore, checkpointStore, checkpointCtxSealing, backend, deploymentPlane, getKeyResolver: () => webAdmin.getKeyResolver() });
|
|
28
35
|
const drainState = { draining: false };
|
|
29
36
|
const authBridgeIssuer = authBridgeIssuerOf(config)?.issuer;
|
|
30
37
|
const webAdminJwtVerifier = authBridgeIssuer
|
|
@@ -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,11 +1,14 @@
|
|
|
1
1
|
import { brainSummary } from "../brain.js";
|
|
2
2
|
import { type ServiceConfig } from "../config.js";
|
|
3
3
|
import type { runStage09 } from "./stage-09-leader.js";
|
|
4
|
+
import { type ControlSocketUnavailableReason } from "../control-socket.js";
|
|
4
5
|
/**
|
|
5
6
|
* 启动协议行 `listening` 的字段(行本身是 `observability/logger.ts` 的 {@link import("../observability/logger.js").STARTUP_PROTOCOL_EVENTS} 一员:不随 `LOG_LEVEL`)。
|
|
6
7
|
* 铸点 = 本文件 listen 之后那一行(全仓唯一,`test/source-hygiene-gate.test.ts` M7),字面量过 {@link exactListeningLine}(键集恰等于本型,可选键与条件展开同算);
|
|
7
8
|
* 键集登记在自铸登记表 `listeningLineKey`(`satisfies Record<keyof ListeningLine, …>`:键加一个而登记表没跟 / 多一个 ⇒ tsc 红)。只登顶层键;`brain` 段里的键随 `brainSummary` 走,不在本型。
|
|
8
9
|
*
|
|
10
|
+
* 本机控制 socket 两格(`controlSocket` / `controlSocketUnavailable`)恰一只在场:同一次开口结局(`control-socket.ts` 的 `openControlSocket`)的投影 —— 绑定的事实由绑定者报,与 `boundAddress` 同一条。
|
|
11
|
+
*
|
|
9
12
|
* 绑址两格,一格一个事实:`bindHost` = 本进程**请求**绑的地址(`resolveBindHost` 的答案 —— `BIND_HOST` 经无鉴权自收窄之后的那一只;答案缺席 = 全接口时是说明串);`boundAddress` = 内核**实际**绑上的地址
|
|
10
13
|
* (`server.address().address` 原样:`::` / `0.0.0.0` / `127.0.0.1` / `::1` …;配置写 `localhost` 时它是解析出的那一只)。口同理:`port` 读的也是绑定者自己的答案。
|
|
11
14
|
*/
|
|
@@ -14,6 +17,10 @@ export interface ListeningLine {
|
|
|
14
17
|
readonly bindHost: string;
|
|
15
18
|
readonly bindHostNote?: string;
|
|
16
19
|
readonly boundAddress: string;
|
|
20
|
+
/** 本机控制 socket 的绝对路径 —— present-iff 它在听(与下一键恰一只在场;同一次开口结局的投影 `controlSocketLineKeysOf`)。 */
|
|
21
|
+
readonly controlSocket?: string;
|
|
22
|
+
/** 本机控制 socket 没开的原因词(闭集 `CONTROL_SOCKET_UNAVAILABLE_REASONS`)—— present-iff 它没在听。 */
|
|
23
|
+
readonly controlSocketUnavailable?: ControlSocketUnavailableReason;
|
|
17
24
|
readonly model: ServiceConfig["model"]["id"];
|
|
18
25
|
readonly brain: ReturnType<typeof brainSummary>;
|
|
19
26
|
readonly breakerState: string;
|
|
@@ -40,9 +47,12 @@ export declare function runStage10(ctx: Awaited<ReturnType<typeof runStage09>>):
|
|
|
40
47
|
leaderEndpoint: import("../leader/endpoint.js").LeaderEndpoint | undefined;
|
|
41
48
|
ownerAware: import("../security.js").OwnerAwareSessionStore;
|
|
42
49
|
planCacheProbe: import("../plan-cache-probe.js").PlanCacheProbe;
|
|
43
|
-
purgeSession: ((sessionId: string, owner: string | null
|
|
50
|
+
purgeSession: ((sessionId: string, owner: string | null, opts?: {
|
|
51
|
+
readonly ageOut?: import("../session-deletion.js").SessionAgeOutExpectation;
|
|
52
|
+
}) => Promise<import("../session-deletion.js").SessionPurgeOutcome>) | undefined;
|
|
44
53
|
webAdminJwtVerifier: import("../auth-bridge.js").WebAdminJwtVerifier | undefined;
|
|
45
54
|
sessionAudit: ((sessionId: string, opts?: import("../audit.js").SessionAuditReadOpts) => Promise<{
|
|
55
|
+
sessionKind?: "sidechain" | undefined;
|
|
46
56
|
projectId?: string | undefined;
|
|
47
57
|
agent?: import("../session-agent.js").SessionAgent | undefined;
|
|
48
58
|
owner: string | null;
|
|
@@ -87,6 +97,7 @@ export declare function runStage10(ctx: Awaited<ReturnType<typeof runStage09>>):
|
|
|
87
97
|
userInputLedger: import("../user-input-ledger.js").UserInputLedger | undefined;
|
|
88
98
|
userInputLedgerStore: import("../user-input-ledger.js").UserInputLedgerStore | undefined;
|
|
89
99
|
webSearchProvider: "brave" | "tavily" | "searxng" | undefined;
|
|
100
|
+
deploymentPlane: (lane: import("./runner-deps.js").DeploymentPlaneLane) => import("./runner-deps.js").DeploymentPlaneDeps;
|
|
90
101
|
sessionEraser: import("../session-erase.js").SessionEraser | undefined;
|
|
91
102
|
settleErasedSessions: import("../session-erase.js").SessionEraseSettler;
|
|
92
103
|
approvalAskAudit: import("../approval-ask-audit-store.js").FileApprovalAskAuditStore | undefined;
|
|
@@ -119,7 +130,7 @@ export declare function runStage10(ctx: Awaited<ReturnType<typeof runStage09>>):
|
|
|
119
130
|
sendUserFileToolSpec: import("@sema-agent/core").ToolSpec<import("@sema-agent/core").TSchema> | undefined;
|
|
120
131
|
sessionTitler: import("../session-titler.js").SessionTitler | undefined;
|
|
121
132
|
sharedMemoryStore: import("../plugins/shared-memory-store-sql.js").SqlSharedMemoryStore | undefined;
|
|
122
|
-
sqlWorkflowRunStore: import("
|
|
133
|
+
sqlWorkflowRunStore: import("../plugins/workflow-run-store-sql.js").SqlWorkflowRunStore | undefined;
|
|
123
134
|
streamApprovalGate: import("../tool-approval.js").StreamApprovalGate<import("../approval-gate-currency.js").GateCurrencyStore>;
|
|
124
135
|
subRunner: import("@sema-agent/core").Runner;
|
|
125
136
|
subagentSteerRegistry: import("../orchestration/subagent-steer.js").SubagentSteerRegistry;
|
|
@@ -130,6 +141,7 @@ export declare function runStage10(ctx: Awaited<ReturnType<typeof runStage09>>):
|
|
|
130
141
|
workflowJournalStore: import("../plugins/store-backend.js").ServiceWorkflowJournalStore | undefined;
|
|
131
142
|
workflowModelAllowlistSnapshot: readonly string[];
|
|
132
143
|
workflowParkDecisions: import("../orchestration/workflow-park-decision.js").WorkflowParkDecisionStore | undefined;
|
|
144
|
+
workflowParkHolderPull: (() => Promise<import("../orchestration/workflow-park-holder.js").HolderPullTally>) | undefined;
|
|
133
145
|
workflowNotifyGate: import("../orchestration/workflow-notify-journal.js").WorkflowNotifyGate | undefined;
|
|
134
146
|
workflowNotifyJournal: import("../orchestration/workflow-notify-journal.js").WorkflowNotifyJournalStore | undefined;
|
|
135
147
|
workflowRecoverOpts: {
|
|
@@ -158,10 +170,12 @@ export declare function runStage10(ctx: Awaited<ReturnType<typeof runStage09>>):
|
|
|
158
170
|
perSessionCwd: Map<string, string>;
|
|
159
171
|
perTaskImage: import("../per-task-image.js").PerTaskImageRegistry;
|
|
160
172
|
sendUserFileTaskEnvs: import("../capabilities/sandbox-file-send.js").TaskEnvRegistry | undefined;
|
|
173
|
+
sessionBindings: {
|
|
174
|
+
commitSessionBindings: (sessionId: string, bindings: import("../session-bindings.js").SessionBindings) => import("../session-bindings.js").SessionBindingReceipt;
|
|
175
|
+
withdrawSessionBindings: (receipt: import("../session-bindings.js").SessionBindingReceipt) => boolean;
|
|
176
|
+
settleSessionBindings: (receipt: import("../session-bindings.js").SessionBindingReceipt) => boolean;
|
|
177
|
+
};
|
|
161
178
|
sessionEnvSelection: import("../capabilities/select-environment-tool.js").SessionEnvironmentSelection;
|
|
162
|
-
setSessionCwd: (sid: string, cwd: string) => void;
|
|
163
|
-
setSessionInheritEnv: (sid: string, policy: import("../request-value-closure.js").TaskInheritEnv | undefined) => void;
|
|
164
|
-
setSessionShellEnv: (sid: string, env: Record<string, string>) => void;
|
|
165
179
|
worktreeReap: (() => Promise<void>) | undefined;
|
|
166
180
|
brain: import("@sema-agent/core").Brain;
|
|
167
181
|
consolidationSeatWatch: import("./memory-consolidation.js").ConsolidationSeatWatch | undefined;
|
|
@@ -29,23 +29,21 @@ import { createRunnerDepsOnAsk } from "./runner-deps.js";
|
|
|
29
29
|
import { installShutdownHandlers } from "./shutdown.js";
|
|
30
30
|
import { bindServerLateSeats } from "./late-binds.js";
|
|
31
31
|
import { serviceVersion } from "../service-version.js";
|
|
32
|
+
import { controlSocketLineKeysOf, openControlSocket } from "../control-socket.js";
|
|
32
33
|
import { buildDisplaySafeUrl } from "../trace/redact.js";
|
|
33
34
|
import { seatText } from "../trace/exit-seat.js";
|
|
34
35
|
function exactListeningLine(line) {
|
|
35
36
|
return line;
|
|
36
37
|
}
|
|
37
38
|
export async function runStage10(ctx) {
|
|
38
|
-
const { peerDesk, approvalAskAudit, approvalExemptionStore, approvalNonceStore, authorize, backend, backgroundAgentStore, brain, breakerState, centerRuntimeCapsResolver, checkpointStore, checkpointCtxSealing, parkCommits, config, webAdmin, consolidationValve, costQuota, belowTaskChainPatterns, deploymentMods, deploymentModsLoaded, deviceLane, drainState, dropSessionScopedOf, durableEnabled, elicitation, fenceSessionOwner,
|
|
39
|
+
const { peerDesk, approvalAskAudit, approvalExemptionStore, approvalNonceStore, authorize, backend, backgroundAgentStore, brain, breakerState, centerRuntimeCapsResolver, checkpointStore, checkpointCtxSealing, parkCommits, config, webAdmin, consolidationValve, costQuota, belowTaskChainPatterns, deploymentMods, deploymentModsLoaded, deviceLane, drainState, dropSessionScopedOf, durableEnabled, elicitation, fenceSessionOwner, fleetBus, fleetLease, fleetUsage, governanceSeams, handslessRunner, hookAgent, hookLlm, hookWakeBus, imageBakes, imageIndex, instanceId, instrumentDegenerate, leaderEndpoint, loadedSkills, localRoot, logger, lspManager, mcpRevocations, sandboxCapacity, memoryBundleFaces, memoryComplianceFaces, memoryConsolidationFaces, memoryEngine, memoryExportStores, memoryOptOutGrantStore, memoryOriginFaces, memoryPosture, memorySyncCursors, memorySyncRunner, metrics, modelUsageTracker, orgMemoryAdmission, otelExporter, outcomeSink, ownerAware, parkedReviveInheritedGate, parkedReviveSurface, perSessionCwd, perTaskImage, planCacheProbe, pricing, principalCaps, promptManifestTracker, purgeSession, question, rateLimiter, reaper, webAdminJwtVerifier, resumeAnchorStore, retentionLaneStarted, retentionLaneStore, ruleConsent, runStore, runner, runnerDeps, runtimeCapsPeekReading, sandboxGitPlane, scenarioDetails, scenarios, selectEnvTool, sendFileLedger, sendUserFileEmitter, sendUserFileToolSpec, sessionAudit, sessionEnvSelection, sessionMemoryStatusFace, sessionTitler, sessionWatchRegistry, sessionBindings, sessionResidentBackground, sharedMemoryStore, sideQueryAccounting, sqlEngine, sqlWorkflowRunStore, staticWiring, storePosture, subRunner, subagentSteerRegistry, taskAttachmentStore, taskLimitCaps, taskTimeoutSec, toolApproval, toolResultStore, usageWindowStore, userInputLedger, webSearchProvider, workflowAgentRegistry, workflowAgentSessionIndex, workflowParkDecisions, workflowCompletionInbox, workflowJournalStore, workflowModelAllowlistSnapshot, workflowNotifyGate, workflowNotifyJournal, workflowRecoverOpts, workflowRunStore, workflowsCapable, orgDeliveryGate } = ctx;
|
|
39
40
|
const stores = {
|
|
40
41
|
runStore,
|
|
41
|
-
resumeAnchorStore: resumeAnchorStore ? resumeAnchorStore : undefined,
|
|
42
42
|
approvalExemptionStore: approvalExemptionStore ? approvalExemptionStore : undefined,
|
|
43
43
|
approvalNonceStore: approvalNonceStore ? approvalNonceStore : undefined,
|
|
44
44
|
checkpointStore,
|
|
45
45
|
checkpointCtxSealing,
|
|
46
|
-
sessionPolicyStore: sessionPolicyStore ? sessionPolicyStore : undefined,
|
|
47
46
|
ruleConsent,
|
|
48
|
-
fileHistoryStore: fileHistoryStore ? fileHistoryStore : undefined,
|
|
49
47
|
toolResultStore,
|
|
50
48
|
taskAttachmentStore: taskAttachmentStore ? taskAttachmentStore : undefined,
|
|
51
49
|
backgroundAgentStore: backgroundAgentStore ? backgroundAgentStore : undefined,
|
|
@@ -88,7 +86,7 @@ export async function runStage10(ctx) {
|
|
|
88
86
|
sessionAudit,
|
|
89
87
|
routeJudgeBrain: brain,
|
|
90
88
|
purgeSession: purgeSession ? purgeSession : undefined,
|
|
91
|
-
|
|
89
|
+
sessionBindings,
|
|
92
90
|
dropSessionScopedOf,
|
|
93
91
|
subagentTaskOutput: (handle, access) => backgroundAgentOutput(defaultTaskRegistry, handle, access, backgroundAgentStore),
|
|
94
92
|
taskHandleOutput: (handle, access) => taskHandleOutput(defaultTaskRegistry, handle, access, backgroundAgentStore),
|
|
@@ -214,7 +212,7 @@ export async function runStage10(ctx) {
|
|
|
214
212
|
config, logger, metrics, localRoot, scenarios, loadedSkills, principalCaps, centerRuntimeCapsResolver,
|
|
215
213
|
peerDesk,
|
|
216
214
|
getKeyResolver: () => webAdmin.getKeyResolver(),
|
|
217
|
-
taskAttachmentStore, perSessionCwd,
|
|
215
|
+
taskAttachmentStore, perSessionCwd, fenceSessionOwner,
|
|
218
216
|
hookLlm, hookAgent, belowTaskChainPatterns, fleetBus, hookWakeBus, ownerAware, taskLimitCaps, taskTimeoutSec,
|
|
219
217
|
historyAnchors: resumeAnchorStore && runStore ? { anchors: resumeAnchorStore, runs: runStore } : undefined,
|
|
220
218
|
selectEnvTool, sendUserFileToolSpec, memoryEngine, memorySyncRunner, durableEnabled, approvalExemptionStore,
|
|
@@ -241,19 +239,6 @@ export async function runStage10(ctx) {
|
|
|
241
239
|
metrics,
|
|
242
240
|
});
|
|
243
241
|
const bindHost = resolveBindHost(config);
|
|
244
|
-
if (config.bindHostSource === "HOST" && bindHost !== config.bindHost) {
|
|
245
|
-
logger.warn("bind_host_from_HOST_env_overridden", {
|
|
246
|
-
bindHost,
|
|
247
|
-
ignoredHostEnv: config.bindHost,
|
|
248
|
-
note: "HOST was inherited from the shell (zsh commonly sets it to the machine name) and would have bound the write face to a non-loopback address — but this deployment has ALLOW_UNAUTHED_WRITES with no service token, so the bind address was narrowed to loopback instead. Two ways out if you meant to expose it: set BIND_HOST explicitly, or configure a service token.",
|
|
249
|
-
});
|
|
250
|
-
}
|
|
251
|
-
else if (config.bindHostSource === "HOST") {
|
|
252
|
-
logger.warn("bind_host_from_HOST_env", {
|
|
253
|
-
bindHost,
|
|
254
|
-
note: "the bind address came from the HOST env var (not BIND_HOST). Shells like zsh commonly set HOST to the machine name — if you did not set it yourself, this may be an inherited shell variable silently configuring the bind face. Set BIND_HOST explicitly to silence this warning.",
|
|
255
|
-
});
|
|
256
|
-
}
|
|
257
242
|
let onListenError;
|
|
258
243
|
try {
|
|
259
244
|
await new Promise((resolve, reject) => {
|
|
@@ -266,8 +251,6 @@ export async function runStage10(ctx) {
|
|
|
266
251
|
logger.error("listen_failed", {
|
|
267
252
|
port: config.port,
|
|
268
253
|
bindHost: bindHost ?? "0.0.0.0/::(all interfaces)",
|
|
269
|
-
...(config.bindHostSource ? { bindHostSource: config.bindHostSource } : {}),
|
|
270
|
-
...(config.bindHostSource === "HOST" ? { note: "bind failed for a host inherited from the HOST env var — set BIND_HOST explicitly (e.g. BIND_HOST=127.0.0.1)." } : {}),
|
|
271
254
|
error: seatText("operator-log-text", e instanceof Error ? e.message : String(e)),
|
|
272
255
|
});
|
|
273
256
|
throw e;
|
|
@@ -282,6 +265,14 @@ export async function runStage10(ctx) {
|
|
|
282
265
|
...("code" in e ? { code: String(e.code) } : {}),
|
|
283
266
|
});
|
|
284
267
|
});
|
|
268
|
+
const controlSocketServer = server.controlSocketServer;
|
|
269
|
+
controlSocketServer.on("error", (e) => {
|
|
270
|
+
logger.error("control_socket_error", {
|
|
271
|
+
error: seatText("operator-log-text", e.message),
|
|
272
|
+
...("code" in e ? { code: String(e.code) } : {}),
|
|
273
|
+
});
|
|
274
|
+
});
|
|
275
|
+
const controlSocket = await openControlSocket(controlSocketServer, { exclusiveDataRoot: backend?.exclusiveDataRoot?.() });
|
|
285
276
|
const fleetClient = startFleetClientFromConfig(config, {
|
|
286
277
|
instanceId,
|
|
287
278
|
version: serviceVersion(),
|
|
@@ -310,6 +301,7 @@ export async function runStage10(ctx) {
|
|
|
310
301
|
? { bindHostNote: "auto-narrowed to loopback: write face is unauthenticated (ALLOW_UNAUTHED_WRITES with no service token). Set BIND_HOST explicitly to override." }
|
|
311
302
|
: {}),
|
|
312
303
|
boundAddress: bound.address,
|
|
304
|
+
...controlSocketLineKeysOf(controlSocket),
|
|
313
305
|
model: config.model.id,
|
|
314
306
|
brain: brainSummary(config),
|
|
315
307
|
breakerState: config.resilience.circuitBreaker ? (breakerState ? `shared(${backend.kind})` : "in-process") : "off",
|
|
@@ -345,6 +337,7 @@ export async function runStage10(ctx) {
|
|
|
345
337
|
}
|
|
346
338
|
void installShutdownHandlers({
|
|
347
339
|
config, logger, server, reaper, fleetReconcile, otelExporter, breakerState, costQuota, rateLimiter,
|
|
340
|
+
controlSocket: controlSocket.listening ? controlSocketServer : undefined,
|
|
348
341
|
version: serviceVersion(),
|
|
349
342
|
runner, subRunner, lspManager, workflowNotifyJournal, fleetClient, backend, drainState,
|
|
350
343
|
storeLiveProbe, webAdmin,
|