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
@@ -0,0 +1,35 @@
1
+ /**
2
+ * The Convex cron roots that an authenticated platform operator may run on
3
+ * demand. Keep this list aligned with `packages/convex/crons.ts`; the catalog
4
+ * check makes a newly added Convex cron fail closed until it joins here.
5
+ *
6
+ * Other scheduler types deliberately are not listed. They need their own
7
+ * narrowly-scoped execution authority (rather than letting a Convex deploy
8
+ * key impersonate GitHub, Vercel, or Inngest).
9
+ */
10
+ export const MANUALLY_RUNNABLE_CONVEX_CRON_JOB_IDS = [
11
+ 'convex.fold-usage-rollups',
12
+ 'convex.record-neon-managed-project-usage',
13
+ 'convex.cleanup-expired-mcp-oauth-codes',
14
+ 'convex.cleanup-expired-analytics-ip2company-cache',
15
+ 'convex.cleanup-expired-domain-health-cache',
16
+ 'convex.salesforce-oauth-refresh-maintenance',
17
+ 'convex.monitor-fleet-convergence-tick',
18
+ 'convex.provider-monitor-global-audit-daily',
19
+ 'convex.recover-notification-delivery-work',
20
+ 'convex.cleanup-expired-notification-audit-records',
21
+ 'convex.fail-stale-play-deployments',
22
+ ] as const;
23
+
24
+ export type ManuallyRunnableConvexCronJobId =
25
+ (typeof MANUALLY_RUNNABLE_CONVEX_CRON_JOB_IDS)[number];
26
+
27
+ const manuallyRunnableConvexCronJobIds = new Set<string>(
28
+ MANUALLY_RUNNABLE_CONVEX_CRON_JOB_IDS,
29
+ );
30
+
31
+ export function isManuallyRunnableConvexCronJob(
32
+ jobId: string,
33
+ ): jobId is ManuallyRunnableConvexCronJobId {
34
+ return manuallyRunnableConvexCronJobIds.has(jobId);
35
+ }
@@ -10,6 +10,7 @@ export type ScheduledWorkScheduler =
10
10
  | 'vercel_cron';
11
11
 
12
12
  export type ScheduledWorkOutcome = 'running' | 'succeeded' | 'failed';
13
+ export type ScheduledWorkTrigger = 'scheduled' | 'manual';
13
14
 
