@tangle-network/agent-runtime 0.162.0 → 0.164.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 (68) hide show
  1. package/dist/{activation-DxGP0h_p.js → activation-CneAm4jL.js} +3 -3
  2. package/dist/{activation-DxGP0h_p.js.map → activation-CneAm4jL.js.map} +1 -1
  3. package/dist/agent.d.ts +1 -1
  4. package/dist/agent.js +2 -2
  5. package/dist/{authoring-kO7vE_c9.js → authoring-CZM22nUG.js} +2 -2
  6. package/dist/{authoring-kO7vE_c9.js.map → authoring-CZM22nUG.js.map} +1 -1
  7. package/dist/candidate-execution/index.js +4 -4
  8. package/dist/{candidate-execution-izJj02pU.js → candidate-execution-DNLk6h0A.js} +4 -4
  9. package/dist/{candidate-execution-izJj02pU.js.map → candidate-execution-DNLk6h0A.js.map} +1 -1
  10. package/dist/conversation.d.ts +1 -1
  11. package/dist/durable.d.ts +2 -2
  12. package/dist/durable.js +1 -1
  13. package/dist/{environment-provider-Bk8rg4gs.d.ts → environment-provider-BXFFK_rZ.d.ts} +2 -2
  14. package/dist/environment-provider.d.ts +1 -1
  15. package/dist/{graph-COikUkrj.js → graph-DzE4SwfP.js} +2 -2
  16. package/dist/{graph-COikUkrj.js.map → graph-DzE4SwfP.js.map} +1 -1
  17. package/dist/graph.d.ts +230 -4
  18. package/dist/graph.js +873 -50
  19. package/dist/graph.js.map +1 -1
  20. package/dist/{improvement-cycle-dGtgX1vr.js → improvement-cycle-a_L8FFql.js} +4 -4
  21. package/dist/{improvement-cycle-dGtgX1vr.js.map → improvement-cycle-a_L8FFql.js.map} +1 -1
  22. package/dist/{index-8b0o4dMF.d.ts → index-BP11HXYi.d.ts} +5 -5
  23. package/dist/{index-4mRXbu_V.d.ts → index-C2X-OVPZ.d.ts} +4 -4
  24. package/dist/{index-CTQ97IMO.d.ts → index-OFOvnNc2.d.ts} +2 -2
  25. package/dist/index.d.ts +7 -7
  26. package/dist/index.js +11 -11
  27. package/dist/intelligence.d.ts +4 -4
  28. package/dist/intelligence.js +5 -5
  29. package/dist/kernel.d.ts +5 -5
  30. package/dist/kernel.js +6 -6
  31. package/dist/{knowledge-CZT8ahp6.js → knowledge-Ccdghy81.js} +5 -5
  32. package/dist/{knowledge-CZT8ahp6.js.map → knowledge-Ccdghy81.js.map} +1 -1
  33. package/dist/knowledge.d.ts +1 -1
  34. package/dist/knowledge.js +1 -1
  35. package/dist/{loop-runner-bin-DHU5kmJW.d.ts → loop-runner-bin-2NITRIFc.d.ts} +3 -3
  36. package/dist/{loop-runner-bin-CIjmKf7v.js → loop-runner-bin-DM-AnPC-.js} +3 -3
  37. package/dist/{loop-runner-bin-CIjmKf7v.js.map → loop-runner-bin-DM-AnPC-.js.map} +1 -1
  38. package/dist/loop-runner-bin.d.ts +1 -1
  39. package/dist/loop-runner-bin.js +1 -1
  40. package/dist/mcp/bin.js +3 -3
  41. package/dist/mcp/index.d.ts +3 -3
  42. package/dist/mcp/index.js +4 -4
  43. package/dist/{openai-tools-DG779Z6S.js → openai-tools-CIo9tB75.js} +2 -2
  44. package/dist/{openai-tools-DG779Z6S.js.map → openai-tools-CIo9tB75.js.map} +1 -1
  45. package/dist/{prepare-VLGnSyav.js → prepare-D7Fb75XR.js} +6 -4
  46. package/dist/prepare-D7Fb75XR.js.map +1 -0
  47. package/dist/primeintellect/index.d.ts +1 -1
  48. package/dist/{protected-model-port-CcCH0Uji.js → protected-model-port-RZkxRZhp.js} +2 -2
  49. package/dist/{protected-model-port-CcCH0Uji.js.map → protected-model-port-RZkxRZhp.js.map} +1 -1
  50. package/dist/{redact-BUIB5IWj.d.ts → redact-D4vlt6p4.d.ts} +3 -3
  51. package/dist/{runtime-BT00zfIS.js → runtime-BDHsMgCK.js} +6 -6
  52. package/dist/{runtime-BT00zfIS.js.map → runtime-BDHsMgCK.js.map} +1 -1
  53. package/dist/{runtime-B0FIFwpH.d.ts → runtime-D44YrQ4t.d.ts} +4 -4
  54. package/dist/{stream-agent-turn-BEhmmYmL.d.ts → stream-agent-turn-Dx2YrEWW.d.ts} +2 -2
  55. package/dist/{structural-rollout-DAenyNls.js → structural-rollout-CBK2LHni.js} +2 -2
  56. package/dist/{structural-rollout-DAenyNls.js.map → structural-rollout-CBK2LHni.js.map} +1 -1
  57. package/dist/{supervise-Di6xvnOL.js → supervise-CzllE0vn.js} +2 -2
  58. package/dist/{supervise-Di6xvnOL.js.map → supervise-CzllE0vn.js.map} +1 -1
  59. package/dist/{supervisor-DmWq4vkU.js → supervisor-D5K8ihKQ.js} +106 -36
  60. package/dist/supervisor-D5K8ihKQ.js.map +1 -0
  61. package/dist/testing.d.ts +2 -2
  62. package/dist/testing.js +12 -12
  63. package/dist/{types-DXKDG6DQ.d.ts → types-C2l1jaos.d.ts} +7 -4
  64. package/dist/{workspace-archive-BptlGCEU.js → workspace-archive-DK0mDjSB.js} +2 -2
  65. package/dist/{workspace-archive-BptlGCEU.js.map → workspace-archive-DK0mDjSB.js.map} +1 -1
  66. package/package.json +1 -1
  67. package/dist/prepare-VLGnSyav.js.map +0 -1
  68. package/dist/supervisor-DmWq4vkU.js.map +0 -1
