@sema-agent/server 7.145.0 → 7.147.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 +876 -0
- package/README.md +1 -1
- package/README.zh-CN.md +1 -1
- package/USAGE.md +374 -99
- package/deploy/facts/CHANGES.json +25 -0
- package/deploy/facts/README.md +57 -0
- package/deploy/facts/lanes.json +61 -0
- package/deploy/facts/lanes.schema.json +57 -0
- package/deploy/facts/sandbox-rbac.json +113 -0
- package/deploy/facts/sandbox-rbac.schema.json +74 -0
- package/deploy/facts/sealed-key.json +9 -0
- package/deploy/facts/sealed-key.schema.json +52 -0
- package/deploy/sema-up/README.md +2 -2
- package/deploy/sema-up/chart/templates/_helpers.tpl +41 -0
- package/deploy/sema-up/chart/templates/sandbox-rbac.yaml +47 -7
- package/deploy/sema-up/chart/templates/server-v4pro.yaml +9 -4
- package/deploy/sema-up/chart/templates/server.yaml +9 -4
- package/deploy/sema-up/chart/values.yaml +8 -1
- package/deploy/sema-up/cluster-up.sh +2 -1
- package/deploy/sema-up/lib/flagshape.sh +4 -0
- package/deploy/sema-up/lib/lanes.json +2 -5
- package/deploy/sema-up/sema-up.sh +12 -9
- package/deploy/sema-up/stack/compose.yaml +5 -4
- package/deploy/sema-up/stack/sema-stack-cluster.yaml +34 -17
- package/dist/adoption/import-limits.d.ts +6 -0
- package/dist/adoption/import-limits.js +7 -0
- package/dist/adoption/import.d.ts +62 -0
- package/dist/adoption/import.js +107 -0
- package/dist/adoption/wire.d.ts +52 -0
- package/dist/adoption/wire.js +9 -0
- package/dist/approval-ask-machine.d.ts +2 -2
- package/dist/approval-card.d.ts +7 -16
- package/dist/approval-card.js +0 -4
- package/dist/approval-gate-currency.d.ts +1 -1
- package/dist/approval-gate-currency.js +1 -1
- package/dist/approval-reconciler.d.ts +1 -1
- package/dist/approval.d.ts +3 -3
- package/dist/audit.js +2 -2
- package/dist/bench/s1/live-deps.js +3 -1
- package/dist/boot/crash-last.js +2 -1
- package/dist/boot/deployment-mods.d.ts +11 -1
- package/dist/boot/deployment-mods.js +15 -2
- package/dist/boot/device-lane.js +7 -5
- package/dist/boot/engine-lease.d.ts +195 -22
- package/dist/boot/engine-lease.js +146 -20
- package/dist/boot/execution-env.d.ts +5 -0
- package/dist/boot/execution-env.js +57 -33
- package/dist/boot/execution-lane.d.ts +37 -9
- package/dist/boot/execution-lane.js +74 -20
- package/dist/boot/exit-boundary.d.ts +50 -0
- package/dist/boot/exit-boundary.js +32 -0
- package/dist/boot/exit-last.d.ts +20 -4
- package/dist/boot/exit-last.js +23 -5
- package/dist/boot/governance-seams.d.ts +2 -2
- package/dist/boot/governance-seams.js +1 -0
- package/dist/boot/leader.js +1 -1
- package/dist/boot/memory-boundary.d.ts +11 -11
- package/dist/boot/memory-boundary.js +3 -3
- package/dist/boot/memory-consolidation.d.ts +42 -41
- package/dist/boot/memory-consolidation.js +26 -28
- package/dist/boot/org-memory.js +3 -2
- package/dist/boot/parked-revive-gate.d.ts +1 -1
- package/dist/boot/parked-revive-gate.js +1 -1
- package/dist/boot/reapers.d.ts +12 -4
- package/dist/boot/reapers.js +40 -16
- package/dist/boot/resolve-spec.d.ts +2 -0
- package/dist/boot/resolve-spec.js +126 -123
- package/dist/boot/retention-lane.d.ts +4 -42
- package/dist/boot/runner-deps.js +1 -1
- package/dist/boot/session-faces.d.ts +1 -0
- package/dist/boot/session-faces.js +11 -3
- package/dist/boot/shutdown.js +27 -9
- package/dist/boot/stage-01-config.d.ts +1 -1
- package/dist/boot/stage-01-config.js +7 -3
- package/dist/boot/stage-02-web-admin-pull.d.ts +1 -1
- package/dist/boot/stage-02-web-admin-pull.js +10 -8
- package/dist/boot/stage-03-store-backend.d.ts +2 -1
- package/dist/boot/stage-03-store-backend.js +2 -2
- package/dist/boot/stage-04-stores.d.ts +2 -1
- package/dist/boot/stage-05-execution-env.d.ts +4 -1
- package/dist/boot/stage-05-execution-env.js +6 -6
- package/dist/boot/stage-06-runners.d.ts +5 -2
- package/dist/boot/stage-06-runners.js +12 -13
- package/dist/boot/stage-07-capability-layer.d.ts +5 -2
- package/dist/boot/stage-07-capability-layer.js +7 -7
- package/dist/boot/stage-08-reapers.d.ts +5 -2
- package/dist/boot/stage-08-reapers.js +3 -3
- package/dist/boot/stage-09-leader.d.ts +6 -2
- package/dist/boot/stage-10-http-server.d.ts +6 -2
- package/dist/boot/stage-10-http-server.js +5 -3
- package/dist/boot/stores.d.ts +10 -0
- package/dist/boot/stores.js +53 -26
- package/dist/boot/web-admin.js +3 -3
- package/dist/boot/workflow-orchestration.d.ts +1 -1
- package/dist/boot/workflow-orchestration.js +2 -1
- package/dist/capabilities/center-plugins.d.ts +2 -0
- package/dist/capabilities/center-plugins.js +6 -2
- package/dist/capabilities/composite-members.d.ts +4 -1
- package/dist/capabilities/composite-members.js +4 -1
- package/dist/capabilities/execution-lane.d.ts +7 -7
- package/dist/capabilities/execution-lane.js +2 -2
- package/dist/capabilities/hands-lane.d.ts +1 -1
- package/dist/capabilities/scenarios.d.ts +34 -20
- package/dist/capabilities/scenarios.js +13 -9
- package/dist/capabilities/settings-contract.d.ts +29 -0
- package/dist/capabilities/settings-contract.js +14 -0
- package/dist/capabilities/skills.d.ts +5 -5
- package/dist/capability-facts.d.ts +56 -1
- package/dist/capability-facts.js +59 -8
- package/dist/center-credential-renewer.js +3 -2
- package/dist/checkpoint-ctx-seal-m28.d.ts +1 -1
- package/dist/config-catalog.js +19 -9
- package/dist/config-invariants.d.ts +18 -3
- package/dist/config-invariants.js +36 -19
- package/dist/config-lkg.d.ts +1 -1
- package/dist/config-lkg.js +5 -6
- package/dist/config-provider.d.ts +2 -2
- package/dist/config-provider.js +2 -0
- package/dist/config-types.d.ts +228 -185
- package/dist/config.d.ts +74 -6
- package/dist/config.js +146 -64
- package/dist/degenerate-instrument.js +1 -1
- package/dist/deleted-session-ids.d.ts +19 -0
- package/dist/deleted-session-ids.js +26 -0
- package/dist/deploy-facts.d.ts +155 -0
- package/dist/deploy-facts.js +95 -0
- package/dist/deployment-shape.d.ts +21 -12
- package/dist/deployment-shape.js +24 -6
- package/dist/device-ws-hub.d.ts +48 -3
- package/dist/device-ws-hub.js +48 -2
- package/dist/env-facts.d.ts +7 -5
- package/dist/env-facts.js +10 -6
- package/dist/error-code-family.d.ts +35 -0
- package/dist/error-code-family.js +26 -0
- package/dist/execution-config-root.d.ts +5 -5
- package/dist/execution-config-root.js +5 -5
- package/dist/execution-env-purpose.d.ts +14 -0
- package/dist/execution-env-purpose.js +29 -0
- package/dist/execution-lane-caps.d.ts +49 -86
- package/dist/execution-lane-caps.js +52 -62
- package/dist/execution-placement.d.ts +18 -2
- package/dist/execution-placement.js +19 -0
- package/dist/file-history-disclosure.d.ts +2 -2
- package/dist/fleet/drain-entry.d.ts +46 -3
- package/dist/fleet/drain-entry.js +6 -0
- package/dist/fleet/fleet-bus.d.ts +2 -1
- package/dist/fleet/serving-lease.js +3 -4
- package/dist/history-anchor.d.ts +22 -0
- package/dist/history-anchor.js +14 -0
- package/dist/hooks/branch-transcript.d.ts +1 -1
- package/dist/hooks/branch-transcript.js +1 -0
- package/dist/hooks/classic-stations.d.ts +25 -8
- package/dist/hooks/classic-stations.js +29 -3
- package/dist/hooks/command-spawn.d.ts +1 -4
- package/dist/hooks/command-spawn.js +0 -11
- package/dist/hooks/hook-runner.d.ts +85 -24
- package/dist/hooks/hook-runner.js +326 -109
- package/dist/hooks/hook-source.d.ts +14 -2
- package/dist/hooks/hook-source.js +8 -0
- package/dist/http/active-run-conflict.d.ts +1 -1
- package/dist/http/active-run-conflict.js +1 -1
- package/dist/http/admission.js +11 -1
- package/dist/http/approval-sweeps.d.ts +2 -5
- package/dist/http/approval-sweeps.js +3 -2
- package/dist/http/checkpoint-ctx.d.ts +76 -71
- package/dist/http/checkpoint-ctx.js +40 -40
- package/dist/http/claim-latency.d.ts +10 -0
- package/dist/http/claim-latency.js +12 -0
- package/dist/http/dispatch.js +19 -3
- package/dist/http/durable-run-leg.d.ts +5 -0
- package/dist/http/durable-run-leg.js +3 -1
- package/dist/http/execution-context.d.ts +7 -1
- package/dist/http/execution-context.js +13 -0
- package/dist/http/health-self-report.d.ts +6 -2
- package/dist/http/health-self-report.js +3 -2
- package/dist/http/memory-compliance-failure-reply.d.ts +2 -2
- package/dist/http/memory-compliance-failure-reply.js +5 -15
- package/dist/http/memory-control-plane-corrupt-reply.d.ts +25 -0
- package/dist/http/memory-control-plane-corrupt-reply.js +19 -0
- package/dist/http/memory-store-refusal-reply.d.ts +3 -3
- package/dist/http/memory-store-refusal-reply.js +3 -0
- package/dist/http/owner-access.d.ts +11 -0
- package/dist/http/owner-access.js +7 -4
- package/dist/http/principal-gate.d.ts +28 -16
- package/dist/http/principal-gate.js +10 -19
- package/dist/http/request-guards.d.ts +2 -2
- package/dist/http/request-guards.js +5 -5
- package/dist/http/resume-legs.d.ts +29 -10
- package/dist/http/resume-legs.js +94 -56
- package/dist/http/rewind-files-reply.d.ts +34 -0
- package/dist/http/rewind-files-reply.js +36 -0
- package/dist/http/route-ctx.d.ts +43 -26
- package/dist/http/route-table.js +4 -0
- package/dist/http/routes/adoption.d.ts +11 -0
- package/dist/http/routes/adoption.js +80 -6
- package/dist/http/routes/agents-roster.js +1 -0
- package/dist/http/routes/approvals-assistant.js +7 -26
- package/dist/http/routes/background.js +1 -0
- package/dist/http/routes/capabilities.js +12 -3
- package/dist/http/routes/devices.js +1 -1
- package/dist/http/routes/diagnostics.d.ts +9 -14
- package/dist/http/routes/diagnostics.js +10 -20
- package/dist/http/routes/engine.d.ts +31 -0
- package/dist/http/routes/engine.js +81 -0
- package/dist/http/routes/memory-bundle.js +3 -0
- package/dist/http/routes/memory-consolidation.js +3 -5
- package/dist/http/routes/memory-origin.d.ts +2 -2
- package/dist/http/routes/memory-origin.js +2 -4
- package/dist/http/routes/memory-policy.js +5 -1
- package/dist/http/routes/notify-wake.js +2 -1
- package/dist/http/routes/observability.js +3 -6
- package/dist/http/routes/projects.d.ts +70 -0
- package/dist/http/routes/projects.js +86 -0
- package/dist/http/routes/rules.js +30 -2
- package/dist/http/routes/runs.js +15 -11
- package/dist/http/routes/session-sync.js +39 -35
- package/dist/http/routes/sessions-list.d.ts +1 -1
- package/dist/http/routes/sessions.d.ts +7 -1
- package/dist/http/routes/sessions.js +108 -2
- package/dist/http/routes/tasks.js +32 -8
- package/dist/http/routes/trace-usage.js +1 -1
- package/dist/http/run-concurrency-cap.d.ts +86 -0
- package/dist/http/run-concurrency-cap.js +54 -0
- package/dist/http/server.d.ts +31 -14
- package/dist/http/server.js +29 -3
- package/dist/http/stored-body-replay.d.ts +12 -7
- package/dist/http/stored-body-replay.js +28 -5
- package/dist/http/wire-types.d.ts +27 -13
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/instruction-source-notice.d.ts +1 -1
- package/dist/json-body-limit.d.ts +8 -0
- package/dist/json-body-limit.js +2 -0
- package/dist/leader/diffout.d.ts +1 -1
- package/dist/local-data-root.d.ts +2 -2
- package/dist/memory-embedder-reembed.d.ts +38 -0
- package/dist/memory-embedder-reembed.js +20 -0
- package/dist/memory-incident-sink.d.ts +0 -28
- package/dist/memory-incident-sink.js +5 -0
- package/dist/memory-operator-faces.d.ts +9 -4
- package/dist/memory-scope-stores.d.ts +9 -7
- package/dist/memory-scope-stores.js +3 -14
- package/dist/memory-scope.d.ts +38 -2
- package/dist/memory-scope.js +33 -2
- package/dist/memory-store-refusal.d.ts +17 -4
- package/dist/memory-store-refusal.js +1 -1
- package/dist/memory-sync-client.d.ts +2 -0
- package/dist/memory-sync-client.js +13 -11
- package/dist/memory-sync.js +1 -1
- package/dist/model-compat.d.ts +35 -21
- package/dist/model-compat.js +49 -21
- package/dist/model-entry-refusal.d.ts +11 -1
- package/dist/model-entry-refusal.js +7 -0
- package/dist/namespaced-rule-name.d.ts +18 -1
- package/dist/namespaced-rule-name.js +12 -0
- package/dist/net-address.d.ts +53 -0
- package/dist/net-address.js +111 -0
- package/dist/observability/fail-open.d.ts +29 -17
- package/dist/observability/fail-open.js +29 -17
- package/dist/observability/metrics.d.ts +2 -0
- package/dist/observability/metrics.js +2 -0
- package/dist/observability/secret-env-scrub.d.ts +30 -4
- package/dist/observability/secret-env-scrub.js +15 -3
- package/dist/orchestration/workflow-agent-session-index.d.ts +7 -12
- package/dist/orchestration/workflow-agent-session-index.js +1 -6
- package/dist/orchestration/workflow-completion-inbox.d.ts +26 -6
- package/dist/orchestration/workflow-completion-inbox.js +63 -45
- package/dist/orchestration/workflow-notify-journal.js +2 -3
- package/dist/org-delivery-gate.js +1 -1
- package/dist/org-memory-admission.d.ts +5 -2
- package/dist/org-memory-admission.js +25 -10
- package/dist/parked-decide.d.ts +33 -26
- package/dist/parked-decide.js +36 -44
- package/dist/peer-directory.d.ts +6 -12
- package/dist/peer-directory.js +5 -1
- package/dist/plugins/approval-ask-store-file.d.ts +10 -2
- package/dist/plugins/approval-ask-store-file.js +37 -4
- package/dist/plugins/approval-ask-store-memory.d.ts +5 -3
- package/dist/plugins/approval-ask-store-memory.js +11 -2
- package/dist/plugins/approval-ask-store-sql.d.ts +3 -0
- package/dist/plugins/approval-ask-store-sql.js +3 -1
- package/dist/plugins/blob-backend.d.ts +38 -195
- package/dist/plugins/blob-backend.js +33 -229
- package/dist/plugins/caching-session-store.d.ts +12 -5
- package/dist/plugins/caching-session-store.js +3 -0
- package/dist/plugins/checkpoint-index-columns.d.ts +1 -1
- package/dist/plugins/checkpoint-index-columns.js +3 -2
- package/dist/plugins/checkpoint-store-face.d.ts +426 -0
- package/dist/plugins/checkpoint-store-face.js +152 -0
- package/dist/plugins/device-store-sql.d.ts +2 -2
- package/dist/plugins/device-store-sql.js +5 -10
- package/dist/plugins/execution-lane-rename-m40.d.ts +20 -0
- package/dist/plugins/execution-lane-rename-m40.js +10 -0
- package/dist/plugins/execution-placement-sql.d.ts +63 -88
- package/dist/plugins/execution-placement-sql.js +94 -54
- package/dist/plugins/file-run-store.d.ts +26 -18
- package/dist/plugins/file-run-store.js +64 -75
- package/dist/plugins/fork-routing-session-store.d.ts +6 -2
- package/dist/plugins/fork-routing-session-store.js +2 -2
- package/dist/plugins/imported-layer-root-retirement.d.ts +22 -11
- package/dist/plugins/imported-layer-root-retirement.js +4 -8
- package/dist/plugins/inbox-payload-column.d.ts +14 -0
- package/dist/plugins/inbox-payload-column.js +13 -0
- package/dist/plugins/local-checkpoint-store.d.ts +7 -2
- package/dist/plugins/local-checkpoint-store.js +13 -8
- package/dist/plugins/local-data-dir-modes-m39.d.ts +48 -0
- package/dist/plugins/local-data-dir-modes-m39.js +182 -0
- package/dist/plugins/local-engine-high-water.d.ts +11 -0
- package/dist/plugins/local-engine-high-water.js +59 -0
- package/dist/plugins/local-session-store.d.ts +119 -30
- package/dist/plugins/local-session-store.js +156 -53
- package/dist/plugins/local-task-attachment-store.d.ts +2 -0
- package/dist/plugins/local-task-attachment-store.js +10 -11
- package/dist/plugins/memory-embedder-fingerprint.d.ts +33 -10
- package/dist/plugins/memory-embedder-fingerprint.js +52 -12
- package/dist/plugins/memory-embedder.d.ts +1 -1
- package/dist/plugins/memory-embedder.js +2 -2
- package/dist/plugins/memory-engine-pg.d.ts +30 -6
- package/dist/plugins/memory-engine-pg.js +96 -214
- package/dist/plugins/memory-engine-sql-apply.d.ts +130 -0
- package/dist/plugins/memory-engine-sql-apply.js +358 -0
- package/dist/plugins/memory-engine-tidb.d.ts +38 -9
- package/dist/plugins/memory-engine-tidb.js +99 -230
- package/dist/plugins/memory-key-guards.d.ts +1 -1
- package/dist/plugins/memory-origin-law.d.ts +3 -3
- package/dist/plugins/one-time-migrations.d.ts +169 -83
- package/dist/plugins/one-time-migrations.js +295 -235
- package/dist/plugins/owner-only-file-mode.d.ts +29 -0
- package/dist/plugins/owner-only-file-mode.js +141 -0
- package/dist/plugins/permission-rule-store-file.d.ts +17 -3
- package/dist/plugins/permission-rule-store-file.js +20 -1
- package/dist/plugins/pg-pool.d.ts +2 -1
- package/dist/plugins/pg-pool.js +12 -5
- package/dist/plugins/release-version.d.ts +20 -0
- package/dist/plugins/release-version.js +28 -0
- package/dist/plugins/remote-env-adb.d.ts +20 -4
- package/dist/plugins/remote-env-adb.js +39 -11
- package/dist/plugins/remote-env-e2b.d.ts +12 -3
- package/dist/plugins/remote-env-e2b.js +6 -4
- package/dist/plugins/remote-env-host.d.ts +9 -1
- package/dist/plugins/remote-env-host.js +6 -5
- package/dist/plugins/remote-env-k8s.d.ts +5 -2
- package/dist/plugins/remote-env-k8s.js +15 -4
- package/dist/plugins/remote-env-local-docker.d.ts +4 -1
- package/dist/plugins/remote-env-local-docker.js +3 -3
- package/dist/plugins/remote-env-ssh.d.ts +8 -2
- package/dist/plugins/remote-env-ssh.js +26 -24
- package/dist/plugins/remote-shell.d.ts +59 -30
- package/dist/plugins/remote-shell.js +175 -62
- package/dist/plugins/retention-declaration.d.ts +37 -0
- package/dist/plugins/retention-declaration.js +9 -0
- package/dist/plugins/retention-deployment.d.ts +126 -0
- package/dist/plugins/retention-deployment.js +88 -0
- package/dist/plugins/retention-lane-store-sql.d.ts +74 -4
- package/dist/plugins/retention-lane-store-sql.js +103 -1
- package/dist/plugins/retention-sql.d.ts +29 -0
- package/dist/plugins/retention-sql.js +8 -0
- package/dist/plugins/run-store-sql.js +2 -2
- package/dist/plugins/schema-consistency.d.ts +0 -6
- package/dist/plugins/schema-consistency.js +1 -2
- package/dist/plugins/schema-ensure-legs.d.ts +1 -1
- package/dist/plugins/schema-ensure-legs.js +13 -3
- package/dist/plugins/session-ext-table.d.ts +74 -0
- package/dist/plugins/session-ext-table.js +121 -0
- package/dist/plugins/session-fork.d.ts +31 -9
- package/dist/plugins/session-fork.js +3 -2
- package/dist/plugins/session-placement.d.ts +4 -2
- package/dist/plugins/session-row-sql.d.ts +8 -7
- package/dist/plugins/session-row-sql.js +15 -7
- package/dist/plugins/session-store-sql.d.ts +131 -0
- package/dist/plugins/session-store-sql.js +298 -0
- package/dist/plugins/session-workspace-cell.d.ts +2 -2
- package/dist/plugins/session-workspace-cell.js +2 -2
- package/dist/plugins/shared-memory-store-sql.d.ts +10 -0
- package/dist/plugins/shared-memory-store-sql.js +13 -13
- package/dist/plugins/snapshot-bucket-presence.js +1 -1
- package/dist/plugins/sql-driver.d.ts +23 -7
- package/dist/plugins/sql-driver.js +41 -8
- package/dist/plugins/sql-errors.d.ts +5 -2
- package/dist/plugins/sql-errors.js +4 -0
- package/dist/plugins/sql-json-column.d.ts +5 -1
- package/dist/plugins/store-backend.d.ts +46 -16
- package/dist/plugins/store-backend.js +192 -69
- package/dist/plugins/store-contracts.d.ts +10 -13
- package/dist/plugins/store-contracts.js +1 -9
- package/dist/plugins/store-sweep.d.ts +63 -0
- package/dist/plugins/store-sweep.js +48 -0
- package/dist/plugins/task-attachment-store.d.ts +6 -8
- package/dist/plugins/task-attachment-store.js +15 -10
- package/dist/plugins/task-list-store-sql.d.ts +1 -1
- package/dist/plugins/text-column-capacity.d.ts +21 -0
- package/dist/plugins/text-column-capacity.js +5 -0
- package/dist/plugins/tidb-pool.d.ts +3 -2
- package/dist/plugins/tidb-pool.js +20 -32
- package/dist/plugins/user-input-ledger-sql.d.ts +1 -1
- package/dist/prompt-screen.d.ts +6 -9
- package/dist/prompt-screen.js +2 -5
- package/dist/read-face-posture.d.ts +6 -6
- package/dist/read-face-posture.js +2 -2
- package/dist/request-value-closure.d.ts +5 -5
- package/dist/request-value-closure.js +1 -1
- package/dist/rules-consent.d.ts +48 -27
- package/dist/rules-consent.js +147 -23
- package/dist/run-cancel-context.d.ts +4 -1
- package/dist/run-cancel-context.js +2 -1
- package/dist/run-local.js +17 -13
- package/dist/runs.d.ts +48 -30
- package/dist/runs.js +27 -17
- package/dist/runtime-caps-resolver.d.ts +15 -8
- package/dist/runtime-caps-resolver.js +14 -10
- package/dist/sandbox-egress-policy.js +6 -11
- package/dist/sandbox-rbac-rules.d.ts +88 -0
- package/dist/sandbox-rbac-rules.js +80 -0
- package/dist/sealed-key-layout.d.ts +16 -0
- package/dist/sealed-key-layout.js +3 -0
- package/dist/sealed-key.js +8 -6
- package/dist/security.d.ts +43 -9
- package/dist/security.js +9 -2
- package/dist/sema-config-dir.js +2 -2
- package/dist/server-secret-env.d.ts +2 -0
- package/dist/service-version.d.ts +2 -1
- package/dist/service-version.js +2 -2
- package/dist/session-error-wire.d.ts +1 -1
- package/dist/session-incarnation.d.ts +8 -5
- package/dist/session-notify-door.d.ts +5 -3
- package/dist/session-resident-background.d.ts +110 -0
- package/dist/session-resident-background.js +88 -0
- package/dist/session-row.d.ts +1 -1
- package/dist/session-sync-kernel.d.ts +53 -14
- package/dist/session-sync-kernel.js +70 -1
- package/dist/session-sync.d.ts +5 -3
- package/dist/session-workspace.d.ts +12 -2
- package/dist/session-workspace.js +6 -0
- package/dist/sighup-idle.d.ts +9 -7
- package/dist/sighup-idle.js +4 -5
- package/dist/spec-fields.d.ts +16 -0
- package/dist/spec-fields.js +7 -0
- package/dist/store-posture.d.ts +2 -1
- package/dist/stored-request-env-credentials-m38.d.ts +3 -0
- package/dist/stored-request-env-credentials-m38.js +8 -0
- package/dist/stored-request-hooks-m20.d.ts +3 -2
- package/dist/stored-request-hooks-m20.js +19 -14
- package/dist/stored-request-prompt-profile-m30.d.ts +1 -1
- package/dist/stores-sql/blob-index-sql.d.ts +148 -0
- package/dist/stores-sql/blob-index-sql.js +154 -0
- package/dist/{plugins → stores-sql}/checkpoint-store-sql.d.ts +14 -428
- package/dist/{plugins → stores-sql}/checkpoint-store-sql.js +43 -220
- package/dist/{plugins → stores-sql}/file-history-store-sql.d.ts +23 -11
- package/dist/{plugins → stores-sql}/file-history-store-sql.js +23 -18
- package/dist/{plugins → stores-sql}/mailbox-store-sql.d.ts +2 -2
- package/dist/{plugins → stores-sql}/mailbox-store-sql.js +4 -4
- package/dist/{plugins → stores-sql}/pg-session-storage.d.ts +27 -67
- package/dist/{plugins → stores-sql}/pg-session-storage.js +82 -207
- package/dist/{plugins → stores-sql}/retention-store-sql.d.ts +123 -217
- package/dist/{plugins → stores-sql}/retention-store-sql.js +66 -190
- package/dist/{plugins → stores-sql}/roster-store-sql.d.ts +2 -2
- package/dist/{plugins → stores-sql}/roster-store-sql.js +1 -1
- package/dist/{plugins → stores-sql}/session-event-payload.d.ts +1 -1
- package/dist/{plugins → stores-sql}/session-event-payload.js +1 -1
- package/dist/stores-sql/session-policy-store-sql.d.ts +1 -1
- package/dist/stores-sql/session-write-hooks.d.ts +59 -0
- package/dist/stores-sql/session-write-hooks.js +2 -0
- package/dist/{plugins → stores-sql}/tidb-session-storage.d.ts +10 -11
- package/dist/{plugins → stores-sql}/tidb-session-storage.js +10 -21
- package/dist/{plugins → stores-sql}/tidb-session-store.d.ts +35 -112
- package/dist/{plugins → stores-sql}/tidb-session-store.js +73 -169
- package/dist/{plugins → stores-sql}/tool-result-store-sql.d.ts +3 -3
- package/dist/{plugins → stores-sql}/tool-result-store-sql.js +6 -6
- package/dist/stores-sql/windowed-session-storage.d.ts +56 -0
- package/dist/stores-sql/windowed-session-storage.js +61 -0
- package/dist/{plugins → stores-sql}/workflow-journal-store-sql.d.ts +7 -12
- package/dist/{plugins → stores-sql}/workflow-journal-store-sql.js +3 -8
- package/dist/task-a2a.d.ts +7 -1
- package/dist/task-a2a.js +15 -14
- package/dist/task-cwd.d.ts +11 -3
- package/dist/task-cwd.js +17 -1
- package/dist/task-mcp.d.ts +10 -2
- package/dist/task-mcp.js +13 -16
- package/dist/task-settings.d.ts +68 -8
- package/dist/task-settings.js +63 -6
- package/dist/tool-approval.d.ts +23 -10
- package/dist/tool-approval.js +10 -6
- package/dist/trace/core-keyset-guard.d.ts +17 -10
- package/dist/trace/engine-notice-wire.d.ts +1 -1
- package/dist/trace/engine-notice-wire.js +4 -0
- package/dist/trace/exit-seat.d.ts +29 -1
- package/dist/trace/exit-seat.js +4 -0
- package/dist/trace/project.d.ts +33 -16
- package/dist/trace/project.js +21 -9
- package/dist/trace/redact.d.ts +13 -2
- package/dist/trace/redact.js +347 -78
- package/dist/trace/self-minted-wire.d.ts +587 -16
- package/dist/trace/self-minted-wire.js +215 -9
- package/dist/trace/sema-provenance.d.ts +45 -41
- package/dist/trace/sema-provenance.js +81 -10
- package/dist/trace/task-notification-facets.d.ts +70 -2
- package/dist/trace/task-notification-facets.js +71 -1
- package/dist/trace/wire-projection-faces.d.ts +39 -3
- package/dist/trace/wire-projection-faces.js +27 -2
- package/dist/unread-request-members.d.ts +66 -0
- package/dist/unread-request-members.js +41 -0
- package/dist/usage-analytics.d.ts +4 -0
- package/dist/user-input-ledger.d.ts +2 -2
- package/dist/web-admin-client/apply-effective.js +22 -26
- package/dist/web-admin-client/candidate-gate.d.ts +35 -3
- package/dist/web-admin-client/candidate-gate.js +53 -5
- package/dist/web-admin-client/center-request.d.ts +4 -1
- package/dist/web-admin-client/center-request.js +2 -1
- package/dist/web-admin-client/effective-keys.js +0 -1
- package/dist/web-admin-client/facade.d.ts +1 -1
- package/dist/web-admin-client/http-client.d.ts +1 -0
- package/dist/web-admin-client/http-client.js +17 -9
- package/dist/web-admin-client/restart-signal.js +5 -2
- package/dist/web-admin-client/skills-mcp.d.ts +20 -6
- package/dist/web-admin-client/skills-mcp.js +26 -21
- package/dist/web-admin-client/types.d.ts +34 -49
- package/docs/DEVICE-EXECUTOR-PROTOCOL.md +2 -2
- package/package.json +22 -13
- package/scripts/drain-check-local.mjs +8 -55
- package/scripts/drain-check.mysql.sql +3 -40
- package/scripts/drain-check.pg.sql +3 -40
- package/skills/update-config.md +1 -1
- package/wire-changes/server@7.146.0.json +3221 -0
- package/wire-changes/server@7.147.0.json +813 -0
- package/dist/approval-batch-census.d.ts +0 -27
- package/dist/approval-batch-census.js +0 -27
|
@@ -29,47 +29,16 @@
|
|
|
29
29
|
* (车1 已实现)。lane **不补记**它们 —— 补记 = 「删了但审计没落地」的窗口重新打开。receipt 在本文件里
|
|
30
30
|
* 只做两件事:二次确认(日志/指标)与「本轮到底动了多少」的读数。
|
|
31
31
|
*/
|
|
32
|
-
import type { RetentionPolicy
|
|
32
|
+
import type { RetentionPolicy } from "@sema-agent/core";
|
|
33
33
|
import type { RetentionMode } from "../config-types.js";
|
|
34
|
-
import type {
|
|
34
|
+
import type { SpaceReclaimer } from "../workspace-space.js";
|
|
35
|
+
import type { RetentionExecutor } from "../plugins/retention-deployment.js";
|
|
35
36
|
/** 同 domain 连续失败多少次算「卡住了」(fail-loud 的阈值)。`5` 与 reaper 家族的
|
|
36
37
|
* `REAPER_FAILURE_WARN_THRESHOLD` 同值同理由:一次抖动(一次重连、一次超时)正是容错要吸收的,
|
|
37
38
|
* 只有**连败**才越过「可诊断」这条线。 */
|
|
38
39
|
export declare const RETENTION_SWEEP_STUCK_THRESHOLD = 5;
|
|
39
40
|
/** 租约 TTL = 本倍数 × sweep 间隔(设计稿 §3)。`2` = 允许一轮跑满一个完整间隔还有余量,再多就该让位。 */
|
|
40
41
|
export declare const RETENTION_LEASE_TTL_FACTOR = 2;
|
|
41
|
-
/**
|
|
42
|
-
* lane 消费的**执行器**面 —— core `ManagedRetentionCapability` 的三方法 + 车1 的非契约窄读口
|
|
43
|
-
* `previewRetention`(audit-only 档的读数源;core 契约无 count 面)+ 声明位。
|
|
44
|
-
*
|
|
45
|
-
* 🔴 三方法的入参是 core 契约形的**超集**(多一个 `audit`):车1 的店在运行期对缺席的审计上下文
|
|
46
|
-
* fail-closed 抛错,所以这里把它写进类型 —— 让「忘了传」变成编译错,而不是一次运行期的破坏性调用被拒。
|
|
47
|
-
*/
|
|
48
|
-
export interface RetentionExecutor {
|
|
49
|
-
readonly retention?: "managed" | "none";
|
|
50
|
-
listRetentionDomains(): Promise<readonly string[]>;
|
|
51
|
-
previewRetention(input: {
|
|
52
|
-
domain: string;
|
|
53
|
-
cutoffMs: number;
|
|
54
|
-
}): Promise<{
|
|
55
|
-
checkpoints: number;
|
|
56
|
-
sessions: number;
|
|
57
|
-
toolResults: number;
|
|
58
|
-
}>;
|
|
59
|
-
expireCheckpoints(input: RetentionDestructiveInput): Promise<RetentionReceipt>;
|
|
60
|
-
deleteExpiredSessions(input: RetentionDestructiveInput): Promise<RetentionSessionsReceipt>;
|
|
61
|
-
deleteOrphanToolResults(input: RetentionDestructiveInput): Promise<RetentionReceipt>;
|
|
62
|
-
}
|
|
63
|
-
/** 破坏性调用的入参(判定时点的三格随行 —— 理由逐字见车1 `RetentionAuditContext` 的头注)。 */
|
|
64
|
-
export interface RetentionDestructiveInput {
|
|
65
|
-
domain: string;
|
|
66
|
-
cutoffMs: number;
|
|
67
|
-
audit: {
|
|
68
|
-
mode: RetentionMode;
|
|
69
|
-
policyDays: number;
|
|
70
|
-
fencingToken: number | null;
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
42
|
/** 非破坏性审计行的写口(lane 侧属主的那五个词)。 */
|
|
74
43
|
export interface RetentionAuditSink {
|
|
75
44
|
append(row: {
|
|
@@ -132,13 +101,6 @@ export interface RetentionSweepCtx {
|
|
|
132
101
|
* (缓存卷、`space/` 快照、该会话停驻车道的快照一并回收)。它从不抛(失败 = 一行 + fail-open 计数);缺席 = 本部署没有可回收的东西。 */
|
|
133
102
|
spaceReclaimer?: SpaceReclaimer;
|
|
134
103
|
}
|
|
135
|
-
/**
|
|
136
|
-
* 会话树 sweep 的回执 = core 契约的 `RetentionReceipt` + 本仓一位:`endedSpaces` = 本次删掉的会话树里**结束了的空间**(会话 id + 住客空间键 = 会话化身;
|
|
137
|
-
* 读不出住客的空化身不算),present-iff 非空。lane 把它交给空间的回收座(与会话删除协调器同一只),缓存卷与快照随空间的终结回收。
|
|
138
|
-
*/
|
|
139
|
-
export type RetentionSessionsReceipt = RetentionReceipt & {
|
|
140
|
-
readonly endedSpaces?: readonly EndedSpace[];
|
|
141
|
-
};
|
|
142
104
|
/** 一轮的读数(给日志与判据用;lane 自己不做任何决策依赖它)。 */
|
|
143
105
|
export interface RetentionSweepOutcome {
|
|
144
106
|
/** 本轮真正处理完的 domain 数(丢租中止时 = 中止之前那些)。 */
|
|
@@ -168,7 +130,7 @@ export interface RetentionSweepOutcome {
|
|
|
168
130
|
* 为什么本道必须存在:引擎的门不拦
|
|
169
131
|
* · 没锁时,执行器在场 × 一只 `"none"` 的店 —— 部署于是**广告了一个不执行的留存面**:能力位说
|
|
170
132
|
* `{mode,maxAgeDays}`、审计表也在长,而那只店的行谁都没在删。
|
|
171
|
-
* 本仓的 SQL 后端按同一个事实(扫车道开不开,`plugins/retention-
|
|
133
|
+
* 本仓的 SQL 后端按同一个事实(扫车道开不开,`plugins/retention-declaration.ts` 的 `retentionSweepRuns`)给它铸的三只店声明词,所以 lane 开着时
|
|
172
134
|
* 这三只店在这一格上恒是 `managed`;这一格防的是声明与 lane 脱钩的店(别的后端、替身)。
|
|
173
135
|
* 这些都在**启动期**拒(安全控件不得半开),不是让运维从一台"启动成功、什么也没删"的机器上猜。
|
|
174
136
|
*
|
package/dist/boot/runner-deps.js
CHANGED
|
@@ -144,7 +144,7 @@ export function createSharedRunnerDeps(ctx) {
|
|
|
144
144
|
}
|
|
145
145
|
export function createRunnerDeps(ctx) {
|
|
146
146
|
const { config, logger, metrics, localRoot, outcomeSink, elicitation, question, toolApproval, sessionStore, memoryEngine, sessionCaptureRecords, memorySyncRunner, runtimeCapsResolver, fileHistoryStore, permissionRuleStore, fleetBus, workflowRunStore, workflowJournalStore, workflowAgentRegistry, workflowNotifyGate, deliverWorkflowCompletion, } = ctx;
|
|
147
|
-
const peerSessionLister = sessionStore.
|
|
147
|
+
const peerSessionLister = sessionStore.listSessionRows?.bind(sessionStore);
|
|
148
148
|
const memoryEngineIncident = createMemoryEngineIncidentSink({ logger, metrics });
|
|
149
149
|
const sharedRunnerDeps = createSharedRunnerDeps(ctx);
|
|
150
150
|
const workflowModelAllowlist = workflowModelAllowlistFor(config);
|
|
@@ -66,6 +66,7 @@ export interface SessionFacesCtx {
|
|
|
66
66
|
export declare function createSessionFaces(ctx: SessionFacesCtx): {
|
|
67
67
|
ownerAware: OwnerAwareSessionStore;
|
|
68
68
|
sessionAudit: ((sessionId: string, opts?: SessionAuditReadOpts) => Promise<{
|
|
69
|
+
projectId?: string | undefined;
|
|
69
70
|
agent?: import("../session-agent.js").SessionAgent | undefined;
|
|
70
71
|
owner: string | null;
|
|
71
72
|
sessionId: string;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { buildRewindHandles, buildSessionAudit, buildSessionAuditLocal, buildSessionAuditPg } from "../audit.js";
|
|
2
2
|
import { readSessionAgent } from "../session-agent.js";
|
|
3
|
+
import { readSessionProjectId, sessionWorkspaceStoreOf } from "../session-workspace.js";
|
|
3
4
|
import { makeDegenerateInstrument } from "../degenerate-instrument.js";
|
|
4
5
|
import { PlanCacheProbe } from "../plan-cache-probe.js";
|
|
5
6
|
import { purgeScratchpadDir } from "../env-facts.js";
|
|
@@ -12,6 +13,7 @@ import { probeSessionChildren, retireSessionChildren, sessionChildrenScope, Sess
|
|
|
12
13
|
import { SessionActiveRunError } from "../execution-placement.js";
|
|
13
14
|
import { headReadOf, redactIncarnations } from "../session-incarnation.js";
|
|
14
15
|
import { recordFailOpen } from "../observability/fail-open.js";
|
|
16
|
+
import { retireSessionId } from "../deleted-session-ids.js";
|
|
15
17
|
import { seatText } from "../trace/exit-seat.js";
|
|
16
18
|
export function createSessionFaces(ctx) {
|
|
17
19
|
const { config, logger, metrics, localRoot, backend, sessionStore, runStore, checkpointStore, toolResultStore, resumeAnchorStore, approvalExemptionStore, sessionPolicyStore, taskAttachmentStore, fileHistoryErasure, workflowCompletionInbox, taskListLane, dropSessionScoped, mailboxStore, mailboxRecipientLifecycle, backgroundAgentStore, userInputLedgerStore, spaceReclaimer, } = ctx;
|
|
@@ -20,6 +22,7 @@ export function createSessionFaces(ctx) {
|
|
|
20
22
|
const auditLocalRows = localSessionRowsOf(backend);
|
|
21
23
|
const ownerAware = sessionStore;
|
|
22
24
|
const headOf = headReadOf(sessionStore);
|
|
25
|
+
const workspaceStore = sessionWorkspaceStoreOf(sessionStore);
|
|
23
26
|
const sessionAudit = mysqlPool || auditPgPool || auditLocalRows
|
|
24
27
|
? async (sessionId, opts) => {
|
|
25
28
|
const handles = opts !== undefined && resumeAnchorStore !== undefined ? buildRewindHandles(await resumeAnchorStore.listBySession(sessionId), opts.reader) : undefined;
|
|
@@ -30,9 +33,13 @@ export function createSessionFaces(ctx) {
|
|
|
30
33
|
: await buildSessionAuditLocal(auditLocalRows, sessionId, handles);
|
|
31
34
|
if (!audit)
|
|
32
35
|
return undefined;
|
|
33
|
-
const [head, agent] = await Promise.all([
|
|
36
|
+
const [head, agent, projectId] = await Promise.all([
|
|
37
|
+
headOf?.(sessionId),
|
|
38
|
+
opts !== undefined ? readSessionAgent(ownerAware, sessionId) : undefined,
|
|
39
|
+
opts !== undefined ? readSessionProjectId(workspaceStore, sessionId) : undefined,
|
|
40
|
+
]);
|
|
34
41
|
const owner = head?.owner;
|
|
35
|
-
return { ...audit, owner: owner ?? null, ...(agent !== undefined ? { agent } : {}) };
|
|
42
|
+
return { ...audit, owner: owner ?? null, ...(agent !== undefined ? { agent } : {}), ...(projectId !== undefined ? { projectId } : {}) };
|
|
36
43
|
}
|
|
37
44
|
: undefined;
|
|
38
45
|
const sessionWatchRegistry = headOf
|
|
@@ -102,7 +109,7 @@ export function createSessionFaces(ctx) {
|
|
|
102
109
|
await fileHistoryErasure.reap(sessionId, []);
|
|
103
110
|
logger.warn("session_file_history_baselines_retained", {
|
|
104
111
|
sessionId,
|
|
105
|
-
note: "
|
|
112
|
+
note: "this file-history store has no whole-scope erase verb (deleteBySession); boundaries were reaped but v1 baselines (original file bytes) remain in the store until it implements that verb — an open deletion-rights gap, not silent",
|
|
106
113
|
});
|
|
107
114
|
}
|
|
108
115
|
}
|
|
@@ -123,6 +130,7 @@ export function createSessionFaces(ctx) {
|
|
|
123
130
|
}
|
|
124
131
|
if (peerBox !== undefined)
|
|
125
132
|
await peerBox.store.drop(peerBox.scope, peerBox.handle);
|
|
133
|
+
retireSessionId(sessionId, owner, config);
|
|
126
134
|
let historyDeleted;
|
|
127
135
|
try {
|
|
128
136
|
historyDeleted = await ownerAware.deleteSession(sessionId, owner);
|
package/dist/boot/shutdown.js
CHANGED
|
@@ -5,8 +5,8 @@ import { createParentWatch } from "../parent-watch.js";
|
|
|
5
5
|
import { setTimeout as delay } from "node:timers/promises";
|
|
6
6
|
import { HOST_BG_KILL_GRACE_MS } from "../plugins/remote-env-host.js";
|
|
7
7
|
import { installProcessExitBoundary } from "./exit-boundary.js";
|
|
8
|
-
import { createEngineLeaseTracker } from "./engine-lease.js";
|
|
9
|
-
import { writeExitLast, readExitLast, clearExitLast } from "./exit-last.js";
|
|
8
|
+
import { backgroundShellsUnreachable, createEngineLeaseTracker, laneWork } from "./engine-lease.js";
|
|
9
|
+
import { writeExitLast, readExitLast, clearExitLast, EXIT_LAST_FORMAT } from "./exit-last.js";
|
|
10
10
|
import { isScriptRealmRejection, describeRejectionReason } from "../orchestration/hardened-vm-runner.js";
|
|
11
11
|
import { DRAIN_CAUSE_COUNTS_AS_FIRST_STOP_SIGNAL, HARD_STOP_ACTION_ID, drainDeadlineBeyondBound } from "../fleet/drain-entry.js";
|
|
12
12
|
import { seatText } from "../trace/exit-seat.js";
|
|
@@ -24,10 +24,20 @@ export function installShutdownHandlers(ctx) {
|
|
|
24
24
|
const prior = readCrashLast(dataRoot);
|
|
25
25
|
if (prior)
|
|
26
26
|
logger.warn("crash_last_found", { at: prior.at, version: prior.version, pid: prior.pid, uptimeMs: prior.uptimeMs, ...(prior.inflight !== undefined ? { inflight: prior.inflight } : {}), err: prior.err });
|
|
27
|
-
const
|
|
27
|
+
const lastExitReading = readExitLast(dataRoot);
|
|
28
|
+
if (lastExitReading?.kind === "formatMismatch") {
|
|
29
|
+
logger.warn("exit_last_stale_format", {
|
|
30
|
+
fileFormat: lastExitReading.fileFormat,
|
|
31
|
+
buildFormat: EXIT_LAST_FORMAT,
|
|
32
|
+
note: "exit-last.json on this data root was written in a different format by another engine version — it is not projected " +
|
|
33
|
+
"(no exit_last_found for it) and is removed now; only the previous exit's self-exit record is lost, nothing else is affected.",
|
|
34
|
+
});
|
|
35
|
+
clearExitLast(dataRoot);
|
|
36
|
+
}
|
|
37
|
+
const lastExit = lastExitReading?.kind === "found" ? lastExitReading.info : undefined;
|
|
28
38
|
if (lastExit) {
|
|
29
39
|
logger.info("exit_last_found", {
|
|
30
|
-
at: lastExit.at, version: lastExit.version, pid: lastExit.pid,
|
|
40
|
+
at: lastExit.at, version: lastExit.version, pid: lastExit.pid, lane: lastExit.lane, reason: lastExit.reason,
|
|
31
41
|
idleForMs: lastExit.idleForMs, attached: lastExit.attached, inflight: lastExit.inflight, lingerMs: lastExit.lingerMs,
|
|
32
42
|
...(lastExit.orphanedForMs !== undefined ? { orphanedForMs: lastExit.orphanedForMs } : {}),
|
|
33
43
|
crashedDuringExit: prior !== undefined && prior.pid === lastExit.pid,
|
|
@@ -76,6 +86,7 @@ export function installShutdownHandlers(ctx) {
|
|
|
76
86
|
let parentWatch;
|
|
77
87
|
let engineLease;
|
|
78
88
|
let leaseFactsReader;
|
|
89
|
+
let handoverDoor;
|
|
79
90
|
const hardShutdown = () => {
|
|
80
91
|
if (closing)
|
|
81
92
|
return;
|
|
@@ -191,14 +202,14 @@ export function installShutdownHandlers(ctx) {
|
|
|
191
202
|
drainState.endSubscriptions?.();
|
|
192
203
|
toolApproval?.beginDrain();
|
|
193
204
|
void fleetClient?.announceNow();
|
|
194
|
-
const inflight = drainState.
|
|
205
|
+
const inflight = drainState.blockingInflight?.() ?? 0;
|
|
195
206
|
logger.info("draining_started", { actionId: entry.actionId, inflight, deadlineAt: entry.deadlineAt, windowMs });
|
|
196
207
|
if (inflight === 0) {
|
|
197
208
|
hardShutdown();
|
|
198
209
|
return { ...current, state: "draining" };
|
|
199
210
|
}
|
|
200
211
|
const tick = setInterval(() => {
|
|
201
|
-
const n = drainState.
|
|
212
|
+
const n = drainState.blockingInflight?.() ?? 0;
|
|
202
213
|
const now = performance.now();
|
|
203
214
|
if (n === 0 || now >= deadlineMono) {
|
|
204
215
|
clearInterval(tick);
|
|
@@ -254,9 +265,9 @@ export function installShutdownHandlers(ctx) {
|
|
|
254
265
|
const onSigint = () => onStopSignal("SIGINT");
|
|
255
266
|
process.on("SIGTERM", onSigterm);
|
|
256
267
|
process.on("SIGINT", onSigint);
|
|
268
|
+
const handoverLane = !config.requirePrincipal ? { lingerMs: config.engineHandoverLingerMs, backgroundShells: exitBoundary.shellsExitWouldKill } : undefined;
|
|
257
269
|
const onSighup = createSighupIdleHandler({
|
|
258
|
-
|
|
259
|
-
attached: () => drainState.attachedStreams?.() ?? 0,
|
|
270
|
+
work: () => laneWork(engineLease?.lane(), { attached: drainState.attachedStreams?.() ?? 0, inflight: drainState.blockingInflight?.() ?? 0, backgroundShells: handoverLane?.backgroundShells ?? backgroundShellsUnreachable }, "sighup"),
|
|
260
271
|
lastActivityAt: () => drainState.lastActivityAt?.() ?? 0,
|
|
261
272
|
isStopped: () => closing || draining,
|
|
262
273
|
escalate: () => drainOnCause("signal:SIGHUP"),
|
|
@@ -283,7 +294,7 @@ export function installShutdownHandlers(ctx) {
|
|
|
283
294
|
if (config.parentPid !== undefined || config.engineAutoExit) {
|
|
284
295
|
engineLease = createEngineLeaseTracker({
|
|
285
296
|
attachedStreams: () => drainState.attachedStreams?.() ?? 0,
|
|
286
|
-
inflight: () => drainState.
|
|
297
|
+
inflight: () => drainState.blockingInflight?.() ?? 0,
|
|
287
298
|
lastActivityAt: () => drainState.lastActivityAt?.() ?? 0,
|
|
288
299
|
lastAttachEndedAt: () => drainState.lastAttachEndedAt?.() ?? 0,
|
|
289
300
|
isStopped: () => closing || draining,
|
|
@@ -296,10 +307,15 @@ export function installShutdownHandlers(ctx) {
|
|
|
296
307
|
...(config.parentPid !== undefined
|
|
297
308
|
? { orphan: { lingerMs: config.engineOrphanLingerMs, read: () => orphanState } }
|
|
298
309
|
: {}),
|
|
310
|
+
firstAttach: { windowMs: config.engineFirstAttachMs, firstTouchAt: () => drainState.firstActivityAt?.() ?? null },
|
|
311
|
+
...(handoverLane !== undefined ? { handover: handoverLane } : {}),
|
|
299
312
|
log: (event, fields) => logger.info(event, fields),
|
|
300
313
|
});
|
|
301
314
|
leaseFactsReader = () => engineLease?.facts;
|
|
302
315
|
drainState.engineLease = leaseFactsReader;
|
|
316
|
+
handoverDoor = engineLease.handover;
|
|
317
|
+
if (handoverDoor !== undefined)
|
|
318
|
+
drainState.engineHandover = handoverDoor;
|
|
303
319
|
}
|
|
304
320
|
let disposed = false;
|
|
305
321
|
return {
|
|
@@ -324,6 +340,8 @@ export function installShutdownHandlers(ctx) {
|
|
|
324
340
|
drainState.enter = undefined;
|
|
325
341
|
if (leaseFactsReader !== undefined && drainState.engineLease === leaseFactsReader)
|
|
326
342
|
drainState.engineLease = undefined;
|
|
343
|
+
if (handoverDoor !== undefined && drainState.engineHandover === handoverDoor)
|
|
344
|
+
drainState.engineHandover = undefined;
|
|
327
345
|
},
|
|
328
346
|
};
|
|
329
347
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare function runStage01(): {
|
|
2
|
-
config: import("../config-types.js").
|
|
2
|
+
config: import("../config-types.js").LoadedConfig;
|
|
3
3
|
localRoot: string;
|
|
4
4
|
logger: import("../observability/logger.js").Logger;
|
|
5
5
|
metrics: import("../observability/metrics.js").Metrics;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { homedir } from "node:os";
|
|
2
2
|
import { loadConfig, logConfigDiagnostics, splitLocalRoots } from "../config.js";
|
|
3
3
|
import { configLocalRoot } from "../config-provider.js";
|
|
4
|
-
import {
|
|
4
|
+
import { operatorDeclarationRefusal, runStaleHeartbeatRefusal } from "../config-invariants.js";
|
|
5
5
|
import { drainNumEnvWarnings } from "../plugins/remote-shell.js";
|
|
6
6
|
import { setWebSearchBadPayloadObserver } from "../plugins/web-search.js";
|
|
7
7
|
import { createLogger } from "../observability/logger.js";
|
|
@@ -20,10 +20,14 @@ export function runStage01() {
|
|
|
20
20
|
declareServerWithheldEnv();
|
|
21
21
|
const config = loadConfig();
|
|
22
22
|
bindOwnCredentialsConfig(config);
|
|
23
|
-
const runStaleFailure =
|
|
23
|
+
const runStaleFailure = runStaleHeartbeatRefusal(config);
|
|
24
24
|
if (runStaleFailure !== undefined) {
|
|
25
25
|
throw new Error(runStaleFailure);
|
|
26
26
|
}
|
|
27
|
+
const operatorDeclarationFailure = operatorDeclarationRefusal(config);
|
|
28
|
+
if (operatorDeclarationFailure !== undefined) {
|
|
29
|
+
throw new Error(operatorDeclarationFailure);
|
|
30
|
+
}
|
|
27
31
|
const logger = createLogger(config.logLevel);
|
|
28
32
|
const metrics = createMetrics();
|
|
29
33
|
installFailOpenRecorder({ logger, metrics, redactDetail: redactSecrets });
|
|
@@ -61,7 +65,7 @@ export function runStage01() {
|
|
|
61
65
|
if (rootsSplit) {
|
|
62
66
|
logger.warn("local_roots_split", {
|
|
63
67
|
...rootsSplit,
|
|
64
|
-
note: "
|
|
68
|
+
note: "The local backend's DATA root and the config root differ, and CONFIG_LOCAL_DIR is not set: config.d / remote-exec.json are read from the derived config root (AGENT_DATA_DIR or ~/.ai-agent; LOCAL_DATA_ROOT is not consulted there), while data lives under the data root (LOCAL_DATA_ROOT, else CONFIG_LOCAL_DIR, AGENT_DATA_DIR, ~/.ai-agent). If you meant to move both, set CONFIG_LOCAL_DIR to the same directory; if the split is intended, set CONFIG_LOCAL_DIR to the config directory explicitly — any explicit CONFIG_LOCAL_DIR silences this line.",
|
|
65
69
|
});
|
|
66
70
|
}
|
|
67
71
|
installOutboundDispatcher(logger);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { runStage01 } from "./stage-01-config.js";
|
|
2
2
|
export declare function runStage02(ctx: Awaited<ReturnType<typeof runStage01>>): Promise<{
|
|
3
|
+
config: import("../config-types.js").ServiceConfig;
|
|
3
4
|
ceilingVerdict: import("./unpriced-ceiling-verdict.js").UnpricedCeilingVerdict;
|
|
4
5
|
webAdmin: import("./web-admin.js").WebAdminRuntime;
|
|
5
|
-
config: import("../config-types.js").ServiceConfig;
|
|
6
6
|
localRoot: string;
|
|
7
7
|
logger: import("../index.js").Logger;
|
|
8
8
|
metrics: import("../index.js").Metrics;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { createUnpricedCeilingVerdict } from "./unpriced-ceiling-verdict.js";
|
|
2
2
|
import { createWebAdminRuntime } from "./web-admin.js";
|
|
3
|
-
import { composeExecutionLane,
|
|
3
|
+
import { composeExecutionLane, HTTP_SERVICE_LANE_ENTRY } from "./execution-lane.js";
|
|
4
4
|
import { configSourceKind } from "../config-provider.js";
|
|
5
|
+
import { buildCandidateRejectionNotes } from "../web-admin-client/candidate-gate.js";
|
|
5
6
|
import { logConfigDirMigration, migrateLocalConfigDirectory } from "../config-d-migration.js";
|
|
6
7
|
import { logEnvModelsMigration, runEnvModelsMigration } from "../config-root-migration.js";
|
|
7
8
|
import { assertLocalConfigDirTrusted } from "../config-dir-trust.js";
|
|
@@ -10,18 +11,19 @@ import { isRosterGateArmed } from "../config.js";
|
|
|
10
11
|
import { judgeServedModelRoute } from "../model-route-endpoint.js";
|
|
11
12
|
import { servedModelTableLeg } from "../model-select.js";
|
|
12
13
|
export async function runStage02(ctx) {
|
|
13
|
-
const { config, localRoot, logger, metrics } = ctx;
|
|
14
|
-
const configSource = configSourceKind(
|
|
14
|
+
const { config: loaded, localRoot, logger, metrics } = ctx;
|
|
15
|
+
const configSource = configSourceKind(loaded);
|
|
15
16
|
if (configSource === "local") {
|
|
16
|
-
await assertLocalConfigDirTrusted({ root: localRoot, declaredOwnerUid:
|
|
17
|
-
const envModelsMigration = { root: localRoot, env: process.env, envTableIsPlaceholder: isRosterGateArmed(
|
|
17
|
+
await assertLocalConfigDirTrusted({ root: localRoot, declaredOwnerUid: loaded.configLocalOwnerUid });
|
|
18
|
+
const envModelsMigration = { root: localRoot, env: process.env, envTableIsPlaceholder: isRosterGateArmed(loaded.webAdmin) };
|
|
18
19
|
logEnvModelsMigration(logger, envModelsMigration, await runEnvModelsMigration(envModelsMigration));
|
|
19
20
|
logConfigDirMigration(logger, await migrateLocalConfigDirectory(localRoot));
|
|
20
21
|
}
|
|
21
|
-
await composeExecutionLane(
|
|
22
|
+
const config = await composeExecutionLane(loaded, { configSource, localRoot, logger, entry: HTTP_SERVICE_LANE_ENTRY });
|
|
22
23
|
const webAdmin = await createWebAdminRuntime({ config, logger, metrics, localRoot });
|
|
23
24
|
const servedLeg = servedModelTableLeg(config);
|
|
24
|
-
const
|
|
25
|
+
const rejection = webAdmin.candidateRejectionState();
|
|
26
|
+
const noDefaultModel = defaultModelRefusal({ models: config.models, modelRefusals: config.modelRefusals, candidateRejectionNotes: rejection === undefined ? undefined : buildCandidateRejectionNotes(rejection) }, servedLeg);
|
|
25
27
|
if (noDefaultModel !== undefined) {
|
|
26
28
|
throw new Error(noDefaultModel);
|
|
27
29
|
}
|
|
@@ -35,6 +37,6 @@ export async function runStage02(ctx) {
|
|
|
35
37
|
}
|
|
36
38
|
const ceilingVerdict = createUnpricedCeilingVerdict({ config, logger });
|
|
37
39
|
ceilingVerdict.judge();
|
|
38
|
-
return { ...ctx, ceilingVerdict, webAdmin };
|
|
40
|
+
return { ...ctx, config, ceilingVerdict, webAdmin };
|
|
39
41
|
}
|
|
40
42
|
//# sourceMappingURL=stage-02-web-admin-pull.js.map
|
|
@@ -20,12 +20,13 @@ export declare function runStage03(ctx: Awaited<ReturnType<typeof runStage02>>):
|
|
|
20
20
|
sessionStore: import("@sema-agent/core").SessionStore<import("@sema-agent/core").SessionStoreSummary, import("@sema-agent/core").SessionListQuery>;
|
|
21
21
|
sqlEngine: import("../plugins/sql-driver.js").SqlEngineReading | undefined;
|
|
22
22
|
storePosture: import("../store-posture.js").StorePosture;
|
|
23
|
+
storeSweep: import("../plugins/store-sweep.js").StoreSweep;
|
|
23
24
|
taskAttachmentStore: import("../plugins/task-attachment-store.js").TaskAttachmentStore | undefined;
|
|
24
25
|
taskListLane: import("./task-list-lane.js").TaskListLane;
|
|
25
26
|
usageWindowStore: import("@sema-agent/core").UsageWindowStore | undefined;
|
|
27
|
+
config: import("../config-types.js").ServiceConfig;
|
|
26
28
|
ceilingVerdict: import("./unpriced-ceiling-verdict.js").UnpricedCeilingVerdict;
|
|
27
29
|
webAdmin: import("./web-admin.js").WebAdminRuntime;
|
|
28
|
-
config: import("../config-types.js").ServiceConfig;
|
|
29
30
|
localRoot: string;
|
|
30
31
|
logger: import("../index.js").Logger;
|
|
31
32
|
metrics: import("../index.js").Metrics;
|
|
@@ -2,8 +2,8 @@ import { uuidv7 } from "@sema-agent/core";
|
|
|
2
2
|
import { openStores } from "./stores.js";
|
|
3
3
|
export async function runStage03(ctx) {
|
|
4
4
|
const { config, localRoot, logger, metrics } = ctx;
|
|
5
|
-
const { backend, storePosture, memoryEngine, engineDataRoot, memorySyncCursors, rosterStore, backgroundAgentStore, sessionCaptureRecords, taskAttachmentStore, mailboxStore, mailboxRecipientLifecycle, memoryExportStores, memorySyncRunner, sessionStore, breakerState, usageWindowStore, memoryPosture, taskListLane, sqlEngine, } = await openStores({ config, logger, metrics, localRoot });
|
|
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 });
|
|
6
6
|
const instanceId = uuidv7();
|
|
7
|
-
return { ...ctx, backend, backgroundAgentStore, breakerState, engineDataRoot, instanceId, mailboxRecipientLifecycle, mailboxStore, memoryEngine, memoryExportStores, memoryPosture, memorySyncCursors, memorySyncRunner, rosterStore, sessionCaptureRecords, sessionStore, sqlEngine, storePosture, taskAttachmentStore, taskListLane, usageWindowStore };
|
|
7
|
+
return { ...ctx, backend, backgroundAgentStore, breakerState, engineDataRoot, instanceId, mailboxRecipientLifecycle, mailboxStore, memoryEngine, memoryExportStores, memoryPosture, memorySyncCursors, memorySyncRunner, rosterStore, sessionCaptureRecords, sessionStore, sqlEngine, storePosture, storeSweep, taskAttachmentStore, taskListLane, usageWindowStore };
|
|
8
8
|
}
|
|
9
9
|
//# sourceMappingURL=stage-03-store-backend.js.map
|
|
@@ -50,12 +50,13 @@ export declare function runStage04(ctx: Awaited<ReturnType<typeof runStage03>>):
|
|
|
50
50
|
sessionStore: import("@sema-agent/core").SessionStore<import("@sema-agent/core").SessionStoreSummary, import("@sema-agent/core").SessionListQuery>;
|
|
51
51
|
sqlEngine: import("../plugins/sql-driver.js").SqlEngineReading | undefined;
|
|
52
52
|
storePosture: import("../store-posture.js").StorePosture;
|
|
53
|
+
storeSweep: import("../plugins/store-sweep.js").StoreSweep;
|
|
53
54
|
taskAttachmentStore: import("../plugins/task-attachment-store.js").TaskAttachmentStore | undefined;
|
|
54
55
|
taskListLane: import("./task-list-lane.js").TaskListLane;
|
|
55
56
|
usageWindowStore: import("@sema-agent/core").UsageWindowStore | undefined;
|
|
57
|
+
config: import("../config-types.js").ServiceConfig;
|
|
56
58
|
ceilingVerdict: import("./unpriced-ceiling-verdict.js").UnpricedCeilingVerdict;
|
|
57
59
|
webAdmin: import("./web-admin.js").WebAdminRuntime;
|
|
58
|
-
config: import("../config-types.js").ServiceConfig;
|
|
59
60
|
localRoot: string;
|
|
60
61
|
logger: import("../index.js").Logger;
|
|
61
62
|
metrics: import("../index.js").Metrics;
|
|
@@ -2,11 +2,13 @@ import type { runStage04 } from "./stage-04-stores.js";
|
|
|
2
2
|
export declare function runStage05(ctx: Awaited<ReturnType<typeof runStage04>>): Promise<{
|
|
3
3
|
deploymentMods: readonly import("@sema-agent/core").ModRegistration<import("@sema-agent/core").EngineDollar>[];
|
|
4
4
|
deploymentModsLoaded: readonly import("./deployment-mods.js").LoadedModPackage[];
|
|
5
|
+
belowTaskChainPatterns: readonly string[];
|
|
5
6
|
deviceLane: import("./device-lane.js").DeviceLane | undefined;
|
|
6
7
|
peerDesk: import("../peer-seat.js").PeerDesk;
|
|
7
8
|
dropSessionScoped: (sid: string) => void;
|
|
8
9
|
executionEnvFactory: import("@sema-agent/core").ExecutionEnvFactory | undefined;
|
|
9
10
|
fenceSessionOwner: (sid: string, owner: string | null) => void;
|
|
11
|
+
sessionResidentBackground: () => import("../session-resident-background.js").SessionResidentCounts;
|
|
10
12
|
lspManager: import("@sema-agent/core").NodeLspManager | import("../lsp/manager.js").E2bLspManager | undefined;
|
|
11
13
|
spaceReclaimer: import("../workspace-space.js").SpaceReclaimer | undefined;
|
|
12
14
|
sandboxPodReaper: import("../plugins/k8s-pod-reaper.js").SandboxPodReaper | undefined;
|
|
@@ -69,12 +71,13 @@ export declare function runStage05(ctx: Awaited<ReturnType<typeof runStage04>>):
|
|
|
69
71
|
sessionStore: import("@sema-agent/core").SessionStore<import("@sema-agent/core").SessionStoreSummary, import("@sema-agent/core").SessionListQuery>;
|
|
70
72
|
sqlEngine: import("../plugins/sql-driver.js").SqlEngineReading | undefined;
|
|
71
73
|
storePosture: import("../store-posture.js").StorePosture;
|
|
74
|
+
storeSweep: import("../plugins/store-sweep.js").StoreSweep;
|
|
72
75
|
taskAttachmentStore: import("../plugins/task-attachment-store.js").TaskAttachmentStore | undefined;
|
|
73
76
|
taskListLane: import("./task-list-lane.js").TaskListLane;
|
|
74
77
|
usageWindowStore: import("@sema-agent/core").UsageWindowStore | undefined;
|
|
78
|
+
config: import("../config-types.js").ServiceConfig;
|
|
75
79
|
ceilingVerdict: import("./unpriced-ceiling-verdict.js").UnpricedCeilingVerdict;
|
|
76
80
|
webAdmin: import("./web-admin.js").WebAdminRuntime;
|
|
77
|
-
config: import("../config-types.js").ServiceConfig;
|
|
78
81
|
localRoot: string;
|
|
79
82
|
logger: import("../index.js").Logger;
|
|
80
83
|
metrics: import("../index.js").Metrics;
|
|
@@ -10,12 +10,12 @@ import { SANDBOX_GIT_PLANE_OFF_TEXT } from "../sandbox-git-plane.js";
|
|
|
10
10
|
import { createPeerDesk } from "../peer-seat.js";
|
|
11
11
|
export async function runStage05(ctx) {
|
|
12
12
|
const { backend, config, instanceId, logger, metrics, sessionStore, taskAttachmentStore } = ctx;
|
|
13
|
-
const deviceLane = config.remoteExec
|
|
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, setSessionCwd, setSessionShellEnv, setSessionInheritEnv, fenceSessionOwner, dropSessionScoped, executionEnvFactory, worktreeReap, sendUserFileTaskEnvs, lspManager, spaceReclaimer, sandboxSecretSeatGate, sandboxPodReaper, sandboxGitPlane: sandboxGitPlaneSeat, } = createExecutionEnv({ config, logger, metrics, taskAttachmentStore, ...(deviceLane ? { deviceLane } : {}), ...(spaceCommits !== undefined ? { spaceCommits } : {}), ...(headOf !== undefined ? { headOf } : {}), ...(backend !== undefined ? { runRows: () => runStore } : {}) });
|
|
17
|
-
assertDeviceLaneWired(config.remoteExec
|
|
18
|
-
if (deviceLane !== undefined && config.remoteExec
|
|
16
|
+
const { perTaskImage, sessionEnvSelection, perSessionCwd, setSessionCwd, setSessionShellEnv, setSessionInheritEnv, fenceSessionOwner, dropSessionScoped, sessionResidentBackground, executionEnvFactory, worktreeReap, sendUserFileTaskEnvs, lspManager, spaceReclaimer, sandboxSecretSeatGate, sandboxPodReaper, sandboxGitPlane: sandboxGitPlaneSeat, } = createExecutionEnv({ config, logger, metrics, taskAttachmentStore, ...(deviceLane ? { deviceLane } : {}), ...(spaceCommits !== undefined ? { spaceCommits } : {}), ...(headOf !== undefined ? { headOf } : {}), ...(backend !== undefined ? { runRows: () => runStore } : {}) });
|
|
17
|
+
assertDeviceLaneWired(config.remoteExec.provider === "device", deviceLane, executionEnvFactory !== undefined);
|
|
18
|
+
if (deviceLane !== undefined && config.remoteExec.provider === "device")
|
|
19
19
|
await noteDeviceRelayBindings(config.remoteExec.relay, deviceLane.store, logger);
|
|
20
20
|
assertWorkspaceSpaceReadable(facts.workspaceSpace(config), { headOf, spaceCommits }, facts.workspaceCache(config), sessionStoreLabelOf(config.sessionBackend, backend?.kind));
|
|
21
21
|
if (sandboxSecretSeatGate !== undefined)
|
|
@@ -30,10 +30,10 @@ export async function runStage05(ctx) {
|
|
|
30
30
|
}
|
|
31
31
|
if (config.toolTrace)
|
|
32
32
|
logger.info("tool_trace_enabled", {});
|
|
33
|
-
const { registrations: deploymentMods, loaded: deploymentModsLoaded } = await assembleDeploymentMods({ metrics, ...(config.toolTrace ? { traceLogger: logger } : {}), brandIdentity: isBrandedDeployment(config), declaration: config.modsDeclaration, logger });
|
|
33
|
+
const { registrations: deploymentMods, loaded: deploymentModsLoaded, belowTaskChainPatterns } = await assembleDeploymentMods({ metrics, ...(config.toolTrace ? { traceLogger: logger } : {}), brandIdentity: isBrandedDeployment(config), declaration: config.modsDeclaration, logger });
|
|
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, deviceLane, peerDesk, dropSessionScoped, executionEnvFactory, fenceSessionOwner, lspManager, spaceReclaimer, sandboxPodReaper, sandboxGitPlane, perSessionCwd, perTaskImage, sendUserFileTaskEnvs, sessionEnvSelection, setSessionCwd, setSessionInheritEnv, setSessionShellEnv, worktreeReap };
|
|
37
|
+
return { ...ctx, deploymentMods, deploymentModsLoaded, belowTaskChainPatterns, deviceLane, peerDesk, dropSessionScoped, executionEnvFactory, fenceSessionOwner, sessionResidentBackground, lspManager, spaceReclaimer, sandboxPodReaper, sandboxGitPlane, perSessionCwd, perTaskImage, sendUserFileTaskEnvs, sessionEnvSelection, setSessionCwd, setSessionInheritEnv, setSessionShellEnv, worktreeReap };
|
|
38
38
|
}
|
|
39
39
|
//# sourceMappingURL=stage-05-execution-env.js.map
|
|
@@ -30,7 +30,7 @@ export declare function runStage06(ctx: Awaited<ReturnType<typeof runStage05>>):
|
|
|
30
30
|
outcomeSink: import("../plugins/file-outcome-sink.js").OutcomeSink | undefined;
|
|
31
31
|
principalCaps: import("../runtime-caps-resolver.js").PrincipalEntitlementsClient | undefined;
|
|
32
32
|
question: import("../question.js").QuestionCoordinator | undefined;
|
|
33
|
-
retentionExecutor: import("../plugins/retention-
|
|
33
|
+
retentionExecutor: import("../plugins/retention-deployment.js").RetentionExecutor | undefined;
|
|
34
34
|
retentionLaneStore: import("../plugins/retention-lane-store-sql.js").RetentionLaneStore | undefined;
|
|
35
35
|
runner: Runner;
|
|
36
36
|
runnerDeps: import("@sema-agent/core").RunnerDeps;
|
|
@@ -63,11 +63,13 @@ export declare function runStage06(ctx: Awaited<ReturnType<typeof runStage05>>):
|
|
|
63
63
|
orgDeliveryGate: import("@sema-agent/core").OrgDeliveryGate | undefined;
|
|
64
64
|
deploymentMods: readonly import("@sema-agent/core").ModRegistration<import("@sema-agent/core").EngineDollar>[];
|
|
65
65
|
deploymentModsLoaded: readonly import("./deployment-mods.js").LoadedModPackage[];
|
|
66
|
+
belowTaskChainPatterns: readonly string[];
|
|
66
67
|
deviceLane: import("./device-lane.js").DeviceLane | undefined;
|
|
67
68
|
peerDesk: import("../peer-seat.js").PeerDesk;
|
|
68
69
|
dropSessionScoped: (sid: string) => void;
|
|
69
70
|
executionEnvFactory: import("@sema-agent/core").ExecutionEnvFactory | undefined;
|
|
70
71
|
fenceSessionOwner: (sid: string, owner: string | null) => void;
|
|
72
|
+
sessionResidentBackground: () => import("../session-resident-background.js").SessionResidentCounts;
|
|
71
73
|
lspManager: import("@sema-agent/core").NodeLspManager | import("../lsp/manager.js").E2bLspManager | undefined;
|
|
72
74
|
spaceReclaimer: import("../workspace-space.js").SpaceReclaimer | undefined;
|
|
73
75
|
sandboxPodReaper: import("../plugins/k8s-pod-reaper.js").SandboxPodReaper | undefined;
|
|
@@ -130,12 +132,13 @@ export declare function runStage06(ctx: Awaited<ReturnType<typeof runStage05>>):
|
|
|
130
132
|
sessionStore: import("@sema-agent/core").SessionStore<import("@sema-agent/core").SessionStoreSummary, import("@sema-agent/core").SessionListQuery>;
|
|
131
133
|
sqlEngine: import("../plugins/sql-driver.js").SqlEngineReading | undefined;
|
|
132
134
|
storePosture: import("../store-posture.js").StorePosture;
|
|
135
|
+
storeSweep: import("../plugins/store-sweep.js").StoreSweep;
|
|
133
136
|
taskAttachmentStore: import("../plugins/task-attachment-store.js").TaskAttachmentStore | undefined;
|
|
134
137
|
taskListLane: import("./task-list-lane.js").TaskListLane;
|
|
135
138
|
usageWindowStore: import("@sema-agent/core").UsageWindowStore | undefined;
|
|
139
|
+
config: import("../config-types.js").ServiceConfig;
|
|
136
140
|
ceilingVerdict: import("./unpriced-ceiling-verdict.js").UnpricedCeilingVerdict;
|
|
137
141
|
webAdmin: import("./web-admin.js").WebAdminRuntime;
|
|
138
|
-
config: import("../config-types.js").ServiceConfig;
|
|
139
142
|
localRoot: string;
|
|
140
143
|
logger: import("../index.js").Logger;
|
|
141
144
|
metrics: import("../index.js").Metrics;
|
|
@@ -6,7 +6,6 @@ import { ForkRoutingSessionStore } from "../plugins/fork-routing-session-store.j
|
|
|
6
6
|
import { withoutHands } from "../capabilities/hands-lane.js";
|
|
7
7
|
import { isBrandedDeployment } from "../capabilities/brand-identity.js";
|
|
8
8
|
import { hasServiceAuth } from "../http/server.js";
|
|
9
|
-
import { operatorRosterPresent } from "../http/principal-gate.js";
|
|
10
9
|
import { workflowModelAllowlistFor } from "../task-workflow.js";
|
|
11
10
|
import { createHookLlm, buildHookFailureText } from "../hooks/hook-llm.js";
|
|
12
11
|
import { assertRetentionLaneWirable } from "./retention-lane.js";
|
|
@@ -28,7 +27,7 @@ import { createSharedMemoryScopeAuthorizer } from "../shared-memory-scope-author
|
|
|
28
27
|
import { mountOrgDeliveryGate } from "./org-delivery.js";
|
|
29
28
|
import { parkedAskRedeem, runStore } from "./late-binds.js";
|
|
30
29
|
import { withInternalRunEnvs } from "../internal-run-env.js";
|
|
31
|
-
import { retentionSweepRuns } from "../plugins/retention-
|
|
30
|
+
import { retentionSweepRuns } from "../plugins/retention-declaration.js";
|
|
32
31
|
import { createOperatorFaceIncidentSink } from "../memory-incident-sink.js";
|
|
33
32
|
export async function runStage06(ctx) {
|
|
34
33
|
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, taskAttachmentStore, taskListLane, toolResultStore, tracer, usageWindowStore } = ctx;
|
|
@@ -79,6 +78,16 @@ export async function runStage06(ctx) {
|
|
|
79
78
|
],
|
|
80
79
|
locked: (config.lockedConfigKeys ?? []).includes("retentionPolicy"),
|
|
81
80
|
});
|
|
81
|
+
const governanceSeams = createGovernanceSeams({
|
|
82
|
+
config,
|
|
83
|
+
logger,
|
|
84
|
+
retentionStores: [
|
|
85
|
+
{ name: "sessionStore", store: sessionStore },
|
|
86
|
+
{ name: "checkpointStore", store: checkpointStore },
|
|
87
|
+
{ name: "toolResultStore", store: runnerOffloadStore },
|
|
88
|
+
],
|
|
89
|
+
retentionExecutor: retentionSweepRuns(config.retentionSweep) ? (retentionExecutor ?? null) : null,
|
|
90
|
+
});
|
|
82
91
|
const consolidationSeat = consolidationValve.enabled && memoryEngine
|
|
83
92
|
? resolveConsolidationDriverSeat({
|
|
84
93
|
brain,
|
|
@@ -97,11 +106,11 @@ export async function runStage06(ctx) {
|
|
|
97
106
|
onStopDetail: (audit) => logger.warn("memory_consolidation_stop_detail", audit),
|
|
98
107
|
writeJudge: createOperatorValveWriteJudge({ ruleStoreProvider: permissionRuleProvider, config }),
|
|
99
108
|
onNotice: createEngineNoticeForwarder(logger, defaultEngineNoticeRouter, metrics),
|
|
109
|
+
postureOf: governanceSeams.compliancePostureResolver,
|
|
100
110
|
})
|
|
101
111
|
: undefined;
|
|
102
112
|
for (const w of buildConsolidationValveAudit({
|
|
103
113
|
valve: consolidationValve,
|
|
104
|
-
operatorRosterPresent: operatorRosterPresent(config),
|
|
105
114
|
hasServiceAuth: hasServiceAuth(config),
|
|
106
115
|
allowUnauthedWrites: config.allowUnauthedWrites ?? false,
|
|
107
116
|
}).warnings) {
|
|
@@ -117,16 +126,6 @@ export async function runStage06(ctx) {
|
|
|
117
126
|
autoRunOnRecommendation: config.memoryConsolidationDriver.autoRunOnRecommendation ?? "engine-default(on)",
|
|
118
127
|
});
|
|
119
128
|
}
|
|
120
|
-
const governanceSeams = createGovernanceSeams({
|
|
121
|
-
config,
|
|
122
|
-
logger,
|
|
123
|
-
retentionStores: [
|
|
124
|
-
{ name: "sessionStore", store: sessionStore },
|
|
125
|
-
{ name: "checkpointStore", store: checkpointStore },
|
|
126
|
-
{ name: "toolResultStore", store: runnerOffloadStore },
|
|
127
|
-
],
|
|
128
|
-
retentionExecutor: retentionSweepRuns(config.retentionSweep) ? (retentionExecutor ?? null) : null,
|
|
129
|
-
});
|
|
130
129
|
const mcpRevocations = webAdmin.takeMcpRevocations();
|
|
131
130
|
const workflowModelAllowlistSnapshot = workflowModelAllowlistFor(config) ?? [];
|
|
132
131
|
const runnerDeps = createRunnerDeps({
|
|
@@ -47,7 +47,7 @@ export declare function runStage07(ctx: Awaited<ReturnType<typeof runStage06>>):
|
|
|
47
47
|
outcomeSink: import("../plugins/file-outcome-sink.js").OutcomeSink | undefined;
|
|
48
48
|
principalCaps: import("../runtime-caps-resolver.js").PrincipalEntitlementsClient | undefined;
|
|
49
49
|
question: import("../question.js").QuestionCoordinator | undefined;
|
|
50
|
-
retentionExecutor: import("../plugins/retention-
|
|
50
|
+
retentionExecutor: import("../plugins/retention-deployment.js").RetentionExecutor | undefined;
|
|
51
51
|
retentionLaneStore: import("../plugins/retention-lane-store-sql.js").RetentionLaneStore | undefined;
|
|
52
52
|
runner: import("@sema-agent/core").Runner;
|
|
53
53
|
runnerDeps: import("@sema-agent/core").RunnerDeps;
|
|
@@ -80,11 +80,13 @@ export declare function runStage07(ctx: Awaited<ReturnType<typeof runStage06>>):
|
|
|
80
80
|
orgDeliveryGate: import("@sema-agent/core").OrgDeliveryGate | undefined;
|
|
81
81
|
deploymentMods: readonly import("@sema-agent/core").ModRegistration<import("@sema-agent/core").EngineDollar>[];
|
|
82
82
|
deploymentModsLoaded: readonly import("./deployment-mods.js").LoadedModPackage[];
|
|
83
|
+
belowTaskChainPatterns: readonly string[];
|
|
83
84
|
deviceLane: import("./device-lane.js").DeviceLane | undefined;
|
|
84
85
|
peerDesk: import("../peer-seat.js").PeerDesk;
|
|
85
86
|
dropSessionScoped: (sid: string) => void;
|
|
86
87
|
executionEnvFactory: import("@sema-agent/core").ExecutionEnvFactory | undefined;
|
|
87
88
|
fenceSessionOwner: (sid: string, owner: string | null) => void;
|
|
89
|
+
sessionResidentBackground: () => import("../session-resident-background.js").SessionResidentCounts;
|
|
88
90
|
lspManager: import("@sema-agent/core").NodeLspManager | import("../lsp/manager.js").E2bLspManager | undefined;
|
|
89
91
|
spaceReclaimer: import("../workspace-space.js").SpaceReclaimer | undefined;
|
|
90
92
|
sandboxPodReaper: import("../plugins/k8s-pod-reaper.js").SandboxPodReaper | undefined;
|
|
@@ -147,12 +149,13 @@ export declare function runStage07(ctx: Awaited<ReturnType<typeof runStage06>>):
|
|
|
147
149
|
sessionStore: import("@sema-agent/core").SessionStore<import("@sema-agent/core").SessionStoreSummary, import("@sema-agent/core").SessionListQuery>;
|
|
148
150
|
sqlEngine: import("../plugins/sql-driver.js").SqlEngineReading | undefined;
|
|
149
151
|
storePosture: import("../store-posture.js").StorePosture;
|
|
152
|
+
storeSweep: import("../plugins/store-sweep.js").StoreSweep;
|
|
150
153
|
taskAttachmentStore: import("../plugins/task-attachment-store.js").TaskAttachmentStore | undefined;
|
|
151
154
|
taskListLane: import("./task-list-lane.js").TaskListLane;
|
|
152
155
|
usageWindowStore: import("@sema-agent/core").UsageWindowStore | undefined;
|
|
156
|
+
config: import("../config-types.js").ServiceConfig;
|
|
153
157
|
ceilingVerdict: import("./unpriced-ceiling-verdict.js").UnpricedCeilingVerdict;
|
|
154
158
|
webAdmin: import("./web-admin.js").WebAdminRuntime;
|
|
155
|
-
config: import("../config-types.js").ServiceConfig;
|
|
156
159
|
localRoot: string;
|
|
157
160
|
logger: import("../index.js").Logger;
|
|
158
161
|
metrics: import("../index.js").Metrics;
|