@pikku/cli 0.12.1 → 0.12.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/cli.schema.json +1 -1
  2. package/console-app/assets/{index-DiYPTQU_.js → index-DRJQtv3c.js} +1 -1
  3. package/console-app/index.html +1 -1
  4. package/dist/.pikku/agent/pikku-agent-types.gen.d.ts +1 -1
  5. package/dist/.pikku/agent/pikku-agent-wirings-meta.gen.js +1 -1
  6. package/dist/.pikku/agent/pikku-agent-wirings.gen.d.ts +1 -1
  7. package/dist/.pikku/agent/pikku-agent-wirings.gen.js +1 -1
  8. package/dist/.pikku/channel/pikku-channel-types.gen.d.ts +1 -1
  9. package/dist/.pikku/channel/pikku-channel-types.gen.js +1 -1
  10. package/dist/.pikku/channel/pikku-channels-meta.gen.js +1 -1
  11. package/dist/.pikku/channel/pikku-channels.gen.d.ts +1 -1
  12. package/dist/.pikku/channel/pikku-channels.gen.js +1 -1
  13. package/dist/.pikku/cli/pikku-cli-channel.js +21 -1
  14. package/dist/.pikku/cli/pikku-cli-client.gen.d.ts +1 -1
  15. package/dist/.pikku/cli/pikku-cli-client.gen.js +1 -1
  16. package/dist/.pikku/cli/pikku-cli-types.gen.d.ts +1 -1
  17. package/dist/.pikku/cli/pikku-cli-types.gen.js +1 -1
  18. package/dist/.pikku/cli/pikku-cli-wirings-meta.gen.js +1 -1
  19. package/dist/.pikku/cli/pikku-cli-wirings-meta.gen.json +52 -0
  20. package/dist/.pikku/cli/pikku-cli-wirings.gen.d.ts +1 -1
  21. package/dist/.pikku/cli/pikku-cli-wirings.gen.js +1 -1
  22. package/dist/.pikku/cli/pikku-cli.gen.d.ts +1 -1
  23. package/dist/.pikku/cli/pikku-cli.gen.js +1 -1
  24. package/dist/.pikku/console/pikku-node-types.gen.d.ts +1 -1
  25. package/dist/.pikku/function/pikku-function-types.gen.d.ts +1 -1
  26. package/dist/.pikku/function/pikku-function-types.gen.js +1 -1
  27. package/dist/.pikku/function/pikku-functions-meta.gen.js +1 -1
  28. package/dist/.pikku/function/pikku-functions-meta.gen.json +202 -123
  29. package/dist/.pikku/function/pikku-functions.gen.js +3 -1
  30. package/dist/.pikku/http/pikku-http-types.gen.d.ts +1 -1
  31. package/dist/.pikku/http/pikku-http-types.gen.js +1 -1
  32. package/dist/.pikku/http/pikku-http-wirings-meta.gen.js +1 -1
  33. package/dist/.pikku/http/pikku-http-wirings.gen.d.ts +1 -1
  34. package/dist/.pikku/http/pikku-http-wirings.gen.js +1 -1
  35. package/dist/.pikku/mcp/pikku-mcp-types.gen.d.ts +1 -1
  36. package/dist/.pikku/mcp/pikku-mcp-types.gen.js +1 -1
  37. package/dist/.pikku/mcp/pikku-mcp-wirings-meta.gen.js +1 -1
  38. package/dist/.pikku/mcp/pikku-mcp-wirings.gen.d.ts +1 -1
  39. package/dist/.pikku/mcp/pikku-mcp-wirings.gen.js +1 -1
  40. package/dist/.pikku/pikku-bootstrap.gen.js +1 -1
  41. package/dist/.pikku/pikku-services.gen.d.ts +1 -1
  42. package/dist/.pikku/pikku-types.gen.d.ts +1 -1
  43. package/dist/.pikku/pikku-types.gen.js +1 -1
  44. package/dist/.pikku/pikku-websocket.gen.d.ts +1 -1
  45. package/dist/.pikku/pikku-websocket.gen.js +1 -1
  46. package/dist/.pikku/queue/pikku-queue-types.gen.d.ts +1 -1
  47. package/dist/.pikku/queue/pikku-queue-types.gen.js +1 -1
  48. package/dist/.pikku/queue/pikku-queue-workers-wirings-meta.gen.js +1 -1
  49. package/dist/.pikku/queue/pikku-queue-workers-wirings.gen.d.ts +1 -1
  50. package/dist/.pikku/queue/pikku-queue-workers-wirings.gen.js +1 -1
  51. package/dist/.pikku/rpc/pikku-remote-rpc-workers.gen.js +1 -1
  52. package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.js +1 -1
  53. package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.json +10 -5
  54. package/dist/.pikku/scheduler/pikku-scheduler-types.gen.d.ts +1 -1
  55. package/dist/.pikku/scheduler/pikku-scheduler-types.gen.js +1 -1
  56. package/dist/.pikku/scheduler/pikku-schedulers-wirings-meta.gen.js +1 -1
  57. package/dist/.pikku/scheduler/pikku-schedulers-wirings.gen.d.ts +1 -1
  58. package/dist/.pikku/scheduler/pikku-schedulers-wirings.gen.js +1 -1
  59. package/dist/.pikku/schemas/register.gen.js +9 -7
  60. package/dist/.pikku/schemas/schemas/PikkuCLIConfig.schema.json +1 -1
  61. package/dist/.pikku/schemas/schemas/PikkuGatewayOutput.schema.json +1 -0
  62. package/dist/.pikku/secrets/pikku-secret-types.gen.d.ts +1 -1
  63. package/dist/.pikku/secrets/pikku-secret-types.gen.js +1 -1
  64. package/dist/.pikku/secrets/pikku-secrets.gen.d.ts +1 -1
  65. package/dist/.pikku/secrets/pikku-secrets.gen.js +1 -1
  66. package/dist/.pikku/trigger/pikku-trigger-types.gen.d.ts +1 -1
  67. package/dist/.pikku/trigger/pikku-trigger-types.gen.js +1 -1
  68. package/dist/.pikku/variables/pikku-variable-types.gen.d.ts +1 -1
  69. package/dist/.pikku/variables/pikku-variable-types.gen.js +1 -1
  70. package/dist/.pikku/variables/pikku-variables.gen.d.ts +1 -1
  71. package/dist/.pikku/variables/pikku-variables.gen.js +1 -1
  72. package/dist/.pikku/workflow/pikku-workflow-types.gen.d.ts +1 -1
  73. package/dist/.pikku/workflow/pikku-workflow-types.gen.js +1 -1
  74. package/dist/.pikku/workflow/pikku-workflow-wirings-meta.gen.js +1 -1
  75. package/dist/.pikku/workflow/pikku-workflow-wirings.gen.d.ts +1 -1
  76. package/dist/.pikku/workflow/pikku-workflow-wirings.gen.js +1 -1
  77. package/dist/src/cli.wiring.js +46 -0
  78. package/dist/src/functions/commands/all.js +7 -2
  79. package/dist/src/functions/commands/enable.d.ts +4 -0
  80. package/dist/src/functions/commands/enable.js +39 -0
  81. package/dist/src/functions/runtimes/fetch/index.js +2 -1
  82. package/dist/src/functions/runtimes/nextjs/pikku-command-nextjs.js +4 -1
  83. package/dist/src/functions/runtimes/websocket/pikku-command-websocket-typed.js +2 -1
  84. package/dist/src/functions/wirings/ai-agent/pikku-command-public-agent.js +3 -5
  85. package/dist/src/functions/wirings/console/pikku-command-console-functions.js +4 -6
  86. package/dist/src/functions/wirings/console/pikku-command-nodes-meta.js +1 -1
  87. package/dist/src/functions/wirings/gateway/pikku-command-gateway.d.ts +1 -0
  88. package/dist/src/functions/wirings/gateway/pikku-command-gateway.js +22 -0
  89. package/dist/src/functions/wirings/mcp/pikku-command-mcp-json.js +1 -1
  90. package/dist/src/functions/wirings/queue/pikku-command-queue-service.js +2 -1
  91. package/dist/src/functions/wirings/rpc/pikku-command-public-rpc.js +3 -5
  92. package/dist/src/functions/wirings/rpc/pikku-command-remote-rpc.js +3 -5
  93. package/dist/src/functions/wirings/rpc/pikku-command-rpc-client.js +2 -1
  94. package/dist/src/functions/wirings/workflow/pikku-command-workflow.js +3 -10
  95. package/dist/src/services.js +12 -0
  96. package/dist/src/utils/pikku-cli-config.js +43 -16
  97. package/dist/tsconfig.tsbuildinfo +1 -1
  98. package/package.json +4 -4