package/dist/graph.d.ts CHANGED
@@ -1,7 +1,29 @@
1
- import { $l as MakeWorkerAgent, If as DeliverableSpec, bo as SupervisorAgentDeps, mu as WorkerSpawnContext } from "./index-8b0o4dMF.js";
2
- import { K as Spend, t as Agent } from "./types-DXKDG6DQ.js";
3
- import { o as ExecutorConfig } from "./runtime-B0FIFwpH.js";
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-BP11HXYi.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-D44YrQ4t.js";
4
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
5
27
  //#region src/runtime/graph/registry.d.ts
6
28
  /**
7
29
  * `Registry<T>` — the ONE name→thing shape for the graph engine.
@@ -148,6 +170,97 @@ declare function kindHandle(kind: Pick<NodeKind, 'id' | 'version'>): RegistryHan
148
170
  */
149
171
  declare function narrowEffects<Effects extends ReadonlyArray<EffectName>>(declared: Effects, provided: Readonly<Record<string, unknown>>, context: string): EffectContext<Effects>;
150
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
151
264
  //#region src/runtime/graph/engine.d.ts
152
265
  interface GraphEngineOptions {
153
266
  /** Kinds to register beside the core set. A host adds its own here; nothing is global. */
@@ -174,6 +287,49 @@ interface GraphEngine {
174
287
  */
175
288
  declare function createGraphEngine(options: GraphEngineOptions): GraphEngine;
176
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
177
333
  //#region src/runtime/graph/kinds.d.ts
178
334
  interface AgentKindConfig {
179
335
  /** Where this node's profile runs. Omit to inherit the engine's default backend. */
@@ -237,5 +393,75 @@ declare function subgraphKind(): NodeKind<{
237
393
  readonly graph: unknown;
238
394
  }>;
239
395
  //#endregion
240
- export { type AgentKindConfig, type BudgetMode, type EffectContext, type EffectName, type GraphEngine, type GraphEngineOptions, type JsonSchema, type NodeFlags, type NodeKind, type OnCrash, type PortSpec, type Registered, type Registry, type RegistryHandle, type ScriptBody, type ScriptKindConfig, type SupervisorKindConfig, agentKind, createGraphEngine, createRegistry, formatRegistryHandle, kindHandle, narrowEffects, parseRegistryHandle, scriptKind, subgraphKind, supervisorKind, validateNodeKind };
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 };
241
467
  //# sourceMappingURL=graph.d.ts.map