@burtson-labs/agent-core 1.6.37 → 1.6.39

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.
@@ -0,0 +1,4 @@
1
+ export * from './types';
2
+ export * from './scheduler';
3
+ export * from './loopNode';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/graph/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC"}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./types"), exports);
18
+ __exportStar(require("./scheduler"), exports);
19
+ __exportStar(require("./loopNode"), exports);
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/graph/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,8CAA4B;AAC5B,6CAA2B"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Phase 2 plumbing: run one ToolUseLoop turn as a graph node — the loop is
3
+ * wrapped, never rewritten. Each execution builds a FRESH loop + conversation;
4
+ * cross-node context flows explicitly through upstream outputs folded into the
5
+ * node's prompt (no shared hidden state between nodes, which is what makes a
6
+ * graph inspectable and retryable per-node later).
7
+ */
8
+ import { type ToolUseLoopOptions } from '../tools/tool-use-loop';
9
+ import type { ChatFn, ToolExecutionContext } from '../tools/tool-types';
10
+ import type { ToolRegistry } from '../tools/tool-registry';
11
+ import type { NodeExecutor, NodeRunContext } from './types';
12
+ export interface LoopNodeDeps {
13
+ registry: ToolRegistry;
14
+ ctx: ToolExecutionContext;
15
+ /** ChatFn shared by every execution of this node. Provide exactly one of
16
+ * `chat` / `chatFactory`. */
17
+ chat?: ChatFn;
18
+ /** Builds a fresh ChatFn per node execution (per-node provider/model). */
19
+ chatFactory?: () => ChatFn | Promise<ChatFn>;
20
+ systemPrompt?: string;
21
+ /** Forwarded into the loop (beforeToolExecute gate, emitEvent, budgets…).
22
+ * The graph run's AbortSignal is injected automatically. */
23
+ loopOptions?: ToolUseLoopOptions;
24
+ }
25
+ /**
26
+ * Build the node's prompt. Default folds each upstream node's summary/output
27
+ * under a heading so the model sees exactly what earlier nodes produced.
28
+ */
29
+ export type NodePromptBuilder = (ctx: NodeRunContext) => string;
30
+ export declare function defaultNodePrompt(base: string): NodePromptBuilder;
31
+ /** Wrap one loop run as a NodeExecutor. */
32
+ export declare function wrapLoopAsNode(deps: LoopNodeDeps, buildPrompt: NodePromptBuilder): NodeExecutor;
33
+ //# sourceMappingURL=loopNode.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loopNode.d.ts","sourceRoot":"","sources":["../../src/graph/loopNode.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAqB,KAAK,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACpF,OAAO,KAAK,EAAE,MAAM,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AACxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE5D,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,YAAY,CAAC;IACvB,GAAG,EAAE,oBAAoB,CAAC;IAC1B;kCAC8B;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,0EAA0E;IAC1E,WAAW,CAAC,EAAE,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC7C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;iEAC6D;IAC7D,WAAW,CAAC,EAAE,kBAAkB,CAAC;CAClC;AAED;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,GAAG,EAAE,cAAc,KAAK,MAAM,CAAC;AAEhE,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,iBAAiB,CAWjE;AAED,2CAA2C;AAC3C,wBAAgB,cAAc,CAAC,IAAI,EAAE,YAAY,EAAE,WAAW,EAAE,iBAAiB,GAAG,YAAY,CAmB/F"}
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.defaultNodePrompt = defaultNodePrompt;
4
+ exports.wrapLoopAsNode = wrapLoopAsNode;
5
+ /**
6
+ * Phase 2 plumbing: run one ToolUseLoop turn as a graph node — the loop is
7
+ * wrapped, never rewritten. Each execution builds a FRESH loop + conversation;
8
+ * cross-node context flows explicitly through upstream outputs folded into the
9
+ * node's prompt (no shared hidden state between nodes, which is what makes a
10
+ * graph inspectable and retryable per-node later).
11
+ */
12
+ const tool_use_loop_1 = require("../tools/tool-use-loop");
13
+ function defaultNodePrompt(base) {
14
+ return (ctx) => {
15
+ const upstreamIds = Object.keys(ctx.upstream);
16
+ if (upstreamIds.length === 0)
17
+ return base;
18
+ const sections = upstreamIds.map((id) => {
19
+ const r = ctx.upstream[id];
20
+ const body = r.summary ?? (typeof r.output === 'string' ? r.output : JSON.stringify(r.output ?? ''));
21
+ return `### Result of "${id}"\n${(body ?? '').toString().slice(0, 4000)}`;
22
+ });
23
+ return `${base}\n\n## Upstream results\n\n${sections.join('\n\n')}`;
24
+ };
25
+ }
26
+ /** Wrap one loop run as a NodeExecutor. */
27
+ function wrapLoopAsNode(deps, buildPrompt) {
28
+ if (!deps.chat && !deps.chatFactory) {
29
+ throw new Error('wrapLoopAsNode: provide chat or chatFactory');
30
+ }
31
+ return async (nodeCtx) => {
32
+ const chat = deps.chatFactory ? await deps.chatFactory() : deps.chat;
33
+ const loop = (0, tool_use_loop_1.createToolUseLoop)(deps.registry, deps.ctx, {
34
+ ...(deps.loopOptions ?? {}),
35
+ signal: nodeCtx.signal,
36
+ });
37
+ const result = await loop.run(buildPrompt(nodeCtx), chat, deps.systemPrompt);
38
+ if (result.cancelled) {
39
+ throw new Error('node cancelled');
40
+ }
41
+ return {
42
+ output: result.finalResponse,
43
+ summary: result.finalResponse.slice(0, 200),
44
+ };
45
+ };
46
+ }
47
+ //# sourceMappingURL=loopNode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loopNode.js","sourceRoot":"","sources":["../../src/graph/loopNode.ts"],"names":[],"mappings":";;AAgCA,8CAWC;AAGD,wCAmBC;AAjED;;;;;;GAMG;AACH,0DAAoF;AAyBpF,SAAgB,iBAAiB,CAAC,IAAY;IAC5C,OAAO,CAAC,GAAG,EAAE,EAAE;QACb,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAC9C,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,IAAI,CAAC;QAC1C,MAAM,QAAQ,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE;YACtC,MAAM,CAAC,GAAG,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;YAC3B,MAAM,IAAI,GAAG,CAAC,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,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AC,aAAa;YAC5B,OAAO,EAAE,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC;SAC5C,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Graph scheduler — deterministic host code that runs a validated DAG.
3
+ * (Phase 4's conservative core, shipped with Phase 1 so the types are provably
4
+ * runnable; budgets/checkpoints layer on later without changing this surface.)
5
+ *
6
+ * Semantics:
7
+ * - A node runs once ALL of its dependencies are 'done'.
8
+ * - `maxConcurrency` caps simultaneously-running nodes. Default 2 — the
9
+ * plan's "safe default concurrency": enough to prove parallel lift, small
10
+ * enough that filesystem/tool contention stays rare. Callers raise it
11
+ * deliberately.
12
+ * - Failure is contained, not contagious across branches: when a node fails,
13
+ * its transitive dependents are 'skipped'; independent branches keep
14
+ * running to completion. Overall status is then 'failed'.
15
+ * - Cancellation (opts.signal) stops launching new nodes; already-running
16
+ * executors receive the same signal and are awaited; never-started nodes
17
+ * end 'cancelled'. Overall status 'cancelled' (a cancelled run never
18
+ * reports 'failed' — the user stopped it, it didn't break).
19
+ * - Events mirror the tool loop's (type, payload) convention so hosts fold
20
+ * graph progress into the SAME stream that already carries tool_loop:*
21
+ * (Phase 7): graph:start, graph:node_start, graph:node_done,
22
+ * graph:node_failed, graph:node_skipped, graph:node_cancelled, graph:done.
23
+ */
24
+ import { type GraphRunResult, type GraphSpec, type NodeExecutor } from './types';
25
+ export interface RunGraphOptions {
26
+ /** Cap on simultaneously running nodes. Default 2 (conservative). */
27
+ maxConcurrency?: number;
28
+ /** Abort the whole run. */
29
+ signal?: AbortSignal;
30
+ /** Progress events — same shape as the tool loop's emitEvent. */
31
+ emitEvent?: (type: string, payload?: unknown) => void;
32
+ }
33
+ /** Executors per node id, or one executor shared by every node. */
34
+ export type GraphExecutors = NodeExecutor | Record<string, NodeExecutor>;
35
+ export declare function runGraph(spec: GraphSpec, executors: GraphExecutors, opts?: RunGraphOptions): Promise<GraphRunResult>;
36
+ //# sourceMappingURL=scheduler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scheduler.d.ts","sourceRoot":"","sources":["../../src/graph/scheduler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,SAAS,EACd,KAAK,YAAY,EAElB,MAAM,SAAS,CAAC;AAEjB,MAAM,WAAW,eAAe;IAC9B,qEAAqE;IACrE,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,2BAA2B;IAC3B,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,iEAAiE;IACjE,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;CACvD;AAED,mEAAmE;AACnE,MAAM,MAAM,cAAc,GAAG,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;AAEzE,wBAAsB,QAAQ,CAC5B,IAAI,EAAE,SAAS,EACf,SAAS,EAAE,cAAc,EACzB,IAAI,GAAE,eAAoB,GACzB,OAAO,CAAC,cAAc,CAAC,CA8IzB"}
@@ -0,0 +1,166 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.runGraph = runGraph;
4
+ /**
5
+ * Graph scheduler — deterministic host code that runs a validated DAG.
6
+ * (Phase 4's conservative core, shipped with Phase 1 so the types are provably
7
+ * runnable; budgets/checkpoints layer on later without changing this surface.)
8
+ *
9
+ * Semantics:
10
+ * - A node runs once ALL of its dependencies are 'done'.
11
+ * - `maxConcurrency` caps simultaneously-running nodes. Default 2 — the
12
+ * plan's "safe default concurrency": enough to prove parallel lift, small
13
+ * enough that filesystem/tool contention stays rare. Callers raise it
14
+ * deliberately.
15
+ * - Failure is contained, not contagious across branches: when a node fails,
16
+ * its transitive dependents are 'skipped'; independent branches keep
17
+ * running to completion. Overall status is then 'failed'.
18
+ * - Cancellation (opts.signal) stops launching new nodes; already-running
19
+ * executors receive the same signal and are awaited; never-started nodes
20
+ * end 'cancelled'. Overall status 'cancelled' (a cancelled run never
21
+ * reports 'failed' — the user stopped it, it didn't break).
22
+ * - Events mirror the tool loop's (type, payload) convention so hosts fold
23
+ * graph progress into the SAME stream that already carries tool_loop:*
24
+ * (Phase 7): graph:start, graph:node_start, graph:node_done,
25
+ * graph:node_failed, graph:node_skipped, graph:node_cancelled, graph:done.
26
+ */
27
+ const types_1 = require("./types");
28
+ async function runGraph(spec, executors, opts = {}) {
29
+ const startedAt = Date.now();
30
+ const validation = (0, types_1.validateGraph)(spec);
31
+ if (!validation.ok) {
32
+ throw new Error(`invalid graph: ${validation.errors.join('; ')}`);
33
+ }
34
+ const maxConcurrency = Math.max(1, opts.maxConcurrency ?? 2);
35
+ const emit = opts.emitEvent ?? (() => undefined);
36
+ const signal = opts.signal;
37
+ const executorFor = (id) => {
38
+ if (typeof executors === 'function')
39
+ return executors;
40
+ const fn = executors[id];
41
+ if (!fn)
42
+ throw new Error(`no executor for node: ${id}`);
43
+ return fn;
44
+ };
45
+ // Resolve every executor up front so a missing one fails the run BEFORE any
46
+ // node starts, not halfway through.
47
+ for (const node of spec.nodes)
48
+ executorFor(node.id);
49
+ const results = {};
50
+ for (const node of spec.nodes) {
51
+ results[node.id] = { id: node.id, state: 'pending' };
52
+ }
53
+ const dependents = new Map();
54
+ for (const node of spec.nodes) {
55
+ for (const dep of node.dependsOn ?? []) {
56
+ const list = dependents.get(dep) ?? [];
57
+ list.push(node.id);
58
+ dependents.set(dep, list);
59
+ }
60
+ }
61
+ const deps = new Map(spec.nodes.map((n) => [n.id, n.dependsOn ?? []]));
62
+ const labelOf = new Map(spec.nodes.map((n) => [n.id, n.label ?? n.id]));
63
+ const running = new Map();
64
+ let anyFailed = false;
65
+ const readyToRun = (id) => results[id].state === 'pending' &&
66
+ (deps.get(id) ?? []).every((d) => results[d].state === 'done');
67
+ /** A dependency failed or was skipped/cancelled → this node can never run. */
68
+ const blocked = (id) => results[id].state === 'pending' &&
69
+ (deps.get(id) ?? []).some((d) => {
70
+ const s = results[d].state;
71
+ return s === 'failed' || s === 'skipped' || s === 'cancelled';
72
+ });
73
+ const markSkippedCascade = () => {
74
+ // Iterate to a fixed point: skipping a node can block its own dependents.
75
+ let changed = true;
76
+ while (changed) {
77
+ changed = false;
78
+ for (const node of spec.nodes) {
79
+ if (blocked(node.id)) {
80
+ results[node.id] = { ...results[node.id], state: 'skipped' };
81
+ emit('graph:node_skipped', { id: node.id, label: labelOf.get(node.id) });
82
+ changed = true;
83
+ }
84
+ }
85
+ }
86
+ };
87
+ const launch = (id) => {
88
+ const record = results[id];
89
+ record.state = 'running';
90
+ record.startedAt = Date.now();
91
+ emit('graph:node_start', { id, label: labelOf.get(id) });
92
+ const upstream = {};
93
+ for (const d of deps.get(id) ?? [])
94
+ upstream[d] = results[d];
95
+ const promise = (async () => {
96
+ try {
97
+ const outcome = await executorFor(id)({
98
+ nodeId: id,
99
+ signal: signal ?? new AbortController().signal,
100
+ upstream,
101
+ });
102
+ record.state = 'done';
103
+ record.output = outcome?.output;
104
+ record.summary = outcome?.summary;
105
+ emit('graph:node_done', { id, label: labelOf.get(id), summary: record.summary });
106
+ }
107
+ catch (err) {
108
+ record.state = 'failed';
109
+ record.error = err instanceof Error ? err.message : String(err);
110
+ anyFailed = true;
111
+ emit('graph:node_failed', { id, label: labelOf.get(id), error: record.error });
112
+ }
113
+ finally {
114
+ record.endedAt = Date.now();
115
+ record.durationMs = record.endedAt - (record.startedAt ?? record.endedAt);
116
+ running.delete(id);
117
+ }
118
+ })();
119
+ running.set(id, promise);
120
+ };
121
+ emit('graph:start', { nodes: spec.nodes.length, maxConcurrency });
122
+ // Main pump: launch every ready node up to the cap, wait for one running
123
+ // node to settle, repeat. Skip-cascade runs each pass so a failure releases
124
+ // its blocked subtree immediately (as 'skipped', not stuck 'pending').
125
+ for (;;) {
126
+ markSkippedCascade();
127
+ if (!signal?.aborted) {
128
+ for (const node of spec.nodes) {
129
+ if (running.size >= maxConcurrency)
130
+ break;
131
+ if (readyToRun(node.id))
132
+ launch(node.id);
133
+ }
134
+ }
135
+ if (running.size === 0)
136
+ break;
137
+ await Promise.race(running.values());
138
+ }
139
+ // Anything still pending at the end: cancelled (signal aborted before it
140
+ // could start) — by construction nothing else can remain pending.
141
+ for (const node of spec.nodes) {
142
+ if (results[node.id].state === 'pending') {
143
+ results[node.id] = { ...results[node.id], state: 'cancelled' };
144
+ emit('graph:node_cancelled', { id: node.id, label: labelOf.get(node.id) });
145
+ }
146
+ }
147
+ const status = signal?.aborted
148
+ ? 'cancelled'
149
+ : anyFailed
150
+ ? 'failed'
151
+ : 'completed';
152
+ const result = {
153
+ status,
154
+ nodes: results,
155
+ durationMs: Date.now() - startedAt,
156
+ };
157
+ emit('graph:done', {
158
+ status,
159
+ durationMs: result.durationMs,
160
+ done: Object.values(results).filter((r) => r.state === 'done').length,
161
+ failed: Object.values(results).filter((r) => r.state === 'failed').length,
162
+ skipped: Object.values(results).filter((r) => r.state === 'skipped').length,
163
+ });
164
+ return result;
165
+ }
166
+ //# sourceMappingURL=scheduler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scheduler.js","sourceRoot":"","sources":["../../src/graph/scheduler.ts"],"names":[],"mappings":";;AA2CA,4BAkJC;AA7LD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,mCAMiB;AAcV,KAAK,UAAU,QAAQ,CAC5B,IAAe,EACf,SAAyB,EACzB,OAAwB,EAAE;IAE1B,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAC7B,MAAM,UAAU,GAAG,IAAA,qBAAa,EAAC,IAAI,CAAC,CAAC;IACvC,IAAI,CAAC,UAAU,CAAC,EAAE,EAAE,CAAC;QACnB,MAAM,IAAI,KAAK,CAAC,kBAAkB,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACpE,CAA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C,CAAC,QAAQ;YACV,CAAC,CAAC,WAAW,CAAC;IAClB,MAAM,MAAM,GAAmB;QAC7B,MAAM;QACN,KAAK,EAAE,OAAO;QACd,UAAU,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS;KACnC,CAAC;IACF,IAAI,CAAC,YAAY,EAAE;QACjB,MAAM;QACN,UAAU,EAAE,MAAM,CAAC,UAAU;QAC7B,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,MAAM,CAAC,CAAC,MAAM;QACrE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,MAAM;QACzE,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,MAAM;KAC5E,CAAC,CAAC;IACH,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,79 @@
1
+ /**
2
+ * Graph runtime — types. (Phase 1 of the graph plan.)
3
+ *
4
+ * A run is a DAG of nodes; each node's executor runs only after every node it
5
+ * depends on has finished. The existing ToolUseLoop is NOT rewritten — a node
6
+ * executor typically wraps one loop run (see loopNode.ts), so a graph is
7
+ * "several of today's turns with explicit dependencies" rather than a new
8
+ * agent architecture. Nothing in the framework consumes this module yet; hosts
9
+ * opt in explicitly (that's the feature flag — zero behavior change until a
10
+ * host wires it).
11
+ *
12
+ * Design rules:
13
+ * - The planner (model) may eventually PROPOSE a GraphSpec, but it never owns
14
+ * scheduling. The scheduler is deterministic host code.
15
+ * - Node states form a strict machine:
16
+ * pending → running → done | failed
17
+ * pending → skipped (an upstream dependency failed or was skipped)
18
+ * pending → cancelled (the run's signal aborted before it started)
19
+ * Terminal states never transition again.
20
+ */
21
+ /** One node in the DAG. */
22
+ export interface GraphNodeSpec {
23
+ /** Unique id within the graph. */
24
+ id: string;
25
+ /** Ids of nodes that must complete (state 'done') before this one runs. */
26
+ dependsOn?: string[];
27
+ /** Human label for UIs; falls back to id. */
28
+ label?: string;
29
+ }
30
+ export interface GraphSpec {
31
+ nodes: GraphNodeSpec[];
32
+ }
33
+ export type NodeState = 'pending' | 'running' | 'done' | 'failed' | 'skipped' | 'cancelled';
34
+ /** What an executor returns on success. `output` is handed to downstream
35
+ * executors verbatim; `summary` is a short human line for UIs/events. */
36
+ export interface NodeOutcome {
37
+ output?: unknown;
38
+ summary?: string;
39
+ }
40
+ /** Terminal record for one node after a run. */
41
+ export interface NodeResult {
42
+ id: string;
43
+ state: NodeState;
44
+ output?: unknown;
45
+ summary?: string;
46
+ /** Set when state === 'failed'. */
47
+ error?: string;
48
+ startedAt?: number;
49
+ endedAt?: number;
50
+ durationMs?: number;
51
+ }
52
+ export type GraphRunStatus = 'completed' | 'failed' | 'cancelled';
53
+ export interface GraphRunResult {
54
+ status: GraphRunStatus;
55
+ /** Terminal result per node id — every node in the spec appears. */
56
+ nodes: Record<string, NodeResult>;
57
+ durationMs: number;
58
+ }
59
+ /** Context handed to a node's executor when it runs. */
60
+ export interface NodeRunContext {
61
+ nodeId: string;
62
+ /** Abort signal for the whole graph run — executors must respect it. */
63
+ signal: AbortSignal;
64
+ /** Terminal results of this node's direct dependencies (all state 'done'). */
65
+ upstream: Record<string, NodeResult>;
66
+ }
67
+ export type NodeExecutor = (ctx: NodeRunContext) => Promise<NodeOutcome> | NodeOutcome;
68
+ export interface GraphValidation {
69
+ ok: boolean;
70
+ errors: string[];
71
+ }
72
+ /**
73
+ * Structural validation: duplicate ids, unknown/self dependencies, cycles.
74
+ * Kahn's algorithm for cycle detection — if a topological pass can't consume
75
+ * every node, whatever remains is (part of) a cycle and gets named in the
76
+ * error so the author can see it.
77
+ */
78
+ export declare function validateGraph(spec: GraphSpec): GraphValidation;
79
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/graph/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,2BAA2B;AAC3B,MAAM,WAAW,aAAa;IAC5B,kCAAkC;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,2EAA2E;IAC3E,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,6CAA6C;IAC7C,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,aAAa,EAAE,CAAC;CACxB;AAED,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,MAAM,GAAG,QAAQ,GAAG,SAAS,GAAG,WAAW,CAAC;AAE5F;0EAC0E;AAC1E,MAAM,WAAW,WAAW;IAC1B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,gDAAgD;AAChD,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,SAAS,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,mCAAmC;IACnC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,MAAM,cAAc,GAAG,WAAW,GAAG,QAAQ,GAAG,WAAW,CAAC;AAElE,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,cAAc,CAAC;IACvB,oEAAoE;IACpE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IAClC,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,wDAAwD;AACxD,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,wEAAwE;IACxE,MAAM,EAAE,WAAW,CAAC;IACpB,8EAA8E;IAC9E,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;CACtC;AAED,MAAM,MAAM,YAAY,GAAG,CAAC,GAAG,EAAE,cAAc,KAAK,OAAO,CAAC,WAAW,CAAC,GAAG,WAAW,CAAC;AAEvF,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,OAAO,CAAC;IACZ,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,SAAS,GAAG,eAAe,CA2C9D"}
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+ /**
3
+ * Graph runtime — types. (Phase 1 of the graph plan.)
4
+ *
5
+ * A run is a DAG of nodes; each node's executor runs only after every node it
6
+ * depends on has finished. The existing ToolUseLoop is NOT rewritten — a node
7
+ * executor typically wraps one loop run (see loopNode.ts), so a graph is
8
+ * "several of today's turns with explicit dependencies" rather than a new
9
+ * agent architecture. Nothing in the framework consumes this module yet; hosts
10
+ * opt in explicitly (that's the feature flag — zero behavior change until a
11
+ * host wires it).
12
+ *
13
+ * Design rules:
14
+ * - The planner (model) may eventually PROPOSE a GraphSpec, but it never owns
15
+ * scheduling. The scheduler is deterministic host code.
16
+ * - Node states form a strict machine:
17
+ * pending → running → done | failed
18
+ * pending → skipped (an upstream dependency failed or was skipped)
19
+ * pending → cancelled (the run's signal aborted before it started)
20
+ * Terminal states never transition again.
21
+ */
22
+ Object.defineProperty(exports, "__esModule", { value: true });
23
+ exports.validateGraph = validateGraph;
24
+ /**
25
+ * Structural validation: duplicate ids, unknown/self dependencies, cycles.
26
+ * Kahn's algorithm for cycle detection — if a topological pass can't consume
27
+ * every node, whatever remains is (part of) a cycle and gets named in the
28
+ * error so the author can see it.
29
+ */
30
+ function validateGraph(spec) {
31
+ const errors = [];
32
+ const ids = new Set();
33
+ for (const node of spec.nodes) {
34
+ if (!node.id || node.id.trim().length === 0)
35
+ errors.push('node with empty id');
36
+ else if (ids.has(node.id))
37
+ errors.push(`duplicate node id: ${node.id}`);
38
+ else
39
+ ids.add(node.id);
40
+ }
41
+ for (const node of spec.nodes) {
42
+ for (const dep of node.dependsOn ?? []) {
43
+ if (dep === node.id)
44
+ errors.push(`node ${node.id} depends on itself`);
45
+ else if (!ids.has(dep))
46
+ errors.push(`node ${node.id} depends on unknown node: ${dep}`);
47
+ }
48
+ }
49
+ if (errors.length === 0) {
50
+ // Kahn: repeatedly remove nodes with no unconsumed deps.
51
+ const indegree = new Map();
52
+ const dependents = new Map();
53
+ for (const node of spec.nodes) {
54
+ indegree.set(node.id, (node.dependsOn ?? []).length);
55
+ for (const dep of node.dependsOn ?? []) {
56
+ const list = dependents.get(dep) ?? [];
57
+ list.push(node.id);
58
+ dependents.set(dep, list);
59
+ }
60
+ }
61
+ const queue = spec.nodes.filter((n) => (indegree.get(n.id) ?? 0) === 0).map((n) => n.id);
62
+ let consumed = 0;
63
+ while (queue.length > 0) {
64
+ const id = queue.shift();
65
+ consumed += 1;
66
+ for (const next of dependents.get(id) ?? []) {
67
+ const left = (indegree.get(next) ?? 1) - 1;
68
+ indegree.set(next, left);
69
+ if (left === 0)
70
+ queue.push(next);
71
+ }
72
+ }
73
+ if (consumed !== spec.nodes.length) {
74
+ const cyclic = spec.nodes.filter((n) => (indegree.get(n.id) ?? 0) > 0).map((n) => n.id);
75
+ errors.push(`cycle detected involving: ${cyclic.join(', ')}`);
76
+ }
77
+ }
78
+ return { ok: errors.length === 0, errors };
79
+ }
80
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/graph/types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;AAqEH,sCA2CC;AAjDD;;;;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,MAAM,EAAE,CAAC;YACnC,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;YACxF,MAAM,CAAC,IAAI,CAAC,6BAA6B,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAChE,CAAC;IACH,CAAC;IACD,OAAO,EAAE,EAAE,EAAE,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;AAC7C,CAAC"}
package/dist/index.d.ts CHANGED
@@ -12,6 +12,7 @@ export interface CreateAgentRuntimeOptions extends Partial<Omit<AgentRuntimeOpti
12
12
  }
