@dudousxd/nestjs-durable-core 0.106.1 → 0.106.2
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 +15 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -4632,6 +4632,13 @@ declare class WorkflowEngine {
|
|
|
4632
4632
|
* step yet) and deduped to distinct groups.
|
|
4633
4633
|
*/
|
|
4634
4634
|
private inflightStepGroups;
|
|
4635
|
+
/**
|
|
4636
|
+
* Whether a streamed step event comes from the turn its run awaits. A dispatched turn that went
|
|
4637
|
+
* quiet past the silence window is dispatched again, but its first worker may still be replaying it
|
|
4638
|
+
* and streaming its steps; written unchecked, those would put a stale turn's output under the live
|
|
4639
|
+
* turn's checkpoint. An event without a `taskId` (a worker from before the field) is kept.
|
|
4640
|
+
*/
|
|
4641
|
+
private stepEventFromAwaitedTurn;
|
|
4635
4642
|
/**
|
|
4636
4643
|
* Persist a streamed local-step lifecycle event from a remote workflow worker (see
|
|
4637
4644
|
* {@link WorkflowStepEvent}). A Python `@workflow` runs its `ctx.step`s inline over one turn that
|
|
@@ -7700,6 +7707,13 @@ interface WorkflowDecision {
|
|
|
7700
7707
|
*/
|
|
7701
7708
|
interface WorkflowStepEvent {
|
|
7702
7709
|
runId: string;
|
|
7710
|
+
/**
|
|
7711
|
+
* The dispatched turn ({@link WorkflowTask.taskId}) whose replay ran the step. The engine keeps an
|
|
7712
|
+
* event only while the run still awaits that turn, so a turn that went quiet, was dispatched again
|
|
7713
|
+
* and kept running on its first worker cannot write over the live turn's checkpoints. Absent (a
|
|
7714
|
+
* worker from before this field): the event is kept, unchecked.
|
|
7715
|
+
*/
|
|
7716
|
+
taskId?: string | undefined;
|
|
7703
7717
|
seq: number;
|
|
7704
7718
|
name: string;
|
|
7705
7719
|
phase: 'running' | 'completed' | 'failed';
|
package/dist/index.d.ts
CHANGED
|
@@ -4632,6 +4632,13 @@ declare class WorkflowEngine {
|
|
|
4632
4632
|
* step yet) and deduped to distinct groups.
|
|
4633
4633
|
*/
|
|
4634
4634
|
private inflightStepGroups;
|
|
4635
|
+
/**
|
|
4636
|
+
* Whether a streamed step event comes from the turn its run awaits. A dispatched turn that went
|
|
4637
|
+
* quiet past the silence window is dispatched again, but its first worker may still be replaying it
|
|
4638
|
+
* and streaming its steps; written unchecked, those would put a stale turn's output under the live
|
|
4639
|
+
* turn's checkpoint. An event without a `taskId` (a worker from before the field) is kept.
|
|
4640
|
+
*/
|
|
4641
|
+
private stepEventFromAwaitedTurn;
|
|
4635
4642
|
/**
|
|
4636
4643
|
* Persist a streamed local-step lifecycle event from a remote workflow worker (see
|
|
4637
4644
|
* {@link WorkflowStepEvent}). A Python `@workflow` runs its `ctx.step`s inline over one turn that
|
|
@@ -7700,6 +7707,13 @@ interface WorkflowDecision {
|
|
|
7700
7707
|
*/
|
|
7701
7708
|
interface WorkflowStepEvent {
|
|
7702
7709
|
runId: string;
|
|
7710
|
+
/**
|
|
7711
|
+
* The dispatched turn ({@link WorkflowTask.taskId}) whose replay ran the step. The engine keeps an
|
|
7712
|
+
* event only while the run still awaits that turn, so a turn that went quiet, was dispatched again
|
|
7713
|
+
* and kept running on its first worker cannot write over the live turn's checkpoints. Absent (a
|
|
7714
|
+
* worker from before this field): the event is kept, unchecked.
|
|
7715
|
+
*/
|
|
7716
|
+
taskId?: string | undefined;
|
|
7703
7717
|
seq: number;
|
|
7704
7718
|
name: string;
|
|
7705
7719
|
phase: 'running' | 'completed' | 'failed';
|
package/dist/index.js
CHANGED
|
@@ -12877,6 +12877,20 @@ var WorkflowEngine = class _WorkflowEngine {
|
|
|
12877
12877
|
];
|
|
12878
12878
|
}
|
|
12879
12879
|
/**
|
|
12880
|
+
* Whether a streamed step event comes from the turn its run awaits. A dispatched turn that went
|
|
12881
|
+
* quiet past the silence window is dispatched again, but its first worker may still be replaying it
|
|
12882
|
+
* and streaming its steps; written unchecked, those would put a stale turn's output under the live
|
|
12883
|
+
* turn's checkpoint. An event without a `taskId` (a worker from before the field) is kept.
|
|
12884
|
+
*/
|
|
12885
|
+
async stepEventFromAwaitedTurn(event) {
|
|
12886
|
+
if (event.taskId === void 0) return true;
|
|
12887
|
+
const run = await this.store.getRun(event.runId);
|
|
12888
|
+
if (!run) return false;
|
|
12889
|
+
return awaitsDecision(run, {
|
|
12890
|
+
taskId: event.taskId
|
|
12891
|
+
});
|
|
12892
|
+
}
|
|
12893
|
+
/**
|
|
12880
12894
|
* Persist a streamed local-step lifecycle event from a remote workflow worker (see
|
|
12881
12895
|
* {@link WorkflowStepEvent}). A Python `@workflow` runs its `ctx.step`s inline over one turn that
|
|
12882
12896
|
* can last minutes; the worker streams each step's start/finish so the engine checkpoints it LIVE —
|
|
@@ -12886,6 +12900,7 @@ var WorkflowEngine = class _WorkflowEngine {
|
|
|
12886
12900
|
* idempotently, so this is purely additive observability and never changes the run's outcome.
|
|
12887
12901
|
*/
|
|
12888
12902
|
async persistStepEvent(event) {
|
|
12903
|
+
if (!await this.stepEventFromAwaitedTurn(event)) return;
|
|
12889
12904
|
const startedAt = new Date(event.startedAt);
|
|
12890
12905
|
if (event.phase === "running") {
|
|
12891
12906
|
await this.store.saveCheckpoint(stepCheckpoint({
|