@fluidgrids/workflows 2026.1027.0 → 2026.1028.1

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.
Files changed (168) hide show
  1. package/README.md +170 -18
  2. package/dist/activation-BBh1p82z.d.cts +57 -0
  3. package/dist/activation-DnhG7SmF.d.ts +57 -0
  4. package/dist/assemble-BLqQ8lSu.d.cts +39 -0
  5. package/dist/assemble-DWgaXHd-.d.ts +39 -0
  6. package/dist/chunk-2DP2Y6EU.cjs +832 -0
  7. package/dist/chunk-2J6TF7YI.cjs +86 -0
  8. package/dist/chunk-3FOTFQ3J.js +1622 -0
  9. package/dist/chunk-4LYSEANA.js +199 -0
  10. package/dist/{chunk-KUTMY2IO.cjs → chunk-57MSZ24T.cjs} +162 -98
  11. package/dist/{chunk-BWSLWF2E.js → chunk-5HDSBTBX.js} +99 -32
  12. package/dist/chunk-623FVQSN.cjs +251 -0
  13. package/dist/{chunk-4DPEGDPW.js → chunk-6FSHT5IL.js} +4 -4
  14. package/dist/{chunk-REV7ZOA4.js → chunk-7AAZGVKD.js} +1 -35
  15. package/dist/chunk-7NQ37GZU.js +73 -0
  16. package/dist/chunk-ABFZWYHT.js +612 -0
  17. package/dist/{chunk-SS4LT2IP.js → chunk-BD7ZPG53.js} +5 -10
  18. package/dist/chunk-BO6OVILK.js +79 -0
  19. package/dist/chunk-C5OLWZ42.js +245 -0
  20. package/dist/chunk-CBL5JSCC.cjs +75 -0
  21. package/dist/{chunk-LSKSBVL4.cjs → chunk-CPDK3K5N.cjs} +6 -6
  22. package/dist/chunk-CSNWNFKU.cjs +1635 -0
  23. package/dist/chunk-DJYMDLV5.js +227 -0
  24. package/dist/{chunk-X4HKU3MX.js → chunk-E2VK7J2C.js} +3 -1
  25. package/dist/chunk-FMSW2HDF.cjs +267 -0
  26. package/dist/chunk-FQIHX7YI.cjs +80 -0
  27. package/dist/chunk-FR7KYWRO.cjs +41 -0
  28. package/dist/{chunk-AU3YW7FZ.cjs → chunk-GBQ33SIZ.cjs} +46 -51
  29. package/dist/{chunk-RRQ5HOBF.cjs → chunk-GVTZMA5C.cjs} +4 -4
  30. package/dist/chunk-H7KEVW2M.js +816 -0
  31. package/dist/chunk-HR3BN4C4.cjs +27 -0
  32. package/dist/chunk-IISBRUWJ.js +13 -0
  33. package/dist/chunk-JD2VQIDZ.cjs +15 -0
  34. package/dist/{chunk-PL73GJR4.js → chunk-JZ4TOOLN.js} +1 -1
  35. package/dist/chunk-L24YIZY7.cjs +207 -0
  36. package/dist/chunk-LNUQE6D6.js +39 -0
  37. package/dist/{chunk-BYJ7QTLY.cjs → chunk-NEIUQASE.cjs} +13 -13
  38. package/dist/chunk-P6TA5EZT.cjs +634 -0
  39. package/dist/chunk-PDHLTDZB.js +72 -0
  40. package/dist/chunk-PMCM2OH4.js +46 -0
  41. package/dist/chunk-PZCVF76Q.cjs +868 -0
  42. package/dist/{chunk-GO34UHSY.js → chunk-QAN5MZEM.js} +3 -3
  43. package/dist/{chunk-27HASETB.cjs → chunk-QKZL3ONM.cjs} +3 -1
  44. package/dist/chunk-SAENRNBJ.cjs +52 -0
  45. package/dist/{chunk-LMX35GNQ.js → chunk-SMCANK3F.js} +5 -4
  46. package/dist/{chunk-IZQNUNSU.cjs → chunk-SX2PNKKT.cjs} +18 -17
  47. package/dist/{chunk-LRM6JXJA.cjs → chunk-TBDXTV22.cjs} +0 -37
  48. package/dist/chunk-VOKMAAJP.js +848 -0
  49. package/dist/chunk-XB53G2DK.js +25 -0
  50. package/dist/chunk-Z2Y65YOY.cjs +7 -0
  51. package/dist/codegen/index.cjs +9 -7
  52. package/dist/codegen/index.d.cts +2 -2
  53. package/dist/codegen/index.d.ts +2 -2
  54. package/dist/codegen/index.js +6 -5
  55. package/dist/file-BOoHZgoQ.d.cts +1557 -0
  56. package/dist/file-yuPCFU5b.d.ts +1557 -0
  57. package/dist/history/index.cjs +287 -0
  58. package/dist/history/index.d.cts +157 -0
  59. package/dist/history/index.d.ts +157 -0
  60. package/dist/history/index.js +5 -0
  61. package/dist/index.cjs +134 -36
  62. package/dist/index.d.cts +137 -9
  63. package/dist/index.d.ts +137 -9
  64. package/dist/index.js +8 -3
  65. package/dist/ir/index.cjs +161 -165
  66. package/dist/ir/index.d.cts +32 -12
  67. package/dist/ir/index.d.ts +32 -12
  68. package/dist/ir/index.js +54 -61
  69. package/dist/lower-BuSvAFqi.d.cts +129 -0
  70. package/dist/lower-C_Qv_34S.d.ts +129 -0
  71. package/dist/lower-types-nofRXw9c.d.cts +15 -0
  72. package/dist/lower-types-nofRXw9c.d.ts +15 -0
  73. package/dist/{manifest-Duf-gHdO.d.cts → manifest-0OLw0i7k.d.cts} +1 -1
  74. package/dist/{manifest-Bp9ZJlav.d.ts → manifest-C8N6HDYl.d.ts} +1 -1
  75. package/dist/node-evaluator-CJNP4GHX.js +12 -0
  76. package/dist/node-evaluator-DMKPKUWA.cjs +22 -0
  77. package/dist/quickjs/index.cjs +256 -78
  78. package/dist/quickjs/index.d.cts +48 -7
  79. package/dist/quickjs/index.d.ts +48 -7
  80. package/dist/quickjs/index.js +254 -79
  81. package/dist/roundtrip/index.cjs +404 -129
  82. package/dist/roundtrip/index.d.cts +43 -8
  83. package/dist/roundtrip/index.d.ts +43 -8
  84. package/dist/roundtrip/index.js +260 -19
  85. package/dist/runtime/index.cjs +90 -0
  86. package/dist/runtime/index.d.cts +297 -0
  87. package/dist/runtime/index.d.ts +297 -0
  88. package/dist/runtime/index.js +8 -0
  89. package/dist/testing/index.cjs +1057 -0
  90. package/dist/testing/index.d.cts +305 -0
  91. package/dist/testing/index.d.ts +305 -0
  92. package/dist/testing/index.js +1037 -0
  93. package/dist/{types-Dr2Fn1Ax.d.ts → types-BGoPzgcl.d.cts} +1 -1
  94. package/dist/{types-Dr2Fn1Ax.d.cts → types-BGoPzgcl.d.ts} +1 -1
  95. package/dist/types-CpBBjaGX.d.cts +380 -0
  96. package/dist/types-DV-HX_Gt.d.ts +380 -0
  97. package/dist/{assemble-DMOuaxRI.d.ts → workflow-Bpr3vnA_.d.ts} +60 -162
  98. package/dist/workflow-C2a05WUJ.d.ts +444 -0
  99. package/dist/{assemble-BJo9TECS.d.cts → workflow-FXUkpIBc.d.cts} +60 -162
  100. package/dist/workflow-J-yYixny.d.cts +444 -0
  101. package/fixtures/README.md +128 -0
  102. package/fixtures/histories/activity-failure-fails-run.history.json +163 -0
  103. package/fixtures/histories/activity-retry-then-success.history.json +147 -0
  104. package/fixtures/histories/cancel-activity-abandon.history.json +126 -0
  105. package/fixtures/histories/cancel-activity-compensate.history.json +307 -0
  106. package/fixtures/histories/cancel-concurrent-non-cancellable.history.json +234 -0
  107. package/fixtures/histories/cancel-concurrent-scope-timeout.history.json +184 -0
  108. package/fixtures/histories/cancel-condition-after-cancel.history.json +200 -0
  109. package/fixtures/histories/cancel-during-timer.history.json +123 -0
  110. package/fixtures/histories/cancel-saga-compensations.history.json +325 -0
  111. package/fixtures/histories/cancel-scope-timeout.history.json +148 -0
  112. package/fixtures/histories/child-abandon-outlives-parent.history.json +191 -0
  113. package/fixtures/histories/child-cancel-default.history.json +234 -0
  114. package/fixtures/histories/child-cancel-request.history.json +206 -0
  115. package/fixtures/histories/child-durable-child-side.history.json +124 -0
  116. package/fixtures/histories/child-durable-result.history.json +163 -0
  117. package/fixtures/histories/child-failure-caught.history.json +166 -0
  118. package/fixtures/histories/child-graph-by-key.history.json +138 -0
  119. package/fixtures/histories/child-terminated-by-parent-close.history.json +85 -0
  120. package/fixtures/histories/continue-as-new-first-run.history.json +146 -0
  121. package/fixtures/histories/continue-as-new-history-limit.history.json +489 -0
  122. package/fixtures/histories/continue-as-new-last-run.history.json +147 -0
  123. package/fixtures/histories/continue-as-new-suggested.history.json +352 -0
  124. package/fixtures/histories/details-and-context.history.json +176 -0
  125. package/fixtures/histories/deterministic-values.history.json +128 -0
  126. package/fixtures/histories/engine-builtins.history.json +172 -0
  127. package/fixtures/histories/gather-activities.history.json +291 -0
  128. package/fixtures/histories/gather-all-settled.history.json +219 -0
  129. package/fixtures/histories/gather-mixed.history.json +281 -0
  130. package/fixtures/histories/input-during-running-task.history.json +111 -0
  131. package/fixtures/histories/nondeterminism-reordered.history.json +218 -0
  132. package/fixtures/histories/patched-deprecated.history.json +271 -0
  133. package/fixtures/histories/patched-new-run.history.json +270 -0
  134. package/fixtures/histories/patched-old-history.history.json +190 -0
  135. package/fixtures/histories/race-activity-wins.history.json +152 -0
  136. package/fixtures/histories/race-signal-beats-child.history.json +161 -0
  137. package/fixtures/histories/race-timeout-wins.history.json +118 -0
  138. package/fixtures/histories/side-effect-recorded.history.json +153 -0
  139. package/fixtures/histories/signal-buffered-at-start.history.json +157 -0
  140. package/fixtures/histories/signal-default-handler.history.json +187 -0
  141. package/fixtures/histories/signal-handler.history.json +191 -0
  142. package/fixtures/histories/signal-parent-child-side.history.json +132 -0
  143. package/fixtures/histories/signal-parent.history.json +202 -0
  144. package/fixtures/histories/signal-run-delivered.history.json +128 -0
  145. package/fixtures/histories/signal-run-undelivered.history.json +134 -0
  146. package/fixtures/histories/signal-wait.history.json +111 -0
  147. package/fixtures/histories/task-failure-code-error.history.json +137 -0
  148. package/fixtures/histories/task-failure-then-transient-attempt.history.json +140 -0
  149. package/fixtures/histories/timer-condition-met.history.json +201 -0
  150. package/fixtures/histories/timer-condition-timeout.history.json +118 -0
  151. package/fixtures/histories/timer-sleep-once.history.json +118 -0
  152. package/fixtures/histories/timer-sleep-sequence.history.json +210 -0
  153. package/fixtures/histories/update-accepted-completed.history.json +149 -0
  154. package/fixtures/histories/update-with-start-rejected-validation.history.json +91 -0
  155. package/package.json +85 -20
  156. package/schema/history-file.schema.json +2544 -0
  157. package/schema/ir-v2.schema.json +16 -0
  158. package/schema/run-event.schema.json +2374 -0
  159. package/schema/workflow-command.schema.json +1095 -0
  160. package/schema/workflow-task.schema.json +3560 -0
  161. package/dist/chunk-265J2FCH.cjs +0 -33
  162. package/dist/chunk-LUXCXFOE.cjs +0 -269
  163. package/dist/chunk-S34NJE3A.js +0 -262
  164. package/dist/chunk-SRQRLWOS.js +0 -31
  165. package/dist/lower-DcOY8ux0.d.cts +0 -49
  166. package/dist/lower-Dw5grNrI.d.ts +0 -49
  167. package/dist/node-evaluator-2GTUZVPK.cjs +0 -17
  168. package/dist/node-evaluator-RMYEWCXZ.js +0 -8
