@nodetool-ai/kernel 0.7.0-rc.23 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/README.md +51 -0
  2. package/dist/.nodetool-build-stamp +1 -0
  3. package/dist/actor.d.ts +381 -20
  4. package/dist/actor.d.ts.map +1 -1
  5. package/dist/actor.js +1619 -184
  6. package/dist/actor.js.map +1 -1
  7. package/dist/correlation-analysis.d.ts +104 -0
  8. package/dist/correlation-analysis.d.ts.map +1 -0
  9. package/dist/correlation-analysis.js +833 -0
  10. package/dist/correlation-analysis.js.map +1 -0
  11. package/dist/durable-inbox.d.ts +9 -0
  12. package/dist/durable-inbox.d.ts.map +1 -1
  13. package/dist/durable-inbox.js +55 -2
  14. package/dist/durable-inbox.js.map +1 -1
  15. package/dist/dynamic-slots.d.ts +58 -0
  16. package/dist/dynamic-slots.d.ts.map +1 -0
  17. package/dist/dynamic-slots.js +182 -0
  18. package/dist/dynamic-slots.js.map +1 -0
  19. package/dist/edge-ids.d.ts +11 -0
  20. package/dist/edge-ids.d.ts.map +1 -0
  21. package/dist/edge-ids.js +15 -0
  22. package/dist/edge-ids.js.map +1 -0
  23. package/dist/graph-utils.d.ts +12 -0
  24. package/dist/graph-utils.d.ts.map +1 -1
  25. package/dist/graph-utils.js +51 -16
  26. package/dist/graph-utils.js.map +1 -1
  27. package/dist/graph.d.ts +50 -9
  28. package/dist/graph.d.ts.map +1 -1
  29. package/dist/graph.js +308 -101
  30. package/dist/graph.js.map +1 -1
  31. package/dist/inbox.d.ts +158 -2
  32. package/dist/inbox.d.ts.map +1 -1
  33. package/dist/inbox.js +253 -11
  34. package/dist/inbox.js.map +1 -1
  35. package/dist/index.d.ts +13 -10
  36. package/dist/index.d.ts.map +1 -1
  37. package/dist/index.js +10 -7
  38. package/dist/index.js.map +1 -1
  39. package/dist/io.d.ts +103 -6
  40. package/dist/io.d.ts.map +1 -1
  41. package/dist/io.js +123 -12
  42. package/dist/io.js.map +1 -1
  43. package/dist/loop.d.ts +36 -0
  44. package/dist/loop.d.ts.map +1 -0
  45. package/dist/loop.js +166 -0
  46. package/dist/loop.js.map +1 -0
  47. package/dist/predicates.d.ts +8 -0
  48. package/dist/predicates.d.ts.map +1 -0
  49. package/dist/predicates.js +8 -0
  50. package/dist/predicates.js.map +1 -0
  51. package/dist/run-state.d.ts +65 -0
  52. package/dist/run-state.d.ts.map +1 -0
  53. package/dist/run-state.js +42 -0
  54. package/dist/run-state.js.map +1 -0
  55. package/dist/runner.d.ts +312 -15
  56. package/dist/runner.d.ts.map +1 -1
  57. package/dist/runner.js +1219 -156
  58. package/dist/runner.js.map +1 -1
  59. package/dist/substitute-validator.d.ts +44 -0
  60. package/dist/substitute-validator.d.ts.map +1 -0
  61. package/dist/substitute-validator.js +169 -0
  62. package/dist/substitute-validator.js.map +1 -0
  63. package/dist/supervisor.d.ts +148 -0
  64. package/dist/supervisor.d.ts.map +1 -0
  65. package/dist/supervisor.js +287 -0
  66. package/dist/supervisor.js.map +1 -0
  67. package/dist/trigger-wakeup.d.ts +74 -5
  68. package/dist/trigger-wakeup.d.ts.map +1 -1
  69. package/dist/trigger-wakeup.js +167 -45
  70. package/dist/trigger-wakeup.js.map +1 -1
  71. package/package.json +27 -9
  72. package/dist/channel.d.ts +0 -46
  73. package/dist/channel.d.ts.map +0 -1
  74. package/dist/channel.js +0 -191
  75. package/dist/channel.js.map +0 -1
  76. package/dist/suspendable.d.ts +0 -68
  77. package/dist/suspendable.d.ts.map +0 -1
  78. package/dist/suspendable.js +0 -108
  79. package/dist/suspendable.js.map +0 -1
  80. package/dist/trigger-manager.d.ts +0 -107
  81. package/dist/trigger-manager.d.ts.map +0 -1
  82. package/dist/trigger-manager.js +0 -214
  83. package/dist/trigger-manager.js.map +0 -1
  84. package/dist/trigger.d.ts +0 -57
  85. package/dist/trigger.d.ts.map +0 -1
  86. package/dist/trigger.js +0 -145
  87. package/dist/trigger.js.map +0 -1
