deepline 0.3.484 → 0.3.486

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 (210) hide show
  1. package/dist/bundling-sources/sdk/src/client-core.ts +91 -30
  2. package/dist/bundling-sources/sdk/src/compat.ts +13 -0
  3. package/dist/bundling-sources/sdk/src/plays/client-core.ts +4 -1
  4. package/dist/bundling-sources/sdk/src/plays/run-request.ts +143 -9
  5. package/dist/bundling-sources/sdk/src/release.ts +1 -1
  6. package/dist/bundling-sources/sdk/src/runs/watch-polling.ts +31 -4
  7. package/dist/bundling-sources/sdk/src/tool-calls.ts +1 -1
  8. package/dist/bundling-sources/sdk/src/types.ts +7 -1
  9. package/dist/bundling-sources/shared_libs/play-data-plane/sheet-column-storage.ts +32 -3
  10. package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +126 -41
  11. package/dist/bundling-sources/shared_libs/play-runtime/context.ts +231 -25
  12. package/dist/bundling-sources/shared_libs/play-runtime/daytona-runtime-config.ts +9 -0
  13. package/dist/bundling-sources/shared_libs/play-runtime/deployment/fly-machines.ts +130 -19
  14. package/dist/bundling-sources/shared_libs/play-runtime/deployment/fly-registry.ts +105 -0
  15. package/dist/bundling-sources/shared_libs/play-runtime/execute-server-timing.ts +4 -2
  16. package/dist/bundling-sources/shared_libs/play-runtime/governor/app-runtime-rate-state-backend.ts +194 -56
  17. package/dist/bundling-sources/shared_libs/play-runtime/ledger-safe-payload.ts +8 -4
  18. package/dist/bundling-sources/shared_libs/play-runtime/log-provenance.ts +11 -6
  19. package/dist/bundling-sources/shared_libs/play-runtime/play-runs/sandbox-cleanup/job.ts +3 -0
  20. package/dist/bundling-sources/shared_libs/play-runtime/play-runs/sandbox-cleanup/ports.ts +2 -0
  21. package/dist/bundling-sources/shared_libs/play-runtime/play-runs/sandbox-cleanup/postgres-adapter.ts +2 -1
  22. package/dist/bundling-sources/shared_libs/play-runtime/protocol.ts +30 -0
  23. package/dist/bundling-sources/shared_libs/play-runtime/resource-governor.ts +195 -2
  24. package/dist/bundling-sources/shared_libs/play-runtime/run-failure.ts +20 -1
  25. package/dist/bundling-sources/shared_libs/play-runtime/run-ledger-projection-contract.ts +15 -0
  26. package/dist/bundling-sources/shared_libs/play-runtime/run-snapshot-stream.ts +2 -2
  27. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/index.ts +139 -67
  28. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/progress-sidecar.ts +9 -1
  29. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-control-transport.ts +25 -5
  30. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-launch-transport.ts +133 -82
  31. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-lifecycle.ts +58 -16
  32. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-sandbox-absence.ts +171 -0
  33. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-session-execution.ts +69 -0
  34. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona.ts +100 -40
  35. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/types.ts +8 -0
  36. package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +67 -9
  37. package/dist/bundling-sources/shared_libs/play-runtime/runtime-incident-drills.ts +5 -5
  38. package/dist/bundling-sources/shared_libs/play-runtime/runtime-receipt-store-adapter.ts +6 -3
  39. package/dist/bundling-sources/shared_libs/play-runtime/runtime-sheet-errors.ts +14 -0
  40. package/dist/bundling-sources/shared_libs/play-runtime/runtime-sheet-row-writer.ts +87 -31
  41. package/dist/bundling-sources/shared_libs/play-runtime/sandbox-runs/contract.ts +18 -0
  42. package/dist/bundling-sources/shared_libs/play-runtime/sandbox-runs/index.ts +19 -0
  43. package/dist/bundling-sources/shared_libs/play-runtime/sandbox-runs/runner-backend-adapter.ts +14 -0
  44. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +206 -7
  45. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd.ts +39 -0
  46. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/play-run-recovery.ts +12 -1
  47. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-progress.ts +28 -9
  48. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-rate-scope.ts +44 -15
  49. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-rate-state.ts +60 -11
  50. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +656 -64
  51. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/run-ledger-outbox-recovery.ts +6 -1
  52. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-event-search.ts +17 -0
  53. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-sandbox-capacity.ts +25 -33
  54. package/dist/bundling-sources/shared_libs/play-runtime/suspension.ts +12 -0
  55. package/dist/bundling-sources/shared_libs/play-runtime/test-runtime-seams.ts +21 -0
  56. package/dist/bundling-sources/shared_libs/plays/authoring-contract.ts +1 -1
  57. package/dist/bundling-sources/shared_libs/plays/source-authoring-edition.ts +1 -1
  58. package/dist/cli/auth-ARKH3OAU.js +43 -0
  59. package/dist/cli/{auth-EBFOTF7X.mjs → auth-B4DJO4FB.mjs} +5 -5
  60. package/dist/cli/{billing-G2G3EF3I.js → billing-GDWAMARK.js} +80 -80
  61. package/dist/cli/{billing-2ZOIMW5V.mjs → billing-IIQ3VNXU.mjs} +7 -7
  62. package/dist/cli/{chunk-YWC5AN26.mjs → chunk-2DVFQYPG.mjs} +62 -34
  63. package/dist/cli/{chunk-UWOY74RU.js → chunk-5DUP4ZUE.js} +21 -21
  64. package/dist/cli/{chunk-EACX7QXO.mjs → chunk-5QYZ4MEW.mjs} +2 -2
  65. package/dist/cli/{chunk-HEI3BWIV.mjs → chunk-5RLVCOKH.mjs} +1 -1
  66. package/dist/cli/{chunk-TIRSKEZH.mjs → chunk-5Y7LLRWO.mjs} +1 -1
  67. package/dist/cli/{chunk-IXWQOVNW.js → chunk-5YILTBF7.js} +87 -76
  68. package/dist/cli/{chunk-OHKKDPA5.js → chunk-7FTQKEZ6.js} +13 -13
  69. package/dist/cli/{chunk-TN2GW57M.mjs → chunk-A456YVDE.mjs} +1 -1
  70. package/dist/cli/{chunk-GVAENVIG.js → chunk-AUQQVDAB.js} +110 -21
  71. package/dist/cli/{chunk-3XQIVEAT.js → chunk-BJL7RYQN.js} +3 -3
  72. package/dist/cli/{chunk-2AWYJXBX.js → chunk-BNB2RK4L.js} +5 -5
  73. package/dist/cli/{chunk-U7IJAGWB.js → chunk-BYEDI5PM.js} +7 -7
  74. package/dist/cli/{chunk-RLLEH2SP.js → chunk-C4GFBB52.js} +26 -26
  75. package/dist/cli/{chunk-AK7UKQ5R.js → chunk-CSBMKHTV.js} +5 -5
  76. package/dist/cli/{chunk-UT4YMA2N.js → chunk-DFHS5XVZ.js} +5 -4
  77. package/dist/cli/{chunk-XZXIWPT3.mjs → chunk-F3G2HAUQ.mjs} +1 -1
  78. package/dist/cli/{chunk-C62NI2X6.js → chunk-FCAKAW6S.js} +5 -5
  79. package/dist/cli/{chunk-AF7MOUZP.mjs → chunk-FGPJXQEJ.mjs} +2 -2
  80. package/dist/cli/chunk-FSCOYTRV.js +42 -0
  81. package/dist/cli/{chunk-6GRZEYSG.js → chunk-GCEUOHJW.js} +7 -7
  82. package/dist/cli/{chunk-SD7QWZTV.mjs → chunk-INW22YP7.mjs} +1 -1
  83. package/dist/cli/{chunk-OWUZKXE7.mjs → chunk-J7EENGKJ.mjs} +1 -1
  84. package/dist/cli/{chunk-QIDDTIVZ.js → chunk-KPIVQFXZ.js} +322 -294
  85. package/dist/cli/{chunk-4IOY2SCQ.js → chunk-LOX3BISD.js} +4 -4
  86. package/dist/cli/{chunk-WYUCDLVR.mjs → chunk-MJ56FCYU.mjs} +2 -1
  87. package/dist/cli/{chunk-DBJ62RAO.js → chunk-NSPMJLYA.js} +3 -3
  88. package/dist/cli/{chunk-HNRELVCS.mjs → chunk-ONONSV2Q.mjs} +96 -7
  89. package/dist/cli/{chunk-PU52JXKA.mjs → chunk-P6KGYOCM.mjs} +13 -4
  90. package/dist/cli/{chunk-VEVGM6B5.js → chunk-PCYZDTDC.js} +14 -14
  91. package/dist/cli/{chunk-NW4QJE54.js → chunk-PHWFY26F.js} +2 -2
  92. package/dist/cli/{chunk-LTZXLYKE.mjs → chunk-PKOFEHZL.mjs} +93 -17
  93. package/dist/cli/{chunk-7K5CWKKZ.mjs → chunk-PQHDZHZG.mjs} +2 -2
  94. package/dist/cli/{chunk-UKM74PAA.js → chunk-PTM3QRAT.js} +37 -37
  95. package/dist/cli/{chunk-YGN77QA5.mjs → chunk-PV7AYBKQ.mjs} +3 -3
  96. package/dist/cli/{chunk-4OEOM6GP.mjs → chunk-PYDHVRAF.mjs} +5 -5
  97. package/dist/cli/{chunk-FRD5WFT4.js → chunk-QD22TY33.js} +323 -247
  98. package/dist/cli/{chunk-5KNRQWHE.js → chunk-QEQ3KHVY.js} +3 -3
  99. package/dist/cli/{chunk-KGOC6HGI.js → chunk-S5EYODEG.js} +53 -53
  100. package/dist/cli/{chunk-FQK7BULS.js → chunk-S7OILDJH.js} +1 -1
  101. package/dist/cli/{chunk-TRLDJNVE.mjs → chunk-T3Q6BMVH.mjs} +1 -1
  102. package/dist/cli/{chunk-5K5CAND4.mjs → chunk-TBE2K5W4.mjs} +4 -4
  103. package/dist/cli/{chunk-YHA3EV3I.mjs → chunk-TE2QT2MX.mjs} +15 -4
  104. package/dist/cli/{chunk-ZOKM7DVA.js → chunk-TNHY3ATN.js} +8 -8
  105. package/dist/cli/{chunk-4OVHIWE7.mjs → chunk-U23L57VU.mjs} +2 -2
  106. package/dist/cli/{chunk-5GOG5ZGC.mjs → chunk-UEJLWUJ3.mjs} +2 -2
  107. package/dist/cli/{chunk-6NPWXE32.mjs → chunk-VJLL5XIP.mjs} +1 -1
  108. package/dist/cli/{chunk-WXRM3UC6.mjs → chunk-WCOJH4W4.mjs} +3 -3
  109. package/dist/cli/{chunk-4SFC2XUF.mjs → chunk-XAZWUW6I.mjs} +5 -5
  110. package/dist/cli/{chunk-ZM2YPJQJ.js → chunk-XK5DMLZE.js} +5 -1
  111. package/dist/cli/{chunk-LJ5747UC.mjs → chunk-XRDXNAAY.mjs} +5 -1
  112. package/dist/cli/{chunk-V7JCMBLU.mjs → chunk-YIKHNZ6B.mjs} +4 -4
  113. package/dist/cli/{chunk-M4PG7FGC.js → chunk-YS6JOYYS.js} +2 -2
  114. package/dist/cli/{chunk-DEXSQGXB.mjs → chunk-ZMRZ3BXG.mjs} +5 -5
  115. package/dist/cli/{chunk-CYWBAV5H.js → chunk-ZQI26KE4.js} +16 -16
  116. package/dist/cli/{csv-S3CHUKI6.js → csv-3PSMPZM5.js} +13 -13
  117. package/dist/cli/{csv-NLWVWD3H.mjs → csv-LFCT3WQ4.mjs} +4 -4
  118. package/dist/cli/{db-OGRPAEEM.mjs → db-HULKVAMU.mjs} +7 -7
  119. package/dist/cli/{db-WBSKMMOH.js → db-R7I2PPTV.js} +28 -28
  120. package/dist/cli/{describe-FAD3Z7LN.mjs → describe-D55V42LH.mjs} +21 -21
  121. package/dist/cli/describe-H47BLOEP.js +49 -0
  122. package/dist/cli/describe-core.d.mts +3 -3
  123. package/dist/cli/describe-core.d.ts +3 -3
  124. package/dist/cli/describe-core.js +4 -4
  125. package/dist/cli/describe-core.mjs +3 -3
  126. package/dist/cli/{executions-LYCL344R.mjs → executions-ICVVOYVG.mjs} +7 -7
  127. package/dist/cli/{executions-SOAZHCY4.js → executions-O37FN2SK.js} +9 -9
  128. package/dist/cli/{feedback-AVF6V7SV.mjs → feedback-3K3QPGCQ.mjs} +4 -4
  129. package/dist/cli/{feedback-OROUPUNJ.js → feedback-MAZQ7C6S.js} +8 -8
  130. package/dist/cli/{git-J5N5M57H.mjs → git-2MMD5KJS.mjs} +5 -5
  131. package/dist/cli/git-RQ2XLFYZ.js +25 -0
  132. package/dist/cli/index.js +142 -139
  133. package/dist/cli/index.mjs +45 -42
  134. package/dist/cli/{legacy-noops-QAQMZMEG.js → legacy-noops-2OX2Y3Y2.js} +8 -8
  135. package/dist/cli/{legacy-noops-ENRRM7BL.mjs → legacy-noops-VLSWJ6VE.mjs} +5 -5
  136. package/dist/cli/{monitors-CKQ65WRL.mjs → monitors-2NODQQWG.mjs} +8 -8
  137. package/dist/cli/{monitors-SFMQ5LFR.js → monitors-UCSV5FOR.js} +92 -92
  138. package/dist/cli/{org-3UNTDLT2.js → org-4YY73VTW.js} +73 -73
  139. package/dist/cli/{org-K4UIEU5P.mjs → org-W7AUQCDE.mjs} +7 -7
  140. package/dist/cli/{pages-NKZTGB4C.js → pages-FBZEUMXK.js} +18 -18
  141. package/dist/cli/{pages-6GPGBIAH.mjs → pages-ZRP7U5PO.mjs} +7 -7
  142. package/dist/cli/{play-BDEADESI.js → play-LFCTQJXA.js} +858 -632
  143. package/dist/cli/{play-62BEE7IX.mjs → play-XF2BSGTP.mjs} +372 -146
  144. package/dist/cli/{providers-SXGP44GH.js → providers-5456JNHP.js} +10 -10
  145. package/dist/cli/{providers-X3CUWMFP.mjs → providers-SICAPKGI.mjs} +7 -7
  146. package/dist/cli/{quickstart-XQ4426M4.js → quickstart-2KLLIPIU.js} +6 -6
  147. package/dist/cli/{quickstart-7LN22BKX.mjs → quickstart-IBVG6GX6.mjs} +4 -4
  148. package/dist/cli/{run-PBJ4ZJ4W.js → run-DNLDGJRC.js} +41 -41
  149. package/dist/cli/{run-XXSN3B5A.mjs → run-XPIZIQ7H.mjs} +26 -26
  150. package/dist/cli/search-2KQA65LH.js +32 -0
  151. package/dist/cli/{search-M75VMADD.mjs → search-PW22AEAL.mjs} +8 -8
  152. package/dist/cli/{search-output-F6HCFYEI.js → search-output-H6F6QMRF.js} +22 -16
  153. package/dist/cli/{search-output-NUQAKWDM.mjs → search-output-JFD53H2N.mjs} +14 -8
  154. package/dist/cli/{secrets-J2H6V33R.mjs → secrets-542CTZRZ.mjs} +7 -7
  155. package/dist/cli/{secrets-LRYY4QPE.js → secrets-LCCRRAN7.js} +16 -16
  156. package/dist/cli/{sessions-YPF62CZE.js → sessions-5FYDQE3N.js} +6 -6
  157. package/dist/cli/{sessions-IMT336UV.mjs → sessions-CALLS2XD.mjs} +5 -5
  158. package/dist/cli/{settings-PDWVQIGH.mjs → settings-GSKPHUEC.mjs} +12 -12
  159. package/dist/cli/{settings-35YYC5WA.js → settings-ORGKOBP6.js} +79 -79
  160. package/dist/cli/{setup-UR7GOR7H.js → setup-4BUWJKB6.js} +47 -47
  161. package/dist/cli/{setup-DG5DISSE.mjs → setup-V57GHVAF.mjs} +9 -9
  162. package/dist/cli/skills-KYZPPGSN.js +33 -0
  163. package/dist/cli/{skills-U6NJD5J7.mjs → skills-NGLCFQFT.mjs} +7 -7
  164. package/dist/cli/tools-AFYXUEMD.js +56 -0
  165. package/dist/cli/{tools-2HGEOELR.mjs → tools-G2YNCFNX.mjs} +19 -19
  166. package/dist/cli/{update-FRAYBAHK.mjs → update-IZ3Z5T5C.mjs} +9 -9
  167. package/dist/cli/update-T6JJ7A3K.js +33 -0
  168. package/dist/cli/{workflow-JKKLOMBX.js → workflow-7AHST2XV.js} +18 -18
  169. package/dist/cli/{workflow-DDKVTF36.mjs → workflow-L7ROQIM7.mjs} +8 -8
  170. package/dist/{client-DJ3r8VQJ.d.mts → client-BkbDHRIg.d.mts} +1 -1
  171. package/dist/{client-JPSNljtj.d.ts → client-D3hVHXjK.d.ts} +1 -1
  172. package/dist/{client-core-3SJlNsKU.d.mts → client-core-BZoSMKcY.d.mts} +30 -15
  173. package/dist/{client-core-rCoQ5Xz3.d.ts → client-core-DUdVqO_m.d.ts} +30 -15
  174. package/dist/{compiler-manifest-gkO9ZkVg.d.mts → compiler-manifest-BFTwq1HI.d.mts} +1 -1
  175. package/dist/{compiler-manifest-gkO9ZkVg.d.ts → compiler-manifest-BFTwq1HI.d.ts} +1 -1
  176. package/dist/{errors-Cc92LKH-.d.ts → errors-c3pMsylw.d.ts} +1 -1
  177. package/dist/{errors-CeCCOKSA.d.mts → errors-w31ybrQM.d.mts} +1 -1
  178. package/dist/{index-DJQKdV76.d.ts → index-CQ-15-QL.d.ts} +1 -1
  179. package/dist/{index-DsqWJL3Q.d.mts → index-DvNtxucX.d.mts} +1 -1
  180. package/dist/index.d.mts +7 -7
  181. package/dist/index.d.ts +7 -7
  182. package/dist/index.js +10 -10
  183. package/dist/index.mjs +7 -7
  184. package/dist/install-integrity.json +117 -116
  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 +2 -2
  188. package/dist/plays/play-description.d.mts +2 -2
  189. package/dist/plays/play-description.d.ts +2 -2
  190. package/dist/plays/run-request.d.mts +2 -2
  191. package/dist/plays/run-request.d.ts +2 -2
  192. package/dist/plays/run-request.js +12 -2
  193. package/dist/plays/run-request.mjs +11 -1
  194. package/dist/release.d.mts +1 -1
  195. package/dist/release.d.ts +1 -1
  196. package/dist/release.js +2 -2
  197. package/dist/release.mjs +1 -1
  198. package/dist/server.d.mts +4 -4
  199. package/dist/server.d.ts +4 -4
  200. package/dist/server.js +6 -6
  201. package/dist/server.mjs +4 -4
  202. package/package.json +1 -1
  203. package/dist/cli/auth-L5CSV3UO.js +0 -43
  204. package/dist/cli/chunk-KA2LNIUP.js +0 -33
  205. package/dist/cli/describe-UIAYCHWW.js +0 -49
  206. package/dist/cli/git-ATMWC27D.js +0 -25
  207. package/dist/cli/search-IGHLRLBD.js +0 -32
  208. package/dist/cli/skills-4U5WC4MJ.js +0 -33
  209. package/dist/cli/tools-PYJTQVVS.js +0 -56
  210. package/dist/cli/update-344OTRFM.js +0 -33
