@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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { frozenHandleCopy, isRemoteExecutionEnv, missingRestoreSurface } from "../remote-env.js";
|
|
1
|
+
import { declaredSuspend, frozenHandleCopy, isRemoteExecutionEnv, missingRestoreSurface, pathsAreHostLocal } from "../remote-env.js";
|
|
2
2
|
import { remoteEnvFailureNote, restoreWorkspaceWithRetry } from "./remote-env-retry.js";
|
|
3
3
|
import { rebaseWorkspacePathAcross } from "./workspace-path.js";
|
|
4
4
|
export { remoteEnvFailureNote, restoreWorkspaceWithRetry } from "./remote-env-retry.js";
|
|
@@ -30,7 +30,7 @@ export async function prepareWorkspaceRestore(input) {
|
|
|
30
30
|
failResume("resume needs a RemoteExecutionEnv from executionEnvFactory to restore the workspace snapshot");
|
|
31
31
|
}
|
|
32
32
|
else if (handle.snapshotId === undefined) {
|
|
33
|
-
if (handle.restoreMode !== "park_only" && ownedEnv
|
|
33
|
+
if (handle.restoreMode !== "park_only" && declaredSuspend(ownedEnv) !== false) {
|
|
34
34
|
failResume("checkpoint workspaceHandle has no snapshotId and is not a park_only handle, but the resumed env is suspendable — refusing to resume on a possibly-unrestored workspace (corrupt checkpoint?)");
|
|
35
35
|
}
|
|
36
36
|
refuseIdentityMismatch(ownedEnv.workspaceHandle());
|
|
@@ -108,7 +108,7 @@ export async function prepareWorkspaceRestore(input) {
|
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
const workspaceEnv = ownedEnv ?? deps.executionEnv;
|
|
111
|
-
const remote = workspaceEnv !== undefined && workspaceEnv !== null && (
|
|
111
|
+
const remote = workspaceEnv !== undefined && workspaceEnv !== null && !pathsAreHostLocal(workspaceEnv);
|
|
112
112
|
if (internals?.onWorkspaceResolved !== undefined) {
|
|
113
113
|
try {
|
|
114
114
|
internals.onWorkspaceResolved({
|
|
@@ -7,7 +7,7 @@ import { constraintChainDigest, constraintChainEntryOfSuppliedLayer } from "../t
|
|
|
7
7
|
import { readFrozenSkillGrants } from "../skill-grant.js";
|
|
8
8
|
import { readFrozenSkillScopes } from "../mods/spec-seats.js";
|
|
9
9
|
import { chainInstallationGaps, chainInstallationRefusal } from "./child-tree.js";
|
|
10
|
-
import {
|
|
10
|
+
import { chainEntryFault } from "../mods/stations.js";
|
|
11
11
|
import { refusePersistedToolNames, refuseRenamedDelegationMounts } from "./sub-agent-deny-lists.js";
|
|
12
12
|
import { asResumeConfigRefusal } from "../mode-policy.js";
|
|
13
13
|
import { screenRecordedRunOrigin } from "../run-origin.js";
|
|
@@ -136,9 +136,9 @@ export function resumeCheckpointScreen(input) {
|
|
|
136
136
|
if (gaps.length > 0)
|
|
137
137
|
throw chainInstallationRefusal(gaps, true);
|
|
138
138
|
}
|
|
139
|
-
const
|
|
140
|
-
if (
|
|
141
|
-
throw new CheckpointError("resume.parent_constraint_mismatch", `${
|
|
139
|
+
const malformed = chainEntryFault(internals?.inheritedGate?.parentConstraints ?? []);
|
|
140
|
+
if (malformed !== undefined)
|
|
141
|
+
throw new CheckpointError("resume.parent_constraint_mismatch", `${malformed}; rejected pre-CAS (the checkpoint stays pending)`);
|
|
142
142
|
const resumeInternals = internals?.inheritedGate?.parentConstraints !== undefined
|
|
143
143
|
? {
|
|
144
144
|
...internals,
|
|
@@ -5,6 +5,8 @@ const RETIRED_RUNNER_DEPS_KEYS = {
|
|
|
5
5
|
peerAdmission: "the peer lane's knob table is `RunnerDeps.peerLane` (the same fields: admission gate, delivery budgets, listing window)",
|
|
6
6
|
builtinWorkflows: "the engine ships no built-in named workflows — the Workflow tool's `{name}` resolves only `RunnerDeps.workflowScriptStore`; register any named workflow there",
|
|
7
7
|
graderEnvFactory: "the grader env reaches the repair loop as `RepairLoopConfig.graderEnv`, minted by the trusted control plane (`assertOracleIsolation` / `GraderEnv` unchanged)",
|
|
8
|
+
mcpImageResizer: "one image processor seat serves every image of a run: `RunnerDeps.imageProcessor` (an `ImageDownsampler`, or `false` for none; absent detects sharp once per process) — the MCP result, the Read tool, PDF pages, Bash data URIs, any tool's result, task images and attachments all pass the one admission with it",
|
|
9
|
+
"hands.readImageDownsampler": "one image processor seat serves every image of a run: `RunnerDeps.imageProcessor` (an `ImageDownsampler`, or `false` for none; absent detects sharp once per process) — the Read tool's images ride it with every other carrier's",
|
|
8
10
|
"hands.readCyberReminder": "a Read result carries only the reminders about that read (an empty file, an offset past the end, a file already in context) — no standing content-safety tail, so there is nothing to switch; a deployment that wants that sentence states it in its own `appendSystemPrompt`",
|
|
9
11
|
promptProvider: "a deployment changes prompt text through overlays: register a `prompt.compose` handler on `RunnerDeps.mods` answering `{ overlays }` (role base `replace`, a brand line `add` to the role band, a behavior or scenario `add`, a core-behavior `replace` / `append` / `drop`), choose the role base per task with `TaskSpec.promptRole`, and dispose of an MCP server's instructions with a `prompt.section` registration answering `{ text }` / `{ text: null }`",
|
|
10
12
|
allowImageUrl: "a remote image URL is judged by the one egress guard (https, the private-network floor) and the deployment's host floor — declare a CDN list as `RunnerDeps.hostFloor.only` (it bounds every structured egress: the fetch tool, task images, MCP http, A2A, WebSearch's SearXNG backend), or send the image inline",
|
|
@@ -15,5 +17,6 @@ export function assertNoRetiredRunnerDeps(deps) {
|
|
|
15
17
|
}
|
|
16
18
|
export function assertNoRetiredInheritedConstraints(internals) {
|
|
17
19
|
for (const constraint of internals?.inheritedGate?.parentConstraints ?? [])
|
|
18
|
-
|
|
20
|
+
if (constraint.policy !== undefined)
|
|
21
|
+
assertNoRetiredToolPolicyKeys(constraint.policy);
|
|
19
22
|
}
|
|
@@ -78,12 +78,12 @@ export async function runAttachmentSeats(input) {
|
|
|
78
78
|
return [];
|
|
79
79
|
const full = textOf(e.message);
|
|
80
80
|
if (m.engineMinted === true)
|
|
81
|
-
return [stripGitStatusUnits(full
|
|
81
|
+
return [stripGitStatusUnits(full)];
|
|
82
82
|
if (Array.isArray(m.engineSegments) && m.engineSegments.length > 0) {
|
|
83
|
-
return m.engineSegments.map((s) => stripGitStatusUnits(full.slice(Math.max(0, s.start), Math.max(0, s.end))
|
|
83
|
+
return m.engineSegments.map((s) => stripGitStatusUnits(full.slice(Math.max(0, s.start), Math.max(0, s.end))));
|
|
84
84
|
}
|
|
85
85
|
if (typeof m.enginePrefixChars === "number" && m.enginePrefixChars > 0)
|
|
86
|
-
return [stripGitStatusUnits(full.slice(0, m.enginePrefixChars)
|
|
86
|
+
return [stripGitStatusUnits(full.slice(0, m.enginePrefixChars))];
|
|
87
87
|
return [];
|
|
88
88
|
});
|
|
89
89
|
}
|
|
@@ -27,6 +27,7 @@ export function runBrainSinks(input) {
|
|
|
27
27
|
...(s.errorStatus !== undefined ? { errorStatus: s.errorStatus } : {}),
|
|
28
28
|
...(s.providerCondition !== undefined ? { providerCondition: s.providerCondition } : {}),
|
|
29
29
|
...(s.providerConditionSource !== undefined ? { providerConditionSource: s.providerConditionSource } : {}),
|
|
30
|
+
...(s.seat !== undefined ? { seat: s.seat } : {}),
|
|
30
31
|
...ident(),
|
|
31
32
|
};
|
|
32
33
|
Object.freeze(frame);
|
|
@@ -42,7 +42,9 @@ export interface RunGitLaneInput {
|
|
|
42
42
|
type: "tool_execution_end";
|
|
43
43
|
}>) => void;
|
|
44
44
|
/** borrowed-readonly — the harness-handlers lane's turn_end closure. */
|
|
45
|
-
onTurnEnd: (
|
|
45
|
+
onTurnEnd: (event: Extract<AgentHarnessEvent, {
|
|
46
|
+
type: "turn_end";
|
|
47
|
+
}>) => void;
|
|
46
48
|
/** borrowed-readonly — the turn-boundary lane's handler, registered on `turn_boundary` AFTER the owed-frame retry
|
|
47
49
|
* so a pending announcement is re-asserted into the session ahead of the boundary's own context work. */
|
|
48
50
|
onTurnBoundary: (event: {
|
|
@@ -33,7 +33,9 @@ export interface RunHarnessHandlersResult {
|
|
|
33
33
|
onToolEnd: (event: Extract<AgentHarnessEvent, {
|
|
34
34
|
type: "tool_execution_end";
|
|
35
35
|
}>) => void;
|
|
36
|
-
onTurnEnd: (
|
|
36
|
+
onTurnEnd: (event: Extract<AgentHarnessEvent, {
|
|
37
|
+
type: "turn_end";
|
|
38
|
+
}>) => void;
|
|
37
39
|
/** The leg's workspace-frame observation (`Prepared.workspaceFrame.observe`); the run body
|
|
38
40
|
* calls it after a resume's approved-call resolution, which bypasses onToolEnd. */
|
|
39
41
|
announceWorkspaceMove: () => void;
|
|
@@ -13,6 +13,7 @@ import { hasVerifiableStructureSignal } from "./grounding-signal.js";
|
|
|
13
13
|
import { announceToolCall, batchResponseDigest, emitSettled } from "./tool-end-body.js";
|
|
14
14
|
import { neverExecuted, stampRowNotExecuted } from "./tool-not-executed.js";
|
|
15
15
|
import { extensionCallOf, noteExtensionCallDenied, requesterOf } from "../mods/extension-call.js";
|
|
16
|
+
import { noteCompletedTurn } from "../mods/lifecycle-stations.js";
|
|
16
17
|
import { createResponseModelSeat } from "./response-model-seat.js";
|
|
17
18
|
import { createToolCallIdFoldSeat } from "./tool-call-id-fold-seat.js";
|
|
18
19
|
import { createFinishReasonSeat } from "./finish-reason-seat.js";
|
|
@@ -295,8 +296,9 @@ export function createHarnessHandlers(input) {
|
|
|
295
296
|
}
|
|
296
297
|
}
|
|
297
298
|
};
|
|
298
|
-
const onTurnEnd = () => {
|
|
299
|
+
const onTurnEnd = (event) => {
|
|
299
300
|
stats.turns += 1;
|
|
301
|
+
noteCompletedTurn(prepared.modBus, rs.turn, event.message.role === "assistant" ? event.message : undefined, stats.turns, prepared.abortController.signal.aborted, rs.turn.turnUsageMissing ? undefined : rs.turn.turnUsage);
|
|
300
302
|
if (prepared.abortController.signal.aborted)
|
|
301
303
|
prepared.workCutRef.abortedBeforeTurnEnd = true;
|
|
302
304
|
const stopExtra = rs.turn.turnStopReason !== undefined ? { stopReason: rs.turn.turnStopReason } : {};
|
|
@@ -119,7 +119,7 @@ export function runIdentityWiring(input) {
|
|
|
119
119
|
{
|
|
120
120
|
const pendingIdle = pendingSessionNotifications.drain(prepared.sessionId);
|
|
121
121
|
if (pendingIdle !== undefined) {
|
|
122
|
-
for (const payload of discloseDroppedPending(pendingIdle)) {
|
|
122
|
+
for (const payload of discloseDroppedPending(pendingIdle, prepared.taskReadHandleOf, () => prepared.listBackgroundTasks({ settled: true }))) {
|
|
123
123
|
const parkedPriority = pendingIdle.priorities?.get(payload);
|
|
124
124
|
deliveredAtTurnOpen.add(taskNotificationDedupKey(payload));
|
|
125
125
|
queue.push({ type: "task_notification", notification: payload, ...(parkedPriority !== undefined ? { priority: parkedPriority } : {}), ...ident() });
|
|
@@ -6,12 +6,13 @@ import { normalizePersistedRuleHit } from "../rule-lane-reads.js";
|
|
|
6
6
|
import { decidersNote, SETTLEMENT_NOBODY_JUDGED } from "../gate-outcome.js";
|
|
7
7
|
import { formatHookFeedback } from "../hooks.js";
|
|
8
8
|
import { classicEventBase, failedHandlerClause, legEventsOf, openSubagent, screenUserPrompt } from "../mods/stations.js";
|
|
9
|
+
import { offeredAgentListing } from "../mods/agent-stations.js";
|
|
9
10
|
import { buildAppliedHumanInputEvent, buildHumanInputEvent, projectHumanInput } from "../human-input-projection.js";
|
|
10
11
|
import { humanInputAttachmentsOf, readObjectiveAttachments, userAttachmentDeclarations } from "../user-attachment.js";
|
|
11
12
|
import { readToolCallArguments, uuidv7 } from "../../internal/harness.js";
|
|
12
13
|
import { ORG_ADJUDICATION_TIMEOUT_MS, settleOrgVerdictWithin } from "../permission-rule-org.js";
|
|
13
14
|
import { applyPersistedTightening, disclosedRuleSet } from "../persisted-rule-arms.js";
|
|
14
|
-
import { argsReadBy, stampArgsReading } from "../effective-path-target.js";
|
|
15
|
+
import { argsReadBy, carryArgsReadFrom, stampArgsReading } from "../effective-path-target.js";
|
|
15
16
|
import { skillGrantBindingMembers, skillRowRefusal } from "../skill-grant.js";
|
|
16
17
|
import { requestGrantBinding } from "../skill-grant-binding.js";
|
|
17
18
|
import { judgeApprovalObject } from "../approval-object.js";
|
|
@@ -19,7 +20,7 @@ import { SKILL_TOOL_NAME } from "./synthetic-tools.js";
|
|
|
19
20
|
import { computeCostMicroUsd } from "../pricing.js";
|
|
20
21
|
import { mintSystemReminder } from "../reminder-mint.js";
|
|
21
22
|
import { hasDestroy } from "../remote-env.js";
|
|
22
|
-
import { advertisedWritableRootsSeat, attestationOf, exemptRootsSeat, humanRefusalSentence, licenseCovers, ownedReading, policyCannotAnswer, policyRefusalMessage, refuseOutOfContractDecision } from "../tool-policy.js";
|
|
23
|
+
import { advertisedWritableRootsSeat, attestationOf, exemptRootsSeat, humanRefusalSentence, licenseCovers, ownArgs, ownedReading, policyCannotAnswer, policyRefusalMessage, refuseOutOfContractDecision } from "../tool-policy.js";
|
|
23
24
|
import { failedJudgmentDeny } from "./policy-throw.js";
|
|
24
25
|
import { pathDenialCardOf } from "../../tools/fs/safety.js";
|
|
25
26
|
import { callFaceSeat, parkedRowLiveFace, rosterEntryNamed, rowMember } from "../tool-roster.js";
|
|
@@ -31,7 +32,7 @@ import { legContextOverlayOption } from "./compaction-call-options.js";
|
|
|
31
32
|
import { mintOutputStyleReminder, owedPostureText } from "./compaction-restate.js";
|
|
32
33
|
import { advisorFrameText, registerAdvisorReceipt } from "./advisor-instructions.js";
|
|
33
34
|
import { resumeContinuation } from "./decide-continuation.js";
|
|
34
|
-
import {
|
|
35
|
+
import { sameBytes } from "../rewrite-rejudge.js";
|
|
35
36
|
import { approvalWordsOf, owedApprovalWords, withApprovalWords } from "./approval-feedback.js";
|
|
36
37
|
import { chainCannotJudge } from "./call-hook-stations.js";
|
|
37
38
|
import { settleExecutionRecord } from "./execution-record.js";
|
|
@@ -41,7 +42,7 @@ import { withGateTimeout } from "../gate-bounded-await.js";
|
|
|
41
42
|
import { readStationAnswer } from "../shell-read-silence.js";
|
|
42
43
|
import { resolveGitLegDelivery, wrapGitFrame } from "./git-leg-delivery.js";
|
|
43
44
|
import { GIT_STATUS_ECHO_PREVIEW } from "./git-status-frame.js";
|
|
44
|
-
import {
|
|
45
|
+
import { toImageContents } from "./image.js";
|
|
45
46
|
import { maybeHumanRejectionHalt } from "./prepare-gate-stations.js";
|
|
46
47
|
import { nextHumanInputSeq } from "./steer-admission.js";
|
|
47
48
|
import { settleTeardownLeg } from "./teardown-bounded.js";
|
|
@@ -338,7 +339,7 @@ export async function runLeg(input) {
|
|
|
338
339
|
effectiveObjective = `${formatHookFeedback(start.additionalContext, prepared.reminderMark)}\n\n${effectiveObjective}`;
|
|
339
340
|
}
|
|
340
341
|
const objectiveInputId = uuidv7();
|
|
341
|
-
const { frames: attachmentFrames, chars: attachmentChars } = await readObjectiveAttachments(prepared, objectiveInputId, promptBlocked, { overlay: () => legContextOverlayOption(prepared, runner).contextOverlay, objectiveChars: effectiveObjective.length });
|
|
342
|
+
const { frames: attachmentFrames, chars: attachmentChars } = await readObjectiveAttachments(prepared, objectiveInputId, promptBlocked, { overlay: () => legContextOverlayOption(prepared, runner).contextOverlay, objectiveChars: effectiveObjective.length }, runner.deps.imageProcessor);
|
|
342
343
|
let gitLegDelivered;
|
|
343
344
|
if (!promptBlocked) {
|
|
344
345
|
const gitBody = await resolveGitLegDelivery(prepared, undefined, (err) => {
|
|
@@ -370,8 +371,9 @@ export async function runLeg(input) {
|
|
|
370
371
|
firstFrames.push({ source: "mcp_unavailable", body: unavailable.body, commit: () => settleMcpUnavailable(prepared, unavailable.entries), disclose: () => undefined });
|
|
371
372
|
if (rs.attach.attachState !== undefined) {
|
|
372
373
|
const attach = rs.attach.attachState;
|
|
373
|
-
|
|
374
|
-
|
|
374
|
+
const offeredListing = !rs.attach.agentListingOn ? undefined : prepared.modBus.hasHandlers("agent.offer") ? await offeredAgentListing(prepared.modBus, prepared.agentListing, prepared.abortController.signal) : prepared.agentListing;
|
|
375
|
+
if (offeredListing !== undefined) {
|
|
376
|
+
const listing = offeredListing;
|
|
375
377
|
const frame = renderAgentListingFrame(attach, listing.entries, listing.toolName, listing.models, listing.budget);
|
|
376
378
|
if (frame !== undefined) {
|
|
377
379
|
firstFrames.push({
|
|
@@ -456,9 +458,7 @@ export async function runLeg(input) {
|
|
|
456
458
|
prepared.abortController.abort();
|
|
457
459
|
}
|
|
458
460
|
else {
|
|
459
|
-
const images = spec.images
|
|
460
|
-
? await Promise.all(spec.images.map((img) => toImageContent(img, prepared.hostFloor)))
|
|
461
|
-
: undefined;
|
|
461
|
+
const images = spec.images ? await toImageContents(spec.images, prepared.hostFloor, runner.deps.imageProcessor, prepared.imageUnprocessed) : undefined;
|
|
462
462
|
if (gitLegDelivered !== undefined) {
|
|
463
463
|
const delivered = gitLegDelivered;
|
|
464
464
|
if (delivered.standalone)
|
|
@@ -593,12 +593,18 @@ async function resolvePendingCall(runner, prepared, resume, emit, emitCommitted,
|
|
|
593
593
|
const reading = liveTool === undefined ? undefined : ownedReading((a) => readToolCallArguments(liveTool, { type: "toolCall", id: pendingAction.toolCallId, name: pendingAction.toolName, arguments: {} }, a));
|
|
594
594
|
const beltFace = () => { const f = parkedRowLiveFace(prepared.toolRosterDeltas.current, pendingAction); if (f !== undefined && reading !== undefined)
|
|
595
595
|
stampArgsReading(f, reading); return f; };
|
|
596
|
-
const tryRead = (v) => {
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
596
|
+
const tryRead = (v) => {
|
|
597
|
+
try {
|
|
598
|
+
const read = reading === undefined ? v : argsReadBy(reading, v);
|
|
599
|
+
const owned = ownArgs(read);
|
|
600
|
+
if (owned.ok && owned.value !== read)
|
|
601
|
+
carryArgsReadFrom(read, owned.value);
|
|
602
|
+
return { args: owned.ok ? owned.value : read };
|
|
603
|
+
}
|
|
604
|
+
catch (error) {
|
|
605
|
+
return { args: v, unread: { error } };
|
|
606
|
+
}
|
|
607
|
+
};
|
|
602
608
|
const decided = outcome.decision === "allow" ? tryRead(humanRewrite !== undefined ? humanRewrite : pendingAction.args) : { args: humanRewrite !== undefined ? humanRewrite : pendingAction.args };
|
|
603
609
|
const resolvedArgs = decided.args;
|
|
604
610
|
const pendingLabel = (() => { const l = liveTool?.label; return l !== undefined && l !== pendingAction.toolName ? { label: l } : {}; })();
|
|
@@ -661,15 +667,7 @@ async function resolvePendingCall(runner, prepared, resume, emit, emitCommitted,
|
|
|
661
667
|
emitCommitted(await prepared.session.appendMessage(resultRow(hookDenial, true)), "toolResult", pendingAction.toolCallId);
|
|
662
668
|
return;
|
|
663
669
|
}
|
|
664
|
-
const
|
|
665
|
-
if (rescreened?.unread !== undefined)
|
|
666
|
-
return settleUnreadable(rescreened.unread.error, "the arguments a PreToolUse hook rewrote it to");
|
|
667
|
-
if (humanRewrite !== undefined && rescreened !== undefined && !sameBytes({}, resolvedArgs, rescreened.args)) {
|
|
668
|
-
const text = formatHookFeedback(`${editRewrittenSentence(pendingAction.toolName)}, which a PreToolUse hook wrote — this approval is spent; the call has to be re-issued.`, prepared.reminderMark);
|
|
669
|
-
await settleEnd(true, { content: text, details: { editRewritten: { acceptableForm: rescreened.args } } }, "hook");
|
|
670
|
-
return emitCommitted(await prepared.session.appendMessage(resultRow(text, true)), "toolResult", pendingAction.toolCallId);
|
|
671
|
-
}
|
|
672
|
-
const executedArgs = rescreened !== undefined ? rescreened.args : resolvedArgs;
|
|
670
|
+
const executedArgs = resolvedArgs;
|
|
673
671
|
const unseen = !licenseCovers(pendingAction.boundInputHash, executedArgs);
|
|
674
672
|
let beltReading;
|
|
675
673
|
const beltReq = () => ({ toolName: pendingAction.toolName, args: executedArgs, toolCallId: pendingAction.toolCallId, ...callFaceSeat(beltFace()), budget: beltBudget, ...(prepared.cwdRef !== undefined ? { cwd: prepared.cwdRef.current } : {}), ...(prepared.handsRoot !== undefined ? { root: prepared.handsRoot } : {}), ...advertisedWritableRootsSeat(prepared.advertisedWritableDirs), ...exemptRootsSeat(prepared.exemptRoots), ...(beltReading !== undefined ? { targetReading: beltReading } : {}), ...requestGrantBinding((call, args) => skillGrantBindingMembers(call, args, prepared.skillSpecs, SKILL_TOOL_NAME), pendingAction, executedArgs) });
|
|
@@ -709,8 +707,8 @@ async function resolvePendingCall(runner, prepared, resume, emit, emitCommitted,
|
|
|
709
707
|
: personUnanswered
|
|
710
708
|
? " (the call as it would run requires a person's approval, and this decision was the deployment's policy)"
|
|
711
709
|
: " (the policy rewrote these bytes to a value that was not approved)";
|
|
712
|
-
const editedDenial = formatHookFeedback(
|
|
713
|
-
const outlet = rechecked.action !== "deny" && !personUnanswered &&
|
|
710
|
+
const editedDenial = formatHookFeedback(`The approver EDITED this call's input; the edited call is refused by the deployment's tool policy and was not executed${why}.`, prepared.reminderMark);
|
|
711
|
+
const outlet = rechecked.action !== "deny" && !personUnanswered && rewrite?.unread === undefined && rewrite !== undefined ? { details: { editRewritten: { acceptableForm: rewrite.args } } } : denialCard(rechecked);
|
|
714
712
|
await settleEnd(true, { content: editedDenial, ...outlet }, "policy");
|
|
715
713
|
emitCommitted(await prepared.session.appendMessage(resultRow(editedDenial, true)), "toolResult", pendingAction.toolCallId);
|
|
716
714
|
return;
|
|
@@ -847,7 +845,7 @@ async function resolvePendingCall(runner, prepared, resume, emit, emitCommitted,
|
|
|
847
845
|
if ((prepared.crossBoundary?.storeWaits() ?? 0) === waited)
|
|
848
846
|
break;
|
|
849
847
|
}
|
|
850
|
-
const args = executedArgs;
|
|
848
|
+
const args = structuredClone(executedArgs);
|
|
851
849
|
screened?.admit();
|
|
852
850
|
onExecuteStart?.(pendingAction.toolCallId);
|
|
853
851
|
occurrences.release(pendingAction.toolCallId);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type PeerInboundChainRef } from "../../agents/peer-admission.js";
|
|
2
2
|
import type { PushQueue } from "../push-queue.js";
|
|
3
3
|
import type { SessionStore } from "../session.js";
|
|
4
|
-
import { type NotificationInjectionOutcome, type PendingSessionNotifications, type SystemInjectionPriority, type TaskNotificationPayload } from "../task-notification.js";
|
|
4
|
+
import { DeliveryObligations, type NotificationInjectionOutcome, type PendingSessionNotifications, type SystemInjectionPriority, type TaskNotificationPayload } from "../task-notification.js";
|
|
5
5
|
import type { RunnerDeps, TaskEvent, TaskSpec } from "../types.js";
|
|
6
6
|
import type { SessionReadFileStates } from "./session-read-file-states.js";
|
|
7
7
|
import type { SessionModeSeats } from "./session-mode-seats.js";
|
|
@@ -59,5 +59,7 @@ export interface RunNotificationLaneResult {
|
|
|
59
59
|
notificationLane: NotificationLaneBindings;
|
|
60
60
|
/** The queue subscription's release; the leg lane's finally calls it right after flipping `live`. */
|
|
61
61
|
unsubscribeTaskNotifications: () => void;
|
|
62
|
+
/** The terminal frames this lane is still owed by loop-type tasks admitted onto its sink — what a one-shot ending waits on. */
|
|
63
|
+
deliveryObligations: DeliveryObligations;
|
|
62
64
|
}
|
|
63
65
|
export declare function runNotificationLane<R>(input: RunNotificationLaneInput<R>): Promise<R>;
|
|
@@ -2,7 +2,7 @@ import { createPeerInboundChainRef, createPeerSelfRef } from "../../agents/peer-
|
|
|
2
2
|
import { boundInputHashOf } from "../canonical-json.js";
|
|
3
3
|
import { readPendingSteerQueue } from "../checkpoint-store.js";
|
|
4
4
|
import { wakeOpening } from "../run-origin.js";
|
|
5
|
-
import { createLiveNotificationLane, DurableAppendObligations, injectionLaneOf, isDelegatedAgentTerminal, isTerminalTaskNotification, renderTaskNotificationXml, routeOrParkNotification, SystemInjectionQueue, taskNotificationDedupKey } from "../task-notification.js";
|
|
5
|
+
import { bindDeliveryObligations, createLiveNotificationLane, DeliveryObligations, DurableAppendObligations, injectionLaneOf, isDelegatedAgentTerminal, isTerminalTaskNotification, renderTaskNotificationXml, routeOrParkNotification, SystemInjectionQueue, taskNotificationDedupKey } from "../task-notification.js";
|
|
6
6
|
import { ToolDetachHub } from "../tool-detach.js";
|
|
7
7
|
import { pendingContentAskCallId } from "./decide-continuation.js";
|
|
8
8
|
export function runNotificationLane(input) {
|
|
@@ -116,6 +116,19 @@ async function runNotificationLaneAs(input, obligations) {
|
|
|
116
116
|
const peerSelfRef = internals?.peerSelfRef ?? createPeerSelfRef(internals?.registryScope ?? spec.principal ?? "default");
|
|
117
117
|
const peerInboundChainRef = internals?.peerInboundChainRef ?? createPeerInboundChainRef();
|
|
118
118
|
const modelCatalog = runner.deps.models;
|
|
119
|
+
const deliveryObligations = new DeliveryObligations();
|
|
120
|
+
const laneSink = (notification, opts) => {
|
|
121
|
+
try {
|
|
122
|
+
upstreamTaskNotification?.(notification, opts);
|
|
123
|
+
}
|
|
124
|
+
catch {
|
|
125
|
+
}
|
|
126
|
+
const outcome = injectTaskNotification(notification, opts);
|
|
127
|
+
if (isTerminalTaskNotification(notification))
|
|
128
|
+
deliveryObligations.discharge(notification);
|
|
129
|
+
return outcome;
|
|
130
|
+
};
|
|
131
|
+
bindDeliveryObligations(laneSink, deliveryObligations);
|
|
119
132
|
const prepared = await prepareTask(spec, runner.deps, sessions, prepareResume, {
|
|
120
133
|
...(internals ?? {}),
|
|
121
134
|
peerSelfRef,
|
|
@@ -123,14 +136,7 @@ async function runNotificationLaneAs(input, obligations) {
|
|
|
123
136
|
detachHub,
|
|
124
137
|
sessionReadStates,
|
|
125
138
|
sessionModeSeats,
|
|
126
|
-
onTaskNotification:
|
|
127
|
-
try {
|
|
128
|
-
upstreamTaskNotification?.(notification, opts);
|
|
129
|
-
}
|
|
130
|
-
catch {
|
|
131
|
-
}
|
|
132
|
-
return injectTaskNotification(notification, opts);
|
|
133
|
-
},
|
|
139
|
+
onTaskNotification: laneSink,
|
|
134
140
|
}, self, taskIdRef, holdSessionLock, legWrites);
|
|
135
141
|
pendingSessionNotifications.bindSessionBox(prepared.sessionId, prepared.sessionBox);
|
|
136
142
|
const notificationLane = {
|
|
@@ -159,7 +165,7 @@ async function runNotificationLaneAs(input, obligations) {
|
|
|
159
165
|
},
|
|
160
166
|
};
|
|
161
167
|
try {
|
|
162
|
-
return await next({ prepared, injectTaskNotification, deliveredAtTurnOpen, peerInboundChainRef, modelCatalog, notificationLane, unsubscribeTaskNotifications });
|
|
168
|
+
return await next({ prepared, injectTaskNotification, deliveredAtTurnOpen, peerInboundChainRef, modelCatalog, notificationLane, unsubscribeTaskNotifications, deliveryObligations });
|
|
163
169
|
}
|
|
164
170
|
finally {
|
|
165
171
|
if (notificationSessionId !== undefined)
|
|
@@ -7,6 +7,7 @@ import { hasBackgroundShell, sweepRunBoundaryBackgroundShells } from "../backgro
|
|
|
7
7
|
import { resolveCheckpointStore } from "../checkpoint-store.js";
|
|
8
8
|
import { compensateUnstarted, reopenReasonOf, resumeStartupCauseOf, unstartedRowSentence } from "../resume-startup-cause.js";
|
|
9
9
|
import { classicEventBase, observeClassic } from "../mods/stations.js";
|
|
10
|
+
import { raiseCompletedTurn, raiseSessionEnd } from "../mods/lifecycle-stations.js";
|
|
10
11
|
import { modelCostToPricing } from "../pricing.js";
|
|
11
12
|
import { hasDestroy, isIsolated } from "../remote-env.js";
|
|
12
13
|
import { resolveTaskModel } from "../roles.js";
|
|
@@ -77,7 +78,6 @@ export async function runSettleAndTeardown(input) {
|
|
|
77
78
|
const reminderDisclosuresActive = Object.keys(prepared.reminderDisclosureCounts).length > 0;
|
|
78
79
|
if (rs.counters.finalVerifyInjections > 0 || rs.attach.attachmentsInjected > 0 || rs.counters.repetitionCuts > 0 || rs.counters.repetitionSpared > 0 || rs.counters.approachNoticesSent > 0 || reminderDisclosuresActive) {
|
|
79
80
|
stats.mechanisms = {
|
|
80
|
-
...(rs.counters.finalVerifyInjections > 0 ? { finalVerifyInjected: true } : {}),
|
|
81
81
|
...(rs.counters.finalVerifyInjections > 0 ? { finalVerifyInjections: rs.counters.finalVerifyInjections } : {}),
|
|
82
82
|
...(rs.attach.attachmentsInjected > 0 ? { attachmentsInjected: rs.attach.attachmentsInjected } : {}),
|
|
83
83
|
...(rs.counters.approachNoticesSent > 0 ? { approachNoticesSent: rs.counters.approachNoticesSent } : {}),
|
|
@@ -190,6 +190,10 @@ export async function runSettleAndTeardown(input) {
|
|
|
190
190
|
});
|
|
191
191
|
if (taskIdRef !== undefined)
|
|
192
192
|
taskIdRef.delegationTerminalOwed = undefined;
|
|
193
|
+
if (rs.turn.completed !== undefined)
|
|
194
|
+
await raiseCompletedTurn(prepared.modBus, rs.turn, prepared.hookIdentity, undefined);
|
|
195
|
+
if (prepared.modBus.hasHandlers("session.end"))
|
|
196
|
+
await raiseSessionEnd(prepared.modBus, prepared.hookIdentity, { reason: terminalFace.status, sessionId: prepared.sessionId });
|
|
193
197
|
if (rs.degrade.degraded)
|
|
194
198
|
result.degraded = rs.degrade.degraded;
|
|
195
199
|
if (prepared.outputRef.set)
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { PushQueue } from "../push-queue.js";
|
|
2
|
+
import type { DeliveryObligations } from "../task-notification.js";
|
|
2
3
|
import type { TaskEvent, TaskSpec } from "../types.js";
|
|
3
4
|
import type { Stats } from "./assemble-result.js";
|
|
4
5
|
import type { InstallingPhaseResult, Prepared, RunnerDepsSeat, RunState } from "./contracts.js";
|
|
@@ -23,6 +24,9 @@ export interface RunStopAndFinalVerifyInput {
|
|
|
23
24
|
};
|
|
24
25
|
/** borrowed-readonly — the monotonic walltime deadline (the clock lane's), read by the budget fill. */
|
|
25
26
|
walltimeMonotonicDeadline: number | undefined;
|
|
27
|
+
/** borrowed-readonly — the terminal frames this leg's lane is still owed (the notification lane's book): a one-shot
|
|
28
|
+
* submission's ending waits on it. */
|
|
29
|
+
deliveryObligations: DeliveryObligations;
|
|
26
30
|
/** borrowed-readonly — the Runner's deployment deps, read LIVE (`hooks` at resolution, `onError` in the gate). */
|
|
27
31
|
runner: RunnerDepsSeat;
|
|
28
32
|
}
|
|
@@ -4,7 +4,7 @@ import { classicEventBase, dispatchClassic, legEventsOf, stringMembersAnswer, st
|
|
|
4
4
|
import { asThrownError } from "../thrown-value.js";
|
|
5
5
|
const STOP_HOOK_BLOCK_CAP = 8;
|
|
6
6
|
export function runStopAndFinalVerify(input) {
|
|
7
|
-
const { spec, prepared, queue, rs, stats, ident, walltimeMonotonicDeadline, runner } = input;
|
|
7
|
+
const { spec, prepared, queue, rs, stats, ident, walltimeMonotonicDeadline, deliveryObligations, runner } = input;
|
|
8
8
|
const stopEvent = legEventsOf(prepared.hookIdentity).stop;
|
|
9
9
|
const stopArmed = prepared.modBus.hasHandlers(stopEvent);
|
|
10
10
|
const finalVerificationOn = spec.finalVerification === true;
|
|
@@ -24,11 +24,19 @@ export function runStopAndFinalVerify(input) {
|
|
|
24
24
|
const emitFinalVerifyEcho = (body) => {
|
|
25
25
|
queue.push({ type: "steering_injected", source: "final_verification", preview: body.slice(0, 220), ...ident() });
|
|
26
26
|
};
|
|
27
|
-
|
|
27
|
+
const owed = spec.oneShot === true ? deliveryObligations : undefined;
|
|
28
|
+
if (stopArmed || finalVerificationOn || owed !== undefined) {
|
|
28
29
|
let consecutiveBlocks = 0;
|
|
30
|
+
const ending = () => prepared.abortController.signal.aborted || prepared.pausedRef.current !== undefined || prepared.batchHaltRef.current !== undefined;
|
|
29
31
|
prepared.harness.setStopGate(async () => {
|
|
30
|
-
if (
|
|
32
|
+
if (ending())
|
|
31
33
|
return [];
|
|
34
|
+
const pushedBack = stopArmed || finalVerificationOn ? await pushBack() : [];
|
|
35
|
+
if (pushedBack.length === 0)
|
|
36
|
+
await owed?.waitOut(prepared.abortController.signal, () => !ending() && prepared.harness.pendingInjectionCount() === 0, (wake) => prepared.harness.subscribe((e) => void (e.type === "queue_update" && wake())));
|
|
37
|
+
return pushedBack;
|
|
38
|
+
});
|
|
39
|
+
async function pushBack() {
|
|
32
40
|
if (finalVerificationOn &&
|
|
33
41
|
(rs.counters.finalVerifyInjections === 0 || (rs.counters.finalVerifyInjections === 1 && rs.counters.groundingSignalPreR9 && !rs.counters.groundingSignalPostR9)) &&
|
|
34
42
|
rs.counters.wroteThisRun &&
|
|
@@ -149,7 +157,7 @@ export function runStopAndFinalVerify(input) {
|
|
|
149
157
|
});
|
|
150
158
|
}
|
|
151
159
|
return messages;
|
|
152
|
-
}
|
|
160
|
+
}
|
|
153
161
|
}
|
|
154
162
|
return {};
|
|
155
163
|
}
|
|
@@ -8,6 +8,8 @@ import { ATTACHMENT_BYTE_CAP, CHANGED_FILES_MAX, TOTAL_TOKENS_REMINDER_DEFAULT_M
|
|
|
8
8
|
import { announceListingTruncation } from "../skill-listing-budget.js";
|
|
9
9
|
import { buildWorkingFileAttachments, centerAdoptionOption, contextInstructionFilesOption, emitInputTruncated, forkContextOption, legCompactionSettings, legContextOverlayOption } from "./compaction-call-options.js";
|
|
10
10
|
import { classicEventBase, dispatchClassic, stringMembersAnswer, stringMembersOf } from "../mods/stations.js";
|
|
11
|
+
import { offeredAgentListing } from "../mods/agent-stations.js";
|
|
12
|
+
import { raiseCompletedTurn } from "../mods/lifecycle-stations.js";
|
|
11
13
|
import { sanitizeUntrustedText, SHELLED_BODY_ENVELOPE_TAGS } from "../untrusted-text.js";
|
|
12
14
|
import { droppedToolDigest, withAnnounceDigests } from "./announce-once-ledger.js";
|
|
13
15
|
import { formatDiagnosticsBlock, withholdListedDiagnostics } from "../lsp-diagnostics.js";
|
|
@@ -33,6 +35,8 @@ export function createTurnBoundary(input) {
|
|
|
33
35
|
let finalVerifySeenAtLastBoundary = 0;
|
|
34
36
|
let legContinues = true;
|
|
35
37
|
const boundaryPass = async (event) => {
|
|
38
|
+
if (rs.turn.completed !== undefined)
|
|
39
|
+
await raiseCompletedTurn(prepared.modBus, rs.turn, prepared.hookIdentity, prepared.abortController.signal);
|
|
36
40
|
const turnOwesRequest = event.continues;
|
|
37
41
|
let boundarySteered = false;
|
|
38
42
|
const noNextRequest = () => prepared.stopRequestedRef.current || deps.loopLatch.userHalted;
|
|
@@ -295,7 +299,8 @@ export function createTurnBoundary(input) {
|
|
|
295
299
|
const undiscoveredTools = toolSearchReminderOn
|
|
296
300
|
? [...prepared.deferredToolNames].filter((n) => !prepared.activeTools.has(n)).sort()
|
|
297
301
|
: undefined;
|
|
298
|
-
const
|
|
302
|
+
const agentListingOwed = rs.attach.agentListingOn && prepared.agentListing !== undefined && !frameCarried(prepared.frameReceipts, "agent_listing");
|
|
303
|
+
const offeredListing = !agentListingOwed ? undefined : prepared.modBus.hasHandlers("agent.offer") ? await offeredAgentListing(prepared.modBus, prepared.agentListing, prepared.abortController.signal) : prepared.agentListing;
|
|
299
304
|
const skillsListingDue = rs.attach.skillsListingOn && prepared.skillsListing !== undefined && !frameCarried(prepared.frameReceipts, "skills_listing");
|
|
300
305
|
const listingBudget = prepared.skillsListing?.budget ?? prepared.agentListing?.budget;
|
|
301
306
|
due.push(...collectDueAttachments(rs.attach.attachState, {
|
|
@@ -340,11 +345,11 @@ export function createTurnBoundary(input) {
|
|
|
340
345
|
? { readdedToolsSwappedUnderStatic: pendingReaddedTools.filter((n) => prepared.staticFaceFor?.(n) !== true) }
|
|
341
346
|
: {}),
|
|
342
347
|
...(mcpToolsDelta !== undefined ? { mcpToolsDelta } : {}),
|
|
343
|
-
...(
|
|
348
|
+
...(offeredListing !== undefined
|
|
344
349
|
? {
|
|
345
|
-
agentListing:
|
|
346
|
-
agentToolName:
|
|
347
|
-
...(
|
|
350
|
+
agentListing: offeredListing.entries,
|
|
351
|
+
agentToolName: offeredListing.toolName,
|
|
352
|
+
...(offeredListing.models !== undefined ? { agentModels: offeredListing.models } : {}),
|
|
348
353
|
}
|
|
349
354
|
: {}),
|
|
350
355
|
...(skillsListingDue ? { skillsListing: prepared.skillsListing.entries } : {}),
|
|
@@ -379,8 +384,8 @@ export function createTurnBoundary(input) {
|
|
|
379
384
|
prepared.frameReceipts.listingSnapshotOwed = true;
|
|
380
385
|
});
|
|
381
386
|
}
|
|
382
|
-
if (
|
|
383
|
-
const listing =
|
|
387
|
+
if (offeredListing !== undefined && due.some((a) => a.source === "agent_listing")) {
|
|
388
|
+
const listing = offeredListing;
|
|
384
389
|
const frame = renderAgentListingFrame(attachState, listing.entries, listing.toolName, listing.models, listing.budget);
|
|
385
390
|
recordSteps.set("agent_listing", () => {
|
|
386
391
|
commitAgentListing(attachState, listing.entries, listing.models);
|
|
@@ -10,6 +10,7 @@ import type { ResumeRun, ResumeTaskConfig, RunInternals, RunnerSelfSeat } from "
|
|
|
10
10
|
export type { ResumeTaskConfig } from "./contracts.js";
|
|
11
11
|
import type { CompactSessionRequest, CompactSessionResult } from "../auto-compaction.js";
|
|
12
12
|
import type { RewindFilesRequest, RewindFilesResult } from "../file-history-store.js";
|
|
13
|
+
import { type PeerDeclarationHold, type PeerDeclarations } from "../peer-seat.js";
|
|
13
14
|
/**
|
|
14
15
|
* A stateless task runner. Holds shared deps (the external brain, model catalog) and an
|
|
15
16
|
* in-memory session store so that passing a `sessionId` continues a prior conversation.
|
|
@@ -76,6 +77,8 @@ export declare class Runner implements RunnerSelfSeat {
|
|
|
76
77
|
emitTaskOutcome(outcome: TaskOutcome): void;
|
|
77
78
|
/** Whether a child this Runner runs can be placed in another tree: {@link RunnerSelfSeat.canRerootChild}. */
|
|
78
79
|
canRerootChild(): boolean;
|
|
80
|
+
/** A hold of `declared`'s references on this Runner's peer seat: {@link RunnerSelfSeat.holdDeclarations}. A seat member that throws reaches `onError`. */
|
|
81
|
+
holdDeclarations(declared: PeerDeclarations, sessionId?: string): PeerDeclarationHold;
|
|
79
82
|
/** The deployment agent catalog (RunnerDeps.agents/builtinAgents), exposed READ-ONLY
|
|
80
83
|
* so the Agent-tool lane (`createSubagentTool`) defaults to the SAME registry the workflow lane
|
|
81
84
|
* consumes (single source; the types.ts "pass the same array" follow-on made structural). The array
|
|
@@ -127,8 +130,8 @@ export declare class Runner implements RunnerSelfSeat {
|
|
|
127
130
|
* `undefined` clears an optional seat: `tiers: undefined` ⇒ no bindings, a face seat `undefined` ⇒ the
|
|
128
131
|
* engine default); a key absent is kept. `tiers` omitted beside `models` ⇒ the current bindings are
|
|
129
132
|
* re-applied over the new catalog.
|
|
130
|
-
* - **Announced per seat.** `config.models_swapped` (models/tiers counts
|
|
131
|
-
* catalog itself) and
|
|
133
|
+
* - **Announced per seat.** `config.models_swapped` (models/tiers counts and the candidate's `generation` — key
|
|
134
|
+
* material only, never the catalog itself) and
|
|
132
135
|
* `config.read_face_swapped` / `config.write_face_swapped` (`{ from, to, occurrenceId }`, the seat's
|
|
133
136
|
* previous and new value, `null` = no declaration) — the table {@link SWAP_SEAT_NOTICE} binds every
|
|
134
137
|
* seat to its line.
|
|
@@ -246,8 +249,8 @@ export declare class Runner implements RunnerSelfSeat {
|
|
|
246
249
|
* registry auto re-supplies them; see `parentConstraintRegistry`). The re-supplied chain's LENGTH must
|
|
247
250
|
* match the checkpoint's recorded `parentConstraintCount` (`resume.parent_constraint_mismatch`
|
|
248
251
|
* otherwise). Most entries are policies the deployment authored and can hand straight back; a
|
|
249
|
-
*
|
|
250
|
-
*
|
|
252
|
+
* mods-wired ancestor also contributes a SCREENING entry (issue #33), its installation — rebuild that one as
|
|
253
|
+
* `{ installation: await admitModChain(…), hookEnv, …regime }`. The DATA half (ancestorRules/shellGate) rides the checkpoint itself and needs no
|
|
251
254
|
* re-supply; on the resumed leg the CHECKPOINT snapshot is the trust floor — live internals may only
|
|
252
255
|
* TIGHTEN it (per-entry rev-monotonic ancestorRules replacement, max-rank shellGate fold), never
|
|
253
256
|
* displace it wholesale. TRUST BOUNDARY: `internals` is the DEPLOYMENT trust channel (the same tier as
|