@pikku/cli 0.12.96 → 0.12.100

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 (423) hide show
  1. package/console-app/assets/abnfDiagram-VRR7QNED-Icjp9hnB.js +1 -0
  2. package/console-app/assets/arc-BfGls--L.js +1 -0
  3. package/console-app/assets/architecture-TIHT7OUA-C8l7I5Lm.js +1 -0
  4. package/console-app/assets/architectureDiagram-ZJ3FMSHR-CpnsLBns.js +36 -0
  5. package/console-app/assets/array-BifhSqXX.js +1 -0
  6. package/console-app/assets/blockDiagram-677ZJIJ3-ByKRMGSr.js +132 -0
  7. package/console-app/assets/c4Diagram-LMCZKHZV-CzJSbsUo.js +10 -0
  8. package/console-app/assets/channel-BgJ-Z0cx.js +1 -0
  9. package/console-app/assets/chunk-2Q5K7J3B-C1jixKkw.js +1 -0
  10. package/console-app/assets/chunk-32BRIVSS-D_tc4HCY.js +1 -0
  11. package/console-app/assets/chunk-52WLFC77-wkQkuUXG.js +10 -0
  12. package/console-app/assets/chunk-5VM5RSS4-ZNzvKenW.js +15 -0
  13. package/console-app/assets/chunk-7BUUIJ7U-Bb538aSH.js +1 -0
  14. package/console-app/assets/chunk-C7G6YPKG-BFW3xG3R.js +1 -0
  15. package/console-app/assets/chunk-EX3LRPZG-Car090Sw.js +231 -0
  16. package/console-app/assets/chunk-FWX5IMBZ-c2ud9kQ-.js +2 -0
  17. package/console-app/assets/chunk-HOUHSVGY-RYmQka5R.js +1 -0
  18. package/console-app/assets/chunk-ICXQ74PX-C-dqYC_9.js +2 -0
  19. package/console-app/assets/chunk-JWPE2WC7-DVXcaiue.js +1 -0
  20. package/console-app/assets/chunk-KEIR6QF5-DNzq6p3w.js +161 -0
  21. package/console-app/assets/chunk-MOJQB5TN-Cu3FUWwl.js +88 -0
  22. package/console-app/assets/chunk-OGEWGWER-Z7f1yArD.js +1 -0
  23. package/console-app/assets/chunk-PUDLZKDR-Bp68DuRj.js +156 -0
  24. package/console-app/assets/chunk-Q4XR5HBZ-CdKSYWZ4.js +70 -0
  25. package/console-app/assets/chunk-RYQCIY6F-9ISCAKm2.js +1 -0
  26. package/console-app/assets/chunk-V7JOEXUC-2EOc1nQB.js +206 -0
  27. package/console-app/assets/chunk-VAUOI2AC-DwKsbf70.js +1 -0
  28. package/console-app/assets/chunk-VR4S4FIN-BPvN0PUm.js +1 -0
  29. package/console-app/assets/chunk-WYO6CB5R-DOpurCTP.js +127 -0
  30. package/console-app/assets/chunk-XXDRQBXY-RuYSFsQb.js +1 -0
  31. package/console-app/assets/chunk-Y2CYZVJY-DsF7k-Jl.js +1 -0
  32. package/console-app/assets/chunk-ZGVPDNZ5-Bu2weVOL.js +62 -0
  33. package/console-app/assets/chunk-ZIRB5QZD-H-kepumB.js +32 -0
  34. package/console-app/assets/classDiagram-OUVF2IWQ-ohoLCI8g.js +1 -0
  35. package/console-app/assets/classDiagram-v2-EOCWNBFH-ohoLCI8g.js +1 -0
  36. package/console-app/assets/cose-bilkent-JH36ORCC-nau-QGCX.js +1 -0
  37. package/console-app/assets/cynefin-VYW2F7L2-BBw-E7lg.js +1 -0
  38. package/console-app/assets/cynefinDiagram-TSTJHNR4-BvnMvOvH.js +62 -0
  39. package/console-app/assets/cytoscape.esm-h6BdjjI9.js +321 -0
  40. package/console-app/assets/dagre-CXRCoUWR.js +1 -0
  41. package/console-app/assets/dagre-VKFMJZFB-CHEqPR29.js +4 -0
  42. package/console-app/assets/defaultLocale-C8Fc0cco.js +1 -0
  43. package/console-app/assets/diagram-FQU43EPY-JijKRWyb.js +3 -0
  44. package/console-app/assets/diagram-G47NLZAW-G5UsB31f.js +24 -0
  45. package/console-app/assets/diagram-NH7WQ7WH-BhuJ6fPu.js +24 -0
  46. package/console-app/assets/diagram-OA4YK3LP-DaUF-8N4.js +30 -0
  47. package/console-app/assets/diagram-WEI45ONY-wLsJIhoM.js +41 -0
  48. package/console-app/assets/dist-fbBkbDNG.js +1 -0
  49. package/console-app/assets/ebnfDiagram-CCIWWBDH-BZCEa3Dz.js +1 -0
  50. package/console-app/assets/erDiagram-Q63AITRT-4XoEUtEh.js +85 -0
  51. package/console-app/assets/eventmodeling-45OFAUF4-DZ7z4YJO.js +1 -0
  52. package/console-app/assets/flowDiagram-23GEKE2U-rd7-NwZT.js +1 -0
  53. package/console-app/assets/ganttDiagram-NO4QXBWP-BXU7pfq6.js +292 -0
  54. package/console-app/assets/gitGraph-TEB2WS4Q-BdMAmvpU.js +1 -0
  55. package/console-app/assets/gitGraphDiagram-IHSO6WYX-3Hn0zwZR.js +106 -0
  56. package/console-app/assets/graphlib-B8gBHxth.js +1 -0
  57. package/console-app/assets/{index-CyYHTGWZ.css → index-BXMjqLQ5.css} +1 -1
  58. package/console-app/assets/{index-CeQodYfg.js → index-Din2vBeb.js} +153 -165
  59. package/console-app/assets/info-DKCQHKI2-Dc_oQkp5.js +1 -0
  60. package/console-app/assets/infoDiagram-FWYZ7A6U-B3v4xCUn.js +2 -0
  61. package/console-app/assets/init-D6jRqBbL.js +1 -0
  62. package/console-app/assets/ishikawaDiagram-FXEZZL3T-DzWq9Vtp.js +70 -0
  63. package/console-app/assets/journeyDiagram-5HDEW3XC-C0buWi_a.js +139 -0
  64. package/console-app/assets/kanban-definition-HUTT4EX6-DRAN9HhV.js +89 -0
  65. package/console-app/assets/katex-Vhh-h91d.js +257 -0
  66. package/console-app/assets/line-UqgRNiAC.js +1 -0
  67. package/console-app/assets/linear-FTAGuk_3.js +1 -0
  68. package/console-app/assets/map-DsCK-0Cs.js +1 -0
  69. package/console-app/assets/mermaid-parser.core-DIHI27FL.js +7 -0
  70. package/console-app/assets/mermaid.core-D4q8kvcu.js +11 -0
  71. package/console-app/assets/mindmap-definition-LN4V7U3C-DN-_CNLb.js +96 -0
  72. package/console-app/assets/ordinal-hYBb2elL.js +1 -0
  73. package/console-app/assets/packet-7NZHBO7P-8a3PoQAb.js +1 -0
  74. package/console-app/assets/path-BWPyau1x.js +1 -0
  75. package/console-app/assets/pegDiagram-2B236MQR-Bh2MhzCN.js +1 -0
  76. package/console-app/assets/pie-RZYD4A2V-Bi6zbJDl.js +1 -0
  77. package/console-app/assets/pieDiagram-ENE6RG2P-D2Z0W5UU.js +39 -0
  78. package/console-app/assets/quadrantDiagram-ABIIQ3AL-DNOKka0p.js +7 -0
  79. package/console-app/assets/radar-I7S5WNFK-CAxa68Sg.js +1 -0
  80. package/console-app/assets/railroad-3IZDKUUU-CZb1usP7.js +1 -0
  81. package/console-app/assets/railroad-abnf-AHOZXSZD-DkQZciri.js +1 -0
  82. package/console-app/assets/railroad-ebnf-EBAXGLYW-CPBeASA9.js +1 -0
  83. package/console-app/assets/railroad-peg-LSFZ7HO6-CXEVIZ0g.js +1 -0
  84. package/console-app/assets/railroadDiagram-RFXS5EU6-B1K2hbTD.js +1 -0
  85. package/console-app/assets/requirementDiagram-TGXJPOKE-K8wcOO0Q.js +84 -0
  86. package/console-app/assets/rough.esm-CSKSodPl.js +1 -0
  87. package/console-app/assets/sankeyDiagram-HTMAVEWB-WBPBkgNx.js +40 -0
  88. package/console-app/assets/sequenceDiagram-DBY2YBRQ-Dz80qZZv.js +162 -0
  89. package/console-app/assets/sizeCapture-X5ZJPWSS-B0uUizjq.js +1 -0
  90. package/console-app/assets/src-CnJCXDL0.js +1 -0
  91. package/console-app/assets/stateDiagram-2N3HPSRC-DMur7lZf.js +1 -0
  92. package/console-app/assets/stateDiagram-v2-6OUMAXLB-BDgLCrot.js +1 -0
  93. package/console-app/assets/swimlanes-5IMT3BWC-BlLdYcPU.js +2 -0
  94. package/console-app/assets/swimlanesDiagram-G3AALYLV-CZ5rQIcE.js +8 -0
  95. package/console-app/assets/timeline-definition-FHXFAJF6-CBOit0JY.js +120 -0
  96. package/console-app/assets/treeView-QDETBFTQ-DM1i1ast.js +1 -0
  97. package/console-app/assets/treemap-6X3UGDF4-ACrBEfY6.js +1 -0
  98. package/console-app/assets/vennDiagram-L72KCM5P-BmeFWb5N.js +34 -0
  99. package/console-app/assets/wardley-OPB4EBWU-BpIbeh58.js +1 -0
  100. package/console-app/assets/wardleyDiagram-EHGQE667-CxL7Mv7y.js +78 -0
  101. package/console-app/assets/xychartDiagram-FW5EYKEG-DkV75xT2.js +7 -0
  102. package/console-app/index.html +2 -2
  103. package/dist/.pikku/agent/pikku-agent-types.gen.d.ts +1 -1
  104. package/dist/.pikku/auth/auth.types.d.ts +1 -1
  105. package/dist/.pikku/auth/auth.types.js +1 -1
  106. package/dist/.pikku/channel/pikku-channel-types.gen.d.ts +1 -1
  107. package/dist/.pikku/channel/pikku-channel-types.gen.js +1 -1
  108. package/dist/.pikku/cli/pikku-cli-channel.d.ts +11 -2
  109. package/dist/.pikku/cli/pikku-cli-channel.js +23 -8
  110. package/dist/.pikku/cli/pikku-cli-client.gen.d.ts +1 -1
  111. package/dist/.pikku/cli/pikku-cli-client.gen.js +36 -9
  112. package/dist/.pikku/cli/pikku-cli-contracts-meta.gen.d.ts +1 -1
  113. package/dist/.pikku/cli/pikku-cli-contracts-meta.gen.js +1 -1
  114. package/dist/.pikku/cli/pikku-cli-types.gen.d.ts +1 -1
  115. package/dist/.pikku/cli/pikku-cli-types.gen.js +1 -1
  116. package/dist/.pikku/cli/pikku-cli-wirings-meta.gen.js +2 -2
  117. package/dist/.pikku/cli/pikku-cli-wirings-meta.gen.json +7 -8
  118. package/dist/.pikku/cli/pikku-cli-wirings.gen.d.ts +1 -1
  119. package/dist/.pikku/cli/pikku-cli-wirings.gen.js +1 -1
  120. package/dist/.pikku/cli/pikku-cli.gen.d.ts +1 -1
  121. package/dist/.pikku/cli/pikku-cli.gen.js +18 -2
  122. package/dist/.pikku/console/pikku-node-types.gen.d.ts +1 -1
  123. package/dist/.pikku/function/pikku-function-types.gen.d.ts +24 -9
  124. package/dist/.pikku/function/pikku-function-types.gen.js +2 -2
  125. package/dist/.pikku/function/pikku-functions-meta.gen.js +2 -2
  126. package/dist/.pikku/function/pikku-functions-meta.gen.json +48 -39
  127. package/dist/.pikku/function/pikku-functions.gen.js +3 -3
  128. package/dist/.pikku/http/pikku-http-types.gen.d.ts +1 -1
  129. package/dist/.pikku/http/pikku-http-types.gen.js +1 -1
  130. package/dist/.pikku/mcp/pikku-mcp-types.gen.d.ts +1 -1
  131. package/dist/.pikku/mcp/pikku-mcp-types.gen.js +1 -1
  132. package/dist/.pikku/pikku-bootstrap-scenarios.gen.d.ts +1 -1
  133. package/dist/.pikku/pikku-bootstrap-scenarios.gen.js +1 -1
  134. package/dist/.pikku/pikku-bootstrap.gen.d.ts +1 -1
  135. package/dist/.pikku/pikku-bootstrap.gen.js +1 -1
  136. package/dist/.pikku/pikku-meta-service.gen.d.ts +1 -1
  137. package/dist/.pikku/pikku-meta-service.gen.js +1 -1
  138. package/dist/.pikku/pikku-services.gen.d.ts +2 -1
  139. package/dist/.pikku/pikku-services.gen.js +1 -0
  140. package/dist/.pikku/pikku-types.gen.d.ts +1 -1
  141. package/dist/.pikku/pikku-types.gen.js +1 -1
  142. package/dist/.pikku/queue/pikku-queue-types.gen.d.ts +1 -1
  143. package/dist/.pikku/queue/pikku-queue-types.gen.js +1 -1
  144. package/dist/.pikku/queue/pikku-queue-workers-wirings-meta.gen.js +2 -2
  145. package/dist/.pikku/queue/pikku-queue-workers-wirings.gen.d.ts +1 -1
  146. package/dist/.pikku/queue/pikku-queue-workers-wirings.gen.js +1 -1
  147. package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.js +2 -2
  148. package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.json +1 -1
  149. package/dist/.pikku/scenarios/pikku-scenario-functions-meta.gen.js +2 -2
  150. package/dist/.pikku/scenarios/pikku-scenario-functions.gen.d.ts +1 -1
  151. package/dist/.pikku/scenarios/pikku-scenario-wirings-meta.gen.js +2 -2
  152. package/dist/.pikku/scenarios/pikku-scenario-wirings.gen.d.ts +1 -1
  153. package/dist/.pikku/scenarios/schemas/register.gen.d.ts +1 -1
  154. package/dist/.pikku/scenarios/schemas/register.gen.js +1 -1
  155. package/dist/.pikku/scheduler/pikku-scheduler-types.gen.d.ts +1 -1
  156. package/dist/.pikku/scheduler/pikku-scheduler-types.gen.js +1 -1
  157. package/dist/.pikku/schemas/register.gen.js +3 -3
  158. package/dist/.pikku/schemas/schemas/DbResetInput.schema.json +1 -1
  159. package/dist/.pikku/schemas/schemas/{DbSeedInput.schema.json → PikkuVirtualUserFunctionsOutput.schema.json} +1 -1
  160. package/dist/.pikku/scopes/pikku-personas.gen.js +1 -1
  161. package/dist/.pikku/scopes/pikku-roles.gen.d.ts +1 -1
  162. package/dist/.pikku/scopes/pikku-scope-types.gen.d.ts +1 -1
  163. package/dist/.pikku/scopes/pikku-scope-types.gen.js +1 -1
  164. package/dist/.pikku/scopes/pikku-scopes.gen.d.ts +1 -1
  165. package/dist/.pikku/secrets/pikku-secret-types.gen.d.ts +1 -1
  166. package/dist/.pikku/secrets/pikku-secret-types.gen.js +1 -1
  167. package/dist/.pikku/secrets/pikku-secrets.gen.d.ts +1 -1
  168. package/dist/.pikku/secrets/pikku-secrets.gen.js +1 -1
  169. package/dist/.pikku/trigger/pikku-trigger-types.gen.d.ts +1 -1
  170. package/dist/.pikku/trigger/pikku-trigger-types.gen.js +1 -1
  171. package/dist/.pikku/variables/pikku-variable-types.gen.d.ts +1 -1
  172. package/dist/.pikku/variables/pikku-variable-types.gen.js +1 -1
  173. package/dist/.pikku/variables/pikku-variables.gen.d.ts +1 -1
  174. package/dist/.pikku/variables/pikku-variables.gen.js +1 -1
  175. package/dist/.pikku/workflow/meta/allWorkflow.gen.json +20 -14
  176. package/dist/.pikku/workflow/pikku-personas.gen.js +1 -1
  177. package/dist/.pikku/workflow/pikku-workflow-types.gen.d.ts +29 -13
  178. package/dist/.pikku/workflow/pikku-workflow-types.gen.js +1 -1
  179. package/dist/.pikku/workflow/pikku-workflow-wirings-meta.gen.js +2 -2
  180. package/dist/.pikku/workflow/pikku-workflow-wirings.gen.js +1 -1
  181. package/dist/bin/pikku-bin.mjs +2 -2
  182. package/dist/src/cli.wiring.js +8 -7
  183. package/dist/src/deploy/analyzer/analyzer.js +0 -6
  184. package/dist/src/deploy/codegen/per-unit-codegen.js +0 -3
  185. package/dist/src/deploy/server-entry.js +1 -1
  186. package/dist/src/fabric/fabric-commands.d.ts +26 -26
  187. package/dist/src/fabric/functions/add.function.d.ts +1 -1
  188. package/dist/src/fabric/functions/addon-verify.function.d.ts +1 -1
  189. package/dist/src/fabric/functions/db-schema.function.d.ts +1 -1
  190. package/dist/src/fabric/functions/deploy-list.function.d.ts +1 -1
  191. package/dist/src/fabric/functions/deploy-units.function.d.ts +1 -1
  192. package/dist/src/fabric/functions/deploy.function.d.ts +2 -2
  193. package/dist/src/fabric/functions/domains-add.function.d.ts +1 -1
  194. package/dist/src/fabric/functions/domains-list.function.d.ts +1 -1
  195. package/dist/src/fabric/functions/domains-remove.function.d.ts +1 -1
  196. package/dist/src/fabric/functions/errors.function.d.ts +1 -1
  197. package/dist/src/fabric/functions/init.function.d.ts +1 -1
  198. package/dist/src/fabric/functions/link.function.d.ts +1 -1
  199. package/dist/src/fabric/functions/llm-key.function.d.ts +1 -1
  200. package/dist/src/fabric/functions/login.function.d.ts +1 -1
  201. package/dist/src/fabric/functions/logs.function.d.ts +1 -1
  202. package/dist/src/fabric/functions/metrics.function.d.ts +1 -1
  203. package/dist/src/fabric/functions/publish.function.d.ts +1 -1
  204. package/dist/src/fabric/functions/rollback.function.d.ts +1 -1
  205. package/dist/src/fabric/functions/secrets-list.function.d.ts +1 -1
  206. package/dist/src/fabric/functions/secrets-rotate.function.d.ts +1 -1
  207. package/dist/src/fabric/functions/secrets-set.function.d.ts +1 -1
  208. package/dist/src/fabric/functions/smoke.function.d.ts +1 -1
  209. package/dist/src/fabric/functions/status.function.d.ts +1 -1
  210. package/dist/src/fabric/functions/trace.function.d.ts +1 -1
  211. package/dist/src/fabric/functions/validate.function.d.ts +1 -1
  212. package/dist/src/fabric/functions/validate.function.js +76 -176
  213. package/dist/src/functions/commands/all.d.ts +1 -1
  214. package/dist/src/functions/commands/audit.d.ts +1 -1
  215. package/dist/src/functions/commands/binary.d.ts +1 -1
  216. package/dist/src/functions/commands/bootstrap.d.ts +1 -1
  217. package/dist/src/functions/commands/db-audit.d.ts +1 -1
  218. package/dist/src/functions/commands/db-audit.js +1 -1
  219. package/dist/src/functions/commands/db-baseline.d.ts +1 -1
  220. package/dist/src/functions/commands/db-baseline.js +1 -1
  221. package/dist/src/functions/commands/db-check.d.ts +1 -1
  222. package/dist/src/functions/commands/db-check.js +6 -5
  223. package/dist/src/functions/commands/db-codegen.d.ts +1 -1
  224. package/dist/src/functions/commands/db-codegen.js +1 -1
  225. package/dist/src/functions/commands/db-export.d.ts +1 -1
  226. package/dist/src/functions/commands/db-generate.d.ts +1 -1
  227. package/dist/src/functions/commands/db-generate.js +1 -1
  228. package/dist/src/functions/commands/db-migrate.d.ts +1 -1
  229. package/dist/src/functions/commands/db-migrate.js +1 -1
  230. package/dist/src/functions/commands/db-reset.d.ts +15 -1
  231. package/dist/src/functions/commands/db-reset.js +18 -6
  232. package/dist/src/functions/commands/db-shared.d.ts +14 -0
  233. package/dist/src/functions/commands/deploy-apply.d.ts +1 -1
  234. package/dist/src/functions/commands/deploy-info.d.ts +1 -1
  235. package/dist/src/functions/commands/deploy-plan.d.ts +1 -1
  236. package/dist/src/functions/commands/dev.d.ts +1 -1
  237. package/dist/src/functions/commands/dev.js +2 -2
  238. package/dist/src/functions/commands/emails-init.d.ts +1 -1
  239. package/dist/src/functions/commands/enable.d.ts +8 -8
  240. package/dist/src/functions/commands/import-n8n.d.ts +1 -1
  241. package/dist/src/functions/commands/info.d.ts +4 -4
  242. package/dist/src/functions/commands/knowledge-index.d.ts +1 -1
  243. package/dist/src/functions/commands/knowledge-validate.d.ts +1 -1
  244. package/dist/src/functions/commands/login.d.ts +3 -3
  245. package/dist/src/functions/commands/meta.d.ts +19 -19
  246. package/dist/src/functions/commands/new-addon.d.ts +1 -1
  247. package/dist/src/functions/commands/new-addon.js +2 -2
  248. package/dist/src/functions/commands/new-function.d.ts +1 -1
  249. package/dist/src/functions/commands/new-middleware.d.ts +1 -1
  250. package/dist/src/functions/commands/new-permission.d.ts +1 -1
  251. package/dist/src/functions/commands/new-wiring.d.ts +1 -1
  252. package/dist/src/functions/commands/persona-sync.d.ts +2 -2
  253. package/dist/src/functions/commands/persona-sync.js +1 -1
  254. package/dist/src/functions/commands/persona.d.ts +2 -2
  255. package/dist/src/functions/commands/persona.js +16 -18
  256. package/dist/src/functions/commands/pikku-command-bootstrap.d.ts +1 -1
  257. package/dist/src/functions/commands/pikku-command-summary.d.ts +1 -1
  258. package/dist/src/functions/commands/roles-audit.d.ts +1 -1
  259. package/dist/src/functions/commands/roles-prune.d.ts +1 -1
  260. package/dist/src/functions/commands/scenario-ladder.js +1 -1
  261. package/dist/src/functions/commands/scenario.d.ts +2 -2
  262. package/dist/src/functions/commands/scenario.js +40 -11
  263. package/dist/src/functions/commands/scopes-audit.d.ts +1 -1
  264. package/dist/src/functions/commands/scopes-prune.d.ts +1 -1
  265. package/dist/src/functions/commands/scopes-shared.d.ts +4 -0
  266. package/dist/src/functions/commands/scopes-shared.js +1 -1
  267. package/dist/src/functions/commands/serve.d.ts +1 -1
  268. package/dist/src/functions/commands/serve.js +2 -2
  269. package/dist/src/functions/commands/skills.d.ts +2 -2
  270. package/dist/src/functions/commands/versions-check.d.ts +1 -1
  271. package/dist/src/functions/commands/versions-check.js +3 -3
  272. package/dist/src/functions/commands/versions-init.d.ts +1 -1
  273. package/dist/src/functions/commands/versions-update.d.ts +1 -1
  274. package/dist/src/functions/commands/watch.d.ts +1 -1
  275. package/dist/src/functions/commands/workspace-validate.d.ts +1 -1
  276. package/dist/src/functions/db/annotation-parser.d.ts +14 -0
  277. package/dist/src/functions/db/annotation-parser.js +50 -2
  278. package/dist/src/functions/db/better-auth-schema.js +2 -1
  279. package/dist/src/functions/db/db-codegen.d.ts +12 -0
  280. package/dist/src/functions/db/db-codegen.js +149 -16
  281. package/dist/src/functions/db/local-db.d.ts +87 -6
  282. package/dist/src/functions/db/local-db.js +202 -35
  283. package/dist/src/functions/db/sqlite/dev-seed.d.ts +12 -0
  284. package/dist/src/functions/db/sqlite/dev-seed.js +23 -0
  285. package/dist/src/functions/db/sqlite/sqlite-runtime-bun.js +1 -1
  286. package/dist/src/functions/runtimes/fetch/index.d.ts +1 -1
  287. package/dist/src/functions/runtimes/nextjs/pikku-command-nextjs.d.ts +1 -1
  288. package/dist/src/functions/runtimes/tanstack-start/pikku-command-tanstack-start.d.ts +1 -1
  289. package/dist/src/functions/runtimes/websocket/pikku-command-websocket-typed.d.ts +1 -1
  290. package/dist/src/functions/validate/bootstrap-checks.d.ts +19 -0
  291. package/dist/src/functions/validate/bootstrap-checks.js +90 -0
  292. package/dist/src/functions/validate/persona-checks.d.ts +24 -0
  293. package/dist/src/functions/validate/persona-checks.js +136 -0
  294. package/dist/src/functions/validate/scenario-file-checks.d.ts +17 -0
  295. package/dist/src/functions/validate/scenario-file-checks.js +123 -0
  296. package/dist/src/functions/validate/shared-checks.d.ts +59 -0
  297. package/dist/src/functions/validate/shared-checks.js +311 -0
  298. package/dist/src/functions/validate/workspace-validate.d.ts +1 -2
  299. package/dist/src/functions/validate/workspace-validate.js +4 -196
  300. package/dist/src/functions/wirings/ai-agent/pikku-command-ai-agent-types.d.ts +1 -1
  301. package/dist/src/functions/wirings/ai-agent/pikku-command-ai-agent.d.ts +1 -1
  302. package/dist/src/functions/wirings/ai-agent/pikku-command-ai-agent.js +1 -1
  303. package/dist/src/functions/wirings/ai-agent/pikku-command-public-agent.d.ts +1 -1
  304. package/dist/src/functions/wirings/auth/pikku-command-auth.d.ts +1 -1
  305. package/dist/src/functions/wirings/auth/serialize-auth-gen.js +16 -1
  306. package/dist/src/functions/wirings/auth/serialize-auth-types.d.ts +3 -1
  307. package/dist/src/functions/wirings/auth/serialize-auth-types.js +3 -1
  308. package/dist/src/functions/wirings/channels/pikku-channels.d.ts +1 -1
  309. package/dist/src/functions/wirings/channels/pikku-channels.js +1 -1
  310. package/dist/src/functions/wirings/channels/pikku-command-channel-types.d.ts +1 -1
  311. package/dist/src/functions/wirings/channels/pikku-command-channels-map.d.ts +1 -1
  312. package/dist/src/functions/wirings/channels/pikku-command-channels.d.ts +1 -1
  313. package/dist/src/functions/wirings/channels/pikku-command-channels.js +1 -1
  314. package/dist/src/functions/wirings/channels/serialize-typed-channel-map.js +10 -2
  315. package/dist/src/functions/wirings/cli/pikku-command-cli-entry.d.ts +1 -1
  316. package/dist/src/functions/wirings/cli/pikku-command-cli-entry.js +9 -4
  317. package/dist/src/functions/wirings/cli/pikku-command-cli-types.d.ts +1 -1
  318. package/dist/src/functions/wirings/cli/pikku-command-cli.d.ts +1 -1
  319. package/dist/src/functions/wirings/cli/pikku-command-cli.js +1 -1
  320. package/dist/src/functions/wirings/cli/serialize-channel-cli-client.js +32 -10
  321. package/dist/src/functions/wirings/cli/serialize-channel-cli.js +4 -4
  322. package/dist/src/functions/wirings/cli/serialize-cli-entrypoint-guard.d.ts +12 -0
  323. package/dist/src/functions/wirings/cli/serialize-cli-entrypoint-guard.js +28 -0
  324. package/dist/src/functions/wirings/cli/serialize-local-cli-bootstrap.js +4 -1
  325. package/dist/src/functions/wirings/console/pikku-command-console-functions.d.ts +1 -1
  326. package/dist/src/functions/wirings/console/pikku-command-node-types.d.ts +1 -1
  327. package/dist/src/functions/wirings/console/pikku-command-nodes-meta.d.ts +1 -1
  328. package/dist/src/functions/wirings/console/serialize-console-functions.js +1 -1
  329. package/dist/src/functions/wirings/credentials/pikku-command-credentials.d.ts +1 -1
  330. package/dist/src/functions/wirings/emails/pikku-command-emails.d.ts +1 -1
  331. package/dist/src/functions/wirings/functions/pikku-command-addon-types.d.ts +1 -1
  332. package/dist/src/functions/wirings/functions/pikku-command-function-types-split.d.ts +1 -1
  333. package/dist/src/functions/wirings/functions/pikku-command-function-types.d.ts +1 -1
  334. package/dist/src/functions/wirings/functions/pikku-command-functions.d.ts +1 -1
  335. package/dist/src/functions/wirings/functions/pikku-command-functions.js +1 -1
  336. package/dist/src/functions/wirings/functions/pikku-command-services.d.ts +1 -1
  337. package/dist/src/functions/wirings/functions/schemas.d.ts +1 -1
  338. package/dist/src/functions/wirings/functions/serialize-addon-types.js +1 -1
  339. package/dist/src/functions/wirings/functions/serialize-function-types.js +37 -9
  340. package/dist/src/functions/wirings/gateway/pikku-command-gateway.d.ts +1 -1
  341. package/dist/src/functions/wirings/graph/pikku-command-graph-wirings.d.ts +1 -1
  342. package/dist/src/functions/wirings/http/pikku-command-http-map.d.ts +1 -1
  343. package/dist/src/functions/wirings/http/pikku-command-http-routes.d.ts +1 -1
  344. package/dist/src/functions/wirings/http/pikku-command-http-routes.js +1 -1
  345. package/dist/src/functions/wirings/http/pikku-command-http-types.d.ts +1 -1
  346. package/dist/src/functions/wirings/http/pikku-command-openapi.d.ts +1 -1
  347. package/dist/src/functions/wirings/http/pikku-http-routes.d.ts +1 -1
  348. package/dist/src/functions/wirings/http/pikku-http-routes.js +1 -1
  349. package/dist/src/functions/wirings/mcp/pikku-command-mcp-json.d.ts +1 -1
  350. package/dist/src/functions/wirings/mcp/pikku-command-mcp-types.d.ts +1 -1
  351. package/dist/src/functions/wirings/mcp/pikku-command-mcp.d.ts +1 -1
  352. package/dist/src/functions/wirings/mcp/pikku-command-mcp.js +1 -1
  353. package/dist/src/functions/wirings/middleware/pikku-command-middleware.d.ts +1 -1
  354. package/dist/src/functions/wirings/package/pikku-command-package-types.d.ts +3 -3
  355. package/dist/src/functions/wirings/package/pikku-command-package.d.ts +1 -1
  356. package/dist/src/functions/wirings/package/serialize-package.js +1 -1
  357. package/dist/src/functions/wirings/permissions/pikku-command-permissions.d.ts +1 -1
  358. package/dist/src/functions/wirings/personas/personas-secrets-file.d.ts +8 -0
  359. package/dist/src/functions/wirings/personas/personas-secrets-file.js +9 -0
  360. package/dist/src/functions/wirings/personas/pikku-command-personas.d.ts +1 -1
  361. package/dist/src/functions/wirings/personas/pikku-command-personas.js +14 -0
  362. package/dist/src/functions/wirings/personas/serialize-personas-secrets.d.ts +16 -0
  363. package/dist/src/functions/wirings/personas/serialize-personas-secrets.js +34 -0
  364. package/dist/src/functions/wirings/queue/pikku-command-queue-map.d.ts +1 -1
  365. package/dist/src/functions/wirings/queue/pikku-command-queue-service.d.ts +1 -1
  366. package/dist/src/functions/wirings/queue/pikku-command-queue-types.d.ts +1 -1
  367. package/dist/src/functions/wirings/queue/pikku-command-queue.d.ts +1 -1
  368. package/dist/src/functions/wirings/queue/pikku-queue-map.d.ts +1 -1
  369. package/dist/src/functions/wirings/queue/pikku-queue.d.ts +1 -1
  370. package/dist/src/functions/wirings/queue/serialize-queue-map.js +2 -1
  371. package/dist/src/functions/wirings/queue/serialize-queue-wrapper.js +2 -1
  372. package/dist/src/functions/wirings/realtime/pikku-command-events-scaffold.d.ts +1 -1
  373. package/dist/src/functions/wirings/realtime/pikku-command-realtime.d.ts +1 -1
  374. package/dist/src/functions/wirings/roles/pikku-command-roles.d.ts +1 -1
  375. package/dist/src/functions/wirings/rpc/pikku-command-public-rpc.d.ts +1 -1
  376. package/dist/src/functions/wirings/rpc/pikku-command-react-query.d.ts +1 -1
  377. package/dist/src/functions/wirings/rpc/pikku-command-remote-rpc.d.ts +1 -1
  378. package/dist/src/functions/wirings/rpc/pikku-command-rpc-client.d.ts +1 -1
  379. package/dist/src/functions/wirings/rpc/pikku-command-rpc-map.d.ts +3 -3
  380. package/dist/src/functions/wirings/rpc/pikku-command-rpc.d.ts +1 -1
  381. package/dist/src/functions/wirings/rpc/pikku-command-rpc.js +1 -1
  382. package/dist/src/functions/wirings/scenarios/register-scenario-instrumentation.js +1 -1
  383. package/dist/src/functions/wirings/scenarios/serialize-scenario-meta.js +2 -2
  384. package/dist/src/functions/wirings/scheduler/pikku-command-scheduler-types.d.ts +1 -1
  385. package/dist/src/functions/wirings/scheduler/pikku-command-scheduler.d.ts +1 -1
  386. package/dist/src/functions/wirings/scopes/pikku-command-scopes.d.ts +1 -1
  387. package/dist/src/functions/wirings/secrets/pikku-command-secrets.d.ts +1 -1
  388. package/dist/src/functions/wirings/triggers/pikku-command-trigger-types.d.ts +1 -1
  389. package/dist/src/functions/wirings/triggers/pikku-command-trigger.d.ts +1 -1
  390. package/dist/src/functions/wirings/triggers/serialize-trigger-meta.js +2 -2
  391. package/dist/src/functions/wirings/user-admin/pikku-command-user-admin-functions.d.ts +1 -1
  392. package/dist/src/functions/wirings/variables/pikku-command-variables.d.ts +1 -1
  393. package/dist/src/functions/wirings/virtual-user/pikku-command-virtual-user-functions.d.ts +1 -0
  394. package/dist/src/functions/wirings/virtual-user/pikku-command-virtual-user-functions.js +42 -0
  395. package/dist/src/functions/wirings/virtual-user/serialize-virtual-user-functions.d.ts +28 -0
  396. package/dist/src/functions/wirings/virtual-user/serialize-virtual-user-functions.js +439 -0
  397. package/dist/src/functions/wirings/webhook/pikku-command-webhook.d.ts +1 -1
  398. package/dist/src/functions/wirings/workflow/pikku-command-workflow-routes.d.ts +1 -1
  399. package/dist/src/functions/wirings/workflow/pikku-command-workflow.d.ts +1 -1
  400. package/dist/src/functions/wirings/workflow/serialize-scenario-step-map.js +2 -2
  401. package/dist/src/functions/wirings/workflow/serialize-workflow-meta.js +2 -2
  402. package/dist/src/functions/wirings/workflow/serialize-workflow-routes.js +15 -32
  403. package/dist/src/functions/wirings/workflow/serialize-workflow-types.js +36 -23
  404. package/dist/src/functions/workflows/all.workflow.js +49 -16
  405. package/dist/src/server/bun-server-runner.d.ts +2 -2
  406. package/dist/src/server/bun-server-runner.js +5 -1
  407. package/dist/src/services/cli-logger.service.d.ts +28 -16
  408. package/dist/src/services/cli-logger.service.js +25 -16
  409. package/dist/src/services.d.ts +1 -1
  410. package/dist/src/services.js +8 -0
  411. package/dist/src/utils/file-import-path.js +9 -0
  412. package/dist/src/utils/pikku-cli-config.js +7 -0
  413. package/dist/src/utils/resolve-personas.d.ts +4 -9
  414. package/dist/src/utils/resolve-personas.js +4 -15
  415. package/dist/src/utils/serialize-meta-ts.js +1 -1
  416. package/dist/tsconfig.tsbuildinfo +1 -1
  417. package/package.json +13 -13
  418. package/dist/.pikku/schemas/schemas/BootstrapInput.schema.json +0 -1
  419. package/dist/.pikku/schemas/schemas/PikkuCLIConfig.schema.json +0 -1
  420. package/dist/src/functions/commands/db-seed.d.ts +0 -1
  421. package/dist/src/functions/commands/db-seed.js +0 -24
  422. package/dist/src/functions/db/sqlite/seed.d.ts +0 -11
  423. package/dist/src/functions/db/sqlite/seed.js +0 -22
