@telorun/sdk 0.86.0 → 0.87.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.
@@ -167,4 +167,34 @@ export declare class StepEngine {
167
167
  * Shared with the composers' whole-operation `catches:`, so one caught failure
168
168
  * has one shape wherever it is read. */
169
169
  export declare function toSequenceError(err: unknown, stepName: string): SequenceError;
170
+ /**
171
+ * Where a step list's journal keys hang from.
172
+ *
173
+ * At the top of a durable run there is no ambient path and the base is `steps`.
174
+ * Inside one, it is the path of the step that dispatched this body — so a nested
175
+ * sequence's `work` becomes `steps/importAll/work` rather than a second
176
+ * `steps/work`, and two nested bodies can no longer collide.
177
+ *
178
+ * The dispatching step's path is used directly rather than with a `steps`
179
+ * segment appended: the parent path already names one dispatch site, and every
180
+ * other segment the grammar produces (`then`, `do[2]`, `cases/x`) is distinct
181
+ * from a step name, so nothing else can generate the same key.
182
+ */
183
+ export declare function baseStepPath(invokeCtx?: InvokeContext): string;
184
+ /**
185
+ * The journal prefix for ONE turn of a composer that runs its body repeatedly —
186
+ * an iteration's item, a loop's turn, a projection's element.
187
+ *
188
+ * A composer that runs its body N times and journals every turn under the SAME
189
+ * prefix is not merely imprecise: the journal takes the first writer at a key,
190
+ * so turns 2..N replay turn 1's recorded outcome instead of executing. The work
191
+ * is silently skipped and the run still completes. The engine's own `while`
192
+ * already qualifies each turn this way (`stepPath(path, "do", turn)`); a
193
+ * controller driving the body itself has to do the same, and this is that
194
+ * prefix so the three of them cannot spell it differently.
195
+ *
196
+ * The index is the turn's position, which is stable across a replay because the
197
+ * collection it indexes is derived from values the run has already journaled.
198
+ */
199
+ export declare function turnStepPath(invokeCtx: InvokeContext | undefined, turn: number): string;
170
200
  //# sourceMappingURL=step-engine.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"step-engine.d.ts","sourceRoot":"","sources":["../src/step-engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAGH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do[2]`, `cases/x`) is distinct
361
361
  * from a step name, so nothing else can generate the same key.
362
362
  */
363
- function baseStepPath(invokeCtx) {
363
+ export function baseStepPath(invokeCtx) {
364
364
  return invokeCtx?.durablePath ?? "steps";
365
365
  }
366
+ /**
367
+ * The journal prefix for ONE turn of a composer that runs its body repeatedly —
368
+ * an iteration's item, a loop's turn, a projection's element.
369
+ *
370
+ * A composer that runs its body N times and journals every turn under the SAME
371
+ * prefix is not merely imprecise: the journal takes the first writer at a key,
372
+ * so turns 2..N replay turn 1's recorded outcome instead of executing. The work
373
+ * is silently skipped and the run still completes. The engine's own `while`
374
+ * already qualifies each turn this way (`stepPath(path, "do", turn)`); a
375
+ * controller driving the body itself has to do the same, and this is that
376
+ * prefix so the three of them cannot spell it differently.
377
+ *
378
+ * The index is the turn's position, which is stable across a replay because the
379
+ * collection it indexes is derived from values the run has already journaled.
380
+ */
381
+ export function turnStepPath(invokeCtx, turn) {
382
+ return stepPath(baseStepPath(invokeCtx), turn);
383
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@telorun/sdk",
3
- "version": "0.86.0",
3
+ "version": "0.87.0",
4
4
  "description": "Telo SDK - Public API for Telo module authors.",
5
5
  "keywords": [
6
6
  "telo",
@@ -622,6 +622,25 @@ export function toSequenceError(err: unknown, stepName: string): SequenceError {
622
622
  * other segment the grammar produces (`then`, `do[2]`, `cases/x`) is distinct
623
623
  * from a step name, so nothing else can generate the same key.
624
624
  */
625
- function baseStepPath(invokeCtx?: InvokeContext): string {
625
+ export function baseStepPath(invokeCtx?: InvokeContext): string {
626
626
  return invokeCtx?.durablePath ?? "steps";
627
627
  }
628
+
629
+ /**
630
+ * The journal prefix for ONE turn of a composer that runs its body repeatedly —
631
+ * an iteration's item, a loop's turn, a projection's element.
632
+ *
633
+ * A composer that runs its body N times and journals every turn under the SAME
634
+ * prefix is not merely imprecise: the journal takes the first writer at a key,
635
+ * so turns 2..N replay turn 1's recorded outcome instead of executing. The work
636
+ * is silently skipped and the run still completes. The engine's own `while`
637
+ * already qualifies each turn this way (`stepPath(path, "do", turn)`); a
638
+ * controller driving the body itself has to do the same, and this is that
639
+ * prefix so the three of them cannot spell it differently.
640
+ *
641
+ * The index is the turn's position, which is stable across a replay because the
642
+ * collection it indexes is derived from values the run has already journaled.
643
+ */
644
+ export function turnStepPath(invokeCtx: InvokeContext | undefined, turn: number): string {
645
+ return stepPath(baseStepPath(invokeCtx), turn);
646
+ }