@sema-agent/server 7.147.0 → 7.148.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/MIGRATION.md +1039 -24
- package/README.md +20 -7
- package/README.zh-CN.md +14 -8
- package/USAGE.md +380 -163
- package/deploy/sema-up/README.md +16 -5
- package/deploy/sema-up/chart/templates/NOTES.txt +1 -1
- package/deploy/sema-up/chart/templates/_helpers.tpl +20 -4
- package/deploy/sema-up/chart/values.yaml +3 -2
- package/deploy/sema-up/cluster-up.sh +74 -176
- package/deploy/sema-up/kube-up.sh +29 -49
- package/deploy/sema-up/lib/chart-run.sh +23 -0
- package/deploy/sema-up/lib/dataroot.sh +3 -3
- package/deploy/sema-up/lib/health.sh +62 -13
- package/deploy/sema-up/lib/helm-values-cluster.py +18 -0
- package/deploy/sema-up/lib/helm-values-kube.py +35 -0
- package/deploy/sema-up/lib/regcred.py +8 -0
- package/deploy/sema-up/lib/remote/helm-install.sh +3 -0
- package/deploy/sema-up/lib/remote/image-import.sh +6 -0
- package/deploy/sema-up/lib/remote/machine-precheck.sh +11 -0
- package/deploy/sema-up/lib/remote/region-probe.sh +3 -0
- package/deploy/sema-up/lib/remote/stack-ready.sh +26 -0
- package/deploy/sema-up/lib/remote/vxlan-guard.sh +8 -0
- package/deploy/sema-up/lib/render-stack.py +17 -0
- package/deploy/sema-up/lib/shell-text.sh +87 -0
- package/deploy/sema-up/lib/usage-flags.txt +10 -0
- package/deploy/sema-up/lib/usage-head.txt +1 -0
- package/deploy/sema-up/lib/usage-tail.txt +13 -0
- package/deploy/sema-up/preflight.sh +10 -8
- package/deploy/sema-up/sema-up.sh +14 -39
- package/deploy/sema-up/smoke.sh +7 -6
- package/deploy/sema-up/stack/compose.dataroot.yaml +3 -0
- package/deploy/sema-up/stack/compose.yaml +13 -1
- package/deploy/sema-up/stack/sema-stack-cluster.yaml +21 -0
- package/dist/adoption/plan.d.ts +24 -0
- package/dist/adoption/plan.js +53 -1
- package/dist/adoption/runner.d.ts +10 -1
- package/dist/adoption/runner.js +36 -16
- package/dist/adoption/wire.d.ts +3 -3
- package/dist/approval-card.d.ts +28 -30
- package/dist/approval-gate-currency.js +3 -2
- package/dist/approval-reconciler.d.ts +4 -13
- package/dist/approval-reconciler.js +2 -2
- package/dist/approval.d.ts +13 -11
- package/dist/approval.js +3 -3
- package/dist/audit.d.ts +10 -3
- package/dist/audit.js +15 -7
- package/dist/auth-bridge.d.ts +0 -14
- package/dist/auth-bridge.js +0 -7
- package/dist/auto-mode-face.d.ts +10 -7
- package/dist/auto-mode-face.js +7 -4
- package/dist/background-agent-name.d.ts +19 -1
- package/dist/background-agent-name.js +12 -2
- package/dist/background-session-reap.d.ts +1 -1
- package/dist/bake-runner/main.js +9 -6
- package/dist/bench/s1/arms.js +6 -5
- package/dist/bench/s1/live-deps.js +5 -2
- package/dist/bench/s1/run-firm.js +6 -5
- package/dist/bind-host.d.ts +25 -0
- package/dist/bind-host.js +25 -0
- package/dist/boot/adoption.d.ts +3 -0
- package/dist/boot/adoption.js +1 -0
- package/dist/boot/deployment-mods.d.ts +1 -1
- package/dist/boot/execution-env.d.ts +17 -7
- package/dist/boot/execution-env.js +37 -31
- package/dist/boot/exit-boundary.d.ts +2 -2
- package/dist/boot/exit-boundary.js +6 -5
- package/dist/boot/fatal-exit.d.ts +3 -5
- package/dist/boot/fatal-exit.js +2 -2
- package/dist/boot/leader.d.ts +15 -0
- package/dist/boot/leader.js +17 -15
- package/dist/boot/memory-consolidation.d.ts +37 -29
- package/dist/boot/memory-consolidation.js +11 -5
- package/dist/boot/org-memory.js +1 -1
- package/dist/boot/parked-revive-gate.js +2 -2
- package/dist/boot/reapers.d.ts +4 -3
- package/dist/boot/reapers.js +19 -16
- package/dist/boot/resolve-spec.d.ts +5 -3
- package/dist/boot/resolve-spec.js +55 -67
- package/dist/boot/retention-lane.d.ts +4 -4
- package/dist/boot/retention-lane.js +2 -2
- package/dist/boot/runner-deps.d.ts +28 -7
- package/dist/boot/runner-deps.js +11 -4
- package/dist/boot/runtime-caps.d.ts +2 -2
- package/dist/boot/runtime-caps.js +16 -2
- package/dist/boot/session-faces.d.ts +16 -7
- package/dist/boot/session-faces.js +114 -94
- package/dist/boot/shutdown.d.ts +5 -4
- package/dist/boot/shutdown.js +6 -4
- package/dist/boot/stage-01-config.js +9 -1
- package/dist/boot/stage-02-web-admin-pull.d.ts +1 -0
- package/dist/boot/stage-02-web-admin-pull.js +6 -1
- package/dist/boot/stage-03-store-backend.d.ts +3 -0
- package/dist/boot/stage-03-store-backend.js +4 -3
- package/dist/boot/stage-04-stores.d.ts +2 -0
- package/dist/boot/stage-04-stores.js +2 -2
- package/dist/boot/stage-05-execution-env.d.ts +7 -3
- package/dist/boot/stage-05-execution-env.js +2 -2
- package/dist/boot/stage-06-runners.d.ts +10 -12
- package/dist/boot/stage-06-runners.js +23 -15
- package/dist/boot/stage-07-capability-layer.d.ts +11 -8
- package/dist/boot/stage-07-capability-layer.js +5 -3
- package/dist/boot/stage-08-reapers.d.ts +11 -8
- package/dist/boot/stage-08-reapers.js +3 -3
- package/dist/boot/stage-09-leader.d.ts +12 -15
- package/dist/boot/stage-09-leader.js +12 -4
- package/dist/boot/stage-10-http-server.d.ts +12 -15
- package/dist/boot/stage-10-http-server.js +7 -4
- package/dist/boot/store-evidence.d.ts +20 -0
- package/dist/boot/store-evidence.js +13 -0
- package/dist/boot/stores.d.ts +3 -0
- package/dist/boot/stores.js +21 -10
- package/dist/boot/task-list-lane.d.ts +4 -4
- package/dist/boot/web-admin.d.ts +4 -2
- package/dist/boot/web-admin.js +55 -35
- package/dist/boot/webfetch-summarize-lane.d.ts +1 -1
- package/dist/boot-reclaim.d.ts +3 -1
- package/dist/boot-reclaim.js +1 -1
- package/dist/brain.d.ts +7 -18
- package/dist/brain.js +5 -17
- package/dist/budget.js +6 -6
- package/dist/capabilities/center-plugins.d.ts +7 -1
- package/dist/capabilities/center-plugins.js +32 -10
- package/dist/capabilities/center-wiring.js +1 -1
- package/dist/capabilities/composite-members.d.ts +2 -2
- package/dist/capabilities/composite-members.js +2 -2
- package/dist/capabilities/repo-tools.d.ts +2 -0
- package/dist/capabilities/repo-tools.js +14 -12
- package/dist/capabilities/scenarios.d.ts +6 -15
- package/dist/capabilities/scenarios.js +11 -16
- package/dist/capabilities/skills.d.ts +1 -1
- package/dist/capabilities/tool-defer.d.ts +1 -1
- package/dist/capability-facts.d.ts +38 -11
- package/dist/capability-facts.js +47 -8
- package/dist/card-void.d.ts +4 -4
- package/dist/card-void.js +1 -1
- package/dist/center-credential-renewer.d.ts +6 -2
- package/dist/center-credential-renewer.js +7 -3
- package/dist/config-catalog.d.ts +16 -1
- package/dist/config-catalog.js +62 -56
- package/dist/config-dir-trust.d.ts +37 -4
- package/dist/config-dir-trust.js +88 -44
- package/dist/config-invariants.d.ts +42 -3
- package/dist/config-invariants.js +69 -5
- package/dist/config-lkg.d.ts +23 -1
- package/dist/config-lkg.js +17 -3
- package/dist/config-provider.d.ts +9 -9
- package/dist/config-provider.js +25 -110
- package/dist/config-pull-failure.d.ts +50 -0
- package/dist/config-pull-failure.js +48 -0
- package/dist/config-types.d.ts +26 -17
- package/dist/config.d.ts +8 -16
- package/dist/config.js +113 -47
- package/dist/delegated-session-owner.d.ts +1 -1
- package/dist/deleted-session-ids.d.ts +3 -2
- package/dist/deployment-governance.d.ts +3 -3
- package/dist/deployment-shape.d.ts +30 -4
- package/dist/deployment-shape.js +7 -0
- package/dist/egress-redirect.d.ts +25 -7
- package/dist/egress-redirect.js +20 -2
- package/dist/elicitation.d.ts +6 -5
- package/dist/elicitation.js +23 -22
- package/dist/engine-identity.d.ts +28 -0
- package/dist/engine-identity.js +10 -0
- package/dist/entry-problems.d.ts +5 -7
- package/dist/entry-problems.js +1 -1
- package/dist/env-facts.js +2 -1
- package/dist/env-witness.d.ts +7 -0
- package/dist/env-witness.js +16 -0
- package/dist/execution-lane-caps.d.ts +5 -18
- package/dist/execution-lane-caps.js +0 -22
- package/dist/execution-placement.d.ts +58 -18
- package/dist/execution-placement.js +41 -2
- package/dist/field-conflict.d.ts +7 -11
- package/dist/field-conflict.js +3 -3
- package/dist/file-history-capture.d.ts +3 -3
- package/dist/file-history-disclosure.js +1 -0
- package/dist/fleet/fleet-bus.d.ts +21 -3
- package/dist/fleet/fleet-bus.js +35 -25
- package/dist/fleet/fleet-reconciler.js +2 -2
- package/dist/fleet/serving-lease.js +3 -3
- package/dist/fleet-client.js +3 -3
- package/dist/fleet-lease.d.ts +0 -1
- package/dist/fleet-lease.js +4 -5
- package/dist/history-anchor.d.ts +23 -3
- package/dist/history-anchor.js +24 -4
- package/dist/hitl-delivery.d.ts +90 -0
- package/dist/hitl-delivery.js +98 -0
- package/dist/hooks/classic-stations.d.ts +8 -11
- package/dist/hooks/classic-stations.js +0 -7
- package/dist/hooks/hook-llm.d.ts +5 -1
- package/dist/hooks/hook-llm.js +24 -15
- package/dist/hooks/hook-runner.d.ts +67 -57
- package/dist/hooks/hook-runner.js +260 -186
- package/dist/host-lsp-manager.d.ts +22 -8
- package/dist/host-lsp-manager.js +4 -1
- package/dist/http/active-run-conflict.d.ts +2 -43
- package/dist/http/active-run-conflict.js +3 -7
- package/dist/http/admission.d.ts +4 -18
- package/dist/http/admission.js +75 -78
- package/dist/http/approval-sweeps.d.ts +3 -3
- package/dist/http/approval-sweeps.js +54 -30
- package/dist/http/caller-trust.d.ts +8 -10
- package/dist/http/caller-trust.js +1 -2
- package/dist/http/claim-heartbeat.d.ts +49 -0
- package/dist/http/claim-heartbeat.js +46 -0
- package/dist/http/claimed-run.d.ts +4 -3
- package/dist/http/dispatch.d.ts +8 -1
- package/dist/http/dispatch.js +76 -30
- package/dist/http/durable-run-leg.d.ts +3 -3
- package/dist/http/durable-run-leg.js +17 -12
- package/dist/http/execution-context.d.ts +17 -43
- package/dist/http/execution-context.js +7 -5
- package/dist/http/health-reader.d.ts +36 -0
- package/dist/http/health-reader.js +21 -0
- package/dist/http/health-self-report.d.ts +9 -9
- package/dist/http/health-self-report.js +4 -4
- package/dist/http/idempotency.d.ts +9 -5
- package/dist/http/idempotency.js +4 -4
- package/dist/http/memory-compliance-failure-reply.d.ts +15 -16
- package/dist/http/memory-compliance-failure-reply.js +4 -2
- package/dist/http/memory-face-fault-reply.d.ts +67 -0
- package/dist/http/memory-face-fault-reply.js +71 -0
- package/dist/http/memory-store-refusal-reply.d.ts +1 -1
- package/dist/http/memory-store-refusal-reply.js +3 -0
- package/dist/http/owner-access.d.ts +391 -67
- package/dist/http/owner-access.js +371 -35
- package/dist/http/principal-gate.d.ts +24 -81
- package/dist/http/principal-gate.js +24 -68
- package/dist/http/refusal-body.d.ts +35 -2
- package/dist/http/refusal-body.js +34 -0
- package/dist/http/request-guards.d.ts +9 -13
- package/dist/http/request-guards.js +34 -68
- package/dist/http/resume-composition.d.ts +37 -0
- package/dist/http/resume-composition.js +18 -0
- package/dist/http/resume-ctx-read.d.ts +35 -12
- package/dist/http/resume-ctx-read.js +25 -6
- package/dist/http/resume-legs.d.ts +21 -18
- package/dist/http/resume-legs.js +189 -129
- package/dist/http/retired-skill-manifest.d.ts +1 -1
- package/dist/http/route-ctx.d.ts +25 -32
- package/dist/http/routes/a2a-serve.d.ts +43 -5
- package/dist/http/routes/a2a-serve.js +58 -37
- package/dist/http/routes/admin-config-refresh.js +2 -2
- package/dist/http/routes/admin-drain.js +2 -2
- package/dist/http/routes/admin-memory-optout.js +4 -3
- package/dist/http/routes/adoption.d.ts +3 -0
- package/dist/http/routes/adoption.js +17 -10
- package/dist/http/routes/agents-roster.js +13 -7
- package/dist/http/routes/approvals-assistant.js +70 -65
- package/dist/http/routes/attachments.js +2 -2
- package/dist/http/routes/background.d.ts +3 -3
- package/dist/http/routes/background.js +9 -17
- package/dist/http/routes/capabilities.js +15 -18
- package/dist/http/routes/config-catalog.js +2 -2
- package/dist/http/routes/devices.d.ts +3 -3
- package/dist/http/routes/devices.js +4 -4
- package/dist/http/routes/diagnostics.d.ts +27 -3
- package/dist/http/routes/diagnostics.js +27 -21
- package/dist/http/routes/engine.js +2 -2
- package/dist/http/routes/fleet.js +5 -3
- package/dist/http/routes/images.js +10 -6
- package/dist/http/routes/leader.d.ts +7 -2
- package/dist/http/routes/leader.js +12 -3
- package/dist/http/routes/mcp-reconnect.d.ts +1 -1
- package/dist/http/routes/mcp-reconnect.js +7 -15
- package/dist/http/routes/memory-bundle.js +4 -7
- package/dist/http/routes/memory-compliance.js +4 -4
- package/dist/http/routes/memory-consolidation.js +6 -9
- package/dist/http/routes/memory-origin.d.ts +2 -0
- package/dist/http/routes/memory-origin.js +7 -8
- package/dist/http/routes/memory-policy.js +17 -12
- package/dist/http/routes/notify-wake.js +10 -19
- package/dist/http/routes/observability.js +3 -3
- package/dist/http/routes/principal-inbox.d.ts +1 -1
- package/dist/http/routes/principal-inbox.js +2 -2
- package/dist/http/routes/projects.d.ts +1 -1
- package/dist/http/routes/projects.js +3 -2
- package/dist/http/routes/retention-ops.js +6 -9
- package/dist/http/routes/rules.js +20 -5
- package/dist/http/routes/run-memory-capture.d.ts +2 -2
- package/dist/http/routes/run-memory-capture.js +6 -12
- package/dist/http/routes/run-permission-mode.d.ts +2 -2
- package/dist/http/routes/run-permission-mode.js +10 -17
- package/dist/http/routes/runs.js +146 -231
- package/dist/http/routes/session-memory-sync.d.ts +2 -2
- package/dist/http/routes/session-memory-sync.js +7 -13
- package/dist/http/routes/session-sync.d.ts +4 -2
- package/dist/http/routes/session-sync.js +21 -20
- package/dist/http/routes/sessions-list.d.ts +3 -3
- package/dist/http/routes/sessions-list.js +9 -9
- package/dist/http/routes/sessions.js +87 -124
- package/dist/http/routes/shared-memory.js +6 -6
- package/dist/http/routes/side-query.js +2 -2
- package/dist/http/routes/tasks.js +136 -120
- package/dist/http/routes/trace-usage.d.ts +0 -12
- package/dist/http/routes/trace-usage.js +40 -46
- package/dist/http/routes/workflows.d.ts +39 -4
- package/dist/http/routes/workflows.js +42 -14
- package/dist/http/run-concurrency-cap.d.ts +20 -12
- package/dist/http/run-concurrency-cap.js +39 -26
- package/dist/http/run-read-face.d.ts +3 -5
- package/dist/http/run-read-face.js +8 -13
- package/dist/http/send.d.ts +12 -3
- package/dist/http/send.js +42 -6
- package/dist/http/server.d.ts +39 -40
- package/dist/http/server.js +36 -11
- package/dist/http/sse-log.d.ts +17 -10
- package/dist/http/sse-log.js +7 -7
- package/dist/http/stored-body-replay.d.ts +12 -0
- package/dist/http/stored-body-replay.js +2 -2
- package/dist/http/submit-ctx.d.ts +16 -8
- package/dist/http/submit-ctx.js +6 -2
- package/dist/http/submit-replay.d.ts +19 -6
- package/dist/http/submit-replay.js +18 -6
- package/dist/http/sync-submit-body.d.ts +3 -4
- package/dist/http/sync-submit-body.js +4 -5
- package/dist/http/wire-types.d.ts +4 -3
- package/dist/identity-source.d.ts +36 -5
- package/dist/identity-source.js +27 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/key-resolver.d.ts +32 -0
- package/dist/key-resolver.js +23 -9
- package/dist/leader/diffup.js +2 -1
- package/dist/leader/endpoint.d.ts +26 -5
- package/dist/leader/endpoint.js +154 -14
- package/dist/leader/fanout.d.ts +3 -0
- package/dist/leader/fanout.js +78 -63
- package/dist/leader/leader.d.ts +16 -0
- package/dist/leader/leader.js +43 -3
- package/dist/leader/merge.d.ts +9 -1
- package/dist/leader/merge.js +16 -1
- package/dist/leader/repair-wire.js +1 -1
- package/dist/leader/wire.d.ts +36 -3
- package/dist/leader/wire.js +59 -18
- package/dist/lsp-evict.d.ts +6 -4
- package/dist/lsp-evict.js +2 -3
- package/dist/memory-operator-faces.d.ts +5 -4
- package/dist/memory-operator-faces.js +1 -1
- package/dist/memory-scope.d.ts +29 -2
- package/dist/memory-scope.js +64 -15
- package/dist/memory-store-refusal.d.ts +5 -2
- package/dist/memory-sync-client.d.ts +3 -2
- package/dist/memory-sync-client.js +6 -3
- package/dist/model-compat.d.ts +17 -8
- package/dist/model-compat.js +6 -2
- package/dist/model-context-window.d.ts +18 -0
- package/dist/model-context-window.js +2 -0
- package/dist/model-entry-headers.d.ts +46 -4
- package/dist/model-entry-headers.js +2 -2
- package/dist/model-entry-refusal.d.ts +35 -16
- package/dist/model-entry-refusal.js +40 -27
- package/dist/model-plane-face.d.ts +19 -11
- package/dist/model-plane-face.js +9 -1
- package/dist/model-plane-probe.d.ts +2 -0
- package/dist/model-plane-probe.js +17 -0
- package/dist/model-provider.d.ts +3 -3
- package/dist/model-route-endpoint.d.ts +9 -5
- package/dist/model-route-endpoint.js +29 -7
- package/dist/model-select.d.ts +16 -0
- package/dist/model-select.js +4 -0
- package/dist/mountinfo.d.ts +37 -0
- package/dist/mountinfo.js +47 -0
- package/dist/namespaced-rule-name.d.ts +23 -14
- package/dist/namespaced-rule-name.js +8 -11
- package/dist/net-address.d.ts +1 -1
- package/dist/observability/corrupt-read-seat.d.ts +4 -4
- package/dist/observability/corrupt-read-seat.js +5 -3
- package/dist/observability/fail-open.d.ts +58 -38
- package/dist/observability/fail-open.js +60 -38
- package/dist/observability/logger.d.ts +22 -1
- package/dist/observability/logger.js +89 -12
- package/dist/observability/metrics.js +3 -4
- package/dist/observability/otel-exporter.js +2 -1
- package/dist/observability/principal-context.d.ts +14 -7
- package/dist/observability/principal-context.js +8 -3
- package/dist/observability/run-terminal.d.ts +7 -1
- package/dist/observability/run-terminal.js +5 -2
- package/dist/orchestration/hardened-vm-runner.d.ts +1 -0
- package/dist/orchestration/hardened-vm-runner.js +11 -5
- package/dist/orchestration/hardened-vm-worker-runner.d.ts +0 -14
- package/dist/orchestration/hardened-vm-worker-runner.js +5 -0
- package/dist/orchestration/hardened-vm-worker.js +2 -1
- package/dist/orchestration/workflow-completion-inbox.d.ts +3 -3
- package/dist/orchestration/workflow-completion-inbox.js +3 -2
- package/dist/org-delivery-gate.d.ts +5 -4
- package/dist/org-delivery-gate.js +7 -6
- package/dist/outbound-dispatcher.d.ts +1 -1
- package/dist/outbound-dispatcher.js +6 -12
- package/dist/owner-brands.d.ts +81 -0
- package/dist/owner-brands.js +42 -0
- package/dist/owner-faces.d.ts +531 -0
- package/dist/owner-faces.js +126 -0
- package/dist/parked-decide.d.ts +67 -5
- package/dist/parked-decide.js +127 -5
- package/dist/parked-revive-surface.d.ts +14 -4
- package/dist/parked-revive-surface.js +5 -4
- package/dist/peer-directory.d.ts +6 -8
- package/dist/peer-directory.js +3 -2
- package/dist/permission-rule-vocab.d.ts +53 -8
- package/dist/permission-rule-vocab.js +30 -2
- package/dist/plugins/adoption-log-sql.d.ts +0 -22
- package/dist/plugins/adoption-log-sql.js +5 -3
- package/dist/plugins/approval-ask-retired-delete-by-task-m50.d.ts +7 -0
- package/dist/plugins/approval-ask-retired-delete-by-task-m50.js +17 -0
- package/dist/plugins/approval-ask-store-file.d.ts +18 -7
- package/dist/plugins/approval-ask-store-file.js +37 -14
- package/dist/plugins/approval-ask-store-memory.d.ts +12 -4
- package/dist/plugins/approval-ask-store-memory.js +24 -10
- package/dist/plugins/approval-ask-store-sql.d.ts +39 -20
- package/dist/plugins/approval-ask-store-sql.js +41 -10
- package/dist/plugins/approval-exemption-skill-m46.d.ts +20 -0
- package/dist/plugins/approval-exemption-skill-m46.js +25 -0
- package/dist/plugins/approval-exemption-store.d.ts +6 -1
- package/dist/plugins/approval-exemption-store.js +14 -0
- package/dist/plugins/approval-nonce-store.d.ts +39 -12
- package/dist/plugins/approval-nonce-store.js +72 -23
- package/dist/plugins/blob-backend.d.ts +2 -0
- package/dist/plugins/blob-backend.js +9 -6
- package/dist/plugins/caching-session-store.d.ts +13 -1
- package/dist/plugins/caching-session-store.js +43 -4
- package/dist/plugins/checkpoint-index-columns.d.ts +32 -5
- package/dist/plugins/checkpoint-index-columns.js +36 -1
- package/dist/plugins/checkpoint-store-face.d.ts +83 -10
- package/dist/plugins/checkpoint-store-face.js +18 -1
- package/dist/plugins/device-store-sql.js +1 -0
- package/dist/plugins/ensure-index.d.ts +13 -1
- package/dist/plugins/ensure-index.js +154 -21
- package/dist/plugins/ensure-schema-lock-policy.d.ts +0 -15
- package/dist/plugins/ensure-schema-lock-policy.js +3 -2
- package/dist/plugins/file-run-store.d.ts +63 -23
- package/dist/plugins/file-run-store.js +138 -83
- package/dist/plugins/host-platform.d.ts +24 -3
- package/dist/plugins/host-platform.js +15 -1
- package/dist/plugins/image-bake-store-sql.js +2 -0
- package/dist/plugins/imported-layer-root-retirement.d.ts +2 -2
- package/dist/plugins/k8s-pod-reaper.d.ts +1 -3
- package/dist/plugins/k8s-pod-reaper.js +0 -1
- package/dist/plugins/leader-run-store-sql.d.ts +22 -0
- package/dist/plugins/leader-run-store-sql.js +34 -4
- package/dist/plugins/local-checkpoint-store.d.ts +58 -23
- package/dist/plugins/local-checkpoint-store.js +195 -76
- package/dist/plugins/local-data-dir-modes-m39.js +2 -1
- package/dist/plugins/local-docker-capacity.d.ts +93 -0
- package/dist/plugins/local-docker-capacity.js +194 -0
- package/dist/plugins/local-docker-reaper.d.ts +92 -0
- package/dist/plugins/local-docker-reaper.js +102 -0
- package/dist/plugins/local-engine-high-water.d.ts +4 -2
- package/dist/plugins/local-engine-high-water.js +4 -1
- package/dist/plugins/local-session-store.d.ts +358 -125
- package/dist/plugins/local-session-store.js +824 -251
- package/dist/plugins/local-session-window.d.ts +3 -2
- package/dist/plugins/local-session-window.js +3 -2
- package/dist/plugins/local-sidecar-quarantine.js +3 -2
- package/dist/plugins/local-task-attachment-store.d.ts +18 -1
- package/dist/plugins/local-task-attachment-store.js +22 -1
- package/dist/plugins/memory-embedder.js +9 -7
- package/dist/plugins/memory-engine-pg.d.ts +3 -2
- package/dist/plugins/memory-engine-pg.js +14 -5
- package/dist/plugins/memory-engine-sql-apply.d.ts +8 -4
- package/dist/plugins/memory-engine-sql-apply.js +6 -8
- package/dist/plugins/memory-engine-tidb.d.ts +4 -2
- package/dist/plugins/memory-engine-tidb.js +11 -2
- package/dist/plugins/memory-optout-grant-store-sql.d.ts +1 -1
- package/dist/plugins/memory-optout-grant-store-sql.js +3 -3
- package/dist/plugins/memory-run-store.d.ts +39 -27
- package/dist/plugins/memory-run-store.js +72 -70
- package/dist/plugins/one-time-migration-marker.d.ts +10 -0
- package/dist/plugins/one-time-migration-marker.js +7 -0
- package/dist/plugins/one-time-migrations.d.ts +186 -45
- package/dist/plugins/one-time-migrations.js +442 -119
- package/dist/plugins/org-delivery-quota-store.js +2 -1
- package/dist/plugins/permission-rule-store-file.d.ts +3 -3
- package/dist/plugins/permission-rule-store-sql.d.ts +4 -63
- package/dist/plugins/permission-rule-store-sql.js +6 -86
- package/dist/plugins/pg-pool.d.ts +1 -31
- package/dist/plugins/pg-pool.js +16 -7
- package/dist/plugins/remote-env-e2b.d.ts +7 -25
- package/dist/plugins/remote-env-e2b.js +34 -25
- package/dist/plugins/remote-env-host.d.ts +2 -9
- package/dist/plugins/remote-env-host.js +34 -22
- package/dist/plugins/remote-env-k8s.d.ts +40 -45
- package/dist/plugins/remote-env-k8s.js +107 -58
- package/dist/plugins/remote-env-local-docker.d.ts +148 -14
- package/dist/plugins/remote-env-local-docker.js +367 -72
- package/dist/plugins/remote-scratchpad.js +4 -0
- package/dist/plugins/retention-deployment.d.ts +49 -17
- package/dist/plugins/retention-deployment.js +39 -8
- package/dist/plugins/run-preview-m45.d.ts +11 -0
- package/dist/plugins/run-preview-m45.js +19 -0
- package/dist/plugins/run-store-sql.d.ts +56 -68
- package/dist/plugins/run-store-sql.js +127 -116
- package/dist/plugins/s3-answer.d.ts +2 -1
- package/dist/plugins/sandbox-reaper.d.ts +26 -0
- package/dist/plugins/sandbox-reaper.js +2 -0
- package/dist/plugins/scenario-prefix-switch-m42.d.ts +54 -0
- package/dist/plugins/scenario-prefix-switch-m42.js +55 -0
- package/dist/plugins/scheduler-support.d.ts +16 -1
- package/dist/plugins/scheduler-support.js +22 -2
- package/dist/plugins/schema-consistency.d.ts +42 -9
- package/dist/plugins/schema-consistency.js +212 -11
- package/dist/plugins/schema-drift-sentence.d.ts +4 -1
- package/dist/plugins/schema-drift-sentence.js +4 -4
- package/dist/plugins/schema-ensure-legs.d.ts +9 -0
- package/dist/plugins/schema-ensure-legs.js +1 -1
- package/dist/plugins/schema-indexes.js +3 -0
- package/dist/plugins/schema-live-columns.d.ts +14 -5
- package/dist/plugins/schema-live-columns.js +10 -10
- package/dist/plugins/send-user-file.js +2 -1
- package/dist/plugins/session-birth.d.ts +37 -0
- package/dist/plugins/session-birth.js +38 -0
- package/dist/plugins/session-epoch-anchor.d.ts +40 -12
- package/dist/plugins/session-epoch-anchor.js +33 -11
- package/dist/plugins/session-ext-table.d.ts +27 -3
- package/dist/plugins/session-ext-table.js +19 -6
- package/dist/plugins/session-fork.d.ts +15 -1
- package/dist/plugins/session-fork.js +3 -0
- package/dist/plugins/session-ownership.d.ts +1 -1
- package/dist/plugins/session-placement.d.ts +22 -16
- package/dist/plugins/session-placement.js +15 -12
- package/dist/plugins/session-row-sql.d.ts +12 -0
- package/dist/plugins/session-row-sql.js +3 -3
- package/dist/plugins/session-run-rollup.d.ts +29 -0
- package/dist/plugins/session-run-rollup.js +40 -0
- package/dist/plugins/session-store-sql.d.ts +38 -12
- package/dist/plugins/session-store-sql.js +130 -30
- package/dist/plugins/session-withdraw-sql.d.ts +36 -0
- package/dist/plugins/session-withdraw-sql.js +42 -0
- package/dist/plugins/shared-memory-store-sql.d.ts +0 -69
- package/dist/plugins/shared-memory-store-sql.js +2 -1
- package/dist/plugins/shell-sentinel-owner-m48.d.ts +20 -0
- package/dist/plugins/shell-sentinel-owner-m48.js +3 -0
- package/dist/plugins/snapshot-bucket-presence.d.ts +2 -1
- package/dist/plugins/sql-driver.d.ts +1 -1
- package/dist/plugins/sql-driver.js +2 -1
- package/dist/plugins/sql-errors.d.ts +32 -5
- package/dist/plugins/sql-errors.js +55 -7
- package/dist/plugins/sql-json-column.d.ts +8 -7
- package/dist/plugins/sql-json-column.js +10 -6
- package/dist/plugins/store-backend.d.ts +84 -15
- package/dist/plugins/store-backend.js +186 -55
- package/dist/plugins/store-contracts.d.ts +90 -30
- package/dist/plugins/store-contracts.js +22 -1
- package/dist/plugins/store-fault.d.ts +28 -2
- package/dist/plugins/store-fault.js +20 -2
- package/dist/plugins/task-attachment-store.d.ts +15 -3
- package/dist/plugins/task-attachment-store.js +22 -9
- package/dist/plugins/tidb-pool.js +23 -8
- package/dist/plugins/web-search.js +5 -3
- package/dist/plugins/workflow-run-store-sql.d.ts +6 -1
- package/dist/plugins/workflow-run-store-sql.js +11 -5
- package/dist/principal-jwt.d.ts +4 -4
- package/dist/principal-jwt.js +20 -5
- package/dist/principal-shape.d.ts +41 -0
- package/dist/principal-shape.js +19 -0
- package/dist/question.d.ts +13 -23
- package/dist/question.js +21 -39
- package/dist/request-declaration-refusal.d.ts +35 -12
- package/dist/request-declaration-refusal.js +21 -9
- package/dist/request-form.d.ts +58 -0
- package/dist/request-form.js +72 -0
- package/dist/request-image-urls.d.ts +8 -2
- package/dist/request-image-urls.js +2 -1
- package/dist/request-images.d.ts +20 -0
- package/dist/request-images.js +59 -0
- package/dist/request-key-closure.d.ts +6 -7
- package/dist/request-key-closure.js +15 -2
- package/dist/resource-suspend.d.ts +7 -16
- package/dist/resource-suspend.js +1 -1
- package/dist/retired-name-host-notice.d.ts +21 -0
- package/dist/retired-name-host-notice.js +12 -0
- package/dist/rule-entry-list.d.ts +2 -2
- package/dist/rule-entry-list.js +3 -4
- package/dist/rule-issue-reading.d.ts +58 -0
- package/dist/rule-issue-reading.js +14 -0
- package/dist/rules-consent.d.ts +5 -3
- package/dist/rules-consent.js +1 -0
- package/dist/run-acceptance.d.ts +3 -1
- package/dist/run-acceptance.js +3 -0
- package/dist/run-local.d.ts +14 -6
- package/dist/run-local.js +92 -80
- package/dist/run-stale-default.d.ts +7 -0
- package/dist/run-stale-default.js +2 -0
- package/dist/runs.d.ts +26 -15
- package/dist/runs.js +39 -27
- package/dist/runtime-caps-resolver.d.ts +21 -6
- package/dist/runtime-caps-resolver.js +17 -4
- package/dist/runtime-governance.d.ts +2 -2
- package/dist/runtime-governance.js +5 -3
- package/dist/sealed-key-layout.d.ts +12 -5
- package/dist/sealed-key-layout.js +5 -0
- package/dist/sealed-key.d.ts +12 -2
- package/dist/sealed-key.js +115 -27
- package/dist/security.d.ts +128 -158
- package/dist/security.js +163 -59
- package/dist/sema-config-dir.d.ts +20 -0
- package/dist/sema-config-dir.js +25 -0
- package/dist/server-secret-env.d.ts +21 -5
- package/dist/server-secret-env.js +14 -4
- package/dist/session-children-retire.d.ts +7 -5
- package/dist/session-children-retire.js +7 -2
- package/dist/session-deletion.d.ts +88 -0
- package/dist/session-deletion.js +8 -0
- package/dist/session-erase.d.ts +145 -0
- package/dist/session-erase.js +115 -0
- package/dist/session-error-wire.d.ts +5 -5
- package/dist/session-error-wire.js +1 -1
- package/dist/session-incarnation.d.ts +52 -5
- package/dist/session-incarnation.js +19 -2
- package/dist/session-policy-wire.d.ts +6 -3
- package/dist/session-policy-wire.js +11 -1
- package/dist/session-resident-background.d.ts +0 -71
- package/dist/session-resident-background.js +4 -3
- package/dist/session-row.d.ts +2 -1
- package/dist/session-rules-seat.d.ts +12 -0
- package/dist/session-rules-seat.js +19 -0
- package/dist/session-titler.d.ts +7 -15
- package/dist/session-titler.js +1 -1
- package/dist/spec-fields.d.ts +57 -3
- package/dist/spec-fields.js +72 -51
- package/dist/store-posture.d.ts +136 -20
- package/dist/store-posture.js +188 -3
- package/dist/stored-request-hooks-m20.js +2 -2
- package/dist/stores-sql/background-agent-store-sql.d.ts +11 -2
- package/dist/stores-sql/background-agent-store-sql.js +73 -20
- package/dist/stores-sql/checkpoint-store-sql.d.ts +33 -28
- package/dist/stores-sql/checkpoint-store-sql.js +75 -44
- package/dist/stores-sql/mailbox-store-sql.d.ts +7 -4
- package/dist/stores-sql/mailbox-store-sql.js +31 -32
- package/dist/stores-sql/pg-session-storage.d.ts +7 -5
- package/dist/stores-sql/pg-session-storage.js +54 -46
- package/dist/stores-sql/retention-store-sql.d.ts +87 -19
- package/dist/stores-sql/retention-store-sql.js +92 -27
- package/dist/stores-sql/session-policy-store-sql.d.ts +32 -10
- package/dist/stores-sql/session-policy-store-sql.js +44 -36
- package/dist/stores-sql/session-write-hooks.d.ts +12 -6
- package/dist/stores-sql/tidb-session-storage.d.ts +4 -4
- package/dist/stores-sql/tidb-session-storage.js +13 -8
- package/dist/stores-sql/tidb-session-store.d.ts +36 -17
- package/dist/stores-sql/tidb-session-store.js +69 -39
- package/dist/stores-sql/windowed-session-storage.d.ts +5 -0
- package/dist/stores-sql/windowed-session-storage.js +9 -0
- package/dist/submission-exit.d.ts +50 -0
- package/dist/submission-exit.js +108 -0
- package/dist/task-a2a.d.ts +1 -1
- package/dist/task-a2a.js +3 -3
- package/dist/task-cwd.d.ts +20 -0
- package/dist/task-cwd.js +8 -0
- package/dist/task-mcp.d.ts +1 -1
- package/dist/task-mcp.js +3 -3
- package/dist/task-settings.d.ts +14 -10
- package/dist/task-settings.js +18 -7
- package/dist/terminal.d.ts +25 -43
- package/dist/terminal.js +31 -11
- package/dist/tool-approval.d.ts +131 -129
- package/dist/tool-approval.js +189 -193
- package/dist/trace/core-keyset-guard.d.ts +13 -6
- package/dist/trace/core-vocab-wire.d.ts +95 -0
- package/dist/trace/core-vocab-wire.js +15 -0
- package/dist/trace/exit-seat.d.ts +30 -4
- package/dist/trace/exit-seat.js +40 -36
- package/dist/trace/extension-call-face.d.ts +3 -2
- package/dist/trace/extension-call-face.js +3 -1
- package/dist/trace/ledger-events.d.ts +4 -7
- package/dist/trace/ledger-sink.d.ts +1 -30
- package/dist/trace/ledger-sink.js +0 -11
- package/dist/trace/model-segment.d.ts +5 -5
- package/dist/trace/model-segment.js +5 -5
- package/dist/trace/project.d.ts +55 -42
- package/dist/trace/project.js +52 -19
- package/dist/trace/redact.d.ts +123 -27
- package/dist/trace/redact.js +880 -260
- package/dist/trace/self-minted-wire.d.ts +487 -19
- package/dist/trace/self-minted-wire.js +172 -23
- package/dist/trace/wire-projection-faces.d.ts +5 -6
- package/dist/trace/wire-projection-faces.js +2 -2
- package/dist/upstream-body.d.ts +23 -0
- package/dist/upstream-body.js +16 -0
- package/dist/url-refusal.d.ts +3 -3
- package/dist/url-refusal.js +11 -4
- package/dist/user-authored-text.d.ts +1 -1
- package/dist/user-input-ledger.d.ts +7 -8
- package/dist/user-input-ledger.js +1 -1
- package/dist/web-admin-client/apply-effective.d.ts +6 -3
- package/dist/web-admin-client/apply-effective.js +13 -16
- package/dist/web-admin-client/apply-ledger.d.ts +16 -7
- package/dist/web-admin-client/apply-ledger.js +5 -2
- package/dist/web-admin-client/center-request.d.ts +2 -2
- package/dist/web-admin-client/center-request.js +15 -15
- package/dist/web-admin-client/effective-keys.d.ts +1 -1
- package/dist/web-admin-client/effective-keys.js +1 -1
- package/dist/web-admin-client/entry-metadata.d.ts +8 -0
- package/dist/web-admin-client/entry-metadata.js +13 -0
- package/dist/web-admin-client/http-client.d.ts +1 -1
- package/dist/web-admin-client/http-client.js +23 -4
- package/dist/web-admin-client/mcp-revocation.d.ts +1 -1
- package/dist/web-admin-client/mcp-revocation.js +2 -1
- package/dist/web-admin-client/read-warnings.d.ts +1 -0
- package/dist/web-admin-client/read-warnings.js +1 -0
- package/dist/web-admin-client/restart-signal.js +8 -4
- package/dist/web-admin-client/skills-mcp.d.ts +2 -2
- package/dist/web-admin-client/types.d.ts +1 -2
- package/dist/workspace-space.d.ts +3 -2
- package/docs/DEVICE-EXECUTOR-PROTOCOL.md +4 -4
- package/package.json +6 -3
- package/scripts/drain-check-local.mjs +118 -147
- package/scripts/drain-check.mysql.sql +22 -2
- package/scripts/drain-check.pg.sql +22 -2
- package/wire-changes/server@7.148.0.json +1517 -0
- package/dist/http/memory-control-plane-corrupt-reply.d.ts +0 -25
- package/dist/http/memory-control-plane-corrupt-reply.js +0 -19
- package/dist/http/memory-layer-reply.d.ts +0 -30
- package/dist/http/memory-layer-reply.js +0 -24
- package/dist/lsp/e2b-bridge.d.ts +0 -57
- package/dist/lsp/e2b-bridge.js +0 -139
- package/dist/lsp/e2b-manager.d.ts +0 -93
- package/dist/lsp/e2b-manager.js +0 -178
- package/dist/lsp/lsp-frames.d.ts +0 -14
- package/dist/lsp/lsp-frames.js +0 -25
- package/dist/lsp/manager.d.ts +0 -129
- package/dist/lsp/manager.js +0 -127
- package/dist/lsp/types.d.ts +0 -12
- package/dist/lsp/types.js +0 -2
- package/dist/lsp/ws-transport.d.ts +0 -40
- package/dist/lsp/ws-transport.js +0 -210
|
@@ -27,6 +27,7 @@ export declare function createRepoClient(kind: GitApiKind, baseUrl: string, toke
|
|
|
27
27
|
export declare class GiteaClient implements RepoReadClient {
|
|
28
28
|
private readonly baseUrl;
|
|
29
29
|
private readonly token?;
|
|
30
|
+
/** 出站出口:Git host 回重定向 ⇒ 拒(`token` 凭据头只去被判过的那个根),不是静默跟随。 */
|
|
30
31
|
private readonly fetchImpl;
|
|
31
32
|
constructor(baseUrl: string, token?: string | undefined, fetchImpl?: typeof fetch);
|
|
32
33
|
private api;
|
|
@@ -51,6 +52,7 @@ export declare class GiteaClient implements RepoReadClient {
|
|
|
51
52
|
export declare class GitHubClient implements RepoReadClient {
|
|
52
53
|
private readonly baseUrl;
|
|
53
54
|
private readonly token?;
|
|
55
|
+
/** 出站出口:Git host 回重定向 ⇒ 拒(Bearer 凭据只去被判过的那个根),不是静默跟随。 */
|
|
54
56
|
private readonly fetchImpl;
|
|
55
57
|
constructor(baseUrl: string, token?: string | undefined, fetchImpl?: typeof fetch);
|
|
56
58
|
private api;
|
|
@@ -13,6 +13,8 @@ export function parseRepo(input) {
|
|
|
13
13
|
const MAX_FILE_BYTES = 96 * 1024;
|
|
14
14
|
const MAX_TREE_ENTRIES = 2000;
|
|
15
15
|
const REQUEST_TIMEOUT_MS = 15_000;
|
|
16
|
+
import { createEgressFetch } from "../egress-redirect.js";
|
|
17
|
+
import { readUpstreamJson } from "../upstream-body.js";
|
|
16
18
|
export { GIT_API_KINDS, isGitApiKind } from "../git-api-kind.js";
|
|
17
19
|
const RepoInfoWire = z.looseObject({ default_branch: z.string().optional() });
|
|
18
20
|
const TreeWire = z.looseObject({
|
|
@@ -32,7 +34,7 @@ function pathSegmentsRejectingTraversal(path) {
|
|
|
32
34
|
}
|
|
33
35
|
return segments;
|
|
34
36
|
}
|
|
35
|
-
export function createRepoClient(kind, baseUrl, token, fetchImpl
|
|
37
|
+
export function createRepoClient(kind, baseUrl, token, fetchImpl) {
|
|
36
38
|
switch (kind) {
|
|
37
39
|
case "gitea":
|
|
38
40
|
return new GiteaClient(baseUrl, token, fetchImpl);
|
|
@@ -48,10 +50,10 @@ export class GiteaClient {
|
|
|
48
50
|
baseUrl;
|
|
49
51
|
token;
|
|
50
52
|
fetchImpl;
|
|
51
|
-
constructor(baseUrl, token, fetchImpl
|
|
53
|
+
constructor(baseUrl, token, fetchImpl) {
|
|
52
54
|
this.baseUrl = baseUrl;
|
|
53
55
|
this.token = token;
|
|
54
|
-
this.fetchImpl = fetchImpl;
|
|
56
|
+
this.fetchImpl = createEgressFetch("declare the final address as GIT_API_BASEURL", fetchImpl);
|
|
55
57
|
}
|
|
56
58
|
async api(path, accept = "application/json") {
|
|
57
59
|
const headers = { accept };
|
|
@@ -66,12 +68,12 @@ export class GiteaClient {
|
|
|
66
68
|
return res;
|
|
67
69
|
}
|
|
68
70
|
async defaultBranch({ owner, repo }) {
|
|
69
|
-
const info = RepoInfoWire.parse(await (await this.api(`/repos/${owner}/${repo}`))
|
|
71
|
+
const info = RepoInfoWire.parse(await readUpstreamJson(await this.api(`/repos/${owner}/${repo}`)));
|
|
70
72
|
return info.default_branch || "main";
|
|
71
73
|
}
|
|
72
74
|
async tree(coords, ref) {
|
|
73
75
|
const { owner, repo } = coords;
|
|
74
|
-
const body = TreeWire.parse(await (await this.api(`/repos/${owner}/${repo}/git/trees/${encodeURIComponent(ref)}?recursive=true&per_page=${MAX_TREE_ENTRIES}`))
|
|
76
|
+
const body = TreeWire.parse(await readUpstreamJson(await this.api(`/repos/${owner}/${repo}/git/trees/${encodeURIComponent(ref)}?recursive=true&per_page=${MAX_TREE_ENTRIES}`)));
|
|
75
77
|
const paths = (body.tree ?? []).filter((e) => e.type === "blob").map((e) => e.path);
|
|
76
78
|
return body.truncated
|
|
77
79
|
? [...paths, `…[truncated, tree has more than ${MAX_TREE_ENTRIES} entries]`]
|
|
@@ -80,7 +82,7 @@ export class GiteaClient {
|
|
|
80
82
|
async readFile(coords, path, ref) {
|
|
81
83
|
const { owner, repo } = coords;
|
|
82
84
|
const segments = pathSegmentsRejectingTraversal(path);
|
|
83
|
-
const body = ContentsWire.parse(await (await this.api(`/repos/${owner}/${repo}/contents/${segments.map(encodeURIComponent).join("/")}?ref=${encodeURIComponent(ref)}`))
|
|
85
|
+
const body = ContentsWire.parse(await readUpstreamJson(await this.api(`/repos/${owner}/${repo}/contents/${segments.map(encodeURIComponent).join("/")}?ref=${encodeURIComponent(ref)}`)));
|
|
84
86
|
if (body.type !== "file" || body.content == null)
|
|
85
87
|
throw new Error(`not a file: ${path}`);
|
|
86
88
|
const text = body.encoding === "base64" ? Buffer.from(body.content, "base64").toString("utf8") : body.content;
|
|
@@ -99,10 +101,10 @@ export class GitHubClient {
|
|
|
99
101
|
baseUrl;
|
|
100
102
|
token;
|
|
101
103
|
fetchImpl;
|
|
102
|
-
constructor(baseUrl, token, fetchImpl
|
|
104
|
+
constructor(baseUrl, token, fetchImpl) {
|
|
103
105
|
this.baseUrl = baseUrl;
|
|
104
106
|
this.token = token;
|
|
105
|
-
this.fetchImpl = fetchImpl;
|
|
107
|
+
this.fetchImpl = createEgressFetch("declare the final address as GIT_API_BASEURL", fetchImpl);
|
|
106
108
|
}
|
|
107
109
|
async api(path, accept = "application/vnd.github+json") {
|
|
108
110
|
const headers = { accept, "x-github-api-version": "2022-11-28" };
|
|
@@ -117,12 +119,12 @@ export class GitHubClient {
|
|
|
117
119
|
return res;
|
|
118
120
|
}
|
|
119
121
|
async defaultBranch({ owner, repo }) {
|
|
120
|
-
const info = RepoInfoWire.parse(await (await this.api(`/repos/${owner}/${repo}`))
|
|
122
|
+
const info = RepoInfoWire.parse(await readUpstreamJson(await this.api(`/repos/${owner}/${repo}`)));
|
|
121
123
|
return info.default_branch || "main";
|
|
122
124
|
}
|
|
123
125
|
async tree(coords, ref) {
|
|
124
126
|
const { owner, repo } = coords;
|
|
125
|
-
const body = TreeWire.parse(await (await this.api(`/repos/${owner}/${repo}/git/trees/${encodeURIComponent(ref)}?recursive=1`))
|
|
127
|
+
const body = TreeWire.parse(await readUpstreamJson(await this.api(`/repos/${owner}/${repo}/git/trees/${encodeURIComponent(ref)}?recursive=1`)));
|
|
126
128
|
const paths = (body.tree ?? []).filter((e) => e.type === "blob").map((e) => e.path);
|
|
127
129
|
if (paths.length > MAX_TREE_ENTRIES) {
|
|
128
130
|
return [...paths.slice(0, MAX_TREE_ENTRIES), `…[truncated, tree has more than ${MAX_TREE_ENTRIES} entries]`];
|
|
@@ -134,7 +136,7 @@ export class GitHubClient {
|
|
|
134
136
|
async readFile(coords, path, ref) {
|
|
135
137
|
const { owner, repo } = coords;
|
|
136
138
|
const segments = pathSegmentsRejectingTraversal(path);
|
|
137
|
-
const body = ContentsWire.parse(await (await this.api(`/repos/${owner}/${repo}/contents/${segments.map(encodeURIComponent).join("/")}?ref=${encodeURIComponent(ref)}`))
|
|
139
|
+
const body = ContentsWire.parse(await readUpstreamJson(await this.api(`/repos/${owner}/${repo}/contents/${segments.map(encodeURIComponent).join("/")}?ref=${encodeURIComponent(ref)}`)));
|
|
138
140
|
if (body.type !== "file" || body.content == null)
|
|
139
141
|
throw new Error(`not a file: ${path}`);
|
|
140
142
|
if (body.encoding === "none") {
|
|
@@ -147,7 +149,7 @@ export class GitHubClient {
|
|
|
147
149
|
}
|
|
148
150
|
async pullDiff(coords, index) {
|
|
149
151
|
const { owner, repo } = coords;
|
|
150
|
-
const meta = PullMetaWire.parse(await (await this.api(`/repos/${owner}/${repo}/pulls/${index}`))
|
|
152
|
+
const meta = PullMetaWire.parse(await readUpstreamJson(await this.api(`/repos/${owner}/${repo}/pulls/${index}`)));
|
|
151
153
|
const res = await this.api(`/repos/${owner}/${repo}/pulls/${index}`, "application/vnd.github.v3.diff");
|
|
152
154
|
let text = await res.text();
|
|
153
155
|
const filesInDiff = (text.match(/^diff --git /gm) ?? []).length;
|
|
@@ -260,18 +260,6 @@ export declare const BUILTIN_SCENARIO_HANDS: {
|
|
|
260
260
|
readonly scan: "none";
|
|
261
261
|
readonly cowork: "full";
|
|
262
262
|
};
|
|
263
|
-
/**
|
|
264
|
-
* [ref]:内建场景的**技能范围**(技能 `scenarios` 标签按哪个名字匹配)—— **全仓唯一声明处**:各场景工厂交进 `TaskSpec` 的技能与场景卡上的技能清单都按这张表取范围,
|
|
265
|
-
* 再过同一只过滤(`skills.ts` 的 `skillsInScope`),两边因此恒为同一组技能。按 {@link BuiltinScenarioName} 键控 ⇒ 加 / 删一个内建场景而这里没跟 = 编译红。
|
|
266
|
-
* `code` 的范围是 `default`:它与 default 共用一只工厂(工具 / 技能面恒等由构造保证),打了 `scenarios: code` 的技能不进 code 的 run。center 场景的范围是它自己的名字。
|
|
267
|
-
*/
|
|
268
|
-
export declare const BUILTIN_SCENARIO_SKILL_SCOPE: {
|
|
269
|
-
readonly code: "default";
|
|
270
|
-
readonly default: "default";
|
|
271
|
-
readonly "code-review": "code-review";
|
|
272
|
-
readonly scan: "scan";
|
|
273
|
-
readonly cowork: "cowork";
|
|
274
|
-
};
|
|
275
263
|
/**
|
|
276
264
|
* `branded` = 这台部署是不是品牌部署 —— 部署座挂品牌行读的同一只判官(`brand-identity.ts` `isBrandedDeployment`)交进来;没有默认值:每个调用点说出这件事实。
|
|
277
265
|
* 品牌部署上,品牌行 `when.binding` 那张表里的场景(`BRAND_IDENTITY_SCENARIOS`)的 `promptSummary` 点名 Sema 产品身份 —— 读面说的就是模型收到的。
|
|
@@ -309,7 +297,6 @@ export type ScenarioAvailability = {
|
|
|
309
297
|
export declare function scenarioAvailability(deps: Pick<ScenarioDeps, "repoClient">, toolset: string): ScenarioAvailability;
|
|
310
298
|
/** 拒绝文案的唯一属主:闭集穷举 switch(新增原因词不在这里表态即编译红)。 */
|
|
311
299
|
export declare function scenarioUnavailableMessage(reason: ScenarioUnavailableReason, scenarioLabel: string): string;
|
|
312
|
-
export declare const SCENARIO_NAME_RE: RegExp;
|
|
313
300
|
/**
|
|
314
301
|
* Build the center-declared scenario overlay. Invalid specs are SKIPPED with a warning (never fail
|
|
315
302
|
* boot — same posture as skills/teams); valid ones become scenarios keyed by name, ready to be merged
|
|
@@ -423,9 +410,13 @@ export interface ScenarioGateSources {
|
|
|
423
410
|
} | undefined;
|
|
424
411
|
readonly logger?: Logger;
|
|
425
412
|
}
|
|
426
|
-
export
|
|
413
|
+
export interface ScenarioGate {
|
|
414
|
+
(principal: string | undefined, requested: unknown): Promise<string>;
|
|
415
|
+
/** 在册词表 —— 门判「在不在册」读的**同一张**场景表的自有键(活读,不抄快照)。请求的场景头在分派层判在册读它(读面没有体,不过整只门)。 */
|
|
416
|
+
readonly known: () => readonly string[];
|
|
417
|
+
}
|
|
427
418
|
/**
|
|
428
|
-
* 门问中心裁定走哪条腿(闭集;新增一词 ⇒ 下面的穷尽 `switch` 编译红)—— 与 `resolveRuntimeCaps` / `
|
|
419
|
+
* 门问中心裁定走哪条腿(闭集;新增一词 ⇒ 下面的穷尽 `switch` 编译红)—— 与 `resolveRuntimeCaps` / `peekRuntimeCapsReading` 是同一对:
|
|
429
420
|
* · `enforce` —— 任务提交腿:中心裁定走执法腿,center 硬失败铸下的 fail-closed 降级项两腿都认;
|
|
430
421
|
* · `peek` —— 读面(`GET /v1/capabilities/mcp` 状态面、`GET /v1/sessions/:id/mcp` / `…/a2a` 两张会话面板):只读腿,同一只缓存 / 同一条抓取 / 同一份读数(中心答不出 ⇒ 读面同拒),但硬失败铸的降级项只对读面自己算数,
|
|
431
422
|
* 不替这个主体的真提交留下 `{allowWorkflows:false, allowFork:false, autoMode:false}` 的短窗 deny(读面不许成为别人被拒的原因)。
|
|
@@ -7,6 +7,7 @@ import { createWebSearchBackend, judgeRequestWebSearch } from "../plugins/web-se
|
|
|
7
7
|
import { scenarioSkillEntries, skillsForScenario } from "./skills.js";
|
|
8
8
|
import { OFFICE_EXCLUDED_TOOL_NAMES, runHasWorkspace } from "./hands-lane.js";
|
|
9
9
|
import { BRAND_IDENTITY_SCENARIOS } from "./brand-identity.js";
|
|
10
|
+
import { SCENARIO_NAME_RE } from "../owner-brands.js";
|
|
10
11
|
export function buildPromptSeats(scenarioName, prompt, callerSystemPrompt) {
|
|
11
12
|
const parts = [prompt?.roleText, callerSystemPrompt].filter((t) => typeof t === "string" && t.length > 0);
|
|
12
13
|
const systemPrompt = parts.length > 0 ? parts.join("\n\n") : callerSystemPrompt;
|
|
@@ -69,7 +70,7 @@ export function buildScenarios(deps) {
|
|
|
69
70
|
}).filter((t) => t.name !== WEB_FETCH_TOOL_NAME || deps.requirePrincipal !== true),
|
|
70
71
|
],
|
|
71
72
|
hands: BUILTIN_SCENARIO_HANDS.default,
|
|
72
|
-
skills: skillsForScenario(deps.skills,
|
|
73
|
+
skills: skillsForScenario(deps.skills, "default"),
|
|
73
74
|
};
|
|
74
75
|
};
|
|
75
76
|
return {
|
|
@@ -77,7 +78,7 @@ export function buildScenarios(deps) {
|
|
|
77
78
|
code: (req, principal, ctx) => ({
|
|
78
79
|
...defaultScenario(req, principal, ctx),
|
|
79
80
|
hands: BUILTIN_SCENARIO_HANDS.code,
|
|
80
|
-
skills: skillsForScenario(deps.skills,
|
|
81
|
+
skills: skillsForScenario(deps.skills, "code"),
|
|
81
82
|
prompt: { role: "code" },
|
|
82
83
|
}),
|
|
83
84
|
"code-review": (req) => codeReview(deps, req),
|
|
@@ -89,13 +90,13 @@ export function buildScenarios(deps) {
|
|
|
89
90
|
return {
|
|
90
91
|
tools: [...repoToolsFor(repoClient, parseRepo(req.repo)), nowTool()],
|
|
91
92
|
hands: BUILTIN_SCENARIO_HANDS.scan,
|
|
92
|
-
skills: skillsForScenario(deps.skills,
|
|
93
|
+
skills: skillsForScenario(deps.skills, "scan"),
|
|
93
94
|
};
|
|
94
95
|
},
|
|
95
96
|
cowork: (req, principal, ctx) => ({
|
|
96
97
|
...defaultScenario(req, principal, ctx),
|
|
97
98
|
hands: BUILTIN_SCENARIO_HANDS.cowork,
|
|
98
|
-
skills: skillsForScenario(deps.skills,
|
|
99
|
+
skills: skillsForScenario(deps.skills, "cowork"),
|
|
99
100
|
excludeTools: OFFICE_EXCLUDED_TOOL_NAMES,
|
|
100
101
|
prompt: { role: "cowork" },
|
|
101
102
|
}),
|
|
@@ -125,13 +126,6 @@ export const BUILTIN_SCENARIO_HANDS = {
|
|
|
125
126
|
scan: "none",
|
|
126
127
|
cowork: "full",
|
|
127
128
|
};
|
|
128
|
-
export const BUILTIN_SCENARIO_SKILL_SCOPE = {
|
|
129
|
-
code: "default",
|
|
130
|
-
default: "default",
|
|
131
|
-
"code-review": "code-review",
|
|
132
|
-
scan: "scan",
|
|
133
|
-
cowork: "cowork",
|
|
134
|
-
};
|
|
135
129
|
export function builtinScenarioDetails(scenarios, deps, branded) {
|
|
136
130
|
const probe = (name, req, principal, fallback) => {
|
|
137
131
|
try {
|
|
@@ -146,7 +140,7 @@ export function builtinScenarioDetails(scenarios, deps, branded) {
|
|
|
146
140
|
name, source: "builtin", builtin: true, summary, toolset, tools, promptSummary, enabled: true,
|
|
147
141
|
...availabilityFields(deps, toolset),
|
|
148
142
|
attachmentSupplies: attachmentSuppliesFor(BUILTIN_SCENARIO_HANDS[name], deps.handsLane === true),
|
|
149
|
-
skills: scenarioSkillEntries(deps.skills,
|
|
143
|
+
skills: scenarioSkillEntries(deps.skills, name),
|
|
150
144
|
});
|
|
151
145
|
const brandedScenario = (name) => branded && BRAND_IDENTITY_SCENARIOS.includes(name);
|
|
152
146
|
const details = {
|
|
@@ -220,7 +214,6 @@ function requireRepoClient(deps, scenarioLabel) {
|
|
|
220
214
|
? `${scenarioLabel} scenario has no repo client although the availability owner reports it available (wiring defect)`
|
|
221
215
|
: scenarioUnavailableMessage(verdict.reason, scenarioLabel));
|
|
222
216
|
}
|
|
223
|
-
export const SCENARIO_NAME_RE = /^[a-z][a-z0-9-]{1,31}$/;
|
|
224
217
|
export function centerScenarios(deps, specs, builtinNames, logger) {
|
|
225
218
|
const overlay = {};
|
|
226
219
|
const shadows = [];
|
|
@@ -254,7 +247,7 @@ function codeReview(deps, req) {
|
|
|
254
247
|
}
|
|
255
248
|
const coords = parseRepo(req.repo);
|
|
256
249
|
const repoTools = repoToolsFor(repoClient, coords);
|
|
257
|
-
const skills = skillsForScenario(deps.skills,
|
|
250
|
+
const skills = skillsForScenario(deps.skills, "code-review");
|
|
258
251
|
const hands = BUILTIN_SCENARIO_HANDS["code-review"];
|
|
259
252
|
return { tools: [...repoTools, nowTool()], hands, skills, prompt: { roleText: REVIEWER_ROLE_TEXT } };
|
|
260
253
|
}
|
|
@@ -328,7 +321,7 @@ export function gateScenarioRequest(ruling, bodyScenario, defaultScenario, known
|
|
|
328
321
|
const refusal = danglingScenarioRefusal(name, source, known);
|
|
329
322
|
if (refusal !== undefined) {
|
|
330
323
|
logger?.warn("scenario_assignment_unknown", { scenario: name, source, ...(principal !== undefined ? { principal } : {}) });
|
|
331
|
-
throw createCodedHttpError(503, "state.scenario_assignment_unknown", refusal, {
|
|
324
|
+
throw createCodedHttpError(503, "state.scenario_assignment_unknown", refusal, { scenario: name, source });
|
|
332
325
|
}
|
|
333
326
|
return name;
|
|
334
327
|
}
|
|
@@ -345,6 +338,8 @@ export function createScenarioGate(sources, leg) {
|
|
|
345
338
|
}
|
|
346
339
|
}
|
|
347
340
|
};
|
|
348
|
-
|
|
341
|
+
const known = () => Object.keys(sources.scenarios);
|
|
342
|
+
const gate = async (principal, requested) => gateScenarioRequest(await rulingOf(principal), requested, sources.config.defaultScenario, known(), sources.logger, principal);
|
|
343
|
+
return Object.assign(gate, { known });
|
|
349
344
|
}
|
|
350
345
|
//# sourceMappingURL=scenarios.js.map
|
|
@@ -87,7 +87,7 @@ export declare function loadDeploymentSkills(config: {
|
|
|
87
87
|
readonly provider: ExecutionLane;
|
|
88
88
|
};
|
|
89
89
|
}, logger?: Logger): LoadedSkill[];
|
|
90
|
-
/** 一个技能范围交进 `TaskSpec` 的技能(场景工厂的 `skills`)
|
|
90
|
+
/** 一个技能范围交进 `TaskSpec` 的技能(场景工厂的 `skills`)。**技能范围 = 场景名**,内建与 center 声明的场景一律如此、一处读法(没有范围表):各工厂与场景卡直传自己的场景名。 */
|
|
91
91
|
export declare function skillsForScenario(loaded: readonly LoadedSkill[], scope: string): SkillSpec[];
|
|
92
92
|
/**
|
|
93
93
|
* 技能清单的一条 —— **一张形,两个面**:场景卡(`GET /v1/capabilities/scenarios/:name` 的 `skills[]`,[ref])与 run 级名册
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* - 🔴 **候选 ≠ 延迟**(core 7.15.0 [ref] 的行为面收窄,本仓两条真后果见下):候选集整体受**一道**
|
|
13
13
|
* 阈值门,全或无 —— 候选的内联字节(name+description+schema)≥ `floor(上下文 token × 10%) × 3`
|
|
14
14
|
* 才延迟,否则**全内联且不挂 `ToolSearch`**。远端协议铸名因此**不再无条件占位**:本仓缺省窗
|
|
15
|
-
* (`
|
|
15
|
+
* (`ASSUMED_CONTEXT_WINDOW`,今天 262144 token)下阈值 = 78 642 字符,一个中小 MCP 名册够不着 ⇒ 首请求带全 schema。
|
|
16
16
|
* 唯一不受门的是调用方的 `TaskSpec.deferTools` 字面名单(按字面恒延迟、不计量)。
|
|
17
17
|
* - `RunnerDeps.deferMode:"auto"` 不是第二道门,而是把候选集**拓宽**到全部 caller spec 后走同一道门 ——
|
|
18
18
|
* 在本仓缺省场景下那会连 Agent 与 Task 四件一起卷进候选(与 CC 姿态相反),所以我们**刻意不开**;
|
|
@@ -25,7 +25,8 @@ import type { ServiceBlobExchange, ServiceFileHistoryStore } from "./plugins/sto
|
|
|
25
25
|
import { resolveStreamApprovalGate, type ApprovalFrameFamily } from "./tool-approval.js";
|
|
26
26
|
import { type WorkspaceSyncCapability } from "./workspace-space.js";
|
|
27
27
|
import type { WorkspaceCacheCapability } from "./workspace-cache.js";
|
|
28
|
-
import type
|
|
28
|
+
import { type HeadRead } from "./session-incarnation.js";
|
|
29
|
+
import type { HistoryAnchorReaders } from "./history-anchor.js";
|
|
29
30
|
import type { EngineHandoverDoor } from "./boot/engine-lease.js";
|
|
30
31
|
/** why 闭集:词 → 给运维看的一句义(诊断 / 测试读它;wire 上的拒句由各门自写)。 */
|
|
31
32
|
export declare const CAPABILITY_FACT_WHY: {
|
|
@@ -38,14 +39,14 @@ export declare const CAPABILITY_FACT_WHY: {
|
|
|
38
39
|
readonly checkpoint_store_absent: "no durable checkpoint store is wired (DURABLE_APPROVAL)";
|
|
39
40
|
readonly session_audit_absent: "no session audit view is wired (needs a durable session store)";
|
|
40
41
|
readonly session_watch_absent: "the session watch registry is not wired";
|
|
41
|
-
readonly session_lister_absent: "no session enumerator is wired (session store
|
|
42
|
+
readonly session_lister_absent: "no session enumerator is wired (the session store has no listSessions)";
|
|
42
43
|
readonly session_fork_face_absent: "the session store has no fork face";
|
|
43
44
|
readonly session_row_faces_absent: "the session store has no session-row faces (headOf / sessionSummaryOf / writeSessionRowCells)";
|
|
44
45
|
readonly session_purge_absent: "no session purge coordinator is wired";
|
|
45
46
|
readonly session_policy_store_absent: "no session policy store is wired";
|
|
46
47
|
readonly store_backend_absent: "no store backend is wired (DB_BACKEND=memory, multi-tenant bare boot, or half-configured SQL)";
|
|
47
48
|
readonly file_history_store_absent: "no file-history store is wired";
|
|
48
|
-
readonly resume_anchor_store_absent: "no rewind anchor map is wired (the handle → session-entry map a rewind target is read through)";
|
|
49
|
+
readonly resume_anchor_store_absent: "no rewind anchor map is wired (the handle → session-entry map a rewind target is read through, with the run store an unknown handle is checked against — both come from the store backend)";
|
|
49
50
|
readonly execution_lane_handless: "the execution lane mounts no execution environment (REMOTE_EXEC=none), so a session has no working tree to rewind";
|
|
50
51
|
readonly workspace_rebuilt_per_task: "each task's workspace is rebuilt when the task starts on this deployment (a fresh directory, container or sandbox, or a restore from the workspace snapshot store that a rewind cannot yet take part in), so a rewind would not land in the tree the next task starts from";
|
|
51
52
|
readonly session_store_shared: "the session store is shared by several server instances (DB_BACKEND=mysql|pg) and no durable claim spans an out-of-run rewind yet, so a rewind could interleave with a run or another rewind started on another instance";
|
|
@@ -101,6 +102,8 @@ export declare const CAPABILITY_FACT_WHY: {
|
|
|
101
102
|
readonly deployment_mod_packages_absent: "no operator-declared mod package was loaded at boot (MODS_ROOT / MODS_PACKAGES)";
|
|
102
103
|
readonly engine_handover_lane_absent: "the attachment lease has no handover lane here: the lease is not armed (neither ENGINE_AUTO_EXIT nor SEMA_PARENT_PID), or the deployment is multi-tenant (REQUIRE_PRINCIPAL=true)";
|
|
103
104
|
readonly engine_lease_stopped: "the attachment lease has stopped observing (this engine is shutting down)";
|
|
105
|
+
readonly auto_background_off: "AUTO_BACKGROUND_ON_TIMEOUT=false: a foreground command that outruns its own timeout is killed";
|
|
106
|
+
readonly lane_cannot_adopt_running_command: "the execution lane's environment cannot move a running command to the background (only the single-user host lane with HOST_BG_ENABLED on, k8s and e2b can), so a command that outruns its timeout is killed whatever AUTO_BACKGROUND_ON_TIMEOUT says";
|
|
104
107
|
};
|
|
105
108
|
export type CapabilityFactWhy = keyof typeof CAPABILITY_FACT_WHY;
|
|
106
109
|
/** 不可用臂。 */
|
|
@@ -170,8 +173,8 @@ export declare function sessionEventStream(d: Pick<Deps, "sessionWatch" | "sessi
|
|
|
170
173
|
sessionStorage: HeadReadingSessionStore;
|
|
171
174
|
}>;
|
|
172
175
|
type SessionLister = NonNullable<OwnerAwareSessionStore["listSessions"]>;
|
|
173
|
-
/**
|
|
174
|
-
export declare function sessionList(d: Pick<Deps, "sessionStorage"
|
|
176
|
+
/** 会话枚举面:会话店的 `listSessions` —— 唯一的会话 lister(run 店不列会话:只有 run 行、没有会话行的面答不了「有哪些会话」)。见证 = 已绑好宿主的那一只。 */
|
|
177
|
+
export declare function sessionList(d: Pick<Deps, "sessionStorage">): Fact<"session_lister_absent", {
|
|
175
178
|
lister: SessionLister;
|
|
176
179
|
}>;
|
|
177
180
|
export declare function sessionFork(d: Pick<Deps, "sessionStorage">): Fact<"session_fork_face_absent" | "session_head_face_absent", {
|
|
@@ -183,9 +186,17 @@ export declare function sessionFork(d: Pick<Deps, "sessionStorage">): Fact<"sess
|
|
|
183
186
|
export declare function sessionPatch(d: Pick<Deps, "sessionStorage">): Fact<"session_row_faces_absent", {
|
|
184
187
|
sessionStorage: WithMethods<OwnerAwareSessionStore, "headOf" | "writeSessionRowCells">;
|
|
185
188
|
}>;
|
|
189
|
+
/** 删除门读的会话店视图:按 id 读 = 删除门那一只头读,行格的 placement 问询 = 店自己的那一只。门照旧由属主存取器读头(`admitSessionById`),读的就是这一只。 */
|
|
190
|
+
type DeletionGateStore = Pick<OwnerAwareSessionStore, "placementOf"> & {
|
|
191
|
+
readonly headOf: HeadRead;
|
|
192
|
+
};
|
|
193
|
+
/**
|
|
194
|
+
* 会话删除面(purge 协调器 ∧ 删除门的头读)。见证 = 协调器 + 删除门的店视图 {@link DeletionGateStore}:按 id 读是 `deletionHeadReadOf`(local 店删到一半的行也答得出属主,
|
|
195
|
+
* 开始删它的那位重发收得完;别的店 = `headOf`)—— 与协调器围栏读同一只。
|
|
196
|
+
*/
|
|
186
197
|
export declare function sessionDelete(d: Pick<Deps, "purgeSession" | "sessionStorage">): Fact<"session_purge_absent" | "session_head_face_absent", {
|
|
187
198
|
purge: Store<"purgeSession">;
|
|
188
|
-
|
|
199
|
+
gateStore: DeletionGateStore;
|
|
189
200
|
}>;
|
|
190
201
|
export declare function sessionPolicy(d: Pick<Deps, "sessionPolicyStore" | "sessionStorage">): Fact<"session_policy_store_absent" | "session_head_face_absent", {
|
|
191
202
|
policyStore: Store<"sessionPolicyStore">;
|
|
@@ -212,16 +223,17 @@ type RewindFilesWhy = "file_history_store_absent" | "session_head_face_absent" |
|
|
|
212
223
|
/**
|
|
213
224
|
* run 外的「只恢复代码」口(`POST /v1/sessions/:id/rewind-files`,[ref])这台部署**解不解得出** —— 能力位 `sessionRewindFiles` 与该口的 501 读这一只。
|
|
214
225
|
* 四格缺一不可,每格都是那一口真要用的设施:文件历史店(引擎 `Runner.rewindFiles` 读的同一只;旋钮 `FILE_HISTORY_CAPTURE` 只关捕获、不摘店,
|
|
215
|
-
* 所以与它无关 —— 已存边界照常可回退)∧ 会话头读(属主门 + 坏档判据)∧
|
|
226
|
+
* 所以与它无关 —— 已存边界照常可回退)∧ 会话头读(属主门 + 坏档判据)∧ 锚店与 run 店(`to` 手柄经锚店翻成 entry id,未知手柄的 404 成因半句读 run 店,
|
|
227
|
+
* `history-anchor.ts`;两只同出存储后端,所以是同一格)∧ 执行车道有手
|
|
216
228
|
* (无手车道上引擎恒拒 `rewind.files_env_unsupported`:没有工作区可回退 —— 位说有而口恒拒不许发生)∧ 即时回退的工作区活过一次执行(部署形表行 `rewindableWorkspace`;
|
|
217
229
|
* 否则恢复的结果到不了下一次执行)∧ 会话店由本进程独占(local 后端:数据根被一个活进程锁住 ⇒ 引擎的进程内会话锁就是全局互斥;
|
|
218
230
|
* SQL 后端被多副本共用,而 run 外回退还没有一只跨副本的持久认领 —— 「先查认领再交引擎」只是检查不是互斥,所以在共享店上位为假、口 501,不留「检查即放行」)。
|
|
219
231
|
* 动词本身是引擎 `Runner` 的必有成员(型上必在),不是一格。
|
|
220
|
-
* 见证 =
|
|
232
|
+
* 见证 = 判过在场的设施(历史店 · 手柄翻译的两只读店 · 会话店);路由在拒臂之后只读见证。
|
|
221
233
|
*/
|
|
222
|
-
export declare function sessionRewindFiles(d: Pick<Deps, "fileHistoryStore" | "resumeAnchorStore" | "sessionStorage" | "config" | "backend">): Fact<RewindFilesWhy, {
|
|
234
|
+
export declare function sessionRewindFiles(d: Pick<Deps, "fileHistoryStore" | "resumeAnchorStore" | "runStore" | "sessionStorage" | "config" | "backend">): Fact<RewindFilesWhy, {
|
|
223
235
|
historyStore: ServiceFileHistoryStore;
|
|
224
|
-
anchors:
|
|
236
|
+
anchors: HistoryAnchorReaders;
|
|
225
237
|
sessionStorage: HeadReadingSessionStore;
|
|
226
238
|
}>;
|
|
227
239
|
/**
|
|
@@ -230,7 +242,7 @@ export declare function sessionRewindFiles(d: Pick<Deps, "fileHistoryStore" | "r
|
|
|
230
242
|
* `previewFileDelta` 不在 core 包根导出面上,本仓不另写一份 —— 等 core 导出它,SQL 店补这一座、本位随之转真,路由零改)。本位为假**不是**口不收 `dryRun`:口照收,答 `preview: null`
|
|
231
243
|
* (「这台给不出统计」≠「什么都不会变」);所以本事实没有 501 拒点,只有能力位读它。
|
|
232
244
|
*/
|
|
233
|
-
export declare function sessionRewindFilesPreview(d: Pick<Deps, "fileHistoryStore" | "resumeAnchorStore" | "sessionStorage" | "config" | "backend">): Fact<RewindFilesWhy | "file_history_preview_absent">;
|
|
245
|
+
export declare function sessionRewindFilesPreview(d: Pick<Deps, "fileHistoryStore" | "resumeAnchorStore" | "runStore" | "sessionStorage" | "config" | "backend">): Fact<RewindFilesWhy | "file_history_preview_absent">;
|
|
234
246
|
/** 持久审批底座(checkpoint 店)在场 —— `/v1/approvals/*` 与 `/v1/assistant/*` 整条车道、会话 wake 都站在它上面。 */
|
|
235
247
|
export declare function checkpointPark(d: Pick<Deps, "checkpointStore">): Fact<"checkpoint_store_absent", {
|
|
236
248
|
checkpointStore: Store<"checkpointStore">;
|
|
@@ -459,6 +471,21 @@ export declare function deploymentModPackages(d: Pick<Deps, "deploymentModPackag
|
|
|
459
471
|
}>;
|
|
460
472
|
/** 自唤醒调度器挂在宿主 env 上:`SCHEDULER_ENABLED` ∧ 单用户 ∧ host 车道。装配(`boot/execution-env.ts`)与能力位同调。 */
|
|
461
473
|
export declare function hostScheduler(c: Pick<ServiceConfig, "schedulerEnabled" | "requirePrincipal" | "remoteExec">): Fact<"scheduler_disabled" | "multi_tenant_deployment" | "not_host_lane">;
|
|
474
|
+
/**
|
|
475
|
+
* 前台命令超时转后台(`AUTO_BACKGROUND_ON_TIMEOUT`)在这台部署上生不生效:旋钮开 ∧ 本车道的执行环境能把**运行中的**命令领养成后台任务。
|
|
476
|
+
* 「能领养」就是执行环境的 `backgroundCapabilities.supportsDetach`,三只声明它的适配器(host / k8s / e2b)上它与后台 shell 的 `supported` 是同一个值 ——
|
|
477
|
+
* 所以按能力表的 `backgroundShell` 一位读:`supported`(k8s / e2b)⇒ 能;`single-user-only`(只有 host 一行)⇒ 单用户且 host 后台 shell 开关开着才能 ——
|
|
478
|
+
* 开关是第二参 `hostBackgroundShellOn`,调用方交 `hostBackgroundShellEnabled()`(`HOST_BG_ENABLED`;host 适配器的能力位读同一只;本模块零 I/O,不自己读 env)。
|
|
479
|
+
* 对账钉 `test/auto-background-on-timeout.test.ts` 逐车道拿装配出的真执行环境的 `supportsDetach` 与本事实对拍。
|
|
480
|
+
* 旋钮先判:关着的部署不论车道都答 `auto_background_off`(运维旋钮无条件,不支持的车道不拒启,只如实报)。
|
|
481
|
+
* `/health.autoBackgroundOnTimeout` 投它的三词({@link autoBackgroundOnTimeoutWord})。
|
|
482
|
+
*/
|
|
483
|
+
export declare function autoBackgroundOnTimeout(c: Pick<ServiceConfig, "autoBackgroundOnTimeout" | "requirePrincipal" | "remoteExec">, hostBackgroundShellOn: boolean): Fact<"auto_background_off" | "lane_cannot_adopt_running_command">;
|
|
484
|
+
/** `/health.autoBackgroundOnTimeout` 的三词闭集(顺序无语义):`armed` = 生效 · `off` = 部署关了 · `unsupported` = 旋钮开着,但本车道不能把运行中的命令转后台。 */
|
|
485
|
+
export declare const AUTO_BACKGROUND_ON_TIMEOUT_WORDS: readonly ["armed", "off", "unsupported"];
|
|
486
|
+
export type AutoBackgroundOnTimeoutWord = (typeof AUTO_BACKGROUND_ON_TIMEOUT_WORDS)[number];
|
|
487
|
+
/** 事实 → 三词(穷举:事实多一个 why 而这里不接 = 编译红)。 */
|
|
488
|
+
export declare function autoBackgroundOnTimeoutWord(f: ReturnType<typeof autoBackgroundOnTimeout>): AutoBackgroundOnTimeoutWord;
|
|
462
489
|
/** 引擎能力词的事实(core `ENGINE_CAPABILITIES` 每词一只谓词,值 = 本进程的事实;`/v1/capabilities` 以顶层布尔键展开它们)—— 住在
|
|
463
490
|
* `capabilities/engine-capabilities.ts`,这里只是把它纳入「能力位只投影事实」的同一张读面,静态门认 `facts.engineCapabilityBits()` 这一只展开。 */
|
|
464
491
|
export { engineCapabilityBits } from "./capabilities/engine-capabilities.js";
|
package/dist/capability-facts.js
CHANGED
|
@@ -7,8 +7,8 @@ import { centerEntitlementSourceWired } from "./runtime-caps-resolver.js";
|
|
|
7
7
|
import { WEB_ADMIN_ENV } from "@sema-agent/settings-schema";
|
|
8
8
|
import { blobExchangeOf, overwriteWipeIncapable } from "./session-sync.js";
|
|
9
9
|
import { WORKSPACE_PERSIST_DEFAULT, WORKSPACE_SNAPSHOT_KEEP_DEFAULT, workspaceSnapshotTimeoutOf } from "./workspace-space.js";
|
|
10
|
-
import { headReadOf } from "./session-incarnation.js";
|
|
11
|
-
import { laneWiresExecutionEnv } from "./execution-lane-caps.js";
|
|
10
|
+
import { deletionHeadReadOf, headReadOf } from "./session-incarnation.js";
|
|
11
|
+
import { executionLaneCaps, laneWiresExecutionEnv } from "./execution-lane-caps.js";
|
|
12
12
|
export const CAPABILITY_FACT_WHY = {
|
|
13
13
|
run_store_absent: "no durable run store is wired (DB_BACKEND=mysql|pg|local)",
|
|
14
14
|
subagent_registry_absent: "the sub-agent steer registry is not wired",
|
|
@@ -19,14 +19,14 @@ export const CAPABILITY_FACT_WHY = {
|
|
|
19
19
|
checkpoint_store_absent: "no durable checkpoint store is wired (DURABLE_APPROVAL)",
|
|
20
20
|
session_audit_absent: "no session audit view is wired (needs a durable session store)",
|
|
21
21
|
session_watch_absent: "the session watch registry is not wired",
|
|
22
|
-
session_lister_absent: "no session enumerator is wired (session store
|
|
22
|
+
session_lister_absent: "no session enumerator is wired (the session store has no listSessions)",
|
|
23
23
|
session_fork_face_absent: "the session store has no fork face",
|
|
24
24
|
session_row_faces_absent: "the session store has no session-row faces (headOf / sessionSummaryOf / writeSessionRowCells)",
|
|
25
25
|
session_purge_absent: "no session purge coordinator is wired",
|
|
26
26
|
session_policy_store_absent: "no session policy store is wired",
|
|
27
27
|
store_backend_absent: "no store backend is wired (DB_BACKEND=memory, multi-tenant bare boot, or half-configured SQL)",
|
|
28
28
|
file_history_store_absent: "no file-history store is wired",
|
|
29
|
-
resume_anchor_store_absent: "no rewind anchor map is wired (the handle → session-entry map a rewind target is read through)",
|
|
29
|
+
resume_anchor_store_absent: "no rewind anchor map is wired (the handle → session-entry map a rewind target is read through, with the run store an unknown handle is checked against — both come from the store backend)",
|
|
30
30
|
execution_lane_handless: "the execution lane mounts no execution environment (REMOTE_EXEC=none), so a session has no working tree to rewind",
|
|
31
31
|
workspace_rebuilt_per_task: "each task's workspace is rebuilt when the task starts on this deployment (a fresh directory, container or sandbox, or a restore from the workspace snapshot store that a rewind cannot yet take part in), so a rewind would not land in the tree the next task starts from",
|
|
32
32
|
session_store_shared: "the session store is shared by several server instances (DB_BACKEND=mysql|pg) and no durable claim spans an out-of-run rewind yet, so a rewind could interleave with a run or another rewind started on another instance",
|
|
@@ -82,6 +82,8 @@ export const CAPABILITY_FACT_WHY = {
|
|
|
82
82
|
deployment_mod_packages_absent: "no operator-declared mod package was loaded at boot (MODS_ROOT / MODS_PACKAGES)",
|
|
83
83
|
engine_handover_lane_absent: "the attachment lease has no handover lane here: the lease is not armed (neither ENGINE_AUTO_EXIT nor SEMA_PARENT_PID), or the deployment is multi-tenant (REQUIRE_PRINCIPAL=true)",
|
|
84
84
|
engine_lease_stopped: "the attachment lease has stopped observing (this engine is shutting down)",
|
|
85
|
+
auto_background_off: "AUTO_BACKGROUND_ON_TIMEOUT=false: a foreground command that outruns its own timeout is killed",
|
|
86
|
+
lane_cannot_adopt_running_command: "the execution lane's environment cannot move a running command to the background (only the single-user host lane with HOST_BG_ENABLED on, k8s and e2b can), so a command that outruns its timeout is killed whatever AUTO_BACKGROUND_ON_TIMEOUT says",
|
|
85
87
|
};
|
|
86
88
|
const no = (why) => ({ available: false, why });
|
|
87
89
|
const yes = (w) => ({ available: true, ...w });
|
|
@@ -147,7 +149,7 @@ export function sessionEventStream(d) {
|
|
|
147
149
|
return yes({ watch: d.sessionWatch, sessionStorage: owned.sessionStorage });
|
|
148
150
|
}
|
|
149
151
|
export function sessionList(d) {
|
|
150
|
-
const lister = d.sessionStorage?.listSessions?.bind(d.sessionStorage)
|
|
152
|
+
const lister = d.sessionStorage?.listSessions?.bind(d.sessionStorage);
|
|
151
153
|
return lister !== undefined ? yes({ lister }) : no("session_lister_absent");
|
|
152
154
|
}
|
|
153
155
|
export function sessionFork(d) {
|
|
@@ -170,7 +172,12 @@ export function sessionDelete(d) {
|
|
|
170
172
|
const owned = sessionOwnership(d);
|
|
171
173
|
if (!owned.available)
|
|
172
174
|
return owned;
|
|
173
|
-
|
|
175
|
+
const store = owned.sessionStorage;
|
|
176
|
+
const headOf = deletionHeadReadOf(store);
|
|
177
|
+
if (headOf === undefined)
|
|
178
|
+
return no("session_head_face_absent");
|
|
179
|
+
const placementOf = store.placementOf?.bind(store);
|
|
180
|
+
return yes({ purge: d.purgeSession, gateStore: { headOf, ...(placementOf !== undefined ? { placementOf } : {}) } });
|
|
174
181
|
}
|
|
175
182
|
export function sessionPolicy(d) {
|
|
176
183
|
if (d.sessionPolicyStore === undefined)
|
|
@@ -209,7 +216,7 @@ export function sessionRewindFiles(d) {
|
|
|
209
216
|
const owned = sessionOwnership(d);
|
|
210
217
|
if (!owned.available)
|
|
211
218
|
return owned;
|
|
212
|
-
if (d.resumeAnchorStore === undefined)
|
|
219
|
+
if (d.resumeAnchorStore === undefined || d.runStore === undefined)
|
|
213
220
|
return no("resume_anchor_store_absent");
|
|
214
221
|
if (!laneWiresExecutionEnv(d.config.remoteExec.provider))
|
|
215
222
|
return no("execution_lane_handless");
|
|
@@ -217,7 +224,7 @@ export function sessionRewindFiles(d) {
|
|
|
217
224
|
return no("workspace_rebuilt_per_task");
|
|
218
225
|
if (d.backend?.kind !== "local")
|
|
219
226
|
return no("session_store_shared");
|
|
220
|
-
return yes({ historyStore: d.fileHistoryStore, anchors: d.resumeAnchorStore, sessionStorage: owned.sessionStorage });
|
|
227
|
+
return yes({ historyStore: d.fileHistoryStore, anchors: { anchors: d.resumeAnchorStore, runs: d.runStore }, sessionStorage: owned.sessionStorage });
|
|
221
228
|
}
|
|
222
229
|
export function sessionRewindFilesPreview(d) {
|
|
223
230
|
const rewind = sessionRewindFiles(d);
|
|
@@ -493,5 +500,37 @@ export function hostScheduler(c) {
|
|
|
493
500
|
return no("not_host_lane");
|
|
494
501
|
return YES;
|
|
495
502
|
}
|
|
503
|
+
export function autoBackgroundOnTimeout(c, hostBackgroundShellOn) {
|
|
504
|
+
if (c.autoBackgroundOnTimeout !== true)
|
|
505
|
+
return no("auto_background_off");
|
|
506
|
+
const cap = executionLaneCaps(c.remoteExec.provider).backgroundShell;
|
|
507
|
+
switch (cap) {
|
|
508
|
+
case "unsupported":
|
|
509
|
+
return no("lane_cannot_adopt_running_command");
|
|
510
|
+
case "supported":
|
|
511
|
+
return YES;
|
|
512
|
+
case "single-user-only":
|
|
513
|
+
return c.requirePrincipal !== true && hostBackgroundShellOn ? YES : no("lane_cannot_adopt_running_command");
|
|
514
|
+
default: {
|
|
515
|
+
const unknownCap = cap;
|
|
516
|
+
throw new Error(`auto-background fact: unknown lane capability ${String(unknownCap)}`);
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
export const AUTO_BACKGROUND_ON_TIMEOUT_WORDS = ["armed", "off", "unsupported"];
|
|
521
|
+
export function autoBackgroundOnTimeoutWord(f) {
|
|
522
|
+
if (f.available)
|
|
523
|
+
return "armed";
|
|
524
|
+
switch (f.why) {
|
|
525
|
+
case "auto_background_off":
|
|
526
|
+
return "off";
|
|
527
|
+
case "lane_cannot_adopt_running_command":
|
|
528
|
+
return "unsupported";
|
|
529
|
+
default: {
|
|
530
|
+
const unknownWhy = f.why;
|
|
531
|
+
throw new Error(`auto-background word: unknown why ${String(unknownWhy)}`);
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
}
|
|
496
535
|
export { engineCapabilityBits } from "./capabilities/engine-capabilities.js";
|
|
497
536
|
//# sourceMappingURL=capability-facts.js.map
|
package/dist/card-void.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* **结算时作废一张归本 run 会话的、本服务兑现不了的卡** —— 读卡 → 卡仍 pending ∧ 卡归调用方说的那只会话(归属列,`hostSessionOf`)⇒
|
|
3
3
|
* 按卡**自己的** scope 走 checkpoint 店的 `expire`(与引擎的本进程仲裁器、续跑的 resolve 同一只 CAS,恰一个赢家)。不新增任何持久态。
|
|
4
4
|
*
|
|
5
5
|
* 规则只有一条:**本服务兑现不了的卡不留在待决面上**。产地 = 停驻没落定就以失败收场的腿(`runs.ts` 的 `voidHeldParkCard`:后台腿与
|
|
@@ -13,16 +13,16 @@
|
|
|
13
13
|
*/
|
|
14
14
|
import type { CheckpointToken } from "@sema-agent/core";
|
|
15
15
|
import { type FailOpenTag } from "./observability/fail-open.js";
|
|
16
|
-
/** 结算点手里那只 checkpoint
|
|
16
|
+
/** 结算点手里那只 checkpoint 店的三个动词:读卡(取它自己的 scope / 状态)、读它归在哪只会话上 → 按卡自己的 scope CAS 作废。 */
|
|
17
17
|
export interface CardVoidPort {
|
|
18
18
|
get(token: CheckpointToken): Promise<{
|
|
19
19
|
readonly scope?: string;
|
|
20
|
-
readonly sessionId?: string;
|
|
21
20
|
readonly status?: string;
|
|
22
21
|
} | null>;
|
|
22
|
+
hostSessionOfCard(token: CheckpointToken): Promise<string | null | undefined>;
|
|
23
23
|
expire(token: CheckpointToken, scope: string): Promise<boolean>;
|
|
24
24
|
}
|
|
25
|
-
/** 要作废的那一张:停驻带回的凭据 +
|
|
25
|
+
/** 要作废的那一张:停驻带回的凭据 + 它应归的会话(本 run 的会话;对不上就不动它 —— 只作废**这一张**)。 */
|
|
26
26
|
export interface CardRef {
|
|
27
27
|
readonly token: CheckpointToken;
|
|
28
28
|
readonly sessionId: string | undefined;
|
package/dist/card-void.js
CHANGED
|
@@ -10,7 +10,7 @@ export async function voidPendingCard(card, cards, tag, at) {
|
|
|
10
10
|
const live = await cards.get(card.token);
|
|
11
11
|
if (live === null || live.status !== "pending")
|
|
12
12
|
return;
|
|
13
|
-
if (card.sessionId === undefined ||
|
|
13
|
+
if (card.sessionId === undefined || (await cards.hostSessionOfCard(card.token)) !== card.sessionId || typeof live.scope !== "string") {
|
|
14
14
|
miss("card_mismatch");
|
|
15
15
|
return;
|
|
16
16
|
}
|
|
@@ -38,8 +38,12 @@ export interface CenterCredentialRenewer {
|
|
|
38
38
|
renewal(): CenterCredentialRenewal;
|
|
39
39
|
/** 最近一次读到的信封的访问令牌到期时刻(epoch ms;最近一次取值不是信封 ⇒ undefined)。 */
|
|
40
40
|
sessionExpiresAt(): number | undefined;
|
|
41
|
-
/**
|
|
42
|
-
|
|
41
|
+
/**
|
|
42
|
+
* 退订 + 停定时器(幂等),此后不再发起续签;返回的 promise 在**已经发出**的那一次续签落定之后才 settle(新信封落盘,或按失败落定 —— 从不 reject;
|
|
43
|
+
* 没有在飞的 ⇒ 立即 settle)。进程出口(起服前探针、停机)等它:中心一旦答应了续签,旧 refresh token 就作废了,换来的新信封没落盘就退出 ⇒
|
|
44
|
+
* 下一次起服手里只剩一只被消费的令牌。续签请求本身有界(`CENTER_PULL_TIMEOUT_MS`),所以这一等有界。
|
|
45
|
+
*/
|
|
46
|
+
stop(): Promise<void>;
|
|
43
47
|
}
|
|
44
48
|
/** `/health.centerCredential` 的 wire 形(免鉴权面:只有闭集词、时刻与计数 —— 不带路径、不带 reason 原句、不带令牌)。 */
|
|
45
49
|
export interface CenterCredentialHealthView {
|
|
@@ -5,6 +5,7 @@ import { WEB_ADMIN_ENV, WebAdminCredentialEnvelope, parseWebAdminCredentialFile
|
|
|
5
5
|
import { ACCESS_TOKEN_TTL_SECONDS, OAuthErrorResponse, TokenGrantResponse } from "@sema-agent/settings-schema/api/auth";
|
|
6
6
|
import { CENTER_PULL_TIMEOUT_MS, CenterRedirectRefusedError, centerTokenRefresh } from "./web-admin-client/center-request.js";
|
|
7
7
|
import { OWNER_ONLY_FILE_MODE } from "./plugins/owner-only-file-mode.js";
|
|
8
|
+
import { readUpstreamJson } from "./upstream-body.js";
|
|
8
9
|
export const CENTER_CREDENTIAL_RENEW_LEAD_KEY = "CENTER_CREDENTIAL_RENEW_LEAD_MS";
|
|
9
10
|
export const CENTER_CREDENTIAL_RENEW_LEAD_DEFAULT_MS = 5 * 60_000;
|
|
10
11
|
export const CENTER_CREDENTIAL_RENEW_LEAD_MIN_MS = CENTER_PULL_TIMEOUT_MS;
|
|
@@ -92,6 +93,7 @@ export function createCenterCredentialRenewer(deps) {
|
|
|
92
93
|
let subject;
|
|
93
94
|
let held;
|
|
94
95
|
let inFlight = false;
|
|
96
|
+
let current;
|
|
95
97
|
let stopped = false;
|
|
96
98
|
const stranded = new Set();
|
|
97
99
|
let cleanupWarned = false;
|
|
@@ -291,13 +293,13 @@ export function createCenterCredentialRenewer(deps) {
|
|
|
291
293
|
return;
|
|
292
294
|
}
|
|
293
295
|
if (res.status !== 200) {
|
|
294
|
-
const oauth = OAuthErrorResponse.safeParse(await res
|
|
296
|
+
const oauth = OAuthErrorResponse.safeParse(await readUpstreamJson(res).catch(() => undefined));
|
|
295
297
|
const oauthError = oauth.success ? oauth.data.error : undefined;
|
|
296
298
|
judgeRefusal(usedDigest, res.status === 400 && oauthError === "invalid_grant" ? "invalid_grant" : "rejected", { status: res.status, ...(oauthError !== undefined ? { oauthError } : {}) });
|
|
297
299
|
return;
|
|
298
300
|
}
|
|
299
301
|
const issuedAt = now();
|
|
300
|
-
const grant = TokenGrantResponse.safeParse(await res
|
|
302
|
+
const grant = TokenGrantResponse.safeParse(await readUpstreamJson(res).catch(() => undefined));
|
|
301
303
|
if (!grant.success || !Number.isFinite(grant.data.expires_in) || grant.data.expires_in <= 0) {
|
|
302
304
|
judgeRefusal(usedDigest, "malformed_grant", { status: res.status });
|
|
303
305
|
return;
|
|
@@ -324,7 +326,7 @@ export function createCenterCredentialRenewer(deps) {
|
|
|
324
326
|
if (held === undefined && (expiresAt - t > leadMs || t < quietUntil))
|
|
325
327
|
return;
|
|
326
328
|
inFlight = true;
|
|
327
|
-
|
|
329
|
+
current = renewOnce()
|
|
328
330
|
.catch((err) => {
|
|
329
331
|
const error = { error: err instanceof Error ? err.message : String(err) };
|
|
330
332
|
if (held !== undefined && subject !== undefined) {
|
|
@@ -336,6 +338,7 @@ export function createCenterCredentialRenewer(deps) {
|
|
|
336
338
|
})
|
|
337
339
|
.finally(() => {
|
|
338
340
|
inFlight = false;
|
|
341
|
+
current = undefined;
|
|
339
342
|
});
|
|
340
343
|
};
|
|
341
344
|
const unsubscribe = source.onRead((read) => {
|
|
@@ -358,6 +361,7 @@ export function createCenterCredentialRenewer(deps) {
|
|
|
358
361
|
if (timer !== undefined)
|
|
359
362
|
clearInterval(timer);
|
|
360
363
|
unsubscribe();
|
|
364
|
+
return current ?? Promise.resolve();
|
|
361
365
|
},
|
|
362
366
|
};
|
|
363
367
|
}
|