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
@@ -8,7 +8,7 @@ import {
8
8
  } from "./chunk-DLIRSHV6.mjs";
9
9
  import {
10
10
  DeeplineError
11
- } from "./chunk-NXGCO4JB.mjs";
11
+ } from "./chunk-E4IXDAZI.mjs";
12
12
 
13
13
  // ../play-runtime/run-lifecycle-policy.ts
14
14
  var TERMINAL_PLAY_RUN_STATUSES = /* @__PURE__ */ new Set([
@@ -73,9 +73,21 @@ function decodePlayRunPublicStatus(value) {
73
73
 
74
74
  // src/plays/run-request.ts
75
75
  var PLAY_RUN_START_PATH = "/api/v2/plays/run";
76
+ var CLI_PLAY_RUN_START_PATH = `${PLAY_RUN_START_PATH}/cli`;
77
+ var CLI_PLAY_RUN_SUPPORTED_HEADER = "x-deepline-cli-play-admission";
76
78
  var PLAY_RUN_START_STREAM_PATH = `${PLAY_RUN_START_PATH}?stream=true`;
79
+ var CLI_PLAY_RUN_START_STREAM_PATH = `${CLI_PLAY_RUN_START_PATH}?stream=true`;
77
80
  var PLAY_FILES_STAGE_PATH = "/api/v2/plays/files/stage";
78
81
  var PLAY_FILES_STAGE_MINT_PATH = `${PLAY_FILES_STAGE_PATH}/mint`;
82
+ var CliPlayAdmissionUnsupportedError = class extends DeeplineError {
83
+ constructor(status) {
84
+ super(
85
+ "This server does not support CLI Play admission.",
86
+ status,
87
+ "CLI_PLAY_ADMISSION_UNSUPPORTED"
88
+ );
89
+ }
90
+ };
79
91
  function buildPlayRunStartBody(request) {
80
92
  return {
81
93
  ...request.admissionOrgId ? { admissionOrgId: request.admissionOrgId } : {},
@@ -103,6 +115,7 @@ function buildPlayRunStartBody(request) {
103
115
  ...typeof request.maxConcurrentRows === "number" ? { maxConcurrentRows: request.maxConcurrentRows } : {},
104
116
  ...typeof request.maxCredits === "number" ? { maxCredits: request.maxCredits } : {},
105
117
  ...typeof request.waitForCompletionMs === "number" ? { waitForCompletionMs: request.waitForCompletionMs } : {},
118
+ ...request.terminalStatus === "full" ? { terminalStatus: "full" } : {},
106
119
  // Profile selection is the API's job, not the caller's. The server
107
120
  // defaults to absurd; callers normally omit this field.
108
121
  ...request.profile ? { profile: request.profile } : {},
@@ -112,11 +125,11 @@ function buildPlayRunStartBody(request) {
112
125
  ...request.testPolicyOverrides ? { testPolicyOverrides: request.testPolicyOverrides } : {}
113
126
  };
114
127
  }
115
- async function preparePlayRunAdmission(http, request, onSubmission) {
128
+ async function preparePlayRunAdmission(http, request, onSubmission, options) {
116
129
  let capability = null;
117
130
  if (http.get) {
118
131
  try {
119
- capability = await http.get(PLAY_RUN_START_PATH);
132
+ capability = await http.get(PLAY_RUN_START_PATH, options);
120
133
  } catch (error) {
121
134
  if (!(error instanceof DeeplineError) || ![404, 405].includes(error.statusCode ?? 0))
122
135
  throw error;
@@ -132,6 +145,7 @@ async function preparePlayRunAdmission(http, request, onSubmission) {
132
145
  }
133
146
  }
134
147
  const supportsCallerIntent = capability?.admissionContract === "caller-intent-v1";
148
+ options?.signal?.throwIfAborted();
135
149
  if (supportsCallerIntent && (!capability?.orgId || request.admissionOrgId && request.admissionOrgId !== capability.orgId)) {
136
150
  throw new DeeplineError(
137
151
  "The admission workspace could not be pinned to this request; execution was not submitted.",
@@ -146,6 +160,20 @@ async function preparePlayRunAdmission(http, request, onSubmission) {
146
160
  "PLAY_RUN_ADMISSION_RECOVERY_UNSUPPORTED"
147
161
  );
148
162
  }
163
+ if (request.maxTotalCredits !== void 0 && capability?.strictTotalBudget === "unbounded-v1") {
164
+ if (request.maxTotalCredits === 0) {
165
+ throw new DeeplineError(
166
+ "A zero-credit total budget cannot admit a Play: sandbox compute is billed even when provider tools are free.",
167
+ 422,
168
+ "PLAY_TOTAL_BUDGET_COMPUTE_REQUIRED"
169
+ );
170
+ }
171
+ throw new DeeplineError(
172
+ "A strict total Play budget cannot currently be admitted: provider operations, Customer DB compute, and additional sandbox sessions do not have a finite admitted upper bound.",
173
+ 422,
174
+ "PLAY_TOTAL_BUDGET_UNBOUNDED"
175
+ );
176
+ }
149
177
  if (request.maxTotalCredits !== void 0 && capability?.strictTotalBudget !== "fail-closed-v1") {
150
178
  throw new DeeplineError(
151
179
  "This server cannot honor a strict total Play budget. Execution was not submitted.",
@@ -186,21 +214,39 @@ async function preparePlayRunAdmission(http, request, onSubmission) {
186
214
  }
187
215
  return { body: submittedBody, workflowId, supportsCallerIntent };
188
216
  }
189
- async function startPlayRun(http, request, headers, onSubmission) {
217
+ async function startPlayRun(http, request, headers, options) {
190
218
  const {
191
219
  body: submittedBody,
192
220
  workflowId,
193
221
  supportsCallerIntent
194
- } = await preparePlayRunAdmission(http, request, onSubmission);
222
+ } = await preparePlayRunAdmission(
223
+ http,
224
+ request,
225
+ options?.onSubmission,
226
+ options
227
+ );
228
+ let cliAdmissionSupported = false;
195
229
  let response;
196
230
  try {
197
231
  response = await http.post(
198
- PLAY_RUN_START_PATH,
232
+ options?.cliAdmission ? CLI_PLAY_RUN_START_PATH : PLAY_RUN_START_PATH,
199
233
  submittedBody,
200
234
  headers,
201
- { maxRetries: 0, exactUrlOnly: true }
235
+ {
236
+ maxRetries: 0,
237
+ exactUrlOnly: true,
238
+ ...options?.signal ? { signal: options.signal } : {},
239
+ ...options?.cliAdmission ? {
240
+ onResponse: (response2) => {
241
+ cliAdmissionSupported = response2.headers.get(CLI_PLAY_RUN_SUPPORTED_HEADER) === "true";
242
+ }
243
+ } : {}
244
+ }
202
245
  );
203
246
  } catch (error) {
247
+ if (options?.cliAdmission && !cliAdmissionSupported && error instanceof DeeplineError && (error.statusCode === 404 || error.statusCode === 405)) {
248
+ throw new CliPlayAdmissionUnsupportedError(error.statusCode);
249
+ }
204
250
  if (error instanceof DeeplineError && ["NETWORK_TIMEOUT", "NETWORK_ERROR", "FETCH_FAILED"].includes(
205
251
  error.code ?? ""
206
252
  ) || error instanceof TypeError || error instanceof Error && ["AbortError", "TimeoutError"].includes(error.name)) {
@@ -223,7 +269,15 @@ async function startPlayRun(http, request, headers, onSubmission) {
223
269
  }
224
270
  throw error;
225
271
  }
226
- return normalizePlayRunStart(response);
272
+ const started = normalizePlayRunStart(response);
273
+ if (options?.cliAdmission && (!started.workflowId || started.workflowId === "pending")) {
274
+ throw new DeeplineError(
275
+ "Play admission returned no run id. Check recent runs before submitting again.",
276
+ void 0,
277
+ "PLAY_START_MISSING_RUN_ID"
278
+ );
279
+ }
280
+ return started;
227
281
  }
228
282
  function isPlayRunPackage(value) {
229
283
  return Boolean(
@@ -245,7 +299,7 @@ function normalizePlayRunStart(raw) {
245
299
  name: runPackage.run.playName,
246
300
  status,
247
301
  ...runPackage.run.dashboardUrl ? { dashboardUrl: runPackage.run.dashboardUrl } : {},
248
- ...isTerminalPlayRunLifecycleStatus(status) ? { finalStatus: runPackage } : {},
302
+ ...isTerminalPlayRunLifecycleStatus(status) ? raw.finalStatusView === "full" && raw.runId === runPackage.run.id ? { finalStatus: raw, finalStatusView: "full" } : { finalStatus: runPackage } : {},
249
303
  package: runPackage
250
304
  };
251
305
  }
@@ -631,11 +685,12 @@ function createSessionPlayRunHttp(fetchImpl = (...args) => fetch(...args)) {
631
685
  return parsed;
632
686
  };
633
687
  return {
634
- get: (path) => send(path, { method: "GET" }),
635
- post: (path, body, headers) => send(path, {
688
+ get: (path, options) => send(path, { method: "GET", ...options }),
689
+ post: (path, body, headers, options) => send(path, {
636
690
  method: "POST",
637
691
  headers: { "content-type": "application/json", ...headers },
638
- body: JSON.stringify(body)
692
+ body: JSON.stringify(body),
693
+ ...options?.signal ? { signal: options.signal } : {}
639
694
  }),
640
695
  postFormData: (path, formData) => send(path, {
641
696
  method: "POST",
@@ -648,9 +703,13 @@ export {
648
703
  isTerminalPlayRunLifecycleStatus,
649
704
  decodePlayRunPublicStatus,
650
705
  PLAY_RUN_START_PATH,
706
+ CLI_PLAY_RUN_START_PATH,
707
+ CLI_PLAY_RUN_SUPPORTED_HEADER,
651
708
  PLAY_RUN_START_STREAM_PATH,
709
+ CLI_PLAY_RUN_START_STREAM_PATH,
652
710
  PLAY_FILES_STAGE_PATH,
653
711
  PLAY_FILES_STAGE_MINT_PATH,
712
+ CliPlayAdmissionUnsupportedError,
654
713
  buildPlayRunStartBody,
655
714
  preparePlayRunAdmission,
656
715
  startPlayRun,
@@ -28,9 +28,26 @@ var PLAY_BACKEND_DESCRIPTORS = {
28
28
  };
29
29
 
30
30
  // ../plays/tool-response-contract.ts
31
+ var V2_TOOL_RESPONSE_CONTRACT = "v2-tool-response";
31
32
  var RAW_V2_TOOL_RESPONSE_CONTRACT = "raw-v2";
32
33
  var RAW_V2_TOOL_RESPONSE_RECEIPT_REVISION = "raw-v2-receipt-v1";
33
34
  var TOOL_RESPONSE_RECEIPT_REVISION_PATTERN = /^[A-Za-z0-9](?:[A-Za-z0-9._-]{0,63})$/;
35
+ function isToolResponseContract(value) {
36
+ return value === V2_TOOL_RESPONSE_CONTRACT || value === RAW_V2_TOOL_RESPONSE_CONTRACT;
37
+ }
38
+ function declaredToolResponseContract(value) {
39
+ if (value == null) return void 0;
40
+ if (isToolResponseContract(value)) return value;
41
+ throw new UnsupportedToolResponseContractError(value);
42
+ }
43
+ var UnsupportedToolResponseContractError = class extends Error {
44
+ constructor(value) {
45
+ super(
46
+ `Unsupported tool response contract ${String(value)}. Supported contracts: ${V2_TOOL_RESPONSE_CONTRACT}, ${RAW_V2_TOOL_RESPONSE_CONTRACT}.`
47
+ );
48
+ this.name = "UnsupportedToolResponseContractError";
49
+ }
50
+ };
34
51
  var InvalidToolResponseReceiptRevisionError = class extends Error {
35
52
  constructor(value) {
36
53
  super(
@@ -46,6 +63,9 @@ function normalizeToolResponseReceiptRevision(value) {
46
63
  }
47
64
  throw new InvalidToolResponseReceiptRevisionError(value);
48
65
  }
66
+ function normalizeToolResponseContract(value) {
67
+ return declaredToolResponseContract(value) ?? V2_TOOL_RESPONSE_CONTRACT;
68
+ }
49
69
  function legacyRawFromToolResponseRawV2(rawV2, view, responseMeta) {
50
70
  const legacyRaw = view === "data" && rawV2 && typeof rawV2 === "object" && !Array.isArray(rawV2) ? rawV2.data : rawV2;
51
71
  const deeplineBilling = responseMeta?.deepline_billing;
@@ -68,7 +88,10 @@ function providerMetaFromToolResponseRawV2(rawV2, view) {
68
88
  export {
69
89
  RAW_V2_TOOL_RESPONSE_CONTRACT,
70
90
  RAW_V2_TOOL_RESPONSE_RECEIPT_REVISION,
91
+ UnsupportedToolResponseContractError,
92
+ InvalidToolResponseReceiptRevisionError,
71
93
  normalizeToolResponseReceiptRevision,
94
+ normalizeToolResponseContract,
72
95
  legacyRawFromToolResponseRawV2,
73
96
  providerMetaFromToolResponseRawV2,
74
97
  PLAY_ARTIFACT_KINDS,
@@ -2,7 +2,7 @@
2
2
 
3
3
 
4
4
 
5
- var _chunkYD7B53RWjs = require('./chunk-YD7B53RW.js');
5
+ var _chunkZHWBU36Hjs = require('./chunk-ZHWBU36H.js');
6
6
 
7
7
 
8
8
 
@@ -25,7 +25,7 @@ var _chunkYD7B53RWjs = require('./chunk-YD7B53RW.js');
25
25
 
26
26
 
27
27
 
28
- var _chunkFJCIUF34js = require('./chunk-FJCIUF34.js');
28
+ var _chunkOZSC6CEWjs = require('./chunk-OZSC6CEW.js');
29
29
 
30
30
  // src/cli/commands/auth.ts
31
31
 
@@ -52,7 +52,7 @@ function statusBannerLine(value) {
52
52
  return `Service notice: ${banner.message}`;
53
53
  }
54
54
  function envFilePath(baseUrl) {
55
- return _chunkFJCIUF34js.hostEnvFilePath.call(void 0, baseUrl);
55
+ return _chunkOZSC6CEWjs.hostEnvFilePath.call(void 0, baseUrl);
56
56
  }
57
57
  function normalizeAuthScope(value) {
58
58
  if (!value || value === "global") return "global";
@@ -65,7 +65,7 @@ function parseAuthScope(args) {
65
65
  }
66
66
  function pendingClaimPath(baseUrl, scope) {
67
67
  if (scope === "folder") {
68
- const target = _chunkFJCIUF34js.resolveProjectPinTarget.call(void 0, );
68
+ const target = _chunkOZSC6CEWjs.resolveProjectPinTarget.call(void 0, );
69
69
  if (!target.ok) {
70
70
  throw new Error(
71
71
  `Cowork project folder is ambiguous. Candidate folders: ${target.candidates.join(
@@ -75,10 +75,10 @@ function pendingClaimPath(baseUrl, scope) {
75
75
  }
76
76
  return _path.join.call(void 0, target.dir, ".deepline", "setup", "pending-auth.json");
77
77
  }
78
- return `${_chunkFJCIUF34js.hostConfigDirPath.call(void 0, baseUrl)}/pending-auth.json`;
78
+ return `${_chunkOZSC6CEWjs.hostConfigDirPath.call(void 0, baseUrl)}/pending-auth.json`;
79
79
  }
80
80
  function legacyPendingClaimTokenPath(baseUrl) {
81
- return `${_chunkFJCIUF34js.hostConfigDirPath.call(void 0, baseUrl)}/pending-claim-token`;
81
+ return `${_chunkOZSC6CEWjs.hostConfigDirPath.call(void 0, baseUrl)}/pending-claim-token`;
82
82
  }
83
83
  function savePendingClaim(baseUrl, claim) {
84
84
  const filePath = pendingClaimPath(baseUrl, claim.scope);
@@ -180,21 +180,21 @@ function parseRegisterWaitMode(args) {
180
180
  function shouldWaitForRegisterClaim(mode) {
181
181
  if (mode === "yes") return true;
182
182
  if (mode === "no") return false;
183
- return _chunkFJCIUF34js.detectAgentRuntime.call(void 0, ) !== "claude_cowork";
183
+ return _chunkOZSC6CEWjs.detectAgentRuntime.call(void 0, ) !== "claude_cowork";
184
184
  }
185
185
  function saveEnvValues(values, baseUrl, scope) {
186
186
  const filtered = {
187
- ...values[_chunkFJCIUF34js.HOST_URL_ENV] ? { [_chunkFJCIUF34js.HOST_URL_ENV]: values[_chunkFJCIUF34js.HOST_URL_ENV] } : {},
188
- ...values[_chunkFJCIUF34js.API_KEY_ENV] ? { [_chunkFJCIUF34js.API_KEY_ENV]: values[_chunkFJCIUF34js.API_KEY_ENV] } : {},
189
- ...values[_chunkFJCIUF34js.ACTIVE_ORG_ID_ENV] ? { [_chunkFJCIUF34js.ACTIVE_ORG_ID_ENV]: values[_chunkFJCIUF34js.ACTIVE_ORG_ID_ENV] } : {},
190
- ...Object.prototype.hasOwnProperty.call(values, _chunkFJCIUF34js.ACTIVE_ORG_NAME_ENV) ? { [_chunkFJCIUF34js.ACTIVE_ORG_NAME_ENV]: values[_chunkFJCIUF34js.ACTIVE_ORG_NAME_ENV] } : {},
187
+ ...values[_chunkOZSC6CEWjs.HOST_URL_ENV] ? { [_chunkOZSC6CEWjs.HOST_URL_ENV]: values[_chunkOZSC6CEWjs.HOST_URL_ENV] } : {},
188
+ ...values[_chunkOZSC6CEWjs.API_KEY_ENV] ? { [_chunkOZSC6CEWjs.API_KEY_ENV]: values[_chunkOZSC6CEWjs.API_KEY_ENV] } : {},
189
+ ...values[_chunkOZSC6CEWjs.ACTIVE_ORG_ID_ENV] ? { [_chunkOZSC6CEWjs.ACTIVE_ORG_ID_ENV]: values[_chunkOZSC6CEWjs.ACTIVE_ORG_ID_ENV] } : {},
190
+ ...Object.prototype.hasOwnProperty.call(values, _chunkOZSC6CEWjs.ACTIVE_ORG_NAME_ENV) ? { [_chunkOZSC6CEWjs.ACTIVE_ORG_NAME_ENV]: values[_chunkOZSC6CEWjs.ACTIVE_ORG_NAME_ENV] } : {},
191
191
  // An explicit empty list must reach the store: it clears a stale line.
192
- ...Object.prototype.hasOwnProperty.call(values, _chunkFJCIUF34js.FEATURES_ENV) ? { [_chunkFJCIUF34js.FEATURES_ENV]: values[_chunkFJCIUF34js.FEATURES_ENV] } : {}
192
+ ...Object.prototype.hasOwnProperty.call(values, _chunkOZSC6CEWjs.FEATURES_ENV) ? { [_chunkOZSC6CEWjs.FEATURES_ENV]: values[_chunkOZSC6CEWjs.FEATURES_ENV] } : {}
193
193
  };
194
194
  if (scope === "folder") {
195
- _chunkFJCIUF34js.saveProjectDeeplineEnvValues.call(void 0, filtered);
195
+ _chunkOZSC6CEWjs.saveProjectDeeplineEnvValues.call(void 0, filtered);
196
196
  } else {
197
- _chunkFJCIUF34js.saveHostEnvValues.call(void 0, baseUrl, filtered);
197
+ _chunkOZSC6CEWjs.saveHostEnvValues.call(void 0, baseUrl, filtered);
198
198
  }
199
199
  }
200
200
  function activeOrgEnvValues(data) {
@@ -202,21 +202,21 @@ function activeOrgEnvValues(data) {
202
202
  if (!orgId) return {};
203
203
  const orgName = typeof data.org_name === "string" ? data.org_name.trim() : "";
204
204
  return {
205
- [_chunkFJCIUF34js.ACTIVE_ORG_ID_ENV]: orgId,
206
- [_chunkFJCIUF34js.ACTIVE_ORG_NAME_ENV]: orgName,
207
- ..._chunkFJCIUF34js.featureEnvValues.call(void 0, data)
205
+ [_chunkOZSC6CEWjs.ACTIVE_ORG_ID_ENV]: orgId,
206
+ [_chunkOZSC6CEWjs.ACTIVE_ORG_NAME_ENV]: orgName,
207
+ ..._chunkOZSC6CEWjs.featureEnvValues.call(void 0, data)
208
208
  };
209
209
  }
210
210
  async function httpJson(method, url, apiKey, body, timeoutMs = AUTH_HTTP_TIMEOUT_MS) {
211
211
  const headers = {
212
212
  "Content-Type": "application/json",
213
- "User-Agent": `deepline-ts-sdk/${_chunkFJCIUF34js.SDK_VERSION}`,
213
+ "User-Agent": `deepline-ts-sdk/${_chunkOZSC6CEWjs.SDK_VERSION}`,
214
214
  "X-Deepline-Client-Family": "sdk",
215
215
  "X-Deepline-CLI-Family": "sdk",
216
- "X-Deepline-Agent-Runtime": _chunkFJCIUF34js.detectAgentRuntime.call(void 0, ),
217
- "X-Deepline-CLI-Version": _chunkFJCIUF34js.SDK_VERSION,
218
- "X-Deepline-SDK-Version": _chunkFJCIUF34js.SDK_VERSION,
219
- "X-Deepline-API-Contract": _chunkFJCIUF34js.SDK_API_CONTRACT
216
+ "X-Deepline-Agent-Runtime": _chunkOZSC6CEWjs.detectAgentRuntime.call(void 0, ),
217
+ "X-Deepline-CLI-Version": _chunkOZSC6CEWjs.SDK_VERSION,
218
+ "X-Deepline-SDK-Version": _chunkOZSC6CEWjs.SDK_VERSION,
219
+ "X-Deepline-API-Contract": _chunkOZSC6CEWjs.SDK_API_CONTRACT
220
220
  };
221
221
  if (apiKey) headers["Authorization"] = `Bearer ${apiKey}`;
222
222
  const bypassToken = _optionalChain([process, 'access', _7 => _7.env, 'access', _8 => _8.VERCEL_PROTECTION_BYPASS_TOKEN, 'optionalAccess', _9 => _9.trim, 'call', _10 => _10()]);
@@ -262,7 +262,7 @@ async function readStatusBanner(baseUrl) {
262
262
  return _optionalChain([response, 'optionalAccess', _11 => _11.status]) === 200 ? _nullishCoalesce(response.data.banner, () => ( null)) : null;
263
263
  }
264
264
  async function reportSetupCompleted(input) {
265
- const apiKey = input.authScope === "folder" ? _chunkFJCIUF34js.resolveProjectApiKeyForBaseUrl.call(void 0, input.baseUrl) : _chunkFJCIUF34js.resolveGlobalApiKeyForBaseUrl.call(void 0, input.baseUrl);
265
+ const apiKey = input.authScope === "folder" ? _chunkOZSC6CEWjs.resolveProjectApiKeyForBaseUrl.call(void 0, input.baseUrl) : _chunkOZSC6CEWjs.resolveGlobalApiKeyForBaseUrl.call(void 0, input.baseUrl);
266
266
  if (!apiKey) return;
267
267
  try {
268
268
  await httpJson(
@@ -359,7 +359,7 @@ async function printClaimSuccessBanner(baseUrl, apiKey, statusData) {
359
359
  }
360
360
  }
361
361
  async function handleRegister(args) {
362
- const baseUrl = _chunkFJCIUF34js.autoDetectBaseUrl.call(void 0, ).replace(/\/$/, "");
362
+ const baseUrl = _chunkOZSC6CEWjs.autoDetectBaseUrl.call(void 0, ).replace(/\/$/, "");
363
363
  let orgName = "";
364
364
  let orgId = "";
365
365
  let agentName = "";
@@ -414,19 +414,19 @@ async function handleRegister(args) {
414
414
  });
415
415
  saveEnvValues(
416
416
  {
417
- [_chunkFJCIUF34js.HOST_URL_ENV]: baseUrl
417
+ [_chunkOZSC6CEWjs.HOST_URL_ENV]: baseUrl
418
418
  },
419
419
  baseUrl,
420
420
  authScope
421
421
  );
422
422
  }
423
423
  if (claimUrl) {
424
- const shouldOpen = waitMode !== "no" && _chunkFJCIUF34js.detectAgentRuntime.call(void 0, ) !== "claude_cowork";
424
+ const shouldOpen = waitMode !== "no" && _chunkOZSC6CEWjs.detectAgentRuntime.call(void 0, ) !== "claude_cowork";
425
425
  console.log(
426
426
  shouldOpen ? " Opening approval page in your browser." : " Open this approval page in your browser:"
427
427
  );
428
428
  console.log(` ${claimUrl}`);
429
- if (shouldOpen) _chunkYD7B53RWjs.openInBrowser.call(void 0, claimUrl);
429
+ if (shouldOpen) _chunkZHWBU36Hjs.openInBrowser.call(void 0, claimUrl);
430
430
  }
431
431
  if (data.cli_message) {
432
432
  console.log(String(data.cli_message));
@@ -469,8 +469,8 @@ async function handleRegister(args) {
469
469
  if (apiKey) {
470
470
  saveEnvValues(
471
471
  {
472
- [_chunkFJCIUF34js.HOST_URL_ENV]: baseUrl,
473
- [_chunkFJCIUF34js.API_KEY_ENV]: apiKey,
472
+ [_chunkOZSC6CEWjs.HOST_URL_ENV]: baseUrl,
473
+ [_chunkOZSC6CEWjs.API_KEY_ENV]: apiKey,
474
474
  ...activeOrgEnvValues(statusData)
475
475
  },
476
476
  baseUrl,
@@ -492,7 +492,7 @@ async function handleRegister(args) {
492
492
  }
493
493
  }
494
494
  async function handleWait(args) {
495
- const baseUrl = _chunkFJCIUF34js.autoDetectBaseUrl.call(void 0, ).replace(/\/$/, "");
495
+ const baseUrl = _chunkOZSC6CEWjs.autoDetectBaseUrl.call(void 0, ).replace(/\/$/, "");
496
496
  let timeoutSeconds = 300;
497
497
  let requestedScope;
498
498
  if (args.includes("--auth-scope")) {
@@ -516,7 +516,7 @@ async function handleWait(args) {
516
516
  const authScope = resumed.scope;
517
517
  const claimToken = _nullishCoalesce(_optionalChain([pendingClaim, 'optionalAccess', _12 => _12.claimToken]), () => ( ""));
518
518
  if (!pendingClaim) {
519
- const scopedApiKey = authScope === "folder" ? _chunkFJCIUF34js.resolveProjectApiKeyForBaseUrl.call(void 0, baseUrl) : _chunkFJCIUF34js.resolveGlobalApiKeyForBaseUrl.call(void 0, baseUrl);
519
+ const scopedApiKey = authScope === "folder" ? _chunkOZSC6CEWjs.resolveProjectApiKeyForBaseUrl.call(void 0, baseUrl) : _chunkOZSC6CEWjs.resolveGlobalApiKeyForBaseUrl.call(void 0, baseUrl);
520
520
  if (scopedApiKey) {
521
521
  console.log("Already connected.");
522
522
  return EXIT_OK;
@@ -559,8 +559,8 @@ async function handleWait(args) {
559
559
  if (apiKey) {
560
560
  saveEnvValues(
561
561
  {
562
- [_chunkFJCIUF34js.HOST_URL_ENV]: baseUrl,
563
- [_chunkFJCIUF34js.API_KEY_ENV]: apiKey,
562
+ [_chunkOZSC6CEWjs.HOST_URL_ENV]: baseUrl,
563
+ [_chunkOZSC6CEWjs.API_KEY_ENV]: apiKey,
564
564
  ...activeOrgEnvValues(data)
565
565
  },
566
566
  baseUrl,
@@ -584,8 +584,8 @@ async function handleWait(args) {
584
584
  return EXIT_AUTH;
585
585
  }
586
586
  async function authStatusLine(timeoutMs = 3e3) {
587
- const baseUrl = _chunkFJCIUF34js.autoDetectBaseUrl.call(void 0, ).replace(/\/$/, "");
588
- const apiKey = _chunkFJCIUF34js.resolveApiKeyForBaseUrl.call(void 0, baseUrl);
587
+ const baseUrl = _chunkOZSC6CEWjs.autoDetectBaseUrl.call(void 0, ).replace(/\/$/, "");
588
+ const apiKey = _chunkOZSC6CEWjs.resolveApiKeyForBaseUrl.call(void 0, baseUrl);
589
589
  if (!apiKey) return `Auth: not connected (${baseUrl})`;
590
590
  try {
591
591
  const { status, data } = await httpJson(
@@ -608,9 +608,9 @@ async function authStatusLine(timeoutMs = 3e3) {
608
608
  }
609
609
  }
610
610
  async function handleStatus(args) {
611
- const baseUrl = _chunkFJCIUF34js.autoDetectBaseUrl.call(void 0, ).replace(/\/$/, "");
611
+ const baseUrl = _chunkOZSC6CEWjs.autoDetectBaseUrl.call(void 0, ).replace(/\/$/, "");
612
612
  const reveal = args.includes("--reveal");
613
- const jsonOutput = _chunkYD7B53RWjs.argsWantJson.call(void 0, args);
613
+ const jsonOutput = _chunkZHWBU36Hjs.argsWantJson.call(void 0, args);
614
614
  const hasExplicitAuthScope = args.includes("--auth-scope");
615
615
  let authScope = null;
616
616
  if (hasExplicitAuthScope) {
@@ -651,14 +651,14 @@ async function handleStatus(args) {
651
651
  };
652
652
  hostLines.push(`Host: ${baseUrl} (unreachable)`);
653
653
  }
654
- const apiKey = authScope === "folder" ? _chunkFJCIUF34js.resolveProjectApiKeyForBaseUrl.call(void 0, baseUrl) : authScope === "global" ? _chunkFJCIUF34js.resolveGlobalApiKeyForBaseUrl.call(void 0, baseUrl) : _chunkFJCIUF34js.resolveApiKeyForBaseUrl.call(void 0, baseUrl);
654
+ const apiKey = authScope === "folder" ? _chunkOZSC6CEWjs.resolveProjectApiKeyForBaseUrl.call(void 0, baseUrl) : authScope === "global" ? _chunkOZSC6CEWjs.resolveGlobalApiKeyForBaseUrl.call(void 0, baseUrl) : _chunkOZSC6CEWjs.resolveApiKeyForBaseUrl.call(void 0, baseUrl);
655
655
  if (!apiKey) {
656
656
  const { claim: pendingClaim } = resolvePendingAuthClaimForResume(
657
657
  baseUrl,
658
658
  _nullishCoalesce(authScope, () => ( void 0))
659
659
  );
660
660
  if (pendingClaim) {
661
- _chunkYD7B53RWjs.printCommandEnvelope.call(void 0,
661
+ _chunkZHWBU36Hjs.printCommandEnvelope.call(void 0,
662
662
  {
663
663
  ..._nullishCoalesce(hostStatusPayload, () => ( { host: baseUrl })),
664
664
  status: "pending",
@@ -679,7 +679,7 @@ async function handleStatus(args) {
679
679
  );
680
680
  return EXIT_OK;
681
681
  }
682
- _chunkYD7B53RWjs.printCommandEnvelope.call(void 0,
682
+ _chunkZHWBU36Hjs.printCommandEnvelope.call(void 0,
683
683
  {
684
684
  ..._nullishCoalesce(hostStatusPayload, () => ( { host: baseUrl })),
685
685
  status: "not connected",
@@ -712,7 +712,7 @@ async function handleStatus(args) {
712
712
  }
713
713
  );
714
714
  if (status === 401 || status === 403) {
715
- _chunkYD7B53RWjs.printCommandEnvelope.call(void 0,
715
+ _chunkZHWBU36Hjs.printCommandEnvelope.call(void 0,
716
716
  {
717
717
  ..._nullishCoalesce(hostStatusPayload, () => ( { host: baseUrl })),
718
718
  status: "unauthorized",
@@ -739,7 +739,7 @@ async function handleStatus(args) {
739
739
  console.error(`Auth status error (status ${status}).`);
740
740
  return EXIT_SERVER;
741
741
  }
742
- const resolvedAuthScope = _nullishCoalesce(authScope, () => ( (_chunkFJCIUF34js.getResolvedProjectAuthSource.call(void 0, baseUrl, apiKey) ? "folder" : "global")));
742
+ const resolvedAuthScope = _nullishCoalesce(authScope, () => ( (_chunkOZSC6CEWjs.getResolvedProjectAuthSource.call(void 0, baseUrl, apiKey) ? "folder" : "global")));
743
743
  clearSatisfiedPendingClaim(
744
744
  baseUrl,
745
745
  resolvedAuthScope,
@@ -767,28 +767,28 @@ async function handleStatus(args) {
767
767
  if (apiKeyResp) {
768
768
  saveEnvValues(
769
769
  {
770
- [_chunkFJCIUF34js.HOST_URL_ENV]: baseUrl,
771
- [_chunkFJCIUF34js.API_KEY_ENV]: apiKeyResp,
770
+ [_chunkOZSC6CEWjs.HOST_URL_ENV]: baseUrl,
771
+ [_chunkOZSC6CEWjs.API_KEY_ENV]: apiKeyResp,
772
772
  ...activeOrgEnvValues(data)
773
773
  },
774
774
  baseUrl,
775
775
  resolvedAuthScope
776
776
  );
777
777
  if (resolvedAuthScope === "folder") {
778
- const target = _chunkFJCIUF34js.resolveProjectPinTarget.call(void 0, );
778
+ const target = _chunkOZSC6CEWjs.resolveProjectPinTarget.call(void 0, );
779
779
  savedApiKeyPath = target.ok ? _path.join.call(void 0, target.dir, ".env.deepline") : null;
780
780
  } else {
781
781
  savedApiKeyPath = envFilePath(baseUrl);
782
782
  }
783
783
  }
784
- } else if (resolvedAuthScope === "folder" || _chunkFJCIUF34js.storedHostApiKey.call(void 0, baseUrl) === apiKey) {
785
- saveEnvValues(_chunkFJCIUF34js.featureEnvValues.call(void 0, data), baseUrl, resolvedAuthScope);
784
+ } else if (resolvedAuthScope === "folder" || _chunkOZSC6CEWjs.storedHostApiKey.call(void 0, baseUrl) === apiKey) {
785
+ saveEnvValues(_chunkOZSC6CEWjs.featureEnvValues.call(void 0, data), baseUrl, resolvedAuthScope);
786
786
  }
787
- _chunkYD7B53RWjs.printCommandEnvelope.call(void 0,
787
+ _chunkZHWBU36Hjs.printCommandEnvelope.call(void 0,
788
788
  {
789
789
  ...payload,
790
- ..._chunkFJCIUF34js.detectAgentRuntime.call(void 0, ) !== "unknown" ? {
791
- command_context: _chunkFJCIUF34js.resolveCliCommandContext.call(void 0,
790
+ ..._chunkOZSC6CEWjs.detectAgentRuntime.call(void 0, ) !== "unknown" ? {
791
+ command_context: _chunkOZSC6CEWjs.resolveCliCommandContext.call(void 0,
792
792
  { baseUrl, apiKey },
793
793
  resolvedAuthScope
794
794
  )
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  getAuthedHttpClient,
3
3
  printCommandEnvelope
4
- } from "./chunk-JRAVVJ3T.mjs";
4
+ } from "./chunk-XJD6LZCO.mjs";
5
5
  import {
6
6
  agentSessionIdFromEnvironment
7
- } from "./chunk-2PRO2JTX.mjs";
7
+ } from "./chunk-E52TKKVI.mjs";
8
8
 
9
9
  // src/cli/commands/sessions.ts
10
10
  import {
@@ -139,7 +139,10 @@ function currentSessionFile(agent) {
139
139
  const newestFirst = listSessionFiles(agent).sort(
140
140
  (a, b) => b.mtimeMs - a.mtimeMs
141
141
  );
142
- const sessionId = agentSessionIdFromEnvironment();
142
+ const sessionId = agentSessionIdFromEnvironment(
143
+ process.env,
144
+ agent === "auto" ? void 0 : agent === "claude" ? "claude_code" : "codex"
145
+ );
143
146
  const cwd = process.cwd();
144
147
  return newestFirst.find((candidate) => candidate.sessionId === sessionId) ?? newestFirst.find(
145
148
  (candidate) => sessionStartedInDirectory(candidate, cwd)
@@ -3,7 +3,7 @@ import {
3
3
  brandAsProviderTransientError,
4
4
  brandAsToolExecutionError,
5
5
  isProviderTransientFailure
6
- } from "./chunk-NXGCO4JB.mjs";
6
+ } from "./chunk-E4IXDAZI.mjs";
7
7
 
8
8
  // src/errors.ts
9
9
  var CustomerDbQueryOutcomeUnknownError = class extends DeeplineError {
@@ -3,10 +3,10 @@
3
3
 
4
4
 
5
5
 
6
- var _chunk7P5AA3SNjs = require('./chunk-7P5AA3SN.js');
6
+ var _chunkPPDBRJRWjs = require('./chunk-PPDBRJRW.js');
7
7
 
8
8
  // src/errors.ts
9
- var CustomerDbQueryOutcomeUnknownError = (_class = class extends _chunk7P5AA3SNjs.DeeplineError {
9
+ var CustomerDbQueryOutcomeUnknownError = (_class = class extends _chunkPPDBRJRWjs.DeeplineError {
10
10
  __init() {this.outcome = "unknown"}
11
11
 
12
12
 
@@ -28,14 +28,14 @@ var CustomerDbQueryOutcomeUnknownError = (_class = class extends _chunk7P5AA3SNj
28
28
  Object.defineProperty(this, "cause", { value: cause, configurable: true });
29
29
  }
30
30
  }, _class);
31
- var AuthError = class extends _chunk7P5AA3SNjs.DeeplineError {
31
+ var AuthError = class extends _chunkPPDBRJRWjs.DeeplineError {
32
32
  /** Constructed by the SDK when Deepline rejects the caller's credentials. */
33
33
  constructor(message = "Authentication failed. Check your DEEPLINE_API_KEY.") {
34
34
  super(message, 401, "AUTH_ERROR");
35
35
  this.name = "AuthError";
36
36
  }
37
37
  };
38
- var RateLimitError = class extends _chunk7P5AA3SNjs.DeeplineError {
38
+ var RateLimitError = class extends _chunkPPDBRJRWjs.DeeplineError {
39
39
  /** Milliseconds to wait before retrying, from the `Retry-After` response header. Defaults to 5000. */
40
40
 
41
41
  /** Constructed by the SDK after exhausting HTTP-level rate-limit retries. */
@@ -89,13 +89,13 @@ var ToolRateLimitError = class extends RateLimitError {
89
89
  this.networkScope = options.networkScope;
90
90
  this.publicDetails = _nullishCoalesce(options.publicDetails, () => ( null));
91
91
  this.details = options.details;
92
- _chunk7P5AA3SNjs.brandAsToolExecutionError.call(void 0, this);
93
- if (_chunk7P5AA3SNjs.isProviderTransientFailure.call(void 0, this)) {
94
- _chunk7P5AA3SNjs.brandAsProviderTransientError.call(void 0, this);
92
+ _chunkPPDBRJRWjs.brandAsToolExecutionError.call(void 0, this);
93
+ if (_chunkPPDBRJRWjs.isProviderTransientFailure.call(void 0, this)) {
94
+ _chunkPPDBRJRWjs.brandAsProviderTransientError.call(void 0, this);
95
95
  }
96
96
  }
97
97
  };
98
- var ConfigError = class extends _chunk7P5AA3SNjs.DeeplineError {
98
+ var ConfigError = class extends _chunkPPDBRJRWjs.DeeplineError {
99
99
  /** Construct a local SDK configuration failure. */
100
100
  constructor(message) {
101
101
  super(message, void 0, "CONFIG_ERROR");