deepline 0.1.228 → 0.1.230

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 (39) hide show
  1. package/dist/bundling-sources/apps/play-runner-workers/src/coordinator-entry.ts +76 -1842
  2. package/dist/bundling-sources/apps/play-runner-workers/src/dedup-do.ts +0 -113
  3. package/dist/bundling-sources/apps/play-runner-workers/src/entry.ts +81 -968
  4. package/dist/bundling-sources/apps/play-runner-workers/src/workflow-retry-state.ts +1 -50
  5. package/dist/bundling-sources/sdk/src/release.ts +2 -2
  6. package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +67 -15
  7. package/dist/bundling-sources/shared_libs/play-runtime/child-execution-strategy.ts +84 -79
  8. package/dist/bundling-sources/shared_libs/play-runtime/context.ts +152 -688
  9. package/dist/bundling-sources/shared_libs/play-runtime/coordinator-headers.ts +3 -10
  10. package/dist/bundling-sources/shared_libs/play-runtime/ctx-contract.ts +2 -2
  11. package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +12 -47
  12. package/dist/bundling-sources/shared_libs/play-runtime/governor/block-reserving-budget-state-backend.ts +0 -2
  13. package/dist/bundling-sources/shared_libs/play-runtime/governor/governor.ts +12 -200
  14. package/dist/bundling-sources/shared_libs/play-runtime/governor/policy.ts +2 -17
  15. package/dist/bundling-sources/shared_libs/play-runtime/play-call-execution.ts +6 -1
  16. package/dist/bundling-sources/shared_libs/play-runtime/play-latency-trace.ts +28 -0
  17. package/dist/bundling-sources/shared_libs/play-runtime/run-execution-scope.ts +16 -64
  18. package/dist/bundling-sources/shared_libs/play-runtime/runtime-api-paths.ts +0 -4
  19. package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +37 -9
  20. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backend.ts +0 -36
  21. package/dist/bundling-sources/shared_libs/play-runtime/suspension.ts +3 -21
  22. package/dist/bundling-sources/shared_libs/play-runtime/test-runtime-seams.ts +9 -1
  23. package/dist/bundling-sources/shared_libs/plays/static-pipeline.ts +2 -0
  24. package/dist/cli/index.js +45 -92
  25. package/dist/cli/index.mjs +45 -92
  26. package/dist/{compiler-manifest-BhgZ23A4.d.ts → compiler-manifest-CYcwzSOJ.d.mts} +2 -0
  27. package/dist/{compiler-manifest-BhgZ23A4.d.mts → compiler-manifest-CYcwzSOJ.d.ts} +2 -0
  28. package/dist/index.d.mts +1 -1
  29. package/dist/index.d.ts +1 -1
  30. package/dist/index.js +2 -2
  31. package/dist/index.mjs +2 -2
  32. package/dist/plays/bundle-play-file.d.mts +2 -2
  33. package/dist/plays/bundle-play-file.d.ts +2 -2
  34. package/package.json +1 -1
  35. package/dist/bundling-sources/apps/play-runner-workers/src/child-manifest-resolver.ts +0 -108
  36. package/dist/bundling-sources/apps/play-runner-workers/src/child-play-await.ts +0 -374
  37. package/dist/bundling-sources/apps/play-runner-workers/src/child-play-submit.ts +0 -203
  38. package/dist/bundling-sources/shared_libs/play-runtime/child-execution-placement.ts +0 -14
  39. package/dist/bundling-sources/shared_libs/play-runtime/child-run-id.ts +0 -121
@@ -2,10 +2,6 @@ export const PLAY_RUNTIME_API_COMPAT_PATH = '/api/v2/plays/internal/runtime';
2
2
  export const PLAY_RUNTIME_API_CURRENT_PATH = '/api/v2/internal/play-runtime';
3
3
  export const PLAY_RUNTIME_ATTEMPT_EXECUTOR_TOKEN_PATH =
4
4
  '/api/v2/internal/play-runtime/executor-token';
5
- export const PLAY_RUNTIME_CHILD_EXECUTOR_TOKEN_COMPAT_PATH =
6
- '/api/v2/plays/internal/child-executor-token';
7
- export const PLAY_RUNTIME_CHILD_EXECUTOR_TOKEN_CURRENT_PATH =
8
- '/api/v2/internal/play-runtime/child-executor-token';
9
5
  export const PLAY_RUNTIME_TAIL_LOG_COMPAT_PATH =
