deepline 0.3.535 → 0.3.536

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 (229) hide show
  1. package/dist/bundling-sources/sdk/src/client-core.ts +232 -147
  2. package/dist/bundling-sources/sdk/src/index.ts +4 -0
  3. package/dist/bundling-sources/sdk/src/plays/local-file-discovery.ts +27 -1
  4. package/dist/bundling-sources/sdk/src/plays/run-request.ts +16 -5
  5. package/dist/bundling-sources/sdk/src/release.ts +1 -1
  6. package/dist/bundling-sources/sdk/src/types.ts +2 -23
  7. package/dist/bundling-sources/shared_libs/integration-contracts/monitor-fleet-contract.ts +26 -14
  8. package/dist/bundling-sources/shared_libs/integration-contracts/monitor-input-contract.ts +33 -8
  9. package/dist/bundling-sources/shared_libs/monitors/fleets/count-drift-alert.ts +121 -0
  10. package/dist/bundling-sources/shared_libs/monitors/fleets/limits.ts +8 -0
  11. package/dist/bundling-sources/shared_libs/monitors/fleets/plan.ts +14 -82
  12. package/dist/bundling-sources/shared_libs/monitors/package.json +1 -0
  13. package/dist/bundling-sources/shared_libs/observability/scheduled-jobs.json +4 -4
  14. package/dist/bundling-sources/shared_libs/play-data-plane/r2.ts +0 -26
  15. package/dist/bundling-sources/shared_libs/play-runtime/activity-observation.ts +36 -0
  16. package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +21 -31
  17. package/dist/bundling-sources/shared_libs/play-runtime/context.ts +88 -96
  18. package/dist/bundling-sources/shared_libs/play-runtime/durable-runs-rollout.ts +12 -10
  19. package/dist/bundling-sources/shared_libs/play-runtime/durable-summary-events.ts +3 -1
  20. package/dist/bundling-sources/shared_libs/play-runtime/governor/app-runtime-rate-state-backend.ts +71 -2
  21. package/dist/bundling-sources/shared_libs/play-runtime/governor/governor.ts +9 -0
  22. package/dist/bundling-sources/shared_libs/play-runtime/governor/rate-state-backend.ts +2 -0
  23. package/dist/bundling-sources/shared_libs/play-runtime/launch-identity.ts +1 -0
  24. package/dist/bundling-sources/shared_libs/play-runtime/map-memory-limits.ts +127 -9
  25. package/dist/bundling-sources/shared_libs/play-runtime/memory-ledger.ts +15 -2
  26. package/dist/bundling-sources/shared_libs/play-runtime/prebuilt-result-quality.ts +1 -1
  27. package/dist/bundling-sources/shared_libs/play-runtime/protocol.ts +6 -0
  28. package/dist/bundling-sources/shared_libs/play-runtime/provider-capacity/fixture-capacity-simulator.ts +1 -0
  29. package/dist/bundling-sources/shared_libs/play-runtime/provider-capacity/gradient2-concurrency-controller.ts +41 -0
  30. package/dist/bundling-sources/shared_libs/play-runtime/provider-capacity/provider-capacity-policy.ts +6 -0
  31. package/dist/bundling-sources/shared_libs/play-runtime/provider-capacity/provider-concurrency-policy.ts +9 -0
  32. package/dist/bundling-sources/shared_libs/play-runtime/resource-governor.ts +7 -0
  33. package/dist/bundling-sources/shared_libs/play-runtime/run-failure.ts +2 -2
  34. package/dist/bundling-sources/shared_libs/play-runtime/run-ledger.ts +5 -2
  35. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-tool-hooks.ts +8 -3
  36. package/dist/bundling-sources/shared_libs/play-runtime/runtime-operation-contract.ts +7 -0
  37. package/dist/bundling-sources/shared_libs/play-runtime/sandbox-compute-usage.ts +31 -0
  38. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backend.ts +6 -0
  39. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +26 -1
  40. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-rate-scope.ts +11 -4
  41. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-rate-state.ts +73 -18
  42. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +169 -2
  43. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-sandbox-capacity.ts +26 -4
  44. package/dist/bundling-sources/shared_libs/play-runtime/tool-execute-retry-policy.ts +84 -49
  45. package/dist/bundling-sources/shared_libs/plays/authoring-contract.ts +37 -32
  46. package/dist/bundling-sources/shared_libs/plays/launch/input-contract.ts +13 -1
  47. package/dist/bundling-sources/shared_libs/plays/local-file-discovery.ts +68 -1
  48. package/dist/bundling-sources/shared_libs/product-notifications/configuration-draft.ts +57 -1
  49. package/dist/bundling-sources/shared_libs/product-notifications/configuration.ts +22 -9
  50. package/dist/cli/auth-6XQKFOLG.js +43 -0
  51. package/dist/cli/{auth-ZCTMB5RA.mjs → auth-KCTCUO7P.mjs} +7 -7
  52. package/dist/cli/{billing-GVFKZQH3.js → billing-4VBGZ3CT.js} +273 -112
  53. package/dist/cli/{billing-OU2ZHL72.mjs → billing-OOJHKLNS.mjs} +185 -24
  54. package/dist/cli/{chunk-FGN75ZN6.js → chunk-2B4IOGFD.js} +390 -382
  55. package/dist/cli/{chunk-KOZBZPRM.js → chunk-2FCSUOYN.js} +55 -55
  56. package/dist/cli/{chunk-T2N3B7IQ.js → chunk-2GJZLIKW.js} +8 -8
  57. package/dist/cli/{chunk-AUEUAPVS.mjs → chunk-2YWJS76L.mjs} +1 -1
  58. package/dist/cli/{chunk-W5YJYU4G.mjs → chunk-3PCYV6ZJ.mjs} +2 -2
  59. package/dist/cli/{chunk-UUQ2OXMH.js → chunk-4E5JXZ3W.js} +18 -20
  60. package/dist/cli/{chunk-R4RG4FV5.mjs → chunk-4KWD3MX2.mjs} +13 -10
  61. package/dist/cli/{chunk-XSOTEVOB.js → chunk-6BBGUQJJ.js} +50 -141
  62. package/dist/cli/{chunk-PHLNYBAA.js → chunk-6VUGBQZQ.js} +5 -5
  63. package/dist/cli/{chunk-G2DLG32W.mjs → chunk-AB2GBOD4.mjs} +40 -27
  64. package/dist/cli/{chunk-JWWYLGUT.mjs → chunk-ANUKBZ6W.mjs} +475 -11
  65. package/dist/cli/{chunk-FZKPPB5P.mjs → chunk-BASLYGXK.mjs} +85 -77
  66. package/dist/cli/{chunk-SQWET4SL.js → chunk-BBTKAASQ.js} +2 -1
  67. package/dist/cli/{chunk-NRO3NTVO.js → chunk-CBV7AKWM.js} +5 -5
  68. package/dist/cli/{chunk-PI5R65OQ.js → chunk-CIDN5K23.js} +1 -1
  69. package/dist/cli/{chunk-QNHHZ63P.mjs → chunk-CQBIO6HW.mjs} +1 -1
  70. package/dist/cli/{chunk-2KHUFWTK.js → chunk-CQDQNZGH.js} +42 -37
  71. package/dist/cli/{chunk-D4MHCCIR.js → chunk-CWSLUNA6.js} +33 -33
  72. package/dist/cli/{chunk-E3CLOVG5.mjs → chunk-CXTW7SRW.mjs} +50 -141
  73. package/dist/cli/{chunk-H6SWS5CG.mjs → chunk-DA2I2M7D.mjs} +2 -2
  74. package/dist/cli/{chunk-WAIBM6KX.mjs → chunk-DQHUJMCL.mjs} +5 -5
  75. package/dist/cli/{chunk-DWPY6ZID.mjs → chunk-DUYAMLOC.mjs} +1 -1
  76. package/dist/cli/{chunk-K53NKWZO.mjs → chunk-E24UGPGG.mjs} +13 -15
  77. package/dist/cli/{chunk-STR5LXK4.mjs → chunk-FSIVF2SI.mjs} +1 -1
  78. package/dist/cli/{chunk-7R5DAANG.mjs → chunk-GF32SBST.mjs} +1 -1
  79. package/dist/cli/{chunk-7CWSAEYS.mjs → chunk-GHLDCLSC.mjs} +1 -1
  80. package/dist/cli/{chunk-ZUVE63Y7.js → chunk-GTVZKY3F.js} +2 -2
  81. package/dist/cli/{chunk-J75DANZY.mjs → chunk-HAJQGP5V.mjs} +2 -2
  82. package/dist/cli/{chunk-RFQWSH6I.js → chunk-HWDKRN7L.js} +3 -3
  83. package/dist/cli/{chunk-5YAJGRWB.js → chunk-IPVRMYWT.js} +7 -7
  84. package/dist/cli/{chunk-ZPGGW27Q.mjs → chunk-JL2OTMSG.mjs} +1 -0
  85. package/dist/cli/{chunk-K76AEBFY.mjs → chunk-JUHDJNSI.mjs} +4 -4
  86. package/dist/cli/{chunk-R2KKEHJN.mjs → chunk-KPQHUVYW.mjs} +5 -5
  87. package/dist/cli/{chunk-6LHX33VN.js → chunk-KWYGWO4Y.js} +9 -6
  88. package/dist/cli/{chunk-7PXP2FQK.js → chunk-LDGZFDUB.js} +2 -2
  89. package/dist/cli/{chunk-KWGXHPHL.js → chunk-LN6RXDTB.js} +523 -59
  90. package/dist/cli/{chunk-TCVCFZP6.mjs → chunk-LZXZQPA2.mjs} +4 -1
  91. package/dist/cli/{chunk-2D6SWQTK.js → chunk-MSP4DTSD.js} +13 -13
  92. package/dist/cli/{chunk-BNH4Y35W.mjs → chunk-OLH2PHMC.mjs} +2 -2
  93. package/dist/cli/{chunk-QYBAHYP4.mjs → chunk-OUDTOMZC.mjs} +7 -9
  94. package/dist/cli/{chunk-GESIFFQX.mjs → chunk-OVX3Q5Q3.mjs} +1 -1
  95. package/dist/cli/{chunk-6TYRRNXY.mjs → chunk-PNY3BWHP.mjs} +2 -2
  96. package/dist/cli/{chunk-DYIWDUY4.js → chunk-Q4MNUOS4.js} +316 -303
  97. package/dist/cli/{chunk-5EKNDNFQ.js → chunk-Q5CXV3E3.js} +2 -2
  98. package/dist/cli/{chunk-W6T23EUC.mjs → chunk-RVSSQPQO.mjs} +1 -1
  99. package/dist/cli/{chunk-WNNA4L6Z.js → chunk-SLPJ3LXI.js} +22 -22
  100. package/dist/cli/{chunk-K3IPGMGP.js → chunk-TX5TUHJN.js} +17 -19
  101. package/dist/cli/{chunk-IF75RD6U.js → chunk-U2LVWCTD.js} +18 -6
  102. package/dist/cli/{chunk-ZS2WHWWL.js → chunk-UNDLNT3V.js} +1 -1
  103. package/dist/cli/{chunk-4NLRWKZB.js → chunk-VBDZIMWD.js} +26 -26
  104. package/dist/cli/{chunk-DAPKLYST.js → chunk-W7AEIGZR.js} +41 -41
  105. package/dist/cli/{chunk-LVISZFYO.mjs → chunk-WC5M3JXE.mjs} +2 -2
  106. package/dist/cli/{chunk-C374C22Y.js → chunk-WOQO3GV4.js} +14 -11
  107. package/dist/cli/{chunk-243O3FH5.js → chunk-XBAH3TKU.js} +5 -5
  108. package/dist/cli/{chunk-DFJODFMC.mjs → chunk-XJD2GYUP.mjs} +5 -5
  109. package/dist/cli/{chunk-BF65LB7X.mjs → chunk-XVZRJJDS.mjs} +4 -4
  110. package/dist/cli/{chunk-OM732MGV.js → chunk-Y2NTPYGS.js} +17 -17
  111. package/dist/cli/{chunk-YFZLZNTH.mjs → chunk-YBMHOH6H.mjs} +4 -4
  112. package/dist/cli/{chunk-RKY4LBX3.mjs → chunk-YRLAUGQY.mjs} +3 -3
  113. package/dist/cli/{chunk-FKD3KL5Q.mjs → chunk-Z2XA6YU4.mjs} +10 -5
  114. package/dist/cli/{chunk-JQQG4QL4.mjs → chunk-Z7UIOGW4.mjs} +3 -3
  115. package/dist/cli/{chunk-HYBZWSSH.js → chunk-ZEV2Y56V.js} +44 -44
  116. package/dist/cli/{chunk-MI6ZP7XI.mjs → chunk-ZG7BOECV.mjs} +18 -6
  117. package/dist/cli/{chunk-HWPOXCCK.js → chunk-ZILSRDIN.js} +8 -8
  118. package/dist/cli/{chunk-CIDATNTY.js → chunk-ZISEH7OL.js} +16 -16
  119. package/dist/cli/{chunk-KA6ZERJL.js → chunk-ZZ4MF2GI.js} +6 -6
  120. package/dist/cli/command-docs.js +2 -2
  121. package/dist/cli/command-docs.mjs +1 -1
  122. package/dist/cli/{csv-CD55KEIO.js → csv-2V2DIFNG.js} +15 -15
  123. package/dist/cli/{csv-CLPVMIRF.mjs → csv-P3HLK4GO.mjs} +6 -6
  124. package/dist/cli/{db-MQKLDAEO.js → db-MREAQVW6.js} +36 -36
  125. package/dist/cli/{db-AU4SMWUN.mjs → db-ZYOY3QRQ.mjs} +9 -9
  126. package/dist/cli/describe-IKZFOADR.mjs +49 -0
  127. package/dist/cli/describe-WW3OQRLP.js +49 -0
  128. package/dist/cli/describe-core.d.mts +3 -3
  129. package/dist/cli/describe-core.d.ts +3 -3
  130. package/dist/cli/describe-core.js +5 -5
  131. package/dist/cli/describe-core.mjs +4 -4
  132. package/dist/cli/{executions-77GOLWRM.js → executions-H5IJ7QSQ.js} +11 -11
  133. package/dist/cli/{executions-TFIJPUX7.mjs → executions-KTSY5M34.mjs} +9 -9
  134. package/dist/cli/{feedback-OV5YAL3A.js → feedback-724QK3Z5.js} +16 -16
  135. package/dist/cli/{feedback-2WRSZ5WL.mjs → feedback-WWJRIXEU.mjs} +8 -8
  136. package/dist/cli/git-PHYRD56H.js +25 -0
  137. package/dist/cli/{git-VNS4ATLZ.mjs → git-R5VRG7X6.mjs} +7 -7
  138. package/dist/cli/index.js +151 -157
  139. package/dist/cli/index.mjs +51 -57
  140. package/dist/cli/{legacy-noops-HDOB5C6F.js → legacy-noops-C6GDEGPU.js} +11 -11
  141. package/dist/cli/{legacy-noops-C732QDCY.mjs → legacy-noops-PWZ5XLAO.mjs} +8 -8
  142. package/dist/cli/{monitors-5IUMHH3E.js → monitors-VAVQ4WCE.js} +125 -122
  143. package/dist/cli/{monitors-2LYEFXOU.mjs → monitors-WQSKMHAP.mjs} +19 -16
  144. package/dist/cli/{org-ADW2EVAC.js → org-CWWRWXZQ.js} +89 -89
  145. package/dist/cli/{org-G4YGZPHS.mjs → org-MAL4QPVF.mjs} +9 -9
  146. package/dist/cli/{play-7GQ56C2D.mjs → play-ILW6MSNG.mjs} +123 -76
  147. package/dist/cli/{play-EHSOSSHT.js → play-WJOWK5PQ.js} +641 -594
  148. package/dist/cli/{providers-WL3YTCSV.mjs → providers-4V2NMLZZ.mjs} +9 -9
  149. package/dist/cli/{providers-PWCF6OOO.js → providers-W662ANCH.js} +12 -12
  150. package/dist/cli/{quickstart-ZKI5MURA.js → quickstart-BW6EBUYX.js} +8 -8
  151. package/dist/cli/{quickstart-323XOPGI.mjs → quickstart-C22BR743.mjs} +6 -6
  152. package/dist/cli/{run-XZPWA6JS.js → run-KW7KW4FX.js} +50 -53
  153. package/dist/cli/{run-ZCNZU3K2.mjs → run-SPAU5IMW.mjs} +31 -34
  154. package/dist/cli/search-HLE54W5G.js +32 -0
  155. package/dist/cli/{search-CVLVSFMJ.mjs → search-XPC75HLM.mjs} +10 -11
  156. package/dist/cli/{search-output-6PY6RN2R.mjs → search-output-JKYJSEPM.mjs} +6 -6
  157. package/dist/cli/{search-output-7HRSSRBS.js → search-output-VJYE7USJ.js} +8 -8
  158. package/dist/cli/{secrets-6S2ZWDIM.mjs → secrets-OJG73GXQ.mjs} +9 -9
  159. package/dist/cli/{secrets-IYD5VKY4.js → secrets-YB57KGSB.js} +18 -18
  160. package/dist/cli/{sessions-GVEX5TUJ.mjs → sessions-7ZL37BW4.mjs} +8 -8
  161. package/dist/cli/sessions-VEBYZIEU.js +22 -0
  162. package/dist/cli/{settings-CANK4HJQ.js → settings-A7DD2ZYE.js} +88 -89
  163. package/dist/cli/{settings-BN5MJZ3C.mjs → settings-RKSQB7FA.mjs} +15 -16
  164. package/dist/cli/{setup-JNMSCCU4.mjs → setup-NXDUTITY.mjs} +11 -12
  165. package/dist/cli/{setup-YSGKGLSJ.js → setup-S3K5YU62.js} +51 -52
  166. package/dist/cli/skills-NVQ744CN.js +36 -0
  167. package/dist/cli/{skills-QCQN2UM2.mjs → skills-VMFAIDO6.mjs} +9 -10
  168. package/dist/cli/{tools-CDPOID7V.mjs → tools-52NTHBSJ.mjs} +20 -21
  169. package/dist/cli/tools-SBDUL3WB.js +56 -0
  170. package/dist/cli/update-HHVFZPCV.js +34 -0
  171. package/dist/cli/{update-D3ZERUQ3.mjs → update-SAKBEKMV.mjs} +11 -12
  172. package/dist/cli/{views-RDZRWQBQ.mjs → views-ACRV7MD6.mjs} +54 -10
  173. package/dist/cli/{views-4NV2KQKA.js → views-C3GJOBDG.js} +66 -22
  174. package/dist/cli/{workflow-2CG3TVCG.mjs → workflow-CS22E7TC.mjs} +10 -10
  175. package/dist/cli/{workflow-RABJCAZC.js → workflow-ZNWCZEGN.js} +20 -20
  176. package/dist/{client-DhSvMO3A.d.mts → client-BlLYQDNo.d.mts} +1 -1
  177. package/dist/{client-oGNJMQFd.d.ts → client-DSQlkIDO.d.ts} +1 -1
  178. package/dist/{client-core-CdWH6Sii.d.ts → client-core-CDwapXy5.d.ts} +159 -108
  179. package/dist/{client-core-CVG1Et-4.d.mts → client-core-rX7n2H8U.d.mts} +159 -108
  180. package/dist/{compiler-manifest-D2ZlBGxj.d.ts → compiler-manifest-BHNC4RL-.d.mts} +15 -22
  181. package/dist/{compiler-manifest-D2ZlBGxj.d.mts → compiler-manifest-BHNC4RL-.d.ts} +15 -22
  182. package/dist/{errors-B-gOQdj-.d.mts → errors-D7sPXrvB.d.mts} +1 -1
  183. package/dist/{errors-CB0KAmmV.d.ts → errors-lhtIWG5Z.d.ts} +1 -1
  184. package/dist/{index-c3nvUGCS.d.ts → index-CQTBHXHr.d.ts} +1 -1
  185. package/dist/{index-BbJADro4.d.mts → index-NaDZq2xf.d.mts} +1 -1
  186. package/dist/index.d.mts +7 -7
  187. package/dist/index.d.ts +7 -7
  188. package/dist/index.js +15 -15
  189. package/dist/index.mjs +11 -11
  190. package/dist/install-integrity.json +129 -132
  191. package/dist/monitor-fleet-contract.d.mts +17 -11
  192. package/dist/monitor-fleet-contract.d.ts +17 -11
  193. package/dist/monitor-fleet-contract.js +3 -3
  194. package/dist/monitor-fleet-contract.mjs +2 -2
  195. package/dist/monitor-input-contract.js +2 -2
  196. package/dist/monitor-input-contract.mjs +1 -1
  197. package/dist/plays/bundle-play-file.d.mts +3 -3
  198. package/dist/plays/bundle-play-file.d.ts +3 -3
  199. package/dist/plays/bundle-play-file.mjs +17 -5
  200. package/dist/plays/csv-data-input.js +3 -3
  201. package/dist/plays/csv-data-input.mjs +2 -2
  202. package/dist/plays/play-description.d.mts +2 -2
  203. package/dist/plays/play-description.d.ts +2 -2
  204. package/dist/plays/run-request.d.mts +2 -2
  205. package/dist/plays/run-request.d.ts +2 -2
  206. package/dist/plays/run-request.js +3 -3
  207. package/dist/plays/run-request.mjs +2 -2
  208. package/dist/release.d.mts +1 -1
  209. package/dist/release.d.ts +1 -1
  210. package/dist/release.js +2 -2
  211. package/dist/release.mjs +1 -1
  212. package/dist/server.d.mts +4 -4
  213. package/dist/server.d.ts +4 -4
  214. package/dist/server.js +12 -12
  215. package/dist/server.mjs +6 -6
  216. package/package.json +1 -1
  217. package/dist/cli/auth-VDCU3T6A.js +0 -43
  218. package/dist/cli/chunk-4QELPWUW.mjs +0 -405
  219. package/dist/cli/chunk-T7RBM2WX.js +0 -405
  220. package/dist/cli/describe-5BFNHT5V.js +0 -50
  221. package/dist/cli/describe-AWJUXE2U.mjs +0 -50
  222. package/dist/cli/git-HGMX52XU.js +0 -25
  223. package/dist/cli/pages-KXKWSCEV.mjs +0 -266
  224. package/dist/cli/pages-VTJGAI2D.js +0 -266
  225. package/dist/cli/search-J6EY7DQN.js +0 -33
  226. package/dist/cli/sessions-7HPIVSQ4.js +0 -22
  227. package/dist/cli/skills-WDGSSKJZ.js +0 -37
  228. package/dist/cli/tools-URNVXSTZ.js +0 -57
  229. package/dist/cli/update-Q6JW32IA.js +0 -35
