deepline 0.3.88 → 0.3.90

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 (280) hide show
  1. package/contracts/install-commands.json +29 -0
  2. package/dist/bundling-sources/sdk/src/client.ts +652 -39
  3. package/dist/bundling-sources/sdk/src/config.ts +77 -0
  4. package/dist/bundling-sources/sdk/src/http.ts +76 -30
  5. package/dist/bundling-sources/sdk/src/index.ts +10 -0
  6. package/dist/bundling-sources/sdk/src/monitor-fleet-contract.ts +1 -1
  7. package/dist/bundling-sources/sdk/src/pagination.ts +25 -0
  8. package/dist/bundling-sources/sdk/src/play.ts +15 -1
  9. package/dist/bundling-sources/sdk/src/plays/bundle-play-file.ts +3 -3
  10. package/dist/bundling-sources/sdk/src/release.ts +16 -9
  11. package/dist/bundling-sources/sdk/src/types.ts +106 -4
  12. package/dist/bundling-sources/shared_libs/integration-contracts/AGENTS.md +9 -0
  13. package/dist/bundling-sources/shared_libs/integration-contracts/README.md +3 -0
  14. package/dist/bundling-sources/shared_libs/integration-contracts/index.ts +2 -0
  15. package/dist/bundling-sources/shared_libs/monitors/analytics-install-guides.ts +77 -0
  16. package/dist/bundling-sources/shared_libs/monitors/analytics-public.ts +10 -0
  17. package/dist/bundling-sources/shared_libs/monitors/billing/charges.ts +125 -0
  18. package/dist/bundling-sources/shared_libs/monitors/billing/policy-builders.ts +686 -0
  19. package/dist/bundling-sources/shared_libs/monitors/billing/pricing.ts +54 -0
  20. package/dist/bundling-sources/shared_libs/monitors/billing/public-pricing.ts +72 -0
  21. package/dist/bundling-sources/shared_libs/monitors/billing/session.ts +45 -0
  22. package/dist/bundling-sources/shared_libs/monitors/billing/state.ts +454 -0
  23. package/dist/bundling-sources/shared_libs/monitors/billing/tamradar.ts +260 -0
  24. package/dist/bundling-sources/shared_libs/monitors/billing/types.ts +215 -0
  25. package/dist/bundling-sources/shared_libs/monitors/callback-security.ts +333 -0
  26. package/dist/bundling-sources/shared_libs/monitors/cursor-page.ts +42 -0
  27. package/dist/bundling-sources/shared_libs/monitors/deactivation-reasons.ts +16 -0
  28. package/dist/bundling-sources/shared_libs/monitors/framework-managed-payload-fields.ts +71 -0
  29. package/dist/bundling-sources/shared_libs/monitors/generated/provider-monitor-callback-admission-targets.ts +16 -0
  30. package/dist/bundling-sources/shared_libs/monitors/http-error-response.ts +270 -0
  31. package/dist/bundling-sources/shared_libs/monitors/inbound-publish-key.ts +39 -0
  32. package/dist/bundling-sources/shared_libs/monitors/inbound-queue.ts +82 -0
  33. package/dist/bundling-sources/shared_libs/monitors/inventory-reconciliation.ts +59 -0
  34. package/dist/bundling-sources/shared_libs/monitors/lifecycle-notifications.ts +471 -0
  35. package/dist/bundling-sources/shared_libs/monitors/org-monitor-limits.ts +1 -1
  36. package/dist/bundling-sources/shared_libs/monitors/package.json +36 -0
  37. package/dist/bundling-sources/shared_libs/monitors/provider-callback-verification.ts +1125 -0
  38. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-batch-operation.ts +305 -0
  39. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-capability.ts +964 -0
  40. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-consumer-health.ts +56 -0
  41. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-errors.ts +131 -0
  42. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-identity-claims.ts +535 -0
  43. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-legacy-aliases.ts +16 -0
  44. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-priority-execution.ts +56 -0
  45. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-public-aliases.ts +28 -0
  46. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-runtime-read-eligibility.ts +38 -0
  47. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-state.ts +122 -0
  48. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-status.ts +10 -0
  49. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-upstream-identity.ts +112 -0
  50. package/dist/bundling-sources/shared_libs/monitors/provider-webhook-monitor-runtime.ts +300 -0
  51. package/dist/bundling-sources/shared_libs/monitors/quickstart-prompts.ts +22 -0
  52. package/dist/bundling-sources/shared_libs/monitors/signal-radars/inbound-dead-letter.ts +245 -0
  53. package/dist/bundling-sources/shared_libs/monitors/signal-radars/inbound-message.ts +38 -0
  54. package/dist/bundling-sources/shared_libs/monitors/signal-radars/inbound-queue-ack-probe.ts +94 -0
  55. package/dist/bundling-sources/shared_libs/monitors/signal-radars/inbound-queue-delivery.ts +60 -0
  56. package/dist/bundling-sources/shared_libs/monitors/signal-radars/inbound-queue.ts +60 -0
  57. package/dist/bundling-sources/shared_libs/monitors/snitcher-install-validation.ts +93 -0
  58. package/dist/bundling-sources/shared_libs/monitors/snitcher-ip2company.ts +332 -0
  59. package/dist/bundling-sources/shared_libs/monitors/snitcher-radar.ts +221 -0
  60. package/dist/bundling-sources/shared_libs/monitors/starter-templates.ts +105 -0
  61. package/dist/bundling-sources/shared_libs/monitors/tracking-provider-guidance.ts +73 -0
  62. package/dist/bundling-sources/shared_libs/monitors/tracking-provider-integrations.ts +81 -0
  63. package/dist/bundling-sources/shared_libs/monitors/tsconfig.json +10 -0
  64. package/dist/bundling-sources/shared_libs/observability/build-context.ts +13 -0
  65. package/dist/bundling-sources/shared_libs/observability/log-metadata.ts +160 -0
  66. package/dist/bundling-sources/shared_libs/observability/request-context.ts +68 -0
  67. package/dist/bundling-sources/shared_libs/observability/scheduled-jobs.json +654 -0
  68. package/dist/bundling-sources/shared_libs/observability/scheduled-work-manual.ts +35 -0
  69. package/dist/bundling-sources/shared_libs/observability/scheduled-work.ts +5 -0
  70. package/dist/bundling-sources/shared_libs/play-data-plane/neon-constants.ts +9 -0
  71. package/dist/bundling-sources/shared_libs/play-data-plane/r2.ts +272 -0
  72. package/dist/bundling-sources/shared_libs/play-runtime/activity-observation.ts +6 -11
  73. package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +135 -12
  74. package/dist/bundling-sources/shared_libs/play-runtime/async-operation.ts +66 -1
  75. package/dist/bundling-sources/shared_libs/play-runtime/async-play-invocation.ts +77 -0
  76. package/dist/bundling-sources/shared_libs/play-runtime/bounceban-batching.ts +137 -0
  77. package/dist/bundling-sources/shared_libs/play-runtime/checkpoint-boundaries.ts +70 -0
  78. package/dist/bundling-sources/shared_libs/play-runtime/context.ts +1159 -166
  79. package/dist/bundling-sources/shared_libs/play-runtime/coordinator-headers.ts +1 -32
  80. package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +103 -0
  81. package/dist/bundling-sources/shared_libs/play-runtime/daytona-payload-contract.ts +68 -0
  82. package/dist/bundling-sources/shared_libs/play-runtime/daytona-sandbox-janitor.ts +103 -0
  83. package/dist/bundling-sources/shared_libs/play-runtime/daytona-sandbox-reaper.ts +725 -0
  84. package/dist/bundling-sources/shared_libs/play-runtime/default-batch-strategies.ts +20 -1
  85. package/dist/bundling-sources/shared_libs/play-runtime/durable-call-cache.ts +29 -0
  86. package/dist/bundling-sources/shared_libs/play-runtime/execution-capabilities.ts +29 -0
  87. package/dist/bundling-sources/shared_libs/play-runtime/execution-gateway-invocation-fence.ts +442 -0
  88. package/dist/bundling-sources/shared_libs/play-runtime/execution-protocol.ts +7 -1
  89. package/dist/bundling-sources/shared_libs/play-runtime/fixture-behavior.ts +18 -0
  90. package/dist/bundling-sources/shared_libs/play-runtime/governor/app-runtime-rate-state-backend.ts +9 -0
  91. package/dist/bundling-sources/shared_libs/play-runtime/governor/policy.ts +1 -1
  92. package/dist/bundling-sources/shared_libs/play-runtime/governor/rate-state-backend.ts +1 -1
  93. package/dist/bundling-sources/shared_libs/play-runtime/integration-operation-reader-fence/contracts.ts +66 -0
  94. package/dist/bundling-sources/shared_libs/play-runtime/integration-operation-reader-fence/job.ts +145 -0
  95. package/dist/bundling-sources/shared_libs/play-runtime/integration-operation-reader-fence/ports.ts +21 -0
  96. package/dist/bundling-sources/shared_libs/play-runtime/integration-operation-reader-fence/postgres-store.ts +170 -0
  97. package/dist/bundling-sources/shared_libs/play-runtime/internal-bootstrap-token.ts +1322 -0
  98. package/dist/bundling-sources/shared_libs/play-runtime/internal-step-ids.ts +2 -2
  99. package/dist/bundling-sources/shared_libs/play-runtime/lane-retirement-gate.ts +189 -0
  100. package/dist/bundling-sources/shared_libs/play-runtime/launch-source-policy.ts +112 -0
  101. package/dist/bundling-sources/shared_libs/play-runtime/map-execution-frame.ts +8 -0
  102. package/dist/bundling-sources/shared_libs/play-runtime/perf-trace.ts +127 -0
  103. package/dist/bundling-sources/shared_libs/play-runtime/play-artifact-runtime-contract.ts +5 -0
  104. package/dist/bundling-sources/shared_libs/play-runtime/play-run-recovery-policy.ts +24 -1
  105. package/dist/bundling-sources/shared_libs/play-runtime/play-runs/admission/contracts.ts +56 -0
  106. package/dist/bundling-sources/shared_libs/play-runtime/play-runs/admission/index.ts +13 -0
  107. package/dist/bundling-sources/shared_libs/play-runtime/play-runs/admission/job.ts +41 -0
  108. package/dist/bundling-sources/shared_libs/play-runtime/play-runs/admission/ports.ts +17 -0
  109. package/dist/bundling-sources/shared_libs/play-runtime/play-runs/admission/postgres-adapter.ts +54 -0
  110. package/dist/bundling-sources/shared_libs/play-runtime/play-runs/attempts/contracts.ts +114 -0
  111. package/dist/bundling-sources/shared_libs/play-runtime/play-runs/attempts/engine-suspension.ts +108 -0
  112. package/dist/bundling-sources/shared_libs/play-runtime/play-runs/attempts/index.ts +36 -0
  113. package/dist/bundling-sources/shared_libs/play-runtime/play-runs/attempts/job.ts +97 -0
  114. package/dist/bundling-sources/shared_libs/play-runtime/play-runs/attempts/ports.ts +104 -0
  115. package/dist/bundling-sources/shared_libs/play-runtime/play-runs/attempts/postgres-fence-adapter.ts +263 -0
  116. package/dist/bundling-sources/shared_libs/play-runtime/play-runs/attempts/worker-terminal-projection.ts +64 -0
  117. package/dist/bundling-sources/shared_libs/play-runtime/play-runs/projection/contracts.ts +29 -0
  118. package/dist/bundling-sources/shared_libs/play-runtime/play-runs/projection/gateway-adapter.ts +56 -0
  119. package/dist/bundling-sources/shared_libs/play-runtime/play-runs/projection/index.ts +15 -0
  120. package/dist/bundling-sources/shared_libs/play-runtime/play-runs/projection/job.ts +65 -0
  121. package/dist/bundling-sources/shared_libs/play-runtime/play-runs/projection/ports.ts +17 -0
  122. package/dist/bundling-sources/shared_libs/play-runtime/play-runs/sandbox-cleanup/contracts.ts +42 -0
  123. package/dist/bundling-sources/shared_libs/play-runtime/play-runs/sandbox-cleanup/index.ts +17 -0
  124. package/dist/bundling-sources/shared_libs/play-runtime/play-runs/sandbox-cleanup/job.ts +142 -0
  125. package/dist/bundling-sources/shared_libs/play-runtime/play-runs/sandbox-cleanup/ports.ts +42 -0
  126. package/dist/bundling-sources/shared_libs/play-runtime/play-runs/sandbox-cleanup/postgres-adapter.ts +102 -0
  127. package/dist/bundling-sources/shared_libs/play-runtime/play-runs/terminal/contracts.ts +60 -0
  128. package/dist/bundling-sources/shared_libs/play-runtime/play-runs/terminal/index.ts +16 -0
  129. package/dist/bundling-sources/shared_libs/play-runtime/play-runs/terminal/job.ts +78 -0
  130. package/dist/bundling-sources/shared_libs/play-runtime/play-runs/terminal/ports.ts +54 -0
  131. package/dist/bundling-sources/shared_libs/play-runtime/play-runs/terminal/postgres-adapter.ts +71 -0
  132. package/dist/bundling-sources/shared_libs/play-runtime/play-runtime-batching-registry.ts +4 -0
  133. package/dist/bundling-sources/shared_libs/play-runtime/play-runtime-semantics.ts +28 -0
  134. package/dist/bundling-sources/shared_libs/play-runtime/protocol.ts +4 -0
  135. package/dist/bundling-sources/shared_libs/play-runtime/receipt-status.ts +5 -8
  136. package/dist/bundling-sources/shared_libs/play-runtime/run-failure.ts +23 -2
  137. package/dist/bundling-sources/shared_libs/play-runtime/run-identity.ts +168 -0
  138. package/dist/bundling-sources/shared_libs/play-runtime/run-snapshot-stream.ts +1 -1
  139. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-lifecycle.ts +90 -13
  140. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-payload-transport.ts +6 -12
  141. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-start-admission.ts +68 -0
  142. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona.ts +21 -0
  143. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/bundle.ts +0 -1
  144. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/runtime-sandbox-reconciliation.ts +14 -43
  145. package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +67 -213
  146. package/dist/bundling-sources/shared_libs/play-runtime/runtime-authority.ts +201 -0
  147. package/dist/bundling-sources/shared_libs/play-runtime/runtime-capacity-policy.ts +20 -0
  148. package/dist/bundling-sources/shared_libs/play-runtime/runtime-contract.ts +6 -0
  149. package/dist/bundling-sources/shared_libs/play-runtime/runtime-env.ts +12 -0
  150. package/dist/bundling-sources/shared_libs/play-runtime/runtime-operation-contract.ts +67 -0
  151. package/dist/bundling-sources/shared_libs/play-runtime/runtime-release-environment.ts +2 -0
  152. package/dist/bundling-sources/shared_libs/play-runtime/runtime-sandbox-contract.ts +68 -0
  153. package/dist/bundling-sources/shared_libs/play-runtime/runtime-scheduler-topology.ts +38 -2
  154. package/dist/bundling-sources/shared_libs/play-runtime/runtime-telemetry.ts +108 -0
  155. package/dist/bundling-sources/shared_libs/play-runtime/sandbox-runs/contract.ts +4 -0
  156. package/dist/bundling-sources/shared_libs/play-runtime/sandbox-runs/runner-backend-adapter.ts +3 -0
  157. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backend.ts +37 -1
  158. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-deadline-reconciliation.ts +88 -0
  159. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-play-deploy-task.ts +124 -0
  160. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-play-run-task.ts +68 -0
  161. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-pool.ts +193 -0
  162. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-queue-lifecycle.ts +269 -0
  163. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-queue-suffix.ts +73 -0
  164. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +6642 -0
  165. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-shared.ts +897 -0
  166. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-worker-metrics.ts +120 -0
  167. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-worker-required-env.ts +76 -0
  168. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd.ts +476 -0
  169. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/gateway-heavy-request-admission.ts +47 -0
  170. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/gateway-progress-registry.ts +147 -0
  171. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/index.ts +27 -0
  172. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/lazy.ts +50 -0
  173. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/play-run-recovery.ts +98 -0
  174. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-budget-state.ts +260 -0
  175. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-pool.ts +1416 -0
  176. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-progress.ts +1255 -0
  177. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-rate-state.ts +942 -0
  178. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +14636 -0
  179. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/receipt-gateway.ts +888 -0
  180. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/run-ledger-outbox-recovery.ts +355 -0
  181. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/run-terminal-transition.ts +46 -0
  182. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runner-push.ts +60 -0
  183. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-api-origin.ts +33 -0
  184. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-receipt-gateway-health.ts +64 -0
  185. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-sandbox-capacity.ts +835 -0
  186. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-sandbox-ledger-reconciliation.ts +1218 -0
  187. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-sandbox-operation.ts +207 -0
  188. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-scheduler-schema.ts +10 -0
  189. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/scheduler-capacity.ts +123 -0
  190. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/scheduler-launch-read-observability.ts +78 -0
  191. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/submit-admission.ts +169 -0
  192. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/terminal-contract.ts +20 -0
  193. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/worker-queue-metrics.ts +34 -0
  194. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/worker-resource-metrics.ts +249 -0
  195. package/dist/bundling-sources/shared_libs/play-runtime/sheet-attempt-sql.ts +7 -0
  196. package/dist/bundling-sources/shared_libs/play-runtime/step-progress.ts +296 -0
  197. package/dist/bundling-sources/shared_libs/play-runtime/tool-call/native-batch.ts +3 -3
  198. package/dist/bundling-sources/shared_libs/play-runtime/tool-call/runtime-step-receipts-adapter.ts +20 -1
  199. package/dist/bundling-sources/shared_libs/play-runtime/tool-execute-retry-policy.ts +60 -15
  200. package/dist/bundling-sources/shared_libs/play-runtime/tool-execution-outcome.ts +20 -0
  201. package/dist/bundling-sources/shared_libs/play-runtime/tool-http-errors.ts +1 -1
  202. package/dist/bundling-sources/shared_libs/play-runtime/tool-result.ts +1 -1
  203. package/dist/bundling-sources/shared_libs/play-runtime/transient-service-error.ts +12 -0
  204. package/dist/bundling-sources/shared_libs/play-runtime/vercel-protection.ts +14 -1
  205. package/dist/bundling-sources/shared_libs/play-runtime/work-receipt-storage-contract.ts +165 -0
  206. package/dist/bundling-sources/shared_libs/play-runtime/work-receipts.ts +15 -23
  207. package/dist/bundling-sources/shared_libs/play-runtime/workflow-executor-auth.ts +169 -0
  208. package/dist/bundling-sources/shared_libs/play-runtime/zerobounce-batching.ts +122 -0
  209. package/dist/bundling-sources/shared_libs/plays/artifact-types.ts +8 -3
  210. package/dist/bundling-sources/shared_libs/plays/authoring-contract.ts +454 -17
  211. package/dist/bundling-sources/shared_libs/plays/bundling/index.ts +19 -4
  212. package/dist/bundling-sources/shared_libs/plays/contracts.ts +8 -14
  213. package/dist/bundling-sources/shared_libs/plays/core.ts +11 -6
  214. package/dist/bundling-sources/shared_libs/plays/deployment-status.ts +1 -1
  215. package/dist/bundling-sources/shared_libs/plays/docflow-binding-owner.ts +16 -11
  216. package/dist/bundling-sources/shared_libs/plays/docflow.ts +1 -1
  217. package/dist/bundling-sources/shared_libs/plays/email-status.ts +1 -1
  218. package/dist/bundling-sources/shared_libs/plays/play-grep-search.ts +39 -0
  219. package/dist/bundling-sources/shared_libs/plays/resolve-static-pipeline.ts +1 -1
  220. package/dist/bundling-sources/shared_libs/plays/share/copy.ts +271 -0
  221. package/dist/bundling-sources/shared_libs/plays/share/metrics.ts +140 -0
  222. package/dist/bundling-sources/shared_libs/plays/share/public-read-model.ts +86 -0
  223. package/dist/bundling-sources/shared_libs/plays/share/seo-quality.ts +181 -0
  224. package/dist/bundling-sources/shared_libs/plays/share/static-pipeline-summary.ts +658 -0
  225. package/dist/bundling-sources/shared_libs/plays/share/types.ts +197 -0
  226. package/dist/bundling-sources/shared_libs/plays/slack-hitl-timeout-error.ts +37 -0
  227. package/dist/bundling-sources/shared_libs/plays/slug.ts +115 -0
  228. package/dist/bundling-sources/shared_libs/plays/static-pipeline.ts +50 -15
  229. package/dist/bundling-sources/shared_libs/plays/tool-category-descriptions.ts +2 -2
  230. package/dist/bundling-sources/shared_libs/plays/tool-result-types.ts +1 -1
  231. package/dist/bundling-sources/shared_libs/product-notifications/catalog.ts +877 -0
  232. package/dist/bundling-sources/shared_libs/product-notifications/configuration-draft.ts +456 -0
  233. package/dist/bundling-sources/shared_libs/product-notifications/configuration.ts +566 -0
  234. package/dist/bundling-sources/shared_libs/product-notifications/content.ts +28 -0
  235. package/dist/bundling-sources/shared_libs/product-notifications/default-policy.ts +60 -0
  236. package/dist/bundling-sources/shared_libs/product-notifications/email.ts +246 -0
  237. package/dist/bundling-sources/shared_libs/product-notifications/evaluation.ts +280 -0
  238. package/dist/bundling-sources/shared_libs/product-notifications/events.ts +433 -0
  239. package/dist/bundling-sources/shared_libs/product-notifications/legacy-slack.ts +80 -0
  240. package/dist/bundling-sources/shared_libs/product-notifications/overflow.ts +18 -0
  241. package/dist/bundling-sources/shared_libs/product-notifications/rolling-limit.ts +24 -0
  242. package/dist/bundling-sources/shared_libs/product-notifications/slack-delivery.ts +624 -0
  243. package/dist/bundling-sources/shared_libs/product-notifications/slack-payload.ts +140 -0
  244. package/dist/bundling-sources/shared_libs/product-notifications/slack-transport.ts +75 -0
  245. package/dist/bundling-sources/shared_libs/product-notifications/workspace.ts +38 -0
  246. package/dist/bundling-sources/shared_libs/runtime-env.ts +12 -0
  247. package/dist/bundling-sources/shared_libs/security/email-blacklist.ts +42 -0
  248. package/dist/bundling-sources/shared_libs/security/header-safe-env.ts +35 -0
  249. package/dist/bundling-sources/shared_libs/security/internal-actor.ts +50 -0
  250. package/dist/bundling-sources/shared_libs/security/secret-redaction.ts +267 -0
  251. package/dist/bundling-sources/shared_libs/security/slack-sanitize.ts +133 -0
  252. package/dist/cli/getting-started.d.mts +52 -0
  253. package/dist/cli/getting-started.d.ts +52 -0
  254. package/dist/cli/getting-started.js +65 -0
  255. package/dist/cli/getting-started.mjs +36 -0
  256. package/dist/cli/index.d.mts +9 -0
  257. package/dist/cli/index.d.ts +9 -0
  258. package/dist/cli/index.js +1611 -453
  259. package/dist/cli/index.mjs +1596 -447
  260. package/dist/{compiler-manifest-Dbov16F7.d.mts → compiler-manifest-BaJfE-5H.d.mts} +136 -10
  261. package/dist/{compiler-manifest-Dbov16F7.d.ts → compiler-manifest-BaJfE-5H.d.ts} +136 -10
  262. package/dist/index.d.mts +910 -155
  263. package/dist/index.d.ts +910 -155
  264. package/dist/index.js +550 -64
  265. package/dist/index.mjs +550 -64
  266. package/dist/install-integrity.json +193 -4
  267. package/dist/monitor-fleet-contract.d.mts +138 -0
  268. package/dist/monitor-fleet-contract.d.ts +138 -0
  269. package/dist/monitor-fleet-contract.js +404 -0
  270. package/dist/monitor-fleet-contract.mjs +367 -0
  271. package/dist/plays/bundle-play-file.d.mts +8 -3
  272. package/dist/plays/bundle-play-file.d.ts +8 -3
  273. package/dist/plays/bundle-play-file.mjs +100 -20
  274. package/dist/release.d.mts +255 -0
  275. package/dist/release.d.ts +255 -0
  276. package/dist/release.js +215 -0
  277. package/dist/release.mjs +188 -0
  278. package/package.json +23 -4
  279. /package/dist/bundling-sources/shared_libs/{integrations/bettercontact-execution-policy.ts → integration-contracts/bettercontact/execution-policy.ts} +0 -0
  280. /package/dist/bundling-sources/shared_libs/{integrations/theirstack-execution-policy.ts → integration-contracts/theirstack/execution-policy.ts} +0 -0