10
6
  '/api/v2/plays/internal/tail-log';
11
7
  export const PLAY_RUNTIME_TAIL_LOG_CURRENT_PATH =
@@ -371,7 +371,22 @@ export type ResolvedRuntimePlay = {
371
371
  sourceCode?: string | null;
372
372
  artifact?: PlayBundleArtifact | null;
373
373
  codeFormat?: 'function' | 'cjs_module' | 'esm_module';
374
+ /**
375
+ * The runtime must receive the child contract with its artifact. Inline
376
+ * composition rejects unresolved or dataset-backed children before running
377
+ * their code, so dropping this field at the API boundary makes valid scalar
378
+ * children indistinguishable from unknown ones.
379
+ */
380
+ staticPipeline?: PlayStaticPipeline | null;
374
381
  contractSnapshot?: Record<string, unknown> | null;
382
+ /** Preview-only contract propagation evidence, emitted by the server and
383
+ * logged by the runner while diagnosing a cross-runtime child resolution
384
+ * failure. It intentionally contains no source, inputs, or credentials. */
385
+ resolutionDiagnostics?: {
386
+ serverPlayPipeline: boolean;
387
+ manifestPipeline: boolean;
388
+ responsePipeline: boolean;
389
+ } | null;
375
390
  };
376
391
 
