@pikku/cli 0.12.100 → 0.12.103

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 (259) hide show
  1. package/console-app/assets/{abnfDiagram-VRR7QNED-Icjp9hnB.js → abnfDiagram-VRR7QNED-BLi9JHGg.js} +1 -1
  2. package/console-app/assets/{arc-BfGls--L.js → arc-B3b5uYlL.js} +1 -1
  3. package/console-app/assets/architecture-TIHT7OUA-BYeDayHv.js +1 -0
  4. package/console-app/assets/{architectureDiagram-ZJ3FMSHR-CpnsLBns.js → architectureDiagram-ZJ3FMSHR-Dkd8kxIa.js} +1 -1
  5. package/console-app/assets/{blockDiagram-677ZJIJ3-ByKRMGSr.js → blockDiagram-677ZJIJ3-DnH0nNlb.js} +1 -1
  6. package/console-app/assets/{c4Diagram-LMCZKHZV-CzJSbsUo.js → c4Diagram-LMCZKHZV-BlelCS5i.js} +1 -1
  7. package/console-app/assets/channel-CTa6nggO.js +1 -0
  8. package/console-app/assets/{chunk-32BRIVSS-D_tc4HCY.js → chunk-32BRIVSS-D7tMgtT1.js} +1 -1
  9. package/console-app/assets/{chunk-52WLFC77-wkQkuUXG.js → chunk-52WLFC77-CRepS35y.js} +1 -1
  10. package/console-app/assets/{chunk-C7G6YPKG-BFW3xG3R.js → chunk-C7G6YPKG-CUldlJz4.js} +1 -1
  11. package/console-app/assets/{chunk-EX3LRPZG-Car090Sw.js → chunk-EX3LRPZG-DODbrqEj.js} +1 -1
  12. package/console-app/assets/{chunk-FWX5IMBZ-c2ud9kQ-.js → chunk-FWX5IMBZ-nZa59wGD.js} +2 -2
  13. package/console-app/assets/{chunk-HOUHSVGY-RYmQka5R.js → chunk-HOUHSVGY-BaawVZCa.js} +1 -1
  14. package/console-app/assets/{chunk-ICXQ74PX-C-dqYC_9.js → chunk-ICXQ74PX-C86LrIRs.js} +1 -1
  15. package/console-app/assets/{chunk-MOJQB5TN-Cu3FUWwl.js → chunk-MOJQB5TN-ovUDQlyW.js} +1 -1
  16. package/console-app/assets/{chunk-OGEWGWER-Z7f1yArD.js → chunk-OGEWGWER-ByZKAcGu.js} +1 -1
  17. package/console-app/assets/{chunk-PUDLZKDR-Bp68DuRj.js → chunk-PUDLZKDR-DdeJN3wJ.js} +1 -1
  18. package/console-app/assets/{chunk-Q4XR5HBZ-CdKSYWZ4.js → chunk-Q4XR5HBZ-Blp5W9-b.js} +1 -1
  19. package/console-app/assets/{chunk-RYQCIY6F-9ISCAKm2.js → chunk-RYQCIY6F-DehwjyPp.js} +1 -1
  20. package/console-app/assets/{chunk-V7JOEXUC-2EOc1nQB.js → chunk-V7JOEXUC-Ca1xeVdo.js} +1 -1
  21. package/console-app/assets/chunk-VAUOI2AC-BCngaLxk.js +1 -0
  22. package/console-app/assets/{chunk-VR4S4FIN-BPvN0PUm.js → chunk-VR4S4FIN-Cj7ZlsLr.js} +1 -1
  23. package/console-app/assets/{chunk-WYO6CB5R-DOpurCTP.js → chunk-WYO6CB5R-CsdBQ1HS.js} +1 -1
  24. package/console-app/assets/chunk-XXDRQBXY-CGIlOoBU.js +1 -0
  25. package/console-app/assets/{chunk-ZGVPDNZ5-Bu2weVOL.js → chunk-ZGVPDNZ5-DMnFdLEO.js} +1 -1
  26. package/console-app/assets/classDiagram-OUVF2IWQ-Bwt1ZVOR.js +1 -0
  27. package/console-app/assets/classDiagram-v2-EOCWNBFH-Bwt1ZVOR.js +1 -0
  28. package/console-app/assets/{cose-bilkent-JH36ORCC-nau-QGCX.js → cose-bilkent-JH36ORCC-CiYBhiBv.js} +1 -1
  29. package/console-app/assets/{cynefin-VYW2F7L2-BBw-E7lg.js → cynefin-VYW2F7L2-BXuNC8qm.js} +1 -1
  30. package/console-app/assets/{cynefinDiagram-TSTJHNR4-BvnMvOvH.js → cynefinDiagram-TSTJHNR4-Ck53b-Nr.js} +1 -1
  31. package/console-app/assets/{dagre-VKFMJZFB-CHEqPR29.js → dagre-VKFMJZFB-C9hZCnOv.js} +1 -1
  32. package/console-app/assets/{diagram-FQU43EPY-JijKRWyb.js → diagram-FQU43EPY-DuEKSLPE.js} +1 -1
  33. package/console-app/assets/{diagram-G47NLZAW-G5UsB31f.js → diagram-G47NLZAW-B_yO-zKt.js} +1 -1
  34. package/console-app/assets/{diagram-NH7WQ7WH-BhuJ6fPu.js → diagram-NH7WQ7WH-CtKFjoB4.js} +1 -1
  35. package/console-app/assets/{diagram-OA4YK3LP-DaUF-8N4.js → diagram-OA4YK3LP-T9eIYXYs.js} +1 -1
  36. package/console-app/assets/{diagram-WEI45ONY-wLsJIhoM.js → diagram-WEI45ONY-BTgu-I69.js} +1 -1
  37. package/console-app/assets/{dist-fbBkbDNG.js → dist-DSVj7qxi.js} +1 -1
  38. package/console-app/assets/{ebnfDiagram-CCIWWBDH-BZCEa3Dz.js → ebnfDiagram-CCIWWBDH-BdyNRX2k.js} +1 -1
  39. package/console-app/assets/{erDiagram-Q63AITRT-4XoEUtEh.js → erDiagram-Q63AITRT-B0cr0nxe.js} +1 -1
  40. package/console-app/assets/eventmodeling-45OFAUF4-BeHdsPzc.js +1 -0
  41. package/console-app/assets/flowDiagram-23GEKE2U-6N6mIkfB.js +1 -0
  42. package/console-app/assets/{ganttDiagram-NO4QXBWP-BXU7pfq6.js → ganttDiagram-NO4QXBWP-Cr1R_nGh.js} +1 -1
  43. package/console-app/assets/{gitGraph-TEB2WS4Q-BdMAmvpU.js → gitGraph-TEB2WS4Q-zcmQoWd4.js} +1 -1
  44. package/console-app/assets/{gitGraphDiagram-IHSO6WYX-3Hn0zwZR.js → gitGraphDiagram-IHSO6WYX-CHB9Fnch.js} +1 -1
  45. package/console-app/assets/{index-Din2vBeb.js → index-BbIUXgNl.js} +150 -150
  46. package/console-app/assets/{index-BXMjqLQ5.css → index-C9U-Zyvx.css} +1 -1
  47. package/console-app/assets/{info-DKCQHKI2-Dc_oQkp5.js → info-DKCQHKI2-BGPZGp_E.js} +1 -1
  48. package/console-app/assets/{infoDiagram-FWYZ7A6U-B3v4xCUn.js → infoDiagram-FWYZ7A6U-Br_p6SR_.js} +1 -1
  49. package/console-app/assets/{ishikawaDiagram-FXEZZL3T-DzWq9Vtp.js → ishikawaDiagram-FXEZZL3T-Ma2d4IuN.js} +1 -1
  50. package/console-app/assets/{journeyDiagram-5HDEW3XC-C0buWi_a.js → journeyDiagram-5HDEW3XC-LdCblEX2.js} +1 -1
  51. package/console-app/assets/{kanban-definition-HUTT4EX6-DRAN9HhV.js → kanban-definition-HUTT4EX6-CRWetzV4.js} +1 -1
  52. package/console-app/assets/{line-UqgRNiAC.js → line-DrceqMYY.js} +1 -1
  53. package/console-app/assets/{linear-FTAGuk_3.js → linear-acWbtwAj.js} +1 -1
  54. package/console-app/assets/{mermaid-parser.core-DIHI27FL.js → mermaid-parser.core-n773Jf0G.js} +3 -3
  55. package/console-app/assets/{mermaid.core-D4q8kvcu.js → mermaid.core-DyTRkSqH.js} +3 -3
  56. package/console-app/assets/{mindmap-definition-LN4V7U3C-DN-_CNLb.js → mindmap-definition-LN4V7U3C-CBU-ehFU.js} +1 -1
  57. package/console-app/assets/{packet-7NZHBO7P-8a3PoQAb.js → packet-7NZHBO7P-DL_fgdX1.js} +1 -1
  58. package/console-app/assets/{pegDiagram-2B236MQR-Bh2MhzCN.js → pegDiagram-2B236MQR-CrFaAHHj.js} +1 -1
  59. package/console-app/assets/{pie-RZYD4A2V-Bi6zbJDl.js → pie-RZYD4A2V-STtzW8Tz.js} +1 -1
  60. package/console-app/assets/{pieDiagram-ENE6RG2P-D2Z0W5UU.js → pieDiagram-ENE6RG2P-DsUOr1Ud.js} +1 -1
  61. package/console-app/assets/{quadrantDiagram-ABIIQ3AL-DNOKka0p.js → quadrantDiagram-ABIIQ3AL-DmuSe_qW.js} +1 -1
  62. package/console-app/assets/{radar-I7S5WNFK-CAxa68Sg.js → radar-I7S5WNFK-L8w2lEOb.js} +1 -1
  63. package/console-app/assets/{railroad-3IZDKUUU-CZb1usP7.js → railroad-3IZDKUUU-CxqlE5vc.js} +1 -1
  64. package/console-app/assets/railroad-abnf-AHOZXSZD-CkJOR_Em.js +1 -0
  65. package/console-app/assets/railroad-ebnf-EBAXGLYW-BH_pRGgm.js +1 -0
  66. package/console-app/assets/railroad-peg-LSFZ7HO6-B50bKcii.js +1 -0
  67. package/console-app/assets/{railroadDiagram-RFXS5EU6-B1K2hbTD.js → railroadDiagram-RFXS5EU6-CJ8Lpbeo.js} +1 -1
  68. package/console-app/assets/{requirementDiagram-TGXJPOKE-K8wcOO0Q.js → requirementDiagram-TGXJPOKE-8OXQXUud.js} +1 -1
  69. package/console-app/assets/{sankeyDiagram-HTMAVEWB-WBPBkgNx.js → sankeyDiagram-HTMAVEWB-Bezd2CqZ.js} +1 -1
  70. package/console-app/assets/{sequenceDiagram-DBY2YBRQ-Dz80qZZv.js → sequenceDiagram-DBY2YBRQ-DHb5js3D.js} +1 -1
  71. package/console-app/assets/{src-CnJCXDL0.js → src-DfFamOl-.js} +1 -1
  72. package/console-app/assets/{stateDiagram-2N3HPSRC-DMur7lZf.js → stateDiagram-2N3HPSRC-UpyJm2mi.js} +1 -1
  73. package/console-app/assets/stateDiagram-v2-6OUMAXLB-C6gAfg82.js +1 -0
  74. package/console-app/assets/{swimlanes-5IMT3BWC-BlLdYcPU.js → swimlanes-5IMT3BWC-yUrV5f4O.js} +1 -1
  75. package/console-app/assets/swimlanesDiagram-G3AALYLV-Ch2_j5W5.js +8 -0
  76. package/console-app/assets/{timeline-definition-FHXFAJF6-CBOit0JY.js → timeline-definition-FHXFAJF6-B6w-rZeZ.js} +1 -1
  77. package/console-app/assets/{treeView-QDETBFTQ-DM1i1ast.js → treeView-QDETBFTQ-0k2QpnXc.js} +1 -1
  78. package/console-app/assets/{treemap-6X3UGDF4-ACrBEfY6.js → treemap-6X3UGDF4-ByCuDcGA.js} +1 -1
  79. package/console-app/assets/{vennDiagram-L72KCM5P-BmeFWb5N.js → vennDiagram-L72KCM5P-BH4374lw.js} +1 -1
  80. package/console-app/assets/{wardley-OPB4EBWU-BpIbeh58.js → wardley-OPB4EBWU-DNVwuJz6.js} +1 -1
  81. package/console-app/assets/{wardleyDiagram-EHGQE667-CxL7Mv7y.js → wardleyDiagram-EHGQE667-EXnQ6lkx.js} +1 -1
  82. package/console-app/assets/{xychartDiagram-FW5EYKEG-DkV75xT2.js → xychartDiagram-FW5EYKEG-rFh-UdgH.js} +1 -1
  83. package/console-app/index.html +10 -3
  84. package/dist/.pikku/agent/pikku-agent-types.gen.d.ts +6 -2
  85. package/dist/.pikku/agent/pikku-agent-types.gen.js +3 -0
  86. package/dist/.pikku/agent/pikku-model-aliases.gen.d.ts +1 -0
  87. package/dist/.pikku/agent/pikku-model-aliases.gen.js +5 -0
  88. package/dist/.pikku/channel/pikku-channel-types.gen.d.ts +1 -1
  89. package/dist/.pikku/channel/pikku-channel-types.gen.js +1 -1
  90. package/dist/.pikku/cli/pikku-cli-channel.js +13 -8
  91. package/dist/.pikku/cli/pikku-cli-client.gen.d.ts +1 -1
  92. package/dist/.pikku/cli/pikku-cli-client.gen.js +1 -1
  93. package/dist/.pikku/cli/pikku-cli-contracts-meta.gen.d.ts +1 -1
  94. package/dist/.pikku/cli/pikku-cli-contracts-meta.gen.js +1 -1
  95. package/dist/.pikku/cli/pikku-cli-types.gen.d.ts +1 -1
  96. package/dist/.pikku/cli/pikku-cli-types.gen.js +1 -1
  97. package/dist/.pikku/cli/pikku-cli-wirings-meta.gen.js +1 -1
  98. package/dist/.pikku/cli/pikku-cli-wirings-meta.gen.json +18 -12
  99. package/dist/.pikku/cli/pikku-cli-wirings.gen.d.ts +1 -1
  100. package/dist/.pikku/cli/pikku-cli-wirings.gen.js +1 -1
  101. package/dist/.pikku/cli/pikku-cli.gen.d.ts +1 -1
  102. package/dist/.pikku/cli/pikku-cli.gen.js +1 -1
  103. package/dist/.pikku/console/pikku-node-types.gen.d.ts +1 -1
  104. package/dist/.pikku/function/pikku-function-types.gen.d.ts +6 -25
  105. package/dist/.pikku/function/pikku-function-types.gen.js +1 -1
  106. package/dist/.pikku/function/pikku-functions-meta.gen.js +1 -1
  107. package/dist/.pikku/function/pikku-functions-meta.gen.json +51 -27
  108. package/dist/.pikku/function/pikku-functions.gen.js +3 -1
  109. package/dist/.pikku/http/pikku-http-types.gen.d.ts +1 -1
  110. package/dist/.pikku/http/pikku-http-types.gen.js +1 -1
  111. package/dist/.pikku/mcp/pikku-mcp-types.gen.d.ts +1 -1
  112. package/dist/.pikku/mcp/pikku-mcp-types.gen.js +1 -1
  113. package/dist/.pikku/pikku-bootstrap-scenarios.gen.d.ts +1 -1
  114. package/dist/.pikku/pikku-bootstrap-scenarios.gen.js +1 -1
  115. package/dist/.pikku/pikku-bootstrap.gen.d.ts +2 -1
  116. package/dist/.pikku/pikku-bootstrap.gen.js +2 -1
  117. package/dist/.pikku/pikku-meta-service.gen.d.ts +1 -1
  118. package/dist/.pikku/pikku-meta-service.gen.js +1 -1
  119. package/dist/.pikku/pikku-services.gen.d.ts +1 -1
  120. package/dist/.pikku/pikku-types.gen.d.ts +1 -1
  121. package/dist/.pikku/pikku-types.gen.js +1 -1
  122. package/dist/.pikku/queue/pikku-queue-types.gen.d.ts +1 -1
  123. package/dist/.pikku/queue/pikku-queue-types.gen.js +1 -1
  124. package/dist/.pikku/queue/pikku-queue-workers-wirings-meta.gen.js +1 -1
  125. package/dist/.pikku/queue/pikku-queue-workers-wirings.gen.d.ts +1 -1
  126. package/dist/.pikku/queue/pikku-queue-workers-wirings.gen.js +1 -1
  127. package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.js +1 -1
  128. package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.json +2 -1
  129. package/dist/.pikku/scenarios/pikku-scenario-functions-meta.gen.js +1 -1
  130. package/dist/.pikku/scenarios/pikku-scenario-functions.gen.d.ts +1 -1
  131. package/dist/.pikku/scenarios/pikku-scenario-wirings-meta.gen.js +1 -1
  132. package/dist/.pikku/scenarios/pikku-scenario-wirings.gen.d.ts +1 -1
  133. package/dist/.pikku/scenarios/schemas/register.gen.d.ts +1 -1
  134. package/dist/.pikku/scenarios/schemas/register.gen.js +1 -1
  135. package/dist/.pikku/scheduler/pikku-scheduler-types.gen.d.ts +1 -1
  136. package/dist/.pikku/scheduler/pikku-scheduler-types.gen.js +1 -1
  137. package/dist/.pikku/schemas/register.gen.js +7 -5
  138. package/dist/.pikku/schemas/schemas/DevInput.schema.json +1 -1
  139. package/dist/.pikku/schemas/schemas/PikkuAIScorerOutput.schema.json +1 -0
  140. package/dist/.pikku/schemas/schemas/ServeInput.schema.json +1 -1
  141. package/dist/.pikku/schemas/schemas/ValidateOutput.schema.json +1 -0
  142. package/dist/.pikku/scopes/pikku-personas.gen.js +1 -1
  143. package/dist/.pikku/scopes/pikku-roles.gen.d.ts +1 -1
  144. package/dist/.pikku/scopes/pikku-scope-types.gen.d.ts +1 -1
  145. package/dist/.pikku/scopes/pikku-scope-types.gen.js +1 -1
  146. package/dist/.pikku/scopes/pikku-scopes.gen.d.ts +1 -1
  147. package/dist/.pikku/secrets/pikku-secret-types.gen.d.ts +1 -1
  148. package/dist/.pikku/secrets/pikku-secret-types.gen.js +1 -1
  149. package/dist/.pikku/secrets/pikku-secrets.gen.d.ts +1 -1
  150. package/dist/.pikku/secrets/pikku-secrets.gen.js +1 -1
  151. package/dist/.pikku/trigger/pikku-trigger-types.gen.d.ts +1 -1
  152. package/dist/.pikku/trigger/pikku-trigger-types.gen.js +1 -1
  153. package/dist/.pikku/variables/pikku-variable-types.gen.d.ts +1 -1
  154. package/dist/.pikku/variables/pikku-variable-types.gen.js +1 -1
  155. package/dist/.pikku/variables/pikku-variables.gen.d.ts +1 -1
  156. package/dist/.pikku/variables/pikku-variables.gen.js +1 -1
  157. package/dist/.pikku/workflow/meta/allWorkflow.gen.json +8 -2
  158. package/dist/.pikku/workflow/pikku-personas.gen.d.ts +2 -1
  159. package/dist/.pikku/workflow/pikku-personas.gen.js +1 -1
  160. package/dist/.pikku/workflow/pikku-workflow-types.gen.d.ts +11 -18
  161. package/dist/.pikku/workflow/pikku-workflow-types.gen.js +1 -1
  162. package/dist/.pikku/workflow/pikku-workflow-wirings-meta.gen.js +1 -1
  163. package/dist/.pikku/workflow/pikku-workflow-wirings.gen.js +1 -1
  164. package/dist/bin/pikku-bin.mjs +2 -2
  165. package/dist/src/cli.wiring.js +20 -11
  166. package/dist/src/deploy/analyzer/analyzer.js +44 -0
  167. package/dist/src/deploy/analyzer/manifest.d.ts +37 -0
  168. package/dist/src/fabric/functions/smoke.function.js +7 -4
  169. package/dist/src/fabric/functions/validate.function.js +3 -1
  170. package/dist/src/functions/commands/db-export.js +1 -1
  171. package/dist/src/functions/commands/db-shared.d.ts +0 -14
  172. package/dist/src/functions/commands/dev.d.ts +3 -0
  173. package/dist/src/functions/commands/dev.js +41 -2
  174. package/dist/src/functions/commands/knowledge-index.d.ts +3 -3
  175. package/dist/src/functions/commands/new-addon.js +6 -3
  176. package/dist/src/functions/commands/scenario-browser.d.ts +25 -2
  177. package/dist/src/functions/commands/scenario-browser.js +5 -1
  178. package/dist/src/functions/commands/scenario-formatter.d.ts +1 -1
  179. package/dist/src/functions/commands/scenario-ladder.d.ts +1 -1
  180. package/dist/src/functions/commands/scenario-ladder.js +1 -1
  181. package/dist/src/functions/commands/scenario-plan.d.ts +2 -1
  182. package/dist/src/functions/commands/scenario-plan.js +1 -1
  183. package/dist/src/functions/commands/scenario.d.ts +7 -1
  184. package/dist/src/functions/commands/scenario.js +28 -7
  185. package/dist/src/functions/commands/serve.d.ts +3 -0
  186. package/dist/src/functions/commands/serve.js +15 -1
  187. package/dist/src/functions/commands/{workspace-validate.d.ts → validate.d.ts} +18 -3
  188. package/dist/src/functions/commands/validate.js +9 -0
  189. package/dist/src/functions/db/local-db.d.ts +2 -1
  190. package/dist/src/functions/db/local-db.js +2 -2
  191. package/dist/src/functions/surface/collect-surface.d.ts +14 -0
  192. package/dist/src/functions/surface/collect-surface.js +215 -0
  193. package/dist/src/functions/validate/addon-package-checks.d.ts +26 -0
  194. package/dist/src/functions/validate/addon-package-checks.js +258 -0
  195. package/dist/src/functions/validate/persona-checks.d.ts +1 -1
  196. package/dist/src/functions/validate/persona-checks.js +1 -1
  197. package/dist/src/functions/validate/scenario-file-checks.js +33 -0
  198. package/dist/src/functions/validate/shared-checks.d.ts +1 -1
  199. package/dist/src/functions/validate/shared-checks.js +1 -1
  200. package/dist/src/functions/validate/type-identity-checks.d.ts +25 -0
  201. package/dist/src/functions/validate/type-identity-checks.js +218 -0
  202. package/dist/src/functions/validate/validate-registry.d.ts +52 -0
  203. package/dist/src/functions/validate/validate-registry.js +111 -0
  204. package/dist/src/functions/validate/validate.d.ts +47 -0
  205. package/dist/src/functions/validate/{workspace-validate.js → validate.js} +46 -12
  206. package/dist/src/functions/wirings/ai-agent/pikku-command-ai-agent-types.js +3 -2
  207. package/dist/src/functions/wirings/ai-agent/pikku-command-ai-agent.js +5 -1
  208. package/dist/src/functions/wirings/ai-agent/serialize-ai-agent-types.d.ts +1 -1
  209. package/dist/src/functions/wirings/ai-agent/serialize-ai-agent-types.js +15 -2
  210. package/dist/src/functions/wirings/ai-agent/serialize-model-aliases.d.ts +5 -0
  211. package/dist/src/functions/wirings/ai-agent/serialize-model-aliases.js +12 -0
  212. package/dist/src/functions/wirings/ai-scorer/pikku-command-ai-scorer.d.ts +1 -0
  213. package/dist/src/functions/wirings/ai-scorer/pikku-command-ai-scorer.js +51 -0
  214. package/dist/src/functions/wirings/ai-scorer/serialize-scorer-names.d.ts +10 -0
  215. package/dist/src/functions/wirings/ai-scorer/serialize-scorer-names.js +17 -0
  216. package/dist/src/functions/wirings/auth/serialize-auth-gen.js +27 -10
  217. package/dist/src/functions/wirings/cli/serialize-channel-cli.js +9 -4
  218. package/dist/src/functions/wirings/console/serialize-console-functions.js +9 -56
  219. package/dist/src/functions/wirings/functions/serialize-function-types.js +7 -30
  220. package/dist/src/functions/wirings/middleware/serialize-middleware-imports.js +5 -1
  221. package/dist/src/functions/wirings/package/pikku-command-package.js +12 -1
  222. package/dist/src/functions/wirings/package/serialize-package.d.ts +1 -1
  223. package/dist/src/functions/wirings/package/serialize-package.js +5 -2
  224. package/dist/src/functions/wirings/rpc/serialize-typed-rpc-map.js +1 -6
  225. package/dist/src/functions/wirings/scenarios/register-scenario-instrumentation.js +30 -0
  226. package/dist/src/functions/wirings/scenarios/serialize-feature-meta.d.ts +1 -1
  227. package/dist/src/functions/wirings/scenarios/serialize-scenario-registration.js +6 -5
  228. package/dist/src/functions/wirings/workflow/serialize-personas.js +2 -5
  229. package/dist/src/functions/wirings/workflow/serialize-workflow-routes.js +12 -4
  230. package/dist/src/functions/wirings/workflow/serialize-workflow-types.js +10 -17
  231. package/dist/src/functions/workflows/all.workflow.js +11 -1
  232. package/dist/src/server/bun-server-runner.js +3 -0
  233. package/dist/src/server/dev-server-runner.interface.d.ts +10 -0
  234. package/dist/src/server/node-server-runner.js +3 -0
  235. package/dist/src/services.js +1 -0
  236. package/dist/src/utils/meta-diff.d.ts +1 -1
  237. package/dist/src/utils/meta-diff.js +2 -0
  238. package/dist/src/utils/model-alias-override.d.ts +7 -0
  239. package/dist/src/utils/model-alias-override.js +33 -0
  240. package/dist/src/utils/pikku-cli-config.js +16 -0
  241. package/dist/tsconfig.tsbuildinfo +1 -1
  242. package/package.json +17 -17
  243. package/console-app/assets/architecture-TIHT7OUA-C8l7I5Lm.js +0 -1
  244. package/console-app/assets/channel-BgJ-Z0cx.js +0 -1
  245. package/console-app/assets/chunk-VAUOI2AC-DwKsbf70.js +0 -1
  246. package/console-app/assets/chunk-XXDRQBXY-RuYSFsQb.js +0 -1
  247. package/console-app/assets/classDiagram-OUVF2IWQ-ohoLCI8g.js +0 -1
  248. package/console-app/assets/classDiagram-v2-EOCWNBFH-ohoLCI8g.js +0 -1
  249. package/console-app/assets/eventmodeling-45OFAUF4-DZ7z4YJO.js +0 -1
  250. package/console-app/assets/flowDiagram-23GEKE2U-rd7-NwZT.js +0 -1
  251. package/console-app/assets/railroad-abnf-AHOZXSZD-DkQZciri.js +0 -1
  252. package/console-app/assets/railroad-ebnf-EBAXGLYW-CPBeASA9.js +0 -1
  253. package/console-app/assets/railroad-peg-LSFZ7HO6-CXEVIZ0g.js +0 -1
  254. package/console-app/assets/stateDiagram-v2-6OUMAXLB-BDgLCrot.js +0 -1
  255. package/console-app/assets/swimlanesDiagram-G3AALYLV-CZ5rQIcE.js +0 -8
  256. package/dist/.pikku/schemas/schemas/WorkspaceValidateOutput.schema.json +0 -1
  257. package/dist/src/functions/commands/workspace-validate.js +0 -9
  258. package/dist/src/functions/validate/workspace-validate.d.ts +0 -33
  259. /package/dist/.pikku/schemas/schemas/{WorkspaceValidateInput.schema.json → ValidateInput.schema.json} +0 -0
