deepline 0.3.477 → 0.3.479

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 (168) hide show
  1. package/dist/bundling-sources/sdk/src/client-core.ts +5 -4
  2. package/dist/bundling-sources/sdk/src/http-core.ts +84 -3
  3. package/dist/bundling-sources/sdk/src/http.ts +2 -0
  4. package/dist/bundling-sources/sdk/src/play.ts +8 -2
  5. package/dist/bundling-sources/sdk/src/release.ts +1 -1
  6. package/dist/bundling-sources/shared_libs/integration-contracts/billing-entitlements.ts +11 -0
  7. package/dist/bundling-sources/shared_libs/observability/scheduled-jobs.json +18 -0
  8. package/dist/bundling-sources/shared_libs/play-runtime/context.ts +10 -2
  9. package/dist/bundling-sources/shared_libs/play-runtime/governor/app-runtime-rate-state-backend.ts +11 -1
  10. package/dist/bundling-sources/shared_libs/play-runtime/protocol.ts +5 -0
  11. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-payload-transport.ts +77 -4
  12. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-session-execution.ts +83 -1
  13. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona.ts +7 -0
  14. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-rate-state.ts +60 -27
  15. package/dist/bundling-sources/shared_libs/plays/authoring-contract.ts +13 -12
  16. package/dist/bundling-sources/shared_libs/plays/bundling/index.ts +5 -2
  17. package/dist/bundling-sources/shared_libs/plays/sandbox-runtime-limits.ts +37 -12
  18. package/dist/bundling-sources/shared_libs/product-notifications/billing-sales.ts +3 -1
  19. package/dist/bundling-sources/shared_libs/product-notifications/catalog.ts +29 -0
  20. package/dist/bundling-sources/shared_libs/product-notifications/events.ts +15 -0
  21. package/dist/bundling-sources/shared_libs/product-notifications/slack-delivery.ts +57 -5
  22. package/dist/bundling-sources/shared_libs/product-notifications/slack-transport.ts +19 -0
  23. package/dist/cli/{auth-XVXRRWIQ.mjs → auth-D7DYB57R.mjs} +5 -5
  24. package/dist/cli/auth-MZDFNRPG.js +41 -0
  25. package/dist/cli/{billing-2H7GFJDT.js → billing-DHGSNM6E.js} +107 -87
  26. package/dist/cli/{billing-EOPUJ4JI.mjs → billing-DT4JT4QN.mjs} +34 -14
  27. package/dist/cli/{chunk-CH4VMDB5.js → chunk-27GSBTWD.js} +70 -52
  28. package/dist/cli/{chunk-PQQNMMWM.mjs → chunk-27PXHD2P.mjs} +1 -1
  29. package/dist/cli/{chunk-ACDXGOXE.js → chunk-33O2JGHE.js} +63 -11
  30. package/dist/cli/{chunk-255O6APS.js → chunk-3GIM7XRH.js} +2 -2
  31. package/dist/cli/{chunk-6IJJCRE5.mjs → chunk-3PHOAUU4.mjs} +23 -5
  32. package/dist/cli/{chunk-NC52JG66.js → chunk-3SGA53DX.js} +3 -3
  33. package/dist/cli/{chunk-RHIFH3GD.mjs → chunk-6C3QY5JS.mjs} +1 -1
  34. package/dist/cli/{chunk-NJMYX2TP.mjs → chunk-6QIXWFPO.mjs} +3 -3
  35. package/dist/cli/chunk-7I4B6V2S.mjs +127 -0
  36. package/dist/cli/{chunk-MZSLFWOT.js → chunk-7UFFWPQ2.js} +13 -9
  37. package/dist/cli/{chunk-RGNMMDSJ.js → chunk-AFHFZU5V.js} +37 -37
  38. package/dist/cli/{chunk-KWQNNPMH.js → chunk-AKVNUNL7.js} +3 -3
  39. package/dist/cli/{chunk-LXKGZKTL.js → chunk-CK2Q6AWR.js} +26 -26
  40. package/dist/cli/{chunk-DFKHXZQ7.mjs → chunk-D6MLXRMQ.mjs} +10 -10
  41. package/dist/cli/{chunk-7CILZKLE.js → chunk-EMVWC5LP.js} +5 -5
  42. package/dist/cli/{chunk-75NLWBYQ.js → chunk-FBEXJVQL.js} +93 -93
  43. package/dist/cli/{chunk-JS4UO6G4.mjs → chunk-FKEZ5DIJ.mjs} +2 -1
  44. package/dist/cli/{chunk-ZDPL5AIK.js → chunk-FV7WGK5X.js} +5 -5
  45. package/dist/cli/{chunk-E2CUSH56.js → chunk-G6V34EQ5.js} +16 -16
  46. package/dist/cli/{chunk-DS3DZUES.mjs → chunk-GICSDK72.mjs} +2 -2
  47. package/dist/cli/{chunk-C2V2HQDW.mjs → chunk-GONL4EFT.mjs} +2 -2
  48. package/dist/cli/{chunk-6KKDIISC.js → chunk-GQCH6Y7W.js} +1 -1
  49. package/dist/cli/{chunk-3UKKM6OS.js → chunk-GSULE54L.js} +7 -6
  50. package/dist/cli/{chunk-2YNLW43I.mjs → chunk-GZ43YXHT.mjs} +2 -2
  51. package/dist/cli/{chunk-UYA7LJGC.mjs → chunk-IL5AF6AR.mjs} +4 -2
  52. package/dist/cli/{chunk-R5FNCFEK.js → chunk-J5VDE42G.js} +3 -3
  53. package/dist/cli/{chunk-KMXBZIKO.mjs → chunk-JFGOMQW6.mjs} +2 -2
  54. package/dist/cli/{chunk-C46DWB56.mjs → chunk-JKUFOP7M.mjs} +1 -1
  55. package/dist/cli/{chunk-23EEVP5W.js → chunk-JMCTNS6S.js} +6 -6
  56. package/dist/cli/{chunk-ISEUOYCB.mjs → chunk-JNFNNJ75.mjs} +4 -4
  57. package/dist/cli/{chunk-C2AN2HTB.mjs → chunk-K5RRY7DJ.mjs} +4 -4
  58. package/dist/cli/{chunk-M2UL4ZS5.js → chunk-LXYDN5FE.js} +7 -7
  59. package/dist/cli/{chunk-3W6E3WVU.js → chunk-N4M6CO5H.js} +9 -9
  60. package/dist/cli/{chunk-RLCAECZH.mjs → chunk-N7E25EU2.mjs} +5 -5
  61. package/dist/cli/{chunk-YZA5UJXM.mjs → chunk-O5BUFQ2P.mjs} +1 -1
  62. package/dist/cli/{chunk-WFVEMDQL.js → chunk-OKAZHDYN.js} +4 -2
  63. package/dist/cli/{chunk-4RAENEAX.js → chunk-OVFCPV24.js} +53 -53
  64. package/dist/cli/{chunk-NO7ZC2GV.mjs → chunk-PUOKABQF.mjs} +5 -5
  65. package/dist/cli/{chunk-SG2SZQ4K.mjs → chunk-RJVUILW4.mjs} +2 -2
  66. package/dist/cli/{chunk-SVU2VR6Q.mjs → chunk-TZCHXF4R.mjs} +2 -2
  67. package/dist/cli/{chunk-XQLYPHYW.mjs → chunk-UOYA35OT.mjs} +1 -1
  68. package/dist/cli/{chunk-THMGJOR4.js → chunk-VKBLXJCK.js} +8 -8
  69. package/dist/cli/{chunk-UBNS6GSV.js → chunk-VRZXGJXH.js} +21 -21
  70. package/dist/cli/{chunk-DMWHEYZM.js → chunk-W4HIOBQQ.js} +2 -2
  71. package/dist/cli/{chunk-347EE4YE.js → chunk-W6N2S5N7.js} +8 -8
  72. package/dist/cli/{chunk-WRHLAAGN.mjs → chunk-XBYW5EHY.mjs} +1 -1
  73. package/dist/cli/{chunk-LJYTYNQZ.mjs → chunk-XDFARN7U.mjs} +55 -3
  74. package/dist/cli/{chunk-2QT6KN54.js → chunk-Y2MVDYV6.js} +10 -10
  75. package/dist/cli/{chunk-QODW5ILA.mjs → chunk-YC2QBF2W.mjs} +2 -2
  76. package/dist/cli/chunk-YGCKMI5P.js +127 -0
  77. package/dist/cli/{chunk-3A7TDUZV.mjs → chunk-ZBSUXXZS.mjs} +13 -9
  78. package/dist/cli/{chunk-2GZFIWSA.mjs → chunk-ZJRVHQSZ.mjs} +4 -4
  79. package/dist/cli/command-docs.js +2 -2
  80. package/dist/cli/command-docs.mjs +1 -1
  81. package/dist/cli/{csv-ECB7TYR2.js → csv-DQWOZ2BL.js} +13 -13
  82. package/dist/cli/{csv-IDRPTSSC.mjs → csv-JXFOD7DJ.mjs} +4 -4
  83. package/dist/cli/{db-FOBZD44N.mjs → db-NOGMZAQE.mjs} +6 -6
  84. package/dist/cli/{db-S74XZZ77.js → db-Q2OAAXRX.js} +27 -27
  85. package/dist/cli/describe-THHHNUEA.js +48 -0
  86. package/dist/cli/{describe-KMTPPI2J.mjs → describe-VKZTZLX6.mjs} +17 -17
  87. package/dist/cli/describe-core.d.mts +3 -3
  88. package/dist/cli/describe-core.d.ts +3 -3
  89. package/dist/cli/{executions-ZE3JMNA4.js → executions-B3GDZ4GQ.js} +8 -8
  90. package/dist/cli/{executions-4JAIVE2E.mjs → executions-XU3JMNI3.mjs} +6 -6
  91. package/dist/cli/{feedback-W6VA47A3.js → feedback-5IW3ZKRP.js} +8 -8
  92. package/dist/cli/{feedback-EUX5PDBA.mjs → feedback-R5UQXINE.mjs} +4 -4
  93. package/dist/cli/{git-UOVG4PLH.mjs → git-7B4H7VEL.mjs} +5 -5
  94. package/dist/cli/git-BX27JAW4.js +25 -0
  95. package/dist/cli/index.js +161 -142
  96. package/dist/cli/index.mjs +65 -46
  97. package/dist/cli/{legacy-noops-3H35EH5Y.js → legacy-noops-AVT6T5QI.js} +8 -8
  98. package/dist/cli/{legacy-noops-ZBWUNFWV.mjs → legacy-noops-KY7JAALE.mjs} +5 -5
  99. package/dist/cli/{monitors-AYSGSUAK.mjs → monitors-G7L7AFXR.mjs} +7 -7
  100. package/dist/cli/{monitors-PI3KPLR2.js → monitors-GZB6CWK2.js} +91 -91
  101. package/dist/cli/{org-2BIG7U4V.mjs → org-QDUBOQTH.mjs} +6 -6
  102. package/dist/cli/{org-MVS3Y6BK.js → org-ZHHKAPCE.js} +72 -72
  103. package/dist/cli/{pages-VB6FOVDE.js → pages-5P3SPMN5.js} +17 -17
  104. package/dist/cli/{pages-4TRRL24G.mjs → pages-Q4WGQCST.mjs} +6 -6
  105. package/dist/cli/{play-BLT6IT2O.js → play-IRLKESZB.js} +585 -678
  106. package/dist/cli/{play-JR3VUOZM.mjs → play-WRSHD4RE.mjs} +26 -119
  107. package/dist/cli/{providers-547DPK4S.mjs → providers-7CQUHS57.mjs} +6 -6
  108. package/dist/cli/{providers-BBXIAGW4.js → providers-LKEYLN6D.js} +9 -9
  109. package/dist/cli/{quickstart-NTLXD7HS.mjs → quickstart-I6NYGMEE.mjs} +4 -4
  110. package/dist/cli/{quickstart-RNPI5B6J.js → quickstart-KS45M5SR.js} +6 -6
  111. package/dist/cli/{run-QZ4SFECD.mjs → run-AZETCL7R.mjs} +22 -22
  112. package/dist/cli/{run-BCCEXBOG.js → run-BLMOBNAN.js} +36 -36
  113. package/dist/cli/{search-PYNELH4C.mjs → search-EEKEP67Y.mjs} +7 -7
  114. package/dist/cli/search-PEQXXY2B.js +32 -0
  115. package/dist/cli/{secrets-O5WGREQ7.mjs → secrets-HAULG2EW.mjs} +6 -6
  116. package/dist/cli/{secrets-VD35LMYJ.js → secrets-M6NU3TD2.js} +15 -15
  117. package/dist/cli/{sessions-2TL6Z5J5.mjs → sessions-5MB4XKOK.mjs} +5 -5
  118. package/dist/cli/{sessions-NGGIBYXF.js → sessions-DSR5AHIA.js} +6 -6
  119. package/dist/cli/{settings-ERFNZRHO.js → settings-6US327NQ.js} +78 -78
  120. package/dist/cli/{settings-6KM74AJT.mjs → settings-JUQP4HYQ.mjs} +11 -11
  121. package/dist/cli/{setup-6X7EJ6RG.js → setup-5ZRSEQUD.js} +44 -44
  122. package/dist/cli/{setup-Y3BN6XRS.mjs → setup-JRH4UC47.mjs} +9 -9
  123. package/dist/cli/{skills-OUBQASHI.mjs → skills-HFOZ5WDH.mjs} +7 -7
  124. package/dist/cli/skills-P67KCVDR.js +33 -0
  125. package/dist/cli/{tools-EELZ5FF5.mjs → tools-CJEBZNPB.mjs} +16 -16
  126. package/dist/cli/tools-PDBEAI22.js +55 -0
  127. package/dist/cli/update-G6DI3BQW.js +33 -0
  128. package/dist/cli/{update-TX7SW32Y.mjs → update-VQJEPAAK.mjs} +9 -9
  129. package/dist/cli/{workflow-PUNQG7LG.mjs → workflow-EYWE3T75.mjs} +7 -7
  130. package/dist/cli/{workflow-5AI2BJA7.js → workflow-NKPDRZOP.js} +17 -17
  131. package/dist/{client-AjmfA5nR.d.mts → client-B9N1bcGc.d.mts} +1 -1
  132. package/dist/{client-DMyY-QL8.d.ts → client-Btw075Hq.d.ts} +1 -1
  133. package/dist/{client-core-C705vFyV.d.ts → client-core-DvGWlwtX.d.ts} +45 -6
  134. package/dist/{client-core-CpBbvLEX.d.mts → client-core-TulbIeRB.d.mts} +45 -6
  135. package/dist/{compiler-manifest-hqIAukR0.d.mts → compiler-manifest-gkO9ZkVg.d.mts} +37 -17
  136. package/dist/{compiler-manifest-hqIAukR0.d.ts → compiler-manifest-gkO9ZkVg.d.ts} +37 -17
  137. package/dist/{errors-CRO2qQ6k.d.ts → errors-Cc92LKH-.d.ts} +1 -1
  138. package/dist/{errors-DIHVetNY.d.mts → errors-CeCCOKSA.d.mts} +1 -1
  139. package/dist/{index-B8DVoeYt.d.ts → index-DJQKdV76.d.ts} +1 -1
  140. package/dist/{index-DVZ_X4Gb.d.mts → index-DsqWJL3Q.d.mts} +1 -1
  141. package/dist/index.d.mts +15 -9
  142. package/dist/index.d.ts +15 -9
  143. package/dist/index.js +9 -9
  144. package/dist/index.mjs +6 -6
  145. package/dist/install-integrity.json +112 -110
  146. package/dist/plays/bundle-play-file.d.mts +3 -3
  147. package/dist/plays/bundle-play-file.d.ts +3 -3
  148. package/dist/plays/bundle-play-file.mjs +2 -1
  149. package/dist/plays/play-description.d.mts +2 -2
  150. package/dist/plays/play-description.d.ts +2 -2
  151. package/dist/plays/run-request.d.mts +2 -2
  152. package/dist/plays/run-request.d.ts +2 -2
  153. package/dist/release.d.mts +1 -1
  154. package/dist/release.d.ts +1 -1
  155. package/dist/release.js +2 -2
  156. package/dist/release.mjs +1 -1
  157. package/dist/server.d.mts +4 -4
  158. package/dist/server.d.ts +4 -4
  159. package/dist/server.js +5 -5
  160. package/dist/server.mjs +3 -3
  161. package/package.json +1 -1
  162. package/dist/cli/auth-QITP34OX.js +0 -41
  163. package/dist/cli/describe-PI7HCT7K.js +0 -48
  164. package/dist/cli/git-NDOGCQZY.js +0 -25
  165. package/dist/cli/search-YHEICYQL.js +0 -32
  166. package/dist/cli/skills-F7MPYC4P.js +0 -33
  167. package/dist/cli/tools-MCWDAK53.js +0 -55
  168. package/dist/cli/update-G5BRJOVT.js +0 -33