@@ -0,0 +1,439 @@
1
+ /**
2
+ * Generate the virtual-user functions into the project scaffold: start a run,
3
+ * read one back, and the sessionless function that does the work.
4
+ *
5
+ * Scaffolded rather than shipped in an addon because the whole feature is
6
+ * derived from what the project already generates — its personas, its function
7
+ * meta, its scenarios — so there is nothing to configure and nothing to author.
8
+ * `pikku persona run` does the same thing from a terminal; this is the same run
9
+ * started over RPC, from CI or from a console, with the result kept.
10
+ *
11
+ * A virtual user is NOT a workflow and NOT a queued job. It explores, so no two
12
+ * attempts take the same steps and there is nothing to replay; and the run
13
+ * record already carries the progress a queue would only be holding on the way
14
+ * here. So `runVirtualUser` writes the record, kicks the run off without
15
+ * awaiting it, and returns the id. The one cost is stated on the record: a
16
+ * restart mid-run strands it at `running`.
17
+ *
18
+ * Emitted as two files. The schemas are zod, and the inspector reads a zod
19
+ * schema by importing the module that declares it — which it cannot do for the
20
+ * functions file, whose relative pikku-types import per-unit deploy codegen
21
+ * rewrites. Keeping the schemas in a sibling module that imports nothing but
22
+ * zod sidesteps that entirely.
23
+ */
24
+ export const serializeVirtualUserFunctions = (pathToPikkuTypes, pathToPersonas, requireAuth = true) => {
25
+ const authFlag = requireAuth ? 'true' : 'false';
26
+ const schemas = `/**
27
+ * Auto-generated virtual user schemas
28
+ * Do not edit manually - regenerate with 'npx pikku'
29
+ */
30
+ import { z } from 'zod'
31
+
32
+ /** Every disposition \`DISPOSITIONS\` declares. */
33
+ export const Disposition = z.enum([
34
+ 'realistic',
35
+ 'careless',
36
+ 'newcomer',
37
+ 'stale',
38
+ 'auditor',
39
+ 'adversarial',
40
+ 'accountable',
41
+ ])
42
+
43
+ export const RunVirtualUserInput = z.object({
44
+ /** A persona id from \`definePersonas()\`. */
45
+ persona: z.string().min(1),
46
+ /**
47
+ * Situational goals in the caller's own words, run alongside the intents
48
+ * derived from the app's scenarios. Appended to what the persona durably
49
+ * wants, never a replacement — a run that replaces their goals is not them.
50
+ */
51
+ goals: z.array(z.string().min(1)).max(20).optional(),
52
+ /**
53
+ * Ids and slugs from an earlier run, replayed as this user's notes on turn
54
+ * one. The point of a \`stale\` run: some of them no longer resolve, and what
55
+ * the product does about that is the thing being tested.
56
+ */
57
+ memory: z.record(z.string(), z.string()).optional(),
58
+ /** Overrides the persona's declared disposition for this run only. */
59
+ disposition: Disposition.optional(),
60
+ budget: z
61
+ .object({
62
+ steps: z.number().int().min(1).max(500).optional(),
63
+ mutations: z.number().int().min(0).max(500).optional(),
64
+ durationMs: z.number().int().min(1000).max(3_600_000).optional(),
65
+ })
66
+ .optional(),
67
+ /** Fixed seed, so a run replays into the same finding. */
68
+ seed: z.number().int().optional(),
69
+ })
70
+
71
+ export const RunVirtualUserOutput = z.object({
72
+ runId: z.string(),
73
+ })
74
+
75
+ export const GetVirtualUserRunInput = z.object({
76
+ runId: z.string(),
77
+ })
78
+
79
+ /**
80
+ * What the user noticed. \`kind\` is a plain string rather than an enum of
81
+ * today's finding kinds: a run that turns up something new should be readable
82
+ * by a client built before that kind existed.
83
+ */
84
+ export const Finding = z.object({
85
+ kind: z.string(),
86
+ detail: z.string(),
87
+ rpcName: z.string().optional(),
88
+ status: z.number().optional(),
89
+ intentId: z.string().optional(),
90
+ /** Step index within the run, so the transcript can be replayed to here. */
91
+ step: z.number(),
92
+ })
93
+
94
+ export const GetVirtualUserRunOutput = z.object({
95
+ runId: z.string(),
96
+ persona: z.string(),
97
+ disposition: Disposition,
98
+ seed: z.number(),
99
+ status: z.enum(['running', 'completed', 'failed']),
100
+ goals: z.array(z.string()),
101
+ memory: z.record(z.string(), z.string()),
102
+ findings: z.array(Finding),
103
+ /** Steps, calls, mutations, tokens and elapsed time, as the engine counted them. */
104
+ tally: z.record(z.string(), z.unknown()).nullable(),
105
+ stoppedBy: z.string().nullable(),
106
+ error: z.string().nullable(),
107
+ createdAt: z.string(),
108
+ finishedAt: z.string().nullable(),
109
+ })
110
+
111
+ /** The internal dispatch payload — everything the run was resolved down to. */
112
+ export const ExecuteVirtualUserRunInput = z.object({
113
+ runId: z.string(),
114
+ persona: z.string(),
115
+ disposition: Disposition,
116
+ goals: z.array(z.string()),
117
+ memory: z.record(z.string(), z.string()),
118
+ budget: z
119
+ .object({
120
+ steps: z.number().optional(),
121
+ mutations: z.number().optional(),
122
+ durationMs: z.number().optional(),
123
+ })
124
+ .optional(),
125
+ seed: z.number(),
126
+ })
127
+
128
+ export const ExecuteVirtualUserRunOutput = z.object({
129
+ findings: z.number(),
130
+ })
131
+ `;
132
+ const functions = `/**
133
+ * Auto-generated virtual user functions
134
+ * Do not edit manually - regenerate with 'npx pikku'
135
+ */
136
+ import { pikkuFunc, pikkuSessionlessFunc, defineScope } from '${pathToPikkuTypes}'
137
+ import {
138
+ personaVirtualUserTarget,
139
+ prepareVirtualUserRun,
140
+ runVirtualUser as runVirtualUserEngine,
141
+ PRODUCTION_DISPOSITION,
142
+ type SchemaMap,
143
+ type VirtualUserDisposition,
144
+ } from '@pikku/core/virtual-user'
145
+ import { createPersonas, personaConfigs } from '${pathToPersonas}'
146
+ import {
147
+ ExecuteVirtualUserRunInput,
148
+ ExecuteVirtualUserRunOutput,
149
+ GetVirtualUserRunInput,
150
+ GetVirtualUserRunOutput,
151
+ RunVirtualUserInput,
152
+ RunVirtualUserOutput,
153
+ } from './virtual-user.schemas.gen.js'
154
+
155
+ defineScope({
156
+ virtualUser: {
157
+ displayName: 'Virtual Users',
158
+ description: 'Run personas against this application and read what they found',
159
+ scopes: {
160
+ run: { description: 'Start a virtual user run' },
161
+ read: { description: "Read a run's findings" },
162
+ },
163
+ },
164
+ })
165
+
166
+ /**
167
+ * Where the virtual user signs in. Its own variable rather than a guess at the
168
+ * host's origin: a run drives real traffic through the real front door, and a
169
+ * server that cannot name its own public URL would be signing in somewhere it
170
+ * only assumed was itself.
171
+ */
172
+ const API_URL_VARIABLE = 'VIRTUAL_USER_API_URL'
173
+ const SECRET_VARIABLE = 'SCENARIO_ACTOR_SECRET'
174
+ const MODEL_VARIABLE = 'VIRTUAL_USER_MODEL'
175
+
176
+ export const runVirtualUser = pikkuFunc({
177
+ tags: ['pikku'],
178
+ title: 'Run a Virtual User',
179
+ description:
180
+ 'Turns a declared persona loose on this application and records what it finds. Returns immediately with a run id; read the result back with getVirtualUserRun.',
181
+ expose: true,
182
+ auth: ${authFlag},
183
+ scopes: ['virtualUser:run'],
184
+ input: RunVirtualUserInput,
185
+ output: RunVirtualUserOutput,
186
+ func: async (
187
+ { virtualUserRunStore, config },
188
+ input,
189
+ { session, rpc }
190
+ ) => {
191
+ if (!virtualUserRunStore) {
192
+ throw new Error(
193
+ 'No virtualUserRunStore is wired — a run has nowhere to be recorded. ' +
194
+ 'Wire KyselyVirtualUserRunStore from @pikku/kysely, or your own implementation of VirtualUserRunStore.'
195
+ )
196
+ }
197
+
198
+ const persona = personaConfigs[input.persona as keyof typeof personaConfigs] as
199
+ | { id: string; runnable: boolean; disposition?: string }
200
+ | undefined
201
+ if (!persona) {
202
+ throw new Error(
203
+ \`Unknown persona "\${input.persona}" — declare it with definePersonas()\`
204
+ )
205
+ }
206
+ // An acted-upon persona has no session of its own, and running one would
207
+ // race whatever scenario acts on it.
208
+ if (!persona.runnable) {
209
+ throw new Error(
210
+ \`Persona "\${input.persona}" is declared as acted upon, never run\`
211
+ )
212
+ }
213
+
214
+ const disposition = (input.disposition ??
215
+ persona.disposition ??
216
+ 'realistic') as VirtualUserDisposition
217
+ // Every disposition other than this one exists to find out what the product
218
+ // does wrong, which is not a thing to do to real customers' data. Checked
219
+ // against the effective disposition, so the override cannot smuggle one in.
220
+ if (
221
+ config.nodeEnv === 'production' &&
222
+ disposition !== PRODUCTION_DISPOSITION
223
+ ) {
224
+ throw new Error(
225
+ \`Only the '\${PRODUCTION_DISPOSITION}' disposition may run against production; "\${input.persona}" is \${disposition}\`
226
+ )
227
+ }
228
+
229
+ // Seeded here rather than inside the engine so the record carries the seed
230
+ // even if the run dies before returning — an unreproducible crash costs the
231
+ // most.
232
+ const seed = input.seed ?? Math.floor(Math.random() * 2_147_483_647)
233
+
234
+ const runId = await virtualUserRunStore.start({
235
+ persona: persona.id,
236
+ disposition,
237
+ seed,
238
+ goals: input.goals ?? [],
239
+ memory: input.memory ?? {},
240
+ startedBy: session?.userId ?? null,
241
+ })
242
+
243
+ // Deliberately not awaited: a run takes minutes, and a held-open request
244
+ // survives neither a rollout nor a proxy timeout. executeVirtualUserRun
245
+ // writes both outcomes to the record itself, so the only thing left to
246
+ // handle here is a rejection escaping the promise — without the catch it
247
+ // becomes an unhandled rejection and takes the process with it.
248
+ void rpc!
249
+ .invoke('executeVirtualUserRun', {
250
+ runId,
251
+ persona: persona.id,
252
+ disposition,
253
+ goals: input.goals ?? [],
254
+ memory: input.memory ?? {},
255
+ budget: input.budget,
256
+ seed,
257
+ })
258
+ .catch(() => {})
259
+
260
+ return { runId }
261
+ },
262
+ })
263
+
264
+ export const getVirtualUserRun = pikkuFunc({
265
+ tags: ['pikku'],
266
+ title: 'Read a Virtual User Run',
267
+ description:
268
+ 'Reads a run back: its status, what it found, and the counts the engine kept.',
269
+ expose: true,
270
+ auth: ${authFlag},
271
+ // Its own scope, and not the one that starts a run: an adversarial run's
272
+ // findings are working exploits carrying live ids, so reading them is the
273
+ // more sensitive of the two.
274
+ scopes: ['virtualUser:read'],
275
+ input: GetVirtualUserRunInput,
276
+ output: GetVirtualUserRunOutput,
277
+ func: async ({ virtualUserRunStore }, { runId }) => {
278
+ if (!virtualUserRunStore) {
279
+ throw new Error('No virtualUserRunStore is wired — there are no runs to read.')
280
+ }
281
+ const run = await virtualUserRunStore.get(runId)
282
+ if (!run) {
283
+ throw new Error(\`No virtual user run \${runId}\`)
284
+ }
285
+ return {
286
+ runId: run.runId,
287
+ persona: run.persona,
288
+ disposition: run.disposition,
289
+ seed: run.seed,
290
+ status: run.status,
291
+ goals: run.goals,
292
+ memory: run.memory,
293
+ // Findings are free-form by design — the engine records what it noticed,
294
+ // not a fixed row shape — so they cross the wire as the schema's open
295
+ // object rather than being narrowed to whatever kinds exist today.
296
+ findings: run.findings.map((finding) => ({
297
+ kind: finding.kind as string,
298
+ detail: finding.detail,
299
+ rpcName: finding.rpcName,
300
+ status: finding.status,
301
+ intentId: finding.intentId,
302
+ step: finding.step,
303
+ })),
304
+ tally: (run.tally ?? null) as Record<string, unknown> | null,
305
+ stoppedBy: run.stoppedBy,
306
+ error: run.error,
307
+ createdAt: run.createdAt.toISOString(),
308
+ finishedAt: run.finishedAt ? run.finishedAt.toISOString() : null,
309
+ }
310
+ },
311
+ })
312
+
313
+ /**
314
+ * The run itself. Not exposed: it is dispatched by \`runVirtualUser\` and has no
315
+ * caller of its own.
316
+ *
317
+ * Everything it needs is derived through \`metaService\` and the generated
318
+ * personas — the same public surface any consumer has. Nothing reaches into
319
+ * pikku's internals, because an app could not, and a feature built on what only
320
+ * the framework can see would not be this feature.
321
+ */
322
+ export const executeVirtualUserRun = pikkuSessionlessFunc({
323
+ tags: ['pikku'],
324
+ input: ExecuteVirtualUserRunInput,
325
+ output: ExecuteVirtualUserRunOutput,
326
+ func: async (
327
+ { virtualUserRunStore, metaService, aiAgentRunner, variables, logger },
328
+ { runId, persona: personaId, disposition, goals, memory, budget, seed }
329
+ ) => {
330
+ if (!virtualUserRunStore) {
331
+ throw new Error('No virtualUserRunStore is wired.')
332
+ }
333
+ try {
334
+ if (!metaService) {
335
+ throw new Error('metaService is not wired — there is no catalogue to derive')
336
+ }
337
+ if (!aiAgentRunner) {
338
+ throw new Error('aiAgentRunner is not wired — there is nothing to think with')
339
+ }
340
+
341
+ const apiUrl = await variables.get(API_URL_VARIABLE)
342
+ if (!apiUrl) {
343
+ throw new Error(
344
+ \`\${API_URL_VARIABLE} is not set — a virtual user has no address to sign in at.\`
345
+ )
346
+ }
347
+ const secret = await variables.get(SECRET_VARIABLE)
348
+ if (!secret) {
349
+ throw new Error(
350
+ \`\${SECRET_VARIABLE} is not set — actor sign-in is disabled, so there is nobody for the virtual user to be.\`
351
+ )
352
+ }
353
+ const model = await variables.get(MODEL_VARIABLE)
354
+ if (!model) {
355
+ throw new Error(\`\${MODEL_VARIABLE} is not set — no model to think with.\`)
356
+ }
357
+
358
+ const functionsMeta = await metaService.getFunctionsMeta()
359
+ // Only the schemas the catalogue can actually refer to, so a large app
360
+ // does not pull every schema it has ever generated into one run.
361
+ const schemaNames = [
362
+ ...new Set(
363
+ Object.values(functionsMeta).flatMap((meta: any) =>
364
+ [meta.inputSchemaName, meta.outputSchemaName].filter(
365
+ (name: unknown): name is string => !!name
366
+ )
367
+ )
368
+ ),
369
+ ]
370
+ const schemas = (await metaService.getSchemas(schemaNames)) as SchemaMap
371
+
372
+ const persona = personaConfigs[personaId as keyof typeof personaConfigs]
373
+ if (!persona) {
374
+ throw new Error(\`Persona "\${personaId}" is no longer declared\`)
375
+ }
376
+
377
+ const { catalogue, intents, agents } = prepareVirtualUserRun({
378
+ persona,
379
+ functionsMeta,
380
+ schemas,
381
+ workflowsMeta: await metaService.getWorkflowMeta(),
382
+ systemRoles: await metaService.getSystemRolesMeta(),
383
+ agentsMeta: await metaService.getAgentsMeta(),
384
+ })
385
+
386
+ const signedIn = createPersonas({ apiUrl, secret, model })
387
+ const target = signedIn[personaId as keyof typeof signedIn]
388
+ if (!target) {
389
+ throw new Error(\`Persona "\${personaId}" cannot sign in\`)
390
+ }
391
+
392
+ const result = await runVirtualUserEngine({
393
+ persona,
394
+ personaId,
395
+ disposition: disposition as VirtualUserDisposition,
396
+ catalogue,
397
+ intents,
398
+ goals,
399
+ memory,
400
+ seed,
401
+ agents,
402
+ target: personaVirtualUserTarget(target, {
403
+ model,
404
+ agents: agents.map((agent) => agent.name),
405
+ }),
406
+ // \`AIAgentRunnerService.run\` IS the engine's \`ActorLLM\` — same params,
407
+ // same result — so a virtual user thinks through the same runner every
408
+ // agent in the app does, provider quirks and all.
409
+ llm: (params) => aiAgentRunner.run(params),
410
+ model,
411
+ budget: {
412
+ steps: budget?.steps,
413
+ mutations: budget?.mutations,
414
+ duration: budget?.durationMs,
415
+ },
416
+ })
417
+
418
+ await virtualUserRunStore.complete(runId, {
419
+ findings: result.findings,
420
+ tally: result.tally,
421
+ memory: result.memory,
422
+ stoppedBy: result.stoppedBy ?? null,
423
+ })
424
+
425
+ return { findings: result.findings.length }
426
+ } catch (error) {
427
+ // A crashed run and a run that found nothing are different states, and the
428
+ // record is the only place that distinction survives — leaving it at
429
+ // 'running' forever is what \`fail\` exists to prevent.
430
+ const message = error instanceof Error ? error.message : String(error)
431
+ logger.error(\`Virtual user run \${runId} (\${personaId}) failed: \${message}\`)
432
+ await virtualUserRunStore.fail(runId, message)
433
+ throw error
434
+ }
435
+ },
436
+ })
437
+ `;
438
+ return { schemas, functions };
439
+ };
@@ -1 +1 @@
1
- export declare const pikkuWebhook: import("#pikku").PikkuFunctionConfig<void, boolean, "rpc" | "session", import("#pikku").PikkuFunctionSessionless<void, boolean, "rpc" | "session", import("#pikku").WiredServices> | import("#pikku").PikkuFunction<void, boolean, "rpc" | "session", import("#pikku").WiredServices>, undefined, undefined>;
1
+ export declare const pikkuWebhook: import("#pikku").PikkuFunctionConfig<void, boolean, "rpc" | "session", import("#pikku").PikkuFunctionSessionless<void, boolean, "rpc" | "session", import("#pikku").WiredServices, unknown> | import("#pikku").PikkuFunction<void, boolean, "rpc" | "session", import("#pikku").WiredServices>, undefined, undefined>;
@@ -1 +1 @@
1
- export declare const pikkuWorkflowRoutes: import("#pikku").PikkuFunctionConfig<void, boolean, "rpc" | "session", import("#pikku").PikkuFunctionSessionless<void, boolean, "rpc" | "session", import("#pikku").WiredServices> | import("#pikku").PikkuFunction<void, boolean, "rpc" | "session", import("#pikku").WiredServices>, undefined, undefined>;
1
+ export declare const pikkuWorkflowRoutes: import("#pikku").PikkuFunctionConfig<void, boolean, "rpc" | "session", import("#pikku").PikkuFunctionSessionless<void, boolean, "rpc" | "session", import("#pikku").WiredServices, unknown> | import("#pikku").PikkuFunction<void, boolean, "rpc" | "session", import("#pikku").WiredServices>, undefined, undefined>;
@@ -1,5 +1,5 @@
1
1
  type WorkflowCommandInput = {
2
2
  bootstrap?: boolean;
3
3
  };
