deepline 0.3.258 → 0.3.259

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 (67) hide show
  1. package/dist/bundling-sources/sdk/src/api-error.ts +45 -0
  2. package/dist/bundling-sources/sdk/src/client.ts +98 -459
  3. package/dist/bundling-sources/sdk/src/http.ts +1 -34
  4. package/dist/bundling-sources/sdk/src/index.ts +8 -0
  5. package/dist/bundling-sources/sdk/src/plays/csv-data-input.ts +139 -0
  6. package/dist/bundling-sources/sdk/src/plays/run-request.ts +855 -0
  7. package/dist/bundling-sources/sdk/src/release.ts +1 -1
  8. package/dist/bundling-sources/sdk/src/runs/overview.ts +45 -2
  9. package/dist/bundling-sources/sdk/src/types.ts +5 -0
  10. package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +8 -0
  11. package/dist/bundling-sources/shared_libs/play-runtime/context.ts +42 -10
  12. package/dist/bundling-sources/shared_libs/play-runtime/launch-identity.ts +3 -0
  13. package/dist/bundling-sources/shared_libs/play-runtime/launch-source-policy.ts +23 -0
  14. package/dist/bundling-sources/shared_libs/play-runtime/live-state-contract.ts +3 -0
  15. package/dist/bundling-sources/shared_libs/play-runtime/play-admission-outcome.ts +23 -5
  16. package/dist/bundling-sources/shared_libs/play-runtime/play-runs/projection/gateway-adapter.ts +1 -1
  17. package/dist/bundling-sources/shared_libs/play-runtime/run-execution-state.ts +845 -0
  18. package/dist/bundling-sources/shared_libs/play-runtime/run-ledger.ts +106 -6
  19. package/dist/bundling-sources/shared_libs/play-runtime/run-observation.ts +440 -0
  20. package/dist/bundling-sources/shared_libs/play-runtime/run-snapshot-stream.ts +35 -2
  21. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/index.ts +66 -7
  22. package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +0 -29
  23. package/dist/bundling-sources/shared_libs/play-runtime/runtime-sheet-row-transition.ts +47 -2
  24. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backend.ts +6 -0
  25. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +475 -36
  26. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-progress.ts +78 -11
  27. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +550 -42
  28. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/run-ledger-outbox-recovery.ts +181 -8
  29. package/dist/bundling-sources/shared_libs/play-runtime/step-lifecycle-tracker.ts +0 -18
  30. package/dist/bundling-sources/shared_libs/play-runtime/tool-execute-retry-policy.ts +80 -7
  31. package/dist/bundling-sources/shared_libs/play-runtime/tool-http-errors.ts +37 -2
  32. package/dist/bundling-sources/shared_libs/plays/bundling/index.ts +148 -18
  33. package/dist/bundling-sources/shared_libs/plays/cascade-falloff.ts +86 -0
  34. package/dist/bundling-sources/shared_libs/plays/docflow-unreached-reason.ts +611 -0
  35. package/dist/bundling-sources/shared_libs/plays/docflow.ts +21 -0
  36. package/dist/bundling-sources/shared_libs/plays/play-exports.ts +28 -5
  37. package/dist/bundling-sources/shared_libs/plays/settings-contract.ts +92 -10
  38. package/dist/bundling-sources/shared_libs/plays/static-pipeline.ts +5 -0
  39. package/dist/bundling-sources/shared_libs/plays/trigger-config-contract.ts +222 -0
  40. package/dist/bundling-sources/shared_libs/plays/trigger-config-route.ts +15 -0
  41. package/dist/cli/index.js +4957 -771
  42. package/dist/cli/index.mjs +4957 -771
  43. package/dist/client-B5XbKrrs.d.mts +6564 -0
  44. package/dist/client-C9Y49yya.d.ts +6564 -0
  45. package/dist/{compiler-manifest-C4mdRJOP.d.mts → compiler-manifest-CUuh8C3b.d.mts} +14 -1
  46. package/dist/{compiler-manifest-C4mdRJOP.d.ts → compiler-manifest-CUuh8C3b.d.ts} +14 -1
  47. package/dist/index.d.mts +7 -6275
  48. package/dist/index.d.ts +7 -6275
  49. package/dist/index.js +360 -326
  50. package/dist/index.mjs +360 -326
  51. package/dist/install-integrity.json +21 -2
  52. package/dist/plays/bundle-play-file.d.mts +2 -2
  53. package/dist/plays/bundle-play-file.d.ts +2 -2
  54. package/dist/plays/bundle-play-file.mjs +117 -18
  55. package/dist/plays/csv-data-input.d.mts +37 -0
  56. package/dist/plays/csv-data-input.d.ts +37 -0
  57. package/dist/plays/csv-data-input.js +3135 -0
  58. package/dist/plays/csv-data-input.mjs +3108 -0
  59. package/dist/plays/run-request.d.mts +6 -0
  60. package/dist/plays/run-request.d.ts +6 -0
  61. package/dist/plays/run-request.js +664 -0
  62. package/dist/plays/run-request.mjs +614 -0
  63. package/dist/release.d.mts +1 -1
  64. package/dist/release.d.ts +1 -1
  65. package/dist/release.js +1 -1
  66. package/dist/release.mjs +1 -1
  67. package/package.json +12 -1