@@ -1,405 +0,0 @@
1
- import {
2
- autoDetectBaseUrl,
3
- resolveApiKeyForBaseUrl
4
- } from "./chunk-W5YJYU4G.mjs";
5
- import {
6
- SDK_VERSION,
7
- agentSessionIdFromEnvironment,
8
- deploymentProtectionHeaders,
9
- detectAgentRuntime
10
- } from "./chunk-RKY4LBX3.mjs";
11
- import {
12
- DeeplineError
13
- } from "./chunk-ZPGGW27Q.mjs";
14
-
15
- // src/cli/failure-reporting.ts
16
- import { hostname, platform, release } from "os";
17
- var FAILURE_REPORT_DISABLE_ENV = "DEEPLINE_DISABLE_FAILURE_REPORTING";
18
- var REPORT_FAILURE_TIMEOUT_MS = 1e4;
19
- var BACKGROUND_REPORT_FAILURE_TIMEOUT_MS = 2e3;
20
- var MAX_FAILURE_TEXT_CHARS = 4e3;
21
- var MAX_COMMAND_TOKENS = 3;
22
- var REPORTABLE_EXIT_CODES = /* @__PURE__ */ new Set([4, 5]);
23
- var EMAIL_RE = /\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}\b/gi;
24
- var UNIX_PATH_RE = /(?:\/Users\/|\/home\/|\/var\/folders\/|\/tmp\/|\/sessions\/)[^"'\n\r`]+/g;
25
- var WINDOWS_PATH_RE = /[A-Za-z]:(?:\\{1,2})(?:Users|Temp|tmp)(?:\\{1,2})[^"'\n\r`]+/g;
26
- var ASSIGNMENT_SECRET_RE = /\b(access[_-]?token|api[_-]?key|apikey|auth(?:orization)?|bearer|password|secret|session)\b(\s*[:=]\s*)(?!Bearer\s+\[redacted-secret\])([^\s,;]+)/gi;
27
- var BEARER_SECRET_RE = /\b(bearer)\s+([A-Za-z0-9._-]+)/gi;
28
- var GENERIC_TOKEN_RE = /\b(?:dlp|sk|ghp|xox[baprs])[-_A-Za-z0-9]{8,}\b/g;
29
- var SECRET_OPTION_RE = /^--?(?:access[-_]?token|api[-_]?key|apikey|auth(?:orization)?|bearer|password|secret|session|token)$/i;
30
- function truthyEnv(name) {
31
- return ["1", "true", "yes", "on"].includes(
32
- String(process.env[name] ?? "").trim().toLowerCase()
33
- );
34
- }
35
- function isFailureReportingDisabled() {
36
- return truthyEnv(FAILURE_REPORT_DISABLE_ENV);
37
- }
38
- function redactFailureText(value, maxChars = MAX_FAILURE_TEXT_CHARS) {
39
- const home = process.env.HOME?.trim();
40
- let text = String(value ?? "");
41
- if (!text) return "";
42
- if (home && home !== "/") {
43
- text = text.split(home).join("~");
44
- }
45
- return text.replace(EMAIL_RE, "[redacted-email]").replace(UNIX_PATH_RE, "[redacted-path]").replace(WINDOWS_PATH_RE, "[redacted-path]").replace(BEARER_SECRET_RE, "$1 [redacted-secret]").replace(ASSIGNMENT_SECRET_RE, "$1$2[redacted-secret]").replace(GENERIC_TOKEN_RE, "[redacted-secret]").slice(0, maxChars);
46
- }
47
- function sanitizeCommand(argv, prefix = "deepline") {
48
- const tokens = [];
49
- for (let index = 0; index < argv.length; index += 1) {
50
- const arg = argv[index];
51
- const value = String(arg ?? "").trim();
52
- if (!value) continue;
53
- if (value.startsWith("-")) {
54
- if (!value.includes("=") && SECRET_OPTION_RE.test(value)) {
55
- index += 1;
56
- }
57
- continue;
58
- }
59
- tokens.push(redactFailureText(value, 200));
60
- if (tokens.length >= MAX_COMMAND_TOKENS) break;
61
- }
62
- return tokens.length > 0 ? [prefix, ...tokens].join(" ") : prefix;
63
- }
64
- function errorMessage(error) {
65
- if (error instanceof Error) return `${error.name}: ${error.message}`;
66
- return String(error ?? "");
67
- }
68
- function errorStack(error) {
69
- if (error instanceof Error && error.stack) {
70
- return redactFailureText(error.stack);
71
- }
72
- return null;
73
- }
74
- function classifyNetworkFailure(error) {
75
- const seen = /* @__PURE__ */ new Set();
76
- let current = error;
77
- while (current && !seen.has(current)) {
78
- seen.add(current);
79
- const record = typeof current === "object" && current !== null ? current : {};
80
- const code = String(record.code ?? "").toLowerCase();
81
- const name = current instanceof Error ? current.name.toLowerCase() : "";
82
- const text = String(
83
- current instanceof Error ? current.message : current
84
- ).toLowerCase();
85
- const combined = `${code} ${name} ${text}`;
86
- if (combined.includes("aborterror") || combined.includes("timeout") || combined.includes("timed out") || combined.includes("etimedout")) {
87
- return "network_timeout";
88
- }
89
- if (combined.includes("enotfound") || combined.includes("eai_again") || combined.includes("getaddrinfo") || combined.includes("name or service not known") || combined.includes("temporary failure in name resolution")) {
90
- return "network_dns_resolution_failed";
91
- }
92
- if (combined.includes("econnrefused") || combined.includes("connection refused")) {
93
- return "network_connection_refused";
94
- }
95
- if (combined.includes("econnreset") || combined.includes("connection reset")) {
96
- return "network_connection_reset";
97
- }
98
- if (combined.includes("incompleteread") || combined.includes("incomplete read")) {
99
- return "network_incomplete_read";
100
- }
101
- if (combined.includes("remotedisconnected") || combined.includes("remote end closed connection") || combined.includes("other side closed") || combined.includes("socket hang up")) {
102
- return "network_remote_disconnected";
103
- }
104
- if (
105
- // Local filenames and retry commands may contain "ssl" or "tls".
106
- // Require a transport identifier or protocol failure text instead.
107
- code.includes("ssl") || code.includes("tls") || name.includes("ssl") || name.includes("tls") || /(?:^|[\s[(:])(?:ssl|tls)[\s:_-]+(?:error|handshake|certificate|routines|connection|failed|failure)(?:$|[\s:_-])/.test(
108
- text
109
- ) || combined.includes("unexpected_eof_while_reading")
110
- ) {
111
- return "network_ssl_error";
112
- }
113
- current = record.cause ?? record.context;
114
- }
115
- return "network_error";
116
- }
117
- function classifyNetworkCauseCategory(error) {
118
- const seen = /* @__PURE__ */ new Set();
119
- let cause = error;
120
- while (cause && typeof cause === "object" && !seen.has(cause)) {
121
- seen.add(cause);
122
- const record = cause;
123
- if (record.code === "UND_ERR_CONNECT_TIMEOUT") return "connect_timeout";
124
- cause = record.cause;
125
- }
126
- switch (classifyNetworkFailure(error)) {
127
- case "network_dns_resolution_failed":
128
- return "dns";
129
- case "network_ssl_error":
130
- return "tls";
131
- case "network_connection_reset":
132
- return "reset";
133
- case "network_timeout":
134
- return "timeout";
135
- default:
136
- return "unknown";
137
- }
138
- }
139
- function isNetworkFailure(error) {
140
- if (!(error instanceof Error)) return false;
141
- if (error instanceof DeeplineError && error.statusCode) return false;
142
- const code = classifyNetworkFailure(error);
143
- return code !== "network_error" || /unable to connect|unable to stream/i.test(error.message);
144
- }
145
- function buildEnvironmentContext() {
146
- const context = {
147
- os: platform(),
148
- os_release: release(),
149
- platform: `${platform()}-${release()}-${process.arch}`,
150
- node_version: process.version,
151
- runtime: "Node.js",
152
- hostname: hostname(),
153
- agent_runtime: detectAgentRuntime()
154
- };
155
- for (const key of ["CLAUDE_CODE_REMOTE", "DEEPLINE_PLUGIN_MODE"]) {
156
- const normalized = process.env[key]?.trim();
157
- if (normalized) context[key.toLowerCase()] = normalized;
158
- }
159
- if (process.env.CLAUDE_PROJECT_DIR?.trim()) {
160
- context.claude_project_dir_present = "true";
161
- }
162
- if (process.env.DEEPLINE_PLUGIN_ROOT?.trim()) {
163
- context.deepline_plugin_root_present = "true";
164
- }
165
- if (process.env.DEEPLINE_PLUGIN_SKILLS_DIR?.trim()) {
166
- context.deepline_plugin_skills_dir_present = "true";
167
- }
168
- if (process.env.HOME?.trim().startsWith("/sessions/")) {
169
- context.home_scope = "sessions";
170
- }
171
- return context;
172
- }
173
- function failureReportHeaders(apiKey) {
174
- const agentSessionId = agentSessionIdFromEnvironment();
175
- return {
176
- ...deploymentProtectionHeaders(),
177
- ...agentSessionId ? { "X-Deepline-Agent-Session-Id": agentSessionId } : {},
178
- Authorization: `Bearer ${apiKey}`,
179
- "Content-Type": "application/json",
180
- "User-Agent": `deepline-ts-sdk/${SDK_VERSION}`,
181
- "X-Deepline-Client-Family": "sdk",
182
- "X-Deepline-CLI-Family": "sdk",
183
- "X-Deepline-Agent-Runtime": detectAgentRuntime(),
184
- "X-Deepline-CLI-Version": SDK_VERSION,
185
- "X-Deepline-SDK-Version": SDK_VERSION
186
- };
187
- }
188
- async function postFailureReport(input) {
189
- const controller = new AbortController();
190
- const timeout = setTimeout(() => controller.abort(), input.timeoutMs);
191
- if (input.background) timeout.unref();
192
- try {
193
- await fetch(new URL("/api/v2/cli/report-failure", input.baseUrl), {
194
- method: "POST",
195
- headers: failureReportHeaders(input.apiKey),
196
- body: JSON.stringify(input.body),
197
- signal: controller.signal
198
- });
199
- return true;
200
- } catch {
201
- return false;
202
- } finally {
203
- clearTimeout(timeout);
204
- }
205
- }
206
- function boundedTelemetryString(value, maxChars) {
207
- return redactFailureText(value.trim(), maxChars);
208
- }
209
- async function maybeReportAutomaticSkillsSyncFailure(input) {
210
- if (isFailureReportingDisabled()) return false;
211
- let apiKey = "";
212
- try {
213
- apiKey = resolveApiKeyForBaseUrl(input.baseUrl);
214
- } catch {
215
- return false;
216
- }
217
- if (!apiKey) return false;
218
- const attempts = input.attempts.slice(0, 2).map((attempt) => ({
219
- installer: attempt.installer,
220
- outcome: attempt.outcome,
221
- exit_code: typeof attempt.exitCode === "number" && Number.isFinite(attempt.exitCode) ? Math.trunc(attempt.exitCode) : null
222
- }));
223
- const agents = input.agents.slice(0, 8).map((agent) => boundedTelemetryString(agent, 100)).filter(Boolean);
224
- const baseUrl = input.baseUrl.replace(/\/$/, "");
225
- const failureKind = "background_warning";
226
- const failureCode2 = "SKILLS_AUTO_SYNC_FAILED";
227
- const failureStage = "skills_install";
228
- return postFailureReport({
229
- baseUrl,
230
- apiKey,
231
- timeoutMs: BACKGROUND_REPORT_FAILURE_TIMEOUT_MS,
232
- background: true,
233
- body: {
234
- command: "deepline skills",
235
- subcommand: "skills",
236
- failure_kind: failureKind,
237
- failure_code: failureCode2,
238
- failure_stage: failureStage,
239
- error_body: "Automatic Deepline skills installation failed.",
240
- cli_version: SDK_VERSION,
241
- context: {
242
- environment: buildEnvironmentContext(),
243
- skills_sync: {
244
- skills_package: boundedTelemetryString(input.skillsPackage, 100),
245
- remote_skills_version: boundedTelemetryString(
246
- input.remoteSkillsVersion,
247
- 200
248
- ),
249
- agents,
250
- target_skill_count: Math.max(
251
- 0,
252
- Math.trunc(
253
- Number.isFinite(input.targetSkillCount) ? input.targetSkillCount : 0
254
- )
255
- ),
256
- marker_written: input.markerWritten,
257
- attempts
258
- }
259
- }
260
- }
261
- });
262
- }
263
- function subcommandFromArgv(argv) {
264
- return argv.find((arg) => arg && !arg.startsWith("-")) ?? null;
265
- }
266
- function commandTokens(argv) {
267
- return argv.map((arg) => String(arg ?? "").trim()).filter((arg) => arg && !arg.startsWith("-"));
268
- }
269
- function isServerLoggedPlayRunStartFailure(input) {
270
- const [subcommand, command] = commandTokens(input.argv);
271
- return subcommand === "plays" && command === "run" && input.error instanceof DeeplineError && typeof input.error.statusCode === "number";
272
- }
273
- function shouldReport(input) {
274
- if (input.error !== void 0) return true;
275
- return input.exitCode !== null && REPORTABLE_EXIT_CODES.has(input.exitCode);
276
- }
277
- function failureCode(input) {
278
- if (input.error !== void 0) {
279
- if (isNetworkFailure(input.error))
280
- return classifyNetworkFailure(input.error);
281
- if (input.error instanceof DeeplineError && input.error.code) {
282
- return input.error.code;
283
- }
284
- if (input.error instanceof Error && input.error.name)
285
- return input.error.name;
286
- return "CLI_FAILURE";
287
- }
288
- return input.exitCode === 4 ? "network_error" : "command_exit";
289
- }
290
- function resolvedExitCode(input) {
291
- if (typeof input.exitCode === "number" && Number.isFinite(input.exitCode)) {
292
- return Math.trunc(input.exitCode);
293
- }
294
- if (input.error === void 0) return null;
295
- return isNetworkFailure(input.error) ? 4 : 5;
296
- }
297
- function resolveSdkCliFailureExitCode(error) {
298
- return isNetworkFailure(error) ? 4 : 1;
299
- }
300
- function resolvedFailureKind(input) {
301
- return input.error === void 0 ? "command_exit" : "uncaught_exception";
302
- }
303
- function safeRequestDiagnostics(error) {
304
- if (!(error instanceof DeeplineError)) return null;
305
- const request = error.details?.request;
306
- if (!request || typeof request !== "object" || Array.isArray(request))
307
- return null;
308
- const value = request;
309
- const result = {};
310
- if (typeof value.phase === "string" && [
311
- "before_request",
312
- "retry_wait",
313
- "awaiting_headers",
314
- "reading_body"
315
- ].includes(value.phase))
316
- result.phase = value.phase;
317
- if (typeof value.method === "string" && /^(GET|HEAD|POST|PUT|PATCH|DELETE|OPTIONS)$/.test(value.method))
318
- result.method = value.method;
319
- if (typeof value.url === "string") {
320
- try {
321
- const url = new URL(value.url);
322
- if (url.protocol === "https:" || url.protocol === "http:") {
323
- result.url = redactFailureText(`${url.origin}${url.pathname}`, 1e3);
324
- }
325
- } catch {
326
- }
327
- }
328
- if (typeof value.failedAtUtc === "string" && Number.isFinite(Date.parse(value.failedAtUtc))) {
329
- result.failedAtUtc = new Date(value.failedAtUtc).toISOString();
330
- }
331
- for (const key of ["elapsedMs", "attempts"]) {
332
- const number = value[key];
333
- if (typeof number === "number" && Number.isSafeInteger(number) && number >= 0)
334
- result[key] = number;
335
- }
336
- return Object.keys(result).length > 0 ? result : null;
337
- }
338
- function buildFailureReport(input) {
339
- const durationMs = Math.max(0, Date.now() - input.startedAtMs);
340
- const request = safeRequestDiagnostics(input.error);
341
- const failureKind = resolvedFailureKind({
342
- exitCode: input.exitCode,
343
- error: input.error
344
- });
345
- const code = failureCode({ exitCode: input.exitCode, error: input.error });
346
- const errorBody = input.error === void 0 ? `SDK CLI command exited ${input.exitCode ?? "unknown"}` : errorMessage(input.error);
347
- const networkCauseCategory = input.error !== void 0 && isNetworkFailure(input.error) ? classifyNetworkCauseCategory(input.error) : null;
348
- return {
349
- command: sanitizeCommand(input.argv),
350
- subcommand: subcommandFromArgv(input.argv),
351
- error_status: input.exitCode,
352
- error_body: redactFailureText(errorBody),
353
- exit_code: input.exitCode,
354
- duration_ms: durationMs,
355
- error_class: input.error instanceof Error ? input.error.name : null,
356
- stack_trace: errorStack(input.error),
357
- failure_kind: failureKind,
358
- failure_code: code,
359
- failure_stage: input.error === void 0 ? "command_exit" : "cli_main",
360
- cli_version: SDK_VERSION,
361
- context: {
362
- base_url: redactFailureText(input.baseUrl, 400),
363
- command_summary: sanitizeCommand(input.argv),
364
- environment: buildEnvironmentContext(),
365
- ...request ? { request } : {},
366
- failure_kind: failureKind,
367
- failure_code: code,
368
- failure_stage: input.error === void 0 ? "command_exit" : "cli_main",
369
- duration_ms: durationMs,
370
- ...input.exitCode !== null ? { exit_code: input.exitCode } : {},
371
- ...networkCauseCategory ? { network_cause_category: networkCauseCategory } : {}
372
- }
373
- };
374
- }
375
- async function maybeReportSdkCliFailure(input) {
376
- if (isFailureReportingDisabled()) return false;
377
- if (isServerLoggedPlayRunStartFailure(input)) return false;
378
- const exitCode = resolvedExitCode(input);
379
- if (!shouldReport({ exitCode, error: input.error })) return false;
380
- const baseUrl = autoDetectBaseUrl().replace(/\/$/, "");
381
- const apiKey = resolveApiKeyForBaseUrl(baseUrl);
382
- if (!apiKey) return false;
383
- return postFailureReport({
384
- baseUrl,
385
- apiKey,
386
- timeoutMs: REPORT_FAILURE_TIMEOUT_MS,
387
- body: buildFailureReport({
388
- argv: input.argv,
389
- startedAtMs: input.startedAtMs,
390
- error: input.error,
391
- exitCode,
392
- baseUrl
393
- })
394
- });
395
- }
396
-
397
- export {
398
- isFailureReportingDisabled,
399
- redactFailureText,
400
- sanitizeCommand,
401
- failureReportHeaders,
402
- maybeReportAutomaticSkillsSyncFailure,
403
- resolveSdkCliFailureExitCode,
404
- maybeReportSdkCliFailure
405
- };