deepline 0.3.552 → 0.3.554

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 (323) hide show
  1. package/dist/bundling-sources/sdk/src/client-core.ts +107 -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 +118 -8
  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 +8 -1
  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 +9 -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-resource-failure.ts +26 -3
  43. package/dist/bundling-sources/shared_libs/monitors/signal-radars/inbound-dead-letter.ts +41 -13
  44. package/dist/bundling-sources/shared_libs/monitors/signal-radars/raw-receipt-causes.ts +219 -0
  45. package/dist/bundling-sources/shared_libs/monitors/snitcher-ip2company.ts +21 -10
  46. package/dist/bundling-sources/shared_libs/monitors/starter-templates.ts +13 -0
  47. package/dist/bundling-sources/shared_libs/monitors/tracking-provider-guidance.ts +6 -0
  48. package/dist/bundling-sources/shared_libs/monitors/tracking-provider-integrations.ts +13 -0
  49. package/dist/bundling-sources/shared_libs/observability/dlq.ts +1 -1
  50. package/dist/bundling-sources/shared_libs/observability/log-metadata.ts +5 -3
  51. package/dist/bundling-sources/shared_libs/observability/queue-health.ts +10 -1
  52. package/dist/bundling-sources/shared_libs/observability/queue-item-connectors.ts +1 -0
  53. package/dist/bundling-sources/shared_libs/observability/redaction.ts +24 -1
  54. package/dist/bundling-sources/shared_libs/observability/scheduled-jobs.json +168 -41
  55. package/dist/bundling-sources/shared_libs/observability/scheduled-work-manual.ts +1 -2
  56. package/dist/bundling-sources/shared_libs/play-data-plane/preview-r2-oidc.ts +188 -0
  57. package/dist/bundling-sources/shared_libs/play-data-plane/r2.ts +170 -16
  58. package/dist/bundling-sources/shared_libs/play-data-plane/runtime-sheet-storage-contract.ts +5 -0
  59. package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +68 -2
  60. package/dist/bundling-sources/shared_libs/play-runtime/context.ts +444 -39
  61. package/dist/bundling-sources/shared_libs/play-runtime/ctx-fetch-caller-deadline.ts +200 -0
  62. package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +6 -0
  63. package/dist/bundling-sources/shared_libs/play-runtime/deployment/runtime-topology.ts +21 -1
  64. package/dist/bundling-sources/shared_libs/play-runtime/durable-call-cache.ts +3 -2
  65. package/dist/bundling-sources/shared_libs/play-runtime/durable-summary-events.ts +70 -2
  66. package/dist/bundling-sources/shared_libs/play-runtime/durable-tool-identity.ts +3 -3
  67. package/dist/bundling-sources/shared_libs/play-runtime/execution-capabilities.ts +16 -0
  68. package/dist/bundling-sources/shared_libs/play-runtime/experiment-switches.ts +72 -0
  69. package/dist/bundling-sources/shared_libs/play-runtime/fixture-behavior.ts +1 -0
  70. package/dist/bundling-sources/shared_libs/play-runtime/governor/policy.ts +7 -1
  71. package/dist/bundling-sources/shared_libs/play-runtime/internal-bootstrap-token.ts +62 -0
  72. package/dist/bundling-sources/shared_libs/play-runtime/map-memory-limits.ts +74 -3
  73. package/dist/bundling-sources/shared_libs/play-runtime/output-size-limits.ts +31 -3
  74. package/dist/bundling-sources/shared_libs/play-runtime/play-http-request.ts +6 -0
  75. package/dist/bundling-sources/shared_libs/play-runtime/protocol.ts +8 -0
  76. package/dist/bundling-sources/shared_libs/play-runtime/query-result-dataset.ts +19 -0
  77. package/dist/bundling-sources/shared_libs/play-runtime/resource-governor.ts +39 -2
  78. package/dist/bundling-sources/shared_libs/play-runtime/run-failure.ts +9 -1
  79. package/dist/bundling-sources/shared_libs/play-runtime/run-identity.ts +33 -0
  80. package/dist/bundling-sources/shared_libs/play-runtime/run-ledger-projection-contract.ts +24 -0
  81. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/index.ts +254 -44
  82. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-payload-transport.ts +87 -6
  83. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/modal.ts +241 -10
  84. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/early-sandbox-egress.ts +161 -14
  85. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/early-sandbox.ts +16 -3
  86. package/dist/bundling-sources/shared_libs/play-runtime/runtime-api-compression.ts +37 -0
  87. package/dist/bundling-sources/shared_libs/play-runtime/runtime-api-paths.ts +9 -0
  88. package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +259 -52
  89. package/dist/bundling-sources/shared_libs/play-runtime/runtime-authority.ts +13 -0
  90. package/dist/bundling-sources/shared_libs/play-runtime/runtime-constants.ts +30 -0
  91. package/dist/bundling-sources/shared_libs/play-runtime/runtime-operation-contract.ts +62 -1
  92. package/dist/bundling-sources/shared_libs/play-runtime/runtime-scheduler-topology.ts +36 -0
  93. package/dist/bundling-sources/shared_libs/play-runtime/runtime-sheet-row-transition.ts +36 -0
  94. package/dist/bundling-sources/shared_libs/play-runtime/runtime-speed-profile.ts +206 -2
  95. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-pool.ts +42 -0
  96. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +185 -64
  97. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-worker-slot-ledger.ts +157 -0
  98. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/early-sandbox-lane.ts +110 -2
  99. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/early-sandbox-listener-hint.ts +323 -0
  100. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/executor-attempt-standing.ts +72 -0
  101. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/integration-operation-value-storage.ts +23 -4
  102. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-workspace-purge.ts +199 -0
  103. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +632 -66
  104. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/run-ledger-outbox-recovery.ts +517 -16
  105. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-api-origin.ts +1 -1
  106. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-receipt-value-storage.ts +9 -0
  107. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-worker-wake.ts +599 -2
  108. package/dist/bundling-sources/shared_libs/play-runtime/secret-resolution-retry-policy.ts +26 -1
  109. package/dist/bundling-sources/shared_libs/play-runtime/startup-read-tool-ids.ts +60 -0
  110. package/dist/bundling-sources/shared_libs/play-runtime/test-runtime-seams.ts +51 -0
  111. package/dist/bundling-sources/shared_libs/play-runtime/tool-call-retry-facts.ts +2 -0
  112. package/dist/bundling-sources/shared_libs/play-runtime/tool-execute-retry-policy.ts +113 -3
  113. package/dist/bundling-sources/shared_libs/play-runtime/tool-http-errors.ts +5 -7
  114. package/dist/bundling-sources/shared_libs/play-runtime/work-receipt-storage-contract.ts +2 -0
  115. package/dist/bundling-sources/shared_libs/play-runtime/workflow-executor-auth.ts +3 -0
  116. package/dist/bundling-sources/shared_libs/plays/authoring-contract.ts +40 -5
  117. package/dist/bundling-sources/shared_libs/plays/deploy/api-client.ts +3 -0
  118. package/dist/bundling-sources/shared_libs/plays/deploy/control-plane-types.ts +16 -0
  119. package/dist/bundling-sources/shared_libs/plays/deploy/run-deployment.ts +10 -41
  120. package/dist/bundling-sources/shared_libs/plays/extension-bridge.ts +33 -0
  121. package/dist/bundling-sources/shared_libs/plays/row-identity.ts +18 -1
  122. package/dist/bundling-sources/shared_libs/plays/tool-execution-error.ts +108 -0
  123. package/dist/bundling-sources/shared_libs/plays/trigger-config-contract.ts +14 -0
  124. package/dist/bundling-sources/shared_libs/product-notifications/catalog.ts +171 -0
  125. package/dist/bundling-sources/shared_libs/product-notifications/events.ts +27 -1
  126. package/dist/bundling-sources/shared_libs/security/email-blacklist.ts +9 -24
  127. package/dist/bundling-sources/shared_libs/security/secret-redaction.ts +178 -5
  128. package/dist/bundling-sources/shared_libs/security/signup-email-dns-screen.ts +148 -0
  129. package/dist/bundling-sources/shared_libs/tool-execution-error.ts +108 -0
  130. package/dist/cli/{auth-KVSBJZOX.mjs → auth-HJUNW7T2.mjs} +8 -7
  131. package/dist/cli/auth-SP6SKZJZ.js +44 -0
  132. package/dist/cli/{billing-FQREA7UA.js → billing-4TSA5HEC.js} +297 -161
  133. package/dist/cli/{billing-54RHFEBI.mjs → billing-SJYRJAQ2.mjs} +197 -61
  134. package/dist/cli/{chunk-4MK42735.js → chunk-2HMN5H54.js} +215 -130
  135. package/dist/cli/{chunk-UBKA33KY.mjs → chunk-2MGZAI54.mjs} +17 -0
  136. package/dist/cli/{chunk-EOPEYCY7.mjs → chunk-2ORPFQUA.mjs} +18 -18
  137. package/dist/cli/{chunk-RQZQVFCJ.js → chunk-2OVHNHCF.js} +2 -2
  138. package/dist/cli/{chunk-QX7LFGJR.mjs → chunk-33WRQSQ2.mjs} +1874 -91
  139. package/dist/cli/{chunk-UPMRIVZB.js → chunk-3IKGZ4CG.js} +74 -13
  140. package/dist/cli/{chunk-EUPVF4SU.mjs → chunk-3Z4VFCXO.mjs} +8 -8
  141. package/dist/cli/{chunk-GKYAYLRI.js → chunk-4DOFGIEJ.js} +27 -31
  142. package/dist/cli/{chunk-4TALT2M3.mjs → chunk-52Q5KETX.mjs} +69 -3
  143. package/dist/cli/{chunk-RBEUVDZF.js → chunk-5CYZHOKI.js} +249 -107
  144. package/dist/cli/{chunk-LX35AXTN.mjs → chunk-5TYLSS4Q.mjs} +6 -6
  145. package/dist/cli/{chunk-IYSTRCLX.mjs → chunk-62AUAWQV.mjs} +4 -4
  146. package/dist/cli/{chunk-ZIAXDBXX.mjs → chunk-62HWJXST.mjs} +17 -21
  147. package/dist/cli/{chunk-QY3ZNU6Z.mjs → chunk-6EXOAT6T.mjs} +2 -2
  148. package/dist/cli/{chunk-EITMD3A5.js → chunk-6VLFQZK6.js} +8 -8
  149. package/dist/cli/{chunk-ADRC5I3R.js → chunk-7OWI736E.js} +30 -30
  150. package/dist/cli/{chunk-NURW5XH4.mjs → chunk-ASB47RXJ.mjs} +1 -1
  151. package/dist/cli/{chunk-PTVD2GVQ.mjs → chunk-B6HO2XWH.mjs} +13 -13
  152. package/dist/cli/{chunk-YJHE3O5M.mjs → chunk-BOZAP2EM.mjs} +141 -56
  153. package/dist/cli/chunk-BVXIGOBZ.js +32 -0
  154. package/dist/cli/{chunk-XDVT3GOM.js → chunk-CFJFUVX2.js} +18 -1
  155. package/dist/cli/{chunk-WE5HES3H.mjs → chunk-D6Z6POKE.mjs} +151 -43
  156. package/dist/cli/{chunk-AZQ264ID.mjs → chunk-DSKSFFK2.mjs} +1 -1
  157. package/dist/cli/{chunk-SHLFOPD6.js → chunk-DUBXUAAO.js} +5 -5
  158. package/dist/cli/{chunk-V436Z54K.js → chunk-E2G2DNAB.js} +3 -1
  159. package/dist/cli/{chunk-HO3XK3R7.js → chunk-E74KGKFZ.js} +8 -8
  160. package/dist/cli/{chunk-77AAAGVB.js → chunk-ECHKAC7M.js} +2 -2
  161. package/dist/cli/{chunk-KWSH5T7K.js → chunk-EN5NHCCQ.js} +21 -21
  162. package/dist/cli/{chunk-6RZOWL2V.mjs → chunk-F7CMRKSK.mjs} +1 -1
  163. package/dist/cli/{chunk-JWUAX6OP.js → chunk-FBAFX43W.js} +11 -11
  164. package/dist/cli/{chunk-AQWQ2BFX.mjs → chunk-FXQ3JKE3.mjs} +1 -1
  165. package/dist/cli/{chunk-QPKH23EC.mjs → chunk-GA2M3G3Y.mjs} +5 -5
  166. package/dist/cli/{chunk-G4O75EXF.js → chunk-GHT2NDL7.js} +18 -18
  167. package/dist/cli/{chunk-MF2GHZDO.js → chunk-GRZENGNE.js} +2 -2
  168. package/dist/cli/{chunk-4UUR4TCH.js → chunk-IVZKMJUK.js} +1875 -92
  169. package/dist/cli/{chunk-FTJLJCE5.mjs → chunk-KVBQY4ST.mjs} +3 -3
  170. package/dist/cli/{chunk-S5S355UY.mjs → chunk-KZHBDMGF.mjs} +12 -12
  171. package/dist/cli/{chunk-BBTKAASQ.js → chunk-LFQJW4S2.js} +42 -1
  172. package/dist/cli/{chunk-6ZORHRKB.mjs → chunk-LRZGS6RZ.mjs} +2 -0
  173. package/dist/cli/{chunk-2WFPHBR4.js → chunk-LY5MMXFF.js} +47 -29
  174. package/dist/cli/{chunk-BAIST2BR.js → chunk-M7STM3MZ.js} +36 -36
  175. package/dist/cli/{chunk-SL6MYJYM.js → chunk-MJTVX4QK.js} +35 -35
  176. package/dist/cli/{chunk-45PVGZST.js → chunk-OPTV7D2V.js} +508 -361
  177. package/dist/cli/{chunk-PFO3ISXA.js → chunk-OVEYWO4H.js} +174 -129
  178. package/dist/cli/{chunk-BGBJV26E.mjs → chunk-PC2FTUCP.mjs} +4 -4
  179. package/dist/cli/{chunk-WLN3SUIA.js → chunk-PQQMPUCZ.js} +3 -3
  180. package/dist/cli/{chunk-HYC4MKGK.mjs → chunk-Q7ACILL2.mjs} +5 -5
  181. package/dist/cli/{chunk-CBV7AKWM.js → chunk-R6DZ6NQ2.js} +5 -5
  182. package/dist/cli/{chunk-57VZVF5D.mjs → chunk-RBBTCYQB.mjs} +3 -3
  183. package/dist/cli/{chunk-F2LH7TGF.js → chunk-RTHMGSZX.js} +21 -21
  184. package/dist/cli/{chunk-YLTMXJFC.mjs → chunk-S6W6SJ6E.mjs} +158 -16
  185. package/dist/cli/chunk-STXDSVQZ.mjs +32 -0
  186. package/dist/cli/{chunk-WEHCBH5R.mjs → chunk-TGUQET3O.mjs} +67 -6
  187. package/dist/cli/{chunk-IHRKLXZN.js → chunk-TJ6HLN56.js} +5 -5
  188. package/dist/cli/{chunk-3FD5EQ62.js → chunk-TOO3YM5N.js} +6 -7
  189. package/dist/cli/{chunk-QILKGXYF.mjs → chunk-UBBYHB2B.mjs} +2 -2
  190. package/dist/cli/{chunk-6PRW5UBA.mjs → chunk-UC4BDZKI.mjs} +299 -69
  191. package/dist/cli/{chunk-634ZDA3F.js → chunk-UNNOZKRT.js} +1 -1
  192. package/dist/cli/{chunk-IDVVIXPJ.js → chunk-UOT7HPBH.js} +41 -41
  193. package/dist/cli/{chunk-6YCA5NKJ.js → chunk-UYCZFQYQ.js} +12 -12
  194. package/dist/cli/{chunk-7IKQKKNX.js → chunk-VIUUTEHY.js} +90 -24
  195. package/dist/cli/{chunk-Z5TSLLOW.mjs → chunk-VLO5NFH2.mjs} +63 -18
  196. package/dist/cli/{chunk-U7QRMBIY.mjs → chunk-VQ75KX7G.mjs} +5 -5
  197. package/dist/cli/{chunk-4NQF6KJ3.js → chunk-VV4XGZ24.js} +13 -13
  198. package/dist/cli/{chunk-FSIVF2SI.mjs → chunk-VZGLIK5U.mjs} +1 -1
  199. package/dist/cli/{chunk-S46HWQKO.js → chunk-W6CZDTIR.js} +69 -69
  200. package/dist/cli/{chunk-XVB7V4N7.js → chunk-WL7P32PI.js} +161 -53
  201. package/dist/cli/{chunk-DJ2JDK4O.mjs → chunk-XD3MFTHA.mjs} +1 -1
  202. package/dist/cli/{chunk-GGGAEVCX.mjs → chunk-XFZX6FNM.mjs} +40 -22
  203. package/dist/cli/{chunk-AWJPDPMA.mjs → chunk-XU6QNM4D.mjs} +1 -1
  204. package/dist/cli/{chunk-QAORXEY3.mjs → chunk-YCOGPOUX.mjs} +6 -7
  205. package/dist/cli/{chunk-VQALXEXO.js → chunk-YQKCH4R7.js} +348 -118
  206. package/dist/cli/{chunk-6O5HOODW.mjs → chunk-YY55NYAH.mjs} +207 -60
  207. package/dist/cli/{chunk-JL2OTMSG.mjs → chunk-Z3A2S3QM.mjs} +41 -0
  208. package/dist/cli/command-docs.js +3 -3
  209. package/dist/cli/command-docs.mjs +2 -2
  210. package/dist/cli/{concurrent-runs-help-Q4KPAUJX.mjs → concurrent-runs-help-O3Q5IPLF.mjs} +9 -8
  211. package/dist/cli/concurrent-runs-help-ZFRZWX5V.js +22 -0
  212. package/dist/cli/{csv-F5VAGX4K.js → csv-4ZQ2RATI.js} +16 -15
  213. package/dist/cli/{csv-2PTVDNO6.mjs → csv-Y3BFPEM6.mjs} +7 -6
  214. package/dist/cli/{db-IEDXAUF7.mjs → db-3JYY4JNN.mjs} +17 -17
  215. package/dist/cli/{db-Z3OIUFMM.js → db-VEIFS4M7.js} +45 -45
  216. package/dist/cli/describe-EVJ4MFVU.mjs +50 -0
  217. package/dist/cli/describe-FG625QPF.js +50 -0
  218. package/dist/cli/describe-core.d.mts +3 -3
  219. package/dist/cli/describe-core.d.ts +3 -3
  220. package/dist/cli/describe-core.js +7 -7
  221. package/dist/cli/describe-core.mjs +6 -6
  222. package/dist/cli/{executions-H6H5655J.js → executions-HPZXOOVX.js} +12 -12
  223. package/dist/cli/{executions-R3LP74QN.mjs → executions-PCXZKEHM.mjs} +10 -10
  224. package/dist/cli/{feedback-WL3MRVT5.mjs → feedback-Y6VKZNY6.mjs} +9 -8
  225. package/dist/cli/{feedback-VFOUR66B.js → feedback-ZKFHFVL6.js} +17 -16
  226. package/dist/cli/git-RUBMALLH.js +26 -0
  227. package/dist/cli/{git-YX2J4GCI.mjs → git-UMPR2QYC.mjs} +8 -7
  228. package/dist/cli/index.js +170 -158
  229. package/dist/cli/index.mjs +60 -48
  230. package/dist/cli/{integrations-E2JZYKHS.js → integrations-3GQCTRTF.js} +23 -27
  231. package/dist/cli/{integrations-5ZK5KLVP.mjs → integrations-V3TM6XAB.mjs} +15 -19
  232. package/dist/cli/{legacy-noops-SMN3GSXY.mjs → legacy-noops-JZBUD7ZE.mjs} +9 -8
  233. package/dist/cli/{legacy-noops-3VW4IJTH.js → legacy-noops-VYCO7NGW.js} +12 -11
  234. package/dist/cli/{mcp-UQV2K4EW.js → mcp-4OIWTCE6.js} +121 -48
  235. package/dist/cli/{mcp-V6MGCYAG.mjs → mcp-PH4KZ76P.mjs} +100 -27
  236. package/dist/cli/{monitors-R3BBDCRC.js → monitors-E2A6VPBY.js} +221 -186
  237. package/dist/cli/{monitors-GGKS5W6M.mjs → monitors-SSMGIDGX.mjs} +58 -23
  238. package/dist/cli/org-SFDKSK5D.mjs +2289 -0
  239. package/dist/cli/org-WUDZGWBT.js +2289 -0
  240. package/dist/cli/outcomes-QT7LQBPK.mjs +2865 -0
  241. package/dist/cli/outcomes-Y7SZTLSL.js +2865 -0
  242. package/dist/cli/{play-MDWPR4XG.mjs → play-EK7KSFPL.mjs} +376 -106
  243. package/dist/cli/{play-2MVO27VO.js → play-GDNHCRRR.js} +1150 -880
  244. package/dist/cli/{providers-AKDYFZJZ.mjs → providers-FVZLRXAU.mjs} +10 -10
  245. package/dist/cli/{providers-2AACRUZH.js → providers-ZKOSECLV.js} +13 -13
  246. package/dist/cli/{quickstart-H6IV3PV3.js → quickstart-KSDKIXYD.js} +9 -8
  247. package/dist/cli/{quickstart-QDGRJFZY.mjs → quickstart-UJZ6PIQV.mjs} +7 -6
  248. package/dist/cli/{run-RTSQNGRD.mjs → run-E7MZ7P35.mjs} +35 -33
  249. package/dist/cli/{run-2634REDK.js → run-PD2BBG6S.js} +55 -53
  250. package/dist/cli/run-identity-LMLFMACS.js +31 -0
  251. package/dist/cli/{run-identity-MRNCEGV2.mjs → run-identity-MAZ7ANH5.mjs} +9 -3
  252. package/dist/cli/search-TKSPTPHA.js +32 -0
  253. package/dist/cli/{search-6AOJ4XPP.mjs → search-VTFUFTOY.mjs} +11 -11
  254. package/dist/cli/{search-output-S5ODBL5E.js → search-output-G2AGDCOY.js} +13 -12
  255. package/dist/cli/{search-output-6ADMTOU5.mjs → search-output-PFVXQCWA.mjs} +10 -9
  256. package/dist/cli/{secrets-TFIFBFB3.mjs → secrets-7CIMEMX7.mjs} +11 -11
  257. package/dist/cli/{secrets-LHCIIHMT.js → secrets-BCOQ4U7U.js} +20 -20
  258. package/dist/cli/sessions-4CO556VD.js +23 -0
  259. package/dist/cli/{sessions-WHBVUHVW.mjs → sessions-IUCQZEF7.mjs} +9 -8
  260. package/dist/cli/{settings-EBONWL5C.mjs → settings-KZN62UQK.mjs} +16 -16
  261. package/dist/cli/{settings-CP4FVK2W.js → settings-REL4736M.js} +89 -89
  262. package/dist/cli/{setup-I5AZE3IU.mjs → setup-2P7OG3OU.mjs} +22 -24
  263. package/dist/cli/{setup-LFGHTNLQ.js → setup-2XIVBBCS.js} +62 -64
  264. package/dist/cli/skills-JYT5DEY6.js +37 -0
  265. package/dist/cli/{skills-W76AO5XE.mjs → skills-VIGNDJKI.mjs} +10 -9
  266. package/dist/cli/tools-NTVUQ2TG.js +57 -0
  267. package/dist/cli/{tools-7IJHGF6W.mjs → tools-W3QT5EJY.mjs} +24 -24
  268. package/dist/cli/{update-GFOPZTHY.mjs → update-GZVBVMY3.mjs} +14 -11
  269. package/dist/cli/update-TWJZPUZM.js +37 -0
  270. package/dist/cli/{views-D4NX4SBG.mjs → views-BOGEH424.mjs} +47 -49
  271. package/dist/cli/{views-BPL2TQJ4.js → views-TOLJNLSV.js} +62 -64
  272. package/dist/cli/{workflow-ZYNAUCKC.js → workflow-ENWFRK5M.js} +23 -23
  273. package/dist/cli/{workflow-YXP42FUI.mjs → workflow-VDG2FDQV.mjs} +13 -13
  274. package/dist/{client-CyXGrO4D.d.mts → client-B8f7RNF8.d.mts} +1 -1
  275. package/dist/{client-Bf3IpUKN.d.ts → client-C5TgXmJQ.d.ts} +1 -1
  276. package/dist/{client-core-BxsLnXlm.d.mts → client-core-SLLGBTht.d.mts} +268 -23
  277. package/dist/{client-core-BWd0lX0Z.d.ts → client-core-p0sOxnkl.d.ts} +268 -23
  278. package/dist/{compiler-manifest-BqwVrOri.d.ts → compiler-manifest-D_zZEh9Q.d.mts} +70 -5
  279. package/dist/{compiler-manifest-BqwVrOri.d.mts → compiler-manifest-D_zZEh9Q.d.ts} +70 -5
  280. package/dist/{errors-BU8FB99X.d.mts → errors-CZCrBFrQ.d.mts} +1 -1
  281. package/dist/{errors-DfVN_FUG.d.ts → errors-DsUkLrdZ.d.ts} +1 -1
  282. package/dist/{index-BGnvtYGc.d.ts → index-B6RTOZGC.d.ts} +1 -1
  283. package/dist/{index-DjZgwpGw.d.mts → index-DeOVrEmX.d.mts} +1 -1
  284. package/dist/index.d.mts +7 -7
  285. package/dist/index.d.ts +7 -7
  286. package/dist/index.js +66 -55
  287. package/dist/index.mjs +25 -14
  288. package/dist/install-integrity.json +163 -144
  289. package/dist/plays/bundle-play-file.d.mts +3 -3
  290. package/dist/plays/bundle-play-file.d.ts +3 -3
  291. package/dist/plays/bundle-play-file.mjs +23 -4
  292. package/dist/plays/csv-data-input.js +3 -3
  293. package/dist/plays/csv-data-input.mjs +2 -2
  294. package/dist/plays/play-description.d.mts +2 -2
  295. package/dist/plays/play-description.d.ts +2 -2
  296. package/dist/plays/run-request.d.mts +2 -2
  297. package/dist/plays/run-request.d.ts +2 -2
  298. package/dist/plays/run-request.js +4 -4
  299. package/dist/plays/run-request.mjs +3 -3
  300. package/dist/release.d.mts +1 -1
  301. package/dist/release.d.ts +1 -1
  302. package/dist/release.js +2 -2
  303. package/dist/release.mjs +1 -1
  304. package/dist/server.d.mts +4 -4
  305. package/dist/server.d.ts +4 -4
  306. package/dist/server.js +15 -13
  307. package/dist/server.mjs +9 -7
  308. package/package.json +1 -1
  309. package/dist/cli/auth-MMNVWATX.js +0 -43
  310. package/dist/cli/chunk-AID3OYVJ.js +0 -8
  311. package/dist/cli/chunk-OVDNJAJN.mjs +0 -8
  312. package/dist/cli/concurrent-runs-help-FQAIHKKC.js +0 -21
  313. package/dist/cli/describe-QDANCTS3.mjs +0 -50
  314. package/dist/cli/describe-VUTT5ZKU.js +0 -50
  315. package/dist/cli/git-ETB3GH3K.js +0 -25
  316. package/dist/cli/org-GRYVMNSW.js +0 -1282
  317. package/dist/cli/org-Z37NGJV4.mjs +0 -1282
  318. package/dist/cli/run-identity-G257GQED.js +0 -25
  319. package/dist/cli/search-VTW2YNBS.js +0 -32
  320. package/dist/cli/sessions-CJ4FJ2WB.js +0 -22
  321. package/dist/cli/skills-R7EBXREW.js +0 -36
  322. package/dist/cli/tools-V7U2BDXM.js +0 -57
  323. package/dist/cli/update-4COPZETK.js +0 -34
