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,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @lua/compiler - Compiler for Lua AI agent primitives
|
|
3
|
+
*
|
|
4
|
+
* This package provides the compilation infrastructure for Lua agents.
|
|
5
|
+
* It transforms TypeScript source code into optimized, sandboxed artifacts.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import { compile } from '@lua/compiler';
|
|
10
|
+
*
|
|
11
|
+
* const result = await compile({
|
|
12
|
+
* rootDir: process.cwd(),
|
|
13
|
+
* outDir: 'dist',
|
|
14
|
+
* });
|
|
15
|
+
*
|
|
16
|
+
* if (result.success) {
|
|
17
|
+
* console.log(`Compiled ${result.stats.totalPrimitives} primitives`);
|
|
18
|
+
* }
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
// Main compiler
|
|
22
|
+
export { Compiler, compile } from './compiler.js';
|
|
23
|
+
// Plugin system
|
|
24
|
+
export { pluginRegistry, PluginRegistry, getAllDefineFunctions, getPluginByDefineFunction, } from './plugins/registry.js';
|
|
25
|
+
// Helper functions
|
|
26
|
+
export { validResult, validationError, validationWarning, } from './plugins/base.js';
|
|
27
|
+
// Built-in plugins
|
|
28
|
+
export { ToolPlugin } from './plugins/tool.plugin.js';
|
|
29
|
+
export { JobPlugin } from './plugins/job.plugin.js';
|
|
30
|
+
export { WebhookPlugin } from './plugins/webhook.plugin.js';
|
|
31
|
+
export { PreProcessorPlugin } from './plugins/preprocessor.plugin.js';
|
|
32
|
+
export { PostProcessorPlugin } from './plugins/postprocessor.plugin.js';
|
|
33
|
+
export { MCPServerPlugin } from './plugins/mcp-server.plugin.js';
|
|
34
|
+
export { SkillPlugin } from './plugins/skill.plugin.js';
|
|
35
|
+
// Utilities
|
|
36
|
+
export { extractStringProperty, extractBooleanProperty, extractNumberProperty, extractObjectProperty, extractSchemaProperty, hasProperty, getPropertyNames, isFunction, getFunctionBody, findImportSource, } from './utils/ast-helpers.js';
|
|
37
|
+
export { zodToJsonSchema, zodStringToJsonSchema, } from './utils/schema-converter.js';
|
|
38
|
+
// Source writing (generic + convenience)
|
|
39
|
+
export { updateAgentConfig, setAgentName, setAgentPersona, } from './source-writer.js';
|
|
40
|
+
// File discovery
|
|
41
|
+
export { findEntryPoint, findIndexFile, getEntryPointPriority, } from './utils/file-discovery.js';
|
|
42
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/compiler/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,gBAAgB;AAChB,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAqDlD,gBAAgB;AAChB,OAAO,EACL,cAAc,EACd,cAAc,EACd,qBAAqB,EACrB,yBAAyB,GAC1B,MAAM,uBAAuB,CAAC;AAE/B,mBAAmB;AACnB,OAAO,EACL,WAAW,EACX,eAAe,EACf,iBAAiB,GAClB,MAAM,mBAAmB,CAAC;AAE3B,mBAAmB;AACnB,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,YAAY;AACZ,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,WAAW,EACX,gBAAgB,EAChB,UAAU,EACV,eAAe,EACf,gBAAgB,GACjB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACL,eAAe,EACf,qBAAqB,GACtB,MAAM,6BAA6B,CAAC;AAErC,yCAAyC;AACzC,OAAO,EACL,iBAAiB,EACjB,YAAY,EACZ,eAAe,GAEhB,MAAM,oBAAoB,CAAC;AAE5B,iBAAiB;AACjB,OAAO,EACL,cAAc,EACd,aAAa,EACb,qBAAqB,GACtB,MAAM,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plugin Base
|
|
3
|
+
*
|
|
4
|
+
* Contains:
|
|
5
|
+
* - CompilationPlugin interface (contract)
|
|
6
|
+
* - BasePlugin abstract class (common implementation)
|
|
7
|
+
* - Helper functions
|
|
8
|
+
*
|
|
9
|
+
* Data types are in ../types.ts
|
|
10
|
+
*/
|
|
11
|
+
import { SourceFile, Project, ObjectLiteralExpression } from 'ts-morph';
|
|
12
|
+
import type { PrimitiveMetadata, CommonExtractedFields, ValidationResult, ValidationMessage, SchemaSet, BundledArtifact, CompiledPrimitive, ManifestPrimitive, ManifestContext, BaseMetadataFields } from '../types.js';
|
|
13
|
+
/**
|
|
14
|
+
* Context for resolving references between primitives.
|
|
15
|
+
* Passed to plugins when they need to resolve dependencies.
|
|
16
|
+
*/
|
|
17
|
+
export interface ReferenceResolverContext {
|
|
18
|
+
/** The ts-morph project for AST analysis */
|
|
19
|
+
project: Project;
|
|
20
|
+
/** Resolve an import specifier to absolute path */
|
|
21
|
+
resolveImportPath: (specifier: string, fromFile: string) => string | null;
|
|
22
|
+
/** Get a plugin by kind */
|
|
23
|
+
getPlugin: (kind: string) => CompilationPlugin | undefined;
|
|
24
|
+
/** Debug logging */
|
|
25
|
+
log: (message: string) => void;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Plugin for compiling a specific primitive type.
|
|
29
|
+
*
|
|
30
|
+
* Implement this interface to add support for a new primitive.
|
|
31
|
+
* Each method has a single responsibility:
|
|
32
|
+
*
|
|
33
|
+
* - detect: Find primitives in source files
|
|
34
|
+
* - validate: Check for errors/warnings
|
|
35
|
+
* - generateEntryPoint: Create the bundler entry point
|
|
36
|
+
* - extractSchemas: Convert Zod → JSON Schema
|
|
37
|
+
* - postProcess: Transform the bundled output
|
|
38
|
+
*/
|
|
39
|
+
export interface CompilationPlugin {
|
|
40
|
+
/**
|
|
41
|
+
* Unique identifier matching the primitive's 'kind' property.
|
|
42
|
+
* Must match exactly what users write in their code.
|
|
43
|
+
*/
|
|
44
|
+
readonly kind: string;
|
|
45
|
+
/**
|
|
46
|
+
* Human-readable name for CLI output and error messages.
|
|
47
|
+
*/
|
|
48
|
+
readonly displayName: string;
|
|
49
|
+
/**
|
|
50
|
+
* The function name that creates this primitive (e.g., 'defineTool').
|
|
51
|
+
* Used for detection in source files.
|
|
52
|
+
*/
|
|
53
|
+
readonly defineFunction: string;
|
|
54
|
+
/**
|
|
55
|
+
* Detect primitives of this type in a source file.
|
|
56
|
+
*
|
|
57
|
+
* Called once per source file during the scanning phase.
|
|
58
|
+
* Should be fast - don't do heavy processing here.
|
|
59
|
+
*
|
|
60
|
+
* @param sourceFile - The ts-morph source file to scan
|
|
61
|
+
* @returns Array of detected primitives
|
|
62
|
+
*/
|
|
63
|
+
detect(sourceFile: SourceFile): PrimitiveMetadata[];
|
|
64
|
+
/**
|
|
65
|
+
* Validate extracted metadata.
|
|
66
|
+
*
|
|
67
|
+
* Called after detection. Return errors for things that prevent
|
|
68
|
+
* compilation, warnings for things that might be problems.
|
|
69
|
+
*
|
|
70
|
+
* @param metadata - The primitive metadata to validate
|
|
71
|
+
* @returns Validation result with errors and warnings
|
|
72
|
+
*/
|
|
73
|
+
validate(metadata: PrimitiveMetadata): ValidationResult;
|
|
74
|
+
/**
|
|
75
|
+
* Generate the entry point code for bundling.
|
|
76
|
+
*
|
|
77
|
+
* This creates a wrapper that:
|
|
78
|
+
* 1. Imports the user's primitive
|
|
79
|
+
* 2. Re-exports it in a standard format
|
|
80
|
+
* 3. Includes runtime metadata
|
|
81
|
+
*
|
|
82
|
+
* @param metadata - The primitive metadata
|
|
83
|
+
* @returns TypeScript code for the entry point
|
|
84
|
+
*/
|
|
85
|
+
generateEntryPoint(metadata: PrimitiveMetadata): string;
|
|
86
|
+
/**
|
|
87
|
+
* Extract schemas and convert to JSON Schema format.
|
|
88
|
+
*
|
|
89
|
+
* Called after detection. Uses ts-morph to evaluate Zod
|
|
90
|
+
* schemas in the source code.
|
|
91
|
+
*
|
|
92
|
+
* @param metadata - The primitive metadata
|
|
93
|
+
* @param project - The ts-morph project
|
|
94
|
+
* @returns Schema set or undefined if no schemas
|
|
95
|
+
*/
|
|
96
|
+
extractSchemas?(metadata: PrimitiveMetadata, project: Project): Promise<SchemaSet | undefined>;
|
|
97
|
+
/**
|
|
98
|
+
* Post-process the bundled artifact.
|
|
99
|
+
*
|
|
100
|
+
* Called after esbuild bundling. Can add runtime wrappers,
|
|
101
|
+
* validation code, or other transformations.
|
|
102
|
+
*
|
|
103
|
+
* @param artifact - The bundled artifact
|
|
104
|
+
* @param metadata - The primitive metadata
|
|
105
|
+
* @returns Transformed artifact
|
|
106
|
+
*/
|
|
107
|
+
postProcess?(artifact: BundledArtifact, metadata: PrimitiveMetadata): BundledArtifact;
|
|
108
|
+
/**
|
|
109
|
+
* Create the manifest entry for this primitive.
|
|
110
|
+
*
|
|
111
|
+
* Each plugin knows what fields its manifest entry needs.
|
|
112
|
+
* This keeps primitive-specific logic in the plugins.
|
|
113
|
+
* May be async for plugins that need additional processing (e.g., bundling resolvers).
|
|
114
|
+
*
|
|
115
|
+
* @param compiled - The compiled primitive data
|
|
116
|
+
* @param context - Additional context (e.g., agent primitives, output directory)
|
|
117
|
+
* @returns The typed manifest entry for this primitive
|
|
118
|
+
*/
|
|
119
|
+
toManifestEntry(compiled: CompiledPrimitive, context?: ManifestContext): ManifestPrimitive | Promise<ManifestPrimitive>;
|
|
120
|
+
/**
|
|
121
|
+
* Resolve references to other primitives.
|
|
122
|
+
*
|
|
123
|
+
* Some primitives reference others (e.g., Skills reference Tools).
|
|
124
|
+
* This method allows plugins to resolve those references and return
|
|
125
|
+
* the additional primitives that should be compiled.
|
|
126
|
+
*
|
|
127
|
+
* @param metadata - The primitive that may have references
|
|
128
|
+
* @param sourceFile - The source file containing the primitive
|
|
129
|
+
* @param context - Context for resolving imports and getting plugins
|
|
130
|
+
* @returns Array of referenced primitives, empty if none
|
|
131
|
+
*/
|
|
132
|
+
resolveReferences?(metadata: PrimitiveMetadata, sourceFile: SourceFile, context: ReferenceResolverContext): PrimitiveMetadata[];
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Abstract base class for plugins with common implementation.
|
|
136
|
+
*
|
|
137
|
+
* Provides default implementations for:
|
|
138
|
+
* - detect() - Function-based and class-based detection
|
|
139
|
+
* - generateEntryPoint() - Universal import pattern
|
|
140
|
+
* - postProcess() - Runtime validation wrapper
|
|
141
|
+
* - extractSchemas() - Returns undefined (override for tools/webhooks)
|
|
142
|
+
*
|
|
143
|
+
* Subclasses must implement:
|
|
144
|
+
* - kind, displayName, defineFunction, legacyClassNames
|
|
145
|
+
* - extractFromConfig() - Extract primitive-specific fields
|
|
146
|
+
* - validate() - Validation rules
|
|
147
|
+
* - toManifestEntry() - Manifest entry creation
|
|
148
|
+
*
|
|
149
|
+
* Subclasses can optionally override:
|
|
150
|
+
* - getEntryPointFields() - Add extra fields to __lua_primitive__
|
|
151
|
+
* - getRuntimeValidation() - Add runtime checks in postProcess
|
|
152
|
+
* - resolveReferences() - Resolve dependencies (skills → tools)
|
|
153
|
+
*/
|
|
154
|
+
export declare abstract class BasePlugin<T extends BaseMetadataFields = BaseMetadataFields> implements CompilationPlugin {
|
|
155
|
+
/** Unique identifier for this primitive type */
|
|
156
|
+
abstract readonly kind: string;
|
|
157
|
+
/** Human-readable name for CLI output */
|
|
158
|
+
abstract readonly displayName: string;
|
|
159
|
+
/** Function name for detection (e.g., 'defineTool') */
|
|
160
|
+
abstract readonly defineFunction: string;
|
|
161
|
+
/** Legacy class names for constructor-based detection (e.g., ['LuaJob']) */
|
|
162
|
+
abstract readonly legacyClassNames: string[];
|
|
163
|
+
/**
|
|
164
|
+
* Detect primitives in a source file.
|
|
165
|
+
* Handles both function-based (defineX) and class-based (new LuaX) patterns.
|
|
166
|
+
*/
|
|
167
|
+
detect(sourceFile: SourceFile): PrimitiveMetadata<T>[];
|
|
168
|
+
/**
|
|
169
|
+
* Detect function-based definitions (defineX pattern):
|
|
170
|
+
*
|
|
171
|
+
* Supported patterns:
|
|
172
|
+
* - const/let/var x = defineX({ ... })
|
|
173
|
+
* - export const/let/var x = defineX({ ... })
|
|
174
|
+
* - export default defineX({ ... })
|
|
175
|
+
*/
|
|
176
|
+
protected detectFunctionBased(sourceFile: SourceFile, primitives: PrimitiveMetadata<T>[]): void;
|
|
177
|
+
/**
|
|
178
|
+
* Detect class-based definitions (new LuaX pattern):
|
|
179
|
+
*
|
|
180
|
+
* Supported patterns:
|
|
181
|
+
* - const/let/var x = new LuaX({ ... })
|
|
182
|
+
* - export const/let/var x = new LuaX({ ... })
|
|
183
|
+
* - export default new LuaX({ ... })
|
|
184
|
+
*/
|
|
185
|
+
protected detectClassBased(sourceFile: SourceFile, primitives: PrimitiveMetadata<T>[]): void;
|
|
186
|
+
/**
|
|
187
|
+
* Helper to detect export default patterns.
|
|
188
|
+
* Works for both function-based (defineX) and class-based (new LuaX) patterns.
|
|
189
|
+
*
|
|
190
|
+
* Sets exportName='default' which causes extractCommonFields to set isDefaultExport=true.
|
|
191
|
+
*/
|
|
192
|
+
private detectDefaultExport;
|
|
193
|
+
/**
|
|
194
|
+
* Extract metadata from config object literal.
|
|
195
|
+
* Subclasses implement this to extract primitive-specific fields.
|
|
196
|
+
*
|
|
197
|
+
* Common fields (name, description) can use extractCommonFields().
|
|
198
|
+
*/
|
|
199
|
+
protected abstract extractFromConfig(config: ObjectLiteralExpression, exportName: string, sourcePath: string, position: {
|
|
200
|
+
line: number;
|
|
201
|
+
column: number;
|
|
202
|
+
}, pattern: 'function' | 'class'): PrimitiveMetadata<T> | null;
|
|
203
|
+
/**
|
|
204
|
+
* Helper to extract common fields (name, description) from config.
|
|
205
|
+
* Returns null if name is missing.
|
|
206
|
+
*
|
|
207
|
+
* Automatically sets `isDefaultExport: true` when `exportName === 'default'`.
|
|
208
|
+
*/
|
|
209
|
+
protected extractCommonFields(config: ObjectLiteralExpression, exportName: string, sourcePath: string, position: {
|
|
210
|
+
line: number;
|
|
211
|
+
column: number;
|
|
212
|
+
}): CommonExtractedFields | null;
|
|
213
|
+
abstract validate(metadata: PrimitiveMetadata<T>): ValidationResult;
|
|
214
|
+
/**
|
|
215
|
+
* Generate entry point code for bundling.
|
|
216
|
+
*
|
|
217
|
+
* Uses `import { __lua_target__ as X }` which is provided by the compiler's
|
|
218
|
+
* virtual source plugin. This works uniformly regardless of how the primitive
|
|
219
|
+
* is exported (default, named, or not exported at all).
|
|
220
|
+
*/
|
|
221
|
+
generateEntryPoint(metadata: PrimitiveMetadata<T>): string;
|
|
222
|
+
/**
|
|
223
|
+
* Override to add extra fields to __lua_primitive__ object.
|
|
224
|
+
* Return a string like: `context: "some value",\n tools: ["tool1"]`
|
|
225
|
+
*/
|
|
226
|
+
protected getEntryPointFields(_metadata: PrimitiveMetadata<T>): string;
|
|
227
|
+
/**
|
|
228
|
+
* Extract schemas from the primitive.
|
|
229
|
+
* Override for primitives that have schemas (tools, webhooks).
|
|
230
|
+
*/
|
|
231
|
+
extractSchemas(_metadata: PrimitiveMetadata<T>, _project: Project): Promise<SchemaSet | undefined>;
|
|
232
|
+
/**
|
|
233
|
+
* Post-process bundled artifact with runtime validation wrapper.
|
|
234
|
+
*/
|
|
235
|
+
postProcess(artifact: BundledArtifact, metadata: PrimitiveMetadata<T>): BundledArtifact;
|
|
236
|
+
/**
|
|
237
|
+
* Override to add extra runtime validation in postProcess.
|
|
238
|
+
* Return JavaScript code to add to the validation IIFE.
|
|
239
|
+
*/
|
|
240
|
+
protected getRuntimeValidation(_metadata: PrimitiveMetadata<T>): string;
|
|
241
|
+
abstract toManifestEntry(compiled: CompiledPrimitive, context?: ManifestContext): ManifestPrimitive | Promise<ManifestPrimitive>;
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Creates a validation result with no errors or warnings.
|
|
245
|
+
*/
|
|
246
|
+
export declare function validResult(): ValidationResult;
|
|
247
|
+
/**
|
|
248
|
+
* Creates a validation error.
|
|
249
|
+
*/
|
|
250
|
+
export declare function validationError(message: string, options?: {
|
|
251
|
+
line?: number;
|
|
252
|
+
column?: number;
|
|
253
|
+
suggestion?: string;
|
|
254
|
+
docsUrl?: string;
|
|
255
|
+
}): ValidationMessage;
|
|
256
|
+
/**
|
|
257
|
+
* Creates a validation warning.
|
|
258
|
+
*/
|
|
259
|
+
export declare function validationWarning(message: string, options?: {
|
|
260
|
+
line?: number;
|
|
261
|
+
column?: number;
|
|
262
|
+
suggestion?: string;
|
|
263
|
+
docsUrl?: string;
|
|
264
|
+
}): ValidationMessage;
|
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plugin Base
|
|
3
|
+
*
|
|
4
|
+
* Contains:
|
|
5
|
+
* - CompilationPlugin interface (contract)
|
|
6
|
+
* - BasePlugin abstract class (common implementation)
|
|
7
|
+
* - Helper functions
|
|
8
|
+
*
|
|
9
|
+
* Data types are in ../types.ts
|
|
10
|
+
*/
|
|
11
|
+
import { Node } from 'ts-morph';
|
|
12
|
+
import { extractStringProperty } from '../utils/ast-helpers.js';
|
|
13
|
+
// =============================================================================
|
|
14
|
+
// BASE PLUGIN ABSTRACT CLASS
|
|
15
|
+
// =============================================================================
|
|
16
|
+
/**
|
|
17
|
+
* Abstract base class for plugins with common implementation.
|
|
18
|
+
*
|
|
19
|
+
* Provides default implementations for:
|
|
20
|
+
* - detect() - Function-based and class-based detection
|
|
21
|
+
* - generateEntryPoint() - Universal import pattern
|
|
22
|
+
* - postProcess() - Runtime validation wrapper
|
|
23
|
+
* - extractSchemas() - Returns undefined (override for tools/webhooks)
|
|
24
|
+
*
|
|
25
|
+
* Subclasses must implement:
|
|
26
|
+
* - kind, displayName, defineFunction, legacyClassNames
|
|
27
|
+
* - extractFromConfig() - Extract primitive-specific fields
|
|
28
|
+
* - validate() - Validation rules
|
|
29
|
+
* - toManifestEntry() - Manifest entry creation
|
|
30
|
+
*
|
|
31
|
+
* Subclasses can optionally override:
|
|
32
|
+
* - getEntryPointFields() - Add extra fields to __lua_primitive__
|
|
33
|
+
* - getRuntimeValidation() - Add runtime checks in postProcess
|
|
34
|
+
* - resolveReferences() - Resolve dependencies (skills → tools)
|
|
35
|
+
*/
|
|
36
|
+
export class BasePlugin {
|
|
37
|
+
// ===========================================================================
|
|
38
|
+
// DETECTION (common implementation)
|
|
39
|
+
// ===========================================================================
|
|
40
|
+
/**
|
|
41
|
+
* Detect primitives in a source file.
|
|
42
|
+
* Handles both function-based (defineX) and class-based (new LuaX) patterns.
|
|
43
|
+
*/
|
|
44
|
+
detect(sourceFile) {
|
|
45
|
+
const primitives = [];
|
|
46
|
+
// Pattern 1: Function-based - defineX({ ... })
|
|
47
|
+
this.detectFunctionBased(sourceFile, primitives);
|
|
48
|
+
// Pattern 2: Class-based - new LuaX({ ... })
|
|
49
|
+
this.detectClassBased(sourceFile, primitives);
|
|
50
|
+
return primitives;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Detect function-based definitions (defineX pattern):
|
|
54
|
+
*
|
|
55
|
+
* Supported patterns:
|
|
56
|
+
* - const/let/var x = defineX({ ... })
|
|
57
|
+
* - export const/let/var x = defineX({ ... })
|
|
58
|
+
* - export default defineX({ ... })
|
|
59
|
+
*/
|
|
60
|
+
detectFunctionBased(sourceFile, primitives) {
|
|
61
|
+
// Pattern 1: Variable declarations - const/let/var x = defineX({ ... })
|
|
62
|
+
// Also covers: export const/let/var x = defineX({ ... })
|
|
63
|
+
sourceFile.getVariableDeclarations().forEach(varDecl => {
|
|
64
|
+
const initializer = varDecl.getInitializer();
|
|
65
|
+
if (!initializer || !Node.isCallExpression(initializer))
|
|
66
|
+
return;
|
|
67
|
+
const callee = initializer.getExpression();
|
|
68
|
+
if (callee.getText() !== this.defineFunction)
|
|
69
|
+
return;
|
|
70
|
+
const args = initializer.getArguments();
|
|
71
|
+
if (args.length === 0)
|
|
72
|
+
return;
|
|
73
|
+
const configArg = args[0];
|
|
74
|
+
if (!Node.isObjectLiteralExpression(configArg))
|
|
75
|
+
return;
|
|
76
|
+
const pos = sourceFile.getLineAndColumnAtPos(varDecl.getStart());
|
|
77
|
+
const metadata = this.extractFromConfig(configArg, varDecl.getName(), sourceFile.getFilePath(), pos, 'function');
|
|
78
|
+
if (metadata)
|
|
79
|
+
primitives.push(metadata);
|
|
80
|
+
});
|
|
81
|
+
// Pattern 2: Export default - export default defineX({ ... })
|
|
82
|
+
this.detectDefaultExport(sourceFile, primitives, 'function', (expr) => {
|
|
83
|
+
if (!Node.isCallExpression(expr))
|
|
84
|
+
return null;
|
|
85
|
+
const callee = expr.getExpression();
|
|
86
|
+
if (callee.getText() !== this.defineFunction)
|
|
87
|
+
return null;
|
|
88
|
+
const args = expr.getArguments();
|
|
89
|
+
if (args.length === 0 || !Node.isObjectLiteralExpression(args[0]))
|
|
90
|
+
return null;
|
|
91
|
+
return args[0];
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Detect class-based definitions (new LuaX pattern):
|
|
96
|
+
*
|
|
97
|
+
* Supported patterns:
|
|
98
|
+
* - const/let/var x = new LuaX({ ... })
|
|
99
|
+
* - export const/let/var x = new LuaX({ ... })
|
|
100
|
+
* - export default new LuaX({ ... })
|
|
101
|
+
*/
|
|
102
|
+
detectClassBased(sourceFile, primitives) {
|
|
103
|
+
// Track which nodes we've already processed to avoid duplicates
|
|
104
|
+
const processedNodes = new Set();
|
|
105
|
+
// Pattern 1: Variable declarations - const/let/var x = new LuaX({ ... })
|
|
106
|
+
// Also covers: export const/let/var x = new LuaX({ ... })
|
|
107
|
+
sourceFile.getVariableDeclarations().forEach(varDecl => {
|
|
108
|
+
const initializer = varDecl.getInitializer();
|
|
109
|
+
if (!initializer || !Node.isNewExpression(initializer))
|
|
110
|
+
return;
|
|
111
|
+
const expression = initializer.getExpression();
|
|
112
|
+
const className = expression.getText();
|
|
113
|
+
if (!this.legacyClassNames.includes(className))
|
|
114
|
+
return;
|
|
115
|
+
const args = initializer.getArguments();
|
|
116
|
+
if (args.length === 0)
|
|
117
|
+
return;
|
|
118
|
+
const configArg = args[0];
|
|
119
|
+
if (!Node.isObjectLiteralExpression(configArg))
|
|
120
|
+
return;
|
|
121
|
+
processedNodes.add(initializer.getStart());
|
|
122
|
+
const pos = sourceFile.getLineAndColumnAtPos(varDecl.getStart());
|
|
123
|
+
const metadata = this.extractFromConfig(configArg, varDecl.getName(), sourceFile.getFilePath(), pos, 'class');
|
|
124
|
+
if (metadata)
|
|
125
|
+
primitives.push(metadata);
|
|
126
|
+
});
|
|
127
|
+
// Pattern 2: Export default - export default new LuaX({ ... })
|
|
128
|
+
this.detectDefaultExport(sourceFile, primitives, 'class', (expr) => {
|
|
129
|
+
if (!Node.isNewExpression(expr))
|
|
130
|
+
return null;
|
|
131
|
+
// Skip if already processed as variable declaration
|
|
132
|
+
if (processedNodes.has(expr.getStart()))
|
|
133
|
+
return null;
|
|
134
|
+
const expression = expr.getExpression();
|
|
135
|
+
const className = expression.getText();
|
|
136
|
+
if (!this.legacyClassNames.includes(className))
|
|
137
|
+
return null;
|
|
138
|
+
const args = expr.getArguments();
|
|
139
|
+
if (args.length === 0 || !Node.isObjectLiteralExpression(args[0]))
|
|
140
|
+
return null;
|
|
141
|
+
return args[0];
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Helper to detect export default patterns.
|
|
146
|
+
* Works for both function-based (defineX) and class-based (new LuaX) patterns.
|
|
147
|
+
*
|
|
148
|
+
* Sets exportName='default' which causes extractCommonFields to set isDefaultExport=true.
|
|
149
|
+
*/
|
|
150
|
+
detectDefaultExport(sourceFile, primitives, pattern, extractConfig) {
|
|
151
|
+
sourceFile.forEachDescendant(node => {
|
|
152
|
+
if (!Node.isExportAssignment(node))
|
|
153
|
+
return;
|
|
154
|
+
const expr = node.getExpression();
|
|
155
|
+
const configArg = extractConfig(expr);
|
|
156
|
+
if (!configArg)
|
|
157
|
+
return;
|
|
158
|
+
const pos = sourceFile.getLineAndColumnAtPos(node.getStart());
|
|
159
|
+
const metadata = this.extractFromConfig(configArg, 'default', // Triggers isDefaultExport=true in extractCommonFields
|
|
160
|
+
sourceFile.getFilePath(), pos, pattern);
|
|
161
|
+
if (metadata)
|
|
162
|
+
primitives.push(metadata);
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Helper to extract common fields (name, description) from config.
|
|
167
|
+
* Returns null if name is missing.
|
|
168
|
+
*
|
|
169
|
+
* Automatically sets `isDefaultExport: true` when `exportName === 'default'`.
|
|
170
|
+
*/
|
|
171
|
+
extractCommonFields(config, exportName, sourcePath, position) {
|
|
172
|
+
const name = extractStringProperty(config, 'name');
|
|
173
|
+
if (!name)
|
|
174
|
+
return null;
|
|
175
|
+
return {
|
|
176
|
+
name,
|
|
177
|
+
description: extractStringProperty(config, 'description') || '',
|
|
178
|
+
exportName,
|
|
179
|
+
isDefaultExport: exportName === 'default',
|
|
180
|
+
sourcePath,
|
|
181
|
+
line: position.line,
|
|
182
|
+
column: position.column,
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
// ===========================================================================
|
|
186
|
+
// ENTRY POINT GENERATION (common implementation)
|
|
187
|
+
// ===========================================================================
|
|
188
|
+
/**
|
|
189
|
+
* Generate entry point code for bundling.
|
|
190
|
+
*
|
|
191
|
+
* Uses `import { __lua_target__ as X }` which is provided by the compiler's
|
|
192
|
+
* virtual source plugin. This works uniformly regardless of how the primitive
|
|
193
|
+
* is exported (default, named, or not exported at all).
|
|
194
|
+
*/
|
|
195
|
+
generateEntryPoint(metadata) {
|
|
196
|
+
const extraFields = this.getEntryPointFields(metadata);
|
|
197
|
+
const extraFieldsStr = extraFields ? `\n ${extraFields}` : '';
|
|
198
|
+
// Default exports use `import X from` syntax directly.
|
|
199
|
+
// Named exports use the __lua_target__ alias injected by the virtual source plugin.
|
|
200
|
+
const importStatement = metadata.isDefaultExport
|
|
201
|
+
? `import __primitive__ from '${metadata.sourcePath}';`
|
|
202
|
+
: `import { __lua_target__ as __primitive__ } from '${metadata.sourcePath}';`;
|
|
203
|
+
return `
|
|
204
|
+
// =============================================================================
|
|
205
|
+
// AUTO-GENERATED ENTRY POINT
|
|
206
|
+
// ${this.displayName}: ${metadata.name}
|
|
207
|
+
// Source: ${metadata.sourcePath}
|
|
208
|
+
// =============================================================================
|
|
209
|
+
|
|
210
|
+
${importStatement}
|
|
211
|
+
|
|
212
|
+
const __lua_primitive__ = {
|
|
213
|
+
version: '2.0.0',
|
|
214
|
+
kind: '${this.kind}',
|
|
215
|
+
name: ${JSON.stringify(metadata.name)},
|
|
216
|
+
description: ${JSON.stringify(metadata.description)},
|
|
217
|
+
exportName: ${JSON.stringify(metadata.exportName)},${extraFieldsStr}
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
export default {
|
|
221
|
+
__lua_primitive__,
|
|
222
|
+
primitive: __primitive__,
|
|
223
|
+
};
|
|
224
|
+
`;
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Override to add extra fields to __lua_primitive__ object.
|
|
228
|
+
* Return a string like: `context: "some value",\n tools: ["tool1"]`
|
|
229
|
+
*/
|
|
230
|
+
getEntryPointFields(_metadata) {
|
|
231
|
+
return '';
|
|
232
|
+
}
|
|
233
|
+
// ===========================================================================
|
|
234
|
+
// SCHEMA EXTRACTION (default: no schemas)
|
|
235
|
+
// ===========================================================================
|
|
236
|
+
/**
|
|
237
|
+
* Extract schemas from the primitive.
|
|
238
|
+
* Override for primitives that have schemas (tools, webhooks).
|
|
239
|
+
*/
|
|
240
|
+
async extractSchemas(_metadata, _project) {
|
|
241
|
+
return undefined;
|
|
242
|
+
}
|
|
243
|
+
// ===========================================================================
|
|
244
|
+
// POST PROCESSING (common implementation)
|
|
245
|
+
// ===========================================================================
|
|
246
|
+
/**
|
|
247
|
+
* Post-process bundled artifact with runtime validation wrapper.
|
|
248
|
+
*/
|
|
249
|
+
postProcess(artifact, metadata) {
|
|
250
|
+
const extraValidation = this.getRuntimeValidation(metadata);
|
|
251
|
+
const extraValidationStr = extraValidation ? `\n ${extraValidation}` : '';
|
|
252
|
+
const wrappedCode = `
|
|
253
|
+
// =============================================================================
|
|
254
|
+
// LUA RUNTIME WRAPPER - ${this.displayName}: ${metadata.name}
|
|
255
|
+
// =============================================================================
|
|
256
|
+
|
|
257
|
+
${artifact.code}
|
|
258
|
+
|
|
259
|
+
(function() {
|
|
260
|
+
const mod = typeof module !== 'undefined' ? module.exports : {};
|
|
261
|
+
const primitive = mod.default;
|
|
262
|
+
|
|
263
|
+
if (!primitive || !primitive.__lua_primitive__) {
|
|
264
|
+
throw new Error('[Lua] Invalid ${this.kind} artifact: missing __lua_primitive__ marker');
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
if (primitive.__lua_primitive__.kind !== '${this.kind}') {
|
|
268
|
+
throw new Error('[Lua] Invalid ${this.kind} artifact: expected kind "${this.kind}"');
|
|
269
|
+
}${extraValidationStr}
|
|
270
|
+
})();
|
|
271
|
+
`;
|
|
272
|
+
return {
|
|
273
|
+
...artifact,
|
|
274
|
+
code: wrappedCode,
|
|
275
|
+
size: Buffer.byteLength(wrappedCode, 'utf8'),
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Override to add extra runtime validation in postProcess.
|
|
280
|
+
* Return JavaScript code to add to the validation IIFE.
|
|
281
|
+
*/
|
|
282
|
+
getRuntimeValidation(_metadata) {
|
|
283
|
+
return '';
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
// =============================================================================
|
|
287
|
+
// HELPER FUNCTIONS
|
|
288
|
+
// =============================================================================
|
|
289
|
+
/**
|
|
290
|
+
* Creates a validation result with no errors or warnings.
|
|
291
|
+
*/
|
|
292
|
+
export function validResult() {
|
|
293
|
+
return { valid: true, errors: [], warnings: [] };
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* Creates a validation error.
|
|
297
|
+
*/
|
|
298
|
+
export function validationError(message, options) {
|
|
299
|
+
return { message, ...options };
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* Creates a validation warning.
|
|
303
|
+
*/
|
|
304
|
+
export function validationWarning(message, options) {
|
|
305
|
+
return { message, ...options };
|
|
306
|
+
}
|
|
307
|
+
//# sourceMappingURL=base.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../../src/compiler/plugins/base.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAuB,IAAI,EAA2B,MAAM,UAAU,CAAC;AAa9E,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAqJhE,gFAAgF;AAChF,6BAA6B;AAC7B,gFAAgF;AAEhF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,OAAgB,UAAU;IAa9B,8EAA8E;IAC9E,oCAAoC;IACpC,8EAA8E;IAE9E;;;OAGG;IACH,MAAM,CAAC,UAAsB;QAC3B,MAAM,UAAU,GAA2B,EAAE,CAAC;QAE9C,+CAA+C;QAC/C,IAAI,CAAC,mBAAmB,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;QAEjD,6CAA6C;QAC7C,IAAI,CAAC,gBAAgB,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;QAE9C,OAAO,UAAU,CAAC;IACpB,CAAC;IAED;;;;;;;OAOG;IACO,mBAAmB,CAAC,UAAsB,EAAE,UAAkC;QACtF,wEAAwE;QACxE,yDAAyD;QACzD,UAAU,CAAC,uBAAuB,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;YACrD,MAAM,WAAW,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;YAC7C,IAAI,CAAC,WAAW,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,WAAW,CAAC;gBAAE,OAAO;YAEhE,MAAM,MAAM,GAAG,WAAW,CAAC,aAAa,EAAE,CAAC;YAC3C,IAAI,MAAM,CAAC,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WAAW;IACzB,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;AACnD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe,CAC7B,OAAe,EACf,OAAmF;IAEnF,OAAO,EAAE,OAAO,EAAE,GAAG,OAAO,EAAE,CAAC;AACjC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAC/B,OAAe,EACf,OAAmF;IAEnF,OAAO,EAAE,OAAO,EAAE,GAAG,OAAO,EAAE,CAAC;AACjC,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Job compilation plugin.
|
|
3
|
+
*
|
|
4
|
+
* BACKWARD COMPATIBLE: Detects BOTH patterns:
|
|
5
|
+
* 1. Class-based (legacy): new LuaJob({ ... })
|
|
6
|
+
* 2. Function-based (new): const myJob = defineJob({ ... })
|
|
7
|
+
*/
|
|
8
|
+
import { ObjectLiteralExpression } from 'ts-morph';
|
|
9
|
+
import { type JobMetadata, type JobMetadataFields, type ValidationResult, type ManifestContext, type CompiledPrimitive, type ManifestPrimitive } from '../types.js';
|
|
10
|
+
import { BasePlugin } from './base.js';
|
|
11
|
+
/**
|
|
12
|
+
* Plugin for compiling job primitives.
|
|
13
|
+
* Extends BasePlugin for common detection/entry point/postProcess logic.
|
|
14
|
+
*/
|
|
15
|
+
export declare class JobPlugin extends BasePlugin<JobMetadataFields> {
|
|
16
|
+
readonly kind = "job";
|
|
17
|
+
readonly displayName = "Job";
|
|
18
|
+
readonly defineFunction = "defineJob";
|
|
19
|
+
readonly legacyClassNames: string[];
|
|
20
|
+
/**
|
|
21
|
+
* Extract metadata from job config object.
|
|
22
|
+
*/
|
|
23
|
+
protected extractFromConfig(config: ObjectLiteralExpression, exportName: string, sourcePath: string, position: {
|
|
24
|
+
line: number;
|
|
25
|
+
column: number;
|
|
26
|
+
}, pattern: 'function' | 'class'): JobMetadata | null;
|
|
27
|
+
validate(metadata: JobMetadata): ValidationResult;
|
|
28
|
+
/**
|
|
29
|
+
* Add runtime validation for executeFunction (LuaJob uses this internally).
|
|
30
|
+
*/
|
|
31
|
+
protected getRuntimeValidation(): string;
|
|
32
|
+
toManifestEntry(compiled: CompiledPrimitive, _context?: ManifestContext): ManifestPrimitive;
|
|
33
|
+
}
|