@sema-agent/core 7.11.2 → 7.13.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 +86 -13
- package/dist/core/ask-origin.d.ts +55 -0
- package/dist/core/ask-origin.js +21 -0
- package/dist/core/auto-mode-arming.d.ts +10 -14
- package/dist/core/auto-mode-arming.js +3 -9
- package/dist/core/auto-mode-defaults.d.ts +0 -2
- package/dist/core/auto-mode-defaults.js +0 -1
- package/dist/core/auto-mode-rebuild.d.ts +6 -13
- package/dist/core/auto-mode-rebuild.js +0 -2
- package/dist/core/auto-mode.d.ts +30 -89
- package/dist/core/auto-mode.js +12 -59
- package/dist/core/checkpoint-store.d.ts +1 -3
- package/dist/core/engine-notice.d.ts +18 -0
- package/dist/core/gate-fold.js +1 -9
- package/dist/core/gate-lanes.d.ts +0 -40
- package/dist/core/gate-lanes.js +18 -26
- package/dist/core/governance-codes.d.ts +1 -1
- package/dist/core/governance-codes.js +2 -0
- package/dist/core/hooks.d.ts +7 -1
- package/dist/core/hooks.js +1 -1
- package/dist/core/runner/assemble-result.d.ts +45 -1
- package/dist/core/runner/assemble-result.js +4 -1
- package/dist/core/runner/compaction-seams.d.ts +42 -0
- package/dist/core/runner/compaction-seams.js +80 -0
- package/dist/core/runner/contracts.d.ts +85 -15
- package/dist/core/runner/denial-limit-arms.d.ts +10 -13
- package/dist/core/runner/denial-limit-arms.js +12 -9
- package/dist/core/runner/gate-exit.js +9 -1
- package/dist/core/runner/permission-rule-lanes.d.ts +2 -1
- package/dist/core/runner/permission-rule-lanes.js +2 -1
- package/dist/core/runner/prepare-caps-and-workflow.d.ts +1 -1
- package/dist/core/runner/prepare-caps-and-workflow.js +0 -5
- package/dist/core/runner/prepare-policy-chain.js +3 -2
- package/dist/core/runner/prepare-protocol-tools.js +5 -0
- package/dist/core/runner/prepare-safety-scan.js +11 -16
- package/dist/core/runner/prepare-suspend-saga.d.ts +0 -2
- package/dist/core/runner/prepare-suspend-saga.js +2 -10
- package/dist/core/runner/prepare-task.d.ts +9 -1
- package/dist/core/runner/prepare-task.js +7 -2
- package/dist/core/runner/prepare-wiring-manifest.d.ts +1 -1
- package/dist/core/runner/prepare-wiring-manifest.js +1 -8
- package/dist/core/runner/resume-claim.d.ts +2 -2
- package/dist/core/runner/resume-preflight.d.ts +2 -2
- package/dist/core/runner/run-attachment-seats.d.ts +6 -4
- package/dist/core/runner/run-attachment-seats.js +2 -2
- package/dist/core/runner/run-git-lane.d.ts +1 -1
- package/dist/core/runner/run-harness-handlers.js +2 -0
- package/dist/core/runner/run-identity-wiring.d.ts +21 -33
- package/dist/core/runner/run-identity-wiring.js +6 -3
- package/dist/core/runner/run-leg.d.ts +108 -0
- package/dist/core/runner/run-leg.js +713 -0
- package/dist/core/runner/run-notification-lane.d.ts +56 -0
- package/dist/core/runner/run-notification-lane.js +128 -0
- package/dist/core/runner/run-reasoning-seat.d.ts +5 -5
- package/dist/core/runner/run-reasoning-seat.js +7 -7
- package/dist/core/runner/run-recovery-lanes.d.ts +4 -17
- package/dist/core/runner/run-recovery-lanes.js +5 -4
- package/dist/core/runner/run-settle-and-teardown.d.ts +113 -0
- package/dist/core/runner/run-settle-and-teardown.js +432 -0
- package/dist/core/runner/run-stop-and-final-verify.d.ts +2 -2
- package/dist/core/runner/run-terminal-adoption.d.ts +99 -0
- package/dist/core/runner/run-terminal-adoption.js +200 -0
- package/dist/core/runner/run-turn-boundary.js +5 -4
- package/dist/core/runner/runtask.d.ts +10 -79
- package/dist/core/runner/runtask.js +83 -1557
- package/dist/core/runner/stream-lifecycle-verbs.js +10 -1
- package/dist/core/runner-deps.d.ts +4 -14
- package/dist/core/store-contracts/workflow-journal-store-contract.d.ts +7 -0
- package/dist/core/store-contracts/workflow-journal-store-contract.js +85 -0
- package/dist/core/task-stream.d.ts +10 -1
- package/dist/core/tool-face.d.ts +8 -0
- package/dist/core/tool-face.js +1 -0
- package/dist/core/tool-policy.d.ts +42 -96
- package/dist/core/tool-policy.js +1 -11
- package/dist/core/tool-registry.d.ts +11 -3
- package/dist/core/tool-registry.js +7 -1
- package/dist/core/tool-roster.d.ts +26 -0
- package/dist/core/tool-roster.js +38 -7
- package/dist/core/trace.d.ts +6 -7
- package/dist/core/wiring-manifest.d.ts +5 -22
- package/dist/core/wiring-manifest.js +3 -11
- package/dist/core/workflow-journal-store.d.ts +35 -4
- package/dist/core/workflow-journal-store.js +19 -2
- package/dist/index.d.ts +6 -5
- package/dist/index.js +6 -5
- package/dist/orchestration/workflow.js +2 -0
- package/dist/server/http.js +2 -1
- package/dist/stores/file/workflow-journal-store.d.ts +7 -10
- package/dist/stores/file/workflow-journal-store.js +2 -4
- package/package.json +1 -1
- package/test/export-surface.snapshot.json +21 -11
|
@@ -429,6 +429,7 @@ export async function prepareTask(spec, deps, sessions, resume, internals, runne
|
|
|
429
429
|
const rosterSeat = new ToolRosterDeltaSeat();
|
|
430
430
|
const { mcp, a2a, rebuildHarnessToolsRef, contentOriginWrapRef, toolCallGateArmedRef } = await prepareProtocolTools({ lockedPreflight, spec, deps, reminderMark, reminderDisclosureCounts, runId, sessionId, onceLedger, roster, rosterSeat, remoteToolOffload, toolFaceSnapshot, toolEffects, axisExplicitNegatives, irreversibilityTier, irreversibleTools, egressTools, abortController, rollback });
|
|
431
431
|
const callIssuedAtRef = {};
|
|
432
|
+
const workCutRef = { continuation: false, abortedBeforeTurnEnd: false };
|
|
432
433
|
const memoryWriteGateRef = {};
|
|
433
434
|
const handsReadFaceInput = { handsEnabled, executionEnv, taskRootFinal, rebaseRestoredPath, resume, session, sessionId, hostTaskId, taskScope, fullShellReachable, effectiveShellGate, toolFaceSnapshot, model, spec, deps, internals, memoryWriteGateRef, firstPartyOffload, roster, egressTools, irreversibilityTier, irreversibleTools, reversibilityProbes, reminderMark, reminderDisclosureCounts, ...(trackFileEdit !== undefined ? { trackFileEdit } : {}), onFileEdited: noteFileEdited, ...(restoredFilePaths.length > 0 ? { restoredFilePaths } : {}) };
|
|
434
435
|
const handsReadFace = handsEnabled ? await prepareHandsMount(handsReadFaceInput) : resolveHandsLessReadFace(handsReadFaceInput);
|
|
@@ -617,6 +618,10 @@ export async function prepareTask(spec, deps, sessions, resume, internals, runne
|
|
|
617
618
|
},
|
|
618
619
|
...(spec.resilience !== undefined ? { resilience: spec.resilience } : {}),
|
|
619
620
|
loopTrace: (step) => {
|
|
621
|
+
if (step.kind === "continue")
|
|
622
|
+
workCutRef.continuation = true;
|
|
623
|
+
else
|
|
624
|
+
workCutRef.continuation = workCutRef.continuation && step.reason === "aborted_before_stream";
|
|
620
625
|
if (step.kind !== "continue")
|
|
621
626
|
return;
|
|
622
627
|
if (step.reason === "next_turn" || step.reason === "steer_injected" || step.reason === "follow_up_injected")
|
|
@@ -678,7 +683,7 @@ export async function prepareTask(spec, deps, sessions, resume, internals, runne
|
|
|
678
683
|
});
|
|
679
684
|
}
|
|
680
685
|
const { askLane } = prepareAskLane({ gateMachineryActive, abortController, effectivePolicy, budgetSnapshot, handsCwdRef, tools, inheritedUnavailableAsks, inheritedAskGrants, onAsk, humanReviewRef, now, ruleOffersOf, askSourceIdentity, riskAxesOf, autoModeDenialTracking, spec, deps, sessionId, runId, hooks, hookTimeoutMs, notifyOwnHookCrash });
|
|
681
|
-
const { saga } = prepareSuspendSaga({ gateMachineryActive, abortController, harness, checkpointStore, deps, sessionId, hostTaskId, taskScope, liveSpendRef, resume, nestedStats, internals, activeTools, outputRef, readFileStateForCheckpoint, faceCheckpointSection, reminderMark, handsCwdRef, worktreeSessionRef, inheritedParentConstraints, seedInheritedGate, inheritedAncestorRules, inheritedShellGate, autoModeIntent,
|
|
686
|
+
const { saga } = prepareSuspendSaga({ gateMachineryActive, abortController, harness, checkpointStore, deps, sessionId, hostTaskId, taskScope, liveSpendRef, resume, nestedStats, internals, activeTools, outputRef, readFileStateForCheckpoint, faceCheckpointSection, reminderMark, handsCwdRef, worktreeSessionRef, inheritedParentConstraints, seedInheritedGate, inheritedAncestorRules, inheritedShellGate, autoModeIntent, inheritedAdmittedOrgScopes, ownOrgVerdictRef, orgGovernedProvenance, announcedListingsRef, gitStatusRef, hookIdentity, placementRootResolved, externalContentTargetActive, remoteEnvFailures, memoryEngineSession, suspendLoopRef, ownedEnv, incompleteSuspendAdapter });
|
|
682
687
|
const { suspendForResource, suspendForPlatformLimit, suspendForReview } = prepareBoundaryParks({ saga, spec, checkpointStore, abortController, harness, session, sessions, sessionId, deps, priorLedger, maxSlices, maxSuspends, resourceTotal, priorSuspendCount, suspendChainBase, humanReviewRef, liveSpendRef, now, faceCheckpointState, f012CheckpointState, orgAdmissionCheckpointState, pausedRef, remoteEnvFailures, resourceSuspendEligible, durableSuspendInfraReady, incompleteSuspendAdapter });
|
|
683
688
|
const { parkAsk } = prepareParkAsk({ askLane, saga, spec, deps, sessionId, checkpointStore, toolRosterDeltas: rosterSeat, parkLaneArmed, contentAskRoutable, liveQuestionFace, mountedQuestionTool, contentAskBindings, lateStrandedAnswers, discloseStrandedAnswers, onAsk, runtimeCaps, inheritedUnavailableAsks, basePolicyForResumeEdit, budgetSnapshot, handsCwdRef, offloadStore, ownedEnv, incompleteSuspendAdapter, session, sessions, suspendChainBase, maxSuspends, remoteEnvFailures, shellGatedBash, shellGatedMonitor, effectiveShellGate, durableApproval, priorLedger, liveSpendRef, resourceTotal, faceCheckpointState, f012CheckpointState, orgAdmissionCheckpointState, ruleOffersOf, now, humanReviewRef, abortController, harness, pausedRef });
|
|
684
689
|
prepareGateStations({ askLane, parkAsk, tools, toolRosterDeltas: rosterSeat, toolEffects, deps, toolCallGateArmedRef, effectivePolicy, hooks, egressTools, irreversibleTools, spec, complianceDenies, harness, blockedToolCalls, inheritedAskGrants, inheritedUnavailableAsks, foldAskClasses, ancestorSandboxAdmissions, preToolContexts, gateOutcomes, batchHaltRef, blockedTracked, hookIdentity, reminderMark, planModeRef, hostTaskId, sessionId, ownGatePreToolUse, hookTimeoutMs, handsCwdRef, hookEnvFace, irreversibilityTier, reversibilityProbes, abortController, shellGatedBash, shellGatedMonitor, autoModeDecider, autoModeDenialTracking, stopForDenialLimit, permissionRuleLane, permissionRuleOrgLane, questionToolMounted, sandboxAdmissionArmed, sandboxBoundaryCapable, emitSandboxAdmitted, delegation, notifyOwnHookCrash });
|
|
@@ -686,7 +691,7 @@ export async function prepareTask(spec, deps, sessions, resume, internals, runne
|
|
|
686
691
|
const preparedHolder = {};
|
|
687
692
|
const { cacheBreakDetector, cacheFingerprint, promptOverheadTokens, readTaskFile, normalizeAttachmentPath, isDedupStubResult, recentlyReadFiles, onCompactionApplied, detectExternalChanges, listBackgroundTasks, centerCompactionCandidate, effectiveReadFaceObserved, effectiveReadDenyObserved } = prepareTurnWiring({ deps, systemPromptSeat, harnessTools, fpRef, model, epochArtifactDigestForSnapshot, promptProfile, fableMitigations, systemBlocks, thinking, spec, sessionId, turnSnapshotRef, promptManifest, charsPerToken, handsEnabled, executionEnv, attachmentRootCanonical, additionalRootsCanonical, additionalReadRootsCanonical, readDenyMatcher, resolvedReadFace, handsCwdRef, readFileStateForCheckpoint, denyNarrowingPolicy, abortController, hostTaskId, taskScope, buildAssembleInputs, centerAdoptionRef, harnessRef, epochDeclaredSections, carrierReadFace, readDenyAdditionsNormalized, preparedHolder });
|
|
688
693
|
await onceLedger.settle(session, announcedListingsRef);
|
|
689
|
-
const buildPrepared = () => ({ harness, session, sessionId, runId, reminderMark, reminderDisclosureCounts, editedFilesSnapshot, taskRootPath: taskRootFinal, model, thinking, compModel: effectiveCompModel, mcp, ...(a2a.tools.length > 0 ? { a2a } : {}), blockedRef, outputRef, abortController, conflictRef, blockedToolCalls, gateOutcomes, batchHaltRef, nestedStats, ...(rewindNotes.length > 0 ? { rewindNotes } : {}), ...(fileHistoryBoundary !== undefined ? { fileHistoryBoundary } : {}), ...(effectiveReadFaceObserved !== undefined ? { effectiveReadFace: effectiveReadFaceObserved } : {}), ...(effectiveReadDenyObserved !== undefined ? { effectiveReadDenyPatterns: effectiveReadDenyObserved } : {}), effectiveMemoryScopes: memoryEffectiveScopes, cwdRef: handsCwdRef, ...(worktreeSessionRef !== undefined ? { worktreeSessionRef } : {}), ...(workspaceStateSettle !== undefined ? { workspaceStateSettle } : {}), ...(sealReadStateSeat !== undefined ? { sealReadStateSeat } : {}), denyNarrowingPolicy, ...(permissionRuleLane !== undefined ? { persistedRuleLane: permissionRuleLane } : {}), ...(basePolicyForResumeEdit !== undefined ? { basePolicyForResumeEdit } : {}), ...(permissionRuleOrgLane !== undefined ? { permissionRuleOrg: permissionRuleOrgLane } : {}), releaseSignal, settleContentAskBindings, cacheBreakDetector, cacheFingerprint, wiringManifest, promptManifest, epochDeclaredSections, activeTools, ...(deferred.size > 0 ? { deferredToolNames: deferred } : {}), toolMaterializeStatic, deferDirectCall, ...(staticFaceForRef.current !== undefined ? { staticFaceFor: staticFaceForRef.current } : {}), ownedEnv, pausedRef, suspendProgressRef, remoteEnvFailures, reviewRequestRef, suspendLoopRef, suspendForResource, ...(suspendForPlatformLimit !== undefined ? { suspendForPlatformLimit } : {}), ...(envLifetimeSuspendAt !== undefined ? { envLifetimeSuspendAt } : {}), ...(usageGovernance !== undefined ? { usageGovernance } : {}), callIssuedAtRef, brainCallGuardrailRef, gateStopRef, suspendForReview, resourceLedger: priorLedger, liveSpendRef, humanReviewRef, now, tools, toolRoster, toolRosterDeltas: rosterSeat, structuredProjector, toolEffects, wakeRecovered, promptOverheadTokens, lastBrainContext, readTaskFile, recentlyReadFiles, normalizeAttachmentPath, isDedupStubResult, ...(onCompactionApplied ? { onCompactionApplied } : {}), compactionReuseRef, trimPressureRef, microCompact, ...(memoryEngineSession ? { memoryEngineSession } : {}), ...(subagentRetain ? { subagentRetain } : {}), ...(lspDiagnostics && nudgeLspOnEdit ? { lspDiagnostics: { registry: lspDiagnostics, nudge: nudgeLspOnEdit, runIdent: lspRunIdent } } : {}), planModeRef, stopRequestedRef, announcedSnapshotRecovered: onceLedger.recovered, ...(dateChange ? { dateChange } : {}), ...(instructionSources ? { instructionSources } : {}), ...(projectInstructionContent !== undefined ? { projectInstructionContent } : {}), ...(workflowSizeGuideline ? { workflowSizeGuideline } : {}), ...(detectExternalChanges ? { detectExternalChanges } : {}), ...(toolsDeltaRef ? { toolsDeltaRef } : {}), ...(agentListing ? { agentListing } : {}), ...(skillsListing ? { skillsListing } : {}), announcedListingsRef, gitStatusRef, listBackgroundTasks, hookIdentity, hookTimeoutMs, ...(turnSnapshotRef.current !== undefined ? { turnSnapshot: turnSnapshotRef.current } : {}), ...(centerCompactionCandidate !== undefined ? { centerCompactionCandidate } : {}) });
|
|
694
|
+
const buildPrepared = () => ({ harness, session, sessionId, runId, reminderMark, reminderDisclosureCounts, editedFilesSnapshot, taskRootPath: taskRootFinal, model, thinking, compModel: effectiveCompModel, mcp, ...(a2a.tools.length > 0 ? { a2a } : {}), blockedRef, outputRef, abortController, conflictRef, blockedToolCalls, gateOutcomes, batchHaltRef, nestedStats, ...(rewindNotes.length > 0 ? { rewindNotes } : {}), ...(fileHistoryBoundary !== undefined ? { fileHistoryBoundary } : {}), ...(effectiveReadFaceObserved !== undefined ? { effectiveReadFace: effectiveReadFaceObserved } : {}), ...(effectiveReadDenyObserved !== undefined ? { effectiveReadDenyPatterns: effectiveReadDenyObserved } : {}), effectiveMemoryScopes: memoryEffectiveScopes, cwdRef: handsCwdRef, ...(worktreeSessionRef !== undefined ? { worktreeSessionRef } : {}), ...(workspaceStateSettle !== undefined ? { workspaceStateSettle } : {}), ...(sealReadStateSeat !== undefined ? { sealReadStateSeat } : {}), denyNarrowingPolicy, ...(permissionRuleLane !== undefined ? { persistedRuleLane: permissionRuleLane } : {}), ...(basePolicyForResumeEdit !== undefined ? { basePolicyForResumeEdit } : {}), ...(permissionRuleOrgLane !== undefined ? { permissionRuleOrg: permissionRuleOrgLane } : {}), releaseSignal, settleContentAskBindings, cacheBreakDetector, cacheFingerprint, wiringManifest, promptManifest, epochDeclaredSections, activeTools, ...(deferred.size > 0 ? { deferredToolNames: deferred } : {}), toolMaterializeStatic, deferDirectCall, ...(staticFaceForRef.current !== undefined ? { staticFaceFor: staticFaceForRef.current } : {}), ownedEnv, pausedRef, suspendProgressRef, remoteEnvFailures, reviewRequestRef, suspendLoopRef, suspendForResource, ...(suspendForPlatformLimit !== undefined ? { suspendForPlatformLimit } : {}), ...(envLifetimeSuspendAt !== undefined ? { envLifetimeSuspendAt } : {}), ...(usageGovernance !== undefined ? { usageGovernance } : {}), callIssuedAtRef, workCutRef, brainCallGuardrailRef, gateStopRef, suspendForReview, resourceLedger: priorLedger, liveSpendRef, humanReviewRef, now, tools, toolRoster, toolRosterDeltas: rosterSeat, structuredProjector, toolEffects, wakeRecovered, promptOverheadTokens, lastBrainContext, readTaskFile, recentlyReadFiles, normalizeAttachmentPath, isDedupStubResult, ...(onCompactionApplied ? { onCompactionApplied } : {}), compactionReuseRef, trimPressureRef, microCompact, ...(memoryEngineSession ? { memoryEngineSession } : {}), ...(subagentRetain ? { subagentRetain } : {}), ...(lspDiagnostics && nudgeLspOnEdit ? { lspDiagnostics: { registry: lspDiagnostics, nudge: nudgeLspOnEdit, runIdent: lspRunIdent } } : {}), planModeRef, stopRequestedRef, announcedSnapshotRecovered: onceLedger.recovered, ...(dateChange ? { dateChange } : {}), ...(instructionSources ? { instructionSources } : {}), ...(projectInstructionContent !== undefined ? { projectInstructionContent } : {}), ...(workflowSizeGuideline ? { workflowSizeGuideline } : {}), ...(detectExternalChanges ? { detectExternalChanges } : {}), ...(toolsDeltaRef ? { toolsDeltaRef } : {}), ...(agentListing ? { agentListing } : {}), ...(skillsListing ? { skillsListing } : {}), announcedListingsRef, gitStatusRef, listBackgroundTasks, hookIdentity, hookTimeoutMs, ...(turnSnapshotRef.current !== undefined ? { turnSnapshot: turnSnapshotRef.current } : {}), ...(centerCompactionCandidate !== undefined ? { centerCompactionCandidate } : {}) });
|
|
690
695
|
rollback.commit();
|
|
691
696
|
const prepared = buildPrepared();
|
|
692
697
|
preparedHolder.current = prepared;
|
|
@@ -46,7 +46,7 @@ export interface PrepareWiringManifestInput {
|
|
|
46
46
|
deps: RunnerDeps;
|
|
47
47
|
/** borrowed-readonly — the trusted spawn-side channel: `questionFaceStripped`, `isDelegatedChild`, `onTaskNotification`,
|
|
48
48
|
* `peerSelfRef`, `explicitAgentName` (the drain), `insideFork` / `agentName` / `parentToolCallId` (the identity). */
|
|
49
|
-
internals: Pick<RunInternals, "questionFaceStripped" | "isDelegatedChild" | "onTaskNotification" | "peerSelfRef" | "explicitAgentName" | "insideFork" | "agentName" | "parentToolCallId"
|
|
49
|
+
internals: Pick<RunInternals, "questionFaceStripped" | "isDelegatedChild" | "onTaskNotification" | "peerSelfRef" | "explicitAgentName" | "insideFork" | "agentName" | "parentToolCallId"> | undefined;
|
|
50
50
|
/** borrowed-readonly — the resume leg, or undefined (the manifest's leg derivation reads presence only). */
|
|
51
51
|
resume: Pick<PrepareResume, "seed"> | undefined;
|
|
52
52
|
/** borrowed-readonly — the acquired session id. */
|
|
@@ -199,14 +199,7 @@ export function prepareWiringManifest(input) {
|
|
|
199
199
|
memoryAdmissionWired: deps.memoryScopeAdmission !== undefined,
|
|
200
200
|
retentionPolicyWired: deps.retentionPolicy !== undefined,
|
|
201
201
|
...(modelGateManifest !== undefined ? { modelGate: modelGateManifest } : {}),
|
|
202
|
-
autoMode: {
|
|
203
|
-
armed: autoModeArmReason === "armed",
|
|
204
|
-
reason: autoModeArmReason,
|
|
205
|
-
...(() => {
|
|
206
|
-
const trip = internals?.autoModeBreakerLedger?.lastTrip(sessionId);
|
|
207
|
-
return trip !== undefined ? { breaker: trip } : {};
|
|
208
|
-
})(),
|
|
209
|
-
},
|
|
202
|
+
autoMode: { armed: autoModeArmReason === "armed", reason: autoModeArmReason },
|
|
210
203
|
mcp: mcpManifestEntries(lockedPreflight.mcp, mcp.statuses),
|
|
211
204
|
tools: toolRoster,
|
|
212
205
|
});
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* — the post-consume hook fires on the tick the win was read — and returns what that rung returns.
|
|
10
10
|
*/
|
|
11
11
|
import { type Checkpoint, type CheckpointStore, type CheckpointToken } from "../checkpoint-store.js";
|
|
12
|
-
import type { InheritedGate, ResumeRun } from "./contracts.js";
|
|
12
|
+
import type { InheritedGate, InstallingPhaseResult, ResumeRun } from "./contracts.js";
|
|
13
13
|
export interface ResumeClaimInput<R> {
|
|
14
14
|
/** borrowed-readonly — the checkpoint token being claimed. */
|
|
15
15
|
token: CheckpointToken;
|
|
@@ -27,6 +27,6 @@ export interface ResumeClaimInput<R> {
|
|
|
27
27
|
next: (claimed: ResumeClaimResult) => Promise<R>;
|
|
28
28
|
}
|
|
29
29
|
/** The claim's completion is its whole result: a lost CAS throws, so reaching `next` IS the win. */
|
|
30
|
-
export interface ResumeClaimResult {
|
|
30
|
+
export interface ResumeClaimResult extends InstallingPhaseResult {
|
|
31
31
|
}
|
|
32
32
|
export declare function resumeClaim<R>(input: ResumeClaimInput<R>): Promise<R>;
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* returns what that rung returns.
|
|
11
11
|
*/
|
|
12
12
|
import { type Checkpoint, type CheckpointStore, type CheckpointToken } from "../checkpoint-store.js";
|
|
13
|
-
import type { InheritedGate, RunnerDepsSeat, SuspendReap } from "./contracts.js";
|
|
13
|
+
import type { InheritedGate, InstallingPhaseResult, RunnerDepsSeat, SuspendReap } from "./contracts.js";
|
|
14
14
|
export interface ResumePreflightInput<R> {
|
|
15
15
|
/** borrowed-readonly — the checkpoint token (handed to the deployment and to the settling CAS). */
|
|
16
16
|
token: CheckpointToken;
|
|
@@ -35,6 +35,6 @@ export interface ResumePreflightInput<R> {
|
|
|
35
35
|
next: (screened: ResumePreflightResult) => Promise<R>;
|
|
36
36
|
}
|
|
37
37
|
/** The preflight's completion is its whole result: every refusal throws, so reaching `next` IS the fact. */
|
|
38
|
-
export interface ResumePreflightResult {
|
|
38
|
+
export interface ResumePreflightResult extends InstallingPhaseResult {
|
|
39
39
|
}
|
|
40
40
|
export declare function resumePreflight<R>(input: ResumePreflightInput<R>): Promise<R>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { TaskSpec } from "../types.js";
|
|
2
|
-
import type { Prepared, ResumeRun, RunnerDepsSeat, RunState } from "./contracts.js";
|
|
3
|
-
export interface RunAttachmentSeatsInput {
|
|
2
|
+
import type { InstallingPhaseResult, Prepared, ResumeRun, RunnerDepsSeat, RunState } from "./contracts.js";
|
|
3
|
+
export interface RunAttachmentSeatsInput<R> {
|
|
4
4
|
/** borrowed-readonly — the task spec: the attachments config and the `finalVerification` opt-in. */
|
|
5
5
|
spec: TaskSpec;
|
|
6
6
|
/** borrowed-mutable — the leg's prepared seat: `announcedListingsRef` is seeded; the session, the listing faces,
|
|
@@ -13,8 +13,10 @@ export interface RunAttachmentSeatsInput {
|
|
|
13
13
|
rs: RunState;
|
|
14
14
|
/** borrowed-readonly — the Runner's deployment deps, read once for `probeInstructionSources`. */
|
|
15
15
|
runner: RunnerDepsSeat;
|
|
16
|
+
/** borrowed-readonly — the lanes after this one, entered in this lane's last continuation (the seats it wrote are on `rs`). */
|
|
17
|
+
next: (seats: RunAttachmentSeatsResult) => Promise<R>;
|
|
16
18
|
}
|
|
17
19
|
/** Nothing comes back: the lane's products are the `counters` / `attach` groups it wrote on the borrowed run state. */
|
|
18
|
-
export interface RunAttachmentSeatsResult {
|
|
20
|
+
export interface RunAttachmentSeatsResult extends InstallingPhaseResult {
|
|
19
21
|
}
|
|
20
|
-
export declare function runAttachmentSeats(input: RunAttachmentSeatsInput): Promise<
|
|
22
|
+
export declare function runAttachmentSeats<R>(input: RunAttachmentSeatsInput<R>): Promise<R>;
|
|
@@ -3,7 +3,7 @@ import { stripGitStatusUnits } from "./git-status-frame.js";
|
|
|
3
3
|
import { SKILLS_LISTING_PROBE_HEADER } from "./synthetic-tools.js";
|
|
4
4
|
import { AGENT_LISTING_REMOVED_HEADER, SKILLS_LISTING_DELTA_HEADER, SKILLS_LISTING_REMOVED_HEADER, agentListingDeltaHeader, agentListingInitialHeader, createAttachmentState, replayAnnouncedListing, replayAnnouncedModels } from "./turn-attachments.js";
|
|
5
5
|
export async function runAttachmentSeats(input) {
|
|
6
|
-
const { spec, prepared, resume, rs, runner } = input;
|
|
6
|
+
const { spec, prepared, resume, rs, runner, next } = input;
|
|
7
7
|
rs.counters.wroteThisRun = false;
|
|
8
8
|
rs.counters.finalVerifyInjections = 0;
|
|
9
9
|
rs.counters.groundingSignalPreR9 = false;
|
|
@@ -183,5 +183,5 @@ export async function runAttachmentSeats(input) {
|
|
|
183
183
|
}
|
|
184
184
|
}
|
|
185
185
|
rs.attach.attachmentsInjected = 0;
|
|
186
|
-
return {};
|
|
186
|
+
return await next({});
|
|
187
187
|
}
|
|
@@ -52,7 +52,7 @@ export interface RunGitLaneInput {
|
|
|
52
52
|
runner: RunnerDepsSeat;
|
|
53
53
|
}
|
|
54
54
|
export interface RunGitLaneResult {
|
|
55
|
-
/** The parked-mirror flush — awaited at the serialization points (the
|
|
55
|
+
/** The parked-mirror flush — awaited at the serialization points: the `turn_boundary` subscription here is the regular station (the final boundary of a gracefully ending run included); the leg's post-prompt call is the fallback for a terminal that skipped it. */
|
|
56
56
|
flushGitMirror: () => Promise<void>;
|
|
57
57
|
/** The owed-frame retry's `turn_boundary` subscription; the driver's teardown releases it first. */
|
|
58
58
|
unsubGitRetry: () => void;
|
|
@@ -281,6 +281,8 @@ export function createHarnessHandlers(input) {
|
|
|
281
281
|
};
|
|
282
282
|
const onTurnEnd = () => {
|
|
283
283
|
stats.turns += 1;
|
|
284
|
+
if (prepared.abortController.signal.aborted)
|
|
285
|
+
prepared.workCutRef.abortedBeforeTurnEnd = true;
|
|
284
286
|
const stopExtra = rs.turn.turnStopReason !== undefined ? { stopReason: rs.turn.turnStopReason } : {};
|
|
285
287
|
queue.push(rs.turn.turnUsage
|
|
286
288
|
? { type: "turn_end", usage: rs.turn.turnUsage, ...(rs.turn.turnUsageMissing ? { usageMissing: true } : {}), ...stopExtra, ...ident() }
|
|
@@ -1,20 +1,9 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* design/393 S5 — the run body's IDENTITY WIRING (R1), verbatim from `Runner.runLocked`, the first thing after
|
|
3
|
-
* `prepared` exists: the notification lane's bindings (harness, session anchor, identity mint), the backstop
|
|
4
|
-
* carrier's immediate seats, the event-identity mint (`ident`) and the run's canonical task id, the wiring-manifest
|
|
5
|
-
* frame and the roster-delta subscription, the delegation-lifecycle spawn station and its owed-terminal carrier,
|
|
6
|
-
* the manual-compact mooted channel, the harness sinks for undrained engine notes / user inputs / consumed
|
|
7
|
-
* engine notes, the notify / capture-opt-out bridges, the spawner's injector hand-back, the idle-parked
|
|
8
|
-
* notification redelivery at turn open, the loop latch and the live-task handle publication, and the run's
|
|
9
|
-
* usage counters. Every push here happens before the run's first model/tool interaction, as it did.
|
|
10
|
-
*/
|
|
11
|
-
import { type AgentHarness } from "../../internal/harness.js";
|
|
12
1
|
import type { PeerInboundChainRef } from "../../agents/peer-admission.js";
|
|
13
2
|
import { type PendingSessionNotifications, type SystemInjectionPriority, type TaskNotificationPayload } from "../task-notification.js";
|
|
14
3
|
import type { PushQueue } from "../push-queue.js";
|
|
15
4
|
import type { TaskEvent, TaskSpec } from "../types.js";
|
|
16
5
|
import type { Stats } from "./assemble-result.js";
|
|
17
|
-
import type { CaptureOptOutRef, LiveHandle, ManualCompactRef, NotifyRef, Prepared, RunInternals, RunnerDepsSeat, TaskIdRef } from "./contracts.js";
|
|
6
|
+
import type { CaptureOptOutRef, LiveHandle, ManualCompactRef, NotificationLaneBindings, NotifyRef, Prepared, RunInternals, RunnerDepsSeat, TaskIdRef } from "./contracts.js";
|
|
18
7
|
export interface RunIdentityWiringInput {
|
|
19
8
|
/** borrowed-readonly — the task spec: the task id and the memory / notification seats it names. */
|
|
20
9
|
spec: TaskSpec;
|
|
@@ -38,7 +27,7 @@ export interface RunIdentityWiringInput {
|
|
|
38
27
|
notifyRef: NotifyRef | undefined;
|
|
39
28
|
/** borrowed-mutable — the capture opt-out bridge: `flip` is bound here when a memory session mounted. */
|
|
40
29
|
captureOptOutRef: CaptureOptOutRef | undefined;
|
|
41
|
-
/** borrowed-readonly — the notification lane's ONE injection entry (the
|
|
30
|
+
/** borrowed-readonly — the notification lane's ONE injection entry (the R0 lane's). */
|
|
42
31
|
injectTaskNotification: (notification: TaskNotificationPayload, opts?: {
|
|
43
32
|
priority?: SystemInjectionPriority;
|
|
44
33
|
}) => Promise<"queued" | "parked" | "dropped_duplicate">;
|
|
@@ -46,26 +35,10 @@ export interface RunIdentityWiringInput {
|
|
|
46
35
|
deliveredAtTurnOpen: Set<string>;
|
|
47
36
|
/** borrowed-mutable — design/176: the peer inbound chain, overwritten by each consumed peer-class payload. */
|
|
48
37
|
peerInboundChainRef: PeerInboundChainRef;
|
|
49
|
-
/** borrowed-mutable — the
|
|
50
|
-
* the harness, the session anchor and the identity mint the lane's closures read, and reads the
|
|
51
|
-
* the undrained-notes sink. */
|
|
52
|
-
notificationLane:
|
|
53
|
-
harness: AgentHarness | undefined;
|
|
54
|
-
sessionId: string | undefined;
|
|
55
|
-
ident: () => {
|
|
56
|
-
eventId?: string;
|
|
57
|
-
parentToolCallId?: string;
|
|
58
|
-
sourceTaskId?: string;
|
|
59
|
-
};
|
|
60
|
-
};
|
|
61
|
-
/** borrowed-mutable — the driver's held agent_end account (backlog #389), a view over its `let`: the undrained-inputs
|
|
62
|
-
* sink writes it when the run committed a durable park; the driver's tail reads it. */
|
|
63
|
-
undrainedUserAtEnd: {
|
|
64
|
-
current: {
|
|
65
|
-
steer: number;
|
|
66
|
-
followUp: number;
|
|
67
|
-
} | undefined;
|
|
68
|
-
};
|
|
38
|
+
/** borrowed-mutable — the notification lane's bindings seat (its own `let`s behind getters / setters, never a copy):
|
|
39
|
+
* this lane binds the harness, the session anchor and the identity mint the lane's closures read, and reads the
|
|
40
|
+
* anchor back in the undrained-notes sink. */
|
|
41
|
+
notificationLane: NotificationLaneBindings;
|
|
69
42
|
/** borrowed-mutable — the Runner's per-session parked-notification store: drained at turn open, re-pended on failure. */
|
|
70
43
|
pendingSessionNotifications: PendingSessionNotifications;
|
|
71
44
|
/** borrowed-readonly — the Runner's deployment deps, read LIVE (`onDelegationLifecycle`, `onNotice`). */
|
|
@@ -92,5 +65,20 @@ export interface RunIdentityWiringResult {
|
|
|
92
65
|
};
|
|
93
66
|
/** This leg's usage counters, zeroed here; the harness-handlers lane is their writer from the first turn on. */
|
|
94
67
|
stats: Stats;
|
|
68
|
+
/** backlog #389 — the held agent_end account, a READ FACE over this lane's own `let` (the undrained-inputs sink writes it
|
|
69
|
+
* when the run committed a durable park); the terminal-adoption lane settles it minus what the park carried. */
|
|
70
|
+
undrainedUserAtEnd: {
|
|
71
|
+
readonly current: {
|
|
72
|
+
steer: number;
|
|
73
|
+
followUp: number;
|
|
74
|
+
} | undefined;
|
|
75
|
+
};
|
|
76
|
+
/** #677 — did the run END with a person's steer / follow-up still pending (queued, or drained at the final boundary and
|
|
77
|
+
* never served)? A READ FACE over this lane's own `let`, written by the same undrained-inputs sink on BOTH its arms
|
|
78
|
+
* (park or not): the terminal-adoption lane folds it into the answer-settled verdict — a "stop" answer the person had
|
|
79
|
+
* already asked to continue past is not a settled answer, so a stop that cut that continuation is a stop on work. */
|
|
80
|
+
userInputLostAtEnd: {
|
|
81
|
+
readonly current: boolean;
|
|
82
|
+
};
|
|
95
83
|
}
|
|
96
84
|
export declare function runIdentityWiring(input: RunIdentityWiringInput): RunIdentityWiringResult;
|
|
@@ -3,7 +3,7 @@ import { createSafeNotifier } from "../safe-notify.js";
|
|
|
3
3
|
import { discloseDroppedPending, renderTaskNotificationXml, taskNotificationDedupKey } from "../task-notification.js";
|
|
4
4
|
import { deliverDelegationLifecycle, deliverEngineNotice, undrainedUserInputNotices } from "../types.js";
|
|
5
5
|
export function runIdentityWiring(input) {
|
|
6
|
-
const { spec, queue, prepared, internals, taskIdRef, onReady, manualCompactRef, notifyRef, captureOptOutRef, injectTaskNotification, deliveredAtTurnOpen, peerInboundChainRef, notificationLane,
|
|
6
|
+
const { spec, queue, prepared, internals, taskIdRef, onReady, manualCompactRef, notifyRef, captureOptOutRef, injectTaskNotification, deliveredAtTurnOpen, peerInboundChainRef, notificationLane, pendingSessionNotifications, runner } = input;
|
|
7
7
|
notificationLane.harness = prepared.harness;
|
|
8
8
|
notificationLane.sessionId = prepared.sessionId;
|
|
9
9
|
if (taskIdRef)
|
|
@@ -40,9 +40,12 @@ export function runIdentityWiring(input) {
|
|
|
40
40
|
pendingSessionNotifications.pend(notificationLane.sessionId, p);
|
|
41
41
|
};
|
|
42
42
|
prepared.harness.engineInjectionsHeld = () => prepared.batchHaltRef.current !== undefined;
|
|
43
|
+
let undrainedUserAtEnd;
|
|
44
|
+
let userInputLostAtEnd = false;
|
|
43
45
|
prepared.harness.onUndrainedUserInputs = (counts) => {
|
|
46
|
+
userInputLostAtEnd = counts.steer + counts.followUp > 0;
|
|
44
47
|
if (prepared.pausedRef.current !== undefined) {
|
|
45
|
-
undrainedUserAtEnd
|
|
48
|
+
undrainedUserAtEnd = counts;
|
|
46
49
|
return;
|
|
47
50
|
}
|
|
48
51
|
for (const notice of undrainedUserInputNotices(counts, spec.taskId ?? prepared.sessionId, prepared.sessionId, prepared.runId)) {
|
|
@@ -80,5 +83,5 @@ export function runIdentityWiring(input) {
|
|
|
80
83
|
const loopLatch = { ended: false, userInterrupted: false, userHalted: false };
|
|
81
84
|
onReady({ harness: prepared.harness, abortController: prepared.abortController, loop: loopLatch, reminderMark: prepared.reminderMark, sessionId: prepared.sessionId, runId: prepared.runId, hookTimeoutMs: prepared.hookTimeoutMs, hookIdentity: prepared.hookIdentity });
|
|
82
85
|
const stats = { turns: 0, tokens: 0, toolCalls: 0, promptTokens: 0, totalInputTokens: 0, cachedTokens: 0, cacheWriteTokens: 0, cacheWriteTokensLong: 0, outputTokens: 0, costMicroUsd: 0 };
|
|
83
|
-
return { runSourceTaskId, parentToolCallId, ident, emitDelegationLifecycle, loopLatch, stats };
|
|
86
|
+
return { runSourceTaskId, parentToolCallId, ident, emitDelegationLifecycle, loopLatch, stats, undrainedUserAtEnd: { get current() { return undrainedUserAtEnd; } }, userInputLostAtEnd: { get current() { return userInputLostAtEnd; } } };
|
|
84
87
|
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* design/393 S6 — the run body's LEG (R13), verbatim from `Runner.runLocked`: the one `harness.prompt` of the leg and
|
|
3
|
+
* everything that decides whether it is issued. Two legs behind one try / catch / finally: the RESUME leg (the walltime
|
|
4
|
+
* and governance-window entrance claims, the gated decision's application, the exhaustion arms, the continuation prompt's
|
|
5
|
+
* assembly — orphaned background tasks, the git frame, the parked steer queue and the wake message each under its own trust
|
|
6
|
+
* framing and redelivery screen — and the prompt itself) and the OBJECTIVE leg (the UserPromptSubmit screen, the git
|
|
7
|
+
* frame's primary delivery, the first-frame listings, the pre-call budget / token / entry-governance gates, the image
|
|
8
|
+
* conversion, the objective's human-input frame and the prompt itself). The resumed decision's application
|
|
9
|
+
* (`applyResumeDecision`) and the gated call's resolver (`resolvePendingCall` — the post-CAS belts, the execution record)
|
|
10
|
+
* are the lane's own module-private functions since design/393 S7, verbatim from the Runner's private methods: the resume
|
|
11
|
+
* leg is their one caller, and a sibling file would be a lane-to-lane reach (the S6 legs' reading). The tail captures the abort facts; the catch
|
|
12
|
+
* re-throws the resume-equivalent env failures after a bounded teardown and adopts everything else as the leg's throw;
|
|
13
|
+
* the finally releases the timer, the diagnostics, the signal, the content-ask bindings, flips the notification lane
|
|
14
|
+
* and releases the four subscriptions in their order.
|
|
15
|
+
*
|
|
16
|
+
* Async (twenty first-level awaits, the same awaits at the same positions). It ends by entering the terminal adoption
|
|
17
|
+
* (`next`) in its LAST continuation — the adoption's first read sits on the tick the finally ran on, as it did in the
|
|
18
|
+
* one-function body — and returns what it returns. The two legs stay ONE function on purpose: splitting them into two
|
|
19
|
+
* async functions (the design's "internal split") costs a microtask on the leg → tail edge, and the tail's first reads
|
|
20
|
+
* there — `abortController.signal.aborted`, `loopLatch.userInterrupted` — are host-mutable attribution facts a late read
|
|
21
|
+
* would mis-sign (the adversarial r2 HIGH-1 finding recorded on them); the forwarded-frame depth ratchet measured the
|
|
22
|
+
* extra hop (58 → 59) when the split was tried.
|
|
23
|
+
*/
|
|
24
|
+
import type { AssistantMessage } from "../../internal/llm.js";
|
|
25
|
+
import { type ActorAssertion } from "../checkpoint-store.js";
|
|
26
|
+
import type { PushQueue } from "../push-queue.js";
|
|
27
|
+
import { type TaskEvent, type TaskSpec } from "../types.js";
|
|
28
|
+
import { type WriteFamily } from "./turn-attachments.js";
|
|
29
|
+
import type { NotificationLaneBindings, Prepared, ResumeRun, RunnerDepsSeat, RunState } from "./contracts.js";
|
|
30
|
+
export interface RunLegInput<R> {
|
|
31
|
+
/** borrowed-readonly — the task spec: the objective, the images, the hooks slot, the principal, the task id. */
|
|
32
|
+
spec: TaskSpec;
|
|
33
|
+
/** borrowed-mutable — the run's event queue: the human-input frames, the git echo frames, the listing echo frames. */
|
|
34
|
+
queue: PushQueue<TaskEvent>;
|
|
35
|
+
/** borrowed-mutable — the leg's prepared seat: the harness is prompted, the blocked / git / listing refs written, the abort controller aborted and the signal released in the finally. */
|
|
36
|
+
prepared: Prepared;
|
|
37
|
+
/** borrowed-readonly — the resume plan when this leg resumes a checkpoint: chooses the resume leg; its delivery bits are written. */
|
|
38
|
+
resume: ResumeRun | undefined;
|
|
39
|
+
/** borrowed-mutable — the run's mutable state: the limit flags and the platform terminal are written by the entrance gates. */
|
|
40
|
+
rs: RunState;
|
|
41
|
+
/** borrowed-readonly — the API-boundary attribution snapshot of the objective's actor (the objective leg's speaker envelope). */
|
|
42
|
+
entryActor: ActorAssertion | undefined;
|
|
43
|
+
/** borrowed-readonly — the effective walltime window (undefined = unbounded): `<= 0` refuses the first turn. */
|
|
44
|
+
effectiveTimeoutMs: number | undefined;
|
|
45
|
+
/** borrowed-mutable — the hard walltime timer: claimed (`fired`) and cleared by the exhausted arms and the finally. */
|
|
46
|
+
timeout: {
|
|
47
|
+
fired: boolean;
|
|
48
|
+
clear: () => void;
|
|
49
|
+
};
|
|
50
|
+
/** borrowed-readonly — the content push (the resumed batch's frames ride it with the leg's identity). */
|
|
51
|
+
pushContent: (e: TaskEvent) => void;
|
|
52
|
+
/** borrowed-readonly — the run's event-identity mint. */
|
|
53
|
+
ident: () => {
|
|
54
|
+
eventId: string;
|
|
55
|
+
parentToolCallId?: string;
|
|
56
|
+
sourceTaskId?: string;
|
|
57
|
+
};
|
|
58
|
+
/** borrowed-readonly — the `message_committed` mint (the resumed batch's re-applied tool results). */
|
|
59
|
+
emitCommitted: (entryId: string, role: "user" | "assistant" | "toolResult", toolCallId?: string) => void;
|
|
60
|
+
/** borrowed-readonly — the write-family resolver (the resume-executed gated write's attachment anchor). */
|
|
61
|
+
writeFamilyOf: (name: string) => WriteFamily | undefined;
|
|
62
|
+
/** borrowed-mutable — the observed tool-start ids: the resume-executed gated call registers itself here. */
|
|
63
|
+
startedToolCallIds: Set<string>;
|
|
64
|
+
/** borrowed-readonly — the harness-handlers lane's workspace-move announcer (the approved `cd`'s frame). */
|
|
65
|
+
announceWorkspaceMove: () => void;
|
|
66
|
+
/** borrowed-readonly — the brain-sinks composition the leg's prompt runs under. */
|
|
67
|
+
withBrainSinks: <T>(fn: () => Promise<T>) => Promise<T>;
|
|
68
|
+
/** borrowed-readonly — the git lane's parked-mirror flush, settled after the prompt (single-turn legs reach no boundary). */
|
|
69
|
+
flushGitMirror: () => Promise<void>;
|
|
70
|
+
/** borrowed-mutable — the loop-liveness latch: `ended` flips when the prompt settles (or a no-prompt / throw arm is taken); `userInterrupted` is snapshotted. */
|
|
71
|
+
loopLatch: {
|
|
72
|
+
ended: boolean;
|
|
73
|
+
readonly userInterrupted: boolean;
|
|
74
|
+
};
|
|
75
|
+
/** borrowed-mutable — the notification lane's bindings seat: `live` flips false in the finally (every later notification parks). */
|
|
76
|
+
notificationLane: NotificationLaneBindings;
|
|
77
|
+
/** borrowed-readonly — the notification lane's subscription release, called in the finally right after the flip. */
|
|
78
|
+
unsubscribeTaskNotifications: () => void;
|
|
79
|
+
/** borrowed-readonly — the git lane's owed-frame retry release, called in the finally first of the three. */
|
|
80
|
+
unsubGitRetry: () => void;
|
|
81
|
+
/** borrowed-readonly — the git lane's boundary-handler release, called second. */
|
|
82
|
+
unsubBoundary: () => void;
|
|
83
|
+
/** borrowed-readonly — the git lane's harness-event release, called third. */
|
|
84
|
+
unsub: () => void;
|
|
85
|
+
/** borrowed-readonly — the Runner's deployment deps, read LIVE (`onError`, `hooks`, `onNotice`, `allowImageUrl`; the resumed
|
|
86
|
+
* decision's resolver files its execution record's word through `onNotice` too); the one home of why it is a seat and not a
|
|
87
|
+
* captured object is {@link RunnerDepsSeat}. */
|
|
88
|
+
runner: RunnerDepsSeat;
|
|
89
|
+
/** borrowed-readonly — the terminal adoption, entered in this lane's last continuation with the leg's facts. */
|
|
90
|
+
next: (leg: RunLegResult) => Promise<R>;
|
|
91
|
+
}
|
|
92
|
+
/** The leg's facts — what the terminal adoption and the settle read. */
|
|
93
|
+
export interface RunLegResult {
|
|
94
|
+
/** The final assistant message; undefined on every no-prompt arm (blocked, refused, exhausted). */
|
|
95
|
+
final: AssistantMessage | undefined;
|
|
96
|
+
/** What the leg threw (undefined on a clean end); the terminal adoption may lift a typed cause over it. */
|
|
97
|
+
threw: unknown;
|
|
98
|
+
/** The live-abort flag, captured before the finally's unconditional release-abort. */
|
|
99
|
+
abortedLive: boolean;
|
|
100
|
+
/** The snapshot of `loopLatch.userInterrupted`, taken with `abortedLive`. */
|
|
101
|
+
userInterruptedLive: boolean;
|
|
102
|
+
/** design/174: the answered-but-never-collected deliveries the finally settled. */
|
|
103
|
+
strandedHumanAnswers: ReadonlyArray<{
|
|
104
|
+
deliveryId: string;
|
|
105
|
+
toolCallId: string;
|
|
106
|
+
}>;
|
|
107
|
+
}
|
|
108
|
+
export declare function runLeg<R>(input: RunLegInput<R>): Promise<R>;
|