@@ -5,13 +5,6 @@ export const serializeConsoleFunctions = (pathToPikkuTypes, _pathToAgentTypes, g
5
5
  */
6
6
  import { z } from 'zod'
7
7
 
8
- export const SecretRef = z.object({ secretId: z.string() })
9
-
10
- export const SetSecret = z.object({
11
- secretId: z.string(),
12
- value: z.unknown(),
13
- })
14
-
15
8
  export const VariableRef = z.object({ variableId: z.string() })
16
9
 
17
10
  export const SetVariable = z.object({
@@ -24,34 +17,16 @@ export const ValueResult = z.object({
24
17
  value: z.unknown().nullable(),
25
18
  })
26
19
 
27
- export const Exists = z.object({ exists: z.boolean() })
28
-
29
20
  export const Success = z.object({ success: z.boolean() })
30
21
  `;
31
22
  const functions = `import { pikkuFunc, defineHTTPRoutes, wireHTTPRoutes, ref, wireAddon } from '${pathToPikkuTypes}'
32
23
  import {
33
- SecretRef,
34
- SetSecret,
35
24
  VariableRef,
36
25
  SetVariable,
37
26
  ValueResult,
38
- Exists,
39
27
  Success,
40
28
  } from './console.schemas.gen.js'
41
29
 
42
- export const pikkuConsoleSetSecret = pikkuFunc({
43
- secretBroker: true,
44
- tags: ['pikku'],
45
- description: 'Set the value of a secret',
46
- expose: true,
47
- input: SetSecret,
48
- output: Success,
49
- func: async ({ secrets }, { secretId, value }) => {
50
- await secrets.setSecret(secretId, value)
51
- return { success: true }
52
- },
53
- })
54
-
55
30
  export const pikkuConsoleGetVariable = pikkuFunc({
56
31
  tags: ['pikku'],
57
32
  description: 'Get the current value of a variable',
@@ -89,36 +64,6 @@ export const pikkuConsoleSetVariable = pikkuFunc({
89
64
  },
90
65
  })
91
66
 
92
- export const pikkuConsoleHasSecret = pikkuFunc({
93
- secretBroker: true,
94
- tags: ['pikku'],
95
- description: 'Check if a secret exists without reading its value',
96
- expose: true,
97
- input: SecretRef,
98
- output: Exists,
99
- func: async ({ secrets }, { secretId }) => {
100
- const exists = await secrets.hasSecret(secretId)
101
- return { exists }
102
- },
103
- })
104
-
105
- export const pikkuConsoleGetSecret = pikkuFunc({
106
- secretBroker: true,
107
- tags: ['pikku'],
108
- description: 'Get the current value of a secret',
109
- expose: true,
110
- input: SecretRef,
111
- output: ValueResult,
112
- func: async ({ secrets }, { secretId }) => {
113
- const exists = await secrets.hasSecret(secretId)
114
- if (!exists) {
115
- return { exists: false, value: null }
116
- }
117
- const value = await secrets.getSecret(secretId)
118
- return { exists: true, value: value.reveal() }
119
- },
120
- })
121
-
122
67
  export const consoleRoutes = defineHTTPRoutes({
123
68
  auth: false,
124
69
  tags: ['pikku'],
@@ -132,7 +77,15 @@ export const consoleRoutes = defineHTTPRoutes({
132
77
  },
133
78
  })
134
79
 
135
- wireAddon({ name: 'console', package: '@pikku/addon-console', scopes: ['admin'] })
80
+ wireAddon({
81
+ name: 'console',
82
+ package: '@pikku/addon-console',
83
+ scopes: ['admin'],
84
+ globalSecrets:
85
+ 'the console administers secrets an operator names at runtime, so no static declaration can cover them',
86
+ globalCredentials:
87
+ 'the console lists and links credentials across every user, so it cannot be scoped to a declared set',
88
+ })
136
89
  wireHTTPRoutes({ basePath: '${globalHTTPPrefix}', routes: { console: consoleRoutes } })
137
90
  `;
138
91
  return { schemas, functions };
@@ -15,7 +15,7 @@ export const serializeFunctionTypes = (userSessionTypeImport, userSessionTypeNam
15
15
  * Core function, middleware, and permission types for all wirings
16
16
  */
17
17
 
18
- import type { CorePikkuMiddleware, CorePermissionGroup, ListInput, ListOutput, PikkuWire, PickRequired, SecretlessServices, SecretService } from '@pikku/core'
18
+ import type { CorePikkuMiddleware, CorePermissionGroup, ListInput, ListOutput, PikkuWire, PickRequired, SecretlessServices } from '@pikku/core'
19
19
  import type { CorePikkuFunctionConfig, CorePikkuSessionlessFunctionConfig, CorePikkuAuth, CorePikkuAuthConfig, CorePikkuPermission } from '@pikku/core/function'
20
20
  import { pikkuAuth as pikkuAuthCore } from '@pikku/core/function'
21
21
  import {
@@ -56,16 +56,6 @@ export type WiredServices = SecretlessServices<RequiredSingletonServices & Servi
56
56
  /** \`WiredSingletonServices\` without \`secrets\`, for auth gates. */
57
57
  export type WiredAuthServices = SecretlessServices<WiredSingletonServices>
58
58
 
59
- /**
60
- * \`WiredServices\` with \`secrets\` restored, for the console's secret-admin
61
- * functions. Reached by declaring \`secretBroker: true\` on a \`pikkuFunc\` config.
62
- *
63
- * Declaring it does not grant the service. The runner hands out the real
64
- * \`SecretService\` only to the functions the inspector marks as secret brokers;
65
- * every other function still receives the throwing accessor.
66
- */
67
- export type WiredSecretBrokerServices = WiredServices & { secrets: SecretService }
68
-
69
59
  /**
70
60
  * Inline node configuration for function definitions.
71
61
  */
@@ -301,15 +291,10 @@ export const pikkuApprovalDescription = <In = unknown, RequiredServices extends
301
291
  * @template In - The input type
302
292
  * @template Out - The output type that the function returns
303
293
  * @template RequiredServices - Services required by this function
304
- * @template ScenarioOut - Types \`scenario.context\`. Only scenarios set it:
305
- * \`PikkuFunctionScenario\` passes the scenario's own output, and a *hook*
306
- * passes the output of the scenario it belongs to (it returns void itself).
307
- *
308
- * It deliberately does NOT default to \`Out\`. That would make every ordinary
309
- * function's wire type vary with its return type, and a \`func\` written
310
- * against the \`PikkuFunction | PikkuFunctionSessionless\` union then loses
311
- * contextual typing — its parameters fall back to \`any\` and the assignment
312
- * fails with no hint as to why.
294
+ * @template ScenarioOut - Types \`scenario.context\`; only scenarios set it.
295
+ * Not defaulted to \`Out\`, which would make every ordinary function's wire
296
+ * type vary with its return type and cost a \`func\` written against the
297
+ * \`PikkuFunction | PikkuFunctionSessionless\` union its contextual typing.
313
298
  */
314
299
  export type PikkuFunctionSessionless<
315
300
  In = unknown,
@@ -363,10 +348,8 @@ export type PikkuFunctionConfig<
363
348
  In = unknown,
364
349
  Out = unknown,
365
350
  RequiredWires extends keyof PikkuWire = never,
366
- // \`any\` in the ScenarioOut slot, not \`unknown\`: a scenario body types its
367
- // context as its own output, and a constraint pinned to one context type
368
- // would refuse it. \`ScenarioContext<any>\` collapses to \`any\`, so the
369
- // constraint stays open on that axis alone.
351
+ // \`any\` in the ScenarioOut slot: a constraint pinned to one context type
352
+ // would refuse a scenario body, which types its context as its own output.
370
353
  PikkuFunc extends PikkuFunction<In, Out, RequiredWires, any> | PikkuFunctionSessionless<In, Out, RequiredWires, any, any> = PikkuFunction<In, Out, RequiredWires> | PikkuFunctionSessionless<In, Out, RequiredWires>,
371
354
  InputSchema extends StandardSchemaV1 | undefined = undefined,
372
355
  OutputSchema extends StandardSchemaV1 | undefined = undefined
@@ -454,12 +437,6 @@ export type PikkuFunctionConfigWithSchema<
454
437
  * })
455
438
  * \`\`\`
456
439
  */
457
- export function pikkuFunc<
458
- InputSchema extends StandardSchemaV1 | undefined = undefined,
459
- OutputSchema extends StandardSchemaV1 | undefined = undefined
460
- >(
461
- config: PikkuFunctionConfigWithSchema<InputSchema, OutputSchema, 'session' | 'rpc', WiredSecretBrokerServices> & { secretBroker: true }
462
- ): PikkuFunctionConfig<InputSchema extends StandardSchemaV1 ? InferSchemaOutput<InputSchema> : unknown, OutputSchema extends StandardSchemaV1 ? InferSchemaOutput<OutputSchema> : unknown, 'session' | 'rpc'>
463
440
  export function pikkuFunc<
464
441
  InputSchema extends StandardSchemaV1 | undefined = undefined,
465
442
  OutputSchema extends StandardSchemaV1 | undefined = undefined
@@ -60,8 +60,12 @@ export const serializeMiddlewareImports = (outputPath, middlewareState, httpStat
60
60
  // it here, into the always-bootstrap-imported pikku-middleware.gen.ts,
61
61
  // guarantees global middleware registers in every unit. A duplicate import
62
62
  // in full builds is harmless — module bodies evaluate once.
63
+ //
64
+ // `isFactoryCall` is not consulted: it distinguishes `mw()` from `mw` as an
65
+ // array element, not a deferred registration behind an exported factory, and
66
+ // addGlobalMiddleware registers at module evaluation under either form.
63
67
  for (const [instanceId, instance] of Object.entries(middlewareState.instances)) {
64
- if (instanceId.startsWith('global:') && !instance.isFactoryCall) {
68
+ if (instanceId.startsWith('global:')) {
65
69
  directImports.add(getFileImportRelativePath(outputPath, instance.sourceFile, packageMappings));
66
70
  }
67
71
  }
@@ -35,6 +35,17 @@ export const pikkuPackage = pikkuSessionlessFunc({
35
35
  };
36
36
  }
37
37
  }
38
+ // A secret read the inspector could not resolve to a literal is absent by
39
+ // construction — such an addon needs `globalSecrets` on its `wireAddon`.
40
+ const declaredSecrets = new Set();
41
+ for (const definition of state.secrets?.definitions ?? []) {
42
+ declaredSecrets.add(definition.secretId);
43
+ }
44
+ for (const usage of state.secrets?.usage?.values() ?? []) {
45
+ for (const key of usage.keys) {
46
+ declaredSecrets.add(key);
47
+ }
48
+ }
38
49
  const content = serializePackageFactories(packageFile, addonName, pikkuConfigFactory
39
50
  ? {
40
51
  file: pikkuConfigFactory.file,
@@ -50,7 +61,7 @@ export const pikkuPackage = pikkuSessionlessFunc({
50
61
  file: wireServicesFactory.file,
51
62
  variable: wireServicesFactory.variable,
52
63
  }
53
- : undefined, packageMappings, Object.keys(credentialsMeta).length > 0 ? credentialsMeta : undefined, state.addonRequiredParentServices);
64
+ : undefined, packageMappings, Object.keys(credentialsMeta).length > 0 ? credentialsMeta : undefined, state.addonRequiredParentServices, [...declaredSecrets].sort());
54
65
  if (!content) {
55
66
  logger.info({
56
67
  message: 'Skipping package factories - no service factories found',
@@ -8,4 +8,4 @@ export interface CredentialMetaForPackage {
8
8
  type: 'singleton' | 'wire';
9
9
  oauth2?: boolean;
10
10
  }
11
- export declare const serializePackageFactories: (outputPath: string, packageName: string, configFactory: PackageFactoryInfo | undefined, singletonServicesFactory: PackageFactoryInfo | undefined, wireServicesFactory: PackageFactoryInfo | undefined, packageMappings?: Record<string, string>, credentialsMeta?: Record<string, CredentialMetaForPackage>, requiredParentServices?: string[]) => string | null;
11
+ export declare const serializePackageFactories: (outputPath: string, packageName: string, configFactory: PackageFactoryInfo | undefined, singletonServicesFactory: PackageFactoryInfo | undefined, wireServicesFactory: PackageFactoryInfo | undefined, packageMappings?: Record<string, string>, credentialsMeta?: Record<string, CredentialMetaForPackage>, requiredParentServices?: string[], declaredSecrets?: string[]) => string | null;
@@ -1,5 +1,5 @@
1
1
  import { getFileImportRelativePath } from '../../../utils/file-import-path.js';
2
- export const serializePackageFactories = (outputPath, packageName, configFactory, singletonServicesFactory, wireServicesFactory, packageMappings = {}, credentialsMeta, requiredParentServices) => {
2
+ export const serializePackageFactories = (outputPath, packageName, configFactory, singletonServicesFactory, wireServicesFactory, packageMappings = {}, credentialsMeta, requiredParentServices, declaredSecrets) => {
3
3
  const imports = [
4
4
  `import { pikkuState } from '@pikku/core/ecosystem'`,
5
5
  ];
@@ -29,10 +29,13 @@ export const serializePackageFactories = (outputPath, packageName, configFactory
29
29
  const requiredParentServicesLine = requiredParentServices && requiredParentServices.length > 0
30
30
  ? `\npikkuState('${packageName}', 'package', 'requiredParentServices', ${JSON.stringify(requiredParentServices)})\n`
31
31
  : '';
32
+ const declaredSecretsLine = declaredSecrets
33
+ ? `\npikkuState('${packageName}', 'package', 'declaredSecrets', ${JSON.stringify(declaredSecrets)})\n`
34
+ : '';
32
35
  return `${imports.join('\n')}
33
36
 
34
37
  pikkuState('${packageName}', 'package', 'factories', {
35
38
  ${factoryEntries.join('\n')}
36
39
  })
37
- ${credentialsLine}${requiredParentServicesLine}`;
40
+ ${credentialsLine}${requiredParentServicesLine}${declaredSecretsLine}`;
38
41
  };
@@ -59,12 +59,7 @@ ${generateAddonAgentImports(wireAddonDeclarations)}
59
59
  ${generateMergedAgentMap(wireAddonDeclarations)}
60
60
 
61
61
  import type { PikkuRPC } from '@pikku/core/rpc'
62
-
63
- interface AIAgentInput {
64
- message: string
65
- threadId: string
66
- resourceId: string
67
- }
62
+ import type { AIAgentInput } from '@pikku/core/ai-agent'
68
63
 
69
64
  export type TypedStartWorkflow = <Name extends keyof FlattenedWorkflowMap>(
70
65
  name: Name,
@@ -3,6 +3,7 @@ import { join } from 'node:path';
3
3
  import { addFunction } from '@pikku/core/function';
4
4
  import { pikkuState } from '@pikku/core/ecosystem';
5
5
  import { getStubTracker, isTestRun, } from '@pikku/core/services';
6
+ import { enableScoreSnapshots, getScoreSnapshot, gradeRun as coreGradeRun, } from '@pikku/core/ai-scorer';
6
7
  /**
7
8
  * The instrumentation `pikku scenario run` calls on the server under test:
8
9
  * snapshot/reset live coverage, and reset/read recorded stub calls.
@@ -52,6 +53,26 @@ const resetStubs = {
52
53
  const getStubCalls = {
53
54
  func: async (_services, data) => getStubTracker().getCalls(data?.service ?? undefined),
54
55
  };
56
+ /**
57
+ * Grade a finished agent run on demand, from the snapshot the runtime kept.
58
+ *
59
+ * Deliberately not sampled and not persisted: a scenario asserting on a grade
60
+ * needs that grade every time, and the assertion is the outcome — writing a
61
+ * test's score alongside production's would make the live figures unreadable.
62
+ */
63
+ const gradeRun = {
64
+ func: async (services, data) => {
65
+ const run = getScoreSnapshot(data.runId);
66
+ if (!run) {
67
+ throw new Error(`No finished run '${data.runId}' is available to grade. A run is gradeable only from the server that produced it, and only while it is among the most recent — check the scenario graded the run it just triggered.`);
68
+ }
69
+ return await coreGradeRun({
70
+ ...run,
71
+ ...(data.reference !== undefined ? { reference: data.reference } : {}),
72
+ scorerName: data.scorer,
73
+ }, services, { persist: false });
74
+ },
75
+ };
55
76
  const instrumentation = {
56
77
  pikkuScenarioTakeLiveCoverage: {
57
78
  ...takeLiveCoverage,
@@ -73,6 +94,11 @@ const instrumentation = {
73
94
  title: 'Get Stub Calls',
74
95
  description: 'Returns calls recorded against stubbed/spied services (via the stub()/spy() core utils). Empty unless the server records service calls (pikku dev --test).',
75
96
  },
97
+ pikkuScenarioGradeRun: {
98
+ ...gradeRun,
99
+ title: 'Grade Run',
100
+ description: "Runs one declared scorer against a finished agent run and returns the grade, ignoring the scorer's live sample rate. Accepts a reference answer, which is the only way a reference-based judge is reachable. The grade is returned, never recorded.",
101
+ },
76
102
  };
77
103
  /**
78
104
  * Register the instrumentation into the running dev server's state, so the
@@ -85,6 +111,10 @@ const instrumentation = {
85
111
  */
86
112
  export const registerScenarioInstrumentation = (requireAuth) => {
87
113
  const meta = pikkuState(null, 'function', 'meta');
114
+ // Retaining finished runs is what makes them gradeable, and this is the only
115
+ // place that can grade one — so the buffer is turned on here rather than by a
116
+ // flag someone has to remember, and stays absent from every other process.
117
+ enableScoreSnapshots();
88
118
  for (const [name, { func, title, description }] of Object.entries(instrumentation)) {
89
119
  addFunction(name, { func, auth: requireAuth });
90
120
  meta[name] = {
@@ -1,4 +1,4 @@
1
- import type { FeaturesMeta } from '@pikku/core/workflow/types';
1
+ import type { FeaturesMeta } from '@pikku/core/scenario';
2
2
  import type { InspectorFeature } from '@pikku/inspector';
3
3
  /**
4
4
  * The feature meta the console reads, built from what the inspector could read
@@ -11,11 +11,12 @@ export const serializeScenarioRegistration = (outputPath, metaImportPath, scenar
11
11
  return 'export {}';
12
12
  }
13
13
  const lines = [];
14
- const registrars = [
15
- ...(hasScenarios ? ['addWorkflow'] : []),
16
- ...(hasFeatures ? ['addFeature'] : []),
17
- ];
18
- lines.push(`import { ${registrars.join(', ')} } from '@pikku/core/workflow'`);
14
+ if (hasScenarios) {
15
+ lines.push(`import { addWorkflow } from '@pikku/core/workflow'`);
16
+ }
17
+ if (hasFeatures) {
18
+ lines.push(`import { addFeature } from '@pikku/core/scenario'`);
19
+ }
19
20
  lines.push(`import '${metaImportPath}'`);
20
21
  const sortedScenarios = Array.from(scenarioFiles.entries()).sort((a, b) => a[0].localeCompare(b[0]));
21
22
  // A feature holds the very objects its scenarios were registered with, so it
@@ -9,11 +9,8 @@
9
9
  export const serializePersonas = (personas, agentMapImportPath, rpcMapImportPath) => {
10
10
  return `/** Personas declared with definePersonas() */
11
11
  import { createHttpPersonas } from '@pikku/core/persona'
12
- import type {
13
- HttpPersonasConfig,
14
- ScenarioPersona,
15
- ResolvedPersona,
16
- } from '@pikku/core/services'
12
+ import type { HttpPersonasConfig } from '@pikku/core/persona'
13
+ import type { ScenarioPersona, ResolvedPersona } from '@pikku/core/services'
17
14
  import type { AgentMap } from '${agentMapImportPath}'
18
15
  import type { FlattenedRPCMap } from '${rpcMapImportPath}'
19
16
 
@@ -274,10 +274,18 @@ export const workflowStatusStreamFull = pikkuSessionlessFunc({
274
274
  * The decision is validated on replay inside the workflow body — the only place
275
275
  * the approval's schema value is in scope — so this route deliberately accepts
276
276
  * an unknown payload. An invalid one re-closes the gate rather than failing the
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.
277
+ * request.
278
+ *
279
+ * WHO may approve is likewise the gate's own business, declared with
280
+ * \`approvers\`/\`approverScope\` on \`workflow.approval()\`, and enforced in two
281
+ * places. Once the run has reached the gate it has published its policy, so this
282
+ * route judges the caller against it and refuses with a 403. A decision arriving
283
+ * before the gate has no policy to judge against yet, so it is accepted here and
284
+ * judged on replay instead, where failing discards the decision and leaves the
285
+ * gate closed. A caller sees either outcome depending on that timing.
286
+ *
287
+ * A gate that declares neither accepts a decision from anyone this route lets
288
+ * through — gate the route with your own auth/permissions to narrow that.
281
289
  */
282
290
  export const workflowApprover = pikkuSessionlessFunc({
283
291
  tags: ['pikku'],
@@ -6,7 +6,8 @@ import {
6
6
  type PikkuWorkflowGraphConfig,
7
7
  type PikkuWorkflowGraphResult,
8
8
  } from '@pikku/core/workflow'
9
- import type { PikkuWorkflowWire, PikkuScenarioWire, WorkflowStepOptions, ScenarioStepOptions } from '@pikku/core/workflow'
9
+ import type { PikkuWorkflowWire, WorkflowStepOptions } from '@pikku/core/workflow'
10
+ import type { PikkuScenarioWire, ScenarioStepOptions } from '@pikku/core/scenario'
10
11
 
11
12
  export { WorkflowCancelledException }
12
13
  import type { PikkuFunctionSessionless, PikkuFunctionConfig, WiredServices } from '${functionTypesImportPath}'
@@ -71,10 +72,7 @@ export interface TypedScenarioSteps {
71
72
  ): Promise<FlattenedScenarioStepMap[K]['output']>
72
73
  }
73
74
 
74
- /**
75
- * \`Out\` types \`scenario.context\` — the scratch the body shares with its
76
- * \`before\`/\`after\` hooks — as a partial of what a completed run produces.
77
- */
75
+ /** \`Out\` types \`scenario.context\`. */
78
76
  export type TypedScenario<Out = unknown> = TypedWorkflow &
79
77
  Omit<PikkuScenarioWire<Out>, keyof PikkuWorkflowWire | keyof TypedScenarioSteps> &
80
78
  TypedScenarioSteps
@@ -91,9 +89,9 @@ export type PikkuFunctionWorkflow<
91
89
  > = PikkuFunctionSessionless<In, Out, 'workflow'>
92
90
 
93
91
  /**
94
- * \`Ctx\` types \`scenario.context\` and defaults to the function's own output,
95
- * which is what a scenario body wants. A hook returns void but shares the
96
- * scenario's context, so it passes the scenario's output here instead.
92
+ * \`Ctx\` types \`scenario.context\`, defaulting to the body's own output. A hook
93
+ * returns void but shares the scenario's context, so it passes that scenario's
94
+ * output here instead.
97
95
  */
98
96
  export type PikkuFunctionScenario<
99
97
  In = unknown,
@@ -185,10 +183,8 @@ export type PikkuScenarioConfigWithSchema<
185
183
  * Always runs after the scenario body, in a \`finally\`, whether it passed or
186
184
  * failed. Throwing fails a run that would otherwise have passed; on an
187
185
  * already-failed run it attaches as the \`cause\` and never replaces the
188
- * original error.
189
- *
190
- * Reads \`scenario.context\` for whatever the body managed to record before it
191
- * stopped — that is how teardown learns the ids a failed run created.
186
+ * original error. Reads \`scenario.context\` for whatever the body managed to
187
+ * record before it stopped.
192
188
  */
193
189
  after?: PikkuScenarioHook<InputSchema, OutputSchema>
194
190
  /**
@@ -202,11 +198,8 @@ export type PikkuScenarioConfigWithSchema<
202
198
 
203
199
  /**
204
200
  * A scenario lifecycle hook: the scenario's own \`(services, data, wire)\`
205
- * signature with its result discarded.
206
- *
207
- * The hook returns void but shares the scenario's \`context\`, so the output
208
- * schema types \`scenario.context\` while the return type stays \`void\` — a hook
209
- * is setup and teardown, never a step, and nothing it returns is recorded.
201
+ * signature with its result discarded. \`OutputSchema\` types
202
+ * \`scenario.context\` while the return type stays \`void\`.
210
203
  */
211
204
  export type PikkuScenarioHook<
212
205
  InputSchema extends StandardSchemaV1 | undefined = undefined,
@@ -1,6 +1,7 @@
1
1
  import { existsSync } from 'fs';
2
2
  import { pikkuWorkflowComplexFunc } from '#pikku/workflow/pikku-workflow-types.gen.js';
3
3
  import { assertSingleCoreVersion } from '../../utils/assert-single-core-version.js';
4
+ import { warnOnSplitTypeIdentity } from '../validate/type-identity-checks.js';
4
5
  import { pruneLegacyScaffoldFiles, removeRetiredScaffoldFiles, } from '../../utils/remove-legacy-scaffold-file.js';
5
6
  import { PikkuTypecheckFailedError, renderTscFull, renderTscSummary, runProjectTypecheck, } from '../../utils/tsc-check.js';
6
7
  const scaffoldFiles = (config) => {
@@ -45,6 +46,10 @@ export const allWorkflow = pikkuWorkflowComplexFunc({
45
46
  // Preflight: a split @pikku/core install silently breaks wiring registration
46
47
  // (workflows/RPCs "disappear"), so refuse to codegen against it.
47
48
  await assertSingleCoreVersion(config.rootDir, logger);
49
+ // Preflight: a linked dependency at a skewed version can exhaust the heap
50
+ // during the typecheck below, and an OOM aborts before anything can explain
51
+ // it. Say it now or never.
52
+ await warnOnSplitTypeIdentity(config.rootDir, logger);
48
53
  await pruneLegacyScaffoldFiles(config);
49
54
  await removeRetiredScaffoldFiles(config);
50
55
  const allImports = [];
@@ -154,16 +159,21 @@ export const allWorkflow = pikkuWorkflowComplexFunc({
154
159
  if (hasPackageFactories) {
155
160
  allImports.push(config.packageFile);
156
161
  }
157
- const [hasInternalRPCs, agents] = await Promise.all([
162
+ const [hasInternalRPCs, agents, scorers] = await Promise.all([
158
163
  workflow.do('RPC', 'pikkuRPC', null),
159
164
  workflow.do('AI agent', 'pikkuAIAgent', null),
165
+ workflow.do('AI scorer', 'pikkuAIScorer', null),
160
166
  ]);
167
+ allImports.push(config.modelAliasesFile);
161
168
  if (agents) {
162
169
  allImports.push(config.agentWiringMetaFile, config.agentWiringsFile);
163
170
  if (config.scaffold?.agent) {
164
171
  await workflow.do('Public agent scaffold', 'pikkuPublicAgent', null);
165
172
  }
166
173
  }
174
+ if (scorers) {
175
+ allImports.push(config.scorerWiringMetaFile, config.scorerWiringsFile);
176
+ }
167
177
  // Scaffold and definition generators are all independent
168
178
  await Promise.all([
169
179
  workflow.do('Graph wirings', 'pikkuGraphWirings', null),
@@ -24,6 +24,9 @@ export class BunServerRunner {
24
24
  // every Bun project: `config.content` arrived, but the service that
25
25
  // verifies its signatures did not.
26
26
  contentSigningJWT: options.contentSigningJWT,
27
+ // Read off this options object by the transport, not off `config` — so it
28
+ // has to be forwarded here explicitly, exactly like the JWT above.
29
+ mcpJson: options.mcpJson,
27
30
  });
28
31
  }
29
32
  }
@@ -26,6 +26,16 @@ export type DevServerOptions = {
26
26
  * instance — otherwise every signed URL is rejected.
27
27
  */
28
28
  contentSigningJWT?: JWTService;
29
+ /**
30
+ * The generated MCP manifest. Handed straight to the transport, which mounts
31
+ * the MCP endpoint only when it is present — so a runner that forgets to
32
+ * forward this serves a 404 with no error anywhere.
33
+ */
34
+ mcpJson?: {
35
+ tools?: unknown[];
36
+ resources?: unknown[];
37
+ prompts?: unknown[];
38
+ };
29
39
  };
30
40
  export interface DevServerRunner {
31
41
  /**
@@ -18,6 +18,9 @@ export class NodeServerRunner {
18
18
  pikkuWebsocketHandler({ server: httpServer, wss, logger });
19
19
  },
20
20
  contentSigningJWT: options.contentSigningJWT,
21
+ // Read off this options object by the transport, not off `config` — so it
22
+ // has to be forwarded here explicitly, exactly like the JWT above.
23
+ mcpJson: options.mcpJson,
21
24
  });
22
25
  return {
23
26
  init: () => server.init(),
@@ -267,6 +267,7 @@ export const createSingletonServices = async (config) => {
267
267
  // cost. Never runs during a plain `pikku all`.
268
268
  classificationCheck: !setupOnly && !!config.security,
269
269
  strictMeta: !!config.strictMeta,
270
+ modelAliases: config.models ?? {},
270
271
  allow: config.allow ?? {},
271
272
  schemaConfig: !setupOnly
272
273
  ? {
@@ -6,7 +6,7 @@
6
6
  * second inspection pass. Only user-visible buildable surfaces are included;
7
7
  * plumbing (secrets/variables/middleware/permissions) is intentionally omitted.
8
8
  */
9
- export type MetaDiffCategoryName = 'functions' | 'http' | 'workflow' | 'email' | 'scheduler' | 'queue' | 'channel' | 'trigger' | 'mcp' | 'agent';
9
+ export type MetaDiffCategoryName = 'functions' | 'http' | 'workflow' | 'email' | 'scheduler' | 'queue' | 'channel' | 'trigger' | 'mcp' | 'agent' | 'scorer';
10
10
  export interface MetaDiffEntry {
11
11
  id: string;
12
12
  status: 'added' | 'removed' | 'modified';
@@ -12,12 +12,14 @@ const SINGLE_FILE = {
12
12
  trigger: 'trigger/pikku-trigger-meta.gen.json',
13
13
  mcp: 'mcp/pikku-mcp-wirings-meta.gen.json',
14
14
  agent: 'agent/pikku-agent-wirings-meta.gen.json',
15
+ scorer: 'agent/pikku-scorer-wirings-meta.gen.json',
15
16
  };
16
17
  // A few meta files wrap their real entities under a single key rather than
17
18
  // keying them at the top level — unwrap to that map so ids are the entities.
18
19
  const UNWRAP = {
19
20
  email: 'templates',
20
21
  agent: 'agentsMeta',
22
+ scorer: 'scorersMeta',
21
23
  };
22
24
  // Workflows (incl. scenarios) are written one file per workflow under
23
25
  // this dir; the file basename (sans `.gen.json`) is the id, `-verbose` excluded.
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Applies `--model cheap:openai/gpt-5-nano` to a `pikku dev` / `pikku serve`
3
+ * run, via PIKKU_MODEL_ALIASES so it leaves no trace in generated output.
4
+ */
5
+ export declare const applyModelAliasOverride: (logger: {
6
+ warn: (message: string) => void;
7
+ }, model: string | undefined, configuredAliases?: Record<string, string>) => void;
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Applies `--model cheap:openai/gpt-5-nano` to a `pikku dev` / `pikku serve`
3
+ * run, via PIKKU_MODEL_ALIASES so it leaves no trace in generated output.
4
+ */
5
+ export const applyModelAliasOverride = (logger, model, configuredAliases = {}) => {
6
+ if (!model)
7
+ return;
8
+ for (const entry of model.split(',')) {
9
+ const separator = entry.indexOf(':');
10
+ if (separator === -1) {
11
+ throw new Error(`--model expects alias:provider/model (e.g. 'cheap:openai/gpt-5-nano'), got '${entry}'.`);
12
+ }
13
+ const alias = entry.slice(0, separator).trim();
14
+ const target = entry.slice(separator + 1).trim();
15
+ // An empty half still contains the separator, so it survives the check
16
+ // above. `cheap:` is the damaging one: the core resolver prefers the
17
+ // environment override, finds nothing behind the alias, and fails later
18
+ // with an unknown-alias error naming a model the user never typed.
19
+ if (!alias || !target) {
20
+ throw new Error(`--model expects alias:provider/model (e.g. 'cheap:openai/gpt-5-nano'), got '${entry}' with ${alias ? 'no model' : 'no alias'}.`);
21
+ }
22
+ if (alias.includes('/')) {
23
+ throw new Error(`--model repoints an alias, and '${alias}' is not an alias but a provider-qualified model. Name the alias whose model you want to change, e.g. 'cheap:${target}'.`);
24
+ }
25
+ // A warning, not an error: the table may come from an addon config this
26
+ // run has not loaded.
27
+ if (Object.keys(configuredAliases).length > 0 &&
28
+ !configuredAliases[alias]) {
29
+ logger.warn(`--model overrides alias '${alias}', which is not in the "models" table of pikku.config.json (${Object.keys(configuredAliases).sort().join(', ')}) — nothing may use it.`);
30
+ }
31
+ }
32
+ process.env.PIKKU_MODEL_ALIASES = model;
33
+ };
@@ -489,12 +489,28 @@ const _getPikkuCLIConfig = async (logger, configFile = undefined, requiredFields
489
489
  if (!result.agentWiringMetaJsonFile) {
490
490
  result.agentWiringMetaJsonFile = join(agentDir, 'pikku-agent-wirings-meta.gen.json');
491
491
  }
492
+ if (!result.modelAliasesFile) {
493
+ result.modelAliasesFile = join(agentDir, 'pikku-model-aliases.gen.ts');
494
+ }
492
495
  if (!result.agentTypesFile) {
493
496
  result.agentTypesFile = join(agentDir, 'pikku-agent-types.gen.ts');
494
497
  }
495
498
  if (!result.agentMapDeclarationFile) {
496
499
  result.agentMapDeclarationFile = join(agentDir, 'pikku-agent-map.gen.d.ts');
497
500
  }
501
+ // AI Scorer — the same directory as agents: a scorer exists to grade one.
502
+ if (!result.scorerWiringsFile) {
503
+ result.scorerWiringsFile = join(agentDir, 'pikku-scorer-wirings.gen.ts');
504
+ }
505
+ if (!result.scorerWiringMetaFile) {
506
+ result.scorerWiringMetaFile = join(agentDir, 'pikku-scorer-wirings-meta.gen.ts');
507
+ }
508
+ if (!result.scorerWiringMetaJsonFile) {
509
+ result.scorerWiringMetaJsonFile = join(agentDir, 'pikku-scorer-wirings-meta.gen.json');
510
+ }
511
+ if (!result.scorerNamesDeclarationFile) {
512
+ result.scorerNamesDeclarationFile = join(agentDir, 'pikku-scorer-names.gen.d.ts');
513
+ }
498
514
  // CLI
499
515
  if (!result.cliWiringsFile) {
500
516
  result.cliWiringsFile = join(cliDir, 'pikku-cli-wirings.gen.ts');