@sema-agent/server 7.52.0 → 7.53.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/USAGE.md +22 -5
- package/dist/adoption/plan.d.ts +3 -3
- package/dist/adoption/quiesce.d.ts +1 -1
- package/dist/adoption/sql.d.ts +2 -2
- package/dist/adoption/wire.d.ts +1 -1
- package/dist/approval-ask-machine.d.ts +2 -2
- package/dist/approval-card.d.ts +18 -18
- package/dist/approval-deny-reasons.d.ts +1 -1
- package/dist/approval-hmac.d.ts +2 -2
- package/dist/approval-reconciler.d.ts +14 -14
- package/dist/approval.d.ts +2 -2
- package/dist/audit.d.ts +4 -4
- package/dist/auth-keys.d.ts +6 -6
- package/dist/bench/l8/artifact.d.ts +6 -1
- package/dist/bench/l8/artifact.js +2 -27
- package/dist/bench/l8/escape.d.ts +3 -3
- package/dist/bench/l8/index.d.ts +1 -1
- package/dist/bench/s1/arms.d.ts +3 -3
- package/dist/bench/s1/oracle.d.ts +2 -2
- package/dist/bench/s1/reviewer.d.ts +1 -1
- package/dist/bench/s1/row.d.ts +5 -5
- package/dist/bench/s1/runner-ctx.d.ts +3 -3
- package/dist/boot/config-center.d.ts +14 -7
- package/dist/boot/config-center.js +2 -0
- package/dist/boot/coordinators.d.ts +4 -4
- package/dist/boot/crash-last.d.ts +1 -1
- package/dist/boot/device-lane.d.ts +3 -3
- package/dist/boot/device-lane.js +2 -0
- package/dist/boot/engine-lease.d.ts +4 -4
- package/dist/boot/governance-seams.d.ts +5 -5
- package/dist/boot/leader.d.ts +5 -5
- package/dist/boot/limit-sync.d.ts +1 -1
- package/dist/boot/memory-boundary.d.ts +5 -5
- package/dist/boot/memory-consolidation.d.ts +8 -2
- package/dist/boot/memory-consolidation.js +1 -0
- package/dist/boot/org-memory.d.ts +5 -5
- package/dist/boot/parked-revive-gate.d.ts +6 -6
- package/dist/boot/permission-rules-audit.d.ts +2 -2
- package/dist/boot/reapers.d.ts +8 -8
- package/dist/boot/resolve-spec.d.ts +4 -4
- package/dist/boot/retention-lane.d.ts +1 -1
- package/dist/boot/runner-deps.d.ts +33 -27
- package/dist/boot/runner-deps.js +2 -1
- package/dist/boot/runtime-caps.d.ts +4 -4
- package/dist/boot/session-faces.d.ts +1 -1
- package/dist/boot/shutdown.d.ts +10 -10
- package/dist/boot/side-query-lane.d.ts +14 -14
- package/dist/boot/stores.js +5 -0
- package/dist/boot/task-list-lane.d.ts +3 -3
- package/dist/boot/webfetch-summarize-lane.d.ts +9 -9
- package/dist/boot/workflow-orchestration.d.ts +1 -1
- package/dist/bounded-session-map.d.ts +1 -1
- package/dist/brain.d.ts +3 -3
- package/dist/budget.d.ts +3 -3
- package/dist/canonical-json.d.ts +53 -0
- package/dist/canonical-json.js +48 -0
- package/dist/capabilities/center-prompts.d.ts +13 -13
- package/dist/capabilities/collab-workflows.d.ts +1 -1
- package/dist/capabilities/hands-lane.d.ts +4 -4
- package/dist/capabilities/memory-notice.d.ts +4 -4
- package/dist/capabilities/prompt.d.ts +2 -2
- package/dist/capabilities/sandbox-file-send.d.ts +2 -2
- package/dist/capabilities/scenarios.d.ts +16 -16
- package/dist/capabilities/skills.d.ts +1 -1
- package/dist/capabilities/team.d.ts +3 -3
- package/dist/capabilities/tool-defer.d.ts +6 -6
- package/dist/config-catalog.d.ts +139 -0
- package/dist/config-catalog.js +556 -0
- package/dist/config-center/apply-effective.d.ts +20 -7
- package/dist/config-center/apply-effective.js +45 -0
- package/dist/config-center/apply-ledger.d.ts +6 -6
- package/dist/config-center/facade.d.ts +3 -2
- package/dist/config-center/hot-keys-registry.d.ts +2 -2
- package/dist/config-center/http-client.d.ts +5 -5
- package/dist/config-center/mcp-revocation.d.ts +6 -4
- package/dist/config-center/mcp-revocation.js +2 -12
- package/dist/config-center/restart-signal.d.ts +11 -1
- package/dist/config-center/restart-signal.js +1 -1
- package/dist/config-center/skills-mcp.d.ts +2 -2
- package/dist/config-center/stage-limits.d.ts +3 -3
- package/dist/config-center/types.d.ts +23 -19
- package/dist/config-invariants.d.ts +1 -1
- package/dist/config-provider.d.ts +2 -2
- package/dist/config-types.d.ts +157 -134
- package/dist/config.d.ts +32 -24
- package/dist/config.js +48 -6
- package/dist/degenerate-instrument.d.ts +1 -1
- package/dist/deployment-governance.d.ts +13 -13
- package/dist/device-store.d.ts +2 -2
- package/dist/device-ws-hub.d.ts +6 -4
- package/dist/device-ws-hub.js +9 -3
- package/dist/device-ws-protocol.d.ts +3 -3
- package/dist/digest-form.d.ts +1 -1
- package/dist/elicitation.d.ts +1 -1
- package/dist/env-facts.d.ts +7 -7
- package/dist/execution-lane-caps.d.ts +5 -5
- package/dist/fleet/fleet-bus.d.ts +56 -53
- package/dist/fleet/fleet-reconciler.d.ts +2 -2
- package/dist/fleet/fleet-terminal-window.d.ts +1 -1
- package/dist/fleet/subagent-tail-bus.d.ts +3 -3
- package/dist/fleet-client.d.ts +3 -3
- package/dist/fleet-lease.d.ts +1 -1
- package/dist/hooks/branch-transcript.d.ts +2 -2
- package/dist/hooks/cc-agent-hook-prompt.d.ts +2 -2
- package/dist/hooks/cc-stop-prompt.d.ts +2 -2
- package/dist/hooks/hook-llm.d.ts +1 -1
- package/dist/hooks/hook-runner.d.ts +12 -5
- package/dist/http/active-run-conflict.d.ts +31 -33
- package/dist/http/active-run-conflict.js +4 -2
- package/dist/http/route-ctx.d.ts +23 -21
- package/dist/http/routes/a2a-serve.d.ts +2 -2
- package/dist/http/routes/admin-config-refresh.d.ts +1 -1
- package/dist/http/routes/admin-drain.d.ts +4 -4
- package/dist/http/routes/admin-memory-optout.d.ts +5 -5
- package/dist/http/routes/adoption.d.ts +1 -1
- package/dist/http/routes/agents-roster.d.ts +1 -1
- package/dist/http/routes/approvals-assistant.d.ts +6 -6
- package/dist/http/routes/approvals-assistant.js +4 -1
- package/dist/http/routes/capabilities.d.ts +1 -1
- package/dist/http/routes/capabilities.js +1 -0
- package/dist/http/routes/config-catalog.d.ts +28 -0
- package/dist/http/routes/config-catalog.js +42 -0
- package/dist/http/routes/diagnostics.d.ts +2 -2
- package/dist/http/routes/fleet.d.ts +1 -1
- package/dist/http/routes/images.d.ts +1 -1
- package/dist/http/routes/leader.d.ts +1 -1
- package/dist/http/routes/memory-bundle.d.ts +4 -4
- package/dist/http/routes/memory-bundle.js +2 -3
- package/dist/http/routes/memory-compliance.d.ts +7 -7
- package/dist/http/routes/memory-consolidation.d.ts +1 -1
- package/dist/http/routes/memory-origin.d.ts +9 -9
- package/dist/http/routes/memory-policy.d.ts +3 -3
- package/dist/http/routes/notify-wake.d.ts +1 -1
- package/dist/http/routes/observability.d.ts +1 -1
- package/dist/http/routes/retention-ops.d.ts +1 -1
- package/dist/http/routes/rules.d.ts +3 -3
- package/dist/http/routes/run-memory-capture.d.ts +1 -1
- package/dist/http/routes/runs.d.ts +3 -3
- package/dist/http/routes/runs.js +12 -17
- package/dist/http/routes/session-sync.d.ts +2 -2
- package/dist/http/routes/sessions-list.d.ts +1 -1
- package/dist/http/routes/sessions.d.ts +9 -1
- package/dist/http/routes/sessions.js +61 -1
- package/dist/http/routes/shared-memory.d.ts +1 -1
- package/dist/http/routes/side-query.d.ts +1 -1
- package/dist/http/routes/tasks.d.ts +1 -1
- package/dist/http/routes/trace-usage.d.ts +1 -1
- package/dist/http/routes/workflows.d.ts +1 -1
- package/dist/http/run-meta.d.ts +1 -1
- package/dist/http/send.d.ts +6 -6
- package/dist/http/server.d.ts +84 -67
- package/dist/http/server.js +25 -12
- package/dist/http/sse-lifecycle.d.ts +1 -1
- package/dist/http/sse-log.d.ts +6 -6
- package/dist/http/verify-rounds.d.ts +3 -3
- package/dist/http/wire-gate.d.ts +2 -2
- package/dist/http/wire-types.d.ts +38 -38
- package/dist/key-resolver.d.ts +1 -1
- package/dist/leader/diffout.d.ts +2 -2
- package/dist/leader/diffup.d.ts +1 -1
- package/dist/leader/endpoint.d.ts +1 -1
- package/dist/leader/fanout.d.ts +6 -6
- package/dist/leader/grader-env-factory.d.ts +1 -1
- package/dist/leader/leader.d.ts +12 -12
- package/dist/leader/merge.d.ts +3 -3
- package/dist/leader/planner.d.ts +5 -5
- package/dist/leader/repair-oracle.d.ts +1 -1
- package/dist/leader/wire.d.ts +9 -9
- package/dist/lsp/manager.d.ts +2 -2
- package/dist/lsp/types.d.ts +1 -1
- package/dist/lsp/ws-transport.d.ts +2 -2
- package/dist/main.js +13 -2
- package/dist/mcp-content-origin.d.ts +1 -1
- package/dist/memory-bundle-engine.d.ts +5 -3
- package/dist/memory-bundle-engine.js +2 -2
- package/dist/memory-operator-faces.d.ts +41 -11
- package/dist/memory-operator-faces.js +12 -0
- package/dist/memory-origin-fence.d.ts +20 -35
- package/dist/memory-origin-fence.js +41 -1
- package/dist/memory-posture.d.ts +6 -6
- package/dist/memory-scope.d.ts +7 -7
- package/dist/model-select.d.ts +5 -5
- package/dist/observability/cost-quota.d.ts +6 -6
- package/dist/observability/cost-taxonomy.d.ts +2 -2
- package/dist/observability/fail-open.d.ts +1 -5
- package/dist/observability/fail-open.js +0 -4
- package/dist/observability/metrics.d.ts +1 -1
- package/dist/observability/prompt-manifest.d.ts +8 -8
- package/dist/observability/rate-limit.d.ts +2 -2
- package/dist/observability/secret-env-scrub.d.ts +1 -1
- package/dist/observability/tool-trace.d.ts +1 -1
- package/dist/orchestration/hardened-vm-runner.d.ts +6 -6
- package/dist/orchestration/hardened-vm-worker-runner.d.ts +1 -1
- package/dist/orchestration/subagent-steer.d.ts +3 -3
- package/dist/orchestration/workflow-agent-steer.d.ts +1 -1
- package/dist/orchestration/workflow-completion-inbox.d.ts +6 -6
- package/dist/orchestration/workflow-notify-journal.d.ts +6 -6
- package/dist/parent-watch.d.ts +1 -1
- package/dist/parked-decide.d.ts +11 -11
- package/dist/plan-cache-probe.d.ts +1 -1
- package/dist/plugins/adoption-log-sql.d.ts +4 -4
- package/dist/plugins/approval-ask-store-memory.d.ts +1 -1
- package/dist/plugins/approval-ask-store-memory.js +12 -0
- package/dist/plugins/approval-ask-store-sql.d.ts +39 -17
- package/dist/plugins/approval-ask-store-sql.js +23 -6
- package/dist/plugins/approval-payload-fingerprint.d.ts +23 -0
- package/dist/plugins/approval-payload-fingerprint.js +23 -0
- package/dist/plugins/background-agent-store-sql.d.ts +8 -8
- package/dist/plugins/background-shell-support.d.ts +12 -12
- package/dist/plugins/blob-backend.d.ts +3 -3
- package/dist/plugins/breaker-state-sql.d.ts +3 -3
- package/dist/plugins/caching-session-store.d.ts +6 -6
- package/dist/plugins/checkpoint-store-sql.d.ts +162 -66
- package/dist/plugins/checkpoint-store-sql.js +76 -33
- package/dist/plugins/device-store-sql.d.ts +4 -3
- package/dist/plugins/e2b-orphan-reclaim.d.ts +3 -3
- package/dist/plugins/file-history-store-sql.d.ts +9 -8
- package/dist/plugins/file-run-store.d.ts +27 -27
- package/dist/plugins/fork-routing-session-store.d.ts +9 -9
- package/dist/plugins/image-bake-store-sql.d.ts +1 -1
- package/dist/plugins/image-index-sql.d.ts +2 -2
- package/dist/plugins/k8s-bg-scripts.d.ts +1 -1
- package/dist/plugins/k8s-exec-protocol.d.ts +1 -1
- package/dist/plugins/leader-run-store-sql.d.ts +1 -1
- package/dist/plugins/local-checkpoint-store.d.ts +26 -17
- package/dist/plugins/local-checkpoint-store.js +21 -11
- package/dist/plugins/local-session-store.d.ts +5 -5
- package/dist/plugins/mailbox-store-sql.d.ts +6 -6
- package/dist/plugins/memory-embedder-fingerprint.d.ts +2 -2
- package/dist/plugins/memory-engine-pg.d.ts +1 -1
- package/dist/plugins/memory-engine-tidb.d.ts +1 -1
- package/dist/plugins/memory-key-guards.d.ts +3 -3
- package/dist/plugins/memory-optout-grant-store-sql.d.ts +10 -10
- package/dist/plugins/memory-origin-law.d.ts +13 -13
- package/dist/plugins/memory-run-store.d.ts +12 -12
- package/dist/plugins/outcome-ledger-sql.d.ts +3 -3
- package/dist/plugins/permission-rule-store-file.d.ts +3 -3
- package/dist/plugins/permission-rule-store-sql.d.ts +38 -33
- package/dist/plugins/permission-rule-store-sql.js +7 -12
- package/dist/plugins/pg-cost-quota.d.ts +2 -2
- package/dist/plugins/pg-pool.js +5 -0
- package/dist/plugins/pg-query.d.ts +1 -1
- package/dist/plugins/pg-rate-limiter.d.ts +2 -2
- package/dist/plugins/pg-session-storage.d.ts +9 -9
- package/dist/plugins/remote-env-adb.d.ts +1 -1
- package/dist/plugins/remote-env-device.d.ts +2 -2
- package/dist/plugins/remote-env-e2b.d.ts +11 -11
- package/dist/plugins/remote-env-file-error.d.ts +2 -2
- package/dist/plugins/remote-env-host.d.ts +10 -10
- package/dist/plugins/remote-env-k8s.d.ts +7 -7
- package/dist/plugins/remote-env-local-docker.d.ts +1 -1
- package/dist/plugins/remote-env-ssh.d.ts +9 -9
- package/dist/plugins/remote-scratchpad.d.ts +1 -1
- package/dist/plugins/resume-anchor-store-sql.d.ts +1 -1
- package/dist/plugins/retention-lane-store-sql.d.ts +2 -2
- package/dist/plugins/retention-store-sql.d.ts +11 -11
- package/dist/plugins/roster-store-sql.d.ts +5 -5
- package/dist/plugins/run-store-sql.d.ts +12 -12
- package/dist/plugins/scheduler-support.d.ts +1 -1
- package/dist/plugins/send-user-file.d.ts +1 -1
- package/dist/plugins/session-capture-record-store-sql.d.ts +99 -0
- package/dist/plugins/session-capture-record-store-sql.js +110 -0
- package/dist/plugins/session-placement.d.ts +1 -1
- package/dist/plugins/session-policy-store-sql.d.ts +2 -2
- package/dist/plugins/session-store.d.ts +3 -3
- package/dist/plugins/shared-memory-store-sql.d.ts +5 -5
- package/dist/plugins/sql-driver.d.ts +7 -7
- package/dist/plugins/sql-errors.d.ts +2 -2
- package/dist/plugins/sql-escape.d.ts +1 -1
- package/dist/plugins/sql-row-helpers.d.ts +1 -1
- package/dist/plugins/store-backend.d.ts +32 -19
- package/dist/plugins/store-backend.js +4 -0
- package/dist/plugins/store-contracts.d.ts +9 -9
- package/dist/plugins/task-list-store-sql.d.ts +3 -3
- package/dist/plugins/tidb-cost-quota.d.ts +3 -3
- package/dist/plugins/tidb-pool.js +9 -0
- package/dist/plugins/tidb-rate-limiter.d.ts +2 -2
- package/dist/plugins/tidb-session-storage.d.ts +2 -2
- package/dist/plugins/tidb-session-store.d.ts +11 -11
- package/dist/plugins/tool-result-store-sql.d.ts +8 -8
- package/dist/plugins/usage-window-store-sql.d.ts +3 -3
- package/dist/plugins/web-search.d.ts +7 -7
- package/dist/plugins/workflow-journal-store-sql.d.ts +6 -6
- package/dist/plugins/workflow-run-store-sql.d.ts +1 -1
- package/dist/plugins/write-behind-counter.d.ts +6 -6
- package/dist/principal-jwt.d.ts +2 -2
- package/dist/project-memory.d.ts +1 -1
- package/dist/prompts-domain-validate.d.ts +8 -8
- package/dist/question.d.ts +3 -3
- package/dist/resource-suspend.d.ts +4 -4
- package/dist/resource-window.d.ts +3 -3
- package/dist/router/route-orchestration.d.ts +1 -1
- package/dist/rules-consent.d.ts +48 -40
- package/dist/run-local.d.ts +5 -5
- package/dist/run-local.js +28 -4
- package/dist/runs.d.ts +19 -19
- package/dist/runtime-caps-resolver.d.ts +6 -6
- package/dist/runtime-governance.d.ts +7 -7
- package/dist/security.d.ts +13 -13
- package/dist/session-leaf-bus.d.ts +1 -1
- package/dist/session-sync-content.d.ts +4 -4
- package/dist/session-sync-kernel.d.ts +2 -2
- package/dist/session-sync.d.ts +13 -13
- package/dist/session-titler.d.ts +1 -1
- package/dist/session-watch.d.ts +3 -3
- package/dist/shared-memory-scope-authorizer.d.ts +4 -4
- package/dist/sighup-idle.d.ts +1 -1
- package/dist/spec-fields.d.ts +20 -20
- package/dist/ssh-host-key.d.ts +5 -5
- package/dist/store-live-probe.d.ts +2 -2
- package/dist/task-cwd.d.ts +11 -11
- package/dist/task-mcp.d.ts +5 -5
- package/dist/task-settings.d.ts +35 -35
- package/dist/task-workflow.d.ts +3 -3
- package/dist/text-bidi.d.ts +1 -1
- package/dist/tool-approval.d.ts +171 -160
- package/dist/tool-approval.js +33 -28
- package/dist/trace/core-keyset-guard.d.ts +21 -7
- package/dist/trace/engine-notice-wire.d.ts +6 -6
- package/dist/trace/injection-tier.d.ts +2 -2
- package/dist/trace/ledger-events.d.ts +3 -3
- package/dist/trace/ledger-sink.d.ts +7 -7
- package/dist/trace/project.d.ts +35 -30
- package/dist/trace/project.js +9 -0
- package/dist/turn-activity.d.ts +4 -4
- package/dist/usage-analytics.d.ts +1 -1
- package/dist/wall-clock-jump-guard.d.ts +3 -3
- package/package.json +6 -6
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Cross-replica circuit-breaker state (core 1.38 `BreakerState`) — SINGLE-FILE DUAL-DIALECT
|
|
3
|
-
* (
|
|
4
|
-
* `PgBreakerState` class names survive as thin ctor subclasses in THIS file ([
|
|
3
|
+
* ([ref] A12 定型半场). ONE implementation, TWO dialects; the historical `TiDBBreakerState` /
|
|
4
|
+
* `PgBreakerState` class names survive as thin ctor subclasses in THIS file ([ref]: the old per-dialect shim files are deleted) so every consumer (store-backend.ts, the
|
|
5
5
|
* fake-pool unit suites, the real dual-DB integration suite) is untouched.
|
|
6
6
|
*
|
|
7
7
|
* core's `createCircuitBreakerBrain` defaults to a per-PROCESS Map → on a multi-replica deployment
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
* learns a peer already opened the breaker — self-healing, never wrong in a dangerous direction).
|
|
19
19
|
*
|
|
20
20
|
* Strict per-call linearizable state would need an async `BreakerState` from core (a separate effort);
|
|
21
|
-
* for a consultative breaker, eventually-consistent write-through is the right trade (see core
|
|
21
|
+
* for a consultative breaker, eventually-consistent write-through is the right trade (see core [ref]).
|
|
22
22
|
*
|
|
23
23
|
* ── Dialect deltas, kept EXPLICIT (the ONLY place the two engines actually differ) ─────────────────
|
|
24
24
|
* - placeholders `?` vs `$n`
|
|
@@ -56,7 +56,7 @@ export declare class CachingSessionStore implements SessionStore {
|
|
|
56
56
|
* wrapper, so without forwarding `noteTaskRun?.()` silently no-ops and lastRunId stays null (review BLOCKER). Pure
|
|
57
57
|
* pass-through to the inner store's in-mem map — no cache interaction. (TiDB/PG don't implement it → not bound.)
|
|
58
58
|
* Return type matches core's `SessionStore.noteTaskRun?(): void | Promise<void>` (review: don't narrow to void).
|
|
59
|
-
*
|
|
59
|
+
* [ref](core 5.65 增量批):第三参 = engine runId。绑定用的是 `.bind(inner)`(整函数),运行期本就
|
|
60
60
|
* 三参全转 —— 这里把**声明**对齐到 core 的三参形,免得读这行类型的人以为缝上只有两参(fork-routing
|
|
61
61
|
* 的两参形正是在运行期真丢过第三参的那个病,同批修)。内店(LocalSessionStore)今日仍是两参消费,
|
|
62
62
|
* runId 落地候 sessions 列表 wire 键的 spec 节拍(见本批提货报告件1b)。 */
|
|
@@ -67,7 +67,7 @@ export declare class CachingSessionStore implements SessionStore {
|
|
|
67
67
|
/** E18 — delegate the leaf read straight to inner (a cache-bypassing single SELECT; the resume-at turn-capture
|
|
68
68
|
* reads the DURABLE leaf, not a possibly-stale cached view — same discipline as the §0.5 repo ops above). */
|
|
69
69
|
readonly getLeafId?: (sessionId: string) => Promise<string | null>;
|
|
70
|
-
/** [
|
|
70
|
+
/** [ref] 六轮复审:owner+leafId 原子快照透传(cache-bypassing,getLeafId 同姿势)。 */
|
|
71
71
|
readonly getHead?: (sessionId: string) => Promise<{
|
|
72
72
|
owner: string | null;
|
|
73
73
|
leafId: string | null;
|
|
@@ -86,7 +86,7 @@ export declare class CachingSessionStore implements SessionStore {
|
|
|
86
86
|
/** 轴A #1(1.254):core B-17 forget 面(evict 本地 + 转发 inner 可选面)。 */
|
|
87
87
|
forget?: (sessionId: string) => void | Promise<void>;
|
|
88
88
|
readonly importEntries?: (sessionId: string, owner: string | null, entries: SessionTreeEntry[]) => Promise<void>;
|
|
89
|
-
/** [
|
|
89
|
+
/** [ref](cli 取证)2c session-sync P1d-β — delegated STAGED import seam. 此前 staging 族不在本类的逐方法
|
|
90
90
|
* 转发白名单里 ⇒ 默认部署(SESSION_CACHE_TTL_SEC=300 把真店包进本类)PUSH Phase A 恒 501
|
|
91
91
|
* `capability.session_store_required`,而 capabilities().sessionSync 谓词三项(backend/exportEntries/
|
|
92
92
|
* fileHistoryStore)都被转发了 ⇒ 照报 true(能力面谎)。转发形:handle 的 `commit` 是唯一写真 id 的
|
|
@@ -101,7 +101,7 @@ export declare class CachingSessionStore implements SessionStore {
|
|
|
101
101
|
* `sessionId`, so a stale warm handle for that id is evicted on success (next acquire re-wakes from the new log). */
|
|
102
102
|
readonly replaceEntries?: (sessionId: string, owner: string | null, entries: SessionTreeEntry[]) => Promise<void>;
|
|
103
103
|
/**
|
|
104
|
-
*
|
|
104
|
+
* [ref] 车1 —— 内层店的 `retention` **声明**(core `RetentionDeclaring`)。
|
|
105
105
|
*
|
|
106
106
|
* 🔴 为什么这一格必须转发,而且方向比别的转发更要命:生产默认 `SESSION_CACHE_TTL_SEC=300` 会把真店
|
|
107
107
|
* 包进本类,于是 boot 递给 `assertRetentionCapability` 的就是**包装层**。core 对缺席是 fail-closed
|
|
@@ -111,7 +111,7 @@ export declare class CachingSessionStore implements SessionStore {
|
|
|
111
111
|
*/
|
|
112
112
|
readonly retention?: RetentionDeclaration;
|
|
113
113
|
/**
|
|
114
|
-
*
|
|
114
|
+
* [ref] C18 —— 内层店的 **placement 声明**转发。
|
|
115
115
|
*
|
|
116
116
|
* 🔴 这一格与 {@link retention} 是同一条教训的同一族(而且更狠):生产默认 `SESSION_CACHE_TTL_SEC=300`
|
|
117
117
|
* 把真店包进本类,于是 boot 递给 core 的就是**包装层**。core 的铸造门判「row store ∧ **session 店声明**」
|
|
@@ -120,7 +120,7 @@ export declare class CachingSessionStore implements SessionStore {
|
|
|
120
120
|
* 只读快照而非 getter:声明是店的构造期常量(会变的声明本身就是缺陷)。
|
|
121
121
|
*/
|
|
122
122
|
readonly placements?: SessionStore["placements"];
|
|
123
|
-
/**
|
|
123
|
+
/** [ref]:placed 分区的两只读面(reap 分区腿 / 准入探针)——同款转发理由:reaper 与准入判据拿到的
|
|
124
124
|
* 是包装层,不转发 = 分区腿静默不可用、暖命中的 claim 关门静默失效。缺席则不设(诚实降级)。 */
|
|
125
125
|
readonly listPlaced?: (kind: "subagent", opts?: {
|
|
126
126
|
olderThanMs?: number;
|
|
@@ -2,9 +2,10 @@ import type { Pool as MySqlPool } from "mysql2/promise";
|
|
|
2
2
|
import type { Pool as PgPool } from "pg";
|
|
3
3
|
import { type Checkpoint, type CheckpointGate, type CheckpointState, type CheckpointStore, type CheckpointSummary, type CheckpointToken, type PendingSteerInput, type ResumeOutcome, type ResolvedOutcome, type ResolveExpectation, type ReopenReason, type RiskDescriptor, type StoreDurability, type StoreFidelity } from "@sema-agent/core";
|
|
4
4
|
import { type RuleOfferProjection } from "../approval-card.js";
|
|
5
|
-
import { type SqlDriver } from "./sql-driver.js";
|
|
5
|
+
import { type SqlDialect, type SqlDriver } from "./sql-driver.js";
|
|
6
|
+
export { approvalPayloadFingerprint } from "./approval-payload-fingerprint.js";
|
|
6
7
|
/**
|
|
7
|
-
*
|
|
8
|
+
* [ref] D-1 (§3 invariant #3 — crash-safe reaper backstop): an ABSOLUTE upper bound on a pending
|
|
8
9
|
* checkpoint's lifetime, stamped at put() into `terminal_at_ms` INDEPENDENT of the per-approval `deadline`. The
|
|
9
10
|
* SLA-timer (D-D) does the fine, per-gate-kind resolve-deny; THIS coarse backstop ensures even a pending row
|
|
10
11
|
* with a NULL `deadline` (no approval TTL configured) is eventually GC'd if the SLA service dies — closing a
|
|
@@ -14,7 +15,7 @@ import { type SqlDriver } from "./sql-driver.js";
|
|
|
14
15
|
*/
|
|
15
16
|
export declare const TERMINAL_BACKSTOP_MS: number;
|
|
16
17
|
/**
|
|
17
|
-
*
|
|
18
|
+
* [ref] D-D (cross-review fix): the crash-safe `terminal_at_ms` backstop must fall STRICTLY AFTER any SLA
|
|
18
19
|
* `deadline`, never AT it. `terminal_at_ms = max(createdAt+backstop, deadline)` made the two coincide whenever an
|
|
19
20
|
* operator tuned APPROVAL_TERMINAL_BACKSTOP_MS at/below the SLA — and reapExpired's terminal_at_ms-branch (which
|
|
20
21
|
* has NO gate_kind filter) then abort-EXPIRED a human/irreversible_ask gate in the SAME tick the deny-sweep
|
|
@@ -35,18 +36,18 @@ export interface PendingCheckpoint {
|
|
|
35
36
|
scope: string;
|
|
36
37
|
toolName: string | null;
|
|
37
38
|
toolCallId: string | null;
|
|
38
|
-
/**
|
|
39
|
+
/** [ref] D-1: the decision-action binding fields the operator/portal must ECHO back on /decide so the
|
|
39
40
|
* resume binds to the EXACT action they saw (a stale view is then rejected fail-closed PRE-CAS). `boundCallId`
|
|
40
41
|
* === `toolCallId` (the pending tool call); `boundInputHash` is the server-minted opaque hash of the shown
|
|
41
42
|
* input (NEVER recomputed by the portal — echoed verbatim). Surfacing them here is what makes the D-1 TOCTOU
|
|
42
43
|
* guard REACHABLE by the portal (without it the portal can only do the unbound legacy fallback).
|
|
43
|
-
* 🔴 [
|
|
44
|
+
* 🔴 [ref]②: ABSENT (key omitted, never `null`) on a park with no tool action (plan_review /
|
|
44
45
|
* resource_limit / task_done) or a pre-D-1 legacy row ⇒ the consumer falls back to the unbound resolve.
|
|
45
46
|
* The wire contract (§1) is "an absent nullable field is OMITTED, not null" — a `null` here invited a
|
|
46
47
|
* consumer to treat the key's PRESENCE as "there is a binding" and echo `null` back into /decide. */
|
|
47
48
|
boundCallId?: string;
|
|
48
49
|
boundInputHash?: string;
|
|
49
|
-
/** 🔴 [
|
|
50
|
+
/** 🔴 [ref]③ (additive): the checkpoint's gate kind — the operator queue mixes tool approvals with
|
|
50
51
|
* plan_review / resource_limit / task_done parks (all of which carry `toolName: null`), so a durable-recovery
|
|
51
52
|
* consumer needs this to ROUTE a row to the right wire (`/decide` vs `/plan_review` vs `/resume`). Absent
|
|
52
53
|
* only for a legacy SQL row suspended before the `gate_kind` column existed. */
|
|
@@ -59,12 +60,12 @@ export interface PendingCheckpoint {
|
|
|
59
60
|
input: unknown;
|
|
60
61
|
createdAt: number;
|
|
61
62
|
deadline: number | null;
|
|
62
|
-
/**
|
|
63
|
+
/** [ref] riskDescriptor inbox: core's INERT triage descriptor ({severity 1-5, axes, toolName, redacted
|
|
63
64
|
* summary, touchedPaths}) for human/irreversible_ask gates. listPending returns the queue severity-sorted
|
|
64
65
|
* (DESC) so the supervisor inbox triages high-risk asks first. `null` for gates with no descriptor. */
|
|
65
66
|
riskDescriptor: RiskDescriptor | null;
|
|
66
67
|
/**
|
|
67
|
-
* [
|
|
68
|
+
* [ref]-2 / [ref]② 起役;core 5.58.0([ref])换 OFFER 判别联合形:这条 park 的「不再询问」
|
|
68
69
|
* offers —— core 在 mint 这道门时挂到 `pendingAction.ruleOffers` 上的那一份(core
|
|
69
70
|
* `checkpoint-store.d.ts` 明写与同步腿的 `AskRequest.ruleOffers` 是**同一条契约**:序即契约——
|
|
70
71
|
* whole-string exact `single` 在场时恒 index 0、`batch` 恒末位,core 契约基数 ≤2 —— server 侧执法帽
|
|
@@ -82,7 +83,7 @@ export interface PendingCheckpoint {
|
|
|
82
83
|
* `card_json` / 重放帧上的下标**恒等于** core 的 offer index —— 兑付真发生在那条腿上。
|
|
83
84
|
*
|
|
84
85
|
* 🔴 **混舰队旧行(pre-5.58 的 `ruleSuggestions` 数组,无 `kind` 判别位)**:按新 Raw 形逐条不合
|
|
85
|
-
* ⇒ 整格落「无供给」——与 [
|
|
86
|
+
* ⇒ 整格落「无供给」——与 [ref] 升级单的舰队条款一致(旧建议面丢失只影响展示,ask 安全面照常;
|
|
86
87
|
* pending 审批短命,重触发即得新形卡)。**不做兼容读**(schema stale=重问,core 同款纪律)。
|
|
87
88
|
*
|
|
88
89
|
* 🔴 **无供给 ≠ 丢失**(本键存在的全部理由):同步腿的卡带这一格(`card_json` 里逐字在),而耐久腿
|
|
@@ -91,7 +92,7 @@ export interface PendingCheckpoint {
|
|
|
91
92
|
* 候选(规则车道没武装 / 命令说不出规则 / 这只 ask 规则清不掉),而不是投影层漏了。
|
|
92
93
|
*
|
|
93
94
|
* 🔴 **只在为真时在场**:core 不给 ⇒ 键**缺席**(不铸 `null`、不铸 `[]`)——与 `boundCallId`/`gateKind`
|
|
94
|
-
* 同一条 wire 纪律([
|
|
95
|
+
* 同一条 wire 纪律([ref]②「absent nullable field is OMITTED, not null」)。存量行(本列存在之前
|
|
95
96
|
* park 的)读回同样是缺席,与「这只 ask 没有候选」在消费端读法一致:本卡无此选项。
|
|
96
97
|
*
|
|
97
98
|
* 🔴 **展示用,永不参与 resume**:core 侧同款定性(「never read by the resume path, and never a rule by
|
|
@@ -100,12 +101,115 @@ export interface PendingCheckpoint {
|
|
|
100
101
|
* 顶注那条射程说明)。
|
|
101
102
|
*/
|
|
102
103
|
ruleOffers?: readonly RuleOfferProjection[];
|
|
104
|
+
/**
|
|
105
|
+
* [ref]①([ref]② / [ref];core 5.60.0 [ref]):**bidi 在场位**的耐久运维队列投影 —— 这条 park 行的
|
|
106
|
+
* 执行载荷里含至少一个 DIRECTIONAL 格式控制符(人眼读到的顺序与真正执行的字节顺序可能不同)。
|
|
107
|
+
*
|
|
108
|
+
* 值**完全由 core 供**:park mint 时 core 写在 `pendingAction`(tool_approval 臂)上的那一位
|
|
109
|
+
* (`PendingAction.hasBidiControls`,core [ref]),`put()` 在铸行
|
|
110
|
+
* 这一刻反范式成 `checkpoint.has_bidi_controls` 列(同行 `tool_input` / `bound_input_hash` / `gate_kind` /
|
|
111
|
+
* `risk_descriptor` / `rule_suggestions` 五列同一条「铸行时一格、读口零 blob」先例),server 不重算。
|
|
112
|
+
*
|
|
113
|
+
* 🔴 `true` **或缺席,恒不写 `false`/`null`**(core d.ts 的 OMIT 契约逐字点名 BFF:「never null, never
|
|
114
|
+
* present-but-undefined, never false」):缺席 = **没检出**(干净 / core 的有界扫描没够着 / 本列诞生前
|
|
115
|
+
* park 的老行),消费端**禁**读成「已确认干净」。与 `/v1/assistant/inbox` 那面的同名键同一份语义
|
|
116
|
+
* (那面由 `summarizeCheckpoint` 对老行做投影期回填;本面读列不读 blob,老行恒缺席 —— 两面的缺席
|
|
117
|
+
* 集合因此不完全相等,但两面对「缺席」的读法逐字相同)。同步腿(`tool_approval` 帧 / `approval_request`
|
|
118
|
+
* 卡)的对应键是 `inputHasBidi`(E-14),名字刻意不同:那一位是 server 对帧自身序列化后的 args 算的。
|
|
119
|
+
*
|
|
120
|
+
* 展示/分诊用,永不参与 resume / gate / CAS(core 同款 ECHO-ONLY 定性)。
|
|
121
|
+
*/
|
|
122
|
+
hasBidiControls?: true;
|
|
103
123
|
}
|
|
124
|
+
/**
|
|
125
|
+
* [ref]([ref] / DEBTS [ref]):session 键读口(`findPendingTokenBySession` / `peekPendingScope`)的**行绑定**。
|
|
126
|
+
*
|
|
127
|
+
* 病灶(本仓自己两处成文:`server.ts` mintFreshRun 腿 409 段、`active-run-conflict.ts` `checkpointId` 顶注):
|
|
128
|
+
* `checkpoint` 表**没有** per-session pending 唯一约束 —— 同一 session 下 `task_done` 纯 park(行已终局、
|
|
129
|
+
* `task_active` claim 已释放)与下一条 run 的门 park **合法并存**;而两条读口此前是**无序 `LIMIT 1`**,同
|
|
130
|
+
* session 两条 pending 时选中哪一条由存储引擎的扫描序决定:同一情形两次调用可能答出两张不同的门,路由层
|
|
131
|
+
* 的 owner 门(`peekPendingScope`)与 `resumeCheckpoint` 的载入(`findPendingTokenBySession`)更可能各读到
|
|
132
|
+
* 一条([ref] codex R3 揭的 tokenless TOCTOU 同源;[ref] 在取用点加了行级属主复核 = 下游兜底,本件是源头)。
|
|
133
|
+
*
|
|
134
|
+
* 为什么不是加唯一约束:那两条行的并存是**设计内**的形(见上),约束会把新 run 的 park `put()` 当场打死
|
|
135
|
+
* (core 的 `CheckpointStore.put` 契约不允许);且 MySQL-protocol 侧没有部分唯一索引,TiDB 上要靠生成列
|
|
136
|
+
* 绕,两方言分歧成本高于收益。
|
|
137
|
+
*
|
|
138
|
+
* 修法 = **读口带 gate 坐标 + 显式序**:
|
|
139
|
+
* · `gateKinds` 在场 ⇒ 只认这些门型的 pending 行(每条 resume 腿本来就只服务一种门型 —— decide 只解
|
|
140
|
+
* 审批门、wake 只解 `task_done`、preempt 只解 `resource_limit`、plan_review 只解 `plan_review`;把
|
|
141
|
+
* 这条已成文的守卫**前移到读口**,选错行这件事结构上不再发生)。**空数组 = 什么都不认**(显式 `1=0`,
|
|
142
|
+
* 不静默退化成「任意门型」)。缺席 ⇒ 任意门型(存在性读口:boot reclaim / reaper probe / 断连竞态卫兵)。
|
|
143
|
+
* · 无论绑不绑,序恒为 `created_at_ms DESC, token DESC`(**最新优先**,主键兜平局):同一情形下每次读
|
|
144
|
+
* 都答同一行;两条读口共用同一段谓词 + 同一段序({@link SqlCheckpointStore.pendingRowQuery} 单一属主),
|
|
145
|
+
* 路由门与载入点结构上选中同一行。最新优先的理由:并存形里**老**的那条恒是终局后的 `task_done` 纯 park,
|
|
146
|
+
* 活 run 的门在它之后铸。
|
|
147
|
+
*
|
|
148
|
+
* SQL twin 与 LOCAL twin 同判(local 侧按 `cp.gate.kind` 过滤、按 `createdAt`/token 同序取最新)。
|
|
149
|
+
*/
|
|
150
|
+
export interface PendingRowBinding {
|
|
151
|
+
/** gate 坐标:只认这些门型的 pending 行(core `CheckpointGate["kind"]` 闭集)。缺席 ⇒ 任意门型。 */
|
|
152
|
+
gateKinds?: readonly CheckpointGate["kind"][];
|
|
153
|
+
/**
|
|
154
|
+
* 并存候选里取哪一端(缺省 `"newest"`)。两个取向各有一个**结构性**的消费者,别混用:
|
|
155
|
+
* · `"newest"`(缺省)—— 「活 run 的门」族:并存形里老的那条恒是终局 task_done 纯 park,活 run 的门
|
|
156
|
+
* 在它之后铸 ⇒ 最新即正解;
|
|
157
|
+
* · `"oldest"` —— **跨副本收敛**族(wake-mint 赢家复核 + wake 消费腿;codex 审批面轮 R2-[medium],
|
|
158
|
+
* 验真后修):收敛要的是一个**与自己的铸行时刻无关**的不动点。最新优先下「后铸者恒自选」——两副本
|
|
159
|
+
* 并发铸 task_done park 时,后铸的 B 复核必选中刚铸的自己,先铸的 A 若在 B 落盘前复核也选中自己,
|
|
160
|
+
* 两行双双留存、消息被拆到两张卡上。最老优先没有这个洞:**后铸者复核时先铸行必然已在**(它比自己老
|
|
161
|
+
* ⇒ 选中它、expire 自己),先铸者无论何时复核都选中自己 ⇒ 不动点唯一。消费腿(/wake)取同端,
|
|
162
|
+
* 赢家卡与被消费卡恒同一张(FIFO 顺带成立)。
|
|
163
|
+
*/
|
|
164
|
+
pick?: "newest" | "oldest";
|
|
165
|
+
}
|
|
166
|
+
/** [ref]:一条**仍持有 claim 的 run** 可能停在的全部门型(= 除 `task_done` 外全部;派生自上表,不手抄)。
|
|
167
|
+
* 给「按 run 行动」的读口用:cancel / steer 的 park 落点、409 `pendingGate` 材料 —— 这些腿手里有 run 行,
|
|
168
|
+
* 而 run 行一旦 parked 就绝不是 `task_done`,绑上它就把同 session 那条终局 park 排除在候选之外。 */
|
|
169
|
+
export declare const LIVE_RUN_GATE_KINDS: readonly CheckpointGate["kind"][];
|
|
170
|
+
/** [ref]:终局后纯 park 的门型(wake 腿 / wake-mint 赢家复核只认它)。 */
|
|
171
|
+
export declare const TERMINAL_PARK_GATE_KINDS: readonly CheckpointGate["kind"][];
|
|
172
|
+
/**
|
|
173
|
+
* [ref]:LOCAL twin 与测试共用的**同序判据**——「候选集里哪一条是读口该答的那条」。与 SQL 的
|
|
174
|
+
* `ORDER BY created_at_ms {DESC|ASC}, token {DESC|ASC} LIMIT 1` 逐字同义(token 列两方言都是二进制序 ——
|
|
175
|
+
* MySQL `utf8mb4_bin` / PG `COLLATE "C"`,token 是 ASCII ⇒ JS 字符串比较与之同序)。
|
|
176
|
+
* 返回 `true` 表示 `a` 应排在 `b` 前面(缺省最新优先;`pick:"oldest"` 时最老优先,取向语义见
|
|
177
|
+
* {@link PendingRowBinding.pick})。
|
|
178
|
+
*/
|
|
179
|
+
export declare function pendingRowPrecedes(a: {
|
|
180
|
+
createdAt: number;
|
|
181
|
+
token: string;
|
|
182
|
+
}, b: {
|
|
183
|
+
createdAt: number;
|
|
184
|
+
token: string;
|
|
185
|
+
}, pick?: "newest" | "oldest"): boolean;
|
|
186
|
+
/**
|
|
187
|
+
* [ref]① 升级前置断言 —— **拒启**,不是 warn(形照 [ref] `assertApprovalAskRuleMaterialSchema` / [ref] /
|
|
188
|
+
* [ref] 三条先例;codex 店面轮 R1-[high] 采纳 —— 其引证的「MIGRATION.md 常设策略」经亲验不存在,采纳的
|
|
189
|
+
* 依据是本仓 assert*Schema 探针族的真先例与失败方向本身)。
|
|
190
|
+
*
|
|
191
|
+
* 病:本仓不发 `ALTER TABLE`(SCHEMA POLICY:改列就改 CREATE + 删库重建)。一台**没删表**就升上来的
|
|
192
|
+
* 部署,`CREATE TABLE IF NOT EXISTS` 对存量 `checkpoint` 是空操作 —— 本批新增的 `has_bidi_controls`
|
|
193
|
+
* 列不在,而 `put()` 的 INSERT 与 `listPending` 的 SELECT **无条件**引用它。没有这道断言,服务照常过
|
|
194
|
+
* 启动与健康检查,直到:每一次 durable park 落行在 `put()` 撞 unknown column(挂起面整条失效),
|
|
195
|
+
* `GET /v1/approvals` 与 `/stream` 的每一次轮询 500 —— 运行期才响,且首撞点在用户的审批路径上。
|
|
196
|
+
*
|
|
197
|
+
* 判据 = **能力探测**(恒空的 `WHERE 1=0` 读)+ **方言的缺列错误码**({@link isMissingColumnError},
|
|
198
|
+
* 判据属主 `sql-errors.ts`);其余错误**原样 rethrow**,一个字都不加工 —— 一句破坏性的「去 DROP TABLE」
|
|
199
|
+
* 指路比它要挡的缺陷更贵([ref] 两轮收窄的结论逐字继承)。
|
|
200
|
+
*
|
|
201
|
+
* 位置:与三条先例同款,不在 `ensureSchema` 里(那条通道的契约是「只发 CREATE」),放在 boot 的
|
|
202
|
+
* store 装配段、路由装配之前;**无条件**跑(与 [ref] tool_result 探针同档)——checkpoint 表在两方言的
|
|
203
|
+
* 中央 DDL 里恒在,SQL 后端一开它就是 durable park/审批队列的承载面,不存在「协议不上场」的豁免形。
|
|
204
|
+
*/
|
|
205
|
+
export declare function assertCheckpointBidiColumnSchema(query: (sql: string) => Promise<{
|
|
206
|
+
rows: Record<string, unknown>[];
|
|
207
|
+
}>, dialect: SqlDialect): Promise<void>;
|
|
104
208
|
/**
|
|
105
209
|
* `pendingAction.ruleOffers` 的**铸行侧**投影(mint 面,与 {@link boundedToolInput} 同位同待遇)。
|
|
106
210
|
*
|
|
107
211
|
* 三件事,一件都不能少:
|
|
108
|
-
* 1. **结构窄读**(宪法 [
|
|
212
|
+
* 1. **结构窄读**(宪法 [ref] 边界必 schema / 禁裸 as-cast):blob 里的这一格是 `unknown`(旧 core /
|
|
109
213
|
* 坏行 / 未来加字段都可能)。形不合的**整条丢弃**(不是整只丢弃)——一条坏 offer 不该让另一条真 offer 消失。
|
|
110
214
|
* 判据按 `kind` 判别联合分臂合形(`RuleOfferRawSchema` 两臂各自 **strip 形** `.strip()`,
|
|
111
215
|
* 多余键**剥掉**、且不拒收 —— 重扫二轮更正:旧注写 `.loose()`,而 zod 4 的 loose = passthrough,
|
|
@@ -113,7 +217,7 @@ export interface PendingCheckpoint {
|
|
|
113
217
|
* offer 静默清零 —— 「有供给」当场变「无供给」,与本键的存在理由正相反(顶注第三段)。
|
|
114
218
|
* 2. **脱敏**:offer 文本是从**命令原文**铸出来的(`Bash(curl -H "Authorization: Bearer …")` 这种 exact
|
|
115
219
|
* 形拼得出秘密),而 `GET /v1/approvals` 是**跨租户可见**的运维队列。落列前过 `redactSecrets` ——
|
|
116
|
-
* 与同行 `tool_input` 在 mint 就 `redactDeep` 是**同一条**纪律(
|
|
220
|
+
* 与同行 `tool_input` 在 mint 就 `redactDeep` 是**同一条**纪律([ref] 件4 把 `shadowedRule` 修在读面
|
|
117
221
|
* 是因为那条路的行早已落库、改铸点救不了存量;本键是**新**列,没有存量行要救,修在铸点更彻底:
|
|
118
222
|
* 秘密从此连**落库**都不落,不是落了库再在两条读面各洗一遍)。
|
|
119
223
|
* 3. **脱敏之后**才截长(codex 交叉复审 [medium],验真后修):`redactSecrets` 会**变长**,先按限长校验
|
|
@@ -149,7 +253,7 @@ export declare function boundedRuleOffers(raw: unknown, opts?: {
|
|
|
149
253
|
* Exported for the LOCAL twin (local-checkpoint-store.ts) so the operator-queue projection can't drift. */
|
|
150
254
|
export declare function boundedToolInput(args: unknown): unknown;
|
|
151
255
|
/**
|
|
152
|
-
* 🔴
|
|
256
|
+
* 🔴 [ref] 车5 §9 C4:`findCheckpointCandidatesForAsk` 的 typed 候选行。刻意只有对账收敛器判据 1 真需要的
|
|
153
257
|
* 五件——**没有 token 之外的任何凭据面**,`token` 本身是 resume 凭据、只在服务端内部流转(同
|
|
154
258
|
* `findPendingTokenBySession`:它从不出网,§12-C「checkpointToken 从不外发」)。
|
|
155
259
|
*/
|
|
@@ -159,7 +263,7 @@ export interface CheckpointAskCandidate {
|
|
|
159
263
|
status: string;
|
|
160
264
|
createdAtMs: number;
|
|
161
265
|
/**
|
|
162
|
-
* 🔴 和解三元组的第一维(
|
|
266
|
+
* 🔴 和解三元组的第一维([ref] 件1,黑板 [ref]③①)—— checkpoint 自己带的 `sourceTaskId`(core 在
|
|
163
267
|
* suspendAsk 铸行时恒填该腿的 `sessionId`)。**没有对应的列**,只能从 blob 窄读;读不出/缺席 = null。
|
|
164
268
|
*
|
|
165
269
|
* 为什么必须进候选集:读口按 `(scope, session_id, tool_call_id)` 查,而委派子代那条腿的 ask 落行时
|
|
@@ -176,7 +280,7 @@ export interface CheckpointAskCandidate {
|
|
|
176
280
|
unparseable?: true;
|
|
177
281
|
}
|
|
178
282
|
/**
|
|
179
|
-
*
|
|
283
|
+
* [ref] 件1 —— legacy `/v1/approvals/:sessionId/decide` 腿的**幂等回放**判别行(窄读,非凭据面)。
|
|
180
284
|
*
|
|
181
285
|
* 刻意**不带 token**:回放只需要「这条已决的行归谁、绑的是哪一次调用、判词是什么」三件,而 token 是
|
|
182
286
|
* resume 凭据(§12-C「checkpointToken 从不外发」;`CheckpointAskCandidate` 带它是因为收敛器要拿它去
|
|
@@ -207,29 +311,7 @@ export interface DecidedApprovalRecord {
|
|
|
207
311
|
payloadFp: string | null;
|
|
208
312
|
}
|
|
209
313
|
/**
|
|
210
|
-
*
|
|
211
|
-
*
|
|
212
|
-
* 为什么是指纹而不是把三件原样交出来:`updatedInput` 可能携人写的命令原文/密钥形字节,而本读口的
|
|
213
|
-
* 契约是「窄读、非凭据面」—— 交指纹够比对,也不给任何调用点把它误投上 wire 的机会。
|
|
214
|
-
*
|
|
215
|
-
* 🔴 **必须是 canonical(键序无关)**,不是裸 `JSON.stringify`(codex R3-[high] 二,验真后修):行侧那份
|
|
216
|
-
* 载荷是从 `JSON`/`JSONB` 列**回读**的,而 **PG 的 jsonb 不保留输入键序**(它按自己的规则重排)⇒ 客户端
|
|
217
|
-
* 逐字重发原 body 时,请求侧按原键序、行侧按库的键序,裸 stringify 出来的两串不等 ⇒ 一次**合法重试**
|
|
218
|
-
* 被误拒成 404。方向虽保守(不是谎报成功),但那正是本件要修的那个场景,所以指纹按**递归键排序 +
|
|
219
|
-
* 数组保序**铸(见 {@link canonicalFingerprintJson})。
|
|
220
|
-
*
|
|
221
|
-
* 缺席一律折 `null` 哨兵(不是省位):`{updatedInput: undefined}` 与「没有这个键」在本比对里是同一件事。
|
|
222
|
-
* ⚠️ 调用方**必须**按 outcome 铸点的在场规则喂参(`updatedInput` 只在 approve 上、`reason` 走真值判)——
|
|
223
|
-
* 铸点丢掉的字节行上就没有,请求侧多喂一件会把一次合法重试误判成「不同的决议」。
|
|
224
|
-
* 序列化失败(循环引用/BigInt 等)⇒ `null` = 判别不出,调用方据此拒绝回放(fail-closed)。
|
|
225
|
-
*/
|
|
226
|
-
export declare function approvalPayloadFingerprint(v: {
|
|
227
|
-
updatedInput?: unknown;
|
|
228
|
-
answer?: unknown;
|
|
229
|
-
reason?: string;
|
|
230
|
-
}): string | null;
|
|
231
|
-
/**
|
|
232
|
-
* #368 件1 —— {@link SqlCheckpointStore.findDecidedApprovalsForBinding} 的扫描上界。
|
|
314
|
+
* [ref] 件1 —— {@link SqlCheckpointStore.findDecidedApprovalsForBinding} 的扫描上界。
|
|
233
315
|
*
|
|
234
316
|
* 🔴 它**同时是判据**,不只是一道 LIMIT:调用方按「命中集里每条判词都一致才回放」判,而一次被截断的
|
|
235
317
|
* 集合可能把分歧藏在第 N+1 行 ⇒ 消费点约定「**回满 = 判别不出**」,整次拒绝回放(回落 404)。现网正常形
|
|
@@ -237,7 +319,7 @@ export declare function approvalPayloadFingerprint(v: {
|
|
|
237
319
|
*/
|
|
238
320
|
export declare const DECIDED_REPLAY_SCAN_CAP = 8;
|
|
239
321
|
/**
|
|
240
|
-
*
|
|
322
|
+
* [ref] 件1 —— core 的 `ResolvedOutcome` → 本腿(工具审批 decide)的二值词表。**闭集穷举**([ref]):
|
|
241
323
|
* core 哪天给 `ResolvedOutcome.decision` 加员,下面的 `never` 当场编译期红,而不是让一个新判词被
|
|
242
324
|
* 静默折成 `deny` 或漏成「没有决议」。
|
|
243
325
|
*
|
|
@@ -254,7 +336,7 @@ export declare function approvalDecisionOfWinner(winner: ResolvedOutcome | undef
|
|
|
254
336
|
type SteerColumnState = Pick<CheckpointState, "pendingSteer" | "pendingSteerQueue">;
|
|
255
337
|
/** 读列结果。`lossy` = 列里有东西但**没能完整读出来**(JSON 坏 / 条目形不认)。两个调用点对它的处置
|
|
256
338
|
* 刻意相反,见各自的旁注:`get()` 容忍(坏列不许把一条挂起的 run 变成不可 resume),`setPendingSteer`
|
|
257
|
-
* fail-loud(往一份读不全的队列上追加 = 把别人 park 的指令悄悄写没,正是
|
|
339
|
+
* fail-loud(往一份读不全的队列上追加 = 把别人 park 的指令悄悄写没,正是 [ref] 要消灭的那件事)。 */
|
|
258
340
|
interface SteerColumnRead {
|
|
259
341
|
state: SteerColumnState;
|
|
260
342
|
lossy: boolean;
|
|
@@ -274,11 +356,11 @@ export declare class SqlCheckpointStore implements CheckpointStore {
|
|
|
274
356
|
protected readonly logger?: {
|
|
275
357
|
info?(msg: string, meta?: unknown): void;
|
|
276
358
|
} | undefined;
|
|
277
|
-
/**
|
|
359
|
+
/** [ref] 车1:托管留存声明。读法与「为什么 SQL 店答 managed 而三方法的实现体在 `retention-store-sql.ts`」
|
|
278
360
|
* 逐字见 {@link MANAGED_RETENTION}(本店的 `checkpoint`/`checkpoint_ctx` 两表由那只聚合店按期清)。 */
|
|
279
361
|
readonly retention: import("@sema-agent/core").RetentionDeclaration;
|
|
280
362
|
/**
|
|
281
|
-
* `CheckpointStore.durability` 声明(
|
|
363
|
+
* `CheckpointStore.durability` 声明([ref] 欠账,[ref] 件5)—— 行落在 MySQL-protocol / PostgreSQL 的
|
|
282
364
|
* `checkpoint` 表里,进程重启、副本轮换、整机重建都不丢 ⇒ `"durable"`,如实。
|
|
283
365
|
*
|
|
284
366
|
* 🔴 为什么这一格空着是有代价的:core 的 `resolveDeclaredDurability` 把**缺席**折成 `"process-local"`
|
|
@@ -289,7 +371,7 @@ export declare class SqlCheckpointStore implements CheckpointStore {
|
|
|
289
371
|
*/
|
|
290
372
|
readonly durability: StoreDurability;
|
|
291
373
|
/**
|
|
292
|
-
* `CheckpointStore.fidelity` 声明(core 5.17.0 [
|
|
374
|
+
* `CheckpointStore.fidelity` 声明(core 5.17.0 [ref] 提货批 [ref])——**如实按介质判**:本店把整个
|
|
293
375
|
* checkpoint 经 {@link SqlCheckpointStore.json} 编码进一个 JSON 列(TiDB 逐字文本 / PG lossless
|
|
294
376
|
* `::jsonb` 协议信封),读侧 `parseJson` 还原 ⇒ 能扛过 round-trip 的只有 JSON 值域,`"json"`。
|
|
295
377
|
*
|
|
@@ -297,7 +379,7 @@ export declare class SqlCheckpointStore implements CheckpointStore {
|
|
|
297
379
|
* (读 json),所以沉默不会立刻错——但沉默**表达不出**「我核对过我的介质就是这个宽度」。park 铸行
|
|
298
380
|
* 的 args / preview / 风险描述 / `boundInputHash` 全部从这一格算出的投影铸;哪天这四行编码里任何
|
|
299
381
|
* 一处改了介质(换存储格式、换列类型),声明在场才有东西可以红,沉默那格只会安静地按错宽度铸出
|
|
300
|
-
* 一份「审批人看到的 ≠ 盘上躺着的 ≠ resume 执行的」。同 `durability` 的
|
|
382
|
+
* 一份「审批人看到的 ≠ 盘上躺着的 ≠ resume 执行的」。同 `durability` 的 [ref] 件5 教训:表态是店
|
|
301
383
|
* 自己的责任,不是消费侧靠 backend.kind 猜。
|
|
302
384
|
*
|
|
303
385
|
* ⚠️ **已知残余(不是遮掩,是这两个词表达不了的那一格)**:PG 臂比 `"json"` 字面**略窄** ——
|
|
@@ -307,13 +389,13 @@ export declare class SqlCheckpointStore implements CheckpointStore {
|
|
|
307
389
|
* 「json 减去本介质存不下的码位」——声明 `"structured-clone"` 是大得多的谎,所以 `"json"` 仍是两者
|
|
308
390
|
* 里唯一诚实的选择。后果有界且 fail-closed:core 5.17.0 起 park 铸行失败会把 cause 带到 gate、追加
|
|
309
391
|
* 到 fallback 的 deny 上,这条 args 退回**同步门**由人判(不静默漏批、不挂死)。边界钉在
|
|
310
|
-
* `wiring-governance-operator.test.ts` 的
|
|
392
|
+
* `wiring-governance-operator.test.ts` 的 [ref] 组;已上报上游求一个能表达该宽度的词。
|
|
311
393
|
*/
|
|
312
394
|
readonly fidelity: StoreFidelity;
|
|
313
395
|
/**
|
|
314
|
-
* `CheckpointStore.redecision` 声明(core 5.22.0 F-012 L2/L3;[
|
|
396
|
+
* `CheckpointStore.redecision` 声明(core 5.22.0 F-012 L2/L3;[ref] clay 裁放行)——**如实按能力判**:
|
|
315
397
|
* 本店的 {@link SqlCheckpointStore.reopen} 是真 CAS 实现(`resolved`→`pending` 原子翻回 + `reopen_reason`
|
|
316
|
-
* 权威列,
|
|
398
|
+
* 权威列,[ref] D-1 的两条重开腿都走它),声明 `reopen: true` 是读数不是抬举。core 的沙箱准入
|
|
317
399
|
* 模式(pre-flight 要求 `redecision.reopen === true`,declaration never duck-typing——方法在场不算数)
|
|
318
400
|
* 由这一格武装:Kata 腿(`capabilities.isolation` 真声明)+ durable park 部署下,`sandbox_local` ask
|
|
319
401
|
* 自动放行并以 `permission.sandbox_admitted` durable 事件披露(缺席披露=core 侧变异恰红)。
|
|
@@ -339,9 +421,18 @@ export declare class SqlCheckpointStore implements CheckpointStore {
|
|
|
339
421
|
* scrubbing the byte and storing the scrubbed row is the unacceptable arm; refusing loudly is the chosen one.
|
|
340
422
|
* That refusal is why {@link SqlCheckpointStore.fidelity} carries a documented residual (see it). */
|
|
341
423
|
private json;
|
|
342
|
-
/** 判据属主 = `sql-errors.ts`(
|
|
424
|
+
/** 判据属主 = `sql-errors.ts`([ref] P1-①;旧形 tidb 臂只认 errno ⇒ 只带 `code` 的 dup 会把
|
|
343
425
|
* `checkpoint.already_exists` 这条 typed 契约错误退化成裸驱动对象上抛)。 */
|
|
344
426
|
private isDupKey;
|
|
427
|
+
/** 第 n 个(1-based)绑定参数的占位符文本 —— 与 approval-ask-store-sql.ts 的 `ph` 同形:谓词按 binding
|
|
428
|
+
* 内容动态变化,固定的两段式 SQL 文本写不出来,占位符本身也得按方言现场生成(分支仍在这一处显式)。 */
|
|
429
|
+
private ph;
|
|
430
|
+
/**
|
|
431
|
+
* [ref]:两条 session 键读口的**唯一**谓词/序属主(理由全文见 {@link PendingRowBinding} 顶注)。
|
|
432
|
+
* `findPendingTokenBySession` 与 `peekPendingScope` 都从这里拿 SQL —— 路由层的 owner 门与载入点因此
|
|
433
|
+
* 结构上选中同一行(修前是两段各写各的无序 `LIMIT 1`)。
|
|
434
|
+
*/
|
|
435
|
+
private pendingRowQuery;
|
|
345
436
|
/** Create-once. core mints the token (`mintCheckpointToken`) and calls this during suspend. */
|
|
346
437
|
put(token: CheckpointToken, cp: Checkpoint): Promise<void>;
|
|
347
438
|
get(token: CheckpointToken): Promise<Checkpoint | null>;
|
|
@@ -350,7 +441,7 @@ export declare class SqlCheckpointStore implements CheckpointStore {
|
|
|
350
441
|
* resolved/expired (AlreadyResolved → caller no-ops, never re-executes). `outcome` is persisted atomically
|
|
351
442
|
* with the flip (R20 #1 — a future v2 resumable-resume can recover a crash-after-CAS; v1 runner write-only).
|
|
352
443
|
*
|
|
353
|
-
*
|
|
444
|
+
* [ref] D-1 (atomicity): the winner-persist (the full `outcome` is stored; the winner
|
|
354
445
|
* {boundCallId,decision,updatedInput?} is derived from it on read) + the `rev` bump happen ATOMICALLY in the
|
|
355
446
|
* SAME UPDATE as the pending→resolved CAS — one statement, no get→write window. When the caller passes the
|
|
356
447
|
* `rev` it observed at get() (ResolveExpectation), the CAS additionally requires the LIVE rev to still equal
|
|
@@ -372,7 +463,7 @@ export declare class SqlCheckpointStore implements CheckpointStore {
|
|
|
372
463
|
* would otherwise strand the suspended work as `resolved` + unfindable (`findPendingTokenBySession` only
|
|
373
464
|
* matches `pending`). Reopening lets a retry re-resume the SAME work.
|
|
374
465
|
*
|
|
375
|
-
*
|
|
466
|
+
* [ref] D-1 (reopen-by-reason): the `reason` distinguishes the two triggers (both fire at core's
|
|
376
467
|
* runtask.ts) so the re-resume can validate per reason (§3 inv #1) — `env_failed` = the action is still
|
|
377
468
|
* valid, the re-resume MUST replay the persisted winner (core rejects a different decision with
|
|
378
469
|
* `checkpoint.reopen_revote`); `tool_unavailable` = the action could not run and may now be stale, so a
|
|
@@ -383,7 +474,7 @@ export declare class SqlCheckpointStore implements CheckpointStore {
|
|
|
383
474
|
*/
|
|
384
475
|
reopen(token: CheckpointToken, scope: string, reason: ReopenReason): Promise<boolean>;
|
|
385
476
|
/**
|
|
386
|
-
*
|
|
477
|
+
* [ref] D-A (durable steering) —— **core 5.14.0([ref] BREAKING)起是「追加进一条有界有序队列」**,
|
|
387
478
|
* 不再是「盖掉单座」。两个人同时给一条挂起的 run 转向,旧语义会让第二条**静默销毁**第一条(一条没人
|
|
388
479
|
* 知道丢了的操作员指令);新语义是两条都在,resume 按 `seq` 全数投递。
|
|
389
480
|
*
|
|
@@ -398,9 +489,9 @@ export declare class SqlCheckpointStore implements CheckpointStore {
|
|
|
398
489
|
* 一条已被接受的指令。
|
|
399
490
|
*
|
|
400
491
|
* 🔴 从「一条无条件 UPDATE」变成「读-改-写」,中间那道窗必须自己有 CAS:两个并发 steer 读到同一份
|
|
401
|
-
* 队列、后写者整个盖掉前者 —— 就是
|
|
492
|
+
* 队列、后写者整个盖掉前者 —— 就是 [ref] 要消灭的静默丢失换了个位置复发。守卫是 `pending_steer_rev`
|
|
402
493
|
* **专用整数列**(不是拿旧列值比:整数按构造唯一,而长 JSON 文本的相等性取决于排序规则/字段序/空白与
|
|
403
|
-
* 转义形,任一处判等松一点就是一次 CAS 假命中 = 悄悄丢一条 steer
|
|
494
|
+
* 转义形,任一处判等松一点就是一次 CAS 假命中 = 悄悄丢一条 steer。[ref] A11 更正:本注原先的理由写的是
|
|
404
495
|
* "本表无显式 COLLATE,*_ci 会把只差大小写的两份信封判等",那半已不成立——`checkpoint` 现在钉了
|
|
405
496
|
* `COLLATE utf8mb4_bin`/PG 侧 `COLLATE "C"`;结论不变,理由回到上面那条更根本的;
|
|
406
497
|
* 也不是复用 resolve 的 `rev`:bump 它会让并发 resume 的 `resolve(expect)` 白白落败)。
|
|
@@ -426,10 +517,10 @@ export declare class SqlCheckpointStore implements CheckpointStore {
|
|
|
426
517
|
* GLOBAL sweep for the service's per-replica TTL reaper (expiry isn't tenant-
|
|
427
518
|
* sensitive — only `resolve` is scoped). Idempotent across replicas (DB serializes; no election). Returns count.
|
|
428
519
|
* Called with `cutoff = Date.now()` (deadline/terminal_at_ms are ABSOLUTE epoch-ms), so it expires any pending row
|
|
429
|
-
* whose per-approval `deadline` OR its
|
|
520
|
+
* whose per-approval `deadline` OR its [ref] D-1 §3-inv#3 `terminal_at_ms` crash-safe backstop has passed —
|
|
430
521
|
* the latter closes the forever-leak of a pending row with a NULL `deadline` (no approval TTL was configured).
|
|
431
522
|
*
|
|
432
|
-
*
|
|
523
|
+
* [ref] D-D: the deadline-branch EXPIRES (≈ abort) every kind EXCEPT a tool-approval human/irreversible_ask
|
|
433
524
|
* gate — those are resolve-DENIED gracefully by the SLA deny-sweep (listExpiredApprovalGates →
|
|
434
525
|
* resumeCheckpoint(deny)), so expiring them here too would race + lose the graceful denial. 🔴 A durable
|
|
435
526
|
* AskUserQuestion ALSO mints gate.kind='human' (no question-specific kind in core) — but DENYING a question is
|
|
@@ -441,7 +532,7 @@ export declare class SqlCheckpointStore implements CheckpointStore {
|
|
|
441
532
|
*/
|
|
442
533
|
reapExpired(cutoff: number): Promise<number>;
|
|
443
534
|
/**
|
|
444
|
-
*
|
|
535
|
+
* [ref] D-D (SLA-timer): the sessions of pending human/irreversible_ask checkpoints past their `deadline`
|
|
445
536
|
* (the per-approval SLA). The reaper resolve-DENIES each (re-resume with decision=deny → the model continues
|
|
446
537
|
* with the denial) — graceful, vs the abort that expire() gives resource_limit/needs_review. Excludes legacy
|
|
447
538
|
* rows (gate_kind NULL — they predate the split and fall through to reapExpired's expire path). LIMIT bounds
|
|
@@ -459,7 +550,7 @@ export declare class SqlCheckpointStore implements CheckpointStore {
|
|
|
459
550
|
* session claim, so the join is live for every pending row; null only in pathological windows). */
|
|
460
551
|
listPending(scope?: string): Promise<PendingCheckpoint[]>;
|
|
461
552
|
/**
|
|
462
|
-
*
|
|
553
|
+
* [ref] #2 (scheduler seam, core 1.105): a scope's PENDING checkpoints as lightweight
|
|
463
554
|
* {@link CheckpointSummary} rows in ONE query — the cross-task triage view a supervisor scheduler needs
|
|
464
555
|
* (gate kind + risk severity + budget spent + deadline per suspended task), no N+1 `get`s. The projection is
|
|
465
556
|
* core's shared {@link summarizeCheckpoint} run over the persisted blob (the `checkpoint` column = the same full
|
|
@@ -472,13 +563,19 @@ export declare class SqlCheckpointStore implements CheckpointStore {
|
|
|
472
563
|
*/
|
|
473
564
|
listByScope(scope: string): Promise<CheckpointSummary[]>;
|
|
474
565
|
/**
|
|
475
|
-
* Map a session (the non-secret handle the operator decides by) → its
|
|
476
|
-
*
|
|
477
|
-
*
|
|
566
|
+
* Map a session (the non-secret handle the operator decides by) → its pending checkpoint token, INTERNALLY.
|
|
567
|
+
* `scope` is enforced so an operator can only resolve within its own tenant. Returns null if there is no
|
|
568
|
+
* pending checkpoint for that session/scope.
|
|
569
|
+
*
|
|
570
|
+
* 🔴 [ref]([ref]):「A suspended session has exactly one pending checkpoint」这句旧注**不成立**(同 session
|
|
571
|
+
* 下 `task_done` 纯 park 与下一条 run 的门 park 合法并存,表上无唯一约束),旧形无序 `LIMIT 1` 因此不确定。
|
|
572
|
+
* 现形 = `binding.gateKinds` 门型绑定 + 显式序(最新优先,token 兜平局),谓词/序的唯一属主
|
|
573
|
+
* {@link SqlCheckpointStore.pendingRowQuery};语义与三态全文见 {@link PendingRowBinding} 顶注。
|
|
574
|
+
* `scope` 传 `""`(空串)历史上与缺席同义(旧形 `scope ?` 真值判),这里逐字保留。
|
|
478
575
|
*/
|
|
479
|
-
findPendingTokenBySession(sessionId: string, scope?: string): Promise<CheckpointToken | null>;
|
|
576
|
+
findPendingTokenBySession(sessionId: string, scope?: string, binding?: PendingRowBinding): Promise<CheckpointToken | null>;
|
|
480
577
|
/**
|
|
481
|
-
* 🔴
|
|
578
|
+
* 🔴 [ref] 车5 §9 C4 —— 流内审批对账收敛器判据 1 的**窄读口**(店面承载;收敛器本体不在本车)。
|
|
482
579
|
*
|
|
483
580
|
* 「这条 PARKING 的 ask 究竟 park 成了哪张 checkpoint?」的唯一读法。为什么不是「按 session 翻历史页」:
|
|
484
581
|
* 分页宽读会漏匹配,而漏匹配在收敛器那侧的后果是**假阴性 ⇒ 落一条不可逆的 DENIED**。所以这里改成
|
|
@@ -501,12 +598,12 @@ export declare class SqlCheckpointStore implements CheckpointStore {
|
|
|
501
598
|
* 🔴 **没有「列命中即零解析」的快路径**(原注写过,已作废,别照它优化):函数体对**每一行**无条件解
|
|
502
599
|
* blob,原因有二 ——(a) 前向兼容门与 blob 可读性门必须门在**所有**命中路径之前(codex F3 + 确认轮:
|
|
503
600
|
* 列长得对不代表 blob 读得出,放行一条读不出的行去 `bindBatch` 会把 ask 钉成 PARKED + 一张本进程读不出
|
|
504
|
-
* 的 resume 坐标,而 PARKED 不可回滚);(b)
|
|
601
|
+
* 的 resume 坐标,而 PARKED 不可回滚);(b) `[ref]` 之后 blob 顶层的 `sourceTaskId` 是和解三元组的第一
|
|
505
602
|
* 维,列命中行结构上也必须解 blob 才拿得到它。
|
|
506
603
|
*/
|
|
507
604
|
findCheckpointCandidatesForAsk(scope: string, sessionId: string, toolCallId: string, sinceMs: number): Promise<CheckpointAskCandidate[]>;
|
|
508
605
|
/**
|
|
509
|
-
*
|
|
606
|
+
* [ref] 件1 —— 「这条会话上的这一次工具调用,**是不是已经被决过了**?」的窄读口(legacy `/decide`
|
|
510
607
|
* 腿的幂等回放判别器;返回形见 {@link DecidedApprovalRecord})。
|
|
511
608
|
*
|
|
512
609
|
* 为什么必须有这一口(而不是复用 `findPendingTokenBySession`):后者硬 `status='pending'`,首决之后
|
|
@@ -544,7 +641,7 @@ export declare class SqlCheckpointStore implements CheckpointStore {
|
|
|
544
641
|
* caller may only decide a checkpoint in their OWN scope. Returns `undefined` (no pending row), `null`
|
|
545
642
|
* (anonymous/dev session — open), or the owner scope string.
|
|
546
643
|
*/
|
|
547
|
-
peekPendingScope(sessionId: string): Promise<string | null | undefined>;
|
|
644
|
+
peekPendingScope(sessionId: string, binding?: PendingRowBinding): Promise<string | null | undefined>;
|
|
548
645
|
/** Upsert the resume rebuild inputs for a session (written at SUBMIT when durable mode is on). */
|
|
549
646
|
putCtx(sessionId: string, ctx: unknown): Promise<void>;
|
|
550
647
|
getCtx<T = unknown>(sessionId: string): Promise<T | null>;
|
|
@@ -590,5 +687,4 @@ export declare class PgCheckpointStore extends SqlCheckpointStore {
|
|
|
590
687
|
info?(msg: string, meta?: unknown): void;
|
|
591
688
|
});
|
|
592
689
|
}
|
|
593
|
-
export {};
|
|
594
690
|
//# sourceMappingURL=checkpoint-store-sql.d.ts.map
|