deepline 0.3.502 → 0.3.503

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 (204) hide show
  1. package/dist/bundling-sources/sdk/src/client-core.ts +26 -0
  2. package/dist/bundling-sources/sdk/src/index.ts +1 -0
  3. package/dist/bundling-sources/sdk/src/release.ts +1 -1
  4. package/dist/bundling-sources/sdk/src/types.ts +9 -0
  5. package/dist/bundling-sources/shared_libs/monitors/starter-templates.ts +0 -8
  6. package/dist/bundling-sources/shared_libs/observability/dlq.ts +174 -0
  7. package/dist/bundling-sources/shared_libs/observability/queue-health.ts +9 -0
  8. package/dist/bundling-sources/shared_libs/observability/queue-item-connectors.ts +1 -0
  9. package/dist/bundling-sources/shared_libs/observability/scheduled-jobs.json +18 -0
  10. package/dist/bundling-sources/shared_libs/play-runtime/activity-observation.ts +20 -0
  11. package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +62 -2
  12. package/dist/bundling-sources/shared_libs/play-runtime/context.ts +667 -62
  13. package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +55 -0
  14. package/dist/bundling-sources/shared_libs/play-runtime/durable-receipt-execution.ts +20 -2
  15. package/dist/bundling-sources/shared_libs/play-runtime/durable-runs-rollout.ts +46 -0
  16. package/dist/bundling-sources/shared_libs/play-runtime/execution-gateway-invocation-fence.ts +80 -4
  17. package/dist/bundling-sources/shared_libs/play-runtime/fixture-egress-fetch.ts +95 -0
  18. package/dist/bundling-sources/shared_libs/play-runtime/freshness-receipt-execution.ts +292 -45
  19. package/dist/bundling-sources/shared_libs/play-runtime/internal-bootstrap-token.ts +15 -0
  20. package/dist/bundling-sources/shared_libs/play-runtime/launch-identity.ts +3 -0
  21. package/dist/bundling-sources/shared_libs/play-runtime/play-http-request.ts +7 -3
  22. package/dist/bundling-sources/shared_libs/play-runtime/play-runtime-semantics.ts +31 -1
  23. package/dist/bundling-sources/shared_libs/play-runtime/post-code-recovery-policy.ts +231 -0
  24. package/dist/bundling-sources/shared_libs/play-runtime/protocol.ts +4 -0
  25. package/dist/bundling-sources/shared_libs/play-runtime/run-ending-event.ts +55 -0
  26. package/dist/bundling-sources/shared_libs/play-runtime/run-ledger.ts +126 -0
  27. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/index.ts +38 -1
  28. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-launch-transport.ts +2 -9
  29. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-lifecycle.ts +51 -19
  30. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/local-process.ts +9 -4
  31. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/modal.ts +2 -0
  32. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/runtime-sandbox-reconciliation.ts +2 -0
  33. package/dist/bundling-sources/shared_libs/play-runtime/runtime-actions.ts +12 -1
  34. package/dist/bundling-sources/shared_libs/play-runtime/runtime-authority.ts +3 -0
  35. package/dist/bundling-sources/shared_libs/play-runtime/runtime-incident-drills.ts +42 -0
  36. package/dist/bundling-sources/shared_libs/play-runtime/runtime-operation-contract.ts +7 -0
  37. package/dist/bundling-sources/shared_libs/play-runtime/runtime-receipt-store-adapter.ts +26 -1
  38. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backend.ts +13 -0
  39. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-deadline-reconciliation.ts +53 -0
  40. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +631 -19
  41. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/durable-run-inventory.ts +719 -0
  42. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/durable-run-sql.ts +206 -0
  43. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/latest-cache-result.ts +83 -0
  44. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +1432 -157
  45. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/receipt-gateway.ts +61 -0
  46. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-event-search.ts +29 -8
  47. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-queue-health.ts +27 -2
  48. package/dist/bundling-sources/shared_libs/play-runtime/test-runtime-seams.ts +45 -0
  49. package/dist/bundling-sources/shared_libs/play-runtime/tool-cache-policy.ts +18 -0
  50. package/dist/bundling-sources/shared_libs/play-runtime/tool-execute-retry-policy.ts +129 -14
  51. package/dist/bundling-sources/shared_libs/play-runtime/workflow-executor-auth.ts +2 -0
  52. package/dist/bundling-sources/shared_libs/plays/authoring-contract.ts +10 -1
  53. package/dist/cli/{auth-EFHLOVG4.mjs → auth-IC4WLSE3.mjs} +5 -5
  54. package/dist/cli/auth-ZCMSXZO4.js +43 -0
  55. package/dist/cli/{billing-Q5XKEYPP.mjs → billing-2VOV64SD.mjs} +6 -6
  56. package/dist/cli/{billing-SKT2VE34.js → billing-LWQOII22.js} +79 -79
  57. package/dist/cli/{chunk-TAK3MVXY.js → chunk-2626LTU3.js} +284 -267
  58. package/dist/cli/{chunk-OEUMXKR5.js → chunk-26RSSTCF.js} +26 -26
  59. package/dist/cli/{chunk-JFBJLNBI.js → chunk-2K2QBLYO.js} +53 -53
  60. package/dist/cli/{chunk-32YQBJON.js → chunk-33JUK73X.js} +7 -7
  61. package/dist/cli/{chunk-X5MGQ7UT.js → chunk-3CXHK4TW.js} +10 -10
  62. package/dist/cli/{chunk-YPTZJ7LO.js → chunk-4IIYSBEP.js} +70 -13
  63. package/dist/cli/{chunk-HIVRCTDR.mjs → chunk-5GI6NKOE.mjs} +20 -1
  64. package/dist/cli/{chunk-TFFJ2PRN.mjs → chunk-5M5WSFRZ.mjs} +70 -13
  65. package/dist/cli/{chunk-4CCMD7QM.mjs → chunk-6XTE6C3W.mjs} +32 -15
  66. package/dist/cli/{chunk-OFBLT2LQ.mjs → chunk-7HEDCIR3.mjs} +1 -1
  67. package/dist/cli/{chunk-DRBD4IYQ.mjs → chunk-7MJYZ33I.mjs} +2 -6
  68. package/dist/cli/{chunk-JL6H4H3G.js → chunk-A2C6ONWA.js} +6 -6
  69. package/dist/cli/{chunk-DKAMCJIT.js → chunk-AARF4SOW.js} +17 -13
  70. package/dist/cli/{chunk-QNELA7SX.js → chunk-B3X4YWQ6.js} +53 -53
  71. package/dist/cli/{chunk-NZXB27TP.mjs → chunk-BI2Q45SY.mjs} +4 -4
  72. package/dist/cli/{chunk-FVM4PS5Q.js → chunk-BN5VKY4X.js} +25 -12
  73. package/dist/cli/{chunk-UOANF3DR.js → chunk-C5RQTTLP.js} +26 -7
  74. package/dist/cli/{chunk-YWOQYYYS.mjs → chunk-D27HP3HS.mjs} +2 -2
  75. package/dist/cli/{chunk-NXVYLX3F.mjs → chunk-DPI5OYVU.mjs} +10 -6
  76. package/dist/cli/{chunk-R5F7JXT4.mjs → chunk-EDMV4JT5.mjs} +2 -2
  77. package/dist/cli/{chunk-MYUISF3P.mjs → chunk-EQ3WMKFY.mjs} +5 -5
  78. package/dist/cli/{chunk-YDXEXVBV.js → chunk-F73PD2XD.js} +7 -7
  79. package/dist/cli/{chunk-L5CTJY74.mjs → chunk-FHJ54BHH.mjs} +2 -2
  80. package/dist/cli/{chunk-EUWRKWT4.js → chunk-FIUTDSJX.js} +5 -4
  81. package/dist/cli/{chunk-WKFAX2K7.js → chunk-FVDTERO2.js} +21 -21
  82. package/dist/cli/{chunk-Q3NM6ZL3.js → chunk-FZHOWPSN.js} +23 -21
  83. package/dist/cli/{chunk-NKLM4J4X.mjs → chunk-GIHNEYBG.mjs} +1 -1
  84. package/dist/cli/{chunk-7ZYSXSJJ.mjs → chunk-GLZBFBJS.mjs} +5 -5
  85. package/dist/cli/{chunk-DYHTXGLX.js → chunk-HRTDCXHI.js} +2 -2
  86. package/dist/cli/{chunk-JLYDLK6X.js → chunk-HS63YBT5.js} +3 -3
  87. package/dist/cli/{chunk-LA3UYRVZ.js → chunk-IIP46RVC.js} +1 -1
  88. package/dist/cli/{chunk-SAW3FBCA.mjs → chunk-ITJ7NB2D.mjs} +6 -0
  89. package/dist/cli/{chunk-54QXWK3C.mjs → chunk-J6RBOLK7.mjs} +1 -1
  90. package/dist/cli/{chunk-YL2CCF6T.mjs → chunk-JJVN7OIX.mjs} +4 -4
  91. package/dist/cli/{chunk-4WTC5SSN.mjs → chunk-JPDD4Y53.mjs} +10 -8
  92. package/dist/cli/{chunk-HMZF2CSP.mjs → chunk-K7NFFQFU.mjs} +2 -2
  93. package/dist/cli/{chunk-2MVIS2UI.mjs → chunk-KGLVATEB.mjs} +2 -2
  94. package/dist/cli/{chunk-3MJSWVQ2.mjs → chunk-KPBBT6OS.mjs} +2 -1
  95. package/dist/cli/{chunk-W5CHE5Q2.mjs → chunk-L3TZV625.mjs} +1 -1
  96. package/dist/cli/{chunk-GINKIZ7S.js → chunk-MJQOG4TZ.js} +16 -16
  97. package/dist/cli/{chunk-JO5FFSR7.js → chunk-NTLBZUHD.js} +6 -0
  98. package/dist/cli/{chunk-QOJBRCAS.js → chunk-PVA3MWCO.js} +3 -3
  99. package/dist/cli/{chunk-OVZOMSH2.js → chunk-QIEYEY6Z.js} +8 -8
  100. package/dist/cli/{chunk-JFUXUSKB.mjs → chunk-R2VZVHJP.mjs} +15 -2
  101. package/dist/cli/{chunk-2S2F6YSI.js → chunk-RVOBFO7C.js} +41 -41
  102. package/dist/cli/{chunk-XMKUJ44Z.js → chunk-TCQYWZFS.js} +5 -5
  103. package/dist/cli/{chunk-FWDAEWCD.js → chunk-TMQUMILM.js} +19 -23
  104. package/dist/cli/{chunk-3KEZVGGV.mjs → chunk-URZNSJE2.mjs} +4 -4
  105. package/dist/cli/{chunk-MP5QY4A2.mjs → chunk-VC5B462T.mjs} +2 -2
  106. package/dist/cli/{chunk-IL666WJE.js → chunk-WHP3FJ7T.js} +5 -5
  107. package/dist/cli/{chunk-ZNB6GR3P.mjs → chunk-WS274KID.mjs} +1 -1
  108. package/dist/cli/{chunk-Z2H7OQ6E.mjs → chunk-XYZZZLN6.mjs} +2 -2
  109. package/dist/cli/{chunk-AJL2Q6IQ.js → chunk-YXGPMTAK.js} +2 -2
  110. package/dist/cli/{chunk-2JS3H6H6.mjs → chunk-ZEQPCEV4.mjs} +3 -3
  111. package/dist/cli/command-docs.js +2 -2
  112. package/dist/cli/command-docs.mjs +1 -1
  113. package/dist/cli/{csv-6AEPKKCO.mjs → csv-2TXOI3UE.mjs} +4 -4
  114. package/dist/cli/{csv-OXGSCV75.js → csv-NEWCNOSZ.js} +13 -13
  115. package/dist/cli/{db-6NVHDUZY.js → db-J3IJS4OG.js} +27 -27
  116. package/dist/cli/{db-K3KRK4CZ.mjs → db-PX7EQEIG.mjs} +6 -6
  117. package/dist/cli/{describe-P3ZJS7TQ.mjs → describe-GQHGTZSL.mjs} +20 -20
  118. package/dist/cli/describe-LE7EZCL4.js +49 -0
  119. package/dist/cli/describe-core.d.mts +8 -4
  120. package/dist/cli/describe-core.d.ts +8 -4
  121. package/dist/cli/describe-core.js +4 -4
  122. package/dist/cli/describe-core.mjs +3 -3
  123. package/dist/cli/{executions-I7XW6WWK.mjs → executions-FFKK24RY.mjs} +6 -6
  124. package/dist/cli/{executions-2C2FFG52.js → executions-RO3TJUXL.js} +8 -8
  125. package/dist/cli/{feedback-47B57A5Y.js → feedback-XRR4HIS6.js} +8 -8
  126. package/dist/cli/{feedback-RSTNBJAI.mjs → feedback-ZTO56SRL.mjs} +4 -4
  127. package/dist/cli/git-26AH4XIO.js +25 -0
  128. package/dist/cli/{git-3G5AFKBT.mjs → git-FIPBVFYZ.mjs} +5 -5
  129. package/dist/cli/index.js +142 -142
  130. package/dist/cli/index.mjs +42 -42
  131. package/dist/cli/{legacy-noops-NQ262TKL.mjs → legacy-noops-AMD2NWHF.mjs} +5 -5
  132. package/dist/cli/{legacy-noops-P665PBG4.js → legacy-noops-MTBBGM27.js} +8 -8
  133. package/dist/cli/{monitors-KUPZODZS.mjs → monitors-24LDKDJX.mjs} +7 -7
  134. package/dist/cli/{monitors-IPWAD7LS.js → monitors-42PIGLBF.js} +95 -95
  135. package/dist/cli/{org-ZCQGEM3L.mjs → org-4B7SCFRL.mjs} +6 -6
  136. package/dist/cli/{org-WFC3N672.js → org-GQMCA3MN.js} +72 -72
  137. package/dist/cli/{pages-VE66IU7B.mjs → pages-PD5EGL2R.mjs} +6 -6
  138. package/dist/cli/{pages-N5BNC67L.js → pages-RL2M62GJ.js} +18 -18
  139. package/dist/cli/{play-EIMDIAJB.mjs → play-5V54VTUR.mjs} +132 -26
  140. package/dist/cli/{play-NKIRJSKX.js → play-FST6ZAHW.js} +447 -341
  141. package/dist/cli/{providers-XU3AGY2F.js → providers-HBUUPN7J.js} +9 -9
  142. package/dist/cli/{providers-KDTJ63ED.mjs → providers-N5YVCKPL.mjs} +6 -6
  143. package/dist/cli/{quickstart-OSCHOSXU.js → quickstart-4QIQNSHG.js} +6 -6
  144. package/dist/cli/{quickstart-TXFXUODF.mjs → quickstart-NJDDVTQR.mjs} +4 -4
  145. package/dist/cli/{run-ET2KVTPK.js → run-FGOKCG4J.js} +44 -44
  146. package/dist/cli/{run-ODGML35U.mjs → run-JHI5MTHD.mjs} +25 -25
  147. package/dist/cli/search-CTKSEVSO.js +32 -0
  148. package/dist/cli/{search-DK67K6PR.mjs → search-EWIZBIY2.mjs} +7 -7
  149. package/dist/cli/{search-output-6SOKQTCW.mjs → search-output-NAK3MWBH.mjs} +5 -5
  150. package/dist/cli/{search-output-KXP4FA62.js → search-output-TMQTRC2W.js} +7 -7
  151. package/dist/cli/{secrets-WPS6NMNK.js → secrets-5TSUEOJB.js} +15 -15
  152. package/dist/cli/{secrets-C6SYTMU7.mjs → secrets-ONQVW5SR.mjs} +6 -6
  153. package/dist/cli/{sessions-PXVOH34X.mjs → sessions-B7F5O3ZR.mjs} +5 -5
  154. package/dist/cli/{sessions-IP562J5Z.js → sessions-BSGE5EET.js} +6 -6
  155. package/dist/cli/{settings-SUDUIVMY.js → settings-47LARBRU.js} +78 -78
  156. package/dist/cli/{settings-FBUQGYVJ.mjs → settings-SGGFQV5R.mjs} +11 -11
  157. package/dist/cli/{setup-JSIMTR73.mjs → setup-ATGNXQUK.mjs} +9 -9
  158. package/dist/cli/{setup-I5H6IOEY.js → setup-BNFZFXO6.js} +49 -49
  159. package/dist/cli/skills-6RD25MVM.js +36 -0
  160. package/dist/cli/{skills-FJQ3LX6N.mjs → skills-CIMBRM5R.mjs} +7 -7
  161. package/dist/cli/{tools-IGBK4BVE.mjs → tools-DTDXAULX.mjs} +18 -18
  162. package/dist/cli/tools-TDZH4XHS.js +56 -0
  163. package/dist/cli/{update-7MTT6F5K.mjs → update-EOIJBJCO.mjs} +9 -9
  164. package/dist/cli/update-Y32VT4VL.js +34 -0
  165. package/dist/cli/{workflow-PM2J2OU3.mjs → workflow-IWXUJPWY.mjs} +7 -7
  166. package/dist/cli/{workflow-UX3ZX6BQ.js → workflow-V5VKPICQ.js} +17 -17
  167. package/dist/{client-Bn8FwKGO.d.ts → client-CIwenMFS.d.ts} +1 -1
  168. package/dist/{client-CfNRmjLK.d.mts → client-DYAfJpaN.d.mts} +1 -1
  169. package/dist/{client-core-B91EV0WS.d.ts → client-core-CRjtyMAI.d.ts} +25 -2
  170. package/dist/{client-core-BG8Cgrmk.d.mts → client-core-DlzP8vEs.d.mts} +25 -2
  171. package/dist/{compiler-manifest-DlXDyndN.d.mts → compiler-manifest-DaJrA2KV.d.mts} +1 -1
  172. package/dist/{compiler-manifest-DlXDyndN.d.ts → compiler-manifest-DaJrA2KV.d.ts} +1 -1
  173. package/dist/{errors-BtriA2ld.d.mts → errors-BKnSYueU.d.mts} +1 -1
  174. package/dist/{errors-DmcLykM7.d.ts → errors-KLga4bLr.d.ts} +1 -1
  175. package/dist/{index-DI0sR_fX.d.mts → index-C-8AFpWy.d.mts} +1 -1
  176. package/dist/{index--Jw-slHY.d.ts → index-C5nAZ-VS.d.ts} +1 -1
  177. package/dist/index.d.mts +7 -7
  178. package/dist/index.d.ts +7 -7
  179. package/dist/index.js +9 -9
  180. package/dist/index.mjs +6 -6
  181. package/dist/install-integrity.json +123 -116
  182. package/dist/plays/bundle-play-file.d.mts +3 -3
  183. package/dist/plays/bundle-play-file.d.ts +3 -3
  184. package/dist/plays/bundle-play-file.mjs +8 -1
  185. package/dist/plays/play-description.d.mts +2 -2
  186. package/dist/plays/play-description.d.ts +2 -2
  187. package/dist/plays/run-request.d.mts +2 -2
  188. package/dist/plays/run-request.d.ts +2 -2
  189. package/dist/release.d.mts +1 -1
  190. package/dist/release.d.ts +1 -1
  191. package/dist/release.js +2 -2
  192. package/dist/release.mjs +1 -1
  193. package/dist/server.d.mts +4 -4
  194. package/dist/server.d.ts +4 -4
  195. package/dist/server.js +5 -5
  196. package/dist/server.mjs +3 -3
  197. package/package.json +1 -1
  198. package/dist/cli/auth-VM3IKP5F.js +0 -43
  199. package/dist/cli/describe-JOUAXXPE.js +0 -49
  200. package/dist/cli/git-OPKIC6JQ.js +0 -25
  201. package/dist/cli/search-6U54Y3OK.js +0 -32
  202. package/dist/cli/skills-VHININXC.js +0 -36
  203. package/dist/cli/tools-XMBMHVKF.js +0 -56
  204. package/dist/cli/update-H7JVW43I.js +0 -34
