deepline 0.3.89 → 0.3.91

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 (267) hide show
  1. package/contracts/install-commands.json +29 -0
  2. package/dist/bundling-sources/sdk/src/client.ts +221 -43
  3. package/dist/bundling-sources/sdk/src/index.ts +4 -0
  4. package/dist/bundling-sources/sdk/src/monitor-fleet-contract.ts +2 -556
  5. package/dist/bundling-sources/sdk/src/monitor-fleets.ts +2 -2
  6. package/dist/bundling-sources/sdk/src/pagination.ts +25 -0
  7. package/dist/bundling-sources/sdk/src/plays/bundle-play-file.ts +1 -1
  8. package/dist/bundling-sources/sdk/src/release.ts +11 -9
  9. package/dist/bundling-sources/sdk/src/types.ts +29 -1
  10. package/dist/bundling-sources/shared_libs/integration-contracts/monitor-fleet-contract.ts +549 -0
  11. package/dist/bundling-sources/shared_libs/monitors/analytics-public.ts +10 -0
  12. package/dist/bundling-sources/shared_libs/monitors/fleets/errors.ts +96 -0
  13. package/dist/bundling-sources/shared_libs/monitors/fleets/limits.ts +8 -0
  14. package/dist/bundling-sources/shared_libs/monitors/fleets/plan.ts +320 -0
  15. package/dist/bundling-sources/shared_libs/monitors/fleets/verdict.ts +106 -0
  16. package/dist/bundling-sources/shared_libs/monitors/http-error-response.ts +8 -1
  17. package/dist/bundling-sources/shared_libs/monitors/inbound-queue.ts +4 -4
  18. package/dist/bundling-sources/shared_libs/monitors/inventory-reconciliation.ts +59 -0
  19. package/dist/bundling-sources/shared_libs/monitors/lifecycle-notifications.ts +7 -9
  20. package/dist/bundling-sources/shared_libs/monitors/monitor-fleet-limits.ts +2 -12
  21. package/dist/bundling-sources/shared_libs/monitors/package.json +113 -4
  22. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-batch-operation.ts +56 -9
  23. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-consumer-health.ts +2 -2
  24. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-identity-claims.ts +2 -2
  25. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-public-aliases.ts +1 -1
  26. package/dist/bundling-sources/shared_libs/monitors/signal-radars/inbound-dead-letter.ts +245 -0
  27. package/dist/bundling-sources/shared_libs/monitors/signal-radars/inbound-message.ts +38 -0
  28. package/dist/bundling-sources/shared_libs/monitors/signal-radars/inbound-queue-ack-probe.ts +94 -0
  29. package/dist/bundling-sources/shared_libs/monitors/signal-radars/inbound-queue-delivery.ts +60 -0
  30. package/dist/bundling-sources/shared_libs/monitors/signal-radars/inbound-queue.ts +60 -0
  31. package/dist/bundling-sources/shared_libs/monitors/snitcher-install-validation.ts +1 -1
  32. package/dist/bundling-sources/shared_libs/monitors/snitcher-ip2company.ts +2 -2
  33. package/dist/bundling-sources/shared_libs/monitors/snitcher-radar.ts +1 -1
  34. package/dist/bundling-sources/shared_libs/monitors/tracking-provider-integrations.ts +1 -1
  35. package/dist/bundling-sources/shared_libs/observability/build-context.ts +13 -0
  36. package/dist/bundling-sources/shared_libs/observability/log-metadata.ts +160 -0
  37. package/dist/bundling-sources/shared_libs/observability/request-context.ts +68 -0
  38. package/dist/bundling-sources/shared_libs/observability/scheduled-jobs.json +690 -0
  39. package/dist/bundling-sources/shared_libs/observability/scheduled-work-manual.ts +35 -0
  40. package/dist/bundling-sources/shared_libs/observability/scheduled-work.ts +5 -0
  41. package/dist/bundling-sources/shared_libs/play-data-plane/neon-constants.ts +9 -0
  42. package/dist/bundling-sources/shared_libs/play-data-plane/r2.ts +272 -0
  43. package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +46 -1
  44. package/dist/bundling-sources/shared_libs/play-runtime/async-operation.ts +66 -1
  45. package/dist/bundling-sources/shared_libs/play-runtime/async-play-invocation.ts +0 -1
  46. package/dist/bundling-sources/shared_libs/play-runtime/bounceban-batching.ts +137 -0
  47. package/dist/bundling-sources/shared_libs/play-runtime/context.ts +779 -140
  48. package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +46 -0
  49. package/dist/bundling-sources/shared_libs/play-runtime/daytona-payload-contract.ts +68 -0
  50. package/dist/bundling-sources/shared_libs/play-runtime/daytona-sandbox-janitor.ts +103 -0
  51. package/dist/bundling-sources/shared_libs/play-runtime/daytona-sandbox-reaper.ts +725 -0
  52. package/dist/bundling-sources/shared_libs/play-runtime/db-session-lease-store.ts +578 -0
  53. package/dist/bundling-sources/shared_libs/play-runtime/deployment/commands/roll-execution-relay.ts +521 -0
  54. package/dist/bundling-sources/shared_libs/play-runtime/deployment/commands/roll-receipt-gateway.ts +1378 -0
  55. package/dist/bundling-sources/shared_libs/play-runtime/deployment/commands/runtime-topology.ts +1024 -0
  56. package/dist/bundling-sources/shared_libs/play-runtime/deployment/fly-gateway-route-probe.ts +193 -0
  57. package/dist/bundling-sources/shared_libs/play-runtime/deployment/fly-machine-lifecycle.ts +104 -0
  58. package/dist/bundling-sources/shared_libs/play-runtime/deployment/fly-machines.ts +1844 -0
  59. package/dist/bundling-sources/shared_libs/play-runtime/deployment/fly-registry.ts +21 -0
  60. package/dist/bundling-sources/shared_libs/play-runtime/deployment/process-tree.ts +40 -0
  61. package/dist/bundling-sources/shared_libs/play-runtime/deployment/runtime-gateway-drain.ts +262 -0
  62. package/dist/bundling-sources/shared_libs/play-runtime/deployment/runtime-surface.ts +98 -0
  63. package/dist/bundling-sources/shared_libs/play-runtime/deployment/runtime-topology.ts +303 -0
  64. package/dist/bundling-sources/shared_libs/play-runtime/deployment/runtime-tuple-publication-guardian.ts +70 -0
  65. package/dist/bundling-sources/shared_libs/play-runtime/deployment/runtime-tuple-recovery.ts +519 -0
  66. package/dist/bundling-sources/shared_libs/play-runtime/deployment/vercel-fly-rollback-alignment.ts +280 -0
  67. package/dist/bundling-sources/shared_libs/play-runtime/deployment/vercel-production-gate.ts +159 -0
  68. package/dist/bundling-sources/shared_libs/play-runtime/durable-call-cache.ts +29 -0
  69. package/dist/bundling-sources/shared_libs/play-runtime/execution-capabilities.ts +23 -0
  70. package/dist/bundling-sources/shared_libs/play-runtime/execution-gateway-invocation-fence.ts +442 -0
  71. package/dist/bundling-sources/shared_libs/play-runtime/execution-protocol.ts +3 -3
  72. package/dist/bundling-sources/shared_libs/play-runtime/fixture-behavior.ts +18 -0
  73. package/dist/bundling-sources/shared_libs/play-runtime/governor/app-runtime-rate-state-backend.ts +9 -0
  74. package/dist/bundling-sources/shared_libs/play-runtime/governor/policy.ts +1 -1
  75. package/dist/bundling-sources/shared_libs/play-runtime/governor/rate-state-backend.ts +1 -1
  76. package/dist/bundling-sources/shared_libs/play-runtime/integration-operation-reader-fence/contracts.ts +66 -0
  77. package/dist/bundling-sources/shared_libs/play-runtime/integration-operation-reader-fence/job.ts +145 -0
  78. package/dist/bundling-sources/shared_libs/play-runtime/integration-operation-reader-fence/memory-store.ts +114 -0
  79. package/dist/bundling-sources/shared_libs/play-runtime/integration-operation-reader-fence/ports.ts +21 -0
  80. package/dist/bundling-sources/shared_libs/play-runtime/integration-operation-reader-fence/postgres-store.ts +170 -0
  81. package/dist/bundling-sources/shared_libs/play-runtime/internal-bootstrap-token.ts +1322 -0
  82. package/dist/bundling-sources/shared_libs/play-runtime/internal-step-ids.ts +2 -2
  83. package/dist/bundling-sources/shared_libs/play-runtime/lane-retirement-gate.ts +1 -1
  84. package/dist/bundling-sources/shared_libs/play-runtime/launch-source-policy.ts +112 -0
  85. package/dist/bundling-sources/shared_libs/play-runtime/map-execution-frame.ts +8 -0
  86. package/dist/bundling-sources/shared_libs/play-runtime/perf-trace.ts +127 -0
  87. package/dist/bundling-sources/shared_libs/play-runtime/play-artifact-runtime-contract.ts +5 -0
  88. package/dist/bundling-sources/shared_libs/play-runtime/play-run-recovery-policy.ts +24 -1
  89. package/dist/bundling-sources/shared_libs/play-runtime/play-runs/admission/contracts.ts +56 -0
  90. package/dist/bundling-sources/shared_libs/play-runtime/play-runs/admission/index.ts +13 -0
  91. package/dist/bundling-sources/shared_libs/play-runtime/play-runs/admission/job.ts +41 -0
  92. package/dist/bundling-sources/shared_libs/play-runtime/play-runs/admission/ports.ts +17 -0
  93. package/dist/bundling-sources/shared_libs/play-runtime/play-runs/admission/postgres-adapter.ts +54 -0
  94. package/dist/bundling-sources/shared_libs/play-runtime/play-runs/attempts/contracts.ts +114 -0
  95. package/dist/bundling-sources/shared_libs/play-runtime/play-runs/attempts/engine-suspension.ts +108 -0
  96. package/dist/bundling-sources/shared_libs/play-runtime/play-runs/attempts/index.ts +36 -0
  97. package/dist/bundling-sources/shared_libs/play-runtime/play-runs/attempts/job.ts +97 -0
  98. package/dist/bundling-sources/shared_libs/play-runtime/play-runs/attempts/ports.ts +104 -0
  99. package/dist/bundling-sources/shared_libs/play-runtime/play-runs/attempts/postgres-fence-adapter.ts +263 -0
  100. package/dist/bundling-sources/shared_libs/play-runtime/play-runs/attempts/worker-terminal-projection.ts +64 -0
  101. package/dist/bundling-sources/shared_libs/play-runtime/play-runs/projection/contracts.ts +29 -0
  102. package/dist/bundling-sources/shared_libs/play-runtime/play-runs/projection/gateway-adapter.ts +56 -0
  103. package/dist/bundling-sources/shared_libs/play-runtime/play-runs/projection/index.ts +15 -0
  104. package/dist/bundling-sources/shared_libs/play-runtime/play-runs/projection/job.ts +65 -0
  105. package/dist/bundling-sources/shared_libs/play-runtime/play-runs/projection/ports.ts +17 -0
  106. package/dist/bundling-sources/shared_libs/play-runtime/play-runs/sandbox-cleanup/contracts.ts +42 -0
  107. package/dist/bundling-sources/shared_libs/play-runtime/play-runs/sandbox-cleanup/index.ts +17 -0
  108. package/dist/bundling-sources/shared_libs/play-runtime/play-runs/sandbox-cleanup/job.ts +142 -0
  109. package/dist/bundling-sources/shared_libs/play-runtime/play-runs/sandbox-cleanup/ports.ts +42 -0
  110. package/dist/bundling-sources/shared_libs/play-runtime/play-runs/sandbox-cleanup/postgres-adapter.ts +102 -0
  111. package/dist/bundling-sources/shared_libs/play-runtime/play-runs/terminal/contracts.ts +60 -0
  112. package/dist/bundling-sources/shared_libs/play-runtime/play-runs/terminal/index.ts +16 -0
  113. package/dist/bundling-sources/shared_libs/play-runtime/play-runs/terminal/job.ts +78 -0
  114. package/dist/bundling-sources/shared_libs/play-runtime/play-runs/terminal/ports.ts +54 -0
  115. package/dist/bundling-sources/shared_libs/play-runtime/play-runs/terminal/postgres-adapter.ts +71 -0
  116. package/dist/bundling-sources/shared_libs/play-runtime/play-runtime-batching-registry.ts +4 -0
  117. package/dist/bundling-sources/shared_libs/play-runtime/protocol.ts +2 -0
  118. package/dist/bundling-sources/shared_libs/play-runtime/receipt-status.ts +5 -8
  119. package/dist/bundling-sources/shared_libs/play-runtime/run-failure.ts +3 -5
  120. package/dist/bundling-sources/shared_libs/play-runtime/run-identity.ts +168 -0
  121. package/dist/bundling-sources/shared_libs/play-runtime/run-ledger.ts +44 -5
  122. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/child-play-resolver.ts +26 -0
  123. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/index.ts +3662 -0
  124. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/progress-sidecar.ts +47 -0
  125. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-deadline.ts +84 -0
  126. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-gateway-transport.ts +91 -0
  127. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-heartbeat.ts +424 -0
  128. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-progress-push.ts +321 -0
  129. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-sheet-persistence-retry.ts +110 -0
  130. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-terminal-push.ts +625 -0
  131. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-lifecycle.ts +72 -9
  132. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-payload-transport.ts +6 -12
  133. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona.ts +19 -0
  134. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/bundle.ts +0 -1
  135. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/runtime-sandbox-reconciliation.ts +14 -44
  136. package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +103 -208
  137. package/dist/bundling-sources/shared_libs/play-runtime/runtime-authority.ts +201 -0
  138. package/dist/bundling-sources/shared_libs/play-runtime/runtime-env.ts +6 -0
  139. package/dist/bundling-sources/shared_libs/play-runtime/runtime-operation-contract.ts +67 -0
  140. package/dist/bundling-sources/shared_libs/play-runtime/runtime-release-environment.ts +2 -0
  141. package/dist/bundling-sources/shared_libs/play-runtime/runtime-sandbox-contract.ts +68 -0
  142. package/dist/bundling-sources/shared_libs/play-runtime/runtime-scheduler-topology.ts +14 -2
  143. package/dist/bundling-sources/shared_libs/play-runtime/runtime-telemetry.ts +108 -0
  144. package/dist/bundling-sources/shared_libs/play-runtime/sandbox-runs/contract.ts +4 -0
  145. package/dist/bundling-sources/shared_libs/play-runtime/sandbox-runs/runner-backend-adapter.ts +3 -0
  146. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backend.ts +7 -0
  147. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-deadline-reconciliation.ts +88 -0
  148. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-play-deploy-task.ts +124 -0
  149. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-play-run-task.ts +68 -0
  150. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-pool.ts +193 -0
  151. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-queue-lifecycle.ts +269 -0
  152. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-queue-suffix.ts +73 -0
  153. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +6642 -0
  154. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-shared.ts +897 -0
  155. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-worker-metrics.ts +120 -0
  156. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-worker-required-env.ts +76 -0
  157. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd.ts +476 -0
  158. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/gateway-heavy-request-admission.ts +47 -0
  159. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/gateway-progress-registry.ts +147 -0
  160. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/index.ts +27 -0
  161. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/lazy.ts +50 -0
  162. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/play-run-recovery.ts +98 -0
  163. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-budget-state.ts +260 -0
  164. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-pool.ts +1416 -0
  165. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-progress.ts +1255 -0
  166. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-rate-state.ts +942 -0
  167. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +14636 -0
  168. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/receipt-gateway.ts +888 -0
  169. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/run-ledger-outbox-recovery.ts +355 -0
  170. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/run-terminal-transition.ts +46 -0
  171. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runner-push.ts +60 -0
  172. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-api-origin.ts +33 -0
  173. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-receipt-gateway-health.ts +64 -0
  174. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-sandbox-capacity.ts +835 -0
  175. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-sandbox-ledger-reconciliation.ts +1218 -0
  176. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-sandbox-operation.ts +207 -0
  177. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-scheduler-schema.ts +10 -0
  178. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/scheduler-capacity.ts +123 -0
  179. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/scheduler-launch-read-observability.ts +78 -0
  180. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/submit-admission.ts +169 -0
  181. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/terminal-contract.ts +20 -0
  182. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/worker-queue-metrics.ts +34 -0
  183. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/worker-resource-metrics.ts +249 -0
  184. package/dist/bundling-sources/shared_libs/play-runtime/sheet-attempt-sql.ts +7 -0
  185. package/dist/bundling-sources/shared_libs/play-runtime/step-progress.ts +296 -0
  186. package/dist/bundling-sources/shared_libs/play-runtime/tool-call/native-batch.ts +3 -3
  187. package/dist/bundling-sources/shared_libs/play-runtime/tool-call/runtime-step-receipts-adapter.ts +20 -1
  188. package/dist/bundling-sources/shared_libs/play-runtime/tool-execute-retry-policy.ts +60 -15
  189. package/dist/bundling-sources/shared_libs/play-runtime/tool-execution-outcome.ts +20 -0
  190. package/dist/bundling-sources/shared_libs/play-runtime/transient-service-error.ts +12 -0
  191. package/dist/bundling-sources/shared_libs/play-runtime/vercel-protection.ts +14 -1
  192. package/dist/bundling-sources/shared_libs/play-runtime/webhook-receipt-retry.ts +50 -0
  193. package/dist/bundling-sources/shared_libs/play-runtime/work-receipt-storage-contract.ts +165 -0
  194. package/dist/bundling-sources/shared_libs/play-runtime/work-receipts.ts +15 -23
  195. package/dist/bundling-sources/shared_libs/play-runtime/workflow-executor-auth.ts +169 -0
  196. package/dist/bundling-sources/shared_libs/play-runtime/zerobounce-batching.ts +122 -0
  197. package/dist/bundling-sources/shared_libs/plays/artifact-types.ts +2 -0
  198. package/dist/bundling-sources/shared_libs/plays/bundling/repository-adapter.ts +24 -0
  199. package/dist/bundling-sources/shared_libs/plays/child-run-projection.ts +174 -0
  200. package/dist/bundling-sources/shared_libs/plays/contracts.ts +2 -0
  201. package/dist/bundling-sources/shared_libs/plays/deploy/api-client.ts +267 -0
  202. package/dist/bundling-sources/shared_libs/plays/deploy/control-plane-types.ts +73 -0
  203. package/dist/bundling-sources/shared_libs/plays/deploy/manifest.ts +162 -0
  204. package/dist/bundling-sources/shared_libs/plays/deploy/project-serializer.ts +87 -0
  205. package/dist/bundling-sources/shared_libs/plays/deploy/source-file-path.ts +26 -0
  206. package/dist/bundling-sources/shared_libs/plays/deploy/target-paths.ts +36 -0
  207. package/dist/bundling-sources/shared_libs/plays/deployment-status.ts +1 -1
  208. package/dist/bundling-sources/shared_libs/plays/docflow.ts +1 -1
  209. package/dist/bundling-sources/shared_libs/plays/launch/input-contract.ts +400 -0
  210. package/dist/bundling-sources/shared_libs/plays/launch/prepare.ts +96 -0
  211. package/dist/bundling-sources/shared_libs/plays/local-file-discovery.ts +385 -0
  212. package/dist/bundling-sources/shared_libs/plays/play-grep-search.ts +112 -0
  213. package/dist/bundling-sources/shared_libs/plays/play-reference.ts +117 -0
  214. package/dist/bundling-sources/shared_libs/plays/run-input-summary.ts +260 -0
  215. package/dist/bundling-sources/shared_libs/plays/run-summary-types.ts +49 -0
  216. package/dist/bundling-sources/shared_libs/plays/secrets/errors.ts +19 -0
  217. package/dist/bundling-sources/shared_libs/plays/share/copy.ts +271 -0
  218. package/dist/bundling-sources/shared_libs/plays/share/metrics.ts +140 -0
  219. package/dist/bundling-sources/shared_libs/plays/share/public-read-model.ts +86 -0
  220. package/dist/bundling-sources/shared_libs/plays/share/seo-quality.ts +181 -0
  221. package/dist/bundling-sources/shared_libs/plays/share/static-pipeline-summary.ts +658 -0
  222. package/dist/bundling-sources/shared_libs/plays/share/types.ts +197 -0
  223. package/dist/bundling-sources/shared_libs/plays/sheet-filter.ts +347 -0
  224. package/dist/bundling-sources/shared_libs/plays/slack-hitl-timeout-error.ts +37 -0
  225. package/dist/bundling-sources/shared_libs/plays/standard-webhooks.ts +117 -0
  226. package/dist/bundling-sources/shared_libs/plays/static-pipeline.ts +6 -1
  227. package/dist/bundling-sources/shared_libs/plays/status-result.ts +388 -0
  228. package/dist/bundling-sources/shared_libs/plays/tool-result-types.ts +1 -1
  229. package/dist/bundling-sources/shared_libs/plays/transform-factor-structure.ts +377 -0
  230. package/dist/bundling-sources/shared_libs/plays/webhook-payload.ts +113 -0
  231. package/dist/bundling-sources/shared_libs/product-notifications/configuration.ts +7 -1
  232. package/dist/bundling-sources/shared_libs/product-notifications/default-policy.ts +3 -2
  233. package/dist/bundling-sources/shared_libs/product-notifications/overflow.ts +18 -0
  234. package/dist/bundling-sources/shared_libs/product-notifications/rolling-limit.ts +24 -0
  235. package/dist/bundling-sources/shared_libs/product-notifications/slack-delivery.ts +624 -0
  236. package/dist/bundling-sources/shared_libs/product-notifications/slack-payload.ts +140 -0
  237. package/dist/bundling-sources/shared_libs/product-notifications/slack-transport.ts +75 -0
  238. package/dist/bundling-sources/shared_libs/runtime-env.ts +6 -0
  239. package/dist/bundling-sources/shared_libs/security/email-blacklist.ts +42 -0
  240. package/dist/bundling-sources/shared_libs/security/header-safe-env.ts +10 -3
  241. package/dist/bundling-sources/shared_libs/security/slack-sanitize.ts +133 -0
  242. package/dist/cli/getting-started.d.mts +52 -0
  243. package/dist/cli/getting-started.d.ts +52 -0
  244. package/dist/cli/getting-started.js +65 -0
  245. package/dist/cli/getting-started.mjs +36 -0
  246. package/dist/cli/index.d.mts +9 -0
  247. package/dist/cli/index.d.ts +9 -0
  248. package/dist/cli/index.js +895 -407
  249. package/dist/cli/index.mjs +893 -414
  250. package/dist/{compiler-manifest-DsLbQaew.d.mts → compiler-manifest-x14KL83E.d.mts} +4 -2
  251. package/dist/{compiler-manifest-DsLbQaew.d.ts → compiler-manifest-x14KL83E.d.ts} +4 -2
  252. package/dist/index.d.mts +124 -154
  253. package/dist/index.d.ts +124 -154
  254. package/dist/index.js +132 -28
  255. package/dist/index.mjs +132 -28
  256. package/dist/install-integrity.json +182 -2
  257. package/dist/monitor-fleet-contract.d.mts +131 -0
  258. package/dist/monitor-fleet-contract.d.ts +131 -0
  259. package/dist/monitor-fleet-contract.js +406 -0
  260. package/dist/monitor-fleet-contract.mjs +367 -0
  261. package/dist/plays/bundle-play-file.d.mts +2 -2
  262. package/dist/plays/bundle-play-file.d.ts +2 -2
  263. package/dist/release.d.mts +255 -0
  264. package/dist/release.d.ts +255 -0
  265. package/dist/release.js +210 -0
  266. package/dist/release.mjs +183 -0
  267. package/package.json +21 -4
