@voltro/cli 0.33.0 → 0.35.0

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 (343) hide show
  1. package/CHANGELOG.md +1968 -0
  2. package/bin/nodeEnvironment.d.mts +30 -0
  3. package/bin/nodeEnvironment.mjs +158 -0
  4. package/bin/voltro.mjs +69 -5
  5. package/dist/addCommand-BNeoeSxe.js +124 -0
  6. package/dist/addCommand-aXSQveak.js +2 -0
  7. package/dist/agentsMd-BTchIZku.js +2 -0
  8. package/dist/agentsMd-mhQMF1bx.js +254 -0
  9. package/dist/apiBuild-B8aoJvuw.js +2 -0
  10. package/dist/{apiBuild-h9VHtnlw.js → apiBuild-DYD_ONLD.js} +46 -46
  11. package/dist/{appGraph-gQ_6GkQQ.js → appGraph-KGDPTuTy.js} +1 -1
  12. package/dist/appGraph-zuMGKVYX.js +2 -0
  13. package/dist/appPort-B_HpJ_ck.js +48 -0
  14. package/dist/baselineCommand-C2ClWZN3.js +2 -0
  15. package/dist/baselineCommand-DIttzO8A.js +227 -0
  16. package/dist/bin.js +71 -28
  17. package/dist/build-CD8K4XOr.js +711 -0
  18. package/dist/cacheCommand-DA4OH9xt.js +42 -0
  19. package/dist/capabilitiesCommand-nq_pz5xd.js +123 -0
  20. package/dist/checkCommand-Ct9xkTrS.js +232 -0
  21. package/dist/checkCommand-DKpDLlqu.js +2 -0
  22. package/dist/{cliArgs-qdZSElM3.js → cliArgs-D4p8n7EE.js} +12 -1
  23. package/dist/cliError-BmdYnghb.js +10 -0
  24. package/dist/cliOutput-D1tSBoRM.js +15 -0
  25. package/dist/{cliRuntime-Oh517vCV.js → cliRuntime-Dh7UDinH.js} +20 -20
  26. package/dist/cloudClient-DWL-Hw_T.js +67 -0
  27. package/dist/cloudCmd-Cvv5HGaZ.js +364 -0
  28. package/dist/clusterCmd-D5wsCmA_.js +54 -0
  29. package/dist/codegen-CYM3Zqrf.js +605 -0
  30. package/dist/codegen-ChBi_hVa.js +2 -0
  31. package/dist/codegenCommand-C4YoQIc2.js +30 -0
  32. package/dist/codemodRunner-BnFq3Fgu.js +5384 -0
  33. package/dist/commandRunner-BLAEFLjp.js +47 -0
  34. package/dist/commands-BE8E7zF3.js +816 -0
  35. package/dist/connectionConfig-UFlIEiys.js +66 -0
  36. package/dist/dashboardCommand-D7SgZGaN.js +25 -0
  37. package/dist/dataCommand-BhYwDgg-.js +537 -0
  38. package/dist/dataProfile-dW-PsfLB.js +15 -0
  39. package/dist/dbCommand-DS4b97Is.js +2 -0
  40. package/dist/{dbCommand-DTLKAfbA.js → dbCommand-O8HA63s2.js} +552 -402
  41. package/dist/{dev-C_P8FLSx.js → dev-C7sFZq3m.js} +3670 -3169
  42. package/dist/dev-D2BikO7a.js +3 -0
  43. package/dist/devActivity-Dx_3nnGv.js +100 -0
  44. package/dist/devActivity.js +1 -1
  45. package/dist/dialectDriver-CgXnDfec.js +39 -0
  46. package/dist/discover-C9XKJDco.js +25 -0
  47. package/dist/doctorCommand-CM4Ch9C7.js +2 -0
  48. package/dist/{checkCommand-xGhRFFg2.js → doctorCommand-DnimF5IM.js} +523 -1278
  49. package/dist/dormancyCommand-QewYug_s.js +69 -0
  50. package/dist/e2eCmd-BRabZww-.js +147 -0
  51. package/dist/embeddingsCommand-BfiLS_QI.js +73 -0
  52. package/dist/envCommand-CCGPRQY1.js +60 -0
  53. package/dist/evalCommand-6RUfPen4.js +118 -0
  54. package/dist/evolveCommand-CHsLCtDf.js +281 -0
  55. package/dist/fileTaxonomy-CJfgOllU.js +457 -0
  56. package/dist/frameworkTableAssembly-YyVe32Cb.js +2 -0
  57. package/dist/frameworkTableAssembly-oMPBKqlE.js +511 -0
  58. package/dist/generateCommand-DbgcUpGw.js +147 -0
  59. package/dist/index.d.ts +45 -0
  60. package/dist/index.js +4 -3
  61. package/dist/infoCommand-DwOgK1t6.js +60 -0
  62. package/dist/{inspect-BUUjt773.js → inspect-CjTYzAs_.js} +113 -41
  63. package/dist/inspect-P4pxoMaV.js +2 -0
  64. package/dist/inspectCmd-EHFZ9yYu.js +224 -0
  65. package/dist/inspectFetch-EMuhTG_9.js +151 -0
  66. package/dist/inspectMetrics-CfdKLh6t.js +72 -0
  67. package/dist/loadEnv-D9nEOClM.js +44 -0
  68. package/dist/logFileSink-C_D2wRN1.js +105 -0
  69. package/dist/logsCmd-D36xK7Zu.js +260 -0
  70. package/dist/manifestBuild-COkJoyAr.js +2 -0
  71. package/dist/{manifestBuild-BLrVuSlM.js → manifestBuild-hpPLaGxV.js} +1 -1
  72. package/dist/metaCommands-7MJfZ5cf.js +196 -0
  73. package/dist/migrate-BV7I-ZHZ.js +83 -0
  74. package/dist/mssqlClusterPatch-_4cE_nun.js +44 -0
  75. package/dist/newCommand-COWOJ1_E.js +156 -0
  76. package/dist/nodeEnvironment-cGFAj1J8.js +28 -0
  77. package/dist/packageCommand-Cug_3Ogl.js +271 -0
  78. package/dist/pageConvention-cEiRxdab.js +5 -0
  79. package/dist/privacyCommand-C-Df56U_.js +146 -0
  80. package/dist/probeCommand-CZfaaUOZ.js +122 -0
  81. package/dist/projectScaffold-DmzEKHib.js +2 -0
  82. package/dist/projectScaffold-LMMtaavR.js +814 -0
  83. package/dist/renderModeScan-D7J1B7Kw.js +105 -0
  84. package/dist/renderProfile-1OWWAAtx.js +81 -0
  85. package/dist/runtimeRegistry-DMeKfTHP.js +81 -0
  86. package/dist/runtimeTrace-CH3eUiMw.js +91 -0
  87. package/dist/scheduleCmd-DQRu6BZC.js +149 -0
  88. package/dist/scheduleManifestCmd-D2x0CTTY.js +249 -0
  89. package/dist/schemaIr-UJybUUZW.js +103 -0
  90. package/dist/{sdkgen-C81QIkiL.js → sdkgen-BLkvGRfX.js} +111 -209
  91. package/dist/seedRunner-ZmLSqNe2.js +333 -0
  92. package/dist/serveCommand-CbDHU6l-.js +2 -0
  93. package/dist/serveCommand-iwlUBNS1.js +1766 -0
  94. package/dist/serveEntry.js +5 -5
  95. package/dist/serverlessCommand-CfJZy6dS.js +482 -0
  96. package/dist/start-BgN62boB.js +3 -0
  97. package/dist/start-T4VesWiM.js +1087 -0
  98. package/dist/startEntry.js +2 -2
  99. package/dist/staticCommand-Dr2M6tpU.js +304 -0
  100. package/dist/storageCommand-Co6NfLqN.js +42 -0
  101. package/dist/templates-De8IR5-c.js +102 -0
  102. package/dist/test-CI6iDsYc.js +115 -0
  103. package/dist/tracesCmd-DStmCJPi.js +232 -0
  104. package/dist/tsconfigPaths-BWXBWgcl.js +107 -0
  105. package/dist/tsxLoader-EuXmSJ1K.js +51 -0
  106. package/dist/typecheckCommand-BlsWiCNq.js +61 -0
  107. package/dist/updateCommand-BlMZhWgO.js +2 -0
  108. package/dist/updateCommand-x0pI_x-B.js +585 -0
  109. package/dist/webDev-BcykISYQ2.js +2 -0
  110. package/dist/{inspectMetrics-1xzTKAFx.js → webDev-Dybxew86.js} +988 -1560
  111. package/dist/webhookDiscovery-CrGAfhIG.js +2 -0
  112. package/dist/webhookDiscovery-D7VaeMlz.js +51 -0
  113. package/dist/webhooksCommand-DlAgS2Iw.js +267 -0
  114. package/dist/workflowsCmd-BGF-mRZ5.js +608 -0
  115. package/package.json +209 -17
  116. package/templates/AGENTS.core.md +58 -3
  117. package/templates/AGENTS.md +64 -7
  118. package/templates/agent-docs/_index.md +6 -4
  119. package/templates/agent-docs/_manifest.json +23 -6
  120. package/templates/agent-docs/ai.md +370 -0
  121. package/templates/agent-docs/authentication.md +313 -31
  122. package/templates/agent-docs/caching.md +6 -0
  123. package/templates/agent-docs/cli.md +853 -50
  124. package/templates/agent-docs/data.md +608 -12
  125. package/templates/agent-docs/database/migrations.md +223 -25
  126. package/templates/agent-docs/database/misc.md +156 -40
  127. package/templates/agent-docs/database/querying.md +19 -1
  128. package/templates/agent-docs/database/scaling.md +60 -0
  129. package/templates/agent-docs/database/schema.md +1 -0
  130. package/templates/agent-docs/database/seedsdialects.md +208 -19
  131. package/templates/agent-docs/database/transactions.md +68 -0
  132. package/templates/agent-docs/deployment.md +284 -25
  133. package/templates/agent-docs/introduction.md +88 -17
  134. package/templates/agent-docs/local-first-mobile.md +79 -4
  135. package/templates/agent-docs/multi-tenancy.md +188 -42
  136. package/templates/agent-docs/observability.md +58 -3
  137. package/templates/agent-docs/plugins/ai-flows.md +247 -2
  138. package/templates/agent-docs/plugins/analytics-postgres.md +1 -1
  139. package/templates/agent-docs/plugins/audit.md +37 -1
  140. package/templates/agent-docs/plugins/auth-social.md +143 -0
  141. package/templates/agent-docs/plugins/auth-workos.md +4 -2
  142. package/templates/agent-docs/plugins/auth.md +131 -6
  143. package/templates/agent-docs/plugins/billing.md +132 -15
  144. package/templates/agent-docs/plugins/cdc-out.md +46 -7
  145. package/templates/agent-docs/plugins/clickhouse.md +32 -1
  146. package/templates/agent-docs/plugins/duckdb.md +1 -1
  147. package/templates/agent-docs/plugins/flags.md +132 -0
  148. package/templates/agent-docs/plugins/governance.md +105 -7
  149. package/templates/agent-docs/plugins/multitenancy.md +9 -4
  150. package/templates/agent-docs/plugins/presence.md +13 -2
  151. package/templates/agent-docs/plugins/ratelimit.md +9 -0
  152. package/templates/agent-docs/plugins/search.md +162 -8
  153. package/templates/agent-docs/plugins/sso-saml.md +47 -8
  154. package/templates/agent-docs/plugins/storage.md +11 -0
  155. package/templates/agent-docs/plugins/webhooks.md +105 -0
  156. package/templates/agent-docs/plugins.md +152 -18
  157. package/templates/agent-docs/reference.md +60 -3
  158. package/templates/agent-docs/releases.md +1117 -0
  159. package/templates/agent-docs/routing.md +43 -25
  160. package/templates/agent-docs/scheduling.md +27 -0
  161. package/templates/agent-docs/schema-driven-ui.md +92 -12
  162. package/templates/agent-docs/security.md +426 -0
  163. package/templates/agent-docs/templates/apibackends.md +87 -18
  164. package/templates/agent-docs/templates/appshells.md +32 -14
  165. package/templates/agent-docs/templates/overview.md +13 -8
  166. package/templates/agent-docs/testing.md +211 -14
  167. package/templates/agent-docs/whats-new.md +98 -136
  168. package/templates/agent-docs/workflows.md +231 -14
  169. package/templates/apps/api-ai/actions/summarize.action.ts +11 -0
  170. package/templates/apps/api-ai/package.json +8 -7
  171. package/templates/apps/api-auth/actions/me.action.ts +13 -0
  172. package/templates/apps/api-auth/package.json +9 -8
  173. package/templates/apps/api-backend/mutations/notes.create.mutation.ts +9 -0
  174. package/templates/apps/api-backend/package.json +12 -8
  175. package/templates/apps/api-backend/queries/notes.query.ts +30 -8
  176. package/templates/apps/api-backend-deactivation/actions/users.get.action.ts +14 -0
  177. package/templates/apps/api-backend-deactivation/mutations/users.create.mutation.ts +8 -0
  178. package/templates/apps/api-backend-deactivation/mutations/users.deactivate.mutation.ts +10 -0
  179. package/templates/apps/api-backend-deactivation/package.json +8 -7
  180. package/templates/apps/api-backend-mail/actions/sendWelcome.action.ts +17 -0
  181. package/templates/apps/api-backend-mail/mutations/notes.create.mutation.ts +9 -0
  182. package/templates/apps/api-backend-mail/package.json +9 -8
  183. package/templates/apps/api-backend-mail/queries/notes.query.ts +30 -8
  184. package/templates/apps/api-backend-mariadb/.env.example +14 -0
  185. package/templates/apps/api-backend-mariadb/mutations/notes.create.mutation.ts +9 -0
  186. package/templates/apps/api-backend-mariadb/package.json +10 -9
  187. package/templates/apps/api-backend-mariadb/queries/notes.query.ts +30 -8
  188. package/templates/apps/api-backend-sqlite/.env.example +14 -0
  189. package/templates/apps/api-backend-sqlite/mutations/notes.create.mutation.ts +9 -0
  190. package/templates/apps/api-backend-sqlite/package.json +9 -8
  191. package/templates/apps/api-backend-sqlite/queries/notes.query.ts +30 -8
  192. package/templates/apps/api-backend-storage/actions/uploadAvatar.action.ts +13 -0
  193. package/templates/apps/api-backend-storage/actions/uploadDocument.action.ts +12 -0
  194. package/templates/apps/api-backend-storage/mutations/notes.create.mutation.ts +9 -0
  195. package/templates/apps/api-backend-storage/package.json +9 -8
  196. package/templates/apps/api-backend-storage/queries/notes.query.ts +30 -8
  197. package/templates/apps/api-cms/actions/content.get.action.ts +7 -0
  198. package/templates/apps/api-cms/actions/content.types.action.ts +6 -0
  199. package/templates/apps/api-cms/actions/me.action.ts +13 -0
  200. package/templates/apps/api-cms/app.config.ts +19 -0
  201. package/templates/apps/api-cms/authz.ts +63 -0
  202. package/templates/apps/api-cms/mutations/content.publish.mutation.ts +10 -0
  203. package/templates/apps/api-cms/mutations/content.saveDraft.mutation.ts +10 -0
  204. package/templates/apps/api-cms/mutations/content.unpublish.mutation.ts +5 -0
  205. package/templates/apps/api-cms/package.json +11 -10
  206. package/templates/apps/api-cms/queries/content.list.query.ts +23 -7
  207. package/templates/apps/api-cms/tests/accessDecisions.test.ts +121 -0
  208. package/templates/apps/api-cms/tests/content.descriptors.test.ts +8 -4
  209. package/templates/apps/api-collab/mutations/documents.create.mutation.ts +8 -0
  210. package/templates/apps/api-collab/mutations/documents.setBody.mutation.ts +13 -0
  211. package/templates/apps/api-collab/package.json +9 -8
  212. package/templates/apps/api-collab/queries/documents.query.ts +19 -7
  213. package/templates/apps/api-data-advanced/package.json +9 -8
  214. package/templates/apps/api-data-advanced/queries/authors.withBooks.query.ts +12 -0
  215. package/templates/apps/api-data-advanced/queries/books.search.query.ts +9 -0
  216. package/templates/apps/api-durable/mutations/orders.approve.mutation.ts +17 -0
  217. package/templates/apps/api-durable/mutations/orders.place.mutation.ts +9 -0
  218. package/templates/apps/api-durable/package.json +9 -8
  219. package/templates/apps/api-feature-flags/actions/notes.export.action.ts +16 -0
  220. package/templates/apps/api-feature-flags/mutations/notes.create.mutation.ts +12 -0
  221. package/templates/apps/api-feature-flags/package.json +10 -9
  222. package/templates/apps/api-governance/README.md +30 -8
  223. package/templates/apps/api-governance/actions/profiles.get.action.server.ts +17 -1
  224. package/templates/apps/api-governance/actions/profiles.get.action.ts +29 -4
  225. package/templates/apps/api-governance/database/schema.ts +16 -4
  226. package/templates/apps/api-governance/mutations/profiles.create.mutation.ts +12 -0
  227. package/templates/apps/api-governance/package.json +9 -8
  228. package/templates/apps/api-kv/actions/sync.pull.action.ts +15 -0
  229. package/templates/apps/api-kv/actions/sync.reset.action.ts +13 -0
  230. package/templates/apps/api-kv/actions/sync.status.action.ts +7 -0
  231. package/templates/apps/api-kv/package.json +9 -8
  232. package/templates/apps/api-kv/queries/events.list.query.ts +19 -8
  233. package/templates/apps/api-moderation/mutations/comments.create.mutation.ts +11 -0
  234. package/templates/apps/api-moderation/mutations/posts.create.mutation.ts +13 -0
  235. package/templates/apps/api-moderation/package.json +9 -8
  236. package/templates/apps/api-observability/mutations/notes.create.mutation.ts +8 -0
  237. package/templates/apps/api-observability/package.json +9 -8
  238. package/templates/apps/api-observability/queries/notes.list.query.ts +13 -0
  239. package/templates/apps/api-ratelimit/mutations/notes.create.mutation.ts +14 -0
  240. package/templates/apps/api-ratelimit/package.json +9 -8
  241. package/templates/apps/api-rbac/package.json +9 -8
  242. package/templates/apps/api-rest/package.json +8 -7
  243. package/templates/apps/api-saas/mutations/projects.create.mutation.ts +13 -0
  244. package/templates/apps/api-saas/package.json +12 -11
  245. package/templates/apps/api-saas/queries/projects.list.query.ts +11 -0
  246. package/templates/apps/api-saas-starter/actions/me.action.ts +13 -0
  247. package/templates/apps/api-saas-starter/app.config.ts +19 -0
  248. package/templates/apps/api-saas-starter/authz.ts +75 -0
  249. package/templates/apps/api-saas-starter/mutations/invites.create.mutation.ts +10 -0
  250. package/templates/apps/api-saas-starter/mutations/projects.create.mutation.ts +9 -0
  251. package/templates/apps/api-saas-starter/package.json +15 -11
  252. package/templates/apps/api-saas-starter/queries/invites.list.query.ts +19 -8
  253. package/templates/apps/api-saas-starter/queries/projects.list.query.ts +18 -7
  254. package/templates/apps/api-saas-starter/tests/accessDecisions.test.ts +135 -0
  255. package/templates/apps/api-search/mutations/articles.create.mutation.ts +14 -0
  256. package/templates/apps/api-search/package.json +9 -8
  257. package/templates/apps/api-search/queries/articles.list.query.ts +21 -8
  258. package/templates/apps/api-status/README.md +10 -3
  259. package/templates/apps/api-status/app.config.ts +8 -3
  260. package/templates/apps/api-status/authz.ts +5 -3
  261. package/templates/apps/api-status/package.json +9 -8
  262. package/templates/apps/api-status/queries/components.list.query.ts +14 -6
  263. package/templates/apps/api-status/queries/incidents.live.query.ts +23 -10
  264. package/templates/apps/api-status/queries/updates.list.query.ts +16 -9
  265. package/templates/apps/api-status/tests/status.test.ts +9 -1
  266. package/templates/apps/api-versioning/actions/documents.asOf.action.ts +12 -0
  267. package/templates/apps/api-versioning/actions/documents.history.action.ts +13 -0
  268. package/templates/apps/api-versioning/mutations/documents.create.mutation.ts +9 -0
  269. package/templates/apps/api-versioning/mutations/documents.update.mutation.ts +12 -0
  270. package/templates/apps/api-versioning/package.json +9 -8
  271. package/templates/apps/api-webhooks/mutations/orders.fulfill.mutation.ts +16 -0
  272. package/templates/apps/api-webhooks/package.json +10 -9
  273. package/templates/apps/api-webhooks/queries/orders.list.query.ts +10 -0
  274. package/templates/apps/changelog/package.json +8 -6
  275. package/templates/apps/edge-functions/package.json +2 -2
  276. package/templates/apps/frontend-admin/package.json +10 -8
  277. package/templates/apps/frontend-admin/src/lib/admin.ts +20 -9
  278. package/templates/apps/frontend-admin/src/locales/de.ts +11 -1
  279. package/templates/apps/frontend-admin/src/locales/en.ts +13 -1
  280. package/templates/apps/frontend-admin/src/pages/admin/[entity]/page.tsx +65 -22
  281. package/templates/apps/frontend-admin/src/pages/admin/entity.test.tsx +130 -23
  282. package/templates/apps/frontend-admin/src/pages/admin/layout.tsx +3 -2
  283. package/templates/apps/frontend-admin/src/pages/admin/page.test.tsx +19 -2
  284. package/templates/apps/frontend-admin/src/pages/admin/page.tsx +9 -4
  285. package/templates/apps/frontend-app/app.config.ts +4 -3
  286. package/templates/apps/frontend-app/package.json +11 -8
  287. package/templates/apps/frontend-app/src/lib/api.ts +25 -0
  288. package/templates/apps/frontend-app/src/pages/page.test.tsx +130 -82
  289. package/templates/apps/frontend-app/src/pages/page.tsx +14 -18
  290. package/templates/apps/frontend-auth/package.json +10 -8
  291. package/templates/apps/frontend-blank/package.json +9 -7
  292. package/templates/apps/frontend-cms/package.json +11 -9
  293. package/templates/apps/frontend-collab/package.json +12 -9
  294. package/templates/apps/frontend-collab/src/pages/page.test.tsx +122 -78
  295. package/templates/apps/frontend-contact/package.json +9 -7
  296. package/templates/apps/frontend-dashboard/package.json +9 -7
  297. package/templates/apps/frontend-docs/package.json +9 -7
  298. package/templates/apps/frontend-i18n/package.json +8 -6
  299. package/templates/apps/frontend-landing/package.json +9 -7
  300. package/templates/apps/frontend-portal/package.json +10 -8
  301. package/templates/apps/frontend-saas/app.config.ts +10 -6
  302. package/templates/apps/frontend-saas/package.json +10 -8
  303. package/templates/apps/frontend-saas/src/lib/api.ts +27 -32
  304. package/templates/apps/frontend-saas/src/pages/dashboard/billing/page.tsx +7 -8
  305. package/templates/apps/frontend-saas/src/pages/dashboard/page.test.tsx +27 -3
  306. package/templates/apps/frontend-saas/src/pages/dashboard/page.tsx +4 -4
  307. package/templates/apps/frontend-saas/src/pages/dashboard/team/page.tsx +3 -4
  308. package/templates/apps/frontend-spa/package.json +9 -7
  309. package/templates/apps/frontend-ssr/package.json +9 -7
  310. package/templates/apps/frontend-ssr-api/package.json +10 -8
  311. package/templates/apps/frontend-static-blog/package.json +8 -6
  312. package/templates/apps/frontend-status/package.json +10 -8
  313. package/templates/apps/mobile-app/README.md +1 -0
  314. package/templates/apps/mobile-app/package.json +4 -2
  315. package/templates/apps/mobile-app/src/app/index.tsx +22 -12
  316. package/templates/apps/mobile-app/src/app/orders/[id].tsx +1 -1
  317. package/templates/apps/mobile-app/src/lib/api.ts +34 -0
  318. package/templates/apps/mobile-app/voltro.mobile.ts +4 -2
  319. package/templates/baselines/bare/.env.example +14 -0
  320. package/templates/baselines/bare/baseline.json +4 -4
  321. package/templates/baselines/compose/.env.example +14 -0
  322. package/templates/baselines/compose/README.md +1 -1
  323. package/templates/baselines/compose/baseline.json +5 -5
  324. package/templates/baselines/compose-mariadb/.env.example +14 -0
  325. package/templates/baselines/compose-mariadb/README.md +1 -1
  326. package/templates/baselines/compose-mariadb/baseline.json +5 -5
  327. package/templates/baselines/helm/.env.example +14 -0
  328. package/templates/baselines/helm/baseline.json +4 -4
  329. package/dist/apiBuild-C-x9YacA.js +0 -2
  330. package/dist/appGraph-CvQCte0z.js +0 -2
  331. package/dist/checkCommand-DRovTKza.js +0 -2
  332. package/dist/commands-CJfepbm4.js +0 -11541
  333. package/dist/dbCommand-b1gum4td.js +0 -2
  334. package/dist/dev-iiMtlkfs.js +0 -3
  335. package/dist/devActivity-BhIu6ncs.js +0 -159
  336. package/dist/frameworkTableAssembly-BwIrO5nv.js +0 -638
  337. package/dist/frameworkTableAssembly-D-EebUQX.js +0 -2
  338. package/dist/inspect-mmBuRXmy.js +0 -2
  339. package/dist/manifestBuild-Dj8Jjoto.js +0 -2
  340. package/dist/seedRunner-Bqxgp7HZ.js +0 -230
  341. package/dist/serveCommand-DdaM4Hup.js +0 -1608
  342. package/dist/start-C0koT0UO.js +0 -1084
  343. /package/templates/apps/api-ai/actions/{summarize.action.server.tsx → summarize.action.server.ts} +0 -0