@@ -2,6 +2,7 @@
2
2
  "schemaVersion": 1,
3
3
  "packageFiles": [
4
4
  "dist/bundling-sources/sdk/src/agent-runtime.ts",
5
+ "dist/bundling-sources/sdk/src/api-error.ts",
5
6
  "dist/bundling-sources/sdk/src/client.ts",
6
7
  "dist/bundling-sources/sdk/src/compat.ts",
7
8
  "dist/bundling-sources/sdk/src/config.ts",
@@ -18,8 +19,10 @@
18
19
  "dist/bundling-sources/sdk/src/pagination.ts",
19
20
  "dist/bundling-sources/sdk/src/play.ts",
20
21
  "dist/bundling-sources/sdk/src/plays/bundle-play-file.ts",
22
+ "dist/bundling-sources/sdk/src/plays/csv-data-input.ts",
21
23
  "dist/bundling-sources/sdk/src/plays/input-example.ts",
22
24
  "dist/bundling-sources/sdk/src/plays/local-file-discovery.ts",
25
+ "dist/bundling-sources/sdk/src/plays/run-request.ts",
23
26
  "dist/bundling-sources/sdk/src/release.ts",
24
27
  "dist/bundling-sources/sdk/src/runs/observe-transport.ts",
25
28
  "dist/bundling-sources/sdk/src/runs/overview.ts",
@@ -301,6 +304,7 @@
301
304
  "dist/bundling-sources/shared_libs/play-runtime/resource-governor.ts",
302
305
  "dist/bundling-sources/shared_libs/play-runtime/row-isolation.ts",
303
306
  "dist/bundling-sources/shared_libs/play-runtime/run-execution-scope.ts",
307
+ "dist/bundling-sources/shared_libs/play-runtime/run-execution-state.ts",
304
308
  "dist/bundling-sources/shared_libs/play-runtime/run-failure.ts",
305
309
  "dist/bundling-sources/shared_libs/play-runtime/run-identity.ts",
306
310
  "dist/bundling-sources/shared_libs/play-runtime/run-ledger-event-transport.ts",
@@ -309,6 +313,7 @@
309
313
  "dist/bundling-sources/shared_libs/play-runtime/run-ledger.ts",
310
314
  "dist/bundling-sources/shared_libs/play-runtime/run-lifecycle-policy.ts",
311
315
  "dist/bundling-sources/shared_libs/play-runtime/run-log-buffer.ts",
316
+ "dist/bundling-sources/shared_libs/play-runtime/run-observation.ts",
312
317
  "dist/bundling-sources/shared_libs/play-runtime/run-snapshot-stream.ts",
313
318
  "dist/bundling-sources/shared_libs/play-runtime/run-terminal-source.ts",
314
319
  "dist/bundling-sources/shared_libs/play-runtime/runner-app/child-play-resolver.ts",
@@ -478,6 +483,7 @@
478
483
  "dist/bundling-sources/shared_libs/plays/bundling/index.ts",
479
484
  "dist/bundling-sources/shared_libs/plays/bundling/limits.ts",
480
485
  "dist/bundling-sources/shared_libs/plays/bundling/repository-adapter.ts",
486
+ "dist/bundling-sources/shared_libs/plays/cascade-falloff.ts",
481
487
  "dist/bundling-sources/shared_libs/plays/cell-staleness.ts",
482
488
  "dist/bundling-sources/shared_libs/plays/child-run-projection.ts",
483
489
  "dist/bundling-sources/shared_libs/plays/compiler-manifest.ts",
@@ -497,6 +503,7 @@
497
503
  "dist/bundling-sources/shared_libs/plays/deployment-status.ts",
498
504
  "dist/bundling-sources/shared_libs/plays/docflow-binding-owner.ts",
499
505
  "dist/bundling-sources/shared_libs/plays/docflow-binding.ts",
506
+ "dist/bundling-sources/shared_libs/plays/docflow-unreached-reason.ts",
500
507
  "dist/bundling-sources/shared_libs/plays/docflow.ts",
501
508
  "dist/bundling-sources/shared_libs/plays/email-status.ts",
502
509
  "dist/bundling-sources/shared_libs/plays/enrich-compat-adapter.ts",
@@ -542,6 +549,8 @@
542
549
  "dist/bundling-sources/shared_libs/plays/tool-response-contract.ts",
543
550
  "dist/bundling-sources/shared_libs/plays/tool-result-types.ts",
544
551
  "dist/bundling-sources/shared_libs/plays/transform-factor-structure.ts",
552
+ "dist/bundling-sources/shared_libs/plays/trigger-config-contract.ts",
553
+ "dist/bundling-sources/shared_libs/plays/trigger-config-route.ts",
545
554
  "dist/bundling-sources/shared_libs/plays/ts-ast.ts",
546
555
  "dist/bundling-sources/shared_libs/plays/user-code-safety.ts",
547
556
  "dist/bundling-sources/shared_libs/plays/webhook-payload.ts",
@@ -582,8 +591,10 @@
582
591
  "dist/cli/index.js",
583
592
  "dist/cli/index.mjs",
584
593
  "dist/cli/text-imports.d.ts",
585
- "dist/compiler-manifest-C4mdRJOP.d.mts",
586
- "dist/compiler-manifest-C4mdRJOP.d.ts",
594
+ "dist/client-B5XbKrrs.d.mts",
595
+ "dist/client-C9Y49yya.d.ts",
596
+ "dist/compiler-manifest-CUuh8C3b.d.mts",
597
+ "dist/compiler-manifest-CUuh8C3b.d.ts",
587
598
  "dist/helpers.d.mts",
588
599
  "dist/helpers.d.ts",
589
600
  "dist/helpers.js",
@@ -603,6 +614,14 @@
603
614
  "dist/plays/bundle-play-file.d.mts",
604
615
  "dist/plays/bundle-play-file.d.ts",
605
616
  "dist/plays/bundle-play-file.mjs",
617
+ "dist/plays/csv-data-input.d.mts",
618
+ "dist/plays/csv-data-input.d.ts",
619
+ "dist/plays/csv-data-input.js",
620
+ "dist/plays/csv-data-input.mjs",
621
+ "dist/plays/run-request.d.mts",
622
+ "dist/plays/run-request.d.ts",
623
+ "dist/plays/run-request.js",
624
+ "dist/plays/run-request.mjs",
606
625
  "dist/plays/text-imports.d.ts",
607
626
  "dist/release.d.mts",
608
627
  "dist/release.d.ts",
@@ -1,6 +1,6 @@
1
1
  /// <reference path="./text-imports.d.ts" />
2
- import { P as PlayArtifactKind, a as PlayBundleArtifact, b as PlaySandboxRuntimeDeclaration, c as PlayCompilerManifest } from '../compiler-manifest-C4mdRJOP.mjs';
3
- export { d as PLAY_ARTIFACT_KINDS, e as PlayArtifactCompatibility, f as PlayImportPolicy, g as PlayPackageImport, h as PlayRuntimeFeature } from '../compiler-manifest-C4mdRJOP.mjs';
2
+ import { P as PlayArtifactKind, a as PlayBundleArtifact, b as PlaySandboxRuntimeDeclaration, c as PlayCompilerManifest } from '../compiler-manifest-CUuh8C3b.mjs';
3
+ export { d as PLAY_ARTIFACT_KINDS, e as PlayArtifactCompatibility, f as PlayImportPolicy, g as PlayPackageImport, h as PlayRuntimeFeature } from '../compiler-manifest-CUuh8C3b.mjs';
4
4
  import '@sinclair/typebox';
5
5
 
6
6
  type ImportedPlayDependency = {
@@ -1,6 +1,6 @@
1
1
  /// <reference path="./text-imports.d.ts" />
2
- import { P as PlayArtifactKind, a as PlayBundleArtifact, b as PlaySandboxRuntimeDeclaration, c as PlayCompilerManifest } from '../compiler-manifest-C4mdRJOP.js';
3
- export { d as PLAY_ARTIFACT_KINDS, e as PlayArtifactCompatibility, f as PlayImportPolicy, g as PlayPackageImport, h as PlayRuntimeFeature } from '../compiler-manifest-C4mdRJOP.js';
2
+ import { P as PlayArtifactKind, a as PlayBundleArtifact, b as PlaySandboxRuntimeDeclaration, c as PlayCompilerManifest } from '../compiler-manifest-CUuh8C3b.js';
3
+ export { d as PLAY_ARTIFACT_KINDS, e as PlayArtifactCompatibility, f as PlayImportPolicy, g as PlayPackageImport, h as PlayRuntimeFeature } from '../compiler-manifest-CUuh8C3b.js';
4
4
  import '@sinclair/typebox';
5
5
 
6
6
  type ImportedPlayDependency = {
@@ -1708,11 +1708,26 @@ function isDefinePlayCall(node) {
1708
1708
  }
1709
1709
  return false;
1710
1710
  }
1711
+ function stringLiteralValue(node) {
1712
+ const expression = unwrapStaticExpression(node);
1713
+ return expression?.type === "Literal" && typeof expression.value === "string" ? expression.value : null;
1714
+ }
1711
1715
  function definePlayName(node) {
1712
1716
  const expression = unwrapStaticExpression(node);
1713
1717
  if (!expression || expression.type !== "CallExpression") return null;
1714
- const first = astArray(expression.arguments)[0] ?? null;
1715
- return first?.type === "Literal" && typeof first.value === "string" ? first.value : null;
1718
+ const first = unwrapStaticExpression(
1719
+ astArray(expression.arguments)[0] ?? null
1720
+ );
1721
+ if (first?.type !== "ObjectExpression") return stringLiteralValue(first);
1722
+ let id = null;
1723
+ for (const property of astArray(first.properties)) {
1724
+ if (property.type !== "Property" || property.computed) continue;
1725
+ const key = isAstNode(property.key) ? property.key : null;
1726
+ const keyName = getIdentifierName(key) ?? (key?.type === "Literal" && typeof key.value === "string" ? key.value : null);
1727
+ if (keyName !== "id") continue;
1728
+ id = stringLiteralValue(isAstNode(property.value) ? property.value : null);
1729
+ }
1730
+ return id;
1716
1731
  }
1717
1732
  function listPlayFileExports(sourceCode) {
1718
1733
  const ast = parsePlaySourceForAnalysis(sourceCode);
@@ -2114,6 +2129,11 @@ function parseDocflowBlockGraph(mermaidSource, errors) {
2114
2129
  if (existing && existing.label === existing.id && label !== id) {
2115
2130
  existing.label = label;
2116
2131
  existing.kind = kind;
2132
+ for (const subgraph of subgraphs.values()) {
2133
+ const at = subgraph.memberIds.indexOf(id);
2134
+ if (at !== -1) subgraph.memberIds.splice(at, 1);
2135
+ }
2136
+ subgraphStack[subgraphStack.length - 1]?.memberIds.push(id);
2117
2137
  } else if (existing && existing.label !== label) {
2118
2138
  errors.push(`Docflow node "${id}" has conflicting labels.`);
2119
2139
  } else if (!existing) {
@@ -2129,10 +2149,12 @@ function parseDocflowBlockGraph(mermaidSource, errors) {
2129
2149
  const id = opened[1];
2130
2150
  const rawLabel = opened[2]?.trim() ?? "";
2131
2151
  const label = rawLabel.length >= 2 && (rawLabel.startsWith('"') && rawLabel.endsWith('"') || rawLabel.startsWith("'") && rawLabel.endsWith("'")) ? rawLabel.slice(1, -1) : rawLabel;
2152
+ const parent = subgraphStack[subgraphStack.length - 1];
2132
2153
  const subgraph = {
2133
2154
  id,
2134
2155
  label: label || id,
2135
- memberIds: []
2156
+ memberIds: [],
2157
+ ...parent ? { parentId: parent.id } : {}
2136
2158
  };
2137
2159
  subgraphs.set(id, subgraph);
2138
2160
  subgraphStack.push(subgraph);
@@ -3759,20 +3781,73 @@ function sourceLoaderForPath(path) {
3759
3781
  }
3760
3782
  return "ts";
3761
3783
  }
3762
- function docflowContextIdentifierFromCall(call) {
3784
+ function isFunctionNode(node) {
3785
+ return !!node && (node.type === "ArrowFunctionExpression" || node.type === "FunctionExpression");
3786
+ }
3787
+ function definePlayRunFunction(call) {
3763
3788
  if (!isDefinePlayCallExpression(call)) return null;
3764
3789
  const args = astArray(call.arguments);
3765
- const callback = args.find(
3766
- (argument) => argument.type === "ArrowFunctionExpression" || argument.type === "FunctionExpression"
3767
- );
3768
- if (!callback) return null;
3769
- return getIdentifierName3(astArray(callback.params)[0]);
3790
+ const positional = args.find((argument) => isFunctionNode(argument));
3791
+ if (positional) return positional;
3792
+ const config = unwrapStaticExpression2(args[0] ?? null);
3793
+ if (!config || config.type !== "ObjectExpression") return null;
3794
+ let run = null;
3795
+ for (const property of astArray(config.properties)) {
3796
+ if (property.type !== "Property") continue;
3797
+ if (propertyNameFromKey(property) !== "run") continue;
3798
+ const value = unwrapStaticExpression2(
3799
+ isAstNode(property.value) ? property.value : null
3800
+ );
3801
+ run = isFunctionNode(value) ? value : null;
3802
+ }
3803
+ return run;
3770
3804
  }
3771
- function findDocflowContextIdentifier(input) {
3805
+ var DOCFLOW_INJECTED_CONTEXT_NAME = "__deeplineDocflowContext";
3806
+ function docflowContextFromCall(call, sourceCode) {
3807
+ if (!isDefinePlayCallExpression(call)) return null;
3808
+ const run = definePlayRunFunction(call);
3809
+ if (!run) {
3810
+ return {
3811
+ kind: "unsupported",
3812
+ reason: "its definePlay call does not declare the run function inline (pass `definePlay(name, async (ctx, input) => \u2026)` or `definePlay({ id, run: async (ctx, input) => \u2026 })`)"
3813
+ };
3814
+ }
3815
+ const params = astArray(run.params);
3816
+ const first = params[0];
3817
+ if (first) {
3818
+ const name = getIdentifierName3(first);
3819
+ return name ? { kind: "named", name } : {
3820
+ kind: "unsupported",
3821
+ reason: `its run function's first parameter is not a plain identifier (found ${first.type}; declare the context as \`ctx\` and destructure inside the body)`
3822
+ };
3823
+ }
3824
+ const runBounds = astNodeBounds(run);
3825
+ const body = isAstNode(run.body) ? astNodeBounds(run.body) : null;
3826
+ if (!runBounds || !body) {
3827
+ return {
3828
+ kind: "unsupported",
3829
+ reason: "its run function has no source span"
3830
+ };
3831
+ }
3832
+ const signature = sourceCode.slice(runBounds.start, body.start);
3833
+ const emptyParams = /\(\s*\)/.exec(signature);
3834
+ if (!emptyParams) {
3835
+ return {
3836
+ kind: "unsupported",
3837
+ reason: "its parameterless run function has no `()` parameter list"
3838
+ };
3839
+ }
3840
+ return {
3841
+ kind: "inject",
3842
+ name: DOCFLOW_INJECTED_CONTEXT_NAME,
3843
+ at: runBounds.start + emptyParams.index + 1
3844
+ };
3845
+ }
3846
+ function findDocflowContext(input) {
3772
3847
  let owner = input.statement;
3773
3848
  while (owner) {
3774
- const contextName = docflowContextIdentifierFromCall(owner);
3775
- if (contextName) return contextName;
3849
+ const context = docflowContextFromCall(owner, input.sourceCode);
3850
+ if (context) return context;
3776
3851
  owner = input.parents.get(owner) ?? null;
3777
3852
  }
3778
3853
  const lineStart = input.lineStarts[input.bindingLine - 1];
@@ -3794,7 +3869,7 @@ function findDocflowContextIdentifier(input) {
3794
3869
  else if (isAstNode(child)) pending.push(child);
3795
3870
  }
3796
3871
  }
3797
- return best ? docflowContextIdentifierFromCall(best) : null;
3872
+ return best ? docflowContextFromCall(best, input.sourceCode) : null;
3798
3873
  }
3799
3874
  function docflowInputCaptureSource(paths) {
3800
3875
  return `[${paths.map((path) => {
@@ -3816,6 +3891,8 @@ function docflowObservationTarget(statement) {
3816
3891
  expression = statement.expression;
3817
3892
  } else if (statement.type === "IfStatement" && isAstNode(statement.test)) {
3818
3893
  expression = statement.test;
3894
+ } else if (statement.type === "ThrowStatement" && isAstNode(statement.argument)) {
3895
+ expression = statement.argument;
3819
3896
  }
3820
3897
  if (!expression) return null;
3821
3898
  const bounds = astNodeBounds(expression);
@@ -3823,11 +3900,13 @@ function docflowObservationTarget(statement) {
3823
3900
  return {
3824
3901
  ...bounds,
3825
3902
  awaitsResult: expressionContainsTopLevelAwait(expression),
3826
- expression
3903
+ expression,
3904
+ throws: statement.type === "ThrowStatement"
3827
3905
  };
3828
3906
  }
3829
3907
  function docflowObservedExpression(input) {
3830
- const callback = input.awaitsResult ? `async()=>(${input.expression})` : `()=>(${input.expression})`;
3908
+ const body = input.throws ? `{throw (${input.expression})}` : `(${input.expression})`;
3909
+ const callback = input.awaitsResult ? `async()=>${body}` : `()=>${body}`;
3831
3910
  const observation = `((runtimeContext,inputCaptures,execute)=>typeof runtimeContext.__deeplineObserveDocflowNode==="function"?runtimeContext.__deeplineObserveDocflowNode(${JSON.stringify(input.nodeId)},inputCaptures,${JSON.stringify(input.outputs)},execute):execute())(${input.contextName},${docflowInputCaptureSource(input.inputs)},${callback})`;
3832
3911
  return input.awaitsResult ? `(await ${observation})` : observation;
3833
3912
  }
@@ -3854,17 +3933,26 @@ function instrumentPlayDocflowRuntimeHits(sourceCode) {
3854
3933
  const lineStarts = sourceLineStarts(sourceCode);
3855
3934
  const replacements = [];
3856
3935
  const targets = [];
3936
+ const injectedContextAt = /* @__PURE__ */ new Set();
3857
3937
  const parents = buildDocflowParentIndex(ast);
3858
3938
  for (const binding of parsed.bindings) {
3859
3939
  const resolution = resolveDocflowBinding(ast, binding, lineStarts, parents);
3860
- const contextName = findDocflowContextIdentifier({
3940
+ const context = findDocflowContext({
3861
3941
  ast,
3942
+ sourceCode,
3862
3943
  statement: resolution.statement,
3863
3944
  bindingLine: binding.line,
3864
3945
  lineStarts,
3865
3946
  parents
3866
3947
  });
3867
- if (!contextName) continue;
3948
+ if (!context) continue;
3949
+ if (context.kind === "unsupported") {
3950
+ throw new Error(
3951
+ `@mermaid-node ${binding.nodeId} (line ${binding.line}) cannot be observed at runtime: ${context.reason}.`
3952
+ );
3953
+ }
3954
+ if (context.kind === "inject") injectedContextAt.add(context.at);
3955
+ const contextName = context.kind === "inject" ? `(${context.name}??{})` : context.name;
3868
3956
  const target = docflowObservationTarget(resolution.statement);
3869
3957
  const observedRoot = docflowOutputRoot(binding);
3870
3958
  if (target && observedRoot && docflowExpressionWrapsStepBuilder(target.expression, observedRoot)) {
@@ -3897,6 +3985,7 @@ function instrumentPlayDocflowRuntimeHits(sourceCode) {
3897
3985
  start: target.start,
3898
3986
  end: target.end,
3899
3987
  awaitsResult: target.awaitsResult,
3988
+ throws: target.throws,
3900
3989
  contextName: target.contextName,
3901
3990
  bindings: [target.binding]
3902
3991
  });
@@ -3904,6 +3993,7 @@ function instrumentPlayDocflowRuntimeHits(sourceCode) {
3904
3993
  }
3905
3994
  for (const group of groups) {
3906
3995
  let expression = sourceCode.slice(group.start, group.end);
3996
+ let innermost = true;
3907
3997
  for (const binding of [...group.bindings].reverse()) {
3908
3998
  expression = docflowObservedExpression({
3909
3999
  contextName: group.contextName,
@@ -3911,8 +4001,10 @@ function instrumentPlayDocflowRuntimeHits(sourceCode) {
3911
4001
  inputs: binding.inputs ?? [],
3912
4002
  outputs: binding.outputs ?? [],
3913
4003
  expression,
3914
- awaitsResult: group.awaitsResult
4004
+ awaitsResult: group.awaitsResult,
4005
+ throws: group.throws && innermost
3915
4006
  });
4007
+ innermost = false;
3916
4008
  }
3917
4009
  replacements.push({
3918
4010
  start: group.start,
@@ -3920,6 +4012,13 @@ function instrumentPlayDocflowRuntimeHits(sourceCode) {
3920
4012
  value: expression
3921
4013
  });
3922
4014
  }
4015
+ for (const at of injectedContextAt) {
4016
+ replacements.push({
4017
+ start: at,
4018
+ end: at,
4019
+ value: DOCFLOW_INJECTED_CONTEXT_NAME
4020
+ });
4021
+ }
3923
4022
  return replacements.sort((left, right) => right.start - left.start).reduce(
3924
4023
  (source, replacement) => `${source.slice(0, replacement.start)}${replacement.value}${source.slice(replacement.end)}`,
3925
4024
  sourceCode
@@ -0,0 +1,37 @@
1
+ /// <reference path="./text-imports.d.ts" />
2
+ type CsvDataInputSource = {
3
+ /** Dotted path into the run input, for error messages. */
4
+ inputPath: string;
5
+ /** What the caller supplied: a CLI path or a dropped file's name. */
6
+ value: string;
7
+ };
8
+ type ParsedCsvDataInput = {
9
+ /** Trimmed header names, in column order. */
10
+ headers: string[];
11
+ /** Trimmed data records, positional (one entry per header, ragged allowed). */
12
+ records: string[][];
13
+ };
14
+ /**
15
+ * STRICT validation of the play's CSV DATA input (the row source):
16
+ *
17
+ * - parses with `relax_quotes: false` so an unclosed/ragged quote is a LOUD
18
+ * error naming the line/character (prod run 20260611t145823-710 swallowed an
19
+ * entire `"https://...`-no-closing-quote row into one giant linkedin_url),
20
+ * - detects EXACT-after-trim duplicate header names (prod run
21
+ * 20260611t145821-917 had two `linkedin_url` columns; the second silently
22
+ * won) — case-DIFFERENT duplicates are handled play-side and not rejected,
23
+ * - rejects a header-only CSV with zero data rows.
24
+ *
25
+ * Any violation throws a `DeeplineError` (code `PLAY_INPUT_FILE_PREFLIGHT`)
26
+ * before any staging or API call, so no run is created and nothing is billed.
27
+ */
28
+ declare function parseCsvDataInput(source: CsvDataInputSource, content: string, options?: {
29
+ /**
30
+ * Called after each parsed record (header included) with the running
31
+ * count. Observation only: it cannot change, drop, or reorder records.
32
+ * The dashboard's parser worker uses it to report row progress.
33
+ */
34
+ onRecord?: (recordCount: number) => void;
35
+ }): ParsedCsvDataInput;
36
+
37
+ export { type CsvDataInputSource, type ParsedCsvDataInput, parseCsvDataInput };
@@ -0,0 +1,37 @@
1
+ /// <reference path="./text-imports.d.ts" />
2
+ type CsvDataInputSource = {
3
+ /** Dotted path into the run input, for error messages. */
4
+ inputPath: string;
5
+ /** What the caller supplied: a CLI path or a dropped file's name. */
6
+ value: string;
7
+ };
8
+ type ParsedCsvDataInput = {
9
+ /** Trimmed header names, in column order. */
10
+ headers: string[];
11
+ /** Trimmed data records, positional (one entry per header, ragged allowed). */
12
+ records: string[][];
13
+ };
14
+ /**
15
+ * STRICT validation of the play's CSV DATA input (the row source):
16
+ *
17
+ * - parses with `relax_quotes: false` so an unclosed/ragged quote is a LOUD
18
+ * error naming the line/character (prod run 20260611t145823-710 swallowed an
19
+ * entire `"https://...`-no-closing-quote row into one giant linkedin_url),
20
+ * - detects EXACT-after-trim duplicate header names (prod run
21
+ * 20260611t145821-917 had two `linkedin_url` columns; the second silently
22
+ * won) — case-DIFFERENT duplicates are handled play-side and not rejected,
23
+ * - rejects a header-only CSV with zero data rows.
24
+ *
25
+ * Any violation throws a `DeeplineError` (code `PLAY_INPUT_FILE_PREFLIGHT`)
26
+ * before any staging or API call, so no run is created and nothing is billed.
27
+ */
28
+ declare function parseCsvDataInput(source: CsvDataInputSource, content: string, options?: {
29
+ /**
30
+ * Called after each parsed record (header included) with the running
31
+ * count. Observation only: it cannot change, drop, or reorder records.
32
+ * The dashboard's parser worker uses it to report row progress.
33
+ */
34
+ onRecord?: (recordCount: number) => void;
35
+ }): ParsedCsvDataInput;
36
+
37
+ export { type CsvDataInputSource, type ParsedCsvDataInput, parseCsvDataInput };