@@ -0,0 +1,267 @@
1
+ import type { PlayBundleArtifact } from '../artifact-types';
2
+ import type { PlayCompilerManifest } from '../compiler-manifest';
3
+ import type { PlayDeploymentStatus } from '../deployment-status';
4
+ import type {
5
+ SerializedPlayDeployment,
6
+ SerializedPlayProject,
7
+ } from './project-serializer';
8
+
9
+ /**
10
+ * The deploy worker's only channel to the control plane: the app HTTP API,
11
+ * authenticated with the per-deployment token minted at webhook intake. The
12
+ * worker holds no Convex, R2, or GitHub App credentials.
13
+ */
14
+
15
+ // Mirrors the SDK's byte-aware chunker: the Vercel request-body ceiling is
16
+ // the real constraint, not the server's 25-item batch cap.
17
+ const REGISTER_MAX_BATCH_COUNT = 3;
18
+ const REGISTER_MAX_BATCH_BYTES = 2_500_000;
19
+
20
+ export type DeployApiErrorCode =
21
+ | 'PLAY_DEPLOYMENT_SUPERSEDED'
22
+ | 'PLAY_DEPLOYMENT_TERMINAL'
23
+ | 'PLAY_PROJECT_DISABLED'
24
+ | string;
25
+
26
+ export class DeployApiError extends Error {
27
+ readonly status: number;
28
+ readonly code: DeployApiErrorCode | null;
29
+ readonly body: unknown;
30
+ constructor(input: {
31
+ message: string;
32
+ status: number;
33
+ code?: string | null;
34
+ body?: unknown;
35
+ }) {
36
+ super(input.message);
37
+ this.name = 'DeployApiError';
38
+ this.status = input.status;
39
+ this.code = input.code ?? null;
40
+ this.body = input.body;
41
+ }
42
+ }
43
+
44
+ export type RegisterArtifactEntry = {
45
+ name: string;
46
+ sourceCode: string;
47
+ sourceFiles?: Record<string, string>;
48
+ description?: string;
49
+ artifact: PlayBundleArtifact;
50
+ compilerManifest: PlayCompilerManifest;
51
+ /**
52
+ * Repo-relative path this play was built from. Per-entry, not per-request:
53
+ * one deployment registers up to 25 plays from 25 different files.
54
+ */
55
+ sourceFilePath?: string;
56
+ };
57
+
58
+ export type RegisteredArtifact = {
59
+ name?: string;
60
+ definitionId?: string;
61
+ revisionId?: string;
62
+ version?: number;
63
+ [key: string]: unknown;
64
+ };
65
+
66
+ export type DeploymentPlayState = {
67
+ name: string;
68
+ exists: boolean;
69
+ playProjectId: string | null;
70
+ /** repoFullName of the project that currently owns this play, if any. */
71
+ playProjectRepo: string | null;
72
+ /** Whether that owner is disabled; null when nothing owns the play. */
73
+ playProjectDisabled: boolean | null;
74
+ driftFromGit?: boolean;
75
+ workingRevision: {
76
+ revisionId: string;
77
+ sourceHash: string | null;
78
+ artifactHash: string | null;
79
+ graphHash: string | null;
80
+ artifactKind: string | null;
81
+ version: number | null;
82
+ } | null;
83
+ liveRevision: DeploymentPlayState['workingRevision'];
84
+ };
85
+
86
+ export class DeployApiClient {
87
+ constructor(
88
+ private readonly config: {
89
+ appBaseUrl: string;
90
+ deployToken: string;
91
+ deploymentId: string;
92
+ fetchImpl?: typeof fetch;
93
+ },
94
+ ) {}
95
+
96
+ private async request<T>(input: {
97
+ method: 'GET' | 'POST';
98
+ path: string;
99
+ body?: unknown;
100
+ }): Promise<T> {
101
+ const doFetch = this.config.fetchImpl ?? fetch;
102
+ const response = await doFetch(
103
+ `${this.config.appBaseUrl.replace(/\/$/, '')}${input.path}`,
104
+ {
105
+ method: input.method,
106
+ headers: {
107
+ Authorization: `Bearer ${this.config.deployToken}`,
108
+ ...(input.body !== undefined
109
+ ? { 'Content-Type': 'application/json' }
110
+ : {}),
111
+ },
112
+ body: input.body !== undefined ? JSON.stringify(input.body) : undefined,
113
+ },
114
+ );
115
+ const text = await response.text();
116
+ let parsed: unknown = null;
117
+ try {
118
+ parsed = text ? JSON.parse(text) : null;
119
+ } catch {
120
+ parsed = text;
121
+ }
122
+ if (!response.ok) {
123
+ const record = (parsed ?? {}) as { error?: unknown; code?: unknown };
124
+ throw new DeployApiError({
125
+ message:
126
+ typeof record.error === 'string'
127
+ ? record.error
128
+ : `Deploy API ${input.path} failed (${response.status}).`,
129
+ status: response.status,
130
+ code: typeof record.code === 'string' ? record.code : null,
131
+ body: parsed,
132
+ });
133
+ }
134
+ return parsed as T;
135
+ }
136
+
137
+ /** Every deployment-scoped route hangs off this one path. */
138
+ private deploymentPath(suffix = ''): string {
139
+ return `/api/v2/deployments/${this.config.deploymentId}${suffix}`;
140
+ }
141
+
142
+ getDeployment(): Promise<{
143
+ deployment: SerializedPlayDeployment;
144
+ project: SerializedPlayProject;
145
+ /** Server-computed; qualified when several targets build one repo. */
146
+ checkRunName: string;
147
+ /** The deploy target's workspace slug, for the manifest `org` guard. */
148
+ workspaceSlug: string | null;
149
+ }> {
150
+ return this.request({
151
+ method: 'GET',
152
+ path: this.deploymentPath(),
153
+ });
154
+ }
155
+
156
+ setStatus(input: {
157
+ status: Exclude<PlayDeploymentStatus, 'queued'>;
158
+ error?: string;
159
+ results?: unknown;
160
+ buildSeconds?: number;
161
+ checkRunId?: number;
162
+ /** Production push only: the PR whose merge produced the commit. */
163
+ mergedPullRequestNumber?: number;
164
+ /** Head-guard supersedes only: lets the server re-enqueue an uncovered head. */
165
+ observedHeadSha?: string;
166
+ }): Promise<{ ok: boolean }> {
167
+ return this.request({
168
+ method: 'POST',
169
+ path: this.deploymentPath('/status'),
170
+ body: input,
171
+ });
172
+ }
173
+
174
+ mintGitHubToken(): Promise<{
175
+ token: string;
176
+ expiresAt: string;
177
+ repoId: number;
178
+ repoFullName: string;
179
+ }> {
180
+ return this.request({
181
+ method: 'POST',
182
+ path: this.deploymentPath('/github-token'),
183
+ body: {},
184
+ });
185
+ }
186
+
187
+ playsState(names: string[]): Promise<{ plays: DeploymentPlayState[] }> {
188
+ return this.request({
189
+ method: 'POST',
190
+ path: this.deploymentPath('/plays-state'),
191
+ body: { names },
192
+ });
193
+ }
194
+
195
+ compileManifest(input: {
196
+ name: string;
197
+ sourceCode: string;
198
+ sourceFiles?: Record<string, string>;
199
+ artifact: PlayBundleArtifact;
200
+ importedPlayDependencies?: PlayCompilerManifest[];
201
+ }): Promise<{ compilerManifest: PlayCompilerManifest; warnings?: string[] }> {
202
+ return this.request({
203
+ method: 'POST',
204
+ path: '/api/v2/plays/compile-manifest',
205
+ body: input,
206
+ });
207
+ }
208
+
209
+ async registerArtifacts(
210
+ entries: RegisterArtifactEntry[],
211
+ ): Promise<RegisteredArtifact[]> {
212
+ const results: RegisteredArtifact[] = [];
213
+ let batch: RegisterArtifactEntry[] = [];
214
+ let batchBytes = 0;
215
+ const flush = async () => {
216
+ if (batch.length === 0) return;
217
+ const payload = await this.request<{ artifacts: RegisteredArtifact[] }>({
218
+ method: 'POST',
219
+ path: '/api/v2/plays/artifacts',
220
+ body: {
221
+ artifacts: batch.map((entry) => ({ ...entry, publish: false })),
222
+ },
223
+ });
224
+ results.push(...payload.artifacts);
225
+ batch = [];
226
+ batchBytes = 0;
227
+ };
228
+ for (const entry of entries) {
229
+ // Serialized UTF-8 bytes of the wire entry: sourceFiles, manifests,
230
+ // JSON escaping, and multibyte characters all count against the Vercel
231
+ // body limit, not just the two code strings.
232
+ const entryBytes = Buffer.byteLength(
233
+ JSON.stringify({ ...entry, publish: false }),
234
+ 'utf8',
235
+ );
236
+ if (
237
+ batch.length >= REGISTER_MAX_BATCH_COUNT ||
238
+ (batch.length > 0 && batchBytes + entryBytes > REGISTER_MAX_BATCH_BYTES)
239
+ ) {
240
+ await flush();
241
+ }
242
+ batch.push(entry);
243
+ batchBytes += entryBytes;
244
+ }
245
+ await flush();
246
+ return results;
247
+ }
248
+
249
+ promote(plays: Array<{ name: string; revisionId: string }>): Promise<{
250
+ success: boolean;
251
+ outcomes: Array<{
252
+ name: string;
253
+ revisionId: string;
254
+ status: 'promoted' | 'failed';
255
+ version?: number;
256
+ error?: string;
257
+ }>;
258
+ phase?: string;
259
+ error?: string;
260
+ }> {
261
+ return this.request({
262
+ method: 'POST',
263
+ path: this.deploymentPath('/promote'),
264
+ body: { plays },
265
+ });
266
+ }
267
+ }
@@ -0,0 +1,73 @@
1
+ import type { GenericId } from 'convex/values';
2
+ import type { PlayDeploymentStatus } from '../deployment-status';
3
+
4
+ export type { PlayDeploymentStatus } from '../deployment-status';
5
+
6
+ /**
7
+ * Explicit row types for the GitHub deploy control plane, mirroring
8
+ * convex/schema.ts. App code deliberately does NOT use `Doc<'...'>` here:
9
+ * the schema-derived document types degrade to `unknown` fields under the
10
+ * full-project tsc pass (the schema type is past TypeScript's inference
11
+ * budget), which is why the rest of `src/` avoids `Doc<>` too. Keep these in
12
+ * sync with the schema tables by hand; the convex typecheck still validates
13
+ * the source of truth.
14
+ */
15
+
16
+ export type GithubInstallationDoc = {
17
+ _id: GenericId<'githubInstallations'>;
18
+ _creationTime: number;
19
+ gitHost: string;
20
+ installationId: string;
21
+ orgId: string;
22
+ accountLogin: string;
23
+ accountType: 'User' | 'Organization';
24
+ targetId: number;
25
+ repositorySelection: 'all' | 'selected';
26
+ installedByUserId: string;
27
+ verifiedAt: number;
28
+ suspendedAt?: number;
29
+ deletedAt?: number;
30
+ createdAt: number;
31
+ updatedAt: number;
32
+ };
33
+
34
+ export type PlayProjectDoc = {
35
+ _id: GenericId<'playProjects'>;
36
+ _creationTime: number;
37
+ orgId: string;
38
+ gitHost: string;
39
+ installationId: string;
40
+ repoId: number;
41
+ repoFullName: string;
42
+ rootDirectory: string;
43
+ manifestPath?: string;
44
+ productionBranch: string;
45
+ checkOnPullRequest: boolean;
46
+ disabledAt?: number;
47
+ createdByUserId: string;
48
+ createdAt: number;
49
+ updatedAt: number;
50
+ };
51
+
52
+ export type PlayDeploymentDoc = {
53
+ _id: GenericId<'playDeployments'>;
54
+ _creationTime: number;
55
+ orgId: string;
56
+ playProjectId: GenericId<'playProjects'>;
57
+ commitSha: string;
58
+ ref: string;
59
+ isProduction: boolean;
60
+ trigger: 'push' | 'pull_request' | 'manual' | 'redeliver';
61
+ deliveryId?: string;
62
+ status: PlayDeploymentStatus;
63
+ checkRunId?: number;
64
+ pullRequestNumber?: number;
65
+ mergedPullRequestNumber?: number;
66
+ committerLogin?: string;
67
+ results?: unknown;
68
+ buildSeconds?: number;
69
+ startedAt?: number;
70
+ finishedAt?: number;
71
+ error?: string;
72
+ createdAt: number;
73
+ };
@@ -0,0 +1,162 @@
1
+ import { readdir, readFile, stat } from 'node:fs/promises';
2
+ import { join, relative } from 'node:path';
3
+ import picomatch from 'picomatch';
4
+
5
+ /**
6
+ * deepline.json — the repo-owned half of deploy configuration. The repo
7
+ * describes what plays exist and where; Convex (playProjects) decides what
8
+ * happens when they change (production branch, PR checks, enable/disable).
9
+ * No field lives in both places.
10
+ */
11
+ export type DeeplineRepoManifest = {
12
+ /** Globs relative to the project root directory. */
13
+ plays: string[];
14
+ /** Optional tenant guard: the workspace slug this repo expects. */
15
+ org?: string;
16
+ };
17
+
18
+ export const DEFAULT_PLAY_GLOBS = ['**/*.play.ts'];
19
+ const MAX_DISCOVERED_PLAY_FILES = 200;
20
+ const IGNORED_DIRECTORIES = new Set([
21
+ 'node_modules',
22
+ '.git',
23
+ 'dist',
24
+ 'build',
25
+ '.next',
26
+ ]);
27
+
28
+ export class DeeplineManifestError extends Error {
29
+ constructor(message: string) {
30
+ super(message);
31
+ this.name = 'DeeplineManifestError';
32
+ }
33
+ }
34
+
35
+ export function parseDeeplineManifest(
36
+ raw: string | null,
37
+ ): DeeplineRepoManifest {
38
+ if (raw === null) {
39
+ return { plays: DEFAULT_PLAY_GLOBS };
40
+ }
41
+ let parsed: unknown;
42
+ try {
43
+ parsed = JSON.parse(raw);
44
+ } catch (error) {
45
+ throw new DeeplineManifestError(
46
+ `deepline.json is not valid JSON: ${error instanceof Error ? error.message : String(error)}`,
47
+ );
48
+ }
49
+ if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) {
50
+ throw new DeeplineManifestError('deepline.json must be a JSON object.');
51
+ }
52
+ const record = parsed as { plays?: unknown; org?: unknown };
53
+ let plays = DEFAULT_PLAY_GLOBS;
54
+ if (record.plays !== undefined) {
55
+ if (
56
+ !Array.isArray(record.plays) ||
57
+ record.plays.length === 0 ||
58
+ !record.plays.every(
59
+ (glob) => typeof glob === 'string' && glob.trim().length > 0,
60
+ )
61
+ ) {
62
+ throw new DeeplineManifestError(
63
+ 'deepline.json "plays" must be a non-empty array of glob strings, e.g. ["plays/**/*.play.ts"].',
64
+ );
65
+ }
66
+ plays = record.plays.map((glob) => glob.trim().replace(/^\.\//, ''));
67
+ }
68
+ if (plays.some((glob) => glob.startsWith('/') || glob.includes('..'))) {
69
+ throw new DeeplineManifestError(
70
+ 'deepline.json "plays" globs must be relative and must not contain "..".',
71
+ );
72
+ }
73
+ const org =
74
+ typeof record.org === 'string' && record.org.trim()
75
+ ? record.org.trim()
76
+ : undefined;
77
+ return { plays, ...(org ? { org } : {}) };
78
+ }
79
+
80
+ export const DEFAULT_MANIFEST_FILE = 'deepline.json';
81
+
82
+ export async function readDeeplineManifest(
83
+ projectRoot: string,
84
+ manifestFile: string = DEFAULT_MANIFEST_FILE,
85
+ ): Promise<DeeplineRepoManifest> {
86
+ let raw: string | null = null;
87
+ try {
88
+ raw = await readFile(join(projectRoot, manifestFile), 'utf8');
89
+ } catch (error) {
90
+ const code = (error as NodeJS.ErrnoException).code;
91
+ // Only "file does not exist" may fall through; a permissions or I/O
92
+ // failure must never silently select default globs.
93
+ if (code !== 'ENOENT' && code !== 'ENOTDIR') {
94
+ throw error;
95
+ }
96
+ // An absent DEFAULT manifest means "use defaults". An absent EXPLICITLY
97
+ // configured manifest means the project points at a file the repo does
98
+ // not have — deploying **/*.play.ts instead would publish plays the
99
+ // manifest was supposed to scope out.
100
+ if (manifestFile !== DEFAULT_MANIFEST_FILE) {
101
+ throw new DeeplineManifestError(
102
+ `DEEPLINE_MANIFEST_MISSING: this project is configured to read ${manifestFile}, but the file does not exist at the project root.`,
103
+ );
104
+ }
105
+ raw = null;
106
+ }
107
+ try {
108
+ return parseDeeplineManifest(raw);
109
+ } catch (error) {
110
+ if (error instanceof DeeplineManifestError) {
111
+ throw new DeeplineManifestError(
112
+ error.message.replace(/^deepline\.json/, manifestFile),
113
+ );
114
+ }
115
+ throw error;
116
+ }
117
+ }
118
+
119
+ /**
120
+ * Explicit globs beat inference; a glob that accidentally matches
121
+ * node_modules or fixtures publishes garbage, so vendored/build directories
122
+ * are always skipped and discovery is capped loudly.
123
+ */
124
+ export async function discoverPlayFiles(input: {
125
+ projectRoot: string;
126
+ globs: string[];
127
+ }): Promise<string[]> {
128
+ const matchers = input.globs.map((glob) => picomatch(glob));
129
+ const found: string[] = [];
130
+
131
+ async function walk(dir: string): Promise<void> {
132
+ const entries = await readdir(dir, { withFileTypes: true });
133
+ for (const entry of entries) {
134
+ if (entry.name.startsWith('.') && entry.name !== '.') continue;
135
+ const absolute = join(dir, entry.name);
136
+ if (entry.isDirectory()) {
137
+ if (IGNORED_DIRECTORIES.has(entry.name)) continue;
138
+ await walk(absolute);
139
+ continue;
140
+ }
141
+ if (!entry.isFile()) continue;
142
+ const relativePath = relative(input.projectRoot, absolute);
143
+ if (matchers.some((match) => match(relativePath))) {
144
+ found.push(relativePath);
145
+ if (found.length > MAX_DISCOVERED_PLAY_FILES) {
146
+ throw new DeeplineManifestError(
147
+ `deepline.json globs matched more than ${MAX_DISCOVERED_PLAY_FILES} play files. Tighten the globs.`,
148
+ );
149
+ }
150
+ }
151
+ }
152
+ }
153
+
154
+ const rootStat = await stat(input.projectRoot).catch(() => null);
155
+ if (!rootStat?.isDirectory()) {
156
+ throw new DeeplineManifestError(
157
+ `Project root directory does not exist in the repo: ${input.projectRoot}`,
158
+ );
159
+ }
160
+ await walk(input.projectRoot);
161
+ return found.sort();
162
+ }
@@ -0,0 +1,87 @@
1
+ import { DEFAULT_MANIFEST_FILE } from './manifest';
2
+ import type { PlayDeploymentDoc, PlayProjectDoc } from './control-plane-types';
3
+
4
+ export { DEFAULT_MANIFEST_FILE } from './manifest';
5
+
6
+ export type SerializedPlayProject = {
7
+ id: string;
8
+ orgId: string;
9
+ gitHost: string;
10
+ installationId: string;
11
+ repoId: number;
12
+ repoFullName: string;
13
+ rootDirectory: string;
14
+ manifestPath: string;
15
+ productionBranch: string;
16
+ checkOnPullRequest: boolean;
17
+ disabled: boolean;
18
+ createdByUserId: string;
19
+ createdAt: number;
20
+ updatedAt: number;
21
+ };
22
+
23
+ export function serializePlayProject(
24
+ project: PlayProjectDoc,
25
+ ): SerializedPlayProject {
26
+ return {
27
+ id: String(project._id),
28
+ orgId: project.orgId,
29
+ gitHost: project.gitHost,
30
+ installationId: project.installationId,
31
+ repoId: project.repoId,
32
+ repoFullName: project.repoFullName,
33
+ rootDirectory: project.rootDirectory,
34
+ manifestPath: project.manifestPath?.trim() || DEFAULT_MANIFEST_FILE,
35
+ productionBranch: project.productionBranch,
36
+ checkOnPullRequest: project.checkOnPullRequest,
37
+ disabled: Boolean(project.disabledAt),
38
+ createdByUserId: project.createdByUserId,
39
+ createdAt: project.createdAt,
40
+ updatedAt: project.updatedAt,
41
+ };
42
+ }
43
+
44
+ export type SerializedPlayDeployment = {
45
+ id: string;
46
+ orgId: string;
47
+ playProjectId: string;
48
+ commitSha: string;
49
+ ref: string;
50
+ isProduction: boolean;
51
+ trigger: string;
52
+ status: string;
53
+ pullRequestNumber: number | null;
54
+ /** Production push only: the PR whose merge produced this commit. */
55
+ mergedPullRequestNumber: number | null;
56
+ committerLogin: string | null;
57
+ results: unknown;
58
+ buildSeconds: number | null;
59
+ error: string | null;
60
+ createdAt: number;
61
+ startedAt: number | null;
62
+ finishedAt: number | null;
63
+ };
64
+
65
+ export function serializePlayDeployment(
66
+ deployment: PlayDeploymentDoc,
67
+ ): SerializedPlayDeployment {
68
+ return {
69
+ id: String(deployment._id),
70
+ orgId: deployment.orgId,
71
+ playProjectId: String(deployment.playProjectId),
72
+ commitSha: deployment.commitSha,
73
+ ref: deployment.ref,
74
+ isProduction: deployment.isProduction,
75
+ trigger: deployment.trigger,
76
+ status: deployment.status,
77
+ pullRequestNumber: deployment.pullRequestNumber ?? null,
78
+ mergedPullRequestNumber: deployment.mergedPullRequestNumber ?? null,
79
+ committerLogin: deployment.committerLogin ?? null,
80
+ results: deployment.results ?? null,
81
+ buildSeconds: deployment.buildSeconds ?? null,
82
+ error: deployment.error ?? null,
83
+ createdAt: deployment.createdAt,
84
+ startedAt: deployment.startedAt ?? null,
85
+ finishedAt: deployment.finishedAt ?? null,
86
+ };
87
+ }
@@ -0,0 +1,26 @@
1
+ /**
2
+ * A revision's source path is repo-relative and is rendered as a location in
3
+ * the dashboard's play tree, so it is admitted once, here, rather than trusted
4
+ * from the request body.
5
+ */
6
+
7
+ const MAX_LENGTH = 1024;
8
+
9
+ /**
10
+ * Returns the path when it could have come from a repository walk, and null
11
+ * otherwise. Null is not an error: the field is optional everywhere downstream,
12
+ * and a play that did not come from a git deploy legitimately has no path.
13
+ */
14
+ export function normalizeSourceFilePath(value: unknown): string | null {
15
+ if (typeof value !== 'string') return null;
16
+ const trimmed = value.trim();
17
+ if (!trimmed || trimmed.length > MAX_LENGTH) return null;
18
+ // Absolute paths and Windows separators never come from the repo walk, and
19
+ // `..` would let a path escape the project it claims to belong to.
20
+ if (trimmed.startsWith('/') || trimmed.includes('\\')) return null;
21
+ const segments = trimmed.split('/');
22
+ if (segments.some((segment) => segment === '..' || segment === '')) {
23
+ return null;
24
+ }
25
+ return trimmed;
26
+ }
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Deployment-target path validation shared by play-project create and
3
+ * update. The canonical forms feed the exact-duplicate target check in
4
+ * convex/playProjects.ts, so create and update MUST canonicalize
5
+ * identically — path aliases ('' vs '.', 'pkg//a' vs 'pkg/a') would
6
+ * otherwise slip past it.
7
+ */
8
+
9
+ export function canonicalizeRootDirectory(
10
+ value: string,
11
+ ): { ok: true; rootDirectory: string } | { ok: false; error: string } {
12
+ if (value.split('/').some((part) => part === '..')) {
13
+ return { ok: false, error: 'rootDirectory must not contain "..".' };
14
+ }
15
+ return {
16
+ ok: true,
17
+ rootDirectory: value
18
+ .split('/')
19
+ .filter((part) => part && part !== '.')
20
+ .join('/'),
21
+ };
22
+ }
23
+
24
+ export function validateManifestPath(
25
+ value: string,
26
+ ): { ok: true; manifestPath: string } | { ok: false; error: string } {
27
+ const manifestPath = value.trim();
28
+ if (manifestPath.includes('/') || manifestPath.includes('..')) {
29
+ return {
30
+ ok: false,
31
+ error:
32
+ 'manifestPath must be a bare file name under the base path (e.g. deepline.staging.json).',
33
+ };
34
+ }
35
+ return { ok: true, manifestPath };
36
+ }
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * The play deployment status machine, shared by the Convex control plane
3
- * (convex/playDeployments.ts), worker auth (src/lib/auth/play-deploy-auth.ts),
3
+ * (convex/playDeployments.ts), worker auth (apps/deepline-api/src/lib/auth/play-deploy-auth.ts),
4
4
  * and the deploy-worker API surface. One spelling of the union, the terminal
5
5
  * set, and the allowed transitions.
6
6
  */
@@ -78,7 +78,7 @@ export type PlayDocflowEdge = {
78
78
  *
79
79
  * ABSENT — never `null` — when unrecorded, and that is load-bearing rather
80
80
  * than stylistic. `docflow` is whole-object serialized into
81
- * `playStaticPipelineContractHash` (`src/lib/plays/artifact-storage.ts`),
81
+ * `playStaticPipelineContractHash` (`apps/deepline-api/src/lib/plays/artifact-storage.ts`),
82
82
  * which is part of the immutable artifact storage key, and the canonicalizer
83
83
  * there drops `undefined` but HASHES `null`. Emitting `arm: null` on an
84
84
  * unannotated edge would change the contract hash of every diagrammed play