@fluidgrids/workflows 2026.1027.1 → 2026.1028.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.
Files changed (166) hide show
  1. package/README.md +144 -13
  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-2J6TF7YI.cjs +86 -0
  7. package/dist/chunk-4LYSEANA.js +199 -0
  8. package/dist/chunk-623FVQSN.cjs +251 -0
  9. package/dist/{chunk-W32BSO3M.js → chunk-6FSHT5IL.js} +2 -2
  10. package/dist/{chunk-E3APHA6O.cjs → chunk-7AAZGVKD.js} +1 -64
  11. package/dist/chunk-ABFZWYHT.js +612 -0
  12. package/dist/{chunk-6U446SKY.js → chunk-BD7ZPG53.js} +2 -2
  13. package/dist/chunk-BO6OVILK.js +79 -0
  14. package/dist/chunk-C5OLWZ42.js +245 -0
  15. package/dist/{chunk-OSPTJCDI.cjs → chunk-CPDK3K5N.cjs} +6 -6
  16. package/dist/chunk-DHTLALBL.cjs +80 -0
  17. package/dist/chunk-DJYMDLV5.js +227 -0
  18. package/dist/{chunk-IHKXLG6I.js → chunk-E2VK7J2C.js} +1 -1
  19. package/dist/{chunk-3M34AUIY.cjs → chunk-FEW3JBYA.cjs} +3 -3
  20. package/dist/chunk-FMSW2HDF.cjs +267 -0
  21. package/dist/chunk-FR7KYWRO.cjs +41 -0
  22. package/dist/{chunk-7YR7DI7B.cjs → chunk-GBQ33SIZ.cjs} +44 -44
  23. package/dist/{chunk-6AIAC2FP.cjs → chunk-GVTZMA5C.cjs} +4 -4
  24. package/dist/{chunk-EEAIM35V.js → chunk-HWJZVOG7.js} +64 -23
  25. package/dist/chunk-I5LR3D2K.js +869 -0
  26. package/dist/chunk-IISBRUWJ.js +13 -0
  27. package/dist/chunk-JD2VQIDZ.cjs +15 -0
  28. package/dist/{chunk-UB2BHU2M.js → chunk-JZ4TOOLN.js} +1 -1
  29. package/dist/chunk-L24YIZY7.cjs +207 -0
  30. package/dist/chunk-LNUQE6D6.js +39 -0
  31. package/dist/chunk-M4BBAERY.cjs +1635 -0
  32. package/dist/chunk-N23SKIG4.js +73 -0
  33. package/dist/{chunk-TWOYB4Y7.cjs → chunk-NEIUQASE.cjs} +13 -13
  34. package/dist/chunk-P6TA5EZT.cjs +634 -0
  35. package/dist/chunk-PMCM2OH4.js +46 -0
  36. package/dist/chunk-PZCVF76Q.cjs +868 -0
  37. package/dist/{chunk-6BEW4QD6.js → chunk-QAN5MZEM.js} +1 -1
  38. package/dist/{chunk-CSYBNN3V.cjs → chunk-QKZL3ONM.cjs} +2 -2
  39. package/dist/chunk-QQ6ULXHI.cjs +885 -0
  40. package/dist/chunk-SAENRNBJ.cjs +52 -0
  41. package/dist/{chunk-TQF7MYEN.cjs → chunk-SAOBPYYJ.cjs} +134 -96
  42. package/dist/{chunk-XBIID5DY.js → chunk-SMCANK3F.js} +5 -4
  43. package/dist/{chunk-UWQWD7BP.cjs → chunk-SX2PNKKT.cjs} +18 -17
  44. package/dist/{chunk-UJNHTS6D.js → chunk-TBDXTV22.cjs} +8 -45
  45. package/dist/chunk-UK3WM7YZ.cjs +75 -0
  46. package/dist/chunk-VOKMAAJP.js +848 -0
  47. package/dist/chunk-VRHHBPT6.js +1622 -0
  48. package/dist/{chunk-5AW745OG.js → chunk-XHXIDVEC.js} +1 -1
  49. package/dist/chunk-XKJA7KX3.js +72 -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 +152 -158
  66. package/dist/ir/index.d.cts +14 -4
  67. package/dist/ir/index.d.ts +14 -4
  68. package/dist/ir/index.js +41 -50
  69. package/dist/lower-BzmUz0sq.d.cts +129 -0
  70. package/dist/lower-_-iT4HYs.d.ts +129 -0
  71. package/dist/lower-types-DQNBfWQn.d.cts +37 -0
  72. package/dist/lower-types-DQNBfWQn.d.ts +37 -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-4MSDKWOG.cjs +22 -0
  76. package/dist/node-evaluator-SX4LEYQC.js +12 -0
  77. package/dist/quickjs/index.cjs +236 -12
  78. package/dist/quickjs/index.d.cts +46 -5
  79. package/dist/quickjs/index.d.ts +46 -5
  80. package/dist/quickjs/index.js +230 -9
  81. package/dist/roundtrip/index.cjs +333 -131
  82. package/dist/roundtrip/index.d.cts +39 -7
  83. package/dist/roundtrip/index.d.ts +39 -7
  84. package/dist/roundtrip/index.js +185 -13
  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-CrpUyd_3.d.ts → workflow-Bpr3vnA_.d.ts} +40 -160
  98. package/dist/workflow-C2a05WUJ.d.ts +444 -0
  99. package/dist/{assemble-DEf3znGD.d.cts → workflow-FXUkpIBc.d.cts} +40 -160
  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 +44 -5
  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-MBBKGD7K.js +0 -440
  162. package/dist/chunk-Y7NWR3WH.cjs +0 -450
  163. package/dist/lower-CXggJTIo.d.ts +0 -67
  164. package/dist/lower-DAzvsJCo.d.cts +0 -67
  165. package/dist/node-evaluator-CH3XCJND.cjs +0 -17
  166. package/dist/node-evaluator-TULXA3WE.js +0 -8
