deepline 0.3.407 → 0.3.409

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 (127) hide show
  1. package/dist/bundling-sources/sdk/src/client.ts +8 -1
  2. package/dist/bundling-sources/sdk/src/play.ts +13 -0
  3. package/dist/bundling-sources/sdk/src/release.ts +1 -1
  4. package/dist/bundling-sources/sdk/src/types.ts +23 -0
  5. package/dist/bundling-sources/shared_libs/play-runtime/admission-timings.ts +64 -0
  6. package/dist/bundling-sources/shared_libs/play-runtime/context.ts +11 -1
  7. package/dist/bundling-sources/shared_libs/play-runtime/modal-runtime-config.ts +1 -4
  8. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/index.ts +2 -0
  9. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/local-process.ts +15 -6
  10. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +188 -45
  11. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/run-ledger-outbox-recovery.ts +22 -4
  12. package/dist/bundling-sources/shared_libs/play-runtime/tool-http-errors.ts +10 -4
  13. package/dist/bundling-sources/shared_libs/play-runtime/tool-result.ts +72 -0
  14. package/dist/bundling-sources/shared_libs/play-runtime/webhook-receipt-source-commit-retry.ts +90 -0
  15. package/dist/bundling-sources/shared_libs/play-runtime/worker-api-types.ts +5 -0
  16. package/dist/bundling-sources/shared_libs/plays/tool-result-types.ts +6 -0
  17. package/dist/cli/{auth-WURWNNLE.mjs → auth-5HIIACF7.mjs} +4 -4
  18. package/dist/cli/auth-F6BX32XZ.js +40 -0
  19. package/dist/cli/{billing-2QJGXGJX.js → billing-4275N7FL.js} +92 -85
  20. package/dist/cli/{billing-BP3E6WIM.mjs → billing-EVZ3ZWKC.mjs} +23 -16
  21. package/dist/cli/{chunk-WXLOW623.mjs → chunk-264PC2RN.mjs} +14 -7
  22. package/dist/cli/{chunk-RMZAOYDN.js → chunk-2GI3QD3L.js} +53 -53
  23. package/dist/cli/{chunk-ZBCTXQ3P.mjs → chunk-2PRO2JTX.mjs} +1 -1
  24. package/dist/cli/{chunk-GAMFK2ZP.mjs → chunk-44ZTYHMQ.mjs} +10 -3
  25. package/dist/cli/{chunk-G4LJS2RE.js → chunk-53HN7WZN.js} +8 -8
  26. package/dist/cli/{chunk-URWF7NGQ.js → chunk-5MLCBXXU.js} +36 -15
  27. package/dist/cli/{chunk-XT6GG3QO.mjs → chunk-7AALNGTA.mjs} +3 -3
  28. package/dist/cli/{chunk-WJYPBHTE.js → chunk-ALD4COBH.js} +11 -4
  29. package/dist/cli/{chunk-RZLXVHNO.js → chunk-AU4OFDFX.js} +26 -26
  30. package/dist/cli/{chunk-N6OAMAO5.mjs → chunk-BEVLCKXG.mjs} +1 -1
  31. package/dist/cli/{chunk-7LKYHZVB.js → chunk-DEC3JECC.js} +1 -1
  32. package/dist/cli/{chunk-UFFSOV6I.mjs → chunk-FHPCKULR.mjs} +2 -2
  33. package/dist/cli/{chunk-THHM4DPE.js → chunk-FJCIUF34.js} +4 -4
  34. package/dist/cli/{chunk-H6EWQFPQ.js → chunk-GAICVLKL.js} +2 -2
  35. package/dist/cli/{chunk-4TV43THC.mjs → chunk-IT3XBJQR.mjs} +4 -4
  36. package/dist/cli/{chunk-UFS752TU.mjs → chunk-J6DCKJNM.mjs} +5 -1
  37. package/dist/cli/{chunk-AYHLUHE5.js → chunk-JGHG4NBA.js} +6 -2
  38. package/dist/cli/{chunk-BKC6VMYZ.mjs → chunk-JRAVVJ3T.mjs} +73 -4
  39. package/dist/cli/{chunk-ZI2ZNDJK.mjs → chunk-LFSHGNT2.mjs} +36 -15
  40. package/dist/cli/{chunk-L25GBGQU.mjs → chunk-N44JHMKY.mjs} +6 -6
  41. package/dist/cli/{chunk-QJAX7QN7.mjs → chunk-NZSF57UO.mjs} +2 -2
  42. package/dist/cli/{chunk-IY6GKJ4O.js → chunk-O3VSXP2F.js} +50 -50
  43. package/dist/cli/{chunk-J67NU4MQ.mjs → chunk-PBZYY7VZ.mjs} +5 -2
  44. package/dist/cli/{chunk-G6U74WNM.js → chunk-RTCDW2GU.js} +15 -15
  45. package/dist/cli/{chunk-UPEOEYZ3.mjs → chunk-TQNHMWUR.mjs} +1 -1
  46. package/dist/cli/{chunk-KUQAU5MG.js → chunk-V76R6HMV.js} +10 -7
  47. package/dist/cli/{chunk-6JZZNP5G.mjs → chunk-VWBTTJYQ.mjs} +2 -2
  48. package/dist/cli/{chunk-SOQIPKF2.js → chunk-WHG43Z67.js} +8 -8
  49. package/dist/cli/{chunk-Y6CX4QPR.js → chunk-WLOCMJWV.js} +67 -67
  50. package/dist/cli/{chunk-QJBJZVG6.js → chunk-WNUR6VP5.js} +15 -8
  51. package/dist/cli/{chunk-P7HOTKOK.mjs → chunk-WYQO2CBS.mjs} +4 -4
  52. package/dist/cli/{chunk-D2ZRMZKF.js → chunk-YD7B53RW.js} +99 -30
  53. package/dist/cli/command-docs.js +2 -2
  54. package/dist/cli/command-docs.mjs +1 -1
  55. package/dist/cli/{csv-N6KYTG7L.mjs → csv-A2MP6EFV.mjs} +3 -3
  56. package/dist/cli/{csv-7E5BE23B.js → csv-BBOTCGQY.js} +12 -12
  57. package/dist/cli/{db-XMBJNVBD.mjs → db-3W5DMTUX.mjs} +4 -4
  58. package/dist/cli/{db-4VLZP33O.js → db-G4CODDCA.js} +25 -25
  59. package/dist/cli/{describe-4I6EIVXD.js → describe-PQTQ5B6F.js} +11 -11
  60. package/dist/cli/{describe-WERH4TD2.mjs → describe-XYJ2ZT4M.mjs} +7 -7
  61. package/dist/cli/describe-core.d.mts +2 -2
  62. package/dist/cli/describe-core.d.ts +2 -2
  63. package/dist/cli/{executions-W7TWJRBK.js → executions-TLANVR7Y.js} +6 -6
  64. package/dist/cli/{executions-JWQXE7G6.mjs → executions-UR67CA5H.mjs} +4 -4
  65. package/dist/cli/{feedback-FMGRC6KO.js → feedback-6C2YTRJL.js} +7 -7
  66. package/dist/cli/{feedback-OEJFX4F7.mjs → feedback-WHCMGEIL.mjs} +3 -3
  67. package/dist/cli/{git-IVC4KHXX.mjs → git-GWLB6VSA.mjs} +4 -4
  68. package/dist/cli/git-VQFF6D7C.js +24 -0
  69. package/dist/cli/index.js +204 -127
  70. package/dist/cli/index.mjs +124 -47
  71. package/dist/cli/{legacy-noops-LT36CLWZ.mjs → legacy-noops-KF4XIFEF.mjs} +4 -4
  72. package/dist/cli/{legacy-noops-X3BQ7MUK.js → legacy-noops-ZUFA7RWI.js} +7 -7
  73. package/dist/cli/{monitors-MNLCELF7.mjs → monitors-6UOIDIMB.mjs} +4 -4
  74. package/dist/cli/{monitors-DLIIAVLW.js → monitors-TB3K2IVE.js} +84 -84
  75. package/dist/cli/{org-CYHDEW7P.js → org-CKWMBPIR.js} +64 -64
  76. package/dist/cli/{org-QV5LMUPT.mjs → org-WGHHMVDZ.mjs} +4 -4
  77. package/dist/cli/{play-5Z4ROZ3P.mjs → play-LYPAXCLD.mjs} +70 -18
  78. package/dist/cli/{play-MEFXC2QA.js → play-N2B3KAVS.js} +345 -293
  79. package/dist/cli/{providers-FJLYSHB3.mjs → providers-6DI5BVZJ.mjs} +4 -4
  80. package/dist/cli/{providers-2MKUNFBQ.js → providers-UR42MD6Z.js} +7 -7
  81. package/dist/cli/{quickstart-ULWXKAOT.js → quickstart-FCJG4XGB.js} +5 -5
  82. package/dist/cli/{quickstart-PQO3OQRT.mjs → quickstart-MNA2S6PO.mjs} +3 -3
  83. package/dist/cli/search-NCEEONMQ.js +30 -0
  84. package/dist/cli/{search-KGAAXMDG.mjs → search-VPPYUJ2M.mjs} +5 -5
  85. package/dist/cli/{secrets-PD5I3KAF.mjs → secrets-DRI4W7Z5.mjs} +4 -4
  86. package/dist/cli/{secrets-X2VGG2PO.js → secrets-QOSMVO36.js} +13 -13
  87. package/dist/cli/{sessions-R3XAKTBQ.js → sessions-3WYKQABW.js} +5 -5
  88. package/dist/cli/{sessions-3WVEU4PE.mjs → sessions-DQNUKP43.mjs} +4 -4
  89. package/dist/cli/{settings-645RSFQX.mjs → settings-DWDK3Y2R.mjs} +8 -8
  90. package/dist/cli/{settings-ZIDO3IP6.js → settings-JUGGCOPS.js} +75 -75
  91. package/dist/cli/{setup-LH5HOZ3D.js → setup-AWBHNYXK.js} +42 -42
  92. package/dist/cli/{setup-LISKIJKP.mjs → setup-D5DWVNY4.mjs} +7 -7
  93. package/dist/cli/skills-AKPAJVSO.js +29 -0
  94. package/dist/cli/{skills-VVQJHLSF.mjs → skills-YV2XR35J.mjs} +5 -5
  95. package/dist/cli/{tools-FTPJCNAM.js → tools-RBKEK6PM.js} +8 -8
  96. package/dist/cli/{tools-Y3LOMXFT.mjs → tools-VFJYHNV2.mjs} +7 -7
  97. package/dist/cli/{update-DOBNQNJI.mjs → update-IM6VOTGL.mjs} +7 -7
  98. package/dist/cli/update-VFNUBLDA.js +29 -0
  99. package/dist/cli/{workflow-ZMAA5VCN.mjs → workflow-26URBWPV.mjs} +5 -5
  100. package/dist/cli/{workflow-LGENKZBV.js → workflow-3BS6U6SL.js} +15 -15
  101. package/dist/{client-IrPHUE5J.d.ts → client-BMjJFpan.d.ts} +28 -2
  102. package/dist/{client-6rEB46Lv.d.mts → client-BfInrZPB.d.mts} +28 -2
  103. package/dist/{compiler-manifest-BHnXE43X.d.ts → compiler-manifest-Ycx-hoAr.d.mts} +2 -0
  104. package/dist/{compiler-manifest-BHnXE43X.d.mts → compiler-manifest-Ycx-hoAr.d.ts} +2 -0
  105. package/dist/{index-Da_Y8z5e.d.mts → index-CZXgiN3E.d.mts} +1 -1
  106. package/dist/{index-SODb2ROS.d.ts → index-NPG5pqxQ.d.ts} +1 -1
  107. package/dist/index.d.mts +5 -5
  108. package/dist/index.d.ts +5 -5
  109. package/dist/index.js +26 -9
  110. package/dist/index.mjs +23 -6
  111. package/dist/install-integrity.json +86 -84
  112. package/dist/plays/bundle-play-file.d.mts +3 -3
  113. package/dist/plays/bundle-play-file.d.ts +3 -3
  114. package/dist/plays/play-description.d.mts +2 -2
  115. package/dist/plays/play-description.d.ts +2 -2
  116. package/dist/plays/run-request.d.mts +2 -2
  117. package/dist/plays/run-request.d.ts +2 -2
  118. package/dist/release.d.mts +1 -1
  119. package/dist/release.d.ts +1 -1
  120. package/dist/release.js +2 -2
  121. package/dist/release.mjs +1 -1
  122. package/package.json +1 -1
  123. package/dist/cli/auth-4JTX6AGM.js +0 -40
  124. package/dist/cli/git-OFXE7G4X.js +0 -24
  125. package/dist/cli/search-ANKSJ224.js +0 -30
  126. package/dist/cli/skills-WLHYSVQA.js +0 -29
  127. package/dist/cli/update-A622H2DZ.js +0 -29