@@ -6,7 +6,7 @@ var _chunkIAYSWZDJjs = require('./chunk-IAYSWZDJ.js');
6
6
 
7
7
 
8
8
 
9
- var _chunkZM2YPJQJjs = require('./chunk-ZM2YPJQJ.js');
9
+ var _chunkXK5DMLZEjs = require('./chunk-XK5DMLZE.js');
10
10
 
11
11
 
12
12
  var _chunkJ33TSWO5js = require('./chunk-J33TSWO5.js');
@@ -74,7 +74,7 @@ function toolContractJsonForDescribe(tool, requestedToolId, authoringContractEdi
74
74
  const extractedValues = extractionContractEntries(
75
75
  arrayField(toolExecutionResult, "extractedValues", "extracted_values")
76
76
  );
77
- const pricing = _chunkZM2YPJQJjs.Capability.fromCatalogEntry(tool).describe().customerCost();
77
+ const pricing = _chunkXK5DMLZEjs.Capability.fromCatalogEntry(tool).describe().customerCost();
78
78
  const executionMetadataRecord = recordField(
79
79
  tool,
80
80
  "executionMetadata",
@@ -298,7 +298,7 @@ function describedTool(tool, requestedToolId) {
298
298
  stringField(cost, "displayText"),
299
299
  // "Free (free)" says the same thing twice.
300
300
  billing.toLowerCase() === stringField(cost, "displayText").toLowerCase() ? "" : billing && `(${billing})`,
301
- _chunkZM2YPJQJjs.observedMaxText.call(void 0, cost) && `\u2014 ${_chunkZM2YPJQJjs.observedMaxText.call(void 0, cost)}`
301
+ _chunkXK5DMLZEjs.observedMaxText.call(void 0, cost) && `\u2014 ${_chunkXK5DMLZEjs.observedMaxText.call(void 0, cost)}`
302
302
  ].filter(Boolean).join(" ") || void 0,
303
303
  guidance: [
304
304
  ...contract.deprecated === true ? [`Deprecated. ${stringField(deprecation, "message")}`.trim()] : [],
@@ -397,7 +397,7 @@ function toolMetadataJsonForDescribe(tool, requestedToolId, seedStarterScript) {
397
397
  } = tool;
398
398
  const outputSchemaRecord = recordField(tool, "outputSchema", "output_schema");
399
399
  return {
400
- cost: _chunkZM2YPJQJjs.Capability.fromCatalogEntry(tool).describe().customerCost(),
400
+ cost: _chunkXK5DMLZEjs.Capability.fromCatalogEntry(tool).describe().customerCost(),
401
401
  ...publicTool,
402
402
  toolId,
403
403
  provider: tool.provider,
@@ -16,7 +16,7 @@ import {
16
16
  } from "./chunk-HBL4PM5Q.mjs";
17
17
  import {
18
18
  SDK_RELEASE
19
- } from "./chunk-HEI3BWIV.mjs";
19
+ } from "./chunk-5RLVCOKH.mjs";
20
20
 
21
21
  // src/version.ts
22
22
  var SDK_VERSION = SDK_RELEASE.version;
@@ -126,6 +126,7 @@ var PREFERRED_RECEIPT_GATEWAY_MACHINE_ID_HEADER = "x-deepline-preferred-receipt-
126
126
  var SYNTHETIC_RUN_HEADER = "x-deepline-synthetic-run";
127
127
 
128
128
  // ../play-runtime/test-runtime-seams.ts
129
+ import { createHash } from "crypto";
129
130
  var PLAY_RUNTIME_TEST_FAULT_HEADER = "x-deepline-test-fault";
130
131
  var MAX_RUNTIME_TEST_POLICY_MS = 10 * 6e4;
131
132
  var MAX_RUNNER_HEARTBEAT_SILENCE_MS = 10 * 6e4;
@@ -6,7 +6,7 @@ var _chunkIAYSWZDJjs = require('./chunk-IAYSWZDJ.js');
6
6
 
7
7
 
8
8
 
9
- var _chunkU7IJAGWBjs = require('./chunk-U7IJAGWB.js');
9
+ var _chunkBYEDI5PMjs = require('./chunk-BYEDI5PM.js');
10
10
 
11
11
  // src/cli/describe-options.ts
12
12
  function addDescribeOptions(command, options = {}) {
@@ -247,7 +247,7 @@ function projectRunDatasetCell(value) {
247
247
  const logicalValue = parseSerializedDatasetValue(value);
248
248
  if (logicalValue === null || logicalValue === void 0) return logicalValue;
249
249
  if (typeof logicalValue === "object") {
250
- return _chunkU7IJAGWBjs.csvSafeJsonString.call(void 0, canonicalDatasetJson(logicalValue));
250
+ return _chunkBYEDI5PMjs.csvSafeJsonString.call(void 0, canonicalDatasetJson(logicalValue));
251
251
  }
252
252
  return logicalValue;
253
253
  }
@@ -642,7 +642,7 @@ function csvText(rows, columns = []) {
642
642
  rows: rows.map((row) => record(row) ? row : { value: row }),
643
643
  columns
644
644
  });
645
- return _chunkU7IJAGWBjs.csvStringFromRows.call(void 0, projection.rows, projection.columns);
645
+ return _chunkBYEDI5PMjs.csvStringFromRows.call(void 0, projection.rows, projection.columns);
646
646
  }
647
647
  function writeExecutionOutput(result, options) {
648
648
  let temp;
@@ -74,11 +74,37 @@ function decodePlayRunPublicStatus(value) {
74
74
  // src/plays/run-request.ts
75
75
  var PLAY_RUN_START_PATH = "/api/v2/plays/run";
76
76
  var CLI_PLAY_RUN_START_PATH = `${PLAY_RUN_START_PATH}/cli`;
77
+ var CLI_PLAY_RUN_CALLER_INTENT_V2_PATH = `${CLI_PLAY_RUN_START_PATH}/caller-intent-v2`;
77
78
  var CLI_PLAY_RUN_SUPPORTED_HEADER = "x-deepline-cli-play-admission";
79
+ var CLI_PLAY_RUN_CALLER_INTENT_V2_SUPPORTED_HEADER = "x-deepline-cli-play-caller-intent-v2";
78
80
  var PLAY_RUN_START_STREAM_PATH = `${PLAY_RUN_START_PATH}?stream=true`;
79
81
  var CLI_PLAY_RUN_START_STREAM_PATH = `${CLI_PLAY_RUN_START_PATH}?stream=true`;
82
+ var CLI_PLAY_RUN_CALLER_INTENT_V2_START_STREAM_PATH = `${CLI_PLAY_RUN_CALLER_INTENT_V2_PATH}?stream=true`;
80
83
  var PLAY_FILES_STAGE_PATH = "/api/v2/plays/files/stage";
81
84
  var PLAY_FILES_STAGE_MINT_PATH = `${PLAY_FILES_STAGE_PATH}/mint`;
85
+ async function awaitWithAbort(value, signal) {
86
+ if (!signal) return await value;
87
+ signal.throwIfAborted();
88
+ let removeAbortListener = () => {
89
+ };
90
+ const aborted = new Promise((_resolve, reject) => {
91
+ const onAbort = () => {
92
+ reject(
93
+ signal.reason ?? Object.assign(new Error("Play admission was aborted."), {
94
+ name: "AbortError"
95
+ })
96
+ );
97
+ };
98
+ signal.addEventListener("abort", onAbort, { once: true });
99
+ removeAbortListener = () => signal.removeEventListener("abort", onAbort);
100
+ if (signal.aborted) onAbort();
101
+ });
102
+ try {
103
+ return await Promise.race([Promise.resolve(value), aborted]);
104
+ } finally {
105
+ removeAbortListener();
106
+ }
107
+ }
82
108
  var CliPlayAdmissionUnsupportedError = class extends DeeplineError {
83
109
  constructor(status) {
84
110
  super(
@@ -88,6 +114,15 @@ var CliPlayAdmissionUnsupportedError = class extends DeeplineError {
88
114
  );
89
115
  }
90
116
  };
117
+ var CliPlayAdmissionCallerIntentV2UnsupportedError = class extends DeeplineError {
118
+ constructor(status) {
119
+ super(
120
+ "This server does not support versioned CLI Play admission.",
121
+ status,
122
+ "CLI_PLAY_CALLER_INTENT_V2_UNSUPPORTED"
123
+ );
124
+ }
125
+ };
91
126
  function buildPlayRunStartBody(request) {
92
127
  return {
93
128
  ...request.admissionOrgId ? { admissionOrgId: request.admissionOrgId } : {},
@@ -126,10 +161,27 @@ function buildPlayRunStartBody(request) {
126
161
  };
127
162
  }
128
163
  async function preparePlayRunAdmission(http, request, onSubmission, options) {
129
- const capability = options && Object.hasOwn(options, "admissionCapability") ? await options.admissionCapability : await readPlayRunAdmissionCapability(http, options);
130
- const supportsCallerIntent = capability?.admissionContract === "caller-intent-v1";
131
- options?.signal?.throwIfAborted();
132
- if (supportsCallerIntent && (!capability?.orgId || request.admissionOrgId && request.admissionOrgId !== capability.orgId)) {
164
+ const assertAdmissionActive = () => {
165
+ options?.signal?.throwIfAborted();
166
+ if (options?.deadlineAt !== void 0 && Date.now() >= options.deadlineAt) {
167
+ const error = new Error("Play admission exceeded its wait deadline.");
168
+ error.name = "AbortError";
169
+ throw error;
170
+ }
171
+ };
172
+ const callerIntentV2 = options?.callerIntentV2 === true;
173
+ if (callerIntentV2 && (onSubmission || request.maxTotalCredits !== void 0)) {
174
+ throw new DeeplineError(
175
+ "Versioned CLI Play admission requires a new, unjournaled run without a strict total budget.",
176
+ 409,
177
+ "CLI_PLAY_CALLER_INTENT_V2_INELIGIBLE"
178
+ );
179
+ }
180
+ assertAdmissionActive();
181
+ const capability = callerIntentV2 ? null : options && Object.hasOwn(options, "admissionCapability") ? await awaitWithAbort(options.admissionCapability, options.signal) : await readPlayRunAdmissionCapability(http, options);
182
+ const supportsCallerIntent = callerIntentV2 || capability?.admissionContract === "caller-intent-v1";
183
+ assertAdmissionActive();
184
+ if (supportsCallerIntent && !callerIntentV2 && (!capability?.orgId || request.admissionOrgId && request.admissionOrgId !== capability.orgId)) {
133
185
  throw new DeeplineError(
134
186
  "The admission workspace could not be pinned to this request; execution was not submitted.",
135
187
  409,
@@ -168,7 +220,7 @@ async function preparePlayRunAdmission(http, request, onSubmission, options) {
168
220
  JSON.stringify(
169
221
  buildPlayRunStartBody({
170
222
  ...request,
171
- ...supportsCallerIntent ? { admissionOrgId: capability.orgId } : {}
223
+ ...supportsCallerIntent && !callerIntentV2 ? { admissionOrgId: capability.orgId } : {}
172
224
  })
173
225
  )
174
226
  );
@@ -189,6 +241,7 @@ async function preparePlayRunAdmission(http, request, onSubmission, options) {
189
241
  "PLAY_RUN_ADMISSION_RECOVERY_UNSUPPORTED"
190
242
  );
191
243
  }
244
+ assertAdmissionActive();
192
245
  await onSubmission({
193
246
  workflowId,
194
247
  orgId: capability.orgId,
@@ -233,25 +286,44 @@ async function startPlayRun(http, request, headers, options) {
233
286
  options?.onSubmission,
234
287
  options
235
288
  );
289
+ return submitPreparedPlayRunAdmission(
290
+ http,
291
+ submittedBody,
292
+ workflowId,
293
+ supportsCallerIntent,
294
+ headers,
295
+ options
296
+ );
297
+ }
298
+ async function submitPreparedPlayRunAdmission(http, submittedBody, workflowId, supportsCallerIntent, headers, options) {
236
299
  let cliAdmissionSupported = false;
300
+ let callerIntentV2Supported = false;
237
301
  let response;
238
302
  try {
239
303
  response = await http.post(
240
- options?.cliAdmission ? CLI_PLAY_RUN_START_PATH : PLAY_RUN_START_PATH,
304
+ options?.callerIntentV2 ? CLI_PLAY_RUN_CALLER_INTENT_V2_PATH : options?.cliAdmission ? CLI_PLAY_RUN_START_PATH : PLAY_RUN_START_PATH,
241
305
  submittedBody,
242
306
  headers,
243
307
  {
244
308
  maxRetries: 0,
245
309
  exactUrlOnly: true,
246
310
  ...options?.signal ? { signal: options.signal } : {},
247
- ...options?.cliAdmission ? {
311
+ ...options?.cliAdmission || options?.callerIntentV2 ? {
248
312
  onResponse: (response2) => {
249
313
  cliAdmissionSupported = response2.headers.get(CLI_PLAY_RUN_SUPPORTED_HEADER) === "true";
314
+ callerIntentV2Supported = response2.headers.get(
315
+ CLI_PLAY_RUN_CALLER_INTENT_V2_SUPPORTED_HEADER
316
+ ) === "true";
250
317
  }
251
318
  } : {}
252
319
  }
253
320
  );
254
321
  } catch (error) {
322
+ if (options?.callerIntentV2 && !callerIntentV2Supported && error instanceof DeeplineError && (error.statusCode === 404 || error.statusCode === 405)) {
323
+ throw new CliPlayAdmissionCallerIntentV2UnsupportedError(
324
+ error.statusCode
325
+ );
326
+ }
255
327
  if (options?.cliAdmission && !cliAdmissionSupported && error instanceof DeeplineError && (error.statusCode === 404 || error.statusCode === 405)) {
256
328
  throw new CliPlayAdmissionUnsupportedError(error.statusCode);
257
329
  }
@@ -277,6 +349,18 @@ async function startPlayRun(http, request, headers, options) {
277
349
  }
278
350
  throw error;
279
351
  }
352
+ if (options?.callerIntentV2 && !callerIntentV2Supported) {
353
+ throw new DeeplineError(
354
+ "The versioned CLI Play admission response did not prove its contract. Inspect this run before submitting again.",
355
+ void 0,
356
+ "PLAY_RUN_ADMISSION_CONTRACT_UNKNOWN",
357
+ {
358
+ ...workflowId ? { runId: workflowId, workflowId } : {},
359
+ admissionState: "unknown",
360
+ recoverySupported: supportsCallerIntent
361
+ }
362
+ );
363
+ }
280
364
  const started = normalizePlayRunStart(response);
281
365
  if (options?.cliAdmission && (!started.workflowId || started.workflowId === "pending")) {
282
366
  throw new DeeplineError(
@@ -713,16 +797,21 @@ export {
713
797
  decodePlayRunPublicStatus,
714
798
  PLAY_RUN_START_PATH,
715
799
  CLI_PLAY_RUN_START_PATH,
800
+ CLI_PLAY_RUN_CALLER_INTENT_V2_PATH,
716
801
  CLI_PLAY_RUN_SUPPORTED_HEADER,
802
+ CLI_PLAY_RUN_CALLER_INTENT_V2_SUPPORTED_HEADER,
717
803
  PLAY_RUN_START_STREAM_PATH,
718
804
  CLI_PLAY_RUN_START_STREAM_PATH,
805
+ CLI_PLAY_RUN_CALLER_INTENT_V2_START_STREAM_PATH,
719
806
  PLAY_FILES_STAGE_PATH,
720
807
  PLAY_FILES_STAGE_MINT_PATH,
721
808
  CliPlayAdmissionUnsupportedError,
809
+ CliPlayAdmissionCallerIntentV2UnsupportedError,
722
810
  buildPlayRunStartBody,
723
811
  preparePlayRunAdmission,
724
812
  readPlayRunAdmissionCapability,
725
813
  startPlayRun,
814
+ submitPreparedPlayRunAdmission,
726
815
  isPlayRunPackage,
727
816
  normalizePlayRunStart,
728
817
  buildNamedPlayRunRequest,
@@ -1,26 +1,34 @@
1
1
  import {
2
2
  traceCliSpan
3
- } from "./chunk-6NPWXE32.mjs";
3
+ } from "./chunk-VJLL5XIP.mjs";
4
4
  import {
5
5
  checkSdkCompatibility,
6
6
  enforceSdkCompatibilityResponse,
7
7
  flushDeferredSkillsSyncNotices
8
- } from "./chunk-YHA3EV3I.mjs";
8
+ } from "./chunk-TE2QT2MX.mjs";
9
9
 
10
10
  // src/cli/play-run-admission.ts
11
11
  function usesInlinePlayAdmission(command, args) {
12
12
  return command === "plays run" && args.includes("--json") && !args.includes("--no-wait");
13
13
  }
14
- async function checkPlayRunCompatibility(baseUrl, maintenancePolicy = "configured") {
14
+ function usesCliPlayAdmission(command, args) {
15
+ return command === "plays run" && !args.includes("--no-wait") && (!args.some(
16
+ (arg) => arg === "--run-id-file" || arg.startsWith("--run-id-file=")
17
+ ) || args.includes("--json"));
18
+ }
19
+ async function checkPlayRunCompatibility(baseUrl, maintenancePolicy = "configured", signal) {
20
+ signal?.throwIfAborted();
15
21
  if (maintenancePolicy !== "off") flushDeferredSkillsSyncNotices(baseUrl);
16
22
  const compatibility = await traceCliSpan(
17
23
  "cli.sdk_compatibility",
18
24
  { baseUrl, command: "plays run" },
19
25
  () => checkSdkCompatibility(baseUrl, {
20
26
  command: "plays run",
21
- persistCache: maintenancePolicy !== "off"
27
+ persistCache: maintenancePolicy !== "off",
28
+ signal
22
29
  })
23
30
  );
31
+ signal?.throwIfAborted();
24
32
  if (compatibility.error) throw compatibility.error;
25
33
  enforceSdkCompatibilityResponse(compatibility.response, {
26
34
  quietAdvisory: true
@@ -29,5 +37,6 @@ async function checkPlayRunCompatibility(baseUrl, maintenancePolicy = "configure
29
37
 
30
38
  export {
31
39
  usesInlinePlayAdmission,
40
+ usesCliPlayAdmission,
32
41
  checkPlayRunCompatibility
33
42
  };
@@ -3,15 +3,15 @@
3
3
  var _chunkVLEVVDWGjs = require('./chunk-VLEVVDWG.js');
4
4
 
5
5
 
6
- var _chunkFRD5WFT4js = require('./chunk-FRD5WFT4.js');
6
+ var _chunkQD22TY33js = require('./chunk-QD22TY33.js');
7
7
 
8
8
 
9
- var _chunkGVAENVIGjs = require('./chunk-GVAENVIG.js');
9
+ var _chunkAUQQVDABjs = require('./chunk-AUQQVDAB.js');
10
10
 
11
11
 
12
12
 
13
13
 
14
- var _chunkU7IJAGWBjs = require('./chunk-U7IJAGWB.js');
14
+ var _chunkBYEDI5PMjs = require('./chunk-BYEDI5PM.js');
15
15
 
16
16
 
17
17
  var _chunkDIAWYWT5js = require('./chunk-DIAWYWT5.js');
@@ -579,7 +579,7 @@ function parseInputFlagValue(raw) {
579
579
  return raw;
580
580
  }
581
581
  function parsePlayRunOptions(args, initialInput = null) {
582
- const selection = _chunkU7IJAGWBjs.parseJsonFields.call(void 0, args, "run");
582
+ const selection = _chunkBYEDI5PMjs.parseJsonFields.call(void 0, args, "run");
583
583
  args = selection.args;
584
584
  const usage = "Usage: deepline plays run <play-name> [--input '{...}'] [--run-id-file <path>] [--no-wait] [--tail-timeout-ms 30000] [--force] [--open] [--full] [--<input> value]\n deepline plays run <play-file.ts> [--input '{...}'] [--run-id-file <path>] [--no-wait] [--tail-timeout-ms 30000] [--force] [--open] [--full] [--<input> value]\n deepline plays run --file <play-file.ts> [--input '{...}'] [--profile <id>] [--run-id-file <path>] [--no-wait] [--tail-timeout-ms 30000] [--force] [--open] [--full] [--<input> value]\n deepline plays run --name <name> [--input '{...}'] [--profile <id>] [--live|--latest|--revision-id <id>] [--run-id-file <path>] [--no-wait] [--tail-timeout-ms 30000] [--force] [--open] [--json] [--full] [--<input> value]\n Runs use the Absurd CJS runtime.\n --header '<name>: <value>' may repeat; each is sent on every request for this run.\n Unknown --<input> value flags, such as --limit 5, are passed into play input.\nRun `deepline plays run --help` for idempotent call caching and deepline.dataset guidance.";
585
585
  let filePath = null;
@@ -591,7 +591,7 @@ function parsePlayRunOptions(args, initialInput = null) {
591
591
  let revisionSelector = null;
592
592
  const watch = !args.includes("--no-wait");
593
593
  const dryRun = args.includes("--dry-run");
594
- let jsonOutput = dryRun ? _chunkU7IJAGWBjs.argsWantJson.call(void 0, args) : watch ? args.includes("--json") : _chunkU7IJAGWBjs.argsWantJson.call(void 0, args);
594
+ let jsonOutput = dryRun ? _chunkBYEDI5PMjs.argsWantJson.call(void 0, args) : watch ? args.includes("--json") : _chunkBYEDI5PMjs.argsWantJson.call(void 0, args);
595
595
  const fullJson = args.includes("--full");
596
596
  const force = args.includes("--force");
597
597
  const forceToolRefresh = args.includes("--force-tool-refresh");
@@ -654,7 +654,7 @@ function parsePlayRunOptions(args, initialInput = null) {
654
654
  "--log-level requires one of: debug, info, warn, error."
655
655
  );
656
656
  }
657
- const parsed = _chunkFRD5WFT4js.parseLogLevel.call(void 0, value);
657
+ const parsed = _chunkQD22TY33js.parseLogLevel.call(void 0, value);
658
658
  if (!parsed) {
659
659
  throw new Error(
660
660
  `Unsupported --log-level ${JSON.stringify(value)}. Use debug, info, warn, or error.`
@@ -778,12 +778,12 @@ function parsePlayRunOptions(args, initialInput = null) {
778
778
  }
779
779
  if (arg === "--debug" && args[index + 1] && !args[index + 1].startsWith("--")) {
780
780
  input ??= {};
781
- _chunkGVAENVIGjs.setDottedInputValue.call(void 0, input, "debug", parseInputFlagValue(args[++index]));
781
+ _chunkAUQQVDABjs.setDottedInputValue.call(void 0, input, "debug", parseInputFlagValue(args[++index]));
782
782
  continue;
783
783
  }
784
784
  if (arg.startsWith("--debug=")) {
785
785
  input ??= {};
786
- _chunkGVAENVIGjs.setDottedInputValue.call(void 0,
786
+ _chunkAUQQVDABjs.setDottedInputValue.call(void 0,
787
787
  input,
788
788
  "debug",
789
789
  parseInputFlagValue(arg.slice("--debug=".length))
@@ -811,7 +811,7 @@ function parsePlayRunOptions(args, initialInput = null) {
811
811
  if (arg.startsWith("--")) {
812
812
  const { path, value } = parseInputFieldFlag(arg, args[index + 1]);
813
813
  input ??= {};
814
- _chunkGVAENVIGjs.setDottedInputValue.call(void 0, input, path, parseInputFlagValue(value));
814
+ _chunkAUQQVDABjs.setDottedInputValue.call(void 0, input, path, parseInputFlagValue(value));
815
815
  if (!arg.includes("=")) {
816
816
  index += 1;
817
817
  }
@@ -900,7 +900,7 @@ function resolvePlayRunCliOptions(target, options, inputArgs = [], maintenancePo
900
900
  let initialInput = options.input === void 0 ? null : parseJsonInput(options.input);
901
901
  if (typeof options.debug === "string") {
902
902
  initialInput ??= {};
903
- _chunkGVAENVIGjs.setDottedInputValue.call(void 0,
903
+ _chunkAUQQVDABjs.setDottedInputValue.call(void 0,
904
904
  initialInput,
905
905
  "debug",
906
906
  parseInputFlagValue(options.debug)
@@ -972,7 +972,7 @@ function resolvePlayRunCliOptions(target, options, inputArgs = [], maintenancePo
972
972
  const hasExplicitLogLevel = options.logLevel !== void 0 || inputArgs.some(
973
973
  (arg) => arg === "--log-level" || arg.startsWith("--log-level=")
974
974
  );
975
- let logLevel = options.logLevel === void 0 ? base.logLevel : _chunkFRD5WFT4js.parseLogLevel.call(void 0, options.logLevel);
975
+ let logLevel = options.logLevel === void 0 ? base.logLevel : _chunkQD22TY33js.parseLogLevel.call(void 0, options.logLevel);
976
976
  if (!logLevel)
977
977
  throw new Error("--log-level requires one of: debug, info, warn, error.");
978
978
  const debugAlias = options.logs || options.debug === true || inputArgs.some(
@@ -986,13 +986,13 @@ function resolvePlayRunCliOptions(target, options, inputArgs = [], maintenancePo
986
986
  if (debugAlias || debugMapLatency && logLevel === "info")
987
987
  logLevel = "debug";
988
988
  const fullJson = _nullishCoalesce(options.full, () => ( base.fullJson));
989
- const jsonFields = options.json === void 0 ? base.jsonFields : _chunkU7IJAGWBjs.parseJsonFields.call(void 0,
990
- [...fullJson ? ["--full"] : [], ..._chunkU7IJAGWBjs.jsonFieldArgs.call(void 0, options.json)],
989
+ const jsonFields = options.json === void 0 ? base.jsonFields : _chunkBYEDI5PMjs.parseJsonFields.call(void 0,
990
+ [...fullJson ? ["--full"] : [], ..._chunkBYEDI5PMjs.jsonFieldArgs.call(void 0, options.json)],
991
991
  "run"
992
992
  ).fields;
993
993
  const watch = options.wait === false ? false : base.watch;
994
994
  const explicitJson = options.json !== void 0 ? options.json !== false : base.jsonOutput;
995
- const jsonOutput = dryRun || !watch ? explicitJson || _chunkU7IJAGWBjs.argsWantJson.call(void 0, []) : explicitJson;
995
+ const jsonOutput = dryRun || !watch ? explicitJson || _chunkBYEDI5PMjs.argsWantJson.call(void 0, []) : explicitJson;
996
996
  const verboseLogs = Boolean(
997
997
  debugAlias || logLevel === "debug" || debugMapLatency
998
998
  );
@@ -1,6 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
2
2
 
3
- var _chunkU7IJAGWBjs = require('./chunk-U7IJAGWB.js');
3
+ var _chunkBYEDI5PMjs = require('./chunk-BYEDI5PM.js');
4
4
 
5
5
  // src/cli/maintenance-policy.ts
6
6
  var _commander = require('commander');
@@ -33,7 +33,7 @@ function recordCliTrace(event) {
33
33
  sinceStartMs: now - cliTraceStartedAt,
34
34
  ...event
35
35
  };
36
- _chunkU7IJAGWBjs.writeRawStderr.call(void 0, `[cli-trace] ${JSON.stringify(payload)}
36
+ _chunkBYEDI5PMjs.writeRawStderr.call(void 0, `[cli-trace] ${JSON.stringify(payload)}
37
37
  `);
38
38
  }
39
39
  async function traceCliSpan(phase, fields, run) {
@@ -5,8 +5,10 @@ import {
5
5
  providerMetaFromToolResponseRawV2
6
6
  } from "./chunk-L2VKAASU.mjs";
7
7
  import {
8
+ CLI_PLAY_RUN_CALLER_INTENT_V2_START_STREAM_PATH,
8
9
  CLI_PLAY_RUN_START_STREAM_PATH,
9
10
  CLI_PLAY_RUN_SUPPORTED_HEADER,
11
+ CliPlayAdmissionCallerIntentV2UnsupportedError,
10
12
  CliPlayAdmissionUnsupportedError,
11
13
  PLAY_RUN_START_STREAM_PATH,
12
14
  decodePlayRunPublicStatus,
@@ -16,8 +18,9 @@ import {
16
18
  preparePlayRunAdmission,
17
19
  readPlayRunAdmissionCapability,
18
20
  stagePlayFiles,
19
- startPlayRun
20
- } from "./chunk-HNRELVCS.mjs";
21
+ startPlayRun,
22
+ submitPreparedPlayRunAdmission
23
+ } from "./chunk-ONONSV2Q.mjs";
21
24
  import {
22
25
  describePlayDetail,
23
26
  describePlayListItem
@@ -28,7 +31,7 @@ import {
28
31
  RETAINED_PIPELINE_RECEIVERS_HEADER,
29
32
  RUNTIME_ENVIRONMENT_TOKEN_HEADER,
30
33
  SDK_API_MAJOR
31
- } from "./chunk-WYUCDLVR.mjs";
34
+ } from "./chunk-MJ56FCYU.mjs";
32
35
  import {
33
36
  CustomerDbQueryOutcomeUnknownError
34
37
  } from "./chunk-4QF2K7TM.mjs";
@@ -1114,7 +1117,8 @@ var PlayClient = class {
1114
1117
  }
1115
1118
  const query = params.size > 0 ? `?${params.toString()}` : "";
1116
1119
  const response = await this.http.get(
1117
- `/api/v2/runs/${encodeURIComponent(workflowId)}${query}`
1120
+ `/api/v2/runs/${encodeURIComponent(workflowId)}${query}`,
1121
+ options?.runStatus === true ? { headers: { "x-deepline-run-status": "1" } } : void 0
1118
1122
  );
1119
1123
  return normalizePlayStatus(response);
1120
1124
  }
@@ -1308,7 +1312,7 @@ function classifyLegacyLogLine(line) {
1308
1312
  if (/^\[perf\] runtime receipt\b/i.test(message)) {
1309
1313
  return "receipt";
1310
1314
  }
1311
- if (/^\[perf\]/i.test(message) || /^\[runtime\.(?:phase_summary|logs|log_transport)\]/i.test(message) || /\[worker\] picked up run\b/.test(message) || /\[worker\] heartbeat\b/.test(message) || /\[worker\] progress completedRows=\d+ totalRows=\d+ rowUpdates=\d+/.test(
1315
+ if (/^\[perf-trace\]/i.test(message) || /^\[perf\]/i.test(message) || /^\[runtime\.(?:phase_summary|logs|log_transport)\]/i.test(message) || /\[worker\] picked up run\b/.test(message) || /\[worker\] heartbeat\b/.test(message) || /\[worker\] progress completedRows=\d+ totalRows=\d+ rowUpdates=\d+/.test(
1312
1316
  message
1313
1317
  ) || /\[worker\] step started\b/.test(message) || /\[worker\] Preparing run files\b/.test(message) || /\[worker\] Run files ready\b/.test(message) || /\[worker\] Runtime ready\b/.test(message) || /\[worker\] Sandbox (?:starting|create start|create done|workspace ready|upload start|runner uploaded)\b/.test(
1314
1318
  message
@@ -2896,8 +2900,9 @@ function diffPlayRunStreamEvents(input) {
2896
2900
 
2897
2901
  // src/runs/watch-polling.ts
2898
2902
  var RUN_WATCH_POLL_INTERVAL_MS = 2e3;
2899
- var RUN_WATCH_STARTUP_POLL_INTERVAL_MS = 500;
2903
+ var RUN_WATCH_STARTUP_POLL_INTERVAL_MS = 300;
2900
2904
  var RUN_WATCH_STARTUP_WINDOW_MS = 6e3;
2905
+ var TERMINAL_LOG_PROJECTION_RETRY_LIMIT = 3;
2901
2906
  function waitForNextPoll(ms, signal) {
2902
2907
  if (signal?.aborted) {
2903
2908
  return Promise.resolve(false);
@@ -2990,6 +2995,7 @@ async function* watchRunEvents(options) {
2990
2995
  let consecutiveFailures = 0;
2991
2996
  let outageNoticeSent = false;
2992
2997
  let pollCount = 0;
2998
+ let terminalLogProjectionRetries = 0;
2993
2999
  while (!signal?.aborted) {
2994
3000
  const pollStartedAt = Date.now();
2995
3001
  const poll = ++pollCount;
@@ -3067,6 +3073,23 @@ async function* watchRunEvents(options) {
3067
3073
  outageNoticeSent = false;
3068
3074
  }
3069
3075
  consecutiveFailures = 0;
3076
+ const terminalLogsPending = isTerminalPlayRunLiveStatus(snapshot.status) && snapshot.logsUnavailable && !options.omitTerminalLogs;
3077
+ if (terminalLogsPending) {
3078
+ if (terminalLogProjectionRetries < TERMINAL_LOG_PROJECTION_RETRY_LIMIT) {
3079
+ terminalLogProjectionRetries += 1;
3080
+ const remaining2 = Math.max(
3081
+ 0,
3082
+ pollIntervalMs - (Date.now() - pollStartedAt)
3083
+ );
3084
+ if (!await waitForNextPoll(remaining2, signal)) return;
3085
+ continue;
3086
+ }
3087
+ options.onNotice?.(
3088
+ `[watch] terminal status is complete, but final logs are unavailable in this watch; fetch retained logs with deepline runs logs ${runId}`
3089
+ );
3090
+ } else {
3091
+ terminalLogProjectionRetries = 0;
3092
+ }
3070
3093
  if (terminalStatus) {
3071
3094
  await options.terminalStatus?.onStatus(terminalStatus, snapshot.status);
3072
3095
  }
@@ -3969,17 +3992,22 @@ var DeeplineClient = class _DeeplineClient {
3969
3992
  this.http,
3970
3993
  resolved.request,
3971
3994
  options?.onSubmission,
3972
- {
3973
- ...options && Object.hasOwn(options, "admissionCapability") ? { admissionCapability: options.admissionCapability } : {}
3974
- }
3995
+ options
3975
3996
  );
3976
3997
  const bodyJson = JSON.stringify(prepared.body);
3977
- const headers = runtimeSelectionHeaders(resolved.runtime, this.environment);
3998
+ const runtimeHeaders = runtimeSelectionHeaders(
3999
+ resolved.runtime,
4000
+ this.environment
4001
+ );
4002
+ const headers = options?.cliAdmission ? {
4003
+ ...runtimeHeaders,
4004
+ "X-Deepline-API-Major": String(SDK_API_MAJOR)
4005
+ } : runtimeHeaders;
3978
4006
  const http = this.http;
3979
4007
  let submitted = false;
3980
4008
  return {
3981
4009
  ...prepared,
3982
- async *startStream(streamOptions) {
4010
+ async start(startOptions) {
3983
4011
  if (submitted && !prepared.supportsCallerIntent) {
3984
4012
  throw new DeeplineError(
3985
4013
  "This server has not enabled caller-owned admission recovery. Do not retry an ambiguous start.",
@@ -3988,15 +4016,56 @@ var DeeplineClient = class _DeeplineClient {
3988
4016
  );
3989
4017
  }
3990
4018
  if (submitted) {
3991
- await preparePlayRunAdmission(
4019
+ if (!options?.callerIntentV2) {
4020
+ await preparePlayRunAdmission(
4021
+ http,
4022
+ JSON.parse(bodyJson),
4023
+ void 0,
4024
+ { signal: startOptions?.signal ?? options?.signal }
4025
+ );
4026
+ }
4027
+ }
4028
+ submitted = true;
4029
+ try {
4030
+ return await submitPreparedPlayRunAdmission(
3992
4031
  http,
3993
4032
  JSON.parse(bodyJson),
3994
- void 0,
3995
- { signal: streamOptions?.signal }
4033
+ prepared.workflowId,
4034
+ prepared.supportsCallerIntent,
4035
+ headers,
4036
+ {
4037
+ cliAdmission: startOptions?.cliAdmission ?? options?.cliAdmission,
4038
+ callerIntentV2: options?.callerIntentV2,
4039
+ signal: startOptions?.signal ?? options?.signal
4040
+ }
4041
+ );
4042
+ } catch (error) {
4043
+ if (error instanceof CliPlayAdmissionUnsupportedError || error instanceof CliPlayAdmissionCallerIntentV2UnsupportedError) {
4044
+ submitted = false;
4045
+ }
4046
+ throw error;
4047
+ }
4048
+ },
4049
+ async *startStream(streamOptions) {
4050
+ if (submitted && !prepared.supportsCallerIntent) {
4051
+ throw new DeeplineError(
4052
+ "This server has not enabled caller-owned admission recovery. Do not retry an ambiguous start.",
4053
+ 409,
4054
+ "PLAY_RUN_ADMISSION_RECOVERY_UNSUPPORTED"
3996
4055
  );
3997
4056
  }
4057
+ if (submitted) {
4058
+ if (!options?.callerIntentV2) {
4059
+ await preparePlayRunAdmission(
4060
+ http,
4061
+ JSON.parse(bodyJson),
4062
+ void 0,
4063
+ { signal: streamOptions?.signal }
4064
+ );
4065
+ }
4066
+ }
3998
4067
  submitted = true;
3999
- const streamPath = options?.cliAdmission ? CLI_PLAY_RUN_START_STREAM_PATH : PLAY_RUN_START_STREAM_PATH;
4068
+ const streamPath = options?.callerIntentV2 ? CLI_PLAY_RUN_CALLER_INTENT_V2_START_STREAM_PATH : options?.cliAdmission ? CLI_PLAY_RUN_START_STREAM_PATH : PLAY_RUN_START_STREAM_PATH;
4000
4069
  let cliAdmissionSupported = false;
4001
4070
  try {
4002
4071
  for await (const event of http.streamSse(streamPath, {
@@ -4015,6 +4084,13 @@ var DeeplineClient = class _DeeplineClient {
4015
4084
  }
4016
4085
  } catch (error) {
4017
4086
  if (options?.cliAdmission && !cliAdmissionSupported && error instanceof DeeplineError && (error.statusCode === 404 || error.statusCode === 405)) {
4087
+ if (options.callerIntentV2) {
4088
+ submitted = false;
4089
+ throw new CliPlayAdmissionCallerIntentV2UnsupportedError(
4090
+ error.statusCode
4091
+ );
4092
+ }
4093
+ submitted = false;
4018
4094
  throw new CliPlayAdmissionUnsupportedError(error.statusCode);
4019
4095
  }
4020
4096
  throw error;
@@ -4027,8 +4103,8 @@ var DeeplineClient = class _DeeplineClient {
4027
4103
  * preparation so the network round trip can overlap with compilation.
4028
4104
  * @internal
4029
4105
  */
4030
- async prefetchPlayRunAdmissionCapability() {
4031
- return readPlayRunAdmissionCapability(this.http);
4106
+ async prefetchPlayRunAdmissionCapability(options) {
4107
+ return readPlayRunAdmissionCapability(this.http, options);
4032
4108
  }
4033
4109
  /**
4034
4110
  * Submit a play run through the legacy event response.
@@ -2,10 +2,10 @@ import {
2
2
  HttpClient,
3
3
  resolveCliCommandContext,
4
4
  resolveConfig
5
- } from "./chunk-TRLDJNVE.mjs";
5
+ } from "./chunk-T3Q6BMVH.mjs";
6
6
  import {
7
7
  detectAgentRuntime
8
- } from "./chunk-WYUCDLVR.mjs";
8
+ } from "./chunk-MJ56FCYU.mjs";
9
9
  import {
10
10
  DeeplineError,
11
11
  serializeToolExecutionFailure