lua-cli 3.13.0 → 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 +5 -5
- package/dist/api/logs.api.service.d.ts.map +1 -1
- package/dist/api/logs.api.service.js +9 -9
- 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 +190 -199
- 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.js +163 -163
- package/dist/commands/channels.js.map +1 -1
- package/dist/commands/chat-log-probe.d.ts.map +1 -1
- package/dist/commands/chat-log-probe.js +2 -6
- package/dist/commands/chat-log-probe.js.map +1 -1
- package/dist/commands/chat.d.ts.map +1 -1
- package/dist/commands/chat.js +33 -33
- 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.map +1 -1
- package/dist/commands/compile.js +18 -11
- package/dist/commands/compile.js.map +1 -1
- package/dist/commands/completion.js +1 -1
- package/dist/commands/configure.js +5 -5
- package/dist/commands/deploy.d.ts.map +1 -1
- package/dist/commands/deploy.js +27 -15
- 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.js +1 -3
- package/dist/commands/devices.js.map +1 -1
- package/dist/commands/env.js +58 -60
- package/dist/commands/env.js.map +1 -1
- package/dist/commands/features.js +69 -70
- package/dist/commands/features.js.map +1 -1
- package/dist/commands/governance.d.ts.map +1 -1
- package/dist/commands/governance.js +13 -7
- package/dist/commands/governance.js.map +1 -1
- package/dist/commands/index.d.ts +37 -37
- package/dist/commands/index.js +37 -37
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +69 -69
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/integrations.d.ts.map +1 -1
- package/dist/commands/integrations.js +369 -339
- package/dist/commands/integrations.js.map +1 -1
- package/dist/commands/jobs.d.ts.map +1 -1
- package/dist/commands/jobs.js +56 -62
- package/dist/commands/jobs.js.map +1 -1
- package/dist/commands/log-tip.d.ts.map +1 -1
- package/dist/commands/log-tip.js +2 -10
- package/dist/commands/log-tip.js.map +1 -1
- package/dist/commands/logs.d.ts.map +1 -1
- package/dist/commands/logs.js +80 -73
- package/dist/commands/logs.js.map +1 -1
- package/dist/commands/marketplace.d.ts.map +1 -1
- package/dist/commands/marketplace.js +368 -403
- package/dist/commands/marketplace.js.map +1 -1
- package/dist/commands/mcp.d.ts.map +1 -1
- package/dist/commands/mcp.js +38 -38
- package/dist/commands/mcp.js.map +1 -1
- package/dist/commands/models.d.ts.map +1 -1
- package/dist/commands/models.js +2 -2
- package/dist/commands/models.js.map +1 -1
- package/dist/commands/persona.js +96 -96
- package/dist/commands/persona.js.map +1 -1
- package/dist/commands/postprocessors.js +44 -44
- package/dist/commands/postprocessors.js.map +1 -1
- package/dist/commands/preprocessors.js +44 -44
- package/dist/commands/preprocessors.js.map +1 -1
- package/dist/commands/production.js +99 -101
- package/dist/commands/production.js.map +1 -1
- package/dist/commands/push.d.ts.map +1 -1
- package/dist/commands/push.js +130 -81
- package/dist/commands/push.js.map +1 -1
- package/dist/commands/pushBackup.d.ts.map +1 -1
- package/dist/commands/pushBackup.js +4 -6
- package/dist/commands/pushBackup.js.map +1 -1
- package/dist/commands/resources.js +45 -48
- package/dist/commands/resources.js.map +1 -1
- package/dist/commands/skills.d.ts.map +1 -1
- package/dist/commands/skills.js +68 -55
- package/dist/commands/skills.js.map +1 -1
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +11 -14
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/sync.d.ts.map +1 -1
- package/dist/commands/sync.js +34 -29
- package/dist/commands/sync.js.map +1 -1
- package/dist/commands/test-output.helpers.js +1 -1
- package/dist/commands/test-output.helpers.js.map +1 -1
- package/dist/commands/test.d.ts.map +1 -1
- package/dist/commands/test.js +81 -71
- 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 +60 -66
- package/dist/commands/webhooks.js.map +1 -1
- package/dist/compiler/agent-traverser.d.ts.map +1 -1
- package/dist/compiler/agent-traverser.js +2 -4
- 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.map +1 -1
- package/dist/compiler/compiler.js +12 -11
- package/dist/compiler/compiler.js.map +1 -1
- package/dist/compiler/index.d.ts +2 -2
- package/dist/compiler/index.d.ts.map +1 -1
- package/dist/compiler/index.js +2 -2
- 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.map +1 -1
- package/dist/compiler/plugins/base.js +3 -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.map +1 -1
- package/dist/compiler/plugins/skill.plugin.js +8 -13
- 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/utils/ast-helpers.d.ts.map +1 -1
- package/dist/compiler/utils/ast-helpers.js +12 -7
- package/dist/compiler/utils/ast-helpers.js.map +1 -1
- package/dist/compiler/utils/common.d.ts.map +1 -1
- package/dist/compiler/utils/common.js +1 -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.map +1 -1
- package/dist/compiler/utils/path-resolver.js.map +1 -1
- package/dist/compiler/utils/reference-resolver.d.ts.map +1 -1
- package/dist/compiler/utils/reference-resolver.js +4 -8
- package/dist/compiler/utils/reference-resolver.js.map +1 -1
- package/dist/compiler/utils/schema-converter.d.ts.map +1 -1
- package/dist/compiler/utils/schema-converter.js +1 -4
- package/dist/compiler/utils/schema-converter.js.map +1 -1
- 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 +8 -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/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/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 +2 -2
- package/dist/primitives/base.handler.d.ts.map +1 -1
- package/dist/primitives/base.handler.js +38 -36
- 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 +1 -1
- package/dist/primitives/job.handler.d.ts.map +1 -1
- package/dist/primitives/job.handler.js +3 -6
- 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 +1 -1
- package/dist/primitives/webhook.handler.d.ts.map +1 -1
- package/dist/primitives/webhook.handler.js +2 -3
- 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 +1 -1
- package/dist/services/auth.js +7 -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 +126 -78
- 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.map +1 -1
- package/dist/utils/aliases.js +38 -3
- package/dist/utils/aliases.js.map +1 -1
- 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.map +1 -1
- package/dist/utils/backup-helpers.js +10 -16
- 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.map +1 -1
- package/dist/utils/cli.js +3 -5
- 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.map +1 -1
- package/dist/utils/hints.js +3 -5
- package/dist/utils/hints.js.map +1 -1
- 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.map +1 -1
- package/dist/utils/suggest.js +1 -3
- package/dist/utils/suggest.js.map +1 -1
- 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/docs/README.md +1 -1
- package/node_modules/@lua/shared-types/dist/index.d.mts +13 -1
- package/node_modules/@lua/shared-types/dist/index.d.ts +13 -1
- 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/chat-stream.types.ts +11 -0
- package/node_modules/@lua/shared-types/src/device.types.ts +6 -6
- package/node_modules/@lua/shared-types/src/index.ts +1 -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 +11 -11
- package/package.json +1 -1
- 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 -63
- 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 +79 -77
- 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
|
@@ -1,49 +1,48 @@
|
|
|
1
|
-
import { AI, LuaTool, User, Jobs, JobInstance } from
|
|
2
|
-
import { z } from
|
|
3
|
-
|
|
1
|
+
import { AI, LuaTool, User, Jobs, JobInstance } from 'lua-cli';
|
|
2
|
+
import { z } from 'zod';
|
|
4
3
|
|
|
5
4
|
export class GetUserDataTool implements LuaTool {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
name = 'get_user_data';
|
|
6
|
+
description = 'Get the user data for a given user id';
|
|
7
|
+
inputSchema = z.object({});
|
|
9
8
|
|
|
10
|
-
|
|
9
|
+
constructor() {}
|
|
11
10
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
11
|
+
async execute(input: z.infer<typeof this.inputSchema>) {
|
|
12
|
+
const user = await User.get();
|
|
13
|
+
return {
|
|
14
|
+
success: true,
|
|
15
|
+
message: 'User data retrieved',
|
|
16
|
+
data: user.data,
|
|
17
|
+
name: user.name,
|
|
18
|
+
age: user.age,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
22
21
|
}
|
|
23
22
|
|
|
24
23
|
export class UpdateUserDataTool implements LuaTool {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
24
|
+
name = 'update_user_data';
|
|
25
|
+
description = 'Update the user data for a given user id';
|
|
26
|
+
inputSchema = z.object({
|
|
27
|
+
data: z.object({
|
|
28
|
+
name: z.string().optional(),
|
|
29
|
+
age: z.number().optional(),
|
|
30
|
+
}),
|
|
31
|
+
});
|
|
33
32
|
|
|
34
|
-
|
|
33
|
+
constructor() {}
|
|
35
34
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
35
|
+
async execute(input: z.infer<typeof this.inputSchema>) {
|
|
36
|
+
const user = await User.get(); //get instance of user
|
|
37
|
+
user.name = input.data.name;
|
|
38
|
+
user.age = input.data.age;
|
|
39
|
+
await user.save();
|
|
40
|
+
// await user.send([{ type: "text", text: "Hello, how are you?" }]);
|
|
41
|
+
return {
|
|
42
|
+
success: true,
|
|
43
|
+
message: 'User data updated',
|
|
44
|
+
};
|
|
45
|
+
}
|
|
47
46
|
}
|
|
48
47
|
|
|
49
48
|
/**
|
|
@@ -51,72 +50,72 @@ export class UpdateUserDataTool implements LuaTool {
|
|
|
51
50
|
* Useful for analyzing past interactions or providing context.
|
|
52
51
|
*/
|
|
53
52
|
export class GetChatHistoryTool implements LuaTool {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
53
|
+
name = 'get_chat_history';
|
|
54
|
+
description = 'Get the conversation history for the current user';
|
|
55
|
+
inputSchema = z.object({
|
|
56
|
+
limit: z.number().optional().describe('Maximum number of messages to retrieve'),
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
async execute(input: z.infer<typeof this.inputSchema>) {
|
|
60
|
+
const history = await User.getChatHistory();
|
|
59
61
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
history: formattedHistory
|
|
79
|
-
};
|
|
80
|
-
}
|
|
62
|
+
// Optionally limit the results
|
|
63
|
+
const messages = input.limit ? history.slice(-input.limit) : history;
|
|
64
|
+
|
|
65
|
+
// Format the history for easier reading
|
|
66
|
+
const formattedHistory = messages.map((msg) => ({
|
|
67
|
+
role: msg.role,
|
|
68
|
+
content: msg.content,
|
|
69
|
+
createdAt: msg.createdAt,
|
|
70
|
+
id: msg.id,
|
|
71
|
+
}));
|
|
72
|
+
|
|
73
|
+
return {
|
|
74
|
+
success: true,
|
|
75
|
+
totalMessages: history.length,
|
|
76
|
+
returnedMessages: messages.length,
|
|
77
|
+
history: formattedHistory,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
81
80
|
}
|
|
82
81
|
|
|
83
82
|
export class WritePoemTool implements LuaTool {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
83
|
+
name = 'write_poem';
|
|
84
|
+
description = 'Write a poem about a given topic';
|
|
85
|
+
inputSchema = z.object({
|
|
86
|
+
topic: z.string(),
|
|
87
|
+
});
|
|
88
|
+
async execute(input: z.infer<typeof this.inputSchema>) {
|
|
89
|
+
return await AI.generate('Write a poem about the following topic:', [{ type: 'text', text: input.topic }]);
|
|
90
|
+
}
|
|
92
91
|
}
|
|
93
92
|
|
|
94
93
|
export class CreateInlineJobTool implements LuaTool {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
94
|
+
name = 'create-job-to-notify-user';
|
|
95
|
+
description = 'Create a new job to notify the user';
|
|
96
|
+
inputSchema = z.object({
|
|
97
|
+
message: z.string(),
|
|
98
|
+
});
|
|
99
|
+
async execute(input: z.infer<typeof this.inputSchema>) {
|
|
100
|
+
//create a job to notify the user in exactly 20 seconds
|
|
101
|
+
const job = await Jobs.create({
|
|
102
|
+
name: 'notify-user-new',
|
|
103
|
+
description: 'Notify the user',
|
|
104
|
+
schedule: {
|
|
105
|
+
type: 'once',
|
|
106
|
+
executeAt: new Date(Date.now() + 0),
|
|
107
|
+
},
|
|
108
|
+
metadata: {
|
|
109
|
+
message: input.message,
|
|
110
|
+
},
|
|
111
|
+
execute: async (jobInstance: JobInstance) => {
|
|
112
|
+
const user = await jobInstance.user();
|
|
113
|
+
const metadata = jobInstance.metadata; //we do this to access runtime variables in the job when the job is executed
|
|
114
|
+
console.log('Metadata', metadata);
|
|
115
|
+
await user.send([{ type: 'text', text: metadata.message }]);
|
|
116
|
+
return { success: true, message: 'User notified' };
|
|
117
|
+
},
|
|
99
118
|
});
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
name: "notify-user-new",
|
|
104
|
-
description: "Notify the user",
|
|
105
|
-
schedule: {
|
|
106
|
-
type: "once",
|
|
107
|
-
executeAt: new Date(Date.now() + 0)
|
|
108
|
-
},
|
|
109
|
-
metadata: {
|
|
110
|
-
message: input.message
|
|
111
|
-
},
|
|
112
|
-
execute: async (jobInstance: JobInstance) => {
|
|
113
|
-
const user = await jobInstance.user();
|
|
114
|
-
const metadata = jobInstance.metadata; //we do this to access runtime variables in the job when the job is executed
|
|
115
|
-
console.log("Metadata", metadata);
|
|
116
|
-
await user.send([{ type: "text", text: metadata.message }]);
|
|
117
|
-
return { success: true, message: "User notified" };
|
|
118
|
-
}
|
|
119
|
-
});
|
|
120
|
-
return { success: true, job: job };
|
|
121
|
-
}
|
|
122
|
-
}
|
|
119
|
+
return { success: true, job: job };
|
|
120
|
+
}
|
|
121
|
+
}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { LuaSkill } from
|
|
2
|
-
import { CreateInlineJobTool, GetUserDataTool, UpdateUserDataTool, WritePoemTool } from
|
|
3
|
-
|
|
1
|
+
import { LuaSkill } from 'lua-cli';
|
|
2
|
+
import { CreateInlineJobTool, GetUserDataTool, UpdateUserDataTool, WritePoemTool } from '../skills/tools/UserDataTool';
|
|
4
3
|
|
|
5
4
|
const userSkill = new LuaSkill({
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
name: 'user-skill',
|
|
6
|
+
description: 'User management skill',
|
|
7
|
+
context: 'User management skill',
|
|
8
|
+
tools: [new GetUserDataTool(), new UpdateUserDataTool(), new WritePoemTool(), new CreateInlineJobTool()],
|
|
10
9
|
});
|
|
11
10
|
|
|
12
|
-
export default userSkill;
|
|
11
|
+
export default userSkill;
|
|
@@ -1,37 +1,39 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* File Upload Webhook
|
|
3
|
-
*
|
|
3
|
+
*
|
|
4
4
|
* Receives file uploads from external systems and stores them in the CDN.
|
|
5
|
-
*
|
|
5
|
+
*
|
|
6
6
|
* Use cases:
|
|
7
7
|
* - Customer uploads documents via your website form
|
|
8
8
|
* - Integration with document management systems
|
|
9
9
|
* - Receiving images/files from third-party services
|
|
10
|
-
*
|
|
10
|
+
*
|
|
11
11
|
* Webhook URL: https://webhook.heylua.ai/{agentId}/file-upload
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
import { LuaWebhook, CDN, Data, User } from
|
|
15
|
-
import { z } from
|
|
14
|
+
import { LuaWebhook, CDN, Data, User } from 'lua-cli';
|
|
15
|
+
import { z } from 'zod';
|
|
16
16
|
|
|
17
17
|
const fileUploadWebhook = new LuaWebhook({
|
|
18
|
-
name:
|
|
19
|
-
description:
|
|
18
|
+
name: 'file-upload',
|
|
19
|
+
description: 'Receives file uploads and stores them in CDN',
|
|
20
20
|
|
|
21
21
|
headerSchema: z.object({
|
|
22
22
|
'content-type': z.string(),
|
|
23
|
-
'x-api-key': z.string().optional()
|
|
23
|
+
'x-api-key': z.string().optional(),
|
|
24
24
|
}),
|
|
25
25
|
|
|
26
26
|
bodySchema: z.object({
|
|
27
27
|
filename: z.string(),
|
|
28
28
|
contentType: z.string(),
|
|
29
|
-
data: z.string().describe(
|
|
30
|
-
metadata: z
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
29
|
+
data: z.string().describe('Base64 encoded file data'),
|
|
30
|
+
metadata: z
|
|
31
|
+
.object({
|
|
32
|
+
category: z.string().optional(),
|
|
33
|
+
description: z.string().optional(),
|
|
34
|
+
tags: z.array(z.string()).optional(),
|
|
35
|
+
})
|
|
36
|
+
.optional(),
|
|
35
37
|
}),
|
|
36
38
|
|
|
37
39
|
execute: async (event: any) => {
|
|
@@ -51,24 +53,30 @@ const fileUploadWebhook = new LuaWebhook({
|
|
|
51
53
|
console.log(`✅ File stored with ID: ${fileId}`);
|
|
52
54
|
|
|
53
55
|
// Store file metadata in custom data for later retrieval
|
|
54
|
-
const fileRecord = await Data.create(
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
56
|
+
const fileRecord = await Data.create(
|
|
57
|
+
'uploaded-files',
|
|
58
|
+
{
|
|
59
|
+
fileId: fileId,
|
|
60
|
+
filename: body.filename,
|
|
61
|
+
contentType: body.contentType,
|
|
62
|
+
size: file.size,
|
|
63
|
+
category: body.metadata?.category || 'uncategorized',
|
|
64
|
+
description: body.metadata?.description,
|
|
65
|
+
tags: body.metadata?.tags || [],
|
|
66
|
+
uploadedAt: new Date().toISOString(),
|
|
67
|
+
},
|
|
68
|
+
`${body.filename} ${body.metadata?.category || ''} ${body.metadata?.tags?.join(' ') || ''}`
|
|
69
|
+
);
|
|
64
70
|
|
|
65
71
|
// Notify user about the upload
|
|
66
72
|
const user = await User.get();
|
|
67
73
|
if (user) {
|
|
68
|
-
await user.send([
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
74
|
+
await user.send([
|
|
75
|
+
{
|
|
76
|
+
type: 'text',
|
|
77
|
+
text: `📁 New file uploaded: ${body.filename}`,
|
|
78
|
+
},
|
|
79
|
+
]);
|
|
72
80
|
}
|
|
73
81
|
|
|
74
82
|
return {
|
|
@@ -77,10 +85,9 @@ const fileUploadWebhook = new LuaWebhook({
|
|
|
77
85
|
recordId: fileRecord.id,
|
|
78
86
|
filename: body.filename,
|
|
79
87
|
size: file.size,
|
|
80
|
-
message: 'File uploaded and stored successfully'
|
|
88
|
+
message: 'File uploaded and stored successfully',
|
|
81
89
|
};
|
|
82
|
-
}
|
|
90
|
+
},
|
|
83
91
|
});
|
|
84
92
|
|
|
85
93
|
export default fileUploadWebhook;
|
|
86
|
-
|
|
@@ -1,44 +1,46 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Payment Webhook Example
|
|
3
|
-
*
|
|
3
|
+
*
|
|
4
4
|
* This webhook receives payment notifications from payment providers (Stripe, PayPal, etc.).
|
|
5
5
|
* It validates signatures, processes payment events, and updates order status.
|
|
6
|
-
*
|
|
6
|
+
*
|
|
7
7
|
* Common use case: Stripe webhook for payment confirmations
|
|
8
|
-
*
|
|
8
|
+
*
|
|
9
9
|
* Webhook URLs:
|
|
10
10
|
* https://webhook.heylua.ai/{agentId}/{webhookId}
|
|
11
11
|
* https://webhook.heylua.ai/{agentId}/{webhook-name}
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
import { LuaWebhook, Orders, Data } from
|
|
15
|
-
import { z } from
|
|
14
|
+
import { LuaWebhook, Orders, Data } from 'lua-cli';
|
|
15
|
+
import { z } from 'zod';
|
|
16
16
|
|
|
17
17
|
const paymentWebhook = new LuaWebhook({
|
|
18
|
-
name:
|
|
19
|
-
description:
|
|
18
|
+
name: 'payment-notifications',
|
|
19
|
+
description: 'Receives payment notifications from payment providers',
|
|
20
20
|
|
|
21
21
|
// Headers typically include webhook signature for verification
|
|
22
22
|
headerSchema: z.object({
|
|
23
23
|
'stripe-signature': z.string().optional(),
|
|
24
|
-
'content-type': z.string()
|
|
24
|
+
'content-type': z.string(),
|
|
25
25
|
}),
|
|
26
26
|
|
|
27
27
|
// Payment event body
|
|
28
28
|
bodySchema: z.object({
|
|
29
|
-
type: z.string(),
|
|
29
|
+
type: z.string(), // e.g., 'payment_intent.succeeded'
|
|
30
30
|
data: z.object({
|
|
31
31
|
object: z.object({
|
|
32
32
|
id: z.string(),
|
|
33
33
|
amount: z.number(),
|
|
34
34
|
currency: z.string(),
|
|
35
35
|
status: z.string(),
|
|
36
|
-
metadata: z
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
36
|
+
metadata: z
|
|
37
|
+
.object({
|
|
38
|
+
orderId: z.string().optional(),
|
|
39
|
+
customerId: z.string().optional(),
|
|
40
|
+
})
|
|
41
|
+
.optional(),
|
|
42
|
+
}),
|
|
43
|
+
}),
|
|
42
44
|
}),
|
|
43
45
|
|
|
44
46
|
execute: async (event: any) => {
|
|
@@ -76,14 +78,14 @@ const paymentWebhook = new LuaWebhook({
|
|
|
76
78
|
orderId: payment.metadata?.orderId,
|
|
77
79
|
customerId: payment.metadata?.customerId,
|
|
78
80
|
status: 'succeeded',
|
|
79
|
-
receivedAt: new Date().toISOString()
|
|
81
|
+
receivedAt: new Date().toISOString(),
|
|
80
82
|
});
|
|
81
83
|
|
|
82
84
|
return {
|
|
83
85
|
success: true,
|
|
84
86
|
paymentId: payment.id,
|
|
85
87
|
orderId: payment.metadata?.orderId,
|
|
86
|
-
message: 'Payment processed successfully'
|
|
88
|
+
message: 'Payment processed successfully',
|
|
87
89
|
};
|
|
88
90
|
}
|
|
89
91
|
|
|
@@ -94,23 +96,22 @@ const paymentWebhook = new LuaWebhook({
|
|
|
94
96
|
await Data.create('payment-logs', {
|
|
95
97
|
paymentId: payment.id,
|
|
96
98
|
status: 'failed',
|
|
97
|
-
receivedAt: new Date().toISOString()
|
|
99
|
+
receivedAt: new Date().toISOString(),
|
|
98
100
|
});
|
|
99
101
|
|
|
100
102
|
return {
|
|
101
103
|
success: true,
|
|
102
104
|
paymentId: payment.id,
|
|
103
|
-
message: 'Payment failure logged'
|
|
105
|
+
message: 'Payment failure logged',
|
|
104
106
|
};
|
|
105
107
|
}
|
|
106
108
|
|
|
107
109
|
// Other event types
|
|
108
110
|
return {
|
|
109
111
|
success: true,
|
|
110
|
-
message: `Event ${eventType} received
|
|
112
|
+
message: `Event ${eventType} received`,
|
|
111
113
|
};
|
|
112
|
-
}
|
|
114
|
+
},
|
|
113
115
|
});
|
|
114
116
|
|
|
115
117
|
export default paymentWebhook;
|
|
116
|
-
|
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* User Event Webhook Example
|
|
3
|
-
*
|
|
3
|
+
*
|
|
4
4
|
* This webhook receives user events from external systems (e.g., CRM, marketing tools).
|
|
5
5
|
* It validates incoming data, stores events for processing, and can send template
|
|
6
6
|
* messages using the Templates API (currently supports WhatsApp templates).
|
|
7
|
-
*
|
|
7
|
+
*
|
|
8
8
|
* Webhook URLs:
|
|
9
9
|
* https://webhook.heylua.ai/{agentId}/{webhookId}
|
|
10
10
|
* https://webhook.heylua.ai/{agentId}/{webhook-name}
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import { LuaWebhook, Data, Templates } from
|
|
14
|
-
import { z } from
|
|
13
|
+
import { LuaWebhook, Data, Templates } from 'lua-cli';
|
|
14
|
+
import { z } from 'zod';
|
|
15
15
|
|
|
16
16
|
const userEventWebhook = new LuaWebhook({
|
|
17
|
-
name:
|
|
18
|
-
description:
|
|
17
|
+
name: 'user-events',
|
|
18
|
+
description: 'Receives user events from external systems',
|
|
19
19
|
|
|
20
20
|
// Validate query parameters (optional source tracking)
|
|
21
21
|
querySchema: z.object({
|
|
22
22
|
source: z.string().optional(),
|
|
23
|
-
version: z.string().optional()
|
|
23
|
+
version: z.string().optional(),
|
|
24
24
|
}),
|
|
25
25
|
|
|
26
26
|
// Validate headers (require API key for security)
|
|
27
27
|
headerSchema: z.object({
|
|
28
28
|
'x-api-key': z.string(),
|
|
29
|
-
'content-type': z.string().optional()
|
|
29
|
+
'content-type': z.string().optional(),
|
|
30
30
|
}),
|
|
31
31
|
|
|
32
32
|
// Validate request body
|
|
@@ -38,7 +38,7 @@ const userEventWebhook = new LuaWebhook({
|
|
|
38
38
|
phoneNumber: z.string().optional(),
|
|
39
39
|
channelId: z.string().optional(),
|
|
40
40
|
metadata: z.record(z.any()).optional(),
|
|
41
|
-
timestamp: z.string()
|
|
41
|
+
timestamp: z.string(),
|
|
42
42
|
}),
|
|
43
43
|
|
|
44
44
|
execute: async (event: any) => {
|
|
@@ -57,12 +57,10 @@ const userEventWebhook = new LuaWebhook({
|
|
|
57
57
|
...body,
|
|
58
58
|
source: query?.source,
|
|
59
59
|
receivedAt: new Date().toISOString(),
|
|
60
|
-
processed: false
|
|
60
|
+
processed: false,
|
|
61
61
|
};
|
|
62
62
|
|
|
63
|
-
const result = await Data.create('user-events', eventData,
|
|
64
|
-
`${body?.eventType} ${body?.email} ${body?.name || ''}`
|
|
65
|
-
);
|
|
63
|
+
const result = await Data.create('user-events', eventData, `${body?.eventType} ${body?.email} ${body?.name || ''}`);
|
|
66
64
|
|
|
67
65
|
console.log('✅ Event stored successfully:', result.id);
|
|
68
66
|
|
|
@@ -74,14 +72,14 @@ const userEventWebhook = new LuaWebhook({
|
|
|
74
72
|
// Search for a welcome template
|
|
75
73
|
const response = await Templates.whatsapp.list(body.channelId, { search: 'welcome' });
|
|
76
74
|
const welcomeTemplate = response.templates.find((t: any) => t.status === 'APPROVED');
|
|
77
|
-
|
|
75
|
+
|
|
78
76
|
if (welcomeTemplate) {
|
|
79
77
|
// Send the template message
|
|
80
78
|
templateResult = await Templates.whatsapp.send(body.channelId, welcomeTemplate.id, {
|
|
81
79
|
phoneNumbers: [body.phoneNumber],
|
|
82
80
|
values: {
|
|
83
|
-
body: { name: body.name || 'there' }
|
|
84
|
-
}
|
|
81
|
+
body: { name: body.name || 'there' },
|
|
82
|
+
},
|
|
85
83
|
});
|
|
86
84
|
console.log('📱 Welcome template sent:', templateResult.results[0]?.messages[0]?.id);
|
|
87
85
|
}
|
|
@@ -96,10 +94,9 @@ const userEventWebhook = new LuaWebhook({
|
|
|
96
94
|
eventId: result.id,
|
|
97
95
|
userId: body?.userId,
|
|
98
96
|
templateSent: templateResult?.totalErrors === 0,
|
|
99
|
-
timestamp: new Date().toISOString()
|
|
97
|
+
timestamp: new Date().toISOString(),
|
|
100
98
|
};
|
|
101
|
-
}
|
|
99
|
+
},
|
|
102
100
|
});
|
|
103
101
|
|
|
104
102
|
export default userEventWebhook;
|
|
105
|
-
|
package/template/lua.skill.yaml
CHANGED
package/template/package.json
CHANGED
package/template/src/index.ts
CHANGED
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
import { LuaAgent } from
|
|
1
|
+
import { LuaAgent } from 'lua-cli';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Your Lua AI Agent
|
|
5
|
-
*
|
|
5
|
+
*
|
|
6
6
|
* This is a minimal agent ready for you to customize.
|
|
7
7
|
* Add skills, webhooks, jobs, and processors as needed.
|
|
8
|
-
*
|
|
8
|
+
*
|
|
9
9
|
* Quick start:
|
|
10
10
|
* 1. Create a tool in src/skills/tools/MyTool.ts
|
|
11
11
|
* 2. Create a skill in src/skills/my.skill.ts
|
|
12
12
|
* 3. Import and add it to the skills array below
|
|
13
13
|
* 4. Run `lua test` to test your tool
|
|
14
14
|
* 5. Run `lua chat` to chat with your agent
|
|
15
|
-
*
|
|
15
|
+
*
|
|
16
16
|
* Need examples? Run `lua init --with-examples` in a new project
|
|
17
17
|
* or see: https://docs.heylua.ai/examples
|
|
18
18
|
*/
|
|
19
19
|
const agent = new LuaAgent({
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
20
|
+
name: ``, // Set during lua init
|
|
21
|
+
persona: ``, // Set during lua init
|
|
22
|
+
|
|
23
|
+
// Add your skills here
|
|
24
|
+
skills: [],
|
|
25
|
+
|
|
26
|
+
// Optional: Add webhooks for external integrations
|
|
27
|
+
// webhooks: [],
|
|
28
|
+
|
|
29
|
+
// Optional: Add scheduled jobs
|
|
30
|
+
// jobs: [],
|
|
31
|
+
|
|
32
|
+
// Optional: Add message preprocessors
|
|
33
|
+
// preProcessors: [],
|
|
34
|
+
|
|
35
|
+
// Optional: Add response postprocessors
|
|
36
|
+
// postProcessors: [],
|
|
37
37
|
});
|
|
38
38
|
|
|
39
39
|
async function main() {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
40
|
+
// Your agent is ready!
|
|
41
|
+
//
|
|
42
|
+
// Next steps:
|
|
43
|
+
// 1. Create your first skill with tools
|
|
44
|
+
// 2. Run `lua test` to test tools interactively
|
|
45
|
+
// 3. Run `lua chat` to chat with your agent
|
|
46
|
+
// 4. Run `lua push` to deploy
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
main().catch(console.error);
|