@tangle-network/agent-runtime 0.161.0 → 0.163.0

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.
Files changed (65) hide show
  1. package/dist/{activation-DaUNBcZw.js → activation-DxGP0h_p.js} +2 -2
  2. package/dist/{activation-DaUNBcZw.js.map → activation-DxGP0h_p.js.map} +1 -1
  3. package/dist/agent.d.ts +1 -1
  4. package/dist/agent.js +2 -2
  5. package/dist/{authoring-DDRliHit.js → authoring-kO7vE_c9.js} +2 -2
  6. package/dist/{authoring-DDRliHit.js.map → authoring-kO7vE_c9.js.map} +1 -1
  7. package/dist/{conversation-DLYKdh6W.js → conversation-7XGKoDM6.js} +3 -3
  8. package/dist/{conversation-DLYKdh6W.js.map → conversation-7XGKoDM6.js.map} +1 -1
  9. package/dist/conversation.d.ts +1 -1
  10. package/dist/conversation.js +1 -1
  11. package/dist/durable.d.ts +2 -2
  12. package/dist/durable.js +1 -1
  13. package/dist/{environment-provider-BobKk46F.d.ts → environment-provider-BXFFK_rZ.d.ts} +2 -2
  14. package/dist/environment-provider.d.ts +1 -1
  15. package/dist/{executable-spec-7ovS7PBo.js → executable-spec-CkGvdPds.js} +17 -5
  16. package/dist/executable-spec-CkGvdPds.js.map +1 -0
  17. package/dist/{graph-DWUz1caU.js → graph-COikUkrj.js} +2 -2
  18. package/dist/{graph-DWUz1caU.js.map → graph-COikUkrj.js.map} +1 -1
  19. package/dist/graph.d.ts +467 -0
  20. package/dist/graph.js +1203 -0
  21. package/dist/graph.js.map +1 -0
  22. package/dist/{improvement-cycle-oUBE1Pzg.js → improvement-cycle-dGtgX1vr.js} +4 -4
  23. package/dist/{improvement-cycle-oUBE1Pzg.js.map → improvement-cycle-dGtgX1vr.js.map} +1 -1
  24. package/dist/{index-5B7TlTSi.d.ts → index-CbyKCjR7.d.ts} +5 -5
  25. package/dist/{index-CT7Cmz66.d.ts → index-CykKDPnB.d.ts} +4 -4
  26. package/dist/{index-CLt9zpuD.d.ts → index-OFOvnNc2.d.ts} +2 -2
  27. package/dist/index.d.ts +7 -7
  28. package/dist/index.js +9 -9
  29. package/dist/intelligence.d.ts +4 -4
  30. package/dist/intelligence.js +3 -3
  31. package/dist/kernel.d.ts +5 -5
  32. package/dist/kernel.js +7 -7
  33. package/dist/{knowledge-BBfx7pSo.js → knowledge-CZT8ahp6.js} +3 -3
  34. package/dist/{knowledge-BBfx7pSo.js.map → knowledge-CZT8ahp6.js.map} +1 -1
  35. package/dist/knowledge.d.ts +1 -1
  36. package/dist/knowledge.js +1 -1
  37. package/dist/{loop-runner-bin-CjRjwtal.js → loop-runner-bin-CIjmKf7v.js} +3 -3
  38. package/dist/{loop-runner-bin-CjRjwtal.js.map → loop-runner-bin-CIjmKf7v.js.map} +1 -1
  39. package/dist/{loop-runner-bin-DRX6EDIy.d.ts → loop-runner-bin-DrN092ew.d.ts} +3 -3
  40. package/dist/loop-runner-bin.d.ts +1 -1
  41. package/dist/loop-runner-bin.js +1 -1
  42. package/dist/mcp/bin.js +3 -3
  43. package/dist/mcp/index.d.ts +3 -3
  44. package/dist/mcp/index.js +4 -4
  45. package/dist/{openai-tools-CLb9RqXL.js → openai-tools-DG779Z6S.js} +2 -2
  46. package/dist/{openai-tools-CLb9RqXL.js.map → openai-tools-DG779Z6S.js.map} +1 -1
  47. package/dist/primeintellect/index.d.ts +1 -1
  48. package/dist/{redact-0AK8JmHW.d.ts → redact-DL_ZtFvR.d.ts} +3 -3
  49. package/dist/{runtime-CyVJSWzN.js → runtime-BT00zfIS.js} +8 -8
  50. package/dist/{runtime-CyVJSWzN.js.map → runtime-BT00zfIS.js.map} +1 -1
  51. package/dist/{runtime-BzY66cd6.d.ts → runtime-CCbeY1KO.d.ts} +3 -3
  52. package/dist/{stream-agent-turn-FRZAuXAL.js → stream-agent-turn-CKIpCbSq.js} +2 -2
  53. package/dist/{stream-agent-turn-FRZAuXAL.js.map → stream-agent-turn-CKIpCbSq.js.map} +1 -1
  54. package/dist/{stream-agent-turn-jaaFaSXM.d.ts → stream-agent-turn-Dx2YrEWW.d.ts} +2 -2
  55. package/dist/{structural-rollout-JEhoJUjC.js → structural-rollout-DAenyNls.js} +4 -4
  56. package/dist/{structural-rollout-JEhoJUjC.js.map → structural-rollout-DAenyNls.js.map} +1 -1
  57. package/dist/{supervise-DE-GFNKg.js → supervise-Di6xvnOL.js} +2 -2
  58. package/dist/{supervise-DE-GFNKg.js.map → supervise-Di6xvnOL.js.map} +1 -1
  59. package/dist/{supervisor-ZlQy5Fwl.js → supervisor-DmWq4vkU.js} +15 -2
  60. package/dist/{supervisor-ZlQy5Fwl.js.map → supervisor-DmWq4vkU.js.map} +1 -1
  61. package/dist/testing.d.ts +2 -2
  62. package/dist/testing.js +11 -11
  63. package/dist/{types-BBXdSns1.d.ts → types-C2l1jaos.d.ts} +14 -8
  64. package/package.json +6 -1
  65. package/dist/executable-spec-7ovS7PBo.js.map +0 -1