@@ -1,10 +1,13 @@
1
+ import {
2
+ PLAY_SANDBOX_SIZE_INPUTS
3
+ } from "./chunk-7I4B6V2S.mjs";
1
4
  import {
2
5
  DeeplineClient
3
- } from "./chunk-SG2SZQ4K.mjs";
6
+ } from "./chunk-RJVUILW4.mjs";
4
7
  import {
5
8
  iterateCursorPages,
6
9
  requireBillingIdempotencyKey
7
- } from "./chunk-JS4UO6G4.mjs";
10
+ } from "./chunk-FKEZ5DIJ.mjs";
8
11
  import "./chunk-L2VKAASU.mjs";
9
12
  import "./chunk-NELMCOWK.mjs";
10
13
  import "./chunk-S3A4IXBQ.mjs";
@@ -15,9 +18,9 @@ import {
15
18
  openInBrowser,
16
19
  printCommandEnvelope,
17
20
  shouldEmitJson
18
- } from "./chunk-QODW5ILA.mjs";
19
- import "./chunk-YZA5UJXM.mjs";
20
- import "./chunk-LJYTYNQZ.mjs";
21
+ } from "./chunk-YC2QBF2W.mjs";
22
+ import "./chunk-O5BUFQ2P.mjs";
23
+ import "./chunk-XDFARN7U.mjs";
21
24
  import {
22
25
  AuthError,
23
26
  ConfigError
@@ -26,7 +29,7 @@ import "./chunk-DLIRSHV6.mjs";
26
29
  import {
27
30
  DeeplineError
28
31
  } from "./chunk-HBL4PM5Q.mjs";
29
- import "./chunk-PQQNMMWM.mjs";
32
+ import "./chunk-27PXHD2P.mjs";
30
33
  import "./chunk-WZYKRD7T.mjs";
31
34
  import "./chunk-KRD6H754.mjs";
32
35
 
@@ -476,6 +479,17 @@ async function handleUsageEvents(options) {
476
479
  );
477
480
  }