@@ -1,6 +1,39 @@
1
1
  /** Narrow protocol shared by the hosted Play launcher and its Chrome shell. */
2
2
  export const EXTENSION_BRIDGE = 'deepline-play-launcher-v1';
3
+ /** Selects the organization a session request acts in. */
4
+ export const ORG_HEADER = 'x-deepline-org-id';
5
+ /**
6
+ * Deprecated name for {@link ORG_HEADER}; it carries an org id. "Workspace"
7
+ * now names a team inside an org, so first-party clients send ORG_HEADER.
8
+ * Servers keep accepting this header because shipped Chrome extension builds
9
+ * and open dashboard tabs still send it. Remove only after measuring that no
10
+ * client sends it.
11
+ */
3
12
  export const WORKSPACE_HEADER = 'x-deepline-workspace-id';
13
+
14
+ export type RequestedOrgHeader =
15
+ | { kind: 'absent' }
16
+ | { kind: 'org'; orgId: string }
17
+ | { kind: 'conflict'; error: string };
18
+
19
+ /**
20
+ * Reads the requested org from {@link ORG_HEADER} or the legacy
21
+ * {@link WORKSPACE_HEADER}. Blank values count as absent. Both present with
22
+ * different values is a conflict the caller must refuse.
23
+ */
24
+ export function readRequestedOrgHeader(
25
+ headers: Pick<Headers, 'get'>,
26
+ ): RequestedOrgHeader {
27
+ const org = headers.get(ORG_HEADER)?.trim() || undefined;
28
+ const legacy = headers.get(WORKSPACE_HEADER)?.trim() || undefined;
29
+ if (org && legacy && org !== legacy)
30
+ return {
31
+ kind: 'conflict',
32
+ error: `The ${ORG_HEADER} and ${WORKSPACE_HEADER} headers name different organizations. Send only ${ORG_HEADER}.`,
33
+ };
34
+ const orgId = org ?? legacy;
35
+ return orgId ? { kind: 'org', orgId } : { kind: 'absent' };
36
+ }
4
37
  export const EXTENSION_PANEL_PATH = '/extension/plays';
