@sema-agent/server 7.133.0 → 7.135.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 +221 -0
- package/README.md +2 -2
- package/README.zh-CN.md +2 -2
- package/USAGE.md +222 -36
- package/deploy/sema-up/README.md +16 -0
- package/deploy/sema-up/chart/Chart.yaml +1 -1
- package/deploy/sema-up/chart/templates/NOTES.txt +15 -0
- package/deploy/sema-up/chart/templates/_helpers.tpl +129 -0
- package/deploy/sema-up/chart/templates/sealed-key.yaml +24 -0
- package/deploy/sema-up/chart/templates/server-v4pro.yaml +14 -0
- package/deploy/sema-up/chart/templates/server.yaml +14 -0
- package/deploy/sema-up/chart/values-full-single.yaml +5 -1
- package/deploy/sema-up/chart/values.yaml +34 -0
- package/dist/adoption/plan.d.ts +1 -1
- package/dist/approval-ask-audit-store.d.ts +25 -25
- package/dist/approval-ask-machine.d.ts +2 -2
- package/dist/approval-card.d.ts +66 -154
- package/dist/approval-card.js +33 -52
- package/dist/approval-content-kind.d.ts +26 -6
- package/dist/approval-content-kind.js +23 -3
- package/dist/approval-deny-reasons.d.ts +1 -1
- package/dist/approval-gate-currency.d.ts +91 -0
- package/dist/approval-gate-currency.js +120 -0
- package/dist/approval-hmac.d.ts +7 -7
- package/dist/approval-policy-settlement.d.ts +2 -2
- package/dist/approval-reconciler.d.ts +3 -3
- package/dist/approval.d.ts +14 -8
- package/dist/approval.js +35 -16
- package/dist/auth-bridge.d.ts +1 -1
- package/dist/auto-mode-face.d.ts +4 -4
- package/dist/background-session-reap.d.ts +2 -2
- package/dist/bake-runner/main.d.ts +2 -2
- package/dist/bake-runner/runner.d.ts +4 -4
- package/dist/bench/s1/live-deps.d.ts +1 -1
- package/dist/bench/s1/run-firm.d.ts +1 -1
- package/dist/boot/coordinators.d.ts +7 -2
- package/dist/boot/coordinators.js +8 -5
- package/dist/boot/deferred-sandbox-path-env.d.ts +0 -6
- package/dist/boot/deferred-sandbox-path-env.js +0 -5
- package/dist/boot/engine-lease.d.ts +5 -5
- package/dist/boot/execution-env.d.ts +16 -15
- package/dist/boot/execution-env.js +19 -21
- package/dist/boot/fatal-exit.d.ts +2 -2
- package/dist/boot/late-binds.d.ts +1 -1
- package/dist/boot/leader.d.ts +2 -0
- package/dist/boot/leader.js +2 -1
- package/dist/boot/memory-boundary.d.ts +2 -2
- package/dist/boot/memory-consolidation.d.ts +15 -15
- package/dist/boot/parked-revive-gate.d.ts +3 -3
- package/dist/boot/parked-revive-gate.js +3 -2
- package/dist/boot/read-deny-anchor-audit.js +2 -2
- package/dist/boot/reapers.d.ts +4 -4
- package/dist/boot/resolve-spec.d.ts +1 -1
- package/dist/boot/resolve-spec.js +28 -24
- package/dist/boot/runner-deps.d.ts +29 -16
- package/dist/boot/runner-deps.js +12 -2
- package/dist/boot/session-faces.d.ts +3 -3
- package/dist/boot/session-faces.js +11 -30
- package/dist/boot/shutdown.d.ts +5 -5
- package/dist/boot/side-query-lane.d.ts +2 -2
- package/dist/boot/stage-05-execution-env.js +4 -4
- package/dist/boot/stage-06-runners.d.ts +4 -3
- package/dist/boot/stage-06-runners.js +15 -4
- package/dist/boot/stage-07-capability-layer.d.ts +2 -1
- package/dist/boot/stage-08-reapers.d.ts +2 -1
- package/dist/boot/stage-09-leader.d.ts +2 -1
- package/dist/boot/stage-09-leader.js +2 -2
- package/dist/boot/stage-10-http-server.d.ts +2 -1
- package/dist/boot/stage-10-http-server.js +2 -1
- package/dist/boot/stores.d.ts +8 -0
- package/dist/boot/stores.js +10 -13
- package/dist/boot/web-admin.d.ts +21 -15
- package/dist/boot/web-admin.js +16 -12
- package/dist/boot/workflow-orchestration.js +2 -9
- package/dist/brain.d.ts +11 -11
- package/dist/budget.d.ts +4 -4
- package/dist/budget.js +5 -1
- package/dist/caller-text-echo.d.ts +2 -0
- package/dist/caller-text-echo.js +2 -1
- package/dist/canonical-json.d.ts +2 -41
- package/dist/canonical-json.js +2 -13
- package/dist/capabilities/approvals-push.d.ts +4 -4
- package/dist/capabilities/builtin-tools.d.ts +5 -5
- package/dist/capabilities/center-plugins.d.ts +5 -5
- package/dist/capabilities/center-plugins.js +1 -1
- package/dist/capabilities/center-prompts.d.ts +1 -1
- package/dist/capabilities/center-wiring.d.ts +1 -1
- package/dist/capabilities/composite-members.d.ts +2 -2
- package/dist/capabilities/composite-members.js +1 -1
- package/dist/capabilities/execution-lane.d.ts +5 -5
- package/dist/capabilities/execution-lane.js +2 -2
- package/dist/capabilities/hands-lane.d.ts +5 -5
- package/dist/capabilities/mcp-probe.d.ts +10 -7
- package/dist/capabilities/mcp-probe.js +2 -2
- package/dist/capabilities/sandbox-file-send.d.ts +1 -18
- package/dist/capabilities/sandbox-file-send.js +0 -7
- package/dist/capabilities/scenarios.d.ts +28 -10
- package/dist/capabilities/scenarios.js +15 -5
- package/dist/capabilities/send-user-file-tool.d.ts +1 -1
- package/dist/capabilities/skills.d.ts +31 -12
- package/dist/capabilities/skills.js +23 -17
- package/dist/capabilities/tool-defer.d.ts +1 -1
- package/dist/capability-facts.d.ts +27 -24
- package/dist/capability-facts.js +18 -20
- package/dist/center-config-tier.d.ts +1 -1
- package/dist/center-credential.d.ts +4 -4
- package/dist/checkpoint-ctx-seal-m28.d.ts +42 -0
- package/dist/checkpoint-ctx-seal-m28.js +19 -0
- package/dist/checkpoint-identity.d.ts +5 -0
- package/dist/checkpoint-identity.js +14 -0
- package/dist/config-catalog.d.ts +12 -12
- package/dist/config-invariants.d.ts +4 -4
- package/dist/config-invariants.js +3 -2
- package/dist/config-lkg.d.ts +1 -1
- package/dist/config-provider.d.ts +13 -13
- package/dist/config-provider.js +2 -1
- package/dist/config-types.d.ts +83 -83
- package/dist/config.d.ts +26 -24
- package/dist/config.js +12 -10
- package/dist/cross-session-settings.d.ts +1 -1
- package/dist/delegated-session-owner.d.ts +16 -13
- package/dist/delegated-session-owner.js +9 -10
- package/dist/deployment-governance.d.ts +16 -16
- package/dist/deployment-shape.d.ts +127 -0
- package/dist/deployment-shape.js +72 -0
- package/dist/device-store.d.ts +1 -1
- package/dist/device-ws-hub.d.ts +1 -1
- package/dist/egress-redirect.d.ts +1 -1
- package/dist/entry-mode-clamp-notice.d.ts +2 -2
- package/dist/env-facts.d.ts +10 -9
- package/dist/env-facts.js +1 -1
- package/dist/env-name-allowlist-knobs.d.ts +5 -5
- package/dist/exec-bounds.d.ts +2 -2
- package/dist/execution-lane-caps.d.ts +31 -43
- package/dist/execution-lane-caps.js +0 -13
- package/dist/field-conflict.d.ts +2 -1
- package/dist/field-conflict.js +1 -0
- package/dist/file-history-capture.d.ts +9 -9
- package/dist/file-history-disclosure.d.ts +50 -9
- package/dist/file-history-disclosure.js +8 -13
- package/dist/fleet/drain-entry.d.ts +2 -2
- package/dist/fleet/fleet-bus.d.ts +26 -14
- package/dist/fleet/fleet-bus.js +6 -5
- package/dist/fleet/fleet-reconciler.d.ts +9 -9
- package/dist/fleet/subagent-tail-bus.d.ts +4 -4
- package/dist/fleet-client.d.ts +13 -13
- package/dist/fleet-lease.d.ts +16 -16
- package/dist/governance-http-status.d.ts +2 -2
- package/dist/hooks/hook-llm.d.ts +7 -7
- package/dist/hooks/hook-runner.d.ts +57 -30
- package/dist/hooks/hook-runner.js +38 -20
- package/dist/host-decision.d.ts +5 -5
- package/dist/host-lsp-manager.d.ts +5 -5
- package/dist/hosted-posture.d.ts +23 -13
- package/dist/hosted-posture.js +4 -9
- package/dist/http/admission.d.ts +2 -2
- package/dist/http/admission.js +28 -5
- package/dist/http/approval-sweeps.d.ts +1 -1
- package/dist/http/approval-sweeps.js +5 -2
- package/dist/http/checkpoint-ctx.d.ts +183 -2
- package/dist/http/checkpoint-ctx.js +197 -2
- package/dist/http/dispatch.d.ts +3 -3
- package/dist/http/dispatch.js +3 -3
- package/dist/http/durable-run-leg.js +7 -5
- package/dist/http/idempotency.d.ts +4 -4
- package/dist/http/idempotency.js +2 -2
- package/dist/http/mcp-dial-deadline.d.ts +7 -5
- package/dist/http/memory-compliance-failure-reply.d.ts +4 -4
- package/dist/http/owner-access.d.ts +4 -6
- package/dist/http/owner-access.js +1 -1
- package/dist/http/principal-gate.d.ts +39 -13
- package/dist/http/principal-gate.js +30 -6
- package/dist/http/readiness.d.ts +1 -1
- package/dist/http/refusal-body.d.ts +12 -0
- package/dist/http/refusal-body.js +11 -0
- package/dist/http/request-guards.d.ts +4 -13
- package/dist/http/request-guards.js +4 -17
- package/dist/http/resume-ctx-read.d.ts +53 -6
- package/dist/http/resume-ctx-read.js +26 -3
- package/dist/http/resume-legs.d.ts +5 -4
- package/dist/http/resume-legs.js +47 -29
- package/dist/http/route-ctx.d.ts +29 -38
- package/dist/http/route-table.d.ts +9 -9
- package/dist/http/routes/agents-roster.d.ts +1 -1
- package/dist/http/routes/agents-roster.js +2 -3
- package/dist/http/routes/approvals-assistant.d.ts +5 -5
- package/dist/http/routes/approvals-assistant.js +91 -17
- package/dist/http/routes/background.d.ts +3 -3
- package/dist/http/routes/background.js +2 -2
- package/dist/http/routes/capabilities.d.ts +1 -1
- package/dist/http/routes/capabilities.js +16 -8
- package/dist/http/routes/config-catalog.d.ts +1 -1
- package/dist/http/routes/devices.d.ts +1 -1
- package/dist/http/routes/diagnostics.d.ts +6 -6
- package/dist/http/routes/diagnostics.js +1 -1
- package/dist/http/routes/fleet.d.ts +1 -1
- package/dist/http/routes/fleet.js +5 -4
- package/dist/http/routes/mcp-reconnect.d.ts +4 -4
- package/dist/http/routes/mcp-reconnect.js +3 -3
- package/dist/http/routes/memory-consolidation.d.ts +1 -1
- package/dist/http/routes/memory-origin.d.ts +1 -1
- package/dist/http/routes/notify-wake.d.ts +1 -1
- package/dist/http/routes/notify-wake.js +2 -2
- package/dist/http/routes/rules.d.ts +1 -1
- package/dist/http/routes/rules.js +4 -4
- package/dist/http/routes/runs.js +44 -11
- package/dist/http/routes/session-sync.d.ts +3 -2
- package/dist/http/routes/session-sync.js +109 -62
- package/dist/http/routes/sessions-list.d.ts +1 -1
- package/dist/http/routes/sessions-list.js +4 -5
- package/dist/http/routes/sessions.js +34 -48
- package/dist/http/routes/tasks.d.ts +1 -1
- package/dist/http/routes/tasks.js +21 -16
- package/dist/http/routes/trace-usage.d.ts +1 -1
- package/dist/http/routes/trace-usage.js +7 -9
- package/dist/http/routes/workflows.d.ts +3 -0
- package/dist/http/routes/workflows.js +31 -28
- package/dist/http/send.d.ts +5 -5
- package/dist/http/server.d.ts +39 -33
- package/dist/http/server.js +5 -2
- package/dist/http/session-inherit-env.d.ts +3 -3
- package/dist/http/sse-lifecycle.d.ts +1 -1
- package/dist/http/sse-log.d.ts +2 -2
- package/dist/http/submit-ctx.d.ts +4 -3
- package/dist/http/submit-ctx.js +19 -3
- package/dist/http/sync-submit-body.d.ts +1 -1
- package/dist/http/verify-rounds.d.ts +1 -1
- package/dist/http/wire-types.d.ts +35 -24
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/instruction-source-notice.d.ts +2 -2
- package/dist/key-resolver.d.ts +3 -3
- package/dist/lane-home-probe.d.ts +1 -1
- package/dist/leader/diffout.d.ts +1 -1
- package/dist/leader/diffup.d.ts +2 -2
- package/dist/leader/endpoint.d.ts +1 -1
- package/dist/leader/fanout.d.ts +1 -1
- package/dist/leader/leader.d.ts +4 -4
- package/dist/leader/merge.d.ts +3 -3
- package/dist/leader/repair-wire.d.ts +1 -1
- package/dist/leader/wire.d.ts +9 -5
- package/dist/leader/wire.js +8 -7
- package/dist/list-entry-display.d.ts +1 -1
- package/dist/lsp-evict.d.ts +1 -1
- package/dist/main.js +1 -1
- package/dist/mcp-assertion-header.d.ts +1 -1
- package/dist/memory-layer-legacy-lock.d.ts +1 -1
- package/dist/memory-operator-faces.d.ts +1 -1
- package/dist/memory-origin-fence.js +2 -2
- package/dist/memory-posture.js +4 -2
- package/dist/memory-project-layer.d.ts +1 -1
- package/dist/memory-scope.d.ts +19 -19
- package/dist/memory-store-refusal.d.ts +4 -4
- package/dist/model-compat.d.ts +1 -1
- package/dist/model-entry-headers.d.ts +2 -2
- package/dist/model-entry-refusal.d.ts +17 -17
- package/dist/model-provider.d.ts +10 -10
- package/dist/model-reach-scope.d.ts +1 -1
- package/dist/model-route-endpoint.d.ts +6 -6
- package/dist/model-route-url.d.ts +5 -5
- package/dist/model-select.d.ts +15 -6
- package/dist/model-select.js +5 -0
- package/dist/model-unreachable-notice.d.ts +3 -3
- package/dist/namespaced-rule-name.d.ts +15 -5
- package/dist/namespaced-rule-name.js +3 -2
- package/dist/observability/corrupt-read-seat.d.ts +9 -9
- package/dist/observability/cost-taxonomy.d.ts +1 -1
- package/dist/observability/err-text.d.ts +1 -1
- package/dist/observability/fail-open.d.ts +12 -8
- package/dist/observability/fail-open.js +12 -8
- package/dist/observability/metrics.d.ts +3 -3
- package/dist/observability/prompt-manifest.d.ts +19 -8
- package/dist/observability/prompt-manifest.js +9 -8
- package/dist/observability/run-terminal.d.ts +36 -36
- package/dist/observability/secret-env-scrub.d.ts +3 -3
- package/dist/observability/tool-trace.d.ts +1 -1
- package/dist/observability/tool-trace.js +8 -9
- package/dist/operator-ask.d.ts +4 -4
- package/dist/orchestration/workflow-agent-session-index.d.ts +3 -3
- package/dist/orchestration/workflow-completion-inbox.d.ts +20 -5
- package/dist/orchestration/workflow-completion-inbox.js +29 -7
- package/dist/orchestration/workflow-notify-journal.d.ts +43 -19
- package/dist/orchestration/workflow-notify-journal.js +17 -0
- package/dist/orchestration/workflow-park-decision.d.ts +1 -1
- package/dist/orchestration/workflow-park-decision.js +1 -0
- package/dist/outbound-dispatcher.d.ts +4 -4
- package/dist/parent-watch.d.ts +4 -4
- package/dist/parked-decide.d.ts +20 -20
- package/dist/parked-decide.js +8 -5
- package/dist/parked-revive-surface.d.ts +7 -7
- package/dist/parked-revive-surface.js +2 -3
- package/dist/peer-directory.d.ts +3 -3
- package/dist/peer-directory.js +1 -1
- package/dist/permission-rule-list.d.ts +10 -1
- package/dist/permission-rule-list.js +7 -5
- package/dist/permission-rule-vocab.d.ts +3 -25
- package/dist/permission-rule-vocab.js +0 -13
- package/dist/plugins/adoption-log-sql.d.ts +1 -1
- package/dist/plugins/approval-ask-store-file.d.ts +8 -1
- package/dist/plugins/approval-ask-store-file.js +6 -3
- package/dist/plugins/approval-ask-store-memory.d.ts +11 -7
- package/dist/plugins/approval-ask-store-memory.js +11 -7
- package/dist/plugins/approval-ask-store-sql.d.ts +34 -15
- package/dist/plugins/approval-ask-store-sql.js +18 -5
- package/dist/plugins/approval-exemption-store.d.ts +3 -3
- package/dist/plugins/approval-nonce-store.d.ts +3 -3
- package/dist/plugins/approval-payload-fingerprint.d.ts +14 -6
- package/dist/plugins/approval-payload-fingerprint.js +1 -1
- package/dist/plugins/background-agent-store-sql.d.ts +1 -1
- package/dist/plugins/background-shell-support.d.ts +2 -2
- package/dist/plugins/blob-backend.d.ts +1 -1
- package/dist/plugins/caching-session-store.d.ts +24 -33
- package/dist/plugins/caching-session-store.js +8 -19
- package/dist/plugins/checkpoint-index-columns.d.ts +81 -0
- package/dist/plugins/checkpoint-index-columns.js +62 -0
- package/dist/plugins/checkpoint-store-sql.d.ts +66 -67
- package/dist/plugins/checkpoint-store-sql.js +100 -103
- package/dist/plugins/device-store-sql.d.ts +7 -6
- package/dist/plugins/e2b-orphan-reclaim.d.ts +1 -1
- package/dist/plugins/ensure-schema-lock-policy.d.ts +1 -1
- package/dist/plugins/file-history-store-sql.d.ts +9 -7
- package/dist/plugins/file-history-store-sql.js +27 -15
- package/dist/plugins/file-run-store.d.ts +8 -8
- package/dist/plugins/fork-routing-session-store.d.ts +2 -2
- package/dist/plugins/fork-routing-session-store.js +1 -1
- package/dist/plugins/host-platform.d.ts +10 -10
- package/dist/plugins/image-bake-store-sql.d.ts +1 -1
- package/dist/plugins/image-index-sql.d.ts +1 -1
- package/dist/plugins/leader-run-store-sql.d.ts +1 -1
- package/dist/plugins/local-checkpoint-store.d.ts +23 -12
- package/dist/plugins/local-checkpoint-store.js +29 -4
- package/dist/plugins/local-session-store.d.ts +44 -45
- package/dist/plugins/local-session-store.js +42 -52
- package/dist/plugins/local-session-window.d.ts +12 -6
- package/dist/plugins/local-session-window.js +1 -17
- package/dist/plugins/mailbox-store-sql.d.ts +2 -2
- package/dist/plugins/memory-engine-pg.d.ts +1 -1
- package/dist/plugins/memory-run-store.d.ts +4 -4
- package/dist/plugins/memory-sync-store-pg.d.ts +3 -3
- package/dist/plugins/one-time-migrations.d.ts +76 -39
- package/dist/plugins/one-time-migrations.js +127 -34
- package/dist/plugins/outcome-ledger-sql.d.ts +1 -1
- package/dist/plugins/park-commit-watch.d.ts +3 -3
- package/dist/plugins/permission-rule-store-file.d.ts +5 -5
- package/dist/plugins/permission-rule-store-file.js +16 -19
- package/dist/plugins/permission-rule-store-sql.d.ts +38 -4
- package/dist/plugins/permission-rule-store-sql.js +74 -31
- package/dist/plugins/pg-cost-quota.d.ts +1 -1
- package/dist/plugins/pg-pool.d.ts +2 -2
- package/dist/plugins/pg-pool.js +5 -2
- package/dist/plugins/pg-rate-limiter.d.ts +1 -1
- package/dist/plugins/pg-session-storage.d.ts +9 -21
- package/dist/plugins/pg-session-storage.js +51 -42
- package/dist/plugins/remote-env-adb.d.ts +10 -10
- package/dist/plugins/remote-env-device.d.ts +22 -14
- package/dist/plugins/remote-env-device.js +28 -16
- package/dist/plugins/remote-env-e2b.d.ts +3 -3
- package/dist/plugins/remote-env-host.d.ts +16 -16
- package/dist/plugins/remote-env-k8s.d.ts +8 -8
- package/dist/plugins/remote-env-local-docker.d.ts +2 -2
- package/dist/plugins/remote-env-ssh.d.ts +4 -4
- package/dist/plugins/remote-scratchpad.d.ts +2 -3
- package/dist/plugins/remote-scratchpad.js +0 -4
- package/dist/plugins/remote-shell.d.ts +6 -6
- package/dist/plugins/retention-lane-store-sql.d.ts +4 -4
- package/dist/plugins/retention-store-sql.d.ts +4 -4
- package/dist/plugins/roster-store-sql.d.ts +1 -1
- package/dist/plugins/run-store-sql.d.ts +8 -8
- package/dist/plugins/schema-consistency.d.ts +2 -2
- package/dist/plugins/schema-ensure-legs.d.ts +3 -3
- package/dist/plugins/schema-indexes.d.ts +1 -1
- package/dist/plugins/schema-live-columns.d.ts +1 -1
- package/dist/plugins/session-event-payload.d.ts +4 -4
- package/dist/plugins/session-fork.d.ts +34 -0
- package/dist/plugins/session-fork.js +29 -0
- package/dist/plugins/session-ownership.d.ts +11 -0
- package/dist/plugins/session-ownership.js +11 -0
- package/dist/plugins/session-placement.d.ts +12 -14
- package/dist/plugins/session-placement.js +2 -15
- package/dist/plugins/session-policy-store-sql.d.ts +12 -12
- package/dist/plugins/session-store.d.ts +2 -2
- package/dist/plugins/session-store.js +2 -2
- package/dist/plugins/shared-memory-store-sql.d.ts +2 -2
- package/dist/plugins/sql-driver.d.ts +8 -8
- package/dist/plugins/sql-errors.d.ts +1 -1
- package/dist/plugins/sql-json-column.d.ts +21 -21
- package/dist/plugins/sql-row-helpers.d.ts +2 -2
- package/dist/plugins/store-backend.d.ts +17 -16
- package/dist/plugins/store-backend.js +3 -3
- package/dist/plugins/store-contracts.d.ts +21 -21
- package/dist/plugins/task-attachment-store.d.ts +2 -2
- package/dist/plugins/task-list-store-sql.d.ts +1 -1
- package/dist/plugins/tidb-pool.d.ts +2 -2
- package/dist/plugins/tidb-pool.js +9 -2
- package/dist/plugins/tidb-session-store.d.ts +17 -27
- package/dist/plugins/tidb-session-store.js +52 -42
- package/dist/plugins/tool-result-store-sql.d.ts +1 -1
- package/dist/plugins/usage-window-store-sql.d.ts +3 -3
- package/dist/plugins/user-input-ledger-file.d.ts +1 -1
- package/dist/plugins/user-input-ledger-sql.d.ts +3 -3
- package/dist/plugins/web-search.d.ts +19 -5
- package/dist/plugins/web-search.js +19 -4
- package/dist/{orchestration/workflow-journal-entry.d.ts → plugins/workflow-journal-payload.d.ts} +23 -32
- package/dist/plugins/workflow-journal-payload.js +32 -0
- package/dist/plugins/workflow-journal-store-sql.d.ts +28 -14
- package/dist/plugins/workflow-journal-store-sql.js +34 -15
- package/dist/plugins/workflow-run-store-sql.d.ts +4 -4
- package/dist/posture-source.d.ts +11 -11
- package/dist/principal-jwt.d.ts +6 -6
- package/dist/project-identity.d.ts +3 -3
- package/dist/project-memory.d.ts +4 -4
- package/dist/read-face-posture.d.ts +7 -7
- package/dist/request-key-closure.d.ts +1 -1
- package/dist/request-key-closure.js +1 -1
- package/dist/request-tool-axes.d.ts +12 -0
- package/dist/request-tool-axes.js +20 -0
- package/dist/request-value-closure.d.ts +15 -8
- package/dist/request-value-closure.js +2 -0
- package/dist/router/route-orchestration.d.ts +11 -16
- package/dist/router/route-orchestration.js +2 -12
- package/dist/rule-entry-list.d.ts +8 -7
- package/dist/rule-entry-list.js +2 -9
- package/dist/rules-consent.d.ts +6 -6
- package/dist/rules-consent.js +2 -0
- package/dist/run-cancel-context.d.ts +5 -5
- package/dist/run-local.d.ts +10 -10
- package/dist/run-local.js +1 -0
- package/dist/runs.d.ts +15 -12
- package/dist/runs.js +19 -4
- package/dist/runtime-caps-resolver.d.ts +6 -6
- package/dist/runtime-governance.d.ts +9 -9
- package/dist/sandbox-pkg-source.d.ts +9 -31
- package/dist/sandbox-pkg-source.js +14 -8
- package/dist/sealed-key.d.ts +34 -2
- package/dist/sealed-key.js +55 -1
- package/dist/security.d.ts +31 -32
- package/dist/security.js +12 -9
- package/dist/server-secret-env.d.ts +10 -10
- package/dist/session-children-retire.d.ts +1 -1
- package/dist/session-error-wire.d.ts +19 -12
- package/dist/session-error-wire.js +4 -1
- package/dist/session-incarnation.d.ts +52 -35
- package/dist/session-incarnation.js +23 -8
- package/dist/session-policy-wire.d.ts +27 -5
- package/dist/session-policy-wire.js +15 -1
- package/dist/session-records-skipped-notice.d.ts +1 -1
- package/dist/session-sync-kernel.d.ts +38 -11
- package/dist/session-sync-kernel.js +10 -0
- package/dist/session-sync.d.ts +49 -6
- package/dist/session-sync.js +52 -10
- package/dist/session-titler.d.ts +7 -6
- package/dist/session-titler.js +8 -13
- package/dist/session-watch.d.ts +3 -3
- package/dist/session-watch.js +4 -4
- package/dist/sighup-idle.d.ts +2 -2
- package/dist/spec-fields.d.ts +4 -4
- package/dist/sql-engine-posture.d.ts +3 -3
- package/dist/store-posture.d.ts +2 -2
- package/dist/stored-request-tool-axes-m19.d.ts +1 -1
- package/dist/task-a2a.d.ts +3 -1
- package/dist/task-a2a.js +38 -5
- package/dist/task-cwd.d.ts +7 -88
- package/dist/task-cwd.js +2 -15
- package/dist/task-mcp.d.ts +14 -10
- package/dist/task-mcp.js +39 -12
- package/dist/task-settings.d.ts +34 -18
- package/dist/task-settings.js +34 -4
- package/dist/task-workflow.d.ts +0 -24
- package/dist/task-workflow.js +2 -1
- package/dist/terminal.d.ts +5 -5
- package/dist/tighten-only-seats.d.ts +7 -6
- package/dist/tighten-only-seats.js +1 -1
- package/dist/tool-approval.d.ts +273 -228
- package/dist/tool-approval.js +125 -47
- package/dist/tool-rule-names.d.ts +7 -1
- package/dist/trace/core-keyset-guard.d.ts +15 -9
- package/dist/trace/engine-notice-wire.d.ts +5 -5
- package/dist/trace/engine-notice-wire.js +1 -0
- package/dist/trace/exit-seat.d.ts +40 -1
- package/dist/trace/exit-seat.js +46 -14
- package/dist/trace/ledger-events.d.ts +6 -4
- package/dist/trace/ledger-sink.d.ts +1 -1
- package/dist/trace/model-segment.d.ts +3 -3
- package/dist/trace/project.d.ts +65 -46
- package/dist/trace/project.js +49 -5
- package/dist/trace/redact.d.ts +44 -27
- package/dist/trace/redact.js +343 -73
- package/dist/trace/self-minted-wire.d.ts +39 -14
- package/dist/trace/self-minted-wire.js +9 -0
- package/dist/trace/sema-provenance.d.ts +1 -1
- package/dist/trace/task-notification-facets.d.ts +4 -4
- package/dist/trace/wire-projection-faces.d.ts +9 -3
- package/dist/trace/wire-projection-faces.js +7 -1
- package/dist/unattended-permission-mode.d.ts +5 -5
- package/dist/url-credential.d.ts +52 -0
- package/dist/url-credential.js +49 -0
- package/dist/url-refusal.d.ts +6 -2
- package/dist/url-refusal.js +8 -1
- package/dist/usage-analytics.d.ts +2 -2
- package/dist/user-input-ledger.d.ts +23 -23
- package/dist/web-admin-client/apply-effective.d.ts +5 -5
- package/dist/web-admin-client/apply-effective.js +2 -1
- package/dist/web-admin-client/apply-ledger.d.ts +2 -2
- package/dist/web-admin-client/center-request.d.ts +2 -2
- package/dist/web-admin-client/facade.d.ts +5 -5
- package/dist/web-admin-client/facade.js +1 -1
- package/dist/web-admin-client/hot-keys-registry.d.ts +2 -2
- package/dist/web-admin-client/http-client.d.ts +4 -4
- package/dist/web-admin-client/mcp-revocation.d.ts +1 -1
- package/dist/web-admin-client/pull-state.d.ts +1 -1
- package/dist/web-admin-client/read-face.d.ts +2 -2
- package/dist/web-admin-client/read-warnings.d.ts +5 -5
- package/dist/web-admin-client/restart-signal.d.ts +6 -6
- package/dist/web-admin-client/skills-mcp.d.ts +29 -4
- package/dist/web-admin-client/skills-mcp.js +31 -4
- package/dist/web-admin-client/types.d.ts +17 -10
- package/dist/workspace-space.d.ts +5 -3
- package/dist/write-protection.d.ts +2 -2
- package/package.json +4 -3
- package/scripts/drain-check-local.mjs +35 -2
- package/scripts/drain-check.mysql.sql +22 -2
- package/scripts/drain-check.pg.sql +22 -2
- package/skills/loop.md +1 -1
- package/dist/mcp-tool-faces.d.ts +0 -69
- package/dist/mcp-tool-faces.js +0 -104
- package/dist/orchestration/workflow-journal-entry.js +0 -27
package/dist/tool-approval.d.ts
CHANGED
|
@@ -1,65 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* [ref]/[ref]② tool-approval bridge — the SERVICE side of core's `RunnerDeps.onAsk` seam (core `tool-policy.ts`
|
|
3
|
-
* `resolveAsk`, 1.290's sync-ask leg). The SIBLING of {@link import("./question.js").QuestionCoordinator}: onQuestion
|
|
4
|
-
* routes the agent's AskUserQuestion tool to a live human; THIS routes a policy `ask` DECISION (e.g. the
|
|
5
|
-
* `createFsWriteGatePolicy` fs-write gate, an ask-list rule, or a non-durable safety ask) to the live human as a
|
|
6
|
-
* CC-parity three-choice card (Yes / Yes-allow-all-session / No).
|
|
7
|
-
*
|
|
8
|
-
* Wire shape (mirrors question end to end): core adjudicates a tool call `ask` → `resolveAsk(req, onAsk)` calls this
|
|
9
|
-
* coordinator's `ask` → we mint a pending entry + emit a `tool_approval` SSE frame on the run's live stream → the
|
|
10
|
-
* shell renders the three-choice card → `POST /v1/tool-approvals/:id/respond` settles the parked promise →
|
|
11
|
-
* `resolveAsk` maps our boolean to allow/deny. RESPOND BODY selection rationale: the question precedent's body is
|
|
12
|
-
* core's own QuestionAnswer (a structured multi-answer object) because core FENCES its semantics; an approval has no
|
|
13
|
-
* core-side answer object — `OnAsk` resolves to a BARE boolean — so the wire body is a minimal closed enum
|
|
14
|
-
* `{decision: "allow" | "allow_session" | "deny"}` mapping 1:1 onto the CC card's three choices (no free text = no
|
|
15
|
-
* fence needed; "allow_session" carries the Yes-allow-all intent that a boolean cannot).
|
|
16
|
-
*
|
|
17
|
-
* Session state ([ref]② "桥内会话态"): `allow_session` remembers a per-CAPABILITY grant keyed by
|
|
18
|
-
* `[owner, sessionId, category]` — a LATER ask in that (owner, session) whose tool maps to the SAME category
|
|
19
|
-
* auto-allows WITHOUT a card (CC 207: "Yes, allow all edits during this session") only through the FOUR-WAY
|
|
20
|
-
* conjunction at the short-circuit (see `ask`): {@link standingAnswerHome} over the ask's three facts
|
|
21
|
-
* (NOT governance-forced [ref] 件7/[ref], NOT `requiresRealApproval` [ref], NOT `mandated` S-660 — the SAME
|
|
22
|
-
* predicate decides whether an `allow_session` answer may MINT a grant, see `finishRespond`) ∧ a truthy sessionId ∧
|
|
23
|
-
* the grant itself ∧ `sessionGrantUncontestedByRow` (the durable row must not contradict the local peek). The category collapses the
|
|
24
|
-
* fs-WRITE tool family (Write/Edit/NotebookEdit, canonical space) into ONE bucket `"fs-write"`; any OTHER tool is
|
|
25
|
-
* its OWN bucket `"tool:<canonical>"`. 🔴 A `allow_session` on a NON-fs-write ask (an irreversible-Bash safety ask,
|
|
26
|
-
* an ask-list rule on another tool) therefore unlocks ONLY that same tool for the session — it must NEVER unlock the
|
|
27
|
-
* fs-write family (the "approve a cheap ask once → all future Write/Edit auto-allowed" scope widening, 三路复审 A 组 修2).
|
|
28
|
-
* The key is scoped to the VERIFIED owner too, so a session id shared across principals cannot inherit another's
|
|
29
|
-
* grant. This is the cheapest mid-task implementation; a mode SWITCH (default → acceptEdits) still goes through the
|
|
30
|
-
* shell's intent on the next task ([ref] table).
|
|
31
|
-
*
|
|
32
|
-
* 🔒 FAIL-CLOSED everywhere (the inverse of the question lane — an unanswered QUESTION never blocks the run: since
|
|
33
|
-
* [ref] the coordinator reports `unavailable` and CORE decides the landing, which depends on WHEN the human became
|
|
34
|
-
* unreachable — at policy time the durable gate says `ask` and the leg parks; once the tool is already running core is
|
|
35
|
-
* past `suspendAsk`, so it continues on `declined_unavailable`; an unanswered APPROVAL must NOT let the write
|
|
36
|
-
* proceed): TTL expiry and client disconnect ([ref] `parkOpenAsksForTask` → `forceParkNow`) land on the ONE
|
|
37
|
-
* unattended-outcome former ({@link ToolApprovalCoordinator.unattendedOutcome}, [ref] R-13) — park route
|
|
38
|
-
* ("unavailable" ⇒ core durable-parks) by default, a DEPLOYMENT-POLICY refusal (`{allow:false, settledBy:"policy",
|
|
39
|
-
* reason}` ⇒ core settles `policy_refused`; S-689 — never a bare `false`, which core reads as a PERSON's refusal)
|
|
40
|
-
* ONLY where the deployment declared `UNATTENDED_APPROVAL_POLICY=deny`; a run ABORT (task cancel → `runCancel`)
|
|
41
|
-
* still resolves `false` — the row goes VOID, there is nothing left to redeem. Since [ref] G1 (core 1.295
|
|
42
|
-
* OnAsk 三值化) the "no reachable human" class returns
|
|
43
|
-
* "unavailable" instead of false — no ALS context AND no bound-closure broker hit(1.258 起 bg/嵌套子代经
|
|
44
|
-
* spec.onAsk 的 bound 闭包 + streams broker 直达宿主活流,「无 ctx」只剩 durable-submit/headless resume
|
|
45
|
-
* 残余腿)and emit failure
|
|
46
|
-
* (card never delivered, and only when this catch is the first settler — a human verdict that raced in during the
|
|
47
|
-
* await keeps its boolean) ⇒ "unavailable" → core durable-parks (or fail-closed denies without a checkpoint). core's
|
|
48
|
-
* `resolveAsk` maps false to a deny WITH the ask message, so the model can re-route (deny + continue turn, [ref]⑤).
|
|
49
|
-
* Owner gate on respond = the VERIFIED principal (gatedPrincipal at the HTTP layer), 404 without an existence oracle
|
|
50
|
-
* — same posture as question/elicit. The frame's model-authored surfaces (message + args) are secret-REDACTED
|
|
51
|
-
* before they are streamed; the SIZE bound is per-surface: args ride a byte cap (`MAX_APPROVAL_ARGS_BYTES`,
|
|
52
|
-
* over-cap ⇒ `argsOmitted`), while the legacy frame's `message` is redacted but NOT length-capped — the char
|
|
53
|
-
* cap (`MAX_MESSAGE`, approval-card.ts `capText`) lives on the card/`approval_request` projection only (same
|
|
54
|
-
* redact-at-write contract as question; the args are shown to a human,
|
|
55
|
-
* never re-fed to a model). No throttle (unlike question): an approval breach-default would be a DENY (task failure),
|
|
56
|
-
* and asks are turn-blocking by construction — the TTL bounds the human-side exposure instead.
|
|
57
|
-
*/
|
|
58
|
-
import { type ParkedGateFace } from "./approval-content-kind.js";
|
|
59
1
|
import { type ApprovalDecidedBy, type HostSettledBy, type RetiredDecisionKeyFacts } from "./host-decision.js";
|
|
60
2
|
import type { IncomingMessage } from "node:http";
|
|
61
|
-
import { type AskClass, type AskRequest, type AskOutcome, type PermissionResult, type CheckpointGate, type PendingAction, type PersistedRuleMandate, type ReadRootGrantCandidate, type RuleOffer, type AutoModeFallbackCause, type BoundGrantAbsence, type BoundSkillGrants, type ToolApprovalCard } from "@sema-agent/core";
|
|
3
|
+
import { type AskClass, type AskRequest, type AskOutcome, type PermissionResult, type CheckpointGate, type PendingAction, type PersistedRuleMandate, type ReadRootGrantCandidate, type RuleOffer, type AutoModeFallbackCause, type BoundGrantAbsence, type BoundSkillGrants, type ToolApprovalCard, type ReopenReason } from "@sema-agent/core";
|
|
62
4
|
import { type CardRulePersisted, type RuleConsentLane } from "./rules-consent.js";
|
|
5
|
+
import type { GateCurrencyStore } from "./approval-gate-currency.js";
|
|
63
6
|
import { type AllowRuleShadowProjection, type DenialLimitFallback, type RuleOffersAbsence, type ApprovalRequestFrame, type ApprovalRevokeFrame, type ApprovalCardLegFrame, type ApprovalCompleteFrame, type RuleEvidenceProjection } from "./approval-card.js";
|
|
64
7
|
import { type ApprovalAskStore, type AskRow } from "./plugins/approval-ask-store-sql.js";
|
|
65
8
|
import type { ApprovalAskAuditSink } from "./approval-ask-audit-store.js";
|
|
@@ -69,20 +12,6 @@ import { type GovernanceAskMarks } from "./governance-ask-marks.js";
|
|
|
69
12
|
import { type GovernancePosture } from "./runtime-governance.js";
|
|
70
13
|
import { type GrantBinding, type StandingAnswerCall } from "./standing-answer-grant.js";
|
|
71
14
|
import { type ApprovalExemptionStore } from "./plugins/approval-exemption-store.js";
|
|
72
|
-
/** [ref]:审批 gate kind 闭集(core gateMatch 的 `human`/`irreversible_ask` ↔ outcome.gate "policy_ask")。
|
|
73
|
-
* 此前 7 份手写副本散在两只 checkpoint store 的数组/SQL 字面与 /decide 守卫——core 加审批味 kind 时
|
|
74
|
-
* 全部静默漂移。core 无导出词表(全大写导出面零命中,2026-08-09 亲验),属主落此;SQL IN 片段从
|
|
75
|
-
* 数组派生保证同源。门=test/approval-gate-kinds-single-owner.test.ts(副本回潮即红)。 */
|
|
76
|
-
export declare const APPROVAL_GATE_KINDS: readonly ["human", "irreversible_ask"];
|
|
77
|
-
export type ApprovalGateKind = (typeof APPROVAL_GATE_KINDS)[number];
|
|
78
|
-
export declare function isApprovalGateKind(k: string | undefined): k is ApprovalGateKind;
|
|
79
|
-
/**
|
|
80
|
-
* 停驻行的到期归 SLA 拒扫腿(deny)而不是作废(expire)?—— **一只谓词**:审批门型 ∧ core `facetOf(gate)` 读作 `A`(问答卡 ⇒ `B`,到期作废;
|
|
81
|
-
* 无门型 / 非审批门 ⇒ 不归拒扫)。两只店的拒扫选行与作废腿的补集都读这一只(SQL 腿的 `gate_kind IN …` 只是它的粗筛前置,判官仍是 core)。
|
|
82
|
-
*/
|
|
83
|
-
export declare function denySweepOwns(gate: ParkedGateFace | undefined): boolean;
|
|
84
|
-
/** 两方言同形的 SQL IN 片段(值为闭集常量字面,无注入面)。 */
|
|
85
|
-
export declare const APPROVAL_GATE_KINDS_SQL_IN: string;
|
|
86
15
|
/** {@link ToolApprovalCoordinator.adoptOpenAsks} 的读数(装配点进启动日志)。 */
|
|
87
16
|
interface OpenAskAdoption {
|
|
88
17
|
/** 本次接管进活集合的问数。 */
|
|
@@ -95,7 +24,7 @@ interface OpenAskAdoption {
|
|
|
95
24
|
readonly capped: boolean;
|
|
96
25
|
}
|
|
97
26
|
/**
|
|
98
|
-
* 耐久回决口 `POST /v1/approvals/:sessionId/decide` 的路径串 ——
|
|
27
|
+
* 耐久回决口 `POST /v1/approvals/:sessionId/decide` 的路径串 —— [ref]:迟到回决口 PARKING 臂 202 体的机读指路 `decidePath`。
|
|
99
28
|
* 路由表那一行(`http/routes/approvals-assistant.ts` 的 `approval-decide`)按 pattern 匹配它;两者同形由往返钉守
|
|
100
29
|
* (`test/parked-late-decision.test.ts` G3-c:本函数的输出经 `lookupRoute` 落 `approval-decide`)。会话段按路由的 `safeDecode` 对称编码。
|
|
101
30
|
*/
|
|
@@ -114,9 +43,9 @@ export type NotPendingCause = AskRowEndingCause | typeof NOT_PENDING_UNKNOWN_CAU
|
|
|
114
43
|
/**
|
|
115
44
|
* `GET /v1/tool-approvals/:approvalId` 应答体 `state` 的**闭集**(一只 ask 此刻在哪一态;读法与应答口逐条同源):
|
|
116
45
|
* · `pending` —— 本副本上有在等它的活登记(应答口此刻收得下);
|
|
117
|
-
* · `decided` —— 行 `DECIDED`(有人 / 有策略决过;回执三键同晚答回放体);
|
|
118
|
-
* · `parked` —— 行 `PARKING
|
|
119
|
-
* · `void` —— 行 `DENIED` / `VOID`(没有人决过它,答案无处兑现;`cause` 同晚答 404)。
|
|
46
|
+
* · `decided` —— 行 `DECIDED`(有人 / 有策略决过;回执三键同晚答回放体),**或**行 `PARKED` 而它的门已被决([ref]:checkpoint 已结算,见 {@link ParkedGateReading});
|
|
47
|
+
* · `parked` —— 行 `PARKING`,或行 `PARKED` 且门仍是该会话当前待决的审批门(转后台候批;应答口走迟到受理,耐久回决口照收);门是被引擎重开的(决过之后续跑腿在动作开跑前失败)⇒ 另带 `reopened`([ref],见 {@link ReopenedGate});
|
|
48
|
+
* · `void` —— 行 `DENIED` / `VOID`(没有人决过它,答案无处兑现;`cause` 同晚答 404),**或**行 `PARKED` 而它的门已过期 / 被取代(含停驻 run 被取消;此时 `cause` 缺席)。
|
|
120
49
|
*/
|
|
121
50
|
export declare const TOOL_APPROVAL_READ_STATES: readonly ["pending", "decided", "parked", "void"];
|
|
122
51
|
export type ToolApprovalReadState = (typeof TOOL_APPROVAL_READ_STATES)[number];
|
|
@@ -140,6 +69,7 @@ export type ToolApprovalReadBody = ({
|
|
|
140
69
|
} & AskRowReadProjection) | ({
|
|
141
70
|
state: "parked";
|
|
142
71
|
decidePath?: string;
|
|
72
|
+
reopened?: ReopenedGate;
|
|
143
73
|
} & AskRowReadProjection) | ({
|
|
144
74
|
state: "void";
|
|
145
75
|
cause?: AskRowEndingCause;
|
|
@@ -185,7 +115,7 @@ export type SettleVerdict = {
|
|
|
185
115
|
* 语义边界(禁扩读):它答的是「本副本此刻有没有活体消费者」,**不是**「这条 run 还活着吗」——持有
|
|
186
116
|
* 悬挂 promise 的可能是另一个副本(F4 的轮询腿会在它自己的下一拍续跑)。run 的生死读 run 面。
|
|
187
117
|
*
|
|
188
|
-
*
|
|
118
|
+
* [ref] 起**同一个词、同一句语义**也出现在 live 面:审批机起服时从问账接管的登记(没有引擎腿在等)在 `livePending` 行上带它,
|
|
189
119
|
* 在 live 应答口的 200 回执上按同一判据(本副本被唤醒的等待腿数 = 0)带它。一个事实,各面一个读法。
|
|
190
120
|
*/
|
|
191
121
|
export declare const ASK_DECISION_CONSUMER_ABSENT = "absent";
|
|
@@ -207,7 +137,7 @@ export interface ParkedAskRedeemRequest {
|
|
|
207
137
|
decision: "approve" | "deny";
|
|
208
138
|
/** [ref] 同源的人写理由(deny 时 core 把它交给模型;allow 只进审计面)。 */
|
|
209
139
|
note?: string;
|
|
210
|
-
/**
|
|
140
|
+
/** [ref]:决定体的**出处位**(已过 `readDecidedBy` 的 wire 词,缺席已落成 `"person"`),经 `hostDecisionFacts` 落到停驻座的
|
|
211
141
|
* `hostDecision.decidedBy`。live 命中臂与本 PARKED 臂读**同一格** —— 同一份体落在哪条臂上只取决于副本与时序;两臂各走自己座的
|
|
212
142
|
* 那一只映射(live = `liveSettledBy`,停驻 = 恒等),词表只有一份。 */
|
|
213
143
|
decidedBy: ApprovalDecidedBy;
|
|
@@ -226,6 +156,51 @@ export type ParkedAskRedeem = (req: ParkedAskRedeemRequest) => Promise<{
|
|
|
226
156
|
status: number;
|
|
227
157
|
body: Record<string, unknown>;
|
|
228
158
|
}>;
|
|
159
|
+
/**
|
|
160
|
+
* 一张门被引擎**重开**过的停驻卡([ref]):决过之后,续跑腿在被批准的动作开跑之前失败,引擎把同一张门(同一把 token)翻回待决。
|
|
161
|
+
* `reason` = core 记在行上的重开因由词原样(闭集 `REOPEN_REASONS`:`env_failed` 同一个决议经耐久回决口(`decidePath`)再交一次即可续跑 —— 本副本还留着首次受理回执时(缺省 1 小时内、未被容量帽逐出)应答口回放那张回执、不驱续跑;`tool_unavailable` / `constraint_rejected` 要重新决;`config_refused` 改好部署配置后再交原决议,或重新决);
|
|
162
|
+
* `decision` / `decidedAtMs` / `decisionNote?` = 重开之前的那次决议(读法与已结算门的 `decided` 同一只;读不出 ⇒ 三键缺席,只带因由词)。
|
|
163
|
+
*/
|
|
164
|
+
export type ReopenedGate = {
|
|
165
|
+
readonly reason: ReopenReason;
|
|
166
|
+
} | {
|
|
167
|
+
readonly reason: ReopenReason;
|
|
168
|
+
readonly decision: "allow" | "deny";
|
|
169
|
+
readonly decidedAtMs: number;
|
|
170
|
+
readonly decisionNote?: string;
|
|
171
|
+
};
|
|
172
|
+
/**
|
|
173
|
+
* 按问读口对一张 `PARKED` 卡的**门读法**([ref];判官的唯一属主 = `approval-gate-currency.ts`,协调器本身不认识 checkpoint 的形):
|
|
174
|
+
* · `open` —— 这张卡的门仍是该会话当前待决的审批门(应答口收得下)⇒ 读口说 `parked`;门被引擎重开过 ⇒ 另带 `reopened`([ref],{@link ReopenedGate});
|
|
175
|
+
* · `decided` —— 门已被决:方向 / 时刻 / 理由取自 checkpoint 上的结算赢家 ⇒ 读口说 `decided`;
|
|
176
|
+
* · `void` —— 门已过期 / 被取代(含停驻 run 被取消:取消先把门 expire)⇒ 读口说 `void`(没有人决过它,答案无处兑现);
|
|
177
|
+
* · `unknown` —— 说不出可信的话:`row_absent` = checkpoint 行没了;`decision_unreadable` = 门已结算却读不出可用的决议(行的 status 词或结算种类不在闭集表里 / 结算记录过不了 core 的
|
|
178
|
+
* 门记录筛 / 方向或时刻读不出)⇒ 读口答 404 `tool_approval.not_pending`(坏行不包装成首决;应答口并不同判:它的 PARKED 臂只对 checkpoint 行没了答 404,已结算的门答 409 `approval_stale`),
|
|
179
|
+
* 并记一行 error:`defects` 是读不出的那几处(非空),日志带首句 + 计数。
|
|
180
|
+
*/
|
|
181
|
+
export type ParkedGateReading = {
|
|
182
|
+
readonly kind: "open";
|
|
183
|
+
readonly reopened?: ReopenedGate;
|
|
184
|
+
} | {
|
|
185
|
+
readonly kind: "decided";
|
|
186
|
+
readonly decision: "allow" | "deny";
|
|
187
|
+
readonly decidedAtMs: number;
|
|
188
|
+
readonly decisionNote?: string;
|
|
189
|
+
} | {
|
|
190
|
+
readonly kind: "void";
|
|
191
|
+
} | {
|
|
192
|
+
readonly kind: "unknown";
|
|
193
|
+
readonly why: "row_absent";
|
|
194
|
+
} | {
|
|
195
|
+
readonly kind: "unknown";
|
|
196
|
+
readonly why: "decision_unreadable";
|
|
197
|
+
readonly defects: readonly [string, ...string[]];
|
|
198
|
+
};
|
|
199
|
+
/** 门读席:入参 = 问账行上的 gate 坐标(PARKED 行恒带 `gateToken`)。读不出(店抛错)⇒ 抛,协调器按店故障姿势处置(见 `readParkedGate`)。 */
|
|
200
|
+
export type ParkedGateRead = (row: {
|
|
201
|
+
readonly gateToken: string;
|
|
202
|
+
readonly gateBoundCallId: string | null;
|
|
203
|
+
}) => Promise<ParkedGateReading>;
|
|
229
204
|
/** 阶梯里**重发**一把 claim 的墙钟上限(ms;首把用 `DURABLE_CALL_TIMEOUT_MS`)。🔴 codex 交叉复审 C5
|
|
230
205
|
* (2026-08-06 真缺陷):只数重试次数是**不够**的 —— 次数只约束「已经返回或已经 reject 的调用」,一次
|
|
231
206
|
* **挂住不返回**的店调用(DB 连接黑洞、池饿死)会让整个退避循环连一格都走不完,`onAsk` 的 promise 于是永久
|
|
@@ -240,7 +215,7 @@ export declare function carriesDeploymentListQuestion(deploymentListAsks: boolea
|
|
|
240
215
|
* 继承问),而**能不能读**与审批席 / 回决写侧是同一只判据({@link standingAnswerDurablyRecordable}):记得下的才代答,记不下的(带授予绑定的问 ……)不代答,
|
|
241
216
|
* 存量行也不例外 —— 一事一读。事实取自**这一问本身**:类集经 core 包根唯一的类派生 `classifyAsk`({@link NO_GATE_FACTS});`requiresRealApproval` /
|
|
242
217
|
* `mandated` 读这一问自报的成员;治理位恒假(本层不是治理层);授予绑定读**调用**(`callGrantBindingOf` —— 本层手里还没有引擎铸的卡,core 7.51.0 不在
|
|
243
|
-
* `ToolCallRequest` 上盖绑定词,
|
|
218
|
+
* `ToolCallRequest` 上盖绑定词,[ref] 载体问题见 `standing-answer-grant.ts` 头注)。
|
|
244
219
|
*/
|
|
245
220
|
export declare function policyAskStandingAnswerFacts(req: StandingAnswerCall, ask: Extract<PermissionResult, {
|
|
246
221
|
action: "ask";
|
|
@@ -252,7 +227,7 @@ export declare function policyAskStandingAnswerFacts(req: StandingAnswerCall, as
|
|
|
252
227
|
* 而不是漏传一格被静默读成 `false`(那是安全轴上的 fail-open)。读者各自从自己手里的形折成这三格,
|
|
253
228
|
* 然后交**同一只** {@link standingAnswerHome}(判据只有一份,折法各归读者):
|
|
254
229
|
* · live 读侧取 `req` + 本地治理 peek;live 写侧取 pending 条目;
|
|
255
|
-
* · 耐久 `/decide` 腿(
|
|
230
|
+
* · 耐久 `/decide` 腿([ref] → NP-1,7.100.0)取 park 行,经 {@link parkRowStandingAnswerFacts}(三格全从行上读)。
|
|
256
231
|
* 本型**不绑** live 条目。
|
|
257
232
|
*/
|
|
258
233
|
export interface StandingAnswerFacts {
|
|
@@ -263,9 +238,9 @@ export interface StandingAnswerFacts {
|
|
|
263
238
|
/** core 闸站盖的强制位([ref]):规则清不掉、站着的答案退不掉,只有对**这一次调用**的应答能答。 */
|
|
264
239
|
readonly mandated: boolean;
|
|
265
240
|
/** 这一问的应答**授不授予**这一次调用之外的东西、授予的话绑定是什么(批准引擎的 `Skill` = 激活技能 + 本 run 内清单免问)。
|
|
266
|
-
* `bound` ⇒ 站着的答案按「工具 + 绑定」记、只代答绑定相同的问(core 7.43.0
|
|
241
|
+
* `bound` ⇒ 站着的答案按「工具 + 绑定」记、只代答绑定相同的问(core 7.43.0 [ref] / [ref]:活的问与停驻行同带 `boundGrantDigest`);
|
|
267
242
|
* `unreadable` ⇒ 不可记、不被代答(fail-closed)。读者一律经 `standing-answer-grant.ts` 折这一位:载体由问的属主定(`questionGrantBindingOf`)——
|
|
268
|
-
* 引擎铸的问读卡上引擎的词(`grantBindingOf`),部署名单自己的问与策略层的调用读 `callGrantBindingOf`(
|
|
243
|
+
* 引擎铸的问读卡上引擎的词(`grantBindingOf`),部署名单自己的问与策略层的调用读 `callGrantBindingOf`([ref])。 */
|
|
269
244
|
readonly grantBinding: GrantBinding;
|
|
270
245
|
/** 引擎盖在这一问上的**类集**(`AskRequest.classes` / 停驻行孪生座;经 core 的屏 `screenAskClassMembers` 读)。`undefined` = 卡上没有类
|
|
271
246
|
* (老引擎 / 不盖类的站)或屏拒 —— 读不出的类不是「无类」。 */
|
|
@@ -287,7 +262,7 @@ export interface StandingAnswerFacts {
|
|
|
287
262
|
*/
|
|
288
263
|
export type StandingAnswerHome = "none" | "seat" | "server_store";
|
|
289
264
|
/**
|
|
290
|
-
* 🔴 **
|
|
265
|
+
* 🔴 **[ref] —— 会话级放行的唯一判据:站着的答案能不能退掉这一问,能的话它记在哪({@link StandingAnswerHome})。** 纯函数,读者:
|
|
291
266
|
* · **读侧**(`askBroadcast` 的会话授权短路 {@link ToolApprovalCoordinator.standingGrantSettles}):`seat` 才可能由既有授权代答,否则往下走真出卡;
|
|
292
267
|
* · **写侧**(`finishRespond` 的 `grantable` 与 `recordDeploymentListAnswer`):`seat` 把 `allow_session` 铸成进程内授权;`server_store` 落 server 的会话豁免店;
|
|
293
268
|
* `none` 只放行这一次、`rememberApplied:false`;
|
|
@@ -299,7 +274,7 @@ export type StandingAnswerHome = "none" | "seat" | "server_store";
|
|
|
299
274
|
* **为什么三位是同一类**(「站着的答案退不掉的一问」):会话授权 = **上一次**应答记下的一揽子放行,不是对
|
|
300
275
|
* **这一次**调用的应答 —— 与持久 allow 规则同族,只是更短命(`askBroadcast` 短路处的注早已这么定性)。
|
|
301
276
|
* · `mandated`:core `PermissionResult` ask 臂 `mandated` 成员的文档。7.29.0 原句「no persisted allow rule and no standing
|
|
302
|
-
* posture may retire it, only an answer to THIS call」;**7.30.0 起 d.ts 已落 [ref] 澄清**(
|
|
277
|
+
* posture may retire it, only an answer to THIS call」;**7.30.0 起 d.ts 已落 [ref] 澄清**([ref] 在 7.30.1 装树亲核):
|
|
303
278
|
* core `PermissionResult` ask 臂的 `mandated` 成员文档「no persisted allow rule and no STANDING ANSWER (a release remembered
|
|
304
279
|
* from an earlier call, at any scope, a session included) may retire it」,`AskRequest.mandated` 孪生句同义 ——
|
|
305
280
|
* 「从早先某次回答记住的放行,**任何 scope、会话级也算**」都是站着的答案。core `ruleClearanceOf` 的文档
|
|
@@ -315,7 +290,7 @@ export type StandingAnswerHome = "none" | "seat" | "server_store";
|
|
|
315
290
|
* **自己**的位 —— core 每一次过闸(含 failover / 重启后的重入)都由 `runGateLanes` 里的 `stampAskOrigin`
|
|
316
291
|
* 重新盖、经同一处的 `carryOf` 带上 `AskRequest`,读侧手里的 `req` 恒是这一次过闸的真值。`governanceForced`
|
|
317
292
|
* 需要行读,是因为它来自本仓的**进程内**治理标表:failover / 重启后幂等命中既有行时本地表恒空,行上的卡才
|
|
318
|
-
* 存着落库那一刻的判定。(那张「行」是本仓的 ask 账本行,不是 core 的 park 行;core 7.31.0
|
|
293
|
+
* 存着落库那一刻的判定。(那张「行」是本仓的 ask 账本行,不是 core 的 park 行;core 7.31.0 [ref] 起 park 行上的
|
|
319
294
|
* `mandated` 孪生座由**耐久** `/decide` 腿读,见 {@link parkRowStandingAnswerFacts}。)
|
|
320
295
|
*/
|
|
321
296
|
export declare function standingAnswerHome(facts: StandingAnswerFacts): StandingAnswerHome;
|
|
@@ -328,7 +303,7 @@ export declare function standingAnswerHome(facts: StandingAnswerFacts): Standing
|
|
|
328
303
|
*/
|
|
329
304
|
export declare function standingAnswerDurablyRecordable(facts: StandingAnswerFacts): boolean;
|
|
330
305
|
/**
|
|
331
|
-
* 🔴 **
|
|
306
|
+
* 🔴 **[ref] → NP-1(7.100.0 合并复审 [ref] 交叉表 #2)—— 耐久 `/decide` 腿的 {@link StandingAnswerFacts}:从 park 行铸三位。**
|
|
332
307
|
* 纯投影,**不判**:判据是同一只 {@link standingAnswerHome}(唯一读点 = `http/resume-legs.ts` 的 remember 可记性,
|
|
333
308
|
* `standingAnswerDurablyRecordable(parkRowStandingAnswerFacts(…))`)。修前耐久腿自成一只谓词、只读 `ruleOffersAbsence` 一词,同一行上
|
|
334
309
|
* core 盖好的 `requiresRealApproval` 与治理出身都不读 ⇒ 那两类卡的 `remember:"session"` 照旧铸会话免询问,而 live 腿对同一张卡
|
|
@@ -340,18 +315,18 @@ export declare function standingAnswerDurablyRecordable(facts: StandingAnswerFac
|
|
|
340
315
|
* park 行上唯一的取证格只有 `riskDescriptor.shellGateDoctrine`(见下方 🚧);
|
|
341
316
|
* · `requiresRealApproval` —— 行上 core 铸的那一位,经 `approval-card.ts` 的 {@link readParkRowTrueSeat}(与运维
|
|
342
317
|
* 队列 `parkRowFacts` 同一只读法,`=== true`)。刻意**不**经 `parkRowFacts` 本身:那只展示投影顺手对 `ruleOffersAbsence`
|
|
343
|
-
* 的集外词计展示面 F 类 tag,而本读者对同一格是 fail-closed(
|
|
344
|
-
* · `mandated` —— **
|
|
318
|
+
* 的集外词计展示面 F 类 tag,而本读者对同一格是 fail-closed([ref] codex r1 钉「权限面不计展示面 tag」);
|
|
319
|
+
* · `mandated` —— **[ref] 二段(core [ref],7.31.0 / [ref])**:行上 core 铸的孪生座 `PendingAction.tool_approval.mandated`,经
|
|
345
320
|
* **同一只** {@link readParkRowTrueSeat}(`=== true`);**或**强制子集 `ruleOffersAbsence` 经三态窄读
|
|
346
321
|
* {@link readRuleOffersAbsenceSeat} 读成 `"mandated"` / 读不出(集外词 / 非串值,世代差)⇒ `true`。两臂是**两个事实**的析取,
|
|
347
322
|
* 不是同一个事实的新旧两种读法:core 对 `"mandated"` 这一词的定义就是「no persisted rule could ever clear this ask」(强制的
|
|
348
|
-
* 充分条件),而
|
|
323
|
+
* 充分条件),而 [ref] 之前铸的行(7.30.x 引擎 park、升级后才被 `/decide`)没有孪生座 —— 只读孪生座会让这类在飞行照旧落豁免,
|
|
349
324
|
* 是对上一版的回归;读不出按强制是 fail-closed(一个本仓不认识的新词可能正是一种强制因由)。
|
|
350
325
|
*
|
|
351
326
|
* 🚧 **剩余不对称一处**(耐久腿读得到的事实比 live 腿少,读不到的一律照旧可记):
|
|
352
|
-
* ① (已关,
|
|
327
|
+
* ① (已关,[ref] 二段)`mandated` 孪生位 —— core [ref] 到货,行上词为 `shadowed` / 缺席的强制卡由孪生座读到
|
|
353
328
|
* (`test/approval-exemption-http.test.ts` 原 🚧 格已按钉翻成「false + 零行」);
|
|
354
|
-
* ② **非 shell 治理(候
|
|
329
|
+
* ② **非 shell 治理(候 [ref])**:治理位经 `governanceOriginOf` 只覆盖 shell 门 `always` 档;敏感写路径
|
|
355
330
|
* (`SENSITIVE_WRITE_PATTERNS`)、`commandPolicy`、`AUTONOMY` 内层策略产的门与 shellGate `classify` 档,park 行上没有取证格
|
|
356
331
|
* (live 腿靠进程内标记表,跨副本 / 重启后够不着),本折法读不到它们的治理出身。
|
|
357
332
|
*/
|
|
@@ -428,8 +403,8 @@ export interface ToolApprovalFrame {
|
|
|
428
403
|
* 车道**有什么可给,而那条车道对它不说话的工具、**没接规则店的部署**(本仓的 live-only 形)、装不下规则的
|
|
429
404
|
* 任务都是结构性沉默 —— 它的缺席**不是**断言。本键是这一问**自己**的属性,凡强制皆在场。读错的代价 core
|
|
430
405
|
* 实测过:同一条根外读命令在 shell 工具上是强制问、在 monitor 工具上看起来是普通问。
|
|
431
|
-
* (耐久 `/decide` 腿手里只有 park 行:core 7.31.0
|
|
432
|
-
*
|
|
406
|
+
* (耐久 `/decide` 腿手里只有 park 行:core 7.31.0 [ref] 起行上有本键的孪生座 `PendingAction.tool_approval.mandated`,
|
|
407
|
+
* [ref] 二段读它;[ref] 之前铸的行没有孪生座,那条腿仍读那一词的**在场**(`"mandated"` ⇒ 强制)、从不读它的缺席 —— 见
|
|
433
408
|
* {@link parkRowStandingAnswerFacts}。live 腿恒读本键。)
|
|
434
409
|
*
|
|
435
410
|
* 🔴 **它不是 `requiresRealApproval`**:强制只说「没有规则能清掉」,**不**说「没有应答者可以答」——
|
|
@@ -437,12 +412,12 @@ export interface ToolApprovalFrame {
|
|
|
437
412
|
*
|
|
438
413
|
* 🔴 **真才带,缺席绝不编 `false`**(`governanceForced` / `requiresRealApproval` 同形)。缺席覆盖「不是强制」「老引擎」
|
|
439
414
|
* 两形。**本仓从不自铸本键**:活卡帧(与 `livePending` 行顶层,T4①)只读 `AskRequest.mandated`;耐久面(运维队列行 / inbox 行)
|
|
440
|
-
* 自 core 7.31.0
|
|
441
|
-
*
|
|
415
|
+
* 自 core 7.31.0 [ref] 起读 core 在 park 行上铸的孪生座(`PendingAction.tool_approval.mandated` / `CheckpointSummary.mandated`,
|
|
416
|
+
* [ref] 二段),同样只投 core 给的那一位 —— 自铸一个就是本仓成了这个事实的第二个源。⚠️ **`card_json` 卡面不带本键**
|
|
442
417
|
* (`ApprovalCardSchema` 没有这一位,`.strict()`)⇒ 断连重放的 `approval_request` 帧(`buildReplayFrame` 只回放卡)上它恒缺席,
|
|
443
418
|
* 消费方读队列行 / 活卡帧 / `livePending` 行(8D-6:此前这里写的「`card_json` 只读 `AskRequest.mandated`」是错句,T4② 车OC 改真)。
|
|
444
419
|
* 🔴 **server 不判「是不是强制」**(判定属主在 core 的闸站),只**读**闸站盖好的这一位 —— 读者恰一个:
|
|
445
|
-
*
|
|
420
|
+
* [ref] 起的会话级放行判据 {@link standingAnswerHome}(会话授权是**上一次**应答记下的站着的答案,
|
|
446
421
|
* 不是对这一次调用的应答 ⇒ 强制卡上既不被既有 grant 代答、也不铸 grant)。上一段「一揽子 `onAsk:"allow"`
|
|
447
422
|
* 席照常答得了」说的是**这一次调用的应答者**,本仓不改它。
|
|
448
423
|
*/
|
|
@@ -457,7 +432,7 @@ export interface ToolApprovalFrame {
|
|
|
457
432
|
*/
|
|
458
433
|
rememberRefused?: true;
|
|
459
434
|
/**
|
|
460
|
-
* **
|
|
435
|
+
* **[ref](core 7.32.0 [ref];ADDITIVE,`"tool_approval"` only)** —— 强制位**站在哪一个词上**:core `PERSISTED_RULE_MANDATES`
|
|
461
436
|
* 六词之一(`operator_always` / `tool_marks` / `probe_mandate` / `probe_unanswered` / `write_protection` /
|
|
462
437
|
* `target_unresolved`,词义属主在 core)。只在 `mandated: true` 的**整因**是那一个词时在场;另一扇门(治理 / hook /
|
|
463
438
|
* 祖先)或不止一个理由 ⇒ 缺席 —— **缺席从不命名一个词**,也不等于「不强制」(读 `mandated`)。值经 `approval-card.ts` 的
|
|
@@ -467,7 +442,7 @@ export interface ToolApprovalFrame {
|
|
|
467
442
|
*/
|
|
468
443
|
mandate?: PersistedRuleMandate;
|
|
469
444
|
/**
|
|
470
|
-
* **
|
|
445
|
+
* **[ref]③/[ref]**(core 7.5.0;**ADDITIVE**,`"tool_approval"` only)—— 这只 ask 的**出身**:
|
|
471
446
|
* 谁提的这一问,一个 core 闭集词(`ASK_ORIGINS` **11 员**,core 7.14.0 现值:content_question /
|
|
472
447
|
* ancestor_marked / org_unavailable / org_rule / rule_store_unavailable / hook / ask_rule /
|
|
473
448
|
* denial_limit_fallback / shell_gate_tighten / safety_tighten / policy)。引擎在门上盖章(core d.ts:
|
|
@@ -485,7 +460,7 @@ export interface ToolApprovalFrame {
|
|
|
485
460
|
* 🔴 **不枚举词表**(`string` 而不是本仓自铸的联合):词表单一属主在 core,在这里抄一份会把 core 加的
|
|
486
461
|
* 新词吞成缺席 —— 与 `wiring_manifest.autoMode.reason` 的透传纪律逐字同规。缺席 = 老引擎 / 非 ask 路径。
|
|
487
462
|
*
|
|
488
|
-
* 同一个词的其余四面(
|
|
463
|
+
* 同一个词的其余四面([ref] 起全部在场):`livePending` 行顶层 / `live_pending` 帧(条目铸定时与本键**同一次**读定);运维队列行
|
|
489
464
|
* (`GET /v1/approvals` 的 `pending[]` + `/stream` 的 `pending` 帧,读 park 行孪生座 `PendingAction.tool_approval.origin`,经
|
|
490
465
|
* `approval-card.ts` 的 `readClosedWordSeat(…, "origin")` —— 那一面读的是持久层原字节、中间没有 core 投影,所以亲手调 core 的
|
|
491
466
|
* `isAskOrigin`);inbox 行(core `CheckpointSummary.origin`,core 投影处已筛)。本键读的是引擎在门上刚盖好的值(盖章点即 core
|
|
@@ -497,38 +472,38 @@ export interface ToolApprovalFrame {
|
|
|
497
472
|
*/
|
|
498
473
|
origin?: string;
|
|
499
474
|
/**
|
|
500
|
-
* **
|
|
475
|
+
* **[ref] ②(core 7.37.0 [ref];ADDITIVE,`"tool_approval"` only)** —— 这一问的**类**:`classes` 的首员(core `ASK_CLASSES` 序),
|
|
501
476
|
* `MODE_ARBITRATION` 的行键(权限模式读的就是它 / 它们)。引擎在每一个铸 `origin` 的站盖章(策略自报的值在盖章处被替换),本仓经
|
|
502
|
-
* `approval-card.ts` 的 `readAskClassPair(req)` 窄读(判法 = core 屏 `screenAskClassMembers`,
|
|
503
|
-
*
|
|
504
|
-
* display:壳按类渲卡(cli 卡面、client-core
|
|
477
|
+
* `approval-card.ts` 的 `readAskClassPair(req)` 窄读(判法 = core 屏 `screenAskClassMembers`,[ref] ⑥ / [ref],本仓零自写对判;屏拒 ⇒ 两键都不投 + 计一次
|
|
478
|
+
* [ref] 集外 tag)。**与 {@link classes} 同在同缺**;缺席 = 老引擎 / 不盖类的站(共享制品读确认,core KL-1214-a),不是「无类」。
|
|
479
|
+
* display:壳按类渲卡(cli 卡面、client-core [ref]),durable 审批席按类答;**本仓不按它裁决**(无人值守腿的按类作答读 core 交来的
|
|
505
480
|
* `AskRequest.classes` 本身)。同一对的其余面:`card_json` 卡面 / `approval_request` 呈卡帧 / 断连重放帧(同一份素材)、运维队列行
|
|
506
481
|
* (`parkRowFacts`,读停车行孪生座 `PendingAction.tool_approval.askClass`);inbox 行不带(core `CheckpointSummary` 不回显)。
|
|
507
482
|
*/
|
|
508
483
|
askClass?: AskClass;
|
|
509
|
-
/**
|
|
484
|
+
/** [ref] ②:这一问属于的**全部**类(core `ASK_CLASSES` 序,`classes[0] === askClass`,非空)—— 读整只集合,别只读 {@link askClass}(一问可同属
|
|
510
485
|
* 几类)。与 `askClass` 同在同缺、同一只窄读;逐字同序过境,不排序不去重。 */
|
|
511
486
|
classes?: AskClass[];
|
|
512
487
|
/**
|
|
513
|
-
* core 7.43.0
|
|
488
|
+
* core 7.43.0 [ref] / [ref](**ADDITIVE**,`"tool_approval"` only)—— 对引擎 `Skill` 工具的调用,批准它**还授予**的东西的摘要
|
|
514
489
|
* (`AskRequest.boundGrantDigest`,技能名 + 两只清单规范拼写的哈希);别的卡缺席。与停驻行 / inbox 行的同名位同值(core:同一只工厂铸,
|
|
515
|
-
* 活卡与它的停驻孪生按 `(toolCallId, boundGrantDigest)` 对账)。逐字过境,本仓不重算;站着的答案按「工具 + 它」记(
|
|
490
|
+
* 活卡与它的停驻孪生按 `(toolCallId, boundGrantDigest)` 对账)。逐字过境,本仓不重算;站着的答案按「工具 + 它」记([ref])。
|
|
516
491
|
*/
|
|
517
492
|
boundGrantDigest?: string;
|
|
518
493
|
/** 上一位哈希的那一份值:`{ skill, allowedTools, disallowedTools }`(`skill: null` = 调用没点名任何已载技能)。与摘要同在同缺;**部署文本**,
|
|
519
494
|
* 壳按上下文转义渲染(core:display metadata)。逐字过境。 */
|
|
520
495
|
boundGrants?: BoundSkillGrants;
|
|
521
|
-
/**
|
|
496
|
+
/** [ref](core 7.51.0 [ref],**ADDITIVE**,`"tool_approval"` only):这张卡为什么没有 {@link boundGrantDigest} —— 引擎铸的每张卡恰带两者之一:
|
|
522
497
|
* `not_bindable`(这一问不是引擎 `Skill` 工具的激活,不绑任何授予 ⇒ 应答可按工具记)/ `unreadable`(绑着却读不出;活卡上引擎恒给摘要,这一词
|
|
523
498
|
* 只出现在读存量行的面上)。闭集经 `readClosedWordSeat(req, "boundGrantAbsence")` 窄读(筛 = core `BOUND_GRANT_ABSENCES`),集外 ⇒ 缺席 + 计一次。
|
|
524
499
|
* 与停驻行 / 运维队列行 / inbox 行的同名位同值;站着的答案的授予绑定(引擎铸的问那一家;部署名单自己的问读调用口)读它(`standing-answer-grant.ts` `grantBindingOf`)。display。 */
|
|
525
500
|
boundGrantAbsence?: BoundGrantAbsence;
|
|
526
|
-
/** core 7.43.0
|
|
501
|
+
/** core 7.43.0 [ref]:分类器没给判词的成因词(`error` / `timeout` / `parse_error`;只在类 `classifier_no_ruling` 的卡上)。闭集经 core 的
|
|
527
502
|
* `readClosedWordSeat(req, "classifierNoRuling")` 窄读(筛 = core `isAutoModeFallbackCause`),集外 ⇒ 缺席 + 计一次。display:本仓不按它裁决。 */
|
|
528
503
|
classifierNoRuling?: AutoModeFallbackCause;
|
|
529
504
|
/**
|
|
530
|
-
* **core 7.49.0
|
|
531
|
-
*
|
|
505
|
+
* **core 7.49.0 [ref](ADDITIVE,`"tool_approval"` only)—— 这一问渲在哪张卡上**:引擎在闸站铸的那一个词(闭集 = core 的 `TOOL_APPROVAL_CARDS`,
|
|
506
|
+
* 本文不抄词表 —— 词表的唯一写者在引擎),`AskRequest.approvalCard` 逐字过境,经
|
|
532
507
|
* `approval-content-kind.ts` 的 `readApprovalCard` 闭集窄读(集外 ⇒ 缺席 + 计一次 closed-word-out-of-set)。`question` = 问用户的问题(引擎保留的
|
|
533
508
|
* 问答工具),不是副作用工具。**本仓不从工具名回推卡**(工具名只作展示):此前按名字铸的 `livePending` 行 / 队列行 `contentKind` 随本键删。
|
|
534
509
|
* 停驻孪生 = 门的 `gate.approvalCard`(运维队列行顶层同名键,两只店读同一只 `parkedApprovalCard`)。display:本仓不按它裁决。
|
|
@@ -588,13 +563,13 @@ export interface ToolApprovalFrame {
|
|
|
588
563
|
* `approval_request` 帧([ref] 呈卡帧)同名同义:`expiresAtMs` = 本 ask 的绝对到期墙钟
|
|
589
564
|
* (有店=行上一次铸定的 `expiresAtMs`,与卡帧/落库同值;无店 D1=注册时刻算定的同名初值),
|
|
590
565
|
* `serverNowMs` = **帧铸造时刻**(cli [ref] 锚定语义:倒计时锚=帧到手时刻的服务器钟),
|
|
591
|
-
* `expiresInMs` = `max(0, expiresAtMs - serverNowMs)` 现算。三键同生同缺(
|
|
566
|
+
* `expiresInMs` = `max(0, expiresAtMs - serverNowMs)` 现算。三键同生同缺(没有活审批通道的腿不发帧,
|
|
592
567
|
* 发出的帧恒带);旧消费端无感,新壳借此给旧族帧补倒计时([ref] Q2 那类 77 分钟死卡的根治半场)。 */
|
|
593
568
|
expiresAtMs?: number;
|
|
594
569
|
expiresInMs?: number;
|
|
595
570
|
serverNowMs?: number;
|
|
596
571
|
/**
|
|
597
|
-
* core 7.42.0
|
|
572
|
+
* core 7.42.0 [ref](**硬破坏换名**:取代 7.41.x 的 `persistedRuleShadowed`,零别名;`"tool_approval"` only)——
|
|
598
573
|
* allow 层里**命中了这次调用、却没能清掉这只 ask** 的成员,每个成员一条 `{ member, entries, omitted? }`:`member` ∈ core `ALLOW_RULE_MEMBERS`
|
|
599
574
|
* (`hook` 部署 PreToolUse hook 的 allow / `deployment` 运维的 `APPROVAL_GRANT` / `persisted` 人存的 allow 规则 / `skill` 被激活技能的清单 /
|
|
600
575
|
* `request` 请求的 `settings.permissions.allow`);`entries` = 那个成员命中的条目原文(hook 恒空表);`omitted` = 没列出的条目数。
|
|
@@ -638,7 +613,7 @@ export interface ToolApprovalFrame {
|
|
|
638
613
|
*/
|
|
639
614
|
ruleOffersAbsence?: RuleOffersAbsence;
|
|
640
615
|
/**
|
|
641
|
-
*
|
|
616
|
+
* [ref](core 7.4.0 [ref];**ADDITIVE**,`"tool_approval"` only)—— 这只 ask 是 auto 模式分类器的**限额
|
|
642
617
|
* 回落卡**:分类器连续(缺省 3)或累计(缺省 20)拒到限额的**那一次**调用不再静默 deny,而是落成一张
|
|
643
618
|
* 必须真人批的卡(同一次铸造同时盖 `requiresRealApproval`,两键是孪生)。
|
|
644
619
|
* `{consecutive, total, limit:"consecutive"|"total", autoDenyAfterMs}` —— 触限时的两个计数、哪一道界
|
|
@@ -678,7 +653,7 @@ export interface ToolApprovalFrame {
|
|
|
678
653
|
* 耐久路的对偶 = `gate.riskDescriptor.probeCause`(同值,core `buildRiskDescriptor` 铸),走 checkpoint
|
|
679
654
|
* 行的**整体透传**到 `GET /v1/approvals` —— 键集零施工,钉在同一个文件的 §4。
|
|
680
655
|
*
|
|
681
|
-
* 姊妹键 `probeReason`(同一件事的**散文**兄弟)见下一键 —— 7.115.0 起投影(
|
|
656
|
+
* 姊妹键 `probeReason`(同一件事的**散文**兄弟)见下一键 —— 7.115.0 起投影([ref]),与本键**并列不替代**。
|
|
682
657
|
*/
|
|
683
658
|
probeCause?: {
|
|
684
659
|
code: string;
|
|
@@ -692,7 +667,7 @@ export interface ToolApprovalFrame {
|
|
|
692
667
|
};
|
|
693
668
|
};
|
|
694
669
|
/**
|
|
695
|
-
*
|
|
670
|
+
* [ref](7.115.0;**ADDITIVE**,`"tool_approval"` only)—— 这次 ask 被收紧时探针给出的那一句**散文**因由
|
|
696
671
|
* (`AskRequest.probeReason`:core 在 maybe 档收紧点 `inlineUntrusted(…, 200)` 过的一句话)。与
|
|
697
672
|
* {@link probeCause}(结构化因由)**并列、不替代**:引擎自己铸的因由走结构位,**部署自写的探针**只会写这一句
|
|
698
673
|
* —— 一只只给 reason 不给 cause 的探针,此前其审批人在活卡上读不到任何因由(耐久面
|
|
@@ -779,15 +754,15 @@ export interface LivePendingRow {
|
|
|
779
754
|
governanceForced?: true;
|
|
780
755
|
/** T4①(八病审计 8D-5,车OC / 7.101.0):强制位([ref],`AskRequest.mandated`)—— 与上两位**同层同形**(真才带,缺席不编 false),
|
|
781
756
|
* 值 = 条目上那一位(`askBroadcast` 铸条目时取自这一次过闸的 `req.mandated`,与 {@link frame} 上的同名键同源)。此前只在
|
|
782
|
-
* `frame` 里:同一个 `GET /v1/approvals` 响应的 durable `pending[]` 行顶层带它(
|
|
757
|
+
* `frame` 里:同一个 `GET /v1/approvals` 响应的 durable `pending[]` 行顶层带它([ref] 二段),live 行却要进帧里读。 */
|
|
783
758
|
mandated?: true;
|
|
784
759
|
/** 7.116.0(审计修复批 S4):这张卡上的「本会话放行」不会被记住 —— 与 {@link ToolApprovalFrame.rememberRefused} 同名同义同源
|
|
785
760
|
* (同一只判据,读条目上的四位事实);真才带。 */
|
|
786
761
|
rememberRefused?: true;
|
|
787
|
-
/**
|
|
762
|
+
/** [ref](core 7.32.0 [ref]):强制位站在哪一个词上 —— 与 `mandated` 同层同形(在场逐字,缺席不编词),值 = 条目上那一个词
|
|
788
763
|
* (与 {@link frame} 上同名键同源;帧型该键顶注是全文)。 */
|
|
789
764
|
mandate?: PersistedRuleMandate;
|
|
790
|
-
/**
|
|
765
|
+
/** [ref](cli [ref] / [ref]):ask 的**出身词**(谁提的这一问,core `ASK_ORIGINS` 闭集一词)—— 与 `mandate` 同层同形(在场逐字,
|
|
791
766
|
* 缺席不编词),值 = 条目上那一个词(铸条目那一次与 {@link frame} 上同名键**同一次**读定;帧型该键顶注是全文)。同一个
|
|
792
767
|
* `GET /v1/approvals` 响应里 durable `pending[]` 行的 `origin` 也在顶层(park 行孪生座),两族行同一种读法。 */
|
|
793
768
|
origin?: string;
|
|
@@ -801,12 +776,12 @@ export interface LivePendingRow {
|
|
|
801
776
|
* 子代 ask)上恒等成立。缺席 = 顶层 ask。`fromSubagent` 保留不动(byte-compat:先于本键的消费方仍按
|
|
802
777
|
* 它判别)。 */
|
|
803
778
|
originTaskId?: string;
|
|
804
|
-
/** core 7.49.0
|
|
779
|
+
/** core 7.49.0 [ref]:这一问的卡词 —— 与 {@link frame} 上的 `approvalCard` **同一个值**(行读帧上那一格,不另读一遍),与 durable
|
|
805
780
|
* 队列行顶层的同名键同层同形(那一面读门的 `gate.approvalCard`)。缺席 = 引擎没给(宿主自建 ask / 老引擎)。展示/分诊用,永不参与决议路由。
|
|
806
|
-
* (此前此处是按工具名铸的 `contentKind`,随
|
|
781
|
+
* (此前此处是按工具名铸的 `contentKind`,随 [ref] 删:卡只有引擎铸的这一个词。) */
|
|
807
782
|
approvalCard?: ToolApprovalCard;
|
|
808
783
|
/**
|
|
809
|
-
* 🔴
|
|
784
|
+
* 🔴 [ref](P1;cli [ref] / 板 [ref]):这只 ask **本来会 emit 的那只活卡帧**。
|
|
810
785
|
*
|
|
811
786
|
* 值 = {@link PendingApproval.frame} 的**引用** —— `askBroadcast` 里那一处唯一构造(已过
|
|
812
787
|
* `redactDeep` / 字节帽 / [ref] 窗三键补写)的**同一个对象**,悬挂与可达两条路共用它。⇒ 这一格
|
|
@@ -825,7 +800,7 @@ export interface LivePendingRow {
|
|
|
825
800
|
*/
|
|
826
801
|
frame?: ToolApprovalFrame | ApprovalRequestFrame;
|
|
827
802
|
/**
|
|
828
|
-
*
|
|
803
|
+
* [ref]:**本副本上没有引擎腿在等这只问** —— 与耐久决断口 200 体同名同值同义的那一位({@link ASK_DECISION_CONSUMER_ABSENT})。
|
|
829
804
|
* 在场 ⇔ 这一行是审批机起服时从问账接管的问(前一个进程 / 别的副本铸下、行仍 `STREAM_PENDING`;见 {@link ToolApprovalCoordinator.adoptOpenAsks}):
|
|
830
805
|
* 它照常列得出、照常应答得了(行落 `DECIDED`,应答回执同带这一位),但这一决不会让本副本上任何在跑的东西续跑 —— 续没续跑读 run 面。
|
|
831
806
|
* 只记真:缺席 = 本副本有引擎腿在等它(或老 server)。
|
|
@@ -966,19 +941,19 @@ export declare const PERSIST_RULE_BATCH_EXCLUSIVE_ERROR = "persistRule.batchOffe
|
|
|
966
941
|
* 指定 scope = 让一次「在项目 A 里点的同意」写成一条覆盖项目 B(或全局)的常驻放行 —— 那是这条轴上
|
|
967
942
|
* 最贵的一次扩权。静默忽略同样不行:客户端会以为自己设上了。响亮拒,一句话说清谁拥有这一格。
|
|
968
943
|
*/
|
|
969
|
-
/**
|
|
944
|
+
/** [ref](core 7.32.0 [ref])—— `readRootGrant` 只随 `decision:"allow"`(CC 卡的第三选项「Yes, and add directory」= 放行这一次
|
|
970
945
|
* + 加目录;`allow_session` 不是那一个选项,`deny` 上它没有意义)。裁决之前响亮拒,不静默丢。 */
|
|
971
946
|
export declare const READ_ROOT_GRANT_ALLOW_ONLY = "readRootGrant is only meaningful with decision \"allow\" \u2014 it is the card's \"Yes, and add directory\" answer (allow this call and add the card's readRootCandidate.dir to this run's read directories)";
|
|
972
947
|
/**
|
|
973
|
-
*
|
|
948
|
+
* [ref]:这台部署不受理读根授权时,带 `readRootGrant` 的应答的拒句。受理与否是**部署姿态**(能力事实 `readRootGrant`,位 `approvalReadRootGrant`;
|
|
974
949
|
* 判据的唯一属主在 `capability-facts.ts`,回决路由把它读来交给 {@link ToolApprovalCoordinator.respond}):不受理 ⇒ 裁决**之前**响亮 400,
|
|
975
|
-
* 这只 ask 没被结算,同一张卡不带该键的 `allow` 照常成。不静默丢键 —— 壳以为加上了目录而引擎只看到一次普通放行,是
|
|
950
|
+
* 这只 ask 没被结算,同一张卡不带该键的 `allow` 照常成。不静默丢键 —— 壳以为加上了目录而引擎只看到一次普通放行,是 [ref] 修过的那一种病。
|
|
976
951
|
*/
|
|
977
952
|
export declare const READ_ROOT_GRANT_NOT_ACCEPTED = "readRootGrant is not accepted on this deployment \u2014 a read-directory grant is honored only on a single-user host-lane deployment (GET /v1/capabilities approvalReadRootGrant is false here); answer with plain decision \"allow\" instead";
|
|
978
|
-
/**
|
|
953
|
+
/** [ref]:`readRootGrant` 的形 —— 卡上 `readRootCandidate.dir` 的原串(非空,≤ core `READ_ROOT_CANDIDATE_DIR_MAX`;超限整只拒,不截:截过的目录是另一个目录)。 */
|
|
979
954
|
export declare const READ_ROOT_GRANT_SHAPE = "readRootGrant must be the card's readRootCandidate.dir sent back byte for byte \u2014 a non-empty string of at most 1024 characters";
|
|
980
955
|
export declare const PERSIST_RULE_SCOPE_REFUSED = "this endpoint does not accept a rule scope \u2014 the server mints it from where the approval happened (send neither `scope` nor `persistRule.scope`)";
|
|
981
|
-
/**
|
|
956
|
+
/** [ref]:`respond()` 要的**部署事实**(由回决路由从能力事实交进;协调器不读 config,也不自判姿态)。 */
|
|
982
957
|
export interface ToolApprovalRespondDeployment {
|
|
983
958
|
/** 这台部署受理不受理应答体里的 `readRootGrant` —— 能力事实 `readRootGrant` 的 `.available`(位 `approvalReadRootGrant` 的同一个值)。 */
|
|
984
959
|
readonly readRootGrantAccepted: boolean;
|
|
@@ -1019,8 +994,8 @@ export declare function parseToolApprovalResponse(body: unknown): ParsedToolAppr
|
|
|
1019
994
|
*/
|
|
1020
995
|
export type UnattendedApprovalPolicy = "park" | "deny";
|
|
1021
996
|
/**
|
|
1022
|
-
*
|
|
1023
|
-
* (`settledBy:"policy"` ⇒ core 结算 `policy_refused`、`who.party:"policy"`(core 7.39.0
|
|
997
|
+
* [ref] —— `deny` 政策下「无人可答」交给 core 的形:core `AskOutcome` 对象臂的**部署政策拒**
|
|
998
|
+
* (`settledBy:"policy"` ⇒ core 结算 `policy_refused`、`who.party:"policy"`(core 7.39.0 [ref] 起;此前 `"none"`),模型读的是策略句)。
|
|
1024
999
|
*
|
|
1025
1000
|
* 修前这里交**裸 `false`** —— 而在 core 的 onAsk 契约里裸 `false` 就是「一个人拒了」:结算记
|
|
1026
1001
|
* `human_refused` / `who.party:"person"`,模型被告知「用户不想继续,停下来等他」,run 以
|
|
@@ -1040,15 +1015,15 @@ export type UnattendedPolicyRefusal = Extract<AskOutcome, {
|
|
|
1040
1015
|
/**
|
|
1041
1016
|
* {@link UnattendedPolicyRefusal} 的**唯一**构造(纯数据 ⇒ `build*`)。来源词读店落行的**同一个**常量(`POLICY_REFUSAL_DECISION`,NP-2):
|
|
1042
1017
|
* 行上记的与交给 core 的在构造上是一个词。两个铸点读它:协调器 deny 政策的「无人可答」({@link ToolApprovalCoordinator.unattendedOutcome})
|
|
1043
|
-
* 与 run-local 本地席没有人可问的两臂(
|
|
1018
|
+
* 与 run-local 本地席没有人可问的两臂([ref]:无 TTY / 参数展示不出 —— `src/run-local.ts` `createLocalApprover`)。`reason` = 铸点的
|
|
1044
1019
|
* 闭集拒因句(core 以 `policy note` 围栏交给模型),不带调用方的字节。
|
|
1045
1020
|
*/
|
|
1046
1021
|
export declare function buildUnattendedPolicyRefusal(reason: string): UnattendedPolicyRefusal;
|
|
1047
1022
|
/** 「无人可答」终局的**闭集** —— core `AskOutcome` 联合里只有这两臂由 {@link ToolApprovalCoordinator.unattendedOutcome}
|
|
1048
|
-
* 铸:park 政策的路由答 `"unavailable"`,deny 政策的 {@link UnattendedPolicyRefusal}。没有布尔臂(
|
|
1023
|
+
* 铸:park 政策的路由答 `"unavailable"`,deny 政策的 {@link UnattendedPolicyRefusal}。没有布尔臂([ref]:裸 `false`
|
|
1049
1024
|
* 是人的拒绝,这个口从不替人说话)。 */
|
|
1050
1025
|
export type UnattendedAskOutcome = Extract<AskOutcome, "unavailable"> | UnattendedPolicyRefusal;
|
|
1051
|
-
/**
|
|
1026
|
+
/** [ref] 候裁 16:耐久会话授权店(`src/plugins/approval-exemption-store.ts` 的同一只店):审批席读它(引擎的问),活卡上部署名单那一问的
|
|
1052
1027
|
* 「本会话放行」写它(名单门在出问之前读同一行)。 */
|
|
1053
1028
|
export type SessionGrantStore = Pick<ApprovalExemptionStore, "has" | "grant">;
|
|
1054
1029
|
/**
|
|
@@ -1071,23 +1046,24 @@ export type SessionGrantStore = Pick<ApprovalExemptionStore, "has" | "grant">;
|
|
|
1071
1046
|
* `tool_approval` 活卡腿逐字保留,而不是「把 ask 推向一个不存在的目的地」(§14 属主照准,core [ref]
|
|
1072
1047
|
* 回帖确认即原意)。
|
|
1073
1048
|
*
|
|
1074
|
-
* 🔴 **
|
|
1049
|
+
* 🔴 **[ref]:第 5 项(旧第 4 项 `volatile_ask_ledger` = 「账必须是持久的」,判据 `kind !== "local"`)
|
|
1075
1050
|
* 已整条删除,词也从闭集里删了(零别名)**。它当年成立的唯一输入是 local 车道交的 `InMemoryApprovalAskStore`;
|
|
1076
1051
|
* `FileApprovalAskStore` 落地后 `StoreBackend.approvalAsk()` 的三条腿全是持久店 ⇒ 这条合取项**没有任何
|
|
1077
1052
|
* 能让它为假的输入**,留着就是一条永不触发的规则(「修完让规则集更小」)。持久性的义务搬到
|
|
1078
1053
|
* `StoreBackend.approvalAsk()` 的接口契约上(那条注 + `wiring-governance-operator.test.ts` 的三腿机器钉)——
|
|
1079
1054
|
* 它是**装配面**的事实,而本谓词能看见的只有 `kind`,拿 `kind` 当持久性的代理正是这次要拆掉的那层间接。
|
|
1080
1055
|
*/
|
|
1081
|
-
export type StreamApprovalGate = {
|
|
1056
|
+
export type StreamApprovalGate<TStore extends GateCurrencyStore = GateCurrencyStore> = {
|
|
1082
1057
|
active: true;
|
|
1083
1058
|
askStore: ApprovalAskStore;
|
|
1059
|
+
checkpointStore: TStore;
|
|
1084
1060
|
} | {
|
|
1085
1061
|
active: false;
|
|
1086
1062
|
reason: "no_tool_approval" | "protocol_disabled" | "no_backend" | "no_park_facility";
|
|
1087
1063
|
};
|
|
1088
1064
|
/** {@link resolveStreamApprovalGate} 的入参。`backend` 用**结构形**(不 import `StoreBackend`):本模块是
|
|
1089
1065
|
* 协调器的家,不该为一个布尔判据把整棵 store 依赖树拖进类型面。 */
|
|
1090
|
-
export interface StreamApprovalGateInput {
|
|
1066
|
+
export interface StreamApprovalGateInput<TStore extends GateCurrencyStore = GateCurrencyStore> {
|
|
1091
1067
|
toolApprovalEnabled: boolean;
|
|
1092
1068
|
/** 协议总开关。⚠️ 调用点一律写 `config.streamApproval?.enabled === true` —— **可选链的缺席臂折算
|
|
1093
1069
|
* false**(段整段缺席 ⇒ 协议不上场)。
|
|
@@ -1101,14 +1077,16 @@ export interface StreamApprovalGateInput {
|
|
|
1101
1077
|
readonly kind: "mysql" | "pg" | "local";
|
|
1102
1078
|
approvalAsk(): ApprovalAskStore;
|
|
1103
1079
|
} | undefined;
|
|
1104
|
-
/** park
|
|
1105
|
-
*
|
|
1080
|
+
/** park 设施 = checkpoint 店本身:在场(非 `undefined`)即设施在场,上场时它随 `active` 臂交出去(与 `askStore` 同形)—— 在场性与实例是一个事实,调用点不必另持一份布尔再断言实例非空。
|
|
1081
|
+
* 类型只收店的形({@link GateCurrencyStore}:协调器读它的那两个口),`backend.checkpoint` 这种工厂方法过不了 tsc —— 全进程的店只有 stage-06 铸的那一只,装配点喂的是它,不是再造一只。
|
|
1082
|
+
* 本仓真码里 `checkpointStore` 的构造条件本身就是
|
|
1083
|
+
* `backend?.checkpoint !== undefined && config.durableApproval`,所以设计 §8.4 那条析取式的
|
|
1106
1084
|
* 「safety 词表非空」一支在**装配时刻**结构上不可达(core 的 irreversible/egress 集合来自 **per-task**
|
|
1107
1085
|
* 的 `spec.tools[].irreversibility/egress`,composition root 看不到)——两条缺失形因此在本仓收敛成
|
|
1108
1086
|
* 同一个 `no_park_facility`(D-5/D-6 两钉打的是两种**输入**形,不是两个 reason)。 */
|
|
1109
|
-
|
|
1087
|
+
checkpointStore: TStore | undefined;
|
|
1110
1088
|
}
|
|
1111
|
-
export declare function resolveStreamApprovalGate(input: StreamApprovalGateInput): StreamApprovalGate
|
|
1089
|
+
export declare function resolveStreamApprovalGate<TStore extends GateCurrencyStore>(input: StreamApprovalGateInput<TStore>): StreamApprovalGate<TStore>;
|
|
1112
1090
|
/**
|
|
1113
1091
|
* 审批开卡帧的**帧族词表**(闭集)—— wire 上一只 ask 的开卡帧可能属于的族:
|
|
1114
1092
|
* · `tool_approval`:旧族(活卡帧 `tool_approval` / 消卡帧 `tool_approval_complete`);
|
|
@@ -1122,6 +1100,64 @@ export declare function resolveStreamApprovalGate(input: StreamApprovalGateInput
|
|
|
1122
1100
|
*/
|
|
1123
1101
|
export declare const APPROVAL_FRAME_FAMILIES: readonly ["tool_approval", "approval_request"];
|
|
1124
1102
|
export type ApprovalFrameFamily = (typeof APPROVAL_FRAME_FAMILIES)[number];
|
|
1103
|
+
/**
|
|
1104
|
+
* 这台 worker **呈卡用的那一个族**(活卡协调器在场时)—— 全仓唯一的映射,三个读者:能力位 `approvalFrameFamilies`(`capability-facts.ts`,
|
|
1105
|
+
* 壳读它决定声明什么)、{@link resolveApprovalLeg}(腿判「这条 run 声明了没有」)与耐久事件流开流 preamble(`routes/runs.ts`:这条 run 名下的卡
|
|
1106
|
+
* 铸于声明了这一族的腿,卡作证的声明就是它)。各写一份三元式 = 壳照一份声明、服务端照另一份判,那正是 [ref] 要封的「两边各说各话」。
|
|
1107
|
+
* 入参 = {@link resolveStreamApprovalGate} 的 `active`。
|
|
1108
|
+
*/
|
|
1109
|
+
export declare function presentedApprovalFrameFamily(streamApprovalOn: boolean): ApprovalFrameFamily;
|
|
1110
|
+
/** 坏声明的拒体(fresh 受理面 400 `request.field_invalid`):一句话 + 机读位,形与 [ref] 座位族 / [ref] 三桶的 `bad_entry` 同。 */
|
|
1111
|
+
export interface ApprovalFrameFamiliesIssue {
|
|
1112
|
+
readonly message: string;
|
|
1113
|
+
readonly fields: {
|
|
1114
|
+
readonly field: "settings.approvalFrameFamilies";
|
|
1115
|
+
readonly reason: "bad_entry";
|
|
1116
|
+
readonly index?: number;
|
|
1117
|
+
};
|
|
1118
|
+
}
|
|
1119
|
+
/**
|
|
1120
|
+
* [ref] —— 请求面声明 `settings.approvalFrameFamilies` 的**唯一判官**:这条 run 的客户端渲染得了哪些审批开卡帧族。
|
|
1121
|
+
* 合法 = 数组,每项是 {@link APPROVAL_FRAME_FAMILIES} 里的词、各出现一次(空数组合法 = 一个族都不渲染,与缺席同读)。非数组 / 词表外 / 重复 ⇒ 拒体点名坐标。
|
|
1122
|
+
* 两个读者:fresh 受理门(`http/admission.ts`,400)与宽容读者 {@link declaredApprovalFrameFamilies}(续跑重放读存体)。入参是 `body.settings`
|
|
1123
|
+
* 本身(非对象 / 缺席 ⇒ 本判官不判,留给 `settings` 自己的形门)。拒句不回显调用方的字节,只报坐标与词表。
|
|
1124
|
+
*/
|
|
1125
|
+
export declare function approvalFrameFamiliesIssue(settings: unknown): ApprovalFrameFamiliesIssue | null;
|
|
1126
|
+
/**
|
|
1127
|
+
* [ref] —— 一条 run 声明的帧族集合(三条执行腿读的**唯一**读者;读的是这条 run 的请求体 `settings`:sync = 本次请求、bg = 受理过的提交体、
|
|
1128
|
+
* resume / wake = 持久化体 —— 声明随体重放,不另存)。缺席 ⇒ 空集。判官说不合法 ⇒ 空集:只有绕过受理门的存体走得到这一形,
|
|
1129
|
+
* 空集 = 这条腿没有活审批通道(问当场交无人值守政策口)—— 失效方向是不呈卡,不是猜一个族去呈。
|
|
1130
|
+
*/
|
|
1131
|
+
export declare function declaredApprovalFrameFamilies(settings: unknown): ReadonlySet<ApprovalFrameFamily>;
|
|
1132
|
+
/** 一条腿**没有活审批通道**的成因(见 {@link ApprovalLegAssembly.unattended});`frame_family_undeclared` 带上缺的那个族。 */
|
|
1133
|
+
export type LegUnattended = {
|
|
1134
|
+
readonly arm: "window_zero";
|
|
1135
|
+
} | {
|
|
1136
|
+
readonly arm: "frame_family_undeclared";
|
|
1137
|
+
readonly family: ApprovalFrameFamily;
|
|
1138
|
+
};
|
|
1139
|
+
/** {@link resolveApprovalLeg} 的入参(sync / bg / resume 三腿 + 开流 preamble 共用一份形)。 */
|
|
1140
|
+
export interface ApprovalLegInput {
|
|
1141
|
+
/** = `resolveStreamApprovalGate(...).active`(协议在本 worker 上场没有)。 */
|
|
1142
|
+
streamApprovalOn: boolean;
|
|
1143
|
+
/** `config.streamApproval.windowMs`(`STREAM_ASK_WINDOW_MS`)。
|
|
1144
|
+
* 🔴 [ref]:`undefined` = **这份装配没有 `streamApproval` 段**(只出现在只填被测键的 stub-harness ——
|
|
1145
|
+
* 真实 boot 无条件铸该段,见 `config.ts`)。此前三个调用点各写 `?? 0` 把这一形折成「0」,在旧语义下
|
|
1146
|
+
* 是死代码(`windowZero` 那时挂在 `streamApprovalOn` 后面,协议关就恒 false);[ref] 让 `0` 在协议关的
|
|
1147
|
+
* 腿上也真生效之后,那个折算会把一台**什么都没配**的 harness 判成「运维显式关窗」。故本字段收成
|
|
1148
|
+
* `number | undefined`,由每个调用点如实交出「有没有这个值」,不许再就地编一个。 */
|
|
1149
|
+
windowMs: number | undefined;
|
|
1150
|
+
/** `config.streamAskWindowMarginMs`(`STREAM_ASK_WINDOW_MARGIN_MS`)。 */
|
|
1151
|
+
windowMarginMs: number;
|
|
1152
|
+
/** `spec.limits.maxWalltimeMs`。缺席 = 没有 walltime 墙 ⇒ 第三源不参与(**缺席 ≠ 0**)。 */
|
|
1153
|
+
legWalltimeMs?: number;
|
|
1154
|
+
/** 本腿**开始执行的时刻**的 `performance.now()`。取值点绝不能挪到腿启动之后:误差方向必须是
|
|
1155
|
+
* 「窗偏短」(安全侧,§7.3 的误差方向论证)。 */
|
|
1156
|
+
nowMonotonicMs: number;
|
|
1157
|
+
/** [ref]:这条 run 声明的帧族(唯一读者 {@link declaredApprovalFrameFamilies},读本 run 的请求体 / 存体)。必填 —— 漏传的装配点编译红,
|
|
1158
|
+
* 不许有「没传 ⇒ 当作声明了」的默认。 */
|
|
1159
|
+
declaredFamilies: ReadonlySet<ApprovalFrameFamily>;
|
|
1160
|
+
}
|
|
1125
1161
|
/**
|
|
1126
1162
|
* [ref] 车3 刀 3b —— **一条执行腿的审批装配裁定**(sync / bg / resume **三腿共用**)。
|
|
1127
1163
|
*
|
|
@@ -1140,14 +1176,19 @@ export type ApprovalFrameFamily = (typeof APPROVAL_FRAME_FAMILIES)[number];
|
|
|
1140
1176
|
* `prepare-task.js` 的 durableMandate/contentMandate 与 durableQuestionFace 等),
|
|
1141
1177
|
* 故不在本函数内。
|
|
1142
1178
|
*
|
|
1143
|
-
* 🔴 **[ref](半接线旋钮族)
|
|
1179
|
+
* 🔴 **[ref](半接线旋钮族)**:关窗的第一源(`STREAM_ASK_WINDOW_MS=0`)自此**不再挂在
|
|
1144
1180
|
* `streamApprovalOn` 后面** —— 那是部署级旋钮,它的语义不该因为这台机器有没有 durable ask 账而改变
|
|
1145
|
-
* (`ApprovalLegAssembly.
|
|
1181
|
+
* (`ApprovalLegAssembly.unattended` 顶注写了那条病)。第三源(贴 deadline)照旧只在协议上场时参与。
|
|
1182
|
+
*
|
|
1183
|
+
* 🔴 **[ref]**:「这条腿有没有活审批通道」多一个成因 —— 这条 run 没声明本 worker 呈卡用的族。它与关窗是**同一件事**(不呈卡、问当场交政策口),
|
|
1184
|
+
* 所以进同一个字段(`unattended` 的成因词),三条腿零新分支;判据读 {@link presentedApprovalFrameFamily}(能力位读同一只)。
|
|
1185
|
+
* 判据**不**放进 {@link resolveStreamApprovalGate}:那是 worker 级谓词(协调器注入 / 能力位 / 回决 501 都没有 run),且它为假时腿退回旧族 `emit` ——
|
|
1186
|
+
* 正是「回退发 `tool_approval`」。
|
|
1146
1187
|
*
|
|
1147
|
-
*
|
|
1148
|
-
*
|
|
1149
|
-
* bg=runs.ts,resume=
|
|
1150
|
-
* resume 无装配点,不包 ALS 即等价」的缺席论证已退役,别再据它推断「少装一件也行」。
|
|
1188
|
+
* **没有活审批通道的两件事必须同时做**(调用方契约):不包 ALS **且** `spec.onAsk` = {@link ToolApprovalCoordinator.boundUnattendedAsk}(带成因)。
|
|
1189
|
+
* 只做一件另一条路仍会呈卡(ALS 腿是 `deps.onAsk` 的到达路;不包 ALS 也让这条腿不进 broker 活流集合 = 不是别的腿的卡的投递目标)。
|
|
1190
|
+
* ⚠️ [ref] 起**三腿都有** per-task `spec.onAsk` 装配点(sync=routes/tasks.ts,bg=runs.ts,resume=http/resume-legs.ts),第二件在三腿都是显式闭包 ——
|
|
1191
|
+
* 旧文「bg/resume 无装配点,不包 ALS 即等价」的缺席论证已退役,别再据它推断「少装一件也行」。
|
|
1151
1192
|
*/
|
|
1152
1193
|
export interface ApprovalLegAssembly {
|
|
1153
1194
|
/** 协议在本腿上是否上场。false ⇒ **既不包 ALS、也不接** `emitCard`/`emitRevoke`/`legKey`/
|
|
@@ -1157,28 +1198,29 @@ export interface ApprovalLegAssembly {
|
|
|
1157
1198
|
* 同 (owner, session) 活流呈活卡(sync 腿 [ref] 起本就如此;bg/resume 的这条行为差 = [ref] CHANGELOG
|
|
1158
1199
|
* 披露的行为面变更)。旧文「本腿逐字保持协议之前的行为」只对协议件成立,别再把它读成「协议关 = 零呈卡」。 */
|
|
1159
1200
|
active: boolean;
|
|
1160
|
-
/**
|
|
1161
|
-
*
|
|
1162
|
-
*
|
|
1163
|
-
*
|
|
1164
|
-
*
|
|
1165
|
-
*
|
|
1166
|
-
*
|
|
1167
|
-
*
|
|
1168
|
-
|
|
1169
|
-
|
|
1201
|
+
/** **这条腿没有活审批通道**(在场 ⇒ 不包 ALS、不是任何卡的投递目标、`spec.onAsk` 是 {@link ToolApprovalCoordinator.boundUnattendedAsk}
|
|
1202
|
+
* 席 —— 每只问当场交无人值守政策口,臂 = 本值)。缺席 ⇒ 这条腿按 {@link presentedApprovalFrameFamily} 的族呈卡。成因闭集两个,先后即判序:
|
|
1203
|
+
* · `window_zero`(§8.3)—— 运维关窗(`STREAM_ASK_WINDOW_MS=0`),或协议上场时本腿剩余 walltime 撑不住安全余量。
|
|
1204
|
+
* 🔴 [ref] 起与 `active` 解耦:`0` 是**部署级**旋钮,在两条车道上是同一个意思(旧形下关协议的部署配了 `0` 拿到的是等满 5min 的活卡)。
|
|
1205
|
+
* ⚠️ 「窗**缺席**」(`windowMs: undefined` = 这份装配根本没有 streamApproval 段,只出现在 stub-harness)**不是**关窗。
|
|
1206
|
+
* 排在声明之前:那时谁都不呈卡,缺的不是客户端的声明。
|
|
1207
|
+
* · `frame_family_undeclared`([ref])—— 这条 run 的请求没有声明本 worker 呈卡用的族(`settings.approvalFrameFamilies`)。判据对两个族同一条:
|
|
1208
|
+
* 不回退发另一族、不双发、没有「键缺席 ⇒ 视作旧族」的默认。
|
|
1209
|
+
* 三条腿只问「在场没有」,成因随席交给唯一铸点(遥测臂 + deny 政策的拒因句)。 */
|
|
1210
|
+
unattended?: LegUnattended;
|
|
1211
|
+
/** §7.3 本 leg 的 walltime deadline(`performance.now()` 单调基)。只在 `active ∧ 有活审批通道 ∧
|
|
1170
1212
|
* 有 walltime 墙` 时在场 —— 关着时供值会把既有 5min 活卡窗按三元公式缩短(§7.2 真行为变更)。 */
|
|
1171
1213
|
legDeadlineMonotonic?: number;
|
|
1172
1214
|
}
|
|
1173
1215
|
/**
|
|
1174
1216
|
* [ref] 车3 刀 3b(codex 交叉复审 round2 R2-1,2026-08-06 真 finding)—— 呈卡腿的**双 sink 投递口**(开卡帧 + 消卡帧)。
|
|
1175
1217
|
*
|
|
1176
|
-
* 🔴 为什么必须收成一个有属主的工厂:「呈卡帧送达」决定「卡到底有没有送到人手上」(见 `emitOne` 顶注;
|
|
1218
|
+
* 🔴 为什么必须收成一个有属主的工厂:「呈卡帧送达」决定「卡到底有没有送到人手上」(见 `emitOne` 顶注;[ref] 起呈卡腿只有这一族)。
|
|
1177
1219
|
* sync 腿原来那个内联闭包把两个 sink 的失败都吞掉、然后**正常返回** —— 于是「账本写失败 ∧ socket 已死」这种**真的一路都没送到**的
|
|
1178
1220
|
* 情形被上报成成功,`anySucceeded` 因此压住了 park 路由。诚实的形只有一个:**至少一个 sink 真的接下了才算送达**,一个都没接下就抛 ——
|
|
1179
1221
|
* 调用点(`emitOne`)的 catch 会把它如实记成没送到。
|
|
1180
1222
|
*
|
|
1181
|
-
* 🔴 **两只 sink 各自推进、各自配对**(
|
|
1223
|
+
* 🔴 **两只 sink 各自推进、各自配对**([ref] codex 一轮 F1 / F2,红先钉在 `test/approval-leg-frame-family.test.ts`):
|
|
1182
1224
|
* · 开卡帧同时交两只 sink,**任一只接下即算送达**(不按序串行 —— 旧族退场后 live 面只剩呈卡族这一条路,一只挂住的账本写不能挡住
|
|
1183
1225
|
* 健康的 live 出口;修前先 await 账本再写 live)。两只都失败才抛。
|
|
1184
1226
|
* · 消卡帧只交给**接下过本卡开卡帧**的那只 sink,且排在该 sink 自己的开卡写之后(每只 sink 内开在合前;没接下开卡的 sink 不收消卡 =
|
|
@@ -1196,24 +1238,15 @@ export declare function createApprovalCardEmitter(sinks: {
|
|
|
1196
1238
|
/** live SSE 口。**已死的流应当由调用方判成缺席或让它抛**,不要写一个静默 no-op —— 那正是本 finding。 */
|
|
1197
1239
|
writeLive?: (frame: ApprovalCardLegFrame) => void | Promise<void>;
|
|
1198
1240
|
}): (frame: ApprovalCardLegFrame, registration: string) => Promise<void>;
|
|
1199
|
-
export declare function resolveApprovalLeg(input:
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
windowMs: number | undefined;
|
|
1209
|
-
/** `config.streamAskWindowMarginMs`(`STREAM_ASK_WINDOW_MARGIN_MS`)。 */
|
|
1210
|
-
windowMarginMs: number;
|
|
1211
|
-
/** `spec.limits.maxWalltimeMs`。缺席 = 没有 walltime 墙 ⇒ 第三源不参与(**缺席 ≠ 0**)。 */
|
|
1212
|
-
legWalltimeMs?: number;
|
|
1213
|
-
/** 本腿**开始执行的时刻**的 `performance.now()`。取值点绝不能挪到腿启动之后:误差方向必须是
|
|
1214
|
-
* 「窗偏短」(安全侧,§7.3 的误差方向论证)。 */
|
|
1215
|
-
nowMonotonicMs: number;
|
|
1216
|
-
}): ApprovalLegAssembly;
|
|
1241
|
+
export declare function resolveApprovalLeg(input: ApprovalLegInput): ApprovalLegAssembly;
|
|
1242
|
+
/**
|
|
1243
|
+
* 🔴 **开流 preamble 往本连接投卡与否的唯一判据**([ref] / H5)—— 两条 preamble 共用:sync 腿(`routes/tasks.ts`,入参的声明读本次请求的 `settings`:
|
|
1244
|
+
* 那条连接列的是整个会话的卡)与耐久事件流(`routes/runs.ts`,那条连接只列这条 run 名下的卡,而无通道的腿一张卡都不落 ⇒ 声明由卡作证,入参 =
|
|
1245
|
+
* {@link presentedApprovalFrameFamily})。preamble 也是往本连接投卡:只在本腿**有活审批通道**时重放、订消卡 ——
|
|
1246
|
+
* 协议在本 worker 上场、没关窗、这条 run 声明了本 worker 呈卡用的族;与本腿呈不呈卡是同一只装配({@link resolveApprovalLeg}),不在 preamble 一侧另写一份合取式。
|
|
1247
|
+
* 为假 ⇒ 零帧且零 ask 账读(与「协议未上场」同形)。时钟不参与这一判:`nowMonotonicMs` 只喂 `legDeadlineMonotonic`(窗长三元),不进 `unattended` 的三个成因。
|
|
1248
|
+
*/
|
|
1249
|
+
export declare function approvalPreambleReplays(input: Omit<ApprovalLegInput, "nowMonotonicMs">): boolean;
|
|
1217
1250
|
/** 一条 **DECIDED 行**能交还给引擎的全部形(`AskOutcome` 减掉 park 路由那一臂 —— 一条有决议的行
|
|
1218
1251
|
* 从定义上不是「投递面拿走了它」)。{@link ToolApprovalCoordinator.notifyExternalDecision} 收的就是它。 */
|
|
1219
1252
|
export type DecidedAskOutcome = Exclude<AskOutcome, "unavailable">;
|
|
@@ -1222,7 +1255,7 @@ type DecidedRowFacts = Pick<AskRow, "decision" | "settledBy"> & {
|
|
|
1222
1255
|
updatedInput?: unknown;
|
|
1223
1256
|
};
|
|
1224
1257
|
/**
|
|
1225
|
-
* 🔴 **一条 DECIDED 行 → 交还给引擎的那个 outcome:全仓唯一铸点**(
|
|
1258
|
+
* 🔴 **一条 DECIDED 行 → 交还给引擎的那个 outcome:全仓唯一铸点**([ref])。
|
|
1226
1259
|
*
|
|
1227
1260
|
* 存在理由 = 这条投影此前被**手抄**在每个消费点上(`row.decision === "approve"` + `row.updatedInput`,
|
|
1228
1261
|
* 六处),于是给行加一格新事实就得记得改六处 —— `settledBy` 正是那个没人改到的格:一次**策略拒**在
|
|
@@ -1233,10 +1266,10 @@ type DecidedRowFacts = Pick<AskRow, "decision" | "settledBy"> & {
|
|
|
1233
1266
|
* · **方向** —— `decision !== "approve"` 即拒(列的二值由店的 CAS 保证);
|
|
1234
1267
|
* · **编辑载荷**([ref])—— `updatedInput` 键缺席 = 没带编辑 ⇒ 裸 `true`;在场(**含 `null`**)= 编辑的
|
|
1235
1268
|
* 字面值 ⇒ 对象臂(语义三态的唯一属主 = `AskRow.updatedInput` 顶注);
|
|
1236
|
-
* · **结算来源**(
|
|
1269
|
+
* · **结算来源**([ref])—— 行上非 null 即宿主自报的那个词(`null` = 人决,与「不铸这个键」同义;
|
|
1237
1270
|
* 语义属主 = `AskRow.settledBy` 顶注)。
|
|
1238
1271
|
*
|
|
1239
|
-
* 🔴
|
|
1272
|
+
* 🔴 [ref]:来源位**两向都读**。决定体的出处位 `decidedBy:"policy"` 在 allow 与 deny 上都会落列(引擎 7.39.0 起铸
|
|
1240
1273
|
* `policy_allowed`),所以 approve 行带来源位是一条合法的行,它的每条读回路径交还 `{allow:true, settledBy:"policy", updatedInput?}`
|
|
1241
1274
|
* —— 与当次回决交给引擎的那一只逐字同形。
|
|
1242
1275
|
*/
|
|
@@ -1321,7 +1354,7 @@ export declare class ToolApprovalCoordinator {
|
|
|
1321
1354
|
* `pollSuspendedDecisions` 里那段:按 askId 记的形会在「上一拍最后碰的那条被结算掉」时塌回队首,
|
|
1322
1355
|
* 构造出永久饥饿的前缀)。只回答「上一拍扫到第几个」,单调推进、按当前长度取模。 */
|
|
1323
1356
|
private suspendedPollOffset;
|
|
1324
|
-
/**
|
|
1357
|
+
/** [ref]:悬挂轮询腿第二层(接管登记)的轮转游标 —— 与 {@link suspendedPollOffset} 同一条理由,两层各一只。 */
|
|
1325
1358
|
private adoptedPollOffset;
|
|
1326
1359
|
/** [ref] + codex R3-[critical]:askId → **此刻正带着 `updatedInput` 决它的请求数**(见
|
|
1327
1360
|
* {@link markEditedDecisionInFlight} 顶注)。只在 `decideAsk` 那一次调用期间非空,故天然有界。 */
|
|
@@ -1360,12 +1393,15 @@ export declare class ToolApprovalCoordinator {
|
|
|
1360
1393
|
* 构造之后才装配;同款 holder 先例 = main.ts 的 `getRunDenySweep`)。取到 undefined ⇒ 该臂逐字回落
|
|
1361
1394
|
* 修前 404,partial 部署安全。 */
|
|
1362
1395
|
private readonly parkedRedeem;
|
|
1396
|
+
/** [ref]:按问读口对 `PARKED` 卡的门读席(见 {@link ParkedGateRead})。缺席(没有 checkpoint 店的部署 / 只装 ask 账的嵌入)⇒ 读口只能说行说的话(`parked`)。
|
|
1397
|
+
* 不是晚绑取值口:checkpoint 店在协调器构造之前就装好了(`boot/stage-06`),与 `parkCommits` 同一只店。 */
|
|
1398
|
+
private readonly parkedGate;
|
|
1363
1399
|
/** [ref] 裁 (c):local 车道的 File ask **审计** sink(在场 ⇔ `DB_BACKEND=local` ∧ 审批面开着,装配点
|
|
1364
1400
|
* `boot/coordinators.ts`)。三个挂线点:铸造(askBroadcast register 后)/ 决议(`settle()` 公共咽喉)/
|
|
1365
1401
|
* 腿闭(`runWithContext` finally)。**纯观察面**:sink 自己吞写失败并 `recordFailOpen`,任何一次审计
|
|
1366
1402
|
* 写都不得改变审批终局(店头注成文)。SQL 车道恒缺席(那里有真 ask 店)。 */
|
|
1367
1403
|
private readonly askAudit;
|
|
1368
|
-
/**
|
|
1404
|
+
/** [ref] 候裁 16 → A:耐久会话授权店(`/decide` 的 `remember:"session"` 写、本席读)。在场 ⇔ 部署有 store backend
|
|
1369
1405
|
* (装配点 `boot/coordinators.ts`,与 `/decide` 写的是**同一只**店)。读口唯一 = {@link standingGrantSettles};写口唯一 = {@link recordDeploymentListAnswer}
|
|
1370
1406
|
* (活卡上部署名单那一问的「本会话放行」)。 */
|
|
1371
1407
|
private readonly sessionGrants;
|
|
@@ -1373,13 +1409,13 @@ export declare class ToolApprovalCoordinator {
|
|
|
1373
1409
|
* 缺席(没有豁免店的装配)⇒ 没有一张卡读作名单的问 —— 名单那一问的答案没有地方记,它就按引擎的类表读(记不住)。
|
|
1374
1410
|
* 活的一问(`AskRequest`)上只有 wire 名(没有调用的别名面)⇒ 名单靠别名命中的调用读不出属主,按引擎的问读(记不住;方向是多问)。 */
|
|
1375
1411
|
private readonly deploymentListAsks;
|
|
1376
|
-
/**
|
|
1412
|
+
/** [ref]:有序关停已开始(`drainForShutdown` 锁存,不复位 —— 进程正在退出)。之后登记的每一张卡在登记那一刻按关停收场。 */
|
|
1377
1413
|
private shutdownDraining;
|
|
1378
|
-
/**
|
|
1414
|
+
/** [ref]:此刻在 `askBroadcast` 里的 ask 数(进出成对,见那里的 try/finally)—— 关停等待「还没登记进 `pending` 的卡」的计数。 */
|
|
1379
1415
|
private asksInFlight;
|
|
1380
|
-
/**
|
|
1416
|
+
/** [ref] F1:park 提交的观察面(checkpoint 店的装饰层;在场 ⇔ 本部署有 park 设施,装配点 `boot/stage-06-runners.ts`)。 */
|
|
1381
1417
|
private readonly parkCommits;
|
|
1382
|
-
/**
|
|
1418
|
+
/** [ref] F1:有序关停下路由到 park、**处置尚未被观察到**的卡 —— 审计 settle 行在这里候着({@link settleParksAwaitingCommit})。
|
|
1383
1419
|
* 只在关停期有成员(进程随后退出,不需要回收)。 */
|
|
1384
1420
|
private readonly parksAwaitingCommit;
|
|
1385
1421
|
constructor(opts?: {
|
|
@@ -1401,6 +1437,8 @@ export declare class ToolApprovalCoordinator {
|
|
|
1401
1437
|
ruleScopeRootFor?: (sessionId: string | undefined) => string | undefined;
|
|
1402
1438
|
/** [ref]:PARKED 臂赎回席的**晚绑取值口**(见 {@link ToolApprovalCoordinator.parkedRedeem})。 */
|
|
1403
1439
|
parkedRedeem?: () => ParkedAskRedeem | undefined;
|
|
1440
|
+
/** [ref]:按问读口的门读席(见 {@link ToolApprovalCoordinator.parkedGate})。 */
|
|
1441
|
+
parkedGate?: ParkedGateRead;
|
|
1404
1442
|
/** [ref]:受理回执表两道界(缺省见 {@link DEFAULT_PARK_REDEMPTION_MAX}/{@link DEFAULT_PARK_REDEMPTION_TTL_MS})。
|
|
1405
1443
|
* 不是部署旋钮(不接 env),可注入只为让「有界」这件事被判据观测得到。 */
|
|
1406
1444
|
parkRedemptionMax?: number;
|
|
@@ -1409,26 +1447,26 @@ export declare class ToolApprovalCoordinator {
|
|
|
1409
1447
|
parkRedemptionPerPrincipalMax?: number;
|
|
1410
1448
|
/** [ref] (c):local 车道审计 sink(见 {@link ToolApprovalCoordinator.askAudit})。 */
|
|
1411
1449
|
askAudit?: ApprovalAskAuditSink;
|
|
1412
|
-
/**
|
|
1450
|
+
/** [ref] 候裁 16:耐久会话授权店(见 {@link ToolApprovalCoordinator.sessionGrants})。 */
|
|
1413
1451
|
sessionGrants?: SessionGrantStore;
|
|
1414
1452
|
/** 问的属主的读法(见 {@link ToolApprovalCoordinator.deploymentListAsks})。只能与 `sessionGrants` 同在:名单那一问的答案就记在那只店里。 */
|
|
1415
1453
|
deploymentListAsks?: (call: {
|
|
1416
1454
|
readonly toolName: string;
|
|
1417
1455
|
}) => boolean;
|
|
1418
|
-
/**
|
|
1456
|
+
/** [ref] F1:park 提交的观察面(见 {@link ToolApprovalCoordinator.parkCommits})。 */
|
|
1419
1457
|
parkCommits?: ParkCommitWatch;
|
|
1420
1458
|
});
|
|
1421
1459
|
/**
|
|
1422
1460
|
* [ref] R-13 C —— 「**无人可答**」这一类终局的**唯一**成形口(park 路由 vs deny 政策)。
|
|
1423
1461
|
*
|
|
1424
|
-
* 终局形(
|
|
1462
|
+
* 终局形([ref]):park ⇒ `"unavailable"`;deny ⇒ {@link UnattendedPolicyRefusal}
|
|
1425
1463
|
* `{allow:false, settledBy:"policy", reason}`(core 记 `policy_refused`)。**从不**交裸 `false`:那在 core 的
|
|
1426
1464
|
* onAsk 契约里是「一个人拒了」,而本口的全部臂都是「没有人能答」。
|
|
1427
1465
|
*
|
|
1428
1466
|
* 五臂(设计稿 §1 的表)全部读它,`unattendedPolicy` 因此是一处施加、五处消费:
|
|
1429
1467
|
* (a) 有店窗到期 `expireAsk` 赢 CAS / (b) 无店窗到期(D1)/ (c) 有店但 `expireAsk` 报错
|
|
1430
1468
|
* —— 三条走 `windowRouteUnavailable` 标志,在 {@link shapeOutcome}(askBroadcast 内)成形;
|
|
1431
|
-
* (d)
|
|
1469
|
+
* (d) 没有活审批通道的腿(装配层短路:关窗 / 未声明呈卡族,[ref])与无 ALS 上下文的 headless 腿 —— 走本方法/{@link ask};
|
|
1432
1470
|
* (e) 断连 `forceParkNow` / emit 全灭 / 写侧准入超限 —— 走本方法。
|
|
1433
1471
|
*
|
|
1434
1472
|
* **持久回放的两个口也归它管**(codex R1-F1 验真后收口,红先钉在
|
|
@@ -1438,7 +1476,7 @@ export declare class ToolApprovalCoordinator {
|
|
|
1438
1476
|
* 的终局会取决于「谁赢了那把 CAS」「重试没重试」—— 比残余更坏的不可解释性。人的**真决议**(回放出
|
|
1439
1477
|
* `true`/`false`)当然不过这个口:那不是「无人可答」。
|
|
1440
1478
|
*
|
|
1441
|
-
* **`ensureAsk` 的两条兜底臂也归它管**(
|
|
1479
|
+
* **`ensureAsk` 的两条兜底臂也归它管**([ref],7.100.0 合并复审 opus 腿 E1;此前两臂直接交裸 `"unavailable"`,是这句
|
|
1442
1480
|
* 「唯一成形口」的例外):行不可用(`persisted_row_unusable`:信封形不合 / deadline 越界)与身份不定(`ensure_indeterminate`:
|
|
1443
1481
|
* ensure 失败且复核读全失败)。两臂的**处置**不变 —— 不编造 wire 身份、不在身份未定时呈卡收人决(fail-closed)—— 变的只是
|
|
1444
1482
|
* 「不呈卡之后交什么」:它们同样是「这只 ask 没有人能答」,于是同样过这个口(park ⇒ `"unavailable"` 逐字不变;deny ⇒
|
|
@@ -1450,9 +1488,9 @@ export declare class ToolApprovalCoordinator {
|
|
|
1450
1488
|
* `refuse` 意图(政策→意图的唯一映射在 `approval-policy-settlement.ts` 的 `settleByPolicy`)—— STREAM_PENDING→DECIDED(deny) + `settled_by = "policy"`,**按 ask
|
|
1451
1489
|
* 作用域**(不碰批、不连坐兄弟)。落的来源词与本口交给 core 的是**同一个常量**(`POLICY_REFUSAL_DECISION`),于是
|
|
1452
1490
|
* 同 ask 重入 / 收敛后重入由 `outcomeOfDecidedRow` 读回同一个对象。当年「危害为零」的论证(PARKING 行绑不上、
|
|
1453
|
-
* 自行收敛成 DENIED/VOID)在
|
|
1491
|
+
* 自行收敛成 DENIED/VOID)在 [ref] 之后不再成立:首判交 `{allow:false, settledBy:"policy"}`,行停 PARKING 的回放
|
|
1454
1492
|
* 却交裸 `false`(收敛后 DENIED 无来源)—— core 当成人拒、可停批,两次判决第一次可被观测地分家。
|
|
1455
|
-
*
|
|
1493
|
+
* [ref] / [ref] 把同一只 claim 接到了另外三处:两条兜底臂({@link landUnattendedOutcome})与崩溃恢复腿(收敛器孤儿段,
|
|
1456
1494
|
* 它是窗到期竞争者在崩溃后的补位)—— 四处调的是**一只** `settleByPolicy`,谁也不自己挑意图。deny 部署上仍按 PARKING
|
|
1457
1495
|
* 记账的只剩一形:别的写者(park 政策副本 / 切换政策之前)推进过的行,重入走本口(`replayed_parked`)。
|
|
1458
1496
|
* deny 政策下批仍是**单 ask 批**(见 {@link batchIdFor}):`refuse` 本来就不碰批,单 ask 批让新行与存量整腿批行
|
|
@@ -1461,28 +1499,27 @@ export declare class ToolApprovalCoordinator {
|
|
|
1461
1499
|
private unattendedOutcome;
|
|
1462
1500
|
/** 政策**读**口(不是终局铸口)—— 回答「这台部署把无人可答翻成 park 吗」。
|
|
1463
1501
|
*
|
|
1464
|
-
* 🔴 与 {@link unattendedOutcome} 分家是
|
|
1502
|
+
* 🔴 与 {@link unattendedOutcome} 分家是 [ref] 的一半:此前两件事共用一只方法,于是 park 路由判别那次
|
|
1465
1503
|
* 纯粹的**政策查询**(`unattendedOutcome() !== false`)会和同一只 ask 的真终局各记一条遥测 ——
|
|
1466
1504
|
* 「一只 ask 一条线」当场不成立。读口不落日志,铸口落;谁也不兼职。 */
|
|
1467
1505
|
private get unattendedRoutesToPark();
|
|
1468
1506
|
/**
|
|
1469
|
-
* 一只 ask 落在**哪只批**里 —— 批作用域随政策(
|
|
1507
|
+
* 一只 ask 落在**哪只批**里 —— 批作用域随政策([ref] codex R1-F1,判据全文见 {@link deriveAskScopedBatchId})。
|
|
1470
1508
|
* · park 路由 ⇒ 整腿一批(`deriveBatchId`):窗到期赢家整批转投递面、兄弟连坐,core 随后 park,腿就此结束;
|
|
1471
1509
|
* · deny 政策 ⇒ 单 ask 批:没有 park 路由,腿在一次部署政策拒之后继续跑 —— 整腿一批会让首只到期把批关掉,
|
|
1472
1510
|
* 同腿后续的卡人批不动(`decideAsk` batch_closed ⇒ 404),兄弟还被连坐成 VOID、以裸 `false` 交 core(人拒)。
|
|
1473
1511
|
* 读的是政策**读**口(不落遥测)。
|
|
1474
1512
|
*/
|
|
1475
1513
|
private batchIdFor;
|
|
1476
|
-
/** {@link unattendedOutcome}
|
|
1477
|
-
* (`
|
|
1478
|
-
|
|
1479
|
-
unattendedAskOutcome(site: {
|
|
1514
|
+
/** {@link unattendedOutcome} 的**公开**口:没有活审批通道的腿({@link ApprovalLegAssembly.unattended})的席长在装配层,它必须与协调器内
|
|
1515
|
+
* 五臂读**同一个**政策值,而不是各算一遍。成因(`why`)与出处随调用方给(那条腿知道自己为什么不呈卡、是哪一只 ask)。 */
|
|
1516
|
+
unattendedAskOutcome(site: LegUnattended & {
|
|
1480
1517
|
taskId?: string;
|
|
1481
1518
|
owner?: string | null;
|
|
1482
1519
|
toolName?: string;
|
|
1483
1520
|
}): UnattendedAskOutcome;
|
|
1484
1521
|
/**
|
|
1485
|
-
*
|
|
1522
|
+
* [ref] —— 两条兜底臂的「无人可答」终局的**落行**半场。交给 core 的值已由 {@link unattendedOutcome} 一处铸好,这里只回答
|
|
1486
1523
|
* 「这条持久行上落什么」,判据是「交出去的是不是**结算**」(行 = 真源:交出去的结算必须同时是行上的结算,否则同 ask 重入 /
|
|
1487
1524
|
* 收敛后重入回放出来的是另一个答案 —— NP-2 在 live 腿上收掉的同一种分家):
|
|
1488
1525
|
* · park 路由(`"unavailable"`)不是结算 ⇒ 行**不动**:它留在 STREAM_PENDING,投递面由既有机器接(崩溃恢复腿按政策代打),
|
|
@@ -1492,7 +1529,7 @@ export declare class ToolApprovalCoordinator {
|
|
|
1492
1529
|
* 🔴 **只对「本次调用插下的」行调用**(调用方的义务;codex 对抗复审 F1 + R2-2 / [ref] 件2 同一条纪律「放弃收尾只许动本次插入的
|
|
1493
1530
|
* 行」):兜底臂发生在**窗开之前** —— 一条幂等命中的 STREAM_PENDING 行此刻可能正被别的登记(另一副本 / 另一版本 / 重入)呈卡、
|
|
1494
1531
|
* 有人正要按;当场 refuse 等于把一张活卡在它自己的窗走完之前作废。所以归属证不出(幂等命中、ensure 报错、迟到结果
|
|
1495
|
-
* `inserted:false`)⇒ 本方法不被调用、行不动:它的属主按自己的窗收场,属主不在了由收敛器孤儿段(同一只 claim,
|
|
1532
|
+
* `inserted:false`)⇒ 本方法不被调用、行不动:它的属主按自己的窗收场,属主不在了由收敛器孤儿段(同一只 claim,[ref])在
|
|
1496
1533
|
* 窗过 + 宽限之后落同一个政策结算。`row.batchId` 恒取**行上**的批(claim 的 scope;本地派生的批可能与存量行不同,
|
|
1497
1534
|
* 错 scope 的 claim 答 absent,不证明「行上没有决议」—— codex F1)。
|
|
1498
1535
|
*
|
|
@@ -1579,7 +1616,7 @@ export declare class ToolApprovalCoordinator {
|
|
|
1579
1616
|
*/
|
|
1580
1617
|
beginDrain(): void;
|
|
1581
1618
|
/**
|
|
1582
|
-
* 🔴 **
|
|
1619
|
+
* 🔴 **[ref] —— 有序关停的审批面收尾(一只;`boot/shutdown.ts` 的 `hardShutdown` 起点调,SIGTERM / SIGINT / SIGHUP 三条停止路同一处)。**
|
|
1583
1620
|
*
|
|
1584
1621
|
* 病(cli [ref] S7):修前关停序不碰协调器 ⇒ 本进程握着的活卡在下一次 boot 被审计收敛器标成 `crashed_before_park`,
|
|
1585
1622
|
* 用户屏上看到「crashed」而实为有序重启。
|
|
@@ -1587,7 +1624,7 @@ export declare class ToolApprovalCoordinator {
|
|
|
1587
1624
|
* 三步:
|
|
1588
1625
|
* ① 本进程握着的**每一张**未决卡(可达 / 悬挂 / 委派子代,不挑)按**断连同路**收场 —— {@link PendingApproval.forceParkNow}(park 路由;
|
|
1589
1626
|
* `deny` 政策下是部署政策拒;有持久 ask 店时走同一把终局 claim)。有序关停与断连是同一件事:投递面要没了,**不是**有人拒了
|
|
1590
|
-
* (不交裸 `false`,
|
|
1627
|
+
* (不交裸 `false`,[ref] 同律)。审计 settle 行携 `cause:"shutdown_before_park"`(`forceParkNow` 的调用点点名它);
|
|
1591
1628
|
* ② 在 `deadlineMs` 之前等:未决卡结清、在飞腿闭合(闭了的腿照常落 `leg_closed`)、**本次路由到 park 的卡全部结清**
|
|
1592
1629
|
* (F1:观察到 core 已处置这次调用 —— 停车行提交或承载它的腿退场 ⇒ 那张卡的审计 settle 行此刻才写,见 {@link settleParksAwaitingCommit})、
|
|
1593
1630
|
* 店里在飞的 `put` 静默;
|
|
@@ -1608,7 +1645,7 @@ export declare class ToolApprovalCoordinator {
|
|
|
1608
1645
|
}>;
|
|
1609
1646
|
}>;
|
|
1610
1647
|
/**
|
|
1611
|
-
*
|
|
1648
|
+
* [ref] F1:checkpoint 店的观察层报「一只审批停车行提交了」({@link CommittedParkCalls}:行自己陈述的会话与握着的调用)⇒ 候着的
|
|
1612
1649
|
* **同一次调用**结清:执行会话**相等**(候者记的是 ask 自己陈述的发起会话,行陈述的是它停住的会话 —— core 同一个变量)∧ 调用 id ∈ 行握着的调用。
|
|
1613
1650
|
* 不做「会话相交」:调用 id 只在 run 内唯一(父子各自的第一只调用常同名),宿主会话若作子代的等价别名,宿主停车行一提交就会冒充子代的提交(车 SO)。
|
|
1614
1651
|
* 只在关停期有候者;非关停期的提交一个不碰。
|
|
@@ -1616,7 +1653,7 @@ export declare class ToolApprovalCoordinator {
|
|
|
1616
1653
|
*/
|
|
1617
1654
|
private noteParkCommitted;
|
|
1618
1655
|
/**
|
|
1619
|
-
*
|
|
1656
|
+
* [ref] F1 的**结清口**(一处):有序关停下 park 路由的卡,在**观察到 core 已处置这次调用**时写它的审计 settle 行 —— 两种观察,同一件事实:
|
|
1620
1657
|
* · `park-committed` —— 停车行提交了(观察层看到 `put` 落定,或 core 回读确认的那一次 `get` 读到了行);
|
|
1621
1658
|
* · `leg-closed` —— **承载它的那条腿**退场了(`runWithContext` finally 按 ctx 身份配 {@link ParkAwaitingCommit.carrierLeg}:core 已走完这条腿 ——
|
|
1622
1659
|
* 停靠了,或拒了停靠 fail-closed 继续)。
|
|
@@ -1659,12 +1696,12 @@ export declare class ToolApprovalCoordinator {
|
|
|
1659
1696
|
* 投递到哪条连接不参与 —— 见 {@link AskOriginIdentity} 顶注。 */
|
|
1660
1697
|
private governanceForcedOf;
|
|
1661
1698
|
/**
|
|
1662
|
-
* 🔴 **
|
|
1699
|
+
* 🔴 **[ref] 候裁 16 → A —— 站着的答案(会话授权)的唯一兑现口**(主会话裁定 2026-09-29;core 7.34.0 wire 段逐字指定的兑现位:
|
|
1663
1700
|
* 「a host approval seat that settles asks from a session grant reads it [`authoredBy`] to keep its hands off」)。
|
|
1664
1701
|
*
|
|
1665
1702
|
* **一条判据**:一只 ask 由会话授权代答 ⇔ ① 判据说它的站着的答案在本席({@link standingAnswerHome} 答 `seat` —— 治理强制 /
|
|
1666
1703
|
* `requiresRealApproval` / `mandated` 三位的既有排除一字不动;运维「恒问人」的卡(`APPROVAL_NEVER_AUTO` / 耐久预算耗尽)
|
|
1667
|
-
* 自
|
|
1704
|
+
* 自 [ref] 起盖部署出身 ⇒ core 盖 `mandated`,同落这一臂)∧ ② 有真会话 ∧ ③ 两只授权店任一命中:live `allow_session` 的
|
|
1668
1705
|
* 进程内表(按能力桶,[ref]② 修2)或耐久 `/decide` `remember:"session"` 的豁免店(按 canonical 工具名,`/decide` 写的同一只店;
|
|
1669
1706
|
* 读失败 ⇒ 不命中 = fail-closed,人多看一张卡而不是被静默代答)∧ ④ 行上没有与本地 peek 矛盾的出处({@link sessionGrantUncontestedByRow})。
|
|
1670
1707
|
*
|
|
@@ -1685,21 +1722,22 @@ export declare class ToolApprovalCoordinator {
|
|
|
1685
1722
|
* 问已经发出去了)。 */
|
|
1686
1723
|
private durableGrantHas;
|
|
1687
1724
|
/**
|
|
1688
|
-
* 🔴 **
|
|
1689
|
-
* (sync `http/routes/tasks.ts`、bg `runs.ts`、resume `http/resume-legs.ts`)
|
|
1725
|
+
* 🔴 **[ref] 候裁 16 —— 无通道席**(旧名「窗 0 席」):本席**不呈卡**,但在报「无人可答」之前先问站着的答案。装配点 = 三条腿上没有活审批通道
|
|
1726
|
+
* 的那一支({@link ApprovalLegAssembly.unattended} 在场;sync `http/routes/tasks.ts`、bg `runs.ts`、resume `http/resume-legs.ts`),成因 `why`
|
|
1727
|
+
* 随席交给唯一铸点(遥测臂 + deny 政策的拒因句;[ref] 起两个成因:关窗 / 这条 run 没声明呈卡族)。修前三处是装配层的就地闭包 `() => unattendedAskOutcome(...)`
|
|
1690
1728
|
* —— 不读授权,引擎那一问(模式写门 / 形状层)在窗 0 部署上 remember 恒无效。改形后:授权命中 ⇒ `true`;否则逐字走
|
|
1691
1729
|
* {@link unattendedAskOutcome} 这**一个**政策口(五臂一处施加,[ref] R-13 C 不变)。
|
|
1692
1730
|
* parked 赎回腿的继承条目席**不**改:那条腿上到席的问全是继承问(core 盖 `mandated`),本席依约不退役,改了也兑现不了任何东西 ——
|
|
1693
1731
|
* 赎回腿上那类问的授权照旧由重建链里 durable 名单门的策略层探针兑现(锚 = 行的 root 会话)。复活子代**自己的**引擎问(模式写门 /
|
|
1694
|
-
* 形状层)则经赎回腿铸的 execute ctx `onAsk` 落本席(身份 = 行的 root 会话,
|
|
1732
|
+
* 形状层)则经赎回腿铸的 execute ctx `onAsk` 落本席(身份 = 行的 root 会话,[ref] 四续 ⑪,`parked-decide.ts` `approverSeatFor`)。
|
|
1695
1733
|
*/
|
|
1696
1734
|
boundUnattendedAsk: (identity: {
|
|
1697
1735
|
owner: string | null;
|
|
1698
1736
|
taskId: string;
|
|
1699
1737
|
sessionId?: string;
|
|
1700
|
-
}) => ((req: AskRequest) => Promise<AskOutcome>);
|
|
1738
|
+
}, why: LegUnattended) => ((req: AskRequest) => Promise<AskOutcome>);
|
|
1701
1739
|
/**
|
|
1702
|
-
* 🔴 session grant 短路前的**持久出处复核**([ref] 的 codex R1-[high] 补丁;[ref] 换判据;
|
|
1740
|
+
* 🔴 session grant 短路前的**持久出处复核**([ref] 的 codex R1-[high] 补丁;[ref] 换判据;[ref] / SN-C1 换读口)。
|
|
1703
1741
|
*
|
|
1704
1742
|
* 回 `true` = 「这次调用在这条腿上从来没有过持久出处」⇒ 一揽子放行可以短路;
|
|
1705
1743
|
* 回 `false` = 这次调用在腿内有行(任何状态、任何 ask 身份),**或**读不出来(不知道 = 不放宽)⇒ 调用方必须往下走真出卡。
|
|
@@ -1708,10 +1746,10 @@ export declare class ToolApprovalCoordinator {
|
|
|
1708
1746
|
* 而 `ensureAsk` 会写行。为什么一行都没有就放行:这次调用在这条腿上的行只可能由**这次调用的某一问**铸出来,
|
|
1709
1747
|
* 一行都没有 ⇒ 从来没有过一份能反驳本地判据的持久出处(这也是常见形:grant 命中的调用多半是头一次到)。
|
|
1710
1748
|
*
|
|
1711
|
-
* ## 争议按**调用**判,不按 ask 身份判(
|
|
1749
|
+
* ## 争议按**调用**判,不按 ask 身份判([ref] / SN-C1)
|
|
1712
1750
|
*
|
|
1713
1751
|
* 争议的真源是调用:人对这次调用说过什么、这次调用还有没有一张卡挂着。ask 身份(`deriveAskId`)只是其中**一问**的主键,而身份会加轴 ——
|
|
1714
|
-
*
|
|
1752
|
+
* [ref] 把这一问的类集并进身份后,按身份点读会把两类行读成「不存在」:① 同一调用另一类集的那一问(core [ref] 的委派第二张卡与首卡);
|
|
1715
1753
|
* ② 升级前按旧派生写的行(同一 resume token 重投 = 同一 `legKey`,跨版本重入同一调用)。两形都让一揽子放行代答、人拒 / 挂着的卡被绕过
|
|
1716
1754
|
* (codex 车内 r1 [high] + [ref] gpt-6 腿 A 同指)。⇒ 读口 = 店的 `listByCall`(四列 = 这次调用在这条腿上的坐标,精确匹配),本函数不派生 askId。
|
|
1717
1755
|
* **身份可以加轴,争议判据不得依赖身份。**
|
|
@@ -1733,7 +1771,7 @@ export declare class ToolApprovalCoordinator {
|
|
|
1733
1771
|
* · **codex 交叉复审**([ref] 同批,验真后采纳):只补终态判据仍漏「卡还在别处挂着」——
|
|
1734
1772
|
* STREAM_PENDING 行意味着已有一张卡在等人,凭 grant 抢跑会让行上的终局与真实执行长期矛盾
|
|
1735
1773
|
* (那张卡随后可被人/另一副本决成相反答案,或 TTL 到点被收敛成幻影 gate)。
|
|
1736
|
-
* · **
|
|
1774
|
+
* · **[ref] / SN-C1**(见上节):读口按身份点读,身份加轴后漏掉同调用别的问与旧派生的行。
|
|
1737
1775
|
* 几次都不是各自独立的 bug,是同一句话没说全,故最终判据收成一条而不是几个分支。
|
|
1738
1776
|
*
|
|
1739
1777
|
* 零额外 IO(一次读),且 fail-closed **by construction**:将来 `AskState` 加词、ask 身份再加轴,都不需要动这里。
|
|
@@ -1786,7 +1824,7 @@ export declare class ToolApprovalCoordinator {
|
|
|
1786
1824
|
private hasOtherSuspendedOwner;
|
|
1787
1825
|
private settleSameAskIdParkRoute;
|
|
1788
1826
|
/**
|
|
1789
|
-
* claim 败方真相的**同 askId 分发口**(codex [ref] R6-2 / R7-1 立在 live 腿的闭包里;
|
|
1827
|
+
* claim 败方真相的**同 askId 分发口**(codex [ref] R6-2 / R7-1 立在 live 腿的闭包里;[ref] codex F2 起两条兜底臂的落行半场
|
|
1790
1828
|
* {@link landUnattendedOutcome} 也调它 —— 一个分发口,不写第二份):真相是**行**的,不是某一条登记的 ⇒ 真决议经
|
|
1791
1829
|
* {@link notifyExternalDecision}、投递面经 {@link settleSameAskIdParkRoute} 交给同 askId 的全部本地登记;各登记的 settle 自带
|
|
1792
1830
|
* 单赢者卫兵,对已落的恒无操作。absent / 编辑在飞没有可分发的真相。
|
|
@@ -1923,7 +1961,7 @@ export declare class ToolApprovalCoordinator {
|
|
|
1923
1961
|
* 舰队 scope,与 `/decide` 腿同姿势);live 命中路径一个字节都不看它。缺席 = 非 HTTP 调用点
|
|
1924
1962
|
* (测试/内部),赎回席按「无请求」形处置。 */
|
|
1925
1963
|
httpReq?: IncomingMessage,
|
|
1926
|
-
/**
|
|
1964
|
+
/** [ref]:本次回决的**部署事实**(协调器自己不读 config;回决路由从能力事实读来交进)。缺席 ⇒ 按「不受理读根授权」读(失败方向 = 拒)。 */
|
|
1927
1965
|
deployment?: ToolApprovalRespondDeployment): {
|
|
1928
1966
|
status: number;
|
|
1929
1967
|
body: unknown;
|
|
@@ -1932,12 +1970,13 @@ export declare class ToolApprovalCoordinator {
|
|
|
1932
1970
|
body: unknown;
|
|
1933
1971
|
}>;
|
|
1934
1972
|
/**
|
|
1935
|
-
*
|
|
1973
|
+
* [ref]:**接管登记**的应答。接管登记是行的投影(没有引擎腿在等它),所以它的属主门读**行当下的** owner —— 接管时记下的那一格可能已被
|
|
1936
1974
|
* `/v1/adoption` 改写(契约:应答口的授权判据取当下的持久事实,收编之后旧属主手里的卡作废)。行仍 `STREAM_PENDING` ⇒ 与活登记同一条应答路
|
|
1937
1975
|
* ({@link answerRegistration}:同一把 `decideAsk` CAS);行已有终局(别处答了 / 对账器收了,本副本的轮询还没到)⇒ 按行的真相答(与晚答口同一张表)。
|
|
1938
1976
|
*/
|
|
1939
1977
|
private respondAdopted;
|
|
1940
|
-
/** 一条已过属主门的登记(活登记或接管登记)的应答 —— 两者同一条路:规则文本前门 → 要人门 → CAS → 兑付。
|
|
1978
|
+
/** 一条已过属主门的登记(活登记或接管登记)的应答 —— 两者同一条路:规则文本前门 → 要人门 → CAS → 兑付。
|
|
1979
|
+
* `judgedOwner` = 门判过的那位属主([ref]:决议作用域的属主维,CAS 与确认读都绑它;见 `askRowCarriesOwner`)。 */
|
|
1941
1980
|
private answerRegistration;
|
|
1942
1981
|
/** 一次 live 回决**落定之后**的两件兑付(部署名单那一问的豁免、「不再询问」的规则)—— 两件都只在 200 那一支、都读同一只资格。 */
|
|
1943
1982
|
private afterLiveDecision;
|
|
@@ -1987,10 +2026,16 @@ export declare class ToolApprovalCoordinator {
|
|
|
1987
2026
|
status: number;
|
|
1988
2027
|
body: unknown;
|
|
1989
2028
|
}>;
|
|
1990
|
-
/**
|
|
2029
|
+
/** [ref]:接管登记的按问读口 —— 行可见且仍 `STREAM_PENDING` ⇒ `pending`(列表面同一只行投影);否则按行的态答(与读行半场同一张表)。 */
|
|
1991
2030
|
private readAdopted;
|
|
1992
2031
|
/** {@link readApproval} 的读行半场。 */
|
|
1993
2032
|
private readAskRowState;
|
|
2033
|
+
/**
|
|
2034
|
+
* `PARKED` 行的门读法([ref]):问判官「这张卡的门此刻还是不是该会话当前待决的审批门」。行是终态、不随赎回 / 取消改写,所以只有 checkpoint 知道。
|
|
2035
|
+
* 没有门读席 / 行上没有 gate token ⇒ `open`(读口只能说行说的话;应答口对同一张卡的 PARKED 臂此时也答不了受理,不另有第二个答案)。
|
|
2036
|
+
* 读不出(店故障 / 超时)⇒ 按本协调器的店故障姿势(D5:记账 + 一次 warn)退回 `open` —— 这一臂只影响**展示**,应答口对同一张卡仍按自己的判官 fail-closed。
|
|
2037
|
+
*/
|
|
2038
|
+
private readParkedGate;
|
|
1994
2039
|
/** 一条行 → 按问读口的答案(行态六态穷举:新增 `AskState` 而不在此表态 = **编译错**)。 */
|
|
1995
2040
|
private readStateOfRow;
|
|
1996
2041
|
/**
|
|
@@ -2118,18 +2163,18 @@ export declare class ToolApprovalCoordinator {
|
|
|
2118
2163
|
* 的唯一数据源,**同时**是 `/v1/approvals/stream` 的 live 半场 diff 源(推与拉必须同源:feed 收到
|
|
2119
2164
|
* `live_pending` 事件就会去 `list()`,两处各读各的会给出一条列不出来的事件)。纯读投影,零锁/零结算
|
|
2120
2165
|
* 语义。
|
|
2121
|
-
* 🔴 **
|
|
2166
|
+
* 🔴 **[ref] 起行上带整只活卡帧**(`frame`,见 {@link LivePendingRow.frame}):旧文那句「input/args
|
|
2122
2167
|
* 不上列表,详情走流帧」对**悬挂 ask 结构上不成立**(它永远没有流帧),而 `frame` 是 `askBroadcast`
|
|
2123
2168
|
* 那一处构造的同一个对象 ⇒ 仍然只有**一个**脱敏属主、零第二投影。`scope` 与 durable 面同一个值(checkpoint scope):`undefined` = operator 全量(含 owner null 的
|
|
2124
2169
|
* 条目),`_`(`CHECKPOINT_PUBLIC_SCOPE`)= 匿名那一组 = owner null 的条目(R7:不带主体的调用方列得出它答得了的那几张),
|
|
2125
2170
|
* 其余串 = 只见 `owner === scope` 的条目(null-owner 行对具名主体不列,宁少列不超范围)。行的 `approvalId` 就是 `respond()` 收的 id
|
|
2126
2171
|
* (同源可达,[ref] 判据);`expiresAtMs` 照抄登记时单点铸定的窗死线([ref] 三键同一个数)。 */
|
|
2127
2172
|
/**
|
|
2128
|
-
* 🔴
|
|
2173
|
+
* 🔴 [ref] —— **起服接管**:把问账里仍 `STREAM_PENDING` 的问接进本审批机的活集合,让 `livePending[]`(及 `/v1/approvals/stream` 的 live 半场、
|
|
2129
2174
|
* 按问读口、应答口)在重启之后不重开流也看得见、答得了它们。审批机仍是这些读面**唯一**的读源:读问账的只有这里(起服一次),之后列表行由
|
|
2130
2175
|
* 同一只 {@link livePendingRowOf} 投影,卡帧 = `buildReplayFrame`(开流 preamble 同一只构造)—— 不是 GET 上加一只读表的第二 reader。
|
|
2131
2176
|
*
|
|
2132
|
-
* 律(设计稿 `design-
|
|
2177
|
+
* 律(设计稿 `design-[ref].md` §2):接管登记**没有引擎腿在等它**(铸它的进程没了,或它活在别的副本上),与活登记同一只状态机 ——
|
|
2133
2178
|
* 应答 = 同一把 `decideAsk` CAS({@link answerRegistration}),收敛 = 同一条悬挂轮询腿读行({@link pollSuspendedDecisions});它活多久只由行说了算,
|
|
2134
2179
|
* 没有自己的窗(无等待腿的行的到期写者已经存在:对账器段二,同一只政策感知终态 claim,窗 + 宽限 —— 接管不新增竞争者)。
|
|
2135
2180
|
* 「本副本没有引擎腿在等它」机读披露:列表行与应答回执带 `consumerState:"absent"`({@link ASK_DECISION_CONSUMER_ABSENT})。
|
|
@@ -2141,26 +2186,26 @@ export declare class ToolApprovalCoordinator {
|
|
|
2141
2186
|
*/
|
|
2142
2187
|
adoptOpenAsks(): Promise<OpenAskAdoption>;
|
|
2143
2188
|
/**
|
|
2144
|
-
*
|
|
2189
|
+
* [ref]:由一条待决行铸一条接管登记并放进活集合(唯一铸点;读法见 {@link AdoptedRegistrationPart})。事实全部取自行与行上的卡:属主 / 会话(adhoc 替身
|
|
2145
2190
|
* = taskId 时不投,与按问读口的行投影同读)/ 子代出身(卡 `fromSubagent` ⇒ 行 `sourceTaskId`)/ 窗死线 / 铸造时刻取行;工具名、要人位、治理位、类集取卡;
|
|
2146
2191
|
* 授予绑定卡上没有 ⇒ `unreadable`(于是站着的答案判据答 `none`:`rememberRefused`,`allow_session` 只放行这一次 —— 既有律);规则素材不在 ⇒ `persistRule`
|
|
2147
2192
|
* 答 `rule_lane_unavailable`(晚答腿同一个词)。卡面的 `rememberRefused` 与条目同一只判据(活登记那一处的同一条纪律)。
|
|
2148
2193
|
*/
|
|
2149
2194
|
private registerAdopted;
|
|
2150
|
-
/**
|
|
2195
|
+
/** [ref]:放掉这只 askId 的全部接管登记(不碰行、不发消卡帧)。两个读者:悬挂轮询读到行没了(接管登记没有窗,没有行就没有活着的依据);本副本来了这只问的活登记(它让位)。活登记不动。 */
|
|
2151
2196
|
private releaseAdoptedRegistrations;
|
|
2152
2197
|
/**
|
|
2153
|
-
*
|
|
2198
|
+
* [ref]:问账里**这只问的行没了**(行被删)⇒ 放掉它的接管登记;放完本副本若已没有这只问的任何登记,经 preamble 订了它的消卡订阅也一并撤掉
|
|
2154
2199
|
* (不发帧 —— 问不是被谁答掉的,编一帧消卡就是撒谎;壳的结构补偿仍是下一次 preamble 的全量对账基准)。还有活登记 ⇒ 订阅留给它的结算。
|
|
2155
2200
|
*/
|
|
2156
2201
|
private forgetAdoptedAsk;
|
|
2157
|
-
/**
|
|
2202
|
+
/** [ref]:接管登记的属主跟行走 —— 悬挂轮询每读到一次仍待决的行就对齐一次(`/v1/adoption` 改写 `approval_ask.owner` 之后,列表面在一拍之内跟上;应答口与读口另读行当下的 owner)。 */
|
|
2158
2203
|
private followAdoptedOwner;
|
|
2159
2204
|
/** 这只 askId 在本副本上有几条**有引擎腿在等**的登记(接管登记不算)—— 轮询腿的「被唤醒数」读它。 */
|
|
2160
2205
|
private waitingRegistrationCount;
|
|
2161
2206
|
listLivePending(scope: string | undefined): LivePendingRow[];
|
|
2162
2207
|
/**
|
|
2163
|
-
*
|
|
2208
|
+
* [ref]:某只委派子代此刻有没有**待决**的活卡 —— fleet 对账腿「子代活性由属主说了算」的属主②读口(另一只是
|
|
2164
2209
|
* bg registry 账)。子代卡在一张没人答的卡上时当然不出帧,只看「静默」就会把它当孤儿扫下面板(报案的真形)。
|
|
2165
2210
|
* 只答是非、不交出 Map(与 `isRunLiveOnThisReplica` 同姿势);纯读,零锁零结算语义。
|
|
2166
2211
|
* 键 = ask 发起者域(`originTaskId` = core `AskRequest.sourceTaskId` = 子代自己的 core session id),**不是**
|
|
@@ -2245,7 +2290,7 @@ export declare class ToolApprovalCoordinator {
|
|
|
2245
2290
|
/** [ref]:当前挂着的**悬挂**条目数(零投递集合铸的那一类)——运维/判据读它证「悬挂队列有多长」。 */
|
|
2246
2291
|
suspendedCount(): number;
|
|
2247
2292
|
sessionAllowedCount(): number;
|
|
2248
|
-
/**
|
|
2293
|
+
/** [ref]:当前在场的 preamble 消卡订阅(按 askId)数 —— 判据据它证「订阅有界于本副本的登记,没有登记、没有行的问不留订阅」。 */
|
|
2249
2294
|
presentedCardWatcherCount(): number;
|
|
2250
2295
|
/** [ref]:当前在场的受理回执数(有界性的可观测面 —— 判据据它证「帽是硬的、过期会被清」)。 */
|
|
2251
2296
|
parkRedemptionCount(): number;
|