package/cli.schema.json CHANGED
@@ -1 +1 @@
1
- {"$schema":"http://json-schema.org/draft-07/schema#","type":"object","additionalProperties":false,"properties":{"outDir":{"type":"string"},"schemaDirectory":{"type":"string"},"typesDeclarationFile":{"type":"string"},"functionsFile":{"type":"string"},"functionsMetaFile":{"type":"string"},"functionsMetaJsonFile":{"type":"string"},"functionTypesFile":{"type":"string"},"httpWiringsFile":{"type":"string"},"httpWiringMetaFile":{"type":"string"},"httpWiringMetaJsonFile":{"type":"string"},"httpMapDeclarationFile":{"type":"string"},"httpTypesFile":{"type":"string"},"channelsWiringFile":{"type":"string"},"channelsWiringMetaFile":{"type":"string"},"channelsWiringMetaJsonFile":{"type":"string"},"channelsMapDeclarationFile":{"type":"string"},"channelsTypesFile":{"type":"string"},"rpcInternalWiringMetaFile":{"type":"string"},"rpcInternalWiringMetaJsonFile":{"type":"string"},"rpcInternalMapDeclarationFile":{"type":"string"},"rpcMapDeclarationFile":{"type":"string"},"triggersTypesFile":{"type":"string"},"triggersWiringFile":{"type":"string"},"triggersWiringMetaFile":{"type":"string"},"triggersWiringMetaJsonFile":{"type":"string"},"triggerSourcesMetaFile":{"type":"string"},"triggerSourcesMetaJsonFile":{"type":"string"},"schedulersWiringFile":{"type":"string"},"schedulersWiringMetaFile":{"type":"string"},"schedulersWiringMetaJsonFile":{"type":"string"},"schedulersTypesFile":{"type":"string"},"queueWorkersWiringFile":{"type":"string"},"queueWorkersWiringMetaFile":{"type":"string"},"queueWorkersWiringMetaJsonFile":{"type":"string"},"queueMapDeclarationFile":{"type":"string"},"queueTypesFile":{"type":"string"},"workflowsWiringFile":{"type":"string"},"workflowsWiringMetaFile":{"type":"string"},"workflowsWorkersFile":{"type":"string"},"workflowMapDeclarationFile":{"type":"string"},"workflowTypesFile":{"type":"string"},"workflowMetaDir":{"type":"string"},"mcpWiringsFile":{"type":"string"},"mcpWiringsMetaFile":{"type":"string"},"mcpWiringsMetaJsonFile":{"type":"string"},"mcpTypesFile":{"type":"string"},"agentWiringsFile":{"type":"string"},"agentWiringMetaFile":{"type":"string"},"agentWiringMetaJsonFile":{"type":"string"},"agentTypesFile":{"type":"string"},"agentMapDeclarationFile":{"type":"string"},"cliWiringsFile":{"type":"string"},"cliWiringMetaFile":{"type":"string"},"cliWiringMetaJsonFile":{"type":"string"},"cliBootstrapFile":{"type":"string"},"cliTypesFile":{"type":"string"},"servicesFile":{"type":"string"},"middlewareFile":{"type":"string"},"middlewareGroupsMetaJsonFile":{"type":"string"},"permissionsFile":{"type":"string"},"permissionsGroupsMetaJsonFile":{"type":"string"},"bootstrapFile":{"type":"string"},"packageFile":{"type":"string"},"addonTypesFile":{"type":"string"},"nodeTypesFile":{"type":"string"},"secretTypesFile":{"type":"string"},"secretsFile":{"type":"string"},"secretsMetaJsonFile":{"type":"string"},"variableTypesFile":{"type":"string"},"variablesFile":{"type":"string"},"variablesMetaJsonFile":{"type":"string"},"$schema":{"type":"string"},"extends":{"type":"string"},"rootDir":{"type":"string"},"srcDirectories":{"type":"array","items":{"type":"string"}},"ignoreFiles":{"type":"array","items":{"type":"string"}},"packageMappings":{"type":"object","additionalProperties":{"type":"string"}},"addon":{"type":"boolean"},"addonName":{"type":"string"},"models":{"type":"object","additionalProperties":{"anyOf":[{"type":"string"},{"type":"object","properties":{"model":{"type":"string"},"temperature":{"type":"number"},"maxSteps":{"type":"number"}},"required":["model"],"additionalProperties":false}]}},"agentDefaults":{"type":"object","properties":{"temperature":{"type":"number"},"maxSteps":{"type":"number"}},"additionalProperties":false},"agentOverrides":{"type":"object","additionalProperties":{"type":"object","properties":{"model":{"type":"string"},"temperature":{"type":"number"},"maxSteps":{"type":"number"}},"additionalProperties":false}},"configFile":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"types":{"type":"array","items":{"type":"string"}},"userSessionType":{"type":"string"},"singletonServicesFactoryType":{"type":"string"},"wireServicesFactoryType":{"type":"string"},"configDir":{"type":"string"},"tsconfig":{"type":"string"},"nextBackendFile":{"type":"string"},"nextHTTPFile":{"type":"string"},"fetchFile":{"type":"string"},"websocketFile":{"type":"string"},"rpcWiringsFile":{"type":"string"},"queueWiringsFile":{"type":"string"},"mcpJsonFile":{"type":"string"},"openAPI":{"type":"object","properties":{"outputFile":{"type":"string"},"additionalInfo":{"$ref":"#/definitions/OpenAPISpecInfo"}},"required":["outputFile","additionalInfo"],"additionalProperties":false},"schema":{"type":"object","properties":{"additionalProperties":{"type":"boolean"},"supportsImportAttributes":{"type":"boolean"}},"additionalProperties":false},"cli":{"type":"object","properties":{"entrypoints":{"type":"object","additionalProperties":{"anyOf":[{"type":"string"},{"type":"object","properties":{"type":{"type":"string","const":"local"},"path":{"type":"string"}},"required":["type","path"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","const":"channel"},"name":{"type":"string"},"route":{"type":"string"},"wirePath":{"type":"string"},"path":{"type":"string"}},"required":["type","wirePath"],"additionalProperties":false},{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"object","properties":{"type":{"type":"string","const":"local"},"path":{"type":"string"}},"required":["type","path"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","const":"channel"},"name":{"type":"string"},"route":{"type":"string"},"wirePath":{"type":"string"},"path":{"type":"string"}},"required":["type","wirePath"],"additionalProperties":false}]}}]}}},"additionalProperties":false},"workflows":{"anyOf":[{"type":"object","properties":{"singleQueue":{"type":"boolean","const":true},"path":{"type":"string"},"orchestratorQueue":{"type":"string"},"workerQueue":{"type":"string"}},"required":["singleQueue","path"],"additionalProperties":false},{"type":"object","properties":{"singleQueue":{"type":"boolean","const":false},"dir":{"type":"string"},"orchestratorQueuePrefix":{"type":"string"},"workerQueuePrefix":{"type":"string"}},"required":["singleQueue","dir"],"additionalProperties":false}]},"rpc":{"type":"object","properties":{"remoteRpcWorkersPath":{"type":"string"},"publicRpcPath":{"type":"string"},"publicRpcRequireAuth":{"type":"boolean"}},"additionalProperties":false},"agent":{"type":"object","properties":{"publicAgentPath":{"type":"string"},"publicAgentRequireAuth":{"type":"boolean"}},"additionalProperties":false},"console":{"type":"object","properties":{"functionsPath":{"type":"string"}},"additionalProperties":false},"scaffold":{"type":"object","properties":{"addonDir":{"type":"string"},"functionDir":{"type":"string"},"wiringDir":{"type":"string"},"middlewareDir":{"type":"string"},"permissionDir":{"type":"string"}},"additionalProperties":false},"forceRequiredServices":{"type":"array","items":{"type":"string"}},"schemasFromTypes":{"type":"array","items":{"type":"string"}},"stateOutput":{"type":"string"},"stateInput":{"type":"string"},"verboseMeta":{"type":"boolean"},"lint":{"type":"object","properties":{"servicesNotDestructured":{"type":"string","enum":["off","warn","error"]},"wiresNotDestructured":{"type":"string","enum":["off","warn","error"]}},"additionalProperties":false},"node":{"type":"object","properties":{"categories":{"type":"array","items":{"type":"string"}},"icon":{"type":"string"},"displayName":{"type":"string"},"description":{"type":"string"}},"additionalProperties":false},"nodesMetaJsonFile":{"type":"string"},"filters":{"$ref":"#/definitions/InspectorFilters"}},"required":["addonTypesFile","agentMapDeclarationFile","agentTypesFile","agentWiringMetaFile","agentWiringMetaJsonFile","agentWiringsFile","bootstrapFile","channelsMapDeclarationFile","channelsTypesFile","channelsWiringFile","channelsWiringMetaFile","channelsWiringMetaJsonFile","cliBootstrapFile","cliTypesFile","cliWiringMetaFile","cliWiringMetaJsonFile","cliWiringsFile","configDir","filters","functionTypesFile","functionsFile","functionsMetaFile","functionsMetaJsonFile","httpMapDeclarationFile","httpTypesFile","httpWiringMetaFile","httpWiringMetaJsonFile","httpWiringsFile","mcpTypesFile","mcpWiringsFile","mcpWiringsMetaFile","mcpWiringsMetaJsonFile","middlewareFile","middlewareGroupsMetaJsonFile","nodeTypesFile","outDir","packageFile","packageMappings","permissionsFile","permissionsGroupsMetaJsonFile","queueMapDeclarationFile","queueTypesFile","queueWorkersWiringFile","queueWorkersWiringMetaFile","queueWorkersWiringMetaJsonFile","rootDir","rpcInternalMapDeclarationFile","rpcInternalWiringMetaFile","rpcInternalWiringMetaJsonFile","rpcMapDeclarationFile","schedulersTypesFile","schedulersWiringFile","schedulersWiringMetaFile","schedulersWiringMetaJsonFile","schemaDirectory","secretTypesFile","secretsFile","secretsMetaJsonFile","servicesFile","srcDirectories","triggerSourcesMetaFile","triggerSourcesMetaJsonFile","triggersTypesFile","triggersWiringFile","triggersWiringMetaFile","triggersWiringMetaJsonFile","tsconfig","typesDeclarationFile","variableTypesFile","variablesFile","variablesMetaJsonFile","workflowMapDeclarationFile","workflowMetaDir","workflowTypesFile","workflowsWiringFile","workflowsWiringMetaFile","workflowsWorkersFile"],"definitions":{"OpenAPISpecInfo":{"type":"object","properties":{"info":{"type":"object","properties":{"title":{"type":"string"},"version":{"type":"string"},"description":{"type":"string"},"termsOfService":{"type":"string"},"contact":{"type":"object","properties":{"name":{"type":"string"},"url":{"type":"string"},"email":{"type":"string"}},"additionalProperties":false},"license":{"type":"object","properties":{"name":{"type":"string"},"url":{"type":"string"}},"required":["name"],"additionalProperties":false}},"required":["title","version","description"],"additionalProperties":false},"servers":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string"},"description":{"type":"string"}},"required":["url"],"additionalProperties":false}},"tags":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string"}},"required":["name"],"additionalProperties":false}},"externalDocs":{"type":"object","properties":{"description":{"type":"string"},"url":{"type":"string"}},"required":["url"],"additionalProperties":false},"securitySchemes":{"type":"object"},"security":{"type":"array","items":{"type":"object","additionalProperties":{"type":"array","items":{}}}}},"required":["info","servers"],"additionalProperties":false},"InspectorFilters":{"type":"object","properties":{"names":{"type":"array","items":{"type":"string"}},"tags":{"type":"array","items":{"type":"string"}},"types":{"type":"array","items":{"type":"string"}},"directories":{"type":"array","items":{"type":"string"}},"httpRoutes":{"type":"array","items":{"type":"string"}},"httpMethods":{"type":"array","items":{"type":"string"}}},"additionalProperties":false}}}
1
+ {"$schema":"http://json-schema.org/draft-07/schema#","type":"object","additionalProperties":false,"properties":{"outDir":{"type":"string"},"schemaDirectory":{"type":"string"},"typesDeclarationFile":{"type":"string"},"functionsFile":{"type":"string"},"functionsMetaFile":{"type":"string"},"functionsMetaJsonFile":{"type":"string"},"functionTypesFile":{"type":"string"},"httpWiringsFile":{"type":"string"},"httpWiringMetaFile":{"type":"string"},"httpWiringMetaJsonFile":{"type":"string"},"httpMapDeclarationFile":{"type":"string"},"httpTypesFile":{"type":"string"},"gatewaysWiringFile":{"type":"string"},"channelsWiringFile":{"type":"string"},"channelsWiringMetaFile":{"type":"string"},"channelsWiringMetaJsonFile":{"type":"string"},"channelsMapDeclarationFile":{"type":"string"},"channelsTypesFile":{"type":"string"},"rpcInternalWiringMetaFile":{"type":"string"},"rpcInternalWiringMetaJsonFile":{"type":"string"},"rpcInternalMapDeclarationFile":{"type":"string"},"rpcMapDeclarationFile":{"type":"string"},"remoteRpcWorkersFile":{"type":"string"},"publicRpcFile":{"type":"string"},"publicAgentFile":{"type":"string"},"consoleFunctionsFile":{"type":"string"},"workflowWorkersFile":{"type":"string"},"triggersTypesFile":{"type":"string"},"triggersWiringFile":{"type":"string"},"triggersWiringMetaFile":{"type":"string"},"triggersWiringMetaJsonFile":{"type":"string"},"triggerSourcesMetaFile":{"type":"string"},"triggerSourcesMetaJsonFile":{"type":"string"},"schedulersWiringFile":{"type":"string"},"schedulersWiringMetaFile":{"type":"string"},"schedulersWiringMetaJsonFile":{"type":"string"},"schedulersTypesFile":{"type":"string"},"queueWorkersWiringFile":{"type":"string"},"queueWorkersWiringMetaFile":{"type":"string"},"queueWorkersWiringMetaJsonFile":{"type":"string"},"queueMapDeclarationFile":{"type":"string"},"queueTypesFile":{"type":"string"},"workflowsWiringFile":{"type":"string"},"workflowsWiringMetaFile":{"type":"string"},"workflowsWorkersFile":{"type":"string"},"workflowMapDeclarationFile":{"type":"string"},"workflowTypesFile":{"type":"string"},"workflowMetaDir":{"type":"string"},"mcpWiringsFile":{"type":"string"},"mcpWiringsMetaFile":{"type":"string"},"mcpWiringsMetaJsonFile":{"type":"string"},"mcpTypesFile":{"type":"string"},"agentWiringsFile":{"type":"string"},"agentWiringMetaFile":{"type":"string"},"agentWiringMetaJsonFile":{"type":"string"},"agentTypesFile":{"type":"string"},"agentMapDeclarationFile":{"type":"string"},"cliWiringsFile":{"type":"string"},"cliWiringMetaFile":{"type":"string"},"cliWiringMetaJsonFile":{"type":"string"},"cliBootstrapFile":{"type":"string"},"cliTypesFile":{"type":"string"},"servicesFile":{"type":"string"},"middlewareFile":{"type":"string"},"middlewareGroupsMetaJsonFile":{"type":"string"},"permissionsFile":{"type":"string"},"permissionsGroupsMetaJsonFile":{"type":"string"},"bootstrapFile":{"type":"string"},"packageFile":{"type":"string"},"addonTypesFile":{"type":"string"},"nodeTypesFile":{"type":"string"},"secretTypesFile":{"type":"string"},"secretsFile":{"type":"string"},"secretsMetaJsonFile":{"type":"string"},"variableTypesFile":{"type":"string"},"variablesFile":{"type":"string"},"variablesMetaJsonFile":{"type":"string"},"$schema":{"type":"string"},"extends":{"type":"string"},"rootDir":{"type":"string"},"srcDirectories":{"type":"array","items":{"type":"string"}},"ignoreFiles":{"type":"array","items":{"type":"string"}},"packageMappings":{"type":"object","additionalProperties":{"type":"string"}},"addon":{"type":"boolean"},"addonName":{"type":"string"},"models":{"type":"object","additionalProperties":{"anyOf":[{"type":"string"},{"type":"object","properties":{"model":{"type":"string"},"temperature":{"type":"number"},"maxSteps":{"type":"number"}},"required":["model"],"additionalProperties":false}]}},"agentDefaults":{"type":"object","properties":{"temperature":{"type":"number"},"maxSteps":{"type":"number"}},"additionalProperties":false},"agentOverrides":{"type":"object","additionalProperties":{"type":"object","properties":{"model":{"type":"string"},"temperature":{"type":"number"},"maxSteps":{"type":"number"}},"additionalProperties":false}},"configFile":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"types":{"type":"array","items":{"type":"string"}},"userSessionType":{"type":"string"},"singletonServicesFactoryType":{"type":"string"},"wireServicesFactoryType":{"type":"string"},"configDir":{"type":"string"},"tsconfig":{"type":"string"},"clientFiles":{"type":"object","properties":{"fetchFile":{"type":"string"},"websocketFile":{"type":"string"},"rpcWiringsFile":{"type":"string"},"queueWiringsFile":{"type":"string"},"mcpJsonFile":{"type":"string"},"nextBackendFile":{"type":"string"},"nextHTTPFile":{"type":"string"}},"additionalProperties":false},"openAPI":{"type":"object","properties":{"outputFile":{"type":"string"},"additionalInfo":{"$ref":"#/definitions/OpenAPISpecInfo"}},"required":["outputFile","additionalInfo"],"additionalProperties":false},"schema":{"type":"object","properties":{"additionalProperties":{"type":"boolean"},"supportsImportAttributes":{"type":"boolean"}},"additionalProperties":false},"cli":{"type":"object","properties":{"entrypoints":{"type":"object","additionalProperties":{"anyOf":[{"type":"string"},{"type":"object","properties":{"type":{"type":"string","const":"local"},"path":{"type":"string"}},"required":["type","path"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","const":"channel"},"name":{"type":"string"},"route":{"type":"string"},"wirePath":{"type":"string"},"path":{"type":"string"}},"required":["type","wirePath"],"additionalProperties":false},{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"object","properties":{"type":{"type":"string","const":"local"},"path":{"type":"string"}},"required":["type","path"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","const":"channel"},"name":{"type":"string"},"route":{"type":"string"},"wirePath":{"type":"string"},"path":{"type":"string"}},"required":["type","wirePath"],"additionalProperties":false}]}}]}}},"additionalProperties":false},"workflows":{"type":"object","properties":{"orchestratorQueue":{"type":"string"},"workerQueue":{"type":"string"}},"additionalProperties":false},"scaffold":{"type":"object","properties":{"addonDir":{"type":"string"},"functionDir":{"type":"string"},"wiringDir":{"type":"string"},"middlewareDir":{"type":"string"},"permissionDir":{"type":"string"},"pikkuDir":{"type":"string"},"rpc":{"$ref":"#/definitions/PikkuScaffoldFeature"},"console":{"$ref":"#/definitions/PikkuScaffoldFeature"},"agent":{"$ref":"#/definitions/PikkuScaffoldFeature"},"workflow":{"$ref":"#/definitions/PikkuScaffoldFeature"}},"additionalProperties":false},"forceRequiredServices":{"type":"array","items":{"type":"string"}},"schemasFromTypes":{"type":"array","items":{"type":"string"}},"stateOutput":{"type":"string"},"stateInput":{"type":"string"},"verboseMeta":{"type":"boolean"},"lint":{"type":"object","properties":{"servicesNotDestructured":{"type":"string","enum":["off","warn","error"]},"wiresNotDestructured":{"type":"string","enum":["off","warn","error"]}},"additionalProperties":false},"node":{"type":"object","properties":{"categories":{"type":"array","items":{"type":"string"}},"icon":{"type":"string"},"displayName":{"type":"string"},"description":{"type":"string"}},"additionalProperties":false},"nodesMetaJsonFile":{"type":"string"},"filters":{"$ref":"#/definitions/InspectorFilters"}},"required":["addonTypesFile","agentMapDeclarationFile","agentTypesFile","agentWiringMetaFile","agentWiringMetaJsonFile","agentWiringsFile","bootstrapFile","channelsMapDeclarationFile","channelsTypesFile","channelsWiringFile","channelsWiringMetaFile","channelsWiringMetaJsonFile","cliBootstrapFile","cliTypesFile","cliWiringMetaFile","cliWiringMetaJsonFile","cliWiringsFile","configDir","consoleFunctionsFile","filters","functionTypesFile","functionsFile","functionsMetaFile","functionsMetaJsonFile","gatewaysWiringFile","httpMapDeclarationFile","httpTypesFile","httpWiringMetaFile","httpWiringMetaJsonFile","httpWiringsFile","mcpTypesFile","mcpWiringsFile","mcpWiringsMetaFile","mcpWiringsMetaJsonFile","middlewareFile","middlewareGroupsMetaJsonFile","nodeTypesFile","outDir","packageFile","packageMappings","permissionsFile","permissionsGroupsMetaJsonFile","publicAgentFile","publicRpcFile","queueMapDeclarationFile","queueTypesFile","queueWorkersWiringFile","queueWorkersWiringMetaFile","queueWorkersWiringMetaJsonFile","remoteRpcWorkersFile","rootDir","rpcInternalMapDeclarationFile","rpcInternalWiringMetaFile","rpcInternalWiringMetaJsonFile","rpcMapDeclarationFile","schedulersTypesFile","schedulersWiringFile","schedulersWiringMetaFile","schedulersWiringMetaJsonFile","schemaDirectory","secretTypesFile","secretsFile","secretsMetaJsonFile","servicesFile","srcDirectories","triggerSourcesMetaFile","triggerSourcesMetaJsonFile","triggersTypesFile","triggersWiringFile","triggersWiringMetaFile","triggersWiringMetaJsonFile","tsconfig","typesDeclarationFile","variableTypesFile","variablesFile","variablesMetaJsonFile","workflowMapDeclarationFile","workflowMetaDir","workflowTypesFile","workflowWorkersFile","workflowsWiringFile","workflowsWiringMetaFile","workflowsWorkersFile"],"definitions":{"OpenAPISpecInfo":{"type":"object","properties":{"info":{"type":"object","properties":{"title":{"type":"string"},"version":{"type":"string"},"description":{"type":"string"},"termsOfService":{"type":"string"},"contact":{"type":"object","properties":{"name":{"type":"string"},"url":{"type":"string"},"email":{"type":"string"}},"additionalProperties":false},"license":{"type":"object","properties":{"name":{"type":"string"},"url":{"type":"string"}},"required":["name"],"additionalProperties":false}},"required":["title","version","description"],"additionalProperties":false},"servers":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string"},"description":{"type":"string"}},"required":["url"],"additionalProperties":false}},"tags":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string"}},"required":["name"],"additionalProperties":false}},"externalDocs":{"type":"object","properties":{"description":{"type":"string"},"url":{"type":"string"}},"required":["url"],"additionalProperties":false},"securitySchemes":{"type":"object"},"security":{"type":"array","items":{"type":"object","additionalProperties":{"type":"array","items":{}}}}},"required":["info","servers"],"additionalProperties":false},"PikkuScaffoldFeature":{"type":["string","boolean"],"enum":["auth","no-auth",false]},"InspectorFilters":{"type":"object","properties":{"names":{"type":"array","items":{"type":"string"}},"tags":{"type":"array","items":{"type":"string"}},"types":{"type":"array","items":{"type":"string"}},"directories":{"type":"array","items":{"type":"string"}},"httpRoutes":{"type":"array","items":{"type":"string"}},"httpMethods":{"type":"array","items":{"type":"string"}}},"additionalProperties":false}}}
@@ -632,7 +632,7 @@ Consider installing the package or pass your own 'workerFactory' to ELK's constr
632
632
  ... Falling back to non-web worker version.`);if(!U.workerFactory){var Y=o("./elk-worker.min.js"),Z=Y.Worker;U.workerFactory=function(oe){return new Z(oe)}}return w(this,F,[U])}return A(F,D),h(F)})(I);Object.defineProperty(a.exports,"__esModule",{value:!0}),a.exports=N,N.default=N},{"./elk-api.js":1,"./elk-worker.min.js":2,"web-worker":4}],4:[function(o,a,f){var g=typeof Worker<"u"?Worker:void 0;a.exports=g},{}]},{},[3])(3)})})(xLe)),xLe.exports}var $rr=Prr();const Drr=qg($rr),Lrr=new Drr,Frr={"elk.algorithm":"layered","elk.direction":"RIGHT","elk.spacing.nodeNode":"80","elk.layered.spacing.nodeNodeBetweenLayers":"120","elk.layered.spacing.edgeNodeBetweenLayers":"40","elk.spacing.edgeNode":"40","elk.spacing.edgeEdge":"20","elk.layered.nodePlacement.strategy":"NETWORK_SIMPLEX","elk.layered.crossingMinimization.strategy":"LAYER_SWEEP","elk.layered.considerModelOrder.strategy":"NODES_AND_EDGES","elk.layered.mergeEdges":"false","elk.edgeRouting":"ORTHOGONAL"};function zrr(r,i){const[o,a]=G.useState({nodes:[],edges:[]}),[f,g]=G.useState(!1),h=G.useMemo(()=>r.map(w=>w.id).join(","),[r]),b=G.useMemo(()=>i.map(w=>w.id).join(","),[i]);return G.useEffect(()=>{(async()=>{var k;if(r.length===0||f)return;g(!0);const x={id:"root",layoutOptions:Frr,children:r.map(E=>{var N,D,F,B,U,q,J,Y,Z;const T=(N=E.data)==null?void 0:N.nodeType;let A=E.width||200,M=E.height||100;if(T==="flow")A=80;else if(T==="channelEntry")A=220,M=55+((((F=(D=E.data)==null?void 0:D.handlers)==null?void 0:F.length)||0)+(((U=(B=E.data)==null?void 0:B.categories)==null?void 0:U.length)||0))*30;else if(T==="channelRouter")A=200,M=40+(((J=(q=E.data)==null?void 0:q.actions)==null?void 0:J.length)||0)*28;else if(T==="wiring")if(E.type==="channelWiringNode"){A=180;let oe=3;(Y=E.data)!=null&&Y.onMessageRoute&&(oe+=Object.keys(E.data.onMessageRoute).length),M=40+oe*28}else A=80;else(T==="rpc"||E.type==="functionNode")&&(A=80);const I={id:E.id,width:A,height:M};return((Z=E.data)==null?void 0:Z.order)!==void 0&&(I.properties={"org.eclipse.elk.priority":E.data.order}),I}),edges:i.map(E=>({id:E.id,sources:[E.source],targets:[E.target]}))};try{const E=await Lrr.layout(x),A=75-Math.min(...((k=E.children)==null?void 0:k.map(D=>D.y||0))||[0]),M=r.map(D=>{var B;const F=(B=E.children)==null?void 0:B.find(U=>U.id===D.id);return F?{...D,position:{x:F.x??D.position.x,y:(F.y??0)+A}}:D}),I=new Map;if(E.edges)for(const D of E.edges){const F=D.sections;if(F&&F.length>0){const B=[];for(const U of F)if(U.bendPoints)for(const q of U.bendPoints)B.push({x:q.x,y:(q.y??0)+A});B.length>0&&I.set(D.id,B)}}const N=i.map(D=>{const F=I.get(D.id);return F?{...D,type:"elk",data:{...D.data,bendPoints:F}}:{...D,type:"elk"}});a({nodes:M,edges:N})}catch{a({nodes:r,edges:i})}finally{g(!1)}})()},[h,b]),o.nodes.length>0?o:{nodes:r,edges:i}}const oNt=({side:r,onExpand:i})=>{const o=r==="left"?Szt:ANn;return S.jsx(Ue,{style:{width:36,height:"100%",display:"flex",alignItems:"center",justifyContent:"center",borderRight:r==="left"?"1px solid var(--mantine-color-default-border)":void 0,borderLeft:r==="right"?"1px solid var(--mantine-color-default-border)":void 0,background:"var(--mantine-color-body)",flexShrink:0},children:S.jsx(HS,{label:"Expand",position:r==="left"?"right":"left",children:S.jsx(im,{variant:"subtle",size:"sm",color:"gray",onClick:i,children:S.jsx(o,{size:16})})})})},Nqt=({children:r,header:i,runsPanel:o,runsPanelVisible:a=!0,emptyPanelMessage:f,showTabs:g=!1,hidePanel:h=!1})=>{const{panels:b}=Bo(),w=!g,[x,k]=G.useState(!1),[E,T]=G.useState(!1),A=G.useRef(a);G.useEffect(()=>{!A.current&&a&&k(!1),A.current=a},[a]);const M=!!o&&a,I=M&&!x,N=!h&&(w||b.size!==0),D=N&&!E,F=G.useCallback((B,U)=>{M&&B===0&&k(!U),N&&B===(M?2:1)&&T(!U)},[M,N]);return S.jsxs(Ue,{style:{display:"flex",flexDirection:"column",height:"100vh"},children:[i,S.jsxs(Ue,{style:{flex:1,minHeight:0,display:"flex",flexDirection:"row"},children:[M&&x&&S.jsx(oNt,{side:"left",onExpand:()=>k(!1)}),S.jsx(Ue,{style:{flex:1,minWidth:0,height:"100%"},children:S.jsxs(dR,{defaultSizes:M&&N?[220,640,400]:M?[220,840]:N?[840,400]:void 0,onVisibleChange:F,children:[M&&S.jsx(dR.Pane,{visible:I,snap:!0,minSize:180,preferredSize:220,maxSize:300,children:S.jsx(Ue,{style:{height:"100%",overflow:"auto",borderRight:"1px solid var(--mantine-color-default-border)"},children:o})}),S.jsx(dR.Pane,{children:S.jsx(Ue,{style:{height:"100%",overflow:"auto"},children:r})}),N&&S.jsx(dR.Pane,{visible:D,snap:!0,minSize:200,preferredSize:400,children:S.jsx(Ue,{style:{height:"100%",overflow:"auto"},children:S.jsx(uUt,{showTabs:g,emptyMessage:f})})})]},`${M}-${N}`)}),N&&E&&S.jsx(oNt,{side:"right",onExpand:()=>T(!1)})]})]})},Brr=({id:r,sourceX:i,sourceY:o,targetX:a,targetY:f,data:g,label:h,labelStyle:b,labelBgStyle:w,style:x,markerEnd:k})=>{var D,F;const E=(g==null?void 0:g.bendPoints)||[],T=[{x:i,y:o},...E,{x:a,y:f}],A=T.map((B,U)=>`${U===0?"M":"L"} ${B.x} ${B.y}`).join(" "),M=Math.floor(T.length/2),I=((D=T[M])==null?void 0:D.x)??(i+a)/2,N=((F=T[M])==null?void 0:F.y)??(o+f)/2;return S.jsxs(S.Fragment,{children:[S.jsx(MH,{id:r,path:A,style:x,markerEnd:k}),h&&S.jsx(mnr,{children:S.jsx("div",{style:{position:"absolute",transform:`translate(-50%, -50%) translate(${I}px, ${N}px)`,pointerEvents:"all",fontSize:10,fontFamily:"monospace",color:"#666",backgroundColor:"rgba(255, 255, 255, 0.8)",padding:"1px 4px",borderRadius:3,...b},children:h})})]})},Hrr={http:"http",queue:"queue",scheduler:"schedule",trigger:"trigger",cli:"cli"},Urr={http:r=>{var i;return`${((i=r.method)==null?void 0:i.toLowerCase())||"get"}:${r.route||""}`},queue:r=>r.name,schedule:r=>r.cron||r.interval,trigger:r=>r.name,cli:r=>r.command};function qrr(r,i){const o=Hrr[i.type];if(!o)return{};if(o==="mcp"||i.type==="mcp"){if(!r.mcp||!i.id)return{mcp:r.mcp};const[g,...h]=i.id.split(":"),b=h.join(":"),w={};return r.mcp[g]&&(w[g]=r.mcp[g].filter(x=>(x.name||x.uri)===b)),{mcp:w}}const a=r[o];if(!a)return{};if(!i.id)return{[o]:a};const f=Urr[o];return f?{[o]:a.filter(g=>f(g)===i.id)}:{[o]:a}}const Grr={functionNode:srr,wiringNode:Wnr,channelNode:orr,decisionNode:crr,sleepNode:arr,inlineNode:lrr,genericNode:Irr,branchNode:frr,fanoutNode:drr,returnNode:grr,cancelNode:brr,switchNode:yrr,arrayPredicateNode:xrr,filterNode:krr,parallelNode:Err,channelWiringNode:_rr,setNode:Arr},Vrr={elk:Brr},Jrr=({workflow:r,onPaneClick:i})=>{const{fitView:o}=zqe(),{nodes:a,edges:f}=G.useMemo(()=>Nrr(r),[r]),g=zrr(a,f),[h,b]=bnr([]),[w,x]=wnr([]);return G.useEffect(()=>{g.nodes.length>0&&(b(g.nodes),x(g.edges),setTimeout(()=>{o({padding:.2})},50))},[g,b,x,o]),S.jsxs(Ue,{style:{width:"100%",height:"100%"},children:[S.jsx("style",{children:`