5
38
 
6
39
  export type BridgeFormEntry = [
@@ -191,6 +191,23 @@ export function normalizeTableNamespace(value: string): string {
191
191
  );
192
192
  }
193
193
 
194
+ /**
195
+ * Normalize a tool id for the tool segment of request, receipt and cache keys.
196
+ *
197
+ * Applies the same character folding as `normalizeTableNamespace`, so every id
198
+ * that normalized before yields the same segment. The segment is part of a
199
+ * string key, never a Postgres identifier, so no 63-character limit applies:
200
+ * catalog ids such as `dataforseo_domain_analytics_technologies_domain_technologies_live`
201
+ * are longer.
202
+ */
203
+ export function normalizeToolIdForIdentity(value: string): string {
204
+ const sanitized = sanitizeIdentifierPart(value);
205
+ if (!sanitized) {
206
+ throw new Error('Tool id must contain a letter or number.');
207
+ }
208
+ return sanitized;
209
+ }
210
+
194
211
  export function validatePlaySheetTableName(
195
212
  playName: string,
196
213
  tableNamespace: string,
@@ -240,7 +257,7 @@ export function deriveToolRequestIdentity(input: {
240
257
  toolId,
241
258
  }),
242
259
  );
243
- return `tool:${normalizeTableNamespace(toolId)}:${digest}`;
260
+ return `tool:${normalizeToolIdForIdentity(toolId)}:${digest}`;
244
261
  }
