@fluidgrids/workflows 2026.1028.2 → 2026.1029.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 (118) hide show
  1. package/README.md +72 -10
  2. package/dist/{activation-DnhG7SmF.d.ts → activation-BnVQMv9y.d.ts} +1 -1
  3. package/dist/{activation-BBh1p82z.d.cts → activation-CESehfYi.d.cts} +1 -1
  4. package/dist/{chunk-XHXIDVEC.js → chunk-25BKWR2O.js} +1 -1
  5. package/dist/{chunk-UK3WM7YZ.cjs → chunk-2B37XAFQ.cjs} +44 -8
  6. package/dist/{chunk-DJYMDLV5.js → chunk-2DDULZFM.js} +93 -1
  7. package/dist/{chunk-623FVQSN.cjs → chunk-3FIDHONL.cjs} +104 -0
  8. package/dist/chunk-6QPOJZT6.cjs +1180 -0
  9. package/dist/chunk-7ILGCUI6.js +154 -0
  10. package/dist/chunk-A2OHX3UQ.js +1156 -0
  11. package/dist/{chunk-VOKMAAJP.js → chunk-A36CCOWS.js} +188 -19
  12. package/dist/{chunk-FMSW2HDF.cjs → chunk-ELL2RBML.cjs} +0 -14
  13. package/dist/{chunk-JD2VQIDZ.cjs → chunk-EWYADREB.cjs} +2 -2
  14. package/dist/{chunk-HWJZVOG7.js → chunk-FQSJI5NV.js} +1 -1
  15. package/dist/{chunk-ABFZWYHT.js → chunk-FWBRQWRX.js} +156 -48
  16. package/dist/{chunk-PZCVF76Q.cjs → chunk-I47EENR4.cjs} +209 -40
  17. package/dist/chunk-J3PYFGKA.cjs +166 -0
  18. package/dist/{chunk-C5OLWZ42.js → chunk-KXJDRQ6G.js} +1 -13
  19. package/dist/chunk-M272AHEX.js +25 -0
  20. package/dist/{chunk-VRHHBPT6.js → chunk-MJ5TGYVG.js} +333 -65
  21. package/dist/{chunk-SAOBPYYJ.cjs → chunk-NXFBVDOI.cjs} +3 -3
  22. package/dist/{chunk-XKJA7KX3.js → chunk-OIX4O6UR.js} +38 -2
  23. package/dist/{chunk-FEW3JBYA.cjs → chunk-OKX3FYIM.cjs} +3 -3
  24. package/dist/{chunk-M4BBAERY.cjs → chunk-OMY3CKUZ.cjs} +404 -136
  25. package/dist/chunk-PWIUEWC3.js +81 -0
  26. package/dist/chunk-Q4MWQNJK.cjs +28 -0
  27. package/dist/{chunk-P6TA5EZT.cjs → chunk-RUQIMTN5.cjs} +171 -57
  28. package/dist/{chunk-IISBRUWJ.js → chunk-WXXNCHUY.js} +1 -1
  29. package/dist/chunk-YHBVMOMK.cjs +87 -0
  30. package/dist/codegen/index.d.cts +2 -2
  31. package/dist/codegen/index.d.ts +2 -2
  32. package/dist/collect-BTHjQaSp.d.ts +86 -0
  33. package/dist/collect-CSyOg5XC.d.cts +86 -0
  34. package/dist/{file-BOoHZgoQ.d.cts → file-cgL9l9l8.d.cts} +765 -14
  35. package/dist/{file-yuPCFU5b.d.ts → file-olQudcx5.d.ts} +765 -14
  36. package/dist/history/index.cjs +198 -86
  37. package/dist/history/index.d.cts +49 -10
  38. package/dist/history/index.d.ts +49 -10
  39. package/dist/history/index.js +49 -4
  40. package/dist/index.cjs +64 -51
  41. package/dist/index.d.cts +9 -53
  42. package/dist/index.d.ts +9 -53
  43. package/dist/index.js +5 -4
  44. package/dist/ir/index.cjs +24 -3
  45. package/dist/ir/index.d.cts +43 -4
  46. package/dist/ir/index.d.ts +43 -4
  47. package/dist/ir/index.js +24 -3
  48. package/dist/{lower-BzmUz0sq.d.cts → lower-3S6PsqjJ.d.cts} +40 -6
  49. package/dist/{lower-_-iT4HYs.d.ts → lower-DmZpQ8hJ.d.ts} +40 -6
  50. package/dist/{manifest-C8N6HDYl.d.ts → manifest-BJjrQt77.d.ts} +1 -1
  51. package/dist/{manifest-0OLw0i7k.d.cts → manifest-gRI2Q5Fj.d.cts} +1 -1
  52. package/dist/node-evaluator-SOADN23V.js +14 -0
  53. package/dist/node-evaluator-YGDEXK4U.cjs +24 -0
  54. package/dist/quickjs/index.cjs +25 -24
  55. package/dist/quickjs/index.d.cts +6 -6
  56. package/dist/quickjs/index.d.ts +6 -6
  57. package/dist/quickjs/index.js +8 -7
  58. package/dist/roundtrip/index.cjs +245 -43
  59. package/dist/roundtrip/index.d.cts +86 -9
  60. package/dist/roundtrip/index.d.ts +86 -9
  61. package/dist/roundtrip/index.js +172 -8
  62. package/dist/runtime/index.cjs +21 -20
  63. package/dist/runtime/index.d.cts +49 -7
  64. package/dist/runtime/index.d.ts +49 -7
  65. package/dist/runtime/index.js +8 -7
  66. package/dist/testing/index.cjs +514 -74
  67. package/dist/testing/index.d.cts +127 -10
  68. package/dist/testing/index.d.ts +127 -10
  69. package/dist/testing/index.js +480 -42
  70. package/dist/{types-BGoPzgcl.d.ts → types-Bb2wRnJ5.d.cts} +20 -1
  71. package/dist/{types-BGoPzgcl.d.cts → types-Bb2wRnJ5.d.ts} +20 -1
  72. package/dist/{types-DV-HX_Gt.d.ts → types-CQKOhPTa.d.cts} +122 -14
  73. package/dist/{types-CpBBjaGX.d.cts → types-CnIOinoz.d.ts} +122 -14
  74. package/dist/{workflow-Bpr3vnA_.d.ts → workflow-8uRU9rhL.d.ts} +2 -2
  75. package/dist/{workflow-FXUkpIBc.d.cts → workflow-CZOXUlQ5.d.cts} +2 -2
  76. package/dist/{workflow-C2a05WUJ.d.ts → workflow-DWTPHFbt.d.ts} +124 -12
  77. package/dist/{workflow-J-yYixny.d.cts → workflow-O6e64ZcG.d.cts} +124 -12
  78. package/fixtures/histories/auto-upgrade-patched.history.json +276 -0
  79. package/fixtures/histories/benign-failure.history.json +146 -0
  80. package/fixtures/histories/cancel-activity-try-cancel.history.json +150 -0
  81. package/fixtures/histories/child-cancel-wait-requested.history.json +217 -0
  82. package/fixtures/histories/child-options-roundtrip.history.json +192 -0
  83. package/fixtures/histories/continue-as-new-last-result.history.json +86 -0
  84. package/fixtures/histories/continue-as-new-options.history.json +99 -0
  85. package/fixtures/histories/continue-as-new-r1-long-task-queue.history.json +78 -0
  86. package/fixtures/histories/continue-as-new-r1-retry-options.history.json +83 -0
  87. package/fixtures/histories/execution-timeout-chain.history.json +98 -0
  88. package/fixtures/histories/external-cancel-resolved.history.json +123 -0
  89. package/fixtures/histories/external-cancel-unknown-target.history.json +127 -0
  90. package/fixtures/histories/failure-error-types-fails-run.history.json +144 -0
  91. package/fixtures/histories/handler-drain-warn.history.json +222 -0
  92. package/fixtures/histories/heartbeat-details-on-retry.history.json +145 -0
  93. package/fixtures/histories/local-activity-abandoned-at-completion.history.json +73 -0
  94. package/fixtures/histories/local-activity-cancelled-in-scope.history.json +118 -0
  95. package/fixtures/histories/local-activity-completed.history.json +157 -0
  96. package/fixtures/histories/local-activity-failed.history.json +93 -0
  97. package/fixtures/histories/local-activity-retry-in-task.history.json +88 -0
  98. package/fixtures/histories/run-retry-last-failure.history.json +90 -0
  99. package/fixtures/histories/run-timeout.history.json +159 -0
  100. package/fixtures/histories/schedule-to-start-timeout.history.json +132 -0
  101. package/fixtures/histories/start-delay-signal-ends-delay.history.json +155 -0
  102. package/fixtures/histories/typeerror-task-retry-100.history.json +137 -0
  103. package/package.json +1 -1
  104. package/schema/history-file.schema.json +283 -2
  105. package/schema/ir-v2.schema.json +45 -0
  106. package/schema/run-event.schema.json +264 -2
  107. package/schema/workflow-command.schema.json +178 -1
  108. package/schema/workflow-task.schema.json +392 -4
  109. package/dist/assemble-BLqQ8lSu.d.cts +0 -39
  110. package/dist/assemble-DWgaXHd-.d.ts +0 -39
  111. package/dist/chunk-2J6TF7YI.cjs +0 -86
  112. package/dist/chunk-BO6OVILK.js +0 -79
  113. package/dist/chunk-DHTLALBL.cjs +0 -80
  114. package/dist/chunk-I5LR3D2K.js +0 -869
  115. package/dist/chunk-N23SKIG4.js +0 -73
  116. package/dist/chunk-QQ6ULXHI.cjs +0 -885
  117. package/dist/node-evaluator-4MSDKWOG.cjs +0 -22
  118. package/dist/node-evaluator-SX4LEYQC.js +0 -12
