lua-cli 3.13.0 → 3.14.1
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/skills.d.ts +18 -0
- package/dist/interfaces/skills.d.ts.map +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 +72 -22
- 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 +47 -0
- package/dist/utils/artifact-loader.d.ts.map +1 -1
- package/dist/utils/artifact-loader.js +98 -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,51 +1,51 @@
|
|
|
1
|
-
import { LuaTool, env } from
|
|
2
|
-
import { z } from
|
|
1
|
+
import { LuaTool, env } from 'lua-cli';
|
|
2
|
+
import { z } from 'zod';
|
|
3
3
|
|
|
4
4
|
export default class CreatePaymentLinkTool implements LuaTool {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
5
|
+
name = 'create_payment_link';
|
|
6
|
+
description = 'Create a Stripe payment link for a one-time payment';
|
|
7
|
+
inputSchema = z.object({
|
|
8
|
+
amount: z.number().int().positive(), // in cents
|
|
9
|
+
currency: z.string().default('usd'),
|
|
10
|
+
});
|
|
11
|
+
outputSchema = z.object({
|
|
12
|
+
url: z.string(),
|
|
13
|
+
id: z.string(),
|
|
14
|
+
});
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
async execute(input: z.infer<typeof this.inputSchema>) {
|
|
17
|
+
const apiKey = env('STRIPE_SECRET_KEY');
|
|
18
|
+
if (!apiKey) {
|
|
19
|
+
throw new Error('STRIPE_SECRET_KEY is not set in environment variables');
|
|
20
|
+
}
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
22
|
+
// Create a one-time Checkout Session with dummy redirect URLs
|
|
23
|
+
const sessionRes = await fetch('https://api.stripe.com/v1/checkout/sessions', {
|
|
24
|
+
method: 'POST',
|
|
25
|
+
headers: {
|
|
26
|
+
Authorization: `Bearer ${apiKey}`,
|
|
27
|
+
'Content-Type': 'application/x-www-form-urlencoded',
|
|
28
|
+
},
|
|
29
|
+
body: new URLSearchParams({
|
|
30
|
+
mode: 'payment',
|
|
31
|
+
'line_items[0][price_data][currency]': input.currency,
|
|
32
|
+
'line_items[0][price_data][product_data][name]': 'One-time Payment',
|
|
33
|
+
'line_items[0][price_data][unit_amount]': input.amount.toString(),
|
|
34
|
+
'line_items[0][quantity]': '1',
|
|
35
|
+
success_url: 'https://example.com/success',
|
|
36
|
+
cancel_url: 'https://example.com/cancel',
|
|
37
|
+
}),
|
|
38
|
+
});
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
if (!sessionRes.ok) {
|
|
41
|
+
throw new Error(`Failed to create checkout session: ${await sessionRes.text()}`);
|
|
42
|
+
}
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
const session = await sessionRes.json();
|
|
45
45
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
46
|
+
return {
|
|
47
|
+
url: session.url,
|
|
48
|
+
id: session.id,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
51
|
}
|
|
@@ -1,98 +1,100 @@
|
|
|
1
|
-
import { LuaTool, Products, User } from
|
|
2
|
-
import { z } from
|
|
1
|
+
import { LuaTool, Products, User } from 'lua-cli';
|
|
2
|
+
import { z } from 'zod';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Example tool with a condition.
|
|
6
|
-
*
|
|
6
|
+
*
|
|
7
7
|
* The `condition` function determines if this tool should be available to the LLM.
|
|
8
8
|
* It runs BEFORE the tool is offered, so the LLM won't see this tool if condition returns false.
|
|
9
|
-
*
|
|
9
|
+
*
|
|
10
10
|
* Use cases:
|
|
11
11
|
* - Premium/paid features only for subscribed users
|
|
12
12
|
* - Features based on user verification status
|
|
13
13
|
* - Region-specific tools
|
|
14
14
|
* - A/B testing tool availability
|
|
15
15
|
* - Time-based feature access
|
|
16
|
-
*
|
|
16
|
+
*
|
|
17
17
|
* The condition has access to all Platform APIs: User, Data, Products, Baskets, Orders, etc.
|
|
18
18
|
*/
|
|
19
19
|
export default class PremiumFeatureTool implements LuaTool {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
inputSchema = z.object({
|
|
24
|
-
query: z.string().describe("Search query"),
|
|
25
|
-
filters: z.object({
|
|
26
|
-
category: z.string().optional().describe("Filter by category"),
|
|
27
|
-
minPrice: z.number().optional().describe("Minimum price filter"),
|
|
28
|
-
maxPrice: z.number().optional().describe("Maximum price filter"),
|
|
29
|
-
}).optional().describe("Optional filters"),
|
|
30
|
-
sortBy: z.enum(["relevance", "price_asc", "price_desc"]).optional().describe("Sort order")
|
|
31
|
-
});
|
|
20
|
+
name = 'premium_advanced_search';
|
|
21
|
+
description = 'Advanced search with filters and sorting - available to premium users only';
|
|
32
22
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
23
|
+
inputSchema = z.object({
|
|
24
|
+
query: z.string().describe('Search query'),
|
|
25
|
+
filters: z
|
|
26
|
+
.object({
|
|
27
|
+
category: z.string().optional().describe('Filter by category'),
|
|
28
|
+
minPrice: z.number().optional().describe('Minimum price filter'),
|
|
29
|
+
maxPrice: z.number().optional().describe('Maximum price filter'),
|
|
30
|
+
})
|
|
31
|
+
.optional()
|
|
32
|
+
.describe('Optional filters'),
|
|
33
|
+
sortBy: z.enum(['relevance', 'price_asc', 'price_desc']).optional().describe('Sort order'),
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Condition function - determines if this tool should be available.
|
|
38
|
+
*
|
|
39
|
+
* This runs once per request when tools are being built.
|
|
40
|
+
* Return true to enable the tool, false to hide it from the LLM.
|
|
41
|
+
*
|
|
42
|
+
* If condition throws an error, the tool is disabled (fail-closed behavior).
|
|
43
|
+
*/
|
|
44
|
+
condition = async () => {
|
|
45
|
+
// Get the current user's data (returns null when called outside a conversation)
|
|
46
|
+
const user = await User.get();
|
|
47
|
+
if (!user) return false;
|
|
48
|
+
|
|
49
|
+
// Check if user has premium subscription
|
|
50
|
+
// The 'data' field contains custom user data stored via User.update()
|
|
51
|
+
const isPremium = user.data?.subscription === 'premium' || user.data?.isPremium === true;
|
|
57
52
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
// Products.search(query) — returns ProductSearchInstance (iterable, has .products)
|
|
63
|
-
const searchResult = await Products.search(query);
|
|
64
|
-
const products = searchResult.products;
|
|
65
|
-
|
|
66
|
-
// Apply filters client-side
|
|
67
|
-
let filteredResults = products;
|
|
53
|
+
// You can also check other conditions:
|
|
54
|
+
// - user.data?.trialEndsAt > Date.now() (trial period)
|
|
55
|
+
// - user.country?.code === "US" (region-based)
|
|
56
|
+
// - user.data?.featureFlags?.advancedSearch (feature flags)
|
|
68
57
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
58
|
+
return isPremium;
|
|
59
|
+
};
|
|
72
60
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
if (filters.minPrice !== undefined && price < filters.minPrice) return false;
|
|
77
|
-
if (filters.maxPrice !== undefined && price > filters.maxPrice) return false;
|
|
78
|
-
return true;
|
|
79
|
-
});
|
|
80
|
-
}
|
|
61
|
+
async execute(input: z.infer<typeof this.inputSchema>) {
|
|
62
|
+
// This only runs if condition returned true
|
|
63
|
+
const { query, filters, sortBy } = input;
|
|
81
64
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
totalResults: filteredResults.length,
|
|
92
|
-
results: filteredResults.slice(0, 10), // Return top 10
|
|
93
|
-
appliedFilters: filters,
|
|
94
|
-
sortedBy: sortBy || "relevance"
|
|
95
|
-
};
|
|
65
|
+
// Products.search(query) — returns ProductSearchInstance (iterable, has .products)
|
|
66
|
+
const searchResult = await Products.search(query);
|
|
67
|
+
const products = searchResult.products;
|
|
68
|
+
|
|
69
|
+
// Apply filters client-side
|
|
70
|
+
let filteredResults = products;
|
|
71
|
+
|
|
72
|
+
if (filters?.category) {
|
|
73
|
+
filteredResults = filteredResults.filter((p) => p.category === filters.category);
|
|
96
74
|
}
|
|
97
|
-
}
|
|
98
75
|
|
|
76
|
+
if (filters?.minPrice !== undefined || filters?.maxPrice !== undefined) {
|
|
77
|
+
filteredResults = filteredResults.filter((product) => {
|
|
78
|
+
const price = product.price || 0;
|
|
79
|
+
if (filters.minPrice !== undefined && price < filters.minPrice) return false;
|
|
80
|
+
if (filters.maxPrice !== undefined && price > filters.maxPrice) return false;
|
|
81
|
+
return true;
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// Sort client-side when requested
|
|
86
|
+
if (sortBy === 'price_asc') {
|
|
87
|
+
filteredResults = [...filteredResults].sort((a, b) => (a.price || 0) - (b.price || 0));
|
|
88
|
+
} else if (sortBy === 'price_desc') {
|
|
89
|
+
filteredResults = [...filteredResults].sort((a, b) => (b.price || 0) - (a.price || 0));
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return {
|
|
93
|
+
query,
|
|
94
|
+
totalResults: filteredResults.length,
|
|
95
|
+
results: filteredResults.slice(0, 10), // Return top 10
|
|
96
|
+
appliedFilters: filters,
|
|
97
|
+
sortedBy: sortBy || 'relevance',
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
}
|
|
@@ -1,94 +1,93 @@
|
|
|
1
|
-
import { LuaTool, Products } from
|
|
2
|
-
import { z } from
|
|
1
|
+
import { LuaTool, Products } from 'lua-cli';
|
|
2
|
+
import { z } from 'zod';
|
|
3
3
|
import { BasketStatus, OrderStatus } from 'lua-cli';
|
|
4
4
|
import { v4 as uuidv4 } from 'uuid';
|
|
5
5
|
export class SearchProductsTool implements LuaTool {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
name = 'search_products';
|
|
7
|
+
description = 'Search for products';
|
|
8
|
+
inputSchema = z.object({
|
|
9
|
+
query: z.string(),
|
|
10
|
+
});
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
constructor() {}
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
async execute(input: z.infer<typeof this.inputSchema>) {
|
|
15
|
+
return await Products.search(input.query);
|
|
16
|
+
}
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
export class GetAllProductsTool implements LuaTool {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
20
|
+
name = 'get_all_products';
|
|
21
|
+
description = 'Get all products';
|
|
22
|
+
inputSchema = z.object({
|
|
23
|
+
page: z.number().optional(),
|
|
24
|
+
limit: z.number().optional(),
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
async execute(input: z.infer<typeof this.inputSchema>) {
|
|
28
|
+
return await Products.get(input.page, input.limit);
|
|
29
|
+
}
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
export class CreateProductTool implements LuaTool {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
33
|
+
name = 'create_product';
|
|
34
|
+
description = 'Create a new product';
|
|
35
|
+
inputSchema = z.object({
|
|
36
|
+
product: z.object({
|
|
37
|
+
name: z.string(),
|
|
38
|
+
description: z.string(),
|
|
39
|
+
price: z.number(),
|
|
40
|
+
}),
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
async execute(input: z.infer<typeof this.inputSchema>) {
|
|
44
|
+
return Products.create({ ...input.product, id: uuidv4() });
|
|
45
|
+
}
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
export class UpdateProductTool implements LuaTool {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
49
|
+
name = 'update_product';
|
|
50
|
+
description = 'Update an existing product';
|
|
51
|
+
inputSchema = z.object({
|
|
52
|
+
product: z.object({
|
|
53
|
+
id: z.string(),
|
|
54
|
+
name: z.string(),
|
|
55
|
+
description: z.string(),
|
|
56
|
+
price: z.number(),
|
|
57
|
+
}),
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
async execute(input: z.infer<typeof this.inputSchema>) {
|
|
61
|
+
const product = await Products.getById(input.product.id);
|
|
62
|
+
return product.update({ ...input.product });
|
|
63
|
+
}
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
export class GetProductByIdTool implements LuaTool {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
67
|
+
name = 'get_product_by_id';
|
|
68
|
+
description = 'Get a product by its unique identifier';
|
|
69
|
+
inputSchema = z.object({
|
|
70
|
+
id: z.string(),
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
async execute(input: z.infer<typeof this.inputSchema>) {
|
|
74
|
+
return Products.getById(input.id);
|
|
75
|
+
}
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
export class DeleteProductTool implements LuaTool {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
79
|
+
name = 'delete_product';
|
|
80
|
+
description = 'Delete an existing product';
|
|
81
|
+
inputSchema = z.object({
|
|
82
|
+
id: z.string(),
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
async execute(input: z.infer<typeof this.inputSchema>) {
|
|
86
|
+
const product = await Products.getById(input.id);
|
|
87
|
+
return product.delete();
|
|
88
|
+
}
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
|
|
92
91
|
// export class CreateOrderTool implements LuaTool {
|
|
93
92
|
// name = "create_order";
|
|
94
93
|
// description = "Create a new order";
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Smart Basket Tool Example
|
|
3
|
-
*
|
|
3
|
+
*
|
|
4
4
|
* This tool creates a basket AND schedules a follow-up job to check if it was abandoned.
|
|
5
5
|
* Demonstrates: Dynamic job creation, basket management, and automated follow-ups.
|
|
6
|
-
*
|
|
6
|
+
*
|
|
7
7
|
* Use case: E-commerce abandoned cart recovery
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import { LuaTool, Baskets, Jobs, Data } from
|
|
11
|
-
import { z } from
|
|
10
|
+
import { LuaTool, Baskets, Jobs, Data } from 'lua-cli';
|
|
11
|
+
import { z } from 'zod';
|
|
12
12
|
|
|
13
13
|
export class CreateSmartBasketTool implements LuaTool {
|
|
14
|
-
name =
|
|
15
|
-
description =
|
|
16
|
-
|
|
14
|
+
name = 'create_smart_basket';
|
|
15
|
+
description = 'Creates a basket with automatic abandoned cart reminder';
|
|
16
|
+
|
|
17
17
|
inputSchema = z.object({
|
|
18
|
-
currency: z.string().default('USD')
|
|
18
|
+
currency: z.string().default('USD'),
|
|
19
19
|
});
|
|
20
20
|
|
|
21
21
|
async execute(input: { currency: string }) {
|
|
@@ -27,8 +27,8 @@ export class CreateSmartBasketTool implements LuaTool {
|
|
|
27
27
|
metadata: {
|
|
28
28
|
createdBy: 'smart-basket-tool',
|
|
29
29
|
reminderScheduled: true,
|
|
30
|
-
createdAt: new Date().toISOString()
|
|
31
|
-
}
|
|
30
|
+
createdAt: new Date().toISOString(),
|
|
31
|
+
},
|
|
32
32
|
};
|
|
33
33
|
|
|
34
34
|
const basketInstance = await Baskets.create(basketData);
|
|
@@ -43,38 +43,38 @@ export class CreateSmartBasketTool implements LuaTool {
|
|
|
43
43
|
const basketId = basketInfo.id;
|
|
44
44
|
|
|
45
45
|
// Create a dynamic one-time job using the Jobs API!
|
|
46
|
-
|
|
46
|
+
|
|
47
47
|
const job = await Jobs.create({
|
|
48
48
|
name: `check-basket-${basketId}`,
|
|
49
49
|
description: `Check if basket ${basketId} was checked out`,
|
|
50
|
-
|
|
50
|
+
|
|
51
51
|
// One-time job that runs in 3 hours
|
|
52
52
|
schedule: {
|
|
53
53
|
type: 'once',
|
|
54
|
-
executeAt: checkTime
|
|
54
|
+
executeAt: checkTime,
|
|
55
55
|
},
|
|
56
|
-
|
|
57
|
-
timeout: 60,
|
|
58
|
-
|
|
56
|
+
|
|
57
|
+
timeout: 60, // 1 minute timeout
|
|
58
|
+
|
|
59
59
|
// Write normal TypeScript code! It will be compiled automatically
|
|
60
60
|
execute: async () => {
|
|
61
61
|
console.log(`⏰ Checking basket ${basketId}...`);
|
|
62
|
-
|
|
62
|
+
|
|
63
63
|
const basketInstance = await Baskets.getById(basketId);
|
|
64
64
|
const basket = await basketInstance.getData();
|
|
65
|
-
|
|
65
|
+
|
|
66
66
|
if (basket.status === 'active' || basket.status === 'pending') {
|
|
67
67
|
// Basket is still active - it was abandoned!
|
|
68
68
|
console.log(`🛒 Basket ${basketId} was abandoned`);
|
|
69
|
-
|
|
69
|
+
|
|
70
70
|
await Data.create('abandoned-baskets', {
|
|
71
71
|
basketId: basketId,
|
|
72
72
|
currency: basket.currency,
|
|
73
73
|
itemCount: basket.items?.length || 0,
|
|
74
74
|
totalValue: basket.total || 0,
|
|
75
|
-
abandonedAt: new Date().toISOString()
|
|
75
|
+
abandonedAt: new Date().toISOString(),
|
|
76
76
|
});
|
|
77
|
-
|
|
77
|
+
|
|
78
78
|
console.log('📧 Sending abandoned cart reminder email...');
|
|
79
79
|
// TODO: Integrate with email service
|
|
80
80
|
// await sendEmail({
|
|
@@ -82,21 +82,21 @@ export class CreateSmartBasketTool implements LuaTool {
|
|
|
82
82
|
// template: 'abandoned-cart',
|
|
83
83
|
// data: { basket }
|
|
84
84
|
// });
|
|
85
|
-
|
|
86
|
-
return {
|
|
87
|
-
abandoned: true,
|
|
85
|
+
|
|
86
|
+
return {
|
|
87
|
+
abandoned: true,
|
|
88
88
|
basketId: basketId,
|
|
89
|
-
reminderSent: true
|
|
89
|
+
reminderSent: true,
|
|
90
90
|
};
|
|
91
91
|
}
|
|
92
|
-
|
|
92
|
+
|
|
93
93
|
console.log(`✅ Basket ${basketId} was checked out`);
|
|
94
|
-
return {
|
|
95
|
-
abandoned: false,
|
|
94
|
+
return {
|
|
95
|
+
abandoned: false,
|
|
96
96
|
basketId: basketId,
|
|
97
|
-
status: basket.status
|
|
97
|
+
status: basket.status,
|
|
98
98
|
};
|
|
99
|
-
}
|
|
99
|
+
},
|
|
100
100
|
});
|
|
101
101
|
|
|
102
102
|
console.log(`⏰ One-time job created: ${job.jobId}`);
|
|
@@ -108,29 +108,29 @@ export class CreateSmartBasketTool implements LuaTool {
|
|
|
108
108
|
basket: {
|
|
109
109
|
id: basketInfo.id,
|
|
110
110
|
currency: basketInfo.currency,
|
|
111
|
-
status: basketInfo.status
|
|
111
|
+
status: basketInfo.status,
|
|
112
112
|
},
|
|
113
113
|
scheduledJob: {
|
|
114
114
|
jobId: job.jobId,
|
|
115
115
|
name: job.name,
|
|
116
116
|
scheduledFor: checkTime.toISOString(),
|
|
117
|
-
message: 'One-time job will check basket in 3 hours'
|
|
118
|
-
}
|
|
117
|
+
message: 'One-time job will check basket in 3 hours',
|
|
118
|
+
},
|
|
119
119
|
};
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
/**
|
|
124
124
|
* Check Abandoned Baskets Tool
|
|
125
|
-
*
|
|
125
|
+
*
|
|
126
126
|
* This tool can be called manually or by a recurring job to check for abandoned baskets.
|
|
127
127
|
*/
|
|
128
128
|
export class CheckAbandonedBasketsTool implements LuaTool {
|
|
129
|
-
name =
|
|
130
|
-
description =
|
|
131
|
-
|
|
129
|
+
name = 'check_abandoned_baskets';
|
|
130
|
+
description = 'Checks for abandoned baskets and sends reminders';
|
|
131
|
+
|
|
132
132
|
inputSchema = z.object({
|
|
133
|
-
basketId: z.string().optional()
|
|
133
|
+
basketId: z.string().optional(),
|
|
134
134
|
});
|
|
135
135
|
|
|
136
136
|
async execute(input: { basketId?: string }) {
|
|
@@ -143,14 +143,14 @@ export class CheckAbandonedBasketsTool implements LuaTool {
|
|
|
143
143
|
if (input.basketId) {
|
|
144
144
|
// Check specific basket
|
|
145
145
|
const specific = abandonedBaskets.find((ab: any) => ab.data.basketId === input.basketId);
|
|
146
|
-
|
|
146
|
+
|
|
147
147
|
if (specific) {
|
|
148
148
|
return {
|
|
149
149
|
basketId: input.basketId,
|
|
150
150
|
abandoned: true,
|
|
151
151
|
abandonedAt: specific.data.abandonedAt,
|
|
152
152
|
itemCount: specific.data.itemCount,
|
|
153
|
-
totalValue: specific.data.totalValue
|
|
153
|
+
totalValue: specific.data.totalValue,
|
|
154
154
|
};
|
|
155
155
|
}
|
|
156
156
|
|
|
@@ -162,7 +162,7 @@ export class CheckAbandonedBasketsTool implements LuaTool {
|
|
|
162
162
|
basketId: input.basketId,
|
|
163
163
|
abandoned: false,
|
|
164
164
|
status: basket.status,
|
|
165
|
-
itemCount: basket.items?.length || 0
|
|
165
|
+
itemCount: basket.items?.length || 0,
|
|
166
166
|
};
|
|
167
167
|
}
|
|
168
168
|
|
|
@@ -172,7 +172,7 @@ export class CheckAbandonedBasketsTool implements LuaTool {
|
|
|
172
172
|
currency: ab.data.currency,
|
|
173
173
|
itemCount: ab.data.itemCount,
|
|
174
174
|
totalValue: ab.data.totalValue,
|
|
175
|
-
abandonedAt: ab.data.abandonedAt
|
|
175
|
+
abandonedAt: ab.data.abandonedAt,
|
|
176
176
|
}));
|
|
177
177
|
|
|
178
178
|
console.log(`🛒 Found ${abandonedBaskets.length} abandoned baskets`);
|
|
@@ -181,8 +181,7 @@ export class CheckAbandonedBasketsTool implements LuaTool {
|
|
|
181
181
|
success: true,
|
|
182
182
|
abandonedCount: abandonedBaskets.length,
|
|
183
183
|
abandonedBaskets: summary,
|
|
184
|
-
timestamp: new Date().toISOString()
|
|
184
|
+
timestamp: new Date().toISOString(),
|
|
185
185
|
};
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
|
-
|