245
262
 
246
263
  /**
@@ -5,6 +5,9 @@ export const TOOL_EXECUTION_ERROR_BRAND = Symbol.for(
5
5
  const PROVIDER_TRANSIENT_ERROR_BRAND = Symbol.for(
6
6
  'deepline.provider-transient-error.v1',
7
7
  );
8
+ const PROVIDER_REJECTED_ERROR_BRAND = Symbol.for(
9
+ 'deepline.provider-rejected-error.v1',
10
+ );
8
11
 
9
12
  export const LEGACY_TOOL_EXECUTION_ERROR_SCHEMA_VERSION = 0 as const;
10
13
  export const TOOL_EXECUTION_ERROR_SCHEMA_VERSION = 1 as const;
@@ -355,6 +358,9 @@ export class ToolExecutionError extends DeeplineError {
355
358
  if (isProviderTransientFailure(options)) {
356
359
  applyBrand(this, PROVIDER_TRANSIENT_ERROR_BRAND);
357
360
  }
361
+ if (isProviderRejectionFailure(options)) {
362
+ applyBrand(this, PROVIDER_REJECTED_ERROR_BRAND);
363
+ }
358
364
  }
359
365
 
360
366
  static [Symbol.hasInstance](value: unknown): boolean {
@@ -388,6 +394,51 @@ export function isProviderTransientFailure(input: {
388
394
  );
389
395
  }
390
396
 
397
+ /**
398
+ * Why a provider rejected the exact request: `UPSTREAM_BAD_INPUT` for its
399
+ * input (upstream 400/422), `UPSTREAM_NOT_FOUND` for the record it names
400
+ * (upstream 404/410).
401
+ *
402
+ * @sdkReference errors 081
403
+ */
404
+ export type ProviderRejectionCode = 'UPSTREAM_BAD_INPUT' | 'UPSTREAM_NOT_FOUND';
405
+
406
+ const PROVIDER_REJECTION_CODES: readonly string[] = [
407
+ 'UPSTREAM_BAD_INPUT',
408
+ 'UPSTREAM_NOT_FOUND',
409
+ ] satisfies readonly ProviderRejectionCode[];
410
+
411
+ /**
412
+ * Whether a provider-owned failure is the provider rejecting this request,
413
+ * from structured fields only. Every rejection is also a provider transient
414
+ * failure, so a read waterfall still falls through it.
415
+ */
416
+ export function isProviderRejectionFailure(input: {
417
+ origin: ToolExecutionErrorOrigin;
418
+ category: ToolExecutionErrorCategory;
419
+ retryable: boolean;
420
+ code?: string | null;
421
+ }): boolean {
422
+ const code = input.code ?? '';
423
+ return (
424
+ isProviderTransientFailure(input) &&
425
+ input.category === 'upstream' &&
426
+ PROVIDER_REJECTION_CODES.includes(code)
427
+ );
428
+ }
429
+
430
+ /** The class name a structured tool failure carries. */
431
+ export function structuredToolErrorName(input: {
432
+ origin: ToolExecutionErrorOrigin;
433
+ category: ToolExecutionErrorCategory;
434
+ retryable: boolean;
435
+ code?: string | null;
436
+ }): 'ProviderRejectedError' | 'ProviderTransientError' | 'ToolExecutionError' {
437
+ if (isProviderRejectionFailure(input)) return 'ProviderRejectedError';
438
+ if (isProviderTransientFailure(input)) return 'ProviderTransientError';
439
+ return 'ToolExecutionError';
440
+ }
441
+
391
442
  /**
392
443
  * A provider-owned transient failure that is safe to handle as an empty
393
444
  * waterfall leg. Validation, auth, billing, Deepline, and unknown failures
@@ -428,6 +479,57 @@ export class ProviderTransientError extends ToolExecutionError {
428
479
  }
429
480
  }
430
481
 
482
+ /**
483
+ * The provider rejected this exact request: its input (upstream 400/422,
484
+ * code `UPSTREAM_BAD_INPUT`) or the record it names (upstream 404/410, code
485
+ * `UPSTREAM_NOT_FOUND`). Repeating the unchanged call fails again.
486
+ *
487
+ * It extends `ProviderTransientError`, so a read waterfall that catches
488
+ * `ProviderTransientError` still moves to its next provider: another provider
489
+ * may accept the same input or find the record. Catch this class first when a
490
+ * rejection needs different handling from an outage.
491
+ *
492
+ * @sdkReference errors 082
493
+ */
494
+ export class ProviderRejectedError extends ProviderTransientError {
495
+ /** Rejections are always a provider's `upstream` answer. */
496
+ declare readonly category: 'upstream';
497
+ /** Which kind of rejection the provider returned. */
498
+ declare readonly code: ProviderRejectionCode;
499
+
500
+ /** Constructed by Deepline when a provider rejects the request. */
501
+ constructor(
502
+ message: string,
503
+ options: Omit<ToolExecutionErrorOptions, 'origin' | 'category' | 'code'> & {
504
+ code: ProviderRejectionCode;
505
+ },
506
+ ) {
507
+ super(message, { ...options, category: 'upstream' });
508
+ this.name = 'ProviderRejectedError';
509
+ applyBrand(this, PROVIDER_REJECTED_ERROR_BRAND);
510
+ }
511
+
512
+ static [Symbol.hasInstance](value: unknown): boolean {
513
+ if (this !== ProviderRejectedError) return nativeInstanceOf(this, value);
514
+ if (hasBrand(value, PROVIDER_REJECTED_ERROR_BRAND)) return true;
515
+ // A runner or SDK from before this class existed brands a rejection only
516
+ // as a tool error. Its structured fields still say what it is.
517
+ if (!hasBrand(value, TOOL_EXECUTION_ERROR_BRAND)) return false;
518
+ const fields = value as {
519
+ origin?: unknown;
520
+ category?: unknown;
521
+ retryable?: unknown;
522
+ code?: unknown;
523
+ };
524
+ return isProviderRejectionFailure({
525
+ origin: fields.origin as ToolExecutionErrorOrigin,
526
+ category: fields.category as ToolExecutionErrorCategory,
527
+ retryable: fields.retryable === true,
528
+ code: typeof fields.code === 'string' ? fields.code : null,
529
+ });
530
+ }
531
+ }
532
+
431
533
  /** Why a provider cannot serve the current read request. */
