lua-cli 3.5.0-alpha.3 → 3.5.0-beta.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 +137 -689
- package/dist/api/agent.api.service.d.ts +1 -8
- package/dist/api/agent.api.service.js +1 -11
- package/dist/api/agent.api.service.js.map +1 -1
- package/dist/api/auth.api.service.d.ts +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 +80 -0
- package/dist/api/backup.api.service.js +101 -0
- package/dist/api/backup.api.service.js.map +1 -0
- package/dist/api/basket.api.service.d.ts +4 -5
- package/dist/api/basket.api.service.js +13 -18
- package/dist/api/basket.api.service.js.map +1 -1
- package/dist/api/cdn.api.service.d.ts +2 -0
- package/dist/api/cdn.api.service.js +2 -0
- package/dist/api/cdn.api.service.js.map +1 -1
- package/dist/api/chat.api.service.d.ts +10 -2
- package/dist/api/chat.api.service.js +21 -2
- package/dist/api/chat.api.service.js.map +1 -1
- package/dist/api/credentials.js +5 -8
- package/dist/api/credentials.js.map +1 -1
- package/dist/api/custom.data.api.service.d.ts +3 -3
- package/dist/api/custom.data.api.service.js +9 -10
- package/dist/api/custom.data.api.service.js.map +1 -1
- package/dist/api/developer.api.service.d.ts +1 -1
- package/dist/api/developer.api.service.js +1 -1
- package/dist/api/developer.api.service.js.map +1 -1
- package/dist/api/http.client.js.map +1 -0
- package/dist/api/job.api.service.d.ts +2 -2
- package/dist/api/job.api.service.js +2 -2
- package/dist/api/job.api.service.js.map +1 -1
- package/dist/api/logs.api.service.d.ts +1 -1
- package/dist/api/logs.api.service.js +1 -1
- package/dist/api/logs.api.service.js.map +1 -1
- package/dist/api/marketplace.api.service.d.ts +6 -6
- package/dist/api/marketplace.api.service.js.map +1 -1
- package/dist/api/order.api.service.d.ts +3 -4
- package/dist/api/order.api.service.js +8 -10
- package/dist/api/order.api.service.js.map +1 -1
- package/dist/api/persona.api.service.d.ts +1 -1
- package/dist/api/persona.api.service.js +1 -1
- package/dist/api/persona.api.service.js.map +1 -1
- package/dist/api/postprocessor.api.service.d.ts +1 -1
- package/dist/api/postprocessor.api.service.js +1 -1
- package/dist/api/postprocessor.api.service.js.map +1 -1
- package/dist/api/preprocessor.api.service.d.ts +1 -1
- package/dist/api/preprocessor.api.service.js +1 -1
- package/dist/api/preprocessor.api.service.js.map +1 -1
- package/dist/api/products.api.service.d.ts +4 -4
- package/dist/api/products.api.service.js +6 -6
- package/dist/api/products.api.service.js.map +1 -1
- package/dist/api/resource.api.service.d.ts +76 -0
- package/dist/api/resource.api.service.js +74 -0
- package/dist/api/resource.api.service.js.map +1 -0
- package/dist/api/skills.api.service.d.ts +7 -15
- 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 +1 -1
- package/dist/api/tool.api.service.js +1 -1
- package/dist/api/tool.api.service.js.map +1 -1
- package/dist/api/unifiedto.api.service.d.ts +1 -1
- package/dist/api/unifiedto.api.service.js +1 -1
- package/dist/api/unifiedto.api.service.js.map +1 -1
- package/dist/api/user.data.api.service.d.ts +7 -8
- package/dist/api/user.data.api.service.js +2 -3
- package/dist/api/user.data.api.service.js.map +1 -1
- package/dist/api/webhook.api.service.d.ts +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 +1 -1
- package/dist/api/whatsapp-templates.api.service.js +1 -1
- package/dist/api/whatsapp-templates.api.service.js.map +1 -1
- package/dist/api-exports.d.ts +14 -12
- package/dist/api-exports.js +8 -8
- package/dist/api-exports.js.map +1 -1
- package/dist/cli/command-definitions.js +32 -17
- package/dist/cli/command-definitions.js.map +1 -1
- package/dist/commands/admin.js +3 -24
- package/dist/commands/admin.js.map +1 -1
- package/dist/commands/agents.d.ts +8 -7
- package/dist/commands/agents.js +63 -21
- package/dist/commands/agents.js.map +1 -1
- package/dist/commands/channels.js +11 -23
- package/dist/commands/channels.js.map +1 -1
- package/dist/commands/chat.js +33 -47
- package/dist/commands/chat.js.map +1 -1
- package/dist/commands/chatClear.js +11 -41
- package/dist/commands/chatClear.js.map +1 -1
- package/dist/commands/compile.d.ts +26 -23
- package/dist/commands/compile.js +98 -403
- package/dist/commands/compile.js.map +1 -1
- package/dist/commands/completion.js +1 -1
- package/dist/commands/completion.js.map +1 -1
- package/dist/commands/deploy.js +55 -25
- package/dist/commands/deploy.js.map +1 -1
- package/dist/commands/dev.js +29 -45
- package/dist/commands/dev.js.map +1 -1
- package/dist/commands/env.js +12 -25
- package/dist/commands/env.js.map +1 -1
- package/dist/commands/evals.js +3 -20
- package/dist/commands/evals.js.map +1 -1
- package/dist/commands/features.js +10 -23
- package/dist/commands/features.js.map +1 -1
- package/dist/commands/index.d.ts +1 -0
- package/dist/commands/index.js +1 -0
- package/dist/commands/index.js.map +1 -1
- package/dist/commands/init.d.ts +1 -0
- package/dist/commands/init.js +135 -19
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/integrations.js +26 -37
- package/dist/commands/integrations.js.map +1 -1
- package/dist/commands/jobs.js +32 -56
- package/dist/commands/jobs.js.map +1 -1
- package/dist/commands/logs.js +9 -20
- package/dist/commands/logs.js.map +1 -1
- package/dist/commands/marketplace.js +34 -52
- package/dist/commands/marketplace.js.map +1 -1
- package/dist/commands/mcp.js +10 -23
- package/dist/commands/mcp.js.map +1 -1
- package/dist/commands/persona.js +43 -74
- package/dist/commands/persona.js.map +1 -1
- package/dist/commands/postprocessors.js +15 -28
- package/dist/commands/postprocessors.js.map +1 -1
- package/dist/commands/preprocessors.js +15 -28
- package/dist/commands/preprocessors.js.map +1 -1
- package/dist/commands/production.js +30 -63
- package/dist/commands/production.js.map +1 -1
- package/dist/commands/push.js +294 -1241
- package/dist/commands/push.js.map +1 -1
- package/dist/commands/pushBackup.d.ts +22 -0
- package/dist/commands/pushBackup.js +133 -0
- package/dist/commands/pushBackup.js.map +1 -0
- package/dist/commands/resources.js +29 -72
- package/dist/commands/resources.js.map +1 -1
- package/dist/commands/skills.d.ts +1 -1
- package/dist/commands/skills.js +58 -70
- package/dist/commands/skills.js.map +1 -1
- package/dist/commands/sync.d.ts +1 -3
- package/dist/commands/sync.js +12 -24
- package/dist/commands/sync.js.map +1 -1
- package/dist/commands/test.js +135 -104
- package/dist/commands/test.js.map +1 -1
- package/dist/commands/webhooks.js +15 -28
- package/dist/commands/webhooks.js.map +1 -1
- package/dist/compiler/agent-traverser.d.ts +104 -0
- package/dist/compiler/agent-traverser.js +311 -0
- package/dist/compiler/agent-traverser.js.map +1 -0
- package/dist/compiler/bundler.d.ts +42 -0
- package/dist/compiler/bundler.js +187 -0
- package/dist/compiler/bundler.js.map +1 -0
- package/dist/compiler/compiler.d.ts +177 -0
- package/dist/compiler/compiler.js +580 -0
- package/dist/compiler/compiler.js.map +1 -0
- package/dist/compiler/index.d.ts +36 -0
- package/dist/compiler/index.js +42 -0
- package/dist/compiler/index.js.map +1 -0
- package/dist/compiler/plugins/base.d.ts +264 -0
- package/dist/compiler/plugins/base.js +307 -0
- package/dist/compiler/plugins/base.js.map +1 -0
- package/dist/compiler/plugins/job.plugin.d.ts +33 -0
- package/dist/compiler/plugins/job.plugin.js +143 -0
- package/dist/compiler/plugins/job.plugin.js.map +1 -0
- package/dist/compiler/plugins/mcp-server.plugin.d.ts +50 -0
- package/dist/compiler/plugins/mcp-server.plugin.js +186 -0
- package/dist/compiler/plugins/mcp-server.plugin.js.map +1 -0
- package/dist/compiler/plugins/postprocessor.plugin.d.ts +20 -0
- package/dist/compiler/plugins/postprocessor.plugin.js +39 -0
- package/dist/compiler/plugins/postprocessor.plugin.js.map +1 -0
- package/dist/compiler/plugins/preprocessor.plugin.d.ts +20 -0
- package/dist/compiler/plugins/preprocessor.plugin.js +48 -0
- package/dist/compiler/plugins/preprocessor.plugin.js.map +1 -0
- package/dist/compiler/plugins/processor-base.d.ts +16 -0
- package/dist/compiler/plugins/processor-base.js +34 -0
- package/dist/compiler/plugins/processor-base.js.map +1 -0
- package/dist/compiler/plugins/registry.d.ts +61 -0
- package/dist/compiler/plugins/registry.js +107 -0
- package/dist/compiler/plugins/registry.js.map +1 -0
- package/dist/compiler/plugins/skill.plugin.d.ts +71 -0
- package/dist/compiler/plugins/skill.plugin.js +243 -0
- package/dist/compiler/plugins/skill.plugin.js.map +1 -0
- package/dist/compiler/plugins/tool.plugin.d.ts +67 -0
- package/dist/compiler/plugins/tool.plugin.js +279 -0
- package/dist/compiler/plugins/tool.plugin.js.map +1 -0
- package/dist/compiler/plugins/webhook.plugin.d.ts +37 -0
- package/dist/compiler/plugins/webhook.plugin.js +127 -0
- package/dist/compiler/plugins/webhook.plugin.js.map +1 -0
- package/dist/compiler/source-writer.d.ts +98 -0
- package/dist/compiler/source-writer.js +223 -0
- package/dist/compiler/source-writer.js.map +1 -0
- package/dist/compiler/types.d.ts +289 -0
- package/dist/compiler/types.js +20 -0
- package/dist/compiler/types.js.map +1 -0
- package/dist/compiler/utils/ast-helpers.d.ts +57 -0
- package/dist/compiler/utils/ast-helpers.js +164 -0
- package/dist/compiler/utils/ast-helpers.js.map +1 -0
- package/dist/compiler/utils/common.d.ts +23 -0
- package/dist/compiler/utils/common.js +66 -0
- package/dist/compiler/utils/common.js.map +1 -0
- package/dist/compiler/utils/file-discovery.d.ts +34 -0
- package/dist/compiler/utils/file-discovery.js +68 -0
- package/dist/compiler/utils/file-discovery.js.map +1 -0
- package/dist/compiler/utils/path-resolver.d.ts +25 -0
- package/dist/compiler/utils/path-resolver.js +66 -0
- package/dist/compiler/utils/path-resolver.js.map +1 -0
- package/dist/compiler/utils/schema-converter.d.ts +26 -0
- package/dist/compiler/utils/schema-converter.js +94 -0
- package/dist/compiler/utils/schema-converter.js.map +1 -0
- package/dist/config/compile.constants.d.ts +2 -22
- package/dist/config/compile.constants.js +2 -49
- package/dist/config/compile.constants.js.map +1 -1
- package/dist/config/constants.d.ts +18 -2
- package/dist/config/constants.js +28 -8
- package/dist/config/constants.js.map +1 -1
- package/dist/config/dev.constants.d.ts +0 -10
- package/dist/config/dev.constants.js +0 -10
- package/dist/config/dev.constants.js.map +1 -1
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/dist/instances/basket.instance.js.map +1 -0
- package/dist/instances/data.entry.instance.js.map +1 -0
- package/dist/instances/job.instance.js.map +1 -0
- package/dist/instances/order.instance.js.map +1 -0
- package/dist/instances/product.instance.js.map +1 -0
- package/dist/instances/product.pagination.instance.js.map +1 -0
- package/dist/instances/product.search.instance.js.map +1 -0
- package/dist/instances/user.instance.js.map +1 -0
- package/dist/interfaces/admin.d.ts +0 -38
- package/dist/interfaces/backup.d.ts +125 -0
- package/dist/interfaces/backup.js +8 -0
- package/dist/interfaces/backup.js.map +1 -0
- package/dist/interfaces/baskets.d.ts +0 -56
- package/dist/interfaces/common.d.ts +1 -0
- package/dist/interfaces/deploy.d.ts +0 -15
- package/dist/interfaces/index.d.ts +1 -1
- package/dist/interfaces/marketplace.d.ts +51 -0
- package/dist/interfaces/marketplace.js +1 -1
- package/dist/interfaces/marketplace.js.map +1 -1
- package/dist/interfaces/message.d.ts +0 -3
- package/dist/interfaces/orders.d.ts +0 -24
- package/dist/interfaces/postprocessors.d.ts +0 -18
- package/dist/interfaces/preprocessors.d.ts +0 -18
- package/dist/interfaces/skills.d.ts +61 -0
- package/dist/interfaces/user.d.ts +25 -0
- package/dist/interfaces/webhooks.d.ts +0 -9
- package/dist/primitives/base.handler.d.ts +106 -0
- package/dist/primitives/base.handler.js +370 -0
- package/dist/primitives/base.handler.js.map +1 -0
- package/dist/primitives/index.d.ts +47 -0
- package/dist/primitives/index.js +78 -0
- package/dist/primitives/index.js.map +1 -0
- package/dist/primitives/job.handler.d.ts +52 -0
- package/dist/primitives/job.handler.js +118 -0
- package/dist/primitives/job.handler.js.map +1 -0
- package/dist/primitives/mcp-server.handler.d.ts +54 -0
- package/dist/primitives/mcp-server.handler.js +91 -0
- package/dist/primitives/mcp-server.handler.js.map +1 -0
- package/dist/primitives/postprocessor.handler.d.ts +49 -0
- package/dist/primitives/postprocessor.handler.js +81 -0
- package/dist/primitives/postprocessor.handler.js.map +1 -0
- package/dist/primitives/preprocessor.handler.d.ts +54 -0
- package/dist/primitives/preprocessor.handler.js +95 -0
- package/dist/primitives/preprocessor.handler.js.map +1 -0
- package/dist/primitives/skill.handler.d.ts +44 -0
- package/dist/primitives/skill.handler.js +192 -0
- package/dist/primitives/skill.handler.js.map +1 -0
- package/dist/primitives/types.d.ts +72 -0
- package/dist/primitives/types.js +17 -0
- package/dist/primitives/types.js.map +1 -0
- package/dist/primitives/webhook.handler.d.ts +50 -0
- package/dist/primitives/webhook.handler.js +96 -0
- package/dist/primitives/webhook.handler.js.map +1 -0
- package/dist/services/auth.js +1 -2
- package/dist/services/auth.js.map +1 -1
- package/dist/services/sandbox.service.d.ts +103 -0
- package/dist/services/sandbox.service.js +479 -0
- package/dist/services/sandbox.service.js.map +1 -0
- package/dist/types/api-contracts.d.ts +1 -1
- package/dist/types/index.d.ts +2 -1
- package/dist/types/index.js.map +1 -1
- package/dist/types/skill.d.ts +8 -2
- package/dist/types/skill.js +8 -0
- package/dist/types/skill.js.map +1 -1
- package/dist/types/yaml.types.d.ts +69 -0
- package/dist/types/yaml.types.js +6 -0
- package/dist/types/yaml.types.js.map +1 -0
- package/dist/utils/artifact-loader.d.ts +108 -0
- package/dist/utils/artifact-loader.js +188 -0
- package/dist/utils/artifact-loader.js.map +1 -0
- package/dist/utils/backup-helpers.d.ts +122 -0
- package/dist/utils/backup-helpers.js +274 -0
- package/dist/utils/backup-helpers.js.map +1 -0
- package/dist/utils/cli.d.ts +8 -0
- package/dist/utils/cli.js +19 -2
- package/dist/utils/cli.js.map +1 -1
- package/dist/utils/command-utils.d.ts +42 -0
- package/dist/utils/command-utils.js +83 -0
- package/dist/utils/command-utils.js.map +1 -0
- package/dist/utils/deploy-helpers.d.ts +0 -29
- package/dist/utils/deploy-helpers.js +0 -70
- package/dist/utils/deploy-helpers.js.map +1 -1
- package/dist/utils/dev-api.d.ts +3 -99
- package/dist/utils/dev-api.js +3 -430
- package/dist/utils/dev-api.js.map +1 -1
- package/dist/utils/dev-server.d.ts +3 -1
- package/dist/utils/dev-server.js +69 -145
- package/dist/utils/dev-server.js.map +1 -1
- package/dist/utils/dev-watcher.d.ts +0 -1
- package/dist/utils/dev-watcher.js +23 -8
- package/dist/utils/dev-watcher.js.map +1 -1
- package/dist/utils/env-loader.utils.d.ts +10 -1
- package/dist/utils/env-loader.utils.js +39 -31
- package/dist/utils/env-loader.utils.js.map +1 -1
- package/dist/utils/files.d.ts +47 -3
- package/dist/utils/files.js +98 -40
- package/dist/utils/files.js.map +1 -1
- package/dist/utils/init-agent.js +1 -2
- package/dist/utils/init-agent.js.map +1 -1
- package/dist/utils/init-helpers.d.ts +2 -10
- package/dist/utils/init-helpers.js +9 -17
- package/dist/utils/init-helpers.js.map +1 -1
- package/dist/utils/init-prompts.d.ts +0 -8
- package/dist/utils/init-prompts.js +0 -22
- package/dist/utils/init-prompts.js.map +1 -1
- package/dist/utils/prompt-handler.d.ts +3 -0
- package/dist/utils/prompt-handler.js +13 -0
- package/dist/utils/prompt-handler.js.map +1 -1
- package/dist/utils/sandbox-storage.d.ts +6 -5
- package/dist/utils/sandbox-storage.js +12 -12
- package/dist/utils/sandbox-storage.js.map +1 -1
- package/dist/utils/sandbox.d.ts +7 -30
- package/dist/utils/sandbox.js +247 -223
- package/dist/utils/sandbox.js.map +1 -1
- package/dist/utils/semver.d.ts +12 -0
- package/dist/utils/semver.js +23 -0
- package/dist/utils/semver.js.map +1 -1
- package/dist/utils/sync-display.d.ts +9 -0
- package/dist/utils/sync-display.js +67 -0
- package/dist/utils/sync-display.js.map +1 -0
- package/dist/utils/sync-fetch.d.ts +23 -0
- package/dist/utils/sync-fetch.js +64 -0
- package/dist/utils/sync-fetch.js.map +1 -0
- package/dist/utils/sync-helpers.d.ts +4 -59
- package/dist/utils/sync-helpers.js +4 -206
- package/dist/utils/sync-helpers.js.map +1 -1
- package/dist/web/app.css +912 -186
- package/dist/web/app.js +46 -46
- package/docs/API_INDEX.md +100 -0
- package/docs/API_REFERENCE.md +773 -0
- package/docs/CLI_REFERENCE.md +924 -0
- package/docs/GETTING_STARTED.md +862 -0
- package/docs/README.md +270 -0
- package/docs/api/AI.md +882 -0
- package/docs/api/Baskets.md +511 -0
- package/docs/api/CDN.md +524 -0
- package/docs/api/Data.md +446 -0
- package/docs/api/Jobs.md +524 -0
- package/docs/api/LuaAgent.md +454 -0
- package/docs/api/LuaJob.md +604 -0
- package/docs/api/LuaSkill.md +396 -0
- package/docs/api/LuaTool.md +521 -0
- package/docs/api/LuaWebhook.md +601 -0
- package/docs/api/Orders.md +514 -0
- package/docs/api/PostProcessor.md +565 -0
- package/docs/api/PreProcessor.md +630 -0
- package/docs/api/Products.md +507 -0
- package/docs/api/Templates.md +662 -0
- package/docs/api/User.md +567 -0
- package/docs/archive/DEVELOPMENT_GUIDE_V1.md +1294 -0
- package/docs/compiler-v2/ASSESSMENT.md +205 -0
- package/docs/compiler-v2/TEST_PLAN.md +306 -0
- package/package.json +3 -7
- package/template/tsconfig.json +1 -1
- package/dist/common/basket.instance.js.map +0 -1
- package/dist/common/data.entry.instance.js.map +0 -1
- package/dist/common/http.client.js.map +0 -1
- package/dist/common/job.instance.js.map +0 -1
- package/dist/common/order.instance.js.map +0 -1
- package/dist/common/product.instance.js.map +0 -1
- package/dist/common/product.pagination.instance.js.map +0 -1
- package/dist/common/product.search.instance.js.map +0 -1
- package/dist/common/user.instance.js.map +0 -1
- package/dist/config/auth.constants.d.ts +0 -11
- package/dist/config/auth.constants.js +0 -12
- package/dist/config/auth.constants.js.map +0 -1
- package/dist/config/init.constants.d.ts +0 -15
- package/dist/config/init.constants.js +0 -20
- package/dist/config/init.constants.js.map +0 -1
- package/dist/interfaces/compile.d.ts +0 -12
- package/dist/interfaces/compile.js +0 -5
- package/dist/interfaces/compile.js.map +0 -1
- package/dist/types/compile.types.d.ts +0 -131
- package/dist/types/compile.types.js +0 -6
- package/dist/types/compile.types.js.map +0 -1
- package/dist/utils/agent-code-utils.d.ts +0 -25
- package/dist/utils/agent-code-utils.js +0 -107
- package/dist/utils/agent-code-utils.js.map +0 -1
- package/dist/utils/bundling.d.ts +0 -89
- package/dist/utils/bundling.js +0 -1068
- package/dist/utils/bundling.js.map +0 -1
- package/dist/utils/compile.d.ts +0 -116
- package/dist/utils/compile.js +0 -1062
- package/dist/utils/compile.js.map +0 -1
- package/dist/utils/deploy-api.d.ts +0 -26
- package/dist/utils/deploy-api.js +0 -54
- package/dist/utils/deploy-api.js.map +0 -1
- package/dist/utils/deployment.d.ts +0 -26
- package/dist/utils/deployment.js +0 -218
- package/dist/utils/deployment.js.map +0 -1
- package/dist/utils/dev-helpers.d.ts +0 -47
- package/dist/utils/dev-helpers.js +0 -82
- package/dist/utils/dev-helpers.js.map +0 -1
- package/dist/utils/job-management.d.ts +0 -27
- package/dist/utils/job-management.js +0 -248
- package/dist/utils/job-management.js.map +0 -1
- package/dist/utils/mcp-server-management.d.ts +0 -26
- package/dist/utils/mcp-server-management.js +0 -197
- package/dist/utils/mcp-server-management.js.map +0 -1
- package/dist/utils/postprocessor-management.d.ts +0 -9
- package/dist/utils/postprocessor-management.js +0 -117
- package/dist/utils/postprocessor-management.js.map +0 -1
- package/dist/utils/pre-bundle-jobs.d.ts +0 -27
- package/dist/utils/pre-bundle-jobs.js +0 -189
- package/dist/utils/pre-bundle-jobs.js.map +0 -1
- package/dist/utils/preprocessor-management.d.ts +0 -9
- package/dist/utils/preprocessor-management.js +0 -117
- package/dist/utils/preprocessor-management.js.map +0 -1
- package/dist/utils/push-api.d.ts +0 -15
- package/dist/utils/push-api.js +0 -49
- package/dist/utils/push-api.js.map +0 -1
- package/dist/utils/push-helpers.d.ts +0 -82
- package/dist/utils/push-helpers.js +0 -246
- package/dist/utils/push-helpers.js.map +0 -1
- package/dist/utils/skill-management.d.ts +0 -39
- package/dist/utils/skill-management.js +0 -299
- package/dist/utils/skill-management.js.map +0 -1
- package/dist/utils/test-helpers.d.ts +0 -33
- package/dist/utils/test-helpers.js +0 -84
- package/dist/utils/test-helpers.js.map +0 -1
- package/dist/utils/test-prompts.d.ts +0 -23
- package/dist/utils/test-prompts.js +0 -187
- package/dist/utils/test-prompts.js.map +0 -1
- package/dist/utils/tool-detection.d.ts +0 -19
- package/dist/utils/tool-detection.js +0 -125
- package/dist/utils/tool-detection.js.map +0 -1
- package/dist/utils/webhook-management.d.ts +0 -27
- package/dist/utils/webhook-management.js +0 -241
- package/dist/utils/webhook-management.js.map +0 -1
- /package/dist/{common → api}/http.client.d.ts +0 -0
- /package/dist/{common → api}/http.client.js +0 -0
- /package/dist/{common → instances}/basket.instance.d.ts +0 -0
- /package/dist/{common → instances}/basket.instance.js +0 -0
- /package/dist/{common → instances}/data.entry.instance.d.ts +0 -0
- /package/dist/{common → instances}/data.entry.instance.js +0 -0
- /package/dist/{common → instances}/job.instance.d.ts +0 -0
- /package/dist/{common → instances}/job.instance.js +0 -0
- /package/dist/{common → instances}/order.instance.d.ts +0 -0
- /package/dist/{common → instances}/order.instance.js +0 -0
- /package/dist/{common → instances}/product.instance.d.ts +0 -0
- /package/dist/{common → instances}/product.instance.js +0 -0
- /package/dist/{common → instances}/product.pagination.instance.d.ts +0 -0
- /package/dist/{common → instances}/product.pagination.instance.js +0 -0
- /package/dist/{common → instances}/product.search.instance.d.ts +0 -0
- /package/dist/{common → instances}/product.search.instance.js +0 -0
- /package/dist/{common → instances}/user.instance.d.ts +0 -0
- /package/dist/{common → instances}/user.instance.js +0 -0
|
@@ -0,0 +1,862 @@
|
|
|
1
|
+
# Getting Started with lua-cli
|
|
2
|
+
|
|
3
|
+
A comprehensive step-by-step guide to building and deploying your first AI agent with lua-cli.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Table of Contents
|
|
8
|
+
|
|
9
|
+
1. [Prerequisites](#prerequisites)
|
|
10
|
+
2. [Installation](#installation)
|
|
11
|
+
3. [Authentication](#authentication)
|
|
12
|
+
4. [Create Your First Agent](#create-your-first-agent)
|
|
13
|
+
5. [Add Your First Tool](#add-your-first-tool)
|
|
14
|
+
6. [Test Your Tool](#test-your-tool)
|
|
15
|
+
7. [Create a Skill](#create-a-skill)
|
|
16
|
+
8. [Chat with Your Agent](#chat-with-your-agent)
|
|
17
|
+
9. [Deploy to Production](#deploy-to-production)
|
|
18
|
+
10. [Add a Webhook](#add-a-webhook)
|
|
19
|
+
11. [Schedule a Job](#schedule-a-job)
|
|
20
|
+
12. [Next Steps](#next-steps)
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## Prerequisites
|
|
25
|
+
|
|
26
|
+
Before starting, ensure you have:
|
|
27
|
+
|
|
28
|
+
- **Node.js 16+** installed ([download](https://nodejs.org/))
|
|
29
|
+
- **npm** or **yarn** package manager
|
|
30
|
+
- **TypeScript 5+** familiarity (basic knowledge)
|
|
31
|
+
- **Lua API key** (sign up at [admin.heylua.ai](https://admin.heylua.ai))
|
|
32
|
+
|
|
33
|
+
**Check your Node.js version:**
|
|
34
|
+
```bash
|
|
35
|
+
node --version
|
|
36
|
+
# Should output: v16.0.0 or higher
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## Installation
|
|
42
|
+
|
|
43
|
+
### Global Installation (Recommended)
|
|
44
|
+
|
|
45
|
+
Install lua-cli globally to use the `lua` command anywhere:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
npm install -g lua-cli
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Verify Installation
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
lua --version
|
|
55
|
+
# Output: lua-cli v3.5.0-alpha.3
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
If the command isn't found, ensure npm global bin is in your PATH:
|
|
59
|
+
```bash
|
|
60
|
+
npm config get prefix
|
|
61
|
+
# Add this to your PATH: /usr/local/bin or similar
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## Authentication
|
|
67
|
+
|
|
68
|
+
### Step 1: Get Your API Key
|
|
69
|
+
|
|
70
|
+
1. Visit [admin.heylua.ai](https://admin.heylua.ai)
|
|
71
|
+
2. Sign up or log in
|
|
72
|
+
3. Navigate to **Settings → API Keys**
|
|
73
|
+
4. Copy your API key
|
|
74
|
+
|
|
75
|
+
### Step 2: Configure CLI
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
lua auth configure
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
When prompted, paste your API key:
|
|
82
|
+
|
|
83
|
+
```
|
|
84
|
+
? Enter your Lua API key: **********************
|
|
85
|
+
✅ API key configured successfully
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
**What just happened?**
|
|
89
|
+
Your API key is securely stored in:
|
|
90
|
+
- **macOS**: Keychain
|
|
91
|
+
- **Windows**: Credential Vault
|
|
92
|
+
- **Linux**: libsecret
|
|
93
|
+
|
|
94
|
+
**Alternative (CI/CD):**
|
|
95
|
+
```bash
|
|
96
|
+
export LUA_API_KEY=your-api-key
|
|
97
|
+
# Or add to .env file
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## Create Your First Agent
|
|
103
|
+
|
|
104
|
+
### Step 1: Create Project Directory
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
mkdir my-assistant
|
|
108
|
+
cd my-assistant
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### Step 2: Initialize Project
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
lua init
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
You'll be guided through setup:
|
|
118
|
+
|
|
119
|
+
```
|
|
120
|
+
? Select an agent:
|
|
121
|
+
❯ Create new agent
|
|
122
|
+
my-existing-agent
|
|
123
|
+
|
|
124
|
+
? Agent name: my-assistant
|
|
125
|
+
? Persona: You are a helpful AI assistant that can help with weather, calculations, and general queries.
|
|
126
|
+
? Welcome message: Hello! I'm your AI assistant. How can I help you today?
|
|
127
|
+
|
|
128
|
+
✅ Project initialized successfully
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Step 3: Explore Project Structure
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
tree -L 3
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Output:
|
|
138
|
+
```
|
|
139
|
+
my-assistant/
|
|
140
|
+
├── src/
|
|
141
|
+
│ ├── index.ts # LuaAgent configuration
|
|
142
|
+
│ ├── skills/ # Tool collections
|
|
143
|
+
│ │ └── general.skill.ts # Default skill
|
|
144
|
+
│ ├── webhooks/ # HTTP endpoints
|
|
145
|
+
│ ├── jobs/ # Scheduled tasks
|
|
146
|
+
│ ├── preprocessors/ # Message filters
|
|
147
|
+
│ └── postprocessors/ # Response formatters
|
|
148
|
+
├── lua.skill.yaml # Agent metadata
|
|
149
|
+
├── package.json
|
|
150
|
+
├── tsconfig.json
|
|
151
|
+
└── .env
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### Step 4: Install Dependencies
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
npm install
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
**Key dependencies:**
|
|
161
|
+
- `zod` - Schema validation
|
|
162
|
+
- `lua-cli` - SDK and runtime APIs
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
## Add Your First Tool
|
|
167
|
+
|
|
168
|
+
Let's create a weather tool!
|
|
169
|
+
|
|
170
|
+
### Step 1: Create Tool File
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
mkdir -p src/skills/tools
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
Create `src/skills/tools/WeatherTool.ts`:
|
|
177
|
+
|
|
178
|
+
```typescript
|
|
179
|
+
import { LuaTool } from 'lua-cli/skill';
|
|
180
|
+
import { z } from 'zod';
|
|
181
|
+
|
|
182
|
+
export default class WeatherTool implements LuaTool {
|
|
183
|
+
name = 'get_weather';
|
|
184
|
+
description = 'Get current weather for any city';
|
|
185
|
+
|
|
186
|
+
inputSchema = z.object({
|
|
187
|
+
city: z.string().describe('City name'),
|
|
188
|
+
units: z.enum(['metric', 'imperial']).optional().describe('Temperature units')
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
outputSchema = z.object({
|
|
192
|
+
temperature: z.number(),
|
|
193
|
+
condition: z.string(),
|
|
194
|
+
city: z.string(),
|
|
195
|
+
feelsLike: z.number().optional()
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
async execute(input: z.infer<typeof this.inputSchema>) {
|
|
199
|
+
// For demo purposes, we'll return mock data
|
|
200
|
+
// In production, you'd call a weather API
|
|
201
|
+
const temp = Math.floor(Math.random() * 30) + 10;
|
|
202
|
+
|
|
203
|
+
return {
|
|
204
|
+
temperature: temp,
|
|
205
|
+
condition: ['sunny', 'cloudy', 'rainy'][Math.floor(Math.random() * 3)],
|
|
206
|
+
city: input.city,
|
|
207
|
+
feelsLike: temp + Math.floor(Math.random() * 5) - 2
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
**Tool Anatomy:**
|
|
214
|
+
- `name` - Unique identifier (snake_case)
|
|
215
|
+
- `description` - What the tool does (AI uses this)
|
|
216
|
+
- `inputSchema` - Zod schema for input validation
|
|
217
|
+
- `outputSchema` - Zod schema for output validation
|
|
218
|
+
- `execute()` - Tool implementation
|
|
219
|
+
|
|
220
|
+
### Step 2: Add Tool to Skill
|
|
221
|
+
|
|
222
|
+
Open `src/skills/general.skill.ts`:
|
|
223
|
+
|
|
224
|
+
```typescript
|
|
225
|
+
import { LuaSkill } from 'lua-cli';
|
|
226
|
+
import WeatherTool from './tools/WeatherTool.js';
|
|
227
|
+
|
|
228
|
+
export default new LuaSkill({
|
|
229
|
+
name: 'general-skill',
|
|
230
|
+
description: 'General purpose tools',
|
|
231
|
+
context: 'Use these tools for weather information and general queries',
|
|
232
|
+
tools: [
|
|
233
|
+
new WeatherTool()
|
|
234
|
+
]
|
|
235
|
+
});
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
### Step 3: Register Skill in Agent
|
|
239
|
+
|
|
240
|
+
Open `src/index.ts`:
|
|
241
|
+
|
|
242
|
+
```typescript
|
|
243
|
+
import { LuaAgent } from 'lua-cli';
|
|
244
|
+
import generalSkill from './skills/general.skill.js';
|
|
245
|
+
|
|
246
|
+
export const agent = new LuaAgent({
|
|
247
|
+
name: 'my-assistant',
|
|
248
|
+
persona: 'You are a helpful AI assistant that can help with weather, calculations, and general queries.',
|
|
249
|
+
skills: [generalSkill]
|
|
250
|
+
});
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
---
|
|
254
|
+
|
|
255
|
+
## Test Your Tool
|
|
256
|
+
|
|
257
|
+
### Step 1: Compile
|
|
258
|
+
|
|
259
|
+
```bash
|
|
260
|
+
lua compile
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
Output:
|
|
264
|
+
```
|
|
265
|
+
⏳ Compiling agent...
|
|
266
|
+
✅ Compiled 1 tool, 1 skill
|
|
267
|
+
✅ Compilation complete
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
**What happened?**
|
|
271
|
+
- TypeScript compiled to JavaScript
|
|
272
|
+
- Tool validated (schema, name, structure)
|
|
273
|
+
- Artifacts saved to `.lua/artifacts/`
|
|
274
|
+
- Manifest generated
|
|
275
|
+
|
|
276
|
+
### Step 2: Interactive Testing
|
|
277
|
+
|
|
278
|
+
```bash
|
|
279
|
+
lua test
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
Interactive flow:
|
|
283
|
+
```
|
|
284
|
+
? Select type: Tool
|
|
285
|
+
? Select tool: get_weather
|
|
286
|
+
? Input (JSON): { "city": "London" }
|
|
287
|
+
|
|
288
|
+
⏳ Executing...
|
|
289
|
+
✅ Result:
|
|
290
|
+
{
|
|
291
|
+
"temperature": 18,
|
|
292
|
+
"condition": "cloudy",
|
|
293
|
+
"city": "London",
|
|
294
|
+
"feelsLike": 17
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
? Test again? No
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
**Testing Tips:**
|
|
301
|
+
- Use valid JSON for input
|
|
302
|
+
- Test edge cases (empty strings, invalid data)
|
|
303
|
+
- Tools run in sandbox with full API access
|
|
304
|
+
|
|
305
|
+
---
|
|
306
|
+
|
|
307
|
+
## Create a Skill
|
|
308
|
+
|
|
309
|
+
Skills group related tools together. Let's create a calculator skill.
|
|
310
|
+
|
|
311
|
+
### Step 1: Create Calculator Tools
|
|
312
|
+
|
|
313
|
+
`src/skills/tools/AddTool.ts`:
|
|
314
|
+
```typescript
|
|
315
|
+
import { LuaTool } from 'lua-cli/skill';
|
|
316
|
+
import { z } from 'zod';
|
|
317
|
+
|
|
318
|
+
export default class AddTool implements LuaTool {
|
|
319
|
+
name = 'add';
|
|
320
|
+
description = 'Add two numbers together';
|
|
321
|
+
|
|
322
|
+
inputSchema = z.object({
|
|
323
|
+
a: z.number().describe('First number'),
|
|
324
|
+
b: z.number().describe('Second number')
|
|
325
|
+
});
|
|
326
|
+
|
|
327
|
+
async execute(input: z.infer<typeof this.inputSchema>) {
|
|
328
|
+
return { result: input.a + input.b };
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
`src/skills/tools/MultiplyTool.ts`:
|
|
334
|
+
```typescript
|
|
335
|
+
import { LuaTool } from 'lua-cli/skill';
|
|
336
|
+
import { z } from 'zod';
|
|
337
|
+
|
|
338
|
+
export default class MultiplyTool implements LuaTool {
|
|
339
|
+
name = 'multiply';
|
|
340
|
+
description = 'Multiply two numbers';
|
|
341
|
+
|
|
342
|
+
inputSchema = z.object({
|
|
343
|
+
a: z.number(),
|
|
344
|
+
b: z.number()
|
|
345
|
+
});
|
|
346
|
+
|
|
347
|
+
async execute(input: z.infer<typeof this.inputSchema>) {
|
|
348
|
+
return { result: input.a * input.b };
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
### Step 2: Create Calculator Skill
|
|
354
|
+
|
|
355
|
+
`src/skills/calculator.skill.ts`:
|
|
356
|
+
```typescript
|
|
357
|
+
import { LuaSkill } from 'lua-cli';
|
|
358
|
+
import AddTool from './tools/AddTool.js';
|
|
359
|
+
import MultiplyTool from './tools/MultiplyTool.js';
|
|
360
|
+
|
|
361
|
+
export default new LuaSkill({
|
|
362
|
+
name: 'calculator-skill',
|
|
363
|
+
description: 'Mathematical calculation tools',
|
|
364
|
+
context: 'Use these tools when the user asks to perform calculations or math operations',
|
|
365
|
+
tools: [
|
|
366
|
+
new AddTool(),
|
|
367
|
+
new MultiplyTool()
|
|
368
|
+
]
|
|
369
|
+
});
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
### Step 3: Add to Agent
|
|
373
|
+
|
|
374
|
+
Update `src/index.ts`:
|
|
375
|
+
```typescript
|
|
376
|
+
import { LuaAgent } from 'lua-cli';
|
|
377
|
+
import generalSkill from './skills/general.skill.js';
|
|
378
|
+
import calculatorSkill from './skills/calculator.skill.js';
|
|
379
|
+
|
|
380
|
+
export const agent = new LuaAgent({
|
|
381
|
+
name: 'my-assistant',
|
|
382
|
+
persona: 'You are a helpful AI assistant that can help with weather, calculations, and general queries.',
|
|
383
|
+
skills: [
|
|
384
|
+
generalSkill,
|
|
385
|
+
calculatorSkill // ← Added
|
|
386
|
+
]
|
|
387
|
+
});
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
### Step 4: Compile and Test
|
|
391
|
+
|
|
392
|
+
```bash
|
|
393
|
+
lua compile
|
|
394
|
+
lua test
|
|
395
|
+
```
|
|
396
|
+
|
|
397
|
+
---
|
|
398
|
+
|
|
399
|
+
## Chat with Your Agent
|
|
400
|
+
|
|
401
|
+
Now let's have a real conversation with the agent!
|
|
402
|
+
|
|
403
|
+
### Step 1: Start Chat
|
|
404
|
+
|
|
405
|
+
```bash
|
|
406
|
+
lua chat
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
Output:
|
|
410
|
+
```
|
|
411
|
+
🤖 Hello! I'm your AI assistant. How can I help you today?
|
|
412
|
+
|
|
413
|
+
You:
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
### Step 2: Test Tools
|
|
417
|
+
|
|
418
|
+
Try these queries:
|
|
419
|
+
|
|
420
|
+
**Weather Query:**
|
|
421
|
+
```
|
|
422
|
+
You: What's the weather in Paris?
|
|
423
|
+
🔄 Calling tool: get_weather...
|
|
424
|
+
Agent: The current weather in Paris is 22°C and sunny. It feels like 23°C.
|
|
425
|
+
```
|
|
426
|
+
|
|
427
|
+
**Calculator Query:**
|
|
428
|
+
```
|
|
429
|
+
You: What's 15 + 27?
|
|
430
|
+
🔄 Calling tool: add...
|
|
431
|
+
Agent: 15 + 27 equals 42.
|
|
432
|
+
```
|
|
433
|
+
|
|
434
|
+
**Mixed Query:**
|
|
435
|
+
```
|
|
436
|
+
You: What's the weather in London, and what's 100 × 5?
|
|
437
|
+
🔄 Calling tool: get_weather...
|
|
438
|
+
🔄 Calling tool: multiply...
|
|
439
|
+
Agent: The weather in London is 14°C and rainy. Also, 100 × 5 equals 500.
|
|
440
|
+
```
|
|
441
|
+
|
|
442
|
+
### Step 3: Exit Chat
|
|
443
|
+
|
|
444
|
+
```
|
|
445
|
+
You: /exit
|
|
446
|
+
👋 Goodbye!
|
|
447
|
+
```
|
|
448
|
+
|
|
449
|
+
---
|
|
450
|
+
|
|
451
|
+
## Deploy to Production
|
|
452
|
+
|
|
453
|
+
Ready to make your agent live? Let's deploy!
|
|
454
|
+
|
|
455
|
+
### Step 1: Compile
|
|
456
|
+
|
|
457
|
+
```bash
|
|
458
|
+
lua compile
|
|
459
|
+
```
|
|
460
|
+
|
|
461
|
+
### Step 2: Push to Server
|
|
462
|
+
|
|
463
|
+
```bash
|
|
464
|
+
lua push all --force
|
|
465
|
+
```
|
|
466
|
+
|
|
467
|
+
Output:
|
|
468
|
+
```
|
|
469
|
+
⏳ Pushing all primitives...
|
|
470
|
+
✅ Pushed general-skill v1.0.0
|
|
471
|
+
✅ Pushed calculator-skill v1.0.0
|
|
472
|
+
? Deploy to production? Yes
|
|
473
|
+
✅ Deployed to production
|
|
474
|
+
```
|
|
475
|
+
|
|
476
|
+
**What happened?**
|
|
477
|
+
- Artifacts uploaded to server
|
|
478
|
+
- New versions created (1.0.0)
|
|
479
|
+
- Agent activated in production
|
|
480
|
+
|
|
481
|
+
### Step 3: Verify Production
|
|
482
|
+
|
|
483
|
+
```bash
|
|
484
|
+
lua production
|
|
485
|
+
```
|
|
486
|
+
|
|
487
|
+
Output:
|
|
488
|
+
```
|
|
489
|
+
📊 Production Status
|
|
490
|
+
|
|
491
|
+
Skills:
|
|
492
|
+
✅ general-skill v1.0.0
|
|
493
|
+
✅ calculator-skill v1.0.0
|
|
494
|
+
|
|
495
|
+
Webhooks: (none)
|
|
496
|
+
Jobs: (none)
|
|
497
|
+
```
|
|
498
|
+
|
|
499
|
+
### Step 4: Test Production
|
|
500
|
+
|
|
501
|
+
```bash
|
|
502
|
+
lua chat --production
|
|
503
|
+
```
|
|
504
|
+
|
|
505
|
+
Your agent is now live! 🎉
|
|
506
|
+
|
|
507
|
+
---
|
|
508
|
+
|
|
509
|
+
## Add a Webhook
|
|
510
|
+
|
|
511
|
+
Webhooks let external systems trigger actions in your agent.
|
|
512
|
+
|
|
513
|
+
### Step 1: Create Webhook
|
|
514
|
+
|
|
515
|
+
`src/webhooks/payment.webhook.ts`:
|
|
516
|
+
```typescript
|
|
517
|
+
import { LuaWebhook } from 'lua-cli';
|
|
518
|
+
import { z } from 'zod';
|
|
519
|
+
import { User } from 'lua-cli';
|
|
520
|
+
|
|
521
|
+
export default new LuaWebhook({
|
|
522
|
+
name: 'payment-webhook',
|
|
523
|
+
description: 'Handle payment notifications from Stripe',
|
|
524
|
+
|
|
525
|
+
bodySchema: z.object({
|
|
526
|
+
orderId: z.string(),
|
|
527
|
+
amount: z.number(),
|
|
528
|
+
status: z.enum(['succeeded', 'failed'])
|
|
529
|
+
}),
|
|
530
|
+
|
|
531
|
+
execute: async ({ body, headers, query }) => {
|
|
532
|
+
console.log('Payment received:', body);
|
|
533
|
+
|
|
534
|
+
// Send notification to user
|
|
535
|
+
if (body.status === 'succeeded') {
|
|
536
|
+
const user = await User.get();
|
|
537
|
+
await user.send([{
|
|
538
|
+
type: 'text',
|
|
539
|
+
text: `✅ Payment of $${body.amount} for order ${body.orderId} succeeded!`
|
|
540
|
+
}]);
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
return {
|
|
544
|
+
status: 200,
|
|
545
|
+
body: { received: true }
|
|
546
|
+
};
|
|
547
|
+
}
|
|
548
|
+
});
|
|
549
|
+
```
|
|
550
|
+
|
|
551
|
+
### Step 2: Register Webhook
|
|
552
|
+
|
|
553
|
+
Update `src/index.ts`:
|
|
554
|
+
```typescript
|
|
555
|
+
import paymentWebhook from './webhooks/payment.webhook.js';
|
|
556
|
+
|
|
557
|
+
export const agent = new LuaAgent({
|
|
558
|
+
name: 'my-assistant',
|
|
559
|
+
persona: '...',
|
|
560
|
+
skills: [generalSkill, calculatorSkill],
|
|
561
|
+
webhooks: [paymentWebhook] // ← Added
|
|
562
|
+
});
|
|
563
|
+
```
|
|
564
|
+
|
|
565
|
+
### Step 3: Deploy
|
|
566
|
+
|
|
567
|
+
```bash
|
|
568
|
+
lua compile
|
|
569
|
+
lua push webhook --name payment-webhook --force
|
|
570
|
+
```
|
|
571
|
+
|
|
572
|
+
### Step 4: Get Webhook URL
|
|
573
|
+
|
|
574
|
+
```bash
|
|
575
|
+
lua webhooks url payment-webhook
|
|
576
|
+
```
|
|
577
|
+
|
|
578
|
+
Output:
|
|
579
|
+
```
|
|
580
|
+
🔗 Webhook URL:
|
|
581
|
+
https://api.heylua.ai/webhooks/hook_abc123xyz
|
|
582
|
+
```
|
|
583
|
+
|
|
584
|
+
Use this URL in your Stripe/Shopify/etc. webhook configuration!
|
|
585
|
+
|
|
586
|
+
---
|
|
587
|
+
|
|
588
|
+
## Schedule a Job
|
|
589
|
+
|
|
590
|
+
Jobs run automatically on a schedule or once at a specific time.
|
|
591
|
+
|
|
592
|
+
### Step 1: Create Job
|
|
593
|
+
|
|
594
|
+
`src/jobs/daily-summary.job.ts`:
|
|
595
|
+
```typescript
|
|
596
|
+
import { LuaJob } from 'lua-cli';
|
|
597
|
+
import { User, Data } from 'lua-cli';
|
|
598
|
+
|
|
599
|
+
export default new LuaJob({
|
|
600
|
+
name: 'daily-summary',
|
|
601
|
+
description: 'Send daily summary to user',
|
|
602
|
+
|
|
603
|
+
schedule: {
|
|
604
|
+
type: 'cron',
|
|
605
|
+
pattern: '0 9 * * *' // Every day at 9 AM
|
|
606
|
+
},
|
|
607
|
+
|
|
608
|
+
execute: async (job) => {
|
|
609
|
+
const user = await job.user();
|
|
610
|
+
|
|
611
|
+
// Fetch some data
|
|
612
|
+
const activities = await Data.get('activities');
|
|
613
|
+
|
|
614
|
+
await user.send([{
|
|
615
|
+
type: 'text',
|
|
616
|
+
text: `Good morning! You have ${activities.length} activities logged this week.`
|
|
617
|
+
}]);
|
|
618
|
+
|
|
619
|
+
return { success: true, sent: activities.length };
|
|
620
|
+
}
|
|
621
|
+
});
|
|
622
|
+
```
|
|
623
|
+
|
|
624
|
+
**Schedule Types:**
|
|
625
|
+
- `cron` - Cron expression (e.g., `0 9 * * *`)
|
|
626
|
+
- `once` - Run once at specific time (`executeAt: Date`)
|
|
627
|
+
- `interval` - Run every X seconds (`interval: 3600`)
|
|
628
|
+
|
|
629
|
+
### Step 2: Register Job
|
|
630
|
+
|
|
631
|
+
Update `src/index.ts`:
|
|
632
|
+
```typescript
|
|
633
|
+
import dailySummaryJob from './jobs/daily-summary.job.js';
|
|
634
|
+
|
|
635
|
+
export const agent = new LuaAgent({
|
|
636
|
+
name: 'my-assistant',
|
|
637
|
+
persona: '...',
|
|
638
|
+
skills: [generalSkill, calculatorSkill],
|
|
639
|
+
webhooks: [paymentWebhook],
|
|
640
|
+
jobs: [dailySummaryJob] // ← Added
|
|
641
|
+
});
|
|
642
|
+
```
|
|
643
|
+
|
|
644
|
+
### Step 3: Deploy
|
|
645
|
+
|
|
646
|
+
```bash
|
|
647
|
+
lua compile
|
|
648
|
+
lua push job --name daily-summary --force
|
|
649
|
+
```
|
|
650
|
+
|
|
651
|
+
### Step 4: Test Immediately
|
|
652
|
+
|
|
653
|
+
```bash
|
|
654
|
+
lua jobs run daily-summary
|
|
655
|
+
```
|
|
656
|
+
|
|
657
|
+
---
|
|
658
|
+
|
|
659
|
+
## Next Steps
|
|
660
|
+
|
|
661
|
+
Congratulations! You've built and deployed your first AI agent. 🎉
|
|
662
|
+
|
|
663
|
+
### Learn More
|
|
664
|
+
|
|
665
|
+
**Core Concepts:**
|
|
666
|
+
- [API Reference](./API_REFERENCE.md) - All available APIs
|
|
667
|
+
- [CLI Reference](./CLI_REFERENCE.md) - All commands and options
|
|
668
|
+
|
|
669
|
+
**Advanced Topics:**
|
|
670
|
+
- [PreProcessors](../docs/api/PreProcessor.md) - Filter incoming messages
|
|
671
|
+
- [PostProcessors](../docs/api/PostProcessor.md) - Format responses
|
|
672
|
+
- [User API](../docs/api/User.md) - Access user data
|
|
673
|
+
- [Products API](../docs/api/Products.md) - Manage product catalog
|
|
674
|
+
- [Data API](../docs/api/Data.md) - Custom data storage
|
|
675
|
+
|
|
676
|
+
**Integrations:**
|
|
677
|
+
- [Marketplace](./CLI_REFERENCE.md#marketplace) - Install community skills
|
|
678
|
+
- [Integrations](./CLI_REFERENCE.md#lua-integrations) - Connect Linear, Discord, etc.
|
|
679
|
+
|
|
680
|
+
### Common Patterns
|
|
681
|
+
|
|
682
|
+
**Real-time Weather API:**
|
|
683
|
+
```typescript
|
|
684
|
+
import axios from 'axios';
|
|
685
|
+
|
|
686
|
+
async execute(input: z.infer<typeof this.inputSchema>) {
|
|
687
|
+
const response = await axios.get('https://api.openweathermap.org/data/2.5/weather', {
|
|
688
|
+
params: {
|
|
689
|
+
q: input.city,
|
|
690
|
+
appid: process.env.OPENWEATHER_API_KEY,
|
|
691
|
+
units: input.units || 'metric'
|
|
692
|
+
}
|
|
693
|
+
});
|
|
694
|
+
|
|
695
|
+
return {
|
|
696
|
+
temperature: response.data.main.temp,
|
|
697
|
+
condition: response.data.weather[0].main,
|
|
698
|
+
city: input.city
|
|
699
|
+
};
|
|
700
|
+
}
|
|
701
|
+
```
|
|
702
|
+
|
|
703
|
+
**User Data Access:**
|
|
704
|
+
```typescript
|
|
705
|
+
import { User } from 'lua-cli';
|
|
706
|
+
|
|
707
|
+
async execute() {
|
|
708
|
+
const user = await User.get();
|
|
709
|
+
console.log('User:', user.name, user.email);
|
|
710
|
+
|
|
711
|
+
await user.update({ preferences: 'dark-mode' });
|
|
712
|
+
|
|
713
|
+
return { success: true };
|
|
714
|
+
}
|
|
715
|
+
```
|
|
716
|
+
|
|
717
|
+
**Custom Data Storage:**
|
|
718
|
+
```typescript
|
|
719
|
+
import { Data } from 'lua-cli';
|
|
720
|
+
|
|
721
|
+
async execute(input) {
|
|
722
|
+
// Create
|
|
723
|
+
await Data.create('notes', {
|
|
724
|
+
title: input.title,
|
|
725
|
+
content: input.content,
|
|
726
|
+
timestamp: new Date()
|
|
727
|
+
});
|
|
728
|
+
|
|
729
|
+
// Search
|
|
730
|
+
const results = await Data.search('notes', input.query);
|
|
731
|
+
|
|
732
|
+
return { results };
|
|
733
|
+
}
|
|
734
|
+
```
|
|
735
|
+
|
|
736
|
+
### Development Workflow
|
|
737
|
+
|
|
738
|
+
**Iterative Development:**
|
|
739
|
+
```bash
|
|
740
|
+
# 1. Make changes
|
|
741
|
+
vim src/skills/tools/MyTool.ts
|
|
742
|
+
|
|
743
|
+
# 2. Test
|
|
744
|
+
lua test
|
|
745
|
+
|
|
746
|
+
# 3. Chat test
|
|
747
|
+
lua chat
|
|
748
|
+
|
|
749
|
+
# 4. Deploy
|
|
750
|
+
lua compile
|
|
751
|
+
lua push skill --name my-skill --force
|
|
752
|
+
```
|
|
753
|
+
|
|
754
|
+
**CI/CD Deployment:**
|
|
755
|
+
```yaml
|
|
756
|
+
# .github/workflows/deploy.yml
|
|
757
|
+
name: Deploy Agent
|
|
758
|
+
|
|
759
|
+
on:
|
|
760
|
+
push:
|
|
761
|
+
branches: [main]
|
|
762
|
+
|
|
763
|
+
jobs:
|
|
764
|
+
deploy:
|
|
765
|
+
runs-on: ubuntu-latest
|
|
766
|
+
steps:
|
|
767
|
+
- uses: actions/checkout@v2
|
|
768
|
+
- uses: actions/setup-node@v2
|
|
769
|
+
with:
|
|
770
|
+
node-version: '18'
|
|
771
|
+
|
|
772
|
+
- run: npm install
|
|
773
|
+
- run: npm install -g lua-cli
|
|
774
|
+
|
|
775
|
+
- name: Deploy
|
|
776
|
+
run: lua push all --ci --force --auto-deploy
|
|
777
|
+
env:
|
|
778
|
+
LUA_API_KEY: ${{ secrets.LUA_API_KEY }}
|
|
779
|
+
```
|
|
780
|
+
|
|
781
|
+
### Troubleshooting
|
|
782
|
+
|
|
783
|
+
**Compilation Errors:**
|
|
784
|
+
```bash
|
|
785
|
+
lua compile --debug
|
|
786
|
+
# Shows detailed AST parsing and validation
|
|
787
|
+
```
|
|
788
|
+
|
|
789
|
+
**Authentication Issues:**
|
|
790
|
+
```bash
|
|
791
|
+
lua auth configure
|
|
792
|
+
# Re-enter API key
|
|
793
|
+
```
|
|
794
|
+
|
|
795
|
+
**Test Failures:**
|
|
796
|
+
```bash
|
|
797
|
+
lua test
|
|
798
|
+
# Test tools interactively to debug
|
|
799
|
+
```
|
|
800
|
+
|
|
801
|
+
**Production Debugging:**
|
|
802
|
+
```bash
|
|
803
|
+
lua logs --follow
|
|
804
|
+
# Watch real-time logs
|
|
805
|
+
```
|
|
806
|
+
|
|
807
|
+
### Get Help
|
|
808
|
+
|
|
809
|
+
- **Documentation**: [docs.heylua.ai](https://docs.heylua.ai)
|
|
810
|
+
- **Email**: support@heylua.ai
|
|
811
|
+
- **GitHub Issues**: [github.com/lua-ai-global/lua-cli/issues](https://github.com/lua-ai-global/lua-cli/issues)
|
|
812
|
+
|
|
813
|
+
---
|
|
814
|
+
|
|
815
|
+
## Example: Full E-commerce Agent
|
|
816
|
+
|
|
817
|
+
Here's a complete example showing an e-commerce agent with tools, webhooks, and jobs:
|
|
818
|
+
|
|
819
|
+
```typescript
|
|
820
|
+
// src/index.ts
|
|
821
|
+
import { LuaAgent } from 'lua-cli';
|
|
822
|
+
import productSkill from './skills/product.skill.js';
|
|
823
|
+
import orderSkill from './skills/order.skill.js';
|
|
824
|
+
import orderWebhook from './webhooks/order.webhook.js';
|
|
825
|
+
import inventoryJob from './jobs/inventory.job.js';
|
|
826
|
+
|
|
827
|
+
export const agent = new LuaAgent({
|
|
828
|
+
name: 'ecommerce-assistant',
|
|
829
|
+
persona: 'You are an e-commerce assistant helping customers browse products, place orders, and track shipments.',
|
|
830
|
+
|
|
831
|
+
skills: [productSkill, orderSkill],
|
|
832
|
+
webhooks: [orderWebhook],
|
|
833
|
+
jobs: [inventoryJob],
|
|
834
|
+
|
|
835
|
+
preProcessors: [], // Add message filters
|
|
836
|
+
postProcessors: [] // Add response formatters
|
|
837
|
+
});
|
|
838
|
+
```
|
|
839
|
+
|
|
840
|
+
**Tools:**
|
|
841
|
+
- `search_products` - Search product catalog
|
|
842
|
+
- `get_product_details` - Get product info
|
|
843
|
+
- `add_to_cart` - Add items to basket
|
|
844
|
+
- `place_order` - Checkout and create order
|
|
845
|
+
- `track_order` - Get order status
|
|
846
|
+
|
|
847
|
+
**Webhook:**
|
|
848
|
+
- `order-webhook` - Receive payment notifications
|
|
849
|
+
|
|
850
|
+
**Job:**
|
|
851
|
+
- `inventory-job` - Daily inventory check and alerts
|
|
852
|
+
|
|
853
|
+
This demonstrates a production-ready agent architecture!
|
|
854
|
+
|
|
855
|
+
---
|
|
856
|
+
|
|
857
|
+
**Happy building! 🚀**
|
|
858
|
+
|
|
859
|
+
---
|
|
860
|
+
|
|
861
|
+
**Version:** 3.5.0-alpha.3
|
|
862
|
+
**Last Updated:** February 2026
|