package/dist/io.d.ts CHANGED
@@ -7,21 +7,61 @@
7
7
  * NodeOutputs provides an emit-based output interface backed by callbacks
8
8
  * supplied by the actor/runner, decoupled from WorkflowRunner internals.
9
9
  */
10
+ import type { CorrelationLineage } from "@nodetool-ai/protocol";
10
11
  import type { MessageEnvelope } from "./inbox.js";
11
12
  import { NodeInbox } from "./inbox.js";
13
+ import type { NodeAnalysis, Scope } from "./correlation-analysis.js";
12
14
  export declare class NodeInputs {
13
15
  private _inbox;
14
- constructor(inbox: NodeInbox);
16
+ private _envelopeTracker;
17
+ private _analysis;
18
+ private _signal;
19
+ /**
20
+ * `envelopeTracker`, when provided, records the most recently consumed
21
+ * envelope per handle. The actor passes its own `_lastEnvelopes` map so
22
+ * raw `stream()`/`first()`/`any()` consumers still surface lineage to the
23
+ * actor — that's how unmigrated stream filters (Take, Drop, Filter*)
24
+ * inherit lineage even when they call `outputs.emit()` with no options.
25
+ *
26
+ * `analysis` is the per-node static correlation analysis; nodes that need
27
+ * scope information at runtime (Zip/Cross) read it via `scopeFor()` and
28
+ * `invocationScope()`.
29
+ *
30
+ * `signal` is the run's cancellation signal (aborted by
31
+ * `WorkflowRunner.cancel()`). Defaults to a never-aborted signal so test
32
+ * fixtures that construct NodeInputs directly stay terse.
33
+ */
34
+ constructor(inbox: NodeInbox, envelopeTracker?: Map<string, MessageEnvelope> | null, analysis?: NodeAnalysis, signal?: AbortSignal);
35
+ /**
36
+ * Aborted when the run is cancelled. Inbox closure only unblocks
37
+ * consumers; producing loops (generators, pacers) must observe this.
38
+ */
39
+ get signal(): AbortSignal;
40
+ /**
41
+ * Static scope of a connected input handle, or `[]` when analysis is off
42
+ * or the handle has no scope.
43
+ */
44
+ scopeFor(handle: string): Scope;
45
+ /**
46
+ * The node's invocation scope (largest comparable input scope, or longest
47
+ * common parent prefix on join nodes), or `[]` when analysis is off.
48
+ */
49
+ invocationScope(): Scope;
15
50
  /**
16
51
  * Return the first available item for a handle, or default if EOS.
52
+ *
53
+ * HOLDOUT (anti-slop/no-unknown-returns): the item is whatever the upstream
54
+ * node put on the handle — the open workflow-value domain, which NodeTool
55
+ * has no named union for. The kernel never inspects the payload.
17
56
  */
18
57
  first(name: string, defaultValue?: unknown): Promise<unknown>;
19
58
  /**
20
59
  * Return the first available MessageEnvelope for a handle, or default if EOS.
21
60
  */
22
- firstWithEnvelope(name: string, defaultValue?: unknown): Promise<MessageEnvelope | unknown>;
61
+ firstWithEnvelope<TDefault>(name: string, defaultValue?: TDefault): Promise<MessageEnvelope | TDefault | undefined>;
23
62
  /**
24
- * Async generator: yields items until EOS.
63
+ * Async generator: yields items until EOS. The most recent envelope per
64
+ * handle is recorded so the actor can derive invocation lineage.
25
65
  */
26
66
  stream(name: string): AsyncGenerator<unknown>;
27
67
  /**
@@ -45,16 +85,39 @@ export declare class NodeInputs {
45
85
  */
46
86
  hasStream(name: string): boolean;
47
87
  }
