@sema-agent/server 7.146.0 → 7.148.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/MIGRATION.md +1423 -24
- package/README.md +21 -8
- package/README.zh-CN.md +15 -9
- package/USAGE.md +537 -216
- package/deploy/facts/lanes.json +7 -0
- package/deploy/sema-up/README.md +18 -7
- package/deploy/sema-up/chart/templates/NOTES.txt +1 -1
- package/deploy/sema-up/chart/templates/_helpers.tpl +42 -4
- package/deploy/sema-up/chart/templates/server-v4pro.yaml +5 -4
- package/deploy/sema-up/chart/templates/server.yaml +5 -4
- package/deploy/sema-up/chart/values.yaml +4 -3
- package/deploy/sema-up/cluster-up.sh +75 -176
- package/deploy/sema-up/kube-up.sh +29 -49
- package/deploy/sema-up/lib/chart-run.sh +23 -0
- package/deploy/sema-up/lib/dataroot.sh +3 -3
- package/deploy/sema-up/lib/flagshape.sh +4 -0
- package/deploy/sema-up/lib/health.sh +62 -13
- package/deploy/sema-up/lib/helm-values-cluster.py +18 -0
- package/deploy/sema-up/lib/helm-values-kube.py +35 -0
- package/deploy/sema-up/lib/lanes.json +2 -5
- package/deploy/sema-up/lib/regcred.py +8 -0
- package/deploy/sema-up/lib/remote/helm-install.sh +3 -0
- package/deploy/sema-up/lib/remote/image-import.sh +6 -0
- package/deploy/sema-up/lib/remote/machine-precheck.sh +11 -0
- package/deploy/sema-up/lib/remote/region-probe.sh +3 -0
- package/deploy/sema-up/lib/remote/stack-ready.sh +26 -0
- package/deploy/sema-up/lib/remote/vxlan-guard.sh +8 -0
- package/deploy/sema-up/lib/render-stack.py +17 -0
- package/deploy/sema-up/lib/shell-text.sh +87 -0
- package/deploy/sema-up/lib/usage-flags.txt +10 -0
- package/deploy/sema-up/lib/usage-head.txt +1 -0
- package/deploy/sema-up/lib/usage-tail.txt +13 -0
- package/deploy/sema-up/preflight.sh +10 -8
- package/deploy/sema-up/sema-up.sh +26 -48
- package/deploy/sema-up/smoke.sh +7 -6
- package/deploy/sema-up/stack/compose.dataroot.yaml +3 -0
- package/deploy/sema-up/stack/compose.yaml +18 -5
- package/deploy/sema-up/stack/sema-stack-cluster.yaml +25 -3
- package/dist/adoption/plan.d.ts +24 -0
- package/dist/adoption/plan.js +53 -1
- package/dist/adoption/runner.d.ts +10 -1
- package/dist/adoption/runner.js +36 -16
- package/dist/adoption/wire.d.ts +3 -3
- package/dist/approval-card.d.ts +32 -34
- package/dist/approval-gate-currency.js +3 -2
- package/dist/approval-reconciler.d.ts +4 -13
- package/dist/approval-reconciler.js +2 -2
- package/dist/approval.d.ts +16 -14
- package/dist/approval.js +3 -3
- package/dist/audit.d.ts +10 -3
- package/dist/audit.js +17 -9
- package/dist/auth-bridge.d.ts +0 -14
- package/dist/auth-bridge.js +0 -7
- package/dist/auto-mode-face.d.ts +10 -7
- package/dist/auto-mode-face.js +7 -4
- package/dist/background-agent-name.d.ts +19 -1
- package/dist/background-agent-name.js +12 -2
- package/dist/background-session-reap.d.ts +1 -1
- package/dist/bake-runner/main.js +9 -6
- package/dist/bench/s1/arms.js +6 -5
- package/dist/bench/s1/live-deps.js +8 -3
- package/dist/bench/s1/run-firm.js +6 -5
- package/dist/bind-host.d.ts +25 -0
- package/dist/bind-host.js +25 -0
- package/dist/boot/adoption.d.ts +3 -0
- package/dist/boot/adoption.js +1 -0
- package/dist/boot/crash-last.js +2 -1
- package/dist/boot/deployment-mods.d.ts +1 -1
- package/dist/boot/device-lane.js +5 -5
- package/dist/boot/engine-lease.d.ts +12 -11
- package/dist/boot/execution-env.d.ts +19 -8
- package/dist/boot/execution-env.js +80 -62
- package/dist/boot/execution-lane.d.ts +37 -9
- package/dist/boot/execution-lane.js +74 -20
- package/dist/boot/exit-boundary.d.ts +3 -3
- package/dist/boot/exit-boundary.js +6 -5
- package/dist/boot/exit-last.js +2 -1
- package/dist/boot/fatal-exit.d.ts +3 -5
- package/dist/boot/fatal-exit.js +2 -2
- package/dist/boot/governance-seams.d.ts +2 -2
- package/dist/boot/leader.d.ts +15 -0
- package/dist/boot/leader.js +18 -16
- package/dist/boot/memory-boundary.d.ts +11 -11
- package/dist/boot/memory-boundary.js +3 -3
- package/dist/boot/memory-consolidation.d.ts +50 -53
- package/dist/boot/memory-consolidation.js +11 -18
- package/dist/boot/org-memory.js +4 -3
- package/dist/boot/parked-revive-gate.d.ts +1 -1
- package/dist/boot/parked-revive-gate.js +3 -3
- package/dist/boot/reapers.d.ts +4 -3
- package/dist/boot/reapers.js +20 -17
- package/dist/boot/resolve-spec.d.ts +5 -3
- package/dist/boot/resolve-spec.js +133 -165
- package/dist/boot/retention-lane.d.ts +7 -45
- package/dist/boot/retention-lane.js +2 -2
- package/dist/boot/runner-deps.d.ts +28 -7
- package/dist/boot/runner-deps.js +11 -4
- package/dist/boot/runtime-caps.d.ts +2 -2
- package/dist/boot/runtime-caps.js +16 -2
- package/dist/boot/session-faces.d.ts +17 -7
- package/dist/boot/session-faces.js +122 -96
- package/dist/boot/shutdown.d.ts +5 -4
- package/dist/boot/shutdown.js +6 -4
- package/dist/boot/stage-01-config.d.ts +1 -1
- package/dist/boot/stage-01-config.js +14 -2
- package/dist/boot/stage-02-web-admin-pull.d.ts +2 -1
- package/dist/boot/stage-02-web-admin-pull.js +15 -8
- package/dist/boot/stage-03-store-backend.d.ts +4 -1
- package/dist/boot/stage-03-store-backend.js +4 -3
- package/dist/boot/stage-04-stores.d.ts +3 -1
- package/dist/boot/stage-04-stores.js +2 -2
- package/dist/boot/stage-05-execution-env.d.ts +9 -5
- package/dist/boot/stage-05-execution-env.js +5 -5
- package/dist/boot/stage-06-runners.d.ts +13 -15
- package/dist/boot/stage-06-runners.js +24 -18
- package/dist/boot/stage-07-capability-layer.d.ts +14 -11
- package/dist/boot/stage-07-capability-layer.js +9 -12
- package/dist/boot/stage-08-reapers.d.ts +14 -11
- package/dist/boot/stage-08-reapers.js +3 -3
- package/dist/boot/stage-09-leader.d.ts +16 -18
- package/dist/boot/stage-09-leader.js +12 -4
- package/dist/boot/stage-10-http-server.d.ts +16 -18
- package/dist/boot/stage-10-http-server.js +9 -5
- package/dist/boot/store-evidence.d.ts +20 -0
- package/dist/boot/store-evidence.js +13 -0
- package/dist/boot/stores.d.ts +12 -0
- package/dist/boot/stores.js +39 -17
- package/dist/boot/task-list-lane.d.ts +4 -4
- package/dist/boot/web-admin.d.ts +4 -2
- package/dist/boot/web-admin.js +58 -38
- package/dist/boot/webfetch-summarize-lane.d.ts +1 -1
- package/dist/boot-reclaim.d.ts +3 -1
- package/dist/boot-reclaim.js +1 -1
- package/dist/brain.d.ts +7 -18
- package/dist/brain.js +5 -17
- package/dist/budget.js +6 -6
- package/dist/capabilities/center-plugins.d.ts +9 -1
- package/dist/capabilities/center-plugins.js +37 -11
- package/dist/capabilities/center-wiring.js +1 -1
- package/dist/capabilities/composite-members.d.ts +3 -2
- package/dist/capabilities/composite-members.js +3 -2
- 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/repo-tools.d.ts +2 -0
- package/dist/capabilities/repo-tools.js +14 -12
- package/dist/capabilities/scenarios.d.ts +38 -33
- package/dist/capabilities/scenarios.js +24 -25
- package/dist/capabilities/settings-contract.d.ts +29 -0
- package/dist/capabilities/settings-contract.js +14 -0
- package/dist/capabilities/skills.d.ts +6 -6
- package/dist/capabilities/tool-defer.d.ts +1 -1
- package/dist/capability-facts.d.ts +69 -4
- package/dist/capability-facts.js +77 -5
- package/dist/card-void.d.ts +4 -4
- package/dist/card-void.js +1 -1
- package/dist/center-credential-renewer.d.ts +6 -2
- package/dist/center-credential-renewer.js +10 -5
- package/dist/config-catalog.d.ts +16 -1
- package/dist/config-catalog.js +68 -61
- package/dist/config-dir-trust.d.ts +37 -4
- package/dist/config-dir-trust.js +88 -44
- package/dist/config-invariants.d.ts +58 -4
- package/dist/config-invariants.js +104 -23
- package/dist/config-lkg.d.ts +24 -2
- package/dist/config-lkg.js +22 -9
- package/dist/config-provider.d.ts +9 -9
- package/dist/config-provider.js +25 -108
- package/dist/config-pull-failure.d.ts +50 -0
- package/dist/config-pull-failure.js +48 -0
- package/dist/config-types.d.ts +215 -202
- package/dist/config.d.ts +69 -14
- package/dist/config.js +188 -96
- package/dist/degenerate-instrument.js +1 -1
- package/dist/delegated-session-owner.d.ts +1 -1
- package/dist/deleted-session-ids.d.ts +3 -2
- package/dist/deploy-facts.js +3 -2
- package/dist/deployment-governance.d.ts +3 -3
- package/dist/deployment-shape.d.ts +51 -16
- package/dist/deployment-shape.js +31 -6
- package/dist/egress-redirect.d.ts +25 -7
- package/dist/egress-redirect.js +20 -2
- package/dist/elicitation.d.ts +6 -5
- package/dist/elicitation.js +23 -22
- package/dist/engine-identity.d.ts +28 -0
- package/dist/engine-identity.js +10 -0
- package/dist/entry-problems.d.ts +5 -7
- package/dist/entry-problems.js +1 -1
- package/dist/env-facts.d.ts +7 -5
- package/dist/env-facts.js +12 -7
- package/dist/env-witness.d.ts +7 -0
- package/dist/env-witness.js +16 -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 +53 -103
- package/dist/execution-lane-caps.js +51 -83
- package/dist/execution-placement.d.ts +65 -9
- package/dist/execution-placement.js +58 -0
- package/dist/field-conflict.d.ts +7 -11
- package/dist/field-conflict.js +3 -3
- package/dist/file-history-capture.d.ts +3 -3
- package/dist/file-history-disclosure.d.ts +2 -2
- package/dist/file-history-disclosure.js +1 -0
- package/dist/fleet/drain-entry.d.ts +17 -10
- package/dist/fleet/drain-entry.js +1 -1
- package/dist/fleet/fleet-bus.d.ts +21 -3
- package/dist/fleet/fleet-bus.js +35 -25
- package/dist/fleet/fleet-reconciler.js +2 -2
- package/dist/fleet/serving-lease.js +6 -7
- package/dist/fleet-client.js +3 -3
- package/dist/fleet-lease.d.ts +0 -1
- package/dist/fleet-lease.js +4 -5
- package/dist/history-anchor.d.ts +42 -0
- package/dist/history-anchor.js +34 -0
- package/dist/hitl-delivery.d.ts +90 -0
- package/dist/hitl-delivery.js +98 -0
- package/dist/hooks/classic-stations.d.ts +8 -11
- package/dist/hooks/classic-stations.js +0 -7
- package/dist/hooks/command-spawn.d.ts +1 -4
- package/dist/hooks/command-spawn.js +0 -11
- package/dist/hooks/hook-llm.d.ts +5 -1
- package/dist/hooks/hook-llm.js +24 -15
- package/dist/hooks/hook-runner.d.ts +119 -65
- package/dist/hooks/hook-runner.js +415 -217
- package/dist/host-lsp-manager.d.ts +22 -8
- package/dist/host-lsp-manager.js +4 -1
- package/dist/http/active-run-conflict.d.ts +2 -43
- package/dist/http/active-run-conflict.js +3 -7
- package/dist/http/admission.d.ts +4 -18
- package/dist/http/admission.js +75 -78
- package/dist/http/approval-sweeps.d.ts +5 -8
- package/dist/http/approval-sweeps.js +55 -30
- package/dist/http/caller-trust.d.ts +8 -10
- package/dist/http/caller-trust.js +1 -2
- package/dist/http/checkpoint-ctx.d.ts +17 -0
- package/dist/http/checkpoint-ctx.js +6 -0
- package/dist/http/claim-heartbeat.d.ts +49 -0
- package/dist/http/claim-heartbeat.js +46 -0
- package/dist/http/claim-latency.d.ts +10 -0
- package/dist/http/claim-latency.js +12 -0
- package/dist/http/claimed-run.d.ts +4 -3
- package/dist/http/dispatch.d.ts +8 -1
- package/dist/http/dispatch.js +77 -31
- package/dist/http/durable-run-leg.d.ts +3 -3
- package/dist/http/durable-run-leg.js +18 -12
- package/dist/http/execution-context.d.ts +18 -42
- package/dist/http/execution-context.js +11 -5
- package/dist/http/health-reader.d.ts +36 -0
- package/dist/http/health-reader.js +21 -0
- package/dist/http/health-self-report.d.ts +9 -9
- package/dist/http/health-self-report.js +4 -4
- package/dist/http/idempotency.d.ts +9 -5
- package/dist/http/idempotency.js +4 -4
- package/dist/http/memory-compliance-failure-reply.d.ts +15 -16
- package/dist/http/memory-compliance-failure-reply.js +7 -2
- package/dist/http/memory-face-fault-reply.d.ts +67 -0
- package/dist/http/memory-face-fault-reply.js +71 -0
- package/dist/http/memory-store-refusal-reply.d.ts +3 -3
- package/dist/http/memory-store-refusal-reply.js +6 -0
- package/dist/http/owner-access.d.ts +391 -56
- package/dist/http/owner-access.js +372 -33
- package/dist/http/principal-gate.d.ts +26 -94
- package/dist/http/principal-gate.js +24 -81
- package/dist/http/refusal-body.d.ts +35 -2
- package/dist/http/refusal-body.js +34 -0
- package/dist/http/request-guards.d.ts +10 -14
- package/dist/http/request-guards.js +34 -68
- package/dist/http/resume-composition.d.ts +37 -0
- package/dist/http/resume-composition.js +18 -0
- package/dist/http/resume-ctx-read.d.ts +35 -12
- package/dist/http/resume-ctx-read.js +25 -6
- package/dist/http/resume-legs.d.ts +24 -24
- package/dist/http/resume-legs.js +260 -171
- package/dist/http/retired-skill-manifest.d.ts +1 -1
- 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 +56 -47
- package/dist/http/route-table.js +2 -0
- package/dist/http/routes/a2a-serve.d.ts +43 -5
- package/dist/http/routes/a2a-serve.js +58 -37
- package/dist/http/routes/admin-config-refresh.js +2 -2
- package/dist/http/routes/admin-drain.js +2 -2
- package/dist/http/routes/admin-memory-optout.js +4 -3
- package/dist/http/routes/adoption.d.ts +3 -0
- package/dist/http/routes/adoption.js +17 -10
- package/dist/http/routes/agents-roster.js +13 -7
- package/dist/http/routes/approvals-assistant.js +73 -88
- package/dist/http/routes/attachments.js +2 -2
- package/dist/http/routes/background.d.ts +3 -3
- package/dist/http/routes/background.js +9 -17
- package/dist/http/routes/capabilities.js +23 -20
- package/dist/http/routes/config-catalog.js +2 -2
- package/dist/http/routes/devices.d.ts +3 -3
- package/dist/http/routes/devices.js +5 -5
- package/dist/http/routes/diagnostics.d.ts +27 -3
- package/dist/http/routes/diagnostics.js +27 -21
- package/dist/http/routes/engine.js +2 -2
- package/dist/http/routes/fleet.js +5 -3
- package/dist/http/routes/images.js +10 -6
- package/dist/http/routes/leader.d.ts +7 -2
- package/dist/http/routes/leader.js +12 -3
- package/dist/http/routes/mcp-reconnect.d.ts +1 -1
- package/dist/http/routes/mcp-reconnect.js +7 -15
- package/dist/http/routes/memory-bundle.js +4 -7
- package/dist/http/routes/memory-compliance.js +4 -4
- package/dist/http/routes/memory-consolidation.js +6 -9
- package/dist/http/routes/memory-origin.d.ts +3 -1
- package/dist/http/routes/memory-origin.js +7 -8
- package/dist/http/routes/memory-policy.js +17 -12
- package/dist/http/routes/notify-wake.js +12 -20
- package/dist/http/routes/observability.js +3 -3
- package/dist/http/routes/principal-inbox.d.ts +1 -1
- package/dist/http/routes/principal-inbox.js +2 -2
- package/dist/http/routes/projects.d.ts +70 -0
- package/dist/http/routes/projects.js +87 -0
- package/dist/http/routes/retention-ops.js +6 -9
- package/dist/http/routes/rules.js +50 -7
- package/dist/http/routes/run-memory-capture.d.ts +2 -2
- package/dist/http/routes/run-memory-capture.js +6 -12
- package/dist/http/routes/run-permission-mode.d.ts +2 -2
- package/dist/http/routes/run-permission-mode.js +10 -17
- package/dist/http/routes/runs.js +148 -233
- package/dist/http/routes/session-memory-sync.d.ts +2 -2
- package/dist/http/routes/session-memory-sync.js +7 -13
- package/dist/http/routes/session-sync.d.ts +4 -2
- package/dist/http/routes/session-sync.js +48 -30
- package/dist/http/routes/sessions-list.d.ts +3 -3
- package/dist/http/routes/sessions-list.js +9 -9
- package/dist/http/routes/sessions.d.ts +7 -1
- package/dist/http/routes/sessions.js +177 -112
- package/dist/http/routes/shared-memory.js +6 -6
- package/dist/http/routes/side-query.js +2 -2
- package/dist/http/routes/tasks.js +144 -122
- package/dist/http/routes/trace-usage.d.ts +0 -12
- package/dist/http/routes/trace-usage.js +40 -46
- package/dist/http/routes/workflows.d.ts +39 -4
- package/dist/http/routes/workflows.js +42 -14
- package/dist/http/run-concurrency-cap.d.ts +20 -12
- package/dist/http/run-concurrency-cap.js +39 -26
- package/dist/http/run-read-face.d.ts +3 -5
- package/dist/http/run-read-face.js +8 -13
- package/dist/http/send.d.ts +12 -3
- package/dist/http/send.js +42 -6
- package/dist/http/server.d.ts +63 -50
- package/dist/http/server.js +52 -16
- package/dist/http/sse-log.d.ts +17 -10
- package/dist/http/sse-log.js +7 -7
- package/dist/http/stored-body-replay.d.ts +17 -3
- package/dist/http/stored-body-replay.js +11 -2
- package/dist/http/submit-ctx.d.ts +16 -8
- package/dist/http/submit-ctx.js +6 -2
- package/dist/http/submit-replay.d.ts +19 -6
- package/dist/http/submit-replay.js +18 -6
- package/dist/http/sync-submit-body.d.ts +3 -4
- package/dist/http/sync-submit-body.js +4 -5
- package/dist/http/wire-types.d.ts +23 -13
- package/dist/identity-source.d.ts +36 -5
- package/dist/identity-source.js +27 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.js +2 -1
- package/dist/instruction-source-notice.d.ts +1 -1
- package/dist/key-resolver.d.ts +32 -0
- package/dist/key-resolver.js +23 -9
- package/dist/leader/diffup.js +2 -1
- package/dist/leader/endpoint.d.ts +26 -5
- package/dist/leader/endpoint.js +154 -14
- package/dist/leader/fanout.d.ts +3 -0
- package/dist/leader/fanout.js +78 -63
- package/dist/leader/leader.d.ts +16 -0
- package/dist/leader/leader.js +43 -3
- package/dist/leader/merge.d.ts +9 -1
- package/dist/leader/merge.js +16 -1
- package/dist/leader/repair-wire.js +1 -1
- package/dist/leader/wire.d.ts +36 -3
- package/dist/leader/wire.js +59 -18
- package/dist/lsp-evict.d.ts +6 -4
- package/dist/lsp-evict.js +2 -3
- package/dist/memory-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 +5 -4
- package/dist/memory-operator-faces.js +1 -1
- package/dist/memory-scope.d.ts +31 -4
- package/dist/memory-scope.js +65 -16
- package/dist/memory-store-refusal.d.ts +20 -4
- package/dist/memory-store-refusal.js +1 -1
- package/dist/memory-sync-client.d.ts +5 -2
- package/dist/memory-sync-client.js +19 -14
- package/dist/memory-sync.js +1 -1
- package/dist/model-compat.d.ts +51 -28
- package/dist/model-compat.js +55 -23
- package/dist/model-context-window.d.ts +18 -0
- package/dist/model-context-window.js +2 -0
- package/dist/model-entry-headers.d.ts +46 -4
- package/dist/model-entry-headers.js +2 -2
- package/dist/model-entry-refusal.d.ts +46 -17
- package/dist/model-entry-refusal.js +47 -27
- package/dist/model-plane-face.d.ts +19 -11
- package/dist/model-plane-face.js +9 -1
- package/dist/model-plane-probe.d.ts +2 -0
- package/dist/model-plane-probe.js +17 -0
- package/dist/model-provider.d.ts +3 -3
- package/dist/model-route-endpoint.d.ts +9 -5
- package/dist/model-route-endpoint.js +29 -7
- package/dist/model-select.d.ts +16 -0
- package/dist/model-select.js +4 -0
- package/dist/mountinfo.d.ts +37 -0
- package/dist/mountinfo.js +47 -0
- package/dist/namespaced-rule-name.d.ts +28 -2
- package/dist/namespaced-rule-name.js +10 -1
- package/dist/net-address.d.ts +1 -1
- package/dist/observability/corrupt-read-seat.d.ts +4 -4
- package/dist/observability/corrupt-read-seat.js +5 -3
- package/dist/observability/fail-open.d.ts +75 -47
- package/dist/observability/fail-open.js +77 -47
- package/dist/observability/logger.d.ts +22 -1
- package/dist/observability/logger.js +89 -12
- package/dist/observability/metrics.d.ts +2 -0
- package/dist/observability/metrics.js +5 -4
- package/dist/observability/otel-exporter.js +2 -1
- package/dist/observability/principal-context.d.ts +14 -7
- package/dist/observability/principal-context.js +8 -3
- package/dist/observability/run-terminal.d.ts +7 -1
- package/dist/observability/run-terminal.js +5 -2
- package/dist/observability/secret-env-scrub.d.ts +30 -4
- package/dist/observability/secret-env-scrub.js +15 -3
- package/dist/orchestration/hardened-vm-runner.d.ts +1 -0
- package/dist/orchestration/hardened-vm-runner.js +11 -5
- package/dist/orchestration/hardened-vm-worker-runner.d.ts +0 -14
- package/dist/orchestration/hardened-vm-worker-runner.js +5 -0
- package/dist/orchestration/hardened-vm-worker.js +2 -1
- package/dist/orchestration/workflow-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 +29 -9
- package/dist/orchestration/workflow-completion-inbox.js +65 -46
- package/dist/org-delivery-gate.d.ts +5 -4
- package/dist/org-delivery-gate.js +7 -6
- package/dist/org-memory-admission.d.ts +5 -2
- package/dist/org-memory-admission.js +25 -10
- package/dist/outbound-dispatcher.d.ts +1 -1
- package/dist/outbound-dispatcher.js +6 -12
- package/dist/owner-brands.d.ts +81 -0
- package/dist/owner-brands.js +42 -0
- package/dist/owner-faces.d.ts +531 -0
- package/dist/owner-faces.js +126 -0
- package/dist/parked-decide.d.ts +100 -31
- package/dist/parked-decide.js +162 -48
- package/dist/parked-revive-surface.d.ts +14 -4
- package/dist/parked-revive-surface.js +5 -4
- package/dist/peer-directory.d.ts +6 -8
- package/dist/peer-directory.js +3 -2
- package/dist/permission-rule-vocab.d.ts +53 -8
- package/dist/permission-rule-vocab.js +30 -2
- package/dist/plugins/adoption-log-sql.d.ts +0 -22
- package/dist/plugins/adoption-log-sql.js +5 -3
- package/dist/plugins/approval-ask-retired-delete-by-task-m50.d.ts +7 -0
- package/dist/plugins/approval-ask-retired-delete-by-task-m50.js +17 -0
- package/dist/plugins/approval-ask-store-file.d.ts +28 -9
- package/dist/plugins/approval-ask-store-file.js +74 -18
- package/dist/plugins/approval-ask-store-memory.d.ts +17 -7
- package/dist/plugins/approval-ask-store-memory.js +35 -12
- package/dist/plugins/approval-ask-store-sql.d.ts +42 -20
- package/dist/plugins/approval-ask-store-sql.js +44 -11
- package/dist/plugins/approval-exemption-skill-m46.d.ts +20 -0
- package/dist/plugins/approval-exemption-skill-m46.js +25 -0
- package/dist/plugins/approval-exemption-store.d.ts +6 -1
- package/dist/plugins/approval-exemption-store.js +14 -0
- package/dist/plugins/approval-nonce-store.d.ts +39 -12
- package/dist/plugins/approval-nonce-store.js +72 -23
- package/dist/plugins/blob-backend.d.ts +40 -195
- package/dist/plugins/blob-backend.js +41 -234
- package/dist/plugins/caching-session-store.d.ts +22 -5
- package/dist/plugins/caching-session-store.js +43 -4
- package/dist/plugins/checkpoint-index-columns.d.ts +33 -6
- package/dist/plugins/checkpoint-index-columns.js +39 -3
- package/dist/plugins/checkpoint-store-face.d.ts +84 -11
- package/dist/plugins/checkpoint-store-face.js +18 -1
- package/dist/plugins/device-store-sql.d.ts +2 -2
- package/dist/plugins/device-store-sql.js +6 -10
- package/dist/plugins/ensure-index.d.ts +13 -1
- package/dist/plugins/ensure-index.js +154 -21
- package/dist/plugins/ensure-schema-lock-policy.d.ts +0 -15
- package/dist/plugins/ensure-schema-lock-policy.js +3 -2
- package/dist/plugins/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 +89 -35
- package/dist/plugins/file-run-store.js +197 -142
- package/dist/plugins/host-platform.d.ts +24 -3
- package/dist/plugins/host-platform.js +15 -1
- package/dist/plugins/image-bake-store-sql.js +2 -0
- package/dist/plugins/imported-layer-root-retirement.d.ts +19 -10
- 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/k8s-pod-reaper.d.ts +1 -3
- package/dist/plugins/k8s-pod-reaper.js +0 -1
- package/dist/plugins/leader-run-store-sql.d.ts +22 -0
- package/dist/plugins/leader-run-store-sql.js +34 -4
- package/dist/plugins/local-checkpoint-store.d.ts +63 -23
- package/dist/plugins/local-checkpoint-store.js +204 -81
- package/dist/plugins/local-data-dir-modes-m39.d.ts +48 -0
- package/dist/plugins/local-data-dir-modes-m39.js +183 -0
- package/dist/plugins/local-docker-capacity.d.ts +93 -0
- package/dist/plugins/local-docker-capacity.js +194 -0
- package/dist/plugins/local-docker-reaper.d.ts +92 -0
- package/dist/plugins/local-docker-reaper.js +102 -0
- package/dist/plugins/local-engine-high-water.d.ts +13 -0
- package/dist/plugins/local-engine-high-water.js +62 -0
- package/dist/plugins/local-session-store.d.ts +442 -143
- package/dist/plugins/local-session-store.js +941 -289
- package/dist/plugins/local-session-window.d.ts +3 -2
- package/dist/plugins/local-session-window.js +3 -2
- package/dist/plugins/local-sidecar-quarantine.js +3 -2
- package/dist/plugins/local-task-attachment-store.d.ts +20 -1
- package/dist/plugins/local-task-attachment-store.js +32 -12
- 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 +11 -9
- package/dist/plugins/memory-engine-pg.d.ts +7 -5
- package/dist/plugins/memory-engine-pg.js +18 -9
- package/dist/plugins/memory-engine-sql-apply.d.ts +21 -8
- package/dist/plugins/memory-engine-sql-apply.js +7 -9
- package/dist/plugins/memory-engine-tidb.d.ts +12 -7
- package/dist/plugins/memory-engine-tidb.js +18 -10
- package/dist/plugins/memory-optout-grant-store-sql.d.ts +1 -1
- package/dist/plugins/memory-optout-grant-store-sql.js +3 -3
- package/dist/plugins/memory-run-store.d.ts +39 -27
- package/dist/plugins/memory-run-store.js +72 -70
- package/dist/plugins/one-time-migration-marker.d.ts +10 -0
- package/dist/plugins/one-time-migration-marker.js +7 -0
- package/dist/plugins/one-time-migrations.d.ts +325 -74
- package/dist/plugins/one-time-migrations.js +705 -230
- package/dist/plugins/org-delivery-quota-store.js +2 -1
- 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 +11 -11
- package/dist/plugins/permission-rule-store-file.js +14 -2
- package/dist/plugins/permission-rule-store-sql.d.ts +4 -63
- package/dist/plugins/permission-rule-store-sql.js +6 -86
- package/dist/plugins/pg-pool.d.ts +3 -32
- package/dist/plugins/pg-pool.js +27 -11
- 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 +19 -28
- package/dist/plugins/remote-env-e2b.js +40 -29
- package/dist/plugins/remote-env-host.d.ts +11 -10
- package/dist/plugins/remote-env-host.js +40 -27
- package/dist/plugins/remote-env-k8s.d.ts +45 -47
- package/dist/plugins/remote-env-k8s.js +122 -62
- package/dist/plugins/remote-env-local-docker.d.ts +152 -15
- package/dist/plugins/remote-env-local-docker.js +370 -75
- package/dist/plugins/remote-env-ssh.d.ts +8 -2
- package/dist/plugins/remote-env-ssh.js +26 -24
- package/dist/plugins/remote-scratchpad.js +4 -0
- 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 +158 -0
- package/dist/plugins/retention-deployment.js +119 -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-preview-m45.d.ts +11 -0
- package/dist/plugins/run-preview-m45.js +19 -0
- package/dist/plugins/run-store-sql.d.ts +56 -68
- package/dist/plugins/run-store-sql.js +127 -116
- package/dist/plugins/s3-answer.d.ts +2 -1
- package/dist/plugins/sandbox-reaper.d.ts +26 -0
- package/dist/plugins/sandbox-reaper.js +2 -0
- package/dist/plugins/scenario-prefix-switch-m42.d.ts +54 -0
- package/dist/plugins/scenario-prefix-switch-m42.js +55 -0
- package/dist/plugins/scheduler-support.d.ts +16 -1
- package/dist/plugins/scheduler-support.js +22 -2
- package/dist/plugins/schema-consistency.d.ts +42 -15
- package/dist/plugins/schema-consistency.js +213 -13
- package/dist/plugins/schema-drift-sentence.d.ts +4 -1
- package/dist/plugins/schema-drift-sentence.js +4 -4
- package/dist/plugins/schema-ensure-legs.d.ts +10 -1
- package/dist/plugins/schema-ensure-legs.js +12 -2
- package/dist/plugins/schema-indexes.js +3 -0
- package/dist/plugins/schema-live-columns.d.ts +14 -5
- package/dist/plugins/schema-live-columns.js +10 -10
- package/dist/plugins/send-user-file.js +2 -1
- package/dist/plugins/session-birth.d.ts +37 -0
- package/dist/plugins/session-birth.js +38 -0
- package/dist/plugins/session-epoch-anchor.d.ts +40 -12
- package/dist/plugins/session-epoch-anchor.js +33 -11
- package/dist/plugins/session-ext-table.d.ts +98 -0
- package/dist/plugins/session-ext-table.js +134 -0
- package/dist/plugins/session-fork.d.ts +16 -2
- package/dist/plugins/session-fork.js +3 -0
- package/dist/plugins/session-ownership.d.ts +1 -1
- package/dist/plugins/session-placement.d.ts +22 -16
- package/dist/plugins/session-placement.js +15 -12
- package/dist/plugins/session-row-sql.d.ts +20 -7
- package/dist/plugins/session-row-sql.js +16 -8
- package/dist/plugins/session-run-rollup.d.ts +29 -0
- package/dist/plugins/session-run-rollup.js +40 -0
- package/dist/plugins/session-store-sql.d.ts +157 -0
- package/dist/plugins/session-store-sql.js +398 -0
- package/dist/plugins/session-withdraw-sql.d.ts +36 -0
- package/dist/plugins/session-withdraw-sql.js +42 -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 -69
- package/dist/plugins/shared-memory-store-sql.js +15 -14
- package/dist/plugins/shell-sentinel-owner-m48.d.ts +20 -0
- package/dist/plugins/shell-sentinel-owner-m48.js +3 -0
- package/dist/plugins/snapshot-bucket-presence.d.ts +2 -1
- package/dist/plugins/snapshot-bucket-presence.js +1 -1
- package/dist/plugins/sql-driver.d.ts +24 -8
- package/dist/plugins/sql-driver.js +43 -9
- package/dist/plugins/sql-errors.d.ts +35 -5
- package/dist/plugins/sql-errors.js +55 -3
- package/dist/plugins/sql-json-column.d.ts +8 -7
- package/dist/plugins/sql-json-column.js +10 -6
- package/dist/plugins/store-backend.d.ts +114 -18
- package/dist/plugins/store-backend.js +340 -87
- package/dist/plugins/store-contracts.d.ts +97 -30
- package/dist/plugins/store-contracts.js +23 -1
- package/dist/plugins/store-fault.d.ts +28 -2
- package/dist/plugins/store-fault.js +20 -2
- package/dist/plugins/task-attachment-store.d.ts +21 -11
- package/dist/plugins/task-attachment-store.js +37 -19
- 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 +42 -39
- package/dist/plugins/user-input-ledger-sql.d.ts +1 -1
- package/dist/plugins/web-search.js +5 -3
- package/dist/plugins/workflow-run-store-sql.d.ts +6 -1
- package/dist/plugins/workflow-run-store-sql.js +11 -5
- package/dist/principal-jwt.d.ts +4 -4
- package/dist/principal-jwt.js +20 -5
- package/dist/principal-shape.d.ts +41 -0
- package/dist/principal-shape.js +19 -0
- package/dist/question.d.ts +13 -23
- package/dist/question.js +21 -39
- package/dist/read-face-posture.d.ts +6 -6
- package/dist/read-face-posture.js +2 -2
- package/dist/request-declaration-refusal.d.ts +35 -12
- package/dist/request-declaration-refusal.js +21 -9
- package/dist/request-form.d.ts +58 -0
- package/dist/request-form.js +72 -0
- package/dist/request-image-urls.d.ts +8 -2
- package/dist/request-image-urls.js +2 -1
- package/dist/request-images.d.ts +20 -0
- package/dist/request-images.js +59 -0
- package/dist/request-key-closure.d.ts +6 -7
- package/dist/request-key-closure.js +15 -2
- package/dist/request-value-closure.d.ts +5 -5
- package/dist/request-value-closure.js +1 -1
- package/dist/resource-suspend.d.ts +7 -16
- package/dist/resource-suspend.js +1 -1
- package/dist/retired-name-host-notice.d.ts +21 -0
- package/dist/retired-name-host-notice.js +12 -0
- package/dist/rule-entry-list.d.ts +2 -2
- package/dist/rule-entry-list.js +3 -4
- package/dist/rule-issue-reading.d.ts +58 -0
- package/dist/rule-issue-reading.js +14 -0
- package/dist/rules-consent.d.ts +46 -16
- package/dist/rules-consent.js +102 -53
- package/dist/run-acceptance.d.ts +3 -1
- package/dist/run-acceptance.js +3 -0
- package/dist/run-local.d.ts +14 -6
- package/dist/run-local.js +109 -93
- package/dist/run-stale-default.d.ts +7 -0
- package/dist/run-stale-default.js +2 -0
- package/dist/runs.d.ts +73 -44
- package/dist/runs.js +65 -43
- package/dist/runtime-caps-resolver.d.ts +36 -14
- package/dist/runtime-caps-resolver.js +31 -14
- package/dist/runtime-governance.d.ts +2 -2
- package/dist/runtime-governance.js +5 -3
- package/dist/sealed-key-layout.d.ts +12 -6
- package/dist/sealed-key-layout.js +5 -1
- package/dist/sealed-key.d.ts +12 -2
- package/dist/sealed-key.js +116 -26
- package/dist/security.d.ts +133 -161
- package/dist/security.js +163 -59
- package/dist/sema-config-dir.d.ts +20 -0
- package/dist/sema-config-dir.js +27 -2
- package/dist/server-secret-env.d.ts +23 -5
- package/dist/server-secret-env.js +14 -4
- package/dist/service-version.d.ts +2 -1
- package/dist/service-version.js +2 -2
- package/dist/session-children-retire.d.ts +7 -5
- package/dist/session-children-retire.js +7 -2
- package/dist/session-deletion.d.ts +88 -0
- package/dist/session-deletion.js +8 -0
- package/dist/session-erase.d.ts +145 -0
- package/dist/session-erase.js +115 -0
- package/dist/session-error-wire.d.ts +6 -6
- package/dist/session-error-wire.js +1 -1
- package/dist/session-incarnation.d.ts +60 -10
- package/dist/session-incarnation.js +19 -2
- package/dist/session-policy-wire.d.ts +6 -3
- package/dist/session-policy-wire.js +11 -1
- package/dist/session-resident-background.d.ts +29 -47
- package/dist/session-resident-background.js +77 -8
- package/dist/session-row.d.ts +3 -2
- package/dist/session-rules-seat.d.ts +12 -0
- package/dist/session-rules-seat.js +19 -0
- package/dist/session-sync-kernel.d.ts +1 -1
- package/dist/session-titler.d.ts +7 -15
- package/dist/session-titler.js +1 -1
- package/dist/session-workspace.d.ts +11 -2
- package/dist/session-workspace.js +5 -0
- package/dist/sighup-idle.d.ts +1 -1
- package/dist/spec-fields.d.ts +57 -3
- package/dist/spec-fields.js +72 -51
- package/dist/store-posture.d.ts +138 -21
- package/dist/store-posture.js +188 -3
- package/dist/stored-request-hooks-m20.d.ts +3 -2
- package/dist/stored-request-hooks-m20.js +21 -16
- package/dist/stores-sql/background-agent-store-sql.d.ts +11 -2
- package/dist/stores-sql/background-agent-store-sql.js +73 -20
- package/dist/stores-sql/blob-index-sql.d.ts +148 -0
- package/dist/stores-sql/blob-index-sql.js +154 -0
- package/dist/stores-sql/checkpoint-store-sql.d.ts +34 -29
- package/dist/stores-sql/checkpoint-store-sql.js +86 -71
- 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/stores-sql/mailbox-store-sql.d.ts +7 -4
- package/dist/stores-sql/mailbox-store-sql.js +31 -32
- package/dist/{plugins → stores-sql}/pg-session-storage.d.ts +30 -81
- package/dist/{plugins → stores-sql}/pg-session-storage.js +123 -244
- package/dist/{plugins → stores-sql}/retention-store-sql.d.ts +197 -223
- package/dist/{plugins → stores-sql}/retention-store-sql.js +148 -207
- 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 +33 -11
- package/dist/stores-sql/session-policy-store-sql.js +44 -36
- package/dist/stores-sql/session-write-hooks.d.ts +65 -0
- package/dist/stores-sql/session-write-hooks.js +2 -0
- package/dist/{plugins → stores-sql}/tidb-session-storage.d.ts +14 -15
- package/dist/{plugins → stores-sql}/tidb-session-storage.js +22 -28
- package/dist/{plugins → stores-sql}/tidb-session-store.d.ts +67 -138
- package/dist/{plugins → stores-sql}/tidb-session-store.js +130 -200
- package/dist/stores-sql/tool-result-store-sql.d.ts +1 -1
- package/dist/stores-sql/tool-result-store-sql.js +1 -1
- package/dist/stores-sql/windowed-session-storage.d.ts +61 -0
- package/dist/stores-sql/windowed-session-storage.js +70 -0
- package/dist/submission-exit.d.ts +50 -0
- package/dist/submission-exit.js +108 -0
- package/dist/task-a2a.d.ts +7 -1
- package/dist/task-a2a.js +18 -17
- package/dist/task-cwd.d.ts +31 -3
- package/dist/task-cwd.js +25 -1
- package/dist/task-mcp.d.ts +11 -3
- package/dist/task-mcp.js +16 -19
- package/dist/task-settings.d.ts +23 -14
- package/dist/task-settings.js +35 -13
- package/dist/terminal.d.ts +25 -43
- package/dist/terminal.js +31 -11
- package/dist/tool-approval.d.ts +152 -137
- package/dist/tool-approval.js +199 -199
- package/dist/trace/core-keyset-guard.d.ts +22 -9
- package/dist/trace/core-vocab-wire.d.ts +95 -0
- package/dist/trace/core-vocab-wire.js +15 -0
- package/dist/trace/engine-notice-wire.d.ts +1 -1
- package/dist/trace/engine-notice-wire.js +2 -0
- package/dist/trace/exit-seat.d.ts +52 -4
- package/dist/trace/exit-seat.js +43 -36
- package/dist/trace/extension-call-face.d.ts +3 -2
- package/dist/trace/extension-call-face.js +3 -1
- package/dist/trace/ledger-events.d.ts +4 -7
- package/dist/trace/ledger-sink.d.ts +1 -30
- package/dist/trace/ledger-sink.js +0 -11
- package/dist/trace/model-segment.d.ts +5 -5
- package/dist/trace/model-segment.js +5 -5
- package/dist/trace/project.d.ts +88 -58
- package/dist/trace/project.js +64 -28
- package/dist/trace/redact.d.ts +124 -28
- package/dist/trace/redact.js +936 -328
- package/dist/trace/self-minted-wire.d.ts +750 -29
- package/dist/trace/self-minted-wire.js +262 -25
- 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 +43 -8
- package/dist/trace/wire-projection-faces.js +28 -3
- package/dist/unread-request-members.d.ts +66 -0
- package/dist/unread-request-members.js +41 -0
- package/dist/upstream-body.d.ts +23 -0
- package/dist/upstream-body.js +16 -0
- package/dist/url-refusal.d.ts +3 -3
- package/dist/url-refusal.js +11 -4
- package/dist/user-authored-text.d.ts +1 -1
- package/dist/user-input-ledger.d.ts +7 -8
- package/dist/user-input-ledger.js +1 -1
- package/dist/web-admin-client/apply-effective.d.ts +6 -3
- package/dist/web-admin-client/apply-effective.js +33 -40
- package/dist/web-admin-client/apply-ledger.d.ts +16 -7
- package/dist/web-admin-client/apply-ledger.js +5 -2
- package/dist/web-admin-client/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 +6 -3
- package/dist/web-admin-client/center-request.js +17 -16
- package/dist/web-admin-client/effective-keys.d.ts +1 -1
- package/dist/web-admin-client/effective-keys.js +1 -2
- package/dist/web-admin-client/entry-metadata.d.ts +8 -0
- package/dist/web-admin-client/entry-metadata.js +13 -0
- package/dist/web-admin-client/facade.d.ts +1 -1
- package/dist/web-admin-client/http-client.d.ts +2 -1
- package/dist/web-admin-client/http-client.js +40 -13
- package/dist/web-admin-client/mcp-revocation.d.ts +1 -1
- package/dist/web-admin-client/mcp-revocation.js +2 -1
- package/dist/web-admin-client/read-warnings.d.ts +1 -0
- package/dist/web-admin-client/read-warnings.js +1 -0
- package/dist/web-admin-client/restart-signal.js +13 -6
- package/dist/web-admin-client/skills-mcp.d.ts +22 -8
- package/dist/web-admin-client/skills-mcp.js +26 -21
- package/dist/web-admin-client/types.d.ts +35 -51
- package/dist/workspace-space.d.ts +3 -2
- package/docs/DEVICE-EXECUTOR-PROTOCOL.md +4 -4
- package/package.json +16 -12
- package/scripts/drain-check-local.mjs +118 -173
- package/scripts/drain-check.mysql.sql +20 -16
- package/scripts/drain-check.pg.sql +20 -16
- package/wire-changes/server@7.147.0.json +813 -0
- package/wire-changes/server@7.148.0.json +1517 -0
- package/dist/http/memory-control-plane-corrupt-reply.d.ts +0 -25
- package/dist/http/memory-control-plane-corrupt-reply.js +0 -19
- package/dist/http/memory-layer-reply.d.ts +0 -30
- package/dist/http/memory-layer-reply.js +0 -24
- package/dist/lsp/e2b-bridge.d.ts +0 -57
- package/dist/lsp/e2b-bridge.js +0 -139
- package/dist/lsp/e2b-manager.d.ts +0 -93
- package/dist/lsp/e2b-manager.js +0 -178
- package/dist/lsp/lsp-frames.d.ts +0 -14
- package/dist/lsp/lsp-frames.js +0 -25
- package/dist/lsp/manager.d.ts +0 -129
- package/dist/lsp/manager.js +0 -127
- package/dist/lsp/types.d.ts +0 -12
- package/dist/lsp/types.js +0 -2
- package/dist/lsp/ws-transport.d.ts +0 -40
- package/dist/lsp/ws-transport.js +0 -210
package/dist/leader/wire.js
CHANGED
|
@@ -21,9 +21,46 @@ import { attachRepairLoopDeps } from "./repair-wire.js";
|
|
|
21
21
|
import { routePlanWithFallback, validateSubtasks } from "./planner.js";
|
|
22
22
|
import { createEngineNoticeSeat } from "../boot/runner-deps.js";
|
|
23
23
|
import { buildInternalRunCtx } from "../internal-run-env.js";
|
|
24
|
-
import {
|
|
24
|
+
import { currentSubject } from "../observability/principal-context.js";
|
|
25
|
+
import { partsOf } from "../owner-brands.js";
|
|
26
|
+
import { taskSpecIdentityOf } from "../engine-identity.js";
|
|
25
27
|
import { redactHead } from "../observability/run-terminal.js";
|
|
26
28
|
const REPAIR_LOOP_WIRED = true;
|
|
29
|
+
export const LEADER_APPROVAL_SCOPE = "_leader";
|
|
30
|
+
export function leaderResourceScope(workerId) {
|
|
31
|
+
return `_leader-resource-${workerId}`;
|
|
32
|
+
}
|
|
33
|
+
const PARK_DRAIN_MAX = 64;
|
|
34
|
+
export function createLeaderParkExpirer(store) {
|
|
35
|
+
return async (workers) => {
|
|
36
|
+
let expired = 0;
|
|
37
|
+
let lost = 0;
|
|
38
|
+
const seen = new Set();
|
|
39
|
+
for (const w of workers) {
|
|
40
|
+
for (const scope of [LEADER_APPROVAL_SCOPE, leaderResourceScope(w.workerId)]) {
|
|
41
|
+
const key = `${w.sessionId}\u0000${scope}`;
|
|
42
|
+
if (seen.has(key))
|
|
43
|
+
continue;
|
|
44
|
+
seen.add(key);
|
|
45
|
+
const tried = new Set();
|
|
46
|
+
for (let i = 0;; i++) {
|
|
47
|
+
const token = await store.findPendingTokenBySession(w.sessionId, scope);
|
|
48
|
+
if (token === null || token === undefined)
|
|
49
|
+
break;
|
|
50
|
+
if (tried.has(token) || i >= PARK_DRAIN_MAX) {
|
|
51
|
+
throw new Error(`leader park expiry: the checkpoint store kept answering pending token for session ${w.sessionId} in scope ${scope} after expiring it — refusing to spin (expired=${expired}, lost=${lost})`);
|
|
52
|
+
}
|
|
53
|
+
tried.add(token);
|
|
54
|
+
if (await store.expire(token, scope))
|
|
55
|
+
expired++;
|
|
56
|
+
else
|
|
57
|
+
lost++;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return { expired, lost };
|
|
62
|
+
};
|
|
63
|
+
}
|
|
27
64
|
const sh = (env) => async (cmd) => {
|
|
28
65
|
const r = await env.exec(`bash -lc ${JSON.stringify(cmd)}`);
|
|
29
66
|
if (!r.ok)
|
|
@@ -111,20 +148,20 @@ export function createCoordinatorPush(durableRemote, targetRef, ident) {
|
|
|
111
148
|
const dir = mkdtempSync(join(tmpdir(), "leader-coord-"));
|
|
112
149
|
const gitEnv = { ...gitSubprocessEnv({ site: "server.leader.git-push", isolateConfig: false }), LC_ALL: "C" };
|
|
113
150
|
try {
|
|
114
|
-
execFileSync("git", ["clone", "-q", durableRemote, dir], { env: gitEnv, timeout: LEADER_PUSH_NETWORK_TIMEOUT_MS });
|
|
115
|
-
execFileSync("git", ["-C", dir, "config", "user.name", ident.name], { env: gitEnv, timeout: LEADER_PUSH_LOCAL_TIMEOUT_MS });
|
|
116
|
-
execFileSync("git", ["-C", dir, "config", "user.email", ident.email], { env: gitEnv, timeout: LEADER_PUSH_LOCAL_TIMEOUT_MS });
|
|
151
|
+
execFileSync("git", ["clone", "-q", durableRemote, dir], { stdio: "pipe", env: gitEnv, timeout: LEADER_PUSH_NETWORK_TIMEOUT_MS });
|
|
152
|
+
execFileSync("git", ["-C", dir, "config", "user.name", ident.name], { stdio: "pipe", env: gitEnv, timeout: LEADER_PUSH_LOCAL_TIMEOUT_MS });
|
|
153
|
+
execFileSync("git", ["-C", dir, "config", "user.email", ident.email], { stdio: "pipe", env: gitEnv, timeout: LEADER_PUSH_LOCAL_TIMEOUT_MS });
|
|
117
154
|
writeFileSync(join(dir, ".leader.patch"), integratedPatch);
|
|
118
|
-
execFileSync("git", ["-C", dir, "am", "--3way", ".leader.patch"], { env: gitEnv, timeout: LEADER_PUSH_LOCAL_TIMEOUT_MS });
|
|
155
|
+
execFileSync("git", ["-C", dir, "am", "--3way", ".leader.patch"], { stdio: "pipe", env: gitEnv, timeout: LEADER_PUSH_LOCAL_TIMEOUT_MS });
|
|
119
156
|
rmSync(join(dir, ".leader.patch"));
|
|
120
157
|
const ref = targetRef ?? "refs/heads/main";
|
|
121
|
-
const ls = execFileSync("git", ["-C", dir, "ls-remote", "--refs", "origin", ref], { encoding: "utf8", env: gitEnv, timeout: LEADER_PUSH_NETWORK_TIMEOUT_MS });
|
|
158
|
+
const ls = execFileSync("git", ["-C", dir, "ls-remote", "--refs", "origin", ref], { stdio: "pipe", encoding: "utf8", env: gitEnv, timeout: LEADER_PUSH_NETWORK_TIMEOUT_MS });
|
|
122
159
|
const exists = ls.split("\n").some((l) => l.split("\t")[1] === ref);
|
|
123
160
|
if (exists) {
|
|
124
|
-
execFileSync("git", ["-C", dir, "push", `--force-with-lease=${ref}:${baseSha}`, "origin", `HEAD:${ref}`], { env: gitEnv, timeout: LEADER_PUSH_NETWORK_TIMEOUT_MS });
|
|
161
|
+
execFileSync("git", ["-C", dir, "push", `--force-with-lease=${ref}:${baseSha}`, "origin", `HEAD:${ref}`], { stdio: "pipe", env: gitEnv, timeout: LEADER_PUSH_NETWORK_TIMEOUT_MS });
|
|
125
162
|
}
|
|
126
163
|
else {
|
|
127
|
-
execFileSync("git", ["-C", dir, "push", `--force-with-lease=${ref}:`, "origin", `HEAD:${ref}`], { env: gitEnv, timeout: LEADER_PUSH_NETWORK_TIMEOUT_MS });
|
|
164
|
+
execFileSync("git", ["-C", dir, "push", `--force-with-lease=${ref}:`, "origin", `HEAD:${ref}`], { stdio: "pipe", env: gitEnv, timeout: LEADER_PUSH_NETWORK_TIMEOUT_MS });
|
|
128
165
|
}
|
|
129
166
|
return { ok: true, ref };
|
|
130
167
|
}
|
|
@@ -168,20 +205,21 @@ export function createLeaderRunner(cfg) {
|
|
|
168
205
|
const deploymentPostureSeat = () => cfg.deploymentPosture?.() ?? {};
|
|
169
206
|
const tracerSeat = cfg.tracer ? { tracer: cfg.tracer } : {};
|
|
170
207
|
const modsSeat = cfg.mods ? { mods: cfg.mods } : {};
|
|
208
|
+
const handsSeat = cfg.hands ? { hands: cfg.hands } : {};
|
|
171
209
|
const servedTableSeat = { models: cfg.models, roles: cfg.roles, ...(cfg.tiers ? { tiers: cfg.tiers } : {}) };
|
|
172
210
|
const usageWindowSeat = cfg.usageWindows && cfg.usageWindowStore ? { usageWindows: cfg.usageWindows, usageWindowStore: cfg.usageWindowStore } : {};
|
|
173
211
|
const promptSourceSeat = cfg.promptSource ? { promptSource: cfg.promptSource } : {};
|
|
174
212
|
const onErrorSeat = cfg.onError ? { onError: cfg.onError } : {};
|
|
175
213
|
const principalSpec = () => {
|
|
176
|
-
const
|
|
177
|
-
return
|
|
214
|
+
const subject = currentSubject();
|
|
215
|
+
return taskSpecIdentityOf(subject === undefined ? undefined : partsOf(subject));
|
|
178
216
|
};
|
|
179
217
|
const mkRepair = (rawEnv, repoDir, oracleFiles, entry) => {
|
|
180
218
|
if (repairRounds <= 0)
|
|
181
219
|
return undefined;
|
|
182
220
|
return {
|
|
183
221
|
maxRounds: repairRounds,
|
|
184
|
-
run: async ({ round, errorText, testCmd }) => {
|
|
222
|
+
run: async ({ round, errorText, testCmd, signal }) => {
|
|
185
223
|
for (const f of oracleFiles) {
|
|
186
224
|
await rawEnv.remove(f.path).catch(() => { });
|
|
187
225
|
const ex = await rawEnv.exists(f.path);
|
|
@@ -189,7 +227,7 @@ export function createLeaderRunner(cfg) {
|
|
|
189
227
|
throw new Error(`oracle still present after remove (${f.path}) — refusing repair (measurement integrity)`);
|
|
190
228
|
}
|
|
191
229
|
try {
|
|
192
|
-
const runner = new Runner({ brain: cfg.brain, ...servedTableSeat, pricing: cfg.pricing, ...onNoticeSeat, ...governanceSeat, ...deploymentPostureSeat(), ...tracerSeat, ...usageWindowSeat, ...promptSourceSeat, ...onErrorSeat, ...modsSeat, executionEnv: rawEnv, rootPath: repoDir });
|
|
230
|
+
const runner = new Runner({ brain: cfg.brain, ...servedTableSeat, pricing: cfg.pricing, ...onNoticeSeat, ...governanceSeat, ...deploymentPostureSeat(), ...tracerSeat, ...usageWindowSeat, ...promptSourceSeat, ...onErrorSeat, ...modsSeat, ...handsSeat, executionEnv: rawEnv, rootPath: repoDir });
|
|
193
231
|
const objective = [
|
|
194
232
|
`The integrated project at ${repoDir} fails its build/test. Make the MINIMAL change to the working tree so this command exits 0 (cd into the repo and run it yourself to confirm):`,
|
|
195
233
|
` ${testCmd}`,
|
|
@@ -203,6 +241,7 @@ export function createLeaderRunner(cfg) {
|
|
|
203
241
|
objective,
|
|
204
242
|
...principalSpec(),
|
|
205
243
|
sessionId: `leader-repair-${Date.now()}-${round}`,
|
|
244
|
+
signal,
|
|
206
245
|
limits: { maxCostUsd: repairBudgetUsd, maxWalltimeMs: Math.max(300_000, Math.floor(leaderTimeoutMs / 2)) },
|
|
207
246
|
}, entry))
|
|
208
247
|
.result();
|
|
@@ -220,7 +259,7 @@ export function createLeaderRunner(cfg) {
|
|
|
220
259
|
},
|
|
221
260
|
};
|
|
222
261
|
};
|
|
223
|
-
return async (raw) => {
|
|
262
|
+
return async (raw, signal) => {
|
|
224
263
|
const body = raw;
|
|
225
264
|
if (!body.objective || !body.durableRemote || !body.testCmd || !body.seedCmd || !body.baseSha) {
|
|
226
265
|
return { ok: false, reports: [], cancelled: false, error: "request must provide objective, durableRemote, baseSha, testCmd, seedCmd" };
|
|
@@ -256,12 +295,13 @@ export function createLeaderRunner(cfg) {
|
|
|
256
295
|
if (Array.isArray(body.subtasks) && body.subtasks.length > 0) {
|
|
257
296
|
return validateSubtasks(body.subtasks);
|
|
258
297
|
}
|
|
259
|
-
const planRunner = new Runner({ brain: cfg.brain, ...servedTableSeat, pricing: cfg.pricing, ...onNoticeSeat, ...governanceSeat, ...deploymentPostureSeat(), ...tracerSeat, ...usageWindowSeat, ...promptSourceSeat, ...onErrorSeat, ...modsSeat });
|
|
298
|
+
const planRunner = new Runner({ brain: cfg.brain, ...servedTableSeat, pricing: cfg.pricing, ...onNoticeSeat, ...governanceSeat, ...deploymentPostureSeat(), ...tracerSeat, ...usageWindowSeat, ...promptSourceSeat, ...onErrorSeat, ...modsSeat, ...handsSeat });
|
|
260
299
|
const runRoute = async (prompt) => {
|
|
261
300
|
const res = await planRunner.runTaskStream({
|
|
262
301
|
objective: prompt,
|
|
263
302
|
...principalSpec(),
|
|
264
303
|
sessionId: `leader-route-${Date.now()}`,
|
|
304
|
+
signal,
|
|
265
305
|
...(cfg.routerModel ? { model: cfg.routerModel } : { modelRole: "classifier" }),
|
|
266
306
|
}).result();
|
|
267
307
|
return res.result ?? "";
|
|
@@ -285,7 +325,7 @@ export function createLeaderRunner(cfg) {
|
|
|
285
325
|
durableSpec = {
|
|
286
326
|
toolPolicy: combinePolicies(createDurableQuestionPolicy(), createDurableAskPolicy({ requireApproval: d.requireApproval, ...(d.deny ? { deny: d.deny } : {}), ...(d.autoBudget ? { autoBudget: d.autoBudget } : {}), ...(d.neverAuto ? { neverAuto: d.neverAuto } : {}) })),
|
|
287
327
|
checkpointStore: d.checkpointStore,
|
|
288
|
-
durableApproval: { scope:
|
|
328
|
+
durableApproval: { scope: LEADER_APPROVAL_SCOPE, ...(d.ttlMs ? { ttlMs: d.ttlMs } : {}) },
|
|
289
329
|
onQuestion: QUESTION_AWAITS_RESUME,
|
|
290
330
|
};
|
|
291
331
|
await d.checkpointStore.putCtx(sessionId, storedResumeCtx).catch((e) => {
|
|
@@ -300,7 +340,7 @@ export function createLeaderRunner(cfg) {
|
|
|
300
340
|
if (resourceCfg && !repairLoopActive && durable && cfg.toolResultStore && cfg.sessionStore) {
|
|
301
341
|
resourceSpec = {
|
|
302
342
|
checkpointStore: durable.checkpointStore,
|
|
303
|
-
resourceSuspend: { scope:
|
|
343
|
+
resourceSuspend: { scope: leaderResourceScope(sub.workerId), totalBudgetUsd: resourceCfg.totalBudgetUsd },
|
|
304
344
|
limits: { ...workerLimits.limits, maxCostUsd: resourceCfg.sliceMaxCostUsd },
|
|
305
345
|
maxSuspends: resourceCfg.maxSuspends,
|
|
306
346
|
};
|
|
@@ -350,7 +390,7 @@ export function createLeaderRunner(cfg) {
|
|
|
350
390
|
workerId: sub.workerId, sessionId, branch: sub.branch,
|
|
351
391
|
baseSha,
|
|
352
392
|
runner: keepCtxWarm(new Runner({
|
|
353
|
-
brain: cfg.brain, ...servedTableSeat, pricing: cfg.pricing, ...onNoticeSeat, ...governanceSeat, ...deploymentPostureSeat(), ...tracerSeat, ...usageWindowSeat, ...promptSourceSeat, ...onErrorSeat, ...modsSeat,
|
|
393
|
+
brain: cfg.brain, ...servedTableSeat, pricing: cfg.pricing, ...onNoticeSeat, ...governanceSeat, ...deploymentPostureSeat(), ...tracerSeat, ...usageWindowSeat, ...promptSourceSeat, ...onErrorSeat, ...modsSeat, ...handsSeat,
|
|
354
394
|
...(cfg.toolResultStore ? { toolResultStore: cfg.toolResultStore } : {}),
|
|
355
395
|
...(cfg.sessionStore ? { sessionStore: cfg.sessionStore } : {}),
|
|
356
396
|
executionEnvFactory: async (ctx) => {
|
|
@@ -375,7 +415,7 @@ export function createLeaderRunner(cfg) {
|
|
|
375
415
|
const baseSha = await sh(env)(`cd ${repo} && git rev-parse HEAD`);
|
|
376
416
|
return {
|
|
377
417
|
workerId: sub.workerId, sessionId, branch: sub.branch, baseSha,
|
|
378
|
-
runner: keepCtxWarm(new Runner({ brain: cfg.brain, ...servedTableSeat, pricing: cfg.pricing, ...onNoticeSeat, ...governanceSeat, ...deploymentPostureSeat(), ...tracerSeat, ...usageWindowSeat, ...promptSourceSeat, ...onErrorSeat, ...modsSeat, ...(cfg.toolResultStore ? { toolResultStore: cfg.toolResultStore } : {}), ...(cfg.sessionStore ? { sessionStore: cfg.sessionStore } : {}), executionEnv: env })),
|
|
418
|
+
runner: keepCtxWarm(new Runner({ brain: cfg.brain, ...servedTableSeat, pricing: cfg.pricing, ...onNoticeSeat, ...governanceSeat, ...deploymentPostureSeat(), ...tracerSeat, ...usageWindowSeat, ...promptSourceSeat, ...onErrorSeat, ...modsSeat, ...handsSeat, ...(cfg.toolResultStore ? { toolResultStore: cfg.toolResultStore } : {}), ...(cfg.sessionStore ? { sessionStore: cfg.sessionStore } : {}), executionEnv: env })),
|
|
379
419
|
diffEnv: env,
|
|
380
420
|
destroy: () => env.destroy().then(() => { }),
|
|
381
421
|
spec: withLeaderLeg({ ...workerLimits, ...sub.spec, ...durableSpec, ...resourceSpec, ...principalSpec() }, resumeBody),
|
|
@@ -419,6 +459,7 @@ export function createLeaderRunner(cfg) {
|
|
|
419
459
|
const push = createCoordinatorPush(body.durableRemote, body.targetRef, ident);
|
|
420
460
|
const deps = {
|
|
421
461
|
entry,
|
|
462
|
+
signal,
|
|
422
463
|
plan,
|
|
423
464
|
provisionWorker,
|
|
424
465
|
provisionIntegrationSandbox,
|
package/dist/lsp-evict.d.ts
CHANGED
|
@@ -8,9 +8,11 @@
|
|
|
8
8
|
* while the dir is rm'd (rooted there, it just sees ENOENT). Only the ephemeral lane is wrapped by the caller — the
|
|
9
9
|
* caller-cwd (deployment-shape row `callerCwd`) persistent-project path keeps its warm server (stable root, reused across turns = CC-parity, no leak).
|
|
10
10
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
11
|
+
* The manager is the one the mint point `createLspManager` returns (core `NodeLspManager`), typed by the one method used
|
|
12
|
+
* (`Pick<NodeLspManager, "evict">`: the class has private members, so a structural test stub could not stand in for the
|
|
13
|
+
* whole class type). The env stays structural: an env without a string `cwd` / callable `destroy` is returned UNWRAPPED
|
|
14
|
+
* (probe-guarded), so this is a safe no-op wherever that precondition doesn't hold.
|
|
14
15
|
*/
|
|
15
|
-
|
|
16
|
+
import type { NodeLspManager } from "@sema-agent/core";
|
|
17
|
+
export declare function evictLspOnDestroy<E extends object>(env: E, lsp: Pick<NodeLspManager, "evict">): E;
|
|
16
18
|
//# sourceMappingURL=lsp-evict.d.ts.map
|
package/dist/lsp-evict.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
export function evictLspOnDestroy(env, lsp) {
|
|
2
|
-
const evict = lsp?.evict;
|
|
3
2
|
const e = env;
|
|
4
|
-
if (typeof
|
|
3
|
+
if (typeof e.cwd !== "string" || typeof e.destroy !== "function")
|
|
5
4
|
return env;
|
|
6
5
|
const origDestroy = e.destroy.bind(e);
|
|
7
6
|
const root = e.cwd;
|
|
8
7
|
e.destroy = () => {
|
|
9
|
-
void evict
|
|
8
|
+
void lsp.evict(root).catch(() => { });
|
|
10
9
|
return origDestroy();
|
|
11
10
|
};
|
|
12
11
|
return env;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `memory-embedder-reembed.ts` —— 「清列重嵌」**确认口令**的单一属主:`MEMORY_EMBEDDER_REEMBED=<model>/<dimensions>`。
|
|
3
|
+
*
|
|
4
|
+
* ## 律(一句)
|
|
5
|
+
*
|
|
6
|
+
* embedder 指纹门(`plugins/memory-embedder-fingerprint.ts`)从不凭自己的判断清列:记下的身份与配置的身份对不上
|
|
7
|
+
* (changed / unattributed / unreadable 三态)⇒ 拒启;唯一出路是运维显式确认「把向量列清掉、按**这个**身份重嵌」——
|
|
8
|
+
* 口令的值就是**配置的那个身份**。口令绑定身份,所以它天然是一次性的:清完并记下这个身份之后,下一次起服判「相等」,
|
|
9
|
+
* 口令不再有东西可确认;之后再换一次模型,留着的旧口令对不上新配置 ⇒ 起服拒(不会替下一次换模型静默清列)。
|
|
10
|
+
*
|
|
11
|
+
* ## 为什么是一只顶层叶模块
|
|
12
|
+
*
|
|
13
|
+
* 两个消费方在不同层:`config.ts` 在 boot 期解析并判口令(拼错 / 对不上配置 ⇒ 拒启),指纹门在拒句里**写出**这条口令。
|
|
14
|
+
* config 层不得值引 plugins 层;口令的读写形只有一份,两层各按需引 —— 这是本文件存在的全部理由。零依赖。
|
|
15
|
+
*
|
|
16
|
+
* 句子里写给运维**照抄**的那条赋值只有一个写者 {@link formatReembedAssignment}:值按 POSIX 单引号包起(模型名可以含空格 / `$` / 引号,
|
|
17
|
+
* 不包就粘不进 shell);引号只是 shell 的写法,shell 读完赋给 env 的值仍是 `<model>/<dimensions>` 本身(config 读的就是它)。
|
|
18
|
+
*/
|
|
19
|
+
/** 口令那一键的名字(config 读它、门的拒句写它)。 */
|
|
20
|
+
export declare const MEMORY_EMBEDDER_REEMBED_ENV = "MEMORY_EMBEDDER_REEMBED";
|
|
21
|
+
/** 口令所确认的身份形(与指纹门的 `EmbedderIdentity` 同形;本叶不引 zod)。 */
|
|
22
|
+
export interface EmbedderIdentityToken {
|
|
23
|
+
readonly model: string;
|
|
24
|
+
readonly dimensions: number;
|
|
25
|
+
}
|
|
26
|
+
/** 身份 → 口令值:`<model>/<dimensions>`。模型名自身可以含 `/`(`BAAI/bge-m3`)—— 维度恒在**最后一个** `/` 之后。 */
|
|
27
|
+
export declare function formatEmbedderIdentityToken(identity: EmbedderIdentityToken): string;
|
|
28
|
+
/**
|
|
29
|
+
* 运维照抄的那条赋值:`MEMORY_EMBEDDER_REEMBED='<model>/<dimensions>'`。POSIX 单引号:值内唯一的元字符是 `'` 本身,写成 `'\''`
|
|
30
|
+
* (关引号、转义一个 `'`、再开引号)。拒句与 config 的出路句都经这里写,不各拼一份。
|
|
31
|
+
*/
|
|
32
|
+
export declare function formatReembedAssignment(identity: EmbedderIdentityToken): string;
|
|
33
|
+
/**
|
|
34
|
+
* 口令值 → 身份;形不对 ⇒ `undefined`(调用方拒启并给出期望形,不猜)。判据:最后一个 `/` 之前非空(模型名),
|
|
35
|
+
* 之后是十进制正整数(无前导零、无符号、无空白)。`true` / `1` / `yes` 这类「开关形」一律不是口令。
|
|
36
|
+
*/
|
|
37
|
+
export declare function parseEmbedderIdentityToken(raw: string): EmbedderIdentityToken | undefined;
|
|
38
|
+
//# sourceMappingURL=memory-embedder-reembed.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export const MEMORY_EMBEDDER_REEMBED_ENV = "MEMORY_EMBEDDER_REEMBED";
|
|
2
|
+
export function formatEmbedderIdentityToken(identity) {
|
|
3
|
+
return `${identity.model}/${identity.dimensions}`;
|
|
4
|
+
}
|
|
5
|
+
export function formatReembedAssignment(identity) {
|
|
6
|
+
return `${MEMORY_EMBEDDER_REEMBED_ENV}='${formatEmbedderIdentityToken(identity).replace(/'/g, "'\\''")}'`;
|
|
7
|
+
}
|
|
8
|
+
export function parseEmbedderIdentityToken(raw) {
|
|
9
|
+
const cut = raw.lastIndexOf("/");
|
|
10
|
+
if (cut <= 0)
|
|
11
|
+
return undefined;
|
|
12
|
+
const digits = raw.slice(cut + 1);
|
|
13
|
+
if (!/^[1-9][0-9]*$/.test(digits))
|
|
14
|
+
return undefined;
|
|
15
|
+
const dimensions = Number(digits);
|
|
16
|
+
if (!Number.isSafeInteger(dimensions))
|
|
17
|
+
return undefined;
|
|
18
|
+
return { model: raw.slice(0, cut), dimensions };
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=memory-embedder-reembed.js.map
|
|
@@ -1,31 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 记忆引擎 **incident 席**在本仓的唯一落点形。
|
|
3
|
-
*
|
|
4
|
-
* ## 为什么要一只共用工厂(而不是每个宿主各写一行 `logger.warn`)
|
|
5
|
-
* core 的记忆引擎有**两条**到宿主的披露路:
|
|
6
|
-
* · **mount 路**——`MemoryEngine` 自己的 `onIncident`,由 core 的 Runner 在 `prepare-memory` 里桥到
|
|
7
|
-
* `RunnerDeps.onError(err, { phase: "memory", sessionId })`(亲读 `dist/core/runner/prepare-memory.js`
|
|
8
|
-
* 的 `const onEngineIncident = (err) => deps.onError?.(err, { phase: "memory", sessionId })`);
|
|
9
|
-
* · **无锁公开面路**——`FileMemoryEngineBackend` 的**构造期** `onIncident`,是那条腿上唯一的披露口
|
|
10
|
-
* (`adoptLayoutLocked` 取 `onIncident ?? this.onIncident`)。
|
|
11
|
-
* 同一条事实(例如一次性的目录布局搬家)会按调用路径落到其中**一条**,而本仓有**两个宿主**
|
|
12
|
-
* (HTTP 服务的 `boot/runner-deps.ts` 与 `run-local.ts`)各自持有 `onError` 座。四个落点各写一行 =
|
|
13
|
-
* 四份会各自漂移的形;实际已经漂过一次:服务腿把整族印成 `memory_consolidation_failed`(只有一支是
|
|
14
|
-
* consolidation),run-local 腿把整族印成 `engine_error` 并用 `String(err)` 抹掉 `err.code`。
|
|
15
|
-
*
|
|
16
|
-
* ## 形(一处定义,四处引用)
|
|
17
|
-
* `memory_engine_incident` + `{ sessionId?, code?, detail }`,并计 `memory_engine_incident_total{code?}`。
|
|
18
|
-
* 🔴 `code` 是**结构化字段**而不是被折进散文:它是运维唯一能按名告警的那一位,而这一族里最要紧的几条
|
|
19
|
-
* (一次性布局搬家、无主根内容、控制面写失败)一辈子只发生一次 —— 折平就等于没说。
|
|
20
|
-
* 码的读法与 `boot/runner-deps.ts` 的 `onError` 汇点其余七条行**同一只**(`terminal.ts` 的 `codeFieldOf`:不抛的读口 + 码判官 `isCodeToken`):是码才带;
|
|
21
|
-
* 无码(core 里有大量不带 `.code` 的记忆相 Error)、不是串 / 空串、非 `Error` 抛出物、读取时抛、或带的不是码(超长 / 含空白 / 凭据形 —— 引擎错上的 `code` 是别人写的串)⇒ 行里**没有** `code` 键、
|
|
22
|
-
* 计数**没有** `code` 标签:不编码,也不写 `null` / `"none"` 之类的占位。
|
|
23
|
-
*
|
|
24
|
-
* ⚠️ 与三只 **operator 面**引擎座(`memory_compliance_incident` / `memory_origin_incident` /
|
|
25
|
-
* `memory_consolidation_incident`)**事件名刻意不合并**:那三条的事件名回答「哪一张操作面」,是三个产品面的
|
|
26
|
-
* 分辨位;本工厂回答「引擎事故席」,是同一件事的四个落点。合并会丢掉前者的分辨位。三座有自己的工厂
|
|
27
|
-
* {@link createOperatorFaceIncidentSink}(事件名由装配处点名),`code` 位与本工厂读同一只 `codeFieldOf`。
|
|
28
|
-
*/
|
|
29
1
|
import type { Logger } from "./observability/logger.js";
|
|
30
2
|
import type { Metrics } from "./observability/metrics.js";
|
|
31
3
|
/** 落点依赖。`metrics` 可缺席(run-local 的 backend 构造期座就没有计数面的消费者)。 */
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { recordFailOpen } from "./observability/fail-open.js";
|
|
2
|
+
import { isStoreFormRefusalCode } from "./memory-store-refusal.js";
|
|
1
3
|
import { redactIncarnations } from "./session-incarnation.js";
|
|
2
4
|
import { codeFieldOf } from "./terminal.js";
|
|
3
5
|
import { seatText } from "./trace/exit-seat.js";
|
|
@@ -10,6 +12,9 @@ export function createMemoryEngineIncidentSink(deps) {
|
|
|
10
12
|
detail: redactIncarnations(String(err)),
|
|
11
13
|
});
|
|
12
14
|
deps.metrics?.inc("memory_engine_incident_total", { ...codeField });
|
|
15
|
+
const { code } = codeField;
|
|
16
|
+
if (isStoreFormRefusalCode(code))
|
|
17
|
+
recordFailOpen("server.memory.store-form-refused-step-skipped", `code=${code}`);
|
|
13
18
|
};
|
|
14
19
|
}
|
|
15
20
|
export function createOperatorFaceIncidentSink(deps, event) {
|
|
@@ -178,9 +178,9 @@ export interface MemoryOriginFaces {
|
|
|
178
178
|
origin: MemoryEntryOrigin;
|
|
179
179
|
provenance: EntryProvenanceAccount;
|
|
180
180
|
}>>;
|
|
181
|
-
/** §13-4② 读半场:清标审计账(
|
|
182
|
-
*
|
|
183
|
-
listClearances: (at?: MemoryLayerSeat) => OriginClearanceRow[]
|
|
181
|
+
/** §13-4② 读半场:清标审计账(**异步** —— core 7.66.0 [ref] 起 `listOriginClearances` 经引擎的治理店读那份账(`Promise`;
|
|
182
|
+
* File 后端 = 同一份控制面文件、同字节);账本损坏 ⇒ `ControlPlaneCorruptError`,fail-closed,绝不回半张表)。 */
|
|
183
|
+
listClearances: (at?: MemoryLayerSeat) => Promise<OriginClearanceRow[]>;
|
|
184
184
|
/** §13-4② 写半场:审计化的 UN-MARK 阀门。拒因族是 core 的**闭集码**,本层零翻译原样上抛。 */
|
|
185
185
|
clear: (entryId: string, input: {
|
|
186
186
|
requestId: string;
|
|
@@ -199,7 +199,8 @@ export interface MemoryOriginFaces {
|
|
|
199
199
|
* ## 控制面归属:判据与合规两口**逐字同一条**(§1 F-9 裁),但理由更硬
|
|
200
200
|
*
|
|
201
201
|
* 亲读 core 5.59.0(不信 JSDoc,读 `engine.js` 实装):
|
|
202
|
-
* · `listOriginClearances` = `readOriginClearances(this.controlDir)`;
|
|
202
|
+
* · `listOriginClearances` = `readOriginClearances(this.controlDir)`(core 7.66.0 [ref] 起经引擎的治理店 `this.governanceStore` 读,答 `Promise`;
|
|
203
|
+
* 本族只挂在自带控制面的 File 后端上,那只店就是同一控制面上的 File 店 —— 同目录、同名、同字节);
|
|
203
204
|
* · `clearEntryOrigin` 整条弧都压在 `this.controlDir` 上 —— 写前开行(`openOriginClearance`)、
|
|
204
205
|
* 墓碑落定登记(`markOriginClearanceTombstoned`)、终态事件(`settleOriginClearance`);
|
|
205
206
|
* · `listExternalOriginEntries` 每一行都要 `provenanceOf`,而它读 `challengedEntryIds` /
|
|
@@ -80,7 +80,7 @@ export function createMemoryOriginFaces(stores, opts) {
|
|
|
80
80
|
});
|
|
81
81
|
return {
|
|
82
82
|
listExternal: async (scopes) => engineOf(memoryStoreForRequest(stores, scopes)).listExternalOriginEntries(scopes),
|
|
83
|
-
listClearances: (at) => engineOf(memoryStoreForRequest(stores, seatLayers(at))).listOriginClearances(),
|
|
83
|
+
listClearances: async (at) => engineOf(memoryStoreForRequest(stores, seatLayers(at))).listOriginClearances(),
|
|
84
84
|
clear: async (entryId, input, at) => engineOf(memoryStoreForRequest(stores, seatLayers(at))).clearEntryOrigin(entryId, input),
|
|
85
85
|
};
|
|
86
86
|
}
|
package/dist/memory-scope.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { FileMemoryEngineBackend, type TaskSpec } from "@sema-agent/core";
|
|
2
2
|
import type { ServiceConfig } from "./config-types.js";
|
|
3
3
|
import { type ExecutionLane } from "./execution-lane-caps.js";
|
|
4
|
+
import type { Logger } from "./observability/logger.js";
|
|
4
5
|
import { type MemoryProjectKey, type ProjectLayerOfTask } from "./project-identity.js";
|
|
5
6
|
/** 前缀词表本体(供门/诊断读;判定一律走 {@link isV2ScopeKey},别在别处重写 startsWith 链)。 */
|
|
6
7
|
export declare const V2_SCOPE_PREFIXES: readonly string[];
|
|
@@ -57,7 +58,7 @@ export declare function memoryScopeFor(config: ServiceConfig, principal?: string
|
|
|
57
58
|
*
|
|
58
59
|
* **一条规则,与车道无关**(主会话 09-23 裁 ②):项目根 = spec 解析出的**真任务根**(`boot/resolve-spec.ts`
|
|
59
60
|
* 的 `realTaskRootOf`,[ref] 属主;run-local 腿 = 它的 `workspaceDir`)。本进程读得到这个根 ⇒ 求项目身份并铸项目层键
|
|
60
|
-
* (
|
|
61
|
+
* (无手的 `none` 车道的真任务根是 `process.cwd()`,读得到,所以照常铸 —— 它的语义就是「项目 = 任务根指向的地方」,不需要另一个词);
|
|
61
62
|
* 读不到(根在沙箱/设备盘上,或 host 车道会话没登记 cwd、spec 期还不知道根)⇒ 调用方传 `undefined` ⇒ `{ absent: "unreadable" }`,
|
|
62
63
|
* core 铸 operator 通知 `memory.project_scope_absent`,写照常落全局层 —— **响亮**,不是静默落 `local`。
|
|
63
64
|
*
|
|
@@ -106,7 +107,7 @@ export declare function replicatesProjectLayersOf(coverage: MemoryReplicationCov
|
|
|
106
107
|
* (`MEMORY_ENGINE_REMOTE_LANE=allow`, e.g. ssh to a host on the same NFS mount).
|
|
107
108
|
*
|
|
108
109
|
* Pure posture probe (memoryEngineBackendFor consumes it; main.ts logs it): `undefined` = no plane split
|
|
109
|
-
* (the lane's file plane IS this worker's fs — `
|
|
110
|
+
* (the lane's file plane IS this worker's fs — `none` / `host`), `dark` = split + fail-closed, `forced` =
|
|
110
111
|
* split + operator override.
|
|
111
112
|
* The plane question reads the execution environment block (`hostLocalPaths`, sole author `capabilitiesFor`) — it used to be the
|
|
112
113
|
* hand-written synonym `lane === undefined || lane === "host"`; readings are unchanged lane by lane.
|
|
@@ -177,17 +178,26 @@ export declare function fileMemoryEngineRoot(config: Pick<ServiceConfig, "memory
|
|
|
177
178
|
* 一条路径的**规范形**(给 {@link judgeMemoryRootOutsideDataRoot} 的 `canonical` 座用的生产实现):
|
|
178
179
|
* · 既存的绝对路径 ⇒ **原样**交给 `realpath`(`.native`:大小写不敏感的文件系统上返回盘上的拼写;符号链接、macOS 的 `/var` → `/private/var` 在这一步展平)。
|
|
179
180
|
* 不先在字串上折 `..`:操作系统在展开符号链接**之后**才折 `..`,`/link/..` 的真身是链接目标的父目录,字串折叠会把它读成 `/`;
|
|
180
|
-
* · 其余(尚不存在 / 相对)⇒
|
|
181
|
+
* · 其余(尚不存在 / 相对)⇒ 绝对化(**不折叠**)后逐段走:既存的前缀每进一段取一次 `realpath`(符号链接在这一步展开),`..` 折在**已展开**的前缀上 ——
|
|
182
|
+
* 与操作系统同序(`/别名/../新目录` 的真身在链接目标的父目录下;先在字串上折会读成别名的父目录,判到另一只挂载上);第一段不存在起,余下是尚不存在的尾巴
|
|
183
|
+
* (尾巴只做字串规范化,与 `mkdir -p` 建出来的同形)。
|
|
181
184
|
*
|
|
182
185
|
* 为什么按「最深既存祖先」而不是直接 `realpath(p)`:boot 期记忆根常常还没建出来(新数据根),`realpath` 对不存在的路径抛 ENOENT,
|
|
183
186
|
* 而数据根那一侧已经存在、会被展平 —— 两侧拼写空间不一样,同一个目录会被读成「不在其下」。祖先用 `existsSync` 找(它对 ENOENT / ENOTDIR / EACCES / ELOOP
|
|
184
187
|
* 一律答 `false`,不抛),所以走到的那一级一定 stat 得动;`realpath` 仍可能在「探完到取值之间目录被挪走 / 搜索权限被收」的竞态里抛 ——
|
|
185
188
|
* 不在本函数里吞(吞了就是一条无声的降级臂),由 boot 调用点接住并响亮报一行(`memory_engine_dir_check_unavailable`),起服照常。
|
|
186
189
|
*
|
|
187
|
-
* 取舍:尾巴(不存在的那几段)
|
|
190
|
+
* 取舍:尾巴(不存在的那几段)只比规范化字串,**不折大小写**,尾巴里的 `..` 按字串折:两个只差大小写、且都还不存在的拼写在大小写不敏感的盘上会被读成两处 ——
|
|
188
191
|
* 方向是多报一条 warn(这条判据的失败方向),不会漏报。
|
|
189
192
|
*/
|
|
190
193
|
export declare function canonicalPathOf(p: string): string;
|
|
194
|
+
/**
|
|
195
|
+
* **路径包含**(含相等)的判官:`child` 是不是 `root` 本身或它的后代 —— `path.relative(canonical(root), canonical(child))` 不是 `..`、不以 `..` 加分隔符起头、也不是绝对路径(跨盘符)。
|
|
196
|
+
* `..` 要按**整段**判:名为 `..data` 的子目录在其下;`startsWith("..")` 会把它读成在其外。`canonical` 座缺省 `path.resolve`(字串规范形),boot 递 {@link canonicalPathOf} 取符号链接展平后的形;
|
|
197
|
+
* 两侧同一只座(先 root、后 child)。读者两处:记忆根「在数据根之外」那一判({@link judgeMemoryRootOutsideDataRoot})与起服时「配置根是不是工作区的祖先」那一判(`sema-config-dir.ts`);
|
|
198
|
+
* 树里别处内联的同形表达式(`boot/deployment-mods.ts` · `plugins/local-data-dir-modes-m39.ts` · `plugins/remote-env-host.ts` · `plugins/worktree-isolation.ts`)不在本次收口范围。
|
|
199
|
+
*/
|
|
200
|
+
export declare function pathIsWithin(root: string, child: string, canonical?: (p: string) => string): boolean;
|
|
191
201
|
/** {@link judgeMemoryRootOutsideDataRoot} 的读数:记忆引擎的根落在本机数据根**之外**。三键即 boot 日志行的字段(`hint` 是一句带两条真路径的人话)。 */
|
|
192
202
|
export type MemoryRootOutsideDataRoot = {
|
|
193
203
|
readonly root: string;
|
|
@@ -273,6 +283,23 @@ onIncident?: (err: Error & {
|
|
|
273
283
|
backend: FileMemoryEngineBackend;
|
|
274
284
|
root: string;
|
|
275
285
|
} | undefined;
|
|
286
|
+
/**
|
|
287
|
+
* **起服期读 file 记忆控制面账本的形:一行 warn,不拒启**([ref])。
|
|
288
|
+
*
|
|
289
|
+
* 病:core >= 7.64.0 的 File 记忆店不再升级「绑定之前」的旧形账本(裸 id → rev 映射)—— 构造器既不碰盘也不抛,读账本的那一刻才抛
|
|
290
|
+
* `ControlPlaneCorruptError`,本仓的记忆面把它答成 `500 internal.memory_control_plane_corrupt`(`http/memory-face-fault-reply.ts`)。
|
|
291
|
+
* 于是升级前账本还是旧形(或任何引擎拒的形)的 file 记忆部署,升级后**起服一切正常、第一次读账本的记忆面才 500**,起服日志里零提示。
|
|
292
|
+
*
|
|
293
|
+
* 读法:只经 core 导出读口 `readMemoryLedgerForm`(只读、不升级、不加锁、不建文件)问「账本是什么形」—— 本仓不自读账本文件、不认它的文件名
|
|
294
|
+
* (一件事一个读者)。答词是闭集三个,穷尽 `switch`。位置 = 构造 file 后端之前:boot 与 run-local 两个宿主各在 {@link memoryEngineBackendFor} 前调一次;
|
|
295
|
+
* 坐标取 {@link fileMemoryPlaneFor} 单铸点,与那只工厂同门(工厂不接线的部署形 —— 多租户 / `MEMORY_ENGINE=off` / 平面分裂车道未 allow —— 这里也不读)。
|
|
296
|
+
*
|
|
297
|
+
* 失败方向:**披露面,不拒启**(不是安全轴;拒启要新码、另票):
|
|
298
|
+
* · `malformed` ⇒ 一行 warn `memory_ledger_malformed`(`root` 数据根 · `controlDir` 控制面目录 · `hint` 一句带出路的话);`v2` / `absent` ⇒ 零输出;
|
|
299
|
+
* · 读口自己抛(账本路径是目录 / 无权读 / 环路:引擎答「没有形」,既不是 `absent` 也不是 `malformed`)⇒ 另报一行 `memory_ledger_check_unavailable`
|
|
300
|
+
* (类名 + 机器码,不带消息原文,与 `memory_engine_dir_check_unavailable` 同形),照常起服,不编一个形。
|
|
301
|
+
*/
|
|
302
|
+
export declare function announceMemoryLedgerForm(config: ServiceConfig, fallbackRoot: string | undefined, log: Logger): Promise<void>;
|
|
276
303
|
/**
|
|
277
304
|
* core 7.49.0 [ref] —— **记忆店根搬动 ⇒ 拒启**(不降级)。店根的物理路径是控制面里的一条记录(`root-anchor.json`),每次打开都比对;
|
|
278
305
|
* 目录被搬走 / 换成指向别处的链接之后,File 后端的**构造器**就抛 `memory.target_outside_store`(`detail` 恰在这一形上带
|
package/dist/memory-scope.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { existsSync, realpathSync } from "node:fs";
|
|
2
|
-
import {
|
|
3
|
-
import { FileMemoryEngineBackend, resolveMemoryEngineRoot, deriveControlPlaneDir, formatUserScope, formatProjScope, normalizeMemorySpec } from "@sema-agent/core";
|
|
2
|
+
import { dirname, isAbsolute, join, parse, relative, resolve, sep } from "node:path";
|
|
3
|
+
import { FileMemoryEngineBackend, readMemoryLedgerForm, resolveMemoryEngineRoot, deriveControlPlaneDir, formatUserScope, formatProjScope, normalizeMemorySpec } from "@sema-agent/core";
|
|
4
4
|
import { capabilitiesFor, executionLaneOf } from "./execution-lane-caps.js";
|
|
5
|
+
import { errorCodeOf, errorKindOf } from "./observability/err-text.js";
|
|
5
6
|
import { assertMemoryScopeWidth } from "./plugins/memory-key-guards.js";
|
|
6
7
|
import { projectLayerForTaskRoot } from "./project-identity.js";
|
|
7
8
|
import { parseProjectLayerKey, projectLayerOwnerOf } from "./project-layer-key.js";
|
|
@@ -68,7 +69,7 @@ export function replicatesProjectLayersOf(coverage, owner) {
|
|
|
68
69
|
}
|
|
69
70
|
}
|
|
70
71
|
export function memoryEngineRemoteLanePosture(config) {
|
|
71
|
-
const lane =
|
|
72
|
+
const lane = config.remoteExec.provider;
|
|
72
73
|
if (capabilitiesFor(config).hostLocalPaths)
|
|
73
74
|
return undefined;
|
|
74
75
|
return { lane, posture: config.memoryEngineRemoteLaneAllowed === true ? "forced" : "dark" };
|
|
@@ -113,25 +114,40 @@ export function fileMemoryEngineRoot(config, fallbackRoot) {
|
|
|
113
114
|
export function canonicalPathOf(p) {
|
|
114
115
|
if (isAbsolute(p) && existsSync(p))
|
|
115
116
|
return realpathSync.native(p);
|
|
116
|
-
const abs =
|
|
117
|
-
|
|
117
|
+
const abs = isAbsolute(p) ? p : `${process.cwd()}${sep}${p}`;
|
|
118
|
+
const { root } = parse(abs);
|
|
119
|
+
let existing = root;
|
|
118
120
|
const tail = [];
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
121
|
+
for (const seg of abs.slice(root.length).split(sep === "\\" ? /[\\/]+/ : /\/+/)) {
|
|
122
|
+
if (seg === "" || seg === ".")
|
|
123
|
+
continue;
|
|
124
|
+
if (tail.length > 0) {
|
|
125
|
+
if (seg === "..")
|
|
126
|
+
tail.pop();
|
|
127
|
+
else
|
|
128
|
+
tail.push(seg);
|
|
129
|
+
continue;
|
|
130
|
+
}
|
|
131
|
+
if (seg === "..") {
|
|
132
|
+
existing = dirname(existing);
|
|
133
|
+
continue;
|
|
134
|
+
}
|
|
135
|
+
const next = join(existing, seg);
|
|
136
|
+
if (existsSync(next))
|
|
137
|
+
existing = realpathSync.native(next);
|
|
138
|
+
else
|
|
139
|
+
tail.push(seg);
|
|
125
140
|
}
|
|
126
|
-
return join(
|
|
141
|
+
return join(existing, ...tail);
|
|
142
|
+
}
|
|
143
|
+
export function pathIsWithin(root, child, canonical = resolve) {
|
|
144
|
+
const rel = relative(canonical(root), canonical(child));
|
|
145
|
+
return rel !== ".." && !rel.startsWith(`..${sep}`) && !isAbsolute(rel);
|
|
127
146
|
}
|
|
128
147
|
export function judgeMemoryRootOutsideDataRoot(a) {
|
|
129
148
|
if (!a.dataRoot)
|
|
130
149
|
return undefined;
|
|
131
|
-
|
|
132
|
-
const rel = relative(canonical(a.dataRoot), canonical(a.memoryRoot));
|
|
133
|
-
const inside = rel !== ".." && !rel.startsWith(`..${sep}`) && !isAbsolute(rel);
|
|
134
|
-
if (inside)
|
|
150
|
+
if (pathIsWithin(a.dataRoot, a.memoryRoot, a.canonical))
|
|
135
151
|
return undefined;
|
|
136
152
|
return {
|
|
137
153
|
root: a.memoryRoot,
|
|
@@ -171,6 +187,39 @@ export function memoryEngineBackendFor(config, fallbackRoot, onIncident) {
|
|
|
171
187
|
}
|
|
172
188
|
return { backend, root: plane.root };
|
|
173
189
|
}
|
|
190
|
+
const MEMORY_LEDGER_MIGRATION_EXIT = "先用上一版引擎开一次再升级";
|
|
191
|
+
export async function announceMemoryLedgerForm(config, fallbackRoot, log) {
|
|
192
|
+
const plane = fileMemoryPlaneFor(config, fallbackRoot);
|
|
193
|
+
if (plane === undefined)
|
|
194
|
+
return;
|
|
195
|
+
const where = { root: plane.root, controlDir: plane.controlDir };
|
|
196
|
+
let form;
|
|
197
|
+
try {
|
|
198
|
+
form = await readMemoryLedgerForm(plane.controlDir);
|
|
199
|
+
}
|
|
200
|
+
catch (err) {
|
|
201
|
+
log.warn("memory_ledger_check_unavailable", { ...where, errorKind: errorKindOf(err), errorCode: errorCodeOf(err) });
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
switch (form) {
|
|
205
|
+
case "v2":
|
|
206
|
+
case "absent":
|
|
207
|
+
return;
|
|
208
|
+
case "malformed":
|
|
209
|
+
log.warn("memory_ledger_malformed", {
|
|
210
|
+
...where,
|
|
211
|
+
hint: `the memory control plane at ${plane.controlDir} holds a committed-rev ledger this engine refuses to read — the memory faces that read it answer ` +
|
|
212
|
+
`500 internal.memory_control_plane_corrupt (the server itself starts regardless). If it is the pre-binding v1 form (a bare id → rev map, no longer ` +
|
|
213
|
+
`upgraded on open), the exit is, from MIGRATION.md: 「${MEMORY_LEDGER_MIGRATION_EXIT}」`,
|
|
214
|
+
});
|
|
215
|
+
return;
|
|
216
|
+
default: {
|
|
217
|
+
const unknownForm = form;
|
|
218
|
+
log.warn("memory_ledger_check_unavailable", { ...where, errorKind: `UnknownLedgerForm:${String(unknownForm)}` });
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
174
223
|
export function memoryStoreRootMovedRefusal(e) {
|
|
175
224
|
const err = e;
|
|
176
225
|
const d = err?.detail;
|
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* **店形拒**(store-form refusal)在本仓的唯一读法属主(纯叶:零 http / 零 boot 依赖)—— core
|
|
2
|
+
* **店形拒**(store-form refusal)在本仓的唯一读法属主(纯叶:零 http / 零 boot 依赖)—— core 店形拒**一族**(族表 `STORE_FORM_REFUSAL_CODES`,引擎 7.66.0 起四码;
|
|
3
|
+
* 本仓按族读,下面点名的成员只是举例与历史,不是判据):
|
|
3
4
|
* · `memory.target_outside_store`(core 7.31.1 [ref]):记忆 store 里的一个目录经软链通到了 store **外**(或 store 根在 backend 打开 / 引擎首次
|
|
4
5
|
* 挂载之后被改指)⇒ 引擎对落点在外的删 / 写 / 重放 / 自身写一律**不做**;
|
|
5
6
|
* · `memory.scope_home_not_directory`(core 7.44.0 [ref]):一只 scope home(`<memoryDir>/<label>`)不是真目录 —— 被换成软链 / 普通文件 / 特殊文件
|
|
6
7
|
* (`detail.form` ∈ `symlink` | `file` | `other`,`lstat` 判、不跟链)。修前 core 对这一形抛不带码的 `ControlPlaneCorruptError`(与真控制面损坏同类同形),
|
|
7
|
-
* 平铺布局(条目直接住在 home 里)于是答 500,而同一换法在嵌套布局下一层答 409 ——
|
|
8
|
-
*
|
|
8
|
+
* 平铺布局(条目直接住在 home 里)于是答 500,而同一换法在嵌套布局下一层答 409 —— 现在两布局同答这一码;
|
|
9
|
+
* · `memory.control_plane_links_unsupported`(core 7.65.0):记忆控制面所在的文件系统不能建硬链接 ⇒ File 记忆店在打开处被拒(构造期抛 ⇒ 起服拒;
|
|
10
|
+
* 引擎 mount 时开它自己的店被拒 ⇒ Runner 记忆相 fail-open,这一跑 memoryless,见 `memory-incident-sink.ts`);
|
|
11
|
+
* · `memory.control_plane_strays`(core 7.66.0 [ref] HB-5):后端自带治理店(不是引擎控制面上那只 File 店),而控制面里还留着旧的治理文档 /
|
|
12
|
+
* 控制对象 ⇒ 引擎构造期拒、一个字节不写(句子点名 `adoptReplicaControlPlane`)。本服务三种后端都构造不出这一形(File 后端钉住自己的控制面、
|
|
13
|
+
* 治理店就是那只;SQL 两只不带治理店 ⇒ 引擎用控制面上的 File 店)—— 按族入族,零专门臂。
|
|
14
|
+
* 族里各码的形相同:普通 `Error` + `.code` + `.detail`(`{ path }`;home 那一码多 `form`),**句子以码领头、不含任何宿主路径**(core 7.44.0 起,
|
|
9
15
|
* 路径只在 `detail.path`)。core 的读法:operator 要处置的盘形(去掉那只链 / 放回真目录),**不是**可重试的 IO 故障,也**不是**对调用方的裁决;
|
|
10
|
-
*
|
|
16
|
+
* 盘形修好之前重发恒拒。本仓据此一条规则:族内同答、409、码原样;路径只进运维行(HTTP 映射一处,见 `http/memory-store-refusal-reply.ts`)。
|
|
11
17
|
*
|
|
12
18
|
* ## 两条到达车道,两个读者(本模块各给一只,别处不许再写第二份判据)
|
|
13
19
|
* ① **抛出面**(抹除 / 出处 / 外源列表 / 清标 / bundle 导出导入 —— 凡触 store 树的 backend 面):`.code` 就是码
|
|
@@ -36,6 +42,16 @@
|
|
|
36
42
|
*/
|
|
37
43
|
import { type ScopeHomeForm, type StoreFormRefusalCode } from "@sema-agent/core";
|
|
38
44
|
import type { Logger } from "./observability/logger.js";
|
|
45
|
+
/**
|
|
46
|
+
* 词表与型全取 core 包根([ref] / core 7.45.0 [ref];此前 core 不导出,本文件自写两只码字面量与族表 —— 那份手抄随本版退役):
|
|
47
|
+
* · 族 = `STORE_FORM_REFUSAL_CODES`,型 `StoreFormRefusalCode`;族判只读族表、不点成员(族的成员归 core,不在这里由人裁)。HTTP 映射逐码写字面量
|
|
48
|
+
* (错误码目录门扫源码字面量,变量态的码对它隐形),两处穷举:`http/memory-store-refusal-reply.ts`(operator 面)与 `http/memory-compliance-failure-reply.ts`(会话所有者面)——
|
|
49
|
+
* 引擎加一码 ⇒ 两处编译红、各补一臂(引擎 7.65.0 的第三码 `CONTROL_PLANE_LINKS_UNSUPPORTED` 就是这样补的);记忆相上撞到它的 fail-open 臂〔mount 开店被拒 / mount 后的一步记忆活被拒〕在 `memory-incident-sink.ts` 登记;
|
|
50
|
+
* · 抛出面的形 = `StoreFormRefusal`(普通 `Error` + `code` + `detail: StoreFormRefusalDetail`);
|
|
51
|
+
* · `detail.form` 的闭集 = `SCOPE_HOME_FORMS`(型 `ScopeHomeForm`):闭集内原样读,闭集外不读(引擎说不出的词不进运维行)。
|
|
52
|
+
*/
|
|
53
|
+
/** 族判(族表 `STORE_FORM_REFUSAL_CODES` 的唯一判据):{@link storeFormRefusalOf} 用它判抛出面的 `.code`;记忆事故席用它判 `codeFieldOf` 已经读出的码(那一席码只许读一次)。 */
|
|
54
|
+
export declare const isStoreFormRefusalCode: (code: unknown) => code is StoreFormRefusalCode;
|
|
39
55
|
/** 一次店形拒的读数(纯数据)。`path` / `form` 取自 core 的 `detail`(读不出 ⇒ `undefined`,不猜、不从句子里抠)。 */
|
|
40
56
|
export interface StoreFormRefusalReading {
|
|
41
57
|
readonly code: StoreFormRefusalCode;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SCOPE_HOME_FORMS, STORE_FORM_REFUSAL_CODES } from "@sema-agent/core";
|
|
2
|
-
const isStoreFormRefusalCode = (code) => STORE_FORM_REFUSAL_CODES.includes(code);
|
|
2
|
+
export const isStoreFormRefusalCode = (code) => STORE_FORM_REFUSAL_CODES.includes(code);
|
|
3
3
|
const isScopeHomeForm = (form) => SCOPE_HOME_FORMS.includes(form);
|
|
4
4
|
export function storeFormRefusalOf(err) {
|
|
5
5
|
if (!(err instanceof Error))
|