deepline 0.3.305 → 0.3.307

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 (99) hide show
  1. package/dist/bundling-sources/sdk/src/cli-invocation-id.ts +14 -0
  2. package/dist/bundling-sources/sdk/src/client.ts +24 -1
  3. package/dist/bundling-sources/sdk/src/http.ts +11 -0
  4. package/dist/bundling-sources/sdk/src/release.ts +1 -1
  5. package/dist/bundling-sources/sdk/src/tool-calls.ts +19 -1
  6. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-shared.ts +10 -5
  7. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +4 -1
  8. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-event-search.ts +125 -19
  9. package/dist/cli/{auth-XMYFUM5L.mjs → auth-AJPTFFC7.mjs} +4 -4
  10. package/dist/cli/auth-TUQTQIH4.js +31 -0
  11. package/dist/cli/{billing-RXT6NYAU.mjs → billing-LPDYJLIL.mjs} +4 -4
  12. package/dist/cli/{billing-NDUDRJ7T.js → billing-SPBWUEOS.js} +70 -70
  13. package/dist/cli/chunk-2IKIG333.js +65 -0
  14. package/dist/cli/{chunk-E4YSOJ2H.js → chunk-76MFV3AC.js} +2 -2
  15. package/dist/cli/{chunk-AEMR2R5H.mjs → chunk-7ONALPWY.mjs} +4 -4
  16. package/dist/cli/{chunk-B7PAZBJX.js → chunk-AKE6ZFIJ.js} +10 -4
  17. package/dist/cli/{chunk-TGOAQTY3.mjs → chunk-BDFVIOLY.mjs} +3 -3
  18. package/dist/cli/{chunk-QFSISXKO.mjs → chunk-D55NIPGU.mjs} +1 -1
  19. package/dist/cli/{chunk-XZD3NYOL.js → chunk-DF3XJ2V2.js} +48 -48
  20. package/dist/cli/{chunk-44GHROVJ.mjs → chunk-G4SSYZND.mjs} +1 -1
  21. package/dist/cli/{chunk-DY72E7K2.js → chunk-GUIQWUCB.js} +6 -6
  22. package/dist/cli/{chunk-5UZQ75HD.js → chunk-HWCB5MHF.js} +60 -60
  23. package/dist/cli/{chunk-HELHRPU6.mjs → chunk-ILOCS73R.mjs} +2 -2
  24. package/dist/cli/{chunk-LUBEGHJC.js → chunk-IVXD2KA2.js} +15 -15
  25. package/dist/cli/{chunk-COMHSM6F.js → chunk-JNHXSZPB.js} +6 -6
  26. package/dist/cli/{chunk-ZQOFBLJN.js → chunk-K2CQ2RBJ.js} +6 -6
  27. package/dist/cli/{chunk-KNHD6J3X.js → chunk-KCHBE2J3.js} +275 -239
  28. package/dist/cli/{chunk-6C4SD4U3.mjs → chunk-MPVXXDWH.mjs} +7 -1
  29. package/dist/cli/{chunk-DNSTXIU4.js → chunk-MZQP7CIL.js} +1 -1
  30. package/dist/cli/{chunk-LYPASDJJ.mjs → chunk-O4OESDIN.mjs} +1 -1
  31. package/dist/cli/{chunk-KNK42P4M.mjs → chunk-QACDLYNO.mjs} +1 -1
  32. package/dist/cli/{chunk-445RPDOQ.mjs → chunk-RXYYANYP.mjs} +5 -5
  33. package/dist/cli/{chunk-S3HPQWZ3.mjs → chunk-TLTKAJ6S.mjs} +44 -8
  34. package/dist/cli/chunk-UABLQKTZ.mjs +65 -0
  35. package/dist/cli/{chunk-SCX2AZFY.mjs → chunk-ZGICKTW7.mjs} +2 -2
  36. package/dist/cli/{chunk-UWDFJXBQ.js → chunk-ZIF6JOOI.js} +26 -26
  37. package/dist/cli/{client-WOHHEX5X.mjs → client-7ZL4ROII.mjs} +3 -3
  38. package/dist/cli/client-S3MIFPM2.js +20 -0
  39. package/dist/cli/{csv-WZ5BOOT7.js → csv-JUDFG7JV.js} +12 -12
  40. package/dist/cli/{csv-WNPLDGFR.mjs → csv-Y3LYCTGD.mjs} +3 -3
  41. package/dist/cli/{db-GBK4QSIU.js → db-5IXGEXNT.js} +20 -20
  42. package/dist/cli/{db-GCQJHGME.mjs → db-GCOJD2BD.mjs} +4 -4
  43. package/dist/cli/{executions-MSB6FRNL.mjs → executions-FIICTMSY.mjs} +4 -4
  44. package/dist/cli/{executions-BAS6T2BN.js → executions-LIEQKFT7.js} +6 -6
  45. package/dist/cli/{feedback-VREMIXAX.mjs → feedback-3OVAA3C7.mjs} +3 -3
  46. package/dist/cli/{feedback-UHOHIOPV.js → feedback-FAADYNAR.js} +6 -6
  47. package/dist/cli/{git-GQKD556H.mjs → git-ESMYCYJO.mjs} +4 -4
  48. package/dist/cli/git-GG6LWE2R.js +23 -0
  49. package/dist/cli/index.js +155 -121
  50. package/dist/cli/index.mjs +121 -87
  51. package/dist/cli/{legacy-noops-RI2ROZ6U.mjs → legacy-noops-KP5CPZRK.mjs} +4 -4
  52. package/dist/cli/{legacy-noops-PIL4KNVA.js → legacy-noops-PKI3RFZW.js} +7 -7
  53. package/dist/cli/{monitors-QHLEULAZ.mjs → monitors-A6KGGSBO.mjs} +4 -4
  54. package/dist/cli/{monitors-UVQLZDIO.js → monitors-KCFBLAFZ.js} +85 -85
  55. package/dist/cli/{org-BYWI4VI3.mjs → org-DHI24UOK.mjs} +4 -4
  56. package/dist/cli/{org-KXJJZOSK.js → org-WI6DEXZQ.js} +60 -60
  57. package/dist/cli/{play-WF7AJJ7J.mjs → play-2YXLQD24.mjs} +6 -6
  58. package/dist/cli/{play-3XR54PQY.js → play-4EUUN76H.js} +200 -200
  59. package/dist/cli/{providers-FG67H5N5.mjs → providers-2WZ6KHH2.mjs} +4 -4
  60. package/dist/cli/{providers-4FYRPS4E.js → providers-DWS3XIM6.js} +7 -7
  61. package/dist/cli/{quickstart-3YCFHVKY.js → quickstart-TDTDKM6F.js} +5 -5
  62. package/dist/cli/{quickstart-IBWIR4LX.mjs → quickstart-ZFZVG6UO.mjs} +3 -3
  63. package/dist/cli/{search-OZRXENTS.mjs → search-BBE2ZMCI.mjs} +5 -5
  64. package/dist/cli/{search-6PQ4QBMC.js → search-GMPXRQF4.js} +6 -6
  65. package/dist/cli/{secrets-S3GIROJA.mjs → secrets-JEJL3KIM.mjs} +4 -4
  66. package/dist/cli/{secrets-2JW5HCHH.js → secrets-SMBX4IE6.js} +13 -13
  67. package/dist/cli/{sessions-6HNVWH3C.mjs → sessions-AVU353UT.mjs} +4 -4
  68. package/dist/cli/{sessions-AQQ6WHMK.js → sessions-S6AWG747.js} +5 -5
  69. package/dist/cli/{settings-6FINI54L.mjs → settings-GY5CYRLF.mjs} +7 -7
  70. package/dist/cli/{settings-HSHA2FO5.js → settings-KBW4ROHC.js} +74 -74
  71. package/dist/cli/{setup-XHIBSXCC.mjs → setup-4CW3XGGX.mjs} +6 -6
  72. package/dist/cli/{setup-O7FZ5EUD.js → setup-WSVIDSEV.js} +41 -41
  73. package/dist/cli/skills-6AU3RRAD.js +28 -0
  74. package/dist/cli/{skills-ZFIIWR5G.mjs → skills-U3NXFSFK.mjs} +4 -4
  75. package/dist/cli/{tools-4B4NLVOJ.js → tools-KZKELW25.js} +120 -87
  76. package/dist/cli/{tools-WURPIECI.mjs → tools-XU6KLJZT.mjs} +76 -43
  77. package/dist/cli/update-LVXXQF4A.js +28 -0
  78. package/dist/cli/{update-2THOPAUS.mjs → update-RZLH46DR.mjs} +6 -6
  79. package/dist/cli/{workflow-XS5JSKED.js → workflow-GDOGDGTZ.js} +15 -15
  80. package/dist/cli/{workflow-S2G453ZX.mjs → workflow-ZQUKQI35.mjs} +5 -5
  81. package/dist/{client-BT11xxG8.d.mts → client-Dj8MAkDc.d.mts} +6 -1
  82. package/dist/{client-5Nsl0O0v.d.ts → client-DsrFGXJf.d.ts} +6 -1
  83. package/dist/index.d.mts +2 -2
  84. package/dist/index.d.ts +2 -2
  85. package/dist/index.js +6 -6
  86. package/dist/index.mjs +3 -3
  87. package/dist/install-integrity.json +73 -70
  88. package/dist/plays/run-request.d.mts +1 -1
  89. package/dist/plays/run-request.d.ts +1 -1
  90. package/dist/release.d.mts +1 -1
  91. package/dist/release.d.ts +1 -1
  92. package/dist/release.js +2 -2
  93. package/dist/release.mjs +1 -1
  94. package/package.json +1 -1
  95. package/dist/cli/auth-WRUUITRZ.js +0 -31
  96. package/dist/cli/client-KBAPBERE.js +0 -20
  97. package/dist/cli/git-6QYO4FQH.js +0 -23
  98. package/dist/cli/skills-3ASRSEF2.js +0 -28
  99. package/dist/cli/update-7ZPTMO6H.js +0 -28
