@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
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
//#region src/runtime-hooks.ts
|
|
2
|
+
/** Identity helper that types a {@link RuntimeHooks} literal so the fields are inferred. */
|
|
3
|
+
function defineRuntimeHooks(hooks) {
|
|
4
|
+
return hooks;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Merge several {@link RuntimeHooks} into one. Falsy entries are dropped (so you can
|
|
8
|
+
* pass `flag && hooks`), and every observer's `onEvent`/`onDecisionPoint` fires for each
|
|
9
|
+
* event. Use this to attach N observers to a loop instead of a second event bus.
|
|
10
|
+
*/
|
|
11
|
+
function composeRuntimeHooks(...entries) {
|
|
12
|
+
const hooks = entries.filter((entry) => !!entry);
|
|
13
|
+
return {
|
|
14
|
+
onEvent: hooks.some((hook) => hook.onEvent) ? (event, context) => {
|
|
15
|
+
const pending = [];
|
|
16
|
+
for (const hook of hooks) {
|
|
17
|
+
const result = hook.onEvent?.(event, context);
|
|
18
|
+
if (isThenable(result)) pending.push(Promise.resolve(result));
|
|
19
|
+
}
|
|
20
|
+
if (pending.length > 0) return Promise.all(pending).then(() => void 0);
|
|
21
|
+
} : void 0,
|
|
22
|
+
onDecisionPoint: hooks.some((hook) => hook.onDecisionPoint) ? (point, context) => {
|
|
23
|
+
const pending = [];
|
|
24
|
+
for (const hook of hooks) {
|
|
25
|
+
const result = hook.onDecisionPoint?.(point, context);
|
|
26
|
+
if (isThenable(result)) pending.push(Promise.resolve(result));
|
|
27
|
+
}
|
|
28
|
+
if (pending.length > 0) return Promise.all(pending).then(() => void 0);
|
|
29
|
+
} : void 0,
|
|
30
|
+
onHookError: hooks.some((hook) => hook.onHookError) ? (error, context) => {
|
|
31
|
+
const pending = [];
|
|
32
|
+
for (const hook of hooks) {
|
|
33
|
+
const result = hook.onHookError?.(error, context);
|
|
34
|
+
if (isThenable(result)) pending.push(Promise.resolve(result));
|
|
35
|
+
}
|
|
36
|
+
if (pending.length > 0) return Promise.all(pending).then(() => void 0);
|
|
37
|
+
} : void 0
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
/** Fire `hooks.onEvent`, swallowing sync throws and surfacing async failures to `onError`. */
|
|
41
|
+
function notifyRuntimeHookEvent(hooks, event, context = {}) {
|
|
42
|
+
const onEvent = hooks?.onEvent;
|
|
43
|
+
if (!onEvent) return;
|
|
44
|
+
try {
|
|
45
|
+
const result = onEvent(event, context);
|
|
46
|
+
if (isThenable(result)) result.catch((error) => {
|
|
47
|
+
notifyRuntimeHookError(hooks, toError(error), {
|
|
48
|
+
hook: "onEvent",
|
|
49
|
+
eventId: event.id,
|
|
50
|
+
target: event.target,
|
|
51
|
+
phase: event.phase
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
} catch (error) {
|
|
55
|
+
notifyRuntimeHookError(hooks, toError(error), {
|
|
56
|
+
hook: "onEvent",
|
|
57
|
+
eventId: event.id,
|
|
58
|
+
target: event.target,
|
|
59
|
+
phase: event.phase
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
/** Fire `hooks.onDecisionPoint`, swallowing sync throws and surfacing async failures to `onError`. */
|
|
64
|
+
function notifyRuntimeDecisionPoint(hooks, point, context = {}) {
|
|
65
|
+
const onDecisionPoint = hooks?.onDecisionPoint;
|
|
66
|
+
if (!onDecisionPoint) return;
|
|
67
|
+
try {
|
|
68
|
+
const result = onDecisionPoint(point, context);
|
|
69
|
+
if (isThenable(result)) result.catch((error) => {
|
|
70
|
+
notifyRuntimeHookError(hooks, toError(error), {
|
|
71
|
+
hook: "onDecisionPoint",
|
|
72
|
+
decisionId: point.id,
|
|
73
|
+
decisionKind: point.kind
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
} catch (error) {
|
|
77
|
+
notifyRuntimeHookError(hooks, toError(error), {
|
|
78
|
+
hook: "onDecisionPoint",
|
|
79
|
+
decisionId: point.id,
|
|
80
|
+
decisionKind: point.kind
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
function notifyRuntimeHookError(hooks, error, context) {
|
|
85
|
+
try {
|
|
86
|
+
const result = hooks?.onHookError?.(error, context);
|
|
87
|
+
if (isThenable(result)) result.catch(() => void 0);
|
|
88
|
+
} catch {}
|
|
89
|
+
}
|
|
90
|
+
function isThenable(value) {
|
|
91
|
+
return typeof value === "object" && value !== null && "then" in value && typeof value.then === "function";
|
|
92
|
+
}
|
|
93
|
+
function toError(error) {
|
|
94
|
+
return error instanceof Error ? error : new Error(String(error));
|
|
95
|
+
}
|
|
96
|
+
//#endregion
|
|
97
|
+
export { notifyRuntimeHookEvent as i, defineRuntimeHooks as n, notifyRuntimeDecisionPoint as r, composeRuntimeHooks as t };
|
|
98
|
+
|
|
99
|
+
//# sourceMappingURL=runtime-hooks-C7iJOWm3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-hooks-C7iJOWm3.js","names":[],"sources":["../src/runtime-hooks.ts"],"sourcesContent":["/**\n *\n * Runtime hook contracts. Hooks are execution-scoped observers, not part of an\n * `AgentProfile`: profiles stay portable agent recipes; hooks attach to the\n * loop or product harness that is running the profile.\n *\n * @experimental\n */\n\nexport type RuntimeHookPhase = 'before' | 'after' | 'error' | 'event'\n\nexport type RuntimeHookTarget =\n | 'agent.run'\n | 'agent.turn'\n | 'agent.tool_call'\n | 'agent.spawn'\n | 'agent.child'\n | 'agent.plan'\n | 'agent.decision'\n | (string & {})\n\nexport type RuntimeDecisionKind =\n | 'continue'\n | 'verify'\n | 'ask'\n | 'retry'\n | 'stop'\n | 'memory-write'\n | 'memory-read'\n | 'tool-select'\n | 'skill-select'\n | 'workflow-select'\n | 'surface-promote'\n | (string & {})\n\nexport interface RuntimeHookEvent<Payload = unknown> {\n id: string\n runId: string\n scenarioId?: string\n target: RuntimeHookTarget\n phase: RuntimeHookPhase\n timestamp: number\n stepIndex?: number\n parentId?: string\n payload?: Payload\n metadata?: Record<string, unknown>\n}\n\nexport interface RuntimeHookContext {\n signal?: AbortSignal\n}\n\nexport interface RuntimeDecisionEvidenceRef {\n source: string\n id: string\n detail?: string\n metadata?: Record<string, unknown>\n}\n\nexport interface RuntimeDecisionPoint {\n id: string\n runId: string\n scenarioId?: string\n stepIndex: number\n kind: RuntimeDecisionKind\n candidateActions: string[]\n context?: string\n evidence: RuntimeDecisionEvidenceRef[]\n metadata?: Record<string, unknown>\n}\n\nexport interface RuntimeHookErrorContext {\n hook: 'onEvent' | 'onDecisionPoint'\n eventId?: string\n target?: RuntimeHookTarget\n phase?: RuntimeHookPhase\n decisionId?: string\n decisionKind?: RuntimeDecisionKind\n}\n\n/**\n * The observation seam attached to a running loop (never to the portable genome).\n * Implement the optional hooks to receive lifecycle events, semantic decision points,\n * and hook errors. Author with {@link defineRuntimeHooks} for inference, and attach N\n * observers at once with {@link composeRuntimeHooks} — there is ONE event stream, not a\n * callback-prop zoo.\n */\nexport interface RuntimeHooks {\n /**\n * General before/after/event hook. Use this for telemetry, memory capture,\n * policy wrapping, child lifecycle observers, or product-specific extension\n * points.\n */\n onEvent?: (event: RuntimeHookEvent, context: RuntimeHookContext) => void | Promise<void>\n /**\n * Semantic decision hook. Belief-state evaluation consumes this, but runtime\n * code should keep emitting ordinary lifecycle events as the base layer.\n */\n onDecisionPoint?: (\n point: RuntimeDecisionPoint,\n context: RuntimeHookContext,\n ) => void | Promise<void>\n onHookError?: (error: Error, context: RuntimeHookErrorContext) => void | Promise<void>\n}\n\n/** Identity helper that types a {@link RuntimeHooks} literal so the fields are inferred. */\nexport function defineRuntimeHooks(hooks: RuntimeHooks): RuntimeHooks {\n return hooks\n}\n\n/**\n * Merge several {@link RuntimeHooks} into one. Falsy entries are dropped (so you can\n * pass `flag && hooks`), and every observer's `onEvent`/`onDecisionPoint` fires for each\n * event. Use this to attach N observers to a loop instead of a second event bus.\n */\nexport function composeRuntimeHooks(\n ...entries: Array<RuntimeHooks | undefined | null | false>\n): RuntimeHooks {\n const hooks = entries.filter((entry): entry is RuntimeHooks => !!entry)\n return {\n onEvent: hooks.some((hook) => hook.onEvent)\n ? (event, context) => {\n const pending: Promise<unknown>[] = []\n for (const hook of hooks) {\n const result = hook.onEvent?.(event, context)\n if (isThenable(result)) pending.push(Promise.resolve(result))\n }\n if (pending.length > 0) return Promise.all(pending).then(() => undefined)\n return undefined\n }\n : undefined,\n onDecisionPoint: hooks.some((hook) => hook.onDecisionPoint)\n ? (point, context) => {\n const pending: Promise<unknown>[] = []\n for (const hook of hooks) {\n const result = hook.onDecisionPoint?.(point, context)\n if (isThenable(result)) pending.push(Promise.resolve(result))\n }\n if (pending.length > 0) return Promise.all(pending).then(() => undefined)\n return undefined\n }\n : undefined,\n onHookError: hooks.some((hook) => hook.onHookError)\n ? (error, context) => {\n const pending: Promise<unknown>[] = []\n for (const hook of hooks) {\n const result = hook.onHookError?.(error, context)\n if (isThenable(result)) pending.push(Promise.resolve(result))\n }\n if (pending.length > 0) return Promise.all(pending).then(() => undefined)\n return undefined\n }\n : undefined,\n }\n}\n\n/** Fire `hooks.onEvent`, swallowing sync throws and surfacing async failures to `onError`. */\nexport function notifyRuntimeHookEvent(\n hooks: RuntimeHooks | undefined,\n event: RuntimeHookEvent,\n context: RuntimeHookContext = {},\n): void {\n const onEvent = hooks?.onEvent\n if (!onEvent) return\n\n try {\n const result = onEvent(event, context)\n if (isThenable(result)) {\n void result.catch((error) => {\n notifyRuntimeHookError(hooks, toError(error), {\n hook: 'onEvent',\n eventId: event.id,\n target: event.target,\n phase: event.phase,\n })\n })\n }\n } catch (error) {\n notifyRuntimeHookError(hooks, toError(error), {\n hook: 'onEvent',\n eventId: event.id,\n target: event.target,\n phase: event.phase,\n })\n }\n}\n\n/** Fire `hooks.onDecisionPoint`, swallowing sync throws and surfacing async failures to `onError`. */\nexport function notifyRuntimeDecisionPoint(\n hooks: RuntimeHooks | undefined,\n point: RuntimeDecisionPoint,\n context: RuntimeHookContext = {},\n): void {\n const onDecisionPoint = hooks?.onDecisionPoint\n if (!onDecisionPoint) return\n\n try {\n const result = onDecisionPoint(point, context)\n if (isThenable(result)) {\n void result.catch((error) => {\n notifyRuntimeHookError(hooks, toError(error), {\n hook: 'onDecisionPoint',\n decisionId: point.id,\n decisionKind: point.kind,\n })\n })\n }\n } catch (error) {\n notifyRuntimeHookError(hooks, toError(error), {\n hook: 'onDecisionPoint',\n decisionId: point.id,\n decisionKind: point.kind,\n })\n }\n}\n\nfunction notifyRuntimeHookError(\n hooks: RuntimeHooks | undefined,\n error: Error,\n context: RuntimeHookErrorContext,\n): void {\n try {\n const result = hooks?.onHookError?.(error, context)\n if (isThenable(result)) void result.catch(() => undefined)\n } catch {\n // Hook errors must never become agent-loop errors.\n }\n}\n\nfunction isThenable(value: unknown): value is PromiseLike<unknown> {\n return (\n typeof value === 'object' &&\n value !== null &&\n 'then' in value &&\n typeof (value as { then?: unknown }).then === 'function'\n )\n}\n\nfunction toError(error: unknown): Error {\n return error instanceof Error ? error : new Error(String(error))\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
//#region src/runtime-hooks.d.ts
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* Runtime hook contracts. Hooks are execution-scoped observers, not part of an
|
|
5
|
+
* `AgentProfile`: profiles stay portable agent recipes; hooks attach to the
|
|
6
|
+
* loop or product harness that is running the profile.
|
|
7
|
+
*
|
|
8
|
+
* @experimental
|
|
9
|
+
*/
|
|
10
|
+
type RuntimeHookPhase = 'before' | 'after' | 'error' | 'event';
|
|
11
|
+
type RuntimeHookTarget = 'agent.run' | 'agent.turn' | 'agent.tool_call' | 'agent.spawn' | 'agent.child' | 'agent.plan' | 'agent.decision' | (string & {});
|
|
12
|
+
type RuntimeDecisionKind = 'continue' | 'verify' | 'ask' | 'retry' | 'stop' | 'memory-write' | 'memory-read' | 'tool-select' | 'skill-select' | 'workflow-select' | 'surface-promote' | (string & {});
|
|
13
|
+
interface RuntimeHookEvent<Payload = unknown> {
|
|
14
|
+
id: string;
|
|
15
|
+
runId: string;
|
|
16
|
+
scenarioId?: string;
|
|
17
|
+
target: RuntimeHookTarget;
|
|
18
|
+
phase: RuntimeHookPhase;
|
|
19
|
+
timestamp: number;
|
|
20
|
+
stepIndex?: number;
|
|
21
|
+
parentId?: string;
|
|
22
|
+
payload?: Payload;
|
|
23
|
+
metadata?: Record<string, unknown>;
|
|
24
|
+
}
|
|
25
|
+
interface RuntimeHookContext {
|
|
26
|
+
signal?: AbortSignal;
|
|
27
|
+
}
|
|
28
|
+
interface RuntimeDecisionEvidenceRef {
|
|
29
|
+
source: string;
|
|
30
|
+
id: string;
|
|
31
|
+
detail?: string;
|
|
32
|
+
metadata?: Record<string, unknown>;
|
|
33
|
+
}
|
|
34
|
+
interface RuntimeDecisionPoint {
|
|
35
|
+
id: string;
|
|
36
|
+
runId: string;
|
|
37
|
+
scenarioId?: string;
|
|
38
|
+
stepIndex: number;
|
|
39
|
+
kind: RuntimeDecisionKind;
|
|
40
|
+
candidateActions: string[];
|
|
41
|
+
context?: string;
|
|
42
|
+
evidence: RuntimeDecisionEvidenceRef[];
|
|
43
|
+
metadata?: Record<string, unknown>;
|
|
44
|
+
}
|
|
45
|
+
interface RuntimeHookErrorContext {
|
|
46
|
+
hook: 'onEvent' | 'onDecisionPoint';
|
|
47
|
+
eventId?: string;
|
|
48
|
+
target?: RuntimeHookTarget;
|
|
49
|
+
phase?: RuntimeHookPhase;
|
|
50
|
+
decisionId?: string;
|
|
51
|
+
decisionKind?: RuntimeDecisionKind;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* The observation seam attached to a running loop (never to the portable genome).
|
|
55
|
+
* Implement the optional hooks to receive lifecycle events, semantic decision points,
|
|
56
|
+
* and hook errors. Author with {@link defineRuntimeHooks} for inference, and attach N
|
|
57
|
+
* observers at once with {@link composeRuntimeHooks} — there is ONE event stream, not a
|
|
58
|
+
* callback-prop zoo.
|
|
59
|
+
*/
|
|
60
|
+
interface RuntimeHooks {
|
|
61
|
+
/**
|
|
62
|
+
* General before/after/event hook. Use this for telemetry, memory capture,
|
|
63
|
+
* policy wrapping, child lifecycle observers, or product-specific extension
|
|
64
|
+
* points.
|
|
65
|
+
*/
|
|
66
|
+
onEvent?: (event: RuntimeHookEvent, context: RuntimeHookContext) => void | Promise<void>;
|
|
67
|
+
/**
|
|
68
|
+
* Semantic decision hook. Belief-state evaluation consumes this, but runtime
|
|
69
|
+
* code should keep emitting ordinary lifecycle events as the base layer.
|
|
70
|
+
*/
|
|
71
|
+
onDecisionPoint?: (point: RuntimeDecisionPoint, context: RuntimeHookContext) => void | Promise<void>;
|
|
72
|
+
onHookError?: (error: Error, context: RuntimeHookErrorContext) => void | Promise<void>;
|
|
73
|
+
}
|
|
74
|
+
/** Identity helper that types a {@link RuntimeHooks} literal so the fields are inferred. */
|
|
75
|
+
declare function defineRuntimeHooks(hooks: RuntimeHooks): RuntimeHooks;
|
|
76
|
+
/**
|
|
77
|
+
* Merge several {@link RuntimeHooks} into one. Falsy entries are dropped (so you can
|
|
78
|
+
* pass `flag && hooks`), and every observer's `onEvent`/`onDecisionPoint` fires for each
|
|
79
|
+
* event. Use this to attach N observers to a loop instead of a second event bus.
|
|
80
|
+
*/
|
|
81
|
+
declare function composeRuntimeHooks(...entries: Array<RuntimeHooks | undefined | null | false>): RuntimeHooks;
|
|
82
|
+
/** Fire `hooks.onEvent`, swallowing sync throws and surfacing async failures to `onError`. */
|
|
83
|
+
declare function notifyRuntimeHookEvent(hooks: RuntimeHooks | undefined, event: RuntimeHookEvent, context?: RuntimeHookContext): void;
|
|
84
|
+
/** Fire `hooks.onDecisionPoint`, swallowing sync throws and surfacing async failures to `onError`. */
|
|
85
|
+
declare function notifyRuntimeDecisionPoint(hooks: RuntimeHooks | undefined, point: RuntimeDecisionPoint, context?: RuntimeHookContext): void;
|
|
86
|
+
//#endregion
|
|
87
|
+
export { RuntimeHookErrorContext as a, RuntimeHookTarget as c, defineRuntimeHooks as d, notifyRuntimeDecisionPoint as f, RuntimeHookContext as i, RuntimeHooks as l, RuntimeDecisionKind as n, RuntimeHookEvent as o, notifyRuntimeHookEvent as p, RuntimeDecisionPoint as r, RuntimeHookPhase as s, RuntimeDecisionEvidenceRef as t, composeRuntimeHooks as u };
|
|
88
|
+
//# sourceMappingURL=runtime-hooks-sbRpjStq.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as InMemorySpawnJournal, r as InMemoryResultBlobStore } from "./spawn-journal-CwPvKUTa.js";
|
|
2
|
-
import {
|
|
2
|
+
import { l as withDriverExecutor, t as createSupervisor, w as routerToolLoop } from "./supervisor-sTJC9psT.js";
|
|
3
3
|
import { createChatClient, estimateCost, isModelPriced, makeProposalFinding } from "@tangle-network/agent-eval";
|
|
4
4
|
import { randomBytes } from "node:crypto";
|
|
5
5
|
import { assertProposalFindings } from "@tangle-network/agent-eval/analyst";
|
|
@@ -1443,4 +1443,4 @@ function structuralRollout(config = {}) {
|
|
|
1443
1443
|
//#endregion
|
|
1444
1444
|
export { observe as C, researchDriverNote as D, optimizerMethod as E, strategyAuthorMethod as O, defaultAnalystInstruction as S, buildDriverSystem as T, depthStrategy as _, defaultStructuralRolloutPolicy as a, sample as b, officialChecksFromMeta as c, selectBestIndex as d, structuralRollout as f, defineStrategy as g, breadthStrategy as h, defaultExtractCandidate as i, resolveEntrySymbol as l, adaptiveRefine as m, compareCheckOutcomes as n, filterAuthoredAsserts as o, visibleCheckScore as p, composeCheckSources as r, modelAuthoredChecks as s, canDisplace as t, sandboxCheckRunner as u, refine as v, renderReport as w, sampleThenRefine as x, runAgentic as y };
|
|
1445
1445
|
|
|
1446
|
-
//# sourceMappingURL=structural-rollout-
|
|
1446
|
+
//# sourceMappingURL=structural-rollout-ASQLr4-v.js.map
|