deepline 0.1.181 → 0.1.183

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 (70) hide show
  1. package/dist/bundling-sources/apps/play-runner-workers/src/child-play-await.ts +203 -6
  2. package/dist/bundling-sources/apps/play-runner-workers/src/child-play-submit.ts +8 -1
  3. package/dist/bundling-sources/apps/play-runner-workers/src/coordinator-entry.ts +633 -107
  4. package/dist/bundling-sources/apps/play-runner-workers/src/dedup-do.ts +3 -2
  5. package/dist/bundling-sources/apps/play-runner-workers/src/entry.ts +1932 -1838
  6. package/dist/bundling-sources/apps/play-runner-workers/src/runtime/harness-receipt-store.ts +116 -0
  7. package/dist/bundling-sources/apps/play-runner-workers/src/runtime/map-chunk-plan.ts +542 -78
  8. package/dist/bundling-sources/apps/play-runner-workers/src/runtime/output-datasets.ts +124 -12
  9. package/dist/bundling-sources/apps/play-runner-workers/src/runtime/receipts.ts +292 -11
  10. package/dist/bundling-sources/apps/play-runner-workers/src/runtime/run-work-dispatcher.ts +519 -0
  11. package/dist/bundling-sources/apps/play-runner-workers/src/runtime/tool-dispatch.ts +2381 -0
  12. package/dist/bundling-sources/apps/play-runner-workers/src/runtime/tool-receipts.ts +18 -5
  13. package/dist/bundling-sources/apps/play-runner-workers/src/runtime/work-budget.ts +130 -0
  14. package/dist/bundling-sources/apps/play-runner-workers/src/runtime/worker-platform-budget.ts +39 -0
  15. package/dist/bundling-sources/apps/play-runner-workers/src/workflow-retry-state.ts +2 -0
  16. package/dist/bundling-sources/sdk/src/client.ts +48 -5
  17. package/dist/bundling-sources/sdk/src/http.ts +23 -8
  18. package/dist/bundling-sources/sdk/src/play.ts +200 -26
  19. package/dist/bundling-sources/sdk/src/plays/harness-stub.ts +56 -3
  20. package/dist/bundling-sources/sdk/src/release.ts +2 -2
  21. package/dist/bundling-sources/sdk/src/types.ts +2 -0
  22. package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +132 -10
  23. package/dist/bundling-sources/shared_libs/play-runtime/auth-scope-resolver.ts +92 -0
  24. package/dist/bundling-sources/shared_libs/play-runtime/batch-runtime.ts +4 -4
  25. package/dist/bundling-sources/shared_libs/play-runtime/batching-types.ts +8 -0
  26. package/dist/bundling-sources/shared_libs/play-runtime/child-run-id.ts +101 -0
  27. package/dist/bundling-sources/shared_libs/play-runtime/context.ts +1857 -314
  28. package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +106 -6
  29. package/dist/bundling-sources/shared_libs/play-runtime/dedup-backend.ts +0 -0
  30. package/dist/bundling-sources/shared_libs/play-runtime/default-batch-strategies.ts +1 -0
  31. package/dist/bundling-sources/shared_libs/play-runtime/durability-store.ts +4 -0
  32. package/dist/bundling-sources/shared_libs/play-runtime/durable-call-cache.ts +116 -16
  33. package/dist/bundling-sources/shared_libs/play-runtime/durable-receipt-execution.ts +186 -20
  34. package/dist/bundling-sources/shared_libs/play-runtime/dynamic-worker-version.ts +2 -0
  35. package/dist/bundling-sources/shared_libs/play-runtime/execution-ledger-store.ts +133 -0
  36. package/dist/bundling-sources/shared_libs/play-runtime/governor/app-runtime-rate-state-backend.ts +245 -0
  37. package/dist/bundling-sources/shared_libs/play-runtime/governor/governor.ts +5 -5
  38. package/dist/bundling-sources/shared_libs/play-runtime/governor/policy.ts +14 -0
  39. package/dist/bundling-sources/shared_libs/play-runtime/lease-policy.ts +52 -0
  40. package/dist/bundling-sources/shared_libs/play-runtime/protocol.ts +41 -0
  41. package/dist/bundling-sources/shared_libs/play-runtime/providers.ts +3 -2
  42. package/dist/bundling-sources/shared_libs/play-runtime/query-result-dataset.ts +120 -0
  43. package/dist/bundling-sources/shared_libs/play-runtime/receipt-sql.ts +124 -0
  44. package/dist/bundling-sources/shared_libs/play-runtime/receipt-status.ts +6 -2
  45. package/dist/bundling-sources/shared_libs/play-runtime/row-isolation.ts +48 -2
  46. package/dist/bundling-sources/shared_libs/play-runtime/run-ledger.ts +158 -15
  47. package/dist/bundling-sources/shared_libs/play-runtime/run-terminal-source.ts +45 -0
  48. package/dist/bundling-sources/shared_libs/play-runtime/runtime-actions.ts +9 -0
  49. package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +2037 -262
  50. package/dist/bundling-sources/shared_libs/play-runtime/runtime-contract.ts +42 -0
  51. package/dist/bundling-sources/shared_libs/play-runtime/runtime-sheet-attempt-state-machine.ts +183 -0
  52. package/dist/bundling-sources/shared_libs/play-runtime/runtime-sheet-errors.ts +88 -0
  53. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backend.ts +8 -1
  54. package/dist/bundling-sources/shared_libs/play-runtime/sheet-attempt-sql.ts +103 -0
  55. package/dist/bundling-sources/shared_libs/play-runtime/suspension.ts +19 -1
  56. package/dist/bundling-sources/shared_libs/play-runtime/test-runtime-seams.ts +343 -0
  57. package/dist/bundling-sources/shared_libs/play-runtime/tool-execute-retry-policy.ts +43 -0
  58. package/dist/bundling-sources/shared_libs/play-runtime/tool-http-errors.ts +11 -0
  59. package/dist/bundling-sources/shared_libs/play-runtime/tool-result.ts +139 -17
  60. package/dist/bundling-sources/shared_libs/play-runtime/work-receipt-state-machine.ts +437 -0
  61. package/dist/bundling-sources/shared_libs/play-runtime/work-receipts.ts +83 -6
  62. package/dist/bundling-sources/shared_libs/security/safe-outbound-fetch.ts +24 -17
  63. package/dist/cli/index.js +85 -23
  64. package/dist/cli/index.mjs +85 -23
  65. package/dist/index.d.mts +4 -1
  66. package/dist/index.d.ts +4 -1
  67. package/dist/index.js +274 -35
  68. package/dist/index.mjs +274 -35
  69. package/dist/plays/bundle-play-file.mjs +2 -2
  70. package/package.json +1 -1