13
13
  export declare const createAgentRuntime: (options?: CreateAgentRuntimeOptions) => AgentRuntime;
14
14
  export * from './tools';
15
+ export * from './graph';
15
16
  export * from './mcp';
16
17
  export { redactSecrets, redactSecretsString, BUILTIN_SECRET_PATTERNS, type SecretPattern, type RedactionResult } from './security/secretPatterns';
17
18
  export { TelemetryExporter, resolveTelemetryConfig, TTFT_BUCKETS, DURATION_BUCKETS, type TelemetryConfig } from './telemetry/otlpExporter';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEtD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAElE,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAElD,OAAO,EACL,c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C;AAE5C,OAAO,EACL,YAAY,EACZ,mBAAmB,EACnB,cAAc,EACd,WAAW,EACX,WAAW,EACX,cAAc,EACd,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EACnB,MAAM,wBAAwB,CAAC;AAEhC,MAAM,WAAW,yBAA0B,SAAQ,OAAO,CAAC,IAAI,CAAC,mBAAmB,EAAE,UAAU,CAAC,CAAC;IAC/F,QAAQ,CAAC,EAAE,cAAc,CAAC;CAC3B;AAED,eAAO,MAAM,kBAAkB,GAAI,UAAS,yBAA8B,KAAG,YAO5E,CAAC;AAGF,cAAc,SAAS,CAAC;AAGxB,cAAc,SAAS,CAAC;AAKxB,cAAc,OAAO,CAAC;AAKtB,OAAO,EACL,aAAa,EACb,mBAAmB,EACnB,uBAAuB,EACvB,KAAK,aAAa,EAClB,KAAK,eAAe,EACrB,MAAM,2BAA2B,CAAC;AAInC,OAAO,EACL,iBAAiB,EACjB,sBAAsB,EACtB,YAAY,EACZ,gBAAgB,EAChB,KAAK,eAAe,EACrB,MAAM,0BAA0B,CAAC"}
