@voltro/workflow 0.85.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/CHANGELOG.md +5987 -0
- package/THIRD-PARTY-NOTICES.md +1122 -31
- package/dist/admission.js +140 -0
- package/dist/admissionDrainer.js +705 -0
- package/dist/admissionGate.js +115 -0
- package/dist/admissionStore.js +347 -0
- package/dist/admissionSubmission.js +297 -0
- package/dist/admissionTables.js +137 -0
- package/dist/admissionTransaction.js +21 -0
- package/dist/awaitEvent.js +82 -0
- package/dist/budgetHold.js +136 -0
- package/dist/cancelOnPlan.js +75 -0
- package/dist/cancelOnSweep.js +188 -0
- package/dist/cancelPendingStart.js +50 -0
- package/dist/cluster.d.ts +111 -27
- package/dist/cluster.js +12 -2
- package/dist/clusterCron.js +19 -0
- package/dist/clusterDiagnostics.js +20 -0
- package/dist/clusterDiagnosticsSql.js +145 -0
- package/dist/clusterLayer.js +145 -0
- package/dist/clusterMigrationGate.js +61 -0
- package/dist/clusterRunnerLayer.js +31 -0
- package/dist/clusterShardGroups.js +33 -0
- package/dist/clusterTestSuite.d.ts +23 -0
- package/dist/clusterTestSuite.js +209 -179
- package/dist/controlMonitor.js +13 -0
- package/dist/controlRequest.js +367 -0
- package/dist/executionRefusal.js +162 -0
- package/dist/failureHandoff.js +183 -0
- package/dist/failureMessage.js +12 -0
- package/dist/failureRecovery.js +50 -0
- package/dist/failureReportStore.js +60 -0
- package/dist/flowControl.js +142 -0
- package/dist/forwardStartReceipts.js +41 -0
- package/dist/inMemoryLayer.js +7 -0
- package/dist/inMemoryRecorder.js +56 -0
- package/dist/index.d.ts +129 -30
- package/dist/index.js +50 -5
- package/dist/inspectWorkflow.js +101 -0
- package/dist/{journalEncryption-DTyhUzaS.js → journalEncryption.js} +30 -37
- package/dist/journalRoutingGuard.js +50 -0
- package/dist/journalRoutingLayout.js +47 -0
- package/dist/journalRoutingLock.js +39 -0
- package/dist/journalRoutingMaintenance.js +24 -0
- package/dist/journalRoutingMessageStorage.js +32 -0
- package/dist/journalRoutingNamespace.js +23 -0
- package/dist/journalRoutingRuntime.js +33 -0
- package/dist/journalRoutingSharding.js +28 -0
- package/dist/journalRoutingState.js +93 -0
- package/dist/journalRoutingTable.js +11 -0
- package/dist/journalRoutingTransaction.js +16 -0
- package/dist/messages.js +92 -0
- package/dist/nondeterminism.js +51 -0
- package/dist/parentClosure.js +141 -0
- package/dist/parentClosureRecovery.js +54 -0
- package/dist/pendingSubmission.js +85 -0
- package/dist/prepareSubmissionDispatch.js +17 -0
- package/dist/preparedExecution.js +14 -0
- package/dist/primitives.js +225 -2
- package/dist/queuedCancellationRequest.js +364 -0
- package/dist/queuedControl.js +21 -0
- package/dist/recorder.js +11 -0
- package/dist/residentExecutionEvidence.js +64 -0
- package/dist/retryPolicy.js +57 -0
- package/dist/runEventsTable.js +17 -0
- package/dist/runGeneration.js +345 -0
- package/dist/runRecording.js +615 -0
- package/dist/runStepsTable.js +28 -0
- package/dist/runnerStorageGuard.js +29 -0
- package/dist/runsTable.js +42 -0
- package/dist/scheduleDeclaration.js +44 -0
- package/dist/signalHint.js +23 -0
- package/dist/signals.js +70 -0
- package/dist/signalsSuspending.js +57 -0
- package/dist/sqliteWorkflowOwnership.js +26 -0
- package/dist/stalenessSweep.js +191 -0
- package/dist/startContextsTable.js +20 -0
- package/dist/startReceipt.js +143 -0
- package/dist/submissionRecovery.js +122 -0
- package/dist/submissionRejection.js +10 -0
- package/dist/submissionRetry.js +71 -0
- package/dist/suspensionUnavailable.js +9 -0
- package/dist/updates.js +87 -0
- package/dist/watermarkTable.js +9 -0
- package/dist/webCrypto.js +17 -0
- package/dist/workflowDelivery.js +24 -0
- package/dist/workflowExecutorRouting.js +33 -0
- package/dist/workflowJournal.js +124 -0
- package/dist/workflowJournalReset.js +111 -0
- package/dist/workflowReadSelections.js +12 -0
- package/dist/workflowRestartDispatch.js +35 -0
- package/dist/workflowRestartObservation.js +60 -0
- package/dist/workflowRestartPreparation.js +109 -0
- package/dist/workflowRestartReservation.js +427 -0
- package/dist/workflowResumeDispatch.js +30 -0
- package/dist/workflowRuntimeReadiness.js +12 -0
- package/dist/workflowShardRelocation.js +58 -0
- package/dist/workflowShardRelocationSql.js +72 -0
- package/package.json +4 -4
- package/dist/cluster-F_bhqVP7.js +0 -679
- package/dist/primitives-DX04WTWh.js +0 -507
- package/dist/src-C2NEyUM8.js +0 -3925
- package/dist/workflowReadSelections-CZAUjP7f.js +0 -2096
package/dist/index.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ import { FieldBinding } from '@voltro/database';
|
|
|
10
10
|
import { FieldCipher } from '@voltro/database';
|
|
11
11
|
import { FieldDefinitions } from '@voltro/database';
|
|
12
12
|
import { Layer } from 'effect';
|
|
13
|
+
import { Predicate } from '@voltro/database';
|
|
13
14
|
import { QueryDescriptor } from '@voltro/database';
|
|
14
15
|
import { RateLimiter } from 'effect/persistence';
|
|
15
16
|
import { Row } from '@voltro/database';
|
|
@@ -21,6 +22,7 @@ import { Table } from '@voltro/database';
|
|
|
21
22
|
import { TableLike } from '@voltro/database';
|
|
22
23
|
import { WorkflowAccessOptions } from '@voltro/protocol';
|
|
23
24
|
import { WorkflowEngine } from 'effect/workflow';
|
|
25
|
+
import { WorkflowInstance } from 'effect/workflow/WorkflowEngine';
|
|
24
26
|
import { Workflow as workflowModule } from 'effect/workflow';
|
|
25
27
|
import { WorkflowParentClosePolicy } from '@voltro/protocol';
|
|
26
28
|
import { WorkflowQueuedCancellationResult } from '@voltro/protocol';
|
|
@@ -94,8 +96,8 @@ export declare type AdmissionDecision = {
|
|
|
94
96
|
readonly deadlineAt?: number;
|
|
95
97
|
/** `'replace'` — one pending row per key, newest payload wins (debounce).
|
|
96
98
|
* `'append'` — one row per item, they accumulate (batch).
|
|
97
|
-
* `'hold'` — the row
|
|
98
|
-
* (throttle / concurrency / paused re-checks). */
|
|
99
|
+
* `'hold'` — retain the existing row; persist only a changed future
|
|
100
|
+
* deadline (throttle / concurrency / paused re-checks). */
|
|
99
101
|
readonly collapse: 'replace' | 'append' | 'hold';
|
|
100
102
|
readonly keys: AdmissionKeys;
|
|
101
103
|
} | {
|
|
@@ -218,6 +220,11 @@ export declare interface AdmissionKeys {
|
|
|
218
220
|
readonly priority: number;
|
|
219
221
|
}
|
|
220
222
|
|
|
223
|
+
/** Unknown acceptance cannot expire into proof of spare capacity. Only an
|
|
224
|
+
* acknowledged execution uses the ordinary crash backstop. Share this rule
|
|
225
|
+
* between admission decisions and read-only capacity observations. */
|
|
226
|
+
export declare const admissionLeaseHeldPredicate: (now: number) => Predicate;
|
|
227
|
+
|
|
221
228
|
export declare const ADMISSIONS_TABLE = "_voltro_workflow_admissions";
|
|
222
229
|
|
|
223
230
|
/** What the store observed for these keys. Every field optional: the store only
|
|
@@ -255,6 +262,31 @@ export declare interface AdmissionState {
|
|
|
255
262
|
* or a batch that has accumulated additional items. */
|
|
256
263
|
export declare type AdmissionSubmission = typeof SubmissionSchema.Type;
|
|
257
264
|
|
|
265
|
+
export declare type AdmissionSubmissionRetryInspection = {
|
|
266
|
+
readonly kind: 'eligible';
|
|
267
|
+
readonly submissionId: string;
|
|
268
|
+
readonly expected: AdmissionSubmissionRetryToken;
|
|
269
|
+
} | {
|
|
270
|
+
readonly kind: 'refused';
|
|
271
|
+
readonly submissionId: string;
|
|
272
|
+
readonly reason: AdmissionSubmissionRetryRefusal;
|
|
273
|
+
};
|
|
274
|
+
|
|
275
|
+
export declare type AdmissionSubmissionRetryRefusal = 'missing-submission' | 'incomplete-transfer' | 'accepted' | 'rejected' | 'prepared-execution' | 'dispatch-attempted' | 'not-stopped' | 'changed-retry' | 'missing-lease' | 'foreign-lease' | 'released-lease' | 'bound-lease';
|
|
276
|
+
|
|
277
|
+
export declare type AdmissionSubmissionRetryResult = {
|
|
278
|
+
readonly kind: 'retried' | 'already-retried';
|
|
279
|
+
readonly submissionId: string;
|
|
280
|
+
readonly expected: AdmissionSubmissionRetryToken;
|
|
281
|
+
} | Extract<AdmissionSubmissionRetryInspection, {
|
|
282
|
+
kind: 'refused';
|
|
283
|
+
}>;
|
|
284
|
+
|
|
285
|
+
export declare interface AdmissionSubmissionRetryToken {
|
|
286
|
+
readonly attempts: number;
|
|
287
|
+
readonly stoppedAt: number;
|
|
288
|
+
}
|
|
289
|
+
|
|
258
290
|
/** What the caller learns about a start that went through flow control. */
|
|
259
291
|
export declare type AdmissionVerdict = {
|
|
260
292
|
/** Start it now. The ledger row is already written; call `linkExecution`
|
|
@@ -555,6 +587,9 @@ export declare interface AwaitUpdateOptions<A, B = A> {
|
|
|
555
587
|
|
|
556
588
|
/** Persist BEFORE calling the engine. Failed acknowledgements and process
|
|
557
589
|
* death must leave evidence that an earlier call could have been accepted.
|
|
590
|
+
* The first dispatch starts the original finite lease interval: time spent
|
|
591
|
+
* waiting before engine I/O must not consume the running crash backstop.
|
|
592
|
+
* Later attempts retain that first deadline, including after a lost ACK.
|
|
558
593
|
* Return null when this source is no longer dispatchable. Database-only;
|
|
559
594
|
* the returned attempt number fences a later permanent-rejection decision. */
|
|
560
595
|
export declare const beginAdmissionSubmissionDispatchInTransaction: (tx: Pick<DataStore, "query" | "update">, id: string, now: number) => Promise<AdmissionSubmission | null>;
|
|
@@ -568,9 +603,10 @@ export declare const beginWorkflowControlDispatchInTransaction: (tx: Store, id:
|
|
|
568
603
|
kind: "settled";
|
|
569
604
|
request: {
|
|
570
605
|
readonly id: string;
|
|
606
|
+
readonly operation: "resume" | "cancel" | "terminate";
|
|
571
607
|
readonly result: {
|
|
572
608
|
readonly kind: "confirmed" | "already-terminal";
|
|
573
|
-
readonly status: "failed" | "
|
|
609
|
+
readonly status: "failed" | "succeeded" | "cancelled";
|
|
574
610
|
readonly completedAt: number;
|
|
575
611
|
readonly output: unknown;
|
|
576
612
|
readonly errorTag: string | null;
|
|
@@ -581,7 +617,6 @@ export declare const beginWorkflowControlDispatchInTransaction: (tx: Store, id:
|
|
|
581
617
|
readonly enteredAt: number;
|
|
582
618
|
readonly generation: string;
|
|
583
619
|
} | null;
|
|
584
|
-
readonly operation: "resume" | "cancel" | "terminate";
|
|
585
620
|
readonly generation: string;
|
|
586
621
|
readonly runId: string;
|
|
587
622
|
readonly requestedAt: number;
|
|
@@ -608,9 +643,10 @@ export declare const beginWorkflowControlDispatchInTransaction: (tx: Store, id:
|
|
|
608
643
|
kind: "unknown";
|
|
609
644
|
request: {
|
|
610
645
|
readonly id: string;
|
|
646
|
+
readonly operation: "resume" | "cancel" | "terminate";
|
|
611
647
|
readonly result: {
|
|
612
648
|
readonly kind: "confirmed" | "already-terminal";
|
|
613
|
-
readonly status: "failed" | "
|
|
649
|
+
readonly status: "failed" | "succeeded" | "cancelled";
|
|
614
650
|
readonly completedAt: number;
|
|
615
651
|
readonly output: unknown;
|
|
616
652
|
readonly errorTag: string | null;
|
|
@@ -621,7 +657,6 @@ export declare const beginWorkflowControlDispatchInTransaction: (tx: Store, id:
|
|
|
621
657
|
readonly enteredAt: number;
|
|
622
658
|
readonly generation: string;
|
|
623
659
|
} | null;
|
|
624
|
-
readonly operation: "resume" | "cancel" | "terminate";
|
|
625
660
|
readonly generation: string;
|
|
626
661
|
readonly runId: string;
|
|
627
662
|
readonly requestedAt: number;
|
|
@@ -648,9 +683,10 @@ export declare const beginWorkflowControlDispatchInTransaction: (tx: Store, id:
|
|
|
648
683
|
kind: "superseded";
|
|
649
684
|
request: {
|
|
650
685
|
readonly id: string;
|
|
686
|
+
readonly operation: "resume" | "cancel" | "terminate";
|
|
651
687
|
readonly result: {
|
|
652
688
|
readonly kind: "confirmed" | "already-terminal";
|
|
653
|
-
readonly status: "failed" | "
|
|
689
|
+
readonly status: "failed" | "succeeded" | "cancelled";
|
|
654
690
|
readonly completedAt: number;
|
|
655
691
|
readonly output: unknown;
|
|
656
692
|
readonly errorTag: string | null;
|
|
@@ -661,7 +697,6 @@ export declare const beginWorkflowControlDispatchInTransaction: (tx: Store, id:
|
|
|
661
697
|
readonly enteredAt: number;
|
|
662
698
|
readonly generation: string;
|
|
663
699
|
} | null;
|
|
664
|
-
readonly operation: "resume" | "cancel" | "terminate";
|
|
665
700
|
readonly generation: string;
|
|
666
701
|
readonly runId: string;
|
|
667
702
|
readonly requestedAt: number;
|
|
@@ -688,9 +723,10 @@ export declare const beginWorkflowControlDispatchInTransaction: (tx: Store, id:
|
|
|
688
723
|
kind: "already-terminal";
|
|
689
724
|
request: {
|
|
690
725
|
readonly id: string;
|
|
726
|
+
readonly operation: "resume" | "cancel" | "terminate";
|
|
691
727
|
readonly result: {
|
|
692
728
|
readonly kind: "confirmed" | "already-terminal";
|
|
693
|
-
readonly status: "failed" | "
|
|
729
|
+
readonly status: "failed" | "succeeded" | "cancelled";
|
|
694
730
|
readonly completedAt: number;
|
|
695
731
|
readonly output: unknown;
|
|
696
732
|
readonly errorTag: string | null;
|
|
@@ -701,7 +737,6 @@ export declare const beginWorkflowControlDispatchInTransaction: (tx: Store, id:
|
|
|
701
737
|
readonly enteredAt: number;
|
|
702
738
|
readonly generation: string;
|
|
703
739
|
} | null;
|
|
704
|
-
readonly operation: "resume" | "cancel" | "terminate";
|
|
705
740
|
readonly generation: string;
|
|
706
741
|
readonly runId: string;
|
|
707
742
|
readonly requestedAt: number;
|
|
@@ -729,9 +764,10 @@ export declare const beginWorkflowControlDispatchInTransaction: (tx: Store, id:
|
|
|
729
764
|
request: {
|
|
730
765
|
dispatchAttempts: number;
|
|
731
766
|
id: string;
|
|
767
|
+
operation: "resume" | "cancel" | "terminate";
|
|
732
768
|
result: {
|
|
733
769
|
readonly kind: "confirmed" | "already-terminal";
|
|
734
|
-
readonly status: "failed" | "
|
|
770
|
+
readonly status: "failed" | "succeeded" | "cancelled";
|
|
735
771
|
readonly completedAt: number;
|
|
736
772
|
readonly output: unknown;
|
|
737
773
|
readonly errorTag: string | null;
|
|
@@ -742,7 +778,6 @@ export declare const beginWorkflowControlDispatchInTransaction: (tx: Store, id:
|
|
|
742
778
|
readonly enteredAt: number;
|
|
743
779
|
readonly generation: string;
|
|
744
780
|
} | null;
|
|
745
|
-
operation: "resume" | "cancel" | "terminate";
|
|
746
781
|
generation: string;
|
|
747
782
|
runId: string;
|
|
748
783
|
requestedAt: number;
|
|
@@ -779,9 +814,10 @@ export declare const bindWorkflowResumeJournalInTransaction: (tx: Store, id: str
|
|
|
779
814
|
kind: "settled";
|
|
780
815
|
request: {
|
|
781
816
|
readonly id: string;
|
|
817
|
+
readonly operation: "resume" | "cancel" | "terminate";
|
|
782
818
|
readonly result: {
|
|
783
819
|
readonly kind: "confirmed" | "already-terminal";
|
|
784
|
-
readonly status: "failed" | "
|
|
820
|
+
readonly status: "failed" | "succeeded" | "cancelled";
|
|
785
821
|
readonly completedAt: number;
|
|
786
822
|
readonly output: unknown;
|
|
787
823
|
readonly errorTag: string | null;
|
|
@@ -792,7 +828,6 @@ export declare const bindWorkflowResumeJournalInTransaction: (tx: Store, id: str
|
|
|
792
828
|
readonly enteredAt: number;
|
|
793
829
|
readonly generation: string;
|
|
794
830
|
} | null;
|
|
795
|
-
readonly operation: "resume" | "cancel" | "terminate";
|
|
796
831
|
readonly generation: string;
|
|
797
832
|
readonly runId: string;
|
|
798
833
|
readonly requestedAt: number;
|
|
@@ -818,9 +853,10 @@ export declare const bindWorkflowResumeJournalInTransaction: (tx: Store, id: str
|
|
|
818
853
|
kind: "unknown";
|
|
819
854
|
request: {
|
|
820
855
|
readonly id: string;
|
|
856
|
+
readonly operation: "resume" | "cancel" | "terminate";
|
|
821
857
|
readonly result: {
|
|
822
858
|
readonly kind: "confirmed" | "already-terminal";
|
|
823
|
-
readonly status: "failed" | "
|
|
859
|
+
readonly status: "failed" | "succeeded" | "cancelled";
|
|
824
860
|
readonly completedAt: number;
|
|
825
861
|
readonly output: unknown;
|
|
826
862
|
readonly errorTag: string | null;
|
|
@@ -831,7 +867,6 @@ export declare const bindWorkflowResumeJournalInTransaction: (tx: Store, id: str
|
|
|
831
867
|
readonly enteredAt: number;
|
|
832
868
|
readonly generation: string;
|
|
833
869
|
} | null;
|
|
834
|
-
readonly operation: "resume" | "cancel" | "terminate";
|
|
835
870
|
readonly generation: string;
|
|
836
871
|
readonly runId: string;
|
|
837
872
|
readonly requestedAt: number;
|
|
@@ -857,9 +892,10 @@ export declare const bindWorkflowResumeJournalInTransaction: (tx: Store, id: str
|
|
|
857
892
|
kind: "superseded";
|
|
858
893
|
request: {
|
|
859
894
|
readonly id: string;
|
|
895
|
+
readonly operation: "resume" | "cancel" | "terminate";
|
|
860
896
|
readonly result: {
|
|
861
897
|
readonly kind: "confirmed" | "already-terminal";
|
|
862
|
-
readonly status: "failed" | "
|
|
898
|
+
readonly status: "failed" | "succeeded" | "cancelled";
|
|
863
899
|
readonly completedAt: number;
|
|
864
900
|
readonly output: unknown;
|
|
865
901
|
readonly errorTag: string | null;
|
|
@@ -870,7 +906,6 @@ export declare const bindWorkflowResumeJournalInTransaction: (tx: Store, id: str
|
|
|
870
906
|
readonly enteredAt: number;
|
|
871
907
|
readonly generation: string;
|
|
872
908
|
} | null;
|
|
873
|
-
readonly operation: "resume" | "cancel" | "terminate";
|
|
874
909
|
readonly generation: string;
|
|
875
910
|
readonly runId: string;
|
|
876
911
|
readonly requestedAt: number;
|
|
@@ -896,9 +931,10 @@ export declare const bindWorkflowResumeJournalInTransaction: (tx: Store, id: str
|
|
|
896
931
|
kind: "not-suspended";
|
|
897
932
|
request: {
|
|
898
933
|
readonly id: string;
|
|
934
|
+
readonly operation: "resume" | "cancel" | "terminate";
|
|
899
935
|
readonly result: {
|
|
900
936
|
readonly kind: "confirmed" | "already-terminal";
|
|
901
|
-
readonly status: "failed" | "
|
|
937
|
+
readonly status: "failed" | "succeeded" | "cancelled";
|
|
902
938
|
readonly completedAt: number;
|
|
903
939
|
readonly output: unknown;
|
|
904
940
|
readonly errorTag: string | null;
|
|
@@ -909,7 +945,6 @@ export declare const bindWorkflowResumeJournalInTransaction: (tx: Store, id: str
|
|
|
909
945
|
readonly enteredAt: number;
|
|
910
946
|
readonly generation: string;
|
|
911
947
|
} | null;
|
|
912
|
-
readonly operation: "resume" | "cancel" | "terminate";
|
|
913
948
|
readonly generation: string;
|
|
914
949
|
readonly runId: string;
|
|
915
950
|
readonly requestedAt: number;
|
|
@@ -935,9 +970,10 @@ export declare const bindWorkflowResumeJournalInTransaction: (tx: Store, id: str
|
|
|
935
970
|
kind: "bound";
|
|
936
971
|
request: {
|
|
937
972
|
readonly id: string;
|
|
973
|
+
readonly operation: "resume" | "cancel" | "terminate";
|
|
938
974
|
readonly result: {
|
|
939
975
|
readonly kind: "confirmed" | "already-terminal";
|
|
940
|
-
readonly status: "failed" | "
|
|
976
|
+
readonly status: "failed" | "succeeded" | "cancelled";
|
|
941
977
|
readonly completedAt: number;
|
|
942
978
|
readonly output: unknown;
|
|
943
979
|
readonly errorTag: string | null;
|
|
@@ -948,7 +984,6 @@ export declare const bindWorkflowResumeJournalInTransaction: (tx: Store, id: str
|
|
|
948
984
|
readonly enteredAt: number;
|
|
949
985
|
readonly generation: string;
|
|
950
986
|
} | null;
|
|
951
|
-
readonly operation: "resume" | "cancel" | "terminate";
|
|
952
987
|
readonly generation: string;
|
|
953
988
|
readonly runId: string;
|
|
954
989
|
readonly requestedAt: number;
|
|
@@ -974,9 +1009,10 @@ export declare const bindWorkflowResumeJournalInTransaction: (tx: Store, id: str
|
|
|
974
1009
|
kind: "waiting-journal";
|
|
975
1010
|
request: {
|
|
976
1011
|
readonly id: string;
|
|
1012
|
+
readonly operation: "resume" | "cancel" | "terminate";
|
|
977
1013
|
readonly result: {
|
|
978
1014
|
readonly kind: "confirmed" | "already-terminal";
|
|
979
|
-
readonly status: "failed" | "
|
|
1015
|
+
readonly status: "failed" | "succeeded" | "cancelled";
|
|
980
1016
|
readonly completedAt: number;
|
|
981
1017
|
readonly output: unknown;
|
|
982
1018
|
readonly errorTag: string | null;
|
|
@@ -987,7 +1023,6 @@ export declare const bindWorkflowResumeJournalInTransaction: (tx: Store, id: str
|
|
|
987
1023
|
readonly enteredAt: number;
|
|
988
1024
|
readonly generation: string;
|
|
989
1025
|
} | null;
|
|
990
|
-
readonly operation: "resume" | "cancel" | "terminate";
|
|
991
1026
|
readonly generation: string;
|
|
992
1027
|
readonly runId: string;
|
|
993
1028
|
readonly requestedAt: number;
|
|
@@ -1825,6 +1860,8 @@ export declare interface InMemoryRecorder {
|
|
|
1825
1860
|
/** `rateLimit()` counts on the `RateLimiter` service; in memory it is per process. */
|
|
1826
1861
|
export declare const inMemoryWorkflowEngineLayer: Layer.Layer<WorkflowEngine.WorkflowEngine | RateLimiter.RateLimiter>;
|
|
1827
1862
|
|
|
1863
|
+
export declare const inspectAdmissionSubmissionRetry: (tx: Pick<DataStore, "query">, id: string) => Promise<AdmissionSubmissionRetryInspection>;
|
|
1864
|
+
|
|
1828
1865
|
export declare interface InspectedStep {
|
|
1829
1866
|
readonly name: string;
|
|
1830
1867
|
/** The attempt number of THIS row (1 on first try, 2+ on retry). When
|
|
@@ -1924,6 +1961,11 @@ export declare const isWorkflowEncrypted: (name: string) => boolean;
|
|
|
1924
1961
|
|
|
1925
1962
|
export declare const isWorkflowWorkerLayer: (value: unknown) => value is WorkflowWorkerLayerBrand;
|
|
1926
1963
|
|
|
1964
|
+
export declare interface JournalRoutingState {
|
|
1965
|
+
readonly generation: number;
|
|
1966
|
+
readonly layout: string;
|
|
1967
|
+
}
|
|
1968
|
+
|
|
1927
1969
|
/**
|
|
1928
1970
|
* Attach the engine's execution id to the ledger row written by
|
|
1929
1971
|
* {@link admitStart}.
|
|
@@ -2026,8 +2068,12 @@ export declare const normaliseWorkflowPatches: (value: unknown) => ReadonlyArray
|
|
|
2026
2068
|
* pending row. Missing acknowledgement does NOT prove that the engine rejected
|
|
2027
2069
|
* the call; this record deliberately makes no terminal-execution claim.
|
|
2028
2070
|
* Call inside the owning admission transaction. A reached attempt limit stops
|
|
2029
|
-
* automatic retry but retains the lease and receipt for reconciliation.
|
|
2030
|
-
|
|
2071
|
+
* automatic retry but retains the lease and receipt for reconciliation.
|
|
2072
|
+
* Pass the attempt's observed `retry.recovery?.attempts ?? 0`: an older
|
|
2073
|
+
* in-flight failure must not consume an operator's newly granted budget.
|
|
2074
|
+
* Omission means the original, unrecovered epoch; it cannot change a recovered
|
|
2075
|
+
* submission. An actual dispatch adopts the epoch returned by its begin call. */
|
|
2076
|
+
export declare const noteAdmissionSubmissionFailure: (tx: Pick<DataStore, "query" | "update">, id: string, error: string, now: number, maxAttempts?: number | false, expectedRecoveryAttempts?: number) => Promise<AdmissionSubmission>;
|
|
2031
2077
|
|
|
2032
2078
|
export declare const noteIntentAttempt: (store: AdmissionDataStore, intent: PendingIntent, error: string, now: number) => Promise<void>;
|
|
2033
2079
|
|
|
@@ -2557,6 +2603,17 @@ export declare interface RecordedStepShape {
|
|
|
2557
2603
|
readonly stepName: string;
|
|
2558
2604
|
}
|
|
2559
2605
|
|
|
2606
|
+
/** Record a known caller's pre-body refusal without replay/version/crash guards
|
|
2607
|
+
* treating the refused attempt as application execution. Entry and completion
|
|
2608
|
+
* use the ordinary resident transactions, delivery identity and generation
|
|
2609
|
+
* fences; an unknown identity cannot create a run. The original failure is
|
|
2610
|
+
* returned to the engine after its terminal record commits. */
|
|
2611
|
+
export declare const recordWorkflowExecutionRefusal: (options: WorkflowExecutionRefusalRecordingOptions, input: {
|
|
2612
|
+
readonly executionId: string;
|
|
2613
|
+
readonly payload: unknown;
|
|
2614
|
+
readonly cause: Cause.Cause<unknown>;
|
|
2615
|
+
}) => Effect.Effect<never, unknown, WorkflowInstance>;
|
|
2616
|
+
|
|
2560
2617
|
/** Database-only: call inside the resident admission transaction, together
|
|
2561
2618
|
* with the source's terminal transition. Never notify the handler from here.
|
|
2562
2619
|
* Replaying an identity keeps the first report AND recipient, even after a
|
|
@@ -2571,12 +2628,14 @@ export declare const recordWorkflowStartReceipt: (tx: Pick<DataStore, "insertIgn
|
|
|
2571
2628
|
/** Record proven pre-engine rejection together with its source and lease.
|
|
2572
2629
|
* Attempt 0 means local validation before any engine call. Attempt 1 means the
|
|
2573
2630
|
* first call returned a failure the host guarantees occurs before engine I/O.
|
|
2574
|
-
* A prior or competing attempt makes acceptance unknown, not rejected.
|
|
2631
|
+
* A prior or competing attempt makes acceptance unknown, not rejected.
|
|
2632
|
+
* Pass the same observed recovery epoch as failure bookkeeping: an older
|
|
2633
|
+
* pre-engine error cannot reject an explicitly recovered submission. */
|
|
2575
2634
|
export declare const rejectAdmissionSubmissionInTransaction: (tx: AdmissionDataStore, id: string, attempt: number, failure: {
|
|
2576
2635
|
readonly handler: string | null;
|
|
2577
2636
|
readonly errorMessage: string;
|
|
2578
2637
|
readonly now: number;
|
|
2579
|
-
}) => Promise<WorkflowFailureRecord | undefined>;
|
|
2638
|
+
}, expectedRecoveryAttempts?: number) => Promise<WorkflowFailureRecord | undefined>;
|
|
2580
2639
|
|
|
2581
2640
|
/**
|
|
2582
2641
|
* Resume every run parked on `budget`.
|
|
@@ -2926,6 +2985,12 @@ export declare const resolveWorkflowStartReceipt: (tx: Pick<DataStore, "query">,
|
|
|
2926
2985
|
|
|
2927
2986
|
export declare const resumeWorkflow: (store: AdmissionDataStore, workflowName: string) => Promise<boolean>;
|
|
2928
2987
|
|
|
2988
|
+
/** Call under the SAME resident admission transaction as preparation, dispatch,
|
|
2989
|
+
* cancellation and ACK. The preview is advisory; this locked reread decides.
|
|
2990
|
+
* Keep lifetime attempts monotonic and retain the consumed stop token so a lost
|
|
2991
|
+
* response can be retried without resuming a later exhausted retry budget. */
|
|
2992
|
+
export declare const retryAdmissionSubmissionInTransaction: (tx: Pick<DataStore, "query" | "update">, id: string, expected: AdmissionSubmissionRetryToken, now: number) => Promise<AdmissionSubmissionRetryResult>;
|
|
2993
|
+
|
|
2929
2994
|
/** Re-arm one dead-lettered intent after an operator has deployed a schema or
|
|
2930
2995
|
* handler fix. The payload and its queue-time provenance stay untouched; only
|
|
2931
2996
|
* the terminal classification and retry history are reset. */
|
|
@@ -3270,6 +3335,8 @@ export declare interface StepRetryPolicy {
|
|
|
3270
3335
|
|
|
3271
3336
|
declare type Store = Pick<DataStore, 'query' | 'insert' | 'update'>;
|
|
3272
3337
|
|
|
3338
|
+
export declare const SUBMISSIONS_TABLE = "_voltro_workflow_submissions";
|
|
3339
|
+
|
|
3273
3340
|
declare const SubmissionSchema: Schema.Struct<{
|
|
3274
3341
|
readonly id: Schema.String;
|
|
3275
3342
|
readonly workflowName: Schema.String;
|
|
@@ -3286,6 +3353,11 @@ declare const SubmissionSchema: Schema.Struct<{
|
|
|
3286
3353
|
readonly after: Schema.Number;
|
|
3287
3354
|
readonly lastError: Schema.NullOr<Schema.String>;
|
|
3288
3355
|
readonly stoppedAt: Schema.NullOr<Schema.Number>;
|
|
3356
|
+
readonly recovery: Schema.optional<Schema.Struct<{
|
|
3357
|
+
readonly attempts: Schema.Int;
|
|
3358
|
+
readonly stoppedAt: Schema.Number;
|
|
3359
|
+
readonly retriedAt: Schema.Number;
|
|
3360
|
+
}>>;
|
|
3289
3361
|
}>;
|
|
3290
3362
|
readonly payload: Schema.Unknown;
|
|
3291
3363
|
readonly callerContext: Schema.Unknown;
|
|
@@ -3407,10 +3479,15 @@ export declare const takeAdmittedSubmissionInTransaction: (tx: AdmissionDataStor
|
|
|
3407
3479
|
readonly dispatchAttempts: number;
|
|
3408
3480
|
readonly failureId: string | null;
|
|
3409
3481
|
readonly retry: {
|
|
3410
|
-
readonly attempts: number;
|
|
3411
|
-
readonly after: number;
|
|
3412
3482
|
readonly lastError: string | null;
|
|
3483
|
+
readonly attempts: number;
|
|
3413
3484
|
readonly stoppedAt: number | null;
|
|
3485
|
+
readonly after: number;
|
|
3486
|
+
readonly recovery?: {
|
|
3487
|
+
readonly attempts: number;
|
|
3488
|
+
readonly stoppedAt: number;
|
|
3489
|
+
readonly retriedAt: number;
|
|
3490
|
+
} | undefined;
|
|
3414
3491
|
};
|
|
3415
3492
|
readonly payload: unknown;
|
|
3416
3493
|
readonly callerContext: unknown;
|
|
@@ -3907,6 +3984,8 @@ export declare interface WorkflowExecuteRecordingOptions extends WorkflowRunReco
|
|
|
3907
3984
|
readonly replayShapeLimit?: number;
|
|
3908
3985
|
}
|
|
3909
3986
|
|
|
3987
|
+
export declare type WorkflowExecutionRefusalRecordingOptions = WorkflowExecuteRecordingOptions & Required<Pick<WorkflowExecuteRecordingOptions, 'subject' | 'failureContext'>>;
|
|
3988
|
+
|
|
3910
3989
|
export declare type WorkflowFailureDelivery = WorkflowFailureHandoff | {
|
|
3911
3990
|
readonly kind: 'accepted';
|
|
3912
3991
|
readonly executionId: string;
|
|
@@ -4085,6 +4164,17 @@ declare type WorkflowFn = <const Name extends string, Payload extends WorkflowPa
|
|
|
4085
4164
|
readonly name: Name;
|
|
4086
4165
|
} & WorkflowMessagesCarrier<NormaliseWorkflowMessages<Messages>>;
|
|
4087
4166
|
|
|
4167
|
+
/** Journal routing generation per PostgreSQL journal namespace. Declared, so the
|
|
4168
|
+
* schema owns it (plan, fingerprint, backup); the maintenance transition only
|
|
4169
|
+
* reads and writes it inside its pinned journal transaction. */
|
|
4170
|
+
export declare const workflowJournalRoutingTable: Table<"_voltro_workflow_journal_routing", FieldDefinitions<{
|
|
4171
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
4172
|
+
readonly namespace: ColumnBuilder<string, "text", boolean>;
|
|
4173
|
+
readonly generation: ColumnBuilder<string, "bigint", boolean>;
|
|
4174
|
+
readonly layout: ColumnBuilder<string, "text", boolean>;
|
|
4175
|
+
readonly relocation: ColumnBuilder<string, "text", boolean>;
|
|
4176
|
+
}>, false, never>;
|
|
4177
|
+
|
|
4088
4178
|
declare type WorkflowMake = typeof workflowModule.make;
|
|
4089
4179
|
|
|
4090
4180
|
export declare interface WorkflowMessagePairSchemas {
|
|
@@ -4510,6 +4600,15 @@ export declare type WorkflowScheduleOverlap = 'skip' | 'buffer' | 'cancelOther';
|
|
|
4510
4600
|
* that crossed a bundler boundary, and symbols do not survive every one. */
|
|
4511
4601
|
export declare const WorkflowScheduleProperty = "__voltroWorkflowSchedule";
|
|
4512
4602
|
|
|
4603
|
+
/** Explicit routing inventory shared by every runner in one cluster. Changing
|
|
4604
|
+
* groups changes persistent addresses; this is not a journal migration. */
|
|
4605
|
+
/** Group names are at most 32 ASCII characters: group + colon + a safe integer
|
|
4606
|
+
* slot fits the existing SQL journal shard_id VARCHAR(50) on every dialect. */
|
|
4607
|
+
export declare interface WorkflowShardGroups {
|
|
4608
|
+
readonly available: ReadonlyArray<string>;
|
|
4609
|
+
readonly assigned: ReadonlyArray<string>;
|
|
4610
|
+
}
|
|
4611
|
+
|
|
4513
4612
|
/**
|
|
4514
4613
|
* At most one run per key. The newcomer either stands down or evicts.
|
|
4515
4614
|
*
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,50 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
1
|
+
import { failureMessage as e } from "./failureMessage.js";
|
|
2
|
+
import { attachPreparedWorkflowExecution as t, executePreparedWorkflow as n, hasPreparedWorkflowExecution as r } from "./preparedExecution.js";
|
|
3
|
+
import { STEP_JOURNAL_BINDING as i, WORKFLOW_JOURNAL_BINDING as a, getWorkflowJournalCipher as o, isSealedJournalValue as s, isWorkflowEncrypted as c, openErrorText as l, openEventPayload as u, openJournalValue as d, openPayloadFields as f, openWorkflowRow as p, sealJournalValue as m, setWorkflowJournalCipher as h, tryOpenJournalValue as g } from "./journalEncryption.js";
|
|
4
|
+
import { DEFERRING_CONTROLS as _, assertConsistentPools as v, deferringControlsOf as y, hasCancelOn as b, hasFlowControl as x, validateFlowControl as S } from "./flowControl.js";
|
|
5
|
+
import { CurrentWorkflowExecutionId as C, CurrentWorkflowPatches as w, CurrentWorkflowRunId as T, CurrentWorkflowStep as E, WorkflowRunRecorder as D, WorkflowStepInterceptorTag as O, currentWorkflowStep as k, getCurrentWorkflowExecutionId as A, getCurrentWorkflowRunId as j } from "./recorder.js";
|
|
6
|
+
import { DEFAULT_WORKFLOW_SCHEDULE_MAX_RUNTIME_MS as M, WorkflowScheduleProperty as N, getWorkflowSchedule as P, validateWorkflowSchedule as F } from "./scheduleDeclaration.js";
|
|
7
|
+
import { CurrentWorkflowReplayShape as I, makeReplayShapeTracker as L, nondeterminismEventPayload as R, reportNondeterminism as z } from "./nondeterminism.js";
|
|
8
|
+
import { WorkflowFlowControlProperty as B, WorkflowMessagesProperty as V, WorkflowVersionTypeId as H, WorkflowWorkerLayerTypeId as U, durableClock as W, durableQueue as G, durableQueueModule as K, getWorkflowFlowControl as q, getWorkflowVersionMetadata as J, isCarrier as Y, isWorkflowWorkerLayer as X, patch as Z, processQueue as Q, queueWorker as $, rateLimit as ee, sleep as te, sleepUntil as ne, step as re, stepIdempotencyKey as ie, stepModule as ae, withCompensation as oe, workflow as se, workflowModule as ce } from "./primitives.js";
|
|
9
|
+
import { inMemoryWorkflowEngineLayer as le } from "./inMemoryLayer.js";
|
|
10
|
+
import { _voltroWorkflowRunsTable as ue } from "./runsTable.js";
|
|
11
|
+
import { _voltroWorkflowRunStepsTable as de } from "./runStepsTable.js";
|
|
12
|
+
import { _voltroWorkflowRunEventsTable as fe } from "./runEventsTable.js";
|
|
13
|
+
import { _voltroWorkflowStartContextsTable as pe } from "./startContextsTable.js";
|
|
14
|
+
import { _voltroWorkflowAdmissionLocksTable as me, _voltroWorkflowAdmissionsTable as he, _voltroWorkflowControlRequestsTable as ge, _voltroWorkflowFailureReportsTable as _e, _voltroWorkflowParentClosuresTable as ve, _voltroWorkflowPausesTable as ye, _voltroWorkflowPendingTable as be, _voltroWorkflowStartReceiptsTable as xe, _voltroWorkflowSubmissionsTable as Se } from "./admissionTables.js";
|
|
15
|
+
import { withAdmissionTransaction as Ce } from "./admissionTransaction.js";
|
|
16
|
+
import { FlowControlKeyError as we, comparePendingOrder as Te, decideAdmission as Ee, isFinishExpired as De, isStartExpired as Oe, nextSlotAt as ke, pooledConcurrencyKey as Ae, resolveAdmissionKeys as je } from "./admission.js";
|
|
17
|
+
import { readWorkflowFailureRecord as Me, recordWorkflowFailureInTransaction as Ne } from "./failureReportStore.js";
|
|
18
|
+
import { handoffWorkflowFailureInTransaction as Pe, reconcileWorkflowFailureInTransaction as Fe } from "./failureHandoff.js";
|
|
19
|
+
import { ADMISSION_SUBMISSION_ID_PREFIX as Ie, SUBMISSIONS_TABLE as Le, acknowledgeAdmissionSubmission as Re, beginAdmissionSubmissionDispatchInTransaction as ze, newAdmissionSubmissionId as Be, noteAdmissionSubmissionFailure as Ve, pendingAdmissionSubmissions as He, prepareAdmissionSubmissionExecutionInTransaction as Ue, readAdmissionSubmission as We, rejectAdmissionSubmissionInTransaction as Ge, reserveAdmissionSubmission as Ke, reserveAdmissionSubmissionInTransaction as qe } from "./admissionSubmission.js";
|
|
20
|
+
import { WorkflowStartRequestConflictError as Je, bindWorkflowStartReceipts as Ye, readWorkflowStartReceipt as Xe, readWorkflowStartRequest as Ze, recordWorkflowStartReceipt as Qe, resolveWorkflowStartReceipt as $e } from "./startReceipt.js";
|
|
21
|
+
import { ADMISSIONS_TABLE as et, DEFAULT_LEASE_MS as tt, PAUSES_TABLE as nt, PENDING_TABLE as rt, admissionLeaseHeldPredicate as it, allIntents as at, deadLetterIntent as ot, deleteIntent as st, discardIntent as ct, discardIntentInTransaction as lt, dueIntents as ut, evaluateAdmission as dt, noteIntentAttempt as ft, parkDelayedStart as pt, pauseWorkflow as mt, pendingSlotId as ht, pendingWindow as gt, persistDefer as _t, pruneAdmissions as vt, readAdmissionState as yt, readPausedWorkflows as bt, recordAdmission as xt, releaseLease as St, resumeWorkflow as Ct, retryDeadLetterIntent as wt } from "./admissionStore.js";
|
|
22
|
+
import { acceptWorkflowControlInTransaction as Tt, beginWorkflowControlDispatchInTransaction as Et, bindWorkflowResumeJournalInTransaction as Dt, readWorkflowControlInTransaction as Ot } from "./controlRequest.js";
|
|
23
|
+
import { stageWorkflowParentClosureInTransaction as kt } from "./parentClosure.js";
|
|
24
|
+
import { readWorkflowRestartObservationInTransaction as At, reserveWorkflowRestartInTransaction as jt, withdrawWorkflowRestartInTransaction as Mt, workflowRestartRequestsTable as Nt, workflowRestartWithdrawalsTable as Pt } from "./workflowRestartReservation.js";
|
|
25
|
+
import { cancelSuspendedWorkflowRunInTransaction as Ft, completeWorkflowRunGenerationInTransaction as It, enterWorkflowRunGenerationInTransaction as Lt } from "./runGeneration.js";
|
|
26
|
+
import { queuedCancellationRequestsTable as Rt } from "./queuedCancellationRequest.js";
|
|
27
|
+
import { workflowJournalRoutingTable as zt } from "./journalRoutingTable.js";
|
|
28
|
+
import { cancelQueuedWorkflowStartInTransaction as Bt, readQueuedWorkflowCancellationInTransaction as Vt } from "./queuedControl.js";
|
|
29
|
+
import { inspectAdmissionSubmissionRetry as Ht, retryAdmissionSubmissionInTransaction as Ut } from "./submissionRetry.js";
|
|
30
|
+
import { takeAdmittedSubmissionInTransaction as Wt, takePendingAdmissionSubmission as Gt } from "./pendingSubmission.js";
|
|
31
|
+
import { admitStart as Kt, linkExecution as qt } from "./admissionGate.js";
|
|
32
|
+
import { _voltroWorkflowWatermarksTable as Jt } from "./watermarkTable.js";
|
|
33
|
+
import { newestEventAt as Yt, planCancellations as Xt } from "./cancelOnPlan.js";
|
|
34
|
+
import { CANCEL_ON_WATERMARK as Zt, DEFAULT_COLD_LOOKBACK_MS as Qt, DEFAULT_EVENT_BATCH as $t, EVENTS_TABLE as en, WATERMARKS_TABLE as tn, readWatermark as nn, sweepCancelOn as rn, writeWatermark as an } from "./cancelOnSweep.js";
|
|
35
|
+
import { DEFAULT_STALL_AFTER_MS as on, DEFAULT_STALL_EVENT_LOOKBACK as sn, DEFAULT_STALL_RUN_PAGE as cn, sweepStalledRuns as ln } from "./stalenessSweep.js";
|
|
36
|
+
import { CLUSTER_REREAD_WINDOW_MS as un, ClusterDiagnostics as dn, describeStalledRun as fn } from "./clusterDiagnostics.js";
|
|
37
|
+
import { DEFAULT_DRAIN_BATCH as pn, acceptAdmissionSubmission as mn, drainTick as hn, isUnacknowledgedSubmission as gn } from "./admissionDrainer.js";
|
|
38
|
+
import { DEFAULT_SUSPEND_HINT_MS as _n, maybeHintSuspendingSignal as vn, resetSuspendHintsForTest as yn, resolveSuspendHintMs as bn, setSuspendSignalHintMs as xn } from "./signalHint.js";
|
|
39
|
+
import { awaitSignal as Sn } from "./signals.js";
|
|
40
|
+
import { awaitEvent as Cn } from "./awaitEvent.js";
|
|
41
|
+
import { SuspensionUnavailable as wn, WorkflowCannotPark as Tn } from "./suspensionUnavailable.js";
|
|
42
|
+
import { makeWorkflowUpdateId as En, resolveWorkflowMessageRun as Dn, sendWorkflowSignal as On, sendWorkflowUpdate as kn } from "./messages.js";
|
|
43
|
+
import { awaitSignalSuspending as An, completeSuspendingSignal as jn, suspendingSignalDeferredName as Mn } from "./signalsSuspending.js";
|
|
44
|
+
import { BUDGET_HOLDS_TABLE as Nn, BudgetHoldExpired as Pn, DEFAULT_BUDGET_HOLD_TIMEOUT_MS as Fn, _voltroBudgetHoldsTable as In, budgetHoldGeneration as Ln, budgetHoldKey as Rn, budgetHoldSignalName as zn, heldBudgets as Bn, pendingBudgetHolds as Vn, releaseBudgetHolds as Hn, suspendForBudget as Un } from "./budgetHold.js";
|
|
45
|
+
import { awaitUpdate as Wn } from "./updates.js";
|
|
46
|
+
import { inspectWorkflow as Gn } from "./inspectWorkflow.js";
|
|
47
|
+
import { makeInMemoryRecorder as Kn } from "./inMemoryRecorder.js";
|
|
48
|
+
import { DEFAULT_MAX_RUN_RECLAIMS as qn, DEFAULT_REPLAY_SHAPE_LIMIT as Jn, makeWorkflowRunRecorder as Yn, normaliseWorkflowPatches as Xn, resolveRunGuardTuning as Zn, serialiseWorkflowRowForWire as Qn, truncateWorkflowValue as $n, wrapWorkflowExecuteWithRunRecording as er } from "./runRecording.js";
|
|
49
|
+
import { recordWorkflowExecutionRefusal as tr } from "./executionRefusal.js";
|
|
50
|
+
export { et as ADMISSIONS_TABLE, Ie as ADMISSION_SUBMISSION_ID_PREFIX, Nn as BUDGET_HOLDS_TABLE, Pn as BudgetHoldExpired, Zt as CANCEL_ON_WATERMARK, un as CLUSTER_REREAD_WINDOW_MS, dn as ClusterDiagnostics, C as CurrentWorkflowExecutionId, w as CurrentWorkflowPatches, I as CurrentWorkflowReplayShape, T as CurrentWorkflowRunId, E as CurrentWorkflowStep, Fn as DEFAULT_BUDGET_HOLD_TIMEOUT_MS, Qt as DEFAULT_COLD_LOOKBACK_MS, pn as DEFAULT_DRAIN_BATCH, $t as DEFAULT_EVENT_BATCH, tt as DEFAULT_LEASE_MS, qn as DEFAULT_MAX_RUN_RECLAIMS, Jn as DEFAULT_REPLAY_SHAPE_LIMIT, on as DEFAULT_STALL_AFTER_MS, sn as DEFAULT_STALL_EVENT_LOOKBACK, cn as DEFAULT_STALL_RUN_PAGE, _n as DEFAULT_SUSPEND_HINT_MS, M as DEFAULT_WORKFLOW_SCHEDULE_MAX_RUNTIME_MS, _ as DEFERRING_CONTROLS, en as EVENTS_TABLE, we as FlowControlKeyError, nt as PAUSES_TABLE, rt as PENDING_TABLE, i as STEP_JOURNAL_BINDING, Le as SUBMISSIONS_TABLE, wn as SuspensionUnavailable, tn as WATERMARKS_TABLE, a as WORKFLOW_JOURNAL_BINDING, Tn as WorkflowCannotPark, B as WorkflowFlowControlProperty, V as WorkflowMessagesProperty, D as WorkflowRunRecorder, N as WorkflowScheduleProperty, Je as WorkflowStartRequestConflictError, O as WorkflowStepInterceptorTag, H as WorkflowVersionTypeId, U as WorkflowWorkerLayerTypeId, In as _voltroBudgetHoldsTable, me as _voltroWorkflowAdmissionLocksTable, he as _voltroWorkflowAdmissionsTable, ge as _voltroWorkflowControlRequestsTable, _e as _voltroWorkflowFailureReportsTable, ve as _voltroWorkflowParentClosuresTable, ye as _voltroWorkflowPausesTable, be as _voltroWorkflowPendingTable, fe as _voltroWorkflowRunEventsTable, de as _voltroWorkflowRunStepsTable, ue as _voltroWorkflowRunsTable, pe as _voltroWorkflowStartContextsTable, xe as _voltroWorkflowStartReceiptsTable, Se as _voltroWorkflowSubmissionsTable, Jt as _voltroWorkflowWatermarksTable, mn as acceptAdmissionSubmission, Tt as acceptWorkflowControlInTransaction, Re as acknowledgeAdmissionSubmission, it as admissionLeaseHeldPredicate, Kt as admitStart, at as allIntents, v as assertConsistentPools, t as attachPreparedWorkflowExecution, Cn as awaitEvent, Sn as awaitSignal, An as awaitSignalSuspending, Wn as awaitUpdate, ze as beginAdmissionSubmissionDispatchInTransaction, Et as beginWorkflowControlDispatchInTransaction, Dt as bindWorkflowResumeJournalInTransaction, Ye as bindWorkflowStartReceipts, Ln as budgetHoldGeneration, Rn as budgetHoldKey, zn as budgetHoldSignalName, Bt as cancelQueuedWorkflowStartInTransaction, Ft as cancelSuspendedWorkflowRunInTransaction, Te as comparePendingOrder, jn as completeSuspendingSignal, It as completeWorkflowRunGenerationInTransaction, k as currentWorkflowStep, ot as deadLetterIntent, Ee as decideAdmission, y as deferringControlsOf, st as deleteIntent, fn as describeStalledRun, ct as discardIntent, lt as discardIntentInTransaction, hn as drainTick, ut as dueIntents, W as durableClock, G as durableQueue, K as durableQueueModule, Lt as enterWorkflowRunGenerationInTransaction, dt as evaluateAdmission, n as executePreparedWorkflow, e as failureMessage, A as getCurrentWorkflowExecutionId, j as getCurrentWorkflowRunId, q as getWorkflowFlowControl, o as getWorkflowJournalCipher, P as getWorkflowSchedule, J as getWorkflowVersionMetadata, Pe as handoffWorkflowFailureInTransaction, b as hasCancelOn, x as hasFlowControl, r as hasPreparedWorkflowExecution, Bn as heldBudgets, le as inMemoryWorkflowEngineLayer, Ht as inspectAdmissionSubmissionRetry, Gn as inspectWorkflow, Y as isCarrier, De as isFinishExpired, s as isSealedJournalValue, Oe as isStartExpired, gn as isUnacknowledgedSubmission, c as isWorkflowEncrypted, X as isWorkflowWorkerLayer, qt as linkExecution, Kn as makeInMemoryRecorder, L as makeReplayShapeTracker, Yn as makeWorkflowRunRecorder, En as makeWorkflowUpdateId, vn as maybeHintSuspendingSignal, Be as newAdmissionSubmissionId, Yt as newestEventAt, ke as nextSlotAt, R as nondeterminismEventPayload, Xn as normaliseWorkflowPatches, Ve as noteAdmissionSubmissionFailure, ft as noteIntentAttempt, l as openErrorText, u as openEventPayload, d as openJournalValue, f as openPayloadFields, p as openWorkflowRow, pt as parkDelayedStart, Z as patch, mt as pauseWorkflow, He as pendingAdmissionSubmissions, Vn as pendingBudgetHolds, ht as pendingSlotId, gt as pendingWindow, _t as persistDefer, Xt as planCancellations, Ae as pooledConcurrencyKey, Ue as prepareAdmissionSubmissionExecutionInTransaction, Q as processQueue, vt as pruneAdmissions, $ as queueWorker, Rt as queuedCancellationRequestsTable, ee as rateLimit, yt as readAdmissionState, We as readAdmissionSubmission, bt as readPausedWorkflows, Vt as readQueuedWorkflowCancellationInTransaction, nn as readWatermark, Ot as readWorkflowControlInTransaction, Me as readWorkflowFailureRecord, At as readWorkflowRestartObservationInTransaction, Xe as readWorkflowStartReceipt, Ze as readWorkflowStartRequest, Fe as reconcileWorkflowFailureInTransaction, xt as recordAdmission, tr as recordWorkflowExecutionRefusal, Ne as recordWorkflowFailureInTransaction, Qe as recordWorkflowStartReceipt, Ge as rejectAdmissionSubmissionInTransaction, Hn as releaseBudgetHolds, St as releaseLease, z as reportNondeterminism, Ke as reserveAdmissionSubmission, qe as reserveAdmissionSubmissionInTransaction, jt as reserveWorkflowRestartInTransaction, yn as resetSuspendHintsForTest, je as resolveAdmissionKeys, Zn as resolveRunGuardTuning, bn as resolveSuspendHintMs, Dn as resolveWorkflowMessageRun, $e as resolveWorkflowStartReceipt, Ct as resumeWorkflow, Ut as retryAdmissionSubmissionInTransaction, wt as retryDeadLetterIntent, m as sealJournalValue, On as sendWorkflowSignal, kn as sendWorkflowUpdate, Qn as serialiseWorkflowRowForWire, xn as setSuspendSignalHintMs, h as setWorkflowJournalCipher, te as sleep, ne as sleepUntil, kt as stageWorkflowParentClosureInTransaction, re as step, ie as stepIdempotencyKey, ae as stepModule, Un as suspendForBudget, Mn as suspendingSignalDeferredName, rn as sweepCancelOn, ln as sweepStalledRuns, Wt as takeAdmittedSubmissionInTransaction, Gt as takePendingAdmissionSubmission, $n as truncateWorkflowValue, g as tryOpenJournalValue, S as validateFlowControl, F as validateWorkflowSchedule, Ce as withAdmissionTransaction, oe as withCompensation, Mt as withdrawWorkflowRestartInTransaction, se as workflow, zt as workflowJournalRoutingTable, ce as workflowModule, Nt as workflowRestartRequestsTable, Pt as workflowRestartWithdrawalsTable, er as wrapWorkflowExecuteWithRunRecording, an as writeWatermark };
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { openJournalValue as e, openPayloadFields as t } from "./journalEncryption.js";
|
|
2
|
+
import { _voltroWorkflowRunsTable as n } from "./runsTable.js";
|
|
3
|
+
import { _voltroWorkflowRunStepsTable as r } from "./runStepsTable.js";
|
|
4
|
+
import { eq as i, or as a, queryFor as o } from "@voltro/database";
|
|
5
|
+
import { types as s } from "node:util";
|
|
6
|
+
//#region src/inspectWorkflow.ts
|
|
7
|
+
var c = (e) => {
|
|
8
|
+
if (e == null) return null;
|
|
9
|
+
if (e instanceof Date) return e;
|
|
10
|
+
if (typeof e == "string" || typeof e == "number") {
|
|
11
|
+
let t = new Date(e);
|
|
12
|
+
return Number.isNaN(t.getTime()) ? null : t;
|
|
13
|
+
}
|
|
14
|
+
return null;
|
|
15
|
+
}, l = (e) => typeof e == "number" ? e : e == null ? null : Number(e), u = (e) => e == null ? null : String(e), d = (e) => {
|
|
16
|
+
if (s.isProxy(e)) return !1;
|
|
17
|
+
let t = Object.getPrototypeOf(e);
|
|
18
|
+
if (t !== null && t !== Object.prototype) return !1;
|
|
19
|
+
for (let t of Reflect.ownKeys(e)) {
|
|
20
|
+
let n = Object.getOwnPropertyDescriptor(e, t);
|
|
21
|
+
if (n === void 0 || !("value" in n)) return !1;
|
|
22
|
+
}
|
|
23
|
+
let n = Object.getOwnPropertyDescriptor(e, "stepName");
|
|
24
|
+
if (n === void 0 || !("value" in n) || typeof n.value != "string") return !1;
|
|
25
|
+
for (let t of [
|
|
26
|
+
"attempt",
|
|
27
|
+
"durationMs",
|
|
28
|
+
"errorTag",
|
|
29
|
+
"errorMessage",
|
|
30
|
+
"startedAt"
|
|
31
|
+
]) {
|
|
32
|
+
let n = Object.getOwnPropertyDescriptor(e, t);
|
|
33
|
+
if (n === void 0) {
|
|
34
|
+
if (t in e) return !1;
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
let r = n.value;
|
|
38
|
+
if (typeof r == "object" && r && s.isProxy(r) || !(t === "startedAt" && r instanceof Date && Object.getPrototypeOf(r) === Date.prototype && Reflect.ownKeys(r).length === 0) && r != null && typeof r != "number" && typeof r != "string" && typeof r != "boolean") return !1;
|
|
39
|
+
}
|
|
40
|
+
return !0;
|
|
41
|
+
}, f = (e) => {
|
|
42
|
+
let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), r = !s.isProxy(e) && Object.getPrototypeOf(e) === Array.prototype && !Object.hasOwn(e, Symbol.iterator) && e.find === Array.prototype.find, i = 0;
|
|
43
|
+
for (let a of e) {
|
|
44
|
+
let o = r ? Object.getOwnPropertyDescriptor(e, String(i)) : void 0;
|
|
45
|
+
(o === void 0 || !("value" in o) || !d(a)) && (r = !1), i++;
|
|
46
|
+
let s = String(a.stepName), c = t.get(s);
|
|
47
|
+
c === void 0 ? (t.set(s, [a]), n.set(s, a)) : c.push(a);
|
|
48
|
+
}
|
|
49
|
+
let a = [];
|
|
50
|
+
for (let [e, n] of t) {
|
|
51
|
+
n.sort((e, t) => (l(e.attempt) ?? 0) - (l(t.attempt) ?? 0));
|
|
52
|
+
let t = n[n.length - 1], r = u(t.errorTag), i = u(t.errorMessage), o = r !== null || i !== null ? {
|
|
53
|
+
tag: r,
|
|
54
|
+
message: i ?? ""
|
|
55
|
+
} : null;
|
|
56
|
+
a.push({
|
|
57
|
+
name: e,
|
|
58
|
+
attempt: l(t.attempt) ?? n.length,
|
|
59
|
+
attempts: n.length,
|
|
60
|
+
status: t.status ?? "running",
|
|
61
|
+
input: t.input ?? null,
|
|
62
|
+
output: t.output ?? null,
|
|
63
|
+
error: o,
|
|
64
|
+
durationMs: l(t.durationMs)
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
return a.sort((t, i) => {
|
|
68
|
+
let a = r ? n.get(t.name) : e.find((e) => String(e.stepName) === t.name), o = r ? n.get(i.name) : e.find((e) => String(e.stepName) === i.name);
|
|
69
|
+
return (c(a?.startedAt)?.getTime() ?? 0) - (c(o?.startedAt)?.getTime() ?? 0);
|
|
70
|
+
}), a;
|
|
71
|
+
}, p = (e) => {
|
|
72
|
+
if (e == null) return null;
|
|
73
|
+
if (typeof e == "string") try {
|
|
74
|
+
return JSON.parse(e);
|
|
75
|
+
} catch {
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
return typeof e == "object" ? e : null;
|
|
79
|
+
}, m = async (s, l) => {
|
|
80
|
+
let d = o(n), m = (await l.query(d.where(a(i("id", s), i("executionId", s))).limit(1).descriptor))[0];
|
|
81
|
+
if (m === void 0) return null;
|
|
82
|
+
let h = String(m.id), g = o(r), _ = await l.query(g.where(i("runId", h)).descriptor);
|
|
83
|
+
return {
|
|
84
|
+
id: h,
|
|
85
|
+
executionId: u(m.executionId) ?? "",
|
|
86
|
+
name: u(m.tag) ?? "",
|
|
87
|
+
status: m.status ?? "running",
|
|
88
|
+
input: t(m.payload ?? null, "workflow run payload"),
|
|
89
|
+
output: e(m.output ?? null, "workflow run result"),
|
|
90
|
+
subject: p(m.subject),
|
|
91
|
+
source: u(m.source),
|
|
92
|
+
steps: f(_),
|
|
93
|
+
startedAt: c(m.startedAt) ?? /* @__PURE__ */ new Date(0),
|
|
94
|
+
finishedAt: c(m.completedAt),
|
|
95
|
+
traceId: u(m.traceId),
|
|
96
|
+
parentExecutionId: u(m.parentExecutionId),
|
|
97
|
+
parentClosePolicy: u(m.parentClosePolicy)
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
//#endregion
|
|
101
|
+
export { m as inspectWorkflow };
|