432
534
  export type ProviderUnavailableReason =
433
535
  | ProviderTransientErrorCategory
@@ -758,6 +860,12 @@ export function deserializeToolExecutionFailure(
758
860
  }
759
861
  const failure = normalizeToolExecutionFailure(value);
760
862
  if (!failure) return null;
863
+ if (isProviderRejectionFailure(failure)) {
864
+ return new ProviderRejectedError(message, {
865
+ ...failure,
866
+ code: failure.code as ProviderRejectionCode,
867
+ });
868
+ }
761
869
  if (isProviderTransientFailure(failure)) {
762
870
  return new ProviderTransientError(message, failure);
763
871
  }
@@ -43,6 +43,12 @@ export const playCronTriggerConfigSchema = z
43
43
  .record(z.string(), z.unknown())
44
44
  .optional()
45
45
  .describe('Static JSON object passed as the input of every cron run.'),
46
+ overlap: z
47
+ .enum(['allow', 'skip'])
48
+ .optional()
49
+ .describe(
50
+ 'While an earlier cron run is still queued or running: "allow" starts another run, "skip" records the occurrence as skipped. Omitted keeps the current policy ("allow" for a new schedule).',
51
+ ),
46
52
  })
47
53
  .strict();
48
54
  export type PlayCronTriggerConfig = z.output<
