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
@@ -3,7 +3,7 @@
3
3
 
4
4
 
5
5
 
6
- var _chunkQ2E4E4FJjs = require('./chunk-Q2E4E4FJ.js');
6
+ var _chunkNPBJI7REjs = require('./chunk-NPBJI7RE.js');
7
7
 
8
8
 
9
9
 
@@ -14,10 +14,10 @@ var _chunkXNYIZMNQjs = require('./chunk-XNYIZMNQ.js');
14
14
 
15
15
 
16
16
 
17
- var _chunk7P5AA3SNjs = require('./chunk-7P5AA3SN.js');
17
+ var _chunkPPDBRJRWjs = require('./chunk-PPDBRJRW.js');
18
18
 
19
19
 
20
- var _chunkDEC3JECCjs = require('./chunk-DEC3JECC.js');
20
+ var _chunkRMINBDYYjs = require('./chunk-RMINBDYY.js');
21
21
 
22
22
  // src/config.ts
23
23
 
@@ -378,7 +378,7 @@ function resolveBaseUrlOnly(options) {
378
378
  _optionalChain([options, 'optionalAccess', _32 => _32.baseUrl, 'optionalAccess', _33 => _33.trim, 'call', _34 => _34()]) || autoDetectBaseUrl()
379
379
  );
