deepline 0.3.325 → 0.3.327

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 (128) hide show
  1. package/dist/bundling-sources/sdk/src/client.ts +23 -25
  2. package/dist/bundling-sources/sdk/src/compat.ts +11 -6
  3. package/dist/bundling-sources/sdk/src/db/query.ts +172 -0
  4. package/dist/bundling-sources/sdk/src/errors.ts +35 -0
  5. package/dist/bundling-sources/sdk/src/index.ts +13 -0
  6. package/dist/bundling-sources/sdk/src/play.ts +34 -31
  7. package/dist/bundling-sources/sdk/src/plays/authoring-graph-path.ts +13 -0
  8. package/dist/bundling-sources/sdk/src/plays/bundle-play-file.ts +2 -1
  9. package/dist/bundling-sources/sdk/src/plays/local-play-execution.ts +189 -0
  10. package/dist/bundling-sources/sdk/src/release.ts +1 -1
  11. package/dist/bundling-sources/sdk/src/tool-calls.ts +1 -1
  12. package/dist/bundling-sources/shared_libs/play-runtime/projection.ts +11 -0
  13. package/dist/bundling-sources/shared_libs/play-runtime/tool-result.ts +98 -11
  14. package/dist/cli/auth-67YOPQ6M.js +31 -0
  15. package/dist/cli/{auth-PIZESRPC.mjs → auth-EBBDOKNV.mjs} +4 -4
  16. package/dist/cli/{billing-DQKFCQV5.js → billing-6AAB7WPJ.js} +70 -70
  17. package/dist/cli/{billing-HSL6VTCM.mjs → billing-IM2QUFX4.mjs} +4 -4
  18. package/dist/cli/{chunk-WW4XZIVM.mjs → chunk-3ITDKXNC.mjs} +12 -9
  19. package/dist/cli/{chunk-K7FC5IUU.js → chunk-3MXRNPBN.js} +1 -1
  20. package/dist/cli/{chunk-DLW7X2UK.js → chunk-4TO56P22.js} +5928 -5730
  21. package/dist/cli/{chunk-MNKDSR2J.js → chunk-4ZARCCPT.js} +344 -254
  22. package/dist/cli/{chunk-PBNZXZCW.js → chunk-77RAV5XX.js} +48 -48
  23. package/dist/cli/{chunk-HUKWYHBG.js → chunk-7RCJDAJX.js} +2 -2
  24. package/dist/cli/{chunk-5TYU3UIS.mjs → chunk-A5SKM3GL.mjs} +1 -1
  25. package/dist/cli/{chunk-XNL3SEMC.js → chunk-AFNEQ43J.js} +8 -3
  26. package/dist/cli/{chunk-XSEMQ4II.js → chunk-AGH6YP2T.js} +2 -1
  27. package/dist/cli/chunk-AID3OYVJ.js +8 -0
  28. package/dist/cli/{chunk-YE3O2UHM.mjs → chunk-CCRQ2VGJ.mjs} +24 -1
  29. package/dist/cli/{chunk-HPTQEWCF.js → chunk-CISKBOXD.js} +70 -67
  30. package/dist/cli/{chunk-OPERWJR6.mjs → chunk-D6GD5AVN.mjs} +3 -3
  31. package/dist/cli/{chunk-6RMKHN7S.mjs → chunk-DCAU6PND.mjs} +4 -20
  32. package/dist/cli/{chunk-PVDQ55PS.js → chunk-DM3SHV6U.js} +29 -6
  33. package/dist/cli/{chunk-CV5GDCKN.js → chunk-DSDX6EUW.js} +29 -45
  34. package/dist/cli/{chunk-5FHU7TV4.mjs → chunk-DVV4FPS7.mjs} +2 -2
  35. package/dist/cli/{chunk-AQUNQJ5Y.mjs → chunk-F45425TB.mjs} +1 -1
  36. package/dist/cli/{chunk-NWBARG3F.mjs → chunk-G5774EFF.mjs} +1 -1
  37. package/dist/cli/chunk-GVESPYSY.mjs +234 -0
  38. package/dist/cli/{chunk-H5TJBRSC.mjs → chunk-HOWQKN6J.mjs} +98 -113
  39. package/dist/cli/{chunk-UYFWTIKF.js → chunk-HZZJR2GV.js} +26 -26
  40. package/dist/cli/{chunk-76VKBPOC.mjs → chunk-JOA6IKDE.mjs} +7 -2
  41. package/dist/cli/chunk-LVEDPCLJ.js +234 -0
  42. package/dist/cli/{chunk-KZNFYOHX.js → chunk-MOP6D7Z5.js} +6 -6
  43. package/dist/cli/{chunk-YXRPWMGN.js → chunk-NWIJLTRL.js} +147 -162
  44. package/dist/cli/chunk-OVDNJAJN.mjs +8 -0
  45. package/dist/cli/{chunk-XIVUB36F.mjs → chunk-QZAP5VOS.mjs} +104 -14
  46. package/dist/cli/{chunk-6VZDSBK6.mjs → chunk-REP2MYBI.mjs} +2 -2
  47. package/dist/cli/{chunk-PWV2M4LW.mjs → chunk-RSEVBSFE.mjs} +1 -1
  48. package/dist/cli/{chunk-OOPSX57I.js → chunk-TAGHNT5P.js} +6 -6
  49. package/dist/cli/{chunk-QQ2FG5W3.js → chunk-UROXKPND.js} +6 -6
  50. package/dist/cli/{chunk-7PZFGB7L.mjs → chunk-YIY74KUF.mjs} +2 -1
  51. package/dist/cli/{chunk-7MD453WV.mjs → chunk-ZOFARJWH.mjs} +5674 -5476
  52. package/dist/cli/client-7LZCG4VD.js +20 -0
  53. package/dist/cli/{client-57SR4KVM.mjs → client-JCMSACT4.mjs} +3 -3
  54. package/dist/cli/{csv-G2FRMOXL.mjs → csv-NPMWVM5D.mjs} +3 -3
  55. package/dist/cli/{csv-5DJSC6BD.js → csv-OILKDKUX.js} +12 -12
  56. package/dist/cli/{db-WWZEXM3N.mjs → db-AZUAOWPQ.mjs} +214 -137
  57. package/dist/cli/{db-NVO7P4VO.js → db-MNDRYYEX.js} +226 -149
  58. package/dist/cli/{describe-26OMF3A4.mjs → describe-KJWOHMKC.mjs} +12 -11
  59. package/dist/cli/{describe-M26LHDBQ.js → describe-QENLDLM2.js} +28 -27
  60. package/dist/cli/{executions-KI47LPKE.js → executions-P36UHBPG.js} +6 -6
  61. package/dist/cli/{executions-2LLHY3IL.mjs → executions-QZNQWF6F.mjs} +4 -4
  62. package/dist/cli/{feedback-2Y26C2BZ.js → feedback-K4UGTLFD.js} +6 -6
  63. package/dist/cli/{feedback-O26VL2OF.mjs → feedback-RQ6HSZSG.mjs} +3 -3
  64. package/dist/cli/{git-UVPGZN3K.mjs → git-PBRMCBMI.mjs} +4 -4
  65. package/dist/cli/git-RPFH3NJ2.js +23 -0
  66. package/dist/cli/index.js +105 -87
  67. package/dist/cli/index.mjs +65 -47
  68. package/dist/cli/{legacy-noops-IK5CH72U.mjs → legacy-noops-G7GWJ5UC.mjs} +4 -4
  69. package/dist/cli/{legacy-noops-H6Y3SEVB.js → legacy-noops-X74FM35Q.js} +7 -7
  70. package/dist/cli/{monitors-SFVVMAJT.mjs → monitors-KL2MCR57.mjs} +4 -4
  71. package/dist/cli/{monitors-JL6TTQCI.js → monitors-VKURX3YM.js} +85 -85
  72. package/dist/cli/{org-SSDONL57.mjs → org-DT53KTNW.mjs} +4 -4
  73. package/dist/cli/{org-OVMAZCQS.js → org-ZYXJDC44.js} +60 -60
  74. package/dist/cli/play-BUQV47E2.js +153 -0
  75. package/dist/cli/{play-X6NPACUO.mjs → play-WIJGQYTB.mjs} +11 -10
  76. package/dist/cli/{providers-E24JDWSR.js → providers-GRTW4TXX.js} +7 -7
  77. package/dist/cli/{providers-ONUBYYY4.mjs → providers-GYGKGS2J.mjs} +4 -4
  78. package/dist/cli/{quickstart-TB7C3DLG.js → quickstart-WB26543C.js} +5 -5
  79. package/dist/cli/{quickstart-B7NIXACV.mjs → quickstart-XF3M2M2S.mjs} +3 -3
  80. package/dist/cli/{search-N3QUIATW.mjs → search-ANJLTOF2.mjs} +5 -5
  81. package/dist/cli/search-CR2GZLCM.js +26 -0
  82. package/dist/cli/{secrets-CPCVFDYB.js → secrets-5KBUGMTK.js} +13 -13
  83. package/dist/cli/{secrets-V7Z4M67T.mjs → secrets-D6UR5CTW.mjs} +4 -4
  84. package/dist/cli/{sessions-E4FIZLQP.js → sessions-46PXFULL.js} +5 -5
  85. package/dist/cli/{sessions-PDOBKAKO.mjs → sessions-S7N4JEWK.mjs} +4 -4
  86. package/dist/cli/{settings-UVM2WDE4.js → settings-KMNBITSU.js} +74 -74
  87. package/dist/cli/{settings-QYHYHZDI.mjs → settings-V6U3SRTH.mjs} +7 -7
  88. package/dist/cli/{setup-3JFAXQLJ.js → setup-4K5FY6AU.js} +41 -41
  89. package/dist/cli/{setup-4RLAETDW.mjs → setup-OGITSLTN.mjs} +6 -6
  90. package/dist/cli/skills-4FP2MZKL.js +28 -0
  91. package/dist/cli/{skills-ZX2JSWOZ.mjs → skills-AXWAYPBY.mjs} +4 -4
  92. package/dist/cli/tools-7YZPH6WC.js +39 -0
  93. package/dist/cli/{tools-EGXCVIPJ.mjs → tools-LJCY6B23.mjs} +8 -7
  94. package/dist/cli/update-3VUOW6AP.js +28 -0
  95. package/dist/cli/{update-7FEKRQFE.mjs → update-DDR5XIUB.mjs} +6 -6
  96. package/dist/cli/{workflow-54VCKIG2.js → workflow-7CTCDWL3.js} +15 -15
  97. package/dist/cli/{workflow-7V7TTTKK.mjs → workflow-PRNCVANQ.mjs} +5 -5
  98. package/dist/{client-Bb4Jjzmj.d.ts → client-DHq8dJ56.d.ts} +39 -11
  99. package/dist/{client-COa-3GHK.d.mts → client-wiWPZhnI.d.mts} +39 -11
  100. package/dist/{compiler-manifest-CsnWj-AK.d.mts → compiler-manifest-9TkZ_ykI.d.mts} +711 -711
  101. package/dist/{compiler-manifest-CsnWj-AK.d.ts → compiler-manifest-9TkZ_ykI.d.ts} +711 -711
  102. package/dist/index-B-5_Xhud.d.mts +75 -0
  103. package/dist/index-ykksoEyR.d.ts +75 -0
  104. package/dist/index.d.mts +52 -13
  105. package/dist/index.d.ts +52 -13
  106. package/dist/index.js +142 -68
  107. package/dist/index.mjs +102 -28
  108. package/dist/install-integrity.json +91 -84
  109. package/dist/plays/bundle-play-file.d.mts +7 -75
  110. package/dist/plays/bundle-play-file.d.ts +7 -75
  111. package/dist/plays/bundle-play-file.mjs +1 -1
  112. package/dist/plays/run-request.d.mts +2 -2
  113. package/dist/plays/run-request.d.ts +2 -2
  114. package/dist/release.d.mts +1 -1
  115. package/dist/release.d.ts +1 -1
  116. package/dist/release.js +2 -2
  117. package/dist/release.mjs +1 -1
  118. package/package.json +1 -1
  119. package/dist/cli/auth-RXCD4GOV.js +0 -31
  120. package/dist/cli/chunk-OWJZUE3Y.mjs +0 -103
  121. package/dist/cli/chunk-SDK3ZA2C.js +0 -103
  122. package/dist/cli/client-562MULXK.js +0 -20
  123. package/dist/cli/git-KGPX5YPD.js +0 -23
  124. package/dist/cli/play-3DB4MSHN.js +0 -152
  125. package/dist/cli/search-NJ637YGQ.js +0 -26
  126. package/dist/cli/skills-BYRYG64R.js +0 -28
  127. package/dist/cli/tools-TAWOAY5X.js +0 -38
  128. package/dist/cli/update-H24GEBXM.js +0 -28
