@sema-agent/core 7.51.2 → 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/CHANGELOG.md +698 -2
- package/README.md +3 -1
- package/dist/agents/agent-transcript-tool.d.ts +1 -1
- package/dist/agents/cascade.js +4 -0
- package/dist/agents/cross-session-envelope.d.ts +8 -0
- package/dist/agents/cross-session-envelope.js +6 -0
- package/dist/agents/cross-session-judge.d.ts +21 -1
- package/dist/agents/cross-session-judge.js +8 -0
- package/dist/agents/cross-session-ref.d.ts +5 -0
- package/dist/agents/cross-session-ref.js +1 -0
- package/dist/agents/cumulative-stats.d.ts +3 -0
- package/dist/agents/cumulative-stats.js +3 -0
- package/dist/agents/list-agents-tool.d.ts +1 -1
- package/dist/agents/org-delivery-gate.d.ts +122 -0
- package/dist/agents/org-delivery-gate.js +69 -0
- package/dist/agents/peer-held-queue.d.ts +9 -4
- package/dist/agents/peer-held-queue.js +6 -5
- package/dist/agents/peer-session-drain.d.ts +35 -5
- package/dist/agents/peer-session-drain.js +271 -180
- package/dist/agents/read-inbox-tool.d.ts +8 -1
- package/dist/agents/read-inbox-tool.js +5 -1
- package/dist/agents/repair-loop.js +4 -0
- package/dist/agents/send-message-tool.d.ts +11 -16
- package/dist/agents/send-message-tool.js +11 -13
- package/dist/agents/subagent.d.ts +3 -0
- package/dist/agents/subagent.js +105 -76
- package/dist/agents/tool-filter.d.ts +58 -13
- package/dist/agents/tool-filter.js +34 -14
- package/dist/bench/metrics.d.ts +1 -0
- package/dist/brain/anthropic.d.ts +6 -1
- package/dist/brain/anthropic.js +17 -13
- package/dist/brain/model-presets.d.ts +4 -5
- package/dist/brain/model-presets.js +6 -5
- package/dist/brain/open-responses.js +16 -12
- package/dist/brain/openai.js +16 -12
- package/dist/brain/request-params.d.ts +12 -33
- package/dist/brain/request-params.js +5 -2
- package/dist/brain/request-route.d.ts +9 -8
- package/dist/brain/request-route.js +1 -0
- package/dist/brain/route-adjudicator.d.ts +123 -47
- package/dist/brain/route-adjudicator.js +171 -42
- package/dist/brain/route-conformance.js +2 -2
- package/dist/brain/routing.d.ts +24 -1
- package/dist/brain/routing.js +54 -19
- package/dist/brain/status-sink.d.ts +18 -0
- package/dist/brain/status-sink.js +7 -0
- package/dist/brain/timeout.js +5 -4
- package/dist/core/a2a.d.ts +5 -2
- package/dist/core/a2a.js +30 -13
- package/dist/core/allow-entry.d.ts +42 -9
- package/dist/core/allow-entry.js +25 -18
- package/dist/core/auto-compaction.d.ts +80 -20
- package/dist/core/auto-compaction.js +65 -18
- package/dist/core/auto-promote.d.ts +2 -1
- package/dist/core/auto-promote.js +2 -2
- package/dist/core/caller-tool-name.d.ts +9 -0
- package/dist/core/caller-tool-name.js +13 -0
- package/dist/core/checkpoint-requirements.d.ts +7 -1
- package/dist/core/checkpoint-requirements.js +2 -0
- package/dist/core/checkpoint-store.d.ts +57 -24
- package/dist/core/checkpoint-store.js +3 -3
- package/dist/core/child-clamp-seats.d.ts +6 -0
- package/dist/core/child-clamp-seats.js +2 -1
- package/dist/core/compliance.js +3 -1
- package/dist/core/credential-vocabulary.d.ts +33 -8
- package/dist/core/credential-vocabulary.js +32 -7
- package/dist/core/decision-receipt.d.ts +2 -2
- package/dist/core/delegation-frames.d.ts +9 -2
- package/dist/core/delegation-name.d.ts +18 -0
- package/dist/core/delegation-name.js +47 -0
- package/dist/core/effective-path-target.d.ts +25 -6
- package/dist/core/effective-path-target.js +24 -2
- package/dist/core/engine-capabilities.d.ts +8 -1
- package/dist/core/engine-capabilities.js +1 -1
- package/dist/core/engine-notice.d.ts +49 -21
- package/dist/core/frontmatter-fence.d.ts +10 -0
- package/dist/core/frontmatter-fence.js +6 -0
- package/dist/core/gate-fold.js +8 -25
- package/dist/core/gate-lanes.js +358 -274
- package/dist/core/gate-outcome.d.ts +11 -6
- package/dist/core/governance-codes.d.ts +11 -4
- package/dist/core/governance-codes.js +12 -3
- package/dist/core/hands-band-screen.d.ts +7 -0
- package/dist/core/hands-band-screen.js +32 -0
- package/dist/core/hooks.d.ts +283 -739
- package/dist/core/hooks.js +100 -193
- package/dist/{tools/fs → core}/image-admission.d.ts +21 -3
- package/dist/{tools/fs → core}/image-admission.js +24 -6
- package/dist/core/locked-config.d.ts +84 -32
- package/dist/core/locked-config.js +128 -42
- package/dist/core/mcp-connection-pool.d.ts +4 -1
- package/dist/core/mcp-connection-pool.js +7 -2
- package/dist/core/mcp-probe.d.ts +12 -9
- package/dist/core/mcp-probe.js +3 -3
- package/dist/core/mcp-server-spec.d.ts +104 -10
- package/dist/core/mcp-server-spec.js +183 -33
- package/dist/core/mcp.d.ts +31 -20
- package/dist/core/mcp.js +66 -56
- package/dist/core/memory-engine/data-plane.js +5 -1
- package/dist/core/memory-engine/distiller.js +16 -2
- package/dist/core/memory-engine/engine.d.ts +22 -30
- package/dist/core/memory-engine/engine.js +16 -10
- package/dist/core/memory-engine/frontmatter.d.ts +6 -0
- package/dist/core/memory-engine/frontmatter.js +19 -16
- package/dist/core/memory.d.ts +2 -2
- package/dist/core/mode-policy.d.ts +5 -16
- package/dist/core/mode-policy.js +7 -19
- package/dist/core/model-seat.d.ts +4 -1
- package/dist/core/mods/dollar.d.ts +109 -0
- package/dist/core/mods/dollar.js +154 -0
- package/dist/core/mods/host.d.ts +23 -0
- package/dist/core/mods/host.js +21 -0
- package/dist/core/mods/kernel/budget.d.ts +43 -0
- package/dist/core/mods/kernel/budget.js +83 -0
- package/dist/core/mods/kernel/dispatch.d.ts +100 -0
- package/dist/core/mods/kernel/dispatch.js +699 -0
- package/dist/core/mods/kernel/events.d.ts +245 -0
- package/dist/core/mods/kernel/events.js +210 -0
- package/dist/core/mods/kernel/index.d.ts +6 -0
- package/dist/core/mods/kernel/index.js +5 -0
- package/dist/core/mods/kernel/receive.d.ts +94 -0
- package/dist/core/mods/kernel/receive.js +188 -0
- package/dist/core/mods/kernel/registration.d.ts +131 -0
- package/dist/core/mods/kernel/registration.js +102 -0
- package/dist/core/mods/kernel/site-rules.d.ts +149 -0
- package/dist/core/mods/kernel/site-rules.js +296 -0
- package/dist/core/mods/stations.d.ts +344 -0
- package/dist/core/mods/stations.js +437 -0
- package/dist/core/mounted-mcp.d.ts +57 -0
- package/dist/core/mounted-mcp.js +71 -2
- package/dist/core/own-property-receipt.d.ts +13 -0
- package/dist/core/own-property-receipt.js +13 -23
- package/dist/core/parent-spec-seat.d.ts +18 -7
- package/dist/core/parent-spec-seat.js +6 -2
- package/dist/core/path-identity.js +2 -1
- package/dist/core/permission-rule-model.d.ts +58 -9
- package/dist/core/permission-rule-model.js +81 -7
- package/dist/core/permission-rule-org.d.ts +163 -33
- package/dist/core/permission-rule-org.js +205 -71
- package/dist/core/permission-rule-syntax.d.ts +15 -0
- package/dist/core/permission-rule-syntax.js +24 -16
- package/dist/core/permission-rules.d.ts +14 -2
- package/dist/core/permission-rules.js +63 -23
- package/dist/core/prompt-section-seat.d.ts +15 -27
- package/dist/core/prompt-section-seat.js +73 -40
- package/dist/core/protocol-http-auth.d.ts +3 -1
- package/dist/core/protocol-http-auth.js +2 -0
- package/dist/core/reminder-mint.d.ts +2 -2
- package/dist/core/remote-env.d.ts +24 -12
- package/dist/core/remote-env.js +1 -0
- package/dist/core/resume-startup-cause.d.ts +16 -1
- package/dist/core/resume-startup-cause.js +4 -1
- package/dist/core/retention.js +7 -2
- package/dist/core/retired-keys.d.ts +12 -2
- package/dist/core/retired-keys.js +15 -1
- package/dist/core/roles.js +60 -10
- package/dist/core/rule-lane-reads.js +1 -1
- package/dist/core/runner/announce-once-ledger.d.ts +31 -1
- package/dist/core/runner/announce-once-ledger.js +22 -0
- package/dist/core/runner/assemble-result.d.ts +9 -0
- package/dist/core/runner/assemble-result.js +3 -1
- package/dist/core/runner/call-hook-stations.d.ts +23 -27
- package/dist/core/runner/call-hook-stations.js +58 -42
- package/dist/core/runner/caller-stop-gate.d.ts +25 -0
- package/dist/core/runner/caller-stop-gate.js +7 -0
- package/dist/core/runner/compaction-seams.d.ts +8 -22
- package/dist/core/runner/compaction-seams.js +28 -53
- package/dist/core/runner/construction-doors.js +11 -1
- package/dist/core/runner/contracts.d.ts +86 -83
- package/dist/core/runner/credential-origin-seat.d.ts +2 -0
- package/dist/core/runner/credential-origin-seat.js +19 -0
- package/dist/core/runner/extra-body-dropped-seat.d.ts +2 -6
- package/dist/core/runner/gate-exit.d.ts +47 -36
- package/dist/core/runner/gate-exit.js +12 -5
- package/dist/core/runner/image.js +1 -2
- package/dist/core/runner/inline-image.js +1 -1
- package/dist/core/runner/mcp-redial.d.ts +52 -10
- package/dist/core/runner/mcp-redial.js +38 -9
- package/dist/core/runner/notice-seat-input.d.ts +11 -0
- package/dist/core/runner/notice-seat-input.js +1 -0
- package/dist/core/runner/permission-rule-lanes.d.ts +5 -2
- package/dist/core/runner/permission-rule-lanes.js +22 -10
- package/dist/core/runner/person-path-rows.d.ts +3 -1
- package/dist/core/runner/person-path-rows.js +3 -2
- package/dist/core/runner/prepare-acquire-reconcile.js +5 -1
- package/dist/core/runner/prepare-ask-lane.d.ts +5 -7
- package/dist/core/runner/prepare-ask-lane.js +6 -15
- package/dist/core/runner/prepare-caps-and-workflow.d.ts +4 -2
- package/dist/core/runner/prepare-caps-and-workflow.js +25 -8
- package/dist/core/runner/prepare-config-doors.d.ts +52 -1
- package/dist/core/runner/prepare-config-doors.js +168 -143
- package/dist/core/runner/prepare-defer-classify.js +7 -11
- package/dist/core/runner/prepare-delegation-surface.d.ts +2 -2
- package/dist/core/runner/prepare-delegation-surface.js +7 -5
- package/dist/core/runner/prepare-gate-stations.d.ts +8 -11
- package/dist/core/runner/prepare-gate-stations.js +11 -10
- package/dist/core/runner/prepare-hands-readface.d.ts +1 -1
- package/dist/core/runner/prepare-hands-readface.js +2 -1
- package/dist/core/runner/prepare-inherited-gate.d.ts +8 -12
- package/dist/core/runner/prepare-inherited-gate.js +10 -23
- package/dist/core/runner/prepare-listings.d.ts +1 -1
- package/dist/core/runner/prepare-listings.js +4 -2
- package/dist/core/runner/prepare-memory-engine-session.d.ts +0 -6
- package/dist/core/runner/prepare-memory-engine-session.js +20 -7
- package/dist/core/runner/prepare-memory.d.ts +3 -2
- package/dist/core/runner/prepare-memory.js +6 -2
- package/dist/core/runner/prepare-offload-wrappers.d.ts +4 -4
- package/dist/core/runner/prepare-offload-wrappers.js +2 -1
- package/dist/core/runner/prepare-park-ask.js +10 -14
- package/dist/core/runner/prepare-policy-chain.d.ts +17 -15
- package/dist/core/runner/prepare-policy-chain.js +104 -109
- package/dist/core/runner/prepare-project-context.d.ts +1 -1
- package/dist/core/runner/prepare-project-context.js +11 -12
- package/dist/core/runner/prepare-prompt-assembly.d.ts +45 -40
- package/dist/core/runner/prepare-prompt-assembly.js +138 -101
- package/dist/core/runner/prepare-prompt-inputs.d.ts +28 -23
- package/dist/core/runner/prepare-prompt-inputs.js +11 -10
- package/dist/core/runner/prepare-protocol-tools.d.ts +11 -7
- package/dist/core/runner/prepare-protocol-tools.js +20 -13
- package/dist/core/runner/prepare-question-face.d.ts +4 -2
- package/dist/core/runner/prepare-question-face.js +4 -3
- package/dist/core/runner/prepare-safety-scan.js +6 -10
- package/dist/core/runner/prepare-suspend-saga.d.ts +6 -0
- package/dist/core/runner/prepare-suspend-saga.js +7 -5
- package/dist/core/runner/prepare-task.js +41 -23
- package/dist/core/runner/prepare-turn-wiring.d.ts +13 -15
- package/dist/core/runner/prepare-turn-wiring.js +29 -27
- package/dist/core/runner/prepare-wiring-manifest.d.ts +13 -9
- package/dist/core/runner/prepare-wiring-manifest.js +14 -11
- package/dist/core/runner/resume-admission.d.ts +4 -1
- package/dist/core/runner/resume-admission.js +7 -5
- package/dist/core/runner/resume-apply.d.ts +5 -2
- package/dist/core/runner/resume-apply.js +24 -42
- package/dist/core/runner/resume-checkpoint-screen.d.ts +1 -0
- package/dist/core/runner/resume-checkpoint-screen.js +9 -1
- package/dist/core/runner/resume-internals-and-config.d.ts +3 -3
- package/dist/core/runner/resume-internals-and-config.js +3 -8
- package/dist/core/runner/resume-preflight.js +38 -16
- package/dist/core/runner/retired-runner-deps.d.ts +5 -6
- package/dist/core/runner/retired-runner-deps.js +4 -5
- package/dist/core/runner/run-brain-sinks.d.ts +3 -2
- package/dist/core/runner/run-brain-sinks.js +5 -1
- package/dist/core/runner/run-compaction-machinery.d.ts +7 -1
- package/dist/core/runner/run-compaction-machinery.js +7 -33
- package/dist/core/runner/run-harness-handlers.js +4 -2
- package/dist/core/runner/run-identity-wiring.d.ts +3 -1
- package/dist/core/runner/run-identity-wiring.js +3 -2
- package/dist/core/runner/run-leg.js +103 -95
- package/dist/core/runner/run-notification-lane.js +1 -0
- package/dist/core/runner/run-recovery-lanes.d.ts +3 -0
- package/dist/core/runner/run-recovery-lanes.js +14 -11
- package/dist/core/runner/run-settle-and-teardown.js +9 -28
- package/dist/core/runner/run-stop-and-final-verify.js +18 -25
- package/dist/core/runner/run-terminal-adoption.d.ts +3 -0
- package/dist/core/runner/run-terminal-adoption.js +34 -22
- package/dist/core/runner/run-tool-mount-facts.js +5 -3
- package/dist/core/runner/run-turn-boundary.js +32 -37
- package/dist/core/runner/runtask.d.ts +6 -7
- package/dist/core/runner/runtask.js +15 -73
- package/dist/core/runner/session-rule-policy.d.ts +5 -5
- package/dist/core/runner/session-rule-policy.js +13 -8
- package/dist/core/runner/side-call-account.d.ts +68 -0
- package/dist/core/runner/side-call-account.js +61 -0
- package/dist/core/runner/skills-seat.d.ts +15 -0
- package/dist/core/runner/skills-seat.js +57 -0
- package/dist/core/runner/stream-halt-verbs.js +12 -17
- package/dist/core/runner/stream-lifecycle-verbs.js +8 -5
- package/dist/core/runner/stream-steer-verb.d.ts +1 -1
- package/dist/core/runner/stream-steer-verb.js +20 -38
- package/dist/core/runner/sub-agent-deny-lists.d.ts +124 -23
- package/dist/core/runner/sub-agent-deny-lists.js +230 -71
- package/dist/core/runner/synthetic-tools.d.ts +5 -2
- package/dist/core/runner/synthetic-tools.js +2 -12
- package/dist/core/runner/tool-end-body.d.ts +5 -6
- package/dist/core/runner/tool-end-body.js +6 -4
- package/dist/core/runner/tool-not-executed.d.ts +15 -0
- package/dist/core/runner/tool-not-executed.js +30 -0
- package/dist/core/runner/tool-occurrence.d.ts +8 -7
- package/dist/core/runner/tool-occurrence.js +5 -5
- package/dist/core/runner/tool-result-media-seat.d.ts +1 -1
- package/dist/core/runner-deps.d.ts +43 -36
- package/dist/core/safety-merge-corpus.js +18 -2
- package/dist/core/secret-env.d.ts +88 -20
- package/dist/core/secret-env.js +192 -38
- package/dist/core/session-policy-store.d.ts +71 -16
- package/dist/core/session-policy-store.js +138 -28
- package/dist/core/session-reconcile.d.ts +4 -0
- package/dist/core/session-reconcile.js +2 -1
- package/dist/core/shell-read-silence.js +3 -32
- package/dist/core/side-query.d.ts +5 -3
- package/dist/core/skill-grant.d.ts +3 -2
- package/dist/core/skill-grant.js +17 -9
- package/dist/core/skills-directory.d.ts +31 -11
- package/dist/core/skills-directory.js +655 -104
- package/dist/core/store-contracts/mailbox-store-contract.js +13 -0
- package/dist/core/task-event.d.ts +49 -3
- package/dist/core/task-notification.js +2 -2
- package/dist/core/task-result.d.ts +8 -0
- package/dist/core/task-spec.d.ts +20 -19
- package/dist/core/task-stream.d.ts +14 -4
- package/dist/core/tighten-task-spec.d.ts +4 -3
- package/dist/core/tighten-task-spec.js +2 -4
- package/dist/core/tool-check-reading.d.ts +74 -0
- package/dist/core/tool-check-reading.js +80 -0
- package/dist/core/tool-policy.d.ts +62 -18
- package/dist/core/tool-policy.js +86 -15
- package/dist/core/tool-registry.d.ts +20 -0
- package/dist/core/tool-registry.js +4 -0
- package/dist/core/tool-spec.d.ts +10 -6
- package/dist/core/tools.js +2 -0
- package/dist/core/trace.d.ts +51 -32
- package/dist/core/types.d.ts +2 -2
- package/dist/core/types.js +1 -1
- package/dist/core/unc-spelling.d.ts +10 -0
- package/dist/core/unc-spelling.js +3 -0
- package/dist/core/untrusted-egress.d.ts +8 -0
- package/dist/core/untrusted-egress.js +4 -1
- package/dist/core/untrusted-text.d.ts +16 -0
- package/dist/core/untrusted-text.js +7 -2
- package/dist/core/user-attachment.d.ts +25 -4
- package/dist/core/user-attachment.js +63 -42
- package/dist/core/wiring-manifest.d.ts +18 -15
- package/dist/core/wiring-manifest.js +2 -2
- package/dist/engine/compaction/utils.js +1 -2
- package/dist/engine/execution-env/node-execution-env.d.ts +4 -3
- package/dist/engine/execution-env/symlink-chain.js +1 -1
- package/dist/engine/harness/agent-harness.d.ts +1 -1
- package/dist/engine/harness/agent-harness.js +5 -4
- package/dist/engine/harness/types.d.ts +20 -16
- package/dist/engine/harness/types.js +7 -1
- package/dist/engine/llm/types.d.ts +12 -7
- package/dist/engine/loop/agent-loop.d.ts +12 -1
- package/dist/engine/loop/agent-loop.js +18 -6
- package/dist/engine/loop/types.d.ts +8 -2
- package/dist/engine/lsp/node-lsp-manager.d.ts +2 -2
- package/dist/engine/session/import-validate.js +3 -10
- package/dist/engine/session/session.d.ts +4 -4
- package/dist/engine/session/session.js +4 -4
- package/dist/index.d.ts +33 -23
- package/dist/index.js +23 -15
- package/dist/internal/harness.d.ts +2 -1
- package/dist/internal/harness.js +2 -1
- package/dist/orchestration/goal.d.ts +24 -1
- package/dist/orchestration/goal.js +3 -2
- package/dist/orchestration/run-spec.d.ts +4 -6
- package/dist/orchestration/run-spec.js +39 -63
- package/dist/orchestration/run-workflow-tool.js +1 -2
- package/dist/orchestration/workflow.d.ts +11 -3
- package/dist/orchestration/workflow.js +11 -2
- package/dist/prompt-assembly/artifact-store.d.ts +72 -56
- package/dist/prompt-assembly/artifact-store.js +60 -52
- package/dist/prompt-assembly/artifact.d.ts +90 -76
- package/dist/prompt-assembly/artifact.js +197 -145
- package/dist/prompt-assembly/assemble.d.ts +36 -29
- package/dist/prompt-assembly/assemble.js +34 -220
- package/dist/prompt-assembly/bands.d.ts +20 -0
- package/dist/prompt-assembly/bands.js +18 -0
- package/dist/prompt-assembly/catalog/constitution.d.ts +23 -0
- package/dist/prompt-assembly/catalog/constitution.js +69 -0
- package/dist/prompt-assembly/catalog/core-behavior.d.ts +9 -0
- package/dist/prompt-assembly/catalog/core-behavior.js +85 -0
- package/dist/prompt-assembly/catalog/index.d.ts +11 -0
- package/dist/prompt-assembly/catalog/index.js +60 -0
- package/dist/prompt-assembly/catalog/memory.d.ts +13 -0
- package/dist/prompt-assembly/catalog/memory.js +6 -0
- package/dist/prompt-assembly/catalog/modes.d.ts +15 -0
- package/dist/prompt-assembly/catalog/modes.js +137 -0
- package/dist/prompt-assembly/catalog/role.d.ts +10 -0
- package/dist/prompt-assembly/catalog/role.js +157 -0
- package/dist/prompt-assembly/catalog/schema.d.ts +138 -0
- package/dist/prompt-assembly/catalog/schema.js +25 -0
- package/dist/prompt-assembly/catalog/sections.d.ts +9 -0
- package/dist/prompt-assembly/catalog/sections.js +98 -0
- package/dist/prompt-assembly/catalog/team.d.ts +4 -0
- package/dist/prompt-assembly/catalog/team.js +258 -0
- package/dist/prompt-assembly/composer.d.ts +26 -28
- package/dist/prompt-assembly/composer.js +124 -46
- package/dist/prompt-assembly/epoch.d.ts +89 -79
- package/dist/prompt-assembly/epoch.js +115 -142
- package/dist/prompt-assembly/explain.d.ts +58 -34
- package/dist/prompt-assembly/explain.js +21 -24
- package/dist/prompt-assembly/overlay.d.ts +137 -0
- package/dist/prompt-assembly/overlay.js +339 -0
- package/dist/prompt-assembly/renderers.d.ts +21 -0
- package/dist/prompt-assembly/renderers.js +39 -0
- package/dist/prompt-assembly/section-usage.d.ts +3 -3
- package/dist/prompt-assembly/section-usage.js +1 -1
- package/dist/prompt-assembly/select.d.ts +71 -0
- package/dist/prompt-assembly/select.js +106 -0
- package/dist/prompt-assembly/sugar.d.ts +31 -0
- package/dist/prompt-assembly/sugar.js +20 -0
- package/dist/prompt-assembly/turn-snapshot.d.ts +3 -2
- package/dist/prompt-assembly/types.d.ts +45 -148
- package/dist/prompts/coordinator.d.ts +2 -21
- package/dist/prompts/coordinator.js +3 -255
- package/dist/prompts/cowork.d.ts +27 -16
- package/dist/prompts/cowork.js +2 -23
- package/dist/prompts/default.d.ts +38 -511
- package/dist/prompts/default.js +20 -288
- package/dist/prompts/supervisor.d.ts +6 -71
- package/dist/prompts/supervisor.js +6 -117
- package/dist/stores/file/permission-rule-store.d.ts +1 -1
- package/dist/stores/file/permission-rule-store.js +2 -1
- package/dist/tools/artifact/artifact-tool.js +4 -3
- package/dist/tools/fs/bash-readonly-classifier.d.ts +6 -5
- package/dist/tools/fs/dir-entries.d.ts +4 -2
- package/dist/tools/fs/dir-entries.js +16 -4
- package/dist/tools/fs/fs-bash.d.ts +1 -1
- package/dist/tools/fs/fs-bash.js +22 -11
- package/dist/tools/fs/fs-pdf.js +17 -13
- package/dist/tools/fs/fs-read.js +4 -3
- package/dist/tools/fs/fs-shared.d.ts +1 -10
- package/dist/tools/fs/fs-shared.js +3 -4
- package/dist/tools/fs/fs-write.js +2 -1
- package/dist/tools/fs/notebook.js +1 -1
- package/dist/tools/fs/pdf.d.ts +20 -10
- package/dist/tools/fs/pdf.js +19 -10
- package/dist/tools/fs/program-read-model.d.ts +68 -8
- package/dist/tools/fs/program-read-model.js +112 -33
- package/dist/tools/fs/program-read-model.rows.js +30 -10
- package/dist/tools/fs/read-deny-home.d.ts +25 -9
- package/dist/tools/fs/read-deny-home.js +28 -27
- package/dist/tools/fs/read-deny.d.ts +41 -11
- package/dist/tools/fs/read-deny.js +51 -5
- package/dist/tools/fs/safety.d.ts +4 -26
- package/dist/tools/fs/safety.js +10 -32
- package/dist/tools/fs/search.js +15 -10
- package/dist/tools/fs/shell-read-argv.d.ts +3 -2
- package/dist/tools/fs/shell-read-argv.js +118 -38
- package/dist/tools/fs/shell-read-establish.d.ts +5 -5
- package/dist/tools/fs/shell-read-establish.js +11 -61
- package/dist/tools/fs/shell-read-identity.js +6 -3
- package/dist/tools/fs/shell-read-judge.d.ts +13 -15
- package/dist/tools/fs/shell-read-judge.js +18 -4
- package/dist/tools/fs/shell-read-plan.d.ts +2 -2
- package/dist/tools/web.js +1 -1
- package/package.json +13 -1
- package/test/export-surface.snapshot.json +306 -103
- package/wire-changes/core@7.52.0.json +5859 -0
- package/wire-changes/core@7.53.0.json +1946 -0
- package/dist/core/hook-seats.d.ts +0 -66
- package/dist/core/hook-seats.js +0 -37
- package/dist/prompt-assembly/packs/sema-default.d.ts +0 -2
- package/dist/prompt-assembly/packs/sema-default.js +0 -147
- package/dist/prompts/simple-sections.d.ts +0 -58
- package/dist/prompts/simple-sections.js +0 -43
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type AgentMessage, type CompactionSettings, type Session, type ThinkingLevel } from "../internal/harness.js";
|
|
2
2
|
import type { Message, Model, Tool } from "../internal/llm.js";
|
|
3
3
|
import type { ContextWindowOverlay } from "./context-settings.js";
|
|
4
|
-
import type {
|
|
4
|
+
import type { PostCompactContext, PreCompactContext, PreCompactResult } from "./hooks.js";
|
|
5
5
|
import type { TraceEvent } from "./trace.js";
|
|
6
6
|
import type { Brain } from "./types.js";
|
|
7
7
|
import type { TaskEvent, TaskEventIdentity } from "./task-event.js";
|
|
@@ -101,6 +101,18 @@ export interface CompactionForkContext {
|
|
|
101
101
|
* eligibility gate refuses a snapshot from a different model (see the engine-side twin's doc). */
|
|
102
102
|
modelId?: string;
|
|
103
103
|
}
|
|
104
|
+
/**
|
|
105
|
+
* What a compaction pass reports at the moment it commits ({@link MaybeCompactOptions.onStarted}) — and the
|
|
106
|
+
* whole content of its `compaction_started` wire frame. `pass` is minted HERE, by the one function every lane
|
|
107
|
+
* runs, so no lane can number its own passes; the frame that ends the pass carries the same value.
|
|
108
|
+
*/
|
|
109
|
+
export interface CompactionPassStart {
|
|
110
|
+
readonly pass: string;
|
|
111
|
+
/** The trigger this pass runs under — the value it hands the `preCompact` hook. */
|
|
112
|
+
readonly trigger: "auto" | "manual" | "forced";
|
|
113
|
+
/** Engine clock, epoch ms, at the commit. */
|
|
114
|
+
readonly startedAt: number;
|
|
115
|
+
}
|
|
104
116
|
export interface MaybeCompactOptions {
|
|
105
117
|
/** Disclosure channel for CONTAINED host-callback failures in this scope (the RB-463
|
|
106
118
|
* isolation primitive's bounded first-failure per site). Absent ⇒ failures are counted only. */
|
|
@@ -108,25 +120,27 @@ export interface MaybeCompactOptions {
|
|
|
108
120
|
/** The session to compact. Typed on the INTERFACE face (typecheck 车 2026-07-24): every member this
|
|
109
121
|
* module touches lives on `Session` (the optional `getPromptEpoch` degrades honestly via `?.()`). */
|
|
110
122
|
session: Session;
|
|
111
|
-
/** This run's
|
|
112
|
-
* the
|
|
113
|
-
*
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
123
|
+
/** This run's prompt identity inputs (and the pinned center layer's provenance): the compaction restates the
|
|
124
|
+
* session's epoch when the identity is unchanged and advances it otherwise — the same identity the prepare-time
|
|
125
|
+
* record names, so a compaction never flaps the record. Absent ⇒ no restatement (a host compacting outside a run). */
|
|
126
|
+
promptIdentity?: {
|
|
127
|
+
readonly layers: import("../prompt-assembly/epoch.js").PromptIdentityLayers;
|
|
128
|
+
readonly sourceRevision?: string;
|
|
129
|
+
};
|
|
130
|
+
/** A compaction-boundary CENTER LAYER CHANGE, pre-assembled by the caller (prepare's seam): an adopted candidate,
|
|
131
|
+
* or an emptied center layer after an explicit revocation. The epoch advances to the identity after the change in
|
|
132
|
+
* the SAME CAS append as the new baseline, and `apply()` (the live prefix / fingerprint swap) runs ONLY after that
|
|
133
|
+
* append succeeded — a failed or blocked compaction swaps nothing. */
|
|
119
134
|
centerAdoption?: {
|
|
120
|
-
/**
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
declaredSections: import("../prompt-assembly/epoch.js").EpochDeclaredSections;
|
|
135
|
+
/** The run's identity inputs after the change (`layers.center` absent ⇒ the center layer is emptied). */
|
|
136
|
+
promptIdentity: {
|
|
137
|
+
readonly layers: import("../prompt-assembly/epoch.js").PromptIdentityLayers;
|
|
138
|
+
readonly sourceRevision?: string;
|
|
139
|
+
};
|
|
126
140
|
/** the post-swap prompt overhead in the trigger estimate's coordinate: used for THIS
|
|
127
141
|
* compaction's post-measurement so PTL recovery/anti-thrash see the swapped prefix size. */
|
|
128
142
|
overheadTokensAfter: number;
|
|
129
|
-
apply: (
|
|
143
|
+
apply: (committedIdentity: string) => void;
|
|
130
144
|
};
|
|
131
145
|
/** Model whose context window bounds the budget (the model that runs the next turn). */
|
|
132
146
|
model: Model;
|
|
@@ -196,8 +210,9 @@ export interface MaybeCompactOptions {
|
|
|
196
210
|
contextInstructionFiles?: string;
|
|
197
211
|
signal?: AbortSignal;
|
|
198
212
|
/**
|
|
199
|
-
*
|
|
200
|
-
*
|
|
213
|
+
* The pass's WITHDRAWAL signal — the run's caller-stop gate (the stop verbs and the task's own
|
|
214
|
+
* `signal`), composed with the cancel signals of the manual callers THIS pass claimed (a SUBSET
|
|
215
|
+
* of `signal`, which may additionally carry the leg's own abort).
|
|
201
216
|
* Used only for failure ATTRIBUTION: when the summary call's failure is its abort outcome and
|
|
202
217
|
* this signal has fired, the thrown error is stamped so {@link isCompactionManualCancel} holds —
|
|
203
218
|
* the caller then treats the pass as withdrawn ("mooted") instead of summarizer evidence. It
|
|
@@ -479,6 +494,17 @@ export interface MaybeCompactOptions {
|
|
|
479
494
|
* not optional there, so a preCompact `block` is IGNORED on "forced").
|
|
480
495
|
*/
|
|
481
496
|
trigger?: "auto" | "manual" | "forced";
|
|
497
|
+
/**
|
|
498
|
+
* The pass has COMMITTED: the trigger gate passed, a valid cut point exists and no `preCompact` handler
|
|
499
|
+
* blocked it, and nothing has yet consulted the summary provider or called the model. Fired exactly once per
|
|
500
|
+
* pass — a retry inside the summary call is the same pass — and never for a pass that ends before this point
|
|
501
|
+
* (under threshold, held under the floor, disabled, nothing to compact, blocked, or cut by its own signal while
|
|
502
|
+
* the `preCompact` hook ran). A pass that fired it ends
|
|
503
|
+
* in `compacted: true` or a throw, so the caller that put a frame on the wire here owes the matching end.
|
|
504
|
+
* Observe-only: a throw — or the rejection of an `async` callback, which this seat does not await — is
|
|
505
|
+
* contained and never reaches the pass.
|
|
506
|
+
*/
|
|
507
|
+
onStarted?: (start: CompactionPassStart) => void;
|
|
482
508
|
/**
|
|
483
509
|
* design/134 (CC PreCompact parity) — fired AFTER the trigger gate and a CONFIRMED valid cut point
|
|
484
510
|
* (so every invocation corresponds to a compaction that would actually happen), BEFORE the
|
|
@@ -488,13 +514,13 @@ export interface MaybeCompactOptions {
|
|
|
488
514
|
* no-block/no-instructions (the caller's wrapper owns tracing; an observer bug must never feed the
|
|
489
515
|
* caller's breaker or kill PTL recovery).
|
|
490
516
|
*/
|
|
491
|
-
preCompact?:
|
|
517
|
+
preCompact?: (ctx: PreCompactContext) => PreCompactResult | undefined | Promise<PreCompactResult | undefined>;
|
|
492
518
|
/**
|
|
493
519
|
* design/134 (CC PostCompact parity) — observe-only, fired after the compaction LANDED
|
|
494
520
|
* (appendCompaction done, post measurement taken). A throw is swallowed (same isolation contract
|
|
495
521
|
* as {@link onCompaction}: the compaction already succeeded).
|
|
496
522
|
*/
|
|
497
|
-
postCompact?:
|
|
523
|
+
postCompact?: (ctx: PostCompactContext) => void | Promise<void>;
|
|
498
524
|
/**
|
|
499
525
|
* MF-18 修② — observe-only: fired when a summary call's serialized conversation INPUT was
|
|
500
526
|
* truncated to fit the compaction model's context window (the ~300K-session shape that previously
|
|
@@ -550,6 +576,10 @@ export declare function maybeCompact(opts: MaybeCompactOptions): Promise<{
|
|
|
550
576
|
* nothing to do looked identical to one that never wanted to run; the caller's outcome event
|
|
551
577
|
* (`compaction_outcome{outcome:"noop"}`) reads this flag. */
|
|
552
578
|
noop?: true;
|
|
579
|
+
/** The id of the pass this result concludes — the value {@link MaybeCompactOptions.onStarted} was handed.
|
|
580
|
+
* Set exactly when `compacted` is true: every other return of this function ends before the pass commits,
|
|
581
|
+
* and a pass that commits and does not land THROWS (the caller learned the id from the start callback). */
|
|
582
|
+
pass?: string;
|
|
553
583
|
tokensBefore?: number;
|
|
554
584
|
/** The §25.2 STRUCTURAL pre/post delta in ONE coordinate — the only subtractable quantity here.
|
|
555
585
|
* Absent ⇒ the post measurement failed and no delta was taken. */
|
|
@@ -666,6 +696,8 @@ export declare function maybeCompact(opts: MaybeCompactOptions): Promise<{
|
|
|
666
696
|
/** What a landed compaction hands the wire frame. Structural, so both the full `maybeCompact` result
|
|
667
697
|
* and the settle lane's narrower `EndOfTaskCompaction` satisfy it without either importing the other. */
|
|
668
698
|
export interface CompactedFrameSource {
|
|
699
|
+
/** The pass this landing concludes (see {@link MaybeCompactOptions.onStarted}). */
|
|
700
|
+
pass?: string;
|
|
669
701
|
tokensBefore?: number;
|
|
670
702
|
freedTokens?: number;
|
|
671
703
|
postTriggerTokens?: number;
|
|
@@ -700,6 +732,34 @@ export interface CompactedFrameSource {
|
|
|
700
732
|
export declare function mintCompactedEvent(comp: CompactedFrameSource, trigger: "auto" | "manual" | "forced", identity: TaskEventIdentity): Extract<TaskEvent, {
|
|
701
733
|
type: "compacted";
|
|
702
734
|
}>;
|
|
735
|
+
/**
|
|
736
|
+
* THE mint of the `compaction_started` wire frame — the opening half of the pair whose closing half is the
|
|
737
|
+
* `compacted` frame above (or a `compaction_outcome` that carries the same `pass`). One function, three
|
|
738
|
+
* lanes, as the landing's: the frame is the start report itself plus the identity envelope, so a lane that
|
|
739
|
+
* wants to announce a pass can only announce the one `maybeCompact` committed.
|
|
740
|
+
*/
|
|
741
|
+
export declare function mintCompactionStartedEvent(start: CompactionPassStart, identity: TaskEventIdentity): Extract<TaskEvent, {
|
|
742
|
+
type: "compaction_started";
|
|
743
|
+
}>;
|
|
744
|
+
/**
|
|
745
|
+
* One compaction pass's account on the wire: the `onStarted` seat to hand `maybeCompact`, and the id the frame
|
|
746
|
+
* that ENDS the pass must carry. A lane makes one per pass, hands `onStarted` to the pass, and spreads
|
|
747
|
+
* {@link CompactionPassReport.end} into every `compaction_outcome` the pass can end with after it committed — a
|
|
748
|
+
* pass that threw before it committed leaves it empty, which is exactly "no start was announced, so no `pass`
|
|
749
|
+
* names it". The landing needs no spread: `maybeCompact` returns the id and `mintCompactedEvent` reads it.
|
|
750
|
+
*/
|
|
751
|
+
export interface CompactionPassReport {
|
|
752
|
+
readonly onStarted: (start: CompactionPassStart) => void;
|
|
753
|
+
/** The announced pass's id; `undefined` until a start went on the wire. */
|
|
754
|
+
readonly pass: string | undefined;
|
|
755
|
+
/** `{ pass }` once a start was announced, `{}` before — for the frame that ends the pass. */
|
|
756
|
+
readonly end: {
|
|
757
|
+
pass?: string;
|
|
758
|
+
};
|
|
759
|
+
}
|
|
760
|
+
export declare function compactionPassReport(sink: {
|
|
761
|
+
push(event: TaskEvent): void;
|
|
762
|
+
}, ident: () => TaskEventIdentity): CompactionPassReport;
|
|
703
763
|
/**
|
|
704
764
|
* How many cross-session message frames the summarized prefix held: the engine-note user messages
|
|
705
765
|
* whose text is the drain's `<cross-session-message …>` envelope, before the kept tail begins. The
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { CROSS_SESSION_MESSAGE_TAG } from "../agents/cross-session-envelope.js";
|
|
2
|
-
import { DEFAULT_CHARS_PER_TOKEN, DEFAULT_CLAMP_TOLERANCE, DEFAULT_COMPACTION_SETTINGS, CompactionError, compact, computeFileLists, dryRunSummarizationClamp, estimateContextTokens, estimateTokens, formatFileOperations, formatPersistedOutputRefs, prepareCompaction, shouldCompact, } from "../internal/harness.js";
|
|
3
|
-
import { fileArgPath } from "
|
|
2
|
+
import { DEFAULT_CHARS_PER_TOKEN, DEFAULT_CLAMP_TOLERANCE, DEFAULT_COMPACTION_SETTINGS, CompactionError, compact, computeFileLists, dryRunSummarizationClamp, estimateContextTokens, estimateTokens, formatFileOperations, formatPersistedOutputRefs, prepareCompaction, shouldCompact, uuidv7, } from "../internal/harness.js";
|
|
3
|
+
import { fileArgPath } from "./tool-registry.js";
|
|
4
4
|
import { contextEditFrontier, resolveTriggerWindow } from "./context-edit.js";
|
|
5
5
|
import { selectCompactionEpoch } from "../prompt-assembly/epoch.js";
|
|
6
|
-
import { SEMA_DEFAULT_PACK } from "../prompt-assembly/packs/sema-default.js";
|
|
7
6
|
import { brainToRuntime } from "./runtime.js";
|
|
8
7
|
import { defuseFenceMarkers, sanitizeUntrustedText } from "./untrusted-text.js";
|
|
9
|
-
import { createSafeNotifier } from "./safe-notify.js";
|
|
8
|
+
import { createSafeNotifier, observeThenableRejection } from "./safe-notify.js";
|
|
10
9
|
export const DEFAULT_COMPACTION_INSTRUCTIONS = "Preserve verbatim every code, identifier, name, number, file path, error message, credential " +
|
|
11
10
|
"reference, and explicit user instruction or decision mentioned anywhere in the conversation. " +
|
|
12
11
|
"When in doubt, keep the specific detail rather than generalizing it.";
|
|
@@ -153,24 +152,53 @@ export async function maybeCompact(opts) {
|
|
|
153
152
|
? `${specInstructions}\n\n${hookSanitized}`
|
|
154
153
|
: hookSanitized
|
|
155
154
|
: specInstructions;
|
|
155
|
+
const signalAtCommit = opts.signal;
|
|
156
|
+
if (signalAtCommit?.aborted === true) {
|
|
157
|
+
throw Object.assign(new CompactionError("aborted", "compaction cancelled before the pass committed — nothing was summarized or persisted"), opts.manualCancelSignal?.aborted === true ? { [COMPACTION_MANUAL_CANCEL_FLAG]: true } : {});
|
|
158
|
+
}
|
|
159
|
+
const pass = uuidv7();
|
|
160
|
+
notifier.notify(() => observeThenableRejection(opts.onStarted?.({ pass, trigger, startedAt: Date.now() }), notifier, "compaction.onStarted"), "compaction.onStarted");
|
|
156
161
|
const maxReuse = opts.maxConsecutiveProviderReuse ?? 3;
|
|
157
162
|
const forceRealSummary = maxReuse > 0 && (opts.consecutiveProviderReuse ?? 0) >= maxReuse;
|
|
158
163
|
let providerSummary;
|
|
159
164
|
if (opts.summaryProvider && !forceRealSummary && !prep.value.isSplitTurn) {
|
|
160
165
|
const providerModifiedFiles = computeFileLists(prep.value.fileOps).modifiedFilesByRecency;
|
|
166
|
+
const signal = opts.signal;
|
|
167
|
+
const cut = Symbol("cut");
|
|
168
|
+
let release = () => undefined;
|
|
169
|
+
const cutByAbort = new Promise((resolve) => {
|
|
170
|
+
if (signal === undefined || signal.aborted)
|
|
171
|
+
return;
|
|
172
|
+
const onAbort = () => resolve(cut);
|
|
173
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
174
|
+
release = () => signal.removeEventListener("abort", onAbort);
|
|
175
|
+
});
|
|
176
|
+
let consulted;
|
|
161
177
|
try {
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
178
|
+
consulted =
|
|
179
|
+
signal?.aborted === true
|
|
180
|
+
? cut
|
|
181
|
+
: await Promise.race([
|
|
182
|
+
Promise.resolve(opts.summaryProvider({
|
|
183
|
+
messagesToSummarize: prep.value.messagesToSummarize,
|
|
184
|
+
previousSummary: prep.value.previousSummary,
|
|
185
|
+
modifiedFiles: providerModifiedFiles,
|
|
186
|
+
})),
|
|
187
|
+
cutByAbort,
|
|
188
|
+
]);
|
|
189
|
+
const trimmed = typeof consulted === "string" ? consulted.trim() : "";
|
|
168
190
|
if (trimmed) {
|
|
169
191
|
providerSummary = trimmed;
|
|
170
192
|
}
|
|
171
193
|
}
|
|
172
194
|
catch {
|
|
173
195
|
}
|
|
196
|
+
finally {
|
|
197
|
+
release();
|
|
198
|
+
}
|
|
199
|
+
if (consulted === cut) {
|
|
200
|
+
throw Object.assign(new CompactionError("aborted", "compaction cancelled while the summary provider was answering — nothing was persisted"), opts.manualCancelSignal?.aborted === true ? { [COMPACTION_MANUAL_CANCEL_FLAG]: true } : {});
|
|
201
|
+
}
|
|
174
202
|
}
|
|
175
203
|
let summary;
|
|
176
204
|
let firstKeptEntryId;
|
|
@@ -448,18 +476,17 @@ export async function maybeCompact(opts) {
|
|
|
448
476
|
for (const m of ctx.messages)
|
|
449
477
|
preChars += estimateTokens(m, cpt);
|
|
450
478
|
const ca = opts.centerAdoption;
|
|
451
|
-
const
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
: undefined);
|
|
479
|
+
const stored = await opts.session.getPromptEpoch?.();
|
|
480
|
+
const current = stored?.kind === "pin" ? stored.descriptor : undefined;
|
|
481
|
+
const identityNow = ca?.promptIdentity ?? opts.promptIdentity ?? (current !== undefined ? { layers: current.layers, ...(current.sourceRevision !== undefined ? { sourceRevision: current.sourceRevision } : {}) } : undefined);
|
|
482
|
+
const restatedEpoch = identityNow !== undefined ? selectCompactionEpoch(current, identityNow.layers, identityNow.sourceRevision) : undefined;
|
|
456
483
|
const restatedListings = await opts.session.getAnnouncedListing().catch(() => undefined);
|
|
457
484
|
if (opts.signal?.aborted === true) {
|
|
458
485
|
throw Object.assign(new Error("compaction cancelled before commit — the abort signal fired during the summary call; nothing was persisted"), opts.manualCancelSignal?.aborted === true ? { [COMPACTION_MANUAL_CANCEL_FLAG]: true } : {});
|
|
459
486
|
}
|
|
460
487
|
await opts.session.appendCompaction(summaryWithAttachments, firstKeptEntryId, summaryTokensBefore, {
|
|
461
488
|
...(details ?? {}),
|
|
462
|
-
promptEpoch: restatedEpoch,
|
|
489
|
+
...(restatedEpoch !== undefined ? { promptEpoch: restatedEpoch } : {}),
|
|
463
490
|
...(restatedListings !== undefined ? { announcedListings: restatedListings } : {}),
|
|
464
491
|
...(opts.activeTools !== undefined && opts.activeTools.length > 0 ? { activeTools: [...opts.activeTools] } : {}),
|
|
465
492
|
...(opts.gitRestate !== undefined ? { gitAnnouncement: { kind: opts.gitRestate.pending.kind, hash: opts.gitRestate.pending.hash, pending: true } } : {}),
|
|
@@ -494,9 +521,9 @@ export async function maybeCompact(opts) {
|
|
|
494
521
|
}
|
|
495
522
|
catch {
|
|
496
523
|
}
|
|
497
|
-
if (ca !== undefined) {
|
|
524
|
+
if (ca !== undefined && restatedEpoch !== undefined) {
|
|
498
525
|
try {
|
|
499
|
-
ca.apply(restatedEpoch.
|
|
526
|
+
ca.apply(restatedEpoch.identity);
|
|
500
527
|
}
|
|
501
528
|
catch {
|
|
502
529
|
}
|
|
@@ -534,6 +561,7 @@ export async function maybeCompact(opts) {
|
|
|
534
561
|
return {
|
|
535
562
|
contextUsage,
|
|
536
563
|
compacted: true,
|
|
564
|
+
pass,
|
|
537
565
|
tokensBefore: summaryTokensBefore,
|
|
538
566
|
freedTokens,
|
|
539
567
|
triggerTokens: tokens,
|
|
@@ -564,6 +592,7 @@ export function mintCompactedEvent(comp, trigger, identity) {
|
|
|
564
592
|
return {
|
|
565
593
|
type: "compacted",
|
|
566
594
|
trigger,
|
|
595
|
+
...(comp.pass !== undefined ? { pass: comp.pass } : {}),
|
|
567
596
|
tokensBefore: comp.tokensBefore ?? 0,
|
|
568
597
|
...(comp.freedTokens !== undefined ? { freedTokens: comp.freedTokens } : {}),
|
|
569
598
|
...(comp.postTriggerTokens !== undefined ? { tokensAfter: comp.postTriggerTokens } : {}),
|
|
@@ -580,6 +609,24 @@ export function mintCompactedEvent(comp, trigger, identity) {
|
|
|
580
609
|
...identity,
|
|
581
610
|
};
|
|
582
611
|
}
|
|
612
|
+
export function mintCompactionStartedEvent(start, identity) {
|
|
613
|
+
return { type: "compaction_started", trigger: start.trigger, pass: start.pass, startedAt: start.startedAt, ...identity };
|
|
614
|
+
}
|
|
615
|
+
export function compactionPassReport(sink, ident) {
|
|
616
|
+
let pass;
|
|
617
|
+
return {
|
|
618
|
+
onStarted: (start) => {
|
|
619
|
+
sink.push(mintCompactionStartedEvent(start, ident()));
|
|
620
|
+
pass = start.pass;
|
|
621
|
+
},
|
|
622
|
+
get pass() {
|
|
623
|
+
return pass;
|
|
624
|
+
},
|
|
625
|
+
get end() {
|
|
626
|
+
return pass !== undefined ? { pass } : {};
|
|
627
|
+
},
|
|
628
|
+
};
|
|
629
|
+
}
|
|
583
630
|
export function countSummarizedCrossSessionMessages(branch, firstKeptEntryId) {
|
|
584
631
|
const firstKeptIdx = branch.findIndex((e) => e.id === firstKeptEntryId);
|
|
585
632
|
const summarized = firstKeptIdx >= 0 ? branch.slice(0, firstKeptIdx) : branch;
|
|
@@ -106,7 +106,8 @@ export declare const FROZEN_DENYLIST_FLOOR: ReadonlySet<string>;
|
|
|
106
106
|
*
|
|
107
107
|
* @param artifactText the artifact's raw text (markdown body included).
|
|
108
108
|
* @param declared the artifact's declared tool list (the `SkillSpec` member the loader copies) — its `allowedTools`
|
|
109
|
-
* entries,
|
|
109
|
+
* entries, read by the list reader as a rule for the tool each names (one it reads as nothing names none), are the
|
|
110
|
+
* symbol-drift baseline.
|
|
110
111
|
* @param profileTokens optional ADD-ONLY extra denylist tokens (UNIONed onto the frozen floor; cannot remove).
|
|
111
112
|
*/
|
|
112
113
|
export declare function deriveTripwire(artifactText: string, declared: Pick<SkillSpec, "allowedTools">, profileTokens?: ReadonlySet<string>): TripwireResult;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { extractSymbols } from "../tools/fs/repo-map.js";
|
|
2
|
-
import {
|
|
2
|
+
import { compileAllowList, compiledEntryName } from "./allow-entry.js";
|
|
3
3
|
import { thrownText } from "./thrown-value.js";
|
|
4
4
|
export function decideAutoPromote(i) {
|
|
5
5
|
if (i.tripwire.escalate)
|
|
@@ -60,7 +60,7 @@ export function deriveTripwire(artifactText, declared, profileTokens) {
|
|
|
60
60
|
const reasons = [];
|
|
61
61
|
let escalate = false;
|
|
62
62
|
try {
|
|
63
|
-
const allow = new Set((declared.allowedTools ?? []).map((
|
|
63
|
+
const allow = new Set(compileAllowList(declared.allowedTools ?? [], "allow").rows.map((r) => compiledEntryName(r.compiled)));
|
|
64
64
|
const symbols = extractSymbols(artifactText);
|
|
65
65
|
for (const sym of symbols) {
|
|
66
66
|
if (!allow.has(sym)) {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Why `name` cannot be a caller tool's name or alias — or `undefined` when it can. Two clauses, in this order:
|
|
3
|
+
* - the name must be one a rule can name ({@link isNameableToolName}; a value that is not a string is none): a tool mounted
|
|
4
|
+
* under a name no list can write could be neither granted nor refused by name;
|
|
5
|
+
* - `__` is reserved for the protocol namespaces: a caller name carrying it is read as a peer's tool everywhere names are
|
|
6
|
+
* parsed (routing, policy, telemetry), and an alias carrying it would sit inside a peer's prefix domain (a refresh would
|
|
7
|
+
* classify or clear it as remote, and a remote tool minted under the same name would shadow the local one).
|
|
8
|
+
*/
|
|
9
|
+
export declare function callerToolNameProblem(name: string): string | undefined;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { NAMESPACED_NAME_SHAPES, carriesNamespaceSeparator } from "./protocol-table.js";
|
|
2
|
+
import { isNameableToolName } from "./permission-rule-syntax.js";
|
|
3
|
+
export function callerToolNameProblem(name) {
|
|
4
|
+
if (!isNameableToolName(name)) {
|
|
5
|
+
return (`a caller tool name or alias must be a name a rule can name — ASCII letters, digits and "_" "-" "." ":" "*", ` +
|
|
6
|
+
`starting with a letter, a digit or "_", not ending with "." or ":", and not the lone wildcard "*" — ` +
|
|
7
|
+
`or no allow or deny list could name the tool; rename it`);
|
|
8
|
+
}
|
|
9
|
+
if (carriesNamespaceSeparator(name)) {
|
|
10
|
+
return `"__" is reserved for the engine's protocol tool namespaces (${NAMESPACED_NAME_SHAPES}) and no caller tool name or alias may carry it`;
|
|
11
|
+
}
|
|
12
|
+
return undefined;
|
|
13
|
+
}
|
|
@@ -6,7 +6,7 @@ import { type StoreFidelity, type Checkpoint, type CheckpointFeature, type Check
|
|
|
6
6
|
* had carried beside the one its word now names, and the members added after the table, each a capability a reader
|
|
7
7
|
* must have. Downstream reads them for display only (`CheckpointError.detail.requires`).
|
|
8
8
|
*/
|
|
9
|
-
export declare const REQUIREMENT_WORDS: readonly ["resource", "binding", "token", "orgAdmission", "f012", "realApproval", "face", "requirements_digest", "org_admission_inherited", "org_write_grant", "org_governed", "delegation_provenance", "skill_grants", "skill_card_binding", "hands_coordinates", "hands_home", "path_rule_anchors", "path_rule_installations", "permission_mode", "plan_mode_restore", "persisted_rule_mandate", "deployment_authored", "call_names", "write_face", "denial_limit_fallback", "leg_scope", "tool_ceiling", "tool_lists_judged"];
|
|
9
|
+
export declare const REQUIREMENT_WORDS: readonly ["resource", "binding", "token", "orgAdmission", "f012", "realApproval", "face", "requirements_digest", "org_admission_inherited", "org_write_grant", "org_governed", "delegation_provenance", "skill_grants", "skill_card_binding", "hands_coordinates", "hands_home", "path_rule_anchors", "path_rule_installations", "permission_mode", "plan_mode_restore", "persisted_rule_mandate", "deployment_authored", "call_names", "write_face", "denial_limit_fallback", "leg_scope", "tool_ceiling", "tool_lists_judged", "own_tool_lists"];
|
|
10
10
|
export type RequirementWord = (typeof REQUIREMENT_WORDS)[number];
|
|
11
11
|
/** Runtime twin of {@link RequirementWord}. */
|
|
12
12
|
export declare function isRequirementWord(word: unknown): word is RequirementWord;
|
|
@@ -224,6 +224,9 @@ export declare const CHECKPOINT_STATE_REQUIREMENTS: {
|
|
|
224
224
|
readonly toolListsJudged: {
|
|
225
225
|
readonly word: "tool_lists_judged";
|
|
226
226
|
};
|
|
227
|
+
readonly ownToolLists: {
|
|
228
|
+
readonly word: "own_tool_lists";
|
|
229
|
+
};
|
|
227
230
|
};
|
|
228
231
|
export declare const PENDING_ACTION_REQUIREMENTS: {
|
|
229
232
|
readonly tool_approval: {
|
|
@@ -576,6 +579,9 @@ export declare const CHECKPOINT_REQUIREMENTS: {
|
|
|
576
579
|
readonly toolListsJudged: {
|
|
577
580
|
readonly word: "tool_lists_judged";
|
|
578
581
|
};
|
|
582
|
+
readonly ownToolLists: {
|
|
583
|
+
readonly word: "own_tool_lists";
|
|
584
|
+
};
|
|
579
585
|
};
|
|
580
586
|
};
|
|
581
587
|
readonly resourceLedger: {
|
|
@@ -30,6 +30,7 @@ export const REQUIREMENT_WORDS = Object.freeze([
|
|
|
30
30
|
"leg_scope",
|
|
31
31
|
"tool_ceiling",
|
|
32
32
|
"tool_lists_judged",
|
|
33
|
+
"own_tool_lists",
|
|
33
34
|
]);
|
|
34
35
|
export function isRequirementWord(word) {
|
|
35
36
|
return typeof word === "string" && REQUIREMENT_WORDS.includes(word);
|
|
@@ -90,6 +91,7 @@ export const CHECKPOINT_STATE_REQUIREMENTS = {
|
|
|
90
91
|
legScope: { word: "leg_scope" },
|
|
91
92
|
toolCeiling: { word: "tool_ceiling" },
|
|
92
93
|
toolListsJudged: { word: "tool_lists_judged" },
|
|
94
|
+
ownToolLists: { word: "own_tool_lists" },
|
|
93
95
|
};
|
|
94
96
|
export const PENDING_ACTION_REQUIREMENTS = {
|
|
95
97
|
tool_approval: {
|
|
@@ -1338,7 +1338,9 @@ export interface CheckpointState {
|
|
|
1338
1338
|
legScope?: string;
|
|
1339
1339
|
/** The tool-selector layers this LEG was spawned under (`RunInternals.toolCeiling`), stamped at every mint: a resume that hands
|
|
1340
1340
|
* no live ceiling restores it, so a resumed child can never use a tool its spawning run could not. Absent ⇒ the leg had no
|
|
1341
|
-
* ceiling (a root run) or the row was minted before the member. A reader that lacks the word would run the leg unbounded.
|
|
1341
|
+
* ceiling (a root run) or the row was minted before the member. A reader that lacks the word would run the leg unbounded.
|
|
1342
|
+
* Each entry is a tool name in its canonical spelling (`persistedToolNameList`, `src/agents/tool-filter.ts`): a row restored with
|
|
1343
|
+
* any other entry is refused before the claim (`checkpoint.config_refused`, `detail.code: config.tool_face_control`, `detail.field: inheritedGate`, the row pending). */
|
|
1342
1344
|
toolCeiling?: ReadonlyArray<{
|
|
1343
1345
|
readonly allow?: readonly string[];
|
|
1344
1346
|
readonly deny: readonly string[];
|
|
@@ -1348,6 +1350,18 @@ export interface CheckpointState {
|
|
|
1348
1350
|
* that hands different lists is judged again. Absent ⇒ the leg judged its own lists (or the row was minted before the member). A
|
|
1349
1351
|
* reader that lacks the word would judge again a list judged against a wider universe, and refuse a leg that was valid. */
|
|
1350
1352
|
toolListsJudged?: string;
|
|
1353
|
+
/** Whose lists this LEG's own are (`RunInternals.ownToolLists`: the delegation tool that spawned it, by its declared name, the
|
|
1354
|
+
* agent definition it was spawned as — absent ⇒ the tool's tool-level list — and `lists`, the digest of exactly the lists it wrote),
|
|
1355
|
+
* stamped at every mint while it holds: a resume that hands no internals restores it while its own lists digest to `lists`, so the
|
|
1356
|
+
* resumed leg asks its own lists of the same universe (which carries that tool's name — a name of its lineage, mounted or not at its
|
|
1357
|
+
* depth) and a refusal names the same list; a resume that hands another table reads it as the host's own `TaskSpec` seats. Absent ⇒ the
|
|
1358
|
+
* leg's lists were not written by a delegation tool (or the row was minted before the member): the leg judges them against its own
|
|
1359
|
+
* roster as before. A reader that lacks the word would refuse a list the leg's lineage wrote, and refuse a leg that was valid. */
|
|
1360
|
+
ownToolLists?: {
|
|
1361
|
+
readonly toolName: string;
|
|
1362
|
+
readonly definition?: string;
|
|
1363
|
+
readonly lists: string;
|
|
1364
|
+
};
|
|
1351
1365
|
}
|
|
1352
1366
|
/**
|
|
1353
1367
|
* {@link CheckpointState} with **every** field made required-PRESENT, while each value keeps its original
|
|
@@ -2082,19 +2096,36 @@ export type CheckpointErrorReason = "version_newer" | "env_factory_missing" | "g
|
|
|
2082
2096
|
/** On `resume.parent_constraint_mismatch`: a re-supplied chain entry whose path rules depend on the leg that installed it has
|
|
2083
2097
|
* no installation record (a chain written before the record existed) / a record that does not cover the chain entry for
|
|
2084
2098
|
* entry / a record member naming no absolute root. */
|
|
2085
|
-
| "installation_record_absent" | "installation_record_misaligned" | "installation_record_invalid"
|
|
2099
|
+
| "installation_record_absent" | "installation_record_misaligned" | "installation_record_invalid"
|
|
2100
|
+
/** On `checkpoint.config_refused` with `detail.code` `config.tool_face_control` — the arm prepare's own refusal carries as its `detail.reason`:
|
|
2101
|
+
* 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
|
|
2102
|
+
* the one spelling a row records (`"not_a_list"`, `"not_a_string"`, `"unknown_name"`, `"unsupported_pattern"`; the re-supplied config's own four lists —
|
|
2103
|
+
* `allowTools`, `excludeTools`, `deferTools`, `alwaysLoadTools` — are refused as `"not_a_list"` / `"not_a_string"`); the record of the delegation tool that
|
|
2104
|
+
* 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
|
|
2105
|
+
* (`"renamed_mount"`); the process-wide table of declared names is occupied by a value that is not the engine's (`"registry_occupied"`). */
|
|
2106
|
+
| "not_a_list" | "not_a_string" | "unknown_name" | "unsupported_pattern" | "invalid_record" | "renamed_mount" | "registry_occupied"
|
|
2107
|
+
/** On `checkpoint.config_refused` with `detail.code` `config.unknown_role` — a role seat or a tier binding the deployment wrote that the engine cannot read:
|
|
2108
|
+
* a word the model catalog does not hold (`"unknown_model_ref"`), or a value that is no model reference at all — a number, a boolean, a list
|
|
2109
|
+
* (`"not_a_model_ref"`). The sentence names the seat (`roles.consolidate`, `tiers.pro`). */
|
|
2110
|
+
| "unknown_model_ref" | "not_a_model_ref";
|
|
2086
2111
|
/**
|
|
2087
|
-
* The codes a RESUME's pre-claim configuration screen carries as `detail.code` of a `checkpoint.config_refused` — the
|
|
2088
|
-
*
|
|
2089
|
-
*
|
|
2090
|
-
* `
|
|
2091
|
-
*
|
|
2092
|
-
* `config.
|
|
2093
|
-
* `
|
|
2094
|
-
* `
|
|
2095
|
-
*
|
|
2112
|
+
* The codes a RESUME's pre-claim configuration screen carries as `detail.code` of a `checkpoint.config_refused` — the words prepare's
|
|
2113
|
+
* doors throw, held unchanged so one refusal reads the same on a fresh run (`TaskResult.errorCode`) and on a resume: the mode, output-style,
|
|
2114
|
+
* approval-reach, invoked-skill, attachment, recorded-mode and tool-face doors (`config.spec_retired_key` … `config.tool_face_control`, the first
|
|
2115
|
+
* nine — `detail.reason` names the tool-face arm: {@link CheckpointErrorReason}), and every value door of the config-door phase over the
|
|
2116
|
+
* re-supplied config and the deployment's deps (`configValueDoors`, the rest): the retired deps seats and caller-policy members
|
|
2117
|
+
* (`config.deps_retired_key`), the peer presence, the restore selector, the microCompact knob, the prompt selectors, `resumeAt` on a resume
|
|
2118
|
+
* (`resume_at.conflicts_resume`, `resume_at.mode_without_target` — a resume carrying `resumeAt` is refused as a conflict before its mode is
|
|
2119
|
+
* read, so `resume_at.invalid_mode` is a fresh run's word only), the containment faces, the add-only seats and the MCP / A2A `toolAxes` (`config.invalid_argument`), the three memory seats,
|
|
2120
|
+
* the auto-consolidation arming (its role key too, and the role seats and tier bindings it reads: `config.unknown_role`, `detail.reason` naming the arm), the materialize strategy and persistence flag, the lock layer (`config.locked_registry`,
|
|
2121
|
+
* `config.locked_key`), an MCP server's content class, the skills-listing seats (`config.skill_listing_budget_invalid`), the limits and the
|
|
2122
|
+
* resource-suspend knobs, the attachment modes, the governance windows, the brain-call guardrail and the retention declaration over the stores the leg
|
|
2123
|
+
* would run on (`config.retention_policy`, `config.retention_capability`), and the checkpoint store seat itself (`config.invalid_checkpoint_store`: the
|
|
2124
|
+
* retired `null` spelling, a store that declares no execution outcome), and the skills seat and the hands band (`config.invalid_argument`;
|
|
2125
|
+
* a skill's `baseDir` by its own reader, `config.skill_base_dir_invalid`). A door not entered here (the leg's model, its rebuilt
|
|
2126
|
+
* roster, its answer face, the approval seat's value) still refuses after the claim, each for a stated reason (INTEGRATION-CORE, "A resume's two doors").
|
|
2096
2127
|
*/
|
|
2097
|
-
export declare const CHECKPOINT_CONFIG_REFUSAL_CODES: readonly ["config.spec_retired_key", "config.output_style_invalid", "config.permission_mode_invalid", "config.shell_gate_value_retired", "config.approval_reach_invalid", "config.user_invoked_skill_unknown", "config.skill_deny_unreadable", "config.user_attachment_invalid"];
|
|
2128
|
+
export declare const CHECKPOINT_CONFIG_REFUSAL_CODES: readonly ["config.spec_retired_key", "config.output_style_invalid", "config.permission_mode_invalid", "config.shell_gate_value_retired", "config.approval_reach_invalid", "config.user_invoked_skill_unknown", "config.skill_deny_unreadable", "config.user_attachment_invalid", "config.tool_face_control", "config.deps_retired_key", "config.peer_presence_invalid", "config.tool_model_gate_invalid", "config.microcompact_invalid", "config.prompt_selector_invalid", "resume_at.conflicts_resume", "resume_at.mode_without_target", "config.read_face_invalid", "config.write_face_invalid", "config.invalid_argument", "config.memory_delegation_evidence", "config.memory_provenance", "config.memory_capture_policy", "config.auto_consolidation", "config.unknown_role", "config.tool_materialize_invalid", "config.memory_persistence_invalid", "config.tool_materialize_unreachable", "config.locked_registry", "config.locked_key", "config.mcp_content_class", "config.skill_listing_budget_invalid", "config.limit_unknown_key", "config.limit_invalid", "config.attachment_invalid", "config.usage_window_invalid", "config.brain_call_guardrail_invalid", "config.retention_policy", "config.retention_capability", "config.invalid_checkpoint_store", "config.skill_base_dir_invalid"];
|
|
2098
2129
|
export type CheckpointConfigRefusalCode = (typeof CHECKPOINT_CONFIG_REFUSAL_CODES)[number];
|
|
2099
2130
|
export declare const isCheckpointConfigRefusalCode: (word: unknown) => word is CheckpointConfigRefusalCode;
|
|
2100
2131
|
/** A typed checkpoint-store error so callers branch on `code` (mirrors `SessionError`). */
|
|
@@ -2204,9 +2235,10 @@ export declare class CheckpointError extends Error {
|
|
|
2204
2235
|
/** Parent effective-policy inheritance (shape check): the resume DID re-supply
|
|
2205
2236
|
* `internals.inheritedGate.parentConstraints`, but its length differs from the checkpoint's recorded
|
|
2206
2237
|
* `parentConstraintCount` — or (F-012 L1) its projection CONTENT digests differently from the
|
|
2207
|
-
* recorded `constraintDigest` — a
|
|
2208
|
-
*
|
|
2209
|
-
*
|
|
2238
|
+
* recorded `constraintDigest` — or a screening entry names a `tool.check` guard beside a policy the
|
|
2239
|
+
* constraint mint did not make (no chain to raise it on) — a partial/mismatched re-supply would silently run
|
|
2240
|
+
* the child under a thinner (or different) ancestor chain than it suspended with. Rejected pre-CAS (the
|
|
2241
|
+
* checkpoint stays `pending`); re-resume with the full original chain. */
|
|
2210
2242
|
| "resume.parent_constraint_mismatch"
|
|
2211
2243
|
/** #449 G1 (codex r2, pre-CAS entrance): a deployment usage-governance window for this resume's
|
|
2212
2244
|
* ledger key (the config's principal, else the row's recorded one, else the shared bucket) is
|
|
@@ -2272,13 +2304,13 @@ export declare class CheckpointError extends Error {
|
|
|
2272
2304
|
* resolve, or try to supply the minted record), or — design/252 G-7 — `"approver"` (the attribution is not a
|
|
2273
2305
|
* well-formed identifier: re-decide with a plain, bounded, control-character-free string, or omit
|
|
2274
2306
|
* it). On a `checkpoint.config_refused` `field` names which INPUT carries the refusal — `"taskConfig"`
|
|
2275
|
-
* (the re-supplied config: correct it and resume the same token)
|
|
2276
|
-
*
|
|
2307
|
+
* (the re-supplied config: correct it and resume the same token), `"deps"` (the deployment's own seat — and the policies the
|
|
2308
|
+
* caller re-supplies as inherited constraints: correct them and resume the same token) or `"inheritedGate"` (the row's record: no config reaches it; expire the row). The throw
|
|
2277
2309
|
* sites always knew which arm fired; this carries that fact instead of dropping it (ruled
|
|
2278
2310
|
* 2026-08-03, cross-repo HITL discussion). Additive and optional — `code` remains the only REQUIRED
|
|
2279
2311
|
* discriminant. */
|
|
2280
2312
|
readonly detail?: {
|
|
2281
|
-
field?: "boundCallId" | "boundInputHash" | "boundGrantDigest" | "answer" | "hostDecision" | "approver" | "taskConfig" | "inheritedGate";
|
|
2313
|
+
field?: "boundCallId" | "boundInputHash" | "boundGrantDigest" | "answer" | "hostDecision" | "approver" | "taskConfig" | "deps" | "inheritedGate";
|
|
2282
2314
|
/** On `checkpoint.config_refused` — prepare's own code for the refusal ({@link CheckpointConfigRefusalCode}), the
|
|
2283
2315
|
* word a fresh run of the same bad config reports as its `errorCode`. Absent on every other code. */
|
|
2284
2316
|
code?: CheckpointConfigRefusalCode;
|
|
@@ -2406,9 +2438,10 @@ export declare class CheckpointError extends Error {
|
|
|
2406
2438
|
/** Parent effective-policy inheritance (shape check): the resume DID re-supply
|
|
2407
2439
|
* `internals.inheritedGate.parentConstraints`, but its length differs from the checkpoint's recorded
|
|
2408
2440
|
* `parentConstraintCount` — or (F-012 L1) its projection CONTENT digests differently from the
|
|
2409
|
-
* recorded `constraintDigest` — a
|
|
2410
|
-
*
|
|
2411
|
-
*
|
|
2441
|
+
* recorded `constraintDigest` — or a screening entry names a `tool.check` guard beside a policy the
|
|
2442
|
+
* constraint mint did not make (no chain to raise it on) — a partial/mismatched re-supply would silently run
|
|
2443
|
+
* the child under a thinner (or different) ancestor chain than it suspended with. Rejected pre-CAS (the
|
|
2444
|
+
* checkpoint stays `pending`); re-resume with the full original chain. */
|
|
2412
2445
|
| "resume.parent_constraint_mismatch"
|
|
2413
2446
|
/** #449 G1 (codex r2, pre-CAS entrance): a deployment usage-governance window for this resume's
|
|
2414
2447
|
* ledger key (the config's principal, else the row's recorded one, else the shared bucket) is
|
|
@@ -2474,13 +2507,13 @@ export declare class CheckpointError extends Error {
|
|
|
2474
2507
|
* resolve, or try to supply the minted record), or — design/252 G-7 — `"approver"` (the attribution is not a
|
|
2475
2508
|
* well-formed identifier: re-decide with a plain, bounded, control-character-free string, or omit
|
|
2476
2509
|
* it). On a `checkpoint.config_refused` `field` names which INPUT carries the refusal — `"taskConfig"`
|
|
2477
|
-
* (the re-supplied config: correct it and resume the same token)
|
|
2478
|
-
*
|
|
2510
|
+
* (the re-supplied config: correct it and resume the same token), `"deps"` (the deployment's own seat — and the policies the
|
|
2511
|
+
* caller re-supplies as inherited constraints: correct them and resume the same token) or `"inheritedGate"` (the row's record: no config reaches it; expire the row). The throw
|
|
2479
2512
|
* sites always knew which arm fired; this carries that fact instead of dropping it (ruled
|
|
2480
2513
|
* 2026-08-03, cross-repo HITL discussion). Additive and optional — `code` remains the only REQUIRED
|
|
2481
2514
|
* discriminant. */
|
|
2482
2515
|
detail?: {
|
|
2483
|
-
field?: "boundCallId" | "boundInputHash" | "boundGrantDigest" | "answer" | "hostDecision" | "approver" | "taskConfig" | "inheritedGate";
|
|
2516
|
+
field?: "boundCallId" | "boundInputHash" | "boundGrantDigest" | "answer" | "hostDecision" | "approver" | "taskConfig" | "deps" | "inheritedGate";
|
|
2484
2517
|
/** On `checkpoint.config_refused` — prepare's own code for the refusal ({@link CheckpointConfigRefusalCode}), the
|
|
2485
2518
|
* word a fresh run of the same bad config reports as its `errorCode`. Absent on every other code. */
|
|
2486
2519
|
code?: CheckpointConfigRefusalCode;
|
|
@@ -305,7 +305,7 @@ export function summarizeCheckpoint(cp) {
|
|
|
305
305
|
...(hasBidi ? { hasBidiControls: true } : {}),
|
|
306
306
|
};
|
|
307
307
|
}
|
|
308
|
-
export const CHECKPOINT_CONFIG_REFUSAL_CODES = Object.freeze(["config.spec_retired_key", "config.output_style_invalid", "config.permission_mode_invalid", "config.shell_gate_value_retired", "config.approval_reach_invalid", "config.user_invoked_skill_unknown", "config.skill_deny_unreadable", "config.user_attachment_invalid"]);
|
|
308
|
+
export const CHECKPOINT_CONFIG_REFUSAL_CODES = Object.freeze(["config.spec_retired_key", "config.output_style_invalid", "config.permission_mode_invalid", "config.shell_gate_value_retired", "config.approval_reach_invalid", "config.user_invoked_skill_unknown", "config.skill_deny_unreadable", "config.user_attachment_invalid", "config.tool_face_control", "config.deps_retired_key", "config.peer_presence_invalid", "config.tool_model_gate_invalid", "config.microcompact_invalid", "config.prompt_selector_invalid", "resume_at.conflicts_resume", "resume_at.mode_without_target", "config.read_face_invalid", "config.write_face_invalid", "config.invalid_argument", "config.memory_delegation_evidence", "config.memory_provenance", "config.memory_capture_policy", "config.auto_consolidation", "config.unknown_role", "config.tool_materialize_invalid", "config.memory_persistence_invalid", "config.tool_materialize_unreachable", "config.locked_registry", "config.locked_key", "config.mcp_content_class", "config.skill_listing_budget_invalid", "config.limit_unknown_key", "config.limit_invalid", "config.attachment_invalid", "config.usage_window_invalid", "config.brain_call_guardrail_invalid", "config.retention_policy", "config.retention_capability", "config.invalid_checkpoint_store", "config.skill_base_dir_invalid"]);
|
|
309
309
|
export const isCheckpointConfigRefusalCode = (word) => CHECKPOINT_CONFIG_REFUSAL_CODES.some((w) => w === word);
|
|
310
310
|
export class CheckpointError extends Error {
|
|
311
311
|
code;
|
|
@@ -399,13 +399,13 @@ export function resolveCheckpointStore(spec, deps) {
|
|
|
399
399
|
throw checkpointStoreExecutionUndeclared("TaskSpec.checkpointStore", spec.checkpointStore);
|
|
400
400
|
return spec.checkpointStore;
|
|
401
401
|
}
|
|
402
|
-
if (deps.checkpointStore !== undefined && deps.checkpointStore
|
|
402
|
+
if (deps.checkpointStore !== undefined && deps.checkpointStore?.execution?.outcome !== true) {
|
|
403
403
|
throw checkpointStoreExecutionUndeclared("RunnerDeps.checkpointStore", deps.checkpointStore);
|
|
404
404
|
}
|
|
405
405
|
return deps.checkpointStore;
|
|
406
406
|
}
|
|
407
407
|
export function checkpointStoreExecutionUndeclared(seat, store) {
|
|
408
|
-
const ctor = store
|
|
408
|
+
const ctor = store?.constructor?.name;
|
|
409
409
|
const name = typeof ctor === "string" && ctor.length > 0 && ctor !== "Object" ? ` (${ctor})` : "";
|
|
410
410
|
const e = new Error(`${seat}: the wired CheckpointStore${name} does not declare \`execution = { outcome: true }\` — the execution-outcome ` +
|
|
411
411
|
"record (recordExecutionOutcome, and reopen refusing a recorded row) is a required member of the store contract; " +
|