@pikku/cli 0.12.20 → 0.12.22
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/cli.schema.json +1 -1
- package/console-app/assets/index-C52h1B_L.css +1 -0
- package/console-app/assets/index-CAk106ji.js +232 -0
- package/console-app/index.html +3 -6
- package/dist/.pikku/agent/pikku-agent-types.gen.d.ts +1 -1
- package/dist/.pikku/channel/pikku-channel-types.gen.d.ts +3 -3
- package/dist/.pikku/channel/pikku-channel-types.gen.js +1 -1
- package/dist/.pikku/cli/pikku-cli-channel.d.ts +6 -6
- package/dist/.pikku/cli/pikku-cli-channel.js +280 -1
- package/dist/.pikku/cli/pikku-cli-types.gen.d.ts +1 -1
- package/dist/.pikku/cli/pikku-cli-types.gen.js +1 -1
- package/dist/.pikku/cli/pikku-cli-wirings-meta.gen.js +1 -1
- package/dist/.pikku/cli/pikku-cli-wirings-meta.gen.json +792 -8
- 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/console/pikku-node-types.gen.d.ts +1 -1
- package/dist/.pikku/function/pikku-function-types.gen.d.ts +44 -70
- package/dist/.pikku/function/pikku-function-types.gen.js +33 -40
- package/dist/.pikku/function/pikku-functions-meta.gen.js +1 -1
- package/dist/.pikku/function/pikku-functions-meta.gen.json +1439 -316
- package/dist/.pikku/function/pikku-functions.gen.js +21 -9
- package/dist/.pikku/http/pikku-http-types.gen.d.ts +1 -1
- package/dist/.pikku/http/pikku-http-types.gen.js +1 -1
- package/dist/.pikku/http/pikku-http-wirings-meta.gen.js +1 -1
- package/dist/.pikku/http/pikku-http-wirings.gen.d.ts +1 -1
- package/dist/.pikku/http/pikku-http-wirings.gen.js +1 -1
- package/dist/.pikku/mcp/pikku-mcp-types.gen.d.ts +1 -1
- package/dist/.pikku/mcp/pikku-mcp-types.gen.js +1 -1
- package/dist/.pikku/pikku-bootstrap.gen.d.ts +3 -1
- package/dist/.pikku/pikku-bootstrap.gen.js +3 -1
- package/dist/.pikku/pikku-meta-service.gen.d.ts +1 -1
- package/dist/.pikku/pikku-meta-service.gen.js +1 -1
- package/dist/.pikku/pikku-services.gen.d.ts +2 -1
- package/dist/.pikku/pikku-services.gen.js +1 -0
- package/dist/.pikku/pikku-types.gen.d.ts +1 -1
- package/dist/.pikku/pikku-types.gen.js +1 -1
- package/dist/.pikku/queue/pikku-queue-types.gen.d.ts +1 -1
- package/dist/.pikku/queue/pikku-queue-types.gen.js +1 -1
- package/dist/.pikku/queue/pikku-queue-workers-wirings-meta.gen.d.ts +1 -0
- package/dist/.pikku/queue/pikku-queue-workers-wirings-meta.gen.js +6 -0
- package/dist/.pikku/queue/pikku-queue-workers-wirings-meta.gen.json +250 -0
- package/dist/.pikku/queue/pikku-queue-workers-wirings.gen.d.ts +4 -0
- package/dist/.pikku/queue/pikku-queue-workers-wirings.gen.js +5 -0
- package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.js +1 -1
- package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.json +66 -10
- package/dist/.pikku/scheduler/pikku-scheduler-types.gen.d.ts +1 -1
- package/dist/.pikku/scheduler/pikku-scheduler-types.gen.js +1 -1
- package/dist/.pikku/schemas/register.gen.js +157 -11
- package/dist/.pikku/schemas/schemas/BinaryInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/DbMigrateInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/DbResetInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/DbSeedInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricDbSchemaInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricDbSchemaOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricDeployApplyInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricDeployApplyOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricDeployListInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricDeployListOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricDeployPlanInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricDeployPlanOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricDeployUnitsInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricDeployUnitsOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricDomainsAddInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricDomainsAddOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricDomainsListInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricDomainsListOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricDomainsRemoveInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricDomainsRemoveOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricErrorsInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricErrorsOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricInitInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricInitOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricLLMKeyInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricLLMKeyOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricLinkInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricLinkOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricLoginInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricLoginOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricLogsInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricLogsOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricMetricsInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricMetricsOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricRollbackInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricRollbackOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricSecretsListInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricSecretsListOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricSecretsSetInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricSecretsSetOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricStatusInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricStatusOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricTraceInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricTraceOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricValidateInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricValidateOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuCLIConfig.schema.json +1 -1
- package/dist/.pikku/schemas/schemas/PikkuCommandChannelsOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuCommandHTTPOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuCommandQueueOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuEventsScaffoldOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuMetaClientsInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuMetaContextInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuMetaFunctionsGetInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuMetaFunctionsListInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuMetaMiddlewareGetInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuMetaMiddlewareListInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuMetaPermissionsGetInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuMetaPermissionsListInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuMetaSchemasGetInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuMetaSchemasListInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuMetaWiresChannelInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuMetaWiresHttpInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuMetaWiresListInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuMetaWiresQueueInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuMetaWiresSchedulerInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuMetaWiresTriggerInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuMetaWiresTypeInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuMetaWorkflowsGetInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuMetaWorkflowsListInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuSkillsInstallInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuSkillsListInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuTestsCoverageInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuTestsInitInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/WorkflowRunStatus.schema.json +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 +1 -1
- package/dist/.pikku/secrets/pikku-secrets.gen.js +1 -1
- package/dist/.pikku/trigger/pikku-trigger-types.gen.d.ts +1 -1
- package/dist/.pikku/trigger/pikku-trigger-types.gen.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 +1 -1
- package/dist/.pikku/variables/pikku-variables.gen.js +1 -1
- package/dist/.pikku/workflow/meta/allWorkflow.gen.json +237 -629
- package/dist/.pikku/workflow/pikku-workflow-types.gen.d.ts +1 -1
- package/dist/.pikku/workflow/pikku-workflow-types.gen.js +1 -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 +23 -0
- package/dist/bin/pikku.js +28 -1
- package/dist/src/cli.wiring.js +286 -10
- package/dist/src/deploy/analyzer/analyzer.d.ts +16 -1
- package/dist/src/deploy/analyzer/analyzer.js +83 -43
- package/dist/src/deploy/analyzer/manifest.d.ts +10 -0
- package/dist/src/deploy/build-pipeline.d.ts +2 -0
- package/dist/src/deploy/build-pipeline.js +123 -19
- package/dist/src/deploy/bundler/bundler.d.ts +3 -1
- package/dist/src/deploy/bundler/bundler.js +40 -9
- package/dist/src/deploy/bundler/dep-extractor.d.ts +5 -2
- package/dist/src/deploy/bundler/dep-extractor.js +103 -23
- package/dist/src/deploy/bundler/types.d.ts +5 -1
- package/dist/src/deploy/codegen/per-unit-codegen.d.ts +11 -1
- package/dist/src/deploy/codegen/per-unit-codegen.js +49 -6
- package/dist/src/deploy/plan/planner.js +25 -3
- package/dist/src/deploy/plan/provider.d.ts +2 -0
- package/dist/src/deploy/provider-adapter.d.ts +34 -0
- package/dist/src/deploy/server-entry.d.ts +16 -0
- package/dist/src/deploy/server-entry.js +81 -0
- package/dist/src/fabric/fabric-commands.d.ts +522 -0
- package/dist/src/fabric/fabric-commands.js +299 -0
- package/dist/src/fabric/functions/db-schema.function.d.ts +35 -0
- package/dist/src/fabric/functions/db-schema.function.js +37 -0
- package/dist/src/fabric/functions/deploy-list.function.d.ts +41 -0
- package/dist/src/fabric/functions/deploy-list.function.js +43 -0
- package/dist/src/fabric/functions/deploy-units.function.d.ts +35 -0
- package/dist/src/fabric/functions/deploy-units.function.js +41 -0
- package/dist/src/fabric/functions/deploy.function.d.ts +105 -0
- package/dist/src/fabric/functions/deploy.function.js +122 -0
- package/dist/src/fabric/functions/domains-add.function.d.ts +35 -0
- package/dist/src/fabric/functions/domains-add.function.js +46 -0
- package/dist/src/fabric/functions/domains-list.function.d.ts +20 -0
- package/dist/src/fabric/functions/domains-list.function.js +50 -0
- package/dist/src/fabric/functions/domains-remove.function.d.ts +24 -0
- package/dist/src/fabric/functions/domains-remove.function.js +44 -0
- package/dist/src/fabric/functions/errors.function.d.ts +44 -0
- package/dist/src/fabric/functions/errors.function.js +50 -0
- package/dist/src/fabric/functions/init.function.d.ts +51 -0
- package/dist/src/fabric/functions/init.function.js +54 -0
- package/dist/src/fabric/functions/link.function.d.ts +28 -0
- package/dist/src/fabric/functions/link.function.js +77 -0
- package/dist/src/fabric/functions/llm-key.function.d.ts +46 -0
- package/dist/src/fabric/functions/llm-key.function.js +76 -0
- package/dist/src/fabric/functions/login.function.d.ts +42 -0
- package/dist/src/fabric/functions/login.function.js +68 -0
- package/dist/src/fabric/functions/logs.function.d.ts +40 -0
- package/dist/src/fabric/functions/logs.function.js +84 -0
- package/dist/src/fabric/functions/metrics.function.d.ts +32 -0
- package/dist/src/fabric/functions/metrics.function.js +49 -0
- package/dist/src/fabric/functions/rollback.function.d.ts +76 -0
- package/dist/src/fabric/functions/rollback.function.js +69 -0
- package/dist/src/fabric/functions/secrets-list.function.d.ts +24 -0
- package/dist/src/fabric/functions/secrets-list.function.js +37 -0
- package/dist/src/fabric/functions/secrets-set.function.d.ts +32 -0
- package/dist/src/fabric/functions/secrets-set.function.js +36 -0
- package/dist/src/fabric/functions/status.function.d.ts +34 -0
- package/dist/src/fabric/functions/status.function.js +43 -0
- package/dist/src/fabric/functions/trace.function.d.ts +28 -0
- package/dist/src/fabric/functions/trace.function.js +45 -0
- package/dist/src/fabric/functions/validate.function.d.ts +50 -0
- package/dist/src/fabric/functions/validate.function.js +363 -0
- package/dist/src/fabric/lib/config.d.ts +64 -0
- package/dist/src/fabric/lib/config.js +62 -0
- package/dist/src/fabric/lib/console-url.d.ts +5 -0
- package/dist/src/fabric/lib/console-url.js +13 -0
- package/dist/src/fabric/lib/git.d.ts +53 -0
- package/dist/src/fabric/lib/git.js +151 -0
- package/dist/src/fabric/lib/http.d.ts +4 -0
- package/dist/src/fabric/lib/http.js +12 -0
- package/dist/src/fabric/lib/not-implemented.d.ts +5 -0
- package/dist/src/fabric/lib/not-implemented.js +8 -0
- package/dist/src/fabric/lib/output.d.ts +23 -0
- package/dist/src/fabric/lib/output.js +39 -0
- package/dist/src/fabric/lib/prompt.d.ts +12 -0
- package/dist/src/fabric/lib/prompt.js +32 -0
- package/dist/src/fabric/lib/stage.d.ts +7 -0
- package/dist/src/fabric/lib/stage.js +14 -0
- package/dist/src/fabric/sdk/pikku-fetch.gen.d.ts +14 -0
- package/dist/src/fabric/sdk/pikku-fetch.gen.js +30 -0
- package/dist/src/fabric/sdk/pikku-rpc.gen.d.ts +105 -0
- package/dist/src/fabric/sdk/pikku-rpc.gen.js +126 -0
- package/dist/src/functions/commands/all.d.ts +1 -1
- package/dist/src/functions/commands/binary.d.ts +7 -0
- package/dist/src/functions/commands/binary.js +40 -0
- package/dist/src/functions/commands/bootstrap.d.ts +1 -1
- package/dist/src/functions/commands/bootstrap.js +7 -4
- package/dist/src/functions/commands/console.d.ts +3 -3
- package/dist/src/functions/commands/db-migrate.d.ts +1 -0
- package/dist/src/functions/commands/db-migrate.js +35 -0
- package/dist/src/functions/commands/db-reset.d.ts +1 -0
- package/dist/src/functions/commands/db-reset.js +36 -0
- package/dist/src/functions/commands/db-seed.d.ts +1 -0
- package/dist/src/functions/commands/db-seed.js +27 -0
- package/dist/src/functions/commands/db-shared.d.ts +32 -0
- package/dist/src/functions/commands/db-shared.js +26 -0
- package/dist/src/functions/commands/deploy-apply.d.ts +3 -3
- package/dist/src/functions/commands/deploy-apply.js +6 -4
- package/dist/src/functions/commands/deploy-info.d.ts +1 -1
- package/dist/src/functions/commands/deploy-plan.d.ts +3 -3
- package/dist/src/functions/commands/deploy-plan.js +7 -1
- package/dist/src/functions/commands/dev.d.ts +3 -3
- package/dist/src/functions/commands/dev.js +142 -86
- package/dist/src/functions/commands/enable.d.ts +5 -4
- package/dist/src/functions/commands/enable.js +4 -0
- package/dist/src/functions/commands/info.d.ts +4 -4
- package/dist/src/functions/commands/load-user-project.d.ts +11 -0
- package/dist/src/functions/commands/load-user-project.js +40 -0
- package/dist/src/functions/commands/meta.d.ts +82 -0
- package/dist/src/functions/commands/meta.js +454 -0
- package/dist/src/functions/commands/new-addon.d.ts +3 -3
- package/dist/src/functions/commands/new-function.d.ts +3 -3
- package/dist/src/functions/commands/new-middleware.d.ts +3 -3
- package/dist/src/functions/commands/new-permission.d.ts +3 -3
- package/dist/src/functions/commands/new-wiring.d.ts +3 -3
- package/dist/src/functions/commands/pikku-command-bootstrap.d.ts +1 -1
- package/dist/src/functions/commands/pikku-command-bootstrap.js +15 -1
- package/dist/src/functions/commands/pikku-command-summary.d.ts +1 -1
- package/dist/src/functions/commands/pikku-command-summary.js +7 -1
- package/dist/src/functions/commands/skills.d.ts +26 -0
- package/dist/src/functions/commands/skills.js +184 -0
- package/dist/src/functions/commands/tests-coverage.d.ts +7 -0
- package/dist/src/functions/commands/tests-coverage.js +231 -0
- package/dist/src/functions/commands/tests-init.d.ts +7 -0
- package/dist/src/functions/commands/tests-init.js +225 -0
- package/dist/src/functions/commands/versions-check.d.ts +1 -1
- package/dist/src/functions/commands/versions-init.d.ts +3 -3
- package/dist/src/functions/commands/versions-update.d.ts +1 -1
- package/dist/src/functions/commands/versions-update.js +4 -2
- package/dist/src/functions/commands/watch.d.ts +3 -3
- package/dist/src/functions/commands/watch.js +1 -1
- package/dist/src/functions/db/local-db.d.ts +48 -0
- package/dist/src/functions/db/local-db.js +106 -0
- package/dist/src/functions/db/seed.d.ts +11 -0
- package/dist/src/functions/db/seed.js +22 -0
- package/dist/src/functions/db/sql-migrator.d.ts +26 -0
- package/dist/src/functions/db/sql-migrator.js +104 -0
- package/dist/src/functions/db/sqlite-codegen.d.ts +45 -0
- package/dist/src/functions/db/sqlite-codegen.js +294 -0
- package/dist/src/functions/db/zod-codegen.d.ts +10 -0
- package/dist/src/functions/db/zod-codegen.js +109 -0
- package/dist/src/functions/runtimes/fetch/index.d.ts +1 -1
- package/dist/src/functions/runtimes/nextjs/pikku-command-nextjs.d.ts +1 -1
- package/dist/src/functions/runtimes/nextjs/pikku-command-nextjs.js +21 -2
- package/dist/src/functions/runtimes/nextjs/serialize-nextjs-backend-worker-rpc-wrapper.d.ts +1 -0
- package/dist/src/functions/runtimes/nextjs/serialize-nextjs-backend-worker-rpc-wrapper.js +163 -0
- package/dist/src/functions/runtimes/nextjs/serialize-nextjs-http-wrapper.d.ts +1 -1
- package/dist/src/functions/runtimes/nextjs/serialize-nextjs-http-wrapper.js +5 -2
- package/dist/src/functions/runtimes/tanstack-start/pikku-command-tanstack-start.d.ts +1 -0
- package/dist/src/functions/runtimes/tanstack-start/pikku-command-tanstack-start.js +32 -0
- package/dist/src/functions/runtimes/tanstack-start/serialize-tanstack-start-shim.d.ts +11 -0
- package/dist/src/functions/runtimes/tanstack-start/serialize-tanstack-start-shim.js +36 -0
- package/dist/src/functions/runtimes/websocket/pikku-command-websocket-typed.d.ts +1 -1
- package/dist/src/functions/wirings/ai-agent/pikku-command-ai-agent-types.d.ts +1 -1
- package/dist/src/functions/wirings/ai-agent/pikku-command-ai-agent.d.ts +1 -1
- package/dist/src/functions/wirings/ai-agent/pikku-command-ai-agent.js +1 -10
- package/dist/src/functions/wirings/ai-agent/pikku-command-public-agent.d.ts +1 -1
- package/dist/src/functions/wirings/ai-agent/serialize-public-agent.js +76 -1
- package/dist/src/functions/wirings/channels/pikku-channels.d.ts +1 -1
- package/dist/src/functions/wirings/channels/pikku-command-channel-types.d.ts +1 -1
- package/dist/src/functions/wirings/channels/pikku-command-channels-map.d.ts +1 -1
- package/dist/src/functions/wirings/channels/pikku-command-channels.d.ts +1 -1
- package/dist/src/functions/wirings/channels/pikku-command-channels.js +1 -1
- package/dist/src/functions/wirings/cli/pikku-command-cli-entry.d.ts +1 -1
- package/dist/src/functions/wirings/cli/pikku-command-cli-entry.js +5 -2
- package/dist/src/functions/wirings/cli/pikku-command-cli-types.d.ts +5 -1
- package/dist/src/functions/wirings/cli/pikku-command-cli-types.js +8 -2
- package/dist/src/functions/wirings/cli/pikku-command-cli.d.ts +1 -1
- package/dist/src/functions/wirings/cli/serialize-channel-cli-client.js +27 -9
- package/dist/src/functions/wirings/cli/serialize-channel-cli.d.ts +5 -1
- package/dist/src/functions/wirings/cli/serialize-channel-cli.js +13 -3
- package/dist/src/functions/wirings/console/pikku-command-console-functions.d.ts +1 -1
- package/dist/src/functions/wirings/console/pikku-command-console-functions.js +5 -1
- package/dist/src/functions/wirings/console/pikku-command-node-types.d.ts +1 -1
- package/dist/src/functions/wirings/console/pikku-command-nodes-meta.d.ts +1 -1
- package/dist/src/functions/wirings/console/serialize-console-functions.js +5 -0
- package/dist/src/functions/wirings/credentials/pikku-command-credentials.d.ts +1 -1
- package/dist/src/functions/wirings/functions/pikku-command-addon-types.d.ts +5 -1
- package/dist/src/functions/wirings/functions/pikku-command-addon-types.js +7 -2
- package/dist/src/functions/wirings/functions/pikku-command-function-types-split.d.ts +1 -1
- package/dist/src/functions/wirings/functions/pikku-command-function-types-split.js +1 -1
- package/dist/src/functions/wirings/functions/pikku-command-function-types.d.ts +1 -1
- package/dist/src/functions/wirings/functions/pikku-command-functions.d.ts +1 -1
- package/dist/src/functions/wirings/functions/pikku-command-services.d.ts +1 -1
- package/dist/src/functions/wirings/functions/schemas.d.ts +1 -1
- package/dist/src/functions/wirings/functions/serialize-function-types.js +105 -80
- package/dist/src/functions/wirings/gateway/pikku-command-gateway.d.ts +1 -1
- package/dist/src/functions/wirings/http/pikku-command-http-map.d.ts +1 -1
- package/dist/src/functions/wirings/http/pikku-command-http-routes.d.ts +1 -1
- package/dist/src/functions/wirings/http/pikku-command-http-routes.js +1 -1
- package/dist/src/functions/wirings/http/pikku-command-http-types.d.ts +1 -1
- package/dist/src/functions/wirings/http/pikku-command-openapi.d.ts +1 -1
- package/dist/src/functions/wirings/http/pikku-http-routes.d.ts +1 -1
- package/dist/src/functions/wirings/mcp/pikku-command-mcp-json.d.ts +1 -1
- package/dist/src/functions/wirings/mcp/pikku-command-mcp-types.d.ts +1 -1
- package/dist/src/functions/wirings/mcp/pikku-command-mcp.d.ts +1 -1
- package/dist/src/functions/wirings/middleware/pikku-command-middleware.d.ts +1 -1
- package/dist/src/functions/wirings/package/pikku-command-package-types.d.ts +2 -2
- package/dist/src/functions/wirings/package/pikku-command-package.d.ts +1 -1
- package/dist/src/functions/wirings/permissions/pikku-command-permissions.d.ts +1 -1
- package/dist/src/functions/wirings/queue/pikku-command-queue-map.d.ts +1 -1
- package/dist/src/functions/wirings/queue/pikku-command-queue-map.js +1 -1
- package/dist/src/functions/wirings/queue/pikku-command-queue-service.d.ts +1 -1
- package/dist/src/functions/wirings/queue/pikku-command-queue-types.d.ts +1 -1
- package/dist/src/functions/wirings/queue/pikku-command-queue.d.ts +1 -1
- package/dist/src/functions/wirings/queue/pikku-command-queue.js +1 -1
- package/dist/src/functions/wirings/queue/pikku-queue-map.d.ts +1 -1
- package/dist/src/functions/wirings/queue/pikku-queue.d.ts +1 -1
- package/dist/src/functions/wirings/realtime/pikku-command-events-scaffold.d.ts +1 -0
- package/dist/src/functions/wirings/realtime/pikku-command-events-scaffold.js +26 -0
- package/dist/src/functions/wirings/realtime/pikku-command-realtime.d.ts +1 -0
- package/dist/src/functions/wirings/realtime/pikku-command-realtime.js +35 -0
- package/dist/src/functions/wirings/realtime/serialize-events-scaffold.d.ts +23 -0
- package/dist/src/functions/wirings/realtime/serialize-events-scaffold.js +98 -0
- package/dist/src/functions/wirings/realtime/serialize-realtime-client.d.ts +22 -0
- package/dist/src/functions/wirings/realtime/serialize-realtime-client.js +337 -0
- package/dist/src/functions/wirings/rpc/pikku-command-public-rpc.d.ts +1 -1
- package/dist/src/functions/wirings/rpc/pikku-command-public-rpc.js +5 -1
- package/dist/src/functions/wirings/rpc/pikku-command-react-query.d.ts +1 -1
- package/dist/src/functions/wirings/rpc/pikku-command-remote-rpc.d.ts +1 -1
- package/dist/src/functions/wirings/rpc/pikku-command-remote-rpc.js +5 -1
- package/dist/src/functions/wirings/rpc/pikku-command-rpc-client.d.ts +1 -1
- package/dist/src/functions/wirings/rpc/pikku-command-rpc-client.js +3 -1
- package/dist/src/functions/wirings/rpc/pikku-command-rpc-map.d.ts +2 -2
- package/dist/src/functions/wirings/rpc/pikku-command-rpc.d.ts +2 -1
- package/dist/src/functions/wirings/rpc/pikku-command-rpc.js +13 -7
- package/dist/src/functions/wirings/rpc/serialize-public-rpc.js +1 -0
- package/dist/src/functions/wirings/rpc/serialize-react-query-hooks.js +1 -1
- package/dist/src/functions/wirings/rpc/serialize-remote-rpc.js +7 -1
- package/dist/src/functions/wirings/rpc/serialize-typed-rpc-map.js +16 -2
- package/dist/src/functions/wirings/scheduler/pikku-command-scheduler-types.d.ts +1 -1
- package/dist/src/functions/wirings/scheduler/pikku-command-scheduler.d.ts +1 -1
- package/dist/src/functions/wirings/secrets/pikku-command-secrets.d.ts +1 -1
- package/dist/src/functions/wirings/triggers/pikku-command-trigger-types.d.ts +1 -1
- package/dist/src/functions/wirings/triggers/pikku-command-trigger-types.js +1 -1
- package/dist/src/functions/wirings/triggers/pikku-command-trigger.d.ts +1 -1
- package/dist/src/functions/wirings/variables/pikku-command-variables.d.ts +1 -1
- package/dist/src/functions/wirings/workflow/pikku-command-workflow-routes.d.ts +1 -1
- package/dist/src/functions/wirings/workflow/pikku-command-workflow-routes.js +1 -1
- package/dist/src/functions/wirings/workflow/pikku-command-workflow.d.ts +5 -1
- package/dist/src/functions/wirings/workflow/pikku-command-workflow.js +18 -4
- package/dist/src/functions/wirings/workflow/serialize-workflow-bootstrap-map.d.ts +3 -0
- package/dist/src/functions/wirings/workflow/serialize-workflow-bootstrap-map.js +40 -0
- package/dist/src/functions/wirings/workflow/serialize-workflow-routes.js +56 -2
- package/dist/src/functions/workflows/all.workflow.js +45 -12
- package/dist/src/scaffold/rpc-remote.gen.d.ts +3 -3
- package/dist/src/scaffold/rpc-remote.gen.js +7 -2
- package/dist/src/scaffold/workflow-routes.gen.d.ts +18 -18
- package/dist/src/scaffold/workflow-routes.gen.js +33 -1
- package/dist/src/services/cli-logger.service.d.ts +22 -3
- package/dist/src/services/cli-logger.service.js +107 -41
- package/dist/src/services.js +32 -67
- package/dist/src/utils/generate-bootstrap-file.js +3 -0
- package/dist/src/utils/parse-cli-filters.d.ts +18 -0
- package/dist/src/utils/parse-cli-filters.js +99 -0
- package/dist/src/utils/pikku-cli-config.js +29 -9
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +9 -4
- package/skills/pikku-addon/SKILL.md +330 -0
- package/skills/pikku-ai-agent/SKILL.md +227 -0
- package/skills/pikku-ai-vercel/SKILL.md +78 -0
- package/skills/pikku-ai-voice/SKILL.md +85 -0
- package/skills/pikku-auth-js/SKILL.md +106 -0
- package/skills/pikku-aws/SKILL.md +107 -0
- package/skills/pikku-backblaze/SKILL.md +70 -0
- package/skills/pikku-cli/SKILL.md +281 -0
- package/skills/pikku-concepts/SKILL.md +281 -0
- package/skills/pikku-concepts/references/concept-mapping.md +528 -0
- package/skills/pikku-config/SKILL.md +208 -0
- package/skills/pikku-cron/SKILL.md +211 -0
- package/skills/pikku-deploy-azure/SKILL.md +69 -0
- package/skills/pikku-deploy-cloudflare/SKILL.md +80 -0
- package/skills/pikku-deploy-express/SKILL.md +83 -0
- package/skills/pikku-deploy-fastify/SKILL.md +70 -0
- package/skills/pikku-deploy-lambda/SKILL.md +107 -0
- package/skills/pikku-deploy-nextjs/SKILL.md +76 -0
- package/skills/pikku-deploy-uws/SKILL.md +85 -0
- package/skills/pikku-fabric/SKILL.md +245 -0
- package/skills/pikku-feature/SKILL.md +258 -0
- package/skills/pikku-gateway-slack/SKILL.md +112 -0
- package/skills/pikku-http/SKILL.md +317 -0
- package/skills/pikku-i18n/SKILL.md +208 -0
- package/skills/pikku-info/SKILL.md +95 -0
- package/skills/pikku-jose/SKILL.md +102 -0
- package/skills/pikku-kysely/SKILL.md +145 -0
- package/skills/pikku-mcp/SKILL.md +237 -0
- package/skills/pikku-mongodb/SKILL.md +102 -0
- package/skills/pikku-n8n-addon-map/SKILL.md +178 -0
- package/skills/pikku-n8n-code-translate/SKILL.md +166 -0
- package/skills/pikku-pino/SKILL.md +77 -0
- package/skills/pikku-queue/SKILL.md +237 -0
- package/skills/pikku-react/SKILL.md +183 -0
- package/skills/pikku-react-query/SKILL.md +205 -0
- package/skills/pikku-realtime/SKILL.md +285 -0
- package/skills/pikku-redis/SKILL.md +87 -0
- package/skills/pikku-rpc/SKILL.md +168 -0
- package/skills/pikku-rtl/SKILL.md +205 -0
- package/skills/pikku-schedule/SKILL.md +54 -0
- package/skills/pikku-schema-ajv/SKILL.md +60 -0
- package/skills/pikku-schema-cfworker/SKILL.md +60 -0
- package/skills/pikku-security/SKILL.md +243 -0
- package/skills/pikku-services/SKILL.md +247 -0
- package/skills/pikku-template-clone/SKILL.md +39 -0
- package/skills/pikku-testing/SKILL.md +428 -0
- package/skills/pikku-trigger/SKILL.md +177 -0
- package/skills/pikku-versioning/SKILL.md +169 -0
- package/skills/pikku-websocket/SKILL.md +239 -0
- package/skills/pikku-workflow/SKILL.md +283 -0
- package/skills/pikku-workflows-client/SKILL.md +150 -0
- package/skills/pikku-ws/SKILL.md +45 -0
- package/console-app/assets/index-BpY2pSuA.css +0 -10
- package/console-app/assets/index-DXLy-_D4.js +0 -717
- package/dist/.pikku/cli/pikku-cli-client.gen.d.ts +0 -10
- package/dist/.pikku/cli/pikku-cli-client.gen.js +0 -44
- /package/dist/.pikku/schemas/schemas/{PikkuChannelsOutput.schema.json → PikkuCLIEntryOutput.schema.json} +0 -0
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pikku-realtime
|
|
3
|
+
description: 'Use Pikku''s realtime feature — typed pub/sub events over WebSocket (multi-topic) or SSE (single-topic, auto-cleanup). Covers declaring EventHubTopics, scaffolding the /events channel, the auto-generated `PikkuRealtime` client, and publishing events from a function. TRIGGER when: the user asks for realtime updates, pub/sub, push notifications, server-sent events, websocket events, eventhub, or "live" data on the frontend. DO NOT TRIGGER when: the user wants RPC-style request/response (use pikku-rpc / pikku-react-query) or a custom one-off WebSocket channel (use pikku-websocket).'
|
|
4
|
+
installGroups: [core]
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Pikku Realtime
|
|
8
|
+
|
|
9
|
+
## Agent Operating Procedure
|
|
10
|
+
|
|
11
|
+
Use this skill as an execution checklist, not reference material.
|
|
12
|
+
|
|
13
|
+
1. Discover before editing. Prefer OpenCode tools such as `pikku-meta` when available; otherwise run the relevant `pikku meta ... --json` command and inspect only the focused output you need.
|
|
14
|
+
2. Identify the source files that own the behavior. Do not start by reading generated output, `.pikku`, `node_modules`, vendored packages, or broad build artifacts.
|
|
15
|
+
3. Make the smallest source change that satisfies the task. Keep generated files generated, and avoid hand-editing SDKs, schema output, or typegen.
|
|
16
|
+
4. Validate with the narrowest relevant command first, then run `pikku-verify` or `pikku all` when functions, wirings, schemas, or generated clients may have changed.
|
|
17
|
+
5. If validation fails, fix the source cause and rerun validation. Do not paper over generated errors by editing generated files.
|
|
18
|
+
|
|
19
|
+
Most realtime UI is just typed pub/sub: a server pushes `todo-created`, the
|
|
20
|
+
client renders it. Pikku's realtime feature ships exactly that, two ways:
|
|
21
|
+
|
|
22
|
+
- **WebSocket** at `/events` — one connection, many topic subscriptions.
|
|
23
|
+
- **SSE** at `GET /events/:topic` — one connection per topic, auto-cleanup
|
|
24
|
+
on disconnect. Good for environments where WebSocket is blocked or for
|
|
25
|
+
trivially streaming one topic.
|
|
26
|
+
|
|
27
|
+
Both transports use the same `EventHubService` and the same publish call.
|
|
28
|
+
Choose by transport, not by code shape.
|
|
29
|
+
|
|
30
|
+
## 1. Declare your topics
|
|
31
|
+
|
|
32
|
+
In your project's types file (e.g. `types/eventhub-topics.d.ts`):
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
import type { Todo } from '../src/schemas.js'
|
|
36
|
+
|
|
37
|
+
export type EventHubTopics = {
|
|
38
|
+
'todo-created': { todo: Todo }
|
|
39
|
+
'todo-updated': { todo: Todo }
|
|
40
|
+
'todo-deleted': { todoId: string }
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Reference it in `application-types.d.ts`:
|
|
45
|
+
|
|
46
|
+
```ts
|
|
47
|
+
import type { EventHubService } from '@pikku/core/channel'
|
|
48
|
+
import type { EventHubTopics } from './eventhub-topics.js'
|
|
49
|
+
|
|
50
|
+
export interface SingletonServices extends CoreSingletonServices<Config> {
|
|
51
|
+
eventHub?: EventHubService<EventHubTopics>
|
|
52
|
+
// ...
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
And instantiate it in `services.ts`:
|
|
57
|
+
|
|
58
|
+
```ts
|
|
59
|
+
import { LocalEventHubService } from '@pikku/core/channel'
|
|
60
|
+
// ...
|
|
61
|
+
const eventHub = new LocalEventHubService<EventHubTopics>()
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
(For multi-instance deployments use `CloudflareEventHubService` /
|
|
65
|
+
`LambdaEventHubService` / `UWSEventHubService` instead — same interface.)
|
|
66
|
+
|
|
67
|
+
## 2. Enable the server side
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
yarn pikku enable events # auth required by default
|
|
71
|
+
yarn pikku enable events --noAuth # public events
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
This sets `scaffold.events` in `pikku.config.json`. The next `pikku all`
|
|
75
|
+
generates `events.gen.ts` in your scaffold dir, which wires:
|
|
76
|
+
|
|
77
|
+
- A WebSocket channel at `/events` handling `{action: 'subscribe' | 'unsubscribe', topic}` messages.
|
|
78
|
+
- An SSE handler at `GET /events/:topic`.
|
|
79
|
+
|
|
80
|
+
You don't write either by hand. They use whatever `eventHub` service is
|
|
81
|
+
in your singletons.
|
|
82
|
+
|
|
83
|
+
## 3. Generate the typed client
|
|
84
|
+
|
|
85
|
+
Add to `pikku.config.json`:
|
|
86
|
+
|
|
87
|
+
```jsonc
|
|
88
|
+
{
|
|
89
|
+
"clientFiles": {
|
|
90
|
+
// ...
|
|
91
|
+
"realtimeFile": "packages/sdk/src/pikku/realtime.gen.ts",
|
|
92
|
+
// Optional: full type inference for subscribe/unsubscribe
|
|
93
|
+
"realtimeEventHubTopicsImport": "../../../functions/types/eventhub-topics.js#EventHubTopics",
|
|
94
|
+
},
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Run `pikku all` (or `pikku realtime` to regenerate just this file). The
|
|
99
|
+
generated file exports two surfaces:
|
|
100
|
+
|
|
101
|
+
```ts
|
|
102
|
+
export class PikkuRealtime {
|
|
103
|
+
constructor(options: { url: string; reconnect?: boolean; ... })
|
|
104
|
+
subscribe<K extends keyof EventHubTopics>(topic: K, handler: (data: EventHubTopics[K]) => void): () => void
|
|
105
|
+
unsubscribe<K extends keyof EventHubTopics>(topic: K, handler?: ...): void
|
|
106
|
+
close(): void
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export function subscribeToTopicViaSSE<K extends keyof EventHubTopics>(
|
|
110
|
+
baseUrl: string, topic: K, handler: (data: EventHubTopics[K]) => void
|
|
111
|
+
): { close: () => void }
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Without `realtimeEventHubTopicsImport`, the client falls back to
|
|
115
|
+
`Record<string, unknown>` — usable but untyped. Set the import for full
|
|
116
|
+
typed subscribe/unsubscribe.
|
|
117
|
+
|
|
118
|
+
## 4. Publish events from a function
|
|
119
|
+
|
|
120
|
+
The `/events` channel listens for client subscriptions; the eventHub fans
|
|
121
|
+
out publishes. Functions publish like this:
|
|
122
|
+
|
|
123
|
+
```ts
|
|
124
|
+
import { pikkuFunc } from '#pikku'
|
|
125
|
+
|
|
126
|
+
export const createTodo = pikkuFunc({
|
|
127
|
+
input: CreateTodoInput,
|
|
128
|
+
output: CreateTodoOutput,
|
|
129
|
+
func: async ({ kysely, eventHub }, data) => {
|
|
130
|
+
const todo = await kysely
|
|
131
|
+
.insertInto('todos')
|
|
132
|
+
.values(data)
|
|
133
|
+
.returningAll()
|
|
134
|
+
.executeTakeFirstOrThrow()
|
|
135
|
+
|
|
136
|
+
if (eventHub) {
|
|
137
|
+
// Envelope the payload with `topic` so the client dispatcher works.
|
|
138
|
+
await eventHub.publish('todo-created', null, {
|
|
139
|
+
topic: 'todo-created',
|
|
140
|
+
data: { todo },
|
|
141
|
+
})
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
return { id: todo.id }
|
|
145
|
+
},
|
|
146
|
+
})
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
The `null` channelId means "broadcast to all subscribers." Pass a
|
|
150
|
+
specific channel id to exclude/include a single connection.
|
|
151
|
+
|
|
152
|
+
A thin helper removes the duplication:
|
|
153
|
+
|
|
154
|
+
```ts
|
|
155
|
+
async function publishEvent<K extends keyof EventHubTopics>(
|
|
156
|
+
hub: EventHubService<EventHubTopics>,
|
|
157
|
+
topic: K,
|
|
158
|
+
data: EventHubTopics[K]
|
|
159
|
+
) {
|
|
160
|
+
return hub.publish(topic, null, { topic, data })
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
// usage:
|
|
164
|
+
await publishEvent(eventHub, 'todo-created', { todo })
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## 5. Wire it up — share fetch with PikkuRPC
|
|
168
|
+
|
|
169
|
+
`PikkuRealtime` mirrors `PikkuRPC`: it wraps the same `PikkuFetch`, so
|
|
170
|
+
server URL + auth are configured **once** and shared across HTTP, RPC,
|
|
171
|
+
and realtime transports.
|
|
172
|
+
|
|
173
|
+
```tsx
|
|
174
|
+
import { createPikku, PikkuProvider } from '@pikku/react'
|
|
175
|
+
import { PikkuFetch } from './pikku/pikku-fetch.gen'
|
|
176
|
+
import { PikkuRPC } from './pikku/pikku-rpc.gen'
|
|
177
|
+
import { PikkuRealtime } from './pikku/realtime.gen'
|
|
178
|
+
|
|
179
|
+
const pikku = createPikku(
|
|
180
|
+
PikkuFetch,
|
|
181
|
+
PikkuRPC,
|
|
182
|
+
PikkuRealtime, // pass the realtime class as the third arg
|
|
183
|
+
{ serverUrl: import.meta.env.VITE_API_URL ?? 'http://localhost:3000' }
|
|
184
|
+
)
|
|
185
|
+
// pikku.fetch / pikku.rpc / pikku.realtime — all share the same fetch.
|
|
186
|
+
|
|
187
|
+
createRoot(document.getElementById('root')!).render(
|
|
188
|
+
<PikkuProvider pikku={pikku}>
|
|
189
|
+
<App />
|
|
190
|
+
</PikkuProvider>
|
|
191
|
+
)
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
Or wire manually:
|
|
195
|
+
|
|
196
|
+
```ts
|
|
197
|
+
const realtime = new PikkuRealtime()
|
|
198
|
+
realtime.setPikkuFetch(pikku.fetch) // inherits serverUrl + auth
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
## 6. Subscribe from React
|
|
202
|
+
|
|
203
|
+
```tsx
|
|
204
|
+
import { useEffect, useState } from 'react'
|
|
205
|
+
|
|
206
|
+
function TodoList() {
|
|
207
|
+
const { realtime } = usePikku() // assuming you expose a hook over your context
|
|
208
|
+
const [todos, setTodos] = useState<Todo[]>([])
|
|
209
|
+
|
|
210
|
+
useEffect(() => {
|
|
211
|
+
const off = realtime.subscribe('todo-created', ({ todo }) => {
|
|
212
|
+
setTodos((prev) => [...prev, todo])
|
|
213
|
+
})
|
|
214
|
+
return off
|
|
215
|
+
}, [realtime])
|
|
216
|
+
|
|
217
|
+
return (
|
|
218
|
+
<ul>
|
|
219
|
+
{todos.map((t) => (
|
|
220
|
+
<li key={t.id}>{t.title}</li>
|
|
221
|
+
))}
|
|
222
|
+
</ul>
|
|
223
|
+
)
|
|
224
|
+
}
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
Single-topic SSE (auto-cleanup on close):
|
|
228
|
+
|
|
229
|
+
```tsx
|
|
230
|
+
useEffect(() => {
|
|
231
|
+
const sub = realtime.subscribeToTopic('todo-created', ({ todo }) => {
|
|
232
|
+
setTodos((prev) => [...prev, todo])
|
|
233
|
+
})
|
|
234
|
+
return () => sub.close()
|
|
235
|
+
}, [realtime])
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
## Subscribing to other SSE / WebSocket routes
|
|
239
|
+
|
|
240
|
+
Same client also handles generic SSE + channel routes — use the path,
|
|
241
|
+
the base URL is inherited from PikkuFetch:
|
|
242
|
+
|
|
243
|
+
```ts
|
|
244
|
+
// Any sse: true HTTP route
|
|
245
|
+
const sub = realtime.subscribeToSSE<{ progress: number }>(
|
|
246
|
+
`/workflow-run/${runId}/stream`,
|
|
247
|
+
(event) => setProgress(event.progress)
|
|
248
|
+
)
|
|
249
|
+
// later: sub.close()
|
|
250
|
+
|
|
251
|
+
// Any wireChannel — open a raw socket, wrap in PikkuWebSocket for typed I/O
|
|
252
|
+
const ws = realtime.connectToChannel('/ws/kanban')
|
|
253
|
+
const typed = new PikkuWebSocket<'kanban-live'>(ws)
|
|
254
|
+
typed.getRoute('command').subscribe('message', (data) => {
|
|
255
|
+
/* ... */
|
|
256
|
+
})
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
Discover what's available with `pikku meta clients --json` — `channels`
|
|
260
|
+
and any HTTP `sse: true` routes are listed there.
|
|
261
|
+
|
|
262
|
+
## When to pick which transport
|
|
263
|
+
|
|
264
|
+
| Need | Use |
|
|
265
|
+
| ------------------------------------------ | ----------------------------- |
|
|
266
|
+
| Many topics in one connection | **PikkuRealtime** (WebSocket) |
|
|
267
|
+
| Single live stream, simple cleanup | **subscribeToTopicViaSSE** |
|
|
268
|
+
| Bidirectional (client also sends messages) | **PikkuRealtime** |
|
|
269
|
+
| WebSockets blocked by infra | **subscribeToTopicViaSSE** |
|
|
270
|
+
|
|
271
|
+
Both auto-clean on the server (the eventHub's `onChannelClosed` hook
|
|
272
|
+
unsubscribes all topics for the dead channel id). Don't write manual
|
|
273
|
+
cleanup unless you're unsubscribing partway through a session.
|
|
274
|
+
|
|
275
|
+
## What NOT to do
|
|
276
|
+
|
|
277
|
+
- Don't call `eventHub.publish(topic, ..., rawData)` without the
|
|
278
|
+
`{topic, data}` envelope — clients use `topic` to dispatch handlers.
|
|
279
|
+
- Don't create your own `/events` channel by hand — `pikku enable events`
|
|
280
|
+
already does it correctly with disconnect cleanup.
|
|
281
|
+
- Don't subscribe inside the render path — use `useEffect`. Otherwise
|
|
282
|
+
you'll create a subscription per render.
|
|
283
|
+
- Don't subscribe to topics that don't exist in `EventHubTopics`. The
|
|
284
|
+
generated client's types prevent it; if you find yourself reaching for
|
|
285
|
+
`as any` to subscribe to a string, declare the topic first.
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pikku-redis
|
|
3
|
+
description: 'Use when setting up Redis-backed services in a Pikku app. Covers channel stores, workflow services, secret services, event hubs, agent runs, and deployment services backed by Redis.
|
|
4
|
+
TRIGGER when: code uses RedisChannelStore, RedisWorkflowService, RedisSecretService, or user asks about Redis setup with Pikku.
|
|
5
|
+
DO NOT TRIGGER when: user asks about BullMQ queues (use pikku-queue) or SQL databases (use pikku-kysely).'
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Pikku Redis
|
|
9
|
+
|
|
10
|
+
## Agent Operating Procedure
|
|
11
|
+
|
|
12
|
+
Use this skill as an execution checklist, not reference material.
|
|
13
|
+
|
|
14
|
+
1. Discover before editing. Prefer OpenCode tools such as `pikku-meta` when available; otherwise run the relevant `pikku meta ... --json` command and inspect only the focused output you need.
|
|
15
|
+
2. Identify the source files that own the behavior. Do not start by reading generated output, `.pikku`, `node_modules`, vendored packages, or broad build artifacts.
|
|
16
|
+
3. Make the smallest source change that satisfies the task. Keep generated files generated, and avoid hand-editing SDKs, schema output, or typegen.
|
|
17
|
+
4. Validate with the narrowest relevant command first, then run `pikku-verify` or `pikku all` when functions, wirings, schemas, or generated clients may have changed.
|
|
18
|
+
5. If validation fails, fix the source cause and rerun validation. Do not paper over generated errors by editing generated files.
|
|
19
|
+
|
|
20
|
+
`@pikku/redis` provides Redis-backed implementations of Pikku's core service interfaces using [ioredis](https://github.com/redis/ioredis).
|
|
21
|
+
|
|
22
|
+
## Installation
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
yarn add @pikku/redis
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## API Reference
|
|
29
|
+
|
|
30
|
+
### Available Services
|
|
31
|
+
|
|
32
|
+
All services accept a Redis connection (ioredis `Redis` instance, `RedisOptions`, or connection string) in their constructor.
|
|
33
|
+
|
|
34
|
+
| Service | Interface | Purpose |
|
|
35
|
+
| ------------------------- | ---------------------- | ---------------------------------------------- |
|
|
36
|
+
| `RedisChannelStore` | `ChannelStore` | WebSocket channel state persistence |
|
|
37
|
+
| `RedisEventHubStore` | `EventHubStore` | Event hub state persistence |
|
|
38
|
+
| `RedisWorkflowService` | `PikkuWorkflowService` | Workflow definition storage |
|
|
39
|
+
| `RedisWorkflowRunService` | `WorkflowRunService` | Workflow execution tracking |
|
|
40
|
+
| `RedisDeploymentService` | `DeploymentService` | Deployment state management |
|
|
41
|
+
| `RedisAgentRunService` | `AgentRunService` | Agent execution tracking |
|
|
42
|
+
| `RedisSecretService` | `SecretService` | Encrypted secret storage (envelope encryption) |
|
|
43
|
+
|
|
44
|
+
### Secret Service
|
|
45
|
+
|
|
46
|
+
```typescript
|
|
47
|
+
import { RedisSecretService } from '@pikku/redis'
|
|
48
|
+
|
|
49
|
+
const secrets = new RedisSecretService(
|
|
50
|
+
connectionOrConfig: Redis | RedisOptions | string,
|
|
51
|
+
config: { kekSecret: string; salt: string }
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
await secrets.getSecret(key: string): Promise<string>
|
|
55
|
+
await secrets.getSecretJSON<R>(key: string): Promise<R>
|
|
56
|
+
await secrets.hasSecret(key: string): Promise<boolean>
|
|
57
|
+
await secrets.setSecretJSON(key: string, value: unknown): Promise<void>
|
|
58
|
+
await secrets.deleteSecret(key: string): Promise<void>
|
|
59
|
+
await secrets.rotateKEK(): Promise<number>
|
|
60
|
+
await secrets.close(): Promise<void>
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Usage Patterns
|
|
64
|
+
|
|
65
|
+
### Full Setup
|
|
66
|
+
|
|
67
|
+
```typescript
|
|
68
|
+
import {
|
|
69
|
+
RedisChannelStore,
|
|
70
|
+
RedisWorkflowService,
|
|
71
|
+
RedisSecretService,
|
|
72
|
+
} from '@pikku/redis'
|
|
73
|
+
|
|
74
|
+
const createSingletonServices = pikkuServices(async (config) => {
|
|
75
|
+
const logger = new PinoLogger()
|
|
76
|
+
|
|
77
|
+
const channelStore = new RedisChannelStore(config.redisUrl)
|
|
78
|
+
const workflowService = new RedisWorkflowService(config.redisUrl)
|
|
79
|
+
|
|
80
|
+
const secrets = new RedisSecretService(config.redisUrl, {
|
|
81
|
+
kekSecret: config.kekSecret,
|
|
82
|
+
salt: config.salt,
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
return { config, logger, channelStore, workflowService, secrets }
|
|
86
|
+
})
|
|
87
|
+
```
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pikku-rpc
|
|
3
|
+
description: 'Use when making internal function-to-function calls within a Pikku app, composing functions, or exposing RPC endpoints. Covers rpc.invoke, rpc.remote, rpc.exposed, and generated RPC client.
|
|
4
|
+
TRIGGER when: code uses wire.rpc or expose: true, user asks about calling one Pikku function from another, function composition, or RPC endpoints.
|
|
5
|
+
DO NOT TRIGGER when: user asks about HTTP routes (use pikku-http) or addon cross-package calls (use pikku-addon).'
|
|
6
|
+
installGroups: [core]
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Pikku RPC Wiring
|
|
10
|
+
|
|
11
|
+
## Agent Operating Procedure
|
|
12
|
+
|
|
13
|
+
Use this skill as an execution checklist, not reference material.
|
|
14
|
+
|
|
15
|
+
1. Discover before editing. Prefer OpenCode tools such as `pikku-meta` when available; otherwise run the relevant `pikku meta ... --json` command and inspect only the focused output you need.
|
|
16
|
+
2. Identify the source files that own the behavior. Do not start by reading generated output, `.pikku`, `node_modules`, vendored packages, or broad build artifacts.
|
|
17
|
+
3. Make the smallest source change that satisfies the task. Keep generated files generated, and avoid hand-editing SDKs, schema output, or typegen.
|
|
18
|
+
4. Validate with the narrowest relevant command first, then run `pikku-verify` or `pikku all` when functions, wirings, schemas, or generated clients may have changed.
|
|
19
|
+
5. If validation fails, fix the source cause and rerun validation. Do not paper over generated errors by editing generated files.
|
|
20
|
+
|
|
21
|
+
Call Pikku functions from other Pikku functions internally with full type safety. Use RPC to compose business logic without importing functions directly.
|
|
22
|
+
|
|
23
|
+
## Before You Start
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
pikku info functions --verbose # See existing functions and which could be called via RPC
|
|
27
|
+
pikku info tags --verbose # Understand project organization
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
See `pikku-concepts` for the core mental model.
|
|
31
|
+
|
|
32
|
+
## API Reference
|
|
33
|
+
|
|
34
|
+
### RPC Methods (on `wire.rpc`)
|
|
35
|
+
|
|
36
|
+
Four ways to call functions via RPC:
|
|
37
|
+
|
|
38
|
+
| Method | Purpose |
|
|
39
|
+
| -------------------------------- | ----------------------------------------- |
|
|
40
|
+
| `rpc.invoke(name, data)` | Internal call to any wired function |
|
|
41
|
+
| `rpc.remote(name, data)` | Remote call via DeploymentService |
|
|
42
|
+
| `rpc.exposed(name, data)` | Call functions marked with `expose: true` |
|
|
43
|
+
| `rpc.startWorkflow(name, input)` | Start a workflow |
|
|
44
|
+
|
|
45
|
+
### Exposed Functions
|
|
46
|
+
|
|
47
|
+
Mark a function as externally callable via RPC:
|
|
48
|
+
|
|
49
|
+
```typescript
|
|
50
|
+
const greet = pikkuSessionlessFunc({
|
|
51
|
+
title: 'Greet',
|
|
52
|
+
expose: true, // ← callable via rpc.exposed()
|
|
53
|
+
func: async ({}, { name }) => {
|
|
54
|
+
return { message: `Hello, ${name}!` }
|
|
55
|
+
},
|
|
56
|
+
})
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### HTTP RPC Endpoint
|
|
60
|
+
|
|
61
|
+
Expose all `expose: true` functions over HTTP:
|
|
62
|
+
|
|
63
|
+
```typescript
|
|
64
|
+
wireHTTP({
|
|
65
|
+
route: '/rpc/:rpcName',
|
|
66
|
+
method: 'post',
|
|
67
|
+
auth: false,
|
|
68
|
+
func: rpcCaller,
|
|
69
|
+
})
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Usage Patterns
|
|
73
|
+
|
|
74
|
+
### Internal Function Composition
|
|
75
|
+
|
|
76
|
+
```typescript
|
|
77
|
+
const calculateTax = pikkuSessionlessFunc({
|
|
78
|
+
title: 'Calculate Tax',
|
|
79
|
+
func: async ({}, { amount, rate }) => {
|
|
80
|
+
return { tax: amount * rate }
|
|
81
|
+
},
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
const processOrder = pikkuFunc({
|
|
85
|
+
title: 'Process Order',
|
|
86
|
+
func: async ({ db }, { orderId }, { rpc }) => {
|
|
87
|
+
const order = await db.getOrder(orderId)
|
|
88
|
+
|
|
89
|
+
// Call another pikku function internally — fully typed
|
|
90
|
+
const { tax } = await rpc.invoke('calculateTax', {
|
|
91
|
+
amount: order.total,
|
|
92
|
+
rate: 0.08,
|
|
93
|
+
})
|
|
94
|
+
|
|
95
|
+
return { orderId, total: order.total + tax }
|
|
96
|
+
},
|
|
97
|
+
})
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### When to Use RPC vs Direct Imports
|
|
101
|
+
|
|
102
|
+
| Approach | Use When |
|
|
103
|
+
| -------------- | -------------------------------------------------------------------------------------------- |
|
|
104
|
+
| `rpc.invoke()` | Cross-domain calls, maintaining separation of concerns, function may be in different package |
|
|
105
|
+
| Direct import | Same module, tightly coupled logic, performance critical |
|
|
106
|
+
|
|
107
|
+
RPC calls go through Pikku's middleware and permission pipeline. Direct imports skip them.
|
|
108
|
+
|
|
109
|
+
### Generated RPC Client
|
|
110
|
+
|
|
111
|
+
After `npx pikku prebuild`:
|
|
112
|
+
|
|
113
|
+
```typescript
|
|
114
|
+
import { pikkuRPC } from '.pikku/pikku-rpc.gen.js'
|
|
115
|
+
|
|
116
|
+
pikkuRPC.setServerUrl('http://localhost:4002')
|
|
117
|
+
|
|
118
|
+
const result = await pikkuRPC.invoke('calculateTax', {
|
|
119
|
+
amount: 100,
|
|
120
|
+
rate: 0.08,
|
|
121
|
+
})
|
|
122
|
+
|
|
123
|
+
pikkuRPC.setAuthorizationJWT(token)
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## Complete Example
|
|
127
|
+
|
|
128
|
+
```typescript
|
|
129
|
+
// functions/billing.functions.ts
|
|
130
|
+
export const calculateTax = pikkuSessionlessFunc({
|
|
131
|
+
title: 'Calculate Tax',
|
|
132
|
+
func: async ({}, { amount, region }) => {
|
|
133
|
+
const rates = { US: 0.08, EU: 0.2, UK: 0.2 }
|
|
134
|
+
return { tax: amount * (rates[region] || 0) }
|
|
135
|
+
},
|
|
136
|
+
})
|
|
137
|
+
|
|
138
|
+
export const calculateShipping = pikkuSessionlessFunc({
|
|
139
|
+
title: 'Calculate Shipping',
|
|
140
|
+
func: async ({}, { weight, region }) => {
|
|
141
|
+
const base = region === 'US' ? 5 : 15
|
|
142
|
+
return { shipping: base + weight * 0.5 }
|
|
143
|
+
},
|
|
144
|
+
})
|
|
145
|
+
|
|
146
|
+
// functions/orders.functions.ts
|
|
147
|
+
export const processOrder = pikkuFunc({
|
|
148
|
+
title: 'Process Order',
|
|
149
|
+
func: async ({ db }, { orderId }, { rpc }) => {
|
|
150
|
+
const order = await db.getOrder(orderId)
|
|
151
|
+
|
|
152
|
+
const { tax } = await rpc.invoke('calculateTax', {
|
|
153
|
+
amount: order.total,
|
|
154
|
+
region: order.region,
|
|
155
|
+
})
|
|
156
|
+
|
|
157
|
+
const { shipping } = await rpc.invoke('calculateShipping', {
|
|
158
|
+
weight: order.totalWeight,
|
|
159
|
+
region: order.region,
|
|
160
|
+
})
|
|
161
|
+
|
|
162
|
+
const finalTotal = order.total + tax + shipping
|
|
163
|
+
await db.updateOrder(orderId, { tax, shipping, finalTotal })
|
|
164
|
+
|
|
165
|
+
return { orderId, total: finalTotal, tax, shipping }
|
|
166
|
+
},
|
|
167
|
+
})
|
|
168
|
+
```
|