633
633
  .react-flow__handle { opacity: 0; pointer-events: none; }
634
634
  @keyframes pulse-border { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
635
- `}),S.jsx(_qt,{nodes:h,edges:w,nodeTypes:Grr,edgeTypes:Vrr,defaultEdgeOptions:{style:{stroke:"#c0c0c0",strokeWidth:1.5,strokeDasharray:"6 4"},animated:!0,markerEnd:{type:Rte.ArrowClosed,color:"#c0c0c0",width:16,height:16}},zoomOnScroll:!0,preventScrolling:!1,nodesConnectable:!1,nodesDraggable:!0,proOptions:{hideAttribution:!0},noDragClassName:"nodrag",onPaneClick:i,children:S.jsx(jnr,{color:"#ccc",variant:f2.Dots,size:2})})]})},Krr=r=>S.jsx(Hqe,{children:S.jsx(Jrr,{...r})}),Wrr=({workflowName:r})=>{const{selectedRunId:i,setSelectedRunId:o,setIsCreatingRun:a}=wWn(),{setActivePanel:f}=Bo(),g=Nu(),{data:h,isLoading:b,refetch:w}=hWn(r),x=G.useMemo(()=>!h||!Array.isArray(h)?[]:h,[h]),k=G.useCallback(async T=>{await g.invoke("console:deleteWorkflowRun",{runId:T}),i===T&&o(null),w()},[g,i,o,w]),E=G.useCallback(()=>{o(null),a(!0),f(`workflow-${r}`)},[o,a,f,r]);return S.jsx(Oqt,{title:"Runs",runs:x,selectedId:i,onSelect:o,onClear:()=>o(null),loading:b,emptyMessage:"No runs found",statusFilters:[],onNewClick:E,newButtonLabel:"New workflow run",onDelete:k})},Yrr=({workflow:r,items:i,onItemSelect:o})=>{var q;const{canvasDrawer:a,closeCanvasDrawer:f}=Enr(),{panels:g,activePanel:h,openWorkflow:b,setActivePanel:w}=Bo(),{setFocusedNode:x}=DE(),k=r.name||r.wireId||"Workflow",E=`workflow-${k}`,T=G.useCallback(()=>{w(E)},[w,E]);G.useEffect(()=>{b(k,r)},[]),G.useEffect(()=>{if(!h){x(null);return}const J=g.get(h);(J==null?void 0:J.data.type)==="workflowStep"?x(J.data.id):x(null)},[h,g,x]);const A=G.useMemo(()=>a?znr(a.data):null,[a]),I=(r.source||"graph")==="complex",N=ly(),D=S.jsxs(S.Fragment,{children:[S.jsx(Ch,{icon:_8,category:"Workflows",docsHref:"https://pikku.dev/docs/wiring/workflows",categoryPath:"/workflow",currentItem:k,items:i,onItemSelect:o,subtitle:r.source?S.jsx(kn,{type:"dynamic",badge:"source",value:r.source}):void 0}),I&&S.jsx(zg,{icon:S.jsx(YS,{size:16}),color:"yellow",radius:0,py:"xs",styles:{root:{borderBottom:"1px solid var(--mantine-color-default-border)"}},children:S.jsxs(jn,{justify:"space-between",align:"center",children:[S.jsx(Qe,{size:"sm",children:"This is a complex workflow. The visual representation may not be accurate."}),S.jsx(Qe,{size:"sm",c:"yellow.7",style:{cursor:"pointer",textDecoration:"underline"},children:"Learn more"})]})}),(N==null?void 0:N.isVersionMismatch)&&S.jsx(zg,{icon:S.jsx(iNn,{size:16}),color:"orange",radius:0,py:"xs",styles:{root:{borderBottom:"1px solid var(--mantine-color-default-border)"}},children:S.jsx(Qe,{size:"sm",children:"Viewing historical version — workflow definition has changed since this run"})})]}),F=N!=null&&N.isVersionMismatch&&(N!=null&&N.historicalWorkflow)?{...r,...N.historicalWorkflow}:r,B=G.useMemo(()=>{var Y;const J=(Y=N==null?void 0:N.runData)==null?void 0:Y.wire;return!J||!F.wires?F:{...F,wires:qrr(F.wires,J)}},[F,(q=N==null?void 0:N.runData)==null?void 0:q.wire]),U=N?S.jsx(Wrr,{workflowName:k}):void 0;return S.jsxs(S.Fragment,{children:[S.jsx(Nqt,{header:D,showTabs:!1,emptyPanelMessage:"Select a node to view its details",runsPanel:U,children:S.jsx(Ue,{style:{height:"100%",position:"relative"},children:S.jsx(Krr,{workflow:B,onPaneClick:T})})}),a&&S.jsx(Ue,{style:{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:98},onClick:f}),S.jsx(d3,{opened:a!==null,onClose:f,position:"right",size:"md",withOverlay:!1,withinPortal:!1,closeOnClickOutside:!1,withCloseButton:!1,styles:{inner:{top:"50px",zIndex:99},content:{height:"100%"},header:{display:"none"},body:{padding:0}},children:A})]})},Xrr=r=>S.jsx(xWn,{workflow:r.workflow,children:S.jsx(Cnr,{children:S.jsx(Yrr,{...r})})}),Qrr=()=>{const[r]=l3(),i=ay(),o=r.get("id")||"",a=Nu(),{data:f,isLoading:g}=k1({queryKey:["workflow-meta-by-id",o],queryFn:()=>a.invoke("console:getWorkflowMetaById",{workflowId:o}),enabled:!!o}),{meta:h}=mu(),b=G.useMemo(()=>h.workflows?Object.entries(h.workflows).map(([w,x])=>({name:w,description:x.steps?`${x.steps.length} steps`:void 0})):[],[h.workflows]);return g?S.jsx(Eh,{h:"100vh",children:S.jsx(Ea,{})}):f?S.jsx(Bd,{children:S.jsx(vWn,{workflowName:o,currentGraphHash:f.graphHash,workflowNodes:f.nodes,children:S.jsx(Ue,{h:"100vh",style:{display:"flex",flexDirection:"column"},children:S.jsx(Ue,{style:{flex:1,overflow:"auto"},children:S.jsx(Xrr,{workflow:f,items:b,onItemSelect:w=>i(`/workflow?id=${encodeURIComponent(w)}`)})})})})}):S.jsx(Eh,{h:"100vh",children:S.jsxs(Qe,{c:"dimmed",children:['Workflow "',o,'" not found.']})})};function Zrr(){const[r]=l3(),i=r.get("id"),{meta:o,loading:a}=mu();return i?S.jsx(Qrr,{}):a?S.jsx(Eh,{h:"100vh",children:S.jsx(Ea,{})}):S.jsx(Bd,{children:S.jsx(zd,{header:S.jsx(Ch,{icon:_8,category:"Workflows",docsHref:"https://pikku.dev/docs/wiring/workflows"}),hidePanel:!0,children:S.jsx(OYn,{workflows:o.workflows||{}})})})}const eir=()=>S.jsx(G.Suspense,{fallback:S.jsx(Eh,{h:"100vh",children:S.jsx(Ea,{})}),children:S.jsx(Zrr,{})}),tir=({routes:r,loading:i})=>{const{openHTTPWire:o}=Bo(),a=G.useMemo(()=>[{key:"route",header:"ROUTE",render:f=>S.jsxs(S.Fragment,{children:[S.jsx(Qe,{fw:500,truncate:!0,children:f.route}),S.jsx(Qe,{size:"xs",c:"dimmed",truncate:!0,children:f.pikkuFuncId})]})},{key:"method",header:"METHOD",align:"right",render:f=>{var h;const g=((h=f.method)==null?void 0:h.toUpperCase())||"GET";return S.jsx(kn,{type:"httpMethod",value:g})}}],[]);return S.jsx(Vg,{title:"HTTP Routes",icon:ej,docsHref:"https://pikku.dev/docs/wiring/http",data:r,columns:a,getKey:f=>`${f.method}::${f.route}`,onRowClick:f=>o(`http::${f.method}::${f.route}`,f),searchPlaceholder:"Search HTTP routes...",searchFilter:(f,g)=>{var h,b,w;return((h=f.route)==null?void 0:h.toLowerCase().includes(g))||((b=f.pikkuFuncId)==null?void 0:b.toLowerCase().includes(g))||((w=f.method)==null?void 0:w.toLowerCase().includes(g))},emptyMessage:"No HTTP routes found.",loading:i,description:S.jsxs(Vn,{gap:2,children:[S.jsx(Qe,{size:"sm",fw:500,children:"See every route at a glance"}),S.jsx(Qe,{size:"xs",c:"dimmed",children:"Pikku prints your full route table at startup. Every method, route, function, and flag — visible in one place."})]})})},nir=()=>{const{meta:r,loading:i}=mu(),o=G.useMemo(()=>r.httpMeta?[...r.httpMeta].sort((a,f)=>a.route.localeCompare(f.route)):[],[r.httpMeta]);return S.jsx(Bd,{children:S.jsx(zd,{header:S.jsx(Ch,{icon:ej,category:"HTTP Routes",docsHref:"https://pikku.dev/docs/wiring/http"}),showTabs:!1,hidePanel:!i&&o.length===0,emptyPanelMessage:"Select a route to view its details",children:S.jsx(tir,{routes:o,loading:i})})})},cNt=["connect","disconnect","message"],rir=({channel:r,selected:i,onSelect:o})=>{const[a,f]=G.useState(""),g=G.useMemo(()=>Object.entries(r.messageWirings||{}),[r.messageWirings]),h=a.toLowerCase(),b=G.useMemo(()=>h?cNt.filter(A=>A.toLowerCase().includes(h)):cNt,[h]),w=G.useMemo(()=>h?g.map(([A,M])=>{if(A.toLowerCase().includes(h))return[A,M];const N=Object.entries(M).filter(([D])=>D.toLowerCase().includes(h));return N.length===0?null:[A,Object.fromEntries(N)]}).filter(Boolean):g,[g,h]),x=A=>(i==null?void 0:i.type)==="handler"&&i.handler===A,k=(A,M)=>(i==null?void 0:i.type)==="action"&&i.category===A&&i.action===M,E=A=>(i==null?void 0:i.type)==="action"&&i.category===A,T=b.length>0||w.length>0;return S.jsxs(Vn,{gap:0,style:{height:"100%"},children:[S.jsx(Ue,{px:"sm",py:"xs",style:{borderBottom:"1px solid var(--mantine-color-default-border)"},children:S.jsx(IE,{placeholder:"Search handlers...",leftSection:S.jsx(une,{size:14}),size:"xs",value:a,onChange:A=>f(A.target.value)})}),S.jsxs(Tb,{style:{flex:1},px:"xs",py:"xs",children:[b.map(A=>{const M=r[A]!=null;return S.jsx(WS,{label:S.jsx(Qe,{size:"sm",fw:x(A)?600:400,c:M?void 0:"dimmed",children:A}),active:x(A),disabled:!M,onClick:()=>M&&o({type:"handler",handler:A}),styles:{root:{borderRadius:4}}},A)}),w.length>0&&S.jsx(WS,{label:S.jsx(Qe,{size:"sm",fw:600,children:"Message Wirings"}),defaultOpened:!0,styles:{root:{borderRadius:4}},children:w.map(([A,M])=>S.jsx(WS,{label:S.jsx(Qe,{size:"sm",fw:600,children:A}),defaultOpened:!0,opened:E(A)||void 0,styles:{root:{borderRadius:4}},children:Object.keys(M).map(I=>S.jsx(WS,{label:S.jsx(Qe,{size:"sm",fw:k(A,I)?600:400,children:I}),active:k(A,I),onClick:()=>o({type:"action",category:A,action:I}),styles:{root:{borderRadius:4}}},I))},A))}),a&&!T&&S.jsxs(Qe,{size:"sm",c:"dimmed",ta:"center",py:"md",children:["No results match “",a,"”"]})]})]})},iir=(r,i)=>{var o,a;return r?i?i.type==="handler"?r.handlers[i.handler]||null:((a=(o=r.actions)==null?void 0:o[i.category])==null?void 0:a[i.action])||null:r.overview||null:null},sir=({channelName:r,channel:i})=>S.jsxs(Vn,{gap:"sm",children:[S.jsx(Qe,{size:"lg",fw:600,children:r}),S.jsx(kn,{type:"dynamic",badge:"route",value:i.route}),S.jsx(lm,{description:i.description,middleware:i.middleware,permissions:i.permissions,tags:i.tags})]}),oir=({handler:r,channel:i})=>{const o=i[r];return o?S.jsxs(Vn,{gap:"sm",children:[S.jsx(Qe,{size:"lg",fw:600,children:r}),S.jsx(i3,{}),S.jsx(_R,{pikkuFuncId:o.pikkuFuncId}),S.jsx(lm,{middleware:o.middleware,permissions:o.permissions,tags:o.tags})]}):null},cir=({category:r,action:i,channel:o})=>{var f,g;const a=(g=(f=o.messageWirings)==null?void 0:f[r])==null?void 0:g[i];return a?S.jsxs(Vn,{gap:"sm",children:[S.jsxs(jn,{gap:"xs",children:[S.jsx(Qe,{size:"sm",c:"dimmed",children:r}),S.jsx(Qe,{size:"sm",c:"dimmed",children:"/"}),S.jsx(Qe,{size:"lg",fw:600,children:i})]}),S.jsx(i3,{}),S.jsx(_R,{pikkuFuncId:a.pikkuFuncId}),S.jsx(lm,{middleware:a.middleware,permissions:a.permissions,tags:a.tags})]}):null},air=({channelName:r,channel:i,selected:o})=>{const{data:a}=SWn(r),f=G.useMemo(()=>iir(a,o),[a,o]);return S.jsxs(Vn,{gap:"md",p:"md",style:{height:"100%",overflow:"auto"},children:[!o&&S.jsx(sir,{channelName:r,channel:i}),(o==null?void 0:o.type)==="handler"&&S.jsx(oir,{handler:o.handler,channel:i}),(o==null?void 0:o.type)==="action"&&S.jsx(cir,{category:o.category,action:o.action,channel:i}),f&&S.jsxs(S.Fragment,{children:[S.jsx(i3,{}),S.jsx(Yr,{children:"Client Usage"}),S.jsx(Qf,{block:!0,children:f})]})]})},uir=(r,i)=>{var o,a,f,g;return i?i.type==="handler"?((o=r[i.handler])==null?void 0:o.pikkuFuncId)??null:((g=(f=(a=r.messageWirings)==null?void 0:a[i.category])==null?void 0:f[i.action])==null?void 0:g.pikkuFuncId)??null:null},lir=({channelName:r,channelMeta:i,channelItems:o})=>{const a=ay(),{openFunction:f}=Bo(),[g,h]=G.useState(null),b=uir(i,g),{data:w}=AH(b??"");G.useEffect(()=>{b&&w&&f(b,w)},[b,w,f]);const x=G.useCallback(k=>{h(null),a(`/apis/channels?id=${encodeURIComponent(k)}`)},[a]);return S.jsx(zd,{header:S.jsx(Ch,{icon:o3,category:"Channels",categoryPath:"/apis/channels",currentItem:r,items:o,onItemSelect:x,docsHref:"https://pikku.dev/docs/wiring/channels"}),children:S.jsxs(Ue,{style:{display:"flex",height:"100%"},children:[S.jsx(Ue,{style:{width:260,minWidth:200,borderRight:"1px solid var(--mantine-color-default-border)",height:"100%"},children:S.jsx(rir,{channel:i,selected:g,onSelect:h})}),S.jsx(Ue,{style:{flex:1,overflow:"hidden"},children:S.jsx(air,{channelName:r,channel:i,selected:g})})]})})},fir=()=>{var g;const[r]=l3(),i=r.get("id")||"",{meta:o}=mu(),a=(g=o.channelsMeta)==null?void 0:g[i],f=G.useMemo(()=>o.channelsMeta?Object.entries(o.channelsMeta).map(([h,b])=>({name:h,description:b.route})):[],[o.channelsMeta]);return a?S.jsx(Bd,{children:S.jsx(lir,{channelName:i,channelMeta:a,channelItems:f})}):S.jsx(Eh,{h:"100vh",children:S.jsxs(Qe,{c:"dimmed",children:['Channel "',i,'" not found.']})})},hir=["connect","disconnect","message"],dir=[{key:"name",header:"NAME",render:r=>S.jsxs(S.Fragment,{children:[S.jsx(Qe,{fw:500,truncate:!0,children:r.name}),S.jsx(Qe,{size:"xs",c:"dimmed",truncate:!0,children:r.route})]})},{key:"handlers",header:"HANDLERS",align:"right",render:r=>S.jsx(kn,{type:"dynamic",badge:"handlers",value:r.handlerCount})},{key:"actions",header:"ACTIONS",align:"right",render:r=>S.jsx(kn,{type:"dynamic",badge:"actions",value:r.actionCount})},{key:"route",header:"ROUTE",align:"right",render:r=>S.jsx(kn,{type:"dynamic",badge:"route",value:r.route})}],pir=()=>{const{meta:r,loading:i}=mu(),o=ay(),a=G.useMemo(()=>Object.entries(r.channelsMeta||{}).map(([f,g])=>{const h=g,b=hir.filter(x=>h[x]!=null).length,w=Object.values(h.messageWirings||{}).reduce((x,k)=>x+Object.keys(k).length,0);return{name:f,route:h.route,handlerCount:b,actionCount:w,data:h}}),[r.channelsMeta]);return S.jsx(Bd,{children:S.jsx(zd,{header:S.jsx(Ch,{icon:o3,category:"Channels",docsHref:"https://pikku.dev/docs/wiring/channels"}),hidePanel:!0,children:S.jsx(Vg,{title:"Channels",icon:o3,docsHref:"https://pikku.dev/docs/wiring/channels",data:a,columns:dir,getKey:f=>f.name,onRowClick:f=>o(`/apis/channels?id=${encodeURIComponent(f.name)}`),searchPlaceholder:"Search channels...",searchFilter:(f,g)=>f.name.toLowerCase().includes(g)||f.route.toLowerCase().includes(g),emptyMessage:"No channels found.",loading:i})})})},gir=()=>{const[r]=l3();return r.get("id")?S.jsx(fir,{}):S.jsx(pir,{})},mir=()=>S.jsx(G.Suspense,{fallback:S.jsx(Eh,{h:"100vh",children:S.jsx(Ea,{})}),children:S.jsx(gir,{})}),bir=({items:r,loading:i})=>{const{openMCP:o}=Bo(),[a,f]=G.useState("all"),g=G.useMemo(()=>a==="all"?r:r.filter(b=>b.method===a),[r,a]),h=G.useMemo(()=>[{key:"name",header:"NAME",render:b=>S.jsxs(S.Fragment,{children:[S.jsx(Qe,{fw:500,truncate:!0,children:b.name||b.wireId||"unnamed"}),b.pikkuFuncId&&S.jsx(Qe,{size:"xs",c:"dimmed",truncate:!0,children:b.pikkuFuncId})]})},{key:"method",header:"TYPE",align:"right",render:b=>{const w=b.method||"tool";return S.jsx(kn,{type:"mcpType",value:w})}}],[]);return S.jsx(Vg,{title:"MCP",icon:QR,docsHref:"https://pikku.dev/docs/wiring/mcp",data:g,columns:h,getKey:b=>`${b.method}::${b.wireId||b.name}`,onRowClick:b=>o(`mcp::${b.method}::${b.wireId||b.name}`,b),searchPlaceholder:"Search MCP tools, resources, prompts...",searchFilter:(b,w)=>{var x,k,E;return((x=b.name)==null?void 0:x.toLowerCase().includes(w))||((k=b.pikkuFuncId)==null?void 0:k.toLowerCase().includes(w))||((E=b.method)==null?void 0:E.toLowerCase().includes(w))},emptyMessage:"No MCP entries found.",loading:i})},wir=()=>{const{meta:r,loading:i}=mu(),o=G.useMemo(()=>r.mcpMeta?[...r.mcpMeta].sort((a,f)=>(a.name||"").localeCompare(f.name||"")):[],[r.mcpMeta]);return S.jsx(Bd,{children:S.jsx(zd,{header:S.jsx(Ch,{icon:QR,category:"MCP",docsHref:"https://pikku.dev/docs/wiring/mcp"}),showTabs:!1,hidePanel:!i&&o.length===0,emptyPanelMessage:"Select an MCP entry to view its details",children:S.jsx(bir,{items:o,loading:i})})})},Pqt=(r,i)=>Object.entries(r).map(([o,a])=>{const f=[...i,o],g=a.subcommands?Pqt(a.subcommands,f):[];return{name:o,path:f,description:a.description,hasChildren:g.length>0,children:g,pikkuFuncId:a.pikkuFuncId||void 0}}),$qt=(r,i)=>{var o;return r.name.toLowerCase().includes(i)||(o=r.description)!=null&&o.toLowerCase().includes(i)?!0:r.children.some(a=>$qt(a,i))},Dqt=(r,i)=>i?r.filter(o=>$qt(o,i)).map(o=>({...o,children:Dqt(o.children,i)})):r,Lqt=({command:r,activePath:i,onSelect:o,depth:a})=>{const f=r.path.length===i.length&&r.path.every((h,b)=>h===i[b]),g=r.path.length<i.length&&r.path.every((h,b)=>h===i[b]);return S.jsx(WS,{label:S.jsx(Qe,{size:"sm",fw:f?600:400,truncate:!0,children:r.name}),description:r.description,active:f,opened:g||void 0,onClick:()=>o(r.path),styles:{root:{borderRadius:4},description:{fontSize:"var(--mantine-font-size-xs)"}},children:r.hasChildren?r.children.map(h=>S.jsx(Lqt,{command:h,activePath:i,onSelect:o,depth:a+1},h.name)):void 0})},yir=({program:r,activePath:i,onSelect:o})=>{const[a,f]=G.useState(""),g=G.useMemo(()=>Pqt(r.commands,[]),[r.commands]),h=G.useMemo(()=>Dqt(g,a.toLowerCase()),[g,a]);return S.jsxs(Vn,{gap:0,style:{height:"100%"},children:[S.jsx(Ue,{px:"sm",py:"xs",style:{borderBottom:"1px solid var(--mantine-color-default-border)"},children:S.jsx(IE,{placeholder:"Search commands...",leftSection:S.jsx(une,{size:14}),size:"xs",value:a,onChange:b=>f(b.target.value)})}),S.jsxs(Tb,{style:{flex:1},px:"xs",py:"xs",children:[h.map(b=>S.jsx(Lqt,{command:b,activePath:i,onSelect:o,depth:0},b.name)),a&&h.length===0&&S.jsxs(Qe,{size:"sm",c:"dimmed",ta:"center",py:"md",children:["No commands match “",a,"”"]})]})]})},Lbe=Symbol.for("@pikku/core/state"),UR=()=>(globalThis[Lbe]||(globalThis[Lbe]=new Map),globalThis[Lbe]),vir=(r,i,o,a)=>{const f="__main__";return UR().has(f)||Fqt(f),UR().get(f)[i][o]},xir=()=>({function:{meta:{},functions:new Map},rpc:{meta:{},files:new Map,addons:new Map},http:{middleware:new Map,permissions:new Map,routes:new Map,meta:{post:{},get:{},delete:{},patch:{},head:{},put:{},options:{}}},channel:{channels:new Map,meta:{}},scheduler:{tasks:new Map,meta:[]},queue:{registrations:new Map,meta:{}},workflows:{registrations:new Map,meta:{}},trigger:{functions:new Map,triggers:new Map,triggerSources:new Map,meta:{},sourceMeta:{}},mcp:{resources:new Map,resourcesMeta:{},toolsMeta:{},prompts:new Map,promptsMeta:{}},agent:{agents:new Map,agentsMeta:{}},cli:{meta:{programs:{},renderers:{}},programs:{}},middleware:{tagGroup:{},httpGroup:{}},channelMiddleware:{tagGroup:{}},permissions:{tagGroup:{},httpGroup:{}},misc:{errors:new Map,schemas:new Map,middleware:{},channelMiddleware:{},permissions:{}},models:{config:null},package:{factories:null,singletonServices:null,metaDir:null}}),Fqt=r=>{UR().has(r)||UR().set(r,xir())},Sir=()=>{var i;const r=(i=UR().get("__main__"))==null?void 0:i.misc.errors;if(globalThis[Lbe]=new Map,Fqt("__main__"),r){const o=UR().get("__main__");o.misc.errors=r}};UR().has("__main__")||Sir();class ea extends Error{constructor(i="An error occurred"){super(i),Object.setPrototypeOf(this,new.target.prototype)}}const ta=(r,{status:i,message:o})=>{vir(null,"misc","errors").set(r,{status:i,message:o})};class kir extends ea{}ta(kir,{status:500,message:"The middleware wire is invalid for the current wiring type."});class jir extends ea{}ta(jir,{status:500,message:"Required metadata is missing"});class Eir extends ea{}ta(Eir,{status:400,message:"The server cannot or will not process the request due to client error (e.g., malformed request syntax)."});class Cir extends ea{}class _ir extends ea{}class Tir extends ea{}ta(Cir,{status:401,message:"Authentication is required and has failed or has not yet been provided."});ta(_ir,{status:401,message:"Session missing."});ta(Tir,{status:401,message:"The session provided is not valid."});class Air extends ea{}ta(Air,{status:402,message:"Reserved for future use, often related to digital payment or subscription services."});class Mir extends ea{}ta(Mir,{status:403,message:"The client does not have permission to access the requested resource."});class Iir extends ea{}ta(Iir,{status:403,message:"The session is readonly and cannot access this function."});class Oir extends ea{}ta(Oir,{status:403,message:"The request was made from an origin that is not permitted to access this resource."});class Rir extends ea{}ta(Rir,{status:404,message:"The server cannot find the requested resource."});class Nir extends ea{}ta(Nir,{status:405,message:"The request method is known by the server but is not supported by the resource."});class Pir extends ea{}ta(Pir,{status:406,message:"The requested resource cannot produce a response matching the list of acceptable values in the request's headers."});class $ir extends ea{}ta($ir,{status:407,message:"The client must authenticate itself to get the requested response."});class Dir extends ea{}ta(Dir,{status:408,message:"The request timeout has expired."});class Lir extends ea{}ta(Lir,{status:409,message:"The request could not be completed due to a conflict with the current state of the target resource."});class Fir extends ea{}ta(Fir,{status:410,message:"The resource that is being accessed is no longer available and will not be available again."});class zir extends ea{}ta(zir,{status:411,message:"The request did not specify the length of its content, which is required by the requested resource."});class Bir extends ea{}ta(Bir,{status:412,message:"The server does not meet one of the preconditions that the requester put on the request."});class Hir extends ea{}ta(Hir,{status:413,message:"The request is larger than the server is willing or able to process."});class Uir extends ea{}ta(Uir,{status:414,message:"The URI requested by the client is longer than the server is willing to interpret."});class qir extends ea{}ta(qir,{status:415,message:"The server does not support the media format of the requested data."});class Gir extends ea{}ta(Gir,{status:416,message:"The client has asked for a portion of the file, but the server cannot supply that portion."});class Vir extends ea{}ta(Vir,{status:417,message:"The server cannot meet the requirements of the Expect request-header field."});class Jir extends ea{}ta(Jir,{status:422,message:"The server understood the content type of the request content, and the syntax of the request content was correct, but it was unable to process the contained instructions.."});class Kir extends ea{}ta(Kir,{status:423,message:"The resource is locked, meaning it can't be accessed. Its response body should contain information in WebDAV's XML format."});class Wir extends ea{}ta(Wir,{status:429,message:'The user has sent too many requests in a given amount of time ("rate limiting").'});class Yir extends ea{}ta(Yir,{status:500,message:"A generic error message, given when no more specific message is suitable."});class Xir extends ea{}ta(Xir,{status:501,message:"The server does not recognize the request method and cannot support it."});class Qir extends ea{}ta(Qir,{status:502,message:"The server was acting as a gateway or proxy and received an invalid response from the upstream server."});class Zir extends ea{}ta(Zir,{status:503,message:"The server is currently unavailable (overloaded or down)."});class esr extends ea{}ta(esr,{status:504,message:"The server was acting as a gateway or proxy and did not receive a timely response from the upstream server."});class tsr extends ea{}ta(tsr,{status:505,message:"The server does not support the HTTP protocol version used in the request."});class nsr extends ea{}ta(nsr,{status:524,message:"The server took too long to complete the request, reaching the maximum compute time allowed."});class rsr extends ea{}ta(rsr,{status:500,message:"A required schema was not found. Ensure schema generation has been run."});Date.now().toString(36);new TextEncoder;new TextDecoder;function isr(r,i){if(i.length===0)return null;let o=r.commands[i[0]];if(!o)return null;for(let a=1;a<i.length;a++){if(!o.subcommands||!o.subcommands[i[a]])return null;o=o.subcommands[i[a]]}return o}function ssr(r,i){let o={...r.options};if(i.length===0)return o;let a=r.commands[i[0]];if(a){o={...o,...a.options};for(let f=1;f<i.length;f++)a.subcommands&&a.subcommands[i[f]]&&(a=a.subcommands[i[f]],o={...o,...a.options})}return o}function osr(r,i,o=[]){const a=[],f=i.programs[r];if(!f)return`Program not found: ${r}`;if(o.length===0){a.push(`Usage: ${r} <command> [options]`),a.push(""),a.push("Commands:");for(const[g,h]of Object.entries(f.commands)){const b=h.description||"",w=h.isDefault?" (default)":"";a.push(` ${g.padEnd(20)} ${b}${w}`)}Object.keys(f.options).length>0&&(a.push(""),a.push("Options:"),aNt(f.options,a))}else{const g=isr(f,o);if(!g)return`Unknown command: ${o.join(" ")}`;let h=`${r} ${o.join(" ")}`;if(g.parameters&&(h+=" "+g.parameters),a.push(`Usage: ${h} [options]`),g.description&&(a.push(""),a.push(g.description)),g.positionals.length>0){a.push(""),a.push("Arguments:");for(const w of g.positionals){const x=w.required?"<required>":"[optional]",k=w.variadic?"...":"";a.push(` ${w.name}${k} ${x}`)}}if(g.subcommands&&Object.keys(g.subcommands).length>0){a.push(""),a.push("Subcommands:");for(const[w,x]of Object.entries(g.subcommands)){const k=x.description||"";a.push(` ${w.padEnd(20)} ${k}`)}}const b=ssr(f,o);Object.keys(b).length>0&&(a.push(""),a.push("Options:"),aNt(b,a))}return a.join(`
635
+ `}),S.jsx(_qt,{nodes:h,edges:w,nodeTypes:Grr,edgeTypes:Vrr,defaultEdgeOptions:{style:{stroke:"#c0c0c0",strokeWidth:1.5,strokeDasharray:"6 4"},animated:!0,markerEnd:{type:Rte.ArrowClosed,color:"#c0c0c0",width:16,height:16}},zoomOnScroll:!0,preventScrolling:!1,nodesConnectable:!1,nodesDraggable:!0,proOptions:{hideAttribution:!0},noDragClassName:"nodrag",onPaneClick:i,children:S.jsx(jnr,{color:"#ccc",variant:f2.Dots,size:2})})]})},Krr=r=>S.jsx(Hqe,{children:S.jsx(Jrr,{...r})}),Wrr=({workflowName:r})=>{const{selectedRunId:i,setSelectedRunId:o,setIsCreatingRun:a}=wWn(),{setActivePanel:f}=Bo(),g=Nu(),{data:h,isLoading:b,refetch:w}=hWn(r),x=G.useMemo(()=>!h||!Array.isArray(h)?[]:h,[h]),k=G.useCallback(async T=>{await g.invoke("console:deleteWorkflowRun",{runId:T}),i===T&&o(null),w()},[g,i,o,w]),E=G.useCallback(()=>{o(null),a(!0),f(`workflow-${r}`)},[o,a,f,r]);return S.jsx(Oqt,{title:"Runs",runs:x,selectedId:i,onSelect:o,onClear:()=>o(null),loading:b,emptyMessage:"No runs found",statusFilters:[],onNewClick:E,newButtonLabel:"New workflow run",onDelete:k})},Yrr=({workflow:r,items:i,onItemSelect:o})=>{var q;const{canvasDrawer:a,closeCanvasDrawer:f}=Enr(),{panels:g,activePanel:h,openWorkflow:b,setActivePanel:w}=Bo(),{setFocusedNode:x}=DE(),k=r.name||r.wireId||"Workflow",E=`workflow-${k}`,T=G.useCallback(()=>{w(E)},[w,E]);G.useEffect(()=>{b(k,r)},[]),G.useEffect(()=>{if(!h){x(null);return}const J=g.get(h);(J==null?void 0:J.data.type)==="workflowStep"?x(J.data.id):x(null)},[h,g,x]);const A=G.useMemo(()=>a?znr(a.data):null,[a]),I=(r.source||"graph")==="complex",N=ly(),D=S.jsxs(S.Fragment,{children:[S.jsx(Ch,{icon:_8,category:"Workflows",docsHref:"https://pikku.dev/docs/wiring/workflows",categoryPath:"/workflow",currentItem:k,items:i,onItemSelect:o,subtitle:r.source?S.jsx(kn,{type:"dynamic",badge:"source",value:r.source}):void 0}),I&&S.jsx(zg,{icon:S.jsx(YS,{size:16}),color:"yellow",radius:0,py:"xs",styles:{root:{borderBottom:"1px solid var(--mantine-color-default-border)"}},children:S.jsxs(jn,{justify:"space-between",align:"center",children:[S.jsx(Qe,{size:"sm",children:"This is a complex workflow. The visual representation may not be accurate."}),S.jsx(Qe,{size:"sm",c:"yellow.7",style:{cursor:"pointer",textDecoration:"underline"},children:"Learn more"})]})}),(N==null?void 0:N.isVersionMismatch)&&S.jsx(zg,{icon:S.jsx(iNn,{size:16}),color:"orange",radius:0,py:"xs",styles:{root:{borderBottom:"1px solid var(--mantine-color-default-border)"}},children:S.jsx(Qe,{size:"sm",children:"Viewing historical version — workflow definition has changed since this run"})})]}),F=N!=null&&N.isVersionMismatch&&(N!=null&&N.historicalWorkflow)?{...r,...N.historicalWorkflow}:r,B=G.useMemo(()=>{var Y;const J=(Y=N==null?void 0:N.runData)==null?void 0:Y.wire;return!J||!F.wires?F:{...F,wires:qrr(F.wires,J)}},[F,(q=N==null?void 0:N.runData)==null?void 0:q.wire]),U=N?S.jsx(Wrr,{workflowName:k}):void 0;return S.jsxs(S.Fragment,{children:[S.jsx(Nqt,{header:D,showTabs:!1,emptyPanelMessage:"Select a node to view its details",runsPanel:U,children:S.jsx(Ue,{style:{height:"100%",position:"relative"},children:S.jsx(Krr,{workflow:B,onPaneClick:T})})}),a&&S.jsx(Ue,{style:{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:98},onClick:f}),S.jsx(d3,{opened:a!==null,onClose:f,position:"right",size:"md",withOverlay:!1,withinPortal:!1,closeOnClickOutside:!1,withCloseButton:!1,styles:{inner:{top:"50px",zIndex:99},content:{height:"100%"},header:{display:"none"},body:{padding:0}},children:A})]})},Xrr=r=>S.jsx(xWn,{workflow:r.workflow,children:S.jsx(Cnr,{children:S.jsx(Yrr,{...r})})}),Qrr=()=>{const[r]=l3(),i=ay(),o=r.get("id")||"",a=Nu(),{data:f,isLoading:g}=k1({queryKey:["workflow-meta-by-id",o],queryFn:()=>a.invoke("console:getWorkflowMetaById",{workflowId:o}),enabled:!!o}),{meta:h}=mu(),b=G.useMemo(()=>h.workflows?Object.entries(h.workflows).map(([w,x])=>({name:w,description:x.steps?`${x.steps.length} steps`:void 0})):[],[h.workflows]);return g?S.jsx(Eh,{h:"100vh",children:S.jsx(Ea,{})}):f?S.jsx(Bd,{children:S.jsx(vWn,{workflowName:o,currentGraphHash:f.graphHash,workflowNodes:f.nodes,children:S.jsx(Ue,{h:"100vh",style:{display:"flex",flexDirection:"column"},children:S.jsx(Ue,{style:{flex:1,overflow:"auto"},children:S.jsx(Xrr,{workflow:f,items:b,onItemSelect:w=>i(`/workflow?id=${encodeURIComponent(w)}`)})})})})}):S.jsx(Eh,{h:"100vh",children:S.jsxs(Qe,{c:"dimmed",children:['Workflow "',o,'" not found.']})})};function Zrr(){const[r]=l3(),i=r.get("id"),{meta:o,loading:a}=mu();return i?S.jsx(Qrr,{}):a?S.jsx(Eh,{h:"100vh",children:S.jsx(Ea,{})}):S.jsx(Bd,{children:S.jsx(zd,{header:S.jsx(Ch,{icon:_8,category:"Workflows",docsHref:"https://pikku.dev/docs/wiring/workflows"}),hidePanel:!0,children:S.jsx(OYn,{workflows:o.workflows||{}})})})}const eir=()=>S.jsx(G.Suspense,{fallback:S.jsx(Eh,{h:"100vh",children:S.jsx(Ea,{})}),children:S.jsx(Zrr,{})}),tir=({routes:r,loading:i})=>{const{openHTTPWire:o}=Bo(),a=G.useMemo(()=>[{key:"route",header:"ROUTE",render:f=>S.jsxs(S.Fragment,{children:[S.jsx(Qe,{fw:500,truncate:!0,children:f.route}),S.jsx(Qe,{size:"xs",c:"dimmed",truncate:!0,children:f.pikkuFuncId})]})},{key:"method",header:"METHOD",align:"right",render:f=>{var h;const g=((h=f.method)==null?void 0:h.toUpperCase())||"GET";return S.jsx(kn,{type:"httpMethod",value:g})}}],[]);return S.jsx(Vg,{title:"HTTP Routes",icon:ej,docsHref:"https://pikku.dev/docs/wiring/http",data:r,columns:a,getKey:f=>`${f.method}::${f.route}`,onRowClick:f=>o(`http::${f.method}::${f.route}`,f),searchPlaceholder:"Search HTTP routes...",searchFilter:(f,g)=>{var h,b,w;return((h=f.route)==null?void 0:h.toLowerCase().includes(g))||((b=f.pikkuFuncId)==null?void 0:b.toLowerCase().includes(g))||((w=f.method)==null?void 0:w.toLowerCase().includes(g))},emptyMessage:"No HTTP routes found.",loading:i,description:S.jsxs(Vn,{gap:2,children:[S.jsx(Qe,{size:"sm",fw:500,children:"See every route at a glance"}),S.jsx(Qe,{size:"xs",c:"dimmed",children:"Pikku prints your full route table at startup. Every method, route, function, and flag — visible in one place."})]})})},nir=()=>{const{meta:r,loading:i}=mu(),o=G.useMemo(()=>r.httpMeta?[...r.httpMeta].sort((a,f)=>a.route.localeCompare(f.route)):[],[r.httpMeta]);return S.jsx(Bd,{children:S.jsx(zd,{header:S.jsx(Ch,{icon:ej,category:"HTTP Routes",docsHref:"https://pikku.dev/docs/wiring/http"}),showTabs:!1,hidePanel:!i&&o.length===0,emptyPanelMessage:"Select a route to view its details",children:S.jsx(tir,{routes:o,loading:i})})})},cNt=["connect","disconnect","message"],rir=({channel:r,selected:i,onSelect:o})=>{const[a,f]=G.useState(""),g=G.useMemo(()=>Object.entries(r.messageWirings||{}),[r.messageWirings]),h=a.toLowerCase(),b=G.useMemo(()=>h?cNt.filter(A=>A.toLowerCase().includes(h)):cNt,[h]),w=G.useMemo(()=>h?g.map(([A,M])=>{if(A.toLowerCase().includes(h))return[A,M];const N=Object.entries(M).filter(([D])=>D.toLowerCase().includes(h));return N.length===0?null:[A,Object.fromEntries(N)]}).filter(Boolean):g,[g,h]),x=A=>(i==null?void 0:i.type)==="handler"&&i.handler===A,k=(A,M)=>(i==null?void 0:i.type)==="action"&&i.category===A&&i.action===M,E=A=>(i==null?void 0:i.type)==="action"&&i.category===A,T=b.length>0||w.length>0;return S.jsxs(Vn,{gap:0,style:{height:"100%"},children:[S.jsx(Ue,{px:"sm",py:"xs",style:{borderBottom:"1px solid var(--mantine-color-default-border)"},children:S.jsx(IE,{placeholder:"Search handlers...",leftSection:S.jsx(une,{size:14}),size:"xs",value:a,onChange:A=>f(A.target.value)})}),S.jsxs(Tb,{style:{flex:1},px:"xs",py:"xs",children:[b.map(A=>{const M=r[A]!=null;return S.jsx(WS,{label:S.jsx(Qe,{size:"sm",fw:x(A)?600:400,c:M?void 0:"dimmed",children:A}),active:x(A),disabled:!M,onClick:()=>M&&o({type:"handler",handler:A}),styles:{root:{borderRadius:4}}},A)}),w.length>0&&S.jsx(WS,{label:S.jsx(Qe,{size:"sm",fw:600,children:"Message Wirings"}),defaultOpened:!0,styles:{root:{borderRadius:4}},children:w.map(([A,M])=>S.jsx(WS,{label:S.jsx(Qe,{size:"sm",fw:600,children:A}),defaultOpened:!0,opened:E(A)||void 0,styles:{root:{borderRadius:4}},children:Object.keys(M).map(I=>S.jsx(WS,{label:S.jsx(Qe,{size:"sm",fw:k(A,I)?600:400,children:I}),active:k(A,I),onClick:()=>o({type:"action",category:A,action:I}),styles:{root:{borderRadius:4}}},I))},A))}),a&&!T&&S.jsxs(Qe,{size:"sm",c:"dimmed",ta:"center",py:"md",children:["No results match “",a,"”"]})]})]})},iir=(r,i)=>{var o,a;return r?i?i.type==="handler"?r.handlers[i.handler]||null:((a=(o=r.actions)==null?void 0:o[i.category])==null?void 0:a[i.action])||null:r.overview||null:null},sir=({channelName:r,channel:i})=>S.jsxs(Vn,{gap:"sm",children:[S.jsx(Qe,{size:"lg",fw:600,children:r}),S.jsx(kn,{type:"dynamic",badge:"route",value:i.route}),S.jsx(lm,{description:i.description,middleware:i.middleware,permissions:i.permissions,tags:i.tags})]}),oir=({handler:r,channel:i})=>{const o=i[r];return o?S.jsxs(Vn,{gap:"sm",children:[S.jsx(Qe,{size:"lg",fw:600,children:r}),S.jsx(i3,{}),S.jsx(_R,{pikkuFuncId:o.pikkuFuncId}),S.jsx(lm,{middleware:o.middleware,permissions:o.permissions,tags:o.tags})]}):null},cir=({category:r,action:i,channel:o})=>{var f,g;const a=(g=(f=o.messageWirings)==null?void 0:f[r])==null?void 0:g[i];return a?S.jsxs(Vn,{gap:"sm",children:[S.jsxs(jn,{gap:"xs",children:[S.jsx(Qe,{size:"sm",c:"dimmed",children:r}),S.jsx(Qe,{size:"sm",c:"dimmed",children:"/"}),S.jsx(Qe,{size:"lg",fw:600,children:i})]}),S.jsx(i3,{}),S.jsx(_R,{pikkuFuncId:a.pikkuFuncId}),S.jsx(lm,{middleware:a.middleware,permissions:a.permissions,tags:a.tags})]}):null},air=({channelName:r,channel:i,selected:o})=>{const{data:a}=SWn(r),f=G.useMemo(()=>iir(a,o),[a,o]);return S.jsxs(Vn,{gap:"md",p:"md",style:{height:"100%",overflow:"auto"},children:[!o&&S.jsx(sir,{channelName:r,channel:i}),(o==null?void 0:o.type)==="handler"&&S.jsx(oir,{handler:o.handler,channel:i}),(o==null?void 0:o.type)==="action"&&S.jsx(cir,{category:o.category,action:o.action,channel:i}),f&&S.jsxs(S.Fragment,{children:[S.jsx(i3,{}),S.jsx(Yr,{children:"Client Usage"}),S.jsx(Qf,{block:!0,children:f})]})]})},uir=(r,i)=>{var o,a,f,g;return i?i.type==="handler"?((o=r[i.handler])==null?void 0:o.pikkuFuncId)??null:((g=(f=(a=r.messageWirings)==null?void 0:a[i.category])==null?void 0:f[i.action])==null?void 0:g.pikkuFuncId)??null:null},lir=({channelName:r,channelMeta:i,channelItems:o})=>{const a=ay(),{openFunction:f}=Bo(),[g,h]=G.useState(null),b=uir(i,g),{data:w}=AH(b??"");G.useEffect(()=>{b&&w&&f(b,w)},[b,w,f]);const x=G.useCallback(k=>{h(null),a(`/apis/channels?id=${encodeURIComponent(k)}`)},[a]);return S.jsx(zd,{header:S.jsx(Ch,{icon:o3,category:"Channels",categoryPath:"/apis/channels",currentItem:r,items:o,onItemSelect:x,docsHref:"https://pikku.dev/docs/wiring/channels"}),children:S.jsxs(Ue,{style:{display:"flex",height:"100%"},children:[S.jsx(Ue,{style:{width:260,minWidth:200,borderRight:"1px solid var(--mantine-color-default-border)",height:"100%"},children:S.jsx(rir,{channel:i,selected:g,onSelect:h})}),S.jsx(Ue,{style:{flex:1,overflow:"hidden"},children:S.jsx(air,{channelName:r,channel:i,selected:g})})]})})},fir=()=>{var g;const[r]=l3(),i=r.get("id")||"",{meta:o}=mu(),a=(g=o.channelsMeta)==null?void 0:g[i],f=G.useMemo(()=>o.channelsMeta?Object.entries(o.channelsMeta).map(([h,b])=>({name:h,description:b.route})):[],[o.channelsMeta]);return a?S.jsx(Bd,{children:S.jsx(lir,{channelName:i,channelMeta:a,channelItems:f})}):S.jsx(Eh,{h:"100vh",children:S.jsxs(Qe,{c:"dimmed",children:['Channel "',i,'" not found.']})})},hir=["connect","disconnect","message"],dir=[{key:"name",header:"NAME",render:r=>S.jsxs(S.Fragment,{children:[S.jsx(Qe,{fw:500,truncate:!0,children:r.name}),S.jsx(Qe,{size:"xs",c:"dimmed",truncate:!0,children:r.route})]})},{key:"handlers",header:"HANDLERS",align:"right",render:r=>S.jsx(kn,{type:"dynamic",badge:"handlers",value:r.handlerCount})},{key:"actions",header:"ACTIONS",align:"right",render:r=>S.jsx(kn,{type:"dynamic",badge:"actions",value:r.actionCount})},{key:"route",header:"ROUTE",align:"right",render:r=>S.jsx(kn,{type:"dynamic",badge:"route",value:r.route})}],pir=()=>{const{meta:r,loading:i}=mu(),o=ay(),a=G.useMemo(()=>Object.entries(r.channelsMeta||{}).map(([f,g])=>{const h=g,b=hir.filter(x=>h[x]!=null).length,w=Object.values(h.messageWirings||{}).reduce((x,k)=>x+Object.keys(k).length,0);return{name:f,route:h.route,handlerCount:b,actionCount:w,data:h}}),[r.channelsMeta]);return S.jsx(Bd,{children:S.jsx(zd,{header:S.jsx(Ch,{icon:o3,category:"Channels",docsHref:"https://pikku.dev/docs/wiring/channels"}),hidePanel:!0,children:S.jsx(Vg,{title:"Channels",icon:o3,docsHref:"https://pikku.dev/docs/wiring/channels",data:a,columns:dir,getKey:f=>f.name,onRowClick:f=>o(`/apis/channels?id=${encodeURIComponent(f.name)}`),searchPlaceholder:"Search channels...",searchFilter:(f,g)=>f.name.toLowerCase().includes(g)||f.route.toLowerCase().includes(g),emptyMessage:"No channels found.",loading:i})})})},gir=()=>{const[r]=l3();return r.get("id")?S.jsx(fir,{}):S.jsx(pir,{})},mir=()=>S.jsx(G.Suspense,{fallback:S.jsx(Eh,{h:"100vh",children:S.jsx(Ea,{})}),children:S.jsx(gir,{})}),bir=({items:r,loading:i})=>{const{openMCP:o}=Bo(),[a,f]=G.useState("all"),g=G.useMemo(()=>a==="all"?r:r.filter(b=>b.method===a),[r,a]),h=G.useMemo(()=>[{key:"name",header:"NAME",render:b=>S.jsxs(S.Fragment,{children:[S.jsx(Qe,{fw:500,truncate:!0,children:b.name||b.wireId||"unnamed"}),b.pikkuFuncId&&S.jsx(Qe,{size:"xs",c:"dimmed",truncate:!0,children:b.pikkuFuncId})]})},{key:"method",header:"TYPE",align:"right",render:b=>{const w=b.method||"tool";return S.jsx(kn,{type:"mcpType",value:w})}}],[]);return S.jsx(Vg,{title:"MCP",icon:QR,docsHref:"https://pikku.dev/docs/wiring/mcp",data:g,columns:h,getKey:b=>`${b.method}::${b.wireId||b.name}`,onRowClick:b=>o(`mcp::${b.method}::${b.wireId||b.name}`,b),searchPlaceholder:"Search MCP tools, resources, prompts...",searchFilter:(b,w)=>{var x,k,E;return((x=b.name)==null?void 0:x.toLowerCase().includes(w))||((k=b.pikkuFuncId)==null?void 0:k.toLowerCase().includes(w))||((E=b.method)==null?void 0:E.toLowerCase().includes(w))},emptyMessage:"No MCP entries found.",loading:i})},wir=()=>{const{meta:r,loading:i}=mu(),o=G.useMemo(()=>r.mcpMeta?[...r.mcpMeta].sort((a,f)=>(a.name||"").localeCompare(f.name||"")):[],[r.mcpMeta]);return S.jsx(Bd,{children:S.jsx(zd,{header:S.jsx(Ch,{icon:QR,category:"MCP",docsHref:"https://pikku.dev/docs/wiring/mcp"}),showTabs:!1,hidePanel:!i&&o.length===0,emptyPanelMessage:"Select an MCP entry to view its details",children:S.jsx(bir,{items:o,loading:i})})})},Pqt=(r,i)=>Object.entries(r).map(([o,a])=>{const f=[...i,o],g=a.subcommands?Pqt(a.subcommands,f):[];return{name:o,path:f,description:a.description,hasChildren:g.length>0,children:g,pikkuFuncId:a.pikkuFuncId||void 0}}),$qt=(r,i)=>{var o;return r.name.toLowerCase().includes(i)||(o=r.description)!=null&&o.toLowerCase().includes(i)?!0:r.children.some(a=>$qt(a,i))},Dqt=(r,i)=>i?r.filter(o=>$qt(o,i)).map(o=>({...o,children:Dqt(o.children,i)})):r,Lqt=({command:r,activePath:i,onSelect:o,depth:a})=>{const f=r.path.length===i.length&&r.path.every((h,b)=>h===i[b]),g=r.path.length<i.length&&r.path.every((h,b)=>h===i[b]);return S.jsx(WS,{label:S.jsx(Qe,{size:"sm",fw:f?600:400,truncate:!0,children:r.name}),description:r.description,active:f,opened:g||void 0,onClick:()=>o(r.path),styles:{root:{borderRadius:4},description:{fontSize:"var(--mantine-font-size-xs)"}},children:r.hasChildren?r.children.map(h=>S.jsx(Lqt,{command:h,activePath:i,onSelect:o,depth:a+1},h.name)):void 0})},yir=({program:r,activePath:i,onSelect:o})=>{const[a,f]=G.useState(""),g=G.useMemo(()=>Pqt(r.commands,[]),[r.commands]),h=G.useMemo(()=>Dqt(g,a.toLowerCase()),[g,a]);return S.jsxs(Vn,{gap:0,style:{height:"100%"},children:[S.jsx(Ue,{px:"sm",py:"xs",style:{borderBottom:"1px solid var(--mantine-color-default-border)"},children:S.jsx(IE,{placeholder:"Search commands...",leftSection:S.jsx(une,{size:14}),size:"xs",value:a,onChange:b=>f(b.target.value)})}),S.jsxs(Tb,{style:{flex:1},px:"xs",py:"xs",children:[h.map(b=>S.jsx(Lqt,{command:b,activePath:i,onSelect:o,depth:0},b.name)),a&&h.length===0&&S.jsxs(Qe,{size:"sm",c:"dimmed",ta:"center",py:"md",children:["No commands match “",a,"”"]})]})]})},Lbe=Symbol.for("@pikku/core/state"),UR=()=>(globalThis[Lbe]||(globalThis[Lbe]=new Map),globalThis[Lbe]),vir=(r,i,o,a)=>{const f="__main__";return UR().has(f)||Fqt(f),UR().get(f)[i][o]},xir=()=>({function:{meta:{},functions:new Map},rpc:{meta:{},files:new Map,addons:new Map},http:{middleware:new Map,permissions:new Map,routes:new Map,meta:{post:{},get:{},delete:{},patch:{},head:{},put:{},options:{}}},channel:{channels:new Map,meta:{}},scheduler:{tasks:new Map,meta:[]},queue:{registrations:new Map,meta:{}},workflows:{registrations:new Map,meta:{}},trigger:{functions:new Map,triggers:new Map,triggerSources:new Map,meta:{},sourceMeta:{}},mcp:{resources:new Map,resourcesMeta:{},toolsMeta:{},prompts:new Map,promptsMeta:{}},agent:{agents:new Map,agentsMeta:{}},gateway:{gateways:new Map,meta:{}},cli:{meta:{programs:{},renderers:{}},programs:{}},middleware:{tagGroup:{},httpGroup:{}},channelMiddleware:{tagGroup:{}},permissions:{tagGroup:{},httpGroup:{}},misc:{errors:new Map,schemas:new Map,middleware:{},channelMiddleware:{},permissions:{}},models:{config:null},package:{factories:null,singletonServices:null,metaDir:null}}),Fqt=r=>{UR().has(r)||UR().set(r,xir())},Sir=()=>{var i;const r=(i=UR().get("__main__"))==null?void 0:i.misc.errors;if(globalThis[Lbe]=new Map,Fqt("__main__"),r){const o=UR().get("__main__");o.misc.errors=r}};UR().has("__main__")||Sir();class ea extends Error{constructor(i="An error occurred"){super(i),Object.setPrototypeOf(this,new.target.prototype)}}const ta=(r,{status:i,message:o})=>{vir(null,"misc","errors").set(r,{status:i,message:o})};class kir extends ea{}ta(kir,{status:500,message:"The middleware wire is invalid for the current wiring type."});class jir extends ea{}ta(jir,{status:500,message:"Required metadata is missing"});class Eir extends ea{}ta(Eir,{status:400,message:"The server cannot or will not process the request due to client error (e.g., malformed request syntax)."});class Cir extends ea{}class _ir extends ea{}class Tir extends ea{}ta(Cir,{status:401,message:"Authentication is required and has failed or has not yet been provided."});ta(_ir,{status:401,message:"Session missing."});ta(Tir,{status:401,message:"The session provided is not valid."});class Air extends ea{}ta(Air,{status:402,message:"Reserved for future use, often related to digital payment or subscription services."});class Mir extends ea{}ta(Mir,{status:403,message:"The client does not have permission to access the requested resource."});class Iir extends ea{}ta(Iir,{status:403,message:"The session is readonly and cannot access this function."});class Oir extends ea{}ta(Oir,{status:403,message:"The request was made from an origin that is not permitted to access this resource."});class Rir extends ea{}ta(Rir,{status:404,message:"The server cannot find the requested resource."});class Nir extends ea{}ta(Nir,{status:405,message:"The request method is known by the server but is not supported by the resource."});class Pir extends ea{}ta(Pir,{status:406,message:"The requested resource cannot produce a response matching the list of acceptable values in the request's headers."});class $ir extends ea{}ta($ir,{status:407,message:"The client must authenticate itself to get the requested response."});class Dir extends ea{}ta(Dir,{status:408,message:"The request timeout has expired."});class Lir extends ea{}ta(Lir,{status:409,message:"The request could not be completed due to a conflict with the current state of the target resource."});class Fir extends ea{}ta(Fir,{status:410,message:"The resource that is being accessed is no longer available and will not be available again."});class zir extends ea{}ta(zir,{status:411,message:"The request did not specify the length of its content, which is required by the requested resource."});class Bir extends ea{}ta(Bir,{status:412,message:"The server does not meet one of the preconditions that the requester put on the request."});class Hir extends ea{}ta(Hir,{status:413,message:"The request is larger than the server is willing or able to process."});class Uir extends ea{}ta(Uir,{status:414,message:"The URI requested by the client is longer than the server is willing to interpret."});class qir extends ea{}ta(qir,{status:415,message:"The server does not support the media format of the requested data."});class Gir extends ea{}ta(Gir,{status:416,message:"The client has asked for a portion of the file, but the server cannot supply that portion."});class Vir extends ea{}ta(Vir,{status:417,message:"The server cannot meet the requirements of the Expect request-header field."});class Jir extends ea{}ta(Jir,{status:422,message:"The server understood the content type of the request content, and the syntax of the request content was correct, but it was unable to process the contained instructions.."});class Kir extends ea{}ta(Kir,{status:423,message:"The resource is locked, meaning it can't be accessed. Its response body should contain information in WebDAV's XML format."});class Wir extends ea{}ta(Wir,{status:429,message:'The user has sent too many requests in a given amount of time ("rate limiting").'});class Yir extends ea{}ta(Yir,{status:500,message:"A generic error message, given when no more specific message is suitable."});class Xir extends ea{}ta(Xir,{status:501,message:"The server does not recognize the request method and cannot support it."});class Qir extends ea{}ta(Qir,{status:502,message:"The server was acting as a gateway or proxy and received an invalid response from the upstream server."});class Zir extends ea{}ta(Zir,{status:503,message:"The server is currently unavailable (overloaded or down)."});class esr extends ea{}ta(esr,{status:504,message:"The server was acting as a gateway or proxy and did not receive a timely response from the upstream server."});class tsr extends ea{}ta(tsr,{status:505,message:"The server does not support the HTTP protocol version used in the request."});class nsr extends ea{}ta(nsr,{status:524,message:"The server took too long to complete the request, reaching the maximum compute time allowed."});class rsr extends ea{}ta(rsr,{status:500,message:"A required schema was not found. Ensure schema generation has been run."});Date.now().toString(36);new TextEncoder;new TextDecoder;function isr(r,i){if(i.length===0)return null;let o=r.commands[i[0]];if(!o)return null;for(let a=1;a<i.length;a++){if(!o.subcommands||!o.subcommands[i[a]])return null;o=o.subcommands[i[a]]}return o}function ssr(r,i){let o={...r.options};if(i.length===0)return o;let a=r.commands[i[0]];if(a){o={...o,...a.options};for(let f=1;f<i.length;f++)a.subcommands&&a.subcommands[i[f]]&&(a=a.subcommands[i[f]],o={...o,...a.options})}return o}function osr(r,i,o=[]){const a=[],f=i.programs[r];if(!f)return`Program not found: ${r}`;if(o.length===0){a.push(`Usage: ${r} <command> [options]`),a.push(""),a.push("Commands:");for(const[g,h]of Object.entries(f.commands)){const b=h.description||"",w=h.isDefault?" (default)":"";a.push(` ${g.padEnd(20)} ${b}${w}`)}Object.keys(f.options).length>0&&(a.push(""),a.push("Options:"),aNt(f.options,a))}else{const g=isr(f,o);if(!g)return`Unknown command: ${o.join(" ")}`;let h=`${r} ${o.join(" ")}`;if(g.parameters&&(h+=" "+g.parameters),a.push(`Usage: ${h} [options]`),g.description&&(a.push(""),a.push(g.description)),g.positionals.length>0){a.push(""),a.push("Arguments:");for(const w of g.positionals){const x=w.required?"<required>":"[optional]",k=w.variadic?"...":"";a.push(` ${w.name}${k} ${x}`)}}if(g.subcommands&&Object.keys(g.subcommands).length>0){a.push(""),a.push("Subcommands:");for(const[w,x]of Object.entries(g.subcommands)){const k=x.description||"";a.push(` ${w.padEnd(20)} ${k}`)}}const b=ssr(f,o);Object.keys(b).length>0&&(a.push(""),a.push("Options:"),aNt(b,a))}return a.join(`
636
636
  `)}function aNt(r,i){for(const[o,a]of Object.entries(r)){let f=" ";a.short?f+=`-${a.short}, `:f+=" ",f+=`--${o}`,a.default!==void 0&&typeof a.default!="boolean"&&(f+=" <value>"),f=f.padEnd(30),f+=a.description||"",a.default!==void 0&&(f+=` (default: ${JSON.stringify(a.default)})`),a.choices&&(f+=` [choices: ${a.choices.join(", ")}]`),i.push(f)}}const csr=(r,i)=>{const o=r.split(`
637
637
  `),a=[];let f=!1;for(let g=0;g<o.length;g++){const h=o[g];if(h.trim()==="Commands:"||h.trim()==="Subcommands:"){f=!0,a.push({text:h+`
638
638
  `});continue}if(f&&h.trim()!==""&&!h.startsWith(" ")&&(f=!1),f&&h.startsWith(" ")){const b=h.match(/^(\s{2})(\S+)(\s.*)?$/);if(b){const[,w,x,k]=b;if(i.includes(x)){a.push({text:w}),a.push({text:x,commandName:x}),a.push({text:(k||"")+`
@@ -25,7 +25,7 @@
25
25
  }