@@ -1,14 +1,14 @@
1
- import { b as WorkflowDefinition, J as JsonObject } from '../types-BGoPzgcl.cjs';
2
- import { b as LayoutSidecar } from '../assemble-BLqQ8lSu.cjs';
3
- import { N as NodeManifest } from '../manifest-0OLw0i7k.cjs';
1
+ import { W as WorkflowDefinition, a as JsonObject, J as Json } from '../types-Bb2wRnJ5.cjs';
2
+ import { f as LayoutSidecar } from '../collect-CSyOg5XC.cjs';
3
+ import { N as NodeManifest } from '../manifest-gRI2Q5Fj.cjs';
4
4
  import { P as PathSegment } from '../expressions-DhHaqyar.cjs';
5
- import { V as VendoredDeps, a as VendoredPackage, E as Evaluator } from '../lower-BzmUz0sq.cjs';
6
- export { B as BuildBundleOptions, b as BuiltBundle, D as DeterminismViolationError, c as ESBUILD_VERSION, d as EVALUATION_GLOBAL, L as LowerIssue, e as LowerOptions, f as LowerResult, g as LoweredWorkflow, N as NODE_BUILTINS, h as buildBundle, i as bundleProject, j as bundleSourceHash, k as defaultEntries, l as lower, r as resolvePackageEntry, s as scanDurableSources, m as splitSpecifier } from '../lower-BzmUz0sq.cjs';
5
+ import { V as VendoredDeps, a as VendoredPackage, E as Evaluator } from '../lower-3S6PsqjJ.cjs';
6
+ export { B as BuildBundleOptions, b as BuiltBundle, D as DeterminismViolationError, c as ESBUILD_VERSION, d as EVALUATION_GLOBAL, L as LowerIssue, e as LowerOptions, f as LowerResult, g as LoweredWorkflow, N as NODE_BUILTINS, h as buildBundle, i as bundleProject, j as bundleSourceHash, k as defaultEntries, l as durableFeatures, m as durableScanModules, n as lower, r as resolvePackageEntry, s as scanDurableSources, o as splitSpecifier } from '../lower-3S6PsqjJ.cjs';
7
7
  import { E as EsbuildApi } from '../lower-types-DQNBfWQn.cjs';
8
8
  export { B as BuildDiagnostic, a as BuildDiagnosticLocation, L as LowerError, b as LowerFailureReason } from '../lower-types-DQNBfWQn.cjs';
