deepline 0.3.409 → 0.3.411

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 (215) hide show
  1. package/dist/bundling-sources/sdk/src/agent-runtime.ts +18 -1
  2. package/dist/bundling-sources/sdk/src/client.ts +206 -333
  3. package/dist/bundling-sources/sdk/src/compat.ts +45 -2
  4. package/dist/bundling-sources/sdk/src/db/query.ts +9 -10
  5. package/dist/bundling-sources/sdk/src/http.ts +38 -20
  6. package/dist/bundling-sources/sdk/src/index.ts +4 -5
  7. package/dist/bundling-sources/sdk/src/play.ts +10 -10
  8. package/dist/bundling-sources/sdk/src/plays/bundle-play-file.ts +6 -4
  9. package/dist/bundling-sources/sdk/src/plays/check-local-play-graph.ts +114 -0
  10. package/dist/bundling-sources/sdk/src/plays/client.ts +431 -0
  11. package/dist/bundling-sources/sdk/src/plays/local-play-execution.ts +2 -2
  12. package/dist/bundling-sources/sdk/src/plays/run-request.ts +106 -16
  13. package/dist/bundling-sources/sdk/src/release.ts +13 -7
  14. package/dist/bundling-sources/sdk/src/runs/read-errors.ts +8 -0
  15. package/dist/bundling-sources/sdk/src/runs/watch-polling.ts +124 -13
  16. package/dist/bundling-sources/sdk/src/tool-calls.ts +108 -19
  17. package/dist/bundling-sources/sdk/src/types.ts +18 -0
  18. package/dist/bundling-sources/shared_libs/integration-contracts/execute-retry-contract.ts +37 -0
  19. package/dist/bundling-sources/shared_libs/integration-contracts/package.json +3 -0
  20. package/dist/bundling-sources/shared_libs/monitors/package.json +1 -1
  21. package/dist/bundling-sources/shared_libs/play-data-plane/r2.ts +3 -1
  22. package/dist/bundling-sources/shared_libs/play-runtime/async-operation.ts +1 -1
  23. package/dist/bundling-sources/shared_libs/play-runtime/context.ts +277 -76
  24. package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +6 -0
  25. package/dist/bundling-sources/shared_libs/play-runtime/dataset-row-input.ts +124 -0
  26. package/dist/bundling-sources/shared_libs/play-runtime/durable-call-cache.ts +6 -62
  27. package/dist/bundling-sources/shared_libs/play-runtime/durable-receipt-execution.ts +1 -0
  28. package/dist/bundling-sources/shared_libs/play-runtime/durable-tool-identity.ts +67 -0
  29. package/dist/bundling-sources/shared_libs/play-runtime/execute-server-timing.ts +64 -6
  30. package/dist/bundling-sources/shared_libs/play-runtime/freshness-receipt-execution.ts +1 -5
  31. package/dist/bundling-sources/shared_libs/play-runtime/ledger-safe-payload.ts +1 -1
  32. package/dist/bundling-sources/shared_libs/play-runtime/play-artifact-runtime-contract.ts +3 -0
  33. package/dist/bundling-sources/shared_libs/play-runtime/play-http-request.ts +10 -0
  34. package/dist/bundling-sources/shared_libs/play-runtime/query-result-dataset.ts +3 -0
  35. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/egress-probe.ts +3 -0
  36. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/index.ts +26 -16
  37. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-heartbeat.ts +36 -11
  38. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-terminal-push.ts +35 -0
  39. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-launch-transport.ts +21 -0
  40. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-payload-transport.ts +21 -6
  41. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-session-execution.ts +11 -2
  42. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona.ts +85 -20
  43. package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +71 -13
  44. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-execution-queries.ts +100 -0
  45. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-pool.ts +9 -5
  46. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +337 -146
  47. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-shared.ts +26 -12
  48. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-rate-state.ts +3 -1
  49. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +425 -102
  50. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/run-ledger-dispatch-authority.ts +4 -0
  51. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/run-ledger-outbox-recovery.ts +4 -0
  52. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-event-search.ts +9 -0
  53. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-sandbox-capacity.ts +181 -124
  54. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-worker-wake.ts +152 -0
  55. package/dist/bundling-sources/shared_libs/play-runtime/test-runtime-seams.ts +5 -3
  56. package/dist/bundling-sources/shared_libs/play-runtime/tool-cache-policy.ts +31 -0
  57. package/dist/bundling-sources/shared_libs/play-runtime/transient-service-error.ts +10 -0
  58. package/dist/bundling-sources/shared_libs/plays/ambiguous-write-error.ts +25 -0
  59. package/dist/bundling-sources/shared_libs/plays/artifact-types.ts +4 -0
  60. package/dist/bundling-sources/shared_libs/plays/authoring-contract.ts +63 -68
  61. package/dist/bundling-sources/shared_libs/plays/bundling/index.ts +129 -63
  62. package/dist/bundling-sources/shared_libs/plays/contracts.ts +14 -0
  63. package/dist/bundling-sources/shared_libs/plays/enrich-play-compiler.ts +58 -16
  64. package/dist/bundling-sources/shared_libs/plays/fetch-http-error.ts +50 -0
  65. package/dist/bundling-sources/shared_libs/plays/source-authoring-edition.ts +351 -0
  66. package/dist/bundling-sources/shared_libs/plays/tool-list-getter-mode.ts +9 -0
  67. package/dist/bundling-sources/shared_libs/plays/tool-result-types.ts +1 -1
  68. package/dist/cli/auth-M7TBLW55.js +40 -0
  69. package/dist/cli/{auth-5HIIACF7.mjs → auth-YD6ZTMB2.mjs} +6 -6
  70. package/dist/cli/{billing-4275N7FL.js → billing-2L3MOB42.js} +84 -84
  71. package/dist/cli/{billing-EVZ3ZWKC.mjs → billing-ZT46GV4C.mjs} +8 -8
  72. package/dist/cli/{chunk-ZAAKSJAS.js → chunk-27GJKC5Q.js} +17 -10
  73. package/dist/cli/{chunk-UHNDVD3P.js → chunk-2H4EY7KH.js} +100 -41
  74. package/dist/cli/{chunk-GAICVLKL.js → chunk-2NI6DHN7.js} +2 -2
  75. package/dist/cli/{chunk-JGHG4NBA.js → chunk-2WUY3VNK.js} +19 -4
  76. package/dist/cli/{chunk-FHPCKULR.mjs → chunk-4BA6ATHA.mjs} +2 -2
  77. package/dist/cli/{chunk-RTCDW2GU.js → chunk-4O4WNFFC.js} +170 -49
  78. package/dist/cli/{chunk-OSDXE27V.mjs → chunk-4PG4ARL2.mjs} +17 -10
  79. package/dist/cli/{chunk-AU4OFDFX.js → chunk-5IGDNBG7.js} +26 -26
  80. package/dist/cli/{chunk-WYQO2CBS.mjs → chunk-5LRWWMRV.mjs} +149 -28
  81. package/dist/cli/{chunk-PMVFAYL7.mjs → chunk-63ILLN5H.mjs} +2 -2
  82. package/dist/cli/chunk-6AUE6JXY.js +35 -0
  83. package/dist/cli/chunk-7DSMMCXP.js +501 -0
  84. package/dist/cli/{chunk-6BJK4EJ3.mjs → chunk-AARWVK4C.mjs} +2132 -65
  85. package/dist/cli/{chunk-FERRDNMO.js → chunk-AD47BXN2.js} +5 -5
  86. package/dist/cli/{chunk-J6DCKJNM.mjs → chunk-BJV3VSKE.mjs} +16 -1
  87. package/dist/cli/{chunk-S6R3OX7B.js → chunk-E4CABWXL.js} +25 -2
  88. package/dist/cli/{chunk-NXGCO4JB.mjs → chunk-E4IXDAZI.mjs} +5 -0
  89. package/dist/cli/{chunk-BEVLCKXG.mjs → chunk-E4KBNNNB.mjs} +1 -1
  90. package/dist/cli/{chunk-2PRO2JTX.mjs → chunk-E52TKKVI.mjs} +36 -284
  91. package/dist/cli/chunk-FR2ILQ4G.mjs +8 -0
  92. package/dist/cli/{chunk-2GI3QD3L.js → chunk-FRVPOXGB.js} +644 -330
  93. package/dist/cli/chunk-G43JLBDE.mjs +501 -0
  94. package/dist/cli/{chunk-BZAMOCPA.mjs → chunk-IMZ56EOH.mjs} +3 -3
  95. package/dist/cli/chunk-IPGV6VFA.mjs +6084 -0
  96. package/dist/cli/{chunk-IT3XBJQR.mjs → chunk-IR3AKJAY.mjs} +330 -625
  97. package/dist/cli/chunk-J33TSWO5.js +8 -0
  98. package/dist/cli/chunk-JQMZUWNM.mjs +35 -0
  99. package/dist/cli/chunk-JYHSEGRM.js +6084 -0
  100. package/dist/cli/{chunk-JI2B4RZP.mjs → chunk-KCC3FKIW.mjs} +71 -12
  101. package/dist/cli/{chunk-6IKARAYD.mjs → chunk-L2VKAASU.mjs} +23 -0
  102. package/dist/cli/{chunk-O3VSXP2F.js → chunk-LWBM5FFL.js} +50 -50
  103. package/dist/cli/{chunk-VWBTTJYQ.mjs → chunk-M6OASCVL.mjs} +6 -3
  104. package/dist/cli/{chunk-YHPYUZZX.mjs → chunk-MAMVGOSC.mjs} +1 -1
  105. package/dist/cli/{chunk-Q2E4E4FJ.js → chunk-NPBJI7RE.js} +8 -8
  106. package/dist/cli/chunk-NQWIZ5PZ.js +313 -0
  107. package/dist/cli/{chunk-HQXL5526.mjs → chunk-NUX2QHNC.mjs} +1 -1
  108. package/dist/cli/{chunk-TQNHMWUR.mjs → chunk-OGSXENOF.mjs} +5 -2
  109. package/dist/cli/{chunk-SEFMGO3Z.js → chunk-OQQOXSYA.js} +2184 -117
  110. package/dist/cli/{chunk-FJCIUF34.js → chunk-OZSC6CEW.js} +128 -376
  111. package/dist/cli/{chunk-NZSF57UO.mjs → chunk-PO2VU6WV.mjs} +2 -2
  112. package/dist/cli/{chunk-7P5AA3SN.js → chunk-PPDBRJRW.js} +6 -1
  113. package/dist/cli/{chunk-ILHRA7AD.js → chunk-QADCFSGH.js} +7 -7
  114. package/dist/cli/{chunk-N44JHMKY.mjs → chunk-RFES6Q2J.mjs} +452 -138
  115. package/dist/cli/{chunk-DEC3JECC.js → chunk-RMINBDYY.js} +5 -2
  116. package/dist/cli/{chunk-WLOCMJWV.js → chunk-TPFD4F5S.js} +426 -721
  117. package/dist/cli/{chunk-V76R6HMV.js → chunk-U5AQKE3T.js} +1029 -806
  118. package/dist/cli/{chunk-PBZYY7VZ.mjs → chunk-UAEVKAUR.mjs} +734 -511
  119. package/dist/cli/{chunk-WHG43Z67.js → chunk-VGHWJL4W.js} +11 -8
  120. package/dist/cli/chunk-VKKVSFRD.js +62 -0
  121. package/dist/cli/{chunk-GSK6NHVM.js → chunk-WU4U6VSB.js} +5 -5
  122. package/dist/cli/chunk-XAB47ZRV.mjs +313 -0
  123. package/dist/cli/{chunk-JRAVVJ3T.mjs → chunk-XJD6LZCO.mjs} +2 -2
  124. package/dist/cli/chunk-ZCALLYF6.mjs +62 -0
  125. package/dist/cli/{chunk-YD7B53RW.js → chunk-ZHWBU36H.js} +12 -12
  126. package/dist/cli/{csv-A2MP6EFV.mjs → csv-BKNRRW7D.mjs} +5 -5
  127. package/dist/cli/{csv-BBOTCGQY.js → csv-SVDP2EU7.js} +14 -14
  128. package/dist/cli/{db-3W5DMTUX.mjs → db-LU4KLRM6.mjs} +15 -20
  129. package/dist/cli/{db-G4CODDCA.js → db-OQ6S7TTZ.js} +42 -47
  130. package/dist/cli/{describe-PQTQ5B6F.js → describe-45TGETKR.js} +27 -22
  131. package/dist/cli/{describe-XYJ2ZT4M.mjs → describe-U4KOGDRA.mjs} +20 -15
  132. package/dist/cli/describe-core.d.mts +2 -2
  133. package/dist/cli/describe-core.d.ts +2 -2
  134. package/dist/cli/describe-core.js +6 -6
  135. package/dist/cli/describe-core.mjs +5 -5
  136. package/dist/cli/{executions-UR67CA5H.mjs → executions-2GAAUXLA.mjs} +8 -8
  137. package/dist/cli/{executions-TLANVR7Y.js → executions-VZN56VRC.js} +10 -10
  138. package/dist/cli/{feedback-6C2YTRJL.js → feedback-NS76B5GU.js} +13 -9
  139. package/dist/cli/{feedback-WHCMGEIL.mjs → feedback-XW5IWA5R.mjs} +11 -7
  140. package/dist/cli/{git-GWLB6VSA.mjs → git-CLI66XP6.mjs} +6 -6
  141. package/dist/cli/git-VGYRGFEN.js +24 -0
  142. package/dist/cli/index.js +236 -348
  143. package/dist/cli/index.mjs +162 -274
  144. package/dist/cli/{legacy-noops-ZUFA7RWI.js → legacy-noops-HCFB3ZOV.js} +9 -9
  145. package/dist/cli/{legacy-noops-KF4XIFEF.mjs → legacy-noops-ODDOMLBL.mjs} +6 -6
  146. package/dist/cli/{monitors-TB3K2IVE.js → monitors-7WXQ7JFT.js} +94 -94
  147. package/dist/cli/{monitors-6UOIDIMB.mjs → monitors-ZXX456TE.mjs} +8 -8
  148. package/dist/cli/{org-CKWMBPIR.js → org-YLX5PHBQ.js} +68 -68
  149. package/dist/cli/{org-WGHHMVDZ.mjs → org-YUN3TLNP.mjs} +8 -8
  150. package/dist/cli/{play-LYPAXCLD.mjs → play-LL73A7EP.mjs} +533 -98
  151. package/dist/cli/{play-N2B3KAVS.js → play-YGOXL52D.js} +1067 -632
  152. package/dist/cli/{providers-6DI5BVZJ.mjs → providers-35QSAUHL.mjs} +8 -8
  153. package/dist/cli/{providers-UR42MD6Z.js → providers-RHCIU2PX.js} +11 -11
  154. package/dist/cli/{quickstart-MNA2S6PO.mjs → quickstart-6BN3LCZH.mjs} +5 -5
  155. package/dist/cli/{quickstart-FCJG4XGB.js → quickstart-ORMM4NRK.js} +7 -7
  156. package/dist/cli/search-EWDMUPHR.js +30 -0
  157. package/dist/cli/{search-VPPYUJ2M.mjs → search-GAERWLSE.mjs} +9 -9
  158. package/dist/cli/{secrets-QOSMVO36.js → secrets-3AFCTGT7.js} +17 -17
  159. package/dist/cli/{secrets-DRI4W7Z5.mjs → secrets-FCL5PALY.mjs} +8 -8
  160. package/dist/cli/sessions-3OEHEQG7.js +16 -0
  161. package/dist/cli/{sessions-DQNUKP43.mjs → sessions-RSSL7I7O.mjs} +6 -6
  162. package/dist/cli/{settings-DWDK3Y2R.mjs → settings-GE4NRE7Y.mjs} +12 -12
  163. package/dist/cli/{settings-JUGGCOPS.js → settings-RX5K4I7H.js} +79 -79
  164. package/dist/cli/{setup-AWBHNYXK.js → setup-N3ZNAEL5.js} +45 -44
  165. package/dist/cli/{setup-D5DWVNY4.mjs → setup-X3RXGG4F.mjs} +11 -10
  166. package/dist/cli/{skills-YV2XR35J.mjs → skills-5JEAJBDE.mjs} +7 -7
  167. package/dist/cli/skills-VAAQVEQC.js +29 -0
  168. package/dist/cli/tools-BYYOT2DU.js +44 -0
  169. package/dist/cli/{tools-VFJYHNV2.mjs → tools-JOKUWEBZ.mjs} +19 -14
  170. package/dist/cli/update-36G4ZD7B.js +31 -0
  171. package/dist/cli/{update-IM6VOTGL.mjs → update-UBHEVFR3.mjs} +11 -9
  172. package/dist/cli/{workflow-26URBWPV.mjs → workflow-FR6EXAXF.mjs} +44 -20
  173. package/dist/cli/{workflow-3BS6U6SL.js → workflow-SZAVOHN6.js} +54 -30
  174. package/dist/{client-BfInrZPB.d.mts → client-74k4IPh6.d.mts} +135 -54
  175. package/dist/{client-BMjJFpan.d.ts → client-C1IK1f8c.d.ts} +135 -54
  176. package/dist/{compiler-manifest-Ycx-hoAr.d.mts → compiler-manifest-lzWpbV3w.d.mts} +83 -66
  177. package/dist/{compiler-manifest-Ycx-hoAr.d.ts → compiler-manifest-lzWpbV3w.d.ts} +83 -66
  178. package/dist/{index-CZXgiN3E.d.mts → index-C8Cy-YTm.d.ts} +5 -1
  179. package/dist/{index-NPG5pqxQ.d.ts → index-CtNK-0nI.d.mts} +5 -1
  180. package/dist/index.d.mts +47 -9
  181. package/dist/index.d.ts +47 -9
  182. package/dist/index.js +17 -14
  183. package/dist/index.mjs +13 -10
  184. package/dist/install-integrity.json +118 -102
  185. package/dist/plays/bundle-play-file.d.mts +3 -3
  186. package/dist/plays/bundle-play-file.d.ts +3 -3
  187. package/dist/plays/bundle-play-file.mjs +5 -4
  188. package/dist/plays/csv-data-input.js +3 -3
  189. package/dist/plays/csv-data-input.mjs +2 -2
  190. package/dist/plays/play-description.d.mts +2 -2
  191. package/dist/plays/play-description.d.ts +2 -2
  192. package/dist/plays/run-request.d.mts +2 -2
  193. package/dist/plays/run-request.d.ts +2 -2
  194. package/dist/plays/run-request.js +11 -3
  195. package/dist/plays/run-request.mjs +10 -2
  196. package/dist/release.d.mts +15 -6
  197. package/dist/release.d.ts +15 -6
  198. package/dist/release.js +2 -2
  199. package/dist/release.mjs +1 -1
  200. package/package.json +2 -2
  201. package/dist/cli/auth-F6BX32XZ.js +0 -40
  202. package/dist/cli/chunk-264PC2RN.mjs +0 -83
  203. package/dist/cli/chunk-44ZTYHMQ.mjs +0 -155
  204. package/dist/cli/chunk-53HN7WZN.js +0 -392
  205. package/dist/cli/chunk-7AALNGTA.mjs +0 -392
  206. package/dist/cli/chunk-ALD4COBH.js +0 -155
  207. package/dist/cli/chunk-CLJGSOVM.mjs +0 -1716
  208. package/dist/cli/chunk-WNUR6VP5.js +0 -83
  209. package/dist/cli/chunk-Z4VNJOF7.js +0 -1716
  210. package/dist/cli/git-VQFF6D7C.js +0 -24
  211. package/dist/cli/search-NCEEONMQ.js +0 -30
  212. package/dist/cli/sessions-3WYKQABW.js +0 -16
  213. package/dist/cli/skills-AKPAJVSO.js +0 -29
  214. package/dist/cli/tools-RBKEK6PM.js +0 -39
  215. package/dist/cli/update-VFNUBLDA.js +0 -29