377
392
  export type PrepareRuntimeSheetResult = {
@@ -2951,15 +2966,28 @@ export async function resolveRuntimeReferencedPlay(
2951
2966
  playRef: string,
2952
2967
  options?: { artifactKind?: PlayArtifactKind },
2953
2968
  ): Promise<ResolvedRuntimePlay | null> {
2954
- const response = await postRuntimeApi<{ play: ResolvedRuntimePlay | null }>(
2955
- context,
2956
- {
2957
- action: 'resolve_play',
2958
- playRef,
2959
- ...(options?.artifactKind ? { artifactKind: options.artifactKind } : {}),
2960
- },
2961
- );
2962
- return response.play;
2969
+ const response = await postRuntimeApi<{
2970
+ play: ResolvedRuntimePlay | null;
2971
+ manifest?: { staticPipeline?: PlayStaticPipeline | null } | null;
2972
+ }>(context, {
2973
+ action: 'resolve_play',
2974
+ playRef,
2975
+ ...(options?.artifactKind ? { artifactKind: options.artifactKind } : {}),
2976
+ });
2977
+ if (!response.play) {
2978
+ return null;
2979
+ }
2980
+
2981
+ // The server builds the manifest and child artifact together. Its manifest
2982
+ // carries the canonical empty scalar contract when a published scalar's
2983
+ // revision snapshot has no pipeline. Keep that contract on the object the
2984
+ // runner passes to ctx.runPlay; otherwise a valid scalar leaf arrives as an
2985
+ // indistinguishable "missing static contract" at runtime.
2986
+ return {
2987
+ ...response.play,
2988
+ staticPipeline:
2989
+ response.play.staticPipeline ?? response.manifest?.staticPipeline ?? null,
2990
+ };
2963
2991
  }
2964
2992
 
2965
2993
  export async function ensureRuntimeSheet(
@@ -17,7 +17,6 @@ import type {
17
17
  PlayRowUpdate,
18
18
  } from './ctx-types';
19
19
  import type { ExecutionPlan } from './execution-plan';
20
- import type { PlayRuntimeManifestMap } from '../plays/compiler-manifest';
21
20
  import type { PreloadedRuntimeDbSession } from './db-session';
22
21
  import type { RuntimeAuthorityDescriptor } from './execution-capabilities';
23
22
  import type { PlayRunnerRuntimeTiming } from './protocol';
@@ -42,39 +41,6 @@ export type PlaySchedulerBackendId =
42
41
 
43
42
  export type { PlayRunInputPayload };
44
43
 
45
- export type PlayCallGovernanceSnapshot = {
46
- rootRunId: string;
47
- parentRunId: string;
48
- parentPlayName: string;
49
- key: string;
50
- ancestryPlayIds: string[];
51
- callDepth: number;
52
- /**
53
- * Cumulative lineage-global budget counters consumed by ancestors at the
54
- * moment this child was launched. The child seeds its own counters from these
55
- * so the corresponding budgets (`maxPlayCallCount`, `maxToolCallCount`,
56
- * `maxRetryCount`, `maxDescendants`, `maxWaterfallStepExecutions`) accumulate
57
- * down the dispatch lineage instead of resetting to 0 in each worker isolate —
58
- * matching the cjs forkChild path, which threads all of them. The Governor
59
- * documents these budgets as global across the nested-play tree, not
60
- * per-worker (see policy.ts / rate-state-backend.ts); threading them here is
61
- * what makes that true on `esm_workers`.
62
- *
63
- * `descendantCount` is load-bearing for fan-out: forkChild charges
64
- * `descendant` on every child launch, so without threading it a deep/wide tree
65
- * would reset descendant accounting at each isolate and never converge on the
66
- * lineage-global cap.
67
- *
68
- * All optional and fail-safe: if absent (older callers / dropped in transit)
69
- * the child falls back to 0, i.e. prior behavior.
70
- */
71
- playCallCount?: number;
72
- toolCallCount?: number;
73
- retryCount?: number;
74
- descendantCount?: number;
75
- waterfallStepExecutions?: number;
76
- };
77
-
78
44
  export type PlaySchedulerSubmitInput = {
79
45
  runId: string;
80
46
  playId: string;
@@ -122,8 +88,6 @@ export type PlaySchedulerSubmitInput = {
122
88
  }> | null;
123
89
  contractSnapshot?: unknown;
124
90
  executionPlan?: ExecutionPlan | null;
125
- childPlayManifests?: PlayRuntimeManifestMap | null;
126
- playCallGovernance?: PlayCallGovernanceSnapshot | null;
127
91
  preloadedDbSessions?: PreloadedRuntimeDbSession[] | null;
128
92
  /**
129
93
  * Secret that decrypts `preloadedDbSessions` postgres URLs. Equals the run's
@@ -18,20 +18,6 @@ export type PlayExecutionSuspension =
18
18
  timeoutMs: number;
19
19
  }>;
20
20
  }
21
- | {
22
- kind: 'child_play';
23
- boundaryId: string;
24
- childRunId: string;
25
- childPlayName: string;
26
- }
27
- | {
28
- kind: 'child_play_batch';
29
- boundaries: Array<{
30
- boundaryId: string;
31
- childRunId: string;
32
- childPlayName: string;
33
- }>;
34
- }
35
21
  | {
36
22
  /**
37
23
  * Push-execution park (B2-final): the Daytona runner command was started
@@ -72,13 +58,9 @@ export class PlayExecutionSuspendedError extends Error {
72
58
  ? `Play execution suspended for durable sleep (${suspension.delayMs}ms).`
73
59
  : suspension.kind === 'integration_event_batch'
74
60
  ? `Play execution suspended waiting for ${suspension.boundaries.length} integration events.`
75
- : suspension.kind === 'child_play_batch'
76
- ? `Play execution suspended waiting for ${suspension.boundaries.length} child plays.`
77
- : suspension.kind === 'child_play'
78
- ? `Play execution suspended waiting for child play ${JSON.stringify(suspension.childPlayName)}.`
79
- : suspension.kind === 'detached_runner'
80
- ? `Play execution parked on detached runner ${suspension.cmdId} (sandbox ${suspension.sandboxId}).`
81
- : `Play execution suspended waiting for integration event ${JSON.stringify(suspension.eventKey)}.`,
61
+ : suspension.kind === 'detached_runner'
62
+ ? `Play execution parked on detached runner ${suspension.cmdId} (sandbox ${suspension.sandboxId}).`
63
+ : `Play execution suspended waiting for integration event ${JSON.stringify(suspension.eventKey)}.`,
82
64
  );
83
65
  this.name = 'PlayExecutionSuspendedError';
84
66
  this.suspension = suspension;
@@ -5,7 +5,14 @@ export const PLAY_RUNTIME_TEST_FAULT_HEADER = 'x-deepline-test-fault';
5
5
  export type RuntimeTestFaultName =
6
6
  | 'receipt_complete_write_fail'
7
7
  | 'receipt_fail_write_fail'
8
- | 'worker_receipt_complete_write_fail';
8
+ | 'worker_receipt_complete_write_fail'
9
+ /**
10
+ * Holds an already checked-out receipt-gateway scheduler client for the
11
+ * supplied bounded millisecond value. Preview/CI only: this creates a
12
+ * deterministic real-Pg-pool pressure window without changing an action's
13
+ * SQL or outcome.
14
+ */
15
+ | 'receipt_gateway_hold_ms';
9
16
 
10
17
  export type RuntimeTestFaultRegistry = {
11
18
  consume(name: RuntimeTestFaultName): boolean;
@@ -63,6 +70,7 @@ const SUPPORTED_RUNTIME_TEST_FAULTS = new Set<RuntimeTestFaultName>([
63
70
  'receipt_complete_write_fail',
64
71
  'receipt_fail_write_fail',
65
72
  'worker_receipt_complete_write_fail',
73
+ 'receipt_gateway_hold_ms',
66
74
  ]);
67
75
 
68
76
  const RUNTIME_TEST_POLICY_MS_FIELDS = new Set([
@@ -586,6 +586,8 @@ export type PlayStaticSubstep = PlayStaticSubstepMetadata &
586
586
  type: 'play_call';
587
587
  playId: string;
588
588
  execution?: 'inline' | 'child-workflow';
589
+ timeoutMs?: number;
590
+ hasExplicitTimeout?: boolean;
589
591
  field: string;
590
592
  inLoop?: boolean;
591
593
  pipeline?: PlayStaticPipeline | null;
package/dist/cli/index.js CHANGED
@@ -625,10 +625,10 @@ var SDK_RELEASE = {
625
625
  // 0.1.175 ships loud `deepline enrich` empty-waterfall reporting.
626
626
  // 0.1.220 deprecates SDK CLI versions below 0.1.219 and updates them
627
627
  // automatically without blocking their current command.
628
- version: "0.1.228",
628
+ version: "0.1.230",
629
629
  apiContract: "2026-06-dataset-handle-results-hard-cutover",
630
630
  supportPolicy: {
631
- latest: "0.1.228",
631
+ latest: "0.1.230",
632
632
  minimumSupported: "0.1.53",
633
633
  deprecatedBelow: "0.1.219",
634
634
  commandMinimumSupported: [
@@ -17886,8 +17886,6 @@ function renderExecuteStep(command, options = {
17886
17886
  force: true` : "";
17887
17887
  const legacyEnvelope = options.legacyEnvelope ? `,
17888
17888
  legacyEnvelope: true` : "";
17889
- const waterfallSoftFail = options.waterfallSoftFail ? `,
17890
- waterfallSoftFail: true` : "";
17891
17889
  return [
17892
17890
  `async (row, stepCtx) => {`,
17893
17891
  ...options.precheck ? [` if (${options.precheck}) return null;`] : [],
@@ -17899,7 +17897,7 @@ function renderExecuteStep(command, options = {
17899
17897
  ` extract: ${extractJs},`,
17900
17898
  ` runIf: ${runIfJs},`,
17901
17899
  ` row,`,
17902
- ` stepCtx${description}${force}${legacyEnvelope}${waterfallSoftFail}`,
17900
+ ` stepCtx${description}${force}${legacyEnvelope}`,
17903
17901
  ` });`,
17904
17902
  `}`
17905
17903
  ].join("\n");
@@ -17959,18 +17957,14 @@ function renderIdiomaticExecuteStep(command, options) {
17959
17957
  `async (row, ctx) => {`,
17960
17958
  ...options.precheck ? [` if (${options.precheck}) return null;`] : [],
17961
17959
  ...runIfLines,
17962
- ` let result: any;`,
17963
- ` try {`,
17964
- ` result = await ctx.tools.execute({`,
17965
- ` id: ${callId},`,
17966
- ` tool: ${tool},`,
17967
- ` input: ${input2} as any,`,
17968
- ` description: ${stringLiteral((command.description ?? "").trim() || `Run ${command.alias} via ${command.tool}.`)},`,
17960
+ ` const result: any = await ctx.tools.execute({`,
17961
+ ` id: ${callId},`,
17962
+ ` tool: ${tool},`,
17963
+ ` input: ${input2} as any,`,
17964
+ ` description: ${stringLiteral((command.description ?? "").trim() || `Run ${command.alias} via ${command.tool}.`)},`,
17969
17965
  ...options.force ? [` force: true,`] : [],
17970
- ` });`,
17971
- ` } catch (error) {`,
17972
- ...options.waterfallSoftFail ? [` return __dlWaterfallToolFailure(error);`] : [` throw error;`],
17973
- ` }`,
17966
+ ` });`,
17967
+ ` __dlAssertSuccessfulToolResult(result);`,
17974
17968
  ` return ${extraction};`,
17975
17969
  `}`
17976
17970
  ].join("\n");
@@ -17994,21 +17988,19 @@ function renderPlayStep(command, options) {
17994
17988
  ...runIfLines,
17995
17989
  ` const payload = __dlTemplate(${payload}, templateRow) as Record<string, unknown>;`,
17996
17990
  ` if (__dlShouldSkipBlankPlayPayload(payload)) return null;`,
17997
- ` let result: unknown;`,
17998
- ` try {`,
17991
+ ` const result: unknown = `,
17999
17992
  ...inlineHandler ? [
18000
17993
  // Enrich validates and normalizes this payload against the certified
18001
17994
  // prebuilt contract before code generation. The attachment retains
18002
17995
  // its concrete input type, while generated payloads are records.
18003
- ` result = await __dlRunInlinePlay(${inlineHandler}, stepCtx, payload as never, ${options.force});`
17996
+ ` await __dlRunInlinePlay(${inlineHandler}, stepCtx, payload as never, ${options.force});`
18004
17997
  ] : [
18005
- ` result = await stepCtx.runPlay(${callId}, ${playRef}, payload, {`,
18006
- ` description: ${stringLiteral(command.description ?? command.alias)}`,
17998
+ ` await stepCtx.runPlay(${callId}, ${playRef}, payload, {`,
17999
+ ` description: ${stringLiteral(command.description ?? command.alias)}`,
18007
18000
  ` });`
18008
18001
  ],
18009
- ` } catch (error) {`,
18010
- ...options.waterfallSoftFail ? [` return __dlWaterfallToolFailure(error);`] : [` throw error;`],
18011
- ` }`,
18002
+ ``,
18003
+ ` __dlAssertSuccessfulToolResult(result);`,
18012
18004
  ` return __dlPlayResultValue(${alias}, result);`,
18013
18005
  `}`
18014
18006
  ].join("\n");
@@ -18042,23 +18034,17 @@ function renderInlineJavascriptStep(command, options) {
18042
18034
  `async (row) => {`,
18043
18035
  ...options.precheck ? [` if (${options.precheck}) return null;`] : [],
18044
18036
  ...runIfLines,
18045
- ...options.waterfallSoftFail ? [` try {`] : [],
18046
- `${options.waterfallSoftFail ? " " : " "}const __dlPayload = __dlRuntimePayload('run_javascript', __dlTemplate(${payload}, row as Record<string, unknown>) as Record<string, unknown>, row as Record<string, unknown>);`,
18047
- `${options.waterfallSoftFail ? " " : " "}const rawResult = ((row: Record<string, any>, input: Record<string, any>, context: Record<string, any>) => {`,
18048
- `${options.waterfallSoftFail ? " " : " "} const payload = __dlPayload as Record<string, any>;`,
18049
- `${options.waterfallSoftFail ? " " : " "} const extract = __dlInlineExtract;`,
18050
- `${options.waterfallSoftFail ? " " : " "} const extractList = __dlInlineExtractList;`,
18051
- `${options.waterfallSoftFail ? " " : " "} return (() => {`,
18037
+ ` const __dlPayload = __dlRuntimePayload('run_javascript', __dlTemplate(${payload}, row as Record<string, unknown>) as Record<string, unknown>, row as Record<string, unknown>);`,
18038
+ ` const rawResult = ((row: Record<string, any>, input: Record<string, any>, context: Record<string, any>) => {`,
18039
+ ` const payload = __dlPayload as Record<string, any>;`,
18040
+ ` const extract = __dlInlineExtract;`,
18041
+ ` const extractList = __dlInlineExtractList;`,
18042
+ ` return (() => {`,
18052
18043
  indent(renderJavascriptBody(code), 4),
18053
- `${options.waterfallSoftFail ? " " : " "} })();`,
18054
- `${options.waterfallSoftFail ? " " : " "}})(row as Record<string, any>, row as Record<string, any>, row as Record<string, any>);`,
18055
- `${options.waterfallSoftFail ? " " : " "}const result = await Promise.resolve(rawResult);`,
18056
- `${options.waterfallSoftFail ? " " : " "}return ${resultExpression};`,
18057
- ...options.waterfallSoftFail ? [
18058
- ` } catch (error) {`,
18059
- ` return __dlExtractorFailure(error);`,
18060
- ` }`
18061
- ] : [],
18044
+ ` })();`,
18045
+ ` })(row as Record<string, any>, row as Record<string, any>, row as Record<string, any>);`,
18046
+ ` const result = await Promise.resolve(rawResult);`,
18047
+ ` return ${resultExpression};`,
18062
18048
  `}`
18063
18049
  ].join("\n");
18064
18050
  }
@@ -18192,7 +18178,6 @@ function renderWaterfallColumns(command, forceAliases, inlineRunJavascript, idio
18192
18178
  legacyEnvelope: Boolean(nested.extract_js),
18193
18179
  inlineRunJavascript,
18194
18180
  idiomaticGetters,
18195
- waterfallSoftFail: true,
18196
18181
  nativeRunIf: Boolean(runIfSource)
18197
18182
  }),
18198
18183
  {
@@ -18526,6 +18511,14 @@ function helperSource() {
18526
18511
  ` return status === 'error' || status === 'failed' || (typeof record.error === 'string' && record.error.trim() !== '') || (typeof resultError === 'string' && resultError.trim() !== '');`,
18527
18512
  `}`,
18528
18513
  ``,
18514
+ `function __dlAssertSuccessfulToolResult(value: unknown): void {`,
18515
+ ` if (!__dlErrorPayload(value)) return;`,
18516
+ ` const record = value as Record<string, unknown>;`,
18517
+ ` const result = record.result && typeof record.result === 'object' && !Array.isArray(record.result) ? record.result as Record<string, unknown> : null;`,
18518
+ ` const message = typeof record.error === 'string' ? record.error : typeof result?.error === 'string' ? result.error : typeof result?.message === 'string' ? result.message : 'Tool returned an error-shaped result.';`,
18519
+ ` throw new Error(message);`,
18520
+ `}`,
18521
+ ``,
18529
18522
  `function __dlGeneratedCellError(value: unknown): boolean {`,
18530
18523
  ` if (typeof value === 'string') {`,
18531
18524
  ` const lower = value.trim().toLowerCase();`,
@@ -18916,37 +18909,6 @@ function helperSource() {
18916
18909
  ` return keys ? __dlProjectListRows(rows, keys, payload) : rows;`,
18917
18910
  `}`,
18918
18911
  ``,
18919
- `function __dlErrorMessage(error: unknown): string {`,
18920
- ` if (error instanceof Error && error.message) return error.message;`,
18921
- ` if (typeof error === 'string' && error.trim()) return error.trim();`,
18922
- ` return 'Extractor failed';`,
18923
- `}`,
18924
- ``,
18925
- `function __dlErrorDetail(error: unknown): string {`,
18926
- ` const message = __dlErrorMessage(error);`,
18927
- ` if (!__dlRecord(error)) return message;`,
18928
- ` try {`,
18929
- ` return message + ' ' + JSON.stringify(error);`,
18930
- ` } catch {`,
18931
- ` return message;`,
18932
- ` }`,
18933
- `}`,
18934
- ``,
18935
- `function __dlRecoverableWaterfallToolError(error: unknown): boolean {`,
18936
- ` const detail = __dlErrorDetail(error).toLowerCase();`,
18937
- ` return /\\b5\\d\\d\\b/.test(detail) || detail.includes('upstream_failure') || detail.includes('"error_category":"upstream"') || (detail.includes('"failure_origin":"provider"') && detail.includes('"status":5')) || detail.includes('bad gateway') || detail.includes('gateway time-out') || detail.includes('gateway timeout') || detail.includes('service unavailable');`,
18938
- `}`,
18939
- ``,
18940
- `function __dlWaterfallToolFailure(error: unknown, tool?: string): unknown {`,
18941
- ` if (tool === 'run_javascript' || __dlRecoverableWaterfallToolError(error)) return __dlExtractorFailure(error);`,
18942
- ` throw error;`,
18943
- `}`,
18944
- ``,
18945
- `function __dlExtractorFailure(error: unknown): unknown {`,
18946
- ` const message = __dlErrorMessage(error);`,
18947
- ` return { matched_result: null, result: { error: message, message } };`,
18948
- `}`,
18949
- ``,
18950
18912
  `function __dlExtract(alias: string, result: unknown, row: Record<string, unknown>, extractor: ((args: __DlExtractorHelpers) => unknown) | null, legacyEnvelope = false): unknown {`,
18951
18913
  ` const raw = __dlRawToolOutput(result);`,
18952
18914
  ` if (!extractor) return raw;`,
@@ -18987,12 +18949,8 @@ function helperSource() {
18987
18949
  ` };`,
18988
18950
  ` const get = (path: string): unknown => __dlExtractedValue(result, path) ?? __dlFirstByPaths(raw, path);`,
18989
18951
  ` let resolved: unknown;`,
18990
- ` try {`,
18991
- ` const extracted = extractor({ row, result, data: raw, raw, pick, extract, extractList, target: pick, get });`,
18992
- ` resolved = typeof extracted === 'function' ? (extracted as (outputData: unknown) => unknown)(__dlLegacyOutputData(result, raw)) : extracted;`,
18993
- ` } catch (error) {`,
18994
- ` return __dlExtractorFailure(error);`,
18995
- ` }`,
18952
+ ` const extracted = extractor({ row, result, data: raw, raw, pick, extract, extractList, target: pick, get });`,
18953
+ ` resolved = typeof extracted === 'function' ? (extracted as (outputData: unknown) => unknown)(__dlLegacyOutputData(result, raw)) : extracted;`,
18996
18954
  ` if (resolved && typeof resolved === 'object' && !Array.isArray(resolved) && alias in (resolved as Record<string, unknown>)) {`,
18997
18955
  ` const aliasValue = (resolved as Record<string, unknown>)[alias];`,
18998
18956
  ` return legacyEnvelope && __dlMeaningful(aliasValue) ? __dlLegacyMatchedEnvelope(aliasValue, raw) : aliasValue;`,
@@ -19082,26 +19040,21 @@ function helperSource() {
19082
19040
  ` return result;`,
19083
19041
  `}`,
19084
19042
  ``,
19085
- `async function __dlRunCommand(input: { alias: string; callId: string; tool: string; payload: Record<string, unknown>; extract: ((args: __DlExtractorHelpers) => unknown) | null; runIf: ((row: Record<string, unknown>) => unknown) | null; row: Record<string, unknown>; stepCtx: { tools: { execute: (request: Record<string, unknown>) => Promise<unknown> } }; description?: string; force?: boolean; legacyEnvelope?: boolean; waterfallSoftFail?: boolean }): Promise<unknown> {`,
19043
+ `async function __dlRunCommand(input: { alias: string; callId: string; tool: string; payload: Record<string, unknown>; extract: ((args: __DlExtractorHelpers) => unknown) | null; runIf: ((row: Record<string, unknown>) => unknown) | null; row: Record<string, unknown>; stepCtx: { tools: { execute: (request: Record<string, unknown>) => Promise<unknown> } }; description?: string; force?: boolean; legacyEnvelope?: boolean }): Promise<unknown> {`,
19086
19044
  ` if (input.runIf) {`,
19087
19045
  ` const shouldRun = input.runIf(input.row);`,
19088
19046
  ` if (!shouldRun) return null;`,
19089
19047
  ` }`,
19090
19048
  ` const payload = __dlRuntimePayload(input.tool, __dlTemplate(input.payload, input.row) as Record<string, unknown>, input.row);`,
19091
19049
  ` if (__dlShouldSkipEmptyPayload(input.tool, payload)) return null;`,
19092
- ` let result: unknown;`,
19093
- ` try {`,
19094
- ` result = await input.stepCtx.tools.execute({`,
19095
- ` id: input.callId,`,
19096
- ` tool: input.tool,`,
19097
- ` input: payload,`,
19098
- ` ...(input.description ? { description: input.description } : {}),`,
19099
- ` ...(input.force ? { force: true } : {}),`,
19100
- ` });`,
19101
- ` } catch (error) {`,
19102
- ` if (input.waterfallSoftFail) return __dlWaterfallToolFailure(error, input.tool);`,
19103
- ` throw error;`,
19104
- ` }`,
19050
+ ` const result = await input.stepCtx.tools.execute({`,
19051
+ ` id: input.callId,`,
19052
+ ` tool: input.tool,`,
19053
+ ` input: payload,`,
19054
+ ` ...(input.description ? { description: input.description } : {}),`,
19055
+ ` ...(input.force ? { force: true } : {}),`,
19056
+ ` });`,
19057
+ ` __dlAssertSuccessfulToolResult(result);`,
19105
19058
  ` return __dlExtract(input.alias, result, input.row, input.extract, Boolean(input.legacyEnvelope));`,
19106
19059
  `}`
19107
19060
  ].join("\n");