88
+ export interface EmitOptions {
89
+ /**
90
+ * Override the lineage propagated downstream for this emission.
91
+ * Used by `outputs.forward()` to copy the source envelope's lineage; can be
92
+ * supplied directly when a stream node mints lineage itself.
93
+ */
94
+ lineage?: CorrelationLineage;
95
+ }
48
96
  export interface NodeOutputsOptions {
49
97
  /**
50
98
  * Called for each emitted (slot, value) pair to route the value downstream.
51
99
  * If not provided, outputs are only collected locally.
100
+ *
101
+ * `opts.lineage` is forwarded to the inbox `put()` call so the downstream
102
+ * envelope carries the correct correlation lineage.
52
103
  */
53
- sendFn?: (slot: string, value: unknown) => Promise<void>;
104
+ sendFn?: (slot: string, value: unknown, opts?: EmitOptions) => Promise<void>;
54
105
  /**
55
106
  * Called when complete(slot) is invoked to signal early EOS on a slot.
56
107
  */
57
108
  eosCallback?: (slot: string) => void;
109
+ /**
110
+ * Send `lineage_done` for `slot` at the projected key carried by
111
+ * `envelope`. Wired by the actor so a stream node calling `outputs.drop()`
112
+ * propagates the slot's done signal to downstream inboxes.
113
+ */
114
+ dropFn?: (slot: string, envelope: MessageEnvelope) => Promise<void>;
115
+ /**
116
+ * Atomically emit a frame across multiple slots, minting one shared token
117
+ * per iteration group so sibling handles in a group share lineage. Falls
118
+ * back to sequential `sendFn` if not supplied.
119
+ */
120
+ emitGroupFn?: (values: Record<string, unknown>, opts?: EmitOptions) => Promise<void>;
58
121
  }
59
122
  /**
60
123
  * Emitter wrapper for routing node outputs.
@@ -68,17 +131,49 @@ export declare class NodeOutputs {
68
131
  private _collected;
69
132
  private _sendFn;
70
133
  private _eosCallback;
134
+ private _dropFn;
135
+ private _emitGroupFn;
71
136
  constructor(opts?: NodeOutputsOptions);
137
+ /**
138
+ * Atomically emit a frame across multiple slots, sharing one minted token
139
+ * per iteration group. Required for stream-mode iteration outputs (Zip,
140
+ * Cross) so paired sibling handles do not get split into independent
141
+ * items. §1.
142
+ *
143
+ * Falls back to sequential `emit()` (which mints independently per slot)
144
+ * if no `emitGroupFn` is wired — preserved for test fixtures with no
145
+ * actor.
146
+ */
147
+ emitGroup(values: Record<string, unknown>, opts?: EmitOptions): Promise<void>;
72
148
  /**
73
149
  * Emit a value to a named output slot.
74
150
  * Routes downstream via sendFn (if set) and collects the last value per slot.
75
151
  * An empty or null slot name defaults to "output".
152
+ *
153
+ * If `opts.lineage` is provided, that lineage is propagated to the
154
+ * downstream envelope; otherwise the actor's ambient invocation lineage is
155
+ * used.
76
156
  */
77
- emit(slot: string, value: unknown): Promise<void>;
157
+ emit(slot: string, value: unknown, opts?: EmitOptions): Promise<void>;
78
158
  /**
79
159
  * Convenience: emit to the "output" slot.
80
160
  */
81
161
  default(value: unknown): Promise<void>;
162
+ /**
163
+ * Forward an envelope to `slot`, preserving its correlation lineage.
164
+ *
165
+ * With two arguments, the envelope's `data` is forwarded unchanged. With
166
+ * three arguments, the caller-supplied value replaces it — including
167
+ * `null`/`undefined`, which would otherwise be indistinguishable from
168
+ * "not supplied" if we used `??`.
169
+ */
170
+ forward(slot: string, envelope: MessageEnvelope, ...overrideValue: [] | [unknown]): Promise<void>;
171
+ /**
172
+ * Send `lineage_done` for `slot` at the projected key carried by
173
+ * `envelope`, via the actor's drop callback, so downstream inboxes learn the
174
+ * slot produced no value for this lineage.
175
+ */
176
+ drop(slot: string, envelope: MessageEnvelope): Promise<void>;
82
177
  /**
83
178
  * Signal early end-of-stream for a specific output slot.
84
179
  * Calls the eosCallback if provided.
@@ -87,6 +182,8 @@ export declare class NodeOutputs {
87
182
  /**
88
183
  * Return a snapshot of all collected outputs (slot → last emitted value).
89
184
  */
90
- collected(): Record<string, unknown>;
185
+ collected(): {
186
+ [x: string]: unknown;
187
+ };
91
188
  }
92
189
  //# sourceMappingURL=io.d.ts.map
