@tangle-network/agent-runtime 0.164.0 → 0.165.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-CneAm4jL.js → activation-DmUIq51m.js} +3 -3
  2. package/dist/{activation-CneAm4jL.js.map → activation-DmUIq51m.js.map} +1 -1
  3. package/dist/agent.d.ts +1 -1
  4. package/dist/agent.js +2 -2
  5. package/dist/{authoring-CZM22nUG.js → authoring-Cm122Duf.js} +2 -2
  6. package/dist/{authoring-CZM22nUG.js.map → authoring-Cm122Duf.js.map} +1 -1
  7. package/dist/candidate-execution/index.js +4 -4
  8. package/dist/{candidate-execution-DNLk6h0A.js → candidate-execution-DC0T8l2p.js} +4 -4
  9. package/dist/{candidate-execution-DNLk6h0A.js.map → candidate-execution-DC0T8l2p.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-BXFFK_rZ.d.ts → environment-provider-DWjbGH8W.d.ts} +2 -2
  14. package/dist/environment-provider.d.ts +1 -1
  15. package/dist/{graph-DzE4SwfP.js → graph-DGri_zJm.js} +3 -3
  16. package/dist/{graph-DzE4SwfP.js.map → graph-DGri_zJm.js.map} +1 -1
  17. package/dist/graph.d.ts +155 -53
  18. package/dist/graph.js +946 -330
  19. package/dist/graph.js.map +1 -1
  20. package/dist/{improvement-cycle-a_L8FFql.js → improvement-cycle-BOd5DFeG.js} +4 -4
  21. package/dist/{improvement-cycle-a_L8FFql.js.map → improvement-cycle-BOd5DFeG.js.map} +1 -1
  22. package/dist/{index-BP11HXYi.d.ts → index-BGQtpQuJ.d.ts} +5 -5
  23. package/dist/{index-C2X-OVPZ.d.ts → index-BgptUCKl.d.ts} +4 -4
  24. package/dist/{index-OFOvnNc2.d.ts → index-CFMB9ux3.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 +7 -7
  31. package/dist/{knowledge-Ccdghy81.js → knowledge-7_IfyD9R.js} +5 -5
  32. package/dist/{knowledge-Ccdghy81.js.map → knowledge-7_IfyD9R.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-2NITRIFc.d.ts → loop-runner-bin-C2NXQK7J.d.ts} +3 -3
  36. package/dist/{loop-runner-bin-DM-AnPC-.js → loop-runner-bin-Dx-5GZQK.js} +3 -3
  37. package/dist/{loop-runner-bin-DM-AnPC-.js.map → loop-runner-bin-Dx-5GZQK.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-CIo9tB75.js → openai-tools-CDS7eSww.js} +2 -2
  44. package/dist/{openai-tools-CIo9tB75.js.map → openai-tools-CDS7eSww.js.map} +1 -1
  45. package/dist/{prepare-D7Fb75XR.js → prepare-BCScSDCv.js} +2 -2
  46. package/dist/{prepare-D7Fb75XR.js.map → prepare-BCScSDCv.js.map} +1 -1
  47. package/dist/primeintellect/index.d.ts +1 -1
  48. package/dist/{protected-model-port-RZkxRZhp.js → protected-model-port-D-5E3HBe.js} +2 -2
  49. package/dist/{protected-model-port-RZkxRZhp.js.map → protected-model-port-D-5E3HBe.js.map} +1 -1
  50. package/dist/{redact-D4vlt6p4.d.ts → redact-DkObldQP.d.ts} +3 -3
  51. package/dist/{runtime-D44YrQ4t.d.ts → runtime-B0HZbuEv.d.ts} +3 -3
  52. package/dist/{runtime-BDHsMgCK.js → runtime-DESENUe1.js} +7 -7
  53. package/dist/{runtime-BDHsMgCK.js.map → runtime-DESENUe1.js.map} +1 -1
  54. package/dist/{spawn-journal-oewq1g2h.js → spawn-journal-Tgvp5VS5.js} +8 -2
  55. package/dist/{spawn-journal-oewq1g2h.js.map → spawn-journal-Tgvp5VS5.js.map} +1 -1
  56. package/dist/{stream-agent-turn-Dx2YrEWW.d.ts → stream-agent-turn-DxQ3GOuR.d.ts} +2 -2
  57. package/dist/{structural-rollout-CBK2LHni.js → structural-rollout-DZGDg0yX.js} +3 -3
  58. package/dist/{structural-rollout-CBK2LHni.js.map → structural-rollout-DZGDg0yX.js.map} +1 -1
  59. package/dist/{supervise-CzllE0vn.js → supervise-Da20R0PO.js} +3 -3
  60. package/dist/{supervise-CzllE0vn.js.map → supervise-Da20R0PO.js.map} +1 -1
  61. package/dist/{supervisor-D5K8ihKQ.js → supervisor-DpIKMlPJ.js} +9 -5
  62. package/dist/{supervisor-D5K8ihKQ.js.map → supervisor-DpIKMlPJ.js.map} +1 -1
  63. package/dist/testing.d.ts +2 -2
  64. package/dist/testing.js +12 -12
  65. package/dist/{types-C2l1jaos.d.ts → types-DjVO-p7R.d.ts} +58 -3
  66. package/dist/{workspace-archive-DK0mDjSB.js → workspace-archive-CHY5HvrF.js} +2 -2
  67. package/dist/{workspace-archive-DK0mDjSB.js.map → workspace-archive-CHY5HvrF.js.map} +1 -1
  68. package/package.json +1 -1
package/dist/graph.d.ts CHANGED
@@ -1,6 +1,6 @@
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";
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-BGQtpQuJ.js";
2
+ import { H as SpawnJournal, K as Spend, V as SpawnEvent, i as Budget, j as ResultBlobStore, t as Agent } from "./types-DjVO-p7R.js";
3
+ import { o as ExecutorConfig } from "./runtime-B0HZbuEv.js";
4
4
  import { AgentProfile } from "@tangle-network/agent-interface";
5
5
  //#region src/runtime/graph/condition.d.ts
6
6
  /** The leaf comparison operators; `exists`/`truthy` are unary, the rest compare against `value`. */
@@ -330,6 +330,121 @@ declare function schemaAccepts(source: JsonSchema, target: JsonSchema, depth?: n
330
330
  */
331
331
  declare function compileGraph(engine: GraphEngine, spec: EngineGraphSpec, context?: string): CompiledGraph;
332
332
  //#endregion
333
+ //#region src/runtime/graph/scheduler-types.d.ts
334
+ /** Result vocabulary shared by the scheduler and the fold (agent-runtime#973, #974, #976). */
335
+ type GraphRunReason = 'all-children-down' | 'budget-exhausted' | 'aborted' | 'driver-failed' | 'cycle-budget-exceeded' | 'unreachable-terminal';
336
+ /** One node settlement as the graph result reports it. */
337
+ interface GraphNodeSettle {
338
+ readonly node: string;
339
+ readonly visit: number;
340
+ readonly status: 'done' | 'down';
341
+ /** The node's completion check verdict; `undefined` when the node declares no check. */
342
+ readonly valid?: boolean;
343
+ readonly out?: unknown;
344
+ readonly outRef?: string;
345
+ readonly reason?: string;
346
+ }
347
+ /** One ledgered edge firing (or refusal) — the run's observable data flow. */
348
+ interface GraphEdgeTraversal {
349
+ readonly edge: string;
350
+ readonly kind: 'delegates' | 'analyzes' | 'data';
351
+ readonly from: string;
352
+ readonly to: string;
353
+ readonly traversal: number;
354
+ readonly outcome: 'delivered' | 'empty' | 'unpropagated';
355
+ readonly directive?: string;
356
+ readonly port?: string;
357
+ readonly reason?: string;
358
+ }
359
+ type GraphRunResult = {
360
+ readonly kind: 'winner';
361
+ readonly out: unknown;
362
+ readonly terminals: ReadonlyArray<GraphNodeSettle>;
363
+ readonly settles: ReadonlyArray<GraphNodeSettle>;
364
+ readonly ledger: ReadonlyArray<GraphEdgeTraversal>;
365
+ } | {
366
+ readonly kind: 'no-winner';
367
+ readonly reason: GraphRunReason;
368
+ readonly error?: {
369
+ readonly name: string;
370
+ readonly message: string;
371
+ };
372
+ readonly terminals: ReadonlyArray<GraphNodeSettle>;
373
+ readonly settles: ReadonlyArray<GraphNodeSettle>;
374
+ readonly ledger: ReadonlyArray<GraphEdgeTraversal>;
375
+ /** Nodes provably stuck when the run ended: every upstream settled, no release possible. */
376
+ readonly unreachable: ReadonlyArray<string>;
377
+ } | {
378
+ /** Every live branch parked on a host wake: a legitimate terminal state for an offline run.
379
+ * Restart over the same journal and `resume(token, payload)` to continue (#976). */
380
+ readonly kind: 'suspended';
381
+ readonly tokens: ReadonlyArray<string>;
382
+ readonly terminals: ReadonlyArray<GraphNodeSettle>;
383
+ readonly settles: ReadonlyArray<GraphNodeSettle>;
384
+ readonly ledger: ReadonlyArray<GraphEdgeTraversal>;
385
+ };
386
+ //#endregion
387
+ //#region src/runtime/graph/fold.d.ts
388
+ type FoldEdgeState = 'pending' | 'satisfied' | 'dead' | 'failed';
389
+ interface FoldEdge {
390
+ state: FoldEdgeState;
391
+ /** Set by a `join-state` whose wave this edge was pending inside; cleared when the in-flight
392
+ * completion it refers to settles (absorbed, never re-released). */
393
+ consumedOnce: boolean;
394
+ /** Delivered consumptions — what the per-edge cap counts. */
395
+ traversals: number;
396
+ /** How many of the source's settles this edge has accounted for — by a journaled verdict or by
397
+ * an absorption. The idempotence key: a kill between a settle and its verdicts re-judges ONLY
398
+ * the unaccounted edges on restart, never a judged or absorbed one twice. */
399
+ judgedSourceSettles: number;
400
+ /** The admitted source payload this state reflects (the source settle's outRef). */
401
+ payloadRef?: string;
402
+ capped: boolean;
403
+ }
404
+ type FoldInstanceStatus = 'released' | 'live' | 'done' | 'down' | 'suspended';
405
+ interface FoldInstance {
406
+ readonly node: string;
407
+ readonly instance: string;
408
+ readonly visit: number;
409
+ inputRef?: string;
410
+ status: FoldInstanceStatus;
411
+ settle?: GraphNodeSettle;
412
+ }
413
+ interface FoldSuspension {
414
+ readonly token: string;
415
+ readonly node: string;
416
+ readonly instance: string;
417
+ readonly onExpire: 'wait' | 'fail' | 'default';
418
+ readonly expiresAtMs?: number;
419
+ readonly defaultRef?: string;
420
+ status: 'pending' | 'woken' | 'expired';
421
+ }
422
+ interface FoldNode {
423
+ visits: number;
424
+ blocked: boolean;
425
+ settles: GraphNodeSettle[];
426
+ }
427
+ interface GraphFoldState {
428
+ readonly nodes: Map<string, FoldNode>;
429
+ readonly edges: Map<string, FoldEdge>;
430
+ /** Every node instance the journal knows, keyed by `<node>#<visit>`. */
431
+ readonly instances: Map<string, FoldInstance>;
432
+ /** Kernel node id → engine instance label, from `spawned`. */
433
+ readonly spawnedIds: Map<string, string>;
434
+ readonly suspensions: Map<string, FoldSuspension>;
435
+ readonly exhaustedEdges: Set<string>;
436
+ }
437
+ /** The reducer's zero: every node unvisited, every edge pending, nothing suspended. */
438
+ declare function emptyFoldState(compiled: CompiledGraph): GraphFoldState;
439
+ /**
440
+ * Apply ONE journal event. The live scheduler calls this right after each append; the restart path
441
+ * calls it over the loaded journal. Unknown kernel events are ignored — the engine folds only what
442
+ * it understands, exactly as the kernel's replay skips the engine's events.
443
+ */
444
+ declare function applyGraphFoldEvent(state: GraphFoldState, ev: SpawnEvent, compiled: CompiledGraph): void;
445
+ /** Fold a loaded journal (append order) into scheduler state. */
446
+ declare function foldGraphJournal(events: ReadonlyArray<SpawnEvent>, compiled: CompiledGraph): GraphFoldState;
447
+ //#endregion
333
448
  //#region src/runtime/graph/kinds.d.ts
334
449
  interface AgentKindConfig {
335
450
  /** Where this node's profile runs. Omit to inherit the engine's default backend. */
@@ -394,49 +509,26 @@ declare function subgraphKind(): NodeKind<{
394
509
  }>;
395
510
  //#endregion
396
511
  //#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;
512
+ /** Engine-appended `woken` ordinals start here far above any kernel cursor counter. */
513
+ declare const ENGINE_WOKEN_SEQ_BASE = 10000000;
514
+ declare const SUSPEND_MARK = "__graphSuspension";
515
+ interface SuspensionRequest {
516
+ readonly [SUSPEND_MARK]: true;
517
+ readonly onExpire: 'wait' | 'fail' | 'default';
518
+ /** Milliseconds from the suspension's journaling instant; absent with `onExpire: 'wait'`. */
519
+ readonly expiresInMs?: number;
520
+ readonly default?: unknown;
408
521
  }
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
- };
522
+ /** What a kind's executor returns to park its node on a host wake (agent-runtime#976). */
523
+ declare function suspended(options?: {
524
+ readonly onExpire?: 'wait' | 'fail' | 'default';
525
+ readonly expiresInMs?: number;
526
+ readonly default?: unknown;
527
+ }): SuspensionRequest;
528
+ /** Admission for every value crossing an edge (#971): JSON round-trip, `undefined` stripped, a
529
+ * non-representable value becomes a RECORD of that fact — a degraded record beats a vanished
530
+ * edge. */
531
+ declare function admitPayload(value: unknown): unknown;
440
532
  interface GraphRunOptions {
441
533
  /** The run's conserved pool. */
442
534
  readonly budget: Budget;
@@ -452,16 +544,26 @@ interface GraphRunOptions {
452
544
  readonly signal?: AbortSignal;
453
545
  readonly now?: () => number;
454
546
  readonly runId?: string;
547
+ /** Continue an existing journaled run. An existing tree without this refuses, like the kernel. */
548
+ readonly resume?: boolean;
549
+ /** Hold a fully-suspended run open for live `resume()` calls instead of returning
550
+ * `{ kind: 'suspended' }`. Offline callers leave this off and restart later (#976). */
551
+ readonly waitForWakes?: boolean;
455
552
  }
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;
553
+ /** A live run: await `done`; deliver host wakes through `resume`/`expire` (#976). */
554
+ interface GraphRunHandle {
555
+ readonly done: Promise<GraphRunResult>;
556
+ resume(token: string, payload: unknown): Promise<void>;
557
+ expire(token: string): Promise<void>;
558
+ }
559
+ /** Run a graph to its result: `createGraphRun` awaited — the one-call form for a run that needs
560
+ * no live host wakes. */
561
+ declare function runEngineGraph(engine: GraphEngine, spec: EngineGraphSpec | CompiledGraph, task: string, options: GraphRunOptions): Promise<GraphRunResult>;
460
562
  /**
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.
563
+ * Start (or resume) a graph run and return its handle: await `done` for the result; deliver host
564
+ * wakes through `resume`/`expire` while it runs (#976).
463
565
  */
464
- declare function runEngineGraph(engine: GraphEngine, spec: EngineGraphSpec | CompiledGraph, task: string, options: GraphRunOptions): Promise<GraphRunResult>;
566
+ declare function createGraphRun(engine: GraphEngine, spec: EngineGraphSpec | CompiledGraph, task: string, options: GraphRunOptions): GraphRunHandle;
465
567
  //#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 };
568
+ export { type AgentKindConfig, type BudgetMode, CONDITION_OPS, type CompiledEdge, type CompiledGraph, type CompiledNode, type Condition, type ConditionLeaf, type ConditionOp, DEFAULT_MAX_NODE_VISITS, ENGINE_WOKEN_SEQ_BASE, type EffectContext, type EffectName, type EngineGraphEdge, type EngineGraphNode, type EngineGraphSpec, type FoldEdge, type FoldEdgeState, type FoldInstance, type FoldInstanceStatus, type FoldNode, type FoldSuspension, type GraphEdgeKind, type GraphEdgeTraversal, type GraphEngine, type GraphEngineOptions, type GraphFoldState, type GraphNodeSettle, type GraphRunHandle, 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, type SuspensionRequest, admitPayload, agentKind, applyGraphFoldEvent, applyProjection, compileGraph, createGraphEngine, createGraphRun, createRegistry, emptyFoldState, evaluateCondition, foldGraphJournal, formatRegistryHandle, kindHandle, narrowEffects, parseRegistryHandle, runEngineGraph, schemaAccepts, scriptKind, subgraphKind, supervisorKind, suspended, validateCondition, validateNodeKind, validateProjection };
467
569
  //# sourceMappingURL=graph.d.ts.map