@@ -4,8 +4,8 @@ import {
4
4
  resolveUpdatePlan,
5
5
  runAutomaticUpdatePlan,
6
6
  shouldRunCliAutoUpdate
7
- } from "./chunk-P7HOTKOK.mjs";
8
- import "./chunk-N6OAMAO5.mjs";
7
+ } from "./chunk-WYQO2CBS.mjs";
8
+ import "./chunk-BEVLCKXG.mjs";
9
9
  import {
10
10
  SDK_COMPATIBILITY_FAST_DEADLINE_MS,
11
11
  SKILLS_AUTO_SYNC_COMMAND,
@@ -22,29 +22,33 @@ import {
22
22
  resolveSdkCliFailureExitCode,
23
23
  sanitizeCommand,
24
24
  syncSdkSkillsIfNeeded
25
- } from "./chunk-4TV43THC.mjs";
25
+ } from "./chunk-IT3XBJQR.mjs";
26
26
  import {
27
27
  beginToolExecuteCommand,
28
28
  compatibilityCatalog,
29
29
  finishToolExecuteCommand,
30
30
  runToolExecuteStage
31
- } from "./chunk-WXLOW623.mjs";
31
+ } from "./chunk-264PC2RN.mjs";
32
32
  import {
33
33
  recordCliTrace,
34
34
  traceCliSpan
35
- } from "./chunk-UFS752TU.mjs";
35
+ } from "./chunk-J6DCKJNM.mjs";
36
36
  import {
37
37
  createCliProgress
38
- } from "./chunk-GAMFK2ZP.mjs";
38
+ } from "./chunk-44ZTYHMQ.mjs";
39
39
  import {
40
+ addJsonNotice,
40
41
  errorToJsonPayload,
41
42
  formatProviderConcurrencyDiagnostic,
42
43
  formatToolExecutionErrorDiagnostic,
44
+ installJsonStderrGuard,
45
+ isJsonOutputMode,
43
46
  printCommandEnvelope,
44
47
  printCompactJson,
45
48
  printJson,
46
- shouldEmitJson
47
- } from "./chunk-BKC6VMYZ.mjs";
49
+ shouldEmitJson,
50
+ takeSilentJsonFailureMessage
51
+ } from "./chunk-JRAVVJ3T.mjs";
48
52
  import {
49
53
  HttpClient,
50
54
  SDK_VERSION,
@@ -54,19 +58,19 @@ import {
54
58
  resolveApiKeyForBaseUrl,
55
59
  resolveBaseUrlOnly,
56
60
  resolveConfig
57
- } from "./chunk-ZBCTXQ3P.mjs";
61
+ } from "./chunk-2PRO2JTX.mjs";
58
62
  import {
59
63
  AuthError
60
64
  } from "./chunk-YHPYUZZX.mjs";