@@ -0,0 +1,199 @@
1
+ // src/runtime/shims.ts
2
+ var SHIM_VIOLATION = "DeterminismViolation";
3
+ var SHIM_HOOK = "__fluidgridsShims";
4
+ var TASK_PRELUDE = `(() => {
5
+ const NAME = ${JSON.stringify(SHIM_VIOLATION)};
6
+ const fail = (what) => {
7
+ const error = new Error(what + " is not allowed in workflow code: use ctx.now(), ctx.random(), ctx.sleep() or an activity.");
8
+ error.name = NAME;
9
+ throw error;
10
+ };
11
+ let hooks = null;
12
+ const now = (what) => (hooks !== null ? hooks.now() : fail(what + " outside a workflow task"));
13
+ const lock = (target, key, value) =>
14
+ Object.defineProperty(target, key, { value, writable: false, enumerable: false, configurable: false });
15
+ const RealDate = Date;
16
+ // ---- Built-ins that differ between hosts and engines --------------------
17
+ // Local time is UTC whatever the host's TZ, locale formatting is fixed
18
+ // (en-US shapes, no ICU), Intl is absent and garbage collection cannot be
19
+ // observed, so QuickJS and vm on any host run workflow code the same way.
20
+ const proto = RealDate.prototype;
21
+ const hostOffset = proto.getTimezoneOffset;
22
+ const realParse = RealDate.parse;
23
+ const isInvalid = (date) => Number.isNaN(proto.getTime.call(date));
24
+ for (const unit of ["FullYear", "Month", "Date", "Day", "Hours", "Minutes", "Seconds", "Milliseconds"]) {
25
+ lock(proto, "get" + unit, proto["getUTC" + unit]);
26
+ if (unit !== "Day") lock(proto, "set" + unit, proto["setUTC" + unit]);
27
+ }
28
+ lock(proto, "getTimezoneOffset", function getTimezoneOffset() { return isInvalid(this) ? NaN : 0; });
29
+ if (typeof proto.getYear === "function")
30
+ lock(proto, "getYear", function getYear() { return isInvalid(this) ? NaN : this.getUTCFullYear() - 1900; });
31
+ if (typeof proto.setYear === "function")
32
+ lock(proto, "setYear", function setYear(value) {
33
+ const year = Number(value);
34
+ if (Number.isNaN(year)) return this.setTime(NaN);
35
+ const whole = Math.trunc(year);
36
+ const base = new RealDate(isInvalid(this) ? 0 : this.getTime());
37
+ base.setUTCFullYear(whole >= 0 && whole <= 99 ? 1900 + whole : whole);
38
+ return this.setTime(base.getTime());
39
+ });
40
+ const DAYS = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
41
+ const MONTHS = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
42
+ const pad = (value, width) => String(value).padStart(width, "0");
43
+ const yearText = (year) => (year < 0 ? "-" + pad(-year, 6) : pad(year, 4));
44
+ const dateText = (d) =>
45
+ DAYS[d.getUTCDay()] + " " + MONTHS[d.getUTCMonth()] + " " + pad(d.getUTCDate(), 2) + " " + yearText(d.getUTCFullYear());
46
+ const timeText = (d) =>
47
+ pad(d.getUTCHours(), 2) + ":" + pad(d.getUTCMinutes(), 2) + ":" + pad(d.getUTCSeconds(), 2) + " GMT+0000 (Coordinated Universal Time)";
48
+ const localeDate = (d) => d.getUTCMonth() + 1 + "/" + d.getUTCDate() + "/" + d.getUTCFullYear();
49
+ const localeTime = (d) => {
50
+ const hours = d.getUTCHours();
51
+ return ((hours + 11) % 12) + 1 + ":" + pad(d.getUTCMinutes(), 2) + ":" + pad(d.getUTCSeconds(), 2) + (hours < 12 ? " AM" : " PM");
52
+ };
53
+ const formatter = (format) => function () { return isInvalid(this) ? "Invalid Date" : format(this); };
54
+ lock(proto, "toString", formatter((d) => dateText(d) + " " + timeText(d)));
55
+ lock(proto, "toDateString", formatter(dateText));
56
+ lock(proto, "toTimeString", formatter(timeText));
57
+ lock(proto, "toLocaleString", formatter((d) => localeDate(d) + ", " + localeTime(d)));
58
+ lock(proto, "toLocaleDateString", formatter(localeDate));
59
+ lock(proto, "toLocaleTimeString", formatter(localeTime));
60
+ // A date-time without an offset is local time to the host's parser; read it as UTC.
61
+ const DATE_ONLY = /^[+-]?\\d{4,6}(?:-\\d{2}(?:-\\d{2})?)?$/;
62
+ const ZONE_AFTER_TIME = /\\d:\\d{2}(?::\\d{2}(?:[.,]\\d+)?)?\\s*(?:[AP]M\\s*)?(?:Z|[+-]\\d{2}(?::?\\d{2})?|[ECMP][SD]T)\\s*(?:\\([^)]*\\))?\\s*$/i;
63
+ const NAMED_ZONE = /\\b(?:GMT|UTC|UT)\\b(?:\\s*[+-]\\d{2}:?\\d{2})?\\s*(?:\\([^)]*\\))?\\s*$/i;
64
+ const parse = function parse(value) {
65
+ const text = String(value);
66
+ const time = realParse(text);
67
+ if (Number.isNaN(time)) return time;
68
+ const trimmed = text.trim();
69
+ if (DATE_ONLY.test(trimmed) || ZONE_AFTER_TIME.test(trimmed) || NAMED_ZONE.test(trimmed)) return time;
70
+ return time - hostOffset.call(new RealDate(time)) * 60000;
71
+ };
72
+ const toTimeValue = (value) => {
73
+ if (value instanceof RealDate) return value.getTime();
74
+ let primitive = value;
75
+ if (typeof value === "object" && value !== null) {
76
+ primitive = value.valueOf();
77
+ if (typeof primitive === "object" && primitive !== null) primitive = String(value);
78
+ }
79
+ return typeof primitive === "string" ? parse(primitive) : primitive;
80
+ };
81
+ // ---- Number, string and array locale methods ----------------------------
82
+ const group = (digits) => digits.replace(/\\B(?=(\\d{3})+(?!\\d))/g, ",");
83
+ lock(Number.prototype, "toLocaleString", function toLocaleString() {
84
+ const x = Number.prototype.valueOf.call(this);
85
+ if (Number.isNaN(x)) return "NaN";
86
+ const sign = x < 0 || Object.is(x, -0) ? "-" : "";
87
+ const abs = Math.abs(x);
88
+ if (abs === Infinity) return sign + "\\u221e";
89
+ const fixed = abs < 1e21 ? abs.toFixed(3) : BigInt(abs).toString() + ".000";
90
+ const [whole, fraction] = fixed.split(".");
91
+ const kept = fraction.replace(/0+$/, "");
92
+ return sign + group(whole) + (kept === "" ? "" : "." + kept);
93
+ });
94
+ if (typeof BigInt === "function")
95
+ lock(BigInt.prototype, "toLocaleString", function toLocaleString() {
96
+ const text = BigInt.prototype.toString.call(this);
97
+ return text.startsWith("-") ? "-" + group(text.slice(1)) : group(text);
98
+ });
99
+ lock(String.prototype, "localeCompare", function localeCompare(that) {
100
+ const a = String(this);
101
+ const b = String(that);
102
+ return a < b ? -1 : a > b ? 1 : 0;
103
+ });
104
+ lock(String.prototype, "toLocaleUpperCase", function toLocaleUpperCase() { return String(this).toUpperCase(); });
105
+ lock(String.prototype, "toLocaleLowerCase", function toLocaleLowerCase() { return String(this).toLowerCase(); });
106
+ const listLocale = function toLocaleString() {
107
+ return Array.prototype.map.call(this, (item) => (item === null || item === undefined ? "" : item.toLocaleString())).join(",");
108
+ };
109
+ lock(Array.prototype, "toLocaleString", listLocale);
110
+ lock(Object.getPrototypeOf(Uint8Array.prototype), "toLocaleString", listLocale);
111
+ // ---- Absent or refused ---------------------------------------------------
112
+ if (!Reflect.deleteProperty(globalThis, "Intl")) lock(globalThis, "Intl", undefined);
113
+ for (const name of ["WeakRef", "FinalizationRegistry"]) {
114
+ lock(globalThis, name, function () { return fail(name + " (garbage collection is not deterministic)"); });
115
+ }
116
+ const LockedDate = function Date(...args) {
117
+ if (new.target === undefined) return new RealDate(now("Date()")).toString();
118
+ if (args.length === 0) return Reflect.construct(RealDate, [now("new Date()")], new.target);
119
+ if (args.length === 1) return Reflect.construct(RealDate, [toTimeValue(args[0])], new.target);
120
+ return Reflect.construct(RealDate, [RealDate.UTC(...args)], new.target);
121
+ };
122
+ lock(LockedDate, "prototype", RealDate.prototype);
123
+ lock(RealDate.prototype, "constructor", LockedDate);
124
+ lock(LockedDate, "now", function now_() { return now("Date.now()"); });
125
+ lock(LockedDate, "parse", parse);
126
+ lock(LockedDate, "UTC", RealDate.UTC);
127
+ lock(globalThis, "Date", LockedDate);
128
+ lock(Math, "random", function random() {
129
+ return hooks !== null ? hooks.random() : fail("Math.random() outside a workflow task");
130
+ });
131
+ const crypto = globalThis.crypto;
132
+ if (crypto !== null && typeof crypto === "object") {
133
+ if (typeof crypto.getRandomValues === "function")
134
+ lock(crypto, "getRandomValues", function getRandomValues(array) {
135
+ if (hooks === null) return fail("crypto.getRandomValues() outside a workflow task");
136
+ for (let i = 0; i < array.length; i++) array[i] = Math.floor(hooks.random() * 256);
137
+ return array;
138
+ });
139
+ if (typeof crypto.randomUUID === "function")
140
+ lock(crypto, "randomUUID", function randomUUID() { return fail("crypto.randomUUID(): use ctx.uuid()"); });
141
+ }
142
+ for (const name of ["setTimeout", "setInterval", "setImmediate", "clearTimeout", "clearInterval", "clearImmediate"]) {
143
+ lock(globalThis, name, function () { return fail(name + "(): use ctx.sleep()"); });
144
+ }
145
+ for (const name of ["fetch", "XMLHttpRequest", "WebSocket", "EventSource"]) {
146
+ lock(globalThis, name, function () { return fail(name + ": do I/O in an activity (ctx.run)"); });
147
+ }
148
+ Object.defineProperty(globalThis, ${JSON.stringify(SHIM_HOOK)}, {
149
+ value: Object.freeze({
150
+ attach(next) { hooks = next; },
151
+ detach() { hooks = null; },
152
+ }),
153
+ writable: false,
154
+ enumerable: false,
155
+ configurable: true,
156
+ });
157
+ })();
158
+ `;
159
+ function isShimControl(value) {
160
+ return typeof value === "object" && value !== null && typeof value.attach === "function" && typeof value.detach === "function";
161
+ }
162
+ function takeShimControl() {
163
+ const holder = globalThis;
164
+ const control = holder[SHIM_HOOK];
165
+ if (!isShimControl(control)) return void 0;
166
+ delete holder[SHIM_HOOK];
167
+ return control;
168
+ }
169
+ function seedOf(text) {
170
+ let hash = 2166136261;
171
+ for (let index = 0; index < text.length; index++) {
172
+ hash ^= text.charCodeAt(index);
173
+ hash = Math.imul(hash, 16777619) >>> 0;
174
+ }
175
+ return hash >>> 0;
176
+ }
177
+ function createRandom(seed) {
178
+ let state = seed >>> 0;
179
+ return () => {
180
+ state = state + 1831565813 >>> 0;
181
+ let t = state;
182
+ t = Math.imul(t ^ t >>> 15, t | 1);
183
+ t ^= t + Math.imul(t ^ t >>> 7, t | 61);
184
+ return ((t ^ t >>> 14) >>> 0) / 4294967296;
185
+ };
186
+ }
187
+ function uuidFrom(random) {
188
+ const hex = [];
189
+ for (let index = 0; index < 16; index++) {
190
+ let byte = Math.floor(random() * 256) & 255;
191
+ if (index === 6) byte = byte & 15 | 64;
192
+ if (index === 8) byte = byte & 63 | 128;
193
+ hex.push(byte.toString(16).padStart(2, "0"));
194
+ }
195
+ const text = hex.join("");
196
+ return `${text.slice(0, 8)}-${text.slice(8, 12)}-${text.slice(12, 16)}-${text.slice(16, 20)}-${text.slice(20)}`;
197
+ }
198
+
199
+ export { SHIM_HOOK, SHIM_VIOLATION, TASK_PRELUDE, createRandom, seedOf, takeShimControl, uuidFrom };
@@ -0,0 +1,251 @@
1
+ 'use strict';
2
+
3
+ // src/history/types.ts
4
+ var HISTORY_PROTOCOL = 1;
5
+ var EVENT_TYPES = [
6
+ "WORKFLOW_STARTED",
7
+ "WORKFLOW_TASK_SCHEDULED",
8
+ "WORKFLOW_TASK_STARTED",
9
+ "WORKFLOW_TASK_COMPLETED",
10
+ "WORKFLOW_TASK_FAILED",
11
+ "WORKFLOW_TASK_TIMED_OUT",
12
+ "ACTIVITY_SCHEDULED",
13
+ "ACTIVITY_STARTED",
14
+ "ACTIVITY_HEARTBEAT",
15
+ "ACTIVITY_COMPLETED",
16
+ "ACTIVITY_FAILED",
17
+ "ACTIVITY_TIMED_OUT",
18
+ "ACTIVITY_CANCEL_REQUESTED",
19
+ "ACTIVITY_CANCELLED",
20
+ "ACTIVITY_PAUSED",
21
+ "ACTIVITY_UNPAUSED",
22
+ "ACTIVITY_RESET",
23
+ "ACTIVITY_OPTIONS_UPDATED",
24
+ "TIMER_STARTED",
25
+ "TIMER_FIRED",
26
+ "TIMER_CANCELLED",
27
+ "SIGNAL_RECEIVED",
28
+ "UPDATE_ADMITTED",
29
+ "UPDATE_ACCEPTED",
30
+ "UPDATE_COMPLETED",
31
+ "CHILD_RUN_INITIATED",
32
+ "CHILD_RUN_STARTED",
33
+ "CHILD_RUN_COMPLETED",
34
+ "CHILD_RUN_FAILED",
35
+ "CHILD_RUN_CANCELLED",
36
+ "CHILD_RUN_TERMINATED",
37
+ "CHILD_RUN_TIMED_OUT",
38
+ "EXTERNAL_RUN_CANCEL_REQUESTED",
39
+ "EXTERNAL_RUN_CANCEL_RESOLVED",
40
+ "EXTERNAL_RUN_SIGNALED",
41
+ "SIDE_EFFECT_RECORDED",
42
+ "LOCAL_ACTIVITY_COMPLETED",
43
+ "LOCAL_ACTIVITY_FAILED",
44
+ "SEARCH_ATTRIBUTES_UPSERTED",
45
+ "CONTEXT_UPSERTED",
46
+ "MARKER_RECORDED",
47
+ "WORKFLOW_CANCEL_REQUESTED",
48
+ "WORKFLOW_RESET",
49
+ "VERSIONING_OVERRIDE_SET",
50
+ "WORKFLOW_COMPLETED",
51
+ "WORKFLOW_FAILED",
52
+ "WORKFLOW_CANCELLED",
53
+ "WORKFLOW_TERMINATED",
54
+ "WORKFLOW_TIMED_OUT",
55
+ "WORKFLOW_CONTINUED_AS_NEW"
56
+ ];
57
+ var COMMAND_TYPES = [
58
+ "SCHEDULE_ACTIVITY",
59
+ "REQUEST_CANCEL_ACTIVITY",
60
+ "START_TIMER",
61
+ "CANCEL_TIMER",
62
+ "START_CHILD_RUN",
63
+ "SIGNAL_RUN",
64
+ "RECORD_SIDE_EFFECT",
65
+ "RECORD_MARKER",
66
+ "COMPLETE_WORKFLOW",
67
+ "FAIL_WORKFLOW",
68
+ "CANCEL_WORKFLOW",
69
+ "UPSERT_CONTEXT",
70
+ "RECORD_LOCAL_ACTIVITY",
71
+ "CONTINUE_AS_NEW",
72
+ "REQUEST_CANCEL_EXTERNAL_RUN",
73
+ "UPSERT_SEARCH_ATTRIBUTES",
74
+ "ACCEPT_UPDATE",
75
+ "REJECT_UPDATE",
76
+ "COMPLETE_UPDATE"
77
+ ];
78
+ var PHASE_B_CORE_COMMANDS = /* @__PURE__ */ new Set([
79
+ "SCHEDULE_ACTIVITY",
80
+ "REQUEST_CANCEL_ACTIVITY",
81
+ "START_TIMER",
82
+ "CANCEL_TIMER",
83
+ "START_CHILD_RUN",
84
+ "SIGNAL_RUN",
85
+ "RECORD_SIDE_EFFECT",
86
+ "RECORD_MARKER",
87
+ "COMPLETE_WORKFLOW",
88
+ "FAIL_WORKFLOW",
89
+ "CANCEL_WORKFLOW"
90
+ ]);
91
+ var PHASE_B_PARITY_COMMANDS = /* @__PURE__ */ new Set([
92
+ "UPSERT_CONTEXT",
93
+ "RECORD_LOCAL_ACTIVITY",
94
+ "CONTINUE_AS_NEW",
95
+ "REQUEST_CANCEL_EXTERNAL_RUN"
96
+ ]);
97
+ var PHASE_C_COMMANDS = /* @__PURE__ */ new Set([
98
+ "UPSERT_SEARCH_ATTRIBUTES",
99
+ "ACCEPT_UPDATE",
100
+ "REJECT_UPDATE",
101
+ "COMPLETE_UPDATE"
102
+ ]);
103
+ var TERMINAL_COMMANDS = /* @__PURE__ */ new Set([
104
+ "COMPLETE_WORKFLOW",
105
+ "FAIL_WORKFLOW",
106
+ "CANCEL_WORKFLOW",
107
+ "CONTINUE_AS_NEW"
108
+ ]);
109
+ var TASK_FAILURE_CAUSES = [
110
+ "NON_DETERMINISM",
111
+ "TASK_TIMEOUT",
112
+ "ISOLATE_MEMORY",
113
+ "PROTOCOL_MISMATCH",
114
+ "BUNDLE_UNAVAILABLE",
115
+ "BUNDLE_INTEGRITY",
116
+ "WORKFLOW_CODE_ERROR",
117
+ "HISTORY_LIMIT",
118
+ "UNSUPPORTED_COMMAND",
119
+ "INVALID_REQUEST",
120
+ "INTERNAL"
121
+ ];
122
+ var ERROR_TYPES = [
123
+ "TIMEOUT",
124
+ "TRANSIENT",
125
+ "DEPENDENCY",
126
+ "AUTHORIZATION",
127
+ "VALIDATION",
128
+ "PERMANENT",
129
+ "UNKNOWN"
130
+ ];
131
+ var EXECUTION_KINDS = ["GRAPH", "DURABLE_FN"];
132
+ var PARENT_CLOSE_POLICIES = ["TERMINATE", "ABANDON", "REQUEST_CANCEL"];
133
+ var ACTIVITY_CANCELLATION_TYPES = [
134
+ "WAIT_CANCELLATION_COMPLETED",
135
+ "TRY_CANCEL",
136
+ "ABANDON"
137
+ ];
138
+ var CHILD_CANCELLATION_TYPES = [
139
+ "WAIT_CANCELLATION_COMPLETED",
140
+ "WAIT_CANCELLATION_REQUESTED",
141
+ "TRY_CANCEL",
142
+ "ABANDON"
143
+ ];
144
+ var DEFAULT_HISTORY_LIMIT = { events: 1e4, bytes: 16 * 1024 * 1024 };
145
+ var CONTINUE_AS_NEW_SUGGESTED_RATIO = 0.8;
146
+ var HISTORY_LIMIT_EXCEEDED_RATIO = 0.95;
147
+ var BUILT_IN_QUERIES = [
148
+ "__stack_trace",
149
+ "__enhanced_stack_trace",
150
+ "__metadata"
151
+ ];
152
+ var COMMAND_EVENT_TYPES = {
153
+ SCHEDULE_ACTIVITY: "ACTIVITY_SCHEDULED",
154
+ REQUEST_CANCEL_ACTIVITY: "ACTIVITY_CANCEL_REQUESTED",
155
+ START_TIMER: "TIMER_STARTED",
156
+ CANCEL_TIMER: "TIMER_CANCELLED",
157
+ START_CHILD_RUN: "CHILD_RUN_INITIATED",
158
+ SIGNAL_RUN: "EXTERNAL_RUN_SIGNALED",
159
+ RECORD_SIDE_EFFECT: "SIDE_EFFECT_RECORDED",
160
+ RECORD_MARKER: "MARKER_RECORDED",
161
+ COMPLETE_WORKFLOW: "WORKFLOW_COMPLETED",
162
+ FAIL_WORKFLOW: "WORKFLOW_FAILED",
163
+ CANCEL_WORKFLOW: "WORKFLOW_CANCELLED",
164
+ UPSERT_CONTEXT: "CONTEXT_UPSERTED",
165
+ RECORD_LOCAL_ACTIVITY: "LOCAL_ACTIVITY_COMPLETED",
166
+ CONTINUE_AS_NEW: "WORKFLOW_CONTINUED_AS_NEW",
167
+ REQUEST_CANCEL_EXTERNAL_RUN: "EXTERNAL_RUN_CANCEL_REQUESTED",
168
+ UPSERT_SEARCH_ATTRIBUTES: "SEARCH_ATTRIBUTES_UPSERTED",
169
+ ACCEPT_UPDATE: "UPDATE_ACCEPTED",
170
+ REJECT_UPDATE: null,
171
+ COMPLETE_UPDATE: "UPDATE_COMPLETED"
172
+ };
173
+ var COMMAND_EVENTS = /* @__PURE__ */ new Set([
174
+ "ACTIVITY_SCHEDULED",
175
+ "ACTIVITY_CANCEL_REQUESTED",
176
+ "TIMER_STARTED",
177
+ "TIMER_CANCELLED",
178
+ "CHILD_RUN_INITIATED",
179
+ "EXTERNAL_RUN_SIGNALED",
180
+ "SIDE_EFFECT_RECORDED",
181
+ "MARKER_RECORDED",
182
+ "WORKFLOW_COMPLETED",
183
+ "WORKFLOW_FAILED",
184
+ "WORKFLOW_CANCELLED",
185
+ "CONTEXT_UPSERTED",
186
+ "LOCAL_ACTIVITY_COMPLETED",
187
+ "LOCAL_ACTIVITY_FAILED",
188
+ "WORKFLOW_CONTINUED_AS_NEW",
189
+ "EXTERNAL_RUN_CANCEL_REQUESTED",
190
+ "SEARCH_ATTRIBUTES_UPSERTED",
191
+ "UPDATE_ACCEPTED",
192
+ "UPDATE_COMPLETED"
193
+ ]);
194
+ var INPUT_EVENTS = /* @__PURE__ */ new Set([
195
+ "WORKFLOW_STARTED",
196
+ "ACTIVITY_COMPLETED",
197
+ "ACTIVITY_FAILED",
198
+ "ACTIVITY_TIMED_OUT",
199
+ "ACTIVITY_CANCELLED",
200
+ "TIMER_FIRED",
201
+ "SIGNAL_RECEIVED",
202
+ "UPDATE_ADMITTED",
203
+ "CHILD_RUN_STARTED",
204
+ "CHILD_RUN_COMPLETED",
205
+ "CHILD_RUN_FAILED",
206
+ "CHILD_RUN_CANCELLED",
207
+ "CHILD_RUN_TERMINATED",
208
+ "CHILD_RUN_TIMED_OUT",
209
+ "EXTERNAL_RUN_CANCEL_RESOLVED",
210
+ "WORKFLOW_CANCEL_REQUESTED"
211
+ ]);
212
+ var TERMINAL_EVENTS = /* @__PURE__ */ new Set([
213
+ "WORKFLOW_COMPLETED",
214
+ "WORKFLOW_FAILED",
215
+ "WORKFLOW_CANCELLED",
216
+ "WORKFLOW_TERMINATED",
217
+ "WORKFLOW_TIMED_OUT",
218
+ "WORKFLOW_CONTINUED_AS_NEW"
219
+ ]);
220
+ function isInputEvent(event) {
221
+ if (event.type === "EXTERNAL_RUN_SIGNALED") return event.payload["resolved"] === true;
222
+ return INPUT_EVENTS.has(event.type);
223
+ }
224
+ function isCommandEvent(event) {
225
+ if (event.type === "EXTERNAL_RUN_SIGNALED") return event.payload["resolved"] !== true;
226
+ return COMMAND_EVENTS.has(event.type);
227
+ }
228
+
229
+ exports.ACTIVITY_CANCELLATION_TYPES = ACTIVITY_CANCELLATION_TYPES;
230
+ exports.BUILT_IN_QUERIES = BUILT_IN_QUERIES;
231
+ exports.CHILD_CANCELLATION_TYPES = CHILD_CANCELLATION_TYPES;
232
+ exports.COMMAND_EVENTS = COMMAND_EVENTS;
233
+ exports.COMMAND_EVENT_TYPES = COMMAND_EVENT_TYPES;
234
+ exports.COMMAND_TYPES = COMMAND_TYPES;
235
+ exports.CONTINUE_AS_NEW_SUGGESTED_RATIO = CONTINUE_AS_NEW_SUGGESTED_RATIO;
236
+ exports.DEFAULT_HISTORY_LIMIT = DEFAULT_HISTORY_LIMIT;
237
+ exports.ERROR_TYPES = ERROR_TYPES;
238
+ exports.EVENT_TYPES = EVENT_TYPES;
239
+ exports.EXECUTION_KINDS = EXECUTION_KINDS;
240
+ exports.HISTORY_LIMIT_EXCEEDED_RATIO = HISTORY_LIMIT_EXCEEDED_RATIO;
241
+ exports.HISTORY_PROTOCOL = HISTORY_PROTOCOL;
242
+ exports.INPUT_EVENTS = INPUT_EVENTS;
243
+ exports.PARENT_CLOSE_POLICIES = PARENT_CLOSE_POLICIES;
244
+ exports.PHASE_B_CORE_COMMANDS = PHASE_B_CORE_COMMANDS;
245
+ exports.PHASE_B_PARITY_COMMANDS = PHASE_B_PARITY_COMMANDS;
246
+ exports.PHASE_C_COMMANDS = PHASE_C_COMMANDS;
247
+ exports.TASK_FAILURE_CAUSES = TASK_FAILURE_CAUSES;
248
+ exports.TERMINAL_COMMANDS = TERMINAL_COMMANDS;
249
+ exports.TERMINAL_EVENTS = TERMINAL_EVENTS;
250
+ exports.isCommandEvent = isCommandEvent;
251
+ exports.isInputEvent = isInputEvent;
@@ -1,5 +1,5 @@
1
- import { hashedProjection } from './chunk-6U446SKY.js';
2
- import { isRecord, deepEqual, ownValue } from './chunk-UJNHTS6D.js';
1
+ import { hashedProjection } from './chunk-BD7ZPG53.js';
2
+ import { isRecord, deepEqual, ownValue } from './chunk-PMCM2OH4.js';
3
3
 