@@ -1,3 +1,4 @@
1
+ import { iterateCursorPages } from './pagination.js';
1
2
  /**
2
3
  * The main API client for interacting with the Deepline platform.
3
4
  *
@@ -37,6 +38,16 @@ import { resolveConfig } from './config.js';
37
38
  import { DeeplineError } from './errors.js';
38
39
  import { HttpClient } from './http.js';
39
40
  import { PRODUCT_NOTIFICATION_SLACK_OAUTH_SCOPES } from '../../shared_libs/product-notifications/contract.js';
41
+ import {
42
+ DEFAULT_PRODUCT_NOTIFICATION_DELIVERY_TIMING,
43
+ normalizeProductNotificationEmail,
44
+ } from '../../shared_libs/product-notifications/configuration.js';
45
+ import {
46
+ type ProductNotificationConfigurationChange,
47
+ type EffectiveProductNotificationDestination,
48
+ type EffectiveProductNotificationGroup,
49
+ type ProductNotificationGroupDraft,
50
+ } from '../../shared_libs/product-notifications/configuration.js';
40
51
  import {
41
52
  STREAM_HEALTHY_CONNECTION_MS,
42
53
  isTransientPlayStreamError,
@@ -60,6 +71,7 @@ import type {
60
71
  PlayLiveEvent,
61
72
  PlayListItem,
62
73
  ProductNotificationSettings,
74
+ ProductNotificationConfigurationResponse,
63
75
  PlayDescription,
64
76
  StopPlayRunResult,
65
77
  StopAllPlayRunsResult,
@@ -88,11 +100,11 @@ import type { PlayStagedFileRef } from './plays/local-file-discovery.js';
88
100
  import type { PlayCompilerManifest } from '../../shared_libs/plays/compiler-manifest.js';
89
101
  import type { EnrichCompiledConfig } from './cli/enrich-play-compiler.js';
90
102
  import { RUNTIME_ENVIRONMENT_TOKEN_HEADER } from '../../shared_libs/play-runtime/coordinator-headers.js';
91
- import { resolveTheirstackClientTimeoutMs } from '../../shared_libs/integrations/theirstack-execution-policy.js';
103
+ import { resolveTheirstackClientTimeoutMs } from '../../shared_libs/integration-contracts/theirstack/execution-policy.js';
92
104
  import {
93
105
  BETTERCONTACT_LAUNCHER_CLIENT_TIMEOUT_MS,
94
106
  usesExtendedBetterContactLauncherBudget,
95
- } from '../../shared_libs/integrations/bettercontact-execution-policy.js';
107
+ } from '../../shared_libs/integration-contracts/bettercontact/execution-policy.js';
96
108
  import {
97
109
  normalizePlayRuntimeEnvironment,
98
110
  normalizePlayRuntimeNamespace,
@@ -124,6 +136,76 @@ export type UpdateNotificationInput =
124
136
  | { enabled: boolean }
125
137
  | ({ name: string; eventTypes: string[] } & SlackNotificationTarget);
126
138
 
139
+ export type CreateNotificationGroupInput = {
140
+ name: string;
141
+ targets: string[];
142
+ legacyEvents?: string[];
143
+ dryRun?: boolean;
144
+ };
145
+
146
+ export type CreateNotificationGroupResult =
147
+ | {
148
+ mode: 'dry_run';
149
+ compatibilityMode: boolean;
150
+ name: string;
151
+ targets: string[];
152
+ legacyEvents: string[];
153
+ }
154
+ | { mode: 'legacy'; notification: unknown }
155
+ | {
156
+ mode: 'native';
157
+ groupKey: string;
158
+ targets: string[];
159
+ group: EffectiveProductNotificationGroup;
160
+ destinations: EffectiveProductNotificationDestination[];
161
+ };
162
+
163
+ type ParsedNotificationGroupTarget =
164
+ | { kind: 'email'; email: string }
165
+ | { kind: 'slack'; channel: string }
166
+ | { kind: 'slack'; memberId: string };
167
+
168
+ const MAX_NOTIFICATION_GROUP_CREATE_TARGETS = 50;
169
+
170
+ function parseNotificationGroupTarget(
171
+ value: string,
172
+ ): ParsedNotificationGroupTarget {
173
+ const normalized = value.trim();
174
+ if (normalized.toLowerCase().startsWith('email:')) {
175
+ const email = normalizeProductNotificationEmail(normalized.slice(6));
176
+ if (!email) {
177
+ throw new Error(
178
+ `Invalid email notification target "${value}". Use --to email:name@example.com.`,
179
+ );
180
+ }
181
+ return { kind: 'email', email };
182
+ }
183
+ const slack = /^slack:(.+)$/i.exec(normalized)?.[1]?.trim();
184
+ if (!slack) {
185
+ const provider = normalized.split(':', 1)[0] || normalized;
186
+ throw new Error(
187
+ `Unsupported notification destination "${provider}". Use email: or slack:.`,
188
+ );
189
+ }
190
+ const member = /^member:([UW][A-Z0-9]{8,})$/i.exec(slack);
191
+ if (member?.[1]) {
192
+ return { kind: 'slack', memberId: member[1].toUpperCase() };
193
+ }
194
+ if (slack.toLowerCase().startsWith('member:')) {
195
+ throw new Error(
196
+ 'Slack member IDs must look like slack:member:U0123456789.',
197
+ );
198
+ }
199
+ if (!slack.replace(/^#/, '').trim()) {
200
+ throw new Error('Use --to slack:#channel.');
201
+ }
202
+ return { kind: 'slack', channel: slack };
203
+ }
204
+
205
+ function notificationObjectKey(kind: 'group' | 'destination') {
206
+ return `${kind}.${globalThis.crypto.randomUUID()}`;
207
+ }
208
+
127
209
  const TERMINAL_PLAY_STATUSES = new Set(['completed', 'failed', 'cancelled']);
128
210
  const INCLUDE_TOOL_METADATA_HEADER = 'x-deepline-include-tool-metadata';
129
211
  const EXECUTE_RESPONSE_CONTRACT_HEADER = 'x-deepline-execute-response-contract';
@@ -514,6 +596,35 @@ export type RunsListOptions = {
514
596
  offset?: number;
515
597
  };
516
598
 
599
+ /** One server page; legacy runs.list continues to return an array. */
600
+ export type RunsListPage = {
601
+ runs: PlayRunListItem[];
602
+ total?: number;
603
+ offset?: number;
604
+ limit?: number;
605
+ hasMore?: boolean;
606
+ };
607
+
608
+ export type PlaysListOptions = {
609
+ origin?: 'prebuilt' | 'owned';
610
+ grep?: string;
611
+ /**
612
+ * @deprecated Grep is always evaluated by the Convex full-text index.
613
+ * This retained option is ignored for source compatibility.
614
+ */
615
+ grepMode?: 'all' | 'any' | 'phrase';
616
+ categories?: string | string[];
617
+ includeToolCategories?: boolean;
618
+ includeArchived?: boolean;
619
+ includeCostEstimates?: boolean;
620
+ };
621
+
622
+ export type PlaysListPage = {
623
+ plays: PlayListItem[];
624
+ cursor: string | null;
625
+ hasMore: boolean;
626
+ };
627
+
517
628
  /** Options for `client.runs.get(...)`. */