26
26
  } catch (e) {}
27
27
  </script>
28
- <script type="module" crossorigin src="/assets/index-DiYPTQU_.js"></script>
28
+ <script type="module" crossorigin src="/assets/index-DRJQtv3c.js"></script>
29
29
  <link rel="stylesheet" crossorigin href="/assets/index-0Ui5UudO.css">
30
30
  </head>
31
31
  <body>
@@ -1,5 +1,5 @@
1
1
  /**
2
- * This file was generated by @pikku/cli@0.12.1
2
+ * This file was generated by @pikku/cli@0.12.2
3
3
  */
4
4
  import { CoreAIAgent, PikkuAIMiddlewareHooks } from '@pikku/core/ai-agent';
5
5
  import type { PikkuPermission, PikkuMiddleware, Services, PikkuFunctionConfig } from '../function/pikku-function-types.gen.js';
@@ -1,5 +1,5 @@
1
1
  /**
2
- * This file was generated by @pikku/cli@0.12.1
2
+ * This file was generated by @pikku/cli@0.12.2
3
3
  */
4
4
  import { pikkuState } from '@pikku/core/internal';
5
5
  import metaData from './pikku-agent-wirings-meta.gen.json' with { type: 'json' };
@@ -1,4 +1,4 @@
1
1
  export {};
