@sema-agent/core 7.68.5 → 7.69.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/CHANGELOG.md +1611 -0
- package/dist/agents/agent-definition.d.ts +32 -3
- package/dist/agents/agent-definition.js +39 -1
- package/dist/agents/agent-transcript-tool.js +16 -5
- package/dist/agents/cascade.js +9 -6
- package/dist/agents/cc-uds-peer-channel.js +2 -1
- package/dist/agents/cumulative-stats.d.ts +3 -1
- package/dist/agents/cumulative-stats.js +4 -1
- package/dist/agents/delegation-review-faces.d.ts +35 -0
- package/dist/agents/delegation-review-faces.js +26 -0
- package/dist/agents/inherited-tool-pool.d.ts +4 -2
- package/dist/agents/list-agents-tool.d.ts +8 -19
- package/dist/agents/list-agents-tool.js +19 -34
- package/dist/agents/peer-directory.js +3 -2
- package/dist/agents/peer-session-drain.js +3 -3
- package/dist/agents/repair-loop.js +12 -8
- package/dist/agents/retain-ledger.d.ts +122 -58
- package/dist/agents/retain-ledger.js +48 -21
- package/dist/agents/root-session-lane.d.ts +17 -0
- package/dist/agents/root-session-lane.js +9 -0
- package/dist/agents/send-message-tool.js +44 -31
- package/dist/agents/subagent-steps.d.ts +0 -11
- package/dist/agents/subagent-steps.js +1 -14
- package/dist/agents/subagent-transcript-placement.d.ts +4 -3
- package/dist/agents/subagent.d.ts +19 -8
- package/dist/agents/subagent.js +250 -207
- package/dist/agents/tool-filter.d.ts +31 -1
- package/dist/agents/tool-filter.js +28 -4
- package/dist/agents/verifier-independence.js +3 -2
- package/dist/agents/verify.d.ts +5 -1
- package/dist/agents/verify.js +10 -6
- package/dist/agents/yield-adoption.d.ts +17 -0
- package/dist/agents/yield-adoption.js +22 -2
- package/dist/brain/anthropic.js +42 -14
- package/dist/brain/claude-model-id.d.ts +36 -0
- package/dist/brain/claude-model-id.js +44 -0
- package/dist/brain/failover.js +14 -3
- package/dist/brain/fast-mode.d.ts +272 -0
- package/dist/brain/fast-mode.js +130 -0
- package/dist/brain/media-degrade.d.ts +5 -0
- package/dist/brain/media-degrade.js +1 -0
- package/dist/brain/model-capability.d.ts +122 -18
- package/dist/brain/model-capability.js +84 -7
- package/dist/brain/model-lane.d.ts +40 -16
- package/dist/brain/model-lane.js +97 -39
- package/dist/brain/model-presets.d.ts +4 -1
- package/dist/brain/model-presets.js +10 -1
- package/dist/brain/open-responses.js +37 -14
- package/dist/brain/openai.js +27 -15
- package/dist/brain/provider-dialect.d.ts +9 -0
- package/dist/brain/provider-dialect.js +4 -0
- package/dist/brain/provider-message.d.ts +2 -2
- package/dist/brain/provider-message.js +8 -8
- package/dist/brain/reasoning-request.d.ts +19 -0
- package/dist/brain/reasoning-request.js +8 -4
- package/dist/brain/reasoning-stamp.d.ts +3 -2
- package/dist/brain/reasoning.d.ts +8 -4
- package/dist/brain/reasoning.js +4 -3
- package/dist/brain/reference-model-traits.d.ts +59 -0
- package/dist/brain/reference-model-traits.js +46 -0
- package/dist/brain/request-params.js +1 -0
- package/dist/brain/route-adjudicator.d.ts +107 -106
- package/dist/brain/route-adjudicator.js +217 -51
- package/dist/brain/route-conformance.d.ts +6 -4
- package/dist/brain/routing.d.ts +2 -1
- package/dist/brain/routing.js +21 -5
- package/dist/brain/status-sink.d.ts +52 -10
- package/dist/brain/stream-engine.d.ts +68 -11
- package/dist/brain/stream-engine.js +512 -93
- package/dist/brain/stream-shared.d.ts +34 -8
- package/dist/brain/stream-shared.js +20 -7
- package/dist/brain/usage-reading.d.ts +15 -0
- package/dist/brain/usage-reading.js +18 -5
- package/dist/core/a2a.js +28 -21
- package/dist/core/advisor-verdict.d.ts +5 -4
- package/dist/core/advisor-verdict.js +2 -2
- package/dist/core/agent-definition.d.ts +4 -1
- package/dist/core/agent-state.d.ts +25 -2
- package/dist/core/agent-state.js +50 -3
- package/dist/core/allow-entry.d.ts +6 -6
- package/dist/core/allow-entry.js +27 -25
- package/dist/core/ask-headline.d.ts +28 -16
- package/dist/core/ask-headline.js +18 -8
- package/dist/core/ask-origin.d.ts +105 -30
- package/dist/core/ask-origin.js +40 -11
- package/dist/core/ask-question.d.ts +9 -1
- package/dist/core/ask-question.js +3 -0
- package/dist/core/ask-unresolvable-notice.d.ts +10 -2
- package/dist/core/ask-unresolvable-notice.js +5 -2
- package/dist/core/attachment-source.d.ts +1 -1
- package/dist/core/attachment-source.js +1 -0
- package/dist/core/auto-compaction.d.ts +4 -4
- package/dist/core/auto-compaction.js +4 -3
- package/dist/core/auto-mode-directive.d.ts +30 -60
- package/dist/core/auto-mode-directive.js +36 -38
- package/dist/core/auto-mode.d.ts +40 -9
- package/dist/core/auto-mode.js +20 -5
- package/dist/core/background-agent-store.d.ts +87 -1
- package/dist/core/background-agent-store.js +72 -1
- package/dist/core/background-shell.d.ts +3 -0
- package/dist/core/background-shell.js +1 -0
- package/dist/core/cache-break-detector.js +1 -1
- package/dist/core/caller-text.d.ts +27 -8
- package/dist/core/caller-text.js +47 -1
- package/dist/core/checkpoint-features.d.ts +17 -9
- package/dist/core/checkpoint-identity.d.ts +53 -0
- package/dist/core/checkpoint-identity.js +29 -0
- package/dist/core/checkpoint-queries.d.ts +4 -3
- package/dist/core/checkpoint-queries.js +5 -3
- package/dist/core/checkpoint-rekey.d.ts +70 -0
- package/dist/core/checkpoint-rekey.js +107 -0
- package/dist/core/checkpoint-requirements.d.ts +65 -10
- package/dist/core/checkpoint-requirements.js +47 -13
- package/dist/core/checkpoint-row-verdict.d.ts +5 -3
- package/dist/core/checkpoint-row-verdict.js +37 -4
- package/dist/core/checkpoint-store.d.ts +71 -5
- package/dist/core/checkpoint-store.js +38 -7
- package/dist/core/child-clamp-seats.js +2 -1
- package/dist/core/classifier-category.d.ts +25 -0
- package/dist/core/classifier-category.js +93 -0
- package/dist/core/classifier-unavailable-arm.d.ts +62 -8
- package/dist/core/classifier-unavailable-arm.js +19 -2
- package/dist/core/command-sandbox-dispatch.d.ts +14 -2
- package/dist/core/command-sandbox.d.ts +209 -28
- package/dist/core/command-sandbox.js +195 -20
- package/dist/core/config-refusal-codes.d.ts +41 -1
- package/dist/core/config-refusal-codes.js +16 -0
- package/dist/core/context-edit.d.ts +2 -1
- package/dist/core/context-edit.js +2 -1
- package/dist/core/context-settings.js +5 -4
- package/dist/core/cross-boundary-taint.d.ts +15 -1
- package/dist/core/cross-boundary-taint.js +6 -0
- package/dist/core/delegation-frames.d.ts +36 -6
- package/dist/core/delegation-frames.js +3 -0
- package/dist/core/delegation-name.d.ts +10 -4
- package/dist/core/delegation-name.js +53 -23
- package/dist/core/engine-attestation.d.ts +10 -2
- package/dist/core/engine-attestation.js +2 -0
- package/dist/core/engine-capabilities.d.ts +40 -3
- package/dist/core/engine-capabilities.js +1 -1
- package/dist/core/engine-notice.d.ts +197 -90
- package/dist/core/engine-notice.js +29 -1
- package/dist/core/engine-version.d.ts +1 -0
- package/dist/core/engine-version.js +1 -0
- package/dist/core/extension-call-id.d.ts +4 -0
- package/dist/core/extension-call-id.js +8 -0
- package/dist/core/fast-tier-door.d.ts +36 -0
- package/dist/core/fast-tier-door.js +65 -0
- package/dist/core/file-history-store.d.ts +343 -67
- package/dist/core/file-history-store.js +320 -93
- package/dist/core/frame-settlement.d.ts +4 -0
- package/dist/core/frame-settlement.js +5 -0
- package/dist/core/gate-fold.js +13 -4
- package/dist/core/gate-lanes.js +27 -20
- package/dist/core/gate-outcome.d.ts +87 -11
- package/dist/core/gate-outcome.js +94 -4
- package/dist/core/git-worktree-env.d.ts +29 -10
- package/dist/core/git-worktree-env.js +31 -12
- package/dist/core/governance-codes.d.ts +232 -7
- package/dist/core/governance-codes.js +195 -6
- package/dist/core/hooks.d.ts +27 -16
- package/dist/core/hooks.js +84 -82
- package/dist/core/host-floor.d.ts +2 -8
- package/dist/core/host-floor.js +6 -42
- package/dist/core/identity-rekey.d.ts +275 -0
- package/dist/core/identity-rekey.js +198 -0
- package/dist/core/image-admission.d.ts +7 -4
- package/dist/core/image-admission.js +24 -11
- package/dist/core/isolation-scope.d.ts +12 -0
- package/dist/core/isolation-scope.js +4 -0
- package/dist/core/leg-identity.d.ts +32 -2
- package/dist/core/leg-identity.js +16 -2
- package/dist/core/locked-config.d.ts +26 -6
- package/dist/core/locked-config.js +31 -14
- package/dist/core/loopback-host.d.ts +18 -0
- package/dist/core/loopback-host.js +40 -0
- package/dist/core/mcp-connection-pool.d.ts +57 -33
- package/dist/core/mcp-connection-pool.js +47 -23
- package/dist/core/mcp-failure.d.ts +41 -19
- package/dist/core/mcp-failure.js +14 -8
- package/dist/core/mcp-host-read.js +5 -4
- package/dist/core/mcp-host-seat.js +3 -2
- package/dist/core/mcp-name-judge.js +2 -1
- package/dist/core/mcp-server-link.js +2 -1
- package/dist/core/mcp-server-spec.js +2 -2
- package/dist/core/mcp-server-unavailable-notice.d.ts +26 -16
- package/dist/core/mcp-server-unavailable-notice.js +25 -4
- package/dist/core/mcp.d.ts +15 -9
- package/dist/core/mcp.js +46 -34
- package/dist/core/memory-engine/consolidation-driver.js +8 -8
- package/dist/core/memory-engine/consolidation-write-gate.js +3 -2
- package/dist/core/memory-engine/engine.js +9 -9
- package/dist/core/memory-engine/layout.d.ts +6 -5
- package/dist/core/memory-engine/layout.js +1 -1
- package/dist/core/memory.d.ts +5 -0
- package/dist/core/memory.js +3 -0
- package/dist/core/model-fallbacks.d.ts +13 -7
- package/dist/core/model-fallbacks.js +5 -3
- package/dist/core/model-receipt.d.ts +15 -0
- package/dist/core/model-receipt.js +54 -1
- package/dist/core/model-seat.d.ts +17 -15
- package/dist/core/mods/agent-stations.js +5 -4
- package/dist/core/mods/extension-call.d.ts +0 -4
- package/dist/core/mods/extension-call.js +0 -8
- package/dist/core/mods/host.d.ts +18 -0
- package/dist/core/mods/host.js +7 -0
- package/dist/core/mods/kernel/events.d.ts +12 -0
- package/dist/core/mods/kernel/events.js +18 -9
- package/dist/core/mods/kernel/registration.d.ts +13 -0
- package/dist/core/mods/kernel/registration.js +34 -1
- package/dist/core/mods/message-display.js +1 -1
- package/dist/core/mods/package.js +3 -3
- package/dist/core/mods/prompt-submit.js +2 -2
- package/dist/core/mods/session-append.js +3 -3
- package/dist/core/mods/session-compact.js +5 -5
- package/dist/core/mods/session-receive.js +3 -3
- package/dist/core/mods/session-send.js +3 -3
- package/dist/core/mods/stations.d.ts +8 -5
- package/dist/core/mods/stations.js +13 -12
- package/dist/core/mods/tool-call.js +12 -12
- package/dist/core/mounted-mcp.d.ts +10 -1
- package/dist/core/mounted-mcp.js +4 -0
- package/dist/core/output-style.d.ts +14 -8
- package/dist/core/output-style.js +6 -6
- package/dist/core/own-property-receipt.js +3 -5
- package/dist/core/owner-identity.d.ts +68 -0
- package/dist/core/owner-identity.js +39 -0
- package/dist/core/parent-spec-seat.d.ts +5 -1
- package/dist/core/parent-spec-seat.js +2 -0
- package/dist/core/park-resumability.js +2 -2
- package/dist/core/park-selfcheck.js +15 -4
- package/dist/core/peer-seat.d.ts +37 -11
- package/dist/core/peer-seat.js +35 -9
- package/dist/core/permission-rule-model.d.ts +5 -0
- package/dist/core/permission-rule-model.js +27 -6
- package/dist/core/permission-rules.d.ts +42 -5
- package/dist/core/permission-rules.js +74 -10
- package/dist/core/persisted-rule-arms.d.ts +8 -6
- package/dist/core/persisted-rule-arms.js +13 -20
- package/dist/core/physical-path.d.ts +12 -8
- package/dist/core/physical-path.js +24 -14
- package/dist/core/present-plan-tool.js +2 -1
- package/dist/core/pricing.d.ts +65 -8
- package/dist/core/pricing.js +51 -0
- package/dist/core/prompt-section-seat.js +6 -5
- package/dist/core/protocol-http-auth.d.ts +87 -10
- package/dist/core/protocol-http-auth.js +155 -23
- package/dist/core/reminder-mint.d.ts +4 -0
- package/dist/core/reminder-mint.js +1 -0
- package/dist/core/remote-env.d.ts +46 -1
- package/dist/core/remote-env.js +2 -0
- package/dist/core/resume-at-refusal.d.ts +47 -0
- package/dist/core/resume-at-refusal.js +9 -0
- package/dist/core/resume-startup-cause.d.ts +8 -3
- package/dist/core/resume-startup-cause.js +3 -1
- package/dist/core/retired-keys.d.ts +4 -0
- package/dist/core/retired-keys.js +4 -0
- package/dist/core/roles.d.ts +11 -5
- package/dist/core/roles.js +14 -3
- package/dist/core/rule-store-fault.d.ts +8 -1
- package/dist/core/rule-store-fault.js +5 -0
- package/dist/core/runner/advisor-instructions.d.ts +12 -12
- package/dist/core/runner/advisor-instructions.js +7 -24
- package/dist/core/runner/announce-once-ledger.d.ts +23 -8
- package/dist/core/runner/announce-once-ledger.js +69 -18
- package/dist/core/runner/assemble-result.d.ts +9 -0
- package/dist/core/runner/assemble-result.js +3 -2
- package/dist/core/runner/auto-strip-notice.js +1 -1
- package/dist/core/runner/branch-window.js +5 -3
- package/dist/core/runner/call-hook-stations.d.ts +3 -0
- package/dist/core/runner/call-hook-stations.js +4 -3
- package/dist/core/runner/caller-roster.js +2 -1
- package/dist/core/runner/capability-withheld-seat.js +47 -5
- package/dist/core/runner/classifier-ladder.d.ts +48 -8
- package/dist/core/runner/classifier-ladder.js +88 -38
- package/dist/core/runner/clock-and-limits.d.ts +13 -2
- package/dist/core/runner/clock-and-limits.js +11 -8
- package/dist/core/runner/command-sandbox-frame.d.ts +56 -0
- package/dist/core/runner/command-sandbox-frame.js +107 -0
- package/dist/core/runner/compact-session.d.ts +3 -1
- package/dist/core/runner/compact-session.js +16 -10
- package/dist/core/runner/compaction-call-options.d.ts +2 -2
- package/dist/core/runner/compaction-restate.d.ts +4 -4
- package/dist/core/runner/compaction-restate.js +3 -1
- package/dist/core/runner/construction-doors.js +9 -0
- package/dist/core/runner/continuation-gate.d.ts +39 -0
- package/dist/core/runner/continuation-gate.js +42 -0
- package/dist/core/runner/continues-from.d.ts +57 -0
- package/dist/core/runner/continues-from.js +76 -0
- package/dist/core/runner/contracts.d.ts +133 -55
- package/dist/core/runner/credential-refusal-seat.js +31 -12
- package/dist/core/runner/cross-boundary-lane.d.ts +2 -2
- package/dist/core/runner/cross-boundary-lane.js +26 -13
- package/dist/core/runner/delegation-owner.d.ts +99 -9
- package/dist/core/runner/delegation-owner.js +107 -4
- package/dist/core/runner/denial-limit-arms.js +13 -12
- package/dist/core/runner/derived-route-fallback.d.ts +15 -19
- package/dist/core/runner/derived-route-fallback.js +4 -4
- package/dist/core/runner/earlier-grammar-notice.d.ts +6 -0
- package/dist/core/runner/earlier-grammar-notice.js +9 -0
- package/dist/core/runner/env-capability-census.js +2 -1
- package/dist/core/runner/execution-record.d.ts +4 -2
- package/dist/core/runner/execution-record.js +1 -1
- package/dist/core/runner/fast-mode-seat.d.ts +89 -0
- package/dist/core/runner/fast-mode-seat.js +215 -0
- package/dist/core/runner/file-history-restore.d.ts +52 -14
- package/dist/core/runner/file-history-restore.js +50 -8
- package/dist/core/runner/forward-sink.js +2 -2
- package/dist/core/runner/gate-exit.d.ts +41 -3
- package/dist/core/runner/gate-exit.js +55 -10
- package/dist/core/runner/git-leg-delivery.js +6 -3
- package/dist/core/runner/git-status-frame.d.ts +33 -25
- package/dist/core/runner/git-status-frame.js +54 -36
- package/dist/core/runner/halt-attribution.js +2 -2
- package/dist/core/runner/hook-progress-lane.d.ts +26 -0
- package/dist/core/runner/hook-progress-lane.js +72 -0
- package/dist/core/runner/initial-run-state.js +2 -2
- package/dist/core/runner/language-frame.d.ts +10 -8
- package/dist/core/runner/language-frame.js +7 -11
- package/dist/core/runner/left-as-is-seat.d.ts +20 -0
- package/dist/core/runner/left-as-is-seat.js +11 -0
- package/dist/core/runner/leg-receipt.d.ts +38 -0
- package/dist/core/runner/leg-receipt.js +22 -0
- package/dist/core/runner/listing-fold.d.ts +4 -3
- package/dist/core/runner/listing-fold.js +5 -5
- package/dist/core/runner/listing-replay.d.ts +41 -0
- package/dist/core/runner/listing-replay.js +75 -0
- package/dist/core/runner/main-call-account.d.ts +2 -1
- package/dist/core/runner/main-call-account.js +18 -5
- package/dist/core/runner/mcp-redial.d.ts +4 -2
- package/dist/core/runner/mcp-redial.js +3 -0
- package/dist/core/runner/memory-consolidation-driver.js +3 -2
- package/dist/core/runner/model-fallback-seat.d.ts +12 -9
- package/dist/core/runner/model-fallback-seat.js +24 -20
- package/dist/core/runner/nested-memory-lane.d.ts +16 -8
- package/dist/core/runner/nested-memory-lane.js +64 -53
- package/dist/core/runner/permission-rule-lanes.d.ts +4 -3
- package/dist/core/runner/permission-rule-lanes.js +2 -0
- package/dist/core/runner/person-path-rows.js +1 -1
- package/dist/core/runner/placement-fence.js +2 -2
- package/dist/core/runner/policy-throw.d.ts +3 -3
- package/dist/core/runner/policy-throw.js +7 -5
- package/dist/core/runner/prepare-acquire-reconcile.d.ts +7 -1
- package/dist/core/runner/prepare-acquire-reconcile.js +9 -5
- package/dist/core/runner/prepare-advisor.d.ts +3 -0
- package/dist/core/runner/prepare-advisor.js +2 -2
- package/dist/core/runner/prepare-artifact.d.ts +7 -2
- package/dist/core/runner/prepare-artifact.js +18 -7
- package/dist/core/runner/prepare-ask-lane.d.ts +7 -0
- package/dist/core/runner/prepare-ask-lane.js +4 -3
- package/dist/core/runner/prepare-caps-and-workflow.d.ts +9 -5
- package/dist/core/runner/prepare-caps-and-workflow.js +28 -20
- package/dist/core/runner/prepare-config-doors.d.ts +13 -3
- package/dist/core/runner/prepare-config-doors.js +35 -24
- package/dist/core/runner/prepare-context-lane.d.ts +3 -4
- package/dist/core/runner/prepare-context-lane.js +12 -15
- package/dist/core/runner/prepare-defer-classify.d.ts +12 -0
- package/dist/core/runner/prepare-defer-classify.js +5 -2
- package/dist/core/runner/prepare-delegation-surface.d.ts +10 -8
- package/dist/core/runner/prepare-delegation-surface.js +6 -7
- package/dist/core/runner/prepare-execution-env.d.ts +46 -4
- package/dist/core/runner/prepare-execution-env.js +47 -18
- package/dist/core/runner/prepare-file-history.d.ts +4 -1
- package/dist/core/runner/prepare-file-history.js +8 -9
- package/dist/core/runner/prepare-gate-stations.d.ts +17 -9
- package/dist/core/runner/prepare-gate-stations.js +22 -38
- package/dist/core/runner/prepare-hands-readface.d.ts +13 -9
- package/dist/core/runner/prepare-hands-readface.js +26 -35
- package/dist/core/runner/prepare-inherited-gate.d.ts +9 -2
- package/dist/core/runner/prepare-inherited-gate.js +10 -9
- package/dist/core/runner/prepare-leg-adoption.d.ts +36 -0
- package/dist/core/runner/prepare-leg-adoption.js +24 -0
- package/dist/core/runner/prepare-listings.d.ts +3 -0
- package/dist/core/runner/prepare-listings.js +2 -2
- package/dist/core/runner/prepare-lsp.d.ts +0 -3
- package/dist/core/runner/prepare-lsp.js +1 -2
- package/dist/core/runner/prepare-memory-engine-session.js +1 -1
- package/dist/core/runner/prepare-memory.js +2 -2
- package/dist/core/runner/prepare-offload-wrappers.d.ts +5 -5
- package/dist/core/runner/prepare-offload-wrappers.js +5 -5
- package/dist/core/runner/prepare-park-ask.d.ts +9 -2
- package/dist/core/runner/prepare-park-ask.js +5 -3
- package/dist/core/runner/prepare-policy-chain.d.ts +20 -5
- package/dist/core/runner/prepare-policy-chain.js +32 -26
- package/dist/core/runner/prepare-prompt-assembly.d.ts +11 -2
- package/dist/core/runner/prepare-prompt-assembly.js +6 -3
- package/dist/core/runner/prepare-prompt-inputs.d.ts +3 -3
- package/dist/core/runner/prepare-prompt-inputs.js +1 -1
- package/dist/core/runner/prepare-protocol-tools.d.ts +9 -4
- package/dist/core/runner/prepare-protocol-tools.js +11 -11
- package/dist/core/runner/prepare-run-refs.d.ts +7 -0
- package/dist/core/runner/prepare-run-refs.js +6 -2
- package/dist/core/runner/prepare-suspend-saga.d.ts +4 -1
- package/dist/core/runner/prepare-suspend-saga.js +5 -2
- package/dist/core/runner/prepare-task.d.ts +1 -30
- package/dist/core/runner/prepare-task.js +111 -147
- package/dist/core/runner/prepare-turn-wiring.d.ts +10 -3
- package/dist/core/runner/prepare-turn-wiring.js +7 -4
- package/dist/core/runner/prepare-wiring-manifest.d.ts +11 -3
- package/dist/core/runner/prepare-wiring-manifest.js +20 -16
- package/dist/core/runner/prompt-block.js +2 -2
- package/dist/core/runner/prompt-suggestions.d.ts +3 -8
- package/dist/core/runner/prompt-suggestions.js +4 -1
- package/dist/core/runner/reply-pricing.d.ts +8 -4
- package/dist/core/runner/reply-pricing.js +6 -5
- package/dist/core/runner/resume-admission.js +2 -0
- package/dist/core/runner/resume-apply.js +4 -4
- package/dist/core/runner/resume-checkpoint-screen.d.ts +23 -2
- package/dist/core/runner/resume-checkpoint-screen.js +34 -27
- package/dist/core/runner/resume-preflight.js +3 -3
- package/dist/core/runner/rewind-files.js +21 -14
- package/dist/core/runner/role-resolution-table.d.ts +10 -7
- package/dist/core/runner/role-resolution-table.js +8 -7
- package/dist/core/runner/role-seat-defaulted.js +2 -2
- package/dist/core/runner/rule-store-unreadable-notice.d.ts +4 -2
- package/dist/core/runner/rule-store-unreadable-notice.js +21 -7
- package/dist/core/runner/run-attachment-seats.js +8 -15
- package/dist/core/runner/run-brain-sinks.js +1 -0
- package/dist/core/runner/run-compaction-machinery.d.ts +1 -1
- package/dist/core/runner/run-compaction-machinery.js +2 -3
- package/dist/core/runner/run-harness-handlers.d.ts +2 -2
- package/dist/core/runner/run-harness-handlers.js +18 -5
- package/dist/core/runner/run-identity-wiring.js +11 -9
- package/dist/core/runner/run-leg.js +33 -12
- package/dist/core/runner/run-notification-lane.d.ts +4 -1
- package/dist/core/runner/run-notification-lane.js +21 -8
- package/dist/core/runner/run-recovery-lanes.js +1 -1
- package/dist/core/runner/run-settle-and-teardown.d.ts +6 -1
- package/dist/core/runner/run-settle-and-teardown.js +30 -32
- package/dist/core/runner/run-stop-and-final-verify.d.ts +4 -1
- package/dist/core/runner/run-stop-and-final-verify.js +12 -49
- package/dist/core/runner/run-telemetry-and-budget-seats.js +29 -10
- package/dist/core/runner/run-terminal-adoption.js +5 -2
- package/dist/core/runner/run-turn-boundary.js +13 -11
- package/dist/core/runner/runtask.d.ts +16 -7
- package/dist/core/runner/runtask.js +49 -28
- package/dist/core/runner/sandbox-network-seat.d.ts +52 -0
- package/dist/core/runner/sandbox-network-seat.js +40 -0
- package/dist/core/runner/seat-model-doors.d.ts +16 -0
- package/dist/core/runner/seat-model-doors.js +13 -0
- package/dist/core/runner/session-file-state-replay.d.ts +20 -0
- package/dist/core/runner/session-file-state-replay.js +17 -5
- package/dist/core/runner/session-read-file-states.d.ts +37 -0
- package/dist/core/runner/session-read-file-states.js +19 -0
- package/dist/core/runner/session-rule-policy.d.ts +2 -1
- package/dist/core/runner/session-rule-policy.js +3 -2
- package/dist/core/runner/session-verb-doors.js +2 -1
- package/dist/core/runner/session-write-ledger.d.ts +5 -1
- package/dist/core/runner/session-write-ledger.js +19 -5
- package/dist/core/runner/shared-read-classifier.d.ts +48 -0
- package/dist/core/runner/shared-read-classifier.js +33 -0
- package/dist/core/runner/shell-env-withheld.d.ts +6 -3
- package/dist/core/runner/shell-env-withheld.js +25 -0
- package/dist/core/runner/side-call-account.d.ts +30 -2
- package/dist/core/runner/side-call-account.js +38 -5
- package/dist/core/runner/skipped-rules-notice.d.ts +43 -0
- package/dist/core/runner/skipped-rules-notice.js +49 -0
- package/dist/core/runner/steering-preview.js +1 -1
- package/dist/core/runner/stop-tail-notice.d.ts +40 -0
- package/dist/core/runner/stop-tail-notice.js +35 -0
- package/dist/core/runner/stream-halt-verbs.js +1 -1
- package/dist/core/runner/stream-mode-verb.d.ts +11 -4
- package/dist/core/runner/stream-mode-verb.js +19 -7
- package/dist/core/runner/stream-settle-backstop.js +3 -1
- package/dist/core/runner/stream-steer-verb.js +4 -3
- package/dist/core/runner/synthetic-tools.d.ts +11 -11
- package/dist/core/runner/synthetic-tools.js +17 -20
- package/dist/core/runner/task-start-doors.d.ts +86 -0
- package/dist/core/runner/task-start-doors.js +108 -0
- package/dist/core/runner/teardown-bounded.d.ts +5 -5
- package/dist/core/runner/teardown-bounded.js +6 -6
- package/dist/core/runner/terminal-account.d.ts +3 -2
- package/dist/core/runner/terminal-account.js +5 -3
- package/dist/core/runner/tool-disclosure.js +8 -9
- package/dist/core/runner/tool-end-body.d.ts +2 -0
- package/dist/core/runner/tool-end-body.js +1 -0
- package/dist/core/runner/tool-face-overlay.js +1 -0
- package/dist/core/runner/tool-occurrence.d.ts +22 -24
- package/dist/core/runner/tool-occurrence.js +9 -15
- package/dist/core/runner/tool-progress-lane.js +1 -1
- package/dist/core/runner/tool-result-media-seat.d.ts +7 -4
- package/dist/core/runner/tool-result-media-seat.js +16 -4
- package/dist/core/runner/tool-table-view.d.ts +7 -1
- package/dist/core/runner/tool-table-view.js +1 -1
- package/dist/core/runner/tool-turn-repair-seat.d.ts +22 -2
- package/dist/core/runner/tool-turn-repair-seat.js +23 -5
- package/dist/core/runner/turn-attachments.d.ts +74 -148
- package/dist/core/runner/turn-attachments.js +153 -223
- package/dist/core/runner/usage-accounting.d.ts +15 -0
- package/dist/core/runner/usage-accounting.js +12 -4
- package/dist/core/runner/verdict-refusal.d.ts +45 -0
- package/dist/core/runner/verdict-refusal.js +39 -0
- package/dist/core/runner/write-protection-station.d.ts +5 -0
- package/dist/core/runner/write-protection-station.js +6 -6
- package/dist/core/runner-deps.d.ts +15 -5
- package/dist/core/runtime-caps.d.ts +5 -3
- package/dist/core/secret-env.d.ts +19 -14
- package/dist/core/secret-env.js +19 -12
- package/dist/core/session-checkout.d.ts +18 -1
- package/dist/core/session-checkout.js +23 -8
- package/dist/core/session-log-transfer.js +2 -2
- package/dist/core/session-policy-store.d.ts +220 -31
- package/dist/core/session-policy-store.js +333 -47
- package/dist/core/session-reconcile.d.ts +12 -0
- package/dist/core/session-reconcile.js +1 -1
- package/dist/core/session-store.d.ts +5 -3
- package/dist/core/session-store.js +11 -11
- package/dist/core/session.d.ts +31 -22
- package/dist/core/session.js +3 -2
- package/dist/core/shared-memory/normalize.js +2 -1
- package/dist/core/side-query.d.ts +4 -0
- package/dist/core/side-query.js +7 -4
- package/dist/core/spec-contract.d.ts +4 -2
- package/dist/core/store-contracts/background-agent-store-contract.js +149 -0
- package/dist/core/store-contracts/checkpoint-store-contract.js +55 -0
- package/dist/core/store-contracts/contract-kit-version.d.ts +4 -4
- package/dist/core/store-contracts/file-history-store-contract.d.ts +1 -1
- package/dist/core/store-contracts/file-history-store-contract.js +282 -22
- package/dist/core/store-contracts/session-policy-store-contract.js +202 -0
- package/dist/core/store-contracts/session-store-contract.js +48 -14
- package/dist/core/store-contracts/tool-result-store-contract.d.ts +1 -1
- package/dist/core/store-contracts/tool-result-store-contract.js +128 -0
- package/dist/core/store-contracts/workflow-journal-store-contract.js +90 -1
- package/dist/core/swappable-deps.d.ts +16 -0
- package/dist/core/swappable-deps.js +61 -1
- package/dist/core/synthetic-read-verdict.d.ts +23 -0
- package/dist/core/synthetic-read-verdict.js +43 -18
- package/dist/core/task-event.d.ts +123 -50
- package/dist/core/task-intake.d.ts +21 -5
- package/dist/core/task-intake.js +29 -3
- package/dist/core/task-limits.d.ts +3 -1
- package/dist/core/task-notification.d.ts +171 -59
- package/dist/core/task-notification.js +162 -104
- package/dist/core/task-registry-agent.d.ts +12 -0
- package/dist/core/task-registry-agent.js +23 -9
- package/dist/core/task-registry-shared.d.ts +4 -2
- package/dist/core/task-registry-shared.js +1 -1
- package/dist/core/task-registry-workflow.js +8 -5
- package/dist/core/task-registry.d.ts +16 -1
- package/dist/core/task-registry.js +35 -23
- package/dist/core/task-result.d.ts +127 -10
- package/dist/core/task-spec-members.d.ts +5 -2
- package/dist/core/task-spec-members.js +9 -5
- package/dist/core/task-spec.d.ts +31 -12
- package/dist/core/task-start-judge.d.ts +41 -0
- package/dist/core/task-start-judge.js +26 -0
- package/dist/core/task-stream.d.ts +12 -1
- package/dist/core/terminal-cause.d.ts +23 -9
- package/dist/core/tool-catalog-entries.js +6 -5
- package/dist/core/tool-face-lists.d.ts +3 -2
- package/dist/core/tool-face-lists.js +6 -0
- package/dist/core/tool-face-reader.d.ts +3 -2
- package/dist/core/tool-face-reader.js +2 -2
- package/dist/core/tool-face.d.ts +27 -3
- package/dist/core/tool-face.js +2 -2
- package/dist/core/tool-model-gate.js +14 -13
- package/dist/core/tool-mount-facts.d.ts +16 -3
- package/dist/core/tool-mount-facts.js +10 -0
- package/dist/core/tool-mount-plan.d.ts +79 -10
- package/dist/core/tool-mount-plan.js +79 -24
- package/dist/core/tool-mount-static.d.ts +52 -6
- package/dist/core/tool-mount-static.js +82 -28
- package/dist/core/tool-name-aliases.js +1 -1
- package/dist/core/tool-policy.d.ts +25 -5
- package/dist/core/tool-policy.js +8 -6
- package/dist/core/tool-registry.d.ts +12 -2
- package/dist/core/tool-registry.js +9 -2
- package/dist/core/tool-result-budget.d.ts +2 -2
- package/dist/core/tool-result-bytes.d.ts +28 -9
- package/dist/core/tool-result-bytes.js +7 -5
- package/dist/core/tool-result-store.d.ts +310 -38
- package/dist/core/tool-result-store.js +325 -30
- package/dist/core/tool-roster.d.ts +20 -8
- package/dist/core/tool-roster.js +16 -6
- package/dist/core/tool-search-setting.js +2 -2
- package/dist/core/tool-spec.d.ts +10 -10
- package/dist/core/types.d.ts +5 -5
- package/dist/core/types.js +2 -2
- package/dist/core/unc-spelling.d.ts +114 -3
- package/dist/core/unc-spelling.js +110 -0
- package/dist/core/untrusted-egress.d.ts +82 -10
- package/dist/core/untrusted-egress.js +102 -9
- package/dist/core/untrusted-text.d.ts +28 -0
- package/dist/core/untrusted-text.js +67 -3
- package/dist/core/user-attachment.d.ts +18 -3
- package/dist/core/user-attachment.js +37 -31
- package/dist/core/user-row-origin.d.ts +22 -0
- package/dist/core/user-row-origin.js +15 -0
- package/dist/core/version.d.ts +1 -1
- package/dist/core/version.js +2 -12
- package/dist/core/wiring-manifest.d.ts +124 -30
- package/dist/core/wiring-manifest.js +59 -17
- package/dist/core/workflow-journal-store.d.ts +186 -16
- package/dist/core/workflow-journal-store.js +156 -1
- package/dist/core/workflow-run-store-contract.js +82 -1
- package/dist/core/workflow-run-store.d.ts +40 -4
- package/dist/core/workflow-run-store.js +9 -2
- package/dist/core/workspace-snapshot.d.ts +4 -1
- package/dist/core/workspace-snapshot.js +1 -1
- package/dist/engine/compaction/compaction.d.ts +3 -3
- package/dist/engine/compaction/compaction.js +16 -18
- package/dist/engine/execution-env/node-execution-env.d.ts +14 -6
- package/dist/engine/execution-env/node-execution-env.js +49 -14
- package/dist/engine/harness/agent-harness.d.ts +17 -7
- package/dist/engine/harness/agent-harness.js +66 -16
- package/dist/engine/harness/types.d.ts +31 -2
- package/dist/engine/harness/types.js +14 -1
- package/dist/engine/llm/tool-turns.d.ts +19 -2
- package/dist/engine/llm/tool-turns.js +29 -2
- package/dist/engine/llm/types.d.ts +103 -22
- package/dist/engine/llm/types.js +1 -1
- package/dist/engine/loop/agent-loop.d.ts +18 -9
- package/dist/engine/loop/agent-loop.js +115 -24
- package/dist/engine/loop/types.d.ts +14 -6
- package/dist/engine/lsp/node-lsp-manager.d.ts +6 -4
- package/dist/engine/lsp/node-lsp-manager.js +22 -21
- package/dist/engine/session/import-validate.js +2 -0
- package/dist/engine/session/repo-utils.d.ts +13 -7
- package/dist/engine/session/repo-utils.js +9 -4
- package/dist/index.d.ts +48 -27
- package/dist/index.js +38 -20
- package/dist/internal/harness.d.ts +1 -1
- package/dist/internal/llm.d.ts +2 -2
- package/dist/internal/llm.js +1 -1
- package/dist/orchestration/goal.js +1 -1
- package/dist/orchestration/governance-baseline-validity.d.ts +20 -5
- package/dist/orchestration/governance-baseline-validity.js +87 -16
- package/dist/orchestration/run-workflow-tool.d.ts +15 -12
- package/dist/orchestration/run-workflow-tool.js +757 -331
- package/dist/orchestration/workflow-governance.d.ts +1 -1
- package/dist/orchestration/workflow-observe.d.ts +22 -2
- package/dist/orchestration/workflow-observe.js +20 -9
- package/dist/orchestration/workflow-park-adoption.d.ts +380 -0
- package/dist/orchestration/workflow-park-adoption.js +617 -0
- package/dist/orchestration/workflow-size-guideline.d.ts +6 -8
- package/dist/orchestration/workflow-size-guideline.js +12 -14
- package/dist/orchestration/workflow-types.d.ts +97 -17
- package/dist/orchestration/workflow-types.js +39 -8
- package/dist/orchestration/workflow.d.ts +70 -26
- package/dist/orchestration/workflow.js +495 -199
- package/dist/prompt-assembly/artifact.js +4 -3
- package/dist/prompt-assembly/assemble.d.ts +2 -0
- package/dist/prompt-assembly/assemble.js +4 -1
- package/dist/prompt-assembly/bands.d.ts +3 -0
- package/dist/prompt-assembly/bands.js +6 -0
- package/dist/prompt-assembly/catalog/constitution.d.ts +1 -1
- package/dist/prompt-assembly/catalog/constitution.js +74 -9
- package/dist/prompt-assembly/catalog/core-behavior.d.ts +5 -4
- package/dist/prompt-assembly/catalog/core-behavior.js +46 -9
- package/dist/prompt-assembly/catalog/engine.d.ts +110 -5
- package/dist/prompt-assembly/catalog/engine.js +13 -0
- package/dist/prompt-assembly/catalog/events.d.ts +852 -0
- package/dist/prompt-assembly/catalog/events.js +62 -0
- package/dist/prompt-assembly/catalog/index.js +2 -1
- package/dist/prompt-assembly/catalog/locales/index.d.ts +2 -2
- package/dist/prompt-assembly/catalog/locales/index.js +4 -2
- package/dist/prompt-assembly/catalog/locales/zh-Hans/constitution.js +53 -1
- package/dist/prompt-assembly/catalog/locales/zh-Hans/core-behavior.js +45 -9
- package/dist/prompt-assembly/catalog/locales/zh-Hans/engine.js +12 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/events.d.ts +7 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/events.js +57 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/mechanism.d.ts +8 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/mechanism.js +56 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/modes.js +8 -2
- package/dist/prompt-assembly/catalog/locales/zh-Hans/role.js +37 -9
- package/dist/prompt-assembly/catalog/mechanism.d.ts +427 -0
- package/dist/prompt-assembly/catalog/mechanism.js +62 -0
- package/dist/prompt-assembly/catalog/memory.d.ts +3 -3
- package/dist/prompt-assembly/catalog/memory.js +12 -3
- package/dist/prompt-assembly/catalog/modes.d.ts +2 -2
- package/dist/prompt-assembly/catalog/modes.js +7 -1
- package/dist/prompt-assembly/catalog/role.d.ts +1 -1
- package/dist/prompt-assembly/catalog/role.js +43 -14
- package/dist/prompt-assembly/catalog/schema.d.ts +43 -20
- package/dist/prompt-assembly/catalog/schema.js +17 -6
- package/dist/prompt-assembly/catalog/sections.d.ts +1 -1
- package/dist/prompt-assembly/catalog/sections.js +20 -12
- package/dist/prompt-assembly/composer.d.ts +3 -0
- package/dist/prompt-assembly/composer.js +11 -5
- package/dist/prompt-assembly/engine-text.d.ts +14 -4
- package/dist/prompt-assembly/engine-text.js +18 -9
- package/dist/prompt-assembly/event-registry.d.ts +38 -31
- package/dist/prompt-assembly/event-registry.js +185 -25
- package/dist/prompt-assembly/explain.d.ts +24 -0
- package/dist/prompt-assembly/explain.js +11 -0
- package/dist/prompt-assembly/locale-review.js +3 -2
- package/dist/prompt-assembly/overlay.d.ts +25 -7
- package/dist/prompt-assembly/overlay.js +68 -14
- package/dist/prompt-assembly/select.d.ts +4 -3
- package/dist/prompt-assembly/select.js +10 -2
- package/dist/prompt-assembly/sugar.d.ts +3 -2
- package/dist/prompt-assembly/sugar.js +2 -2
- package/dist/prompt-assembly/tool-catalog.js +3 -2
- package/dist/prompt-assembly/turn-snapshot.d.ts +1 -0
- package/dist/prompt-assembly/turn-snapshot.js +1 -0
- package/dist/prompt-assembly/types.d.ts +3 -4
- package/dist/prompts/default.d.ts +6 -45
- package/dist/prompts/default.js +3 -21
- package/dist/stores/file/adoption/adopt.d.ts +13 -3
- package/dist/stores/file/adoption/adopt.js +90 -95
- package/dist/stores/file/adoption/marker.d.ts +2 -1
- package/dist/stores/file/background-agent-store.d.ts +61 -0
- package/dist/stores/file/background-agent-store.js +64 -15
- package/dist/stores/file/checkpoint-store.d.ts +30 -2
- package/dist/stores/file/checkpoint-store.js +72 -23
- package/dist/stores/file/file-history-store.d.ts +13 -7
- package/dist/stores/file/file-history-store.js +170 -46
- package/dist/stores/file/fs-atomic.d.ts +57 -2
- package/dist/stores/file/fs-atomic.js +116 -48
- package/dist/stores/file/index.d.ts +2 -0
- package/dist/stores/file/index.js +2 -0
- package/dist/stores/file/ledger-damage.d.ts +87 -0
- package/dist/stores/file/ledger-damage.js +103 -0
- package/dist/stores/file/session-policy-store.d.ts +36 -4
- package/dist/stores/file/session-policy-store.js +177 -6
- package/dist/stores/file/shared-ledger.d.ts +123 -11
- package/dist/stores/file/shared-ledger.js +113 -18
- package/dist/stores/file/tool-result-store.d.ts +30 -1
- package/dist/stores/file/tool-result-store.js +60 -6
- package/dist/stores/file/workflow-journal-store.d.ts +73 -26
- package/dist/stores/file/workflow-journal-store.js +195 -32
- package/dist/stores/file/workflow-run-store.d.ts +47 -2
- package/dist/stores/file/workflow-run-store.js +17 -14
- package/dist/tools/artifact/artifact-tool.d.ts +9 -6
- package/dist/tools/artifact/artifact-tool.js +76 -40
- package/dist/tools/fs/env-error-detail.d.ts +11 -0
- package/dist/tools/fs/env-error-detail.js +13 -2
- package/dist/tools/fs/fs-bash.js +30 -21
- package/dist/tools/fs/fs-pdf.d.ts +1 -1
- package/dist/tools/fs/fs-pdf.js +2 -2
- package/dist/tools/fs/fs-read.js +4 -4
- package/dist/tools/fs/fs-shared.d.ts +26 -9
- package/dist/tools/fs/fs-shared.js +12 -6
- package/dist/tools/fs/fs-write.d.ts +6 -4
- package/dist/tools/fs/fs-write.js +24 -18
- package/dist/tools/fs/pattern-kill-guard.js +2 -1
- package/dist/tools/fs/pdf.d.ts +8 -0
- package/dist/tools/fs/pdf.js +10 -0
- package/dist/tools/fs/program-read-model.d.ts +4 -0
- package/dist/tools/fs/program-read-model.rows.js +3 -3
- package/dist/tools/fs/read-floor.d.ts +11 -9
- package/dist/tools/fs/read-floor.js +7 -10
- package/dist/tools/fs/removal-targets.d.ts +4 -3
- package/dist/tools/fs/removal-targets.js +27 -9
- package/dist/tools/fs/safety.d.ts +29 -107
- package/dist/tools/fs/safety.js +16 -118
- package/dist/tools/fs/shell-read-check.d.ts +4 -2
- package/dist/tools/fs/shell-read-check.js +6 -2
- package/dist/tools/fs/shell-read-environment.d.ts +10 -2
- package/dist/tools/fs/shell-read-environment.js +20 -11
- package/dist/tools/fs/shell-read-judge.d.ts +19 -7
- package/dist/tools/fs/shell-read-judge.js +9 -3
- package/dist/tools/fs/shell-reentry-text.d.ts +8 -0
- package/dist/tools/fs/shell-reentry-text.js +56 -0
- package/dist/tools/monitor.js +7 -5
- package/dist/tools/scheduler-tools.d.ts +39 -1
- package/dist/tools/scheduler-tools.js +84 -35
- package/dist/tools/task-list.d.ts +12 -4
- package/dist/tools/task-list.js +10 -7
- package/dist/tools/web.d.ts +2 -8
- package/dist/tools/web.js +5 -5
- package/dist/tools/worktree.js +18 -15
- package/package.json +6 -3
- package/test/export-surface.snapshot.json +344 -14
- package/wire-changes/core-stores-sql@7.69.0.json +39 -0
- package/wire-changes/core@7.69.0.json +9561 -0
- package/wire-changes/mods-kernel@7.69.0.json +80 -0
- package/wire-changes/primitives@7.69.0.json +79 -0
- package/wire-changes/wiki-gate@7.69.0.json +39 -0
package/dist/core/auto-mode.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type ClassifierCategory } from "./classifier-category.js";
|
|
1
2
|
import type { ToolCallRequest } from "./tool-policy.js";
|
|
2
3
|
/**
|
|
3
4
|
* WHY an `unavailable` verdict could not run — the closed set behind the verdict arm, the model-facing
|
|
@@ -70,11 +71,15 @@ export declare function autoModeRateLimitBreakAfterOf(v: unknown): number;
|
|
|
70
71
|
export type AutoModeVerdict = ({
|
|
71
72
|
kind: "allow";
|
|
72
73
|
} & AutoModeRoundAttributed)
|
|
73
|
-
/** `category` is the matched BLOCK rule name (207 output contract); `reason` starts with `[Rule Name]`.
|
|
74
|
+
/** `category` is the matched BLOCK rule name (207 output contract), as the classifier wrote it; `reason` starts with `[Rule Name]`.
|
|
75
|
+
* `categoryWord` is that rule as a member of the closed set ({@link ClassifierCategory}) — present only when the reply named EXACTLY ONE
|
|
76
|
+
* category of the accepted spelling and its normalized word is in the set ({@link classifierCategoryOf}); absent otherwise, and on a
|
|
77
|
+
* verdict a hand-built decider returns without it. It is the only form of the category the gate record carries. */
|
|
74
78
|
| ({
|
|
75
79
|
kind: "block";
|
|
76
80
|
category: string;
|
|
77
81
|
reason: string;
|
|
82
|
+
categoryWord?: ClassifierCategory;
|
|
78
83
|
} & AutoModeRoundAttributed)
|
|
79
84
|
/** The classifier could not run: the model leg threw / rejected, or ran past the cap. NOT a decision — the
|
|
80
85
|
* gate denies and says so ({@link classifierUnavailableDenyMessage}). */
|
|
@@ -193,10 +198,33 @@ export declare function classifierNoRulingAskMessage(askText: string, cause: Aut
|
|
|
193
198
|
* and auto mode blocks what it could not evaluate. With a candidate ladder wired the tail NAMES the model whose
|
|
194
199
|
* reply carried no verdict (`attribution.modelUsed`) — a declared departure from upstream, whose card names no
|
|
195
200
|
* model: the person reading this card is the one who can change the catalog, and on a single-model deployment
|
|
196
|
-
* the name is the whole diagnosis. Without attribution the sentence is unchanged. The
|
|
197
|
-
* either way; one writer
|
|
201
|
+
* the name is the whole diagnosis. Without attribution the sentence is unchanged. The tail follows the reply's `form`: a
|
|
202
|
+
* reply that answered both yes and no says so (it did answer, twice). The stem is a stable prefix either way; one writer
|
|
203
|
+
* for every site that refuses on such a reply (the two per-call stations and the delegation sites).
|
|
198
204
|
*/
|
|
199
|
-
export declare function classifierParseFailureDenyMessage(
|
|
205
|
+
export declare function classifierParseFailureDenyMessage(verdict: {
|
|
206
|
+
readonly form: AutoModeParseFailure;
|
|
207
|
+
readonly classifier?: AutoModeClassifierRound;
|
|
208
|
+
}): string;
|
|
209
|
+
/**
|
|
210
|
+
* What a classifier's ruling BLOCK said about itself, as the gate reads it and the gate record carries it: the `reason` it gave (the
|
|
211
|
+
* classifier model's sentence — the main model's own, when the ladder fell back to it) and the `category` it filed the call under, as a
|
|
212
|
+
* word of the closed set. The reason is CLASSIFIER-MODEL output — untrusted text — and leaves the verdict only through
|
|
213
|
+
* {@link foreignLine} (credentials withheld, then one line, bounded, tag and fence markers defused); a reason the classifier left empty, or that folds to nothing,
|
|
214
|
+
* is absent, and so is a category outside the set. The classifier's own spelling of the rule is never carried: the deny sentence quotes
|
|
215
|
+
* the reason alone, and the record carries the category as the word.
|
|
216
|
+
*/
|
|
217
|
+
export interface ClassifierSaid {
|
|
218
|
+
readonly reason?: string;
|
|
219
|
+
readonly category?: ClassifierCategory;
|
|
220
|
+
}
|
|
221
|
+
/** A ruling block's {@link ClassifierSaid}, folded ONCE: the deny sentence ({@link classifierSaidTail}) and the gate record read this one
|
|
222
|
+
* object. `undefined` when the classifier said nothing the record can carry. */
|
|
223
|
+
export declare function classifierSaidOf(verdict: Extract<AutoModeVerdict, {
|
|
224
|
+
kind: "block";
|
|
225
|
+
}>): ClassifierSaid | undefined;
|
|
226
|
+
/** The tail a block's deny sentence puts after "…blocked this call": `: <reason>` when the classifier gave one, else nothing. */
|
|
227
|
+
export declare function classifierSaidTail(said: ClassifierSaid | undefined): string;
|
|
200
228
|
/**
|
|
201
229
|
* Parse the classifier's output contract — the verdict reader (with its thinking strip and its
|
|
202
230
|
* reason reader), plus ONE arm of sema's own:
|
|
@@ -221,11 +249,11 @@ export declare function classifierParseFailureDenyMessage(attribution?: AutoMode
|
|
|
221
249
|
* no whitespace inside (the word-boundary form — `<block>yesterday` is not a hit) and case does not matter.
|
|
222
250
|
*
|
|
223
251
|
* A stated BLOCK stands with or without its tail: `<category>` (the BLOCK rule NAME the prompt asked
|
|
224
|
-
* for, read case-insensitively
|
|
225
|
-
*
|
|
226
|
-
*
|
|
227
|
-
*
|
|
228
|
-
* classifier's explicit verdict on the exact calls it flagged.
|
|
252
|
+
* for, read case-insensitively; the first tag's text as the classifier wrote it, which the deny sentence quotes) and `<reason>`
|
|
253
|
+
* (first `<reason>…</reason>` pair on the stripped text, trimmed) are carried when present and `""` when absent; the consumers
|
|
254
|
+
* render their own fallback line from the tool name in that case. The category is ALSO read as a word of the closed set
|
|
255
|
+
* ({@link classifierCategoryOf}, `categoryWord` on the verdict) — the only form the gate record carries. Downgrading a stated block
|
|
256
|
+
* to `parse_error` would lose the classifier's explicit verdict on the exact calls it flagged.
|
|
229
257
|
*
|
|
230
258
|
* `parse_error` is fail-closed: the gate handles it as a BLOCK (the reference's own outcome for a reply with no
|
|
231
259
|
* verdict) that the denial limit counts like any other — never a silent allow, and never a question handed
|
|
@@ -316,6 +344,9 @@ export interface AutoModeClassified {
|
|
|
316
344
|
cause?: Extract<AutoModeVerdict, {
|
|
317
345
|
kind: "unavailable";
|
|
318
346
|
}>["cause"];
|
|
347
|
+
/** Present exactly when `verdict` is `parse_error`: how the reply failed ({@link AutoModeParseFailure}) — what a reader
|
|
348
|
+
* of the record needs to say what happened next (a `missing` reply did not rule; a `conflict` is refused where it lands). */
|
|
349
|
+
form?: AutoModeParseFailure;
|
|
319
350
|
/** Present exactly when no model was asked because the QUESTION did not assemble: `"timeout"` = the build
|
|
320
351
|
* outran its cap, `"failed"` = it threw (also what a classify hook owning its own assembly reports). ABSENT
|
|
321
352
|
* = a model was asked. The verdict is `unavailable` / `error` either way — nothing was dispatched — so this
|
package/dist/core/auto-mode.js
CHANGED
|
@@ -4,7 +4,9 @@ import { thrownIs } from "./thrown-value.js";
|
|
|
4
4
|
import { describeRejectedValue } from "./tool-search-setting.js";
|
|
5
5
|
import { isPlainRecord } from "./mods/kernel/receive.js";
|
|
6
6
|
import { optionKeys, receiveMembers } from "./own-property-receipt.js";
|
|
7
|
-
import {
|
|
7
|
+
import { callerKey } from "./caller-text.js";
|
|
8
|
+
import { foreignLine } from "./protocol-http-auth.js";
|
|
9
|
+
import { classifierCategoryOf, isClassifierCategory } from "./classifier-category.js";
|
|
8
10
|
export const AUTO_MODE_UNAVAILABLE_CAUSES = Object.freeze(["error", "timeout"]);
|
|
9
11
|
const AUTO_MODE_UNAVAILABLE_CAUSE_SET = new Set(AUTO_MODE_UNAVAILABLE_CAUSES);
|
|
10
12
|
export function isAutoModeUnavailableCause(v) {
|
|
@@ -111,9 +113,20 @@ export function classifierNoRulingAskMessage(askText, cause) {
|
|
|
111
113
|
const parenthetical = cause === "timeout" ? " (timed out)" : "";
|
|
112
114
|
return `${askText}\n\nThe auto-mode classifier is temporarily unavailable${parenthetical}, so auto mode could not judge this call; it needs an approval instead of the classifier's verdict.`;
|
|
113
115
|
}
|
|
114
|
-
export function classifierParseFailureDenyMessage(
|
|
116
|
+
export function classifierParseFailureDenyMessage(verdict) {
|
|
115
117
|
const stem = "Auto mode could not evaluate this action and is blocking it for safety";
|
|
116
|
-
|
|
118
|
+
const who = verdict.classifier === undefined ? undefined : `the classifier model "${verdict.classifier.modelUsed}"`;
|
|
119
|
+
if (verdict.form === "conflict")
|
|
120
|
+
return `${stem} — ${who ?? "the classifier's reply"} answered both yes and no.`;
|
|
121
|
+
return who === undefined ? `${stem} — the classifier's reply carried no verdict.` : `${stem} — ${who} replied without a verdict.`;
|
|
122
|
+
}
|
|
123
|
+
export function classifierSaidOf(verdict) {
|
|
124
|
+
const reason = verdict.reason ? foreignLine(verdict.reason) : "";
|
|
125
|
+
const category = isClassifierCategory(verdict.categoryWord) ? verdict.categoryWord : undefined;
|
|
126
|
+
return reason === "" && category === undefined ? undefined : { ...(reason !== "" ? { reason } : {}), ...(category !== undefined ? { category } : {}) };
|
|
127
|
+
}
|
|
128
|
+
export function classifierSaidTail(said) {
|
|
129
|
+
return said?.reason !== undefined ? `: ${said.reason}` : "";
|
|
117
130
|
}
|
|
118
131
|
function stripThinking(text) {
|
|
119
132
|
return text.replace(/<(thinking|think)>[\s\S]*?<\/\1>/gi, "").replace(/<(thinking|think)>[\s\S]*$/i, "");
|
|
@@ -191,7 +204,8 @@ export function parseAutoModeResponse(text, options) {
|
|
|
191
204
|
return { kind: "allow" };
|
|
192
205
|
const category = /<category>([\s\S]*?)<\/category>/i.exec(stripped)?.[1]?.trim() ?? "";
|
|
193
206
|
const reason = /<reason>([\s\S]*?)<\/reason>/.exec(stripped)?.[1]?.trim() ?? "";
|
|
194
|
-
|
|
207
|
+
const categoryWord = classifierCategoryOf(stripped);
|
|
208
|
+
return { kind: "block", category, reason, ...(categoryWord !== undefined ? { categoryWord } : {}) };
|
|
195
209
|
}
|
|
196
210
|
export function heldWhileClassifying(decider, hold) {
|
|
197
211
|
return {
|
|
@@ -224,6 +238,7 @@ export function createAutoModeDecider(opts) {
|
|
|
224
238
|
ms: Math.max(0, Math.round(performance.now() - startedAt)),
|
|
225
239
|
verdict: verdict.kind,
|
|
226
240
|
...(verdict.kind === "unavailable" ? { cause: verdict.cause } : {}),
|
|
241
|
+
...(verdict.kind === "parse_error" ? { form: verdict.form } : {}),
|
|
227
242
|
...(round.notAsked !== undefined ? { notAsked: round.notAsked } : {}),
|
|
228
243
|
...(verdict.classifier !== undefined ? { classifier: verdict.classifier } : {}),
|
|
229
244
|
...(round.rateLimitBreaks.length > 0 ? { rateLimitBreaks: round.rateLimitBreaks } : {}),
|
|
@@ -401,7 +416,7 @@ export function autoModeDenialLimitOf(v) {
|
|
|
401
416
|
return { ...AUTO_MODE_DENIAL_LIMIT_DEFAULTS, autoDenyAfterMs: AUTO_MODE_DENIAL_AUTO_DENY_DEFAULT_MS };
|
|
402
417
|
if (typeof v !== "object" || v === null || Array.isArray(v))
|
|
403
418
|
return refuse(` must be a record of bounds (got ${describeRejectedValue(v)}) — omit it for the defaults`);
|
|
404
|
-
const opts = receiveMembers(v, { subject: "RunnerDeps.autoMode.denialLimit", unit: "member", moment: "when the knob is read" }, DENIAL_LIMIT_KEYS, (_, [stray]) => refuse(` has no member ${
|
|
419
|
+
const opts = receiveMembers(v, { subject: "RunnerDeps.autoMode.denialLimit", unit: "member", moment: "when the knob is read" }, DENIAL_LIMIT_KEYS, (_, [stray]) => refuse(` has no member ${callerKey(stray)} — its members are maxConsecutive, maxTotal and autoDenyAfterMs`));
|
|
405
420
|
const bound = (name, dflt) => {
|
|
406
421
|
const b = opts[name];
|
|
407
422
|
if (b === undefined)
|
|
@@ -5,6 +5,7 @@ import { type DamagedRowVerdict, type RowContext } from "./row-shape.js";
|
|
|
5
5
|
/** A background agent row's lifecycle words (closed; the stored row's `status` is read against it). */
|
|
6
6
|
export declare const BACKGROUND_AGENT_STATUSES: readonly ["running", "parked", "completed", "failed", "killed"];
|
|
7
7
|
export type BackgroundAgentStatus = (typeof BACKGROUND_AGENT_STATUSES)[number];
|
|
8
|
+
import { type RekeyConflict, type RekeyDone, type RekeyMode, type RekeyPlan, type ScopeRekeyInput } from "./identity-rekey.js";
|
|
8
9
|
/** Terminal/live usage rollup persisted on the row (mirror of the task_notification/BCE fields). */
|
|
9
10
|
export interface BackgroundAgentUsage {
|
|
10
11
|
totalTokens?: number;
|
|
@@ -26,7 +27,8 @@ export interface BackgroundAgentRecord {
|
|
|
26
27
|
handle: string;
|
|
27
28
|
/** Tenant/principal scope — put-time REQUIRED (assertOwnership parity: a row with neither a real
|
|
28
29
|
* scope nor an owner would be world-readable through the fallback; the registry writer always has
|
|
29
|
-
* both).
|
|
30
|
+
* both). It is the row's partition key: `update` never rewrites it, and a row changes partition only
|
|
31
|
+
* through {@link BackgroundAgentStore.rekeyScope} (an arrival under the new key, then the old key's leave). */
|
|
30
32
|
scope: string;
|
|
31
33
|
/** task-scoped: the host taskId · session-scoped: the sessionId (registry owner semantics). */
|
|
32
34
|
owner: string;
|
|
@@ -462,7 +464,82 @@ export interface BackgroundAgentStore {
|
|
|
462
464
|
listScopes?(): Promise<string[]>;
|
|
463
465
|
/** Retention sweep for `scope` (explicit policy, see interface notes). Returns rows deleted+flipped. */
|
|
464
466
|
reap(scope: string, now: number, opts?: BackgroundAgentReapOptions): Promise<number>;
|
|
467
|
+
/**
|
|
468
|
+
* Re-file one isolation scope's rows under another, in the steps {@link import("./identity-rekey.js").REKEY_MODES}
|
|
469
|
+
* names (REQUIRED, as every identity seat's re-key member is). The input is read by
|
|
470
|
+
* {@link import("./identity-rekey.js").readScopeRekeyInput} before anything is read or written; the step is judged by
|
|
471
|
+
* {@link planScopeRekey}. The answer arm is bound to the step, as on the policy seat.
|
|
472
|
+
*
|
|
473
|
+
* @contract background_agent.rekey_scope — `rekeyScope({ fromScope, toScope, mode })` re-files every row stored under
|
|
474
|
+
* `(handle, fromScope)` to `(handle, toScope)`. `arrive` puts a copy carrying `scope: toScope`, `rev + 1` and every other
|
|
475
|
+
* field as the store reads the source row (`owner`, writer fields and history are not the axis); a row already at the
|
|
476
|
+
* target is this move's arrival only when it is that copy exactly. `leave` deletes each source row whose arrival is in
|
|
477
|
+
* place, guarded by the rev it read, and leaves any other source row; `withdraw` deletes each arrival, guarded the same
|
|
478
|
+
* way. A target row that is not the arrival makes `arrive` answer `conflict`; nothing is written then. Every row the step
|
|
479
|
+
* reads — each row filed under `fromScope` and each target — is read as `get` reads it ({@link readStoredBackgroundAgent}):
|
|
480
|
+
* one that does not read refuses the whole step in {@link BACKGROUND_AGENT_ROW_MALFORMED_CODE}, every step, before anything
|
|
481
|
+
* is written; every copy passes the write gate ({@link admitBackgroundAgent}) before the first write. Scope values are
|
|
482
|
+
* read as the put gate reads them. Revisions follow the store's delete law: a key deleted and filed again may restart lower.
|
|
483
|
+
*/
|
|
484
|
+
rekeyScope(input: ScopeRekeyInput & {
|
|
485
|
+
readonly mode: "plan";
|
|
486
|
+
}): Promise<RekeyPlan>;
|
|
487
|
+
rekeyScope(input: ScopeRekeyInput & {
|
|
488
|
+
readonly mode: "arrive";
|
|
489
|
+
}): Promise<RekeyDone | RekeyConflict>;
|
|
490
|
+
rekeyScope(input: ScopeRekeyInput & {
|
|
491
|
+
readonly mode: "leave" | "withdraw";
|
|
492
|
+
}): Promise<RekeyDone>;
|
|
493
|
+
}
|
|
494
|
+
/** One source row of a scope re-key and the row its target key holds: `arrived` = that row is this move's copy. */
|
|
495
|
+
export interface ScopeRekeyMove {
|
|
496
|
+
readonly source: BackgroundAgentRecord;
|
|
497
|
+
readonly target: BackgroundAgentRecord | null;
|
|
498
|
+
readonly arrived: boolean;
|
|
465
499
|
}
|
|
500
|
+
/**
|
|
501
|
+
* The copy `arrive` files for `source` under `toScope`: every member as stored, `rev + 1`, and the partition's value moved wherever
|
|
502
|
+
* the row records it — `scope`, and `rootSessionScope` when it names the same partition (the root's box mounts in the scope its
|
|
503
|
+
* tree was filed under; a box of another scope stays). No other member carries a partition: the session ids address sessions, the
|
|
504
|
+
* org-admission pair names org planes, the policy floor holds clamp values.
|
|
505
|
+
*/
|
|
506
|
+
export declare function scopeRekeyCopyOf(source: BackgroundAgentRecord, toScope: string): BackgroundAgentRecord;
|
|
507
|
+
/**
|
|
508
|
+
* THE judge of a scope re-key over one store's rows, both bundled backends' (pure: it reads rows the caller hands it —
|
|
509
|
+
* {@link readScopeRekeyPlan} hands it the rows filed under `fromScope`, each as the store reads it). Each is a source; its
|
|
510
|
+
* target is the row `targetOf` answers under `toScope`; a target is the arrival exactly when it equals
|
|
511
|
+
* {@link scopeRekeyCopyOf} of its source (the handle is minted once and `put` creates once, so no other row can be that
|
|
512
|
+
* copy). `fromScope === toScope` moves nothing. Returns the moves (sorted by handle) and the answer the step gives before
|
|
513
|
+
* any write — the backend then writes what the moves say.
|
|
514
|
+
*/
|
|
515
|
+
export declare function planScopeRekey(rows: Iterable<BackgroundAgentRecord>, targetOf: (handle: string) => BackgroundAgentRecord | null, input: ScopeRekeyInput): {
|
|
516
|
+
moves: readonly ScopeRekeyMove[];
|
|
517
|
+
answer: RekeyPlan | RekeyDone | RekeyConflict;
|
|
518
|
+
};
|
|
519
|
+
/**
|
|
520
|
+
* A scope re-key's plan over a backend's stored rows (`stored`: the store's key → the row as stored; `keyOf`: the store's
|
|
521
|
+
* key of `(handle, scope)`, `scope \u0000 handle` in both bundled backends, so the rows filed under `fromScope` are the keys
|
|
522
|
+
* that begin `keyOf("", fromScope)` — the partition the store files a row under, whatever its body says). Each such row whose
|
|
523
|
+
* key `only` admits, and each target, is read through {@link readStoredBackgroundAgent}: one that does not read throws the
|
|
524
|
+
* family's refusal before any plan exists, so the backend writes nothing. Then {@link planScopeRekey} judges the step.
|
|
525
|
+
*/
|
|
526
|
+
export declare function readScopeRekeyPlan(stored: ReadonlyMap<string, unknown>, keyOf: (handle: string, scope: string) => string, input: ScopeRekeyInput, opts?: {
|
|
527
|
+
readonly only?: ReadonlySet<string>;
|
|
528
|
+
readonly disclose?: (sentence: string) => void;
|
|
529
|
+
}): ReturnType<typeof planScopeRekey>;
|
|
530
|
+
/** The writes one scope re-key step makes, from its plan, keyed by `keyOf`: the copies to file (`arrive`, none when the
|
|
531
|
+
* answer is a conflict — each already through the write gate, {@link admitBackgroundAgent}, so a refusal comes before the
|
|
532
|
+
* first write), the source rows to delete (`leave`) or the arrivals to delete (`withdraw`), each with the rev it was read at. */
|
|
533
|
+
export declare function scopeRekeyWritesOf(mode: RekeyMode, plan: ReturnType<typeof planScopeRekey>, toScope: string, keyOf: (handle: string, scope: string) => string): {
|
|
534
|
+
puts: readonly {
|
|
535
|
+
key: string;
|
|
536
|
+
row: BackgroundAgentRecord;
|
|
537
|
+
}[];
|
|
538
|
+
deletes: readonly {
|
|
539
|
+
key: string;
|
|
540
|
+
rev: number;
|
|
541
|
+
}[];
|
|
542
|
+
};
|
|
466
543
|
/** What a parked row's approval card is, as the checkpoint store states it. `unreadable` = no read of the store could say. */
|
|
467
544
|
export type ParkedCardState = "pending" | "resolved" | "expired" | "missing" | "unreadable";
|
|
468
545
|
/** The store seat the card-state reader needs: the body read every store has, and the body-tolerant session listing a store may offer. */
|
|
@@ -650,6 +727,15 @@ export declare class InMemoryBackgroundAgentStore implements BackgroundAgentStor
|
|
|
650
727
|
rev: number;
|
|
651
728
|
}): Promise<boolean>;
|
|
652
729
|
listScopes(): Promise<string[]>;
|
|
730
|
+
rekeyScope(input: ScopeRekeyInput & {
|
|
731
|
+
readonly mode: "plan";
|
|
732
|
+
}): Promise<RekeyPlan>;
|
|
733
|
+
rekeyScope(input: ScopeRekeyInput & {
|
|
734
|
+
readonly mode: "arrive";
|
|
735
|
+
}): Promise<RekeyDone | RekeyConflict>;
|
|
736
|
+
rekeyScope(input: ScopeRekeyInput & {
|
|
737
|
+
readonly mode: "leave" | "withdraw";
|
|
738
|
+
}): Promise<RekeyDone>;
|
|
653
739
|
reap(scope: string, now: number, opts?: BackgroundAgentReapOptions): Promise<number>;
|
|
654
740
|
}
|
|
655
741
|
export {};
|
|
@@ -6,6 +6,7 @@ import { deliverEngineNotice } from "./engine-notice.js";
|
|
|
6
6
|
import { absentReads, isBoolean, isCount, isFiniteNumber, isRecord, isRowCorrupt, isString, isWord, optional, pair, required, rowShapeReader, takesExit, via, } from "./row-shape.js";
|
|
7
7
|
export const BACKGROUND_AGENT_STATUSES = Object.freeze(["running", "parked", "completed", "failed", "killed"]);
|
|
8
8
|
import { receiptRefusal } from "./own-property-receipt.js";
|
|
9
|
+
import { agentScopeOf, readScopeRekeyInput, rekeyAnswerOf } from "./identity-rekey.js";
|
|
9
10
|
export const REVIVED_ROW_CLEARED_FIELDS = Object.freeze([
|
|
10
11
|
"settledAt",
|
|
11
12
|
"stoppedBy",
|
|
@@ -91,7 +92,7 @@ export const BACKGROUND_AGENT_ROW_SHAPE = rowShapeReader({
|
|
|
91
92
|
],
|
|
92
93
|
},
|
|
93
94
|
],
|
|
94
|
-
admitOnly: [pair("scope", (row) => (row.scope ===
|
|
95
|
+
admitOnly: [pair("scope", (row) => (agentScopeOf(row.scope) === undefined ? "its scope is empty — refusing a row without a scope (world-readable through the fallback)" : undefined))],
|
|
95
96
|
});
|
|
96
97
|
function backgroundAgentRefusal(corrupt) {
|
|
97
98
|
return new BackgroundAgentStoreError(BACKGROUND_AGENT_ROW_MALFORMED_CODE, BACKGROUND_AGENT_ROW_SHAPE.refusalText(corrupt));
|
|
@@ -132,6 +133,64 @@ export const BACKGROUND_AGENT_REAP_KNOBS = Object.freeze(["maxAgeMs", "keep", "s
|
|
|
132
133
|
export function receiveBackgroundAgentReapOptions(opts) {
|
|
133
134
|
return receiveRetentionPolicy("BackgroundAgentStore.reap", opts, BACKGROUND_AGENT_REAP_KNOBS);
|
|
134
135
|
}
|
|
136
|
+
function canonicalRecord(record) {
|
|
137
|
+
return JSON.stringify(record, (_key, value) => value !== null && typeof value === "object" && !Array.isArray(value) ? Object.fromEntries(Object.entries(value).sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0))) : value);
|
|
138
|
+
}
|
|
139
|
+
export function scopeRekeyCopyOf(source, toScope) {
|
|
140
|
+
return { ...structuredClone(source), scope: toScope, ...(source.rootSessionScope === source.scope ? { rootSessionScope: toScope } : {}), rev: source.rev + 1 };
|
|
141
|
+
}
|
|
142
|
+
export function planScopeRekey(rows, targetOf, input) {
|
|
143
|
+
const moves = [];
|
|
144
|
+
if (input.fromScope !== input.toScope) {
|
|
145
|
+
for (const source of rows) {
|
|
146
|
+
const target = targetOf(source.handle);
|
|
147
|
+
moves.push({ source, target, arrived: target !== null && canonicalRecord(target) === canonicalRecord(scopeRekeyCopyOf(source, input.toScope)) });
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
moves.sort((a, b) => (a.source.handle < b.source.handle ? -1 : a.source.handle > b.source.handle ? 1 : 0));
|
|
151
|
+
const conflicting = moves.filter((m) => m.target !== null && !m.arrived).length;
|
|
152
|
+
const acted = input.mode === "leave" || input.mode === "withdraw" ? moves.filter((m) => m.arrived).length : 0;
|
|
153
|
+
return { moves, answer: rekeyAnswerOf(input.mode, { rows: moves.length, conflicting, acted }) };
|
|
154
|
+
}
|
|
155
|
+
export function readScopeRekeyPlan(stored, keyOf, input, opts = {}) {
|
|
156
|
+
const filedUnder = keyOf("", input.fromScope);
|
|
157
|
+
const sources = [];
|
|
158
|
+
if (input.fromScope !== input.toScope) {
|
|
159
|
+
for (const [k, raw] of stored)
|
|
160
|
+
if (k.startsWith(filedUnder) && (opts.only === undefined || opts.only.has(k)))
|
|
161
|
+
sources.push(readStoredBackgroundAgent(raw, { key: k }, opts.disclose));
|
|
162
|
+
}
|
|
163
|
+
const targets = new Map();
|
|
164
|
+
for (const source of sources) {
|
|
165
|
+
const k = keyOf(source.handle, input.toScope);
|
|
166
|
+
targets.set(source.handle, stored.has(k) ? readStoredBackgroundAgent(stored.get(k), { key: k }, opts.disclose) : null);
|
|
167
|
+
}
|
|
168
|
+
return planScopeRekey(sources, (handle) => targets.get(handle) ?? null, input);
|
|
169
|
+
}
|
|
170
|
+
export function scopeRekeyWritesOf(mode, plan, toScope, keyOf) {
|
|
171
|
+
switch (mode) {
|
|
172
|
+
case "plan":
|
|
173
|
+
return { puts: [], deletes: [] };
|
|
174
|
+
case "arrive":
|
|
175
|
+
return {
|
|
176
|
+
puts: plan.answer.kind === "conflict"
|
|
177
|
+
? []
|
|
178
|
+
: plan.moves.filter((m) => !m.arrived).map((m) => {
|
|
179
|
+
const key = keyOf(m.source.handle, toScope);
|
|
180
|
+
return { key, row: admitBackgroundAgent(scopeRekeyCopyOf(m.source, toScope), { key }) };
|
|
181
|
+
}),
|
|
182
|
+
deletes: [],
|
|
183
|
+
};
|
|
184
|
+
case "leave":
|
|
185
|
+
return { puts: [], deletes: plan.moves.filter((m) => m.arrived).map((m) => ({ key: keyOf(m.source.handle, m.source.scope), rev: m.source.rev })) };
|
|
186
|
+
case "withdraw":
|
|
187
|
+
return { puts: [], deletes: plan.moves.flatMap((m) => (m.arrived && m.target !== null ? [{ key: keyOf(m.target.handle, m.target.scope), rev: m.target.rev }] : [])) };
|
|
188
|
+
default: {
|
|
189
|
+
const unhandled = mode;
|
|
190
|
+
return unhandled;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
135
194
|
const isCardStatus = (word) => word === "pending" || word === "resolved" || word === "expired";
|
|
136
195
|
async function listedCardStatus(store, token, sessionId) {
|
|
137
196
|
if (store.listBySession === undefined || sessionId === undefined)
|
|
@@ -483,6 +542,18 @@ export class InMemoryBackgroundAgentStore {
|
|
|
483
542
|
async listScopes() {
|
|
484
543
|
return [...new Set([...this.rows.values()].map((r) => r.scope))].sort();
|
|
485
544
|
}
|
|
545
|
+
async rekeyScope(input) {
|
|
546
|
+
const read = readScopeRekeyInput("BackgroundAgentStore.rekeyScope", input);
|
|
547
|
+
const keyOf = (handle, scope) => this.key(handle, scope);
|
|
548
|
+
const plan = readScopeRekeyPlan(this.rows, keyOf, read);
|
|
549
|
+
const { puts, deletes } = scopeRekeyWritesOf(read.mode, plan, read.toScope, keyOf);
|
|
550
|
+
for (const p of puts)
|
|
551
|
+
this.rows.set(p.key, p.row);
|
|
552
|
+
for (const d of deletes)
|
|
553
|
+
if (this.rows.get(d.key)?.rev === d.rev)
|
|
554
|
+
this.rows.delete(d.key);
|
|
555
|
+
return plan.answer;
|
|
556
|
+
}
|
|
486
557
|
async reap(scope, now, opts) {
|
|
487
558
|
const policy = receiveBackgroundAgentReapOptions(opts);
|
|
488
559
|
if (policy.maxAgeMs === undefined && policy.keep === undefined && policy.staleRunningMaxAgeMs === undefined)
|
|
@@ -34,6 +34,9 @@ export declare class BackgroundShellError extends Error {
|
|
|
34
34
|
readonly cause?: unknown | undefined;
|
|
35
35
|
/** `sandbox_unavailable` only — which way the start was refused, as `ExecutionError.refusedBy` reads it. */
|
|
36
36
|
refusedBy?: ConfinementRefusal;
|
|
37
|
+
/** As `ExecutionError.briefMessage`: a bounded restatement of `message` for a reader that has already shown the whole message to the same
|
|
38
|
+
* reader. Absent ⇒ the message is the only form. */
|
|
39
|
+
briefMessage?: string;
|
|
37
40
|
constructor(code: BackgroundShellErrorCode, message: string, cause?: unknown | undefined);
|
|
38
41
|
}
|
|
39
42
|
/**
|
|
@@ -115,7 +115,7 @@ export class CacheBreakDetector {
|
|
|
115
115
|
if (located.length > 0)
|
|
116
116
|
return finding(located[0], true, ` — declared (${located[0].declaredBy})`);
|
|
117
117
|
if (words.has("request_policy")) {
|
|
118
|
-
return finding({ cause: "request-policy", detail: "the request's controls changed (thinking level / output cap / retention)" }, true, " — declared (request_policy)");
|
|
118
|
+
return finding({ cause: "request-policy", detail: "the request's controls changed (thinking level / output cap / retention / speed)" }, true, " — declared (request_policy)");
|
|
119
119
|
}
|
|
120
120
|
const rewrites = declared.filter((d) => d.cause === "history_rewrite" || d.cause === "compaction");
|
|
121
121
|
if (rewrites.length > 0) {
|
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* THE one shape
|
|
3
|
-
* that is no string is named by its kind ({@link dataKind}). A caller's text can be anything a deployment put in the wrong
|
|
2
|
+
* THE one shape a VALUE the caller wrote takes in a judge's sentence: the redaction mark and its length, never the text (the name of a
|
|
3
|
+
* member a door does not take has {@link callerKey}'s shape). A value that is no string is named by its kind ({@link dataKind}). A caller's text can be anything a deployment put in the wrong
|
|
4
4
|
* field, a credential included, and the sentence travels to logs, panels and probes.
|
|
5
5
|
*
|
|
6
6
|
* Who wrote the text decides what a refusal (an error's message, a refused answer's reason, a tool result saying what was
|
|
7
|
-
* refused) says about it — five authors, one shape each:
|
|
7
|
+
* refused) says about it — five authors, one shape each (the first author's two readings below, one per kind of text):
|
|
8
8
|
* (a) the HOST or a DECLARER — a value or a key it wrote that is not the identity of what it declares: a member's value, a key
|
|
9
|
-
* it chose (a tool or skill name a per-tool table keys, a
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
9
|
+
* it chose (a tool or skill name a per-tool table keys, a `_meta` key, a header or variable name a seat answered), a
|
|
10
|
+
* `RunnerDeps` or `TaskSpec` member, a setting, an environment value, a malformed list entry, a word outside a closed
|
|
11
|
+
* vocabulary. Shape: `callerText` — the mark and the length (a symbol: its description's). A refusal over a closed
|
|
12
|
+
* vocabulary lists the closed words (and may name the nearest one), never the word the caller wrote;
|
|
13
|
+
* (a') the NAME of a member a door does not take — a key of a record the host or a declarer handed in that the door's closed
|
|
14
|
+
* table lacks (a stray option, a stray member, a seat or a word no table holds). The name is the defect and the only thing
|
|
15
|
+
* that lets the person find it, and a name is not where a credential lives (the value at it is, and stays {@link callerText}):
|
|
16
|
+
* the sentence names it, by {@link callerKey} — the same for a name that is a word of another seat (an option of another store, a
|
|
17
|
+
* member a later release reads), which is how the person sees where it belongs;
|
|
13
18
|
* (b) the IDENTITY of a declared entry — the name a declaration gives the server, peer, extension, device, agent or memory
|
|
14
19
|
* scope it declares, a principal, and, for an entry whose spelling is its only identity (a permission rule, a tool-list
|
|
15
20
|
* entry, a host pattern the floor holds), that spelling. The identity is published (the engine mints it into tool names,
|
|
@@ -24,5 +29,19 @@
|
|
|
24
29
|
* closed vocabulary, a kind, a count and its bound) and whose.
|
|
25
30
|
*/
|
|
26
31
|
export declare function callerText(value: unknown): string;
|
|
27
|
-
/** The
|
|
32
|
+
/** The most characters of a member name a sentence prints ({@link callerKey}), escapes counted; a longer name is cut and its size said. */
|
|
33
|
+
export declare const CALLER_KEY_MAX = 80;
|
|
34
|
+
/**
|
|
35
|
+
* THE one shape the name of a member a door does not take has in a judge's sentence (author (a') of {@link callerText}): the name as
|
|
36
|
+
* the caller wrote it, JSON-quoted, on one line and at most {@link CALLER_KEY_MAX} characters between the quotes, JSON escapes counted
|
|
37
|
+
* (a name of backslashes is cut where its escaped spelling reaches the bound). The line is the sanitized echo's fold
|
|
38
|
+
* ({@link inlineUntrusted}: control, format and separator characters become one space, an envelope tag is defused); a cut ends in the
|
|
39
|
+
* truncation mark; and when what is shown is not the whole name — folded, defused or cut — its size in UTF-16 units follows it
|
|
40
|
+
* (`"zz…" (200 UTF-16 units)`). A symbol key is `Symbol("<description>")`, the description quoted, folded and cut by the same function (a `)`
|
|
41
|
+
* in it cannot close the parenthesis: it sits inside the quotes). A key that is neither a string nor a symbol is named by its kind
|
|
42
|
+
* ({@link dataKind}). The work is bounded by {@link CALLER_KEY_READ}, whatever the size of the name; the function throws for no input and
|
|
43
|
+
* spells no value.
|
|
44
|
+
*/
|
|
45
|
+
export declare function callerKey(key: unknown): string;
|
|
46
|
+
/** The kind of a value, in the words a sentence uses for it: `null`, `undefined`, `an array`, `a record`, or `a <typeof>`. Total: a revoked Proxy is a record. */
|
|
28
47
|
export declare function dataKind(value: unknown): string;
|
package/dist/core/caller-text.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { REDACTION_MARKS } from "@sema-agent/primitives";
|
|
2
|
+
import { INLINE_TRUNCATION_MARK, inlineUntrusted } from "./untrusted-text.js";
|
|
2
3
|
export function callerText(value) {
|
|
3
4
|
if (typeof value === "symbol")
|
|
4
5
|
return `a symbol ${callerText(value.description ?? "")}`;
|
|
@@ -7,6 +8,51 @@ export function callerText(value) {
|
|
|
7
8
|
const length = [...value].length;
|
|
8
9
|
return `${REDACTION_MARKS.bare} (${length} character${length === 1 ? "" : "s"})`;
|
|
9
10
|
}
|
|
11
|
+
export const CALLER_KEY_MAX = 80;
|
|
12
|
+
const CALLER_KEY_READ = 4096;
|
|
13
|
+
function quotedSpelling(text) {
|
|
14
|
+
const read = text.length > CALLER_KEY_READ ? text.slice(0, CALLER_KEY_READ) : text;
|
|
15
|
+
const folded = inlineUntrusted(read, Number.POSITIVE_INFINITY);
|
|
16
|
+
let body = "";
|
|
17
|
+
let used = 0;
|
|
18
|
+
let cut = read.length < text.length;
|
|
19
|
+
for (const character of folded) {
|
|
20
|
+
const piece = JSON.stringify(character).slice(1, -1);
|
|
21
|
+
const width = [...piece].length;
|
|
22
|
+
if (used + width > CALLER_KEY_MAX) {
|
|
23
|
+
cut = true;
|
|
24
|
+
break;
|
|
25
|
+
}
|
|
26
|
+
body += piece;
|
|
27
|
+
used += width;
|
|
28
|
+
}
|
|
29
|
+
return { quoted: `"${body}${cut ? INLINE_TRUNCATION_MARK : ""}"`, whole: !cut && folded === text };
|
|
30
|
+
}
|
|
31
|
+
const sizeOf = (text) => ` (${text.length} UTF-16 unit${text.length === 1 ? "" : "s"})`;
|
|
32
|
+
export function callerKey(key) {
|
|
33
|
+
if (typeof key === "symbol") {
|
|
34
|
+
const description = key.description;
|
|
35
|
+
if (description === undefined)
|
|
36
|
+
return "Symbol()";
|
|
37
|
+
const { quoted, whole } = quotedSpelling(description);
|
|
38
|
+
return `Symbol(${quoted})${whole ? "" : sizeOf(description)}`;
|
|
39
|
+
}
|
|
40
|
+
if (typeof key !== "string")
|
|
41
|
+
return dataKind(key);
|
|
42
|
+
const { quoted, whole } = quotedSpelling(key);
|
|
43
|
+
return `${quoted}${whole ? "" : sizeOf(key)}`;
|
|
44
|
+
}
|
|
10
45
|
export function dataKind(value) {
|
|
11
|
-
|
|
46
|
+
if (value === null)
|
|
47
|
+
return "null";
|
|
48
|
+
if (value === undefined)
|
|
49
|
+
return "undefined";
|
|
50
|
+
if (typeof value !== "object")
|
|
51
|
+
return `a ${typeof value}`;
|
|
52
|
+
try {
|
|
53
|
+
return Array.isArray(value) ? "an array" : "a record";
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
return "a record";
|
|
57
|
+
}
|
|
12
58
|
}
|
|
@@ -180,16 +180,23 @@ export declare function checkpointVersionOf(cp: Pick<Checkpoint, "version">): nu
|
|
|
180
180
|
* steer seat, which no worker version reads and the host decides itself, or a retired mode-seed member of
|
|
181
181
|
* `inheritedGate`, which an engine at 7.38.x or earlier still reads once), `"leg_not_resumable"` (a row a synchronous child
|
|
182
182
|
* parked under an earlier release — it carries the synchronous-child block — whose leg nobody resumes: its result has no road back to
|
|
183
|
-
* the run that spawned it; terminal for the row's bytes on every worker of this release — expire it and run the work again)
|
|
183
|
+
* the run that spawned it; terminal for the row's bytes on every worker of this release — expire it and run the work again),
|
|
184
|
+
* `"reading_changed"` (the row is intact and an earlier release parked it, reading a member a decision binds the way this release
|
|
185
|
+
* no longer does — it reads as written under that earlier reading, as the requirement tables record it).
|
|
184
186
|
* · `invalid_outcome` pre-CAS row-integrity arms: `"real_approval_damaged"`, `"real_approval_forged"`,
|
|
185
|
-
* `"read_face_damaged"`, `"read_face_forged"`, `"write_face_damaged"`, `"skill_grants_damaged"`, `"skill_scopes_damaged"`, `"constraint_chain_missing"`, `"hands_coordinates_damaged"`, `"requirements_damaged"`, `"bound_input_hash_missing"
|
|
186
|
-
*
|
|
187
|
+
* `"read_face_damaged"`, `"read_face_forged"`, `"write_face_damaged"`, `"skill_grants_damaged"`, `"skill_scopes_damaged"`, `"constraint_chain_missing"`, `"hands_coordinates_damaged"`, `"requirements_damaged"`, `"bound_input_hash_missing"`.
|
|
188
|
+
* Whether ANY release still resumes a row its judge refuses is not restated per word here: it is the row judge's one table
|
|
189
|
+
* (`checkpoint-row-verdict.ts`, read as the verdict's `terminal`), beside the refusal's fixed sentence.
|
|
187
190
|
*
|
|
188
191
|
* THE ONE RULE for `checkpoint.invalid_outcome` (registered in `docs/CLOSED-SETS.md`, which also says what a host reads from it): `detail.reason` is a
|
|
189
192
|
* ROW-INTEGRITY word and only that, `detail.field` ({@link CheckpointErrorField}) names the cell of the decision to act on, a refusal carries at most
|
|
190
193
|
* one of them, and a refusal with neither is never a damaged row.
|
|
191
194
|
*/
|
|
192
|
-
export type CheckpointErrorReason = "version_newer" | "env_factory_missing" | "governed_unwired" | "origin_missing" | "tool_identity_missing" | "ledger_event_unknown" | "seat_retired" | "leg_not_resumable"
|
|
195
|
+
export type CheckpointErrorReason = "version_newer" | "env_factory_missing" | "governed_unwired" | "origin_missing" | "tool_identity_missing" | "ledger_event_unknown" | "seat_retired" | "leg_not_resumable"
|
|
196
|
+
/** An intact row an earlier release parked, which this release reads differently: the input hash of a tool approval parked before
|
|
197
|
+
* 7.63.0, or a member whose earlier reading the requirement tables record (`EarlierReading`) and the row's content cannot show
|
|
198
|
+
* agrees with this release's. */
|
|
199
|
+
| "reading_changed" | "real_approval_damaged" | "real_approval_forged" | "read_face_damaged" | "read_face_forged"
|
|
193
200
|
/** `state.writeFace` is present but not a well-formed section. No `_forged` twin: the section is
|
|
194
201
|
* legal-and-absent at every version, so there is no version to judge a fabrication against — and a
|
|
195
202
|
* fabricated "open" still needs the LIVE resolution to say open too. */
|
|
@@ -198,9 +205,10 @@ export type CheckpointErrorReason = "version_newer" | "env_factory_missing" | "g
|
|
|
198
205
|
| "skill_scopes_damaged" | "constraint_chain_missing"
|
|
199
206
|
/** `state.handsRoot` / `state.handsHome` / `state.handsCwd` is present but not an absolute path (the row's hands' coordinates). */
|
|
200
207
|
| "hands_coordinates_damaged"
|
|
201
|
-
/** The row's
|
|
202
|
-
* is
|
|
203
|
-
*
|
|
208
|
+
/** The row's content does not read the way it was recorded when it was parked: its reader-requirement list
|
|
209
|
+
* ({@link CheckpointRow.requires}) is missing on a v10 row, is not a list of words, is present below v10, or does not equal
|
|
210
|
+
* the words the row's content carries, or its digest does not equal its content's — and no earlier reading the requirement
|
|
211
|
+
* tables record explains it (that is `reading_changed`); a member the shape table refuses; a row its judge cannot read. */
|
|
204
212
|
| "requirements_damaged"
|
|
205
213
|
/** A pending tool approval whose row format is at or above the binding era carries no persisted `boundInputHash` — every mint at that
|
|
206
214
|
* version writes one, so its absence is corruption or a caller-declared downgrade, and the decision-action input binding has nothing to
|
|
@@ -213,10 +221,10 @@ export type CheckpointErrorReason = "version_newer" | "env_factory_missing" | "g
|
|
|
213
221
|
/** On `checkpoint.config_refused` with `detail.code` `config.tool_face_control` — the arm prepare's own refusal carries as its `detail.reason`:
|
|
214
222
|
* a tool-name list the row recorded is not a list / has a member that is not a string / has a spelling no tool name can have / is not in
|
|
215
223
|
* the one spelling a row records (`"not_a_list"`, `"not_a_string"`, `"unknown_name"`, `"unsupported_pattern"`; the re-supplied config's own four lists —
|
|
216
|
-
* `allowTools`, `excludeTools`, `deferTools`, `alwaysLoadTools` — are refused as `"not_a_list"` / `"not_a_string"`); the record of the delegation tool that
|
|
224
|
+
* `allowTools`, `excludeTools`, `deferTools`, `alwaysLoadTools` — are refused as `"not_a_list"` / `"not_a_string"`, and its whole-face switch `excludeAllTools` when it is not a boolean as `"not_a_boolean"`); the record of the delegation tool that
|
|
217
225
|
* wrote the leg's lists is not one (`"invalid_record"`); the roster the resume hands mounts a delegation tool under another name than it declares
|
|
218
226
|
* (`"renamed_mount"`); the process-wide table of declared names is occupied by a value that is not the engine's (`"registry_occupied"`). */
|
|
219
|
-
| "not_a_list" | "not_a_string" | "unknown_name" | "unsupported_pattern" | "invalid_record" | "renamed_mount" | "registry_occupied"
|
|
227
|
+
| "not_a_list" | "not_a_string" | "not_a_boolean" | "unknown_name" | "unsupported_pattern" | "invalid_record" | "renamed_mount" | "registry_occupied"
|
|
220
228
|
/** On `config.unknown_role` (a fresh run's terminal `detail.detail.reason`; on a resume, `detail.reason` of `checkpoint.config_refused` with `detail.code` `config.unknown_role`)
|
|
221
229
|
* — a model binding or a role word the engine cannot read: a word the model catalog does not hold (`"unknown_model_ref"`), a value that is
|
|
222
230
|
* no model reference at all — a number, a boolean, a list (`"not_a_model_ref"`), or a role word outside the vocabulary — a `roles` key, a `modelRole` value (`"unknown_role_word"`) — or a task naming no model whose requested role and fallback chain supply none (`"no_model_for_role"`, `field` the requested role's seat). The sentence names the seat the refusal's `field` names (`roles.consolidate`, `tiers.pro`, `TaskSpec.model`). */
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A checkpoint's non-secret identity (`Checkpoint.checkpointId`) as it leaves the store: ONE judge and one closed set of words for
|
|
3
|
+
* why an id is not handed out. The faces that read it through {@link readGateIdentity}: the park card a background agent's state
|
|
4
|
+
* carries (the live and durable task poll, ListAgents, AgentTranscript — and the engine card on `tool_end.structured` that carries
|
|
5
|
+
* their `agentState`), the three engine sentences that name a row (the unreadable summary, the projected summary's descriptor
|
|
6
|
+
* damage, the listing selectors), and the unrecorded-execution notice. Not yet through it: the resumed leg's `tool_start` /
|
|
7
|
+
* `tool_end` frames hand the row's id out as `resumesCheckpoint` as stored, and a workflow resume's not-pending refusal and its two
|
|
8
|
+
* sentences about a parked ordinal name it as stored — those faces move onto the judge in a later slice.
|
|
9
|
+
*
|
|
10
|
+
* Why a judge: the value is read back from persistence (a store's decoded row, a third-party store's answer), so anything can be
|
|
11
|
+
* written there — a row copied wrong, a migration that put the resume token in the id cell, a wrapper that prefixed it. Two
|
|
12
|
+
* criteria, both failing closed (a value the judge cannot clear is treated as not there):
|
|
13
|
+
* 1. the id never CONTAINS the row's token, compared case-insensitively — containment, not equality (`"cp_" + token` hands the
|
|
14
|
+
* whole capability out just the same), and case-folded (the upper-cased form of a lowercase hex token is as reversible);
|
|
15
|
+
* 2. the id is bounded ({@link MAX_CHECKPOINT_ID_CHARS}): the engine mints `cp_` + a UUID (39 characters), so an unbounded value
|
|
16
|
+
* would let the persisted bytes decide how large every face that echoes it is.
|
|
17
|
+
* What it guards against is an accident (a copy, a naive wrap, a case change), not an adversary who can write any value into the row:
|
|
18
|
+
* such a writer already holds the row and its token. There is deliberately no format pattern — a token grouped like a UUID passes
|
|
19
|
+
* one, and a pattern would only add a silent loss of the id the day the engine changes how it mints one.
|
|
20
|
+
*/
|
|
21
|
+
/** The upper bound on a trusted `checkpointId`, in UTF-16 code units (`String.prototype.length`). */
|
|
22
|
+
export declare const MAX_CHECKPOINT_ID_CHARS = 128;
|
|
23
|
+
/** Why a gate's identity is not handed out — `absent`: the row carries no id (a row parked before the member existed);
|
|
24
|
+
* `untrusted`: it carries one the judge refused (not a string, empty, over the bound, or containing the row's token). */
|
|
25
|
+
export declare const CHECKPOINT_ID_MISSING: readonly ["absent", "untrusted"];
|
|
26
|
+
export type CheckpointIdMissing = (typeof CHECKPOINT_ID_MISSING)[number];
|
|
27
|
+
/** Whether `word` is a member of {@link CHECKPOINT_ID_MISSING} (for a reader of a stored word): a non-string is not. */
|
|
28
|
+
export declare function isCheckpointIdMissing(word: unknown): word is CheckpointIdMissing;
|
|
29
|
+
/**
|
|
30
|
+
* THE judge: `raw` (a checkpoint id read back from persistence) as it may leave, or `undefined`. It passes exactly when `raw` is a
|
|
31
|
+
* non-empty string of at most {@link MAX_CHECKPOINT_ID_CHARS} code units that does not contain `token` once both are folded with
|
|
32
|
+
* `String.prototype.toLowerCase()`. `token` is the same row's resume token: `undefined` / `null` read as no token, anything else as
|
|
33
|
+
* `String(token)`; an empty token tests nothing, and a token `String()` cannot convert (its conversion throws) fails the id
|
|
34
|
+
* closed — the judge never throws. Callers hand both values as read, without normalizing them.
|
|
35
|
+
*/
|
|
36
|
+
export declare function trustedCheckpointId(raw: unknown, token: unknown): string | undefined;
|
|
37
|
+
/** One gate's identity reading: the trusted id, or why there is none — exactly one of the two keys, spread as it is into a face. */
|
|
38
|
+
export type GateIdentity = {
|
|
39
|
+
readonly checkpointId: string;
|
|
40
|
+
readonly checkpointIdMissing?: never;
|
|
41
|
+
} | {
|
|
42
|
+
readonly checkpointIdMissing: CheckpointIdMissing;
|
|
43
|
+
readonly checkpointId?: never;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* A gate's identity from the id cell read off its row and that row's token: `{ checkpointId }` when {@link trustedCheckpointId} passes
|
|
47
|
+
* it; otherwise `{ checkpointIdMissing }` — `absent` when the cell read as `undefined`, `untrusted` when it held anything else
|
|
48
|
+
* (`null` included: a reader that could not read the cell hands `null`, because the cell was there).
|
|
49
|
+
*/
|
|
50
|
+
export declare function readGateIdentity(raw: unknown, token: unknown): GateIdentity;
|
|
51
|
+
/** How an engine sentence names a checkpoint row: `checkpoint "<id>"` for a trusted id, else the reason the id is not shown —
|
|
52
|
+
* never a value the judge refused, never the token. */
|
|
53
|
+
export declare function checkpointRowLabel(identity: GateIdentity): string;
|