@tangle-network/agent-runtime 0.337.0 → 0.337.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/dist/{activation-BHFW1uEv.js → activation-BDP6Eivv.js} +3 -3
- package/dist/{activation-BHFW1uEv.js.map → activation-BDP6Eivv.js.map} +1 -1
- package/dist/{activation-DMehb166.d.ts → activation-DRHM55Oo.d.ts} +2 -2
- package/dist/agent.d.ts +1 -1
- package/dist/agent.js +2 -2
- package/dist/{bundle-Cor5z_U9.js → bundle-BPGjESee.js} +2 -2
- package/dist/{bundle-Cor5z_U9.js.map → bundle-BPGjESee.js.map} +1 -1
- package/dist/candidate-execution/index.js +5 -5
- package/dist/{coordination-driver-CMh1f0aW.js → coordination-driver-BHkFVqIq.js} +3 -3
- package/dist/{coordination-driver-CMh1f0aW.js.map → coordination-driver-BHkFVqIq.js.map} +1 -1
- package/dist/{delegate-CCX9kVVr.js → delegate-B-T_ZB50.js} +2 -2
- package/dist/{delegate-CCX9kVVr.js.map → delegate-B-T_ZB50.js.map} +1 -1
- package/dist/durable.d.ts +1 -1
- package/dist/durable.js +5 -5
- package/dist/{graph-DdREcI4N.js → graph-C4RFlWAJ.js} +4 -4
- package/dist/{graph-DdREcI4N.js.map → graph-C4RFlWAJ.js.map} +1 -1
- package/dist/{improvement-cycle-MY3fOdnr.js → improvement-cycle-D1I4hQvf.js} +6 -6
- package/dist/{improvement-cycle-MY3fOdnr.js.map → improvement-cycle-D1I4hQvf.js.map} +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +9 -9
- package/dist/intelligence.d.ts +2 -2
- package/dist/intelligence.js +7 -7
- package/dist/kernel.d.ts +1 -1
- package/dist/kernel.js +9 -9
- package/dist/{loop-runner-bin-B86AiPBf.d.ts → loop-runner-bin-DOuBIJ2O.d.ts} +2 -2
- package/dist/{loop-runner-bin-vk20OLHn.js → loop-runner-bin-Dv5QvYDH.js} +3 -3
- package/dist/{loop-runner-bin-vk20OLHn.js.map → loop-runner-bin-Dv5QvYDH.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 +2 -2
- package/dist/mcp/index.js +5 -5
- package/dist/{openai-tools-DHO2QS1q.d.ts → openai-tools-Oxk4KQrY.d.ts} +2 -2
- package/dist/{prepare-HgB1PE5H.js → prepare-CER-ZkPp.js} +3 -3
- package/dist/{prepare-HgB1PE5H.js.map → prepare-CER-ZkPp.js.map} +1 -1
- package/dist/{profile-hxqZn-p-.js → profile-gNUsHNIJ.js} +2 -2
- package/dist/{profile-hxqZn-p-.js.map → profile-gNUsHNIJ.js.map} +1 -1
- package/dist/profiles.d.ts +1 -1
- package/dist/{protected-model-port-BeJFGIjD.js → protected-model-port-BuRsviSL.js} +4 -4
- package/dist/{protected-model-port-BeJFGIjD.js.map → protected-model-port-BuRsviSL.js.map} +1 -1
- package/dist/{provision-supervisor-BXigA_iX.js → provision-supervisor-DGegCUH4.js} +4 -4
- package/dist/{provision-supervisor-BXigA_iX.js.map → provision-supervisor-DGegCUH4.js.map} +1 -1
- package/dist/{runtime-DfU1_ndW.js → runtime-BOGpotnH.js} +161 -105
- package/dist/runtime-BOGpotnH.js.map +1 -0
- package/dist/{sandbox-profile-compat-BpxJTqU8.js → sandbox-profile-compat-QTkLe1Z6.js} +8 -3
- package/dist/{sandbox-profile-compat-BpxJTqU8.js.map → sandbox-profile-compat-QTkLe1Z6.js.map} +1 -1
- package/dist/{search-executor-SuQmYEil.js → search-executor-Cm1WZmL-.js} +4 -3
- package/dist/search-executor-Cm1WZmL-.js.map +1 -0
- package/dist/{server-B6Ih0E-r.js → server-hZWM-G8w.js} +4 -4
- package/dist/{server-B6Ih0E-r.js.map → server-hZWM-G8w.js.map} +1 -1
- package/dist/{supervise-D9txxvz1.js → supervise-CvAKVfue.js} +4 -4
- package/dist/{supervise-D9txxvz1.js.map → supervise-CvAKVfue.js.map} +1 -1
- package/dist/{supervisor-D3zrWAlw.js → supervisor-Rz8AGpYb.js} +152 -66
- package/dist/supervisor-Rz8AGpYb.js.map +1 -0
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +14 -14
- package/dist/tui/index.d.ts +1 -1
- package/dist/tui/index.js +1 -1
- package/dist/{types-CupCBY-j.d.ts → types-Dl5L4r8Z.d.ts} +20 -8
- package/package.json +3 -3
- package/dist/runtime-DfU1_ndW.js.map +0 -1
- package/dist/search-executor-SuQmYEil.js.map +0 -1
- package/dist/supervisor-D3zrWAlw.js.map +0 -1
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { o as writeAtomicDurableFile } from "./durable-file-B_eJr6Mb.js";
|
|
2
|
-
import { D as settledToIteration, Di as executableAgentProfileSnapshot, Dn as readPromptOptions, En as assertBoxlessPromptOptions, Oi as executableAgentSpecSnapshot, On as routerBrain, Qn as runAbortable, Sn as createSandboxLineage, Y as coordinationProfileToolPrefix,
|
|
2
|
+
import { D as settledToIteration, Di as executableAgentProfileSnapshot, Dn as readPromptOptions, En as assertBoxlessPromptOptions, Oi as executableAgentSpecSnapshot, On as routerBrain, Qn as runAbortable, Sn as createSandboxLineage, Wi as createSandboxTurnEventCollector, Xi as notifySandboxEventObserver, Y as coordinationProfileToolPrefix, aa as insideCursorNamespace, ct as mapExecutorResult, da as isTraceAnalysisStore, en as CheckUnavailableError, f as withDriverExecutor, ga as detachedSnapshot, gt as createWorktreeCliExecutor, ha as detachedFrozen, ia as InMemorySpawnJournal, kn as runBrainLoop, ma as contentAddress, mt as createExecutorRegistry, ot as rollingDispatch, pt as createExecutor, r as createSupervisor, ra as InMemoryResultBlobStore, st as gateOnDeliverable, un as verdictFromJudgeScore, xn as runAgentRounds, yn as defaultSelectWinner } from "./supervisor-Rz8AGpYb.js";
|
|
3
3
|
import { i as ConfigError, m as ValidationError, n as AnalystError, s as PlannerError } from "./errors-DodWX-cb.js";
|
|
4
|
-
import { B as runAgentic, G as observe, K as renderReport, U as ObservationError, V as sample, X as strategyAuthorMethod, a as reconcileInterruptedSearchCalls, c as searchExecutor, q as profileChatClient, r as dedicatedLane, x as runtimeShipDecision, z as refine } from "./search-executor-
|
|
5
|
-
import { $ as isAsyncIterable, Ct as armDeadlineTimer, F as canonicalCandidateDigest$1, G as chargedTokens, K as cloneSpend, M as markPutStreamVerified, Q as isAbortError, U as addSpend, V as sha256Bytes$1, X as fnv1a32Hex, Y as errorMessage, Z as hasCompleteCacheBreakdown, at as sleep, dt as zeroSpend, et as mapWithConcurrency, nt as randomSuffix, ot as stringifySafe, w as captureMaterializedWorkspace, x as WorkspaceScanLimitError, z as immutableCandidateValue } from "./sandbox-profile-compat-
|
|
4
|
+
import { B as runAgentic, G as observe, K as renderReport, U as ObservationError, V as sample, X as strategyAuthorMethod, a as reconcileInterruptedSearchCalls, c as searchExecutor, q as profileChatClient, r as dedicatedLane, x as runtimeShipDecision, z as refine } from "./search-executor-Cm1WZmL-.js";
|
|
5
|
+
import { $ as isAsyncIterable, Ct as armDeadlineTimer, F as canonicalCandidateDigest$1, G as chargedTokens, K as cloneSpend, M as markPutStreamVerified, Q as isAbortError, U as addSpend, V as sha256Bytes$1, X as fnv1a32Hex, Y as errorMessage, Z as hasCompleteCacheBreakdown, at as sleep, dt as zeroSpend, et as mapWithConcurrency, nt as randomSuffix, ot as stringifySafe, w as captureMaterializedWorkspace, x as WorkspaceScanLimitError, z as immutableCandidateValue } from "./sandbox-profile-compat-QTkLe1Z6.js";
|
|
6
6
|
import { a as readCommittedJsonLines, i as readCommittedJsonFile, n as isNoEntError, o as upsertCommittedJsonLine, s as withJsonlFileLock, t as appendCommittedJsonLine } from "./jsonl-file-DBv31uPi.js";
|
|
7
7
|
import { c as profileModelExecutionSettings, i as concreteModelId, l as profileProviderModel, o as enforceTokenLimits, p as canonicalObservedModelParts, t as assertExecutableAgentProfile, v as harnessRunsAgent } from "./model-policy-CyCUwHed.js";
|
|
8
8
|
import { i as notifyRuntimeHookEvent } from "./runtime-hooks-tXpAarhW.js";
|
|
9
9
|
import { i as redactProtectedValue, r as redactProtectedReason } from "./protected-redaction-DFCeo4vg.js";
|
|
10
|
-
import { D as foldCoordinationRecords, w as createInMemoryRunContext } from "./coordination-driver-
|
|
11
|
-
import { r as supervise } from "./supervise-
|
|
10
|
+
import { D as foldCoordinationRecords, w as createInMemoryRunContext } from "./coordination-driver-BHkFVqIq.js";
|
|
11
|
+
import { r as supervise } from "./supervise-CvAKVfue.js";
|
|
12
12
|
import { a as graphRunsFor, d as recordGraphRun, i as graphRegistry, l as lookupGraph, p as taskShapeDigest, r as graphFromStored, t as digestOfGraph } from "./graph-registry-DAI6KNXB.js";
|
|
13
13
|
import "./run-layout-Cu8H7aeh.js";
|
|
14
|
-
import "./provision-supervisor-
|
|
15
|
-
import "./delegate-
|
|
16
|
-
import "./graph-
|
|
14
|
+
import "./provision-supervisor-DGegCUH4.js";
|
|
15
|
+
import "./delegate-B-T_ZB50.js";
|
|
16
|
+
import "./graph-C4RFlWAJ.js";
|
|
17
17
|
import { agentProfileSchema, canonicalAgentProfileDigest, canonicalCandidateDigest, sha256Bytes, validateAgentProfileSecurity } from "@tangle-network/agent-interface";
|
|
18
18
|
import { CODING_HARNESSES, DEFAULT_TRACE_ANALYST_KINDS, InMemoryTraceStore, OUTPUT_VALUE, benjaminiHochberg, buildTrajectory, computeFindingId as computeFindingId$1, confidenceInterval, createTraceAnalyst, expandProfileAxes, makeFinding as makeFinding$1, pairedBootstrap, paretoFrontier, wilcoxonSignedRank, wilson } from "@tangle-network/agent-eval";
|
|
19
19
|
import { createAgentRunOutcomeTracker } from "@tangle-network/sandbox/runtime";
|
|
@@ -31,6 +31,7 @@ import { collectAgentResponseText } from "@tangle-network/sandbox";
|
|
|
31
31
|
import { SearchRecorder, asha, beam, createRunCostLedger, estimateNode, fsCampaignStorage, openSearchLedger, renderSearchSummary, runProfileMatrix, runSearch, searchClaimReserveUsd, searchModelIdentity, surfaceDiff } from "@tangle-network/agent-eval/campaign";
|
|
32
32
|
import { defineEvaluationClaim, summarizeEvaluationUnits } from "@tangle-network/agent-eval/experiment";
|
|
33
33
|
import { createInterface } from "node:readline";
|
|
34
|
+
import { Worker } from "node:worker_threads";
|
|
34
35
|
import { pathToFileURL } from "node:url";
|
|
35
36
|
import { gzipSync } from "node:zlib";
|
|
36
37
|
import { stuckLoopView, toolWasteView } from "@tangle-network/agent-eval/pipelines";
|
|
@@ -4911,6 +4912,133 @@ function requireSpend(rolled, id, root) {
|
|
|
4911
4912
|
return spend;
|
|
4912
4913
|
}
|
|
4913
4914
|
//#endregion
|
|
4915
|
+
//#region src/runtime/durable-sync.ts
|
|
4916
|
+
/**
|
|
4917
|
+
* Threads that run fsync for the private CAS. Node runs every fs call on libuv's pool of four
|
|
4918
|
+
* threads, and an fsync on a busy disk holds its thread until the filesystem journal commits. On
|
|
4919
|
+
* drew-gtr-pro's USB disk (2026-10-20) all four sat in jbd2_log_wait_commit and rq_qos_wait while
|
|
4920
|
+
* a tree capture had 16 files in flight: four fsyncs shared each journal commit, and every open,
|
|
4921
|
+
* read, lstat and link of the capture queued behind them, at about one file per second. On
|
|
4922
|
+
* threads of their own, every fsync in flight waits on the same commit and the pool stays free
|
|
4923
|
+
* for the rest.
|
|
4924
|
+
*/
|
|
4925
|
+
const SYNC_THREADS = 16;
|
|
4926
|
+
const IDLE_THREAD_MS = 3e4;
|
|
4927
|
+
const SYNCER = `
|
|
4928
|
+
const { parentPort } = require('node:worker_threads')
|
|
4929
|
+
const { fsyncSync } = require('node:fs')
|
|
4930
|
+
parentPort.on('message', (fd) => {
|
|
4931
|
+
try {
|
|
4932
|
+
fsyncSync(fd)
|
|
4933
|
+
parentPort.postMessage(null)
|
|
4934
|
+
} catch (error) {
|
|
4935
|
+
parentPort.postMessage({ message: String(error && error.message), code: error && error.code })
|
|
4936
|
+
}
|
|
4937
|
+
})
|
|
4938
|
+
`;
|
|
4939
|
+
const jobs = [];
|
|
4940
|
+
const idle = [];
|
|
4941
|
+
const idleSince = /* @__PURE__ */ new Map();
|
|
4942
|
+
let threads = 0;
|
|
4943
|
+
let threadsUnavailable = false;
|
|
4944
|
+
function retire(worker) {
|
|
4945
|
+
const at = idle.indexOf(worker);
|
|
4946
|
+
if (at === -1) return false;
|
|
4947
|
+
idle.splice(at, 1);
|
|
4948
|
+
clearTimeout(idleSince.get(worker));
|
|
4949
|
+
idleSince.delete(worker);
|
|
4950
|
+
threads--;
|
|
4951
|
+
return true;
|
|
4952
|
+
}
|
|
4953
|
+
function spawn$1() {
|
|
4954
|
+
try {
|
|
4955
|
+
const worker = new Worker(SYNCER, { eval: true });
|
|
4956
|
+
worker.unref();
|
|
4957
|
+
threads++;
|
|
4958
|
+
worker.on("error", () => void 0);
|
|
4959
|
+
worker.on("exit", () => retire(worker));
|
|
4960
|
+
return worker;
|
|
4961
|
+
} catch {
|
|
4962
|
+
threadsUnavailable = true;
|
|
4963
|
+
return;
|
|
4964
|
+
}
|
|
4965
|
+
}
|
|
4966
|
+
function onPool(job) {
|
|
4967
|
+
job.handle.sync().then(() => job.settle(), (error) => job.settle(error));
|
|
4968
|
+
}
|
|
4969
|
+
function rest(worker) {
|
|
4970
|
+
worker.unref();
|
|
4971
|
+
idle.push(worker);
|
|
4972
|
+
const timer = setTimeout(() => {
|
|
4973
|
+
if (retire(worker)) worker.terminate().catch(() => void 0);
|
|
4974
|
+
}, IDLE_THREAD_MS);
|
|
4975
|
+
timer.unref();
|
|
4976
|
+
idleSince.set(worker, timer);
|
|
4977
|
+
}
|
|
4978
|
+
function run(worker, job) {
|
|
4979
|
+
clearTimeout(idleSince.get(worker));
|
|
4980
|
+
idleSince.delete(worker);
|
|
4981
|
+
worker.ref();
|
|
4982
|
+
const detach = () => {
|
|
4983
|
+
worker.off("message", replied);
|
|
4984
|
+
worker.off("error", failed);
|
|
4985
|
+
worker.off("exit", failed);
|
|
4986
|
+
};
|
|
4987
|
+
const replied = (failure) => {
|
|
4988
|
+
detach();
|
|
4989
|
+
rest(worker);
|
|
4990
|
+
if (failure === null) job.settle();
|
|
4991
|
+
else job.settle(Object.assign(new Error(failure.message), { code: failure.code }));
|
|
4992
|
+
dispatch();
|
|
4993
|
+
};
|
|
4994
|
+
const failed = () => {
|
|
4995
|
+
detach();
|
|
4996
|
+
threads--;
|
|
4997
|
+
threadsUnavailable = true;
|
|
4998
|
+
worker.terminate().catch(() => void 0);
|
|
4999
|
+
onPool(job);
|
|
5000
|
+
dispatch();
|
|
5001
|
+
};
|
|
5002
|
+
worker.on("message", replied);
|
|
5003
|
+
worker.on("error", failed);
|
|
5004
|
+
worker.on("exit", failed);
|
|
5005
|
+
worker.postMessage(job.handle.fd);
|
|
5006
|
+
}
|
|
5007
|
+
function dispatch() {
|
|
5008
|
+
while (jobs.length > 0) {
|
|
5009
|
+
if (threadsUnavailable) {
|
|
5010
|
+
onPool(jobs.shift());
|
|
5011
|
+
continue;
|
|
5012
|
+
}
|
|
5013
|
+
const worker = idle.pop() ?? (threads < SYNC_THREADS ? spawn$1() : void 0);
|
|
5014
|
+
if (worker === void 0) {
|
|
5015
|
+
if (threadsUnavailable) continue;
|
|
5016
|
+
return;
|
|
5017
|
+
}
|
|
5018
|
+
run(worker, jobs.shift());
|
|
5019
|
+
}
|
|
5020
|
+
}
|
|
5021
|
+
/** fsync an open file or directory on a sync thread; keep the handle open until this settles. */
|
|
5022
|
+
function syncHandle(handle) {
|
|
5023
|
+
if (threadsUnavailable) return handle.sync();
|
|
5024
|
+
return new Promise((resolve, reject) => {
|
|
5025
|
+
jobs.push({
|
|
5026
|
+
handle,
|
|
5027
|
+
settle: (error) => error === void 0 ? resolve() : reject(error)
|
|
5028
|
+
});
|
|
5029
|
+
dispatch();
|
|
5030
|
+
});
|
|
5031
|
+
}
|
|
5032
|
+
/** Make durable every entry change made in `directory` before this call. */
|
|
5033
|
+
async function syncDirectory(directory) {
|
|
5034
|
+
const handle = await open(directory, constants.O_RDONLY | constants.O_DIRECTORY | constants.O_NOFOLLOW);
|
|
5035
|
+
try {
|
|
5036
|
+
await syncHandle(handle);
|
|
5037
|
+
} finally {
|
|
5038
|
+
await handle.close();
|
|
5039
|
+
}
|
|
5040
|
+
}
|
|
5041
|
+
//#endregion
|
|
4914
5042
|
//#region src/runtime/private-cas.ts
|
|
4915
5043
|
const DIGEST$1 = /^sha256:([0-9a-f]{64})$/u;
|
|
4916
5044
|
const HEX = /^[0-9a-f]{64}$/u;
|
|
@@ -4921,6 +5049,7 @@ const DURABLE_ATTEMPTS = 3;
|
|
|
4921
5049
|
const DURABLE_STALL_MS = 12e4;
|
|
4922
5050
|
const BUFFERED_BYTES_PER_MS = 256;
|
|
4923
5051
|
const OFFLOAD_COPIES_AT_ONCE = 16;
|
|
5052
|
+
const LIST_SHARDS_AT_ONCE = 16;
|
|
4924
5053
|
async function realDirectory(path) {
|
|
4925
5054
|
const entry = await lstat(path);
|
|
4926
5055
|
if (!entry.isDirectory() || entry.isSymbolicLink()) throw new Error(`private CAS directory is not a real directory: ${path}`);
|
|
@@ -4942,14 +5071,6 @@ async function checkDirectories(path, create) {
|
|
|
4942
5071
|
const missing = (error) => error?.code === "ENOENT";
|
|
4943
5072
|
const message = (error) => error instanceof Error ? error.message : String(error);
|
|
4944
5073
|
const sha256 = (bytes) => `sha256:${createHash("sha256").update(bytes).digest("hex")}`;
|
|
4945
|
-
async function syncDirectory(directory) {
|
|
4946
|
-
const handle = await open(directory, constants.O_RDONLY | constants.O_DIRECTORY | constants.O_NOFOLLOW);
|
|
4947
|
-
try {
|
|
4948
|
-
await handle.sync();
|
|
4949
|
-
} finally {
|
|
4950
|
-
await handle.close();
|
|
4951
|
-
}
|
|
4952
|
-
}
|
|
4953
5074
|
/** Read one local object, or undefined when the host no longer holds it. */
|
|
4954
5075
|
async function readLocal(path) {
|
|
4955
5076
|
let file;
|
|
@@ -5011,7 +5132,7 @@ function createPrivateCasArtifactPort(root, namespace, options = {}) {
|
|
|
5011
5132
|
byteLength,
|
|
5012
5133
|
storedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
5013
5134
|
})}\n`);
|
|
5014
|
-
await file
|
|
5135
|
+
await syncHandle(file);
|
|
5015
5136
|
} finally {
|
|
5016
5137
|
await file.close();
|
|
5017
5138
|
}
|
|
@@ -5066,23 +5187,25 @@ function createPrivateCasArtifactPort(root, namespace, options = {}) {
|
|
|
5066
5187
|
if (missing(error)) return [];
|
|
5067
5188
|
throw error;
|
|
5068
5189
|
}
|
|
5069
|
-
|
|
5070
|
-
|
|
5071
|
-
|
|
5072
|
-
|
|
5073
|
-
|
|
5074
|
-
|
|
5075
|
-
|
|
5076
|
-
|
|
5077
|
-
|
|
5078
|
-
|
|
5079
|
-
|
|
5080
|
-
|
|
5081
|
-
|
|
5082
|
-
|
|
5190
|
+
return (await mapWithConcurrency(shards.filter((name) => SHARD.test(name)), LIST_SHARDS_AT_ONCE, async (shard) => {
|
|
5191
|
+
const objects = [];
|
|
5192
|
+
for (const hex of await readdir(join(store, shard))) {
|
|
5193
|
+
if (!HEX.test(hex) || hex.slice(0, 2) !== shard) continue;
|
|
5194
|
+
const path = join(store, shard, hex);
|
|
5195
|
+
try {
|
|
5196
|
+
const entry = await lstat(path);
|
|
5197
|
+
if (entry.isFile()) objects.push({
|
|
5198
|
+
hex,
|
|
5199
|
+
path,
|
|
5200
|
+
size: entry.size,
|
|
5201
|
+
modifiedMs: entry.mtimeMs
|
|
5202
|
+
});
|
|
5203
|
+
} catch (error) {
|
|
5204
|
+
if (!missing(error)) throw error;
|
|
5205
|
+
}
|
|
5083
5206
|
}
|
|
5084
|
-
|
|
5085
|
-
|
|
5207
|
+
return objects;
|
|
5208
|
+
})).flat();
|
|
5086
5209
|
};
|
|
5087
5210
|
const streamDurably = async (digest, path, byteLength, signal) => {
|
|
5088
5211
|
const ref = {
|
|
@@ -5388,7 +5511,7 @@ function createPrivateCasArtifactPort(root, namespace, options = {}) {
|
|
|
5388
5511
|
await file.writeFile(chunk);
|
|
5389
5512
|
}
|
|
5390
5513
|
signal?.throwIfAborted();
|
|
5391
|
-
await file
|
|
5514
|
+
await syncHandle(file);
|
|
5392
5515
|
} finally {
|
|
5393
5516
|
await file.close();
|
|
5394
5517
|
}
|
|
@@ -5416,12 +5539,7 @@ function createPrivateCasArtifactPort(root, namespace, options = {}) {
|
|
|
5416
5539
|
linked = false;
|
|
5417
5540
|
for await (const _chunk of readStream(ref, { signal }));
|
|
5418
5541
|
}
|
|
5419
|
-
|
|
5420
|
-
try {
|
|
5421
|
-
await dir.sync();
|
|
5422
|
-
} finally {
|
|
5423
|
-
await dir.close();
|
|
5424
|
-
}
|
|
5542
|
+
await syncDirectory(directory);
|
|
5425
5543
|
if (durable !== void 0) await settlePut(sha, byteLength, linked, () => streamDurably(digest, path, byteLength, signal), signal);
|
|
5426
5544
|
return ref;
|
|
5427
5545
|
} finally {
|
|
@@ -5478,7 +5596,7 @@ function createPrivateCasArtifactPort(root, namespace, options = {}) {
|
|
|
5478
5596
|
const file = await open(temporary, constants.O_WRONLY | constants.O_CREAT | constants.O_EXCL | constants.O_NOFOLLOW, 384);
|
|
5479
5597
|
try {
|
|
5480
5598
|
await file.writeFile(bytes);
|
|
5481
|
-
await file
|
|
5599
|
+
await syncHandle(file);
|
|
5482
5600
|
} finally {
|
|
5483
5601
|
await file.close();
|
|
5484
5602
|
}
|
|
@@ -6091,7 +6209,7 @@ async function openSandboxRun(client, options, deliverable) {
|
|
|
6091
6209
|
...error !== void 0 ? { error: errorMessage(error) } : {}
|
|
6092
6210
|
});
|
|
6093
6211
|
async function settle(box, events, turnIndex, turnKind) {
|
|
6094
|
-
const collector =
|
|
6212
|
+
const collector = createSandboxTurnEventCollector();
|
|
6095
6213
|
const outcomeTracker = createAgentRunOutcomeTracker();
|
|
6096
6214
|
try {
|
|
6097
6215
|
for await (const ev of events) {
|
|
@@ -6279,68 +6397,6 @@ function hashText(value) {
|
|
|
6279
6397
|
}
|
|
6280
6398
|
return (hash >>> 0).toString(16).padStart(8, "0");
|
|
6281
6399
|
}
|
|
6282
|
-
/**
|
|
6283
|
-
* Collect one turn's events, keeping only the newest snapshot of each streamed text or
|
|
6284
|
-
* reasoning part.
|
|
6285
|
-
*
|
|
6286
|
-
* opencode sends `message.part.updated` once per token, and every frame carries the part's
|
|
6287
|
-
* whole cumulative text, so keeping every frame holds O(L²) bytes per turn: two concurrent
|
|
6288
|
-
* audit workflows took the platform API from 459 MB to an OOM at 1.95 GB in 11 minutes.
|
|
6289
|
-
* A snapshot (a frame whose part carries `text`) whose text extends the previous snapshot
|
|
6290
|
-
* of the same part replaces it and moves to the newest position, which is the rule the
|
|
6291
|
-
* Sandbox SDK's text collectors already apply, so the collected text is unchanged. The kept
|
|
6292
|
-
* frame drops its `delta`, because its text already holds every earlier increment and a
|
|
6293
|
-
* reader that joins `delta ?? part.text` across frames would otherwise read only the last
|
|
6294
|
-
* one. Delta-only frames and every other event are kept as they arrived.
|
|
6295
|
-
*/
|
|
6296
|
-
function createTurnEventCollector() {
|
|
6297
|
-
const slots = [];
|
|
6298
|
-
const snapshots = /* @__PURE__ */ new Map();
|
|
6299
|
-
return {
|
|
6300
|
-
push(event) {
|
|
6301
|
-
const snapshot = partSnapshot(event);
|
|
6302
|
-
if (!snapshot) {
|
|
6303
|
-
slots.push(event);
|
|
6304
|
-
return;
|
|
6305
|
-
}
|
|
6306
|
-
const previous = snapshots.get(snapshot.key);
|
|
6307
|
-
const extends_ = previous !== void 0 && snapshot.text.startsWith(previous.text);
|
|
6308
|
-
if (extends_) slots[previous.at] = void 0;
|
|
6309
|
-
snapshots.set(snapshot.key, {
|
|
6310
|
-
at: slots.length,
|
|
6311
|
-
text: snapshot.text
|
|
6312
|
-
});
|
|
6313
|
-
slots.push(extends_ ? withoutDelta(event) : event);
|
|
6314
|
-
},
|
|
6315
|
-
events() {
|
|
6316
|
-
return slots.filter((event) => event !== void 0);
|
|
6317
|
-
}
|
|
6318
|
-
};
|
|
6319
|
-
}
|
|
6320
|
-
function partSnapshot(event) {
|
|
6321
|
-
if (event?.type !== "message.part.updated") return void 0;
|
|
6322
|
-
const data = asRecord$1(event.data);
|
|
6323
|
-
const part = asRecord$1(data?.part) ?? asRecord$1(asRecord$1(data?.properties)?.part);
|
|
6324
|
-
if (!part || typeof part.id !== "string") return void 0;
|
|
6325
|
-
if (part.type !== "text" && part.type !== "reasoning" && part.type !== "thinking") return void 0;
|
|
6326
|
-
const text = typeof part.text === "string" ? part.text : typeof part.content === "string" ? part.content : void 0;
|
|
6327
|
-
return text === void 0 ? void 0 : {
|
|
6328
|
-
key: `${part.type}:${part.id}`,
|
|
6329
|
-
text
|
|
6330
|
-
};
|
|
6331
|
-
}
|
|
6332
|
-
function withoutDelta(event) {
|
|
6333
|
-
const data = asRecord$1(event.data);
|
|
6334
|
-
if (!data || !("delta" in data)) return event;
|
|
6335
|
-
const { delta: _delta, ...rest } = data;
|
|
6336
|
-
return {
|
|
6337
|
-
...event,
|
|
6338
|
-
data: rest
|
|
6339
|
-
};
|
|
6340
|
-
}
|
|
6341
|
-
function asRecord$1(value) {
|
|
6342
|
-
return value !== null && typeof value === "object" ? value : void 0;
|
|
6343
|
-
}
|
|
6344
6400
|
//#endregion
|
|
6345
6401
|
//#region src/runtime/authored-code.ts
|
|
6346
6402
|
/**
|
|
@@ -9472,4 +9528,4 @@ function tail(s) {
|
|
|
9472
9528
|
//#endregion
|
|
9473
9529
|
export { runBenchmark as $, McpSpawnFault as $t, connectRemoteSupervisor as A, inlineSandboxClient as At, chatTransportExecutor as B, runIsolatedCheck as Bt, analyzeTrace as C, observationFromRegistry as Ct, compileSearchSpec as D, defineLeaderboard as Dt, assertSearchSpec as E, harvestCorpus as Et, profileRunsForName as F, checkProgramDigest as Ft, assertStrategyContract as G, leaderboard as Gt, createChatSessionStore as H, deterministicCompletion as Ht, recordProfileRun as I, declaredCheckDeliverable as It, strategyAuthorSystemPrompt as J, renderLeaderboardMarkdown as Jt, authorStrategy as K, pairwiseSignificance as Kt, patchDelivered as L, declaredCheckDigest as Lt, loadProfile as M, loopDispatch as Mt, pickBestProfile as N, superviseDispatch as Nt, searchPresets as O, resolveSandboxClient as Ot, profileRegistry as P, assertDeclaredCheck as Pt, printBenchmarkReport as Q, openSqlRunStore as Qt, runCoderChecks as R, declaredCheckJudge as Rt, withUntrackedArtifacts as S, registryScopeAnalyst as St, SEARCH_SPEC_CORRELATION_KEY as T, HarvestError as Tt, runStrategyEvolution as U, sentinelCompletion as Ut, chatWorkerSeam as V, completionAuthorizes as Vt, strategyTournament as W, stopSentinel as Wt, openSandboxRun as X, renderPairwiseMarkdown as Xt, SandboxRunAbortError as Y, renderLeaderboardSvg as Yt, createS3PrivateCasStore as Z, SqlRunOwnershipError as Zt, VERIFY_TAIL_CHARS as _, verify as _t, localShell as a, mcpSecretEnvMetadataKey as an, builtinShapes as at, settledWorkerOut as b, buildSteerContext as bt, createVerifierEnvironment as c, secretEnvOfMcpServer as cn, FileCorpus as ct, harvestSurfaceDiffs as d, fanout as dt, connectStdioMcp as en, createPrivateCasArtifactPort as et, analystsFromRegistry as f, flatWidenGate as ft, NOTE_MAX_CHARS as g, selectValidWinner as gt, EVIDENCE_MAX_CHARS as h, pipeline as ht, jjWorkspace as i, envKeyProvider as in, runPersonified as it, bestProfileFor as j, loopCampaignDispatch as jt, searchSpecDigest as k, localSandboxClient as kt, boxSurfaceReader as l, createTangleSandboxExactProcessProvider as ln, InMemoryCorpus as lt, worktreeFanout as m, panel as mt, makeFinding$1 as n, createMcpEnvironment as nn, trajectoryReport as nt, runInWorkspace as o, resolveMcpServerLaunch as on, createShapeRegistry as ot, failuresAnalyst as p, loopUntil as pt, strategyAuthorContract as q, renderLeaderboardHtml as qt, gitWorkspace as r, sanitizeMcpToolSchema as rn, definePersona as rt, createWaterfallCollector as s, resolveSecretEnv as sn, registerShape as st, computeFindingId$1 as t, materializeLocalMcp as tn, equalKOnCost as tt, fsSurfaceReader as u, renderCorpusToInstructions as ut, closingWorkerNote as v, widen as vt, createFencedSqlRunContext as w, inProcessSandboxClient as wt, copyUntrackedIntoClone as x, createScopeAnalyst as xt, composeWorkerEvidence as y, assertTraceDerivedFindings as yt, graphDesignerExtraTools as z, readDeclaredCheck as zt };
|
|
9474
9530
|
|
|
9475
|
-
//# sourceMappingURL=runtime-
|
|
9531
|
+
//# sourceMappingURL=runtime-BOGpotnH.js.map
|