@@ -1,7 +1,7 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
3
 
4
- var _chunkDY72E7K2js = require('./chunk-DY72E7K2.js');
4
+ var _chunkGUIQWUCBjs = require('./chunk-GUIQWUCB.js');
5
5
 
6
6
 
7
7
 
@@ -12,23 +12,28 @@ var _chunkDY72E7K2js = require('./chunk-DY72E7K2.js');
12
12
  var _chunkNXDRDJ4Kjs = require('./chunk-NXDRDJ4K.js');
13
13
 
14
14
 
15
- var _chunkKNHD6J3Xjs = require('./chunk-KNHD6J3X.js');
15
+ var _chunkKCHBE2J3js = require('./chunk-KCHBE2J3.js');
16
16
  require('./chunk-LA46MMTL.js');
17
17
 
18
18
 
19
19
 
20
20
 
21
+ var _chunk2IKIG333js = require('./chunk-2IKIG333.js');
21
22
 
22
23
 
23
24
 
24
25
 
25
- var _chunkCOMHSM6Fjs = require('./chunk-COMHSM6F.js');
26
26
 
27
27
 
28
28
 
29
- var _chunkB7PAZBJXjs = require('./chunk-B7PAZBJX.js');
29
+
30
+ var _chunkJNHXSZPBjs = require('./chunk-JNHXSZPB.js');
31
+
32
+
33
+
34
+ var _chunkAKE6ZFIJjs = require('./chunk-AKE6ZFIJ.js');
30
35
  require('./chunk-XNYIZMNQ.js');
31
- require('./chunk-DNSTXIU4.js');
36
+ require('./chunk-MZQP7CIL.js');
32
37
  require('./chunk-S6R3OX7B.js');
33
38
 
34
39
 
@@ -76,10 +81,10 @@ var ToolCallRecovery = class _ToolCallRecovery {
76
81
  }
77
82
  };