380
380
  if (!baseUrl) {
381
- throw new (0, _chunkQ2E4E4FJjs.ConfigError)(
381
+ throw new (0, _chunkNPBJI7REjs.ConfigError)(
382
382
  `Invalid ${HOST_URL_ENV}. Expected an http(s) URL such as https://code.deepline.com.`
383
383
  );
384
384
  }
@@ -389,13 +389,13 @@ function resolveConfig(options) {
389
389
  _optionalChain([options, 'optionalAccess', _35 => _35.baseUrl, 'optionalAccess', _36 => _36.trim, 'call', _37 => _37()]) || autoDetectBaseUrl()
390
390
  );
391
391
  if (!baseUrl) {
392
- throw new (0, _chunkQ2E4E4FJjs.ConfigError)(
392
+ throw new (0, _chunkNPBJI7REjs.ConfigError)(
393
393
  `Invalid ${HOST_URL_ENV}. Expected an http(s) URL such as https://code.deepline.com.`
394
394
  );
395
395
  }
396
396
  const apiKey = resolveApiKeyForBaseUrl(baseUrl, _optionalChain([options, 'optionalAccess', _38 => _38.apiKey]));
397
397
  if (!apiKey) {
398
- throw new (0, _chunkQ2E4E4FJjs.ConfigError)(
398
+ throw new (0, _chunkNPBJI7REjs.ConfigError)(
399
399
  `No API key found. Set ${API_KEY_ENV}, add it to .env.deepline, or run: deepline auth register`
400
400
  );
401
401
  }
@@ -498,7 +498,7 @@ function findNearestGitCommonDir(startDir) {
498
498
  function saveProjectDeeplineEnvValues(values, startDir = process.cwd()) {
499
499
  const target = resolveProjectPinTarget(startDir);
500
500
  if (!target.ok) {
501
- throw new (0, _chunkQ2E4E4FJjs.ConfigError)(
501
+ throw new (0, _chunkNPBJI7REjs.ConfigError)(
502
502
  `Cowork project folder is ambiguous. Candidate folders: ${target.candidates.join(
503
503
  ", "
504
504
  )}. Set CLAUDE_PROJECT_DIR or cd into the intended project folder before running this command.`
@@ -649,9 +649,9 @@ function resolveCliCommandContext(inputConfig, requestedScope) {
649
649
  }
650
650
 
651
651
  // src/version.ts
652
- var SDK_VERSION = _chunkDEC3JECCjs.SDK_RELEASE.version;
653
- var SDK_API_MAJOR = _chunkDEC3JECCjs.SDK_RELEASE.contracts.api.currentMajor;
654
- var SDK_API_CONTRACT = _nullishCoalesce(_chunkDEC3JECCjs.SDK_RELEASE.contracts.api.legacyWireIds[0], () => ( `api-v${SDK_API_MAJOR}`));
652
+ var SDK_VERSION = _chunkRMINBDYYjs.SDK_RELEASE.version;
653
+ var SDK_API_MAJOR = _chunkRMINBDYYjs.SDK_RELEASE.contracts.api.currentMajor;
654
+ var SDK_API_CONTRACT = _nullishCoalesce(_chunkRMINBDYYjs.SDK_RELEASE.contracts.api.legacyWireIds[0], () => ( `api-v${SDK_API_MAJOR}`));
655
655
 
656
656
  // src/agent-runtime.ts
657
657
 
@@ -682,9 +682,14 @@ var AGENT_SESSION_ID_VARIABLES = [
682
682
  "CODEX_SESSION_ID",
683
683
  "CODEX_THREAD_ID"
684
684
  ];
685
- function agentSessionIdFromEnvironment(env = process.env) {
686
- for (const variable of AGENT_SESSION_ID_VARIABLES) {
687
- const sessionId = _optionalChain([env, 'access', _67 => _67[variable], 'optionalAccess', _68 => _68.trim, 'call', _69 => _69()]);
685
+ function agentSessionIdFromEnvironment(env = process.env, agentRuntime) {
686
+ const detectedRuntime = normalizeAgentRuntime(
687
+ _nullishCoalesce(agentRuntime, () => ( env.DEEPLINE_AGENT_RUNTIME))
688
+ );
689
+ const runtime = _nullishCoalesce((detectedRuntime === "unknown" ? null : detectedRuntime), () => ( (_optionalChain([env, 'access', _67 => _67.CODEX_SESSION_ID, 'optionalAccess', _68 => _68.trim, 'call', _69 => _69()]) || _optionalChain([env, 'access', _70 => _70.CODEX_THREAD_ID, 'optionalAccess', _71 => _71.trim, 'call', _72 => _72()]) ? "codex" : null)));
690
+ const variables = runtime === "codex" ? ["CODEX_SESSION_ID", "CODEX_THREAD_ID"] : runtime === "claude_code" || runtime === "claude_cowork" ? ["CLAUDE_CODE_SESSION_ID"] : runtime === null ? AGENT_SESSION_ID_VARIABLES : [];
691
+ for (const variable of variables) {
692
+ const sessionId = _optionalChain([env, 'access', _73 => _73[variable], 'optionalAccess', _74 => _74.trim, 'call', _75 => _75()]);
688
693
  if (sessionId) return sessionId;
689
694
  }
690
695
  return null;
@@ -692,9 +697,9 @@ function agentSessionIdFromEnvironment(env = process.env) {
692
697
  function isCoworkLikeSandbox2() {
693
698
  const pluginMode = truthyEnv("DEEPLINE_PLUGIN_MODE");
694
699
  const claudeRemote = truthyEnv("CLAUDE_CODE_REMOTE");
695
- const projectDir = Boolean(_optionalChain([process, 'access', _70 => _70.env, 'access', _71 => _71.CLAUDE_PROJECT_DIR, 'optionalAccess', _72 => _72.trim, 'call', _73 => _73()]));
696
- const pluginRoot = Boolean(_optionalChain([process, 'access', _74 => _74.env, 'access', _75 => _75.DEEPLINE_PLUGIN_ROOT, 'optionalAccess', _76 => _76.trim, 'call', _77 => _77()]));
697
- const home = _optionalChain([process, 'access', _78 => _78.env, 'access', _79 => _79.HOME, 'optionalAccess', _80 => _80.trim, 'call', _81 => _81()]) || _os.homedir.call(void 0, );
700
+ const projectDir = Boolean(_optionalChain([process, 'access', _76 => _76.env, 'access', _77 => _77.CLAUDE_PROJECT_DIR, 'optionalAccess', _78 => _78.trim, 'call', _79 => _79()]));
701
+ const pluginRoot = Boolean(_optionalChain([process, 'access', _80 => _80.env, 'access', _81 => _81.DEEPLINE_PLUGIN_ROOT, 'optionalAccess', _82 => _82.trim, 'call', _83 => _83()]));
702
+ const home = _optionalChain([process, 'access', _84 => _84.env, 'access', _85 => _85.HOME, 'optionalAccess', _86 => _86.trim, 'call', _87 => _87()]) || _os.homedir.call(void 0, );
698
703
  const sessionHome = home === "/sessions" || home.startsWith("/sessions/");
699
704
  return claudeRemote || sessionHome || (pluginMode || pluginRoot) && projectDir;
700
705
  }
@@ -702,22 +707,22 @@ function detectAgentRuntime(options = {}) {
702
707
  const env = _nullishCoalesce(options.env, () => ( process.env));
703
708
  const explicit = normalizeAgentRuntime(env.DEEPLINE_AGENT_RUNTIME);
704
709
  if (explicit) return explicit;
705
- if (_optionalChain([env, 'access', _82 => _82.CODEX_THREAD_ID, 'optionalAccess', _83 => _83.trim, 'call', _84 => _84()])) return "codex";
710
+ if (_optionalChain([env, 'access', _88 => _88.CODEX_THREAD_ID, 'optionalAccess', _89 => _89.trim, 'call', _90 => _90()])) return "codex";
706
711
  if (options.detectCowork !== false && isCoworkLikeSandbox2()) {
707
712
  return "claude_cowork";
708
713
  }
709
- if (_optionalChain([env, 'access', _85 => _85.CLAUDECODE, 'optionalAccess', _86 => _86.trim, 'call', _87 => _87()]) === "1") return "claude_code";
710
- if (_optionalChain([env, 'access', _88 => _88.CLINE_ACTIVE, 'optionalAccess', _89 => _89.trim, 'call', _90 => _90(), 'access', _91 => _91.toLowerCase, 'call', _92 => _92()]) === "true") return "cline";
711
- if (_optionalChain([env, 'access', _93 => _93.CURSOR_TRACE_ID, 'optionalAccess', _94 => _94.trim, 'call', _95 => _95()]) || _optionalChain([env, 'access', _96 => _96.CURSOR_AGENT, 'optionalAccess', _97 => _97.trim, 'call', _98 => _98()])) {
714
+ if (_optionalChain([env, 'access', _91 => _91.CLAUDECODE, 'optionalAccess', _92 => _92.trim, 'call', _93 => _93()]) === "1") return "claude_code";
715
+ if (_optionalChain([env, 'access', _94 => _94.CLINE_ACTIVE, 'optionalAccess', _95 => _95.trim, 'call', _96 => _96(), 'access', _97 => _97.toLowerCase, 'call', _98 => _98()]) === "true") return "cline";
716
+ if (_optionalChain([env, 'access', _99 => _99.CURSOR_TRACE_ID, 'optionalAccess', _100 => _100.trim, 'call', _101 => _101()]) || _optionalChain([env, 'access', _102 => _102.CURSOR_AGENT, 'optionalAccess', _103 => _103.trim, 'call', _104 => _104()])) {
712
717
  return "cursor";
713
718
  }
714
- if (_optionalChain([env, 'access', _99 => _99.WINDSURF, 'optionalAccess', _100 => _100.trim, 'call', _101 => _101()]) || _optionalChain([env, 'access', _102 => _102.CASCADE, 'optionalAccess', _103 => _103.trim, 'call', _104 => _104()])) {
719
+ if (_optionalChain([env, 'access', _105 => _105.WINDSURF, 'optionalAccess', _106 => _106.trim, 'call', _107 => _107()]) || _optionalChain([env, 'access', _108 => _108.CASCADE, 'optionalAccess', _109 => _109.trim, 'call', _110 => _110()])) {
715
720
  return "windsurf";
716
721
  }
717
- if (_optionalChain([env, 'access', _105 => _105.ANTIGRAVITY, 'optionalAccess', _106 => _106.trim, 'call', _107 => _107()]) || _optionalChain([env, 'access', _108 => _108.ANTIGRAVITY_CLI, 'optionalAccess', _109 => _109.trim, 'call', _110 => _110()]) || _optionalChain([env, 'access', _111 => _111.ANTIGRAVITY_AGENT, 'optionalAccess', _112 => _112.trim, 'call', _113 => _113()]) || _optionalChain([env, 'access', _114 => _114.ANTIGRAVITY_WORKSPACE, 'optionalAccess', _115 => _115.trim, 'call', _116 => _116()])) {
722
+ if (_optionalChain([env, 'access', _111 => _111.ANTIGRAVITY, 'optionalAccess', _112 => _112.trim, 'call', _113 => _113()]) || _optionalChain([env, 'access', _114 => _114.ANTIGRAVITY_CLI, 'optionalAccess', _115 => _115.trim, 'call', _116 => _116()]) || _optionalChain([env, 'access', _117 => _117.ANTIGRAVITY_AGENT, 'optionalAccess', _118 => _118.trim, 'call', _119 => _119()]) || _optionalChain([env, 'access', _120 => _120.ANTIGRAVITY_WORKSPACE, 'optionalAccess', _121 => _121.trim, 'call', _122 => _122()])) {
718
723
  return "antigravity";
719
724
  }
720
- if (_optionalChain([env, 'access', _117 => _117.GEMINI_CLI, 'optionalAccess', _118 => _118.trim, 'call', _119 => _119()]) || _optionalChain([env, 'access', _120 => _120.GEMINI_CLI_VERSION, 'optionalAccess', _121 => _121.trim, 'call', _122 => _122()]) || _optionalChain([env, 'access', _123 => _123.GEMINI_SANDBOX, 'optionalAccess', _124 => _124.trim, 'call', _125 => _125()]) || _optionalChain([env, 'access', _126 => _126.GEMINI_CONFIG_DIR, 'optionalAccess', _127 => _127.trim, 'call', _128 => _128()])) {
725
+ if (_optionalChain([env, 'access', _123 => _123.GEMINI_CLI, 'optionalAccess', _124 => _124.trim, 'call', _125 => _125()]) || _optionalChain([env, 'access', _126 => _126.GEMINI_CLI_VERSION, 'optionalAccess', _127 => _127.trim, 'call', _128 => _128()]) || _optionalChain([env, 'access', _129 => _129.GEMINI_SANDBOX, 'optionalAccess', _130 => _130.trim, 'call', _131 => _131()]) || _optionalChain([env, 'access', _132 => _132.GEMINI_CONFIG_DIR, 'optionalAccess', _133 => _133.trim, 'call', _134 => _134()])) {
721
726
  return "gemini";
722
727
  }
723
728
  return _nullishCoalesce(options.defaultRuntime, () => ( "unknown"));
@@ -727,11 +732,11 @@ function detectAgentRuntime(options = {}) {
727
732
 
728
733
 
729
734
  function activePluginSkillsDir() {
730
- const pluginMode = _optionalChain([process, 'access', _129 => _129.env, 'access', _130 => _130.DEEPLINE_PLUGIN_MODE, 'optionalAccess', _131 => _131.trim, 'call', _132 => _132(), 'access', _133 => _133.toLowerCase, 'call', _134 => _134()]);
735
+ const pluginMode = _optionalChain([process, 'access', _135 => _135.env, 'access', _136 => _136.DEEPLINE_PLUGIN_MODE, 'optionalAccess', _137 => _137.trim, 'call', _138 => _138(), 'access', _139 => _139.toLowerCase, 'call', _140 => _140()]);
731
736
  if (pluginMode !== "true" && pluginMode !== "1" && pluginMode !== "yes" && pluginMode !== "on") {
732
737
  return "";
733
738
  }
734
- const dir = _nullishCoalesce(_optionalChain([process, 'access', _135 => _135.env, 'access', _136 => _136.DEEPLINE_PLUGIN_SKILLS_DIR, 'optionalAccess', _137 => _137.trim, 'call', _138 => _138()]), () => ( ""));
739
+ const dir = _nullishCoalesce(_optionalChain([process, 'access', _141 => _141.env, 'access', _142 => _142.DEEPLINE_PLUGIN_SKILLS_DIR, 'optionalAccess', _143 => _143.trim, 'call', _144 => _144()]), () => ( ""));
735
740
  return dir && _fs.existsSync.call(void 0, dir) ? dir : "";
736
741
  }
737
742
  function hasActivePluginSkills() {
@@ -860,7 +865,7 @@ var fetchWithDeploymentProtection = (input, init) => {
860
865
  const headers = new Headers(
861
866
  input instanceof Request ? input.headers : void 0
862
867
  );
863
- new Headers(_optionalChain([init, 'optionalAccess', _139 => _139.headers])).forEach((value, name) => headers.set(name, value));
868
+ new Headers(_optionalChain([init, 'optionalAccess', _145 => _145.headers])).forEach((value, name) => headers.set(name, value));
864
869
  for (const [name, value] of Object.entries(deploymentProtectionHeaders())) {
865
870
  headers.set(name, value);
866
871
  }
@@ -878,285 +883,24 @@ var ABSURD_RELEASE_OVERRIDE_HEADER = "x-deepline-absurd-release";
878
883
  var PREFERRED_RECEIPT_GATEWAY_MACHINE_ID_HEADER = "x-deepline-preferred-receipt-gateway-machine-id";
879
884
  var SYNTHETIC_RUN_HEADER = "x-deepline-synthetic-run";
880
885
 
881
- // ../play-runtime/runtime-incident-drills.ts
882
- var RUNTIME_TEST_FAULT_IDS = [
883
- "receipt_complete_write_fail",
884
- "receipt_fail_write_fail",
885
- "worker_receipt_complete_write_fail",
886
- "invocation_response_delivery_abort",
887
- "execution_upstream_response_loss",
888
- "receipt_gateway_hold_ms",
889
- "receipt_claim_query_hold_once_ms",
890
- "receipt_claim_response_timeout",
891
- "modal_sandbox_create_resource_exhausted",
892
- "runtime_sheet_page_tail_hold_ms"
893
- ];
894
- var LOCAL_TOPOLOGY = ["local_daytona"];
895
- var LOCAL_AND_PREVIEW_TOPOLOGIES = [
896
- "local_daytona",
897
- "preview_fly",
898
- "preview_direct_modal"
899
- ];
900
- var MODAL_PREVIEW_TOPOLOGY = ["preview_direct_modal"];
901
- var RUNTIME_INCIDENT_DRILL_CATALOG = [
902
- {
903
- id: "local_worker_process_outage",
904
- description: "Interrupt the scheduler worker in the selected non-production runtime topology.",
905
- topologies: LOCAL_AND_PREVIEW_TOPOLOGIES,
906
- control: {
907
- kind: "process",
908
- component: "worker",
909
- modes: ["pause", "crash"]
910
- },
911
- expected: {
912
- outcome: "The same logical run stays durable through the worker outage and completes after the selected topology recovers.",
913
- safetyFacts: ["same_logical_run", "no_false_success"]
914
- },
915
- verification: {
916
- kind: "local_black_box",
917
- target: "local-component-outage-recovery-e2e"
918
- }
919
- },
920
- {
921
- id: "local_gateway_process_outage",
922
- description: "Interrupt the receipt gateway in the selected non-production runtime topology.",
923
- topologies: LOCAL_AND_PREVIEW_TOPOLOGIES,
924
- control: {
925
- kind: "process",
926
- component: "gateway",
927
- modes: ["pause", "crash"]
928
- },
929
- expected: {
930
- outcome: "In-flight work recovers only at a safe receipt boundary and the same logical run completes after the gateway recovers.",
931
- safetyFacts: [
932
- "same_logical_run",
933
- "no_false_success",
934
- "bounded_provider_execution"
935
- ]
936
- },
937
- verification: {
938
- kind: "local_black_box",
939
- target: "local-component-outage-recovery-e2e"
940
- }
941
- },
942
- {
943
- id: "local_runtime_process_outage",
944
- description: "Interrupt both runtime components in the selected non-production topology.",
945
- topologies: LOCAL_AND_PREVIEW_TOPOLOGIES,
946
- control: { kind: "process", component: "all", modes: ["pause", "crash"] },
947
- expected: {
948
- outcome: "Durable work waits through the combined outage; it never becomes a false success or creates a second logical run.",
949
- safetyFacts: ["same_logical_run", "no_false_success"]
950
- },
951
- verification: {
952
- kind: "local_black_box",
953
- target: "local-component-outage-recovery-e2e"
954
- }
955
- },
956
- {
957
- id: "receipt_complete_write_fail",
958
- description: "Fail the next durable receipt-completion write.",
959
- topologies: LOCAL_AND_PREVIEW_TOPOLOGIES,
960
- control: {
961
- kind: "runtime_test_fault",
962
- defaultValue: 1,
963
- valueMeaning: "occurrence"
964
- },
965
- expected: {
966
- outcome: "The failed run is loud, and a later bounded recovery may repeat the affected provider operation if its prior completion was not durable.",
967
- safetyFacts: ["retry_or_explicit_recovery", "bounded_provider_execution"]
968
- },
969
- verification: {
970
- kind: "local_black_box",
971
- target: "receipt-persist-failure-run-fatal-e2e"
972
- }
973
- },
974
- {
975
- id: "receipt_fail_write_fail",
976
- description: "Fail the next durable receipt-failure write.",
977
- topologies: LOCAL_AND_PREVIEW_TOPOLOGIES,
978
- control: {
979
- kind: "runtime_test_fault",
980
- defaultValue: 1,
981
- valueMeaning: "occurrence"
982
- },
983
- expected: {
984
- outcome: "The failure is loud; recovery remains bounded and may repeat an operation whose prior outcome was not durably recorded.",
985
- safetyFacts: ["retry_or_explicit_recovery", "bounded_provider_execution"]
986
- },
987
- verification: {
988
- kind: "focused_regression",
989
- target: "tests/lib/plays/runtime-test-fault-registry.test.ts"
990
- }
991
- },
992
- {
993
- id: "worker_receipt_complete_write_fail",
994
- description: "Fail the worker-side receipt-completion write once.",
995
- topologies: LOCAL_AND_PREVIEW_TOPOLOGIES,
996
- control: {
997
- kind: "runtime_test_fault",
998
- defaultValue: 1,
999
- valueMeaning: "occurrence"
1000
- },
1001
- expected: {
1002
- outcome: "The worker reports the persistence failure loudly; bounded recovery may repeat work whose completion was not durable.",
1003
- safetyFacts: ["retry_or_explicit_recovery", "bounded_provider_execution"]
1004
- },
1005
- verification: {
1006
- kind: "focused_regression",
1007
- target: "tests/lib/plays/runtime-test-fault-registry.test.ts"
1008
- }
1009
- },
1010
- {
1011
- id: "invocation_response_delivery_abort",
1012
- description: "Abort one receipt-gateway response after invocation delivery.",
1013
- topologies: LOCAL_AND_PREVIEW_TOPOLOGIES,
1014
- control: {
1015
- kind: "runtime_test_fault",
1016
- defaultValue: 1,
1017
- valueMeaning: "occurrence"
1018
- },
1019
- expected: {
1020
- outcome: "The same logical run completes through terminal-cache replay; any provider retry is governed by its separate operation policy.",
1021
- safetyFacts: ["same_logical_run", "bounded_provider_execution"]
1022
- },
1023
- verification: {
1024
- kind: "local_black_box",
1025
- target: "invocation-delivery-replay-e2e"
1026
- }
1027
- },
1028
- {
1029
- id: "execution_upstream_response_loss",
1030
- description: "Lose the first response of each keyed execution after the upstream app durably stores it.",
1031
- topologies: ["preview_fly"],
1032
- control: {
1033
- kind: "runtime_test_fault",
1034
- defaultValue: 1,
1035
- valueMeaning: "occurrence"
1036
- },
1037
- expected: {
1038
- outcome: "The same invocation recovers the stored response without repeating provider work or customer charges, and every row retains its usable result.",
1039
- safetyFacts: [
1040
- "same_logical_run",
1041
- "bounded_provider_execution",
1042
- "all_rows_settle_once",
1043
- "no_false_success"
1044
- ]
1045
- },
1046
- verification: {
1047
- kind: "preview_black_box",
1048
- target: "101-agent-heavy-gateway-load-e2e"
1049
- }
1050
- },
1051
- {
1052
- id: "receipt_gateway_hold_ms",
1053
- description: "Hold one checked-out receipt-gateway scheduler client.",
1054
- topologies: LOCAL_AND_PREVIEW_TOPOLOGIES,
1055
- control: {
1056
- kind: "runtime_test_fault",
1057
- defaultValue: 500,
1058
- valueMeaning: "milliseconds"
1059
- },
1060
- expected: {
1061
- outcome: "The request is delayed inside the real gateway pool and either completes within its deadline or follows bounded transport recovery.",
1062
- safetyFacts: ["bounded_provider_execution"]
1063
- },
1064
- verification: {
1065
- kind: "local_black_box",
1066
- target: "agent-heavy-gateway-load-e2e"
1067
- }
1068
- },
1069
- {
1070
- id: "receipt_claim_query_hold_once_ms",
1071
- description: "Hold one physical receipt-claim query.",
1072
- topologies: LOCAL_AND_PREVIEW_TOPOLOGIES,
1073
- control: {
1074
- kind: "runtime_test_fault",
1075
- defaultValue: 500,
1076
- valueMeaning: "milliseconds"
1077
- },
1078
- expected: {
1079
- outcome: "The checked-out claim either completes or times out through bounded recovery; an ambiguous outcome may be retried within its budget.",
1080
- safetyFacts: ["bounded_provider_execution"]
1081
- },
1082
- verification: {
1083
- kind: "local_black_box",
1084
- target: "receipt-claim-deadline-recovery-e2e"
1085
- }
1086
- },
1087
- {
1088
- id: "receipt_claim_response_timeout",
1089
- description: "Report one fully received receipt-claim response as timed out.",
1090
- topologies: LOCAL_AND_PREVIEW_TOPOLOGIES,
1091
- control: {
1092
- kind: "runtime_test_fault",
1093
- defaultValue: 1,
1094
- valueMeaning: "occurrence"
1095
- },
1096
- expected: {
1097
- outcome: "The same logical run completes by replaying the committed receipt response or uses bounded recovery if that response is unavailable.",
1098
- safetyFacts: ["same_logical_run", "bounded_provider_execution"]
1099
- },
1100
- verification: {
1101
- kind: "local_black_box",
1102
- target: "receipt-ambiguous-response-recovery-e2e"
1103
- }
1104
- },
1105
- {
1106
- id: "modal_sandbox_create_resource_exhausted",
1107
- description: "Make Modal sandbox creation return RESOURCE_EXHAUSTED before user code.",
1108
- topologies: MODAL_PREVIEW_TOPOLOGY,
1109
- control: {
1110
- kind: "runtime_test_fault",
1111
- defaultValue: 1,
1112
- valueMeaning: "occurrence"
1113
- },
1114
- expected: {
1115
- outcome: "The same logical run enters bounded pre-code defer/recovery and later retries sandbox startup; no user code or provider call precedes the retry.",
1116
- safetyFacts: [
1117
- "same_logical_run",
1118
- "no_user_code_before_recovery",
1119
- "bounded_provider_execution"
1120
- ]
1121
- },
1122
- verification: {
1123
- kind: "preview_black_box",
1124
- target: "modal-sandbox-recovery-e2e"
1125
- }
1126
- },
1127
- {
1128
- id: "runtime_sheet_page_tail_hold_ms",
1129
- description: "Hold one runtime-sheet tail-page operation.",
1130
- topologies: LOCAL_TOPOLOGY,
1131
- control: {
1132
- kind: "runtime_test_fault",
1133
- defaultValue: 500,
1134
- valueMeaning: "milliseconds"
1135
- },
1136
- expected: {
1137
- outcome: "Page-tail work stays pending during the bounded hold, then completes without losing or duplicating rows.",
1138
- safetyFacts: ["all_rows_settle_once"]
1139
- },
1140
- verification: {
1141
- kind: "local_black_box",
1142
- target: "page-tail-sheet-write-hold-e2e"
1143
- }
1144
- }
1145
- ];
1146
- function isRuntimeTestFaultDrill(drill) {
1147
- return drill.control.kind === "runtime_test_fault" && RUNTIME_TEST_FAULT_IDS.some((faultId) => faultId === drill.id);
1148
- }
1149
- function runtimeTestFaultDrills() {
1150
- return RUNTIME_INCIDENT_DRILL_CATALOG.filter(isRuntimeTestFaultDrill);
1151
- }
1152
-
1153
886
  // ../play-runtime/test-runtime-seams.ts
1154
887
  var PLAY_RUNTIME_TEST_FAULT_HEADER = "x-deepline-test-fault";
1155
- var SUPPORTED_RUNTIME_TEST_FAULTS = new Set(
1156
- runtimeTestFaultDrills().map(({ id }) => id)
1157
- );
1158
888
  var MAX_RUNTIME_TEST_POLICY_MS = 10 * 6e4;
1159
889
 
890
+ // ../integration-contracts/execute-retry-contract.ts
891
+ var EXECUTE_RETRY_POLICY_HEADER = "x-deepline-execute-retry-policy";
892
+ var EXECUTE_RETRY_POLICY_VERSION = 1;
893
+ function parseExecuteRetryPolicy(value) {
894
+ if (value === `v${EXECUTE_RETRY_POLICY_VERSION}:transient-http-safe`) {
895
+ return "transient-http-safe";
896
+ }
897
+ if (value === `v${EXECUTE_RETRY_POLICY_VERSION}:transient-http-unsafe`) {
898
+ return "transient-http-unsafe";
899
+ }
900
+ return null;
901
+ }
902
+ var ATOMIC_TOOL_EXECUTE_SUPPORTED_HEADER = "x-deepline-atomic-tool-supported";
903
+
1160
904
  // src/http.ts
1161
905
  var MAX_DIAGNOSTIC_HEADER_LENGTH = 120;
1162
906
  var COWORK_NETWORK_HINT = "Claude Cowork appears to be running Deepline in a network-restricted sandbox. In Claude Desktop, open Settings > Capabilities, turn on Allow network egress, and set Domain allowlist to All domains for the Cowork session.";
@@ -1207,7 +951,7 @@ function withErrorCause(error, cause) {
1207
951
  }
1208
952
  function mapNetworkError(baseUrl, error, targetLabel) {
1209
953
  const tagged = error;
1210
- const timeoutMs = _optionalChain([tagged, 'optionalAccess', _140 => _140[REQUEST_TIMEOUT_MARKER]]);
954
+ const timeoutMs = _optionalChain([tagged, 'optionalAccess', _146 => _146[REQUEST_TIMEOUT_MARKER]]);
1211
955
  if (typeof timeoutMs === "number") {
1212
956
  return {
1213
957
  message: `Request to ${targetLabel} timed out after ${timeoutMs}ms while waiting for a response.`,
@@ -1215,14 +959,14 @@ function mapNetworkError(baseUrl, error, targetLabel) {
1215
959
  details: { timeoutMs, target: targetLabel }
1216
960
  };
1217
961
  }
1218
- if (_optionalChain([tagged, 'optionalAccess', _141 => _141[REQUEST_ABORT_MARKER]])) {
962
+ if (_optionalChain([tagged, 'optionalAccess', _147 => _147[REQUEST_ABORT_MARKER]])) {
1219
963
  return {
1220
964
  message: `Request to ${targetLabel} was aborted before it completed.`,
1221
965
  code: "NETWORK_ABORTED"
1222
966
  };
1223
967
  }
1224
968
  return {
1225
- message: _optionalChain([error, 'optionalAccess', _142 => _142.message]) ? `Unable to connect to ${baseUrl}. ${error.message}` : `Unable to connect to ${baseUrl}. Is the computer able to access the url?`,
969
+ message: _optionalChain([error, 'optionalAccess', _148 => _148.message]) ? `Unable to connect to ${baseUrl}. ${error.message}` : `Unable to connect to ${baseUrl}. Is the computer able to access the url?`,
1226
970
  code: "NETWORK_ERROR"
1227
971
  };
1228
972
  }
@@ -1308,15 +1052,15 @@ var HttpClient = class {
1308
1052
  const coordinatorInternalToken = env.DEEPLINE_INTERNAL_TOKEN;
1309
1053
  const absurdReleaseOverride = env.DEEPLINE_ABSURD_RELEASE;
1310
1054
  const preferredReceiptGatewayMachineId = env.DEEPLINE_PREFERRED_RECEIPT_GATEWAY_MACHINE_ID;
1311
- if (_optionalChain([coordinatorUrl, 'optionalAccess', _143 => _143.trim, 'call', _144 => _144()])) {
1055
+ if (_optionalChain([coordinatorUrl, 'optionalAccess', _149 => _149.trim, 'call', _150 => _150()])) {
1312
1056
  headers[COORDINATOR_URL_OVERRIDE_HEADER] = coordinatorUrl.trim();
1313
1057
  }
1314
1058
  const workerCallbackUrl = env.DEEPLINE_WORKER_CALLBACK_URL;
1315
- if (_optionalChain([workerCallbackUrl, 'optionalAccess', _145 => _145.trim, 'call', _146 => _146()])) {
1059
+ if (_optionalChain([workerCallbackUrl, 'optionalAccess', _151 => _151.trim, 'call', _152 => _152()])) {
1316
1060
  headers[WORKER_CALLBACK_URL_OVERRIDE_HEADER] = workerCallbackUrl.trim();
1317
1061
  }
1318
1062
  const runtimeSchedulerSchema = env.DEEPLINE_RUNTIME_SCHEDULER_SCHEMA;
1319
- if (_optionalChain([runtimeSchedulerSchema, 'optionalAccess', _147 => _147.trim, 'call', _148 => _148()])) {
1063
+ if (_optionalChain([runtimeSchedulerSchema, 'optionalAccess', _153 => _153.trim, 'call', _154 => _154()])) {
1320
1064
  headers[RUNTIME_SCHEDULER_SCHEMA_OVERRIDE_HEADER] = runtimeSchedulerSchema.trim();
1321
1065
  }
1322
1066
  const syntheticRun = env.DEEPLINE_SYNTHETIC_RUN;
@@ -1324,21 +1068,21 @@ var HttpClient = class {
1324
1068
  headers[SYNTHETIC_RUN_HEADER] = "1";
1325
1069
  }
1326
1070
  const runtimeTestFault = env.DEEPLINE_TEST_RUNTIME_FAULT;
1327
- if (_optionalChain([runtimeTestFault, 'optionalAccess', _149 => _149.trim, 'call', _150 => _150()])) {
1071
+ if (_optionalChain([runtimeTestFault, 'optionalAccess', _155 => _155.trim, 'call', _156 => _156()])) {
1328
1072
  headers[PLAY_RUNTIME_TEST_FAULT_HEADER] = runtimeTestFault.trim();
1329
1073
  }
1330
- const retainedReceivers = _optionalChain([env, 'access', _151 => _151.DEEPLINE_RUNTIME_RETAINED_PIPELINE_RECEIVERS, 'optionalAccess', _152 => _152.trim, 'call', _153 => _153()]);
1331
- if (retainedReceivers && _optionalChain([coordinatorInternalToken, 'optionalAccess', _154 => _154.trim, 'call', _155 => _155()])) {
1074
+ const retainedReceivers = _optionalChain([env, 'access', _157 => _157.DEEPLINE_RUNTIME_RETAINED_PIPELINE_RECEIVERS, 'optionalAccess', _158 => _158.trim, 'call', _159 => _159()]);
1075
+ if (retainedReceivers && _optionalChain([coordinatorInternalToken, 'optionalAccess', _160 => _160.trim, 'call', _161 => _161()])) {
1332
1076
  headers[RETAINED_PIPELINE_RECEIVERS_HEADER] = retainedReceivers;
1333
1077
  headers[COORDINATOR_INTERNAL_TOKEN_HEADER] = coordinatorInternalToken.trim();
1334
1078
  }
1335
- if (_optionalChain([absurdReleaseOverride, 'optionalAccess', _156 => _156.trim, 'call', _157 => _157()]) && _optionalChain([coordinatorInternalToken, 'optionalAccess', _158 => _158.trim, 'call', _159 => _159()])) {
1079
+ if (_optionalChain([absurdReleaseOverride, 'optionalAccess', _162 => _162.trim, 'call', _163 => _163()]) && _optionalChain([coordinatorInternalToken, 'optionalAccess', _164 => _164.trim, 'call', _165 => _165()])) {
1336
1080
  headers[ABSURD_RELEASE_OVERRIDE_HEADER] = absurdReleaseOverride.trim();
1337
1081
  }
1338
- if (_optionalChain([preferredReceiptGatewayMachineId, 'optionalAccess', _160 => _160.trim, 'call', _161 => _161()]) && _optionalChain([coordinatorInternalToken, 'optionalAccess', _162 => _162.trim, 'call', _163 => _163()])) {
1082
+ if (_optionalChain([preferredReceiptGatewayMachineId, 'optionalAccess', _166 => _166.trim, 'call', _167 => _167()]) && _optionalChain([coordinatorInternalToken, 'optionalAccess', _168 => _168.trim, 'call', _169 => _169()])) {
1339
1083
  headers[PREFERRED_RECEIPT_GATEWAY_MACHINE_ID_HEADER] = preferredReceiptGatewayMachineId.trim();
1340
1084
  }
1341
- if (_optionalChain([coordinatorInternalToken, 'optionalAccess', _164 => _164.trim, 'call', _165 => _165()]) && (_optionalChain([coordinatorUrl, 'optionalAccess', _166 => _166.trim, 'call', _167 => _167()]) || _optionalChain([workerCallbackUrl, 'optionalAccess', _168 => _168.trim, 'call', _169 => _169()]) || _optionalChain([runtimeTestFault, 'optionalAccess', _170 => _170.trim, 'call', _171 => _171()]) || _optionalChain([absurdReleaseOverride, 'optionalAccess', _172 => _172.trim, 'call', _173 => _173()]) || _optionalChain([preferredReceiptGatewayMachineId, 'optionalAccess', _174 => _174.trim, 'call', _175 => _175()]))) {
1085
+ if (_optionalChain([coordinatorInternalToken, 'optionalAccess', _170 => _170.trim, 'call', _171 => _171()]) && (_optionalChain([coordinatorUrl, 'optionalAccess', _172 => _172.trim, 'call', _173 => _173()]) || _optionalChain([workerCallbackUrl, 'optionalAccess', _174 => _174.trim, 'call', _175 => _175()]) || _optionalChain([runtimeTestFault, 'optionalAccess', _176 => _176.trim, 'call', _177 => _177()]) || _optionalChain([absurdReleaseOverride, 'optionalAccess', _178 => _178.trim, 'call', _179 => _179()]) || _optionalChain([preferredReceiptGatewayMachineId, 'optionalAccess', _180 => _180.trim, 'call', _181 => _181()]))) {
1342
1086
  headers[COORDINATOR_INTERNAL_TOKEN_HEADER] = coordinatorInternalToken.trim();
1343
1087
  }
1344
1088
  return applyExplicitHeaders(
@@ -1363,23 +1107,23 @@ var HttpClient = class {
1363
1107
  async request(path, options) {
1364
1108
  const baseUrl = this.config.baseUrl;
1365
1109
  const url = `${baseUrl}${path}`;
1366
- const method = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _176 => _176.method]), () => ( "GET"));
1110
+ const method = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _182 => _182.method]), () => ( "GET"));
1367
1111
  const requestStartedAt = Date.now();
1368
1112
  let fetchAttempts = 0;
1369
1113
  let lastRequestUrl = url;
1370
1114
  let networkFailedAt;
1371
1115
  let networkPhase = "before_request";
1372
- const headers = this.authHeaders(_optionalChain([options, 'optionalAccess', _177 => _177.headers]));
1373
- if (_optionalChain([options, 'optionalAccess', _178 => _178.body]) !== void 0) {
1116
+ const headers = this.authHeaders(_optionalChain([options, 'optionalAccess', _183 => _183.headers]));
1117
+ if (_optionalChain([options, 'optionalAccess', _184 => _184.body]) !== void 0) {
1374
1118
  applyExplicitHeaders(headers, { "Content-Type": "application/json" });
1375
1119
  }
1376
1120
  let lastError = null;
1377
- const candidateUrls = _optionalChain([options, 'optionalAccess', _179 => _179.exactUrlOnly]) ? [url] : buildCandidateUrls(url);
1121
+ const candidateUrls = _optionalChain([options, 'optionalAccess', _185 => _185.exactUrlOnly]) ? [url] : buildCandidateUrls(url);
1378
1122
  let retryAfterDelayMs = null;
1379
1123
  let totalRetryWaitMs = 0;
1380
- const maxRetries = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _180 => _180.maxRetries]), () => ( this.config.maxRetries));
1124
+ let maxRetries = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _186 => _186.maxRetries]), () => ( this.config.maxRetries));
1381
1125
  requestAttempts: for (let attempt = 0; attempt <= maxRetries; attempt++) {
1382
- if (_optionalChain([options, 'optionalAccess', _181 => _181.signal, 'optionalAccess', _182 => _182.aborted])) {
1126
+ if (_optionalChain([options, 'optionalAccess', _187 => _187.signal, 'optionalAccess', _188 => _188.aborted])) {
1383
1127
  lastError = requestCancelledError(options.signal);
1384
1128
  networkFailedAt = Date.now();
1385
1129
  break;
@@ -1394,7 +1138,7 @@ var HttpClient = class {
1394
1138
  totalRetryWaitMs += delayMs;
1395
1139
  networkPhase = "retry_wait";
1396
1140
  try {
1397
- await sleep(delayMs, _optionalChain([options, 'optionalAccess', _183 => _183.signal]));
1141
+ await sleep(delayMs, _optionalChain([options, 'optionalAccess', _189 => _189.signal]));
1398
1142
  } catch (error) {
1399
1143
  lastError = error instanceof Error ? error : new Error(String(error));
1400
1144
  networkFailedAt = Date.now();
@@ -1402,25 +1146,25 @@ var HttpClient = class {
1402
1146
  }
1403
1147
  }
1404
1148
  for (const candidateUrl of candidateUrls) {
1405
- if (_optionalChain([options, 'optionalAccess', _184 => _184.signal, 'optionalAccess', _185 => _185.aborted])) {
1149
+ if (_optionalChain([options, 'optionalAccess', _190 => _190.signal, 'optionalAccess', _191 => _191.aborted])) {
1406
1150
  lastError = requestCancelledError(options.signal);
1407
1151
  networkFailedAt = Date.now();
1408
1152
  break requestAttempts;
1409
1153
  }
1410
1154
  const controller = new AbortController();
1411
- const timeoutMs = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _186 => _186.timeout]), () => ( this.config.timeout));
1155
+ const timeoutMs = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _192 => _192.timeout]), () => ( this.config.timeout));
1412
1156
  let requestTimedOut = false;
1413
1157
  const timeoutId = setTimeout(() => {
1414
1158
  requestTimedOut = true;
1415
1159
  controller.abort();
1416
1160
  }, timeoutMs);
1417
1161
  const abortRequest = () => controller.abort();
1418
- _optionalChain([options, 'optionalAccess', _187 => _187.signal, 'optionalAccess', _188 => _188.addEventListener, 'call', _189 => _189("abort", abortRequest, {
1162
+ _optionalChain([options, 'optionalAccess', _193 => _193.signal, 'optionalAccess', _194 => _194.addEventListener, 'call', _195 => _195("abort", abortRequest, {
1419
1163
  once: true
1420
1164
  })]);
1421
1165
  networkPhase = "before_request";
1422
1166
  try {
1423
- const requestBody = _optionalChain([options, 'optionalAccess', _190 => _190.formData]) !== void 0 ? typeof options.formData === "function" ? options.formData() : options.formData : _optionalChain([options, 'optionalAccess', _191 => _191.body]) !== void 0 ? JSON.stringify(options.body) : void 0;
1167
+ const requestBody = _optionalChain([options, 'optionalAccess', _196 => _196.formData]) !== void 0 ? typeof options.formData === "function" ? options.formData() : options.formData : _optionalChain([options, 'optionalAccess', _197 => _197.body]) !== void 0 ? JSON.stringify(options.body) : void 0;
1424
1168
  fetchAttempts += 1;
1425
1169
  lastRequestUrl = candidateUrl;
1426
1170
  networkPhase = "awaiting_headers";
@@ -1431,8 +1175,8 @@ var HttpClient = class {
1431
1175
  signal: controller.signal
1432
1176
  });
1433
1177
  networkPhase = "reading_body";
1434
- _optionalChain([options, 'optionalAccess', _192 => _192.onResponse, 'optionalCall', _193 => _193(response)]);
1435
- if (response.status === 404 && _optionalChain([options, 'optionalAccess', _194 => _194.allowNotFound])) {
1178
+ _optionalChain([options, 'optionalAccess', _198 => _198.onResponse, 'optionalCall', _199 => _199(response)]);
1179
+ if (response.status === 404 && _optionalChain([options, 'optionalAccess', _200 => _200.allowNotFound])) {
1436
1180
  clearTimeout(timeoutId);
1437
1181
  return null;
1438
1182
  }
@@ -1440,25 +1184,31 @@ var HttpClient = class {
1440
1184
  const receivedAtMs = Date.now();
1441
1185
  clearTimeout(timeoutId);
1442
1186
  const parsed = parseResponseBody(body);
1443
- _optionalChain([options, 'optionalAccess', _195 => _195.onResponseBody, 'optionalCall', _196 => _196({
1187
+ _optionalChain([options, 'optionalAccess', _201 => _201.onResponseBody, 'optionalCall', _202 => _202({
1444
1188
  receivedAtMs,
1445
1189
  httpStatus: response.status,
1446
1190
  body: parsed
1447
1191
  })]);
1448
- const structuredToolError = _optionalChain([options, 'optionalAccess', _197 => _197.toolId]) && !response.ok ? _chunk7P5AA3SNjs.deserializeToolExecutionFailure.call(void 0,
1192
+ const responseRetryAllowed = _optionalChain([options, 'optionalAccess', _203 => _203.retryFromExecutePolicy]) !== true || parseExecuteRetryPolicy(
1193
+ response.headers.get(EXECUTE_RETRY_POLICY_HEADER)
1194
+ ) === "transient-http-safe";
1195
+ if (_optionalChain([options, 'optionalAccess', _204 => _204.retryFromExecutePolicy]) === true && responseRetryAllowed && options.executePolicyMaxRetries !== void 0) {
1196
+ maxRetries = options.executePolicyMaxRetries;
1197
+ }
1198
+ const structuredToolError = _optionalChain([options, 'optionalAccess', _205 => _205.toolId]) && !response.ok ? _chunkPPDBRJRWjs.deserializeToolExecutionFailure.call(void 0,
1449
1199
  _chunkXNYIZMNQjs.apiErrorMessage.call(void 0, parsed, response.status),
1450
1200
  isRecord(parsed) ? parsed.tool_error : null,
1451
- _chunk7P5AA3SNjs.TOOL_EXECUTION_ERROR_SCHEMA_VERSION
1201
+ _chunkPPDBRJRWjs.TOOL_EXECUTION_ERROR_SCHEMA_VERSION
1452
1202
  ) : null;
1453
1203
  if (structuredToolError) {
1454
1204
  if (response.status === 429) {
1455
1205
  const retryAfter = parseRetryAfter(response);
1456
- const failure = _chunk7P5AA3SNjs.serializeToolExecutionFailure.call(void 0, structuredToolError);
1457
- lastError = failure === null ? structuredToolError : new (0, _chunkQ2E4E4FJjs.ToolRateLimitError)(structuredToolError.message, {
1206
+ const failure = _chunkPPDBRJRWjs.serializeToolExecutionFailure.call(void 0, structuredToolError);
1207
+ lastError = failure === null ? structuredToolError : new (0, _chunkNPBJI7REjs.ToolRateLimitError)(structuredToolError.message, {
1458
1208
  ...failure,
1459
1209
  retryAfterMs: _nullishCoalesce(failure.retryAfterMs, () => ( Math.max(0, retryAfter)))
1460
1210
  });
1461
- if (attempt < maxRetries) {
1211
+ if (responseRetryAllowed && attempt < maxRetries) {
1462
1212
  retryAfterDelayMs = retryAfter;
1463
1213
  break;
1464
1214
  }
@@ -1467,8 +1217,8 @@ var HttpClient = class {
1467
1217
  throw structuredToolError;
1468
1218
  }
1469
1219
  if (response.status === 429) {
1470
- if (_optionalChain([options, 'optionalAccess', _198 => _198.preserveRateLimitResponse]) && isMonitorRateLimitEnvelope(parsed)) {
1471
- throw new (0, _chunk7P5AA3SNjs.DeeplineError)(
1220
+ if (_optionalChain([options, 'optionalAccess', _206 => _206.preserveRateLimitResponse]) && isMonitorRateLimitEnvelope(parsed)) {
1221
+ throw new (0, _chunkPPDBRJRWjs.DeeplineError)(
1472
1222
  _chunkXNYIZMNQjs.apiErrorMessage.call(void 0, parsed, response.status),
1473
1223
  response.status,
1474
1224
  _chunkXNYIZMNQjs.apiErrorCodeFromResponse.call(void 0, parsed),
@@ -1476,24 +1226,24 @@ var HttpClient = class {
1476
1226
  );
1477
1227
  }
1478
1228
  const retryAfter = parseRetryAfter(response);
1479
- lastError = new (0, _chunkQ2E4E4FJjs.RateLimitError)(retryAfter);
1480
- if (attempt < maxRetries) {
1229
+ lastError = new (0, _chunkNPBJI7REjs.RateLimitError)(retryAfter);
1230
+ if (responseRetryAllowed && attempt < maxRetries) {
1481
1231
  retryAfterDelayMs = retryAfter;
1482
1232
  break;
1483
1233
  }
1484
1234
  throw lastError;
1485
1235
  }
1486
1236
  if (response.status === 401 && !isProviderOriginatedHttpError(parsed)) {
1487
- throw new (0, _chunkQ2E4E4FJjs.AuthError)(_chunkXNYIZMNQjs.apiErrorMessage.call(void 0, parsed, response.status));
1237
+ throw new (0, _chunkNPBJI7REjs.AuthError)(_chunkXNYIZMNQjs.apiErrorMessage.call(void 0, parsed, response.status));
1488
1238
  }
1489
1239
  if (!response.ok) {
1490
- const retryableApiError = _optionalChain([options, 'optionalAccess', _199 => _199.retryApiErrors]) === true && isRetryableApiErrorResponse(response.status);
1240
+ const retryableApiError = _optionalChain([options, 'optionalAccess', _207 => _207.retryApiErrors]) === true && responseRetryAllowed && isRetryableApiErrorResponse(response.status);
1491
1241
  const htmlError = detectHtmlErrorBody(
1492
1242
  body,
1493
1243
  response.headers.get("content-type")
1494
1244
  );
1495
1245
  if (htmlError) {
1496
- lastError = new (0, _chunk7P5AA3SNjs.DeeplineError)(
1246
+ lastError = new (0, _chunkPPDBRJRWjs.DeeplineError)(
1497
1247
  htmlError.message(response.status),
1498
1248
  response.status,
1499
1249
  "API_ERROR",
@@ -1512,7 +1262,7 @@ var HttpClient = class {
1512
1262
  const errorValue = typeof parsed === "object" && parsed && "error" in parsed ? parsed.error : void 0;
1513
1263
  const msg = typeof errorValue === "string" ? errorValue : errorValue && typeof errorValue === "object" && "message" in errorValue && typeof errorValue.message === "string" ? errorValue.message : typeof parsed === "object" && parsed && "message" in parsed && typeof parsed.message === "string" ? parsed.message : `HTTP ${response.status}`;
1514
1264
  const apiErrorCode = _chunkXNYIZMNQjs.apiErrorCodeFromResponse.call(void 0, parsed);
1515
- lastError = new (0, _chunk7P5AA3SNjs.DeeplineError)(msg, response.status, apiErrorCode, {
1265
+ lastError = new (0, _chunkPPDBRJRWjs.DeeplineError)(msg, response.status, apiErrorCode, {
1516
1266
  response: parsed
1517
1267
  });
1518
1268
  if (retryableApiError && attempt < maxRetries) {
@@ -1527,7 +1277,7 @@ var HttpClient = class {
1527
1277
  response.headers.get("content-type")
1528
1278
  );
1529
1279
  if (interstitial) {
1530
- throw new (0, _chunk7P5AA3SNjs.DeeplineError)(
1280
+ throw new (0, _chunkPPDBRJRWjs.DeeplineError)(
1531
1281
  `${this.config.baseUrl} returned a deployment-protection page instead of JSON. Set VERCEL_PROTECTION_BYPASS_TOKEN, or run \`vercel login\` if the CLI session expired.`,
1532
1282
  response.status,
1533
1283
  "DEPLOYMENT_PROTECTED",
@@ -1539,14 +1289,14 @@ var HttpClient = class {
1539
1289
  } catch (error) {
1540
1290
  clearTimeout(timeoutId);
1541
1291
  networkFailedAt = Date.now();
1542
- if (_optionalChain([options, 'optionalAccess', _200 => _200.signal, 'optionalAccess', _201 => _201.aborted])) {
1292
+ if (_optionalChain([options, 'optionalAccess', _208 => _208.signal, 'optionalAccess', _209 => _209.aborted])) {
1543
1293
  lastError = requestCancelledError(options.signal);
1544
1294
  break requestAttempts;
1545
1295
  }
1546
- if (error instanceof _chunkQ2E4E4FJjs.AuthError || error instanceof _chunk7P5AA3SNjs.DeeplineError) {
1296
+ if (error instanceof _chunkNPBJI7REjs.AuthError || error instanceof _chunkPPDBRJRWjs.DeeplineError) {
1547
1297
  throw error;
1548
1298
  }
1549
- if (error instanceof _chunkQ2E4E4FJjs.RateLimitError) {
1299
+ if (error instanceof _chunkNPBJI7REjs.RateLimitError) {
1550
1300
  lastError = error;
1551
1301
  break;
1552
1302
  }
@@ -1554,14 +1304,15 @@ var HttpClient = class {
1554
1304
  timeoutMs,
1555
1305
  timedOut: requestTimedOut
1556
1306
  });
1307
+ if (_optionalChain([options, 'optionalAccess', _210 => _210.retryFromExecutePolicy])) break requestAttempts;
1557
1308
  } finally {
1558
1309
  clearTimeout(timeoutId);
1559
- _optionalChain([options, 'optionalAccess', _202 => _202.signal, 'optionalAccess', _203 => _203.removeEventListener, 'call', _204 => _204("abort", abortRequest)]);
1310
+ _optionalChain([options, 'optionalAccess', _211 => _211.signal, 'optionalAccess', _212 => _212.removeEventListener, 'call', _213 => _213("abort", abortRequest)]);
1560
1311
  }
1561
1312
  }
1562
1313
  if (attempt < maxRetries) continue;
1563
1314
  }
1564
- if (lastError instanceof _chunk7P5AA3SNjs.DeeplineError) {
1315
+ if (lastError instanceof _chunkPPDBRJRWjs.DeeplineError) {
1565
1316
  throw lastError;
1566
1317
  }
1567
1318
  const mappedNetworkError = mapNetworkError(
@@ -1583,10 +1334,10 @@ var HttpClient = class {
1583
1334
  phase: networkPhase
1584
1335
  }
1585
1336
  };
1586
- if (_optionalChain([options, 'optionalAccess', _205 => _205.toolId])) {
1337
+ if (_optionalChain([options, 'optionalAccess', _214 => _214.toolId])) {
1587
1338
  const code = mappedNetworkError.code;
1588
1339
  throw withErrorCause(
1589
- new (0, _chunk7P5AA3SNjs.ToolExecutionError)(
1340
+ new (0, _chunkPPDBRJRWjs.ToolExecutionError)(
1590
1341
  withCoworkNetworkHint(mappedNetworkError.message),
1591
1342
  {
1592
1343
  toolId: options.toolId,
@@ -1611,7 +1362,7 @@ var HttpClient = class {
1611
1362
  );
1612
1363
  }
1613
1364
  throw withErrorCause(
1614
- new (0, _chunk7P5AA3SNjs.DeeplineError)(
1365
+ new (0, _chunkPPDBRJRWjs.DeeplineError)(
1615
1366
  withCoworkNetworkHint(mappedNetworkError.message),
1616
1367
  void 0,
1617
1368
  mappedNetworkError.code,
@@ -1635,36 +1386,36 @@ var HttpClient = class {
1635
1386
  }
1636
1387
  async *streamSse(path, options) {
1637
1388
  const url = `${this.config.baseUrl}${path}`;
1638
- const method = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _206 => _206.method]), () => ( "GET"));
1389
+ const method = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _215 => _215.method]), () => ( "GET"));
1639
1390
  const headers = this.authHeaders({
1640
1391
  Accept: "text/event-stream",
1641
- ..._optionalChain([options, 'optionalAccess', _207 => _207.headers])
1392
+ ..._optionalChain([options, 'optionalAccess', _216 => _216.headers])
1642
1393
  });
1643
- if (_optionalChain([options, 'optionalAccess', _208 => _208.body]) !== void 0) {
1394
+ if (_optionalChain([options, 'optionalAccess', _217 => _217.body]) !== void 0) {
1644
1395
  applyExplicitHeaders(headers, { "Content-Type": "application/json" });
1645
1396
  }
1646
1397
  let lastError = null;
1647
- const candidateUrls = _optionalChain([options, 'optionalAccess', _209 => _209.exactUrlOnly]) ? [url] : buildCandidateUrls(url);
1398
+ const candidateUrls = _optionalChain([options, 'optionalAccess', _218 => _218.exactUrlOnly]) ? [url] : buildCandidateUrls(url);
1648
1399
  for (const candidateUrl of candidateUrls) {
1649
1400
  try {
1650
1401
  const response = await fetch(candidateUrl, {
1651
1402
  method,
1652
1403
  headers,
1653
- body: _optionalChain([options, 'optionalAccess', _210 => _210.body]) !== void 0 ? JSON.stringify(options.body) : void 0,
1654
- signal: _optionalChain([options, 'optionalAccess', _211 => _211.signal])
1404
+ body: _optionalChain([options, 'optionalAccess', _219 => _219.body]) !== void 0 ? JSON.stringify(options.body) : void 0,
1405
+ signal: _optionalChain([options, 'optionalAccess', _220 => _220.signal])
1655
1406
  });
1656
1407
  if (!response.ok) {
1657
1408
  const body = await response.text();
1658
1409
  const parsed = parseResponseBody(body);
1659
1410
  if (response.status === 401 && !isProviderOriginatedHttpError(parsed)) {
1660
- throw new (0, _chunkQ2E4E4FJjs.AuthError)(_chunkXNYIZMNQjs.apiErrorMessage.call(void 0, parsed, response.status));
1411
+ throw new (0, _chunkNPBJI7REjs.AuthError)(_chunkXNYIZMNQjs.apiErrorMessage.call(void 0, parsed, response.status));
1661
1412
  }
1662
1413
  const htmlError = detectHtmlErrorBody(
1663
1414
  body,
1664
1415
  response.headers.get("content-type")
1665
1416
  );
1666
1417
  if (htmlError) {
1667
- throw new (0, _chunk7P5AA3SNjs.DeeplineError)(
1418
+ throw new (0, _chunkPPDBRJRWjs.DeeplineError)(
1668
1419
  htmlError.message(response.status),
1669
1420
  response.status,
1670
1421
  "API_ERROR",
@@ -1675,7 +1426,7 @@ var HttpClient = class {
1675
1426
  }
1676
1427
  );
1677
1428
  }
1678
- throw new (0, _chunk7P5AA3SNjs.DeeplineError)(
1429
+ throw new (0, _chunkPPDBRJRWjs.DeeplineError)(
1679
1430
  _chunkXNYIZMNQjs.apiErrorMessage.call(void 0, parsed, response.status),
1680
1431
  response.status,
1681
1432
  _chunkXNYIZMNQjs.apiErrorCodeFromResponse.call(void 0, parsed),
@@ -1683,17 +1434,17 @@ var HttpClient = class {
1683
1434
  );
1684
1435
  }
1685
1436
  if (!response.body) {
1686
- throw new (0, _chunk7P5AA3SNjs.DeeplineError)("SSE response did not include a body.");
1437
+ throw new (0, _chunkPPDBRJRWjs.DeeplineError)("SSE response did not include a body.");
1687
1438
  }
1688
1439
  yield* decodeSseStream(response.body);
1689
1440
  return;
1690
1441
  } catch (error) {
1691
- if (error instanceof _chunkQ2E4E4FJjs.AuthError || error instanceof _chunk7P5AA3SNjs.DeeplineError) {
1442
+ if (error instanceof _chunkNPBJI7REjs.AuthError || error instanceof _chunkPPDBRJRWjs.DeeplineError) {
1692
1443
  throw error;
1693
1444
  }
1694
1445
  const normalized = error instanceof Error ? error : new Error(String(error));
1695
- if (isAbortLikeError(normalized) && _optionalChain([options, 'optionalAccess', _212 => _212.signal, 'optionalAccess', _213 => _213.aborted])) {
1696
- throw new (0, _chunk7P5AA3SNjs.DeeplineError)(
1446
+ if (isAbortLikeError(normalized) && _optionalChain([options, 'optionalAccess', _221 => _221.signal, 'optionalAccess', _222 => _222.aborted])) {
1447
+ throw new (0, _chunkPPDBRJRWjs.DeeplineError)(
1697
1448
  `Stream from ${this.config.baseUrl} was aborted by the caller.`,
1698
1449
  void 0,
1699
1450
  "ABORTED"
@@ -1703,7 +1454,7 @@ var HttpClient = class {
1703
1454
  }
1704
1455
  }
1705
1456
  if (lastError && isAbortLikeError(lastError)) {
1706
- throw new (0, _chunk7P5AA3SNjs.DeeplineError)(
1457
+ throw new (0, _chunkPPDBRJRWjs.DeeplineError)(
1707
1458
  withCoworkNetworkHint(
1708
1459
  `Unable to stream from ${this.config.baseUrl}. The remote stream was interrupted.`
1709
1460
  ),
@@ -1711,9 +1462,9 @@ var HttpClient = class {
1711
1462
  "PLAY_STREAM_NETWORK_ABORTED"
1712
1463
  );
1713
1464
  }
1714
- throw new (0, _chunk7P5AA3SNjs.DeeplineError)(
1465
+ throw new (0, _chunkPPDBRJRWjs.DeeplineError)(
1715
1466
  withCoworkNetworkHint(
1716
- _optionalChain([lastError, 'optionalAccess', _214 => _214.message]) ? `Unable to stream from ${this.config.baseUrl}. ${lastError.message}` : `Unable to stream from ${this.config.baseUrl}.`
1467
+ _optionalChain([lastError, 'optionalAccess', _223 => _223.message]) ? `Unable to stream from ${this.config.baseUrl}. ${lastError.message}` : `Unable to stream from ${this.config.baseUrl}.`
1717
1468
  )
1718
1469
  );
1719
1470
  }
@@ -1775,15 +1526,15 @@ function parseResponseBody(body) {
1775
1526
  }
1776
1527
  function isProviderOriginatedHttpError(parsed) {
1777
1528
  const response = asRecord(parsed);
1778
- const error = asRecord(_optionalChain([response, 'optionalAccess', _215 => _215.error]));
1779
- const failureOrigin = _nullishCoalesce(_optionalChain([error, 'optionalAccess', _216 => _216.failure_origin]), () => ( _optionalChain([response, 'optionalAccess', _217 => _217.failure_origin])));
1780
- const code = _nullishCoalesce(_optionalChain([error, 'optionalAccess', _218 => _218.code]), () => ( _optionalChain([response, 'optionalAccess', _219 => _219.code])));
1529
+ const error = asRecord(_optionalChain([response, 'optionalAccess', _224 => _224.error]));
1530
+ const failureOrigin = _nullishCoalesce(_optionalChain([error, 'optionalAccess', _225 => _225.failure_origin]), () => ( _optionalChain([response, 'optionalAccess', _226 => _226.failure_origin])));
1531
+ const code = _nullishCoalesce(_optionalChain([error, 'optionalAccess', _227 => _227.code]), () => ( _optionalChain([response, 'optionalAccess', _228 => _228.code])));
1781
1532
  return failureOrigin === "provider" || code === "UPSTREAM_BLOCKED";
1782
1533
  }
1783
1534
  function isMonitorRateLimitEnvelope(parsed) {
1784
1535
  const response = asRecord(parsed);
1785
- const error = asRecord(_optionalChain([response, 'optionalAccess', _220 => _220.error]));
1786
- return _optionalChain([error, 'optionalAccess', _221 => _221.code]) === "monitor_upstream_rate_limited" && typeof error.message === "string";
1536
+ const error = asRecord(_optionalChain([response, 'optionalAccess', _229 => _229.error]));
1537
+ return _optionalChain([error, 'optionalAccess', _230 => _230.code]) === "monitor_upstream_rate_limited" && typeof error.message === "string";
1787
1538
  }
1788
1539
  function asRecord(value) {
1789
1540
  return typeof value === "object" && value !== null ? value : null;
@@ -1799,7 +1550,7 @@ function detectHtmlErrorBody(body, contentType) {
1799
1550
  return null;
1800
1551
  }
1801
1552
  const titleMatch = trimmed.match(/<title[^>]*>([\s\S]*?)<\/title>/i);
1802
- const title = _optionalChain([titleMatch, 'optionalAccess', _222 => _222[1], 'optionalAccess', _223 => _223.replace, 'call', _224 => _224(/\s+/g, " "), 'access', _225 => _225.trim, 'call', _226 => _226()]) || void 0;
1553
+ const title = _optionalChain([titleMatch, 'optionalAccess', _231 => _231[1], 'optionalAccess', _232 => _232.replace, 'call', _233 => _233(/\s+/g, " "), 'access', _234 => _234.trim, 'call', _235 => _235()]) || void 0;
1803
1554
  const workerThrewException = /worker threw exception/i.test(trimmed);
1804
1555
  return {
1805
1556
  title,
@@ -1883,20 +1634,20 @@ function decodeSseFrame(frame) {
1883
1634
  }
1884
1635
  function sleep(ms, signal) {
1885
1636
  return new Promise((resolve2, reject) => {
1886
- if (_optionalChain([signal, 'optionalAccess', _227 => _227.aborted])) {
1637
+ if (_optionalChain([signal, 'optionalAccess', _236 => _236.aborted])) {
1887
1638
  reject(requestCancelledError(signal));
1888
1639
  return;
1889
1640
  }
1890
1641
  const timeoutId = setTimeout(() => {
1891
- _optionalChain([signal, 'optionalAccess', _228 => _228.removeEventListener, 'call', _229 => _229("abort", abort)]);
1642
+ _optionalChain([signal, 'optionalAccess', _237 => _237.removeEventListener, 'call', _238 => _238("abort", abort)]);
1892
1643
  resolve2();
1893
1644
  }, ms);
1894
1645
  const abort = () => {
1895
1646
  clearTimeout(timeoutId);
1896
- _optionalChain([signal, 'optionalAccess', _230 => _230.removeEventListener, 'call', _231 => _231("abort", abort)]);
1647
+ _optionalChain([signal, 'optionalAccess', _239 => _239.removeEventListener, 'call', _240 => _240("abort", abort)]);
1897
1648
  reject(requestCancelledError(signal));
1898
1649
  };
1899
- _optionalChain([signal, 'optionalAccess', _232 => _232.addEventListener, 'call', _233 => _233("abort", abort, { once: true })]);
1650
+ _optionalChain([signal, 'optionalAccess', _241 => _241.addEventListener, 'call', _242 => _242("abort", abort, { once: true })]);
1900
1651
  });
1901
1652
  }
1902
1653
  function withCoworkNetworkHint(message) {
@@ -1953,4 +1704,5 @@ ${COWORK_NETWORK_HINT}`;
1953
1704
 
1954
1705
 
1955
1706
 
1956
- exports.HOST_URL_ENV = HOST_URL_ENV; exports.API_KEY_ENV = API_KEY_ENV; exports.ACTIVE_ORG_ID_ENV = ACTIVE_ORG_ID_ENV; exports.ACTIVE_ORG_NAME_ENV = ACTIVE_ORG_NAME_ENV; exports.FEATURES_ENV = FEATURES_ENV; exports.PROD_URL = PROD_URL; exports.featureEnvValues = featureEnvValues; exports.storedHostApiKey = storedHostApiKey; exports.storedHostFeatures = storedHostFeatures; exports.baseUrlSlug = baseUrlSlug; exports.sdkCliStateDirPath = sdkCliStateDirPath; exports.hostConfigDirPath = hostConfigDirPath; exports.hostEnvFilePath = hostEnvFilePath; exports.saveHostEnvValues = saveHostEnvValues; exports.autoDetectBaseUrl = autoDetectBaseUrl; exports.resolveApiKeyForBaseUrl = resolveApiKeyForBaseUrl; exports.resolveProjectApiKeyForBaseUrl = resolveProjectApiKeyForBaseUrl; exports.resolveGlobalApiKeyForBaseUrl = resolveGlobalApiKeyForBaseUrl; exports.getResolvedProjectAuthSource = getResolvedProjectAuthSource; exports.resolveBaseUrlOnly = resolveBaseUrlOnly; exports.resolveConfig = resolveConfig; exports.ensureProjectPrivatePathsIgnored = ensureProjectPrivatePathsIgnored; exports.saveProjectDeeplineEnvValues = saveProjectDeeplineEnvValues; exports.resolveProjectPinTarget = resolveProjectPinTarget; exports.getActiveProjectAuthSource = getActiveProjectAuthSource; exports.resolveCliAuthProvenance = resolveCliAuthProvenance; exports.resolveCliCommandContext = resolveCliCommandContext; exports.SDK_VERSION = SDK_VERSION; exports.SDK_API_MAJOR = SDK_API_MAJOR; exports.SDK_API_CONTRACT = SDK_API_CONTRACT; exports.agentSessionIdFromEnvironment = agentSessionIdFromEnvironment; exports.detectAgentRuntime = detectAgentRuntime; exports.hasActivePluginSkills = hasActivePluginSkills; exports.KNOWN_SKILL_AGENTS = KNOWN_SKILL_AGENTS; exports.DEFAULT_SKILL_AGENTS = DEFAULT_SKILL_AGENTS; exports.skillsAgentPathSegment = skillsAgentPathSegment; exports.resolveAutoSyncSkillAgents = resolveAutoSyncSkillAgents; exports.readSdkSkillsLocalVersion = readSdkSkillsLocalVersion; exports.writeSdkSkillsLocalVersion = writeSdkSkillsLocalVersion; exports.deploymentProtectionHeaders = deploymentProtectionHeaders; exports.fetchWithDeploymentProtection = fetchWithDeploymentProtection; 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.HttpClient = HttpClient;
1707
+
1708
+ exports.HOST_URL_ENV = HOST_URL_ENV; exports.API_KEY_ENV = API_KEY_ENV; exports.ACTIVE_ORG_ID_ENV = ACTIVE_ORG_ID_ENV; exports.ACTIVE_ORG_NAME_ENV = ACTIVE_ORG_NAME_ENV; exports.FEATURES_ENV = FEATURES_ENV; exports.PROD_URL = PROD_URL; exports.featureEnvValues = featureEnvValues; exports.storedHostApiKey = storedHostApiKey; exports.storedHostFeatures = storedHostFeatures; exports.baseUrlSlug = baseUrlSlug; exports.sdkCliStateDirPath = sdkCliStateDirPath; exports.hostConfigDirPath = hostConfigDirPath; exports.hostEnvFilePath = hostEnvFilePath; exports.saveHostEnvValues = saveHostEnvValues; exports.autoDetectBaseUrl = autoDetectBaseUrl; exports.resolveApiKeyForBaseUrl = resolveApiKeyForBaseUrl; exports.resolveProjectApiKeyForBaseUrl = resolveProjectApiKeyForBaseUrl; exports.resolveGlobalApiKeyForBaseUrl = resolveGlobalApiKeyForBaseUrl; exports.getResolvedProjectAuthSource = getResolvedProjectAuthSource; exports.resolveBaseUrlOnly = resolveBaseUrlOnly; exports.resolveConfig = resolveConfig; exports.ensureProjectPrivatePathsIgnored = ensureProjectPrivatePathsIgnored; exports.saveProjectDeeplineEnvValues = saveProjectDeeplineEnvValues; exports.resolveProjectPinTarget = resolveProjectPinTarget; exports.getActiveProjectAuthSource = getActiveProjectAuthSource; exports.resolveCliAuthProvenance = resolveCliAuthProvenance; exports.resolveCliCommandContext = resolveCliCommandContext; 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.agentSessionIdFromEnvironment = agentSessionIdFromEnvironment; exports.detectAgentRuntime = detectAgentRuntime; exports.hasActivePluginSkills = hasActivePluginSkills; exports.KNOWN_SKILL_AGENTS = KNOWN_SKILL_AGENTS; exports.DEFAULT_SKILL_AGENTS = DEFAULT_SKILL_AGENTS; exports.skillsAgentPathSegment = skillsAgentPathSegment; exports.resolveAutoSyncSkillAgents = resolveAutoSyncSkillAgents; exports.readSdkSkillsLocalVersion = readSdkSkillsLocalVersion; exports.writeSdkSkillsLocalVersion = writeSdkSkillsLocalVersion; exports.deploymentProtectionHeaders = deploymentProtectionHeaders; exports.fetchWithDeploymentProtection = fetchWithDeploymentProtection; 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.HttpClient = HttpClient;