@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
|
@@ -3,11 +3,13 @@ import { FULL_SHELL_CONTRACT_ID } from "../../tools/fs/index.js";
|
|
|
3
3
|
import { ASK_USER_QUESTION_TOOL_NAME } from "../ask-question.js";
|
|
4
4
|
import { MEMORY_ENGINE_TOOL_NAMES } from "../memory-engine/tools.js";
|
|
5
5
|
import { SHARED_MEMORY_TOOL_NAMES } from "../shared-memory/types.js";
|
|
6
|
+
import { announceMemoryNotMounted } from "./announce-once-ledger.js";
|
|
6
7
|
import { protocolOf } from "../protocol-table.js";
|
|
7
8
|
import { classifyDeferredWithGate } from "./tool-defer-gate.js";
|
|
8
9
|
import { TOOL_SEARCH_NAME } from "./tool-disclosure.js";
|
|
9
10
|
import { resolveToolSearch, toolSearchSettingOf } from "../tool-search-setting.js";
|
|
10
11
|
import { RosterBuilder } from "../tool-roster.js";
|
|
12
|
+
import { valveLeaves } from "../../agents/tool-filter.js";
|
|
11
13
|
function explicitlyDeferredMemoryTrio(mounted, roster, callerDeferNames) {
|
|
12
14
|
return mounted ? MEMORY_ENGINE_TOOL_NAMES.filter((n) => roster.some((t) => t.name === n) && (callerDeferNames ?? []).includes(n)) : [];
|
|
13
15
|
}
|
|
@@ -18,12 +20,8 @@ export function prepareDeferClassify(input) {
|
|
|
18
20
|
const { spec, deps, roster, toolFaceSnapshot, handsEnabled, fullShellReachable, promptProfile, model, mcp, a2a, sharedMemoryPairMounted, memoryEnginePairMounted, memoryRecallSegment, onceLedger, sessionId } = input;
|
|
19
21
|
const tools = roster.tools;
|
|
20
22
|
let memoryBlock = input.memoryBlock;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
roster.unmountWhere((t) => !toolFaceSnapshot.selector.admits(t));
|
|
26
|
-
}
|
|
23
|
+
const leaves = valveLeaves(spec, toolFaceSnapshot.selector);
|
|
24
|
+
roster.unmountWhere((t) => !leaves(t));
|
|
27
25
|
if (handsEnabled) {
|
|
28
26
|
const fullShellOnRoster = tools.some((t) => t.name === "Bash" && getToolContract(t, "core").contractId === FULL_SHELL_CONTRACT_ID);
|
|
29
27
|
if (fullShellOnRoster !== fullShellReachable) {
|
|
@@ -47,7 +45,7 @@ export function prepareDeferClassify(input) {
|
|
|
47
45
|
.map((t) => t.name);
|
|
48
46
|
const resolvedToolSearch = resolveToolSearch(deps.toolSearch);
|
|
49
47
|
const toolSearchSeat = toolSearchSettingOf(resolvedToolSearch);
|
|
50
|
-
const toolSearchAdmitted =
|
|
48
|
+
const toolSearchAdmitted = leaves({ name: TOOL_SEARCH_NAME });
|
|
51
49
|
const classifyDeferredOverFace = (face, builtinDeferNames) => {
|
|
52
50
|
const mounted = new Set(face.map((t) => t.name));
|
|
53
51
|
const classified = classifyDeferredWithGate({
|
|
@@ -87,8 +85,7 @@ export function prepareDeferClassify(input) {
|
|
|
87
85
|
const retractNames = memoryGroupRetractionSet(builtinDeferPairNames, memoryEnginePair.length > 0);
|
|
88
86
|
roster.unmountWhere((t) => retractNames.has(t.name));
|
|
89
87
|
if (sharedMemoryPair.length > 0) {
|
|
90
|
-
onceLedger
|
|
91
|
-
`the "${TOOL_SEARCH_NAME}" tool, whose name this task already declares — the pair mounts together or not at all.`), { phase: "config", sessionId, classification: "shared-memory-not-mounted" });
|
|
88
|
+
announceMemoryNotMounted(onceLedger, sessionId, "shared", SHARED_MEMORY_TOOL_NAMES, `mounting them would inject the "${TOOL_SEARCH_NAME}" tool, whose name this task already declares`);
|
|
92
89
|
}
|
|
93
90
|
if (memoryEnginePair.length > 0) {
|
|
94
91
|
if (memoryBlock !== undefined && memoryRecallSegment !== undefined) {
|
|
@@ -100,8 +97,7 @@ export function prepareDeferClassify(input) {
|
|
|
100
97
|
else if (memoryBlock.startsWith(`${segment}\n\n`))
|
|
101
98
|
memoryBlock = memoryBlock.slice(segment.length + 2);
|
|
102
99
|
}
|
|
103
|
-
onceLedger
|
|
104
|
-
`the "${TOOL_SEARCH_NAME}" tool, whose name this task already declares — these tools mount together or not at all.`), { phase: "config", sessionId, classification: "memory-tools-not-mounted" });
|
|
100
|
+
announceMemoryNotMounted(onceLedger, sessionId, "engine", MEMORY_ENGINE_TOOL_NAMES, `mounting them would inject the "${TOOL_SEARCH_NAME}" tool, whose name this task already declares`);
|
|
105
101
|
}
|
|
106
102
|
deferred = d0;
|
|
107
103
|
}
|
|
@@ -30,11 +30,11 @@ export interface PrepareDelegationSurfaceInput {
|
|
|
30
30
|
/** borrowed-readonly — the REBOUND spec. Read: `tools` (the shadow checks and the revival spawner's delegation-tool
|
|
31
31
|
* lookup), `oneShot` (the read/kill faces' completion promises), `retainBackgroundProcesses` (the Monitor receipt),
|
|
32
32
|
* `handsReadOnly` is NOT read here (the hands mount decided the surface). Never mutated. */
|
|
33
|
-
spec: Pick<TaskSpec, "tools" | "oneShot" | "retainBackgroundProcesses">;
|
|
33
|
+
spec: Pick<TaskSpec, "tools" | "oneShot" | "retainBackgroundProcesses" | "excludeAllTools">;
|
|
34
34
|
/** borrowed-readonly — the deployment seats the mounts read: `workflowRunStore` / `backgroundAgentStore` / `mailboxStore` (the
|
|
35
35
|
* read/kill faces and the tier-3 revival seams), `rosterStore`, `peerLane`, `peerDirectory`, `onNotice`,
|
|
36
36
|
* `onBackgroundChildEvent`, `tracer`. */
|
|
37
|
-
deps: Pick<RunnerDeps, "workflowRunStore" | "backgroundAgentStore" | "mailboxStore" | "rosterStore" | "peerLane" | "peerDirectory" | "onNotice" | "onBackgroundChildEvent" | "tracer">;
|
|
37
|
+
deps: Pick<RunnerDeps, "workflowRunStore" | "backgroundAgentStore" | "mailboxStore" | "rosterStore" | "peerLane" | "peerDirectory" | "principalInboxConsumer" | "onNotice" | "onBackgroundChildEvent" | "tracer">;
|
|
38
38
|
/** borrowed-readonly — the trusted spawn-side channel: `parentNotify` (the delegated-child door), the uplink / sibling /
|
|
39
39
|
* identity seats the SendMessage mount forwards, `onTaskNotification`, `onSubagentSpawn`. Never mutated. */
|
|
40
40
|
internals: Pick<RunInternals, "parentNotify" | "parentPeerRef" | "uplinkSessionId" | "parentRetainLedger" | "explicitAgentName" | "parentTaskId" | "parentSessionId" | "peerSelfRef" | "peerInboundChainRef" | "onTaskNotification" | "onSubagentSpawn"> | undefined;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { createAgentTranscriptTool, AGENT_TRANSCRIPT_TOOL_NAME } from "../../agents/agent-transcript-tool.js";
|
|
2
2
|
import { createSendMessageTool, SEND_MESSAGE_TOOL_NAME } from "../../agents/send-message-tool.js";
|
|
3
|
-
import { listAgentsMountable, mountListAgents, peerLaneSendMessageSeats } from "../../agents/peer-session-drain.js";
|
|
3
|
+
import { listAgentsMountable, mountListAgents, peerLaneSendMessageSeats, terminalsDrainPrincipalInbox } from "../../agents/peer-session-drain.js";
|
|
4
4
|
import { resolvePeerLaneConfig } from "../../agents/peer-admission.js";
|
|
5
5
|
import { createReadInboxTool, READ_INBOX_TOOL_NAME } from "../../agents/read-inbox-tool.js";
|
|
6
|
+
import { valveLeaves } from "../../agents/tool-filter.js";
|
|
6
7
|
import { createMonitorTool } from "../../tools/monitor.js";
|
|
7
8
|
import { createWorktreeTools } from "../../tools/worktree.js";
|
|
8
9
|
import { createTaskOutputTool, createTaskStopTool, defaultTaskRegistry } from "../task-registry.js";
|
|
@@ -15,6 +16,7 @@ export function prepareDelegationSurface(input) {
|
|
|
15
16
|
const { spec, deps, internals, resume, sessionId, hostTaskId, taskScope, taskRootFinal, taskRootCanonical, executionEnv, runnerSelf, backgroundTaskToolsActive, workflowToolsActive, peerLaneActive, peerSendMessageBuiltIn, peerLaneRefs, sessionBox, roster, toolEffects, axisExplicitNegatives, envHandToolNames, toolFaceSnapshot, firstPartyOffload, offloadStore, subagentRetain, enrichSpecToolCtx, checkpointSeat, handsCwdRef, wsSnapshot, rebaseWsPath, rebaseRestoredPath, workspaceStateSettle } = input;
|
|
16
17
|
let worktreeSessionRef;
|
|
17
18
|
const delegationSurfaceActive = backgroundTaskToolsActive || workflowToolsActive;
|
|
19
|
+
const leaves = valveLeaves(spec, toolFaceSnapshot.selector);
|
|
18
20
|
let sendMessageTier;
|
|
19
21
|
if (delegationSurfaceActive || internals?.parentNotify !== undefined || peerLaneActive) {
|
|
20
22
|
if (delegationSurfaceActive) {
|
|
@@ -54,7 +56,7 @@ export function prepareDelegationSurface(input) {
|
|
|
54
56
|
...(deps.backgroundAgentStore !== undefined ? { agentStore: deps.backgroundAgentStore } : {}),
|
|
55
57
|
...(deps.mailboxStore !== undefined ? { mailbox: deps.mailboxStore } : {}),
|
|
56
58
|
...(reviveSpawn !== undefined ? { reviveSpawn } : {}),
|
|
57
|
-
...(peerLaneActive ? peerLaneSendMessageSeats({ peerDirectory: deps.peerDirectory, sessionId, scope: taskScope, ...(internals?.explicitAgentName !== undefined ? { name: internals.explicitAgentName } : {}), refs: peerLaneRefs, listingMounted: listAgentsMountable({
|
|
59
|
+
...(peerLaneActive ? peerLaneSendMessageSeats({ peerDirectory: deps.peerDirectory, sessionId, scope: taskScope, ...(internals?.explicitAgentName !== undefined ? { name: internals.explicitAgentName } : {}), refs: peerLaneRefs, listingMounted: listAgentsMountable({ leaves, specTools: spec.tools ?? [] }) }) : {}),
|
|
58
60
|
onNotifyError: (f) => emitTrace(deps.tracer, () => ({ kind: "observer.notify_failed", version: 1, taskId: hostTaskId, site: f.site, message: f.error.message, ts: Date.now() })),
|
|
59
61
|
onTranscriptIntegrityGap: (handle, scope) => deliverEngineNotice(deps.onNotice, {
|
|
60
62
|
code: "delegation.transcript_integrity",
|
|
@@ -80,11 +82,11 @@ export function prepareDelegationSurface(input) {
|
|
|
80
82
|
}
|
|
81
83
|
}
|
|
82
84
|
}
|
|
83
|
-
if (sessionBox !== undefined && internals?.onTaskNotification !== undefined &&
|
|
85
|
+
if (sessionBox !== undefined && internals?.onTaskNotification !== undefined && leaves({ name: READ_INBOX_TOOL_NAME }) && !(spec.tools ?? []).some((t) => t.name === READ_INBOX_TOOL_NAME)) {
|
|
84
86
|
toolEffects.set(READ_INBOX_TOOL_NAME, "read");
|
|
85
|
-
roster.mount(firstPartyOffload(createReadInboxTool({ pull: () => peerLaneRefs.pull })), { source: "builtin", mountedBy: "peerLane" });
|
|
87
|
+
roster.mount(firstPartyOffload(createReadInboxTool({ pull: () => peerLaneRefs.pull, ...(terminalsDrainPrincipalInbox(deps) ? { coversPrincipalInbox: true } : {}) })), { source: "builtin", mountedBy: "peerLane" });
|
|
86
88
|
}
|
|
87
|
-
const listAgents = (peerLaneActive || delegationSurfaceActive) && peerSendMessageBuiltIn && listAgentsMountable({
|
|
89
|
+
const listAgents = (peerLaneActive || delegationSurfaceActive) && peerSendMessageBuiltIn && listAgentsMountable({ leaves, specTools: spec.tools ?? [] }) ? mountListAgents({ ...(peerLaneActive ? { peerDirectory: deps.peerDirectory } : {}), freshWindowMs: resolvePeerLaneConfig(deps.peerLane, deps.onNotice).listingFreshWindowMs, sessionId, scope: taskScope, hostTaskId, ...(internals?.parentTaskId !== undefined ? { parentTaskId: internals.parentTaskId } : {}), ...(internals?.parentSessionId !== undefined ? { parentSessionId: internals.parentSessionId } : {}), registry: defaultTaskRegistry, ...(deps.rosterStore !== undefined ? { roster: deps.rosterStore } : {}), ...(sendMessageTier !== undefined ? { continuationTier: sendMessageTier } : {}), ...(checkpointSeat !== undefined ? { readSeats: { checkpointSeat } } : {}), specTools: spec.tools ?? [], toolEffects }) : undefined;
|
|
88
90
|
if (listAgents !== undefined)
|
|
89
91
|
roster.mount(firstPartyOffload(listAgents), { source: "builtin", mountedBy: "peerLane" });
|
|
90
92
|
if (backgroundTaskToolsActive) {
|
|
@@ -30,7 +30,8 @@ import type { Arbitration, ToolMarkSource } from "../ask-origin.js";
|
|
|
30
30
|
import { type PermissionModeController } from "../mode-policy.js";
|
|
31
31
|
import type { AutoModeDecider, AutoModeDenialTracker } from "../auto-mode.js";
|
|
32
32
|
import { type ComplianceCapability } from "../compliance.js";
|
|
33
|
-
import
|
|
33
|
+
import type { InheritedToolCheck, LegModBus } from "../mods/stations.js";
|
|
34
|
+
import { type HookEnvCapabilities, type HookInvocationIdentity } from "../hooks.js";
|
|
34
35
|
import type { ToolPolicy } from "../tool-policy.js";
|
|
35
36
|
import { type GateOutcome } from "../gate-outcome.js";
|
|
36
37
|
import type { RunnerDeps, TaskSpec, ToolEffect } from "../types.js";
|
|
@@ -95,9 +96,11 @@ export interface PrepareGateStationsInput {
|
|
|
95
96
|
};
|
|
96
97
|
/** borrowed-readonly — the policy chain's effective policy, or undefined; presence only (the arming predicate). */
|
|
97
98
|
effectivePolicy: ToolPolicy | undefined;
|
|
98
|
-
/** borrowed-readonly — the
|
|
99
|
-
*
|
|
100
|
-
|
|
99
|
+
/** borrowed-readonly — the leg's mods bus: `classic.PreToolUse` presence arms the gate; the screenings and the post-call
|
|
100
|
+
* events are raised on it. */
|
|
101
|
+
modBus: LegModBus;
|
|
102
|
+
/** borrowed-readonly — the inherited installations the gate raises `tool.check` on after `modBus` (the inherited-gate phase's). */
|
|
103
|
+
inheritedToolChecks: readonly InheritedToolCheck[];
|
|
101
104
|
/** borrowed-readonly — the egress vocabulary: arming, and the per-call `egress` flag handed to the gate. */
|
|
102
105
|
egressTools: ReadonlySet<string>;
|
|
103
106
|
/** borrowed-readonly — the irreversible vocabulary: arming only. */
|
|
@@ -138,7 +141,7 @@ export interface PrepareGateStationsInput {
|
|
|
138
141
|
batchHaltRef: Prepared["batchHaltRef"];
|
|
139
142
|
/** borrowed-readonly — whether blocked/suspended ids are tracked at all (the post-tool callbacks exist). */
|
|
140
143
|
blockedTracked: boolean;
|
|
141
|
-
/** borrowed-readonly — the leg's identity envelope every
|
|
144
|
+
/** borrowed-readonly — the leg's identity envelope every classic event and PermissionDeniedPayload carries. */
|
|
142
145
|
hookIdentity: HookInvocationIdentity;
|
|
143
146
|
/** borrowed-readonly — the leg's reminder provenance mark (every model-facing deny reason and hook context carries it). */
|
|
144
147
|
reminderMark: string;
|
|
@@ -146,10 +149,6 @@ export interface PrepareGateStationsInput {
|
|
|
146
149
|
hostTaskId: string;
|
|
147
150
|
/** borrowed-readonly — the acquired session id (the settlement defects' error tag). */
|
|
148
151
|
sessionId: string;
|
|
149
|
-
/** borrowed-readonly — the screening face as the gate must see it (the observational wrapper or the face itself). */
|
|
150
|
-
ownGatePreToolUse: Hooks["preToolUse"] | undefined;
|
|
151
|
-
/** borrowed-readonly — the validated per-prepare hook seat bound. */
|
|
152
|
-
hookTimeoutMs: number;
|
|
153
152
|
/** borrowed-readonly — the hand's live tracked cwd, or undefined; `current` is read per screening / per post seat. Not
|
|
154
153
|
* written here. */
|
|
155
154
|
handsCwdRef: CwdRef | undefined;
|
|
@@ -237,8 +236,6 @@ export interface PrepareGateStationsInput {
|
|
|
237
236
|
delegation: {
|
|
238
237
|
isDelegatedChild: boolean;
|
|
239
238
|
};
|
|
240
|
-
/** borrowed-readonly — the own hook-crash reporter (an expired post seat is reported through it). */
|
|
241
|
-
notifyOwnHookCrash: (err: unknown) => void;
|
|
242
239
|
/** borrowed-mutable — the leg's settlement seam. Writer here: the `tool_result` station marks a carrier whose output
|
|
243
240
|
* a host hook rewrote (`noteHostRewrite`), so a frame the rewrite removed settles as the host's decision. */
|
|
244
241
|
frameSettlement: FrameSettlement;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { SEND_MESSAGE_TOOL_NAME } from "../../agents/send-message-tool.js";
|
|
2
2
|
import { mountedToolRequiresUserInteraction } from "../mode-policy.js";
|
|
3
3
|
import { complianceCallDenial } from "../compliance.js";
|
|
4
|
-
import {
|
|
4
|
+
import { formatHookFeedback, runToolGate } from "../hooks.js";
|
|
5
5
|
import { screenGateOutcome } from "../gate-outcome.js";
|
|
6
|
-
import { directDeny, frozenInputSnapshot } from "./gate-exit.js";
|
|
6
|
+
import { cloneObserverInput, directDeny, frozenInputSnapshot } from "./gate-exit.js";
|
|
7
7
|
import { emitTrace } from "../trace.js";
|
|
8
8
|
import { deliverEngineNotice } from "../engine-notice.js";
|
|
9
9
|
import { askUnresolvableNotice } from "../ask-unresolvable-notice.js";
|
|
@@ -46,8 +46,7 @@ export function maybeHumanRejectionHalt(input) {
|
|
|
46
46
|
};
|
|
47
47
|
}
|
|
48
48
|
export function prepareGateStations(input) {
|
|
49
|
-
const { askLane, parkAsk, tools, toolRosterDeltas, toolEffects, deps, toolCallGateArmedRef, effectivePolicy,
|
|
50
|
-
const gatePreToolUse = ownGatePreToolUse !== undefined ? (name, args, ctx) => ownGatePreToolUse(name, args, { ...ctx, permissionMode: permissionMode.observed }) : undefined;
|
|
49
|
+
const { askLane, parkAsk, tools, toolRosterDeltas, toolEffects, deps, toolCallGateArmedRef, effectivePolicy, egressTools, irreversibleTools, spec, complianceDenies, harness, blockedToolCalls, inheritedAskGrants, inheritedUnavailableAsks, foldAskClasses, ancestorSandboxAdmissions, preToolContexts, toolOccurrences, batchHaltRef, blockedTracked, hookIdentity, reminderMark, hostTaskId, sessionId, handsCwdRef, stampCallTarget, hookEnvFace, writeProtectionCheck, shellReadCheck, readFace, irreversibilityTier, reversibilityProbes, abortController, shellGatedTools, autoModeDecider, autoModeDenialTracking, askRoute, permissionMode, toolMarkSources, a2aIsolatePeers, ancestorArbitrations, runId, stopForDenialLimit, permissionRuleLane, permissionRuleOrgLane, questionToolMounted, sandboxAdmissionArmed, sandboxBoundaryCapable, emitSandboxAdmitted, delegation, frameSettlement, seatInputsFor, modBus, inheritedToolChecks } = input;
|
|
51
50
|
const releasesAnnounced = new Map();
|
|
52
51
|
const onModeReleased = (info) => {
|
|
53
52
|
const table = info.readUnestablished === true ? input.readDenyInForce(info.toolCallId) : undefined;
|
|
@@ -81,7 +80,7 @@ export function prepareGateStations(input) {
|
|
|
81
80
|
const writeProtectionArmed = writeProtectionCheck !== undefined && tools.some((t) => PATH_CONFINABLE_WRITE_TOOLS.has(t.name));
|
|
82
81
|
toolCallGateArmedRef.armed =
|
|
83
82
|
effectivePolicy !== undefined ||
|
|
84
|
-
|
|
83
|
+
modBus.hasHandlers("classic.PreToolUse") ||
|
|
85
84
|
egressTools.size > 0 ||
|
|
86
85
|
irreversibleTools.size > 0 ||
|
|
87
86
|
spec.enablePlanMode === true ||
|
|
@@ -119,8 +118,9 @@ export function prepareGateStations(input) {
|
|
|
119
118
|
...(e.signal !== undefined ? { callSignal: e.signal } : {}),
|
|
120
119
|
identity: hookIdentity,
|
|
121
120
|
reminderMark,
|
|
122
|
-
|
|
123
|
-
|
|
121
|
+
modBus,
|
|
122
|
+
...(inheritedToolChecks.length > 0 ? { inheritedToolChecks } : {}),
|
|
123
|
+
observedPermissionMode: () => permissionMode.observed,
|
|
124
124
|
...(handsCwdRef !== undefined ? { trackedCwd: () => handsCwdRef.current } : {}),
|
|
125
125
|
...(stampCallTarget !== undefined ? { stampCallTarget } : {}),
|
|
126
126
|
...(hookEnvFace !== undefined ? { hookEnv: hookEnvFace } : {}),
|
|
@@ -137,7 +137,6 @@ export function prepareGateStations(input) {
|
|
|
137
137
|
irreversibility: tierSeat?.value,
|
|
138
138
|
reversibilityProbe: tierSeat?.read(reversibilityProbes),
|
|
139
139
|
abortSignal: abortController.signal,
|
|
140
|
-
...(notifyPermissionDenied ? { permissionDenied: (p) => notifyPermissionDenied({ ...p, permissionMode: permissionMode.observed }) } : {}),
|
|
141
140
|
onHookError: notifyHookError,
|
|
142
141
|
shellGated: tierSeat?.shellGated(shellGatedTools, toolMarkSources) === true,
|
|
143
142
|
...(autoModeDecider.current !== undefined ? { autoMode: { decider: autoModeDecider.current, ...(autoModeDenialTracking.current !== undefined ? { denialTracking: autoModeDenialTracking.current } : {}), unavailable: classifierUnavailableSeat({ station: "leg", ...(autoModeDecider.current.timeoutMs !== undefined ? { budgetMs: autoModeDecider.current.timeoutMs } : {}), route: approvalRouteOf(askRoute), onNotice: deps.onNotice, sessionId, runId }) } } : {}),
|
|
@@ -241,13 +240,15 @@ export function prepareGateStations(input) {
|
|
|
241
240
|
}
|
|
242
241
|
return { block: true, reason: result.reason, ...details };
|
|
243
242
|
}
|
|
243
|
+
if (result.suspend === undefined)
|
|
244
|
+
toolOccurrences.release(e.toolCallId);
|
|
244
245
|
return result.updatedInput !== undefined ? { updatedInput: result.updatedInput } : undefined;
|
|
245
246
|
});
|
|
246
247
|
}
|
|
247
248
|
}
|
|
248
|
-
const toolResultStation = createToolResultStation({
|
|
249
|
+
const toolResultStation = createToolResultStation({ modBus, blockedToolCalls, toolRosterDeltas, preToolContexts, abortController, spec, handsCwdRef, hookEnvFace, hookIdentity, permissionMode, reminderMark, frameSettlement });
|
|
249
250
|
if (toolResultStation !== undefined)
|
|
250
251
|
harness.on("tool_result", toolResultStation);
|
|
251
|
-
const approvedCallScreen = createApprovedCallScreen({
|
|
252
|
+
const approvedCallScreen = createApprovedCallScreen({ modBus, permissionMode, abortController, handsCwdRef, hookEnvFace, hookIdentity, preToolContexts });
|
|
252
253
|
return { toolCallStationArmed: toolCallGateArmedRef.armed, toolResultStationArmed: toolResultStation !== undefined, ...(approvedCallScreen !== undefined ? { approvedCallScreen } : {}) };
|
|
253
254
|
}
|
|
@@ -88,7 +88,7 @@ export interface PrepareHandsReadFaceInput {
|
|
|
88
88
|
/** borrowed-readonly — the task-spec seats this phase reads, as a Pick over the SAME spec object
|
|
89
89
|
* (R-4). `tools` feeds only the band shadow check; `envFacts` only the advertised scratchpad;
|
|
90
90
|
* `retainBackgroundProcesses` only the band's retain lane (Bash's lifetime sentence + row stamp). */
|
|
91
|
-
spec: Pick<TaskSpec, "additionalDirectories" | "additionalReadDirectories" | "envFacts" | "handsReadOnly" | "readDenyPatterns" | "readFace" | "writeFace" | "oneShot" | "resumeAt" | "retainBackgroundProcesses" | "sessionId" | "tools">;
|
|
91
|
+
spec: Pick<TaskSpec, "additionalDirectories" | "additionalReadDirectories" | "envFacts" | "handsReadOnly" | "readDenyPatterns" | "readFace" | "writeFace" | "oneShot" | "resumeAt" | "retainBackgroundProcesses" | "sessionId" | "tools" | "excludeAllTools">;
|
|
92
92
|
/** borrowed-readonly — the deployment seats this phase reads, as a Pick over the SAME deps
|
|
93
93
|
* object (R-4: `deps.onError?.()` keeps its receiver; a new deps read must widen this Pick).
|
|
94
94
|
* `readDenyBuiltinTiers`/`readDenyBuiltinExclude` are SNAPSHOTTED before the first await that
|
|
@@ -21,6 +21,7 @@ import { RosterBuilder } from "../tool-roster.js";
|
|
|
21
21
|
import { unionAddOnly } from "../child-clamp-seats.js";
|
|
22
22
|
import { assertStringArraySeat } from "../read-face-seats.js";
|
|
23
23
|
import { modePolicyOf } from "../mode-policy.js";
|
|
24
|
+
import { valveLeaves } from "../../agents/tool-filter.js";
|
|
24
25
|
const faceClampAnnouncedSinks = { read: new WeakSet(), write: new WeakSet() };
|
|
25
26
|
const faceClampConsoleAnnounced = { read: false, write: false };
|
|
26
27
|
function announceDeploymentFaceClamp(kind, sink) {
|
|
@@ -370,7 +371,7 @@ export async function prepareHandsMount(input) {
|
|
|
370
371
|
return memoryWriteGate?.(w);
|
|
371
372
|
},
|
|
372
373
|
mountBackgroundTaskTools: false,
|
|
373
|
-
monitorToolActive: backgroundTaskToolsActive && toolFaceSnapshot.selector
|
|
374
|
+
monitorToolActive: backgroundTaskToolsActive && valveLeaves(spec, toolFaceSnapshot.selector)({ name: "Monitor" }),
|
|
374
375
|
});
|
|
375
376
|
{
|
|
376
377
|
const bandNames = new Set(band.flatMap((t) => [t.name, ...(t.aliases ?? [])]));
|
|
@@ -31,14 +31,15 @@ import type { AgentHarness, ExecutionEnv } from "../../internal/harness.js";
|
|
|
31
31
|
import type { SubagentWorktreeIsolation } from "../../agents/subagent.js";
|
|
32
32
|
import { forkGovernanceDenial } from "../../agents/subagent.js";
|
|
33
33
|
import type { SubagentRetainLedger } from "../../agents/retain-ledger.js";
|
|
34
|
-
import type {
|
|
34
|
+
import type { PromptArtifact } from "../../prompt-assembly/artifact.js";
|
|
35
35
|
import type { ContainmentFace } from "../../tools/fs/index.js";
|
|
36
36
|
import type { AutoModeArmingRecipe } from "../auto-mode-arming.js";
|
|
37
37
|
import type { AutoModeDecider, AutoModeDenialTracker } from "../auto-mode.js";
|
|
38
38
|
import { type OnQuestion } from "../ask-question.js";
|
|
39
39
|
import { type ParentSpecSeat } from "../parent-spec-seat.js";
|
|
40
|
+
import { type HookEnvCapabilities } from "../hooks.js";
|
|
41
|
+
import { type LegModBus, type ModChainLink } from "../mods/stations.js";
|
|
40
42
|
import { type ChildClampSource } from "../child-clamp-seats.js";
|
|
41
|
-
import { type HookEnvCapabilities, type Hooks } from "../hooks.js";
|
|
42
43
|
import type { LockedPreflight } from "../locked-config.js";
|
|
43
44
|
import type { OwnOrgAdmissionVerdict } from "../memory-admission.js";
|
|
44
45
|
import type { DelegationContentSafety } from "../memory-engine/delegation-provenance.js";
|
|
@@ -157,13 +158,10 @@ export interface PrepareInheritedGateInput {
|
|
|
157
158
|
/** borrowed-readonly — LATE-BOUND: the per-principal entitlements the caps phase resolves after this one; read only inside
|
|
158
159
|
* `inheritedGateForChildren` (the two mandate tests), at spawn time. */
|
|
159
160
|
runtimeCaps: () => RuntimeCaps | undefined;
|
|
160
|
-
/** borrowed-readonly —
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
preToolUseObservational: () => boolean;
|
|
165
|
-
/** borrowed-readonly — LATE-BOUND: the validated per-invocation hook bound the screening-face entry's policy runs under. */
|
|
166
|
-
hookTimeoutMs: () => number;
|
|
161
|
+
/** borrowed-readonly — the leg's mods bus: the chain assembly mints this leg's screening entry over its `classic.PreToolUse` chain. */
|
|
162
|
+
modBus: LegModBus;
|
|
163
|
+
/** borrowed-readonly — this leg's chain identity as its admission recorded it (`chainOfBus`) — the installation identity's chain term. */
|
|
164
|
+
ownModChain: readonly ModChainLink[];
|
|
167
165
|
/** borrowed-readonly — LATE-BOUND: the hook-env capability face the screening-face entry's policy resolves paths in. */
|
|
168
166
|
hookEnvFace: () => HookEnvCapabilities | undefined;
|
|
169
167
|
/** borrowed-readonly — LATE-BOUND: the armed classifier (undefined = not armed), read where the chain freezes it onto both
|
|
@@ -192,7 +190,7 @@ export interface PrepareInheritedGateInput {
|
|
|
192
190
|
handsLessResolvedWriteFace: () => WriteFaceSeat | undefined;
|
|
193
191
|
/** borrowed-readonly — LATE-BOUND: the adopted center artifact (ctx `centerArtifactDigest` / `centerSourceRevision`). */
|
|
194
192
|
centerAdoption: () => {
|
|
195
|
-
artifact:
|
|
193
|
+
artifact: PromptArtifact;
|
|
196
194
|
sourceRevision?: string;
|
|
197
195
|
} | undefined;
|
|
198
196
|
/** borrowed-readonly — LATE-BOUND: the memory-engine session (the ctx's capture-floor getters read it at THEIR call time). */
|
|
@@ -296,8 +294,6 @@ export interface PrepareInheritedGateResult {
|
|
|
296
294
|
/** owned — the env the screening face sees through `ctx.env` (identity half of a chain entry's `hookEnv`); the policy-chain
|
|
297
295
|
* station's pass-through arm compares against it. */
|
|
298
296
|
hookEnvSource: unknown;
|
|
299
|
-
/** owned — the deployment lane for a screening face that crashes while screening a descendant's call (phase "hook"). */
|
|
300
|
-
notifyOwnHookCrash: (err: unknown) => void;
|
|
301
297
|
/** owned — the FROZEN question seat (spec over deps), the content-ask twin of `frozenOnAsk`. */
|
|
302
298
|
frozenOnQuestion: OnQuestion | undefined;
|
|
303
299
|
/** owned — the parent SPEC seat this run hands its children (`parentSpecSeatOf(spec, frozenOnQuestion)`): the ctx seat and the Workflow mount dep are this one value; both lanes apply it with `applyParentSpecSeat` (one law). */
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { forkGovernanceDenial, resolveDelegationEntryCaps } from "../../agents/subagent.js";
|
|
2
2
|
import { isLiveQuestionFace } from "../ask-question.js";
|
|
3
3
|
import { parentSpecSeatOf } from "../parent-spec-seat.js";
|
|
4
|
-
import { childClampSeats, clampSourceOf } from "../child-clamp-seats.js";
|
|
5
4
|
import { createPreToolUseConstraintPolicy } from "../hooks.js";
|
|
5
|
+
import { chainJudges, sameInstallation } from "../mods/stations.js";
|
|
6
|
+
import { childClampSeats, clampSourceOf } from "../child-clamp-seats.js";
|
|
6
7
|
import { continuesLineage } from "../session-policy-store.js";
|
|
7
8
|
import { StubExecutionEnv } from "../stub-env.js";
|
|
8
|
-
import {
|
|
9
|
+
import { durableMandateSourceOf } from "../tool-policy.js";
|
|
9
10
|
import { chainAnchorRecords } from "./child-tree.js";
|
|
10
11
|
import { deliverEngineNotice } from "../types.js";
|
|
11
12
|
import { PermissionModeController, autoModeFaceOf, modeRequestAfterResume } from "../mode-policy.js";
|
|
@@ -13,7 +14,7 @@ import { SessionModeSeats } from "./session-mode-seats.js";
|
|
|
13
14
|
import { recordedModeSeed } from "../checkpoint-store.js";
|
|
14
15
|
import { frozenSkillGrants } from "../skill-grant.js";
|
|
15
16
|
import { attachRebuiltDenialTrackers, createDenialLimitStop } from "./denial-limit-arms.js";
|
|
16
|
-
import {
|
|
17
|
+
import { valveLeaves } from "../../agents/tool-filter.js";
|
|
17
18
|
export function prepareInheritedGate(input) {
|
|
18
19
|
const { spec, deps, askSeat, internals, resume, sessions, sessionId, runId, hostTaskId, taskRootFinal, executionEnv, ownedEnv, lockedPreflight, pathRuleAnchors, toolFaceSnapshot, mountsCallerTool, promptProfile, resolvedInteractionPosture, permissionModeSeat, handsEnabled, reportUsage, harnessRef, skillGrants, forwardEvent, subagentRetain, worktreeIsolation, requestReview, requestStopAfterTurn, enterPlanMode, reminderMark, reminderDisclosureCounts, fileHistoryEnabled, historyScope, historyRoot, historyFs, abortRun } = input;
|
|
19
20
|
const liveInheritedGate = internals?.inheritedGate;
|
|
@@ -117,13 +118,6 @@ export function prepareInheritedGate(input) {
|
|
|
117
118
|
const skillGrantCheckpointSection = () => frozenSkillGrants(skillGrants);
|
|
118
119
|
const frozenOnAsk = askSeat.value;
|
|
119
120
|
const hookEnvSource = (ownedEnv ?? deps.executionEnv) != null ? executionEnv : undefined;
|
|
120
|
-
const notifyOwnHookCrash = (err) => {
|
|
121
|
-
try {
|
|
122
|
-
deps.onError?.(asThrownError(err), { phase: "hook", sessionId });
|
|
123
|
-
}
|
|
124
|
-
catch {
|
|
125
|
-
}
|
|
126
|
-
};
|
|
127
121
|
const frozenOnQuestion = spec.onQuestion ?? deps.onQuestion;
|
|
128
122
|
const parentSpecSeat = parentSpecSeatOf(spec, frozenOnQuestion);
|
|
129
123
|
const provenanceForChildrenRef = {};
|
|
@@ -142,18 +136,12 @@ export function prepareInheritedGate(input) {
|
|
|
142
136
|
const durableMandate = durableMandateSourceOf({ forceDurableGate: input.runtimeCaps()?.forceDurableGate === true, durableApprovalDeclared: spec.durableApproval !== undefined, onAsk: frozenOnAsk }) !== undefined;
|
|
143
137
|
const contentMandate = input.runtimeCaps()?.forceDurableGate === true ||
|
|
144
138
|
(spec.durableApproval !== undefined && !isLiveQuestionFace(frozenOnQuestion));
|
|
145
|
-
const
|
|
146
|
-
const hookConstraint =
|
|
147
|
-
!(inheritedParentConstraints ?? []).some((pc) => pc.preToolUse === ownPreToolUse &&
|
|
148
|
-
askApproverIdentity(pc.onAsk) === askApproverIdentity(frozenOnAsk) &&
|
|
149
|
-
(pc.durableMandate === true) === durableMandate &&
|
|
150
|
-
(pc.contentMandate === true) === contentMandate &&
|
|
151
|
-
pc.hookEnv === hookEnvSource &&
|
|
152
|
-
pc.autoMode?.decider === autoModeDecider)
|
|
139
|
+
const ownInstallation = { chain: input.ownModChain, onAsk: frozenOnAsk, durableMandate, contentMandate, hookEnv: hookEnvSource, decider: autoModeDecider };
|
|
140
|
+
const hookConstraint = chainJudges(input.modBus) && !(inheritedParentConstraints ?? []).some((pc) => sameInstallation(pc, ownInstallation))
|
|
153
141
|
? [
|
|
154
142
|
{
|
|
155
|
-
policy: createPreToolUseConstraintPolicy(
|
|
156
|
-
|
|
143
|
+
policy: createPreToolUseConstraintPolicy(input.modBus, input.hookEnvFace()),
|
|
144
|
+
mods: input.ownModChain,
|
|
157
145
|
...(hookEnvSource !== undefined ? { hookEnv: hookEnvSource } : {}),
|
|
158
146
|
...(frozenOnAsk !== undefined ? { onAsk: frozenOnAsk } : {}),
|
|
159
147
|
...(durableMandate ? { durableMandate: true } : {}),
|
|
@@ -205,8 +193,7 @@ export function prepareInheritedGate(input) {
|
|
|
205
193
|
const fullShellReachable = handsEnabled &&
|
|
206
194
|
!(executionEnv instanceof StubExecutionEnv) &&
|
|
207
195
|
spec.handsReadOnly !== true &&
|
|
208
|
-
spec.
|
|
209
|
-
toolFaceSnapshot.selector.admits({ name: "Bash" });
|
|
196
|
+
valveLeaves(spec, toolFaceSnapshot.selector)({ name: "Bash" });
|
|
210
197
|
const { gateStopRef, stopForDenialLimit } = createDenialLimitStop({ sessionId, runId, onNotice: deps.onNotice, abort: abortRun });
|
|
211
198
|
const delegationEntryCapsResolved = resolveDelegationEntryCaps(deps.delegationEntryCaps);
|
|
212
199
|
const enrichSpecToolCtx = (ctx) => {
|
|
@@ -305,5 +292,5 @@ export function prepareInheritedGate(input) {
|
|
|
305
292
|
...(spec.enablePlanMode === true ? { enterPlanMode } : {}),
|
|
306
293
|
};
|
|
307
294
|
};
|
|
308
|
-
return { liveInheritedGate, seedInheritedGate, inheritedAncestorRules, inheritedShellGate, inheritedParentConstraints, permissionMode, commitModeSeats, endModeCeiling, inheritedAdmittedOrgScopes, priorOwnOrgVerdict, orgGovernedProvenance, effectiveShellGate, ownSessionRulesRef, ancestorSessionRulesRef, ancestorRulesNow, memoryAdmittedOrgScopesRef, ownOrgVerdictRef, runClampSource, faceCheckpointSection, writeFaceCheckpointSection, skillGrantCheckpointSection, frozenOnAsk, hookEnvSource,
|
|
295
|
+
return { liveInheritedGate, seedInheritedGate, inheritedAncestorRules, inheritedShellGate, inheritedParentConstraints, permissionMode, commitModeSeats, endModeCeiling, inheritedAdmittedOrgScopes, priorOwnOrgVerdict, orgGovernedProvenance, effectiveShellGate, ownSessionRulesRef, ancestorSessionRulesRef, ancestorRulesNow, memoryAdmittedOrgScopesRef, ownOrgVerdictRef, runClampSource, faceCheckpointSection, writeFaceCheckpointSection, skillGrantCheckpointSection, frozenOnAsk, hookEnvSource, frozenOnQuestion, parentSpecSeat, provenanceForChildrenRef, delegationSettlementRef, inheritedGateForChildren, carrierReadFace, carrierWriteFace, fullShellReachable, gateStopRef, stopForDenialLimit, enrichSpecToolCtx };
|
|
309
296
|
}
|
|
@@ -5,7 +5,7 @@ import type { ResolvedSkillListingBudget } from "../skill-listing-budget.js";
|
|
|
5
5
|
export interface PrepareListingsInput {
|
|
6
6
|
/** borrowed-readonly — the REBOUND spec (`spec′`). Read: `tools` (the roster-bearing delegation tool, by its `agentListing`
|
|
7
7
|
* marker), `sessionId` (continuation ⇒ seeded/removal projections), `attachments` (the two opt-outs). Never mutated. */
|
|
8
|
-
spec: Pick<TaskSpec, "agents" | "tools" | "sessionId" | "attachments">;
|
|
8
|
+
spec: Pick<TaskSpec, "agents" | "tools" | "sessionId" | "attachments" | "excludeAllTools">;
|
|
9
9
|
/** borrowed-readonly — the once-per-session ledger: its deduplicated operator sink (`onError`) and
|
|
10
10
|
* the whole announced snapshot (`arms()`) the mirror is seeded from. */
|
|
11
11
|
onceLedger: AnnounceOnceSink & {
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import { formatLocalDate } from "../../prompts/default.js";
|
|
2
|
+
import { valveLeaves } from "../../agents/tool-filter.js";
|
|
2
3
|
import { SKILL_TOOL_NAME } from "./synthetic-tools.js";
|
|
3
4
|
import { renderAgentListingDelta } from "./turn-attachments.js";
|
|
4
5
|
export function prepareListings(input) {
|
|
5
6
|
const { spec, onceLedger, sessionId, toolFaceSnapshot, activeTools, deferred, resume, skillsListing, listingBudget, listingRideRef, renderWithDate, envFacts, tzValid, userTz, dateAnchor } = input;
|
|
6
7
|
const rosterBearingSpec = (spec.tools ?? []).find((t) => t.agentListing !== undefined && t.agentListing.length > 0);
|
|
8
|
+
const leaves = valveLeaves(spec, toolFaceSnapshot.selector);
|
|
7
9
|
const rosterFaceDeferred = rosterBearingSpec !== undefined &&
|
|
8
|
-
|
|
10
|
+
leaves(rosterBearingSpec) &&
|
|
9
11
|
(toolFaceSnapshot.defer?.includes(rosterBearingSpec.name) ?? false) &&
|
|
10
12
|
deferred.has(rosterBearingSpec.name) &&
|
|
11
13
|
!activeTools.has(rosterBearingSpec.name);
|
|
12
14
|
const agentListingSpec = rosterBearingSpec !== undefined &&
|
|
13
15
|
!rosterFaceDeferred &&
|
|
14
|
-
|
|
16
|
+
leaves(rosterBearingSpec)
|
|
15
17
|
? rosterBearingSpec
|
|
16
18
|
: undefined;
|
|
17
19
|
const agentListing = agentListingSpec
|
|
@@ -12,12 +12,8 @@
|
|
|
12
12
|
* installs, which run at tool-call time), so the phase adds no yield between the deferred classification before it
|
|
13
13
|
* and the prompt assembly after it (a stretch with no await is extracted as a sync function).
|
|
14
14
|
* Read-stability of the host handles for the call: {@link RunInternals} (`@contract prepare.deps-read-stable`).
|
|
15
|
-
*
|
|
16
|
-
* One read changed spelling and nothing else: the declared-class announcement read `mcp?.statuses` while `mcp` had
|
|
17
|
-
* long been the protocol-tools phase's non-null handle; the optional chain was dead and is now the plain member read.
|
|
18
15
|
*/
|
|
19
16
|
import type { LockedPreflight } from "../locked-config.js";
|
|
20
|
-
import type { MaterializedMcp } from "../mcp.js";
|
|
21
17
|
import { type DelegationContentSafety } from "../memory-engine/delegation-provenance.js";
|
|
22
18
|
import type { RunnerDeps, TaskSpec } from "../types.js";
|
|
23
19
|
import type { Prepared, RunInternals } from "./contracts.js";
|
|
@@ -40,8 +36,6 @@ export interface PrepareMemoryEngineSessionInput {
|
|
|
40
36
|
lockedPreflight: Pick<LockedPreflight, "mcp">;
|
|
41
37
|
/** borrowed-readonly — the run's MCP mount, read at call time (present iff the run declared a server): the children a delegation tool spawns inherit it, so its tools are rows of their pool. */
|
|
42
38
|
mountedMcp?: () => import("../mounted-mcp.js").MountedMcp;
|
|
43
|
-
/** borrowed-readonly — the materialized MCP handle; only `statuses` (the announcement's mounted-tool count). */
|
|
44
|
-
mcp: Pick<MaterializedMcp, "statuses">;
|
|
45
39
|
/** borrowed-readonly — the acquired session id (notice detail). */
|
|
46
40
|
sessionId: string;
|
|
47
41
|
/** borrowed-readonly — the run's invocation id (notice detail; the once-per-leg claims are per-RUN claims). */
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { classifyToolContentOrigin, contentOriginPollutes, delegationCallIsExternal } from "../memory-engine/content-origin.js";
|
|
2
|
-
import { mountedMcpPoolRows } from "../mounted-mcp.js";
|
|
2
|
+
import { mountedMcpPoolRows, toolNamesOfServer } from "../mounted-mcp.js";
|
|
3
3
|
import { narrowContentSafety, readCardAttestation } from "../memory-engine/delegation-provenance.js";
|
|
4
4
|
import { recordSyncUnattestable, sessionSettlements } from "../memory-engine/delegation-settlement.js";
|
|
5
5
|
import { protocolOf } from "../protocol-table.js";
|
|
6
6
|
import { deliverEngineNotice } from "../types.js";
|
|
7
7
|
import { inlineUntrusted } from "../untrusted-text.js";
|
|
8
|
-
import { fileArgPath } from "
|
|
8
|
+
import { fileArgPath } from "../tool-registry.js";
|
|
9
9
|
import { RosterBuilder } from "../tool-roster.js";
|
|
10
|
+
import { isNotStartedDelegationResult } from "../../agents/subagent.js";
|
|
10
11
|
import { thrownText } from "../thrown-value.js";
|
|
11
12
|
export function prepareMemoryEngineSession(input) {
|
|
12
|
-
const { memoryEngineSession, internals, memoryDelegationEvidence, externalContentTargetActive, lockedPreflight,
|
|
13
|
+
const { memoryEngineSession, internals, memoryDelegationEvidence, externalContentTargetActive, lockedPreflight, mountedMcp, sessionId, runId, deps, provenanceForChildrenRef, delegationSettlementRef, spec, envHandToolNames, roster, contentOriginWrapRef } = input;
|
|
13
14
|
const tools = roster.tools;
|
|
14
15
|
const delegationProvenanceChannel = internals?.delegationProvenance;
|
|
15
16
|
if (memoryEngineSession !== undefined || delegationProvenanceChannel !== undefined) {
|
|
@@ -22,7 +23,7 @@ export function prepareMemoryEngineSession(input) {
|
|
|
22
23
|
provenanceForChildrenRef.current = { trustedTools: [...trustedTools], execIsExternalContent };
|
|
23
24
|
announceDeclaredMcpContentClasses({
|
|
24
25
|
entries: lockedPreflight.mcp,
|
|
25
|
-
|
|
26
|
+
mountedNames: roster.tools.map((t) => t.name),
|
|
26
27
|
execIsExternalContent,
|
|
27
28
|
sessionId,
|
|
28
29
|
runId,
|
|
@@ -133,6 +134,9 @@ export function prepareMemoryEngineSession(input) {
|
|
|
133
134
|
isPolluting: poolToolPollutes,
|
|
134
135
|
});
|
|
135
136
|
const result = await inner(toolCallId, params, signal, onUpdate);
|
|
137
|
+
const delivery = delegationDeliveryOf(result);
|
|
138
|
+
if (delivery === "none")
|
|
139
|
+
return result;
|
|
136
140
|
const att = readCardAttestation(result?.details);
|
|
137
141
|
if (att === "external") {
|
|
138
142
|
mark(`tool "${t.name}" returned the output of a delegated agent that invoked an external-content-class tool at runtime` +
|
|
@@ -141,8 +145,11 @@ export function prepareMemoryEngineSession(input) {
|
|
|
141
145
|
}
|
|
142
146
|
else if (att !== "clean") {
|
|
143
147
|
if (external) {
|
|
144
|
-
const staticFaceReason =
|
|
145
|
-
|
|
148
|
+
const staticFaceReason = (delivery === "launched"
|
|
149
|
+
? `tool "${t.name}" launched a background delegated agent whose tool face can reach external content`
|
|
150
|
+
: `tool "${t.name}" returned the output of a delegated agent whose tool face can reach external content`) +
|
|
151
|
+
(typeof requested === "string" ? ` (subagent_type "${requested}")` : " (no subagent_type named — classified fail-closed)") +
|
|
152
|
+
(delivery === "launched" ? " — its output enters this session when it finishes" : "");
|
|
146
153
|
if (!delegationEvidenceAttestedOnly) {
|
|
147
154
|
mark(staticFaceReason, "static");
|
|
148
155
|
}
|
|
@@ -207,13 +214,19 @@ export function prepareMemoryEngineSession(input) {
|
|
|
207
214
|
}
|
|
208
215
|
return { armed: memoryEngineSession !== undefined || delegationProvenanceChannel !== undefined };
|
|
209
216
|
}
|
|
217
|
+
function delegationDeliveryOf(result) {
|
|
218
|
+
if (isNotStartedDelegationResult(result))
|
|
219
|
+
return "none";
|
|
220
|
+
const details = typeof result === "object" && result !== null ? result.details : undefined;
|
|
221
|
+
return typeof details === "object" && details !== null && details.status === "async_launched" ? "launched" : "report";
|
|
222
|
+
}
|
|
210
223
|
function announceDeclaredMcpContentClasses(args) {
|
|
211
224
|
for (const entry of args.entries ?? []) {
|
|
212
225
|
const declaredClass = entry.contentOrigin;
|
|
213
226
|
if (declaredClass === undefined)
|
|
214
227
|
continue;
|
|
215
228
|
const server = inlineUntrusted(String(entry.name), 160);
|
|
216
|
-
const toolCount = args.
|
|
229
|
+
const toolCount = toolNamesOfServer(args.mountedNames, entry.name).length;
|
|
217
230
|
const resourceFaceCaveat = " (Not covered: the cross-server resource faces — ListMcpResourcesTool/ReadMcpResourceTool/ReadMcpResourceDirTool — stay externally classified and still mark.)";
|
|
218
231
|
const posture = declaredClass === "local"
|
|
219
232
|
? `this server's mounted tools' invocations will not mark this session's memory as externally exposed.${resourceFaceCaveat}`
|
|
@@ -208,11 +208,12 @@ export interface PrepareMemoryResult {
|
|
|
208
208
|
* BEFORE it). It performs the one destructive read this phase has — `inject()` drains the announcement queue —
|
|
209
209
|
* so a hands-phase refusal cannot consume announcements a later prepare should deliver, and it takes the
|
|
210
210
|
* roster-wide persistence verdict the driver can only read off the MOUNTED roster (`rosterCanPersist`: the
|
|
211
|
-
* `
|
|
212
|
-
*
|
|
211
|
+
* `memoryPersistenceCapable` declaration when set, else the store-path inference over the assembled tools) and
|
|
212
|
+
* `isSubagent` (a non-fork delegated child — no user conversation, no not-mounted notice). Call once per prepare.
|
|
213
213
|
*/
|
|
214
214
|
composeInjection: (facts: {
|
|
215
215
|
rosterCanPersist: boolean;
|
|
216
|
+
isSubagent: boolean;
|
|
216
217
|
}) => MemoryInjectionComposition;
|
|
217
218
|
/**
|
|
218
219
|
* The FROZEN org-admission verdict of this prepare: every org scope the task actually mounts
|
|
@@ -6,7 +6,7 @@ import { classifyScopePlanes, derivePersonalControlDir, derivePersonalMemoryDir,
|
|
|
6
6
|
import { memoryProjectScopeAbsentNotice, normalizeMemorySpec } from "../memory.js";
|
|
7
7
|
import { deriveSupersededSet } from "../memory-engine/consolidation.js";
|
|
8
8
|
import { shadowNamesOf } from "../memory-engine/shadowing.js";
|
|
9
|
-
import { MEMORY_ANNOUNCEMENT_CAPTURE_OPTOUT_CODA, MEMORY_ANNOUNCEMENT_READONLY_CODA,
|
|
9
|
+
import { MEMORY_ANNOUNCEMENT_CAPTURE_OPTOUT_CODA, MEMORY_ANNOUNCEMENT_READONLY_CODA, MEMORY_CAPTURE_OPTOUT_NOTICE, MEMORY_PREFERENCE_DISCIPLINE, MEMORY_READONLY_NOTICE, MemoryEngine, entryFileHeadCarriesOrigin, memoryCaptureOptedOutNotice, memoryCaptureOptOutUnpersistedNotice, memoryConsolidationRecommendedNotice, memoryHarvestQuarantinedNotice, memoryHoldNotices, memoryRecallDisciplineSegment, memoryRestoreWithheldNotice, memorySessionPollutedNotice, memoryUnavailableNotice, pollutionContainmentCounts, } from "../memory-engine/engine.js";
|
|
10
10
|
import { adjudicateCaptureOptOut, captureOptOutDeniedError, captureOptOutUnpersistedError } from "./memory-capture-optout.js";
|
|
11
11
|
import { readSessionCaptureOptOut } from "../memory-engine/layout.js";
|
|
12
12
|
import { sessionIncarnationResolver } from "../memory-engine/session-incarnation.js";
|
|
@@ -14,6 +14,7 @@ import { createMemoryEngineTools } from "../memory-engine/tools.js";
|
|
|
14
14
|
import { assertScopeContractPlacement, parseScopeKey, resolveProjectId } from "../memory-engine/scope-contract.js";
|
|
15
15
|
import { FileMemoryEngineBackend } from "../memory-engine/file-backend.js";
|
|
16
16
|
import { writableRootOf } from "../memory-engine/types.js";
|
|
17
|
+
import { catalogText } from "../../prompt-assembly/catalog/index.js";
|
|
17
18
|
import { asThrownError, thrownText } from "../thrown-value.js";
|
|
18
19
|
let undeclaredCapturePostureAnnounced = false;
|
|
19
20
|
export async function prepareMemory(input) {
|
|
@@ -781,7 +782,7 @@ export async function prepareMemory(input) {
|
|
|
781
782
|
blockBody = [MEMORY_CAPTURE_OPTOUT_NOTICE, injection.index, injection.announceBlock].filter((s) => Boolean(s && s.trim())).join("\n\n");
|
|
782
783
|
}
|
|
783
784
|
else if (captureIndeterminate && facts.rosterCanPersist) {
|
|
784
|
-
blockBody = [
|
|
785
|
+
blockBody = [memoryUnavailableNotice({ what: "capture-record-unreadable", notesReadable: true }), injection.index, injection.announceBlock].filter((s) => Boolean(s && s.trim())).join("\n\n");
|
|
785
786
|
}
|
|
786
787
|
else if (!facts.rosterCanPersist && injection.instruction === "" && injection.readOnlyNotice === undefined) {
|
|
787
788
|
blockBody = blockBody.trim() ? `${MEMORY_READONLY_NOTICE}\n\n${blockBody}` : MEMORY_READONLY_NOTICE;
|
|
@@ -817,6 +818,9 @@ export async function prepareMemory(input) {
|
|
|
817
818
|
if (memoryBlock !== undefined && injection.indexSeed !== undefined && facts.rosterCanPersist && !captureOptedOut && !captureIndeterminate)
|
|
818
819
|
seedFiles = [injection.indexSeed];
|
|
819
820
|
}
|
|
821
|
+
else if (!facts.rosterCanPersist && !facts.isSubagent) {
|
|
822
|
+
memoryBlock = effectiveMemoryScopes?.reason === "mount-failed" ? memoryUnavailableNotice({ what: "mount-failed", notesReadable: false }) : catalogText("core/memory.no-persistent-store");
|
|
823
|
+
}
|
|
820
824
|
return {
|
|
821
825
|
memoryBlock,
|
|
822
826
|
...(recallDisciplineSegment !== undefined ? { recallDisciplineSegment } : {}),
|