518
629
  export type RunsGetOptions = {
519
630
  /** Return the raw status payload instead of the compact package. */
@@ -645,12 +756,17 @@ export type PlaySecretMetadata = {
645
756
  lastUsedAt?: number;
646
757
  };
647
758
 
759
+ export type PlaySecretCheck = {
760
+ ok: boolean;
761
+ name: string;
762
+ playName: string | null;
763
+ reason: 'active' | 'missing' | 'disabled' | 'empty' | 'invalid_version';
764
+ secret: PlaySecretMetadata | null;
765
+ };
766
+
648
767
  /**
649
- * Public runs namespace exposed as `client.runs`.
650
- *
651
- * This namespace mirrors the canonical `/api/v2/runs` resource family and is
652
- * the preferred low-level surface for polling, streaming, stopping, reading
653
- * logs, and exporting durable dataset rows.
768
+ * `client.runs` mirrors `/api/v2/runs`: the preferred low-level surface for
769
+ * polling, streaming, stopping, reading logs, and exporting durable dataset rows.
654
770
  *
655
771
  * @sdkReference client 020 client.runs
656
772
  */
@@ -675,6 +791,8 @@ export type RunsNamespace = {
675
791
  }>;
676
792
  /** List runs for one play, optionally filtered by status. */
677
793
  list: (options: RunsListOptions) => Promise<PlayRunListItem[]>;
794
+ /** Read one run page with total, offset, limit and completeness metadata. */
795
+ listPage: (options: RunsListOptions) => Promise<RunsListPage>;
678
796
  /** Stream run events and return the latest/terminal run status. */
679
797
  tail: (runId: string, options?: RunsTailOptions) => Promise<PlayStatus>;
680
798
  /** Fetch persisted log lines for a run. */
@@ -930,6 +1048,62 @@ export type MonitorFleetWaitOptions = {
930
1048
  until?: 'converged' | 'deactivated';
931
1049
  };
932
1050
 
1051
+ /** A durable monitor batch can name a small key set, a query target, or one Fleet. */
1052
+ export type MonitorBatchScope =
1053
+ | { kind: 'keys'; monitorKeys: string[] }
1054
+ | {
1055
+ kind: 'target';
1056
+ target: 'all' | 'all-active' | 'billing-suspended' | 'needs-repair';
1057
+ }
1058
+ | { kind: 'fleet'; fleetId: string };
1059
+
1060
+ export type MonitorBatchExistingSubmitOptions = {
1061
+ kind: 'audit' | 'deactivate' | 'reactivate' | 'repair';
1062
+ scope: MonitorBatchScope;
1063
+ dryRun?: boolean;
1064
+ /** Required for deactivate; it is the declared reason shown by health/UI. */
1065
+ deactivationReason?: string;
1066
+ /** Stable retry key. Reusing it joins the original durable operation. */
1067
+ idempotencyKey: string;
1068
+ };
1069
+
1070
+ /** Complete definitions, one JSON object per line; uploaded as bounded shards. */
1071
+ export type MonitorBatchDeploySubmitOptions = {
1072
+ kind: 'deploy';
1073
+ manifestNdjson: string;
1074
+ dryRun?: boolean;
1075
+ /** Stable retry key. Reusing it joins the same content-addressed manifest. */
1076
+ idempotencyKey: string;
1077
+ };
1078
+
1079
+ export type MonitorBatchSubmitOptions =
1080
+ | MonitorBatchExistingSubmitOptions
1081
+ | MonitorBatchDeploySubmitOptions;
1082
+
1083
+ export type MonitorBatchOperationResult = {
1084
+ ok?: boolean;
1085
+ rejoined?: boolean;
1086
+ operation: {
1087
+ runId: string;
1088
+ kind: 'audit' | 'deactivate' | 'reactivate' | 'deploy' | 'repair';
1089
+ state: 'running' | 'retry_scheduled' | 'completed' | 'failed';
1090
+ dryRun: boolean;
1091
+ scope: unknown;
1092
+ submittedAt: number;
1093
+ updatedAt: number;
1094
+ deactivationReason?: string;
1095
+ nextAttemptAt?: number;
1096
+ completedAt?: number;
1097
+ summary?: Record<string, unknown>;
1098
+ lastError?: string;
1099
+ };
1100
+ results?: {
1101
+ page: Array<Record<string, unknown>>;
1102
+ isDone: boolean;
1103
+ continueCursor: string;
1104
+ };
1105
+ };
1106
+
933
1107
  export type MonitorFleetsNamespace = {
934
1108
  /**
935
1109
  * Create, update, or re-plan a fleet. Pass a definition to admit new source
@@ -963,6 +1137,16 @@ export type MonitorFleetsNamespace = {
963
1137
  ) => Promise<MonitorFleetResult>;
964
1138
  };
965
1139
 
1140
+ export type MonitorBatchNamespace = {
1141
+ submit: (
1142
+ options: MonitorBatchSubmitOptions,
1143
+ ) => Promise<MonitorBatchOperationResult>;
1144
+ get: (
1145
+ operationId: string,
1146
+ options?: { cursor?: string | null },
1147
+ ) => Promise<MonitorBatchOperationResult>;
1148
+ };
1149
+
966
1150
  /**
967
1151
  * Delivery and convergence health for a scope, from
968
1152
  * `GET /api/v2/monitors/health`.
@@ -977,6 +1161,16 @@ export type MonitorsHealth = {
977
1161
  scanned: number;
978
1162
  /** True when the scope was larger than one bounded read; counts are partial. */
979
1163
  truncated: boolean;
1164
+ /**
1165
+ * A durable whole-scope snapshot is rebuilding. Counts remain intentionally
1166
+ * partial until it completes; older servers omit this additive field.
1167
+ */
1168
+ refresh?: {
1169
+ state: 'running' | 'completed';
1170
+ started_at: number;
1171
+ updated_at: number;
1172
+ completed_at: number | null;
1173
+ };
980
1174
  desired: { active: number; inactive: number; unset: number };
981
1175
  observed: {
982
1176
  active: number;
@@ -987,6 +1181,11 @@ export type MonitorsHealth = {
987
1181
  };
988
1182
  converged: number;
989
1183
  needs_repair: number;
1184
+ /**
1185
+ * Unknown records without an upstream resource id. Use the exact inventory
1186
+ * reconciler to align them; ordinary repair never guesses an identity.
1187
+ */
1188
+ alignment_required: number;
990
1189
  /** Observed active, but nothing delivered inside `silent_window_days`. */
991
1190
  silent: number;
992
1191
  silent_window_days: number;
@@ -1003,6 +1202,27 @@ export type MonitorsHealth = {
1003
1202
  observed_at: number | null;
1004
1203
  provider_resource_id: string | null;
1005
1204
  }>;
1205
+ /** Bounded current durable monitor work, if the server supports it. */
1206
+ batch_operations?: Array<{
1207
+ run_id: string;
1208
+ kind: 'audit' | 'deactivate' | 'reactivate' | 'repair' | 'deploy';
1209
+ state: 'running' | 'retry_scheduled';
1210
+ updated_at: number;
1211
+ next_attempt_at?: number;
1212
+ summary?: Record<string, unknown>;
1213
+ }>;
1214
+ /** Bounded sample explaining why normal audit did not settle the row. */
1215
+ unaudited_monitors: Array<{
1216
+ monitor_key: string;
1217
+ tool: string;
1218
+ observed: 'unknown' | null;
1219
+ observed_at: number | null;
1220
+ provider_resource_id: string | null;
1221
+ reason:
1222
+ | 'not_yet_audited'
1223
+ | 'missing_provider_resource_id'
1224
+ | 'provider_observation_unknown';
1225
+ }>;
1006
1226
  };
1007
1227
 
1008
1228
  /** One bounded audit pass, from `POST /api/v2/monitors/audit`. */
@@ -1137,12 +1357,16 @@ export type MonitorsNamespace = {
1137
1357
  }) => Promise<MonitorsRepairResult>;
1138
1358
  /** Delivery and convergence health for the workspace or one fleet. */
1139
1359
  health: (options?: { fleetId?: string }) => Promise<MonitorsHealth>;
1360
+ /** Durable bulk audit/deactivation/reactivation/repair with retained progress. */
1361
+ batch: MonitorBatchNamespace;
1140
1362
  /** Define, reconcile, and control table-backed monitor fleets. */
1141
1363
  fleets: MonitorFleetsNamespace;
1142
1364
  };