@@ -222,4 +222,4 @@ interface WorkflowDefinition {
222
222
  [key: string]: unknown;
223
223
  }
224
224
 
225
- export type { CodeBundleActivityExport as C, ErrorType as E, Json as J, LegacyCredentialRef as L, NodeArgs as N, Position as P, RetryConfig as R, WorkflowDefinition as W, JsonObject as a, WorkflowInterface as b, CodeBundleWorkflowExport as c, ConnectionRef as d, ExecutionSettings as e, NodeErrorConfig as f, NodeTimeout as g, RunOnSetting as h, WorkflowAuthoring as i, WorkflowCode as j, WorkflowConfig as k, WorkflowEdge as l, WorkflowNode as m };
225
+ export type { CodeBundleActivityExport as C, ErrorType as E, JsonObject as J, LegacyCredentialRef as L, NodeArgs as N, Position as P, RetryConfig as R, WorkflowInterface as W, Json as a, WorkflowDefinition as b, CodeBundleWorkflowExport as c, ConnectionRef as d, ExecutionSettings as e, NodeErrorConfig as f, NodeTimeout as g, RunOnSetting as h, WorkflowAuthoring as i, WorkflowCode as j, WorkflowConfig as k, WorkflowEdge as l, WorkflowNode as m };
@@ -222,4 +222,4 @@ interface WorkflowDefinition {
222
222
  [key: string]: unknown;
223
223
  }