14
15
  export type ScheduledWorkVolume = {
15
16
  unit: string;
@@ -34,6 +35,7 @@ export type ScheduledWorkObservation = {
34
35
  occurredAt: number;
35
36
  outcome: ScheduledWorkOutcome;
36
37
  expectedWithinMs: number;
38
+ trigger?: ScheduledWorkTrigger;
37
39
  durationMs?: number;
38
40
  errorSummary?: string;
39
41
  runUrl?: string;
@@ -53,6 +55,9 @@ export function scheduledWorkTelemetryFields(
53
55
  scheduledWorkOutcome: observation.outcome,
54
56
  scheduledWorkInvocationId: observation.invocationId,
55
57
  scheduledWorkExpectedWithinMs: observation.expectedWithinMs,
58
+ ...(observation.trigger === undefined
59
+ ? {}
60
+ : { scheduledWorkTrigger: observation.trigger }),
56
61
  ...(observation.durationMs === undefined
57
62
  ? {}
58
63
  : { scheduledWorkDurationMs: observation.durationMs }),
@@ -0,0 +1,9 @@
1
+ /** Shared tenant data-plane topology and database role names. */
2
+ export const TENANT_DATA_PLANE_TOPOLOGY = 'project_per_org';
3
+
4
+ export const TENANT_OWNER_ROLE_NAME = 'dl_platform_owner';
5
+ export const TENANT_RUNTIME_ROLE_NAME = 'dl_platform_runtime';
6
+ export const TENANT_READ_ROLE_NAME = 'dl_tenant_read';
7
+ export const TENANT_OVERRIDE_ROLE_NAME = 'dl_tenant_override';
8
+
9
+ export const TENANT_BASELINE_SCHEMA_VERSION = 1;
@@ -0,0 +1,272 @@
1
+ import {
2
+ S3Client,
3
+ PutObjectCommand,
4
+ GetObjectCommand,
5
+ HeadObjectCommand,
6
+ } from '@aws-sdk/client-s3';
7
+ import { NodeHttpHandler } from '@smithy/node-http-handler';
8
+ import { getSignedUrl } from '@aws-sdk/s3-request-presigner';
9
+ import { Agent as HttpsAgent } from 'node:https';
10
+ import { isBuildContext } from '../observability/build-context';
11
+
12
+ type R2PresignerClient = Parameters<typeof getSignedUrl>[0];
13
+ type R2PresignerCommand = Parameters<typeof getSignedUrl>[1];
14
+
15
+ export type R2BucketKind = 'default' | 'playArtifacts';
16
+
17
+ const PLAY_ARTIFACT_BUCKETS = {
18
+ dev: 'plays-artifacts-v1-dev',
19
+ prod: 'plays-artifacts-v1-prod',
20
+ } as const;
21
+
22
+ function requireEnv(name: string): string {
23
+ const value = process.env[name]?.trim();
24
+ if (!value) {
25
+ throw new Error(`Missing ${name}`);
26
+ }
27
+ return value;
28
+ }
29
+
30
+ function getRuntimeEnv(): keyof typeof PLAY_ARTIFACT_BUCKETS {
31
+ const candidates = [
32
+ process.env.DEEPLINE_ENV,
33
+ process.env.VERCEL_ENV,
34
+ process.env.NODE_ENV,
35
+ ]
36
+ .filter(Boolean)
37
+ .map((value) => String(value).trim().toLowerCase());
38
+
39
+ for (const value of candidates) {
40
+ if (value === 'production' || value === 'prod' || value === 'live') {
41
+ return 'prod';
42
+ }
43
+ if (
44
+ value === 'development' ||
45
+ value === 'dev' ||
46
+ value === 'preview' ||
47
+ value === 'staging' ||
48
+ value === 'stage' ||
49
+ value === 'test'
50
+ ) {
51
+ return 'dev';
52
+ }
53
+ }
54
+
55
+ return 'dev';
56
+ }
57
+
58
+ function resolveBucket(kind: R2BucketKind): string {
59
+ if (kind === 'playArtifacts') {
60
+ return PLAY_ARTIFACT_BUCKETS[getRuntimeEnv()];
61
+ }
62
+ return requireEnv('CLOUDFLARE_R2_BUCKET_NAME');
63
+ }
64
+
65
+ export function getR2Config(kind: R2BucketKind = 'default') {
66
+ return {
67
+ endpoint: requireEnv('CLOUDFLARE_R2_ENDPOINT'),
68
+ accessKeyId: requireEnv('CLOUDFLARE_R2_ACCESS_KEY_ID'),
69
+ secretAccessKey: requireEnv('CLOUDFLARE_R2_SECRET_ACCESS_KEY'),
70
+ bucket: resolveBucket(kind),
71
+ publicUrl: requireEnv('CLOUDFLARE_R2_PUBLIC_URL'),
72
+ };
73
+ }
74
+
75
+ export function createR2Client(
76
+ config: ReturnType<typeof getR2Config>,
77
+ ): S3Client {
78
+ return new S3Client({
79
+ region: 'auto',
80
+ endpoint: config.endpoint,
81
+ credentials: {
82
+ accessKeyId: config.accessKeyId,
83
+ secretAccessKey: config.secretAccessKey,
84
+ },
85
+ requestHandler: new NodeHttpHandler({
86
+ httpsAgent: new HttpsAgent({
87
+ keepAlive: true,
88
+ maxSockets: 64,
89
+ }),
90
+ }),
91
+ });
92
+ }
93
+
94
+ const r2ClientMemo = new Map<string, S3Client>();
95
+
96
+ function getR2Client(config: ReturnType<typeof getR2Config>): S3Client {
97
+ const key = `${config.endpoint}|${config.bucket}|${config.accessKeyId}`;
98
+ const existing = r2ClientMemo.get(key);
99
+ if (existing) {
100
+ return existing;
101
+ }
102
+ const client = createR2Client(config);
103
+ r2ClientMemo.set(key, client);
104
+ return client;
105
+ }
106
+
107
+ function logR2Perf(
108
+ operation: string,
109
+ key: string,
110
+ startedAt: number,
111
+ extra: Record<string, unknown> = {},
112
+ ) {
113
+ // `[perf][r2]` fires on every object op; during the prebuilt-artifact build it
114
+ // floods the log. Keep it at runtime (Axiom) but silence it in the build.
115
+ if (isBuildContext()) return;
116
+ console.info('[perf][r2]', {
117
+ operation,
118
+ key,
119
+ ms: Date.now() - startedAt,
120
+ ...extra,
121
+ });
122
+ }
123
+
124
+ export async function r2ObjectExists(
125
+ key: string,
126
+ kind: R2BucketKind = 'default',
127
+ ): Promise<boolean> {
128
+ const startedAt = Date.now();
129
+ const config = getR2Config(kind);
130
+ const client = getR2Client(config);
131
+ try {
132
+ await client.send(
133
+ new HeadObjectCommand({
134
+ Bucket: config.bucket,
135
+ Key: key,
136
+ }),
137
+ );
138
+ logR2Perf('head', key, startedAt, { kind, exists: true });
139
+ return true;
140
+ } catch {
141
+ logR2Perf('head', key, startedAt, { kind, exists: false });
142
+ return false;
143
+ }
144
+ }
145
+
146
+ export async function uploadBufferToR2(input: {
147
+ key: string;
148
+ body: Buffer | Uint8Array;
149
+ contentType: string;
150
+ bucketKind?: R2BucketKind;
151
+ }): Promise<string> {
152
+ const startedAt = Date.now();
153
+ const bucketKind = input.bucketKind ?? 'default';
154
+ const configStartedAt = Date.now();
155
+ const config = getR2Config(bucketKind);
156
+ logR2Perf('config', input.key, configStartedAt, { kind: bucketKind });
157
+ const clientStartedAt = Date.now();
158
+ const client = getR2Client(config);
159
+ logR2Perf('client', input.key, clientStartedAt, { kind: bucketKind });
160
+
161
+ const sendStartedAt = Date.now();
162
+ await client.send(
163
+ new PutObjectCommand({
164
+ Bucket: config.bucket,
165
+ Key: input.key,
166
+ Body:
167
+ input.body instanceof Buffer ? new Uint8Array(input.body) : input.body,
168
+ ContentType: input.contentType,
169
+ }),
170
+ );
171
+ logR2Perf('put-send', input.key, sendStartedAt, {
172
+ kind: bucketKind,
173
+ bytes: input.body.byteLength,
174
+ });
175
+ logR2Perf('put', input.key, startedAt, {
176
+ kind: bucketKind,
177
+ bytes: input.body.byteLength,
178
+ });
179
+
180
+ if (bucketKind === 'playArtifacts') {
181
+ return `r2://${config.bucket}/${input.key}`;
182
+ }
183
+ return `${config.publicUrl.replace(/\/+$/, '')}/${input.key}`;
184
+ }
185
+
186
+ export async function getBufferFromR2(
187
+ key: string,
188
+ kind: R2BucketKind = 'default',
189
+ ): Promise<Buffer> {
190
+ const startedAt = Date.now();
191
+ const config = getR2Config(kind);
192
+ const client = getR2Client(config);
193
+
194
+ const response = await client.send(
195
+ new GetObjectCommand({
196
+ Bucket: config.bucket,
197
+ Key: key,
198
+ }),
199
+ );
200
+
201
+ const bytes = await response.Body!.transformToByteArray();
202
+ logR2Perf('get', key, startedAt, { kind, bytes: bytes.byteLength });
203
+ return Buffer.from(bytes);
204
+ }
205
+
206
+ export async function createSignedR2ReadUrl(input: {
207
+ key: string;
208
+ kind?: R2BucketKind;
209
+ expiresInSeconds: number;
210
+ }): Promise<{ url: string; expiresAt: string }> {
211
+ const startedAt = Date.now();
212
+ const kind = input.kind ?? 'default';
213
+ const config = getR2Config(kind);
214
+ const client = createR2Client(config);
215
+ const expiresInSeconds = Math.max(1, Math.floor(input.expiresInSeconds));
216
+ const command = new GetObjectCommand({
217
+ Bucket: config.bucket,
218
+ Key: input.key,
219
+ });
220
+ const url = await getSignedUrl(
221
+ client as R2PresignerClient,
222
+ command as R2PresignerCommand,
223
+ { expiresIn: expiresInSeconds },
224
+ );
225
+ logR2Perf('sign-get', input.key, startedAt, {
226
+ kind,
227
+ expiresInSeconds,
228
+ });
229
+ return {
230
+ url,
231
+ expiresAt: new Date(Date.now() + expiresInSeconds * 1000).toISOString(),
232
+ };
233
+ }
234
+
235
+ /**
236
+ * Mint a short-lived presigned PUT URL so a client can upload an object body
237
+ * straight to R2, bypassing the serverless request-body ceiling that a proxied
238
+ * upload through the Next.js route would hit.
239
+ *
240
+ * The URL signs `ContentType`, so the caller MUST send a matching
241
+ * `Content-Type` header on the PUT for the signature to validate.
242
+ */
243
+ export async function createSignedR2WriteUrl(input: {
244
+ key: string;
245
+ kind?: R2BucketKind;
246
+ contentType: string;
247
+ expiresInSeconds: number;
248
+ }): Promise<{ url: string; expiresAt: string }> {
249
+ const startedAt = Date.now();
250
+ const kind = input.kind ?? 'default';
251
+ const config = getR2Config(kind);
252
+ const client = createR2Client(config);
253
+ const expiresInSeconds = Math.max(1, Math.floor(input.expiresInSeconds));
254
+ const command = new PutObjectCommand({
255
+ Bucket: config.bucket,
256
+ Key: input.key,
257
+ ContentType: input.contentType,
258
+ });
259
+ const url = await getSignedUrl(
260
+ client as R2PresignerClient,
261
+ command as R2PresignerCommand,
262
+ { expiresIn: expiresInSeconds },
263
+ );
264
+ logR2Perf('sign-put', input.key, startedAt, {
265
+ kind,
266
+ expiresInSeconds,
267
+ });
268
+ return {
269
+ url,
270
+ expiresAt: new Date(Date.now() + expiresInSeconds * 1000).toISOString(),
271
+ };
272
+ }
@@ -101,7 +101,11 @@ export type PlayActivityState =
101
101
  };
102
102
 
103
103
  export type PlayActivityObservation = {
104
- schemaVersion: 1;
104
+ /**
105
+ * Retired marker. Producers stopped writing it; envelopes still in flight
106
+ * from an older producer carry `1`, so readers tolerate both shapes.
107
+ */
108
+ schemaVersion?: 1;
105
109
  /** Stable within one run, for example `tool:discover_ctos` or `dataset:leads`. */
106
110
  activityId: string;
107
111
  /** Optional owning play step. */
@@ -126,7 +130,7 @@ export function isPlayActivityObservation(
126
130
  ): value is PlayActivityObservation {
127
131
  if (
128
132
  !isRecord(value) ||
129
- value.schemaVersion !== 1 ||
133
+ (value.schemaVersion !== undefined && value.schemaVersion !== 1) ||
130
134
  typeof value.activityId !== 'string' ||
131
135
  !value.activityId.trim() ||
132
136
  typeof value.observedAt !== 'number' ||
@@ -316,7 +320,6 @@ export function createPlayActivityReporter(input: {
316
320
  type: 'activity.observed',
317
321
  observation: {
318
322
  ...observation,
319
- schemaVersion: 1,
320
323
  observedAt: observation.observedAt ?? input.now?.() ?? Date.now(),
321
324
  },
322
325
  });
@@ -402,7 +405,6 @@ export function projectPlayRunActivity(input: {
402
405
  if (input.waitKind === 'detached_runner') {
403
406
  return projection(
404
407
  {
405
- schemaVersion: 1,
406
408
  activityId: 'runner:managed',
407
409
  target: {
408
410
  kind: 'runner',
@@ -418,7 +420,6 @@ export function projectPlayRunActivity(input: {
418
420
  if (input.waitKind === 'sleep') {
419
421
  return projection(
420
422
  {
421
- schemaVersion: 1,
422
423
  activityId: 'run:sleep',
423
424
  target: {
424
425
  kind: 'step',
@@ -441,7 +442,6 @@ export function projectPlayRunActivity(input: {
441
442
  ) {
442
443
  return projection(
443
444
  {
444
- schemaVersion: 1,
445
445
  activityId: `event:${input.activeNodeId ?? 'run'}`,
446
446
  stepId: input.activeNodeId ?? undefined,
447
447
  target: {
@@ -468,7 +468,6 @@ export function projectPlayRunActivity(input: {
468
468
  if (normalizedStatus === 'waiting') {
469
469
  return projection(
470
470
  {
471
- schemaVersion: 1,
472
471
  activityId: 'run:legacy-wait',
473
472
  target: {
474
473
  kind: 'step',
@@ -506,7 +505,6 @@ export function projectPlayRunActivity(input: {
506
505
  const datasetProgress = datasetStep?.progress ?? null;
507
506
  return projection(
508
507
  {
509
- schemaVersion: 1,
510
508
  activityId: `dataset:${pendingDataset.datasetId ?? pendingDataset.tableNamespace}`,
511
509
  target: {
512
510
  kind: 'dataset',
@@ -548,7 +546,6 @@ export function projectPlayRunActivity(input: {
548
546
  const provider = toolId?.split(/[._]/)[0]?.trim() || null;
549
547
  return projection(
550
548
  {
551
- schemaVersion: 1,
552
549
  activityId: `step:${activeStep.nodeId}`,
553
550
  stepId: activeStep.nodeId,
554
551
  target:
@@ -577,7 +574,6 @@ export function projectPlayRunActivity(input: {
577
574
  if (normalizedStatus === 'queued') {
578
575
  return projection(
579
576
  {
580
- schemaVersion: 1,
581
577
  activityId: 'capacity:worker',
582
578
  target: { kind: 'capacity', pool: 'worker' },
583
579
  state: { kind: 'queued', reason: 'capacity' },
@@ -588,7 +584,6 @@ export function projectPlayRunActivity(input: {
588
584
  }
589
585
 
590
586
  const fallback: PlayActivityObservation = {
591
- schemaVersion: 1,
592
587
  activityId: 'run:legacy',
593
588
  target: {
594
589
  kind: 'step',
@@ -4,6 +4,7 @@ import { stat } from 'node:fs/promises';
4
4
  import { Readable } from 'node:stream';
5
5
  import { pipeline } from 'node:stream/promises';
6
6
  import type { PlaySheetContract } from '../plays/static-pipeline';
7
+ import type { AsyncPlayRunRef } from '../plays/authoring-contract';
7
8
  import type { PlayRowUpdate } from './/ctx-types';
8
9
  import type { PlayRunTimelineEntry } from './/live-events';
9
10
  import type { PlayDatasetBornFrom } from './/cell-provenance';
@@ -179,6 +180,58 @@ type RuntimeApiRequest =
179
180
  runId: string;
180
181
  firstClaimLatencyMs: number;
181
182
  }
183
+ | {
184
+ action: 'launch_play_async';
185
+ key: string;
186
+ invocationKey: string;
187
+ playRef: string;
188
+ input: Record<string, unknown>;
189
+ description: string;
190
+ schedulerSchema?: string | null;
191
+ ancestryPlayIds: string[];
192
+ }
193
+ | {
194
+ action: 'project_run_created';
195
+ idempotencyKey: string;
196
+ playName: string;
197
+ playReference?: string | null;
198
+ workflowId: string;
199
+ runId: string;
200
+ workflowFamilyKey: string;
201
+ /** Optional for root and older durable admission envelopes. */
202
+ parentRunId?: string | null;
203
+ rootRunId?: string | null;
204
+ asyncLaunchKey?: string | null;
205
+ asyncInvocationKey?: string | null;
206
+ asyncRequestFingerprint?: string | null;
207
+ asyncAncestryPlayIds?: string[] | null;
208
+ definitionScope?: 'org' | 'system';
209
+ revisionId?: string | null;
210
+ artifactStorageKey?: string | null;
211
+ artifactHash?: string | null;
212
+ graphHash?: string | null;
213
+ runtimeBackend?: string | null;
214
+ schedulerBackend?: string | null;
215
+ schedulerSchema?: string | null;
216
+ executionProfile?: string | null;
217
+ runtimeReleaseId?: string | null;
218
+ runtimeDeployVersion?: string | null;
219
+ runtimeCallbackBaseUrl?: string | null;
220
+ coordinatorUrl?: string | null;
221
+ coordinatorWorkerName?: string | null;
222
+ runtimeWorkflowName?: string | null;
223
+ runtimeHarnessWorkerName?: string | null;
224
+ maxCreditsPerRun?: number | null;
225
+ staticPipeline?: unknown;
226
+ source?: 'published' | 'ad_hoc' | 'draft';
227
+ triggerSource?: 'webhook' | 'cron' | 'sql_listener' | 'api';
228
+ inputFileId?: string;
229
+ inputBytes?: number;
230
+ inputSha256?: string;
231
+ replayedFromRunId?: string | null;
232
+ secretRefs?: unknown[];
233
+ inputSummary?: Record<string, unknown>;
234
+ }
182
235
  | ({
183
236
  action: 'save_results';
184
237
  } & RuntimeSaveResults)
@@ -546,6 +599,17 @@ function isRetryableAppRuntimeResponse(input: {
546
599
  ) {
547
600
  return true;
548
601
  }
602
+ // Convex can deploy the projector before the Vercel app knows this action.
603
+ // That old app returns this exact unstructured 403. The projection is
604
+ // idempotent and the outbox keeps its delivery receipt, so retrying bridges
605
+ // the release skew without classifying real executor authorization failures
606
+ // as transient.
607
+ if (
608
+ input.action === 'project_run_created' &&
609
+ isLegacyProjectRunCreatedUnsupportedActionResponse(input)
610
+ ) {
611
+ return true;
612
+ }
549
613
  // The app runtime may explicitly classify an otherwise-client-error status
550
614
  // as transient. Keep the structured delivery contract authoritative rather
551
615
  // than reducing every 4xx to permanent at the worker boundary.
@@ -564,6 +628,32 @@ function isRetryableAppRuntimeResponse(input: {
564
628
  return isRetryableAppRuntimeResponseStatus(input.status);
565
629
  }
566
630
 
631
+ /**
632
+ * The pre-reader app returns this one precise response for an action it does
633
+ * not yet know. Do not use a substring match here: an authorization failure
634
+ * that merely repeats the phrase must remain terminal and reach an operator.
635
+ */
636
+ function isLegacyProjectRunCreatedUnsupportedActionResponse(input: {
637
+ status: number;
638
+ body: string;
639
+ }): boolean {
640
+ if (input.status !== 403) return false;
641
+ const expected = 'Unsupported runtime action capability scope.';
642
+ try {
643
+ const parsed = JSON.parse(input.body) as unknown;
644
+ return (
645
+ !!parsed &&
646
+ typeof parsed === 'object' &&
647
+ !Array.isArray(parsed) &&
648
+ (parsed as { error?: unknown }).error === expected
649
+ );
650
+ } catch {
651
+ // The oldest route can return the bare legacy message. Retain that bridge
652
+ // while keeping it exact rather than accepting an arbitrary 403 body.
653
+ return input.body.trim() === expected;
654
+ }
655
+ }
656
+
567
657
  function appRuntimeExplicitRetryable(body: string): boolean | null {
568
658
  try {
569
659
  const parsed = JSON.parse(body) as unknown;
@@ -716,10 +806,12 @@ function isRetryableAppRuntimeAction(
716
806
  action === 'rate_state_release' ||
717
807
  action === 'rate_state_penalize' ||
718
808
  action === 'record_first_claim_latency' ||
809
+ action === 'project_run_created' ||
719
810
  action === 'release_runtime_step_receipt' ||
720
811
  action === 'save_results' ||
721
812
  action === 'skip_runtime_step_receipt' ||
722
- action === 'start_run'
813
+ action === 'start_run' ||
814
+ action === 'launch_play_async'
723
815
  );
724
816
  }
725
817
 
@@ -1073,7 +1165,8 @@ export class AppRuntimeApiResponseError extends Error {
1073
1165
  this.requestId = input.requestId?.trim() || null;
1074
1166
  this.retryable = input.retryable;
1075
1167
  this.retryAfterMs =
1076
- typeof input.retryAfterMs === 'number' && Number.isFinite(input.retryAfterMs)
1168
+ typeof input.retryAfterMs === 'number' &&
1169
+ Number.isFinite(input.retryAfterMs)
1077
1170
  ? Math.max(0, Math.floor(input.retryAfterMs))
1078
1171
  : null;
1079
1172
  this.detail = input.detail;
@@ -1963,16 +2056,14 @@ export async function appendRunEventsViaAppRuntime(
1963
2056
  let terminalBatchIndex = -1;
1964
2057
  for (let index = batches.length - 1; index >= 0; index -= 1) {
1965
2058
  if (
1966
- batches[index]!.some(
1967
- (event) => {
1968
- const key = event.key ?? event.type;
1969
- return (
1970
- key === 'run.completed' ||
1971
- key === 'run.failed' ||
1972
- key === 'run.cancelled'
1973
- );
1974
- },
1975
- )
2059
+ batches[index]!.some((event) => {
2060
+ const key = event.key ?? event.type;
2061
+ return (
2062
+ key === 'run.completed' ||
2063
+ key === 'run.failed' ||
2064
+ key === 'run.cancelled'
2065
+ );
2066
+ })
1976
2067
  ) {
1977
2068
  terminalBatchIndex = index;
1978
2069
  break;
@@ -2021,6 +2112,19 @@ export async function startRunViaAppRuntime(
2021
2112
  });
2022
2113
  }
2023
2114
 
2115
+ export async function projectRunCreatedViaAppRuntime(
2116
+ context: WorkerRuntimeApiContext,
2117
+ input: Omit<
2118
+ Extract<RuntimeApiRequest, { action: 'project_run_created' }>,
2119
+ 'action'
2120
+ >,
2121
+ ): Promise<void> {
2122
+ await postAppRuntimeApi<{ ok: true; status: 'queued' }>(context, {
2123
+ action: 'project_run_created',
2124
+ ...input,
2125
+ });
2126
+ }
2127
+
2024
2128
  export async function recordFirstClaimLatencyViaAppRuntime(
2025
2129
  context: WorkerRuntimeApiContext,
2026
2130
  input: { runId: string; firstClaimLatencyMs: number },
@@ -2031,6 +2135,25 @@ export async function recordFirstClaimLatencyViaAppRuntime(
2031
2135
  });
2032
2136
  }
2033
2137
 
2138
+ export async function launchPlayAsyncViaAppRuntime(
2139
+ context: WorkerRuntimeApiContext,
2140
+ input: {
2141
+ key: string;
2142
+ invocationKey: string;
2143
+ playRef: string;
2144
+ input: Record<string, unknown>;
2145
+ description: string;
2146
+ schedulerSchema?: string | null;
2147
+ ancestryPlayIds: readonly string[];
2148
+ },
2149
+ ): Promise<AsyncPlayRunRef> {
2150
+ return await postAppRuntimeApi<AsyncPlayRunRef>(context, {
2151
+ action: 'launch_play_async',
2152
+ ...input,
2153
+ ancestryPlayIds: [...input.ancestryPlayIds],
2154
+ });
2155
+ }
2156
+
2034
2157
  export async function saveResultsViaAppRuntime(
2035
2158
  context: WorkerRuntimeApiContext,
2036
2159
  input: RuntimeSaveResults,