@pikku/cli 0.12.21 → 0.12.23

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 (442) hide show
  1. package/cli.schema.json +1 -1
  2. package/console-app/assets/index-C52h1B_L.css +1 -0
  3. package/console-app/assets/index-CAk106ji.js +232 -0
  4. package/console-app/index.html +3 -6
  5. package/dist/.pikku/agent/pikku-agent-types.gen.d.ts +1 -1
  6. package/dist/.pikku/channel/pikku-channel-types.gen.d.ts +3 -3
  7. package/dist/.pikku/channel/pikku-channel-types.gen.js +1 -1
  8. package/dist/.pikku/cli/pikku-cli-channel.d.ts +6 -6
  9. package/dist/.pikku/cli/pikku-cli-channel.js +280 -1
  10. package/dist/.pikku/cli/pikku-cli-types.gen.d.ts +1 -1
  11. package/dist/.pikku/cli/pikku-cli-types.gen.js +1 -1
  12. package/dist/.pikku/cli/pikku-cli-wirings-meta.gen.js +1 -1
  13. package/dist/.pikku/cli/pikku-cli-wirings-meta.gen.json +782 -7
  14. package/dist/.pikku/cli/pikku-cli-wirings.gen.d.ts +1 -1
  15. package/dist/.pikku/cli/pikku-cli-wirings.gen.js +1 -1
  16. package/dist/.pikku/cli/pikku-cli.gen.d.ts +1 -1
  17. package/dist/.pikku/cli/pikku-cli.gen.js +1 -1
  18. package/dist/.pikku/console/pikku-node-types.gen.d.ts +1 -1
  19. package/dist/.pikku/function/pikku-function-types.gen.d.ts +41 -73
  20. package/dist/.pikku/function/pikku-function-types.gen.js +30 -40
  21. package/dist/.pikku/function/pikku-functions-meta.gen.js +1 -1
  22. package/dist/.pikku/function/pikku-functions-meta.gen.json +1305 -378
  23. package/dist/.pikku/function/pikku-functions.gen.js +13 -1
  24. package/dist/.pikku/http/pikku-http-types.gen.d.ts +1 -1
  25. package/dist/.pikku/http/pikku-http-types.gen.js +1 -1
  26. package/dist/.pikku/http/pikku-http-wirings-meta.gen.js +1 -1
  27. package/dist/.pikku/http/pikku-http-wirings-meta.gen.json +1 -62
  28. package/dist/.pikku/http/pikku-http-wirings.gen.d.ts +1 -2
  29. package/dist/.pikku/http/pikku-http-wirings.gen.js +1 -2
  30. package/dist/.pikku/mcp/pikku-mcp-types.gen.d.ts +1 -1
  31. package/dist/.pikku/mcp/pikku-mcp-types.gen.js +1 -1
  32. package/dist/.pikku/pikku-bootstrap.gen.d.ts +3 -1
  33. package/dist/.pikku/pikku-bootstrap.gen.js +3 -1
  34. package/dist/.pikku/pikku-meta-service.gen.d.ts +1 -1
  35. package/dist/.pikku/pikku-meta-service.gen.js +1 -1
  36. package/dist/.pikku/pikku-services.gen.d.ts +2 -1
  37. package/dist/.pikku/pikku-services.gen.js +1 -0
  38. package/dist/.pikku/pikku-types.gen.d.ts +1 -1
  39. package/dist/.pikku/pikku-types.gen.js +1 -1
  40. package/dist/.pikku/queue/pikku-queue-types.gen.d.ts +1 -1
  41. package/dist/.pikku/queue/pikku-queue-types.gen.js +1 -1
  42. package/dist/.pikku/queue/pikku-queue-workers-wirings-meta.gen.d.ts +1 -0
  43. package/dist/.pikku/queue/pikku-queue-workers-wirings-meta.gen.js +6 -0
  44. package/dist/.pikku/queue/pikku-queue-workers-wirings-meta.gen.json +250 -0
  45. package/dist/.pikku/queue/pikku-queue-workers-wirings.gen.d.ts +4 -0
  46. package/dist/.pikku/queue/pikku-queue-workers-wirings.gen.js +5 -0
  47. package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.js +1 -1
  48. package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.json +66 -20
  49. package/dist/.pikku/scheduler/pikku-scheduler-types.gen.d.ts +1 -1
  50. package/dist/.pikku/scheduler/pikku-scheduler-types.gen.js +1 -1
  51. package/dist/.pikku/schemas/register.gen.js +153 -29
  52. package/dist/.pikku/schemas/schemas/BinaryInput.schema.json +1 -0
  53. package/dist/.pikku/schemas/schemas/DbMigrateInput.schema.json +1 -0
  54. package/dist/.pikku/schemas/schemas/DbResetInput.schema.json +1 -0
  55. package/dist/.pikku/schemas/schemas/DbSeedInput.schema.json +1 -0
  56. package/dist/.pikku/schemas/schemas/FabricDbSchemaInput.schema.json +1 -0
  57. package/dist/.pikku/schemas/schemas/FabricDbSchemaOutput.schema.json +1 -0
  58. package/dist/.pikku/schemas/schemas/FabricDeployApplyInput.schema.json +1 -0
  59. package/dist/.pikku/schemas/schemas/FabricDeployApplyOutput.schema.json +1 -0
  60. package/dist/.pikku/schemas/schemas/FabricDeployListInput.schema.json +1 -0
  61. package/dist/.pikku/schemas/schemas/FabricDeployListOutput.schema.json +1 -0
  62. package/dist/.pikku/schemas/schemas/FabricDeployPlanInput.schema.json +1 -0
  63. package/dist/.pikku/schemas/schemas/FabricDeployPlanOutput.schema.json +1 -0
  64. package/dist/.pikku/schemas/schemas/FabricDeployUnitsInput.schema.json +1 -0
  65. package/dist/.pikku/schemas/schemas/FabricDeployUnitsOutput.schema.json +1 -0
  66. package/dist/.pikku/schemas/schemas/FabricDomainsAddInput.schema.json +1 -0
  67. package/dist/.pikku/schemas/schemas/FabricDomainsAddOutput.schema.json +1 -0
  68. package/dist/.pikku/schemas/schemas/FabricDomainsListInput.schema.json +1 -0
  69. package/dist/.pikku/schemas/schemas/FabricDomainsListOutput.schema.json +1 -0
  70. package/dist/.pikku/schemas/schemas/FabricDomainsRemoveInput.schema.json +1 -0
  71. package/dist/.pikku/schemas/schemas/FabricDomainsRemoveOutput.schema.json +1 -0
  72. package/dist/.pikku/schemas/schemas/FabricErrorsInput.schema.json +1 -0
  73. package/dist/.pikku/schemas/schemas/FabricErrorsOutput.schema.json +1 -0
  74. package/dist/.pikku/schemas/schemas/FabricInitInput.schema.json +1 -0
  75. package/dist/.pikku/schemas/schemas/FabricInitOutput.schema.json +1 -0
  76. package/dist/.pikku/schemas/schemas/FabricLLMKeyInput.schema.json +1 -0
  77. package/dist/.pikku/schemas/schemas/FabricLLMKeyOutput.schema.json +1 -0
  78. package/dist/.pikku/schemas/schemas/FabricLinkInput.schema.json +1 -0
  79. package/dist/.pikku/schemas/schemas/FabricLinkOutput.schema.json +1 -0
  80. package/dist/.pikku/schemas/schemas/FabricLoginInput.schema.json +1 -0
  81. package/dist/.pikku/schemas/schemas/FabricLoginOutput.schema.json +1 -0
  82. package/dist/.pikku/schemas/schemas/FabricLogsInput.schema.json +1 -0
  83. package/dist/.pikku/schemas/schemas/FabricLogsOutput.schema.json +1 -0
  84. package/dist/.pikku/schemas/schemas/FabricMetricsInput.schema.json +1 -0
  85. package/dist/.pikku/schemas/schemas/FabricMetricsOutput.schema.json +1 -0
  86. package/dist/.pikku/schemas/schemas/FabricRollbackInput.schema.json +1 -0
  87. package/dist/.pikku/schemas/schemas/FabricRollbackOutput.schema.json +1 -0
  88. package/dist/.pikku/schemas/schemas/FabricSecretsListInput.schema.json +1 -0
  89. package/dist/.pikku/schemas/schemas/FabricSecretsListOutput.schema.json +1 -0
  90. package/dist/.pikku/schemas/schemas/FabricSecretsSetInput.schema.json +1 -0
  91. package/dist/.pikku/schemas/schemas/FabricSecretsSetOutput.schema.json +1 -0
  92. package/dist/.pikku/schemas/schemas/FabricStatusInput.schema.json +1 -0
  93. package/dist/.pikku/schemas/schemas/FabricStatusOutput.schema.json +1 -0
  94. package/dist/.pikku/schemas/schemas/FabricTraceInput.schema.json +1 -0
  95. package/dist/.pikku/schemas/schemas/FabricTraceOutput.schema.json +1 -0
  96. package/dist/.pikku/schemas/schemas/FabricValidateInput.schema.json +1 -0
  97. package/dist/.pikku/schemas/schemas/FabricValidateOutput.schema.json +1 -0
  98. package/dist/.pikku/schemas/schemas/PikkuCLIConfig.schema.json +1 -1
  99. package/dist/.pikku/schemas/schemas/PikkuCLIEntryOutput.schema.json +1 -0
  100. package/dist/.pikku/schemas/schemas/PikkuEventsScaffoldOutput.schema.json +1 -0
  101. package/dist/.pikku/schemas/schemas/PikkuMetaClientsInput.schema.json +1 -0
  102. package/dist/.pikku/schemas/schemas/PikkuMetaContextInput.schema.json +1 -0
  103. package/dist/.pikku/schemas/schemas/PikkuMetaFunctionsGetInput.schema.json +1 -0
  104. package/dist/.pikku/schemas/schemas/PikkuMetaFunctionsListInput.schema.json +1 -0
  105. package/dist/.pikku/schemas/schemas/PikkuMetaMiddlewareGetInput.schema.json +1 -0
  106. package/dist/.pikku/schemas/schemas/PikkuMetaMiddlewareListInput.schema.json +1 -0
  107. package/dist/.pikku/schemas/schemas/PikkuMetaPermissionsGetInput.schema.json +1 -0
  108. package/dist/.pikku/schemas/schemas/PikkuMetaPermissionsListInput.schema.json +1 -0
  109. package/dist/.pikku/schemas/schemas/PikkuMetaSchemasGetInput.schema.json +1 -0
  110. package/dist/.pikku/schemas/schemas/PikkuMetaSchemasListInput.schema.json +1 -0
  111. package/dist/.pikku/schemas/schemas/PikkuMetaWiresChannelInput.schema.json +1 -0
  112. package/dist/.pikku/schemas/schemas/PikkuMetaWiresHttpInput.schema.json +1 -0
  113. package/dist/.pikku/schemas/schemas/PikkuMetaWiresListInput.schema.json +1 -0
  114. package/dist/.pikku/schemas/schemas/PikkuMetaWiresQueueInput.schema.json +1 -0
  115. package/dist/.pikku/schemas/schemas/PikkuMetaWiresSchedulerInput.schema.json +1 -0
  116. package/dist/.pikku/schemas/schemas/PikkuMetaWiresTriggerInput.schema.json +1 -0
  117. package/dist/.pikku/schemas/schemas/PikkuMetaWiresTypeInput.schema.json +1 -0
  118. package/dist/.pikku/schemas/schemas/PikkuMetaWorkflowsGetInput.schema.json +1 -0
  119. package/dist/.pikku/schemas/schemas/PikkuMetaWorkflowsListInput.schema.json +1 -0
  120. package/dist/.pikku/schemas/schemas/PikkuSkillsInstallInput.schema.json +1 -0
  121. package/dist/.pikku/schemas/schemas/PikkuSkillsListInput.schema.json +1 -0
  122. package/dist/.pikku/schemas/schemas/PikkuTestsCoverageInput.schema.json +1 -0
  123. package/dist/.pikku/schemas/schemas/PikkuTestsInitInput.schema.json +1 -0
  124. package/dist/.pikku/secrets/pikku-secret-types.gen.d.ts +1 -1
  125. package/dist/.pikku/secrets/pikku-secret-types.gen.js +1 -1
  126. package/dist/.pikku/secrets/pikku-secrets.gen.d.ts +1 -1
  127. package/dist/.pikku/secrets/pikku-secrets.gen.js +1 -1
  128. package/dist/.pikku/trigger/pikku-trigger-types.gen.d.ts +1 -1
  129. package/dist/.pikku/trigger/pikku-trigger-types.gen.js +1 -1
  130. package/dist/.pikku/variables/pikku-variable-types.gen.d.ts +1 -1
  131. package/dist/.pikku/variables/pikku-variable-types.gen.js +1 -1
  132. package/dist/.pikku/variables/pikku-variables.gen.d.ts +1 -1
  133. package/dist/.pikku/variables/pikku-variables.gen.js +1 -1
  134. package/dist/.pikku/workflow/meta/allWorkflow.gen.json +235 -627
  135. package/dist/.pikku/workflow/pikku-workflow-types.gen.d.ts +1 -1
  136. package/dist/.pikku/workflow/pikku-workflow-types.gen.js +1 -1
  137. package/dist/.pikku/workflow/pikku-workflow-wirings-meta.gen.js +1 -1
  138. package/dist/.pikku/workflow/pikku-workflow-wirings.gen.js +1 -1
  139. package/dist/bin/pikku-bin.mjs +23 -0
  140. package/dist/bin/pikku.js +28 -1
  141. package/dist/src/cli.wiring.js +274 -8
  142. package/dist/src/deploy/analyzer/analyzer.d.ts +16 -1
  143. package/dist/src/deploy/analyzer/analyzer.js +83 -43
  144. package/dist/src/deploy/build-pipeline.js +83 -17
  145. package/dist/src/deploy/bundler/bundler.d.ts +1 -0
  146. package/dist/src/deploy/bundler/bundler.js +13 -5
  147. package/dist/src/deploy/codegen/per-unit-codegen.d.ts +8 -0
  148. package/dist/src/deploy/codegen/per-unit-codegen.js +46 -5
  149. package/dist/src/deploy/provider-adapter.d.ts +34 -0
  150. package/dist/src/deploy/server-entry.d.ts +16 -0
  151. package/dist/src/deploy/server-entry.js +81 -0
  152. package/dist/src/fabric/fabric-commands.d.ts +522 -0
  153. package/dist/src/fabric/fabric-commands.js +299 -0
  154. package/dist/src/fabric/functions/db-schema.function.d.ts +35 -0
  155. package/dist/src/fabric/functions/db-schema.function.js +37 -0
  156. package/dist/src/fabric/functions/deploy-list.function.d.ts +41 -0
  157. package/dist/src/fabric/functions/deploy-list.function.js +43 -0
  158. package/dist/src/fabric/functions/deploy-units.function.d.ts +35 -0
  159. package/dist/src/fabric/functions/deploy-units.function.js +41 -0
  160. package/dist/src/fabric/functions/deploy.function.d.ts +105 -0
  161. package/dist/src/fabric/functions/deploy.function.js +122 -0
  162. package/dist/src/fabric/functions/domains-add.function.d.ts +35 -0
  163. package/dist/src/fabric/functions/domains-add.function.js +46 -0
  164. package/dist/src/fabric/functions/domains-list.function.d.ts +20 -0
  165. package/dist/src/fabric/functions/domains-list.function.js +50 -0
  166. package/dist/src/fabric/functions/domains-remove.function.d.ts +24 -0
  167. package/dist/src/fabric/functions/domains-remove.function.js +44 -0
  168. package/dist/src/fabric/functions/errors.function.d.ts +44 -0
  169. package/dist/src/fabric/functions/errors.function.js +50 -0
  170. package/dist/src/fabric/functions/init.function.d.ts +51 -0
  171. package/dist/src/fabric/functions/init.function.js +54 -0
  172. package/dist/src/fabric/functions/link.function.d.ts +28 -0
  173. package/dist/src/fabric/functions/link.function.js +77 -0
  174. package/dist/src/fabric/functions/llm-key.function.d.ts +46 -0
  175. package/dist/src/fabric/functions/llm-key.function.js +76 -0
  176. package/dist/src/fabric/functions/login.function.d.ts +42 -0
  177. package/dist/src/fabric/functions/login.function.js +68 -0
  178. package/dist/src/fabric/functions/logs.function.d.ts +40 -0
  179. package/dist/src/fabric/functions/logs.function.js +84 -0
  180. package/dist/src/fabric/functions/metrics.function.d.ts +32 -0
  181. package/dist/src/fabric/functions/metrics.function.js +49 -0
  182. package/dist/src/fabric/functions/rollback.function.d.ts +76 -0
  183. package/dist/src/fabric/functions/rollback.function.js +69 -0
  184. package/dist/src/fabric/functions/secrets-list.function.d.ts +24 -0
  185. package/dist/src/fabric/functions/secrets-list.function.js +37 -0
  186. package/dist/src/fabric/functions/secrets-set.function.d.ts +32 -0
  187. package/dist/src/fabric/functions/secrets-set.function.js +36 -0
  188. package/dist/src/fabric/functions/status.function.d.ts +34 -0
  189. package/dist/src/fabric/functions/status.function.js +43 -0
  190. package/dist/src/fabric/functions/trace.function.d.ts +28 -0
  191. package/dist/src/fabric/functions/trace.function.js +45 -0
  192. package/dist/src/fabric/functions/validate.function.d.ts +50 -0
  193. package/dist/src/fabric/functions/validate.function.js +363 -0
  194. package/dist/src/fabric/lib/config.d.ts +64 -0
  195. package/dist/src/fabric/lib/config.js +62 -0
  196. package/dist/src/fabric/lib/console-url.d.ts +5 -0
  197. package/dist/src/fabric/lib/console-url.js +13 -0
  198. package/dist/src/fabric/lib/git.d.ts +53 -0
  199. package/dist/src/fabric/lib/git.js +151 -0
  200. package/dist/src/fabric/lib/http.d.ts +4 -0
  201. package/dist/src/fabric/lib/http.js +12 -0
  202. package/dist/src/fabric/lib/not-implemented.d.ts +5 -0
  203. package/dist/src/fabric/lib/not-implemented.js +8 -0
  204. package/dist/src/fabric/lib/output.d.ts +23 -0
  205. package/dist/src/fabric/lib/output.js +39 -0
  206. package/dist/src/fabric/lib/prompt.d.ts +12 -0
  207. package/dist/src/fabric/lib/prompt.js +32 -0
  208. package/dist/src/fabric/lib/stage.d.ts +7 -0
  209. package/dist/src/fabric/lib/stage.js +14 -0
  210. package/dist/src/fabric/sdk/pikku-fetch.gen.d.ts +14 -0
  211. package/dist/src/fabric/sdk/pikku-fetch.gen.js +30 -0
  212. package/dist/src/fabric/sdk/pikku-rpc.gen.d.ts +105 -0
  213. package/dist/src/fabric/sdk/pikku-rpc.gen.js +126 -0
  214. package/dist/src/functions/commands/all.d.ts +1 -1
  215. package/dist/src/functions/commands/binary.d.ts +7 -0
  216. package/dist/src/functions/commands/binary.js +40 -0
  217. package/dist/src/functions/commands/bootstrap.d.ts +1 -1
  218. package/dist/src/functions/commands/bootstrap.js +7 -4
  219. package/dist/src/functions/commands/console.d.ts +3 -3
  220. package/dist/src/functions/commands/db-migrate.d.ts +1 -0
  221. package/dist/src/functions/commands/db-migrate.js +35 -0
  222. package/dist/src/functions/commands/db-reset.d.ts +1 -0
  223. package/dist/src/functions/commands/db-reset.js +36 -0
  224. package/dist/src/functions/commands/db-seed.d.ts +1 -0
  225. package/dist/src/functions/commands/db-seed.js +27 -0
  226. package/dist/src/functions/commands/db-shared.d.ts +32 -0
  227. package/dist/src/functions/commands/db-shared.js +26 -0
  228. package/dist/src/functions/commands/deploy-apply.d.ts +3 -3
  229. package/dist/src/functions/commands/deploy-info.d.ts +1 -1
  230. package/dist/src/functions/commands/deploy-plan.d.ts +3 -3
  231. package/dist/src/functions/commands/dev.d.ts +3 -3
  232. package/dist/src/functions/commands/dev.js +142 -86
  233. package/dist/src/functions/commands/enable.d.ts +5 -4
  234. package/dist/src/functions/commands/enable.js +4 -0
  235. package/dist/src/functions/commands/info.d.ts +4 -4
  236. package/dist/src/functions/commands/load-user-project.d.ts +11 -0
  237. package/dist/src/functions/commands/load-user-project.js +40 -0
  238. package/dist/src/functions/commands/meta.d.ts +82 -0
  239. package/dist/src/functions/commands/meta.js +454 -0
  240. package/dist/src/functions/commands/new-addon.d.ts +3 -3
  241. package/dist/src/functions/commands/new-function.d.ts +3 -3
  242. package/dist/src/functions/commands/new-middleware.d.ts +3 -3
  243. package/dist/src/functions/commands/new-permission.d.ts +3 -3
  244. package/dist/src/functions/commands/new-wiring.d.ts +3 -3
  245. package/dist/src/functions/commands/pikku-command-bootstrap.d.ts +1 -1
  246. package/dist/src/functions/commands/pikku-command-bootstrap.js +15 -1
  247. package/dist/src/functions/commands/pikku-command-summary.d.ts +1 -1
  248. package/dist/src/functions/commands/pikku-command-summary.js +3 -0
  249. package/dist/src/functions/commands/skills.d.ts +26 -0
  250. package/dist/src/functions/commands/skills.js +184 -0
  251. package/dist/src/functions/commands/tests-coverage.d.ts +7 -0
  252. package/dist/src/functions/commands/tests-coverage.js +231 -0
  253. package/dist/src/functions/commands/tests-init.d.ts +7 -0
  254. package/dist/src/functions/commands/tests-init.js +225 -0
  255. package/dist/src/functions/commands/versions-check.d.ts +1 -1
  256. package/dist/src/functions/commands/versions-init.d.ts +3 -3
  257. package/dist/src/functions/commands/versions-update.d.ts +1 -1
  258. package/dist/src/functions/commands/watch.d.ts +3 -3
  259. package/dist/src/functions/commands/watch.js +1 -1
  260. package/dist/src/functions/db/local-db.d.ts +48 -0
  261. package/dist/src/functions/db/local-db.js +106 -0
  262. package/dist/src/functions/db/seed.d.ts +11 -0
  263. package/dist/src/functions/db/seed.js +22 -0
  264. package/dist/src/functions/db/sql-migrator.d.ts +26 -0
  265. package/dist/src/functions/db/sql-migrator.js +104 -0
  266. package/dist/src/functions/db/sqlite-codegen.d.ts +45 -0
  267. package/dist/src/functions/db/sqlite-codegen.js +294 -0
  268. package/dist/src/functions/db/zod-codegen.d.ts +10 -0
  269. package/dist/src/functions/db/zod-codegen.js +109 -0
  270. package/dist/src/functions/runtimes/fetch/index.d.ts +1 -1
  271. package/dist/src/functions/runtimes/nextjs/pikku-command-nextjs.d.ts +1 -1
  272. package/dist/src/functions/runtimes/nextjs/pikku-command-nextjs.js +21 -2
  273. package/dist/src/functions/runtimes/nextjs/serialize-nextjs-backend-worker-rpc-wrapper.d.ts +1 -0
  274. package/dist/src/functions/runtimes/nextjs/serialize-nextjs-backend-worker-rpc-wrapper.js +163 -0
  275. package/dist/src/functions/runtimes/nextjs/serialize-nextjs-http-wrapper.d.ts +1 -1
  276. package/dist/src/functions/runtimes/nextjs/serialize-nextjs-http-wrapper.js +5 -2
  277. package/dist/src/functions/runtimes/tanstack-start/pikku-command-tanstack-start.d.ts +1 -0
  278. package/dist/src/functions/runtimes/tanstack-start/pikku-command-tanstack-start.js +32 -0
  279. package/dist/src/functions/runtimes/tanstack-start/serialize-tanstack-start-shim.d.ts +11 -0
  280. package/dist/src/functions/runtimes/tanstack-start/serialize-tanstack-start-shim.js +36 -0
  281. package/dist/src/functions/runtimes/websocket/pikku-command-websocket-typed.d.ts +1 -1
  282. package/dist/src/functions/wirings/ai-agent/pikku-command-ai-agent-types.d.ts +1 -1
  283. package/dist/src/functions/wirings/ai-agent/pikku-command-ai-agent.d.ts +1 -1
  284. package/dist/src/functions/wirings/ai-agent/pikku-command-ai-agent.js +1 -10
  285. package/dist/src/functions/wirings/ai-agent/pikku-command-public-agent.d.ts +1 -1
  286. package/dist/src/functions/wirings/ai-agent/serialize-public-agent.js +76 -1
  287. package/dist/src/functions/wirings/channels/pikku-channels.d.ts +1 -1
  288. package/dist/src/functions/wirings/channels/pikku-command-channel-types.d.ts +1 -1
  289. package/dist/src/functions/wirings/channels/pikku-command-channels-map.d.ts +1 -1
  290. package/dist/src/functions/wirings/channels/pikku-command-channels.d.ts +1 -1
  291. package/dist/src/functions/wirings/cli/pikku-command-cli-entry.d.ts +1 -1
  292. package/dist/src/functions/wirings/cli/pikku-command-cli-entry.js +5 -2
  293. package/dist/src/functions/wirings/cli/pikku-command-cli-types.d.ts +5 -1
  294. package/dist/src/functions/wirings/cli/pikku-command-cli-types.js +8 -2
  295. package/dist/src/functions/wirings/cli/pikku-command-cli.d.ts +1 -1
  296. package/dist/src/functions/wirings/cli/serialize-channel-cli-client.js +27 -9
  297. package/dist/src/functions/wirings/cli/serialize-channel-cli.d.ts +5 -1
  298. package/dist/src/functions/wirings/cli/serialize-channel-cli.js +13 -3
  299. package/dist/src/functions/wirings/console/pikku-command-console-functions.d.ts +1 -1
  300. package/dist/src/functions/wirings/console/pikku-command-node-types.d.ts +1 -1
  301. package/dist/src/functions/wirings/console/pikku-command-nodes-meta.d.ts +1 -1
  302. package/dist/src/functions/wirings/console/serialize-console-functions.js +5 -0
  303. package/dist/src/functions/wirings/credentials/pikku-command-credentials.d.ts +1 -1
  304. package/dist/src/functions/wirings/functions/pikku-command-addon-types.d.ts +5 -1
  305. package/dist/src/functions/wirings/functions/pikku-command-addon-types.js +7 -2
  306. package/dist/src/functions/wirings/functions/pikku-command-function-types-split.d.ts +1 -1
  307. package/dist/src/functions/wirings/functions/pikku-command-function-types-split.js +1 -1
  308. package/dist/src/functions/wirings/functions/pikku-command-function-types.d.ts +1 -1
  309. package/dist/src/functions/wirings/functions/pikku-command-functions.d.ts +1 -1
  310. package/dist/src/functions/wirings/functions/pikku-command-services.d.ts +1 -1
  311. package/dist/src/functions/wirings/functions/schemas.d.ts +1 -1
  312. package/dist/src/functions/wirings/functions/serialize-function-types.js +78 -83
  313. package/dist/src/functions/wirings/gateway/pikku-command-gateway.d.ts +1 -1
  314. package/dist/src/functions/wirings/http/pikku-command-http-map.d.ts +1 -1
  315. package/dist/src/functions/wirings/http/pikku-command-http-routes.d.ts +1 -1
  316. package/dist/src/functions/wirings/http/pikku-command-http-types.d.ts +1 -1
  317. package/dist/src/functions/wirings/http/pikku-command-openapi.d.ts +1 -1
  318. package/dist/src/functions/wirings/http/pikku-http-routes.d.ts +1 -1
  319. package/dist/src/functions/wirings/mcp/pikku-command-mcp-json.d.ts +1 -1
  320. package/dist/src/functions/wirings/mcp/pikku-command-mcp-types.d.ts +1 -1
  321. package/dist/src/functions/wirings/mcp/pikku-command-mcp.d.ts +1 -1
  322. package/dist/src/functions/wirings/middleware/pikku-command-middleware.d.ts +1 -1
  323. package/dist/src/functions/wirings/package/pikku-command-package-types.d.ts +2 -2
  324. package/dist/src/functions/wirings/package/pikku-command-package.d.ts +1 -1
  325. package/dist/src/functions/wirings/permissions/pikku-command-permissions.d.ts +1 -1
  326. package/dist/src/functions/wirings/queue/pikku-command-queue-map.d.ts +1 -1
  327. package/dist/src/functions/wirings/queue/pikku-command-queue-service.d.ts +1 -1
  328. package/dist/src/functions/wirings/queue/pikku-command-queue-types.d.ts +1 -1
  329. package/dist/src/functions/wirings/queue/pikku-command-queue.d.ts +1 -1
  330. package/dist/src/functions/wirings/queue/pikku-queue-map.d.ts +1 -1
  331. package/dist/src/functions/wirings/queue/pikku-queue.d.ts +1 -1
  332. package/dist/src/functions/wirings/realtime/pikku-command-events-scaffold.d.ts +1 -0
  333. package/dist/src/functions/wirings/realtime/pikku-command-events-scaffold.js +26 -0
  334. package/dist/src/functions/wirings/realtime/pikku-command-realtime.d.ts +1 -0
  335. package/dist/src/functions/wirings/realtime/pikku-command-realtime.js +35 -0
  336. package/dist/src/functions/wirings/realtime/serialize-events-scaffold.d.ts +23 -0
  337. package/dist/src/functions/wirings/realtime/serialize-events-scaffold.js +98 -0
  338. package/dist/src/functions/wirings/realtime/serialize-realtime-client.d.ts +22 -0
  339. package/dist/src/functions/wirings/realtime/serialize-realtime-client.js +337 -0
  340. package/dist/src/functions/wirings/rpc/pikku-command-public-rpc.d.ts +1 -1
  341. package/dist/src/functions/wirings/rpc/pikku-command-react-query.d.ts +1 -1
  342. package/dist/src/functions/wirings/rpc/pikku-command-remote-rpc.d.ts +1 -1
  343. package/dist/src/functions/wirings/rpc/pikku-command-rpc-client.d.ts +1 -1
  344. package/dist/src/functions/wirings/rpc/pikku-command-rpc-client.js +3 -1
  345. package/dist/src/functions/wirings/rpc/pikku-command-rpc-map.d.ts +2 -2
  346. package/dist/src/functions/wirings/rpc/pikku-command-rpc.d.ts +2 -1
  347. package/dist/src/functions/wirings/rpc/pikku-command-rpc.js +13 -7
  348. package/dist/src/functions/wirings/rpc/serialize-public-rpc.js +1 -0
  349. package/dist/src/functions/wirings/rpc/serialize-react-query-hooks.js +1 -1
  350. package/dist/src/functions/wirings/rpc/serialize-remote-rpc.js +7 -1
  351. package/dist/src/functions/wirings/scheduler/pikku-command-scheduler-types.d.ts +1 -1
  352. package/dist/src/functions/wirings/scheduler/pikku-command-scheduler.d.ts +1 -1
  353. package/dist/src/functions/wirings/secrets/pikku-command-secrets.d.ts +1 -1
  354. package/dist/src/functions/wirings/triggers/pikku-command-trigger-types.d.ts +1 -1
  355. package/dist/src/functions/wirings/triggers/pikku-command-trigger-types.js +1 -1
  356. package/dist/src/functions/wirings/triggers/pikku-command-trigger.d.ts +1 -1
  357. package/dist/src/functions/wirings/variables/pikku-command-variables.d.ts +1 -1
  358. package/dist/src/functions/wirings/workflow/pikku-command-workflow-routes.d.ts +1 -1
  359. package/dist/src/functions/wirings/workflow/pikku-command-workflow-routes.js +1 -1
  360. package/dist/src/functions/wirings/workflow/pikku-command-workflow.d.ts +5 -1
  361. package/dist/src/functions/wirings/workflow/pikku-command-workflow.js +18 -4
  362. package/dist/src/functions/wirings/workflow/serialize-workflow-bootstrap-map.d.ts +3 -0
  363. package/dist/src/functions/wirings/workflow/serialize-workflow-bootstrap-map.js +40 -0
  364. package/dist/src/functions/wirings/workflow/serialize-workflow-routes.js +14 -2
  365. package/dist/src/functions/workflows/all.workflow.js +41 -8
  366. package/dist/src/scaffold/rpc-remote.gen.d.ts +3 -3
  367. package/dist/src/scaffold/rpc-remote.gen.js +7 -2
  368. package/dist/src/services/cli-logger.service.d.ts +0 -1
  369. package/dist/src/services/cli-logger.service.js +12 -22
  370. package/dist/src/services.js +24 -66
  371. package/dist/src/utils/generate-bootstrap-file.js +3 -0
  372. package/dist/src/utils/parse-cli-filters.d.ts +18 -0
  373. package/dist/src/utils/parse-cli-filters.js +99 -0
  374. package/dist/src/utils/pikku-cli-config.js +29 -9
  375. package/dist/src/utils/serialize-schemas.js +1 -1
  376. package/dist/tsconfig.tsbuildinfo +1 -1
  377. package/package.json +9 -4
  378. package/skills/pikku-addon/SKILL.md +330 -0
  379. package/skills/pikku-ai-agent/SKILL.md +227 -0
  380. package/skills/pikku-ai-vercel/SKILL.md +78 -0
  381. package/skills/pikku-ai-voice/SKILL.md +85 -0
  382. package/skills/pikku-auth-js/SKILL.md +106 -0
  383. package/skills/pikku-aws/SKILL.md +107 -0
  384. package/skills/pikku-backblaze/SKILL.md +70 -0
  385. package/skills/pikku-cli/SKILL.md +281 -0
  386. package/skills/pikku-concepts/SKILL.md +281 -0
  387. package/skills/pikku-concepts/references/concept-mapping.md +528 -0
  388. package/skills/pikku-config/SKILL.md +208 -0
  389. package/skills/pikku-cron/SKILL.md +211 -0
  390. package/skills/pikku-deploy-azure/SKILL.md +69 -0
  391. package/skills/pikku-deploy-cloudflare/SKILL.md +80 -0
  392. package/skills/pikku-deploy-express/SKILL.md +83 -0
  393. package/skills/pikku-deploy-fastify/SKILL.md +70 -0
  394. package/skills/pikku-deploy-lambda/SKILL.md +107 -0
  395. package/skills/pikku-deploy-nextjs/SKILL.md +76 -0
  396. package/skills/pikku-deploy-uws/SKILL.md +85 -0
  397. package/skills/pikku-fabric/SKILL.md +245 -0
  398. package/skills/pikku-feature/SKILL.md +258 -0
  399. package/skills/pikku-gateway-slack/SKILL.md +112 -0
  400. package/skills/pikku-http/SKILL.md +317 -0
  401. package/skills/pikku-i18n/SKILL.md +217 -0
  402. package/skills/pikku-info/SKILL.md +95 -0
  403. package/skills/pikku-jose/SKILL.md +102 -0
  404. package/skills/pikku-kysely/SKILL.md +145 -0
  405. package/skills/pikku-mcp/SKILL.md +237 -0
  406. package/skills/pikku-mongodb/SKILL.md +102 -0
  407. package/skills/pikku-n8n-addon-map/SKILL.md +178 -0
  408. package/skills/pikku-n8n-code-translate/SKILL.md +166 -0
  409. package/skills/pikku-pino/SKILL.md +77 -0
  410. package/skills/pikku-queue/SKILL.md +237 -0
  411. package/skills/pikku-react/SKILL.md +183 -0
  412. package/skills/pikku-react-query/SKILL.md +205 -0
  413. package/skills/pikku-realtime/SKILL.md +285 -0
  414. package/skills/pikku-redis/SKILL.md +87 -0
  415. package/skills/pikku-rpc/SKILL.md +168 -0
  416. package/skills/pikku-rtl/SKILL.md +219 -0
  417. package/skills/pikku-schedule/SKILL.md +54 -0
  418. package/skills/pikku-schema-ajv/SKILL.md +60 -0
  419. package/skills/pikku-schema-cfworker/SKILL.md +60 -0
  420. package/skills/pikku-security/SKILL.md +243 -0
  421. package/skills/pikku-services/SKILL.md +247 -0
  422. package/skills/pikku-template-clone/SKILL.md +39 -0
  423. package/skills/pikku-testing/SKILL.md +428 -0
  424. package/skills/pikku-trigger/SKILL.md +177 -0
  425. package/skills/pikku-versioning/SKILL.md +169 -0
  426. package/skills/pikku-websocket/SKILL.md +239 -0
  427. package/skills/pikku-workflow/SKILL.md +283 -0
  428. package/skills/pikku-workflows-client/SKILL.md +150 -0
  429. package/skills/pikku-ws/SKILL.md +45 -0
  430. package/console-app/assets/index-BpY2pSuA.css +0 -10
  431. package/console-app/assets/index-DXLy-_D4.js +0 -717
  432. package/dist/.pikku/schemas/schemas/GraphStarterInput.schema.json +0 -1
  433. package/dist/.pikku/schemas/schemas/GraphStarterOutput.schema.json +0 -1
  434. package/dist/.pikku/schemas/schemas/WorkflowRunStatus.schema.json +0 -1
  435. package/dist/.pikku/schemas/schemas/WorkflowRunnerInput.schema.json +0 -1
  436. package/dist/.pikku/schemas/schemas/WorkflowStarterInput.schema.json +0 -1
  437. package/dist/.pikku/schemas/schemas/WorkflowStarterOutput.schema.json +0 -1
  438. package/dist/.pikku/schemas/schemas/WorkflowStatusCheckerInput.schema.json +0 -1
  439. package/dist/.pikku/schemas/schemas/WorkflowStatusStreamFullInput.schema.json +0 -1
  440. package/dist/.pikku/schemas/schemas/WorkflowStatusStreamInput.schema.json +0 -1
  441. package/dist/src/scaffold/workflow-routes.gen.d.ts +0 -84
  442. package/dist/src/scaffold/workflow-routes.gen.js +0 -229
