@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
|
@@ -3,7 +3,7 @@ import { FLEET_SNAPSHOT_TERMINAL_MAX_ROWS, isTerminalWorkflowRowStatus, recentTe
|
|
|
3
3
|
import { taskNotificationFoldKey } from "../../orchestration/workflow-completion-inbox.js";
|
|
4
4
|
import { sendJson, sendError, sseHeaders } from "../send.js";
|
|
5
5
|
import { gatedSubject, sendPrincipalRefusal } from "../principal-gate.js";
|
|
6
|
-
import { routeListFilter } from "../owner-access.js";
|
|
6
|
+
import { routeListFilter, workflowScopeOf } from "../owner-access.js";
|
|
7
7
|
import { assertNever } from "../route-ctx.js";
|
|
8
8
|
import * as facts from "../../capability-facts.js";
|
|
9
9
|
export async function handleFleet(req, res, match, ctx) {
|
|
@@ -24,22 +24,24 @@ export async function handleFleet(req, res, match, ctx) {
|
|
|
24
24
|
const fleetParams = new URLSearchParams(match.search);
|
|
25
25
|
const callerSession = fleetParams.get("session");
|
|
26
26
|
const observeOnly = fleetParams.get("observe") === "1";
|
|
27
|
-
|
|
27
|
+
const workflowScope = workflowScopeOf(principal);
|
|
28
|
+
const viewer = fleetWide ? null : { rows: principal ?? "default", workflows: workflowScope };
|
|
29
|
+
await streamFleet(req, res, fleet.fleetBus, viewer, callerSession || null, observeOnly ? undefined : deps.workflowCompletionInbox, { store: deps.workflowRunStore, scope: viewer?.workflows ?? null, pullScope: workflowScope, ready: deps.fleetRecoveryDone });
|
|
28
30
|
return;
|
|
29
31
|
}
|
|
30
32
|
default:
|
|
31
33
|
return assertNever(match.decl.id);
|
|
32
34
|
}
|
|
33
35
|
}
|
|
34
|
-
function streamFleet(req, res, bus,
|
|
36
|
+
function streamFleet(req, res, bus, viewer, callerSession = null, completionInbox, terminal) {
|
|
35
37
|
return new Promise((resolve) => {
|
|
36
38
|
sseHeaders(res);
|
|
37
|
-
res.write(`event: meta\ndata: ${JSON.stringify({ type: "meta", version: 1, scoped:
|
|
39
|
+
res.write(`event: meta\ndata: ${JSON.stringify({ type: "meta", version: 1, scoped: viewer !== null, sessionScoped: callerSession !== null, ...(callerSession !== null ? { session: callerSession } : {}), bgNotifyFailClosed: true })}\n\n`);
|
|
38
40
|
const seenTasks = new Set();
|
|
39
41
|
const seenWf = new Set();
|
|
40
42
|
const sessionOk = (rowSession) => callerSession === null || rowSession === undefined || rowSession === callerSession;
|
|
41
|
-
const visT = (r) => (
|
|
42
|
-
const visW = (r) => (
|
|
43
|
+
const visT = (r) => (viewer === null || r.scope === viewer.rows) && sessionOk(r.sessionId);
|
|
44
|
+
const visW = (r) => (viewer === null || r.scope === viewer.workflows) && sessionOk(r.sessionId);
|
|
43
45
|
const SCOPED_TASK_KEY_DISPOSITION = {
|
|
44
46
|
id: "keep", parentId: "keep", parentToolCallId: "keep", workflowRunId: "keep", status: "keep",
|
|
45
47
|
startedAt: "keep", elapsedMs: "keep", tokens: "keep",
|
|
@@ -144,7 +146,7 @@ function streamFleet(req, res, bus, callerScope, callerSession = null, completio
|
|
|
144
146
|
break;
|
|
145
147
|
case "hook_notice": {
|
|
146
148
|
const hn = frame.notice;
|
|
147
|
-
const hScopeOk =
|
|
149
|
+
const hScopeOk = viewer === null || hn.ownerScope === viewer.rows;
|
|
148
150
|
const hSessionOk = callerSession === null || hn.ownerSessionId === callerSession;
|
|
149
151
|
if (hScopeOk && hSessionOk) {
|
|
150
152
|
send("hook_notice", { type: "hook_notice", ...hookNoticeWire(hn), ts: frame.ts });
|
|
@@ -153,7 +155,7 @@ function streamFleet(req, res, bus, callerScope, callerSession = null, completio
|
|
|
153
155
|
}
|
|
154
156
|
case "bg_notification": {
|
|
155
157
|
const n = frame.notification;
|
|
156
|
-
const scopeOk =
|
|
158
|
+
const scopeOk = viewer === null || n.ownerScope === viewer.rows;
|
|
157
159
|
const sessionInjectOk = callerSession === null || n.ownerSessionId === callerSession;
|
|
158
160
|
if (scopeOk && sessionInjectOk) {
|
|
159
161
|
const { ownerScope: _os, ownerSessionId: _osid, ...wire } = n;
|
|
@@ -49,13 +49,13 @@ export async function handleImages(req, res, match, ctx) {
|
|
|
49
49
|
const bakes = deps.imageBakes;
|
|
50
50
|
const idx = deps.imageIndex;
|
|
51
51
|
const principal = gatedPerson(req, deps.config);
|
|
52
|
-
const isExplicitOperator = explicitOperatorOk(principal, deps.config);
|
|
53
|
-
const operatorLane = facts.operatorLane(deps);
|
|
52
|
+
const isExplicitOperator = explicitOperatorOk(principal, deps.config, "operate");
|
|
53
|
+
const operatorLane = facts.operatorLane(deps, "operate");
|
|
54
54
|
const cfg = deps.config.imageBakes;
|
|
55
55
|
const isRunner = source !== undefined && source !== null && source === cfg.runnerPrincipal;
|
|
56
56
|
if (match.decl.id === "image-bake-submit") {
|
|
57
57
|
if (!operatorLane.available) {
|
|
58
|
-
sendOperatorPrincipalsRequired(res);
|
|
58
|
+
sendOperatorPrincipalsRequired(res, "operate");
|
|
59
59
|
return;
|
|
60
60
|
}
|
|
61
61
|
if (!isExplicitOperator) {
|
|
@@ -130,7 +130,7 @@ export async function handleImages(req, res, match, ctx) {
|
|
|
130
130
|
}
|
|
131
131
|
if (match.decl.id === "image-bake-events") {
|
|
132
132
|
if (!operatorLane.available) {
|
|
133
|
-
sendOperatorPrincipalsRequired(res);
|
|
133
|
+
sendOperatorPrincipalsRequired(res, "operate");
|
|
134
134
|
return;
|
|
135
135
|
}
|
|
136
136
|
if (!isExplicitOperator) {
|
|
@@ -152,7 +152,7 @@ export async function handleImages(req, res, match, ctx) {
|
|
|
152
152
|
}
|
|
153
153
|
if (match.decl.id === "image-bake-cancel") {
|
|
154
154
|
if (!operatorLane.available) {
|
|
155
|
-
sendOperatorPrincipalsRequired(res);
|
|
155
|
+
sendOperatorPrincipalsRequired(res, "operate");
|
|
156
156
|
return;
|
|
157
157
|
}
|
|
158
158
|
if (!isExplicitOperator) {
|
|
@@ -264,7 +264,7 @@ export async function handleImages(req, res, match, ctx) {
|
|
|
264
264
|
}
|
|
265
265
|
if (match.decl.id === "image-bake-detail") {
|
|
266
266
|
if (!operatorLane.available) {
|
|
267
|
-
sendOperatorPrincipalsRequired(res);
|
|
267
|
+
sendOperatorPrincipalsRequired(res, "operate");
|
|
268
268
|
return;
|
|
269
269
|
}
|
|
270
270
|
if (!isExplicitOperator) {
|
|
@@ -290,7 +290,7 @@ export async function handleImages(req, res, match, ctx) {
|
|
|
290
290
|
if (pool.available && isIndexRouteId(match.decl.id)) {
|
|
291
291
|
const idx = pool.imageIndex;
|
|
292
292
|
const principal = gatedPerson(req, deps.config);
|
|
293
|
-
const operator = explicitOperatorOk(principal, deps.config);
|
|
293
|
+
const operator = explicitOperatorOk(principal, deps.config, "operate");
|
|
294
294
|
const viewer = { operator, tenantId: principal ?? null };
|
|
295
295
|
const q = new URLSearchParams(match.search);
|
|
296
296
|
if (match.decl.id === "images-index") {
|
|
@@ -340,11 +340,11 @@ export async function handleImages(req, res, match, ctx) {
|
|
|
340
340
|
return;
|
|
341
341
|
}
|
|
342
342
|
if (match.decl.id === "image-register") {
|
|
343
|
-
if (!facts.operatorLane(deps).available) {
|
|
344
|
-
sendOperatorPrincipalsRequired(res);
|
|
343
|
+
if (!facts.operatorLane(deps, "operate").available) {
|
|
344
|
+
sendOperatorPrincipalsRequired(res, "operate");
|
|
345
345
|
return;
|
|
346
346
|
}
|
|
347
|
-
if (!explicitOperatorOk(principal, deps.config)) {
|
|
347
|
+
if (!explicitOperatorOk(principal, deps.config, "operate")) {
|
|
348
348
|
sendError(res, 403, "auth.operator_only", "operator only");
|
|
349
349
|
return;
|
|
350
350
|
}
|
|
@@ -73,10 +73,10 @@ export async function handleMemoryBundle(req, res, match, ctx) {
|
|
|
73
73
|
}
|
|
74
74
|
const fact = facts.memoryBundle(deps);
|
|
75
75
|
if (!fact.available && fact.why === "operator_principals_empty") {
|
|
76
|
-
sendOperatorPrincipalsRequired(res);
|
|
76
|
+
sendOperatorPrincipalsRequired(res, "operate");
|
|
77
77
|
return;
|
|
78
78
|
}
|
|
79
|
-
if (!explicitOperatorOk(principal, deps.config)) {
|
|
79
|
+
if (!explicitOperatorOk(principal, deps.config, "operate")) {
|
|
80
80
|
sendError(res, 403, "auth.operator_only", "memory governance bundles are an operator-only deployment action");
|
|
81
81
|
return;
|
|
82
82
|
}
|
|
@@ -86,7 +86,7 @@ export async function handleMemoryBundle(req, res, match, ctx) {
|
|
|
86
86
|
sendError(res, 501, "capability.memory_engine_required", "memory governance bundles are not available on this deployment — they require a wired memory engine (MEMORY_ENGINE=on) whose backend implements the v2-c bundle composite (exportSnapshotOf / importBundleCommit); the file memory backend does, the pg/mysql memory backends do not");
|
|
87
87
|
return;
|
|
88
88
|
case "operator_principals_empty":
|
|
89
|
-
sendOperatorPrincipalsRequired(res);
|
|
89
|
+
sendOperatorPrincipalsRequired(res, "operate");
|
|
90
90
|
return;
|
|
91
91
|
default:
|
|
92
92
|
return assertNever(fact.why);
|
|
@@ -29,10 +29,10 @@ export async function handleMemoryCompliance(req, res, match, ctx) {
|
|
|
29
29
|
}
|
|
30
30
|
const fact = facts.memoryCompliance(deps);
|
|
31
31
|
if (!fact.available && fact.why === "operator_principals_empty") {
|
|
32
|
-
sendOperatorPrincipalsRequired(res);
|
|
32
|
+
sendOperatorPrincipalsRequired(res, "operate");
|
|
33
33
|
return;
|
|
34
34
|
}
|
|
35
|
-
if (!explicitOperatorOk(principal, deps.config)) {
|
|
35
|
+
if (!explicitOperatorOk(principal, deps.config, "operate")) {
|
|
36
36
|
sendError(res, 403, "auth.operator_only", "memory provenance and erasure are operator-only deployment actions");
|
|
37
37
|
return;
|
|
38
38
|
}
|
|
@@ -42,7 +42,7 @@ export async function handleMemoryCompliance(req, res, match, ctx) {
|
|
|
42
42
|
sendError(res, 501, "capability.memory_engine_required", "memory provenance and erasure are not available on this deployment — they require a wired memory engine (MEMORY_ENGINE=on) whose backend owns the engine control plane (controlPlaneRoot); the file memory backend does, the pg/mysql memory backends do not (their control plane would land on a replica's local disk)");
|
|
43
43
|
return;
|
|
44
44
|
case "operator_principals_empty":
|
|
45
|
-
sendOperatorPrincipalsRequired(res);
|
|
45
|
+
sendOperatorPrincipalsRequired(res, "operate");
|
|
46
46
|
return;
|
|
47
47
|
default:
|
|
48
48
|
return assertNever(fact.why);
|
|
@@ -85,14 +85,14 @@ export async function handleMemoryConsolidation(req, res, match, ctx) {
|
|
|
85
85
|
sendError(res, 501, "feature.memory_consolidation_disabled", "memory consolidation is switched off on this deployment (MEMORY_CONSOLIDATION_DRIVER is off, or its default derived off because no cheap model is configured); turn it on to use these endpoints");
|
|
86
86
|
return;
|
|
87
87
|
case "operator_principals_empty":
|
|
88
|
-
sendOperatorPrincipalsRequired(res);
|
|
88
|
+
sendOperatorPrincipalsRequired(res, "operate");
|
|
89
89
|
return;
|
|
90
90
|
default:
|
|
91
91
|
return assertNever(fact.why);
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
const faces = fact.valve;
|
|
95
|
-
if (!explicitOperatorOk(principal, deps.config)) {
|
|
95
|
+
if (!explicitOperatorOk(principal, deps.config, "operate")) {
|
|
96
96
|
sendError(res, 403, "auth.operator_only", "memory consolidation is operator-only: the caller principal is not in OPERATOR_PRINCIPALS");
|
|
97
97
|
return;
|
|
98
98
|
}
|
|
@@ -118,10 +118,10 @@ export async function handleMemoryOrigin(req, res, match, ctx) {
|
|
|
118
118
|
}
|
|
119
119
|
const fact = facts.memoryOrigin(deps);
|
|
120
120
|
if (!fact.available && fact.why === "operator_principals_empty") {
|
|
121
|
-
sendOperatorPrincipalsRequired(res);
|
|
121
|
+
sendOperatorPrincipalsRequired(res, "operate");
|
|
122
122
|
return;
|
|
123
123
|
}
|
|
124
|
-
if (!explicitOperatorOk(principal, deps.config)) {
|
|
124
|
+
if (!explicitOperatorOk(principal, deps.config, "operate")) {
|
|
125
125
|
sendError(res, 403, "auth.operator_only", "memory origin marking and clearance are operator-only deployment actions");
|
|
126
126
|
return;
|
|
127
127
|
}
|
|
@@ -131,7 +131,7 @@ export async function handleMemoryOrigin(req, res, match, ctx) {
|
|
|
131
131
|
sendError(res, 501, "capability.memory_engine_required", "memory origin marking and clearance are not available on this deployment — they require a wired memory engine (MEMORY_ENGINE=on) whose backend owns the engine control plane (controlPlaneRoot); the clearance ledger and its write-ahead custody rows live in that plane, and on a backend without it they would land on one replica's local disk");
|
|
132
132
|
return;
|
|
133
133
|
case "operator_principals_empty":
|
|
134
|
-
sendOperatorPrincipalsRequired(res);
|
|
134
|
+
sendOperatorPrincipalsRequired(res, "operate");
|
|
135
135
|
return;
|
|
136
136
|
default:
|
|
137
137
|
return assertNever(fact.why);
|
|
@@ -9,7 +9,7 @@ import { gatedPerson, explicitOperatorOk, sendPrincipalRefusal, sendUnauthorized
|
|
|
9
9
|
import { assertNever } from "../route-ctx.js";
|
|
10
10
|
import { sentMemoryFaceFault } from "../memory-face-fault-reply.js";
|
|
11
11
|
function layerFaceAudience(deps, principal, face, scope) {
|
|
12
|
-
if (explicitOperatorOk(principal, deps.config))
|
|
12
|
+
if (explicitOperatorOk(principal, deps.config, "operate"))
|
|
13
13
|
return { kind: "operator" };
|
|
14
14
|
return { kind: "layer_owner", face, withheld: (coreMessage) => deps.logger?.warn?.(face === "export" ? "memory_export_refused" : "memory_sync_refused", { scope, err: coreMessage }) };
|
|
15
15
|
}
|
|
@@ -44,7 +44,7 @@ function directoryDecidesThisFace(mode) {
|
|
|
44
44
|
async function gateMemoryScope(deps, person, scope, need) {
|
|
45
45
|
if (scope === formatUserScope(person) || parseProjectLayerKey(scope)?.owner === person)
|
|
46
46
|
return { kind: "allow" };
|
|
47
|
-
if (explicitOperatorOk(person, deps.config))
|
|
47
|
+
if (explicitOperatorOk(person, deps.config, "operate"))
|
|
48
48
|
return { kind: "allow" };
|
|
49
49
|
const directory = deps.orgMemoryDirectory;
|
|
50
50
|
if (!scope.startsWith(ORG_PREFIX) || directory === undefined || !directoryDecidesThisFace(deps.config.memoryOrgAdmissionMode)) {
|
|
@@ -9,10 +9,10 @@ export async function handleObservability(req, res, match, ctx) {
|
|
|
9
9
|
case "outcomes": {
|
|
10
10
|
const fact = facts.outcomeLedger(deps);
|
|
11
11
|
if (!fact.available && fact.why === "operator_principals_empty") {
|
|
12
|
-
sendOperatorPrincipalsRequired(res);
|
|
12
|
+
sendOperatorPrincipalsRequired(res, "operate");
|
|
13
13
|
return;
|
|
14
14
|
}
|
|
15
|
-
if (!explicitOperatorOk(gatedPerson(req, deps.config), deps.config)) {
|
|
15
|
+
if (!explicitOperatorOk(gatedPerson(req, deps.config), deps.config, "operate")) {
|
|
16
16
|
sendError(res, 403, "auth.operator_only", "the outcomes view is operator-only");
|
|
17
17
|
return;
|
|
18
18
|
}
|
|
@@ -22,7 +22,7 @@ export async function handleObservability(req, res, match, ctx) {
|
|
|
22
22
|
sendError(res, 501, "capability.outcome_ledger_required", "no queryable outcome ledger on this worker (File sink — read the JSONL dataset directly)");
|
|
23
23
|
return;
|
|
24
24
|
case "operator_principals_empty":
|
|
25
|
-
sendOperatorPrincipalsRequired(res);
|
|
25
|
+
sendOperatorPrincipalsRequired(res, "operate");
|
|
26
26
|
return;
|
|
27
27
|
default:
|
|
28
28
|
return assertNever(fact.why);
|
|
@@ -9,8 +9,9 @@
|
|
|
9
9
|
* · **登记簿只由配置中心下发**:settings-schema 的本地读取集不收 `projects` 域 ⇒ 没有中心腿在应用配置的部署上没有登记簿 —— 两口 501
|
|
10
10
|
* `capability.unavailable`,能力位 `capabilities.projects`(布尔)读同一只事实(`capability-facts.ts` 的 `projectRegistry`)答 `false`;
|
|
11
11
|
* 有登记簿时答 `true`。本面不开写动词(写到哪里由另一张设计定;写面到货时另立一位,本位不改义)。
|
|
12
|
-
* · **可见性 fail-closed**:身份判在登记簿在场判**之前**(否则「这台有没有登记簿」先于 401 泄出去)
|
|
13
|
-
*
|
|
12
|
+
* · **可见性 fail-closed**:身份判在登记簿在场判**之前**(否则「这台有没有登记簿」先于 401 泄出去);判与按 id 取只有一只(`project-registry.ts`:
|
|
13
|
+
* fleet 调用方(列表面 `list.read` 读档(`listFilterOf`))看全部,带验过主体的调用方只看 `registeredBy` 恰是自己的登记 —— 项目上下文继承与登记簿默认读层种子同读它);
|
|
14
|
+
* 看不见的与不存在的同码同句(404 `not_found.project`,不给存在性预言机)。
|
|
14
15
|
*
|
|
15
16
|
* 归档:`archivedAt` 在场 = 已归档。列表缺省不列,`?archived=true` 只列已归档的,`?archived=false` 与缺省同;单项读不论归档与否都答(会话行引用它)。
|
|
16
17
|
*/
|
|
@@ -4,7 +4,7 @@ import { sendUnauthorized } from "../principal-gate.js";
|
|
|
4
4
|
import { routeListFilter } from "../owner-access.js";
|
|
5
5
|
import { assertNever } from "../route-ctx.js";
|
|
6
6
|
import * as facts from "../../capability-facts.js";
|
|
7
|
-
import {
|
|
7
|
+
import { projectVisibleTo, visibleProjectOf } from "../../project-registry.js";
|
|
8
8
|
import { projectByTable } from "../../trace/projection-table.js";
|
|
9
9
|
export const PROJECT_NOT_FOUND_MESSAGE = "no such project";
|
|
10
10
|
export const PROJECT_ROW_DISPOSITIONS = {
|
|
@@ -49,7 +49,6 @@ export async function handleProjects(req, res, match, ctx) {
|
|
|
49
49
|
sendError(res, 501, "capability.unavailable", "the project registry is not available on this deployment: projects are published only by the configuration center, and no center configuration is applied here");
|
|
50
50
|
return;
|
|
51
51
|
}
|
|
52
|
-
const visible = (registration) => projectVisible(registration, viewer);
|
|
53
52
|
switch (match.decl.id) {
|
|
54
53
|
case "projects-list": {
|
|
55
54
|
const archived = readArchivedQuery(new URLSearchParams(match.search).get("archived"));
|
|
@@ -58,7 +57,7 @@ export async function handleProjects(req, res, match, ctx) {
|
|
|
58
57
|
return;
|
|
59
58
|
}
|
|
60
59
|
const projects = Object.entries(registry.registry)
|
|
61
|
-
.filter(([, registration]) =>
|
|
60
|
+
.filter(([, registration]) => projectVisibleTo(viewer, registration) && (registration.archivedAt !== undefined) === archived)
|
|
62
61
|
.map(([id, registration]) => projectRowOf(id, registration));
|
|
63
62
|
sendJson(res, 200, { projects });
|
|
64
63
|
return;
|
|
@@ -70,8 +69,8 @@ export async function handleProjects(req, res, match, ctx) {
|
|
|
70
69
|
return;
|
|
71
70
|
}
|
|
72
71
|
const id = raw.toLowerCase();
|
|
73
|
-
const registration =
|
|
74
|
-
if (registration === undefined
|
|
72
|
+
const registration = visibleProjectOf(registry.registry, id, viewer);
|
|
73
|
+
if (registration === undefined) {
|
|
75
74
|
sendError(res, 404, "not_found.project", PROJECT_NOT_FOUND_MESSAGE);
|
|
76
75
|
return;
|
|
77
76
|
}
|
|
@@ -33,11 +33,11 @@ export async function handleRetention(req, res, match, ctx) {
|
|
|
33
33
|
sendPrincipalRefusal(res, req, deps.config);
|
|
34
34
|
return;
|
|
35
35
|
}
|
|
36
|
-
if (!facts.operatorLane(deps).available) {
|
|
37
|
-
sendOperatorPrincipalsRequired(res);
|
|
36
|
+
if (!facts.operatorLane(deps, "operate").available) {
|
|
37
|
+
sendOperatorPrincipalsRequired(res, "operate");
|
|
38
38
|
return;
|
|
39
39
|
}
|
|
40
|
-
if (!explicitOperatorOk(principal, deps.config)) {
|
|
40
|
+
if (!explicitOperatorOk(principal, deps.config, "operate")) {
|
|
41
41
|
sendError(res, 403, "auth.operator_only", OPERATOR_ONLY_MESSAGE);
|
|
42
42
|
return;
|
|
43
43
|
}
|
|
@@ -242,9 +242,9 @@ function sendImportReceipt(res, outcome) {
|
|
|
242
242
|
function resolveTargetPrincipal(requested, caller, config) {
|
|
243
243
|
if (requested === undefined || requested === caller)
|
|
244
244
|
return { ok: true, principal: caller };
|
|
245
|
-
if (!facts.operatorLane({ config }).available)
|
|
245
|
+
if (!facts.operatorLane({ config }, "operate").available)
|
|
246
246
|
return { ok: false, why: "operator_principals_empty" };
|
|
247
|
-
if (!explicitOperatorOk(caller, config))
|
|
247
|
+
if (!explicitOperatorOk(caller, config, "operate"))
|
|
248
248
|
return { ok: false, why: "not_operator" };
|
|
249
249
|
if (principalShapeProblem(requested) !== undefined)
|
|
250
250
|
return { ok: false, why: "not_a_principal" };
|
|
@@ -259,7 +259,7 @@ async function handleRuleList(res, search, caller, lane, config) {
|
|
|
259
259
|
if (!target.ok) {
|
|
260
260
|
switch (target.why) {
|
|
261
261
|
case "operator_principals_empty":
|
|
262
|
-
sendOperatorPrincipalsRequired(res);
|
|
262
|
+
sendOperatorPrincipalsRequired(res, "operate");
|
|
263
263
|
return;
|
|
264
264
|
case "not_operator":
|
|
265
265
|
sendError(res, 403, "auth.operator_only", "reading another principal's rules is an operator-only action");
|
|
@@ -382,7 +382,7 @@ async function handleRuleWrite(res, rawBody, caller, lane, config) {
|
|
|
382
382
|
if (!target.ok) {
|
|
383
383
|
switch (target.why) {
|
|
384
384
|
case "operator_principals_empty":
|
|
385
|
-
sendOperatorPrincipalsRequired(res);
|
|
385
|
+
sendOperatorPrincipalsRequired(res, "operate");
|
|
386
386
|
return;
|
|
387
387
|
case "not_operator":
|
|
388
388
|
sendError(res, 403, "auth.operator_only", "writing another principal's rules is an operator-only action");
|
|
@@ -434,7 +434,7 @@ async function handleRuleRevoke(res, rawBody, caller, lane, config) {
|
|
|
434
434
|
if (!target.ok) {
|
|
435
435
|
switch (target.why) {
|
|
436
436
|
case "operator_principals_empty":
|
|
437
|
-
sendOperatorPrincipalsRequired(res);
|
|
437
|
+
sendOperatorPrincipalsRequired(res, "operate");
|
|
438
438
|
return;
|
|
439
439
|
case "not_operator":
|
|
440
440
|
sendError(res, 403, "auth.operator_only", "revoking another principal's rules is an operator-only action");
|
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
* 拒 ⇒ 422 `request.host_posture_refused`(与提交口同码同句)。
|
|
16
16
|
*
|
|
17
17
|
* ── 回写:准入的词写回存储体(run 模式词的唯一来源)────────────────────────────────────────────────────────
|
|
18
|
-
* 续跑腿(停驻后续跑 / 重启后续跑)按存储体顶层 `permissionMode` 重建 spec;不写回 =
|
|
18
|
+
* 续跑腿(停驻后续跑 / 重启后续跑)按存储体顶层 `permissionMode` 重建 spec;不写回 = 下一腿回到切档前的词。词与写据经改写口一笔换(写据 `switch`:
|
|
19
|
+
* 切档写下的词不是任何地板的出口,运维事后改严时续跑口照钳 —— `permission-mode-admission.ts` 顶注「写据」)。写回走**认领栅栏**
|
|
19
20
|
* (checkpoint 店的 `rewriteCtxWhileClaimed`:只在**接下切档的那条腿**此刻仍持有这条 run 时写,只改既有行)—— 这条 run 终局放掉认领、同会话新 run
|
|
20
21
|
* 已写下它自己的存储体之后,或这条 run 停驻、续跑的新腿(同一个 taskId 回到 running、认领仍在)已写下它续跑用的体之后,迟到的回写零写,
|
|
21
22
|
* 不会拿旧腿的体盖掉新腿的。腿身份 = {@link switchLegHolds}(栅栏里问)。同一条腿上的切档在本进程按活流对象串行(引擎受理序 = 落盘序;活流只在本副本)。
|
|
@@ -5,7 +5,7 @@ import { admitRunById, enter } from "../owner-access.js";
|
|
|
5
5
|
import { assertNever } from "../route-ctx.js";
|
|
6
6
|
import * as facts from "../../capability-facts.js";
|
|
7
7
|
import { PERMISSION_MODE_WORDS, coercePermissionModeStrict, parseTaskSettings } from "../../task-settings.js";
|
|
8
|
-
import { admitPermissionModeWord } from "../../permission-mode-admission.js";
|
|
8
|
+
import { admitPermissionModeWord, withStoredPermissionMode } from "../../permission-mode-admission.js";
|
|
9
9
|
import { readResumeCtx, resumeCtxCorruptAnswer, resumeCtxUnreadableAnswer, resumeCtxUnsealableAnswer } from "../resume-ctx-read.js";
|
|
10
10
|
import { sealCheckpointCtx } from "../checkpoint-ctx.js";
|
|
11
11
|
import { serviceVersion } from "../../service-version.js";
|
|
@@ -114,7 +114,7 @@ export async function handlePermissionMode(req, res, match, ctx) {
|
|
|
114
114
|
}
|
|
115
115
|
let persistMiss;
|
|
116
116
|
try {
|
|
117
|
-
const next = sealCheckpointCtx({ ...stored,
|
|
117
|
+
const next = sealCheckpointCtx({ ...withStoredPermissionMode(stored, admitted, "switch"), writerVersion: serviceVersion() }, deps.checkpointCtxSealing, sessionId);
|
|
118
118
|
const rewrite = await checkpointStore.rewriteCtxWhileClaimed(sessionId, next, { fence: runStore, taskId, legHolds: (fenced) => switchLegHolds(fenced, deps.instanceId, ctx.registry.steerableRuns.get(taskId), live) });
|
|
119
119
|
persistMiss = rewrite === "written" ? undefined : rewrite;
|
|
120
120
|
}
|
|
@@ -129,20 +129,15 @@ export declare const RUN_VERBS_ROUTES: readonly [{
|
|
|
129
129
|
readonly label: "/v1/questions/:id/respond";
|
|
130
130
|
readonly methods: readonly ["POST"];
|
|
131
131
|
}, {
|
|
132
|
-
readonly id: "
|
|
132
|
+
readonly id: "task-ask-decision";
|
|
133
133
|
readonly pattern: RegExp;
|
|
134
|
-
readonly label: "/v1/
|
|
134
|
+
readonly label: "/v1/tasks/:id/asks/:askId/decision";
|
|
135
135
|
readonly methods: readonly ["POST"];
|
|
136
136
|
}, {
|
|
137
|
-
readonly id: "
|
|
137
|
+
readonly id: "task-ask-read";
|
|
138
138
|
readonly pattern: RegExp;
|
|
139
|
-
readonly label: "/v1/
|
|
139
|
+
readonly label: "/v1/tasks/:id/asks/:askId";
|
|
140
140
|
readonly methods: readonly ["GET"];
|
|
141
|
-
}, {
|
|
142
|
-
readonly id: "task-ask-decision";
|
|
143
|
-
readonly pattern: RegExp;
|
|
144
|
-
readonly label: "/v1/tasks/:id/asks/:askId/decision";
|
|
145
|
-
readonly methods: readonly ["POST"];
|
|
146
141
|
}];
|
|
147
142
|
export type RunVerbsRouteId = RouteIdsOf<typeof RUN_VERBS_ROUTES>;
|
|
148
143
|
//# sourceMappingURL=runs.d.ts.map
|