@tangle-network/agent-runtime 0.133.2 → 0.133.4
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-ChGJ2T70.js → activation-WLt7Dmfv.js} +2 -2
- package/dist/{activation-ChGJ2T70.js.map → activation-WLt7Dmfv.js.map} +1 -1
- package/dist/agent.d.ts +1 -1
- package/dist/agent.js +2 -2
- package/dist/{authoring-CCzHzhCy.js → authoring-Da9lWfh7.js} +2 -2
- package/dist/{authoring-CCzHzhCy.js.map → authoring-Da9lWfh7.js.map} +1 -1
- package/dist/{graph-DiFPPTdk.js → graph-TkrwBJCS.js} +2 -2
- package/dist/{graph-DiFPPTdk.js.map → graph-TkrwBJCS.js.map} +1 -1
- package/dist/{improvement-cycle-d0O_nkmj.js → improvement-cycle-ClbcuXvP.js} +3 -3
- package/dist/{improvement-cycle-d0O_nkmj.js.map → improvement-cycle-ClbcuXvP.js.map} +1 -1
- package/dist/{index-BNz-BzLt.d.ts → index-C7tsPEzj.d.ts} +2 -2
- package/dist/{index-B7qKWyMV.d.ts → index-kMp8g-jT.d.ts} +125 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +7 -7
- package/dist/intelligence.js +3 -3
- package/dist/kernel.d.ts +2 -2
- package/dist/kernel.js +7 -7
- package/dist/{knowledge-CtFA0_YY.js → knowledge-CwPnD1pI.js} +3 -3
- package/dist/{knowledge-CtFA0_YY.js.map → knowledge-CwPnD1pI.js.map} +1 -1
- package/dist/knowledge.d.ts +1 -1
- package/dist/knowledge.js +1 -1
- package/dist/{loop-runner-bin-CBW9ri20.d.ts → loop-runner-bin-CC5c39zY.d.ts} +2 -2
- package/dist/{loop-runner-bin-Cak-SbgO.js → loop-runner-bin-DWQCX7cS.js} +3 -3
- package/dist/{loop-runner-bin-Cak-SbgO.js.map → loop-runner-bin-DWQCX7cS.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 +4 -4
- package/dist/{openai-tools-BeYChImD.js → openai-tools-DYZaZVDC.js} +2 -2
- package/dist/{openai-tools-BeYChImD.js.map → openai-tools-DYZaZVDC.js.map} +1 -1
- package/dist/{runtime-B6YK6v3I.js → runtime-DRr7g_2C.js} +261 -22
- package/dist/runtime-DRr7g_2C.js.map +1 -0
- package/dist/{structural-rollout-BQh7Rzoa.js → structural-rollout-BfOB1pIb.js} +9 -4
- package/dist/structural-rollout-BfOB1pIb.js.map +1 -0
- package/dist/{supervise-C_P4yxA4.js → supervise-C3yRHeDk.js} +35 -6
- package/dist/supervise-C3yRHeDk.js.map +1 -0
- package/dist/{supervisor-C5pAAPb5.js → supervisor-D8sBmGYd.js} +2 -1
- package/dist/supervisor-D8sBmGYd.js.map +1 -0
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +11 -11
- package/package.json +1 -1
- package/dist/runtime-B6YK6v3I.js.map +0 -1
- package/dist/structural-rollout-BQh7Rzoa.js.map +0 -1
- package/dist/supervise-C_P4yxA4.js.map +0 -1
- package/dist/supervisor-C5pAAPb5.js.map +0 -1
|
@@ -6,18 +6,19 @@ import { i as redactProtectedValue, r as redactProtectedReason } from "./protect
|
|
|
6
6
|
import { a as notifySandboxEventObserver, c as parseCanonicalTransportEvent, s as extractTransportEventIdentity } from "./sandbox-events-vIwmuPdl.js";
|
|
7
7
|
import { c as profileProviderModel, i as concreteModelId, s as profileModelExecutionSettings, t as assertExecutableAgentProfile } from "./model-policy-Bv1DU2fw.js";
|
|
8
8
|
import { T as executableAgentSpecSnapshot, w as executableAgentProfileSnapshot } from "./materialization-D2bdTfkK.js";
|
|
9
|
-
import { $ as defaultSelectWinner, F as createExecutorRegistry, G as createPushTraceSource, L as createWorktreeCliExecutor, P as createExecutor, T as rollingDispatch, at as runBrainLoop, et as runAgentRounds, h as settledToIteration, it as routerBrain, l as withDriverExecutor, n as createSupervisor, nt as probeSandboxCapabilities, ot as canonicalObservedModel, tt as createSandboxLineage } from "./supervisor-
|
|
9
|
+
import { $ as defaultSelectWinner, F as createExecutorRegistry, G as createPushTraceSource, L as createWorktreeCliExecutor, P as createExecutor, T as rollingDispatch, at as runBrainLoop, et as runAgentRounds, h as settledToIteration, it as routerBrain, l as withDriverExecutor, n as createSupervisor, nt as probeSandboxCapabilities, ot as canonicalObservedModel, tt as createSandboxLineage } from "./supervisor-D8sBmGYd.js";
|
|
10
10
|
import "./environment-provider-mDsjfGjY.js";
|
|
11
11
|
import { i as notifyRuntimeHookEvent } from "./runtime-hooks-C7iJOWm3.js";
|
|
12
|
-
import { C as observe, O as strategyAuthorMethod, T as profileChatClient, b as sample, v as refine, x as sampleThenRefine, y as runAgentic } from "./structural-rollout-
|
|
13
|
-
import { It as gateOnDeliverable, Lt as mapExecutorResult, n as supervise } from "./supervise-
|
|
14
|
-
import "./authoring-
|
|
15
|
-
import "./graph-
|
|
12
|
+
import { C as observe, O as strategyAuthorMethod, T as profileChatClient, b as sample, v as refine, x as sampleThenRefine, y as runAgentic } from "./structural-rollout-BfOB1pIb.js";
|
|
13
|
+
import { It as gateOnDeliverable, Lt as mapExecutorResult, n as supervise } from "./supervise-C3yRHeDk.js";
|
|
14
|
+
import "./authoring-Da9lWfh7.js";
|
|
15
|
+
import "./graph-TkrwBJCS.js";
|
|
16
16
|
import { CODING_HARNESSES, InMemoryTraceStore, OUTPUT_VALUE, benjaminiHochberg, buildTrajectory, computeFindingId as computeFindingId$1, confidenceInterval, expandProfileAxes, makeFinding as makeFinding$1, pairedBootstrap, paretoFrontier, wilcoxonSignedRank, wilson } from "@tangle-network/agent-eval";
|
|
17
17
|
import { heldoutSignificance, runProfileMatrix } from "@tangle-network/agent-eval/campaign";
|
|
18
18
|
import { AgentEnvironmentCapabilitiesSchema, AgentExactRunControlRefSchema, AgentNativeContextContinuationResultSchema, AgentRunCancellationAcknowledgementSchema, AgentRunCancellationRequestSchema, AgentTurnResultSchema, InteractionAcknowledgementSchema, InteractionResponseCommandSchema, NativeContextBoundaryProofSchema, NativeContextContinuationRequestSchema, RuntimeEventEnvelopeSchema, agentNativeContextContinuationResultMatchesRequest, agentProfileSchema, agentRunCancellationAcknowledgementMatchesRequest, agentRunCancellationRequestDigest, canonicalAgentProfileDigest, canonicalCandidateDigest, nativeContextContinuationTurnDigest, validateAgentProfileSecurity } from "@tangle-network/agent-interface";
|
|
19
|
+
import { createHash } from "node:crypto";
|
|
19
20
|
import { dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
20
|
-
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
21
|
+
import { mkdir, readFile, realpath, writeFile } from "node:fs/promises";
|
|
21
22
|
import { appendFileSync, chmodSync, constants, copyFileSync, existsSync, lstatSync, mkdirSync, mkdtempSync, readFileSync, readlinkSync, rmSync, symlinkSync, writeFileSync } from "node:fs";
|
|
22
23
|
import { execFileSync, spawn, spawnSync } from "node:child_process";
|
|
23
24
|
import { tmpdir } from "node:os";
|
|
@@ -4260,6 +4261,50 @@ function printBenchmarkReport(report) {
|
|
|
4260
4261
|
}
|
|
4261
4262
|
}
|
|
4262
4263
|
//#endregion
|
|
4264
|
+
//#region src/runtime/box-read-retry.ts
|
|
4265
|
+
/**
|
|
4266
|
+
* One bounded-retry read over a sandbox box's filesystem, shared by every caller that reads a
|
|
4267
|
+
* path the agent may have just written.
|
|
4268
|
+
*
|
|
4269
|
+
* The box data plane can transiently 404 a file that exists: the write is not yet flushed, or an
|
|
4270
|
+
* edge read lands on a stale view. A first-attempt failure is therefore not evidence of absence,
|
|
4271
|
+
* and a caller that treats it as such records a lie — "the agent produced nothing" for a
|
|
4272
|
+
* deliverable, or "the agent deleted this surface" for a mounted profile file.
|
|
4273
|
+
*
|
|
4274
|
+
* Retries wait `delayMs × attempt` (linear), so the total wait for n attempts is
|
|
4275
|
+
* `delayMs × n(n-1)/2`. Set `delayMs` to 0 to retry without waiting (tests).
|
|
4276
|
+
*/
|
|
4277
|
+
/** The diagnostic for a failed attempt. `undefined` in, `undefined` out — so a caller can pass the
|
|
4278
|
+
* "no attempt has failed yet" state through without inventing a message for it. */
|
|
4279
|
+
function boxReadErrorMessage(error) {
|
|
4280
|
+
if (error === void 0) return void 0;
|
|
4281
|
+
return error instanceof Error ? error.message : String(error);
|
|
4282
|
+
}
|
|
4283
|
+
async function readBoxPathWithRetry(read, path, options) {
|
|
4284
|
+
const attempts = Math.max(1, options.attempts);
|
|
4285
|
+
let lastError;
|
|
4286
|
+
for (let attempt = 1; attempt <= attempts; attempt += 1) {
|
|
4287
|
+
options.beforeAttempt?.(lastError);
|
|
4288
|
+
if (options.signal?.aborted) {
|
|
4289
|
+
lastError ??= /* @__PURE__ */ new Error(`readBoxPathWithRetry: aborted before reading ${JSON.stringify(path)}`);
|
|
4290
|
+
break;
|
|
4291
|
+
}
|
|
4292
|
+
try {
|
|
4293
|
+
return {
|
|
4294
|
+
succeeded: true,
|
|
4295
|
+
text: await read(path)
|
|
4296
|
+
};
|
|
4297
|
+
} catch (err) {
|
|
4298
|
+
lastError = err;
|
|
4299
|
+
if (attempt < attempts && options.delayMs > 0) await sleep(options.delayMs * attempt, options.signal);
|
|
4300
|
+
}
|
|
4301
|
+
}
|
|
4302
|
+
return {
|
|
4303
|
+
succeeded: false,
|
|
4304
|
+
error: lastError
|
|
4305
|
+
};
|
|
4306
|
+
}
|
|
4307
|
+
//#endregion
|
|
4263
4308
|
//#region src/runtime/sandbox-run.ts
|
|
4264
4309
|
/**
|
|
4265
4310
|
* Thrown when a turn is aborted/timed-out mid-settle. Carries the events drained
|
|
@@ -4358,21 +4403,16 @@ async function openSandboxRun(client, options, deliverable) {
|
|
|
4358
4403
|
events: collected
|
|
4359
4404
|
};
|
|
4360
4405
|
if (options.signal.aborted) throw new SandboxRunAbortError(collected);
|
|
4361
|
-
|
|
4362
|
-
|
|
4363
|
-
|
|
4364
|
-
|
|
4365
|
-
|
|
4366
|
-
|
|
4367
|
-
try {
|
|
4368
|
-
raw = await box.fs.read(deliverable.path);
|
|
4369
|
-
readError = void 0;
|
|
4370
|
-
break;
|
|
4371
|
-
} catch (err) {
|
|
4372
|
-
readError = err instanceof Error ? err.message : String(err);
|
|
4373
|
-
if (attempt < readAttempts - 1 && readDelayMs > 0) await sleep(readDelayMs * (attempt + 1), options.signal);
|
|
4406
|
+
const attempted = await readBoxPathWithRetry(box.fs.read.bind(box.fs), deliverable.path, {
|
|
4407
|
+
attempts: 4,
|
|
4408
|
+
delayMs: options.readRetryDelayMs ?? 1e3,
|
|
4409
|
+
signal: options.signal,
|
|
4410
|
+
beforeAttempt: (lastError) => {
|
|
4411
|
+
if (options.signal.aborted) throw new SandboxRunAbortError(collected, boxReadErrorMessage(lastError));
|
|
4374
4412
|
}
|
|
4375
|
-
}
|
|
4413
|
+
});
|
|
4414
|
+
const raw = attempted.succeeded ? attempted.text : "";
|
|
4415
|
+
const readError = attempted.succeeded ? void 0 : boxReadErrorMessage(attempted.error);
|
|
4376
4416
|
return {
|
|
4377
4417
|
out: deliverable.fromArtifact(raw, collected),
|
|
4378
4418
|
events: collected,
|
|
@@ -5938,6 +5978,205 @@ function profileMaxTokens(profile) {
|
|
|
5938
5978
|
return value;
|
|
5939
5979
|
}
|
|
5940
5980
|
//#endregion
|
|
5981
|
+
//#region src/runtime/surface-diff.ts
|
|
5982
|
+
/**
|
|
5983
|
+
*
|
|
5984
|
+
* Settle-time surface-diff harvest — the read-back dual of the mount manifest.
|
|
5985
|
+
*
|
|
5986
|
+
* `RunProvenance.mounts` records what the caller placed INTO a run's workspace before the agent saw
|
|
5987
|
+
* it (instructions, skills, memory files — the profile surfaces the substrate materialized). This
|
|
5988
|
+
* module answers the reverse question at settle: **which of those mounted surfaces did the agent
|
|
5989
|
+
* itself change while working?** Harnesses mutate their own profile-adjacent surfaces as a matter of
|
|
5990
|
+
* course — a memory file appended to, an instructions file edited, a skill rewritten — and that
|
|
5991
|
+
* self-mutation is improvement-relevant evidence: an OBSERVED, session-scoped edit that may later be
|
|
5992
|
+
* lifted into the measured proposal pipeline (`proposeAgentImprovement`), never auto-promoted.
|
|
5993
|
+
*
|
|
5994
|
+
* The harvest is harness-agnostic by construction: it compares content hashes against the mount
|
|
5995
|
+
* manifest, so it needs no harness event format, no refinement protocol, and no knowledge of WHY a
|
|
5996
|
+
* surface changed. A harness that additionally reports structured self-edit events can enrich this
|
|
5997
|
+
* signal; nothing requires it to.
|
|
5998
|
+
*
|
|
5999
|
+
* The kernel never reads workspace contents itself — the caller supplies the read seam (a box
|
|
6000
|
+
* `fs.read`, a worktree read, a test double), mirroring how `recordMount` keeps mount hashing with
|
|
6001
|
+
* the byte owner. Reads return typed outcomes; a failed read is reported as an `unreadable` diff
|
|
6002
|
+
* carrying the error, never silently dropped.
|
|
6003
|
+
*
|
|
6004
|
+
* @experimental
|
|
6005
|
+
*/
|
|
6006
|
+
const sha256Hex = (bytes) => createHash("sha256").update(bytes).digest("hex");
|
|
6007
|
+
/** Contain a reader that violates its typed-outcome contract by THROWING: the module's law is that
|
|
6008
|
+
* a failed read becomes an `unreadable` diff, so one bad path must not reject the whole harvest
|
|
6009
|
+
* and silently drop every other diff. */
|
|
6010
|
+
const readOutcome = async (read, path) => {
|
|
6011
|
+
try {
|
|
6012
|
+
return await read(path);
|
|
6013
|
+
} catch (err) {
|
|
6014
|
+
return {
|
|
6015
|
+
succeeded: false,
|
|
6016
|
+
missing: false,
|
|
6017
|
+
error: err instanceof Error ? err.message : String(err)
|
|
6018
|
+
};
|
|
6019
|
+
}
|
|
6020
|
+
};
|
|
6021
|
+
/** The collision/dedup key for a path: a leading `./` stripped, so `./AGENTS.md` (a mount
|
|
6022
|
+
* recorder's form) and `AGENTS.md` (a file-tree enumeration's form) are one surface. Absolute vs
|
|
6023
|
+
* relative cannot be reconciled here — keep those forms consistent between mounts and watches. */
|
|
6024
|
+
const pathKey = (p) => p.replace(/^\.\//, "");
|
|
6025
|
+
/**
|
|
6026
|
+
* Re-read every mounted (and watched) surface and report the ones whose settled state differs from
|
|
6027
|
+
* the manifest — modified, removed, or created. Unchanged surfaces and still-absent watched paths
|
|
6028
|
+
* produce no entry; reads run concurrently; output preserves record order, mounts before
|
|
6029
|
+
* watch-only paths. Mounts and watches sharing a path key are each collapsed to the LAST entry,
|
|
6030
|
+
* and a watched path that was also mounted compares against its mount (never reports `created`).
|
|
6031
|
+
*
|
|
6032
|
+
* The harvest takes no `AbortSignal`: it is pure fan-out over the read seam and waits on nothing
|
|
6033
|
+
* itself, so every cancellable moment belongs to the reader. Pass a signal to the reader instead
|
|
6034
|
+
* ({@link BoxSurfaceReaderOptions.signal}, or close over one in a custom {@link SurfaceReader}) —
|
|
6035
|
+
* that cuts the backoff waits, and the harvest still returns the diffs it did establish rather
|
|
6036
|
+
* than discarding settle-time evidence on a late cancellation.
|
|
6037
|
+
*/
|
|
6038
|
+
async function harvestSurfaceDiffs(options) {
|
|
6039
|
+
const byPath = /* @__PURE__ */ new Map();
|
|
6040
|
+
for (const entry of options.mounts) byPath.set(pathKey(entry.path), entry);
|
|
6041
|
+
const watchByPath = /* @__PURE__ */ new Map();
|
|
6042
|
+
for (const watched of options.watch ?? []) {
|
|
6043
|
+
if (byPath.has(pathKey(watched.path))) continue;
|
|
6044
|
+
watchByPath.set(pathKey(watched.path), watched);
|
|
6045
|
+
}
|
|
6046
|
+
const mountDiffs = await Promise.all([...byPath.values()].map(async (entry) => {
|
|
6047
|
+
const outcome = await readOutcome(options.read, entry.path);
|
|
6048
|
+
if (!outcome.succeeded) return outcome.missing ? {
|
|
6049
|
+
path: entry.path,
|
|
6050
|
+
status: "removed",
|
|
6051
|
+
mountedSha256: entry.sha256,
|
|
6052
|
+
source: entry.source
|
|
6053
|
+
} : {
|
|
6054
|
+
path: entry.path,
|
|
6055
|
+
status: "unreadable",
|
|
6056
|
+
mountedSha256: entry.sha256,
|
|
6057
|
+
source: entry.source,
|
|
6058
|
+
error: outcome.error
|
|
6059
|
+
};
|
|
6060
|
+
const settledSha256 = sha256Hex(outcome.value);
|
|
6061
|
+
if (settledSha256 === entry.sha256.toLowerCase()) return void 0;
|
|
6062
|
+
return {
|
|
6063
|
+
path: entry.path,
|
|
6064
|
+
status: "modified",
|
|
6065
|
+
mountedSha256: entry.sha256,
|
|
6066
|
+
source: entry.source,
|
|
6067
|
+
settledSha256,
|
|
6068
|
+
settledBytes: outcome.value.byteLength
|
|
6069
|
+
};
|
|
6070
|
+
}));
|
|
6071
|
+
const watchDiffs = await Promise.all([...watchByPath.values()].map(async (watched) => {
|
|
6072
|
+
const outcome = await readOutcome(options.read, watched.path);
|
|
6073
|
+
if (!outcome.succeeded) {
|
|
6074
|
+
if (outcome.missing) return void 0;
|
|
6075
|
+
return {
|
|
6076
|
+
path: watched.path,
|
|
6077
|
+
status: "unreadable",
|
|
6078
|
+
source: watched.source ?? "watched",
|
|
6079
|
+
error: outcome.error
|
|
6080
|
+
};
|
|
6081
|
+
}
|
|
6082
|
+
return {
|
|
6083
|
+
path: watched.path,
|
|
6084
|
+
status: "created",
|
|
6085
|
+
source: watched.source ?? "watched",
|
|
6086
|
+
settledSha256: sha256Hex(outcome.value),
|
|
6087
|
+
settledBytes: outcome.value.byteLength
|
|
6088
|
+
};
|
|
6089
|
+
}));
|
|
6090
|
+
return [...mountDiffs, ...watchDiffs].filter((d) => d !== void 0);
|
|
6091
|
+
}
|
|
6092
|
+
/**
|
|
6093
|
+
* A {@link SurfaceReader} over a sandbox box's filesystem — the same `box.fs.read` seam
|
|
6094
|
+
* `openSandboxRun` reads deliverables through, with the same transient-404 posture (bounded
|
|
6095
|
+
* retry). The box wire returns UTF-8 TEXT (the SDK's binary path is `download()`), which profile
|
|
6096
|
+
* surfaces are; hashes are computed over the UTF-8 encoding, and content the wire had to
|
|
6097
|
+
* lossy-decode (a U+FFFD replacement character) is reported `unreadable` rather than hashed as
|
|
6098
|
+
* mojibake. The SDK's not-found error is detected structurally (`err.name === 'NotFoundError'`)
|
|
6099
|
+
* and maps to `missing: true` — unless its `resourceType` names something other than a file/path
|
|
6100
|
+
* (the BOX or session being gone), which is a transport failure, not an absent surface.
|
|
6101
|
+
*/
|
|
6102
|
+
function boxSurfaceReader(box, options = {}) {
|
|
6103
|
+
return async (path) => {
|
|
6104
|
+
const result = await readBoxPathWithRetry(box.fs.read.bind(box.fs), path, {
|
|
6105
|
+
attempts: options.attempts ?? 3,
|
|
6106
|
+
delayMs: options.retryDelayMs ?? 250,
|
|
6107
|
+
signal: options.signal
|
|
6108
|
+
});
|
|
6109
|
+
if (result.succeeded) {
|
|
6110
|
+
if (result.text.includes("�")) return {
|
|
6111
|
+
succeeded: false,
|
|
6112
|
+
missing: false,
|
|
6113
|
+
error: `boxSurfaceReader: content at ${JSON.stringify(path)} is not valid UTF-8 text (the box text wire lossy-decoded it); binary surfaces need a byte-faithful reader`
|
|
6114
|
+
};
|
|
6115
|
+
return {
|
|
6116
|
+
succeeded: true,
|
|
6117
|
+
value: new TextEncoder().encode(result.text)
|
|
6118
|
+
};
|
|
6119
|
+
}
|
|
6120
|
+
const err = result.error;
|
|
6121
|
+
const notFound = err instanceof Error && err.name === "NotFoundError";
|
|
6122
|
+
const resourceType = err && typeof err === "object" && "resourceType" in err ? String(err.resourceType) : void 0;
|
|
6123
|
+
const transportGone = resourceType !== void 0 && /sandbox|session/i.test(resourceType);
|
|
6124
|
+
return {
|
|
6125
|
+
succeeded: false,
|
|
6126
|
+
missing: notFound && !transportGone,
|
|
6127
|
+
error: err instanceof Error ? err.message : String(err)
|
|
6128
|
+
};
|
|
6129
|
+
};
|
|
6130
|
+
}
|
|
6131
|
+
/**
|
|
6132
|
+
* A {@link SurfaceReader} over the local filesystem, for worktree/local workers. Every path —
|
|
6133
|
+
* relative or absolute — must resolve INSIDE `root`: a path that escapes it (`../`, an absolute
|
|
6134
|
+
* path elsewhere) fails as a contained non-missing outcome rather than reading outside the
|
|
6135
|
+
* worktree, so a persisted or mistyped manifest path cannot turn the harvest into an
|
|
6136
|
+
* existence/hash oracle over the host filesystem. Containment is checked twice — once on the
|
|
6137
|
+
* lexical path, then again on the symlink-resolved path, because `readFile` follows a link and a
|
|
6138
|
+
* link planted inside the root would otherwise read host bytes through a contained-looking name.
|
|
6139
|
+
* Absence maps to `missing: true`; every other failure carries the error message.
|
|
6140
|
+
*/
|
|
6141
|
+
function fsSurfaceReader(root) {
|
|
6142
|
+
const lexicalRoot = resolve(root);
|
|
6143
|
+
let resolvedRoot;
|
|
6144
|
+
const escapes = (candidate, boundary) => candidate !== boundary && !candidate.startsWith(boundary + sep);
|
|
6145
|
+
const outside = (path, boundary) => ({
|
|
6146
|
+
succeeded: false,
|
|
6147
|
+
missing: false,
|
|
6148
|
+
error: `fsSurfaceReader: path ${JSON.stringify(path)} resolves outside the reader root ${JSON.stringify(boundary)}`
|
|
6149
|
+
});
|
|
6150
|
+
return async (path) => {
|
|
6151
|
+
const target = isAbsolute(path) ? resolve(path) : resolve(lexicalRoot, path);
|
|
6152
|
+
if (escapes(target, lexicalRoot)) return outside(path, lexicalRoot);
|
|
6153
|
+
try {
|
|
6154
|
+
resolvedRoot ??= await realpath(lexicalRoot);
|
|
6155
|
+
} catch (err) {
|
|
6156
|
+
return {
|
|
6157
|
+
succeeded: false,
|
|
6158
|
+
missing: false,
|
|
6159
|
+
error: `fsSurfaceReader: reader root ${JSON.stringify(lexicalRoot)} is unreadable (${err instanceof Error ? err.message : String(err)})`
|
|
6160
|
+
};
|
|
6161
|
+
}
|
|
6162
|
+
try {
|
|
6163
|
+
const resolvedTarget = await realpath(target);
|
|
6164
|
+
if (escapes(resolvedTarget, resolvedRoot)) return outside(path, resolvedRoot);
|
|
6165
|
+
return {
|
|
6166
|
+
succeeded: true,
|
|
6167
|
+
value: new Uint8Array(await readFile(resolvedTarget))
|
|
6168
|
+
};
|
|
6169
|
+
} catch (err) {
|
|
6170
|
+
const code = err.code;
|
|
6171
|
+
return {
|
|
6172
|
+
succeeded: false,
|
|
6173
|
+
missing: code === "ENOENT" || code === "ENOTDIR",
|
|
6174
|
+
error: err instanceof Error ? err.message : String(err)
|
|
6175
|
+
};
|
|
6176
|
+
}
|
|
6177
|
+
};
|
|
6178
|
+
}
|
|
6179
|
+
//#endregion
|
|
5941
6180
|
//#region src/runtime/verifier-environment.ts
|
|
5942
6181
|
const submitTool = {
|
|
5943
6182
|
type: "function",
|
|
@@ -6351,6 +6590,6 @@ function tail(s) {
|
|
|
6351
6590
|
return s.slice(-400);
|
|
6352
6591
|
}
|
|
6353
6592
|
//#endregion
|
|
6354
|
-
export {
|
|
6593
|
+
export { InMemoryCorpus as $, pickChampion as A, renderLeaderboardSvg as At, runBenchmark as B, mcpSecretEnvMetadataKey as Bt, analyzeTrace as C, deterministicCompletion as Ct, chatWorkerSeam as D, pairwiseSignificance as Dt, chatTransportExecutor as E, leaderboard as Et, strategyAuthorContract as F, connectStdioMcp as Ft, equalKOnCost as G, recoverRetainedRun as H, resolveSecretEnv as Ht, strategyAuthorSystemPrompt as I, materializeLocalMcp as It, runPersonified as J, trajectoryReport as K, SandboxRunAbortError as L, createMcpEnvironment as Lt, selectChampion as M, auditIntent as Mt, assertStrategyContract as N, defaultAuditorInstruction as Nt, createChatSessionStore as O, renderLeaderboardHtml as Ot, authorStrategy as P, McpSpawnFault as Pt, FileCorpus as Q, openSandboxRun as R, sanitizeMcpToolSchema as Rt, withUntrackedArtifacts as S, completionAuthorizes as St, runCoderChecks as T, stopSentinel as Tt, startRetainedRun as U, secretEnvOfMcpServer as Ut, reconnectRetainedRun as V, resolveMcpServerLaunch as Vt, promotionGate as W, createShapeRegistry as X, builtinShapes as Y, registerShape as Z, VERIFY_TAIL_CHARS as _, localSandboxClient as _t, localShell as a, pipeline as at, settledWorkerOut as b, loopDispatch as bt, createVerifierEnvironment as c, widen as ct, harvestSurfaceDiffs as d, createScopeAnalyst as dt, renderCorpusToInstructions as et, failuresAnalyst as f, registryScopeAnalyst as ft, NOTE_MAX_CHARS as g, resolveSandboxClient as gt, EVIDENCE_MAX_CHARS as h, defineLeaderboard as ht, jjWorkspace as i, panel as it, runStrategyEvolution as j, renderPairwiseMarkdown as jt, discriminatingMeans as k, renderLeaderboardMarkdown as kt, boxSurfaceReader as l, assertTraceDerivedFindings as lt, worktreeFanout as m, harvestCorpus as mt, makeFinding$1 as n, flatWidenGate as nt, runInWorkspace as o, selectValidWinner as ot, superviseSurface as p, inProcessSandboxClient as pt, definePersona as q, gitWorkspace as r, loopUntil as rt, createWaterfallCollector as s, verify as st, computeFindingId$1 as t, fanout as tt, fsSurfaceReader as u, buildSteerContext as ut, closingWorkerNote as v, inlineSandboxClient as vt, patchDelivered as w, sentinelCompletion as wt, copyUntrackedIntoClone as x, superviseDispatch as xt, composeWorkerEvidence as y, loopCampaignDispatch as yt, printBenchmarkReport as z, envKeyProvider as zt };
|
|
6355
6594
|
|
|
6356
|
-
//# sourceMappingURL=runtime-
|
|
6595
|
+
//# sourceMappingURL=runtime-DRr7g_2C.js.map
|