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,29 +1,29 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Game Score Tracker Tool - Complex Dynamic Job Example
|
|
3
|
-
*
|
|
3
|
+
*
|
|
4
4
|
* This tool demonstrates:
|
|
5
5
|
* 1. Creating a game tracking record
|
|
6
6
|
* 2. Creating an interval job that starts at game time
|
|
7
7
|
* 3. Job fetches score updates periodically
|
|
8
8
|
* 4. Job checks if game is over
|
|
9
9
|
* 5. Job deactivates itself when game ends
|
|
10
|
-
*
|
|
10
|
+
*
|
|
11
11
|
* Use case: Live sports score tracking, esports matches, auction monitoring
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
import { LuaTool, Jobs, Data } from
|
|
15
|
-
import { z } from
|
|
14
|
+
import { LuaTool, Jobs, Data } from 'lua-cli';
|
|
15
|
+
import { z } from 'zod';
|
|
16
16
|
|
|
17
17
|
export class TrackGameScoresTool implements LuaTool {
|
|
18
|
-
name =
|
|
19
|
-
description =
|
|
20
|
-
|
|
18
|
+
name = 'track_game_scores';
|
|
19
|
+
description = 'Track live scores for a game with automatic updates';
|
|
20
|
+
|
|
21
21
|
inputSchema = z.object({
|
|
22
22
|
gameId: z.string(),
|
|
23
23
|
gameName: z.string(),
|
|
24
24
|
startTime: z.string(), // ISO 8601 timestamp
|
|
25
25
|
updateIntervalSeconds: z.number().min(30).max(600).default(60), // 30s to 10min
|
|
26
|
-
apiEndpoint: z.string().optional() // Optional external API
|
|
26
|
+
apiEndpoint: z.string().optional(), // Optional external API
|
|
27
27
|
});
|
|
28
28
|
|
|
29
29
|
async execute(input: {
|
|
@@ -43,12 +43,10 @@ export class TrackGameScoresTool implements LuaTool {
|
|
|
43
43
|
status: 'scheduled',
|
|
44
44
|
currentScore: { home: 0, away: 0 },
|
|
45
45
|
lastUpdate: new Date().toISOString(),
|
|
46
|
-
createdAt: new Date().toISOString()
|
|
46
|
+
createdAt: new Date().toISOString(),
|
|
47
47
|
};
|
|
48
48
|
|
|
49
|
-
const game = await Data.create('games', gameRecord,
|
|
50
|
-
`${input.gameName} ${input.gameId}`
|
|
51
|
-
);
|
|
49
|
+
const game = await Data.create('games', gameRecord, `${input.gameName} ${input.gameId}`);
|
|
52
50
|
|
|
53
51
|
console.log(`✅ Game record created: ${game.id}`);
|
|
54
52
|
|
|
@@ -75,57 +73,57 @@ export class TrackGameScoresTool implements LuaTool {
|
|
|
75
73
|
const job = await Jobs.create({
|
|
76
74
|
name: `track-game-${gameId}`,
|
|
77
75
|
description: `Live score tracking for ${gameName}`,
|
|
78
|
-
|
|
76
|
+
|
|
79
77
|
// Important: Use interval schedule
|
|
80
78
|
schedule: {
|
|
81
79
|
type: 'interval',
|
|
82
|
-
seconds: intervalSeconds
|
|
80
|
+
seconds: intervalSeconds,
|
|
83
81
|
},
|
|
84
|
-
|
|
85
|
-
timeout: 30,
|
|
86
|
-
|
|
82
|
+
|
|
83
|
+
timeout: 30, // Each update should complete in 30 seconds
|
|
84
|
+
|
|
87
85
|
retry: {
|
|
88
|
-
maxAttempts: 2,
|
|
89
|
-
backoffSeconds: 10
|
|
86
|
+
maxAttempts: 2, // Retry failed updates
|
|
87
|
+
backoffSeconds: 10,
|
|
90
88
|
},
|
|
91
|
-
|
|
89
|
+
|
|
92
90
|
// The job logic - runs every interval until game ends
|
|
93
91
|
execute: async () => {
|
|
94
92
|
console.log('🎮 Fetching score update for game ' + gameId + '...');
|
|
95
|
-
|
|
93
|
+
|
|
96
94
|
try {
|
|
97
95
|
// Fetch current game data from our database
|
|
98
96
|
const gameData = await Data.getEntry('games', gameRecordId);
|
|
99
|
-
|
|
97
|
+
|
|
100
98
|
// Check if game is already over
|
|
101
99
|
if (gameData.data.status === 'finished') {
|
|
102
100
|
console.log('🏁 Game ' + gameId + ' is already finished. Stopping job.');
|
|
103
|
-
|
|
101
|
+
|
|
104
102
|
// IMPORTANT: Job stops itself using the instance method!
|
|
105
103
|
await job.deactivate();
|
|
106
|
-
|
|
104
|
+
|
|
107
105
|
return {
|
|
108
106
|
action: 'job-stopped',
|
|
109
107
|
reason: 'game-finished',
|
|
110
108
|
gameId: gameId,
|
|
111
|
-
finalScore: gameData.data.currentScore
|
|
109
|
+
finalScore: gameData.data.currentScore,
|
|
112
110
|
};
|
|
113
111
|
}
|
|
114
|
-
|
|
112
|
+
|
|
115
113
|
// Fetch latest scores from external API
|
|
116
114
|
let scoreUpdate;
|
|
117
115
|
try {
|
|
118
116
|
const response = await fetch(apiEndpoint + '/' + gameId);
|
|
119
|
-
|
|
117
|
+
|
|
120
118
|
if (!response.ok) {
|
|
121
119
|
throw new Error('API returned ' + response.status);
|
|
122
120
|
}
|
|
123
|
-
|
|
121
|
+
|
|
124
122
|
scoreUpdate = await response.json();
|
|
125
123
|
} catch (apiError) {
|
|
126
124
|
// If external API fails, generate mock data for demo
|
|
127
125
|
console.warn('External API failed, using mock data:', apiError);
|
|
128
|
-
|
|
126
|
+
|
|
129
127
|
// Simulate score progression
|
|
130
128
|
const currentScore = gameData.data.currentScore;
|
|
131
129
|
scoreUpdate = {
|
|
@@ -133,79 +131,78 @@ export class TrackGameScoresTool implements LuaTool {
|
|
|
133
131
|
away: currentScore.away + Math.floor(Math.random() * 2),
|
|
134
132
|
quarter: Math.min(4, Math.floor(Date.now() / 1000 / 60 / 15) % 5),
|
|
135
133
|
timeRemaining: '12:34',
|
|
136
|
-
isFinished: Math.random() > 0.9
|
|
134
|
+
isFinished: Math.random() > 0.9, // 10% chance game ends
|
|
137
135
|
};
|
|
138
136
|
}
|
|
139
|
-
|
|
137
|
+
|
|
140
138
|
// Update game record with new scores
|
|
141
139
|
const updatedGame = await Data.update('games', gameRecordId, {
|
|
142
140
|
...gameData.data,
|
|
143
141
|
currentScore: {
|
|
144
142
|
home: scoreUpdate.home,
|
|
145
|
-
away: scoreUpdate.away
|
|
143
|
+
away: scoreUpdate.away,
|
|
146
144
|
},
|
|
147
145
|
quarter: scoreUpdate.quarter,
|
|
148
146
|
timeRemaining: scoreUpdate.timeRemaining,
|
|
149
147
|
status: scoreUpdate.isFinished ? 'finished' : 'in-progress',
|
|
150
|
-
lastUpdate: new Date().toISOString()
|
|
148
|
+
lastUpdate: new Date().toISOString(),
|
|
151
149
|
});
|
|
152
|
-
|
|
150
|
+
|
|
153
151
|
console.log('📊 Score update: ' + scoreUpdate.home + ' - ' + scoreUpdate.away);
|
|
154
|
-
|
|
152
|
+
|
|
155
153
|
// Check if game just ended
|
|
156
154
|
if (scoreUpdate.isFinished) {
|
|
157
155
|
console.log('🏁 Game ' + gameId + ' has finished!');
|
|
158
156
|
console.log('Final score: ' + scoreUpdate.home + ' - ' + scoreUpdate.away);
|
|
159
|
-
|
|
157
|
+
|
|
160
158
|
// Store final game result
|
|
161
159
|
await Data.create('game-results', {
|
|
162
160
|
gameId: gameId,
|
|
163
161
|
gameName: gameName,
|
|
164
162
|
finalScore: {
|
|
165
163
|
home: scoreUpdate.home,
|
|
166
|
-
away: scoreUpdate.away
|
|
164
|
+
away: scoreUpdate.away,
|
|
167
165
|
},
|
|
168
|
-
finishedAt: new Date().toISOString()
|
|
166
|
+
finishedAt: new Date().toISOString(),
|
|
169
167
|
});
|
|
170
|
-
|
|
168
|
+
|
|
171
169
|
// IMPORTANT: Job stops itself when game ends using instance method!
|
|
172
170
|
await job.deactivate();
|
|
173
|
-
|
|
171
|
+
|
|
174
172
|
console.log('⏹️ Score tracking job stopped for game ' + gameId);
|
|
175
|
-
|
|
173
|
+
|
|
176
174
|
return {
|
|
177
175
|
action: 'game-ended-job-stopped',
|
|
178
176
|
gameId: gameId,
|
|
179
177
|
finalScore: {
|
|
180
178
|
home: scoreUpdate.home,
|
|
181
|
-
away: scoreUpdate.away
|
|
182
|
-
}
|
|
179
|
+
away: scoreUpdate.away,
|
|
180
|
+
},
|
|
183
181
|
};
|
|
184
182
|
}
|
|
185
|
-
|
|
183
|
+
|
|
186
184
|
// Game still in progress
|
|
187
185
|
return {
|
|
188
186
|
action: 'score-updated',
|
|
189
187
|
gameId: gameId,
|
|
190
188
|
currentScore: {
|
|
191
189
|
home: scoreUpdate.home,
|
|
192
|
-
away: scoreUpdate.away
|
|
190
|
+
away: scoreUpdate.away,
|
|
193
191
|
},
|
|
194
192
|
quarter: scoreUpdate.quarter,
|
|
195
|
-
timeRemaining: scoreUpdate.timeRemaining
|
|
193
|
+
timeRemaining: scoreUpdate.timeRemaining,
|
|
196
194
|
};
|
|
197
|
-
|
|
198
195
|
} catch (error: any) {
|
|
199
196
|
console.error('❌ Error updating score for game ' + gameId + ':', error);
|
|
200
|
-
|
|
197
|
+
|
|
201
198
|
// Don't stop job on errors - just log and continue
|
|
202
199
|
return {
|
|
203
200
|
action: 'error',
|
|
204
201
|
gameId: gameId,
|
|
205
|
-
error: error.message
|
|
202
|
+
error: error.message,
|
|
206
203
|
};
|
|
207
204
|
}
|
|
208
|
-
}
|
|
205
|
+
},
|
|
209
206
|
});
|
|
210
207
|
|
|
211
208
|
console.log(`✅ Score tracking job created: ${job.id}`);
|
|
@@ -219,30 +216,30 @@ export class TrackGameScoresTool implements LuaTool {
|
|
|
219
216
|
gameId: input.gameId,
|
|
220
217
|
name: input.gameName,
|
|
221
218
|
startTime: input.startTime,
|
|
222
|
-
status: 'scheduled'
|
|
219
|
+
status: 'scheduled',
|
|
223
220
|
},
|
|
224
221
|
scoreTracker: {
|
|
225
222
|
jobId: job.id,
|
|
226
223
|
jobName: job.name,
|
|
227
224
|
updateInterval: input.updateIntervalSeconds,
|
|
228
225
|
startsAt: jobStartTime.toISOString(),
|
|
229
|
-
message: 'Job will automatically stop when game ends'
|
|
230
|
-
}
|
|
226
|
+
message: 'Job will automatically stop when game ends',
|
|
227
|
+
},
|
|
231
228
|
};
|
|
232
229
|
}
|
|
233
230
|
}
|
|
234
231
|
|
|
235
232
|
/**
|
|
236
233
|
* Get Game Scores Tool
|
|
237
|
-
*
|
|
234
|
+
*
|
|
238
235
|
* Retrieves current scores for a game or all active games
|
|
239
236
|
*/
|
|
240
237
|
export class GetGameScoresTool implements LuaTool {
|
|
241
|
-
name =
|
|
242
|
-
description =
|
|
243
|
-
|
|
238
|
+
name = 'get_game_scores';
|
|
239
|
+
description = 'Get current scores for tracked games';
|
|
240
|
+
|
|
244
241
|
inputSchema = z.object({
|
|
245
|
-
gameId: z.string().optional()
|
|
242
|
+
gameId: z.string().optional(),
|
|
246
243
|
});
|
|
247
244
|
|
|
248
245
|
async execute(input: { gameId?: string }) {
|
|
@@ -250,12 +247,12 @@ export class GetGameScoresTool implements LuaTool {
|
|
|
250
247
|
// Get specific game
|
|
251
248
|
const games = await Data.get('games', {}, 1, 100);
|
|
252
249
|
const game = games.data?.find((g: any) => g.data.gameId === input.gameId);
|
|
253
|
-
|
|
250
|
+
|
|
254
251
|
if (!game) {
|
|
255
252
|
return {
|
|
256
253
|
found: false,
|
|
257
254
|
gameId: input.gameId,
|
|
258
|
-
message: 'Game not found'
|
|
255
|
+
message: 'Game not found',
|
|
259
256
|
};
|
|
260
257
|
}
|
|
261
258
|
|
|
@@ -268,14 +265,14 @@ export class GetGameScoresTool implements LuaTool {
|
|
|
268
265
|
currentScore: game.data.currentScore,
|
|
269
266
|
quarter: game.data.quarter,
|
|
270
267
|
timeRemaining: game.data.timeRemaining,
|
|
271
|
-
lastUpdate: game.data.lastUpdate
|
|
272
|
-
}
|
|
268
|
+
lastUpdate: game.data.lastUpdate,
|
|
269
|
+
},
|
|
273
270
|
};
|
|
274
271
|
}
|
|
275
272
|
|
|
276
273
|
// Get all active games
|
|
277
274
|
const allGames = await Data.get('games', {}, 1, 50);
|
|
278
|
-
|
|
275
|
+
|
|
279
276
|
const activeGames = (allGames.data || [])
|
|
280
277
|
.filter((g: any) => g.data.status === 'in-progress' || g.data.status === 'scheduled')
|
|
281
278
|
.map((g: any) => ({
|
|
@@ -283,27 +280,27 @@ export class GetGameScoresTool implements LuaTool {
|
|
|
283
280
|
name: g.data.gameName,
|
|
284
281
|
status: g.data.status,
|
|
285
282
|
currentScore: g.data.currentScore,
|
|
286
|
-
lastUpdate: g.data.lastUpdate
|
|
283
|
+
lastUpdate: g.data.lastUpdate,
|
|
287
284
|
}));
|
|
288
285
|
|
|
289
286
|
return {
|
|
290
287
|
activeGamesCount: activeGames.length,
|
|
291
|
-
games: activeGames
|
|
288
|
+
games: activeGames,
|
|
292
289
|
};
|
|
293
290
|
}
|
|
294
291
|
}
|
|
295
292
|
|
|
296
293
|
/**
|
|
297
294
|
* Stop Game Tracking Tool
|
|
298
|
-
*
|
|
295
|
+
*
|
|
299
296
|
* Manually stops score tracking for a game
|
|
300
297
|
*/
|
|
301
298
|
export class StopGameTrackingTool implements LuaTool {
|
|
302
|
-
name =
|
|
303
|
-
description =
|
|
304
|
-
|
|
299
|
+
name = 'stop_game_tracking';
|
|
300
|
+
description = 'Manually stop score tracking for a game';
|
|
301
|
+
|
|
305
302
|
inputSchema = z.object({
|
|
306
|
-
gameId: z.string()
|
|
303
|
+
gameId: z.string(),
|
|
307
304
|
});
|
|
308
305
|
|
|
309
306
|
async execute(input: { gameId: string }) {
|
|
@@ -312,15 +309,13 @@ export class StopGameTrackingTool implements LuaTool {
|
|
|
312
309
|
// Find the tracking job - Jobs.getAll() returns array of JobInstance
|
|
313
310
|
const allJobs = await Jobs.getAll({ includeDynamic: true });
|
|
314
311
|
|
|
315
|
-
const trackingJob = allJobs.find((j: any) =>
|
|
316
|
-
j.name === `track-game-${input.gameId}`
|
|
317
|
-
);
|
|
312
|
+
const trackingJob = allJobs.find((j: any) => j.name === `track-game-${input.gameId}`);
|
|
318
313
|
|
|
319
314
|
if (!trackingJob) {
|
|
320
315
|
return {
|
|
321
316
|
success: false,
|
|
322
317
|
gameId: input.gameId,
|
|
323
|
-
message: 'No tracking job found for this game'
|
|
318
|
+
message: 'No tracking job found for this game',
|
|
324
319
|
};
|
|
325
320
|
}
|
|
326
321
|
|
|
@@ -330,12 +325,12 @@ export class StopGameTrackingTool implements LuaTool {
|
|
|
330
325
|
// Update game status
|
|
331
326
|
const games = await Data.get('games', {}, 1, 100);
|
|
332
327
|
const game = games.data?.find((g: any) => g.data.gameId === input.gameId);
|
|
333
|
-
|
|
328
|
+
|
|
334
329
|
if (game) {
|
|
335
330
|
await Data.update('games', game.id, {
|
|
336
331
|
...game.data,
|
|
337
332
|
status: 'stopped',
|
|
338
|
-
stoppedAt: new Date().toISOString()
|
|
333
|
+
stoppedAt: new Date().toISOString(),
|
|
339
334
|
});
|
|
340
335
|
}
|
|
341
336
|
|
|
@@ -345,8 +340,7 @@ export class StopGameTrackingTool implements LuaTool {
|
|
|
345
340
|
success: true,
|
|
346
341
|
gameId: input.gameId,
|
|
347
342
|
jobId: trackingJob.id,
|
|
348
|
-
message: 'Score tracking stopped successfully'
|
|
343
|
+
message: 'Score tracking stopped successfully',
|
|
349
344
|
};
|
|
350
345
|
}
|
|
351
346
|
}
|
|
352
|
-
|
|
@@ -1,53 +1,51 @@
|
|
|
1
|
-
import { LuaTool } from
|
|
2
|
-
import { z } from
|
|
1
|
+
import { LuaTool } from 'lua-cli';
|
|
2
|
+
import { z } from 'zod';
|
|
3
3
|
|
|
4
4
|
export default class GetWeatherTool implements LuaTool {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
5
|
+
name = 'get_weather';
|
|
6
|
+
description = 'Get the weather for a given city';
|
|
7
|
+
inputSchema = z.object({
|
|
8
|
+
city: z.string(),
|
|
9
|
+
});
|
|
10
|
+
outputSchema = z.object({
|
|
11
|
+
weather: z.string(),
|
|
12
|
+
city: z.string(),
|
|
13
|
+
temperature: z.number().optional(),
|
|
14
|
+
humidity: z.number().optional(),
|
|
15
|
+
description: z.string().optional(),
|
|
16
|
+
});
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
input.city
|
|
22
|
-
)}&count=1`;
|
|
23
|
-
|
|
24
|
-
const geoRes = await fetch(geoUrl);
|
|
25
|
-
if (!geoRes.ok) {
|
|
26
|
-
throw new Error(`Failed to fetch location: ${geoRes.statusText}`);
|
|
27
|
-
}
|
|
28
|
-
const geoData = await geoRes.json();
|
|
29
|
-
if (!geoData.results || geoData.results.length === 0) {
|
|
30
|
-
throw new Error(`No location found for ${input.city}`);
|
|
31
|
-
}
|
|
18
|
+
async execute(input: z.infer<typeof this.inputSchema>) {
|
|
19
|
+
// Step 1: Geocode city → lat/lon (use Open-Meteo’s free geocoding API)
|
|
20
|
+
const geoUrl = `https://geocoding-api.open-meteo.com/v1/search?name=${encodeURIComponent(input.city)}&count=1`;
|
|
32
21
|
|
|
33
|
-
|
|
22
|
+
const geoRes = await fetch(geoUrl);
|
|
23
|
+
if (!geoRes.ok) {
|
|
24
|
+
throw new Error(`Failed to fetch location: ${geoRes.statusText}`);
|
|
25
|
+
}
|
|
26
|
+
const geoData = await geoRes.json();
|
|
27
|
+
if (!geoData.results || geoData.results.length === 0) {
|
|
28
|
+
throw new Error(`No location found for ${input.city}`);
|
|
29
|
+
}
|
|
34
30
|
|
|
35
|
-
|
|
36
|
-
const weatherUrl = `https://api.open-meteo.com/v1/forecast?latitude=${latitude}&longitude=${longitude}¤t_weather=true`;
|
|
37
|
-
|
|
38
|
-
const weatherRes = await fetch(weatherUrl);
|
|
39
|
-
if (!weatherRes.ok) {
|
|
40
|
-
throw new Error(`Failed to fetch weather: ${weatherRes.statusText}`);
|
|
41
|
-
}
|
|
42
|
-
const weatherData = await weatherRes.json();
|
|
43
|
-
const current = weatherData.current_weather;
|
|
31
|
+
const { latitude, longitude, name } = geoData.results[0];
|
|
44
32
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
};
|
|
33
|
+
// Step 2: Get weather for lat/lon
|
|
34
|
+
const weatherUrl = `https://api.open-meteo.com/v1/forecast?latitude=${latitude}&longitude=${longitude}¤t_weather=true`;
|
|
35
|
+
|
|
36
|
+
const weatherRes = await fetch(weatherUrl);
|
|
37
|
+
if (!weatherRes.ok) {
|
|
38
|
+
throw new Error(`Failed to fetch weather: ${weatherRes.statusText}`);
|
|
52
39
|
}
|
|
40
|
+
const weatherData = await weatherRes.json();
|
|
41
|
+
const current = weatherData.current_weather;
|
|
42
|
+
|
|
43
|
+
return {
|
|
44
|
+
weather: current.weathercode?.toString() || 'Unknown',
|
|
45
|
+
city: name,
|
|
46
|
+
temperature: current.temperature,
|
|
47
|
+
humidity: undefined, // Open-Meteo current_weather does not include humidity
|
|
48
|
+
description: `Windspeed ${current.windspeed} km/h`,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
53
51
|
}
|
|
@@ -1,56 +1,56 @@
|
|
|
1
|
-
import { LuaTool, Orders
|
|
2
|
-
import { z } from
|
|
1
|
+
import { LuaTool, Orders } from 'lua-cli';
|
|
2
|
+
import { z } from 'zod';
|
|
3
3
|
import { OrderStatus } from 'lua-cli';
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
5
|
export class CreateOrderTool implements LuaTool {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
6
|
+
name = 'create_order';
|
|
7
|
+
description = 'Create a new order';
|
|
8
|
+
inputSchema = z.object({
|
|
9
|
+
order: z.object({
|
|
10
|
+
basketId: z.string(),
|
|
11
|
+
data: z
|
|
12
|
+
.object({
|
|
13
|
+
storeId: z.string(),
|
|
16
14
|
})
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
.optional(),
|
|
16
|
+
}),
|
|
17
|
+
});
|
|
18
|
+
async execute(input: z.infer<typeof this.inputSchema>) {
|
|
19
|
+
return Orders.create(input.order);
|
|
20
|
+
}
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
export class UpdateOrderStatusTool implements LuaTool {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
24
|
+
name = 'update_order_status';
|
|
25
|
+
description = 'Update the status of an order';
|
|
26
|
+
inputSchema = z.object({
|
|
27
|
+
orderId: z.string(),
|
|
28
|
+
status: z.enum(['pending', 'confirmed', 'fulfilled', 'cancelled']),
|
|
29
|
+
});
|
|
30
|
+
async execute(input: z.infer<typeof this.inputSchema>) {
|
|
31
|
+
const order = await Orders.getById(input.orderId);
|
|
32
|
+
return order.updateStatus(input.status as OrderStatus);
|
|
33
|
+
}
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
export class GetUserOrdersTool implements LuaTool {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
37
|
+
name = 'get_user_orders';
|
|
38
|
+
description = 'Get all orders for a user';
|
|
39
|
+
inputSchema = z.object({});
|
|
40
|
+
async execute(input: z.infer<typeof this.inputSchema>) {
|
|
41
|
+
return Orders.get();
|
|
42
|
+
}
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
export class GetOrderByIdTool implements LuaTool {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
46
|
+
name = 'get_order_by_id';
|
|
47
|
+
description = 'Get an order by id';
|
|
48
|
+
inputSchema = z.object({
|
|
49
|
+
orderId: z.string(),
|
|
50
|
+
});
|
|
51
|
+
async execute(input: z.infer<typeof this.inputSchema>) {
|
|
52
|
+
return Orders.getById(input.orderId);
|
|
53
|
+
}
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
/**
|
|
@@ -58,22 +58,22 @@ export class GetOrderByIdTool implements LuaTool {
|
|
|
58
58
|
* Useful for adding tracking info, notes, or custom metadata.
|
|
59
59
|
*/
|
|
60
60
|
export class UpdateOrderDataTool implements LuaTool {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
61
|
+
name = 'update_order_data';
|
|
62
|
+
description = 'Update custom data on an order (tracking info, notes, etc.)';
|
|
63
|
+
inputSchema = z.object({
|
|
64
|
+
orderId: z.string().describe('The order ID to update'),
|
|
65
|
+
data: z.record(z.any()).describe('Custom data to add/update on the order'),
|
|
66
|
+
});
|
|
67
|
+
async execute(input: z.infer<typeof this.inputSchema>) {
|
|
68
|
+
console.log(`📝 Updating order ${input.orderId} with data:`, input.data);
|
|
69
|
+
|
|
70
|
+
const result = await Orders.updateData(input.data, input.orderId);
|
|
71
|
+
|
|
72
|
+
return {
|
|
73
|
+
success: true,
|
|
74
|
+
orderId: input.orderId,
|
|
75
|
+
message: 'Order data updated successfully',
|
|
76
|
+
updatedData: input.data,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
79
|
}
|