@tangle-network/agent-runtime 0.202.0 → 0.203.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-D4oFb8Lt.js → activation-jkFJVJRN.js} +2 -2
- package/dist/{activation-D4oFb8Lt.js.map → activation-jkFJVJRN.js.map} +1 -1
- package/dist/agent.d.ts +1 -1
- package/dist/agent.js +2 -2
- package/dist/{coordination-driver-B5TLsu_f.js → coordination-driver-MJuF_LIR.js} +2 -2
- package/dist/{coordination-driver-B5TLsu_f.js.map → coordination-driver-MJuF_LIR.js.map} +1 -1
- package/dist/{delegate-B8y9EvTY.js → delegate-BdLTkmND.js} +2 -2
- package/dist/{delegate-B8y9EvTY.js.map → delegate-BdLTkmND.js.map} +1 -1
- package/dist/durable.d.ts +1 -1
- package/dist/durable.js +2 -2
- package/dist/{graph-C3WsOkdi.js → graph-DQN-oV1z.js} +3 -3
- package/dist/{graph-C3WsOkdi.js.map → graph-DQN-oV1z.js.map} +1 -1
- package/dist/{improvement-cycle-RpIiIKjM.js → improvement-cycle-BxqzXYi8.js} +76 -18
- package/dist/improvement-cycle-BxqzXYi8.js.map +1 -0
- package/dist/{index-BLaGPXGh.d.ts → index-prZR0SAw.d.ts} +60 -26
- package/dist/index.d.ts +2 -2
- package/dist/index.js +7 -7
- package/dist/intelligence.js +3 -3
- package/dist/kernel.d.ts +2 -2
- package/dist/kernel.js +9 -9
- package/dist/{loop-runner-bin-CkmHiZgU.d.ts → loop-runner-bin-CdLhMvhw.d.ts} +2 -2
- package/dist/{loop-runner-bin-CqXOUcrz.js → loop-runner-bin-CrRJTCHK.js} +3 -3
- package/dist/{loop-runner-bin-CqXOUcrz.js.map → loop-runner-bin-CrRJTCHK.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/{provision-supervisor-hc_SOkP5.js → provision-supervisor-BS4y6pVS.js} +3 -3
- package/dist/{provision-supervisor-hc_SOkP5.js.map → provision-supervisor-BS4y6pVS.js.map} +1 -1
- package/dist/{redact-B5g0jY2n.js → redact-B1SbJVu9.js} +102 -20
- package/dist/redact-B1SbJVu9.js.map +1 -0
- package/dist/{runtime-Dc-Aem9j.js → runtime-tA99kYBU.js} +103 -26
- package/dist/runtime-tA99kYBU.js.map +1 -0
- package/dist/{server-BnsMo0dR.js → server-Bd7EYaQT.js} +3 -3
- package/dist/{server-BnsMo0dR.js.map → server-Bd7EYaQT.js.map} +1 -1
- package/dist/{structural-rollout-Zbntz3jo.js → structural-rollout-FBtZzm0q.js} +88 -51
- package/dist/structural-rollout-FBtZzm0q.js.map +1 -0
- package/dist/{supervise-CskGiJMk.js → supervise-dCZg-EB8.js} +3 -3
- package/dist/{supervise-CskGiJMk.js.map → supervise-dCZg-EB8.js.map} +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +12 -12
- package/dist/tui/index.d.ts +1 -1
- package/dist/tui/index.js +1 -1
- package/package.json +10 -8
- package/dist/improvement-cycle-RpIiIKjM.js.map +0 -1
- package/dist/redact-B5g0jY2n.js.map +0 -1
- package/dist/runtime-Dc-Aem9j.js.map +0 -1
- package/dist/structural-rollout-Zbntz3jo.js.map +0 -1
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { Bt as insideCursorNamespace, C as settledToIteration, Ci as notifySandboxEventObserver, Cn as hasCompleteCacheBreakdown, Dn as sleep, En as randomSuffix, Hr as parseCommittedJsonLines, Mn as zeroSpend, On as stringifySafe, Rt as InMemoryResultBlobStore, Ur as prepareJsonlAppend, Vr as isNoEntError, Wr as writeAllBytes, Xt as contentAddress, Y as rollingDispatch, _t as createPushTraceSource, a as createSupervisor, an as createSandboxLineage, bn as chargedTokens, cn as assertBoxlessPromptOptions, di as detachedFrozen, dn as runBrainLoop, fn as canonicalObservedModelParts, in as runAgentRounds, li as executableAgentProfileSnapshot, ln as readPromptOptions, lt as createWorktreeCliExecutor, m as withDriverExecutor, nn as defaultSelectWinner, on as probeSandboxCapabilities, ot as createExecutor, qt as isTraceAnalysisStore, st as createExecutorRegistry, ui as executableAgentSpecSnapshot, un as routerBrain, wn as isAbortError, xn as cloneSpend, yn as addSpend, zt as InMemorySpawnJournal } from "./redact-
|
|
1
|
+
import { Bt as insideCursorNamespace, C as settledToIteration, Ci as notifySandboxEventObserver, Cn as hasCompleteCacheBreakdown, Dn as sleep, En as randomSuffix, Hr as parseCommittedJsonLines, Mn as zeroSpend, On as stringifySafe, Rt as InMemoryResultBlobStore, Ur as prepareJsonlAppend, Vr as isNoEntError, Wr as writeAllBytes, Xt as contentAddress, Y as rollingDispatch, _t as createPushTraceSource, a as createSupervisor, an as createSandboxLineage, bn as chargedTokens, cn as assertBoxlessPromptOptions, di as detachedFrozen, dn as runBrainLoop, fn as canonicalObservedModelParts, in as runAgentRounds, li as executableAgentProfileSnapshot, ln as readPromptOptions, lt as createWorktreeCliExecutor, m as withDriverExecutor, nn as defaultSelectWinner, on as probeSandboxCapabilities, ot as createExecutor, qt as isTraceAnalysisStore, st as createExecutorRegistry, ui as executableAgentSpecSnapshot, un as routerBrain, wn as isAbortError, xn as cloneSpend, yn as addSpend, zt as InMemorySpawnJournal } from "./redact-B1SbJVu9.js";
|
|
2
2
|
import { m as ValidationError, n as AnalystError, s as PlannerError } from "./errors-DodWX-cb.js";
|
|
3
|
-
import {
|
|
3
|
+
import { E as profileChatClient, S as ObservationError, T as renderReport, b as sample, k as strategyAuthorMethod, v as refine, w as observe, x as sampleThenRefine, y as runAgentic } from "./structural-rollout-FBtZzm0q.js";
|
|
4
4
|
import { c as profileModelExecutionSettings, i as concreteModelId, l as profileProviderModel, o as enforceTokenLimits, t as assertExecutableAgentProfile } from "./model-policy-DKDyr-fc.js";
|
|
5
5
|
import { i as notifyRuntimeHookEvent } from "./runtime-hooks-tXpAarhW.js";
|
|
6
6
|
import { f as sha256Bytes, i as redactProtectedValue, o as canonicalCandidateDigest$1, r as redactProtectedReason, u as immutableCandidateValue } from "./protected-redaction-wGo44k2K.js";
|
|
7
|
-
import { b as mapExecutorResult, n as supervise, y as gateOnDeliverable } from "./supervise-
|
|
8
|
-
import "./coordination-driver-
|
|
7
|
+
import { b as mapExecutorResult, n as supervise, y as gateOnDeliverable } from "./supervise-dCZg-EB8.js";
|
|
8
|
+
import "./coordination-driver-MJuF_LIR.js";
|
|
9
9
|
import "./run-layout-B8I_LXN-.js";
|
|
10
|
-
import "./provision-supervisor-
|
|
11
|
-
import "./delegate-
|
|
12
|
-
import "./graph-
|
|
10
|
+
import "./provision-supervisor-BS4y6pVS.js";
|
|
11
|
+
import "./delegate-BdLTkmND.js";
|
|
12
|
+
import "./graph-DQN-oV1z.js";
|
|
13
13
|
import { agentProfileSchema, canonicalAgentProfileDigest, canonicalCandidateDigest, validateAgentProfileSecurity } from "@tangle-network/agent-interface";
|
|
14
14
|
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";
|
|
15
15
|
import { createAgentRunOutcomeTracker } from "@tangle-network/sandbox/runtime";
|
|
@@ -2213,9 +2213,34 @@ function defineLeaderboard(spec) {
|
|
|
2213
2213
|
}
|
|
2214
2214
|
//#endregion
|
|
2215
2215
|
//#region src/runtime/harvest-corpus.ts
|
|
2216
|
-
/**
|
|
2216
|
+
/**
|
|
2217
|
+
* Analyze completed runs through the selected observer and retain findings in a corpus.
|
|
2218
|
+
*
|
|
2219
|
+
* Store-agnostic by design: the caller maps its trace store's rows (a
|
|
2220
|
+
* `ProductionTraceSink` ndjson, OTLP spans, RunRecords) to `ObserveInput` — task text,
|
|
2221
|
+
* final output, the event trace, terminal outcome.
|
|
2222
|
+
* The default observer reads execution evidence; an injected analysis owns its admitted sources.
|
|
2223
|
+
*
|
|
2224
|
+
* The nightly product job is then three lines:
|
|
2225
|
+
* const runs = mapSinkRowsToObserveInputs(await readSink(yesterday))
|
|
2226
|
+
* const report = await harvestCorpus({ runs, profile, executor, corpus })
|
|
2227
|
+
* log(report) // runsObserved / findings / learned / failures
|
|
2228
|
+
*
|
|
2229
|
+
* Consumers choose how retained findings inform later work and how to assess their value.
|
|
2230
|
+
*/
|
|
2231
|
+
/** The completed batch evidence remains available even when every analysis failed. */
|
|
2232
|
+
var HarvestError = class extends Error {
|
|
2233
|
+
report;
|
|
2234
|
+
constructor(report) {
|
|
2235
|
+
super(`harvestCorpus: every run failed analysis (${report.failures.length}) — first: ${report.failures[0]?.error}`);
|
|
2236
|
+
this.report = report;
|
|
2237
|
+
this.name = "HarvestError";
|
|
2238
|
+
}
|
|
2239
|
+
};
|
|
2240
|
+
/** Batch the selected observation implementation over completed runs and retain its findings. */
|
|
2217
2241
|
async function harvestCorpus(opts) {
|
|
2218
|
-
const concurrency =
|
|
2242
|
+
const concurrency = opts.concurrency ?? 4;
|
|
2243
|
+
if (!Number.isSafeInteger(concurrency) || concurrency < 1 || opts.maxRuns !== void 0 && (!Number.isSafeInteger(opts.maxRuns) || opts.maxRuns < 0)) throw new TypeError("harvest limits require positive integer concurrency and nonnegative integer maxRuns");
|
|
2219
2244
|
const report = {
|
|
2220
2245
|
runsObserved: 0,
|
|
2221
2246
|
findings: 0,
|
|
@@ -2233,26 +2258,34 @@ async function harvestCorpus(opts) {
|
|
|
2233
2258
|
let consumed = 0;
|
|
2234
2259
|
let done = false;
|
|
2235
2260
|
const next = async () => {
|
|
2236
|
-
if (done || opts.maxRuns !== void 0 && consumed >= opts.maxRuns) return null;
|
|
2237
|
-
const
|
|
2261
|
+
if (done || opts.signal?.aborted || opts.maxRuns !== void 0 && consumed >= opts.maxRuns) return null;
|
|
2262
|
+
const sequence = ++consumed;
|
|
2263
|
+
let r;
|
|
2264
|
+
try {
|
|
2265
|
+
r = await iterator.next();
|
|
2266
|
+
} catch (error) {
|
|
2267
|
+
done = true;
|
|
2268
|
+
report.failures.push({
|
|
2269
|
+
runId: `source-${sequence}`,
|
|
2270
|
+
error: `trace source: ${error instanceof Error ? error.message.slice(0, 300) : String(error)}`
|
|
2271
|
+
});
|
|
2272
|
+
return null;
|
|
2273
|
+
}
|
|
2238
2274
|
if (r.done) {
|
|
2239
2275
|
done = true;
|
|
2240
2276
|
return null;
|
|
2241
2277
|
}
|
|
2242
|
-
|
|
2243
|
-
|
|
2278
|
+
return {
|
|
2279
|
+
input: r.value,
|
|
2280
|
+
sequence
|
|
2281
|
+
};
|
|
2244
2282
|
};
|
|
2245
2283
|
const workers = Array.from({ length: concurrency }, async () => {
|
|
2246
|
-
for (let
|
|
2284
|
+
for (let run = await next(); run !== null; run = await next()) {
|
|
2285
|
+
const { input, sequence } = run;
|
|
2247
2286
|
if (opts.signal?.aborted) return;
|
|
2248
2287
|
try {
|
|
2249
|
-
const obs = await observe(input,
|
|
2250
|
-
profile: opts.profile,
|
|
2251
|
-
executor: opts.executor,
|
|
2252
|
-
corpus: opts.corpus,
|
|
2253
|
-
tags: opts.tags ?? [],
|
|
2254
|
-
...opts.signal ? { signal: opts.signal } : {}
|
|
2255
|
-
});
|
|
2288
|
+
const obs = await observe(input, opts);
|
|
2256
2289
|
report.runsObserved += 1;
|
|
2257
2290
|
report.findings += obs.findings.length;
|
|
2258
2291
|
report.learned += obs.learned.length;
|
|
@@ -2260,16 +2293,20 @@ async function harvestCorpus(opts) {
|
|
|
2260
2293
|
report.usage.output += obs.usage.output;
|
|
2261
2294
|
report.usage.known &&= obs.usage.known;
|
|
2262
2295
|
} catch (e) {
|
|
2263
|
-
report.usage.known
|
|
2296
|
+
report.usage.known &&= e instanceof ObservationError && e.usage.known;
|
|
2297
|
+
if (e instanceof ObservationError) {
|
|
2298
|
+
report.usage.input += e.usage.input;
|
|
2299
|
+
report.usage.output += e.usage.output;
|
|
2300
|
+
}
|
|
2264
2301
|
report.failures.push({
|
|
2265
|
-
runId: input.runId ?? `run-${
|
|
2302
|
+
runId: input.runId ?? `run-${sequence}`,
|
|
2266
2303
|
error: e instanceof Error ? e.message.slice(0, 300) : String(e)
|
|
2267
2304
|
});
|
|
2268
2305
|
}
|
|
2269
2306
|
}
|
|
2270
2307
|
});
|
|
2271
2308
|
await Promise.all(workers);
|
|
2272
|
-
if (report.runsObserved === 0 && report.failures.length > 0) throw new
|
|
2309
|
+
if (report.runsObserved === 0 && report.failures.length > 0) throw new HarvestError(report);
|
|
2273
2310
|
return report;
|
|
2274
2311
|
}
|
|
2275
2312
|
//#endregion
|
|
@@ -2397,6 +2434,46 @@ function inProcessSandboxClient(options) {
|
|
|
2397
2434
|
} };
|
|
2398
2435
|
}
|
|
2399
2436
|
//#endregion
|
|
2437
|
+
//#region src/runtime/observation-registry.ts
|
|
2438
|
+
/** Adapt any Eval analyst registry, including recursive engines, to observation and harvesting. */
|
|
2439
|
+
function observationFromRegistry(registry, options) {
|
|
2440
|
+
if (!["production", "search"].includes(options.proposalOrigin)) throw new TypeError("registry observation requires an explicit production or search origin");
|
|
2441
|
+
return async (input, context) => {
|
|
2442
|
+
const signals = [context.signal, options.runOptions?.signal].filter((signal) => signal !== void 0);
|
|
2443
|
+
const result = await registry.run(input.runId ?? randomUUID(), typeof options.inputs === "function" ? await options.inputs(input) : options.inputs, {
|
|
2444
|
+
...options.runOptions,
|
|
2445
|
+
...signals.length ? { signal: AbortSignal.any(signals) } : {}
|
|
2446
|
+
});
|
|
2447
|
+
const usage = {
|
|
2448
|
+
input: 0,
|
|
2449
|
+
output: 0,
|
|
2450
|
+
known: true
|
|
2451
|
+
};
|
|
2452
|
+
for (const analyst of result.per_analyst) {
|
|
2453
|
+
const receipt = analyst.usage;
|
|
2454
|
+
usage.input += receipt.tokens?.input ?? receipt.partialTokens?.input ?? 0;
|
|
2455
|
+
usage.output += receipt.tokens?.output ?? receipt.partialTokens?.output ?? 0;
|
|
2456
|
+
usage.known &&= receipt.tokens !== null && receipt.tokens.tokensKnown !== false && receipt.tokensEstimated !== true;
|
|
2457
|
+
}
|
|
2458
|
+
try {
|
|
2459
|
+
await options.record?.(result, input);
|
|
2460
|
+
const incomplete = result.per_analyst.filter((analyst) => analyst.status !== "ok");
|
|
2461
|
+
if (incomplete.length) throw new Error(incomplete.map((analyst) => `${analyst.analyst_id}: ${analyst.error?.message ?? analyst.reason ?? analyst.status}`).join("; "));
|
|
2462
|
+
const findings = result.findings.map((finding) => ({
|
|
2463
|
+
...finding,
|
|
2464
|
+
proposal_origin: options.proposalOrigin
|
|
2465
|
+
}));
|
|
2466
|
+
return {
|
|
2467
|
+
findings,
|
|
2468
|
+
report: renderReport(findings),
|
|
2469
|
+
usage
|
|
2470
|
+
};
|
|
2471
|
+
} catch (cause) {
|
|
2472
|
+
throw new ObservationError(cause instanceof Error ? cause.message : String(cause), usage, { cause });
|
|
2473
|
+
}
|
|
2474
|
+
};
|
|
2475
|
+
}
|
|
2476
|
+
//#endregion
|
|
2400
2477
|
//#region src/runtime/personify/analyst.ts
|
|
2401
2478
|
/**
|
|
2402
2479
|
* The diagnosis a combinator steers from must be TRACE-derived, never JUDGE-derived. A finding
|
|
@@ -6837,6 +6914,6 @@ function tail(s) {
|
|
|
6837
6914
|
return s.slice(-400);
|
|
6838
6915
|
}
|
|
6839
6916
|
//#endregion
|
|
6840
|
-
export { InMemoryCorpus as $, chatWorkerSeam as A,
|
|
6917
|
+
export { InMemoryCorpus as $, chatWorkerSeam as A, renderLeaderboardHtml as At, SandboxRunAbortError as B, sanitizeMcpToolSchema as Bt, withUntrackedArtifacts as C, superviseDispatch as Ct, codeModeSupervisorTools as D, stopSentinel as Dt, runCoderChecks as E, sentinelCompletion as Et, selectChampion as F, defaultAuditorInstruction as Ft, equalKOnCost as G, secretEnvOfMcpServer as Gt, printBenchmarkReport as H, mcpSecretEnvMetadataKey as Ht, assertStrategyContract as I, McpSpawnFault as It, runPersonified as J, trajectoryReport as K, createTangleSandboxExactProcessProvider as Kt, authorStrategy as L, connectStdioMcp as Lt, discriminatingMeans as M, renderLeaderboardSvg as Mt, pickChampion as N, renderPairwiseMarkdown as Nt, unsafeInProcessRunner as O, leaderboard as Ot, runStrategyEvolution as P, auditIntent as Pt, FileCorpus as Q, strategyAuthorContract as R, materializeLocalMcp as Rt, copyUntrackedIntoClone as S, loopDispatch as St, patchDelivered as T, deterministicCompletion as Tt, runBenchmark as U, resolveMcpServerLaunch as Ut, openSandboxRun as V, envKeyProvider as Vt, promotionGate as W, resolveSecretEnv as Wt, createShapeRegistry as X, builtinShapes as Y, registerShape as Z, NOTE_MAX_CHARS as _, defineLeaderboard as _t, localShell as a, pipeline as at, composeWorkerEvidence as b, inlineSandboxClient as bt, createVerifierEnvironment as c, widen as ct, harvestSurfaceDiffs as d, createScopeAnalyst as dt, renderCorpusToInstructions as et, analystsFromRegistry as f, registryScopeAnalyst as ft, EVIDENCE_MAX_CHARS as g, harvestCorpus as gt, worktreeFanout as h, HarvestError as ht, jjWorkspace as i, panel as it, createChatSessionStore as j, renderLeaderboardMarkdown as jt, chatTransportExecutor as k, pairwiseSignificance as kt, boxSurfaceReader as l, assertTraceDerivedFindings as lt, superviseSurface as m, inProcessSandboxClient as mt, makeFinding$1 as n, flatWidenGate as nt, runInWorkspace as o, selectValidWinner as ot, failuresAnalyst as p, observationFromRegistry 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, VERIFY_TAIL_CHARS as v, resolveSandboxClient as vt, analyzeTrace as w, completionAuthorizes as wt, settledWorkerOut as x, loopCampaignDispatch as xt, closingWorkerNote as y, localSandboxClient as yt, strategyAuthorSystemPrompt as z, createMcpEnvironment as zt };
|
|
6841
6918
|
|
|
6842
|
-
//# sourceMappingURL=runtime-
|
|
6919
|
+
//# sourceMappingURL=runtime-tA99kYBU.js.map
|