@telorun/sdk 0.83.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.
- package/dist/module-context.d.ts +30 -1
- package/dist/module-context.d.ts.map +1 -1
- package/dist/resolve-ref-instance.d.ts.map +1 -1
- package/dist/resolve-ref-instance.js +5 -1
- package/dist/step-engine.d.ts +30 -0
- package/dist/step-engine.d.ts.map +1 -1
- package/dist/step-engine.js +19 -1
- package/package.json +1 -1
- package/src/module-context.ts +27 -1
- package/src/resolve-ref-instance.ts +5 -1
- package/src/step-engine.ts +20 -1
package/dist/module-context.d.ts
CHANGED
|
@@ -42,7 +42,36 @@ export interface ModuleContext extends EvaluationContext {
|
|
|
42
42
|
} | undefined;
|
|
43
43
|
/** Resolve a cross-module exported-instance reference `Alias.name` to its live instance. */
|
|
44
44
|
resolveImportedInstance(alias: string, name: string): ResourceInstance | undefined;
|
|
45
|
-
|
|
45
|
+
/**
|
|
46
|
+
* Resolve a sibling by NAME.
|
|
47
|
+
*
|
|
48
|
+
* A resolution taken while the module is still initializing is RECORDED,
|
|
49
|
+
* because a caller that resolves during `init()` may hold what it gets, and
|
|
50
|
+
* nothing in the manifest says so: a name passed here is invisible to the
|
|
51
|
+
* reference walk that builds the dependency edges, so a host rebuilding that
|
|
52
|
+
* resource cannot know this caller is holding it. Recording is what makes the
|
|
53
|
+
* host fall back to rebuilding the whole context instead of silently leaving
|
|
54
|
+
* a holder pointing at a dead instance.
|
|
55
|
+
*
|
|
56
|
+
* A resolution taken after initialization is not recorded: it re-resolves per
|
|
57
|
+
* dispatch, so there is nothing to hold and nothing to invalidate.
|
|
58
|
+
*
|
|
59
|
+
* Prefer an `x-telo-ref` slot, which declares the edge and costs the caller
|
|
60
|
+
* nothing at run time — the kernel injects the live instance before `init()`.
|
|
61
|
+
* This is for the case a slot cannot express, and its cost is that the
|
|
62
|
+
* resource it names can no longer be rebuilt on its own.
|
|
63
|
+
*
|
|
64
|
+
* `declaredBy` is for the one caller that has a declared slot behind it and
|
|
65
|
+
* only wants the lookup: the SDK's own `!ref` resolution, for a reference that
|
|
66
|
+
* reached a controller as a raw sentinel instead of being injected. Passing
|
|
67
|
+
* the resolved ref suppresses the record, because the edge is in the manifest
|
|
68
|
+
* already. There is deliberately no second METHOD for this — a public door
|
|
69
|
+
* whose documentation asks you not to use it is one that gets used.
|
|
70
|
+
*/
|
|
71
|
+
getInstance(name: string, declaredBy?: {
|
|
72
|
+
kind: string;
|
|
73
|
+
name: string;
|
|
74
|
+
}): unknown;
|
|
46
75
|
getInvocable<TInput = Record<string, any>, TOutput = any>(name: string): Invocable<TInput, TOutput>;
|
|
47
76
|
resolveKind(kind: string): string;
|
|
48
77
|
runTargets(ctx?: InvokeContext): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module-context.d.ts","sourceRoot":"","sources":["../src/module-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE/D;;;;;;;;;GASG;AACH,MAAM,WAAW,aAAc,SAAQ,iBAAiB;IACtD,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC5C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC1C,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAE5C,4EAA4E;IA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,gBAAgB,GAAG,SAAS,CAAC;CACnE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAClC,KAAK,EAAE,OAAO,EACd,GAAG,EAAE,iBAAiB,EACtB,KAAK,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,SAAS,IAAI,CAAC,EAC7C,QAAQ,EAAE,MAAM,MAAM,EACtB,OAAO,CAAC,EAAE,MAAM,GACf,CAAC,
|
|
1
|
+
{"version":3,"file":"resolve-ref-instance.d.ts","sourceRoot":"","sources":["../src/resolve-ref-instance.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAG/D,oEAAoE;AACpE,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAC;IACtC;;;;;;;OAOG;IACH,oBAAoB,CAAC,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB,GAAG,SAAS,CAAC;CACnE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAClC,KAAK,EAAE,OAAO,EACd,GAAG,EAAE,iBAAiB,EACtB,KAAK,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,SAAS,IAAI,CAAC,EAC7C,QAAQ,EAAE,MAAM,MAAM,EACtB,OAAO,CAAC,EAAE,MAAM,GACf,CAAC,CAqCH"}
|
|
@@ -47,7 +47,11 @@ export function resolveRefInstance(value, ctx, guard, describe, expects) {
|
|
|
47
47
|
// it is an alias that crosses no import boundary.
|
|
48
48
|
const instance = ref.alias && ref.alias !== "Self"
|
|
49
49
|
? ctx.moduleContext.resolveImportedInstance(ref.alias, ref.name)
|
|
50
|
-
:
|
|
50
|
+
: // The DECLARED door: this name came out of a ref slot, so the edge is
|
|
51
|
+
// already in the manifest and recording it would mark the target
|
|
52
|
+
// unreconcilable on the strength of a reference the host can see.
|
|
53
|
+
(ctx.resolveLocalInstance?.(ref.name) ??
|
|
54
|
+
ctx.moduleContext.getInstance(ref.name, { kind: ref.kind, name: ref.name }));
|
|
51
55
|
if (!guard(instance)) {
|
|
52
56
|
const label = ref.alias ? `${ref.alias}.${ref.name}` : ref.name;
|
|
53
57
|
throw new RuntimeError("ERR_REF_UNRESOLVED", `${describe()} reference '${label}' did not resolve to a ${target}` +
|
package/dist/step-engine.d.ts
CHANGED
|
@@ -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,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAUvD,OAAO,EAAqB,KAAK,UAAU,EAAE,KAAK,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAC9F,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAEtD;;;;;;;;GAQG;AACH,MAAM,WAAW,iBAAkB,SAAQ,iBAAiB;IAC1D,aAAa,CAAC,KAAK,EAAE,GAAG,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CAC3D;AAED,MAAM,WAAW,MAAM;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,IAAI,EAAE,CAAC;IACb,MAAM,CAAC,EAAE,KAAK,CAAC;QACb,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,IAAI,EAAE,CAAC;KACd,CAAC,CAAC;IACH,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC;CACf;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,EAAE,EAAE,IAAI,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b,gBAAgB;YA2BhB,iBAAiB;IAoC/B;;;gEAG4D;YAC9C,gBAAgB;IAkC9B,OAAO,CAAC,gBAAgB;YA0BV,cAAc;CA4F7B;AAcD;;yCAEyC;AACzC,wBAAgB,eAAe,CAAC,GAAG,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG,aAAa,CAU7E;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,YAAY,CAAC,SAAS,CAAC,EAAE,aAAa,GAAG,MAAM,CAE9D;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,YAAY,CAAC,SAAS,EAAE,aAAa,GAAG,SAAS,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAEvF"}
|
package/dist/step-engine.js
CHANGED
|
@@ -360,6 +360,24 @@ export function toSequenceError(err, stepName) {
|
|
|
360
360
|
* other segment the grammar produces (`then`, `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
package/src/module-context.ts
CHANGED
|
@@ -43,7 +43,33 @@ export interface ModuleContext extends EvaluationContext {
|
|
|
43
43
|
resolveImportedRef(alias: string, name: string): { kind: string; name: string } | undefined;
|
|
44
44
|
/** Resolve a cross-module exported-instance reference `Alias.name` to its live instance. */
|
|
45
45
|
resolveImportedInstance(alias: string, name: string): ResourceInstance | undefined;
|
|
46
|
-
|
|
46
|
+
/**
|
|
47
|
+
* Resolve a sibling by NAME.
|
|
48
|
+
*
|
|
49
|
+
* A resolution taken while the module is still initializing is RECORDED,
|
|
50
|
+
* because a caller that resolves during `init()` may hold what it gets, and
|
|
51
|
+
* nothing in the manifest says so: a name passed here is invisible to the
|
|
52
|
+
* reference walk that builds the dependency edges, so a host rebuilding that
|
|
53
|
+
* resource cannot know this caller is holding it. Recording is what makes the
|
|
54
|
+
* host fall back to rebuilding the whole context instead of silently leaving
|
|
55
|
+
* a holder pointing at a dead instance.
|
|
56
|
+
*
|
|
57
|
+
* A resolution taken after initialization is not recorded: it re-resolves per
|
|
58
|
+
* dispatch, so there is nothing to hold and nothing to invalidate.
|
|
59
|
+
*
|
|
60
|
+
* Prefer an `x-telo-ref` slot, which declares the edge and costs the caller
|
|
61
|
+
* nothing at run time — the kernel injects the live instance before `init()`.
|
|
62
|
+
* This is for the case a slot cannot express, and its cost is that the
|
|
63
|
+
* resource it names can no longer be rebuilt on its own.
|
|
64
|
+
*
|
|
65
|
+
* `declaredBy` is for the one caller that has a declared slot behind it and
|
|
66
|
+
* only wants the lookup: the SDK's own `!ref` resolution, for a reference that
|
|
67
|
+
* reached a controller as a raw sentinel instead of being injected. Passing
|
|
68
|
+
* the resolved ref suppresses the record, because the edge is in the manifest
|
|
69
|
+
* already. There is deliberately no second METHOD for this — a public door
|
|
70
|
+
* whose documentation asks you not to use it is one that gets used.
|
|
71
|
+
*/
|
|
72
|
+
getInstance(name: string, declaredBy?: { kind: string; name: string }): unknown;
|
|
47
73
|
getInvocable<TInput = Record<string, any>, TOutput = any>(
|
|
48
74
|
name: string,
|
|
49
75
|
): Invocable<TInput, TOutput>;
|
|
@@ -77,7 +77,11 @@ export function resolveRefInstance<T>(
|
|
|
77
77
|
const instance =
|
|
78
78
|
ref.alias && ref.alias !== "Self"
|
|
79
79
|
? ctx.moduleContext.resolveImportedInstance(ref.alias, ref.name)
|
|
80
|
-
:
|
|
80
|
+
: // The DECLARED door: this name came out of a ref slot, so the edge is
|
|
81
|
+
// already in the manifest and recording it would mark the target
|
|
82
|
+
// unreconcilable on the strength of a reference the host can see.
|
|
83
|
+
(ctx.resolveLocalInstance?.(ref.name) ??
|
|
84
|
+
ctx.moduleContext.getInstance(ref.name, { kind: ref.kind as string, name: ref.name }));
|
|
81
85
|
|
|
82
86
|
if (!guard(instance)) {
|
|
83
87
|
const label = ref.alias ? `${ref.alias}.${ref.name}` : ref.name;
|
package/src/step-engine.ts
CHANGED
|
@@ -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
|
+
}
|