@tangle-network/agent-runtime 10.0.2 → 10.0.3
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 +4 -0
- package/dist/{activation-D0Sp7wMc.d.ts → activation-DbSxPRUW.d.ts} +2 -2
- package/dist/{activation-B0DHGRtB.js → activation-kitznAHo.js} +2 -2
- package/dist/{activation-B0DHGRtB.js.map → activation-kitznAHo.js.map} +1 -1
- package/dist/agent.d.ts +1 -1
- package/dist/agent.js +3 -3
- package/dist/{continuation-CZaeHEzQ.js → continuation-BDeKJgV3.js} +3 -3
- package/dist/{continuation-CZaeHEzQ.js.map → continuation-BDeKJgV3.js.map} +1 -1
- package/dist/{delegate-Co5iUyS0.js → delegate-D8yX_2K7.js} +2 -2
- package/dist/{delegate-Co5iUyS0.js.map → delegate-D8yX_2K7.js.map} +1 -1
- package/dist/{driver-control-acknowledgers-B1Qx2JUz.js → driver-control-acknowledgers-BTSr3Znq.js} +7 -5
- package/dist/{driver-control-acknowledgers-B1Qx2JUz.js.map → driver-control-acknowledgers-BTSr3Znq.js.map} +1 -1
- package/dist/durable-file-DUcTDWJD.js +498 -0
- package/dist/durable-file-DUcTDWJD.js.map +1 -0
- package/dist/durable-file-XqOyDf7q.js +1 -0
- package/dist/durable-writer-thread.d.ts +1 -0
- package/dist/durable-writer-thread.js +86 -0
- package/dist/durable-writer-thread.js.map +1 -0
- package/dist/durable.d.ts +1 -1
- package/dist/durable.js +15 -128
- package/dist/durable.js.map +1 -1
- package/dist/{graph-uc4eT1wR.js → graph-4ep9laIH.js} +7 -7
- package/dist/{graph-uc4eT1wR.js.map → graph-4ep9laIH.js.map} +1 -1
- package/dist/{graph-registry-DxhlgHdA.js → graph-registry-B-EGvJ-3.js} +1 -1
- package/dist/{graph-registry-j9t9J0KT.js → graph-registry-BxEBeihr.js} +4 -4
- package/dist/{graph-registry-j9t9J0KT.js.map → graph-registry-BxEBeihr.js.map} +1 -1
- package/dist/{improve-BM0HlzMi.js → improve-CJf87tBs.js} +7 -7
- package/dist/{improve-BM0HlzMi.js.map → improve-CJf87tBs.js.map} +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +9 -9
- package/dist/intelligence.d.ts +2 -2
- package/dist/intelligence.js +4 -4
- package/dist/{jsonl-file-BhuxeejY.js → jsonl-file-CVAWegN-.js} +53 -11
- package/dist/jsonl-file-CVAWegN-.js.map +1 -0
- package/dist/kernel.d.ts +1 -1
- package/dist/kernel.js +17 -15
- package/dist/{loop-runner-npLkvCU5.d.ts → loop-runner-CayC8e9K.d.ts} +2 -2
- package/dist/{loop-runner-CRC-RE4D.js → loop-runner-Ckj-Zz3-.js} +2 -2
- package/dist/{loop-runner-CRC-RE4D.js.map → loop-runner-Ckj-Zz3-.js.map} +1 -1
- 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 +5 -5
- package/dist/profiles.d.ts +1 -1
- package/dist/{provision-supervisor-CJrMGyZW.js → provision-supervisor-NjROV7AQ.js} +6 -6
- package/dist/{provision-supervisor-CJrMGyZW.js.map → provision-supervisor-NjROV7AQ.js.map} +1 -1
- package/dist/result-blob-store-BR-BVZrg.js +76 -0
- package/dist/result-blob-store-BR-BVZrg.js.map +1 -0
- package/dist/{run-cancellation-CBP3Bmad.js → run-cancellation-C9V1lYhq.js} +5 -209
- package/dist/run-cancellation-C9V1lYhq.js.map +1 -0
- package/dist/run-lock-Y3u9kwM0.js +193 -0
- package/dist/run-lock-Y3u9kwM0.js.map +1 -0
- package/dist/run-reopen-CHYTHk7x.js +134 -0
- package/dist/run-reopen-CHYTHk7x.js.map +1 -0
- package/dist/run-state-DgKo8_tO.js +180 -0
- package/dist/run-state-DgKo8_tO.js.map +1 -0
- package/dist/{runtime-BqSaWTEY.js → runtime-CdthBQUs.js} +21 -19
- package/dist/{runtime-BqSaWTEY.js.map → runtime-CdthBQUs.js.map} +1 -1
- package/dist/{search-executor-C9TN-KgI.js → search-executor-Bb0WuI_Z.js} +3 -3
- package/dist/{search-executor-C9TN-KgI.js.map → search-executor-Bb0WuI_Z.js.map} +1 -1
- package/dist/{server-CcMa8Lt9.js → server-BCtyL7jH.js} +3 -3
- package/dist/{server-CcMa8Lt9.js.map → server-BCtyL7jH.js.map} +1 -1
- package/dist/{settle-record-BtjYZabI.js → settle-record-Beh-sXBW.js} +5 -4
- package/dist/settle-record-Beh-sXBW.js.map +1 -0
- package/dist/{structural-rollout-2oRJjwyM.js → structural-rollout-BRfSDPkv.js} +4 -4
- package/dist/{structural-rollout-2oRJjwyM.js.map → structural-rollout-BRfSDPkv.js.map} +1 -1
- package/dist/{supervise-BrgtzJf3.js → supervise-DTUYxnoJ.js} +9 -8
- package/dist/{supervise-BrgtzJf3.js.map → supervise-DTUYxnoJ.js.map} +1 -1
- package/dist/supervise-identity-eMF-h1uP.js +210 -0
- package/dist/supervise-identity-eMF-h1uP.js.map +1 -0
- package/dist/{supervision-discovery-DLMm3UOr.js → supervision-discovery-CAUsSDno.js} +3 -3
- package/dist/{supervision-discovery-DLMm3UOr.js.map → supervision-discovery-CAUsSDno.js.map} +1 -1
- package/dist/{supervisor-ACffs_W4.js → supervisor-BtRRFbgF.js} +13 -176
- package/dist/supervisor-BtRRFbgF.js.map +1 -0
- package/dist/{supervisor-accounting-BlJqoP3k.js → supervisor-accounting-Cuehs4te.js} +59 -112
- package/dist/supervisor-accounting-Cuehs4te.js.map +1 -0
- package/dist/supervisor-root-contract-CmFKzPps.js +165 -0
- package/dist/supervisor-root-contract-CmFKzPps.js.map +1 -0
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +11 -11
- package/dist/{top-web-PYyzBMsK.js → top-web-D-wuEVdM.js} +7 -6
- package/dist/{top-web-PYyzBMsK.js.map → top-web-D-wuEVdM.js.map} +1 -1
- package/dist/tui/bin.js +3 -3
- package/dist/tui/index.d.ts +1 -1
- package/dist/tui/index.js +2 -2
- package/dist/{types-DX1OGeHE.d.ts → types-PBoTtcbX.d.ts} +2 -2
- package/package.json +1 -1
- package/dist/durable-file-CksURHlH.js +0 -1
- package/dist/durable-file-DstVeHcj.js +0 -228
- package/dist/durable-file-DstVeHcj.js.map +0 -1
- package/dist/jsonl-file-BhuxeejY.js.map +0 -1
- package/dist/run-cancellation-CBP3Bmad.js.map +0 -1
- package/dist/run-state-BnhCVbTY.js +0 -357
- package/dist/run-state-BnhCVbTY.js.map +0 -1
- package/dist/settle-record-BtjYZabI.js.map +0 -1
- package/dist/supervisor-ACffs_W4.js.map +0 -1
- package/dist/supervisor-accounting-BlJqoP3k.js.map +0 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { c as RetainedInteractiveAdmissionError, d as RetainedRunDispatchBindingError, f as RuntimeRunStateError, l as RetainedInteractiveBindingError, m as ValidationError, r as BackendTransportError, u as RetainedRunAdmissionError } from "./errors-DG8yufqX.js";
|
|
2
|
-
import {
|
|
2
|
+
import { _ as runAbortable, c as withJsonlFileLock, d as journalFileStamp, f as sha256, h as deadlineSignal, l as appendCommittedJsonLine, o as readCommittedJsonLines, p as RunCancellationReason, r as prepareJsonlAppend, t as isNoEntError, v as signalAbortError } from "./jsonl-file-CVAWegN-.js";
|
|
3
3
|
import { c as checkInIdleMs, d as teardownExecutor, n as CHILD_DEADLINE_REASON, o as armDeadlineTimer, s as boundedChildDeadlineAt, u as singleFlightTeardown } from "./deadline-CySmJ_0S.js";
|
|
4
4
|
import { A as withBudgetResources, C as unreportedSpend, D as addResourceSpend, T as zeroSpend, a as cloneSpend, c as errorMessage, f as isAsyncIterable, i as chargedTokens, k as resourceTelemetry, n as addSpend, o as cloneTokenUsage, t as abortError, v as sleep } from "./util-qsH5cC9S.js";
|
|
5
5
|
import { $ as newUsageTotals, F as executorFailureInfra, G as BudgetReconcileFault, I as executorFailureReason, J as budgetRecoverySeeds, K as budgetLeaseUpdates, M as contentAddress, Ot as recordValue, P as executorFailure, Q as meterUsageEvent, X as createBudgetPool, Y as completedLeafBacking, Z as refreshBudgetLease, a as settlementFailureCause, d as executorEvidenceWriter, ft as extractTransportEventIdentity, h as prepareRetainedExecutor, j as traceRootWriter, l as RetainedExecutionPendingError, m as leafContinuationExecutionId, n as runtimeFailureCause, nt as assertValidBudget, o as BUDGET_CONTINUATION_TASK, pt as parseCanonicalTransportEvent, q as budgetLeases, rt as assertValidSpend, t as reportedFailureCause, tt as spendFromUsageTotals, v as retainedExecutorSeamKey } from "./failure-cause-DoCCGLDH.js";
|
|
6
6
|
import { a as errMessage, f as resolveRedactor, i as causeChain, l as errorText, n as detachedSnapshot, r as shareParsedStrings, u as defaultRedactor } from "./snapshot-BKI_w3JD.js";
|
|
7
7
|
import { p as canonicalObservedModelParts, t as assertExecutableAgentProfile } from "./model-policy-DZnL8Yj9.js";
|
|
8
8
|
import { b as verifiedArtifactChunks, g as workspaceLimits, h as safeArchivePath, i as readAgentCandidateWorkspaceArtifactFiles } from "./workspace-streams-C7PGLAUd.js";
|
|
9
|
-
import { a as
|
|
9
|
+
import { a as assertNoSymlinkDescendant, b as fenceRunWrite, n as appendDurableFile, o as publishExclusiveDurableFile, r as appendRunLines, u as writeAtomicDurableFile, v as runFencedAsync, y as captureRunWriteContext } from "./durable-file-DUcTDWJD.js";
|
|
10
10
|
import { b as sha256Bytes$1, g as deepFreezeCandidate } from "./output-artifacts-AqkZ8lO2.js";
|
|
11
11
|
import { a as withPursuitContext, i as notifyRuntimeHookEvent } from "./runtime-hooks-CsW2pfFk.js";
|
|
12
12
|
import * as traceContract from "@tangle-network/agent-trace-contract";
|
|
@@ -17,7 +17,7 @@ import { isRecord } from "@tangle-network/agent-core";
|
|
|
17
17
|
import { z } from "zod";
|
|
18
18
|
import { redact } from "@tangle-network/agent-eval/traces";
|
|
19
19
|
import { createHash, randomUUID } from "node:crypto";
|
|
20
|
-
import { appendFileSync, closeSync, constants, existsSync, fstatSync, fsyncSync, lstatSync, mkdirSync, openSync, readFileSync, readdirSync, realpathSync,
|
|
20
|
+
import { appendFileSync, closeSync, constants, existsSync, fstatSync, fsyncSync, lstatSync, mkdirSync, openSync, readFileSync, readdirSync, realpathSync, unlinkSync, writeSync } from "node:fs";
|
|
21
21
|
import { dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
22
22
|
import { mkdir, open, realpath, stat } from "node:fs/promises";
|
|
23
23
|
import { BOUND_HARNESS_SESSION_READ_LIMITS, HARNESS_TRANSCRIPT_DENY, readBoundHarnessSessions } from "@tangle-network/harness-sessions";
|
|
@@ -5132,75 +5132,6 @@ function outsideCursorNamespace(ev) {
|
|
|
5132
5132
|
function insideCursorNamespace(ev) {
|
|
5133
5133
|
return !outsideKinds.has(ev.kind);
|
|
5134
5134
|
}
|
|
5135
|
-
// src/durable/spawn-journal/result-blob-store.ts
|
|
5136
|
-
/**
|
|
5137
|
-
* FS `ResultBlobStore`. One JSON file per artifact under `dir`, named by a
|
|
5138
|
-
* filesystem-safe encoding of the `outRef` (`sha256:<hex>` → `sha256-<hex>.json`).
|
|
5139
|
-
* `put` fsyncs so a crash between writes never loses an acknowledged blob.
|
|
5140
|
-
*
|
|
5141
|
-
* @stable
|
|
5142
|
-
*/
|
|
5143
|
-
var FileResultBlobStore = class {
|
|
5144
|
-
dir;
|
|
5145
|
-
writeContext = captureRunWriteContext();
|
|
5146
|
-
constructor(dir) {
|
|
5147
|
-
this.dir = dir;
|
|
5148
|
-
}
|
|
5149
|
-
async put(outRef, artifact) {
|
|
5150
|
-
return this.writeContext(async () => {
|
|
5151
|
-
const { text } = encodeResultBlob(outRef, artifact);
|
|
5152
|
-
const filePath = this.blobPath(outRef);
|
|
5153
|
-
assertNoSymlinkDescendant(this.dir, filePath, "result blob");
|
|
5154
|
-
await (await import("node:fs/promises")).mkdir(this.dir, { recursive: true });
|
|
5155
|
-
assertNoSymlinkDescendant(this.dir, filePath, "result blob");
|
|
5156
|
-
if (!publishExclusiveDurableFile(filePath, text, { mode: 384 })) assertContentAddress(outRef, await this.get(outRef));
|
|
5157
|
-
});
|
|
5158
|
-
}
|
|
5159
|
-
async get(outRef) {
|
|
5160
|
-
const filePath = this.blobPath(outRef);
|
|
5161
|
-
assertNoSymlinkDescendant(this.dir, filePath, "result blob");
|
|
5162
|
-
const fs = await import("node:fs/promises");
|
|
5163
|
-
const { constants } = await import("node:fs");
|
|
5164
|
-
let text;
|
|
5165
|
-
try {
|
|
5166
|
-
const handle = await fs.open(filePath, constants.O_RDONLY | constants.O_NOFOLLOW);
|
|
5167
|
-
try {
|
|
5168
|
-
if (!(await handle.stat()).isFile()) throw new Error("result blob must be a regular file");
|
|
5169
|
-
text = await handle.readFile("utf8");
|
|
5170
|
-
} finally {
|
|
5171
|
-
await handle.close();
|
|
5172
|
-
}
|
|
5173
|
-
} catch (err) {
|
|
5174
|
-
if (isNoEntError(err)) return void 0;
|
|
5175
|
-
throw err;
|
|
5176
|
-
}
|
|
5177
|
-
const artifact = JSON.parse(text);
|
|
5178
|
-
assertContentAddress(outRef, artifact);
|
|
5179
|
-
return artifact;
|
|
5180
|
-
}
|
|
5181
|
-
blobPath(outRef) {
|
|
5182
|
-
if (!/^sha256:[0-9a-f]{64}$/.test(outRef)) throw new Error("invalid result blob content address");
|
|
5183
|
-
return `${this.dir}/${outRef.replace(/:/g, "-")}.json`;
|
|
5184
|
-
}
|
|
5185
|
-
};
|
|
5186
|
-
/** @internal shared with the SQL-backed store. */
|
|
5187
|
-
function encodeResultBlob(outRef, artifact) {
|
|
5188
|
-
const detached = detachedSnapshot(artifact, "result blob");
|
|
5189
|
-
assertContentAddress(outRef, detached);
|
|
5190
|
-
const text = JSON.stringify(detached);
|
|
5191
|
-
if (text === void 0) throw new Error("result blob must contain JSON");
|
|
5192
|
-
const snapshot = JSON.parse(text);
|
|
5193
|
-
assertContentAddress(outRef, snapshot);
|
|
5194
|
-
return {
|
|
5195
|
-
snapshot,
|
|
5196
|
-
text
|
|
5197
|
-
};
|
|
5198
|
-
}
|
|
5199
|
-
/** @internal shared with the SQL-backed store. */
|
|
5200
|
-
function assertContentAddress(outRef, artifact) {
|
|
5201
|
-
const expected = contentAddress(artifact);
|
|
5202
|
-
if (outRef !== expected) throw new Error(`blob outRef '${outRef}' does not match the artifact content hash '${expected}'; a content-addressed store refuses a mismatched ref (breaks the replay invariant)`);
|
|
5203
|
-
}
|
|
5204
5135
|
// src/runtime/supervise/tree-key.ts
|
|
5205
5136
|
/** Runtime tag used only for a child that owns another supervised scope. */
|
|
5206
5137
|
const driverRuntime = "driver";
|
|
@@ -9185,21 +9116,13 @@ var FileSpawnJournal = class {
|
|
|
9185
9116
|
const { dirname } = await import("node:path");
|
|
9186
9117
|
try {
|
|
9187
9118
|
await fs.mkdir(dirname(this.path), { recursive: true });
|
|
9188
|
-
return await appendCommittedJsonLine(this.path, record,
|
|
9189
|
-
const stamp = journalFileStamp(fstatSync(fd, { bigint: true }));
|
|
9190
|
-
if (journalFileStamp(statSync(this.path, { bigint: true })) !== stamp) throw new Error("spawn journal changed while acknowledging its append");
|
|
9191
|
-
return stamp;
|
|
9192
|
-
});
|
|
9119
|
+
return await appendCommittedJsonLine(this.path, record, { journalStamp: true });
|
|
9193
9120
|
} catch (error) {
|
|
9194
9121
|
this.appendIndex = void 0;
|
|
9195
9122
|
throw error;
|
|
9196
9123
|
}
|
|
9197
9124
|
}
|
|
9198
9125
|
};
|
|
9199
|
-
/** Detect replacement, truncation, and same-size edits; this is not a cross-process write lock. */
|
|
9200
|
-
function journalFileStamp(stat) {
|
|
9201
|
-
return `${stat.dev}:${stat.ino}:${stat.size}:${stat.mtimeNs}:${stat.ctimeNs}`;
|
|
9202
|
-
}
|
|
9203
9126
|
// src/runtime/retained-interactive-handle.ts
|
|
9204
9127
|
function createRetainedInteractiveRunHandle(environment, inputRef, capabilities, requestedStart) {
|
|
9205
9128
|
const ref = freezeInteractiveRef(inputRef);
|
|
@@ -11687,7 +11610,7 @@ function writeWorkerSteer(rootDir, supervisorId, worker, options) {
|
|
|
11687
11610
|
mkdirSync(supervisorWorkersDir(dir), { recursive: true });
|
|
11688
11611
|
const projection = workerInboxFileFromEventDir(dir, workerId);
|
|
11689
11612
|
try {
|
|
11690
|
-
|
|
11613
|
+
appendRunLines(projection, [`${JSON.stringify(request)}\n`]);
|
|
11691
11614
|
} catch {}
|
|
11692
11615
|
appendWorkerControlEvent(dir, workerId, {
|
|
11693
11616
|
kind: "message",
|
|
@@ -11954,14 +11877,11 @@ function isWorkerCancelRequest(value) {
|
|
|
11954
11877
|
}
|
|
11955
11878
|
function appendWorkerControlEvent(eventDir, label, event) {
|
|
11956
11879
|
try {
|
|
11957
|
-
|
|
11958
|
-
|
|
11959
|
-
|
|
11960
|
-
|
|
11961
|
-
|
|
11962
|
-
...event
|
|
11963
|
-
})}\n`, "utf8");
|
|
11964
|
-
});
|
|
11880
|
+
appendRunLines(workerControlLogFile(eventDir, label), [`${JSON.stringify({
|
|
11881
|
+
at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11882
|
+
label,
|
|
11883
|
+
...event
|
|
11884
|
+
})}\n`], { directory: supervisorWorkersDir(eventDir) });
|
|
11965
11885
|
} catch {}
|
|
11966
11886
|
}
|
|
11967
11887
|
function workerSteerRequestDigest(value) {
|
|
@@ -12083,17 +12003,28 @@ function createRootStreamSink(runDir, now, file = ROOT_STREAM_FILE, options = {}
|
|
|
12083
12003
|
const pending = [];
|
|
12084
12004
|
let failure;
|
|
12085
12005
|
let flushedAt = 0;
|
|
12006
|
+
let writes = Promise.resolve();
|
|
12007
|
+
let writing = false;
|
|
12086
12008
|
const flush = () => withClaim(() => {
|
|
12087
12009
|
const writer = fd;
|
|
12088
|
-
if (pending.length === 0 || writer === void 0) return;
|
|
12010
|
+
if (writing || pending.length === 0 || writer === void 0) return;
|
|
12089
12011
|
const lines = pending.splice(0).join("\n");
|
|
12090
12012
|
flushedAt = Date.now();
|
|
12091
|
-
|
|
12092
|
-
|
|
12093
|
-
} catch (error) {
|
|
12013
|
+
writing = true;
|
|
12014
|
+
writes = runFencedAsync("writeStreamLines", writeStreamLinesFenced, writer, lines).catch((error) => {
|
|
12094
12015
|
failure ??= error;
|
|
12095
|
-
}
|
|
12016
|
+
}).finally(() => {
|
|
12017
|
+
writing = false;
|
|
12018
|
+
if (pending.length > 0 && !closed) setImmediate(flush);
|
|
12019
|
+
});
|
|
12096
12020
|
});
|
|
12021
|
+
const drain = async () => {
|
|
12022
|
+
flush();
|
|
12023
|
+
while (writing) {
|
|
12024
|
+
await writes;
|
|
12025
|
+
flush();
|
|
12026
|
+
}
|
|
12027
|
+
};
|
|
12097
12028
|
const openOnce = async () => {
|
|
12098
12029
|
if (fd !== void 0) return;
|
|
12099
12030
|
await mkdir(dirname(path), { recursive: true });
|
|
@@ -12106,16 +12037,7 @@ function createRootStreamSink(runDir, now, file = ROOT_STREAM_FILE, options = {}
|
|
|
12106
12037
|
priorAttempts = Math.max(priorAttempts, record.attempt);
|
|
12107
12038
|
}
|
|
12108
12039
|
if (options.continueAttempts === true) attempt += priorAttempts;
|
|
12109
|
-
fd =
|
|
12110
|
-
const writer = openSync(path, constants.O_APPEND | constants.O_CREAT | constants.O_WRONLY | (typeof constants.O_NOFOLLOW === "number" ? constants.O_NOFOLLOW : 0), 384);
|
|
12111
|
-
try {
|
|
12112
|
-
if (needsSeparator) writeLine(writer, "");
|
|
12113
|
-
return writer;
|
|
12114
|
-
} catch (error) {
|
|
12115
|
-
closeSync(writer);
|
|
12116
|
-
throw error;
|
|
12117
|
-
}
|
|
12118
|
-
});
|
|
12040
|
+
fd = await runFencedAsync("openStreamFile", openStreamFileFenced, path, needsSeparator);
|
|
12119
12041
|
};
|
|
12120
12042
|
return {
|
|
12121
12043
|
async beginAttempt() {
|
|
@@ -12123,9 +12045,9 @@ function createRootStreamSink(runDir, now, file = ROOT_STREAM_FILE, options = {}
|
|
|
12123
12045
|
if (closed) throw new Error("root stream: beginAttempt after close");
|
|
12124
12046
|
attempt += 1;
|
|
12125
12047
|
const writer = fd;
|
|
12126
|
-
|
|
12048
|
+
await drain();
|
|
12127
12049
|
if (failure !== void 0) throw failure;
|
|
12128
|
-
if (writer !== void 0)
|
|
12050
|
+
if (writer !== void 0) await runFencedAsync("syncStreamFile", syncStreamFileFenced, writer);
|
|
12129
12051
|
await openOnce();
|
|
12130
12052
|
});
|
|
12131
12053
|
},
|
|
@@ -12168,18 +12090,43 @@ function createRootStreamSink(runDir, now, file = ROOT_STREAM_FILE, options = {}
|
|
|
12168
12090
|
const writer = fd;
|
|
12169
12091
|
if (writer === void 0) return void 0;
|
|
12170
12092
|
try {
|
|
12171
|
-
|
|
12093
|
+
await drain();
|
|
12172
12094
|
if (failure !== void 0) throw failure;
|
|
12173
|
-
|
|
12095
|
+
await runFencedAsync("syncStreamFile", syncStreamFileFenced, writer);
|
|
12174
12096
|
} finally {
|
|
12175
|
-
closeSync(writer);
|
|
12176
12097
|
fd = void 0;
|
|
12098
|
+
await runFencedAsync("closeStreamFile", closeStreamFile, writer);
|
|
12177
12099
|
}
|
|
12178
12100
|
return readRootStreamReceipt(dir, file);
|
|
12179
12101
|
});
|
|
12180
12102
|
}
|
|
12181
12103
|
};
|
|
12182
12104
|
}
|
|
12105
|
+
/** Open a stream file for append under the fence, separating it from a torn tail. @internal */
|
|
12106
|
+
function openStreamFileFenced(path, needsSeparator) {
|
|
12107
|
+
return fenceRunWrite(() => {
|
|
12108
|
+
const writer = openSync(path, constants.O_APPEND | constants.O_CREAT | constants.O_WRONLY | (typeof constants.O_NOFOLLOW === "number" ? constants.O_NOFOLLOW : 0), 384);
|
|
12109
|
+
try {
|
|
12110
|
+
if (needsSeparator) writeLine(writer, "");
|
|
12111
|
+
return writer;
|
|
12112
|
+
} catch (error) {
|
|
12113
|
+
closeSync(writer);
|
|
12114
|
+
throw error;
|
|
12115
|
+
}
|
|
12116
|
+
});
|
|
12117
|
+
}
|
|
12118
|
+
/** Write grouped stream lines to an open descriptor under the fence. @internal */
|
|
12119
|
+
function writeStreamLinesFenced(fd, lines) {
|
|
12120
|
+
fenceRunWrite(() => writeLine(fd, lines));
|
|
12121
|
+
}
|
|
12122
|
+
/** Close a stream descriptor on the thread that opened it. @internal */
|
|
12123
|
+
function closeStreamFile(fd) {
|
|
12124
|
+
closeSync(fd);
|
|
12125
|
+
}
|
|
12126
|
+
/** Fsync an open stream descriptor under the fence. @internal */
|
|
12127
|
+
function syncStreamFileFenced(fd) {
|
|
12128
|
+
fenceRunWrite(() => fsyncSync(fd));
|
|
12129
|
+
}
|
|
12183
12130
|
/** `writeSync` may legally make a short write; loop until the whole line and its newline land. */
|
|
12184
12131
|
function writeLine(fd, line) {
|
|
12185
12132
|
const bytes = Buffer.from(`${line}\n`, "utf8");
|
|
@@ -14176,6 +14123,6 @@ function unknownChannels(spend) {
|
|
|
14176
14123
|
function isNonEmptySpend(s) {
|
|
14177
14124
|
return s.iterations > 0 || s.tokens.input > 0 || s.tokens.output > 0 || s.usd > 0 || s.ms > 0 || s.tokensKnown === false || s.usdKnown === false || Object.values(s.resources ?? {}).some((resource) => resource.amount > 0 || !resource.known);
|
|
14178
14125
|
}
|
|
14179
|
-
export {
|
|
14126
|
+
export { settledToIteration as $, createRuntimeEventCollector as $n, unknownMaterializationReceipt as $r, noteScopeRetainedOwnerCoordination as $t, writeWorkerCancellation as A, acceptedInteractiveControl as An, attestRuntimeOwnedPendingExecutor as Ar, consumeScopeRetainedOwnerResult as At, workerTraceAnalysisStore as B, workerTraceEnv as Bn, recordRuntimeOwnedDriveHarnessProviderEvidence as Br, restoreScopeOwnerAcceptedExecution as Bt, safeWorkerFile as C, assertRetainedRunReplayMaterial as Cn, SeatChain as Cr, prepareScopeRetainedOwnerSeatSwitch as Ct, workerCancellationsDir as D, startRetainedRun as Dn, subscriptionUsageLimitSignal as Dr, resolveSpawnResourcePaths as Dt, workerCancelRequestsFile as E, recoverRetainedRun as En, seatExecutionProfile as Er, environmentReader as Et, resolveWorkerSlots as F, observerRecordDigest as Fn, inheritRuntimeOwnedExecutorAttestation as Fr, finalizeScopeOwnerMaterialization as Ft, reconnectRetainedInteractiveRun as G, buildLoopOtelSpans as Gn, runtimeOwnedDriveHarnessProviderEvidence as Gr, providerVisibleProfile as Gt, interactiveAdmissionSeamKey as H, createPropagatingTraceEmitter as Hn, recordRuntimeOwnedProviderDispatchNotStarted as Hr, scopeOwnerExecutorNodeContext as Ht, prepareScopeResume as I, verifyObserverRecords as In, knownExecutionBindingReceipt as Ir, holdScopeOwnerTranscript as It, FileSpawnJournal as J, createOpenInferenceFileExporter as Jn, runtimeOwnedExecutorProviderEvidence as Jr, scopeRetainedOwnerSettled as Jt, recoverRetainedInteractiveRun as K, buildLoopSpanNodes as Kn, runtimeOwnedExecutorExecutionBinding as Kr, runtimeGraphMetadataKey as Kt, replaySpawnTree as L, destroyInteractiveEnvironment as Ln, knownMaterializationReceipt as Lr, noteScopeOwnerPlannedExecution as Lt, writeWorkerSteerAcknowledgement as M, prepareInteractiveDelegation as Mn, authoredAgentIdentity as Mr, scopeRetainedOwnerPriorSpend as Mt, createWorkerSlots as N, FileObserverJournal as Nn, authoredProfileDigest as Nr, scopeRetainedOwnerResult as Nt, workerInboxFileFromEventDir as O, startRetainedRunInEnvironment as On, attestRuntimeOwnedDeferredExecutor as Or, RELEASE_DESTROY_MS as Ot, openSlotGroup as P, createFileObserverHooks as Pn, finalizeRuntimeOwnedPendingExecutor as Pr, beginScopeOwnerAttempt as Pt, reenteredWorkers as Q, loopEventToOtelSpan as Qn, unknownExecutionBindingReceipt as Qr, scopeRetainedOwnerRestorePoint as Qt, isTraceAnalysisStore as R, environmentGone as Rn, newExecutionAttemptId as Rr, recordScopeOwnerHarnessTranscript as Rt, readWorkerSteerRequests as S, RetainedMaterializationTimeoutError as Sn, SEAT_RECHECK_MS as Sr, waitForScopeChildren as St, supervisorRunsRoot as T, reconnectRetainedRun as Tn, authoredSeatStages as Tr, scopeRetainedOwnerResourceReader as Tt, attachWorker as U, mergeTraceEnv as Un, recordRuntimeOwnedProviderIdentityConflict as Ur, coordinationMcpAlias as Ut, nestedScopeSeamKey as V, workerTraceHeaders as Vn, recordRuntimeOwnedProviderAttemptStart as Vr, scopeOwnerExecutionObservation as Vt, readWorkerInteractiveBinding as W, readTraceContextFromEnv as Wn, recordRuntimeOwnedProviderModel as Wr, coordinationProfileToolPrefix as Wt, spawnJournalRecordEvents as X, flatOtelSpan as Xn, runtimeOwnedScopeOwnerControl as Xr, assertRetainedOwnerCoordinationRekey as Xt, appendSpawnEvents as Y, createOtelExporter as Yn, runtimeOwnedPendingExecutorMaterialization as Yr, scopeRetainedOwnerTurnEnded as Yt, appendTeardownConfirmation as Z, generateSpanId as Zn, runtimeOwnedScopeOwnerRuntime as Zr, reconcileScopeRetainedOwnerEnvironment as Zt, legacySupervisorRunDir as _, observeModelRequest as _n, createActivityLog as _r, releaseRetainedEnvironments as _t, closeStreamFile as a, runtimeFlowBrain as ai, scopeRetainedOwnerContext as an, captureHarnessTranscript as ar, boundRetainedReleases as at, readWorkerCancellation as b, stopRetainedNativeExecution as bn, isLiveNodeStatus as br, startScopeRecoveries as bt, openStreamFileFenced as c, awaitAbortable$1 as ci, ownedTreeRootSpawn as cn, harnessTranscriptUnavailable as cr, hasRetriableTeardowns as ct, syncStreamFileFenced as d, retainedSessionReplaced as di, driverRuntime as dn, settleHarnessTranscript as dr, pauseScopeSeatAdmission as dt, executableAgentProfileSnapshot as ei, scopeRetainedOwnerCheckpointing as en, createRuntimeStreamEventCollector as er, assertRecursiveReservationPolicy as et, writeStreamLinesFenced as f, sameControlCoordinates as fi, nestedDriverTreeRoot as fn, HARNESS_TRANSCRIPT_READ_LIMITS as fr, recordScopeOwnerBarrenPause as ft, fileEscalateQuestion as g, executorObservationSeamKey as gn, DEFAULT_STALL_AFTER_MS as gr, releaseHeldEnvironments as gt, claimWorkerSteerDelivery as h, providerMessageText as hi, executorObservation as hn, retainHarnessTranscript as hr, registerNestedTeardownScope as ht, ROOT_STREAM_FILE as i, runtimeFlowAgent as ii, scopeOwnerLiabilities as in, captureBoundHarnessTranscript as ir, rollingDispatch as it, writeWorkerSteer as j, offerInteractiveControl as jn, attestRuntimeOwnedScopeOwner as jr, prepareScopeRetainedOwnerTask as jt, workerSteerRequestsDir as k, retainedCreateMaterial as kn, attestRuntimeOwnedExecutor as kr, abandonScopeRetainedOwnerInvocation as kt, readRootStream as l, exactSession as li, materializeTreeView as ln, persistHarnessTranscript as lr, meterRuntimeOwnedAccounting as lt, cancelWorker as m, promptOptionsFromAgentTurnInput as mi, insideCursorNamespace as mn, resolveHarnessTranscriptCapture as mr, recordScopeOwnerPause as mt, terminalAccounting as n, isRuntimeFlowBrain as ni, bindScopeRetainedOwnerProvider as nn, sanitizeRuntimeStreamEvent as nr, freeSlots as nt, createRootStreamSink as o, RetainedRunProviderContractError as oi, scopeRetainedOwnerJournalRoot as on, harnessTranscriptArtifact as or, closeRetainedSlots as ot, appendWorkerControlEvent as p, promptFromAgentTurnInput as pi, SpawnEventIndex as pn, readBoundHarnessSessions$1 as pr, recordScopeOwnerDriverAttempt as pt, startRetainedInteractiveRun as q, buildRuntimeEventOtelSpans as qn, runtimeOwnedExecutorMaterialization as qr, beginScopeRetainedOwnerDrive as qt, createScope as r, runtimeCheckFactory as ri, owners as rn, HARNESS_TRANSCRIPT_SETTLE_TIMEOUT_MS as rr, queueOf as rt, nodeStreamFile as s, assertEventBinding as si, loadSpawnForest as sn, harnessTranscriptFromLines as sr, closeScopeAdmission as st, isNonEmptySpend as t, executableAgentSpecSnapshot as ti, bindScopeRetainedOwnerEnvironmentId as tn, sanitizeKnowledgeReadinessReport as tr, deriveNodeExecutionIdentity as tt, readRootStreamReceipt as u, freezeControlRef as ui, attestNestedDriverTreeOwner as un, readHarnessTranscript as ur, meterRuntimeOwnedProviderAttempt as ut, legacySupervisorRunsRoot as v, NATIVE_STOP_UNCONFIRMED as vn, describeToolArgs as vr, retryUnconfirmedTeardowns as vt, supervisorRunDir as w, mintRetainedIdentity as wn, SeatPauseError as wr, releaseScopeRetainedOwnerForSeatPause as wt, readWorkerSteerAcknowledgement as x, verifyWorkspaceMarker as xn, isTerminalNodeStatus as xr, unconfirmedTeardowns as xt, readWorkerCancelRequests as y, describeRetainedNativeStops as yn, readWorkerProgress as yr, settleManagerWork as yt, parseWorkerToolTraceArtifact as z, WORKER_TRACE_PROPAGATION as zn, providerAttemptEvidence as zr, recordScopeOwnerMaterialization as zt };
|
|
14180
14127
|
|
|
14181
|
-
//# sourceMappingURL=supervisor-accounting-
|
|
14128
|
+
//# sourceMappingURL=supervisor-accounting-Cuehs4te.js.map
|