deepline 0.3.551 → 0.3.553

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 (324) hide show
  1. package/dist/bundling-sources/sdk/src/client-core.ts +130 -12
  2. package/dist/bundling-sources/sdk/src/compat.ts +239 -87
  3. package/dist/bundling-sources/sdk/src/config.ts +113 -2
  4. package/dist/bundling-sources/sdk/src/errors.ts +2 -0
  5. package/dist/bundling-sources/sdk/src/http-core.ts +124 -10
  6. package/dist/bundling-sources/sdk/src/index.ts +2 -0
  7. package/dist/bundling-sources/sdk/src/integrations.ts +6 -4
  8. package/dist/bundling-sources/sdk/src/play.ts +3 -0
  9. package/dist/bundling-sources/sdk/src/plays/run-request.ts +1 -1
  10. package/dist/bundling-sources/sdk/src/release.ts +1 -1
  11. package/dist/bundling-sources/sdk/src/runs/watch-polling.ts +66 -30
  12. package/dist/bundling-sources/sdk/src/tool-calls.ts +2 -1
  13. package/dist/bundling-sources/sdk/src/tool-failure-hint.ts +104 -0
  14. package/dist/bundling-sources/sdk/src/types.ts +9 -1
  15. package/dist/bundling-sources/shared_libs/integration-contracts/billing-entitlements.ts +4 -2
  16. package/dist/bundling-sources/shared_libs/integration-contracts/billing-plan-skus.ts +25 -0
  17. package/dist/bundling-sources/shared_libs/monitors/action-actor.ts +2 -0
  18. package/dist/bundling-sources/shared_libs/monitors/billing/credit-recovery.ts +58 -4
  19. package/dist/bundling-sources/shared_libs/monitors/billing/policy-builders.ts +8 -0
  20. package/dist/bundling-sources/shared_libs/monitors/billing/pricing.ts +11 -0
  21. package/dist/bundling-sources/shared_libs/monitors/billing/types.ts +13 -0
  22. package/dist/bundling-sources/shared_libs/monitors/deactivation-reasons.ts +103 -5
  23. package/dist/bundling-sources/shared_libs/monitors/fleets/converge-admission.ts +133 -0
  24. package/dist/bundling-sources/shared_libs/monitors/fleets/fence-attention.ts +165 -0
  25. package/dist/bundling-sources/shared_libs/monitors/fleets/fence-release.ts +726 -0
  26. package/dist/bundling-sources/shared_libs/monitors/fleets/fence-walk.ts +274 -0
  27. package/dist/bundling-sources/shared_libs/monitors/fleets/issues.ts +1 -0
  28. package/dist/bundling-sources/shared_libs/monitors/fleets/limits.ts +28 -0
  29. package/dist/bundling-sources/shared_libs/monitors/fleets/provider-bulk-wait.ts +126 -0
  30. package/dist/bundling-sources/shared_libs/monitors/fleets/shared-payload.ts +189 -0
  31. package/dist/bundling-sources/shared_libs/monitors/http-error-response.ts +28 -0
  32. package/dist/bundling-sources/shared_libs/monitors/inbound-publish-key.ts +4 -0
  33. package/dist/bundling-sources/shared_libs/monitors/inventory-counter-errors.ts +25 -0
  34. package/dist/bundling-sources/shared_libs/monitors/org-monitor-limits.ts +65 -0
  35. package/dist/bundling-sources/shared_libs/monitors/package.json +11 -0
  36. package/dist/bundling-sources/shared_libs/monitors/provider-callback-verification.ts +152 -1
  37. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-batch-operation.ts +6 -0
  38. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-capability.ts +390 -10
  39. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-errors.ts +34 -0
  40. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-identity-claims.ts +66 -30
  41. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-state.ts +30 -0
  42. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-upstream-identity.ts +80 -13
  43. package/dist/bundling-sources/shared_libs/monitors/provider-resource-failure.ts +26 -3
  44. package/dist/bundling-sources/shared_libs/monitors/signal-radars/inbound-dead-letter.ts +41 -13
  45. package/dist/bundling-sources/shared_libs/monitors/signal-radars/raw-receipt-causes.ts +219 -0
  46. package/dist/bundling-sources/shared_libs/monitors/snitcher-ip2company.ts +21 -10
  47. package/dist/bundling-sources/shared_libs/monitors/starter-templates.ts +13 -0
  48. package/dist/bundling-sources/shared_libs/monitors/tamradar-countries.ts +285 -0
  49. package/dist/bundling-sources/shared_libs/monitors/tracking-provider-guidance.ts +6 -0
  50. package/dist/bundling-sources/shared_libs/monitors/tracking-provider-integrations.ts +13 -0
  51. package/dist/bundling-sources/shared_libs/observability/dlq.ts +1 -1
  52. package/dist/bundling-sources/shared_libs/observability/log-metadata.ts +5 -3
  53. package/dist/bundling-sources/shared_libs/observability/queue-health.ts +10 -1
  54. package/dist/bundling-sources/shared_libs/observability/queue-item-connectors.ts +1 -0
  55. package/dist/bundling-sources/shared_libs/observability/redaction.ts +24 -1
  56. package/dist/bundling-sources/shared_libs/observability/scheduled-jobs.json +312 -41
  57. package/dist/bundling-sources/shared_libs/observability/scheduled-work-manual.ts +1 -2
  58. package/dist/bundling-sources/shared_libs/play-data-plane/preview-r2-oidc.ts +188 -0
  59. package/dist/bundling-sources/shared_libs/play-data-plane/r2.ts +170 -16
  60. package/dist/bundling-sources/shared_libs/play-data-plane/runtime-sheet-storage-contract.ts +5 -0
  61. package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +68 -2
  62. package/dist/bundling-sources/shared_libs/play-runtime/context.ts +568 -26
  63. package/dist/bundling-sources/shared_libs/play-runtime/ctx-fetch-caller-deadline.ts +200 -0
  64. package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +6 -0
  65. package/dist/bundling-sources/shared_libs/play-runtime/deployment/runtime-topology.ts +21 -1
  66. package/dist/bundling-sources/shared_libs/play-runtime/durable-call-cache.ts +3 -2
  67. package/dist/bundling-sources/shared_libs/play-runtime/durable-runs-rollout.ts +14 -2
  68. package/dist/bundling-sources/shared_libs/play-runtime/durable-summary-events.ts +70 -2
  69. package/dist/bundling-sources/shared_libs/play-runtime/durable-tool-identity.ts +3 -3
  70. package/dist/bundling-sources/shared_libs/play-runtime/execution-capabilities.ts +16 -0
  71. package/dist/bundling-sources/shared_libs/play-runtime/experiment-switches.ts +92 -16
  72. package/dist/bundling-sources/shared_libs/play-runtime/fixture-behavior.ts +1 -0
  73. package/dist/bundling-sources/shared_libs/play-runtime/governor/policy.ts +7 -1
  74. package/dist/bundling-sources/shared_libs/play-runtime/internal-bootstrap-token.ts +62 -0
  75. package/dist/bundling-sources/shared_libs/play-runtime/map-memory-limits.ts +74 -3
  76. package/dist/bundling-sources/shared_libs/play-runtime/output-size-limits.ts +31 -3
  77. package/dist/bundling-sources/shared_libs/play-runtime/play-http-request.ts +6 -0
  78. package/dist/bundling-sources/shared_libs/play-runtime/protocol.ts +8 -0
  79. package/dist/bundling-sources/shared_libs/play-runtime/query-result-dataset.ts +19 -0
  80. package/dist/bundling-sources/shared_libs/play-runtime/resource-governor.ts +39 -2
  81. package/dist/bundling-sources/shared_libs/play-runtime/run-failure.ts +9 -1
  82. package/dist/bundling-sources/shared_libs/play-runtime/run-identity.ts +33 -0
  83. package/dist/bundling-sources/shared_libs/play-runtime/run-ledger-projection-contract.ts +24 -0
  84. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/index.ts +300 -57
  85. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-payload-transport.ts +87 -6
  86. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/modal.ts +241 -10
  87. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/early-sandbox-egress.ts +161 -14
  88. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/early-sandbox.ts +16 -3
  89. package/dist/bundling-sources/shared_libs/play-runtime/runtime-api-compression.ts +37 -0
  90. package/dist/bundling-sources/shared_libs/play-runtime/runtime-api-paths.ts +9 -0
  91. package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +298 -46
  92. package/dist/bundling-sources/shared_libs/play-runtime/runtime-authority.ts +13 -0
  93. package/dist/bundling-sources/shared_libs/play-runtime/runtime-constants.ts +39 -0
  94. package/dist/bundling-sources/shared_libs/play-runtime/runtime-operation-contract.ts +62 -1
  95. package/dist/bundling-sources/shared_libs/play-runtime/runtime-scheduler-topology.ts +36 -0
  96. package/dist/bundling-sources/shared_libs/play-runtime/runtime-sheet-row-transition.ts +36 -0
  97. package/dist/bundling-sources/shared_libs/play-runtime/runtime-speed-profile.ts +206 -2
  98. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-pool.ts +42 -0
  99. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +185 -64
  100. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-worker-slot-ledger.ts +157 -0
  101. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/early-sandbox-lane.ts +110 -2
  102. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/early-sandbox-listener-hint.ts +323 -0
  103. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/executor-attempt-standing.ts +72 -0
  104. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/integration-operation-value-storage.ts +23 -4
  105. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-rate-state.ts +32 -10
  106. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-workspace-purge.ts +199 -0
  107. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +632 -66
  108. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/run-ledger-outbox-recovery.ts +517 -16
  109. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-api-origin.ts +1 -1
  110. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-receipt-value-storage.ts +9 -0
  111. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-worker-wake.ts +599 -2
  112. package/dist/bundling-sources/shared_libs/play-runtime/secret-resolution-retry-policy.ts +26 -1
  113. package/dist/bundling-sources/shared_libs/play-runtime/startup-read-tool-ids.ts +60 -0
  114. package/dist/bundling-sources/shared_libs/play-runtime/test-runtime-seams.ts +51 -0
  115. package/dist/bundling-sources/shared_libs/play-runtime/tool-call-retry-facts.ts +2 -0
  116. package/dist/bundling-sources/shared_libs/play-runtime/tool-execute-retry-policy.ts +113 -3
  117. package/dist/bundling-sources/shared_libs/play-runtime/tool-http-errors.ts +5 -7
  118. package/dist/bundling-sources/shared_libs/play-runtime/tool-result.ts +37 -7
  119. package/dist/bundling-sources/shared_libs/play-runtime/work-receipt-storage-contract.ts +2 -0
  120. package/dist/bundling-sources/shared_libs/play-runtime/workflow-executor-auth.ts +3 -0
  121. package/dist/bundling-sources/shared_libs/plays/authoring-contract.ts +40 -5
  122. package/dist/bundling-sources/shared_libs/plays/deploy/api-client.ts +3 -0
  123. package/dist/bundling-sources/shared_libs/plays/deploy/control-plane-types.ts +16 -0
  124. package/dist/bundling-sources/shared_libs/plays/deploy/run-deployment.ts +10 -41
  125. package/dist/bundling-sources/shared_libs/plays/extension-bridge.ts +33 -0
  126. package/dist/bundling-sources/shared_libs/plays/row-identity.ts +18 -1
  127. package/dist/bundling-sources/shared_libs/plays/tool-execution-error.ts +108 -0
  128. package/dist/bundling-sources/shared_libs/plays/trigger-config-contract.ts +14 -0
  129. package/dist/bundling-sources/shared_libs/product-notifications/catalog.ts +171 -0
  130. package/dist/bundling-sources/shared_libs/product-notifications/events.ts +27 -1
  131. package/dist/bundling-sources/shared_libs/security/email-blacklist.ts +9 -24
  132. package/dist/bundling-sources/shared_libs/security/secret-redaction.ts +178 -5
  133. package/dist/bundling-sources/shared_libs/security/signup-email-dns-screen.ts +148 -0
  134. package/dist/bundling-sources/shared_libs/tool-execution-error.ts +108 -0
  135. package/dist/cli/{auth-E7BH4GMJ.mjs → auth-I3QAU4RV.mjs} +8 -7
  136. package/dist/cli/auth-MQCN7WGZ.js +44 -0
  137. package/dist/cli/{billing-OXKU462W.mjs → billing-3IC54OQQ.mjs} +202 -59
  138. package/dist/cli/{billing-DNQAZGX7.js → billing-YGFFVAIC.js} +302 -159
  139. package/dist/cli/{chunk-COGREZAO.js → chunk-2B5B5KAW.js} +210 -128
  140. package/dist/cli/{chunk-UBKA33KY.mjs → chunk-2MGZAI54.mjs} +17 -0
  141. package/dist/cli/{chunk-T2B5BVZE.js → chunk-3NTP2OSG.js} +13 -13
  142. package/dist/cli/{chunk-FOTGUFVK.mjs → chunk-45OAVGU6.mjs} +5 -5
  143. package/dist/cli/{chunk-54EEYLTF.js → chunk-4747TPLV.js} +3 -3
  144. package/dist/cli/{chunk-CLRAANWH.mjs → chunk-4BFTDNHU.mjs} +1 -1
  145. package/dist/cli/{chunk-BGBJV26E.mjs → chunk-4HYNMXXF.mjs} +4 -4
  146. package/dist/cli/{chunk-5S6PHKRV.mjs → chunk-4SMCFQ23.mjs} +1 -1
  147. package/dist/cli/{chunk-VWLHRZFG.mjs → chunk-55F6HNOY.mjs} +5 -5
  148. package/dist/cli/{chunk-LX35AXTN.mjs → chunk-5TYLSS4Q.mjs} +6 -6
  149. package/dist/cli/{chunk-VTGG2RT3.js → chunk-6NE3RRRY.js} +1 -1
  150. package/dist/cli/{chunk-EITMD3A5.js → chunk-6VLFQZK6.js} +8 -8
  151. package/dist/cli/{chunk-MNSTCJMX.mjs → chunk-72V4PDH5.mjs} +18 -18
  152. package/dist/cli/{chunk-ZCDKE4UH.js → chunk-74RES4DS.js} +5 -5
  153. package/dist/cli/{chunk-WKBHUB6R.js → chunk-7GEMELKI.js} +366 -320
  154. package/dist/cli/{chunk-C4CUZH57.js → chunk-7O6J6A7P.js} +1871 -92
  155. package/dist/cli/{chunk-7RSIFA72.js → chunk-7SERLBNR.js} +161 -53
  156. package/dist/cli/{chunk-3G6QZACZ.js → chunk-7YRJ5UC4.js} +21 -21
  157. package/dist/cli/{chunk-I4VKGNAQ.mjs → chunk-A7DLBE5K.mjs} +136 -54
  158. package/dist/cli/{chunk-GGB3JYCW.mjs → chunk-AGICYWGN.mjs} +299 -69
  159. package/dist/cli/{chunk-44KSACJW.mjs → chunk-AGIQDA2T.mjs} +12 -12
  160. package/dist/cli/{chunk-PACD5DGC.js → chunk-AGLR6QVN.js} +255 -109
  161. package/dist/cli/{chunk-NURW5XH4.mjs → chunk-ASB47RXJ.mjs} +1 -1
  162. package/dist/cli/{chunk-4OMAGJ6U.js → chunk-BVDKFS2T.js} +2 -2
  163. package/dist/cli/{chunk-LPJPCGT3.js → chunk-CACFJODG.js} +190 -134
  164. package/dist/cli/{chunk-GVYLCCKN.mjs → chunk-CAEBJOYU.mjs} +1 -1
  165. package/dist/cli/{chunk-XDVT3GOM.js → chunk-CFJFUVX2.js} +18 -1
  166. package/dist/cli/{chunk-POLUE7D5.js → chunk-DP2VH7CO.js} +12 -12
  167. package/dist/cli/{chunk-D6M5HFBB.mjs → chunk-DP64MD6U.mjs} +1 -1
  168. package/dist/cli/{chunk-W425ERWN.mjs → chunk-DZA7RFGL.mjs} +5 -5
  169. package/dist/cli/{chunk-R7J7CJPZ.js → chunk-E2G2DNAB.js} +4 -1
  170. package/dist/cli/{chunk-GGGAEVCX.mjs → chunk-E7WZOX2A.mjs} +22 -18
  171. package/dist/cli/{chunk-44I675YK.js → chunk-FM7LPUPA.js} +41 -41
  172. package/dist/cli/{chunk-2UXDHFSF.mjs → chunk-GAVZ4EOD.mjs} +1 -1
  173. package/dist/cli/{chunk-Z2FIOG3V.js → chunk-HEBO3XNZ.js} +27 -31
  174. package/dist/cli/{chunk-6PWJKMFQ.mjs → chunk-HSJ6X2AQ.mjs} +4 -4
  175. package/dist/cli/{chunk-UPMRIVZB.js → chunk-HVI55MTK.js} +61 -10
  176. package/dist/cli/{chunk-KWSH5T7K.js → chunk-IH6GDNKW.js} +21 -21
  177. package/dist/cli/{chunk-3KYBDAR3.js → chunk-IMX7J4DU.js} +8 -8
  178. package/dist/cli/{chunk-HEHVGEZV.mjs → chunk-INEMTYMT.mjs} +8 -8
  179. package/dist/cli/{chunk-5VVSEU67.js → chunk-IUOGII7D.js} +6 -7
  180. package/dist/cli/{chunk-MXGA6JFI.mjs → chunk-JJGWHITQ.mjs} +5 -5
  181. package/dist/cli/{chunk-QM6Y6S4E.js → chunk-JLGP5XAJ.js} +5 -5
  182. package/dist/cli/{chunk-V6SCP4B7.mjs → chunk-LFOERUQY.mjs} +69 -3
  183. package/dist/cli/{chunk-BBTKAASQ.js → chunk-LFQJW4S2.js} +42 -1
  184. package/dist/cli/{chunk-ZMNGZ6XS.mjs → chunk-LH5PZKER.mjs} +80 -24
  185. package/dist/cli/{chunk-MR5LTVHD.js → chunk-LRDHPOZW.js} +69 -69
  186. package/dist/cli/{chunk-5LUF4LAR.mjs → chunk-LRZGS6RZ.mjs} +3 -0
  187. package/dist/cli/{chunk-SL6MYJYM.js → chunk-MJTVX4QK.js} +35 -35
  188. package/dist/cli/{chunk-UDXULACQ.js → chunk-MLABYI4M.js} +90 -24
  189. package/dist/cli/{chunk-S7IZWGUA.mjs → chunk-NDNHYONK.mjs} +17 -21
  190. package/dist/cli/{chunk-4D3WIZST.mjs → chunk-OTV2UUKW.mjs} +164 -18
  191. package/dist/cli/{chunk-XYE5XPGF.js → chunk-Q6Z6N3A7.js} +18 -18
  192. package/dist/cli/{chunk-7WQNWJQW.mjs → chunk-QG6JIWUL.mjs} +151 -43
  193. package/dist/cli/{chunk-3T65J5RG.mjs → chunk-QI5S5HWB.mjs} +2 -2
  194. package/dist/cli/{chunk-CBV7AKWM.js → chunk-R6DZ6NQ2.js} +5 -5
  195. package/dist/cli/{chunk-PM7MO62Y.mjs → chunk-RMNOZKRI.mjs} +3 -3
  196. package/dist/cli/{chunk-NMWGZD6Y.js → chunk-RTV4RF7N.js} +36 -36
  197. package/dist/cli/{chunk-CQ6JYQSW.js → chunk-SBH4CKPN.js} +11 -11
  198. package/dist/cli/{chunk-BIIJATTX.mjs → chunk-SG3LUONJ.mjs} +3 -3
  199. package/dist/cli/{chunk-2WFPHBR4.js → chunk-TFEXSHPM.js} +22 -18
  200. package/dist/cli/{chunk-5IL7SC45.mjs → chunk-TN4TY6TT.mjs} +6 -7
  201. package/dist/cli/{chunk-WEHCBH5R.mjs → chunk-UEVKMZLR.mjs} +54 -3
  202. package/dist/cli/{chunk-RE5MJBEV.mjs → chunk-UVQJYV76.mjs} +2 -2
  203. package/dist/cli/{chunk-FSIVF2SI.mjs → chunk-VZGLIK5U.mjs} +1 -1
  204. package/dist/cli/{chunk-W2ZWQUHT.js → chunk-WOCHZCUJ.js} +2 -2
  205. package/dist/cli/{chunk-ZDQFBJPO.js → chunk-XLIHTJVM.js} +348 -118
  206. package/dist/cli/{chunk-2ZYRBMQM.js → chunk-Y6SP3JMI.js} +22 -22
  207. package/dist/cli/{chunk-PPSDCN6C.js → chunk-YUA6HA6D.js} +2 -2
  208. package/dist/cli/{chunk-JL2OTMSG.mjs → chunk-Z3A2S3QM.mjs} +41 -0
  209. package/dist/cli/{chunk-E64HFB4L.mjs → chunk-Z6XPSHKM.mjs} +87 -41
  210. package/dist/cli/{chunk-7DOQ3OEX.mjs → chunk-Z7AOIHFE.mjs} +1870 -91
  211. package/dist/cli/command-docs.js +3 -3
  212. package/dist/cli/command-docs.mjs +2 -2
  213. package/dist/cli/concurrent-runs-help-CFJH4KXV.js +22 -0
  214. package/dist/cli/{concurrent-runs-help-C6L6I5OR.mjs → concurrent-runs-help-DNV2X5AZ.mjs} +9 -8
  215. package/dist/cli/{csv-QMF4FWE7.js → csv-SA6ELJY6.js} +16 -15
  216. package/dist/cli/{csv-SYSDXFEM.mjs → csv-ZXZGHWOM.mjs} +7 -6
  217. package/dist/cli/{db-Q7HURWRZ.mjs → db-A54SP6AD.mjs} +16 -16
  218. package/dist/cli/{db-YSHPPA4H.js → db-JHFEIQBU.js} +43 -43
  219. package/dist/cli/describe-PHQ33AGS.mjs +50 -0
  220. package/dist/cli/describe-RHJ4XRFI.js +50 -0
  221. package/dist/cli/describe-core.d.mts +3 -3
  222. package/dist/cli/describe-core.d.ts +3 -3
  223. package/dist/cli/describe-core.js +6 -6
  224. package/dist/cli/describe-core.mjs +5 -5
  225. package/dist/cli/{executions-G7U3VUXN.mjs → executions-HL2M2DFU.mjs} +10 -10
  226. package/dist/cli/{executions-MWBC5TAW.js → executions-TLFZRHBJ.js} +12 -12
  227. package/dist/cli/{feedback-SD55OY6H.js → feedback-5UEX5UZK.js} +17 -16
  228. package/dist/cli/{feedback-GMHIFLBJ.mjs → feedback-QMBTNXVG.mjs} +9 -8
  229. package/dist/cli/git-4JWOOHBG.js +26 -0
  230. package/dist/cli/{git-HPE45OPD.mjs → git-LKGXVIVC.mjs} +8 -7
  231. package/dist/cli/index.js +170 -158
  232. package/dist/cli/index.mjs +60 -48
  233. package/dist/cli/{integrations-HFKVBY6G.js → integrations-6RUTLMN7.js} +23 -27
  234. package/dist/cli/{integrations-2W4MGIQR.mjs → integrations-FGGRVUJ7.mjs} +15 -19
  235. package/dist/cli/{legacy-noops-SXVNDEXN.js → legacy-noops-J3Z7QRWZ.js} +12 -11
  236. package/dist/cli/{legacy-noops-GZYKNU2Z.mjs → legacy-noops-YIPRMVXZ.mjs} +9 -8
  237. package/dist/cli/{mcp-PJRHQHHU.js → mcp-6LWFP7RW.js} +121 -48
  238. package/dist/cli/{mcp-BWA6KULG.mjs → mcp-CHDYFO7F.mjs} +100 -27
  239. package/dist/cli/{monitors-K2WSI6CR.js → monitors-STM6A7OU.js} +221 -186
  240. package/dist/cli/{monitors-SYQKCATO.mjs → monitors-UGRY2BXI.mjs} +58 -23
  241. package/dist/cli/org-3SYOUQCX.mjs +2289 -0
  242. package/dist/cli/org-ZOBSNSIB.js +2289 -0
  243. package/dist/cli/outcomes-H4YYAT5X.js +2865 -0
  244. package/dist/cli/outcomes-Z3P2JE67.mjs +2865 -0
  245. package/dist/cli/{play-SZXY2F2S.js → play-SM4CW2GS.js} +1116 -846
  246. package/dist/cli/{play-TTMABJEI.mjs → play-SN5YWLS7.mjs} +375 -105
  247. package/dist/cli/{providers-GQIOMRQO.mjs → providers-WZ4YBR5Y.mjs} +10 -10
  248. package/dist/cli/{providers-YDHCTZAF.js → providers-WZARYMCF.js} +13 -13
  249. package/dist/cli/{quickstart-PHSSMKCA.mjs → quickstart-2575BNKA.mjs} +7 -6
  250. package/dist/cli/{quickstart-BNYOXQXG.js → quickstart-PS4YHQJ6.js} +9 -8
  251. package/dist/cli/{run-GFIAZXVL.js → run-FLZ6OTM7.js} +51 -51
  252. package/dist/cli/{run-74C3C75C.mjs → run-ZUHCZOJS.mjs} +31 -31
  253. package/dist/cli/run-identity-LMLFMACS.js +31 -0
  254. package/dist/cli/{run-identity-MRNCEGV2.mjs → run-identity-MAZ7ANH5.mjs} +9 -3
  255. package/dist/cli/{search-3SWUB7KX.mjs → search-HLPPKQEO.mjs} +11 -11
  256. package/dist/cli/search-JJWVHR3N.js +32 -0
  257. package/dist/cli/{search-output-K2SWHVHQ.mjs → search-output-PDAXNOGP.mjs} +9 -8
  258. package/dist/cli/{search-output-6JF3S4TP.js → search-output-RXJLU36B.js} +12 -11
  259. package/dist/cli/{secrets-2M4XWEKE.mjs → secrets-CGELYQ3H.mjs} +11 -11
  260. package/dist/cli/{secrets-2SAKLH2H.js → secrets-QJNG7G2Y.js} +20 -20
  261. package/dist/cli/sessions-DHTBT2GN.js +23 -0
  262. package/dist/cli/{sessions-A64BCXTO.mjs → sessions-ELMWVR4M.mjs} +9 -8
  263. package/dist/cli/{settings-HV64WIJF.js → settings-44I44P5F.js} +89 -89
  264. package/dist/cli/{settings-SVGEC3FI.mjs → settings-RR3LZXL7.mjs} +16 -16
  265. package/dist/cli/{setup-EDC3NEJ3.mjs → setup-KGWRWH4B.mjs} +20 -19
  266. package/dist/cli/{setup-FHXOLQGQ.js → setup-KTEYOCJO.js} +60 -59
  267. package/dist/cli/skills-EPZPEXI2.js +37 -0
  268. package/dist/cli/{skills-3HGHZMXB.mjs → skills-FPRID2I5.mjs} +10 -9
  269. package/dist/cli/tools-IGQQ5TML.js +57 -0
  270. package/dist/cli/{tools-P2QS6A6Q.mjs → tools-PI4WMDLY.mjs} +23 -23
  271. package/dist/cli/update-4RNCVYGE.js +37 -0
  272. package/dist/cli/{update-552BYQM4.mjs → update-VJOJAZ7B.mjs} +14 -11
  273. package/dist/cli/{views-PA25NAE3.js → views-NTUOLNQU.js} +62 -64
  274. package/dist/cli/{views-LD5HXJYY.mjs → views-OVPSINZO.mjs} +47 -49
  275. package/dist/cli/{workflow-FIDBUQV6.js → workflow-2UDYDM6F.js} +23 -23
  276. package/dist/cli/{workflow-LDYFGBYP.mjs → workflow-7OEFNXZC.mjs} +13 -13
  277. package/dist/{client-DuDFiJDU.d.mts → client-B8f7RNF8.d.mts} +1 -1
  278. package/dist/{client-t9HZAkFD.d.ts → client-C5TgXmJQ.d.ts} +1 -1
  279. package/dist/{client-core-DydMQOft.d.mts → client-core-SLLGBTht.d.mts} +285 -23
  280. package/dist/{client-core-CJRzLanv.d.ts → client-core-p0sOxnkl.d.ts} +285 -23
  281. package/dist/{compiler-manifest-BqwVrOri.d.mts → compiler-manifest-D_zZEh9Q.d.mts} +70 -5
  282. package/dist/{compiler-manifest-BqwVrOri.d.ts → compiler-manifest-D_zZEh9Q.d.ts} +70 -5
  283. package/dist/{errors-BU8FB99X.d.mts → errors-CZCrBFrQ.d.mts} +1 -1
  284. package/dist/{errors-DfVN_FUG.d.ts → errors-DsUkLrdZ.d.ts} +1 -1
  285. package/dist/{index-BGnvtYGc.d.ts → index-B6RTOZGC.d.ts} +1 -1
  286. package/dist/{index-DjZgwpGw.d.mts → index-DeOVrEmX.d.mts} +1 -1
  287. package/dist/index.d.mts +7 -7
  288. package/dist/index.d.ts +7 -7
  289. package/dist/index.js +66 -55
  290. package/dist/index.mjs +25 -14
  291. package/dist/install-integrity.json +162 -142
  292. package/dist/plays/bundle-play-file.d.mts +3 -3
  293. package/dist/plays/bundle-play-file.d.ts +3 -3
  294. package/dist/plays/bundle-play-file.mjs +23 -4
  295. package/dist/plays/csv-data-input.js +3 -3
  296. package/dist/plays/csv-data-input.mjs +2 -2
  297. package/dist/plays/play-description.d.mts +2 -2
  298. package/dist/plays/play-description.d.ts +2 -2
  299. package/dist/plays/run-request.d.mts +2 -2
  300. package/dist/plays/run-request.d.ts +2 -2
  301. package/dist/plays/run-request.js +4 -4
  302. package/dist/plays/run-request.mjs +3 -3
  303. package/dist/release.d.mts +1 -1
  304. package/dist/release.d.ts +1 -1
  305. package/dist/release.js +2 -2
  306. package/dist/release.mjs +1 -1
  307. package/dist/server.d.mts +4 -4
  308. package/dist/server.d.ts +4 -4
  309. package/dist/server.js +15 -13
  310. package/dist/server.mjs +9 -7
  311. package/package.json +1 -1
  312. package/dist/cli/auth-B4PI7GVY.js +0 -43
  313. package/dist/cli/concurrent-runs-help-JEFQZTJI.js +0 -21
  314. package/dist/cli/describe-PXTSBJTL.js +0 -50
  315. package/dist/cli/describe-YGMQBV44.mjs +0 -50
  316. package/dist/cli/git-I3JV7IGH.js +0 -25
  317. package/dist/cli/org-5KD7X7IA.mjs +0 -1282
  318. package/dist/cli/org-YQ2CR32B.js +0 -1282
  319. package/dist/cli/run-identity-G257GQED.js +0 -25
  320. package/dist/cli/search-2RRRF4LW.js +0 -32
  321. package/dist/cli/sessions-SBH27JNW.js +0 -22
  322. package/dist/cli/skills-Y3SRLOYD.js +0 -36
  323. package/dist/cli/tools-OFYPUPUV.js +0 -57
  324. package/dist/cli/update-SOUSCLB7.js +0 -34