78
83
  function pendingToolExecutionPath(input) {
79
- const config = _chunkB7PAZBJXjs.resolveConfig.call(void 0, );
84
+ const config = _chunkAKE6ZFIJjs.resolveConfig.call(void 0, );
80
85
  const fingerprint = _crypto.createHash.call(void 0, "sha256").update(config.baseUrl).update("\0").update(_crypto.createHash.call(void 0, "sha256").update(config.apiKey).digest("hex")).update("\0").update(input.toolId).update("\0").update(_chunkNXDRDJ4Kjs.stableStringify.call(void 0, input.params)).update("\0").update(input.responseIntent).digest("hex");
81
86
  return _path.join.call(void 0,
82
- _chunkB7PAZBJXjs.sdkCliStateDirPath.call(void 0, config.baseUrl),
87
+ _chunkAKE6ZFIJjs.sdkCliStateDirPath.call(void 0, config.baseUrl),
83
88
  `pending-tool-execution-${fingerprint}.json`
84
89
  );
85
90
  }
@@ -511,12 +516,12 @@ function categoryEnumerationRender(summaries) {
511
516
  };
512
517
  }
513
518
  async function listToolCategories(emitJson, compact) {
514
- const client = new (0, _chunkKNHD6J3Xjs.DeeplineClient)();
519
+ const client = new (0, _chunkKCHBE2J3js.DeeplineClient)();
515
520
  const rawTools = await client.listTools({ compact });
516
521
  const items = rawTools.map(toListedTool);
517
522
  const summaries = aggregateCategorySummaries(rawTools);
518
523
  const outputItems = compact ? items.map(compactTool) : items;
519
- _chunkCOMHSM6Fjs.printCommandEnvelope.call(void 0,
524
+ _chunkJNHXSZPBjs.printCommandEnvelope.call(void 0,
520
525
  {
521
526
  tools: outputItems,
522
527
  count: outputItems.length,
@@ -535,7 +540,7 @@ function unknownCategoryError(category, summaries, emitJson) {
535
540
  const known = summaries.map((item) => item.name);
536
541
  const message = `Unknown tool category "${category}". Run \`deepline tools list\` to browse categories.`;
537
542
  if (emitJson) {
538
- _chunkCOMHSM6Fjs.printJson.call(void 0, {
543
+ _chunkJNHXSZPBjs.printJson.call(void 0, {
539
544
  ok: false,
540
545
  exitCode: 4,
541
546
  code: "TOOL_CATEGORY_NOT_FOUND",
@@ -549,13 +554,13 @@ function unknownCategoryError(category, summaries, emitJson) {
549
554
  const render = categoryEnumerationRender(summaries);
550
555
  console.error(message);
551
556
  console.error("");
552
- console.error(_chunkCOMHSM6Fjs.renderCommandEnvelopeText.call(void 0, { render }).trimEnd());
557
+ console.error(_chunkJNHXSZPBjs.renderCommandEnvelopeText.call(void 0, { render }).trimEnd());
553
558
  console.error("");
554
559
  console.error(`Valid categories: ${known.join(", ")}`);
555
560
  return 4;
556
561
  }
557
562
  async function listToolsInCategory(category, emitJson) {
558
- const client = new (0, _chunkKNHD6J3Xjs.DeeplineClient)();
563
+ const client = new (0, _chunkKCHBE2J3js.DeeplineClient)();
559
564
  const rawTools = await client.listTools({
560
565
  categories: category,
561
566
  compact: false
@@ -594,7 +599,7 @@ async function listToolsInCategory(category, emitJson) {
594
599
  }
595
600
  ]
596
601
  };
597
- _chunkCOMHSM6Fjs.printCommandEnvelope.call(void 0,
602
+ _chunkJNHXSZPBjs.printCommandEnvelope.call(void 0,
598
603
  {
599
604
  category,
600
605
  total: rows.length,
@@ -607,7 +612,7 @@ async function listToolsInCategory(category, emitJson) {
607
612
  return 0;
608
613
  }
609
614
  async function listToolsForCategoryFilter(requestedCategories, emitJson, compact) {
610
- const client = new (0, _chunkKNHD6J3Xjs.DeeplineClient)();
615
+ const client = new (0, _chunkKCHBE2J3js.DeeplineClient)();
611
616
  const items = (await client.listTools({
612
617
  categories: requestedCategories.join(","),
613
618
  compact
@@ -636,7 +641,7 @@ async function listToolsForCategoryFilter(requestedCategories, emitJson, compact
636
641
  ]
637
642
  };
638
643
  const outputItems = compact ? items.map(compactTool) : items;
639
- _chunkCOMHSM6Fjs.printCommandEnvelope.call(void 0,
644
+ _chunkJNHXSZPBjs.printCommandEnvelope.call(void 0,
640
645
  {
641
646
  tools: outputItems,
642
647
  count: outputItems.length,
@@ -655,13 +660,13 @@ async function listTools(category, options = {}) {
655
660
  const positional = _nullishCoalesce(_optionalChain([category, 'optionalAccess', _9 => _9.trim, 'call', _10 => _10()]), () => ( ""));
656
661
  const flagCategories = (_nullishCoalesce(options.categories, () => ( ""))).split(",").map((item) => item.trim()).filter(Boolean);
657
662
  const compact = options.compact !== false;
658
- const emitJson = options.json === true || _chunkCOMHSM6Fjs.shouldEmitJson.call(void 0, );
663
+ const emitJson = options.json === true || _chunkJNHXSZPBjs.shouldEmitJson.call(void 0, );
659
664
  if (positional && flagCategories.length > 0) {
660
665
  const flagIsSameSingle = flagCategories.length === 1 && flagCategories[0] === positional;
661
666
  if (!flagIsSameSingle) {
662
667
  const message = `Category "${positional}" and --categories ${flagCategories.join(",")} disagree. Pass one: deepline tools list ${positional}`;
663
668
  if (emitJson) {
664
- _chunkCOMHSM6Fjs.printJson.call(void 0, {
669
+ _chunkJNHXSZPBjs.printJson.call(void 0, {
665
670
  ok: false,
666
671
  exitCode: 2,
667
672
  code: "TOOL_LIST_CATEGORY_CONFLICT",
@@ -688,7 +693,7 @@ async function grepTools(queryInput, options = {}) {
688
693
  console.error("Usage: deepline tools grep <query> [--json]");
689
694
  return 1;
690
695
  }
691
- const client = new (0, _chunkKNHD6J3Xjs.DeeplineClient)();
696
+ const client = new (0, _chunkKCHBE2J3js.DeeplineClient)();
692
697
  const requestedCategories = options.categories ? options.categories.split(",").map((item) => item.trim()).filter(Boolean) : [];
693
698
  const mode = _nullishCoalesce(options.mode, () => ( "all"));
694
699
  const jsonOutput = options.json === true;
@@ -731,7 +736,7 @@ async function grepTools(queryInput, options = {}) {
731
736
  query,
732
737
  mode
733
738
  }) : null;
734
- _chunkCOMHSM6Fjs.printCommandEnvelope.call(void 0,
739
+ _chunkJNHXSZPBjs.printCommandEnvelope.call(void 0,
735
740
  {
736
741
  tools: outputTools,
737
742
  count: outputTools.length,
@@ -749,7 +754,7 @@ async function grepTools(queryInput, options = {}) {
749
754
  } : {},
750
755
  commandTemplates: TOOL_COMMAND_TEMPLATES
751
756
  },
752
- { json: options.json || _chunkCOMHSM6Fjs.shouldEmitJson.call(void 0, ) }
757
+ { json: options.json || _chunkJNHXSZPBjs.shouldEmitJson.call(void 0, ) }
753
758
  );
754
759
  return 0;
755
760
  }
@@ -777,12 +782,16 @@ function compactTool(tool) {
777
782
  function playIdentifiers(play) {
778
783
  return [play.name, play.reference, ..._nullishCoalesce(play.aliases, () => ( []))].filter((value) => Boolean(_optionalChain([value, 'optionalAccess', _11 => _11.trim, 'call', _12 => _12()]))).map((value) => value.trim());
779
784
  }
780
- async function findPlayForToolId(client, toolId) {
785
+ async function findPlayForToolId(client, toolId, cliInvocationId) {
781
786
  const requested = toolId.trim();
782
787
  if (!requested) {
783
788
  return null;
784
789
  }
785
- const plays = await client.searchPlays({ query: requested, compact: true });
790
+ const plays = await client.searchPlays({
791
+ query: requested,
792
+ compact: true,
793
+ ...cliInvocationId ? { cliInvocationId } : {}
794
+ });
786
795
  return _nullishCoalesce(plays.find((play) => playIdentifiers(play).includes(requested)), () => ( null));
787
796
  }
788
797
  function isMissingToolMetadataError(error) {
@@ -893,7 +902,7 @@ Examples:
893
902
  json: Boolean(options.json)
894
903
  });
895
904
  });
896
- _chunkDY72E7K2js.registerDeprecatedSearchCommand.call(void 0, tools, () => ["tools", "monitors"]);
905
+ _chunkGUIQWUCBjs.registerDeprecatedSearchCommand.call(void 0, tools, () => ["tools", "monitors"]);
897
906
  tools.command("grep <query>").description(
898
907
  "Literal grep over tool ids, descriptions, categories, and input fields."
899
908
  ).addHelpText(
@@ -1060,7 +1069,7 @@ async function getTool(toolId, options = {}) {
1060
1069
  console.error("Usage: deepline tools describe <toolId> [--json]");
1061
1070
  return 1;
1062
1071
  }
1063
- const client = new (0, _chunkKNHD6J3Xjs.DeeplineClient)();
1072
+ const client = new (0, _chunkKCHBE2J3js.DeeplineClient)();
1064
1073
  let tool;
1065
1074
  try {
1066
1075
  tool = await client.getTool(toolId);
@@ -1114,7 +1123,7 @@ async function getTool(toolId, options = {}) {
1114
1123
  const lines = toolPricingOnlyLines(tool, toolId);
1115
1124
  if (inferenceQuote)
1116
1125
  lines.push(...inferenceQuoteSummaryLines(inferenceQuote));
1117
- _chunkCOMHSM6Fjs.printCommandEnvelope.call(void 0,
1126
+ _chunkJNHXSZPBjs.printCommandEnvelope.call(void 0,
1118
1127
  {
1119
1128
  toolId: String(tool.toolId || toolId),
1120
1129
  cost: Capability.fromCatalogEntry(tool).describe().customerCost(),
@@ -1132,7 +1141,7 @@ async function getTool(toolId, options = {}) {
1132
1141
  }
1133
1142
  if ((options.schemaOnly || options.examplesOnly || options.gettersOnly) && !isMonitorTypeTool(tool) && !isPlayLikeTool(tool) && (options.json || options.contractJson)) {
1134
1143
  const contract = toolContractJsonForDescribe(tool, toolId);
1135
- _chunkCOMHSM6Fjs.printCompactJson.call(void 0, {
1144
+ _chunkJNHXSZPBjs.printCompactJson.call(void 0, {
1136
1145
  toolId: contract.toolId,
1137
1146
  ...options.schemaOnly ? {
1138
1147
  inputSchema: contract.inputSchema,
@@ -1155,7 +1164,7 @@ async function getTool(toolId, options = {}) {
1155
1164
  return 0;
1156
1165
  }
1157
1166
  if (options.contractJson) {
1158
- _chunkCOMHSM6Fjs.printCompactJson.call(void 0, {
1167
+ _chunkJNHXSZPBjs.printCompactJson.call(void 0, {
1159
1168
  ...toolContractJsonForDescribe(tool, toolId),
1160
1169
  ...modelDescription ? { modelOptions: modelDescription } : {},
1161
1170
  ...inferenceQuote ? { inferenceQuote } : {}
@@ -1164,7 +1173,7 @@ async function getTool(toolId, options = {}) {
1164
1173
  }
1165
1174
  const emitJson = options.json === true;
1166
1175
  if (emitJson) {
1167
- _chunkCOMHSM6Fjs.printCompactJson.call(void 0, {
1176
+ _chunkJNHXSZPBjs.printCompactJson.call(void 0, {
1168
1177
  ...toolMetadataJsonForDescribe(tool, toolId),
1169
1178
  ...modelDescription ? { modelOptions: modelDescription } : {},
1170
1179
  ...inferenceQuote ? { inferenceQuote } : {}
@@ -1195,8 +1204,8 @@ ${formatModelDescription(modelDescription)}`);
1195
1204
  if (inferenceQuote) printInferenceQuoteSummary(inferenceQuote);
1196
1205
  return 0;
1197
1206
  }
1198
- if (_chunkCOMHSM6Fjs.shouldEmitJson.call(void 0, )) {
1199
- _chunkCOMHSM6Fjs.printCompactJson.call(void 0, {
1207
+ if (_chunkJNHXSZPBjs.shouldEmitJson.call(void 0, )) {
1208
+ _chunkJNHXSZPBjs.printCompactJson.call(void 0, {
1200
1209
  ...toolContractJsonForDescribe(tool, toolId),
1201
1210
  ...modelDescription ? { modelOptions: modelDescription } : {},
1202
1211
  ...inferenceQuote ? { inferenceQuote } : {}
@@ -2750,23 +2759,30 @@ async function executeTool(args) {
2750
2759
  try {
2751
2760
  parsed = parseExecuteOptions(args);
2752
2761
  } catch (error) {
2753
- if (_chunkCOMHSM6Fjs.argsWantJson.call(void 0, args)) {
2754
- _chunkCOMHSM6Fjs.printJsonError.call(void 0, error);
2762
+ if (_chunkJNHXSZPBjs.argsWantJson.call(void 0, args)) {
2763
+ _chunkJNHXSZPBjs.printJsonError.call(void 0, error);
2755
2764
  } else {
2756
2765
  console.error(error instanceof Error ? error.message : String(error));
2757
2766
  }
2758
2767
  return 1;
2759
2768
  }
2760
- const client = new (0, _chunkKNHD6J3Xjs.DeeplineClient)();
2769
+ const cliInvocationId = _nullishCoalesce(_chunk2IKIG333js.getToolExecuteInvocationId.call(void 0, ), () => ( _chunk2IKIG333js.beginToolExecuteCommand.call(void 0, )));
2770
+ const client = new (0, _chunkKCHBE2J3js.DeeplineClient)();
2761
2771
  let metadata;
2762
2772
  try {
2763
- metadata = await client.getTool(parsed.toolId);
2773
+ metadata = await _chunk2IKIG333js.runToolExecuteStage.call(void 0,
2774
+ "tool metadata lookup",
2775
+ () => client.getTool(parsed.toolId, { cliInvocationId })
2776
+ );
2764
2777
  } catch (error) {
2765
2778
  if (isMissingToolMetadataError(error)) {
2766
- const play = await findPlayForToolId(client, parsed.toolId);
2779
+ const play = await _chunk2IKIG333js.runToolExecuteStage.call(void 0,
2780
+ "play alias lookup",
2781
+ () => findPlayForToolId(client, parsed.toolId, cliInvocationId)
2782
+ );
2767
2783
  if (play) {
2768
- if (_chunkCOMHSM6Fjs.argsWantJson.call(void 0, args)) {
2769
- _chunkCOMHSM6Fjs.printJsonError.call(void 0,
2784
+ if (_chunkJNHXSZPBjs.argsWantJson.call(void 0, args)) {
2785
+ _chunkJNHXSZPBjs.printJsonError.call(void 0,
2770
2786
  new Error(playAliasToolErrorMessage(parsed.toolId, play))
2771
2787
  );
2772
2788
  } else {
@@ -2778,8 +2794,8 @@ async function executeTool(args) {
2778
2794
  throw error;
2779
2795
  }
2780
2796
  if (isPlayLikeTool(metadata)) {
2781
- if (_chunkCOMHSM6Fjs.argsWantJson.call(void 0, args)) {
2782
- _chunkCOMHSM6Fjs.printJsonError.call(void 0,
2797
+ if (_chunkJNHXSZPBjs.argsWantJson.call(void 0, args)) {
2798
+ _chunkJNHXSZPBjs.printJsonError.call(void 0,
2783
2799
  new Error(
2784
2800
  playLikeToolExecuteErrorMessage(
2785
2801
  parsed.toolId,
@@ -2807,43 +2823,55 @@ async function executeTool(args) {
2807
2823
  if (idempotencyKey) {
2808
2824
  console.error(`Tool execution recovery key: ${idempotencyKey}`);
2809
2825
  }
2810
- const rawResponse = await client.executeTool(parsed.toolId, parsed.params, {
2811
- ...parsed.timeoutMs !== void 0 ? { timeout: parsed.timeoutMs } : {},
2812
- ..._optionalChain([metadata, 'access', _26 => _26.executionMetadata, 'optionalAccess', _27 => _27.retrySafeTransientHttp]) === true ? { maxRetries: 2, retryApiErrors: true } : {},
2813
- responseIntent,
2814
- ...idempotencyKey ? { idempotencyKey } : {},
2815
- ...parsed.recoveryTimeoutMs !== void 0 ? { recoveryTimeoutMs: parsed.recoveryTimeoutMs } : {},
2816
- searchRef: _chunkDY72E7K2js.recentSearchRef.call(void 0, )
2817
- }).catch((error) => {
2818
- const guidanceLines = toolGuidanceLines(metadata.guidance);
2819
- if (guidanceLines.length > 0) {
2820
- if (args.includes("--json") && error instanceof Error) {
2821
- Object.assign(error, { guidance: metadata.guidance });
2822
- } else {
2823
- console.error(
2824
- [`Guidance for ${parsed.toolId}:`, ...guidanceLines].join("\n")
2825
- );
2826
+ const rawResponse = await _chunk2IKIG333js.runToolExecuteStage.call(void 0,
2827
+ "execute request",
2828
+ () => client.executeTool(parsed.toolId, parsed.params, {
2829
+ ...parsed.timeoutMs !== void 0 ? { timeout: parsed.timeoutMs } : {},
2830
+ ..._optionalChain([metadata, 'access', _26 => _26.executionMetadata, 'optionalAccess', _27 => _27.retrySafeTransientHttp]) === true ? { maxRetries: 2, retryApiErrors: true } : {},
2831
+ responseIntent,
2832
+ ...idempotencyKey ? { idempotencyKey } : {},
2833
+ ...parsed.recoveryTimeoutMs !== void 0 ? { recoveryTimeoutMs: parsed.recoveryTimeoutMs } : {},
2834
+ searchRef: _chunkGUIQWUCBjs.recentSearchRef.call(void 0, ),
2835
+ cliInvocationId
2836
+ }).catch((error) => {
2837
+ const guidanceLines = toolGuidanceLines(metadata.guidance);
2838
+ if (guidanceLines.length > 0) {
2839
+ if (args.includes("--json") && error instanceof Error) {
2840
+ Object.assign(error, { guidance: metadata.guidance });
2841
+ } else {
2842
+ console.error(
2843
+ [`Guidance for ${parsed.toolId}:`, ...guidanceLines].join("\n")
2844
+ );
2845
+ }
2826
2846
  }
2847
+ throw error;
2848
+ })
2849
+ );
2850
+ const { listConversion, summary, baseEnvelope } = await _chunk2IKIG333js.runToolExecuteStage.call(void 0,
2851
+ "result formatting",
2852
+ () => {
2853
+ const listExtractorPaths = listExtractorPathsFromUsageGuidance(metadata);
2854
+ const listConversion2 = _chunkNXDRDJ4Kjs.tryConvertToList.call(void 0, rawResponse, {
2855
+ listExtractorPaths
2856
+ });
2857
+ const summary2 = _chunkNXDRDJ4Kjs.extractSummaryFields.call(void 0, rawResponse);
2858
+ const baseEnvelope2 = buildToolExecuteBaseEnvelope({
2859
+ toolId: parsed.toolId,
2860
+ params: parsed.params,
2861
+ ...idempotencyKey ? { idempotencyKey } : {},
2862
+ rawResponse,
2863
+ listConversion: listConversion2,
2864
+ summary: summary2,
2865
+ guidance: metadata.guidance,
2866
+ listExpected: listExtractorPaths.length > 0
2867
+ });
2868
+ return { listConversion: listConversion2, summary: summary2, baseEnvelope: baseEnvelope2 };
2827
2869
  }
2828
- throw error;
2829
- });
2830
- const listExtractorPaths = listExtractorPathsFromUsageGuidance(metadata);
2831
- const listConversion = _chunkNXDRDJ4Kjs.tryConvertToList.call(void 0, rawResponse, { listExtractorPaths });
2832
- const summary = _chunkNXDRDJ4Kjs.extractSummaryFields.call(void 0, rawResponse);
2833
- const baseEnvelope = buildToolExecuteBaseEnvelope({
2834
- toolId: parsed.toolId,
2835
- params: parsed.params,
2836
- ...idempotencyKey ? { idempotencyKey } : {},
2837
- rawResponse,
2838
- listConversion,
2839
- summary,
2840
- guidance: metadata.guidance,
2841
- listExpected: listExtractorPaths.length > 0
2842
- });
2870
+ );
2843
2871
  const executeExitCode = toolExecuteExitCode(baseEnvelope);
2844
- const delivered = (() => {
2845
- if (!parsed.outPath && (parsed.outputFormat === "json" || parsed.outputFormat === "auto" && _chunkCOMHSM6Fjs.shouldEmitJson.call(void 0, ))) {
2846
- _chunkCOMHSM6Fjs.printCommandEnvelope.call(void 0, baseEnvelope, { json: true });
2872
+ const delivered = await _chunk2IKIG333js.runToolExecuteStage.call(void 0, "output delivery", () => {
2873
+ if (!parsed.outPath && (parsed.outputFormat === "json" || parsed.outputFormat === "auto" && _chunkJNHXSZPBjs.shouldEmitJson.call(void 0, ))) {
2874
+ _chunkJNHXSZPBjs.printCommandEnvelope.call(void 0, baseEnvelope, { json: true });
2847
2875
  return true;
2848
2876
  }
2849
2877
  if (parsed.outputFormat === "json_file") {
@@ -2851,7 +2879,7 @@ async function executeTool(args) {
2851
2879
  rawResponse,
2852
2880
  `payload_${parsed.toolId}`
2853
2881
  );
2854
- _chunkCOMHSM6Fjs.printCommandEnvelope.call(void 0,
2882
+ _chunkJNHXSZPBjs.printCommandEnvelope.call(void 0,
2855
2883
  {
2856
2884
  ...baseEnvelope,
2857
2885
  local: {
@@ -2868,8 +2896,8 @@ async function executeTool(args) {
2868
2896
  const error = new Error(
2869
2897
  `${parsed.toolId} did not expose row-shaped output to write as CSV. Re-run with --json to inspect the raw tool response.`
2870
2898
  );
2871
- if (_chunkCOMHSM6Fjs.argsWantJson.call(void 0, args)) {
2872
- _chunkCOMHSM6Fjs.printJsonError.call(void 0, error);
2899
+ if (_chunkJNHXSZPBjs.argsWantJson.call(void 0, args)) {
2900
+ _chunkJNHXSZPBjs.printJsonError.call(void 0, error);
2873
2901
  } else {
2874
2902
  console.error(error.message);
2875
2903
  }
@@ -2880,18 +2908,18 @@ async function executeTool(args) {
2880
2908
  rawResponse,
2881
2909
  `payload_${parsed.toolId}`
2882
2910
  );
2883
- _chunkCOMHSM6Fjs.printCommandEnvelope.call(void 0,
2911
+ _chunkJNHXSZPBjs.printCommandEnvelope.call(void 0,
2884
2912
  {
2885
2913
  ...baseEnvelope,
2886
2914
  local: {
2887
2915
  payload_file: jsonPath
2888
2916
  }
2889
2917
  },
2890
- { json: parsed.outputFormat === "csv_file" || _chunkCOMHSM6Fjs.shouldEmitJson.call(void 0, ) }
2918
+ { json: parsed.outputFormat === "csv_file" || _chunkJNHXSZPBjs.shouldEmitJson.call(void 0, ) }
2891
2919
  );
2892
2920
  return true;
2893
2921
  }
2894
- _chunkCOMHSM6Fjs.printCommandEnvelope.call(void 0, baseEnvelope, { json: false });
2922
+ _chunkJNHXSZPBjs.printCommandEnvelope.call(void 0, baseEnvelope, { json: false });
2895
2923
  return true;
2896
2924
  }
2897
2925
  const rowOutput = _chunkNXDRDJ4Kjs.projectRowOutput.call(void 0, listConversion);
@@ -2913,19 +2941,19 @@ async function executeTool(args) {
2913
2941
  seededScript
2914
2942
  });
2915
2943
  if (parsed.outputFormat === "csv_file") {
2916
- _chunkCOMHSM6Fjs.printCommandEnvelope.call(void 0, materializedEnvelope, { json: true });
2944
+ _chunkJNHXSZPBjs.printCommandEnvelope.call(void 0, materializedEnvelope, { json: true });
2917
2945
  return true;
2918
2946
  }
2919
2947
  if (parsed.outPath) {
2920
- _chunkCOMHSM6Fjs.printCommandEnvelope.call(void 0, materializedEnvelope, {
2921
- json: _chunkCOMHSM6Fjs.argsWantJson.call(void 0, args) || _chunkCOMHSM6Fjs.shouldEmitJson.call(void 0, ),
2948
+ _chunkJNHXSZPBjs.printCommandEnvelope.call(void 0, materializedEnvelope, {
2949
+ json: _chunkJNHXSZPBjs.argsWantJson.call(void 0, args) || _chunkJNHXSZPBjs.shouldEmitJson.call(void 0, ),
2922
2950
  text: `Wrote ${csv.rowCount} row(s) to ${csv.path}
2923
2951
  `
2924
2952
  });
2925
2953
  return true;
2926
2954
  }
2927
2955
  if (parsed.noPreview) {
2928
- _chunkCOMHSM6Fjs.printCommandEnvelope.call(void 0,
2956
+ _chunkJNHXSZPBjs.printCommandEnvelope.call(void 0,
2929
2957
  {
2930
2958
  ...materializedEnvelope,
2931
2959
  local: {
@@ -2933,15 +2961,20 @@ async function executeTool(args) {
2933
2961
  output_path: csv.path
2934
2962
  }
2935
2963
  },
2936
- { json: _chunkCOMHSM6Fjs.shouldEmitJson.call(void 0, ), text: `${csv.path}
2964
+ { json: _chunkJNHXSZPBjs.shouldEmitJson.call(void 0, ), text: `${csv.path}
2937
2965
  ` }
2938
2966
  );
2939
2967
  return true;
2940
2968
  }
2941
- _chunkCOMHSM6Fjs.printCommandEnvelope.call(void 0, materializedEnvelope, { json: false });
2969
+ _chunkJNHXSZPBjs.printCommandEnvelope.call(void 0, materializedEnvelope, { json: false });
2942
2970
  return true;
2943
- })();
2944
- if (delivered) await recovery.acknowledgeDelivery();
2971
+ });
2972
+ if (delivered) {
2973
+ await _chunk2IKIG333js.runToolExecuteStage.call(void 0,
2974
+ "acknowledge delivery",
2975
+ () => recovery.acknowledgeDelivery()
2976
+ );
2977
+ }
2945
2978
  return delivered ? executeExitCode : 1;
2946
2979
  }
2947
2980
 
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  recentSearchRef,
3
3
  registerDeprecatedSearchCommand
4
- } from "./chunk-TGOAQTY3.mjs";
4
+ } from "./chunk-BDFVIOLY.mjs";
5
5
  import {
6
6
  extractSummaryFields,
7
7
  projectRowOutput,
@@ -12,8 +12,13 @@ import {
12
12
  } from "./chunk-MIMASXO4.mjs";
13
13
  import {
14
14
  DeeplineClient
15
- } from "./chunk-S3HPQWZ3.mjs";
15
+ } from "./chunk-TLTKAJ6S.mjs";
16
16
  import "./chunk-CBVIJSHF.mjs";
17
+ import {
18
+ beginToolExecuteCommand,
19
+ getToolExecuteInvocationId,
20
+ runToolExecuteStage
21
+ } from "./chunk-UABLQKTZ.mjs";
17
22
  import {
18
23
  argsWantJson,
19
24
  printCommandEnvelope,
@@ -22,13 +27,13 @@ import {
22
27
  printJsonError,
23
28
  renderCommandEnvelopeText,
24
29
  shouldEmitJson
25
- } from "./chunk-QFSISXKO.mjs";
30
+ } from "./chunk-D55NIPGU.mjs";
26
31
  import {
27
32
  resolveConfig,
28
33
  sdkCliStateDirPath
29
- } from "./chunk-6C4SD4U3.mjs";
34
+ } from "./chunk-MPVXXDWH.mjs";
30
35
  import "./chunk-DLIRSHV6.mjs";
31
- import "./chunk-KNK42P4M.mjs";
36
+ import "./chunk-QACDLYNO.mjs";
32
37
  import "./chunk-6IKARAYD.mjs";
33
38
  import {
34
39
  DeeplineError
@@ -777,12 +782,16 @@ function compactTool(tool) {
777
782
  function playIdentifiers(play) {
778
783
  return [play.name, play.reference, ...play.aliases ?? []].filter((value) => Boolean(value?.trim())).map((value) => value.trim());
779
784
  }
780
- async function findPlayForToolId(client, toolId) {
785
+ async function findPlayForToolId(client, toolId, cliInvocationId) {
781
786
  const requested = toolId.trim();
782
787
  if (!requested) {
783
788
  return null;
784
789
  }
785
- const plays = await client.searchPlays({ query: requested, compact: true });
790
+ const plays = await client.searchPlays({
791
+ query: requested,
792
+ compact: true,
793
+ ...cliInvocationId ? { cliInvocationId } : {}
794
+ });
786
795
  return plays.find((play) => playIdentifiers(play).includes(requested)) ?? null;
787
796
  }
788
797
  function isMissingToolMetadataError(error) {
@@ -2757,13 +2766,20 @@ async function executeTool(args) {
2757
2766
  }
2758
2767
  return 1;
2759
2768
  }
2769
+ const cliInvocationId = getToolExecuteInvocationId() ?? beginToolExecuteCommand();
2760
2770
  const client = new DeeplineClient();
2761
2771
  let metadata;
2762
2772
  try {
2763
- metadata = await client.getTool(parsed.toolId);
2773
+ metadata = await runToolExecuteStage(
2774
+ "tool metadata lookup",
2775
+ () => client.getTool(parsed.toolId, { cliInvocationId })
2776
+ );
2764
2777
  } catch (error) {
2765
2778
  if (isMissingToolMetadataError(error)) {
2766
- const play = await findPlayForToolId(client, parsed.toolId);
2779
+ const play = await runToolExecuteStage(
2780
+ "play alias lookup",
2781
+ () => findPlayForToolId(client, parsed.toolId, cliInvocationId)
2782
+ );
2767
2783
  if (play) {
2768
2784
  if (argsWantJson(args)) {
2769
2785
  printJsonError(
@@ -2807,41 +2823,53 @@ async function executeTool(args) {
2807
2823
  if (idempotencyKey) {
2808
2824
  console.error(`Tool execution recovery key: ${idempotencyKey}`);
2809
2825
  }
2810
- const rawResponse = await client.executeTool(parsed.toolId, parsed.params, {
2811
- ...parsed.timeoutMs !== void 0 ? { timeout: parsed.timeoutMs } : {},
2812
- ...metadata.executionMetadata?.retrySafeTransientHttp === true ? { maxRetries: 2, retryApiErrors: true } : {},
2813
- responseIntent,
2814
- ...idempotencyKey ? { idempotencyKey } : {},
2815
- ...parsed.recoveryTimeoutMs !== void 0 ? { recoveryTimeoutMs: parsed.recoveryTimeoutMs } : {},
2816
- searchRef: recentSearchRef()
2817
- }).catch((error) => {
2818
- const guidanceLines = toolGuidanceLines(metadata.guidance);
2819
- if (guidanceLines.length > 0) {
2820
- if (args.includes("--json") && error instanceof Error) {
2821
- Object.assign(error, { guidance: metadata.guidance });
2822
- } else {
2823
- console.error(
2824
- [`Guidance for ${parsed.toolId}:`, ...guidanceLines].join("\n")
2825
- );
2826
+ const rawResponse = await runToolExecuteStage(
2827
+ "execute request",
2828
+ () => client.executeTool(parsed.toolId, parsed.params, {
2829
+ ...parsed.timeoutMs !== void 0 ? { timeout: parsed.timeoutMs } : {},
2830
+ ...metadata.executionMetadata?.retrySafeTransientHttp === true ? { maxRetries: 2, retryApiErrors: true } : {},
2831
+ responseIntent,
2832
+ ...idempotencyKey ? { idempotencyKey } : {},
2833
+ ...parsed.recoveryTimeoutMs !== void 0 ? { recoveryTimeoutMs: parsed.recoveryTimeoutMs } : {},
2834
+ searchRef: recentSearchRef(),
2835
+ cliInvocationId
2836
+ }).catch((error) => {
2837
+ const guidanceLines = toolGuidanceLines(metadata.guidance);
2838
+ if (guidanceLines.length > 0) {
2839
+ if (args.includes("--json") && error instanceof Error) {
2840
+ Object.assign(error, { guidance: metadata.guidance });
2841
+ } else {
2842
+ console.error(
2843
+ [`Guidance for ${parsed.toolId}:`, ...guidanceLines].join("\n")
2844
+ );
2845
+ }
2826
2846
  }
2847
+ throw error;
2848
+ })
2849
+ );
2850
+ const { listConversion, summary, baseEnvelope } = await runToolExecuteStage(
2851
+ "result formatting",
2852
+ () => {
2853
+ const listExtractorPaths = listExtractorPathsFromUsageGuidance(metadata);
2854
+ const listConversion2 = tryConvertToList(rawResponse, {
2855
+ listExtractorPaths
2856
+ });
2857
+ const summary2 = extractSummaryFields(rawResponse);
2858
+ const baseEnvelope2 = buildToolExecuteBaseEnvelope({
2859
+ toolId: parsed.toolId,
2860
+ params: parsed.params,
2861
+ ...idempotencyKey ? { idempotencyKey } : {},
2862
+ rawResponse,
2863
+ listConversion: listConversion2,
2864
+ summary: summary2,
2865
+ guidance: metadata.guidance,
2866
+ listExpected: listExtractorPaths.length > 0
2867
+ });
2868
+ return { listConversion: listConversion2, summary: summary2, baseEnvelope: baseEnvelope2 };
2827
2869
  }
2828
- throw error;
2829
- });
2830
- const listExtractorPaths = listExtractorPathsFromUsageGuidance(metadata);
2831
- const listConversion = tryConvertToList(rawResponse, { listExtractorPaths });
2832
- const summary = extractSummaryFields(rawResponse);
2833
- const baseEnvelope = buildToolExecuteBaseEnvelope({
2834
- toolId: parsed.toolId,
2835
- params: parsed.params,
2836
- ...idempotencyKey ? { idempotencyKey } : {},
2837
- rawResponse,
2838
- listConversion,
2839
- summary,
2840
- guidance: metadata.guidance,
2841
- listExpected: listExtractorPaths.length > 0
2842
- });
2870
+ );
2843
2871
  const executeExitCode = toolExecuteExitCode(baseEnvelope);
2844
- const delivered = (() => {
2872
+ const delivered = await runToolExecuteStage("output delivery", () => {
2845
2873
  if (!parsed.outPath && (parsed.outputFormat === "json" || parsed.outputFormat === "auto" && shouldEmitJson())) {
2846
2874
  printCommandEnvelope(baseEnvelope, { json: true });
2847
2875
  return true;
@@ -2940,8 +2968,13 @@ async function executeTool(args) {
2940
2968
  }
2941
2969
  printCommandEnvelope(materializedEnvelope, { json: false });
2942
2970
  return true;
2943
- })();
2944
- if (delivered) await recovery.acknowledgeDelivery();
2971
+ });
2972
+ if (delivered) {
2973
+ await runToolExecuteStage(
2974
+ "acknowledge delivery",
2975
+ () => recovery.acknowledgeDelivery()
2976
+ );
2977
+ }
2945
2978
  return delivered ? executeExitCode : 1;
2946
2979
  }
2947
2980
  export {