package/dist/cli/index.js CHANGED
@@ -623,10 +623,10 @@ var SDK_RELEASE = {
623
623
  // 0.1.154 removes the short-lived generated enrich StepOptions recompute
624
624
  // fields shipped in 0.1.153.
625
625
  // 0.1.175 ships loud `deepline enrich` empty-waterfall reporting.
626
- version: "0.1.181",
626
+ version: "0.1.183",
627
627
  apiContract: "2026-06-dataset-handle-results-hard-cutover",
628
628
  supportPolicy: {
629
- latest: "0.1.181",
629
+ latest: "0.1.183",
630
630
  minimumSupported: "0.1.53",
631
631
  deprecatedBelow: "0.1.53",
632
632
  commandMinimumSupported: [
@@ -784,6 +784,10 @@ var WORKER_CALLBACK_URL_OVERRIDE_HEADER = "x-deepline-worker-callback-url";
784
784
  var RUNTIME_SCHEDULER_SCHEMA_OVERRIDE_HEADER = "x-deepline-runtime-scheduler-schema";
785
785
  var SYNTHETIC_RUN_HEADER = "x-deepline-synthetic-run";
786
786
 
787
+ // ../shared_libs/play-runtime/test-runtime-seams.ts
788
+ var PLAY_RUNTIME_TEST_FAULT_HEADER = "x-deepline-test-fault";
789
+ var MAX_RUNTIME_TEST_POLICY_MS = 10 * 6e4;
790
+
787
791
  // src/http.ts
788
792
  var MAX_DIAGNOSTIC_HEADER_LENGTH = 120;
789
793
  var COWORK_NETWORK_HINT = "Claude Cowork appears to be running Deepline in a network-restricted sandbox. In Claude Desktop, open Settings > Capabilities, turn on Allow network egress, and set Domain allowlist to All domains for the Cowork session.";
@@ -898,12 +902,9 @@ var HttpClient = class {
898
902
  headers["x-deepline-play-artifact-r2-prefix"] = playArtifactR2Prefix;
899
903
  }
900
904
  const coordinatorUrl = typeof process !== "undefined" ? process.env?.DEEPLINE_COORDINATOR_URL : void 0;
905
+ const coordinatorInternalToken = typeof process !== "undefined" ? process.env?.DEEPLINE_INTERNAL_TOKEN : void 0;
901
906
  if (coordinatorUrl?.trim()) {
902
907
  headers[COORDINATOR_URL_OVERRIDE_HEADER] = coordinatorUrl.trim();
903
- const coordinatorInternalToken = typeof process !== "undefined" ? process.env?.DEEPLINE_INTERNAL_TOKEN : void 0;
904
- if (coordinatorInternalToken?.trim()) {
905
- headers[COORDINATOR_INTERNAL_TOKEN_HEADER] = coordinatorInternalToken.trim();
906
- }
907
908
  }
908
909
  const workerCallbackUrl = typeof process !== "undefined" ? process.env?.DEEPLINE_WORKER_CALLBACK_URL : void 0;
909
910
  if (workerCallbackUrl?.trim()) {
@@ -917,6 +918,13 @@ var HttpClient = class {
917
918
  if (syntheticRun && syntheticRun.trim() && syntheticRun.trim() !== "0") {
918
919
  headers[SYNTHETIC_RUN_HEADER] = "1";
919
920
  }
921
+ const runtimeTestFault = typeof process !== "undefined" ? process.env?.DEEPLINE_TEST_RUNTIME_FAULT : void 0;
922
+ if (runtimeTestFault?.trim()) {
923
+ headers[PLAY_RUNTIME_TEST_FAULT_HEADER] = runtimeTestFault.trim();
924
+ }
925
+ if (coordinatorInternalToken?.trim() && (coordinatorUrl?.trim() || workerCallbackUrl?.trim() || runtimeTestFault?.trim())) {
926
+ headers[COORDINATOR_INTERNAL_TOKEN_HEADER] = coordinatorInternalToken.trim();
927
+ }
920
928
  return headers;
921
929
  }
922
930
  /**
@@ -1330,6 +1338,20 @@ function resolveTimingWindow(input2) {
1330
1338
  };
1331
1339
  }
1332
1340
 
1341
+ // ../shared_libs/play-runtime/run-terminal-source.ts
1342
+ var PLAY_RUN_LEDGER_EVENT_SOURCES = [
1343
+ "worker",
1344
+ "temporal",
1345
+ "convex",
1346
+ "coordinator",
1347
+ "system"
1348
+ ];
1349
+ function normalizePlayRunLedgerTerminalSource(value) {
1350
+ return PLAY_RUN_LEDGER_EVENT_SOURCES.includes(
1351
+ value
1352
+ ) ? value : null;
1353
+ }
1354
+
1333
1355
  // ../shared_libs/play-runtime/run-ledger.ts
1334
1356
  var LOG_TAIL_LIMIT = 100;
1335
1357
  function isRecord(value) {
@@ -1466,7 +1488,8 @@ function normalizePlayRunLedgerSnapshot(value, fallback) {
1466
1488
  ),
1467
1489
  resultTableNamespace: optionalNullableString(value.resultTableNamespace),
1468
1490
  resultSummary: value.resultSummary,
1469
- result: value.result
1491
+ result: value.result,
1492
+ terminalSource: normalizePlayRunLedgerTerminalSource(value.terminalSource)
1470
1493
  };
1471
1494
  }
1472
1495
  function normalizeStepStatus(value) {
@@ -2191,6 +2214,33 @@ function resolvePlayRunIntegrationMode(request) {
2191
2214
  request.integrationMode ?? process.env.DEEPLINE_EVAL_INTEGRATION_MODE
2192
2215
  );
2193
2216
  }
2217
+ function normalizeTestPolicyOverrides(value, source) {
2218
+ if (value && typeof value === "object" && !Array.isArray(value)) {
2219
+ return value;
2220
+ }
2221
+ throw new DeeplineError(
2222
+ `${source} must be a JSON object.`,
2223
+ void 0,
2224
+ "INVALID_TEST_POLICY_OVERRIDES"
2225
+ );
2226
+ }
2227
+ function parseEnvTestPolicyOverrides() {
2228
+ const raw = typeof process !== "undefined" ? process.env?.DEEPLINE_TEST_POLICY_OVERRIDES : void 0;
2229
+ const trimmed = raw?.trim();
2230
+ if (!trimmed) return void 0;
2231
+ let parsed;
2232
+ try {
2233
+ parsed = JSON.parse(trimmed);
2234
+ } catch (error) {
2235
+ const detail = error instanceof Error ? ` ${error.message}` : "";
2236
+ throw new DeeplineError(
2237
+ `DEEPLINE_TEST_POLICY_OVERRIDES must be valid JSON.${detail}`,
2238
+ void 0,
2239
+ "INVALID_TEST_POLICY_OVERRIDES"
2240
+ );
2241
+ }
2242
+ return normalizeTestPolicyOverrides(parsed, "DEEPLINE_TEST_POLICY_OVERRIDES");
2243
+ }
2194
2244
  function sleep2(ms) {
2195
2245
  return new Promise((resolve14) => setTimeout(resolve14, ms));
2196
2246
  }
@@ -2742,11 +2792,14 @@ var DeeplineClient = class {
2742
2792
  const headers = {
2743
2793
  [EXECUTE_RESPONSE_CONTRACT_HEADER]: V2_EXECUTE_RESPONSE_CONTRACT,
2744
2794
  ...options?.includeToolMetadata ? { [INCLUDE_TOOL_METADATA_HEADER]: "true" } : {},
2745
- ...options?.responseIntent ? { [EXECUTE_RESPONSE_INTENT_HEADER]: options.responseIntent } : {}
2795
+ [EXECUTE_RESPONSE_INTENT_HEADER]: options?.responseIntent ?? "raw"
2746
2796
  };
2747
2797
  return this.http.post(
2748
2798
  `/api/v2/integrations/${encodeURIComponent(toolId)}/execute`,
2749
- { payload: input2 },
2799
+ {
2800
+ payload: input2,
2801
+ ...options?.metadata ? { metadata: options.metadata } : {}
2802
+ },
2750
2803
  headers,
2751
2804
  {
2752
2805
  forbiddenAsApiError: true,
@@ -2830,6 +2883,7 @@ var DeeplineClient = class {
2830
2883
  */
2831
2884
  async startPlayRun(request) {
2832
2885
  const integrationMode = resolvePlayRunIntegrationMode(request);
2886
+ const testPolicyOverrides = request.testPolicyOverrides ?? parseEnvTestPolicyOverrides();
2833
2887
  const forceToolRefresh = request.forceToolRefresh === true;
2834
2888
  const response = await this.http.post(
2835
2889
  "/api/v2/plays/run",
@@ -2857,7 +2911,8 @@ var DeeplineClient = class {
2857
2911
  // defaults to workers_edge; tests and runtime probes that want a
2858
2912
  // different profile pass `request.profile` explicitly.
2859
2913
  ...request.profile ? { profile: request.profile } : {},
2860
- ...integrationMode ? { integrationMode } : {}
2914
+ ...integrationMode ? { integrationMode } : {},
2915
+ ...testPolicyOverrides ? { testPolicyOverrides } : {}
2861
2916
  }
2862
2917
  );
2863
2918
  return normalizePlayRunStart(response);
@@ -2875,6 +2930,7 @@ var DeeplineClient = class {
2875
2930
  */
2876
2931
  async *startPlayRunStream(request, options) {
2877
2932
  const integrationMode = resolvePlayRunIntegrationMode(request);
2933
+ const testPolicyOverrides = request.testPolicyOverrides ?? parseEnvTestPolicyOverrides();
2878
2934
  const forceToolRefresh = request.forceToolRefresh === true;
2879
2935
  const body = {
2880
2936
  ...request.name ? { name: request.name } : {},
@@ -2897,7 +2953,8 @@ var DeeplineClient = class {
2897
2953
  ...forceToolRefresh ? { forceToolRefresh: true } : {},
2898
2954
  ...typeof request.waitForCompletionMs === "number" ? { waitForCompletionMs: request.waitForCompletionMs } : {},
2899
2955
  ...request.profile ? { profile: request.profile } : {},
2900
- ...integrationMode ? { integrationMode } : {}
2956
+ ...integrationMode ? { integrationMode } : {},
2957
+ ...testPolicyOverrides ? { testPolicyOverrides } : {}
2901
2958
  };
2902
2959
  for await (const event of this.http.streamSse(
2903
2960
  "/api/v2/plays/run?stream=true",
@@ -9745,7 +9802,7 @@ async function traceCliSpan(phase, fields, run) {
9745
9802
  }
9746
9803
 
9747
9804
  // src/cli/play-check-hints.ts
9748
- var EXTRACTED_GETTER_ERROR_HINT = "Deepline hint: extractedValues/extractedLists .get() only works for declared Deepline getters listed by `deepline tools describe <tool> --json`. Use `toolExecutionResult.toolResponse.raw` for provider/tool-specific fields.";
9805
+ var EXTRACTED_GETTER_ERROR_HINT = "Deepline hint: extractedValues/extractedLists .get() only works for declared Deepline getters listed by `deepline tools describe <tool> --json`. Use `toolExecutionResult.toolResponse.raw` for provider/tool-specific scalar fields, and `toolExecutionResult.extractedLists.<name>.get()` for declared row/list outputs.";
9749
9806
  var DATASET_API_HINT = "Deepline hint: PlayDataset is lazy and durable. Use `.peek(n)` for a small preview or `.materialize()` when you intentionally need rows in memory; do not use `.rows`, `.toArray()`, or array methods directly on the dataset handle.";
9750
9807
  var ROW_PROPERTY_HINT = "Deepline hint: this row type only contains fields produced by the CSV/schema and previous map steps. Check source column casing and the exact output field names from earlier steps before scaling.";
9751
9808
  var TOOLS_EXECUTE_SIGNATURE_HINT = "Deepline hint: ctx.tools.execute requires a request object: `ctx.tools.execute({ id, tool, input, description })`. The stable `id` is required for logs, metadata, and receipt attachment; provider-call reuse is based on play, tool, semantic input, auth scope, provider action version, and cache policy.";
@@ -9889,9 +9946,9 @@ var PLAY_RUNTIME_PROVIDERS = {
9889
9946
  id: PLAY_RUNTIME_PROVIDER_IDS.hatchet,
9890
9947
  scheduler: PLAY_SCHEDULER_BACKENDS.hatchet,
9891
9948
  runner: PLAY_RUNTIME_BACKENDS.daytona,
9892
- dedup: PLAY_DEDUP_BACKENDS.durableObject,
9949
+ dedup: PLAY_DEDUP_BACKENDS.inMemory,
9893
9950
  artifactKind: PLAY_ARTIFACT_KINDS.cjsNode20,
9894
- label: "Hatchet scheduler + one-shot Daytona runner + DO dedup"
9951
+ label: "Hatchet scheduler + one-shot Daytona runner + receipt-backed in-process dedup"
9895
9952
  },
9896
9953
  local: {
9897
9954
  id: PLAY_RUNTIME_PROVIDER_IDS.local,
@@ -13716,7 +13773,7 @@ async function handleFileBackedRun(options) {
13716
13773
  ...Object.keys(runtimeInput).length > 0 ? { input: runtimeInput } : {},
13717
13774
  ...stagedFileInputs.inputFile ? { inputFile: stagedFileInputs.inputFile } : {},
13718
13775
  ...stagedFileInputs.packagedFiles.length ? { packagedFiles: stagedFileInputs.packagedFiles } : {},
13719
- ...options.force ? { force: true, forceToolRefresh: true } : {},
13776
+ ...options.force ? { force: true } : {},
13720
13777
  ...options.profile ? { profile: options.profile } : {},
13721
13778
  ...integrationMode ? { integrationMode } : {}
13722
13779
  };
@@ -13875,7 +13932,7 @@ async function handleNamedRun(options) {
13875
13932
  ...Object.keys(runtimeInput).length > 0 ? { input: runtimeInput } : {},
13876
13933
  ...stagedFileInputs.inputFile ? { inputFile: stagedFileInputs.inputFile } : {},
13877
13934
  ...stagedFileInputs.packagedFiles.length ? { packagedFiles: stagedFileInputs.packagedFiles } : {},
13878
- ...options.force ? { force: true, forceToolRefresh: true } : {},
13935
+ ...options.force ? { force: true } : {},
13879
13936
  ...options.profile ? { profile: options.profile } : {},
13880
13937
  ...integrationMode ? { integrationMode } : {}
13881
13938
  };
@@ -15062,7 +15119,7 @@ Notes:
15062
15119
  The play page opens in your browser as soon as the run starts; use --no-open
15063
15120
  to only print the URL.
15064
15121
  Concurrent runs for the same play are allowed.
15065
- --force bypasses durable dataset/tool cache reuse for this run.
15122
+ --force starts a fresh run graph without refreshing completed provider calls.
15066
15123
  It does not cancel active sibling runs.
15067
15124
  This command starts cloud work and may spend Deepline credits through tool calls.
15068
15125
 
@@ -15114,7 +15171,7 @@ Examples:
15114
15171
  ).option("--watch", "Compatibility alias; run waits by default").option("--wait", "Compatibility alias; run waits by default").option("--no-wait", "Start the run and return immediately").option(
15115
15172
  "--logs",
15116
15173
  "When output is non-interactive, stream play logs to stderr while waiting"
15117
- ).option("--tail-timeout-ms <ms>", "Timeout while watching the run stream").option("--force", "Bypass durable dataset/tool cache reuse").option("--no-open", "Print the play page URL without opening a browser").option("--json", "Emit JSON output").option("--full", "Debug only: with --json, emit the raw status payload").addHelpText(
15174
+ ).option("--tail-timeout-ms <ms>", "Timeout while watching the run stream").option("--force", "Start a fresh run graph").option("--no-open", "Print the play page URL without opening a browser").option("--json", "Emit JSON output").option("--full", "Debug only: with --json, emit the raw status payload").addHelpText(
15118
15175
  "afterAll",
15119
15176
  `
15120
15177
  Pass-through input flags:
@@ -22464,7 +22521,7 @@ async function readHiddenLine(prompt, streams = {}) {
22464
22521
  if (typeof inputStream.setRawMode === "function") {
22465
22522
  inputStream.setRawMode(previousRawMode);
22466
22523
  }
22467
- if (wasPaused) {
22524
+ if (wasPaused || inputStream === import_node_process.stdin) {
22468
22525
  inputStream.pause();
22469
22526
  }
22470
22527
  };
@@ -24026,7 +24083,7 @@ function toolMetadataJsonForDescribe(tool, requestedToolId) {
24026
24083
  runtimeOutputHelp: {
24027
24084
  contract: "tools describe shows declared schema and Deepline getters; it is not an observed provider response.",
24028
24085
  getterScope: "extractedValues/extractedLists .get() only works for declared Deepline getters listed in usageGuidance.toolExecutionResult.",
24029
- rawToolResponse: "Use toolExecutionResult.toolResponse.raw for provider/tool-specific fields, fields in outputSchema that are not declared getters, and debugging.",
24086
+ rawToolResponse: "Use toolExecutionResult.toolResponse.raw for provider/tool-specific scalar fields, fields in outputSchema that are not declared getters, and debugging. For declared row/list outputs, use extractedLists.<name>.get(); raw row arrays may be inline previews.",
24030
24087
  invalidGetterHint: "If TypeScript says an extractedValues/extractedLists property does not exist, that field is not a declared Deepline getter.",
24031
24088
  observeActualShape: observedOutputCommand,
24032
24089
  observedOutput: observedOutputCommand,
@@ -24052,9 +24109,9 @@ function usageGuidanceWithAccessDefaults(usageGuidance) {
24052
24109
  },
24053
24110
  rawToolResponse: {
24054
24111
  expression: "toolExecutionResult.toolResponse.raw",
24055
- meaning: "Raw tool response for provider/tool-specific fields and debugging."
24112
+ meaning: "Raw tool response for provider/tool-specific scalar fields and bounded debugging. Declared row/list outputs should use extractedLists.<name>.get(); raw row arrays may be inline previews."
24056
24113
  },
24057
- invalidGetterHint: "If TypeScript says an extractedValues/extractedLists property does not exist, that field is not a declared Deepline getter; use toolResponse.raw for provider/tool-specific fields.",
24114
+ invalidGetterHint: "If TypeScript says an extractedValues/extractedLists property does not exist, that field is not a declared Deepline getter; use toolResponse.raw for provider/tool-specific scalar fields, and extractedLists.<name>.get() for declared row/list outputs.",
24058
24115
  ...existingAccess
24059
24116
  }
24060
24117
  };
@@ -25597,10 +25654,15 @@ async function syncSdkSkillsIfNeeded(baseUrl, options = {}) {
25597
25654
  }
25598
25655
 
25599
25656
  // src/cli/commands/update.ts
25600
- var NPM_SDK_INSTALL_COMMON_FLAGS = ["--no-audit", "--no-fund"];
25657
+ var NPM_SDK_INSTALL_COMMON_FLAGS = [
25658
+ "--no-audit",
25659
+ "--no-fund",
25660
+ "--include=optional"
25661
+ ];
25601
25662
  var NPM_SDK_GLOBAL_INSTALL_FLAGS = [
25602
25663
  "--no-audit",
25603
25664
  "--no-fund",
25665
+ "--include=optional",
25604
25666
  "--allow-scripts=esbuild"
25605
25667
  ];
25606
25668
  var NPM_SDK_SIDECAR_PACKAGE_JSON = `${JSON.stringify(
@@ -608,10 +608,10 @@ var SDK_RELEASE = {
608
608
  // 0.1.154 removes the short-lived generated enrich StepOptions recompute
609
609
  // fields shipped in 0.1.153.
610
610
  // 0.1.175 ships loud `deepline enrich` empty-waterfall reporting.
611
- version: "0.1.181",
611
+ version: "0.1.183",
612
612
  apiContract: "2026-06-dataset-handle-results-hard-cutover",
613
613
  supportPolicy: {
614
- latest: "0.1.181",
614
+ latest: "0.1.183",
615
615
  minimumSupported: "0.1.53",
616
616
  deprecatedBelow: "0.1.53",
617
617
  commandMinimumSupported: [
@@ -769,6 +769,10 @@ var WORKER_CALLBACK_URL_OVERRIDE_HEADER = "x-deepline-worker-callback-url";
769
769
  var RUNTIME_SCHEDULER_SCHEMA_OVERRIDE_HEADER = "x-deepline-runtime-scheduler-schema";
770
770
  var SYNTHETIC_RUN_HEADER = "x-deepline-synthetic-run";
771
771
 
772
+ // ../shared_libs/play-runtime/test-runtime-seams.ts
773
+ var PLAY_RUNTIME_TEST_FAULT_HEADER = "x-deepline-test-fault";
774
+ var MAX_RUNTIME_TEST_POLICY_MS = 10 * 6e4;
775
+
772
776
  // src/http.ts
773
777
  var MAX_DIAGNOSTIC_HEADER_LENGTH = 120;
774
778
  var COWORK_NETWORK_HINT = "Claude Cowork appears to be running Deepline in a network-restricted sandbox. In Claude Desktop, open Settings > Capabilities, turn on Allow network egress, and set Domain allowlist to All domains for the Cowork session.";
@@ -883,12 +887,9 @@ var HttpClient = class {
883
887
  headers["x-deepline-play-artifact-r2-prefix"] = playArtifactR2Prefix;
884
888
  }
885
889
  const coordinatorUrl = typeof process !== "undefined" ? process.env?.DEEPLINE_COORDINATOR_URL : void 0;
890
+ const coordinatorInternalToken = typeof process !== "undefined" ? process.env?.DEEPLINE_INTERNAL_TOKEN : void 0;
886
891
  if (coordinatorUrl?.trim()) {
887
892
  headers[COORDINATOR_URL_OVERRIDE_HEADER] = coordinatorUrl.trim();
888
- const coordinatorInternalToken = typeof process !== "undefined" ? process.env?.DEEPLINE_INTERNAL_TOKEN : void 0;
889
- if (coordinatorInternalToken?.trim()) {
890
- headers[COORDINATOR_INTERNAL_TOKEN_HEADER] = coordinatorInternalToken.trim();
891
- }
892
893
  }
893
894
  const workerCallbackUrl = typeof process !== "undefined" ? process.env?.DEEPLINE_WORKER_CALLBACK_URL : void 0;
894
895
  if (workerCallbackUrl?.trim()) {
@@ -902,6 +903,13 @@ var HttpClient = class {
902
903
  if (syntheticRun && syntheticRun.trim() && syntheticRun.trim() !== "0") {
903
904
  headers[SYNTHETIC_RUN_HEADER] = "1";
904
905
  }
906
+ const runtimeTestFault = typeof process !== "undefined" ? process.env?.DEEPLINE_TEST_RUNTIME_FAULT : void 0;
907
+ if (runtimeTestFault?.trim()) {
908
+ headers[PLAY_RUNTIME_TEST_FAULT_HEADER] = runtimeTestFault.trim();
909
+ }
910
+ if (coordinatorInternalToken?.trim() && (coordinatorUrl?.trim() || workerCallbackUrl?.trim() || runtimeTestFault?.trim())) {
911
+ headers[COORDINATOR_INTERNAL_TOKEN_HEADER] = coordinatorInternalToken.trim();
912
+ }
905
913
  return headers;
906
914
  }
907
915
  /**
@@ -1315,6 +1323,20 @@ function resolveTimingWindow(input2) {
1315
1323
  };
1316
1324
  }
1317
1325
 
1326
+ // ../shared_libs/play-runtime/run-terminal-source.ts
1327
+ var PLAY_RUN_LEDGER_EVENT_SOURCES = [
1328
+ "worker",
1329
+ "temporal",
1330
+ "convex",
1331
+ "coordinator",
1332
+ "system"
1333
+ ];
1334
+ function normalizePlayRunLedgerTerminalSource(value) {
1335
+ return PLAY_RUN_LEDGER_EVENT_SOURCES.includes(
1336
+ value
1337
+ ) ? value : null;
1338
+ }
1339
+
1318
1340
  // ../shared_libs/play-runtime/run-ledger.ts
1319
1341
  var LOG_TAIL_LIMIT = 100;
1320
1342
  function isRecord(value) {
@@ -1451,7 +1473,8 @@ function normalizePlayRunLedgerSnapshot(value, fallback) {
1451
1473
  ),
1452
1474
  resultTableNamespace: optionalNullableString(value.resultTableNamespace),
1453
1475
  resultSummary: value.resultSummary,
1454
- result: value.result
1476
+ result: value.result,
1477
+ terminalSource: normalizePlayRunLedgerTerminalSource(value.terminalSource)
1455
1478
  };
1456
1479
  }
1457
1480
  function normalizeStepStatus(value) {
@@ -2176,6 +2199,33 @@ function resolvePlayRunIntegrationMode(request) {
2176
2199
  request.integrationMode ?? process.env.DEEPLINE_EVAL_INTEGRATION_MODE
2177
2200
  );
2178
2201
  }
2202
+ function normalizeTestPolicyOverrides(value, source) {
2203
+ if (value && typeof value === "object" && !Array.isArray(value)) {
2204
+ return value;
2205
+ }
2206
+ throw new DeeplineError(
2207
+ `${source} must be a JSON object.`,
2208
+ void 0,
2209
+ "INVALID_TEST_POLICY_OVERRIDES"
2210
+ );
2211
+ }
2212
+ function parseEnvTestPolicyOverrides() {
2213
+ const raw = typeof process !== "undefined" ? process.env?.DEEPLINE_TEST_POLICY_OVERRIDES : void 0;
2214
+ const trimmed = raw?.trim();
2215
+ if (!trimmed) return void 0;
2216
+ let parsed;
2217
+ try {
2218
+ parsed = JSON.parse(trimmed);
2219
+ } catch (error) {
2220
+ const detail = error instanceof Error ? ` ${error.message}` : "";
2221
+ throw new DeeplineError(
2222
+ `DEEPLINE_TEST_POLICY_OVERRIDES must be valid JSON.${detail}`,
2223
+ void 0,
2224
+ "INVALID_TEST_POLICY_OVERRIDES"
2225
+ );
2226
+ }
2227
+ return normalizeTestPolicyOverrides(parsed, "DEEPLINE_TEST_POLICY_OVERRIDES");
2228
+ }
2179
2229
  function sleep2(ms) {
2180
2230
  return new Promise((resolve14) => setTimeout(resolve14, ms));
2181
2231
  }
@@ -2727,11 +2777,14 @@ var DeeplineClient = class {
2727
2777
  const headers = {
2728
2778
  [EXECUTE_RESPONSE_CONTRACT_HEADER]: V2_EXECUTE_RESPONSE_CONTRACT,
2729
2779
  ...options?.includeToolMetadata ? { [INCLUDE_TOOL_METADATA_HEADER]: "true" } : {},
2730
- ...options?.responseIntent ? { [EXECUTE_RESPONSE_INTENT_HEADER]: options.responseIntent } : {}
2780
+ [EXECUTE_RESPONSE_INTENT_HEADER]: options?.responseIntent ?? "raw"
2731
2781
  };
2732
2782
  return this.http.post(
2733
2783
  `/api/v2/integrations/${encodeURIComponent(toolId)}/execute`,
2734
- { payload: input2 },
2784
+ {
2785
+ payload: input2,
2786
+ ...options?.metadata ? { metadata: options.metadata } : {}
2787
+ },
2735
2788
  headers,
2736
2789
  {
2737
2790
  forbiddenAsApiError: true,
@@ -2815,6 +2868,7 @@ var DeeplineClient = class {
2815
2868
  */
2816
2869
  async startPlayRun(request) {
2817
2870
  const integrationMode = resolvePlayRunIntegrationMode(request);
2871
+ const testPolicyOverrides = request.testPolicyOverrides ?? parseEnvTestPolicyOverrides();
2818
2872
  const forceToolRefresh = request.forceToolRefresh === true;
2819
2873
  const response = await this.http.post(
2820
2874
  "/api/v2/plays/run",
@@ -2842,7 +2896,8 @@ var DeeplineClient = class {
2842
2896
  // defaults to workers_edge; tests and runtime probes that want a
2843
2897
  // different profile pass `request.profile` explicitly.
2844
2898
  ...request.profile ? { profile: request.profile } : {},
2845
- ...integrationMode ? { integrationMode } : {}
2899
+ ...integrationMode ? { integrationMode } : {},
2900
+ ...testPolicyOverrides ? { testPolicyOverrides } : {}
2846
2901
  }
2847
2902
  );
2848
2903
  return normalizePlayRunStart(response);
@@ -2860,6 +2915,7 @@ var DeeplineClient = class {
2860
2915
  */
2861
2916
  async *startPlayRunStream(request, options) {
2862
2917
  const integrationMode = resolvePlayRunIntegrationMode(request);
2918
+ const testPolicyOverrides = request.testPolicyOverrides ?? parseEnvTestPolicyOverrides();
2863
2919
  const forceToolRefresh = request.forceToolRefresh === true;
2864
2920
  const body = {
2865
2921
  ...request.name ? { name: request.name } : {},
@@ -2882,7 +2938,8 @@ var DeeplineClient = class {
2882
2938
  ...forceToolRefresh ? { forceToolRefresh: true } : {},
2883
2939
  ...typeof request.waitForCompletionMs === "number" ? { waitForCompletionMs: request.waitForCompletionMs } : {},
2884
2940
  ...request.profile ? { profile: request.profile } : {},
2885
- ...integrationMode ? { integrationMode } : {}
2941
+ ...integrationMode ? { integrationMode } : {},
2942
+ ...testPolicyOverrides ? { testPolicyOverrides } : {}
2886
2943
  };
2887
2944
  for await (const event of this.http.streamSse(
2888
2945
  "/api/v2/plays/run?stream=true",
@@ -9772,7 +9829,7 @@ async function traceCliSpan(phase, fields, run) {
9772
9829
  }
9773
9830
 
9774
9831
  // src/cli/play-check-hints.ts
9775
- var EXTRACTED_GETTER_ERROR_HINT = "Deepline hint: extractedValues/extractedLists .get() only works for declared Deepline getters listed by `deepline tools describe <tool> --json`. Use `toolExecutionResult.toolResponse.raw` for provider/tool-specific fields.";
9832
+ var EXTRACTED_GETTER_ERROR_HINT = "Deepline hint: extractedValues/extractedLists .get() only works for declared Deepline getters listed by `deepline tools describe <tool> --json`. Use `toolExecutionResult.toolResponse.raw` for provider/tool-specific scalar fields, and `toolExecutionResult.extractedLists.<name>.get()` for declared row/list outputs.";
9776
9833
  var DATASET_API_HINT = "Deepline hint: PlayDataset is lazy and durable. Use `.peek(n)` for a small preview or `.materialize()` when you intentionally need rows in memory; do not use `.rows`, `.toArray()`, or array methods directly on the dataset handle.";
9777
9834
  var ROW_PROPERTY_HINT = "Deepline hint: this row type only contains fields produced by the CSV/schema and previous map steps. Check source column casing and the exact output field names from earlier steps before scaling.";
9778
9835
  var TOOLS_EXECUTE_SIGNATURE_HINT = "Deepline hint: ctx.tools.execute requires a request object: `ctx.tools.execute({ id, tool, input, description })`. The stable `id` is required for logs, metadata, and receipt attachment; provider-call reuse is based on play, tool, semantic input, auth scope, provider action version, and cache policy.";
@@ -9916,9 +9973,9 @@ var PLAY_RUNTIME_PROVIDERS = {
9916
9973
  id: PLAY_RUNTIME_PROVIDER_IDS.hatchet,
9917
9974
  scheduler: PLAY_SCHEDULER_BACKENDS.hatchet,
9918
9975
  runner: PLAY_RUNTIME_BACKENDS.daytona,
9919
- dedup: PLAY_DEDUP_BACKENDS.durableObject,
9976
+ dedup: PLAY_DEDUP_BACKENDS.inMemory,
9920
9977
  artifactKind: PLAY_ARTIFACT_KINDS.cjsNode20,
9921
- label: "Hatchet scheduler + one-shot Daytona runner + DO dedup"
9978
+ label: "Hatchet scheduler + one-shot Daytona runner + receipt-backed in-process dedup"
9922
9979
  },
9923
9980
  local: {
9924
9981
  id: PLAY_RUNTIME_PROVIDER_IDS.local,
@@ -13743,7 +13800,7 @@ async function handleFileBackedRun(options) {
13743
13800
  ...Object.keys(runtimeInput).length > 0 ? { input: runtimeInput } : {},
13744
13801
  ...stagedFileInputs.inputFile ? { inputFile: stagedFileInputs.inputFile } : {},
13745
13802
  ...stagedFileInputs.packagedFiles.length ? { packagedFiles: stagedFileInputs.packagedFiles } : {},
13746
- ...options.force ? { force: true, forceToolRefresh: true } : {},
13803
+ ...options.force ? { force: true } : {},
13747
13804
  ...options.profile ? { profile: options.profile } : {},
13748
13805
  ...integrationMode ? { integrationMode } : {}
13749
13806
  };
@@ -13902,7 +13959,7 @@ async function handleNamedRun(options) {
13902
13959
  ...Object.keys(runtimeInput).length > 0 ? { input: runtimeInput } : {},
13903
13960
  ...stagedFileInputs.inputFile ? { inputFile: stagedFileInputs.inputFile } : {},
13904
13961
  ...stagedFileInputs.packagedFiles.length ? { packagedFiles: stagedFileInputs.packagedFiles } : {},
13905
- ...options.force ? { force: true, forceToolRefresh: true } : {},
13962
+ ...options.force ? { force: true } : {},
13906
13963
  ...options.profile ? { profile: options.profile } : {},
13907
13964
  ...integrationMode ? { integrationMode } : {}
13908
13965
  };
@@ -15089,7 +15146,7 @@ Notes:
15089
15146
  The play page opens in your browser as soon as the run starts; use --no-open
15090
15147
  to only print the URL.
15091
15148
  Concurrent runs for the same play are allowed.
15092
- --force bypasses durable dataset/tool cache reuse for this run.
15149
+ --force starts a fresh run graph without refreshing completed provider calls.
15093
15150
  It does not cancel active sibling runs.
15094
15151
  This command starts cloud work and may spend Deepline credits through tool calls.
15095
15152
 
@@ -15141,7 +15198,7 @@ Examples:
15141
15198
  ).option("--watch", "Compatibility alias; run waits by default").option("--wait", "Compatibility alias; run waits by default").option("--no-wait", "Start the run and return immediately").option(
15142
15199
  "--logs",
15143
15200
  "When output is non-interactive, stream play logs to stderr while waiting"
15144
- ).option("--tail-timeout-ms <ms>", "Timeout while watching the run stream").option("--force", "Bypass durable dataset/tool cache reuse").option("--no-open", "Print the play page URL without opening a browser").option("--json", "Emit JSON output").option("--full", "Debug only: with --json, emit the raw status payload").addHelpText(
15201
+ ).option("--tail-timeout-ms <ms>", "Timeout while watching the run stream").option("--force", "Start a fresh run graph").option("--no-open", "Print the play page URL without opening a browser").option("--json", "Emit JSON output").option("--full", "Debug only: with --json, emit the raw status payload").addHelpText(
15145
15202
  "afterAll",
15146
15203
  `
15147
15204
  Pass-through input flags:
@@ -22498,7 +22555,7 @@ async function readHiddenLine(prompt, streams = {}) {
22498
22555
  if (typeof inputStream.setRawMode === "function") {
22499
22556
  inputStream.setRawMode(previousRawMode);
22500
22557
  }
22501
- if (wasPaused) {
22558
+ if (wasPaused || inputStream === input) {
22502
22559
  inputStream.pause();
22503
22560
  }
22504
22561
  };
@@ -24072,7 +24129,7 @@ function toolMetadataJsonForDescribe(tool, requestedToolId) {
24072
24129
  runtimeOutputHelp: {
24073
24130
  contract: "tools describe shows declared schema and Deepline getters; it is not an observed provider response.",
24074
24131
  getterScope: "extractedValues/extractedLists .get() only works for declared Deepline getters listed in usageGuidance.toolExecutionResult.",
24075
- rawToolResponse: "Use toolExecutionResult.toolResponse.raw for provider/tool-specific fields, fields in outputSchema that are not declared getters, and debugging.",
24132
+ rawToolResponse: "Use toolExecutionResult.toolResponse.raw for provider/tool-specific scalar fields, fields in outputSchema that are not declared getters, and debugging. For declared row/list outputs, use extractedLists.<name>.get(); raw row arrays may be inline previews.",
24076
24133
  invalidGetterHint: "If TypeScript says an extractedValues/extractedLists property does not exist, that field is not a declared Deepline getter.",
24077
24134
  observeActualShape: observedOutputCommand,
24078
24135
  observedOutput: observedOutputCommand,
@@ -24098,9 +24155,9 @@ function usageGuidanceWithAccessDefaults(usageGuidance) {
24098
24155
  },
24099
24156
  rawToolResponse: {
24100
24157
  expression: "toolExecutionResult.toolResponse.raw",
24101
- meaning: "Raw tool response for provider/tool-specific fields and debugging."
24158
+ meaning: "Raw tool response for provider/tool-specific scalar fields and bounded debugging. Declared row/list outputs should use extractedLists.<name>.get(); raw row arrays may be inline previews."
24102
24159
  },
24103
- invalidGetterHint: "If TypeScript says an extractedValues/extractedLists property does not exist, that field is not a declared Deepline getter; use toolResponse.raw for provider/tool-specific fields.",
24160
+ invalidGetterHint: "If TypeScript says an extractedValues/extractedLists property does not exist, that field is not a declared Deepline getter; use toolResponse.raw for provider/tool-specific scalar fields, and extractedLists.<name>.get() for declared row/list outputs.",
24104
24161
  ...existingAccess
24105
24162
  }
24106
24163
  };
@@ -25652,10 +25709,15 @@ async function syncSdkSkillsIfNeeded(baseUrl, options = {}) {
25652
25709
  }
25653
25710
 
25654
25711
  // src/cli/commands/update.ts
25655
- var NPM_SDK_INSTALL_COMMON_FLAGS = ["--no-audit", "--no-fund"];
25712
+ var NPM_SDK_INSTALL_COMMON_FLAGS = [
25713
+ "--no-audit",
25714
+ "--no-fund",
25715
+ "--include=optional"
25716
+ ];
25656
25717
  var NPM_SDK_GLOBAL_INSTALL_FLAGS = [
25657
25718
  "--no-audit",
25658
25719
  "--no-fund",
25720
+ "--include=optional",
25659
25721
  "--allow-scripts=esbuild"
25660
25722
  ];
25661
25723
  var NPM_SDK_SIDECAR_PACKAGE_JSON = `${JSON.stringify(
package/dist/index.d.mts CHANGED
@@ -952,6 +952,8 @@ interface StartPlayRunRequest {
952
952
  profile?: string;
953
953
  /** Optional per-run provider execution mode for eval/smoke runs. */
954
954
  integrationMode?: 'live' | 'eval_stub' | 'fixture';
955
+ /** Internal/dev-only runtime policy overrides for black-box durability tests. */
956
+ testPolicyOverrides?: Record<string, unknown>;
955
957
  }
956
958
  /**
957
959
  * Request body for making a play revision live.
@@ -1088,7 +1090,8 @@ type EnrichCompiledConfig = {
1088
1090
 
1089
1091
  type ExecuteToolRawOptions = {
1090
1092
  includeToolMetadata?: boolean;
1091
- responseIntent?: 'raw' | 'row_artifact';
1093
+ responseIntent?: 'dataset' | 'raw' | 'row_artifact';
1094
+ metadata?: Record<string, unknown>;
1092
1095
  timeout?: number;
1093
1096
  maxRetries?: number;
1094
1097
  };
package/dist/index.d.ts CHANGED
@@ -952,6 +952,8 @@ interface StartPlayRunRequest {
952
952
  profile?: string;
953
953
  /** Optional per-run provider execution mode for eval/smoke runs. */
954
954
  integrationMode?: 'live' | 'eval_stub' | 'fixture';
955
+ /** Internal/dev-only runtime policy overrides for black-box durability tests. */
956
+ testPolicyOverrides?: Record<string, unknown>;
955
957
  }
956
958
  /**
957
959
  * Request body for making a play revision live.
@@ -1088,7 +1090,8 @@ type EnrichCompiledConfig = {
1088
1090
 
1089
1091
  type ExecuteToolRawOptions = {
1090
1092
  includeToolMetadata?: boolean;
1091
- responseIntent?: 'raw' | 'row_artifact';
1093
+ responseIntent?: 'dataset' | 'raw' | 'row_artifact';
1094
+ metadata?: Record<string, unknown>;
1092
1095
  timeout?: number;
1093
1096
  maxRetries?: number;
1094
1097
  };