2
2
  /**
3
- * This file was generated by @pikku/cli@0.12.1
3
+ * This file was generated by @pikku/cli@0.12.2
4
4
  */
@@ -1,4 +1,4 @@
1
1
  export {};
2
2
  /**
3
- * This file was generated by @pikku/cli@0.12.1
3
+ * This file was generated by @pikku/cli@0.12.2
4
4
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * This file was generated by @pikku/cli@0.12.1
2
+ * This file was generated by @pikku/cli@0.12.2
3
3
  */
4
4
  /**
5
5
  * Channel-specific type definitions for tree-shaking optimization
@@ -1,5 +1,5 @@
1
1
  /**
2
- * This file was generated by @pikku/cli@0.12.1
2
+ * This file was generated by @pikku/cli@0.12.2
3
3
  */
4
4
  /**
5
5
  * Channel-specific type definitions for tree-shaking optimization
@@ -1,5 +1,5 @@
1
1
  /**
2
- * This file was generated by @pikku/cli@0.12.1
2
+ * This file was generated by @pikku/cli@0.12.2
3
3
  */
4
4
  import { pikkuState } from '@pikku/core/internal';
5
5
  import metaData from './pikku-channels-meta.gen.json' with { type: 'json' };
@@ -1,4 +1,4 @@
1
1
  export {};
