@pikku/cli 0.12.115 → 0.12.116
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.
- package/CHANGELOG.md +260 -0
- package/console-app/assets/{abnfDiagram-N423BO3Z-Bltf5dmS.js → abnfDiagram-N423BO3Z-WNIAg_Oa.js} +1 -1
- package/console-app/assets/architecture-TIHT7OUA-CIT-Nug2.js +1 -0
- package/console-app/assets/{architectureDiagram-T3A2C74G-BTtx6R7-.js → architectureDiagram-T3A2C74G-DM698mgf.js} +1 -1
- package/console-app/assets/{blockDiagram-VBNYF7ZC-DgeTIOaM.js → blockDiagram-VBNYF7ZC-DPfy9K5S.js} +1 -1
- package/console-app/assets/{c4Diagram-5PPSVZJV-CaswnNob.js → c4Diagram-5PPSVZJV-DhLbbBbX.js} +1 -1
- package/console-app/assets/channel-DQC6cL1c.js +1 -0
- package/console-app/assets/{chunk-2GRJ4B5K-OnpnkpQT.js → chunk-2GRJ4B5K-C1RQ1gvs.js} +1 -1
- package/console-app/assets/{chunk-4I5QYGJK-CWmfNXFr.js → chunk-4I5QYGJK-BkzSdNc_.js} +1 -1
- package/console-app/assets/{chunk-5RXB4S5H-M8QmKeuk.js → chunk-5RXB4S5H-DZpBpdcU.js} +1 -1
- package/console-app/assets/{chunk-6Q2QTUOP-C_h5lS68.js → chunk-6Q2QTUOP-mZObxdld.js} +1 -1
- package/console-app/assets/{chunk-7Z6QIM7H-DSnVb09k.js → chunk-7Z6QIM7H-C0HbxZEa.js} +1 -1
- package/console-app/assets/{chunk-GF5L2VYU-BkX038sq.js → chunk-GF5L2VYU-DXPVwWqW.js} +1 -1
- package/console-app/assets/{chunk-I66GZJ75-b3yMIljX.js → chunk-I66GZJ75-pVpq9ckD.js} +1 -1
- package/console-app/assets/{chunk-JQJVKLGR-Bihcz4nv.js → chunk-JQJVKLGR-DJQ8K4wK.js} +1 -1
- package/console-app/assets/{chunk-KBJHAD2P-CS7eflbk.js → chunk-KBJHAD2P-B8XuxRCO.js} +1 -1
- package/console-app/assets/{chunk-NSK5VX7P-CfigFGDQ.js → chunk-NSK5VX7P-cYzQU4bD.js} +1 -1
- package/console-app/assets/{chunk-QR6OTTB3-BBy8NfTW.js → chunk-QR6OTTB3-CNoTFsqn.js} +1 -1
- package/console-app/assets/{chunk-RYQCIY6F-BCfZVQef.js → chunk-RYQCIY6F-DoKRUO_N.js} +1 -1
- package/console-app/assets/{chunk-UBXNYLIW-DkMKDHW4.js → chunk-UBXNYLIW-BqcIoUpU.js} +1 -1
- package/console-app/assets/{chunk-W5SLKNZC-BSLytTSJ.js → chunk-W5SLKNZC-p0Qalbjj.js} +1 -1
- package/console-app/assets/{chunk-WRU74C26-Dic7ZP8H.js → chunk-WRU74C26-DUMn96Dr.js} +1 -1
- package/console-app/assets/chunk-XXDRQBXY-Dgz5VbWO.js +1 -0
- package/console-app/assets/classDiagram-JCYQIIEL-1ASFocNV.js +1 -0
- package/console-app/assets/classDiagram-v2-OCEON4UE-1ASFocNV.js +1 -0
- package/console-app/assets/{cose-bilkent-JH36ORCC-CEpWcE3M.js → cose-bilkent-JH36ORCC-BCh3BlPI.js} +1 -1
- package/console-app/assets/{cynefin-VYW2F7L2-irPiPhgz.js → cynefin-VYW2F7L2-ZfghUZsD.js} +1 -1
- package/console-app/assets/{cynefinDiagram-MW4NZA55-CIkqQ912.js → cynefinDiagram-MW4NZA55-DcV3QXCe.js} +1 -1
- package/console-app/assets/{dagre-FZyyw3H3.js → dagre-BPFWXLBN.js} +1 -1
- package/console-app/assets/{dagre-VZM6K2ZE-Dxnnu7Rh.js → dagre-VZM6K2ZE-DETshBO-.js} +1 -1
- package/console-app/assets/{diagram-7IWD3JNH-DaT47sVs.js → diagram-7IWD3JNH-CsLX3P2o.js} +1 -1
- package/console-app/assets/{diagram-B4RE2ZJO-Dmht03tx.js → diagram-B4RE2ZJO-o2zcxm5S.js} +1 -1
- package/console-app/assets/{diagram-LBJQPF4R-B--jwILh.js → diagram-LBJQPF4R-BD2zKU21.js} +1 -1
- package/console-app/assets/{diagram-Q27KOJAE-D9H0euUr.js → diagram-Q27KOJAE-DHaacyna.js} +1 -1
- package/console-app/assets/{diagram-UB23O5K3-DloUQ8tO.js → diagram-UB23O5K3-pSLCMUyV.js} +1 -1
- package/console-app/assets/{ebnfDiagram-BXEA7PRR-gaOXzNBU.js → ebnfDiagram-BXEA7PRR-BDzawX3O.js} +1 -1
- package/console-app/assets/{erDiagram-JOGREHBK-3X9eTLsh.js → erDiagram-JOGREHBK-CyYnPmbN.js} +1 -1
- package/console-app/assets/eventmodeling-45OFAUF4-BYJ0A5k-.js +1 -0
- package/console-app/assets/flowDiagram-UKHOOZJN-CVn87uiP.js +1 -0
- package/console-app/assets/{ganttDiagram-PKOTCBZU-khAFwSBy.js → ganttDiagram-PKOTCBZU-3fhCBbPA.js} +1 -1
- package/console-app/assets/{gitGraph-TEB2WS4Q-Bb7uENmk.js → gitGraph-TEB2WS4Q-CdLRkVux.js} +1 -1
- package/console-app/assets/{gitGraphDiagram-DS77QQ5N-OkSBM0h0.js → gitGraphDiagram-DS77QQ5N-CC1epdKw.js} +1 -1
- package/console-app/assets/{index-Bn1BoT3w.js → index-BRmokG9t.js} +184 -184
- package/console-app/assets/{index-suVNAhyL.css → index-GruDnAhJ.css} +1 -1
- package/console-app/assets/{info-DKCQHKI2-BH5dbX2B.js → info-DKCQHKI2-BJs8WkzC.js} +1 -1
- package/console-app/assets/{infoDiagram-6WML65LV-IbUl8J2C.js → infoDiagram-6WML65LV-uoOwoIeI.js} +1 -1
- package/console-app/assets/{ishikawaDiagram-WSZJBQD7-CX0gA3de.js → ishikawaDiagram-WSZJBQD7-vCUJhwTi.js} +1 -1
- package/console-app/assets/{journeyDiagram-NVQOT4AX--k2etXu8.js → journeyDiagram-NVQOT4AX-D2QcIlLG.js} +1 -1
- package/console-app/assets/{kanban-definition-27J2QSJJ-D1FvtPpN.js → kanban-definition-27J2QSJJ-JwwKowmR.js} +1 -1
- package/console-app/assets/{line-JLMY_DDK.js → line-h2oRreYF.js} +1 -1
- package/console-app/assets/{linear-CSvLB3cd.js → linear-Dz002X_a.js} +1 -1
- package/console-app/assets/{mermaid-parser.core-CwwjcAjz.js → mermaid-parser.core-DTgmT0AA.js} +3 -3
- package/console-app/assets/{mermaid.core-hmS_M4K5.js → mermaid.core-1jSEDr-j.js} +4 -4
- package/console-app/assets/{mindmap-definition-FAOFIHXS-rTDa_CTp.js → mindmap-definition-FAOFIHXS-C3Txxhj4.js} +1 -1
- package/console-app/assets/{packet-7NZHBO7P-DBUJcYfI.js → packet-7NZHBO7P-BGG7zIK2.js} +1 -1
- package/console-app/assets/{pegDiagram-VL7TDLO6-D42PxXnS.js → pegDiagram-VL7TDLO6--g1r_rov.js} +1 -1
- package/console-app/assets/{pie-RZYD4A2V-dM0uFAE4.js → pie-RZYD4A2V-C5OepMH7.js} +1 -1
- package/console-app/assets/{pieDiagram-7S7Q4E2Y-wCln1ucl.js → pieDiagram-7S7Q4E2Y-DGD_LzGm.js} +1 -1
- package/console-app/assets/{quadrantDiagram-CIZ2JOQS-DrRwS1g5.js → quadrantDiagram-CIZ2JOQS-CyBQQlD2.js} +1 -1
- package/console-app/assets/{radar-I7S5WNFK-BW0V-EGR.js → radar-I7S5WNFK-CaBOAO95.js} +1 -1
- package/console-app/assets/{railroad-3IZDKUUU-FiTHaDbb.js → railroad-3IZDKUUU-2aTWN4Pw.js} +1 -1
- package/console-app/assets/railroad-abnf-AHOZXSZD-TU7k5gB_.js +1 -0
- package/console-app/assets/railroad-ebnf-EBAXGLYW-DbArPBkM.js +1 -0
- package/console-app/assets/railroad-peg-LSFZ7HO6-TzB93z4K.js +1 -0
- package/console-app/assets/{railroadDiagram-AXF67PYL-9ef7j5U7.js → railroadDiagram-AXF67PYL-3Nr0rlTp.js} +1 -1
- package/console-app/assets/{requirementDiagram-LRYGKXZP-Cu90DbEZ.js → requirementDiagram-LRYGKXZP-BN7sEwSa.js} +1 -1
- package/console-app/assets/{sankeyDiagram-W5VNT64P-Bhxmyxaw.js → sankeyDiagram-W5VNT64P-CXZR46wO.js} +1 -1
- package/console-app/assets/{sequenceDiagram-SI44F4Z6-CBsbRTz8.js → sequenceDiagram-SI44F4Z6-DNtmdJ4U.js} +1 -1
- package/console-app/assets/{src-BR8qR3lM.js → src-x1E3pJJ-.js} +1 -1
- package/console-app/assets/{stateDiagram-OKZ733FA-Dr0frETZ.js → stateDiagram-OKZ733FA-B_GyYdl_.js} +1 -1
- package/console-app/assets/stateDiagram-v2-UEYNNEHI-D7V_HITc.js +1 -0
- package/console-app/assets/{swimlanes-SLNWSIFB-CXMjvd_a.js → swimlanes-SLNWSIFB-D4N7VdF7.js} +1 -1
- package/console-app/assets/swimlanesDiagram-ULZ7WXOC-C4XcIHKT.js +8 -0
- package/console-app/assets/{timeline-definition-Z64GVDOM-DpmEZPV0.js → timeline-definition-Z64GVDOM-DU5rsOWQ.js} +1 -1
- package/console-app/assets/{treeView-QDETBFTQ-CjmuinMk.js → treeView-QDETBFTQ-DaKM_9sB.js} +1 -1
- package/console-app/assets/{treemap-6X3UGDF4-BP_fU6Cn.js → treemap-6X3UGDF4-BabsKtZY.js} +1 -1
- package/console-app/assets/{vennDiagram-T6HMQDX7-DgZS7iuW.js → vennDiagram-T6HMQDX7-Dniftpq0.js} +1 -1
- package/console-app/assets/{wardley-OPB4EBWU-CgMPoouN.js → wardley-OPB4EBWU-BWffQNys.js} +1 -1
- package/console-app/assets/{wardleyDiagram-T6FBY63Y-6y-xxP1R.js → wardleyDiagram-T6FBY63Y-CQ74fVdn.js} +1 -1
- package/console-app/assets/{xychartDiagram-ELKLHX3M-DOeIQjYI.js → xychartDiagram-ELKLHX3M-D-XxbGIL.js} +1 -1
- package/console-app/index.html +2 -2
- package/dist/.pikku/addon/index.d.ts +1 -1
- package/dist/.pikku/addon/index.js +1 -1
- package/dist/.pikku/addon/pikku-addon-types.gen.d.ts +1 -1
- package/dist/.pikku/addon/pikku-addon-types.gen.js +1 -1
- package/dist/.pikku/agent/index.d.ts +1 -1
- package/dist/.pikku/agent/index.js +1 -1
- package/dist/.pikku/agent/pikku-agent-types.gen.d.ts +42 -1
- package/dist/.pikku/agent/pikku-agent-types.gen.js +41 -0
- package/dist/.pikku/agent/pikku-model-aliases.gen.js +1 -1
- package/dist/.pikku/auth/index.d.ts +1 -1
- package/dist/.pikku/auth/index.js +1 -1
- package/dist/.pikku/auth/pikku-auth-types.gen.d.ts +2 -19
- package/dist/.pikku/auth/pikku-auth-types.gen.js +2 -19
- package/dist/.pikku/channel/index.d.ts +1 -1
- package/dist/.pikku/channel/index.js +1 -1
- package/dist/.pikku/channel/pikku-channel-types.gen.d.ts +10 -18
- package/dist/.pikku/channel/pikku-channel-types.gen.js +9 -1
- package/dist/.pikku/cli/index.d.ts +1 -1
- package/dist/.pikku/cli/index.js +1 -1
- package/dist/.pikku/cli/pikku-cli-channel.js +6 -6
- package/dist/.pikku/cli/pikku-cli-client.gen.d.ts +1 -1
- package/dist/.pikku/cli/pikku-cli-client.gen.js +1 -1
- package/dist/.pikku/cli/pikku-cli-contracts-meta.gen.d.ts +1 -1
- package/dist/.pikku/cli/pikku-cli-contracts-meta.gen.js +1 -1
- package/dist/.pikku/cli/pikku-cli-contracts-meta.gen.json +24 -23
- package/dist/.pikku/cli/pikku-cli-types.gen.d.ts +8 -7
- package/dist/.pikku/cli/pikku-cli-types.gen.js +8 -7
- package/dist/.pikku/cli/pikku-cli-wirings-meta.gen.js +1 -1
- package/dist/.pikku/cli/pikku-cli-wirings-meta.gen.json +51 -23
- package/dist/.pikku/cli/pikku-cli-wirings.gen.d.ts +1 -1
- package/dist/.pikku/cli/pikku-cli-wirings.gen.js +1 -1
- package/dist/.pikku/cli/pikku-cli.gen.d.ts +1 -1
- package/dist/.pikku/cli/pikku-cli.gen.js +1 -1
- package/dist/.pikku/error/index.d.ts +1 -1
- package/dist/.pikku/error/index.js +1 -1
- package/dist/.pikku/error/pikku-error-types.gen.d.ts +1 -1
- package/dist/.pikku/error/pikku-error-types.gen.js +1 -1
- package/dist/.pikku/function/index.d.ts +1 -1
- package/dist/.pikku/function/index.js +1 -1
- package/dist/.pikku/function/pikku-function-types.gen.d.ts +36 -37
- package/dist/.pikku/function/pikku-function-types.gen.js +21 -9
- package/dist/.pikku/function/pikku-functions-meta.gen.js +1 -1
- package/dist/.pikku/function/pikku-functions-meta.gen.json +34 -34
- package/dist/.pikku/function/pikku-functions.gen.js +1 -1
- package/dist/.pikku/gateway/index.d.ts +1 -1
- package/dist/.pikku/gateway/index.js +1 -1
- package/dist/.pikku/gateway/pikku-gateway-types.gen.d.ts +1 -1
- package/dist/.pikku/gateway/pikku-gateway-types.gen.js +1 -1
- package/dist/.pikku/http/index.d.ts +1 -1
- package/dist/.pikku/http/index.js +1 -1
- package/dist/.pikku/http/pikku-http-types.gen.d.ts +7 -1
- package/dist/.pikku/http/pikku-http-types.gen.js +5 -1
- package/dist/.pikku/mcp/index.d.ts +1 -1
- package/dist/.pikku/mcp/index.js +1 -1
- package/dist/.pikku/mcp/pikku-mcp-types.gen.d.ts +11 -1
- package/dist/.pikku/mcp/pikku-mcp-types.gen.js +5 -1
- package/dist/.pikku/middleware/index.d.ts +1 -1
- package/dist/.pikku/middleware/index.js +1 -1
- package/dist/.pikku/middleware/pikku-middleware-types.gen.d.ts +33 -24
- package/dist/.pikku/middleware/pikku-middleware-types.gen.js +29 -24
- package/dist/.pikku/pikku-bootstrap-scenarios.gen.d.ts +1 -1
- package/dist/.pikku/pikku-bootstrap-scenarios.gen.js +1 -1
- package/dist/.pikku/pikku-bootstrap.gen.d.ts +1 -1
- package/dist/.pikku/pikku-bootstrap.gen.js +1 -1
- package/dist/.pikku/pikku-services.gen.d.ts +1 -1
- package/dist/.pikku/queue/index.d.ts +1 -1
- package/dist/.pikku/queue/index.js +1 -1
- package/dist/.pikku/queue/pikku-queue-types.gen.d.ts +3 -1
- package/dist/.pikku/queue/pikku-queue-types.gen.js +3 -1
- package/dist/.pikku/queue/pikku-queue-workers-wirings-meta.gen.js +1 -1
- package/dist/.pikku/queue/pikku-queue-workers-wirings.gen.d.ts +1 -1
- package/dist/.pikku/queue/pikku-queue-workers-wirings.gen.js +1 -1
- package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.js +1 -1
- package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.json +1 -1
- package/dist/.pikku/scenarios/index.d.ts +1 -1
- package/dist/.pikku/scenarios/index.js +1 -1
- package/dist/.pikku/scenarios/pikku-personas.gen.d.ts +4 -0
- package/dist/.pikku/scenarios/pikku-personas.gen.js +1 -1
- package/dist/.pikku/scenarios/pikku-scenario-functions-meta.gen.js +1 -1
- package/dist/.pikku/scenarios/pikku-scenario-functions.gen.d.ts +1 -1
- package/dist/.pikku/scenarios/pikku-scenario-types.gen.d.ts +13 -1
- package/dist/.pikku/scenarios/pikku-scenario-types.gen.js +4 -0
- package/dist/.pikku/scenarios/pikku-scenario-wirings-meta.gen.js +1 -1
- package/dist/.pikku/scenarios/pikku-scenario-wirings.gen.d.ts +1 -1
- package/dist/.pikku/scenarios/schemas/register.gen.d.ts +1 -1
- package/dist/.pikku/scenarios/schemas/register.gen.js +1 -1
- package/dist/.pikku/scheduler/index.d.ts +1 -1
- package/dist/.pikku/scheduler/index.js +1 -1
- package/dist/.pikku/scheduler/pikku-scheduler-types.gen.d.ts +3 -1
- package/dist/.pikku/scheduler/pikku-scheduler-types.gen.js +3 -1
- package/dist/.pikku/schemas/register.gen.js +5 -5
- package/dist/.pikku/schemas/schemas/DocInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/DocOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricDeployApplyInput.schema.json +1 -1
- package/dist/.pikku/schemas/schemas/FabricDeployApplyOutput.schema.json +1 -1
- package/dist/.pikku/schemas/schemas/FabricSecretsRotateOutput.schema.json +1 -1
- package/dist/.pikku/schemas/schemas/PikkuSkillsInstallInput.schema.json +1 -1
- package/dist/.pikku/scopes/index.d.ts +1 -1
- package/dist/.pikku/scopes/index.js +1 -1
- package/dist/.pikku/scopes/pikku-personas.gen.js +1 -1
- package/dist/.pikku/scopes/pikku-roles.gen.d.ts +1 -1
- package/dist/.pikku/scopes/pikku-scope-types.gen.d.ts +1 -1
- package/dist/.pikku/scopes/pikku-scope-types.gen.js +1 -1
- package/dist/.pikku/scopes/pikku-scopes.gen.d.ts +1 -1
- package/dist/.pikku/secrets/index.d.ts +1 -1
- package/dist/.pikku/secrets/index.js +1 -1
- package/dist/.pikku/secrets/pikku-secret-types.gen.d.ts +1 -1
- package/dist/.pikku/secrets/pikku-secret-types.gen.js +1 -1
- package/dist/.pikku/secrets/pikku-secrets.gen.d.ts +9 -1
- package/dist/.pikku/secrets/pikku-secrets.gen.js +5 -1
- package/dist/.pikku/services/pikku-meta-service.gen.d.ts +1 -1
- package/dist/.pikku/services/pikku-meta-service.gen.js +1 -1
- package/dist/.pikku/setup/index.d.ts +1 -1
- package/dist/.pikku/setup/index.js +1 -1
- package/dist/.pikku/setup/pikku-setup-types.gen.d.ts +7 -19
- package/dist/.pikku/setup/pikku-setup-types.gen.js +11 -19
- package/dist/.pikku/trigger/index.d.ts +1 -1
- package/dist/.pikku/trigger/index.js +1 -1
- package/dist/.pikku/trigger/pikku-trigger-types.gen.d.ts +5 -1
- package/dist/.pikku/trigger/pikku-trigger-types.gen.js +5 -1
- package/dist/.pikku/variables/index.d.ts +1 -1
- package/dist/.pikku/variables/index.js +1 -1
- package/dist/.pikku/variables/pikku-variable-types.gen.d.ts +1 -1
- package/dist/.pikku/variables/pikku-variable-types.gen.js +1 -1
- package/dist/.pikku/variables/pikku-variables.gen.d.ts +9 -1
- package/dist/.pikku/variables/pikku-variables.gen.js +5 -1
- package/dist/.pikku/workflow/index.d.ts +1 -1
- package/dist/.pikku/workflow/index.js +1 -1
- package/dist/.pikku/workflow/pikku-workflow-types.gen.d.ts +29 -1
- package/dist/.pikku/workflow/pikku-workflow-types.gen.js +8 -1
- package/dist/.pikku/workflow/pikku-workflow-wirings-meta.gen.js +1 -1
- package/dist/.pikku/workflow/pikku-workflow-wirings.gen.js +1 -1
- package/dist/bin/pikku-bin.mjs +2 -2
- package/dist/src/cli.wiring.js +21 -0
- package/dist/src/deploy/analyzer/analyzer.d.ts +1 -0
- package/dist/src/deploy/analyzer/analyzer.js +8 -6
- package/dist/src/deploy/build-pipeline.d.ts +1 -0
- package/dist/src/deploy/build-pipeline.js +1 -0
- package/dist/src/fabric/fabric-commands.d.ts +170 -54
- package/dist/src/fabric/fabric-commands.js +25 -20
- package/dist/src/fabric/functions/deploy.function.d.ts +246 -67
- package/dist/src/fabric/functions/deploy.function.js +316 -69
- package/dist/src/fabric/functions/init.function.js +1 -0
- package/dist/src/fabric/functions/link.function.js +4 -1
- package/dist/src/fabric/functions/secrets-rotate.function.d.ts +4 -4
- package/dist/src/fabric/functions/secrets-rotate.function.js +2 -2
- package/dist/src/fabric/functions/validate.function.js +123 -0
- package/dist/src/fabric/lib/deployment.d.ts +107 -0
- package/dist/src/fabric/lib/deployment.js +264 -0
- package/dist/src/fabric/sdk/pikku-fetch.gen.d.ts +1 -1
- package/dist/src/fabric/sdk/pikku-fetch.gen.js +1 -1
- package/dist/src/fabric/sdk/pikku-rpc.gen.d.ts +4 -1
- package/dist/src/fabric/sdk/pikku-rpc.gen.js +4 -1
- package/dist/src/functions/commands/deploy-apply.js +1 -0
- package/dist/src/functions/commands/deploy-plan.js +1 -0
- package/dist/src/functions/commands/doc.d.ts +22 -0
- package/dist/src/functions/commands/doc.js +25 -0
- package/dist/src/functions/commands/skills.d.ts +3 -0
- package/dist/src/functions/commands/skills.js +4 -2
- package/dist/src/functions/runtimes/tanstack-start/serialize-tanstack-start-shim.d.ts +3 -2
- package/dist/src/functions/runtimes/tanstack-start/serialize-tanstack-start-shim.js +33 -10
- package/dist/src/functions/surface/build-surface-doc.d.ts +8 -1
- package/dist/src/functions/surface/build-surface-doc.js +21 -8
- package/dist/src/functions/surface/collect-snippets.d.ts +13 -0
- package/dist/src/functions/surface/collect-snippets.js +83 -0
- package/dist/src/functions/surface/collect-surface.d.ts +27 -1
- package/dist/src/functions/surface/collect-surface.js +323 -13
- package/dist/src/functions/surface/generate-surface-doc.js +40 -5
- package/dist/src/functions/surface/render-surface-doc.d.ts +12 -0
- package/dist/src/functions/surface/render-surface-doc.js +209 -0
- package/dist/src/functions/surface/surface-doc.types.d.ts +15 -2
- package/dist/src/functions/surface/surface-editorial.d.ts +6 -0
- package/dist/src/functions/surface/surface-editorial.js +22 -1
- package/dist/src/functions/wirings/agent/serialize-agent-types.js +41 -0
- package/dist/src/functions/wirings/agent/serialize-public-agent.js +1 -1
- package/dist/src/functions/wirings/auth/serialize-auth-guards.js +1 -18
- package/dist/src/functions/wirings/auth/serialize-auth-types.js +7 -0
- package/dist/src/functions/wirings/channels/serialize-channel-types.js +9 -17
- package/dist/src/functions/wirings/cli/serialize-cli-types.js +7 -6
- package/dist/src/functions/wirings/functions/pikku-command-function-types-split.js +1 -1
- package/dist/src/functions/wirings/functions/serialize-addon-refs.js +12 -0
- package/dist/src/functions/wirings/functions/serialize-function-types.js +23 -36
- package/dist/src/functions/wirings/http/serialize-http-types.js +6 -0
- package/dist/src/functions/wirings/mcp/serialize-mcp-types.js +10 -0
- package/dist/src/functions/wirings/middleware/serialize-middleware-types.js +32 -23
- package/dist/src/functions/wirings/queue/serialize-queue-types.js +2 -0
- package/dist/src/functions/wirings/scheduler/serialize-scheduler-types.js +2 -0
- package/dist/src/functions/wirings/secrets/serialize-secrets-types.js +8 -0
- package/dist/src/functions/wirings/setup/serialize-setup-types.d.ts +1 -1
- package/dist/src/functions/wirings/setup/serialize-setup-types.js +19 -19
- package/dist/src/functions/wirings/triggers/serialize-trigger-types.js +4 -0
- package/dist/src/functions/wirings/variables/serialize-variables-types.js +8 -0
- package/dist/src/functions/wirings/workflow/serialize-personas.js +4 -0
- package/dist/src/functions/wirings/workflow/serialize-scenario-types.js +12 -0
- package/dist/src/functions/wirings/workflow/serialize-workflow-types.js +28 -0
- package/dist/src/services.js +8 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +9 -7
- package/snippets-meta.json +131 -0
- package/snippets.json +131 -0
- package/surface.json +7393 -458
- package/console-app/assets/architecture-TIHT7OUA-DgRqRaqo.js +0 -1
- package/console-app/assets/channel-37lNznWk.js +0 -1
- package/console-app/assets/chunk-XXDRQBXY-B1prMCvW.js +0 -1
- package/console-app/assets/classDiagram-JCYQIIEL-BDCX9ZLm.js +0 -1
- package/console-app/assets/classDiagram-v2-OCEON4UE-BDCX9ZLm.js +0 -1
- package/console-app/assets/eventmodeling-45OFAUF4-BarrKD55.js +0 -1
- package/console-app/assets/flowDiagram-UKHOOZJN-B6RiRjcD.js +0 -1
- package/console-app/assets/railroad-abnf-AHOZXSZD-lmUjOixE.js +0 -1
- package/console-app/assets/railroad-ebnf-EBAXGLYW-ZjdA7OHp.js +0 -1
- package/console-app/assets/railroad-peg-LSFZ7HO6-VHSlvwI8.js +0 -1
- package/console-app/assets/stateDiagram-v2-UEYNNEHI-BSXWhCvf.js +0 -1
- package/console-app/assets/swimlanesDiagram-ULZ7WXOC-BUdsPDKC.js +0 -8
- package/dist/.pikku/schemas/schemas/FabricDeployPlanInput.schema.json +0 -1
- package/dist/.pikku/schemas/schemas/FabricDeployPlanOutput.schema.json +0 -1
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
export class UnknownSurfaceTargetError extends Error {
|
|
2
|
+
target;
|
|
3
|
+
suggestions;
|
|
4
|
+
constructor(target, suggestions) {
|
|
5
|
+
super(suggestions.length > 0
|
|
6
|
+
? `No door or export called '${target}'. Did you mean: ${suggestions.join(', ')}?`
|
|
7
|
+
: `No door or export called '${target}'. Run 'pikku doc' for the index.`);
|
|
8
|
+
this.target = target;
|
|
9
|
+
this.suggestions = suggestions;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
const STEPS = [
|
|
13
|
+
'create a function',
|
|
14
|
+
'enhance it',
|
|
15
|
+
'wire it up',
|
|
16
|
+
'guard it',
|
|
17
|
+
'orchestrate it',
|
|
18
|
+
'test it',
|
|
19
|
+
];
|
|
20
|
+
const wrap = (text, width, indent) => text
|
|
21
|
+
.replace(/\s+/g, ' ')
|
|
22
|
+
.trim()
|
|
23
|
+
.split(' ')
|
|
24
|
+
.reduce((lines, word) => {
|
|
25
|
+
const last = lines[lines.length - 1];
|
|
26
|
+
if (last !== undefined && `${last} ${word}`.length <= width) {
|
|
27
|
+
lines[lines.length - 1] = `${last} ${word}`;
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
lines.push(word);
|
|
31
|
+
}
|
|
32
|
+
return lines;
|
|
33
|
+
}, [])
|
|
34
|
+
.map((line) => indent + line)
|
|
35
|
+
.join('\n');
|
|
36
|
+
const columns = (values, perRow, width) => {
|
|
37
|
+
const rows = [];
|
|
38
|
+
for (let i = 0; i < values.length; i += perRow) {
|
|
39
|
+
rows.push(' ' +
|
|
40
|
+
values
|
|
41
|
+
.slice(i, i + perRow)
|
|
42
|
+
.map((value) => value.length >= width ? `${value} ` : value.padEnd(width))
|
|
43
|
+
.join('')
|
|
44
|
+
.trimEnd());
|
|
45
|
+
}
|
|
46
|
+
return rows;
|
|
47
|
+
};
|
|
48
|
+
const appEntryPoint = (doc, id) => {
|
|
49
|
+
const entryPoint = doc.entryPoints.find((candidate) => candidate.id === id);
|
|
50
|
+
if (!entryPoint) {
|
|
51
|
+
throw new Error(`The surface doc has no '${id}' entry point.`);
|
|
52
|
+
}
|
|
53
|
+
return entryPoint;
|
|
54
|
+
};
|
|
55
|
+
const renderIndex = (doc, leaves, ai) => {
|
|
56
|
+
const total = leaves.reduce((count, leaf) => count + leaf.symbols.length, 0);
|
|
57
|
+
const lines = [
|
|
58
|
+
`pikku ${doc.version} — application surface, ${leaves.length} doors / ${total} exports`,
|
|
59
|
+
'',
|
|
60
|
+
];
|
|
61
|
+
for (const step of STEPS) {
|
|
62
|
+
const names = leaves
|
|
63
|
+
.filter((leaf) => leaf.step === step)
|
|
64
|
+
.map((leaf) => leaf.name);
|
|
65
|
+
if (names.length > 0) {
|
|
66
|
+
lines.push(` ${step.padEnd(20)}${names.join(' ')}`);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
const fn = leaves.find((leaf) => leaf.name === 'function');
|
|
70
|
+
if (fn) {
|
|
71
|
+
lines.push('', ` ${fn.specifier} — every wiring eventually points at one of these`);
|
|
72
|
+
lines.push(...columns(fn.symbols.map((symbol) => symbol.name), 4, 26));
|
|
73
|
+
}
|
|
74
|
+
if (ai) {
|
|
75
|
+
const taught = leaves.filter((leaf) => leaf.skill);
|
|
76
|
+
const bare = leaves.filter((leaf) => !leaf.skill).map((leaf) => leaf.name);
|
|
77
|
+
lines.push('', ' what is above is what exists; these skills say how to use it');
|
|
78
|
+
lines.push(...columns(taught.map((leaf) => `${leaf.name} → ${[leaf.skill].flat().join(' + ')}`), 2, 38));
|
|
79
|
+
if (bare.length > 0) {
|
|
80
|
+
lines.push(wrap(`No skill teaches ${bare.join(', ')} — for those, this doc is the whole of it.`, 78, ' '));
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
lines.push('', ' pikku doc <door> one door: what it exports and the keys you write', ' pikku doc <export> one export: its signature, its keys, what it references', ' pikku doc a b c several at once, in one call');
|
|
84
|
+
if (!ai) {
|
|
85
|
+
lines.push(' pikku doc --ai the same, plus the skill to load for each door');
|
|
86
|
+
}
|
|
87
|
+
return lines.join('\n');
|
|
88
|
+
};
|
|
89
|
+
const renderSymbolRow = (symbol) => {
|
|
90
|
+
const lines = [
|
|
91
|
+
` ${symbol.name}${symbol.deprecated ? ' [deprecated]' : ''} (${symbol.kind})`,
|
|
92
|
+
];
|
|
93
|
+
if (symbol.summary) {
|
|
94
|
+
lines.push(wrap(symbol.summary, 74, ' '));
|
|
95
|
+
}
|
|
96
|
+
const keys = symbol.members?.length ?? 0;
|
|
97
|
+
const more = keys > 0 || (symbol.examples?.length ?? 0) > 0;
|
|
98
|
+
const signature = symbol.signature?.replace(/\s+/g, ' ');
|
|
99
|
+
if (more) {
|
|
100
|
+
lines.push(` ${keys > 0 ? `${keys} keys` : 'example'} — pikku doc ${symbol.name}`);
|
|
101
|
+
}
|
|
102
|
+
else if (signature && signature.length <= 96) {
|
|
103
|
+
lines.push(` ${signature}`);
|
|
104
|
+
}
|
|
105
|
+
else if (signature) {
|
|
106
|
+
lines.push(` pikku doc ${symbol.name}`);
|
|
107
|
+
}
|
|
108
|
+
lines.push('');
|
|
109
|
+
return lines;
|
|
110
|
+
};
|
|
111
|
+
const renderLeaf = (leaf, ai) => {
|
|
112
|
+
const lines = [`${leaf.specifier} — ${leaf.step}`, '', wrap(leaf.summary, 78, ' '), ''];
|
|
113
|
+
const statuses = leaf.symbols.filter((symbol) => symbol.status !== undefined);
|
|
114
|
+
for (const symbol of leaf.symbols.filter((symbol) => symbol.status === undefined)) {
|
|
115
|
+
lines.push(...renderSymbolRow(symbol));
|
|
116
|
+
}
|
|
117
|
+
if (statuses.length > 0) {
|
|
118
|
+
lines.push(` ${statuses.length} error classes, each thrown to produce its HTTP status:`);
|
|
119
|
+
lines.push(...columns(statuses.map((symbol) => `${symbol.name} ${symbol.status}`), 3, 38));
|
|
120
|
+
lines.push('');
|
|
121
|
+
}
|
|
122
|
+
if (ai) {
|
|
123
|
+
lines.push(leaf.skill
|
|
124
|
+
? ` Load the ${[leaf.skill].flat().join(' and ')} skill before writing this if you need how rather than what.`
|
|
125
|
+
: ' No skill teaches this door — what is above is the whole of it.');
|
|
126
|
+
}
|
|
127
|
+
return lines.join('\n');
|
|
128
|
+
};
|
|
129
|
+
const referencesOf = (symbol, home) => {
|
|
130
|
+
const blob = [
|
|
131
|
+
symbol.signature ?? '',
|
|
132
|
+
...(symbol.members ?? []).map((member) => member.line),
|
|
133
|
+
].join(' ');
|
|
134
|
+
return [...new Set(blob.match(/\b[A-Z][A-Za-z0-9]+\b/g) ?? [])].filter((name) => home.has(name) && name !== symbol.name);
|
|
135
|
+
};
|
|
136
|
+
const renderSymbol = (symbol, leaf, home, ai) => {
|
|
137
|
+
const lines = [`${symbol.name} — ${symbol.kind}, from ${leaf.specifier}`, ''];
|
|
138
|
+
if (symbol.deprecated) {
|
|
139
|
+
lines.push(` DEPRECATED: ${symbol.deprecated}`, '');
|
|
140
|
+
}
|
|
141
|
+
if (symbol.docs) {
|
|
142
|
+
lines.push(wrap(symbol.docs, 78, ' '), '');
|
|
143
|
+
}
|
|
144
|
+
if (symbol.status !== undefined) {
|
|
145
|
+
lines.push(` HTTP status ${symbol.status}`, '');
|
|
146
|
+
}
|
|
147
|
+
if (symbol.signature) {
|
|
148
|
+
lines.push(' ' + symbol.signature.replace(/\s+/g, ' '), '');
|
|
149
|
+
}
|
|
150
|
+
if (symbol.members?.length) {
|
|
151
|
+
lines.push(' keys you write');
|
|
152
|
+
for (const member of symbol.members) {
|
|
153
|
+
lines.push(` ${member.line}`);
|
|
154
|
+
if (member.doc) {
|
|
155
|
+
lines.push(wrap(member.doc, 72, ' '));
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
lines.push('');
|
|
159
|
+
}
|
|
160
|
+
for (const example of symbol.examples ?? []) {
|
|
161
|
+
lines.push(' example');
|
|
162
|
+
lines.push(...example.split('\n').map((line) => ' ' + line));
|
|
163
|
+
lines.push('');
|
|
164
|
+
}
|
|
165
|
+
const references = referencesOf(symbol, home);
|
|
166
|
+
if (references.length > 0) {
|
|
167
|
+
lines.push(' references ' +
|
|
168
|
+
references.map((name) => `${name} (${home.get(name)})`).join(' '));
|
|
169
|
+
}
|
|
170
|
+
if (ai && leaf.skill) {
|
|
171
|
+
lines.push('', ` Load the ${[leaf.skill].flat().join(' and ')} skill before writing this if you need how rather than what.`);
|
|
172
|
+
}
|
|
173
|
+
return lines.join('\n').trimEnd();
|
|
174
|
+
};
|
|
175
|
+
const near = (target, candidates) => {
|
|
176
|
+
const needle = target.toLowerCase();
|
|
177
|
+
return candidates
|
|
178
|
+
.filter((candidate) => candidate.toLowerCase().includes(needle))
|
|
179
|
+
.slice(0, 5);
|
|
180
|
+
};
|
|
181
|
+
export const renderSurfaceDoc = (doc, { target, ai = false, entryPoint = 'app' } = {}) => {
|
|
182
|
+
const leaves = appEntryPoint(doc, entryPoint).leaves;
|
|
183
|
+
if (!target) {
|
|
184
|
+
return renderIndex(doc, leaves, ai);
|
|
185
|
+
}
|
|
186
|
+
const leaf = leaves.find((candidate) => candidate.name === target || candidate.specifier === target);
|
|
187
|
+
if (leaf) {
|
|
188
|
+
return renderLeaf(leaf, ai);
|
|
189
|
+
}
|
|
190
|
+
const home = new Map();
|
|
191
|
+
for (const candidate of leaves) {
|
|
192
|
+
for (const symbol of candidate.symbols) {
|
|
193
|
+
if (!home.has(symbol.name)) {
|
|
194
|
+
home.set(symbol.name, candidate.specifier);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
const owner = leaves.find((candidate) => candidate.symbols.some((symbol) => symbol.name === target));
|
|
199
|
+
const symbol = owner?.symbols.find((candidate) => candidate.name === target);
|
|
200
|
+
if (owner && symbol) {
|
|
201
|
+
return renderSymbol(symbol, owner, home, ai);
|
|
202
|
+
}
|
|
203
|
+
const elsewhere = doc.entryPoints.find((candidate) => candidate.id !== entryPoint &&
|
|
204
|
+
candidate.leaves.some((leaf2) => leaf2.symbols.some((symbol2) => symbol2.name === target)));
|
|
205
|
+
if (elsewhere) {
|
|
206
|
+
return renderSurfaceDoc(doc, { target, ai, entryPoint: elsewhere.id });
|
|
207
|
+
}
|
|
208
|
+
throw new UnknownSurfaceTargetError(target, near(target, [...leaves.map((candidate) => candidate.name), ...home.keys()]));
|
|
209
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { SurfaceKind } from './collect-surface.js';
|
|
2
|
-
export type { SurfaceKind };
|
|
1
|
+
import type { SurfaceKind, SurfaceMember } from './collect-surface.js';
|
|
2
|
+
export type { SurfaceKind, SurfaceMember };
|
|
3
3
|
/**
|
|
4
4
|
* The order in which you meet these doors while building a service. It is the
|
|
5
5
|
* page's spine: the console groups by it and the reading order follows it.
|
|
@@ -23,6 +23,14 @@ export type SurfaceDocSymbol = {
|
|
|
23
23
|
/** The full documentation, for the panel that reads one export. */
|
|
24
24
|
docs?: string;
|
|
25
25
|
deprecated?: string;
|
|
26
|
+
/** How it is called, printed from the compiler rather than from prose. */
|
|
27
|
+
signature?: string;
|
|
28
|
+
/** The keys of the options object it takes, one per line. */
|
|
29
|
+
members?: SurfaceMember[];
|
|
30
|
+
/** `@example` blocks, which the summary and docs both leave out. */
|
|
31
|
+
examples?: string[];
|
|
32
|
+
/** For an error class, the HTTP status it was registered with. */
|
|
33
|
+
status?: number;
|
|
26
34
|
};
|
|
27
35
|
export type SurfaceLeaf = {
|
|
28
36
|
/** The specifier you import from, e.g. `#pikku/http`. */
|
|
@@ -30,6 +38,11 @@ export type SurfaceLeaf = {
|
|
|
30
38
|
name: string;
|
|
31
39
|
step: SurfaceStep;
|
|
32
40
|
summary: string;
|
|
41
|
+
/**
|
|
42
|
+
* The skill to load for how rather than what, or `null` where this page is
|
|
43
|
+
* the whole story. Never absent: a leaf must answer the question.
|
|
44
|
+
*/
|
|
45
|
+
skill: string | string[] | null;
|
|
33
46
|
symbols: SurfaceDocSymbol[];
|
|
34
47
|
};
|
|
35
48
|
export type SurfaceEntryPointId = 'app' | 'addon';
|
|
@@ -11,6 +11,12 @@ import type { SurfaceEntryPointId, SurfaceStep } from './surface-doc.types.js';
|
|
|
11
11
|
export type LeafEditorial = {
|
|
12
12
|
step: SurfaceStep;
|
|
13
13
|
summary: string;
|
|
14
|
+
/**
|
|
15
|
+
* The skill that teaches this door, or `null` where the generated page says
|
|
16
|
+
* everything there is. Required so that adding a leaf forces the question
|
|
17
|
+
* rather than quietly shipping a door nothing teaches.
|
|
18
|
+
*/
|
|
19
|
+
skill: string | string[] | null;
|
|
14
20
|
};
|
|
15
21
|
export type EntryPointEditorial = {
|
|
16
22
|
job: string;
|
|
@@ -6,86 +6,107 @@
|
|
|
6
6
|
export const LEAF_EDITORIAL = {
|
|
7
7
|
setup: {
|
|
8
8
|
step: 'create a function',
|
|
9
|
+
skill: 'pikku-services',
|
|
9
10
|
summary: 'The three factories a project declares exactly once — its config, its singleton services and its per-wire services. An addon declares the same three in its own flavour, handed the logger, variables and secrets the host application already built. Everything else on this page is imported by features; these are imported by bootstrap and then left alone.',
|
|
10
11
|
},
|
|
11
12
|
function: {
|
|
12
13
|
step: 'create a function',
|
|
13
|
-
|
|
14
|
+
skill: 'pikku-concepts',
|
|
15
|
+
summary: 'The function definers every wiring eventually points at, and the types they are written against. A function is handed services, then its input, then the wire — and the wire is where the request lives: `session`, `setSession`, `clearSession`, `http`, `channel`, `rpc`. None of those are exports, so they are not listed here; destructure them from the third argument.',
|
|
14
16
|
},
|
|
15
17
|
middleware: {
|
|
16
18
|
step: 'enhance it',
|
|
19
|
+
skill: 'pikku-middleware',
|
|
17
20
|
summary: 'Middleware is one concept regardless of what it ends up attached to, so it is one import: define it here, then register it globally, against a tag, or against an HTTP route or channel.',
|
|
18
21
|
},
|
|
19
22
|
error: {
|
|
20
23
|
step: 'enhance it',
|
|
24
|
+
skill: null,
|
|
21
25
|
summary: 'The errors your functions throw and the HTTP status each one maps to, so a thrown error is part of the contract rather than a stack trace.',
|
|
22
26
|
},
|
|
23
27
|
variables: {
|
|
24
28
|
step: 'enhance it',
|
|
29
|
+
skill: 'pikku-config',
|
|
25
30
|
summary: 'Configuration a function reads through the variables service, declared once so a deployment can be checked for what it is missing.',
|
|
26
31
|
},
|
|
27
32
|
secrets: {
|
|
28
33
|
step: 'enhance it',
|
|
34
|
+
skill: 'pikku-config',
|
|
29
35
|
summary: 'Secrets a function can use without ever holding, declared here and resolved by the secrets service at runtime.',
|
|
30
36
|
},
|
|
31
37
|
credentials: {
|
|
32
38
|
step: 'enhance it',
|
|
39
|
+
skill: null,
|
|
33
40
|
summary: 'Third-party credentials — OAuth2 grants and API keys — declared so the runtime can acquire, refresh and inject them.',
|
|
34
41
|
},
|
|
35
42
|
addon: {
|
|
36
43
|
step: 'enhance it',
|
|
44
|
+
skill: 'pikku-addon',
|
|
37
45
|
summary: 'Installs an addon into this application, on its own or over rpc against a remote one.',
|
|
38
46
|
},
|
|
39
47
|
http: {
|
|
40
48
|
step: 'wire it up',
|
|
49
|
+
skill: 'pikku-http',
|
|
41
50
|
summary: 'Wires a function to an HTTP route, with the path parameters checked against the function input.',
|
|
42
51
|
},
|
|
43
52
|
channel: {
|
|
44
53
|
step: 'wire it up',
|
|
54
|
+
skill: 'pikku-websocket',
|
|
45
55
|
summary: 'Wires a function to a websocket channel, its message routes and its pub/sub topics.',
|
|
46
56
|
},
|
|
47
57
|
queue: {
|
|
48
58
|
step: 'wire it up',
|
|
59
|
+
skill: 'pikku-queue',
|
|
49
60
|
summary: 'Wires a function as a queue worker, so a job on the queue runs the same handler an HTTP route would.',
|
|
50
61
|
},
|
|
51
62
|
scheduler: {
|
|
52
63
|
step: 'wire it up',
|
|
64
|
+
skill: 'pikku-schedule',
|
|
53
65
|
summary: 'Wires a function to a cron expression to run it on a schedule.',
|
|
54
66
|
},
|
|
55
67
|
trigger: {
|
|
56
68
|
step: 'wire it up',
|
|
69
|
+
skill: 'pikku-trigger',
|
|
57
70
|
summary: 'Wires a function to an event a source emits, rather than to a caller that asks for it.',
|
|
58
71
|
},
|
|
59
72
|
gateway: {
|
|
60
73
|
step: 'wire it up',
|
|
74
|
+
skill: 'pikku-gateway-slack',
|
|
61
75
|
summary: 'Wires a function behind a gateway that receives requests on behalf of another system.',
|
|
62
76
|
},
|
|
63
77
|
mcp: {
|
|
64
78
|
step: 'wire it up',
|
|
79
|
+
skill: 'pikku-mcp',
|
|
65
80
|
summary: 'Wires a function as an MCP tool, resource or prompt for a model to call.',
|
|
66
81
|
},
|
|
67
82
|
cli: {
|
|
68
83
|
step: 'wire it up',
|
|
84
|
+
skill: 'pikku-cli',
|
|
69
85
|
summary: 'Wires a function as a command, with its flags and arguments derived from the function input.',
|
|
70
86
|
},
|
|
71
87
|
auth: {
|
|
72
88
|
step: 'guard it',
|
|
89
|
+
skill: ['pikku-security', 'pikku-permissions'],
|
|
73
90
|
summary: 'Who may call a function, and what the call is made with: permissions that see the request, auth gates that run before it, and the credentials a function borrows rather than holds.',
|
|
74
91
|
},
|
|
75
92
|
scopes: {
|
|
76
93
|
step: 'guard it',
|
|
94
|
+
skill: 'pikku-permissions',
|
|
77
95
|
summary: 'The scopes a caller can hold and the roles that grant them, gating a call outside the permission pool.',
|
|
78
96
|
},
|
|
79
97
|
workflow: {
|
|
80
98
|
step: 'orchestrate it',
|
|
99
|
+
skill: 'pikku-workflow',
|
|
81
100
|
summary: 'Composes functions into a durable workflow whose steps survive a restart and retry on their own.',
|
|
82
101
|
},
|
|
83
102
|
agent: {
|
|
84
103
|
step: 'orchestrate it',
|
|
104
|
+
skill: 'pikku-agent',
|
|
85
105
|
summary: 'Defines an AI agent, the tools it may call and the scorers that judge what it did.',
|
|
86
106
|
},
|
|
87
107
|
scenarios: {
|
|
88
108
|
step: 'test it',
|
|
109
|
+
skill: 'pikku-scenario',
|
|
89
110
|
summary: 'Drives features and scenarios against a real running server, in the vocabulary a user would use.',
|
|
90
111
|
},
|
|
91
112
|
};
|
|
@@ -31,6 +31,12 @@ type AgentConfig<
|
|
|
31
31
|
workflows?: object[]
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
/**
|
|
35
|
+
* Declares an agent: the model, the prompt, the tools it may call and the shape
|
|
36
|
+
* of what it returns. Wire it like any other function.
|
|
37
|
+
*
|
|
38
|
+
* @example snippet: aiAgent
|
|
39
|
+
*/
|
|
34
40
|
export const pikkuAgent = <
|
|
35
41
|
InputSchema extends StandardSchemaV1 | undefined = undefined,
|
|
36
42
|
OutputSchema extends StandardSchemaV1 | undefined = undefined
|
|
@@ -40,16 +46,34 @@ export const pikkuAgent = <
|
|
|
40
46
|
return agent
|
|
41
47
|
}
|
|
42
48
|
|
|
49
|
+
/**
|
|
50
|
+
* Declares a scorer that grades an agent run programmatically — a function over
|
|
51
|
+
* the run's input and output returning a score.
|
|
52
|
+
*
|
|
53
|
+
* @example snippet: agentScorer
|
|
54
|
+
*/
|
|
43
55
|
export const pikkuAgentScorer = (
|
|
44
56
|
config: Parameters<typeof corePikkuAgentScorer<Services>>[0]
|
|
45
57
|
) => corePikkuAgentScorer<Services>(config)
|
|
46
58
|
|
|
59
|
+
/**
|
|
60
|
+
* Declares a scorer that grades an agent run with another model, for the
|
|
61
|
+
* qualities a programmatic check cannot express.
|
|
62
|
+
*
|
|
63
|
+
* @example snippet: agentJudge
|
|
64
|
+
*/
|
|
47
65
|
export const pikkuAgentJudge = (
|
|
48
66
|
config: Parameters<typeof corePikkuAgentJudge<Services>>[0]
|
|
49
67
|
) => corePikkuAgentJudge<Services>(config)
|
|
50
68
|
|
|
51
69
|
|
|
52
70
|
|
|
71
|
+
/**
|
|
72
|
+
* A ready-made function that runs the named agent once and returns its result —
|
|
73
|
+
* wire it straight to a route when you need no logic around the run.
|
|
74
|
+
*
|
|
75
|
+
* @example snippet: aiAgentInvoke
|
|
76
|
+
*/
|
|
53
77
|
export const agent = <Name extends keyof AgentMap>(
|
|
54
78
|
agentName: Name
|
|
55
79
|
) => {
|
|
@@ -60,6 +84,12 @@ export const agent = <Name extends keyof AgentMap>(
|
|
|
60
84
|
>
|
|
61
85
|
}
|
|
62
86
|
|
|
87
|
+
/**
|
|
88
|
+
* The streaming counterpart of \`agent\`: wire it to a channel to send tokens and
|
|
89
|
+
* tool calls as they happen instead of waiting for the run to finish.
|
|
90
|
+
*
|
|
91
|
+
* @example snippet: aiAgentStream
|
|
92
|
+
*/
|
|
63
93
|
export const agentStream = <Name extends keyof AgentMap>(
|
|
64
94
|
agentName?: Name
|
|
65
95
|
) => {
|
|
@@ -70,6 +100,12 @@ export const agentStream = <Name extends keyof AgentMap>(
|
|
|
70
100
|
>
|
|
71
101
|
}
|
|
72
102
|
|
|
103
|
+
/**
|
|
104
|
+
* A ready-made function that answers one pending tool approval, letting a run
|
|
105
|
+
* that paused for a human carry on.
|
|
106
|
+
*
|
|
107
|
+
* @example snippet: agentApproval
|
|
108
|
+
*/
|
|
73
109
|
export const agentResume = () => {
|
|
74
110
|
return coreAgentResume() as PikkuFunctionConfig<
|
|
75
111
|
{ runId: string; toolCallId: string; approved: boolean },
|
|
@@ -78,6 +114,11 @@ export const agentResume = () => {
|
|
|
78
114
|
>
|
|
79
115
|
}
|
|
80
116
|
|
|
117
|
+
/**
|
|
118
|
+
* A ready-made function that answers every pending approval for a run at once.
|
|
119
|
+
*
|
|
120
|
+
* @example snippet: agentApproval
|
|
121
|
+
*/
|
|
81
122
|
export const agentApprove = <Name extends keyof AgentMap>(
|
|
82
123
|
agentName: Name
|
|
83
124
|
) => {
|
|
@@ -144,7 +144,7 @@ export const getAgentThreads = pikkuSessionlessFunc({
|
|
|
144
144
|
description:
|
|
145
145
|
'Returns the caller\\'s AI agent threads from storage. Accepts optional filters: agentName, resourceId, limit, and offset for pagination.',
|
|
146
146
|
expose: true,
|
|
147
|
-
auth:
|
|
147
|
+
auth: true,
|
|
148
148
|
func: async ({ agentRunService }, input, { session }) => {
|
|
149
149
|
// \`owners\` is an authorization constraint derived from the session, never
|
|
150
150
|
// from input — \`resourceId\` remains a caller-supplied filter within it.
|
|
@@ -69,24 +69,7 @@ type PikkuPermissionConfig<In = unknown, RequiredServices extends SecretlessServ
|
|
|
69
69
|
* Factory function for creating permissions with tree-shaking support.
|
|
70
70
|
* Supports both direct function and configuration object syntax.
|
|
71
71
|
*
|
|
72
|
-
* @example
|
|
73
|
-
* \`\`\`typescript
|
|
74
|
-
* // Direct function syntax
|
|
75
|
-
* const permission = pikkuPermission(async ({ logger }, data, { session }) => {
|
|
76
|
-
* const session = await session?.get()
|
|
77
|
-
* return session?.role === 'admin'
|
|
78
|
-
* })
|
|
79
|
-
*
|
|
80
|
-
* // Configuration object syntax with metadata
|
|
81
|
-
* const adminPermission = pikkuPermission({
|
|
82
|
-
* name: 'Admin Permission',
|
|
83
|
-
* description: 'Checks if user has admin role',
|
|
84
|
-
* func: async ({ logger }, data, { session }) => {
|
|
85
|
-
* const session = await session?.get()
|
|
86
|
-
* return session?.role === 'admin'
|
|
87
|
-
* }
|
|
88
|
-
* })
|
|
89
|
-
* \`\`\`
|
|
72
|
+
* @example snippet: permissionFunction
|
|
90
73
|
*/
|
|
91
74
|
export const pikkuPermission = <In>(
|
|
92
75
|
permission: PikkuPermission<In> | PikkuPermissionConfig<In>
|
|
@@ -60,6 +60,13 @@ export const serializeAuthTypes = (authTypesFile, functionTypesFile, secretsFile
|
|
|
60
60
|
` variables: TypedVariablesService`,
|
|
61
61
|
`}`,
|
|
62
62
|
'',
|
|
63
|
+
`/**`,
|
|
64
|
+
` * Builds this project's Better Auth instance. The factory is handed the`,
|
|
65
|
+
` * singleton services, with typed \`secrets\` and \`variables\`, and is called`,
|
|
66
|
+
` * lazily so config and secrets are resolved before auth is constructed.`,
|
|
67
|
+
` *`,
|
|
68
|
+
` * @example snippet: betterAuthConfig`,
|
|
69
|
+
` */`,
|
|
63
70
|
`export const pikkuBetterAuth = <I extends BetterAuthInstance>(`,
|
|
64
71
|
` factory: (services: AuthSingletonServices) => I | Promise<I>`,
|
|
65
72
|
`): PikkuBetterAuthFactory<I> =>`,
|
|
@@ -50,6 +50,8 @@ type ChannelWiring<ChannelData, Channel extends string> = CoreChannel<
|
|
|
50
50
|
* @template Out - Output type for connection response
|
|
51
51
|
* @param func - Function definition, either direct function or configuration object
|
|
52
52
|
* @returns The normalized configuration object
|
|
53
|
+
*
|
|
54
|
+
* @example snippet: channelLifecycle
|
|
53
55
|
*/
|
|
54
56
|
export const pikkuChannelConnectionFunc = <Out = unknown>(
|
|
55
57
|
func:
|
|
@@ -65,6 +67,8 @@ export const pikkuChannelConnectionFunc = <Out = unknown>(
|
|
|
65
67
|
*
|
|
66
68
|
* @param func - Function definition, either direct function or configuration object
|
|
67
69
|
* @returns The normalized configuration object
|
|
70
|
+
*
|
|
71
|
+
* @example snippet: channelLifecycle
|
|
68
72
|
*/
|
|
69
73
|
export const pikkuChannelDisconnectionFunc = (
|
|
70
74
|
func:
|
|
@@ -110,23 +114,7 @@ type PikkuChannelFuncConfigWithSchema<
|
|
|
110
114
|
* @param func - Function definition, either direct function or configuration object
|
|
111
115
|
* @returns The normalized configuration object
|
|
112
116
|
*
|
|
113
|
-
* @example
|
|
114
|
-
* \`\`\`typescript
|
|
115
|
-
* // Pattern 1: Using generic types
|
|
116
|
-
* const handleMessage = pikkuChannelFunc<{text: string}, {received: boolean}>({
|
|
117
|
-
* func: async (_services, { text }) => ({ received: true })
|
|
118
|
-
* })
|
|
119
|
-
*
|
|
120
|
-
* // Pattern 2: Using Zod schemas
|
|
121
|
-
* const messageInput = z.object({ text: z.string() })
|
|
122
|
-
* const messageOutput = z.object({ received: z.boolean() })
|
|
123
|
-
*
|
|
124
|
-
* const handleMessage = pikkuChannelFunc({
|
|
125
|
-
* input: messageInput,
|
|
126
|
-
* output: messageOutput,
|
|
127
|
-
* func: async (_services, { text }) => ({ received: true })
|
|
128
|
-
* })
|
|
129
|
-
* \`\`\`
|
|
117
|
+
* @example snippet: orderStatusChannel
|
|
130
118
|
*/
|
|
131
119
|
export function pikkuChannelFunc<
|
|
132
120
|
InputSchema extends StandardSchemaV1,
|
|
@@ -151,6 +139,8 @@ ${addon
|
|
|
151
139
|
* @template ChannelData - Type of data associated with the channel
|
|
152
140
|
* @template Channel - String literal type for the channel name
|
|
153
141
|
* @param channel - Channel definition with connection, disconnection, and message handlers
|
|
142
|
+
*
|
|
143
|
+
* @example snippet: channelWiring
|
|
154
144
|
*/
|
|
155
145
|
export const wireChannel = <ChannelData, Channel extends string>(
|
|
156
146
|
channel: ChannelWiring<ChannelData, Channel> & AssertHTTPWiringParams<ChannelData, Channel>
|
|
@@ -165,6 +155,8 @@ export const wireChannel = <ChannelData, Channel extends string>(
|
|
|
165
155
|
* @template T - Record of channel route handlers
|
|
166
156
|
* @param routes - The channel routes record
|
|
167
157
|
* @returns The same routes record (identity function for type safety)
|
|
158
|
+
*
|
|
159
|
+
* @example snippet: channelRoutes
|
|
168
160
|
*/
|
|
169
161
|
export function defineChannelRoutes<T extends Record<string, any>>(routes: T): T {
|
|
170
162
|
return defineChannelRoutesCore(routes)
|
|
@@ -39,12 +39,7 @@ type PikkuCLIRender<Data, RequiredServices extends SingletonServices = Singleton
|
|
|
39
39
|
* @param render - Function that receives singleton services and data to render output
|
|
40
40
|
* @returns A CLI renderer configuration
|
|
41
41
|
*
|
|
42
|
-
* @example
|
|
43
|
-
* \`\`\`typescript
|
|
44
|
-
* const myRenderer = pikkuCLIRender<MyData>(({ logger }, data) => {
|
|
45
|
-
* logger.info(data.message)
|
|
46
|
-
* })
|
|
47
|
-
* \`\`\`
|
|
42
|
+
* @example snippet: cliRenderer
|
|
48
43
|
*/
|
|
49
44
|
export const pikkuCLIRender = <Data, RequiredServices extends SingletonServices = SingletonServices>(
|
|
50
45
|
render: (services: SingletonServices, data: Data) => void | Promise<void>
|
|
@@ -73,6 +68,8 @@ type CLIWiring<Commands extends Record<string, CoreCLICommandConfig<any, PikkuMi
|
|
|
73
68
|
* @template Commands - Type describing the command structure
|
|
74
69
|
* @template GlobalOptions - Type for global CLI options
|
|
75
70
|
* @param cli - CLI definition with program name, commands, and global options
|
|
71
|
+
*
|
|
72
|
+
* @example snippet: cliWiring
|
|
76
73
|
*/
|
|
77
74
|
export const wireCLI = <Commands extends Record<string, CoreCLICommandConfig<any, PikkuMiddleware, PikkuCLIRender<any>, any>>, GlobalOptions>(
|
|
78
75
|
cli: CLIWiring<Commands, GlobalOptions>
|
|
@@ -88,6 +85,8 @@ export const wireCLI = <Commands extends Record<string, CoreCLICommandConfig<any
|
|
|
88
85
|
* @template Params - The parameters string literal type
|
|
89
86
|
* @param config - CLI command configuration
|
|
90
87
|
* @returns CLI command configuration with inferred types
|
|
88
|
+
*
|
|
89
|
+
* @example snippet: cliWiring
|
|
91
90
|
*/
|
|
92
91
|
export const pikkuCLICommand = <
|
|
93
92
|
FuncConfig extends PikkuFunctionConfig<any, any, 'cli' | 'rpc' | 'session'>,
|
|
@@ -104,6 +103,8 @@ export const pikkuCLICommand = <
|
|
|
104
103
|
* @template T - Record of CLI command configurations
|
|
105
104
|
* @param commands - The CLI commands record
|
|
106
105
|
* @returns The same commands record (identity function for type safety)
|
|
106
|
+
*
|
|
107
|
+
* @example snippet: cliCommandContract
|
|
107
108
|
*/
|
|
108
109
|
export const defineCLICommands = <T extends Record<string, CoreCLICommandConfig<any, PikkuMiddleware, PikkuCLIRender<any>, any>>>(
|
|
109
110
|
commands: T
|
|
@@ -35,7 +35,7 @@ export const pikkuFunctionTypesSplit = pikkuSessionlessFunc({
|
|
|
35
35
|
await writeFileInDir(logger, middlewareTypesFile, serializeMiddlewareTypes(getFileImportRelativePath(middlewareTypesFile, functionTypesFile, packageMappings), `import type { RequiredSingletonServices } from '${getFileImportRelativePath(middlewareTypesFile, servicesFile, packageMappings)}'`, config.addonName));
|
|
36
36
|
await writeFileInDir(logger, setupTypesFile, serializeSetupTypes(getFileImportRelativePath(setupTypesFile, functionTypesFile, packageMappings), pikkuConfigType
|
|
37
37
|
? `import type { ${pikkuConfigType.type} } from '${getFileImportRelativePath(setupTypesFile, pikkuConfigType.typePath, packageMappings)}'`
|
|
38
|
-
: '// Config type not found, will use fallback', pikkuConfigType?.type, `import type { RequiredSingletonServices, RequiredWireServices } from '${getFileImportRelativePath(setupTypesFile, servicesFile, packageMappings)}'
|
|
38
|
+
: '// Config type not found, will use fallback', pikkuConfigType?.type, `import type { RequiredSingletonServices, RequiredWireServices } from '${getFileImportRelativePath(setupTypesFile, servicesFile, packageMappings)}'`, config.allowShadowedServices));
|
|
39
39
|
await writeFileInDir(logger, authGuardsFile, serializeAuthGuards(getFileImportRelativePath(authGuardsFile, functionTypesFile, packageMappings), `import type { RequiredSingletonServices } from '${getFileImportRelativePath(authGuardsFile, servicesFile, packageMappings)}'`, config.addonName));
|
|
40
40
|
const addonRefs = serializeAddonRefs({
|
|
41
41
|
addonHttp: visitState.exportedContracts.addonHttp,
|
|
@@ -106,6 +106,10 @@ const __addonHttp = ${httpMap} as const
|
|
|
106
106
|
const __addonChannel = ${channelMap} as const
|
|
107
107
|
const __addonCli = ${cliMap} as const
|
|
108
108
|
|
|
109
|
+
/**
|
|
110
|
+
* Names an HTTP route an installed addon wires, so you can link or redirect to
|
|
111
|
+
* it without hardcoding a path the addon may move.
|
|
112
|
+
*/
|
|
109
113
|
export const refHTTP = <Name extends keyof typeof __addonHttp>(
|
|
110
114
|
name: Name,
|
|
111
115
|
options?: { basePath?: string }
|
|
@@ -118,10 +122,18 @@ export const refHTTP = <Name extends keyof typeof __addonHttp>(
|
|
|
118
122
|
) as (typeof __addonHttp)[Name]
|
|
119
123
|
}
|
|
120
124
|
|
|
125
|
+
/**
|
|
126
|
+
* Names a channel an installed addon wires, for connecting to it without
|
|
127
|
+
* hardcoding its name.
|
|
128
|
+
*/
|
|
121
129
|
export const refChannel = <Name extends keyof typeof __addonChannel>(
|
|
122
130
|
name: Name
|
|
123
131
|
): (typeof __addonChannel)[Name] => __addonChannel[name]
|
|
124
132
|
|
|
133
|
+
/**
|
|
134
|
+
* Names a CLI command an installed addon wires, for invoking it without
|
|
135
|
+
* hardcoding its name.
|
|
136
|
+
*/
|
|
125
137
|
export const refCLI = <Name extends keyof typeof __addonCli>(
|
|
126
138
|
name: Name
|
|
127
139
|
): (typeof __addonCli)[Name] => __addonCli[name]
|