4
- export declare const pikkuWorkflow: import("#pikku").PikkuFunctionConfig<WorkflowCommandInput, boolean | undefined, "rpc" | "session", import("#pikku").PikkuFunctionSessionless<WorkflowCommandInput, boolean | undefined, "rpc" | "session", import("#pikku").WiredServices> | import("#pikku").PikkuFunction<WorkflowCommandInput, boolean | undefined, "rpc" | "session", import("#pikku").WiredServices>, undefined, undefined>;
4
+ export declare const pikkuWorkflow: import("#pikku").PikkuFunctionConfig<WorkflowCommandInput, boolean | undefined, "rpc" | "session", import("#pikku").PikkuFunctionSessionless<WorkflowCommandInput, boolean | undefined, "rpc" | "session", import("#pikku").WiredServices, unknown> | import("#pikku").PikkuFunction<WorkflowCommandInput, boolean | undefined, "rpc" | "session", import("#pikku").WiredServices>, undefined, undefined>;
5
5
  export {};
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Generate the scenario step map: the typed set of names a scenario may pass to
3
- * `scenario.step/given/when/then`.
3
+ * `scenario.given/when/then`.
4
4
  *
5
5
  * Steps are referenced by string, exactly like `workflow.do` references an RPC,
6
6
  * so type safety has to come from a generated map rather than from importing