@@ -112,6 +118,11 @@ export type PlayTriggerConfigCronState = {
112
118
  schedule: string;
113
119
  timezone: string | null;
114
120
  input: Record<string, unknown> | null;
121
+ /**
122
+ * What an occurrence does while an earlier cron run is still queued or
123
+ * running. Absent from older servers, which always allow overlap.
124
+ */
125
+ overlap?: 'allow' | 'skip';
115
126
  /** Scheduler binding status: active, inactive (credit hold), or blocked. */
116
127
  status: string | null;
117
128
  nextScheduledAt: number | null;
@@ -192,6 +203,8 @@ export type PlayScheduleIntent =
192
203
  timezone?: string | null;
193
204
  /** Omitted, null, or empty: no static input. */
194
205
  input?: Record<string, unknown> | null;
206
+ /** Omitted or null keeps the live policy; `allow` clears an opt-in. */
207
+ overlap?: 'allow' | 'skip' | null;
195
208
  };
196
209
 
197
210
  /** Webhook intent: off, or on with its authentication (null = unsigned). */
@@ -225,6 +238,7 @@ export function buildPlayTriggerConfigUpdate(intent: {
225
238
  ...(schedule.input && Object.keys(schedule.input).length > 0
226
239
  ? { input: schedule.input }
227
240
  : {}),
241
+ ...(schedule.overlap ? { overlap: schedule.overlap } : {}),
228
242
  }
229
243
  : null,
230
244
  }),