2
2
  /**
3
- * This file was generated by @pikku/cli@0.12.1
3
+ * This file was generated by @pikku/cli@0.12.2
4
4
  */
@@ -1,5 +1,5 @@
1
1
  export {};
2
2
  /**
3
- * This file was generated by @pikku/cli@0.12.1
3
+ * This file was generated by @pikku/cli@0.12.2
4
4
  */
5
5
  /* The files with an addChannel function call */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * This file was generated by @pikku/cli@0.12.1
2
+ * This file was generated by @pikku/cli@0.12.2
3
3
  */
4
4
  /**
5
5
  * WebSocket channel backend for 'pikku' CLI commands
@@ -17,6 +17,10 @@ import { pikkuRPCClient } from '../../src/functions/wirings/rpc/pikku-command-rp
17
17
  import { pikkuQueueService } from '../../src/functions/wirings/queue/pikku-command-queue-service.js';
18
18
  import { pikkuOpenAPI } from '../../src/functions/wirings/http/pikku-command-openapi.js';
19
19
  import { pikkuNext } from '../../src/functions/runtimes/nextjs/pikku-command-nextjs.js';
20
+ import { enableRpc } from '../../src/functions/commands/enable.js';
21
+ import { enableConsole } from '../../src/functions/commands/enable.js';
22
+ import { enableAgent } from '../../src/functions/commands/enable.js';
23
+ import { enableWorkflow } from '../../src/functions/commands/enable.js';
20
24
  import { pikkuNewFunction } from '../../src/functions/commands/new-function.js';
21
25
  import { pikkuNewWiring } from '../../src/functions/commands/new-wiring.js';
22
26
  import { pikkuNewMiddleware } from '../../src/functions/commands/new-middleware.js';
@@ -102,6 +106,22 @@ wireChannel({
102
106
  func: pikkuNext,
103
107
  middleware: [cliCloseOnComplete],
104
108
  },
109
+ 'enable.rpc': {
110
+ func: enableRpc,
111
+ middleware: [cliCloseOnComplete],
112
+ },
113
+ 'enable.console': {
114
+ func: enableConsole,
115
+ middleware: [cliCloseOnComplete],
116
+ },
117
+ 'enable.agent': {
118
+ func: enableAgent,
119
+ middleware: [cliCloseOnComplete],
120
+ },
121
+ 'enable.workflow': {
122
+ func: enableWorkflow,
123
+ middleware: [cliCloseOnComplete],
124
+ },
105
125
  'new.function': {
106
126
  func: pikkuNewFunction,
107
127
  middleware: [cliCloseOnComplete],
@@ -1,5 +1,5 @@
1
1
  /**
2
- * This file was generated by @pikku/cli@0.12.1
2
+ * This file was generated by @pikku/cli@0.12.2
3
3
  */