4
4
  // src/ir/diff.ts
5
5
  function keyPath(base, key) {
@@ -1,54 +1,3 @@
1
- 'use strict';
2
-
3
- // node_modules/tsup/assets/cjs_shims.js
4
- var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.tagName.toUpperCase() === "SCRIPT" ? document.currentScript.src : new URL("main.js", document.baseURI).href;
5
- var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
6
-
7
- // src/ir/json-utils.ts
8
- function isRecord(value) {
9
- return typeof value === "object" && value !== null && !Array.isArray(value);
10
- }
11
- function deepEqual(left, right) {
12
- if (left === right) return true;
13
- if (Array.isArray(left)) {
14
- if (!Array.isArray(right) || left.length !== right.length) return false;
15
- return left.every((item, index) => deepEqual(item, right[index]));
16
- }
17
- if (isRecord(left)) {
18
- if (!isRecord(right)) return false;
19
- const leftKeys = Object.keys(left).filter((key) => left[key] !== void 0);
20
- const rightKeys = Object.keys(right).filter((key) => right[key] !== void 0);
21
- if (leftKeys.length !== rightKeys.length) return false;
22
- return leftKeys.every((key) => Object.hasOwn(right, key) && deepEqual(left[key], right[key]));
23
- }
24
- return false;
25
- }
26
- function setOwn(target, key, value) {
27
- Object.defineProperty(target, key, {
28
- value,
29
- enumerable: true,
30
- writable: true,
31
- configurable: true
32
- });
33
- }
34
- function ownValue(record, key) {
35
- return Object.hasOwn(record, key) ? record[key] : void 0;
36
- }
37
- function cloneJson(value) {
38
- return structuredCloneJson(value);
39
- }
40
- function structuredCloneJson(value) {
41
- if (Array.isArray(value)) return value.map(structuredCloneJson);
42
- if (isRecord(value)) {
43
- const out = {};
44
- for (const [key, child] of Object.entries(value)) {
45
- if (child !== void 0) setOwn(out, key, structuredCloneJson(child));
46
- }
47
- return out;
48
- }
49
- return value;
50
- }
51
-
52
1
  // src/ir/expressions.ts
53
2
  var IDENTIFIER = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
54
3
  function segmentFromKey(key) {
@@ -184,16 +133,4 @@ function isJsIdentifier(name) {
184
133
  return IDENTIFIER.test(name);
185
134
  }
186
135
 
187
- exports.cloneJson = cloneJson;
188
- exports.deepEqual = deepEqual;
189
- exports.formatRefExpression = formatRefExpression;
190
- exports.formatRefTemplate = formatRefTemplate;
191
- exports.hasLegacyTemplate = hasLegacyTemplate;
192
- exports.importMetaUrl = importMetaUrl;
193
- exports.isJsIdentifier = isJsIdentifier;
194
- exports.isRecord = isRecord;
195
- exports.ownValue = ownValue;
196
- exports.parseRefExpression = parseRefExpression;
197
- exports.parseTemplate = parseTemplate;
198
- exports.segmentFromKey = segmentFromKey;
199
- exports.setOwn = setOwn;
136
+ export { formatRefExpression, formatRefTemplate, hasLegacyTemplate, isJsIdentifier, parseRefExpression, parseTemplate, segmentFromKey };