1143
1365
 
1144
1366
  /** One credit grant pool reported by the billing subscription status endpoint. */
1145
1367
  export type BillingCreditPool = {
1368
+ /** Stable grant identity; optional when talking to an older server. */
1369
+ grant_id?: string;
1146
1370
  pool: string;
1147
1371
  credits_remaining: number;
1148
1372
  credits_granted: number;
@@ -1227,10 +1451,10 @@ export type TargetBillingOperation = {
1227
1451
  };
1228
1452
 
1229
1453
  export type TargetBillingPlan = {
1230
- sku: 'payg-v1' | 'builder-v1' | 'team-v1';
1454
+ sku: 'payg-v1' | 'builder-v1' | 'growth-v1' | 'growth-canary-v1' | 'team-v1';
1231
1455
  name: string;
1232
1456
  recurring_price_usd: number;
1233
- interval: 'month';
1457
+ interval: 'month' | 'year';
1234
1458
  included_credits: number;
1235
1459
  purchased_credit_price_usd: number;
1236
1460
  };
@@ -1293,7 +1517,12 @@ export type TargetBillingMutationResult = {
1293
1517
  export type TargetBillingPlanTransitionOptions =
1294
1518
  | {
1295
1519
  action: 'start_or_change';
1296
- targetPlanSku: 'payg-v1' | 'builder-v1' | 'team-v1';
1520
+ targetPlanSku:
1521
+ | 'payg-v1'
1522
+ | 'builder-v1'
1523
+ | 'growth-v1'
1524
+ | 'growth-canary-v1'
1525
+ | 'team-v1';
1297
1526
  idempotencyKey: string;
1298
1527
  }
1299
1528
  | {
@@ -1379,7 +1608,12 @@ export type WorkspaceCreateResult = {
1379
1608
  org_name: string;
1380
1609
  org_slug: string;
1381
1610
  plan_sku: 'payg-v1';
1382
- rate_policy_ref: 'payg-rates-v2';
1611
+ /**
1612
+ * The PAYG rate policy the workspace was provisioned onto, taken from the
1613
+ * catalog revision its operation pinned: v4 bound payg-rates-v2, v5 binds
1614
+ * the flat payg-rates-v3.
1615
+ */
1616
+ rate_policy_ref: 'payg-rates-v2' | 'payg-rates-v3';
1383
1617
  operation: {
1384
1618
  id: string;
1385
1619
  state: 'completed';
@@ -2007,6 +2241,7 @@ export class DeeplineClient {
2007
2241
  this.runs = {
2008
2242
  get: (runId, options) => this.getRunStatus(runId, options),
2009
2243
  list: (options) => this.listRuns(options),
2244
+ listPage: (options) => this.listRunsPage(options),
2010
2245
  tail: (runId, options) => this.tailRun(runId, options),
2011
2246
  logs: (runId, options) => this.getRunLogs(runId, options),
2012
2247
  input: (runId) => this.getRunInput(runId),
@@ -2059,6 +2294,11 @@ export class DeeplineClient {
2059
2294
  audit: (options) => this.auditMonitors(options),
2060
2295
  repair: (options) => this.repairMonitors(options),
2061
2296
  health: (options) => this.readMonitorsHealth(options),
2297
+ batch: {
2298
+ submit: (options) => this.submitMonitorBatch(options),
2299
+ get: (operationId, options) =>
2300
+ this.getMonitorBatch(operationId, options),
2301
+ },
2062
2302
  fleets: {
2063
2303
  sync: (definitionOrId, options) =>
2064
2304
  this.syncMonitorFleet(definitionOrId, options),
@@ -2271,6 +2511,20 @@ export class DeeplineClient {
2271
2511
  );
2272
2512
  }
2273
2513
 
2514
+ /** Check effective scope and active-version health without reading the value.
2515
+ * Without playName, checks the organization-scoped secret only. With a Play
2516
+ * name, an active Play secret takes precedence; a deleted/disabled Play
2517
+ * secret falls back to the organization-scoped secret.
2518
+ */
2519
+ async inspectSecret(
2520
+ name: string,
2521
+ options: { playName?: string } = {},
2522
+ ): Promise<PlaySecretCheck> {
2523
+ const params = new URLSearchParams({ name: name.trim().toUpperCase() });
2524
+ if (options.playName !== undefined) params.set('play', options.playName);
2525
+ return this.http.get(`/api/v2/secrets?${params.toString()}`);
2526
+ }
2527
+
2274
2528
  // ——————————————————————————————————————————————————————————
2275
2529
  // Tools
2276
2530
  // ——————————————————————————————————————————————————————————
@@ -2376,6 +2630,10 @@ export class DeeplineClient {
2376
2630
  `/api/v2/integrations/${encodeURIComponent(toolId)}/get`,
2377
2631
  {
2378
2632
  method: 'GET',
2633
+ // Tool metadata is a read-only catalog lookup. Keep the metadata
2634
+ // header while opting into the same transient edge-response retries as
2635
+ // other GET catalog methods such as searchTools().
2636
+ retryApiErrors: true,
2379
2637
  headers: {
2380
2638
  'x-deepline-tool-meta-only': '1',
2381
2639
  },
@@ -3664,6 +3922,11 @@ export class DeeplineClient {
3664
3922
  * ```
3665
3923
  */
3666
3924
  async listRuns(options: RunsListOptions): Promise<PlayRunListItem[]> {
3925
+ return (await this.listRunsPage(options)).runs;
3926
+ }
3927
+
3928
+ /** Read one run page without discarding server pagination metadata. */
3929
+ async listRunsPage(options: RunsListOptions): Promise<RunsListPage> {
3667
3930
  const playName = options.play?.trim();
3668
3931
  const params = new URLSearchParams();
3669
3932
  if (playName) {
@@ -3695,10 +3958,10 @@ export class DeeplineClient {
3695
3958
  throw new Error('runs.list requires options.play or options.status.');
3696
3959
  }
3697
3960
  params.set('compact', 'true');
3698
- const response = await this.http.get<{ runs: PlayRunListItem[] }>(
3961
+ const response = await this.http.get<RunsListPage>(
3699
3962
  `/api/v2/runs?${params.toString()}`,
3700
3963
  );
3701
- return response.runs ?? [];
3964
+ return { ...response, runs: response.runs ?? [] };
3702
3965
  }
3703
3966
 
3704
3967
  /**
@@ -4189,20 +4452,46 @@ export class DeeplineClient {
4189
4452
  }
4190
4453
 
4191
4454
  /**
4192
- * List callable plays visible to the workspace.
4455
+ * List one page of callable plays; grep retains exhaustive matching results.
4456
+ * Use listPlaysPage to retain pagination metadata.
4193
4457
  *
4194
4458
  * Pass `origin: "prebuilt"` for Deepline-managed prebuilts or
4195
4459
  * `origin: "owned"` for org-owned plays.
4196
4460
  */
4197
- async listPlays(options?: {
4198
- origin?: 'prebuilt' | 'owned';
4199
- grep?: string;
4200
- grepMode?: 'all' | 'any' | 'phrase';
4201
- categories?: string | string[];
4202
- includeToolCategories?: boolean;
4203
- includeArchived?: boolean;
4204
- }): Promise<PlayListItem[]> {
4461
+ async listPlays(options?: PlaysListOptions): Promise<PlayListItem[]> {
4462
+ if (!options?.grep?.trim()) {
4463
+ return (await this.requestPlaysPage(options, false)).plays;
4464
+ }
4465
+ const plays: PlayListItem[] = [];
4466
+ for await (const items of iterateCursorPages(async (cursor) => {
4467
+ const page = await this.listPlaysPage({ ...options, cursor });
4468
+ return { items: page.plays, cursor: page.cursor, hasMore: page.hasMore };
4469
+ })) {
4470
+ plays.push(...items);
4471
+ }
4472
+ return plays;
4473
+ }
4474
+
4475
+ /** Read one bounded inventory page; cursor continues the same filters. */
4476
+ async listPlaysPage(
4477
+ options?: PlaysListOptions & {
4478
+ limit?: number;
4479
+ cursor?: string | null;
4480
+ },
4481
+ ): Promise<PlaysListPage> {
4482
+ return this.requestPlaysPage(options);
4483
+ }
4484
+
4485
+ private async requestPlaysPage(
4486
+ options?: PlaysListOptions & {
4487
+ limit?: number;
4488
+ cursor?: string | null;
4489
+ },
4490
+ paginateInventory = true,
4491
+ ): Promise<PlaysListPage> {
4205
4492
  const params = new URLSearchParams();
4493
+ if (paginateInventory && !options?.grep?.trim())
4494
+ params.set('inventory_paginated', '1');
4206
4495
  if (options?.origin) params.set('origin', options.origin);
4207
4496
  if (options?.categories) {
4208
4497
  params.set(
@@ -4216,32 +4505,32 @@ export class DeeplineClient {
4216
4505
  params.set('include_tool_categories', '1');
4217
4506
  }
4218
4507
  if (options?.includeArchived) params.set('include_archived', '1');
4508
+ if (options?.includeCostEstimates) {
4509
+ params.set('include_cost_estimates', '1');
4510
+ }
4219
4511
  if (options?.grep?.trim()) {
4220
4512
  params.set('grep', options.grep.trim());
4221
- params.set('grep_mode', options.grepMode ?? 'all');
4222
- params.set('grep_paginated', '1');
4223
4513
  params.set('limit', '60');
4224
4514
  }
4225
- type PlayListResponse = {
4515
+ if (options?.limit !== undefined) {
4516
+ if (!Number.isSafeInteger(options.limit) || options.limit < 1) {
4517
+ throw new Error('Play page limit must be a positive integer');
4518
+ }
4519
+ params.set('limit', String(options.limit));
4520
+ }
4521
+ if (options?.cursor) params.set('cursor', options.cursor);
4522
+ const suffix = params.size ? `?${params.toString()}` : '';
4523
+ const response = await this.http.get<{
4226
4524
  plays?: PlayListItem[];
4227
4525
  cursor?: string | null;
4228
4526
  hasMore?: boolean;
4229
4527
  pagination?: { cursor?: string | null; hasMore?: boolean };
4528
+ }>(`/api/v2/plays${suffix}`);
4529
+ return {
4530
+ plays: response.plays ?? [],
4531
+ cursor: response.pagination?.cursor ?? response.cursor ?? null,
4532
+ hasMore: Boolean(response.pagination?.hasMore ?? response.hasMore),
4230
4533
  };
4231
- const plays: PlayListItem[] = [];
4232
- let cursor: string | null = null;
4233
- let hasMore = true;
4234
- do {
4235
- if (cursor) params.set('cursor', cursor);
4236
- const suffix = params.toString() ? `?${params.toString()}` : '';
4237
- const response = await this.http.get<PlayListResponse>(
4238
- `/api/v2/plays${suffix}`,
4239
- );
4240
- plays.push(...(response.plays ?? []));
4241
- cursor = response.pagination?.cursor ?? response.cursor ?? null;
4242
- hasMore = Boolean(response.pagination?.hasMore ?? response.hasMore);
4243
- } while (Boolean(options?.grep?.trim()) && hasMore && cursor);
4244
- return plays;
4245
4534
  }
4246
4535
 
4247
4536
  /** Set whether an org-owned Play sorts before unpinned Plays. */
@@ -4342,6 +4631,244 @@ export class DeeplineClient {
4342
4631
  return this.http.get('/api/v2/notifications');
4343
4632
  }
4344
4633
 
4634
+ /** Read the group-based product-notification configuration and rule catalog. */
4635
+ async getNotificationConfiguration(): Promise<ProductNotificationConfigurationResponse> {
4636
+ return this.http.get('/api/v2/notifications/configuration');
4637
+ }
4638
+
4639
+ /** Atomically apply one retry-safe desired configuration change. */
4640
+ async changeNotificationConfiguration(
4641
+ expectedWorkspaceVersion: number,
4642
+ change: ProductNotificationConfigurationChange,
4643
+ ): Promise<Pick<ProductNotificationConfigurationResponse, 'configuration'>> {
4644
+ return this.http.put('/api/v2/notifications/configuration', {
4645
+ expectedWorkspaceVersion,
4646
+ change,
4647
+ });
4648
+ }
4649
+
4650
+ /** Create one notification group and its destinations as a retry-safe unit. */
4651
+ async createNotificationGroup(
4652
+ input: CreateNotificationGroupInput,
4653
+ ): Promise<CreateNotificationGroupResult> {
4654
+ const name = input.name.trim().replace(/\s+/g, ' ');
4655
+ if (!name) throw new Error('Notification group name is required.');
4656
+ if (
4657
+ input.targets.length < 1 ||
4658
+ input.targets.length > MAX_NOTIFICATION_GROUP_CREATE_TARGETS
4659
+ ) {
4660
+ throw new Error(
4661
+ `Choose between 1 and ${MAX_NOTIFICATION_GROUP_CREATE_TARGETS} notification targets.`,
4662
+ );
4663
+ }
4664
+
4665
+ const targets = input.targets.map(parseNotificationGroupTarget);
4666
+ const legacyEvents = input.legacyEvents ?? [];
4667
+ const legacyTarget =
4668
+ targets.length === 1 &&
4669
+ targets[0]?.kind === 'slack' &&
4670
+ legacyEvents.length > 0
4671
+ ? targets[0]
4672
+ : null;
4673
+ if (legacyEvents.length > 0 && !legacyTarget) {
4674
+ throw new Error(
4675
+ '--for is supported only by the legacy one-Slack-target form. Create the group first, then add rules in notification configuration.',
4676
+ );
4677
+ }
4678
+
4679
+ if (!legacyTarget && name.toLowerCase() === 'default') {
4680
+ throw new Error(
4681
+ 'Default is reserved for the workspace default notification group.',
4682
+ );
4683
+ }
4684
+
4685
+ const normalizedTargets = targets.map((target) =>
4686
+ target.kind === 'email'
4687
+ ? `email:${target.email}`
4688
+ : 'memberId' in target
4689
+ ? `slack:member:${target.memberId}`
4690
+ : `slack:${target.channel}`,
4691
+ );
4692
+ if (input.dryRun) {
4693
+ return {
4694
+ mode: 'dry_run' as const,
4695
+ compatibilityMode: legacyTarget !== null,
4696
+ name: legacyTarget ? input.name : name,
4697
+ targets: normalizedTargets,
4698
+ legacyEvents,
4699
+ };
4700
+ }
4701
+
4702
+ if (legacyTarget) {
4703
+ const notification = await this.createNotification({
4704
+ name: input.name,
4705
+ provider: 'slack',
4706
+ ...('channel' in legacyTarget
4707
+ ? { channel: legacyTarget.channel }
4708
+ : { memberId: legacyTarget.memberId }),
4709
+ eventTypes: legacyEvents,
4710
+ });
4711
+ return { mode: 'legacy' as const, notification };
4712
+ }
4713
+
4714
+ const current = await this.getNotificationConfiguration();
4715
+ const existingGroup = current.configuration.groups.find(
4716
+ (candidate) => candidate.name.toLowerCase() === name.toLowerCase(),
4717
+ );
4718
+ const groupKey = existingGroup?.groupKey ?? notificationObjectKey('group');
4719
+ const group: EffectiveProductNotificationGroup = existingGroup ?? {
4720
+ groupKey,
4721
+ name,
4722
+ enabled: true,
4723
+ deliveryTiming: DEFAULT_PRODUCT_NOTIFICATION_DELIVERY_TIMING,
4724
+ source: 'workspace',
4725
+ configMode: 'custom',
4726
+ version: 0,
4727
+ };
4728
+ const destinations = current.configuration.destinations.filter(
4729
+ (destination) => destination.groupKey === groupKey,
4730
+ );
4731
+
4732
+ const emails = [
4733
+ ...new Set(
4734
+ targets.flatMap((target) =>
4735
+ target.kind === 'email' ? [target.email] : [],
4736
+ ),
4737
+ ),
4738
+ ].sort();
4739
+ const existingEmails = new Set(
4740
+ destinations.flatMap((destination) =>
4741
+ destination.settings.kind === 'email_addresses'
4742
+ ? destination.settings.to
4743
+ : [],
4744
+ ),
4745
+ );
4746
+ const newEmails = emails.filter((email) => !existingEmails.has(email));
4747
+ if (newEmails.length > 0) {
4748
+ destinations.push({
4749
+ destinationKey: notificationObjectKey('destination'),
4750
+ groupKey,
4751
+ name: 'Email recipients',
4752
+ enabled: true,
4753
+ source: 'workspace',
4754
+ configMode: 'custom',
4755
+ version: 0,
4756
+ status: 'active',
4757
+ settings: { kind: 'email_addresses', to: newEmails },
4758
+ });
4759
+ }
4760
+
4761
+ const slackTargets = new Map<
4762
+ string,
4763
+ Extract<ParsedNotificationGroupTarget, { kind: 'slack' }>
4764
+ >();
4765
+ for (const target of targets) {
4766
+ if (target.kind !== 'slack') continue;
4767
+ const targetKey =
4768
+ 'memberId' in target
4769
+ ? `member:${target.memberId}`
4770
+ : `channel:${target.channel.replace(/^#/, '').toLowerCase()}`;
4771
+ slackTargets.set(targetKey, target);
4772
+ }
4773
+ const connectionId = current.slackConnection.connectionId;
4774
+ if (slackTargets.size > 0 && !connectionId) {
4775
+ throw new Error(
4776
+ 'Slack is not connected to this workspace. Connect it in Dashboard → Integrations, then retry.',
4777
+ );
4778
+ }
4779
+ const resolvedSlackTargets = await Promise.all(
4780
+ [...slackTargets.values()].map(async (target) => {
4781
+ if ('memberId' in target) {
4782
+ return {
4783
+ targetKind: 'member' as const,
4784
+ targetId: target.memberId,
4785
+ targetName: target.memberId,
4786
+ };
4787
+ }
4788
+ const channel = target.channel;
4789
+ const requested = channel.replace(/^#/, '');
4790
+ const response = await this.listNotificationChannels(channel);
4791
+ const matches = response.channels.filter(
4792
+ (candidate) =>
4793
+ candidate.id === requested ||
4794
+ candidate.name.toLowerCase() === requested.toLowerCase(),
4795
+ );
4796
+ if (matches.length !== 1) {
4797
+ throw new Error(
4798
+ matches.length === 0
4799
+ ? `Slack channel ${channel} was not found or is not visible to the Deepline app.`
4800
+ : `Slack channel ${channel} is ambiguous. Use its channel ID.`,
4801
+ );
4802
+ }
4803
+ return {
4804
+ targetKind: 'channel' as const,
4805
+ targetId: matches[0]!.id,
4806
+ targetName: matches[0]!.name,
4807
+ };
4808
+ }),
4809
+ );
4810
+ const uniqueSlackTargets = new Map(
4811
+ resolvedSlackTargets.map((target) => [
4812
+ `${target.targetKind}:${target.targetId}`,
4813
+ target,
4814
+ ]),
4815
+ );
4816
+ for (const target of uniqueSlackTargets.values()) {
4817
+ if (
4818
+ destinations.some(
4819
+ (destination) =>
4820
+ destination.settings.kind === 'slack' &&
4821
+ destination.settings.targetKind === target.targetKind &&
4822
+ destination.settings.targetId === target.targetId,
4823
+ )
4824
+ ) {
4825
+ continue;
4826
+ }
4827
+ destinations.push({
4828
+ destinationKey: notificationObjectKey('destination'),
4829
+ groupKey,
4830
+ name: `${target.targetKind === 'channel' ? '#' : '@'}${target.targetName}`,
4831
+ enabled: true,
4832
+ source: 'workspace',
4833
+ configMode: 'custom',
4834
+ version: 0,
4835
+ status: 'pending_verification',
4836
+ settings: {
4837
+ kind: 'slack',
4838
+ ...target,
4839
+ oauthConnectionId: connectionId!,
4840
+ },
4841
+ });
4842
+ }
4843
+
4844
+ const draft: ProductNotificationGroupDraft = {
4845
+ group,
4846
+ destinations,
4847
+ rules: current.configuration.rules.filter(
4848
+ (rule) => rule.groupKey === groupKey,
4849
+ ),
4850
+ };
4851
+ const result = await this.changeNotificationConfiguration(
4852
+ current.configuration.workspaceVersion,
4853
+ { kind: 'save_group', draft },
4854
+ );
4855
+ const storedGroup = result.configuration.groups.find(
4856
+ (candidate) => candidate.groupKey === groupKey,
4857
+ );
4858
+ if (!storedGroup) {
4859
+ throw new Error('Notification group creation returned no saved group.');
4860
+ }
4861
+ return {
4862
+ mode: 'native' as const,
4863
+ groupKey,
4864
+ targets: normalizedTargets,
4865
+ group: storedGroup,
4866
+ destinations: result.configuration.destinations.filter(
4867
+ (destination) => destination.groupKey === groupKey,
4868
+ ),
4869
+ };
4870
+ }
4871
+
4345
4872
  /** List Slack channels available to an already-connected Slack integration. */
4346
4873
  async listNotificationChannels(query?: string): Promise<{
4347
4874
  identity: { teamId: string; teamName?: string };
@@ -5049,6 +5576,92 @@ export class DeeplineClient {
5049
5576
  );
5050
5577
  }
5051
5578
 
5579
+ /** Submit durable monitor work; transport retries use the same idempotency key. */
5580
+ async submitMonitorBatch(
5581
+ options: MonitorBatchSubmitOptions,
5582
+ ): Promise<MonitorBatchOperationResult> {
5583
+ const idempotencyKey = options.idempotencyKey.trim();
5584
+ if (!idempotencyKey) {
5585
+ throw new DeeplineError(
5586
+ 'Monitor batch idempotencyKey is required.',
5587
+ undefined,
5588
+ 'INVALID_MONITOR_BATCH_IDEMPOTENCY_KEY',
5589
+ );
5590
+ }
5591
+ if (options.kind === 'deploy') {
5592
+ if (!options.manifestNdjson.trim()) {
5593
+ throw new DeeplineError(
5594
+ 'Monitor batch deploy requires a non-empty NDJSON manifest.',
5595
+ undefined,
5596
+ 'INVALID_MONITOR_BATCH_MANIFEST',
5597
+ );
5598
+ }
5599
+ return this.http.request<MonitorBatchOperationResult>(
5600
+ '/api/v2/monitors/batch',
5601
+ {
5602
+ method: 'POST',
5603
+ body: {
5604
+ kind: 'deploy',
5605
+ manifest_ndjson: options.manifestNdjson,
5606
+ dry_run: options.dryRun === true,
5607
+ idempotency_key: idempotencyKey,
5608
+ },
5609
+ headers: { 'Idempotency-Key': idempotencyKey },
5610
+ maxRetries: 0,
5611
+ exactUrlOnly: true,
5612
+ },
5613
+ );
5614
+ }
5615
+ const scope =
5616
+ options.scope.kind === 'keys'
5617
+ ? { kind: 'keys', monitor_keys: options.scope.monitorKeys }
5618
+ : options.scope.kind === 'fleet'
5619
+ ? { kind: 'fleet', fleet_id: options.scope.fleetId }
5620
+ : { kind: 'target', target: options.scope.target };
5621
+ return this.http.request<MonitorBatchOperationResult>(
5622
+ '/api/v2/monitors/batch',
5623
+ {
5624
+ method: 'POST',
5625
+ body: {
5626
+ kind: options.kind,
5627
+ scope,
5628
+ dry_run: options.dryRun === true,
5629
+ idempotency_key: idempotencyKey,
5630
+ ...(options.deactivationReason === undefined
5631
+ ? {}
5632
+ : { deactivation_reason: options.deactivationReason }),
5633
+ },
5634
+ headers: { 'Idempotency-Key': idempotencyKey },
5635
+ // Durable submission is itself idempotent, but an ambiguous local retry
5636
+ // must retain the exact key and never turn a CLI attempt into two runs.
5637
+ maxRetries: 0,
5638
+ exactUrlOnly: true,
5639
+ },
5640
+ );
5641
+ }
5642
+
5643
+ /** Get durable batch progress and a bounded retained evidence page. */
5644
+ async getMonitorBatch(
5645
+ operationId: string,
5646
+ options?: { cursor?: string | null },
5647
+ ): Promise<MonitorBatchOperationResult> {
5648
+ const runId = operationId.trim();
5649
+ if (!runId) {
5650
+ throw new DeeplineError(
5651
+ 'Monitor batch operation id is required.',
5652
+ undefined,
5653
+ 'INVALID_MONITOR_BATCH_OPERATION_ID',
5654
+ );
5655
+ }
5656
+ const params = new URLSearchParams();
5657
+ if (options?.cursor) params.set('cursor', options.cursor);
5658
+ const suffix = params.size > 0 ? `?${params}` : '';
5659
+ return this.http.request<MonitorBatchOperationResult>(
5660
+ `/api/v2/monitors/batch/${encodeURIComponent(runId)}${suffix}`,
5661
+ { method: 'GET' },
5662
+ );
5663
+ }
5664
+
5052
5665
  /**
5053
5666
  * The deployable monitor tools catalog. Pass a tool id (positional or
5054
5667
  * `{ tool }`) to describe one tool's full payload/stream contract, or no tool