4
4
  import '../pikku-bootstrap.gen.js';
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  /**
2
- * This file was generated by @pikku/cli@0.12.1
2
+ * This file was generated by @pikku/cli@0.12.2
3
3
  */
4
4
  import { executeCLIViaChannel } from '@pikku/core/cli/channel';
5
5
  import { CorePikkuWebsocket } from '@pikku/websocket';
@@ -1,5 +1,5 @@
1
1
  /**
2
- * This file was generated by @pikku/cli@0.12.1
2
+ * This file was generated by @pikku/cli@0.12.2
3
3
  */
4
4
  /**
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * This file was generated by @pikku/cli@0.12.1
2
+ * This file was generated by @pikku/cli@0.12.2
3
3
  */
4
4
  /**
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * This file was generated by @pikku/cli@0.12.1
2
+ * This file was generated by @pikku/cli@0.12.2
3
3
  */
4
4
  import { pikkuState } from '@pikku/core/internal';
5
5
  import metaData from './pikku-cli-wirings-meta.gen.json' with { type: 'json' };
@@ -98,6 +98,58 @@
98
98
  "options": {},
99
99
  "description": "Generate Next.js backend and HTTP wrappers"
100
100
  },
101
+ "enable": {
102
+ "pikkuFuncId": "",
103
+ "positionals": [],
104
+ "options": {},
105
+ "description": "Enable Pikku features",
106
+ "subcommands": {
107
+ "rpc": {
108
+ "pikkuFuncId": "enableRpc",
109
+ "positionals": [],
110
+ "options": {
111
+ "no-auth": {
112
+ "description": "Disable auth requirement",
113
+ "default": false
114
+ }
115
+ },
116
+ "description": "Enable public RPC endpoint"
117
+ },
118
+ "console": {
119
+ "pikkuFuncId": "enableConsole",
120
+ "positionals": [],
121
+ "options": {
122
+ "no-auth": {
123
+ "description": "Disable auth requirement",
124
+ "default": false
125
+ }
126
+ },
127
+ "description": "Enable console functions"
128
+ },
129
+ "agent": {
130
+ "pikkuFuncId": "enableAgent",
131
+ "positionals": [],
132
+ "options": {
133
+ "no-auth": {
134
+ "description": "Disable auth requirement",
135
+ "default": false
136
+ }
137
+ },
138
+ "description": "Enable public agent endpoints"
139
+ },
140
+ "workflow": {
141
+ "pikkuFuncId": "enableWorkflow",
142
+ "positionals": [],
143
+ "options": {
144
+ "no-auth": {
145
+ "description": "Disable auth requirement",
146
+ "default": false
147
+ }
148
+ },
149
+ "description": "Enable workflow workers"
150
+ }
151
+ }
152
+ },
101
153
  "new": {
102
154
  "pikkuFuncId": "",
103
155
  "positionals": [],
@@ -1,5 +1,5 @@
1
1
  /**
2
- * This file was generated by @pikku/cli@0.12.1
2
+ * This file was generated by @pikku/cli@0.12.2
3
3
  */
4
4
  import '../../src/cli.wiring.js';
5
5
  import '../../src/services.js';
@@ -1,5 +1,5 @@
1
1
  /**
2
- * This file was generated by @pikku/cli@0.12.1
2
+ * This file was generated by @pikku/cli@0.12.2
3
3
  */
4
4
  /* The files with an wireCLI function call */
5
5
  import '../../src/cli.wiring.js';
@@ -1,5 +1,5 @@
1
1
  /**
2
- * This file was generated by @pikku/cli@0.12.1
2
+ * This file was generated by @pikku/cli@0.12.2
3
3
  */
4
4
  import '../pikku-bootstrap.gen.js';
5
5
  export declare function PikkuCLI(args: string[]): Promise<void>;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * This file was generated by @pikku/cli@0.12.1
2
+ * This file was generated by @pikku/cli@0.12.2
3
3
  */
4
4
  import { executeCLI, CLIError } from '@pikku/core/cli';
5
5
  import { createConfig as createConfig } from '../../src/services.js';
@@ -1,5 +1,5 @@
1
1
  /**
2
- * This file was generated by @pikku/cli@0.12.1
2
+ * This file was generated by @pikku/cli@0.12.2
3
3
  */
4
4
  import type { FlattenedRPCMap } from '../rpc/pikku-rpc-wirings-map.internal.gen.js';
5
5
  export type NodeCategory = never;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * This file was generated by @pikku/cli@0.12.1
2
+ * This file was generated by @pikku/cli@0.12.2
3
3
  */
4
4
  /**
5
5
  * Core function, middleware, and permission types for all wirings
@@ -1,5 +1,5 @@
1
1
  /**
2
- * This file was generated by @pikku/cli@0.12.1
2
+ * This file was generated by @pikku/cli@0.12.2
3
3
  */
4
4
  /**
5
5
  * Core function, middleware, and permission types for all wirings
@@ -1,5 +1,5 @@
1
1
  /**
2
- * This file was generated by @pikku/cli@0.12.1
2
+ * This file was generated by @pikku/cli@0.12.2
3
3
  */
4
4
  import { pikkuState } from '@pikku/core/internal';
5
5
  import metaData from './pikku-functions-meta.gen.json' with { type: 'json' };