@sema-agent/server 7.149.0 → 7.151.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 +307 -9
- package/README.md +1 -1
- package/README.zh-CN.md +1 -1
- package/USAGE.md +92 -40
- package/deploy/sema-up/README.md +7 -1
- package/deploy/sema-up/chart/Chart.yaml +1 -1
- package/deploy/sema-up/chart/templates/NOTES.txt +5 -0
- package/deploy/sema-up/chart/templates/_helpers.tpl +15 -16
- package/deploy/sema-up/chart/templates/server-v4pro.yaml +5 -3
- package/deploy/sema-up/chart/templates/server.yaml +5 -3
- package/deploy/sema-up/chart/values-full-single.yaml +3 -1
- package/deploy/sema-up/chart/values.yaml +8 -1
- package/deploy/sema-up/cluster-up.sh +1 -0
- package/deploy/sema-up/kube-up.sh +1 -1
- package/deploy/sema-up/lib/flagshape.sh +1 -1
- package/deploy/sema-up/lib/helm-values-cluster.py +2 -0
- package/deploy/sema-up/lib/helm-values-kube.py +2 -0
- package/dist/adoption/import.js +3 -3
- package/dist/approval-ask-machine.d.ts +1 -1
- package/dist/approval-card.d.ts +3 -3
- package/dist/approval-gate-currency.d.ts +2 -2
- package/dist/audit.d.ts +1 -1
- package/dist/audit.js +2 -2
- package/dist/auth-bridge.d.ts +20 -0
- package/dist/auth-bridge.js +9 -0
- package/dist/background-session-reap.d.ts +2 -2
- package/dist/bake-runner/main.d.ts +4 -2
- package/dist/bind-host.d.ts +2 -3
- package/dist/bind-host.js +2 -4
- package/dist/boot/budget-tracing.js +1 -1
- package/dist/boot/deferred-sandbox-path-env.d.ts +5 -3
- package/dist/boot/deferred-sandbox-path-env.js +1 -2
- package/dist/boot/engine-lease.d.ts +5 -0
- package/dist/boot/engine-lease.js +1 -0
- package/dist/boot/execution-env.d.ts +8 -14
- package/dist/boot/execution-env.js +54 -17
- package/dist/boot/execution-lane.js +32 -5
- package/dist/boot/late-binds.d.ts +8 -4
- package/dist/boot/late-binds.js +7 -1
- package/dist/boot/memory-consolidation.d.ts +3 -2
- package/dist/boot/memory-consolidation.js +6 -6
- package/dist/boot/parked-revive-gate.d.ts +5 -5
- package/dist/boot/parked-revive-gate.js +2 -3
- package/dist/boot/reapers.d.ts +5 -0
- package/dist/boot/reapers.js +12 -1
- package/dist/boot/resolve-spec.d.ts +7 -8
- package/dist/boot/resolve-spec.js +80 -35
- package/dist/boot/retention-lane.d.ts +1 -1
- package/dist/boot/runner-deps.d.ts +9 -2
- package/dist/boot/runner-deps.js +3 -3
- package/dist/boot/session-age-out.d.ts +36 -0
- package/dist/boot/session-age-out.js +101 -0
- package/dist/boot/session-faces.d.ts +5 -14
- package/dist/boot/session-faces.js +28 -24
- package/dist/boot/stage-01-config.js +2 -0
- package/dist/boot/stage-03-store-backend.js +2 -2
- package/dist/boot/stage-05-execution-env.d.ts +5 -3
- package/dist/boot/stage-05-execution-env.js +2 -2
- package/dist/boot/stage-06-runners.d.ts +7 -4
- package/dist/boot/stage-06-runners.js +16 -8
- package/dist/boot/stage-07-capability-layer.d.ts +7 -4
- package/dist/boot/stage-07-capability-layer.js +3 -2
- package/dist/boot/stage-08-reapers.d.ts +7 -4
- package/dist/boot/stage-08-reapers.js +4 -2
- package/dist/boot/stage-09-leader.d.ts +11 -5
- package/dist/boot/stage-09-leader.js +12 -3
- package/dist/boot/stage-10-http-server.d.ts +44 -6
- package/dist/boot/stage-10-http-server.js +12 -10
- package/dist/boot/web-admin.d.ts +1 -1
- package/dist/boot/web-admin.js +3 -1
- package/dist/boot/workflow-orchestration.d.ts +7 -2
- package/dist/boot/workflow-orchestration.js +24 -7
- package/dist/bounded-rotation.d.ts +29 -0
- package/dist/bounded-rotation.js +24 -0
- package/dist/capability-facts.d.ts +84 -66
- package/dist/capability-facts.js +58 -41
- package/dist/center-credential.d.ts +25 -6
- package/dist/center-credential.js +25 -5
- package/dist/config-catalog.d.ts +26 -7
- package/dist/config-catalog.js +15 -12
- package/dist/config-invariants.d.ts +2 -1
- package/dist/config-invariants.js +4 -4
- package/dist/config-types.d.ts +22 -15
- package/dist/config.d.ts +51 -2
- package/dist/config.js +35 -24
- package/dist/deployment-governance.d.ts +7 -28
- package/dist/deployment-governance.js +1 -14
- package/dist/deployment-shape.d.ts +9 -1
- package/dist/deployment-shape.js +2 -1
- package/dist/device-protocol.d.ts +5 -4
- package/dist/device-protocol.js +1 -1
- package/dist/device-ws-hub.d.ts +1 -0
- package/dist/device-ws-hub.js +66 -29
- package/dist/device-ws-protocol.d.ts +79 -12
- package/dist/device-ws-protocol.js +64 -26
- package/dist/engine-identity.d.ts +23 -5
- package/dist/engine-identity.js +13 -0
- package/dist/entry-mode-clamp-notice.d.ts +2 -1
- package/dist/execution-env-refusal.d.ts +23 -0
- package/dist/execution-env-refusal.js +5 -0
- package/dist/execution-lane-caps.d.ts +3 -1
- package/dist/field-conflict.d.ts +3 -3
- package/dist/file-history-capture.d.ts +11 -4
- package/dist/file-history-capture.js +9 -6
- package/dist/file-history-disclosure.d.ts +7 -5
- package/dist/file-history-disclosure.js +7 -5
- package/dist/fleet/drain-entry.d.ts +4 -0
- package/dist/fleet/engine-signal.d.ts +14 -1
- package/dist/fleet/engine-signal.js +5 -1
- package/dist/fleet/fleet-reconciler.d.ts +1 -1
- package/dist/fleet/serving-lease.d.ts +18 -3
- package/dist/fleet/serving-lease.js +81 -35
- package/dist/fleet-client.d.ts +13 -11
- package/dist/fleet-client.js +53 -33
- package/dist/history-anchor.js +1 -1
- package/dist/hitl-delivery.d.ts +1 -3
- package/dist/hitl-delivery.js +1 -1
- package/dist/hooks/hook-runner.js +2 -2
- package/dist/host-lsp-manager.d.ts +2 -2
- package/dist/http/active-run-conflict.d.ts +3 -7
- package/dist/http/active-run-conflict.js +2 -2
- package/dist/http/admission.js +19 -4
- package/dist/http/approval-sweeps.js +7 -6
- package/dist/http/caller-trust.d.ts +2 -2
- package/dist/http/caller-trust.js +3 -3
- package/dist/http/checkpoint-ctx.d.ts +20 -63
- package/dist/http/checkpoint-ctx.js +2 -24
- package/dist/http/claim-heartbeat.d.ts +4 -4
- package/dist/http/claim-heartbeat.js +3 -3
- package/dist/http/dispatch.d.ts +2 -1
- package/dist/http/dispatch.js +36 -29
- package/dist/http/durable-run-leg.js +17 -17
- package/dist/http/health-self-report.d.ts +9 -1
- package/dist/http/health-self-report.js +2 -0
- package/dist/http/owner-access.d.ts +264 -20
- package/dist/http/owner-access.js +215 -5
- package/dist/http/readiness.d.ts +4 -2
- package/dist/http/resume-ctx-read.js +38 -1
- package/dist/http/resume-legs.d.ts +2 -1
- package/dist/http/resume-legs.js +273 -89
- package/dist/http/route-ctx.d.ts +41 -19
- package/dist/http/route-table.d.ts +1 -1
- package/dist/http/routes/a2a-serve.js +15 -14
- package/dist/http/routes/admin-memory-optout.d.ts +1 -1
- package/dist/http/routes/agents-roster.js +2 -3
- package/dist/http/routes/approvals-assistant.d.ts +3 -2
- package/dist/http/routes/approvals-assistant.js +12 -12
- package/dist/http/routes/background.d.ts +3 -3
- package/dist/http/routes/capabilities.js +10 -6
- package/dist/http/routes/config-catalog.d.ts +1 -1
- package/dist/http/routes/fleet.js +10 -8
- package/dist/http/routes/mcp-reconnect.js +2 -2
- package/dist/http/routes/memory-origin.d.ts +1 -1
- package/dist/http/routes/notify-wake.js +2 -3
- package/dist/http/routes/projects.d.ts +4 -2
- package/dist/http/routes/projects.js +7 -6
- package/dist/http/routes/retention-ops.d.ts +1 -1
- package/dist/http/routes/run-permission-mode.d.ts +1 -1
- package/dist/http/routes/run-permission-mode.js +2 -2
- package/dist/http/routes/runs.d.ts +1 -1
- package/dist/http/routes/runs.js +125 -66
- package/dist/http/routes/session-memory-sync.js +4 -5
- package/dist/http/routes/session-sync.d.ts +4 -3
- package/dist/http/routes/session-sync.js +174 -83
- package/dist/http/routes/sessions-list.js +13 -7
- package/dist/http/routes/sessions.d.ts +1 -1
- package/dist/http/routes/sessions.js +26 -48
- package/dist/http/routes/tasks.js +38 -23
- package/dist/http/routes/trace-usage.js +14 -14
- package/dist/http/routes/workflows.d.ts +1 -0
- package/dist/http/routes/workflows.js +20 -38
- package/dist/http/server.d.ts +28 -30
- package/dist/http/server.js +7 -3
- package/dist/http/stored-body-replay.d.ts +3 -24
- package/dist/http/stored-body-replay.js +2 -12
- package/dist/http/submit-ctx.d.ts +1 -2
- package/dist/http/submit-ctx.js +8 -6
- package/dist/http/submit-replay.d.ts +15 -2
- package/dist/http/submit-replay.js +10 -4
- package/dist/http/wire-types.d.ts +19 -6
- package/dist/identity-source.d.ts +20 -3
- package/dist/identity-source.js +14 -0
- package/dist/index.d.ts +4 -0
- package/dist/lane-home-probe.d.ts +3 -7
- package/dist/lane-home-probe.js +0 -1
- package/dist/leader/endpoint.js +9 -8
- package/dist/leader/leader.d.ts +2 -1
- package/dist/leg-facts.d.ts +19 -5
- package/dist/leg-facts.js +3 -1
- package/dist/mcp-authorization-face.d.ts +18 -14
- package/dist/mcp-authorization-face.js +3 -2
- package/dist/memory-scope.d.ts +5 -4
- package/dist/memory-scope.js +4 -4
- package/dist/memory-store-refusal.d.ts +1 -1
- package/dist/memory-sync-client.d.ts +30 -2
- package/dist/memory-sync-client.js +16 -9
- package/dist/observability/corrupt-read-seat.d.ts +1 -1
- package/dist/observability/err-text.d.ts +7 -0
- package/dist/observability/err-text.js +5 -0
- package/dist/observability/fail-open.d.ts +12 -8
- package/dist/observability/fail-open.js +12 -8
- package/dist/observability/logger.d.ts +7 -0
- package/dist/observability/logger.js +3 -1
- package/dist/observability/metrics.js +1 -0
- package/dist/observability/run-terminal.d.ts +1 -1
- package/dist/orchestration/workflow-notify-journal.d.ts +18 -1
- package/dist/orchestration/workflow-notify-journal.js +12 -1
- package/dist/orchestration/workflow-park-decision.d.ts +70 -18
- package/dist/orchestration/workflow-park-decision.js +49 -10
- package/dist/orchestration/workflow-park-holder.d.ts +65 -0
- package/dist/orchestration/workflow-park-holder.js +98 -0
- package/dist/orchestration/workflow-record-fence.d.ts +36 -0
- package/dist/orchestration/workflow-record-fence.js +42 -0
- package/dist/owner-faces.d.ts +28 -4
- package/dist/owner-faces.js +2 -0
- package/dist/parked-decide.d.ts +104 -53
- package/dist/parked-decide.js +153 -117
- package/dist/peer-directory.d.ts +2 -2
- package/dist/peer-inbound-face.d.ts +2 -6
- package/dist/peer-inbound-face.js +0 -3
- package/dist/peer-seat.d.ts +1 -1
- package/dist/peer-seat.js +52 -59
- package/dist/permission-mode-admission.d.ts +41 -5
- package/dist/permission-mode-admission.js +29 -3
- package/dist/plugins/adoption-log-sql.d.ts +3 -1
- package/dist/plugins/adoption-log-sql.js +7 -1
- package/dist/plugins/approval-ask-store-file.d.ts +10 -2
- package/dist/plugins/approval-ask-store-file.js +8 -0
- package/dist/plugins/approval-ask-store-memory.d.ts +6 -1
- package/dist/plugins/approval-ask-store-memory.js +28 -9
- package/dist/plugins/approval-ask-store-sql.d.ts +43 -2
- package/dist/plugins/approval-ask-store-sql.js +34 -5
- package/dist/plugins/approval-exemption-store.js +3 -0
- package/dist/plugins/approval-nonce-store.js +2 -0
- package/dist/plugins/breaker-state-sql.js +2 -0
- package/dist/plugins/caching-session-store.d.ts +9 -15
- package/dist/plugins/caching-session-store.js +6 -0
- package/dist/plugins/device-store-sql.js +6 -0
- package/dist/plugins/error-origin.d.ts +18 -0
- package/dist/plugins/error-origin.js +10 -0
- package/dist/plugins/exec-path-law.d.ts +34 -0
- package/dist/plugins/exec-path-law.js +13 -0
- package/dist/plugins/execution-placement-sql.js +6 -6
- package/dist/plugins/file-run-store.js +1 -1
- package/dist/plugins/image-bake-store-sql.js +6 -0
- package/dist/plugins/image-index-sql.js +4 -0
- package/dist/plugins/landed-attendants.d.ts +212 -0
- package/dist/plugins/landed-attendants.js +161 -0
- package/dist/plugins/leader-run-store-sql.js +4 -0
- package/dist/plugins/local-checkpoint-store.d.ts +4 -1
- package/dist/plugins/local-checkpoint-store.js +3 -0
- package/dist/plugins/local-session-live-reference.d.ts +40 -0
- package/dist/plugins/local-session-live-reference.js +39 -0
- package/dist/plugins/local-session-store.d.ts +71 -33
- package/dist/plugins/local-session-store.js +129 -27
- package/dist/plugins/memory-engine-pg.js +4 -0
- package/dist/plugins/memory-engine-sql-apply.js +5 -2
- package/dist/plugins/memory-engine-tidb.js +4 -0
- package/dist/plugins/memory-optout-grant-store-sql.js +4 -0
- package/dist/plugins/memory-run-store.js +1 -1
- package/dist/plugins/memory-sync-store-pg.js +5 -0
- package/dist/plugins/memory-sync-store-tidb.js +5 -0
- package/dist/plugins/one-time-migrations.d.ts +80 -61
- package/dist/plugins/one-time-migrations.js +241 -104
- package/dist/plugins/org-delivery-quota-store.js +4 -1
- package/dist/plugins/outcome-ledger-sql.js +2 -0
- package/dist/plugins/permission-rule-store-sql.js +11 -4
- package/dist/plugins/pg-cost-quota.js +4 -0
- package/dist/plugins/pg-pool.js +28 -1
- package/dist/plugins/pg-rate-limiter.js +2 -0
- package/dist/plugins/posix-shell-fs.d.ts +6 -1
- package/dist/plugins/posix-shell-fs.js +8 -3
- package/dist/plugins/remote-env-adb.d.ts +19 -15
- package/dist/plugins/remote-env-adb.js +44 -17
- package/dist/plugins/remote-env-connect-seat.d.ts +105 -0
- package/dist/plugins/remote-env-connect-seat.js +72 -0
- package/dist/plugins/remote-env-device.d.ts +22 -5
- package/dist/plugins/remote-env-device.js +114 -14
- package/dist/plugins/remote-env-e2b.d.ts +18 -7
- package/dist/plugins/remote-env-e2b.js +53 -40
- package/dist/plugins/remote-env-file-error.js +6 -2
- package/dist/plugins/remote-env-host.d.ts +18 -1
- package/dist/plugins/remote-env-host.js +48 -47
- package/dist/plugins/remote-env-k8s.d.ts +41 -39
- package/dist/plugins/remote-env-k8s.js +56 -32
- package/dist/plugins/remote-env-local-docker.d.ts +13 -8
- package/dist/plugins/remote-env-local-docker.js +37 -43
- package/dist/plugins/remote-env-ssh.d.ts +18 -12
- package/dist/plugins/remote-env-ssh.js +64 -62
- package/dist/plugins/remote-shell.d.ts +101 -2
- package/dist/plugins/remote-shell.js +221 -3
- package/dist/plugins/replica-registration.d.ts +35 -0
- package/dist/plugins/replica-registration.js +48 -0
- package/dist/plugins/resume-anchor-store-sql.d.ts +11 -2
- package/dist/plugins/resume-anchor-store-sql.js +12 -5
- package/dist/plugins/retention-lane-store-sql.d.ts +1 -1
- package/dist/plugins/retention-lane-store-sql.js +4 -0
- package/dist/plugins/retention-sql.d.ts +20 -2
- package/dist/plugins/retention-sql.js +11 -0
- package/dist/plugins/run-store-sql.d.ts +22 -3
- package/dist/plugins/run-store-sql.js +33 -9
- package/dist/plugins/scenario-prefix-switch-m42.d.ts +6 -12
- package/dist/plugins/scenario-prefix-switch-m42.js +7 -5
- package/dist/plugins/schema-consistency.d.ts +9 -5
- package/dist/plugins/schema-consistency.js +48 -18
- package/dist/plugins/schema-drift-sentence.js +1 -1
- package/dist/plugins/send-file-ledger.js +3 -0
- package/dist/plugins/serving-requirement.d.ts +68 -0
- package/dist/plugins/serving-requirement.js +60 -0
- package/dist/plugins/session-birth.d.ts +6 -2
- package/dist/plugins/session-capture-record-store-sql.js +2 -0
- package/dist/plugins/session-ext-table.d.ts +14 -1
- package/dist/plugins/session-ext-table.js +5 -1
- package/dist/plugins/session-row-sql.d.ts +49 -2
- package/dist/plugins/session-row-sql.js +56 -13
- package/dist/plugins/session-store-sql.d.ts +34 -18
- package/dist/plugins/session-store-sql.js +98 -17
- package/dist/plugins/shared-memory-store-sql.d.ts +1 -0
- package/dist/plugins/shared-memory-store-sql.js +6 -2
- package/dist/plugins/sql-driver.d.ts +2 -1
- package/dist/plugins/sql-driver.js +18 -3
- package/dist/plugins/sql-errors.d.ts +11 -6
- package/dist/plugins/sql-errors.js +5 -6
- package/dist/plugins/stop-then-start-sentence.d.ts +48 -3
- package/dist/plugins/stop-then-start-sentence.js +48 -0
- package/dist/plugins/stop-then-start.d.ts +109 -0
- package/dist/plugins/stop-then-start.js +104 -0
- package/dist/plugins/store-backend.d.ts +40 -13
- package/dist/plugins/store-backend.js +169 -27
- package/dist/plugins/store-boundary.d.ts +57 -0
- package/dist/plugins/store-boundary.js +139 -0
- package/dist/plugins/store-contracts.d.ts +29 -2
- package/dist/plugins/store-contracts.js +3 -0
- package/dist/plugins/store-fault-sentence-m53.d.ts +7 -0
- package/dist/plugins/store-fault-sentence-m53.js +25 -0
- package/dist/plugins/store-fault.d.ts +26 -7
- package/dist/plugins/store-fault.js +18 -2
- package/dist/plugins/task-attachment-store.js +9 -0
- package/dist/plugins/task-list-store-sql.d.ts +2 -2
- package/dist/plugins/task-list-store-sql.js +10 -8
- package/dist/plugins/tidb-cost-quota.js +4 -0
- package/dist/plugins/tidb-pool.js +6 -1
- package/dist/plugins/tidb-rate-limiter.js +4 -0
- package/dist/plugins/user-input-ledger-sql.js +4 -0
- package/dist/plugins/workflow-run-store-sql.d.ts +28 -10
- package/dist/plugins/workflow-run-store-sql.js +64 -4
- package/dist/plugins/workspace-fill.d.ts +4 -7
- package/dist/plugins/workspace-fill.js +2 -1
- package/dist/plugins/write-behind-counter.js +5 -0
- package/dist/process-instance.d.ts +3 -0
- package/dist/process-instance.js +7 -0
- package/dist/project-context.d.ts +64 -0
- package/dist/project-context.js +66 -0
- package/dist/project-registry.d.ts +46 -0
- package/dist/project-registry.js +44 -0
- package/dist/question.d.ts +9 -21
- package/dist/question.js +28 -19
- package/dist/request-key-closure.js +1 -1
- package/dist/request-value-closure.d.ts +4 -0
- package/dist/request-value-closure.js +10 -0
- package/dist/run-acceptance.d.ts +3 -2
- package/dist/run-acceptance.js +4 -6
- package/dist/run-cancel-card.d.ts +1 -1
- package/dist/run-cancel-card.js +2 -1
- package/dist/run-local.js +1 -0
- package/dist/runs.d.ts +37 -8
- package/dist/runs.js +53 -12
- package/dist/runtime-governance.d.ts +5 -4
- package/dist/security.d.ts +31 -33
- package/dist/security.js +41 -7
- package/dist/server-secret-env.d.ts +12 -10
- package/dist/server-secret-env.js +24 -15
- package/dist/session-agent.d.ts +1 -10
- package/dist/session-agent.js +0 -6
- package/dist/session-bindings.d.ts +82 -0
- package/dist/session-bindings.js +18 -0
- package/dist/session-children-retire.d.ts +2 -2
- package/dist/session-children-retire.js +2 -6
- package/dist/session-deletion.d.ts +16 -1
- package/dist/session-error-wire.d.ts +3 -3
- package/dist/session-error-wire.js +3 -3
- package/dist/session-incarnation.d.ts +28 -4
- package/dist/session-incarnation.js +14 -2
- package/dist/session-kind.d.ts +57 -0
- package/dist/session-kind.js +22 -0
- package/dist/session-notify-door.d.ts +4 -4
- package/dist/session-notify-door.js +5 -6
- package/dist/session-row.d.ts +21 -1
- package/dist/session-row.js +7 -1
- package/dist/session-rules-seat.d.ts +4 -3
- package/dist/session-rules-seat.js +3 -11
- package/dist/session-sync-kernel.d.ts +24 -14
- package/dist/session-sync-kernel.js +3 -6
- package/dist/session-sync.d.ts +4 -98
- package/dist/session-sync.js +4 -74
- package/dist/session-titler.d.ts +10 -3
- package/dist/session-titler.js +19 -6
- package/dist/ssh-host-key.d.ts +5 -0
- package/dist/ssh-host-key.js +3 -0
- package/dist/stores-sql/checkpoint-store-sql.d.ts +21 -2
- package/dist/stores-sql/checkpoint-store-sql.js +106 -18
- package/dist/stores-sql/file-history-store-sql.d.ts +52 -2
- package/dist/stores-sql/file-history-store-sql.js +108 -70
- package/dist/stores-sql/pg-session-storage.d.ts +34 -7
- package/dist/stores-sql/pg-session-storage.js +37 -13
- package/dist/stores-sql/retention-store-sql.d.ts +2 -10
- package/dist/stores-sql/retention-store-sql.js +2 -10
- package/dist/stores-sql/session-policy-store-sql.d.ts +30 -7
- package/dist/stores-sql/session-policy-store-sql.js +61 -44
- package/dist/stores-sql/session-write-hooks.d.ts +11 -0
- package/dist/stores-sql/tidb-session-store.d.ts +58 -7
- package/dist/stores-sql/tidb-session-store.js +37 -13
- package/dist/submission-exit.d.ts +3 -2
- package/dist/submission-exit.js +9 -1
- package/dist/task-cwd.d.ts +6 -5
- package/dist/task-settings.d.ts +19 -5
- package/dist/task-settings.js +13 -7
- package/dist/terminal.d.ts +33 -2
- package/dist/terminal.js +139 -9
- package/dist/tool-approval.d.ts +147 -12
- package/dist/tool-approval.js +206 -109
- package/dist/trace/engine-notice-wire.d.ts +14 -0
- package/dist/trace/engine-notice-wire.js +18 -1
- package/dist/trace/project.d.ts +4 -3
- package/dist/trace/project.js +3 -2
- package/dist/trace/projection-table.d.ts +33 -2
- package/dist/trace/self-minted-wire.d.ts +422 -26
- package/dist/trace/self-minted-wire.js +149 -23
- package/dist/trace/tool-card.d.ts +3 -0
- package/dist/trace/tool-card.js +24 -0
- package/dist/trace/tool-output-media.d.ts +2 -1
- package/dist/unattended-permission-mode.d.ts +1 -1
- package/dist/web-admin-client/apply-effective.d.ts +1 -1
- package/dist/web-admin-client/effective-keys.d.ts +1 -1
- package/dist/web-admin-client/skills-mcp.d.ts +1 -1
- package/docs/DEVICE-EXECUTOR-PROTOCOL.md +120 -41
- package/package.json +3 -3
- package/wire-changes/server@7.150.0.json +335 -0
- package/wire-changes/server@7.151.0.json +762 -0
- package/dist/http/session-inherit-env.d.ts +0 -36
- package/dist/http/session-inherit-env.js +0 -6
package/dist/device-ws-hub.js
CHANGED
|
@@ -5,7 +5,7 @@ import { WebSocketServer } from "ws";
|
|
|
5
5
|
import { DEVICE_DRAINING_CODE, DEVICE_ERROR_CODES, DEVICE_ERROR_STATUS, assertDeviceIdShape, } from "./device-store.js";
|
|
6
6
|
import { MAX_TIMER_DELAY_MS } from "./config-types.js";
|
|
7
7
|
import { canonicalAddress, createTrustedProxySet } from "./net-address.js";
|
|
8
|
-
import { DEVICE_HELLO_ACK_BOUNDS, DEVICE_MIN_PROTOCOL_VERSION, DEVICE_WS_LIMITS, DEVICE_WS_PATH, DEVICE_PROTOCOL_VERSION,
|
|
8
|
+
import { DEVICE_HELLO_ACK_BOUNDS, DEVICE_MIN_PROTOCOL_VERSION, DEVICE_WS_LIMITS, DEVICE_WS_PATH, DEVICE_PROTOCOL_VERSION, asInstructionKindAt, buildHelloSignaturePayload, deviceHelloAckNumberFlaw, deviceProtocolRevisionRefusal, formatGeneration, mintChallengeNonce, mintInstructionId, parseDeviceFrameText, verifyHelloSignature, } from "./device-ws-protocol.js";
|
|
9
9
|
const OUTCOME_UNKNOWN_SENTENCE = "outcome unknown — the command may have already executed on the device; verify its effect before re-running";
|
|
10
10
|
const SETTLED_MEMO_MAX = 512;
|
|
11
11
|
const DRAIN_RETRY_AFTER_SEC = 15;
|
|
@@ -27,6 +27,25 @@ function outcomeUnknown(why) {
|
|
|
27
27
|
return { ok: false, errorCode: "outcome_unknown", message: `${why} — ${OUTCOME_UNKNOWN_SENTENCE}` };
|
|
28
28
|
}
|
|
29
29
|
const WRITE_PAYLOAD_KINDS = new Set(["writeFile", "writeFileExclusive", "writeFileGuarded", "appendFile"]);
|
|
30
|
+
const PAYLOAD_CHUNK_ENVELOPE_BYTES = Buffer.byteLength(JSON.stringify({ t: "payload", gen: String(Number.MAX_SAFE_INTEGER), instructionId: mintInstructionId(), part: "chunk", offset: Number.MAX_SAFE_INTEGER, dataB64: "" }), "utf8");
|
|
31
|
+
export const DEVICE_MAX_PAYLOAD_PART_BYTES = Math.floor((DEVICE_WS_LIMITS.maxFrameBytes - PAYLOAD_CHUNK_ENVELOPE_BYTES) / 4) * 3;
|
|
32
|
+
const FRAME_TOO_LARGE = "frame_too_large";
|
|
33
|
+
function encodeServerFrame(frame) {
|
|
34
|
+
const text = JSON.stringify(frame);
|
|
35
|
+
const bytes = Buffer.byteLength(text, "utf8");
|
|
36
|
+
return bytes <= DEVICE_WS_LIMITS.maxFrameBytes ? { ok: true, text } : { ok: false, bytes };
|
|
37
|
+
}
|
|
38
|
+
function frameTooLargeResult(kind, bytes) {
|
|
39
|
+
return {
|
|
40
|
+
kind: "never_started",
|
|
41
|
+
outcome: {
|
|
42
|
+
ok: false,
|
|
43
|
+
errorCode: "not_supported",
|
|
44
|
+
message: `[${FRAME_TOO_LARGE}] the ${kind} instruction frame would be ${bytes} bytes, over the device protocol's ${DEVICE_WS_LIMITS.maxFrameBytes}-byte frame cap — ` +
|
|
45
|
+
"it was never sent (the device transport drops a connection that carries a frame that size); keep a command and its arguments under the cap, and move large content into a file write (it travels in slices)",
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
}
|
|
30
49
|
const ALLOWED_SUCCESS_OUTCOME_KINDS = {
|
|
31
50
|
exec: ["exec"],
|
|
32
51
|
execStream: ["exec"],
|
|
@@ -47,6 +66,7 @@ const ALLOWED_SUCCESS_OUTCOME_KINDS = {
|
|
|
47
66
|
remove: ["void"],
|
|
48
67
|
createTempDir: ["write"],
|
|
49
68
|
createTempFile: ["write"],
|
|
69
|
+
openBound: ["stat", "read"],
|
|
50
70
|
};
|
|
51
71
|
const HELLO_ACK_FIELD_SOURCES = {
|
|
52
72
|
heartbeatIntervalMs: "option heartbeatIntervalMs",
|
|
@@ -145,14 +165,22 @@ export function createDeviceWsHub(options) {
|
|
|
145
165
|
.catch((err) => logger?.error("device_audit_write_failed", { event, err: err instanceof Error ? err.message : String(err) }));
|
|
146
166
|
}
|
|
147
167
|
function sendServerFrame(conn, frame) {
|
|
168
|
+
const encoded = encodeServerFrame(frame);
|
|
169
|
+
if (!encoded.ok) {
|
|
170
|
+
logger?.error("device_ws_frame_over_cap", { deviceId: conn.deviceId, t: frame.t, bytes: encoded.bytes, cap: DEVICE_WS_LIMITS.maxFrameBytes });
|
|
171
|
+
return false;
|
|
172
|
+
}
|
|
173
|
+
return writeServerText(conn, frame.t, encoded.text);
|
|
174
|
+
}
|
|
175
|
+
function writeServerText(conn, t, text) {
|
|
148
176
|
if (conn.ws.readyState !== conn.ws.OPEN)
|
|
149
177
|
return false;
|
|
150
178
|
try {
|
|
151
|
-
conn.ws.send(
|
|
179
|
+
conn.ws.send(text);
|
|
152
180
|
return true;
|
|
153
181
|
}
|
|
154
182
|
catch (err) {
|
|
155
|
-
logger?.warn("device_ws_send_failed", { deviceId: conn.deviceId, t
|
|
183
|
+
logger?.warn("device_ws_send_failed", { deviceId: conn.deviceId, t, err: err instanceof Error ? err.message : String(err) });
|
|
156
184
|
return false;
|
|
157
185
|
}
|
|
158
186
|
}
|
|
@@ -301,11 +329,11 @@ export function createDeviceWsHub(options) {
|
|
|
301
329
|
}, reconnectGraceMs);
|
|
302
330
|
reconnectTimers.set(deviceId, timer);
|
|
303
331
|
}
|
|
304
|
-
function rejectHello(conn, code,
|
|
332
|
+
function rejectHello(conn, code, version) {
|
|
305
333
|
if (conn.handshakeTimer)
|
|
306
334
|
clearTimeout(conn.handshakeTimer);
|
|
307
335
|
conn.handshakeTimer = null;
|
|
308
|
-
sendServerFrame(conn, { t: "helloReject", code, ...
|
|
336
|
+
sendServerFrame(conn, { t: "helloReject", code, ...version });
|
|
309
337
|
closeConn(conn, { releaseLease: false });
|
|
310
338
|
}
|
|
311
339
|
async function fenceConnection(conn) {
|
|
@@ -367,7 +395,10 @@ export function createDeviceWsHub(options) {
|
|
|
367
395
|
if (draining || closed)
|
|
368
396
|
return rejectHello(conn, "draining");
|
|
369
397
|
if (frame.protocolVersion < DEVICE_MIN_PROTOCOL_VERSION || frame.protocolVersion > DEVICE_PROTOCOL_VERSION) {
|
|
370
|
-
|
|
398
|
+
const message = deviceProtocolRevisionRefusal(frame.protocolVersion);
|
|
399
|
+
logger?.warn("device_hello_version_rejected", { declared: frame.protocolVersion, minProtocolVersion: DEVICE_MIN_PROTOCOL_VERSION, protocolVersion: DEVICE_PROTOCOL_VERSION, message });
|
|
400
|
+
metrics?.inc("device_hello_rejected_total", { code: "protocol_version_unsupported" });
|
|
401
|
+
return rejectHello(conn, "protocol_version_unsupported", { minProtocolVersion: DEVICE_MIN_PROTOCOL_VERSION, message });
|
|
371
402
|
}
|
|
372
403
|
let idShapeOk = true;
|
|
373
404
|
try {
|
|
@@ -470,7 +501,7 @@ export function createDeviceWsHub(options) {
|
|
|
470
501
|
conn.workspaceRoot = frame.workspaceRoot;
|
|
471
502
|
const supported = new Set();
|
|
472
503
|
for (const s of frame.supports) {
|
|
473
|
-
const k =
|
|
504
|
+
const k = asInstructionKindAt(s, frame.protocolVersion);
|
|
474
505
|
if (k !== null)
|
|
475
506
|
supported.add(k);
|
|
476
507
|
}
|
|
@@ -860,8 +891,8 @@ export function createDeviceWsHub(options) {
|
|
|
860
891
|
async function dispatch(input) {
|
|
861
892
|
if (input.payloadPartBytes !== undefined) {
|
|
862
893
|
const n = input.payloadPartBytes;
|
|
863
|
-
if (!Number.isSafeInteger(n) || n <= 0 || n >
|
|
864
|
-
throw new Error(`device-ws: payloadPartBytes must be a positive safe integer ≤ ${DEVICE_WS_LIMITS.maxFrameBytes}
|
|
894
|
+
if (!Number.isSafeInteger(n) || n <= 0 || n > DEVICE_MAX_PAYLOAD_PART_BYTES) {
|
|
895
|
+
throw new Error(`device-ws: payloadPartBytes must be a positive safe integer ≤ ${DEVICE_MAX_PAYLOAD_PART_BYTES} (the ${DEVICE_WS_LIMITS.maxFrameBytes}-byte frame cap after base64 and the chunk envelope; got ${String(n)})`);
|
|
865
896
|
}
|
|
866
897
|
}
|
|
867
898
|
if (!Number.isSafeInteger(input.timeoutMs) || input.timeoutMs <= 0) {
|
|
@@ -963,7 +994,32 @@ export function createDeviceWsHub(options) {
|
|
|
963
994
|
releaseSlot(deviceId);
|
|
964
995
|
return abortedBeforeCommit();
|
|
965
996
|
}
|
|
997
|
+
let args = input.args;
|
|
998
|
+
let body = null;
|
|
999
|
+
let sha = "";
|
|
1000
|
+
if (input.payload !== undefined && WRITE_PAYLOAD_KINDS.has(input.kind)) {
|
|
1001
|
+
body = Buffer.from(input.payload);
|
|
1002
|
+
sha = createHash("sha256").update(body).digest("hex");
|
|
1003
|
+
args = { ...input.args, contentLen: body.length, sha256: sha };
|
|
1004
|
+
}
|
|
966
1005
|
const instructionId = mintInstructionId();
|
|
1006
|
+
const instructionFrame = encodeServerFrame({
|
|
1007
|
+
t: "instruction",
|
|
1008
|
+
gen: conn.genStr,
|
|
1009
|
+
instructionId,
|
|
1010
|
+
rootSessionId: input.rootSessionId,
|
|
1011
|
+
issuedSeq: conn.issuedSeq + 1,
|
|
1012
|
+
kind: input.kind,
|
|
1013
|
+
args,
|
|
1014
|
+
...(input.cwd === undefined ? {} : { cwd: input.cwd }),
|
|
1015
|
+
...(input.shellEnv === undefined ? {} : { shellEnv: input.shellEnv }),
|
|
1016
|
+
timeoutMs: input.timeoutMs,
|
|
1017
|
+
});
|
|
1018
|
+
if (!instructionFrame.ok) {
|
|
1019
|
+
releaseSlot(deviceId);
|
|
1020
|
+
logger?.warn("device_instruction_frame_over_cap", { deviceId, kind: input.kind, bytes: instructionFrame.bytes, cap: DEVICE_WS_LIMITS.maxFrameBytes });
|
|
1021
|
+
return frameTooLargeResult(input.kind, instructionFrame.bytes);
|
|
1022
|
+
}
|
|
967
1023
|
conn.issuedSeq += 1;
|
|
968
1024
|
let resolve;
|
|
969
1025
|
const settled = new Promise((r) => {
|
|
@@ -996,26 +1052,7 @@ export function createDeviceWsHub(options) {
|
|
|
996
1052
|
resolve,
|
|
997
1053
|
};
|
|
998
1054
|
pending.set(instructionId, p);
|
|
999
|
-
|
|
1000
|
-
let body = null;
|
|
1001
|
-
let sha = "";
|
|
1002
|
-
if (input.payload !== undefined && WRITE_PAYLOAD_KINDS.has(input.kind)) {
|
|
1003
|
-
body = Buffer.from(input.payload);
|
|
1004
|
-
sha = createHash("sha256").update(body).digest("hex");
|
|
1005
|
-
args = { ...input.args, contentLen: body.length, sha256: sha };
|
|
1006
|
-
}
|
|
1007
|
-
const wrote = sendServerFrame(conn, {
|
|
1008
|
-
t: "instruction",
|
|
1009
|
-
gen: conn.genStr,
|
|
1010
|
-
instructionId,
|
|
1011
|
-
rootSessionId: input.rootSessionId,
|
|
1012
|
-
issuedSeq: conn.issuedSeq,
|
|
1013
|
-
kind: input.kind,
|
|
1014
|
-
args,
|
|
1015
|
-
...(input.cwd === undefined ? {} : { cwd: input.cwd }),
|
|
1016
|
-
...(input.shellEnv === undefined ? {} : { shellEnv: input.shellEnv }),
|
|
1017
|
-
timeoutMs: input.timeoutMs,
|
|
1018
|
-
});
|
|
1055
|
+
const wrote = writeServerText(conn, "instruction", instructionFrame.text);
|
|
1019
1056
|
if (body !== null)
|
|
1020
1057
|
sendPayloadSequence(conn, instructionId, body, input.payloadPartBytes ?? DEVICE_WS_LIMITS.defaultPayloadPartBytes, sha);
|
|
1021
1058
|
metrics?.inc("device_instruction_dispatched_total", { kind: input.kind });
|
|
@@ -4,14 +4,29 @@ export declare const DEVICE_WS_PATH = "/v1/device/ws";
|
|
|
4
4
|
/**
|
|
5
5
|
* 本 server 铸/认的协议**修订号**(wire 上的 `protocolVersion`)。
|
|
6
6
|
*
|
|
7
|
-
* 规则(§
|
|
8
|
-
*
|
|
9
|
-
* ({@link DEVICE_OUTCOME_ERROR_CODES_BY_REVISION}
|
|
10
|
-
* (
|
|
7
|
+
* 规则(真源 = 协议文档 `docs/DEVICE-EXECUTOR-PROTOCOL.md` §2.1「Protocol revisions」段,此处只转述):加帧 / 加字段 = additive 不升号;
|
|
8
|
+
* 其余变更一律升号并在增量表加一行,已发布的行不改 —— **指令两向的闭集加词 = 升号**:server 受理的结局 `errorCode` 词集(executor → server)
|
|
9
|
+
* 与 server 下发的指令 kind 集(server → executor),各一张按修订号分行的表({@link DEVICE_OUTCOME_ERROR_CODES_BY_REVISION} /
|
|
10
|
+
* {@link DEVICE_INSTRUCTION_KINDS_BY_REVISION},同一组行键;协议文档是同一张修订号表的两栏);**语义变更(server 下发的帧意思变了)= 升号**。
|
|
11
|
+
* 修订号是 executor 在发 hello 之前唯一能读到的「这台 server 受理什么、会发来什么、发来的帧是什么意思」的事实(challenge 帧带它),所以两个闭集
|
|
12
|
+
* 都必须是修订号的函数,不另发第二份列表;闭集变了而修订号没变 = 同一个修订号两种集合(7.132.0 给结局码加 `liveness_no_output` 时没抬号,7.136.0 补到 2)。
|
|
13
|
+
* 下发方向的读法:汇聚端只认**这条连接协商的修订号**那一份 kind 集({@link asInstructionKindAt}),高于它的 kind 与认不出的词同读 —— 恒不下发。
|
|
14
|
+
* 类型锁:抬了号而任一张表没有这一行 ⇒ 编译红。
|
|
11
15
|
*/
|
|
12
16
|
export declare const DEVICE_PROTOCOL_VERSION: DeviceProtocolRevision;
|
|
13
|
-
/**
|
|
14
|
-
|
|
17
|
+
/**
|
|
18
|
+
* 受理下沿:低于它 ⇒ `helloReject: protocol_version_unsupported`(带 `minProtocolVersion` 与一句 {@link deviceProtocolRevisionRefusal},响亮拒,不静默降级,[ref])。
|
|
19
|
+
* 兼容窗 = [MIN, 当前]。律(协议文档 §2.1 规则句):升号的变更旧修订的 executor 守不住 ⇒ 同一版把下沿抬到那一修订号 —— 旧 executor 在 hello 被拒一次,
|
|
20
|
+
* 而不是逐调用失败。今天 = 5:修订号 5 起路径只锚不折(下沿理由见 {@link DEVICE_FLOOR_CHANGE}),写给修订号 ≤ 4 的 executor 认的是折过的路径。
|
|
21
|
+
* 修订号 6(kind 集加 `openBound`)不抬下沿:那个 kind 只派给协商修订号 ≥ 6 的连接,修订号 5 的 executor 收不到它 ⇒ 守得住。
|
|
22
|
+
* 这是**本 server** 的受理下沿,不是 executor 协商时的下界(executor 一侧修订号是累积的:实现了 5 的照样能按 4 服务老 server)。
|
|
23
|
+
*/
|
|
24
|
+
export declare const DEVICE_MIN_PROTOCOL_VERSION: DeviceProtocolRevision;
|
|
25
|
+
/**
|
|
26
|
+
* `protocol_version_unsupported` 的那一句 `message`(帧上与服务端 warn 行同一句;executor 可原样示人)。声明值在窗外只有两种:低于下沿 / 高于上沿。
|
|
27
|
+
* 握手之前的帧,任何能开 socket 的对端都读得到 ⇒ 句里只有修订号与下沿引入的版本,不带本进程的服务版本号。
|
|
28
|
+
*/
|
|
29
|
+
export declare function deviceProtocolRevisionRefusal(declared: number): string;
|
|
15
30
|
/** 签名的 domain tag —— 换域即换 tag,防止别处的 Ed25519 签名被拿来当握手用。 */
|
|
16
31
|
export declare const DEVICE_HELLO_DOMAIN_TAG = "sema.device.hello.v1";
|
|
17
32
|
/**
|
|
@@ -60,11 +75,44 @@ export type DeviceCancelState = (typeof DEVICE_CANCEL_STATES)[number];
|
|
|
60
75
|
*/
|
|
61
76
|
export declare const DEVICE_INSTRUCTION_STATES: readonly ["queued", "dispatch_committed", "terminal", "terminal_never_started"];
|
|
62
77
|
export type DeviceInstructionState = (typeof DEVICE_INSTRUCTION_STATES)[number];
|
|
63
|
-
/**
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
78
|
+
/**
|
|
79
|
+
* 指令 kind ↔ core 的 FileSystem+Shell 面 1:1(§5.1;双端穷举 switch)—— **按修订号分行的增量表,是这个闭集唯一的一份来源**(与结局码同一条律):
|
|
80
|
+
* 修订号 N 的 kind 集 = 行 ≤ N 的并、按行序({@link deviceInstructionKindsAt}),{@link DEVICE_INSTRUCTION_KINDS} 是当前修订号的那一份(派生)。
|
|
81
|
+
* 汇聚端对一条连接只认它协商的修订号那一份({@link asInstructionKindAt}):executor 在 `hello.supports` 里声明了一个高于自己修订号的 kind,与声明了
|
|
82
|
+
* 一个认不出的词同读 —— 不进声明集、恒不下发。已发布修订号的行不许改(测试冻结了每个修订号的集合哈希);加 kind = 抬 {@link DEVICE_PROTOCOL_VERSION} + 加一行。
|
|
83
|
+
* 行键与 {@link DEVICE_OUTCOME_ERROR_CODES_BY_REVISION} 同一组(`satisfies` 锁:少一行 / 多一行 ⇒ 编译红)。
|
|
84
|
+
*/
|
|
85
|
+
export declare const DEVICE_INSTRUCTION_KINDS_BY_REVISION: {
|
|
86
|
+
readonly 1: readonly ["exec", "execStream", "readTextFile", "readTextLines", "readBinaryFile", "writeFile", "writeFileExclusive", "writeFileGuarded", "appendFile", "fileInfo", "listDir", "canonicalPath", "exists", "readLink", "createDir", "remove", "createTempDir", "createTempFile", "statBatch"];
|
|
87
|
+
readonly 2: readonly [];
|
|
88
|
+
readonly 3: readonly [];
|
|
89
|
+
readonly 4: readonly [];
|
|
90
|
+
readonly 5: readonly [];
|
|
91
|
+
/**
|
|
92
|
+
* 7.151.0:绑定读 —— 判过的那只对象就是读到的那只。协议没有跨指令的句柄,所以 `BoundFileObject` 的每一答是一条指令
|
|
93
|
+
* ({@link DeviceInstructionArgsByKind}`.openBound.op` 四选一):执行器在本机打开这条路径(叶链接不跟)、核对这只打开的对象此刻就在这条路径上
|
|
94
|
+
* (且 `identity` / `kind` 在场时等于它们)、经这一次打开作答、关掉。executor 必须实现才答得出 ⇒ 加词抬号;只派给协商修订号 ≥ 6 的连接,
|
|
95
|
+
* 修订号 5 的 executor 收不到它(受理下沿不动)。presence-typed(同 `writeFileGuarded` / `readLink`):执行器在 `hello.supports` 声明才装这一面;
|
|
96
|
+
* 没声明 ⇒ 这一面缺席(引擎不绑定读,附件不附),**不许**用 `fileInfo` + `readBinaryFile` 仿真。
|
|
97
|
+
*/
|
|
98
|
+
readonly 6: readonly ["openBound"];
|
|
99
|
+
};
|
|
100
|
+
export type DeviceInstructionKind = (typeof DEVICE_INSTRUCTION_KINDS_BY_REVISION)[DeviceProtocolRevision][number];
|
|
101
|
+
/**
|
|
102
|
+
* 协议修订号 `revision` 下发的指令 kind 全集(行 ≤ revision 的并,按行序 —— 协议文档 §3.1 的表同序)。executor 按**自己声明的修订号**取这一份,
|
|
103
|
+
* 决定 `hello.supports` 里能声明哪些 kind。不是本包认得的修订号 ⇒ 抛 `RangeError`(不静默给空集或全集)。
|
|
104
|
+
*/
|
|
105
|
+
export declare function deviceInstructionKindsAt(revision: number): readonly DeviceInstructionKind[];
|
|
106
|
+
/** 当前修订号下发的 kind 全集(派生自增量表;§3.1 的表就是它)。 */
|
|
107
|
+
export declare const DEVICE_INSTRUCTION_KINDS: readonly DeviceInstructionKind[];
|
|
108
|
+
/** `openBound` 指令的四个答(一个 `BoundFileObject` 成员一个;`open` 是开答)。 */
|
|
109
|
+
export declare const DEVICE_BOUND_READ_OPS: readonly ["open", "size", "readBytes", "list"];
|
|
110
|
+
export type DeviceBoundReadOp = (typeof DEVICE_BOUND_READ_OPS)[number];
|
|
111
|
+
/**
|
|
112
|
+
* 认词 **按协商修订号**:`v` 在修订号 `revision` 的 kind 集里就收窄,不在就 null(**不猜**:高于协商修订号的 kind 与认不出的词同读,恒不下发,fail-closed 方向)。
|
|
113
|
+
* 不是本包认得的修订号 ⇒ 抛 `RangeError`(汇聚端在 hello 的版本窗之后才调它,窗外到不了这里;到了就是响亮的缺陷,不静默给全集)。
|
|
114
|
+
*/
|
|
115
|
+
export declare function asInstructionKindAt(v: string, revision: number): DeviceInstructionKind | null;
|
|
68
116
|
/**
|
|
69
117
|
* 结果帧的错误码闭集 = core 的 `FileErrorCode ∪ ExecutionErrorCode`(§5.1「error code 全闭集」:
|
|
70
118
|
* 未知值映射为协议错误而非透传 string)—— **按修订号分行的增量表,是这个闭集唯一的一份来源**:
|
|
@@ -76,6 +124,8 @@ export declare const DEVICE_OUTCOME_ERROR_CODES_BY_REVISION: {
|
|
|
76
124
|
readonly 2: readonly ["liveness_no_output"];
|
|
77
125
|
readonly 3: readonly ["name_too_long"];
|
|
78
126
|
readonly 4: readonly ["symlink_loop"];
|
|
127
|
+
readonly 5: readonly [];
|
|
128
|
+
readonly 6: readonly [];
|
|
79
129
|
};
|
|
80
130
|
/** 本包认得的协议修订号(= 增量表的行键)。 */
|
|
81
131
|
export type DeviceProtocolRevision = keyof typeof DEVICE_OUTCOME_ERROR_CODES_BY_REVISION;
|
|
@@ -139,7 +189,9 @@ export type DeviceInstructionOutcome = {
|
|
|
139
189
|
} | {
|
|
140
190
|
ok: true;
|
|
141
191
|
kind: "read";
|
|
142
|
-
}
|
|
192
|
+
}
|
|
193
|
+
/** `identity` 是 additive 扩键(`openBound` 开答:被打开对象的 `<dev>:<inode>`,之后每一答的对拍凭据)。 */
|
|
194
|
+
| {
|
|
143
195
|
ok: true;
|
|
144
196
|
kind: "stat";
|
|
145
197
|
info?: WireFileInfo;
|
|
@@ -147,6 +199,7 @@ export type DeviceInstructionOutcome = {
|
|
|
147
199
|
existsValue?: boolean;
|
|
148
200
|
canonicalPath?: string;
|
|
149
201
|
linkTarget?: string | null;
|
|
202
|
+
identity?: string;
|
|
150
203
|
}
|
|
151
204
|
/** 写面的**落盘对象收据**(§4.3.1 / core `WriteReceipt`)。`created` 是 additive 扩键(车A-4):
|
|
152
205
|
* core 的收据形要求它,缺席 = adapter 只能猜「是新建还是覆盖」,而猜出来的收据就是假收据。 */
|
|
@@ -243,6 +296,18 @@ export interface DeviceInstructionArgsByKind {
|
|
|
243
296
|
statBatch: {
|
|
244
297
|
paths: string[];
|
|
245
298
|
};
|
|
299
|
+
/**
|
|
300
|
+
* 绑定读的一答。`op`:`open` ⇒ `stat` 结局带 `identity` 与 `info`(`kind` 只许 `file` / `dir`);`size` ⇒ `stat` 带 `info`(`size` = 此刻大小);
|
|
301
|
+
* `readBytes` ⇒ `read` 结局 + `data` 片(大小 > `max` ⇒ `invalid`,一个字节不读);`list` ⇒ `stat` 带 `entries`(经这只打开的目录列,链接不跟)。
|
|
302
|
+
* `identity` / `kind` 在场(开答之后的三答)⇒ 这一次打开的对象须与它们都相等,否则 `precondition_failed`;开后不在这条路径上同拒。
|
|
303
|
+
*/
|
|
304
|
+
openBound: {
|
|
305
|
+
path: string;
|
|
306
|
+
op: DeviceBoundReadOp;
|
|
307
|
+
identity?: string;
|
|
308
|
+
kind?: "file" | "directory";
|
|
309
|
+
max?: number;
|
|
310
|
+
};
|
|
246
311
|
}
|
|
247
312
|
export type DeviceChallengeFrame = {
|
|
248
313
|
t: "challenge";
|
|
@@ -275,10 +340,12 @@ export type DeviceHelloAckFrame = {
|
|
|
275
340
|
chunkGapTimeoutMs?: number;
|
|
276
341
|
executionCeilingGraceMs?: number;
|
|
277
342
|
};
|
|
343
|
+
/** `minProtocolVersion` 与 `message` 只出现在 `protocol_version_unsupported` 上(加字段 = additive,不升号;协议文档 §1.4 / §2.3)。 */
|
|
278
344
|
export type DeviceHelloRejectFrame = {
|
|
279
345
|
t: "helloReject";
|
|
280
346
|
code: DeviceHelloRejectCode;
|
|
281
347
|
minProtocolVersion?: number;
|
|
348
|
+
message?: string;
|
|
282
349
|
};
|
|
283
350
|
/**
|
|
284
351
|
* helloAck 六个数值位的**合法域**(闭区间、整数)—— 一处成文:汇聚端创建时按它校验(越界 ⇒ 响亮拒启,不夹取、不换成缺省),
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import { createPublicKey, randomBytes, randomInt, verify as edVerify } from "node:crypto";
|
|
2
2
|
import { MAX_TIMER_DELAY_MS, inWholeNumberBounds, wholeNumberBoundsRule } from "./config-types.js";
|
|
3
3
|
export const DEVICE_WS_PATH = "/v1/device/ws";
|
|
4
|
-
export const DEVICE_PROTOCOL_VERSION =
|
|
5
|
-
export const DEVICE_MIN_PROTOCOL_VERSION =
|
|
4
|
+
export const DEVICE_PROTOCOL_VERSION = 6;
|
|
5
|
+
export const DEVICE_MIN_PROTOCOL_VERSION = 5;
|
|
6
|
+
const DEVICE_FLOOR_CHANGE = 'since server 7.150.0 every path an instruction carries (args.path, args.paths, cwd) arrives unfolded, with "." / ".." / empty segments kept for the device\'s filesystem to resolve';
|
|
7
|
+
export function deviceProtocolRevisionRefusal(declared) {
|
|
8
|
+
return declared < DEVICE_MIN_PROTOCOL_VERSION
|
|
9
|
+
? `device protocol revision ${declared} is below the lowest revision this server accepts (${DEVICE_MIN_PROTOCOL_VERSION}): ${DEVICE_FLOOR_CHANGE}; upgrade the executor to one that declares revision ${DEVICE_MIN_PROTOCOL_VERSION} or above`
|
|
10
|
+
: `device protocol revision ${declared} is above the highest revision this server speaks (${DEVICE_PROTOCOL_VERSION}): declare the highest revision you implement that is not above challenge.protocolVersion`;
|
|
11
|
+
}
|
|
6
12
|
export const DEVICE_HELLO_DOMAIN_TAG = "sema.device.hello.v1";
|
|
7
13
|
export const DEVICE_WS_LIMITS = {
|
|
8
14
|
maxFrameBytes: 1024 * 1024,
|
|
@@ -18,30 +24,54 @@ export const DEVICE_GOODBYE_REASONS = ["shutdown", "sleep", "user_stop"];
|
|
|
18
24
|
export const DEVICE_CHUNK_KINDS = ["stdout", "stderr", "data", "exit"];
|
|
19
25
|
export const DEVICE_CANCEL_STATES = ["not_started", "killed"];
|
|
20
26
|
export const DEVICE_INSTRUCTION_STATES = ["queued", "dispatch_committed", "terminal", "terminal_never_started"];
|
|
21
|
-
export const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
27
|
+
export const DEVICE_INSTRUCTION_KINDS_BY_REVISION = {
|
|
28
|
+
1: [
|
|
29
|
+
"exec",
|
|
30
|
+
"execStream",
|
|
31
|
+
"readTextFile",
|
|
32
|
+
"readTextLines",
|
|
33
|
+
"readBinaryFile",
|
|
34
|
+
"writeFile",
|
|
35
|
+
"writeFileExclusive",
|
|
36
|
+
"writeFileGuarded",
|
|
37
|
+
"appendFile",
|
|
38
|
+
"fileInfo",
|
|
39
|
+
"listDir",
|
|
40
|
+
"canonicalPath",
|
|
41
|
+
"exists",
|
|
42
|
+
"readLink",
|
|
43
|
+
"createDir",
|
|
44
|
+
"remove",
|
|
45
|
+
"createTempDir",
|
|
46
|
+
"createTempFile",
|
|
47
|
+
"statBatch",
|
|
48
|
+
],
|
|
49
|
+
2: [],
|
|
50
|
+
3: [],
|
|
51
|
+
4: [],
|
|
52
|
+
5: [],
|
|
53
|
+
6: ["openBound"],
|
|
54
|
+
};
|
|
55
|
+
export function deviceInstructionKindsAt(revision) {
|
|
56
|
+
if (!Number.isInteger(revision) || revision < 1 || revision > DEVICE_PROTOCOL_VERSION) {
|
|
57
|
+
throw new RangeError(`device-ws: no instruction-kind set for protocol revision ${String(revision)} (this package knows revisions 1..${DEVICE_PROTOCOL_VERSION})`);
|
|
58
|
+
}
|
|
59
|
+
const out = [];
|
|
60
|
+
for (const [rev, kinds] of Object.entries(DEVICE_INSTRUCTION_KINDS_BY_REVISION)) {
|
|
61
|
+
if (Number(rev) <= revision)
|
|
62
|
+
out.push(...kinds);
|
|
63
|
+
}
|
|
64
|
+
return out;
|
|
65
|
+
}
|
|
66
|
+
export const DEVICE_INSTRUCTION_KINDS = deviceInstructionKindsAt(DEVICE_PROTOCOL_VERSION);
|
|
67
|
+
export const DEVICE_BOUND_READ_OPS = ["open", "size", "readBytes", "list"];
|
|
68
|
+
const INSTRUCTION_KIND_SETS = new Map(Object.keys(DEVICE_INSTRUCTION_KINDS_BY_REVISION).map((rev) => [Number(rev), new Set(deviceInstructionKindsAt(Number(rev)))]));
|
|
69
|
+
export function asInstructionKindAt(v, revision) {
|
|
70
|
+
const kinds = INSTRUCTION_KIND_SETS.get(revision);
|
|
71
|
+
if (kinds === undefined) {
|
|
72
|
+
throw new RangeError(`device-ws: no instruction-kind set for protocol revision ${String(revision)} (this package knows revisions 1..${DEVICE_PROTOCOL_VERSION})`);
|
|
73
|
+
}
|
|
74
|
+
return kinds.has(v) ? v : null;
|
|
45
75
|
}
|
|
46
76
|
export const DEVICE_OUTCOME_ERROR_CODES_BY_REVISION = {
|
|
47
77
|
1: [
|
|
@@ -68,6 +98,8 @@ export const DEVICE_OUTCOME_ERROR_CODES_BY_REVISION = {
|
|
|
68
98
|
2: ["liveness_no_output"],
|
|
69
99
|
3: ["name_too_long"],
|
|
70
100
|
4: ["symlink_loop"],
|
|
101
|
+
5: [],
|
|
102
|
+
6: [],
|
|
71
103
|
};
|
|
72
104
|
export function deviceOutcomeErrorCodesAt(revision) {
|
|
73
105
|
if (!Number.isInteger(revision) || revision < 1 || revision > DEVICE_PROTOCOL_VERSION) {
|
|
@@ -225,6 +257,12 @@ function parseOutcome(v) {
|
|
|
225
257
|
return null;
|
|
226
258
|
out.linkTarget = v.linkTarget;
|
|
227
259
|
}
|
|
260
|
+
if (v.identity !== undefined) {
|
|
261
|
+
const id = str(v.identity);
|
|
262
|
+
if (id === null)
|
|
263
|
+
return null;
|
|
264
|
+
out.identity = id;
|
|
265
|
+
}
|
|
228
266
|
return out;
|
|
229
267
|
}
|
|
230
268
|
case "write": {
|
|
@@ -5,11 +5,13 @@
|
|
|
5
5
|
* 与本仓的人面汇点同轴);`isolationScope` = **带场景的主体**(只在请求带了场景时有;引擎按它分登记域 / offload 租界 / 后台登记 / peer 目录 / 工作流 scope,
|
|
6
6
|
* 引擎的读法是「隔离格缺席 ⇒ 读 `principal`」)。没带场景的请求只有 `principal`,与今天逐字节同。检查点的分区走本仓自己供的 `scope` 格。
|
|
7
7
|
*
|
|
8
|
-
* 今天的引擎还没有隔离格:{@link taskSpecIdentityOf} 是**唯一的落点**,今天只写 `principal`;隔离格到货后改那一行(钉在 `test/scenario-subject.test.ts`)
|
|
9
|
-
*
|
|
10
|
-
*
|
|
8
|
+
* 今天的引擎还没有隔离格:{@link taskSpecIdentityOf} 是**唯一的落点**,今天只写 `principal`;隔离格到货后改那一行(钉在 `test/scenario-subject.test.ts`),
|
|
9
|
+
* {@link engineScopeOf} 同一提交换读(钉在 `test/workflow-scope-core-parity.test.ts`)。
|
|
10
|
+
* 落点之前引擎自己按 `spec.principal` 分的那几面按人分(同一个人的各场景在那几面互见)。本仓读这几面(工作流行的 `scope` 列、后台登记簿与它的停止标记、
|
|
11
|
+
* 会话信箱盒与被扣来信的队列、名册)时「一只主体 ⇒ 那一格 scope」只有一只换算 {@link engineScopeOf},读到的就是引擎写下的那一个值,不各写一份;
|
|
12
|
+
* leader 子任务与提交腿的 spec 同经落点 {@link taskSpecIdentityOf}。
|
|
11
13
|
*/
|
|
12
|
-
import type
|
|
14
|
+
import { type Person, type Subject, type SubjectParts } from "./owner-brands.js";
|
|
13
15
|
/** 引擎交界的身份(本仓的类型;二元)。 */
|
|
14
16
|
export interface EngineIdentity {
|
|
15
17
|
readonly principal: Person | undefined;
|
|
@@ -20,9 +22,25 @@ export interface EngineIdentity {
|
|
|
20
22
|
export declare function specIdentityOf(parts: SubjectParts | undefined): EngineIdentity;
|
|
21
23
|
/**
|
|
22
24
|
* 落进 `TaskSpec` 的身份格(**唯一落点**)。今天的引擎没有隔离格 ⇒ 只写 `principal`,`isolationScope` 在这里不落(引擎按人分它自己的那几面);
|
|
23
|
-
* 引擎的隔离格到货 ⇒
|
|
25
|
+
* 引擎的隔离格到货 ⇒ 这里加一格,同一提交里 {@link engineScopeOf} 改读 core 的 `isolationScopeOf`(身份格闭集型在那里编译红,逼读法表态),别处不动。
|
|
24
26
|
*/
|
|
25
27
|
export declare function taskSpecIdentityOf(parts: SubjectParts | undefined): {
|
|
26
28
|
readonly principal?: string;
|
|
27
29
|
};
|
|
30
|
+
/**
|
|
31
|
+
* 🔴 **一只主体在引擎按身份分的那几面上的 scope —— 唯一一只换算**(工作流行的 `scope` 列 / 后台登记簿 / 会话信箱盒与被扣来信的队列 / 停止标记 / 名册:
|
|
32
|
+
* 引擎写下它们时用的那一个值)。规则 = core 写侧那一条,落在本仓交给引擎的身份格({@link taskSpecIdentityOf})上 ⇒ {@link scopeOfLanded}:
|
|
33
|
+
* · core 7.66.0(本仓钉的版本):工作流行 `scope` = `ctx.principal ?? 挂载 scope`(`createRunWorkflowTool` 的 `execute` 里的 `taskScope`;`startWorkflow` 缺席落
|
|
34
|
+
* `"default"`)—— `ctx.principal` 是 Runner 填的 `spec.principal`;挂载 scope 与后台登记簿 / 被扣来信队列同一个量,即 Runner 准备任务时算的任务 scope
|
|
35
|
+
* `registryScope ?? spec.principal ?? "default"`(同一个值挂进 `run_workflow`、交给信箱排空腿开 held 队列)。本仓不供 `registryScope` ⇒ 各面同值 = 落下的
|
|
36
|
+
* `principal`,匿名 = `"default"`。
|
|
37
|
+
* · core 的下一形([ref] 隔离格随 7.68.0 到货;[ref] 同版根导出 `callScopeOf` / `isolationScopeOf`):`callScopeOf(ctx, 挂载) = ctx.isolationScope ?? 挂载.scope`,
|
|
38
|
+
* Runner 把 `ctx.isolationScope` 填成 `isolationScopeOf(spec) = spec.isolationScope || spec.principal`;落点只写 `principal` 时两形同值。
|
|
39
|
+
* **随 core [ref] 到货换读、退本读法**:提货车让落点写出隔离格的同一提交里,这里改读 core 根导出的 `isolationScopeOf`(落下的身份格 ⇒ `?? "default"`),
|
|
40
|
+
* {@link scopeOfLanded} 退役 —— 落点多一格而读法没表态 = 编译红(身份格闭集,见它)。真 core 对拍钉:`test/workflow-scope-core-parity.test.ts`。
|
|
41
|
+
* 工作流行「归谁」只在属主存取器经它判(`http/owner-access.ts` 的 `workflowScopeOf`:列表 / 按 id / 舰队流同读)。
|
|
42
|
+
*/
|
|
43
|
+
export declare function engineScopeOf(subject: Subject | undefined): string;
|
|
44
|
+
/** 一只**持久的**属主串(会话 / run 行的属主列、续跑腿交来的属主、请求鉴权句柄的纯串主体)在那几面上的 scope:先过内部恢复管线,再经 {@link engineScopeOf};无主 ⇒ 匿名那一格。 */
|
|
45
|
+
export declare function engineScopeOfOwner(owner: string | null | undefined): string;
|
|
28
46
|
//# sourceMappingURL=engine-identity.d.ts.map
|
package/dist/engine-identity.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { partsOf } from "./owner-brands.js";
|
|
2
|
+
import { LEGACY_UNOWNED_AMNESTY_TENANT, recoveredSubject } from "./owner-faces.js";
|
|
1
3
|
export function specIdentityOf(parts) {
|
|
2
4
|
if (parts === undefined)
|
|
3
5
|
return { principal: undefined };
|
|
@@ -7,4 +9,15 @@ export function taskSpecIdentityOf(parts) {
|
|
|
7
9
|
const { principal } = specIdentityOf(parts);
|
|
8
10
|
return principal === undefined ? {} : { principal };
|
|
9
11
|
}
|
|
12
|
+
export function engineScopeOf(subject) {
|
|
13
|
+
return scopeOfLanded(taskSpecIdentityOf(subject === undefined ? undefined : partsOf(subject)));
|
|
14
|
+
}
|
|
15
|
+
export function engineScopeOfOwner(owner) {
|
|
16
|
+
return engineScopeOf(recoveredSubject(owner));
|
|
17
|
+
}
|
|
18
|
+
function scopeOfLanded(landed) {
|
|
19
|
+
const { principal, ...unread } = landed;
|
|
20
|
+
unread;
|
|
21
|
+
return principal ?? LEGACY_UNOWNED_AMNESTY_TENANT;
|
|
22
|
+
}
|
|
10
23
|
//# sourceMappingURL=engine-identity.js.map
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
* ## 铸点(唯一)
|
|
11
11
|
* {@link buildEntryModeClampNotice} 是本码**唯一**的铸点;调用点只有一处:`http/admission.ts` 的 `prepareSpec`(提交入口,盖章之后、装配
|
|
12
12
|
* 之后 —— 那时会话 id 才定)。一次提交一次 ⇒ 一条 run 至多一帧(core 码册的去重单位「once per run」)。读的是盖章那一次求值的读数
|
|
13
|
-
* (`EntryPermissionMode`)
|
|
13
|
+
* (`EntryPermissionMode`),不另判一遍「折没折」。续跑腿不铸:续跑口按**现**地板钳存储体的词时(`permission-mode-admission.ts` `stampReplayEntryMode`),
|
|
14
|
+
* 那一腿的生效词由它的 `wiring_manifest.permissionMode` 说(引擎收到的就是钳过的词);本码只说受理门那一折(per run 一帧)。
|
|
14
15
|
* 装配期铸、腿开口那一拍投(`PreparedTaskSubmission.engineNotices` → `registerEngineNoticeLeg` 的 `pending`)—— 与请求腿 MCP 丢弃同一条投递路,
|
|
15
16
|
* 白名单 / 归属 / 消毒 / 隔离一个不绕。
|
|
16
17
|
*
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 本仓自铸的**执行环境拒码**闭集(`env.*` 族)的唯一属主(纯叶:零值依赖)。
|
|
3
|
+
*
|
|
4
|
+
* 一族一句:**这只执行环境没开,而且再问也是同一个答** —— 部署状态(或会话数据)与这条 run 冲突,原样重试不改判,出路在部署。两处产出、同一族:
|
|
5
|
+
* · host 车道的工厂在铸环境之前拒(读数在构造时就到手:`lane-home-probe.ts` 的 `laneHomeRefusal`),引擎在准备期原样再抛;
|
|
6
|
+
* · 远端车道在建连时答的**立定拒**(这只环境此后每一次建连都答同一个拒,适配器记住它):码由 `plugins/remote-env-connect-seat.ts` 的拒因表从事实词拼出
|
|
7
|
+
* —— 那张表是远端车道拼本族码的唯一入口,立定 ⇔ 码在引擎可重试表之外 ⇔ 记住。
|
|
8
|
+
* 同步提交腿按零工作拒落档(`runs.ts` 的 `EXECUTION_ENV_REFUSAL_HTTP_STATUS`,按本闭集键控:加一员而档没跟 ⇒ tsc 红)。
|
|
9
|
+
* · `env.home_unconfirmed` —— 家目录主张证不了(`judgeLaneHome` 的三形拒句:读不出 / 不是绝对路径 / 与实测不一致;远端车道只在环境**答了**的两形上记住它)。
|
|
10
|
+
* 三形一个码:出路都在部署(声明、环境里的 `HOME`,或会话 `settings.env` 里的 `HOME`),消费端不按形分岔;是哪一形、怎么改,句子里说。
|
|
11
|
+
* · `env.snapshot_bucket_missing` —— k8s 车道的工作区快照桶不在(对象存储对 `latest` 或归档的读答 `404 NoSuchBucket`):建桶,或把
|
|
12
|
+
* `WORKSPACE_SNAPSHOT_BUCKET` 指向已有的桶,或 `WORKSPACE_PERSIST=off`。
|
|
13
|
+
* · `env.occupant_missing` —— k8s 车道读这条 run 的会话住客:会话行在、却不带住客令牌(存储数据缺陷,重发不改判):给行补令牌或删会话,或关掉要它的旋钮。
|
|
14
|
+
* · `env.sandbox_refused` —— 隔离车道(k8s / e2b / local-docker)替这条 run 建的沙箱被立定地拒:集群在准入时拒了 pod、成员凭据中继建不起来、
|
|
15
|
+
* 快照归档在桶里却取不回、工作区的填充(会话附件 / 项目包种子)放不进且换一台机器也是同一个答。是哪一件、怎么改,句子里说。
|
|
16
|
+
* · `env.host_key_rejected` —— ssh 车道:目标机出示的主机密钥过不了部署钉的判(`SSH_HOST_FINGERPRINT` / `SSH_KNOWN_HOSTS`:指纹不符、条目换了钥、被吊销、没有条目)。
|
|
17
|
+
* 改钉或查明对面为什么换了钥;同一配置同一主机每次同答。
|
|
18
|
+
*/
|
|
19
|
+
export declare const EXECUTION_ENV_REFUSAL_CODES: readonly ["env.home_unconfirmed", "env.snapshot_bucket_missing", "env.occupant_missing", "env.sandbox_refused", "env.host_key_rejected"];
|
|
20
|
+
export type ExecutionEnvRefusalCode = (typeof EXECUTION_ENV_REFUSAL_CODES)[number];
|
|
21
|
+
/** 这个码是不是本族的一员(按闭集,不按前缀:引擎自己的 `env.lifetime_expired` 同前缀而不是本族)。 */
|
|
22
|
+
export declare function isExecutionEnvRefusalCode(code: unknown): code is ExecutionEnvRefusalCode;
|
|
23
|
+
//# sourceMappingURL=execution-env-refusal.d.ts.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export const EXECUTION_ENV_REFUSAL_CODES = ["env.home_unconfirmed", "env.snapshot_bucket_missing", "env.occupant_missing", "env.sandbox_refused", "env.host_key_rejected"];
|
|
2
|
+
export function isExecutionEnvRefusalCode(code) {
|
|
3
|
+
return typeof code === "string" && EXECUTION_ENV_REFUSAL_CODES.includes(code);
|
|
4
|
+
}
|
|
5
|
+
//# sourceMappingURL=execution-env-refusal.js.map
|
|
@@ -184,7 +184,7 @@ export declare function deployedExecutionLanes(config: Pick<ServiceConfigFlat, "
|
|
|
184
184
|
* 读者问的都是这一句,**同一只函数**,不许各写一份 `=== "host"`:
|
|
185
185
|
* ① 部署形表行 `toolsOnThisHost`(`deployment-shape.ts`)—— wire `executionLane.toolsOnThisHost` + 出厂自扫技能与中心 plugin 技能的 `baseDir`;
|
|
186
186
|
* ② 部署形表行 `callerOwnsWorkerDisk`(本列 ∧ 单主)—— SendUserFile 本机腿(「无手不挂」)、调用方宿主路径(附加目录 / 项目上下文)、指令文件探针、
|
|
187
|
-
* 本机语言服务器(`createLspManager
|
|
187
|
+
* 本机语言服务器(`createLspManager`;「绑得住读」`openBound` 不是本列的事,是每条有手车道的结构前提,见 {@link laneWiresExecutionEnv});
|
|
188
188
|
* ③ `approval.ts` 的 `buildNoResponderBootWarns` —— 写门的 ask 只在「有手写本机盘」时才会发生(它手里已有车道词,直接读本列)。
|
|
189
189
|
*/
|
|
190
190
|
export declare function handsOnWorkerFilePlane(lane: ExecutionLane): boolean;
|
|
@@ -230,6 +230,8 @@ export declare function laneIsolated(lane: ExecutionLane): boolean;
|
|
|
230
230
|
* 这条车道**有没有手**(块 `io`:文件与 shell 两面真到达目标;`none` 的桩块 false)的唯一布尔口。读者四处:路由的「有没有执行环境」(`boot/resolve-spec.ts`)、
|
|
231
231
|
* wire `executionLane.isolated` 的在场判据(`capabilities/execution-lane.ts`)、场景详情的附件供给集(`boot/stage-07-capability-layer.ts` 把它填进
|
|
232
232
|
* `ScenarioDeps.handsLane`:「这一 run 有没有工作区」的车道半场)、起服家目录那一行({@link buildLaneHomeBootNote})—— 同读这一只。
|
|
233
|
+
* 有手车道的结构前提:适配器有绑定读面(`openBound`;设备的面 presence-typed,执行器声明了才装)—— 「能不能绑定读」的源是适配器对象本身,
|
|
234
|
+
* 本列不另存一位(对拍钉 `test/host-env-open-bound.test.ts` P3;本版唯一缓装 = ssh,同文件 `HELD_THIS_VERSION`,翻回条件钉在那里)。
|
|
233
235
|
*/
|
|
234
236
|
export declare function laneWiresExecutionEnv(lane: ExecutionLane): boolean;
|
|
235
237
|
/** 一条**已登记**的分叉:表写的是目标态,今天的判别式还答别的。 */
|
package/dist/field-conflict.d.ts
CHANGED
|
@@ -7,15 +7,15 @@ export type FieldConflictReason = (typeof FIELD_CONFLICT_REASONS)[number];
|
|
|
7
7
|
* 动态下标的坐标用模板字面量型(`agents[1].skills`)。
|
|
8
8
|
*/
|
|
9
9
|
export interface FieldConflictCoordinates {
|
|
10
|
-
readonly cascade_verify: "verify" | "cascade" | "sandboxImageProfile" | "resumeAt" | "suggestNextPrompts";
|
|
10
|
+
readonly cascade_verify: "verify" | "cascade" | "sandboxImageProfile" | "resumeAt" | "rewindFilesTo" | "suggestNextPrompts";
|
|
11
11
|
readonly image_profile: "capabilitiesNeeded" | "sandboxImageProfile";
|
|
12
12
|
readonly resume_anchor: "resumeAtMode" | "resumeAt";
|
|
13
|
-
readonly system_prompt_fold: "appendSystemPrompt" | "settings.outputStyle";
|
|
13
|
+
readonly system_prompt_fold: "appendSystemPrompt" | "projectId" | "settings.outputStyle";
|
|
14
14
|
readonly file_history_restore: "fileHistory" | "restoreFiles" | "rewindFilesTo";
|
|
15
15
|
readonly skills_disabled: "disableSkills" | "skills" | `agents[${number}].skills`;
|
|
16
16
|
readonly existing_session: "requireExistingSession" | "sessionId";
|
|
17
17
|
readonly fork_target: "forkId" | "forkNonce";
|
|
18
|
-
readonly scratchpad_root: "cwd" | "scratchpadDir";
|
|
18
|
+
readonly scratchpad_root: "cwd" | "projectId" | "scratchpadDir";
|
|
19
19
|
readonly ask_answer: "decision" | "answer";
|
|
20
20
|
readonly policy_person_ask: "decision" | "decidedBy";
|
|
21
21
|
readonly plan_edit: "decision" | "editedPlan";
|
|
@@ -52,21 +52,28 @@ export interface FileHistoryAssembly {
|
|
|
52
52
|
/** 擦除脸:在场 ⟺ 后端在(与旋钮无关;是 {@link store} 的删除类动词视图)。 */
|
|
53
53
|
readonly erasure: FileHistoryErasureFace | undefined;
|
|
54
54
|
}
|
|
55
|
-
/**
|
|
55
|
+
/** 「这台部署有没有文件历史店」的唯一判定:店是后端恒交的那一只(`StoreBackend.fileHistory()`,落定席位写的同一只)⇒ 店在 ⟺ 后端在。旋钮不在这里 ——
|
|
56
|
+
* 它只关捕获,不摘店([ref])。只问「在不在」的读者(能力位)读这一只,不必取店。 */
|
|
57
|
+
export declare function fileHistoryWired(backend: StoreBackend | undefined): backend is StoreBackend;
|
|
58
|
+
/** 装配:取那只店(判定 = {@link fileHistoryWired})。起服装配(引擎的还原族 / 擦除脸)与服务面要店的读者(同步族、rewind 口)都经这里取,手里有后端 ⇒ 型上就有店。 */
|
|
59
|
+
export declare function assembleFileHistory(backend: StoreBackend): {
|
|
60
|
+
readonly store: ServiceFileHistoryStore;
|
|
61
|
+
readonly erasure: FileHistoryErasureFace;
|
|
62
|
+
};
|
|
56
63
|
export declare function assembleFileHistory(backend: StoreBackend | undefined): FileHistoryAssembly;
|
|
57
64
|
/**
|
|
58
|
-
* 「捕不捕」的**唯一**判定(纯函数):能力词。`
|
|
65
|
+
* 「捕不捕」的**唯一**判定(纯函数):能力词。`wired` = 店在不在({@link fileHistoryWired} 的答 / 装配出来的店在不在),`knob` = 部署旋钮 `FILE_HISTORY_CAPTURE`
|
|
59
66
|
* (`config.fileHistoryCapture`)。从**装配结果**派生,不照旋钮字面回声:后端本来就没有这只店的部署同样是 `off`。
|
|
60
67
|
*
|
|
61
68
|
* 与 `restoreFiles` 分叉([ref] 当时写下的分叉条件,自 [ref] 成真):本词答「这台部署捕不捕、能不能按 run 关掉」,
|
|
62
69
|
* `restoreFiles` 答「这台部署能不能还原」—— 旋钮关的部署本词 `off` 而 `restoreFiles` 仍为真。
|
|
63
70
|
*/
|
|
64
|
-
export declare function fileHistoryCaptureOf(
|
|
71
|
+
export declare function fileHistoryCaptureOf(wired: boolean, knob: boolean): FileHistoryCapture;
|
|
65
72
|
/**
|
|
66
73
|
* core 的部署捕获位 `RunnerDeps.fileHistoryCapture`,由 {@link fileHistoryCaptureOf} 派生(同一组输入、同一只判定)。
|
|
67
74
|
* 形照 `execution-lane-caps.ts` 的穷举 switch(无 default 臂):能力词加一个而这里不加臂 ⇒ 编译红 —— 加臂的那一刻就是
|
|
68
75
|
* 决定「这一词下 core 的捕获位怎么递」的地方。没有店 ⇒ 恒 `undefined`(core 对「off 但没店」拒 prepare)。
|
|
69
76
|
*/
|
|
70
|
-
export declare function coreFileHistoryCaptureSeat(
|
|
77
|
+
export declare function coreFileHistoryCaptureSeat(wired: boolean, knob: boolean): RunnerDeps["fileHistoryCapture"];
|
|
71
78
|
export {};
|
|
72
79
|
//# sourceMappingURL=file-history-capture.d.ts.map
|