224
224
 
225
- export type { CodeBundleActivityExport as C, ErrorType as E, Json as J, LegacyCredentialRef as L, NodeArgs as N, Position as P, RetryConfig as R, WorkflowDefinition as W, JsonObject as a, WorkflowInterface as b, CodeBundleWorkflowExport as c, ConnectionRef as d, ExecutionSettings as e, NodeErrorConfig as f, NodeTimeout as g, RunOnSetting as h, WorkflowAuthoring as i, WorkflowCode as j, WorkflowConfig as k, WorkflowEdge as l, WorkflowNode as m };
225
+ export type { CodeBundleActivityExport as C, ErrorType as E, JsonObject as J, LegacyCredentialRef as L, NodeArgs as N, Position as P, RetryConfig as R, WorkflowInterface as W, Json as a, WorkflowDefinition as b, CodeBundleWorkflowExport as c, ConnectionRef as d, ExecutionSettings as e, NodeErrorConfig as f, NodeTimeout as g, RunOnSetting as h, WorkflowAuthoring as i, WorkflowCode as j, WorkflowConfig as k, WorkflowEdge as l, WorkflowNode as m };
@@ -0,0 +1,380 @@
1
+ import { J as JsonObject, E as ErrorType, a as Json } from './types-BGoPzgcl.cjs';
2
+
3
+ /**
4
+ * The durable-function history contract (PLAN-B C-HIST, C-CMD, C-ABI):
5
+ * event types, command types, workflow-task failure causes, failures and the
6
+ * records the service stores in `workflow_run_events`.
7
+ *
8
+ * This module is pure data and types. It has no imports with side effects, so
9
+ * the runtime that runs inside the isolate can bundle it, and the service, the
10
+ * workers and the Python SDK read the same lists through the JSON Schemas in
11
+ * `schema/` (generated from `schema.ts`).
12
+ */
13
+
14
+ /** Version of the runtime ABI and of the history file format. */
15
+ declare const HISTORY_PROTOCOL = 1;
16
+ /** Every value of the `type` column of `workflow_run_events`, UPPER_SNAKE (DB4). */
17
+ declare const EVENT_TYPES: readonly ["WORKFLOW_STARTED", "WORKFLOW_TASK_SCHEDULED", "WORKFLOW_TASK_STARTED", "WORKFLOW_TASK_COMPLETED", "WORKFLOW_TASK_FAILED", "WORKFLOW_TASK_TIMED_OUT", "ACTIVITY_SCHEDULED", "ACTIVITY_STARTED", "ACTIVITY_HEARTBEAT", "ACTIVITY_COMPLETED", "ACTIVITY_FAILED", "ACTIVITY_TIMED_OUT", "ACTIVITY_CANCEL_REQUESTED", "ACTIVITY_CANCELLED", "ACTIVITY_PAUSED", "ACTIVITY_UNPAUSED", "ACTIVITY_RESET", "ACTIVITY_OPTIONS_UPDATED", "TIMER_STARTED", "TIMER_FIRED", "TIMER_CANCELLED", "SIGNAL_RECEIVED", "UPDATE_ADMITTED", "UPDATE_ACCEPTED", "UPDATE_COMPLETED", "CHILD_RUN_INITIATED", "CHILD_RUN_STARTED", "CHILD_RUN_COMPLETED", "CHILD_RUN_FAILED", "CHILD_RUN_CANCELLED", "CHILD_RUN_TERMINATED", "CHILD_RUN_TIMED_OUT", "EXTERNAL_RUN_CANCEL_REQUESTED", "EXTERNAL_RUN_CANCEL_RESOLVED", "EXTERNAL_RUN_SIGNALED", "SIDE_EFFECT_RECORDED", "LOCAL_ACTIVITY_COMPLETED", "LOCAL_ACTIVITY_FAILED", "SEARCH_ATTRIBUTES_UPSERTED", "CONTEXT_UPSERTED", "MARKER_RECORDED", "WORKFLOW_CANCEL_REQUESTED", "WORKFLOW_RESET", "VERSIONING_OVERRIDE_SET", "WORKFLOW_COMPLETED", "WORKFLOW_FAILED", "WORKFLOW_CANCELLED", "WORKFLOW_TERMINATED", "WORKFLOW_TIMED_OUT", "WORKFLOW_CONTINUED_AS_NEW"];
18
+ type RunEventType = (typeof EVENT_TYPES)[number];
19
+ /** Every command a workflow task may return (C-CMD), UPPER_SNAKE. */
20
+ declare const COMMAND_TYPES: readonly ["SCHEDULE_ACTIVITY", "REQUEST_CANCEL_ACTIVITY", "START_TIMER", "CANCEL_TIMER", "START_CHILD_RUN", "SIGNAL_RUN", "RECORD_SIDE_EFFECT", "RECORD_MARKER", "COMPLETE_WORKFLOW", "FAIL_WORKFLOW", "CANCEL_WORKFLOW", "UPSERT_CONTEXT", "RECORD_LOCAL_ACTIVITY", "CONTINUE_AS_NEW", "REQUEST_CANCEL_EXTERNAL_RUN", "UPSERT_SEARCH_ATTRIBUTES", "ACCEPT_UPDATE", "REJECT_UPDATE", "COMPLETE_UPDATE"];
21
+ type CommandType = (typeof COMMAND_TYPES)[number];
22
+ /** Commands of the Phase B core release. */
23
+ declare const PHASE_B_CORE_COMMANDS: ReadonlySet<CommandType>;
24
+ /** Commands of the Phase B parity releases (defined now, enabled by the service per release). */
25
+ declare const PHASE_B_PARITY_COMMANDS: ReadonlySet<CommandType>;
26
+ /** Commands that are defined but refused in Phase B (`UNSUPPORTED_COMMAND`). */
27
+ declare const PHASE_C_COMMANDS: ReadonlySet<CommandType>;
28
+ /** Commands that end the run; one may appear, and only last in a batch. */
29
+ declare const TERMINAL_COMMANDS: ReadonlySet<CommandType>;
30
+ /** Why a workflow task failed (`WorkflowTaskFailureCause`). A task failure never fails the run. */
31
+ declare const TASK_FAILURE_CAUSES: readonly ["NON_DETERMINISM", "TASK_TIMEOUT", "ISOLATE_MEMORY", "PROTOCOL_MISMATCH", "BUNDLE_UNAVAILABLE", "BUNDLE_INTEGRITY", "WORKFLOW_CODE_ERROR", "HISTORY_LIMIT", "UNSUPPORTED_COMMAND", "INVALID_REQUEST", "INTERNAL"];
32
+ type WorkflowTaskFailureCause = (typeof TASK_FAILURE_CAUSES)[number];
33
+ /** The shared `ErrorType` enum, as a list. */
34
+ declare const ERROR_TYPES: readonly ErrorType[];
35
+ /** `ExecutionKind`. */
36
+ declare const EXECUTION_KINDS: readonly ["GRAPH", "DURABLE_FN"];
37
+ type ExecutionKind = (typeof EXECUTION_KINDS)[number];
38
+ /** `ParentClosePolicy`. */
39
+ declare const PARENT_CLOSE_POLICIES: readonly ["TERMINATE", "ABANDON", "REQUEST_CANCEL"];
40
+ type ParentClosePolicy = (typeof PARENT_CLOSE_POLICIES)[number];
41
+ /** Activity cancellation types (11 §2.5). */
42
+ declare const ACTIVITY_CANCELLATION_TYPES: readonly ["WAIT_CANCELLATION_COMPLETED", "TRY_CANCEL", "ABANDON"];
43
+ type ActivityCancellationType = (typeof ACTIVITY_CANCELLATION_TYPES)[number];
44
+ /** Child cancellation types (11 §2.5). */
45
+ declare const CHILD_CANCELLATION_TYPES: readonly ["WAIT_CANCELLATION_COMPLETED", "WAIT_CANCELLATION_REQUESTED", "TRY_CANCEL", "ABANDON"];
46
+ type ChildCancellationType = (typeof CHILD_CANCELLATION_TYPES)[number];
47
+ /** Where a failure came from (11 §2.25). */
48
+ type FailureSource = 'sdk-ts' | 'sdk-py' | 'engine' | `node:${string}`;
49
+ /**
50
+ * A failure as it is stored in history and passed between the SDK, the
51
+ * service and the workers (11 §2.25). `type` is the free-form application
52
+ * type; `errorType` is always one value of the shared enum.
53
+ */
54
+ interface Failure {
55
+ errorType: ErrorType;
56
+ message: string;
57
+ type?: string;
58
+ details?: Json;
59
+ nonRetryable?: boolean;
60
+ /** Overrides the retry policy's delay for the next attempt only. */
61
+ nextRetryDelayMs?: number;
62
+ category?: 'BENIGN';
63
+ /** For timeouts: `START_TO_CLOSE`, `SCHEDULE_TO_START`, `SCHEDULE_TO_CLOSE`, `HEARTBEAT`, `WORKFLOW_RUN`, `WORKFLOW_EXECUTION`. */
64
+ timeoutType?: string;
65
+ cause?: Failure;
66
+ stackTrace?: string;
67
+ source?: string;
68
+ }
69
+ /**
70
+ * The retry policy an activity carries (`retryConfig` plus Temporal's
71
+ * deny-list). `maxRetries` absent means unlimited attempts, bounded by
72
+ * `scheduleToCloseTimeout`.
73
+ */
74
+ interface RetryPolicy {
75
+ maxRetries?: number;
76
+ /** Delay before the first retry, in milliseconds. */
77
+ retryDelay: number;
78
+ backoffMultiplier?: number;
79
+ /** Largest delay, in milliseconds. */
80
+ maxDelay?: number;
81
+ /** Allow-list on `errorType`. */
82
+ retryOnErrorTypes?: ErrorType[];
83
+ /** Deny-list on the free-form `Failure.type`; wins over the allow-list. */
84
+ nonRetryableErrorTypes?: string[];
85
+ }
86
+ /** One stored history event, as the service returns it (offloaded payloads already inlined). */
87
+ interface RunEventRecord {
88
+ /** 1-based, gapless. */
89
+ seq: number;
90
+ type: RunEventType;
91
+ /** The workflow task that produced the event, for command events and task events. */
92
+ taskId?: string | null;
93
+ payload: JsonObject;
94
+ /** ISO 8601 timestamp. */
95
+ createdAt: string;
96
+ dedupeKey?: string | null;
97
+ }
98
+ /** An event the service is to append (no `seq` or timestamp yet). */
99
+ interface RunEventDraft {
100
+ type: RunEventType;
101
+ taskId?: string;
102
+ payload: JsonObject;
103
+ }
104
+ /** Headers carried on commands and events (interceptors, Phase C). */
105
+ type Headers = Record<string, string>;
106
+ interface CommandBase {
107
+ headers?: Headers;
108
+ }
109
+ /** Signal and cancel targets. `workflowKey`/`workflowId` addressing is parity (11 §2.1). */
110
+ type RunTarget = {
111
+ runId: string;
112
+ } | {
113
+ parent: true;
114
+ } | {
115
+ childId: string;
116
+ } | {
117
+ workflowKey: string;
118
+ workflowId: string;
119
+ };
120
+ interface ScheduleActivityCommand extends CommandBase {
121
+ type: 'SCHEDULE_ACTIVITY';
122
+ activityId: string;
123
+ kind: 'node';
124
+ nodeType: string;
125
+ nodeVersion?: string;
126
+ operation: string;
127
+ args: Json;
128
+ connection?: string;
129
+ retry: RetryPolicy;
130
+ startToCloseTimeout?: number;
131
+ scheduleToCloseTimeout?: number;
132
+ scheduleToStartTimeout?: number;
133
+ heartbeatTimeout?: number;
134
+ cancellationType?: ActivityCancellationType;
135
+ priority?: number;
136
+ summary?: string;
137
+ runOn?: string;
138
+ }
139
+ interface RequestCancelActivityCommand extends CommandBase {
140
+ type: 'REQUEST_CANCEL_ACTIVITY';
141
+ activityId: string;
142
+ }
143
+ interface StartTimerCommand extends CommandBase {
144
+ type: 'START_TIMER';
145
+ timerId: string;
146
+ durationMs: number;
147
+ summary?: string;
148
+ }
149
+ interface CancelTimerCommand extends CommandBase {
150
+ type: 'CANCEL_TIMER';
151
+ timerId: string;
152
+ }
153
+ /** Child start options (11 §2.35); everything but `parentClosePolicy` is optional. */
154
+ interface ChildRunOptions {
155
+ parentClosePolicy: ParentClosePolicy;
156
+ cancellationType?: ChildCancellationType;
157
+ taskQueue?: string;
158
+ workflowId?: string;
159
+ priority?: number;
160
+ summary?: string;
161
+ details?: string;
162
+ context?: JsonObject;
163
+ executionTimeout?: number;
164
+ runTimeout?: number;
165
+ workflowTaskTimeout?: number;
166
+ startDelay?: number;
167
+ [key: string]: Json | undefined;
168
+ }
169
+ interface StartChildRunCommand extends CommandBase {
170
+ type: 'START_CHILD_RUN';
171
+ childId: string;
172
+ /** Another workflow (graph or durable) by key. */
173
+ workflowKey?: string;
174
+ /** A function of the same bundle, by export name. */
175
+ workflowFn?: string;
176
+ /** `active`, `vN` or `@alias`; default `active`. */
177
+ version?: string;
178
+ input: Json;
179
+ options: ChildRunOptions;
180
+ }
181
+ interface SignalRunCommand extends CommandBase {
182
+ type: 'SIGNAL_RUN';
183
+ externalId: string;
184
+ target: RunTarget;
185
+ name: string;
186
+ payload: Json;
187
+ }
188
+ interface RecordSideEffectCommand extends CommandBase {
189
+ type: 'RECORD_SIDE_EFFECT';
190
+ sideEffectId: string;
191
+ value: Json;
192
+ }
193
+ interface RecordMarkerCommand extends CommandBase {
194
+ type: 'RECORD_MARKER';
195
+ markerId: string;
196
+ data: Json;
197
+ }
198
+ interface CompleteWorkflowCommand extends CommandBase {
199
+ type: 'COMPLETE_WORKFLOW';
200
+ output: Json;
201
+ }
202
+ interface FailWorkflowCommand extends CommandBase {
203
+ type: 'FAIL_WORKFLOW';
204
+ failure: Failure;
205
+ }
206
+ interface CancelWorkflowCommand extends CommandBase {
207
+ type: 'CANCEL_WORKFLOW';
208
+ }
209
+ interface UpsertContextCommand extends CommandBase {
210
+ type: 'UPSERT_CONTEXT';
211
+ entries: JsonObject;
212
+ }
213
+ interface RecordLocalActivityCommand extends CommandBase {
214
+ type: 'RECORD_LOCAL_ACTIVITY';
215
+ localActivityId: string;
216
+ result?: Json;
217
+ failure?: Failure;
218
+ attempts: number;
219
+ }
220
+ interface ContinueAsNewCommand extends CommandBase {
221
+ type: 'CONTINUE_AS_NEW';
222
+ input: Json;
223
+ options: JsonObject;
224
+ }
225
+ interface RequestCancelExternalRunCommand extends CommandBase {
226
+ type: 'REQUEST_CANCEL_EXTERNAL_RUN';
227
+ externalId: string;
228
+ target: RunTarget;
229
+ }
230
+ interface UpsertSearchAttributesCommand extends CommandBase {
231
+ type: 'UPSERT_SEARCH_ATTRIBUTES';
232
+ attributes: JsonObject;
233
+ }
234
+ interface AcceptUpdateCommand extends CommandBase {
235
+ type: 'ACCEPT_UPDATE';
236
+ updateId: string;
237
+ }
238
+ interface RejectUpdateCommand extends CommandBase {
239
+ type: 'REJECT_UPDATE';
240
+ updateId: string;
241
+ failure: Failure;
242
+ }
243
+ interface CompleteUpdateCommand extends CommandBase {
244
+ type: 'COMPLETE_UPDATE';
245
+ updateId: string;
246
+ result?: Json;
247
+ failure?: Failure;
248
+ }
249
+ /** One command, a flat object discriminated by `type` (DB4). */
250
+ type WorkflowCommand = ScheduleActivityCommand | RequestCancelActivityCommand | StartTimerCommand | CancelTimerCommand | StartChildRunCommand | SignalRunCommand | RecordSideEffectCommand | RecordMarkerCommand | CompleteWorkflowCommand | FailWorkflowCommand | CancelWorkflowCommand | UpsertContextCommand | RecordLocalActivityCommand | ContinueAsNewCommand | RequestCancelExternalRunCommand | UpsertSearchAttributesCommand | AcceptUpdateCommand | RejectUpdateCommand | CompleteUpdateCommand;
251
+ /** History caps (C-HIST). */
252
+ interface HistoryLimit {
253
+ events: number;
254
+ bytes: number;
255
+ }
256
+ declare const DEFAULT_HISTORY_LIMIT: HistoryLimit;
257
+ /** Fraction of the cap at which `continueAsNewSuggested` turns true. */
258
+ declare const CONTINUE_AS_NEW_SUGGESTED_RATIO = 0.8;
259
+ /** Fraction of the cap at which the next command throws `HistoryLimitExceeded`. */
260
+ declare const HISTORY_LIMIT_EXCEEDED_RATIO = 0.95;
261
+ /** What a task knows about its run (C-ABI `WorkflowInfoSnapshot`). */
262
+ interface WorkflowInfoSnapshot {
263
+ runId: string;
264
+ workspaceId: string;
265
+ workflowKey?: string;
266
+ version?: number | string;
267
+ buildId?: string;
268
+ businessId?: string;
269
+ attempt?: number;
270
+ taskQueue?: string;
271
+ parentRunId?: string | null;
272
+ rootRunId?: string | null;
273
+ firstRunId?: string | null;
274
+ continuedFromRunId?: string | null;
275
+ lastResult?: Json;
276
+ lastFailure?: Failure | null;
277
+ startedAt?: string;
278
+ runStartedAt?: string;
279
+ historyLimit?: HistoryLimit;
280
+ timeouts?: {
281
+ executionTimeout?: number;
282
+ runTimeout?: number;
283
+ workflowTaskTimeout?: number;
284
+ };
285
+ headers?: Headers;
286
+ priority?: number;
287
+ summary?: string;
288
+ details?: string;
289
+ context?: JsonObject;
290
+ }
291
+ /** A built-in query (11 §2.21). Custom queries are Phase C. */
292
+ type BuiltInQueryName = '__stack_trace' | '__enhanced_stack_trace' | '__metadata';
293
+ declare const BUILT_IN_QUERIES: readonly BuiltInQueryName[];
294
+ /** The input of one workflow task (C-ABI). */
295
+ interface WorkflowTaskRequest {
296
+ protocol: number;
297
+ kind: 'task' | 'query' | 'verify';
298
+ workflowFn: string;
299
+ info: WorkflowInfoSnapshot;
300
+ history: RunEventRecord[];
301
+ /** The task's start time; the clock for new side effects only. */
302
+ nowMs: number;
303
+ localActivityResults?: Array<{
304
+ localActivityId: string;
305
+ result?: Json;
306
+ failure?: Failure;
307
+ attempts: number;
308
+ }>;
309
+ queries?: Array<{
310
+ queryId: string;
311
+ name: BuiltInQueryName;
312
+ args?: Json;
313
+ }>;
314
+ }
315
+ /** A local activity the task wants run before it can continue (parity). */
316
+ interface LocalActivityRequest {
317
+ localActivityId: string;
318
+ nodeType: string;
319
+ operation: string;
320
+ args: Json;
321
+ connection?: string;
322
+ retry?: RetryPolicy;
323
+ startToCloseTimeout?: number;
324
+ }
325
+ interface TaskLogLine {
326
+ level: 'debug' | 'info' | 'warn' | 'error';
327
+ message: string;
328
+ data?: Json;
329
+ }
330
+ /** The output of one workflow task (C-ABI). */
331
+ interface WorkflowTaskResult {
332
+ protocol: number;
333
+ outcome: 'commands' | 'failed' | 'localActivityRequested';
334
+ commands: WorkflowCommand[];
335
+ localActivityRequests?: LocalActivityRequest[];
336
+ queryResults?: Array<{
337
+ queryId: string;
338
+ value?: Json;
339
+ error?: string;
340
+ }>;
341
+ failure?: {
342
+ cause: WorkflowTaskFailureCause;
343
+ message: string;
344
+ stackTrace?: string;
345
+ seq?: number;
346
+ errorType?: string;
347
+ };
348
+ logs: TaskLogLine[];
349
+ stackTrace?: string;
350
+ }
351
+ /**
352
+ * The event each command appends (C-CMD). `REJECT_UPDATE` appends nothing: a
353
+ * rejected update leaves no history (11 §2.39). `RECORD_LOCAL_ACTIVITY`
354
+ * appends `LOCAL_ACTIVITY_COMPLETED` or `LOCAL_ACTIVITY_FAILED` by outcome.
355
+ */
356
+ declare const COMMAND_EVENT_TYPES: Readonly<Record<CommandType, RunEventType | null>>;
357
+ /**
358
+ * Events a command appends. During replay each one is matched against the
359
+ * command the code issues at the same position (spec 04 §4).
360
+ * `EXTERNAL_RUN_SIGNALED` is a command event only in its initiated form (no
361
+ * `resolved`); the service's delivery outcome is an input event of the same
362
+ * type with `resolved: true`.
363
+ */
364
+ declare const COMMAND_EVENTS: ReadonlySet<RunEventType>;
365
+ /** Events that deliver something to the workflow code (resolve an awaitable or run a handler). */
366
+ declare const INPUT_EVENTS: ReadonlySet<RunEventType>;
367
+ /** Events that end the run. */
368
+ declare const TERMINAL_EVENTS: ReadonlySet<RunEventType>;
369
+ /** True when the event delivers something to the code (see {@link INPUT_EVENTS}). */
370
+ declare function isInputEvent(event: {
371
+ type: RunEventType;
372
+ payload: JsonObject;
373
+ }): boolean;
374
+ /** True when the event was appended for a command (see {@link COMMAND_EVENTS}). */
375
+ declare function isCommandEvent(event: {
376
+ type: RunEventType;
377
+ payload: JsonObject;
378
+ }): boolean;
379
+
380
+ export { type StartTimerCommand as $, ACTIVITY_CANCELLATION_TYPES as A, BUILT_IN_QUERIES as B, type ChildCancellationType as C, DEFAULT_HISTORY_LIMIT as D, ERROR_TYPES as E, type Failure as F, PHASE_B_PARITY_COMMANDS as G, HISTORY_LIMIT_EXCEEDED_RATIO as H, INPUT_EVENTS as I, PHASE_C_COMMANDS as J, type RecordLocalActivityCommand as K, type LocalActivityRequest as L, type RecordMarkerCommand as M, type RecordSideEffectCommand as N, type RejectUpdateCommand as O, type ParentClosePolicy as P, type RequestCancelActivityCommand as Q, type RetryPolicy as R, type RequestCancelExternalRunCommand as S, type RunEventDraft as T, type RunEventRecord as U, type RunEventType as V, type WorkflowCommand as W, type RunTarget as X, type ScheduleActivityCommand as Y, type SignalRunCommand as Z, type StartChildRunCommand as _, type WorkflowTaskFailureCause as a, TASK_FAILURE_CAUSES as a0, TERMINAL_COMMANDS as a1, TERMINAL_EVENTS as a2, type TaskLogLine as a3, type UpsertContextCommand as a4, type UpsertSearchAttributesCommand as a5, type WorkflowInfoSnapshot as a6, type WorkflowTaskRequest as a7, type WorkflowTaskResult as a8, isCommandEvent as a9, isInputEvent as aa, type AcceptUpdateCommand as b, type ActivityCancellationType as c, type BuiltInQueryName as d, CHILD_CANCELLATION_TYPES as e, COMMAND_EVENTS as f, COMMAND_EVENT_TYPES as g, COMMAND_TYPES as h, CONTINUE_AS_NEW_SUGGESTED_RATIO as i, type CancelTimerCommand as j, type CancelWorkflowCommand as k, type ChildRunOptions as l, type CommandType as m, type CompleteUpdateCommand as n, type CompleteWorkflowCommand as o, type ContinueAsNewCommand as p, EVENT_TYPES as q, EXECUTION_KINDS as r, type ExecutionKind as s, type FailWorkflowCommand as t, type FailureSource as u, HISTORY_PROTOCOL as v, type Headers as w, type HistoryLimit as x, PARENT_CLOSE_POLICIES as y, PHASE_B_CORE_COMMANDS as z };