@sema-agent/core 7.11.1 → 7.11.2
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 +20 -8
- package/dist/core/runner/compaction-knobs.d.ts +45 -0
- package/dist/core/runner/compaction-knobs.js +3 -0
- package/dist/core/runner/contracts.d.ts +8 -1
- package/dist/core/runner/run-attachment-seats.d.ts +20 -0
- package/dist/core/runner/run-attachment-seats.js +187 -0
- package/dist/core/runner/run-brain-sinks.d.ts +29 -0
- package/dist/core/runner/run-brain-sinks.js +61 -0
- package/dist/core/runner/run-clock-and-content.d.ts +52 -0
- package/dist/core/runner/run-clock-and-content.js +26 -0
- package/dist/core/runner/run-compaction-machinery.d.ts +35 -0
- package/dist/core/runner/run-compaction-machinery.js +98 -0
- package/dist/core/runner/run-git-lane.d.ts +64 -0
- package/dist/core/runner/run-git-lane.js +102 -0
- package/dist/core/runner/run-identity-wiring.d.ts +96 -0
- package/dist/core/runner/run-identity-wiring.js +84 -0
- package/dist/core/runner/run-reasoning-seat.d.ts +27 -0
- package/dist/core/runner/run-reasoning-seat.js +48 -0
- package/dist/core/runner/run-recovery-lanes.d.ts +54 -0
- package/dist/core/runner/run-recovery-lanes.js +180 -0
- package/dist/core/runner/run-stop-and-final-verify.d.ts +32 -0
- package/dist/core/runner/run-stop-and-final-verify.js +159 -0
- package/dist/core/runner/run-telemetry-and-budget-seats.d.ts +38 -0
- package/dist/core/runner/run-telemetry-and-budget-seats.js +159 -0
- package/dist/core/runner/run-tool-mount-facts.d.ts +26 -0
- package/dist/core/runner/run-tool-mount-facts.js +58 -0
- package/dist/core/runner/run-turn-boundary.d.ts +0 -35
- package/dist/core/runner/run-turn-boundary.js +1 -3
- package/dist/core/runner/runtask.js +94 -1116
- package/dist/tools/fs/fs-bash.js +3 -2
- package/package.json +1 -1
|
@@ -1,28 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { deliverDelegationLifecycle, deliverEngineNotice, undrainedUserInputNotices } from "../types.js";
|
|
4
|
-
import { planRejectionClears, resolveTriggerWindow } from "../context-edit.js";
|
|
1
|
+
import { mintSystemReminder } from "../reminder-mint.js";
|
|
2
|
+
import { deliverEngineNotice, undrainedUserInputNotices } from "../types.js";
|
|
5
3
|
import { AgentHarness, DEFAULT_COMPACTION_SETTINGS, isSyntheticApiErrorMessage, uuidv7 } from "../../internal/harness.js";
|
|
6
4
|
import { snapshotActorAssertion } from "../../internal/llm.js";
|
|
7
|
-
import { CheckpointError, remainingBudgetMicroUsd, readPendingSteerQueue,
|
|
8
|
-
import { GIT_STATUS_ECHO_PREVIEW
|
|
5
|
+
import { CheckpointError, remainingBudgetMicroUsd, readPendingSteerQueue, resolveCheckpointStore, realApprovalOrgFact } from "../checkpoint-store.js";
|
|
6
|
+
import { GIT_STATUS_ECHO_PREVIEW } from "./git-status-frame.js";
|
|
9
7
|
import { settleExecutionRecord } from "./execution-record.js";
|
|
10
|
-
import { engineVersion } from "../version.js";
|
|
11
|
-
import { CONFIG_CATALOG_VERSION, declarationReasons, resolveEffectiveConfig } from "../../config/catalog.js";
|
|
12
8
|
import { eventDefaultOn } from "../../prompt-assembly/event-registry.js";
|
|
13
|
-
import { DEFAULT_COMPACTION_INSTRUCTIONS, createRapidRefillState, maybeCompact
|
|
9
|
+
import { DEFAULT_COMPACTION_INSTRUCTIONS, createRapidRefillState, maybeCompact } from "../auto-compaction.js";
|
|
14
10
|
import { ASK_USER_QUESTION_TOOL_NAME } from "../ask-question.js";
|
|
15
11
|
import { boundInputHashOf } from "../canonical-json.js";
|
|
16
|
-
import { computeCostMicroUsd,
|
|
12
|
+
import { computeCostMicroUsd, modelCostToPricing } from "../pricing.js";
|
|
17
13
|
import { emitTrace } from "../trace.js";
|
|
18
14
|
import { ORG_ADJUDICATION_TIMEOUT_MS, settleOrgVerdictWithin } from "../permission-rule-org.js";
|
|
19
15
|
import { emitTaskOutcome } from "../task-outcome.js";
|
|
20
16
|
import { isDegenerateCutMessage } from "../../brain/terminal-cause.js";
|
|
21
17
|
import { redactThenCut } from "../../agents/subagent-steps.js";
|
|
22
|
-
import { resolveReasoning } from "../../brain/reasoning.js";
|
|
23
18
|
import { adjudicateDerivedRoute, authCarrierFingerprint, fallbackToPrimaryNotice, normalizeBaseUrl, sameRouteIdentity } from "../../brain/route-adjudicator.js";
|
|
24
|
-
import {
|
|
25
|
-
import { expandTiers,
|
|
19
|
+
import { runWithReasoningWireFacts } from "../../brain/status-sink.js";
|
|
20
|
+
import { expandTiers, resolveTaskModel } from "../roles.js";
|
|
26
21
|
import { screenSwappableDeps } from "../swappable-deps.js";
|
|
27
22
|
import { AutoModeBreakerLedger } from "../auto-mode.js";
|
|
28
23
|
import { runSideQuery } from "../side-query.js";
|
|
@@ -30,11 +25,9 @@ import { generatePromptSuggestions } from "./prompt-suggestions.js";
|
|
|
30
25
|
import { PushQueue } from "../push-queue.js";
|
|
31
26
|
import { TtlSessionStore } from "../session-store.js";
|
|
32
27
|
import { toImageContent } from "./image.js";
|
|
33
|
-
import { SKILLS_LISTING_PROBE_HEADER, resolveOutputRetries } from "./synthetic-tools.js";
|
|
34
|
-
import { cacheFamilyOf, usageCostMicroUsd } from "./usage-accounting.js";
|
|
35
28
|
import { assembleResult, errorCodeOf } from "./assemble-result.js";
|
|
36
29
|
import { amendTerminal, terminalProjection } from "./terminal-projection.js";
|
|
37
|
-
import {
|
|
30
|
+
import { attachmentEnvelopeTags, commitAgentListing, commitSkillsListing, reduceToolEnd, renderAgentListingDelta, renderOrphanedBackgroundTasks, renderSkillsListingDelta, stampWriteAnchor } from "./turn-attachments.js";
|
|
38
31
|
import { buildWorkingFileAttachments, centerAdoptionOption, contextInstructionFilesOption, emitInputTruncated, forkContextOption } from "./compaction-call-options.js";
|
|
39
32
|
import { effectiveDelegationFacts, prepareTask } from "./prepare-task.js";
|
|
40
33
|
import { drainForwardedFramesBeforeDone, forwardsSubagentEvents } from "./prepare-run-refs.js";
|
|
@@ -54,16 +47,17 @@ import { PAUSE_REGISTRY } from "../pause-registry.js";
|
|
|
54
47
|
import { refuseOutOfContractDecision, toolPolicyNameSets } from "../tool-policy.js";
|
|
55
48
|
import { mintGateOutcome } from "./gate-exit.js";
|
|
56
49
|
import { defaultTaskRegistry } from "../task-registry.js";
|
|
57
|
-
import {
|
|
50
|
+
import { isDelegatedAgentTerminal, isTerminalTaskNotification, PendingSessionNotifications, renderTaskNotificationXml, SystemInjectionQueue, taskNotificationDedupKey } from "../task-notification.js";
|
|
58
51
|
import { ToolDetachHub } from "../tool-detach.js";
|
|
59
52
|
import { createPeerInboundChainRef, createPeerSelfRef } from "../../agents/peer-admission.js";
|
|
60
53
|
import { createRunState } from "./initial-run-state.js";
|
|
61
54
|
import { nextHumanInputSeq } from "./steer-admission.js";
|
|
62
|
-
import { reconciledToolEndBody, toolEndBodyFrom, toolResultMsg
|
|
55
|
+
import { reconciledToolEndBody, toolEndBodyFrom, toolResultMsg } from "./tool-end-body.js";
|
|
63
56
|
import { answerFaceForRedeemedCall, deepJsonEqual, DEFERRED_REISSUE, pendingContentAskCallId, resumeContinuation, resumeDecisionWasNegative } from "./decide-continuation.js";
|
|
64
|
-
import { awaitChargeWithSlowDisclosure, DEFAULT_PRECALL_OUTPUT_TOKENS, discloseUnevaluableWindow, platformLimitTerminal,
|
|
57
|
+
import { awaitChargeWithSlowDisclosure, DEFAULT_PRECALL_OUTPUT_TOKENS, discloseUnevaluableWindow, platformLimitTerminal, TIMER_LATENESS_REPORT_MS } from "./clock-and-limits.js";
|
|
65
58
|
import { gitRestateOption, resolveGitLegDelivery, wrapGitFrame } from "./git-leg-delivery.js";
|
|
66
|
-
import {
|
|
59
|
+
import { createTurnBoundary } from "./run-turn-boundary.js";
|
|
60
|
+
import { MAX_CONSECUTIVE_COMPACTION_FAILURES } from "./compaction-knobs.js";
|
|
67
61
|
import { createHarnessHandlers } from "./run-harness-handlers.js";
|
|
68
62
|
import { resumeAdmission } from "./resume-admission.js";
|
|
69
63
|
import { resumeReviewOutcome } from "./resume-review-outcome.js";
|
|
@@ -78,7 +72,17 @@ import { streamReap } from "./stream-reap.js";
|
|
|
78
72
|
import { streamSteerVerb } from "./stream-steer-verb.js";
|
|
79
73
|
import { streamLifecycleVerbs } from "./stream-lifecycle-verbs.js";
|
|
80
74
|
import { streamHaltVerbs } from "./stream-halt-verbs.js";
|
|
81
|
-
|
|
75
|
+
import { runIdentityWiring } from "./run-identity-wiring.js";
|
|
76
|
+
import { runTelemetryAndBudgetSeats } from "./run-telemetry-and-budget-seats.js";
|
|
77
|
+
import { runAttachmentSeats } from "./run-attachment-seats.js";
|
|
78
|
+
import { runToolMountFacts } from "./run-tool-mount-facts.js";
|
|
79
|
+
import { runReasoningSeat } from "./run-reasoning-seat.js";
|
|
80
|
+
import { runClockAndContent } from "./run-clock-and-content.js";
|
|
81
|
+
import { runBrainSinks } from "./run-brain-sinks.js";
|
|
82
|
+
import { runCompactionMachinery } from "./run-compaction-machinery.js";
|
|
83
|
+
import { runStopAndFinalVerify } from "./run-stop-and-final-verify.js";
|
|
84
|
+
import { runRecoveryLanes } from "./run-recovery-lanes.js";
|
|
85
|
+
import { runGitLane } from "./run-git-lane.js";
|
|
82
86
|
const ORG_DISCLOSURE_MAX_CHARS = 600;
|
|
83
87
|
const SUGGESTIONS_DEFAULT_COUNT = 3;
|
|
84
88
|
const SUGGESTIONS_MAX_COUNT = 8;
|
|
@@ -329,33 +333,48 @@ export class Runner {
|
|
|
329
333
|
? await this.acquireSessionLock(spec.sessionId)
|
|
330
334
|
: undefined;
|
|
331
335
|
try {
|
|
332
|
-
await this.runLocked(
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
const oldest = this.parentConstraintRegistry.keys().next().value;
|
|
345
|
-
if (oldest !== undefined)
|
|
346
|
-
this.parentConstraintRegistry.delete(oldest);
|
|
336
|
+
await this.runLocked({
|
|
337
|
+
spec,
|
|
338
|
+
queue,
|
|
339
|
+
setResult: (r) => {
|
|
340
|
+
resultValue = r;
|
|
341
|
+
const pcs = internals?.inheritedGate?.parentConstraints;
|
|
342
|
+
if (resume !== undefined)
|
|
343
|
+
this.locallyClaimedTokens.delete(resume.cp.token);
|
|
344
|
+
const rToken = r.terminal.kind === "paused" ? r.terminal.token : undefined;
|
|
345
|
+
if (resume !== undefined && rToken !== resume.cp.token) {
|
|
346
|
+
this.parentConstraintRegistry.delete(resume.cp.token);
|
|
347
|
+
this.suspendedEnvReaps.delete(resume.cp.token);
|
|
347
348
|
}
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
349
|
+
if (r.terminal.kind === "paused" && PAUSE_REGISTRY[r.terminal.gate.kind].taskStatus === "suspended" && pcs !== undefined && pcs.length > 0) {
|
|
350
|
+
if (this.parentConstraintRegistry.size >= Runner.PARENT_CONSTRAINT_REGISTRY_CAP) {
|
|
351
|
+
const oldest = this.parentConstraintRegistry.keys().next().value;
|
|
352
|
+
if (oldest !== undefined)
|
|
353
|
+
this.parentConstraintRegistry.delete(oldest);
|
|
354
|
+
}
|
|
355
|
+
this.parentConstraintRegistry.set(r.terminal.token, pcs);
|
|
356
|
+
}
|
|
357
|
+
},
|
|
358
|
+
onSuggestions: (p) => {
|
|
359
|
+
suggestionsDone = p;
|
|
360
|
+
},
|
|
361
|
+
onReady: (h) => {
|
|
362
|
+
handle = h;
|
|
363
|
+
publishReady(h);
|
|
364
|
+
},
|
|
365
|
+
onSuspend: (s) => {
|
|
366
|
+
reapHandle = s;
|
|
367
|
+
this.suspendedEnvReaps.set(s.token, s);
|
|
368
|
+
},
|
|
369
|
+
manualCompactRef,
|
|
370
|
+
taskIdRef,
|
|
371
|
+
resume,
|
|
372
|
+
internals: { ...(internals ?? {}), detachHub },
|
|
373
|
+
notifyRef,
|
|
374
|
+
captureOptOutRef,
|
|
375
|
+
entryActor,
|
|
376
|
+
entryTracer,
|
|
377
|
+
});
|
|
359
378
|
}
|
|
360
379
|
finally {
|
|
361
380
|
releaseLock?.();
|
|
@@ -410,7 +429,8 @@ export class Runner {
|
|
|
410
429
|
destroy,
|
|
411
430
|
};
|
|
412
431
|
}
|
|
413
|
-
async runLocked(
|
|
432
|
+
async runLocked(input) {
|
|
433
|
+
const { spec, queue, setResult, onSuggestions, onReady, onSuspend, manualCompactRef, taskIdRef, resume, internals, notifyRef, captureOptOutRef, entryActor, entryTracer } = input;
|
|
414
434
|
const prepareResume = resume
|
|
415
435
|
? {
|
|
416
436
|
leafId: resume.cp.leafId,
|
|
@@ -525,577 +545,26 @@ export class Runner {
|
|
|
525
545
|
injectTaskNotification(notification, opts);
|
|
526
546
|
},
|
|
527
547
|
}, this, taskIdRef);
|
|
528
|
-
notificationHarness = prepared.harness;
|
|
529
|
-
notificationSessionId = prepared.sessionId;
|
|
530
|
-
if (taskIdRef)
|
|
531
|
-
taskIdRef.effectiveMemoryScopes = prepared.effectiveMemoryScopes;
|
|
532
|
-
if (taskIdRef)
|
|
533
|
-
taskIdRef.editedFiles = prepared.editedFilesSnapshot;
|
|
534
|
-
const runSourceTaskId = spec.taskId ?? prepared.sessionId;
|
|
535
|
-
const parentToolCallId = internals?.parentToolCallId;
|
|
536
|
-
const ident = () => parentToolCallId !== undefined ? { eventId: uuidv7(), parentToolCallId, sourceTaskId: runSourceTaskId } : { eventId: uuidv7() };
|
|
537
|
-
notificationIdent = ident;
|
|
538
|
-
queue.push({ type: "wiring_manifest", manifest: prepared.wiringManifest, ...ident() });
|
|
539
|
-
prepared.toolRosterDeltas.subscribe((delta) => queue.push({ type: "tool_roster_delta", delta, ...ident() }));
|
|
540
|
-
const delegationLifecycleNotifier = createSafeNotifier({
|
|
541
|
-
onError: (f) => console.warn(`[sema-core] ${f.site}: delegation-lifecycle observer threw (contained; further failures counted, not re-disclosed): ${f.error.message}`),
|
|
542
|
-
});
|
|
543
|
-
const emitDelegationLifecycle = (event) => {
|
|
544
|
-
if (!prepared.hookIdentity.isDelegatedChild)
|
|
545
|
-
return;
|
|
546
|
-
if (this.deps.onDelegationLifecycle === undefined)
|
|
547
|
-
return;
|
|
548
|
-
deliverDelegationLifecycle(this.deps.onDelegationLifecycle, event, delegationLifecycleNotifier, "runtask.onDelegationLifecycle");
|
|
549
|
-
};
|
|
550
|
-
emitDelegationLifecycle({ phase: "spawn", identity: prepared.hookIdentity });
|
|
551
|
-
if (taskIdRef !== undefined && prepared.hookIdentity.isDelegatedChild && this.deps.onDelegationLifecycle !== undefined) {
|
|
552
|
-
taskIdRef.delegationTerminalOwed = prepared.hookIdentity;
|
|
553
|
-
}
|
|
554
|
-
manualCompactRef.emitMooted = (reason) => {
|
|
555
|
-
queue.push({ type: "compaction_outcome", outcome: "mooted", trigger: "manual", reason, ...ident() });
|
|
556
|
-
};
|
|
557
|
-
prepared.harness.onUndrainedEngineNotes = (payloads) => {
|
|
558
|
-
if (notificationSessionId === undefined)
|
|
559
|
-
return;
|
|
560
|
-
for (const p of payloads)
|
|
561
|
-
this.pendingSessionNotifications.pend(notificationSessionId, p);
|
|
562
|
-
};
|
|
563
|
-
prepared.harness.engineInjectionsHeld = () => prepared.batchHaltRef.current !== undefined;
|
|
564
548
|
let undrainedUserAtEnd;
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
}
|
|
570
|
-
for (const notice of undrainedUserInputNotices(counts, spec.taskId ?? prepared.sessionId, prepared.sessionId, prepared.runId)) {
|
|
571
|
-
deliverEngineNotice(this.deps.onNotice, notice);
|
|
572
|
-
}
|
|
573
|
-
};
|
|
574
|
-
prepared.harness.onEngineNoteConsumed = (p) => {
|
|
575
|
-
const peer = p?.peer;
|
|
576
|
-
if (peer !== undefined && Array.isArray(peer.hopChain))
|
|
577
|
-
peerInboundChainRef.current = [...peer.hopChain];
|
|
578
|
-
};
|
|
579
|
-
if (notifyRef)
|
|
580
|
-
notifyRef.inject = injectTaskNotification;
|
|
581
|
-
if (captureOptOutRef && prepared.memoryEngineSession?.captureOptOut !== undefined) {
|
|
582
|
-
captureOptOutRef.flip = prepared.memoryEngineSession.captureOptOut.flip;
|
|
583
|
-
}
|
|
584
|
-
try {
|
|
585
|
-
internals?.onNotifyInjectorReady?.(injectTaskNotification);
|
|
586
|
-
}
|
|
587
|
-
catch {
|
|
588
|
-
}
|
|
589
|
-
{
|
|
590
|
-
const pendingIdle = this.pendingSessionNotifications.drain(prepared.sessionId);
|
|
591
|
-
if (pendingIdle !== undefined) {
|
|
592
|
-
for (const payload of discloseDroppedPending(pendingIdle)) {
|
|
593
|
-
const parkedPriority = pendingIdle.priorities?.get(payload);
|
|
594
|
-
deliveredAtTurnOpen.add(taskNotificationDedupKey(payload));
|
|
595
|
-
queue.push({ type: "task_notification", notification: payload, ...(parkedPriority !== undefined ? { priority: parkedPriority } : {}), ...ident() });
|
|
596
|
-
void prepared.harness.nextTurn(renderTaskNotificationXml(payload), { provenance: "engine-note", enginePayload: payload }).catch(() => {
|
|
597
|
-
this.pendingSessionNotifications.pend(prepared.sessionId, payload, parkedPriority);
|
|
598
|
-
});
|
|
599
|
-
}
|
|
600
|
-
}
|
|
601
|
-
}
|
|
602
|
-
const loopLatch = { ended: false, userInterrupted: false, userHalted: false };
|
|
603
|
-
onReady({ harness: prepared.harness, abortController: prepared.abortController, loop: loopLatch, reminderMark: prepared.reminderMark, sessionId: prepared.sessionId, runId: prepared.runId, hookTimeoutMs: prepared.hookTimeoutMs, hookIdentity: prepared.hookIdentity });
|
|
604
|
-
const stats = { turns: 0, tokens: 0, toolCalls: 0, promptTokens: 0, totalInputTokens: 0, cachedTokens: 0, cacheWriteTokens: 0, cacheWriteTokensLong: 0, outputTokens: 0, costMicroUsd: 0 };
|
|
605
|
-
prepared.liveSpendRef.get = () => ({ costMicroUsd: stats.costMicroUsd, tokens: stats.tokens, turns: stats.turns, walltimeMs: Math.round(performance.now() - rs.telemetry.taskStartMonotonic) });
|
|
606
|
-
if (resume &&
|
|
607
|
-
resume.cp.suspendedAt !== undefined &&
|
|
608
|
-
(resume.cp.gate.kind === "human" ||
|
|
609
|
-
resume.cp.gate.kind === "irreversible_ask" ||
|
|
610
|
-
resume.cp.gate.kind === "needs_review" ||
|
|
611
|
-
resume.cp.gate.kind === "plan_review")) {
|
|
612
|
-
const waitMs = Math.max(0, prepared.now() - resume.cp.suspendedAt);
|
|
613
|
-
const decision = resume.outcome.gate === "wake" ? undefined : resume.outcome.decision;
|
|
614
|
-
prepared.humanReviewRef.count += 1;
|
|
615
|
-
prepared.humanReviewRef.totalWaitMs += waitMs;
|
|
616
|
-
const gateToolName = "toolName" in resume.cp.gate ? resume.cp.gate.toolName : undefined;
|
|
617
|
-
prepared.humanReviewRef.gates.push({ kind: resume.cp.gate.kind, waitMs, ...(decision !== undefined ? { decision } : {}), ...(gateToolName !== undefined ? { toolName: gateToolName } : {}) });
|
|
618
|
-
}
|
|
619
|
-
if (resume !== undefined && resume.outcome.gate === "plan_review" && resume.outcome.decision === "reject") {
|
|
620
|
-
prepared.planModeRef.active = true;
|
|
621
|
-
}
|
|
622
|
-
const rs = createRunState();
|
|
623
|
-
rs.telemetry.cacheFamily = cacheFamilyOf(prepared.model);
|
|
624
|
-
rs.telemetry.pricing = this.deps.pricing?.[prepared.model.id] ?? modelCostToPricing(prepared.model.cost);
|
|
625
|
-
rs.telemetry.pricingConfigured = isModelPriced(prepared.model, this.deps.pricing);
|
|
626
|
-
if (spec.limits?.degrade) {
|
|
627
|
-
try {
|
|
628
|
-
rs.degrade.degradeToModel = resolveModel(spec.limits.degrade.to, modelCatalog);
|
|
629
|
-
}
|
|
630
|
-
catch (e) {
|
|
631
|
-
this.deps.onError?.(e, { phase: "degraded", sessionId: prepared.sessionId });
|
|
632
|
-
}
|
|
633
|
-
}
|
|
634
|
-
const famOverride = prepared.model.params?.promptCacheFamily;
|
|
635
|
-
if (famOverride && !["input-includes-cached", "input-excludes-cached", "openai", "anthropic"].includes(famOverride)) {
|
|
636
|
-
this.deps.onError?.(new Error(`prompt-cache: unrecognized model.params.promptCacheFamily "${famOverride}" — ignored (fell back to model.api inference). Use "input-includes-cached" | "input-excludes-cached" (aliases "openai" | "anthropic").`), { phase: "prompt-cache", sessionId: prepared.sessionId });
|
|
637
|
-
}
|
|
638
|
-
rs.limits.turnsExceeded = false;
|
|
639
|
-
rs.degrade.outputErrorStreak = 0;
|
|
640
|
-
rs.degrade.outputInvalid = false;
|
|
641
|
-
rs.telemetry.cacheBreakReported = false;
|
|
642
|
-
rs.limits.outputRetryCap = resolveOutputRetries(spec.outputRetries);
|
|
643
|
-
rs.limits.effectiveMaxTurns = resolveMaxTurns(spec.limits);
|
|
644
|
-
rs.telemetry.tracer = entryTracer !== undefined ? entryTracer.tracer : (spec.tracer ?? this.deps.tracer);
|
|
645
|
-
rs.telemetry.taskId = runSourceTaskId;
|
|
646
|
-
rs.telemetry.runId = prepared.runId;
|
|
647
|
-
if (taskIdRef) {
|
|
648
|
-
taskIdRef.current = rs.telemetry.taskId;
|
|
649
|
-
taskIdRef.sessionId = prepared.sessionId;
|
|
650
|
-
}
|
|
651
|
-
rs.telemetry.taskStart = Date.now();
|
|
652
|
-
rs.telemetry.taskStartMonotonic = performance.now();
|
|
653
|
-
const discloseNoteTaskRunFailure = (err) => {
|
|
654
|
-
try {
|
|
655
|
-
this.deps.onError?.(err instanceof Error ? err : new Error(String(err)), { phase: "config", sessionId: prepared.sessionId });
|
|
656
|
-
}
|
|
657
|
-
catch {
|
|
658
|
-
}
|
|
659
|
-
};
|
|
660
|
-
try {
|
|
661
|
-
void Promise.resolve(this.sessions.noteTaskRun?.(prepared.sessionId, rs.telemetry.taskId, rs.telemetry.runId)).catch(discloseNoteTaskRunFailure);
|
|
662
|
-
}
|
|
663
|
-
catch (err) {
|
|
664
|
-
discloseNoteTaskRunFailure(err);
|
|
665
|
-
}
|
|
666
|
-
const noteUnevaluablePriceTable = (p) => {
|
|
667
|
-
if (prepared.usageGovernance?.governsCost !== true)
|
|
668
|
-
return;
|
|
669
|
-
if (malformedPricingField(p) !== undefined)
|
|
670
|
-
rs.telemetry.unpricedSpend = true;
|
|
671
|
-
};
|
|
672
|
-
rs.degrade.recordDegraded = (info, toModel) => {
|
|
673
|
-
if (rs.degrade.degraded !== undefined)
|
|
674
|
-
return;
|
|
675
|
-
let m = toModel;
|
|
676
|
-
if (!m) {
|
|
677
|
-
try {
|
|
678
|
-
m = resolveModel(info.to, modelCatalog);
|
|
679
|
-
}
|
|
680
|
-
catch {
|
|
681
|
-
m = undefined;
|
|
682
|
-
}
|
|
683
|
-
}
|
|
684
|
-
if (m) {
|
|
685
|
-
rs.telemetry.pricing = this.deps.pricing?.[m.id] ?? modelCostToPricing(m.cost);
|
|
686
|
-
rs.telemetry.pricingConfigured = isModelPriced(m, this.deps.pricing);
|
|
687
|
-
noteUnevaluablePriceTable(rs.telemetry.pricing);
|
|
688
|
-
rs.telemetry.cacheFamily = cacheFamilyOf(m);
|
|
689
|
-
}
|
|
690
|
-
else {
|
|
691
|
-
if (this.deps.pricing?.[info.to]) {
|
|
692
|
-
rs.telemetry.pricing = this.deps.pricing[info.to];
|
|
693
|
-
rs.telemetry.pricingConfigured = true;
|
|
694
|
-
noteUnevaluablePriceTable(rs.telemetry.pricing);
|
|
695
|
-
}
|
|
696
|
-
else {
|
|
697
|
-
rs.telemetry.pricingConfigured = false;
|
|
698
|
-
}
|
|
699
|
-
rs.telemetry.cacheFamily = "input-excludes-cached";
|
|
700
|
-
}
|
|
701
|
-
rs.degrade.degraded = info;
|
|
702
|
-
emitTrace(rs.telemetry.tracer, () => ({ kind: "task.degraded", version: 1, taskId: rs.telemetry.taskId, from: info.from, to: info.to, reason: info.reason, atTurn: info.atTurn, ts: Date.now() }));
|
|
703
|
-
try {
|
|
704
|
-
this.deps.onError?.(new Error(`degraded to a cheaper model: ${info.from} → ${info.to} (${info.reason}) at turn ${info.atTurn}`), { phase: "degraded", sessionId: prepared.sessionId });
|
|
705
|
-
}
|
|
706
|
-
catch {
|
|
707
|
-
}
|
|
549
|
+
const notificationLane = {
|
|
550
|
+
get harness() { return notificationHarness; }, set harness(h) { notificationHarness = h; },
|
|
551
|
+
get sessionId() { return notificationSessionId; }, set sessionId(s) { notificationSessionId = s; },
|
|
552
|
+
get ident() { return notificationIdent; }, set ident(f) { notificationIdent = f; },
|
|
708
553
|
};
|
|
709
|
-
const
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
:
|
|
713
|
-
? Math.round(spec.resourceSuspend.totalBudgetUsd * 1e6)
|
|
714
|
-
: undefined;
|
|
715
|
-
rs.budget.maxCostMicroUsd =
|
|
716
|
-
sliceWindowMicroUsd !== undefined && rs.budget.remainingMicroUsd !== undefined
|
|
717
|
-
? Math.min(sliceWindowMicroUsd, rs.budget.remainingMicroUsd)
|
|
718
|
-
: (sliceWindowMicroUsd ?? rs.budget.remainingMicroUsd);
|
|
719
|
-
rs.budget.remainingTokens = prepared.resourceLedger
|
|
720
|
-
? remainingTokens(prepared.resourceLedger)
|
|
721
|
-
: spec.resourceSuspend?.totalTokens;
|
|
722
|
-
rs.budget.maxTokensWindow =
|
|
723
|
-
spec.limits?.maxTokens !== undefined && rs.budget.remainingTokens !== undefined
|
|
724
|
-
? Math.min(spec.limits.maxTokens, rs.budget.remainingTokens)
|
|
725
|
-
: (spec.limits?.maxTokens ?? rs.budget.remainingTokens);
|
|
726
|
-
rs.budget.overBudget = () => {
|
|
727
|
-
if (rs.budget.maxTokensWindow !== undefined && stats.tokens > rs.budget.maxTokensWindow)
|
|
728
|
-
return "tokens";
|
|
729
|
-
if (rs.budget.maxCostMicroUsd !== undefined && stats.costMicroUsd > rs.budget.maxCostMicroUsd)
|
|
730
|
-
return "cost";
|
|
731
|
-
return undefined;
|
|
732
|
-
};
|
|
733
|
-
rs.budget.streamCancel =
|
|
734
|
-
(spec.limits?.budgetStreamCancel ?? rs.budget.maxCostMicroUsd !== undefined) && prepared.suspendForResource === undefined;
|
|
735
|
-
rs.budget.callOutputChars = 0;
|
|
736
|
-
rs.budget.lastStreamBudgetCheck = 0;
|
|
737
|
-
rs.budget.projectedOverBudget = () => {
|
|
738
|
-
const estOut = Math.ceil(rs.budget.callOutputChars / 4);
|
|
739
|
-
if (rs.budget.maxTokensWindow !== undefined && stats.tokens + estOut > rs.budget.maxTokensWindow)
|
|
740
|
-
return "tokens";
|
|
741
|
-
if (rs.budget.maxCostMicroUsd !== undefined) {
|
|
742
|
-
const estOutMicro = computeCostMicroUsd({ totalInputTokens: 0, cacheReadTokens: 0, cacheWriteTokens: 0, cacheWriteTokensLong: 0, outputTokens: estOut }, rs.telemetry.pricing);
|
|
743
|
-
if (stats.costMicroUsd + estOutMicro > rs.budget.maxCostMicroUsd)
|
|
744
|
-
return "cost";
|
|
745
|
-
}
|
|
746
|
-
return undefined;
|
|
747
|
-
};
|
|
748
|
-
rs.turn.turnUsageMissing = false;
|
|
749
|
-
rs.counters.repetitionCuts = 0;
|
|
750
|
-
rs.counters.repetitionSpared = 0;
|
|
751
|
-
rs.counters.repetitionEvents = [];
|
|
752
|
-
rs.counters.REPETITION_EVENTS_CAP = 20;
|
|
753
|
-
rs.counters.preemptIgnoredReported = false;
|
|
754
|
-
rs.counters.wroteThisRun = false;
|
|
755
|
-
rs.counters.finalVerifyInjections = 0;
|
|
756
|
-
rs.counters.groundingSignalPreR9 = false;
|
|
757
|
-
rs.counters.groundingSignalPostR9 = false;
|
|
758
|
-
rs.attach.attachmentsCfg = spec.attachments;
|
|
759
|
-
rs.attach.agentListingOn = rs.attach.attachmentsCfg?.agentListing !== false && eventDefaultOn("agent_listing");
|
|
760
|
-
rs.attach.skillsListingOn = rs.attach.attachmentsCfg?.skillsListing !== false && eventDefaultOn("skills_listing");
|
|
761
|
-
const listingsLive = (rs.attach.agentListingOn && prepared.agentListing !== undefined) || (rs.attach.skillsListingOn && prepared.skillsListing !== undefined);
|
|
762
|
-
const backgroundTasksLive = (rs.attach.attachmentsCfg?.backgroundTasks ?? eventDefaultOn("background_tasks")) === true;
|
|
763
|
-
rs.attach.attachState = rs.attach.attachmentsCfg !== undefined || listingsLive || backgroundTasksLive ? createAttachmentState() : undefined;
|
|
764
|
-
rs.attach.dateState = prepared.dateChange !== undefined ? { announcedDate: prepared.dateChange.legDate } : undefined;
|
|
765
|
-
rs.attach.instrProbe = this.deps.probeInstructionSources;
|
|
766
|
-
rs.attach.instrState =
|
|
767
|
-
rs.attach.instrProbe !== undefined && prepared.instructionSources !== undefined && prepared.instructionSources.length > 0
|
|
768
|
-
? { lastAnnouncedHash: new Map(prepared.instructionSources.map((s) => [s.path, s.contentHash])) }
|
|
769
|
-
: undefined;
|
|
770
|
-
rs.attach.sizeGuidelineState =
|
|
771
|
-
prepared.workflowSizeGuideline !== undefined
|
|
772
|
-
? { announcedGuideline: prepared.workflowSizeGuideline.legGuideline, current: prepared.workflowSizeGuideline.current }
|
|
773
|
-
: undefined;
|
|
774
|
-
rs.counters.cadenceTurns = 0;
|
|
775
|
-
rs.turn.lastTurnHadToolCalls = false;
|
|
776
|
-
if (rs.attach.attachState !== undefined && (rs.attach.attachmentsCfg?.backgroundTasks ?? eventDefaultOn("background_tasks")) === true) {
|
|
777
|
-
try {
|
|
778
|
-
const branch = await prepared.session.getBranch();
|
|
779
|
-
for (let i = branch.length - 1; i >= 0; i--) {
|
|
780
|
-
const e = branch[i];
|
|
781
|
-
if (e.type === "compaction") {
|
|
782
|
-
rs.attach.attachState.postCompactPending = true;
|
|
783
|
-
break;
|
|
784
|
-
}
|
|
785
|
-
if (e.type === "message" && e.message.role === "assistant")
|
|
786
|
-
break;
|
|
787
|
-
}
|
|
788
|
-
}
|
|
789
|
-
catch {
|
|
790
|
-
}
|
|
791
|
-
}
|
|
792
|
-
if (rs.attach.attachState !== undefined &&
|
|
793
|
-
((rs.attach.agentListingOn && prepared.agentListing?.seedAnnounced === true) ||
|
|
794
|
-
(rs.attach.skillsListingOn && prepared.skillsListing?.seedAnnounced === true))) {
|
|
795
|
-
const cpListings = resume?.cp.state.announcedListings;
|
|
796
|
-
let entryListings;
|
|
797
|
-
try {
|
|
798
|
-
entryListings = await prepared.session.getAnnouncedListing();
|
|
799
|
-
}
|
|
800
|
-
catch {
|
|
801
|
-
entryListings = undefined;
|
|
802
|
-
}
|
|
803
|
-
const textOf = (m) => {
|
|
804
|
-
const c = m.content;
|
|
805
|
-
if (typeof c === "string")
|
|
806
|
-
return c;
|
|
807
|
-
if (Array.isArray(c)) {
|
|
808
|
-
return c
|
|
809
|
-
.map((b) => (b !== null && typeof b === "object" && b.type === "text" ? String(b.text ?? "") : ""))
|
|
810
|
-
.join("\n");
|
|
811
|
-
}
|
|
812
|
-
return "";
|
|
813
|
-
};
|
|
814
|
-
let branchTexts = null;
|
|
815
|
-
const branchLoad = async () => {
|
|
816
|
-
if (branchTexts === null) {
|
|
817
|
-
const branch = await prepared.session.getBranch();
|
|
818
|
-
branchTexts = branch.flatMap((e) => {
|
|
819
|
-
if (e.type !== "message")
|
|
820
|
-
return [];
|
|
821
|
-
const m = e.message;
|
|
822
|
-
if (m.role !== "user")
|
|
823
|
-
return [];
|
|
824
|
-
const full = textOf(e.message);
|
|
825
|
-
if (m.engineMinted === true)
|
|
826
|
-
return [stripGitStatusUnits(full, prepared.reminderMark)];
|
|
827
|
-
if (Array.isArray(m.engineSegments) && m.engineSegments.length > 0) {
|
|
828
|
-
return m.engineSegments.map((s) => stripGitStatusUnits(full.slice(Math.max(0, s.start), Math.max(0, s.end)), prepared.reminderMark));
|
|
829
|
-
}
|
|
830
|
-
if (typeof m.enginePrefixChars === "number" && m.enginePrefixChars > 0)
|
|
831
|
-
return [stripGitStatusUnits(full.slice(0, m.enginePrefixChars), prepared.reminderMark)];
|
|
832
|
-
return [];
|
|
833
|
-
});
|
|
834
|
-
}
|
|
835
|
-
return branchTexts;
|
|
836
|
-
};
|
|
837
|
-
const branchReplay = async (headers) => {
|
|
838
|
-
try {
|
|
839
|
-
return replayAnnouncedListing(await branchLoad(), headers);
|
|
840
|
-
}
|
|
841
|
-
catch {
|
|
842
|
-
return undefined;
|
|
843
|
-
}
|
|
844
|
-
};
|
|
845
|
-
if (rs.attach.agentListingOn && prepared.agentListing?.seedAnnounced === true) {
|
|
846
|
-
const listing = prepared.agentListing;
|
|
847
|
-
if (cpListings?.agents === undefined && entryListings?.agents !== undefined) {
|
|
848
|
-
const descOf = new Map(listing.entries.map((e) => [e.name, e.description]));
|
|
849
|
-
rs.attach.attachState.announcedAgentTypes = new Map(entryListings.agents.map((n) => [n, descOf.get(n) ?? ""]));
|
|
850
|
-
prepared.announcedListingsRef.agents = [...entryListings.agents];
|
|
851
|
-
if (entryListings.models !== undefined) {
|
|
852
|
-
rs.attach.attachState.announcedModels = [...entryListings.models];
|
|
853
|
-
prepared.announcedListingsRef.models = [...entryListings.models];
|
|
854
|
-
}
|
|
855
|
-
}
|
|
856
|
-
else if (cpListings?.agents !== undefined) {
|
|
857
|
-
const descOf = new Map(listing.entries.map((e) => [e.name, e.description]));
|
|
858
|
-
rs.attach.attachState.announcedAgentTypes = new Map(cpListings.agents.map((n) => [n, descOf.get(n) ?? ""]));
|
|
859
|
-
prepared.announcedListingsRef.agents = [...cpListings.agents];
|
|
860
|
-
if (cpListings.models !== undefined) {
|
|
861
|
-
rs.attach.attachState.announcedModels = [...cpListings.models];
|
|
862
|
-
prepared.announcedListingsRef.models = [...cpListings.models];
|
|
863
|
-
}
|
|
864
|
-
}
|
|
865
|
-
else {
|
|
866
|
-
const replayed = await branchReplay({
|
|
867
|
-
initial: agentListingInitialHeader(listing.toolName),
|
|
868
|
-
delta: agentListingDeltaHeader(listing.toolName),
|
|
869
|
-
removed: AGENT_LISTING_REMOVED_HEADER,
|
|
870
|
-
});
|
|
871
|
-
if (replayed !== undefined) {
|
|
872
|
-
const descOf = new Map(listing.entries.map((e) => [e.name, e.description]));
|
|
873
|
-
rs.attach.attachState.announcedAgentTypes = new Map([...replayed].map((n) => [n, descOf.get(n) ?? ""]));
|
|
874
|
-
prepared.announcedListingsRef.agents = [...replayed];
|
|
875
|
-
const replayedModels = replayAnnouncedModels(await branchLoad());
|
|
876
|
-
if (replayedModels !== undefined) {
|
|
877
|
-
rs.attach.attachState.announcedModels = [...replayedModels];
|
|
878
|
-
prepared.announcedListingsRef.models = [...replayedModels];
|
|
879
|
-
}
|
|
880
|
-
}
|
|
881
|
-
}
|
|
882
|
-
}
|
|
883
|
-
if (rs.attach.skillsListingOn && prepared.skillsListing?.seedAnnounced === true) {
|
|
884
|
-
const listing = prepared.skillsListing;
|
|
885
|
-
if (cpListings?.skills === undefined && entryListings?.skills !== undefined) {
|
|
886
|
-
const descOf = new Map(listing.entries.map((e) => [e.name, e.description]));
|
|
887
|
-
rs.attach.attachState.announcedSkills = new Map(entryListings.skills.map((n) => [n, descOf.get(n) ?? ""]));
|
|
888
|
-
prepared.announcedListingsRef.skills = [...entryListings.skills];
|
|
889
|
-
}
|
|
890
|
-
else if (cpListings?.skills !== undefined) {
|
|
891
|
-
const descOf = new Map(listing.entries.map((e) => [e.name, e.description]));
|
|
892
|
-
rs.attach.attachState.announcedSkills = new Map(cpListings.skills.map((n) => [n, descOf.get(n) ?? ""]));
|
|
893
|
-
prepared.announcedListingsRef.skills = [...cpListings.skills];
|
|
894
|
-
}
|
|
895
|
-
else {
|
|
896
|
-
const replayed = await branchReplay({
|
|
897
|
-
initial: SKILLS_LISTING_PROBE_HEADER,
|
|
898
|
-
delta: SKILLS_LISTING_DELTA_HEADER,
|
|
899
|
-
removed: SKILLS_LISTING_REMOVED_HEADER,
|
|
900
|
-
});
|
|
901
|
-
if (replayed !== undefined) {
|
|
902
|
-
const descOf = new Map(listing.entries.map((e) => [e.name, e.description]));
|
|
903
|
-
rs.attach.attachState.announcedSkills = new Map([...replayed].map((n) => [n, descOf.get(n) ?? ""]));
|
|
904
|
-
prepared.announcedListingsRef.skills = [...replayed];
|
|
905
|
-
}
|
|
906
|
-
}
|
|
907
|
-
}
|
|
908
|
-
}
|
|
909
|
-
if (spec.finalVerification === true && resume !== undefined) {
|
|
910
|
-
try {
|
|
911
|
-
const branch = await prepared.session.getBranch();
|
|
912
|
-
for (const e of branch) {
|
|
913
|
-
if (e.type !== "message")
|
|
914
|
-
continue;
|
|
915
|
-
const m = e.message;
|
|
916
|
-
if (m.role === "user") {
|
|
917
|
-
const text = typeof m.content === "string"
|
|
918
|
-
? m.content
|
|
919
|
-
: m.content.map((b) => (b !== null && typeof b === "object" && b.type === "text" ? String(b.text ?? "") : "")).join("\n");
|
|
920
|
-
const fvMarked = m.engineMinted === true && text.includes(`<system-reminder mark="${prepared.reminderMark}">[final verification]`);
|
|
921
|
-
if ((fvMarked || text.includes("<system-reminder>[final verification]")) && rs.counters.finalVerifyInjections < 2)
|
|
922
|
-
rs.counters.finalVerifyInjections += 1;
|
|
923
|
-
}
|
|
924
|
-
else if (m.role === "toolResult" && !rs.counters.wroteThisRun && (prepared.toolEffects.get(m.toolName) ?? "write") !== "read") {
|
|
925
|
-
rs.counters.wroteThisRun = true;
|
|
926
|
-
}
|
|
927
|
-
}
|
|
928
|
-
}
|
|
929
|
-
catch {
|
|
930
|
-
}
|
|
931
|
-
}
|
|
932
|
-
rs.attach.attachmentsInjected = 0;
|
|
933
|
-
const todoToolMounted = rs.attach.attachState !== undefined && prepared.tools.some((t) => t.name === "TodoWrite");
|
|
934
|
-
const taskToolsMounted = rs.attach.attachState !== undefined && prepared.tools.some((t) => t.name === "TaskCreate");
|
|
935
|
-
const writeFamilyByName = new Map();
|
|
936
|
-
if (rs.attach.attachState !== undefined) {
|
|
937
|
-
for (const t of prepared.tools) {
|
|
938
|
-
const family = writeFamilyOfCanonical(t.name);
|
|
939
|
-
if (family !== undefined)
|
|
940
|
-
for (const n of [t.name, ...(t.aliases ?? [])])
|
|
941
|
-
writeFamilyByName.set(n, family);
|
|
942
|
-
}
|
|
943
|
-
}
|
|
944
|
-
const writeFamilyOf = (name) => writeFamilyByName.get(name) ?? writeFamilyOfCanonical(name);
|
|
945
|
-
const toolStartAt = new Map();
|
|
946
|
-
const startedToolCallIds = new Set();
|
|
947
|
-
emitTrace(rs.telemetry.tracer, () => ({ kind: "task.start", version: 1, taskId: rs.telemetry.taskId, runId: rs.telemetry.runId, model: prepared.model.id, engineVersion: engineVersion(), ts: rs.telemetry.taskStart }));
|
|
948
|
-
emitTrace(rs.telemetry.tracer, () => ({
|
|
949
|
-
kind: "prompt.assembled",
|
|
950
|
-
version: 1,
|
|
951
|
-
taskId: rs.telemetry.taskId,
|
|
952
|
-
constitution: prepared.promptManifest.constitution,
|
|
953
|
-
blocks: prepared.promptManifest.blocks,
|
|
954
|
-
...(prepared.promptManifest.sections ? { sections: prepared.promptManifest.sections } : {}),
|
|
955
|
-
...(prepared.promptManifest.tools ? { tools: prepared.promptManifest.tools } : {}),
|
|
956
|
-
...(prepared.promptManifest.snapshot ? { snapshot: prepared.promptManifest.snapshot } : {}),
|
|
957
|
-
...(prepared.promptManifest.lowering ? { lowering: prepared.promptManifest.lowering } : {}),
|
|
958
|
-
...(prepared.promptManifest.toolDisclosure ? { toolDisclosure: prepared.promptManifest.toolDisclosure } : {}),
|
|
959
|
-
totalChars: prepared.promptManifest.blocks.reduce((n, b) => n + b.chars, 0),
|
|
960
|
-
ts: rs.telemetry.taskStart,
|
|
961
|
-
}));
|
|
962
|
-
emitTrace(rs.telemetry.tracer, () => {
|
|
963
|
-
const reasons = declarationReasons(spec.configOverrides);
|
|
964
|
-
return {
|
|
965
|
-
kind: "config.assembled",
|
|
966
|
-
version: 1,
|
|
967
|
-
taskId: rs.telemetry.taskId,
|
|
968
|
-
catalogVersion: CONFIG_CATALOG_VERSION,
|
|
969
|
-
fields: resolveEffectiveConfig(spec, { modelMaxTokens: prepared.model.maxTokens }),
|
|
970
|
-
...(Object.keys(reasons).length > 0 ? { overrideReasons: reasons } : {}),
|
|
971
|
-
ts: rs.telemetry.taskStart,
|
|
972
|
-
};
|
|
554
|
+
const undrainedUserAtEndCell = { get current() { return undrainedUserAtEnd; }, set current(v) { undrainedUserAtEnd = v; } };
|
|
555
|
+
const { runSourceTaskId, parentToolCallId, ident, emitDelegationLifecycle, loopLatch, stats } = runIdentityWiring({
|
|
556
|
+
spec, queue, prepared, internals, taskIdRef, onReady, manualCompactRef, notifyRef, captureOptOutRef, injectTaskNotification, deliveredAtTurnOpen, peerInboundChainRef,
|
|
557
|
+
notificationLane, undrainedUserAtEnd: undrainedUserAtEndCell, pendingSessionNotifications: this.pendingSessionNotifications, runner: this.depsSeat,
|
|
973
558
|
});
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
}
|
|
983
|
-
let reasoningResolution = prepared.thinking && prepared.thinking !== "off" ? resolveReasoning(prepared.thinking, prepared.model) : undefined;
|
|
984
|
-
const publishReasoningResolution = (r) => {
|
|
985
|
-
reasoningResolution = r;
|
|
986
|
-
if (taskIdRef)
|
|
987
|
-
taskIdRef.effectiveReasoning = r;
|
|
988
|
-
emitTrace(rs.telemetry.tracer, () => ({
|
|
989
|
-
kind: "reasoning.resolved",
|
|
990
|
-
version: 1,
|
|
991
|
-
taskId: rs.telemetry.taskId,
|
|
992
|
-
model: prepared.model.id,
|
|
993
|
-
requested: r.requested,
|
|
994
|
-
effective: r.effective,
|
|
995
|
-
graded: r.graded,
|
|
996
|
-
clamped: r.clamped,
|
|
997
|
-
format: r.format,
|
|
998
|
-
endpoint: r.endpoint,
|
|
999
|
-
...(r.dropped === true ? { dropped: true } : {}),
|
|
1000
|
-
ts: Date.now(),
|
|
1001
|
-
}));
|
|
1002
|
-
};
|
|
1003
|
-
if (reasoningResolution !== undefined)
|
|
1004
|
-
publishReasoningResolution(reasoningResolution);
|
|
1005
|
-
let reasoningFactsConsumed = false;
|
|
1006
|
-
const observeReasoningWireFacts = (facts) => {
|
|
1007
|
-
if (reasoningFactsConsumed)
|
|
1008
|
-
return;
|
|
1009
|
-
reasoningFactsConsumed = true;
|
|
1010
|
-
if (prepared.thinking === undefined || prepared.thinking === "off")
|
|
1011
|
-
return;
|
|
1012
|
-
const next = resolveReasoning(prepared.thinking, prepared.model, facts);
|
|
1013
|
-
const current = reasoningResolution;
|
|
1014
|
-
if (current !== undefined &&
|
|
1015
|
-
current.effective === next.effective &&
|
|
1016
|
-
current.graded === next.graded &&
|
|
1017
|
-
current.clamped === next.clamped &&
|
|
1018
|
-
current.format === next.format &&
|
|
1019
|
-
current.endpoint === next.endpoint &&
|
|
1020
|
-
current.dropped === next.dropped) {
|
|
1021
|
-
return;
|
|
1022
|
-
}
|
|
1023
|
-
publishReasoningResolution(next);
|
|
1024
|
-
};
|
|
1025
|
-
const effectiveTimeoutMs = spec.limits?.maxWalltimeMs;
|
|
1026
|
-
const walltimeMonotonicDeadline = effectiveTimeoutMs !== undefined ? rs.telemetry.taskStartMonotonic + effectiveTimeoutMs : undefined;
|
|
1027
|
-
rs.counters.walltimeSyncBackstopFired = false;
|
|
1028
|
-
const timeout = startTimeout(prepared.harness, prepared.abortController, walltimeMonotonicDeadline !== undefined ? walltimeMonotonicDeadline - performance.now() : undefined, prepared.suspendForResource !== undefined);
|
|
1029
|
-
const pushContent = (e) => {
|
|
1030
|
-
queue.push(e);
|
|
1031
|
-
if (parentToolCallId !== undefined && internals?.onForwardEvent) {
|
|
1032
|
-
try {
|
|
1033
|
-
internals.onForwardEvent(e);
|
|
1034
|
-
}
|
|
1035
|
-
catch {
|
|
1036
|
-
}
|
|
1037
|
-
}
|
|
1038
|
-
};
|
|
1039
|
-
const ownCommittedTailRef = { current: undefined };
|
|
1040
|
-
const emitCommitted = (entryId, role, toolCallId) => {
|
|
1041
|
-
ownCommittedTailRef.current = entryId;
|
|
1042
|
-
if (role === "toolResult" && toolCallId !== undefined)
|
|
1043
|
-
startedToolCallIds.delete(toolCallId);
|
|
1044
|
-
queue.push({ type: "message_committed", entryId, role, ...(toolCallId !== undefined ? { toolCallId } : {}), ...ident() });
|
|
1045
|
-
};
|
|
1046
|
-
const subagentName = parentToolCallId !== undefined && internals?.agentName !== undefined ? inlineUntrusted(internals.agentName.slice(0, 320), 80) : undefined;
|
|
1047
|
-
const statusSinkNotifier = createSafeNotifier({
|
|
1048
|
-
onError: (f) => console.warn(`[sema-core] ${f.site}: run-internals status sink threw (contained; further failures counted, not re-disclosed): ${f.error.message}`),
|
|
1049
|
-
});
|
|
1050
|
-
const statusEmit = (s) => {
|
|
1051
|
-
const frame = {
|
|
1052
|
-
type: "status",
|
|
1053
|
-
phase: s.phase,
|
|
1054
|
-
...(s.detail !== undefined ? { detail: s.detail } : {}),
|
|
1055
|
-
...(s.retryInSec !== undefined ? { retryInSec: s.retryInSec } : {}),
|
|
1056
|
-
...(s.retryInMs !== undefined ? { retryInMs: s.retryInMs } : {}),
|
|
1057
|
-
...(s.retryAtMs !== undefined ? { retryAtMs: s.retryAtMs } : {}),
|
|
1058
|
-
...(s.elapsedMs !== undefined ? { elapsedMs: s.elapsedMs } : {}),
|
|
1059
|
-
...(s.timeoutMs !== undefined ? { timeoutMs: s.timeoutMs } : {}),
|
|
1060
|
-
...(s.attempt !== undefined ? { attempt: s.attempt } : {}),
|
|
1061
|
-
...(s.maxRetries !== undefined ? { maxRetries: s.maxRetries } : {}),
|
|
1062
|
-
...(s.errClass !== undefined ? { errClass: s.errClass } : {}),
|
|
1063
|
-
...(s.errorStatus !== undefined ? { errorStatus: s.errorStatus } : {}),
|
|
1064
|
-
...ident(),
|
|
1065
|
-
};
|
|
1066
|
-
Object.freeze(frame);
|
|
1067
|
-
const accepted = queue.push(frame);
|
|
1068
|
-
if (accepted && internals?.onStatusEvent !== undefined) {
|
|
1069
|
-
statusSinkNotifier.notify(() => observeThenableRejection(internals.onStatusEvent?.(frame), statusSinkNotifier, "runtask.onStatusEvent"), "runtask.onStatusEvent");
|
|
1070
|
-
}
|
|
1071
|
-
};
|
|
1072
|
-
const telemetryEmit = (t) => {
|
|
1073
|
-
emitTrace(rs.telemetry.tracer, () => t.kind === "failover"
|
|
1074
|
-
? {
|
|
1075
|
-
kind: "brain.failover",
|
|
1076
|
-
version: 1,
|
|
1077
|
-
taskId: rs.telemetry.taskId,
|
|
1078
|
-
servedIndex: t.servedIndex,
|
|
1079
|
-
total: t.total,
|
|
1080
|
-
...(t.errorCode !== undefined ? { errorCode: t.errorCode } : {}),
|
|
1081
|
-
ts: Date.now(),
|
|
1082
|
-
}
|
|
1083
|
-
: t.kind === "breaker"
|
|
1084
|
-
? { kind: "breaker.transition", version: 1, taskId: rs.telemetry.taskId, key: t.key, phase: t.phase, failures: t.failures, ts: Date.now() }
|
|
1085
|
-
: t.kind === "retry"
|
|
1086
|
-
? {
|
|
1087
|
-
kind: "brain.retry",
|
|
1088
|
-
version: 1,
|
|
1089
|
-
taskId: rs.telemetry.taskId,
|
|
1090
|
-
attempt: t.attempt,
|
|
1091
|
-
phase: t.phase,
|
|
1092
|
-
...(t.errClass !== undefined ? { errClass: t.errClass } : {}),
|
|
1093
|
-
...(t.nextDelayMs !== undefined ? { nextDelayMs: t.nextDelayMs } : {}),
|
|
1094
|
-
ts: Date.now(),
|
|
1095
|
-
}
|
|
1096
|
-
: { kind: "vision.placeholder", version: 1, taskId: rs.telemetry.taskId, count: t.count, ts: Date.now() });
|
|
1097
|
-
};
|
|
1098
|
-
const withBrainSinks = (fn) => runWithStatusSink(statusEmit, () => runWithBrainTelemetry(telemetryEmit, () => runWithReasoningWireFacts(observeReasoningWireFacts, fn)));
|
|
559
|
+
const rs = createRunState();
|
|
560
|
+
const { noteUnevaluablePriceTable } = runTelemetryAndBudgetSeats({ spec, prepared, resume, stats, taskIdRef, entryTracer, modelCatalog, runSourceTaskId, rs, runner: this.depsSeat, sessions: this.sessions });
|
|
561
|
+
await runAttachmentSeats({ spec, prepared, resume, rs, runner: this.depsSeat });
|
|
562
|
+
const { todoToolMounted, taskToolsMounted, writeFamilyOf, toolStartAt, startedToolCallIds } = runToolMountFacts({ spec, prepared, rs });
|
|
563
|
+
let reasoningResolution;
|
|
564
|
+
const reasoningResolutionCell = { get current() { return reasoningResolution; }, set current(v) { reasoningResolution = v; } };
|
|
565
|
+
const { observeReasoningWireFacts } = runReasoningSeat({ prepared, rs, taskIdRef, reasoningResolution: reasoningResolutionCell });
|
|
566
|
+
const { effectiveTimeoutMs, walltimeMonotonicDeadline, timeout, pushContent, ownCommittedTailRef, emitCommitted } = runClockAndContent({ spec, prepared, queue, internals, rs, ident, parentToolCallId, startedToolCallIds });
|
|
567
|
+
const { subagentName, withBrainSinks } = runBrainSinks({ queue, internals, rs, ident, parentToolCallId, observeReasoningWireFacts });
|
|
1099
568
|
const toolLabels = new Map(prepared.tools.flatMap((t) => (t.label !== undefined && t.label !== t.name ? [[t.name, t.label]] : [])));
|
|
1100
569
|
for (const orphan of prepared.wakeRecovered) {
|
|
1101
570
|
queue.push({ type: "tool_end", toolCallId: orphan.toolCallId, toolName: orphan.toolName, ...(toolLabels.has(orphan.toolName) ? { label: toolLabels.get(orphan.toolName) } : {}), isError: true, ...reconciledToolEndBody(orphan, prepared.structuredProjector), ...ident() });
|
|
@@ -1113,412 +582,16 @@ export class Runner {
|
|
|
1113
582
|
runnerHooks: { onError: (e, info) => this.deps.onError?.(e, info) },
|
|
1114
583
|
},
|
|
1115
584
|
});
|
|
1116
|
-
const
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
rs.telemetry.unpricedSpend = true;
|
|
1125
|
-
noteUnevaluablePriceTable(price);
|
|
1126
|
-
const { totalInputTokens, uncachedInputTokens, costMicroUsd } = usageCostMicroUsd(fam, u, price);
|
|
1127
|
-
stats.tokens += u.totalTokens || 0;
|
|
1128
|
-
stats.promptTokens += uncachedInputTokens;
|
|
1129
|
-
stats.totalInputTokens += totalInputTokens;
|
|
1130
|
-
stats.cachedTokens += u.cacheRead || 0;
|
|
1131
|
-
stats.cacheWriteTokens += u.cacheWrite || 0;
|
|
1132
|
-
stats.outputTokens += u.output || 0;
|
|
1133
|
-
stats.costMicroUsd += costMicroUsd;
|
|
1134
|
-
stats.compactionMicroUsd = (stats.compactionMicroUsd ?? 0) + costMicroUsd;
|
|
1135
|
-
emitTrace(rs.telemetry.tracer, () => ({
|
|
1136
|
-
kind: "brain.call", version: 1, taskId: rs.telemetry.taskId, model: m.id, provider: m.provider,
|
|
1137
|
-
promptTokens: uncachedInputTokens, totalInputTokens, completionTokens: u.output || 0,
|
|
1138
|
-
cacheRead: u.cacheRead || 0, cacheWrite: u.cacheWrite || 0,
|
|
1139
|
-
latencyMs: 0, ...(priced ? { costMicroUsd } : {}), ...(typeof msg?.stopReason === "string" ? { stopReason: msg.stopReason } : {}), ts: Date.now(),
|
|
1140
|
-
}));
|
|
1141
|
-
};
|
|
1142
|
-
const compactionBrain = {
|
|
1143
|
-
stream: this.deps.brain.stream,
|
|
1144
|
-
complete: async (m, c, o) => {
|
|
1145
|
-
const msg = await runWithStatusSink(() => { }, async () => await runWithReasoningWireFacts(() => { }, async () => this.deps.brain.complete
|
|
1146
|
-
? await this.deps.brain.complete(m, c, o)
|
|
1147
|
-
: await (await Promise.resolve(this.deps.brain.stream(m, c, o))).result()));
|
|
1148
|
-
recordCompactionUsage(m, msg);
|
|
1149
|
-
return msg;
|
|
1150
|
-
},
|
|
1151
|
-
};
|
|
1152
|
-
const withinTaskCompaction = (spec.compaction?.enabled ?? true) && (spec.compaction?.withinTask ?? true);
|
|
1153
|
-
const compactionBreaker = { failures: 0 };
|
|
1154
|
-
if (spec.compaction?.enabled ?? true) {
|
|
1155
|
-
const prefixWindow = resolveTriggerWindow(prepared.model).window;
|
|
1156
|
-
if (Number.isFinite(prefixWindow) && prefixWindow > 0) {
|
|
1157
|
-
const prefixSettings = sanitizeCompactionSettings({ ...DEFAULT_COMPACTION_SETTINGS, ...spec.compaction }, prefixWindow);
|
|
1158
|
-
const prefixCompactAt = prefixWindow - prefixSettings.reserveTokens;
|
|
1159
|
-
if (prepared.promptOverheadTokens >= prefixCompactAt) {
|
|
1160
|
-
this.deps.onError?.(new Error(`compaction cannot help: the fixed request prefix (system prompt + tool schemas, ≈${prepared.promptOverheadTokens} tokens) ` +
|
|
1161
|
-
`already meets or exceeds the compaction threshold (${prefixCompactAt} of a ${prefixWindow}-token window). ` +
|
|
1162
|
-
`Compaction only shrinks conversation history, so this run will re-trigger or overflow regardless — ` +
|
|
1163
|
-
`shrink the system prompt/tool surface or use a larger-window model.`), { phase: "config", sessionId: prepared.sessionId });
|
|
1164
|
-
}
|
|
1165
|
-
}
|
|
1166
|
-
}
|
|
1167
|
-
const windowSafetyOptions = (mainModel) => ({
|
|
1168
|
-
...(rs.budget.maxCostMicroUsd !== undefined
|
|
1169
|
-
? {
|
|
1170
|
-
fallbackBudget: {
|
|
1171
|
-
spentMicroUsd: () => stats.costMicroUsd,
|
|
1172
|
-
capMicroUsd: rs.budget.maxCostMicroUsd,
|
|
1173
|
-
mainInputPer1M: (this.deps.pricing?.[mainModel.id] ?? modelCostToPricing(mainModel.cost)).inputPer1M,
|
|
1174
|
-
},
|
|
1175
|
-
}
|
|
1176
|
-
: {}),
|
|
1177
|
-
onWindowSafety: (info) => {
|
|
1178
|
-
if (info.kind === "fallback") {
|
|
1179
|
-
emitTrace(rs.telemetry.tracer, () => ({
|
|
1180
|
-
kind: "compaction.model_fallback",
|
|
1181
|
-
version: 1,
|
|
1182
|
-
taskId: rs.telemetry.taskId,
|
|
1183
|
-
contentTokens: info.contentTokens,
|
|
1184
|
-
headroomTokens: info.headroomTokens ?? 0,
|
|
1185
|
-
truncationRatio: info.truncationRatio,
|
|
1186
|
-
...(info.estCostMicroUsd !== undefined ? { estCostMicroUsd: info.estCostMicroUsd } : {}),
|
|
1187
|
-
ts: Date.now(),
|
|
1188
|
-
}));
|
|
1189
|
-
}
|
|
1190
|
-
else {
|
|
1191
|
-
emitTrace(rs.telemetry.tracer, () => ({
|
|
1192
|
-
kind: "compaction.clamp_disclosure",
|
|
1193
|
-
version: 1,
|
|
1194
|
-
taskId: rs.telemetry.taskId,
|
|
1195
|
-
truncationRatio: info.truncationRatio,
|
|
1196
|
-
reason: info.reason ?? "tolerance",
|
|
1197
|
-
...(info.estCostMicroUsd !== undefined ? { estCostMicroUsd: info.estCostMicroUsd } : {}),
|
|
1198
|
-
ts: Date.now(),
|
|
1199
|
-
}));
|
|
1200
|
-
}
|
|
585
|
+
const { compactionBrain, withinTaskCompaction, compactionBreaker, windowSafetyOptions } = runCompactionMachinery({ spec, prepared, rs, stats, noteUnevaluablePriceTable, runner: this.depsSeat });
|
|
586
|
+
runStopAndFinalVerify({ spec, prepared, queue, rs, stats, ident, walltimeMonotonicDeadline, runner: this.depsSeat });
|
|
587
|
+
runRecoveryLanes({
|
|
588
|
+
spec, prepared, queue, rs, ident, compactionBrain, compactionBreaker, windowSafetyOptions, runner: this.depsSeat,
|
|
589
|
+
compactionSeats: {
|
|
590
|
+
seamCCompactionOptions: (p) => this.seamCCompactionOptions(p),
|
|
591
|
+
compactionHookOptions: (s, sid, trig, identity, seatBound) => this.compactionHookOptions(s, sid, trig, identity, seatBound),
|
|
592
|
+
recordCompactionReuse: (p, c) => this.recordCompactionReuse(p, c),
|
|
1201
593
|
},
|
|
1202
594
|
});
|
|
1203
|
-
const stopHook = (spec.hooks ?? this.deps.hooks)?.stop;
|
|
1204
|
-
const finalVerificationOn = spec.finalVerification === true;
|
|
1205
|
-
const finalVerifyBudgetFill = () => {
|
|
1206
|
-
let worst = 0;
|
|
1207
|
-
if (rs.budget.maxTokensWindow !== undefined && rs.budget.maxTokensWindow > 0)
|
|
1208
|
-
worst = Math.max(worst, stats.tokens / rs.budget.maxTokensWindow);
|
|
1209
|
-
if (rs.budget.maxCostMicroUsd !== undefined && rs.budget.maxCostMicroUsd > 0)
|
|
1210
|
-
worst = Math.max(worst, stats.costMicroUsd / rs.budget.maxCostMicroUsd);
|
|
1211
|
-
if (walltimeMonotonicDeadline !== undefined && prepared.suspendForResource === undefined) {
|
|
1212
|
-
const windowMs = walltimeMonotonicDeadline - rs.telemetry.taskStartMonotonic;
|
|
1213
|
-
if (windowMs > 0)
|
|
1214
|
-
worst = Math.max(worst, (performance.now() - rs.telemetry.taskStartMonotonic) / windowMs);
|
|
1215
|
-
}
|
|
1216
|
-
return worst;
|
|
1217
|
-
};
|
|
1218
|
-
const emitFinalVerifyEcho = (body) => {
|
|
1219
|
-
queue.push({ type: "steering_injected", source: "final_verification", preview: body.slice(0, 220), ...ident() });
|
|
1220
|
-
};
|
|
1221
|
-
if (stopHook || finalVerificationOn) {
|
|
1222
|
-
let consecutiveBlocks = 0;
|
|
1223
|
-
prepared.harness.setStopGate(async () => {
|
|
1224
|
-
if (prepared.abortController.signal.aborted || prepared.pausedRef.current !== undefined || prepared.batchHaltRef.current !== undefined)
|
|
1225
|
-
return [];
|
|
1226
|
-
if (finalVerificationOn &&
|
|
1227
|
-
(rs.counters.finalVerifyInjections === 0 || (rs.counters.finalVerifyInjections === 1 && rs.counters.groundingSignalPreR9 && !rs.counters.groundingSignalPostR9)) &&
|
|
1228
|
-
rs.counters.wroteThisRun &&
|
|
1229
|
-
prepared.outputRef.set !== true &&
|
|
1230
|
-
!(rs.limits.effectiveMaxTurns !== undefined && rs.limits.effectiveMaxTurns > 0 && stats.turns >= rs.limits.effectiveMaxTurns - 1) &&
|
|
1231
|
-
finalVerifyBudgetFill() < 0.9) {
|
|
1232
|
-
rs.counters.finalVerifyInjections += 1;
|
|
1233
|
-
if (rs.counters.finalVerifyInjections === 2) {
|
|
1234
|
-
const reentryBody = openSystemReminder(prepared.reminderMark) +
|
|
1235
|
-
"[final verification] Your tool calls in this run worked with raw bytes, structural parsing, " +
|
|
1236
|
-
"or checksum/digest computation — the deliverable very likely embeds verifiable structure (structural fields, an " +
|
|
1237
|
-
"embedded checksum-family value, reference data it must match, or a replayable deterministic path). You MUST " +
|
|
1238
|
-
"execute the grounding check that structure supports — recompute the embedded value and compare it against the " +
|
|
1239
|
-
"declared one, re-parse the structure from the raw bytes and reconcile it with your output, compare against the " +
|
|
1240
|
-
"reference data, or replay the deterministic path — and REPORT the check's concrete result before finishing. " +
|
|
1241
|
-
"A closing statement without a reported check result is not verification. If you already ran such a check, state " +
|
|
1242
|
-
"its concrete result now; if the check mismatches, fix the deliverable first. This is the final reminder from " +
|
|
1243
|
-
"this verification gate — it will not intervene again.</system-reminder>";
|
|
1244
|
-
emitFinalVerifyEcho(reentryBody);
|
|
1245
|
-
return [
|
|
1246
|
-
{
|
|
1247
|
-
role: "user",
|
|
1248
|
-
engineMinted: true,
|
|
1249
|
-
content: reentryBody,
|
|
1250
|
-
timestamp: Date.now(),
|
|
1251
|
-
},
|
|
1252
|
-
];
|
|
1253
|
-
}
|
|
1254
|
-
const nudgeBody = openSystemReminder(prepared.reminderMark) +
|
|
1255
|
-
"[final verification] Before finishing: re-verify the FINAL deliverable through its REAL entry point, " +
|
|
1256
|
-
"exactly as the acceptance criteria would exercise it — execute the binary/function/endpoint directly and read the ACTUAL " +
|
|
1257
|
-
"output and exit code. Do NOT rely on earlier self-tests, shell redirections, or assumptions (a program that prints to " +
|
|
1258
|
-
"stdout is not a program that writes the required file). If anything mismatches the task's requirements, fix it before " +
|
|
1259
|
-
"finishing. " +
|
|
1260
|
-
"Treat verification writes as state-harmless: when the deliverable itself is a persisted final " +
|
|
1261
|
-
"state (for example a committed or pushed file, a deployed artifact, or a required output file), " +
|
|
1262
|
-
"do not change that state merely to test it. This constrains HOW you verify — it is never a " +
|
|
1263
|
-
"license to skip the real acceptance path or to check a substitute of your own making: expected " +
|
|
1264
|
-
"values must come from the task's requirements, never from content you generated. If the real " +
|
|
1265
|
-
"acceptance path requires a write, use disposable inputs or an isolated target, end in the exact " +
|
|
1266
|
-
"required final state, and verify that final state before finishing. " +
|
|
1267
|
-
"If the work relied on a third-party API, library, or model, check the usage contract the object itself declares " +
|
|
1268
|
-
"(docstrings, metadata, configuration — e.g. prompt conventions shipped with a model) and confirm your calls follow " +
|
|
1269
|
-
"it rather than a default symmetric usage. Verify not only that the deliverable EXISTS but that the METHOD that " +
|
|
1270
|
-
"produced it matches the task's requirements. " +
|
|
1271
|
-
"Choose the verification SURFACE deliberately: check against the reference data, oracle, or evaluation tooling the " +
|
|
1272
|
-
"task itself provides — re-running your own implementation and getting the same answer is self-consistency, not " +
|
|
1273
|
-
"correctness — and cross-check through an independent second path where the task or environment offers one " +
|
|
1274
|
-
"(checksums, runtime artifacts). Verify the PERSISTED artifact — re-read what is actually on disk or committed, " +
|
|
1275
|
-
"not in-memory state — against every hard constraint from the original task text (numeric bounds, allowed-value " +
|
|
1276
|
-
"lists, naming semantics, required files), reconciling whole-set completeness: nothing missing, nothing duplicated. " +
|
|
1277
|
-
"If the deliverable embeds verifiable structure — structural fields, an embedded checksum-family value, " +
|
|
1278
|
-
"reference data it must match, or a replayable deterministic path — you MUST execute the grounding check " +
|
|
1279
|
-
"that structure supports and REPORT its concrete result in your closing summary: for such a deliverable, " +
|
|
1280
|
-
"no reported check result means the work is not finished. " +
|
|
1281
|
-
"If the task produced neither an executable deliverable nor any verifiable structure or acceptance " +
|
|
1282
|
-
"oracle to check against, briefly confirm completion and stop. " +
|
|
1283
|
-
"Residue YOUR OWN testing created (scratch files, running processes, generated outputs the task does not ask for) " +
|
|
1284
|
-
"is not protected state — if the task's required final state is a clean target, removing your own residue is part " +
|
|
1285
|
-
"of delivering it. " +
|
|
1286
|
-
"Verification must never LAUNDER uncertainty: if part of your conclusion was uncertain before this check, keep " +
|
|
1287
|
-
"reporting it as uncertain unless the check you actually ran resolved it — a re-stated conclusion is not new " +
|
|
1288
|
-
"evidence.</system-reminder>";
|
|
1289
|
-
emitFinalVerifyEcho(nudgeBody);
|
|
1290
|
-
return [
|
|
1291
|
-
{
|
|
1292
|
-
role: "user",
|
|
1293
|
-
engineMinted: true,
|
|
1294
|
-
content: nudgeBody,
|
|
1295
|
-
timestamp: Date.now(),
|
|
1296
|
-
},
|
|
1297
|
-
];
|
|
1298
|
-
}
|
|
1299
|
-
if (!stopHook)
|
|
1300
|
-
return [];
|
|
1301
|
-
let result;
|
|
1302
|
-
try {
|
|
1303
|
-
const stopSeat = await runHookSeat("stop", { timeoutMs: prepared.hookTimeoutMs, signal: prepared.abortController.signal, abortEnds: true }, (sig) => stopHook({
|
|
1304
|
-
stopHookActive: consecutiveBlocks > 0,
|
|
1305
|
-
consecutiveBlocks,
|
|
1306
|
-
getBranch: () => prepared.session.getBranch(),
|
|
1307
|
-
identity: prepared.hookIdentity,
|
|
1308
|
-
signal: sig,
|
|
1309
|
-
}));
|
|
1310
|
-
if (stopSeat.expired) {
|
|
1311
|
-
if (stopSeat.cause === "timeout") {
|
|
1312
|
-
this.deps.onError?.(hookSeatExpiredError("stop", prepared.hookTimeoutMs, stopSeat.cause, "the run was allowed to END (the seat's own no-opinion answer); no pushback and no additional context were injected"), { phase: "hook", sessionId: prepared.sessionId });
|
|
1313
|
-
}
|
|
1314
|
-
consecutiveBlocks = 0;
|
|
1315
|
-
return [];
|
|
1316
|
-
}
|
|
1317
|
-
result = stopSeat.value;
|
|
1318
|
-
}
|
|
1319
|
-
catch (err) {
|
|
1320
|
-
this.deps.onError?.(err instanceof Error ? err : new Error(String(err)), { phase: "hook", sessionId: prepared.sessionId });
|
|
1321
|
-
return [];
|
|
1322
|
-
}
|
|
1323
|
-
const messages = [];
|
|
1324
|
-
if (result?.additionalContext) {
|
|
1325
|
-
messages.push({
|
|
1326
|
-
role: "user",
|
|
1327
|
-
engineMinted: true,
|
|
1328
|
-
content: formatHookFeedback(`Stop hook additional context: ${result.additionalContext}`, prepared.reminderMark),
|
|
1329
|
-
timestamp: Date.now(),
|
|
1330
|
-
});
|
|
1331
|
-
}
|
|
1332
|
-
if (messages.length === 0 && !result?.block) {
|
|
1333
|
-
consecutiveBlocks = 0;
|
|
1334
|
-
return messages;
|
|
1335
|
-
}
|
|
1336
|
-
consecutiveBlocks++;
|
|
1337
|
-
const cap = STOP_HOOK_BLOCK_CAP;
|
|
1338
|
-
if (consecutiveBlocks > cap) {
|
|
1339
|
-
this.deps.onError?.(new Error(`a Stop hook kept the turn from ending ${consecutiveBlocks} consecutive times — overriding and ending the run. ` +
|
|
1340
|
-
`Both a block and an additionalContext-only push-back count (CC 2.1.220). ` +
|
|
1341
|
-
`Check ctx.stopHookActive in the hook and return success while it's true.`), { phase: "hook", sessionId: prepared.sessionId });
|
|
1342
|
-
return [];
|
|
1343
|
-
}
|
|
1344
|
-
if (result?.block) {
|
|
1345
|
-
messages.push({
|
|
1346
|
-
role: "user",
|
|
1347
|
-
engineMinted: true,
|
|
1348
|
-
content: formatHookFeedback(`Stop hook stopped continuation: ${result.block}`, prepared.reminderMark),
|
|
1349
|
-
timestamp: Date.now(),
|
|
1350
|
-
});
|
|
1351
|
-
}
|
|
1352
|
-
return messages;
|
|
1353
|
-
});
|
|
1354
|
-
}
|
|
1355
|
-
const runForcedCompactionPass = async (lane, turnSignal) => {
|
|
1356
|
-
if (!(spec.compaction?.enabled ?? true))
|
|
1357
|
-
return false;
|
|
1358
|
-
if (compactionBreaker.failures >= MAX_CONSECUTIVE_COMPACTION_FAILURES)
|
|
1359
|
-
return false;
|
|
1360
|
-
const passSignal = turnSignal !== undefined ? AbortSignal.any([prepared.abortController.signal, turnSignal]) : prepared.abortController.signal;
|
|
1361
|
-
try {
|
|
1362
|
-
const comp = await maybeCompact({
|
|
1363
|
-
session: prepared.session,
|
|
1364
|
-
epochDeclaredSections: prepared.epochDeclaredSections,
|
|
1365
|
-
...centerAdoptionOption(prepared),
|
|
1366
|
-
model: prepared.harness.getModel(),
|
|
1367
|
-
compactionModel: prepared.compModel,
|
|
1368
|
-
...forkContextOption(prepared, true),
|
|
1369
|
-
brain: compactionBrain,
|
|
1370
|
-
getApiKeyAndHeaders: spec.getApiKeyAndHeaders,
|
|
1371
|
-
thinking: prepared.thinking,
|
|
1372
|
-
settings: { ...DEFAULT_COMPACTION_SETTINGS, ...spec.compaction },
|
|
1373
|
-
customInstructions: spec.compaction?.instructions ?? DEFAULT_COMPACTION_INSTRUCTIONS,
|
|
1374
|
-
signal: passSignal,
|
|
1375
|
-
minTokens: 0,
|
|
1376
|
-
force: true,
|
|
1377
|
-
overheadTokens: prepared.promptOverheadTokens,
|
|
1378
|
-
...(prepared.activeTools.size > 0 ? { activeTools: [...prepared.activeTools] } : {}),
|
|
1379
|
-
onInputTruncated: emitInputTruncated(rs.telemetry.tracer, rs.telemetry.taskId),
|
|
1380
|
-
workingFileAttachments: buildWorkingFileAttachments(spec, prepared),
|
|
1381
|
-
...contextInstructionFilesOption(prepared),
|
|
1382
|
-
...(prepared.onCompactionApplied ? { onApplied: prepared.onCompactionApplied } : {}),
|
|
1383
|
-
...this.seamCCompactionOptions(prepared),
|
|
1384
|
-
...gitRestateOption(prepared),
|
|
1385
|
-
...windowSafetyOptions(prepared.harness.getModel()),
|
|
1386
|
-
...this.compactionHookOptions(spec, prepared.sessionId, "forced", prepared.hookIdentity, { timeoutMs: prepared.hookTimeoutMs, signal: passSignal }),
|
|
1387
|
-
});
|
|
1388
|
-
if (comp.compacted) {
|
|
1389
|
-
compactionBreaker.failures = 0;
|
|
1390
|
-
this.recordCompactionReuse(prepared, comp);
|
|
1391
|
-
if ((comp.freedTokens ?? 0) >= COMPACTION_FREED_EPSILON) {
|
|
1392
|
-
const postSize = comp.postTriggerTokens ?? Math.max(0, (comp.triggerTokens ?? comp.tokensBefore ?? 0) - (comp.freedTokens ?? 0));
|
|
1393
|
-
rs.counters.compactionFloor = Math.ceil(postSize * COMPACTION_REGROWTH_FACTOR);
|
|
1394
|
-
}
|
|
1395
|
-
queue.push({
|
|
1396
|
-
type: "compacted",
|
|
1397
|
-
trigger: "forced",
|
|
1398
|
-
tokensBefore: comp.tokensBefore ?? 0,
|
|
1399
|
-
...(comp.postTriggerTokens !== undefined ? { tokensAfter: comp.postTriggerTokens } : {}),
|
|
1400
|
-
...(comp.triggerTokens !== undefined ? { triggerTokensBefore: comp.triggerTokens } : {}),
|
|
1401
|
-
...(comp.durationMs !== undefined ? { durationMs: comp.durationMs } : {}),
|
|
1402
|
-
...(comp.phaseDurations !== undefined ? { phaseDurations: comp.phaseDurations } : {}),
|
|
1403
|
-
...(comp.firstKeptEntryId !== undefined ? { preserved_segment: { firstKeptEntryId: comp.firstKeptEntryId } } : {}),
|
|
1404
|
-
...(comp.attachedFiles !== undefined ? { attachedFiles: comp.attachedFiles } : {}),
|
|
1405
|
-
...(comp.modelFallback ? { modelFallback: true } : {}),
|
|
1406
|
-
...(comp.fallbackReason !== undefined ? { fallbackReason: comp.fallbackReason } : {}),
|
|
1407
|
-
...(comp.clampedRatio !== undefined ? { clampedRatio: comp.clampedRatio } : {}),
|
|
1408
|
-
...(comp.clampReason !== undefined ? { clampReason: comp.clampReason } : {}),
|
|
1409
|
-
...ident(),
|
|
1410
|
-
});
|
|
1411
|
-
if (comp.phaseDurations !== undefined && comp.durationMs !== undefined) {
|
|
1412
|
-
const pd = comp.phaseDurations;
|
|
1413
|
-
const pdDur = comp.durationMs;
|
|
1414
|
-
emitTrace(rs.telemetry.tracer, () => ({ kind: "compaction.phase_timings", version: 1, taskId: rs.telemetry.taskId, ...pd, durationMs: pdDur, ts: Date.now() }));
|
|
1415
|
-
}
|
|
1416
|
-
prepared.cacheBreakDetector?.notifyCompaction();
|
|
1417
|
-
if (rs.attach.attachState !== undefined) {
|
|
1418
|
-
rs.attach.attachState.postCompactPending = true;
|
|
1419
|
-
rebaseCadenceWindows(rs.attach.attachState, rs.counters.cadenceTurns);
|
|
1420
|
-
}
|
|
1421
|
-
}
|
|
1422
|
-
else {
|
|
1423
|
-
if (comp.noop) {
|
|
1424
|
-
compactionBreaker.failures = 0;
|
|
1425
|
-
}
|
|
1426
|
-
else {
|
|
1427
|
-
compactionBreaker.failures += 1;
|
|
1428
|
-
}
|
|
1429
|
-
const declineReason = lane === "rejection" ? "prompt-too-long recovery pass did not land" : "guard-chain forced compaction pass did not land";
|
|
1430
|
-
if (!comp.noop) {
|
|
1431
|
-
this.deps.onError?.(new Error(declineReason), { phase: "compaction", sessionId: prepared.sessionId });
|
|
1432
|
-
}
|
|
1433
|
-
queue.push({
|
|
1434
|
-
type: "compaction_outcome",
|
|
1435
|
-
outcome: comp.noop ? "noop" : "failed",
|
|
1436
|
-
trigger: "forced",
|
|
1437
|
-
reason: declineReason,
|
|
1438
|
-
...ident(),
|
|
1439
|
-
});
|
|
1440
|
-
}
|
|
1441
|
-
return comp.compacted === true;
|
|
1442
|
-
}
|
|
1443
|
-
catch (err) {
|
|
1444
|
-
if (turnSignal?.aborted === true && !prepared.abortController.signal.aborted) {
|
|
1445
|
-
const interruptReason = lane === "rejection"
|
|
1446
|
-
? "prompt-too-long recovery pass cut short by a turn interrupt"
|
|
1447
|
-
: "guard-chain forced compaction cut short by a turn interrupt";
|
|
1448
|
-
queue.push({ type: "compaction_outcome", outcome: "failed", trigger: "forced", reason: interruptReason, ...ident() });
|
|
1449
|
-
return false;
|
|
1450
|
-
}
|
|
1451
|
-
compactionBreaker.failures += 1;
|
|
1452
|
-
this.deps.onError?.(err instanceof Error ? err : new Error(String(err)), { phase: "compaction", sessionId: prepared.sessionId });
|
|
1453
|
-
const msg = String(err instanceof Error ? err.message : err);
|
|
1454
|
-
queue.push({ type: "compaction_outcome", outcome: "failed", trigger: "forced", reason: msg.length > 512 ? `${msg.slice(0, 512)}…` : msg, ...ident() });
|
|
1455
|
-
return false;
|
|
1456
|
-
}
|
|
1457
|
-
};
|
|
1458
|
-
prepared.harness.setLoopRecovery({
|
|
1459
|
-
truncatedOutput: {},
|
|
1460
|
-
malformedToolUse: {},
|
|
1461
|
-
thinkingOnly: {},
|
|
1462
|
-
degenerateOutput: { detect: (m) => isDegenerateCutMessage(m) },
|
|
1463
|
-
promptTooLong: {
|
|
1464
|
-
recover: async (attempt, turnSignal) => {
|
|
1465
|
-
if (prepared.abortController.signal.aborted || prepared.pausedRef.current !== undefined)
|
|
1466
|
-
return false;
|
|
1467
|
-
if (turnSignal?.aborted === true)
|
|
1468
|
-
return false;
|
|
1469
|
-
if (prepared.microCompact.clearOnRejection && attempt === 1) {
|
|
1470
|
-
const proj = prepared.microCompact.projectionRef.current;
|
|
1471
|
-
const compactionAvailable = (spec.compaction?.enabled ?? true) && compactionBreaker.failures < MAX_CONSECUTIVE_COMPACTION_FAILURES;
|
|
1472
|
-
const declineArm = compactionAvailable ? "forced_compaction" : "none";
|
|
1473
|
-
const plan = proj === undefined
|
|
1474
|
-
? { declined: "no_candidates" }
|
|
1475
|
-
: planRejectionClears(proj.messages, {
|
|
1476
|
-
keyOf: proj.keyOf,
|
|
1477
|
-
...(prepared.microCompact.offloadPersist ? { offload: { persist: prepared.microCompact.offloadPersist } } : {}),
|
|
1478
|
-
});
|
|
1479
|
-
if ("declined" in plan) {
|
|
1480
|
-
emitTrace(rs.telemetry.tracer, () => ({
|
|
1481
|
-
kind: "context.mc_null",
|
|
1482
|
-
version: 1,
|
|
1483
|
-
taskId: rs.telemetry.taskId,
|
|
1484
|
-
reason: plan.declined,
|
|
1485
|
-
nextArm: declineArm,
|
|
1486
|
-
ts: Date.now(),
|
|
1487
|
-
}));
|
|
1488
|
-
}
|
|
1489
|
-
else {
|
|
1490
|
-
for (const e of plan.cleared) {
|
|
1491
|
-
prepared.microCompact.ledger.entries.set(e.key, { marker: e.marker, groupCount: e.groupCount, fp: e.fp });
|
|
1492
|
-
}
|
|
1493
|
-
emitTrace(rs.telemetry.tracer, () => ({
|
|
1494
|
-
kind: "context.mc_clear",
|
|
1495
|
-
version: 1,
|
|
1496
|
-
taskId: rs.telemetry.taskId,
|
|
1497
|
-
clearedCount: plan.cleared.length,
|
|
1498
|
-
tokensSavedEstimate: plan.tokensSavedEstimate,
|
|
1499
|
-
trigger: "refusal",
|
|
1500
|
-
ts: Date.now(),
|
|
1501
|
-
}));
|
|
1502
|
-
return true;
|
|
1503
|
-
}
|
|
1504
|
-
}
|
|
1505
|
-
return runForcedCompactionPass("rejection", turnSignal);
|
|
1506
|
-
},
|
|
1507
|
-
},
|
|
1508
|
-
});
|
|
1509
|
-
prepared.microCompact.inTurnCompactionRef.current = async (turnSignal, anchoredEstimate) => {
|
|
1510
|
-
if (prepared.abortController.signal.aborted || prepared.pausedRef.current !== undefined)
|
|
1511
|
-
return false;
|
|
1512
|
-
if (turnSignal?.aborted === true)
|
|
1513
|
-
return false;
|
|
1514
|
-
if (anchoredEstimate !== undefined && rs.counters.compactionFloor > 0 && anchoredEstimate < rs.counters.compactionFloor) {
|
|
1515
|
-
const floor = rs.counters.compactionFloor;
|
|
1516
|
-
emitTrace(rs.telemetry.tracer, () => ({ kind: "compaction.suppressed", version: 1, taskId: rs.telemetry.taskId, estTokens: anchoredEstimate, floor, ts: Date.now() }));
|
|
1517
|
-
queue.push({ type: "compaction_outcome", outcome: "suppressed", trigger: "forced", ...ident() });
|
|
1518
|
-
return false;
|
|
1519
|
-
}
|
|
1520
|
-
return runForcedCompactionPass("guard", turnSignal);
|
|
1521
|
-
};
|
|
1522
595
|
const rapidRefill = createRapidRefillState();
|
|
1523
596
|
const drainManualCompact = (outcome) => {
|
|
1524
597
|
manualCompactRef.requested = false;
|
|
@@ -1540,102 +613,7 @@ export class Runner {
|
|
|
1540
613
|
},
|
|
1541
614
|
},
|
|
1542
615
|
});
|
|
1543
|
-
|
|
1544
|
-
const ref = prepared.gitStatusRef;
|
|
1545
|
-
const frame = ref.frame;
|
|
1546
|
-
if (frame === undefined)
|
|
1547
|
-
return;
|
|
1548
|
-
delete ref.mirrorOwed;
|
|
1549
|
-
const use = ref.overBudgetShrunk && frame.shrunk !== undefined
|
|
1550
|
-
? { kind: "degraded", body: frame.shrunk.body, hash: frame.shrunk.hash }
|
|
1551
|
-
: { kind: frame.kind, body: frame.body, hash: frame.hash };
|
|
1552
|
-
const wrapped = wrapGitFrame(use.body, prepared.reminderMark);
|
|
1553
|
-
try {
|
|
1554
|
-
const entryId = await prepared.session.appendMessage({
|
|
1555
|
-
role: "user",
|
|
1556
|
-
content: [{ type: "text", text: wrapped }],
|
|
1557
|
-
timestamp: Date.now(),
|
|
1558
|
-
engineMinted: true,
|
|
1559
|
-
});
|
|
1560
|
-
ref.announced = { kind: use.kind, hash: use.hash, entryId };
|
|
1561
|
-
ref.protectedText = wrapped;
|
|
1562
|
-
if (use.kind === "full" && frame.shrunk !== undefined) {
|
|
1563
|
-
ref.wrappedShrink = { find: wrapped, replace: wrapGitFrame(frame.shrunk.body, prepared.reminderMark) };
|
|
1564
|
-
}
|
|
1565
|
-
else {
|
|
1566
|
-
delete ref.wrappedShrink;
|
|
1567
|
-
}
|
|
1568
|
-
queue.push({ type: "steering_injected", source: "git_status", preview: GIT_STATUS_ECHO_PREVIEW[use.kind], ...ident() });
|
|
1569
|
-
rs.attach.attachmentsInjected += 1;
|
|
1570
|
-
try {
|
|
1571
|
-
await prepared.session.appendGitAnnouncement?.({ kind: use.kind, hash: use.hash, entryId });
|
|
1572
|
-
}
|
|
1573
|
-
catch (mirrorErr) {
|
|
1574
|
-
try {
|
|
1575
|
-
this.deps.onError?.(new Error(`git announcement mirror write failed (frame delivered; next leg re-announces): ${mirrorErr instanceof Error ? mirrorErr.message : String(mirrorErr)}`), { phase: "degraded", sessionId: prepared.sessionId });
|
|
1576
|
-
}
|
|
1577
|
-
catch {
|
|
1578
|
-
}
|
|
1579
|
-
}
|
|
1580
|
-
}
|
|
1581
|
-
catch (err) {
|
|
1582
|
-
ref.announced = { kind: use.kind, hash: use.hash, pending: true };
|
|
1583
|
-
try {
|
|
1584
|
-
this.deps.onError?.(new Error(`git status frame re-assert append failed (pending; retried at the next boundary): ${err instanceof Error ? err.message : String(err)}`), { phase: "degraded", sessionId: prepared.sessionId });
|
|
1585
|
-
}
|
|
1586
|
-
catch {
|
|
1587
|
-
}
|
|
1588
|
-
}
|
|
1589
|
-
};
|
|
1590
|
-
const flushGitMirror = async () => {
|
|
1591
|
-
const owed = prepared.gitStatusRef.mirrorOwed;
|
|
1592
|
-
if (owed === undefined)
|
|
1593
|
-
return;
|
|
1594
|
-
if (prepared.gitStatusRef.overBudgetShrunk && owed.kind === "full") {
|
|
1595
|
-
delete prepared.gitStatusRef.mirrorOwed;
|
|
1596
|
-
return;
|
|
1597
|
-
}
|
|
1598
|
-
delete prepared.gitStatusRef.mirrorOwed;
|
|
1599
|
-
try {
|
|
1600
|
-
await prepared.session.appendGitAnnouncement?.(owed);
|
|
1601
|
-
}
|
|
1602
|
-
catch (mirrorErr) {
|
|
1603
|
-
prepared.gitStatusRef.mirrorOwed = owed;
|
|
1604
|
-
try {
|
|
1605
|
-
this.deps.onError?.(new Error(`git announcement mirror write failed (frame delivered; retried at the next serialization point): ${mirrorErr instanceof Error ? mirrorErr.message : String(mirrorErr)}`), { phase: "degraded", sessionId: prepared.sessionId });
|
|
1606
|
-
}
|
|
1607
|
-
catch {
|
|
1608
|
-
}
|
|
1609
|
-
}
|
|
1610
|
-
};
|
|
1611
|
-
const unsubGitRetry = prepared.harness.on("turn_boundary", async () => {
|
|
1612
|
-
await flushGitMirror();
|
|
1613
|
-
if (prepared.gitStatusRef.announced?.pending === true)
|
|
1614
|
-
await prepared.gitStatusRef.reassert?.();
|
|
1615
|
-
return undefined;
|
|
1616
|
-
});
|
|
1617
|
-
const unsubBoundary = prepared.harness.on("turn_boundary", onTurnBoundary);
|
|
1618
|
-
const unsub = prepared.harness.subscribe((event) => {
|
|
1619
|
-
switch (event.type) {
|
|
1620
|
-
case "message_update":
|
|
1621
|
-
onMessageUpdate(event);
|
|
1622
|
-
break;
|
|
1623
|
-
case "message_end":
|
|
1624
|
-
onMessageEnd(event);
|
|
1625
|
-
break;
|
|
1626
|
-
case "tool_execution_start":
|
|
1627
|
-
onToolStart(event);
|
|
1628
|
-
break;
|
|
1629
|
-
case "tool_execution_end":
|
|
1630
|
-
onToolEnd(event);
|
|
1631
|
-
break;
|
|
1632
|
-
case "turn_end":
|
|
1633
|
-
onTurnEnd();
|
|
1634
|
-
break;
|
|
1635
|
-
default:
|
|
1636
|
-
break;
|
|
1637
|
-
}
|
|
1638
|
-
});
|
|
616
|
+
const { flushGitMirror, unsubGitRetry, unsubBoundary, unsub } = runGitLane({ prepared, queue, rs, ident, onMessageUpdate, onMessageEnd, onToolStart, onToolEnd, onTurnEnd, onTurnBoundary, runner: this.depsSeat });
|
|
1639
617
|
let final;
|
|
1640
618
|
let threw;
|
|
1641
619
|
let abortedLive = false;
|