@vibesdotdev/infra-core 0.0.2 → 1.0.0-rc.11

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 (331) hide show
  1. package/LICENSE +18 -0
  2. package/README.md +28 -1
  3. package/dist/bootstrap/seed.descriptor.d.ts +1 -1
  4. package/dist/bootstrap/seed.descriptor.d.ts.map +1 -1
  5. package/dist/bootstrap/seed.descriptor.js +1 -1
  6. package/dist/bootstrap/seed.descriptor.js.map +1 -1
  7. package/dist/bootstrap/seed.impl-shape.d.ts +1 -1
  8. package/dist/bootstrap/seed.impl-shape.d.ts.map +1 -1
  9. package/dist/bootstrap/seed.kind.d.ts +1 -3
  10. package/dist/bootstrap/seed.kind.d.ts.map +1 -1
  11. package/dist/bootstrap/seed.kind.js +17 -4
  12. package/dist/bootstrap/seed.kind.js.map +1 -1
  13. package/dist/bootstrap/seed.runner.d.ts +9 -2
  14. package/dist/bootstrap/seed.runner.d.ts.map +1 -1
  15. package/dist/bootstrap/seed.runner.js +37 -18
  16. package/dist/bootstrap/seed.runner.js.map +1 -1
  17. package/dist/capped-id.d.ts +19 -0
  18. package/dist/capped-id.d.ts.map +1 -0
  19. package/dist/capped-id.js +64 -0
  20. package/dist/capped-id.js.map +1 -0
  21. package/dist/cli/generate/artifact/artifact.cli-command.descriptor.d.ts +23 -0
  22. package/dist/cli/generate/artifact/artifact.cli-command.descriptor.d.ts.map +1 -0
  23. package/dist/cli/generate/artifact/artifact.cli-command.descriptor.js +33 -0
  24. package/dist/cli/generate/artifact/artifact.cli-command.descriptor.js.map +1 -0
  25. package/dist/cli/generate/artifact/artifact.cli-command.impl.d.ts +24 -0
  26. package/dist/cli/generate/artifact/artifact.cli-command.impl.d.ts.map +1 -0
  27. package/dist/cli/generate/artifact/artifact.cli-command.impl.js +73 -0
  28. package/dist/cli/generate/artifact/artifact.cli-command.impl.js.map +1 -0
  29. package/dist/cli/generate/context.d.ts +17 -0
  30. package/dist/cli/generate/context.d.ts.map +1 -0
  31. package/dist/cli/generate/context.js +24 -0
  32. package/dist/cli/generate/context.js.map +1 -0
  33. package/dist/cli/generate/generate/generate.cli-command.descriptor.d.ts +30 -0
  34. package/dist/cli/generate/generate/generate.cli-command.descriptor.d.ts.map +1 -0
  35. package/dist/cli/generate/generate/generate.cli-command.descriptor.js +25 -0
  36. package/dist/cli/generate/generate/generate.cli-command.descriptor.js.map +1 -0
  37. package/dist/cli/generate/generate/generate.cli-command.impl.d.ts +25 -0
  38. package/dist/cli/generate/generate/generate.cli-command.impl.d.ts.map +1 -0
  39. package/dist/cli/generate/generate/generate.cli-command.impl.js +64 -0
  40. package/dist/cli/generate/generate/generate.cli-command.impl.js.map +1 -0
  41. package/dist/cli/generate/generate-core.d.ts +51 -0
  42. package/dist/cli/generate/generate-core.d.ts.map +1 -0
  43. package/dist/cli/generate/generate-core.js +172 -0
  44. package/dist/cli/generate/generate-core.js.map +1 -0
  45. package/dist/cli/generate/index.d.ts +5 -0
  46. package/dist/cli/generate/index.d.ts.map +1 -0
  47. package/dist/cli/generate/index.js +5 -0
  48. package/dist/cli/generate/index.js.map +1 -0
  49. package/dist/credentials/resolve.d.ts +82 -22
  50. package/dist/credentials/resolve.d.ts.map +1 -1
  51. package/dist/credentials/resolve.js +251 -77
  52. package/dist/credentials/resolve.js.map +1 -1
  53. package/dist/deployment-budget.d.ts +319 -0
  54. package/dist/deployment-budget.d.ts.map +1 -0
  55. package/dist/deployment-budget.js +660 -0
  56. package/dist/deployment-budget.js.map +1 -0
  57. package/dist/deployment-environment.d.ts +30 -0
  58. package/dist/deployment-environment.d.ts.map +1 -0
  59. package/dist/deployment-environment.js +53 -0
  60. package/dist/deployment-environment.js.map +1 -0
  61. package/dist/deployment-graph.d.ts +185 -0
  62. package/dist/deployment-graph.d.ts.map +1 -0
  63. package/dist/deployment-graph.js +705 -0
  64. package/dist/deployment-graph.js.map +1 -0
  65. package/dist/deployment.d.ts +25 -4
  66. package/dist/deployment.d.ts.map +1 -1
  67. package/dist/deployment.js +105 -0
  68. package/dist/deployment.js.map +1 -1
  69. package/dist/doks/cloud/base.d.ts +49 -0
  70. package/dist/doks/cloud/base.d.ts.map +1 -0
  71. package/dist/doks/cloud/base.js +138 -0
  72. package/dist/doks/cloud/base.js.map +1 -0
  73. package/dist/doks/cloud/factory.d.ts +18 -0
  74. package/dist/doks/cloud/factory.d.ts.map +1 -0
  75. package/dist/doks/cloud/factory.js +22 -0
  76. package/dist/doks/cloud/factory.js.map +1 -0
  77. package/dist/doks/cloud/index.d.ts +5 -0
  78. package/dist/doks/cloud/index.d.ts.map +1 -0
  79. package/dist/doks/cloud/index.js +4 -0
  80. package/dist/doks/cloud/index.js.map +1 -0
  81. package/dist/doks/types.d.ts +95 -0
  82. package/dist/doks/types.d.ts.map +1 -0
  83. package/dist/doks/types.js +14 -0
  84. package/dist/doks/types.js.map +1 -0
  85. package/dist/generate/index.d.ts +29 -0
  86. package/dist/generate/index.d.ts.map +1 -0
  87. package/dist/generate/index.js +28 -0
  88. package/dist/generate/index.js.map +1 -0
  89. package/dist/generate/infra-generate.plugin.d.ts +3 -0
  90. package/dist/generate/infra-generate.plugin.d.ts.map +1 -0
  91. package/dist/generate/infra-generate.plugin.js +23 -0
  92. package/dist/generate/infra-generate.plugin.js.map +1 -0
  93. package/dist/generate/plugin.d.ts +2 -0
  94. package/dist/generate/plugin.d.ts.map +1 -0
  95. package/dist/generate/plugin.js +2 -0
  96. package/dist/generate/plugin.js.map +1 -0
  97. package/dist/heartbeat/cron-heartbeat.d.ts +97 -0
  98. package/dist/heartbeat/cron-heartbeat.d.ts.map +1 -0
  99. package/dist/heartbeat/cron-heartbeat.js +200 -0
  100. package/dist/heartbeat/cron-heartbeat.js.map +1 -0
  101. package/dist/index.d.ts +37 -22
  102. package/dist/index.d.ts.map +1 -1
  103. package/dist/index.js +29 -14
  104. package/dist/index.js.map +1 -1
  105. package/dist/infra.plugin.d.ts +1 -1
  106. package/dist/infra.plugin.d.ts.map +1 -1
  107. package/dist/infra.plugin.js +64 -12
  108. package/dist/infra.plugin.js.map +1 -1
  109. package/dist/kinds/alerts.kind.d.ts +64 -25
  110. package/dist/kinds/alerts.kind.d.ts.map +1 -1
  111. package/dist/kinds/alerts.kind.js +43 -16
  112. package/dist/kinds/alerts.kind.js.map +1 -1
  113. package/dist/kinds/artifact.kind.d.ts +58 -10
  114. package/dist/kinds/artifact.kind.d.ts.map +1 -1
  115. package/dist/kinds/artifact.kind.js +26 -9
  116. package/dist/kinds/artifact.kind.js.map +1 -1
  117. package/dist/kinds/billing.kind.d.ts +88 -0
  118. package/dist/kinds/billing.kind.d.ts.map +1 -0
  119. package/dist/kinds/billing.kind.js +48 -0
  120. package/dist/kinds/billing.kind.js.map +1 -0
  121. package/dist/kinds/build-job.kind.d.ts +383 -0
  122. package/dist/kinds/build-job.kind.d.ts.map +1 -0
  123. package/dist/kinds/build-job.kind.js +218 -0
  124. package/dist/kinds/build-job.kind.js.map +1 -0
  125. package/dist/kinds/cache-byte-store.d.ts +23 -0
  126. package/dist/kinds/cache-byte-store.d.ts.map +1 -0
  127. package/dist/kinds/cache-byte-store.js +9 -0
  128. package/dist/kinds/cache-byte-store.js.map +1 -0
  129. package/dist/kinds/cache.kind.d.ts +38 -94
  130. package/dist/kinds/cache.kind.d.ts.map +1 -1
  131. package/dist/kinds/cache.kind.js +39 -50
  132. package/dist/kinds/cache.kind.js.map +1 -1
  133. package/dist/kinds/cluster.kind.d.ts +154 -0
  134. package/dist/kinds/cluster.kind.d.ts.map +1 -0
  135. package/dist/kinds/cluster.kind.js +99 -0
  136. package/dist/kinds/cluster.kind.js.map +1 -0
  137. package/dist/kinds/compute-source.kind.d.ts +155 -0
  138. package/dist/kinds/compute-source.kind.d.ts.map +1 -0
  139. package/dist/kinds/compute-source.kind.js +158 -0
  140. package/dist/kinds/compute-source.kind.js.map +1 -0
  141. package/dist/kinds/container-registry.kind.d.ts +62 -0
  142. package/dist/kinds/container-registry.kind.d.ts.map +1 -0
  143. package/dist/kinds/container-registry.kind.js +47 -0
  144. package/dist/kinds/container-registry.kind.js.map +1 -0
  145. package/dist/kinds/database-migrator.kind.d.ts +6 -0
  146. package/dist/kinds/database-migrator.kind.d.ts.map +1 -0
  147. package/dist/kinds/database-migrator.kind.js +28 -0
  148. package/dist/kinds/database-migrator.kind.js.map +1 -0
  149. package/dist/kinds/database.kind.d.ts +114 -93
  150. package/dist/kinds/database.kind.d.ts.map +1 -1
  151. package/dist/kinds/database.kind.js +93 -54
  152. package/dist/kinds/database.kind.js.map +1 -1
  153. package/dist/kinds/deployment-provider.kind.d.ts +5 -0
  154. package/dist/kinds/deployment-provider.kind.d.ts.map +1 -0
  155. package/dist/kinds/deployment-provider.kind.js +11 -0
  156. package/dist/kinds/deployment-provider.kind.js.map +1 -0
  157. package/dist/kinds/discovery.d.ts +5 -12
  158. package/dist/kinds/discovery.d.ts.map +1 -1
  159. package/dist/kinds/discovery.js +5 -17
  160. package/dist/kinds/discovery.js.map +1 -1
  161. package/dist/kinds/dns.kind.d.ts +162 -0
  162. package/dist/kinds/dns.kind.d.ts.map +1 -0
  163. package/dist/kinds/dns.kind.js +54 -0
  164. package/dist/kinds/dns.kind.js.map +1 -0
  165. package/dist/kinds/drift.kind.d.ts +115 -0
  166. package/dist/kinds/drift.kind.d.ts.map +1 -0
  167. package/dist/kinds/drift.kind.js +60 -0
  168. package/dist/kinds/drift.kind.js.map +1 -0
  169. package/dist/kinds/edge-hostname.kind.d.ts +124 -0
  170. package/dist/kinds/edge-hostname.kind.d.ts.map +1 -0
  171. package/dist/kinds/edge-hostname.kind.js +87 -0
  172. package/dist/kinds/edge-hostname.kind.js.map +1 -0
  173. package/dist/kinds/edge-tls.kind.d.ts +194 -0
  174. package/dist/kinds/edge-tls.kind.d.ts.map +1 -0
  175. package/dist/kinds/edge-tls.kind.js +58 -0
  176. package/dist/kinds/edge-tls.kind.js.map +1 -0
  177. package/dist/kinds/firewall.kind.d.ts +92 -0
  178. package/dist/kinds/firewall.kind.d.ts.map +1 -0
  179. package/dist/kinds/firewall.kind.js +59 -0
  180. package/dist/kinds/firewall.kind.js.map +1 -0
  181. package/dist/kinds/git-hosting.kind.d.ts +36 -38
  182. package/dist/kinds/git-hosting.kind.d.ts.map +1 -1
  183. package/dist/kinds/git-hosting.kind.js +21 -32
  184. package/dist/kinds/git-hosting.kind.js.map +1 -1
  185. package/dist/kinds/index.d.ts +41 -15
  186. package/dist/kinds/index.d.ts.map +1 -1
  187. package/dist/kinds/index.js +40 -14
  188. package/dist/kinds/index.js.map +1 -1
  189. package/dist/kinds/inventory.kind.d.ts +245 -0
  190. package/dist/kinds/inventory.kind.d.ts.map +1 -0
  191. package/dist/kinds/inventory.kind.js +243 -0
  192. package/dist/kinds/inventory.kind.js.map +1 -0
  193. package/dist/kinds/load-balancer.kind.d.ts +135 -0
  194. package/dist/kinds/load-balancer.kind.d.ts.map +1 -0
  195. package/dist/kinds/load-balancer.kind.js +71 -0
  196. package/dist/kinds/load-balancer.kind.js.map +1 -0
  197. package/dist/kinds/logs.kind.d.ts +74 -3
  198. package/dist/kinds/logs.kind.d.ts.map +1 -1
  199. package/dist/kinds/logs.kind.js +26 -17
  200. package/dist/kinds/logs.kind.js.map +1 -1
  201. package/dist/kinds/nfs.kind.d.ts +67 -0
  202. package/dist/kinds/nfs.kind.d.ts.map +1 -0
  203. package/dist/kinds/nfs.kind.js +45 -0
  204. package/dist/kinds/nfs.kind.js.map +1 -0
  205. package/dist/kinds/node-pool.kind.d.ts +134 -0
  206. package/dist/kinds/node-pool.kind.d.ts.map +1 -0
  207. package/dist/kinds/node-pool.kind.js +88 -0
  208. package/dist/kinds/node-pool.kind.js.map +1 -0
  209. package/dist/kinds/object-storage.kind.d.ts +50 -24
  210. package/dist/kinds/object-storage.kind.d.ts.map +1 -1
  211. package/dist/kinds/object-storage.kind.js +40 -23
  212. package/dist/kinds/object-storage.kind.js.map +1 -1
  213. package/dist/kinds/observability.kind.d.ts +104 -6
  214. package/dist/kinds/observability.kind.d.ts.map +1 -1
  215. package/dist/kinds/observability.kind.js +67 -9
  216. package/dist/kinds/observability.kind.js.map +1 -1
  217. package/dist/kinds/package-registry.kind.d.ts +139 -33
  218. package/dist/kinds/package-registry.kind.d.ts.map +1 -1
  219. package/dist/kinds/package-registry.kind.js +55 -25
  220. package/dist/kinds/package-registry.kind.js.map +1 -1
  221. package/dist/kinds/queue.kind.d.ts +67 -63
  222. package/dist/kinds/queue.kind.d.ts.map +1 -1
  223. package/dist/kinds/queue.kind.js +55 -33
  224. package/dist/kinds/queue.kind.js.map +1 -1
  225. package/dist/kinds/read-descriptor.d.ts +15 -0
  226. package/dist/kinds/read-descriptor.d.ts.map +1 -0
  227. package/dist/kinds/read-descriptor.js +11 -0
  228. package/dist/kinds/read-descriptor.js.map +1 -0
  229. package/dist/kinds/rum.kind.d.ts +36 -6
  230. package/dist/kinds/rum.kind.d.ts.map +1 -1
  231. package/dist/kinds/rum.kind.js +6 -7
  232. package/dist/kinds/rum.kind.js.map +1 -1
  233. package/dist/kinds/sandbox.kind.d.ts +136 -40
  234. package/dist/kinds/sandbox.kind.d.ts.map +1 -1
  235. package/dist/kinds/sandbox.kind.js +82 -43
  236. package/dist/kinds/sandbox.kind.js.map +1 -1
  237. package/dist/kinds/select-compute-source.d.ts +72 -0
  238. package/dist/kinds/select-compute-source.d.ts.map +1 -0
  239. package/dist/kinds/select-compute-source.js +170 -0
  240. package/dist/kinds/select-compute-source.js.map +1 -0
  241. package/dist/kinds/service-release.kind.d.ts +771 -0
  242. package/dist/kinds/service-release.kind.d.ts.map +1 -0
  243. package/dist/kinds/service-release.kind.js +676 -0
  244. package/dist/kinds/service-release.kind.js.map +1 -0
  245. package/dist/kinds/spend-guard.kind.d.ts +41 -0
  246. package/dist/kinds/spend-guard.kind.d.ts.map +1 -0
  247. package/dist/kinds/spend-guard.kind.js +140 -0
  248. package/dist/kinds/spend-guard.kind.js.map +1 -0
  249. package/dist/kinds/utilization.kind.d.ts +88 -0
  250. package/dist/kinds/utilization.kind.d.ts.map +1 -0
  251. package/dist/kinds/utilization.kind.js +62 -0
  252. package/dist/kinds/utilization.kind.js.map +1 -0
  253. package/dist/kinds/volume.kind.d.ts +54 -0
  254. package/dist/kinds/volume.kind.d.ts.map +1 -0
  255. package/dist/kinds/volume.kind.js +39 -0
  256. package/dist/kinds/volume.kind.js.map +1 -0
  257. package/dist/kinds/vpc.kind.d.ts +61 -0
  258. package/dist/kinds/vpc.kind.d.ts.map +1 -0
  259. package/dist/kinds/vpc.kind.js +51 -0
  260. package/dist/kinds/vpc.kind.js.map +1 -0
  261. package/dist/kinds/web-app.kind.d.ts +118 -45
  262. package/dist/kinds/web-app.kind.d.ts.map +1 -1
  263. package/dist/kinds/web-app.kind.js +69 -42
  264. package/dist/kinds/web-app.kind.js.map +1 -1
  265. package/dist/kinds/worker.kind.d.ts +129 -188
  266. package/dist/kinds/worker.kind.d.ts.map +1 -1
  267. package/dist/kinds/worker.kind.js +45 -123
  268. package/dist/kinds/worker.kind.js.map +1 -1
  269. package/dist/schemas/database-migration.d.ts +173 -0
  270. package/dist/schemas/database-migration.d.ts.map +1 -0
  271. package/dist/schemas/database-migration.js +88 -0
  272. package/dist/schemas/database-migration.js.map +1 -0
  273. package/dist/schemas/deployment-environment.d.ts +11 -0
  274. package/dist/schemas/deployment-environment.d.ts.map +1 -0
  275. package/dist/schemas/deployment-environment.js +9 -0
  276. package/dist/schemas/deployment-environment.js.map +1 -0
  277. package/dist/schemas/deployment-provider.d.ts +383 -0
  278. package/dist/schemas/deployment-provider.d.ts.map +1 -0
  279. package/dist/schemas/deployment-provider.js +211 -0
  280. package/dist/schemas/deployment-provider.js.map +1 -0
  281. package/dist/schemas/log-stream.d.ts +27 -0
  282. package/dist/schemas/log-stream.d.ts.map +1 -0
  283. package/dist/schemas/log-stream.js +31 -0
  284. package/dist/schemas/log-stream.js.map +1 -0
  285. package/dist/schemas/spend-guard.d.ts +155 -0
  286. package/dist/schemas/spend-guard.d.ts.map +1 -0
  287. package/dist/schemas/spend-guard.js +61 -0
  288. package/dist/schemas/spend-guard.js.map +1 -0
  289. package/dist/schemas.d.ts +195 -20
  290. package/dist/schemas.d.ts.map +1 -1
  291. package/dist/schemas.js +151 -31
  292. package/dist/schemas.js.map +1 -1
  293. package/dist/service.d.ts +87 -0
  294. package/dist/service.d.ts.map +1 -0
  295. package/dist/service.js +199 -0
  296. package/dist/service.js.map +1 -0
  297. package/dist/settle-work.d.ts +20 -0
  298. package/dist/settle-work.d.ts.map +1 -0
  299. package/dist/settle-work.js +22 -0
  300. package/dist/settle-work.js.map +1 -0
  301. package/dist/web-app-projection.d.ts +208 -0
  302. package/dist/web-app-projection.d.ts.map +1 -0
  303. package/dist/web-app-projection.js +95 -0
  304. package/dist/web-app-projection.js.map +1 -0
  305. package/package.json +121 -37
  306. package/src/bootstrap/index.ts +0 -15
  307. package/src/bootstrap/seed.descriptor.ts +0 -24
  308. package/src/bootstrap/seed.impl-shape.ts +0 -5
  309. package/src/bootstrap/seed.kind.ts +0 -26
  310. package/src/bootstrap/seed.runner.ts +0 -87
  311. package/src/credentials/resolve.ts +0 -205
  312. package/src/deployment.ts +0 -57
  313. package/src/index.ts +0 -149
  314. package/src/infra.plugin.ts +0 -54
  315. package/src/kinds/alerts.kind.ts +0 -164
  316. package/src/kinds/artifact.kind.ts +0 -96
  317. package/src/kinds/cache.kind.ts +0 -104
  318. package/src/kinds/database.kind.ts +0 -120
  319. package/src/kinds/discovery.ts +0 -26
  320. package/src/kinds/git-hosting.kind.ts +0 -100
  321. package/src/kinds/index.ts +0 -139
  322. package/src/kinds/logs.kind.ts +0 -104
  323. package/src/kinds/object-storage.kind.ts +0 -101
  324. package/src/kinds/observability.kind.ts +0 -178
  325. package/src/kinds/package-registry.kind.ts +0 -95
  326. package/src/kinds/queue.kind.ts +0 -102
  327. package/src/kinds/rum.kind.ts +0 -135
  328. package/src/kinds/sandbox.kind.ts +0 -115
  329. package/src/kinds/web-app.kind.ts +0 -103
  330. package/src/kinds/worker.kind.ts +0 -203
  331. package/src/schemas.ts +0 -127