@@ -55,15 +55,35 @@ export const ACTIVE_ORG_NAME_ENV = 'DEEPLINE_ACTIVE_ORG_NAME';
55
55
  * retained for older CLIs that hide command groups whose key is absent.
56
56
  */
57
57
  export const FEATURES_ENV = 'DEEPLINE_FEATURES';
58
+ /**
59
+ * The workspace this CLI acts in (org-teams-scim, Phase 4b). In a process
60
+ * environment it is a one-off choice; saved by `deepline org workspace set` it sits
61
+ * in the same file as the credential it belongs to. Absent: the org's default
62
+ * workspace.
63
+ */
64
+ export const WORKSPACE_ID_ENV = 'DEEPLINE_WORKSPACE_ID';
58
65
 
59
66
  /** Production API base URL. */
60
67
  const PROD_URL = 'https://code.deepline.com';
61
68
 
62
69
  /** Default request timeout: 60 seconds. */
63
- const DEFAULT_TIMEOUT = 60_000;
70
+ export const DEFAULT_TIMEOUT = 60_000;
64
71
 
65
72
  /** Default retry count for transient failures. */
66
- const DEFAULT_MAX_RETRIES = 3;
73
+ export const DEFAULT_MAX_RETRIES = 3;
74
+
75
+ /**
76
+ * Gateway, overload and rate-limit statuses that carry no answer yet: a
77
+ * required request retries them like a transport failure.
78
+ */
79
+ export const TRANSIENT_HTTP_STATUSES: ReadonlySet<number> = new Set([
80
+ 408, 425, 429, 502, 503, 504,
81
+ ]);
82
+
83
+ /** Backoff before automatic retry `retry` (1-based): 1 s doubling, capped at 30 s. */
84
+ export function defaultRetryBackoffMs(retry: number): number {
85
+ return Math.min(1000 * 2 ** (retry - 1), 30_000);
86
+ }
67
87
 