@@ -0,0 +1,511 @@
1
+ import { n as e } from "./appModuleLoader-C9r9mxZt.js";
2
+ import { D as t, a as n, j as r, k as i, x as a } from "./fileConventions-Cof68_BL.js";
3
+ import { basename as o, join as s } from "node:path";
4
+ import { existsSync as c, promises as l } from "node:fs";
5
+ import { pathToFileURL as u } from "node:url";
6
+ import { defineAction as d, defineMutation as f, defineQuery as ee } from "@voltro/protocol";
7
+ import { Effect as p } from "effect";
8
+ import { SqlClient as m } from "@effect/sql";
9
+ import { _voltroBudgetHoldsTable as te, _voltroWorkflowAdmissionsTable as ne, _voltroWorkflowPausesTable as re, _voltroWorkflowPendingTable as ie, _voltroWorkflowRunEventsTable as ae, _voltroWorkflowRunStepsTable as oe, _voltroWorkflowRunsTable as se, _voltroWorkflowStartContextsTable as ce, _voltroWorkflowWatermarksTable as le } from "@voltro/workflow";
10
+ import { agentMessagesTable as ue, agentThreadsTable as de, aiBudgetTable as fe, aiInferencesTable as pe, aiUsageTable as me, isAgentDescriptor as he, isAgentExecutor as ge, promptsTable as h, resolveToolModuleHandlers as g } from "@voltro/ai";
11
+ import { _voltroApiKeysTable as _, _voltroCdcOffsetsTable as v, _voltroIdempotencyTable as y, _voltroKvTable as b, _voltroMigrationPlansTable as x, _voltroMigrationsTable as S, _voltroMssqlCdcOffsetsTable as C, _voltroSeedsTable as w } from "@voltro/database";
12
+ import { _voltroApprovalsTable as T, _voltroConnectionGrantsTable as E, _voltroConnectionsTable as D, _voltroScheduleClaimsTable as O, _voltroScheduleRunsTable as k, _voltroTracesTable as A, _voltroUndoLogTable as j, _voltroWakeupsTable as M, _voltroWorkflowEventDeliveriesTable as N, _voltroWorkflowEventsTable as P, outboxAttemptsTable as F, outboxTable as I } from "@voltro/runtime";
13
+ import { _voltroWebhookDeliveriesTable as L, _voltroWebhookTargetsTable as _e } from "@voltro/plugin-webhooks/mixin";
14
+ import { _voltroStorageBlobsTable as ve, _voltroStorageGrantsTable as ye, _voltroStorageRefsTable as be, _voltroStorageUsageTable as xe } from "@voltro/plugin-storage";
15
+ //#region src/frameworkTables.ts
16
+ var Se = [
17
+ {
18
+ table: S,
19
+ when: "always"
20
+ },
21
+ {
22
+ table: w,
23
+ when: "always"
24
+ },
25
+ {
26
+ table: x,
27
+ when: "always"
28
+ },
29
+ {
30
+ table: se,
31
+ when: "workflows"
32
+ },
33
+ {
34
+ table: oe,
35
+ when: "workflows"
36
+ },
37
+ {
38
+ table: ae,
39
+ when: "workflows"
40
+ },
41
+ {
42
+ table: ce,
43
+ when: "workflows"
44
+ },
45
+ {
46
+ table: ie,
47
+ when: "workflows"
48
+ },
49
+ {
50
+ table: ne,
51
+ when: "workflows"
52
+ },
53
+ {
54
+ table: re,
55
+ when: "workflows"
56
+ },
57
+ {
58
+ table: le,
59
+ when: "workflows"
60
+ },
61
+ {
62
+ table: P,
63
+ when: "workflows"
64
+ },
65
+ {
66
+ table: N,
67
+ when: "workflows"
68
+ },
69
+ {
70
+ table: k,
71
+ when: "schedules"
72
+ },
73
+ {
74
+ table: O,
75
+ when: "schedules"
76
+ },
77
+ {
78
+ table: _e,
79
+ when: "webhooks"
80
+ },
81
+ {
82
+ table: L,
83
+ when: "webhooks"
84
+ },
85
+ {
86
+ table: A,
87
+ when: "traces"
88
+ },
89
+ {
90
+ table: j,
91
+ when: "undo"
92
+ },
93
+ {
94
+ table: T,
95
+ when: "always"
96
+ },
97
+ {
98
+ table: te,
99
+ when: "workflows"
100
+ },
101
+ {
102
+ table: I,
103
+ when: "always"
104
+ },
105
+ {
106
+ table: F,
107
+ when: "always"
108
+ },
109
+ {
110
+ table: D,
111
+ when: "connections"
112
+ },
113
+ {
114
+ table: E,
115
+ when: "connections"
116
+ },
117
+ {
118
+ table: M,
119
+ when: "always"
120
+ },
121
+ {
122
+ table: be,
123
+ when: "always"
124
+ },
125
+ {
126
+ table: ye,
127
+ when: "always"
128
+ },
129
+ {
130
+ table: ve,
131
+ when: "always"
132
+ },
133
+ {
134
+ table: xe,
135
+ when: "always"
136
+ },
137
+ {
138
+ table: y,
139
+ when: "always"
140
+ },
141
+ {
142
+ table: _,
143
+ when: "always"
144
+ },
145
+ {
146
+ table: b,
147
+ when: "always"
148
+ }
149
+ ], Ce = (e) => {
150
+ let t = Se.filter((t) => t.when === "always" || t.when === "workflows" && e.workflows || t.when === "schedules" && e.schedules || t.when === "webhooks" && e.webhooks || t.when === "traces" && e.traces || t.when === "undo" && e.undo === !0 || t.when === "connections" && e.connections === !0).map((e) => e.table);
151
+ return e.cdc === !0 && t.push(e.cdcDialect === "mssql" ? C : v), t;
152
+ }, R = (e) => {
153
+ let t = e.startsWith("@") ? e.replace(/^@[^/]+\//, "") : e;
154
+ return (t.startsWith("plugin-") ? t.slice(7) : t).replace(/-([a-zA-Z0-9])/g, (e, t) => t.toUpperCase());
155
+ }, we = (e) => {
156
+ let t = e.startsWith("@") ? e.replace(/^@[^/]+\//, "") : e;
157
+ return (t.startsWith("plugin-") ? t.slice(7) : t).replace(/#/g, "--").replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
158
+ }, Te = (e, t) => z(e, t.name), z = (e, t) => {
159
+ let n = R(e.name);
160
+ if (!t.includes(".")) return `${n}.${t}`;
161
+ if (e.baseName === void 0) return t;
162
+ let r = `${R(e.baseName)}.`;
163
+ return t.startsWith(r) ? `${n}.${t.slice(r.length)}` : t;
164
+ }, B = (e) => e.openAccess === void 0 ? e.guards !== void 0 && e.guards.length > 0 ? { guards: e.guards } : {} : { openAccess: e.openAccess }, Ee = (e, t, n) => {
165
+ switch (e) {
166
+ case "query": return ee({
167
+ name: t,
168
+ input: n.input,
169
+ output: n.output,
170
+ ...n.error === void 0 ? {} : { error: n.error },
171
+ ...B(n),
172
+ ...n.source === void 0 ? {} : { source: n.source }
173
+ });
174
+ case "mutation": return f({
175
+ name: t,
176
+ input: n.input,
177
+ output: n.output,
178
+ ...n.error === void 0 ? {} : { error: n.error },
179
+ ...B(n)
180
+ });
181
+ case "action": return d({
182
+ name: t,
183
+ input: n.input,
184
+ output: n.output,
185
+ ...n.error === void 0 ? {} : { error: n.error },
186
+ ...B(n)
187
+ });
188
+ }
189
+ }, De = (e) => (t, n) => p.suspend(() => {
190
+ let r = { request: {
191
+ subject: n.request.subject,
192
+ traceId: n.request.traceId
193
+ } };
194
+ return e.execute(t, r);
195
+ }), Oe = (e) => {
196
+ let t = [];
197
+ for (let n of e) {
198
+ let e = n.routes ?? [];
199
+ for (let r of e) {
200
+ let e = Te(n, r), i = Ee(r.kind, e, r);
201
+ t.push({
202
+ kind: r.kind,
203
+ file: `plugin:${n.name}`,
204
+ descriptor: i,
205
+ executor: De(r),
206
+ plugin: {
207
+ name: n.name,
208
+ version: n.version
209
+ }
210
+ });
211
+ }
212
+ }
213
+ return t;
214
+ }, ke = (e, t, n = /* @__PURE__ */ new Set()) => {
215
+ let r = /* @__PURE__ */ new Map();
216
+ for (let e of t) r.set(e, "user-route");
217
+ let i = [];
218
+ for (let t of e) {
219
+ let e = t.descriptor.name, a = r.get(e);
220
+ if (!(a === "user-route" && n.has(e))) {
221
+ if (a !== void 0) throw Error(`plugin route tag collision: "${e}" declared by plugin "${t.plugin.name}" but already claimed by ${a === "user-route" ? "a user-authored route" : `plugin "${a}"`}` + (a === "user-route" ? `.\nIf replacing it is intentional, declare \`overridesPlugin: true\` on your "${e}" — renaming yours or aliasing the plugin both split the namespace by who built it.` : ""));
222
+ r.set(e, t.plugin.name), i.push(t);
223
+ }
224
+ }
225
+ return i;
226
+ }, V = "_voltro_plugin_migrations", Ae = () => p.gen(function* () {
227
+ yield* (yield* m.SqlClient).unsafe(`
228
+ CREATE TABLE IF NOT EXISTS ${V} (
229
+ id TEXT PRIMARY KEY,
230
+ plugin_name TEXT NOT NULL,
231
+ migration_id TEXT NOT NULL,
232
+ description TEXT,
233
+ applied_at TEXT NOT NULL
234
+ );
235
+ `).pipe(p.orDie);
236
+ }), je = (e, t) => `${R(e)}__${t}`, Me = () => p.gen(function* () {
237
+ let e = yield* m.SqlClient, t = yield* e`SELECT id FROM ${e(V)}`.pipe(p.orDie);
238
+ return new Set(t.map((e) => e.id));
239
+ }), Ne = (e) => p.gen(function* () {
240
+ let t = yield* m.SqlClient, n = (/* @__PURE__ */ new Date()).toISOString();
241
+ yield* t`
242
+ INSERT INTO ${t(V)} (id, plugin_name, migration_id, description, applied_at)
243
+ VALUES (${e.key}, ${e.pluginName}, ${e.migration.id}, ${e.migration.description ?? null}, ${n})
244
+ `.pipe(p.orDie);
245
+ }), H = (e) => p.gen(function* () {
246
+ let t = e.flatMap((e) => (e.extendSchema?.migrations ?? []).map((t) => ({
247
+ plugin: e,
248
+ migration: t
249
+ })));
250
+ if (t.length === 0) return [];
251
+ yield* Ae();
252
+ let n = yield* Me(), r = [];
253
+ for (let { plugin: e, migration: i } of t) {
254
+ let t = je(e.name, i.id), a = Date.now();
255
+ if (n.has(t)) {
256
+ r.push({
257
+ pluginName: e.name,
258
+ migrationId: i.id,
259
+ status: "skipped",
260
+ durationMs: 0
261
+ });
262
+ continue;
263
+ }
264
+ let o = yield* m.SqlClient;
265
+ try {
266
+ yield* i.up(o).pipe(p.mapError((e) => e)), yield* Ne({
267
+ key: t,
268
+ pluginName: e.name,
269
+ migration: i
270
+ }), r.push({
271
+ pluginName: e.name,
272
+ migrationId: i.id,
273
+ status: "applied",
274
+ durationMs: Date.now() - a
275
+ });
276
+ } catch (t) {
277
+ return r.push({
278
+ pluginName: e.name,
279
+ migrationId: i.id,
280
+ status: "failed",
281
+ durationMs: Date.now() - a,
282
+ error: t
283
+ }), yield* p.fail(/* @__PURE__ */ Error(`Plugin migration failed: ${e.name} ${i.id} — ${t instanceof Error ? t.message : String(t)}`));
284
+ }
285
+ }
286
+ return r;
287
+ }), Pe = (e, t) => p.gen(function* () {
288
+ let n = yield* H(e);
289
+ if (n.length === 0) return n;
290
+ let r = n.filter((e) => e.status === "applied"), i = n.filter((e) => e.status === "skipped");
291
+ return t(`plugin migrations: ${r.length} applied, ${i.length} already applied`, { applied: r.map((e) => `${e.pluginName}:${e.migrationId}`) }), n;
292
+ }), Fe = (e) => e.filter((e) => e.extendSchema && (e.extendSchema.tables?.length ?? 0) + (e.extendSchema.migrations?.length ?? 0) > 0).map((e) => ({
293
+ pluginName: e.name,
294
+ pluginAlias: R(e.name),
295
+ tables: e.extendSchema.tables?.length ?? 0,
296
+ migrations: e.extendSchema.migrations?.length ?? 0
297
+ })), Ie = (e) => e.flatMap((e) => e.extendSchema?.tables ?? []), U = /(?<!\.server)\.agent\.tsx?$/, Le = /\.agent\.server\.tsx?$/, W = /\.tool\.tsx?$/, Re = async (t, n) => {
298
+ let r = 0;
299
+ for (let i of t) if (W.test(i)) try {
300
+ let t = await e(i);
301
+ r += g(t);
302
+ } catch (e) {
303
+ n.warn("tool: failed to import — handler not wired", { file: i }, e);
304
+ }
305
+ return r;
306
+ }, ze = (e) => e.replace(/\.agent\.(tsx?)$/, ".agent.server.$1"), Be = async (t, n) => {
307
+ let r = [], i = /* @__PURE__ */ new Set();
308
+ for (let a of t) {
309
+ if (!U.test(a)) continue;
310
+ let t;
311
+ try {
312
+ t = await e(a);
313
+ } catch (e) {
314
+ n.warn("agent: failed to import descriptor", { file: a }, e);
315
+ continue;
316
+ }
317
+ let o = Object.values(t).find(he);
318
+ if (o === void 0) {
319
+ n.warn("agent: no defineAgent() descriptor export found", { file: a });
320
+ continue;
321
+ }
322
+ if (i.has(o.name)) {
323
+ n.warn("agent: duplicate name — skipping", {
324
+ file: a,
325
+ name: o.name
326
+ });
327
+ continue;
328
+ }
329
+ let s = ze(a), c;
330
+ try {
331
+ c = await e(s);
332
+ } catch (e) {
333
+ n.warn("agent: no executor — expected a `*.agent.server.tsx` default-exporting defineAgentExecutor()", {
334
+ descriptor: a,
335
+ expected: s,
336
+ name: o.name
337
+ }, e);
338
+ continue;
339
+ }
340
+ let l = c.default;
341
+ if (!ge(l)) {
342
+ n.warn("agent: executor file must default-export defineAgentExecutor(descriptor, {...})", {
343
+ file: s,
344
+ name: o.name
345
+ });
346
+ continue;
347
+ }
348
+ i.add(o.name), r.push({
349
+ file: a,
350
+ serverFile: s,
351
+ descriptor: o,
352
+ executor: l
353
+ });
354
+ }
355
+ return { agents: r };
356
+ }, G = /\.connection\.tsx?$/, Ve = (e) => e.replace(G, ""), K = async (t, n) => {
357
+ let r = [], i = /* @__PURE__ */ new Map();
358
+ for (let a of t) {
359
+ let t;
360
+ try {
361
+ t = await e(a);
362
+ } catch (e) {
363
+ n.warn("connections: failed to import", { file: a }, e);
364
+ continue;
365
+ }
366
+ let o = t.default;
367
+ if (o === void 0 || typeof o != "object" || !o) {
368
+ n.warn("connections: missing or non-object default export — expected `defineConnection({...})`", { file: a });
369
+ continue;
370
+ }
371
+ let s = o;
372
+ if (typeof s.id != "string" || s.id.length === 0) {
373
+ n.warn("connections: invalid `id` field", { file: a });
374
+ continue;
375
+ }
376
+ if (s.kind !== "oauth2" && s.kind !== "pat") {
377
+ n.warn("connections: `kind` must be \"oauth2\" or \"pat\"", {
378
+ file: a,
379
+ kind: String(s.kind)
380
+ });
381
+ continue;
382
+ }
383
+ let c = i.get(s.id);
384
+ if (c !== void 0) {
385
+ n.error("connections: DUPLICATE id — only the first is registered", {
386
+ id: s.id,
387
+ registered: c,
388
+ ignored: a
389
+ });
390
+ continue;
391
+ }
392
+ i.set(s.id, a), r.push({
393
+ file: a,
394
+ definition: s
395
+ });
396
+ }
397
+ return r.length > 0 && n.info("discovered connections", {
398
+ connections: r.map((e) => `${e.definition.id} (${e.definition.kind})`),
399
+ files: r.map((e) => Ve(o(e.file)))
400
+ }), r;
401
+ }, q = (e) => {
402
+ let t = e.nodeEnv !== "production";
403
+ return {
404
+ traces: e.declared?.traces ?? t,
405
+ undo: e.declared?.undo ?? t,
406
+ cdc: e.cdcDialect !== void 0
407
+ };
408
+ }, He = (e) => {
409
+ let t = e.nodeEnv ?? "<unset>", n = (n) => e.declared?.[n] === void 0 ? `the default for NODE_ENV=${t}` : `app.config.ts \`schema: { ${n}: ${String(e.declared[n])} }\``, r = (e, t, n) => ` ${e ? "+" : "-"} ${t.padEnd(22)} ${n}`;
410
+ return `The three tables whose presence is DECIDED rather than implied by your source tree —
411
+ compare these against the other process's environment before anything else:
412
+
413
+ ${r(e.gates.traces, "_voltro_traces", n("traces"))}\n${r(e.gates.undo, "_voltro_undo_log", n("undo"))}\n${r(e.gates.cdc, "_voltro_cdc_offsets", `DB_DIALECT=${e.cdcDialect ?? "<no out-of-band CDC>"}`)}\n\nNone of them reads a runtime flag any more. If you are upgrading FROM a version where\nthey did, a migrate job without \`CDC\` / \`VOLTRO_UNDO\` / \`VOLTRO_TRACING_PERSIST\` recorded\na different set than your pods computed — re-run \`voltro db apply\` once on this version.`;
414
+ }, Ue = (e) => {
415
+ let t = [{
416
+ key: "traces",
417
+ table: "_voltro_traces",
418
+ envVar: "VOLTRO_TRACING_PERSIST"
419
+ }, {
420
+ key: "undo",
421
+ table: "_voltro_undo_log",
422
+ envVar: "VOLTRO_UNDO"
423
+ }].filter((t) => e.runtime[t.key] && !e.gates[t.key]);
424
+ if (t.length !== 0) return `refusing to boot — a runtime flag asks for a table the deployment does not declare:\n\n${t.map(({ key: e, table: t, envVar: n }) => ` \`${n}\` turns ${e} capture ON, but \`${t}\` is not in this app's declared schema.\n Declare it: \`schema: { ${e}: true }\` in app.config.ts.`).join("\n\n")}\n\nThe declaration has to live in app.config.ts rather than in the environment because the\npre-deploy migrate job runs with its OWN env block. A flag set on the pods and not on the\njob produces a green apply and a schema fingerprint no container can reproduce.`;
425
+ }, J = (e) => n.test(e) || a.test(e), Y = async (e) => {
426
+ let n = !1, a = !1, o = !1, c = !1, u = !1, d = async (e) => {
427
+ let f = await l.readdir(e, { withFileTypes: !0 }).catch(() => []);
428
+ for (let l of f) if (l.isDirectory()) {
429
+ if (l.name === "node_modules" || l.name === "dist" || l.name === ".framework" || l.name.startsWith(".")) continue;
430
+ await d(s(e, l.name));
431
+ } else {
432
+ let e = l.name;
433
+ (r.test(e) || t.test(e)) && (n = !0), J(e) && (a = !0), i.test(e) && (o = !0), U.test(e) && (c = !0), G.test(e) && (u = !0);
434
+ }
435
+ };
436
+ return await d(e), {
437
+ workflows: n,
438
+ schedules: a,
439
+ webhooks: o,
440
+ agents: c,
441
+ connections: u
442
+ };
443
+ }, We = async (e) => {
444
+ let t = s(e, "app.config.ts");
445
+ if (!c(t)) return { plugins: [] };
446
+ try {
447
+ let e = await import(u(t).href);
448
+ return {
449
+ plugins: e.default?.plugins ?? [],
450
+ ...e.default?.schema ? { schema: e.default.schema } : {}
451
+ };
452
+ } catch (e) {
453
+ return {
454
+ plugins: [],
455
+ error: e
456
+ };
457
+ }
458
+ }, Ge = async (e) => (await X(e)).plugins, X = async (e) => {
459
+ let { plugins: t, schema: n, error: r } = await We(e);
460
+ if (r !== void 0) throw new Z(e, r);
461
+ return {
462
+ plugins: t,
463
+ ...n ? { schema: n } : {}
464
+ };
465
+ }, Z = class extends Error {
466
+ root;
467
+ cause;
468
+ constructor(e, t) {
469
+ super(`app.config.ts could not be imported, so this app's plugin list is EMPTY and every plugin table is missing from the schema.
470
+
471
+ This is refused rather than continued: a plan computed without them does not merely omit them, it proposes DROPPING them, and the failure surfaces later as a pluginRef error naming an unrelated plugin.
472
+
473
+ The import ran at config-evaluation time — anything your config imports, directly or transitively, that does work when the module is first evaluated will reach here.
474
+
475
+ Cause: ${t instanceof Error ? t.message : String(t)}`), this.root = e, this.cause = t, this.name = "AppConfigLoadError";
476
+ }
477
+ }, Q = (e) => {
478
+ let t = /* @__PURE__ */ new Map(), n = (e) => {
479
+ e?.tableName && !t.has(e.tableName) && t.set(e.tableName, e);
480
+ };
481
+ for (let t of Ce({
482
+ workflows: e.mix.workflows,
483
+ schedules: e.mix.schedules,
484
+ webhooks: e.mix.webhooks,
485
+ traces: e.gates.traces,
486
+ cdc: e.gates.cdc,
487
+ ...e.cdcDialect ? { cdcDialect: e.cdcDialect } : {},
488
+ undo: e.gates.undo,
489
+ connections: e.mix.connections
490
+ })) n(t);
491
+ e.mix.agents && (n(de), n(ue), n(me), n(fe)), e.mix.workflows && n(pe), (e.mix.workflows || e.mix.agents) && n(h);
492
+ for (let t of Ie(e.plugins)) n(t);
493
+ return [...t.values()];
494
+ }, Ke = async (e) => {
495
+ let t = await Y(e.root), { plugins: n, schema: r } = await X(e.root);
496
+ return Q({
497
+ mix: t,
498
+ plugins: n,
499
+ gates: q({
500
+ nodeEnv: process.env.NODE_ENV,
501
+ cdcDialect: $(),
502
+ declared: r
503
+ }),
504
+ ...$() ? { cdcDialect: $() } : {}
505
+ });
506
+ }, $ = (e = process.env) => {
507
+ let t = (e.DB_DIALECT ?? "postgres").toLowerCase();
508
+ return t === "mariadb" ? "mariadb" : t === "mssql" ? "mssql" : void 0;
509
+ };
510
+ //#endregion
511
+ export { Oe as C, we as E, ke as S, R as T, Be as _, Y as a, H as b, X as c, Ue as d, G as f, W as g, Le as h, $ as i, He as l, U as m, Ke as n, J as o, K as p, Q as r, Ge as s, Z as t, q as u, Re as v, z as w, Fe as x, Pe as y };
@@ -0,0 +1,147 @@
1
+ import { r as e } from "./appGraph-KGDPTuTy.js";
2
+ import { dirname as t, join as n } from "node:path";
3
+ import { promises as r } from "node:fs";
4
+ import { createLogger as i } from "@voltro/logger";
5
+ import { Effect as a, Schema as o } from "effect";
6
+ import { generateObject as s } from "@voltro/ai";
7
+ //#region src/appBuilder.ts
8
+ var c = 3, l = 50, u = 256 * 1024, d = (e) => e.reduce((e, t) => e + Buffer.byteLength(t.content, "utf8"), 0), f = async (t, n) => {
9
+ let r = Math.max(1, n.maxAttempts ?? c), i = n.maxArtifacts ?? l, a = n.maxTotalBytes ?? u, o = [];
10
+ for (let s = 1; s <= r; s++) {
11
+ let r = await n.generate({
12
+ prompt: t,
13
+ attempt: s,
14
+ priorDiagnostics: o
15
+ });
16
+ if (r.artifacts.length === 0) return {
17
+ status: "rejected",
18
+ reason: "empty",
19
+ attempts: s,
20
+ diagnostics: []
21
+ };
22
+ if (r.artifacts.length > i || d(r.artifacts) > a) return {
23
+ status: "rejected",
24
+ reason: "too-large",
25
+ attempts: s,
26
+ diagnostics: []
27
+ };
28
+ let c = e(r.graph);
29
+ if (c.ok) return {
30
+ status: "accepted",
31
+ proposal: r,
32
+ attempts: s,
33
+ diagnostics: c.diagnostics
34
+ };
35
+ o = c.diagnostics;
36
+ }
37
+ return {
38
+ status: "rejected",
39
+ reason: "check-failed",
40
+ attempts: r,
41
+ diagnostics: o
42
+ };
43
+ }, p = o.Struct({
44
+ tag: o.String,
45
+ kind: o.String,
46
+ file: o.optional(o.String),
47
+ source: o.optional(o.Union(o.String, o.Array(o.String))),
48
+ targets: o.optional(o.Array(o.Struct({
49
+ table: o.String,
50
+ op: o.String
51
+ }))),
52
+ binds: o.optional(o.Array(o.String)),
53
+ requiresScopes: o.optional(o.Array(o.String))
54
+ }), m = o.Struct({
55
+ tables: o.Array(o.String),
56
+ procedures: o.Array(p),
57
+ scopes: o.optional(o.Array(o.String)),
58
+ routes: o.optional(o.Array(o.Struct({
59
+ pattern: o.String,
60
+ binds: o.Array(o.String),
61
+ file: o.optional(o.String)
62
+ })))
63
+ }), h = o.Struct({
64
+ graph: m,
65
+ artifacts: o.Array(o.Struct({
66
+ path: o.String,
67
+ content: o.String
68
+ }))
69
+ }), g = (e, t) => {
70
+ let n = [
71
+ "You are a Voltro app builder. Emit a structured proposal: the app GRAPH",
72
+ "(tables + procedures + routes) AND the FILES (artifacts) that realise it.",
73
+ "",
74
+ "You may ONLY use these framework primitives / conventions:",
75
+ ...e.length > 0 ? e.map((e) => `- ${e}`) : ["- (no capability manifest provided)"],
76
+ "",
77
+ "Rules:",
78
+ "- Every procedure `tag` is `<domain>.<action>` (camelCase segments).",
79
+ "- A query declares `source` (the table(s) it reads); a mutation declares",
80
+ " `targets` ([{ table, op }]); a route `binds` rpc tags that MUST exist.",
81
+ "- `requiresScopes` lists the RBAC scopes a handler needs (must be in `scopes`).",
82
+ "- Emit one artifact per file with its full `content`. Keep it minimal + valid."
83
+ ];
84
+ return t.length > 0 && n.push("", "Your PREVIOUS attempt FAILED these checks — FIX each before re-emitting:", ...t.map((e) => `- [${e.rule}]${e.node ? ` ${e.node}` : ""}: ${e.breaks}${e.fix ? ` → ${e.fix}` : ""}`)), n.join("\n");
85
+ }, _ = (e) => async ({ prompt: t, priorDiagnostics: n }) => await a.runPromise(s({
86
+ schema: h,
87
+ prompt: t,
88
+ system: g(e.manifest, n),
89
+ ...e.provider === void 0 ? {} : { provider: e.provider },
90
+ ...e.maxTokens === void 0 ? {} : { maxTokens: e.maxTokens }
91
+ }).pipe(a.map((e) => e.object))), v = (e) => {
92
+ let t = [];
93
+ for (let n of e.tables) {
94
+ let e = n.columns.map((e) => `${e.name}:${e.type}${e.nullable ? "?" : ""}${e.refersTo ? `→${e.refersTo}` : ""}`).join(", ");
95
+ t.push(`table: ${n.name}(${e})${n.reactive ? " [reactive]" : ""}`);
96
+ }
97
+ for (let n of e.procedures) t.push(`${n.kind}: ${n.tag}`);
98
+ for (let n of e.workflows) t.push(`workflow: ${n.name}`);
99
+ return e.widgets.length > 0 && t.push(`widgets: ${e.widgets.join(", ")}`), t;
100
+ }, y = async (e, t) => {
101
+ let r = await t.readManifest();
102
+ if (r === null) return t.log.error("voltro generate: no app.manifest.generated.json — run `voltro dev` once to emit it, then retry"), {
103
+ status: "rejected",
104
+ reason: "empty",
105
+ attempts: 0,
106
+ diagnostics: []
107
+ };
108
+ let i = v(r);
109
+ t.log.info(`voltro generate: ${i.length} capabilities in scope; asking the model…`);
110
+ let a = await f(e, { generate: t.makeGenerate(i) });
111
+ if (a.status !== "accepted") {
112
+ t.log.warn(`voltro generate: rejected (${a.reason}) after ${a.attempts} attempt(s) — nothing written`);
113
+ for (let e of a.diagnostics) t.log.warn(` [${e.rule}]${e.node ? ` ${e.node}` : ""}: ${e.breaks}${e.fix ? ` → ${e.fix}` : ""}`);
114
+ return a;
115
+ }
116
+ let o = a.proposal.artifacts;
117
+ if (!t.write) {
118
+ t.log.info(`voltro generate: ✓ ${o.length} artifact(s) passed voltro check (dry-run — pass --write to apply):`);
119
+ for (let e of o) t.log.info(` ${e.path}`);
120
+ return a;
121
+ }
122
+ for (let e of o) await t.writeFile(n(t.root, e.path), e.content), t.log.info(` wrote ${e.path}`);
123
+ return t.log.info(`voltro generate: ✓ wrote ${o.length} artifact(s)`), a;
124
+ }, b = async (e) => {
125
+ let a = e.includes("--write"), o = e.filter((e) => !e.startsWith("--")).join(" ").trim(), s = i({ scope: "voltro:generate" });
126
+ if (o.length === 0) return s.error("usage: voltro generate \"<prompt>\" [--write]"), 2;
127
+ let c = process.cwd();
128
+ return (await y(o, {
129
+ root: c,
130
+ write: a,
131
+ log: s,
132
+ readManifest: async () => {
133
+ try {
134
+ let e = await r.readFile(n(c, "app.manifest.generated.json"), "utf8");
135
+ return JSON.parse(e);
136
+ } catch {
137
+ return null;
138
+ }
139
+ },
140
+ makeGenerate: (e) => _({ manifest: e }),
141
+ writeFile: async (e, n) => {
142
+ await r.mkdir(t(e), { recursive: !0 }), await r.writeFile(e, n, "utf8");
143
+ }
144
+ })).status === "accepted" ? 0 : 1;
145
+ };
146
+ //#endregion
147
+ export { b as runGenerateCommand };