@@ -0,0 +1,467 @@
1
+ import { $l as MakeWorkerAgent, If as DeliverableSpec, an as PromptRegistry, bo as SupervisorAgentDeps, in as PromptHandle, mu as WorkerSpawnContext, os as SupervisorFinalizer } from "./index-CbyKCjR7.js";
2
+ import { H as SpawnJournal, K as Spend, i as Budget, j as ResultBlobStore, t as Agent } from "./types-C2l1jaos.js";
3
+ import { o as ExecutorConfig } from "./runtime-CCbeY1KO.js";
4
+ import { AgentProfile } from "@tangle-network/agent-interface";
5
+ //#region src/runtime/graph/condition.d.ts
6
+ /** The leaf comparison operators; `exists`/`truthy` are unary, the rest compare against `value`. */
7
+ declare const CONDITION_OPS: readonly ["eq", "neq", "gt", "gte", "lt", "lte", "in", "contains", "exists", "truthy"];
8
+ type ConditionOp = (typeof CONDITION_OPS)[number];
9
+ interface ConditionLeaf {
10
+ /** Dotted path with `[N]` indexing into the guard context, e.g. `out.findings[0].severity`. */
11
+ readonly path: string;
12
+ readonly op: ConditionOp;
13
+ readonly value?: unknown;
14
+ }
15
+ type Condition = ConditionLeaf | {
16
+ readonly all: ReadonlyArray<Condition>;
17
+ } | {
18
+ readonly any: ReadonlyArray<Condition>;
19
+ } | {
20
+ readonly not: Condition;
21
+ };
22
+ /** Validate shape, bounds, and per-leaf path/operator rules; returns the input for chaining. */
23
+ declare function validateCondition(raw: unknown, context: string): Condition;
24
+ /** Walk a validated condition over a context to a boolean. Never throws on data shape. */
25
+ declare function evaluateCondition(condition: Condition, context: unknown): boolean;
26
+ //#endregion
27
+ //#region src/runtime/graph/registry.d.ts
28
+ /**
29
+ * `Registry<T>` — the ONE name→thing shape for the graph engine.
30
+ *
31
+ * The kernel grew fourteen of these (agent-runtime#978) that differ in three properties:
32
+ * whether names can be listed, what a miss does, and whether the table is global. This one
33
+ * fixes all three — enumerable, a miss is refused BY NAME listing what is registered, and every
34
+ * registry is per-instance — and it is lifted from `AgentEnvironmentProviderRegistry`, the
35
+ * richest and best-tested of the fourteen, not invented.
36
+ *
37
+ * Entries are addressed by a versioned handle, `<id>/v<n>`, the same way the prompt registry
38
+ * addresses directives. A graph names a kind by handle; a host registers exact versions; a
39
+ * missing version is refused, never served by a newer one.
40
+ */
41
+ /** A versioned name: what a graph writes and what a host registers. */
42
+ interface RegistryHandle {
43
+ readonly id: string;
44
+ readonly version: number;
45
+ }
46
+ /** `<id>/v<n>` — the only spelling a handle has on the wire, in a journal, or in an error. */
47
+ declare function formatRegistryHandle(handle: RegistryHandle): string;
48
+ /** Parse the wire spelling back. Refuses anything that is not exactly `<id>/v<n>`. */
49
+ declare function parseRegistryHandle(text: string, context: string): RegistryHandle;
50
+ /** Anything a registry holds carries its own handle, so the table cannot drift from the entry. */
51
+ interface Registered extends RegistryHandle {}
52
+ interface Registry<T extends Registered> {
53
+ /** Add one entry. A second entry under the same handle is refused unless `replace` is set —
54
+ * silently shadowing a registered kind is how a key no caller could produce once survived. */
55
+ register(entry: T, options?: {
56
+ readonly replace?: boolean;
57
+ }): void;
58
+ has(handle: RegistryHandle): boolean;
59
+ get(handle: RegistryHandle): T | undefined;
60
+ /** The entry, or a refusal that names the handle AND lists every registered handle — a miss
61
+ * must be diagnosable from its message alone. */
62
+ require(handle: RegistryHandle, context?: string): T;
63
+ /** Every registered handle, sorted, as wire spellings. The thing the fourteen predecessors
64
+ * mostly could not do and four callers needed. */
65
+ names(): string[];
66
+ /** Every entry, in `names()` order. */
67
+ entries(): T[];
68
+ }
69
+ /**
70
+ * Create a registry. Per-instance by construction: two engines in one process may hold
71
+ * different kind sets, a test is hermetic, and a run can print its own table. There is
72
+ * deliberately no module-level singleton — `builtinShapes` was the one mutable global in the
73
+ * kernel and it had zero tests.
74
+ */
75
+ declare function createRegistry<T extends Registered>(label: string, seed?: Iterable<T>): Registry<T>;
76
+ //#endregion
77
+ //#region src/runtime/graph/kind.d.ts
78
+ /** A JSON Schema document as the kernel already spells it: an opaque record, validated by the
79
+ * consumer's own validator, published verbatim. */
80
+ type JsonSchema = Readonly<Record<string, unknown>>;
81
+ /**
82
+ * One declared port on a node. Ports are how a `data` edge binds one node's output to another's
83
+ * input with a type the compiler can check structurally before any spend. A node has two implicit
84
+ * output ports beside its declared ones: `out` (its result) and `trace` (its `WorkerTraceEvidence`
85
+ * by `traceRef`); only an `analyzes` edge may bind `trace`.
86
+ */
87
+ interface PortSpec {
88
+ readonly name: string;
89
+ readonly schema: JsonSchema;
90
+ readonly description?: string;
91
+ }
92
+ /**
93
+ * What a kind declares it needs from the host. The engine never imports a host capability; it
94
+ * knows only that a kind SAID it needs something under this name and the host PROVIDED something
95
+ * under it. The context a kind receives is narrowed to exactly its declaration — an undeclared
96
+ * effect is `undefined`, never a service locator.
97
+ */
98
+ type EffectName = string;
99
+ type EffectContext<Effects extends ReadonlyArray<EffectName>> = Readonly<{ [K in Effects[number]]: unknown; }>;
100
+ /**
101
+ * What happens to a node that was IN FLIGHT when the process died. A settled node is never a
102
+ * per-kind choice — it restores from its content-addressed `outRef` on replay. `'restart'` re-runs
103
+ * from the journaled `inputRef`; `'resume'` is legal only for a kind whose executor can re-attach
104
+ * to the live process (the bridge backend's session re-attachment is the existing instance).
105
+ */
106
+ type OnCrash = 'restart' | 'resume';
107
+ /**
108
+ * Whether a kind's spend enters the conserved pool. `'metered'`: the executor reports `Spend` and
109
+ * settling without one is an ENGINE ERROR — never "free". `'exempt'`: the whole reservation is
110
+ * refunded on settle, keeping the node out of Σk by construction (the kernel's `budgetExempt`).
111
+ */
112
+ type BudgetMode = 'metered' | 'exempt';
113
+ /** The validated declaration every kind provides. `Config` is the per-node config shape;
114
+ * `Effects` is the tuple of host capabilities it declares, so the context `run` receives is typed
115
+ * to exactly that tuple. */
116
+ interface NodeKind<Config = unknown, Effects extends ReadonlyArray<EffectName> = ReadonlyArray<EffectName>> extends Registered {
117
+ /** Kind id, e.g. `agent`, `integration.invoke`. With `version`, forms the handle `<id>/v<n>`. */
118
+ readonly id: string;
119
+ readonly version: number;
120
+ readonly description: string;
121
+ /** Validate and narrow one node's config. Throw `ValidationError` to refuse; the compiler
122
+ * surfaces the message with the node id prefixed. */
123
+ readonly validateConfig: (raw: unknown, context: string) => Config;
124
+ /** The portable form of `validateConfig`'s accepted shape, for manifests and hosts. */
125
+ readonly configSchema: JsonSchema;
126
+ /** Declared input ports; a `data` edge may bind only these. Empty for a source node. */
127
+ readonly inputs: ReadonlyArray<PortSpec>;
128
+ /** Declared output ports beside the implicit `out` and `trace`. */
129
+ readonly outputs: ReadonlyArray<PortSpec>;
130
+ /** Host capabilities this kind reaches for, by name. The context is narrowed to exactly these. */
131
+ readonly effects: Effects;
132
+ readonly onCrash: OnCrash;
133
+ readonly budget: BudgetMode;
134
+ /**
135
+ * Build the agent for one node instance. The kernel spawns it under `Scope.spawn`, so it is
136
+ * authorized, classified, journaled, pooled and gated like any child — the kind owns only what
137
+ * the agent DOES. `profile` is the node's pinned profile (an `agent`/`supervisor` kind runs it;
138
+ * a `script` kind may ignore it); `inputs` are the resolved, content-addressed port values;
139
+ * `effects` is the narrowed host context; `spawn` is the kernel's per-spawn context when the
140
+ * kind needs it (a supervisor kind threads it into `nodeContext`).
141
+ */
142
+ readonly run: (args: {
143
+ readonly config: Config;
144
+ readonly profile: AgentProfile;
145
+ readonly inputs: Readonly<Record<string, unknown>>;
146
+ readonly effects: EffectContext<Effects>;
147
+ readonly spawn?: WorkerSpawnContext;
148
+ }) => Agent<unknown, unknown>;
149
+ }
150
+ /** Per-node flags a graph author sets; they are node properties, not kinds (agent-runtime#970). */
151
+ interface NodeFlags {
152
+ /** An oracle — a judge, grader, auditor, trace analyst — may be bound only by an `analyzes`
153
+ * edge. The compiler refuses a `delegates` or `data` edge INTO an oracle: an edge to a grader
154
+ * leaks the rubric. */
155
+ readonly oracle?: boolean;
156
+ /** `script` only: pure over `(config, inputs)` ⇒ budget exempt, output restorable on replay,
157
+ * runs in-process. A pure script that settles with a different `outRef` for the same inputs
158
+ * has lied, and the first replay mismatch is an engine error. */
159
+ readonly pure?: boolean;
160
+ }
161
+ /** Validate a kind declaration at registration — so a malformed kind is refused by name once,
162
+ * not at the first node that uses it. */
163
+ declare function validateNodeKind(kind: NodeKind, context?: string): NodeKind;
164
+ /** The handle a graph writes to name this kind. */
165
+ declare function kindHandle(kind: Pick<NodeKind, 'id' | 'version'>): RegistryHandle;
166
+ /**
167
+ * Narrow a host's effect table to exactly what one kind declared. Anything the kind did not
168
+ * declare is absent — `undefined` on read — so a kind cannot reach past its declaration, and the
169
+ * engine can list a graph's required effects before spending a token.
170
+ */
171
+ declare function narrowEffects<Effects extends ReadonlyArray<EffectName>>(declared: Effects, provided: Readonly<Record<string, unknown>>, context: string): EffectContext<Effects>;
172
+ //#endregion
173
+ //#region src/runtime/graph/projection.d.ts
174
+ type Projection = {
175
+ readonly path: string;
176
+ } | {
177
+ readonly pick: ReadonlyArray<string>;
178
+ } | {
179
+ readonly map: string;
180
+ } | {
181
+ readonly filter: Condition;
182
+ } | {
183
+ readonly first: true;
184
+ } | {
185
+ readonly last: true;
186
+ } | {
187
+ readonly count: true;
188
+ };
189
+ /** Validate a projection: exactly one known operator, its argument well-formed. */
190
+ declare function validateProjection(raw: unknown, context: string): Projection;
191
+ /**
192
+ * Apply a validated projection to an admitted payload. Collection operators over a non-array
193
+ * refuse by name — a shape the author did not expect is a graph defect, not an empty result.
194
+ */
195
+ declare function applyProjection(value: unknown, projection: Projection, context: string): unknown;
196
+ //#endregion
197
+ //#region src/runtime/graph/definition.d.ts
198
+ /** Which gating-edge outcomes release a node (adopted from ADC, agent-runtime#968). */
199
+ declare const JOIN_RULES: readonly ["all", "any", "any_failed", "all_done"];
200
+ type JoinRule = (typeof JOIN_RULES)[number];
201
+ /** ADC-compatible visit backstop: nothing may be ENTERED more than this many times. */
202
+ declare const DEFAULT_MAX_NODE_VISITS = 25;
203
+ /** The hard ceiling an author's `maxVisits`/`maxNodeVisits` override may reach. */
204
+ declare const MAX_MAX_NODE_VISITS = 100;
205
+ type GraphEdgeKind = 'delegates' | 'analyzes' | 'data';
206
+ interface EngineGraphNode {
207
+ readonly id: string;
208
+ /** `<id>/v<n>` into the engine's kind registry. */
209
+ readonly kind: string;
210
+ /** This node's config, validated by its kind's `validateConfig` at compile. */
211
+ readonly config?: unknown;
212
+ /** Per-node flags — properties of the node, never of its kind (agent-runtime#970). */
213
+ readonly flags?: NodeFlags;
214
+ /** Node-level port declarations, merged OVER the kind's. A kind whose surface depends on its
215
+ * config (a script) declares ports here; a typed kind's declared ports stay authoritative. */
216
+ readonly ports?: {
217
+ readonly inputs?: ReadonlyArray<PortSpec>;
218
+ readonly outputs?: ReadonlyArray<PortSpec>;
219
+ };
220
+ /** Which inbound gating-edge outcomes release this node. Default `all`. */
221
+ readonly join?: JoinRule;
222
+ /** Entered more than this many times fails the run `cycle-budget-exceeded`. */
223
+ readonly maxVisits?: number;
224
+ /** This node's completion check; a terminal without one (or a kind/graph default) refuses. */
225
+ readonly deliverable?: DeliverableSpec<unknown>;
226
+ /** Force-mark a terminal. Absent, a node with no outbound gating edge is terminal. */
227
+ readonly terminal?: boolean;
228
+ /** Profile fields merged over the engine-authored `{ name: id }` for this node's spawns. */
229
+ readonly profile?: Readonly<Partial<AgentProfile>>;
230
+ /** Per-instance reservation for this node's spawns; falls back to the run's `perNode`. */
231
+ readonly budget?: Budget;
232
+ }
233
+ interface EngineGraphEdge {
234
+ /** Stable id for the ledger; defaults to `<from>-><to>#<ordinal>`. */
235
+ readonly id?: string;
236
+ readonly kind: GraphEdgeKind;
237
+ readonly from: {
238
+ readonly node: string;
239
+ readonly port?: string;
240
+ };
241
+ readonly to: {
242
+ readonly node: string;
243
+ readonly port?: string;
244
+ };
245
+ /** Evaluated over the source's settle context; absent = satisfied by completion. */
246
+ readonly guard?: Condition;
247
+ /** `data` edges only: ONE pure reshape of the admitted payload. */
248
+ readonly projection?: Projection;
249
+ /** Refuses the traversal past this many firings (ledgered `unpropagated`). */
250
+ readonly maxTraversals?: number;
251
+ /** `delegates`/`analyzes`: the versioned directive appended to the target's task. */
252
+ readonly directive?: PromptHandle;
253
+ }
254
+ interface EngineGraphSpec {
255
+ readonly nodes: ReadonlyArray<EngineGraphNode>;
256
+ readonly edges: ReadonlyArray<EngineGraphEdge>;
257
+ /** Root node for the graph-level completion check. Defaults to the single entry node. */
258
+ readonly root?: string;
259
+ /** Becomes the ROOT node's completion check when the root declares none (#973). */
260
+ readonly deliverable?: DeliverableSpec<unknown>;
261
+ readonly maxNodeVisits?: number;
262
+ }
263
+ //#endregion
264
+ //#region src/runtime/graph/engine.d.ts
265
+ interface GraphEngineOptions {
266
+ /** Kinds to register beside the core set. A host adds its own here; nothing is global. */
267
+ readonly kinds?: ReadonlyArray<NodeKind>;
268
+ /** The host's effect table, by name. A kind receives only the effects it declared. */
269
+ readonly effects?: Readonly<Record<EffectName, unknown>>;
270
+ /** The core set. Injected so a test can substitute, and so the engine never imports a
271
+ * backend-specific factory at module load. */
272
+ readonly coreKinds: ReadonlyArray<NodeKind>;
273
+ }
274
+ interface GraphEngine {
275
+ readonly kinds: Registry<NodeKind>;
276
+ readonly effects: Readonly<Record<EffectName, unknown>>;
277
+ /** Every effect name any registered kind declares — what a host must provide for this engine's
278
+ * whole kind set to be runnable. Listed, never discovered mid-run. */
279
+ requiredEffects(): string[];
280
+ /** The declared effects no host value covers. Empty means every registered kind is runnable. */
281
+ missingEffects(): string[];
282
+ }
283
+ /**
284
+ * Build one engine: a kind registry seeded with the core kinds plus the host's, and the host's
285
+ * effect values. Every kind is validated by name at construction, so a malformed host kind fails
286
+ * here, never at its first node.
287
+ */
288
+ declare function createGraphEngine(options: GraphEngineOptions): GraphEngine;
289
+ //#endregion
290
+ //#region src/runtime/graph/compile.d.ts
291
+ interface CompiledEdge {
292
+ readonly id: string;
293
+ readonly spec: EngineGraphEdge;
294
+ readonly fromPort: string;
295
+ readonly toPort: string;
296
+ }
297
+ interface CompiledNode {
298
+ readonly id: string;
299
+ readonly kind: NodeKind;
300
+ readonly config: unknown;
301
+ readonly join: JoinRule;
302
+ readonly maxVisits: number;
303
+ readonly oracle: boolean;
304
+ readonly pure: boolean;
305
+ readonly terminal: boolean;
306
+ /** The check this node must pass to count DELIVERED; resolved per #973. */
307
+ readonly deliverable?: DeliverableSpec<unknown>;
308
+ readonly inbound: ReadonlyArray<CompiledEdge>;
309
+ readonly outbound: ReadonlyArray<CompiledEdge>;
310
+ readonly spec: EngineGraphSpec['nodes'][number];
311
+ }
312
+ interface CompiledGraph {
313
+ readonly nodes: ReadonlyMap<string, CompiledNode>;
314
+ readonly edges: ReadonlyArray<CompiledEdge>;
315
+ readonly entries: ReadonlyArray<string>;
316
+ readonly terminals: ReadonlyArray<string>;
317
+ readonly root: string;
318
+ readonly maxNodeVisits: number;
319
+ }
320
+ /**
321
+ * Bounded structural acceptance: does a value of `source`'s shape fit `target`? Schemas with no
322
+ * `type` accept anything; object targets require their `required` properties to be present and
323
+ * accepted when the source declares properties. Depth-bounded — this is a compile-time tripwire,
324
+ * not a full JSON Schema validator.
325
+ */
326
+ declare function schemaAccepts(source: JsonSchema, target: JsonSchema, depth?: number): boolean;
327
+ /**
328
+ * Lower an authored graph against an engine's kind registry into the schedulable form, refusing
329
+ * every structural defect before any spend.
330
+ */
331
+ declare function compileGraph(engine: GraphEngine, spec: EngineGraphSpec, context?: string): CompiledGraph;
332
+ //#endregion
333
+ //#region src/runtime/graph/kinds.d.ts
334
+ interface AgentKindConfig {
335
+ /** Where this node's profile runs. Omit to inherit the engine's default backend. */
336
+ readonly backend?: ExecutorConfig;
337
+ /** This node's completion check. Omit to inherit the graph's terminal check. */
338
+ readonly deliverable?: DeliverableSpec<unknown>;
339
+ }
340
+ /**
341
+ * One profile, one run: the kernel's leaf, exactly as `supervise()` derives it from `backend`.
342
+ * The model cannot decide this — it is what gets run.
343
+ */
344
+ declare function agentKind(defaults: {
345
+ readonly backend?: ExecutorConfig;
346
+ readonly deliverable?: DeliverableSpec<unknown>;
347
+ }): NodeKind<AgentKindConfig>;
348
+ interface SupervisorKindConfig {
349
+ /** Per-child budget reserved from the pool on each spawn this supervisor makes. */
350
+ readonly perWorker: SupervisorAgentDeps['perWorker'];
351
+ readonly maxLiveWorkers?: number;
352
+ }
353
+ /**
354
+ * The thing that DECIDES: a nested `supervisorAgent` with the coordination verbs. Its children
355
+ * are its own tree — the graph sees one node in, one `Settled` out. A `subgraph` constrains what
356
+ * it may spawn; without one it is free-form under `profileSecurity` and `allowedModels`.
357
+ */
358
+ declare function supervisorKind(deps: {
359
+ readonly blobs: SupervisorAgentDeps['blobs'];
360
+ readonly makeWorkerAgent: MakeWorkerAgent;
361
+ readonly router?: SupervisorAgentDeps['router'];
362
+ readonly driveHarness?: SupervisorAgentDeps['driveHarness'];
363
+ }): NodeKind<SupervisorKindConfig>;
364
+ /** The caller code a `script` node runs. Receives the resolved inputs; returns the output. */
365
+ type ScriptBody = (inputs: Readonly<Record<string, unknown>>, signal: AbortSignal) => Promise<unknown> | unknown;
366
+ interface ScriptKindConfig {
367
+ readonly body: ScriptBody;
368
+ /**
369
+ * `pure: true` is the promise that the output is a function of `(config, inputs)` alone: the
370
+ * node is then budget-exempt, its output restorable on replay by content address, and it runs
371
+ * in-process. A pure script that settles with a different `outRef` for the same inputs has
372
+ * lied, and the first replay mismatch is an engine error.
373
+ */
374
+ readonly pure?: boolean;
375
+ /** For a metered script: what it spent. Omit on a pure script. A metered script that reports
376
+ * nothing is metered as NOTHING-KNOWN, never as free. */
377
+ readonly spent?: Spend;
378
+ }
379
+ /**
380
+ * Caller code as a node. The one kind with no kernel primitive behind it: the kernel has no
381
+ * "data→data with no execution" concept (agent-runtime#970 fact-finding), so this is new. It is
382
+ * still a leaf `Agent` carrying an `Executor`, so the journal, the gate and the pool treat it like
383
+ * any other node.
384
+ */
385
+ declare function scriptKind(): NodeKind<ScriptKindConfig>;
386
+ /**
387
+ * A node carrying its own graph: the constraint on what a supervisor may spawn at depth>1. Its
388
+ * executor is a nested engine run; that needs the scheduler (#980), so until then this kind is
389
+ * registered and REFUSES at run time by name rather than being absent — a graph that names it
390
+ * compiles, and the refusal says exactly what is missing.
391
+ */
392
+ declare function subgraphKind(): NodeKind<{
393
+ readonly graph: unknown;
394
+ }>;
395
+ //#endregion
396
+ //#region src/runtime/graph/scheduler.d.ts
397
+ type GraphRunReason = 'all-children-down' | 'budget-exhausted' | 'aborted' | 'driver-failed' | 'cycle-budget-exceeded' | 'unreachable-terminal';
398
+ /** One node settlement as the graph result reports it. */
399
+ interface GraphNodeSettle {
400
+ readonly node: string;
401
+ readonly visit: number;
402
+ readonly status: 'done' | 'down';
403
+ /** The node's completion check verdict; `undefined` when the node declares no check. */
404
+ readonly valid?: boolean;
405
+ readonly out?: unknown;
406
+ readonly outRef?: string;
407
+ readonly reason?: string;
408
+ }
409
+ /** One ledgered edge firing (or refusal) — the run's observable data flow. */
410
+ interface GraphEdgeTraversal {
411
+ readonly edge: string;
412
+ readonly kind: 'delegates' | 'analyzes' | 'data';
413
+ readonly from: string;
414
+ readonly to: string;
415
+ readonly traversal: number;
416
+ readonly outcome: 'delivered' | 'empty' | 'unpropagated';
417
+ readonly directive?: string;
418
+ readonly port?: string;
419
+ readonly reason?: string;
420
+ }
421
+ type GraphRunResult = {
422
+ readonly kind: 'winner';
423
+ readonly out: unknown;
424
+ readonly terminals: ReadonlyArray<GraphNodeSettle>;
425
+ readonly settles: ReadonlyArray<GraphNodeSettle>;
426
+ readonly ledger: ReadonlyArray<GraphEdgeTraversal>;
427
+ } | {
428
+ readonly kind: 'no-winner';
429
+ readonly reason: GraphRunReason;
430
+ readonly error?: {
431
+ readonly name: string;
432
+ readonly message: string;
433
+ };
434
+ readonly terminals: ReadonlyArray<GraphNodeSettle>;
435
+ readonly settles: ReadonlyArray<GraphNodeSettle>;
436
+ readonly ledger: ReadonlyArray<GraphEdgeTraversal>;
437
+ /** Nodes provably stuck when the run ended: every upstream settled, no release possible. */
438
+ readonly unreachable: ReadonlyArray<string>;
439
+ };
440
+ interface GraphRunOptions {
441
+ /** The run's conserved pool. */
442
+ readonly budget: Budget;
443
+ /** Default per-instance reservation for nodes that declare no `budget` of their own.
444
+ * Required when any such node exists — the engine invents no split. */
445
+ readonly perNode?: Budget;
446
+ readonly journal?: SpawnJournal;
447
+ readonly blobs?: ResultBlobStore;
448
+ /** Resolves `delegates`/`analyzes` directives; required when any edge carries one. */
449
+ readonly prompts?: PromptRegistry;
450
+ /** How terminal settles reduce to `out`. Default `bestDelivered`. */
451
+ readonly finalizer?: 'bestDelivered' | 'collectDelivered' | SupervisorFinalizer;
452
+ readonly signal?: AbortSignal;
453
+ readonly now?: () => number;
454
+ readonly runId?: string;
455
+ }
456
+ /** Admission for every value crossing an edge (#971): JSON round-trip, `undefined` stripped, a
457
+ * non-representable value becomes a RECORD of that fact — a degraded record beats a vanished
458
+ * edge. */
459
+ declare function admitPayload(value: unknown): unknown;
460
+ /**
461
+ * Run a graph: host every node instance on one kernel `Scope`, resolve joins over guarded edges,
462
+ * enforce the traversal and visit caps, and reduce the terminal settlements through the finalizer.
463
+ */
464
+ declare function runEngineGraph(engine: GraphEngine, spec: EngineGraphSpec | CompiledGraph, task: string, options: GraphRunOptions): Promise<GraphRunResult>;
465
+ //#endregion
466
+ export { type AgentKindConfig, type BudgetMode, CONDITION_OPS, type CompiledEdge, type CompiledGraph, type CompiledNode, type Condition, type ConditionLeaf, type ConditionOp, DEFAULT_MAX_NODE_VISITS, type EffectContext, type EffectName, type EngineGraphEdge, type EngineGraphNode, type EngineGraphSpec, type GraphEdgeKind, type GraphEdgeTraversal, type GraphEngine, type GraphEngineOptions, type GraphNodeSettle, type GraphRunOptions, type GraphRunReason, type GraphRunResult, JOIN_RULES, type JoinRule, type JsonSchema, MAX_MAX_NODE_VISITS, type NodeFlags, type NodeKind, type OnCrash, type PortSpec, type Projection, type Registered, type Registry, type RegistryHandle, type ScriptBody, type ScriptKindConfig, type SupervisorKindConfig, admitPayload, agentKind, applyProjection, compileGraph, createGraphEngine, createRegistry, evaluateCondition, formatRegistryHandle, kindHandle, narrowEffects, parseRegistryHandle, runEngineGraph, schemaAccepts, scriptKind, subgraphKind, supervisorKind, validateCondition, validateNodeKind, validateProjection };
467
+ //# sourceMappingURL=graph.d.ts.map