@sema-agent/server 7.150.0 → 7.152.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 +451 -0
- package/README.md +15 -3
- package/README.zh-CN.md +10 -2
- package/USAGE.md +144 -87
- package/deploy/sema-up/README.md +11 -4
- 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 +7 -6
- package/deploy/sema-up/kube-up.sh +6 -6
- package/deploy/sema-up/lib/flagshape.sh +36 -8
- package/deploy/sema-up/lib/helm-values-cluster.py +2 -0
- package/deploy/sema-up/lib/helm-values-kube.py +2 -0
- package/deploy/sema-up/machines.example.yaml +3 -1
- package/deploy/sema-up/sema-up.sh +22 -16
- package/dist/adoption/import.js +3 -3
- package/dist/approval-ask-audit-store.d.ts +1 -1
- package/dist/approval-ask-machine.d.ts +4 -10
- package/dist/approval-ask-retention.d.ts +1 -1
- package/dist/approval-card.d.ts +12 -14
- package/dist/approval-gate-currency.d.ts +9 -9
- package/dist/approval-gate-currency.js +3 -4
- package/dist/approval-hmac.d.ts +17 -1
- package/dist/approval-hmac.js +7 -1
- package/dist/approval-queue-kind.d.ts +1 -1
- package/dist/approval.d.ts +2 -2
- package/dist/approval.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 +1 -1
- package/dist/bake-runner/main.d.ts +4 -2
- package/dist/bind-host.d.ts +3 -6
- package/dist/bind-host.js +4 -7
- package/dist/boot/budget-tracing.js +1 -1
- package/dist/boot/coordinators.d.ts +1 -1
- package/dist/boot/coordinators.js +9 -10
- package/dist/boot/device-lane.js +2 -0
- package/dist/boot/engine-lease.d.ts +5 -0
- package/dist/boot/engine-lease.js +1 -0
- package/dist/boot/execution-env.d.ts +9 -14
- package/dist/boot/execution-env.js +85 -22
- 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/leader.d.ts +31 -30
- package/dist/boot/leader.js +38 -28
- package/dist/boot/leg-path-adjudication.d.ts +40 -0
- package/dist/boot/leg-path-adjudication.js +18 -0
- package/dist/boot/memory-consolidation.d.ts +3 -2
- package/dist/boot/memory-consolidation.js +6 -6
- package/dist/boot/parked-revive-gate.js +3 -15
- package/dist/boot/reapers.d.ts +6 -1
- package/dist/boot/reapers.js +13 -2
- package/dist/boot/resolve-spec.d.ts +3 -3
- package/dist/boot/resolve-spec.js +43 -48
- package/dist/boot/runner-deps.d.ts +46 -35
- package/dist/boot/runner-deps.js +94 -91
- 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 +9 -5
- package/dist/boot/shutdown.d.ts +6 -0
- package/dist/boot/shutdown.js +10 -4
- package/dist/boot/stage-01-config.js +2 -0
- package/dist/boot/stage-02-web-admin-pull.js +4 -5
- package/dist/boot/stage-05-execution-env.d.ts +5 -3
- package/dist/boot/stage-05-execution-env.js +3 -2
- package/dist/boot/stage-06-runners.d.ts +9 -4
- package/dist/boot/stage-06-runners.js +24 -9
- package/dist/boot/stage-07-capability-layer.d.ts +8 -4
- package/dist/boot/stage-07-capability-layer.js +3 -2
- package/dist/boot/stage-08-reapers.d.ts +8 -4
- package/dist/boot/stage-08-reapers.js +4 -2
- package/dist/boot/stage-09-leader.d.ts +12 -5
- package/dist/boot/stage-09-leader.js +14 -5
- package/dist/boot/stage-10-http-server.d.ts +19 -5
- package/dist/boot/stage-10-http-server.js +14 -21
- package/dist/boot/stores.js +7 -4
- package/dist/boot/web-admin.js +5 -8
- 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/capabilities/approvals-push.d.ts +3 -3
- package/dist/capabilities/scenarios.d.ts +28 -13
- package/dist/capabilities/scenarios.js +2 -2
- package/dist/capability-facts.d.ts +43 -32
- package/dist/capability-facts.js +45 -51
- package/dist/card-rule-offers.d.ts +32 -0
- package/dist/card-rule-offers.js +130 -0
- 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 +26 -22
- package/dist/config-dir-trust.js +4 -2
- package/dist/config-invariants.d.ts +20 -8
- package/dist/config-invariants.js +55 -12
- package/dist/config-lkg.d.ts +5 -19
- package/dist/config-lkg.js +8 -62
- package/dist/config-provider.d.ts +1 -1
- package/dist/config-root-migration.d.ts +2 -2
- package/dist/config-types.d.ts +38 -42
- package/dist/config.d.ts +58 -7
- package/dist/config.js +90 -40
- package/dist/control-socket.d.ts +51 -0
- package/dist/control-socket.js +115 -0
- package/dist/deployment-governance.d.ts +2 -1
- 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 +7 -0
- package/dist/device-ws-hub.js +10 -3
- package/dist/device-ws-protocol.d.ts +63 -10
- package/dist/device-ws-protocol.js +56 -25
- package/dist/elicitation.js +2 -2
- package/dist/engine-identity.d.ts +19 -7
- package/dist/engine-identity.js +10 -2
- package/dist/entry-mode-clamp-notice.d.ts +2 -1
- package/dist/entry-problems.d.ts +40 -3
- package/dist/entry-problems.js +3 -1
- package/dist/execution-env-refusal.d.ts +29 -0
- package/dist/execution-env-refusal.js +8 -0
- package/dist/execution-lane-caps.d.ts +3 -1
- package/dist/field-conflict.d.ts +1 -1
- 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 +12 -29
- package/dist/fleet/engine-signal.js +1 -7
- package/dist/fleet-client.js +2 -5
- package/dist/gate-settlement.d.ts +1 -8
- package/dist/gate-settlement.js +0 -4
- package/dist/history-anchor.js +1 -1
- package/dist/hitl-delivery.d.ts +2 -3
- package/dist/hitl-delivery.js +0 -2
- package/dist/hooks/hook-llm.js +4 -2
- package/dist/hooks/hook-runner.d.ts +3 -2
- package/dist/hooks/hook-runner.js +18 -3
- package/dist/host-decision.d.ts +11 -11
- package/dist/host-lsp-manager.d.ts +2 -2
- package/dist/http/active-run-conflict.d.ts +35 -2
- package/dist/http/active-run-conflict.js +48 -19
- package/dist/http/admission.js +17 -2
- package/dist/http/approval-sweeps.d.ts +1 -1
- package/dist/http/approval-sweeps.js +10 -7
- package/dist/http/checkpoint-ctx.d.ts +4 -0
- package/dist/http/checkpoint-ctx.js +2 -0
- package/dist/http/dispatch.d.ts +8 -3
- package/dist/http/dispatch.js +59 -32
- package/dist/http/durable-run-leg.js +16 -17
- package/dist/http/health-reader.d.ts +16 -9
- package/dist/http/health-reader.js +2 -1
- package/dist/http/health-self-report.d.ts +9 -1
- package/dist/http/health-self-report.js +3 -1
- package/dist/http/owner-access.d.ts +33 -14
- package/dist/http/owner-access.js +40 -10
- package/dist/http/principal-gate.d.ts +49 -21
- package/dist/http/principal-gate.js +61 -11
- package/dist/http/request-channel.d.ts +23 -0
- package/dist/http/request-channel.js +9 -0
- package/dist/http/request-guards.js +17 -2
- package/dist/http/resume-ctx-read.js +42 -3
- package/dist/http/resume-legs.d.ts +4 -3
- package/dist/http/resume-legs.js +367 -117
- package/dist/http/route-ctx.d.ts +91 -15
- package/dist/http/route-ctx.js +17 -0
- package/dist/http/route-table.d.ts +5 -1
- package/dist/http/route-table.js +4 -0
- package/dist/http/routes/admin-config-refresh.js +3 -3
- package/dist/http/routes/admin-drain.d.ts +3 -0
- package/dist/http/routes/admin-drain.js +7 -7
- package/dist/http/routes/admin-memory-optout.d.ts +1 -1
- package/dist/http/routes/admin-memory-optout.js +3 -3
- package/dist/http/routes/adoption.js +3 -5
- package/dist/http/routes/agents-roster.js +2 -3
- package/dist/http/routes/approvals-assistant.d.ts +2 -1
- package/dist/http/routes/approvals-assistant.js +99 -51
- package/dist/http/routes/background.d.ts +3 -3
- package/dist/http/routes/capabilities.d.ts +4 -0
- package/dist/http/routes/capabilities.js +38 -10
- package/dist/http/routes/config-catalog.js +2 -2
- package/dist/http/routes/devices.js +1 -1
- package/dist/http/routes/diagnostics.d.ts +3 -3
- package/dist/http/routes/diagnostics.js +19 -7
- package/dist/http/routes/fleet.js +10 -8
- package/dist/http/routes/images.js +10 -10
- package/dist/http/routes/memory-bundle.js +3 -3
- package/dist/http/routes/memory-compliance.js +3 -3
- package/dist/http/routes/memory-consolidation.js +2 -2
- package/dist/http/routes/memory-origin.js +3 -3
- package/dist/http/routes/memory-policy.js +2 -2
- package/dist/http/routes/observability.js +3 -3
- package/dist/http/routes/projects.d.ts +3 -2
- package/dist/http/routes/projects.js +4 -5
- package/dist/http/routes/retention-ops.js +3 -3
- package/dist/http/routes/rules.js +5 -5
- package/dist/http/routes/run-permission-mode.d.ts +2 -1
- package/dist/http/routes/run-permission-mode.js +2 -2
- package/dist/http/routes/runs.d.ts +4 -9
- package/dist/http/routes/runs.js +171 -65
- package/dist/http/routes/session-sync.d.ts +22 -9
- package/dist/http/routes/session-sync.js +204 -107
- package/dist/http/routes/sessions-list.js +13 -7
- package/dist/http/routes/sessions.js +30 -15
- package/dist/http/routes/tasks.js +46 -41
- package/dist/http/routes/trace-usage.js +2 -2
- package/dist/http/routes/workflows.js +1 -1
- package/dist/http/server.d.ts +30 -30
- package/dist/http/server.js +16 -4
- package/dist/http/submit-ctx.d.ts +1 -1
- package/dist/http/submit-ctx.js +7 -4
- package/dist/http/wire-types.d.ts +14 -4
- package/dist/human-facing-args.d.ts +33 -0
- package/dist/human-facing-args.js +33 -0
- package/dist/identity-source.d.ts +20 -3
- package/dist/identity-source.js +14 -0
- package/dist/index.d.ts +5 -1
- package/dist/k8s-api-credentials.d.ts +29 -0
- package/dist/k8s-api-credentials.js +25 -0
- package/dist/lane-home-probe.d.ts +3 -7
- package/dist/lane-home-probe.js +2 -2
- package/dist/leader/diffup.d.ts +19 -0
- package/dist/leader/diffup.js +7 -0
- package/dist/leader/leader.d.ts +116 -11
- package/dist/leader/leader.js +69 -5
- package/dist/leader/repair-wire.js +2 -2
- package/dist/leader/run-entry.d.ts +2 -1
- package/dist/leader/run-entry.js +1 -1
- package/dist/leader/wire.d.ts +42 -132
- package/dist/leader/wire.js +81 -67
- package/dist/leg-facts.d.ts +13 -5
- package/dist/leg-facts.js +2 -1
- package/dist/memory-scope.d.ts +23 -11
- package/dist/memory-scope.js +18 -6
- package/dist/memory-sync-client.d.ts +30 -2
- package/dist/memory-sync-client.js +16 -9
- package/dist/model-entry-headers.d.ts +9 -10
- package/dist/model-entry-headers.js +0 -4
- package/dist/model-entry-refusal.d.ts +7 -4
- package/dist/model-entry-refusal.js +11 -5
- package/dist/model-plane-face.d.ts +1 -1
- package/dist/model-plane-face.js +3 -1
- package/dist/model-route-endpoint.d.ts +13 -7
- package/dist/model-route-endpoint.js +14 -11
- package/dist/model-select.d.ts +22 -0
- package/dist/model-select.js +9 -0
- package/dist/model-unreachable-notice.d.ts +11 -0
- package/dist/model-unreachable-notice.js +4 -4
- package/dist/object-store-buckets.d.ts +640 -6
- package/dist/object-store-buckets.js +166 -0
- package/dist/observability/err-text.d.ts +7 -0
- package/dist/observability/err-text.js +5 -0
- package/dist/observability/fail-open.d.ts +25 -17
- package/dist/observability/fail-open.js +25 -17
- package/dist/observability/logger.js +3 -1
- package/dist/observability/metrics.js +1 -0
- package/dist/operator-roster.d.ts +68 -0
- package/dist/operator-roster.js +32 -0
- 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/outbound-dispatcher.d.ts +71 -8
- package/dist/outbound-dispatcher.js +48 -7
- package/dist/owner-faces.d.ts +2 -2
- package/dist/parked-decide.d.ts +106 -55
- 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/permission-mode-admission.d.ts +74 -5
- package/dist/permission-mode-admission.js +56 -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 +14 -2
- package/dist/plugins/approval-ask-store-file.js +11 -0
- package/dist/plugins/approval-ask-store-memory.d.ts +10 -1
- package/dist/plugins/approval-ask-store-memory.js +35 -10
- package/dist/plugins/approval-ask-store-sql.d.ts +69 -4
- package/dist/plugins/approval-ask-store-sql.js +45 -5
- package/dist/plugins/approval-exemption-store.js +3 -0
- package/dist/plugins/approval-nonce-store.js +2 -0
- package/dist/plugins/blob-backend.d.ts +83 -7
- package/dist/plugins/blob-backend.js +57 -6
- 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/checkpoint-index-columns.d.ts +20 -16
- package/dist/plugins/checkpoint-index-columns.js +3 -6
- package/dist/plugins/checkpoint-store-face.d.ts +119 -61
- package/dist/plugins/checkpoint-store-face.js +134 -55
- 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/execution-placement-sql.js +6 -6
- 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 +13 -3
- package/dist/plugins/local-checkpoint-store.js +38 -49
- 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-sync-store-pg.js +5 -0
- package/dist/plugins/memory-sync-store-tidb.js +5 -0
- package/dist/plugins/one-time-migrations.d.ts +104 -80
- package/dist/plugins/one-time-migrations.js +226 -132
- 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 +35 -10
- 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 +4 -1
- package/dist/plugins/remote-env-adb.d.ts +19 -15
- package/dist/plugins/remote-env-adb.js +41 -15
- 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 +106 -8
- package/dist/plugins/remote-env-e2b.d.ts +15 -6
- package/dist/plugins/remote-env-e2b.js +42 -32
- package/dist/plugins/remote-env-file-error.js +6 -2
- package/dist/plugins/remote-env-host.d.ts +46 -10
- package/dist/plugins/remote-env-host.js +124 -52
- package/dist/plugins/remote-env-k8s.d.ts +109 -41
- package/dist/plugins/remote-env-k8s.js +160 -54
- package/dist/plugins/remote-env-local-docker.d.ts +13 -8
- package/dist/plugins/remote-env-local-docker.js +34 -41
- package/dist/plugins/remote-env-ssh.d.ts +18 -12
- package/dist/plugins/remote-env-ssh.js +60 -59
- package/dist/plugins/remote-shell.d.ts +98 -1
- package/dist/plugins/remote-shell.js +218 -0
- package/dist/plugins/replica-registration.d.ts +1 -1
- package/dist/plugins/replica-registration.js +1 -1
- 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.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 +21 -2
- package/dist/plugins/run-store-sql.js +31 -7
- package/dist/plugins/s3-presign.d.ts +23 -0
- package/dist/plugins/s3-presign.js +37 -3
- package/dist/plugins/scenario-prefix-switch-m42.d.ts +1 -1
- package/dist/plugins/scenario-prefix-switch-m42.js +2 -2
- package/dist/plugins/scheduler-support.d.ts +2 -2
- package/dist/plugins/scheduler-support.js +0 -3
- package/dist/plugins/schema-consistency.d.ts +4 -2
- package/dist/plugins/schema-consistency.js +19 -2
- package/dist/plugins/schema-indexes.js +2 -0
- package/dist/plugins/send-file-ledger.d.ts +2 -2
- package/dist/plugins/send-file-ledger.js +5 -2
- package/dist/plugins/send-user-file.d.ts +3 -4
- package/dist/plugins/send-user-file.js +56 -52
- package/dist/plugins/serving-requirement.d.ts +26 -7
- package/dist/plugins/serving-requirement.js +11 -4
- package/dist/plugins/session-birth.d.ts +6 -2
- package/dist/plugins/session-blob-claim-token.d.ts +15 -0
- package/dist/plugins/session-blob-claim-token.js +20 -0
- package/dist/plugins/session-blob-namespace.d.ts +46 -0
- package/dist/plugins/session-blob-namespace.js +116 -0
- 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/snapshot-bucket-presence.d.ts +25 -2
- package/dist/plugins/snapshot-bucket-presence.js +8 -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/sql-json-column.d.ts +1 -1
- package/dist/plugins/stop-then-start-sentence.d.ts +10 -4
- package/dist/plugins/stop-then-start-sentence.js +14 -10
- 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 +84 -15
- package/dist/plugins/store-backend.js +236 -72
- package/dist/plugins/store-boundary.d.ts +57 -0
- package/dist/plugins/store-boundary.js +139 -0
- package/dist/plugins/store-contracts.d.ts +17 -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.d.ts +2 -1
- package/dist/plugins/task-attachment-store.js +14 -1
- 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 +21 -25
- 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-custody.d.ts +4 -3
- 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/project-context.d.ts +0 -2
- package/dist/project-context.js +4 -8
- package/dist/project-registry.d.ts +46 -0
- package/dist/project-registry.js +44 -0
- package/dist/question.d.ts +2 -1
- package/dist/question.js +5 -13
- package/dist/request-form.d.ts +6 -1
- package/dist/request-form.js +4 -1
- 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/rule-issue-reading.d.ts +1 -1
- package/dist/rules-consent.d.ts +1 -1
- package/dist/run-acceptance.d.ts +3 -2
- package/dist/run-acceptance.js +4 -6
- package/dist/run-local.js +9 -9
- package/dist/runs.d.ts +54 -16
- package/dist/runs.js +67 -13
- package/dist/runtime-governance.d.ts +5 -4
- package/dist/security.d.ts +30 -32
- package/dist/security.js +41 -7
- package/dist/sema-config-dir.d.ts +2 -1
- package/dist/server-secret-env.d.ts +12 -10
- package/dist/server-secret-env.js +24 -15
- 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 +10 -0
- package/dist/session-incarnation.js +10 -1
- package/dist/session-kind.d.ts +57 -0
- package/dist/session-kind.js +22 -0
- package/dist/session-row.d.ts +21 -1
- package/dist/session-row.js +7 -1
- package/dist/session-sync-kernel.d.ts +24 -14
- package/dist/session-sync-kernel.js +3 -6
- package/dist/session-sync.d.ts +25 -103
- package/dist/session-sync.js +14 -76
- 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/blob-index-sql.d.ts +30 -9
- package/dist/stores-sql/blob-index-sql.js +40 -21
- package/dist/stores-sql/checkpoint-store-sql.d.ts +54 -27
- package/dist/stores-sql/checkpoint-store-sql.js +70 -146
- package/dist/stores-sql/file-history-store-sql.d.ts +113 -15
- package/dist/stores-sql/file-history-store-sql.js +205 -95
- 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 +1 -9
- package/dist/stores-sql/retention-store-sql.js +5 -19
- 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 +2 -2
- package/dist/task-settings.d.ts +7 -5
- package/dist/task-settings.js +3 -3
- package/dist/terminal.d.ts +33 -2
- package/dist/terminal.js +139 -9
- package/dist/tool-approval.d.ts +465 -507
- package/dist/tool-approval.js +606 -1222
- package/dist/trace/core-keyset-guard.d.ts +1 -1
- package/dist/trace/ledger-events.d.ts +3 -3
- package/dist/trace/project.d.ts +2 -3
- package/dist/trace/redact.js +3 -2
- package/dist/trace/self-minted-wire.d.ts +571 -178
- package/dist/trace/self-minted-wire.js +189 -56
- package/dist/web-admin-client/apply-effective.js +2 -2
- package/dist/web-admin-client/read-warnings.d.ts +2 -2
- package/dist/web-admin-client/read-warnings.js +1 -1
- package/dist/web-admin-client/types.d.ts +1 -1
- package/dist/workspace-space.d.ts +10 -4
- package/dist/workspace-space.js +4 -1
- package/docs/DEVICE-EXECUTOR-PROTOCOL.md +79 -28
- package/package.json +7 -3
- package/scripts/embed-minimal.mjs +3 -3
- package/wire-changes/server@7.151.0.json +762 -0
- package/wire-changes/server@7.152.0.json +900 -0
- package/dist/config-d-migration.d.ts +0 -37
- package/dist/config-d-migration.js +0 -60
- package/dist/http/session-inherit-env.d.ts +0 -36
- package/dist/http/session-inherit-env.js +0 -6
package/dist/leader/leader.js
CHANGED
|
@@ -2,8 +2,9 @@ import { fanOut } from "./fanout.js";
|
|
|
2
2
|
import { redactErrorMessage, redactHead } from "../observability/run-terminal.js";
|
|
3
3
|
import { pullDiff } from "./diffout.js";
|
|
4
4
|
import { mergeBranches } from "./merge.js";
|
|
5
|
-
import { Runner, runWithVerification, resumeWithVerification } from "@sema-agent/core";
|
|
5
|
+
import { Runner, QUESTION_AWAITS_RESUME, runWithVerification, resumeWithVerification } from "@sema-agent/core";
|
|
6
6
|
import { pausedCauseOf, outwardPlane } from "../terminal.js";
|
|
7
|
+
import { seatText } from "../trace/exit-seat.js";
|
|
7
8
|
import { voidVerifierPauseCard } from "../verifier-pause-card.js";
|
|
8
9
|
import { entryPermissionMode } from "../runtime-governance.js";
|
|
9
10
|
import { withUnattendedLeg } from "../unattended-permission-mode.js";
|
|
@@ -18,9 +19,68 @@ export async function autoResumeOnResource(initial, signal, resume, maxSlices =
|
|
|
18
19
|
}
|
|
19
20
|
return vr;
|
|
20
21
|
}
|
|
21
|
-
export
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
export const LEADER_APPROVAL_SCOPE = "_leader";
|
|
23
|
+
export function leaderLegDurability(leg) {
|
|
24
|
+
switch (leg.continuation) {
|
|
25
|
+
case "in_run":
|
|
26
|
+
return { kind: "transient", why: "this leg is continued by the leader's own in-run repair round, which a separately resumed run cannot hand its result back to" };
|
|
27
|
+
case "replay":
|
|
28
|
+
switch (leg.resumeCtx) {
|
|
29
|
+
case "landed":
|
|
30
|
+
return { kind: "durable", park: leg.park };
|
|
31
|
+
case "lost":
|
|
32
|
+
return { kind: "transient", why: "the worker's resume context did not land in the checkpoint store, so a decided park could not rebuild this leg" };
|
|
33
|
+
case "unwritten":
|
|
34
|
+
return { kind: "transient", why: "no park facility for this worker (no durable checkpoint store; on the static lane, no approval list in force either)" };
|
|
35
|
+
default: {
|
|
36
|
+
const unhandled = leg;
|
|
37
|
+
throw new Error(`leader leg resume context ${JSON.stringify(unhandled)} has no durability arm`);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
default: {
|
|
41
|
+
const unhandled = leg;
|
|
42
|
+
throw new Error(`leader leg facts ${JSON.stringify(unhandled)} have no durability arm`);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
export function staticLaneWorkerPark(park, approvalListInForce) {
|
|
47
|
+
return approvalListInForce ? park : undefined;
|
|
48
|
+
}
|
|
49
|
+
function legAuthSeat(spec, birth, executor) {
|
|
50
|
+
switch (executor.kind) {
|
|
51
|
+
case "fresh":
|
|
52
|
+
return birth.auth(spec.getApiKeyAndHeaders);
|
|
53
|
+
case "reuses":
|
|
54
|
+
return executor.worker.spec.getApiKeyAndHeaders;
|
|
55
|
+
default: {
|
|
56
|
+
const unhandled = executor;
|
|
57
|
+
throw new Error(`leader leg executor ${JSON.stringify(unhandled)} has no credential seat`);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
function legApprovalSeat(durability, birth) {
|
|
62
|
+
switch (durability.kind) {
|
|
63
|
+
case "durable": {
|
|
64
|
+
const d = durability;
|
|
65
|
+
return {
|
|
66
|
+
toolPolicy: birth.baseline("durable"),
|
|
67
|
+
checkpointStore: d.park.checkpointStore,
|
|
68
|
+
durableApproval: { scope: LEADER_APPROVAL_SCOPE, ...(d.park.ttlMs ? { ttlMs: d.park.ttlMs } : {}) },
|
|
69
|
+
onQuestion: QUESTION_AWAITS_RESUME,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
case "transient":
|
|
73
|
+
return { toolPolicy: birth.baseline("live") };
|
|
74
|
+
default: {
|
|
75
|
+
const unhandled = durability;
|
|
76
|
+
throw new Error(`leader leg durability ${JSON.stringify(unhandled)} has no approval seat`);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
export function withLeaderLeg(spec, birth, leg) {
|
|
81
|
+
const governed = birth.govern({ ...spec, ...birth.identity, getApiKeyAndHeaders: legAuthSeat(spec, birth, leg.executor), ...legApprovalSeat(leg.durability, birth) }, leg.slotKey);
|
|
82
|
+
const word = entryPermissionMode(governed.permissionMode, birth.entry.permissionMode).effective;
|
|
83
|
+
return withUnattendedLeg(word === undefined ? governed : { ...governed, permissionMode: word });
|
|
24
84
|
}
|
|
25
85
|
export const LEADER_RUN_STOPPED = "leader run stopped at an abort checkpoint (cancel): no further work was started and nothing was pushed after the stop";
|
|
26
86
|
export function stoppedResult(reports, route) {
|
|
@@ -230,7 +290,11 @@ export async function runLeaderTask(task, durableBaseSha, deps) {
|
|
|
230
290
|
}
|
|
231
291
|
deps.logger?.info?.("module_repair", { workerId: r.workerId, attempt: attempt + 1, reason: redactHead(verdict.reason ?? "", 500) });
|
|
232
292
|
try {
|
|
233
|
-
const rr = await w.runner.runTaskStream(withLeaderLeg({ ...sub.spec, objective: deps.moduleGate.repairObjective(sub, safeVerdictReason), sessionId: `${w.sessionId}-r${attempt + 1}`, ...(signal ? { signal } : {}) }, deps.
|
|
293
|
+
const rr = await w.runner.runTaskStream(withLeaderLeg({ ...sub.spec, objective: deps.moduleGate.repairObjective(sub, safeVerdictReason), sessionId: `${w.sessionId}-r${attempt + 1}`, ...(signal ? { signal } : {}) }, deps.birth, { slotKey: w.sessionId, durability: leaderLegDurability({ continuation: "in_run" }), executor: { kind: "reuses", worker: w } })).result();
|
|
294
|
+
if (rr !== undefined && rr.terminal.kind !== "completed") {
|
|
295
|
+
const plane = outwardPlane(rr.terminal);
|
|
296
|
+
deps.logger?.warn?.("module_repair_incomplete", { workerId: r.workerId, attempt: attempt + 1, status: plane.status, ...(plane.errorMessage !== undefined ? { err: seatText("operator-log-error", plane.errorMessage) } : {}) });
|
|
297
|
+
}
|
|
234
298
|
if (r.stats && rr?.stats)
|
|
235
299
|
r.stats = { ...r.stats, tokens: (r.stats.tokens ?? 0) + (rr.stats.tokens ?? 0), costMicroUsd: (r.stats.costMicroUsd ?? 0) + (rr.stats.costMicroUsd ?? 0) };
|
|
236
300
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { runRepairLoop, delimitUntrusted, } from "@sema-agent/core";
|
|
2
2
|
import { mkRepairOracle } from "./repair-oracle.js";
|
|
3
|
-
import { withLeaderLeg } from "./leader.js";
|
|
3
|
+
import { leaderLegDurability, withLeaderLeg } from "./leader.js";
|
|
4
4
|
import { outwardPlane } from "../terminal.js";
|
|
5
5
|
import { redactHead } from "../observability/run-terminal.js";
|
|
6
6
|
function statusForTerminal(t) {
|
|
@@ -87,7 +87,7 @@ export function attachRepairLoopDeps(deps, resolve) {
|
|
|
87
87
|
deps.repairLoop = {
|
|
88
88
|
run: async (solo, sub) => {
|
|
89
89
|
const cfg = await resolve(solo, sub);
|
|
90
|
-
const implSpec = withLeaderLeg({ ...sub.spec, sessionId: solo.sessionId, ...(deps.signal ? { signal: deps.signal } : {}) }, deps.
|
|
90
|
+
const implSpec = withLeaderLeg({ ...sub.spec, sessionId: solo.sessionId, ...(deps.signal ? { signal: deps.signal } : {}) }, deps.birth, { slotKey: solo.sessionId, durability: leaderLegDurability({ continuation: "in_run" }), executor: { kind: "reuses", worker: solo } });
|
|
91
91
|
return runRepairLoopForLeader(solo, implSpec, cfg);
|
|
92
92
|
},
|
|
93
93
|
};
|
|
@@ -16,7 +16,8 @@ import { type Autonomy } from "../runtime-governance.js";
|
|
|
16
16
|
import type { LeaderRunEntry } from "./leader.js";
|
|
17
17
|
/** 一条 leader run 的入口体:地板读一次、入口词经受理门同一只函数(地板缺席 ⇒ `{}`)。调用方读**活** config(热改只影响之后起的 run)。 */
|
|
18
18
|
export declare function leaderRunEntry(autonomy: Autonomy | undefined): LeaderRunEntry;
|
|
19
|
-
/** 拒句:原因(运维的 plan 地板 × 这条车道没有计划审阅通道)+ 两条出路(改走有计划审阅的 run 车道 /
|
|
19
|
+
/** 拒句:原因(运维的 plan 地板 × 这条车道没有计划审阅通道)+ 两条出路(改走有计划审阅的 run 车道 / 运维换到 `ask` 档,代价写在句里)。`read-only` 不是出路:
|
|
20
|
+
* 部署治理折叠盖在 leader 每条腿的出生口上,`read-only` 下 worker 写不了。不含任何配置值之外的回显。
|
|
20
21
|
* 受理口(HTTP 422 的 `error`)与 run 出生处(run 的 `error`)读的是这一份;字节由 `test/api-error-text-freeze.test.ts` 的常量锚格冻。 */
|
|
21
22
|
export declare const LEADER_PLAN_ENTRY_REFUSAL: string;
|
|
22
23
|
/**
|
package/dist/leader/run-entry.js
CHANGED
|
@@ -6,7 +6,7 @@ export function leaderRunEntry(autonomy) {
|
|
|
6
6
|
export const LEADER_PLAN_ENTRY_REFUSAL = "this deployment runs with AUTONOMY=plan, which starts every task in plan mode and lets it out of plan mode only when a person approves its plan through plan review; " +
|
|
7
7
|
"a leader task's workers have no plan review channel, so they could neither write nor hand their plan to anyone who can approve it. Nothing was started. " +
|
|
8
8
|
"Submit the work as a run instead (POST /v1/runs, whose plan is reviewed through POST /v1/assistant/tasks/:id/plan_review), " +
|
|
9
|
-
"or ask the operator to set AUTONOMY=
|
|
9
|
+
"or ask the operator to set AUTONOMY=ask, under which leader tasks run, though each shell command a worker runs then needs a person's approval.";
|
|
10
10
|
export function leaderEntryRefusal(entry) {
|
|
11
11
|
const mode = entry.permissionMode;
|
|
12
12
|
if (mode === undefined)
|
package/dist/leader/wire.d.ts
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type TaskSpec, type ExecutionEnvFactory, type RemoteExecutionEnv, type ToolResultStore, type SessionStore, type ExecutionEnv, type CheckpointToken } from "@sema-agent/core";
|
|
2
2
|
import type { Autonomy } from "../runtime-governance.js";
|
|
3
|
-
import { type
|
|
4
|
-
import type
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
3
|
+
import { type LeaderDiffStore } from "./diffup.js";
|
|
4
|
+
import { type LeaderBirth, type LeaderDurableSeat, type LeaderDeps, type LeaderResult } from "./leader.js";
|
|
5
|
+
import type { DeploymentPlaneDeps } from "../boot/runner-deps.js";
|
|
6
|
+
import type { SandboxPathEnvSlots } from "../boot/deferred-sandbox-path-env.js";
|
|
7
7
|
import type { LeaderRequestBody } from "./endpoint.js";
|
|
8
8
|
/**
|
|
9
|
-
* leader worker
|
|
10
|
-
* `
|
|
9
|
+
* leader worker 资源分片停驻行的 scope —— **唯一属主**(保留前缀见 `principal-shape.ts` 的 `RESERVED_PRINCIPAL_PREFIXES`;审批停驻那一只
|
|
10
|
+
* `LEADER_APPROVAL_SCOPE` 的属主是出生口所在的 `leader.ts`)。worker 的资源分片 spec 与取消时的残留过期({@link createLeaderParkExpirer})读这同一对。
|
|
11
11
|
*/
|
|
12
|
-
export declare const LEADER_APPROVAL_SCOPE = "_leader";
|
|
13
12
|
export declare function leaderResourceScope(workerId: string): string;
|
|
14
13
|
/** 过期残留停驻要的那两口(SQL 两方言与 local 店都有;结构型,单测用假件)。 */
|
|
15
14
|
export interface LeaderParkStore {
|
|
@@ -30,18 +29,6 @@ export declare function createLeaderParkExpirer(store: LeaderParkStore): (worker
|
|
|
30
29
|
readonly workerId: string;
|
|
31
30
|
readonly sessionId: string;
|
|
32
31
|
}>) => Promise<LeaderParkExpiry>;
|
|
33
|
-
/** leader worker 的 durable 审批座(`LeaderWireConfig.durable` 函数席每次产出的一份)。 */
|
|
34
|
-
export interface LeaderDurableSeat {
|
|
35
|
-
readonly checkpointStore: CheckpointStoreFull;
|
|
36
|
-
/** [ref]:写 worker 续跑上下文的封口(`ServiceDeps.checkpointCtxSealing` 同一只;规则属主 `http/checkpoint-ctx.ts` 末段「凭据位密封」)。
|
|
37
|
-
* worker 的续跑体只有入口词 + 子任务 objective、不带凭据位 ⇒ 实际不封任何值,但写 ctx 的每一笔都经同一只封口(没有不封的第二种写法)。 */
|
|
38
|
-
readonly ctxSealer: CheckpointCtxSealer | undefined;
|
|
39
|
-
readonly requireApproval: string[];
|
|
40
|
-
readonly deny?: string[];
|
|
41
|
-
readonly ttlMs?: number;
|
|
42
|
-
readonly autoBudget?: number;
|
|
43
|
-
readonly neverAuto?: string[];
|
|
44
|
-
}
|
|
45
32
|
export interface LeaderWireConfig {
|
|
46
33
|
/** Static-env compat mode (E2B only): the leader provisions/owns each env. Required when `envFactory` unset. */
|
|
47
34
|
e2bApiKey?: string;
|
|
@@ -49,17 +36,17 @@ export interface LeaderWireConfig {
|
|
|
49
36
|
* REMOTE_EXEC (e2b or k8s/Kata) — workers and the integration sandbox run on envs from THIS factory.
|
|
50
37
|
* Requires `s3` (diff-out is the worker's self-upload; there is no leader-held env to pull from). */
|
|
51
38
|
envFactory?: ExecutionEnvFactory;
|
|
52
|
-
/**
|
|
53
|
-
*
|
|
54
|
-
* (
|
|
55
|
-
*
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
* (`
|
|
59
|
-
*
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
39
|
+
/** 部署的停驻设施([ref] C4):键在场 ⟺ 部署接了停驻店。worker 首跑的出生点按车道决定递不递给这条腿:工厂车道 = 递(worker 的环境由它自己的 Runner
|
|
40
|
+
* 经工厂铸,停驻续得上);静态车道 = `leader.ts` 的 `staticLaneWorkerPark`(上一发布版的条件:另要任一审批名单在场,见 {@link approvalListInForce})。
|
|
41
|
+
* 递了且续跑上下文真落了 ⇒ 这条腿**耐久**(唯一读者 `leader.ts` 的 `leaderLegDurability`):停驻设施进 spec、ctx 保温、开资源分片停驻。
|
|
42
|
+
* 函数席:`provisionWorker` 每只 worker 调一次,同一只 worker 的停驻设施 / ctx 保温 / 资源分片读同一份。 */
|
|
43
|
+
durable?: () => LeaderDurableSeat;
|
|
44
|
+
/** 这台部署此刻有没有任一审批名单在场(`APPROVAL_REQUIRE` / `APPROVAL_DENY` / `APPROVAL_NEVER_AUTO`,含中心热换的那一张;装配处闭包同一个活 config,与
|
|
45
|
+
* {@link baseline} 同源)。**唯一读者** = 静态车道 worker 的停驻设施条件(`leader.ts` 的 `staticLaneWorkerPark`,上一发布版的条件);引擎提供
|
|
46
|
+
* 「宿主声明本腿审批停驻不可续」的声明位后,那条条件退役,本席随之删。函数席:每只 worker 现读一次。 */
|
|
47
|
+
approvalListInForce: () => boolean;
|
|
48
|
+
/** 审批基线的两臂(`LeaderBirth.baseline`;装配处闭包活 config,leader 不读 config)—— 每一条腿出生时经 {@link withLeaderLeg} 按它的耐久事实取一臂。 */
|
|
49
|
+
baseline: LeaderBirth["baseline"];
|
|
63
50
|
/** Durable tool-result offload store (TiDB). REQUIRED for `durable` to actually suspend: core's suspend
|
|
64
51
|
* pre-commit refuses with the default InMemoryToolResultStore (offloaded results would deref to null after
|
|
65
52
|
* a cross-replica resume) and silently falls back to the synchronous onAsk gate — which the leader does not
|
|
@@ -70,109 +57,35 @@ export interface LeaderWireConfig {
|
|
|
70
57
|
* the resume dies with SessionError "Entry <leafId> not found" (found live: drill c3 deny path). */
|
|
71
58
|
sessionStore?: SessionStore;
|
|
72
59
|
/**
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
60
|
+
* **部署平面层**(唯一铸点 `boot/runner-deps.ts` 的 `createDeploymentPlaneDeps`;起服第 6 段交出、`boot/leader.ts` 递进来)—— 本车道的每一只
|
|
61
|
+
* `new Runner` 头一项展开它,零逐席搬运:收紧面(治理三座 / 按主体准入 resolver / MCP 撤销台账 / 部署姿态座席族 / 豁免根)、计量面(tracer /
|
|
62
|
+
* 治理窗两键)、服务表(brain / 模型目录 / 定价 / 提示词目录)、部署座 / 手带、两条披露出口(通告 / 错误汇)。新的部署键进那一层即到达这里。
|
|
63
|
+
* 🔴 **函数席**([ref] 先例):姿态族与模型目录会被中心热换,本车道的 Runner 逐调用现构 ⇒ 每只构造时现铸一份,与主车道经 swap 门换代同代。
|
|
76
64
|
*/
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* [ref](黑板 [ref])—— **部署姿态座席族**(readFace 四席 `readFace`/`readDenyPatterns`/`readDenyBuiltinTiers`/
|
|
80
|
-
* `readDenyBuiltinExclude` + `memoryDelegationEvidence`/`memoryProvenance`/`memoryCapturePolicy`/
|
|
81
|
-
* `delegationEntryCaps`),**原样递给本车道的每一只 Runner**。唯一属主 = `boot/runner-deps.ts` 的
|
|
82
|
-
* `buildDeploymentPostureSeats(config)`(主 runner / subRunner / run-local 的共享基座展开的就是它),
|
|
83
|
-
* `boot/leader.ts` 把**同一函数、同一 config** 的产物搬过来:一个进程里「这台部署的 READ 面 / 记忆姿态 /
|
|
84
|
-
* 委派 caps」只能有一个答案。缺席 = 展开空对象 = 五处字面量键缺席(与接线前逐字相同)。
|
|
85
|
-
* 修前(≤7.53)这五只 Runner 一席都没有:运维写的 READ_DENY_PATTERNS / MEMORY_DELEGATION_EVIDENCE 等对
|
|
86
|
-
* leader 编排的 planner / worker / repair / conflict 四类任务**静默不生效**(core 内建 deny 表仍在)。
|
|
87
|
-
*
|
|
88
|
-
* 🔴 **是 provider 不是快照**([ref] 追加,codex 对抗复审 r1 [high] 验真后修):本车道的 Runner 是
|
|
89
|
-
* **逐调用现构**的,而 [ref] 起 `config.readFace` 在进程内**会变**(center 下发的 read face 转成了
|
|
90
|
-
* `Runner.swapDeps` 热换席)。boot 期取一次值再五处复用,等于让 leader 车道永远停在起服那一刻的 READ
|
|
91
|
-
* 姿态:读面(`/v1/capabilities`、`/v1/diagnostics/wiring`)报新档、`restart.reasons` 也不再要求重启,
|
|
92
|
-
* 而**新建的 leader Runner 仍在旧档上跑** —— 组织把 `open` 收紧成 `roots` 之后这条腿还在 open,方向是
|
|
93
|
-
* fail-OPEN。改成函数席之后每只 Runner 构造时现读,与主车道经 swap 门换代**同代**;已经准备好的腿
|
|
94
|
-
* 保留它准备时的那一份(core 的自然快照语义,两条腿同律)。 */
|
|
95
|
-
deploymentPosture?: () => DeploymentPostureSeats;
|
|
65
|
+
plane: () => DeploymentPlaneDeps;
|
|
96
66
|
/**
|
|
97
|
-
*
|
|
98
|
-
* 得出这条 run 的入口体(`LeaderDeps.entry`);本 run 铸的每一条 spec 与 worker 的续跑体都从它取词。入口词是 `plan` 的 run 进不了这条车道
|
|
99
|
-
* (`leaderEntryRefusal`:worker 会话没有计划审阅通道)⇒ 出生处即以拒句收场;HTTP 受理口用同一只判据先答 422。
|
|
100
|
-
*
|
|
101
|
-
* 🔴 **函数席**(与 `deploymentPosture` / `durable` 同一条先例):`config.autonomy` 被 web-admin 原地热改,boot 期取一次值会把这条腿钉在起服那一刻。
|
|
102
|
-
* **必填**:没有 AUTONOMY 的装配递 `() => undefined` —— 缺席不是「没有地板」的合法拼法(权限轴上不许静默放宽)。
|
|
103
|
-
*/
|
|
104
|
-
autonomy: () => Autonomy | undefined;
|
|
105
|
-
/**
|
|
106
|
-
* [ref]([ref])—— **计费/遥测追踪席**,原样递给本车道的每一只 Runner。唯一属主 =
|
|
107
|
-
* `boot/budget-tracing.ts` 的 `createTracer(...)`(主 runner / subRunner / hook runner 经共享基座吃的
|
|
108
|
-
* 就是它),`boot/leader.ts` 搬的是**同一只**。
|
|
109
|
-
*
|
|
110
|
-
* 🔴 为什么这一席是承重的:`src/budget.ts` 的 `createTracer` 是 `brain.call` **唯一**的记账点 ——
|
|
111
|
-
* `costQuota.add` / `fleetUsage.record` / `fleetLease.recordSpend` / `model_cost_micro_usd_total` 四个写口
|
|
112
|
-
* 全在那里(`createBrain` 自己不记账)。而 `POST /v1/leader` 的准入处**读**的正是 costQuota / fleetLease
|
|
113
|
-
* 这两个桶。缺席 ⇒ 门查的桶与花钱的手不是同一只:`MAX_PRINCIPAL_COST_USD` 与 fleet 租约对这条腿结构性
|
|
114
|
-
* 失效,而一条 leader run 扇出 ≤6 个带手 worker + planner + repair/conflict 环,全是实钱。
|
|
115
|
-
* 归因的另一半在 `leader/endpoint.ts` 的 `drive()`(ALS `withSubject`)—— 记账臂按 `currentPerson()`
|
|
116
|
-
* 分租户,只补席不包裹 = 归因恒 undefined = 假绿。缺席 ⇒ 展开空对象(与接线前逐字相同)。
|
|
67
|
+
* 部署治理折叠(`LeaderBirth.govern`;装配处闭包活 config,leader 不读 config)—— 每一条腿出生时经 {@link withLeaderLeg} 调一次。
|
|
117
68
|
*/
|
|
118
|
-
|
|
69
|
+
govern: LeaderBirth["govern"];
|
|
119
70
|
/**
|
|
120
|
-
*
|
|
121
|
-
*
|
|
122
|
-
* leader 不自铸、不自己装配(一个进程两份部署注册 = 主车道与 leader 车道各按一套扩展跑)。缺失时整个部署座在这条车道上缺席:运维声明的守卫包
|
|
123
|
-
* 管不到 leader 派出的腿,拒绝计量 / 工具追踪也漏这条腿。缺席 ⇒ 展开空对象。
|
|
71
|
+
* 每条腿的 per-model 凭据席(`LeaderBirth.auth`;装配处铸,与任务面同一只活引用)—— 本车道每一只 Runner 跑的 spec 都带它:五个出生点经 {@link withLeaderLeg},
|
|
72
|
+
* planner 路由在它的 Runner 构造那一拍取一只。**必填**:没有 per-model 钥匙的装配照样递(席对每只模型答「没有自己的钥」⇒ 网关钥,与不递逐字同)。
|
|
124
73
|
*/
|
|
125
|
-
|
|
74
|
+
auth: LeaderBirth["auth"];
|
|
126
75
|
/**
|
|
127
|
-
*
|
|
128
|
-
*
|
|
76
|
+
* 腿的路径裁决的槽表(进程内唯一那一只,`boot/deferred-sandbox-path-env.ts`)。本车道**手里握着 env** 的腿 —— 静态车道的 worker、集成修复腿 ——
|
|
77
|
+
* 的 env 不是部署工厂为那条腿铸的,工厂装饰器登记不到;每一次 run 由本车道按跑它的会话号登记、run 收场即注销(守卫在沙盒车道上按会话号取真身)。
|
|
129
78
|
*/
|
|
130
|
-
|
|
79
|
+
legSlots: Pick<SandboxPathEnvSlots, "bind">;
|
|
131
80
|
/**
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
* `
|
|
135
|
-
*
|
|
136
|
-
* 成对的理由是 core 的消费形:`prepare-task.js` 的 `buildUsageGovernance(usageWindows, deps, …)` 要求
|
|
137
|
-
* 声明与 `deps.usageWindowStore` **同时**在场才铸 `usageGovernance`,缺一即 undefined(既不 check 也不
|
|
138
|
-
* commit)⇒ 半席只是死键。缺席 ⇒ 展开空对象。
|
|
139
|
-
* 提交面那一半(`POST /v1/leader` 的 `usageWindowDenied` 门)在 `src/http/routes/leader.ts`。
|
|
140
|
-
*/
|
|
141
|
-
usageWindows?: RunnerDeps["usageWindows"];
|
|
142
|
-
usageWindowStore?: RunnerDeps["usageWindowStore"];
|
|
143
|
-
/**
|
|
144
|
-
* [ref]([ref])—— **center 发布的 prompt catalog** 席,原样递给本车道的每一只 Runner。唯一属主 =
|
|
145
|
-
* `boot/web-admin.ts` 的 `webAdmin.promptSource`(主 runner / subRunner 同一只;run-local 有自己
|
|
146
|
-
* 的等价腿)。缺席 ⇒ leader 的 planner/worker/repair/conflict 四类**顶层**任务跑引擎内置提示词,而同一
|
|
147
|
-
* 部署的 `/v1/tasks`、`/v1/runs` 跑运维发布的那一份 —— 且 core 顶层新任务走的是**静默**臂(pinned /
|
|
148
|
-
* parentCenterArtifactDigest 两支才 `prompt.snapshot_unavailable` fail-loud),运维面零信号。
|
|
149
|
-
* 缺席 ⇒ 展开空对象(与接线前逐字相同)。
|
|
150
|
-
*/
|
|
151
|
-
promptSource?: RunnerDeps["promptSource"];
|
|
152
|
-
/**
|
|
153
|
-
* [ref] 的**披露半件**([ref],codex 对抗复审 r2-[high],亲读装树 core 后修)—— 部署级错误汇。
|
|
154
|
-
*
|
|
155
|
-
* 🔴 为什么它与治理窗席**同生共死**:core 对「治理窗最终扣账失败」的唯一出口就是这一席 ——
|
|
156
|
-
* `dist/core/runner/runtask.js` 收尾段 `catch (flushErr) { this.deps.onError?.(flushErr, { phase: "config", … }) }`
|
|
157
|
-
* (以及 10s 慢盘披露的同一只回调),抛错之后任务**按原结果收尾**。挂了窗席却不挂本席 = 一次窗账
|
|
158
|
-
* 永久丢失时这条腿上零日志零计数,后续提交继续读偏低的窗被放行 —— CLAUDE.md [ref]「治理/门轴禁静默
|
|
159
|
-
* fail-open」正是说这个。它顺带也把 leader 车道其余 phase(degraded / rewind / memory / mcp / a2a /
|
|
160
|
-
* prompt-cache …)的既有观测面补齐,与 `onNotice` 席当年([ref]②)同一个理由。
|
|
81
|
+
* 运维 `AUTONOMY`(活 config 的那一位)—— 本车道每条 leader run **出生那一拍**读一次,经 `run-entry.ts` 的 `leaderRunEntry`(入口地板 + 受理门同一只入口函数 `entryPermissionMode`)
|
|
82
|
+
* 得出这条 run 的入口体(`LeaderDeps.birth.entry`);本 run 铸的每一条 spec 与 worker 的续跑体都从它取词。入口词是 `plan` 的 run 进不了这条车道
|
|
83
|
+
* (`leaderEntryRefusal`:worker 会话没有计划审阅通道)⇒ 出生处即以拒句收场;HTTP 受理口用同一只判据先答 422。
|
|
161
84
|
*
|
|
162
|
-
*
|
|
163
|
-
* `
|
|
164
|
-
* leader 绝不另写一份臂表(两份必漂)。缺席 ⇒ 展开空对象(与接线前逐字相同)。
|
|
85
|
+
* 🔴 **函数席**(与 `deploymentPosture` / `durable` 同一条先例):`config.autonomy` 被 web-admin 原地热改,boot 期取一次值会把这条腿钉在起服那一刻。
|
|
86
|
+
* **必填**:没有 AUTONOMY 的装配递 `() => undefined` —— 缺席不是「没有地板」的合法拼法(权限轴上不许静默放宽)。
|
|
165
87
|
*/
|
|
166
|
-
|
|
167
|
-
/** Worker model brain + catalog (the same the service runs tasks on). */
|
|
168
|
-
brain: Brain;
|
|
169
|
-
models: Record<string, Model>;
|
|
170
|
-
roles: ModelRoles;
|
|
171
|
-
/** The active tier table of the served catalog (boot hands the same object as `config.tiers`, mutated in place on a hot apply).
|
|
172
|
-
* Every leader Runner gets it with `models` / `roles` (one seat, `servedTableSeat`): a role resolves in the tier-expanded view,
|
|
173
|
-
* exactly as the main runner resolves it — absent ⇒ no tiers (the env table has none). */
|
|
174
|
-
tiers?: NonNullable<RunnerDeps["tiers"]>;
|
|
175
|
-
pricing: Record<string, ModelPricing>;
|
|
88
|
+
autonomy: () => Autonomy | undefined;
|
|
176
89
|
/** Workspace root inside each E2B VM. Default /home/user. */
|
|
177
90
|
workspace?: string;
|
|
178
91
|
/** Git identity for the Coordinator's local clone/commit. */
|
|
@@ -198,14 +111,7 @@ export interface LeaderWireConfig {
|
|
|
198
111
|
* complete path; a suspended worker's paused env is exempt from the leader reap by construction) and diff-out
|
|
199
112
|
* is the worker's mandatory self-upload to this MinIO/S3 store (presigned per worker; creds adapter-held).
|
|
200
113
|
* Unset = the original leader-owned static-env mode (pullDiff compat). */
|
|
201
|
-
s3?:
|
|
202
|
-
endpoint: string;
|
|
203
|
-
bucket: string;
|
|
204
|
-
accessKey: string;
|
|
205
|
-
secretKey: string;
|
|
206
|
-
region?: string;
|
|
207
|
-
keyPrefix?: string;
|
|
208
|
-
};
|
|
114
|
+
s3?: LeaderDiffStore;
|
|
209
115
|
logger?: {
|
|
210
116
|
warn?: (m: string, x?: Record<string, unknown>) => void;
|
|
211
117
|
info?: (m: string, x?: Record<string, unknown>) => void;
|
|
@@ -279,6 +185,10 @@ export declare function stageWorkerEnv(env: WireEnv, opts: {
|
|
|
279
185
|
* (URL) silently killed long autonomous builds or expired the diff upload mid-run. core's turn cap is now a
|
|
280
186
|
* high net (10000), so the leader gives each worker an explicit triple bound; a sub-task's own limits override.
|
|
281
187
|
*/
|
|
188
|
+
/** The leader's diff-out URL lifetime (`presignTtlSec` = `LEADER_TIMEOUT_MS` / 1000 + 600: the URL outlives the worker) over the SigV4 ceiling ⇒ the
|
|
189
|
+
* refusal sentence, naming the knob and its largest value; within it ⇒ `undefined`. The runner refuses to be built with a diff-out store on such a
|
|
190
|
+
* configuration (boot), instead of signing URLs the store would refuse at the end of a worker's run. */
|
|
191
|
+
export declare function leaderDiffUrlTtlRefusal(presignTtlSec: number): string | undefined;
|
|
282
192
|
export declare function leaderResourceConfig(env?: NodeJS.ProcessEnv): {
|
|
283
193
|
leaderTimeoutMs: number;
|
|
284
194
|
workerMaxTurns: number;
|