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,686 @@
1
+ import { getUsdPerCustomerCredit } from '@deepline/billing/credit-pricing';
2
+ import {
3
+ MONITOR_BASE_LIFECYCLE_CREDITS,
4
+ MONITOR_BILLING_VERIFIED_AT,
5
+ MONITOR_PLAN_ENTITLEMENT_ALLOCATION_DIVISOR,
6
+ MONITOR_UPSTREAM_COST_MARKUP_MULTIPLIER,
7
+ monitorProviderUsdToRetailCredits,
8
+ planEntitlementCreateCredits,
9
+ } from '@deepline/monitors/billing/pricing';
10
+ import type {
11
+ MonitorBillingPolicy,
12
+ MonitorBillingSource,
13
+ MonitorEconomicResponsibility,
14
+ MonitorPayloadPricingEntry,
15
+ MonitorPayloadPricingMap,
16
+ MonitorProviderChargeComponent,
17
+ MonitorRetailCharge,
18
+ MonitorRetailChargeComponent,
19
+ } from '@deepline/monitors/billing/types';
20
+ import { providerMonitorCapabilityId } from '@deepline/monitors/provider-monitor-capability';
21
+ import { tamradarPayloadPricingForCapability } from '@deepline/monitors/billing/tamradar';
22
+
23
+ export type MonitorBillingSourceInput = Omit<
24
+ MonitorBillingSource,
25
+ 'verifiedAt'
26
+ >;
27
+
28
+ type FixedRetailChargeSource = Extract<
29
+ MonitorRetailChargeComponent,
30
+ { kind: 'fixed_deepline_credits' }
31
+ >['source'];
32
+ type NoCustomerChargeReason = Extract<
33
+ MonitorRetailChargeComponent,
34
+ { kind: 'no_customer_charge' }
35
+ >['reason'];
36
+ type UpstreamMarkupSource = Extract<
37
+ MonitorRetailChargeComponent,
38
+ { kind: 'upstream_cost_markup' }
39
+ >['source'];
40
+
41
+ function source(input: MonitorBillingSourceInput): MonitorBillingSource {
42
+ return {
43
+ ...input,
44
+ verifiedAt: MONITOR_BILLING_VERIFIED_AT,
45
+ };
46
+ }
47
+
48
+ function fixedCredits(
49
+ credits: number,
50
+ customerLabel: string,
51
+ sourceKind: FixedRetailChargeSource,
52
+ basis?: Extract<
53
+ MonitorRetailChargeComponent,
54
+ { kind: 'fixed_deepline_credits' }
55
+ >['basis'],
56
+ ): MonitorRetailChargeComponent {
57
+ return {
58
+ kind: 'fixed_deepline_credits',
59
+ credits,
60
+ source: sourceKind,
61
+ customerLabel,
62
+ ...(basis ? { basis } : {}),
63
+ };
64
+ }
65
+
66
+ function noCustomerCharge(
67
+ reason: NoCustomerChargeReason,
68
+ customerLabel: string,
69
+ ): MonitorRetailChargeComponent {
70
+ return {
71
+ kind: 'no_customer_charge',
72
+ reason,
73
+ customerLabel,
74
+ };
75
+ }
76
+
77
+ function upstreamMarkupCharge(input: {
78
+ customerLabel: string;
79
+ providerCostKey: string;
80
+ retailCredits?: number;
81
+ source: UpstreamMarkupSource;
82
+ multiplier?: number;
83
+ }): MonitorRetailChargeComponent {
84
+ return {
85
+ kind: 'upstream_cost_markup',
86
+ multiplier: input.multiplier ?? MONITOR_UPSTREAM_COST_MARKUP_MULTIPLIER,
87
+ source: input.source,
88
+ customerLabel: input.customerLabel,
89
+ providerCostKey: input.providerCostKey,
90
+ ...(typeof input.retailCredits === 'number'
91
+ ? { retailCredits: input.retailCredits }
92
+ : {}),
93
+ };
94
+ }
95
+
96
+ function retailCharge(
97
+ input: Omit<MonitorRetailCharge, 'components'> & {
98
+ components: MonitorRetailChargeComponent[];
99
+ },
100
+ ): MonitorRetailCharge {
101
+ return input;
102
+ }
103
+
104
+ export function definePlanEntitlementMonitorBillingPolicy(input: {
105
+ provider: string;
106
+ capability: string;
107
+ planName: string;
108
+ minimumMonthlyPlanUsd: number;
109
+ sources: MonitorBillingSourceInput[];
110
+ eventDeliverySourceLabel: string;
111
+ economicResponsibility?: MonitorEconomicResponsibility;
112
+ }): MonitorBillingPolicy {
113
+ const providerCapability = providerMonitorCapabilityId(input);
114
+ const createCredits = planEntitlementCreateCredits(
115
+ input.minimumMonthlyPlanUsd,
116
+ );
117
+ const basis = {
118
+ minimumMonthlyPlanUsd: input.minimumMonthlyPlanUsd,
119
+ allocationDivisor: MONITOR_PLAN_ENTITLEMENT_ALLOCATION_DIVISOR,
120
+ usdPerDeeplineCredit: getUsdPerCustomerCredit(),
121
+ };
122
+ const owner =
123
+ input.economicResponsibility ?? 'runtime_upstream_account_owner';
124
+ return {
125
+ provider: input.provider,
126
+ capability: input.capability,
127
+ providerCapability,
128
+ pricingMode: 'plan_entitlement',
129
+ evidenceStatus: 'verified',
130
+ economicResponsibility: owner,
131
+ sourceDocs: input.sources.map(source),
132
+ upstreamMarkupMultiplier: MONITOR_UPSTREAM_COST_MARKUP_MULTIPLIER,
133
+ customerCreateCharge: retailCharge({
134
+ phase: 'create',
135
+ label: 'Monitor create',
136
+ components: [
137
+ fixedCredits(
138
+ createCredits,
139
+ 'Monitor create',
140
+ 'plan_entitlement_formula',
141
+ basis,
142
+ ),
143
+ ],
144
+ }),
145
+ customerReactivateCharge: retailCharge({
146
+ phase: 'reactivate',
147
+ label: 'Monitor reactivate',
148
+ components: [
149
+ fixedCredits(
150
+ createCredits,
151
+ 'Monitor reactivate',
152
+ 'plan_entitlement_formula',
153
+ basis,
154
+ ),
155
+ ],
156
+ }),
157
+ customerUsageCharges: [
158
+ retailCharge({
159
+ phase: 'periodic_renewal',
160
+ label: 'Monitor renewal',
161
+ components: [
162
+ fixedCredits(
163
+ createCredits,
164
+ 'Monitor renewal',
165
+ 'plan_entitlement_formula',
166
+ basis,
167
+ ),
168
+ ],
169
+ }),
170
+ retailCharge({
171
+ phase: 'webhook_event',
172
+ label: 'Webhook event delivery',
173
+ components: [
174
+ noCustomerCharge(
175
+ 'included_in_plan_entitlement',
176
+ 'Usage included in monitor entitlement',
177
+ ),
178
+ ],
179
+ }),
180
+ ],
181
+ providerChargeComponents: [
182
+ {
183
+ kind: 'provider_entitlement_cost',
184
+ phase: 'create',
185
+ owner,
186
+ planName: input.planName,
187
+ minimumMonthlyPlanUsd: input.minimumMonthlyPlanUsd,
188
+ allocation:
189
+ owner === 'customer_owned_upstream'
190
+ ? 'customer_paid_directly'
191
+ : 'plan_entitlement_retail_formula',
192
+ usageIncluded: true,
193
+ },
194
+ {
195
+ kind: 'provider_entitlement_cost',
196
+ phase: 'periodic_renewal',
197
+ owner,
198
+ planName: input.planName,
199
+ minimumMonthlyPlanUsd: input.minimumMonthlyPlanUsd,
200
+ allocation:
201
+ owner === 'customer_owned_upstream'
202
+ ? 'customer_paid_directly'
203
+ : 'plan_entitlement_retail_formula',
204
+ usageIncluded: true,
205
+ },
206
+ {
207
+ kind: 'provider_entitlement_cost',
208
+ phase: 'webhook_event',
209
+ owner,
210
+ planName: input.planName,
211
+ minimumMonthlyPlanUsd: input.minimumMonthlyPlanUsd,
212
+ allocation:
213
+ owner === 'customer_owned_upstream'
214
+ ? 'customer_paid_directly'
215
+ : 'plan_entitlement_retail_formula',
216
+ usageIncluded: true,
217
+ },
218
+ {
219
+ kind: 'provider_documented_no_charge',
220
+ phase: 'webhook_event',
221
+ scope: 'Webhook event delivery inside the eligible plan entitlement',
222
+ sourceLabel: input.eventDeliverySourceLabel,
223
+ },
224
+ ],
225
+ disableOnBillingFailure: true,
226
+ };
227
+ }
228
+
229
+ export function defineWrapperEntitlementMonitorBillingPolicy(input: {
230
+ provider: string;
231
+ capability: string;
232
+ planName: string;
233
+ minimumMonthlyPlanUsd: number;
234
+ sources: MonitorBillingSourceInput[];
235
+ eventDeliverySourceLabel: string;
236
+ economicResponsibility?: MonitorEconomicResponsibility;
237
+ }): MonitorBillingPolicy {
238
+ const policy = definePlanEntitlementMonitorBillingPolicy(input);
239
+ const noCharge = (phase: MonitorRetailCharge['phase']) =>
240
+ retailCharge({
241
+ phase,
242
+ label:
243
+ phase === 'webhook_event'
244
+ ? 'Webhook event delivery'
245
+ : phase === 'create'
246
+ ? 'Monitor create'
247
+ : 'Monitor reactivate',
248
+ components: [
249
+ noCustomerCharge(
250
+ 'included_in_plan_entitlement',
251
+ 'Included in Monitor Wrapper Pack entitlement',
252
+ ),
253
+ ],
254
+ });
255
+ return {
256
+ ...policy,
257
+ customerCreateCharge: noCharge('create'),
258
+ customerReactivateCharge: noCharge('reactivate'),
259
+ customerUsageCharges: policy.customerUsageCharges.map((charge) =>
260
+ noCharge(charge.phase),
261
+ ),
262
+ };
263
+ }
264
+
265
+ export function defineMeteredStaticMonitorBillingPolicy(input: {
266
+ provider: string;
267
+ capability: string;
268
+ customerMarkupMultiplier?: number;
269
+ sources: MonitorBillingSourceInput[];
270
+ createProviderComponents: MonitorProviderChargeComponent[];
271
+ usageCharges: {
272
+ label: string;
273
+ providerCostKey: string;
274
+ unitName: string;
275
+ units: number | { min: number; max: number };
276
+ unitCostUsd: number;
277
+ sourceLabel: string;
278
+ }[];
279
+ }): MonitorBillingPolicy {
280
+ const providerCapability = providerMonitorCapabilityId(input);
281
+ const customerMarkupMultiplier =
282
+ input.customerMarkupMultiplier ?? MONITOR_UPSTREAM_COST_MARKUP_MULTIPLIER;
283
+ const usageRetailCharges = input.usageCharges.map((charge) => {
284
+ const units =
285
+ typeof charge.units === 'number' ? charge.units : charge.units.max;
286
+ const retailCredits = monitorProviderUsdToRetailCredits(
287
+ units * charge.unitCostUsd,
288
+ customerMarkupMultiplier,
289
+ );
290
+ return retailCharge({
291
+ phase: 'webhook_event',
292
+ label: charge.label,
293
+ components: [
294
+ upstreamMarkupCharge({
295
+ customerLabel: charge.label,
296
+ providerCostKey: charge.providerCostKey,
297
+ source: 'static_provider_unit',
298
+ retailCredits,
299
+ multiplier: customerMarkupMultiplier,
300
+ }),
301
+ ],
302
+ });
303
+ });
304
+ const upstreamCreateIsFree =
305
+ input.createProviderComponents.length > 0 &&
306
+ input.createProviderComponents.every(
307
+ (component) => component.kind === 'provider_documented_no_charge',
308
+ );
309
+ // create and reactivate share the same "waive base fee when upstream create is
310
+ // free, otherwise charge the base lifecycle credits" shape — differing only in
311
+ // phase + label. Build both from one helper so the waiver contract stays in
312
+ // lockstep across the two phases.
313
+ const baseLifecycleCharge = (
314
+ phase: 'create' | 'reactivate',
315
+ label: string,
316
+ ): MonitorRetailCharge =>
317
+ retailCharge({
318
+ phase,
319
+ label,
320
+ components: upstreamCreateIsFree
321
+ ? [
322
+ noCustomerCharge(
323
+ 'provider_documented_no_charge',
324
+ 'No Deepline base create fee — upstream creation is free; billed on responses',
325
+ ),
326
+ ]
327
+ : [
328
+ fixedCredits(
329
+ MONITOR_BASE_LIFECYCLE_CREDITS,
330
+ label,
331
+ 'metered_monitor_default',
332
+ ),
333
+ ],
334
+ });
335
+ const createCharge = baseLifecycleCharge('create', 'Monitor create');
336
+ const reactivateCharge = baseLifecycleCharge(
337
+ 'reactivate',
338
+ 'Monitor reactivate',
339
+ );
340
+ return {
341
+ provider: input.provider,
342
+ capability: input.capability,
343
+ providerCapability,
344
+ pricingMode: 'metered_static',
345
+ evidenceStatus: 'verified',
346
+ economicResponsibility: 'deepline_managed_upstream',
347
+ sourceDocs: input.sources.map(source),
348
+ upstreamMarkupMultiplier: customerMarkupMultiplier,
349
+ customerCreateCharge: createCharge,
350
+ customerReactivateCharge: reactivateCharge,
351
+ customerUsageCharges: usageRetailCharges,
352
+ providerChargeComponents: [
353
+ ...input.createProviderComponents,
354
+ ...input.usageCharges.map((charge): MonitorProviderChargeComponent => {
355
+ const units =
356
+ typeof charge.units === 'number' ? charge.units : charge.units.max;
357
+ return {
358
+ kind: 'provider_metered_static',
359
+ phase: 'webhook_event',
360
+ providerCostKey: charge.providerCostKey,
361
+ unitName: charge.unitName,
362
+ units: charge.units,
363
+ unitCostUsd: charge.unitCostUsd,
364
+ retailCredits: monitorProviderUsdToRetailCredits(
365
+ units * charge.unitCostUsd,
366
+ customerMarkupMultiplier,
367
+ ),
368
+ sourceLabel: charge.sourceLabel,
369
+ };
370
+ }),
371
+ ],
372
+ disableOnBillingFailure: true,
373
+ };
374
+ }
375
+
376
+ export function defineTamradarUnresolvedMonitorBillingPolicy(
377
+ capability: string,
378
+ ): MonitorBillingPolicy {
379
+ const providerCapability = providerMonitorCapabilityId({
380
+ provider: 'deepline_native',
381
+ capability,
382
+ });
383
+ return {
384
+ provider: 'deepline_native',
385
+ capability,
386
+ providerCapability,
387
+ pricingMode: 'hybrid_unresolved',
388
+ evidenceStatus: 'partially_unresolved',
389
+ economicResponsibility: 'deepline_managed_upstream',
390
+ sourceDocs: [
391
+ source({
392
+ kind: 'official_provider_docs',
393
+ label: 'Deepline Balance and Pricing',
394
+ url: 'https://tamradar.mintlify.app/guides/balance-system-explained',
395
+ }),
396
+ source({
397
+ kind: 'official_provider_docs',
398
+ label: 'Deepline Monthly Subscription Billing',
399
+ url: 'https://tamradar.mintlify.app/guides/balance-monthly-subscription',
400
+ }),
401
+ source({
402
+ kind: 'official_provider_docs',
403
+ label: 'Deepline Update-Based Billing',
404
+ url: 'https://tamradar.mintlify.app/guides/balance-update-based',
405
+ }),
406
+ source({
407
+ kind: 'official_api_reference',
408
+ label: 'Deepline Account Summary',
409
+ url: 'https://tamradar.mintlify.app/api-reference/account',
410
+ }),
411
+ source({
412
+ kind: 'official_api_reference',
413
+ label: 'Deepline List Radars',
414
+ url: 'https://tamradar.mintlify.app/api-reference/list-radars',
415
+ }),
416
+ ],
417
+ upstreamMarkupMultiplier: MONITOR_UPSTREAM_COST_MARKUP_MULTIPLIER,
418
+ customerCreateCharge: retailCharge({
419
+ phase: 'create',
420
+ label: 'Monitor create',
421
+ components: [
422
+ fixedCredits(
423
+ MONITOR_BASE_LIFECYCLE_CREDITS,
424
+ 'Monitor create',
425
+ 'metered_monitor_default',
426
+ ),
427
+ upstreamMarkupCharge({
428
+ customerLabel: 'Provider setup charge, once known',
429
+ providerCostKey: `deepline_native.${capability}.create_or_period`,
430
+ source: 'provider_truth',
431
+ }),
432
+ ],
433
+ }),
434
+ customerReactivateCharge: retailCharge({
435
+ phase: 'reactivate',
436
+ label: 'Monitor reactivate',
437
+ components: [
438
+ fixedCredits(
439
+ MONITOR_BASE_LIFECYCLE_CREDITS,
440
+ 'Monitor reactivate',
441
+ 'metered_monitor_default',
442
+ ),
443
+ upstreamMarkupCharge({
444
+ customerLabel: 'Provider reactivation charge, once known',
445
+ providerCostKey: `deepline_native.${capability}.reactivate_or_period`,
446
+ source: 'provider_truth',
447
+ }),
448
+ ],
449
+ }),
450
+ customerUsageCharges: [
451
+ retailCharge({
452
+ phase: 'periodic_renewal',
453
+ label: 'Provider billing period',
454
+ components: [
455
+ upstreamMarkupCharge({
456
+ customerLabel: 'Provider billing period, once known',
457
+ providerCostKey: `deepline_native.${capability}.periodic_renewal`,
458
+ source: 'provider_truth',
459
+ }),
460
+ ],
461
+ }),
462
+ retailCharge({
463
+ phase: 'webhook_event',
464
+ label: 'Approved update or finding',
465
+ components: [
466
+ upstreamMarkupCharge({
467
+ customerLabel: 'Approved update or finding, once known',
468
+ providerCostKey: `deepline_native.${capability}.approved_update`,
469
+ source: 'provider_truth',
470
+ }),
471
+ ],
472
+ }),
473
+ ],
474
+ providerChargeComponents: [
475
+ {
476
+ kind: 'unresolved_deepline_paid_exposure',
477
+ phase: 'create',
478
+ missing: ['exact_billing_mode', 'exact_usd_amount'],
479
+ sourceLabel: 'Deepline Balance and Pricing',
480
+ blocksPublicDeploy: true,
481
+ },
482
+ {
483
+ kind: 'provider_recurring_period',
484
+ phase: 'periodic_renewal',
485
+ periodDays: 30,
486
+ amountStatus: 'unresolved',
487
+ sourceLabel: 'Deepline Monthly Subscription Billing',
488
+ },
489
+ {
490
+ kind: 'provider_metered_dynamic',
491
+ phase: 'webhook_event',
492
+ truthSources: [
493
+ 'provider_webhook',
494
+ 'provider_account_balance_delta',
495
+ 'provider_ledger_api',
496
+ ],
497
+ amountStatus: 'known_at_runtime',
498
+ sourceLabel: 'Deepline Update-Based Billing',
499
+ },
500
+ {
501
+ kind: 'unresolved_deepline_paid_exposure',
502
+ phase: 'webhook_event',
503
+ missing: [
504
+ 'exact_billing_mode',
505
+ 'exact_usd_amount',
506
+ 'provider_truth_source',
507
+ ],
508
+ sourceLabel: 'Deepline Update-Based Billing',
509
+ blocksPublicDeploy: true,
510
+ },
511
+ ],
512
+ disableOnBillingFailure: true,
513
+ };
514
+ }
515
+
516
+ function tamradarSourceDocs(): MonitorBillingSource[] {
517
+ return [
518
+ source({
519
+ kind: 'official_provider_docs',
520
+ label: 'Deepline Balance and Pricing',
521
+ url: 'https://tamradar.mintlify.app/guides/balance-system-explained',
522
+ }),
523
+ source({
524
+ kind: 'official_provider_docs',
525
+ label: 'Deepline Monthly Subscription Billing',
526
+ url: 'https://tamradar.mintlify.app/guides/balance-monthly-subscription',
527
+ }),
528
+ source({
529
+ kind: 'official_provider_docs',
530
+ label: 'Deepline Update-Based Billing',
531
+ url: 'https://tamradar.mintlify.app/guides/balance-update-based',
532
+ }),
533
+ source({
534
+ kind: 'official_api_reference',
535
+ label: 'Deepline Account Summary',
536
+ url: 'https://tamradar.mintlify.app/api-reference/account',
537
+ }),
538
+ source({
539
+ kind: 'official_api_reference',
540
+ label: 'Deepline List Radars',
541
+ url: 'https://tamradar.mintlify.app/api-reference/list-radars',
542
+ }),
543
+ ];
544
+ }
545
+
546
+ function payloadEntriesByMode(
547
+ pricing: MonitorPayloadPricingMap,
548
+ mode: MonitorPayloadPricingEntry['mode'],
549
+ ) {
550
+ return Object.entries(pricing.entries).filter(
551
+ (entry): entry is [string, MonitorPayloadPricingEntry] =>
552
+ entry[1].mode === mode,
553
+ );
554
+ }
555
+
556
+ function tamradarChargeForPayloadEntry(input: {
557
+ phase: MonitorRetailCharge['phase'];
558
+ entry: MonitorPayloadPricingEntry;
559
+ }): MonitorRetailChargeComponent {
560
+ return upstreamMarkupCharge({
561
+ customerLabel: `${input.entry.label} ${input.entry.unitLabel}`,
562
+ providerCostKey: input.entry.providerCostKey,
563
+ source: 'static_provider_unit',
564
+ retailCredits: input.entry.retailCredits,
565
+ });
566
+ }
567
+
568
+ export function defineTamradarMonitorBillingPolicy(
569
+ capability: string,
570
+ ): MonitorBillingPolicy {
571
+ const providerCapability = providerMonitorCapabilityId({
572
+ provider: 'deepline_native',
573
+ capability,
574
+ });
575
+ const payloadPricing = tamradarPayloadPricingForCapability(capability);
576
+ const usageEntries = payloadEntriesByMode(payloadPricing, 'monitor_usage');
577
+ const subscriptionEntries = payloadEntriesByMode(
578
+ payloadPricing,
579
+ 'monitor_subscription',
580
+ );
581
+ const subscriptionComponents = subscriptionEntries.map(([, entry]) =>
582
+ tamradarChargeForPayloadEntry({ phase: 'create', entry }),
583
+ );
584
+ const usageComponents = usageEntries.map(([, entry]) =>
585
+ tamradarChargeForPayloadEntry({ phase: 'webhook_event', entry }),
586
+ );
587
+ const noBaseCreateCharge = noCustomerCharge(
588
+ 'provider_documented_no_charge',
589
+ 'No Deepline base create charge',
590
+ );
591
+ const noBaseReactivateCharge = noCustomerCharge(
592
+ 'provider_documented_no_charge',
593
+ 'No Deepline base reactivate charge',
594
+ );
595
+ const customerUsageCharges: MonitorRetailCharge[] = [];
596
+ if (subscriptionEntries.length > 0) {
597
+ customerUsageCharges.push(
598
+ retailCharge({
599
+ phase: 'subscription_renewal',
600
+ label: 'Monitor subscription renewal',
601
+ components: subscriptionEntries.map(([, entry]) =>
602
+ tamradarChargeForPayloadEntry({
603
+ phase: 'subscription_renewal',
604
+ entry,
605
+ }),
606
+ ),
607
+ }),
608
+ );
609
+ }
610
+ if (usageEntries.length > 0) {
611
+ customerUsageCharges.push(
612
+ retailCharge({
613
+ phase: 'webhook_event',
614
+ label: 'Approved update or finding',
615
+ components: usageComponents,
616
+ }),
617
+ );
618
+ }
619
+
620
+ return {
621
+ provider: 'deepline_native',
622
+ capability,
623
+ providerCapability,
624
+ pricingMode: 'mixed_provider_native',
625
+ evidenceStatus: 'verified',
626
+ economicResponsibility: 'deepline_managed_upstream',
627
+ sourceDocs: tamradarSourceDocs(),
628
+ upstreamMarkupMultiplier: MONITOR_UPSTREAM_COST_MARKUP_MULTIPLIER,
629
+ customerCreateCharge: retailCharge({
630
+ phase: 'create',
631
+ label: 'Monitor create',
632
+ components: [noBaseCreateCharge, ...subscriptionComponents],
633
+ }),
634
+ customerReactivateCharge: retailCharge({
635
+ phase: 'reactivate',
636
+ label: 'Monitor reactivate',
637
+ components: [
638
+ noBaseReactivateCharge,
639
+ ...subscriptionEntries.map(([, entry]) =>
640
+ tamradarChargeForPayloadEntry({ phase: 'reactivate', entry }),
641
+ ),
642
+ ],
643
+ }),
644
+ customerUsageCharges,
645
+ providerChargeComponents: [
646
+ ...usageEntries.map(([, entry]): MonitorProviderChargeComponent => {
647
+ return {
648
+ kind: 'provider_metered_static',
649
+ phase: 'webhook_event',
650
+ providerCostKey: entry.providerCostKey,
651
+ unitName: entry.unitLabel,
652
+ units: 1,
653
+ unitCostUsd: entry.providerCostUsd,
654
+ retailCredits: entry.retailCredits,
655
+ sourceLabel: 'Deepline Update-Based Billing',
656
+ };
657
+ }),
658
+ ...subscriptionEntries.flatMap(([, entry]) => {
659
+ return [
660
+ {
661
+ kind: 'provider_metered_static',
662
+ phase: 'create',
663
+ providerCostKey: entry.providerCostKey,
664
+ unitName: entry.unitLabel,
665
+ units: 1,
666
+ unitCostUsd: entry.providerCostUsd,
667
+ retailCredits: entry.retailCredits,
668
+ sourceLabel: 'Deepline Monthly Subscription Billing',
669
+ },
670
+ {
671
+ kind: 'provider_metered_static',
672
+ phase: 'subscription_renewal',
673
+ providerCostKey: entry.providerCostKey,
674
+ unitName: entry.unitLabel,
675
+ units: 1,
676
+ unitCostUsd: entry.providerCostUsd,
677
+ retailCredits: entry.retailCredits,
678
+ sourceLabel: 'Deepline Monthly Subscription Billing',
679
+ },
680
+ ] satisfies MonitorProviderChargeComponent[];
681
+ }),
682
+ ],
683
+ disableOnBillingFailure: true,
684
+ payloadPricing,
685
+ };
686
+ }