@dudousxd/nestjs-durable-core 0.106.1 → 0.106.3
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/index.cjs +21 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +19 -2
- package/dist/index.d.ts +19 -2
- package/dist/index.js +21 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -13180,6 +13180,20 @@ var WorkflowEngine = class _WorkflowEngine {
|
|
|
13180
13180
|
];
|
|
13181
13181
|
}
|
|
13182
13182
|
/**
|
|
13183
|
+
* Whether a streamed step event comes from the turn its run awaits. A dispatched turn that went
|
|
13184
|
+
* quiet past the silence window is dispatched again, but its first worker may still be replaying it
|
|
13185
|
+
* and streaming its steps; written unchecked, those would put a stale turn's output under the live
|
|
13186
|
+
* turn's checkpoint. An event without a `taskId` (a worker from before the field) is kept.
|
|
13187
|
+
*/
|
|
13188
|
+
async stepEventFromAwaitedTurn(event) {
|
|
13189
|
+
if (event.taskId === void 0) return true;
|
|
13190
|
+
const run = await this.store.getRun(event.runId);
|
|
13191
|
+
if (!run) return false;
|
|
13192
|
+
return awaitsDecision(run, {
|
|
13193
|
+
taskId: event.taskId
|
|
13194
|
+
});
|
|
13195
|
+
}
|
|
13196
|
+
/**
|
|
13183
13197
|
* Persist a streamed local-step lifecycle event from a remote workflow worker (see
|
|
13184
13198
|
* {@link WorkflowStepEvent}). A Python `@workflow` runs its `ctx.step`s inline over one turn that
|
|
13185
13199
|
* can last minutes; the worker streams each step's start/finish so the engine checkpoints it LIVE —
|
|
@@ -13189,6 +13203,7 @@ var WorkflowEngine = class _WorkflowEngine {
|
|
|
13189
13203
|
* idempotently, so this is purely additive observability and never changes the run's outcome.
|
|
13190
13204
|
*/
|
|
13191
13205
|
async persistStepEvent(event) {
|
|
13206
|
+
if (!await this.stepEventFromAwaitedTurn(event)) return;
|
|
13192
13207
|
const startedAt = new Date(event.startedAt);
|
|
13193
13208
|
if (event.phase === "running") {
|
|
13194
13209
|
await this.store.saveCheckpoint(stepCheckpoint({
|
|
@@ -16370,7 +16385,8 @@ ${run.workflowVersion}`;
|
|
|
16370
16385
|
if (!settle2) {
|
|
16371
16386
|
return this.savePendingCheckpoints(settlements.map((s, i) => ({
|
|
16372
16387
|
...settled[i],
|
|
16373
|
-
...s
|
|
16388
|
+
...s,
|
|
16389
|
+
wakeAt: void 0
|
|
16374
16390
|
})));
|
|
16375
16391
|
}
|
|
16376
16392
|
if (settlements.length > 1) {
|
|
@@ -18694,7 +18710,8 @@ var InMemoryStateStore = class {
|
|
|
18694
18710
|
if (cp?.status !== "pending") return false;
|
|
18695
18711
|
this.checkpoints.set(key, {
|
|
18696
18712
|
...cp,
|
|
18697
|
-
...settlement
|
|
18713
|
+
...settlement,
|
|
18714
|
+
wakeAt: void 0
|
|
18698
18715
|
});
|
|
18699
18716
|
return true;
|
|
18700
18717
|
});
|
|
@@ -18766,7 +18783,8 @@ var InMemoryStateStore = class {
|
|
|
18766
18783
|
const cp = before.get(this.key(settlement.runId, settlement.seq));
|
|
18767
18784
|
out[at[k]] = {
|
|
18768
18785
|
...cp,
|
|
18769
|
-
...settlement
|
|
18786
|
+
...settlement,
|
|
18787
|
+
wakeAt: void 0
|
|
18770
18788
|
};
|
|
18771
18789
|
});
|
|
18772
18790
|
return out;
|