@@ -1,17 +1,19 @@
1
1
  import {
2
2
  npmSupportsAllowScripts,
3
3
  readNpmVersion
4
- } from "./chunk-BEVLCKXG.mjs";
4
+ } from "./chunk-E4KBNNNB.mjs";
5
5
  import {
6
- resolveShellSpawn,
7
6
  runSkillsCommand
8
- } from "./chunk-IT3XBJQR.mjs";
7
+ } from "./chunk-G43JLBDE.mjs";
8
+ import {
9
+ resolveShellSpawn
10
+ } from "./chunk-IR3AKJAY.mjs";
9
11
  import {
10
12
  printCommandEnvelope
11
- } from "./chunk-JRAVVJ3T.mjs";
13
+ } from "./chunk-XJD6LZCO.mjs";
12
14
  import {
13
15
  autoDetectBaseUrl
14
- } from "./chunk-2PRO2JTX.mjs";
16
+ } from "./chunk-E52TKKVI.mjs";
15
17
 
16
18
  // src/cli/commands/update.ts
17
19
  import { spawn, spawnSync } from "child_process";
@@ -26,6 +28,7 @@ import {
26
28
  writeFileSync as writeFileSync2
27
29
  } from "fs";
28
30
  import { homedir as homedir2 } from "os";
