@sema-agent/server 7.147.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 +1039 -24
- package/README.md +20 -7
- package/README.zh-CN.md +14 -8
- package/USAGE.md +380 -163
- package/deploy/sema-up/README.md +16 -5
- package/deploy/sema-up/chart/templates/NOTES.txt +1 -1
- package/deploy/sema-up/chart/templates/_helpers.tpl +20 -4
- package/deploy/sema-up/chart/values.yaml +3 -2
- package/deploy/sema-up/cluster-up.sh +74 -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/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/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 +14 -39
- 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 +13 -1
- package/deploy/sema-up/stack/sema-stack-cluster.yaml +21 -0
- 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 +28 -30
- 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 +13 -11
- package/dist/approval.js +3 -3
- package/dist/audit.d.ts +10 -3
- package/dist/audit.js +15 -7
- 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 +5 -2
- 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/deployment-mods.d.ts +1 -1
- package/dist/boot/execution-env.d.ts +17 -7
- package/dist/boot/execution-env.js +37 -31
- package/dist/boot/exit-boundary.d.ts +2 -2
- package/dist/boot/exit-boundary.js +6 -5
- package/dist/boot/fatal-exit.d.ts +3 -5
- package/dist/boot/fatal-exit.js +2 -2
- package/dist/boot/leader.d.ts +15 -0
- package/dist/boot/leader.js +17 -15
- package/dist/boot/memory-consolidation.d.ts +37 -29
- package/dist/boot/memory-consolidation.js +11 -5
- package/dist/boot/org-memory.js +1 -1
- package/dist/boot/parked-revive-gate.js +2 -2
- package/dist/boot/reapers.d.ts +4 -3
- package/dist/boot/reapers.js +19 -16
- package/dist/boot/resolve-spec.d.ts +5 -3
- package/dist/boot/resolve-spec.js +55 -67
- package/dist/boot/retention-lane.d.ts +4 -4
- 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 +16 -7
- package/dist/boot/session-faces.js +114 -94
- package/dist/boot/shutdown.d.ts +5 -4
- package/dist/boot/shutdown.js +6 -4
- package/dist/boot/stage-01-config.js +9 -1
- package/dist/boot/stage-02-web-admin-pull.d.ts +1 -0
- package/dist/boot/stage-02-web-admin-pull.js +6 -1
- package/dist/boot/stage-03-store-backend.d.ts +3 -0
- package/dist/boot/stage-03-store-backend.js +4 -3
- package/dist/boot/stage-04-stores.d.ts +2 -0
- package/dist/boot/stage-04-stores.js +2 -2
- package/dist/boot/stage-05-execution-env.d.ts +7 -3
- package/dist/boot/stage-05-execution-env.js +2 -2
- package/dist/boot/stage-06-runners.d.ts +10 -12
- package/dist/boot/stage-06-runners.js +23 -15
- package/dist/boot/stage-07-capability-layer.d.ts +11 -8
- package/dist/boot/stage-07-capability-layer.js +5 -3
- package/dist/boot/stage-08-reapers.d.ts +11 -8
- package/dist/boot/stage-08-reapers.js +3 -3
- package/dist/boot/stage-09-leader.d.ts +12 -15
- package/dist/boot/stage-09-leader.js +12 -4
- package/dist/boot/stage-10-http-server.d.ts +12 -15
- package/dist/boot/stage-10-http-server.js +7 -4
- package/dist/boot/store-evidence.d.ts +20 -0
- package/dist/boot/store-evidence.js +13 -0
- package/dist/boot/stores.d.ts +3 -0
- package/dist/boot/stores.js +21 -10
- 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 +55 -35
- 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 +7 -1
- package/dist/capabilities/center-plugins.js +32 -10
- package/dist/capabilities/center-wiring.js +1 -1
- package/dist/capabilities/composite-members.d.ts +2 -2
- package/dist/capabilities/composite-members.js +2 -2
- package/dist/capabilities/repo-tools.d.ts +2 -0
- package/dist/capabilities/repo-tools.js +14 -12
- package/dist/capabilities/scenarios.d.ts +6 -15
- package/dist/capabilities/scenarios.js +11 -16
- package/dist/capabilities/skills.d.ts +1 -1
- package/dist/capabilities/tool-defer.d.ts +1 -1
- package/dist/capability-facts.d.ts +38 -11
- package/dist/capability-facts.js +47 -8
- 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 +7 -3
- package/dist/config-catalog.d.ts +16 -1
- package/dist/config-catalog.js +62 -56
- package/dist/config-dir-trust.d.ts +37 -4
- package/dist/config-dir-trust.js +88 -44
- package/dist/config-invariants.d.ts +42 -3
- package/dist/config-invariants.js +69 -5
- package/dist/config-lkg.d.ts +23 -1
- package/dist/config-lkg.js +17 -3
- package/dist/config-provider.d.ts +9 -9
- package/dist/config-provider.js +25 -110
- package/dist/config-pull-failure.d.ts +50 -0
- package/dist/config-pull-failure.js +48 -0
- package/dist/config-types.d.ts +26 -17
- package/dist/config.d.ts +8 -16
- package/dist/config.js +113 -47
- package/dist/delegated-session-owner.d.ts +1 -1
- package/dist/deleted-session-ids.d.ts +3 -2
- package/dist/deployment-governance.d.ts +3 -3
- package/dist/deployment-shape.d.ts +30 -4
- package/dist/deployment-shape.js +7 -0
- 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.js +2 -1
- package/dist/env-witness.d.ts +7 -0
- package/dist/env-witness.js +16 -0
- package/dist/execution-lane-caps.d.ts +5 -18
- package/dist/execution-lane-caps.js +0 -22
- package/dist/execution-placement.d.ts +58 -18
- package/dist/execution-placement.js +41 -2
- 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.js +1 -0
- 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 +3 -3
- 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 +23 -3
- package/dist/history-anchor.js +24 -4
- 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/hook-llm.d.ts +5 -1
- package/dist/hooks/hook-llm.js +24 -15
- package/dist/hooks/hook-runner.d.ts +67 -57
- package/dist/hooks/hook-runner.js +260 -186
- 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 +3 -3
- package/dist/http/approval-sweeps.js +54 -30
- package/dist/http/caller-trust.d.ts +8 -10
- package/dist/http/caller-trust.js +1 -2
- package/dist/http/claim-heartbeat.d.ts +49 -0
- package/dist/http/claim-heartbeat.js +46 -0
- package/dist/http/claimed-run.d.ts +4 -3
- package/dist/http/dispatch.d.ts +8 -1
- package/dist/http/dispatch.js +76 -30
- package/dist/http/durable-run-leg.d.ts +3 -3
- package/dist/http/durable-run-leg.js +17 -12
- package/dist/http/execution-context.d.ts +17 -43
- package/dist/http/execution-context.js +7 -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 +4 -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 +1 -1
- package/dist/http/memory-store-refusal-reply.js +3 -0
- package/dist/http/owner-access.d.ts +391 -67
- package/dist/http/owner-access.js +371 -35
- package/dist/http/principal-gate.d.ts +24 -81
- package/dist/http/principal-gate.js +24 -68
- package/dist/http/refusal-body.d.ts +35 -2
- package/dist/http/refusal-body.js +34 -0
- package/dist/http/request-guards.d.ts +9 -13
- 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 +21 -18
- package/dist/http/resume-legs.js +189 -129
- package/dist/http/retired-skill-manifest.d.ts +1 -1
- package/dist/http/route-ctx.d.ts +25 -32
- 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 +70 -65
- 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 +15 -18
- package/dist/http/routes/config-catalog.js +2 -2
- package/dist/http/routes/devices.d.ts +3 -3
- package/dist/http/routes/devices.js +4 -4
- 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 +2 -0
- 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 +10 -19
- 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 +1 -1
- package/dist/http/routes/projects.js +3 -2
- package/dist/http/routes/retention-ops.js +6 -9
- package/dist/http/routes/rules.js +20 -5
- 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 +146 -231
- 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 +21 -20
- package/dist/http/routes/sessions-list.d.ts +3 -3
- package/dist/http/routes/sessions-list.js +9 -9
- package/dist/http/routes/sessions.js +87 -124
- package/dist/http/routes/shared-memory.js +6 -6
- package/dist/http/routes/side-query.js +2 -2
- package/dist/http/routes/tasks.js +136 -120
- 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 +39 -40
- package/dist/http/server.js +36 -11
- 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 +12 -0
- package/dist/http/stored-body-replay.js +2 -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 +4 -3
- package/dist/identity-source.d.ts +36 -5
- package/dist/identity-source.js +27 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- 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-operator-faces.d.ts +5 -4
- package/dist/memory-operator-faces.js +1 -1
- package/dist/memory-scope.d.ts +29 -2
- package/dist/memory-scope.js +64 -15
- package/dist/memory-store-refusal.d.ts +5 -2
- package/dist/memory-sync-client.d.ts +3 -2
- package/dist/memory-sync-client.js +6 -3
- package/dist/model-compat.d.ts +17 -8
- package/dist/model-compat.js +6 -2
- 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 +35 -16
- package/dist/model-entry-refusal.js +40 -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 +23 -14
- package/dist/namespaced-rule-name.js +8 -11
- 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 +58 -38
- package/dist/observability/fail-open.js +60 -38
- package/dist/observability/logger.d.ts +22 -1
- package/dist/observability/logger.js +89 -12
- package/dist/observability/metrics.js +3 -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/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-completion-inbox.d.ts +3 -3
- package/dist/orchestration/workflow-completion-inbox.js +3 -2
- package/dist/org-delivery-gate.d.ts +5 -4
- package/dist/org-delivery-gate.js +7 -6
- 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 +67 -5
- package/dist/parked-decide.js +127 -5
- 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 +18 -7
- package/dist/plugins/approval-ask-store-file.js +37 -14
- package/dist/plugins/approval-ask-store-memory.d.ts +12 -4
- package/dist/plugins/approval-ask-store-memory.js +24 -10
- package/dist/plugins/approval-ask-store-sql.d.ts +39 -20
- package/dist/plugins/approval-ask-store-sql.js +41 -10
- 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 +2 -0
- package/dist/plugins/blob-backend.js +9 -6
- package/dist/plugins/caching-session-store.d.ts +13 -1
- package/dist/plugins/caching-session-store.js +43 -4
- package/dist/plugins/checkpoint-index-columns.d.ts +32 -5
- package/dist/plugins/checkpoint-index-columns.js +36 -1
- package/dist/plugins/checkpoint-store-face.d.ts +83 -10
- package/dist/plugins/checkpoint-store-face.js +18 -1
- package/dist/plugins/device-store-sql.js +1 -0
- 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/file-run-store.d.ts +63 -23
- package/dist/plugins/file-run-store.js +138 -83
- 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 +2 -2
- 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 +58 -23
- package/dist/plugins/local-checkpoint-store.js +195 -76
- package/dist/plugins/local-data-dir-modes-m39.js +2 -1
- 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 +4 -2
- package/dist/plugins/local-engine-high-water.js +4 -1
- package/dist/plugins/local-session-store.d.ts +358 -125
- package/dist/plugins/local-session-store.js +824 -251
- 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 +18 -1
- package/dist/plugins/local-task-attachment-store.js +22 -1
- package/dist/plugins/memory-embedder.js +9 -7
- package/dist/plugins/memory-engine-pg.d.ts +3 -2
- package/dist/plugins/memory-engine-pg.js +14 -5
- package/dist/plugins/memory-engine-sql-apply.d.ts +8 -4
- package/dist/plugins/memory-engine-sql-apply.js +6 -8
- package/dist/plugins/memory-engine-tidb.d.ts +4 -2
- package/dist/plugins/memory-engine-tidb.js +11 -2
- 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 +186 -45
- package/dist/plugins/one-time-migrations.js +442 -119
- package/dist/plugins/org-delivery-quota-store.js +2 -1
- package/dist/plugins/permission-rule-store-file.d.ts +3 -3
- 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 +1 -31
- package/dist/plugins/pg-pool.js +16 -7
- package/dist/plugins/remote-env-e2b.d.ts +7 -25
- package/dist/plugins/remote-env-e2b.js +34 -25
- package/dist/plugins/remote-env-host.d.ts +2 -9
- package/dist/plugins/remote-env-host.js +34 -22
- package/dist/plugins/remote-env-k8s.d.ts +40 -45
- package/dist/plugins/remote-env-k8s.js +107 -58
- package/dist/plugins/remote-env-local-docker.d.ts +148 -14
- package/dist/plugins/remote-env-local-docker.js +367 -72
- package/dist/plugins/remote-scratchpad.js +4 -0
- package/dist/plugins/retention-deployment.d.ts +49 -17
- package/dist/plugins/retention-deployment.js +39 -8
- 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 -9
- package/dist/plugins/schema-consistency.js +212 -11
- 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 +9 -0
- package/dist/plugins/schema-ensure-legs.js +1 -1
- 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 +27 -3
- package/dist/plugins/session-ext-table.js +19 -6
- package/dist/plugins/session-fork.d.ts +15 -1
- 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 +12 -0
- package/dist/plugins/session-row-sql.js +3 -3
- 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 +38 -12
- package/dist/plugins/session-store-sql.js +130 -30
- package/dist/plugins/session-withdraw-sql.d.ts +36 -0
- package/dist/plugins/session-withdraw-sql.js +42 -0
- package/dist/plugins/shared-memory-store-sql.d.ts +0 -69
- package/dist/plugins/shared-memory-store-sql.js +2 -1
- 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/sql-driver.d.ts +1 -1
- package/dist/plugins/sql-driver.js +2 -1
- package/dist/plugins/sql-errors.d.ts +32 -5
- package/dist/plugins/sql-errors.js +55 -7
- 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 +84 -15
- package/dist/plugins/store-backend.js +186 -55
- package/dist/plugins/store-contracts.d.ts +90 -30
- package/dist/plugins/store-contracts.js +22 -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 +15 -3
- package/dist/plugins/task-attachment-store.js +22 -9
- package/dist/plugins/tidb-pool.js +23 -8
- 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/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/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 +5 -3
- package/dist/rules-consent.js +1 -0
- 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 +92 -80
- package/dist/run-stale-default.d.ts +7 -0
- package/dist/run-stale-default.js +2 -0
- package/dist/runs.d.ts +26 -15
- package/dist/runs.js +39 -27
- package/dist/runtime-caps-resolver.d.ts +21 -6
- package/dist/runtime-caps-resolver.js +17 -4
- package/dist/runtime-governance.d.ts +2 -2
- package/dist/runtime-governance.js +5 -3
- package/dist/sealed-key-layout.d.ts +12 -5
- package/dist/sealed-key-layout.js +5 -0
- package/dist/sealed-key.d.ts +12 -2
- package/dist/sealed-key.js +115 -27
- package/dist/security.d.ts +128 -158
- package/dist/security.js +163 -59
- package/dist/sema-config-dir.d.ts +20 -0
- package/dist/sema-config-dir.js +25 -0
- package/dist/server-secret-env.d.ts +21 -5
- package/dist/server-secret-env.js +14 -4
- 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 +5 -5
- package/dist/session-error-wire.js +1 -1
- package/dist/session-incarnation.d.ts +52 -5
- 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 +0 -71
- package/dist/session-resident-background.js +4 -3
- package/dist/session-row.d.ts +2 -1
- package/dist/session-rules-seat.d.ts +12 -0
- package/dist/session-rules-seat.js +19 -0
- package/dist/session-titler.d.ts +7 -15
- package/dist/session-titler.js +1 -1
- package/dist/spec-fields.d.ts +57 -3
- package/dist/spec-fields.js +72 -51
- package/dist/store-posture.d.ts +136 -20
- package/dist/store-posture.js +188 -3
- package/dist/stored-request-hooks-m20.js +2 -2
- 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/checkpoint-store-sql.d.ts +33 -28
- package/dist/stores-sql/checkpoint-store-sql.js +75 -44
- package/dist/stores-sql/mailbox-store-sql.d.ts +7 -4
- package/dist/stores-sql/mailbox-store-sql.js +31 -32
- package/dist/stores-sql/pg-session-storage.d.ts +7 -5
- package/dist/stores-sql/pg-session-storage.js +54 -46
- package/dist/stores-sql/retention-store-sql.d.ts +87 -19
- package/dist/stores-sql/retention-store-sql.js +92 -27
- package/dist/stores-sql/session-policy-store-sql.d.ts +32 -10
- package/dist/stores-sql/session-policy-store-sql.js +44 -36
- package/dist/stores-sql/session-write-hooks.d.ts +12 -6
- package/dist/stores-sql/tidb-session-storage.d.ts +4 -4
- package/dist/stores-sql/tidb-session-storage.js +13 -8
- package/dist/stores-sql/tidb-session-store.d.ts +36 -17
- package/dist/stores-sql/tidb-session-store.js +69 -39
- package/dist/stores-sql/windowed-session-storage.d.ts +5 -0
- package/dist/stores-sql/windowed-session-storage.js +9 -0
- package/dist/submission-exit.d.ts +50 -0
- package/dist/submission-exit.js +108 -0
- package/dist/task-a2a.d.ts +1 -1
- package/dist/task-a2a.js +3 -3
- package/dist/task-cwd.d.ts +20 -0
- package/dist/task-cwd.js +8 -0
- package/dist/task-mcp.d.ts +1 -1
- package/dist/task-mcp.js +3 -3
- package/dist/task-settings.d.ts +14 -10
- package/dist/task-settings.js +18 -7
- package/dist/terminal.d.ts +25 -43
- package/dist/terminal.js +31 -11
- package/dist/tool-approval.d.ts +131 -129
- package/dist/tool-approval.js +189 -193
- package/dist/trace/core-keyset-guard.d.ts +13 -6
- package/dist/trace/core-vocab-wire.d.ts +95 -0
- package/dist/trace/core-vocab-wire.js +15 -0
- package/dist/trace/exit-seat.d.ts +30 -4
- package/dist/trace/exit-seat.js +40 -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 +55 -42
- package/dist/trace/project.js +52 -19
- package/dist/trace/redact.d.ts +123 -27
- package/dist/trace/redact.js +880 -260
- package/dist/trace/self-minted-wire.d.ts +487 -19
- package/dist/trace/self-minted-wire.js +172 -23
- package/dist/trace/wire-projection-faces.d.ts +5 -6
- package/dist/trace/wire-projection-faces.js +2 -2
- 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 +13 -16
- 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/center-request.d.ts +2 -2
- package/dist/web-admin-client/center-request.js +15 -15
- package/dist/web-admin-client/effective-keys.d.ts +1 -1
- package/dist/web-admin-client/effective-keys.js +1 -1
- 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/http-client.d.ts +1 -1
- package/dist/web-admin-client/http-client.js +23 -4
- 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 +8 -4
- package/dist/web-admin-client/skills-mcp.d.ts +2 -2
- package/dist/web-admin-client/types.d.ts +1 -2
- package/dist/workspace-space.d.ts +3 -2
- package/docs/DEVICE-EXECUTOR-PROTOCOL.md +4 -4
- package/package.json +6 -3
- package/scripts/drain-check-local.mjs +118 -147
- package/scripts/drain-check.mysql.sql +22 -2
- package/scripts/drain-check.pg.sql +22 -2
- 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/elicitation.js
CHANGED
|
@@ -3,6 +3,8 @@ import { uuidv7, delimitUntrusted } from "@sema-agent/core";
|
|
|
3
3
|
import { redactSecrets, redactDeep } from "./trace/redact.js";
|
|
4
4
|
import { recordFailOpen } from "./observability/fail-open.js";
|
|
5
5
|
import { refusalBody } from "./http/refusal-body.js";
|
|
6
|
+
import { keyAdmits, ownerCellOf, recoveredSubject } from "./owner-faces.js";
|
|
7
|
+
import { createHitlOpenRace } from "./hitl-delivery.js";
|
|
6
8
|
const MAX_ELICIT_MESSAGE_CHARS = 4096;
|
|
7
9
|
const MAX_ELICIT_SCHEMA_BYTES = 8192;
|
|
8
10
|
const RELEASE_ACTION = { refused: "decline", unanswered: "cancel" };
|
|
@@ -114,34 +116,33 @@ export class ElicitationCoordinator {
|
|
|
114
116
|
signal?.addEventListener("abort", onAbort, { once: true });
|
|
115
117
|
ctx.abortSignal?.addEventListener("abort", onAbort, { once: true });
|
|
116
118
|
this.pending.set(id, { settle, owner: ctx.owner, taskId: ctx.taskId });
|
|
117
|
-
const
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
119
|
+
const now = this.now();
|
|
120
|
+
const race = createHitlOpenRace({
|
|
121
|
+
targets: [{ transport: ctx.transport, frame: { type: "elicitation", elicitationId: id, mcpServerName: req.server, message, ...(requestedSchema !== undefined ? { requestedSchema } : {}), mode: "form", serverNowMs: now, expiresInMs: this.throttle.ttlMs, expiresAtMs: now + this.throttle.ttlMs } }],
|
|
122
|
+
settled: answerP,
|
|
123
|
+
});
|
|
124
|
+
const charge = () => {
|
|
123
125
|
rc.total += 1;
|
|
124
126
|
rc.lastByServer.set(req.server, t);
|
|
127
|
+
};
|
|
128
|
+
const phase = await race.phase;
|
|
129
|
+
if (phase === "delivered") {
|
|
130
|
+
charge();
|
|
125
131
|
}
|
|
126
|
-
else if (
|
|
132
|
+
else if (phase === "undelivered") {
|
|
127
133
|
recordFailOpen("server.elicitation.open-frame-undelivered", `elicitation=${id} server=${req.server}`);
|
|
128
134
|
settle({ action: RELEASE_ACTION.unanswered });
|
|
129
135
|
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
136
|
+
else {
|
|
137
|
+
void race.landing.then((late) => {
|
|
138
|
+
if (late === "delivered")
|
|
139
|
+
charge();
|
|
140
|
+
else
|
|
135
141
|
recordFailOpen("server.elicitation.open-frame-undelivered", `elicitation=${id} server=${req.server}`);
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
rc.lastByServer.set(req.server, t);
|
|
141
|
-
}
|
|
142
|
-
return ctx.emit({ type: "elicitation_complete", elicitationId: id, mcpServerName: req.server, action: answer.action, serverNowMs: this.now() });
|
|
143
|
-
})
|
|
144
|
-
.catch(() => recordFailOpen("server.elicitation.complete-breadcrumb-dropped", `elicitation=${id}`));
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
const answer = await answerP;
|
|
145
|
+
race.close({ type: "elicitation_complete", elicitationId: id, mcpServerName: req.server, action: answer.action, serverNowMs: this.now() });
|
|
145
146
|
return answer;
|
|
146
147
|
};
|
|
147
148
|
respond(id, principal, body) {
|
|
@@ -149,7 +150,7 @@ export class ElicitationCoordinator {
|
|
|
149
150
|
if (!parsed.ok)
|
|
150
151
|
return { status: 400, body: refusalBody({ errorCode: "request.body_shape", message: parsed.error }) };
|
|
151
152
|
const entry = this.pending.get(id);
|
|
152
|
-
if (!entry || (
|
|
153
|
+
if (!entry || !keyAdmits("ask.answer", { subject: recoveredSubject(principal), operator: false }, ownerCellOf(entry.owner))) {
|
|
153
154
|
return { status: 404, body: refusalBody({ errorCode: "elicitation.not_pending", message: "no pending elicitation for this id (answered, expired, or not on this replica)" }) };
|
|
154
155
|
}
|
|
155
156
|
entry.settle(parsed.value);
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 🔴 **引擎交界的身份**(唯一一处;叶子):一只主体的三格(`owner-brands.ts` 的 `partsOf`)怎么落进引擎 `TaskSpec` 的身份格。
|
|
3
|
+
*
|
|
4
|
+
* 二元形:`principal` = **人**(引擎的成文契约「终端用户 / MCP RBAC / 治理键」:用量窗扣账、出站 MCP / A2A 身份、事件归因、检查点的 `principal` 格都按人,
|
|
5
|
+
* 与本仓的人面汇点同轴);`isolationScope` = **带场景的主体**(只在请求带了场景时有;引擎按它分登记域 / offload 租界 / 后台登记 / peer 目录 / 工作流 scope,
|
|
6
|
+
* 引擎的读法是「隔离格缺席 ⇒ 读 `principal`」)。没带场景的请求只有 `principal`,与今天逐字节同。检查点的分区走本仓自己供的 `scope` 格。
|
|
7
|
+
*
|
|
8
|
+
* 今天的引擎还没有隔离格:{@link taskSpecIdentityOf} 是**唯一的落点**,今天只写 `principal`;隔离格到货后改那一行(钉在 `test/scenario-subject.test.ts`)。
|
|
9
|
+
* 落点之前引擎自己按 `spec.principal` 分的那几面按人分(同一个人的各场景在那几面互见)—— 本仓镜像这几面的读口(工作流读面、后台登记簿的停止标记、
|
|
10
|
+
* leader 子任务的 spec)同读 {@link taskSpecIdentityOf},读到的就是引擎写下的那一个值,不各写一份。
|
|
11
|
+
*/
|
|
12
|
+
import type { Person, Subject, SubjectParts } from "./owner-brands.js";
|
|
13
|
+
/** 引擎交界的身份(本仓的类型;二元)。 */
|
|
14
|
+
export interface EngineIdentity {
|
|
15
|
+
readonly principal: Person | undefined;
|
|
16
|
+
/** 带场景的主体;没带场景 ⇒ 缺席(引擎读 `principal`)。 */
|
|
17
|
+
readonly isolationScope?: Subject;
|
|
18
|
+
}
|
|
19
|
+
/** 一只主体(没有 ⇒ 匿名)在引擎交界上的身份。 */
|
|
20
|
+
export declare function specIdentityOf(parts: SubjectParts | undefined): EngineIdentity;
|
|
21
|
+
/**
|
|
22
|
+
* 落进 `TaskSpec` 的身份格(**唯一落点**)。今天的引擎没有隔离格 ⇒ 只写 `principal`,`isolationScope` 在这里不落(引擎按人分它自己的那几面);
|
|
23
|
+
* 引擎的隔离格到货 ⇒ 这里加一格,别处不动。
|
|
24
|
+
*/
|
|
25
|
+
export declare function taskSpecIdentityOf(parts: SubjectParts | undefined): {
|
|
26
|
+
readonly principal?: string;
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=engine-identity.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export function specIdentityOf(parts) {
|
|
2
|
+
if (parts === undefined)
|
|
3
|
+
return { principal: undefined };
|
|
4
|
+
return parts.scenario === undefined ? { principal: parts.person } : { principal: parts.person, isolationScope: parts.subject };
|
|
5
|
+
}
|
|
6
|
+
export function taskSpecIdentityOf(parts) {
|
|
7
|
+
const { principal } = specIdentityOf(parts);
|
|
8
|
+
return principal === undefined ? {} : { principal };
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=engine-identity.js.map
|
package/dist/entry-problems.d.ts
CHANGED
|
@@ -18,14 +18,12 @@ export interface EntryProblem {
|
|
|
18
18
|
}
|
|
19
19
|
/** 铸一条问题:`entry` 收**原串**,这里过脱敏(调用方没有「忘了脱敏」的可能)。 */
|
|
20
20
|
export declare function entryProblem(code: string, field: string, rawEntry: string, reason: string): EntryProblem;
|
|
21
|
-
/** 拒体上的机读位(
|
|
22
|
-
export
|
|
21
|
+
/** 拒体上的机读位(原样摊在拒体根上:`HttpError.extra` / `refusalBody` 的 `facts`)。型别名而不是接口 —— 要能直接当 `Record<string, unknown>` 用。 */
|
|
22
|
+
export type EntryProblemsFacts = {
|
|
23
23
|
readonly field: string;
|
|
24
|
-
readonly
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
};
|
|
28
|
-
}
|
|
24
|
+
readonly problems: readonly EntryProblem[];
|
|
25
|
+
readonly total: number;
|
|
26
|
+
};
|
|
29
27
|
/**
|
|
30
28
|
* 一遍判下来的全部问题 ⇒ 拒体的机读位。**不能空**:没有问题就没有拒(调用方只在命中时调),空表是调用点的错,响亮抛。
|
|
31
29
|
* 顶层 `field` = 第一条问题的坐标(句子点名的那一张清单)。
|
package/dist/entry-problems.js
CHANGED
|
@@ -9,6 +9,6 @@ export function entryProblemsFacts(found) {
|
|
|
9
9
|
const first = found[0];
|
|
10
10
|
if (first === undefined)
|
|
11
11
|
throw new Error("entryProblemsFacts: a refusal needs at least one problem");
|
|
12
|
-
return { field: first.field,
|
|
12
|
+
return { field: first.field, problems: found.length > MAX_ENTRY_PROBLEMS ? found.slice(0, MAX_ENTRY_PROBLEMS) : found, total: found.length };
|
|
13
13
|
}
|
|
14
14
|
//# sourceMappingURL=entry-problems.js.map
|
package/dist/env-facts.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { writeLogText } from "./observability/logger.js";
|
|
1
2
|
import { isAbsolute, join, resolve, sep } from "node:path";
|
|
2
3
|
import { mkdir, readdir, rm, stat } from "node:fs/promises";
|
|
3
4
|
import { ensureDir } from "@sema-agent/core";
|
|
@@ -147,7 +148,7 @@ export async function purgeScratchpadDir(localDataRoot, sessionId) {
|
|
|
147
148
|
await rm(dir, { recursive: true, force: true });
|
|
148
149
|
}
|
|
149
150
|
catch (err) {
|
|
150
|
-
|
|
151
|
+
writeLogText("stderr", `scratchpad_purge_failed dir=${dir}: ${err instanceof Error ? err.message : String(err)}`);
|
|
151
152
|
}
|
|
152
153
|
}
|
|
153
154
|
export async function sweepStaleScratchpads(localDataRoot, opts) {
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** 出口座登记「这条 run 的环境一旦留下持久物就告诉我」;交回注销口(只注销自己登记的那一只)。 */
|
|
2
|
+
export declare function listenEnvWitness(runId: string, onWitness: () => void): () => void;
|
|
3
|
+
/** 环境留下了按会话键的持久物(run id 缺席 = 子 run / 服务自起的 run,不属任何提交 ⇒ 无事)。 */
|
|
4
|
+
export declare function witnessEnv(runId: string | undefined): void;
|
|
5
|
+
/** 在听的座数(测试读:收场后归零 = 不积累)。 */
|
|
6
|
+
export declare function envWitnessListeners(): number;
|
|
7
|
+
//# sourceMappingURL=env-witness.d.ts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const listening = new Map();
|
|
2
|
+
export function listenEnvWitness(runId, onWitness) {
|
|
3
|
+
listening.set(runId, onWitness);
|
|
4
|
+
return () => {
|
|
5
|
+
if (listening.get(runId) === onWitness)
|
|
6
|
+
listening.delete(runId);
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
export function witnessEnv(runId) {
|
|
10
|
+
if (runId !== undefined)
|
|
11
|
+
listening.get(runId)?.();
|
|
12
|
+
}
|
|
13
|
+
export function envWitnessListeners() {
|
|
14
|
+
return listening.size;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=env-witness.js.map
|
|
@@ -3,7 +3,7 @@ import { type ExecutionLane as DeclarableLane, type ExecutionLaneRow } from "@se
|
|
|
3
3
|
import type { ServiceConfigFlat } from "./config-types.js";
|
|
4
4
|
import { type LaneHomeConfig } from "./lane-home-probe.js";
|
|
5
5
|
/** 一位能力的三态。`single-user-only` = 车道支持,但只在单用户部署(`requirePrincipal !== true`)开 ——
|
|
6
|
-
* 多租户下这一位必须关(host 家族的 cwd/scheduler/backgroundShell
|
|
6
|
+
* 多租户下这一位必须关(host 家族的 cwd/scheduler/backgroundShell 都是这一档,理由同源 —— 本机语言服务器同理由,答者是部署形行 `callerOwnsWorkerDisk`:
|
|
7
7
|
* 一个租户的输入不许把 agent 指向 worker 宿主上另一个租户/运维的文件与进程)。 */
|
|
8
8
|
export type LaneCapability = "supported" | "unsupported" | "single-user-only";
|
|
9
9
|
/** 闭集:执行车道全集 = settings-schema 词表正本的可声明车道(**派生**,本仓零手抄;`REMOTE_EXEC` 能写下去的词就是这些)。
|
|
@@ -23,8 +23,6 @@ export interface ExecutionLaneCaps {
|
|
|
23
23
|
/** 自唤醒 scheduler(`CronCreate`/…)。判别式:`boot/execution-env.ts` host 臂的 `hostScheduler`
|
|
24
24
|
* 与 `http/routes/capabilities.ts` 的 `scheduler` 位(两处同判据)。 */
|
|
25
25
|
readonly scheduler: LaneCapability;
|
|
26
|
-
/** LSP。判别式:`boot/execution-env.ts` 的 `lspManager` 两臂(沙箱桥 e2b/k8s;host 本地 NodeLspManager)。 */
|
|
27
|
-
readonly lsp: LaneCapability;
|
|
28
26
|
/** SendUserFile 的**沙箱直传腿**(host 的本机 fs 源是另一条腿,不是本位)。
|
|
29
27
|
* 读者:部署形表行 `sandboxSendUserFile`(本位即判据;判定依据在 `capabilities/sandbox-file-send.ts` 头注)。 */
|
|
30
28
|
readonly sandboxSendUserFile: LaneCapability;
|
|
@@ -58,8 +56,8 @@ export interface ExecutionLaneCaps {
|
|
|
58
56
|
* 绑定验证),故不要求单用户。(部署形表行 `callerCwd` 直接读本位。)
|
|
59
57
|
* · `remoteScratchpad: supported` —— executor 平台闭集 = darwin|linux,`/tmp/scratchpad/<sessionId>`
|
|
60
58
|
* 的惰性 mkdir 约定原样适用;不加词则 scratchpad envFact 对模型整块缺席。
|
|
61
|
-
* · scheduler / backgroundShell /
|
|
62
|
-
* (
|
|
59
|
+
* · scheduler / backgroundShell / sandboxSendUserFile / worktreeIsolation = v1 **诚实关闭**
|
|
60
|
+
* (不是遗漏:设备侧长驻进程、直传腿都是 follow-on,声明了就是谎)。
|
|
63
61
|
*/
|
|
64
62
|
export declare function executionLaneCaps(lane: ExecutionLane): ExecutionLaneCaps;
|
|
65
63
|
/** 读地板旋钮的 env 名(拒起句与起服行点名它)。 */
|
|
@@ -186,22 +184,11 @@ export declare function deployedExecutionLanes(config: Pick<ServiceConfigFlat, "
|
|
|
186
184
|
*
|
|
187
185
|
* 读者问的都是这一句,**同一只函数**,不许各写一份 `=== "host"`:
|
|
188
186
|
* ① 部署形表行 `toolsOnThisHost`(`deployment-shape.ts`)—— wire `executionLane.toolsOnThisHost` + 出厂自扫技能与中心 plugin 技能的 `baseDir`;
|
|
189
|
-
* ② 部署形表行 `callerOwnsWorkerDisk`(本列 ∧ 单主)—— SendUserFile 本机腿(「无手不挂」)、调用方宿主路径(附加目录 / 项目上下文)
|
|
187
|
+
* ② 部署形表行 `callerOwnsWorkerDisk`(本列 ∧ 单主)—— SendUserFile 本机腿(「无手不挂」)、调用方宿主路径(附加目录 / 项目上下文)、指令文件探针、
|
|
188
|
+
* 本机语言服务器(`createLspManager`;这类车道的适配器必须绑得住读 `openBound`,对拍钉 `test/host-env-open-bound.test.ts`);
|
|
190
189
|
* ③ `approval.ts` 的 `buildNoResponderBootWarns` —— 写门的 ask 只在「有手写本机盘」时才会发生(它手里已有车道词,直接读本列)。
|
|
191
190
|
*/
|
|
192
191
|
export declare function handsOnWorkerFilePlane(lane: ExecutionLane): boolean;
|
|
193
|
-
/**
|
|
194
|
-
* core 7.50.0 —— 「这条车道的执行环境能不能把一次读**绑到判过的那只对象**上」(`FileSystem.openBound`:开着并持有,叶链接不跟,
|
|
195
|
-
* 开后身份对拍)。LSP 会话的读口与路径附件只经它读;环境不实现 ⇒ 那两个读口在这条车道上一律拒。
|
|
196
|
-
*
|
|
197
|
-
* **一条律**:LSP 只在本谓词为真的车道挂(`boot/execution-env.ts` 的 LSP 管理器两臂都合取它;表的 `lsp` 位与之同向,
|
|
198
|
-
* 对拍钉 `test/host-env-open-bound.test.ts`:本谓词 ⟺ 适配器类原型上有 `openBound`)。
|
|
199
|
-
* · `host` —— `RemoteHostExecutionEnv.openBound` 委托 core `NodeExecutionEnv` 的实现(唯一属主),真;
|
|
200
|
-
* · `none` —— 没有手(执行环境两座都不给),无物可绑;
|
|
201
|
-
* · 其余车道(沙箱 / 远端 shell / 设备)—— 读走 exec / sftp / 设备协议,本版不实现绑定读,假。实现之日翻这一格,LSP 沙箱桥随之回来。
|
|
202
|
-
* 穷举 switch、无 default 臂:车道加词而此处不表态 = 编译红。
|
|
203
|
-
*/
|
|
204
|
-
export declare function laneBindsReads(lane: ExecutionLane): boolean;
|
|
205
192
|
/**
|
|
206
193
|
* 「这条车道的执行环境**自己读得出家目录**」—— 读得出 ⇒ 读数是真源:适配器持一只 `LaneHomeSeat`(取值律与座的唯一属主 = `lane-home-probe.ts`),
|
|
207
194
|
* 部署给的主张({@link buildLaneHomeClaim})在每只环境开起来时被证,不一致 ⇒ 那只环境不开;没有主张 ⇒ 读数填 `ExecutionEnv.homeDir` 的座。
|
|
@@ -12,7 +12,6 @@ export function executionLaneCaps(lane) {
|
|
|
12
12
|
callerCwd: NO,
|
|
13
13
|
backgroundShell: NO,
|
|
14
14
|
scheduler: NO,
|
|
15
|
-
lsp: NO,
|
|
16
15
|
sandboxSendUserFile: NO,
|
|
17
16
|
remoteScratchpad: NO,
|
|
18
17
|
worktreeIsolation: NO,
|
|
@@ -23,7 +22,6 @@ export function executionLaneCaps(lane) {
|
|
|
23
22
|
callerCwd: SU,
|
|
24
23
|
backgroundShell: SU,
|
|
25
24
|
scheduler: SU,
|
|
26
|
-
lsp: SU,
|
|
27
25
|
sandboxSendUserFile: NO,
|
|
28
26
|
remoteScratchpad: NO,
|
|
29
27
|
worktreeIsolation: YES,
|
|
@@ -34,7 +32,6 @@ export function executionLaneCaps(lane) {
|
|
|
34
32
|
callerCwd: NO,
|
|
35
33
|
backgroundShell: YES,
|
|
36
34
|
scheduler: NO,
|
|
37
|
-
lsp: NO,
|
|
38
35
|
sandboxSendUserFile: YES,
|
|
39
36
|
remoteScratchpad: YES,
|
|
40
37
|
worktreeIsolation: NO,
|
|
@@ -45,7 +42,6 @@ export function executionLaneCaps(lane) {
|
|
|
45
42
|
callerCwd: NO,
|
|
46
43
|
backgroundShell: YES,
|
|
47
44
|
scheduler: NO,
|
|
48
|
-
lsp: NO,
|
|
49
45
|
sandboxSendUserFile: YES,
|
|
50
46
|
remoteScratchpad: YES,
|
|
51
47
|
worktreeIsolation: NO,
|
|
@@ -56,7 +52,6 @@ export function executionLaneCaps(lane) {
|
|
|
56
52
|
callerCwd: NO,
|
|
57
53
|
backgroundShell: NO,
|
|
58
54
|
scheduler: NO,
|
|
59
|
-
lsp: NO,
|
|
60
55
|
sandboxSendUserFile: SU,
|
|
61
56
|
remoteScratchpad: YES,
|
|
62
57
|
worktreeIsolation: NO,
|
|
@@ -67,7 +62,6 @@ export function executionLaneCaps(lane) {
|
|
|
67
62
|
callerCwd: NO,
|
|
68
63
|
backgroundShell: NO,
|
|
69
64
|
scheduler: NO,
|
|
70
|
-
lsp: NO,
|
|
71
65
|
sandboxSendUserFile: NO,
|
|
72
66
|
remoteScratchpad: NO,
|
|
73
67
|
worktreeIsolation: NO,
|
|
@@ -78,7 +72,6 @@ export function executionLaneCaps(lane) {
|
|
|
78
72
|
callerCwd: NO,
|
|
79
73
|
backgroundShell: NO,
|
|
80
74
|
scheduler: NO,
|
|
81
|
-
lsp: NO,
|
|
82
75
|
sandboxSendUserFile: NO,
|
|
83
76
|
remoteScratchpad: YES,
|
|
84
77
|
worktreeIsolation: NO,
|
|
@@ -89,7 +82,6 @@ export function executionLaneCaps(lane) {
|
|
|
89
82
|
callerCwd: YES,
|
|
90
83
|
backgroundShell: NO,
|
|
91
84
|
scheduler: NO,
|
|
92
|
-
lsp: NO,
|
|
93
85
|
sandboxSendUserFile: NO,
|
|
94
86
|
remoteScratchpad: YES,
|
|
95
87
|
worktreeIsolation: NO,
|
|
@@ -263,20 +255,6 @@ export function handsOnWorkerFilePlane(lane) {
|
|
|
263
255
|
const block = laneBlock(lane, NO_SUB_KNOBS);
|
|
264
256
|
return block.io && block.hostLocalPaths;
|
|
265
257
|
}
|
|
266
|
-
export function laneBindsReads(lane) {
|
|
267
|
-
switch (lane) {
|
|
268
|
-
case "host":
|
|
269
|
-
return true;
|
|
270
|
-
case "none":
|
|
271
|
-
case "e2b":
|
|
272
|
-
case "k8s":
|
|
273
|
-
case "ssh":
|
|
274
|
-
case "adb":
|
|
275
|
-
case "device":
|
|
276
|
-
case "local-docker":
|
|
277
|
-
return false;
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
258
|
export function laneMeasuresHome(lane) {
|
|
281
259
|
switch (lane) {
|
|
282
260
|
case "k8s":
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* 委派分区行读作「不在」。
|
|
10
10
|
* · **读只有一只**:会话店的执行席 {@link ExecutionPlacementSeat.read}(一次行读:住客 + 格;行不在 / 委派分区行 ⇒ `undefined`;读故障抛,不吞成 `absent`)。
|
|
11
11
|
* 跨行的聚合也只有一只:设备店的绑定数 `countDeviceBindings`(writer(device, D) 的格数 = {@link boundDeviceOf} 的聚合;只交数,不交根 id)。
|
|
12
|
-
* · **写只按住客谓词** `(root, incarnation, owner) ∧ placement_kind IS NULL`:住客换了(
|
|
12
|
+
* · **写只按住客谓词** `(root, incarnation, owner) ∧ placement_kind IS NULL`:住客换了(删后重建,哪怕同一属主)= 这一格不在 ⇒ 落空;
|
|
13
13
|
* 0 行一律按住客复读分类({@link settledPlaceOutcome} / {@link settledMirrorOutcome} / {@link settledDeviceBindOutcome}),**永不对现住客重试**。
|
|
14
14
|
* · **没有的转换**:writer ↔ mirror、writer(L) → writer(L')(device 车道的换绑 writer(device, D) → writer(device, D') 除外,它有自己的语句与门)。
|
|
15
15
|
* · **放置存在 ⇒ 住客存在**:放置是行的列 / 格,删会话即删放置;建行恒 absent(SQL 建行 INSERT 列名显式;local 新格整格新铸),导入新建的行同锁落 mirror。
|
|
@@ -22,6 +22,7 @@ import { type SessionHead } from "@sema-agent/core";
|
|
|
22
22
|
import type { DeviceOwner } from "./device-store.js";
|
|
23
23
|
import type { ExecutionLane } from "./execution-lane-caps.js";
|
|
24
24
|
import type { SessionFace } from "./session-incarnation.js";
|
|
25
|
+
import type { SessionWrite } from "./plugins/store-backend.js";
|
|
25
26
|
/** writer(device, D) 的 D:设备、绑定属主(= 设备属主)、换绑序号、放下时刻(ISO)。 */
|
|
26
27
|
export interface ExecutionDeviceCell {
|
|
27
28
|
readonly id: string;
|
|
@@ -108,13 +109,22 @@ export interface UnusableArchive {
|
|
|
108
109
|
readonly fault: unknown;
|
|
109
110
|
}
|
|
110
111
|
export declare function isUnusableArchive(x: object | undefined): x is UnusableArchive;
|
|
112
|
+
/** {@link LocalPlacementBackfillSeat.backfill} 的结局(随 M32):写成了 writer · 这一格此刻不归回填(行不在 / placed / 已有执行位 / forking)· 车道表不是一项而这一格要回填(不写)· 存档读不出(点名跳过)。 */
|
|
113
|
+
export type LocalPlacementBackfillOutcome = {
|
|
114
|
+
readonly outcome: "placed";
|
|
115
|
+
} | {
|
|
116
|
+
readonly outcome: "skipped";
|
|
117
|
+
} | {
|
|
118
|
+
readonly outcome: "ambiguous";
|
|
119
|
+
} | UnusableArchive;
|
|
111
120
|
/**
|
|
112
|
-
* 一次性迁移 M32 **local 腿**的席(随 M32 · 窗口见 `plugins/one-time-migrations.ts` 登记表;只 local 有:SQL 的行就是会话,没有「会话元数据格缺 ∧ 存档读不出」这一形)
|
|
113
|
-
*
|
|
114
|
-
*
|
|
121
|
+
* 一次性迁移 M32 **local 腿**的席(随 M32 · 窗口见 `plugins/one-time-migrations.ts` 登记表;只 local 有:SQL 的行就是会话,没有「会话元数据格缺 ∧ 存档读不出」这一形)。
|
|
122
|
+
* 唯一成员 `backfill(root, lanes)`:在这只会话的写锁里**观察一次**(与执行席的读同一只观察),absent 的那一格 ∧ 车道表只有一项 ⇒ **一笔**写成 writer(格缺就在同一笔里铸化身);
|
|
123
|
+
* 车道表不是一项 ⇒ `ambiguous`、不写;观察抛(这只会话的存档读不出)⇒ 答 {@link UnusableArchive} 而不抛 —— 开机回填不动存档、只补一格放置,读不出的会话由它点名跳过
|
|
124
|
+
* (该会话的请求照旧答存档的故障)。观察与写在同一节锁里:读与写之间没有别的写者。
|
|
115
125
|
*/
|
|
116
|
-
export interface LocalPlacementBackfillSeat
|
|
117
|
-
|
|
126
|
+
export interface LocalPlacementBackfillSeat {
|
|
127
|
+
backfill(root: string, lanes: readonly ExecutionLane[]): Promise<LocalPlacementBackfillOutcome>;
|
|
118
128
|
}
|
|
119
129
|
/** wire 投影(新读面 + 受理回声共用)。 */
|
|
120
130
|
export type ExecutionPlacementView = {
|
|
@@ -135,7 +145,7 @@ export type ExecutionPlacementView = {
|
|
|
135
145
|
export declare function executionPlacementView(cell: ExecutionPlacementCell): ExecutionPlacementView;
|
|
136
146
|
/**
|
|
137
147
|
* 住客谓词的 JS 读法(SQL `incarnation = ? AND owner <=> ?` 的对位)= core 的行期望判官 `sessionRowMatches`(会话行格写原语锁内判的也是它,
|
|
138
|
-
* `session-row.ts` 的 `judgeSessionRowWrite`):属主与化身两样都没变才是判过的那一位 —— 同一化身的属主会变(
|
|
148
|
+
* `session-row.ts` 的 `judgeSessionRowWrite`):属主与化身两样都没变才是判过的那一位 —— 同一化身的属主会变(identical 重戳、
|
|
139
149
|
* SQL 导入提交点改属主)。两侧收「属主 + 化身」那一读:活住客(`SessionFace`)与店的头(`SessionHead`,门判过的那一读)。三处调用方:
|
|
140
150
|
* · 执行格的写口判官(本模块)与执行上下文解析器步 ① 的 `judged` 复核(`http/execution-context.ts`)—— 一侧恒是执行席的读数(住客经 `sessionFaceFromRow` 解码,令牌非空);
|
|
141
151
|
* · 会话通知门投递前的住客复核(`session-notify-door.ts` 的 `recheck`)—— 两侧都是会话店的头读:不铸化身的店上**两侧都没有令牌**。
|
|
@@ -163,8 +173,8 @@ export declare class SessionForkInProgressError extends Error {
|
|
|
163
173
|
}
|
|
164
174
|
/**
|
|
165
175
|
* 写口在写事务 / 写锁内的认领读命中:SQL = 读写序律(`plugins/execution-placement-sql.ts` 的 `lockRootAndReadClaim`:改根住客 / 放置的写者在自己的事务里先锁根
|
|
166
|
-
* `session_meta` 行、再锁定读 `task_active(root)`,读到认领 ⇒ 回滚、一个字节不写、抛它);local =
|
|
167
|
-
*
|
|
176
|
+
* `session_meta` 行、再锁定读 `task_active(root)`,读到认领 ⇒ 回滚、一个字节不写、抛它);local = 这只会话的写锁(= 根行锁)内读 run 店的认领(`markMirror` 返回 `active` 臂;
|
|
177
|
+
* 三个导入写口、删除与 placed 行的终结经 {@link judgeSessionWrite} 抛它)—— device 首绑在写事务内的认领读只在 SQL 后端(local 没有 device 工厂)。
|
|
168
178
|
* 具名类型、**不带 wire 码**:各门按自己的既有码答(导入 409 `session_active`、删除 409 `conflict.session_active_run`),体带 `activeTaskId`。
|
|
169
179
|
*/
|
|
170
180
|
export declare class SessionActiveRunError extends Error {
|
|
@@ -182,21 +192,51 @@ export declare const WRITABLE: "writable";
|
|
|
182
192
|
export declare function settledPlaceOutcome(root: string, reading: ExecutionPlacementReading | undefined, occupant: SessionFace, wanted: ExecutionWriterCell): PlaceOutcome | typeof WRITABLE;
|
|
183
193
|
/** markMirror 的唯一判官(认领那一半在本判官之后,SQL 与 local 各在自己的写事务 / 写锁内判):行不在 / 住客不同 ⇒ `gone`;writer ⇒ `writer`;mirror ⇒ `mirrored`(幂等,零写);absent ⇒ {@link WRITABLE};forking ⇒ 抛。 */
|
|
184
194
|
export declare function settledMirrorOutcome(root: string, reading: ExecutionPlacementReading | undefined, occupant: SessionFace): MarkMirrorOutcome | typeof WRITABLE;
|
|
185
|
-
/**
|
|
186
|
-
|
|
187
|
-
|
|
195
|
+
/**
|
|
196
|
+
* 删净在删会话的执行体(写词 `erase`;`session-erase.ts`)在根行锁里读到:这一行此刻**不是**这一次删除的在删态 —— 另一次删除接管了它(换了令牌)、它已经删完(行不在 / 同 id 的新住客)。
|
|
197
|
+
* 一个字节不删。具名类型、不带 wire 码:协调器把它读作「这次尝试被接管」(路由 409 `conflict.session_deleting`)。
|
|
198
|
+
*/
|
|
199
|
+
export declare class SessionDeletionSupersededError extends Error {
|
|
200
|
+
readonly sessionId: string;
|
|
201
|
+
constructor(sessionId: string);
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* 改动会话树根的写(导入三写口 / 撤回 / placed 行的终结 / 留存删除)在根行锁里读到这一行**在删**(会话三态,`src/session-deletion.ts`):一次删除独占着它,一个字节不写。
|
|
205
|
+
* 带 wire 码 `conflict.session_deleting`(全局兜底映射 409;导入路由的属主门读头 —— 在删读作不在 ⇒ 404 —— 只有门判过之后才落围栏的那一拍走到这里)。
|
|
206
|
+
* 留存删除读作「本轮跳过这棵树」(在删的行由删除协调器删完,留存不当第二个收尾者);撤回读作留(`claim`:一次删除持有这一行)。
|
|
207
|
+
*/
|
|
208
|
+
export declare class SessionDeletingError extends Error {
|
|
209
|
+
readonly sessionId: string;
|
|
210
|
+
readonly code = "conflict.session_deleting";
|
|
211
|
+
constructor(sessionId: string);
|
|
212
|
+
}
|
|
213
|
+
/** {@link judgeSessionWrite} 的判:放行,或拒(拒的载荷是写口抛的那只 typed 错;SQL 的事务内钩原样交给店,local 直接抛)。 */
|
|
214
|
+
export type SessionWriteJudgement = "proceed" | {
|
|
215
|
+
readonly refuse: SessionActiveRunError | SessionWriterPresentError | SessionForkInProgressError | SessionDeletionSupersededError | SessionDeletingError;
|
|
188
216
|
};
|
|
189
217
|
/**
|
|
190
|
-
*
|
|
191
|
-
*
|
|
192
|
-
|
|
193
|
-
|
|
218
|
+
* 一个写词碰不碰这一行的执行格(写词闭集的**唯一**分派,穷尽 —— 加一个词在这里编译红):`import` ⇒ 碰(判写者 / fork 中间态,放行后调用方落 mirror);
|
|
219
|
+
* `delete` / `retention-delete` ⇒ 不碰(删除不问执行格:格随这一行一起走)。判官 {@link judgeSessionWrite} 与 SQL 事务内钩的写派(放行后落不落 mirror)都读它。
|
|
220
|
+
*/
|
|
221
|
+
export declare function sessionWriteTouchesCell(op: SessionWrite["op"]): boolean;
|
|
222
|
+
/**
|
|
223
|
+
* 改动会话树根的写(闭集 = `SessionWrite.op`:`import` 导入三写口落定这一行 / `delete` 提交出口的条件撤回与 placed 行的终结 / `retention-delete` 留存删一棵树的根 /
|
|
224
|
+
* `erase` 删净在删会话的执行体)落定**之前**的唯一判官,**连序**在内(SQL 的事务内钩与 local 的写锁内同调,两店不各抄一份):
|
|
225
|
+
* 先读这一行的在删令牌:
|
|
226
|
+
* · `erase` —— 令牌等于 `write.token` ⇒ 放行,否则 {@link SessionDeletionSupersededError}(认领在围栏那一刻判过,在删期间认领落不下;不读认领、不读格);
|
|
227
|
+
* · 其余三个词 —— 在删 ⇒ {@link SessionDeletingError}(一次删除独占着这一行;任何别的写者 / 删除者都不碰它);
|
|
228
|
+
* 不在删 ⇒ 其余三个词再读认领 —— 在 ⇒ {@link SessionActiveRunError}(活 run 挂着的根不换内容、不删);认领不在 ⇒ 按词:
|
|
229
|
+
* · `import` 再读这一格 —— `writer` ⇒ {@link SessionWriterPresentError}(带车道)、`forking` ⇒ {@link SessionForkInProgressError};`absent` / `mirror` ⇒ 放行(落 mirror 由调用方写);
|
|
230
|
+
* · `delete` / `retention-delete` ⇒ 放行(删除不问执行格:格随这一行一起走)。
|
|
231
|
+
* 读口由调用方给、**按需读**:在删令牌每个词都读;认领在 ⇒ 不读格;删除三词从不读格(SQL:不发格那一句锁定读;local:不探存档)。
|
|
232
|
+
* 读与判必须在写者独占的同一刻里:SQL = 锁根行之后、同一连接;local = 这只会话的写锁(= 根行锁)内、第一笔写之前(取锁 → 读认领 → 判 → 写)。
|
|
194
233
|
* 返回判、不抛:拒之后一个字节不写由调用方保证(SQL 回滚,local 判在第一笔写之前)。
|
|
195
234
|
*/
|
|
196
|
-
export declare function
|
|
235
|
+
export declare function judgeSessionWrite(write: SessionWrite, read: {
|
|
197
236
|
readonly claim: () => Promise<string | null | undefined>;
|
|
198
237
|
readonly cell: () => Promise<ExecutionPlacementCell>;
|
|
199
|
-
|
|
238
|
+
readonly deleting: () => Promise<string | null>;
|
|
239
|
+
}): Promise<SessionWriteJudgement>;
|
|
200
240
|
/** device 车道首绑(absent → writer(device, D) 或 writer(device, ∅) → writer(device, D))的结果(设备店的事务 / 内存参照实现同调)。 */
|
|
201
241
|
export type DeviceBindOutcome = {
|
|
202
242
|
readonly outcome: "bound";
|
|
@@ -94,10 +94,49 @@ export function settledMirrorOutcome(root, reading, occupant) {
|
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
|
-
export
|
|
97
|
+
export class SessionDeletionSupersededError extends Error {
|
|
98
|
+
sessionId;
|
|
99
|
+
constructor(sessionId) {
|
|
100
|
+
super(`session ${sessionId} is no longer held by this deletion attempt (another deletion took it over, or it is already gone) — nothing was deleted by this attempt`);
|
|
101
|
+
this.sessionId = sessionId;
|
|
102
|
+
this.name = "SessionDeletionSupersededError";
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
export class SessionDeletingError extends Error {
|
|
106
|
+
sessionId;
|
|
107
|
+
code = "conflict.session_deleting";
|
|
108
|
+
constructor(sessionId) {
|
|
109
|
+
super(`session ${sessionId} is being deleted — this write was refused inside its transaction; nothing was written`);
|
|
110
|
+
this.sessionId = sessionId;
|
|
111
|
+
this.name = "SessionDeletingError";
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
export function sessionWriteTouchesCell(op) {
|
|
115
|
+
switch (op) {
|
|
116
|
+
case "import":
|
|
117
|
+
return true;
|
|
118
|
+
case "delete":
|
|
119
|
+
case "retention-delete":
|
|
120
|
+
case "erase":
|
|
121
|
+
return false;
|
|
122
|
+
default: {
|
|
123
|
+
const unknownOp = op;
|
|
124
|
+
throw new Error(`sessionWriteTouchesCell: no write ${JSON.stringify(unknownOp)}`);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
export async function judgeSessionWrite(write, read) {
|
|
129
|
+
const root = write.rootSessionId;
|
|
130
|
+
const deleting = await read.deleting();
|
|
131
|
+
if (write.op === "erase")
|
|
132
|
+
return deleting === write.token ? "proceed" : { refuse: new SessionDeletionSupersededError(root) };
|
|
133
|
+
if (deleting !== null)
|
|
134
|
+
return { refuse: new SessionDeletingError(root) };
|
|
98
135
|
const claim = await read.claim();
|
|
99
136
|
if (claim !== null && claim !== undefined)
|
|
100
137
|
return { refuse: new SessionActiveRunError(root, claim) };
|
|
138
|
+
if (!sessionWriteTouchesCell(write.op))
|
|
139
|
+
return "proceed";
|
|
101
140
|
const cell = await read.cell();
|
|
102
141
|
switch (cell.role) {
|
|
103
142
|
case "writer":
|
|
@@ -109,7 +148,7 @@ export async function judgeImportWrite(root, read) {
|
|
|
109
148
|
return "proceed";
|
|
110
149
|
default: {
|
|
111
150
|
const unknownRole = cell;
|
|
112
|
-
throw new Error(`
|
|
151
|
+
throw new Error(`judgeSessionWrite: no arm for ${JSON.stringify(unknownRole)}`);
|
|
113
152
|
}
|
|
114
153
|
}
|
|
115
154
|
}
|
package/dist/field-conflict.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/** 冲突的类(
|
|
2
|
-
export declare const
|
|
1
|
+
/** 冲突的类(闭集;拒体根上的 `reason`)。同一个约束的几个拒点同一个词;新增一类见文件头。 */
|
|
2
|
+
export declare const FIELD_CONFLICT_REASONS: readonly ["cascade_verify", "image_profile", "resume_anchor", "system_prompt_fold", "file_history_restore", "skills_disabled", "existing_session", "fork_target", "scratchpad_root", "ask_answer", "policy_person_ask", "plan_edit", "plan_mode_after", "bound_call_door", "remember_decision", "approval_feedback"];
|
|
3
3
|
/** 冲突的类(闭集词)。 */
|
|
4
|
-
export type
|
|
4
|
+
export type FieldConflictReason = (typeof FIELD_CONFLICT_REASONS)[number];
|
|
5
5
|
/**
|
|
6
6
|
* 每一类允许点名的请求体坐标(铸点的 `fields` 按所属类的行检查)。键序无意义;值是该类可出现的坐标的联合。
|
|
7
7
|
* 动态下标的坐标用模板字面量型(`agents[1].skills`)。
|
|
@@ -29,17 +29,13 @@ export interface FieldConflictMeasure {
|
|
|
29
29
|
readonly count: number;
|
|
30
30
|
readonly cap: number;
|
|
31
31
|
}
|
|
32
|
-
/**
|
|
33
|
-
export type
|
|
34
|
-
readonly
|
|
32
|
+
/** 一处冲突的机读位(原样摊在拒体根上:`sendError` 的 extra / `HttpError.extra` / `refusalBody` 的 facts;型别名而不是接口 —— 要能直接当 `Record<string, unknown>` 用)。 */
|
|
33
|
+
export type FieldConflictFacts<K extends FieldConflictReason = FieldConflictReason> = {
|
|
34
|
+
readonly reason: K;
|
|
35
35
|
readonly fields: readonly FieldConflictCoordinates[K][];
|
|
36
36
|
} & Partial<FieldConflictMeasure>;
|
|
37
|
-
/** 一处冲突的机读位(原样进拒体:`sendError` 的 extra / `HttpError.extra` / 手拼体的展开;型别名而不是接口 —— 要能直接当 `Record<string, unknown>` 用)。 */
|
|
38
|
-
export type FieldConflictFacts<K extends FieldConflictKind = FieldConflictKind> = {
|
|
39
|
-
readonly detail: FieldConflictDetail<K>;
|
|
40
|
-
};
|
|
41
37
|
/**
|
|
42
38
|
* 铸一处冲突的机读位。`fields` 至少一个坐标、主语在前;`measure` 只有折叠上限那一类给。
|
|
43
39
|
*/
|
|
44
|
-
export declare function fieldConflictFacts<K extends
|
|
40
|
+
export declare function fieldConflictFacts<K extends FieldConflictReason>(reason: K, fields: readonly [FieldConflictCoordinates[K], ...FieldConflictCoordinates[K][]], measure?: FieldConflictMeasure): FieldConflictFacts<K>;
|
|
45
41
|
//# sourceMappingURL=field-conflict.d.ts.map
|
package/dist/field-conflict.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const
|
|
1
|
+
export const FIELD_CONFLICT_REASONS = [
|
|
2
2
|
"cascade_verify",
|
|
3
3
|
"image_profile",
|
|
4
4
|
"resume_anchor",
|
|
@@ -16,7 +16,7 @@ export const FIELD_CONFLICT_KINDS = [
|
|
|
16
16
|
"remember_decision",
|
|
17
17
|
"approval_feedback",
|
|
18
18
|
];
|
|
19
|
-
export function fieldConflictFacts(
|
|
20
|
-
return {
|
|
19
|
+
export function fieldConflictFacts(reason, fields, measure) {
|
|
20
|
+
return { reason, fields: [...fields], ...(measure === undefined ? {} : { count: measure.count, cap: measure.cap }) };
|
|
21
21
|
}
|
|
22
22
|
//# sourceMappingURL=field-conflict.js.map
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
*
|
|
13
13
|
* ## 两件事,两个单点
|
|
14
14
|
* · 「这台部署有没有文件历史店」只在 {@link assembleFileHistory} 判一次(后端在即在,**与旋钮无关**),产出两张脸:
|
|
15
|
-
* **店** `store` 喂 core 的 `RunnerDeps.fileHistoryStore`(还原族)、rewind 族能力位(`
|
|
15
|
+
* **店** `store` 喂 core 的 `RunnerDeps.fileHistoryStore`(还原族)、rewind 族能力位(`restoreFiles` /
|
|
16
16
|
* `rewindFilesTo` / `sessionSync`)与 2c sync 路由族;**擦除脸** `erasure` = 店的**只有删除类动词**的收窄视图,喂 E21 在线删除
|
|
17
17
|
* (`boot/session-faces.ts`)与孤儿 blob GC(`boot/reapers.ts`)。旋钮从不管擦除:关掉捕获的部署照样要能删掉已捕获的文件字节。
|
|
18
18
|
* · 「捕不捕」只在 {@link fileHistoryCaptureOf} 判一次(纯函数,输入 = 店在不在 + 旋钮)。两个消费点喂它同一组输入:
|
|
@@ -58,8 +58,8 @@ export declare function assembleFileHistory(backend: StoreBackend | undefined):
|
|
|
58
58
|
* 「捕不捕」的**唯一**判定(纯函数):能力词。`store` = 装配出来的店(在不在),`knob` = 部署旋钮 `FILE_HISTORY_CAPTURE`
|
|
59
59
|
* (`config.fileHistoryCapture`)。从**装配结果**派生,不照旋钮字面回声:后端本来就没有这只店的部署同样是 `off`。
|
|
60
60
|
*
|
|
61
|
-
* 与 `
|
|
62
|
-
* `
|
|
61
|
+
* 与 `restoreFiles` 分叉([ref] 当时写下的分叉条件,自 [ref] 成真):本词答「这台部署捕不捕、能不能按 run 关掉」,
|
|
62
|
+
* `restoreFiles` 答「这台部署能不能还原」—— 旋钮关的部署本词 `off` 而 `restoreFiles` 仍为真。
|
|
63
63
|
*/
|
|
64
64
|
export declare function fileHistoryCaptureOf(store: object | undefined, knob: boolean): FileHistoryCapture;
|
|
65
65
|
/**
|