61
65
  import "./chunk-DLIRSHV6.mjs";
62
66
  import "./chunk-NXGCO4JB.mjs";
63
- import "./chunk-UPEOEYZ3.mjs";
67
+ import "./chunk-TQNHMWUR.mjs";
64
68
  import "./chunk-WZYKRD7T.mjs";
65
69
  import {
66
70
  commandDocKey,
67
71
  helpDetailFromArgv,
68
72
  renderCommandExplanation
69
- } from "./chunk-ZI2ZNDJK.mjs";
73
+ } from "./chunk-LFSHGNT2.mjs";
70
74
  import "./chunk-KRD6H754.mjs";
71
75
 
72
76
  // src/cli/command-invocation.ts
@@ -130,48 +134,48 @@ import { Command as Command2 } from "commander";
130
134
  var COMMAND_GROUPS = [
131
135
  {
132
136
  names: ["auth"],
133
- load: async () => (await import("./auth-WURWNNLE.mjs")).registerAuthCommands
137
+ load: async () => (await import("./auth-5HIIACF7.mjs")).registerAuthCommands
134
138
  },
135
139
  {
136
140
  names: ["providers"],
137
- load: async () => (await import("./providers-FJLYSHB3.mjs")).registerProviderCommands
141
+ load: async () => (await import("./providers-6DI5BVZJ.mjs")).registerProviderCommands
138
142
  },
139
143
  {
140
144
  names: ["search"],
141
- load: async () => (await import("./search-KGAAXMDG.mjs")).registerSearchCommand
145
+ load: async () => (await import("./search-VPPYUJ2M.mjs")).registerSearchCommand
142
146
  },
143
147
  {
144
148
  names: ["describe"],
145
- load: async () => (await import("./describe-WERH4TD2.mjs")).registerDescribeCommand
149
+ load: async () => (await import("./describe-XYJ2ZT4M.mjs")).registerDescribeCommand
146
150
  },
147
151
  {
148
152
  names: ["tools"],
149
- load: async () => (await import("./tools-Y3LOMXFT.mjs")).registerToolsCommands
153
+ load: async () => (await import("./tools-VFJYHNV2.mjs")).registerToolsCommands
150
154
  },
151
155
  {
152
156
  names: ["executions"],
153
- load: async () => (await import("./executions-JWQXE7G6.mjs")).registerExecutionsCommands
157
+ load: async () => (await import("./executions-UR67CA5H.mjs")).registerExecutionsCommands
154
158
  },
155
159
  {
156
160
  names: ["plays", "runs"],
157
- load: async () => (await import("./play-5Z4ROZ3P.mjs")).registerPlayCommands
161
+ load: async () => (await import("./play-LYPAXCLD.mjs")).registerPlayCommands
158
162
  },
159
163
  {
160
164
  names: ["sessions"],
161
- load: async () => (await import("./sessions-3WVEU4PE.mjs")).registerSessionsCommands
165
+ load: async () => (await import("./sessions-DQNUKP43.mjs")).registerSessionsCommands
162
166
  },
163
167
  {
164
168
  names: ["workflows"],
165
- load: async () => (await import("./workflow-ZMAA5VCN.mjs")).registerWorkflowCommands
169
+ load: async () => (await import("./workflow-26URBWPV.mjs")).registerWorkflowCommands
166
170
  },
167
171
  {
168
172
  names: ["secrets"],
169
- load: async () => (await import("./secrets-PD5I3KAF.mjs")).registerSecretsCommands
173
+ load: async () => (await import("./secrets-DRI4W7Z5.mjs")).registerSecretsCommands
170
174
  },
171
175
  {
172
176
  names: ["settings", "notifications"],
173
177
  load: async () => {
174
- const commands = await import("./settings-645RSFQX.mjs");
178
+ const commands = await import("./settings-DWDK3Y2R.mjs");
175
179
  return (p) => {
176
180
  commands.registerSettingsCommands(p);
177
181
  commands.registerNotificationCommands(p);
@@ -180,51 +184,51 @@ var COMMAND_GROUPS = [
180
184
  },
181
185
  {
182
186
  names: ["billing"],
183
- load: async () => (await import("./billing-BP3E6WIM.mjs")).registerBillingCommands
187
+ load: async () => (await import("./billing-EVZ3ZWKC.mjs")).registerBillingCommands
184
188
  },
185
189
  {
186
190
  names: ["monitors"],
187
- load: async () => (await import("./monitors-MNLCELF7.mjs")).registerMonitorsCommands
191
+ load: async () => (await import("./monitors-6UOIDIMB.mjs")).registerMonitorsCommands
188
192
  },
189
193
  {
190
194
  names: ["org"],
191
- load: async () => (await import("./org-QV5LMUPT.mjs")).registerOrgCommands
195
+ load: async () => (await import("./org-WGHHMVDZ.mjs")).registerOrgCommands
192
196
  },
193
197
  {
194
198
  names: ["git", "projects", "deployments"],
195
- load: async () => (await import("./git-IVC4KHXX.mjs")).registerGitCommands
199
+ load: async () => (await import("./git-GWLB6VSA.mjs")).registerGitCommands
196
200
  },
197
201
  {
198
202
  names: ["csv"],
199
- load: async () => (await import("./csv-N6KYTG7L.mjs")).registerCsvCommands
203
+ load: async () => (await import("./csv-A2MP6EFV.mjs")).registerCsvCommands
200
204
  },
201
205
  {
202
206
  names: ["db"],
203
- load: async () => (await import("./db-XMBJNVBD.mjs")).registerDbCommands
207
+ load: async () => (await import("./db-3W5DMTUX.mjs")).registerDbCommands
204
208
  },
205
209
  {
206
210
  names: ["feedback"],
207
- load: async () => (await import("./feedback-OEJFX4F7.mjs")).registerFeedbackCommands
211
+ load: async () => (await import("./feedback-WHCMGEIL.mjs")).registerFeedbackCommands
208
212
  },
209
213
  {
210
214
  names: ["enrich", "session", "backend"],
211
- load: async () => (await import("./legacy-noops-LT36CLWZ.mjs")).registerDeprecatedCommands
215
+ load: async () => (await import("./legacy-noops-KF4XIFEF.mjs")).registerDeprecatedCommands
212
216
  },
213
217
  {
214
218
  names: ["update"],
215
- load: async () => (await import("./update-DOBNQNJI.mjs")).registerUpdateCommand
219
+ load: async () => (await import("./update-IM6VOTGL.mjs")).registerUpdateCommand
216
220
  },
217
221
  {
218
222
  names: ["skills", "skills-auto-sync"],
219
- load: async () => (await import("./skills-VVQJHLSF.mjs")).registerSkillsCommand
223
+ load: async () => (await import("./skills-YV2XR35J.mjs")).registerSkillsCommand
220
224
  },
221
225
  {
222
226
  names: ["setup", "doctor"],
223
- load: async () => (await import("./setup-LISKIJKP.mjs")).registerSetupCommands
227
+ load: async () => (await import("./setup-D5DWVNY4.mjs")).registerSetupCommands
224
228
  },
225
229
  {
226
230
  names: ["quickstart"],
227
- load: async () => (await import("./quickstart-PQO3OQRT.mjs")).registerQuickstartCommands
231
+ load: async () => (await import("./quickstart-MNA2S6PO.mjs")).registerQuickstartCommands
228
232
  }
229
233
  ];
230
234
  async function registerDeeplineCommandGroups(program, requestedCommand) {
@@ -658,6 +662,25 @@ function asCommanderError(error) {
658
662
  const code = error.code;
659
663
  return typeof code === "string" && code.startsWith("commander.") ? error : null;
660
664
  }
665
+ function silenceCommanderErrorOutput(command) {
666
+ command.configureOutput({ writeErr: () => {
667
+ } });
668
+ for (const child of command.commands) silenceCommanderErrorOutput(child);
669
+ }
670
+ function printUsageErrorJson(code, message, commandPath) {
671
+ const unknownName = code === "commander.unknownCommand" ? /unknown command '([^']+)'/.exec(message)?.[1] : void 0;
672
+ const helpPath = unknownName && commandPath.endsWith(` ${unknownName}`) ? commandPath.slice(0, -unknownName.length - 1) : commandPath;
673
+ printJson({
674
+ ok: false,
675
+ error: {
676
+ code,
677
+ message,
678
+ details: {
679
+ help: `deepline ${helpPath ? `${helpPath} ` : ""}--help`
680
+ }
681
+ }
682
+ });
683
+ }
661
684
  function shouldPrintStartupPhase() {
662
685
  if (process.argv.includes("--json")) {
663
686
  return false;
@@ -739,7 +762,7 @@ async function runPlayRunnerHealthCheck() {
739
762
  });
740
763
  let exitCode = 1;
741
764
  try {
742
- const { handlePlayRun } = await import("./play-5Z4ROZ3P.mjs");
765
+ const { handlePlayRun } = await import("./play-LYPAXCLD.mjs");
743
766
  exitCode = await handlePlayRun([
744
767
  file,
745
768
  "--input",
@@ -912,6 +935,7 @@ async function newerCliCommandHint(baseUrl, command) {
912
935
  }
913
936
  async function runMain(ensureTransport, onAction) {
914
937
  const mainStartedAt = Date.now();
938
+ installJsonStderrGuard();
915
939
  let rootHelpStatus = "";
916
940
  recordCliTrace({
917
941
  phase: "cli.main_start",
@@ -1060,9 +1084,14 @@ Exit codes:
1060
1084
  response: compatibility.response
1061
1085
  };
1062
1086
  }
1087
+ const jsonOutput = isJsonOutputMode();
1063
1088
  enforceSdkCompatibilityResponse(compatibility.response, {
1064
- quietAdvisory: process.argv.includes("--json")
1089
+ quietAdvisory: jsonOutput
1065
1090
  });
1091
+ const advisory = compatibility.response;
1092
+ if (jsonOutput && advisory && (advisory.status === "deprecated" || advisory.status === "update_available") && !isCiEnvironment()) {
1093
+ addJsonNotice({ code: advisory.status, message: advisory.message });
1094
+ }
1066
1095
  return {
1067
1096
  shouldContinue: true,
1068
1097
  baseUrl,
@@ -1095,6 +1124,7 @@ Exit codes:
1095
1124
  !requestedCommand || requestedCommand === "help" || requestedCommand.startsWith("-") && !["-v", "--version"].includes(requestedCommand) ? void 0 : requestedCommand
1096
1125
  );
1097
1126
  const { preflight, health, version } = registerDeeplineInlineCommands(program);
1127
+ if (isJsonOutputMode()) silenceCommanderErrorOutput(program);
1098
1128
  preflight.addHelpText(
1099
1129
  "after",
1100
1130
  `
@@ -1140,7 +1170,7 @@ Examples:
1140
1170
  return;
1141
1171
  }
1142
1172
  try {
1143
- const { httpJson, readStatusBanner, statusBannerLine } = await import("./auth-WURWNNLE.mjs");
1173
+ const { httpJson, readStatusBanner, statusBannerLine } = await import("./auth-5HIIACF7.mjs");
1144
1174
  const baseUrl = resolveBaseUrlOnly();
1145
1175
  const [{ status, data }, banner] = await Promise.all([
1146
1176
  httpJson("GET", `${baseUrl}/api/v2/health`, null),
@@ -1196,13 +1226,26 @@ Examples:
1196
1226
  }
1197
1227
  const requestedTopLevelCommand = process.argv.slice(2)[0] ?? "";
1198
1228
  if (!topLevelCommandKnown(program, requestedTopLevelCommand)) {
1199
- console.error(`error: unknown command '${requestedTopLevelCommand}'`);
1229
+ const unknownCommandMessage = `error: unknown command '${requestedTopLevelCommand}'`;
1230
+ if (!isJsonOutputMode()) console.error(unknownCommandMessage);
1200
1231
  const baseUrl = autoDetectBaseUrl();
1201
1232
  await ensureTransport();
1202
1233
  const versionHint = await newerCliCommandHint(
1203
1234
  baseUrl,
1204
1235
  requestedTopLevelCommand
1205
1236
  );
1237
+ if (isJsonOutputMode()) {
1238
+ if (versionHint) {
1239
+ addJsonNotice({ code: "newer_cli_command", message: versionHint });
1240
+ }
1241
+ printUsageErrorJson(
1242
+ "commander.unknownCommand",
1243
+ unknownCommandMessage,
1244
+ ""
1245
+ );
1246
+ process.exitCode = 2;
1247
+ return;
1248
+ }
1206
1249
  if (versionHint) {
1207
1250
  console.error(versionHint);
1208
1251
  process.exitCode = 2;
@@ -1215,7 +1258,7 @@ Examples:
1215
1258
  const helpArgs = process.argv.slice(2);
1216
1259
  const helpPositionals = helpArgs.filter((arg) => !arg.startsWith("-"));
1217
1260
  if (helpPositionals.length === 0 ? helpArgs.includes("--help") || helpArgs.includes("-h") : helpPositionals.length === 1 && helpPositionals[0] === "help") {
1218
- const { authStatusLine } = await import("./auth-WURWNNLE.mjs");
1261
+ const { authStatusLine } = await import("./auth-5HIIACF7.mjs");
1219
1262
  rootHelpStatus = `Version: ${SDK_VERSION}
1220
1263
  ${await authStatusLine()}
1221
1264
  `;
@@ -1240,28 +1283,54 @@ ${await authStatusLine()}
1240
1283
  error: error instanceof Error ? error.message : String(error)
1241
1284
  });
1242
1285
  progress?.fail();
1243
- const wantsJson = process.argv.includes("--json");
1286
+ const wantsJson = isJsonOutputMode();
1244
1287
  if (commanderError) {
1245
- if ([
1288
+ const grammarError = [
1246
1289
  "commander.unknownCommand",
1247
1290
  "commander.unknownOption",
1248
1291
  "commander.excessArguments"
1249
- ].includes(commanderError.code)) {
1250
- const invocation = inspectCliInvocation(program, process.argv.slice(2));
1251
- const commandPath = invocation.commandPath || requestedTopLevelCommand;
1292
+ ].includes(commanderError.code);
1293
+ const commandPath = grammarError || wantsJson ? inspectCliInvocation(program, process.argv.slice(2)).commandPath || requestedTopLevelCommand : "";
1294
+ if (grammarError) {
1252
1295
  await ensureTransport();
1253
1296
  const versionHint = await newerCliCommandHint(
1254
1297
  autoDetectBaseUrl(),
1255
1298
  commandPath
1256
1299
  );
1257
- if (versionHint) console.error(versionHint);
1258
- console.error(
1259
- `Check this installation's grammar: deepline ${commandPath} --help`
1300
+ if (wantsJson) {
1301
+ if (versionHint) {
1302
+ addJsonNotice({ code: "newer_cli_command", message: versionHint });
1303
+ }
1304
+ } else {
1305
+ if (versionHint) console.error(versionHint);
1306
+ console.error(
1307
+ `Check this installation's grammar: deepline ${commandPath} --help`
1308
+ );
1309
+ }
1310
+ }
1311
+ if (wantsJson && (commanderError.exitCode ?? 1) !== 0) {
1312
+ printUsageErrorJson(
1313
+ commanderError.code,
1314
+ commanderError.message,
1315
+ commandPath
1260
1316
  );
1261
1317
  }
1262
1318
  process.exitCode = commanderError.code === "commander.unknownCommand" && !wantsJson ? 2 : commanderError.exitCode ?? 1;
1263
1319
  return;
1264
1320
  } else if (wantsJson) {
1321
+ if (error instanceof AuthError) {
1322
+ addJsonNotice({
1323
+ code: "auth_required",
1324
+ message: `Not authenticated. Run: ${AUTH_RECOVERY_COMMAND}`
1325
+ });
1326
+ }
1327
+ const providerConcurrency = formatProviderConcurrencyDiagnostic(error);
1328
+ if (providerConcurrency) {
1329
+ addJsonNotice({
1330
+ code: "provider_concurrency",
1331
+ message: providerConcurrency
1332
+ });
1333
+ }
1265
1334
  printJson({
1266
1335
  ...errorToJsonPayload(error),
1267
1336
  ...error instanceof AuthError ? { next: AUTH_RECOVERY_COMMAND } : {}
@@ -1316,6 +1385,14 @@ async function main() {
1316
1385
  await runMain(ensureTransport, (dispatched) => {
1317
1386
  action = dispatched;
1318
1387
  });
1388
+ const silentFailure = takeSilentJsonFailureMessage(process.exitCode);
1389
+ if (silentFailure) {
1390
+ printJson({
1391
+ ok: false,
1392
+ exitCode: Number(process.exitCode),
1393
+ error: { code: "CLI_ERROR", message: silentFailure }
1394
+ });
1395
+ }
1319
1396
  await ensureTransport();
1320
1397
  await reportOutputSize({ exitCode: process.exitCode, action });
1321
1398
  } finally {
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  registerSessionSendRenderCommands
3
- } from "./chunk-6JZZNP5G.mjs";
3
+ } from "./chunk-VWBTTJYQ.mjs";
4
4
  import {
5
5
  ENRICH_COMMAND_DEPRECATION_MESSAGE
6
6
  } from "./chunk-ITOFSXIU.mjs";
7
7
  import {
8
8
  printCommandEnvelope
9
- } from "./chunk-BKC6VMYZ.mjs";
10
- import "./chunk-ZBCTXQ3P.mjs";
9
+ } from "./chunk-JRAVVJ3T.mjs";
10
+ import "./chunk-2PRO2JTX.mjs";
11
11
  import "./chunk-YHPYUZZX.mjs";
12
12
  import "./chunk-DLIRSHV6.mjs";
13
13
  import "./chunk-NXGCO4JB.mjs";
14
- import "./chunk-UPEOEYZ3.mjs";
14
+ import "./chunk-TQNHMWUR.mjs";
15
15
  import "./chunk-WZYKRD7T.mjs";
16
16
  import "./chunk-KRD6H754.mjs";
17
17
 
@@ -1,17 +1,17 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkSOQIPKF2js = require('./chunk-SOQIPKF2.js');
3
+ var _chunkWHG43Z67js = require('./chunk-WHG43Z67.js');
4
4
 
5
5
 
6
6
  var _chunk3XX5TEA4js = require('./chunk-3XX5TEA4.js');
7
7
 
8
8
 
9
- var _chunkD2ZRMZKFjs = require('./chunk-D2ZRMZKF.js');
10
- require('./chunk-THHM4DPE.js');
9
+ var _chunkYD7B53RWjs = require('./chunk-YD7B53RW.js');
10
+ require('./chunk-FJCIUF34.js');
11
11
  require('./chunk-Q2E4E4FJ.js');
12
12
  require('./chunk-XNYIZMNQ.js');
13
13
  require('./chunk-7P5AA3SN.js');
14
- require('./chunk-7LKYHZVB.js');
14
+ require('./chunk-DEC3JECC.js');
15
15
  require('./chunk-OG64RBAC.js');
16
16
  require('./chunk-COGTRVWW.js');
17
17
 
@@ -52,7 +52,7 @@ function deprecatedCommandEnvelope(input) {
52
52
  };
53
53
  }
54
54
  function printDeprecatedCommand(input) {
55
- _chunkD2ZRMZKFjs.printCommandEnvelope.call(void 0, deprecatedCommandEnvelope(input), {
55
+ _chunkYD7B53RWjs.printCommandEnvelope.call(void 0, deprecatedCommandEnvelope(input), {
56
56
  json: input.options.json
57
57
  });
58
58
  process.exitCode = 2;
@@ -72,7 +72,7 @@ function registerDeprecatedCommands(program) {
72
72
  program.command("enrich", { hidden: true }).description("Deprecated CSV enrichment command.").allowUnknownOption(true).allowExcessArguments(true).option("--json", "Emit JSON output").argument("[args...]").addHelpText("after", `
73
73
  ${_chunk3XX5TEA4js.ENRICH_COMMAND_DEPRECATION_MESSAGE}
74
74
  `).action((_args, options) => {
75
- _chunkD2ZRMZKFjs.printCommandEnvelope.call(void 0,
75
+ _chunkYD7B53RWjs.printCommandEnvelope.call(void 0,
76
76
  {
77
77
  ok: false,
78
78
  command: "deepline enrich",
@@ -115,7 +115,7 @@ Examples:
115
115
  options
116
116
  });
117
117
  });
118
- _chunkSOQIPKF2js.registerSessionSendRenderCommands.call(void 0, session, "session");
118
+ _chunkWHG43Z67js.registerSessionSendRenderCommands.call(void 0, session, "session");
119
119
  for (const subcommand of SESSION_SUBCOMMANDS) {
120
120
  addDeprecatedSubcommand(
121
121
  session,
@@ -1,7 +1,7 @@
1
1
  import "./chunk-EXMLR72R.mjs";
2
2
  import {
3
3
  DeeplineClient
4
- } from "./chunk-J67NU4MQ.mjs";
4
+ } from "./chunk-PBZYY7VZ.mjs";
5
5
  import "./chunk-6IKARAYD.mjs";
6
6
  import "./chunk-JI2B4RZP.mjs";
7
7
  import "./chunk-EIMG75BT.mjs";
@@ -19,8 +19,8 @@ import {
19
19
  printCommandEnvelope,
20
20
  printJson,
21
21
  shouldEmitJson
22
- } from "./chunk-BKC6VMYZ.mjs";
23
- import "./chunk-ZBCTXQ3P.mjs";
22
+ } from "./chunk-JRAVVJ3T.mjs";
23
+ import "./chunk-2PRO2JTX.mjs";
24
24
  import {
25
25
  AuthError
26
26
  } from "./chunk-YHPYUZZX.mjs";
@@ -28,7 +28,7 @@ import "./chunk-DLIRSHV6.mjs";
28
28
  import {
29
29
  DeeplineError
30
30
  } from "./chunk-NXGCO4JB.mjs";
31
- import "./chunk-UPEOEYZ3.mjs";
31
+ import "./chunk-TQNHMWUR.mjs";
32
32
  import "./chunk-WZYKRD7T.mjs";
33
33
  import "./chunk-KRD6H754.mjs";
34
34