@tangle-network/agent-runtime 0.108.1 → 0.109.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/README.md +7 -6
- package/dist/{activation-DRpnplEm.js → activation-CM-L6TtL.js} +2 -2
- package/dist/{activation-DRpnplEm.js.map → activation-CM-L6TtL.js.map} +1 -1
- package/dist/agent.d.ts +2 -2
- package/dist/agent.js +2 -2
- package/dist/analyst-loop.d.ts +1 -1
- package/dist/{environment-provider-D0NXc4Qz.d.ts → environment-provider-CMqSAp-O.d.ts} +3 -2
- package/dist/environment-provider.d.ts +1 -1
- package/dist/{improvement-cycle-CRnDDdX0.js → improvement-cycle-9O4iVFOA.js} +3 -3
- package/dist/{improvement-cycle-CRnDDdX0.js.map → improvement-cycle-9O4iVFOA.js.map} +1 -1
- package/dist/{index-DQp3BPeC.d.ts → index-Bur6uUF4.d.ts} +6 -152
- package/dist/{index-cdkwHruJ.d.ts → index-Cn5TtHUG.d.ts} +3 -3
- package/dist/{index-BZbJWqoZ.d.ts → index-bXiMVrUv.d.ts} +8 -7
- package/dist/index.d.ts +8 -6
- package/dist/index.js +11 -635
- package/dist/index.js.map +1 -1
- package/dist/intelligence.d.ts +2 -2
- package/dist/intelligence.js +2 -2
- package/dist/{loops.d.ts → kernel.d.ts} +3 -3
- package/dist/{loops.js → kernel.js} +4 -4
- package/dist/{knowledge-rdrpPIXs.js → knowledge-1a38bcUT.js} +3 -3
- package/dist/{knowledge-rdrpPIXs.js.map → knowledge-1a38bcUT.js.map} +1 -1
- package/dist/knowledge.d.ts +1 -1
- package/dist/knowledge.js +1 -1
- package/dist/{loop-runner-bin-9-JlGqN7.d.ts → loop-runner-bin-CSzrWlgE.d.ts} +3 -3
- package/dist/{loop-runner-bin-B1V-XS5A.js → loop-runner-bin-V4EN9aNT.js} +3 -3
- package/dist/{loop-runner-bin-B1V-XS5A.js.map → loop-runner-bin-V4EN9aNT.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 +1 -1
- package/dist/mcp/index.d.ts +2 -2
- package/dist/mcp/index.js +4 -4
- package/dist/{openai-tools-BjQq2TTL.js → openai-tools-DT9FH2_t.js} +2 -2
- package/dist/{openai-tools-BjQq2TTL.js.map → openai-tools-DT9FH2_t.js.map} +1 -1
- package/dist/primeintellect/index.d.ts +1 -1
- package/dist/profiles.d.ts +1 -1
- package/dist/profiles.js.map +1 -1
- package/dist/{runtime-CDekUROm.js → runtime-BVMyqgct.js} +8 -7
- package/dist/{runtime-CDekUROm.js.map → runtime-BVMyqgct.js.map} +1 -1
- package/dist/runtime-hooks-C7iJOWm3.js +99 -0
- package/dist/runtime-hooks-C7iJOWm3.js.map +1 -0
- package/dist/runtime-hooks-sbRpjStq.d.ts +88 -0
- package/dist/{structural-rollout-BC81Otmc.js → structural-rollout-ASQLr4-v.js} +2 -2
- package/dist/{structural-rollout-BC81Otmc.js.map → structural-rollout-ASQLr4-v.js.map} +1 -1
- package/dist/{supervise-JfKPwIlO.js → supervise-DyPmmhJ6.js} +6 -5
- package/dist/supervise-DyPmmhJ6.js.map +1 -0
- package/dist/{supervisor-B2LzaWRb.js → supervisor-sTJC9psT.js} +3 -98
- package/dist/supervisor-sTJC9psT.js.map +1 -0
- package/dist/testing.js +8 -8
- package/dist/tool-loop.d.ts +149 -0
- package/dist/tool-loop.js +629 -0
- package/dist/tool-loop.js.map +1 -0
- package/dist/{types-BevOjfTY.d.ts → types-DnNGJ5Gz.d.ts} +3 -88
- package/package.json +21 -10
- package/dist/supervise-JfKPwIlO.js.map +0 -1
- package/dist/supervisor-B2LzaWRb.js.map +0 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { c as RuntimeRunStateError, u as ValidationError } from "./errors-DEAvWQPy.js";
|
|
2
2
|
import { f as zeroTokenUsage, t as addTokenUsage } from "./util-MVgdwuIS.js";
|
|
3
3
|
import { a as contentAddress, c as replaySpawnTree, o as materializeTreeView, s as pendingWaits } from "./spawn-journal-CwPvKUTa.js";
|
|
4
|
+
import { i as notifyRuntimeHookEvent } from "./runtime-hooks-C7iJOWm3.js";
|
|
4
5
|
import { estimateCost, isModelPriced } from "@tangle-network/agent-eval";
|
|
5
6
|
import { createHash, randomUUID } from "node:crypto";
|
|
6
7
|
import { applyWorkspacePlan, materializeProfile } from "@tangle-network/agent-profile-materialize";
|
|
@@ -1968,102 +1969,6 @@ function routerBrain(cfg, opts = {}) {
|
|
|
1968
1969
|
});
|
|
1969
1970
|
}
|
|
1970
1971
|
//#endregion
|
|
1971
|
-
//#region src/runtime-hooks.ts
|
|
1972
|
-
/** Identity helper that types a {@link RuntimeHooks} literal so the fields are inferred. */
|
|
1973
|
-
function defineRuntimeHooks(hooks) {
|
|
1974
|
-
return hooks;
|
|
1975
|
-
}
|
|
1976
|
-
/**
|
|
1977
|
-
* Merge several {@link RuntimeHooks} into one. Falsy entries are dropped (so you can
|
|
1978
|
-
* pass `flag && hooks`), and every observer's `onEvent`/`onDecisionPoint` fires for each
|
|
1979
|
-
* event. Use this to attach N observers to a loop instead of a second event bus.
|
|
1980
|
-
*/
|
|
1981
|
-
function composeRuntimeHooks(...entries) {
|
|
1982
|
-
const hooks = entries.filter((entry) => !!entry);
|
|
1983
|
-
return {
|
|
1984
|
-
onEvent: hooks.some((hook) => hook.onEvent) ? (event, context) => {
|
|
1985
|
-
const pending = [];
|
|
1986
|
-
for (const hook of hooks) {
|
|
1987
|
-
const result = hook.onEvent?.(event, context);
|
|
1988
|
-
if (isThenable(result)) pending.push(Promise.resolve(result));
|
|
1989
|
-
}
|
|
1990
|
-
if (pending.length > 0) return Promise.all(pending).then(() => void 0);
|
|
1991
|
-
} : void 0,
|
|
1992
|
-
onDecisionPoint: hooks.some((hook) => hook.onDecisionPoint) ? (point, context) => {
|
|
1993
|
-
const pending = [];
|
|
1994
|
-
for (const hook of hooks) {
|
|
1995
|
-
const result = hook.onDecisionPoint?.(point, context);
|
|
1996
|
-
if (isThenable(result)) pending.push(Promise.resolve(result));
|
|
1997
|
-
}
|
|
1998
|
-
if (pending.length > 0) return Promise.all(pending).then(() => void 0);
|
|
1999
|
-
} : void 0,
|
|
2000
|
-
onHookError: hooks.some((hook) => hook.onHookError) ? (error, context) => {
|
|
2001
|
-
const pending = [];
|
|
2002
|
-
for (const hook of hooks) {
|
|
2003
|
-
const result = hook.onHookError?.(error, context);
|
|
2004
|
-
if (isThenable(result)) pending.push(Promise.resolve(result));
|
|
2005
|
-
}
|
|
2006
|
-
if (pending.length > 0) return Promise.all(pending).then(() => void 0);
|
|
2007
|
-
} : void 0
|
|
2008
|
-
};
|
|
2009
|
-
}
|
|
2010
|
-
/** Fire `hooks.onEvent`, swallowing sync throws and surfacing async failures to `onError`. */
|
|
2011
|
-
function notifyRuntimeHookEvent(hooks, event, context = {}) {
|
|
2012
|
-
const onEvent = hooks?.onEvent;
|
|
2013
|
-
if (!onEvent) return;
|
|
2014
|
-
try {
|
|
2015
|
-
const result = onEvent(event, context);
|
|
2016
|
-
if (isThenable(result)) result.catch((error) => {
|
|
2017
|
-
notifyRuntimeHookError(hooks, toError(error), {
|
|
2018
|
-
hook: "onEvent",
|
|
2019
|
-
eventId: event.id,
|
|
2020
|
-
target: event.target,
|
|
2021
|
-
phase: event.phase
|
|
2022
|
-
});
|
|
2023
|
-
});
|
|
2024
|
-
} catch (error) {
|
|
2025
|
-
notifyRuntimeHookError(hooks, toError(error), {
|
|
2026
|
-
hook: "onEvent",
|
|
2027
|
-
eventId: event.id,
|
|
2028
|
-
target: event.target,
|
|
2029
|
-
phase: event.phase
|
|
2030
|
-
});
|
|
2031
|
-
}
|
|
2032
|
-
}
|
|
2033
|
-
/** Fire `hooks.onDecisionPoint`, swallowing sync throws and surfacing async failures to `onError`. */
|
|
2034
|
-
function notifyRuntimeDecisionPoint(hooks, point, context = {}) {
|
|
2035
|
-
const onDecisionPoint = hooks?.onDecisionPoint;
|
|
2036
|
-
if (!onDecisionPoint) return;
|
|
2037
|
-
try {
|
|
2038
|
-
const result = onDecisionPoint(point, context);
|
|
2039
|
-
if (isThenable(result)) result.catch((error) => {
|
|
2040
|
-
notifyRuntimeHookError(hooks, toError(error), {
|
|
2041
|
-
hook: "onDecisionPoint",
|
|
2042
|
-
decisionId: point.id,
|
|
2043
|
-
decisionKind: point.kind
|
|
2044
|
-
});
|
|
2045
|
-
});
|
|
2046
|
-
} catch (error) {
|
|
2047
|
-
notifyRuntimeHookError(hooks, toError(error), {
|
|
2048
|
-
hook: "onDecisionPoint",
|
|
2049
|
-
decisionId: point.id,
|
|
2050
|
-
decisionKind: point.kind
|
|
2051
|
-
});
|
|
2052
|
-
}
|
|
2053
|
-
}
|
|
2054
|
-
function notifyRuntimeHookError(hooks, error, context) {
|
|
2055
|
-
try {
|
|
2056
|
-
const result = hooks?.onHookError?.(error, context);
|
|
2057
|
-
if (isThenable(result)) result.catch(() => void 0);
|
|
2058
|
-
} catch {}
|
|
2059
|
-
}
|
|
2060
|
-
function isThenable(value) {
|
|
2061
|
-
return typeof value === "object" && value !== null && "then" in value && typeof value.then === "function";
|
|
2062
|
-
}
|
|
2063
|
-
function toError(error) {
|
|
2064
|
-
return error instanceof Error ? error : new Error(String(error));
|
|
2065
|
-
}
|
|
2066
|
-
//#endregion
|
|
2067
1972
|
//#region src/runtime/supervise/progress.ts
|
|
2068
1973
|
/** How long a worker may produce no metered activity before a `progress()` read calls it stalled.
|
|
2069
1974
|
* Deliberately generous: a coding harness routinely spends minutes inside one tool call, and a
|
|
@@ -4026,6 +3931,6 @@ function isNonEmptySpend(s) {
|
|
|
4026
3931
|
return s.iterations > 0 || s.tokens.input > 0 || s.tokens.output > 0 || s.usd > 0 || s.ms > 0;
|
|
4027
3932
|
}
|
|
4028
3933
|
//#endregion
|
|
4029
|
-
export {
|
|
3934
|
+
export { createWorktree as A, routerChatWithUsage as C, runWorktreeChecks as D, runSettledCommand as E, CodexExecutionDiagnosticError as F, harnessInvocation as M, parseCodexTokenUsage as N, runWorktreeHarness as O, runLocalHarness as P, routerChatWithTools as S, runBrainLoop as T, waitUntil as _, runFinalizer as a, readWorkerProgress as b, spendFromUsageEvents as c, settledToIteration as d, createWaitProbes as f, validateWaitSpec as g, timerAt as h, pickBestDelivered as i, removeWorktree as j, captureWorktreeDiff as k, withDriverExecutor as l, pollFor as m, bestDelivered as n, runTree as o, isWaitOutcome as p, collectDelivered as r, createBudgetPool as s, createSupervisor as t, createScope as u, DEFAULT_STALL_AFTER_MS as v, routerToolLoop as w, routerBrain as x, createActivityLog as y };
|
|
4030
3935
|
|
|
4031
|
-
//# sourceMappingURL=supervisor-
|
|
3936
|
+
//# sourceMappingURL=supervisor-sTJC9psT.js.map
|