@tangle-network/agent-runtime 0.294.0 → 0.295.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-1BxDcwZs.d.ts → activation-DYCFEI_o.d.ts} +2 -2
- package/dist/{activation-BKz1t1Qb.js → activation-DbcZXadv.js} +3 -3
- package/dist/{activation-BKz1t1Qb.js.map → activation-DbcZXadv.js.map} +1 -1
- package/dist/agent.d.ts +1 -1
- package/dist/agent.js +2 -2
- package/dist/{bundle-BfW-32vB.js → bundle-CDR0caM4.js} +2 -2
- package/dist/{bundle-BfW-32vB.js.map → bundle-CDR0caM4.js.map} +1 -1
- package/dist/candidate-execution/index.d.ts +27 -3
- package/dist/candidate-execution/index.js +6 -6
- package/dist/{coordination-driver-BpEJv7GR.js → coordination-driver-Do3g6Qif.js} +2 -2
- package/dist/{coordination-driver-BpEJv7GR.js.map → coordination-driver-Do3g6Qif.js.map} +1 -1
- package/dist/{delegate-DEP51NR7.js → delegate-CCaU8M4O.js} +2 -2
- package/dist/{delegate-DEP51NR7.js.map → delegate-CCaU8M4O.js.map} +1 -1
- package/dist/durable.d.ts +1 -1
- package/dist/durable.js +3 -3
- package/dist/{graph-oFWfYVpn.js → graph-dNmpMnzl.js} +4 -4
- package/dist/{graph-oFWfYVpn.js.map → graph-dNmpMnzl.js.map} +1 -1
- package/dist/{improvement-cycle-CBAuTq3p.js → improvement-cycle-D4hoGlAe.js} +6 -6
- package/dist/{improvement-cycle-CBAuTq3p.js.map → improvement-cycle-D4hoGlAe.js.map} +1 -1
- package/dist/{index-D25LzHVg.d.ts → index-nREMiWJP.d.ts} +17 -3
- package/dist/index.d.ts +5 -5
- package/dist/index.js +9 -9
- package/dist/intelligence.d.ts +4 -4
- package/dist/intelligence.js +8 -8
- package/dist/kernel.d.ts +2 -2
- package/dist/kernel.js +8 -8
- package/dist/{loop-runner-bin-hjelfQvP.js → loop-runner-bin-DIf0bbQM.js} +3 -3
- package/dist/{loop-runner-bin-hjelfQvP.js.map → loop-runner-bin-DIf0bbQM.js.map} +1 -1
- package/dist/{loop-runner-bin-BxwHrpyo.d.ts → loop-runner-bin-cf1xZPC2.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 +2 -2
- package/dist/mcp/index.js +4 -4
- package/dist/{prepare-CxnyZ1fG.js → prepare-Dzkj4AGj.js} +3 -3
- package/dist/prepare-Dzkj4AGj.js.map +1 -0
- package/dist/{profile-C4NDjZyB.js → profile-BubsrYhR.js} +2 -2
- package/dist/{profile-C4NDjZyB.js.map → profile-BubsrYhR.js.map} +1 -1
- package/dist/{protected-model-port-DDnU39ul.d.ts → protected-model-port-CAa0t1MT.d.ts} +2 -2
- package/dist/{protected-model-port-BSsgmdhI.js → protected-model-port-_Daje74V.js} +4 -4
- package/dist/{protected-model-port-BSsgmdhI.js.map → protected-model-port-_Daje74V.js.map} +1 -1
- package/dist/{provision-supervisor-CIwZLCGR.js → provision-supervisor-B_3hmSz6.js} +3 -3
- package/dist/{provision-supervisor-CIwZLCGR.js.map → provision-supervisor-B_3hmSz6.js.map} +1 -1
- package/dist/{runtime-B_OdIcAW.js → runtime-CXKCdGTg.js} +242 -24
- package/dist/runtime-CXKCdGTg.js.map +1 -0
- package/dist/{search-method-3EtnGKdL.js → search-method-B0VM-hHV.js} +3 -3
- package/dist/{search-method-3EtnGKdL.js.map → search-method-B0VM-hHV.js.map} +1 -1
- package/dist/{server-DgEDz4Rn.js → server--GKA8T0f.js} +3 -3
- package/dist/{server-DgEDz4Rn.js.map → server--GKA8T0f.js.map} +1 -1
- package/dist/{stream-agent-turn-DsHYpI9p.d.ts → stream-agent-turn-CwqktoXW.d.ts} +2 -2
- package/dist/{supervise-Cu0yOTkc.js → supervise-BwfqpTVR.js} +3 -3
- package/dist/{supervise-Cu0yOTkc.js.map → supervise-BwfqpTVR.js.map} +1 -1
- package/dist/{supervisor-B-UbeBqD.js → supervisor-Da7iAPSw.js} +15 -6
- package/dist/supervisor-Da7iAPSw.js.map +1 -0
- package/dist/testing.d.ts +2 -2
- package/dist/testing.js +14 -14
- package/dist/tui/index.d.ts +1 -1
- package/dist/tui/index.js +1 -1
- package/dist/{workspace-archive-DpyZV2Cj.d.ts → workspace-archive-pz8YJ1fr.d.ts} +12 -1
- package/dist/{workspace-archive-MhowMCmp.js → workspace-streams-D4TMTrJV.js} +301 -15
- package/dist/workspace-streams-D4TMTrJV.js.map +1 -0
- package/package.json +1 -1
- package/dist/prepare-CxnyZ1fG.js.map +0 -1
- package/dist/runtime-B_OdIcAW.js.map +0 -1
- package/dist/supervisor-B-UbeBqD.js.map +0 -1
- package/dist/workspace-archive-MhowMCmp.js.map +0 -1
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { Ai as writeAllBytes, Da as zeroSpend, Dn as runBrainLoop, Dt as rollingDispatch, En as routerBrain, Fa as armDeadlineTimer, Fn as createPushTraceSource, Ft as createWorktreeCliExecutor, G as settledToIteration, Gn as assertContentAddress, Hn as InMemoryResultBlobStore, Kn as encodeResultBlob, M as withDriverExecutor, Mt as createExecutor, Nt as createExecutorRegistry, O as verdictFromJudgeScore, Oi as prepareJsonlAppend, Or as contentAddress, Qi as detachedSnapshot, Sa as stringifySafe, Tn as readPromptOptions, Un as InMemorySpawnJournal, Wn as SpawnEventIndex, Xi as executableAgentSpecSnapshot, Yi as executableAgentProfileSnapshot, Zi as detachedFrozen, _ as CheckUnavailableError, _a as hasCompleteCacheBreakdown, ba as randomSuffix, bn as probeSandboxCapabilities, er as isTraceAnalysisStore, gn as defaultSelectWinner, ha as cloneSpend, ki as readCommittedJsonLines, la as notifySandboxEventObserver, ma as chargedTokens, pa as addSpend, qn as insideCursorNamespace, r as createSupervisor, va as isAbortError, vn as runAgentRounds, wn as assertBoxlessPromptOptions, xa as sleep, yn as createSandboxLineage } from "./supervisor-
|
|
1
|
+
import { Ai as writeAllBytes, Da as zeroSpend, Dn as runBrainLoop, Dt as rollingDispatch, En as routerBrain, Fa as armDeadlineTimer, Fn as createPushTraceSource, Ft as createWorktreeCliExecutor, G as settledToIteration, Gn as assertContentAddress, Hn as InMemoryResultBlobStore, Kn as encodeResultBlob, M as withDriverExecutor, Mt as createExecutor, Nt as createExecutorRegistry, O as verdictFromJudgeScore, Oi as prepareJsonlAppend, Or as contentAddress, Qi as detachedSnapshot, Sa as stringifySafe, Tn as readPromptOptions, Un as InMemorySpawnJournal, Wn as SpawnEventIndex, Xi as executableAgentSpecSnapshot, Yi as executableAgentProfileSnapshot, Zi as detachedFrozen, _ as CheckUnavailableError, _a as hasCompleteCacheBreakdown, ba as randomSuffix, bn as probeSandboxCapabilities, er as isTraceAnalysisStore, gn as defaultSelectWinner, ha as cloneSpend, ki as readCommittedJsonLines, la as notifySandboxEventObserver, ma as chargedTokens, pa as addSpend, qn as insideCursorNamespace, r as createSupervisor, va as isAbortError, vn as runAgentRounds, wn as assertBoxlessPromptOptions, xa as sleep, yn as createSandboxLineage } from "./supervisor-Da7iAPSw.js";
|
|
2
2
|
import { i as ConfigError, m as ValidationError, n as AnalystError, s as PlannerError } from "./errors-DodWX-cb.js";
|
|
3
|
-
import { Q as sample, X as refine, Z as runAgentic, c as reconcileInterruptedSearchCalls, ct as strategyAuthorMethod, et as ObservationError, it as profileChatClient, nt as observe, o as dedicatedLane, r as runtimeShipDecision, rt as renderReport, u as searchExecutor } from "./search-method-
|
|
3
|
+
import { Q as sample, X as refine, Z as runAgentic, c as reconcileInterruptedSearchCalls, ct as strategyAuthorMethod, et as ObservationError, it as profileChatClient, nt as observe, o as dedicatedLane, r as runtimeShipDecision, rt as renderReport, u as searchExecutor } from "./search-method-B0VM-hHV.js";
|
|
4
4
|
import { c as profileModelExecutionSettings, i as concreteModelId, l as profileProviderModel, o as enforceTokenLimits, p as canonicalObservedModelParts, t as assertExecutableAgentProfile } from "./model-policy-DydyWTQg.js";
|
|
5
|
-
import {
|
|
5
|
+
import { D as canonicalCandidateDigest$1, N as sha256Bytes$1, h as WorkspaceScanLimitError, j as immutableCandidateValue, v as captureMaterializedWorkspace } from "./workspace-streams-D4TMTrJV.js";
|
|
6
6
|
import { i as notifyRuntimeHookEvent } from "./runtime-hooks-tXpAarhW.js";
|
|
7
7
|
import { i as redactProtectedValue, r as redactProtectedReason } from "./protected-redaction-DylCC_ot.js";
|
|
8
|
-
import { S as foldCoordinationRecords, y as createInMemoryRunContext } from "./coordination-driver-
|
|
9
|
-
import { C as gateOnDeliverable, r as supervise, w as mapExecutorResult } from "./supervise-
|
|
8
|
+
import { S as foldCoordinationRecords, y as createInMemoryRunContext } from "./coordination-driver-Do3g6Qif.js";
|
|
9
|
+
import { C as gateOnDeliverable, r as supervise, w as mapExecutorResult } from "./supervise-BwfqpTVR.js";
|
|
10
10
|
import "./run-layout-DSCWdbX2.js";
|
|
11
|
-
import "./provision-supervisor-
|
|
12
|
-
import "./delegate-
|
|
13
|
-
import "./graph-
|
|
11
|
+
import "./provision-supervisor-B_3hmSz6.js";
|
|
12
|
+
import "./delegate-CCaU8M4O.js";
|
|
13
|
+
import "./graph-dNmpMnzl.js";
|
|
14
14
|
import { agentProfileSchema, canonicalAgentProfileDigest, canonicalCandidateDigest, sha256Bytes, validateAgentProfileSecurity } from "@tangle-network/agent-interface";
|
|
15
15
|
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";
|
|
16
16
|
import { createAgentRunOutcomeTracker } from "@tangle-network/sandbox/runtime";
|
|
@@ -22,6 +22,7 @@ import { chmod, link, lstat, mkdir, mkdtemp, open, opendir, readFile, readdir, r
|
|
|
22
22
|
import { tmpdir } from "node:os";
|
|
23
23
|
import { isDeepStrictEqual, promisify } from "node:util";
|
|
24
24
|
import { redact } from "@tangle-network/agent-eval/traces";
|
|
25
|
+
import { Readable } from "node:stream";
|
|
25
26
|
import { collectAgentResponseText } from "@tangle-network/sandbox";
|
|
26
27
|
import { SearchRecorder, asha, beam, createRunCostLedger, estimateNode, fsCampaignStorage, openSearchLedger, renderSearchSummary, runProfileMatrix, runSearch, searchClaimReserveUsd, searchModelIdentity, surfaceDiff } from "@tangle-network/agent-eval/campaign";
|
|
27
28
|
import { defineEvaluationClaim, summarizeEvaluationUnits } from "@tangle-network/agent-eval/experiment";
|
|
@@ -5129,17 +5130,53 @@ function createPrivateCasArtifactPort(root, namespace, options = {}) {
|
|
|
5129
5130
|
});
|
|
5130
5131
|
continue;
|
|
5131
5132
|
}
|
|
5132
|
-
const bytes = await readLocal(object.path);
|
|
5133
|
-
if (bytes === void 0) continue;
|
|
5134
|
-
if (sha256(bytes) !== digest) {
|
|
5135
|
-
pending.push({
|
|
5136
|
-
digest,
|
|
5137
|
-
error: "local object failed digest verification; it stays on the host"
|
|
5138
|
-
});
|
|
5139
|
-
continue;
|
|
5140
|
-
}
|
|
5141
5133
|
try {
|
|
5142
|
-
|
|
5134
|
+
if (durable.putStream && durable.getStream) {
|
|
5135
|
+
const ref = {
|
|
5136
|
+
locator: {
|
|
5137
|
+
kind: "private-cas",
|
|
5138
|
+
namespace,
|
|
5139
|
+
digest
|
|
5140
|
+
},
|
|
5141
|
+
sha256: digest,
|
|
5142
|
+
byteLength: object.size
|
|
5143
|
+
};
|
|
5144
|
+
let failure;
|
|
5145
|
+
for (let attempt = 1; attempt <= DURABLE_ATTEMPTS; attempt++) {
|
|
5146
|
+
signal?.throwIfAborted();
|
|
5147
|
+
const chunks = readObject(object.path, ref, signal);
|
|
5148
|
+
try {
|
|
5149
|
+
await durable.putStream({
|
|
5150
|
+
namespace,
|
|
5151
|
+
digest,
|
|
5152
|
+
byteLength: object.size,
|
|
5153
|
+
chunks,
|
|
5154
|
+
signal
|
|
5155
|
+
});
|
|
5156
|
+
await writeReceipt(digest, object.size);
|
|
5157
|
+
failure = void 0;
|
|
5158
|
+
break;
|
|
5159
|
+
} catch (error) {
|
|
5160
|
+
failure = error;
|
|
5161
|
+
if (signal?.aborted) throw error;
|
|
5162
|
+
if (attempt < DURABLE_ATTEMPTS) await new Promise((settle) => setTimeout(settle, 1e3 * 4 ** (attempt - 1)));
|
|
5163
|
+
} finally {
|
|
5164
|
+
await chunks.return(void 0);
|
|
5165
|
+
}
|
|
5166
|
+
}
|
|
5167
|
+
if (failure !== void 0) throw failure;
|
|
5168
|
+
} else {
|
|
5169
|
+
const bytes = await readLocal(object.path);
|
|
5170
|
+
if (bytes === void 0) continue;
|
|
5171
|
+
if (sha256(bytes) !== digest) {
|
|
5172
|
+
pending.push({
|
|
5173
|
+
digest,
|
|
5174
|
+
error: "local object failed digest verification; it stays on the host"
|
|
5175
|
+
});
|
|
5176
|
+
continue;
|
|
5177
|
+
}
|
|
5178
|
+
await storeDurably(digest, bytes, signal);
|
|
5179
|
+
}
|
|
5143
5180
|
durableHex.add(object.hex);
|
|
5144
5181
|
uploaded++;
|
|
5145
5182
|
} catch (error) {
|
|
@@ -5189,7 +5226,119 @@ function createPrivateCasArtifactPort(root, namespace, options = {}) {
|
|
|
5189
5226
|
if (sha256(bytes) !== ref.sha256 || bytes.byteLength !== ref.byteLength) throw new Error("private CAS object failed digest or length verification");
|
|
5190
5227
|
return bytes;
|
|
5191
5228
|
};
|
|
5229
|
+
async function* readStream(ref, options = {}) {
|
|
5230
|
+
const { signal } = options;
|
|
5231
|
+
signal?.throwIfAborted();
|
|
5232
|
+
if (ref.locator.kind !== "private-cas" || ref.locator.namespace !== namespace || ref.locator.digest !== ref.sha256) throw new Error("private CAS locator does not match its digest and namespace");
|
|
5233
|
+
const path = destination(ref.sha256);
|
|
5234
|
+
try {
|
|
5235
|
+
await checkDirectories(join(store, hexOf(ref.sha256).slice(0, 2)), false);
|
|
5236
|
+
yield* readObject(path, ref, signal);
|
|
5237
|
+
return;
|
|
5238
|
+
} catch (error) {
|
|
5239
|
+
if (!missing(error)) throw error;
|
|
5240
|
+
}
|
|
5241
|
+
if (!durable?.getStream) throw new Error(`private CAS object is not on this host; streaming durable reads are unavailable: ${ref.sha256}`);
|
|
5242
|
+
const chunks = await durable.getStream({
|
|
5243
|
+
namespace,
|
|
5244
|
+
digest: ref.sha256,
|
|
5245
|
+
signal
|
|
5246
|
+
});
|
|
5247
|
+
if (!chunks) throw new Error(`private CAS object is neither on this host nor in ${durable.location}: ${ref.sha256}`);
|
|
5248
|
+
yield* checkedChunks(chunks, ref, signal);
|
|
5249
|
+
}
|
|
5250
|
+
async function* readObject(path, ref, signal) {
|
|
5251
|
+
signal?.throwIfAborted();
|
|
5252
|
+
const file = await open(path, constants.O_RDONLY | constants.O_NOFOLLOW);
|
|
5253
|
+
try {
|
|
5254
|
+
const stats = await file.stat();
|
|
5255
|
+
if (!stats.isFile() || stats.size !== ref.byteLength) throw new Error("private CAS object failed digest or length verification");
|
|
5256
|
+
yield* checkedChunks(file.createReadStream({
|
|
5257
|
+
autoClose: false,
|
|
5258
|
+
highWaterMark: 64 * 1024
|
|
5259
|
+
}), ref, signal);
|
|
5260
|
+
} finally {
|
|
5261
|
+
await file.close();
|
|
5262
|
+
}
|
|
5263
|
+
}
|
|
5264
|
+
async function* checkedChunks(chunks, ref, signal) {
|
|
5265
|
+
const hash = createHash("sha256");
|
|
5266
|
+
let byteLength = 0;
|
|
5267
|
+
for await (const chunk of chunks) {
|
|
5268
|
+
signal?.throwIfAborted();
|
|
5269
|
+
if (!(chunk instanceof Uint8Array)) throw new Error("private CAS emitted a non-byte chunk");
|
|
5270
|
+
byteLength += chunk.byteLength;
|
|
5271
|
+
if (byteLength > ref.byteLength) throw new Error("private CAS object failed digest or length verification");
|
|
5272
|
+
hash.update(chunk);
|
|
5273
|
+
yield chunk;
|
|
5274
|
+
}
|
|
5275
|
+
signal?.throwIfAborted();
|
|
5276
|
+
if (`sha256:${hash.digest("hex")}` !== ref.sha256 || byteLength !== ref.byteLength) throw new Error("private CAS object failed digest or length verification");
|
|
5277
|
+
}
|
|
5278
|
+
async function putStream(input) {
|
|
5279
|
+
const { signal } = input;
|
|
5280
|
+
signal?.throwIfAborted();
|
|
5281
|
+
await checkDirectories(store, true);
|
|
5282
|
+
const temporary = join(store, `.${randomUUID()}.tmp`);
|
|
5283
|
+
try {
|
|
5284
|
+
const file = await open(temporary, constants.O_WRONLY | constants.O_CREAT | constants.O_EXCL | constants.O_NOFOLLOW, 384);
|
|
5285
|
+
const hash = createHash("sha256");
|
|
5286
|
+
let byteLength = 0;
|
|
5287
|
+
try {
|
|
5288
|
+
for await (const chunk of input.chunks) {
|
|
5289
|
+
signal?.throwIfAborted();
|
|
5290
|
+
if (!(chunk instanceof Uint8Array)) throw new Error("private CAS received a non-byte chunk");
|
|
5291
|
+
hash.update(chunk);
|
|
5292
|
+
byteLength += chunk.byteLength;
|
|
5293
|
+
if (!Number.isSafeInteger(byteLength)) throw new Error("private CAS object is too large");
|
|
5294
|
+
await file.writeFile(chunk);
|
|
5295
|
+
}
|
|
5296
|
+
signal?.throwIfAborted();
|
|
5297
|
+
await file.sync();
|
|
5298
|
+
} finally {
|
|
5299
|
+
await file.close();
|
|
5300
|
+
}
|
|
5301
|
+
const sha = hash.digest("hex");
|
|
5302
|
+
const digest = `sha256:${sha}`;
|
|
5303
|
+
const ref = {
|
|
5304
|
+
locator: {
|
|
5305
|
+
kind: "private-cas",
|
|
5306
|
+
namespace,
|
|
5307
|
+
digest
|
|
5308
|
+
},
|
|
5309
|
+
sha256: digest,
|
|
5310
|
+
byteLength
|
|
5311
|
+
};
|
|
5312
|
+
for await (const _chunk of readObject(temporary, ref, signal));
|
|
5313
|
+
const path = destination(digest);
|
|
5314
|
+
const directory = join(store, sha.slice(0, 2));
|
|
5315
|
+
await checkDirectories(directory, true);
|
|
5316
|
+
signal?.throwIfAborted();
|
|
5317
|
+
try {
|
|
5318
|
+
await link(temporary, path);
|
|
5319
|
+
} catch (error) {
|
|
5320
|
+
if (error.code !== "EEXIST") throw error;
|
|
5321
|
+
for await (const _chunk of readStream(ref, { signal }));
|
|
5322
|
+
}
|
|
5323
|
+
const dir = await open(directory, constants.O_RDONLY | constants.O_DIRECTORY | constants.O_NOFOLLOW);
|
|
5324
|
+
try {
|
|
5325
|
+
await dir.sync();
|
|
5326
|
+
} finally {
|
|
5327
|
+
await dir.close();
|
|
5328
|
+
}
|
|
5329
|
+
if (durable !== void 0) await offload(signal);
|
|
5330
|
+
return ref;
|
|
5331
|
+
} finally {
|
|
5332
|
+
await unlink(temporary).catch((error) => {
|
|
5333
|
+
if (error.code !== "ENOENT") throw error;
|
|
5334
|
+
});
|
|
5335
|
+
}
|
|
5336
|
+
}
|
|
5192
5337
|
const port = {
|
|
5338
|
+
...durable === void 0 || durable.putStream && durable.getStream ? {
|
|
5339
|
+
putStream,
|
|
5340
|
+
readStream
|
|
5341
|
+
} : {},
|
|
5193
5342
|
async put({ bytes, signal }) {
|
|
5194
5343
|
signal?.throwIfAborted();
|
|
5195
5344
|
const digest = sha256(bytes);
|
|
@@ -5505,7 +5654,7 @@ function createS3PrivateCasStore(options) {
|
|
|
5505
5654
|
if (!match) throw new Error("S3 private CAS digest must be sha256:<64 lowercase hex>");
|
|
5506
5655
|
return `${prefix}${namespace}/sha256/${match[1]}`;
|
|
5507
5656
|
};
|
|
5508
|
-
const request = async (method, objectKey, { body, payloadHash = EMPTY_PAYLOAD, headers = {}, signal } = {}) => {
|
|
5657
|
+
const request = async (method, objectKey, { body, byteLength, payloadHash = EMPTY_PAYLOAD, headers = {}, signal } = {}) => {
|
|
5509
5658
|
const path = `/${[options.bucket, ...objectKey.split("/")].map(encode).join("/")}`;
|
|
5510
5659
|
const url = new URL(path, endpoint);
|
|
5511
5660
|
const amzDate = (/* @__PURE__ */ new Date()).toISOString().replace(/[:-]|\.\d{3}/gu, "");
|
|
@@ -5533,7 +5682,7 @@ function createS3PrivateCasStore(options) {
|
|
|
5533
5682
|
hex(canonical)
|
|
5534
5683
|
].join("\n")).digest("hex");
|
|
5535
5684
|
const { host: _host, ...sent } = signed;
|
|
5536
|
-
const deadline = AbortSignal.timeout(timeoutMs + Math.ceil((
|
|
5685
|
+
const deadline = AbortSignal.timeout(timeoutMs + Math.ceil((byteLength ?? (body instanceof Uint8Array ? body.byteLength : 0)) / (1024 * 1024)) * 1e3);
|
|
5537
5686
|
return await send(url, {
|
|
5538
5687
|
method,
|
|
5539
5688
|
headers: {
|
|
@@ -5541,11 +5690,23 @@ function createS3PrivateCasStore(options) {
|
|
|
5541
5690
|
authorization: `AWS4-HMAC-SHA256 Credential=${options.accessKeyId}/${scope}, SignedHeaders=${names.join(";")}, Signature=${signature}`
|
|
5542
5691
|
},
|
|
5543
5692
|
...body === void 0 ? {} : { body },
|
|
5693
|
+
...body instanceof ReadableStream ? { duplex: "half" } : {},
|
|
5544
5694
|
signal: signal === void 0 ? deadline : AbortSignal.any([signal, deadline])
|
|
5545
5695
|
});
|
|
5546
5696
|
};
|
|
5547
5697
|
const refusal = async (response, action) => {
|
|
5548
|
-
const
|
|
5698
|
+
const reader = response.body?.getReader();
|
|
5699
|
+
let detail = "";
|
|
5700
|
+
try {
|
|
5701
|
+
while (reader && detail.length < 300) {
|
|
5702
|
+
const { done, value } = await reader.read();
|
|
5703
|
+
if (done) break;
|
|
5704
|
+
detail += new TextDecoder().decode(value.subarray(0, 300));
|
|
5705
|
+
}
|
|
5706
|
+
} catch {} finally {
|
|
5707
|
+
await reader?.cancel().catch(() => void 0);
|
|
5708
|
+
}
|
|
5709
|
+
detail = detail.replace(/\s+/gu, " ").slice(0, 300);
|
|
5549
5710
|
return /* @__PURE__ */ new Error(`S3 private CAS ${action} returned ${response.status}${detail ? `: ${detail}` : ""}`);
|
|
5550
5711
|
};
|
|
5551
5712
|
/** Whether the bucket holds this exact object; refuses a same-key object of other bytes. */
|
|
@@ -5560,6 +5721,63 @@ function createS3PrivateCasStore(options) {
|
|
|
5560
5721
|
};
|
|
5561
5722
|
return {
|
|
5562
5723
|
location: `s3://${options.bucket}/${prefix}`,
|
|
5724
|
+
async putStream({ namespace, digest, byteLength, chunks, signal }) {
|
|
5725
|
+
const objectKey = key(namespace, digest);
|
|
5726
|
+
if (await holds(objectKey, digest, byteLength, signal)) return;
|
|
5727
|
+
async function* checked() {
|
|
5728
|
+
const hash = createHash("sha256");
|
|
5729
|
+
let total = 0;
|
|
5730
|
+
for await (const chunk of chunks) {
|
|
5731
|
+
signal?.throwIfAborted();
|
|
5732
|
+
total += chunk.byteLength;
|
|
5733
|
+
if (total > byteLength) throw new Error("S3 private CAS stream exceeds its declared length");
|
|
5734
|
+
hash.update(chunk);
|
|
5735
|
+
yield chunk;
|
|
5736
|
+
}
|
|
5737
|
+
if (total !== byteLength || `sha256:${hash.digest("hex")}` !== digest) throw new Error("S3 private CAS stream failed digest or length verification");
|
|
5738
|
+
}
|
|
5739
|
+
const body = Readable.from(checked());
|
|
5740
|
+
try {
|
|
5741
|
+
const response = await request("PUT", objectKey, {
|
|
5742
|
+
body: Readable.toWeb(body),
|
|
5743
|
+
byteLength,
|
|
5744
|
+
payloadHash: DIGEST.exec(digest)[1],
|
|
5745
|
+
headers: {
|
|
5746
|
+
"content-type": CONTENT_TYPE,
|
|
5747
|
+
"content-length": String(byteLength),
|
|
5748
|
+
[METADATA_DIGEST]: digest
|
|
5749
|
+
},
|
|
5750
|
+
...signal === void 0 ? {} : { signal }
|
|
5751
|
+
});
|
|
5752
|
+
if (!response.ok) throw await refusal(response, "PUT");
|
|
5753
|
+
await response.body?.cancel().catch(() => void 0);
|
|
5754
|
+
if (!await holds(objectKey, digest, byteLength, signal)) throw new Error(`S3 private CAS object ${objectKey} is absent after its write`);
|
|
5755
|
+
} finally {
|
|
5756
|
+
body.destroy();
|
|
5757
|
+
}
|
|
5758
|
+
},
|
|
5759
|
+
async getStream({ namespace, digest, signal }) {
|
|
5760
|
+
const response = await request("GET", key(namespace, digest), signal === void 0 ? {} : { signal });
|
|
5761
|
+
if (response.status === 404) {
|
|
5762
|
+
await response.body?.cancel().catch(() => void 0);
|
|
5763
|
+
return;
|
|
5764
|
+
}
|
|
5765
|
+
if (!response.ok) throw await refusal(response, "GET");
|
|
5766
|
+
if (!response.body) throw new Error("S3 private CAS GET returned no body");
|
|
5767
|
+
return (async function* () {
|
|
5768
|
+
const reader = response.body.getReader();
|
|
5769
|
+
try {
|
|
5770
|
+
while (true) {
|
|
5771
|
+
signal?.throwIfAborted();
|
|
5772
|
+
const { done, value } = await reader.read();
|
|
5773
|
+
if (done) break;
|
|
5774
|
+
yield value;
|
|
5775
|
+
}
|
|
5776
|
+
} finally {
|
|
5777
|
+
await reader.cancel().catch(() => void 0);
|
|
5778
|
+
}
|
|
5779
|
+
})();
|
|
5780
|
+
},
|
|
5563
5781
|
async put({ namespace, digest, bytes, signal }) {
|
|
5564
5782
|
const objectKey = key(namespace, digest);
|
|
5565
5783
|
if (await holds(objectKey, digest, bytes.byteLength, signal)) return;
|
|
@@ -5573,13 +5791,13 @@ function createS3PrivateCasStore(options) {
|
|
|
5573
5791
|
...signal === void 0 ? {} : { signal }
|
|
5574
5792
|
});
|
|
5575
5793
|
if (!response.ok) throw await refusal(response, "PUT");
|
|
5576
|
-
await response.
|
|
5794
|
+
await response.body?.cancel().catch(() => void 0);
|
|
5577
5795
|
if (!await holds(objectKey, digest, bytes.byteLength, signal)) throw new Error(`S3 private CAS object ${objectKey} is absent after its write`);
|
|
5578
5796
|
},
|
|
5579
5797
|
async get({ namespace, digest, signal }) {
|
|
5580
5798
|
const response = await request("GET", key(namespace, digest), signal === void 0 ? {} : { signal });
|
|
5581
5799
|
if (response.status === 404) {
|
|
5582
|
-
await response.
|
|
5800
|
+
await response.body?.cancel().catch(() => void 0);
|
|
5583
5801
|
return;
|
|
5584
5802
|
}
|
|
5585
5803
|
if (!response.ok) throw await refusal(response, "GET");
|
|
@@ -8722,4 +8940,4 @@ function tail(s) {
|
|
|
8722
8940
|
//#endregion
|
|
8723
8941
|
export { FileCorpus as $, envKeyProvider as $t, unsafeInProcessRunner as A, readDeclaredCheck as At, SandboxRunAbortError as B, renderLeaderboardSvg as Bt, withUntrackedArtifacts as C, loopDispatch as Ct, patchDelivered as D, declaredCheckDeliverable as Dt, createSqlRunContext as E, checkProgramDigest as Et, strategyTournament as F, stopSentinel as Ft, createPrivateCasArtifactPort as G, openSqlRunStore as Gt, createS3PrivateCasStore as H, auditIntent as Ht, assertStrategyContract as I, leaderboard as It, definePersona as J, McpSpawnFault as Jt, equalKOnCost as K, SqlResultBlobStore as Kt, authorStrategy as L, pairwiseSignificance as Lt, chatWorkerSeam as M, completionAuthorizes as Mt, createChatSessionStore as N, deterministicCompletion as Nt, runCoderChecks as O, declaredCheckDigest as Ot, runStrategyEvolution as P, sentinelCompletion as Pt, registerShape as Q, sanitizeMcpToolSchema as Qt, strategyAuthorContract as R, renderLeaderboardHtml as Rt, copyUntrackedIntoClone as S, loopCampaignDispatch as St, createFencedSqlRunContext as T, assertDeclaredCheck as Tt, printBenchmarkReport as U, defaultAuditorInstruction as Ut, openSandboxRun as V, renderPairwiseMarkdown as Vt, runBenchmark as W, SqlRunOwnershipError as Wt, builtinShapes as X, materializeLocalMcp as Xt, runPersonified as Y, connectStdioMcp as Yt, createShapeRegistry as Z, createMcpEnvironment as Zt, NOTE_MAX_CHARS as _, harvestCorpus as _t, localShell as a, panel as at, composeWorkerEvidence as b, localSandboxClient as bt, createVerifierEnvironment as c, verify as ct, harvestSurfaceDiffs as d, buildSteerContext as dt, mcpSecretEnvMetadataKey as en, InMemoryCorpus as et, analystsFromRegistry as f, createScopeAnalyst as ft, EVIDENCE_MAX_CHARS as g, HarvestError as gt, worktreeFanout as h, inProcessSandboxClient as ht, jjWorkspace as i, createTangleSandboxExactProcessProvider as in, loopUntil as it, chatTransportExecutor as j, runIsolatedCheck as jt, codeModeSupervisorTools as k, declaredCheckJudge as kt, boxSurfaceReader as l, widen as lt, superviseSurface as m, observationFromRegistry as mt, makeFinding$1 as n, resolveSecretEnv as nn, fanout as nt, runInWorkspace as o, pipeline as ot, failuresAnalyst as p, registryScopeAnalyst as pt, trajectoryReport as q, SqlSpawnJournal as qt, gitWorkspace as r, secretEnvOfMcpServer as rn, flatWidenGate as rt, createWaterfallCollector as s, selectValidWinner as st, computeFindingId$1 as t, resolveMcpServerLaunch as tn, renderCorpusToInstructions as tt, fsSurfaceReader as u, assertTraceDerivedFindings as ut, VERIFY_TAIL_CHARS as v, defineLeaderboard as vt, analyzeTrace as w, superviseDispatch as wt, settledWorkerOut as x, inlineSandboxClient as xt, closingWorkerNote as y, resolveSandboxClient as yt, strategyAuthorSystemPrompt as z, renderLeaderboardMarkdown as zt };
|
|
8724
8942
|
|
|
8725
|
-
//# sourceMappingURL=runtime-
|
|
8943
|
+
//# sourceMappingURL=runtime-CXKCdGTg.js.map
|