9
- import '../workflow-FXUkpIBc.cjs';
10
- import '../workflow-J-yYixny.cjs';
11
- import '../types-CpBBjaGX.cjs';
9
+ import '../workflow-CZOXUlQ5.cjs';
10
+ import '../workflow-O6e64ZcG.cjs';
11
+ import '../types-CQKOhPTa.cjs';
12
12
  import '../hash-CZkTXPCX.cjs';
13
13
  import 'esbuild';
14
14
 
@@ -236,6 +236,8 @@ interface SourceArchive {
236
236
  lock?: string;
237
237
  /** Vendored packages by name. */
238
238
  vendored?: Record<string, VendoredPackage>;
239
+ /** The bundle's source map (`buildBundle(…, { sourcemap: 'external' }).map`, R2). */
240
+ map?: string;
239
241
  }
240
242
  declare const SOURCE_ARCHIVE_MAX_BYTES: number;
241
243
  /** Pack a source archive. */
@@ -247,6 +249,81 @@ declare function unpackSources(data: Uint8Array, options?: {
247
249
  /** The vendored packages of an archive as `buildBundle` takes them. */
248
250
  declare function archiveDeps(archive: SourceArchive): VendoredDeps;
249
251
 
252
+ /**
253
+ * Read a bundle's source map (C-SOURCEMAP): map a position in the bundle back
254
+ * to the workflow source, so `__stack_trace` and `__enhanced_stack_trace` name
255
+ * the original TypeScript line (11 §2.21). The service keeps the map in the
256
+ * source archive (`map`) and applies it to the stacks a query returns.
257
+ *
258
+ * Only version 3 maps with `mappings` are read; index maps (`sections`) are
259
+ * not produced by `buildBundle` and are refused.
260
+ */
261
+
262
+ /** The file name the isolates give a workflow bundle in stack traces. */
263
+ declare const BUNDLE_FILE_NAME = "workflow-bundle.mjs";
264
+ /** A position in the original source. Lines are 1-based, columns 0-based. */
265
+ interface SourcePosition {
266
+ source: string;
267
+ line: number;
268
+ column: number;
269
+ name?: string;
270
+ }
271
+ /** Maps a bundle position (1-based line, 0-based column) to its source position. */
272
+ interface SourceMapper {
273
+ /** Without a column, the first mapped segment of the line is used. */
274
+ lookup(line: number, column?: number): SourcePosition | undefined;
275
+ }
276
+ /** Decode one segment's base64 VLQ numbers. */
277
+ declare function decodeVlq(segment: string): number[];
278
+ /** Parse a version 3 source map. */
279
+ declare function createSourceMapper(mapText: string): SourceMapper;
280
+ /**
281
+ * Rewrite the bundle frames of a stack text (`at fn (workflow-bundle.mjs:12:5)`)
282
+ * to source positions (`at fn (workflows/order.ts:7:11)`). Other frames are kept.
283
+ */
284
+ declare function mapStackTrace(stack: string, mapper: SourceMapper, bundleFile?: string): string;
285
+ /**
286
+ * Map the locations of an `__enhanced_stack_trace` value in place of their
287
+ * bundle positions; a location keeps `bundleLine`/`bundleColumn` with the
288
+ * original position. Anything that is not the SDK's shape is returned as is.
289
+ */
290
+ declare function mapEnhancedStackTrace(value: Json, mapper: SourceMapper, bundleFile?: string): Json;
291
+ /** The source positions of the bundle frames of a stack text, innermost first. */
292
+ declare function sourceLocations(stack: string, mapper: SourceMapper, bundleFile?: string): SourcePosition[];
293
+
294
+ /** Bundle features a call site can show (the option-level ones come from the declarations). */
295
+ type SourceFeature = 'localActivity' | 'externalCancel' | 'childOptions' | 'canOptions';
296
+ /**
297
+ * The text between the parenthesis at `open` and its match, skipping string
298
+ * and template literals and comments. Unbalanced text runs to the end.
299
+ */
300
+ declare function callArguments(text: string, open: number): string;
301
+ /** Split `text` at commas that are not nested in brackets, literals or comments. */
302
+ declare function splitTopLevel(text: string): string[];
303
+ /**
304
+ * The top-level entries of an object literal (`{ a: 1, b }`): key and value
305
+ * text. Undefined when `text` is not an object literal or spreads another
306
+ * object, whose keys cannot be known.
307
+ */
308
+ declare function objectEntries(text: string): Map<string, string> | undefined;
309
+ /**
310
+ * `text` with its comments replaced by spaces (string and template literals
311
+ * are kept, so offsets and bracket access still read the same).
312
+ */
313
+ declare function withoutAllComments(text: string): string;
314
+ /** The milliseconds of a literal duration (`30000`, `'45s'`), or undefined for anything else. */
315
+ declare function literalDurationMs(value: string): number | undefined;
316
+ /** What one module's source shows. */
317
+ interface DurableSourceFindings {
318
+ features: SourceFeature[];
319
+ /** `startToCloseTimeout` literals of local activities above the cap, in milliseconds. */
320
+ localActivityTimeouts: number[];
321
+ /** Local activities given a function (user local activities, Phase C). */
322
+ userLocalActivities: number;
323
+ }
324
+ /** Read one tier-2 module (or a module a tier-2 workflow may call). */
325
+ declare function scanDurableSource(source: string): DurableSourceFindings;
326
+
250
327
  interface NodeVmEvaluatorOptions {
251
328
  /** Wall-clock budget for evaluating the bundle. Default 5000 ms. */
252
329
  timeoutMs?: number;
@@ -319,4 +396,4 @@ declare const PY_PROJECT_MODULE = "fluidgrids_workflows.project";
319
396
  */
320
397
  declare const PY_LINE_LENGTH = 88;
321
398
 
322
- export { EsbuildApi, Evaluator, type ExportCodeOptions, type ExportCodeResult, type ExportedFile, type FidelityItem, type FidelityItemKind, type FidelityReport, LiftError, type LiftHeader, type LiftOptions, type LiftResult, type NodeVmEvaluatorOptions, PY_LINE_LENGTH, PY_PROJECT_MODULE, PY_SDK_MODULE, type PlanOptions, type PreparedLift, SOURCE_ARCHIVE_MAX_BYTES, type SourceArchive, TS_FORMAT_OPTIONS, TS_NODES_IMPORT, type VendorOptions, VendoredDeps, VendoredPackage, archiveDeps, checkFidelity, createNodeVmEvaluator, exportWorkflowCode, liftToPython, liftToTypeScript, packSources, prepareLift, unpackSources, vendorDependencies };
399
+ export { BUNDLE_FILE_NAME, type DurableSourceFindings, EsbuildApi, Evaluator, type ExportCodeOptions, type ExportCodeResult, type ExportedFile, type FidelityItem, type FidelityItemKind, type FidelityReport, LiftError, type LiftHeader, type LiftOptions, type LiftResult, type NodeVmEvaluatorOptions, PY_LINE_LENGTH, PY_PROJECT_MODULE, PY_SDK_MODULE, type PlanOptions, type PreparedLift, SOURCE_ARCHIVE_MAX_BYTES, type SourceArchive, type SourceFeature, type SourceMapper, type SourcePosition, TS_FORMAT_OPTIONS, TS_NODES_IMPORT, type VendorOptions, VendoredDeps, VendoredPackage, archiveDeps, callArguments, checkFidelity, createNodeVmEvaluator, createSourceMapper, decodeVlq, exportWorkflowCode, liftToPython, liftToTypeScript, literalDurationMs, mapEnhancedStackTrace, mapStackTrace, objectEntries, packSources, prepareLift, scanDurableSource, sourceLocations, splitTopLevel, unpackSources, vendorDependencies, withoutAllComments };
@@ -1,14 +1,14 @@
1
- import { b as WorkflowDefinition, J as JsonObject } from '../types-BGoPzgcl.js';
2
- import { b as LayoutSidecar } from '../assemble-DWgaXHd-.js';
3
- import { N as NodeManifest } from '../manifest-C8N6HDYl.js';
1
+ import { W as WorkflowDefinition, a as JsonObject, J as Json } from '../types-Bb2wRnJ5.js';
2
+ import { f as LayoutSidecar } from '../collect-BTHjQaSp.js';
3
+ import { N as NodeManifest } from '../manifest-BJjrQt77.js';
4
4
  import { P as PathSegment } from '../expressions-DhHaqyar.js';
5
- import { V as VendoredDeps, a as VendoredPackage, E as Evaluator } from '../lower-_-iT4HYs.js';
6
- export { B as BuildBundleOptions, b as BuiltBundle, D as DeterminismViolationError, c as ESBUILD_VERSION, d as EVALUATION_GLOBAL, L as LowerIssue, e as LowerOptions, f as LowerResult, g as LoweredWorkflow, N as NODE_BUILTINS, h as buildBundle, i as bundleProject, j as bundleSourceHash, k as defaultEntries, l as lower, r as resolvePackageEntry, s as scanDurableSources, m as splitSpecifier } from '../lower-_-iT4HYs.js';
5
+ import { V as VendoredDeps, a as VendoredPackage, E as Evaluator } from '../lower-DmZpQ8hJ.js';
6
+ export { B as BuildBundleOptions, b as BuiltBundle, D as DeterminismViolationError, c as ESBUILD_VERSION, d as EVALUATION_GLOBAL, L as LowerIssue, e as LowerOptions, f as LowerResult, g as LoweredWorkflow, N as NODE_BUILTINS, h as buildBundle, i as bundleProject, j as bundleSourceHash, k as defaultEntries, l as durableFeatures, m as durableScanModules, n as lower, r as resolvePackageEntry, s as scanDurableSources, o as splitSpecifier } from '../lower-DmZpQ8hJ.js';
7
7
  import { E as EsbuildApi } from '../lower-types-DQNBfWQn.js';
8
8
  export { B as BuildDiagnostic, a as BuildDiagnosticLocation, L as LowerError, b as LowerFailureReason } from '../lower-types-DQNBfWQn.js';
9
- import '../workflow-Bpr3vnA_.js';
10
- import '../workflow-C2a05WUJ.js';
11
- import '../types-DV-HX_Gt.js';
9
+ import '../workflow-8uRU9rhL.js';
10
+ import '../workflow-DWTPHFbt.js';
11
+ import '../types-CnIOinoz.js';
12
12
  import '../hash-CZkTXPCX.js';
13
13
  import 'esbuild';
14
14
 
@@ -236,6 +236,8 @@ interface SourceArchive {
236
236
  lock?: string;
237
237
  /** Vendored packages by name. */
238
238
  vendored?: Record<string, VendoredPackage>;
239
+ /** The bundle's source map (`buildBundle(…, { sourcemap: 'external' }).map`, R2). */
240
+ map?: string;
239
241
  }
240
242
  declare const SOURCE_ARCHIVE_MAX_BYTES: number;
241
243
  /** Pack a source archive. */
@@ -247,6 +249,81 @@ declare function unpackSources(data: Uint8Array, options?: {
247
249
  /** The vendored packages of an archive as `buildBundle` takes them. */
248
250
  declare function archiveDeps(archive: SourceArchive): VendoredDeps;
249
251
 
252
+ /**
253
+ * Read a bundle's source map (C-SOURCEMAP): map a position in the bundle back
254
+ * to the workflow source, so `__stack_trace` and `__enhanced_stack_trace` name
255
+ * the original TypeScript line (11 §2.21). The service keeps the map in the
256
+ * source archive (`map`) and applies it to the stacks a query returns.
257
+ *
258
+ * Only version 3 maps with `mappings` are read; index maps (`sections`) are
259
+ * not produced by `buildBundle` and are refused.
260
+ */
261
+
262
+ /** The file name the isolates give a workflow bundle in stack traces. */
263
+ declare const BUNDLE_FILE_NAME = "workflow-bundle.mjs";
264
+ /** A position in the original source. Lines are 1-based, columns 0-based. */
265
+ interface SourcePosition {
266
+ source: string;
267
+ line: number;
268
+ column: number;
269
+ name?: string;
270
+ }
271
+ /** Maps a bundle position (1-based line, 0-based column) to its source position. */
272
+ interface SourceMapper {
273
+ /** Without a column, the first mapped segment of the line is used. */
274
+ lookup(line: number, column?: number): SourcePosition | undefined;
275
+ }
276
+ /** Decode one segment's base64 VLQ numbers. */
277
+ declare function decodeVlq(segment: string): number[];
278
+ /** Parse a version 3 source map. */
279
+ declare function createSourceMapper(mapText: string): SourceMapper;
280
+ /**
281
+ * Rewrite the bundle frames of a stack text (`at fn (workflow-bundle.mjs:12:5)`)
282
+ * to source positions (`at fn (workflows/order.ts:7:11)`). Other frames are kept.
283
+ */
284
+ declare function mapStackTrace(stack: string, mapper: SourceMapper, bundleFile?: string): string;
285
+ /**
286
+ * Map the locations of an `__enhanced_stack_trace` value in place of their
287
+ * bundle positions; a location keeps `bundleLine`/`bundleColumn` with the
288
+ * original position. Anything that is not the SDK's shape is returned as is.
289
+ */
290
+ declare function mapEnhancedStackTrace(value: Json, mapper: SourceMapper, bundleFile?: string): Json;
291
+ /** The source positions of the bundle frames of a stack text, innermost first. */
292
+ declare function sourceLocations(stack: string, mapper: SourceMapper, bundleFile?: string): SourcePosition[];
293
+
294
+ /** Bundle features a call site can show (the option-level ones come from the declarations). */
295
+ type SourceFeature = 'localActivity' | 'externalCancel' | 'childOptions' | 'canOptions';
296
+ /**
297
+ * The text between the parenthesis at `open` and its match, skipping string
298
+ * and template literals and comments. Unbalanced text runs to the end.
299
+ */
300
+ declare function callArguments(text: string, open: number): string;
301
+ /** Split `text` at commas that are not nested in brackets, literals or comments. */
302
+ declare function splitTopLevel(text: string): string[];
303
+ /**
304
+ * The top-level entries of an object literal (`{ a: 1, b }`): key and value
305
+ * text. Undefined when `text` is not an object literal or spreads another
306
+ * object, whose keys cannot be known.
307
+ */
308
+ declare function objectEntries(text: string): Map<string, string> | undefined;
309
+ /**
310
+ * `text` with its comments replaced by spaces (string and template literals
311
+ * are kept, so offsets and bracket access still read the same).
312
+ */
313
+ declare function withoutAllComments(text: string): string;
314
+ /** The milliseconds of a literal duration (`30000`, `'45s'`), or undefined for anything else. */
315
+ declare function literalDurationMs(value: string): number | undefined;
316
+ /** What one module's source shows. */
317
+ interface DurableSourceFindings {
318
+ features: SourceFeature[];
319
+ /** `startToCloseTimeout` literals of local activities above the cap, in milliseconds. */
320
+ localActivityTimeouts: number[];
321
+ /** Local activities given a function (user local activities, Phase C). */
322
+ userLocalActivities: number;
323
+ }
324
+ /** Read one tier-2 module (or a module a tier-2 workflow may call). */
325
+ declare function scanDurableSource(source: string): DurableSourceFindings;
326
+
250
327
  interface NodeVmEvaluatorOptions {
251
328
  /** Wall-clock budget for evaluating the bundle. Default 5000 ms. */
252
329
  timeoutMs?: number;
@@ -319,4 +396,4 @@ declare const PY_PROJECT_MODULE = "fluidgrids_workflows.project";
319
396
  */
320
397
  declare const PY_LINE_LENGTH = 88;
321
398
 
322
- export { EsbuildApi, Evaluator, type ExportCodeOptions, type ExportCodeResult, type ExportedFile, type FidelityItem, type FidelityItemKind, type FidelityReport, LiftError, type LiftHeader, type LiftOptions, type LiftResult, type NodeVmEvaluatorOptions, PY_LINE_LENGTH, PY_PROJECT_MODULE, PY_SDK_MODULE, type PlanOptions, type PreparedLift, SOURCE_ARCHIVE_MAX_BYTES, type SourceArchive, TS_FORMAT_OPTIONS, TS_NODES_IMPORT, type VendorOptions, VendoredDeps, VendoredPackage, archiveDeps, checkFidelity, createNodeVmEvaluator, exportWorkflowCode, liftToPython, liftToTypeScript, packSources, prepareLift, unpackSources, vendorDependencies };
399
+ export { BUNDLE_FILE_NAME, type DurableSourceFindings, EsbuildApi, Evaluator, type ExportCodeOptions, type ExportCodeResult, type ExportedFile, type FidelityItem, type FidelityItemKind, type FidelityReport, LiftError, type LiftHeader, type LiftOptions, type LiftResult, type NodeVmEvaluatorOptions, PY_LINE_LENGTH, PY_PROJECT_MODULE, PY_SDK_MODULE, type PlanOptions, type PreparedLift, SOURCE_ARCHIVE_MAX_BYTES, type SourceArchive, type SourceFeature, type SourceMapper, type SourcePosition, TS_FORMAT_OPTIONS, TS_NODES_IMPORT, type VendorOptions, VendoredDeps, VendoredPackage, archiveDeps, callArguments, checkFidelity, createNodeVmEvaluator, createSourceMapper, decodeVlq, exportWorkflowCode, liftToPython, liftToTypeScript, literalDurationMs, mapEnhancedStackTrace, mapStackTrace, objectEntries, packSources, prepareLift, scanDurableSource, sourceLocations, splitTopLevel, unpackSources, vendorDependencies, withoutAllComments };
@@ -1,20 +1,23 @@
1
- export { createNodeVmEvaluator } from '../chunk-XHXIDVEC.js';
1
+ export { createNodeVmEvaluator } from '../chunk-25BKWR2O.js';
2
2
  import { diffDefinitions } from '../chunk-6FSHT5IL.js';
3
3
  import { renderTypeScript, generateNodeClients, pyWorkflowName, NameAllocator, referencedLater, formatLines, formatImport, clientNames, pyString, snakeCase, pyNumber, PY_KEYWORDS } from '../chunk-SMCANK3F.js';
4
4
  export { PY_LINE_LENGTH, TS_FORMAT_OPTIONS, TS_NODES_IMPORT } from '../chunk-SMCANK3F.js';
5
5
  import { operationsOf, isTriggerOperation } from '../chunk-QAN5MZEM.js';
6
- import { LowerError, lower } from '../chunk-I5LR3D2K.js';
7
- export { DeterminismViolationError, ESBUILD_VERSION, EVALUATION_GLOBAL, LowerError, NODE_BUILTINS, buildBundle, bundleProject, bundleSourceHash, defaultEntries, lower, resolvePackageEntry, scanDurableSources, splitSpecifier } from '../chunk-I5LR3D2K.js';
8
- import '../chunk-XKJA7KX3.js';
9
- import { assembleRecording, LAYOUT_FORMAT_VERSION, LAYOUT_FORMAT, defineWorkflow, nodes, trigger, op, internalNodes, triggers, edge, defaultEdgeId } from '../chunk-HWJZVOG7.js';
6
+ import { LowerError, lower } from '../chunk-A2OHX3UQ.js';
7
+ export { DeterminismViolationError, ESBUILD_VERSION, EVALUATION_GLOBAL, LowerError, NODE_BUILTINS, buildBundle, bundleProject, bundleSourceHash, callArguments, defaultEntries, durableFeatures, durableScanModules, literalDurationMs, lower, objectEntries, resolvePackageEntry, scanDurableSource, scanDurableSources, splitSpecifier, splitTopLevel, withoutAllComments } from '../chunk-A2OHX3UQ.js';
8
+ import '../chunk-OIX4O6UR.js';
9
+ import { assembleRecording, LAYOUT_FORMAT_VERSION, LAYOUT_FORMAT, defineWorkflow, nodes, trigger, op, internalNodes, triggers, edge, defaultEdgeId } from '../chunk-FQSJI5NV.js';
10
10
  import { normalizeDefinition, irHash } from '../chunk-BD7ZPG53.js';
11
11
  import '../chunk-5LUIDMF4.js';
12
12
  import { PREDICATE_OPERATORS, BuilderError, and, or, expr, RESERVED_REF_KEYS } from '../chunk-JZ4TOOLN.js';
13
13
  import { canonicalJson, stableStringify } from '../chunk-E2VK7J2C.js';
14
14
  import { parseTemplate } from '../chunk-7AAZGVKD.js';
15
15
  import { isRecord, setOwn, deepEqual } from '../chunk-PMCM2OH4.js';
16
- import '../chunk-N23SKIG4.js';
17
- import '../chunk-BO6OVILK.js';
16
+ import { parseStack } from '../chunk-M272AHEX.js';
17
+ import '../chunk-7ILGCUI6.js';
18
+ import '../chunk-LNUQE6D6.js';
19
+ import '../chunk-2DDULZFM.js';
20
+ import '../chunk-PWIUEWC3.js';
18
21
  import { readFileSync, existsSync, readdirSync, statSync } from 'fs';
19
22
  import { resolve, join, dirname, relative, sep } from 'path';
20
23
  import { gzipSync, gunzipSync } from 'zlib';
@@ -1445,6 +1448,7 @@ function packSources(archive) {
1445
1448
  if (archive.lock !== void 0) value2["lock"] = archive.lock;
1446
1449
  if (archive.vendored !== void 0 && Object.keys(archive.vendored).length > 0)
1447
1450
  value2["vendored"] = archive.vendored;
1451
+ if (archive.map !== void 0) value2["map"] = archive.map;
1448
1452
  const text = canonicalJson(value2);
1449
1453
  const zipped = gzipSync(Buffer.from(text, "utf8"), { level: 9 });
1450
1454
  zipped[GZIP_OS_BYTE] = 255;
@@ -1488,6 +1492,10 @@ function unpackSources(data, options2 = {}) {
1488
1492
  if (typeof parsed["lock"] !== "string") throw new LowerError("lock must be a string");
1489
1493
  archive.lock = parsed["lock"];
1490
1494
  }
1495
+ if (parsed["map"] !== void 0) {
1496
+ if (typeof parsed["map"] !== "string") throw new LowerError("map must be a string");
1497
+ archive.map = parsed["map"];
1498
+ }
1491
1499
  if (parsed["vendored"] !== void 0) {
1492
1500
  if (!isRecord(parsed["vendored"])) throw new LowerError("vendored must be an object");
1493
1501
  const vendored = {};
@@ -1512,6 +1520,162 @@ function archiveDeps(archive) {
1512
1520
  return archive.vendored ?? {};
1513
1521
  }
1514
1522
 
1523
+ // src/roundtrip/source-map.ts
1524
+ var BUNDLE_FILE_NAME = "workflow-bundle.mjs";
1525
+ var BASE64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
1526
+ var BASE64_VALUE = new Map([...BASE64].map((char, index) => [char, index]));
1527
+ function decodeVlq(segment) {
1528
+ const values = [];
1529
+ let value2 = 0;
1530
+ let shift = 0;
1531
+ for (const char of segment) {
1532
+ const digit = BASE64_VALUE.get(char);
1533
+ if (digit === void 0) throw new LowerError(`Invalid source map character "${char}"`);
1534
+ value2 += (digit & 31) * 2 ** shift;
1535
+ if (digit & 32) {
1536
+ shift += 5;
1537
+ continue;
1538
+ }
1539
+ values.push(value2 % 2 === 1 ? -Math.floor(value2 / 2) : Math.floor(value2 / 2));
1540
+ value2 = 0;
1541
+ shift = 0;
1542
+ }
1543
+ if (shift !== 0) throw new LowerError("A source map segment ends in the middle of a number");
1544
+ return values;
1545
+ }
1546
+ function createSourceMapper(mapText) {
1547
+ let parsed;
1548
+ try {
1549
+ parsed = JSON.parse(mapText);
1550
+ } catch {
1551
+ throw new LowerError("The source map is not JSON");
1552
+ }
1553
+ if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed))
1554
+ throw new LowerError("The source map is not an object");
1555
+ const record = parsed;
1556
+ const sources = record["sources"];
1557
+ const names = Array.isArray(record["names"]) ? record["names"].map(String) : [];
1558
+ const mappings = record["mappings"];
1559
+ if (record["version"] !== 3 || !Array.isArray(sources) || typeof mappings !== "string")
1560
+ throw new LowerError("Only version 3 source maps with mappings are supported");
1561
+ const sourceNames = sources.map(String);
1562
+ const lines = [];
1563
+ let source = 0;
1564
+ let line = 0;
1565
+ let sourceColumn = 0;
1566
+ let name = 0;
1567
+ for (const lineText of mappings.split(";")) {
1568
+ const segments = [];
1569
+ let column = 0;
1570
+ for (const text of lineText.split(",")) {
1571
+ if (text === "") continue;
1572
+ const values = decodeVlq(text);
1573
+ column += values[0] ?? 0;
1574
+ if (values.length < 4) continue;
1575
+ source += values[1] ?? 0;
1576
+ line += values[2] ?? 0;
1577
+ sourceColumn += values[3] ?? 0;
1578
+ const segment = { column, source, line, sourceColumn };
1579
+ if (values.length >= 5) {
1580
+ name += values[4] ?? 0;
1581
+ segment.name = name;
1582
+ }
1583
+ segments.push(segment);
1584
+ }
1585
+ segments.sort((a, b) => a.column - b.column);
1586
+ lines.push(segments);
1587
+ }
1588
+ return {
1589
+ lookup(atLine, atColumn) {
1590
+ const segments = lines[atLine - 1];
1591
+ if (!segments || segments.length === 0) return void 0;
1592
+ let found = segments[0];
1593
+ if (atColumn !== void 0) {
1594
+ found = void 0;
1595
+ for (const segment of segments) {
1596
+ if (segment.column > atColumn) break;
1597
+ found = segment;
1598
+ }
1599
+ found ??= segments[0];
1600
+ }
1601
+ if (!found) return void 0;
1602
+ const sourceName = sourceNames[found.source];
1603
+ if (sourceName === void 0) return void 0;
1604
+ const position = {
1605
+ source: sourceName,
1606
+ line: found.line + 1,
1607
+ column: found.sourceColumn
1608
+ };
1609
+ const mappedName = found.name !== void 0 ? names[found.name] : void 0;
1610
+ if (mappedName !== void 0) position.name = mappedName;
1611
+ return position;
1612
+ }
1613
+ };
1614
+ }
1615
+ function isBundleFile(path, bundleFile) {
1616
+ return path !== void 0 && (path === bundleFile || path.endsWith(`/${bundleFile}`));
1617
+ }
1618
+ function mapStackTrace(stack, mapper, bundleFile = BUNDLE_FILE_NAME) {
1619
+ const frame = new RegExp(
1620
+ `${bundleFile.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}:(\\d+)(?::(\\d+))?`,
1621
+ "g"
1622
+ );
1623
+ return stack.split("\n").map(
1624
+ (line) => line.replace(frame, (whole, lineText, columnText) => {
1625
+ const position = mapper.lookup(
1626
+ Number(lineText),
1627
+ columnText !== void 0 ? Number(columnText) - 1 : void 0
1628
+ );
1629
+ return position ? `${position.source}:${position.line}:${position.column + 1}` : whole;
1630
+ })
1631
+ ).join("\n");
1632
+ }
1633
+ function mapEnhancedStackTrace(value2, mapper, bundleFile = BUNDLE_FILE_NAME) {
1634
+ if (typeof value2 !== "object" || value2 === null || Array.isArray(value2)) return value2;
1635
+ const stacks = value2["stacks"];
1636
+ if (!Array.isArray(stacks)) return value2;
1637
+ const mappedStacks = stacks.map((stack) => {
1638
+ if (typeof stack !== "object" || stack === null || Array.isArray(stack)) return stack;
1639
+ const locations = stack["locations"];
1640
+ if (!Array.isArray(locations)) return stack;
1641
+ return {
1642
+ ...stack,
1643
+ locations: locations.map((location) => {
1644
+ if (typeof location !== "object" || location === null || Array.isArray(location))
1645
+ return location;
1646
+ const filePath = typeof location["filePath"] === "string" ? location["filePath"] : void 0;
1647
+ const line = typeof location["line"] === "number" ? location["line"] : void 0;
1648
+ const column = typeof location["column"] === "number" ? location["column"] : void 0;
1649
+ if (!isBundleFile(filePath, bundleFile) || line === void 0) return location;
1650
+ const position = mapper.lookup(line, column !== void 0 ? column - 1 : void 0);
1651
+ if (!position) return location;
1652
+ const out = {
1653
+ ...location,
1654
+ filePath: position.source,
1655
+ line: position.line,
1656
+ column: position.column + 1,
1657
+ bundleLine: line
1658
+ };
1659
+ if (column !== void 0) out["bundleColumn"] = column;
1660
+ return out;
1661
+ })
1662
+ };
1663
+ });
1664
+ return { ...value2, stacks: mappedStacks };
1665
+ }
1666
+ function sourceLocations(stack, mapper, bundleFile = BUNDLE_FILE_NAME) {
1667
+ const out = [];
1668
+ for (const location of parseStack(stack)) {
1669
+ if (!isBundleFile(location.filePath, bundleFile) || location.line === void 0) continue;
1670
+ const position = mapper.lookup(
1671
+ location.line,
1672
+ location.column !== void 0 ? location.column - 1 : void 0
1673
+ );
1674
+ if (position) out.push(position);
1675
+ }
1676
+ return out;
1677
+ }
1678
+
1515
1679
  // src/roundtrip/fidelity.ts
1516
1680
  var LOSSY_KINDS = /* @__PURE__ */ new Set([
1517
1681
  "layout-omitted",
@@ -1566,4 +1730,4 @@ async function exportWorkflowCode(definition, options2) {
1566
1730
  return { format: options2.format, files, fidelity, irHash: irHash(definition) };
1567
1731
  }
1568
1732
 
1569
- export { LiftError, PY_PROJECT_MODULE, PY_SDK_MODULE, SOURCE_ARCHIVE_MAX_BYTES, archiveDeps, checkFidelity, exportWorkflowCode, liftToPython, liftToTypeScript, packSources, prepareLift, unpackSources, vendorDependencies };
1733
+ export { BUNDLE_FILE_NAME, LiftError, PY_PROJECT_MODULE, PY_SDK_MODULE, SOURCE_ARCHIVE_MAX_BYTES, archiveDeps, checkFidelity, createSourceMapper, decodeVlq, exportWorkflowCode, liftToPython, liftToTypeScript, mapEnhancedStackTrace, mapStackTrace, packSources, prepareLift, sourceLocations, unpackSources, vendorDependencies };
@@ -1,64 +1,65 @@
1
1
  'use strict';
2
2
 
3
- var chunkM4BBAERY_cjs = require('../chunk-M4BBAERY.cjs');
4
- require('../chunk-FMSW2HDF.cjs');
5
- require('../chunk-FR7KYWRO.cjs');
3
+ var chunkOMY3CKUZ_cjs = require('../chunk-OMY3CKUZ.cjs');
4
+ require('../chunk-ELL2RBML.cjs');
5
+ require('../chunk-Q4MWQNJK.cjs');
6
6
  var chunkL24YIZY7_cjs = require('../chunk-L24YIZY7.cjs');
7
- require('../chunk-DHTLALBL.cjs');
8
- var chunkP6TA5EZT_cjs = require('../chunk-P6TA5EZT.cjs');
9
- require('../chunk-623FVQSN.cjs');
10
- require('../chunk-2J6TF7YI.cjs');
7
+ require('../chunk-J3PYFGKA.cjs');
8
+ require('../chunk-FR7KYWRO.cjs');
9
+ var chunkRUQIMTN5_cjs = require('../chunk-RUQIMTN5.cjs');
10
+ require('../chunk-3FIDHONL.cjs');
11
+ require('../chunk-YHBVMOMK.cjs');
11
12
  require('../chunk-Z2Y65YOY.cjs');
12
13
 
13
14
 
14
15
 
15
16
  Object.defineProperty(exports, "CommandIds", {
16
17
  enumerable: true,
17
- get: function () { return chunkM4BBAERY_cjs.CommandIds; }
18
+ get: function () { return chunkOMY3CKUZ_cjs.CommandIds; }
18
19
  });
19
20
  Object.defineProperty(exports, "RUNTIME_GLOBAL", {
20
21
  enumerable: true,
21
- get: function () { return chunkM4BBAERY_cjs.RUNTIME_GLOBAL; }
22
+ get: function () { return chunkOMY3CKUZ_cjs.RUNTIME_GLOBAL; }
22
23
  });
23
24
  Object.defineProperty(exports, "SDK_NAME", {
24
25
  enumerable: true,
25
- get: function () { return chunkM4BBAERY_cjs.SDK_NAME; }
26
+ get: function () { return chunkOMY3CKUZ_cjs.SDK_NAME; }
26
27
  });
27
28
  Object.defineProperty(exports, "WorkflowExecution", {
28
29
  enumerable: true,
29
- get: function () { return chunkM4BBAERY_cjs.WorkflowExecution; }
30
+ get: function () { return chunkOMY3CKUZ_cjs.WorkflowExecution; }
30
31
  });
31
32
  Object.defineProperty(exports, "buildWorkflowRegistry", {
32
33
  enumerable: true,
33
- get: function () { return chunkM4BBAERY_cjs.buildWorkflowRegistry; }
34
+ get: function () { return chunkOMY3CKUZ_cjs.buildWorkflowRegistry; }
34
35
  });
35
36
  Object.defineProperty(exports, "createWorkflowRuntime", {
36
37
  enumerable: true,
37
- get: function () { return chunkM4BBAERY_cjs.createWorkflowRuntime; }
38
+ get: function () { return chunkOMY3CKUZ_cjs.createWorkflowRuntime; }
38
39
  });
39
40
  Object.defineProperty(exports, "installWorkflowRuntime", {
40
41
  enumerable: true,
41
- get: function () { return chunkM4BBAERY_cjs.installWorkflowRuntime; }
42
+ get: function () { return chunkOMY3CKUZ_cjs.installWorkflowRuntime; }
42
43
  });
43
44
  Object.defineProperty(exports, "isPatchMarkerId", {
44
45
  enumerable: true,
45
- get: function () { return chunkM4BBAERY_cjs.isPatchMarkerId; }
46
+ get: function () { return chunkOMY3CKUZ_cjs.isPatchMarkerId; }
46
47
  });
47
48
  Object.defineProperty(exports, "isRuntimeAbi", {
48
49
  enumerable: true,
49
- get: function () { return chunkM4BBAERY_cjs.isRuntimeAbi; }
50
+ get: function () { return chunkOMY3CKUZ_cjs.isRuntimeAbi; }
50
51
  });
51
52
  Object.defineProperty(exports, "matchActivation", {
52
53
  enumerable: true,
53
- get: function () { return chunkM4BBAERY_cjs.matchActivation; }
54
+ get: function () { return chunkOMY3CKUZ_cjs.matchActivation; }
54
55
  });
55
56
  Object.defineProperty(exports, "mismatch", {
56
57
  enumerable: true,
57
- get: function () { return chunkM4BBAERY_cjs.mismatch; }
58
+ get: function () { return chunkOMY3CKUZ_cjs.mismatch; }
58
59
  });
59
60
  Object.defineProperty(exports, "patchMarkerId", {
60
61
  enumerable: true,
61
- get: function () { return chunkM4BBAERY_cjs.patchMarkerId; }
62
+ get: function () { return chunkOMY3CKUZ_cjs.patchMarkerId; }
62
63
  });
63
64
  Object.defineProperty(exports, "SHIM_HOOK", {
64
65
  enumerable: true,
@@ -86,5 +87,5 @@ Object.defineProperty(exports, "uuidFrom", {
86
87
  });
87
88
  Object.defineProperty(exports, "splitActivations", {
88
89
  enumerable: true,
89
- get: function () { return chunkP6TA5EZT_cjs.splitActivations; }
90
+ get: function () { return chunkRUQIMTN5_cjs.splitActivations; }
90
91
  });