@@ -322,6 +322,15 @@ function defaultThreshold(
322
322
  return editor.defaultThreshold;
323
323
  }
324
324
 
325
+ /** A workspace notification names the workspace, or its id before a name resolves. */
326
+ function workspaceLabel(payload: ProductNotificationFacts): string {
327
+ const name =
328
+ typeof payload.teamName === 'string' ? payload.teamName.trim() : '';
329
+ const teamId =
330
+ typeof payload.teamId === 'string' ? payload.teamId.trim() : '';
331
+ return name || teamId || 'unnamed';
332
+ }
333
+
325
334
  function formatCredits(value: number): string {
326
335
  return value.toLocaleString('en-US', { maximumFractionDigits: 3 });
327
336
  }
@@ -621,6 +630,168 @@ const PRODUCT_NOTIFICATION_TYPE_REGISTRY = [
621
630
  },
622
631
  },
623
632
  },
633
+ {
634
+ // Org workspaces Phase 6: a named workspace's own monthly cap. No
635
+ // `conditionSubject`, so each workspace (the event's `teamId`) keeps its
636
+ // own condition state, apart from the organization's usage rules.
637
+ id: 'usage.workspace_monthly.limit_reached',
638
+ eventName: ProductNotificationEvent.WorkspaceUsageRecorded,
639
+ requiredFilter: {},
640
+ allowedTriggers: ['threshold_crossing'],
641
+ catalog: {
642
+ name: 'Workspace usage limit reached',
643
+ category: 'credits',
644
+ description:
645
+ "Notify when a workspace's monthly usage reaches the workspace's own spending cap.",
646
+ allowMultiple: false,
647
+ editor: { kind: 'none' },
648
+ },
649
+ rule: {
650
+ default: {
651
+ ruleKey: 'default.workspace_usage_limit_reached',
652
+ groupKey: 'default',
653
+ },
654
+ create: (_input, base) => ({
655
+ ...base,
656
+ trigger: {
657
+ kind: 'threshold_crossing',
658
+ direction: 'at_or_above',
659
+ threshold: 100,
660
+ unit: 'percent',
661
+ },
662
+ }),
663
+ validate: (trigger) => {
664
+ if (
665
+ trigger.kind !== 'threshold_crossing' ||
666
+ trigger.direction !== 'at_or_above' ||
667
+ trigger.unit !== 'percent' ||
668
+ trigger.threshold !== 100
669
+ ) {
670
+ throw new Error(
671
+ 'Workspace-usage-limit-reached rules must cross 100 percent.',
672
+ );
673
+ }
674
+ },
675
+ present: ({ payload }) => {
676
+ const actualUsage = Number(payload.actualUsage ?? payload.currentUsage);
677
+ const workspace = workspaceLabel(payload);
678
+ return {
679
+ title: `Workspace usage limit reached: ${workspace}`,
680
+ summary:
681
+ payload.limitDenied === true
682
+ ? [
683
+ 'An operation was blocked by the ',
684
+ { strong: workspace },
685
+ " workspace's monthly spending cap in your ",
686
+ { workspace: true },
687
+ '.',
688
+ ]
689
+ : [
690
+ 'The ',
691
+ { strong: workspace },
692
+ ' workspace in your ',
693
+ { workspace: true },
694
+ ' reached its monthly spending cap.',
695
+ ],
696
+ details: [
697
+ [
698
+ 'Workspace usage: ',
699
+ {
700
+ strong: `${formatCredits(actualUsage)} of ${formatCredits(Number(payload.limit))}`,
701
+ },
702
+ ` ${payload.unit}`,
703
+ ],
704
+ "An organization owner or admin can raise or remove the workspace's cap in Workspaces & users settings.",
705
+ ],
706
+ targetUrl: String(payload.targetUrl),
707
+ subjectKind: 'workspace_team',
708
+ subjectId: String(payload.teamId),
709
+ severity: 'error',
710
+ };
711
+ },
712
+ },
713
+ },
714
+ {
715
+ id: 'usage.workspace_monthly.nearing_limit',
716
+ eventName: ProductNotificationEvent.WorkspaceUsageRecorded,
717
+ requiredFilter: {},
718
+ allowedTriggers: ['threshold_crossing'],
719
+ catalog: {
720
+ name: 'Workspace usage limit warning',
721
+ category: 'credits',
722
+ description:
723
+ "Notify when only a configurable percentage of a workspace's monthly spending cap remains.",
724
+ allowMultiple: false,
725
+ editor: {
726
+ kind: 'threshold',
727
+ label: 'Remaining workspace usage',
728
+ // Stored as percent used; shown as percent remaining (default 10%).
729
+ defaultThreshold: 90,
730
+ minimum: 1,
731
+ maximum: 99,
732
+ suffix: '%',
733
+ remainingOf: 100,
734
+ },
735
+ },
736
+ rule: {
737
+ create: (input, base, editor) => ({
738
+ ...base,
739
+ trigger: {
740
+ kind: 'threshold_crossing',
741
+ direction: 'at_or_above',
742
+ threshold: input.threshold ?? defaultThreshold(editor),
743
+ unit: 'percent',
744
+ },
745
+ }),
746
+ validate: (trigger) => {
747
+ if (
748
+ trigger.kind !== 'threshold_crossing' ||
749
+ trigger.direction !== 'at_or_above' ||
750
+ trigger.unit !== 'percent'
751
+ ) {
752
+ throw new Error(
753
+ 'Workspace-usage-near-limit rules must cross above a percentage threshold.',
754
+ );
755
+ }
756
+ if (
757
+ !Number.isFinite(trigger.threshold) ||
758
+ trigger.threshold < 1 ||
759
+ trigger.threshold > 99
760
+ ) {
761
+ throw new Error(
762
+ 'Workspace-usage-near-limit thresholds must be between 1 and 99 percent.',
763
+ );
764
+ }
765
+ },
766
+ present: ({ payload, trigger }) => {
767
+ if (trigger.kind !== 'threshold_crossing') {
768
+ throw new Error(
769
+ 'Workspace-usage-near-limit presentation requires a threshold.',
770
+ );
771
+ }
772
+ const percent =
773
+ (Number(payload.currentUsage) / Number(payload.limit)) * 100;
774
+ const workspace = workspaceLabel(payload);
775
+ return {
776
+ title: `Workspace usage near limit: ${workspace}`,
777
+ summary: [
778
+ `Only ${100 - trigger.threshold}% of the `,
779
+ { strong: workspace },
780
+ " workspace's monthly spending cap remains in your ",
781
+ { workspace: true },
782
+ '.',
783
+ ],
784
+ details: [
785
+ ['Workspace usage: ', { strong: `${Math.round(percent)}%` }],
786
+ ],
787
+ targetUrl: String(payload.targetUrl),
788
+ subjectKind: 'workspace_team',
789
+ subjectId: String(payload.teamId),
790
+ severity: 'warning',
791
+ };
792
+ },
793
+ },
794
+ },
624
795
  {
625
796
  id: 'billing.auto_topup.limit_reached',
626
797
  eventName: ProductNotificationEvent.AutoTopupLimitObserved,
@@ -28,6 +28,8 @@ export const ProductNotificationEvent = {
28
28
  CreditsBalanceChanged: 'credits.balance.changed',
29
29
  CreditsPurchaseCompleted: 'credits.purchase.completed',
30
30
  CreditsUsageRecorded: 'credits.usage.recorded',
31
+ /** A named workspace's spend against its own cap (org workspaces Phase 6). */
32
+ WorkspaceUsageRecorded: 'credits.workspace_usage.recorded',
31
33
  AutoTopupLimitObserved: 'billing.auto_topup.limit_observed',
32
34
  BillingPlanPurchased: 'billing.plan.purchased',
33
35
  BillingPlanCancelled: 'billing.plan.cancelled',
@@ -75,6 +77,7 @@ export const PRODUCT_NOTIFICATION_EVENT_NAMES = [
75
77
  ProductNotificationEvent.PlayRunCompleted,
76
78
  ProductNotificationEvent.WebhookDeliveryCompleted,
77
79
  ProductNotificationEvent.CreditsUsageRecorded,
80
+ ProductNotificationEvent.WorkspaceUsageRecorded,
78
81
  ProductNotificationEvent.AutoTopupLimitObserved,
79
82
  ProductNotificationEvent.CreditsPurchaseCompleted,
80
83
  ProductNotificationEvent.BillingPlanPurchased,
@@ -214,6 +217,26 @@ export const PRODUCT_NOTIFICATION_EVENT_DEFINITIONS: readonly ProductNotificatio
214
217
  allowedTriggers: ['threshold_crossing'],
215
218
  allowedThresholdUnits: ['percent', 'usage'],
216
219
  },
220
+ {
221
+ // One named workspace's rolling 30-day spend against its own cap. The
222
+ // subject is the workspace, so each workspace crosses its thresholds
223
+ // on its own, apart from the org's usage rules.
224
+ eventName: ProductNotificationEvent.WorkspaceUsageRecorded,
225
+ producerKey: ProductNotificationProducerKey.BillingUsage,
226
+ requiredFacts: {
227
+ accountId: 'string',
228
+ teamId: 'string',
229
+ creditsUsed: 'number',
230
+ limitDenied: 'boolean',
231
+ targetUrl: 'string',
232
+ },
233
+ optionalFacts: {
234
+ teamName: 'string',
235
+ },
236
+ orderingSubjectFact: 'teamId',
237
+ allowedTriggers: ['threshold_crossing'],
238
+ allowedThresholdUnits: ['percent'],
239
+ },
217
240
  {
218
241
  eventName: ProductNotificationEvent.AutoTopupLimitObserved,
219
242
  producerKey: ProductNotificationProducerKey.BillingCredits,
@@ -597,7 +620,10 @@ export function adaptProductNotificationObservation(input: {
597
620
  };
598
621
  }
599
622
  const limit = Number(event.payload.limit);
600
- if (event.eventName === ProductNotificationEvent.CreditsUsageRecorded) {
623
+ if (
624
+ event.eventName === ProductNotificationEvent.CreditsUsageRecorded ||
625
+ event.eventName === ProductNotificationEvent.WorkspaceUsageRecorded
626
+ ) {
601
627
  if (!(limit > 0)) throw new Error('Monthly usage limit must be positive.');
602
628
  return {
603
629
  kind: 'threshold_state',
@@ -1,29 +1,11 @@
1
- import { emailDomainCandidates } from './email-domain';
1
+ import { emailDomainCandidates, mailboxIdentity } from './email-domain';
2
2
  export { emailDomainCandidates, normalizeEmailDomain } from './email-domain';
3
3
  import { disposableEmailBlocklistSet } from 'disposable-email-domains-js';
4
4
 
5
- // Operator-reported signup-abuse domains (2026-11-18). Keep these blocked even
6
- // when the upstream disposable list has not yet classified a new provider.
7
- const REPORTED_ABUSIVE_SIGNUP_DOMAINS = [
8
- 'garodi.com',
9
- 'jerrsha.com',
10
- 'gomail.edu.pl',
11
- 'aabkmail.com',
12
- 'fbmail.com',
13
- 'corgd.com',
14
- 'jertom.com',
15
- 'temp-mail.lol',
16
- 'hidingpost.net',
17
- // Temporary inboxes seen in the 2026-10 signup audit.
18
- '18lover.com',
19
- 'westcast-systems.com',
20
- ] as const;
21
-
22
- // Build once per module load. Authentication never needs an external lookup.
5
+ // The upstream package is the only disposable list: no hand-kept domains.
6
+ // Operator domain blocks (Admin → Bulk Actions) cover what it misses. Build
7
+ // once per module load; authentication never needs an external lookup.
23
8
  const DISPOSABLE_EMAIL_DOMAINS = disposableEmailBlocklistSet();
24
- for (const domain of REPORTED_ABUSIVE_SIGNUP_DOMAINS) {
25
- DISPOSABLE_EMAIL_DOMAINS.add(domain);
26
- }
27
9
 
28
10
  const HARDCODED_BLACKLISTED_EMAILS = [] as const;
29
11
  const EMAIL_BLACKLIST_ENV_VAR = 'DEEPLINE_EMAIL_BLACKLIST';
@@ -65,9 +47,12 @@ export function isBlacklistedEmail(email?: string | null): boolean {
65
47
  if (!normalized) {
66
48
  return false;
67
49
  }
68
- return (
69
- getBlacklistedEmails().has(normalized) || isDisposableEmail(normalized)
50
+ // Compare inboxes, so listing one Gmail dot or `+tag` alias lists them all.
51
+ const mailbox = mailboxIdentity(normalized);
52
+ const listed = [...getBlacklistedEmails()].some(
53
+ (entry) => mailboxIdentity(entry) === mailbox,
70
54
  );
55
+ return listed || isDisposableEmail(normalized);
71
56
  }
72
57
 
73
58
  export function isDisposableEmail(email?: string | null): boolean {