@@ -3,11 +3,14 @@ import {
3
3
  rateLimitSummary,
4
4
  schemaField,
5
5
  schemaFields
6
- } from "./chunk-76VKBPOC.mjs";
6
+ } from "./chunk-JOA6IKDE.mjs";
7
+ import {
8
+ shellQuote
9
+ } from "./chunk-OVDNJAJN.mjs";
7
10
  import {
8
11
  recentSearchRef,
9
12
  registerDeprecatedSearchCommand
10
- } from "./chunk-OPERWJR6.mjs";
13
+ } from "./chunk-D6GD5AVN.mjs";
11
14
  import {
12
15
  extractSummaryFields,
13
16
  projectRowOutput,
@@ -17,8 +20,9 @@ import {
17
20
  writeJsonOutputFile
18
21
  } from "./chunk-MIMASXO4.mjs";
19
22
  import {
20
- DeeplineClient
21
- } from "./chunk-XIVUB36F.mjs";
23
+ DeeplineClient,
24
+ validateExecutionIdempotencyKey
25
+ } from "./chunk-QZAP5VOS.mjs";
22
26
  import {
23
27
  beginToolExecuteCommand,
24
28
  getToolExecuteInvocationId,
@@ -26,18 +30,17 @@ import {
26
30
  runToolExecuteStage
27
31
  } from "./chunk-WXLOW623.mjs";
28
32
  import {
29
- argsWantJson,
30
33
  printCommandEnvelope,
31
34
  printCompactJson,
32
35
  printJson,
33
36
  printJsonError,
34
37
  renderCommandEnvelopeText,
35
38
  shouldEmitJson
36
- } from "./chunk-AQUNQJ5Y.mjs";
39
+ } from "./chunk-F45425TB.mjs";
37
40
  import {
38
41
  resolveConfig,
39
42
  sdkCliStateDirPath
40
- } from "./chunk-YE3O2UHM.mjs";
43
+ } from "./chunk-CCRQ2VGJ.mjs";
41
44
  import {
42
45
  DeeplineError
43
46
  } from "./chunk-NXGCO4JB.mjs";
