@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
|
@@ -26,7 +26,7 @@ import type { AutoModeClassifierRound } from "../auto-mode.js";
|
|
|
26
26
|
import { type Arbitration, type AskClassification, type AskFace, type AskOrigin, type AskOriginFacts } from "../ask-origin.js";
|
|
27
27
|
import { type PermissionResult, type ResolvedAsk, type ToolCallRequest } from "../tool-policy.js";
|
|
28
28
|
import type { SafeNotifier } from "../safe-notify.js";
|
|
29
|
-
import type {
|
|
29
|
+
import type { PermissionDeniedPayload, PreToolUseResult, ToolGateInput, ToolGateResult } from "../hooks.js";
|
|
30
30
|
/** The ask a gate pass settled, as the gate captured it at its resolution site: the settlement the
|
|
31
31
|
* resolver composed and the origin word the ask carried. Both or neither (invariant I1). `licensed` is the engine record's
|
|
32
32
|
* digest of the bytes the settlement licensed: the allow exit keeps a settlement only for the bytes that run. */
|
|
@@ -126,32 +126,31 @@ export declare function cloneObserverInput(input: unknown): unknown;
|
|
|
126
126
|
* freeze the call's input under the tool.
|
|
127
127
|
*/
|
|
128
128
|
export declare function frozenInputSnapshot(input: unknown): unknown;
|
|
129
|
+
/** What one `classic.PreToolUse` screening came to: an answer the receipt took (`undefined` = no opinion), or the
|
|
130
|
+
* engine's fail-closed refusal of the call with its sentence (a handler that failed or broke the site's contract,
|
|
131
|
+
* or a cancel). */
|
|
132
|
+
/** A screen's outcome; an answer names the registration whose answer the chain returned (`answeredBy`, absent when no
|
|
133
|
+
* handler spoke). */
|
|
134
|
+
export type PreToolUseScreen = {
|
|
135
|
+
readonly kind: "answered";
|
|
136
|
+
readonly answer: PreToolUseResult | undefined;
|
|
137
|
+
readonly answeredBy?: string;
|
|
138
|
+
} | {
|
|
139
|
+
readonly kind: "refused";
|
|
140
|
+
readonly reason: string;
|
|
141
|
+
};
|
|
129
142
|
/**
|
|
130
|
-
* The PreToolUse screening face as the gate's stations see it —
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
* a `preToolUse` face is wired.
|
|
143
|
+
* The PreToolUse screening face as the gate's stations see it — `classic.PreToolUse` raised on the leg's bus, the
|
|
144
|
+
* per-screening e, the answer receipt and the fail-closed sentences behind one method, so the approved-edit re-screen
|
|
145
|
+
* in the lanes runs the SAME screening the phase-1 pass ran. Present on the pass exactly when a handler hangs on the
|
|
146
|
+
* event (an observe handler runs inside the screening too; it never decides).
|
|
135
147
|
*/
|
|
136
148
|
export interface PreToolUseScreening {
|
|
137
|
-
/**
|
|
138
|
-
*
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
* seat runner's own; a wrapper that screened the answer inside a second `async` cost one more tick there. An
|
|
142
|
-
* expired seat is reported, not thrown; a crashing face rejects. */
|
|
143
|
-
screen(args: unknown): Promise<HookSeatOutcome<PreToolUseResult | undefined>>;
|
|
144
|
-
/** The result screen over an answered seat's value: an out-of-contract decision becomes the ordinary hook deny. */
|
|
145
|
-
screened(answer: PreToolUseResult | undefined): PreToolUseResult | undefined;
|
|
146
|
-
/** The model-facing text for a face that THREW while screening `subject`. */
|
|
147
|
-
crashReason(subject: string, err: unknown): string;
|
|
148
|
-
/** The model-facing text for a face that never ANSWERED while screening `subject` (the timeout arm also
|
|
149
|
-
* reports on the deployment lane; a task-abort expiry does not). */
|
|
150
|
-
unansweredReason(subject: string, cause: "timeout" | "aborted"): Promise<string>;
|
|
151
|
-
/** The model-facing text for the face's OWN deny of this call (unwrapped; every exit wraps it with the leg's mark). */
|
|
149
|
+
/** Raise `classic.PreToolUse` over `args`; `subject` names what is screened in a fail-closed sentence. What the gate
|
|
150
|
+
* does after the screen answers runs in the screen's own continuation. */
|
|
151
|
+
screen(args: unknown, subject: string): Promise<PreToolUseScreen>;
|
|
152
|
+
/** The model-facing text for the screen's OWN deny of this call (unwrapped; every exit wraps it with the leg's mark). */
|
|
152
153
|
deniedReason(answer: PreToolUseResult): string;
|
|
153
|
-
/** The model-facing text for an answer the decision receipt refused (an ENGINE fail-closed, not the face's deny). */
|
|
154
|
-
refusedReason(answer: PreToolUseResult): string;
|
|
155
154
|
}
|
|
156
155
|
/** The FACE a pass's questions are put on ({@link askFaceOf} of the call's wire name) — the one reading of it the
|
|
157
156
|
* write-protection tighten (the fold) and every class derivation (the lanes) make. */
|
|
@@ -198,9 +197,9 @@ export interface GatePass {
|
|
|
198
197
|
readonly ledger: SettlementLedger;
|
|
199
198
|
/** borrowed-readonly — the ONE emission seat of the deny observer for this pass, bounded and contained like
|
|
200
199
|
* every other seat (the hook machinery owns the seat runner; the exits call this). */
|
|
201
|
-
readonly notifyPermissionDenied: (payload:
|
|
202
|
-
/** borrowed-readonly — the PreToolUse screening face ({@link PreToolUseScreening}), or undefined when no
|
|
203
|
-
* `
|
|
200
|
+
readonly notifyPermissionDenied: (payload: PermissionDeniedPayload) => Promise<void>;
|
|
201
|
+
/** borrowed-readonly — the PreToolUse screening face ({@link PreToolUseScreening}), or undefined when no handler hangs
|
|
202
|
+
* on `classic.PreToolUse` (the edit chain then re-screens nothing). */
|
|
204
203
|
readonly screening: PreToolUseScreening | undefined;
|
|
205
204
|
/** borrowed-readonly — the station group that runs AFTER the fold (the lanes: org layer, rule lane, classifier,
|
|
206
205
|
* parks, resolution, edit chain, and the exit they end in), handed the pass by the fold's LAST station on the
|
|
@@ -212,14 +211,14 @@ export interface GatePass {
|
|
|
212
211
|
* behind the policy's answer could not land in between. Returns the gate result (a park's suspension or the
|
|
213
212
|
* exit's record). Writer: the dispatch (`runToolGate`, which wires `runGateLanes`). Reader: the fold's tail. */
|
|
214
213
|
readonly afterFold: (pass: GatePass) => Promise<ToolGateResult>;
|
|
215
|
-
/** borrowed-mutable — the FINAL args
|
|
216
|
-
*
|
|
214
|
+
/** borrowed-mutable — the FINAL args, always the pass's own immutable value (`ownArgs`): the model's input as taken at
|
|
215
|
+
* the entry, rewritten by the phase-1 hook, by the policy rewrite on the ask path and by the exits' rewrite fold.
|
|
217
216
|
* Writers: the dispatch (phase 1), the lanes, the exits. */
|
|
218
217
|
currentInput: unknown;
|
|
219
|
-
/** borrowed-mutable — the adjudication request. Minted over the
|
|
218
|
+
/** borrowed-mutable — the adjudication request. Minted over the pass's args so the record is whole from
|
|
220
219
|
* the first station, and RE-MINTED by the adjudication station over the FINAL post-screen args (the
|
|
221
|
-
* pre-existing `const req` site); `args` is re-pointed at the policy rewrite on the ask path
|
|
222
|
-
*
|
|
220
|
+
* pre-existing `const req` site); `args` is re-pointed at the policy rewrite on the ask path. Writers: the
|
|
221
|
+
* fold (mint), the lanes (`args`). */
|
|
223
222
|
req: ToolCallRequest;
|
|
224
223
|
/** borrowed-mutable — the PreToolUse `additionalContext` collected for this call (pushed into; the binding
|
|
225
224
|
* is fixed). Writers: the dispatch (phase 1), the lanes (sandbox admission note, the edit re-screen). */
|
|
@@ -231,10 +230,14 @@ export interface GatePass {
|
|
|
231
230
|
hookAsk: Extract<PermissionResult, {
|
|
232
231
|
action: "ask";
|
|
233
232
|
}> | undefined;
|
|
234
|
-
/** borrowed-mutable — the phase-1
|
|
235
|
-
* speaks only while no policy rewrote the arguments after the
|
|
236
|
-
* lanes' allow layer (its one reader). */
|
|
237
|
-
|
|
233
|
+
/** borrowed-mutable — the phase-1 screen answered its own `allow` (the exact word), naming the registration that answered
|
|
234
|
+
* it: the allow layer's hook member (its `entries`), which speaks only while no policy rewrote the arguments after the
|
|
235
|
+
* screen saw them. Writer: the dispatch (phase 1). Reader: the lanes' allow layer (its one reader). */
|
|
236
|
+
hookAllowedBy?: readonly string[];
|
|
237
|
+
/** borrowed-mutable — `tool.check` was raised in this pass's first adjudication, which raises it once: set by the
|
|
238
|
+
* raise in front of the ask branch, read by the raise behind the read-only arm (it then raises nothing). Writer and
|
|
239
|
+
* reader: the lanes. */
|
|
240
|
+
toolCheckRaised?: true;
|
|
238
241
|
/** borrowed-mutable — set by a park attempt that FAILED (see `ParkAttemptFailed`). Read at the single deny
|
|
239
242
|
* exit — whatever the fallback chain then decides to say, it says it knowing the park was tried first.
|
|
240
243
|
* Writers: the three park sites. */
|
|
@@ -335,8 +338,16 @@ export interface GatePass {
|
|
|
335
338
|
* deployment's only evidence of a broken hook is a tool that mysteriously stops working.
|
|
336
339
|
*/
|
|
337
340
|
export declare function engineFailClosedExit(pass: GatePass, reason: string): Promise<ToolGateResult>;
|
|
341
|
+
/** The refusal sentence for args the gate could not take into its own copy (`ownArgs` refused them), naming what. */
|
|
342
|
+
export declare const unownedArgsMessage: (subject: string, reason: string) => string;
|
|
343
|
+
/**
|
|
344
|
+
* The model's args could not be taken into the pass's own copy (a function, a shared buffer, a typed array): nobody judged
|
|
345
|
+
* them, so nothing may run them. The single deny exit (the observer fires), in the policy layer's word — the value is the
|
|
346
|
+
* deployment's own (a host driving the gate; the runner's calls are always clonable).
|
|
347
|
+
*/
|
|
348
|
+
export declare function unownedArgsExit(pass: GatePass, reason: string): Promise<ToolGateResult>;
|
|
338
349
|
/** The hook's OWN deny in phase 1. A PreToolUse hook deny does NOT fire `permissionDenied`
|
|
339
|
-
* (the exclusion recorded on `
|
|
350
|
+
* (the exclusion recorded on `PermissionDeniedPayload`) — this return stays observer-free. */
|
|
340
351
|
export declare function hookDenyExit(pass: GatePass, deniedReason: string): ToolGateResult;
|
|
341
352
|
/**
|
|
342
353
|
* The exit of the adjudicate chain — the pass has a standing `deny` or `allow` (every ask was resolved or
|
|
@@ -5,6 +5,7 @@ import { isProtectedWrite } from "../tool-registry.js";
|
|
|
5
5
|
import { attestationOf, decisionText } from "../tool-policy.js";
|
|
6
6
|
import { pathDenialCardOf } from "../../tools/fs/safety.js";
|
|
7
7
|
import { boundInputHashOf } from "../canonical-json.js";
|
|
8
|
+
import { argsAsTheToolReads, argsReadFrom } from "../effective-path-target.js";
|
|
8
9
|
import { askUnresolvableRemedySeat } from "../ask-unresolvable-notice.js";
|
|
9
10
|
import { inlineUntrusted } from "../untrusted-text.js";
|
|
10
11
|
import { formatHookFeedback } from "../reminder-mint.js";
|
|
@@ -127,7 +128,7 @@ export function createSettlementLedger(call) {
|
|
|
127
128
|
return { decision, deniedBy: refusal ? "ask_resolution" : "policy" };
|
|
128
129
|
},
|
|
129
130
|
keepForBytes(runs) {
|
|
130
|
-
if (settled !== undefined && settled.licensed !== boundInputHashOf(runs))
|
|
131
|
+
if (settled !== undefined && settled.licensed !== boundInputHashOf(runs) && settled.licensed !== boundInputHashOf(argsReadFrom(runs)))
|
|
131
132
|
settled = undefined;
|
|
132
133
|
},
|
|
133
134
|
causeOf(decision) {
|
|
@@ -190,6 +191,12 @@ export async function engineFailClosedExit(pass, reason) {
|
|
|
190
191
|
await notifyPermissionDenied({ toolName, input: cloneObserverInput(finalInput), toolCallId, reason, gate, ...(input.identity !== undefined ? { identity: input.identity } : {}) });
|
|
191
192
|
return { block: true, reason: formatHookFeedback(reason, input.reminderMark), gate, finalInput, preToolContext: pass.preToolContext };
|
|
192
193
|
}
|
|
194
|
+
export const unownedArgsMessage = (subject, reason) => `${subject} could not be taken into the gate's own copy (${reason}) — denied fail-closed`;
|
|
195
|
+
export async function unownedArgsExit(pass, reason) {
|
|
196
|
+
pass.decision = { action: "deny", message: unownedArgsMessage(`the arguments of "${pass.toolName}"`, reason) };
|
|
197
|
+
pass.deniedBy = "policy";
|
|
198
|
+
return await exitGate(pass);
|
|
199
|
+
}
|
|
193
200
|
export function hookDenyExit(pass, deniedReason) {
|
|
194
201
|
const { input } = pass;
|
|
195
202
|
return {
|
|
@@ -211,10 +218,10 @@ function unresolvableCauseOfSettlement(gate) {
|
|
|
211
218
|
return undefined;
|
|
212
219
|
}
|
|
213
220
|
export async function exitGate(pass) {
|
|
214
|
-
const { input,
|
|
221
|
+
const { input, toolName, toolCallId, ledger, notifyPermissionDenied } = pass;
|
|
215
222
|
if (pass.decision.action === "deny") {
|
|
216
223
|
if (pass.decision.updatedInput !== undefined) {
|
|
217
|
-
pass.currentInput = pass.decision.updatedInput;
|
|
224
|
+
pass.currentInput = argsAsTheToolReads(pass.req, pass.decision.updatedInput);
|
|
218
225
|
}
|
|
219
226
|
if (pass.deniedBy === undefined)
|
|
220
227
|
throw new Error(`the tool gate refused "${toolName}" without a refusing layer — every deny site attributes itself`);
|
|
@@ -259,13 +266,13 @@ export async function exitGate(pass) {
|
|
|
259
266
|
if (pass.decision.action === "allow") {
|
|
260
267
|
const rw = pass.decision.updatedInput !== undefined ? pass.decision.updatedInput : pass.policyRewrite;
|
|
261
268
|
if (rw !== undefined)
|
|
262
|
-
pass.currentInput = rw;
|
|
269
|
+
pass.currentInput = argsAsTheToolReads(pass.req, rw);
|
|
263
270
|
}
|
|
264
271
|
ledger.keepForBytes(pass.currentInput);
|
|
265
272
|
const release = pass.arbitration?.kind === "released" ? pass.arbitration : (() => { if (ledger.settled !== undefined)
|
|
266
273
|
return undefined; const a = pass.arbitration === undefined ? input.ancestorArbitrationOf?.(toolCallId) : undefined; return a?.kind === "released" ? a : undefined; })();
|
|
267
274
|
return {
|
|
268
|
-
updatedInput: pass.currentInput
|
|
275
|
+
updatedInput: pass.currentInput,
|
|
269
276
|
gate: mintGateOutcome({ ...(ledger.settled !== undefined ? { settled: ledger.settled } : {}), ...(pass.classifierRound !== undefined ? { classifier: pass.classifierRound } : {}), ...(release !== undefined ? { released: releaseRecordOf(release) } : {}) }),
|
|
270
277
|
finalInput: frozenInputSnapshot(pass.currentInput),
|
|
271
278
|
preToolContext: pass.preToolContext,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { isIP } from "node:net";
|
|
2
|
-
import { imageMagicMatches } from "
|
|
3
|
-
import { ADMITTED_IMAGE_MIME_TYPES } from "../../tools/fs/image-admission.js";
|
|
2
|
+
import { ADMITTED_IMAGE_MIME_TYPES, imageMagicMatches } from "../image-admission.js";
|
|
4
3
|
import { admitInlineImage } from "./inline-image.js";
|
|
5
4
|
function sniffImageMime(bytes) {
|
|
6
5
|
return ADMITTED_IMAGE_MIME_TYPES.find((mime) => imageMagicMatches(bytes, mime));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { admitImageBytes, ADMITTED_IMAGE_MIME_TYPES } from "
|
|
1
|
+
import { admitImageBytes, ADMITTED_IMAGE_MIME_TYPES } from "../image-admission.js";
|
|
2
2
|
import { MCP_IMAGE_MAX_BASE64 } from "../image-downsample.js";
|
|
3
3
|
function inlineImageRefusal(detail) {
|
|
4
4
|
const e = new Error(`TaskSpec.images: ${detail}`);
|
|
@@ -15,22 +15,28 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import type { AgentTool } from "../../internal/harness.js";
|
|
17
17
|
import type { McpDroppedTool, McpReconnectResult, MaterializedMcp, McpToolAxis } from "../mcp.js";
|
|
18
|
-
import type { RunnerDeps, ToolEffect } from "../types.js";
|
|
18
|
+
import type { RunnerDeps, TaskSpec, ToolEffect } from "../types.js";
|
|
19
19
|
import type { IrreversibilityTier, ToolFaceSnapshot } from "./contracts.js";
|
|
20
20
|
import type { RosterBuilder, ToolRosterDeltaSeat } from "../tool-roster.js";
|
|
21
|
+
import type { McpInstructionsEntry } from "../prompt-section-seat.js";
|
|
21
22
|
/** One server's assertion about its own prefix domain — the shape both faces reduce to. `tools` is
|
|
22
23
|
* the roster the domain must END UP with (empty withdraws it); `added`/`removed` are the reporting
|
|
23
|
-
* half and never drive the swap.
|
|
24
|
+
* half and never drive the swap. `instructions`: the server's current connection's instructions entry, when the face that produced
|
|
25
|
+
* the delta hands it back (a refresh does; a re-dial queues its new text itself). */
|
|
24
26
|
export interface McpRosterDelta {
|
|
25
27
|
server: string;
|
|
26
28
|
prefix: string;
|
|
27
29
|
tools: AgentTool[];
|
|
28
30
|
axes: McpToolAxis[];
|
|
29
31
|
dropped: McpDroppedTool[];
|
|
32
|
+
instructions?: McpInstructionsEntry;
|
|
30
33
|
}
|
|
31
34
|
/** The seats a roster application writes through. Every one of them is borrowed from the phase that
|
|
32
35
|
* minted it — this module owns nothing. */
|
|
33
36
|
export interface McpRosterApplyInput {
|
|
37
|
+
/** borrowed-readonly — the run's spec; only `excludeAllTools` is read: the valve's whole-face switch decides what a live roster
|
|
38
|
+
* change may mount, beside the selector (`valveLeaves`). */
|
|
39
|
+
spec: Pick<TaskSpec, "excludeAllTools">;
|
|
34
40
|
/** borrowed-readonly — the frozen tool face; its selector keeps a tool the leg may not use from ever
|
|
35
41
|
* being mounted by a face the model or a host can trigger. */
|
|
36
42
|
toolFaceSnapshot: Pick<ToolFaceSnapshot, "selector">;
|
|
@@ -48,20 +54,53 @@ export interface McpRosterApplyInput {
|
|
|
48
54
|
}>;
|
|
49
55
|
/** borrowed-mutable — the run's shared roster. */
|
|
50
56
|
roster: RosterBuilder;
|
|
57
|
+
/** borrowed-readonly — the run's frozen MCP server declarations: a roster reading is of a declared server, and a name none is declared under holds nothing. */
|
|
58
|
+
declared: ReadonlyArray<{
|
|
59
|
+
readonly name: string;
|
|
60
|
+
}>;
|
|
61
|
+
/** borrowed-mutable — the materialization's instructions delta lane; a roster change settles the server's adds on it. */
|
|
62
|
+
instructionsDelta: MaterializedMcp["instructionsDelta"];
|
|
63
|
+
}
|
|
64
|
+
/** What one application did to the server's domain on the roster — read off the roster before and after the swap, the ONE source of
|
|
65
|
+
* "how many of this server's tools are mounted" for the re-dial's notice and receipt and the refresh tool's receipt. A name the
|
|
66
|
+
* valve left out, a name the deployment's `toolFaces` overlay refused and a name the server listed but the roster did not take are
|
|
67
|
+
* all simply absent from `mounted`. */
|
|
68
|
+
export interface McpRosterReading {
|
|
69
|
+
/** The names of the server's tools the roster holds after the application, in wire order. */
|
|
70
|
+
mounted: string[];
|
|
71
|
+
/** The names `mounted` holds that the roster did not hold before. */
|
|
72
|
+
added: string[];
|
|
73
|
+
/** The names the roster held before that `mounted` no longer holds. */
|
|
74
|
+
removed: string[];
|
|
75
|
+
/** The names the server listed that the roster did not take (the valve's, the overlay's). */
|
|
76
|
+
excluded: string[];
|
|
51
77
|
}
|
|
52
78
|
/** What one application did, for the caller's receipt. `applied:false` means the axis fold refused
|
|
53
|
-
* and the domain was left exactly as it was (the tables restored) — no roster write happened. */
|
|
54
|
-
export type McpRosterApplyOutcome = {
|
|
79
|
+
* and the domain was left exactly as it was (the tables restored) — no roster write happened, so `mounted` is what it held. */
|
|
80
|
+
export type McpRosterApplyOutcome = ({
|
|
55
81
|
applied: true;
|
|
56
|
-
|
|
57
|
-
excluded: string[];
|
|
58
|
-
} | {
|
|
82
|
+
} & McpRosterReading) | ({
|
|
59
83
|
applied: false;
|
|
60
84
|
foldError: string;
|
|
61
|
-
};
|
|
85
|
+
} & McpRosterReading);
|
|
86
|
+
/** What the roster holds of one server with no swap made — the reading of an arm that asserted no roster (a failed refresh, a refused re-dial, a fold refusal).
|
|
87
|
+
* A name no server is declared under holds nothing, even when it mints a declared server's prefix. */
|
|
88
|
+
export declare function rosterHolding(input: Pick<McpRosterApplyInput, "roster" | "declared">, serverName: string): McpRosterReading;
|
|
89
|
+
/** A refresh or re-dial result read off the roster instead of the server's own listing: `toolCount` is the tools mounted, `added` /
|
|
90
|
+
* `removed` the names that came onto / left the roster, and — on a result that asserts a roster — `tools` the roster's tools of the
|
|
91
|
+
* server (with `axes` cut to them), so `toolCount === tools.length`. One meaning, the one `MaterializedMcp.refresh` / `reconnect` give
|
|
92
|
+
* for their own handles. */
|
|
93
|
+
export declare function settledOnRoster<T extends {
|
|
94
|
+
toolCount: number;
|
|
95
|
+
added: string[];
|
|
96
|
+
removed: string[];
|
|
97
|
+
tools?: AgentTool[];
|
|
98
|
+
axes?: McpToolAxis[];
|
|
99
|
+
}>(result: T, reading: McpRosterReading, roster: Pick<RosterBuilder, "tools">): T;
|
|
62
100
|
/**
|
|
63
|
-
* Apply one server's delta to the live roster
|
|
64
|
-
*
|
|
101
|
+
* Apply one server's delta to the live roster, and settle the server's instruction adds on the delta lane: the teaching answer over the
|
|
102
|
+
* roster after the swap, against the lane's ledger of what the model holds (both faces — the model's refresh and the host's re-dial —
|
|
103
|
+
* through this one step).
|
|
65
104
|
*/
|
|
66
105
|
export declare function applyMcpRosterDelta(input: McpRosterApplyInput, delta: McpRosterDelta): McpRosterApplyOutcome;
|
|
67
106
|
/** The seats the post-application commit writes through. */
|
|
@@ -105,5 +144,8 @@ export interface McpRedialInput extends McpRosterApplyInput, McpRosterCommitInpu
|
|
|
105
144
|
* leave the model holding tools that can only fail), and an arm that never touched the connection —
|
|
106
145
|
* unknown name, revoked server, re-dial already in flight, disposed materialization — asserts nothing
|
|
107
146
|
* and the mounted roster is left alone.
|
|
147
|
+
*
|
|
148
|
+
* The result it hands back counts what the ROSTER took: `toolCount` is the server's tools mounted after the swap, `added` /
|
|
149
|
+
* `removed` the names that came onto / left the roster, and the notice reads the same three — one source for "how many are mounted".
|
|
108
150
|
*/
|
|
109
151
|
export declare function redialMcpServer(input: McpRedialInput, server: string): Promise<McpReconnectResult>;
|
|
@@ -1,9 +1,31 @@
|
|
|
1
|
+
import { valveLeaves } from "../../agents/tool-filter.js";
|
|
2
|
+
import { instructionsTaught, instructionsTold, tellInstructions, toolNamesOfServer, withdrawInstructionAdds } from "../mounted-mcp.js";
|
|
1
3
|
import { deliverEngineNotice } from "../types.js";
|
|
2
4
|
import { thrownText } from "../thrown-value.js";
|
|
5
|
+
export function rosterHolding(input, serverName) {
|
|
6
|
+
const mounted = input.declared.some((d) => d.name === serverName) ? toolNamesOfServer(input.roster.tools.map((t) => t.name), serverName) : [];
|
|
7
|
+
return { mounted, added: [], removed: [], excluded: [] };
|
|
8
|
+
}
|
|
9
|
+
export function settledOnRoster(result, reading, roster) {
|
|
10
|
+
const settled = { ...result, toolCount: reading.mounted.length, added: reading.added, removed: reading.removed };
|
|
11
|
+
if (result.tools === undefined)
|
|
12
|
+
return settled;
|
|
13
|
+
const held = new Set(reading.mounted);
|
|
14
|
+
return { ...settled, tools: roster.tools.filter((t) => held.has(t.name)), ...(result.axes !== undefined ? { axes: result.axes.filter((a) => held.has(a.name)) } : {}) };
|
|
15
|
+
}
|
|
16
|
+
function settleInstructions(lane, delta, taught) {
|
|
17
|
+
if (!taught)
|
|
18
|
+
return withdrawInstructionAdds(lane, delta.server);
|
|
19
|
+
if (delta.instructions !== undefined && !instructionsTold(lane, delta.server) && !lane.pendingAdds.some((e) => e.server === delta.server))
|
|
20
|
+
tellInstructions(lane, delta.instructions);
|
|
21
|
+
}
|
|
3
22
|
export function applyMcpRosterDelta(input, delta) {
|
|
4
|
-
const { toolFaceSnapshot, withFaces, remoteToolOffload, foldProtocolAxes, toolEffects, axisExplicitNegatives, roster } = input;
|
|
5
|
-
const
|
|
6
|
-
const
|
|
23
|
+
const { spec, toolFaceSnapshot, withFaces, remoteToolOffload, foldProtocolAxes, toolEffects, axisExplicitNegatives, roster } = input;
|
|
24
|
+
const domainNow = () => toolNamesOfServer(roster.tools.map((t) => t.name), delta.server);
|
|
25
|
+
const before = domainNow();
|
|
26
|
+
const leaves = valveLeaves(spec, toolFaceSnapshot.selector);
|
|
27
|
+
const pushable = delta.tools.filter(leaves);
|
|
28
|
+
const valveExcluded = delta.tools.filter((t) => !leaves(t)).map((t) => t.name);
|
|
7
29
|
const domainSnapshot = (m) => new Map([...m].filter(([name]) => name.startsWith(delta.prefix)));
|
|
8
30
|
const restoreDomain = (m, snap) => {
|
|
9
31
|
for (const name of [...m.keys()])
|
|
@@ -19,15 +41,20 @@ export function applyMcpRosterDelta(input, delta) {
|
|
|
19
41
|
for (const name of priorDomainNegatives.keys())
|
|
20
42
|
axisExplicitNegatives.delete(name);
|
|
21
43
|
try {
|
|
22
|
-
foldProtocolAxes(delta.axes.filter((a) => !
|
|
44
|
+
foldProtocolAxes(delta.axes.filter((a) => !valveExcluded.includes(a.name)), "MCP");
|
|
23
45
|
}
|
|
24
46
|
catch (foldErr) {
|
|
25
47
|
restoreDomain(toolEffects, priorDomainEffects);
|
|
26
48
|
restoreDomain(axisExplicitNegatives, priorDomainNegatives);
|
|
27
|
-
|
|
49
|
+
settleInstructions(input.instructionsDelta, delta, instructionsTaught(leaves, delta.server, roster.tools, delta.tools));
|
|
50
|
+
return { applied: false, foldError: thrownText(foldErr), ...rosterHolding(input, delta.server) };
|
|
28
51
|
}
|
|
29
52
|
roster.replaceDomain(delta.prefix, withFaces(pushable, delta.server).map((t) => remoteToolOffload(t)), { source: "mcp", mountedBy: "optional", origin: { peer: delta.server } });
|
|
30
|
-
|
|
53
|
+
const mounted = domainNow();
|
|
54
|
+
const heldNow = new Set(mounted);
|
|
55
|
+
const heldBefore = new Set(before);
|
|
56
|
+
settleInstructions(input.instructionsDelta, delta, instructionsTaught(leaves, delta.server, roster.tools, delta.tools));
|
|
57
|
+
return { applied: true, mounted, added: mounted.filter((n) => !heldBefore.has(n)), removed: before.filter((n) => !heldNow.has(n)), excluded: delta.tools.map((t) => t.name).filter((n) => !heldNow.has(n)) };
|
|
31
58
|
}
|
|
32
59
|
export async function commitMcpRosterChanges(input) {
|
|
33
60
|
await input.rebuildHarnessToolsRef.current?.();
|
|
@@ -38,9 +65,11 @@ export async function commitMcpRosterChanges(input) {
|
|
|
38
65
|
return undefined;
|
|
39
66
|
}
|
|
40
67
|
export async function redialMcpServer(input, server) {
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
68
|
+
const listed = await input.mcp.reconnect(server);
|
|
69
|
+
let result = settledOnRoster(listed, rosterHolding(input, listed.server), input.roster);
|
|
70
|
+
if (listed.tools !== undefined) {
|
|
71
|
+
const outcome = applyMcpRosterDelta(input, { server: listed.server, prefix: listed.prefix, tools: listed.tools, axes: listed.axes ?? [], dropped: listed.dropped ?? [] });
|
|
72
|
+
result = settledOnRoster(listed, outcome, input.roster);
|
|
44
73
|
if (!outcome.applied)
|
|
45
74
|
input.deps.onError?.(Object.assign(new Error(`MCP re-dial of "${server}" connected but its safety-axis fold refused, so its tools were not mounted: ${outcome.foldError}`), { code: "mcp.server_unavailable" }), { phase: "mcp", sessionId: input.sessionId });
|
|
46
75
|
const ungated = await commitMcpRosterChanges(input);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The input a once-per-run NOTICE SEAT takes: the run's notice sink and the two ids a notice is attributed to. One shape, defined
|
|
3
|
+
* once, below every seat that takes it (the extra-body strip account, the per-model credential-origin refusal account) — a seat
|
|
4
|
+
* importing a sibling seat's type was a sideways edge on a stratum that allows none.
|
|
5
|
+
*/
|
|
6
|
+
import type { EngineNotice } from "../engine-notice.js";
|
|
7
|
+
export interface NoticeSeatInput {
|
|
8
|
+
onNotice: ((notice: EngineNotice) => void) | undefined;
|
|
9
|
+
sessionId: string;
|
|
10
|
+
runId: string;
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -117,12 +117,15 @@ export interface PermissionRuleLanes {
|
|
|
117
117
|
} | undefined;
|
|
118
118
|
}
|
|
119
119
|
/** The ORG lane: the org's verdict about one call, off the store view `read` supplies — the gate's `orgRules` face over the
|
|
120
|
-
* call's pinned read ({@link createPermissionRuleLanes}), and {@link orgVerdictBeforeClaim} over a view of its own.
|
|
120
|
+
* call's pinned read ({@link createPermissionRuleLanes}), and {@link orgVerdictBeforeClaim} over a view of its own.
|
|
121
|
+
* `onDegraded` receives the snapshot's degraded line ({@link describeUnreadableOrgRows}) on every adjudication over a
|
|
122
|
+
* snapshot carrying a row this layer cannot read. */
|
|
121
123
|
export declare function orgRuleLane(cfg: {
|
|
122
124
|
read: (toolCallId: string) => Promise<Pick<EffectivePermissionRules, "org">>;
|
|
123
125
|
questionToolMounted: boolean;
|
|
124
126
|
questionToolName: string;
|
|
125
127
|
onRevisionDefect: (message: string) => void;
|
|
128
|
+
onDegraded: (message: string) => void;
|
|
126
129
|
}): NonNullable<PermissionRuleLanes["org"]>;
|
|
127
130
|
/** The org's CURRENT verdict about a parked call, read by the resume entry before the claim (the row's session and principal,
|
|
128
131
|
* bounded like the gate's wait; unreadable ⇒ unavailable). The mount and a revision defect are the resumed leg's facts, so
|
|
@@ -172,7 +175,7 @@ export declare function createPermissionRuleLanes(cfg: {
|
|
|
172
175
|
questionToolMounted: boolean;
|
|
173
176
|
questionToolName: string;
|
|
174
177
|
onRevisionDefect: (message: string) => void;
|
|
175
|
-
/** Sink for a judgment against the rows that threw. */
|
|
178
|
+
/** Sink for a judgment against the rows that threw, and for the org lane's degraded-snapshot line. */
|
|
176
179
|
onDisclosure: (message: string) => void;
|
|
177
180
|
/** The run's one reader of the person's rules: the call's ONE read, pinned, that the read station, the org lane and the
|
|
178
181
|
* personal lane all take (the lanes consume a reader; they do not make one). */
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { persistedRuleMandateOf, ruleClearanceOf } from "../ask-origin.js";
|
|
2
2
|
import {} from "../hooks.js";
|
|
3
|
-
import { adjudicatePersistedDomainRules, adjudicatePersistedNameRules, adjudicatePersistedPathRules, adjudicatePersistedRules, callPathFaceOf, domainRuleSubjectOf, faceRowsSpeakFor, laneToolNamesOf, nameRuleSubjectOf, ruleToolGrammarOf, segmentCoverageOf, suggestRuleForName, suggestRulesForCommand } from "../permission-rule-model.js";
|
|
3
|
+
import { adjudicatePersistedDomainRules, adjudicatePersistedNameRules, adjudicatePersistedPathRules, adjudicatePersistedRules, callPathFaceOf, domainRuleSubjectOf, escapeForDisclosure, faceRowsSpeakFor, laneToolNamesOf, nameRuleSubjectOf, ruleToolGrammarOf, segmentCoverageOf, suggestRuleForName, suggestRulesForCommand } from "../permission-rule-model.js";
|
|
4
4
|
import { callTargetViewsOf, validatePath } from "../effective-path-target.js";
|
|
5
5
|
import { bindPathRules, persistedRowAnchors, projectScopeIdentity } from "../path-rule-binding.js";
|
|
6
6
|
import { heldBy, seatOf, wireOf } from "../tool-name-readings.js";
|
|
7
|
-
import {
|
|
7
|
+
import { describeUnreadableOrgRows, readOrgRules, settleOrgVerdictWithin } from "../permission-rule-org.js";
|
|
8
8
|
import { ASK_USER_QUESTION_TOOL_NAME } from "../ask-question.js";
|
|
9
9
|
import { ownerStoreOf } from "../permission-rule-provider.js";
|
|
10
10
|
import { thrownText } from "../thrown-value.js";
|
|
@@ -18,12 +18,19 @@ export function inheritedAskRuleEvidence(provider) {
|
|
|
18
18
|
return Object.freeze({ orgRevisionAbsent: org, orgRuleAbsent: org, personalRuleDotsAbsent: personal });
|
|
19
19
|
}
|
|
20
20
|
export function orgRevisionEvidenceOf(resolution, onDefect) {
|
|
21
|
-
|
|
21
|
+
let reported;
|
|
22
|
+
try {
|
|
23
|
+
reported = resolution.revision;
|
|
24
|
+
}
|
|
25
|
+
catch (err) {
|
|
26
|
+
onDefect(`the org rule partition's revision could not be read (${thrownText(err)}) — the adjudication stands, but the ask carries no revision evidence for this call`);
|
|
27
|
+
return {};
|
|
28
|
+
}
|
|
22
29
|
if (reported === undefined)
|
|
23
30
|
return {};
|
|
24
31
|
if (typeof reported === "number" && Number.isFinite(reported))
|
|
25
32
|
return { revision: reported };
|
|
26
|
-
onDefect(`the org rule partition reported revision ${
|
|
33
|
+
onDefect(`the org rule partition reported revision ${typeof reported === "string" ? `"${escapeForDisclosure(reported)}"` : escapeForDisclosure(reported)} — a snapshot revision is a finite number; ` +
|
|
27
34
|
`the adjudication stands, but the ask carries no revision evidence for this call`);
|
|
28
35
|
return {};
|
|
29
36
|
}
|
|
@@ -59,11 +66,16 @@ export function orgRuleLane(cfg) {
|
|
|
59
66
|
if (resolution.status === "unavailable" || resolution.status === "ungoverned") {
|
|
60
67
|
return { status: "unavailable", disclosures: resolution.status === "ungoverned" ? ["the store reports no org partition while the provider declares one — unreadable governance, never an empty one"] : resolution.disclosures };
|
|
61
68
|
}
|
|
62
|
-
const
|
|
69
|
+
const reading = readOrgRules(resolution.rules);
|
|
70
|
+
if ("refused" in reading)
|
|
71
|
+
return { status: "unavailable", disclosures: [`the store's org resolution cannot be read (${reading.refused}) — unreadable governance, never an empty one`] };
|
|
63
72
|
const command = req.args?.command;
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
const
|
|
73
|
+
const face = callPathFaceOf(req);
|
|
74
|
+
const verdict = reading.verdictFor({ tool: laneToolNamesOf(req), ...(typeof command === "string" ? { command } : {}), ...(face !== undefined ? { face } : {}) });
|
|
75
|
+
const revisionCell = orgRevisionEvidenceOf(resolution, cfg.onRevisionDefect);
|
|
76
|
+
const degraded = describeUnreadableOrgRows(reading.unreadable, revisionCell.revision);
|
|
77
|
+
if (degraded !== undefined)
|
|
78
|
+
cfg.onDegraded(degraded);
|
|
67
79
|
return verdict === undefined ? { status: "available", ...revisionCell } : { status: "available", verdict, ...revisionCell };
|
|
68
80
|
},
|
|
69
81
|
};
|
|
@@ -72,7 +84,7 @@ export function orgVerdictBeforeClaim(cfg, req) {
|
|
|
72
84
|
const unreadable = { status: "unavailable", disclosures: [] };
|
|
73
85
|
const read = () => {
|
|
74
86
|
const store = ownerStoreOf(cfg.provider, cfg.principal, cfg.localOwnerDeclared);
|
|
75
|
-
return orgRuleLane({ read: () => store.effective({ sessionId: cfg.sessionId }), questionToolMounted: true, questionToolName: ASK_USER_QUESTION_TOOL_NAME, onRevisionDefect: () => undefined }).adjudicate(req);
|
|
87
|
+
return orgRuleLane({ read: () => store.effective({ sessionId: cfg.sessionId }), questionToolMounted: true, questionToolName: ASK_USER_QUESTION_TOOL_NAME, onRevisionDefect: () => undefined, onDegraded: () => undefined }).adjudicate(req);
|
|
76
88
|
};
|
|
77
89
|
return settleOrgVerdictWithin(Promise.resolve().then(read).catch(() => unreadable), unreadable, { timeoutMs: ORG_ADJUDICATION_TIMEOUT_MS, ...(cfg.signal !== undefined ? { signal: cfg.signal } : {}) });
|
|
78
90
|
}
|
|
@@ -101,7 +113,7 @@ export function createPermissionRuleLanes(cfg) {
|
|
|
101
113
|
throw new Error(read.unreadable ?? "the store did not answer");
|
|
102
114
|
return { org: read.org };
|
|
103
115
|
};
|
|
104
|
-
const org = provider.partitions.org ? orgRuleLane({ read: orgViewOf, questionToolMounted: cfg.questionToolMounted, questionToolName: cfg.questionToolName, onRevisionDefect: cfg.onRevisionDefect }) : undefined;
|
|
116
|
+
const org = provider.partitions.org ? orgRuleLane({ read: orgViewOf, questionToolMounted: cfg.questionToolMounted, questionToolName: cfg.questionToolName, onRevisionDefect: cfg.onRevisionDefect, onDegraded: cfg.onDisclosure }) : undefined;
|
|
105
117
|
const personalAdjudicate = async (req) => {
|
|
106
118
|
if (anonymous && !cfg.localOwnerDeclared)
|
|
107
119
|
return undefined;
|
|
@@ -237,7 +237,9 @@ export declare function ruleStoreUnreadableNotice(onNotice: RunnerDeps["onNotice
|
|
|
237
237
|
/**
|
|
238
238
|
* The run's ONE `permission.rule_row_dropped` notice (audience user): the person's store served project-scoped rows whose
|
|
239
239
|
* scope root is not a complete absolute path, left out of the checks; minted by whichever read met them first, once per
|
|
240
|
-
* run. The sentence names no path; the rows
|
|
240
|
+
* run. The sentence names no path; the rows ride the detail: `rule` is the rule text as the store served it, through the one
|
|
241
|
+
* reading ({@link noticeRuleText}) that `permission.allowed_tool_not_granted`'s `entries[].entry` uses too — the machine-read side carries the
|
|
242
|
+
* original, the sentence spells — and `scopeRoot` neutralized and bounded. The trace keeps every read's line.
|
|
241
243
|
*/
|
|
242
244
|
export declare function ruleRowsDroppedNotice(onNotice: RunnerDeps["onNotice"], ids: {
|
|
243
245
|
readonly sessionId: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ownerStoreOf } from "../permission-rule-provider.js";
|
|
2
2
|
import { ORG_ADJUDICATION_TIMEOUT_MS } from "../permission-rule-org.js";
|
|
3
|
-
import { PATH_RULE_FACES, READ_RULE_TOOL, eligiblePersisted } from "../permission-rule-model.js";
|
|
3
|
+
import { PATH_RULE_FACES, READ_RULE_TOOL, eligiblePersisted, noticeRuleText } from "../permission-rule-model.js";
|
|
4
4
|
import { bindPathRules, persistedRowAnchors, projectScopeIdentity } from "../path-rule-binding.js";
|
|
5
5
|
import { DEFAULT_GATE_AWAIT_TIMEOUT_MS, gateWaitFailureOf, withGateTimeout } from "../gate-bounded-await.js";
|
|
6
6
|
import { thrownText } from "../thrown-value.js";
|
|
@@ -258,6 +258,7 @@ export function createPersonPathRows(cfg) {
|
|
|
258
258
|
matchPath: (path, opts) => judging().readDeny.matchPath(path, opts),
|
|
259
259
|
matchTarget: (canonicalKey, lexicalView, opts) => judging().readDeny.matchTarget(canonicalKey, lexicalView, opts),
|
|
260
260
|
unexcludableUnder: (scope) => judging().readDeny.unexcludableUnder?.(scope) ?? false,
|
|
261
|
+
rowUnderRoot: (scope) => judging().readDeny.rowUnderRoot?.(scope) ?? null,
|
|
261
262
|
rowAtOrBelow: (path) => judging().readDeny.rowAtOrBelow?.(path) ?? null,
|
|
262
263
|
forCall: (id) => tablesFor(id).readDeny,
|
|
263
264
|
});
|
|
@@ -381,7 +382,7 @@ export function ruleRowsDroppedNotice(onNotice, ids) {
|
|
|
381
382
|
deliverEngineNotice(onNotice, {
|
|
382
383
|
code: "permission.rule_row_dropped",
|
|
383
384
|
message: `${rows.length} of your persisted permission rule rows ${one ? "is" : "are"} scoped to a project directory that is not written as a complete absolute path, so ${one ? "it takes" : "they take"} no part in this run's checks — a deny or ask row among them protects nothing. Rewrite ${one ? "it" : "them"} with the project's full path, or remove ${one ? "it" : "them"} (this notice's detail names ${one ? "it" : "them"}).`,
|
|
384
|
-
detail: { rows: rows.slice(0, 8).map((r) => ({ rule:
|
|
385
|
+
detail: { rows: rows.slice(0, 8).map((r) => ({ rule: noticeRuleText(r.rule), scopeRoot: inlineUntrusted(r.scopeRoot, 200) })), count: rows.length, sessionId: ids.sessionId, runId: ids.runId },
|
|
385
386
|
});
|
|
386
387
|
};
|
|
387
388
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { StoredSession, isSessionConflict } from "../session.js";
|
|
2
|
+
import { SessionError } from "../../internal/harness.js";
|
|
3
|
+
import { readMember } from "../thrown-value.js";
|
|
2
4
|
import { userAttachmentOf } from "../../internal/llm.js";
|
|
3
5
|
import { lastAttachmentFrameOf } from "../user-attachment.js";
|
|
4
6
|
import { reconcileInterruptedSession } from "../session-reconcile.js";
|
|
@@ -33,7 +35,9 @@ export async function prepareAcquireReconcile(input) {
|
|
|
33
35
|
}
|
|
34
36
|
try {
|
|
35
37
|
if (resume) {
|
|
36
|
-
await session.getStorage().setLeafId(resume.leafId)
|
|
38
|
+
await session.getStorage().setLeafId(resume.leafId).catch((cut) => {
|
|
39
|
+
throw readMember(cut, "code") === "not_found" ? new SessionError("invalid_session", `session "${spec.sessionId}" no longer holds the entry its checkpoint was cut at ("${resume.leafId}")`, cut) : cut;
|
|
40
|
+
});
|
|
37
41
|
}
|
|
38
42
|
else if (spec.resumeAt !== undefined) {
|
|
39
43
|
const entry = await session.getEntry(spec.resumeAt);
|
|
@@ -2,7 +2,7 @@ import type { CallTargetStamp } from "../effective-path-target.js";
|
|
|
2
2
|
import type { AgentTool } from "../../internal/harness.js";
|
|
3
3
|
import type { AdvertisedWritableDirs } from "./advertised-writable-dirs.js";
|
|
4
4
|
import type { AutoModeDenialTracker } from "../auto-mode.js";
|
|
5
|
-
import { type
|
|
5
|
+
import { type LegModBus } from "../mods/stations.js";
|
|
6
6
|
import { type OnAsk, type ToolCallRequest, type ToolPolicy } from "../tool-policy.js";
|
|
7
7
|
import type { RunnerDeps, TaskSpec } from "../types.js";
|
|
8
8
|
import type { CwdRef } from "../../tools/fs/fs-shared.js";
|
|
@@ -89,12 +89,10 @@ export interface PrepareAskLaneInput {
|
|
|
89
89
|
sessionId: string;
|
|
90
90
|
/** borrowed-readonly — the run's invocation id (the observer's tag). */
|
|
91
91
|
runId: string;
|
|
92
|
-
/** borrowed-readonly — the
|
|
93
|
-
|
|
94
|
-
/** borrowed-readonly — the
|
|
95
|
-
|
|
96
|
-
/** borrowed-readonly — the own hook-failure lane (`onError`, phase `hook`, swallow-guarded): the deny observer's report sink,
|
|
97
|
-
* the gate's crashing-PreToolUse sink and the adjudicate seat's report of a policy chain that threw. */
|
|
92
|
+
/** borrowed-readonly — the leg's mods bus (the deny observer raises `classic.PermissionDenied` on it). */
|
|
93
|
+
modBus: LegModBus;
|
|
94
|
+
/** borrowed-readonly — the leg's own failure lane (`onError`, phase `hook`, swallow-guarded): the adjudicate seat's report
|
|
95
|
+
* of a policy chain that threw. */
|
|
98
96
|
notifyOwnHookCrash: (err: unknown) => void;
|
|
99
97
|
/** borrowed-readonly — the hands phase's in-flight read-root widening (an approver's accepted `readRootGrant`), or undefined (hands-less). */
|
|
100
98
|
grantReadRoot: GrantReadRoot | undefined;
|