@@ -54,7 +54,7 @@ export const serializeScenarioStepMap = (logger, relativeToPath, packageMappings
54
54
  .filter((line) => !line.startsWith('import '))
55
55
  .join('\n');
56
56
  return `/**
57
- * Scenario step map: the names \`scenario.step/given/when/then\` accepts, with
57
+ * Scenario step map: the names \`scenario.given/when/then\` accepts, with
58
58
  * the input and output types of each step.
59
59
  */
60
60
 
@@ -7,7 +7,7 @@ import { sanitizeTypeName } from '@pikku/inspector';
7
7
  export const serializeWorkflowMeta = (outputPath, metaDir, workflowNames, packageMappings, supportsImportAttributes, packageName) => {
8
8
  const pkg = packageName ? `'${packageName}'` : 'null';
9
9
  if (workflowNames.length === 0) {
10
- return `import { pikkuState } from '@pikku/core/internal'
10
+ return `import { pikkuState } from '@pikku/core/ecosystem'
11
11
  import type { WorkflowsRuntimeMeta } from '@pikku/core/workflow/types'
12
12
 
13
13
  const workflowsMeta: WorkflowsRuntimeMeta = {}
@@ -31,7 +31,7 @@ pikkuState(${pkg}, 'workflows', 'meta', workflowsMeta)`;
31
31
  return ` '${name}': ${sanitizedIdentifier}Meta,`;
32
32
  })