@@ -143,6 +143,7 @@ import type {
143
143
  StopAllPlayRunsStopResult,
144
144
  RerunOptions,
145
145
  RerunPlayRunResult,
146
+ ResumePlayRunResult,
146
147
  ClearPlayHistoryRequest,
147
148
  ClearPlayHistoryResult,
148
149
  PublishPlayVersionRequest,
@@ -1042,6 +1043,8 @@ export type RunsNamespace = {
1042
1043
  }>;
1043
1044
  /** Start a fresh run from a prior run's retained input and pinned revision. */
1044
1045
  rerun: (runId: string, options?: RerunOptions) => Promise<RerunPlayRunResult>;
1046
+ /** Continue a failed or cancelled run as the same run, reusing its completed work. */
1047
+ resume: (runId: string) => Promise<ResumePlayRunResult>;
1045
1048
  /** List runs for one play, optionally filtered by status. */
1046
1049
  list: (options: RunsListOptions) => Promise<PlayRunListItem[]>;
1047
1050
  /** Read one run page with total, offset, limit and completeness metadata. */
@@ -2972,6 +2975,7 @@ export class DeeplineClient {
2972
2975
  searchEvents: (options) => this.searchRunEvents(options),
2973
2976
  input: (runId) => this.getRunInput(runId),
2974
2977
  rerun: (runId, options) => this.rerun(runId, options),
2978
+ resume: (runId) => this.resumeRun(runId),
2975
2979
  exportDatasetRows: (input) => this.getPlaySheetRows(input),
2976
2980
  rowHistory: (input) => this.getPlayRunRowHistory(input),
2977
2981
  stop: (runId, options) => this.stopRun(runId, options),
@@ -4976,6 +4980,20 @@ export class DeeplineClient {
4976
4980
  );
4977
4981
  }
4978
4982
 
4983
+ /**
4984
+ * Continue a failed or cancelled run as the same run. Completed calls are
4985
+ * reused; only work the run had not finished runs. A run can be resumed for
4986
+ * 14 days after it stops. Refusals (still active, last attempt still
4987
+ * finishing, sandbox cleanup pending, window expired) throw a
4988
+ * {@link DeeplineError} with the server's code.
4989
+ */
4990
+ async resumeRun(runId: string): Promise<ResumePlayRunResult> {
4991
+ return this.http.post<ResumePlayRunResult>(
4992
+ `/api/v2/runs/${encodeURIComponent(runId)}/resume`,
4993
+ {},
4994
+ );
4995
+ }
4996
+
4979
4997
  /**
4980
4998
  * Read a run's retained text tail (default 200), full retained stream (`all`), or terminal failure window (`failed`, at most 20). These are existing reads; sampling and retention loss cannot be recovered. See [run logs and events](run-events.md) for structured search and payload retrieval.
4981
4999
  *
@@ -5609,6 +5627,14 @@ export class DeeplineClient {
5609
5627
  return this.http.get('/api/v2/settings/notifications');
5610
5628
  }
5611
5629
 
5630
+ /** Get the dashboard link where a workspace owner or admin can connect a provider. */
5631
+ async getIntegrationConnectLink(
5632
+ provider: string,
5633
+ ): Promise<{ provider: string; connect_url: string }> {
5634
+ const params = new URLSearchParams({ provider });
5635
+ return this.http.get(`/api/v2/integrations/connect?${params}`);
5636
+ }
5637
+
5612
5638
  /** Save provider-owned credential fields without starting an OAuth browser flow. */
5613
5639
  async setIntegrationCredentials(
5614
5640
  provider: string,
@@ -351,6 +351,7 @@ export type {
351
351
  DeeplineToolCategory,
352
352
  RerunOptions,
353
353
  RerunPlayRunResult,
354
+ ResumePlayRunResult,
354
355
  StopAllCandidate,
355
356
  StopAllPlayRunsDryRunResult,
356
357
  StopAllPlayRunsResult,
@@ -205,7 +205,7 @@ export const SDK_RELEASE = {
205
205
  // getters keep their established compatibility behavior.
206
206
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
207
207
  // 0.3.90 is the first deliberately versioned SDK release for API v3.
208
- version: '0.3.502',
208
+ version: '0.3.503',
209
209
  updateSummary: {
210
210
  introducedIn: '0.3.90',
211
211
  summary:
@@ -1303,6 +1303,15 @@ export interface RerunPlayRunResult {
1303
1303
  next: { inspect: string; input: string };
1304
1304
  }
1305
1305
 
1306
+ /** Result of {@link DeeplineClient.resumeRun} / `runs.resume`. */
1307
+ export interface ResumePlayRunResult {
1308
+ /** The same run id: a resume continues the run in place. */
1309
+ runId: string;
1310
+ resumed: true;
1311
+ /** How many times this run has been resumed, including this one. */
1312
+ epoch: number;
1313
+ }
1314
+
1306
1315
  /** One active run that a workspace stop-all would target. */
1307
1316
  export interface StopAllCandidate {
1308
1317
  /** Public play-run id. */
@@ -48,12 +48,4 @@ export const MONITOR_STARTER_TEMPLATES: MonitorStarterTemplate[] = [
48
48
  prompt:
49
49
  '/deepline-gtm Monitor my target accounts for news like launches, expansions, and leadership changes.',
50
50
  },
51
- {
52
- id: 'website-visitor-intent',
53
- title: 'Website visitor intent',
54
- description:
55
- 'Find target accounts showing buying intent through visits to your website.',
56
- prompt:
57
- '/deepline-gtm Monitor my target accounts for high-intent visits to my website.',
58
- },
59
51
  ];
@@ -301,6 +301,164 @@ export type QueueItemMonitorEvent = {
301
301
  readonly lastRedriveStatus: string | null;
302
302
  };
303
303
 
304
+ /**
305
+ * Why `runs resume` would refuse a stopped run, exactly as the resume API
306
+ * reports it. `run_not_resumable`: a child run, which continues only with its
307
+ * parent. `resume_unavailable`: the `runsResume` switch is off here.
308
+ */
309
+ export const DURABLE_RUN_RESUME_REFUSALS = [
310
+ 'run_not_stopped',
311
+ 'attempt_not_settled',
312
+ 'sandbox_cleanup_pending',
313
+ 'resume_window_expired',
314
+ 'not_replay_safe',
315
+ 'play_revision_changed',
316
+ 'staged_input_retired',
317
+ 'run_not_resumable',
318
+ 'resume_unavailable',
319
+ ] as const;
320
+ export type DurableRunResumeRefusal =
321
+ (typeof DURABLE_RUN_RESUME_REFUSALS)[number];
322
+
323
+ /** Refusals that clear by themselves once the run's ending settles. */
324
+ export const DURABLE_RUN_TRANSIENT_RESUME_REFUSALS: readonly DurableRunResumeRefusal[] =
325
+ ['attempt_not_settled', 'sandbox_cleanup_pending'];
326
+
327
+ export type DurableRunNextActionKind =
328
+ /** Continue the stopped run in place (admin queue action `resume`). */
329
+ | 'resume'
330
+ /** Stop an in-flight run (admin queue action `cancel`). */
331
+ | 'cancel'
332
+ /** Bring a deferred recovery retry forward. Never available: see reason. */
333
+ | 'wake_now'
334
+ /** Start a new run from this one's input; runs as a workspace member. */
335
+ | 'rerun_from_run'
336
+ /** Nothing to do yet: the owner is still settling or retrying. */
337
+ | 'wait';
338
+
339
+ /**
340
+ * Why a stopped durable run stopped. `play_error`: the Play's own error (the
341
+ * customer's). `platform_recovery_exhausted`: Deepline's automatic recovery
342
+ * ran out (resume it). `platform_failure`: another platform failure the
343
+ * runtime recognizes. `cancelled`: cancelled (code names a platform cancel).
344
+ * `unknown`: no stored terminal error.
345
+ */
346
+ export const DURABLE_RUN_FAILURE_CLASSES = [
347
+ 'play_error',
348
+ 'platform_recovery_exhausted',
349
+ 'platform_failure',
350
+ 'cancelled',
351
+ 'unknown',
352
+ ] as const;
353
+ export type DurableRunFailureClass =
354
+ (typeof DURABLE_RUN_FAILURE_CLASSES)[number];
355
+
356
+ /** `failureCause` list filter of the `durable-play-runs` quarantined listing. */
357
+ export const DURABLE_RUN_FAILURE_CAUSE_FILTERS = ['platform', 'play'] as const;
358
+ export type DurableRunFailureCauseFilter =
359
+ (typeof DURABLE_RUN_FAILURE_CAUSE_FILTERS)[number];
360
+
361
+ export function isDurableRunFailureCauseFilter(
362
+ value: unknown,
363
+ ): value is DurableRunFailureCauseFilter {
364
+ return (
365
+ typeof value === 'string' &&
366
+ (DURABLE_RUN_FAILURE_CAUSE_FILTERS as readonly string[]).includes(value)
367
+ );
368
+ }
369
+
370
+ /**
371
+ * Fixed-size, admin-only summary of one durable Play run. Never carries the
372
+ * run's input, output, logs, sandbox identity or provider circuits. Safe for a
373
+ * dashboard: its size never grows with the run's rows, calls or attempts.
374
+ */
375
+ export type QueueItemDurableRun = {
376
+ readonly version: 1;
377
+ readonly runId: string;
378
+ readonly orgId: string;
379
+ readonly playName: string;
380
+ /** Scheduler status: queued, running, waiting, failed, cancelled, completed. */
381
+ readonly status: string;
382
+ /** queued, running, waiting, recovering, failed, cancelled or completed. */
383
+ readonly phase: string;
384
+ readonly createdAt: string | null;
385
+ readonly startedAt: string | null;
386
+ readonly finishedAt: string | null;
387
+ readonly updatedAt: string | null;
388
+ readonly resumeEpoch: number;
389
+ readonly attemptsThisEpoch: number;
390
+ readonly latestAttempt: {
391
+ readonly attempt: number;
392
+ readonly status: string;
393
+ readonly heartbeatAt: string | null;
394
+ readonly leaseExpiresAt: string | null;
395
+ readonly errorKind: string | null;
396
+ } | null;
397
+ /** Admin-only release lane the run is pinned to. */
398
+ readonly releaseId: string | null;
399
+ readonly parentRunId: string | null;
400
+ readonly recovery: {
401
+ readonly kind: 'post_code' | 'pre_code';
402
+ /** True while the run waits out this recovery's retry delay. */
403
+ readonly active: boolean;
404
+ readonly reason: string | null;
405
+ readonly dependency: string | null;
406
+ readonly deferCount: number | null;
407
+ /** Cap on deferrals for this kind, as this app build configures it. */
408
+ readonly maxDefers: number;
409
+ /** Post-code only: consecutive attempts that recorded no new history. */
410
+ readonly unproductiveAttempts: number | null;
411
+ readonly maxUnproductiveAttempts: number | null;
412
+ readonly nextRetryAt: string | null;
413
+ /** True when the next retry time has passed and no attempt has started. */
414
+ readonly nextRetryDue: boolean;
415
+ /** Recovery horizon: no retry is scheduled after this time. */
416
+ readonly deadlineAt: string | null;
417
+ readonly exhaustedAt: string | null;
418
+ readonly updatedAt: string | null;
419
+ } | null;
420
+ readonly resume: {
421
+ /** `not_applicable` for in-flight and completed runs. */
422
+ readonly state: 'resumable' | 'refused' | 'not_applicable';
423
+ readonly reason: DurableRunResumeRefusal | null;
424
+ /** The refusal clears by itself once the ending settles. */
425
+ readonly transient: boolean;
426
+ /** When the resume window closes (finishedAt + 14 days). */
427
+ readonly windowExpiresAt: string | null;
428
+ };
429
+ /** At most one entry per kind, in recommended order. */
430
+ readonly nextActions: readonly {
431
+ readonly action: DurableRunNextActionKind;
432
+ readonly available: boolean;
433
+ readonly reason: string | null;
434
+ }[];
435
+ /**
436
+ * Additive; failed and cancelled runs only (null otherwise; absent from
437
+ * older servers). `code` is a short machine token; `message` is only
438
+ * Deepline's fixed exhausted-recovery text, never the Play's error text.
439
+ */
440
+ readonly failure?: {
441
+ readonly class: DurableRunFailureClass;
442
+ readonly code: string | null;
443
+ readonly message: string | null;
444
+ /** When recovery was exhausted, else when the run stopped. */
445
+ readonly at: string | null;
446
+ } | null;
447
+ };
448
+
449
+ /** Fixed-size schedule of one cron trigger binding. */
450
+ export type QueueItemSchedule = {
451
+ readonly version: 1;
452
+ readonly orgId: string | null;
453
+ readonly playDefinitionId: string | null;
454
+ readonly triggerName: string | null;
455
+ readonly cron: string | null;
456
+ readonly timezone: string | null;
457
+ /** Null until the scheduler initializes the binding's first slot. */
458
+ readonly nextScheduledAt: string | null;
459
+ readonly lastScheduledAt: string | null;
460
+ };
461
+
304
462
  export type QueueItem = {
305
463
  readonly queueId: string;
306
464
  readonly id: string;
@@ -323,6 +481,10 @@ export type QueueItem = {
323
481
  readonly diagnosis?: QueueItemDiagnosis;
324
482
  /** Additive; only monitor inbound dead letters carry it. */
325
483
  readonly monitorEvent?: QueueItemMonitorEvent;
484
+ /** Additive; only `durable-play-runs` items carry it. */
485
+ readonly durableRun?: QueueItemDurableRun;
486
+ /** Additive; only `play-cron-bindings` items carry it. */
487
+ readonly schedule?: QueueItemSchedule;
326
488
  readonly retiredAt?: string;
327
489
  readonly retirementReason?: string;
328
490
  };
@@ -551,10 +713,20 @@ export type QueueItemConnectorContext = {
551
713
  readonly limit: number;
552
714
  readonly cursor?: string;
553
715
  readonly state?: QueueItemState;
716
+ /**
717
+ * Keep only quarantined items with this failure cause. Only connectors that
718
+ * declare `supportsFailureCause` receive it.
719
+ */
720
+ readonly failureCause?: DurableRunFailureCauseFilter;
554
721
  /** Explicit tenant scope for owner sources stored in a Customer DB. */
555
722
  readonly orgId?: string;
556
723
  readonly actorId?: string;
557
724
  readonly operationId?: string;
725
+ /**
726
+ * The app origin serving this admin request. Owners whose action launches
727
+ * runtime work (durable-run resume) need it as the run's callback origin.
728
+ */
729
+ readonly runtimeApiBaseUrl?: string;
558
730
  };
559
731
 
560
732
  /**
@@ -570,6 +742,8 @@ export type QueueItemConnector = {
570
742
  /** The owner can record revision-fenced operator retirement overlays for
571
743
  * terminal or quarantined source items without mutating its native row. */
572
744
  readonly supportsRetirement?: true;
745
+ /** The owner filters its quarantined listing by `failureCause`. */
746
+ readonly supportsFailureCause?: true;
573
747
  /** Stable reason surfaced when this registration is an unavailable shell. */
574
748
  readonly unavailableReason?: string;
575
749
  /** True only when the owner explicitly declares that no item reader exists. */
@@ -361,6 +361,15 @@ export const OPERATIONS_QUEUE_CATALOG = [
361
361
  300_000,
362
362
  900_000,
363
363
  ),
364
+ queue(
365
+ 'durable-play-runs',
366
+ 'Durable Play runs',
367
+ 'leased_workset',
368
+ 'runtime',
369
+ 'Show in-flight, automatically recovering, and resumable Play runs with the command that moves each one along',
370
+ 300_000,
371
+ 900_000,
372
+ ),
364
373
  ] as const satisfies readonly QueueCatalogEntry[];
365
374
 
366
375
  export type OperationsQueueId = (typeof OPERATIONS_QUEUE_CATALOG)[number]['id'];
@@ -293,6 +293,7 @@ export const QUEUE_CONNECTOR_BACKENDS: Readonly<
293
293
  'play-deployment-jobs': 'workpool',
294
294
  'github-runner-wait': 'provider',
295
295
  'sandbox-cleanup-jobs': 'postgres-outbox',
296
+ 'durable-play-runs': 'absurd',
296
297
  };
297
298
 
298
299
  function defaultRegistration(
@@ -1845,5 +1845,23 @@
1845
1845
  "runTimeoutMs": 12000,
1846
1846
  "failureAlert": "fly_scaler_lifecycle_metric",
1847
1847
  "domainReportRequired": true
1848
+ },
1849
+ {
1850
+ "id": "vercel.staged-input-expiry",
1851
+ "name": "Staged input expiry",
1852
+ "scheduler": "vercel_cron",
1853
+ "cadence": "23 * * * *",
1854
+ "timezone": "UTC",
1855
+ "source": "apps/deepline-api/src/app/api/v2/cron/staged-input-expiry/route.ts",
1856
+ "locator": "/api/v2/cron/staged-input-expiry",
1857
+ "owner": "runtime",
1858
+ "criticality": "maintenance",
1859
+ "purpose": "Retire the staged array input of failed and cancelled Play runs once their 14-day runs resume window has passed.",
1860
+ "successDefinition": "Every selected run's staged input is deleted from its Customer DB and the run is marked retired, so no later pass selects it again.",
1861
+ "failureDefinition": "Listing expired runs fails, or any selected run's input cannot be retired or marked; that run is selected again on the next pass.",
1862
+ "startGraceMs": 1800000,
1863
+ "runTimeoutMs": 800000,
1864
+ "failureAlert": "vercel_route_wrapper",
1865
+ "domainReportRequired": true
1848
1866
  }
1849
1867
  ]
@@ -1,4 +1,8 @@
1
1
  import { RUN_EVENT_KIND } from './run-event-catalog';
2
+
3
+ /** One current activity across bounded platform-recovery attempts. */
4
+ export const PLATFORM_RECOVERY_ACTIVITY_ID = 'run:platform-recovery';
5
+ export const CANCELLATION_CLEANUP_ACTIVITY_ID = 'run:cancellation-cleanup';
2
6
  /**
3
7
  * Canonical, producer-facing description of what a play is doing.
4
8
  *
@@ -242,6 +246,8 @@ export function derivePlayActivityVisibility(input: {
242
246
  }
243
247
  if (state.kind === 'queued' || state.kind === 'scheduled') return 'headline';
244
248
  if (state.kind === 'retrying') {
249
+ if (input.observation.activityId === PLATFORM_RECOVERY_ACTIVITY_ID)
250
+ return 'headline';
245
251
  if (
246
252
  state.reason === 'rate_limit' &&
247
253
  input.observation.target.kind === 'capacity'
@@ -307,6 +313,11 @@ export function summarizePlayActivity(
307
313
  ): string {
308
314
  const label = targetLabel(observation.target);
309
315
  const { state } = observation;
316
+ if (
317
+ observation.activityId === CANCELLATION_CLEANUP_ACTIVITY_ID &&
318
+ state.kind === 'active'
319
+ )
320
+ return 'Cancelling Play: waiting for cleanup to finish.';
310
321
  switch (state.kind) {
311
322
  case 'active': {
312
323
  const progress = state.progress;
@@ -447,6 +458,15 @@ export function projectPlayRunActivity(input: {
447
458
  return null;
448
459
  }
449
460
 
461
+ // A cancellation remains the active intent while its durable cleanup is
462
+ // pending, even if an already-running attempt emits later progress.
463
+ const pendingCancellation = input.explicit?.find(
464
+ (candidate) =>
465
+ candidate.activityId === CANCELLATION_CLEANUP_ACTIVITY_ID &&
466
+ candidate.state.kind === 'active',
467
+ );
468
+ if (pendingCancellation) return projection(pendingCancellation, now);
469
+
450
470
  const latestExplicit = [...(input.explicit ?? [])]
451
471
  .filter((candidate) => !isTerminalActivityState(candidate.state))
452
472
  .sort((left, right) => right.observedAt - left.observedAt)[0];
@@ -39,7 +39,10 @@ import type {
39
39
  PlayStagedFileRef,
40
40
  PlayVisualNodeProgressMap,
41
41
  } from './/worker-api-types';
42
- import type { RuntimeStepReceipt } from './/ctx-types';
42
+ import type {
43
+ PublishLatestCacheResultOutcome,
44
+ RuntimeStepReceipt,
45
+ } from './/ctx-types';
43
46
  import type {
44
47
  CreateDbSessionRequest,
45
48
  CreateDbSessionResponse,
@@ -1099,6 +1102,7 @@ function isRetryableAppRuntimeAction(
1099
1102
  action === 'release_runtime_step_receipt' ||
1100
1103
  action === 'save_results' ||
1101
1104
  action === 'skip_runtime_step_receipt' ||
1105
+ action === 'publish_latest_cache_result' ||
1102
1106
  action === 'start_run' ||
1103
1107
  action === 'launch_play_async'
1104
1108
  );
@@ -1123,7 +1127,8 @@ function isRuntimeStepReceiptAction(
1123
1127
  action === 'fail_runtime_step_receipt' ||
1124
1128
  action === 'fail_runtime_step_receipts' ||
1125
1129
  action === 'release_runtime_step_receipt' ||
1126
- action === 'skip_runtime_step_receipt'
1130
+ action === 'skip_runtime_step_receipt' ||
1131
+ action === 'publish_latest_cache_result'
1127
1132
  );
1128
1133
  }
1129
1134
 
@@ -3470,6 +3475,61 @@ export async function skipRuntimeStepReceiptViaAppRuntime(
3470
3475
  });
3471
3476
  }
3472
3477
 
3478
+ /**
3479
+ * Newest-wins publish of a shared read result. Only these exact older-receiver
3480
+ * answers mean "this receiver has no shared read cache": an older app route
3481
+ * (reached through an older gateway's proxy) rejects the unknown action before
3482
+ * capability evaluation, and a newer app route declines it explicitly. Both
3483
+ * write nothing, so the publish is a no-op. Every other failure throws.
3484
+ */
3485
+ export async function publishLatestCacheResultViaAppRuntime(
3486
+ context: WorkerRuntimeApiContext,
3487
+ input: Omit<
3488
+ Extract<RuntimeApiRequest, { action: 'publish_latest_cache_result' }>,
3489
+ 'action'
3490
+ >,
3491
+ ): Promise<PublishLatestCacheResultOutcome> {
3492
+ let response: unknown;
3493
+ try {
3494
+ response = await postAppRuntimeApi<unknown>(context, {
3495
+ action: 'publish_latest_cache_result',
3496
+ ...input,
3497
+ });
3498
+ } catch (error) {
3499
+ if (
3500
+ error instanceof AppRuntimeApiResponseError &&
3501
+ ((error.status === 403 &&
3502
+ error.code === null &&
3503
+ error.detail === 'Unsupported runtime action capability scope.') ||
3504
+ error.code === 'SHARED_READ_CACHE_UNAVAILABLE')
3505
+ ) {
3506
+ return { published: false, reason: 'unavailable' };
3507
+ }
3508
+ throw error;
3509
+ }
3510
+ const outcome = response as Partial<{
3511
+ published: unknown;
3512
+ recordedAtMs: unknown;
3513
+ reason: unknown;
3514
+ }> | null;
3515
+ if (
3516
+ outcome?.published === true &&
3517
+ typeof outcome.recordedAtMs === 'number' &&
3518
+ Number.isSafeInteger(outcome.recordedAtMs)
3519
+ ) {
3520
+ return { published: true, recordedAtMs: outcome.recordedAtMs };
3521
+ }
3522
+ if (
3523
+ outcome?.published === false &&
3524
+ (outcome.reason === 'older' || outcome.reason === 'value_too_large')
3525
+ ) {
3526
+ return { published: false, reason: outcome.reason };
3527
+ }
3528
+ throw new Error(
3529
+ 'Receipt gateway returned an invalid shared read cache publish response.',
3530
+ );
3531
+ }
3532
+
3473
3533
  /**
3474
3534
  * Post one durable docflow observation to the receipt gateway (ADR 0016 rule
3475
3535
  * 2). Callers invoke this fire-and-forget; it resolves on the gateway ack and