package/dist/io.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"io.d.ts","sourceRoot":"","sources":["../src/io.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,qBAAa,UAAU;IACrB,OAAO,CAAC,MAAM,CAAY;gBAEd,KAAK,EAAE,SAAS;IAI5B;;OAEG;IACG,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IAOnE;;OAEG;IACG,iBAAiB,CACrB,IAAI,EAAE,MAAM,EACZ,YAAY,CAAC,EAAE,OAAO,GACrB,OAAO,CAAC,eAAe,GAAG,OAAO,CAAC;IAOrC;;OAEG;IACI,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,CAAC,OAAO,CAAC;IAMpD;;OAEG;IACI,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,CAAC,eAAe,CAAC;IAMxE;;OAEG;IACI,GAAG,IAAI,cAAc,CAAC,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAM/C;;OAEG;IACI,eAAe,IAAI,cAAc,CAAC,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IA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AAE,MAAM,EACZ,QAAQ,EAAE,eAAe,EACzB,GAAG,aAAa,EAAE,EAAE,GAAG,CAAC,OAAO,CAAC,GAC/B,OAAO,CAAC,IAAI,CAAC,CAMf;IAED;;;;OAIG;IACG,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAIjE;IAED;;;OAGG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAI3B;IAED;;OAEG;IACH,SAAS;;MAER;CACF"}
package/dist/io.js CHANGED
@@ -9,15 +9,62 @@
9
9
  */