@@ -6,27 +6,10 @@
6
6
  * Gateways (MCP, agents, channels) dispatch to function units via RPC.
7
7
  * Workflow orchestrators dispatch to step units via queue or RPC (inline).
8
8
  */
9
- /**
10
- * Determine deploy target for a function based on its explicit flag
11
- * and service compatibility.
12
- */
13
- function resolveDeployTarget(funcMeta, serverlessIncompatible) {
14
- // Explicit flag takes priority
15
- if (funcMeta.deploy === 'serverless')
16
- return 'serverless';
17
- if (funcMeta.deploy === 'server')
18
- return 'server';
19
- // Auto: check if any service is serverless-incompatible
20
- if (funcMeta.services?.services) {
21
- for (const svc of funcMeta.services.services) {
22
- if (serverlessIncompatible.has(svc))
23
- return 'server';
24
- }
25
- }
26
- return 'serverless';
27
- }
9
+ import { resolveDeployTarget, } from '@pikku/inspector';
28
10
  export function analyzeDeployment(state, options) {
29
11
  const serverlessIncompatible = new Set(options.serverlessIncompatible ?? []);
12
+ const workflowQueues = options.workflowQueues ?? true;
30
13
  const units = [];
31
14
  const queues = [];
32
15
  const scheduledTasks = [];
@@ -56,7 +39,11 @@ export function analyzeDeployment(state, options) {
56
39
  funcId === 'agentCaller' ||
57
40
  funcId === 'agentStreamCaller' ||
58
41
  funcId === 'agentApproveCaller' ||
59
- funcId === 'agentResumeCaller') {
42
+ funcId === 'agentResumeCaller' ||
43
+ funcId === 'getAgentThreads' ||
44
+ funcId === 'getAgentThreadMessages' ||
45
+ funcId === 'getAgentThreadRuns' ||
46
+ funcId === 'deleteAgentThread') {
60
47
  continue;
61
48
  }
62
49
  const handlers = [];
@@ -131,7 +118,7 @@ export function analyzeDeployment(state, options) {
131
118
  units.push({
132
119
  name: toSafeKebab(funcId),
133
120
  role: 'function',
134
- target: resolveDeployTarget(funcMeta, serverlessIncompatible),
121
+ target: resolveDeployTarget(funcMeta, serverlessIncompatible, funcId),
135
122
  functionIds: [funcId],
136
123
  services: collectServicesForFunction(funcMeta),
137
124
  dependsOn: [],
@@ -186,7 +173,14 @@ export function analyzeDeployment(state, options) {
186
173
  tags: agentMeta.tags ?? [],
187
174
  });
188
175
  agents.push({
189
- name: agentMeta.name,
176
+ // The registry KEY (export name, e.g. `kanbanAgent`), NOT the
177
+ // human-facing `agentMeta.name` (e.g. `kanban-agent`). Routes,
178
+ // `addAIAgent(...)`, and the inspector-state name filter all key off
179
+ // this identifier — per-unit codegen passes it to `--names`, and the
180
+ // filter matches it against the `agentsMeta` key. Using the human name
181
+ // here makes the filter prune the agent, so its registration never gets
182
+ // bundled into the deployed unit ("AI agent not found: <key>").
183
+ name: agentName,
190
184
  unitName,
191
185
  toolFunctionIds: toolIds,
192
186
  subAgentNames,
@@ -252,7 +246,7 @@ export function analyzeDeployment(state, options) {
252
246
  });
253
247
  }
254
248
  // ── Step 5: Workflows ──────────────────────────────────────────────
255
- buildWorkflows(state.workflows.graphMeta, functionsMeta, httpMeta, units, workflows, queues);
249
+ buildWorkflows(state.workflows.graphMeta, functionsMeta, httpMeta, units, workflows, queues, workflowQueues);
256
250
  // ── Step 6: Ensure function units exist for gateway dependencies ───
257
251
  // Gateways depend on function units. If a function is only used via
258
252
  // a gateway (not directly wired to HTTP/queue/cron), it still needs
@@ -269,7 +263,7 @@ export function analyzeDeployment(state, options) {
269
263
  units.push({
270
264
  name: dep,
271
265
  role: 'function',
272
- target: resolveDeployTarget(funcMeta, serverlessIncompatible),
266
+ target: resolveDeployTarget(funcMeta, serverlessIncompatible, funcId),
273
267
  functionIds: [funcId],
274
268
  services: collectServicesForFunction(funcMeta),
275
269
  dependsOn: [],
@@ -309,6 +303,36 @@ export function analyzeDeployment(state, options) {
309
303
  }
310
304
  }
311
305
  }
306
+ // ── Step 8: Scaffold workflow function units need workflow-state ──
307
+ // Scaffold endpoints like workflowStarter destructure { workflowService }
308
+ // and call rpc.startWorkflow / workflowService.runToCompletion. The
309
+ // function-meta inspector doesn't always surface those destructured
310
+ // services into funcMeta.services.services, so collectServicesForFunction
311
+ // returns [] and per-unit codegen omits workflow queue meta — the unit
312
+ // then falls back to the shared 'pikku-workflow-step-worker' queue name
313
+ // at runtime. Force the capability for the known scaffold ids so the
314
+ // queue meta is bundled and the runtime can resolve per-step queues.
315
+ const SCAFFOLD_WORKFLOW_FUNCS = new Set([
316
+ 'workflowStarter',
317
+ 'workflowRunner',
318
+ 'workflowStatusChecker',
319
+ 'workflowStatusStream',
320
+ 'workflowStatusStreamFull',
321
+ 'graphStarter',
322
+ ]);
323
+ for (const unit of units) {
324
+ if (unit.role !== 'function')
325
+ continue;
326
+ const hasScaffold = unit.functionIds.some((id) => SCAFFOLD_WORKFLOW_FUNCS.has(id));
327
+ if (!hasScaffold)
328
+ continue;
329
+ if (!unit.services.some((s) => s.capability === 'workflow-state')) {
330
+ unit.services.push({
331
+ capability: 'workflow-state',
332
+ sourceServiceName: 'workflowService',
333
+ });
334
+ }
335
+ }
312
336
  // ── Secrets & Variables ────────────────────────────────────────────
313
337
  const secrets = state.secrets.definitions.map((s) => ({
314
338
  secretId: s.secretId,
@@ -337,7 +361,7 @@ export function analyzeDeployment(state, options) {
337
361
  // ---------------------------------------------------------------------------
338
362
  // Workflow builder
339
363
  // ---------------------------------------------------------------------------
340
- function buildWorkflows(graphMeta, _functionsMeta, _httpMeta, units, workflows, queues) {
364
+ function buildWorkflows(graphMeta, _functionsMeta, _httpMeta, units, workflows, queues, workflowQueues) {
341
365
  for (const [_wfName, graph] of entries(graphMeta)) {
342
366
  const steps = [];
343
367
  const stepUnitNames = [];
@@ -355,13 +379,24 @@ function buildWorkflows(graphMeta, _functionsMeta, _httpMeta, units, workflows,
355
379
  functionId: node.rpcName,
356
380
  unitName: stepUnitName,
357
381
  });
382
+ // Every step gets its own unit (for log/metric isolation). The
383
+ // dispatch mechanism differs at runtime: async steps consume a
384
+ // dedicated queue; inline steps are invoked via CF dispatch
385
+ // namespace remote-call from the orchestrator.
358
386
  stepUnitNames.push(stepUnitName);
359
387
  }
360
388
  // Build orchestrator unit — no function code, just orchestration
361
389
  const orchUnitName = `wf-${toSafeKebab(graph.name)}`;
362
390
  const orchServices = [
363
391
  { capability: 'workflow-state', sourceServiceName: 'workflowService' },
364
- { capability: 'queue', sourceServiceName: 'queueService' },
392
+ ...(workflowQueues
393
+ ? [
394
+ {
395
+ capability: 'queue',
396
+ sourceServiceName: 'queueService',
397
+ },
398
+ ]
399
+ : []),
365
400
  ];
366
401
  // Concrete routes for this workflow via catch-all
367
402
  const wfRoutes = [
@@ -386,11 +421,14 @@ function buildWorkflows(graphMeta, _functionsMeta, _httpMeta, units, workflows,
386
421
  pikkuFuncId: `graphStart:${graph.name}`,
387
422
  },
388
423
  ];
389
- // Orchestrator queue — the orchestrator consumes from this
424
+ // Orchestrator queue — the orchestrator consumes from this. Only emitted
425
+ // when the provider's workflow runtime needs queue dispatch.
390
426
  const orchQueueName = `wf-orchestrator-${toSafeKebab(graph.name)}`;
391
427
  const orchHandlers = [
392
428
  { type: 'fetch', routes: wfRoutes },
393
- { type: 'queue', queueName: orchQueueName },
429
+ ...(workflowQueues
430
+ ? [{ type: 'queue', queueName: orchQueueName }]
431
+ : []),
394
432
  ];
395
433
  units.push({
396
434
  name: orchUnitName,
@@ -402,23 +440,25 @@ function buildWorkflows(graphMeta, _functionsMeta, _httpMeta, units, workflows,
402
440
  handlers: orchHandlers,
403
441
  tags: [],
404
442
  });
405
- queues.push({
406
- name: orchQueueName,
407
- consumerUnit: orchUnitName,
408
- consumerFunctionId: `pikkuWorkflowOrchestrator:${graph.name}`,
409
- });
410
- // Per-step queues — each step function worker consumes its own queue.
411
- // The step units may not exist yet (created in step 6), so we just
412
- // create queue definitions here. Step 7 wires them to units.
413
- for (const step of steps) {
414
- if (step.inline || !step.functionId)
415
- continue;
416
- const stepQueueName = `wf-step-${toSafeKebab(step.functionId)}`;
443
+ if (workflowQueues) {
417
444
  queues.push({
418
- name: stepQueueName,
419
- consumerUnit: toSafeKebab(step.functionId),
420
- consumerFunctionId: `pikkuWorkflowWorker:${step.functionId}`,
445
+ name: orchQueueName,
446
+ consumerUnit: orchUnitName,
447
+ consumerFunctionId: `pikkuWorkflowOrchestrator:${graph.name}`,
421
448
  });
449
+ // Per-step queues — each step function worker consumes its own queue.
450
+ // The step units may not exist yet (created in step 6), so we just
451
+ // create queue definitions here. Step 7 wires them to units.
452
+ for (const step of steps) {
453
+ if (step.inline || !step.functionId)
454
+ continue;
455
+ const stepQueueName = `wf-step-${toSafeKebab(step.functionId)}`;
456
+ queues.push({
457
+ name: stepQueueName,
458
+ consumerUnit: toSafeKebab(step.functionId),
459
+ consumerFunctionId: `pikkuWorkflowWorker:${step.functionId}`,
460
+ });
461
+ }
422
462
  }
423
463
  workflows.push({
424
464
  name: graph.name,
@@ -10,6 +10,7 @@ import { mkdir, writeFile, copyFile } from 'node:fs/promises';
10
10
  import { analyzeDeployment } from './analyzer/index.js';
11
11
  import { generatePerUnitCodegen } from './codegen/per-unit-codegen.js';
12
12
  import { bundleUnits } from './bundler/index.js';
13
+ import { generateServerEntrySource, SERVER_DOCKERFILE, SERVER_DOCKERIGNORE, } from './server-entry.js';
13
14
  const MERGED_SERVER_UNIT_NAME = 'pikku-server-container';
14
15
  const UNITS_DIR_NAME = 'units';
15
16
  const CONTAINER_DIR_NAME = 'container';
@@ -41,9 +42,11 @@ export async function runBuildPipeline(options) {
41
42
  const deployDir = options.deployDir ?? join(projectDir, '.deploy');
42
43
  const providerDir = join(deployDir, provider.deployDirName);
43
44
  // Step 1: Analyze
45
+ const workflowQueues = provider.workflowQueues ?? true;
44
46
  const manifest = analyzeDeployment(inspectorState, {
45
47
  projectId,
46
48
  serverlessIncompatible: options.serverlessIncompatible,
49
+ workflowQueues,
47
50
  });
48
51
  let bundled = [];
49
52
  let bundleErrors = [];
@@ -82,6 +85,7 @@ export async function runBuildPipeline(options) {
82
85
  define: provider.getDefine?.(),
83
86
  platform: provider.getPlatform?.(),
84
87
  format: provider.getFormat?.(),
88
+ noRequireShim: provider.getNoRequireShim?.(),
85
89
  });
86
90
  bundled = bundleResult.results;
87
91
  bundleErrors = bundleResult.errors;
@@ -114,6 +118,7 @@ export async function runBuildPipeline(options) {
114
118
  manifest: serverlessManifest,
115
119
  inspectorState,
116
120
  deployDir: unitsDir,
121
+ workflowQueues,
117
122
  onProgress: (unitName, status, error) => {
118
123
  if (status === 'start') {
119
124
  logger.info(` Codegen: ${unitName}...`);
@@ -149,6 +154,7 @@ export async function runBuildPipeline(options) {
149
154
  inspectorState,
150
155
  deployDir: containerDir,
151
156
  resolveUnitDir: () => containerDir,
157
+ workflowQueues,
152
158
  onProgress: (unitName, status, error) => {
153
159
  if (status === 'start')
154
160
  logger.info(` Codegen: ${unitName}...`);
@@ -168,7 +174,8 @@ export async function runBuildPipeline(options) {
168
174
  logger.info(`Codegen complete: ${unitPikkuDirs.size} units`);
169
175
  // Step 3: Generate entry points + Bundle
170
176
  logger.info('Bundling...');
171
- const entryFiles = new Map();
177
+ const serverlessEntryFiles = new Map();
178
+ const serverEntryFiles = new Map();
172
179
  for (const unit of manifest.units) {
173
180
  const pikkuDir = unitPikkuDirs.get(unit.name);
174
181
  if (!pikkuDir)
@@ -177,20 +184,66 @@ export async function runBuildPipeline(options) {
177
184
  const entryPath = join(unitDir, 'entry.ts');
178
185
  await mkdir(unitDir, { recursive: true });
179
186
  const ctx = getEntryContext(unitDir, pikkuDir, unit, inspectorState);
180
- const source = provider.generateEntrySource(ctx);
187
+ const source = unit.target === 'server'
188
+ ? generateServerEntrySource(ctx)
189
+ : provider.generateEntrySource(ctx);
181
190
  await writeFile(entryPath, source, 'utf-8');
182
- entryFiles.set(unit.name, entryPath);
191
+ if (unit.target === 'server') {
192
+ serverEntryFiles.set(unit.name, entryPath);
193
+ }
194
+ else {
195
+ serverlessEntryFiles.set(unit.name, entryPath);
196
+ }
183
197
  }
184
- const bundleResult = await bundleUnits(projectDir, manifest, entryFiles, providerDir, {
185
- externals: provider.getExternals?.(),
186
- aliases: provider.getAliases?.(),
187
- define: provider.getDefine?.(),
188
- platform: provider.getPlatform?.(),
189
- format: provider.getFormat?.(),
190
- resolveOutputDir: (unit) => unit.target === 'server' ? containerDir : join(unitsDir, unit.name),
191
- });
192
- bundled = bundleResult.results;
193
- bundleErrors = bundleResult.errors;
198
+ const aggregated = [];
199
+ const aggregatedErrors = [];
200
+ if (serverlessEntryFiles.size > 0) {
201
+ const serverlessManifestForBundle = {
202
+ ...manifest,
203
+ units: manifest.units.filter((u) => u.target !== 'server'),
204
+ };
205
+ const result = await bundleUnits(projectDir, serverlessManifestForBundle, serverlessEntryFiles, providerDir, {
206
+ externals: provider.getExternals?.(),
207
+ aliases: provider.getAliases?.(),
208
+ define: provider.getDefine?.(),
209
+ platform: provider.getPlatform?.(),
210
+ format: provider.getFormat?.(),
211
+ noRequireShim: provider.getNoRequireShim?.(),
212
+ resolveOutputDir: (unit) => join(unitsDir, unit.name),
213
+ });
214
+ aggregated.push(...result.results);
215
+ aggregatedErrors.push(...result.errors);
216
+ }
217
+ if (serverEntryFiles.size > 0) {
218
+ // Server bundles use `@pikku/node-http-server` (pure JS), so esbuild
219
+ // can inline everything except node builtins. The bundler still
220
+ // emits a package.json from the metafile; if a user pulls in a
221
+ // native module the dep extractor surfaces it and `npm install`
222
+ // inside the container picks it up.
223
+ const serverManifestForBundle = {
224
+ ...manifest,
225
+ units: manifest.units.filter((u) => u.target === 'server'),
226
+ };
227
+ const result = await bundleUnits(projectDir, serverManifestForBundle, serverEntryFiles, providerDir, {
228
+ externals: ['node:*'],
229
+ aliases: undefined,
230
+ define: undefined,
231
+ platform: 'node',
232
+ format: 'esm',
233
+ noRequireShim: false,
234
+ resolveOutputDir: () => containerDir,
235
+ });
236
+ aggregated.push(...result.results);
237
+ aggregatedErrors.push(...result.errors);
238
+ // Emit Dockerfile + .dockerignore alongside bundle.js for any
239
+ // orchestrator that wants to `docker build` the container directly.
240
+ if (result.results.length > 0) {
241
+ await writeFile(join(containerDir, 'Dockerfile'), SERVER_DOCKERFILE, 'utf-8');
242
+ await writeFile(join(containerDir, '.dockerignore'), SERVER_DOCKERIGNORE, 'utf-8');
243
+ }
244
+ }
245
+ bundled = aggregated;
246
+ bundleErrors = aggregatedErrors;
194
247
  attachBundleMetadata(manifest, bundled);
195
248
  logger.info(`Bundled ${bundled.length} units${bundleErrors.length > 0 ? ` (${bundleErrors.length} failed)` : ''}`);
196
249
  }
@@ -209,6 +262,13 @@ export async function runBuildPipeline(options) {
209
262
  await writeFile(infraPath, infraContent, 'utf-8');
210
263
  logger.info('Generated infrastructure manifest');
211
264
  }
265
+ if (provider.emitSideArtifacts) {
266
+ await provider.emitSideArtifacts({
267
+ buildDir: providerDir,
268
+ manifest,
269
+ logger,
270
+ });
271
+ }
212
272
  if (provider.generateProviderConfigs) {
213
273
  const providerConfigs = provider.generateProviderConfigs(manifest);
214
274
  for (const [filename, content] of providerConfigs) {
@@ -218,12 +278,17 @@ export async function runBuildPipeline(options) {
218
278
  }
219
279
  }
220
280
  const lockfileSrc = findLockfile(projectDir);
281
+ let configCount = 0;
221
282
  for (const unit of manifest.units) {
283
+ // Server units don't take per-unit provider configs (no wrangler.toml,
284
+ // etc.) — their runtime is the emitted Dockerfile + bundle.js. Skip
285
+ // both the provider config emit and the lockfile copy; the bundle is
286
+ // self-contained and the Docker build uses npm install on its own.
287
+ if (unit.target === 'server')
288
+ continue;
222
289
  const unitDir = provider.singleUnit
223
290
  ? join(providerDir, unit.name)
224
- : unit.target === 'server'
225
- ? containerDir
226
- : join(unitsDir, unit.name);
291
+ : join(unitsDir, unit.name);
227
292
  await mkdir(unitDir, { recursive: true });
228
293
  const configs = provider.generateUnitConfigs(unit, manifest, projectId);
229
294
  for (const [filename, content] of configs) {
@@ -232,8 +297,9 @@ export async function runBuildPipeline(options) {
232
297
  if (lockfileSrc) {
233
298
  await copyFile(lockfileSrc, join(unitDir, 'yarn.lock'));
234
299
  }
300
+ configCount++;
235
301
  }
236
- logger.info(`Generated ${manifest.units.length} provider config files`);
302
+ logger.info(`Generated ${configCount} provider config files`);
237
303
  return {
238
304
  manifest,
239
305
  providerDir,
@@ -27,5 +27,6 @@ export declare function bundleUnits(projectDir: string, manifest: DeploymentMani
27
27
  define?: Record<string, string>;
28
28
  platform?: 'node' | 'neutral' | 'browser';
29
29
  format?: 'esm' | 'cjs';
30
+ noRequireShim?: boolean;
30
31
  resolveOutputDir?: (unit: DeploymentUnit, baseOutputDir: string) => string;
31
32
  }): Promise<BundleOutput>;
@@ -104,13 +104,21 @@ async function bundleUnit(options) {
104
104
  break;
105
105
  dir = parent;
106
106
  }
107
- // For ESM + node platform, CJS deps may use require() for builtins.
108
- // esbuild wraps these as __require() which fails at runtime in ESM.
109
- // The banner shims require via createRequire so CJS builtins resolve.
107
+ // For ESM + node platform, CJS deps may use require() / __filename / __dirname
108
+ // for builtins or to locate native addons (the `bindings` package, used
109
+ // transitively by `pg` and many others, calls `__filename` directly). esbuild
110
+ // wraps require() as __require() which fails at runtime in ESM, and leaves
111
+ // `__filename` / `__dirname` as undefined references. The banner shims all
112
+ // three via createRequire / fileURLToPath so CJS builtins resolve and native-
113
+ // addon loaders find their .node files.
114
+ // Skipped when the provider opts out via `noRequireShim` (e.g. CF Workers
115
+ // — `import.meta.url` is undefined there, so the shim crashes at boot).
110
116
  const resolvedFormat = format ?? 'esm';
111
- const banner = resolvedFormat === 'esm' && (platform ?? 'node') === 'node'
117
+ const banner = resolvedFormat === 'esm' &&
118
+ (platform ?? 'node') === 'node' &&
119
+ !options.noRequireShim
112
120
  ? {
113
- js: `import { createRequire } from 'module'; const require = createRequire(import.meta.url);`,
121
+ js: `import { createRequire as __pikkuCreateRequire } from 'node:module'; import { fileURLToPath as __pikkuFileURLToPath } from 'node:url'; import { dirname as __pikkuDirname } from 'node:path'; const require = __pikkuCreateRequire(import.meta.url); const __filename = __pikkuFileURLToPath(import.meta.url); const __dirname = __pikkuDirname(__filename);`,
114
122
  }
115
123
  : undefined;
116
124
  const result = await build({
@@ -24,6 +24,14 @@ export interface PerUnitCodegenOptions {
24
24
  onProgress?: (unitName: string, status: 'start' | 'done' | 'error', error?: string) => void;
25
25
  /** Resolve unit output directory (defaults to <deployDir>/<unit-name>) */
26
26
  resolveUnitDir?: (unit: DeploymentUnit, baseDeployDir: string) => string;
27
+ /**
28
+ * Whether the deploy pipeline emits per-step workflow queues. When `false`
29
+ * the per-unit codegen filter does NOT include `wf-orchestrator-*` /
30
+ * `wf-step-*` queue names — they don't exist in the manifest, and pulling
31
+ * them through codegen would force the workflow runtime to register queue
32
+ * meta the provider doesn't actually use. Defaults to `true`.
33
+ */
34
+ workflowQueues?: boolean;
27
35
  }
28
36
  export interface PerUnitCodegenResult {
29
37
  /** Map of unit name -> path to the unit's .pikku directory */
@@ -34,7 +34,7 @@ function resolvePikkuBin() {
34
34
  * include both the function IDs and any wiring-level names (e.g. agent
35
35
  * names, channel names) that reference those functions.
36
36
  */
37
- function collectFilterNames(unit, manifest, inspectorState) {
37
+ function collectFilterNames(unit, manifest, inspectorState, workflowQueues) {
38
38
  const names = new Set(unit.functionIds);
39
39
  // Include catch-all scaffold routes based on unit contents
40
40
  const functionsMeta = inspectorState.functions.meta;
@@ -62,6 +62,10 @@ function collectFilterNames(unit, manifest, inspectorState) {
62
62
  names.add('agentStreamCaller');
63
63
  names.add('agentApproveCaller');
64
64
  names.add('agentResumeCaller');
65
+ names.add('getAgentThreads');
66
+ names.add('getAgentThreadMessages');
67
+ names.add('getAgentThreadRuns');
68
+ names.add('deleteAgentThread');
65
69
  // Include RPC catch-all for agent tool dispatch
66
70
  names.add('/rpc/:rpcName');
67
71
  for (const id of agentDef.toolFunctionIds)
@@ -99,6 +103,37 @@ function collectFilterNames(unit, manifest, inspectorState) {
99
103
  if (handler.type === 'scheduled')
100
104
  names.add(handler.taskName);
101
105
  }
106
+ // Function units with workflow-state capability (workflow-starter,
107
+ // workflow-runner, workflow-status-checker) call rpc.startWorkflow
108
+ // and look workflows up by name in the registry. The registry is
109
+ // populated when the user's `pikkuWorkflowGraph(...)` calls execute
110
+ // at module load — so the per-unit bootstrap needs the workflow
111
+ // wirings file. We only pull in the workflow NAME (graph structure
112
+ // only — nodes reference step functions by string ID), not the step
113
+ // function bodies; those stay in their own per-step units and are
114
+ // reached via queue dispatch at runtime.
115
+ const usesWorkflowState = unit.services.some((s) => s.capability === 'workflow-state');
116
+ if (usesWorkflowState) {
117
+ for (const wf of manifest.workflows) {
118
+ names.add(wf.name);
119
+ // Include orchestrator + per-step queue NAMES so queue meta gets
120
+ // emitted into this unit. The runtime needs these in
121
+ // `pikkuState('queue', 'meta')` to map a step's rpcName to its
122
+ // dedicated queue (otherwise it falls back to the shared
123
+ // 'pikku-workflow-step-worker' queue which doesn't exist in
124
+ // per-unit deploys). Names only — no function bodies bundled.
125
+ // Skipped when the provider doesn't use workflow queues — its
126
+ // workflow runtime dispatches steps natively.
127
+ if (workflowQueues) {
128
+ names.add(`wf-orchestrator-${toSafeKebab(wf.name)}`);
129
+ for (const step of wf.steps) {
130
+ if (step.functionId) {
131
+ names.add(`wf-step-${toSafeKebab(step.functionId)}`);
132
+ }
133
+ }
134
+ }
135
+ }
136
+ }
102
137
  break;
103
138
  }
104
139
  case 'workflow': {
@@ -122,12 +157,17 @@ function collectFilterNames(unit, manifest, inspectorState) {
122
157
  names.add('http:get:/workflow/:workflowName/status/:runId');
123
158
  names.add('http:get:/workflow/:workflowName/status/:runId/stream');
124
159
  names.add('http:post:/workflow/:workflowName/graph/:nodeId');
125
- // Queue names for orchestrator and step workers
126
- names.add(`wf-orchestrator-${toSafeKebab(wfDef.name)}`);
160
+ // Queue names for orchestrator and step workers — only when the
161
+ // provider's workflow runtime fans out via queues.
162
+ if (workflowQueues) {
163
+ names.add(`wf-orchestrator-${toSafeKebab(wfDef.name)}`);
164
+ }
127
165
  for (const step of wfDef.steps) {
128
166
  if (step.functionId) {
129
167
  names.add(step.functionId);
130
- names.add(`wf-step-${toSafeKebab(step.functionId)}`);
168
+ if (workflowQueues) {
169
+ names.add(`wf-step-${toSafeKebab(step.functionId)}`);
170
+ }
131
171
  }
132
172
  }
133
173
  }
@@ -149,6 +189,7 @@ function collectFilterNames(unit, manifest, inspectorState) {
149
189
  */
150
190
  export async function generatePerUnitCodegen(options) {
151
191
  const { projectDir, manifest, inspectorState, onProgress } = options;
192
+ const workflowQueues = options.workflowQueues ?? true;
152
193
  const baseDir = options.deployDir ?? join(projectDir, '.deploy');
153
194
  const pikkuBin = options.pikkuBin ?? resolvePikkuBin();
154
195
  const unitPikkuDirs = new Map();
@@ -162,7 +203,7 @@ export async function generatePerUnitCodegen(options) {
162
203
  await writeFile(stateFilePath, JSON.stringify(serialized), 'utf-8');
163
204
  // Generate codegen for each unit
164
205
  for (const unit of manifest.units) {
165
- const filterNames = collectFilterNames(unit, manifest, inspectorState);
206
+ const filterNames = collectFilterNames(unit, manifest, inspectorState, workflowQueues);
166
207
  if (filterNames.length === 0) {
167
208
  errors.push({
168
209
  unitName: unit.name,
@@ -39,6 +39,21 @@ export interface ProviderAdapter {
39
39
  * Used by standalone adapter.
40
40
  */
41
41
  readonly singleUnit?: boolean;
42
+ /**
43
+ * Whether the provider's workflow runtime needs synthesized per-step
44
+ * dispatch queues. Defaults to `true`.
45
+ *
46
+ * - `true` (default): The deploy pipeline synthesizes a `wf-orchestrator-*`
47
+ * queue and a `wf-step-*` queue for every workflow step, plus producer
48
+ * bindings, so the workflow runtime can fan out via queues.
49
+ * - `false`: No synthetic workflow queues are emitted into the manifest
50
+ * or per-unit codegen. Use this when the provider's workflow runtime
51
+ * dispatches steps natively (e.g. Cloudflare's Durable-Object-based
52
+ * `CloudflareWorkflowService`, where the orchestrator DO advances
53
+ * steps directly without a queue hop). Queues created via explicit
54
+ * `wireQueue(...)` user code are unaffected.
55
+ */
56
+ readonly workflowQueues?: boolean;
42
57
  /**
43
58
  * Generate the entry file source for a deployment unit.
44
59
  * Called once per unit.
@@ -78,11 +93,30 @@ export interface ProviderAdapter {
78
93
  * pkg requires 'cjs' for standalone binaries.
79
94
  */
80
95
  getFormat?(): 'esm' | 'cjs';
96
+ /**
97
+ * Skip the createRequire banner. CF Workers should return true —
98
+ * `import.meta.url` is undefined there and the banner crashes at boot.
99
+ */
100
+ getNoRequireShim?(): boolean;
81
101
  /**
82
102
  * Generate additional provider-level config files (e.g. serverless.yml).
83
103
  * Returns a map of filename → content to write into the deploy directory.
84
104
  */
85
105
  generateProviderConfigs?(manifest: DeploymentManifest): Map<string, string>;
106
+ /**
107
+ * Emit any provider-specific artifacts that aren't tied to a single user
108
+ * unit — e.g. a synthesized proxy Worker that fronts a CF Container.
109
+ * Called after the infra manifest is written so providers can read it
110
+ * and key off resources that were provisioned in earlier steps.
111
+ */
112
+ emitSideArtifacts?(options: {
113
+ buildDir: string;
114
+ manifest: DeploymentManifest;
115
+ logger: {
116
+ info(msg: string): void;
117
+ error(msg: string): void;
118
+ };
119
+ }): Promise<void>;
86
120
  /**
87
121
  * Deploy the built artifacts to the provider.
88
122
  * Optional — if not implemented, the CLI just outputs the build directory.
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Provider-agnostic Node server entry generator for `target: 'server'` units.
3
+ *
4
+ * Produces a `node:http`-based HTTP entry built on `@pikku/node-http-server`
5
+ * — the same runtime `pikku dev` uses. Containers sit behind something
6
+ * (Cloudflare Workers, a load balancer) so raw uWS throughput isn't
7
+ * required; sharing the dev server keeps one HTTP path to maintain.
8
+ *
9
+ * The same bundle runs anywhere a Node process can run: CF Containers,
10
+ * fly.io, ECS, bare VM. Provider-specific config (Dockerfile, infra) is
11
+ * emitted by the provider adapter on top of this entry + bundle.js.
12
+ */
13
+ import type { EntryGenerationContext } from './provider-adapter.js';
14
+ export declare function generateServerEntrySource(ctx: EntryGenerationContext): string;
15
+ export declare const SERVER_DOCKERFILE = "# Generated by @pikku/cli \u2014 do not edit\nFROM node:22-slim\n\nRUN apt-get update \\\n && apt-get install -y --no-install-recommends tini ca-certificates \\\n && rm -rf /var/lib/apt/lists/*\n\nRUN groupadd -r pikku && useradd -r -g pikku -u 1001 pikku\n\nWORKDIR /app\n\n# Pikku bundles user code + first-party deps inline; only externalised deps\n# (typically empty for pure-JS apps) are listed in package.json. We ship no\n# lockfile because the bundle has already pinned everything via the\n# extracted exact-dependencies \u2014 `npm install --omit=dev` resolves the\n# leftover externals (if any) at build time.\nCOPY --chown=pikku:pikku package.json ./\nRUN npm install --omit=dev --no-audit --no-fund\n\nCOPY --chown=pikku:pikku bundle.js ./\n\nUSER pikku\nENV NODE_ENV=production\nENV PORT=8080\nEXPOSE 8080\n\nENTRYPOINT [\"/usr/bin/tini\", \"--\"]\nCMD [\"node\", \"bundle.js\"]\n";
16
+ export declare const SERVER_DOCKERIGNORE = "node_modules\n.git\n*.log\nmetafile.json\nexact-dependencies.json\n";