@tangle-network/agent-runtime 2.2.1 → 2.3.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/dist/{activation-BRASQAee.d.ts → activation-BpkpEn0T.d.ts} +2 -2
- package/dist/{activation-D7-ZwyKD.js → activation-D9KoX_R4.js} +2 -2
- package/dist/{activation-D7-ZwyKD.js.map → activation-D9KoX_R4.js.map} +1 -1
- package/dist/agent.d.ts +1 -1
- package/dist/agent.js +3 -3
- package/dist/{coordination-manager-DbNKO53e.js → coordination-manager-CqZGCqjV.js} +4 -4
- package/dist/{coordination-manager-DbNKO53e.js.map → coordination-manager-CqZGCqjV.js.map} +1 -1
- package/dist/{delegate-CBFbETCq.js → delegate-B5XFrkTg.js} +2 -2
- package/dist/{delegate-CBFbETCq.js.map → delegate-B5XFrkTg.js.map} +1 -1
- package/dist/durable.d.ts +1 -1
- package/dist/durable.js +6 -6
- package/dist/{graph-D05w51EQ.js → graph-Ds6VUJzW.js} +5 -5
- package/dist/{graph-D05w51EQ.js.map → graph-Ds6VUJzW.js.map} +1 -1
- package/dist/{improve-Byp45uiM.js → improve-DbfENElN.js} +5 -5
- package/dist/{improve-Byp45uiM.js.map → improve-DbfENElN.js.map} +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +8 -8
- package/dist/intelligence.d.ts +2 -2
- package/dist/intelligence.js +3 -3
- package/dist/kernel.d.ts +1 -1
- package/dist/kernel.js +11 -11
- package/dist/{loop-runner-DBH2LY57.js → loop-runner-CL_5TsT8.js} +2 -2
- package/dist/{loop-runner-DBH2LY57.js.map → loop-runner-CL_5TsT8.js.map} +1 -1
- package/dist/{loop-runner-Bjy-ALf4.d.ts → loop-runner-DjYZrgqT.d.ts} +2 -2
- package/dist/loop-runner-bin.d.ts +1 -1
- package/dist/loop-runner-bin.js +1 -1
- package/dist/mcp/bin.js +3 -3
- package/dist/mcp/index.d.ts +1 -1
- package/dist/mcp/index.js +4 -4
- package/dist/profiles.d.ts +1 -1
- package/dist/{provision-supervisor-Bvqnu3xm.js → provision-supervisor-Cmej51pt.js} +4 -5
- package/dist/{provision-supervisor-Bvqnu3xm.js.map → provision-supervisor-Cmej51pt.js.map} +1 -1
- package/dist/{journal-store-E6TojmWB.js → root-stream-To4qAc0e.js} +710 -8
- package/dist/root-stream-To4qAc0e.js.map +1 -0
- package/dist/run-cancellation-BhP0Nw6G.js +229 -0
- package/dist/run-cancellation-BhP0Nw6G.js.map +1 -0
- package/dist/{runtime-DlmYZZpp.js → runtime-Dm8QlK_z.js} +11 -11
- package/dist/{runtime-DlmYZZpp.js.map → runtime-Dm8QlK_z.js.map} +1 -1
- package/dist/{search-executor-DWFivIJq.js → search-executor-CN2Axxt9.js} +3 -3
- package/dist/{search-executor-DWFivIJq.js.map → search-executor-CN2Axxt9.js.map} +1 -1
- package/dist/{server-DKYzcVEO.js → server-DlKT7AgQ.js} +3 -3
- package/dist/{server-DKYzcVEO.js.map → server-DlKT7AgQ.js.map} +1 -1
- package/dist/{structural-rollout-ChERY66G.js → structural-rollout-BPz5dLDB.js} +3 -3
- package/dist/{structural-rollout-ChERY66G.js.map → structural-rollout-BPz5dLDB.js.map} +1 -1
- package/dist/{supervise-DQkPeVi6.js → supervise-BtjM7_0G.js} +7 -185
- package/dist/supervise-BtjM7_0G.js.map +1 -0
- package/dist/{supervision-discovery-P89Ej0yJ.js → supervision-discovery-CVpmTroK.js} +2 -2
- package/dist/{supervision-discovery-P89Ej0yJ.js.map → supervision-discovery-CVpmTroK.js.map} +1 -1
- package/dist/{supervisor-DorLcfvJ.js → supervisor-BsW69Ccw.js} +123 -28
- package/dist/supervisor-BsW69Ccw.js.map +1 -0
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +11 -11
- package/dist/{top-web-CWcNwaRb.js → top-web-Bjb_UlNI.js} +7 -4
- package/dist/top-web-Bjb_UlNI.js.map +1 -0
- package/dist/tui/bin.js +3 -2
- package/dist/tui/bin.js.map +1 -1
- package/dist/tui/index.d.ts +1 -1
- package/dist/tui/index.js +2 -2
- package/dist/{types-C2fJMeEi.d.ts → types-BDmLQLNj.d.ts} +5 -4
- package/package.json +1 -1
- package/dist/journal-store-E6TojmWB.js.map +0 -1
- package/dist/run-cancellation-Cpm-BIUu.js +0 -743
- package/dist/run-cancellation-Cpm-BIUu.js.map +0 -1
- package/dist/supervise-DQkPeVi6.js.map +0 -1
- package/dist/supervisor-DorLcfvJ.js.map +0 -1
- package/dist/top-web-CWcNwaRb.js.map +0 -1
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { $ as abandonScopeRetainedOwnerInvocation, $n as gateFactoryOnDeliverable, $r as providerAttemptEvidence, $t as persistHarnessTranscript, A as noteScopeOwnerPlannedExecution, An as isPeerMailEnvelope, B as deriveNodeExecutionIdentity, Bn as HarnessTurnFailedError, Bt as resolveAgentEnvironmentProvider, Cn as createInbox, Cr as bridgeRuntimeAttachmentsKey, Dn as PEER_MAIL_WIRE_KEY, F as coordinationProfileToolPrefix, Fn as createActivityLog, Fr as fullProfileMaterialization, G as meterRuntimeOwnedProviderAttempt, Gn as undispatchedCredentialExit, Gr as attestRuntimeOwnedScopeOwner, Hn as causedByPartialFailure, Hr as unsupportedProfileDimensions, I as providerVisibleProfile, Ir as profileMaterializationAxes$1, It as toolResultText, J as recordScopeOwnerPause, Jn as SeatChainExhaustedError, K as recordScopeOwnerBarrenPause, Kn as upstreamUnavailableSignal, Kr as authoredAgentIdentity, L as runtimeGraphMetadataKey, Ln as isLiveNodeStatus, Lr as promptControlProfileMaterialization, Lt as createRouterTranscript, M as restoreScopeOwnerAcceptedExecution, Mt as codeModeArguments, N as scopeOwnerExecutorNodeContext, Nr as controlProfileMaterialization, Nt as codeModeModelOutput, P as coordinationMcpAlias, Pr as defineProfileMaterializationContract, Pt as createCodeModeTools, Qn as CheckUnavailableError, Rn as isTerminalNodeStatus, Rr as promptModelProfileMaterialization, Rt as routerBrain, Sn as INBOX_RECEIPT_KEY, Un as classifyDriverFailure, Ur as worktreeCliProfileMaterialization, Vn as abandonablePending, Vr as sandboxProfileMaterialization, W as meterRuntimeOwnedAccounting, Wn as summarizeDriverAttempts, X as scopeRetainedOwnerResourceReader, Xn as seatExecutionProfile, Y as prepareScopeRetainedOwnerSeatSwitch, Yn as authoredSeatStages, Yr as inheritRuntimeOwnedExecutorAttestation, a as assertRunParking, ai as runtimeOwnedPendingExecutorMaterialization, ar as bestComposite, at as scopeRetainedOwnerTurnEnded, br as linkAbort, bt as createExecutor, c as sleepScopeWait, ct as noteScopeRetainedOwnerCoordination, d as runFinalizer, di as isRuntimeFlowBrain, dr as bridgeModelRouteRefusal, dt as scopeRetainedOwnerContext, ei as recordRuntimeOwnedDriveHarnessProviderEvidence, en as readHarnessTranscript, et as consumeScopeRetainedOwnerResult, f as runTree, fi as runtimeFlowAgent, ft as scopeRetainedOwnerJournalRoot, g as isDriverSpec, gn as generateSpanId, h as driverExecutorFactory, i as RunParkedError, ii as runtimeOwnedExecutorProviderEvidence, ir as admitContinuationPolicy, it as beginScopeRetainedOwnerDrive, j as recordScopeOwnerMaterialization, jr as assertProfileMaterialization, k as beginScopeOwnerAttempt, l as withRunParking, lt as bindScopeRetainedOwnerEnvironmentId, m as driverChild, mn as createOtelExporter, n as createSupervisor, ni as runtimeOwnedExecutorExecutionBinding, nt as scopeRetainedOwnerPriorSpend, o as bindScopeParkingDrain, oi as runtimeOwnedScopeOwnerRuntime, or as checkVerdictOf, ot as reconcileScopeRetainedOwnerEnvironment, p as createRootHandle, pi as runtimeFlowBrain, q as recordScopeOwnerDriverAttempt, qn as SeatChain, ri as runtimeOwnedExecutorMaterialization, rr as CONTINUATIONS_DIR, rt as scopeRetainedOwnerResult, sn as WORKER_TRACE_PROPAGATION, sr as createContinuationKeeper, st as scopeRetainedOwnerRestorePoint, ti as runtimeOwnedDriveHarnessProviderEvidence, tt as prepareScopeRetainedOwnerTask, u as bestDelivered, ur as bridgeAdmissionRefusal, ut as bindScopeRetainedOwnerProvider, vt as bindReusableExecutorExecutionId, wr as bridgeStopSignalKey, x as parseWorkerToolTraceArtifact, xr as runAbortable, xt as snapshotExecutorConfig, yr as RunCancellationReason, yt as captureReusableExecutorConfig, z as assertRecursiveReservationPolicy, zn as DriverAttemptsExhaustedError, zr as renderUnsupported } from "./supervisor-
|
|
1
|
+
import { $ as abandonScopeRetainedOwnerInvocation, $n as gateFactoryOnDeliverable, $r as providerAttemptEvidence, $t as persistHarnessTranscript, A as noteScopeOwnerPlannedExecution, An as isPeerMailEnvelope, B as deriveNodeExecutionIdentity, Bn as HarnessTurnFailedError, Bt as resolveAgentEnvironmentProvider, Cn as createInbox, Cr as bridgeRuntimeAttachmentsKey, Dn as PEER_MAIL_WIRE_KEY, F as coordinationProfileToolPrefix, Fn as createActivityLog, Fr as fullProfileMaterialization, G as meterRuntimeOwnedProviderAttempt, Gn as undispatchedCredentialExit, Gr as attestRuntimeOwnedScopeOwner, Hn as causedByPartialFailure, Hr as unsupportedProfileDimensions, I as providerVisibleProfile, Ir as profileMaterializationAxes$1, It as toolResultText, J as recordScopeOwnerPause, Jn as SeatChainExhaustedError, K as recordScopeOwnerBarrenPause, Kn as upstreamUnavailableSignal, Kr as authoredAgentIdentity, L as runtimeGraphMetadataKey, Ln as isLiveNodeStatus, Lr as promptControlProfileMaterialization, Lt as createRouterTranscript, M as restoreScopeOwnerAcceptedExecution, Mt as codeModeArguments, N as scopeOwnerExecutorNodeContext, Nr as controlProfileMaterialization, Nt as codeModeModelOutput, P as coordinationMcpAlias, Pr as defineProfileMaterializationContract, Pt as createCodeModeTools, Qn as CheckUnavailableError, Rn as isTerminalNodeStatus, Rr as promptModelProfileMaterialization, Rt as routerBrain, Sn as INBOX_RECEIPT_KEY, Un as classifyDriverFailure, Ur as worktreeCliProfileMaterialization, Vn as abandonablePending, Vr as sandboxProfileMaterialization, W as meterRuntimeOwnedAccounting, Wn as summarizeDriverAttempts, X as scopeRetainedOwnerResourceReader, Xn as seatExecutionProfile, Y as prepareScopeRetainedOwnerSeatSwitch, Yn as authoredSeatStages, Yr as inheritRuntimeOwnedExecutorAttestation, a as assertRunParking, ai as runtimeOwnedPendingExecutorMaterialization, ar as bestComposite, at as scopeRetainedOwnerTurnEnded, br as linkAbort, bt as createExecutor, c as sleepScopeWait, ct as noteScopeRetainedOwnerCoordination, d as runFinalizer, di as isRuntimeFlowBrain, dr as bridgeModelRouteRefusal, dt as scopeRetainedOwnerContext, ei as recordRuntimeOwnedDriveHarnessProviderEvidence, en as readHarnessTranscript, et as consumeScopeRetainedOwnerResult, f as runTree, fi as runtimeFlowAgent, ft as scopeRetainedOwnerJournalRoot, g as isDriverSpec, gn as generateSpanId, h as driverExecutorFactory, i as RunParkedError, ii as runtimeOwnedExecutorProviderEvidence, ir as admitContinuationPolicy, it as beginScopeRetainedOwnerDrive, j as recordScopeOwnerMaterialization, jr as assertProfileMaterialization, k as beginScopeOwnerAttempt, l as withRunParking, lt as bindScopeRetainedOwnerEnvironmentId, m as driverChild, mn as createOtelExporter, n as createSupervisor, ni as runtimeOwnedExecutorExecutionBinding, nt as scopeRetainedOwnerPriorSpend, o as bindScopeParkingDrain, oi as runtimeOwnedScopeOwnerRuntime, or as checkVerdictOf, ot as reconcileScopeRetainedOwnerEnvironment, p as createRootHandle, pi as runtimeFlowBrain, q as recordScopeOwnerDriverAttempt, qn as SeatChain, ri as runtimeOwnedExecutorMaterialization, rr as CONTINUATIONS_DIR, rt as scopeRetainedOwnerResult, sn as WORKER_TRACE_PROPAGATION, sr as createContinuationKeeper, st as scopeRetainedOwnerRestorePoint, ti as runtimeOwnedDriveHarnessProviderEvidence, tt as prepareScopeRetainedOwnerTask, u as bestDelivered, ur as bridgeAdmissionRefusal, ut as bindScopeRetainedOwnerProvider, vt as bindReusableExecutorExecutionId, wr as bridgeStopSignalKey, x as parseWorkerToolTraceArtifact, xr as runAbortable, xt as snapshotExecutorConfig, yr as RunCancellationReason, yt as captureReusableExecutorConfig, z as assertRecursiveReservationPolicy, zn as DriverAttemptsExhaustedError, zr as renderUnsupported } from "./supervisor-BsW69Ccw.js";
|
|
2
2
|
import { f as RuntimeRunStateError, i as ConfigError, m as ValidationError } from "./errors-AzSuGI23.js";
|
|
3
3
|
import { B as teardownExecutor, C as withTimeout, E as addResourceSpend, N as DEFAULT_SUCCESSFUL_SHUTDOWN_MS, O as resourceTelemetry, R as isDeadlineAbortReason, S as unmeteredSpend, V as teardownSurfaces, c as errorMessage, f as isAsyncIterable, i as chargedTokens, k as withBudgetResources, m as promptCacheTokenClasses, n as addSpend, v as sleep, w as zeroSpend } from "./util-BX20UJ9X.js";
|
|
4
|
-
import {
|
|
5
|
-
import { d as detachedSnapshot,
|
|
4
|
+
import { G as RetainedExecutionPendingError, Q as retainedExecutorSeamKey, St as newUsageTotals, Tt as assertValidBudget, X as registerRetainedExecutorPreparation, at as unavailableResumeAt, dt as contentAddress, i as readRootStream, it as unavailablePauseMs, n as createRootStreamSink, nt as cappedDoublingMs, pt as executorFailure, rt as jitteredMs, t as ROOT_STREAM_FILE, wt as spendFromUsageTotals, xt as meterUsageEvent } from "./root-stream-To4qAc0e.js";
|
|
5
|
+
import { d as detachedSnapshot, m as errMessage } from "./jsonl-file-BBP9Dz9w.js";
|
|
6
6
|
import { _ as agentHarness, a as concreteProfileModel, c as profileModelExecutionSettings, l as profileProviderModel, n as assertModelAllowed, o as enforceTokenLimits, r as assertProfileModelsAllowed, s as profileBridgeWireModel, t as assertExecutableAgentProfile, v as harnessRunsAgent } from "./model-policy-C-RGAUW4.js";
|
|
7
|
-
import { n as assertNoSymlinkDescendant, o as captureRunWriteContext, s as fenceRunWrite } from "./durable-file-DstVeHcj.js";
|
|
8
7
|
import { t as composeRuntimeHooks } from "./runtime-hooks-CsW2pfFk.js";
|
|
9
|
-
import { c as createSteerAcknowledger, d as coordinationVerbNames, f as createFileRunContext, l as budgetOverspendText, m as withRunContext, n as createCoordinationToolsForManager, p as createInMemoryRunContext, s as createCancelAcknowledger, t as createCoordinationTools, u as normalizeAnalyzeOnSettle } from "./coordination-manager-
|
|
10
|
-
import { c as writeRunCancellation, i as readRunCancellation, r as readRunCancelRequest, s as watchRunCancellation, t as applyRunCancellation } from "./run-cancellation-
|
|
8
|
+
import { c as createSteerAcknowledger, d as coordinationVerbNames, f as createFileRunContext, l as budgetOverspendText, m as withRunContext, n as createCoordinationToolsForManager, p as createInMemoryRunContext, s as createCancelAcknowledger, t as createCoordinationTools, u as normalizeAnalyzeOnSettle } from "./coordination-manager-CqZGCqjV.js";
|
|
9
|
+
import { c as writeRunCancellation, i as readRunCancellation, r as readRunCancelRequest, s as watchRunCancellation, t as applyRunCancellation } from "./run-cancellation-BhP0Nw6G.js";
|
|
11
10
|
import { o as safeJsonText } from "./coordination-map-routing-CUvwHAtv.js";
|
|
12
11
|
import { n as createStdioToolServer, t as PROTOCOL_VERSION } from "./tool-server-CZWd_Opp.js";
|
|
13
12
|
import { a as graphRegistry, c as loadGraph } from "./graph-registry-72DlMnUl.js";
|
|
@@ -16,9 +15,7 @@ import { agentProfileSchema, canonicalAgentProfileDigest, canonicalCandidateDige
|
|
|
16
15
|
import { toolSpansToTraceAnalysisStore } from "@tangle-network/agent-eval";
|
|
17
16
|
import { isRecord } from "@tangle-network/agent-core";
|
|
18
17
|
import { createHash, createHmac, randomBytes, randomUUID, timingSafeEqual } from "node:crypto";
|
|
19
|
-
import { closeSync, constants, fsyncSync, openSync, writeSync } from "node:fs";
|
|
20
18
|
import { dirname, resolve } from "node:path";
|
|
21
|
-
import { mkdir } from "node:fs/promises";
|
|
22
19
|
import { isMaterializerHarness } from "@tangle-network/agent-profile-materialize";
|
|
23
20
|
import { createServer } from "node:http";
|
|
24
21
|
import { msToUnixNano, toOtlpAttributes } from "@tangle-network/agent-trace-contract/otlp";
|
|
@@ -754,181 +751,6 @@ function str(value) {
|
|
|
754
751
|
function truncate(value) {
|
|
755
752
|
return value.length > MAX_DETAIL_CHARS ? `${value.slice(0, MAX_DETAIL_CHARS)}…` : value;
|
|
756
753
|
}
|
|
757
|
-
// src/runtime/supervise/root-stream.ts
|
|
758
|
-
/**
|
|
759
|
-
* The root manager's own provider stream, retained where Runtime owns it.
|
|
760
|
-
*
|
|
761
|
-
* Measured motive (agent-runtime#1233): a CHILD's full event stream — reasoning, text,
|
|
762
|
-
* and tool parts, 28k to 76k reasoning characters per child — is retained in the blob its
|
|
763
|
-
* `settled` record names as `outRef`. The ROOT's stream reached nobody: `driveHarnessFromBackend`
|
|
764
|
-
* drained the root executor for accounting and discarded every `progress` event, and on a
|
|
765
|
-
* `winner` run `result.outRef` is the SELECTED CHILD's artifact, not the root's. A root that died
|
|
766
|
-
* at its join barrier (fourier-e, 63 children) left a 607-byte `failure.json` and nothing it
|
|
767
|
-
* thought; the Lab's only transcript of a root was a post-hoc scrape of the harness's own
|
|
768
|
-
* database.
|
|
769
|
-
*
|
|
770
|
-
* `<runDir>/root-stream.jsonl` is the record: one JSONL line per `ExecutorProgressEvent`, written
|
|
771
|
-
* AS IT ARRIVES, so a root whose process is killed mid-turn keeps every line already written. The
|
|
772
|
-
* file itself is the evidence; the receipt (`ref`, the content address of the file's bytes, and
|
|
773
|
-
* `events`, its committed line count) is what `result.json` and `failure.json` carry. The winner's
|
|
774
|
-
* `outRef` keeps its meaning; this is a separate reference.
|
|
775
|
-
*
|
|
776
|
-
* Durability boundary: each line is written synchronously to an `O_APPEND` descriptor before the
|
|
777
|
-
* next event is drained, and the file is fsynced at every drive-attempt boundary and at close, not
|
|
778
|
-
* per line. An fsync per line cost 7.1 ms per event over
|
|
779
|
-
* 1,000 events and 8.1 ms over 5,000 (~80 s for a root emitting ten thousand text deltas, all of
|
|
780
|
-
* it serialized inside the drain loop that also meters the budget); an async `FileHandle.write`
|
|
781
|
-
* still cost 0.9 to 1.1 ms per line in the thread pool the children's journal writes share; a
|
|
782
|
-
* `writeSync` costs 6 µs. A process kill loses nothing written; only a kernel crash or power
|
|
783
|
-
* loss can drop lines written since the last fsync, and the reader's torn-tail rule keeps such a
|
|
784
|
-
* file readable.
|
|
785
|
-
*
|
|
786
|
-
* The bridge wire carries text and tool calls only: cli-bridge's SSE frames decode
|
|
787
|
-
* `delta.content` and `delta.tool_calls`, never a reasoning delta. A bridge-placed root's retained
|
|
788
|
-
* stream is therefore text plus tool calls; reasoning arrives only on the provider/sandbox path,
|
|
789
|
-
* which projects `message.part.updated` reasoning parts to `reasoning_delta`.
|
|
790
|
-
*/
|
|
791
|
-
/** The root stream: one JSONL line per progress event the root's executor observed. */
|
|
792
|
-
const ROOT_STREAM_FILE = "root-stream.jsonl";
|
|
793
|
-
/** Create the writer for `<runDir>/root-stream.jsonl`. Nothing touches disk until the first
|
|
794
|
-
* `beginAttempt`, so a run whose root never drives leaves no file and no receipt. */
|
|
795
|
-
function createRootStreamSink(runDir, now) {
|
|
796
|
-
const withClaim = captureRunWriteContext();
|
|
797
|
-
const dir = resolve(runDir);
|
|
798
|
-
const path = resolve(dir, ROOT_STREAM_FILE);
|
|
799
|
-
let fd;
|
|
800
|
-
let attempt = 0;
|
|
801
|
-
let seq = 0;
|
|
802
|
-
let closed = false;
|
|
803
|
-
const openOnce = async () => {
|
|
804
|
-
if (fd !== void 0) return;
|
|
805
|
-
await mkdir(dir, { recursive: true });
|
|
806
|
-
assertNoSymlinkDescendant(dir, path, "root stream");
|
|
807
|
-
const needsSeparator = await prepareJsonlAppend(path);
|
|
808
|
-
seq = 0;
|
|
809
|
-
for await (const _record of readCommittedJsonLines(path, { allowMissing: true })) seq += 1;
|
|
810
|
-
fd = fenceRunWrite(() => {
|
|
811
|
-
const writer = openSync(path, constants.O_APPEND | constants.O_CREAT | constants.O_WRONLY | (typeof constants.O_NOFOLLOW === "number" ? constants.O_NOFOLLOW : 0), 384);
|
|
812
|
-
try {
|
|
813
|
-
if (needsSeparator) writeLine(writer, "");
|
|
814
|
-
return writer;
|
|
815
|
-
} catch (error) {
|
|
816
|
-
closeSync(writer);
|
|
817
|
-
throw error;
|
|
818
|
-
}
|
|
819
|
-
});
|
|
820
|
-
};
|
|
821
|
-
return {
|
|
822
|
-
async beginAttempt() {
|
|
823
|
-
return withClaim(async () => {
|
|
824
|
-
if (closed) throw new Error("root stream: beginAttempt after close");
|
|
825
|
-
attempt += 1;
|
|
826
|
-
const writer = fd;
|
|
827
|
-
if (writer !== void 0) fenceRunWrite(() => fsyncSync(writer));
|
|
828
|
-
await openOnce();
|
|
829
|
-
});
|
|
830
|
-
},
|
|
831
|
-
append(event) {
|
|
832
|
-
return withClaim(() => fenceRunWrite(() => {
|
|
833
|
-
if (closed) throw new Error("root stream: append after close");
|
|
834
|
-
if (fd === void 0) throw new Error("root stream: append before beginAttempt");
|
|
835
|
-
const at = new Date(now()).toISOString();
|
|
836
|
-
const record = {
|
|
837
|
-
seq: seq + 1,
|
|
838
|
-
at,
|
|
839
|
-
attempt,
|
|
840
|
-
event
|
|
841
|
-
};
|
|
842
|
-
let line;
|
|
843
|
-
try {
|
|
844
|
-
line = JSON.stringify(record);
|
|
845
|
-
} catch (error) {
|
|
846
|
-
line = JSON.stringify({
|
|
847
|
-
seq: seq + 1,
|
|
848
|
-
at,
|
|
849
|
-
attempt,
|
|
850
|
-
dropped: {
|
|
851
|
-
kind: event.kind,
|
|
852
|
-
reason: errorMessage(error)
|
|
853
|
-
}
|
|
854
|
-
});
|
|
855
|
-
}
|
|
856
|
-
if (line === void 0) line = JSON.stringify({
|
|
857
|
-
seq: seq + 1,
|
|
858
|
-
at,
|
|
859
|
-
attempt,
|
|
860
|
-
dropped: {
|
|
861
|
-
kind: event.kind,
|
|
862
|
-
reason: "event serialized to nothing"
|
|
863
|
-
}
|
|
864
|
-
});
|
|
865
|
-
writeLine(fd, line);
|
|
866
|
-
seq += 1;
|
|
867
|
-
}));
|
|
868
|
-
},
|
|
869
|
-
async close() {
|
|
870
|
-
return withClaim(async () => {
|
|
871
|
-
if (closed) throw new Error("root stream: closed twice");
|
|
872
|
-
closed = true;
|
|
873
|
-
const writer = fd;
|
|
874
|
-
if (writer === void 0) return void 0;
|
|
875
|
-
try {
|
|
876
|
-
fenceRunWrite(() => fsyncSync(writer));
|
|
877
|
-
} finally {
|
|
878
|
-
closeSync(writer);
|
|
879
|
-
fd = void 0;
|
|
880
|
-
}
|
|
881
|
-
return readRootStreamReceipt(dir);
|
|
882
|
-
});
|
|
883
|
-
}
|
|
884
|
-
};
|
|
885
|
-
}
|
|
886
|
-
/** `writeSync` may legally make a short write; loop until the whole line and its newline land. */
|
|
887
|
-
function writeLine(fd, line) {
|
|
888
|
-
const bytes = Buffer.from(`${line}\n`, "utf8");
|
|
889
|
-
let offset = 0;
|
|
890
|
-
while (offset < bytes.byteLength) {
|
|
891
|
-
const written = writeSync(fd, bytes, offset, bytes.byteLength - offset);
|
|
892
|
-
if (written <= 0) throw new Error(`root stream: append made no progress at byte ${offset}`);
|
|
893
|
-
offset += written;
|
|
894
|
-
}
|
|
895
|
-
}
|
|
896
|
-
/**
|
|
897
|
-
* The receipt for the root stream a run directory holds, recomputed from the file's bytes, or
|
|
898
|
-
* `undefined` when the directory holds none. This is what a run that never settled — a root that
|
|
899
|
-
* died mid-turn — gets on its failure record, and it equals what `close()` returned for a run
|
|
900
|
-
* that did.
|
|
901
|
-
*/
|
|
902
|
-
async function readRootStreamReceipt(runDir) {
|
|
903
|
-
const path = resolve(runDir, ROOT_STREAM_FILE);
|
|
904
|
-
const hash = createHash("sha256");
|
|
905
|
-
let events = 0;
|
|
906
|
-
try {
|
|
907
|
-
for await (const _record of readCommittedJsonLines(path, { onBytes: (bytes) => {
|
|
908
|
-
hash.update(bytes);
|
|
909
|
-
} })) events += 1;
|
|
910
|
-
} catch (error) {
|
|
911
|
-
if (isNoEntError(error)) return void 0;
|
|
912
|
-
throw error;
|
|
913
|
-
}
|
|
914
|
-
return Object.freeze({
|
|
915
|
-
ref: `sha256:${hash.digest("hex")}`,
|
|
916
|
-
events
|
|
917
|
-
});
|
|
918
|
-
}
|
|
919
|
-
/** Every committed line of the root stream, in order, or `undefined` when there is no file. A
|
|
920
|
-
* torn final line from a process that died mid-write is not a record and is left out. */
|
|
921
|
-
async function readRootStream(runDir) {
|
|
922
|
-
const path = resolve(runDir, ROOT_STREAM_FILE);
|
|
923
|
-
const records = [];
|
|
924
|
-
try {
|
|
925
|
-
for await (const record of readCommittedJsonLines(path)) records.push(record);
|
|
926
|
-
} catch (error) {
|
|
927
|
-
if (isNoEntError(error)) return void 0;
|
|
928
|
-
throw error;
|
|
929
|
-
}
|
|
930
|
-
return records;
|
|
931
|
-
}
|
|
932
754
|
// src/runtime/anytime.ts
|
|
933
755
|
/**
|
|
934
756
|
* The best-so-far fold — the ONE definition of "how good was the run after k results", shared by
|
|
@@ -9596,6 +9418,6 @@ function superviseWithContext(profile, task, opts, brain) {
|
|
|
9596
9418
|
...signal === void 0 ? {} : { signal }
|
|
9597
9419
|
}, brain));
|
|
9598
9420
|
}
|
|
9599
|
-
export { analyzesFindingsReportPrompt as A, anyOf as B, flowRootProfile as C, defaultEdgeTraversalCap as D, validateFlowGraph as E, formatPromptHandle as F, bestSoFar as G, plateau as H, kernelPromptRegistry as I,
|
|
9421
|
+
export { analyzesFindingsReportPrompt as A, anyOf as B, flowRootProfile as C, defaultEdgeTraversalCap as D, validateFlowGraph as E, formatPromptHandle as F, bestSoFar as G, plateau as H, kernelPromptRegistry as I, createSupervisorSpanRecorder as J, plateauLength as K, naiveContinuationPrompt as L, delegatesWorkerBriefPrompt as M, dumbContinuationFailPrompt as N, graphRootProfile as O, dumbContinuationPassPrompt as P, promptHandle as R, createFlowRun as S, routeFlowOf as T, anytimeReport as U, noProgressFor as V, areaUnderCurve as W, coordinationControlToolNames as _, superviseRootProfile as a, createGraphOverlay as b, retryPreSpawnRefusals as c, supervisorAgent as d, supervisorAgentWithTestBrain as f, serveCoordinationMcp as g, composeReentryTask as h, profileGuidanceComposer as i, createPromptRegistry as j, validateGraphTopology as k, withWorkerSpawnRetry as l, UNPROVEN_CONTINUITY as m, superviseFleetCapabilities as n, isPreSpawnExecutorFailure as o, runToolSpans as p, renderAnytimeTable as q, superviseWithTestBrain as r, resolveWorkerSpawnRetry as s, supervise as t, workerFromBackend as u, driverAgent as v, journaledGateDecider as w, GraphRouteError as x, runBrainLoop as y, allWorkersStalled as z };
|
|
9600
9422
|
|
|
9601
|
-
//# sourceMappingURL=supervise-
|
|
9423
|
+
//# sourceMappingURL=supervise-BtjM7_0G.js.map
|