33
33
  .join('\n');
34
- return `import { pikkuState } from '@pikku/core/internal'
34
+ return `import { pikkuState } from '@pikku/core/ecosystem'
35
35
  import type { WorkflowsRuntimeMeta } from '@pikku/core/workflow/types'
36
36
 
37
37
  ${imports}
@@ -14,12 +14,6 @@ export const WorkflowStart = z.object({
14
14
  data: z.unknown().optional(),
15
15
  })
16
16
 
17
- export const GraphStart = z.object({
18
- workflowName: z.string(),
19
- nodeId: z.string(),
20
- data: z.unknown().optional(),
21
- })
22
-
23
17
  export const WorkflowRunRef = z.object({
24
18
  workflowName: z.string(),
25
19
  runId: z.string(),
@@ -42,9 +36,9 @@ export const Acknowledged = z.object({ ok: z.literal(true) })
42
36
  */
43
37
  import { pikkuSessionlessFunc, wireHTTPRoutes } from '${pathToPikkuTypes}'
44
38
  import { MissingServiceError } from '@pikku/core/errors'
39
+ import { assertWorkflowRunOwner } from '@pikku/core/workflow'
45
40
  import {
46
41
  WorkflowStart,
47
- GraphStart,
48
42
  WorkflowRunRef,
49
43
  WorkflowRunId,
50
44
  WorkflowApproval,
@@ -87,8 +81,11 @@ export const workflowStatusChecker = pikkuSessionlessFunc({
87
81
  tags: ['pikku'],
88
82
  auth: ${authFlag},
89
83
  input: WorkflowRunRef,
90
- func: async ({ workflowService }, { runId }) => {
84
+ func: async ({ workflowService }, { runId }, { session }) => {
91
85
  assertWorkflowService(workflowService)
86
+ const run = await workflowService.getRun(runId)
87
+ if (!run) throw new Error(\`Run not found: \${runId}\`)
88
+ assertWorkflowRunOwner(run.wire, session)
92
89
  const status = await workflowService.getRunStatus(runId)
93
90
  if (!status) throw new Error(\`Run not found: \${runId}\`)
94
91
  return status
@@ -103,7 +100,7 @@ export const workflowStatusStream = pikkuSessionlessFunc({
103
100
  tags: ['pikku'],
104
101
  auth: ${authFlag},
105
102
  input: WorkflowRunRef,
106
- func: async ({ workflowRunService }, { runId }, { channel }) => {
103
+ func: async ({ workflowRunService }, { runId }, { channel, session }) => {
107
104
  assertWorkflowRunService(workflowRunService)
108
105
  if (!channel) return
109
106
 
@@ -117,6 +114,7 @@ export const workflowStatusStream = pikkuSessionlessFunc({
117
114
  channel.close()
118
115
  return false
119
116
  }
117
+ assertWorkflowRunOwner(run.wire, session)
120
118
 
121
119
  const steps = await workflowRunService.getRunSteps(runId)
122
120
 
@@ -188,7 +186,7 @@ export const workflowStatusStreamFull = pikkuSessionlessFunc({
188
186
  tags: ['pikku'],
189
187
  auth: ${authFlag},
190
188
  input: WorkflowRunRef,
191
- func: async ({ workflowRunService }, { runId }, { channel }) => {
189
+ func: async ({ workflowRunService }, { runId }, { channel, session }) => {
192
190
  assertWorkflowRunService(workflowRunService)
193
191
  if (!channel) return
194
192
 
@@ -202,6 +200,7 @@ export const workflowStatusStreamFull = pikkuSessionlessFunc({
202
200
  channel.close()
203
201
  return false
204
202
  }
203
+ assertWorkflowRunOwner(run.wire, session)
205
204
 
206
205
  const steps = await workflowRunService.getRunSteps(runId)
207
206
 
@@ -269,27 +268,16 @@ export const workflowStatusStreamFull = pikkuSessionlessFunc({
269
268
  },
270
269
  })
271
270
 
272
- export const graphStarter = pikkuSessionlessFunc({
273
- tags: ['pikku'],
274
- auth: ${authFlag},
275
- input: GraphStart,
276
- output: WorkflowRunId,
277
- // See workflowStarter — destructure workflowService so the analyzer
278
- // assigns workflow-state capability to this unit.
279
- func: async ({ workflowService }, { workflowName, nodeId, data }, { rpc }) => {
280
- assertWorkflowService(workflowService)
281
- return await rpc.startWorkflow(workflowName as any, (data ?? {}) as any, { startNode: nodeId })
282
- },
283
- })
284
-
285
271
  /**
286
272
  * Record a human decision against a workflow.approval() gate and wake the run.
287
273
  *
288
274
  * The decision is validated on replay inside the workflow body — the only place
289
275
  * the approval's schema value is in scope — so this route deliberately accepts
290
276
  * an unknown payload. An invalid one re-closes the gate rather than failing the
291
- * run. Gate this route with your own auth/permissions to control WHO may
292
- * approve: the framework does not model approver identity.
277
+ * A run started through a session may only be approved by that session's user
278
+ * (\`assertWorkflowRunOwner\`). A run with no recorded owner has nobody to compare
279
+ * a caller against — gate this route with your own auth/permissions to control
280
+ * WHO may approve those.
293
281
  */
294
282
  export const workflowApprover = pikkuSessionlessFunc({
295
283
  tags: ['pikku'],
@@ -298,9 +286,9 @@ export const workflowApprover = pikkuSessionlessFunc({
298
286
  output: Acknowledged,
299
287
  // See workflowStarter — destructure workflowService so the analyzer
300
288
  // assigns workflow-state capability to this unit.
301
- func: async ({ workflowService }, { runId, reason, decision }) => {
289
+ func: async ({ workflowService }, { runId, reason, decision }, { session }) => {
302
290
  assertWorkflowService(workflowService)
303
- await workflowService.approveStep(runId, reason, decision)
291
+ await workflowService.approveStep(runId, reason, decision, session)
304
292
  return { ok: true as const }
305
293
  },
306
294
  })
@@ -341,11 +329,6 @@ wireHTTPRoutes({
341
329
  sse: true,
342
330
  func: workflowStatusStreamFull,
343
331
  },
344
- graphStart: {
345
- route: '/workflow/:workflowName/graph/:nodeId',
346
- method: 'post',
347
- func: graphStarter,
348
- },
349
332
  },
350
333
  })
351
334
  `;