68
88
  const PROJECT_DEEPLINE_ENV_FILE = '.env.deepline';
69
89
  const COWORK_IGNORED_WORKSPACE_DIRS = new Set([
@@ -90,6 +110,7 @@ const CLI_ENV_ALLOWED_KEYS = new Set([
90
110
  ACTIVE_ORG_ID_ENV,
91
111
  ACTIVE_ORG_NAME_ENV,
92
112
  FEATURES_ENV,
113
+ WORKSPACE_ID_ENV,
93
114
  ]);
94
115
 
95
116
  /** Env line for a server-reported `features` list; absent input writes nothing. */
@@ -471,6 +492,16 @@ function mergePersistedEnvValues(
471
492
  delete merged[ACTIVE_ORG_ID_ENV];
472
493
  delete merged[ACTIVE_ORG_NAME_ENV];
473
494
  delete merged[FEATURES_ENV];
495
+ delete merged[WORKSPACE_ID_ENV];
496
+ }
497
+ // A saved workspace belongs to one org: choosing another org (or a new key for
498
+ // an unknown one) returns this credential to the new org's default workspace.
499
+ if (
500
+ values[WORKSPACE_ID_ENV] === undefined &&
501
+ values[ACTIVE_ORG_ID_ENV] !== undefined &&
502
+ values[ACTIVE_ORG_ID_ENV] !== existing[ACTIVE_ORG_ID_ENV]
503
+ ) {
504
+ delete merged[WORKSPACE_ID_ENV];
474
505
  }
475
506
  // An explicit empty features list means "none": drop the stale line
476
507
  // rather than keeping the previous workspace's features around.
@@ -633,6 +664,85 @@ export function resolveBaseUrlOnly(options?: DeeplineClientOptions): string {
633
664
  return baseUrl;
634
665
  }
635
666
 
667
+ /** Where the workspace a CLI request acts in comes from. */
668
+ export type CliWorkspaceSource = 'option' | 'env' | 'saved' | 'default';
669
+
670
+ /**
671
+ * The file that holds the credential this process uses, or null when the key
672
+ * comes from the process environment or an explicit option (nothing to save
673
+ * a workspace next to).
674
+ */
675
+ export function resolveCredentialEnvFile(
676
+ config: Pick<ResolvedConfig, 'baseUrl' | 'apiKey'>,
677
+ startDir: string = process.cwd(),
678
+ ): { scope: 'folder' | 'global'; filePath: string; env: EnvValues } | null {
679
+ const apiKey = config.apiKey.trim();
680
+ if (!apiKey || process.env[API_KEY_ENV]?.trim()) return null;
681
+ const folder = getResolvedProjectAuthSource(config.baseUrl, apiKey, startDir);
682
+ if (folder) {
683
+ return { scope: 'folder', filePath: folder.filePath, env: folder.env };
684
+ }
685
+ const filePath = sdkCliEnvFilePath(config.baseUrl);
686
+ const env = parseEnvFile(filePath);
687
+ return (env[API_KEY_ENV] ?? '').trim() === apiKey
688
+ ? { scope: 'global', filePath, env }
689
+ : null;
690
+ }
691
+
692
+ /**
693
+ * The workspace for this process: an explicit option, then `DEEPLINE_WORKSPACE_ID` in
694
+ * the process environment, then the workspace saved next to the credential in
695
+ * use, else the org's default workspace (null).
696
+ */
697
+ export function resolveCliWorkspace(
698
+ config: Pick<ResolvedConfig, 'baseUrl' | 'apiKey'>,
699
+ explicitWorkspace?: string | null,
700
+ ): { workspaceId: string | null; source: CliWorkspaceSource } {
701
+ const option = explicitWorkspace?.trim();
702
+ if (option) return { workspaceId: option, source: 'option' };
703
+ const env = process.env[WORKSPACE_ID_ENV]?.trim();
704
+ if (env) return { workspaceId: env, source: 'env' };
705
+ const saved = resolveCredentialEnvFile(config)?.env[WORKSPACE_ID_ENV]?.trim();
706
+ if (saved) return { workspaceId: saved, source: 'saved' };
707
+ return { workspaceId: null, source: 'default' };
708
+ }
709
+
710
+ /**
711
+ * Saves (or, with null, clears) the workspace next to the credential in use, in
712
+ * the same file `deepline org set` wrote. Refuses when the key comes from the
713
+ * process environment: there is no file to save it in.
714
+ */
715
+ export function saveCliWorkspace(
716
+ config: Pick<ResolvedConfig, 'baseUrl' | 'apiKey'>,
717
+ workspaceId: string | null,
718
+ ): { scope: 'folder' | 'global'; filePath: string } {
719
+ const target = resolveCredentialEnvFile(config);
720
+ if (!target) {
721
+ throw new ConfigError(
722
+ `${API_KEY_ENV} comes from the environment, so there is no saved auth to add a workspace to. Set ${WORKSPACE_ID_ENV} for that invocation instead.`,
723
+ );
724
+ }
725
+ const values = { [WORKSPACE_ID_ENV]: workspaceId ?? '' };
726
+ if (target.scope === 'folder') {
727
+ mergeProjectEnvFile(target.filePath, values);
728
+ } else {
729
+ saveHostEnvValues(config.baseUrl, values);
730
+ }
731
+ return { scope: target.scope, filePath: target.filePath };
732
+ }
733
+
734
+ function workspaceConfig(
735
+ baseUrl: string,
736
+ apiKey: string,
737
+ explicitWorkspace: string | undefined,
738
+ ): { workspace?: string } {
739
+ const { workspaceId } = resolveCliWorkspace(
740
+ { baseUrl, apiKey },
741
+ explicitWorkspace,
742
+ );
743
+ return workspaceId ? { workspace: workspaceId } : {};
744
+ }
745
+
636
746
  export function resolveConfig(options?: DeeplineClientOptions): ResolvedConfig {
637
747
  const baseUrl = normalizeBaseUrl(
638
748
  options?.baseUrl?.trim() || autoDetectBaseUrl(),
@@ -656,6 +766,7 @@ export function resolveConfig(options?: DeeplineClientOptions): ResolvedConfig {
656
766
  baseUrl,
657
767
  timeout: options?.timeout ?? DEFAULT_TIMEOUT,
658
768
  maxRetries: options?.maxRetries ?? DEFAULT_MAX_RETRIES,
769
+ ...workspaceConfig(baseUrl, apiKey, options?.workspace),
659
770
  // Pass through untouched: the transport owns case-insensitive merging so
660
771
  // there is exactly one place that decides which header wins.
661
772
  ...(options?.headers ? { headers: { ...options.headers } } : {}),
@@ -55,11 +55,13 @@ export class CustomerDbQueryOutcomeUnknownError extends DeeplineError {
55
55
 
56
56
  export {
57
57
  DeeplineError,
58
+ ProviderRejectedError,
58
59
  ProviderTransientError,
59
60
  ToolExecutionError,
60
61
  getProviderUnavailableReason,
61
62
  isProviderUnavailable,
62
63
  isProviderWaterfallUnavailableError,
64
+ type ProviderRejectionCode,
63
65
  type ProviderTransientErrorCategory,
64
66
  type ProviderUnavailableError,
65
67
  type ProviderUnavailableReason,
@@ -23,6 +23,7 @@
23
23
  import type { ResolvedConfig } from './types';
24
24
  import {
25
25
  AuthError,
26
+ ConfigError,
26
27
  DeeplineError,
27
28
  RateLimitError,
28
29
  ToolExecutionError,
@@ -34,8 +35,10 @@ import {
34
35
  serializeToolExecutionFailure,
35
36
  TOOL_EXECUTION_ERROR_SCHEMA_VERSION,
36
37
  } from '../../shared_libs/plays/tool-execution-error';
38
+ import { playRunIdLookupPrefix } from '../../shared_libs/play-runtime/run-identity';
37
39
  import { SDK_API_CONTRACT, SDK_VERSION } from './version';
38
40
  import { apiErrorCodeFromResponse, apiErrorMessage } from './api-error';
41
+ import { attachToolFailureHint } from './tool-failure-hint';
39
42
  import type { LiveEventEnvelope } from './types';
40
43
  import {
41
44
  agentSessionIdFromEnvironment,
@@ -367,7 +370,35 @@ function isRecord(value: unknown): value is Record<string, unknown> {
367
370
  * const result = await http.post('/api/v2/integrations/apollo/execute', { payload: input });
368
371
  * ```
369
372
  */
373
+ /**
374
+ * A Play run id inside a request path or query, raw or percent-encoded: the
375
+ * short form, optionally followed by its caller hash tail. Only ids that
376
+ * cannot be read as written (`playRunIdLookupPrefix`) are looked up.
377
+ */
378
+ const PLAY_RUN_ID_IN_PATH =
379
+ /play(?:\/|%2F)(?:[a-z0-9-]+(?:\/|%2F))+run(?:\/|%2F)\d{8}t\d{6}-\d{3}-[a-z0-9]{8}(?:-caller-[a-f0-9]*)?(?![A-Za-z0-9-])/gi;
380
+
381
+ /** Each run id in `path` to look up, with the short id it is looked up by. */
382
+ function runIdsToLookUp(path: string): Map<string, string> {
383
+ const found = new Map<string, string>();
384
+ if (path.startsWith('/api/v2/runs/resolve')) return found;
385
+ for (const raw of path.match(PLAY_RUN_ID_IN_PATH) ?? []) {
386
+ let decoded: string;
387
+ try {
388
+ decoded = decodeURIComponent(raw);
389
+ } catch {
390
+ continue;
391
+ }
392
+ const lookup = playRunIdLookupPrefix(decoded);
393
+ if (lookup) found.set(raw, lookup);
394
+ }
395
+ return found;
396
+ }
397
+
370
398
  export class HttpClient {
399
+ /** Full run ids by the short id that named them, for this client's life. */
400
+ private readonly resolvedRunIds = new Map<string, string>();
401
+
371
402
  constructor(
372
403
  private config: ResolvedConfig,
373
404
  private readonly readLocalSkillsVersion?: (
@@ -426,6 +457,15 @@ export class HttpClient {
426
457
  if (skillsVersion) {
427
458
  headers['X-Deepline-Skills-Version'] = skillsVersion;
428
459
  }
460
+ // The server checks workspace access on every request; no workspace is
461
+ // the org's default workspace. The header is TEAM_HEADER in
462
+ // @deepline/auth; `x-deepline-workspace-id` is a shipped header that
463
+ // names the org, so the workspace uses its own name.
464
+ const workspace =
465
+ this.config.workspace ?? env.DEEPLINE_WORKSPACE_ID?.trim();
466
+ if (workspace) {
467
+ headers['x-deepline-org-workspace-id'] = workspace;
468
+ }
429
469
  const agentSessionId = agentSessionIdFromEnvironment(env);
430
470
  if (agentSessionId) {
431
471
  headers['X-Deepline-Agent-Session-Id'] = agentSessionId;
@@ -508,6 +548,43 @@ export class HttpClient {
508
548
  );
509
549
  }
510
550
 
551
+ /**
552
+ * Swap each run id in `path` that cannot be read as written for the full
553
+ * one: a short id, or a caller id with a damaged hash tail. Every run
554
+ * endpoint takes the full id. A run the lookup cannot find keeps its id, so
555
+ * the endpoint answers with its own error.
556
+ */
557
+ private async expandRunIds(
558
+ path: string,
559
+ lookups: Map<string, string>,
560
+ ): Promise<string> {
561
+ const replacements = new Map<string, string>();
562
+ for (const [raw, short] of lookups) {
563
+ let full = this.resolvedRunIds.get(short);
564
+ if (!full) {
565
+ try {
566
+ const resolved = await this.request<{ runId: string }>(
567
+ `/api/v2/runs/resolve?id=${encodeURIComponent(short)}`,
568
+ );
569
+ full = resolved.runId;
570
+ } catch (error) {
571
+ if (error instanceof DeeplineError && error.statusCode === 404) {
572
+ continue;
573
+ }
574
+ throw error;
575
+ }
576
+ this.resolvedRunIds.set(short, full);
577
+ }
578
+ replacements.set(raw, /%2f/i.test(raw) ? encodeURIComponent(full) : full);
579
+ }
580
+ return replacements.size === 0
581
+ ? path
582
+ : path.replace(
583
+ PLAY_RUN_ID_IN_PATH,
584
+ (raw) => replacements.get(raw) ?? raw,
585
+ );
586
+ }
587
+
511
588
  /**
512
589
  * Send an HTTP request with automatic retries and error handling.
513
590
  *
@@ -520,9 +597,14 @@ export class HttpClient {
520
597
  * @throws {@link DeeplineError} on other API errors or connection failures
521
598
  */
522
599
  async request<T = unknown>(
523
- path: string,
600
+ rawPath: string,
524
601
  options?: RequestOptions,
525
602
  ): Promise<T> {
603
+ // Requests that name no unreadable run id must not gain an `await`,
604
+ // which would shift their timing.
605
+ const lookups = runIdsToLookUp(rawPath);
606
+ const path =
607
+ lookups.size > 0 ? await this.expandRunIds(rawPath, lookups) : rawPath;
526
608
  const baseUrl = this.config.baseUrl;
527
609
  const url = `${baseUrl}${path}`;
528
610
  const method = options?.method ?? 'GET';
@@ -630,10 +712,6 @@ export class HttpClient {
630
712
 
631
713
  networkPhase = 'reading_body';
632
714
  options?.onResponse?.(response);
633
- if (response.status === 404 && options?.allowNotFound) {
634
- clearTimeout(timeoutId);
635
- return null as T;
636
- }
637
715
 
638
716
  // Receiving headers is not completion: a stalled response body must
639
717
  // remain inside the same request deadline and abort its connection.
@@ -641,6 +719,10 @@ export class HttpClient {
641
719
  const receivedAtMs = Date.now();
642
720
  clearTimeout(timeoutId);
643
721
  const parsed = parseResponseBody(body);
722
+ throwIfTeamNotFound(response.status, parsed);
723
+ if (response.status === 404 && options?.allowNotFound) {
724
+ return null as T;
725
+ }
644
726
  options?.onResponseBody?.({
645
727
  receivedAtMs,
646
728
  httpStatus: response.status,
@@ -689,9 +771,15 @@ export class HttpClient {
689
771
  };
690
772
  break;
691
773
  }
692
- throw attachToolUpstreamResponse(lastError, parsed);
774
+ throw attachToolFailureHint(
775
+ attachToolUpstreamResponse(lastError, parsed),
776
+ parsed,
777
+ );
693
778
  }
694
- throw attachToolUpstreamResponse(structuredToolError, parsed);
779
+ throw attachToolFailureHint(
780
+ attachToolUpstreamResponse(structuredToolError, parsed),
781
+ parsed,
782
+ );
695
783
  }
696
784
 
697
785
  if (response.status === 429) {
@@ -946,9 +1034,14 @@ export class HttpClient {
946
1034
  }
947
1035
 
948
1036
  async *streamSse<TEvent extends LiveEventEnvelope = LiveEventEnvelope>(
949
- path: string,
1037
+ rawPath: string,
950
1038
  options?: StreamOptions,
951
1039
  ): AsyncGenerator<TEvent> {
1040
+ // Requests that name no unreadable run id must not gain an `await`,
1041
+ // which would shift their timing.
1042
+ const lookups = runIdsToLookUp(rawPath);
1043
+ const path =
1044
+ lookups.size > 0 ? await this.expandRunIds(rawPath, lookups) : rawPath;
952
1045
  const url = `${this.config.baseUrl}${path}`;
953
1046
  const method = options?.method ?? 'GET';
954
1047
  const headers = this.authHeaders({
@@ -980,6 +1073,7 @@ export class HttpClient {
980
1073
  if (!response.ok) {
981
1074
  const body = await response.text();
982
1075
  const parsed = parseResponseBody(body);
1076
+ throwIfTeamNotFound(response.status, parsed);
983
1077
  if (
984
1078
  response.status === 401 &&
985
1079
  !isProviderOriginatedHttpError(parsed)
@@ -1138,6 +1232,22 @@ export class HttpClient {
1138
1232
  }
1139
1233
  }
1140
1234
 
1235
+ /**
1236
+ * An unknown selected workspace answers 404 `TEAM_NOT_FOUND` on any route.
1237
+ * Callers read a bare 404 as "endpoint or resource missing" (unsupported
1238
+ * server, play not found, legacy fallback), so surface it as a configuration
1239
+ * error with no 404 status that names the workspace setting instead.
1240
+ */
1241
+ function throwIfTeamNotFound(status: number, parsed: unknown): void {
1242
+ if (status !== 404 || apiErrorCodeFromResponse(parsed) !== 'TEAM_NOT_FOUND') {
1243
+ return;
1244
+ }
1245
+ throw new ConfigError(
1246
+ `${apiErrorMessage(parsed, status)} Check --workspace or ` +
1247
+ 'DEEPLINE_WORKSPACE_ID; unset it to use the default workspace.',
1248
+ );
1249
+ }
1250
+
1141
1251
  function parseResponseBody(body: string): unknown {
1142
1252
  try {
1143
1253
  return JSON.parse(body);
@@ -1258,8 +1368,12 @@ function parseRetryAfterHint(response: Response): RetryAfterHint | null {
1258
1368
  const header = response.headers.get('retry-after');
1259
1369
  if (header) {
1260
1370
  const seconds = Number(header);
1261
- if (Number.isFinite(seconds) && seconds > 0) {
1262
- return { delayMs: seconds * 1000, exact: false };
1371
+ if (Number.isFinite(seconds)) {
1372
+ return seconds > 0 ? { delayMs: seconds * 1000, exact: false } : null;
1373
+ }
1374
+ const retryAtMs = Date.parse(header);
1375
+ if (Number.isFinite(retryAtMs)) {
1376
+ return { delayMs: Math.max(0, retryAtMs - Date.now()), exact: false };
1263
1377
  }
1264
1378
  }
1265
1379
  return null;
@@ -272,6 +272,7 @@ export { DEEPLINE_TOOL_CATEGORIES } from '../../shared_libs/plays/tool-categorie
272
272
  export {
273
273
  DeeplineError,
274
274
  CustomerDbQueryOutcomeUnknownError,
275
+ ProviderRejectedError,
275
276
  ProviderTransientError,
276
277
  ToolExecutionError,
277
278
  getProviderUnavailableReason,
@@ -283,6 +284,7 @@ export {
283
284
  ConfigError,
284
285
  } from './errors';
285
286
  export type {
287
+ ProviderRejectionCode,
286
288
  ProviderTransientErrorCategory,
287
289
  ProviderUnavailableError,
288
290
  ProviderUnavailableReason,
@@ -48,7 +48,7 @@ async function findConnection(
48
48
  );
49
49
  if (matches.length === 0)
50
50
  throw new DeeplineError(
51
- `No workspace connection named ${JSON.stringify(name)}. Run deepline integrations list --json.`,
51
+ `No org connection named ${JSON.stringify(name)}. Run deepline integrations list --json.`,
52
52
  404,
53
53
  'NOT_FOUND',
54
54
  );
@@ -76,9 +76,11 @@ async function changeConnection(
76
76
  invalid('Use --list-calendars with Google Workspace verify or reconnect.');
77
77
  if (row.type === 'workspace_delegation') {
78
78
  if (row.provider !== CALENDAR_PROVIDER || !row.domain)
79
- invalid('The workspace approval is missing its provider or domain.');
79
+ invalid(
80
+ 'The Google Workspace approval is missing its provider or domain.',
81
+ );
80
82
  if (row.authorizationVersion === undefined)
81
- invalid('The API did not return a workspace approval revision.');
83
+ invalid('The API did not return a Google Workspace approval revision.');
82
84
  if (action === 'reconnect') {
83
85
  return verifyWorkspace(client, row.domain, options, row);
84
86
  }
@@ -152,7 +154,7 @@ async function verifyWorkspace(
152
154
  }
153
155
  : await client.getCalendarDelegation(undefined, undefined, domain);
154
156
  if (settings.grantRevision === undefined)
155
- invalid('The API did not return a workspace approval revision.');
157
+ invalid('The API did not return a Google Workspace approval revision.');
156
158
  const requestedScopes = [
157
159
  ...new Set([
158
160
  GOOGLE_WORKSPACE_AVAILABILITY_SCOPE,
@@ -68,6 +68,7 @@ import {
68
68
  QUERY_RESULT_DATASET_PAGE_SIZE,
69
69
  isCustomerDbDatasetTool,
70
70
  isQueryResultDatasetTool,
71
+ readQueryResultDatasetResultRef,
71
72
  } from '../../shared_libs/play-runtime/query-result-dataset.js';
72
73
  import type {
73
74
  PlayDataset,
@@ -1652,6 +1653,7 @@ function attachSdkQueryResultDatasetResult(
1652
1653
  const datasetLimit =
1653
1654
  finitePositiveInteger(dataset.returned_limit) ?? totalRows;
1654
1655
  const effectiveCount = Math.min(totalRows, datasetLimit);
1656
+ const storedResultRef = readQueryResultDatasetResultRef(dataset);
1655
1657
  const rawRows = rowsFromUnknown(raw?.rows);
1656
1658
  const previewRows = rawRows.slice(0, 25);
1657
1659
  const fetchPage = async (
@@ -1668,6 +1670,7 @@ function attachSdkQueryResultDatasetResult(
1668
1670
  offset,
1669
1671
  page_size: Math.min(limit, QUERY_RESULT_DATASET_PAGE_SIZE),
1670
1672
  total_rows: totalRows,
1673
+ ...(storedResultRef ? { result_ref: storedResultRef } : {}),
1671
1674
  },
1672
1675
  ...(isCustomerDbDatasetTool(toolId)
1673
1676
  ? {
@@ -300,7 +300,7 @@ export async function preparePlayRunAdmission(
300
300
  (request.admissionOrgId && request.admissionOrgId !== capability.orgId))
301
301
  ) {
302
302
  throw new DeeplineError(
303
- 'The admission workspace could not be pinned to this request; execution was not submitted.',
303
+ 'The admission org could not be pinned to this request; execution was not submitted.',
304
304
  409,
305
305
  'PLAY_RUN_ADMISSION_TENANT_CONFLICT',
306
306
  );
@@ -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.551',
208
+ version: '0.3.553',
209
209
  updateSummary: {
210
210
  introducedIn: '0.3.90',
211
211
  summary:
@@ -7,6 +7,7 @@ import {
7
7
  type PlayRunStreamDiffState,
8
8
  type PlayRunStreamEvent,
9
9
  } from '../../../shared_libs/play-runtime/run-snapshot-stream.js';
10
+ import { DeeplineError } from '../errors';
10
11
  import { isTransientPlayRunReadError } from './read-errors';
11
12
 
12
13
  /** Steady-state cadence for the small authenticated REST snapshot. */
@@ -22,21 +23,32 @@ const RUN_WATCH_STARTUP_WINDOW_MS = 6_000;
22
23
  const RUN_WATCH_INTERACTIVE_POLL_INTERVAL_MS = 500;
23
24
  const RUN_WATCH_INTERACTIVE_WINDOW_MS = 30_000;
24
25
  /**
25
- * Server-held wait per snapshot request once the startup window has passed:
26
- * the run route answers as soon as the run is terminal, or after this bound,
27
- * so terminal detection no longer waits out the 2 s cadence. 0 (off) keeps
28
- * client-side polling only. Used only by watchers that defer logs, whose
29
- * progress output does not depend on intermediate snapshots. Lands off.
26
+ * Server-held wait per snapshot request: the run route answers as soon as the
27
+ * run is terminal, or after this bound, so terminal detection no longer waits
28
+ * out the client cadence. Used only by watchers that defer logs, whose
29
+ * progress output does not depend on intermediate snapshots. The route holds
30
+ * only for organizations its rollout lists and says so in
31
+ * `RUN_WATCH_HOLD_HEADER`; any other answer (an older server, an unlisted
32
+ * organization) ends server waiting for this watch, which then keeps its
33
+ * ordinary client cadence. 0 turns it off.
30
34
  */
31
- export const RUN_WATCH_SERVER_WAIT_MS = 0;
35
+ export const RUN_WATCH_SERVER_WAIT_MS = 20_000;
32
36
  /**
33
37
  * Use the server-held wait from the first snapshot request instead of only
34
38
  * after the startup window, so a short run is seen as soon as it is terminal
35
39
  * rather than on the next 300 ms poll. Same watchers (deferred logs) and the
36
- * same bounded server wait. Off.
40
+ * same bounded server wait.
37
41
  */
38
- export const RUN_WATCH_SERVER_WAIT_FROM_START = false;
42
+ export const RUN_WATCH_SERVER_WAIT_FROM_START = true;
43
+ /** Response header in which the run route reports whether it held a request. */
44
+ export const RUN_WATCH_HOLD_HEADER = 'x-deepline-run-watch-hold';
39
45
  export const TERMINAL_LOG_PROJECTION_RETRY_LIMIT = 3;
46
+ /**
47
+ * Wait between those retries. The run is already terminal; only its final
48
+ * log projection is catching up, so a short fixed wait (not the poll cadence,
49
+ * up to 2 s) bounds the extra time to under a second.
50
+ */
51
+ export const TERMINAL_LOG_PROJECTION_RETRY_INTERVAL_MS = 250;
40
52
 
41
53
  type WatchHttp = {
42
54
  get<T = unknown>(
@@ -232,6 +244,9 @@ export async function* watchRunEvents(
232
244
  let outageNoticeSent = false;
233
245
  let pollCount = 0;
234
246
  let terminalLogProjectionRetries = 0;
247
+ // Set once a held request comes back without `applied`: this watch then
248
+ // stops asking and keeps the ordinary client cadence.
249
+ let serverHoldDeclined = false;
235
250
 
236
251
  while (!signal?.aborted) {
237
252
  const pollStartedAt = Date.now();
@@ -244,20 +259,23 @@ export async function* watchRunEvents(
244
259
  const serverWaitMs =
245
260
  options.pollIntervalMs === undefined &&
246
261
  options.deferLogs &&
262
+ !serverHoldDeclined &&
247
263
  (pastStartup || RUN_WATCH_SERVER_WAIT_FROM_START) &&
248
264
  RUN_WATCH_SERVER_WAIT_MS > 0
249
265
  ? RUN_WATCH_SERVER_WAIT_MS
250
266
  : 0;
251
- // A held request already waited server-side; poll again immediately.
252
- const pollIntervalMs =
267
+ const clientPollIntervalMs =
253
268
  options.pollIntervalMs ??
254
- (serverWaitMs > 0
255
- ? 0
256
- : pastInteractive
257
- ? RUN_WATCH_POLL_INTERVAL_MS
258
- : pastStartup
259
- ? RUN_WATCH_INTERACTIVE_POLL_INTERVAL_MS
260
- : RUN_WATCH_STARTUP_POLL_INTERVAL_MS);
269
+ (pastInteractive
270
+ ? RUN_WATCH_POLL_INTERVAL_MS
271
+ : pastStartup
272
+ ? RUN_WATCH_INTERACTIVE_POLL_INTERVAL_MS
273
+ : RUN_WATCH_STARTUP_POLL_INTERVAL_MS);
274
+ // The client cadence is measured from the poll's start, so a request the
275
+ // server really held (up to its bound) is followed at once, while an
276
+ // instant answer of any kind still waits the ordinary interval: no server
277
+ // answer can make a loop.
278
+ const pollIntervalMs = clientPollIntervalMs;
261
279
  let snapshot: PlayRunLiveSnapshot;
262
280
  let terminalStatus: Record<string, unknown> | undefined;
263
281
  let responseStatus: number | undefined;
@@ -281,17 +299,27 @@ export async function* watchRunEvents(
281
299
  const response = await http.get<unknown>(
282
300
  serverWaitMs > 0 ? `${path}&waitForTerminalMs=${serverWaitMs}` : path,
283
301
  {
284
- signal,
285
- ...(options.onPoll
286
- ? {
287
- onResponse: (response: Response) => {
288
- responseStatus = response.status;
289
- serverTiming =
290
- response.headers.get('server-timing') ?? undefined;
291
- },
292
- }
293
- : {}),
294
- });
302
+ signal,
303
+ ...(options.onPoll || serverWaitMs > 0
304
+ ? {
305
+ onResponse: (response: Response) => {
306
+ responseStatus = response.status;
307
+ serverTiming =
308
+ response.headers.get('server-timing') ?? undefined;
309
+ // Only a successful answer says whether this server holds;
310
+ // a transient error leaves the ask in place.
311
+ if (
312
+ serverWaitMs > 0 &&
313
+ response.ok &&
314
+ response.headers.get(RUN_WATCH_HOLD_HEADER) !== 'applied'
315
+ ) {
316
+ serverHoldDeclined = true;
317
+ }
318
+ },
319
+ }
320
+ : {}),
321
+ },
322
+ );
295
323
  const parsed = readSnapshotResponse(response, runId);
296
324
  terminalStatus = parsed.terminalStatus;
297
325
  // Deferred watchers need the terminal tail, not a replay of every skipped log.
@@ -310,7 +338,14 @@ export async function* watchRunEvents(
310
338
  if (signal?.aborted) {
311
339
  return;
312
340
  }
313
- if (!isTransientPlayRunReadError(error)) {
341
+ // A client timeout shorter than the server hold: stop asking for the
342
+ // hold in this watch and keep polling, instead of failing it.
343
+ const heldTimeout =
344
+ serverWaitMs > 0 &&
345
+ error instanceof DeeplineError &&
346
+ error.code === 'NETWORK_TIMEOUT';
347
+ if (heldTimeout) serverHoldDeclined = true;
348
+ if (!heldTimeout && !isTransientPlayRunReadError(error)) {
314
349
  throw error;
315
350
  }
316
351
  consecutiveFailures += 1;
@@ -354,7 +389,8 @@ export async function* watchRunEvents(
354
389
  terminalLogProjectionRetries += 1;
355
390
  const remaining = Math.max(
356
391
  0,
357
- pollIntervalMs - (Date.now() - pollStartedAt),
392
+ Math.min(pollIntervalMs, TERMINAL_LOG_PROJECTION_RETRY_INTERVAL_MS) -
393
+ (Date.now() - pollStartedAt),
358
394
  );
359
395
  if (!(await waitForNextPoll(remaining, signal))) return;
360
396
  continue;
@@ -243,6 +243,7 @@ function resolveToolExecuteTimeoutMs(
243
243
  normalized === 'deeplineagent_ai_inference' ||
244
244
  normalized === 'ai_evaluate' ||
245
245
  normalized === 'deeplineagent_ai_evaluate' ||
246
+ normalized === 'ai_decision' ||
246
247
  normalized === 'aiinference'
247
248
  ? DEEPLINEAGENT_EXECUTE_TIMEOUT_MS
248
249
  : undefined;
@@ -362,7 +363,7 @@ export class ToolCalls {
362
363
  options?.recover)
363
364
  ) {
364
365
  throw new DeeplineError(
365
- 'Use a valid workspace connection name without execution recovery.',
366
+ 'Use a valid org connection name without execution recovery.',
366
367
  400,
367
368
  'NAMED_CONNECTION_INVALID',
368
369
  );