lua-cli 3.12.2 → 3.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -13
- package/dist/api/agent.api.service.d.ts +20 -20
- package/dist/api/agent.api.service.d.ts.map +1 -1
- package/dist/api/agent.api.service.js +1 -1
- package/dist/api/agent.api.service.js.map +1 -1
- package/dist/api/agents.api.service.d.ts +3 -3
- package/dist/api/agents.api.service.d.ts.map +1 -1
- package/dist/api/agents.api.service.js +11 -9
- package/dist/api/agents.api.service.js.map +1 -1
- package/dist/api/ai.api.service.d.ts +4 -4
- package/dist/api/ai.api.service.d.ts.map +1 -1
- package/dist/api/ai.api.service.js +10 -8
- package/dist/api/ai.api.service.js.map +1 -1
- package/dist/api/auth.api.service.d.ts +3 -3
- package/dist/api/auth.api.service.d.ts.map +1 -1
- package/dist/api/auth.api.service.js +1 -1
- package/dist/api/auth.api.service.js.map +1 -1
- package/dist/api/backup.api.service.d.ts.map +1 -1
- package/dist/api/backup.api.service.js +21 -7
- package/dist/api/backup.api.service.js.map +1 -1
- package/dist/api/basket.api.service.d.ts +5 -5
- package/dist/api/basket.api.service.d.ts.map +1 -1
- package/dist/api/basket.api.service.js +4 -4
- package/dist/api/basket.api.service.js.map +1 -1
- package/dist/api/cdn.api.service.d.ts +1 -1
- package/dist/api/cdn.api.service.js +3 -3
- package/dist/api/cdn.api.service.js.map +1 -1
- package/dist/api/chat.api.service.d.ts +4 -4
- package/dist/api/chat.api.service.js +3 -3
- package/dist/api/chat.api.service.js.map +1 -1
- package/dist/api/credentials.js +3 -3
- package/dist/api/custom.data.api.service.d.ts +4 -4
- package/dist/api/custom.data.api.service.d.ts.map +1 -1
- package/dist/api/custom.data.api.service.js +2 -2
- package/dist/api/custom.data.api.service.js.map +1 -1
- package/dist/api/developer.api.service.d.ts +3 -3
- package/dist/api/developer.api.service.d.ts.map +1 -1
- package/dist/api/developer.api.service.js +7 -3
- package/dist/api/developer.api.service.js.map +1 -1
- package/dist/api/device-trigger.api.service.d.ts +3 -3
- package/dist/api/device-trigger.api.service.d.ts.map +1 -1
- package/dist/api/device-trigger.api.service.js +1 -1
- package/dist/api/device-trigger.api.service.js.map +1 -1
- package/dist/api/device.api.service.d.ts +3 -3
- package/dist/api/device.api.service.d.ts.map +1 -1
- package/dist/api/device.api.service.js +1 -1
- package/dist/api/device.api.service.js.map +1 -1
- package/dist/api/http.client.d.ts +1 -1
- package/dist/api/http.client.d.ts.map +1 -1
- package/dist/api/http.client.js +6 -6
- package/dist/api/http.client.js.map +1 -1
- package/dist/api/job.api.service.d.ts +13 -14
- package/dist/api/job.api.service.d.ts.map +1 -1
- package/dist/api/job.api.service.js +12 -20
- package/dist/api/job.api.service.js.map +1 -1
- package/dist/api/lazy-instances.d.ts +12 -12
- package/dist/api/lazy-instances.js +14 -14
- package/dist/api/logs.api.service.d.ts +9 -6
- package/dist/api/logs.api.service.d.ts.map +1 -1
- package/dist/api/logs.api.service.js +12 -11
- package/dist/api/logs.api.service.js.map +1 -1
- package/dist/api/marketplace.api.service.d.ts +1 -1
- package/dist/api/marketplace.api.service.d.ts.map +1 -1
- package/dist/api/marketplace.api.service.js +18 -18
- package/dist/api/marketplace.api.service.js.map +1 -1
- package/dist/api/order.api.service.d.ts +4 -4
- package/dist/api/order.api.service.d.ts.map +1 -1
- package/dist/api/order.api.service.js +2 -2
- package/dist/api/order.api.service.js.map +1 -1
- package/dist/api/persona.api.service.d.ts +3 -3
- package/dist/api/persona.api.service.d.ts.map +1 -1
- package/dist/api/persona.api.service.js +2 -2
- package/dist/api/persona.api.service.js.map +1 -1
- package/dist/api/postprocessor.api.service.d.ts +8 -9
- package/dist/api/postprocessor.api.service.d.ts.map +1 -1
- package/dist/api/postprocessor.api.service.js +1 -2
- package/dist/api/postprocessor.api.service.js.map +1 -1
- package/dist/api/preprocessor.api.service.d.ts +8 -9
- package/dist/api/preprocessor.api.service.d.ts.map +1 -1
- package/dist/api/preprocessor.api.service.js +1 -2
- package/dist/api/preprocessor.api.service.js.map +1 -1
- package/dist/api/products.api.service.d.ts +9 -9
- package/dist/api/products.api.service.d.ts.map +1 -1
- package/dist/api/products.api.service.js +10 -10
- package/dist/api/products.api.service.js.map +1 -1
- package/dist/api/resource.api.service.d.ts +2 -2
- package/dist/api/resource.api.service.js +1 -1
- package/dist/api/skills.api.service.d.ts +4 -4
- package/dist/api/skills.api.service.d.ts.map +1 -1
- package/dist/api/skills.api.service.js +1 -1
- package/dist/api/skills.api.service.js.map +1 -1
- package/dist/api/tool.api.service.d.ts +2 -2
- package/dist/api/tool.api.service.js +1 -1
- package/dist/api/unifiedto.api.service.d.ts +3 -3
- package/dist/api/unifiedto.api.service.d.ts.map +1 -1
- package/dist/api/unifiedto.api.service.js +28 -10
- package/dist/api/unifiedto.api.service.js.map +1 -1
- package/dist/api/user.data.api.service.d.ts +6 -6
- package/dist/api/user.data.api.service.d.ts.map +1 -1
- package/dist/api/user.data.api.service.js +5 -5
- package/dist/api/user.data.api.service.js.map +1 -1
- package/dist/api/webhook.api.service.d.ts +3 -3
- package/dist/api/webhook.api.service.d.ts.map +1 -1
- package/dist/api/webhook.api.service.js +1 -1
- package/dist/api/webhook.api.service.js.map +1 -1
- package/dist/api/whatsapp-templates.api.service.d.ts +3 -3
- package/dist/api/whatsapp-templates.api.service.js +1 -1
- package/dist/api-exports.d.ts +25 -25
- package/dist/api-exports.d.ts.map +1 -1
- package/dist/api-exports.js +26 -26
- package/dist/api-exports.js.map +1 -1
- package/dist/cli/command-definitions.d.ts +1 -1
- package/dist/cli/command-definitions.d.ts.map +1 -1
- package/dist/cli/command-definitions.js +209 -196
- package/dist/cli/command-definitions.js.map +1 -1
- package/dist/commands/agents.js +2 -2
- package/dist/commands/apiKey.js +12 -12
- package/dist/commands/channels.d.ts.map +1 -1
- package/dist/commands/channels.js +165 -174
- package/dist/commands/channels.js.map +1 -1
- package/dist/commands/chat-log-probe.d.ts +59 -0
- package/dist/commands/chat-log-probe.d.ts.map +1 -0
- package/dist/commands/chat-log-probe.js +87 -0
- package/dist/commands/chat-log-probe.js.map +1 -0
- package/dist/commands/chat.d.ts.map +1 -1
- package/dist/commands/chat.js +143 -40
- package/dist/commands/chat.js.map +1 -1
- package/dist/commands/chatClear.d.ts.map +1 -1
- package/dist/commands/chatClear.js +10 -6
- package/dist/commands/chatClear.js.map +1 -1
- package/dist/commands/compile.d.ts +7 -0
- package/dist/commands/compile.d.ts.map +1 -1
- package/dist/commands/compile.js +49 -12
- package/dist/commands/compile.js.map +1 -1
- package/dist/commands/completion.d.ts.map +1 -1
- package/dist/commands/completion.js +8 -9
- package/dist/commands/completion.js.map +1 -1
- package/dist/commands/configure.js +5 -5
- package/dist/commands/deploy.d.ts.map +1 -1
- package/dist/commands/deploy.js +132 -35
- package/dist/commands/deploy.js.map +1 -1
- package/dist/commands/destroy.d.ts.map +1 -1
- package/dist/commands/destroy.js +27 -17
- package/dist/commands/destroy.js.map +1 -1
- package/dist/commands/devices.d.ts.map +1 -1
- package/dist/commands/devices.js +4 -5
- package/dist/commands/devices.js.map +1 -1
- package/dist/commands/env.d.ts.map +1 -1
- package/dist/commands/env.js +101 -80
- package/dist/commands/env.js.map +1 -1
- package/dist/commands/features.d.ts.map +1 -1
- package/dist/commands/features.js +71 -82
- package/dist/commands/features.js.map +1 -1
- package/dist/commands/governance.d.ts.map +1 -1
- package/dist/commands/governance.js +17 -15
- package/dist/commands/governance.js.map +1 -1
- package/dist/commands/index.d.ts +37 -36
- package/dist/commands/index.d.ts.map +1 -1
- package/dist/commands/index.js +37 -36
- package/dist/commands/index.js.map +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +80 -70
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/integrations.d.ts.map +1 -1
- package/dist/commands/integrations.js +373 -341
- package/dist/commands/integrations.js.map +1 -1
- package/dist/commands/jobs.d.ts.map +1 -1
- package/dist/commands/jobs.js +110 -78
- package/dist/commands/jobs.js.map +1 -1
- package/dist/commands/log-tip.d.ts +79 -0
- package/dist/commands/log-tip.d.ts.map +1 -0
- package/dist/commands/log-tip.js +83 -0
- package/dist/commands/log-tip.js.map +1 -0
- package/dist/commands/logs.d.ts.map +1 -1
- package/dist/commands/logs.js +166 -198
- package/dist/commands/logs.js.map +1 -1
- package/dist/commands/marketplace.d.ts.map +1 -1
- package/dist/commands/marketplace.js +381 -427
- package/dist/commands/marketplace.js.map +1 -1
- package/dist/commands/mcp.d.ts.map +1 -1
- package/dist/commands/mcp.js +54 -56
- package/dist/commands/mcp.js.map +1 -1
- package/dist/commands/models.d.ts.map +1 -1
- package/dist/commands/models.js +4 -3
- package/dist/commands/models.js.map +1 -1
- package/dist/commands/persona.d.ts.map +1 -1
- package/dist/commands/persona.js +100 -126
- package/dist/commands/persona.js.map +1 -1
- package/dist/commands/postprocessors.d.ts.map +1 -1
- package/dist/commands/postprocessors.js +87 -61
- package/dist/commands/postprocessors.js.map +1 -1
- package/dist/commands/preprocessors.d.ts.map +1 -1
- package/dist/commands/preprocessors.js +87 -61
- package/dist/commands/preprocessors.js.map +1 -1
- package/dist/commands/production.d.ts.map +1 -1
- package/dist/commands/production.js +101 -113
- package/dist/commands/production.js.map +1 -1
- package/dist/commands/push-helpers.d.ts +42 -0
- package/dist/commands/push-helpers.d.ts.map +1 -0
- package/dist/commands/push-helpers.js +48 -0
- package/dist/commands/push-helpers.js.map +1 -0
- package/dist/commands/push.d.ts +2 -0
- package/dist/commands/push.d.ts.map +1 -1
- package/dist/commands/push.js +388 -124
- package/dist/commands/push.js.map +1 -1
- package/dist/commands/pushBackup.d.ts.map +1 -1
- package/dist/commands/pushBackup.js +8 -4
- package/dist/commands/pushBackup.js.map +1 -1
- package/dist/commands/resources.d.ts.map +1 -1
- package/dist/commands/resources.js +47 -60
- package/dist/commands/resources.js.map +1 -1
- package/dist/commands/skills.d.ts.map +1 -1
- package/dist/commands/skills.js +117 -89
- package/dist/commands/skills.js.map +1 -1
- package/dist/commands/status.d.ts +14 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +731 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/sync.d.ts.map +1 -1
- package/dist/commands/sync.js +70 -30
- package/dist/commands/sync.js.map +1 -1
- package/dist/commands/telemetry.d.ts.map +1 -1
- package/dist/commands/telemetry.js +4 -0
- package/dist/commands/telemetry.js.map +1 -1
- package/dist/commands/test-output.helpers.d.ts +24 -0
- package/dist/commands/test-output.helpers.d.ts.map +1 -0
- package/dist/commands/test-output.helpers.js +62 -0
- package/dist/commands/test-output.helpers.js.map +1 -0
- package/dist/commands/test.d.ts.map +1 -1
- package/dist/commands/test.js +291 -121
- package/dist/commands/test.js.map +1 -1
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +15 -3
- package/dist/commands/update.js.map +1 -1
- package/dist/commands/webhooks.d.ts.map +1 -1
- package/dist/commands/webhooks.js +94 -87
- package/dist/commands/webhooks.js.map +1 -1
- package/dist/compiler/agent-traverser.d.ts +50 -14
- package/dist/compiler/agent-traverser.d.ts.map +1 -1
- package/dist/compiler/agent-traverser.js +189 -86
- package/dist/compiler/agent-traverser.js.map +1 -1
- package/dist/compiler/bundler.d.ts.map +1 -1
- package/dist/compiler/bundler.js +5 -5
- package/dist/compiler/bundler.js.map +1 -1
- package/dist/compiler/compiler.d.ts +32 -0
- package/dist/compiler/compiler.d.ts.map +1 -1
- package/dist/compiler/compiler.js +154 -28
- package/dist/compiler/compiler.js.map +1 -1
- package/dist/compiler/index.d.ts +3 -3
- package/dist/compiler/index.d.ts.map +1 -1
- package/dist/compiler/index.js +3 -3
- package/dist/compiler/index.js.map +1 -1
- package/dist/compiler/plugins/agent.plugin.d.ts.map +1 -1
- package/dist/compiler/plugins/agent.plugin.js +2 -4
- package/dist/compiler/plugins/agent.plugin.js.map +1 -1
- package/dist/compiler/plugins/base.d.ts +21 -0
- package/dist/compiler/plugins/base.d.ts.map +1 -1
- package/dist/compiler/plugins/base.js +13 -3
- package/dist/compiler/plugins/base.js.map +1 -1
- package/dist/compiler/plugins/device-trigger.plugin.d.ts.map +1 -1
- package/dist/compiler/plugins/device-trigger.plugin.js +8 -4
- package/dist/compiler/plugins/device-trigger.plugin.js.map +1 -1
- package/dist/compiler/plugins/device.plugin.d.ts.map +1 -1
- package/dist/compiler/plugins/device.plugin.js +4 -4
- package/dist/compiler/plugins/device.plugin.js.map +1 -1
- package/dist/compiler/plugins/job.plugin.d.ts.map +1 -1
- package/dist/compiler/plugins/job.plugin.js +15 -11
- package/dist/compiler/plugins/job.plugin.js.map +1 -1
- package/dist/compiler/plugins/mcp-server.plugin.d.ts.map +1 -1
- package/dist/compiler/plugins/mcp-server.plugin.js +10 -4
- package/dist/compiler/plugins/mcp-server.plugin.js.map +1 -1
- package/dist/compiler/plugins/registry.js +2 -2
- package/dist/compiler/plugins/registry.js.map +1 -1
- package/dist/compiler/plugins/skill.plugin.d.ts +35 -9
- package/dist/compiler/plugins/skill.plugin.d.ts.map +1 -1
- package/dist/compiler/plugins/skill.plugin.js +129 -87
- package/dist/compiler/plugins/skill.plugin.js.map +1 -1
- package/dist/compiler/plugins/tool.plugin.d.ts.map +1 -1
- package/dist/compiler/plugins/tool.plugin.js +13 -9
- package/dist/compiler/plugins/tool.plugin.js.map +1 -1
- package/dist/compiler/plugins/webhook.plugin.d.ts.map +1 -1
- package/dist/compiler/plugins/webhook.plugin.js +7 -5
- package/dist/compiler/plugins/webhook.plugin.js.map +1 -1
- package/dist/compiler/source-writer.d.ts.map +1 -1
- package/dist/compiler/source-writer.js +2 -4
- package/dist/compiler/source-writer.js.map +1 -1
- package/dist/compiler/types.d.ts +33 -0
- package/dist/compiler/types.d.ts.map +1 -1
- package/dist/compiler/types.js.map +1 -1
- package/dist/compiler/utils/ast-helpers.d.ts +1 -16
- package/dist/compiler/utils/ast-helpers.d.ts.map +1 -1
- package/dist/compiler/utils/ast-helpers.js +14 -38
- package/dist/compiler/utils/ast-helpers.js.map +1 -1
- package/dist/compiler/utils/common.d.ts +14 -0
- package/dist/compiler/utils/common.d.ts.map +1 -1
- package/dist/compiler/utils/common.js +39 -11
- package/dist/compiler/utils/common.js.map +1 -1
- package/dist/compiler/utils/file-discovery.d.ts.map +1 -1
- package/dist/compiler/utils/file-discovery.js +2 -10
- package/dist/compiler/utils/file-discovery.js.map +1 -1
- package/dist/compiler/utils/path-resolver.d.ts +67 -10
- package/dist/compiler/utils/path-resolver.d.ts.map +1 -1
- package/dist/compiler/utils/path-resolver.js +120 -24
- package/dist/compiler/utils/path-resolver.js.map +1 -1
- package/dist/compiler/utils/reference-resolver.d.ts +196 -0
- package/dist/compiler/utils/reference-resolver.d.ts.map +1 -0
- package/dist/compiler/utils/reference-resolver.js +1026 -0
- package/dist/compiler/utils/reference-resolver.js.map +1 -0
- package/dist/compiler/utils/schema-converter.d.ts +25 -0
- package/dist/compiler/utils/schema-converter.d.ts.map +1 -1
- package/dist/compiler/utils/schema-converter.js +80 -4
- package/dist/compiler/utils/schema-converter.js.map +1 -1
- package/dist/compiler/utils/workspace.d.ts +35 -0
- package/dist/compiler/utils/workspace.d.ts.map +1 -0
- package/dist/compiler/utils/workspace.js +121 -0
- package/dist/compiler/utils/workspace.js.map +1 -0
- package/dist/compiler/utils/zod-runtime.mjs +5334 -0
- package/dist/config/compile.constants.d.ts.map +1 -1
- package/dist/config/compile.constants.js +3 -1
- package/dist/config/compile.constants.js.map +1 -1
- package/dist/config/constants.d.ts.map +1 -1
- package/dist/config/constants.js +1 -5
- package/dist/config/constants.js.map +1 -1
- package/dist/errors/auth.error.d.ts.map +1 -1
- package/dist/errors/auth.error.js +3 -5
- package/dist/errors/auth.error.js.map +1 -1
- package/dist/errors/index.d.ts +1 -1
- package/dist/errors/index.js +1 -1
- package/dist/index.js +9 -8
- package/dist/index.js.map +1 -1
- package/dist/instances/basket.instance.d.ts +3 -3
- package/dist/instances/basket.instance.d.ts.map +1 -1
- package/dist/instances/basket.instance.js +26 -8
- package/dist/instances/basket.instance.js.map +1 -1
- package/dist/instances/data.entry.instance.d.ts +2 -2
- package/dist/instances/data.entry.instance.d.ts.map +1 -1
- package/dist/instances/data.entry.instance.js +5 -5
- package/dist/instances/data.entry.instance.js.map +1 -1
- package/dist/instances/order.instance.d.ts +2 -2
- package/dist/instances/order.instance.d.ts.map +1 -1
- package/dist/instances/order.instance.js +20 -9
- package/dist/instances/order.instance.js.map +1 -1
- package/dist/instances/product.instance.d.ts +1 -1
- package/dist/instances/product.instance.d.ts.map +1 -1
- package/dist/instances/product.instance.js +3 -3
- package/dist/instances/product.instance.js.map +1 -1
- package/dist/instances/product.pagination.instance.d.ts +2 -2
- package/dist/instances/product.pagination.instance.d.ts.map +1 -1
- package/dist/instances/product.pagination.instance.js +6 -7
- package/dist/instances/product.pagination.instance.js.map +1 -1
- package/dist/instances/product.search.instance.d.ts +3 -3
- package/dist/instances/product.search.instance.d.ts.map +1 -1
- package/dist/instances/product.search.instance.js +3 -4
- package/dist/instances/product.search.instance.js.map +1 -1
- package/dist/instances/user.instance.d.ts +3 -3
- package/dist/instances/user.instance.d.ts.map +1 -1
- package/dist/instances/user.instance.js +19 -36
- package/dist/instances/user.instance.js.map +1 -1
- package/dist/interfaces/agent.d.ts +8 -8
- package/dist/interfaces/agent.d.ts.map +1 -1
- package/dist/interfaces/backup.d.ts +19 -1
- package/dist/interfaces/backup.d.ts.map +1 -1
- package/dist/interfaces/device-triggers.d.ts +0 -2
- package/dist/interfaces/device-triggers.d.ts.map +1 -1
- package/dist/interfaces/devices.d.ts +0 -1
- package/dist/interfaces/devices.d.ts.map +1 -1
- package/dist/interfaces/index.d.ts +8 -8
- package/dist/interfaces/index.d.ts.map +1 -1
- package/dist/interfaces/jobs.d.ts +2 -3
- package/dist/interfaces/jobs.d.ts.map +1 -1
- package/dist/interfaces/logs.d.ts +7 -4
- package/dist/interfaces/logs.d.ts.map +1 -1
- package/dist/interfaces/message.d.ts +3 -3
- package/dist/interfaces/message.d.ts.map +1 -1
- package/dist/interfaces/orders.d.ts +1 -1
- package/dist/interfaces/webhooks.d.ts +2 -2
- package/dist/interfaces/webhooks.d.ts.map +1 -1
- package/dist/primitives/agent.handler.d.ts.map +1 -1
- package/dist/primitives/agent.handler.js +1 -1
- package/dist/primitives/agent.handler.js.map +1 -1
- package/dist/primitives/base.handler.d.ts +12 -2
- package/dist/primitives/base.handler.d.ts.map +1 -1
- package/dist/primitives/base.handler.js +104 -73
- package/dist/primitives/base.handler.js.map +1 -1
- package/dist/primitives/device-trigger.handler.d.ts +1 -1
- package/dist/primitives/device-trigger.handler.d.ts.map +1 -1
- package/dist/primitives/device-trigger.handler.js +2 -3
- package/dist/primitives/device-trigger.handler.js.map +1 -1
- package/dist/primitives/device.handler.d.ts +1 -1
- package/dist/primitives/device.handler.d.ts.map +1 -1
- package/dist/primitives/device.handler.js +2 -3
- package/dist/primitives/device.handler.js.map +1 -1
- package/dist/primitives/index.d.ts +1 -1
- package/dist/primitives/index.d.ts.map +1 -1
- package/dist/primitives/index.js +2 -3
- package/dist/primitives/index.js.map +1 -1
- package/dist/primitives/job.handler.d.ts +6 -1
- package/dist/primitives/job.handler.d.ts.map +1 -1
- package/dist/primitives/job.handler.js +9 -3
- package/dist/primitives/job.handler.js.map +1 -1
- package/dist/primitives/mcp-server.handler.d.ts.map +1 -1
- package/dist/primitives/mcp-server.handler.js +2 -2
- package/dist/primitives/mcp-server.handler.js.map +1 -1
- package/dist/primitives/postprocessor.handler.d.ts.map +1 -1
- package/dist/primitives/postprocessor.handler.js.map +1 -1
- package/dist/primitives/preprocessor.handler.d.ts +1 -1
- package/dist/primitives/preprocessor.handler.d.ts.map +1 -1
- package/dist/primitives/preprocessor.handler.js +2 -3
- package/dist/primitives/preprocessor.handler.js.map +1 -1
- package/dist/primitives/skill.handler.d.ts +1 -1
- package/dist/primitives/skill.handler.d.ts.map +1 -1
- package/dist/primitives/skill.handler.js +34 -13
- package/dist/primitives/skill.handler.js.map +1 -1
- package/dist/primitives/types.d.ts +1 -1
- package/dist/primitives/types.d.ts.map +1 -1
- package/dist/primitives/types.js.map +1 -1
- package/dist/primitives/webhook.handler.d.ts +3 -2
- package/dist/primitives/webhook.handler.d.ts.map +1 -1
- package/dist/primitives/webhook.handler.js +9 -4
- package/dist/primitives/webhook.handler.js.map +1 -1
- package/dist/services/analytics.d.ts.map +1 -1
- package/dist/services/analytics.js +4 -5
- package/dist/services/analytics.js.map +1 -1
- package/dist/services/auth.d.ts +9 -1
- package/dist/services/auth.d.ts.map +1 -1
- package/dist/services/auth.js +26 -7
- package/dist/services/auth.js.map +1 -1
- package/dist/services/sandbox.service.d.ts.map +1 -1
- package/dist/services/sandbox.service.js +132 -80
- package/dist/services/sandbox.service.js.map +1 -1
- package/dist/types/api-contracts.d.ts +4 -4
- package/dist/types/api-contracts.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js.map +1 -1
- package/dist/types/skill.d.ts +7 -7
- package/dist/types/skill.d.ts.map +1 -1
- package/dist/types/skill.js +2 -2
- package/dist/types/skill.js.map +1 -1
- package/dist/types/tool-validation.js.map +1 -1
- package/dist/types/yaml.types.js +0 -1
- package/dist/types/yaml.types.js.map +1 -1
- package/dist/utils/aliases.d.ts +7 -0
- package/dist/utils/aliases.d.ts.map +1 -0
- package/dist/utils/aliases.js +492 -0
- package/dist/utils/aliases.js.map +1 -0
- package/dist/utils/artifact-loader.d.ts +9 -0
- package/dist/utils/artifact-loader.d.ts.map +1 -1
- package/dist/utils/artifact-loader.js +16 -6
- package/dist/utils/artifact-loader.js.map +1 -1
- package/dist/utils/auth-flows.d.ts.map +1 -1
- package/dist/utils/auth-flows.js +54 -54
- package/dist/utils/auth-flows.js.map +1 -1
- package/dist/utils/backup-helpers.d.ts +24 -0
- package/dist/utils/backup-helpers.d.ts.map +1 -1
- package/dist/utils/backup-helpers.js +102 -22
- package/dist/utils/backup-helpers.js.map +1 -1
- package/dist/utils/bundle-upload.d.ts +42 -0
- package/dist/utils/bundle-upload.d.ts.map +1 -0
- package/dist/utils/bundle-upload.js +90 -0
- package/dist/utils/bundle-upload.js.map +1 -0
- package/dist/utils/chat-attachments.js +1 -1
- package/dist/utils/chat-attachments.js.map +1 -1
- package/dist/utils/cli.d.ts +24 -6
- package/dist/utils/cli.d.ts.map +1 -1
- package/dist/utils/cli.js +26 -14
- package/dist/utils/cli.js.map +1 -1
- package/dist/utils/command-utils.d.ts.map +1 -1
- package/dist/utils/command-utils.js +4 -4
- package/dist/utils/command-utils.js.map +1 -1
- package/dist/utils/deploy-helpers.d.ts.map +1 -1
- package/dist/utils/deploy-helpers.js +13 -13
- package/dist/utils/deploy-helpers.js.map +1 -1
- package/dist/utils/env-loader.utils.d.ts +1 -1
- package/dist/utils/env-loader.utils.d.ts.map +1 -1
- package/dist/utils/env-loader.utils.js +15 -22
- package/dist/utils/env-loader.utils.js.map +1 -1
- package/dist/utils/files.d.ts.map +1 -1
- package/dist/utils/files.js +23 -13
- package/dist/utils/files.js.map +1 -1
- package/dist/utils/hints.d.ts +81 -0
- package/dist/utils/hints.d.ts.map +1 -0
- package/dist/utils/hints.js +81 -0
- package/dist/utils/hints.js.map +1 -0
- package/dist/utils/init-agent.d.ts.map +1 -1
- package/dist/utils/init-agent.js +18 -20
- package/dist/utils/init-agent.js.map +1 -1
- package/dist/utils/init-helpers.d.ts.map +1 -1
- package/dist/utils/init-helpers.js +11 -11
- package/dist/utils/init-helpers.js.map +1 -1
- package/dist/utils/init-prompts.d.ts.map +1 -1
- package/dist/utils/init-prompts.js +34 -36
- package/dist/utils/init-prompts.js.map +1 -1
- package/dist/utils/prompt-handler.js +1 -1
- package/dist/utils/prompt-handler.js.map +1 -1
- package/dist/utils/sandbox-storage.d.ts.map +1 -1
- package/dist/utils/sandbox-storage.js.map +1 -1
- package/dist/utils/sandbox.d.ts +1 -1
- package/dist/utils/sandbox.d.ts.map +1 -1
- package/dist/utils/sandbox.js +107 -106
- package/dist/utils/sandbox.js.map +1 -1
- package/dist/utils/semver.js +1 -1
- package/dist/utils/semver.js.map +1 -1
- package/dist/utils/suggest.d.ts +3 -0
- package/dist/utils/suggest.d.ts.map +1 -0
- package/dist/utils/suggest.js +32 -0
- package/dist/utils/suggest.js.map +1 -0
- package/dist/utils/sync-display.d.ts.map +1 -1
- package/dist/utils/sync-display.js +15 -13
- package/dist/utils/sync-display.js.map +1 -1
- package/dist/utils/sync-fetch.d.ts.map +1 -1
- package/dist/utils/sync-fetch.js +33 -24
- package/dist/utils/sync-fetch.js.map +1 -1
- package/dist/utils/version-check.js +1 -1
- package/dist/utils/version-check.js.map +1 -1
- package/dist/utils/write-info.d.ts +9 -0
- package/dist/utils/write-info.d.ts.map +1 -0
- package/dist/utils/write-info.js +11 -0
- package/dist/utils/write-info.js.map +1 -0
- package/docs/README.md +1 -1
- package/node_modules/@lua/shared-types/dist/index.d.mts +76 -2
- package/node_modules/@lua/shared-types/dist/index.d.ts +76 -2
- package/node_modules/@lua/shared-types/dist/index.js +27 -0
- package/node_modules/@lua/shared-types/dist/index.mjs +24 -0
- package/node_modules/@lua/shared-types/src/ai-generate.types.ts +1 -6
- package/node_modules/@lua/shared-types/src/ai-generate.utils.ts +1 -4
- package/node_modules/@lua/shared-types/src/channel.type.ts +1 -0
- package/node_modules/@lua/shared-types/src/chat-stream.types.ts +11 -0
- package/node_modules/@lua/shared-types/src/client-tools.types.ts +47 -0
- package/node_modules/@lua/shared-types/src/device.types.ts +6 -6
- package/node_modules/@lua/shared-types/src/index.ts +3 -0
- package/node_modules/@lua/shared-types/src/sandbox-contract.ts +26 -5
- package/node_modules/@lua/shared-types/src/vm-execution-log.types.ts +41 -0
- package/package.json +10 -6
- package/scripts/build-vendor.mjs +53 -0
- package/scripts/vendor-entry.mjs +11 -0
- package/template/QUICKSTART.md +33 -33
- package/template/README.md +35 -34
- package/template/examples/README.md +44 -38
- package/template/examples/jobs/AbandonedBasketProcessorJob.ts +30 -31
- package/template/examples/jobs/DailyCleanupJob.ts +17 -18
- package/template/examples/jobs/DataMigrationJob.ts +18 -23
- package/template/examples/jobs/HealthCheckJob.ts +13 -14
- package/template/examples/postprocessors/modifyResponse.ts +14 -15
- package/template/examples/preprocessors/messageMatching.ts +28 -29
- package/template/examples/services/ApiService.ts +68 -64
- package/template/examples/services/GetWeather.ts +39 -33
- package/template/examples/skills/basket.skill.ts +27 -7
- package/template/examples/skills/product.skill.ts +21 -8
- package/template/examples/skills/tools/BasketTool.ts +97 -98
- package/template/examples/skills/tools/CreateInlineJob.ts +38 -36
- package/template/examples/skills/tools/CreatePostTool.ts +27 -28
- package/template/examples/skills/tools/CustomDataTool.ts +72 -67
- package/template/examples/skills/tools/GameScoreTrackerTool.ts +72 -78
- package/template/examples/skills/tools/GetWeatherTool.ts +43 -45
- package/template/examples/skills/tools/OrderTool.ts +58 -58
- package/template/examples/skills/tools/PaymentTool.ts +43 -43
- package/template/examples/skills/tools/PremiumFeatureTool.ts +81 -79
- package/template/examples/skills/tools/ProductsTool.ts +68 -69
- package/template/examples/skills/tools/SmartBasketTool.ts +43 -44
- package/template/examples/skills/tools/UserDataTool.ts +97 -98
- package/template/examples/skills/user.skill.ts +7 -8
- package/template/examples/webhooks/FileUploadWebhook.ts +38 -31
- package/template/examples/webhooks/PaymentWebhook.ts +23 -22
- package/template/examples/webhooks/UserEventWebhook.ts +16 -19
- package/template/lua.skill.yaml +2 -2
- package/template/package.json +1 -1
- package/template/src/index.ts +28 -28
|
@@ -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
|
-
|
|
@@ -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;
|