package/dist/index.js CHANGED
@@ -38,6 +38,9 @@ const createAgentRuntime = (options = {}) => {
38
38
  exports.createAgentRuntime = createAgentRuntime;
39
39
  // Tool system
40
40
  __exportStar(require("./tools"), exports);
41
+ // Graph runtime (DAG of loop-wrapping nodes). Nothing in the framework
42
+ // consumes it yet — hosts opt in explicitly; zero behavior change until then.
43
+ __exportStar(require("./graph"), exports);
41
44
  // MCP — Model Context Protocol client (Phase 1: groundwork). See
42
45
  // docs/integration-playlist/mcp-roadmap.md. Off by default — hosts
43
46
  // that don't construct an McpClientPool get zero behavior change.
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACA,yDAAsD;AACtD,+EAAiF;AAGjF,gDAA8B;AAC9B,gDAA8B;AAC9B,uCAAkD;AAAzC,0GAAA,iBAAiB,OAAA;AAE1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AQ,EAAE,gBAAgB,EAAE,GAAG,IAAI,EAAE,GAAG,OAAO,CAAC;IACxD,MAAM,QAAQ,GAAG,gBAAgB,IAAI,IAAI,oDAA2B,EAAE,CAAC;IACvE,OAAO,IAAI,2BAAY,CAAC;QACtB,QAAQ;QACR,GAAI,IAA8C;KACnD,CAAC,CAAC;AACL,CAAC,CAAC;AAPW,QAAA,kBAAkB,sBAO7B;AAEF,cAAc;AACd,0CAAwB;AACxB,uEAAuE;AACvE,8EAA8E;AAC9E,0CAAwB;AAExB,iEAAiE;AACjE,mEAAmE;AACnE,kEAAkE;AAClE,wCAAsB;AAEtB,wDAAwD;AACxD,mEAAmE;AACnE,4CAA4C;AAC5C,4DAMmC;AALjC,+GAAA,aAAa,OAAA;AACb,qHAAA,mBAAmB,OAAA;AACnB,yHAAA,uBAAuB,OAAA;AAKzB,iFAAiF;AACjF,iFAAiF;AACjF,yDAMkC;AALhC,iHAAA,iBAAiB,OAAA;AACjB,sHAAA,sBAAsB,OAAA;AACtB,4GAAA,YAAY,OAAA;AACZ,gHAAA,gBAAgB,OAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@burtson-labs/agent-core",
3
- "version": "1.6.37",
3
+ "version": "1.6.39",
4
4
  "author": {
5
5
  "name": "Burtson Labs",
6
6
  "email": "team@burtson.ai",