@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
|
@@ -14,7 +14,7 @@ import { buildScenarios, builtinScenarioDetails, danglingScenarioRefusal } from
|
|
|
14
14
|
import { isBrandedDeployment } from "../capabilities/brand-identity.js";
|
|
15
15
|
import { RateLimiter } from "../observability/rate-limit.js";
|
|
16
16
|
import { explicitOperatorOk } from "../http/server.js";
|
|
17
|
-
import {
|
|
17
|
+
import { buildServiceTokenPostureNotice } from "../http/principal-gate.js";
|
|
18
18
|
import { selfOrchestrationDenial } from "../task-workflow.js";
|
|
19
19
|
import { centerEntitlementSourceWired } from "../runtime-caps-resolver.js";
|
|
20
20
|
import { reclaimOrphansAtBoot } from "../boot-reclaim.js";
|
|
@@ -87,7 +87,7 @@ export async function runStage07(ctx) {
|
|
|
87
87
|
})()
|
|
88
88
|
: undefined;
|
|
89
89
|
const imageIndex = backend?.imageIndex ? backend.imageIndex() : undefined;
|
|
90
|
-
const selectEnvTool = config.selectEnvironmentTool && config.remoteExec
|
|
90
|
+
const selectEnvTool = config.selectEnvironmentTool && config.remoteExec.provider === "k8s" && imageIndex
|
|
91
91
|
? selectEnvironmentTool({
|
|
92
92
|
catalog: imageIndex,
|
|
93
93
|
selection: sessionEnvSelection,
|
|
@@ -100,9 +100,9 @@ export async function runStage07(ctx) {
|
|
|
100
100
|
if (durableEnabled)
|
|
101
101
|
logger.info("durable_approval_enabled", { toolApprovalGate: config.approvalRequire.length });
|
|
102
102
|
{
|
|
103
|
-
const
|
|
104
|
-
if (
|
|
105
|
-
logger.
|
|
103
|
+
const posture = buildServiceTokenPostureNotice(config);
|
|
104
|
+
if (posture)
|
|
105
|
+
logger.info(posture.event, posture.fields);
|
|
106
106
|
}
|
|
107
107
|
if (config.a2aServe) {
|
|
108
108
|
const peer = facts.a2aServe({ config, runStore });
|
|
@@ -123,7 +123,7 @@ export async function runStage07(ctx) {
|
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
125
|
for (const w of buildNoResponderBootWarns({
|
|
126
|
-
lane:
|
|
126
|
+
lane: config.remoteExec.provider,
|
|
127
127
|
selfOrchestrationEnabled: config.selfOrchestrationEnabled,
|
|
128
128
|
approvalFaceWired: toolApproval !== undefined || durableEnabled,
|
|
129
129
|
}))
|
|
@@ -177,7 +177,7 @@ export async function runStage07(ctx) {
|
|
|
177
177
|
const webFetchSummarize = createWebFetchSummarizeLane({ brain, config, getKeyResolver: () => webAdmin.getKeyResolver(), logger });
|
|
178
178
|
const scenarioDeps = {
|
|
179
179
|
runner, subRunner, model: DEFAULT_MODEL_REF, skills, repoClient, requirePrincipal: config.requirePrincipal,
|
|
180
|
-
handsLane: laneWiresExecutionEnv(
|
|
180
|
+
handsLane: laneWiresExecutionEnv(config.remoteExec.provider),
|
|
181
181
|
webSearch: webSearch ? webSearch : undefined, logger, webFetchSummarize,
|
|
182
182
|
backgroundAgentStore: backgroundAgentStore ? backgroundAgentStore : undefined,
|
|
183
183
|
checkpointStore: checkpointStore ? checkpointStore : undefined,
|
|
@@ -60,7 +60,7 @@ export declare function runStage08(ctx: Awaited<ReturnType<typeof runStage07>>):
|
|
|
60
60
|
outcomeSink: import("../plugins/file-outcome-sink.js").OutcomeSink | undefined;
|
|
61
61
|
principalCaps: import("../runtime-caps-resolver.js").PrincipalEntitlementsClient | undefined;
|
|
62
62
|
question: import("../question.js").QuestionCoordinator | undefined;
|
|
63
|
-
retentionExecutor: import("../plugins/retention-
|
|
63
|
+
retentionExecutor: import("../plugins/retention-deployment.js").RetentionExecutor | undefined;
|
|
64
64
|
retentionLaneStore: import("../plugins/retention-lane-store-sql.js").RetentionLaneStore | undefined;
|
|
65
65
|
runner: Runner;
|
|
66
66
|
runnerDeps: import("@sema-agent/core").RunnerDeps;
|
|
@@ -93,11 +93,13 @@ export declare function runStage08(ctx: Awaited<ReturnType<typeof runStage07>>):
|
|
|
93
93
|
orgDeliveryGate: import("@sema-agent/core").OrgDeliveryGate | undefined;
|
|
94
94
|
deploymentMods: readonly import("@sema-agent/core").ModRegistration<import("@sema-agent/core").EngineDollar>[];
|
|
95
95
|
deploymentModsLoaded: readonly import("./deployment-mods.js").LoadedModPackage[];
|
|
96
|
+
belowTaskChainPatterns: readonly string[];
|
|
96
97
|
deviceLane: import("./device-lane.js").DeviceLane | undefined;
|
|
97
98
|
peerDesk: import("../peer-seat.js").PeerDesk;
|
|
98
99
|
dropSessionScoped: (sid: string) => void;
|
|
99
100
|
executionEnvFactory: import("@sema-agent/core").ExecutionEnvFactory | undefined;
|
|
100
101
|
fenceSessionOwner: (sid: string, owner: string | null) => void;
|
|
102
|
+
sessionResidentBackground: () => import("../session-resident-background.js").SessionResidentCounts;
|
|
101
103
|
lspManager: import("@sema-agent/core").NodeLspManager | import("../lsp/manager.js").E2bLspManager | undefined;
|
|
102
104
|
spaceReclaimer: import("../workspace-space.js").SpaceReclaimer | undefined;
|
|
103
105
|
sandboxPodReaper: import("../plugins/k8s-pod-reaper.js").SandboxPodReaper | undefined;
|
|
@@ -160,12 +162,13 @@ export declare function runStage08(ctx: Awaited<ReturnType<typeof runStage07>>):
|
|
|
160
162
|
sessionStore: import("@sema-agent/core").SessionStore<import("@sema-agent/core").SessionStoreSummary, import("@sema-agent/core").SessionListQuery>;
|
|
161
163
|
sqlEngine: import("../plugins/sql-driver.js").SqlEngineReading | undefined;
|
|
162
164
|
storePosture: import("../store-posture.js").StorePosture;
|
|
165
|
+
storeSweep: import("../plugins/store-sweep.js").StoreSweep;
|
|
163
166
|
taskAttachmentStore: import("../plugins/task-attachment-store.js").TaskAttachmentStore | undefined;
|
|
164
167
|
taskListLane: import("./task-list-lane.js").TaskListLane;
|
|
165
168
|
usageWindowStore: import("@sema-agent/core").UsageWindowStore | undefined;
|
|
169
|
+
config: import("../config-types.js").ServiceConfig;
|
|
166
170
|
ceilingVerdict: import("./unpriced-ceiling-verdict.js").UnpricedCeilingVerdict;
|
|
167
171
|
webAdmin: import("./web-admin.js").WebAdminRuntime;
|
|
168
|
-
config: import("../config-types.js").ServiceConfig;
|
|
169
172
|
localRoot: string;
|
|
170
173
|
logger: import("../index.js").Logger;
|
|
171
174
|
metrics: import("../index.js").Metrics;
|
|
@@ -6,11 +6,11 @@ import { createLimitSync } from "./limit-sync.js";
|
|
|
6
6
|
import { runDenySweep } 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, spaceReclaimer, sandboxPodReaper, handslessRunner, hookAgentRunner, imageBakes, instanceId, localRoot, logger, mailboxStore, metrics, permissionRuleStores, pricing, rateLimiter, retentionExecutor, retentionLaneStore,
|
|
9
|
+
const { approvalAskAudit, approvalNonceStore, backend, backgroundAgentStore, ceilingVerdict, checkpointStore, parkCommits, config, webAdmin, consolidationSeatWatch, costQuota, degradeRouteWatch, fileHistoryErasure, spaceReclaimer, sandboxPodReaper, 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;
|
|
10
10
|
const reaper = startReapers({
|
|
11
11
|
config, logger, metrics, localRoot, backend, subRunner, runStore, checkpointStore, parkCommits,
|
|
12
|
-
rateLimiter, costQuota,
|
|
13
|
-
workflowNotifyGate, workflowRecoverOpts,
|
|
12
|
+
rateLimiter, costQuota, storeSweep, fileHistoryErasure, taskAttachmentStore, imageBakes, worktreeReap,
|
|
13
|
+
workflowNotifyGate, workflowRecoverOpts, sqlWorkflowRunStore, workflowNotifyJournal,
|
|
14
14
|
backgroundAgentStore, mailboxStore, toolApproval, permissionRuleStores, approvalNonceStore, userInputLedger, approvalAskAudit,
|
|
15
15
|
...(sandboxPodReaper !== undefined ? { sandboxPodReaper } : {}),
|
|
16
16
|
getRunDenySweep: () => runDenySweep,
|
|
@@ -18,6 +18,7 @@ export declare function runStage09(ctx: Awaited<ReturnType<typeof runStage08>>):
|
|
|
18
18
|
}>) | undefined;
|
|
19
19
|
webAdminJwtVerifier: import("../auth-bridge.js").WebAdminJwtVerifier | undefined;
|
|
20
20
|
sessionAudit: ((sessionId: string, opts?: import("../audit.js").SessionAuditReadOpts) => Promise<{
|
|
21
|
+
projectId?: string | undefined;
|
|
21
22
|
agent?: import("../session-agent.js").SessionAgent | undefined;
|
|
22
23
|
owner: string | null;
|
|
23
24
|
sessionId: string;
|
|
@@ -84,7 +85,7 @@ export declare function runStage09(ctx: Awaited<ReturnType<typeof runStage08>>):
|
|
|
84
85
|
outcomeSink: import("../plugins/file-outcome-sink.js").OutcomeSink | undefined;
|
|
85
86
|
principalCaps: import("../runtime-caps-resolver.js").PrincipalEntitlementsClient | undefined;
|
|
86
87
|
question: import("../question.js").QuestionCoordinator | undefined;
|
|
87
|
-
retentionExecutor: import("../plugins/retention-
|
|
88
|
+
retentionExecutor: import("../plugins/retention-deployment.js").RetentionExecutor | undefined;
|
|
88
89
|
retentionLaneStore: import("../plugins/retention-lane-store-sql.js").RetentionLaneStore | undefined;
|
|
89
90
|
runner: import("@sema-agent/core").Runner;
|
|
90
91
|
runnerDeps: import("@sema-agent/core").RunnerDeps;
|
|
@@ -117,11 +118,13 @@ export declare function runStage09(ctx: Awaited<ReturnType<typeof runStage08>>):
|
|
|
117
118
|
orgDeliveryGate: import("@sema-agent/core").OrgDeliveryGate | undefined;
|
|
118
119
|
deploymentMods: readonly import("@sema-agent/core").ModRegistration<import("@sema-agent/core").EngineDollar>[];
|
|
119
120
|
deploymentModsLoaded: readonly import("./deployment-mods.js").LoadedModPackage[];
|
|
121
|
+
belowTaskChainPatterns: readonly string[];
|
|
120
122
|
deviceLane: import("./device-lane.js").DeviceLane | undefined;
|
|
121
123
|
peerDesk: import("../peer-seat.js").PeerDesk;
|
|
122
124
|
dropSessionScoped: (sid: string) => void;
|
|
123
125
|
executionEnvFactory: import("@sema-agent/core").ExecutionEnvFactory | undefined;
|
|
124
126
|
fenceSessionOwner: (sid: string, owner: string | null) => void;
|
|
127
|
+
sessionResidentBackground: () => import("../session-resident-background.js").SessionResidentCounts;
|
|
125
128
|
lspManager: import("@sema-agent/core").NodeLspManager | import("../lsp/manager.js").E2bLspManager | undefined;
|
|
126
129
|
spaceReclaimer: import("../workspace-space.js").SpaceReclaimer | undefined;
|
|
127
130
|
sandboxPodReaper: import("../plugins/k8s-pod-reaper.js").SandboxPodReaper | undefined;
|
|
@@ -184,12 +187,13 @@ export declare function runStage09(ctx: Awaited<ReturnType<typeof runStage08>>):
|
|
|
184
187
|
sessionStore: import("@sema-agent/core").SessionStore<import("@sema-agent/core").SessionStoreSummary, import("@sema-agent/core").SessionListQuery>;
|
|
185
188
|
sqlEngine: import("../plugins/sql-driver.js").SqlEngineReading | undefined;
|
|
186
189
|
storePosture: import("../store-posture.js").StorePosture;
|
|
190
|
+
storeSweep: import("../plugins/store-sweep.js").StoreSweep;
|
|
187
191
|
taskAttachmentStore: import("../plugins/task-attachment-store.js").TaskAttachmentStore | undefined;
|
|
188
192
|
taskListLane: import("./task-list-lane.js").TaskListLane;
|
|
189
193
|
usageWindowStore: import("@sema-agent/core").UsageWindowStore | undefined;
|
|
194
|
+
config: import("../config-types.js").ServiceConfig;
|
|
190
195
|
ceilingVerdict: import("./unpriced-ceiling-verdict.js").UnpricedCeilingVerdict;
|
|
191
196
|
webAdmin: import("./web-admin.js").WebAdminRuntime;
|
|
192
|
-
config: import("../config-types.js").ServiceConfig;
|
|
193
197
|
localRoot: string;
|
|
194
198
|
logger: import("../index.js").Logger;
|
|
195
199
|
metrics: import("../index.js").Metrics;
|
|
@@ -17,6 +17,7 @@ export declare function runStage10(ctx: Awaited<ReturnType<typeof runStage09>>):
|
|
|
17
17
|
}>) | undefined;
|
|
18
18
|
webAdminJwtVerifier: import("../auth-bridge.js").WebAdminJwtVerifier | undefined;
|
|
19
19
|
sessionAudit: ((sessionId: string, opts?: import("../audit.js").SessionAuditReadOpts) => Promise<{
|
|
20
|
+
projectId?: string | undefined;
|
|
20
21
|
agent?: import("../session-agent.js").SessionAgent | undefined;
|
|
21
22
|
owner: string | null;
|
|
22
23
|
sessionId: string;
|
|
@@ -83,7 +84,7 @@ export declare function runStage10(ctx: Awaited<ReturnType<typeof runStage09>>):
|
|
|
83
84
|
outcomeSink: import("../plugins/file-outcome-sink.js").OutcomeSink | undefined;
|
|
84
85
|
principalCaps: import("../runtime-caps-resolver.js").PrincipalEntitlementsClient | undefined;
|
|
85
86
|
question: import("../question.js").QuestionCoordinator | undefined;
|
|
86
|
-
retentionExecutor: import("../plugins/retention-
|
|
87
|
+
retentionExecutor: import("../plugins/retention-deployment.js").RetentionExecutor | undefined;
|
|
87
88
|
retentionLaneStore: import("../plugins/retention-lane-store-sql.js").RetentionLaneStore | undefined;
|
|
88
89
|
runner: import("@sema-agent/core").Runner;
|
|
89
90
|
runnerDeps: import("@sema-agent/core").RunnerDeps;
|
|
@@ -116,11 +117,13 @@ export declare function runStage10(ctx: Awaited<ReturnType<typeof runStage09>>):
|
|
|
116
117
|
orgDeliveryGate: import("@sema-agent/core").OrgDeliveryGate | undefined;
|
|
117
118
|
deploymentMods: readonly import("@sema-agent/core").ModRegistration<import("@sema-agent/core").EngineDollar>[];
|
|
118
119
|
deploymentModsLoaded: readonly import("./deployment-mods.js").LoadedModPackage[];
|
|
120
|
+
belowTaskChainPatterns: readonly string[];
|
|
119
121
|
deviceLane: import("./device-lane.js").DeviceLane | undefined;
|
|
120
122
|
peerDesk: import("../peer-seat.js").PeerDesk;
|
|
121
123
|
dropSessionScoped: (sid: string) => void;
|
|
122
124
|
executionEnvFactory: import("@sema-agent/core").ExecutionEnvFactory | undefined;
|
|
123
125
|
fenceSessionOwner: (sid: string, owner: string | null) => void;
|
|
126
|
+
sessionResidentBackground: () => import("../session-resident-background.js").SessionResidentCounts;
|
|
124
127
|
lspManager: import("@sema-agent/core").NodeLspManager | import("../lsp/manager.js").E2bLspManager | undefined;
|
|
125
128
|
spaceReclaimer: import("../workspace-space.js").SpaceReclaimer | undefined;
|
|
126
129
|
sandboxPodReaper: import("../plugins/k8s-pod-reaper.js").SandboxPodReaper | undefined;
|
|
@@ -183,12 +186,13 @@ export declare function runStage10(ctx: Awaited<ReturnType<typeof runStage09>>):
|
|
|
183
186
|
sessionStore: import("@sema-agent/core").SessionStore<import("@sema-agent/core").SessionStoreSummary, import("@sema-agent/core").SessionListQuery>;
|
|
184
187
|
sqlEngine: import("../plugins/sql-driver.js").SqlEngineReading | undefined;
|
|
185
188
|
storePosture: import("../store-posture.js").StorePosture;
|
|
189
|
+
storeSweep: import("../plugins/store-sweep.js").StoreSweep;
|
|
186
190
|
taskAttachmentStore: import("../plugins/task-attachment-store.js").TaskAttachmentStore | undefined;
|
|
187
191
|
taskListLane: import("./task-list-lane.js").TaskListLane;
|
|
188
192
|
usageWindowStore: import("@sema-agent/core").UsageWindowStore | undefined;
|
|
193
|
+
config: import("../config-types.js").ServiceConfig;
|
|
189
194
|
ceilingVerdict: import("./unpriced-ceiling-verdict.js").UnpricedCeilingVerdict;
|
|
190
195
|
webAdmin: import("./web-admin.js").WebAdminRuntime;
|
|
191
|
-
config: import("../config-types.js").ServiceConfig;
|
|
192
196
|
localRoot: string;
|
|
193
197
|
logger: import("../index.js").Logger;
|
|
194
198
|
metrics: import("../index.js").Metrics;
|
|
@@ -32,7 +32,7 @@ import { serviceVersion } from "../service-version.js";
|
|
|
32
32
|
import { buildDisplaySafeUrl } from "../trace/redact.js";
|
|
33
33
|
import { seatText } from "../trace/exit-seat.js";
|
|
34
34
|
export async function runStage10(ctx) {
|
|
35
|
-
const { peerDesk, approvalAskAudit, approvalExemptionStore, approvalNonceStore, authorize, backend, backgroundAgentStore, brain, breakerState, centerRuntimeCapsResolver, checkpointStore, checkpointCtxSealing, parkCommits, config, webAdmin, consolidationValve, costQuota, deploymentMods, deploymentModsLoaded, deviceLane, drainState, durableEnabled, elicitation, fenceSessionOwner, fileHistoryStore, fleetBus, fleetLease, fleetUsage, governanceSeams, handslessRunner, hookAgent, hookLlm, hookWakeBus, imageBakes, imageIndex, instanceId, instrumentDegenerate, leaderEndpoint, loadedSkills, localRoot, logger, lspManager, mcpRevocations, 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, runtimeCapsPeekResolver, sandboxGitPlane, scenarioDetails, scenarios, selectEnvTool, sendFileLedger, sendUserFileEmitter, sendUserFileToolSpec, sessionAudit, sessionEnvSelection, sessionMemoryStatusFace, sessionPolicyStore, sessionTitler, sessionWatchRegistry, setSessionCwd, setSessionInheritEnv, setSessionShellEnv, 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;
|
|
35
|
+
const { peerDesk, approvalAskAudit, approvalExemptionStore, approvalNonceStore, authorize, backend, backgroundAgentStore, brain, breakerState, centerRuntimeCapsResolver, checkpointStore, checkpointCtxSealing, parkCommits, config, webAdmin, consolidationValve, costQuota, belowTaskChainPatterns, deploymentMods, deploymentModsLoaded, deviceLane, drainState, durableEnabled, elicitation, fenceSessionOwner, fileHistoryStore, fleetBus, fleetLease, fleetUsage, governanceSeams, handslessRunner, hookAgent, hookLlm, hookWakeBus, imageBakes, imageIndex, instanceId, instrumentDegenerate, leaderEndpoint, loadedSkills, localRoot, logger, lspManager, mcpRevocations, 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, runtimeCapsPeekResolver, sandboxGitPlane, scenarioDetails, scenarios, selectEnvTool, sendFileLedger, sendUserFileEmitter, sendUserFileToolSpec, sessionAudit, sessionEnvSelection, sessionMemoryStatusFace, sessionPolicyStore, sessionTitler, sessionWatchRegistry, setSessionCwd, setSessionInheritEnv, setSessionShellEnv, 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;
|
|
36
36
|
const stores = {
|
|
37
37
|
runStore,
|
|
38
38
|
resumeAnchorStore: resumeAnchorStore ? resumeAnchorStore : undefined,
|
|
@@ -85,7 +85,7 @@ export async function runStage10(ctx) {
|
|
|
85
85
|
sessionAudit,
|
|
86
86
|
routeJudgeBrain: brain,
|
|
87
87
|
purgeSession: purgeSession ? purgeSession : undefined,
|
|
88
|
-
bindSessionInheritEnv:
|
|
88
|
+
bindSessionInheritEnv: config.remoteExec.provider === "host" ? setSessionInheritEnv : undefined,
|
|
89
89
|
subagentTaskOutput: (handle, access) => backgroundAgentOutput(defaultTaskRegistry, handle, access, backgroundAgentStore),
|
|
90
90
|
taskHandleOutput: (handle, access) => taskHandleOutput(defaultTaskRegistry, handle, access, backgroundAgentStore),
|
|
91
91
|
taskHandleStop: (handle, access) => taskHandleStop(defaultTaskRegistry, handle, access, backgroundAgentStore),
|
|
@@ -174,6 +174,7 @@ export async function runStage10(ctx) {
|
|
|
174
174
|
sealedKeyPublic: webAdmin.sealedKeyPublic,
|
|
175
175
|
sandboxGitPlane,
|
|
176
176
|
deploymentModPackages: deploymentModsLoaded.length,
|
|
177
|
+
perSessionCwd,
|
|
177
178
|
instanceId,
|
|
178
179
|
capabilities: {
|
|
179
180
|
version: serviceVersion(),
|
|
@@ -195,6 +196,7 @@ export async function runStage10(ctx) {
|
|
|
195
196
|
configRefreshNow: () => webAdmin.refreshNow(),
|
|
196
197
|
webAdminManagedKeys: () => webAdmin.centerManagedKeys(),
|
|
197
198
|
drainState,
|
|
199
|
+
sessionResidentBackground,
|
|
198
200
|
servingLease: servingLease ? () => servingLease.view() : undefined,
|
|
199
201
|
storePosture,
|
|
200
202
|
centerWiring: createCenterWiringReader({ config, pullState: () => webAdmin.centerPullState(), fleetLease, usageReport: fleetUsage !== undefined }),
|
|
@@ -208,7 +210,7 @@ export async function runStage10(ctx) {
|
|
|
208
210
|
peerDesk,
|
|
209
211
|
getKeyResolver: () => webAdmin.getKeyResolver(),
|
|
210
212
|
taskAttachmentStore, perSessionCwd, setSessionCwd, setSessionShellEnv, fenceSessionOwner,
|
|
211
|
-
hookLlm, hookAgent, fleetBus, hookWakeBus, resumeAnchorStore, ownerAware, taskLimitCaps, taskTimeoutSec,
|
|
213
|
+
hookLlm, hookAgent, belowTaskChainPatterns, fleetBus, hookWakeBus, resumeAnchorStore, ownerAware, taskLimitCaps, taskTimeoutSec,
|
|
212
214
|
selectEnvTool, sendUserFileToolSpec, memoryEngine, memorySyncRunner, durableEnabled, approvalExemptionStore,
|
|
213
215
|
checkpointStore, imageIndex, perTaskImage,
|
|
214
216
|
sessionEnvSelection,
|
package/dist/boot/stores.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { sessionBoxMountVerdict } from "@sema-agent/core";
|
|
1
2
|
import type { ServiceConfig } from "../config.js";
|
|
2
3
|
import { type MemorySyncRunner } from "../memory-sync-client.js";
|
|
3
4
|
import type { Logger } from "../observability/logger.js";
|
|
@@ -20,6 +21,14 @@ export interface OpenStoresCtx {
|
|
|
20
21
|
* 不在这里手抄一份,也不在别处再求一遍(手抄的判据会漂,漂的方向要么是拒启误伤、要么是该拒不拒;再求一遍的 park 设施位手上没有那只店)。本函数只做探:有 SQL 池就探,local 后端无池则无事。
|
|
21
22
|
*/
|
|
22
23
|
export declare function assertApprovalAskRuleMaterialOnBackend(backend: StoreBackend | undefined): Promise<void>;
|
|
24
|
+
/**
|
|
25
|
+
* 起服报告 `session_box_mount` 那一行(纯数据):引擎会话盒挂载判官的判决 → 级别与键集,唯一一处。挂得上 ⇒ info `{ peerLaneMountable: true }`;
|
|
26
|
+
* 挂不上 ⇒ warn `{ peerLaneMountable: false, peerLaneRefusal: <引擎的码>, reason: <引擎的句> }`。{@link openStores} 对本部署装的那一对店问一次、按它落行。
|
|
27
|
+
*/
|
|
28
|
+
export declare function buildSessionBoxMountLine(verdict: ReturnType<typeof sessionBoxMountVerdict>): {
|
|
29
|
+
readonly level: "info" | "warn";
|
|
30
|
+
readonly fields: Readonly<Record<string, unknown>>;
|
|
31
|
+
};
|
|
23
32
|
export declare function openStores(ctx: OpenStoresCtx): Promise<{
|
|
24
33
|
backend: StoreBackend | undefined;
|
|
25
34
|
storePosture: import("../store-posture.js").StorePosture;
|
|
@@ -43,5 +52,6 @@ export declare function openStores(ctx: OpenStoresCtx): Promise<{
|
|
|
43
52
|
taskListLane: import("./task-list-lane.js").TaskListLane;
|
|
44
53
|
sqlEngine: import("../plugins/sql-driver.js").SqlEngineReading | undefined;
|
|
45
54
|
sessionCaptureRecords: import("../plugins/store-backend.js").SessionCaptureRecordSource | undefined;
|
|
55
|
+
storeSweep: import("../plugins/store-sweep.js").StoreSweep;
|
|
46
56
|
}>;
|
|
47
57
|
//# sourceMappingURL=stores.d.ts.map
|
package/dist/boot/stores.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { join } from "node:path";
|
|
2
|
-
import { FileBackgroundAgentStore, FileMailboxStore, FileRosterStore, InMemoryUsageWindowStore,
|
|
2
|
+
import { FileBackgroundAgentStore, FileMailboxStore, FileRosterStore, InMemoryUsageWindowStore, sessionBoxMountVerdict } from "@sema-agent/core";
|
|
3
3
|
import { createCorruptReadFailOpenSeat } from "../observability/corrupt-read-seat.js";
|
|
4
4
|
import { startMemorySyncRunner } from "../memory-sync-client.js";
|
|
5
|
+
import { errorCodeOf, errorKindOf } from "../observability/err-text.js";
|
|
5
6
|
import { memoryEmbedderFor } from "../plugins/memory-embedder.js";
|
|
6
7
|
import { ensurePgMemoryEmbedderMetaSchema, reconcileEmbedderFingerprint } from "../plugins/memory-embedder-fingerprint.js";
|
|
7
8
|
import { PgMemoryEngineBackend, ensurePgMemoryEngineSchema } from "../plugins/memory-engine-pg.js";
|
|
@@ -11,38 +12,39 @@ import { TiDBMemoryHistoryStore, TiDBMemorySyncStore, ensureTiDBMemoryHistorySch
|
|
|
11
12
|
import { MinioBlobBackend } from "../plugins/blob-backend.js";
|
|
12
13
|
import { ensureSnapshotBuckets } from "../plugins/snapshot-bucket-presence.js";
|
|
13
14
|
import { PgBackgroundAgentStore, TiDBBackgroundAgentStore, ensurePgBackgroundAgentSchema, ensureTiDBBackgroundAgentSchema } from "../stores-sql/background-agent-store-sql.js";
|
|
14
|
-
import { PgMailboxStore, TiDBMailboxStore, ensurePgMailboxSchema, ensureTiDBMailboxSchema } from "../
|
|
15
|
+
import { PgMailboxStore, TiDBMailboxStore, ensurePgMailboxSchema, ensureTiDBMailboxSchema } from "../stores-sql/mailbox-store-sql.js";
|
|
15
16
|
import { recipientLifecycleOf } from "../plugins/mailbox-recipient-lifecycle.js";
|
|
16
17
|
import { PgUsageWindowStore, TiDBUsageWindowStore, ensurePgUsageWindowSchema, ensureTiDBUsageWindowSchema } from "../stores-sql/usage-window-store-sql.js";
|
|
17
|
-
import { PgRosterStore, TiDBRosterStore, ensurePgRosterSchema, ensureTiDBRosterSchema } from "../
|
|
18
|
+
import { PgRosterStore, TiDBRosterStore, ensurePgRosterSchema, ensureTiDBRosterSchema } from "../stores-sql/roster-store-sql.js";
|
|
18
19
|
import { LocalTaskAttachmentStore } from "../plugins/local-task-attachment-store.js";
|
|
19
20
|
import { PgTaskAttachmentStore, TiDBTaskAttachmentStore, ensurePgTaskAttachmentSchema, ensureTiDBTaskAttachmentSchema } from "../plugins/task-attachment-store.js";
|
|
20
21
|
import { createSessionStore } from "../plugins/session-store.js";
|
|
21
22
|
import { buildSqlPoolMissingRefusal, missingSqlCoordinateKeys } from "../sql-engine-coordinates.js";
|
|
22
|
-
import { runApprovalBatchKindlessCensus } from "../approval-batch-census.js";
|
|
23
23
|
import { runAndLogOneTimeMigrations } from "../plugins/one-time-migrations.js";
|
|
24
24
|
import { createTaskListLane } from "./task-list-lane.js";
|
|
25
25
|
import { ensurePgTaskListSchema, ensureTiDBTaskListSchema } from "../plugins/task-list-store-sql.js";
|
|
26
26
|
import { assertDeviceAuditRebindEventSchema, ensurePgDeviceSchema, ensureTiDBDeviceSchema } from "../plugins/device-store-sql.js";
|
|
27
27
|
import { mysqlDriver, pgDriver } from "../plugins/sql-driver.js";
|
|
28
|
-
import { assertCloudSnapshotBlobPosture, openStoreBackendWithFallback } from "../plugins/store-backend.js";
|
|
28
|
+
import { assertCloudSnapshotBlobPosture, openStoreBackendWithFallback, workflowJournalOf } from "../plugins/store-backend.js";
|
|
29
29
|
import { createMemoryEngineIncidentSink } from "../memory-incident-sink.js";
|
|
30
30
|
import { announceLockedLegacyMemoryLayers } from "../memory-layer-legacy-lock.js";
|
|
31
31
|
import { createEngineNoticeForwarder } from "./runner-deps.js";
|
|
32
|
-
import { buildMemoryRemoteLaneWarn, memoryEngineBackendFor, memoryEngineRemoteLanePosture, memoryEngineRootFor, memoryMountRootOf } from "../memory-scope.js";
|
|
32
|
+
import { buildMemoryRemoteLaneWarn, canonicalPathOf, judgeMemoryRootOutsideDataRoot, memoryEngineBackendFor, memoryEngineRemoteLanePosture, memoryEngineRootFor, memoryMountRootOf } from "../memory-scope.js";
|
|
33
33
|
import { createMemoryScopeStores } from "../memory-scope-stores.js";
|
|
34
|
-
import { assertToolResultProvenanceSchema } from "../
|
|
34
|
+
import { assertToolResultProvenanceSchema } from "../stores-sql/tool-result-store-sql.js";
|
|
35
35
|
import { assertPermissionRuleApprovalSchema, assertPermissionRuleTicketSchema } from "../plugins/permission-rule-store-sql.js";
|
|
36
36
|
import { assertApprovalAskRuleMaterialSchema } from "../plugins/approval-ask-store-sql.js";
|
|
37
37
|
import { assertSchemaMatchesCode } from "../plugins/schema-consistency.js";
|
|
38
|
-
import {
|
|
39
|
-
import {
|
|
38
|
+
import { assertSessionExtCascadeOn } from "../plugins/session-ext-table.js";
|
|
39
|
+
import { SqlCheckpointStore, assertCheckpointColumnSchema } from "../stores-sql/checkpoint-store-sql.js";
|
|
40
|
+
import { assertFileHistorySchema } from "../stores-sql/file-history-store-sql.js";
|
|
40
41
|
import { buildMemoryBoundaryLaneFacts, buildMemoryWriteBoundaryAudit } from "./memory-boundary.js";
|
|
41
42
|
import { buildMemoryPosture } from "../memory-posture.js";
|
|
42
43
|
import { headReadOf } from "../session-incarnation.js";
|
|
43
44
|
import { establishSqlEnginePosture, sqlPoolsOf } from "../sql-engine-posture.js";
|
|
44
45
|
import { buildStorePosture } from "../store-posture.js";
|
|
45
46
|
import { seatText } from "../trace/exit-seat.js";
|
|
47
|
+
import { buildStoreSweepBounds, createJournalSweepLeg, createStoreSweep } from "../plugins/store-sweep.js";
|
|
46
48
|
const DARK_REASON_PROSE = {
|
|
47
49
|
engine_off: () => "MEMORY_ENGINE=off",
|
|
48
50
|
multi_tenant_file_backend: () => "multi-tenant on the FILE backend (no tenant isolation; set MEMORY_ENGINE_BACKEND=pg|mysql to light up)",
|
|
@@ -56,6 +58,11 @@ export async function assertApprovalAskRuleMaterialOnBackend(backend) {
|
|
|
56
58
|
else if (mysqlPool)
|
|
57
59
|
await assertApprovalAskRuleMaterialSchema(async (sql) => ({ rows: (await mysqlPool.query(sql))[0] }), "mysql");
|
|
58
60
|
}
|
|
61
|
+
export function buildSessionBoxMountLine(verdict) {
|
|
62
|
+
return verdict.ok
|
|
63
|
+
? { level: "info", fields: { peerLaneMountable: true } }
|
|
64
|
+
: { level: "warn", fields: { peerLaneMountable: false, peerLaneRefusal: verdict.code, reason: verdict.reason } };
|
|
65
|
+
}
|
|
59
66
|
export async function openStores(ctx) {
|
|
60
67
|
const { config, logger, metrics, localRoot } = ctx;
|
|
61
68
|
let backend;
|
|
@@ -97,13 +104,13 @@ export async function openStores(ctx) {
|
|
|
97
104
|
await assertFileHistorySchema(async (sql) => ({ rows: (await pgPool.query(sql)).rows }), "pg");
|
|
98
105
|
else if (mysqlPool)
|
|
99
106
|
await assertFileHistorySchema(async (sql) => ({ rows: (await mysqlPool.query(sql))[0] }), "mysql");
|
|
107
|
+
if (pgPool)
|
|
108
|
+
await assertSessionExtCascadeOn(pgDriver(pgPool));
|
|
109
|
+
else if (mysqlPool)
|
|
110
|
+
await assertSessionExtCascadeOn(mysqlDriver(mysqlPool));
|
|
100
111
|
}
|
|
101
112
|
if (backend)
|
|
102
113
|
await runAndLogOneTimeMigrations(logger, backend);
|
|
103
|
-
{
|
|
104
|
-
const censusStore = backend !== undefined && backend.kind !== "local" ? backend.checkpoint?.() : undefined;
|
|
105
|
-
void runApprovalBatchKindlessCensus(censusStore instanceof SqlCheckpointStore ? censusStore : undefined, logger);
|
|
106
|
-
}
|
|
107
114
|
if ((process.env.REWIND_SNAPSHOT_MAX_MB ?? "") !== "") {
|
|
108
115
|
logger.warn("rewind_snapshot_max_mb_retired", {
|
|
109
116
|
note: "REWIND_SNAPSHOT_MAX_MB no longer has an effect: the whole-tree snapshot epoch is retired (S-15); per-edited-file history captures only files the agent touches, with no tree walk and no size gate. Remove the env var. Per-blob SQL sizing is governed by SNAPSHOT_BLOB_SQL_MAX_BYTES / object storage as before.",
|
|
@@ -162,7 +169,7 @@ export async function openStores(ctx) {
|
|
|
162
169
|
});
|
|
163
170
|
if (embedder !== undefined && config.memoryEmbedder !== undefined) {
|
|
164
171
|
await ensurePgMemoryEmbedderMetaSchema(q);
|
|
165
|
-
await reconcileEmbedderFingerprint(q, { model: config.memoryEmbedder.model, dimensions: config.memoryEmbedder.dimensions }, { log: logger });
|
|
172
|
+
await reconcileEmbedderFingerprint(q, { model: config.memoryEmbedder.model, dimensions: config.memoryEmbedder.dimensions }, { log: logger, reembedConfirmed: config.memoryEmbedder.reembedConfirmed === true });
|
|
166
173
|
}
|
|
167
174
|
else {
|
|
168
175
|
logger.info("memory_embedder_identity_absent", {
|
|
@@ -204,11 +211,15 @@ export async function openStores(ctx) {
|
|
|
204
211
|
memoryEngine = fileEngine !== undefined ? scopeStoresOver(fileEngine.backend) : undefined;
|
|
205
212
|
if (memoryEngine)
|
|
206
213
|
announceLockedLegacyMemoryLayers(memoryMountRootOf(memoryEngine.backend, memoryEngine.root), createEngineNoticeForwarder(logger));
|
|
207
|
-
if (memoryEngine
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
214
|
+
if (memoryEngine) {
|
|
215
|
+
try {
|
|
216
|
+
const outside = judgeMemoryRootOutsideDataRoot({ memoryRoot: memoryEngine.root, dataRoot: config.localDataRoot, canonical: canonicalPathOf });
|
|
217
|
+
if (outside)
|
|
218
|
+
logger.warn("memory_engine_dir_outside_data_root", outside);
|
|
219
|
+
}
|
|
220
|
+
catch (err) {
|
|
221
|
+
logger.warn("memory_engine_dir_check_unavailable", { root: memoryEngine.root, dataRoot: config.localDataRoot, errorKind: errorKindOf(err), errorCode: errorCodeOf(err) });
|
|
222
|
+
}
|
|
212
223
|
}
|
|
213
224
|
}
|
|
214
225
|
{
|
|
@@ -224,17 +235,22 @@ export async function openStores(ctx) {
|
|
|
224
235
|
logger.warn(w.tag, { detail: w.detail, lane: laneFacts.lane, root: memoryMountRoot ?? null });
|
|
225
236
|
}
|
|
226
237
|
let rosterStore;
|
|
238
|
+
let rosterAged;
|
|
227
239
|
{
|
|
228
240
|
const mysqlPool = backend?.mysqlPool?.();
|
|
229
241
|
const pgPool = backend?.pgPool?.();
|
|
230
242
|
if (pgPool) {
|
|
231
243
|
const q = async (text, params) => { const r = await pgPool.query(text, params); return { rows: r.rows }; };
|
|
232
244
|
await ensurePgRosterSchema(q);
|
|
233
|
-
|
|
245
|
+
const store = new PgRosterStore(q);
|
|
246
|
+
rosterStore = store;
|
|
247
|
+
rosterAged = (nowMs, { maxAgeMs }) => store.reapOlderThan(nowMs - maxAgeMs);
|
|
234
248
|
}
|
|
235
249
|
else if (mysqlPool) {
|
|
236
250
|
await ensureTiDBRosterSchema(mysqlPool);
|
|
237
|
-
|
|
251
|
+
const store = new TiDBRosterStore(mysqlPool);
|
|
252
|
+
rosterStore = store;
|
|
253
|
+
rosterAged = (nowMs, { maxAgeMs }) => store.reapOlderThan(nowMs - maxAgeMs);
|
|
238
254
|
}
|
|
239
255
|
else if (backend?.kind === "local") {
|
|
240
256
|
rosterStore = new FileRosterStore(join(config.localDataRoot ?? localRoot, "roster.json"), {
|
|
@@ -316,13 +332,10 @@ export async function openStores(ctx) {
|
|
|
316
332
|
if (mailboxStore)
|
|
317
333
|
mailboxRecipientLifecycle = recipientLifecycleOf(mailboxStore);
|
|
318
334
|
if (mailboxStore) {
|
|
319
|
-
const laneVerdict = mailboxCrossProcessMountVerdict(mailboxStore);
|
|
320
335
|
logger.info("mailbox_store_enabled", {
|
|
321
336
|
backend: pgPool ? "pg" : mysqlPool ? "mysql" : "file",
|
|
322
337
|
crossProcessSafe: mailboxStore.crossProcessSafe,
|
|
323
338
|
recipientTombstones: pgPool !== undefined || mysqlPool !== undefined,
|
|
324
|
-
peerLaneMountable: laneVerdict.ok,
|
|
325
|
-
...(laneVerdict.ok ? {} : { peerLaneRefusal: laneVerdict.code }),
|
|
326
339
|
});
|
|
327
340
|
}
|
|
328
341
|
}
|
|
@@ -391,7 +404,7 @@ export async function openStores(ctx) {
|
|
|
391
404
|
await ensurePgDeviceSchema(async (text, params) => pgPool.query(text, params));
|
|
392
405
|
if (mysqlPool)
|
|
393
406
|
await ensureTiDBDeviceSchema(mysqlPool);
|
|
394
|
-
if (config.remoteExec
|
|
407
|
+
if (config.remoteExec.provider === "device") {
|
|
395
408
|
if (pgPool)
|
|
396
409
|
await assertDeviceAuditRebindEventSchema(pgDriver(pgPool));
|
|
397
410
|
else if (mysqlPool)
|
|
@@ -423,6 +436,10 @@ export async function openStores(ctx) {
|
|
|
423
436
|
});
|
|
424
437
|
}
|
|
425
438
|
metrics.dynamicGauge("sessions_warm", "Sessions held in the warm cache", () => sessionStore.size);
|
|
439
|
+
if (mailboxStore !== undefined) {
|
|
440
|
+
const line = buildSessionBoxMountLine(sessionBoxMountVerdict(mailboxStore, sessionStore));
|
|
441
|
+
logger[line.level]("session_box_mount", line.fields);
|
|
442
|
+
}
|
|
426
443
|
const breakerState = backend?.breaker && config.resilience.circuitBreaker
|
|
427
444
|
? backend
|
|
428
445
|
.breaker((streak) => {
|
|
@@ -436,10 +453,20 @@ export async function openStores(ctx) {
|
|
|
436
453
|
})
|
|
437
454
|
.startRefresh()
|
|
438
455
|
: undefined;
|
|
456
|
+
const toolResultsForSweep = backend?.toolResult?.();
|
|
457
|
+
const journalForSweep = workflowJournalOf(config, backend);
|
|
458
|
+
const storeSweep = createStoreSweep({
|
|
459
|
+
legs: {
|
|
460
|
+
"roster-aged": rosterAged,
|
|
461
|
+
"tool-results-aged": toolResultsForSweep?.reap?.bind(toolResultsForSweep),
|
|
462
|
+
"workflow-journal-expired": createJournalSweepLeg(journalForSweep),
|
|
463
|
+
},
|
|
464
|
+
bounds: () => buildStoreSweepBounds(config),
|
|
465
|
+
});
|
|
439
466
|
return {
|
|
440
467
|
backend, storePosture, memoryEngine, engineDataRoot, memorySyncCursors, rosterStore, backgroundAgentStore, mailboxRecipientLifecycle,
|
|
441
468
|
taskAttachmentStore, mailboxStore, memoryExportStores, memorySyncRunner, sessionStore, breakerState,
|
|
442
|
-
usageWindowStore, memoryPosture, taskListLane, sqlEngine, sessionCaptureRecords,
|
|
469
|
+
usageWindowStore, memoryPosture, taskListLane, sqlEngine, sessionCaptureRecords, storeSweep,
|
|
443
470
|
};
|
|
444
471
|
}
|
|
445
472
|
//# sourceMappingURL=stores.js.map
|
package/dist/boot/web-admin.js
CHANGED
|
@@ -7,7 +7,7 @@ import { stableStringify } from "@sema-agent/settings-schema/hash";
|
|
|
7
7
|
import { buildModelRefusalsSignal } from "../model-entry-refusal.js";
|
|
8
8
|
import { CenterPromptSource, FilePromptArtifactStore, FilePromptSourceStateStore, MemoryPromptArtifactStore, MemoryPromptSourceStateStore, } from "@sema-agent/core";
|
|
9
9
|
import { buildPricing } from "../budget.js";
|
|
10
|
-
import { applyCenterPlugins } from "../capabilities/center-plugins.js";
|
|
10
|
+
import { applyCenterPlugins, pluginCacheRootFor } from "../capabilities/center-plugins.js";
|
|
11
11
|
import { applyCenterArtifact, centerSourceOnError, withPromptArtifactBackfill } from "../capabilities/center-prompts.js";
|
|
12
12
|
import { centerScenarios, centerScenarioDetails } from "../capabilities/scenarios.js";
|
|
13
13
|
import { isRosterGateArmed } from "../config.js";
|
|
@@ -213,7 +213,7 @@ export async function createWebAdminRuntime(ctx) {
|
|
|
213
213
|
const domains = verdict.domains.join(",");
|
|
214
214
|
if (candidateRejection?.version === r.effective.version && candidateRejection.domains.join(",") === domains)
|
|
215
215
|
return;
|
|
216
|
-
admitArrival(ordinal, candidateRejectionOf(r, verdict, candidateSource().kind, Date.now()));
|
|
216
|
+
admitArrival(ordinal, candidateRejectionOf(r, verdict, candidateSource().kind, Date.now(), localDirField.dir));
|
|
217
217
|
logger.warn("config_candidate_rejected", buildCandidateRejectedFields(r, verdict, leg, { lkgVersion: latestEffective?.version ?? "(env)", ...localDirField }));
|
|
218
218
|
};
|
|
219
219
|
const noteSourceAtApplied = () => {
|
|
@@ -776,7 +776,7 @@ export async function createWebAdminRuntime(ctx) {
|
|
|
776
776
|
skills = await applySkillsManifest(skills, effective.skills, candidateSource(), logger);
|
|
777
777
|
if (effective?.plugins !== undefined) {
|
|
778
778
|
const pluginOut = await applyCenterPlugins(skills, effective, {
|
|
779
|
-
cacheRoot:
|
|
779
|
+
cacheRoot: pluginCacheRootFor(config.localDataRoot ?? join(homedir(), ".ai-agent")),
|
|
780
780
|
allowHosts: config.pluginsAllowHosts,
|
|
781
781
|
toolsShareThisFilesystem: DEPLOYMENT_SHAPE_PREDICATES.toolsOnThisHost.holds(config),
|
|
782
782
|
logger,
|
|
@@ -22,7 +22,7 @@ import { type WorkflowCompletionInbox } from "../orchestration/workflow-completi
|
|
|
22
22
|
import { JournalingWorkflowRunStore, WorkflowNotifyGate, type WorkflowCompletionPayload } from "../orchestration/workflow-notify-journal.js";
|
|
23
23
|
import { SubagentSteerRegistry } from "../orchestration/subagent-steer.js";
|
|
24
24
|
import { WorkflowAgentRegistry } from "../orchestration/workflow-agent-steer.js";
|
|
25
|
-
import type
|
|
25
|
+
import { type StoreBackend } from "../plugins/store-backend.js";
|
|
26
26
|
export interface WorkflowOrchestrationCtx {
|
|
27
27
|
config: ServiceConfig;
|
|
28
28
|
logger: Logger;
|
|
@@ -7,6 +7,7 @@ import { FileWorkflowCompletionInbox, InMemoryWorkflowCompletionInbox, buildWork
|
|
|
7
7
|
import { FileWorkflowNotifyJournalStore, JournalingWorkflowRunStore, WorkflowNotifyGate } from "../orchestration/workflow-notify-journal.js";
|
|
8
8
|
import { SubagentSteerRegistry } from "../orchestration/subagent-steer.js";
|
|
9
9
|
import { WorkflowAgentRegistry } from "../orchestration/workflow-agent-steer.js";
|
|
10
|
+
import { workflowJournalOf } from "../plugins/store-backend.js";
|
|
10
11
|
import { seatText } from "../trace/exit-seat.js";
|
|
11
12
|
export function createWorkflowOrchestration(ctx) {
|
|
12
13
|
const { config, logger, metrics, localRoot, backend, getRunStore } = ctx;
|
|
@@ -70,7 +71,7 @@ export function createWorkflowOrchestration(ctx) {
|
|
|
70
71
|
...(replicaLocalNotifyJournal ? { finalizeStartedBeforeMs: workflowBootAtMs } : {}),
|
|
71
72
|
...(workflowRunStore ? { publishTerminalFleetRow: (id, run) => workflowRunStore.republishFleet(id, run) } : {}),
|
|
72
73
|
};
|
|
73
|
-
const workflowJournalStore = config
|
|
74
|
+
const workflowJournalStore = workflowJournalOf(config, backend);
|
|
74
75
|
const outcomeSink = backend?.outcomeSink();
|
|
75
76
|
const workflowAgentRegistry = config.selfOrchestrationEnabled ? new WorkflowAgentRegistry() : undefined;
|
|
76
77
|
const subagentSteerRegistry = new SubagentSteerRegistry();
|
|
@@ -97,6 +97,8 @@ export declare function materializablePlugins(eff: {
|
|
|
97
97
|
url: string;
|
|
98
98
|
sha?: string;
|
|
99
99
|
}>;
|
|
100
|
+
/** 中心 plugin 缓存根 `<数据根>/plugin-cache`(组合根传给 {@link applyCenterPlugins} 的 `cacheRoot` 与一次性迁移 M39 的名册同读这一只)。 */
|
|
101
|
+
export declare function pluginCacheRootFor(dataRoot: string): string;
|
|
100
102
|
/** 总入口(条款 3/7/8):逐条物化 + 装载 + 让位合并。materialize 盘位 = `<cacheRoot>/<name>/live`
|
|
101
103
|
* (成功后原子 rename 替换,失败保留旧盘位 = LKG)。 */
|
|
102
104
|
export declare function applyCenterPlugins(baseline: LoadedSkill[], eff: {
|
|
@@ -2,6 +2,7 @@ import { execFile } from "node:child_process";
|
|
|
2
2
|
import { promisify } from "node:util";
|
|
3
3
|
import { promises as fsp, realpathSync, existsSync, readFileSync, lstatSync, statSync } from "node:fs";
|
|
4
4
|
import { join, resolve, isAbsolute, sep } from "node:path";
|
|
5
|
+
import { ensureDir } from "@sema-agent/core";
|
|
5
6
|
import { assertConfined, loadSkills } from "./skills.js";
|
|
6
7
|
import { buildDisplaySafeUrl, redactSecrets } from "../trace/redact.js";
|
|
7
8
|
import { gitSubprocessEnv } from "../server-secret-env.js";
|
|
@@ -132,6 +133,9 @@ export function materializablePlugins(eff, allowHosts) {
|
|
|
132
133
|
return v.ok ? [{ name: v.name, url: v.url, ...(v.sha !== undefined ? { sha: v.sha } : {}) }] : [];
|
|
133
134
|
});
|
|
134
135
|
}
|
|
136
|
+
export function pluginCacheRootFor(dataRoot) {
|
|
137
|
+
return join(dataRoot, "plugin-cache");
|
|
138
|
+
}
|
|
135
139
|
export async function applyCenterPlugins(baseline, eff, opts) {
|
|
136
140
|
const shape = declaredPlugins(eff);
|
|
137
141
|
const out = { skills: [...baseline], failures: [], letGo: [], lkgUsed: [] };
|
|
@@ -165,12 +169,12 @@ export async function applyCenterPlugins(baseline, eff, opts) {
|
|
|
165
169
|
let materialized = false;
|
|
166
170
|
try {
|
|
167
171
|
await fsp.rm(staging, { recursive: true, force: true });
|
|
168
|
-
|
|
172
|
+
ensureDir(staging);
|
|
169
173
|
const plan = gitClonePlan({ url: v.url, dest: staging, sha: v.sha });
|
|
170
174
|
for (const step of plan.steps)
|
|
171
175
|
await runGit(step);
|
|
172
176
|
await fsp.rm(liveDir, { recursive: true, force: true });
|
|
173
|
-
|
|
177
|
+
ensureDir(join(opts.cacheRoot, v.name));
|
|
174
178
|
await fsp.rename(staging, liveDir);
|
|
175
179
|
materialized = true;
|
|
176
180
|
}
|
|
@@ -45,8 +45,9 @@ export declare const COMPOSITE_CAPABILITY_MEMBERS: {
|
|
|
45
45
|
readonly centerWiring: readonly ["effectivePull", "effectiveRevision", "lease", "leaseHealth", "failMode", "usageReport", "issuer", "worker", "caller"];
|
|
46
46
|
readonly webSearch: readonly ["backend"];
|
|
47
47
|
readonly background: readonly ["listFace", "exitFaces"];
|
|
48
|
-
readonly taskSettings: readonly ["permissions", "permissionMode", "model", "outputStyle", "env", "hooks", "pluginHooks", "managedHookGroups", "httpHookAllowlists", "tightenOnlySeats", "approvalFrameFamilies"];
|
|
48
|
+
readonly taskSettings: readonly ["permissions", "permissionMode", "model", "outputStyle", "env", "hooks", "pluginHooks", "managedHookGroups", "httpHookAllowlists", "tightenOnlySeats", "approvalFrameFamilies", "autoCompactEnabled"];
|
|
49
49
|
readonly settings: readonly ["permissions"];
|
|
50
|
+
readonly settingsContract: readonly ["version", "hookEntryFields"];
|
|
50
51
|
readonly permissionModeAuto: readonly ["accepted", "classifierSeat", "entitlementSource", "armed", "reason", "model"];
|
|
51
52
|
readonly writeProtection: readonly ["armed", "rows", "replaced"];
|
|
52
53
|
readonly executionLane: readonly ["provider", "toolsOnThisHost", "isolated"];
|
|
@@ -57,6 +58,8 @@ export declare const COMPOSITE_CAPABILITY_MEMBERS: {
|
|
|
57
58
|
readonly userAttachments: readonly ["entries", "kinds", "supplies", "limits"];
|
|
58
59
|
readonly credentialPlane: readonly ["sandboxGit"];
|
|
59
60
|
readonly memorySyncServe: readonly ["identity"];
|
|
61
|
+
readonly adoptionImport: readonly ["adoptionId", "maxSessions", "maxSessionBytes"];
|
|
62
|
+
readonly engine: readonly ["handover"];
|
|
60
63
|
};
|
|
61
64
|
type CompositeTable = typeof COMPOSITE_CAPABILITY_MEMBERS;
|
|
62
65
|
/** 值的**具名成员对象臂**(标量 / 字面词 / `false` / `null` / `undefined` / 数组 / 函数臂剥掉)。 */
|
|
@@ -6,8 +6,9 @@ export const COMPOSITE_CAPABILITY_MEMBERS = {
|
|
|
6
6
|
centerWiring: ["effectivePull", "effectiveRevision", "lease", "leaseHealth", "failMode", "usageReport", "issuer", "worker", "caller"],
|
|
7
7
|
webSearch: ["backend"],
|
|
8
8
|
background: ["listFace", "exitFaces"],
|
|
9
|
-
taskSettings: ["permissions", "permissionMode", "model", "outputStyle", "env", "hooks", "pluginHooks", "managedHookGroups", "httpHookAllowlists", "tightenOnlySeats", "approvalFrameFamilies"],
|
|
9
|
+
taskSettings: ["permissions", "permissionMode", "model", "outputStyle", "env", "hooks", "pluginHooks", "managedHookGroups", "httpHookAllowlists", "tightenOnlySeats", "approvalFrameFamilies", "autoCompactEnabled"],
|
|
10
10
|
settings: ["permissions"],
|
|
11
|
+
settingsContract: ["version", "hookEntryFields"],
|
|
11
12
|
permissionModeAuto: ["accepted", "classifierSeat", "entitlementSource", "armed", "reason", "model"],
|
|
12
13
|
writeProtection: ["armed", "rows", "replaced"],
|
|
13
14
|
executionLane: ["provider", "toolsOnThisHost", "isolated"],
|
|
@@ -18,6 +19,8 @@ export const COMPOSITE_CAPABILITY_MEMBERS = {
|
|
|
18
19
|
userAttachments: ["entries", "kinds", "supplies", "limits"],
|
|
19
20
|
credentialPlane: ["sandboxGit"],
|
|
20
21
|
memorySyncServe: ["identity"],
|
|
22
|
+
adoptionImport: ["adoptionId", "maxSessions", "maxSessionBytes"],
|
|
23
|
+
engine: ["handover"],
|
|
21
24
|
};
|
|
22
25
|
export function gateCompositeMembers(body) {
|
|
23
26
|
return body;
|