@@ -1010,7 +1013,7 @@ Examples:
1010
1013
  process.exitCode = await narrowView();
1011
1014
  return;
1012
1015
  }
1013
- const { describeAnything } = await import("./describe-26OMF3A4.mjs");
1016
+ const { describeAnything } = await import("./describe-KJWOHMKC.mjs");
1014
1017
  process.exitCode = await describeAnything(
1015
1018
  toolId,
1016
1019
  { ...options, kinds: ["tools", "monitors"], fetchedTool: metadata },
@@ -1025,7 +1028,7 @@ Examples:
1025
1028
  { json: false }
1026
1029
  )
1027
1030
  );
1028
- tools.command("execute <toolId>").description("Execute a tool by id.").addHelpText(
1031
+ tools.command("execute <toolId>").alias("call").description("Execute a tool by id.").addHelpText(
1029
1032
  "after",
1030
1033
  `
1031
1034
  Notes:
@@ -1084,22 +1087,7 @@ Examples:
1084
1087
  "--recovery-timeout-ms <milliseconds>",
1085
1088
  "Maximum wait for a keyed execution to finish (default: 900000)"
1086
1089
  ).action(async (toolId, options) => {
1087
- const args = [
1088
- toolId,
1089
- ...options.param.flatMap((value) => ["--param", value]),
1090
- ...options.json === true ? ["--json"] : [],
1091
- ...typeof options.json === "string" ? ["--json", options.json] : [],
1092
- ...options.input ? ["--input", options.input] : [],
1093
- ...options.payload ? ["--payload", options.payload] : [],
1094
- ...options.timeout ? ["--timeout", options.timeout] : [],
1095
- ...options.outputFormat ? ["--output-format", options.outputFormat] : [],
1096
- ...options.out ? ["--out", options.out] : [],
1097
- ...options.preview === false ? ["--no-preview"] : [],
1098
- ...options.idempotencyKey ? ["--idempotency-key", options.idempotencyKey] : [],
1099
- ...options.recover ? ["--recover"] : [],
1100
- ...options.recoveryTimeoutMs ? ["--recovery-timeout-ms", options.recoveryTimeoutMs] : []
1101
- ];
1102
- process.exitCode = await executeTool(args);
1090
+ process.exitCode = await executeTool(toolId, options);
1103
1091
  });
1104
1092
  }
1105
1093
  async function getTool(toolId, options = {}, compatibilityMetadata) {
@@ -1808,6 +1796,7 @@ function printToolExamplesOnly(tool, requestedToolId) {
1808
1796
  console.log(`Use in a play:`);
1809
1797
  console.log("```ts");
1810
1798
  console.log("const result = await ctx.tools.execute({");
1799
+ console.log(" staleAfterSeconds: 0,");
1811
1800
  console.log(` id: '${stableStepIdForTool(toolId)}',`);
1812
1801
  console.log(` tool: '${toolId}',`);
1813
1802
  console.log(
@@ -2545,87 +2534,63 @@ function parseJsonObjectArgument(raw, flagName) {
2545
2534
  }
2546
2535
  return parsed;
2547
2536
  }
2548
- function parseExecuteOptions(args) {
2549
- const toolId = args[0];
2537
+ function toolExecuteJsonOption(value) {
2538
+ const legacyInput = typeof value === "string" ? value : void 0;
2539
+ return {
2540
+ requested: value === true || legacyInput !== void 0,
2541
+ legacyInput
2542
+ };
2543
+ }
2544
+ function parseExecuteOptions(toolId, options, output) {
2550
2545
  if (!toolId) {
2551
2546
  throw new Error(
2552
2547
  `Usage: deepline tools execute <toolId> [--param key=value ...] [--input '{"k":"v"}'] [--timeout <duration>] [--recover | --idempotency-key <key>] [--recovery-timeout-ms <ms>] [--out rows.csv] [--output-format auto|csv|csv_file|json|json_file] [--no-preview]`
2553
2548
  );
2554
2549
  }
2555
2550
  const params = {};
2556
- let outputFormat = "auto";
2557
- let noPreview = false;
2558
- let outPath = null;
2559
- let timeoutMs;
2560
- let idempotencyKey;
2561
- let recover = false;
2551
+ let outputFormat = output.requested ? "json" : "auto";
2562
2552
  let recoveryTimeoutMs;
2563
- for (let index = 1; index < args.length; index += 1) {
2564
- const arg = args[index];
2565
- if ((arg === "--param" || arg === "-p") && args[index + 1]) {
2566
- const kv = args[++index];
2567
- const eqIdx = kv.indexOf("=");
2568
- if (eqIdx > 0) params[kv.slice(0, eqIdx)] = kv.slice(eqIdx + 1);
2569
- continue;
2570
- }
2571
- if (arg === "--json") {
2572
- const next = args[index + 1];
2573
- outputFormat = "json";
2574
- if (next && !next.startsWith("--")) {
2575
- Object.assign(
2576
- params,
2577
- parseJsonObjectArgument(args[++index], "--json")
2578
- );
2579
- }
2580
- continue;
2581
- }
2582
- if ((arg === "--input" || arg === "--payload") && args[index + 1]) {
2583
- Object.assign(params, parseJsonObjectArgument(args[++index], arg));
2584
- continue;
2585
- }
2586
- if (arg === "--timeout" && args[index + 1]) {
2587
- timeoutMs = parseToolExecuteTimeout(args[++index]);
2588
- continue;
2589
- }
2590
- if (arg === "--output-format" && args[index + 1]) {
2591
- outputFormat = normalizeOutputFormat(args[++index]);
2592
- continue;
2593
- }
2594
- if (arg === "--no-preview") {
2595
- noPreview = true;
2596
- continue;
2597
- }
2598
- if (arg === "--idempotency-key" && args[index + 1]) {
2599
- idempotencyKey = args[++index];
2600
- continue;
2601
- }
2602
- if (arg === "--recover") {
2603
- recover = true;
2604
- continue;
2605
- }
2606
- if (arg === "--recovery-timeout-ms" && args[index + 1]) {
2607
- const parsed = Number(args[++index]);
2608
- if (!Number.isFinite(parsed) || parsed < 0) {
2609
- throw new Error("--recovery-timeout-ms must be a non-negative number.");
2610
- }
2611
- recoveryTimeoutMs = parsed;
2612
- continue;
2613
- }
2614
- if ((arg === "--out" || arg === "-o") && args[index + 1]) {
2615
- outPath = resolve(args[++index]);
2616
- continue;
2553
+ for (const kv of options.param ?? []) {
2554
+ const eqIdx = kv.indexOf("=");
2555
+ if (eqIdx > 0) params[kv.slice(0, eqIdx)] = kv.slice(eqIdx + 1);
2556
+ }
2557
+ if (output.legacyInput !== void 0) {
2558
+ Object.assign(
2559
+ params,
2560
+ parseJsonObjectArgument(output.legacyInput, "--json")
2561
+ );
2562
+ }
2563
+ if (options.input !== void 0) {
2564
+ Object.assign(params, parseJsonObjectArgument(options.input, "--input"));
2565
+ }
2566
+ if (options.payload !== void 0) {
2567
+ Object.assign(
2568
+ params,
2569
+ parseJsonObjectArgument(options.payload, "--payload")
2570
+ );
2571
+ }
2572
+ if (options.outputFormat !== void 0) {
2573
+ outputFormat = normalizeOutputFormat(options.outputFormat);
2574
+ }
2575
+ if (options.idempotencyKey !== void 0) {
2576
+ validateExecutionIdempotencyKey(options.idempotencyKey);
2577
+ }
2578
+ if (options.recoveryTimeoutMs !== void 0) {
2579
+ const parsed = Number(options.recoveryTimeoutMs);
2580
+ if (!options.recoveryTimeoutMs.trim() || !Number.isFinite(parsed) || parsed < 0) {
2581
+ throw new Error("--recovery-timeout-ms must be a non-negative number.");
2617
2582
  }
2618
- throw new Error(`Unknown option: ${arg}`);
2583
+ recoveryTimeoutMs = parsed;
2619
2584
  }
2620
2585
  return {
2621
2586
  toolId,
2622
2587
  params,
2623
2588
  outputFormat,
2624
- noPreview,
2625
- outPath,
2626
- timeoutMs,
2627
- idempotencyKey,
2628
- recover,
2589
+ noPreview: options.preview === false,
2590
+ outPath: options.out !== void 0 ? resolve(options.out) : null,
2591
+ timeoutMs: options.timeout !== void 0 ? parseToolExecuteTimeout(options.timeout) : void 0,
2592
+ idempotencyKey: options.idempotencyKey,
2593
+ recover: options.recover === true,
2629
2594
  recoveryTimeoutMs
2630
2595
  };
2631
2596
  }
@@ -2650,9 +2615,6 @@ function parseToolExecuteTimeout(raw) {
2650
2615
  function safeFileStem(value) {
2651
2616
  return value.trim().replace(/[^a-zA-Z0-9_-]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 64) || "tool";
2652
2617
  }
2653
- function shellQuote(value) {
2654
- return `'${value.replace(/'/g, `'\\''`)}'`;
2655
- }
2656
2618
  function powerShellQuote(value) {
2657
2619
  return `'${value.replace(/'/g, "''")}'`;
2658
2620
  }
@@ -2682,6 +2644,7 @@ function seedToolListScript(input) {
2682
2644
 
2683
2645
  export default definePlay(${JSON.stringify(playName)}, async (ctx) => {
2684
2646
  const result = await ctx.tools.execute({
2647
+ staleAfterSeconds: 0,
2685
2648
  id: ${JSON.stringify(input.toolId)},
2686
2649
  tool: ${JSON.stringify(input.toolId)},
2687
2650
  input: ${JSON.stringify(input.payload)},
@@ -2699,7 +2662,7 @@ export default definePlay(${JSON.stringify(playName)}, async (ctx) => {
2699
2662
  // Pass it to ctx.dataset; use rows.peek/count/materialize only for deliberate bounded inspection.
2700
2663
  // .withColumn('email_waterfall', (row, rowCtx) => rowCtx.runPlay('name_domain_email', 'name-and-domain-to-email', { first_name: String(row.first_name ?? ''), last_name: String(row.last_name ?? ''), domain: String(row.domain ?? '') }, { description: 'Resolve email.' }))
2701
2664
  // .withColumn('phone_waterfall', (row, rowCtx) => rowCtx.runPlay('contact_phone', 'contact-to-phone', { first_name: String(row.first_name ?? ''), last_name: String(row.last_name ?? ''), email: String(row.email ?? '') }, { description: 'Resolve phone.' }))
2702
- // ctx.dataset is idempotent by dataset key + row key; reruns reuse completed rows.
2665
+ // ctx.dataset is idempotent for completed rows during same-run recovery. New runs follow each call's freshness.
2703
2666
  const enrichedData = await ctx
2704
2667
  .dataset('enriched_data', rows)
2705
2668
  .run({
@@ -2724,6 +2687,12 @@ export default definePlay(${JSON.stringify(playName)}, async (ctx) => {
2724
2687
  windowsCopyCommand: `New-Item -ItemType Directory -Force -Path ${powerShellQuote(projectDir.replace(/\//g, "\\"))} | Out-Null; Copy-Item -LiteralPath ${powerShellQuote(scriptPath)} -Destination ${powerShellQuote(`${projectDir.replace(/\//g, "\\")}\\${fileName}`)}`
2725
2688
  };
2726
2689
  }
2690
+ function toolExecutionInspection(input) {
2691
+ return {
2692
+ inspect: input.idempotencyKey !== void 0 ? `deepline executions get --idempotency-key ${shellQuote(input.idempotencyKey)} --json` : `deepline describe ${shellQuote(input.toolId)} --json`,
2693
+ inspectDescription: input.idempotencyKey !== void 0 ? "Read the saved execution without starting new work." : "Read the tool contract; this unkeyed call has no saved recovery identity."
2694
+ };
2695
+ }
2727
2696
  function buildToolExecuteBaseEnvelope(input) {
2728
2697
  const envelope = commandEnvelopeFromRawResponse(input.rawResponse);
2729
2698
  const guidanceLines = toolExecuteExitCode(envelope) !== 0 || input.listExpected === true && !input.listConversion ? toolGuidanceLines(input.guidance) : [];
@@ -2749,7 +2718,7 @@ function buildToolExecuteBaseEnvelope(input) {
2749
2718
  "output"
2750
2719
  );
2751
2720
  const billingLookup = typeof envelope.job_id === "string" && envelope.job_id.trim() ? `deepline billing usage --request-id ${shellQuote(envelope.job_id)} --json` : null;
2752
- const inspectCommand = `deepline tools execute ${input.toolId} --input ${shellQuote(JSON.stringify(input.params))} --json`;
2721
+ const inspection = toolExecutionInspection(input);
2753
2722
  const actions = input.listConversion ? [
2754
2723
  {
2755
2724
  label: "next",
@@ -2767,6 +2736,7 @@ function buildToolExecuteBaseEnvelope(input) {
2767
2736
  if (billingLookup) {
2768
2737
  actions.push({ label: "charge", command: billingLookup });
2769
2738
  }
2739
+ actions.unshift({ label: "inspect", command: inspection.inspect });
2770
2740
  return {
2771
2741
  ...envelope,
2772
2742
  ...input.idempotencyKey ? { idempotency_key: input.idempotencyKey } : {},
@@ -2775,13 +2745,13 @@ function buildToolExecuteBaseEnvelope(input) {
2775
2745
  ...summaryEntries.length > 0 ? { summary: input.summary } : {},
2776
2746
  ...warningMessages.length > 0 ? { warnings: warningMessages } : {},
2777
2747
  next: {
2778
- inspect: inspectCommand,
2748
+ ...inspection,
2779
2749
  ...billingLookup ? { billing: billingLookup } : {},
2780
2750
  ...apifyRecovery ?? {},
2781
2751
  ...guidanceLines.length > 0 ? { guidance: input.guidance } : {},
2782
2752
  playDebugging: "When fixing a play getter, inspect returned dataset handles with runs get and export rows with runs export; do not copy CLI preview paths blindly.",
2783
2753
  ...input.listConversion ? {
2784
- expandToPlay: "Use stable map and step keys so reruns are idempotent: completed rows are reused, and only missing or stale work runs again.",
2754
+ expandToPlay: "Use stable map and step keys for recovery within a run. New runs follow each call's explicit freshness.",
2785
2755
  listSourcePath: input.listConversion.sourcePath ?? "auto-detected list in the CLI response preview"
2786
2756
  } : {}
2787
2757
  },
@@ -2832,6 +2802,7 @@ function buildToolExecuteRowArtifactEnvelope(input) {
2832
2802
  void _next;
2833
2803
  void _local;
2834
2804
  const billingLookup = isRecord(input.baseEnvelope.next) && typeof input.baseEnvelope.next.billing === "string" ? input.baseEnvelope.next.billing : null;
2805
+ const inspection = toolExecutionInspection(input);
2835
2806
  return {
2836
2807
  ...base,
2837
2808
  status: typeof base.status === "string" ? base.status : "completed",
@@ -2873,10 +2844,10 @@ function buildToolExecuteRowArtifactEnvelope(input) {
2873
2844
  windows_powershell: input.seededScript.windowsCopyCommand
2874
2845
  },
2875
2846
  next: {
2876
- inspect: "Re-run with --json only when you need the raw provider/tool response.",
2847
+ ...inspection,
2877
2848
  ...billingLookup ? { billing: billingLookup } : {},
2878
2849
  listSourcePath: input.rowOutput.sourcePath,
2879
- expandToPlay: "Use stable map and step keys so reruns are idempotent: completed rows are reused, and only missing or stale work runs again."
2850
+ expandToPlay: "Use stable map and step keys for recovery within a run. New runs follow each call's explicit freshness."
2880
2851
  },
2881
2852
  render: {
2882
2853
  sections: [
@@ -2893,10 +2864,11 @@ function buildToolExecuteRowArtifactEnvelope(input) {
2893
2864
  }
2894
2865
  ],
2895
2866
  actions: [
2867
+ { label: "inspect", command: inspection.inspect },
2896
2868
  ...billingLookup ? [{ label: "charge", command: billingLookup }] : [],
2897
2869
  {
2898
2870
  label: "next",
2899
- command: "Move the script into a project folder and expand it into a Deepline play. Use stable map and step keys so reruns are idempotent: completed rows are reused, and only missing or stale work runs again."
2871
+ command: "Move the script into a project folder and expand it into a Deepline play. Use stable map and step keys for same-run recovery; choose explicit freshness for calls in new runs."
2900
2872
  },
2901
2873
  {
2902
2874
  label: "macOS/Linux",
@@ -2910,17 +2882,19 @@ function buildToolExecuteRowArtifactEnvelope(input) {
2910
2882
  }
2911
2883
  };
2912
2884
  }
2913
- async function executeTool(args) {
2885
+ async function executeTool(toolId, options) {
2886
+ const output = toolExecuteJsonOption(options.json);
2887
+ const wantsJson = shouldEmitJson(output.requested);
2914
2888
  let parsed;
2915
2889
  try {
2916
- parsed = parseExecuteOptions(args);
2890
+ parsed = parseExecuteOptions(toolId, options, output);
2917
2891
  } catch (error) {
2918
- if (argsWantJson(args)) {
2892
+ if (wantsJson) {
2919
2893
  printJsonError(error);
2920
2894
  } else {
2921
2895
  console.error(error instanceof Error ? error.message : String(error));
2922
2896
  }
2923
- return 1;
2897
+ return error instanceof DeeplineError && error.code === "IDEMPOTENCY_KEY_INVALID" ? 2 : 1;
2924
2898
  }
2925
2899
  const cliInvocationId = getToolExecuteInvocationId() ?? beginToolExecuteCommand();
2926
2900
  const client = new DeeplineClient();
@@ -2937,7 +2911,7 @@ async function executeTool(args) {
2937
2911
  () => findPlayForToolId(client, parsed.toolId, cliInvocationId)
2938
2912
  );
2939
2913
  if (play) {
2940
- if (argsWantJson(args)) {
2914
+ if (wantsJson) {
2941
2915
  printJsonError(
2942
2916
  new Error(playAliasToolErrorMessage(parsed.toolId, play))
2943
2917
  );
@@ -2950,7 +2924,7 @@ async function executeTool(args) {
2950
2924
  throw error;
2951
2925
  }
2952
2926
  if (isPlayLikeTool(metadata)) {
2953
- if (argsWantJson(args)) {
2927
+ if (wantsJson) {
2954
2928
  printJsonError(
2955
2929
  new Error(
2956
2930
  playLikeToolExecuteErrorMessage(
@@ -2992,7 +2966,7 @@ async function executeTool(args) {
2992
2966
  }).catch((error) => {
2993
2967
  const guidanceLines = toolGuidanceLines(metadata.guidance);
2994
2968
  if (guidanceLines.length > 0) {
2995
- if (args.includes("--json") && error instanceof Error) {
2969
+ if (wantsJson && error instanceof Error) {
2996
2970
  Object.assign(error, { guidance: metadata.guidance });
2997
2971
  } else {
2998
2972
  console.error(
@@ -3049,10 +3023,14 @@ async function executeTool(args) {
3049
3023
  }
3050
3024
  if (!listConversion) {
3051
3025
  if (parsed.outPath) {
3026
+ const inspection = toolExecutionInspection({
3027
+ toolId: parsed.toolId,
3028
+ idempotencyKey
3029
+ });
3052
3030
  const error = new Error(
3053
- `${parsed.toolId} did not expose row-shaped output to write as CSV. Re-run with --json to inspect the raw tool response.`
3031
+ `${parsed.toolId} did not expose row-shaped output to write as CSV. ${inspection.inspectDescription} Run: ${inspection.inspect}`
3054
3032
  );
3055
- if (argsWantJson(args)) {
3033
+ if (wantsJson) {
3056
3034
  printJsonError(error);
3057
3035
  } else {
3058
3036
  console.error(error.message);
@@ -3090,6 +3068,8 @@ async function executeTool(args) {
3090
3068
  rows: listConversion.rows
3091
3069
  });
3092
3070
  const materializedEnvelope = buildToolExecuteRowArtifactEnvelope({
3071
+ toolId: parsed.toolId,
3072
+ idempotencyKey,
3093
3073
  baseEnvelope,
3094
3074
  csv,
3095
3075
  rowOutput,
@@ -3101,9 +3081,14 @@ async function executeTool(args) {
3101
3081
  return true;
3102
3082
  }
3103
3083
  if (parsed.outPath) {
3084
+ const inspection = toolExecutionInspection({
3085
+ toolId: parsed.toolId,
3086
+ idempotencyKey
3087
+ });
3104
3088
  printCommandEnvelope(materializedEnvelope, {
3105
- json: argsWantJson(args) || shouldEmitJson(),
3089
+ json: wantsJson,
3106
3090
  text: `Wrote ${csv.rowCount} row(s) to ${csv.path}
3091
+ inspect: ${inspection.inspect}
3107
3092
  `
3108
3093
  });
3109
3094
  return true;
@@ -2,10 +2,10 @@
2
2
 
3
3
 
4
4
 
5
- var _chunkQQ2FG5W3js = require('./chunk-QQ2FG5W3.js');
5
+ var _chunkUROXKPNDjs = require('./chunk-UROXKPND.js');
6
6
 
7
7
 
8
- var _chunkPVDQ55PSjs = require('./chunk-PVDQ55PS.js');
8
+ var _chunkDM3SHV6Ujs = require('./chunk-DM3SHV6U.js');
9
9
 
10
10
  // src/cli/commands/git.ts
11
11
  function shellQuote(value) {
@@ -32,11 +32,11 @@ function renderDeployment(deployment) {
32
32
  return `${deployment.id} ${source} (${kind}) - ${deployment.status}${suffix}`;
33
33
  }
34
34
  async function handleList(options) {
35
- const { http } = _chunkQQ2FG5W3js.getAuthedHttpClient.call(void 0, );
35
+ const { http } = _chunkUROXKPNDjs.getAuthedHttpClient.call(void 0, );
36
36
  const payload = await http.get(
37
37
  `/api/v2/play-projects${options.all ? "?includeDisabled=1" : ""}`
38
38
  );
39
- _chunkQQ2FG5W3js.printCommandEnvelope.call(void 0,
39
+ _chunkUROXKPNDjs.printCommandEnvelope.call(void 0,
40
40
  {
41
41
  projects: payload.projects,
42
42
  count: payload.projects.length,
@@ -73,7 +73,7 @@ function describeInstallationStatus(installation) {
73
73
  }
74
74
  }
75
75
  async function handleStatus(options) {
76
- const { http } = _chunkQQ2FG5W3js.getAuthedHttpClient.call(void 0, );
76
+ const { http } = _chunkUROXKPNDjs.getAuthedHttpClient.call(void 0, );
77
77
  const payload = await http.get("/api/v2/github/installation");
78
78
  const installation = payload.installation;
79
79
  const others = (_nullishCoalesce(payload.installations, () => ( []))).filter(
@@ -136,7 +136,7 @@ async function handleStatus(options) {
136
136
  )
137
137
  );
138
138
  }
139
- _chunkQQ2FG5W3js.printCommandEnvelope.call(void 0,
139
+ _chunkUROXKPNDjs.printCommandEnvelope.call(void 0,
140
140
  {
141
141
  installation,
142
142
  installations: _nullishCoalesce(payload.installations, () => ( [])),
@@ -147,10 +147,10 @@ async function handleStatus(options) {
147
147
  );
148
148
  }
149
149
  async function handleRepos(options) {
150
- const { http } = _chunkQQ2FG5W3js.getAuthedHttpClient.call(void 0, );
150
+ const { http } = _chunkUROXKPNDjs.getAuthedHttpClient.call(void 0, );
151
151
  const query = options.installation ? `?installationId=${encodeURIComponent(options.installation)}` : "";
152
152
  const payload = await http.get(`/api/v2/github/repos${query}`);
153
- _chunkQQ2FG5W3js.printCommandEnvelope.call(void 0,
153
+ _chunkUROXKPNDjs.printCommandEnvelope.call(void 0,
154
154
  {
155
155
  installation: payload.installation,
156
156
  repositories: payload.repositories,
@@ -171,7 +171,7 @@ async function handleRepos(options) {
171
171
  }
172
172
  async function resolveRepoId(repo, installation) {
173
173
  if (/^\d+$/.test(repo)) return Number(repo);
174
- const { http } = _chunkQQ2FG5W3js.getAuthedHttpClient.call(void 0, );
174
+ const { http } = _chunkUROXKPNDjs.getAuthedHttpClient.call(void 0, );
175
175
  const query = installation ? `?installationId=${encodeURIComponent(installation)}` : "";
176
176
  const payload = await http.get(
177
177
  `/api/v2/github/repos${query}`
@@ -188,7 +188,7 @@ async function resolveRepoId(repo, installation) {
188
188
  }
189
189
  async function handleLink(repo, options) {
190
190
  const repoId = await resolveRepoId(repo, options.installation);
191
- const { http } = _chunkQQ2FG5W3js.getAuthedHttpClient.call(void 0, );
191
+ const { http } = _chunkUROXKPNDjs.getAuthedHttpClient.call(void 0, );
192
192
  const payload = await http.post("/api/v2/play-projects", {
193
193
  repoId,
194
194
  ...options.installation !== void 0 ? { installationId: options.installation } : {},
@@ -197,7 +197,7 @@ async function handleLink(repo, options) {
197
197
  ...options.branch !== void 0 ? { productionBranch: options.branch } : {},
198
198
  ...options.prChecks !== void 0 ? { checkOnPullRequest: options.prChecks } : {}
199
199
  });
200
- _chunkQQ2FG5W3js.printCommandEnvelope.call(void 0,
200
+ _chunkUROXKPNDjs.printCommandEnvelope.call(void 0,
201
201
  {
202
202
  project: payload.project,
203
203
  render: {
@@ -220,11 +220,11 @@ async function handleLink(repo, options) {
220
220
  );
221
221
  }
222
222
  async function handleGet(id, options) {
223
- const { http } = _chunkQQ2FG5W3js.getAuthedHttpClient.call(void 0, );
223
+ const { http } = _chunkUROXKPNDjs.getAuthedHttpClient.call(void 0, );
224
224
  const payload = await http.get(
225
225
  `/api/v2/play-projects/${encodeURIComponent(id)}`
226
226
  );
227
- _chunkQQ2FG5W3js.printCommandEnvelope.call(void 0,
227
+ _chunkUROXKPNDjs.printCommandEnvelope.call(void 0,
228
228
  {
229
229
  project: payload.project,
230
230
  render: {
@@ -240,7 +240,7 @@ async function handleGet(id, options) {
240
240
  );
241
241
  }
242
242
  async function handleSet(id, options) {
243
- const { http } = _chunkQQ2FG5W3js.getAuthedHttpClient.call(void 0, );
243
+ const { http } = _chunkUROXKPNDjs.getAuthedHttpClient.call(void 0, );
244
244
  const payload = await http.patch(
245
245
  `/api/v2/play-projects/${encodeURIComponent(id)}`,
246
246
  {
@@ -251,7 +251,7 @@ async function handleSet(id, options) {
251
251
  ...options.disabled !== void 0 ? { disabled: options.disabled } : {}
252
252
  }
253
253
  );
254
- _chunkQQ2FG5W3js.printCommandEnvelope.call(void 0,
254
+ _chunkUROXKPNDjs.printCommandEnvelope.call(void 0,
255
255
  {
256
256
  project: payload.project,
257
257
  render: {
@@ -264,9 +264,9 @@ async function handleSet(id, options) {
264
264
  );
265
265
  }
266
266
  async function handleUnlink(id, options) {
267
- const { http } = _chunkQQ2FG5W3js.getAuthedHttpClient.call(void 0, );
267
+ const { http } = _chunkUROXKPNDjs.getAuthedHttpClient.call(void 0, );
268
268
  await http.delete(`/api/v2/play-projects/${encodeURIComponent(id)}`);
269
- _chunkQQ2FG5W3js.printCommandEnvelope.call(void 0,
269
+ _chunkUROXKPNDjs.printCommandEnvelope.call(void 0,
270
270
  {
271
271
  ok: true,
272
272
  id,
@@ -286,10 +286,10 @@ async function handleUnlink(id, options) {
286
286
  );
287
287
  }
288
288
  async function handleConnect(options) {
289
- const baseUrl = _chunkPVDQ55PSjs.resolveBaseUrlOnly.call(void 0, );
289
+ const baseUrl = _chunkDM3SHV6Ujs.resolveBaseUrlOnly.call(void 0, );
290
290
  const connectUrl = `${baseUrl.replace(/\/$/, "")}/api/v2/github/connect`;
291
- const opened = _chunkQQ2FG5W3js.openInBrowser.call(void 0, connectUrl);
292
- _chunkQQ2FG5W3js.printCommandEnvelope.call(void 0,
291
+ const opened = _chunkUROXKPNDjs.openInBrowser.call(void 0, connectUrl);
292
+ _chunkUROXKPNDjs.printCommandEnvelope.call(void 0,
293
293
  {
294
294
  connectUrl,
295
295
  browser: opened,
@@ -311,7 +311,7 @@ async function handleConnect(options) {
311
311
  );
312
312
  }
313
313
  async function handleDeploymentsList(options) {
314
- const { http } = _chunkQQ2FG5W3js.getAuthedHttpClient.call(void 0, );
314
+ const { http } = _chunkUROXKPNDjs.getAuthedHttpClient.call(void 0, );
315
315
  const query = new URLSearchParams();
316
316
  if (options.repo) query.set("projectId", options.repo);
317
317
  if (options.limit) query.set("limit", options.limit);
@@ -319,7 +319,7 @@ async function handleDeploymentsList(options) {
319
319
  const payload = await http.get(
320
320
  `/api/v2/deployments${suffix}`
321
321
  );
322
- _chunkQQ2FG5W3js.printCommandEnvelope.call(void 0,
322
+ _chunkUROXKPNDjs.printCommandEnvelope.call(void 0,
323
323
  {
324
324
  deployments: payload.deployments,
325
325
  count: payload.deployments.length,
@@ -363,12 +363,12 @@ function renderDeploymentMonitorLines(results) {
363
363
  ]);
364
364
  }
365
365
  async function handleDeploymentGet(id, options) {
366
- const { http } = _chunkQQ2FG5W3js.getAuthedHttpClient.call(void 0, );
366
+ const { http } = _chunkUROXKPNDjs.getAuthedHttpClient.call(void 0, );
367
367
  const payload = await http.get(`/api/v2/deployments/${encodeURIComponent(id)}`);
368
368
  const playLines = renderDeploymentPlayLines(payload.deployment.results);
369
369
  const monitorLines = renderDeploymentMonitorLines(payload.deployment.results);
370
370
  const repository = _nullishCoalesce(_optionalChain([payload, 'access', _10 => _10.project, 'optionalAccess', _11 => _11.repoFullName]), () => ( payload.deployment.repoFullName));
371
- _chunkQQ2FG5W3js.printCommandEnvelope.call(void 0,
371
+ _chunkUROXKPNDjs.printCommandEnvelope.call(void 0,
372
372
  {
373
373
  deployment: payload.deployment,
374
374
  project: payload.project,
@@ -387,9 +387,9 @@ async function handleDeploymentGet(id, options) {
387
387
  );
388
388
  }
389
389
  async function handleDeploymentCancel(id, options) {
390
- const { http } = _chunkQQ2FG5W3js.getAuthedHttpClient.call(void 0, );
390
+ const { http } = _chunkUROXKPNDjs.getAuthedHttpClient.call(void 0, );
391
391
  const payload = await http.post(`/api/v2/deployments/${encodeURIComponent(id)}/cancel`, {});
392
- _chunkQQ2FG5W3js.printCommandEnvelope.call(void 0,
392
+ _chunkUROXKPNDjs.printCommandEnvelope.call(void 0,
393
393
  {
394
394
  cancelled: payload.cancelled,
395
395
  deployment: payload.deployment,
@@ -1,3 +1,7 @@
1
+ import {
2
+ shellQuote
3
+ } from "./chunk-OVDNJAJN.mjs";
4
+
1
5
  // src/cli/described.ts
2
6
  var SHAPE = "{}";
3
7
  var SCHEMA_LINE_LIMIT = 100;
@@ -288,9 +292,10 @@ function examples(described, options) {
288
292
  if (runner.via === "monitor") return { cli: runner.deploy, play: null };
289
293
  if (runner.via === "tool") {
290
294
  return {
291
- cli: `deepline tools execute ${runner.toolId} --input '${input}'`,
295
+ cli: `deepline tools execute ${runner.toolId} --input ${shellQuote(input)}`,
292
296
  play: [
293
297
  "const result = await ctx.tools.execute({",
298
+ " staleAfterSeconds: 0,",
294
299
  ` id: '${safeIdentifier(runner.toolId)}',`,
295
300
  ` tool: '${runner.toolId}',`,
296
301
  ` input: ${input},`,
@@ -300,7 +305,7 @@ function examples(described, options) {
300
305
  };
301
306
  }
302
307
  return {
303
- cli: runner.cli ?? `deepline plays run ${runner.reference} --input '${input}'`,
308
+ cli: runner.cli ?? `deepline plays run ${runner.reference} --input ${shellQuote(input)}`,
304
309
  play: [
305
310
  `const output = await ctx.runPlay('${safeIdentifier(runner.reference.replace(/^.*\//, ""))}', '${runner.reference}', ${input});`,
306
311
  ...reads((field) => `output.${field.name}`)