10
10
  export class NodeInputs {
11
11
  _inbox;
12
- constructor(inbox) {
12
+ _envelopeTracker;
13
+ _analysis;
14
+ _signal;
15
+ /**
16
+ * `envelopeTracker`, when provided, records the most recently consumed
17
+ * envelope per handle. The actor passes its own `_lastEnvelopes` map so
18
+ * raw `stream()`/`first()`/`any()` consumers still surface lineage to the
19
+ * actor — that's how unmigrated stream filters (Take, Drop, Filter*)
20
+ * inherit lineage even when they call `outputs.emit()` with no options.
21
+ *
22
+ * `analysis` is the per-node static correlation analysis; nodes that need
23
+ * scope information at runtime (Zip/Cross) read it via `scopeFor()` and
24
+ * `invocationScope()`.
25
+ *
26
+ * `signal` is the run's cancellation signal (aborted by
27
+ * `WorkflowRunner.cancel()`). Defaults to a never-aborted signal so test
28
+ * fixtures that construct NodeInputs directly stay terse.
29
+ */
30
+ constructor(inbox, envelopeTracker, analysis, signal) {
13
31
  this._inbox = inbox;
32
+ this._envelopeTracker = envelopeTracker ?? null;
33
+ this._analysis = analysis;
34
+ this._signal = signal ?? new AbortController().signal;
35
+ }
36
+ /**
37
+ * Aborted when the run is cancelled. Inbox closure only unblocks
38
+ * consumers; producing loops (generators, pacers) must observe this.
39
+ */
40
+ get signal() {
41
+ return this._signal;
42
+ }
43
+ /**
44
+ * Static scope of a connected input handle, or `[]` when analysis is off
45
+ * or the handle has no scope.
46
+ */
47
+ scopeFor(handle) {
48
+ return this._analysis?.inputs.get(handle)?.scope ?? [];
49
+ }
50
+ /**
51
+ * The node's invocation scope (largest comparable input scope, or longest
52
+ * common parent prefix on join nodes), or `[]` when analysis is off.
53
+ */
54
+ invocationScope() {
55
+ return this._analysis?.invocationScope ?? [];
14
56
  }
15
57
  /**
16
58
  * Return the first available item for a handle, or default if EOS.
59
+ *
60
+ * HOLDOUT (anti-slop/no-unknown-returns): the item is whatever the upstream
61
+ * node put on the handle — the open workflow-value domain, which NodeTool
62
+ * has no named union for. The kernel never inspects the payload.
17
63
  */
18
64
  async first(name, defaultValue) {
19
- for await (const item of this._inbox.iterInput(name)) {
20
- return item;
65
+ for await (const envelope of this._inbox.iterInputWithEnvelope(name)) {
66
+ this._envelopeTracker?.set(name, envelope);
67
+ return envelope.data;
21
68
  }
22
69
  return defaultValue;
23
70
  }
@@ -26,16 +73,19 @@ export class NodeInputs {
26
73
  */
27
74
  async firstWithEnvelope(name, defaultValue) {
28
75
  for await (const envelope of this._inbox.iterInputWithEnvelope(name)) {
76
+ this._envelopeTracker?.set(name, envelope);
29
77
  return envelope;
30
78
  }
31
79
  return defaultValue;
32
80
  }
33
81
  /**
34
- * Async generator: yields items until EOS.
82
+ * Async generator: yields items until EOS. The most recent envelope per
83
+ * handle is recorded so the actor can derive invocation lineage.
35
84
  */
36
85
  async *stream(name) {
37
- for await (const item of this._inbox.iterInput(name)) {
38
- yield item;
86
+ for await (const envelope of this._inbox.iterInputWithEnvelope(name)) {
87
+ this._envelopeTracker?.set(name, envelope);
88
+ yield envelope.data;
39
89
  }
40
90
  }
41
91
  /**
@@ -43,6 +93,7 @@ export class NodeInputs {
43
93
  */
44
94
  async *streamWithEnvelope(name) {
45
95
  for await (const envelope of this._inbox.iterInputWithEnvelope(name)) {
96
+ this._envelopeTracker?.set(name, envelope);
46
97
  yield envelope;
47
98
  }
48
99
  }
@@ -50,16 +101,18 @@ export class NodeInputs {
50
101
  * Async generator: yields [handle, item] tuples in arrival order.
51
102
  */
52
103
  async *any() {
53
- for await (const tuple of this._inbox.iterAny()) {
54
- yield tuple;
104
+ for await (const [handle, envelope] of this._inbox.iterAnyWithEnvelope()) {
105
+ this._envelopeTracker?.set(handle, envelope);
106
+ yield [handle, envelope.data];
55
107
  }
56
108
  }
57
109
  /**
58
110
  * Async generator: yields [handle, MessageEnvelope] tuples.
59
111
  */
60
112
  async *anyWithEnvelope() {
61
- for await (const tuple of this._inbox.iterAnyWithEnvelope()) {
62
- yield tuple;
113
+ for await (const [handle, envelope] of this._inbox.iterAnyWithEnvelope()) {
114
+ this._envelopeTracker?.set(handle, envelope);
115
+ yield [handle, envelope];
63
116
  }
64
117
  }
65
118
  /**
@@ -87,28 +140,86 @@ export class NodeOutputs {
87
140
  _collected = {};
88
141
  _sendFn;
89
142
  _eosCallback;
143
+ _dropFn;
144
+ _emitGroupFn;
90
145
  constructor(opts = {}) {
91
146
  this._sendFn = opts.sendFn ?? null;
92
147
  this._eosCallback = opts.eosCallback ?? null;
148
+ this._dropFn = opts.dropFn ?? null;
149
+ this._emitGroupFn = opts.emitGroupFn ?? null;
150
+ }
151
+ /**
152
+ * Atomically emit a frame across multiple slots, sharing one minted token
153
+ * per iteration group. Required for stream-mode iteration outputs (Zip,
154
+ * Cross) so paired sibling handles do not get split into independent
155
+ * items. §1.
156
+ *
157
+ * Falls back to sequential `emit()` (which mints independently per slot)
158
+ * if no `emitGroupFn` is wired — preserved for test fixtures with no
159
+ * actor.
160
+ */
161
+ async emitGroup(values, opts) {
162
+ for (const [slot, value] of Object.entries(values)) {
163
+ this._collected[slot] = value;
164
+ }
165
+ if (this._emitGroupFn) {
166
+ await this._emitGroupFn(values, opts);
167
+ return;
168
+ }
169
+ for (const [slot, value] of Object.entries(values)) {
170
+ if (this._sendFn) {
171
+ await this._sendFn(slot, value, opts);
172
+ }
173
+ }
93
174
  }
94
175
  /**
95
176
  * Emit a value to a named output slot.
96
177
  * Routes downstream via sendFn (if set) and collects the last value per slot.
97
178
  * An empty or null slot name defaults to "output".
179
+ *
180
+ * If `opts.lineage` is provided, that lineage is propagated to the
181
+ * downstream envelope; otherwise the actor's ambient invocation lineage is
182
+ * used.
98
183
  */
99
- async emit(slot, value) {
184
+ async emit(slot, value, opts) {
100
185
  const resolvedSlot = slot || "output";
101
186
  this._collected[resolvedSlot] = value;
102
187
  if (this._sendFn) {
103
- await this._sendFn(resolvedSlot, value);
188
+ await this._sendFn(resolvedSlot, value, opts);
104
189
  }
105
190
  }
106
191
  /**
107
192
  * Convenience: emit to the "output" slot.
108
193
  */
109
194
  async default(value) {
195
+ // Stryker disable next-line StringLiteral: emit() maps a falsy slot to
196
+ // "output" via `slot || "output"`, so passing "output" vs "" is identical.
110
197
  await this.emit("output", value);
111
198
  }
199
+ /**
200
+ * Forward an envelope to `slot`, preserving its correlation lineage.
201
+ *
202
+ * With two arguments, the envelope's `data` is forwarded unchanged. With
203
+ * three arguments, the caller-supplied value replaces it — including
204
+ * `null`/`undefined`, which would otherwise be indistinguishable from
205
+ * "not supplied" if we used `??`.
206
+ */
207
+ async forward(slot, envelope, ...overrideValue) {
208
+ const value = overrideValue.length > 0 ? overrideValue[0] : envelope.data;
209
+ await this.emit(slot, value, {
210
+ lineage: envelope.correlation_lineage
211
+ });
212
+ }
213
+ /**
214
+ * Send `lineage_done` for `slot` at the projected key carried by
215
+ * `envelope`, via the actor's drop callback, so downstream inboxes learn the
216
+ * slot produced no value for this lineage.
217
+ */
218
+ async drop(slot, envelope) {
219
+ if (this._dropFn) {
220
+ await this._dropFn(slot || "output", envelope);
221
+ }
222
+ }
112
223
  /**
113
224
  * Signal early end-of-stream for a specific output slot.
114
225
  * Calls the eosCallback if provided.
package/dist/io.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"io.js","sourceRoot":"","sources":["../src/io.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,MAAM,OAAO,UAAU;IACb,MAAM,CAAY;IAE1B,YAAY,KAAgB;QAC1B,IAAI,CAAC,MAA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I,CAAC,OAAO,EAAE,CAAC;YACjB,MAAM,IAAI,CAAC,OAAO,CAAC,IAAI,IAAI,QAAQ,EAAE,QAAQ,CAAC,CAAC;QACjD,CAAC;IACH,CAAC;IAED;;;OAGG;IACH,QAAQ,CAAC,IAAY;QACnB,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;YACtB,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC;IAED;;OAEG;IACH,SAAS;QACP,OAAO,EAAE,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;IAChC,CAAC;CACF"}
package/dist/loop.d.ts ADDED
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Loop node runtime: the actor mode for `nodetool.control.Loop`.
3
+ *
4
+ * A Loop starts one run per parent key of `initial`, emits each iteration on
5
+ * `value`/`index` under the loop root, and waits for the body to feed back
6
+ * `next` (and `condition` when wired) for that iteration. It then either
7
+ * starts the next iteration or emits `done` at the parent key.
8
+ *
9
+ * The body is a cycle, so its EOS cannot end the loop. The Loop closes
10
+ * `value`/`index` itself once `initial` has closed and no run is active; EOS
11
+ * then flows around the body into the feedback inputs and the inbox drains.
12
+ * Runs whose feedback can no longer arrive end without a `done` value: when a
13
+ * feedback input has closed, or when the runner reports the graph quiescent.
14
+ * docs/workflow-loops.md.
15
+ */
16
+ import type { CorrelationLineage, NodeDescriptor } from "@nodetool-ai/protocol";
17
+ import type { NodeAnalysis } from "./correlation-analysis.js";
18
+ import type { NodeInbox } from "./inbox.js";
19
+ export declare const DEFAULT_MAX_ITERATIONS = 10;
20
+ export declare const MAX_ITERATIONS_LIMIT = 1000;
21
+ /** Clamp the `max_iterations` property to [1, MAX_ITERATIONS_LIMIT]. */
22
+ export declare function resolveMaxIterations(raw: unknown): number;
23
+ /** What the Loop runtime needs from its actor. */
24
+ export interface LoopHost {
25
+ node: NodeDescriptor;
26
+ inbox: NodeInbox;
27
+ analysis: NodeAnalysis;
28
+ /** Route `value` on `slot` downstream with an explicit lineage. */
29
+ emit(slot: string, value: unknown, lineage: CorrelationLineage): Promise<void>;
30
+ /** Close an output slot early (EOS on its outgoing edges). */
31
+ closeSlot(slot: string): void;
32
+ /** Surface a node warning to the client. */
33
+ warn(message: string): void;
34
+ }
35
+ export declare function runLoop(host: LoopHost): Promise<void>;
36
+ //# sourceMappingURL=loop.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loop.d.ts","sourceRoot":"","sources":["../src/loop.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,KAAK,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEhF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAE9D,OAAO,KAAK,EAAmB,SAAS,EAAE,MAAM,YAAY,CAAC;AAK7D,eAAO,MAAM,sBAAsB,KAAK,CAAC;AACzC,eAAO,MAAM,oBAAoB,OAAO,CAAC;AAEzC,wEAAwE;AACxE,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAIzD;AAED,kDAAkD;AAClD,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,cAAc,CAAC;IACrB,KAAK,EAAE,SAAS,CAAC;IACjB,QAAQ,EAAE,YAAY,CAAC;IACvB,mEAAmE;IACnE,IAAI,CACF,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,OAAO,EACd,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,IAAI,CAAC,CAAC;IACjB,8DAA8D;IAC9D,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,4CAA4C;IAC5C,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B;AASD,wBAAsB,OAAO,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAkJ3D"}
package/dist/loop.js ADDED
@@ -0,0 +1,166 @@
1
+ /**
2
+ * Loop node runtime: the actor mode for `nodetool.control.Loop`.
3
+ *
4
+ * A Loop starts one run per parent key of `initial`, emits each iteration on
5
+ * `value`/`index` under the loop root, and waits for the body to feed back
6
+ * `next` (and `condition` when wired) for that iteration. It then either
7
+ * starts the next iteration or emits `done` at the parent key.
8
+ *
9
+ * The body is a cycle, so its EOS cannot end the loop. The Loop closes
10
+ * `value`/`index` itself once `initial` has closed and no run is active; EOS
11
+ * then flows around the body into the feedback inputs and the inbox drains.
12
+ * Runs whose feedback can no longer arrive end without a `done` value: when a
13
+ * feedback input has closed, or when the runner reports the graph quiescent.
14
+ * docs/workflow-loops.md.
15
+ */
16
+ import { createLogger } from "@nodetool-ai/config";
17
+ import { loopRootId } from "@nodetool-ai/protocol";
18
+ import { tryProjectLineageKey } from "./correlation-analysis.js";
19
+ // Stryker disable next-line StringLiteral: logger name is a diagnostic label
20
+ const log = createLogger("nodetool.kernel.loop");
21
+ export const DEFAULT_MAX_ITERATIONS = 10;
22
+ export const MAX_ITERATIONS_LIMIT = 1000;
23
+ /** Clamp the `max_iterations` property to [1, MAX_ITERATIONS_LIMIT]. */
24
+ export function resolveMaxIterations(raw) {
25
+ const n = Math.floor(Number(raw ?? DEFAULT_MAX_ITERATIONS));
26
+ if (!Number.isFinite(n))
27
+ return DEFAULT_MAX_ITERATIONS;
28
+ return Math.min(MAX_ITERATIONS_LIMIT, Math.max(1, n));
29
+ }
30
+ export async function runLoop(host) {
31
+ const { node, inbox, analysis } = host;
32
+ const parentScope = analysis.invocationScope;
33
+ const root = loopRootId(node.id);
34
+ const maxIterations = resolveMaxIterations(node.properties?.max_iterations);
35
+ const handles = new Set(inbox.handles());
36
+ const initialWired = handles.has("initial");
37
+ const conditionWired = handles.has("condition");
38
+ const runs = new Map();
39
+ const started = new Set();
40
+ let iterationsClosed = false;
41
+ const parentOf = (lineage) => {
42
+ const parent = {};
43
+ for (const r of parentScope) {
44
+ const token = lineage[r];
45
+ if (token)
46
+ parent[r] = token;
47
+ }
48
+ return parent;
49
+ };
50
+ const emitIteration = async (run, value) => {
51
+ const lineage = { ...run.parent, [root]: { index: run.iteration } };
52
+ await host.emit("value", value, lineage);
53
+ await host.emit("index", run.iteration, lineage);
54
+ };
55
+ const start = async (lineage, value) => {
56
+ const key = tryProjectLineageKey(lineage, parentScope) ?? "";
57
+ if (started.has(key)) {
58
+ log.warn("Loop ignored a second initial value for the same key", {
59
+ nodeId: node.id,
60
+ key
61
+ });
62
+ return;
63
+ }
64
+ started.add(key);
65
+ const run = { parent: parentOf(lineage), iteration: 0 };
66
+ runs.set(key, run);
67
+ await emitIteration(run, value);
68
+ };
69
+ const endWithoutResult = (key, reason) => {
70
+ const run = runs.get(key);
71
+ if (!run)
72
+ return;
73
+ runs.delete(key);
74
+ log.info("Loop run ended without a result", {
75
+ nodeId: node.id,
76
+ key,
77
+ iteration: run.iteration,
78
+ reason
79
+ });
80
+ };
81
+ const decide = async (key, run) => {
82
+ const value = run.next.data;
83
+ const again = conditionWired ? Boolean(run.condition.data) : true;
84
+ if (again && run.iteration + 1 < maxIterations) {
85
+ run.iteration += 1;
86
+ run.next = undefined;
87
+ run.condition = undefined;
88
+ await emitIteration(run, value);
89
+ return;
90
+ }
91
+ if (again && conditionWired) {
92
+ host.warn(`Loop stopped after max_iterations (${maxIterations}) while its condition was still true.`);
93
+ }
94
+ runs.delete(key);
95
+ await host.emit("done", value, run.parent);
96
+ };
97
+ const onFeedback = async (handle, env) => {
98
+ const key = tryProjectLineageKey(env.correlation_lineage, parentScope);
99
+ const run = key === null ? undefined : runs.get(key);
100
+ const iteration = env.correlation_lineage[root]?.index;
101
+ if (!run || iteration !== run.iteration) {
102
+ log.warn("Loop dropped feedback for an iteration that is not waiting", {
103
+ nodeId: node.id,
104
+ handle,
105
+ key,
106
+ iteration
107
+ });
108
+ return;
109
+ }
110
+ if (run[handle]) {
111
+ log.warn("Loop received a second feedback value for one iteration", {
112
+ nodeId: node.id,
113
+ handle,
114
+ key,
115
+ iteration
116
+ });
117
+ }
118
+ run[handle] = env;
119
+ if (run.next && (!conditionWired || run.condition)) {
120
+ await decide(key, run);
121
+ }
122
+ };
123
+ const closedAndEmpty = (handle) => !inbox.isOpen(handle) && !inbox.hasBuffered(handle);
124
+ if (!initialWired) {
125
+ await start({}, node.properties?.initial ?? null);
126
+ }
127
+ while (true) {
128
+ const popped = inbox.tryPopAnyWithEnvelope();
129
+ if (popped) {
130
+ const [handle, env] = popped;
131
+ if (handle === "initial") {
132
+ await start(env.correlation_lineage, env.data);
133
+ }
134
+ else if (handle === "next" || handle === "condition") {
135
+ await onFeedback(handle, env);
136
+ }
137
+ continue;
138
+ }
139
+ if (inbox.isClosed())
140
+ break;
141
+ if (inbox.takeQuiescent()) {
142
+ for (const key of [...runs.keys()]) {
143
+ endWithoutResult(key, "the loop body stopped feeding back");
144
+ }
145
+ }
146
+ for (const [key, run] of [...runs]) {
147
+ if (!run.next && closedAndEmpty("next")) {
148
+ endWithoutResult(key, '"next" closed');
149
+ }
150
+ else if (conditionWired && !run.condition && closedAndEmpty("condition")) {
151
+ endWithoutResult(key, '"condition" closed');
152
+ }
153
+ }
154
+ if (!iterationsClosed &&
155
+ runs.size === 0 &&
156
+ (!initialWired || closedAndEmpty("initial"))) {
157
+ iterationsClosed = true;
158
+ host.closeSlot("value");
159
+ host.closeSlot("index");
160
+ }
161
+ if (inbox.isFullyDrained())
162
+ break;
163
+ await inbox.waitForActivity();
164
+ }
165
+ }
166
+ //# sourceMappingURL=loop.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loop.js","sourceRoot":"","sources":["../src/loop.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAGjE,6EAA6E;AAC7E,MAAM,GAAG,GAAG,YAAY,CAA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AC,IAAI,KAAK,CAAC;YACf,CAAC,CAAC,YAAY,IAAI,cAAc,CAAC,SAAS,CAAC,CAAC,EAC5C,CAAC;YACD,gBAAgB,GAAG,IAAI,CAAC;YACxB,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;YACxB,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QAC1B,CAAC;QAED,IAAI,KAAK,CAAC,cAAc,EAAE;YAAE,MAAM;QAClC,MAAM,KAAK,CAAC,eAAe,EAAE,CAAC;IAChC,CAAC;AACH,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * The workspace's named type predicates, re-exported for the runner's call
3
+ * sites. The definitions live in `@nodetool-ai/protocol`.
4
+ */
5
+ export { isBoolean, isCallable, isNonEmptyString, isNumber, isString,
6
+ /** An object value. Arrays pass — the sites that care test `Array.isArray`. */
7
+ isObjectLike as isObjectValue } from "@nodetool-ai/protocol";
8
+ //# sourceMappingURL=predicates.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"predicates.d.ts","sourceRoot":"","sources":["../src/predicates.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,SAAS,EACT,UAAU,EACV,gBAAgB,EAChB,QAAQ,EACR,QAAQ;AACR,+EAA+E;AAC/E,YAAY,IAAI,aAAa,EAC9B,MAAM,uBAAuB,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * The workspace's named type predicates, re-exported for the runner's call
3
+ * sites. The definitions live in `@nodetool-ai/protocol`.
4
+ */
5
+ export { isBoolean, isCallable, isNonEmptyString, isNumber, isString,
6
+ /** An object value. Arrays pass — the sites that care test `Array.isArray`. */
7
+ isObjectLike as isObjectValue } from "@nodetool-ai/protocol";
8
+ //# sourceMappingURL=predicates.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"predicates.js","sourceRoot":"","sources":["../src/predicates.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,SAAS,EACT,UAAU,EACV,gBAAgB,EAChB,QAAQ,EACR,QAAQ;AACR,+EAA+E;AAC/E,YAAY,IAAI,aAAa,EAC9B,MAAM,uBAAuB,CAAC"}