478
481
  async function handleUsage(options) {
482
+ if (options.events && options.recentOnly) {
483
+ reportBillingFailure(
484
+ {
485
+ exitCode: 2,
486
+ code: "CONFLICTING_USAGE_FILTERS",
487
+ message: "--recent-only cannot be combined with --events."
488
+ },
489
+ options
490
+ );
491
+ return;
492
+ }
479
493
  if (options.events) return handleUsageEvents(options);
480
494
  const { http } = getAuthedHttpClient();
481
495
  const params = new URLSearchParams();
@@ -505,6 +519,7 @@ async function handleUsage(options) {
505
519
  }
506
520
  params.set("request_id", requestId);
507
521
  } else {
522
+ if (options.recentOnly) params.set("recent_only", "true");
508
523
  if (options.limit) params.set("recent_limit", options.limit);
509
524
  if (options.offset) params.set("recent_offset", options.offset);
510
525
  if (options.cursor) params.set("recent_cursor", options.cursor);
@@ -536,18 +551,20 @@ async function handleUsage(options) {
536
551
  const recent = payload.recent ?? {};
537
552
  const last30Usage = usage.last_30_days_usage_credits ?? usage.month_spent_credits;
538
553
  const temporaryHolds = Number(usage.temporary_hold_credits ?? 0);
539
- const nextPage = typeof recent.next_cursor === "string" && recent.next_cursor.length > 0 ? `deepline billing usage --cursor ${quoteShellArgument(recent.next_cursor)}${options.limit ? ` --limit ${options.limit}` : ""}${options.runId ? ` --run-id ${quoteShellArgument(options.runId)}` : ""}` : null;
554
+ const nextPage = typeof recent.next_cursor === "string" && recent.next_cursor.length > 0 ? `deepline billing usage${options.recentOnly ? " --recent-only" : ""} --cursor ${quoteShellArgument(recent.next_cursor)}${options.limit ? ` --limit ${options.limit}` : ""}${options.runId ? ` --run-id ${quoteShellArgument(options.runId)}` : ""}` : null;
540
555
  const recentLines = recentUsageLines(
541
556
  Array.isArray(recent.entries) ? recent.entries : []
542
557
  );
543
558
  const matchingActivity = typeof recent.total === "number" && Number.isFinite(recent.total) && recent.total >= 0 && typeof recent.total_is_exact === "boolean" ? recent.total_is_exact ? `Matching activity: ${recent.total}` : typeof recent.total_lower_bound === "number" && Number.isFinite(recent.total_lower_bound) && recent.total_lower_bound >= 0 ? `Matching activity: at least ${recent.total_lower_bound}` : `Matching activity: count not exact (reported ${recent.total})` : null;
544
559
  const lines = options.requestId ? [`Charge lookup: ${options.requestId}`, ...recentLines] : [
545
- `Balance: ${payload.balance ?? "(unknown)"}`,
546
- `Last 30 days usage: ${last30Usage ?? "(unknown)"}`,
547
- ...Number.isFinite(temporaryHolds) && temporaryHolds > 0 ? [`Temporary holds: ${temporaryHolds}`] : [],
548
- `Monthly usage cap: ${quota.enabled ? quota.monthly_credits_limit ?? "(unknown)" : "off"}`,
549
- ...options.runId && recent.run_id ? [
550
- `Run spend: ${(payload.run ?? {}).spent_credits ?? "(unknown)"} Deepline Credits`
560
+ ...!options.recentOnly ? [
561
+ `Balance: ${payload.balance ?? "(unknown)"}`,
562
+ `Last 30 days usage: ${last30Usage ?? "(unknown)"}`,
563
+ ...Number.isFinite(temporaryHolds) && temporaryHolds > 0 ? [`Temporary holds: ${temporaryHolds}`] : [],
564
+ `Monthly usage cap: ${quota.enabled ? quota.monthly_credits_limit ?? "(unknown)" : "off"}`,
565
+ ...options.runId && recent.run_id ? [
566
+ `Run spend: ${(payload.run ?? {}).spent_credits ?? "(unknown)"} Deepline Credits`
567
+ ] : []
551
568
  ] : [],
552
569
  ...matchingActivity ? [matchingActivity] : [],
553
570
  ...recentLines,
@@ -1595,7 +1612,7 @@ Examples:
1595
1612
  "--sandbox-timeout <duration>",
1596
1613
  "Runtime timeout, such as 30m or 2h"
1597
1614
  ).addOption(
1598
- new Option("--sandbox-size <size>", "Runtime memory profile").choices(["standard", "large", "xlarge"]).default("standard")
1615
+ new Option("--sandbox-size <size>", "Runtime memory profile").choices([...PLAY_SANDBOX_SIZE_INPUTS]).default("standard")
1599
1616
  ).option("--quantity <sessions>", "Number of sandbox sessions", "1").option("--json", "Emit the bounded component quotation as JSON").action(
1600
1617
  async (options) => {
1601
1618
  const quantity = Number(options.quantity);
@@ -1660,6 +1677,9 @@ Examples:
1660
1677
  ).option(
1661
1678
  "--events",
1662
1679
  "Read a raw usage-event page instead of the billing summary"
1680
+ ).option(
1681
+ "--recent-only",
1682
+ "Read recent billing activity without spend totals"
1663
1683
  ).option("--limit <n>", "Page size (1\u2013500 with --events)").option("--offset <n>", "Recent-call offset").option(
1664
1684
  "--cursor <cursor>",
1665
1685
  "Recent-call cursor from the previous response"
@@ -2,7 +2,7 @@
2
2
 
3
3
 
4
4
 
5
- var _chunkM2UL4ZS5js = require('./chunk-M2UL4ZS5.js');
5
+ var _chunkLXYDN5FEjs = require('./chunk-LXYDN5FE.js');
6
6
 
7
7
 
8
8
 
@@ -22,12 +22,17 @@ var _chunkM2UL4ZS5js = require('./chunk-M2UL4ZS5.js');
22
22
 
23
23
 
24
24
 
25
- var _chunkNC52JG66js = require('./chunk-NC52JG66.js');
25
+ var _chunk3SGA53DXjs = require('./chunk-3SGA53DX.js');
26
26
 
27
27
 
28
28
 
29
29
 
30
- var _chunkACDXGOXEjs = require('./chunk-ACDXGOXE.js');
30
+
31
+
32
+ var _chunk33O2JGHEjs = require('./chunk-33O2JGHE.js');
33
+
34
+
35
+ var _chunkDIAWYWT5js = require('./chunk-DIAWYWT5.js');
31
36
 
32
37
  // src/cli/commands/auth.ts
33
38
 
@@ -54,7 +59,7 @@ function statusBannerLine(value) {
54
59
  return `Service notice: ${banner.message}`;
55
60
  }
56
61
  function envFilePath(baseUrl) {
57
- return _chunkNC52JG66js.hostEnvFilePath.call(void 0, baseUrl);
62
+ return _chunk3SGA53DXjs.hostEnvFilePath.call(void 0, baseUrl);
58
63
  }
59
64
  function normalizeAuthScope(value) {
60
65
  if (!value || value === "global") return "global";
@@ -67,7 +72,7 @@ function parseAuthScope(args) {
67
72
  }
68
73
  function pendingClaimPath(baseUrl, scope) {
69
74
  if (scope === "folder") {
70
- const target = _chunkNC52JG66js.resolveProjectPinTarget.call(void 0, );
75
+ const target = _chunk3SGA53DXjs.resolveProjectPinTarget.call(void 0, );
71
76
  if (!target.ok) {
72
77
  throw new Error(
73
78
  `Cowork project folder is ambiguous. Candidate folders: ${target.candidates.join(
@@ -77,10 +82,10 @@ function pendingClaimPath(baseUrl, scope) {
77
82
  }
78
83
  return _path.join.call(void 0, target.dir, ".deepline", "setup", "pending-auth.json");
79
84
  }
80
- return `${_chunkNC52JG66js.hostConfigDirPath.call(void 0, baseUrl)}/pending-auth.json`;
85
+ return `${_chunk3SGA53DXjs.hostConfigDirPath.call(void 0, baseUrl)}/pending-auth.json`;
81
86
  }
82
87
  function legacyPendingClaimTokenPath(baseUrl) {
83
- return `${_chunkNC52JG66js.hostConfigDirPath.call(void 0, baseUrl)}/pending-claim-token`;
88
+ return `${_chunk3SGA53DXjs.hostConfigDirPath.call(void 0, baseUrl)}/pending-claim-token`;
84
89
  }
85
90
  function savePendingClaim(baseUrl, claim) {
86
91
  const filePath = pendingClaimPath(baseUrl, claim.scope);
@@ -182,21 +187,21 @@ function parseRegisterWaitMode(args) {
182
187
  function shouldWaitForRegisterClaim(mode) {
183
188
  if (mode === "yes") return true;
184
189
  if (mode === "no") return false;
185
- return _chunkACDXGOXEjs.detectAgentRuntime.call(void 0, ) !== "claude_cowork";
190
+ return _chunk33O2JGHEjs.detectAgentRuntime.call(void 0, ) !== "claude_cowork";
186
191
  }
187
192
  function saveEnvValues(values, baseUrl, scope) {
188
193
  const filtered = {
189
- ...values[_chunkNC52JG66js.HOST_URL_ENV] ? { [_chunkNC52JG66js.HOST_URL_ENV]: values[_chunkNC52JG66js.HOST_URL_ENV] } : {},
190
- ...values[_chunkNC52JG66js.API_KEY_ENV] ? { [_chunkNC52JG66js.API_KEY_ENV]: values[_chunkNC52JG66js.API_KEY_ENV] } : {},
191
- ...values[_chunkNC52JG66js.ACTIVE_ORG_ID_ENV] ? { [_chunkNC52JG66js.ACTIVE_ORG_ID_ENV]: values[_chunkNC52JG66js.ACTIVE_ORG_ID_ENV] } : {},
192
- ...Object.prototype.hasOwnProperty.call(values, _chunkNC52JG66js.ACTIVE_ORG_NAME_ENV) ? { [_chunkNC52JG66js.ACTIVE_ORG_NAME_ENV]: values[_chunkNC52JG66js.ACTIVE_ORG_NAME_ENV] } : {},
194
+ ...values[_chunk3SGA53DXjs.HOST_URL_ENV] ? { [_chunk3SGA53DXjs.HOST_URL_ENV]: values[_chunk3SGA53DXjs.HOST_URL_ENV] } : {},
195
+ ...values[_chunk3SGA53DXjs.API_KEY_ENV] ? { [_chunk3SGA53DXjs.API_KEY_ENV]: values[_chunk3SGA53DXjs.API_KEY_ENV] } : {},
196
+ ...values[_chunk3SGA53DXjs.ACTIVE_ORG_ID_ENV] ? { [_chunk3SGA53DXjs.ACTIVE_ORG_ID_ENV]: values[_chunk3SGA53DXjs.ACTIVE_ORG_ID_ENV] } : {},
197
+ ...Object.prototype.hasOwnProperty.call(values, _chunk3SGA53DXjs.ACTIVE_ORG_NAME_ENV) ? { [_chunk3SGA53DXjs.ACTIVE_ORG_NAME_ENV]: values[_chunk3SGA53DXjs.ACTIVE_ORG_NAME_ENV] } : {},
193
198
  // An explicit empty list must reach the store: it clears a stale line.
194
- ...Object.prototype.hasOwnProperty.call(values, _chunkNC52JG66js.FEATURES_ENV) ? { [_chunkNC52JG66js.FEATURES_ENV]: values[_chunkNC52JG66js.FEATURES_ENV] } : {}
199
+ ...Object.prototype.hasOwnProperty.call(values, _chunk3SGA53DXjs.FEATURES_ENV) ? { [_chunk3SGA53DXjs.FEATURES_ENV]: values[_chunk3SGA53DXjs.FEATURES_ENV] } : {}
195
200
  };
196
201
  if (scope === "folder") {
197
- _chunkNC52JG66js.saveProjectDeeplineEnvValues.call(void 0, filtered);
202
+ _chunk3SGA53DXjs.saveProjectDeeplineEnvValues.call(void 0, filtered);
198
203
  } else {
199
- _chunkNC52JG66js.saveHostEnvValues.call(void 0, baseUrl, filtered);
204
+ _chunk3SGA53DXjs.saveHostEnvValues.call(void 0, baseUrl, filtered);
200
205
  }
201
206
  }
202
207
  function activeOrgEnvValues(data) {
@@ -204,21 +209,21 @@ function activeOrgEnvValues(data) {
204
209
  if (!orgId) return {};
205
210
  const orgName = typeof data.org_name === "string" ? data.org_name.trim() : "";
206
211
  return {
207
- [_chunkNC52JG66js.ACTIVE_ORG_ID_ENV]: orgId,
208
- [_chunkNC52JG66js.ACTIVE_ORG_NAME_ENV]: orgName,
209
- ..._chunkNC52JG66js.featureEnvValues.call(void 0, data)
212
+ [_chunk3SGA53DXjs.ACTIVE_ORG_ID_ENV]: orgId,
213
+ [_chunk3SGA53DXjs.ACTIVE_ORG_NAME_ENV]: orgName,
214
+ ..._chunk3SGA53DXjs.featureEnvValues.call(void 0, data)
210
215
  };
211
216
  }
212
217
  async function httpJson(method, url, apiKey, body, timeoutMs = AUTH_HTTP_TIMEOUT_MS) {
213
218
  const headers = {
214
219
  "Content-Type": "application/json",
215
- "User-Agent": `deepline-ts-sdk/${_chunkACDXGOXEjs.SDK_VERSION}`,
220
+ "User-Agent": `deepline-ts-sdk/${_chunk33O2JGHEjs.SDK_VERSION}`,
216
221
  "X-Deepline-Client-Family": "sdk",
217
222
  "X-Deepline-CLI-Family": "sdk",
218
- "X-Deepline-Agent-Runtime": _chunkACDXGOXEjs.detectAgentRuntime.call(void 0, ),
219
- "X-Deepline-CLI-Version": _chunkACDXGOXEjs.SDK_VERSION,
220
- "X-Deepline-SDK-Version": _chunkACDXGOXEjs.SDK_VERSION,
221
- "X-Deepline-API-Contract": _chunkACDXGOXEjs.SDK_API_CONTRACT
223
+ "X-Deepline-Agent-Runtime": _chunk33O2JGHEjs.detectAgentRuntime.call(void 0, ),
224
+ "X-Deepline-CLI-Version": _chunk33O2JGHEjs.SDK_VERSION,
225
+ "X-Deepline-SDK-Version": _chunk33O2JGHEjs.SDK_VERSION,
226
+ "X-Deepline-API-Contract": _chunk33O2JGHEjs.SDK_API_CONTRACT
222
227
  };
223
228
  if (apiKey) headers["Authorization"] = `Bearer ${apiKey}`;
224
229
  const bypassToken = _optionalChain([process, 'access', _7 => _7.env, 'access', _8 => _8.VERCEL_PROTECTION_BYPASS_TOKEN, 'optionalAccess', _9 => _9.trim, 'call', _10 => _10()]);
@@ -253,7 +258,20 @@ async function httpJson(method, url, apiKey, body, timeoutMs = AUTH_HTTP_TIMEOUT
253
258
  clearTimeout(timeout);
254
259
  }
255
260
  }
256
- throw lastError instanceof Error ? lastError : new Error(String(lastError));
261
+ const failure = lastError instanceof Error ? lastError : new Error(String(lastError));
262
+ if (failure.name === "AbortError" || failure.name === "TimeoutError") {
263
+ throw failure;
264
+ }
265
+ const causeCode = _chunk33O2JGHEjs.networkCauseCode.call(void 0, failure);
266
+ throw Object.assign(
267
+ new (0, _chunkDIAWYWT5js.DeeplineError)(
268
+ _chunk33O2JGHEjs.connectionFailureMessage.call(void 0, new URL(url).origin, failure),
269
+ void 0,
270
+ "NETWORK_ERROR",
271
+ causeCode ? { causeCode } : void 0
272
+ ),
273
+ { cause: failure }
274
+ );
257
275
  }
258
276
  async function readStatusBanner(baseUrl) {
259
277
  const response = await httpJson(
@@ -264,7 +282,7 @@ async function readStatusBanner(baseUrl) {
264
282
  return _optionalChain([response, 'optionalAccess', _11 => _11.status]) === 200 ? _nullishCoalesce(response.data.banner, () => ( null)) : null;
265
283
  }
266
284
  async function reportSetupCompleted(input) {
267
- const apiKey = input.authScope === "folder" ? _chunkNC52JG66js.resolveProjectApiKeyForBaseUrl.call(void 0, input.baseUrl) : _chunkNC52JG66js.resolveGlobalApiKeyForBaseUrl.call(void 0, input.baseUrl);
285
+ const apiKey = input.authScope === "folder" ? _chunk3SGA53DXjs.resolveProjectApiKeyForBaseUrl.call(void 0, input.baseUrl) : _chunk3SGA53DXjs.resolveGlobalApiKeyForBaseUrl.call(void 0, input.baseUrl);
268
286
  if (!apiKey) return;
269
287
  try {
270
288
  await httpJson(
@@ -361,7 +379,7 @@ async function printClaimSuccessBanner(baseUrl, apiKey, statusData) {
361
379
  }
362
380
  }
363
381
  async function handleRegister(args) {
364
- const baseUrl = _chunkNC52JG66js.autoDetectBaseUrl.call(void 0, ).replace(/\/$/, "");
382
+ const baseUrl = _chunk3SGA53DXjs.autoDetectBaseUrl.call(void 0, ).replace(/\/$/, "");
365
383
  let orgName = "";
366
384
  let orgId = "";
367
385
  let agentName = "";
@@ -416,19 +434,19 @@ async function handleRegister(args) {
416
434
  });
417
435
  saveEnvValues(
418
436
  {
419
- [_chunkNC52JG66js.HOST_URL_ENV]: baseUrl
437
+ [_chunk3SGA53DXjs.HOST_URL_ENV]: baseUrl
420
438
  },
421
439
  baseUrl,
422
440
  authScope
423
441
  );
424
442
  }
425
443
  if (claimUrl) {
426
- const shouldOpen = waitMode !== "no" && _chunkACDXGOXEjs.detectAgentRuntime.call(void 0, ) !== "claude_cowork";
444
+ const shouldOpen = waitMode !== "no" && _chunk33O2JGHEjs.detectAgentRuntime.call(void 0, ) !== "claude_cowork";
427
445
  console.log(
428
446
  shouldOpen ? " Opening approval page in your browser." : " Open this approval page in your browser:"
429
447
  );
430
448
  console.log(` ${claimUrl}`);
431
- if (shouldOpen) _chunkM2UL4ZS5js.openInBrowser.call(void 0, claimUrl);
449
+ if (shouldOpen) _chunkLXYDN5FEjs.openInBrowser.call(void 0, claimUrl);
432
450
  }
433
451
  if (data.cli_message) {
434
452
  console.log(String(data.cli_message));
@@ -471,8 +489,8 @@ async function handleRegister(args) {
471
489
  if (apiKey) {
472
490
  saveEnvValues(
473
491
  {
474
- [_chunkNC52JG66js.HOST_URL_ENV]: baseUrl,
475
- [_chunkNC52JG66js.API_KEY_ENV]: apiKey,
492
+ [_chunk3SGA53DXjs.HOST_URL_ENV]: baseUrl,
493
+ [_chunk3SGA53DXjs.API_KEY_ENV]: apiKey,
476
494
  ...activeOrgEnvValues(statusData)
477
495
  },
478
496
  baseUrl,
@@ -494,7 +512,7 @@ async function handleRegister(args) {
494
512
  }
495
513
  }
496
514
  async function handleWait(args) {
497
- const baseUrl = _chunkNC52JG66js.autoDetectBaseUrl.call(void 0, ).replace(/\/$/, "");
515
+ const baseUrl = _chunk3SGA53DXjs.autoDetectBaseUrl.call(void 0, ).replace(/\/$/, "");
498
516
  let timeoutSeconds = 300;
499
517
  let requestedScope;
500
518
  if (args.includes("--auth-scope")) {
@@ -518,7 +536,7 @@ async function handleWait(args) {
518
536
  const authScope = resumed.scope;
519
537
  const claimToken = _nullishCoalesce(_optionalChain([pendingClaim, 'optionalAccess', _12 => _12.claimToken]), () => ( ""));
520
538
  if (!pendingClaim) {
521
- const scopedApiKey = authScope === "folder" ? _chunkNC52JG66js.resolveProjectApiKeyForBaseUrl.call(void 0, baseUrl) : _chunkNC52JG66js.resolveGlobalApiKeyForBaseUrl.call(void 0, baseUrl);
539
+ const scopedApiKey = authScope === "folder" ? _chunk3SGA53DXjs.resolveProjectApiKeyForBaseUrl.call(void 0, baseUrl) : _chunk3SGA53DXjs.resolveGlobalApiKeyForBaseUrl.call(void 0, baseUrl);
522
540
  if (scopedApiKey) {
523
541
  console.log("Already connected.");
524
542
  return EXIT_OK;
@@ -561,8 +579,8 @@ async function handleWait(args) {
561
579
  if (apiKey) {
562
580
  saveEnvValues(
563
581
  {
564
- [_chunkNC52JG66js.HOST_URL_ENV]: baseUrl,
565
- [_chunkNC52JG66js.API_KEY_ENV]: apiKey,
582
+ [_chunk3SGA53DXjs.HOST_URL_ENV]: baseUrl,
583
+ [_chunk3SGA53DXjs.API_KEY_ENV]: apiKey,
566
584
  ...activeOrgEnvValues(data)
567
585
  },
568
586
  baseUrl,
@@ -586,8 +604,8 @@ async function handleWait(args) {
586
604
  return EXIT_AUTH;
587
605
  }
588
606
  async function authStatusLine(timeoutMs = 3e3) {
589
- const baseUrl = _chunkNC52JG66js.autoDetectBaseUrl.call(void 0, ).replace(/\/$/, "");
590
- const apiKey = _chunkNC52JG66js.resolveApiKeyForBaseUrl.call(void 0, baseUrl);
607
+ const baseUrl = _chunk3SGA53DXjs.autoDetectBaseUrl.call(void 0, ).replace(/\/$/, "");
608
+ const apiKey = _chunk3SGA53DXjs.resolveApiKeyForBaseUrl.call(void 0, baseUrl);
591
609
  if (!apiKey) return `Auth: not connected (${baseUrl})`;
592
610
  try {
593
611
  const { status, data } = await httpJson(
@@ -610,9 +628,9 @@ async function authStatusLine(timeoutMs = 3e3) {
610
628
  }
611
629
  }
612
630
  async function handleStatus(args) {
613
- const baseUrl = _chunkNC52JG66js.autoDetectBaseUrl.call(void 0, ).replace(/\/$/, "");
631
+ const baseUrl = _chunk3SGA53DXjs.autoDetectBaseUrl.call(void 0, ).replace(/\/$/, "");
614
632
  const reveal = args.includes("--reveal");
615
- const jsonOutput = _chunkM2UL4ZS5js.argsWantJson.call(void 0, args);
633
+ const jsonOutput = _chunkLXYDN5FEjs.argsWantJson.call(void 0, args);
616
634
  const hasExplicitAuthScope = args.includes("--auth-scope");
617
635
  let authScope = null;
618
636
  if (hasExplicitAuthScope) {
@@ -653,14 +671,14 @@ async function handleStatus(args) {
653
671
  };
654
672
  hostLines.push(`Host: ${baseUrl} (unreachable)`);
655
673
  }
656
- const apiKey = authScope === "folder" ? _chunkNC52JG66js.resolveProjectApiKeyForBaseUrl.call(void 0, baseUrl) : authScope === "global" ? _chunkNC52JG66js.resolveGlobalApiKeyForBaseUrl.call(void 0, baseUrl) : _chunkNC52JG66js.resolveApiKeyForBaseUrl.call(void 0, baseUrl);
674
+ const apiKey = authScope === "folder" ? _chunk3SGA53DXjs.resolveProjectApiKeyForBaseUrl.call(void 0, baseUrl) : authScope === "global" ? _chunk3SGA53DXjs.resolveGlobalApiKeyForBaseUrl.call(void 0, baseUrl) : _chunk3SGA53DXjs.resolveApiKeyForBaseUrl.call(void 0, baseUrl);
657
675
  if (!apiKey) {
658
676
  const { claim: pendingClaim } = resolvePendingAuthClaimForResume(
659
677
  baseUrl,
660
678
  _nullishCoalesce(authScope, () => ( void 0))
661
679
  );
662
680
  if (pendingClaim) {
663
- _chunkM2UL4ZS5js.printCommandEnvelope.call(void 0,
681
+ _chunkLXYDN5FEjs.printCommandEnvelope.call(void 0,
664
682
  {
665
683
  ..._nullishCoalesce(hostStatusPayload, () => ( { host: baseUrl })),
666
684
  status: "pending",
@@ -681,7 +699,7 @@ async function handleStatus(args) {
681
699
  );
682
700
  return EXIT_OK;
683
701
  }
684
- _chunkM2UL4ZS5js.printCommandEnvelope.call(void 0,
702
+ _chunkLXYDN5FEjs.printCommandEnvelope.call(void 0,
685
703
  {
686
704
  ..._nullishCoalesce(hostStatusPayload, () => ( { host: baseUrl })),
687
705
  status: "not connected",
@@ -714,7 +732,7 @@ async function handleStatus(args) {
714
732
  }
715
733
  );
716
734
  if (status === 401 || status === 403) {
717
- _chunkM2UL4ZS5js.printCommandEnvelope.call(void 0,
735
+ _chunkLXYDN5FEjs.printCommandEnvelope.call(void 0,
718
736
  {
719
737
  ..._nullishCoalesce(hostStatusPayload, () => ( { host: baseUrl })),
720
738
  status: "unauthorized",
@@ -741,7 +759,7 @@ async function handleStatus(args) {
741
759
  console.error(`Auth status error (status ${status}).`);
742
760
  return EXIT_SERVER;
743
761
  }
744
- const resolvedAuthScope = _nullishCoalesce(authScope, () => ( (_chunkNC52JG66js.getResolvedProjectAuthSource.call(void 0, baseUrl, apiKey) ? "folder" : "global")));
762
+ const resolvedAuthScope = _nullishCoalesce(authScope, () => ( (_chunk3SGA53DXjs.getResolvedProjectAuthSource.call(void 0, baseUrl, apiKey) ? "folder" : "global")));
745
763
  clearSatisfiedPendingClaim(
746
764
  baseUrl,
747
765
  resolvedAuthScope,
@@ -769,28 +787,28 @@ async function handleStatus(args) {
769
787
  if (apiKeyResp) {
770
788
  saveEnvValues(
771
789
  {
772
- [_chunkNC52JG66js.HOST_URL_ENV]: baseUrl,
773
- [_chunkNC52JG66js.API_KEY_ENV]: apiKeyResp,
790
+ [_chunk3SGA53DXjs.HOST_URL_ENV]: baseUrl,
791
+ [_chunk3SGA53DXjs.API_KEY_ENV]: apiKeyResp,
774
792
  ...activeOrgEnvValues(data)
775
793
  },
776
794
  baseUrl,
777
795
  resolvedAuthScope
778
796
  );
779
797
  if (resolvedAuthScope === "folder") {
780
- const target = _chunkNC52JG66js.resolveProjectPinTarget.call(void 0, );
798
+ const target = _chunk3SGA53DXjs.resolveProjectPinTarget.call(void 0, );
781
799
  savedApiKeyPath = target.ok ? _path.join.call(void 0, target.dir, ".env.deepline") : null;
782
800
  } else {
783
801
  savedApiKeyPath = envFilePath(baseUrl);
784
802
  }
785
803
  }
786
- } else if (resolvedAuthScope === "folder" || _chunkNC52JG66js.storedHostApiKey.call(void 0, baseUrl) === apiKey) {
787
- saveEnvValues(_chunkNC52JG66js.featureEnvValues.call(void 0, data), baseUrl, resolvedAuthScope);
804
+ } else if (resolvedAuthScope === "folder" || _chunk3SGA53DXjs.storedHostApiKey.call(void 0, baseUrl) === apiKey) {
805
+ saveEnvValues(_chunk3SGA53DXjs.featureEnvValues.call(void 0, data), baseUrl, resolvedAuthScope);
788
806
  }
789
- _chunkM2UL4ZS5js.printCommandEnvelope.call(void 0,
807
+ _chunkLXYDN5FEjs.printCommandEnvelope.call(void 0,
790
808
  {
791
809
  ...payload,
792
- ..._chunkACDXGOXEjs.detectAgentRuntime.call(void 0, ) !== "unknown" ? {
793
- command_context: _chunkNC52JG66js.resolveCliCommandContext.call(void 0,
810
+ ..._chunk33O2JGHEjs.detectAgentRuntime.call(void 0, ) !== "unknown" ? {
811
+ command_context: _chunk3SGA53DXjs.resolveCliCommandContext.call(void 0,
794
812
  { baseUrl, apiKey },
795
813
  resolvedAuthScope
796
814
  )
@@ -49,7 +49,7 @@ var SDK_RELEASE = {
49
49
  // getters keep their established compatibility behavior.
50
50
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
51
51
  // 0.3.90 is the first deliberately versioned SDK release for API v3.
52
- version: "0.3.477",
52
+ version: "0.3.479",
53
53
  updateSummary: {
54
54
  introducedIn: "0.3.90",
55
55
  summary: "Play grep now returns concise results with the matched fields and terms. Automatic CLI updates are enabled by default; use `deepline settings autoupdate off` to opt out, `deepline settings autoupdate on` to re-enable updates, or `deepline settings autoupdate pin <version>` to hold an exact release."
@@ -16,12 +16,12 @@ var _chunkXNYIZMNQjs = require('./chunk-XNYIZMNQ.js');
16
16
  var _chunkDIAWYWT5js = require('./chunk-DIAWYWT5.js');
17
17
 
18
18
 
19
- var _chunk6KKDIISCjs = require('./chunk-6KKDIISC.js');
19
+ var _chunkGQCH6Y7Wjs = require('./chunk-GQCH6Y7W.js');
20
20
 
21
21
  // src/version.ts
22
- var SDK_VERSION = _chunk6KKDIISCjs.SDK_RELEASE.version;
23
- var SDK_API_MAJOR = _chunk6KKDIISCjs.SDK_RELEASE.contracts.api.currentMajor;
24
- var SDK_API_CONTRACT = _nullishCoalesce(_chunk6KKDIISCjs.SDK_RELEASE.contracts.api.legacyWireIds[0], () => ( `api-v${SDK_API_MAJOR}`));
22
+ var SDK_VERSION = _chunkGQCH6Y7Wjs.SDK_RELEASE.version;
23
+ var SDK_API_MAJOR = _chunkGQCH6Y7Wjs.SDK_RELEASE.contracts.api.currentMajor;
24
+ var SDK_API_CONTRACT = _nullishCoalesce(_chunkGQCH6Y7Wjs.SDK_RELEASE.contracts.api.legacyWireIds[0], () => ( `api-v${SDK_API_MAJOR}`));
25
25
 
26
26
  // src/agent-runtime.ts
27
27
  var _os = require('os');
@@ -208,11 +208,61 @@ function mapNetworkError(baseUrl, error, targetLabel) {
208
208
  code: "NETWORK_ABORTED"
209
209
  };
210
210
  }
211
+ const causeCode = networkCauseCode(error);
211
212
  return {
212
- message: _optionalChain([error, 'optionalAccess', _78 => _78.message]) ? `Unable to connect to ${baseUrl}. ${error.message}` : `Unable to connect to ${baseUrl}. Is the computer able to access the url?`,
213
- code: "NETWORK_ERROR"
213
+ message: connectionFailureMessage(baseUrl, error),
214
+ code: "NETWORK_ERROR",
215
+ ...causeCode ? { details: { causeCode } } : {}
214
216
  };
215
217
  }
218
+ var BLOCKED_EGRESS_CAUSE_CODES = /* @__PURE__ */ new Set([
219
+ "EPERM",
220
+ "EACCES",
221
+ "ENOTFOUND",
222
+ "EAI_AGAIN",
223
+ "ENETUNREACH",
224
+ "EHOSTUNREACH",
225
+ "ETIMEDOUT",
226
+ "UND_ERR_CONNECT_TIMEOUT"
227
+ ]);
228
+ function networkCauseCode(error) {
229
+ const seen = /* @__PURE__ */ new Set();
230
+ const queue = [error];
231
+ while (queue.length > 0) {
232
+ const current = queue.shift();
233
+ if (!current || typeof current !== "object" || seen.has(current)) continue;
234
+ seen.add(current);
235
+ const record = current;
236
+ if (typeof record.code === "string" && /^[A-Z][A-Z0-9_]+$/.test(record.code))
237
+ return record.code;
238
+ queue.push(record.cause);
239
+ if (Array.isArray(record.errors)) queue.push(...record.errors);
240
+ }
241
+ return void 0;
242
+ }
243
+ function isLoopbackHost(hostname) {
244
+ return hostname === "localhost" || hostname === "[::1]" || hostname.startsWith("127.") || hostname.endsWith(".localhost");
245
+ }
246
+ function connectionFailureMessage(baseUrl, error) {
247
+ if (!_optionalChain([error, 'optionalAccess', _78 => _78.message])) {
248
+ return `Unable to connect to ${baseUrl}. Is the computer able to access the url?`;
249
+ }
250
+ const causeCode = networkCauseCode(error);
251
+ let hostname = "";
252
+ try {
253
+ hostname = new URL(baseUrl).hostname;
254
+ } catch (e) {
255
+ }
256
+ const blocked = hostname !== "" && !isLoopbackHost(hostname) && causeCode !== void 0 && (BLOCKED_EGRESS_CAUSE_CODES.has(causeCode) || causeCode === "ECONNREFUSED");
257
+ const causeMessage = error.cause instanceof Error ? error.cause.message.slice(0, 200) : "";
258
+ const cause = _nullishCoalesce(causeCode, () => ( causeMessage));
259
+ return [
260
+ `Unable to connect to ${baseUrl}. ${error.message}${cause && !error.message.includes(cause) ? ` (${cause})` : ""}.`,
261
+ ...blocked ? [
262
+ `A sandbox, firewall, or proxy may be blocking ${hostname}; allow outbound HTTPS to it and retry.`
263
+ ] : []
264
+ ].join(" ");
265
+ }
216
266
  function describeRequestTarget(path) {
217
267
  const toolExecuteMatch = path.match(
218
268
  /^\/api\/v2\/integrations\/([^/?#]+)\/execute(?:[/?#]|$)/
@@ -227,7 +277,7 @@ function networkDiagnosticUrl(value) {
227
277
  const url = new URL(value);
228
278
  if (url.protocol !== "https:" && url.protocol !== "http:") return void 0;
229
279
  return `${url.origin}${url.pathname}`;
230
- } catch (e) {
280
+ } catch (e2) {
231
281
  return void 0;
232
282
  }
233
283
  }
@@ -260,7 +310,7 @@ var HttpClient = class {
260
310
  return this.cleanDiagnosticHeader(
261
311
  _optionalChain([this, 'access', _79 => _79.readLocalSkillsVersion, 'optionalCall', _80 => _80(this.config.baseUrl)])
262
312
  );
263
- } catch (e2) {
313
+ } catch (e3) {
264
314
  return null;
265
315
  }
266
316
  }
@@ -766,7 +816,7 @@ var HttpClient = class {
766
816
  function parseResponseBody(body) {
767
817
  try {
768
818
  return JSON.parse(body);
769
- } catch (e3) {
819
+ } catch (e4) {
770
820
  return body;
771
821
  }
772
822
  }
@@ -836,7 +886,7 @@ function buildCandidateUrls(url) {
836
886
  candidates.push(loopback.toString());
837
887
  }
838
888
  return [...new Set(candidates)];
839
- } catch (e4) {
889
+ } catch (e5) {
840
890
  return [url];
841
891
  }
842
892
  }
@@ -917,4 +967,6 @@ ${COWORK_NETWORK_HINT}`;
917
967
 
918
968
 
919
969
 
920
- exports.ATOMIC_TOOL_EXECUTE_SUPPORTED_HEADER = ATOMIC_TOOL_EXECUTE_SUPPORTED_HEADER; exports.SDK_VERSION = SDK_VERSION; exports.SDK_API_MAJOR = SDK_API_MAJOR; exports.SDK_API_CONTRACT = SDK_API_CONTRACT; exports.COORDINATOR_INTERNAL_TOKEN_HEADER = COORDINATOR_INTERNAL_TOKEN_HEADER; exports.RUNTIME_ENVIRONMENT_TOKEN_HEADER = RUNTIME_ENVIRONMENT_TOKEN_HEADER; exports.RETAINED_PIPELINE_RECEIVERS_HEADER = RETAINED_PIPELINE_RECEIVERS_HEADER; exports.agentSessionIdFromEnvironment = agentSessionIdFromEnvironment; exports.detectAgentRuntime = detectAgentRuntime; exports.deploymentProtectionHeaders = deploymentProtectionHeaders; exports.fetchWithDeploymentProtection = fetchWithDeploymentProtection; exports.HttpClient = HttpClient;
970
+
971
+
972
+ exports.ATOMIC_TOOL_EXECUTE_SUPPORTED_HEADER = ATOMIC_TOOL_EXECUTE_SUPPORTED_HEADER; exports.SDK_VERSION = SDK_VERSION; exports.SDK_API_MAJOR = SDK_API_MAJOR; exports.SDK_API_CONTRACT = SDK_API_CONTRACT; exports.COORDINATOR_INTERNAL_TOKEN_HEADER = COORDINATOR_INTERNAL_TOKEN_HEADER; exports.RUNTIME_ENVIRONMENT_TOKEN_HEADER = RUNTIME_ENVIRONMENT_TOKEN_HEADER; exports.RETAINED_PIPELINE_RECEIVERS_HEADER = RETAINED_PIPELINE_RECEIVERS_HEADER; exports.agentSessionIdFromEnvironment = agentSessionIdFromEnvironment; exports.detectAgentRuntime = detectAgentRuntime; exports.deploymentProtectionHeaders = deploymentProtectionHeaders; exports.fetchWithDeploymentProtection = fetchWithDeploymentProtection; exports.networkCauseCode = networkCauseCode; exports.connectionFailureMessage = connectionFailureMessage; exports.HttpClient = HttpClient;
@@ -1,6 +1,6 @@
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
- var _chunk4RAENEAXjs = require('./chunk-4RAENEAX.js');
3
+ var _chunkOVFCPV24js = require('./chunk-OVFCPV24.js');
4
4
 
5
5
  // src/cli/npm-script-policy.ts
6
6
  var _child_process = require('child_process');
@@ -13,7 +13,7 @@ function npmSupportsAllowScripts(version) {
13
13
  }
14
14
  function readNpmVersion(env) {
15
15
  try {
16
- const plan = _chunk4RAENEAXjs.resolveShellSpawn.call(void 0, "npm", ["--version"], process.platform, env);
16
+ const plan = _chunkOVFCPV24js.resolveShellSpawn.call(void 0, "npm", ["--version"], process.platform, env);
17
17
  const result = _child_process.spawnSync.call(void 0, plan.command, plan.args, {
18
18
  encoding: "utf8",
19
19
  env,
@@ -2,7 +2,7 @@ import {
2
2
  argsWantJson,
3
3
  openInBrowser,
4
4
  printCommandEnvelope
5
- } from "./chunk-QODW5ILA.mjs";
5
+ } from "./chunk-YC2QBF2W.mjs";
6
6
  import {
7
7
  ACTIVE_ORG_ID_ENV,
8
8
  ACTIVE_ORG_NAME_ENV,
@@ -22,12 +22,17 @@ import {
22
22
  saveHostEnvValues,
23
23
  saveProjectDeeplineEnvValues,
24
24
  storedHostApiKey
25
- } from "./chunk-YZA5UJXM.mjs";
25
+ } from "./chunk-O5BUFQ2P.mjs";
26
26
  import {
27
27
  SDK_API_CONTRACT,
28
28
  SDK_VERSION,
29
- detectAgentRuntime
30
- } from "./chunk-LJYTYNQZ.mjs";
29
+ connectionFailureMessage,
30
+ detectAgentRuntime,
31
+ networkCauseCode
32
+ } from "./chunk-XDFARN7U.mjs";
33
+ import {
34
+ DeeplineError
35
+ } from "./chunk-HBL4PM5Q.mjs";
31
36
 
32
37
  // src/cli/commands/auth.ts
33
38
  import {
@@ -253,7 +258,20 @@ async function httpJson(method, url, apiKey, body, timeoutMs = AUTH_HTTP_TIMEOUT
253
258
  clearTimeout(timeout);
254
259
  }
255
260
  }
256
- throw lastError instanceof Error ? lastError : new Error(String(lastError));
261
+ const failure = lastError instanceof Error ? lastError : new Error(String(lastError));
262
+ if (failure.name === "AbortError" || failure.name === "TimeoutError") {
263
+ throw failure;
264
+ }
265
+ const causeCode = networkCauseCode(failure);
266
+ throw Object.assign(
267
+ new DeeplineError(
268
+ connectionFailureMessage(new URL(url).origin, failure),
269
+ void 0,
270
+ "NETWORK_ERROR",
271
+ causeCode ? { causeCode } : void 0
272
+ ),
273
+ { cause: failure }
274
+ );
257
275
  }
258
276
  async function readStatusBanner(baseUrl) {
259
277
  const response = await httpJson(