@tangle-network/agent-runtime 0.343.4 → 0.348.1
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-C5rFWXGj.js → activation-BEGalhOL.js} +2 -2
- package/dist/{activation-C5rFWXGj.js.map → activation-BEGalhOL.js.map} +1 -1
- package/dist/{activation-NJiV0MHb.d.ts → activation-NQZP_mdI.d.ts} +2 -2
- package/dist/agent.d.ts +1 -1
- package/dist/agent.js +3 -3
- package/dist/{coordination-manager-T98ZbsEt.js → coordination-manager-Bm6leXc6.js} +22 -19
- package/dist/coordination-manager-Bm6leXc6.js.map +1 -0
- package/dist/{delegate-CjdtLf1v.js → delegate-Cp5-PsaX.js} +2 -2
- package/dist/{delegate-CjdtLf1v.js.map → delegate-Cp5-PsaX.js.map} +1 -1
- package/dist/durable.d.ts +7 -2
- package/dist/durable.js +127 -115
- package/dist/durable.js.map +1 -1
- package/dist/{graph-kgzTaNMA.js → graph-CE_pzU31.js} +5 -4
- package/dist/graph-CE_pzU31.js.map +1 -0
- package/dist/{improve-DevAd83a.js → improve-wT11zteg.js} +6 -6
- package/dist/{improve-DevAd83a.js.map → improve-wT11zteg.js.map} +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +7 -7
- package/dist/intelligence.d.ts +2 -2
- package/dist/intelligence.js +3 -3
- package/dist/kernel.d.ts +2 -2
- package/dist/kernel.js +11 -11
- package/dist/{loop-runner-D56Rpd2z.d.ts → loop-runner-CY5HHhtR.d.ts} +2 -2
- package/dist/{loop-runner-CyUoVMkv.js → loop-runner-CZzeeJTG.js} +2 -2
- package/dist/{loop-runner-CyUoVMkv.js.map → loop-runner-CZzeeJTG.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/mcp/index.js.map +1 -1
- package/dist/profiles.d.ts +1 -1
- package/dist/{provision-supervisor-CysVhSqV.js → provision-supervisor-CC0HdOHo.js} +5 -5
- package/dist/{provision-supervisor-CysVhSqV.js.map → provision-supervisor-CC0HdOHo.js.map} +1 -1
- package/dist/{durable-file-DLcrzrjL.js → record-events-D93DkpAx.js} +100 -3
- package/dist/record-events-D93DkpAx.js.map +1 -0
- package/dist/{run-cancellation-CEDiqfhC.js → run-cancellation-CzFhQGMa.js} +11 -9
- package/dist/run-cancellation-CzFhQGMa.js.map +1 -0
- package/dist/{runtime-CefFtXC2.js → runtime-B_40dXlF.js} +270 -57
- package/dist/runtime-B_40dXlF.js.map +1 -0
- package/dist/{search-executor-t05_9Wwk.js → search-executor-COd2F2wp.js} +2 -2
- package/dist/{search-executor-t05_9Wwk.js.map → search-executor-COd2F2wp.js.map} +1 -1
- package/dist/{server-DjrVWzH2.js → server-BGB4R4wQ.js} +3 -3
- package/dist/{server-DjrVWzH2.js.map → server-BGB4R4wQ.js.map} +1 -1
- package/dist/{structural-rollout-CpJknIaL.js → structural-rollout-Wl_rCuzM.js} +2 -2
- package/dist/{structural-rollout-CpJknIaL.js.map → structural-rollout-Wl_rCuzM.js.map} +1 -1
- package/dist/{supervise-BuVVC7Bl.js → supervise-BUOeThuB.js} +122 -63
- package/dist/supervise-BUOeThuB.js.map +1 -0
- package/dist/{supervisor-D3M9ab1v.js → supervisor-DDy0aEtR.js} +438 -170
- package/dist/supervisor-DDy0aEtR.js.map +1 -0
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +11 -11
- package/dist/{top-snapshot-BGYI6G6K.js → top-snapshot-CflmaDgk.js} +6 -4
- package/dist/top-snapshot-CflmaDgk.js.map +1 -0
- package/dist/tui/bin.js +2 -2
- package/dist/tui/index.d.ts +1 -1
- package/dist/tui/index.js +2 -2
- package/dist/{types-D0ZRqIJh.d.ts → types-hc4cmSc7.d.ts} +102 -13
- package/package.json +11 -11
- package/skills/agent-graphs/SKILL.md +38 -2
- package/dist/coordination-manager-T98ZbsEt.js.map +0 -1
- package/dist/durable-file-DLcrzrjL.js.map +0 -1
- package/dist/graph-kgzTaNMA.js.map +0 -1
- package/dist/run-cancellation-CEDiqfhC.js.map +0 -1
- package/dist/runtime-CefFtXC2.js.map +0 -1
- package/dist/supervise-BuVVC7Bl.js.map +0 -1
- package/dist/supervisor-D3M9ab1v.js.map +0 -1
- package/dist/top-snapshot-BGYI6G6K.js.map +0 -1
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { s as writeAtomicDurableFile } from "./record-events-D93DkpAx.js";
|
|
2
|
+
import { At as createExecutor, Ct as readCommittedJsonLines, Dt as createExecutorRegistry, Et as insideCursorNamespace, Ft as assertBoxlessPromptOptions, I as coordinationProfileToolPrefix, It as readPromptOptions, Jt as routerBrain, Li as detachedFrozen, Pr as runAbortable, Pt as runAgentRounds, Ri as detachedSnapshot, Rt as createSandboxLineage, Si as executableAgentSpecSnapshot, St as readCommittedJsonFile, Tt as withJsonlFileLock, Vt as defaultSelectWinner, W as rollingDispatch, _ as withDriverExecutor, _t as InMemorySpawnJournal, aa as notifySandboxEventObserver, b as isTraceAnalysisStore, bt as isNoEntError, dr as CheckUnavailableError, gt as InMemoryResultBlobStore, hn as createWorktreeCliExecutor, hr as verdictFromJudgeScore, mr as mapExecutorResult, n as createSupervisor, na as createSandboxTurnEventCollector, pr as gateOnDeliverable, wt as upsertCommittedJsonLine, xi as executableAgentProfileSnapshot, yt as appendCommittedJsonLine, z as settledToIteration, zi as contentAddress } from "./supervisor-DDy0aEtR.js";
|
|
3
3
|
import { i as ConfigError, m as ValidationError, n as AnalystError, s as PlannerError } from "./errors-DodWX-cb.js";
|
|
4
|
-
import { D as runAgentic, E as refine, M as renderReport, N as profileChatClient, O as sample, j as observe, k as ObservationError, v as loadAuthoredStrategy, x as strategyAuthorContract, y as requestStrategySource } from "./structural-rollout-
|
|
4
|
+
import { D as runAgentic, E as refine, M as renderReport, N as profileChatClient, O as sample, j as observe, k as ObservationError, v as loadAuthoredStrategy, x as strategyAuthorContract, y as requestStrategySource } from "./structural-rollout-Wl_rCuzM.js";
|
|
5
5
|
import { $ as isAbortError, B as sha256Bytes$1, C as WorkspaceScanLimitError, Ct as armDeadlineTimer, E as captureMaterializedWorkspace, K as chargedTokens, P as canonicalCandidateDigest$1, Q as hasCompleteCacheBreakdown, R as immutableCandidateValue, W as addSpend, X as errorMessage, Z as fnv1a32Hex, et as isAsyncIterable, ft as zeroSpend, h as markPutStreamVerified, ot as sleep, q as cloneSpend, rt as randomSuffix, st as stringifySafe, tt as mapWithConcurrency } from "./sandbox-profile-compat-_fEtHPCj.js";
|
|
6
6
|
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";
|
|
7
7
|
import { i as notifyRuntimeHookEvent } from "./runtime-hooks-tXpAarhW.js";
|
|
8
|
-
import { a as reconcileInterruptedSearchCalls, c as searchExecutor, r as dedicatedLane, x as runtimeShipDecision } from "./search-executor-
|
|
9
|
-
import { g as foldCoordinationRecords, p as createInMemoryRunContext } from "./coordination-manager-
|
|
10
|
-
import { A as runBrainLoop, S as taskShapeDigest, b as recordGraphRun, f as graphFromStored, m as graphRunsFor, p as graphRegistry, t as supervise, u as digestOfGraph, v as lookupGraph } from "./supervise-
|
|
11
|
-
import "./run-cancellation-
|
|
8
|
+
import { a as reconcileInterruptedSearchCalls, c as searchExecutor, r as dedicatedLane, x as runtimeShipDecision } from "./search-executor-COd2F2wp.js";
|
|
9
|
+
import { g as foldCoordinationRecords, p as createInMemoryRunContext } from "./coordination-manager-Bm6leXc6.js";
|
|
10
|
+
import { A as runBrainLoop, S as taskShapeDigest, b as recordGraphRun, f as graphFromStored, m as graphRunsFor, p as graphRegistry, t as supervise, u as digestOfGraph, v as lookupGraph } from "./supervise-BUOeThuB.js";
|
|
11
|
+
import "./run-cancellation-CzFhQGMa.js";
|
|
12
12
|
import { i as redactProtectedValue, r as redactProtectedReason } from "./protected-redaction-DFCeo4vg.js";
|
|
13
|
-
import "./provision-supervisor-
|
|
14
|
-
import "./delegate-
|
|
15
|
-
import "./graph-
|
|
13
|
+
import "./provision-supervisor-CC0HdOHo.js";
|
|
14
|
+
import "./delegate-Cp5-PsaX.js";
|
|
15
|
+
import "./graph-CE_pzU31.js";
|
|
16
16
|
import { agentProfileSchema, canonicalAgentProfileDigest, canonicalCandidateDigest, sha256Bytes, validateAgentProfileSecurity } from "@tangle-network/agent-interface";
|
|
17
17
|
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";
|
|
18
18
|
import { createAgentRunOutcomeTracker } from "@tangle-network/sandbox/runtime";
|
|
@@ -5645,50 +5645,204 @@ function printBenchmarkReport(report) {
|
|
|
5645
5645
|
}
|
|
5646
5646
|
}
|
|
5647
5647
|
//#endregion
|
|
5648
|
-
//#region src/runtime/s3-private-cas-
|
|
5649
|
-
const
|
|
5650
|
-
const
|
|
5651
|
-
const
|
|
5652
|
-
|
|
5653
|
-
|
|
5654
|
-
|
|
5648
|
+
//#region src/runtime/s3-private-cas-namespace.ts
|
|
5649
|
+
const NAMESPACE$1 = /^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$/u;
|
|
5650
|
+
const MAX_PAGE_BYTES = 2 * 1024 * 1024;
|
|
5651
|
+
const fingerprint = (namespace, location, storeIdentity, objects) => `sha256:${createHash("sha256").update(JSON.stringify({
|
|
5652
|
+
namespace,
|
|
5653
|
+
location,
|
|
5654
|
+
storeIdentity,
|
|
5655
|
+
objects
|
|
5656
|
+
})).digest("hex")}`;
|
|
5657
|
+
function xmlText(text) {
|
|
5658
|
+
return text.replace(/&([^;]*);/gu, (_, entity) => {
|
|
5659
|
+
const named = {
|
|
5660
|
+
amp: "&",
|
|
5661
|
+
lt: "<",
|
|
5662
|
+
gt: ">",
|
|
5663
|
+
quot: "\"",
|
|
5664
|
+
apos: "'"
|
|
5665
|
+
};
|
|
5666
|
+
if (named[entity] !== void 0) return named[entity];
|
|
5667
|
+
const numeric = /^#(?:x([0-9a-f]+)|([0-9]+))$/iu.exec(entity);
|
|
5668
|
+
if (!numeric) throw new Error("S3 private CAS list contains an unknown XML entity");
|
|
5669
|
+
const code = Number.parseInt(numeric[1] ?? numeric[2], numeric[1] ? 16 : 10);
|
|
5670
|
+
if (!Number.isSafeInteger(code) || code <= 0 || code > 1114111 || code >= 55296 && code <= 57343) throw new Error("S3 private CAS list contains an invalid XML character");
|
|
5671
|
+
return String.fromCodePoint(code);
|
|
5672
|
+
});
|
|
5673
|
+
}
|
|
5674
|
+
function field(text, name, optional = false) {
|
|
5675
|
+
const values = [...text.matchAll(new RegExp(`<${name}>([^<]*)</${name}>`, "gu"))];
|
|
5676
|
+
if (values.length !== 1) {
|
|
5677
|
+
if (optional && values.length === 0) return void 0;
|
|
5678
|
+
throw new Error(`S3 private CAS list has an invalid ${name}`);
|
|
5679
|
+
}
|
|
5680
|
+
return xmlText(values[0][1]);
|
|
5681
|
+
}
|
|
5682
|
+
async function listPage(response) {
|
|
5683
|
+
const reader = response.body?.getReader();
|
|
5684
|
+
if (!reader) throw new Error("S3 private CAS list returned no body");
|
|
5685
|
+
const chunks = [];
|
|
5686
|
+
let size = 0;
|
|
5687
|
+
try {
|
|
5688
|
+
while (true) {
|
|
5689
|
+
const { value, done } = await reader.read();
|
|
5690
|
+
if (done) break;
|
|
5691
|
+
size += value.byteLength;
|
|
5692
|
+
if (size > MAX_PAGE_BYTES) throw new Error("S3 private CAS list page exceeds its bound");
|
|
5693
|
+
chunks.push(value);
|
|
5694
|
+
}
|
|
5695
|
+
} finally {
|
|
5696
|
+
await reader.cancel().catch(() => void 0);
|
|
5697
|
+
}
|
|
5698
|
+
const text = Buffer.concat(chunks).toString("utf8");
|
|
5699
|
+
if (/<!/u.test(text) || !/^\s*(?:<\?xml[^>]*>\s*)?<ListBucketResult(?:\s[^>]*)?>[\s\S]*<\/ListBucketResult>\s*$/u.test(text)) throw new Error("S3 private CAS list returned an invalid document");
|
|
5700
|
+
if (field(text, "EncodingType") !== "url") throw new Error("S3 private CAS list did not encode keys");
|
|
5701
|
+
const truncated = field(text, "IsTruncated");
|
|
5702
|
+
if (truncated !== "true" && truncated !== "false") throw new Error("S3 private CAS list has no completion flag");
|
|
5703
|
+
const objects = [...text.matchAll(/<Contents>([\s\S]*?)<\/Contents>/gu)].map(([, row]) => {
|
|
5704
|
+
const byteLength = Number(field(row, "Size"));
|
|
5705
|
+
const key = decodeURIComponent(field(row, "Key"));
|
|
5706
|
+
const etag = field(row, "ETag");
|
|
5707
|
+
if (!Number.isSafeInteger(byteLength) || byteLength < 0 || !etag || /[\r\n]/u.test(etag)) throw new Error("S3 private CAS list has invalid object metadata");
|
|
5708
|
+
return {
|
|
5709
|
+
key,
|
|
5710
|
+
etag,
|
|
5711
|
+
byteLength
|
|
5712
|
+
};
|
|
5713
|
+
});
|
|
5714
|
+
const count = field(text, "KeyCount");
|
|
5715
|
+
if (!/^\d+$/u.test(count) || Number(count) !== objects.length) throw new Error("S3 private CAS list object count is inconsistent");
|
|
5716
|
+
const next = field(text, "NextContinuationToken", true);
|
|
5717
|
+
if (truncated === "true" && !next) throw new Error("S3 private CAS list omitted its next page");
|
|
5718
|
+
return {
|
|
5719
|
+
objects,
|
|
5720
|
+
next: truncated === "true" ? next : void 0
|
|
5721
|
+
};
|
|
5722
|
+
}
|
|
5723
|
+
/** Generic storage operation only; ownership, holds, references and writer fencing belong to its consumer. */
|
|
5724
|
+
function privateCasNamespaceOperations({ request, refusal, prefix, location, storeIdentity }) {
|
|
5725
|
+
const namespacePrefix = (namespace) => {
|
|
5726
|
+
if (!NAMESPACE$1.test(namespace)) throw new Error("S3 private CAS namespace is invalid");
|
|
5727
|
+
return `${prefix}${namespace}/`;
|
|
5728
|
+
};
|
|
5729
|
+
const validObject = (object, scope) => {
|
|
5730
|
+
if (!object.key.startsWith(scope) || object.key.length === scope.length || object.key.split("/").some((part) => !part || part === "." || part === "..")) throw new Error("S3 private CAS inventory contains a key outside its namespace");
|
|
5731
|
+
if (!Number.isSafeInteger(object.byteLength) || object.byteLength < 0 || !object.etag || /[\r\n]/u.test(object.etag)) throw new Error("S3 private CAS inventory contains invalid object metadata");
|
|
5732
|
+
};
|
|
5733
|
+
const inspectNamespace = async ({ namespace, signal }) => {
|
|
5734
|
+
const scope = namespacePrefix(namespace);
|
|
5735
|
+
const objects = [];
|
|
5736
|
+
const tokens = /* @__PURE__ */ new Set();
|
|
5737
|
+
const keys = /* @__PURE__ */ new Set();
|
|
5738
|
+
let next;
|
|
5739
|
+
do {
|
|
5740
|
+
signal?.throwIfAborted();
|
|
5741
|
+
const response = await request("GET", "", {
|
|
5742
|
+
query: {
|
|
5743
|
+
"list-type": "2",
|
|
5744
|
+
"encoding-type": "url",
|
|
5745
|
+
"max-keys": "1000",
|
|
5746
|
+
prefix: scope,
|
|
5747
|
+
...next ? { "continuation-token": next } : {}
|
|
5748
|
+
},
|
|
5749
|
+
...signal ? { signal } : {}
|
|
5750
|
+
});
|
|
5751
|
+
if (!response.ok) throw await refusal(response, "namespace list");
|
|
5752
|
+
const page = await listPage(response);
|
|
5753
|
+
for (const object of page.objects) {
|
|
5754
|
+
validObject(object, scope);
|
|
5755
|
+
if (keys.has(object.key)) throw new Error("S3 private CAS list repeated an object");
|
|
5756
|
+
keys.add(object.key);
|
|
5757
|
+
objects.push(object);
|
|
5758
|
+
}
|
|
5759
|
+
next = page.next;
|
|
5760
|
+
if (next && tokens.has(next)) throw new Error("S3 private CAS list repeated its continuation token");
|
|
5761
|
+
if (next) tokens.add(next);
|
|
5762
|
+
} while (next);
|
|
5763
|
+
objects.sort((a, b) => a.key < b.key ? -1 : a.key > b.key ? 1 : 0);
|
|
5764
|
+
return {
|
|
5765
|
+
namespace,
|
|
5766
|
+
location,
|
|
5767
|
+
storeIdentity,
|
|
5768
|
+
objects,
|
|
5769
|
+
sha256: fingerprint(namespace, location, storeIdentity, objects)
|
|
5770
|
+
};
|
|
5771
|
+
};
|
|
5772
|
+
return {
|
|
5773
|
+
inspectNamespace,
|
|
5774
|
+
async retireNamespace({ inventory, signal }) {
|
|
5775
|
+
const { namespace, objects } = inventory;
|
|
5776
|
+
const scope = namespacePrefix(namespace);
|
|
5777
|
+
if (inventory.location !== location || inventory.storeIdentity !== storeIdentity || inventory.sha256 !== fingerprint(namespace, location, storeIdentity, objects)) throw new Error("S3 private CAS retirement inventory does not match this store");
|
|
5778
|
+
const reviewed = /* @__PURE__ */ new Map();
|
|
5779
|
+
for (const object of objects) {
|
|
5780
|
+
validObject(object, scope);
|
|
5781
|
+
if (reviewed.has(object.key)) throw new Error("S3 private CAS retirement inventory repeats an object");
|
|
5782
|
+
reviewed.set(object.key, object);
|
|
5783
|
+
}
|
|
5784
|
+
const current = await inspectNamespace({
|
|
5785
|
+
namespace,
|
|
5786
|
+
...signal ? { signal } : {}
|
|
5787
|
+
});
|
|
5788
|
+
for (const object of current.objects) {
|
|
5789
|
+
const prior = reviewed.get(object.key);
|
|
5790
|
+
if (!prior || prior.etag !== object.etag || prior.byteLength !== object.byteLength) throw new Error("S3 private CAS namespace changed after its reviewed inventory");
|
|
5791
|
+
}
|
|
5792
|
+
let deletedObjects = 0;
|
|
5793
|
+
let deletedBytes = 0;
|
|
5794
|
+
for (const object of current.objects) {
|
|
5795
|
+
signal?.throwIfAborted();
|
|
5796
|
+
const check = await request("HEAD", object.key, { ...signal ? { signal } : {} });
|
|
5797
|
+
if (check.status === 404) {
|
|
5798
|
+
await check.body?.cancel();
|
|
5799
|
+
continue;
|
|
5800
|
+
}
|
|
5801
|
+
if (!check.ok) throw await refusal(check, "retirement HEAD");
|
|
5802
|
+
await check.body?.cancel();
|
|
5803
|
+
if (check.headers.get("etag") !== object.etag || check.headers.get("content-length") === null || Number(check.headers.get("content-length")) !== object.byteLength) throw new Error("S3 private CAS object changed before retirement");
|
|
5804
|
+
const response = await request("DELETE", object.key, { ...signal ? { signal } : {} });
|
|
5805
|
+
if (!response.ok) throw await refusal(response, "namespace delete");
|
|
5806
|
+
await response.body?.cancel();
|
|
5807
|
+
const absent = await request("HEAD", object.key, { ...signal ? { signal } : {} });
|
|
5808
|
+
await absent.body?.cancel();
|
|
5809
|
+
if (absent.status !== 404) throw new Error("S3 private CAS object is not confirmed absent after retirement");
|
|
5810
|
+
deletedObjects++;
|
|
5811
|
+
deletedBytes += object.byteLength;
|
|
5812
|
+
if (!Number.isSafeInteger(deletedBytes)) throw new Error("S3 private CAS retired payload bytes exceed the safe integer range");
|
|
5813
|
+
}
|
|
5814
|
+
const remaining = await inspectNamespace({
|
|
5815
|
+
namespace,
|
|
5816
|
+
...signal ? { signal } : {}
|
|
5817
|
+
});
|
|
5818
|
+
return {
|
|
5819
|
+
namespace,
|
|
5820
|
+
location,
|
|
5821
|
+
deletedObjects,
|
|
5822
|
+
deletedBytes,
|
|
5823
|
+
remainingObjects: remaining.objects.length,
|
|
5824
|
+
remainingBytes: remaining.objects.reduce((sum, object) => sum + object.byteLength, 0),
|
|
5825
|
+
complete: remaining.objects.length === 0
|
|
5826
|
+
};
|
|
5827
|
+
}
|
|
5828
|
+
};
|
|
5829
|
+
}
|
|
5830
|
+
//#endregion
|
|
5831
|
+
//#region src/runtime/s3-private-cas-request.ts
|
|
5655
5832
|
const EMPTY_PAYLOAD = createHash("sha256").update("").digest("hex");
|
|
5656
|
-
const
|
|
5657
|
-
const METADATA_DIGEST = "x-amz-meta-sha256";
|
|
5658
|
-
const hex = (value) => createHash("sha256").update(value).digest("hex");
|
|
5833
|
+
const hex$1 = (value) => createHash("sha256").update(value).digest("hex");
|
|
5659
5834
|
const hmac = (key, value) => createHmac("sha256", key).update(value).digest();
|
|
5660
5835
|
const encode = (segment) => encodeURIComponent(segment).replace(/[!'()*]/gu, (character) => `%${character.charCodeAt(0).toString(16).toUpperCase()}`);
|
|
5661
|
-
/**
|
|
5662
|
-
|
|
5663
|
-
*
|
|
5664
|
-
* Every write declares its SHA-256 as the signed payload hash, so the store refuses bytes that
|
|
5665
|
-
* do not match the digest. A write is confirmed by reading back the object's length and digest
|
|
5666
|
-
* metadata. Reads return raw bytes; the private CAS port verifies them.
|
|
5667
|
-
*/
|
|
5668
|
-
function createS3PrivateCasStore(options) {
|
|
5669
|
-
const endpoint = new URL(options.endpoint);
|
|
5670
|
-
if (endpoint.protocol !== "https:" || endpoint.username || endpoint.password || endpoint.search || endpoint.hash || endpoint.pathname !== "/" && endpoint.pathname !== "") throw new Error("S3 private CAS endpoint must be a bare https origin");
|
|
5671
|
-
if (!BUCKET.test(options.bucket)) throw new Error("S3 private CAS bucket name is invalid");
|
|
5672
|
-
const prefix = options.prefix ?? "";
|
|
5673
|
-
if (!PREFIX.test(prefix)) throw new Error("S3 private CAS prefix must be empty or end in /");
|
|
5674
|
-
if (!options.accessKeyId || !options.secretAccessKey) throw new Error("S3 private CAS needs an access key id and secret");
|
|
5836
|
+
/** The single signed transport for private CAS object, pointer and namespace operations. */
|
|
5837
|
+
function createPrivateCasS3Transport(options, endpoint) {
|
|
5675
5838
|
const region = options.region ?? "auto";
|
|
5676
5839
|
const timeoutMs = options.timeoutMs ?? 12e4;
|
|
5677
5840
|
const send = options.fetch ?? fetch;
|
|
5678
|
-
const
|
|
5679
|
-
if (!NAMESPACE.test(namespace)) throw new Error("S3 private CAS namespace is invalid");
|
|
5680
|
-
const match = DIGEST.exec(digest);
|
|
5681
|
-
if (!match) throw new Error("S3 private CAS digest must be sha256:<64 lowercase hex>");
|
|
5682
|
-
return `${prefix}${namespace}/sha256/${match[1]}`;
|
|
5683
|
-
};
|
|
5684
|
-
const pointerKey = (namespace, name) => {
|
|
5685
|
-
if (!NAMESPACE.test(namespace)) throw new Error("S3 private CAS namespace is invalid");
|
|
5686
|
-
if (!POINTER_NAME.test(name)) throw new Error("S3 private CAS pointer name is invalid");
|
|
5687
|
-
return `${prefix}${namespace}/${name}`;
|
|
5688
|
-
};
|
|
5689
|
-
const request = async (method, objectKey, { body, byteLength, payloadHash = EMPTY_PAYLOAD, headers = {}, signal } = {}) => {
|
|
5841
|
+
const request = async (method, objectKey, { body, byteLength, payloadHash = EMPTY_PAYLOAD, headers = {}, signal, query = {} } = {}) => {
|
|
5690
5842
|
const path = `/${[options.bucket, ...objectKey.split("/")].map(encode).join("/")}`;
|
|
5691
5843
|
const url = new URL(path, endpoint);
|
|
5844
|
+
const canonicalQuery = Object.entries(query).map(([name, value]) => [encode(name), encode(value)]).sort(([a, av], [b, bv]) => a < b ? -1 : a > b ? 1 : av < bv ? -1 : av > bv ? 1 : 0).map(([name, value]) => `${name}=${value}`).join("&");
|
|
5845
|
+
url.search = canonicalQuery;
|
|
5692
5846
|
const amzDate = (/* @__PURE__ */ new Date()).toISOString().replace(/[:-]|\.\d{3}/gu, "");
|
|
5693
5847
|
const day = amzDate.slice(0, 8);
|
|
5694
5848
|
const signed = {
|
|
@@ -5701,7 +5855,7 @@ function createS3PrivateCasStore(options) {
|
|
|
5701
5855
|
const canonical = [
|
|
5702
5856
|
method,
|
|
5703
5857
|
path,
|
|
5704
|
-
|
|
5858
|
+
canonicalQuery,
|
|
5705
5859
|
names.map((name) => `${name}:${signed[name].trim()}\n`).join(""),
|
|
5706
5860
|
names.join(";"),
|
|
5707
5861
|
payloadHash
|
|
@@ -5711,7 +5865,7 @@ function createS3PrivateCasStore(options) {
|
|
|
5711
5865
|
"AWS4-HMAC-SHA256",
|
|
5712
5866
|
amzDate,
|
|
5713
5867
|
scope,
|
|
5714
|
-
hex(canonical)
|
|
5868
|
+
hex$1(canonical)
|
|
5715
5869
|
].join("\n")).digest("hex");
|
|
5716
5870
|
const { host: _host, ...sent } = signed;
|
|
5717
5871
|
const deadline = AbortSignal.timeout(timeoutMs + Math.ceil((byteLength ?? (body instanceof Uint8Array ? body.byteLength : 0)) / (1024 * 1024)) * 1e3);
|
|
@@ -5741,6 +5895,59 @@ function createS3PrivateCasStore(options) {
|
|
|
5741
5895
|
detail = detail.replace(/\s+/gu, " ").slice(0, 300);
|
|
5742
5896
|
return /* @__PURE__ */ new Error(`S3 private CAS ${action} returned ${response.status}${detail ? `: ${detail}` : ""}`);
|
|
5743
5897
|
};
|
|
5898
|
+
return {
|
|
5899
|
+
request,
|
|
5900
|
+
refusal
|
|
5901
|
+
};
|
|
5902
|
+
}
|
|
5903
|
+
//#endregion
|
|
5904
|
+
//#region src/runtime/s3-private-cas-store.ts
|
|
5905
|
+
const DIGEST = /^sha256:([0-9a-f]{64})$/u;
|
|
5906
|
+
const BUCKET = /^[a-z0-9][a-z0-9.-]{1,61}[a-z0-9]$/u;
|
|
5907
|
+
const PREFIX = /^(?:[A-Za-z0-9._-]+\/)*$/u;
|
|
5908
|
+
const NAMESPACE = /^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$/u;
|
|
5909
|
+
const POINTER_NAME = /^(?!sha256\/)[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}(?:\/[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}){0,3}$/u;
|
|
5910
|
+
const POINTER_MAX_BYTES = 1024 * 1024;
|
|
5911
|
+
const CONTENT_TYPE = "application/octet-stream";
|
|
5912
|
+
const METADATA_DIGEST = "x-amz-meta-sha256";
|
|
5913
|
+
const hex = (value) => createHash("sha256").update(value).digest("hex");
|
|
5914
|
+
/**
|
|
5915
|
+
* Durable private CAS bytes in one S3-compatible bucket under `<prefix><namespace>/sha256/<hex>`.
|
|
5916
|
+
*
|
|
5917
|
+
* Every write declares its SHA-256 as the signed payload hash, so the store refuses bytes that
|
|
5918
|
+
* do not match the digest. A write is confirmed by reading back the object's length and digest
|
|
5919
|
+
* metadata. Reads return raw bytes; the private CAS port verifies them.
|
|
5920
|
+
*/
|
|
5921
|
+
function createS3PrivateCasStore(options) {
|
|
5922
|
+
const endpoint = new URL(options.endpoint);
|
|
5923
|
+
if (endpoint.protocol !== "https:" || endpoint.username || endpoint.password || endpoint.search || endpoint.hash || endpoint.pathname !== "/" && endpoint.pathname !== "") throw new Error("S3 private CAS endpoint must be a bare https origin");
|
|
5924
|
+
if (!BUCKET.test(options.bucket)) throw new Error("S3 private CAS bucket name is invalid");
|
|
5925
|
+
const prefix = options.prefix ?? "";
|
|
5926
|
+
if (!PREFIX.test(prefix)) throw new Error("S3 private CAS prefix must be empty or end in /");
|
|
5927
|
+
if (!options.accessKeyId || !options.secretAccessKey) throw new Error("S3 private CAS needs an access key id and secret");
|
|
5928
|
+
const key = (namespace, digest) => {
|
|
5929
|
+
if (!NAMESPACE.test(namespace)) throw new Error("S3 private CAS namespace is invalid");
|
|
5930
|
+
const match = DIGEST.exec(digest);
|
|
5931
|
+
if (!match) throw new Error("S3 private CAS digest must be sha256:<64 lowercase hex>");
|
|
5932
|
+
return `${prefix}${namespace}/sha256/${match[1]}`;
|
|
5933
|
+
};
|
|
5934
|
+
const pointerKey = (namespace, name) => {
|
|
5935
|
+
if (!NAMESPACE.test(namespace)) throw new Error("S3 private CAS namespace is invalid");
|
|
5936
|
+
if (!POINTER_NAME.test(name)) throw new Error("S3 private CAS pointer name is invalid");
|
|
5937
|
+
return `${prefix}${namespace}/${name}`;
|
|
5938
|
+
};
|
|
5939
|
+
const { request, refusal } = createPrivateCasS3Transport(options, endpoint);
|
|
5940
|
+
const namespaceOperations = privateCasNamespaceOperations({
|
|
5941
|
+
request,
|
|
5942
|
+
refusal,
|
|
5943
|
+
prefix,
|
|
5944
|
+
location: `s3://${options.bucket}/${prefix}`,
|
|
5945
|
+
storeIdentity: `sha256:${hex(JSON.stringify({
|
|
5946
|
+
endpoint: endpoint.origin,
|
|
5947
|
+
bucket: options.bucket,
|
|
5948
|
+
prefix
|
|
5949
|
+
}))}`
|
|
5950
|
+
});
|
|
5744
5951
|
/** Whether the bucket holds this exact object; refuses a same-key object of other bytes. */
|
|
5745
5952
|
const holds = async (objectKey, digest, byteLength, signal) => {
|
|
5746
5953
|
const response = await request("HEAD", objectKey, signal === void 0 ? {} : { signal });
|
|
@@ -5753,6 +5960,7 @@ function createS3PrivateCasStore(options) {
|
|
|
5753
5960
|
};
|
|
5754
5961
|
return {
|
|
5755
5962
|
location: `s3://${options.bucket}/${prefix}`,
|
|
5963
|
+
...namespaceOperations,
|
|
5756
5964
|
async putStream({ namespace, digest, byteLength, chunks, signal }) {
|
|
5757
5965
|
const objectKey = key(namespace, digest);
|
|
5758
5966
|
if (await holds(objectKey, digest, byteLength, signal)) return;
|
|
@@ -7145,7 +7353,7 @@ function graphDesignerExtraTools(env) {
|
|
|
7145
7353
|
})();
|
|
7146
7354
|
if (name === "designer_history") return (async () => {
|
|
7147
7355
|
const args = asRecord(raw ?? {}, "designer_history");
|
|
7148
|
-
const { listGraphRuns } = await import("./supervise-
|
|
7356
|
+
const { listGraphRuns } = await import("./supervise-BUOeThuB.js").then((n) => n.h);
|
|
7149
7357
|
const all = await listGraphRuns(registry);
|
|
7150
7358
|
return { runs: (args.taskShape === void 0 ? all : all.filter((row) => row.taskDigest === taskShapeDigest(asRecord(args.taskShape, "designer_history.taskShape")))).map(summarize) };
|
|
7151
7359
|
})();
|
|
@@ -7156,7 +7364,7 @@ function graphDesignerExtraTools(env) {
|
|
|
7156
7364
|
if (mode === "replay") {
|
|
7157
7365
|
const digest = args.graphDigest;
|
|
7158
7366
|
if (typeof digest !== "string" || digest.length === 0) throw new ValidationError("designer_run_graph: replay mode requires graphDigest from lookup");
|
|
7159
|
-
const { loadGraph } = await import("./supervise-
|
|
7367
|
+
const { loadGraph } = await import("./supervise-BUOeThuB.js").then((n) => n.h);
|
|
7160
7368
|
const stored = await loadGraph(registry, digest);
|
|
7161
7369
|
if (!stored) throw new ValidationError(`designer_run_graph: no stored graph ${digest.slice(0, 12)} — re-lookup`);
|
|
7162
7370
|
const graph = env.bindCheck(graphFromStored(stored, () => {
|
|
@@ -8898,10 +9106,14 @@ function createWaterfallCollector() {
|
|
|
8898
9106
|
if (typeof p.score === "number") span.score = p.score;
|
|
8899
9107
|
}
|
|
8900
9108
|
};
|
|
8901
|
-
const report = () => {
|
|
8902
|
-
const
|
|
9109
|
+
const report = (opts) => {
|
|
9110
|
+
const observedAtMs = opts?.nowMs ?? Date.now();
|
|
9111
|
+
const all = [...spans.values()].map((span) => ({
|
|
9112
|
+
...span,
|
|
9113
|
+
tokens: { ...span.tokens }
|
|
9114
|
+
})).sort((a, b) => a.startMs - b.startMs);
|
|
8903
9115
|
const start = all[0]?.startMs ?? 0;
|
|
8904
|
-
const end = Math.max(start, ...all.map((s) => s.endMs ?? s.startMs));
|
|
9116
|
+
const end = Math.max(start, ...all.map((s) => s.endMs ?? Math.max(s.startMs, observedAtMs)));
|
|
8905
9117
|
const byKind = {};
|
|
8906
9118
|
let totalUsd = 0;
|
|
8907
9119
|
const totalTokens = {
|
|
@@ -8927,13 +9139,14 @@ function createWaterfallCollector() {
|
|
|
8927
9139
|
byKind[kind] = k;
|
|
8928
9140
|
}
|
|
8929
9141
|
k.count += 1;
|
|
8930
|
-
k.ms += (s.endMs ?? s.startMs) - s.startMs;
|
|
9142
|
+
k.ms += (s.endMs ?? Math.max(s.startMs, observedAtMs)) - s.startMs;
|
|
8931
9143
|
k.usd += s.usd;
|
|
8932
9144
|
k.tokens.input += s.tokens.input;
|
|
8933
9145
|
k.tokens.output += s.tokens.output;
|
|
8934
9146
|
}
|
|
8935
9147
|
return {
|
|
8936
9148
|
spans: all,
|
|
9149
|
+
observedAtMs,
|
|
8937
9150
|
totalMs: end - start,
|
|
8938
9151
|
totalUsd,
|
|
8939
9152
|
totalTokens,
|
|
@@ -8941,7 +9154,7 @@ function createWaterfallCollector() {
|
|
|
8941
9154
|
};
|
|
8942
9155
|
};
|
|
8943
9156
|
const render = (opts) => {
|
|
8944
|
-
const { spans: all, totalMs, totalUsd, byKind } = report();
|
|
9157
|
+
const { spans: all, observedAtMs, totalMs, totalUsd, byKind } = report(opts);
|
|
8945
9158
|
if (all.length === 0) return "(no spans observed)";
|
|
8946
9159
|
const width = opts?.width ?? 48;
|
|
8947
9160
|
const maxRows = opts?.maxRows ?? 60;
|
|
@@ -8951,7 +9164,7 @@ function createWaterfallCollector() {
|
|
|
8951
9164
|
const labelWidth = Math.min(24, Math.max(...all.map((s) => s.label.length)) + 1);
|
|
8952
9165
|
for (const s of all.slice(0, maxRows)) {
|
|
8953
9166
|
const offset = Math.round((s.startMs - start) * scale);
|
|
8954
|
-
const dur = (s.endMs ?? s.startMs) - s.startMs;
|
|
9167
|
+
const dur = (s.endMs ?? Math.max(s.startMs, observedAtMs)) - s.startMs;
|
|
8955
9168
|
const len = Math.max(1, Math.round(dur * scale));
|
|
8956
9169
|
const bar = `${" ".repeat(Math.min(offset, width))}${(s.status === "down" ? "░" : "█").repeat(Math.max(1, Math.min(len, width - Math.min(offset, width) + 1)))}`;
|
|
8957
9170
|
const mark = s.status === "down" ? " DOWN" : s.score !== void 0 ? ` ${(s.score * 100).toFixed(0)}%` : "";
|
|
@@ -9195,4 +9408,4 @@ function tail(s) {
|
|
|
9195
9408
|
//#endregion
|
|
9196
9409
|
export { runPersonified as $, openSqlRunStore as $t, searchSpecDigest as A, secretEnvOfMcpServer as At, chatWorkerSeam as B, readDeclaredCheck as Bt, withUntrackedArtifacts as C, materializeLocalMcp as Ct, assertSearchSpec as D, mcpSecretEnvMetadataKey as Dt, SEARCH_SPEC_CORRELATION_KEY as E, envKeyProvider as Et, profileRegistry as F, assertDeclaredCheck as Ft, openSandboxRun as G, stopSentinel as Gt, runStrategyEvolution as H, completionAuthorizes as Ht, profileRunsForName as I, checkProgramDigest as It, runBenchmark as J, renderLeaderboardHtml as Jt, createS3PrivateCasStore as K, leaderboard as Kt, recordProfileRun as L, declaredCheckDeliverable as Lt, bestProfileFor as M, loopCampaignDispatch as Mt, loadProfile as N, loopDispatch as Nt, compileSearchSpec as O, resolveMcpServerLaunch as Ot, pickBestProfile as P, superviseDispatch as Pt, definePersona as Q, SqlRunOwnershipError as Qt, graphDesignerExtraTools as R, declaredCheckDigest as Rt, copyUntrackedIntoClone as S, connectStdioMcp as St, createFencedSqlRunContext as T, sanitizeMcpToolSchema as Tt, strategyTournament as U, deterministicCompletion as Ut, createChatSessionStore as V, runIsolatedCheck as Vt, SandboxRunAbortError as W, sentinelCompletion as Wt, equalKOnCost as X, renderLeaderboardSvg as Xt, createPrivateCasArtifactPort as Y, renderLeaderboardMarkdown as Yt, trajectoryReport as Z, renderPairwiseMarkdown as Zt, NOTE_MAX_CHARS as _, HarvestError as _t, localShell as a, loopUntil as at, composeWorkerEvidence as b, resolveSandboxClient as bt, createVerifierEnvironment as c, selectValidWinner as ct, harvestSurfaceDiffs as d, assertTraceDerivedFindings as dt, FileCorpus as et, analystsFromRegistry as f, buildSteerContext as ft, EVIDENCE_MAX_CHARS as g, inProcessSandboxClient as gt, runCoderChecks as h, observationFromRegistry as ht, jjWorkspace as i, flatWidenGate as it, connectRemoteSupervisor as j, inlineSandboxClient as jt, searchPresets as k, resolveSecretEnv as kt, boxSurfaceReader as l, verify as lt, worktreeFanout as m, registryScopeAnalyst as mt, makeFinding$1 as n, renderCorpusToInstructions as nt, runInWorkspace as o, panel as ot, failuresAnalyst as p, createScopeAnalyst as pt, printBenchmarkReport as q, pairwiseSignificance as qt, gitWorkspace as r, fanout as rt, createWaterfallCollector as s, pipeline as st, computeFindingId$1 as t, InMemoryCorpus as tt, fsSurfaceReader as u, widen as ut, VERIFY_TAIL_CHARS as v, harvestCorpus as vt, analyzeTrace as w, createMcpEnvironment as wt, settledWorkerOut as x, McpSpawnFault as xt, closingWorkerNote as y, defineLeaderboard as yt, chatTransportExecutor as z, declaredCheckJudge as zt };
|
|
9197
9410
|
|
|
9198
|
-
//# sourceMappingURL=runtime-
|
|
9411
|
+
//# sourceMappingURL=runtime-B_40dXlF.js.map
|