lua-cli 3.12.2 ā 3.14.0
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/README.md +14 -13
- package/dist/api/agent.api.service.d.ts +20 -20
- package/dist/api/agent.api.service.d.ts.map +1 -1
- package/dist/api/agent.api.service.js +1 -1
- package/dist/api/agent.api.service.js.map +1 -1
- package/dist/api/agents.api.service.d.ts +3 -3
- package/dist/api/agents.api.service.d.ts.map +1 -1
- package/dist/api/agents.api.service.js +11 -9
- package/dist/api/agents.api.service.js.map +1 -1
- package/dist/api/ai.api.service.d.ts +4 -4
- package/dist/api/ai.api.service.d.ts.map +1 -1
- package/dist/api/ai.api.service.js +10 -8
- package/dist/api/ai.api.service.js.map +1 -1
- package/dist/api/auth.api.service.d.ts +3 -3
- package/dist/api/auth.api.service.d.ts.map +1 -1
- package/dist/api/auth.api.service.js +1 -1
- package/dist/api/auth.api.service.js.map +1 -1
- package/dist/api/backup.api.service.d.ts.map +1 -1
- package/dist/api/backup.api.service.js +21 -7
- package/dist/api/backup.api.service.js.map +1 -1
- package/dist/api/basket.api.service.d.ts +5 -5
- package/dist/api/basket.api.service.d.ts.map +1 -1
- package/dist/api/basket.api.service.js +4 -4
- package/dist/api/basket.api.service.js.map +1 -1
- package/dist/api/cdn.api.service.d.ts +1 -1
- package/dist/api/cdn.api.service.js +3 -3
- package/dist/api/cdn.api.service.js.map +1 -1
- package/dist/api/chat.api.service.d.ts +4 -4
- package/dist/api/chat.api.service.js +3 -3
- package/dist/api/chat.api.service.js.map +1 -1
- package/dist/api/credentials.js +3 -3
- package/dist/api/custom.data.api.service.d.ts +4 -4
- package/dist/api/custom.data.api.service.d.ts.map +1 -1
- package/dist/api/custom.data.api.service.js +2 -2
- package/dist/api/custom.data.api.service.js.map +1 -1
- package/dist/api/developer.api.service.d.ts +3 -3
- package/dist/api/developer.api.service.d.ts.map +1 -1
- package/dist/api/developer.api.service.js +7 -3
- package/dist/api/developer.api.service.js.map +1 -1
- package/dist/api/device-trigger.api.service.d.ts +3 -3
- package/dist/api/device-trigger.api.service.d.ts.map +1 -1
- package/dist/api/device-trigger.api.service.js +1 -1
- package/dist/api/device-trigger.api.service.js.map +1 -1
- package/dist/api/device.api.service.d.ts +3 -3
- package/dist/api/device.api.service.d.ts.map +1 -1
- package/dist/api/device.api.service.js +1 -1
- package/dist/api/device.api.service.js.map +1 -1
- package/dist/api/http.client.d.ts +1 -1
- package/dist/api/http.client.d.ts.map +1 -1
- package/dist/api/http.client.js +6 -6
- package/dist/api/http.client.js.map +1 -1
- package/dist/api/job.api.service.d.ts +13 -14
- package/dist/api/job.api.service.d.ts.map +1 -1
- package/dist/api/job.api.service.js +12 -20
- package/dist/api/job.api.service.js.map +1 -1
- package/dist/api/lazy-instances.d.ts +12 -12
- package/dist/api/lazy-instances.js +14 -14
- package/dist/api/logs.api.service.d.ts +9 -6
- package/dist/api/logs.api.service.d.ts.map +1 -1
- package/dist/api/logs.api.service.js +12 -11
- package/dist/api/logs.api.service.js.map +1 -1
- package/dist/api/marketplace.api.service.d.ts +1 -1
- package/dist/api/marketplace.api.service.d.ts.map +1 -1
- package/dist/api/marketplace.api.service.js +18 -18
- package/dist/api/marketplace.api.service.js.map +1 -1
- package/dist/api/order.api.service.d.ts +4 -4
- package/dist/api/order.api.service.d.ts.map +1 -1
- package/dist/api/order.api.service.js +2 -2
- package/dist/api/order.api.service.js.map +1 -1
- package/dist/api/persona.api.service.d.ts +3 -3
- package/dist/api/persona.api.service.d.ts.map +1 -1
- package/dist/api/persona.api.service.js +2 -2
- package/dist/api/persona.api.service.js.map +1 -1
- package/dist/api/postprocessor.api.service.d.ts +8 -9
- package/dist/api/postprocessor.api.service.d.ts.map +1 -1
- package/dist/api/postprocessor.api.service.js +1 -2
- package/dist/api/postprocessor.api.service.js.map +1 -1
- package/dist/api/preprocessor.api.service.d.ts +8 -9
- package/dist/api/preprocessor.api.service.d.ts.map +1 -1
- package/dist/api/preprocessor.api.service.js +1 -2
- package/dist/api/preprocessor.api.service.js.map +1 -1
- package/dist/api/products.api.service.d.ts +9 -9
- package/dist/api/products.api.service.d.ts.map +1 -1
- package/dist/api/products.api.service.js +10 -10
- package/dist/api/products.api.service.js.map +1 -1
- package/dist/api/resource.api.service.d.ts +2 -2
- package/dist/api/resource.api.service.js +1 -1
- package/dist/api/skills.api.service.d.ts +4 -4
- package/dist/api/skills.api.service.d.ts.map +1 -1
- package/dist/api/skills.api.service.js +1 -1
- package/dist/api/skills.api.service.js.map +1 -1
- package/dist/api/tool.api.service.d.ts +2 -2
- package/dist/api/tool.api.service.js +1 -1
- package/dist/api/unifiedto.api.service.d.ts +3 -3
- package/dist/api/unifiedto.api.service.d.ts.map +1 -1
- package/dist/api/unifiedto.api.service.js +28 -10
- package/dist/api/unifiedto.api.service.js.map +1 -1
- package/dist/api/user.data.api.service.d.ts +6 -6
- package/dist/api/user.data.api.service.d.ts.map +1 -1
- package/dist/api/user.data.api.service.js +5 -5
- package/dist/api/user.data.api.service.js.map +1 -1
- package/dist/api/webhook.api.service.d.ts +3 -3
- package/dist/api/webhook.api.service.d.ts.map +1 -1
- package/dist/api/webhook.api.service.js +1 -1
- package/dist/api/webhook.api.service.js.map +1 -1
- package/dist/api/whatsapp-templates.api.service.d.ts +3 -3
- package/dist/api/whatsapp-templates.api.service.js +1 -1
- package/dist/api-exports.d.ts +25 -25
- package/dist/api-exports.d.ts.map +1 -1
- package/dist/api-exports.js +26 -26
- package/dist/api-exports.js.map +1 -1
- package/dist/cli/command-definitions.d.ts +1 -1
- package/dist/cli/command-definitions.d.ts.map +1 -1
- package/dist/cli/command-definitions.js +209 -196
- package/dist/cli/command-definitions.js.map +1 -1
- package/dist/commands/agents.js +2 -2
- package/dist/commands/apiKey.js +12 -12
- package/dist/commands/channels.d.ts.map +1 -1
- package/dist/commands/channels.js +165 -174
- package/dist/commands/channels.js.map +1 -1
- package/dist/commands/chat-log-probe.d.ts +59 -0
- package/dist/commands/chat-log-probe.d.ts.map +1 -0
- package/dist/commands/chat-log-probe.js +87 -0
- package/dist/commands/chat-log-probe.js.map +1 -0
- package/dist/commands/chat.d.ts.map +1 -1
- package/dist/commands/chat.js +143 -40
- package/dist/commands/chat.js.map +1 -1
- package/dist/commands/chatClear.d.ts.map +1 -1
- package/dist/commands/chatClear.js +10 -6
- package/dist/commands/chatClear.js.map +1 -1
- package/dist/commands/compile.d.ts +7 -0
- package/dist/commands/compile.d.ts.map +1 -1
- package/dist/commands/compile.js +49 -12
- package/dist/commands/compile.js.map +1 -1
- package/dist/commands/completion.d.ts.map +1 -1
- package/dist/commands/completion.js +8 -9
- package/dist/commands/completion.js.map +1 -1
- package/dist/commands/configure.js +5 -5
- package/dist/commands/deploy.d.ts.map +1 -1
- package/dist/commands/deploy.js +132 -35
- package/dist/commands/deploy.js.map +1 -1
- package/dist/commands/destroy.d.ts.map +1 -1
- package/dist/commands/destroy.js +27 -17
- package/dist/commands/destroy.js.map +1 -1
- package/dist/commands/devices.d.ts.map +1 -1
- package/dist/commands/devices.js +4 -5
- package/dist/commands/devices.js.map +1 -1
- package/dist/commands/env.d.ts.map +1 -1
- package/dist/commands/env.js +101 -80
- package/dist/commands/env.js.map +1 -1
- package/dist/commands/features.d.ts.map +1 -1
- package/dist/commands/features.js +71 -82
- package/dist/commands/features.js.map +1 -1
- package/dist/commands/governance.d.ts.map +1 -1
- package/dist/commands/governance.js +17 -15
- package/dist/commands/governance.js.map +1 -1
- package/dist/commands/index.d.ts +37 -36
- package/dist/commands/index.d.ts.map +1 -1
- package/dist/commands/index.js +37 -36
- package/dist/commands/index.js.map +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +80 -70
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/integrations.d.ts.map +1 -1
- package/dist/commands/integrations.js +373 -341
- package/dist/commands/integrations.js.map +1 -1
- package/dist/commands/jobs.d.ts.map +1 -1
- package/dist/commands/jobs.js +110 -78
- package/dist/commands/jobs.js.map +1 -1
- package/dist/commands/log-tip.d.ts +79 -0
- package/dist/commands/log-tip.d.ts.map +1 -0
- package/dist/commands/log-tip.js +83 -0
- package/dist/commands/log-tip.js.map +1 -0
- package/dist/commands/logs.d.ts.map +1 -1
- package/dist/commands/logs.js +166 -198
- package/dist/commands/logs.js.map +1 -1
- package/dist/commands/marketplace.d.ts.map +1 -1
- package/dist/commands/marketplace.js +381 -427
- package/dist/commands/marketplace.js.map +1 -1
- package/dist/commands/mcp.d.ts.map +1 -1
- package/dist/commands/mcp.js +54 -56
- package/dist/commands/mcp.js.map +1 -1
- package/dist/commands/models.d.ts.map +1 -1
- package/dist/commands/models.js +4 -3
- package/dist/commands/models.js.map +1 -1
- package/dist/commands/persona.d.ts.map +1 -1
- package/dist/commands/persona.js +100 -126
- package/dist/commands/persona.js.map +1 -1
- package/dist/commands/postprocessors.d.ts.map +1 -1
- package/dist/commands/postprocessors.js +87 -61
- package/dist/commands/postprocessors.js.map +1 -1
- package/dist/commands/preprocessors.d.ts.map +1 -1
- package/dist/commands/preprocessors.js +87 -61
- package/dist/commands/preprocessors.js.map +1 -1
- package/dist/commands/production.d.ts.map +1 -1
- package/dist/commands/production.js +101 -113
- package/dist/commands/production.js.map +1 -1
- package/dist/commands/push-helpers.d.ts +42 -0
- package/dist/commands/push-helpers.d.ts.map +1 -0
- package/dist/commands/push-helpers.js +48 -0
- package/dist/commands/push-helpers.js.map +1 -0
- package/dist/commands/push.d.ts +2 -0
- package/dist/commands/push.d.ts.map +1 -1
- package/dist/commands/push.js +388 -124
- package/dist/commands/push.js.map +1 -1
- package/dist/commands/pushBackup.d.ts.map +1 -1
- package/dist/commands/pushBackup.js +8 -4
- package/dist/commands/pushBackup.js.map +1 -1
- package/dist/commands/resources.d.ts.map +1 -1
- package/dist/commands/resources.js +47 -60
- package/dist/commands/resources.js.map +1 -1
- package/dist/commands/skills.d.ts.map +1 -1
- package/dist/commands/skills.js +117 -89
- package/dist/commands/skills.js.map +1 -1
- package/dist/commands/status.d.ts +14 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +731 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/sync.d.ts.map +1 -1
- package/dist/commands/sync.js +70 -30
- package/dist/commands/sync.js.map +1 -1
- package/dist/commands/telemetry.d.ts.map +1 -1
- package/dist/commands/telemetry.js +4 -0
- package/dist/commands/telemetry.js.map +1 -1
- package/dist/commands/test-output.helpers.d.ts +24 -0
- package/dist/commands/test-output.helpers.d.ts.map +1 -0
- package/dist/commands/test-output.helpers.js +62 -0
- package/dist/commands/test-output.helpers.js.map +1 -0
- package/dist/commands/test.d.ts.map +1 -1
- package/dist/commands/test.js +291 -121
- package/dist/commands/test.js.map +1 -1
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +15 -3
- package/dist/commands/update.js.map +1 -1
- package/dist/commands/webhooks.d.ts.map +1 -1
- package/dist/commands/webhooks.js +94 -87
- package/dist/commands/webhooks.js.map +1 -1
- package/dist/compiler/agent-traverser.d.ts +50 -14
- package/dist/compiler/agent-traverser.d.ts.map +1 -1
- package/dist/compiler/agent-traverser.js +189 -86
- package/dist/compiler/agent-traverser.js.map +1 -1
- package/dist/compiler/bundler.d.ts.map +1 -1
- package/dist/compiler/bundler.js +5 -5
- package/dist/compiler/bundler.js.map +1 -1
- package/dist/compiler/compiler.d.ts +32 -0
- package/dist/compiler/compiler.d.ts.map +1 -1
- package/dist/compiler/compiler.js +154 -28
- package/dist/compiler/compiler.js.map +1 -1
- package/dist/compiler/index.d.ts +3 -3
- package/dist/compiler/index.d.ts.map +1 -1
- package/dist/compiler/index.js +3 -3
- package/dist/compiler/index.js.map +1 -1
- package/dist/compiler/plugins/agent.plugin.d.ts.map +1 -1
- package/dist/compiler/plugins/agent.plugin.js +2 -4
- package/dist/compiler/plugins/agent.plugin.js.map +1 -1
- package/dist/compiler/plugins/base.d.ts +21 -0
- package/dist/compiler/plugins/base.d.ts.map +1 -1
- package/dist/compiler/plugins/base.js +13 -3
- package/dist/compiler/plugins/base.js.map +1 -1
- package/dist/compiler/plugins/device-trigger.plugin.d.ts.map +1 -1
- package/dist/compiler/plugins/device-trigger.plugin.js +8 -4
- package/dist/compiler/plugins/device-trigger.plugin.js.map +1 -1
- package/dist/compiler/plugins/device.plugin.d.ts.map +1 -1
- package/dist/compiler/plugins/device.plugin.js +4 -4
- package/dist/compiler/plugins/device.plugin.js.map +1 -1
- package/dist/compiler/plugins/job.plugin.d.ts.map +1 -1
- package/dist/compiler/plugins/job.plugin.js +15 -11
- package/dist/compiler/plugins/job.plugin.js.map +1 -1
- package/dist/compiler/plugins/mcp-server.plugin.d.ts.map +1 -1
- package/dist/compiler/plugins/mcp-server.plugin.js +10 -4
- package/dist/compiler/plugins/mcp-server.plugin.js.map +1 -1
- package/dist/compiler/plugins/registry.js +2 -2
- package/dist/compiler/plugins/registry.js.map +1 -1
- package/dist/compiler/plugins/skill.plugin.d.ts +35 -9
- package/dist/compiler/plugins/skill.plugin.d.ts.map +1 -1
- package/dist/compiler/plugins/skill.plugin.js +129 -87
- package/dist/compiler/plugins/skill.plugin.js.map +1 -1
- package/dist/compiler/plugins/tool.plugin.d.ts.map +1 -1
- package/dist/compiler/plugins/tool.plugin.js +13 -9
- package/dist/compiler/plugins/tool.plugin.js.map +1 -1
- package/dist/compiler/plugins/webhook.plugin.d.ts.map +1 -1
- package/dist/compiler/plugins/webhook.plugin.js +7 -5
- package/dist/compiler/plugins/webhook.plugin.js.map +1 -1
- package/dist/compiler/source-writer.d.ts.map +1 -1
- package/dist/compiler/source-writer.js +2 -4
- package/dist/compiler/source-writer.js.map +1 -1
- package/dist/compiler/types.d.ts +33 -0
- package/dist/compiler/types.d.ts.map +1 -1
- package/dist/compiler/types.js.map +1 -1
- package/dist/compiler/utils/ast-helpers.d.ts +1 -16
- package/dist/compiler/utils/ast-helpers.d.ts.map +1 -1
- package/dist/compiler/utils/ast-helpers.js +14 -38
- package/dist/compiler/utils/ast-helpers.js.map +1 -1
- package/dist/compiler/utils/common.d.ts +14 -0
- package/dist/compiler/utils/common.d.ts.map +1 -1
- package/dist/compiler/utils/common.js +39 -11
- package/dist/compiler/utils/common.js.map +1 -1
- package/dist/compiler/utils/file-discovery.d.ts.map +1 -1
- package/dist/compiler/utils/file-discovery.js +2 -10
- package/dist/compiler/utils/file-discovery.js.map +1 -1
- package/dist/compiler/utils/path-resolver.d.ts +67 -10
- package/dist/compiler/utils/path-resolver.d.ts.map +1 -1
- package/dist/compiler/utils/path-resolver.js +120 -24
- package/dist/compiler/utils/path-resolver.js.map +1 -1
- package/dist/compiler/utils/reference-resolver.d.ts +196 -0
- package/dist/compiler/utils/reference-resolver.d.ts.map +1 -0
- package/dist/compiler/utils/reference-resolver.js +1026 -0
- package/dist/compiler/utils/reference-resolver.js.map +1 -0
- package/dist/compiler/utils/schema-converter.d.ts +25 -0
- package/dist/compiler/utils/schema-converter.d.ts.map +1 -1
- package/dist/compiler/utils/schema-converter.js +80 -4
- package/dist/compiler/utils/schema-converter.js.map +1 -1
- package/dist/compiler/utils/workspace.d.ts +35 -0
- package/dist/compiler/utils/workspace.d.ts.map +1 -0
- package/dist/compiler/utils/workspace.js +121 -0
- package/dist/compiler/utils/workspace.js.map +1 -0
- package/dist/compiler/utils/zod-runtime.mjs +5334 -0
- package/dist/config/compile.constants.d.ts.map +1 -1
- package/dist/config/compile.constants.js +3 -1
- package/dist/config/compile.constants.js.map +1 -1
- package/dist/config/constants.d.ts.map +1 -1
- package/dist/config/constants.js +1 -5
- package/dist/config/constants.js.map +1 -1
- package/dist/errors/auth.error.d.ts.map +1 -1
- package/dist/errors/auth.error.js +3 -5
- package/dist/errors/auth.error.js.map +1 -1
- package/dist/errors/index.d.ts +1 -1
- package/dist/errors/index.js +1 -1
- package/dist/index.js +9 -8
- package/dist/index.js.map +1 -1
- package/dist/instances/basket.instance.d.ts +3 -3
- package/dist/instances/basket.instance.d.ts.map +1 -1
- package/dist/instances/basket.instance.js +26 -8
- package/dist/instances/basket.instance.js.map +1 -1
- package/dist/instances/data.entry.instance.d.ts +2 -2
- package/dist/instances/data.entry.instance.d.ts.map +1 -1
- package/dist/instances/data.entry.instance.js +5 -5
- package/dist/instances/data.entry.instance.js.map +1 -1
- package/dist/instances/order.instance.d.ts +2 -2
- package/dist/instances/order.instance.d.ts.map +1 -1
- package/dist/instances/order.instance.js +20 -9
- package/dist/instances/order.instance.js.map +1 -1
- package/dist/instances/product.instance.d.ts +1 -1
- package/dist/instances/product.instance.d.ts.map +1 -1
- package/dist/instances/product.instance.js +3 -3
- package/dist/instances/product.instance.js.map +1 -1
- package/dist/instances/product.pagination.instance.d.ts +2 -2
- package/dist/instances/product.pagination.instance.d.ts.map +1 -1
- package/dist/instances/product.pagination.instance.js +6 -7
- package/dist/instances/product.pagination.instance.js.map +1 -1
- package/dist/instances/product.search.instance.d.ts +3 -3
- package/dist/instances/product.search.instance.d.ts.map +1 -1
- package/dist/instances/product.search.instance.js +3 -4
- package/dist/instances/product.search.instance.js.map +1 -1
- package/dist/instances/user.instance.d.ts +3 -3
- package/dist/instances/user.instance.d.ts.map +1 -1
- package/dist/instances/user.instance.js +19 -36
- package/dist/instances/user.instance.js.map +1 -1
- package/dist/interfaces/agent.d.ts +8 -8
- package/dist/interfaces/agent.d.ts.map +1 -1
- package/dist/interfaces/backup.d.ts +19 -1
- package/dist/interfaces/backup.d.ts.map +1 -1
- package/dist/interfaces/device-triggers.d.ts +0 -2
- package/dist/interfaces/device-triggers.d.ts.map +1 -1
- package/dist/interfaces/devices.d.ts +0 -1
- package/dist/interfaces/devices.d.ts.map +1 -1
- package/dist/interfaces/index.d.ts +8 -8
- package/dist/interfaces/index.d.ts.map +1 -1
- package/dist/interfaces/jobs.d.ts +2 -3
- package/dist/interfaces/jobs.d.ts.map +1 -1
- package/dist/interfaces/logs.d.ts +7 -4
- package/dist/interfaces/logs.d.ts.map +1 -1
- package/dist/interfaces/message.d.ts +3 -3
- package/dist/interfaces/message.d.ts.map +1 -1
- package/dist/interfaces/orders.d.ts +1 -1
- package/dist/interfaces/webhooks.d.ts +2 -2
- package/dist/interfaces/webhooks.d.ts.map +1 -1
- package/dist/primitives/agent.handler.d.ts.map +1 -1
- package/dist/primitives/agent.handler.js +1 -1
- package/dist/primitives/agent.handler.js.map +1 -1
- package/dist/primitives/base.handler.d.ts +12 -2
- package/dist/primitives/base.handler.d.ts.map +1 -1
- package/dist/primitives/base.handler.js +104 -73
- package/dist/primitives/base.handler.js.map +1 -1
- package/dist/primitives/device-trigger.handler.d.ts +1 -1
- package/dist/primitives/device-trigger.handler.d.ts.map +1 -1
- package/dist/primitives/device-trigger.handler.js +2 -3
- package/dist/primitives/device-trigger.handler.js.map +1 -1
- package/dist/primitives/device.handler.d.ts +1 -1
- package/dist/primitives/device.handler.d.ts.map +1 -1
- package/dist/primitives/device.handler.js +2 -3
- package/dist/primitives/device.handler.js.map +1 -1
- package/dist/primitives/index.d.ts +1 -1
- package/dist/primitives/index.d.ts.map +1 -1
- package/dist/primitives/index.js +2 -3
- package/dist/primitives/index.js.map +1 -1
- package/dist/primitives/job.handler.d.ts +6 -1
- package/dist/primitives/job.handler.d.ts.map +1 -1
- package/dist/primitives/job.handler.js +9 -3
- package/dist/primitives/job.handler.js.map +1 -1
- package/dist/primitives/mcp-server.handler.d.ts.map +1 -1
- package/dist/primitives/mcp-server.handler.js +2 -2
- package/dist/primitives/mcp-server.handler.js.map +1 -1
- package/dist/primitives/postprocessor.handler.d.ts.map +1 -1
- package/dist/primitives/postprocessor.handler.js.map +1 -1
- package/dist/primitives/preprocessor.handler.d.ts +1 -1
- package/dist/primitives/preprocessor.handler.d.ts.map +1 -1
- package/dist/primitives/preprocessor.handler.js +2 -3
- package/dist/primitives/preprocessor.handler.js.map +1 -1
- package/dist/primitives/skill.handler.d.ts +1 -1
- package/dist/primitives/skill.handler.d.ts.map +1 -1
- package/dist/primitives/skill.handler.js +34 -13
- package/dist/primitives/skill.handler.js.map +1 -1
- package/dist/primitives/types.d.ts +1 -1
- package/dist/primitives/types.d.ts.map +1 -1
- package/dist/primitives/types.js.map +1 -1
- package/dist/primitives/webhook.handler.d.ts +3 -2
- package/dist/primitives/webhook.handler.d.ts.map +1 -1
- package/dist/primitives/webhook.handler.js +9 -4
- package/dist/primitives/webhook.handler.js.map +1 -1
- package/dist/services/analytics.d.ts.map +1 -1
- package/dist/services/analytics.js +4 -5
- package/dist/services/analytics.js.map +1 -1
- package/dist/services/auth.d.ts +9 -1
- package/dist/services/auth.d.ts.map +1 -1
- package/dist/services/auth.js +26 -7
- package/dist/services/auth.js.map +1 -1
- package/dist/services/sandbox.service.d.ts.map +1 -1
- package/dist/services/sandbox.service.js +132 -80
- package/dist/services/sandbox.service.js.map +1 -1
- package/dist/types/api-contracts.d.ts +4 -4
- package/dist/types/api-contracts.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js.map +1 -1
- package/dist/types/skill.d.ts +7 -7
- package/dist/types/skill.d.ts.map +1 -1
- package/dist/types/skill.js +2 -2
- package/dist/types/skill.js.map +1 -1
- package/dist/types/tool-validation.js.map +1 -1
- package/dist/types/yaml.types.js +0 -1
- package/dist/types/yaml.types.js.map +1 -1
- package/dist/utils/aliases.d.ts +7 -0
- package/dist/utils/aliases.d.ts.map +1 -0
- package/dist/utils/aliases.js +492 -0
- package/dist/utils/aliases.js.map +1 -0
- package/dist/utils/artifact-loader.d.ts +9 -0
- package/dist/utils/artifact-loader.d.ts.map +1 -1
- package/dist/utils/artifact-loader.js +16 -6
- package/dist/utils/artifact-loader.js.map +1 -1
- package/dist/utils/auth-flows.d.ts.map +1 -1
- package/dist/utils/auth-flows.js +54 -54
- package/dist/utils/auth-flows.js.map +1 -1
- package/dist/utils/backup-helpers.d.ts +24 -0
- package/dist/utils/backup-helpers.d.ts.map +1 -1
- package/dist/utils/backup-helpers.js +102 -22
- package/dist/utils/backup-helpers.js.map +1 -1
- package/dist/utils/bundle-upload.d.ts +42 -0
- package/dist/utils/bundle-upload.d.ts.map +1 -0
- package/dist/utils/bundle-upload.js +90 -0
- package/dist/utils/bundle-upload.js.map +1 -0
- package/dist/utils/chat-attachments.js +1 -1
- package/dist/utils/chat-attachments.js.map +1 -1
- package/dist/utils/cli.d.ts +24 -6
- package/dist/utils/cli.d.ts.map +1 -1
- package/dist/utils/cli.js +26 -14
- package/dist/utils/cli.js.map +1 -1
- package/dist/utils/command-utils.d.ts.map +1 -1
- package/dist/utils/command-utils.js +4 -4
- package/dist/utils/command-utils.js.map +1 -1
- package/dist/utils/deploy-helpers.d.ts.map +1 -1
- package/dist/utils/deploy-helpers.js +13 -13
- package/dist/utils/deploy-helpers.js.map +1 -1
- package/dist/utils/env-loader.utils.d.ts +1 -1
- package/dist/utils/env-loader.utils.d.ts.map +1 -1
- package/dist/utils/env-loader.utils.js +15 -22
- package/dist/utils/env-loader.utils.js.map +1 -1
- package/dist/utils/files.d.ts.map +1 -1
- package/dist/utils/files.js +23 -13
- package/dist/utils/files.js.map +1 -1
- package/dist/utils/hints.d.ts +81 -0
- package/dist/utils/hints.d.ts.map +1 -0
- package/dist/utils/hints.js +81 -0
- package/dist/utils/hints.js.map +1 -0
- package/dist/utils/init-agent.d.ts.map +1 -1
- package/dist/utils/init-agent.js +18 -20
- package/dist/utils/init-agent.js.map +1 -1
- package/dist/utils/init-helpers.d.ts.map +1 -1
- package/dist/utils/init-helpers.js +11 -11
- package/dist/utils/init-helpers.js.map +1 -1
- package/dist/utils/init-prompts.d.ts.map +1 -1
- package/dist/utils/init-prompts.js +34 -36
- package/dist/utils/init-prompts.js.map +1 -1
- package/dist/utils/prompt-handler.js +1 -1
- package/dist/utils/prompt-handler.js.map +1 -1
- package/dist/utils/sandbox-storage.d.ts.map +1 -1
- package/dist/utils/sandbox-storage.js.map +1 -1
- package/dist/utils/sandbox.d.ts +1 -1
- package/dist/utils/sandbox.d.ts.map +1 -1
- package/dist/utils/sandbox.js +107 -106
- package/dist/utils/sandbox.js.map +1 -1
- package/dist/utils/semver.js +1 -1
- package/dist/utils/semver.js.map +1 -1
- package/dist/utils/suggest.d.ts +3 -0
- package/dist/utils/suggest.d.ts.map +1 -0
- package/dist/utils/suggest.js +32 -0
- package/dist/utils/suggest.js.map +1 -0
- package/dist/utils/sync-display.d.ts.map +1 -1
- package/dist/utils/sync-display.js +15 -13
- package/dist/utils/sync-display.js.map +1 -1
- package/dist/utils/sync-fetch.d.ts.map +1 -1
- package/dist/utils/sync-fetch.js +33 -24
- package/dist/utils/sync-fetch.js.map +1 -1
- package/dist/utils/version-check.js +1 -1
- package/dist/utils/version-check.js.map +1 -1
- package/dist/utils/write-info.d.ts +9 -0
- package/dist/utils/write-info.d.ts.map +1 -0
- package/dist/utils/write-info.js +11 -0
- package/dist/utils/write-info.js.map +1 -0
- package/docs/README.md +1 -1
- package/node_modules/@lua/shared-types/dist/index.d.mts +76 -2
- package/node_modules/@lua/shared-types/dist/index.d.ts +76 -2
- package/node_modules/@lua/shared-types/dist/index.js +27 -0
- package/node_modules/@lua/shared-types/dist/index.mjs +24 -0
- package/node_modules/@lua/shared-types/src/ai-generate.types.ts +1 -6
- package/node_modules/@lua/shared-types/src/ai-generate.utils.ts +1 -4
- package/node_modules/@lua/shared-types/src/channel.type.ts +1 -0
- package/node_modules/@lua/shared-types/src/chat-stream.types.ts +11 -0
- package/node_modules/@lua/shared-types/src/client-tools.types.ts +47 -0
- package/node_modules/@lua/shared-types/src/device.types.ts +6 -6
- package/node_modules/@lua/shared-types/src/index.ts +3 -0
- package/node_modules/@lua/shared-types/src/sandbox-contract.ts +26 -5
- package/node_modules/@lua/shared-types/src/vm-execution-log.types.ts +41 -0
- package/package.json +10 -6
- package/scripts/build-vendor.mjs +53 -0
- package/scripts/vendor-entry.mjs +11 -0
- package/template/QUICKSTART.md +33 -33
- package/template/README.md +35 -34
- package/template/examples/README.md +44 -38
- package/template/examples/jobs/AbandonedBasketProcessorJob.ts +30 -31
- package/template/examples/jobs/DailyCleanupJob.ts +17 -18
- package/template/examples/jobs/DataMigrationJob.ts +18 -23
- package/template/examples/jobs/HealthCheckJob.ts +13 -14
- package/template/examples/postprocessors/modifyResponse.ts +14 -15
- package/template/examples/preprocessors/messageMatching.ts +28 -29
- package/template/examples/services/ApiService.ts +68 -64
- package/template/examples/services/GetWeather.ts +39 -33
- package/template/examples/skills/basket.skill.ts +27 -7
- package/template/examples/skills/product.skill.ts +21 -8
- package/template/examples/skills/tools/BasketTool.ts +97 -98
- package/template/examples/skills/tools/CreateInlineJob.ts +38 -36
- package/template/examples/skills/tools/CreatePostTool.ts +27 -28
- package/template/examples/skills/tools/CustomDataTool.ts +72 -67
- package/template/examples/skills/tools/GameScoreTrackerTool.ts +72 -78
- package/template/examples/skills/tools/GetWeatherTool.ts +43 -45
- package/template/examples/skills/tools/OrderTool.ts +58 -58
- package/template/examples/skills/tools/PaymentTool.ts +43 -43
- package/template/examples/skills/tools/PremiumFeatureTool.ts +81 -79
- package/template/examples/skills/tools/ProductsTool.ts +68 -69
- package/template/examples/skills/tools/SmartBasketTool.ts +43 -44
- package/template/examples/skills/tools/UserDataTool.ts +97 -98
- package/template/examples/skills/user.skill.ts +7 -8
- package/template/examples/webhooks/FileUploadWebhook.ts +38 -31
- package/template/examples/webhooks/PaymentWebhook.ts +23 -22
- package/template/examples/webhooks/UserEventWebhook.ts +16 -19
- package/template/lua.skill.yaml +2 -2
- package/template/package.json +1 -1
- package/template/src/index.ts +28 -28
package/dist/commands/test.js
CHANGED
|
@@ -2,16 +2,18 @@
|
|
|
2
2
|
* Test Command
|
|
3
3
|
* Orchestrates the testing of individual tools in a local sandbox environment
|
|
4
4
|
*/
|
|
5
|
-
import inquirer from
|
|
6
|
-
import { compileCommand } from
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
5
|
+
import inquirer from 'inquirer';
|
|
6
|
+
import { compileCommand } from './compile.js';
|
|
7
|
+
import { printToolOutput } from './test-output.helpers.js';
|
|
8
|
+
import { withErrorHandling, clearPromptLines, writeProgress, writeSuccess, writeNextStep, writeHintBlock, } from '../utils/cli.js';
|
|
9
|
+
import { initializeCommand } from '../utils/command-utils.js';
|
|
10
|
+
import { executeTool, executeWebhook, executeJob, executePreProcessor, executePostProcessor, loadEnvironmentVariables, } from '../utils/sandbox.js';
|
|
11
|
+
import { hasEnvFile } from '../utils/files.js';
|
|
12
|
+
import { safePrompt } from '../utils/prompt-handler.js';
|
|
13
|
+
import { loadManifest, loadArtifact, getPrimitivesByKind } from '../utils/artifact-loader.js';
|
|
14
|
+
import { PrimitiveKind, } from '../compiler/types.js';
|
|
14
15
|
import { trackEvent } from '../services/analytics.js';
|
|
16
|
+
import { validateOrSuggest } from '../utils/aliases.js';
|
|
15
17
|
// āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
|
|
16
18
|
// Shared Helpers
|
|
17
19
|
// āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
|
|
@@ -30,7 +32,7 @@ async function promptToolSelection(tools) {
|
|
|
30
32
|
name: tool.skillName
|
|
31
33
|
? `${tool.name} (${tool.skillName}) - ${tool.description}`
|
|
32
34
|
: `${tool.name} - ${tool.description}`,
|
|
33
|
-
value: tool
|
|
35
|
+
value: tool,
|
|
34
36
|
}));
|
|
35
37
|
const { selectedTool } = await inquirer.prompt([
|
|
36
38
|
{
|
|
@@ -38,8 +40,8 @@ async function promptToolSelection(tools) {
|
|
|
38
40
|
name: 'selectedTool',
|
|
39
41
|
message: 'š§ Select a tool to test:',
|
|
40
42
|
choices: toolChoices,
|
|
41
|
-
pageSize: 10
|
|
42
|
-
}
|
|
43
|
+
pageSize: 10,
|
|
44
|
+
},
|
|
43
45
|
]);
|
|
44
46
|
return selectedTool;
|
|
45
47
|
}
|
|
@@ -76,14 +78,14 @@ function parseJsonInputOrFail(inputJson, expectedFormat) {
|
|
|
76
78
|
* Selects an entity by name (non-interactive) or prompts user (interactive).
|
|
77
79
|
*/
|
|
78
80
|
async function selectEntityOrPrompt(options) {
|
|
79
|
-
const { items, entityName, entityType, idProperty, nameProperty, promptMessage, formatChoice } = options;
|
|
81
|
+
const { items, entityName, entityType, idProperty, nameProperty, promptMessage, formatChoice, asJson } = options;
|
|
80
82
|
if (entityName) {
|
|
81
83
|
const selected = items.find((item) => item[idProperty] === entityName || item[nameProperty] === entityName);
|
|
82
84
|
if (!selected) {
|
|
83
85
|
console.error(`ā ${entityType} "${entityName}" not found`);
|
|
84
|
-
throw new Error("${
|
|
86
|
+
throw new Error(`${entityType} "${entityName}" not found`);
|
|
85
87
|
}
|
|
86
|
-
|
|
88
|
+
progress(asJson ?? false, `ā
Selected ${entityType.toLowerCase()}: ${selected[nameProperty]}`);
|
|
87
89
|
return selected;
|
|
88
90
|
}
|
|
89
91
|
const answer = await safePrompt([
|
|
@@ -93,14 +95,63 @@ async function selectEntityOrPrompt(options) {
|
|
|
93
95
|
message: promptMessage,
|
|
94
96
|
choices: items.map((item) => ({
|
|
95
97
|
name: formatChoice ? formatChoice(item) : `${item[nameProperty]}`,
|
|
96
|
-
value: item
|
|
97
|
-
}))
|
|
98
|
-
}
|
|
98
|
+
value: item,
|
|
99
|
+
})),
|
|
100
|
+
},
|
|
99
101
|
]);
|
|
100
102
|
if (!answer)
|
|
101
103
|
return null;
|
|
102
104
|
return answer.selected;
|
|
103
105
|
}
|
|
106
|
+
/**
|
|
107
|
+
* Writes a progress message. In `--json` mode, routes to stderr so stdout
|
|
108
|
+
* stays clean for the final JSON payload (allowing `| jq` etc.).
|
|
109
|
+
*/
|
|
110
|
+
function progress(asJson, message) {
|
|
111
|
+
if (asJson) {
|
|
112
|
+
process.stderr.write('\r\x1b[K' + message + '\n');
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
writeProgress(message);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Writes a success message. In `--json` mode, routes to stderr (see `progress`).
|
|
120
|
+
*/
|
|
121
|
+
function success(asJson, message) {
|
|
122
|
+
if (asJson) {
|
|
123
|
+
process.stderr.write('\r\x1b[K' + message + '\n');
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
writeSuccess(message);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Runs `compileCommand` with stdout redirected to stderr when `asJson` is
|
|
131
|
+
* true, so compile output (which uses `console.log` and direct stdout writes)
|
|
132
|
+
* doesn't pollute the JSON stream piped from `lua test --json`.
|
|
133
|
+
*/
|
|
134
|
+
async function compileQuietly(asJson) {
|
|
135
|
+
if (!asJson) {
|
|
136
|
+
await compileCommand();
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
const originalLog = console.log;
|
|
140
|
+
const originalInfo = console.info;
|
|
141
|
+
const originalStdoutWrite = process.stdout.write.bind(process.stdout);
|
|
142
|
+
// Re-route stdout writes to stderr for the duration of compile.
|
|
143
|
+
console.log = console.error;
|
|
144
|
+
console.info = console.error;
|
|
145
|
+
process.stdout.write = process.stderr.write.bind(process.stderr);
|
|
146
|
+
try {
|
|
147
|
+
await compileCommand();
|
|
148
|
+
}
|
|
149
|
+
finally {
|
|
150
|
+
console.log = originalLog;
|
|
151
|
+
console.info = originalInfo;
|
|
152
|
+
process.stdout.write = originalStdoutWrite;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
104
155
|
/**
|
|
105
156
|
* Handles execution errors with consistent formatting.
|
|
106
157
|
*/
|
|
@@ -124,7 +175,7 @@ function extractToolsFromManifest(manifest) {
|
|
|
124
175
|
toolToSkill.set(toolName, skill.name);
|
|
125
176
|
}
|
|
126
177
|
}
|
|
127
|
-
return tools.map(tool => ({
|
|
178
|
+
return tools.map((tool) => ({
|
|
128
179
|
...tool,
|
|
129
180
|
id: tool.name,
|
|
130
181
|
skillName: toolToSkill.get(tool.name) || 'unknown',
|
|
@@ -140,19 +191,10 @@ export async function testCommand(type, cmdObj) {
|
|
|
140
191
|
return withErrorHandling(async () => {
|
|
141
192
|
const entityName = cmdObj?.name || null;
|
|
142
193
|
const inputJson = cmdObj?.input || null;
|
|
194
|
+
const asJson = !!cmdObj?.json;
|
|
143
195
|
let selectedType;
|
|
144
196
|
if (type) {
|
|
145
|
-
|
|
146
|
-
console.error(`ā Invalid type: "${type}". Must be "skill", "webhook", "job", "preprocessor", or "postprocessor".`);
|
|
147
|
-
console.log('\nUsage:');
|
|
148
|
-
console.log(' lua test - Interactive selection');
|
|
149
|
-
console.log(' lua test skill - Test a skill/tool directly');
|
|
150
|
-
console.log(' lua test webhook - Test a webhook directly');
|
|
151
|
-
console.log(' lua test job - Test a job directly');
|
|
152
|
-
console.log(' lua test preprocessor - Test a preprocessor directly');
|
|
153
|
-
console.log(' lua test postprocessor - Test a postprocessor directly');
|
|
154
|
-
throw new Error("Invalid type:");
|
|
155
|
-
}
|
|
197
|
+
type = validateOrSuggest('test.type', type);
|
|
156
198
|
selectedType = type;
|
|
157
199
|
}
|
|
158
200
|
else if (entityName) {
|
|
@@ -160,7 +202,7 @@ export async function testCommand(type, cmdObj) {
|
|
|
160
202
|
console.log('\nUsage:');
|
|
161
203
|
console.log(' lua test skill --name mySkill --input "{...}" Test skill with JSON input');
|
|
162
204
|
console.log(' lua test webhook --name myWebhook --input "{...}" Test webhook with JSON input');
|
|
163
|
-
throw new Error(
|
|
205
|
+
throw new Error('Type must be specified when using the --name option.');
|
|
164
206
|
}
|
|
165
207
|
else {
|
|
166
208
|
const typeAnswer = await safePrompt([
|
|
@@ -173,31 +215,31 @@ export async function testCommand(type, cmdObj) {
|
|
|
173
215
|
{ name: 'šŖ Webhook', value: 'webhook' },
|
|
174
216
|
{ name: 'ā° Job', value: 'job' },
|
|
175
217
|
{ name: 'š„ PreProcessor', value: 'preprocessor' },
|
|
176
|
-
{ name: 'š¤ PostProcessor', value: 'postprocessor' }
|
|
177
|
-
]
|
|
178
|
-
}
|
|
218
|
+
{ name: 'š¤ PostProcessor', value: 'postprocessor' },
|
|
219
|
+
],
|
|
220
|
+
},
|
|
179
221
|
]);
|
|
180
222
|
if (!typeAnswer) {
|
|
181
|
-
console.log(
|
|
223
|
+
console.log('Test cancelled.');
|
|
182
224
|
return;
|
|
183
225
|
}
|
|
184
226
|
selectedType = typeAnswer.type;
|
|
185
227
|
}
|
|
186
228
|
switch (selectedType) {
|
|
187
229
|
case 'skill':
|
|
188
|
-
await testSkill(entityName, inputJson);
|
|
230
|
+
await testSkill(entityName, inputJson, asJson);
|
|
189
231
|
break;
|
|
190
232
|
case 'webhook':
|
|
191
|
-
await testWebhook(entityName, inputJson);
|
|
233
|
+
await testWebhook(entityName, inputJson, asJson);
|
|
192
234
|
break;
|
|
193
235
|
case 'job':
|
|
194
|
-
await testJob(entityName);
|
|
236
|
+
await testJob(entityName, asJson);
|
|
195
237
|
break;
|
|
196
238
|
case 'preprocessor':
|
|
197
|
-
await testPreProcessor(entityName, inputJson);
|
|
239
|
+
await testPreProcessor(entityName, inputJson, asJson);
|
|
198
240
|
break;
|
|
199
241
|
case 'postprocessor':
|
|
200
|
-
await testPostProcessor(entityName, inputJson);
|
|
242
|
+
await testPostProcessor(entityName, inputJson, asJson);
|
|
201
243
|
break;
|
|
202
244
|
}
|
|
203
245
|
trackEvent('cli_test_executed', {
|
|
@@ -206,24 +248,24 @@ export async function testCommand(type, cmdObj) {
|
|
|
206
248
|
input_provided_json: !!inputJson,
|
|
207
249
|
non_interactive: !!type,
|
|
208
250
|
});
|
|
209
|
-
},
|
|
251
|
+
}, 'testing');
|
|
210
252
|
}
|
|
211
253
|
// āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
|
|
212
254
|
// Test Functions
|
|
213
255
|
// āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
|
|
214
|
-
async function testSkill(entityName, inputJson) {
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
await
|
|
256
|
+
async function testSkill(entityName, inputJson, asJson = false) {
|
|
257
|
+
progress(asJson, 'š§Ŗ Testing Lua skill...');
|
|
258
|
+
progress(asJson, 'š¦ Compiling code first...');
|
|
259
|
+
await compileQuietly(asJson);
|
|
218
260
|
const manifest = loadManifest();
|
|
219
261
|
const allTools = extractToolsFromManifest(manifest);
|
|
220
262
|
const { apiKey, agentId } = await loadAuthOrFail();
|
|
221
263
|
if (hasEnvFile()) {
|
|
222
|
-
|
|
264
|
+
progress(asJson, `š Loaded environment variables from .env file`);
|
|
223
265
|
}
|
|
224
266
|
if (allTools.length === 0) {
|
|
225
|
-
console.error(
|
|
226
|
-
throw new Error(
|
|
267
|
+
console.error('ā No tools found in compiled output.');
|
|
268
|
+
throw new Error('No tools found in compiled output.');
|
|
227
269
|
}
|
|
228
270
|
// Select tool
|
|
229
271
|
let selectedTool;
|
|
@@ -231,25 +273,25 @@ async function testSkill(entityName, inputJson) {
|
|
|
231
273
|
selectedTool = allTools.find((t) => t.id === entityName || t.name === entityName);
|
|
232
274
|
if (!selectedTool) {
|
|
233
275
|
console.error(`ā Tool "${entityName}" not found`);
|
|
234
|
-
throw new Error(
|
|
276
|
+
throw new Error('Tool');
|
|
235
277
|
}
|
|
236
|
-
|
|
278
|
+
progress(asJson, `ā
Selected tool: ${selectedTool.name}`);
|
|
237
279
|
}
|
|
238
280
|
else {
|
|
239
281
|
selectedTool = await promptToolSelection(allTools);
|
|
240
282
|
clearPromptLines(2);
|
|
241
|
-
|
|
283
|
+
progress(asJson, `ā
Selected tool: ${selectedTool.name}`);
|
|
242
284
|
}
|
|
243
285
|
// Get input values - for now, use simple prompts since schemas are in the bundled code
|
|
244
286
|
let inputValues = {};
|
|
245
287
|
if (inputJson) {
|
|
246
288
|
inputValues = parseJsonInputOrFail(inputJson, '{"param1": "value1", ...}');
|
|
247
|
-
|
|
289
|
+
progress(asJson, `Input: ${JSON.stringify(inputValues, null, 2)}`);
|
|
248
290
|
}
|
|
249
291
|
else {
|
|
250
292
|
// Simple input prompt since we don't have schema metadata at this point
|
|
251
293
|
const inputAnswer = await safePrompt([
|
|
252
|
-
{ type: 'input', name: 'input', message: 'Enter input JSON (or empty for {}):', default: '{}' }
|
|
294
|
+
{ type: 'input', name: 'input', message: 'Enter input JSON (or empty for {}):', default: '{}' },
|
|
253
295
|
]);
|
|
254
296
|
if (inputAnswer) {
|
|
255
297
|
try {
|
|
@@ -261,7 +303,7 @@ async function testSkill(entityName, inputJson) {
|
|
|
261
303
|
}
|
|
262
304
|
}
|
|
263
305
|
// Execute - load uncompressed code from dist-v2
|
|
264
|
-
|
|
306
|
+
progress(asJson, '\nš Executing tool...');
|
|
265
307
|
const toolCode = loadArtifact(selectedTool, process.cwd());
|
|
266
308
|
await withSandboxEnv(async () => {
|
|
267
309
|
try {
|
|
@@ -272,24 +314,42 @@ async function testSkill(entityName, inputJson) {
|
|
|
272
314
|
agentId,
|
|
273
315
|
channel: 'dev',
|
|
274
316
|
});
|
|
275
|
-
|
|
276
|
-
|
|
317
|
+
success(asJson, 'ā
Tool execution successful!');
|
|
318
|
+
printToolOutput('Tool', result, asJson);
|
|
319
|
+
// Skip post-action hints in --json mode so they don't pollute the JSON stream.
|
|
320
|
+
if (!asJson) {
|
|
321
|
+
writeNextStep({
|
|
322
|
+
command: 'lua chat -e sandbox -m "test message"',
|
|
323
|
+
rationale: 'to verify the tool integrates correctly with the agent',
|
|
324
|
+
when: 'success',
|
|
325
|
+
});
|
|
326
|
+
}
|
|
277
327
|
}
|
|
278
328
|
catch (error) {
|
|
279
329
|
handleExecutionError(error, 'Tool');
|
|
330
|
+
if (!asJson) {
|
|
331
|
+
writeHintBlock({
|
|
332
|
+
headline: 'Tool ran locally ā no server logs exist for this execution.',
|
|
333
|
+
lines: [
|
|
334
|
+
{ label: 'Try with --json:', command: `lua test skill --name ${selectedTool.name} --json` },
|
|
335
|
+
{ label: 'Test in sandbox:', command: 'lua chat -e sandbox -m "trigger the tool"' },
|
|
336
|
+
],
|
|
337
|
+
when: 'error',
|
|
338
|
+
});
|
|
339
|
+
}
|
|
280
340
|
}
|
|
281
341
|
});
|
|
282
342
|
}
|
|
283
|
-
async function testWebhook(entityName, inputJson) {
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
await
|
|
343
|
+
async function testWebhook(entityName, inputJson, asJson = false) {
|
|
344
|
+
progress(asJson, 'šŖ Testing webhook...');
|
|
345
|
+
progress(asJson, 'š¦ Compiling code first...');
|
|
346
|
+
await compileQuietly(asJson);
|
|
287
347
|
const { apiKey, agentId, config } = await loadAuthOrFail();
|
|
288
348
|
const manifest = loadManifest();
|
|
289
349
|
const webhooks = getPrimitivesByKind(manifest, PrimitiveKind.WEBHOOK);
|
|
290
350
|
if (webhooks.length === 0) {
|
|
291
|
-
console.error(
|
|
292
|
-
console.log(
|
|
351
|
+
console.error('ā No webhooks found in compiled output.');
|
|
352
|
+
console.log('š” Create a webhook using LuaWebhook in your code.');
|
|
293
353
|
return;
|
|
294
354
|
}
|
|
295
355
|
// Select webhook
|
|
@@ -300,12 +360,14 @@ async function testWebhook(entityName, inputJson) {
|
|
|
300
360
|
idProperty: 'name',
|
|
301
361
|
nameProperty: 'name',
|
|
302
362
|
promptMessage: 'Select a webhook to test:',
|
|
303
|
-
formatChoice: (w) => `${w.name}
|
|
363
|
+
formatChoice: (w) => `${w.name}`,
|
|
364
|
+
asJson,
|
|
304
365
|
});
|
|
305
366
|
if (!selectedWebhook) {
|
|
306
|
-
console.log(
|
|
367
|
+
console.log('Test cancelled.');
|
|
307
368
|
return;
|
|
308
369
|
}
|
|
370
|
+
const webhookName = selectedWebhook.name;
|
|
309
371
|
// Get inputs
|
|
310
372
|
let query = {};
|
|
311
373
|
let headers = {};
|
|
@@ -319,48 +381,69 @@ async function testWebhook(entityName, inputJson) {
|
|
|
319
381
|
else {
|
|
320
382
|
// Simple JSON input prompts
|
|
321
383
|
const queryAnswer = await safePrompt([
|
|
322
|
-
{ type: 'input', name: 'query', message: 'Enter query params JSON (or empty):', default: '{}' }
|
|
384
|
+
{ type: 'input', name: 'query', message: 'Enter query params JSON (or empty):', default: '{}' },
|
|
323
385
|
]);
|
|
324
386
|
if (queryAnswer)
|
|
325
387
|
query = JSON.parse(queryAnswer.query || '{}');
|
|
326
388
|
const headersAnswer = await safePrompt([
|
|
327
|
-
{ type: 'input', name: 'headers', message: 'Enter headers JSON (or empty):', default: '{}' }
|
|
389
|
+
{ type: 'input', name: 'headers', message: 'Enter headers JSON (or empty):', default: '{}' },
|
|
328
390
|
]);
|
|
329
391
|
if (headersAnswer)
|
|
330
392
|
headers = JSON.parse(headersAnswer.headers || '{}');
|
|
331
393
|
const bodyAnswer = await safePrompt([
|
|
332
|
-
{ type: 'input', name: 'body', message: 'Enter body JSON (or empty):', default: '{}' }
|
|
394
|
+
{ type: 'input', name: 'body', message: 'Enter body JSON (or empty):', default: '{}' },
|
|
333
395
|
]);
|
|
334
396
|
if (bodyAnswer)
|
|
335
397
|
body = JSON.parse(bodyAnswer.body || '{}');
|
|
336
398
|
}
|
|
337
399
|
// Execute
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
400
|
+
progress(asJson, '\nš Executing webhook...');
|
|
401
|
+
progress(asJson, `Query: ${JSON.stringify(query, null, 2)}`);
|
|
402
|
+
progress(asJson, `Headers: ${JSON.stringify(headers, null, 2)}`);
|
|
403
|
+
progress(asJson, `Body: ${JSON.stringify(body, null, 2)}`);
|
|
342
404
|
const webhookCode = loadArtifact(selectedWebhook, process.cwd());
|
|
343
405
|
await withSandboxEnv(async () => {
|
|
344
406
|
try {
|
|
345
407
|
const result = await executeWebhook({ webhookCode, query, headers, body, apiKey, agentId });
|
|
346
|
-
|
|
347
|
-
|
|
408
|
+
success(asJson, '\nā
Webhook execution successful!');
|
|
409
|
+
printToolOutput('Webhook', result, asJson);
|
|
410
|
+
if (!asJson) {
|
|
411
|
+
writeHintBlock({
|
|
412
|
+
headline: 'Webhook works locally. To test in production:',
|
|
413
|
+
lines: [
|
|
414
|
+
{ label: 'Trigger via HTTP:', command: 'curl -X POST <your webhook URL>' },
|
|
415
|
+
{ label: 'Inspect logs:', command: `lua logs --type webhook --name ${webhookName} --limit 5` },
|
|
416
|
+
],
|
|
417
|
+
when: 'success',
|
|
418
|
+
});
|
|
419
|
+
}
|
|
348
420
|
}
|
|
349
421
|
catch (error) {
|
|
350
422
|
handleExecutionError(error, 'Webhook');
|
|
423
|
+
if (!asJson) {
|
|
424
|
+
writeHintBlock({
|
|
425
|
+
headline: 'Webhook ran locally ā no server logs exist for this execution.',
|
|
426
|
+
lines: [
|
|
427
|
+
{ label: 'Try with --json:', command: `lua test webhook --name ${webhookName} --json` },
|
|
428
|
+
{ label: 'Trigger in production:', command: 'curl -X POST <your webhook URL>' },
|
|
429
|
+
{ label: 'Then inspect:', command: `lua logs --type webhook --name ${webhookName} --limit 5` },
|
|
430
|
+
],
|
|
431
|
+
when: 'error',
|
|
432
|
+
});
|
|
433
|
+
}
|
|
351
434
|
}
|
|
352
435
|
});
|
|
353
436
|
}
|
|
354
|
-
async function testJob(entityName) {
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
await
|
|
437
|
+
async function testJob(entityName, asJson = false) {
|
|
438
|
+
progress(asJson, 'ā° Testing job...');
|
|
439
|
+
progress(asJson, 'š¦ Compiling code first...');
|
|
440
|
+
await compileQuietly(asJson);
|
|
358
441
|
const { apiKey, agentId, config } = await loadAuthOrFail();
|
|
359
442
|
const manifest = loadManifest();
|
|
360
443
|
const jobs = getPrimitivesByKind(manifest, PrimitiveKind.JOB);
|
|
361
444
|
if (jobs.length === 0) {
|
|
362
|
-
console.error(
|
|
363
|
-
console.log(
|
|
445
|
+
console.error('ā No jobs found in compiled output.');
|
|
446
|
+
console.log('š” Create a job using LuaJob in your code.');
|
|
364
447
|
return;
|
|
365
448
|
}
|
|
366
449
|
// Select job
|
|
@@ -371,19 +454,21 @@ async function testJob(entityName) {
|
|
|
371
454
|
idProperty: 'name',
|
|
372
455
|
nameProperty: 'name',
|
|
373
456
|
promptMessage: 'Select a job to test:',
|
|
374
|
-
formatChoice: (j) => `${j.name} - ${formatSchedule(j.schedule)}
|
|
457
|
+
formatChoice: (j) => `${j.name} - ${formatSchedule(j.schedule)}`,
|
|
458
|
+
asJson,
|
|
375
459
|
});
|
|
376
460
|
if (!selectedJob) {
|
|
377
|
-
console.log(
|
|
461
|
+
console.log('Test cancelled.');
|
|
378
462
|
return;
|
|
379
463
|
}
|
|
464
|
+
const jobNameForHints = selectedJob.name;
|
|
380
465
|
// Get jobId from YAML config
|
|
381
466
|
const yamlJobs = config.jobs || [];
|
|
382
467
|
const yamlJob = yamlJobs.find((j) => j.name === selectedJob.name);
|
|
383
468
|
const jobId = yamlJob?.jobId || selectedJob.name;
|
|
384
469
|
// Execute
|
|
385
|
-
|
|
386
|
-
|
|
470
|
+
progress(asJson, `\nš Executing job: ${selectedJob.name}...`);
|
|
471
|
+
progress(asJson, `š
Schedule: ${formatSchedule(selectedJob.schedule)}`);
|
|
387
472
|
const jobCode = loadArtifact(selectedJob, process.cwd());
|
|
388
473
|
await withSandboxEnv(async () => {
|
|
389
474
|
try {
|
|
@@ -396,25 +481,46 @@ async function testJob(entityName) {
|
|
|
396
481
|
jobId: jobId,
|
|
397
482
|
name: selectedJob.name,
|
|
398
483
|
schedule: selectedJob.schedule,
|
|
399
|
-
metadata: {}
|
|
400
|
-
}
|
|
484
|
+
metadata: {},
|
|
485
|
+
},
|
|
401
486
|
});
|
|
402
|
-
|
|
403
|
-
|
|
487
|
+
success(asJson, '\nā
Job execution successful!');
|
|
488
|
+
printToolOutput('Job', result, asJson);
|
|
489
|
+
if (!asJson) {
|
|
490
|
+
writeHintBlock({
|
|
491
|
+
headline: 'Job works locally. To test in production:',
|
|
492
|
+
lines: [
|
|
493
|
+
{ label: 'Trigger now:', command: `lua jobs trigger --job-name ${jobNameForHints}` },
|
|
494
|
+
{ label: 'Inspect logs:', command: `lua logs --type job --name ${jobNameForHints} --limit 5` },
|
|
495
|
+
],
|
|
496
|
+
when: 'success',
|
|
497
|
+
});
|
|
498
|
+
}
|
|
404
499
|
}
|
|
405
500
|
catch (error) {
|
|
406
501
|
handleExecutionError(error, 'Job');
|
|
502
|
+
if (!asJson) {
|
|
503
|
+
writeHintBlock({
|
|
504
|
+
headline: 'Job ran locally ā no server logs exist for this execution.',
|
|
505
|
+
lines: [
|
|
506
|
+
{ label: 'Try with --json:', command: `lua test job --name ${jobNameForHints} --json` },
|
|
507
|
+
{ label: 'Trigger in production:', command: `lua jobs trigger --job-name ${jobNameForHints}` },
|
|
508
|
+
{ label: 'Then inspect:', command: `lua logs --type job --name ${jobNameForHints} --limit 5` },
|
|
509
|
+
],
|
|
510
|
+
when: 'error',
|
|
511
|
+
});
|
|
512
|
+
}
|
|
407
513
|
}
|
|
408
514
|
});
|
|
409
515
|
}
|
|
410
|
-
async function testPreProcessor(entityName, inputJson) {
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
await
|
|
516
|
+
async function testPreProcessor(entityName, inputJson, asJson = false) {
|
|
517
|
+
progress(asJson, 'š„ Testing preprocessor...');
|
|
518
|
+
progress(asJson, 'š¦ Compiling code first...');
|
|
519
|
+
await compileQuietly(asJson);
|
|
414
520
|
const manifest = loadManifest();
|
|
415
521
|
const preprocessors = getPrimitivesByKind(manifest, PrimitiveKind.PREPROCESSOR);
|
|
416
522
|
if (preprocessors.length === 0) {
|
|
417
|
-
console.error(
|
|
523
|
+
console.error('ā No preprocessors found in compiled output.');
|
|
418
524
|
return;
|
|
419
525
|
}
|
|
420
526
|
// Select preprocessor
|
|
@@ -425,10 +531,12 @@ async function testPreProcessor(entityName, inputJson) {
|
|
|
425
531
|
idProperty: 'name',
|
|
426
532
|
nameProperty: 'name',
|
|
427
533
|
promptMessage: 'Select a preprocessor to test:',
|
|
428
|
-
formatChoice: (p) => `${p.name}
|
|
534
|
+
formatChoice: (p) => `${p.name}`,
|
|
535
|
+
asJson,
|
|
429
536
|
});
|
|
430
537
|
if (!selected)
|
|
431
538
|
return;
|
|
539
|
+
const preprocessorName = selected.name;
|
|
432
540
|
// Get inputs
|
|
433
541
|
let message;
|
|
434
542
|
let channel;
|
|
@@ -439,22 +547,22 @@ async function testPreProcessor(entityName, inputJson) {
|
|
|
439
547
|
}
|
|
440
548
|
else {
|
|
441
549
|
const messageAnswer = await safePrompt([
|
|
442
|
-
{ type: 'input', name: 'message', message: 'Enter test message:', default: 'Hello, I need help with my order' }
|
|
550
|
+
{ type: 'input', name: 'message', message: 'Enter test message:', default: 'Hello, I need help with my order' },
|
|
443
551
|
]);
|
|
444
552
|
if (!messageAnswer)
|
|
445
553
|
return;
|
|
446
554
|
message = messageAnswer.message;
|
|
447
555
|
const channelAnswer = await safePrompt([
|
|
448
|
-
{ type: 'input', name: 'channel', message: 'Enter channel:', default: 'web' }
|
|
556
|
+
{ type: 'input', name: 'channel', message: 'Enter channel:', default: 'web' },
|
|
449
557
|
]);
|
|
450
558
|
if (!channelAnswer)
|
|
451
559
|
return;
|
|
452
560
|
channel = channelAnswer.channel;
|
|
453
561
|
}
|
|
454
562
|
// Execute
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
563
|
+
progress(asJson, '\nš Executing preprocessor...');
|
|
564
|
+
progress(asJson, `Input message: ${message}`);
|
|
565
|
+
progress(asJson, `Channel: ${channel}`);
|
|
458
566
|
const { apiKey, agentId } = await loadAuthOrFail();
|
|
459
567
|
const preprocessorCode = loadArtifact(selected, process.cwd());
|
|
460
568
|
await withSandboxEnv(async () => {
|
|
@@ -465,9 +573,9 @@ async function testPreProcessor(entityName, inputJson) {
|
|
|
465
573
|
messages,
|
|
466
574
|
channel,
|
|
467
575
|
apiKey,
|
|
468
|
-
agentId
|
|
576
|
+
agentId,
|
|
469
577
|
});
|
|
470
|
-
|
|
578
|
+
success(asJson, '\nā
PreProcessor execution successful!');
|
|
471
579
|
// Helper to display messages
|
|
472
580
|
const displayMessages = (outputMessages) => {
|
|
473
581
|
console.log(`Processed messages (${outputMessages.length}):`);
|
|
@@ -486,7 +594,10 @@ async function testPreProcessor(entityName, inputJson) {
|
|
|
486
594
|
}
|
|
487
595
|
});
|
|
488
596
|
};
|
|
489
|
-
if (
|
|
597
|
+
if (asJson) {
|
|
598
|
+
printToolOutput('PreProcessor', result, true);
|
|
599
|
+
}
|
|
600
|
+
else if (result.action === 'block') {
|
|
490
601
|
console.log(`\nAction: BLOCK`);
|
|
491
602
|
console.log(`Response: ${result.response}`);
|
|
492
603
|
if (result.metadata) {
|
|
@@ -504,22 +615,43 @@ async function testPreProcessor(entityName, inputJson) {
|
|
|
504
615
|
else {
|
|
505
616
|
console.log(`\nAction: PROCEED (no valid action returned, messages unchanged)`);
|
|
506
617
|
displayMessages(messages);
|
|
507
|
-
console.log(`\nRaw result
|
|
618
|
+
console.log(`\nRaw result:`);
|
|
619
|
+
printToolOutput('PreProcessor', result, false);
|
|
620
|
+
}
|
|
621
|
+
if (!asJson) {
|
|
622
|
+
writeHintBlock({
|
|
623
|
+
headline: 'Preprocessor works locally. To test in production:',
|
|
624
|
+
lines: [
|
|
625
|
+
{ label: 'Send a message:', command: 'lua chat -e production -m "test message"' },
|
|
626
|
+
{ label: 'Inspect logs:', command: 'lua logs --type preprocessor --limit 5' },
|
|
627
|
+
],
|
|
628
|
+
when: 'success',
|
|
629
|
+
});
|
|
508
630
|
}
|
|
509
631
|
}
|
|
510
632
|
catch (error) {
|
|
511
633
|
handleExecutionError(error, 'PreProcessor');
|
|
634
|
+
if (!asJson) {
|
|
635
|
+
writeHintBlock({
|
|
636
|
+
headline: 'Preprocessor ran locally ā no server logs exist for this execution.',
|
|
637
|
+
lines: [
|
|
638
|
+
{ label: 'Try with --json:', command: `lua test preprocessor --name ${preprocessorName} --json` },
|
|
639
|
+
{ label: 'Then inspect:', command: 'lua logs --type preprocessor --limit 5' },
|
|
640
|
+
],
|
|
641
|
+
when: 'error',
|
|
642
|
+
});
|
|
643
|
+
}
|
|
512
644
|
}
|
|
513
645
|
});
|
|
514
646
|
}
|
|
515
|
-
async function testPostProcessor(entityName, inputJson) {
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
await
|
|
647
|
+
async function testPostProcessor(entityName, inputJson, asJson = false) {
|
|
648
|
+
progress(asJson, 'š¤ Testing postprocessor...');
|
|
649
|
+
progress(asJson, 'š¦ Compiling code first...');
|
|
650
|
+
await compileQuietly(asJson);
|
|
519
651
|
const manifest = loadManifest();
|
|
520
652
|
const postprocessors = getPrimitivesByKind(manifest, PrimitiveKind.POSTPROCESSOR);
|
|
521
653
|
if (postprocessors.length === 0) {
|
|
522
|
-
console.error(
|
|
654
|
+
console.error('ā No postprocessors found in compiled output.');
|
|
523
655
|
return;
|
|
524
656
|
}
|
|
525
657
|
// Select postprocessor
|
|
@@ -530,10 +662,12 @@ async function testPostProcessor(entityName, inputJson) {
|
|
|
530
662
|
idProperty: 'name',
|
|
531
663
|
nameProperty: 'name',
|
|
532
664
|
promptMessage: 'Select a postprocessor to test:',
|
|
533
|
-
formatChoice: (p) => `${p.name}
|
|
665
|
+
formatChoice: (p) => `${p.name}`,
|
|
666
|
+
asJson,
|
|
534
667
|
});
|
|
535
668
|
if (!selected)
|
|
536
669
|
return;
|
|
670
|
+
const postprocessorName = selected.name;
|
|
537
671
|
// Get inputs
|
|
538
672
|
let message;
|
|
539
673
|
let response;
|
|
@@ -546,29 +680,39 @@ async function testPostProcessor(entityName, inputJson) {
|
|
|
546
680
|
}
|
|
547
681
|
else {
|
|
548
682
|
const messageAnswer = await safePrompt([
|
|
549
|
-
{
|
|
683
|
+
{
|
|
684
|
+
type: 'input',
|
|
685
|
+
name: 'message',
|
|
686
|
+
message: 'Enter original user message:',
|
|
687
|
+
default: 'What products do you have?',
|
|
688
|
+
},
|
|
550
689
|
]);
|
|
551
690
|
if (!messageAnswer)
|
|
552
691
|
return;
|
|
553
692
|
message = messageAnswer.message;
|
|
554
693
|
const responseAnswer = await safePrompt([
|
|
555
|
-
{
|
|
694
|
+
{
|
|
695
|
+
type: 'input',
|
|
696
|
+
name: 'response',
|
|
697
|
+
message: 'Enter agent response to process:',
|
|
698
|
+
default: 'We have laptops, phones, and tablets available.',
|
|
699
|
+
},
|
|
556
700
|
]);
|
|
557
701
|
if (!responseAnswer)
|
|
558
702
|
return;
|
|
559
703
|
response = responseAnswer.response;
|
|
560
704
|
const channelAnswer = await safePrompt([
|
|
561
|
-
{ type: 'input', name: 'channel', message: 'Enter channel:', default: 'web' }
|
|
705
|
+
{ type: 'input', name: 'channel', message: 'Enter channel:', default: 'web' },
|
|
562
706
|
]);
|
|
563
707
|
if (!channelAnswer)
|
|
564
708
|
return;
|
|
565
709
|
channel = channelAnswer.channel;
|
|
566
710
|
}
|
|
567
711
|
// Execute
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
712
|
+
progress(asJson, '\nš Executing postprocessor...');
|
|
713
|
+
progress(asJson, `Original message: ${message}`);
|
|
714
|
+
progress(asJson, `Agent response: ${response}`);
|
|
715
|
+
progress(asJson, `Channel: ${channel}`);
|
|
572
716
|
const { apiKey, agentId } = await loadAuthOrFail();
|
|
573
717
|
const postprocessorCode = loadArtifact(selected, process.cwd());
|
|
574
718
|
await withSandboxEnv(async () => {
|
|
@@ -579,21 +723,47 @@ async function testPostProcessor(entityName, inputJson) {
|
|
|
579
723
|
response,
|
|
580
724
|
channel,
|
|
581
725
|
apiKey,
|
|
582
|
-
agentId
|
|
726
|
+
agentId,
|
|
583
727
|
});
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
728
|
+
success(asJson, '\nā
PostProcessor execution successful!');
|
|
729
|
+
if (asJson) {
|
|
730
|
+
printToolOutput('PostProcessor', result, true);
|
|
731
|
+
}
|
|
732
|
+
else if (typeof result === 'object' && result !== null) {
|
|
587
733
|
const resultObj = result;
|
|
588
|
-
|
|
589
|
-
|
|
734
|
+
if (resultObj.modifiedResponse) {
|
|
735
|
+
console.log(`Processed response: ${resultObj.modifiedResponse}`);
|
|
736
|
+
}
|
|
737
|
+
else {
|
|
738
|
+
printToolOutput('PostProcessor', result, false);
|
|
739
|
+
}
|
|
590
740
|
}
|
|
591
741
|
else {
|
|
592
742
|
console.log(`Processed response: ${result}`);
|
|
593
743
|
}
|
|
744
|
+
if (!asJson) {
|
|
745
|
+
writeHintBlock({
|
|
746
|
+
headline: 'Postprocessor works locally. To test in production:',
|
|
747
|
+
lines: [
|
|
748
|
+
{ label: 'Send a message:', command: 'lua chat -e production -m "test message"' },
|
|
749
|
+
{ label: 'Inspect logs:', command: 'lua logs --type postprocessor --limit 5' },
|
|
750
|
+
],
|
|
751
|
+
when: 'success',
|
|
752
|
+
});
|
|
753
|
+
}
|
|
594
754
|
}
|
|
595
755
|
catch (error) {
|
|
596
756
|
handleExecutionError(error, 'PostProcessor');
|
|
757
|
+
if (!asJson) {
|
|
758
|
+
writeHintBlock({
|
|
759
|
+
headline: 'Postprocessor ran locally ā no server logs exist for this execution.',
|
|
760
|
+
lines: [
|
|
761
|
+
{ label: 'Try with --json:', command: `lua test postprocessor --name ${postprocessorName} --json` },
|
|
762
|
+
{ label: 'Test in production:', command: 'lua logs --type postprocessor --limit 5' },
|
|
763
|
+
],
|
|
764
|
+
when: 'error',
|
|
765
|
+
});
|
|
766
|
+
}
|
|
597
767
|
}
|
|
598
768
|
});
|
|
599
769
|
}
|