@sema-agent/core 7.51.1 → 7.52.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 +550 -2
- package/dist/agents/agent-transcript-tool.d.ts +1 -1
- package/dist/agents/cascade.js +4 -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/read-inbox-tool.d.ts +1 -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 +5 -0
- package/dist/agents/subagent.js +7 -4
- package/dist/agents/tool-filter.d.ts +40 -13
- package/dist/agents/tool-filter.js +28 -14
- package/dist/bench/metrics.d.ts +1 -0
- package/dist/brain/anthropic.js +16 -12
- package/dist/brain/model-presets.d.ts +4 -5
- package/dist/brain/model-presets.js +4 -4
- 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 +117 -47
- package/dist/brain/route-adjudicator.js +171 -42
- package/dist/brain/route-conformance.js +2 -2
- package/dist/brain/status-sink.d.ts +18 -0
- package/dist/brain/status-sink.js +7 -0
- package/dist/core/allow-entry.d.ts +42 -8
- package/dist/core/allow-entry.js +24 -17
- package/dist/core/auto-compaction.d.ts +23 -20
- package/dist/core/auto-compaction.js +37 -16
- 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 +36 -12
- package/dist/core/checkpoint-store.js +1 -1
- package/dist/core/child-clamp-seats.d.ts +6 -0
- package/dist/core/child-clamp-seats.js +2 -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/engine-capabilities.d.ts +8 -1
- package/dist/core/engine-capabilities.js +1 -1
- package/dist/core/engine-notice.d.ts +36 -19
- package/dist/core/frontmatter-fence.d.ts +10 -0
- package/dist/core/frontmatter-fence.js +6 -0
- package/dist/core/gate-fold.js +5 -23
- package/dist/core/gate-lanes.js +356 -270
- package/dist/core/governance-codes.d.ts +9 -4
- package/dist/core/governance-codes.js +9 -3
- package/dist/core/hooks.d.ts +276 -734
- package/dist/core/hooks.js +97 -192
- 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 +26 -5
- package/dist/core/locked-config.js +31 -6
- 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 +2 -2
- package/dist/core/mcp-server-spec.d.ts +53 -7
- package/dist/core/mcp-server-spec.js +84 -1
- package/dist/core/mcp.d.ts +11 -7
- package/dist/core/mcp.js +27 -9
- 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 +8 -11
- package/dist/core/memory-engine/engine.js +9 -5
- 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 +4 -0
- package/dist/core/mode-policy.js +7 -5
- 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 +701 -0
- package/dist/core/mods/kernel/events.d.ts +242 -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 +65 -0
- package/dist/core/mods/kernel/receive.js +123 -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 +84 -0
- package/dist/core/mods/kernel/site-rules.js +104 -0
- package/dist/core/mods/stations.d.ts +350 -0
- package/dist/core/mods/stations.js +444 -0
- package/dist/core/own-property-receipt.js +11 -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-syntax.d.ts +15 -0
- package/dist/core/permission-rule-syntax.js +24 -16
- package/dist/core/permission-rules.d.ts +7 -1
- package/dist/core/permission-rules.js +26 -15
- 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/retired-keys.d.ts +4 -0
- package/dist/core/retired-keys.js +3 -0
- 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 +85 -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 +8 -2
- package/dist/core/runner/image.js +1 -2
- package/dist/core/runner/inline-image.js +1 -1
- 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/person-path-rows.js +1 -0
- 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 +5 -0
- package/dist/core/runner/prepare-config-doors.js +9 -0
- package/dist/core/runner/prepare-defer-classify.js +3 -4
- 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-inherited-gate.d.ts +8 -12
- package/dist/core/runner/prepare-inherited-gate.js +8 -21
- package/dist/core/runner/prepare-memory-engine-session.js +1 -1
- package/dist/core/runner/prepare-park-ask.js +10 -14
- package/dist/core/runner/prepare-policy-chain.d.ts +18 -16
- package/dist/core/runner/prepare-policy-chain.js +98 -101
- package/dist/core/runner/prepare-project-context.js +7 -10
- package/dist/core/runner/prepare-prompt-assembly.d.ts +45 -40
- package/dist/core/runner/prepare-prompt-assembly.js +134 -101
- package/dist/core/runner/prepare-prompt-inputs.d.ts +18 -19
- package/dist/core/runner/prepare-prompt-inputs.js +5 -7
- package/dist/core/runner/prepare-protocol-tools.d.ts +6 -4
- package/dist/core/runner/prepare-protocol-tools.js +2 -2
- 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 +33 -15
- 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 +5 -6
- package/dist/core/runner/prepare-wiring-manifest.js +7 -7
- 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-preflight.js +38 -16
- package/dist/core/runner/retired-runner-deps.js +3 -1
- 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 +62 -84
- 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 +11 -10
- 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 +33 -22
- package/dist/core/runner/run-tool-mount-facts.js +5 -3
- package/dist/core/runner/run-turn-boundary.js +23 -34
- package/dist/core/runner/runtask.d.ts +6 -7
- package/dist/core/runner/runtask.js +14 -72
- package/dist/core/runner/session-rule-policy.d.ts +6 -4
- package/dist/core/runner/session-rule-policy.js +17 -10
- 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/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 +121 -22
- package/dist/core/runner/sub-agent-deny-lists.js +228 -71
- 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 +20 -28
- package/dist/core/safety-merge-corpus.js +18 -2
- package/dist/core/secret-env.d.ts +93 -20
- package/dist/core/secret-env.js +192 -38
- package/dist/core/session-policy-store.d.ts +93 -17
- package/dist/core/session-policy-store.js +178 -25
- 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/task-event.d.ts +13 -3
- 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 +59 -18
- package/dist/core/tool-policy.js +77 -12
- 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 -1
- package/dist/core/types.js +1 -0
- 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/user-attachment.d.ts +12 -2
- package/dist/core/user-attachment.js +17 -2
- package/dist/core/wiring-manifest.d.ts +14 -13
- 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 +3 -3
- package/dist/engine/harness/types.d.ts +17 -16
- package/dist/engine/harness/types.js +7 -1
- package/dist/engine/llm/types.d.ts +12 -7
- package/dist/engine/loop/agent-loop.js +1 -1
- package/dist/engine/loop/types.d.ts +1 -1
- 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 +24 -17
- package/dist/index.js +15 -12
- package/dist/internal/harness.d.ts +1 -1
- package/dist/internal/harness.js +1 -1
- 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 +37 -56
- package/dist/prompt-assembly/artifact-store.js +31 -49
- package/dist/prompt-assembly/artifact.d.ts +89 -76
- package/dist/prompt-assembly/artifact.js +167 -146
- package/dist/prompt-assembly/assemble.d.ts +34 -29
- package/dist/prompt-assembly/assemble.js +33 -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 +59 -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 +124 -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 +24 -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 +127 -0
- package/dist/prompt-assembly/overlay.js +301 -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 +56 -0
- package/dist/prompt-assembly/select.js +69 -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 -500
- package/dist/prompts/default.js +20 -285
- package/dist/prompts/supervisor.d.ts +6 -71
- package/dist/prompts/supervisor.js +6 -117
- package/dist/stores/file/session-policy-store.d.ts +3 -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 +256 -99
- package/wire-changes/core@7.51.1.json +5 -5
- package/wire-changes/core@7.51.2.json +293 -0
- package/wire-changes/core@7.52.0.json +5859 -0
- package/dist/core/hook-seats.d.ts +0 -66
- package/dist/core/hook-seats.js +0 -37
- package/dist/prompt-assembly/packs/sema-default.d.ts +0 -2
- package/dist/prompt-assembly/packs/sema-default.js +0 -147
- package/dist/prompts/simple-sections.d.ts +0 -58
- package/dist/prompts/simple-sections.js +0 -43
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { cardDisclosureOf } from "../allow-entry.js";
|
|
2
2
|
import { primaryActivityArg } from "../arg-summary.js";
|
|
3
|
-
import {
|
|
3
|
+
import { classicEventBase, observeClassic } from "../mods/stations.js";
|
|
4
4
|
import { advertisedWritableRootsSeat, exemptRootsSeat, attest, attestationOf, isLiveApproverSeat, resolveAsk } from "../tool-policy.js";
|
|
5
5
|
import { boundInputHashOf } from "../canonical-json.js";
|
|
6
6
|
import { composeCallSignal, raceSettlementAgainstSignal } from "./abort-race.js";
|
|
@@ -10,19 +10,10 @@ import { approvalCardMemberOf } from "../tool-roster.js";
|
|
|
10
10
|
import { gateAskCarry, lateAskSettlementObserver } from "./denial-limit-arms.js";
|
|
11
11
|
import { consumeInheritedAskGrant } from "./inherited-ask-grants.js";
|
|
12
12
|
import { settleReadRootGrant } from "./read-root-grant.js";
|
|
13
|
-
function createDenyObserverNotifier(
|
|
14
|
-
if (
|
|
13
|
+
function createDenyObserverNotifier(bus, signal) {
|
|
14
|
+
if (bus === undefined || !bus.hasHandlers("classic.PermissionDenied"))
|
|
15
15
|
return undefined;
|
|
16
|
-
return
|
|
17
|
-
try {
|
|
18
|
-
const seat = await runHookSeat("permissionDenied", { timeoutMs: hookTimeoutMs, signal }, (sig) => hooks.permissionDenied({ ...payload, signal: sig }));
|
|
19
|
-
if (seat.expired)
|
|
20
|
-
report(hookSeatExpiredError("permissionDenied", hookTimeoutMs, seat.cause, "the deny observation was abandoned; the deny itself is unchanged"));
|
|
21
|
-
}
|
|
22
|
-
catch (err) {
|
|
23
|
-
report(err);
|
|
24
|
-
}
|
|
25
|
-
};
|
|
16
|
+
return (payload) => observeClassic(bus, "classic.PermissionDenied", { ...payload, ...classicEventBase(payload.identity, payload.permissionMode) }, signal);
|
|
26
17
|
}
|
|
27
18
|
const sanitizePreview = (node, depth = 0) => {
|
|
28
19
|
if (depth > 6)
|
|
@@ -61,7 +52,7 @@ function resolveApprovalPreview(tools, toolName, args) {
|
|
|
61
52
|
}
|
|
62
53
|
}
|
|
63
54
|
export function prepareAskLane(input) {
|
|
64
|
-
const { gateMachineryActive, abortController, effectivePolicy, budgetSnapshot, handsCwdRef, handsRoot, stampCallTarget, advertisedWritableDirs, exemptRoots, tools, inheritedUnavailableAsks, inheritedAskGrants, onAsk, humanReviewRef, now, ruleOffersOf, grantBindingOf, askSourceIdentity, riskAxesOf, autoModeDenialTracking, spec, deps, sessionId, runId,
|
|
55
|
+
const { gateMachineryActive, abortController, effectivePolicy, budgetSnapshot, handsCwdRef, handsRoot, stampCallTarget, advertisedWritableDirs, exemptRoots, tools, inheritedUnavailableAsks, inheritedAskGrants, onAsk, humanReviewRef, now, ruleOffersOf, grantBindingOf, askSourceIdentity, riskAxesOf, autoModeDenialTracking, spec, deps, sessionId, runId, grantReadRoot, modBus, notifyOwnHookCrash } = input;
|
|
65
56
|
if (!gateMachineryActive)
|
|
66
57
|
return { askLane: undefined };
|
|
67
58
|
const composedCallSignal = (callSignal) => composeCallSignal(abortController.signal, callSignal);
|
|
@@ -142,6 +133,6 @@ export function prepareAskLane(input) {
|
|
|
142
133
|
}
|
|
143
134
|
return resolved;
|
|
144
135
|
};
|
|
145
|
-
const notifyPermissionDenied = createDenyObserverNotifier(
|
|
136
|
+
const notifyPermissionDenied = createDenyObserverNotifier(modBus, abortController.signal);
|
|
146
137
|
return { askLane: { composedCallSignal, adjudicate, approvalPreviewOf, resolveAskBound, notifyPermissionDenied, notifyHookError: notifyOwnHookCrash } };
|
|
147
138
|
}
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
import type { AgentHarness, AgentTool, ThinkingLevel } from "../../internal/harness.js";
|
|
22
22
|
import type { Model } from "../../internal/llm.js";
|
|
23
23
|
import { forkGovernanceDenial } from "../../agents/subagent.js";
|
|
24
|
-
import type {
|
|
24
|
+
import type { PromptArtifact } from "../../prompt-assembly/artifact.js";
|
|
25
25
|
import { type WorkflowSizeGuideline } from "../../orchestration/workflow-size-guideline.js";
|
|
26
26
|
import { type AutoModeArmingRecipe } from "../auto-mode-arming.js";
|
|
27
27
|
import { type PermissionModeController } from "../mode-policy.js";
|
|
@@ -131,6 +131,8 @@ export interface PrepareCapsAndWorkflowInput {
|
|
|
131
131
|
peerLaneActive: boolean;
|
|
132
132
|
/** borrowed-readonly — the leg's effective delegation fact (`effectiveDelegationFacts`): the classifier window shows its user lane as the launching agent's. */
|
|
133
133
|
delegated: boolean;
|
|
134
|
+
/** borrowed-mutable — `Prepared.sideCallBookRef`: written by the run body (never here); the classifier books each of its replies through it. */
|
|
135
|
+
sideCallBookRef: Prepared["sideCallBookRef"];
|
|
134
136
|
/** borrowed-readonly — whether the BUILT-IN SendMessage is on this face (the lane rule's second term). */
|
|
135
137
|
peerSendMessageBuiltIn: boolean;
|
|
136
138
|
/** borrowed-readonly — the trusted Runner self-reference the Workflow mount executes children through; undefined when
|
|
@@ -140,7 +142,7 @@ export interface PrepareCapsAndWorkflowInput {
|
|
|
140
142
|
memoryEngineSession: () => Prepared["memoryEngineSession"];
|
|
141
143
|
/** borrowed-readonly — LATE-BOUND: the adopted center artifact; the Workflow mount's two center getters read it at THEIR call time. */
|
|
142
144
|
centerAdoption: () => {
|
|
143
|
-
artifact:
|
|
145
|
+
artifact: PromptArtifact;
|
|
144
146
|
sourceRevision?: string;
|
|
145
147
|
} | undefined;
|
|
146
148
|
}
|
|
@@ -117,7 +117,7 @@ function autoModeArmReasonOf(intent, facePresent, caps, capsFaulted) {
|
|
|
117
117
|
return { armed: true, reason: "armed" };
|
|
118
118
|
}
|
|
119
119
|
export async function prepareCapsAndWorkflow(input) {
|
|
120
|
-
const { spec, deps, parentSpecSeat, checkpointSeat, internals, session, sessionId, runId, hostTaskId, taskScope, taskRootFinal, model, thinking, lockedPreflight, toolEffects, toolFaceSnapshot, promptProfile, resolvedInteractionPosture, harnessRef, askSeat, runClampSource, forwardEvent, inheritedGateForChildren, enrichSpecToolCtx, maybeOffload, requestReview, enterPlanMode, permissionMode, readDenyEntries, peerLaneActive, peerSendMessageBuiltIn, runnerSelf, delegated } = input;
|
|
120
|
+
const { spec, deps, parentSpecSeat, checkpointSeat, internals, session, sessionId, runId, hostTaskId, taskScope, taskRootFinal, model, thinking, lockedPreflight, toolEffects, toolFaceSnapshot, promptProfile, resolvedInteractionPosture, harnessRef, askSeat, runClampSource, forwardEvent, inheritedGateForChildren, enrichSpecToolCtx, maybeOffload, requestReview, enterPlanMode, permissionMode, readDenyEntries, peerLaneActive, peerSendMessageBuiltIn, runnerSelf, delegated, sideCallBookRef } = input;
|
|
121
121
|
const roster = new RosterBuilder(toolEffects);
|
|
122
122
|
for (const t of spec.tools ?? []) {
|
|
123
123
|
const mounted = mountCallerTool(t);
|
|
@@ -254,13 +254,30 @@ export async function prepareCapsAndWorkflow(input) {
|
|
|
254
254
|
}
|
|
255
255
|
const classifierAuth = await spec.getApiKeyAndHeaders?.(rungModel);
|
|
256
256
|
const request = async (seat, suffix) => {
|
|
257
|
-
const
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
257
|
+
const book = sideCallBookRef.book;
|
|
258
|
+
if (book === undefined)
|
|
259
|
+
throw new Error("the auto-mode classifier was asked before the run body bound the leg's usage account, which it does before any tool call");
|
|
260
|
+
let replied = false;
|
|
261
|
+
const cut = () => {
|
|
262
|
+
if (!replied)
|
|
263
|
+
book("classifier", rungModel, undefined);
|
|
264
|
+
};
|
|
265
|
+
signal?.addEventListener("abort", cut, { once: true });
|
|
266
|
+
let response;
|
|
267
|
+
try {
|
|
268
|
+
response = await classifierRuntime.completeSimple(rungModel, { systemPrompt: classifierSystemPrompt(), messages: [{ role: "user", content: userPrompt + suffix, timestamp: Date.now() }] }, {
|
|
269
|
+
signal,
|
|
270
|
+
maxRetries: AUTO_MODE_CLASSIFIER_MAX_RETRIES,
|
|
271
|
+
...seat,
|
|
272
|
+
...(classifierAuth?.apiKey !== undefined ? { apiKey: classifierAuth.apiKey } : {}),
|
|
273
|
+
...(classifierAuth?.headers !== undefined ? { headers: classifierAuth.headers } : {}),
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
finally {
|
|
277
|
+
replied = true;
|
|
278
|
+
signal?.removeEventListener("abort", cut);
|
|
279
|
+
}
|
|
280
|
+
book("classifier", rungModel, response);
|
|
264
281
|
const failure = classifierReplyFailure(response);
|
|
265
282
|
if (failure !== undefined)
|
|
266
283
|
throw failure;
|
|
@@ -31,6 +31,7 @@ import type { RunnerDeps, TaskLimits, TaskSpec } from "../types.js";
|
|
|
31
31
|
import { type UsageWindow } from "../usage-window-store.js";
|
|
32
32
|
import { type AskSeat } from "../wiring-manifest.js";
|
|
33
33
|
import type { PrepareResume, RunInternals, ToolFaceLists } from "./contracts.js";
|
|
34
|
+
import { resolveHost } from "../../prompt-assembly/select.js";
|
|
34
35
|
import { type RosterSpec } from "./caller-roster.js";
|
|
35
36
|
export declare function limitConfigError(code: string, message: string): Error & {
|
|
36
37
|
code?: string;
|
|
@@ -143,6 +144,10 @@ export interface PrepareConfigDoorsResult {
|
|
|
143
144
|
toolFaceLists: ToolFaceLists;
|
|
144
145
|
/** owned — the profile half of the single decision point (model-independent by contract). */
|
|
145
146
|
promptProfile: "simple" | "classic";
|
|
147
|
+
/** owned — the host selector values (`TaskSpec.promptRole` / `TaskSpec.promptForm`, validated) the assembly selects on. */
|
|
148
|
+
promptHost: ReturnType<typeof resolveHost>;
|
|
149
|
+
/** owned — the center binding (`TaskSpec.promptBinding`, validated) the center layer's scoped overlays select on. */
|
|
150
|
+
promptBinding: string | undefined;
|
|
146
151
|
/** owned — the administrator lock snapshot; the rest of prepare reads guarded slots through it. */
|
|
147
152
|
lockedPreflight: LockedPreflight;
|
|
148
153
|
/** owned — the resolved interaction posture (spec > spawning run > deployment); the
|
|
@@ -14,10 +14,13 @@ import { describeRejectedValue } from "../tool-search-setting.js";
|
|
|
14
14
|
import { applyToolModelGate, assertRestoreGatedToolsValue, modelIdTail } from "../tool-model-gate.js";
|
|
15
15
|
import { resolveUsageWindows } from "../usage-window-store.js";
|
|
16
16
|
import { deriveAskEffective, resolveAskSeat, resolveQuestionSeam } from "../wiring-manifest.js";
|
|
17
|
+
import { resolveHost } from "../../prompt-assembly/select.js";
|
|
18
|
+
import { resolvePromptBinding } from "../../prompt-assembly/overlay.js";
|
|
17
19
|
import { assertPeerPresenceValue } from "../../agents/peer-directory.js";
|
|
18
20
|
import { snapshotDefinitionLists } from "../../agents/tool-filter.js";
|
|
19
21
|
import { TOTAL_TOKENS_REMINDER_MODES } from "./turn-attachments.js";
|
|
20
22
|
import { rosterFaceOf } from "./caller-roster.js";
|
|
23
|
+
import { refuseRenamedDelegationMounts } from "./sub-agent-deny-lists.js";
|
|
21
24
|
const TASK_LIMIT_KEY_DICT = {
|
|
22
25
|
maxTokens: true,
|
|
23
26
|
maxCostUsd: true,
|
|
@@ -184,6 +187,8 @@ export function prepareConfigDoors(input) {
|
|
|
184
187
|
: undefined,
|
|
185
188
|
};
|
|
186
189
|
const promptProfile = resolveModelPromptTraits({ id: "" }, spec, internals).promptProfile;
|
|
190
|
+
const promptHost = resolveHost(spec);
|
|
191
|
+
const promptBinding = resolvePromptBinding(spec);
|
|
187
192
|
if (spec.resumeAt !== undefined) {
|
|
188
193
|
if (resume) {
|
|
189
194
|
const e = new Error("resumeAt cannot be combined with a durable resume");
|
|
@@ -358,6 +363,7 @@ export function prepareConfigDoors(input) {
|
|
|
358
363
|
const usageWindows = resolveUsageWindows(deps.usageWindows);
|
|
359
364
|
const brainCallGuardrailRef = {};
|
|
360
365
|
const brainCallGuardrailMs = resolveBrainCallGuardrailMs(spec.limits?.brainCallGuardrailMs ?? deps.brainCallGuardrailMs);
|
|
366
|
+
const mountedRoster = spec.tools;
|
|
361
367
|
if (spec.agents !== undefined && spec.agents.length > 0) {
|
|
362
368
|
const pool = spec.tools ?? [];
|
|
363
369
|
if (!pool.some((t) => typeof t.withAgents === "function")) {
|
|
@@ -377,6 +383,7 @@ export function prepareConfigDoors(input) {
|
|
|
377
383
|
}),
|
|
378
384
|
};
|
|
379
385
|
}
|
|
386
|
+
refuseRenamedDelegationMounts(mountedRoster, spec.tools);
|
|
380
387
|
const resolvedRoleRaw = resolveTaskModel(spec, deps);
|
|
381
388
|
const resolvedRole = internals?.inheritedModelRef !== undefined ? { ...resolvedRoleRaw, modelRef: internals.inheritedModelRef } : resolvedRoleRaw;
|
|
382
389
|
const model = resolvedRole.model;
|
|
@@ -438,6 +445,8 @@ export function prepareConfigDoors(input) {
|
|
|
438
445
|
spec,
|
|
439
446
|
toolFaceLists,
|
|
440
447
|
promptProfile,
|
|
448
|
+
promptHost,
|
|
449
|
+
promptBinding,
|
|
441
450
|
lockedPreflight,
|
|
442
451
|
resolvedInteractionPosture,
|
|
443
452
|
askSeat,
|
|
@@ -3,6 +3,7 @@ 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";
|
|
@@ -87,8 +88,7 @@ export function prepareDeferClassify(input) {
|
|
|
87
88
|
const retractNames = memoryGroupRetractionSet(builtinDeferPairNames, memoryEnginePair.length > 0);
|
|
88
89
|
roster.unmountWhere((t) => retractNames.has(t.name));
|
|
89
90
|
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" });
|
|
91
|
+
announceMemoryNotMounted(onceLedger, sessionId, "shared", SHARED_MEMORY_TOOL_NAMES, `mounting them would inject the "${TOOL_SEARCH_NAME}" tool, whose name this task already declares`);
|
|
92
92
|
}
|
|
93
93
|
if (memoryEnginePair.length > 0) {
|
|
94
94
|
if (memoryBlock !== undefined && memoryRecallSegment !== undefined) {
|
|
@@ -100,8 +100,7 @@ export function prepareDeferClassify(input) {
|
|
|
100
100
|
else if (memoryBlock.startsWith(`${segment}\n\n`))
|
|
101
101
|
memoryBlock = memoryBlock.slice(segment.length + 2);
|
|
102
102
|
}
|
|
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" });
|
|
103
|
+
announceMemoryNotMounted(onceLedger, sessionId, "engine", MEMORY_ENGINE_TOOL_NAMES, `mounting them would inject the "${TOOL_SEARCH_NAME}" tool, whose name this task already declares`);
|
|
105
104
|
}
|
|
106
105
|
deferred = d0;
|
|
107
106
|
}
|
|
@@ -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
|
}
|
|
@@ -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,6 @@ 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 { asThrownError } from "../thrown-value.js";
|
|
17
17
|
export function prepareInheritedGate(input) {
|
|
18
18
|
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
19
|
const liveInheritedGate = internals?.inheritedGate;
|
|
@@ -117,13 +117,6 @@ export function prepareInheritedGate(input) {
|
|
|
117
117
|
const skillGrantCheckpointSection = () => frozenSkillGrants(skillGrants);
|
|
118
118
|
const frozenOnAsk = askSeat.value;
|
|
119
119
|
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
120
|
const frozenOnQuestion = spec.onQuestion ?? deps.onQuestion;
|
|
128
121
|
const parentSpecSeat = parentSpecSeatOf(spec, frozenOnQuestion);
|
|
129
122
|
const provenanceForChildrenRef = {};
|
|
@@ -142,18 +135,12 @@ export function prepareInheritedGate(input) {
|
|
|
142
135
|
const durableMandate = durableMandateSourceOf({ forceDurableGate: input.runtimeCaps()?.forceDurableGate === true, durableApprovalDeclared: spec.durableApproval !== undefined, onAsk: frozenOnAsk }) !== undefined;
|
|
143
136
|
const contentMandate = input.runtimeCaps()?.forceDurableGate === true ||
|
|
144
137
|
(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)
|
|
138
|
+
const ownInstallation = { chain: input.ownModChain, onAsk: frozenOnAsk, durableMandate, contentMandate, hookEnv: hookEnvSource, decider: autoModeDecider };
|
|
139
|
+
const hookConstraint = chainJudges(input.modBus) && !(inheritedParentConstraints ?? []).some((pc) => sameInstallation(pc, ownInstallation))
|
|
153
140
|
? [
|
|
154
141
|
{
|
|
155
|
-
policy: createPreToolUseConstraintPolicy(
|
|
156
|
-
|
|
142
|
+
policy: createPreToolUseConstraintPolicy(input.modBus, input.hookEnvFace()),
|
|
143
|
+
mods: input.ownModChain,
|
|
157
144
|
...(hookEnvSource !== undefined ? { hookEnv: hookEnvSource } : {}),
|
|
158
145
|
...(frozenOnAsk !== undefined ? { onAsk: frozenOnAsk } : {}),
|
|
159
146
|
...(durableMandate ? { durableMandate: true } : {}),
|
|
@@ -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 { recordSyncUnattestable, sessionSettlements } from "../memory-engine/del
|
|
|
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
10
|
import { thrownText } from "../thrown-value.js";
|
|
11
11
|
export function prepareMemoryEngineSession(input) {
|
|
@@ -9,7 +9,7 @@ import { pauseOf } from "../pause-registry.js";
|
|
|
9
9
|
import { askCarryRowMembers } from "../hooks.js";
|
|
10
10
|
import { askMandateMember, ownedClearanceFacts } from "../ask-origin.js";
|
|
11
11
|
import { defaultTaskRegistry } from "../task-registry.js";
|
|
12
|
-
import { advertisedWritableRootsSeat, exemptRootsSeat, isLiveApproverSeat, carriesBidiControls, describeThrown, refuseOutOfContractDecision, tryCloneArgs } from "../tool-policy.js";
|
|
12
|
+
import { advertisedWritableRootsSeat, exemptRootsSeat, isLiveApproverSeat, carriesBidiControls, describeThrown, ownArgs, refuseOutOfContractDecision, tryCloneArgs } from "../tool-policy.js";
|
|
13
13
|
import { InMemoryToolResultStore, ScopedToolResultStore, isVolatileOffloadStore } from "../tool-result-store.js";
|
|
14
14
|
import { raceAbort, raceSettlementAgainstSignal } from "./abort-race.js";
|
|
15
15
|
import { CONTENT_ASK_BINDING_CAP } from "./content-ask-bindings.js";
|
|
@@ -43,11 +43,7 @@ export function prepareParkAsk(input) {
|
|
|
43
43
|
return;
|
|
44
44
|
contentAskBindings.set(req.toolCallId, { ...entry, questionsHash, deliveryId });
|
|
45
45
|
};
|
|
46
|
-
const refuseBeforeDelivery = (code
|
|
47
|
-
kind: "delivery_failure",
|
|
48
|
-
code,
|
|
49
|
-
...(presentedInput !== undefined ? { presentedInput } : {}),
|
|
50
|
-
});
|
|
46
|
+
const refuseBeforeDelivery = (code) => ({ kind: "delivery_failure", code });
|
|
51
47
|
let retained;
|
|
52
48
|
let presented;
|
|
53
49
|
try {
|
|
@@ -59,13 +55,13 @@ export function prepareParkAsk(input) {
|
|
|
59
55
|
}
|
|
60
56
|
const retainedQuestionsHash = boundInputHashOf(retained.questions);
|
|
61
57
|
if (!Value.Check(mountedQuestionTool.parameters, retained) || validateAskQuestions(presented) !== undefined) {
|
|
62
|
-
return refuseBeforeDelivery("question.malformed_request"
|
|
58
|
+
return refuseBeforeDelivery("question.malformed_request");
|
|
63
59
|
}
|
|
64
60
|
if (contentAskBindings.size >= CONTENT_ASK_BINDING_CAP && !contentAskBindings.has(req.toolCallId)) {
|
|
65
61
|
return { kind: "unavailable", parkDeclined: true };
|
|
66
62
|
}
|
|
67
63
|
if (contentAskSignal.aborted) {
|
|
68
|
-
return { kind: "delivery_failure", code: "question.aborted"
|
|
64
|
+
return { kind: "delivery_failure", code: "question.aborted" };
|
|
69
65
|
}
|
|
70
66
|
try {
|
|
71
67
|
const facePromise = (async () => liveQuestionFace({
|
|
@@ -90,13 +86,13 @@ export function prepareParkAsk(input) {
|
|
|
90
86
|
const reading = classifyQuestionOutcome(outcome);
|
|
91
87
|
if (reading.shape === "contradictory") {
|
|
92
88
|
bindOutcome({ kind: "failed", error: new Error("the question channel returned a contradictory outcome (an unavailable answer)") }, retainedQuestionsHash);
|
|
93
|
-
return { kind: "delivery_failure", code: "question.human_channel_failed"
|
|
89
|
+
return { kind: "delivery_failure", code: "question.human_channel_failed" };
|
|
94
90
|
}
|
|
95
91
|
if (reading.shape === "unavailable")
|
|
96
|
-
return { kind: "unavailable", parkDeclined: true
|
|
92
|
+
return { kind: "unavailable", parkDeclined: true };
|
|
97
93
|
const answerSnapshot = reading.answer;
|
|
98
94
|
bindOutcome({ kind: "answered", answer: answerSnapshot }, retainedQuestionsHash);
|
|
99
|
-
return { kind: "answered"
|
|
95
|
+
return { kind: "answered" };
|
|
100
96
|
}
|
|
101
97
|
const error = settlement.tag === "threw"
|
|
102
98
|
? settlement.error
|
|
@@ -105,12 +101,11 @@ export function prepareParkAsk(input) {
|
|
|
105
101
|
return {
|
|
106
102
|
kind: "delivery_failure",
|
|
107
103
|
code: settlement.tag === "aborted" || contentAskSignal.aborted ? "question.aborted" : "question.human_channel_failed",
|
|
108
|
-
presentedInput: retained,
|
|
109
104
|
};
|
|
110
105
|
}
|
|
111
106
|
catch (err) {
|
|
112
107
|
bindOutcome({ kind: "failed", error: err }, retainedQuestionsHash);
|
|
113
|
-
return { kind: "delivery_failure", code: "question.human_channel_failed"
|
|
108
|
+
return { kind: "delivery_failure", code: "question.human_channel_failed" };
|
|
114
109
|
}
|
|
115
110
|
};
|
|
116
111
|
const suspendAsk = parkLaneArmed && checkpointStore !== undefined
|
|
@@ -180,7 +175,8 @@ export function prepareParkAsk(input) {
|
|
|
180
175
|
if (reprojectedRaced.tag === "threw")
|
|
181
176
|
throw reprojectedRaced.error;
|
|
182
177
|
const reprojected = refuseOutOfContractDecision(reprojectedRaced.value);
|
|
183
|
-
const
|
|
178
|
+
const filedAsHeld = ownArgs(parkedArgs);
|
|
179
|
+
const rewroteTheFiledValue = reprojected.updatedInput !== undefined && !(filedAsHeld.ok && samePlainValue(reprojected.updatedInput, filedAsHeld.value));
|
|
184
180
|
if (reprojected.action === "deny" || rewroteTheFiledValue) {
|
|
185
181
|
throw new ParkRefusal(`the arguments of "${req.toolName}" change shape when stored by this checkpoint backend, and the deployment's tool policy does not accept the stored shape` +
|
|
186
182
|
`${reprojected.action === "deny" && reprojected.message ? `: ${reprojected.message}` : ""} — ` +
|