31
+ import { setTimeout as delay } from "timers/promises";
29
32
  import {
30
33
  basename,
31
34
  dirname as dirname2,
@@ -210,6 +213,9 @@ import {
210
213
  import { homedir } from "os";
211
214
  import { dirname, join as join2 } from "path";
212
215
  var UPDATE_PREFERENCES_SCHEMA_VERSION = 1;
216
+ function defaultHomeDir() {
217
+ return process.env.HOME?.trim() || homedir();
218
+ }
213
219
  var CLI_UPDATE_MESSAGES = [
214
220
  {
215
221
  id: "auto-update-default-v1",
@@ -236,7 +242,7 @@ function unreadablePreferences(path, error) {
236
242
  acknowledgedMessages: CLI_UPDATE_MESSAGES.map(({ id }) => id)
237
243
  };
238
244
  }
239
- function cliUpdatePreferencesPath(homeDir = homedir()) {
245
+ function cliUpdatePreferencesPath(homeDir = defaultHomeDir()) {
240
246
  return join2(
241
247
  homeDir,
242
248
  ".local",
@@ -245,7 +251,7 @@ function cliUpdatePreferencesPath(homeDir = homedir()) {
245
251
  "update-preferences.json"
246
252
  );
247
253
  }
248
- function readCliUpdatePreferences(homeDir = homedir()) {
254
+ function readCliUpdatePreferences(homeDir = defaultHomeDir()) {
249
255
  const path = cliUpdatePreferencesPath(homeDir);
250
256
  if (!existsSync2(path)) return defaultPreferences();
251
257
  try {
@@ -262,7 +268,7 @@ function readCliUpdatePreferences(homeDir = homedir()) {
262
268
  return unreadablePreferences(path, error);
263
269
  }
264
270
  }
265
- function writeCliUpdatePreferences(preferences, homeDir = homedir()) {
271
+ function writeCliUpdatePreferences(preferences, homeDir = defaultHomeDir()) {
266
272
  const path = cliUpdatePreferencesPath(homeDir);
267
273
  const tempPath = `${path}.${process.pid}.tmp`;
268
274
  mkdirSync(dirname(path), { recursive: true });
@@ -277,7 +283,7 @@ function writeCliUpdatePreferences(preferences, homeDir = homedir()) {
277
283
  rmSync(tempPath, { force: true });
278
284
  }
279
285
  }
280
- function setCliAutoUpdateEnabled(enabled, homeDir = homedir()) {
286
+ function setCliAutoUpdateEnabled(enabled, homeDir = defaultHomeDir()) {
281
287
  const current = readCliUpdatePreferences(homeDir);
282
288
  const next = {
283
289
  ...current,
@@ -287,7 +293,7 @@ function setCliAutoUpdateEnabled(enabled, homeDir = homedir()) {
287
293
  writeCliUpdatePreferences(next, homeDir);
288
294
  return next;
289
295
  }
290
- function setCliPinnedVersion(version, homeDir = homedir()) {
296
+ function setCliPinnedVersion(version, homeDir = defaultHomeDir()) {
291
297
  const next = {
292
298
  ...readCliUpdatePreferences(homeDir),
293
299
  pinnedVersion: version
@@ -295,14 +301,14 @@ function setCliPinnedVersion(version, homeDir = homedir()) {
295
301
  writeCliUpdatePreferences(next, homeDir);
296
302
  return next;
297
303
  }
298
- function clearCliPinnedVersion(homeDir = homedir()) {
304
+ function clearCliPinnedVersion(homeDir = defaultHomeDir()) {
299
305
  const current = readCliUpdatePreferences(homeDir);
300
306
  if (current.pinnedVersion === null) return current;
301
307
  const next = { ...current, pinnedVersion: null };
302
308
  writeCliUpdatePreferences(next, homeDir);
303
309
  return next;
304
310
  }
305
- function shouldRunCliAutoUpdate(homeDir = homedir()) {
311
+ function shouldRunCliAutoUpdate(homeDir = defaultHomeDir()) {
306
312
  const preferences = readCliUpdatePreferences(homeDir);
307
313
  return preferences.autoUpdateEnabled && preferences.pinnedVersion === null;
308
314
  }
@@ -489,7 +495,12 @@ function normalizedNpmPrefix(value) {
489
495
  }
490
496
  function resolveNpmGlobalPrefix(env) {
491
497
  try {
492
- const plan = resolveShellSpawn("npm", ["prefix", "-g"], process.platform, env);
498
+ const plan = resolveShellSpawn(
499
+ "npm",
500
+ ["prefix", "-g"],
501
+ process.platform,
502
+ env
503
+ );
493
504
  const result = spawnSync(plan.command, plan.args, {
494
505
  encoding: "utf8",
495
506
  env,
@@ -636,24 +647,126 @@ function matchingAutoUpdateFailure(plan) {
636
647
  return marker;
637
648
  }
638
649
  async function runAutomaticUpdatePlan(plan) {
639
- const previousFailure = matchingAutoUpdateFailure(plan);
640
- if (previousFailure) {
650
+ try {
651
+ const installation = resolveUpdateInstallation(plan);
652
+ return await withUpdateLock(installation?.directory ?? null, async () => {
653
+ const previousFailure = matchingAutoUpdateFailure(plan);
654
+ if (previousFailure) {
655
+ process.stderr.write(
656
+ [
657
+ "Skipping Deepline SDK/CLI auto-update because this same update already failed on this machine.",
658
+ `Fix Node/npm native package installation issues, then run: ${previousFailure.manualCommand}`,
659
+ "Common causes include broken esbuild installs, node-gyp build toolchain errors, npm cache corruption, or registry/network failures.",
660
+ ""
661
+ ].join("\n")
662
+ );
663
+ return {
664
+ status: "skipped_previous_failure",
665
+ exitCode: previousFailure.exitCode || 1,
666
+ previousFailure
667
+ };
668
+ }
669
+ const targetVersion = autoUpdatePackageSpec(plan).match(
670
+ /^deepline@(\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?)$/
671
+ )?.[1];
672
+ const installedVersion = installedUpdateVersion(installation);
673
+ if (targetVersion && parseSemver(installedVersion) && compareUpdateVersions(installedVersion, targetVersion) >= 0) {
674
+ return { status: "updated", exitCode: 0 };
675
+ }
676
+ const exitCode = await applyUpdatePlan(plan);
677
+ return exitCode === 0 ? { status: "updated", exitCode: 0 } : { status: "failed", exitCode };
678
+ });
679
+ } catch (error) {
641
680
  process.stderr.write(
642
- [
643
- "Skipping Deepline SDK/CLI auto-update because this same update already failed on this machine.",
644
- `Fix Node/npm native package installation issues, then run: ${previousFailure.manualCommand}`,
645
- "Common causes include broken esbuild installs, node-gyp build toolchain errors, npm cache corruption, or registry/network failures.",
646
- ""
647
- ].join("\n")
681
+ `Could not complete the automatic Deepline CLI update: ${error instanceof Error ? error.message : String(error)}
682
+ `
648
683
  );
649
- return {
650
- status: "skipped_previous_failure",
651
- exitCode: previousFailure.exitCode || 1,
652
- previousFailure
653
- };
684
+ return { status: "failed", exitCode: 1 };
685
+ }
686
+ }
687
+ function parseSemver(version) {
688
+ const match = /^v?(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?$/.exec(
689
+ version.trim()
690
+ );
691
+ if (!match) return null;
692
+ return {
693
+ major: Number(match[1]),
694
+ minor: Number(match[2]),
695
+ patch: Number(match[3]),
696
+ prerelease: match[4] ?? ""
697
+ };
698
+ }
699
+ function compareUpdateVersions(left, right) {
700
+ const a = parseSemver(left);
701
+ const b = parseSemver(right);
702
+ if (!a || !b) return left.localeCompare(right);
703
+ for (const key of ["major", "minor", "patch"]) {
704
+ if (a[key] !== b[key]) return a[key] > b[key] ? 1 : -1;
705
+ }
706
+ if (a.prerelease === b.prerelease) return 0;
707
+ if (!a.prerelease) return 1;
708
+ if (!b.prerelease) return -1;
709
+ return a.prerelease.localeCompare(b.prerelease);
710
+ }
711
+ function resolveUpdateInstallation(plan) {
712
+ if (plan.kind === "source" || plan.kind === "homebrew") return null;
713
+ const prefixIndex = plan.kind === "npm-global" ? plan.args.indexOf("--prefix") : -1;
714
+ const directory = plan.kind === "python-sidecar" ? plan.stateDir : plan.installPrefix ?? (prefixIndex >= 0 ? plan.args[prefixIndex + 1] : void 0) ?? resolveNpmGlobalPrefix(process.env);
715
+ if (!directory)
716
+ throw new Error("Cannot determine the npm global installation to lock.");
717
+ return {
718
+ kind: plan.kind,
719
+ directory: normalizedNpmPrefix(directory) ?? resolve2(directory)
720
+ };
721
+ }
722
+ function installedUpdateVersion(installation) {
723
+ if (!installation) return "";
724
+ const { kind, directory } = installation;
725
+ if (kind === "python-sidecar") {
726
+ try {
727
+ const version = safeVersionSegment(
728
+ readFileSync3(join3(directory, ".version"), "utf8")
729
+ );
730
+ return !version || sidecarStructureFailure(join3(directory, "versions", version)) ? "" : version;
731
+ } catch {
732
+ return "";
733
+ }
734
+ }
735
+ return installedPackageVersion(
736
+ process.platform === "win32" ? directory : join3(directory, "lib")
737
+ );
738
+ }
739
+ async function withUpdateLock(installationDirectory, action) {
740
+ if (!installationDirectory) return action();
741
+ mkdirSync2(installationDirectory, { recursive: true });
742
+ const lockPath = join3(installationDirectory, ".deepline-update.lock");
743
+ const deadline = Date.now() + 12e4;
744
+ let waiting = false;
745
+ for (; ; ) {
746
+ try {
747
+ mkdirSync2(lockPath, { mode: 448 });
748
+ break;
749
+ } catch (error) {
750
+ if (error.code !== "EEXIST") throw error;
751
+ if (Date.now() >= deadline) {
752
+ throw new Error(
753
+ `Timed out waiting for the Deepline CLI update lock at ${lockPath}. Check for an active installer before removing a lock left by an interrupted update.`
754
+ );
755
+ }
756
+ if (!waiting) {
757
+ process.stderr.write(
758
+ "Another Deepline CLI update is in progress; waiting for it to finish.\n"
759
+ );
760
+ waiting = true;
761
+ }
762
+ await delay(100);
763
+ }
764
+ }
765
+ try {
766
+ return await action();
767
+ } finally {
768
+ rmSync2(lockPath, { recursive: true });
654
769
  }
655
- const exitCode = await runUpdatePlan(plan);
656
- return exitCode === 0 ? { status: "updated", exitCode: 0 } : { status: "failed", exitCode };
657
770
  }
658
771
  function safeVersionSegment(value) {
659
772
  const normalized = value.trim();
@@ -1014,6 +1127,13 @@ async function runPythonSidecarUpdatePlan(plan) {
1014
1127
  return 0;
1015
1128
  }
1016
1129
  async function runUpdatePlan(plan) {
1130
+ const installation = resolveUpdateInstallation(plan);
1131
+ return withUpdateLock(
1132
+ installation?.directory ?? null,
1133
+ () => applyUpdatePlan(plan)
1134
+ );
1135
+ }
1136
+ async function applyUpdatePlan(plan) {
1017
1137
  let exitCode = 1;
1018
1138
  if (plan.kind === "npm-global") {
1019
1139
  exitCode = await runNpmInstallWithRegistryFallback({
@@ -1246,6 +1366,7 @@ export {
1246
1366
  canAutomaticallyApplyUpdatePlan,
1247
1367
  resolveUpdatePlan,
1248
1368
  runAutomaticUpdatePlan,
1369
+ compareUpdateVersions,
1249
1370
  runUpdatePlan,
1250
1371
  publishedVersionSupportsPin,
1251
1372
  runUpdateCommand,
@@ -3,7 +3,7 @@ import {
3
3
  formatModelDescription,
4
4
  publicToolSchemas,
5
5
  toolMetadataJsonForDescribe
6
- } from "./chunk-BZAMOCPA.mjs";
6
+ } from "./chunk-IMZ56EOH.mjs";
7
7
  import {
8
8
  buildPlayDashboardUrl,
9
9
  byokLines,
@@ -16,7 +16,7 @@ import {
16
16
  } from "./chunk-IHG7UAHD.mjs";
17
17
  import {
18
18
  DeeplineError
19
- } from "./chunk-NXGCO4JB.mjs";
19
+ } from "./chunk-E4IXDAZI.mjs";
20
20
 
21
21
  // src/cli/tool-features.ts
22
22
  var VIEWS = {
@@ -0,0 +1,35 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+ var _chunk2WUY3VNKjs = require('./chunk-2WUY3VNK.js');
4
+
5
+
6
+
7
+
8
+ var _chunkTPFD4F5Sjs = require('./chunk-TPFD4F5S.js');
9
+
10
+ // src/cli/play-run-admission.ts
11
+ function usesInlinePlayAdmission(command, args) {
12
+ return command === "plays run" && args.includes("--json") && !args.includes("--no-wait") && !args.some(
13
+ (arg) => arg === "--run-id-file" || arg.startsWith("--run-id-file=")
14
+ );
15
+ }
16
+ async function checkPlayRunCompatibility(baseUrl, maintenancePolicy = "configured") {
17
+ if (maintenancePolicy !== "off") _chunkTPFD4F5Sjs.flushDeferredSkillsSyncNotices.call(void 0, baseUrl);
18
+ const compatibility = await _chunk2WUY3VNKjs.traceCliSpan.call(void 0,
19
+ "cli.sdk_compatibility",
20
+ { baseUrl, command: "plays run" },
21
+ () => _chunkTPFD4F5Sjs.checkSdkCompatibility.call(void 0, baseUrl, {
22
+ command: "plays run",
23
+ persistCache: maintenancePolicy !== "off"
24
+ })
25
+ );
26
+ if (compatibility.error) throw compatibility.error;
27
+ _chunkTPFD4F5Sjs.enforceSdkCompatibilityResponse.call(void 0, compatibility.response, {
28
+ quietAdvisory: true
29
+ });
30
+ }
31
+
32
+
33
+
34
+
35
+ exports.usesInlinePlayAdmission = usesInlinePlayAdmission; exports.checkPlayRunCompatibility = checkPlayRunCompatibility;