@@ -1,102 +0,0 @@
1
- /**
2
- * Kind: infra/queue
3
- *
4
- * Describes a message queue system.
5
- *
6
- * Schema shape: strict common base + `config` discriminated union.
7
- *
8
- * - The base defines fields universal across adapters: id/kind/name +
9
- * the queue shape (engine, topics, maxBatchSize, maxRetries, deadLetterQueue).
10
- * - Adapter-specific fields (namespace, storageSize, resources, …) live under
11
- * `config`. Each adapter package defines its own concrete schema.
12
- */
13
- import * as z from 'zod/v4';
14
- import { createRuntimeKind } from '@vibesdotdev/runtime/factory/kind';
15
- import type { RuntimeKindDescriptorRecord } from '@vibesdotdev/runtime/schemas/kind';
16
- import { RuntimeDescriptorSchema } from '@vibesdotdev/runtime/schemas/descriptor';
17
- import type { RuntimeDescriptor } from '@vibesdotdev/runtime/schemas/descriptor';
18
- import { INFRA_DISCOVERY_PATTERN, extractStem } from './discovery.ts';
19
-
20
- export const QueueTopicSchema = z.object({
21
- name: z.string().min(1),
22
- partitions: z.number().int().positive().optional(),
23
- retention: z.string().optional(),
24
- replication: z.number().int().positive().optional()
25
- });
26
- export type QueueTopic = z.infer<typeof QueueTopicSchema>;
27
-
28
- const QueueBaseSchema = RuntimeDescriptorSchema.extend({
29
- kind: z.literal('infra/queue'),
30
-
31
- /** Queue engine (e.g., 'cloudflare-queues', 'redpanda'). */
32
- engine: z.string().min(1).optional(),
33
-
34
- /** Topic / queue declarations. */
35
- topics: z.array(QueueTopicSchema).optional(),
36
-
37
- /** Maximum batch size. */
38
- maxBatchSize: z.number().int().positive().optional(),
39
-
40
- /** Maximum retry count. */
41
- maxRetries: z.number().int().nonnegative().optional(),
42
-
43
- /** Dead-letter queue id. */
44
- deadLetterQueue: z.string().optional()
45
- });
46
-
47
- export const DoksQueueConfigSchema = z.object({
48
- /** Kubernetes namespace (default: vibes). */
49
- namespace: z.string().min(1).default('vibes'),
50
- /** Storage size for data volume (default: 10Gi). */
51
- storageSize: z.string().min(1).default('10Gi'),
52
- /** Container resources. */
53
- resources: z
54
- .object({
55
- requests: z.object({ cpu: z.string().min(1), memory: z.string().min(1) }).optional(),
56
- limits: z.object({ cpu: z.string().min(1), memory: z.string().min(1) }).optional()
57
- })
58
- .optional()
59
- });
60
-
61
- export const CloudflareQueuesConfigSchema = z.object({
62
- /** Maximum batch size per message. */
63
- maxBatchSize: z.number().int().positive().default(10),
64
- /** Maximum retry count. */
65
- maxRetries: z.number().int().nonnegative().default(3),
66
- /** Dead-letter queue id. */
67
- deadLetterQueue: z.string().min(1).optional()
68
- });
69
-
70
- export const QueueConfigSchema = z.union([
71
- DoksQueueConfigSchema.extend({ adapter: z.literal('doks-statefulset') }),
72
- CloudflareQueuesConfigSchema.extend({ adapter: z.literal('cloudflare-queues') })
73
- ]);
74
-
75
- export const QueueDescriptorSchema = QueueBaseSchema.extend({
76
- /**
77
- * Adapter-specific configuration. Discriminated union — each adapter
78
- * package defines its own config schema under its discriminator key.
79
- */
80
- config: QueueConfigSchema.optional()
81
- });
82
-
83
- export type QueueDescriptor = z.infer<typeof QueueDescriptorSchema>;
84
-
85
- class DefaultQueueImplementation {
86
- constructor(
87
- public readonly descriptor: RuntimeDescriptor,
88
- public readonly context: unknown
89
- ) {}
90
-
91
- get config(): QueueDescriptor {
92
- return this.descriptor as QueueDescriptor;
93
- }
94
- }
95
-
96
- export const queueKind = createRuntimeKind<QueueDescriptor, DefaultQueueImplementation>({
97
- id: 'infra/queue',
98
- descriptorSchema: QueueDescriptorSchema,
99
- defaultImplementation: DefaultQueueImplementation,
100
- discoveryPattern: INFRA_DISCOVERY_PATTERN,
101
- extractStem
102
- });
@@ -1,135 +0,0 @@
1
- /**
2
- * Infra RUM (Real User Monitoring) Kind
3
- *
4
- * Provider-agnostic schema for beacon-based front-end telemetry —
5
- * page-load timing, Core Web Vitals, navigation timing. Provider impls
6
- * map this shape onto native services:
7
- *
8
- * cloudflare-web-analytics → CF Web Analytics (sites + auto-injection rules)
9
- * sentry-replay → Sentry Performance + Session Replay
10
- * plausible → Plausible Analytics
11
- *
12
- * The kind decouples *configuration* (which hostnames, which token,
13
- * which privacy mode) from *delivery* (how the beacon `<script>` tag
14
- * lands in the HTML). For SvelteKit apps, the
15
- * `@vibesdotdev/cloudflare-web-analytics` package provides a `handle`
16
- * hook that injects the beacon via `transformPageChunk` — no
17
- * per-app `app.html` edits required once the kind is wired in.
18
- */
19
-
20
- import * as z from 'zod/v4';
21
- import { createRuntimeKind } from '@vibesdotdev/runtime/factory/kind';
22
- import { RuntimeDescriptorSchema } from '@vibesdotdev/runtime/schemas/descriptor';
23
- import { INFRA_DISCOVERY_PATTERN, extractStem } from './discovery.ts';
24
-
25
- const RumPrivacySchema = z.object({
26
- /** Drop EU visitor data at the beacon level (GDPR fast path). */
27
- excludeEU: z.boolean().default(false),
28
- /** Honor Do-Not-Track / Global Privacy Control headers. */
29
- respectDoNotTrack: z.boolean().default(true),
30
- /** Strip PII (query params, fragments) from reported URLs. */
31
- stripQueryParams: z.boolean().default(false)
32
- });
33
-
34
- export type RumPrivacy = z.infer<typeof RumPrivacySchema>;
35
-
36
- /**
37
- * Where + how the beacon `<script>` lands in the served HTML.
38
- *
39
- * app-html → bake the snippet into app.html (manual; pre-Phase 3)
40
- * sveltekit-hook → injected via `transformPageChunk` in handle hook (preferred)
41
- * provider-auto → provider auto-injection (CF: only works on non-Worker traffic)
42
- * custom → caller injects however they want; we just track config
43
- */
44
- const RumInjectionSchema = z.enum([
45
- 'app-html',
46
- 'sveltekit-hook',
47
- 'provider-auto',
48
- 'custom'
49
- ]);
50
-
51
- export type RumInjection = z.infer<typeof RumInjectionSchema>;
52
-
53
- const RumBaseSchema = RuntimeDescriptorSchema.extend({
54
- kind: z.literal('infra/rum'),
55
- adapter: z.string().min(1),
56
- adapterConfig: z.record(z.string(), z.unknown()).optional(),
57
- environment: z.string().default('local'),
58
- /**
59
- * Public site token (a.k.a. site_tag / beacon token / measurement
60
- * id). Provider-specific format; safe to commit because it's
61
- * embedded in client-side HTML for every visitor to see.
62
- *
63
- * Pass `{ source: 'secret', key: 'NAME' }` only when the provider
64
- * explicitly wants a private token — most don't.
65
- */
66
- siteToken: z.union([
67
- z.string().min(1),
68
- z.object({ source: z.literal('secret'), key: z.string().min(1) })
69
- ]),
70
- /** Hostnames the beacon should report from. `*` matches all subdomains. */
71
- hostnames: z.array(z.string().min(1)).default(['*']),
72
- injection: RumInjectionSchema.default('sveltekit-hook'),
73
- privacy: RumPrivacySchema.default(() => ({
74
- excludeEU: false,
75
- respectDoNotTrack: true,
76
- stripQueryParams: false
77
- })),
78
- /** Whether the site is currently enabled. Provider impls read+write this. */
79
- enabled: z.boolean().default(true)
80
- });
81
-
82
- export type InfraRumDescriptor = z.infer<typeof RumBaseSchema>;
83
- export type InfraRumDescriptorInput = z.input<typeof RumBaseSchema>;
84
-
85
- /**
86
- * Snapshot of a single configured RUM site on the provider. Returned
87
- * by `listSites`; consumed by the CLI for table rendering and drift
88
- * detection.
89
- */
90
- export interface RumSiteSnapshot {
91
- /** Provider-assigned site id (CF: site_tag). */
92
- siteTag: string;
93
- /** Friendly name (often the apex hostname). */
94
- name?: string;
95
- hostnames: string[];
96
- enabled: boolean;
97
- injection?: RumInjection;
98
- /** Page-views captured in the last 24h (when available). */
99
- pageViews24h?: number;
100
- createdAt?: string;
101
- }
102
-
103
- export interface RumImplementation {
104
- /** Enumerate the configured RUM sites on the provider. */
105
- listSites(): Promise<RumSiteSnapshot[]>;
106
- /** Look up a single site by siteTag. */
107
- getSite(siteTag: string): Promise<RumSiteSnapshot | null>;
108
- /**
109
- * Ensure a site exists matching the descriptor; returns the
110
- * siteTag (provider-assigned id) and whether it was created or
111
- * already existed.
112
- */
113
- ensureSite(descriptor: InfraRumDescriptor): Promise<{
114
- siteTag: string;
115
- created: boolean;
116
- }>;
117
- /** Toggle enabled state. */
118
- setEnabled(siteTag: string, enabled: boolean): Promise<void>;
119
- }
120
-
121
- export const rumKind = createRuntimeKind<InfraRumDescriptor, RumImplementation>({
122
- id: 'infra/rum',
123
- descriptorSchema: RumBaseSchema,
124
- discoveryPattern: INFRA_DISCOVERY_PATTERN,
125
- extractStem
126
- });
127
-
128
- export type InfraRumKind = InfraRumDescriptor;
129
- export type InfraRumKindInput = InfraRumDescriptorInput;
130
-
131
- export {
132
- RumBaseSchema as InfraRumDescriptorSchema,
133
- RumPrivacySchema,
134
- RumInjectionSchema
135
- };
@@ -1,115 +0,0 @@
1
- /**
2
- * Kind: infra/sandbox
3
- *
4
- * Persistent isolated execution environment with shell, filesystem, and
5
- * subprocess capabilities. Used for agent code execution, tool sandboxing,
6
- * and long-running background tasks.
7
- *
8
- * Schema shape: strict common base + `config` discriminated union.
9
- *
10
- * - The base defines fields universal across every adapter:
11
- * id/kind/name + the sandbox shape (entrypoint, image, limits,
12
- * outboundProxy, liveView, persistent, env).
13
- * - Adapter-specific fields live under `config`. Each adapter package
14
- * defines its own concrete schema under its discriminator key.
15
- */
16
- import * as z from 'zod/v4';
17
- import { createRuntimeKind } from '@vibesdotdev/runtime/factory/kind';
18
- import type { RuntimeKindDescriptorRecord } from '@vibesdotdev/runtime/schemas/kind';
19
- import { RuntimeDescriptorSchema } from '@vibesdotdev/runtime/schemas/descriptor';
20
- import type { RuntimeDescriptor } from '@vibesdotdev/runtime/schemas/descriptor';
21
- import { deploymentEnvRequirementSchema } from '../schemas.ts';
22
- import { INFRA_DISCOVERY_PATTERN, extractStem } from './discovery.ts';
23
-
24
- export const SandboxOutboundProxySchema = z.object({
25
- binding: z.string().min(1),
26
- workerPath: z.string().min(1).optional(),
27
- allowedHosts: z.array(z.string()).default([])
28
- });
29
- export type SandboxOutboundProxy = z.infer<typeof SandboxOutboundProxySchema>;
30
-
31
- export const SandboxResourceLimitsSchema = z.object({
32
- cpu: z.string().optional(),
33
- memory: z.string().optional(),
34
- disk: z.string().optional(),
35
- maxSubprocesses: z.number().int().positive().optional(),
36
- timeoutSeconds: z.number().int().positive().optional()
37
- });
38
- export type SandboxResourceLimits = z.infer<typeof SandboxResourceLimitsSchema>;
39
-
40
- const SandboxBaseSchema = RuntimeDescriptorSchema.extend({
41
- kind: z.literal('infra/sandbox'),
42
-
43
- /** Shell or script to run on sandbox start. */
44
- entrypoint: z.string().optional(),
45
-
46
- /** Container image or template snapshot. */
47
- image: z.string().optional(),
48
-
49
- /** Resource limits. */
50
- limits: SandboxResourceLimitsSchema.optional(),
51
-
52
- /** Outbound egress proxy (CF Outbound Workers for Sandboxes). */
53
- outboundProxy: SandboxOutboundProxySchema.optional(),
54
-
55
- /** Enable Live View for human-in-loop debugging. */
56
- liveView: z.boolean().optional(),
57
-
58
- /** Persist state between sessions. */
59
- persistent: z.boolean().optional(),
60
-
61
- /** Environment variable requirements. */
62
- env: z.array(deploymentEnvRequirementSchema).optional()
63
- });
64
-
65
- export const CloudflareSandboxConfigSchema = z.object({
66
- /** Container image or template snapshot. */
67
- image: z.string().optional()
68
- });
69
-
70
- export const DockerSandboxConfigSchema = z.object({
71
- /** Container image. */
72
- image: z.string(),
73
- /** Volume mounts (hostPath: containerPath). */
74
- volumes: z.record(z.string(), z.string()).optional()
75
- });
76
-
77
- export const DigitalOceanDropletSandboxConfigSchema = z.object({
78
- /** Droplet size slug (e.g., 's-2vcpu-2gb'). */
79
- dropletSize: z.string().min(1)
80
- });
81
-
82
- export const SandboxConfigSchema = z.union([
83
- CloudflareSandboxConfigSchema.extend({ adapter: z.literal('cloudflare-sandbox') }),
84
- DockerSandboxConfigSchema.extend({ adapter: z.literal('docker') }),
85
- DigitalOceanDropletSandboxConfigSchema.extend({ adapter: z.literal('digitalocean-droplet') })
86
- ]);
87
-
88
- export const SandboxDescriptorSchema = SandboxBaseSchema.extend({
89
- /**
90
- * Adapter-specific configuration. Discriminated union — each adapter
91
- * package defines its own config schema under its discriminator key.
92
- */
93
- config: SandboxConfigSchema.optional()
94
- });
95
-
96
- export type SandboxDescriptor = z.infer<typeof SandboxDescriptorSchema>;
97
-
98
- class DefaultSandboxImplementation {
99
- constructor(
100
- public readonly descriptor: RuntimeDescriptor,
101
- public readonly context: unknown
102
- ) {}
103
-
104
- get config(): SandboxDescriptor {
105
- return this.descriptor as SandboxDescriptor;
106
- }
107
- }
108
-
109
- export const sandboxKind = createRuntimeKind<SandboxDescriptor, DefaultSandboxImplementation>({
110
- id: 'infra/sandbox',
111
- descriptorSchema: SandboxDescriptorSchema,
112
- defaultImplementation: DefaultSandboxImplementation,
113
- discoveryPattern: INFRA_DISCOVERY_PATTERN,
114
- extractStem
115
- });
@@ -1,103 +0,0 @@
1
- /**
2
- * Kind: infra/web-app
3
- *
4
- * Describes a deployable web application (SvelteKit, static site, etc.).
5
- *
6
- * Schema shape: strict common base + `config` discriminated union.
7
- *
8
- * - The base defines fields universal across every adapter:
9
- * id/kind/name + the deployment shape every web-app declares
10
- * (domain, appDir, outputDir, runtime, env, dependsOn).
11
- * - Adapter-specific fields (cfWorkerName, secretsStoreId, digitaloceanAppName, …)
12
- * live exclusively under `config`. Each adapter package defines its own
13
- * concrete schema under its discriminator key.
14
- */
15
- import * as z from 'zod/v4';
16
- import { createRuntimeKind } from '@vibesdotdev/runtime/factory/kind';
17
- import type { RuntimeKindDescriptorRecord } from '@vibesdotdev/runtime/schemas/kind';
18
- import { RuntimeDescriptorSchema } from '@vibesdotdev/runtime/schemas/descriptor';
19
- import type { RuntimeDescriptor } from '@vibesdotdev/runtime/schemas/descriptor';
20
- import { deploymentEnvRequirementSchema } from '../schemas.ts';
21
- import { INFRA_DISCOVERY_PATTERN, extractStem } from './discovery.ts';
22
-
23
- export const WebAppDependencySchema = z.object({
24
- serviceId: z.string().min(1),
25
- reason: z.string().optional()
26
- });
27
- export type WebAppDependency = z.infer<typeof WebAppDependencySchema>;
28
-
29
- const WebAppBaseSchema = RuntimeDescriptorSchema.extend({
30
- kind: z.literal('infra/web-app'),
31
-
32
- /** Primary domain for this app (e.g., 'auth.vibes.dev'). */
33
- domain: z.string().min(1),
34
-
35
- /** Application source directory (e.g., 'apps/auth-web'). */
36
- appDir: z.string().min(1),
37
-
38
- /** Build output directory (e.g., '.svelte-kit/cloudflare'). */
39
- outputDir: z.string().min(1),
40
-
41
- /** Runtime environment for app deployments. */
42
- runtime: z.enum(['edge', 'node']),
43
-
44
- /** Environment variable requirements. */
45
- env: z.array(deploymentEnvRequirementSchema).optional(),
46
-
47
- /** Service dependencies. */
48
- dependsOn: z.array(WebAppDependencySchema).optional()
49
- });
50
-
51
- export const CloudflareWorkersWebAppConfigSchema = z.object({
52
- /** Cloudflare Workers script name (e.g., "vibes-ai"). */
53
- cfWorkerName: z.string().min(1),
54
- /** Path to the `_worker.js` entry point relative to outputDir. */
55
- workerEntry: z.string().min(1).default('_worker.js'),
56
- /** Compatibility date for wrangler. */
57
- compatibilityDate: z.string().regex(/^\d{4}-\d{2}-\d{2}$/).optional(),
58
- /** Compatibility flags for wrangler. */
59
- compatibilityFlags: z.array(z.string()).default(['nodejs_compat']),
60
- /** Environment variables to include. */
61
- env: z.record(z.string(), z.string()).default({}),
62
- /** Cloudflare Secrets Store ID for secret bindings. */
63
- secretsStoreId: z.string().min(1).optional()
64
- });
65
-
66
- export const DigitalOceanAppWebAppConfigSchema = z.object({
67
- /** DigitalOcean App name. */
68
- digitaloceanAppName: z.string().min(1)
69
- });
70
-
71
- export const WebAppConfigSchema = z.union([
72
- CloudflareWorkersWebAppConfigSchema.extend({ adapter: z.literal('cloudflare-workers') }),
73
- DigitalOceanAppWebAppConfigSchema.extend({ adapter: z.literal('digitalocean-apps') })
74
- ]);
75
-
76
- export const WebAppDescriptorSchema = WebAppBaseSchema.extend({
77
- /**
78
- * Adapter-specific configuration. Discriminated union — each adapter
79
- * package defines its own config schema under its discriminator key.
80
- */
81
- config: WebAppConfigSchema.optional()
82
- });
83
-
84
- export type WebAppDescriptor = z.infer<typeof WebAppDescriptorSchema>;
85
-
86
- class DefaultWebAppImplementation {
87
- constructor(
88
- public readonly descriptor: RuntimeDescriptor,
89
- public readonly context: unknown
90
- ) {}
91
-
92
- get config(): WebAppDescriptor {
93
- return this.descriptor as WebAppDescriptor;
94
- }
95
- }
96
-
97
- export const webAppKind = createRuntimeKind<WebAppDescriptor, DefaultWebAppImplementation>({
98
- id: 'infra/web-app',
99
- descriptorSchema: WebAppDescriptorSchema,
100
- defaultImplementation: DefaultWebAppImplementation,
101
- discoveryPattern: INFRA_DISCOVERY_PATTERN,
102
- extractStem
103
- });
@@ -1,203 +0,0 @@
1
- /**
2
- * Kind: infra/worker
3
- *
4
- * Describes a background worker process.
5
- *
6
- * Schema shape: strict common base + `config` discriminated union.
7
- *
8
- * - The base defines fields universal across adapters: id/kind/name +
9
- * the worker shape (entrypoint, queues, concurrency, scaling, env).
10
- * - Adapter-specific fields (namespace, image, healthPort, …) live under
11
- * `config`. Each adapter package defines its own concrete schema.
12
- */
13
- import * as z from 'zod/v4';
14
- import { createRuntimeKind } from '@vibesdotdev/runtime/factory/kind';
15
- import type { RuntimeKindDescriptorRecord } from '@vibesdotdev/runtime/schemas/kind';
16
- import { RuntimeDescriptorSchema } from '@vibesdotdev/runtime/schemas/descriptor';
17
- import type { RuntimeDescriptor } from '@vibesdotdev/runtime/schemas/descriptor';
18
- import { deploymentEnvRequirementSchema } from '../schemas.ts';
19
- import { INFRA_DISCOVERY_PATTERN, extractStem } from './discovery.ts';
20
-
21
- export const WorkerScalingSchema = z.object({
22
- min: z.number().int().nonnegative().default(1),
23
- max: z.number().int().positive().default(1),
24
- cpu: z.string().optional(),
25
- memory: z.string().optional()
26
- });
27
- export type WorkerScaling = z.infer<typeof WorkerScalingSchema>;
28
-
29
- const WorkerBaseSchema = RuntimeDescriptorSchema.extend({
30
- kind: z.literal('infra/worker'),
31
-
32
- /** Path to worker entrypoint (e.g., 'packages/workers/src/ai/entrypoint.ts'). */
33
- entrypoint: z.string().min(1).optional(),
34
-
35
- /** Queue names this worker consumes from. */
36
- queues: z.array(z.string().min(1)).optional(),
37
-
38
- /** Worker concurrency. */
39
- concurrency: z.number().int().positive().optional(),
40
-
41
- /** Scaling configuration. */
42
- scaling: WorkerScalingSchema.optional(),
43
-
44
- /** Environment variable requirements. */
45
- env: z.array(deploymentEnvRequirementSchema).optional()
46
- });
47
-
48
- export const DoksDeploymentWorkerConfigSchema = z.object({
49
- /** Kubernetes namespace (default: vibes). */
50
- namespace: z.string().min(1).default('vibes'),
51
- /** Container image (default: vibes/{id}:latest). */
52
- image: z.string().min(1).optional(),
53
- /** Health probe port (default: 8080). */
54
- healthPort: z.number().int().positive().default(8080),
55
- /** Health probe path (default: /healthz). */
56
- healthPath: z.string().min(1).default('/healthz'),
57
- /** Readiness probe path (default: /readyz). */
58
- readyPath: z.string().min(1).default('/readyz')
59
- });
60
-
61
- export const CloudflareWorkersWorkerConfigSchema = z.object({
62
- /** Cloudflare Workers script name (e.g., "vibes-jobs"). */
63
- cfWorkerName: z.string().min(1),
64
- /** Path to the `_worker.js` entry point relative to outputDir. */
65
- workerEntry: z.string().min(1).default('_worker.js'),
66
- /** Compatibility date for wrangler. */
67
- compatibilityDate: z.string().regex(/^\d{4}-\d{2}-\d{2}$/).optional(),
68
- /** Compatibility flags for wrangler. */
69
- compatibilityFlags: z.array(z.string()).default(['nodejs_compat']),
70
- /** Environment variables to include. */
71
- env: z.record(z.string(), z.string()).default({}),
72
- /** Cloudflare Secrets Store ID for secret bindings. */
73
- secretsStoreId: z.string().min(1).optional(),
74
- /**
75
- * Detailed queue-consumer config. When present, these override the
76
- * coarse `queues: string[]` field on the base descriptor and let
77
- * declarations control batch size, retries, and dead-letter routing.
78
- */
79
- consumers: z
80
- .array(
81
- z.object({
82
- queue: z.string().min(1),
83
- maxBatchSize: z.number().int().positive().default(10),
84
- maxRetries: z.number().int().min(0).default(3),
85
- deadLetterQueue: z.string().optional()
86
- })
87
- )
88
- .default([]),
89
- /** Durable Object class bindings. */
90
- durableObjects: z
91
- .array(
92
- z.object({
93
- binding: z.string().regex(/^[_A-Z0-9]+$/),
94
- className: z.string().min(1),
95
- scriptName: z.string().min(1).optional()
96
- })
97
- )
98
- .default([]),
99
- /** Durable Object migrations. */
100
- migrations: z
101
- .array(
102
- z.object({
103
- tag: z.string().min(1),
104
- newClasses: z.array(z.string().min(1)).optional(),
105
- renamedClasses: z
106
- .array(z.object({ from: z.string().min(1), to: z.string().min(1) }))
107
- .optional(),
108
- deletedClasses: z.array(z.string().min(1)).optional(),
109
- newSqliteClasses: z.array(z.string().min(1)).optional()
110
- })
111
- )
112
- .default([]),
113
- /** Service bindings — call other Workers from this Worker. */
114
- services: z
115
- .array(
116
- z.object({
117
- binding: z.string().regex(/^[_A-Z0-9]+$/),
118
- service: z.string().min(1),
119
- environment: z.string().min(1).optional()
120
- })
121
- )
122
- .default([]),
123
- /** D1 database bindings. */
124
- d1Databases: z
125
- .array(
126
- z.object({
127
- binding: z.string().regex(/^[_A-Z0-9]+$/),
128
- databaseName: z.string().min(1),
129
- databaseId: z.string().min(1)
130
- })
131
- )
132
- .default([]),
133
- /** KV namespace bindings. */
134
- kvNamespaces: z
135
- .array(
136
- z.object({
137
- binding: z.string().min(1),
138
- id: z.string().min(1)
139
- })
140
- )
141
- .default([]),
142
- /** R2 bucket bindings. */
143
- r2Buckets: z
144
- .array(
145
- z.object({
146
- binding: z.string().min(1),
147
- bucketName: z.string().min(1)
148
- })
149
- )
150
- .default([]),
151
- /** Queue producer bindings (worker can also produce to queues). */
152
- queueProducers: z
153
- .array(
154
- z.object({
155
- queue: z.string().min(1),
156
- binding: z.string().min(1)
157
- })
158
- )
159
- .default([]),
160
- /** Enable smart placement. */
161
- smartPlacement: z.boolean().default(false),
162
- /**
163
- * Whether this is a job-consumer Worker. When true, deploy step
164
- * auto-injects the JOB_RESULT_STORE Durable Object binding +
165
- * initial migration via `generateJobConsumerWorkerConfig` from
166
- * `@vibesdotdev/infra-cloudflare`.
167
- */
168
- jobConsumer: z.boolean().default(false)
169
- });
170
-
171
- export const WorkerConfigSchema = z.union([
172
- DoksDeploymentWorkerConfigSchema.extend({ adapter: z.literal('doks-deployment') }),
173
- CloudflareWorkersWorkerConfigSchema.extend({ adapter: z.literal('cloudflare-workers') })
174
- ]);
175
-
176
- export const WorkerDescriptorSchema = WorkerBaseSchema.extend({
177
- /**
178
- * Adapter-specific configuration. Discriminated union — each adapter
179
- * package defines its own config schema under its discriminator key.
180
- */
181
- config: WorkerConfigSchema.optional()
182
- });
183
-
184
- export type WorkerDescriptor = z.infer<typeof WorkerDescriptorSchema>;
185
-
186
- class DefaultWorkerImplementation {
187
- constructor(
188
- public readonly descriptor: RuntimeDescriptor,
189
- public readonly context: unknown
190
- ) {}
191
-
192
- get config(): WorkerDescriptor {
193
- return this.descriptor as WorkerDescriptor;
194
- }
195
- }
196
-
197
- export const workerKind = createRuntimeKind<WorkerDescriptor, DefaultWorkerImplementation>({
198
- id: 'infra/worker',
199
- descriptorSchema: WorkerDescriptorSchema,
200
- defaultImplementation: DefaultWorkerImplementation,
201
- discoveryPattern: INFRA_DISCOVERY_PATTERN,
202
- extractStem
203
- });