@pikku/cli 0.12.2 → 0.12.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli.schema.json +1 -1
- package/console-app/assets/index-Ci24-VT-.js +657 -0
- package/console-app/assets/{index-0Ui5UudO.css → index-DvrDbftC.css} +1 -1
- package/console-app/index.html +2 -2
- package/dist/.pikku/agent/pikku-agent-types.gen.d.ts +1 -1
- package/dist/.pikku/agent/pikku-agent-wirings-meta.gen.js +1 -1
- package/dist/.pikku/agent/pikku-agent-wirings.gen.d.ts +1 -1
- package/dist/.pikku/agent/pikku-agent-wirings.gen.js +1 -1
- package/dist/.pikku/channel/pikku-channel-types.gen.d.ts +1 -1
- package/dist/.pikku/channel/pikku-channel-types.gen.js +1 -1
- package/dist/.pikku/channel/pikku-channels-meta.gen.js +1 -1
- package/dist/.pikku/channel/pikku-channels.gen.d.ts +1 -1
- package/dist/.pikku/channel/pikku-channels.gen.js +1 -1
- package/dist/.pikku/cli/pikku-cli-channel.d.ts +13 -1
- package/dist/.pikku/cli/pikku-cli-channel.js +17 -2
- package/dist/.pikku/cli/pikku-cli-client.gen.d.ts +1 -1
- package/dist/.pikku/cli/pikku-cli-client.gen.js +1 -1
- package/dist/.pikku/cli/pikku-cli-types.gen.d.ts +1 -1
- package/dist/.pikku/cli/pikku-cli-types.gen.js +1 -1
- package/dist/.pikku/cli/pikku-cli-wirings-meta.gen.js +1 -1
- package/dist/.pikku/cli/pikku-cli-wirings-meta.gen.json +12 -1
- package/dist/.pikku/cli/pikku-cli-wirings.gen.d.ts +1 -1
- package/dist/.pikku/cli/pikku-cli-wirings.gen.js +1 -1
- package/dist/.pikku/cli/pikku-cli.gen.d.ts +1 -1
- package/dist/.pikku/cli/pikku-cli.gen.js +1 -1
- package/dist/.pikku/console/pikku-node-types.gen.d.ts +1 -1
- package/dist/.pikku/function/pikku-function-types.gen.d.ts +30 -1
- package/dist/.pikku/function/pikku-function-types.gen.js +17 -1
- package/dist/.pikku/function/pikku-functions-meta.gen.js +1 -1
- package/dist/.pikku/function/pikku-functions-meta.gen.json +114 -114
- package/dist/.pikku/function/pikku-functions.gen.js +1 -1
- package/dist/.pikku/http/pikku-http-types.gen.d.ts +1 -1
- package/dist/.pikku/http/pikku-http-types.gen.js +1 -1
- package/dist/.pikku/http/pikku-http-wirings-meta.gen.js +1 -1
- package/dist/.pikku/http/pikku-http-wirings.gen.d.ts +1 -1
- package/dist/.pikku/http/pikku-http-wirings.gen.js +1 -1
- package/dist/.pikku/mcp/pikku-mcp-types.gen.d.ts +1 -1
- package/dist/.pikku/mcp/pikku-mcp-types.gen.js +1 -1
- package/dist/.pikku/mcp/pikku-mcp-wirings-meta.gen.js +1 -1
- package/dist/.pikku/mcp/pikku-mcp-wirings.gen.d.ts +1 -1
- package/dist/.pikku/mcp/pikku-mcp-wirings.gen.js +1 -1
- package/dist/.pikku/pikku-bootstrap.gen.js +1 -1
- package/dist/.pikku/pikku-services.gen.d.ts +3 -1
- package/dist/.pikku/pikku-services.gen.js +2 -0
- package/dist/.pikku/pikku-types.gen.d.ts +1 -1
- package/dist/.pikku/pikku-types.gen.js +1 -1
- package/dist/.pikku/pikku-websocket.gen.d.ts +1 -1
- package/dist/.pikku/pikku-websocket.gen.js +1 -1
- package/dist/.pikku/queue/pikku-queue-types.gen.d.ts +1 -1
- package/dist/.pikku/queue/pikku-queue-types.gen.js +1 -1
- package/dist/.pikku/queue/pikku-queue-workers-wirings-meta.gen.js +1 -1
- package/dist/.pikku/queue/pikku-queue-workers-wirings.gen.d.ts +1 -1
- package/dist/.pikku/queue/pikku-queue-workers-wirings.gen.js +1 -1
- package/dist/.pikku/rpc/pikku-remote-rpc-workers.gen.js +1 -1
- package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.js +1 -1
- package/dist/.pikku/scheduler/pikku-scheduler-types.gen.d.ts +1 -1
- package/dist/.pikku/scheduler/pikku-scheduler-types.gen.js +1 -1
- package/dist/.pikku/scheduler/pikku-schedulers-wirings-meta.gen.js +1 -1
- package/dist/.pikku/scheduler/pikku-schedulers-wirings.gen.d.ts +1 -1
- package/dist/.pikku/scheduler/pikku-schedulers-wirings.gen.js +1 -1
- package/dist/.pikku/schemas/register.gen.js +9 -9
- package/dist/.pikku/schemas/schemas/ConsoleCommandInput.schema.json +1 -1
- package/dist/.pikku/schemas/schemas/PikkuCLIConfig.schema.json +1 -1
- package/dist/.pikku/schemas/schemas/PikkuNewAddonInput.schema.json +1 -1
- package/dist/.pikku/secrets/pikku-secret-types.gen.d.ts +1 -1
- package/dist/.pikku/secrets/pikku-secret-types.gen.js +1 -1
- package/dist/.pikku/secrets/pikku-secrets.gen.d.ts +1 -1
- package/dist/.pikku/secrets/pikku-secrets.gen.js +1 -1
- package/dist/.pikku/trigger/pikku-trigger-types.gen.d.ts +1 -1
- package/dist/.pikku/trigger/pikku-trigger-types.gen.js +1 -1
- package/dist/.pikku/variables/pikku-variable-types.gen.d.ts +1 -1
- package/dist/.pikku/variables/pikku-variable-types.gen.js +1 -1
- package/dist/.pikku/variables/pikku-variables.gen.d.ts +1 -1
- package/dist/.pikku/variables/pikku-variables.gen.js +1 -1
- package/dist/.pikku/workflow/pikku-workflow-types.gen.d.ts +1 -1
- package/dist/.pikku/workflow/pikku-workflow-types.gen.js +1 -1
- package/dist/.pikku/workflow/pikku-workflow-wirings-meta.gen.js +1 -1
- package/dist/.pikku/workflow/pikku-workflow-wirings.gen.d.ts +1 -1
- package/dist/.pikku/workflow/pikku-workflow-wirings.gen.js +1 -1
- package/dist/src/cli.wiring.js +9 -0
- package/dist/src/functions/commands/all.js +33 -11
- package/dist/src/functions/commands/console.d.ts +3 -0
- package/dist/src/functions/commands/console.js +4 -2
- package/dist/src/functions/commands/new-addon.d.ts +3 -0
- package/dist/src/functions/commands/new-addon.js +8 -6
- package/dist/src/functions/wirings/ai-agent/serialize-public-agent.js +19 -0
- package/dist/src/functions/wirings/channels/pikku-command-channels-map.js +1 -1
- package/dist/src/functions/wirings/channels/serialize-typed-channel-map.d.ts +1 -1
- package/dist/src/functions/wirings/channels/serialize-typed-channel-map.js +7 -6
- package/dist/src/functions/wirings/cli/pikku-command-cli-entry.js +9 -1
- package/dist/src/functions/wirings/cli/serialize-channel-cli.js +35 -12
- package/dist/src/functions/wirings/console/pikku-command-node-types.js +2 -2
- package/dist/src/functions/wirings/console/pikku-command-nodes-meta.js +20 -11
- package/dist/src/functions/wirings/console/serialize-console-functions.js +1 -1
- package/dist/src/functions/wirings/functions/pikku-command-function-types-split.js +1 -1
- package/dist/src/functions/wirings/functions/serialize-addon-types.js +23 -1
- package/dist/src/functions/wirings/functions/serialize-function-types.js +38 -0
- package/dist/src/services.js +1 -1
- package/dist/src/utils/file-import-path.js +5 -2
- package/dist/src/utils/openapi/codegen.d.ts +1 -0
- package/dist/src/utils/openapi/codegen.js +214 -46
- package/dist/src/utils/openapi/parse-openapi.d.ts +25 -0
- package/dist/src/utils/openapi/parse-openapi.js +119 -9
- package/dist/src/utils/openapi/zod-codegen.d.ts +1 -53
- package/dist/src/utils/openapi/zod-codegen.js +1 -251
- package/dist/src/utils/pikku-cli-config.js +2 -2
- package/dist/src/utils/strip-verbose-meta.d.ts +2 -0
- package/dist/src/utils/strip-verbose-meta.js +34 -0
- package/package.json +4 -3
- package/console-app/assets/index-DRJQtv3c.js +0 -676
|
@@ -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" }, "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 } } }
|
|
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": { "anyOf": [{ "type": "boolean" }, { "type": "object", "properties": { "categories": { "type": "array", "items": { "type": "string" } }, "icon": { "type": "string" }, "displayName": { "type": "string" }, "description": { "type": "string" } }, "additionalProperties": false }] }, "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 }, "addonMetaJsonFile": { "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 } } }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{ "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "properties": { "name": { "type": "string" }, "displayName": { "type": "string" }, "description": { "type": "string" }, "category": { "type": "string" }, "dir": { "type": "string" }, "secret": { "type": "boolean" }, "variable": { "type": "boolean" }, "oauth": { "type": "boolean" }, "test": { "type": "boolean" }, "openapi": { "type": "string" } }, "required": ["name"], "additionalProperties": false, "definitions": {} }
|
|
1
|
+
{ "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "properties": { "name": { "type": "string" }, "displayName": { "type": "string" }, "description": { "type": "string" }, "category": { "type": "string" }, "dir": { "type": "string" }, "secret": { "type": "boolean" }, "variable": { "type": "boolean" }, "oauth": { "type": "boolean" }, "test": { "type": "boolean" }, "openapi": { "type": "string" }, "mcp": { "type": "boolean" } }, "required": ["name"], "additionalProperties": false, "definitions": {} }
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* This file was generated by @pikku/cli@0.12.
|
|
2
|
+
* This file was generated by @pikku/cli@0.12.3
|
|
3
3
|
*/
|
|
4
4
|
export { wireVariable } from '@pikku/core/variable';
|
|
5
5
|
export type { CoreVariable, VariableDefinitionMeta, VariableDefinitionsMeta } from '@pikku/core/variable';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* This file was generated by @pikku/cli@0.12.
|
|
2
|
+
* This file was generated by @pikku/cli@0.12.3
|
|
3
3
|
*/
|
|
4
4
|
import { WorkflowCancelledException } from '@pikku/core/workflow';
|
|
5
5
|
import { workflow as coreWorkflow, workflowStart as coreWorkflowStart, workflowStatus as coreWorkflowStatus, graphStart as coreGraphStart, } from '@pikku/core/workflow';
|
package/dist/src/cli.wiring.js
CHANGED
|
@@ -97,6 +97,11 @@ wireCLI({
|
|
|
97
97
|
default: '51442',
|
|
98
98
|
short: 'p',
|
|
99
99
|
},
|
|
100
|
+
open: {
|
|
101
|
+
description: 'Open the console in the browser',
|
|
102
|
+
default: 'false',
|
|
103
|
+
short: 'o',
|
|
104
|
+
},
|
|
100
105
|
},
|
|
101
106
|
}),
|
|
102
107
|
schemas: pikkuCLICommand({
|
|
@@ -261,6 +266,10 @@ wireCLI({
|
|
|
261
266
|
openapi: {
|
|
262
267
|
description: 'Path to OpenAPI YAML/JSON spec to generate functions from',
|
|
263
268
|
},
|
|
269
|
+
mcp: {
|
|
270
|
+
description: 'Add mcp: true to generated functions (expose as MCP tools)',
|
|
271
|
+
default: false,
|
|
272
|
+
},
|
|
264
273
|
},
|
|
265
274
|
}),
|
|
266
275
|
},
|
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
import { existsSync } from 'fs';
|
|
2
2
|
import { pikkuVoidFunc } from '#pikku';
|
|
3
|
+
const scaffoldFiles = (config) => {
|
|
4
|
+
const files = [];
|
|
5
|
+
if (config.scaffold?.rpc && config.publicRpcFile)
|
|
6
|
+
files.push({ file: config.publicRpcFile, generator: 'pikkuPublicRPC' });
|
|
7
|
+
if (config.scaffold?.console && config.consoleFunctionsFile)
|
|
8
|
+
files.push({
|
|
9
|
+
file: config.consoleFunctionsFile,
|
|
10
|
+
generator: 'pikkuConsoleFunctions',
|
|
11
|
+
});
|
|
12
|
+
if (config.scaffold?.agent && config.publicAgentFile)
|
|
13
|
+
files.push({
|
|
14
|
+
file: config.publicAgentFile,
|
|
15
|
+
generator: 'pikkuPublicAgent',
|
|
16
|
+
});
|
|
17
|
+
return files;
|
|
18
|
+
};
|
|
3
19
|
export const all = pikkuVoidFunc({
|
|
4
20
|
remote: true,
|
|
5
21
|
func: async ({ logger, config, getInspectorState }, _data, { rpc }) => {
|
|
@@ -8,9 +24,15 @@ export const all = pikkuVoidFunc({
|
|
|
8
24
|
if (!existsSync(config.typesDeclarationFile)) {
|
|
9
25
|
typesDeclarationFileExists = false;
|
|
10
26
|
}
|
|
27
|
+
const missingScaffolds = scaffoldFiles(config).filter((s) => !existsSync(s.file));
|
|
28
|
+
if (missingScaffolds.length > 0) {
|
|
29
|
+
for (const { generator } of missingScaffolds) {
|
|
30
|
+
await rpc.invoke(generator, null);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
11
33
|
await rpc.invoke('pikkuFunctionTypes', null);
|
|
12
|
-
if (!typesDeclarationFileExists) {
|
|
13
|
-
logger.debug(`• Type file first created, inspecting again...`);
|
|
34
|
+
if (!typesDeclarationFileExists || missingScaffolds.length > 0) {
|
|
35
|
+
logger.debug(`• Type file or scaffolds first created, inspecting again...`);
|
|
14
36
|
await getInspectorState(true);
|
|
15
37
|
}
|
|
16
38
|
await rpc.invoke('pikkuFunctionTypesSplit', null);
|
|
@@ -66,6 +88,15 @@ export const all = pikkuVoidFunc({
|
|
|
66
88
|
}
|
|
67
89
|
await rpc.invoke('pikkuRPCInternalMap', null);
|
|
68
90
|
await rpc.invoke('pikkuRPCExposedMap', null);
|
|
91
|
+
const workflows = await rpc.invoke('pikkuWorkflow', null);
|
|
92
|
+
let remoteRPC = false;
|
|
93
|
+
if (!config.addon) {
|
|
94
|
+
remoteRPC = await rpc.invoke('pikkuRemoteRPC', null);
|
|
95
|
+
}
|
|
96
|
+
if (workflows || remoteRPC) {
|
|
97
|
+
await getInspectorState(true);
|
|
98
|
+
await rpc.invoke('pikkuSchemas', null);
|
|
99
|
+
}
|
|
69
100
|
if (!config.addon) {
|
|
70
101
|
const http = await rpc.invoke('pikkuHTTP', null);
|
|
71
102
|
if (http) {
|
|
@@ -82,15 +113,6 @@ export const all = pikkuVoidFunc({
|
|
|
82
113
|
allImports.push(config.triggersWiringMetaFile, config.triggerSourcesMetaFile, config.triggersWiringFile);
|
|
83
114
|
}
|
|
84
115
|
}
|
|
85
|
-
const workflows = await rpc.invoke('pikkuWorkflow', null);
|
|
86
|
-
let remoteRPC = false;
|
|
87
|
-
if (!config.addon) {
|
|
88
|
-
remoteRPC = await rpc.invoke('pikkuRemoteRPC', null);
|
|
89
|
-
}
|
|
90
|
-
if (workflows || remoteRPC) {
|
|
91
|
-
await getInspectorState(true);
|
|
92
|
-
await rpc.invoke('pikkuSchemas', null);
|
|
93
|
-
}
|
|
94
116
|
const hasFunctionRegistrations = await rpc.invoke('pikkuFunctions', null);
|
|
95
117
|
allImports.push(config.functionsMetaFile);
|
|
96
118
|
if (hasFunctionRegistrations) {
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
export declare const consoleCommand: import("#pikku").PikkuFunctionConfig<{
|
|
2
2
|
port?: string;
|
|
3
|
+
open?: string;
|
|
3
4
|
}, void, "session" | "rpc", import("#pikku").PikkuFunctionSessionless<{
|
|
4
5
|
port?: string;
|
|
6
|
+
open?: string;
|
|
5
7
|
}, void, "session" | "rpc", import("#pikku").Services> | import("#pikku").PikkuFunction<{
|
|
6
8
|
port?: string;
|
|
9
|
+
open?: string;
|
|
7
10
|
}, void, "session" | "rpc", import("#pikku").Services>, undefined, undefined>;
|
|
@@ -21,7 +21,7 @@ const MIME_TYPES = {
|
|
|
21
21
|
};
|
|
22
22
|
export const consoleCommand = pikkuSessionlessFunc({
|
|
23
23
|
remote: true,
|
|
24
|
-
func: async ({ logger, config }, { port }, { rpc }) => {
|
|
24
|
+
func: async ({ logger, config }, { port, open: openBrowser }, { rpc }) => {
|
|
25
25
|
const consoleDir = join(fileURLToPath(import.meta.url), '..', '..', '..', '..', '..', 'console-app');
|
|
26
26
|
const resolvedPort = parseInt(port || '51442', 10);
|
|
27
27
|
try {
|
|
@@ -57,7 +57,9 @@ export const consoleCommand = pikkuSessionlessFunc({
|
|
|
57
57
|
});
|
|
58
58
|
server.listen(resolvedPort, () => {
|
|
59
59
|
logger.info(`Pikku Console running at http://localhost:${resolvedPort}`);
|
|
60
|
-
|
|
60
|
+
if (openBrowser === 'true') {
|
|
61
|
+
open(`http://localhost:${resolvedPort}`);
|
|
62
|
+
}
|
|
61
63
|
});
|
|
62
64
|
const configWatcher = chokidar.watch(config.srcDirectories, {
|
|
63
65
|
ignoreInitial: true,
|
|
@@ -9,6 +9,7 @@ export declare const pikkuNewAddon: import("#pikku").PikkuFunctionConfig<{
|
|
|
9
9
|
oauth?: boolean;
|
|
10
10
|
test?: boolean;
|
|
11
11
|
openapi?: string;
|
|
12
|
+
mcp?: boolean;
|
|
12
13
|
}, void, "session" | "rpc", import("#pikku").PikkuFunctionSessionless<{
|
|
13
14
|
name: string;
|
|
14
15
|
displayName?: string;
|
|
@@ -20,6 +21,7 @@ export declare const pikkuNewAddon: import("#pikku").PikkuFunctionConfig<{
|
|
|
20
21
|
oauth?: boolean;
|
|
21
22
|
test?: boolean;
|
|
22
23
|
openapi?: string;
|
|
24
|
+
mcp?: boolean;
|
|
23
25
|
}, void, "session" | "rpc", import("#pikku").Services> | import("#pikku").PikkuFunction<{
|
|
24
26
|
name: string;
|
|
25
27
|
displayName?: string;
|
|
@@ -31,4 +33,5 @@ export declare const pikkuNewAddon: import("#pikku").PikkuFunctionConfig<{
|
|
|
31
33
|
oauth?: boolean;
|
|
32
34
|
test?: boolean;
|
|
33
35
|
openapi?: string;
|
|
36
|
+
mcp?: boolean;
|
|
34
37
|
}, void, "session" | "rpc", import("#pikku").Services>, undefined, undefined>;
|
|
@@ -117,9 +117,9 @@ import { pikkuAddonServices } from '#pikku'
|
|
|
117
117
|
|
|
118
118
|
export const createSingletonServices = pikkuAddonServices(async (
|
|
119
119
|
config,
|
|
120
|
-
{ secrets }
|
|
120
|
+
{ secrets, variables }
|
|
121
121
|
) => {
|
|
122
|
-
const ${camelName} = new ${pascalName}Service(secrets)
|
|
122
|
+
const ${camelName} = new ${pascalName}Service(secrets, variables)
|
|
123
123
|
|
|
124
124
|
return { ${camelName} }
|
|
125
125
|
})
|
|
@@ -133,10 +133,10 @@ import { pikkuAddonServices } from '#pikku'
|
|
|
133
133
|
|
|
134
134
|
export const createSingletonServices = pikkuAddonServices(async (
|
|
135
135
|
config,
|
|
136
|
-
{ secrets }
|
|
136
|
+
{ secrets, variables }
|
|
137
137
|
) => {
|
|
138
138
|
const creds = await secrets.getSecretJSON<${pascalName}Secrets>('${screamingName}_CREDENTIALS')
|
|
139
|
-
const ${camelName} = new ${pascalName}Service(creds)
|
|
139
|
+
const ${camelName} = new ${pascalName}Service(creds, variables)
|
|
140
140
|
|
|
141
141
|
return { ${camelName} }
|
|
142
142
|
})
|
|
@@ -149,8 +149,9 @@ import { pikkuAddonServices } from '#pikku'
|
|
|
149
149
|
|
|
150
150
|
export const createSingletonServices = pikkuAddonServices(async (
|
|
151
151
|
config,
|
|
152
|
+
{ variables }
|
|
152
153
|
) => {
|
|
153
|
-
const ${camelName} = new ${pascalName}Service()
|
|
154
|
+
const ${camelName} = new ${pascalName}Service(variables)
|
|
154
155
|
|
|
155
156
|
return { ${camelName} }
|
|
156
157
|
})
|
|
@@ -581,7 +582,7 @@ async function writeFiles(baseDir, files) {
|
|
|
581
582
|
return written;
|
|
582
583
|
}
|
|
583
584
|
export const pikkuNewAddon = pikkuSessionlessFunc({
|
|
584
|
-
func: async ({ logger, config }, { name, displayName, description, category = 'General', dir, secret = false, variable = false, oauth = false, test = true, openapi, }) => {
|
|
585
|
+
func: async ({ logger, config }, { name, displayName, description, category = 'General', dir, secret = false, variable = false, oauth = false, test = true, openapi, mcp = false, }) => {
|
|
585
586
|
if (!/^[a-z][a-z0-9_-]*$/.test(name)) {
|
|
586
587
|
logger.error(`Invalid addon name "${name}": must start with a lowercase letter and contain only lowercase alphanumerics, hyphens, and underscores`);
|
|
587
588
|
process.exit(1);
|
|
@@ -617,6 +618,7 @@ export const pikkuNewAddon = pikkuSessionlessFunc({
|
|
|
617
618
|
const openapiFiles = generateAddonFromOpenAPI(spec, vars, {
|
|
618
619
|
oauth,
|
|
619
620
|
secret: secret || oauth,
|
|
621
|
+
mcp,
|
|
620
622
|
});
|
|
621
623
|
Object.assign(addonFiles, openapiFiles);
|
|
622
624
|
}
|
|
@@ -40,6 +40,19 @@ export const agentApproveCaller = pikkuSessionlessFunc<
|
|
|
40
40
|
},
|
|
41
41
|
})
|
|
42
42
|
|
|
43
|
+
export const agentResumeCaller = pikkuSessionlessFunc<
|
|
44
|
+
{ agentName: string; runId: string; toolCallId: string; approved: boolean },
|
|
45
|
+
void
|
|
46
|
+
>({
|
|
47
|
+
auth: ${authFlag},
|
|
48
|
+
func: async (_services, data, { rpc }) => {
|
|
49
|
+
await rpc.agent.resume(data.runId, {
|
|
50
|
+
toolCallId: data.toolCallId,
|
|
51
|
+
approved: data.approved,
|
|
52
|
+
})
|
|
53
|
+
},
|
|
54
|
+
})
|
|
55
|
+
|
|
43
56
|
export const agentRoutes = defineHTTPRoutes({
|
|
44
57
|
auth: ${authFlag},
|
|
45
58
|
tags: ['pikku:public'],
|
|
@@ -60,6 +73,12 @@ export const agentRoutes = defineHTTPRoutes({
|
|
|
60
73
|
method: 'post',
|
|
61
74
|
func: agentApproveCaller,
|
|
62
75
|
},
|
|
76
|
+
agentResume: {
|
|
77
|
+
route: '/rpc/agent/:agentName/resume',
|
|
78
|
+
method: 'post',
|
|
79
|
+
sse: true,
|
|
80
|
+
func: agentResumeCaller,
|
|
81
|
+
},
|
|
63
82
|
},
|
|
64
83
|
})
|
|
65
84
|
|
|
@@ -6,7 +6,7 @@ export const pikkuChannelsMap = pikkuSessionlessFunc({
|
|
|
6
6
|
func: async ({ logger, config, getInspectorState }) => {
|
|
7
7
|
const state = await getInspectorState();
|
|
8
8
|
const { channelsMapDeclarationFile, packageMappings } = config;
|
|
9
|
-
const content = serializeTypedChannelsMap(logger, channelsMapDeclarationFile, packageMappings, state.functions.typesMap, state.functions.meta, state.channels.meta);
|
|
9
|
+
const content = serializeTypedChannelsMap(logger, channelsMapDeclarationFile, packageMappings, state.functions.typesMap, state.functions.meta, state.addonFunctions, state.channels.meta);
|
|
10
10
|
await writeFileInDir(logger, channelsMapDeclarationFile, content);
|
|
11
11
|
},
|
|
12
12
|
middleware: [
|
|
@@ -2,4 +2,4 @@ import type { ChannelsMeta } from '@pikku/core/channel';
|
|
|
2
2
|
import type { TypesMap } from '@pikku/inspector';
|
|
3
3
|
import type { FunctionsMeta } from '@pikku/core';
|
|
4
4
|
import type { Logger } from '@pikku/core/services';
|
|
5
|
-
export declare const serializeTypedChannelsMap: (logger: Logger, relativeToPath: string, packageMappings: Record<string, string>, typesMap: TypesMap, functionsMeta: FunctionsMeta, channelsMeta: ChannelsMeta) => string;
|
|
5
|
+
export declare const serializeTypedChannelsMap: (logger: Logger, relativeToPath: string, packageMappings: Record<string, string>, typesMap: TypesMap, functionsMeta: FunctionsMeta, addonFunctions: Record<string, FunctionsMeta>, channelsMeta: ChannelsMeta) => string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { serializeImportMap } from '../../../utils/serialize-import-map.js';
|
|
2
|
-
import { generateCustomTypes } from '@pikku/inspector';
|
|
3
|
-
export const serializeTypedChannelsMap = (logger, relativeToPath, packageMappings, typesMap, functionsMeta, channelsMeta) => {
|
|
4
|
-
const { channels, requiredTypes } = generateChannels(functionsMeta, channelsMeta);
|
|
2
|
+
import { generateCustomTypes, resolveFunctionMeta } from '@pikku/inspector';
|
|
3
|
+
export const serializeTypedChannelsMap = (logger, relativeToPath, packageMappings, typesMap, functionsMeta, addonFunctions, channelsMeta) => {
|
|
4
|
+
const { channels, requiredTypes } = generateChannels(functionsMeta, addonFunctions, channelsMeta);
|
|
5
5
|
typesMap.customTypes.forEach(({ references }) => {
|
|
6
6
|
for (const reference of references) {
|
|
7
7
|
if (reference !== '__object' && !reference.startsWith('__object_')) {
|
|
@@ -40,7 +40,8 @@ export type ChannelWiringHandlerOf<
|
|
|
40
40
|
: never;
|
|
41
41
|
`;
|
|
42
42
|
};
|
|
43
|
-
function generateChannels(functionsMeta, channelsMeta) {
|
|
43
|
+
function generateChannels(functionsMeta, addonFunctions, channelsMeta) {
|
|
44
|
+
const state = { functions: { meta: functionsMeta }, addonFunctions };
|
|
44
45
|
const requiredTypes = new Set();
|
|
45
46
|
const channelsObject = {};
|
|
46
47
|
for (const meta of Object.values(channelsMeta)) {
|
|
@@ -49,7 +50,7 @@ function generateChannels(functionsMeta, channelsMeta) {
|
|
|
49
50
|
channelsObject[name] = { message: null, routes: {} };
|
|
50
51
|
}
|
|
51
52
|
if (message) {
|
|
52
|
-
const func =
|
|
53
|
+
const func = resolveFunctionMeta(state, message.pikkuFuncId);
|
|
53
54
|
if (!func) {
|
|
54
55
|
throw new Error(`Function ${message.pikkuFuncId} not found in functionsMeta for channel ${name}`);
|
|
55
56
|
}
|
|
@@ -67,7 +68,7 @@ function generateChannels(functionsMeta, channelsMeta) {
|
|
|
67
68
|
channelsObject[name].routes[key] = {};
|
|
68
69
|
}
|
|
69
70
|
for (const [method, { pikkuFuncId }] of Object.entries(route)) {
|
|
70
|
-
const func =
|
|
71
|
+
const func = resolveFunctionMeta(state, pikkuFuncId);
|
|
71
72
|
if (!func) {
|
|
72
73
|
throw new Error(`Function ${pikkuFuncId} not found in functionsMeta for channel ${name}, route ${key}, method ${method}`);
|
|
73
74
|
}
|
|
@@ -47,7 +47,15 @@ export const pikkuCLIEntry = pikkuSessionlessFunc({
|
|
|
47
47
|
const channelClientPath = entrypointConfig.path;
|
|
48
48
|
const channelName = entrypointConfig.name;
|
|
49
49
|
const channelRoute = entrypointConfig.route;
|
|
50
|
-
|
|
50
|
+
// Validate wirePath is not inside the output directory
|
|
51
|
+
const resolvedWirePath = join(config.rootDir, channelWirePath);
|
|
52
|
+
const resolvedOutDir = join(config.rootDir, config.outDir);
|
|
53
|
+
if (resolvedWirePath.startsWith(resolvedOutDir)) {
|
|
54
|
+
throw new Error(`CLI channel wirePath "${channelWirePath}" must not be inside the output directory "${config.outDir}". ` +
|
|
55
|
+
`The wire file uses wireChannel() which must be in a source directory so the inspector can discover it. ` +
|
|
56
|
+
`Move it to a source directory like "src/wirings/cli-channel.gen.ts".`);
|
|
57
|
+
}
|
|
58
|
+
const channelWireFile = resolvedWirePath;
|
|
51
59
|
const channelCode = serializeChannelCLI(programName, programMeta, channelWireFile, visitState.functions.files, config.packageMappings, config.channelsTypesFile, config.functionTypesFile, channelName, channelRoute);
|
|
52
60
|
await writeFileInDir(logger, channelWireFile, channelCode);
|
|
53
61
|
logger.debug(`Serialized CLI channel for ${programName}: ${channelWireFile}`);
|
|
@@ -15,6 +15,7 @@ export function serializeChannelCLI(programName, programMeta, channelFile, funct
|
|
|
15
15
|
if (cmd.pikkuFuncId) {
|
|
16
16
|
commandMap[commandKey] = {
|
|
17
17
|
pikkuFuncId: cmd.pikkuFuncId,
|
|
18
|
+
isAddon: !!cmd.packageName,
|
|
18
19
|
};
|
|
19
20
|
}
|
|
20
21
|
// Recursively process subcommands
|
|
@@ -24,20 +25,21 @@ export function serializeChannelCLI(programName, programMeta, channelFile, funct
|
|
|
24
25
|
}
|
|
25
26
|
};
|
|
26
27
|
collectCommands(programMeta.commands);
|
|
27
|
-
|
|
28
|
-
const funcNames = [
|
|
28
|
+
const allFuncs = [
|
|
29
29
|
...new Set(Object.values(commandMap).map((v) => v.pikkuFuncId)),
|
|
30
30
|
];
|
|
31
|
-
const
|
|
32
|
-
|
|
31
|
+
const localFuncs = allFuncs.filter((id) => !Object.values(commandMap).find((v) => v.pikkuFuncId === id && v.isAddon));
|
|
32
|
+
const hasAddonFuncs = allFuncs.length > localFuncs.length;
|
|
33
|
+
const importLines = [];
|
|
34
|
+
for (const pikkuFuncId of localFuncs) {
|
|
33
35
|
const fileInfo = functionFiles.get(pikkuFuncId);
|
|
34
36
|
if (!fileInfo) {
|
|
35
37
|
throw new Error(`Function not found in files map: ${pikkuFuncId}`);
|
|
36
38
|
}
|
|
37
39
|
const importPath = getFileImportRelativePath(channelFile, fileInfo.path, packageMappings);
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
|
|
40
|
+
importLines.push(`import { ${fileInfo.exportedName} } from '${importPath}'`);
|
|
41
|
+
}
|
|
42
|
+
const imports = importLines.join('\n');
|
|
41
43
|
// Get relative path to channel types file
|
|
42
44
|
const channelTypesPath = getFileImportRelativePath(channelFile, channelTypesFile, packageMappings);
|
|
43
45
|
// Get relative path to function types file
|
|
@@ -46,7 +48,9 @@ export function serializeChannelCLI(programName, programMeta, channelFile, funct
|
|
|
46
48
|
* WebSocket channel backend for '${programName}' CLI commands
|
|
47
49
|
*/
|
|
48
50
|
import { wireChannel } from '${channelTypesPath}'
|
|
49
|
-
import { pikkuMiddleware } from '${functionTypesPath}'
|
|
51
|
+
import { pikkuMiddleware${hasAddonFuncs ? ', addon' : ''}, pikkuSessionlessFunc } from '${functionTypesPath}'
|
|
52
|
+
import { generateCommandHelp } from '@pikku/core/cli'
|
|
53
|
+
import { pikkuState } from '@pikku/core/internal'
|
|
50
54
|
${imports}
|
|
51
55
|
|
|
52
56
|
// Middleware to close the channel after CLI command completes
|
|
@@ -61,7 +65,7 @@ const cliCloseOnComplete = pikkuMiddleware(async (_services, { channel }, next)
|
|
|
61
65
|
}
|
|
62
66
|
}, 200)
|
|
63
67
|
}
|
|
64
|
-
|
|
68
|
+
|
|
65
69
|
try {
|
|
66
70
|
const result = await next()
|
|
67
71
|
closeChannel()
|
|
@@ -72,17 +76,36 @@ const cliCloseOnComplete = pikkuMiddleware(async (_services, { channel }, next)
|
|
|
72
76
|
}
|
|
73
77
|
})
|
|
74
78
|
|
|
79
|
+
export const cliHelp = pikkuSessionlessFunc<{ args?: string[] }, { help: string }>({
|
|
80
|
+
auth: false,
|
|
81
|
+
func: async (_services, data: { args?: string[] }) => {
|
|
82
|
+
const cliMeta = pikkuState(null, 'cli', 'meta')
|
|
83
|
+
const commandPath = data?.args?.length ? data.args : []
|
|
84
|
+
const helpText = generateCommandHelp('${programName}', cliMeta as any, commandPath)
|
|
85
|
+
return { help: helpText }
|
|
86
|
+
},
|
|
87
|
+
})
|
|
88
|
+
|
|
75
89
|
wireChannel({
|
|
76
90
|
name: '${finalChannelName}',
|
|
77
91
|
route: '${finalChannelRoute}',
|
|
78
92
|
auth: false,
|
|
79
93
|
onMessageWiring: {
|
|
80
94
|
command: {
|
|
95
|
+
'__help': {
|
|
96
|
+
func: cliHelp,
|
|
97
|
+
middleware: [cliCloseOnComplete],
|
|
98
|
+
},
|
|
81
99
|
${Object.entries(commandMap)
|
|
82
|
-
.map(([commandKey, { pikkuFuncId }]) =>
|
|
83
|
-
|
|
100
|
+
.map(([commandKey, { pikkuFuncId, isAddon }]) => {
|
|
101
|
+
const funcRef = isAddon
|
|
102
|
+
? `addon('${pikkuFuncId}')`
|
|
103
|
+
: (functionFiles.get(pikkuFuncId)?.exportedName ?? pikkuFuncId);
|
|
104
|
+
return ` '${commandKey}': {
|
|
105
|
+
func: ${funcRef},
|
|
84
106
|
middleware: [cliCloseOnComplete],
|
|
85
|
-
}
|
|
107
|
+
}`;
|
|
108
|
+
})
|
|
86
109
|
.join(',\n')}
|
|
87
110
|
}
|
|
88
111
|
},
|