@sema-agent/core 7.59.0 → 7.60.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 +564 -0
- package/dist/agents/agent-definition.d.ts +7 -0
- package/dist/agents/agent-definition.js +12 -0
- package/dist/agents/agent-transcript-tool.d.ts +2 -1
- package/dist/agents/agent-transcript-tool.js +3 -1
- package/dist/agents/child-model-seat.js +6 -3
- package/dist/agents/cumulative-stats.js +0 -1
- package/dist/agents/inherited-tool-pool.d.ts +26 -1
- package/dist/agents/inherited-tool-pool.js +22 -0
- package/dist/agents/retain-ledger.d.ts +11 -1
- package/dist/agents/retain-ledger.js +13 -2
- package/dist/agents/roster-store.d.ts +1 -1
- package/dist/agents/roster-store.js +3 -1
- package/dist/agents/send-message-tool.d.ts +8 -19
- package/dist/agents/send-message-tool.js +11 -38
- package/dist/agents/subagent.d.ts +51 -17
- package/dist/agents/subagent.js +117 -78
- package/dist/agents/tool-filter.d.ts +1 -3
- package/dist/agents/tool-filter.js +4 -12
- package/dist/bench/metrics.d.ts +3 -5
- package/dist/bench/metrics.js +0 -1
- package/dist/brain/degrading.js +3 -1
- package/dist/brain/route-adjudicator.js +3 -1
- package/dist/brain/status-sink.d.ts +7 -1
- package/dist/brain/status-sink.js +6 -0
- package/dist/brain/timeout.d.ts +3 -1
- package/dist/brain/timeout.js +18 -5
- package/dist/core/a2a.d.ts +15 -5
- package/dist/core/a2a.js +34 -19
- package/dist/core/agent-definition.d.ts +20 -0
- package/dist/core/allow-entry.d.ts +2 -0
- package/dist/core/allow-entry.js +3 -1
- package/dist/core/artifact-host.d.ts +0 -2
- package/dist/core/artifact-host.js +0 -1
- package/dist/core/auto-mode-defaults.d.ts +8 -0
- package/dist/core/auto-mode-defaults.js +1 -0
- package/dist/core/auto-mode-rebuild.d.ts +2 -1
- package/dist/core/auto-mode.d.ts +39 -4
- package/dist/core/auto-mode.js +63 -12
- package/dist/core/background-agent-store.d.ts +10 -1
- package/dist/core/background-agent-store.js +3 -2
- package/dist/core/background-shell.d.ts +12 -1
- package/dist/core/background-shell.js +12 -0
- package/dist/core/checkpoint-store.d.ts +8 -13
- package/dist/core/checkpoint-store.js +4 -3
- package/dist/core/compliance.d.ts +1 -1
- package/dist/core/credential-echo.d.ts +52 -0
- package/dist/core/credential-echo.js +65 -0
- package/dist/core/credential-vocabulary.d.ts +13 -3
- package/dist/core/credential-vocabulary.js +12 -4
- package/dist/core/cross-boundary-taint.d.ts +4 -5
- package/dist/core/engine-notice.d.ts +58 -15
- package/dist/core/frame-settlement.d.ts +5 -0
- package/dist/core/frame-settlement.js +4 -0
- package/dist/core/gate-fold.js +7 -5
- package/dist/core/gate-lanes.js +39 -8
- package/dist/core/governance-codes.d.ts +9 -1
- package/dist/core/governance-codes.js +12 -0
- package/dist/core/hands-band-screen.js +0 -1
- package/dist/core/hands-band.d.ts +0 -3
- package/dist/core/hooks.d.ts +39 -56
- package/dist/core/hooks.js +123 -77
- package/dist/core/image-admission.d.ts +104 -51
- package/dist/core/image-admission.js +170 -46
- package/dist/core/image-downsample.d.ts +36 -69
- package/dist/core/image-downsample.js +111 -73
- package/dist/core/integer-option.d.ts +21 -0
- package/dist/core/integer-option.js +13 -0
- package/dist/core/locked-config.d.ts +54 -3
- package/dist/core/locked-config.js +81 -50
- package/dist/core/mcp-call-meta.d.ts +2 -2
- package/dist/core/mcp-call-meta.js +9 -10
- package/dist/core/mcp-failure.d.ts +9 -3
- package/dist/core/mcp-failure.js +10 -0
- package/dist/core/mcp-host-seat.d.ts +92 -0
- package/dist/core/mcp-host-seat.js +131 -0
- package/dist/core/mcp-probe.d.ts +7 -2
- package/dist/core/mcp-probe.js +7 -2
- package/dist/core/mcp-server-spec.d.ts +38 -9
- package/dist/core/mcp-server-spec.js +55 -21
- package/dist/core/mcp.d.ts +17 -6
- package/dist/core/mcp.js +67 -55
- package/dist/core/memory-admission.d.ts +23 -6
- package/dist/core/memory-admission.js +19 -9
- package/dist/core/memory-engine/content-origin.d.ts +13 -0
- package/dist/core/memory-engine/content-origin.js +21 -3
- package/dist/core/memory-engine/index.d.ts +2 -1
- package/dist/core/memory-engine/index.js +2 -1
- package/dist/core/memory-engine/scope-contract.d.ts +13 -3
- package/dist/core/memory-engine/scope-contract.js +2 -2
- package/dist/core/memory-engine/sync-client.d.ts +45 -11
- package/dist/core/memory-engine/sync-client.js +82 -11
- package/dist/core/memory-engine/sync-report.d.ts +103 -0
- package/dist/core/memory-engine/sync-report.js +119 -0
- package/dist/core/memory-engine/sync.d.ts +4 -2
- package/dist/core/mode-policy.d.ts +9 -1
- package/dist/core/mode-policy.js +11 -1
- package/dist/core/model-receipt.d.ts +39 -0
- package/dist/core/model-receipt.js +139 -0
- package/dist/core/mods/agent-stations.d.ts +65 -0
- package/dist/core/mods/agent-stations.js +105 -0
- package/dist/core/mods/kernel/dispatch.d.ts +5 -1
- package/dist/core/mods/kernel/dispatch.js +4 -4
- package/dist/core/mods/kernel/events.d.ts +10 -4
- package/dist/core/mods/kernel/events.js +10 -6
- package/dist/core/mods/kernel/receive.d.ts +5 -0
- package/dist/core/mods/kernel/receive.js +10 -0
- package/dist/core/mods/lifecycle-stations.d.ts +41 -0
- package/dist/core/mods/lifecycle-stations.js +35 -0
- package/dist/core/mods/stations.d.ts +51 -59
- package/dist/core/mods/stations.js +32 -42
- package/dist/core/mods/tool-call.d.ts +10 -4
- package/dist/core/mods/tool-call.js +28 -12
- package/dist/core/mounted-mcp.d.ts +5 -0
- package/dist/core/mounted-mcp.js +2 -2
- package/dist/core/namespaced-rule-name.d.ts +7 -1
- package/dist/core/namespaced-rule-name.js +13 -2
- package/dist/core/oracle-isolation.js +1 -1
- package/dist/core/own-property-receipt.d.ts +3 -0
- package/dist/core/own-property-receipt.js +3 -0
- package/dist/core/park-selfcheck.js +8 -8
- package/dist/core/peer-seat.d.ts +63 -8
- package/dist/core/peer-seat.js +179 -34
- package/dist/core/permission-rule-consent.d.ts +0 -21
- package/dist/core/permission-rule-consent.js +1 -2
- package/dist/core/permission-rule-model.d.ts +4 -2
- package/dist/core/permission-rule-model.js +7 -6
- package/dist/core/protocol-http-auth.d.ts +14 -2
- package/dist/core/protocol-http-auth.js +16 -7
- package/dist/core/read-face-seats.d.ts +7 -5
- package/dist/core/read-face-seats.js +4 -1
- package/dist/core/redaction-marks.d.ts +4 -3
- package/dist/core/redaction-marks.js +2 -2
- package/dist/core/remote-env.d.ts +146 -98
- package/dist/core/remote-env.js +113 -14
- package/dist/core/retention.js +37 -12
- package/dist/core/retired-keys.d.ts +6 -1
- package/dist/core/retired-keys.js +4 -1
- package/dist/core/rewrite-rejudge.d.ts +12 -5
- package/dist/core/rewrite-rejudge.js +9 -5
- package/dist/core/roles.d.ts +37 -3
- package/dist/core/roles.js +126 -78
- package/dist/core/rule-owner.d.ts +3 -0
- package/dist/core/runner/assemble-result.d.ts +0 -5
- package/dist/core/runner/assemble-result.js +0 -1
- package/dist/core/runner/call-hook-stations.d.ts +17 -10
- package/dist/core/runner/call-hook-stations.js +21 -10
- package/dist/core/runner/child-tree.d.ts +7 -8
- package/dist/core/runner/child-tree.js +6 -6
- package/dist/core/runner/classifier-ladder.d.ts +10 -2
- package/dist/core/runner/classifier-ladder.js +39 -8
- package/dist/core/runner/construction-doors.js +5 -0
- package/dist/core/runner/contracts.d.ts +62 -41
- package/dist/core/runner/cross-boundary-lane.d.ts +3 -5
- package/dist/core/runner/cross-boundary-lane.js +11 -2
- package/dist/core/runner/env-capability-census.d.ts +15 -20
- package/dist/core/runner/env-capability-census.js +25 -34
- package/dist/core/runner/file-history-request.d.ts +2 -2
- package/dist/core/runner/file-history-request.js +0 -8
- package/dist/core/runner/gate-exit.d.ts +75 -7
- package/dist/core/runner/gate-exit.js +20 -1
- package/dist/core/runner/git-status-frame.d.ts +5 -2
- package/dist/core/runner/git-status-frame.js +3 -4
- package/dist/core/runner/image.d.ts +7 -2
- package/dist/core/runner/image.js +14 -8
- package/dist/core/runner/inline-image.d.ts +10 -8
- package/dist/core/runner/inline-image.js +11 -9
- package/dist/core/runner/memory-consolidation-driver.js +4 -4
- package/dist/core/runner/permission-rule-lanes.js +1 -1
- package/dist/core/runner/prepare-boundary-parks.d.ts +2 -2
- package/dist/core/runner/prepare-boundary-parks.js +3 -3
- package/dist/core/runner/prepare-caps-and-workflow.d.ts +4 -0
- package/dist/core/runner/prepare-caps-and-workflow.js +4 -3
- package/dist/core/runner/prepare-config-doors.d.ts +6 -1
- package/dist/core/runner/prepare-config-doors.js +14 -9
- package/dist/core/runner/prepare-delegation-surface.d.ts +5 -3
- package/dist/core/runner/prepare-delegation-surface.js +4 -4
- package/dist/core/runner/prepare-file-history.d.ts +10 -12
- package/dist/core/runner/prepare-file-history.js +3 -12
- package/dist/core/runner/prepare-gate-stations.d.ts +4 -3
- package/dist/core/runner/prepare-gate-stations.js +4 -3
- package/dist/core/runner/prepare-hands-readface.d.ts +3 -1
- package/dist/core/runner/prepare-hands-readface.js +15 -7
- package/dist/core/runner/prepare-inherited-gate.d.ts +5 -4
- package/dist/core/runner/prepare-inherited-gate.js +9 -5
- package/dist/core/runner/prepare-memory-engine-session.js +1 -1
- package/dist/core/runner/prepare-memory.d.ts +2 -2
- package/dist/core/runner/prepare-memory.js +2 -2
- package/dist/core/runner/prepare-park-ask.d.ts +3 -5
- package/dist/core/runner/prepare-park-ask.js +3 -8
- package/dist/core/runner/prepare-policy-chain.d.ts +5 -4
- package/dist/core/runner/prepare-policy-chain.js +120 -108
- package/dist/core/runner/prepare-project-context.js +8 -5
- package/dist/core/runner/prepare-prompt-inputs.d.ts +4 -1
- package/dist/core/runner/prepare-prompt-inputs.js +3 -2
- package/dist/core/runner/prepare-protocol-tools.d.ts +5 -3
- package/dist/core/runner/prepare-protocol-tools.js +9 -2
- package/dist/core/runner/prepare-suspend-saga.d.ts +0 -2
- package/dist/core/runner/prepare-suspend-saga.js +5 -7
- package/dist/core/runner/prepare-task.js +41 -27
- package/dist/core/runner/prepare-turn-wiring.d.ts +2 -0
- package/dist/core/runner/prepare-turn-wiring.js +7 -2
- package/dist/core/runner/prepare-wiring-manifest.d.ts +4 -3
- package/dist/core/runner/prepare-wiring-manifest.js +32 -18
- package/dist/core/runner/prepare-workspace-restore.js +3 -3
- package/dist/core/runner/resume-checkpoint-screen.js +4 -4
- package/dist/core/runner/retired-runner-deps.js +4 -1
- package/dist/core/runner/run-attachment-seats.js +3 -3
- package/dist/core/runner/run-brain-sinks.js +1 -0
- package/dist/core/runner/run-git-lane.d.ts +3 -1
- package/dist/core/runner/run-git-lane.js +1 -1
- package/dist/core/runner/run-harness-handlers.d.ts +3 -1
- package/dist/core/runner/run-harness-handlers.js +3 -1
- package/dist/core/runner/run-identity-wiring.js +1 -1
- package/dist/core/runner/run-leg.js +26 -28
- package/dist/core/runner/run-notification-lane.d.ts +3 -1
- package/dist/core/runner/run-notification-lane.js +16 -10
- package/dist/core/runner/run-settle-and-teardown.js +5 -1
- package/dist/core/runner/run-stop-and-final-verify.d.ts +4 -0
- package/dist/core/runner/run-stop-and-final-verify.js +12 -4
- package/dist/core/runner/run-turn-boundary.js +12 -7
- package/dist/core/runner/runtask.d.ts +7 -4
- package/dist/core/runner/runtask.js +19 -11
- package/dist/core/runner/skills-seat.js +2 -2
- package/dist/core/runner/sub-agent-deny-lists.js +10 -7
- package/dist/core/runner/synthetic-tools.js +2 -2
- package/dist/core/runner/tool-disclosure.js +0 -2
- package/dist/core/runner/tool-face-overlay.d.ts +1 -1
- package/dist/core/runner/tool-face-overlay.js +26 -19
- package/dist/core/runner/tool-result-media-seat.d.ts +9 -1
- package/dist/core/runner/tool-result-media-seat.js +17 -1
- package/dist/core/runner/turn-attachments.d.ts +3 -5
- package/dist/core/runner/turn-attachments.js +3 -16
- package/dist/core/runner-deps.d.ts +31 -18
- package/dist/core/secret-env.d.ts +3 -2
- package/dist/core/session-policy-store.d.ts +9 -2
- package/dist/core/session-policy-store.js +16 -1
- package/dist/core/session-store.d.ts +3 -2
- package/dist/core/session-store.js +50 -11
- package/dist/core/skill-grant.d.ts +9 -0
- package/dist/core/skill-grant.js +18 -0
- package/dist/core/store-contracts/tool-result-store-contract.d.ts +1 -1
- package/dist/core/store-contracts/tool-result-store-contract.js +37 -0
- package/dist/core/stub-env.d.ts +5 -5
- package/dist/core/stub-env.js +11 -1
- package/dist/core/swappable-deps.d.ts +17 -43
- package/dist/core/swappable-deps.js +15 -5
- package/dist/core/synthetic-read-verdict.d.ts +1 -1
- package/dist/core/task-event.d.ts +18 -2
- package/dist/core/task-notification.d.ts +88 -5
- package/dist/core/task-notification.js +130 -7
- package/dist/core/task-registry-agent.d.ts +18 -12
- package/dist/core/task-registry-agent.js +18 -6
- package/dist/core/task-registry-monitor.d.ts +7 -0
- package/dist/core/task-registry-monitor.js +28 -1
- package/dist/core/task-registry-shared.d.ts +38 -3
- package/dist/core/task-registry-shared.js +21 -7
- package/dist/core/task-registry-workflow.js +1 -1
- package/dist/core/task-registry.d.ts +50 -35
- package/dist/core/task-registry.js +64 -23
- package/dist/core/task-result.d.ts +3 -12
- package/dist/core/task-spec.d.ts +3 -6
- package/dist/core/task-stream.d.ts +1 -1
- package/dist/core/tool-catalog-entries.js +1 -1
- package/dist/core/tool-face-reader.d.ts +7 -6
- package/dist/core/tool-face-reader.js +4 -3
- package/dist/core/tool-name-aliases.d.ts +19 -0
- package/dist/core/tool-name-aliases.js +54 -2
- package/dist/core/tool-policy.d.ts +5 -4
- package/dist/core/tool-policy.js +1 -1
- package/dist/core/tool-registry.d.ts +5 -5
- package/dist/core/tool-registry.js +2 -2
- package/dist/core/tool-result-store.d.ts +88 -5
- package/dist/core/tool-result-store.js +51 -12
- package/dist/core/tool-spec.d.ts +20 -4
- package/dist/core/trace.d.ts +0 -1
- package/dist/core/types.d.ts +3 -3
- package/dist/core/types.js +1 -1
- package/dist/core/untrusted-text.js +1 -1
- package/dist/core/user-attachment.d.ts +10 -5
- package/dist/core/user-attachment.js +14 -6
- package/dist/engine/execution-env/node-execution-env.d.ts +7 -2
- package/dist/engine/execution-env/node-execution-env.js +12 -1
- package/dist/engine/harness/agent-harness.d.ts +1 -1
- package/dist/engine/harness/agent-harness.js +8 -4
- package/dist/engine/harness/types.d.ts +112 -29
- package/dist/engine/loop/agent-loop.d.ts +12 -12
- package/dist/engine/loop/agent-loop.js +153 -21
- package/dist/engine/loop/types.d.ts +9 -2
- package/dist/engine/lsp/node-lsp-manager.d.ts +3 -3
- package/dist/engine/lsp/node-lsp-manager.js +32 -13
- package/dist/index.d.ts +22 -14
- package/dist/index.js +15 -10
- package/dist/internal/harness-types.d.ts +1 -1
- package/dist/orchestration/run-workflow-tool.d.ts +9 -3
- package/dist/orchestration/run-workflow-tool.js +59 -29
- package/dist/orchestration/workflow-governance.d.ts +1 -1
- package/dist/orchestration/workflow-governance.js +2 -1
- package/dist/orchestration/workflow.d.ts +4 -0
- package/dist/orchestration/workflow.js +25 -4
- package/dist/prompts/default.d.ts +1 -10
- package/dist/prompts/default.js +0 -2
- package/dist/stores/file/background-agent-store.d.ts +1 -1
- package/dist/stores/file/background-agent-store.js +3 -1
- package/dist/stores/file/checkpoint-store.d.ts +127 -2
- package/dist/stores/file/checkpoint-store.js +19 -14
- package/dist/stores/file/file-history-store.d.ts +1 -1
- package/dist/stores/file/file-history-store.js +3 -1
- package/dist/stores/file/index.d.ts +4 -3
- package/dist/stores/file/index.js +17 -8
- package/dist/stores/file/mailbox-store.d.ts +1 -1
- package/dist/stores/file/mailbox-store.js +3 -1
- package/dist/stores/file/memory-store.d.ts +1 -1
- package/dist/stores/file/memory-store.js +3 -1
- package/dist/stores/file/session-policy-store.d.ts +1 -1
- package/dist/stores/file/session-policy-store.js +3 -1
- package/dist/stores/file/session-store.d.ts +1 -1
- package/dist/stores/file/session-store.js +3 -1
- package/dist/stores/file/shared-ledger.d.ts +26 -0
- package/dist/stores/file/shared-ledger.js +38 -9
- package/dist/stores/file/tool-result-store.d.ts +20 -2
- package/dist/stores/file/tool-result-store.js +74 -6
- package/dist/stores/file/usage-window-store.d.ts +1 -1
- package/dist/stores/file/usage-window-store.js +3 -1
- package/dist/stores/file/workflow-journal-store.d.ts +1 -11
- package/dist/stores/file/workflow-journal-store.js +3 -2
- package/dist/tools/fs/containment-face.d.ts +5 -0
- package/dist/tools/fs/encoding.d.ts +13 -4
- package/dist/tools/fs/encoding.js +17 -2
- package/dist/tools/fs/fs-bash-background-text.d.ts +7 -0
- package/dist/tools/fs/fs-bash-background-text.js +1 -0
- package/dist/tools/fs/fs-bash.d.ts +8 -4
- package/dist/tools/fs/fs-bash.js +26 -35
- package/dist/tools/fs/fs-pdf.d.ts +2 -2
- package/dist/tools/fs/fs-pdf.js +26 -21
- package/dist/tools/fs/fs-read.d.ts +5 -4
- package/dist/tools/fs/fs-read.js +35 -18
- package/dist/tools/fs/fs-search-tools.js +4 -1
- package/dist/tools/fs/fs-shared.d.ts +11 -13
- package/dist/tools/fs/fs-shared.js +11 -7
- package/dist/tools/fs/fs-write.js +5 -5
- package/dist/tools/fs/index.d.ts +14 -8
- package/dist/tools/fs/index.js +8 -4
- package/dist/tools/fs/read-floor.d.ts +44 -1
- package/dist/tools/fs/read-floor.js +35 -0
- package/dist/tools/fs/removal-targets.d.ts +9 -4
- package/dist/tools/fs/removal-targets.js +17 -9
- package/dist/tools/fs/search.d.ts +3 -3
- package/dist/tools/fs/search.js +4 -4
- package/dist/tools/monitor.d.ts +5 -4
- package/dist/tools/monitor.js +15 -8
- package/dist/tools/scheduler-tools.js +42 -4
- package/dist/tools/web.d.ts +0 -10
- package/dist/tools/web.js +1 -4
- package/package.json +4 -2
- package/test/export-surface.snapshot.json +75 -21
- package/wire-changes/core-stores-sql@7.60.0.json +30 -0
- package/wire-changes/core@7.60.0.json +3274 -0
- package/wire-changes/mods-kernel@7.60.0.json +62 -0
- package/wire-changes/primitives@7.60.0.json +30 -0
|
@@ -2,11 +2,10 @@ import { principalNameOf } from "../principal-name.js";
|
|
|
2
2
|
import { forkGovernanceDenial, resolveDelegationEntryCaps } from "../../agents/subagent.js";
|
|
3
3
|
import { isLiveQuestionFace } from "../ask-question.js";
|
|
4
4
|
import { parentSpecSeatOf } from "../parent-spec-seat.js";
|
|
5
|
-
import { createPreToolUseConstraintPolicy } from "../hooks.js";
|
|
6
5
|
import { chainJudges, sameInstallation } from "../mods/stations.js";
|
|
7
6
|
import { childClampSeats, clampSourceOf } from "../child-clamp-seats.js";
|
|
8
7
|
import { rowFollowsFloor } from "./session-rule-policy.js";
|
|
9
|
-
import {
|
|
8
|
+
import { performsIo } from "../remote-env.js";
|
|
10
9
|
import { durableMandateSourceOf } from "../tool-policy.js";
|
|
11
10
|
import { chainAnchorRecords } from "./child-tree.js";
|
|
12
11
|
import { deliverEngineNotice } from "../types.js";
|
|
@@ -17,7 +16,7 @@ import { frozenSkillGrants } from "../skill-grant.js";
|
|
|
17
16
|
import { attachRebuiltDenialTrackers, createDenialLimitStop } from "./denial-limit-arms.js";
|
|
18
17
|
import { valveLeaves } from "../../agents/tool-filter.js";
|
|
19
18
|
export function prepareInheritedGate(input) {
|
|
20
|
-
const { spec, deps, askSeat, internals, resume, sessions, sessionId, runId, hostTaskId, taskRootFinal, executionEnv, ownedEnv, lockedPreflight, pathRuleAnchors, toolFaceSnapshot, mountsCallerTool, promptLean, resolvedInteractionPosture, permissionModeSeat, handsEnabled, reportUsage, harnessRef, skillGrants, forwardEvent, subagentRetain, worktreeIsolation, requestReview, requestStopAfterTurn, enterPlanMode, reminderMark, reminderDisclosureCounts, fileHistoryEnabled, historyScope, historyRoot, historyFs, abortRun } = input;
|
|
19
|
+
const { spec, deps, askSeat, internals, resume, sessions, sessionId, runId, hostTaskId, taskRootFinal, executionEnv, ownedEnv, lockedPreflight, pathRuleAnchors, toolFaceSnapshot, mountsCallerTool, promptLean, resolvedInteractionPosture, permissionModeSeat, handsEnabled, reportUsage, harnessRef, skillGrants, forwardEvent, subagentRetain, taskArtifacts, worktreeIsolation, requestReview, requestStopAfterTurn, enterPlanMode, reminderMark, reminderDisclosureCounts, fileHistoryEnabled, historyScope, historyRoot, historyFs, abortRun } = input;
|
|
21
20
|
const liveInheritedGate = internals?.inheritedGate;
|
|
22
21
|
const seedInheritedGate = resume?.seed.inheritedGate;
|
|
23
22
|
const inheritedAncestorRules = (() => {
|
|
@@ -41,6 +40,8 @@ export function prepareInheritedGate(input) {
|
|
|
41
40
|
const inheritedShellGate = liveInheritedGate?.shellGate ?? modeSeed.shellGate;
|
|
42
41
|
const askView = askSeat.reach === "none" ? liveInheritedGate?.parentConstraints?.map((pc) => (typeof pc.onAsk === "function" ? ((({ onAsk: _person, ...rest }) => rest)(pc)) : pc)) : liveInheritedGate?.parentConstraints;
|
|
43
42
|
const chainView = askView?.map((pc, position) => {
|
|
43
|
+
if (pc.policy === undefined)
|
|
44
|
+
return pc;
|
|
44
45
|
const policy = pathRuleAnchors.onLeg(pc.policy, position);
|
|
45
46
|
return policy === pc.policy ? pc : { ...pc, policy };
|
|
46
47
|
});
|
|
@@ -147,7 +148,7 @@ export function prepareInheritedGate(input) {
|
|
|
147
148
|
: {}),
|
|
148
149
|
};
|
|
149
150
|
const hookConstraint = chainJudges(input.modBus) && !(inheritedParentConstraints ?? []).some((pc) => sameInstallation(pc, ownInstallation))
|
|
150
|
-
? [{
|
|
151
|
+
? [{ installation: input.modBus, ...(hookEnvSource !== undefined ? { hookEnv: hookEnvSource } : {}), ...regime }]
|
|
151
152
|
: [];
|
|
152
153
|
const parentConstraints = [
|
|
153
154
|
...(inheritedParentConstraints ?? []),
|
|
@@ -176,7 +177,7 @@ export function prepareInheritedGate(input) {
|
|
|
176
177
|
approvalReach: askSeat.reach,
|
|
177
178
|
});
|
|
178
179
|
const fullShellReachable = handsEnabled &&
|
|
179
|
-
|
|
180
|
+
performsIo(executionEnv) === true &&
|
|
180
181
|
spec.handsReadOnly !== true &&
|
|
181
182
|
valveLeaves(spec, toolFaceSnapshot.selector)({ name: "Bash" });
|
|
182
183
|
const { gateStopRef, stopForDenialLimit } = createDenialLimitStop({ sessionId, runId, onNotice: deps.onNotice, abort: abortRun });
|
|
@@ -186,9 +187,11 @@ export function prepareInheritedGate(input) {
|
|
|
186
187
|
const observersActive = input.observersActive();
|
|
187
188
|
const autoModeDecider = input.autoModeDecider();
|
|
188
189
|
const centerAdoption = input.centerAdoption();
|
|
190
|
+
const agentStations = input.agentStations();
|
|
189
191
|
return {
|
|
190
192
|
...ctx,
|
|
191
193
|
delegationEntryCaps: delegationEntryCapsResolved,
|
|
194
|
+
...(agentStations !== undefined ? { agentStations } : {}),
|
|
192
195
|
reportUsage,
|
|
193
196
|
model: harnessRef.current?.getModel(),
|
|
194
197
|
modelRef: harnessRef.current?.getModelRef(),
|
|
@@ -267,6 +270,7 @@ export function prepareInheritedGate(input) {
|
|
|
267
270
|
...(resolvedInteractionPosture !== undefined ? { interactionPosture: resolvedInteractionPosture } : {}),
|
|
268
271
|
...(deps.onBackgroundChildEvent ? { onBackgroundChildEvent: deps.onBackgroundChildEvent } : {}),
|
|
269
272
|
...(internals?.onTaskNotification ? { onTaskNotification: internals.onTaskNotification } : {}),
|
|
273
|
+
...(taskArtifacts !== undefined ? { taskArtifacts } : {}),
|
|
270
274
|
...(forwardEvent ? { forwardEvent } : {}),
|
|
271
275
|
...(internals?.onSubagentSpawn ? { onSubagentSpawn: internals.onSubagentSpawn } : {}),
|
|
272
276
|
...(subagentRetain ? { subagentRetain } : {}),
|
|
@@ -131,7 +131,7 @@ export function prepareMemoryEngineSession(input) {
|
|
|
131
131
|
requestedType: typeof requested === "string" ? requested : undefined,
|
|
132
132
|
faces: delegation.faces,
|
|
133
133
|
pool: delegation.pool !== undefined && delegation.inheritsMcp && mountedMcp !== undefined ? [...delegation.pool, ...mountedMcpPoolRows(mountedMcp())] : delegation.pool,
|
|
134
|
-
isPolluting: poolToolPollutes,
|
|
134
|
+
isPolluting: poolToolPollutes, ...(delegation.inheritsMcp && mountedMcp !== undefined ? { inheritedServers: mountedMcp().servers.map((m) => ({ name: m.server.name, ...(m.server.contentOrigin !== undefined ? { contentOrigin: m.server.contentOrigin } : {}) })) } : {}),
|
|
135
135
|
});
|
|
136
136
|
const result = await inner(toolCallId, params, signal, onUpdate);
|
|
137
137
|
const delivery = delegationDeliveryOf(result);
|
|
@@ -96,8 +96,8 @@ export interface PrepareMemoryInput {
|
|
|
96
96
|
captureEntitlement?: CaptureEntitlementInput;
|
|
97
97
|
/**
|
|
98
98
|
* borrowed-readonly — design/383 §2.1b: the carrier-absence verdict, judged by prepare-task from the DECLARED
|
|
99
|
-
* deployment shape:
|
|
100
|
-
*
|
|
99
|
+
* deployment shape: an execution env whose paths are not the host's (`pathsAreHostLocal` false — the per-run
|
|
100
|
+
* sandbox / stateless-replica form, whose control plane does not follow the run) with no
|
|
101
101
|
* {@link RunnerDeps.memoryCaptureRecordStore} supplied. TRUE + a `capture:"off"` declaration ⇒
|
|
102
102
|
* the declaration is refused (`config.memory_capture_unsupported`) — a promise the next resume
|
|
103
103
|
* replica cannot see is a false promise, and a loud refusal beats one.
|
|
@@ -69,7 +69,7 @@ export async function prepareMemory(input) {
|
|
|
69
69
|
deps.onError?.(new Error(verdict.faultDisclosure), { phase: "config", sessionId });
|
|
70
70
|
}
|
|
71
71
|
if (input.captureCarrierUnsupported === true) {
|
|
72
|
-
const e = new Error(`memory.capture:"off" cannot be honored on this deployment shape: the execution environment
|
|
72
|
+
const e = new Error(`memory.capture:"off" cannot be honored on this deployment shape: the execution environment's paths are not the host's (remote/per-run) ` +
|
|
73
73
|
`and no RunnerDeps.memoryCaptureRecordStore is supplied, so core cannot know the control plane survives to a ` +
|
|
74
74
|
`resume replica — a privacy promise that silently expires at the first resume is refused rather than made. A ` +
|
|
75
75
|
`deployment whose control plane IS durable (a single persistent host using a remote sandbox) opts back in by ` +
|
|
@@ -636,7 +636,7 @@ export async function prepareMemory(input) {
|
|
|
636
636
|
if (verdict.faultDisclosure !== undefined)
|
|
637
637
|
deps.onError?.(new Error(verdict.faultDisclosure), { phase: "config", sessionId });
|
|
638
638
|
if (input.captureCarrierUnsupported === true) {
|
|
639
|
-
const e = new Error(`memory capture opt-out cannot be honored on this deployment shape: the execution environment
|
|
639
|
+
const e = new Error(`memory capture opt-out cannot be honored on this deployment shape: the execution environment's paths are not the host's (remote/per-run) ` +
|
|
640
640
|
`and no RunnerDeps.memoryCaptureRecordStore is supplied — the record would not survive to a resume replica. Nothing was recorded.`);
|
|
641
641
|
e.code = "config.memory_capture_unsupported";
|
|
642
642
|
throw e;
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
* Both closures exist exactly when the ask lane and the saga do (the same predicate) — an absent lane answers two absent
|
|
20
20
|
* closures, so the orchestrator grows no branch.
|
|
21
21
|
*/
|
|
22
|
-
import type { AgentHarness, AgentMessage, AgentTool
|
|
22
|
+
import type { AgentHarness, AgentMessage, AgentTool } from "../../internal/harness.js";
|
|
23
23
|
import { type CallTargetStamp } from "../effective-path-target.js";
|
|
24
24
|
import { type OnQuestion } from "../ask-question.js";
|
|
25
25
|
import { type CheckpointStore } from "../checkpoint-store.js";
|
|
@@ -110,10 +110,8 @@ export interface PrepareParkAskInput {
|
|
|
110
110
|
exemptRoots: readonly string[];
|
|
111
111
|
/** borrowed-readonly — the run's offload store, or undefined (a volatile store holding results refuses the park). */
|
|
112
112
|
offloadStore: ToolResultStore | undefined;
|
|
113
|
-
/** borrowed-readonly — the per-task
|
|
114
|
-
|
|
115
|
-
/** borrowed-readonly — the restore-incomplete adapter's missing members, or undefined (names the actual gap in the refusal). */
|
|
116
|
-
incompleteSuspendAdapter: readonly ("resumeVM" | "postResumeInit")[] | undefined;
|
|
113
|
+
/** borrowed-readonly — why the per-task env is in neither suspend target, or undefined (the park refuses, naming the gap). */
|
|
114
|
+
suspendTargetGap: string | undefined;
|
|
117
115
|
/** borrowed-readonly — the acquired session; `getLeafId` (the resume point) and `buildContext` (the batch position) are read. */
|
|
118
116
|
session: Pick<Prepared["session"], "getLeafId" | "buildContext">;
|
|
119
117
|
/** borrowed-readonly — the session store; only the optional `pin` is called (best-effort, after commit). */
|
|
@@ -30,7 +30,7 @@ const wordlessDemand = (toolName) => {
|
|
|
30
30
|
throw new Error(`a real-approval demand for "${toolName}" reached the park with no origin word — the origin stamp precedes every park`);
|
|
31
31
|
};
|
|
32
32
|
export function prepareParkAsk(input) {
|
|
33
|
-
const { askLane, saga, spec, deps, sessionId, checkpointStore, checkpointScope, toolRosterDeltas, parkLaneArmed, contentAskRoutable, liveQuestionFace, mountedQuestionTool, contentAskBindings, lateStrandedAnswers, discloseStrandedAnswers, onAsk, runtimeCaps, inheritedUnavailableAsks, basePolicyForResumeEdit, budgetSnapshot, handsCwdRef, handsRoot, stampCallTarget, shellReadLandings, advertisedWritableDirs, exemptRoots, offloadStore,
|
|
33
|
+
const { askLane, saga, spec, deps, sessionId, checkpointStore, checkpointScope, toolRosterDeltas, parkLaneArmed, contentAskRoutable, liveQuestionFace, mountedQuestionTool, contentAskBindings, lateStrandedAnswers, discloseStrandedAnswers, onAsk, runtimeCaps, inheritedUnavailableAsks, basePolicyForResumeEdit, budgetSnapshot, handsCwdRef, handsRoot, stampCallTarget, shellReadLandings, advertisedWritableDirs, exemptRoots, offloadStore, suspendTargetGap, session, sessions, suspendChainBase, maxSuspends, remoteEnvFailures, shellGatedTools, irreversibilityTier, toolMarkSources, effectiveShellGate, durableApproval, priorLedger, liveSpendRef, resourceTotal, ruleOffersOf, grantBindingOf, now, humanReviewRef, abortController, harness, pausedRef } = input;
|
|
34
34
|
if (askLane === undefined || saga === undefined)
|
|
35
35
|
return { parkAsk: undefined };
|
|
36
36
|
const { composedCallSignal, approvalPreviewOf } = askLane;
|
|
@@ -197,13 +197,8 @@ export function prepareParkAsk(input) {
|
|
|
197
197
|
"holds offloaded results that are lost across a cross-replica resume); inject " +
|
|
198
198
|
"RunnerDeps.toolResultStore or disable offload.");
|
|
199
199
|
}
|
|
200
|
-
if (
|
|
201
|
-
throw new ParkRefusal(
|
|
202
|
-
? `durable suspend is not supported with this per-task executionEnvFactory env: it declares capabilities.suspendable but its adapter does not implement ${incompleteSuspendAdapter.join(" or ")}, so a snapshot taken now could never be restored. Implement the full RemoteExecutionEnv restore surface, or declare capabilities.suspendable:false if the workspace is externally durable (the park-only lane).`
|
|
203
|
-
: "durable suspend is not supported with a non-remote per-task executionEnvFactory env: the " +
|
|
204
|
-
"minted env is destroyed on suspend, so a resumed file/shell tool would act on a fresh " +
|
|
205
|
-
"(empty) env. Use a RemoteExecutionEnv factory (it is paused, not destroyed) or a static, " +
|
|
206
|
-
"caller-owned RunnerDeps.executionEnv.");
|
|
200
|
+
if (suspendTargetGap !== undefined) {
|
|
201
|
+
throw new ParkRefusal(`durable suspend is not supported with this per-task executionEnvFactory env: it ${suspendTargetGap}, so no resumable checkpoint can be taken. Use a RemoteExecutionEnv factory that declares capabilities.suspendable — true with the full restore surface, or false if the workspace is externally durable (the park-only lane) — or a static, caller-owned RunnerDeps.executionEnv.`);
|
|
207
202
|
}
|
|
208
203
|
const leafId = await session.getLeafId();
|
|
209
204
|
if (!leafId) {
|
|
@@ -23,7 +23,7 @@ import type { AgentTool } from "../../internal/harness.js";
|
|
|
23
23
|
import type { ExecutionEnv } from "../../internal/harness.js";
|
|
24
24
|
import { type AskClass } from "../ask-class.js";
|
|
25
25
|
import type { AutoModeDecider } from "../auto-mode.js";
|
|
26
|
-
import { type
|
|
26
|
+
import { type InheritedInstallation, type LegModBus, type ModChainLink } from "../mods/stations.js";
|
|
27
27
|
import type { LockedPreflight } from "../locked-config.js";
|
|
28
28
|
import { type SessionPermissionRules } from "../session-policy-store.js";
|
|
29
29
|
import { type OnAsk, type ToolPolicy } from "../tool-policy.js";
|
|
@@ -210,9 +210,10 @@ export interface PreparePolicyChainResult {
|
|
|
210
210
|
/** borrowed-mutable — the inherited-unavailable marker channel. Writers: the inherited arms here (mark); the gate station
|
|
211
211
|
* (the lifecycle-end sweep) and the park lane's consumers (delete on consumption). */
|
|
212
212
|
inheritedUnavailableAsks: Set<string>;
|
|
213
|
-
/** owned — the inherited installations THIS leg's gate
|
|
214
|
-
* leg's own gate does not stand in for
|
|
215
|
-
|
|
213
|
+
/** owned — the inherited installations THIS leg's gate judges its calls on after its own bus (`classic.PreToolUse` at phase 1,
|
|
214
|
+
* `tool.check` at the verdict read; every screening entry the leg's own gate does not stand in for), each with the environment
|
|
215
|
+
* face it was installed against and the settlement its question takes. */
|
|
216
|
+
inheritedInstallations: readonly InheritedInstallation[];
|
|
216
217
|
/** owned — the inherited stations' MODE ARBITRATIONS by tool call (a release or a refusal made inside the fold,
|
|
217
218
|
* where an ancestor's ask is arbitrated before its frozen approver). Writers: the three inherited stations here; the gate's
|
|
218
219
|
* exit reads it onto the disposition and the gate station deletes it at the call's end. */
|
|
@@ -4,7 +4,8 @@ import { policyAskClassOf } from "../ask-class.js";
|
|
|
4
4
|
import { ASK_USER_QUESTION_TOOL_NAME, isEngineQuestionFace } from "../ask-question.js";
|
|
5
5
|
import { classifierUnavailableSeat } from "./classifier-ladder.js";
|
|
6
6
|
import { resolveCheckpointStore } from "../checkpoint-store.js";
|
|
7
|
-
import { chainJudges,
|
|
7
|
+
import { chainJudges, inheritedInstallations, standsInFor } from "../mods/stations.js";
|
|
8
|
+
import { createHookEnvCapabilities } from "../hooks.js";
|
|
8
9
|
import { isCoveringRuleName, ruleNameCovers } from "../namespaced-rule-name.js";
|
|
9
10
|
import { isIsolated } from "../remote-env.js";
|
|
10
11
|
import { deliverEngineNotice } from "../engine-notice.js";
|
|
@@ -62,6 +63,14 @@ export async function preparePolicyChain(input) {
|
|
|
62
63
|
const verdict = judgeRuleToolName(n, known, kind);
|
|
63
64
|
const twin = verdict.kind === "current" && layer !== "ancestor_session_rules" ? nearMissSpellingOf(n, rootFacing) : undefined;
|
|
64
65
|
const stale = verdict.kind !== "current" ? verdict : twin !== undefined ? { kind: "case_twin", twin, carrier: known.has(twin) || callerNames.has(twin) ? "run" : pool.names.has(twin) ? "pool" : "catalog" } : undefined;
|
|
66
|
+
if (stale?.kind === "retired" && kind === "allow") {
|
|
67
|
+
unmatched.add(`"${n}" (allow — a retired tool name: ${stale.guidance})`);
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
if (stale?.kind === "unmintable_segment" && stale.ambiguous === true && kind === "allow") {
|
|
71
|
+
unmatched.add(`"${n}" (allow — ${stale.guidance}${stale.currentName !== undefined ? ` Write "${stale.currentName}".` : ""})`);
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
65
74
|
if (stale !== undefined) {
|
|
66
75
|
const entry = `tool policy ${kind}-list entry "${n}"`;
|
|
67
76
|
let message;
|
|
@@ -448,7 +457,7 @@ export async function preparePolicyChain(input) {
|
|
|
448
457
|
if (judged.kind === "deny")
|
|
449
458
|
return settledAs(judged.result);
|
|
450
459
|
const { ask: inheritedAsk, fallback } = judged;
|
|
451
|
-
if (fallback === undefined && sandboxAdmissionArmed && policyAskClassOf(pc.policy) === "sandbox_local" && !sandboxBoundaryCapable(creq) && judged.classification.row.sandboxAdmission) {
|
|
460
|
+
if (fallback === undefined && sandboxAdmissionArmed && pc.policy !== undefined && policyAskClassOf(pc.policy) === "sandbox_local" && !sandboxBoundaryCapable(creq) && judged.classification.row.sandboxAdmission) {
|
|
452
461
|
recordAncestorSandboxAdmission(creq.toolCallId, creq.toolName);
|
|
453
462
|
return settledAs(decision.updatedInput !== undefined ? { action: "allow", updatedInput: decision.updatedInput, decisionReason: "sandbox" } : { action: "allow", decisionReason: "sandbox" });
|
|
454
463
|
}
|
|
@@ -484,119 +493,122 @@ export async function preparePolicyChain(input) {
|
|
|
484
493
|
return { kind: "approved", resolved, askWaitMs, classes: askClassMembersOf(judged.classification).classes };
|
|
485
494
|
};
|
|
486
495
|
const legStandsIn = (pc) => standsInFor(pc, { chain: ownModChain, onAsk: frozenOnAsk, hookEnv: hookEnvSource, decider: autoModeDecider() }, ownChainJudges);
|
|
487
|
-
const parentConstraintWrappers = (inheritedParentConstraints ?? []).
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
action: "
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
if (isDelegatedQuestion(creq)) {
|
|
511
|
-
if (pc.contentMandate !== true || markInheritedUnavailable(creq.toolCallId))
|
|
496
|
+
const parentConstraintWrappers = (inheritedParentConstraints ?? []).flatMap((pc) => {
|
|
497
|
+
const ancestorPolicy = pc.policy;
|
|
498
|
+
if (ancestorPolicy === undefined)
|
|
499
|
+
return [];
|
|
500
|
+
return [
|
|
501
|
+
policy !== undefined && ancestorPolicy === policy
|
|
502
|
+
? {
|
|
503
|
+
check: async function arbitrate(creq, csignal) {
|
|
504
|
+
const recorded = sharedFirstDecision.get(creq.toolCallId);
|
|
505
|
+
const first = recorded?.decision;
|
|
506
|
+
const stale = recorded !== undefined && !sameBytes(creq, recorded.decision.updatedInput !== undefined ? recorded.decision.updatedInput : recorded.judged, creq.args);
|
|
507
|
+
if (recorded !== undefined)
|
|
508
|
+
noteArbitration(creq.toolCallId, arbitrate, stale);
|
|
509
|
+
if (stale)
|
|
510
|
+
return { action: "allow" };
|
|
511
|
+
if (first === undefined) {
|
|
512
|
+
return {
|
|
513
|
+
action: "deny",
|
|
514
|
+
message: `inherited parent policy could not be arbitrated for "${creq.toolName}" ` +
|
|
515
|
+
`(shared-instance first decision unavailable); denied fail-closed`,
|
|
516
|
+
};
|
|
517
|
+
}
|
|
518
|
+
if (first.action === "deny")
|
|
512
519
|
return first;
|
|
520
|
+
if (first.action === "allow")
|
|
521
|
+
return { action: "allow" };
|
|
522
|
+
if (isDelegatedQuestion(creq)) {
|
|
523
|
+
if (pc.contentMandate !== true || markInheritedUnavailable(creq.toolCallId))
|
|
524
|
+
return first;
|
|
525
|
+
return {
|
|
526
|
+
action: "deny",
|
|
527
|
+
message: `inherited parent policy requires durable handling of the question raised for "${creq.toolName}" and the marker channel is at capacity — ` +
|
|
528
|
+
`denied fail-closed (tighten-only)`,
|
|
529
|
+
};
|
|
530
|
+
}
|
|
531
|
+
if (pc.durableMandate === true) {
|
|
532
|
+
if (mandatedCallFloats(creq.toolCallId))
|
|
533
|
+
return first;
|
|
534
|
+
return mandateUnreconstructibleDeny(creq);
|
|
535
|
+
}
|
|
536
|
+
const judged = await judgeInheritedClassifier({ liveMode: () => permissionMode.current, autoMode: pc.autoMode, ask: first, req: creq, signal: csignal ?? abortController.signal, subject: "this call", facts: inheritedStationFacts(creq), unavailableSeat: classifierUnavailableSeat({ station: "ancestor", ...(pc.autoMode?.decider.timeoutMs !== undefined ? { budgetMs: pc.autoMode.decider.timeoutMs } : {}), route: frozenApproverRoute(pc.onAsk), onNotice: deps.onNotice, sessionId, runId }) });
|
|
537
|
+
if (judged.kind === "allow")
|
|
538
|
+
return judged.result;
|
|
539
|
+
if (judged.kind === "deny")
|
|
540
|
+
return judged.result;
|
|
541
|
+
const { ask: inheritedAsk, fallback } = judged;
|
|
542
|
+
if (fallback === undefined && sandboxAdmissionArmed && policyAskClassOf(ancestorPolicy) === "sandbox_local" && !sandboxBoundaryCapable(creq) && judged.classification.row.sandboxAdmission) {
|
|
543
|
+
recordAncestorSandboxAdmission(creq.toolCallId, creq.toolName);
|
|
544
|
+
return { action: "allow", decisionReason: "sandbox" };
|
|
545
|
+
}
|
|
546
|
+
const arbitrated = arbitrateInherited(inheritedAsk, creq.toolCallId, judged);
|
|
547
|
+
if (arbitrated !== undefined)
|
|
548
|
+
return arbitrated;
|
|
549
|
+
const presentedArgs = creq.args;
|
|
550
|
+
const askT0 = now();
|
|
551
|
+
const { resolved, judged: settled } = await resolveInheritedAsk(judged, (j) => resolveAsk({
|
|
552
|
+
toolName: creq.toolName,
|
|
553
|
+
toolCallId: creq.toolCallId,
|
|
554
|
+
args: presentedArgs,
|
|
555
|
+
...ruleOffersOf(creq, presentedArgs, ancestorFacts(j.ask.action === "ask" ? j.ask : undefined)),
|
|
556
|
+
...cardDisclosureOf(j.ask, inheritedAskFallbackMessage(creq.toolName)),
|
|
557
|
+
...askSourceIdentity(),
|
|
558
|
+
...riskAxesOf(creq),
|
|
559
|
+
...approvalCardMemberOf(creq),
|
|
560
|
+
...grantBindingOf(creq, presentedArgs),
|
|
561
|
+
...(j.ask.action === "ask" && j.ask.requiresRealApproval === true ? { requiresRealApproval: true } : {}),
|
|
562
|
+
...askMandateMember(ancestorFacts(j.ask.action === "ask" ? j.ask : undefined)),
|
|
563
|
+
...inheritedAskCarry(j, isLiveApproverSeat(pc.onAsk), pc.autoMode?.denialTracking),
|
|
564
|
+
ruleEvidence: inheritedAskEvidence,
|
|
565
|
+
}, pc.onAsk, csignal ?? abortController.signal, lateAskSettlementObserver({ toolName: creq.toolName, toolCallId: creq.toolCallId, sessionId, runId, ...(spec.taskId !== undefined ? { taskId: spec.taskId } : {}), onNotice: deps.onNotice, onError: deps.onError })), pc.autoMode?.denialTracking, creq, inheritedStationFacts(creq));
|
|
566
|
+
void settleReadRootGrant(resolved.readRootGrant, undefined, { toolName: creq.toolName, toolCallId: creq.toolCallId, sessionId, runId, ...(spec.taskId !== undefined ? { taskId: spec.taskId } : {}), onNotice: deps.onNotice });
|
|
567
|
+
const askWaitMs = Math.max(0, now() - askT0);
|
|
568
|
+
if (resolved.action === "deny" && resolved.approverUnavailable === true) {
|
|
569
|
+
if (markInheritedUnavailable(creq.toolCallId))
|
|
570
|
+
return settled.ask;
|
|
571
|
+
return markerChannelFullDeny(creq);
|
|
572
|
+
}
|
|
573
|
+
settleDenialLimitFallback({ fallback: settled.fallback, mintedHere: settled.mintedHere, tracker: pc.autoMode?.denialTracking, resolved, headless: headlessDenyAtFold, stop: stopForDenialLimit, toolName: creq.toolName, toolCallId: creq.toolCallId });
|
|
574
|
+
if (resolved.action !== "allow")
|
|
575
|
+
return resolved;
|
|
576
|
+
if (resolved.updatedInput !== undefined) {
|
|
577
|
+
return recheckApprovedEdit(ancestorPolicy, pc.onAsk, creq, resolved.updatedInput, resolved, csignal, pc.autoMode);
|
|
578
|
+
}
|
|
579
|
+
recordInheritedAskGrant(creq.toolCallId, pc.onAsk, resolved.presentedInput, askWaitMs, resolved, askClassMembersOf(settled.classification).classes);
|
|
580
|
+
return { action: "allow", decisionReason: "mode" };
|
|
581
|
+
},
|
|
582
|
+
}
|
|
583
|
+
: wrapToolPolicy(ancestorPolicy, async (creq, csignal) => {
|
|
584
|
+
let decision;
|
|
585
|
+
try {
|
|
586
|
+
decision = refuseOutOfContractDecision(await ancestorPolicy.check(creq, csignal ?? abortController.signal), { call: creq });
|
|
587
|
+
}
|
|
588
|
+
catch (err) {
|
|
589
|
+
reportPolicyThrow(notifyOwnHookCrash, "an inherited parent policy", creq, err, csignal ?? abortController.signal);
|
|
513
590
|
return {
|
|
514
591
|
action: "deny",
|
|
515
|
-
message: `inherited parent policy
|
|
516
|
-
`denied fail-closed (tighten-only)`,
|
|
592
|
+
message: `inherited parent policy errored for "${creq.toolName}": ${policyThrowLine(err)}`,
|
|
517
593
|
};
|
|
518
594
|
}
|
|
519
|
-
if (
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
const
|
|
525
|
-
if (judged.kind === "allow")
|
|
526
|
-
return judged.result;
|
|
527
|
-
if (judged.kind === "deny")
|
|
528
|
-
return judged.result;
|
|
529
|
-
const { ask: inheritedAsk, fallback } = judged;
|
|
530
|
-
if (fallback === undefined && sandboxAdmissionArmed && policyAskClassOf(pc.policy) === "sandbox_local" && !sandboxBoundaryCapable(creq) && judged.classification.row.sandboxAdmission) {
|
|
531
|
-
recordAncestorSandboxAdmission(creq.toolCallId, creq.toolName);
|
|
532
|
-
return { action: "allow", decisionReason: "sandbox" };
|
|
533
|
-
}
|
|
534
|
-
const arbitrated = arbitrateInherited(inheritedAsk, creq.toolCallId, judged);
|
|
535
|
-
if (arbitrated !== undefined)
|
|
536
|
-
return arbitrated;
|
|
537
|
-
const presentedArgs = creq.args;
|
|
538
|
-
const askT0 = now();
|
|
539
|
-
const { resolved, judged: settled } = await resolveInheritedAsk(judged, (j) => resolveAsk({
|
|
540
|
-
toolName: creq.toolName,
|
|
541
|
-
toolCallId: creq.toolCallId,
|
|
542
|
-
args: presentedArgs,
|
|
543
|
-
...ruleOffersOf(creq, presentedArgs, ancestorFacts(j.ask.action === "ask" ? j.ask : undefined)),
|
|
544
|
-
...cardDisclosureOf(j.ask, inheritedAskFallbackMessage(creq.toolName)),
|
|
545
|
-
...askSourceIdentity(),
|
|
546
|
-
...riskAxesOf(creq),
|
|
547
|
-
...approvalCardMemberOf(creq),
|
|
548
|
-
...grantBindingOf(creq, presentedArgs),
|
|
549
|
-
...(j.ask.action === "ask" && j.ask.requiresRealApproval === true ? { requiresRealApproval: true } : {}),
|
|
550
|
-
...askMandateMember(ancestorFacts(j.ask.action === "ask" ? j.ask : undefined)),
|
|
551
|
-
...inheritedAskCarry(j, isLiveApproverSeat(pc.onAsk), pc.autoMode?.denialTracking),
|
|
552
|
-
ruleEvidence: inheritedAskEvidence,
|
|
553
|
-
}, pc.onAsk, csignal ?? abortController.signal, lateAskSettlementObserver({ toolName: creq.toolName, toolCallId: creq.toolCallId, sessionId, runId, ...(spec.taskId !== undefined ? { taskId: spec.taskId } : {}), onNotice: deps.onNotice, onError: deps.onError })), pc.autoMode?.denialTracking, creq, inheritedStationFacts(creq));
|
|
554
|
-
void settleReadRootGrant(resolved.readRootGrant, undefined, { toolName: creq.toolName, toolCallId: creq.toolCallId, sessionId, runId, ...(spec.taskId !== undefined ? { taskId: spec.taskId } : {}), onNotice: deps.onNotice });
|
|
555
|
-
const askWaitMs = Math.max(0, now() - askT0);
|
|
556
|
-
if (resolved.action === "deny" && resolved.approverUnavailable === true) {
|
|
557
|
-
if (markInheritedUnavailable(creq.toolCallId))
|
|
558
|
-
return settled.ask;
|
|
559
|
-
return markerChannelFullDeny(creq);
|
|
560
|
-
}
|
|
561
|
-
settleDenialLimitFallback({ fallback: settled.fallback, mintedHere: settled.mintedHere, tracker: pc.autoMode?.denialTracking, resolved, headless: headlessDenyAtFold, stop: stopForDenialLimit, toolName: creq.toolName, toolCallId: creq.toolCallId });
|
|
562
|
-
if (resolved.action !== "allow")
|
|
563
|
-
return resolved;
|
|
595
|
+
if (decision.action !== "ask")
|
|
596
|
+
return decision;
|
|
597
|
+
const settled = await settleInstallationAsk(pc, decision, creq, csignal);
|
|
598
|
+
if (settled.kind === "settled")
|
|
599
|
+
return settled.result;
|
|
600
|
+
const { resolved } = settled;
|
|
564
601
|
if (resolved.updatedInput !== undefined) {
|
|
565
|
-
return recheckApprovedEdit(
|
|
602
|
+
return recheckApprovedEdit(ancestorPolicy, pc.onAsk, creq, resolved.updatedInput, resolved, csignal, pc.autoMode);
|
|
566
603
|
}
|
|
567
|
-
recordInheritedAskGrant(creq.toolCallId, pc.onAsk, resolved.presentedInput, askWaitMs, resolved, askClassMembersOf(settled.classification).classes);
|
|
568
|
-
return { action: "allow", decisionReason: "mode" };
|
|
569
|
-
},
|
|
570
|
-
}
|
|
571
|
-
: wrapToolPolicy(pc.policy, async (creq, csignal) => {
|
|
572
|
-
let decision;
|
|
573
|
-
try {
|
|
574
|
-
decision = refuseOutOfContractDecision(await pc.policy.check(creq, csignal ?? abortController.signal), { call: creq });
|
|
575
|
-
}
|
|
576
|
-
catch (err) {
|
|
577
|
-
reportPolicyThrow(notifyOwnHookCrash, "an inherited parent policy", creq, err, csignal ?? abortController.signal);
|
|
578
|
-
return {
|
|
579
|
-
action: "deny",
|
|
580
|
-
message: `inherited parent policy errored for "${creq.toolName}": ${policyThrowLine(err)}`,
|
|
581
|
-
};
|
|
582
|
-
}
|
|
583
|
-
if (decision.action !== "ask")
|
|
584
|
-
return decision;
|
|
585
|
-
const settled = await settleInstallationAsk(pc, decision, creq, csignal);
|
|
586
|
-
if (settled.kind === "settled")
|
|
587
|
-
return settled.result;
|
|
588
|
-
const { resolved } = settled;
|
|
589
|
-
if (resolved.updatedInput !== undefined) {
|
|
590
|
-
return recheckApprovedEdit(pc.policy, pc.onAsk, creq, resolved.updatedInput, resolved, csignal, pc.autoMode);
|
|
591
|
-
}
|
|
592
|
-
if (screeningInstallationsOf([pc]).length === 0) {
|
|
593
604
|
recordInheritedAskGrant(creq.toolCallId, pc.onAsk, resolved.presentedInput, settled.askWaitMs, resolved, settled.classes);
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
return resolved;
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
605
|
+
if (decision.updatedInput === undefined)
|
|
606
|
+
return resolved;
|
|
607
|
+
return { ...resolved, updatedInput: decision.updatedInput };
|
|
608
|
+
}),
|
|
609
|
+
];
|
|
610
|
+
});
|
|
611
|
+
const installationsOnLeg = inheritedInstallations(inheritedParentConstraints ?? [], legStandsIn, (pc) => (typeof pc.hookEnv === "object" && pc.hookEnv !== null ? createHookEnvCapabilities(pc.hookEnv) : undefined), (pc) => async (ask, creq, csignal) => {
|
|
600
612
|
const settled = await settleInstallationAsk(pc, ask, creq, csignal);
|
|
601
613
|
return settled.kind === "settled" ? settled.result : settled.resolved;
|
|
602
614
|
});
|
|
@@ -656,7 +668,7 @@ export async function preparePolicyChain(input) {
|
|
|
656
668
|
return decision;
|
|
657
669
|
})
|
|
658
670
|
: foldedPolicy;
|
|
659
|
-
return { basePolicyForResumeEdit, denyNarrowingPolicy, skillGrantLane, allowEntryLanes, policyLayers, effectivePolicy, inheritedUnavailableAsks, inheritedAskGrants, askSourceIdentity, riskAxesOf, ruleOffersOf, grantBindingOf, permissionRuleLane, ruleLaneFacts, permissionRuleOrgLane, sandboxAdmissionArmed, sandboxBoundaryCapable, emitSandboxAdmitted, foldAskClasses, ancestorSandboxAdmissions, ancestorArbitrations,
|
|
671
|
+
return { basePolicyForResumeEdit, denyNarrowingPolicy, skillGrantLane, allowEntryLanes, policyLayers, effectivePolicy, inheritedUnavailableAsks, inheritedAskGrants, askSourceIdentity, riskAxesOf, ruleOffersOf, grantBindingOf, permissionRuleLane, ruleLaneFacts, permissionRuleOrgLane, sandboxAdmissionArmed, sandboxBoundaryCapable, emitSandboxAdmitted, foldAskClasses, ancestorSandboxAdmissions, ancestorArbitrations, inheritedInstallations: installationsOnLeg };
|
|
660
672
|
}
|
|
661
673
|
const advisedPolicyNames = new WeakMap();
|
|
662
674
|
const ADVISED_KEYS_CAP = 64;
|
|
@@ -48,9 +48,9 @@ export async function prepareProjectContext(input) {
|
|
|
48
48
|
catch {
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
-
let loaded
|
|
51
|
+
let loaded;
|
|
52
52
|
try {
|
|
53
|
-
|
|
53
|
+
const answered = await Promise.resolve(loadProjectMemory.call(deps, {
|
|
54
54
|
cwd: taskRootFinal,
|
|
55
55
|
handsEnabled,
|
|
56
56
|
isSubagent: delegation.isNonForkChild,
|
|
@@ -59,13 +59,16 @@ export async function prepareProjectContext(input) {
|
|
|
59
59
|
runId,
|
|
60
60
|
phase: projectMemoryPhase,
|
|
61
61
|
}));
|
|
62
|
+
if (answered === null || typeof answered !== "object")
|
|
63
|
+
throw new Error(`RunnerDeps.loadProjectMemory answered ${answered === null ? "null" : typeof answered} — the answer is a ProjectMemoryLoad object ({ content: string | null, … }); answer { content: null } for no project layer. Not read: this leg runs with no project layer.`);
|
|
64
|
+
loaded = answered;
|
|
62
65
|
}
|
|
63
66
|
catch (err) {
|
|
64
67
|
deps.onError?.(asThrownError(err), { phase: "config", sessionId });
|
|
65
68
|
}
|
|
66
|
-
const projectMem = loaded
|
|
67
|
-
const seededFiles = loaded
|
|
68
|
-
const declaredSources = loaded
|
|
69
|
+
const projectMem = loaded?.content;
|
|
70
|
+
const seededFiles = loaded?.seededFiles;
|
|
71
|
+
const declaredSources = loaded?.instructionSources;
|
|
69
72
|
if (declaredSources !== undefined && declaredSources.length > 0)
|
|
70
73
|
instructionSources = declaredSources;
|
|
71
74
|
if (seededFiles?.length && seedContextFiles) {
|
|
@@ -31,7 +31,7 @@ import type { MaterializedMcp } from "../mcp.js";
|
|
|
31
31
|
import type { RosterBuilder } from "../tool-roster.js";
|
|
32
32
|
import type { ResolvedRole } from "../roles.js";
|
|
33
33
|
import type { RunnerDeps, TaskSpec } from "../types.js";
|
|
34
|
-
import type { SessionTreeEntry } from "../../internal/harness-types.js";
|
|
34
|
+
import type { ReadFloor, SessionTreeEntry } from "../../internal/harness-types.js";
|
|
35
35
|
import type { DateAnchorRead, PrepareResume, PromptFeatureFlags, RunInternals, ToolFaceSnapshot } from "./contracts.js";
|
|
36
36
|
import type { AdvertisedWritableDirs } from "./advertised-writable-dirs.js";
|
|
37
37
|
import { type GitStatusLaneRef } from "./git-status-frame.js";
|
|
@@ -99,6 +99,9 @@ export interface PreparePromptInputsInput {
|
|
|
99
99
|
resume: PrepareResume | undefined;
|
|
100
100
|
/** borrowed-readonly — whether a real execution env is mounted (the hands facts + both probes). */
|
|
101
101
|
handsEnabled: boolean;
|
|
102
|
+
/** borrowed-readonly — the byte floor of the run's base read-deny table (`undefined` when the table holds no row): both
|
|
103
|
+
* probes' output reaches the model, so their starts carry it as every relaying start does. */
|
|
104
|
+
readFloor: ReadFloor | undefined;
|
|
102
105
|
/** borrowed-readonly — the FINAL task root: the env `cwd` fact and the git lane's root. */
|
|
103
106
|
taskRootFinal: string;
|
|
104
107
|
/** borrowed-readonly — the canonical extra working roots (copied into the env facts). */
|
|
@@ -10,7 +10,7 @@ import { cwdAlignmentProbe, cwdMisalignmentMessage, readCwdAlignment } from "./c
|
|
|
10
10
|
const ULTRA_REASONING_TIERS = new Set(["xhigh", "max"]);
|
|
11
11
|
import { compactionEnabled } from "../context-settings.js";
|
|
12
12
|
export async function preparePromptInputs(input) {
|
|
13
|
-
const { spec, deps, failClosedReason, lockedPreflight, selfOrchestrationActive, executionEnv, reminderMark, resolvedReadFace, resolvedWriteFace, toolFaceSnapshot, internals, thinking, ownedEnv, delegation, resolvedRole, mcp, model, externalContentTargetActive, resume, handsEnabled, taskRootFinal, additionalRootsCanonical, additionalReadRootsCanonical, sessionId, session, advertisedWritableDirs } = input;
|
|
13
|
+
const { spec, deps, failClosedReason, lockedPreflight, selfOrchestrationActive, executionEnv, reminderMark, resolvedReadFace, resolvedWriteFace, toolFaceSnapshot, internals, thinking, ownedEnv, delegation, resolvedRole, mcp, model, externalContentTargetActive, resume, handsEnabled, readFloor, taskRootFinal, additionalRootsCanonical, additionalReadRootsCanonical, sessionId, session, advertisedWritableDirs } = input;
|
|
14
14
|
const promptPolicyEnabled = Boolean(lockedPreflight.toolPolicy);
|
|
15
15
|
const promptHooksEnabled = input.modBus.hasHandlers("classic.PreToolUse") || input.modBus.hasHandlers("classic.PostToolUse");
|
|
16
16
|
if (failClosedReason) {
|
|
@@ -84,7 +84,7 @@ export async function preparePromptInputs(input) {
|
|
|
84
84
|
envFacts.additionalReadDirectories = [...additionalReadRootsCanonical];
|
|
85
85
|
}
|
|
86
86
|
try {
|
|
87
|
-
const probe = await executionEnv.exec('uname -s; uname -r; (git rev-parse --is-inside-work-tree 2>/dev/null || echo false); (git symbolic-ref --short -q HEAD 2>/dev/null || echo "HEAD (detached)"); (git rev-parse --show-toplevel 2>/dev/null || echo); (test -n "$(git status --porcelain 2>/dev/null | head -1)" && echo dirty || echo clean); (s=$(ps -p $$ -o comm= 2>/dev/null); s=${s##*/}; echo "${s#-}"); (test "$(git rev-parse --git-dir 2>/dev/null)" != "$(git rev-parse --git-common-dir 2>/dev/null)" && echo linked || echo main); ' + cwdAlignmentProbe(taskRootFinal), { cwd: envFacts.cwd, timeout: 10 });
|
|
87
|
+
const probe = await executionEnv.exec('uname -s; uname -r; (git rev-parse --is-inside-work-tree 2>/dev/null || echo false); (git symbolic-ref --short -q HEAD 2>/dev/null || echo "HEAD (detached)"); (git rev-parse --show-toplevel 2>/dev/null || echo); (test -n "$(git status --porcelain 2>/dev/null | head -1)" && echo dirty || echo clean); (s=$(ps -p $$ -o comm= 2>/dev/null); s=${s##*/}; echo "${s#-}"); (test "$(git rev-parse --git-dir 2>/dev/null)" != "$(git rev-parse --git-common-dir 2>/dev/null)" && echo linked || echo main); ' + cwdAlignmentProbe(taskRootFinal), { cwd: envFacts.cwd, timeout: 10, ...(readFloor !== undefined ? { readFloor } : {}) });
|
|
88
88
|
if (probe.ok && probe.value.exitCode === 0) {
|
|
89
89
|
const lines = probe.value.stdout.split("\n");
|
|
90
90
|
if (lines.length >= 6) {
|
|
@@ -129,6 +129,7 @@ export async function preparePromptInputs(input) {
|
|
|
129
129
|
envFacts,
|
|
130
130
|
handsEnabled,
|
|
131
131
|
taskRoot: taskRootFinal,
|
|
132
|
+
readFloor,
|
|
132
133
|
onDegrade: (reason) => deps.onError?.(new Error(`env git snapshot degraded — ${reason}`), { phase: "degraded", sessionId, classification: "env-git-snapshot" }),
|
|
133
134
|
});
|
|
134
135
|
return { featureFlags, sugar, mcpInstructionsBlock, envFacts, tzValid, userTz, dateAnchor, gitStatusRef };
|
|
@@ -28,7 +28,7 @@ import { type MaterializedMcp, type McpDroppedTool, type McpReconnectResult } fr
|
|
|
28
28
|
import { type MaterializedA2a } from "../a2a.js";
|
|
29
29
|
import type { LockedPreflight } from "../locked-config.js";
|
|
30
30
|
import type { RunnerDeps, TaskSpec, ToolEffect } from "../types.js";
|
|
31
|
-
import type { AnnounceOnceSink, IrreversibilityTier, Prepared, RollbackStack, ToolFaceSnapshot } from "./contracts.js";
|
|
31
|
+
import type { AnnounceOnceSink, IrreversibilityTier, Prepared, RollbackStack, RunInternals, ToolFaceSnapshot } from "./contracts.js";
|
|
32
32
|
import { RosterBuilder, type ToolRosterDeltaSeat } from "../tool-roster.js";
|
|
33
33
|
import type { LegModBus } from "../mods/stations.js";
|
|
34
34
|
export interface PrepareProtocolToolsInput {
|
|
@@ -43,9 +43,9 @@ export interface PrepareProtocolToolsInput {
|
|
|
43
43
|
* reading, and the first-dial gate), `signal` (the host's abort, which stops an MCP dial). */
|
|
44
44
|
spec: Pick<TaskSpec, "principal" | "tools" | "excludeAllTools" | "signal">;
|
|
45
45
|
/** borrowed-readonly — the deployment seats the materializers and their operator faces read: `onElicit`
|
|
46
|
-
* and `
|
|
46
|
+
* and `imageProcessor` ride into the MCP intake; `onError` takes the A2A warnings (no ledger — a peer is
|
|
47
47
|
* re-read every prepare); `mcpRevocations` + `onNotice` make the revocation wiring; `peerSeat` answers what each MCP / A2A request carries. */
|
|
48
|
-
deps: Pick<RunnerDeps, "onElicit" | "
|
|
48
|
+
deps: Pick<RunnerDeps, "onElicit" | "imageProcessor" | "onError" | "mcpRevocations" | "onNotice" | "peerSeat">;
|
|
49
49
|
/** borrowed-readonly — the leg's mods bus: its `prompt.section` station disposes of each server's instructions at the dial. */
|
|
50
50
|
modBus: LegModBus;
|
|
51
51
|
/** borrowed-readonly — the run tree's MCP connection pool (the leg leases its connections from it) and whether THIS leg created it
|
|
@@ -54,6 +54,8 @@ export interface PrepareProtocolToolsInput {
|
|
|
54
54
|
pool: import("../mcp-connection-pool.js").McpConnectionPool;
|
|
55
55
|
owned: boolean;
|
|
56
56
|
};
|
|
57
|
+
/** borrowed-readonly — the leg's host seats (`RunInternals.mcpHostSeats`): a host-transport server dials through its seat. */
|
|
58
|
+
mcpHostSeats?: RunInternals["mcpHostSeats"];
|
|
57
59
|
/** borrowed-readonly — the leg's reminder mark (the MCP intake's disclosure bounding reads it). */
|
|
58
60
|
reminderMark: string;
|
|
59
61
|
/** borrowed-mutable — the reminder-disclosure counters: the MCP intake's bounding writes them here, and
|