lua-cli 3.15.3 ā 3.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api-exports.d.ts +5029 -698
- package/dist/api-exports.js +6509 -772
- package/dist/api-exports.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +41174 -82
- package/dist/index.js.map +1 -1
- package/dist/voice/test/index.d.ts +1217 -0
- package/dist/voice/test/index.js +386 -0
- package/dist/voice/test/index.js.map +1 -0
- package/dist/voice-exports.d.ts +40 -0
- package/dist/voice-exports.js +16 -0
- package/dist/voice-exports.js.map +1 -0
- package/docs/README.md +1 -1
- package/package.json +38 -21
- package/scripts/build-vendor.mjs +6 -3
- package/scripts/run-api-extractor.mjs +79 -0
- package/template/.gitignore +21 -0
- package/template/package.json +1 -1
- package/dist/api/agent.api.service.d.ts +0 -165
- package/dist/api/agent.api.service.d.ts.map +0 -1
- package/dist/api/agent.api.service.js +0 -207
- package/dist/api/agent.api.service.js.map +0 -1
- package/dist/api/agents.api.service.d.ts +0 -21
- package/dist/api/agents.api.service.d.ts.map +0 -1
- package/dist/api/agents.api.service.js +0 -51
- package/dist/api/agents.api.service.js.map +0 -1
- package/dist/api/ai.api.service.d.ts +0 -20
- package/dist/api/ai.api.service.d.ts.map +0 -1
- package/dist/api/ai.api.service.js +0 -40
- package/dist/api/ai.api.service.js.map +0 -1
- package/dist/api/auth.api.service.d.ts +0 -49
- package/dist/api/auth.api.service.d.ts.map +0 -1
- package/dist/api/auth.api.service.js +0 -55
- package/dist/api/auth.api.service.js.map +0 -1
- package/dist/api/backup.api.service.d.ts +0 -78
- package/dist/api/backup.api.service.d.ts.map +0 -1
- package/dist/api/backup.api.service.js +0 -115
- package/dist/api/backup.api.service.js.map +0 -1
- package/dist/api/basket.api.service.d.ts +0 -85
- package/dist/api/basket.api.service.d.ts.map +0 -1
- package/dist/api/basket.api.service.js +0 -160
- package/dist/api/basket.api.service.js.map +0 -1
- package/dist/api/cdn.api.service.d.ts +0 -21
- package/dist/api/cdn.api.service.d.ts.map +0 -1
- package/dist/api/cdn.api.service.js +0 -46
- package/dist/api/cdn.api.service.js.map +0 -1
- package/dist/api/chat.api.service.d.ts +0 -40
- package/dist/api/chat.api.service.d.ts.map +0 -1
- package/dist/api/chat.api.service.js +0 -121
- package/dist/api/chat.api.service.js.map +0 -1
- package/dist/api/credentials.d.ts +0 -25
- package/dist/api/credentials.d.ts.map +0 -1
- package/dist/api/credentials.js +0 -44
- package/dist/api/credentials.js.map +0 -1
- package/dist/api/custom.data.api.service.d.ts +0 -71
- package/dist/api/custom.data.api.service.d.ts.map +0 -1
- package/dist/api/custom.data.api.service.js +0 -126
- package/dist/api/custom.data.api.service.js.map +0 -1
- package/dist/api/developer.api.service.d.ts +0 -121
- package/dist/api/developer.api.service.d.ts.map +0 -1
- package/dist/api/developer.api.service.js +0 -162
- package/dist/api/developer.api.service.js.map +0 -1
- package/dist/api/device-trigger.api.service.d.ts +0 -136
- package/dist/api/device-trigger.api.service.d.ts.map +0 -1
- package/dist/api/device-trigger.api.service.js +0 -120
- package/dist/api/device-trigger.api.service.js.map +0 -1
- package/dist/api/device.api.service.d.ts +0 -61
- package/dist/api/device.api.service.d.ts.map +0 -1
- package/dist/api/device.api.service.js +0 -72
- package/dist/api/device.api.service.js.map +0 -1
- package/dist/api/http.client.d.ts +0 -90
- package/dist/api/http.client.d.ts.map +0 -1
- package/dist/api/http.client.js +0 -265
- package/dist/api/http.client.js.map +0 -1
- package/dist/api/job.api.service.d.ts +0 -154
- package/dist/api/job.api.service.d.ts.map +0 -1
- package/dist/api/job.api.service.js +0 -230
- package/dist/api/job.api.service.js.map +0 -1
- package/dist/api/lazy-instances.d.ts +0 -107
- package/dist/api/lazy-instances.d.ts.map +0 -1
- package/dist/api/lazy-instances.js +0 -220
- package/dist/api/lazy-instances.js.map +0 -1
- package/dist/api/logs.api.service.d.ts +0 -38
- package/dist/api/logs.api.service.d.ts.map +0 -1
- package/dist/api/logs.api.service.js +0 -50
- package/dist/api/logs.api.service.js.map +0 -1
- package/dist/api/marketplace.api.service.d.ts +0 -28
- package/dist/api/marketplace.api.service.d.ts.map +0 -1
- package/dist/api/marketplace.api.service.js +0 -112
- package/dist/api/marketplace.api.service.js.map +0 -1
- package/dist/api/order.api.service.d.ts +0 -53
- package/dist/api/order.api.service.d.ts.map +0 -1
- package/dist/api/order.api.service.js +0 -94
- package/dist/api/order.api.service.js.map +0 -1
- package/dist/api/persona.api.service.d.ts +0 -56
- package/dist/api/persona.api.service.d.ts.map +0 -1
- package/dist/api/persona.api.service.js +0 -90
- package/dist/api/persona.api.service.js.map +0 -1
- package/dist/api/postprocessor.api.service.d.ts +0 -151
- package/dist/api/postprocessor.api.service.d.ts.map +0 -1
- package/dist/api/postprocessor.api.service.js +0 -109
- package/dist/api/postprocessor.api.service.js.map +0 -1
- package/dist/api/preprocessor.api.service.d.ts +0 -155
- package/dist/api/preprocessor.api.service.d.ts.map +0 -1
- package/dist/api/preprocessor.api.service.js +0 -111
- package/dist/api/preprocessor.api.service.js.map +0 -1
- package/dist/api/products.api.service.d.ts +0 -80
- package/dist/api/products.api.service.d.ts.map +0 -1
- package/dist/api/products.api.service.js +0 -126
- package/dist/api/products.api.service.js.map +0 -1
- package/dist/api/resource.api.service.d.ts +0 -77
- package/dist/api/resource.api.service.d.ts.map +0 -1
- package/dist/api/resource.api.service.js +0 -74
- package/dist/api/resource.api.service.js.map +0 -1
- package/dist/api/skills.api.service.d.ts +0 -94
- package/dist/api/skills.api.service.d.ts.map +0 -1
- package/dist/api/skills.api.service.js +0 -120
- package/dist/api/skills.api.service.js.map +0 -1
- package/dist/api/tool.api.service.d.ts +0 -53
- package/dist/api/tool.api.service.d.ts.map +0 -1
- package/dist/api/tool.api.service.js +0 -74
- package/dist/api/tool.api.service.js.map +0 -1
- package/dist/api/unifiedto.api.service.d.ts +0 -133
- package/dist/api/unifiedto.api.service.d.ts.map +0 -1
- package/dist/api/unifiedto.api.service.js +0 -166
- package/dist/api/unifiedto.api.service.js.map +0 -1
- package/dist/api/user.data.api.service.d.ts +0 -69
- package/dist/api/user.data.api.service.d.ts.map +0 -1
- package/dist/api/user.data.api.service.js +0 -158
- package/dist/api/user.data.api.service.js.map +0 -1
- package/dist/api/webhook.api.service.d.ts +0 -163
- package/dist/api/webhook.api.service.d.ts.map +0 -1
- package/dist/api/webhook.api.service.js +0 -140
- package/dist/api/webhook.api.service.js.map +0 -1
- package/dist/api/whatsapp-templates.api.service.d.ts +0 -41
- package/dist/api/whatsapp-templates.api.service.d.ts.map +0 -1
- package/dist/api/whatsapp-templates.api.service.js +0 -79
- package/dist/api/whatsapp-templates.api.service.js.map +0 -1
- package/dist/api-exports.d.ts.map +0 -1
- package/dist/cli/command-definitions.d.ts +0 -29
- package/dist/cli/command-definitions.d.ts.map +0 -1
- package/dist/cli/command-definitions.js +0 -943
- package/dist/cli/command-definitions.js.map +0 -1
- package/dist/commands/admin.d.ts +0 -24
- package/dist/commands/admin.d.ts.map +0 -1
- package/dist/commands/admin.js +0 -44
- package/dist/commands/admin.js.map +0 -1
- package/dist/commands/agents.d.ts +0 -23
- package/dist/commands/agents.d.ts.map +0 -1
- package/dist/commands/agents.js +0 -83
- package/dist/commands/agents.js.map +0 -1
- package/dist/commands/apiKey.d.ts +0 -8
- package/dist/commands/apiKey.d.ts.map +0 -1
- package/dist/commands/apiKey.js +0 -43
- package/dist/commands/apiKey.js.map +0 -1
- package/dist/commands/channels.d.ts +0 -13
- package/dist/commands/channels.d.ts.map +0 -1
- package/dist/commands/channels.js +0 -747
- package/dist/commands/channels.js.map +0 -1
- package/dist/commands/chat-log-probe.d.ts +0 -59
- package/dist/commands/chat-log-probe.d.ts.map +0 -1
- package/dist/commands/chat-log-probe.js +0 -87
- package/dist/commands/chat-log-probe.js.map +0 -1
- package/dist/commands/chat.d.ts +0 -20
- package/dist/commands/chat.d.ts.map +0 -1
- package/dist/commands/chat.js +0 -618
- package/dist/commands/chat.js.map +0 -1
- package/dist/commands/chatClear.d.ts +0 -25
- package/dist/commands/chatClear.d.ts.map +0 -1
- package/dist/commands/chatClear.js +0 -71
- package/dist/commands/chatClear.js.map +0 -1
- package/dist/commands/compile.d.ts +0 -48
- package/dist/commands/compile.d.ts.map +0 -1
- package/dist/commands/compile.js +0 -216
- package/dist/commands/compile.js.map +0 -1
- package/dist/commands/completion.d.ts +0 -12
- package/dist/commands/completion.d.ts.map +0 -1
- package/dist/commands/completion.js +0 -211
- package/dist/commands/completion.js.map +0 -1
- package/dist/commands/configure.d.ts +0 -42
- package/dist/commands/configure.d.ts.map +0 -1
- package/dist/commands/configure.js +0 -76
- package/dist/commands/configure.js.map +0 -1
- package/dist/commands/deploy.d.ts +0 -14
- package/dist/commands/deploy.d.ts.map +0 -1
- package/dist/commands/deploy.js +0 -517
- package/dist/commands/deploy.js.map +0 -1
- package/dist/commands/destroy.d.ts +0 -8
- package/dist/commands/destroy.d.ts.map +0 -1
- package/dist/commands/destroy.js +0 -66
- package/dist/commands/destroy.js.map +0 -1
- package/dist/commands/devices.d.ts +0 -6
- package/dist/commands/devices.d.ts.map +0 -1
- package/dist/commands/devices.js +0 -265
- package/dist/commands/devices.js.map +0 -1
- package/dist/commands/docs.d.ts +0 -20
- package/dist/commands/docs.d.ts.map +0 -1
- package/dist/commands/docs.js +0 -33
- package/dist/commands/docs.js.map +0 -1
- package/dist/commands/env.d.ts +0 -34
- package/dist/commands/env.d.ts.map +0 -1
- package/dist/commands/env.js +0 -612
- package/dist/commands/env.js.map +0 -1
- package/dist/commands/evals.d.ts +0 -9
- package/dist/commands/evals.d.ts.map +0 -1
- package/dist/commands/evals.js +0 -27
- package/dist/commands/evals.js.map +0 -1
- package/dist/commands/features.d.ts +0 -13
- package/dist/commands/features.d.ts.map +0 -1
- package/dist/commands/features.js +0 -455
- package/dist/commands/features.js.map +0 -1
- package/dist/commands/governance.d.ts +0 -7
- package/dist/commands/governance.d.ts.map +0 -1
- package/dist/commands/governance.js +0 -258
- package/dist/commands/governance.js.map +0 -1
- package/dist/commands/index.d.ts +0 -38
- package/dist/commands/index.d.ts.map +0 -1
- package/dist/commands/index.js +0 -38
- package/dist/commands/index.js.map +0 -1
- package/dist/commands/init.d.ts +0 -53
- package/dist/commands/init.d.ts.map +0 -1
- package/dist/commands/init.js +0 -992
- package/dist/commands/init.js.map +0 -1
- package/dist/commands/integrations.d.ts +0 -18
- package/dist/commands/integrations.d.ts.map +0 -1
- package/dist/commands/integrations.js +0 -2666
- package/dist/commands/integrations.js.map +0 -1
- package/dist/commands/jobs.d.ts +0 -13
- package/dist/commands/jobs.d.ts.map +0 -1
- package/dist/commands/jobs.js +0 -736
- package/dist/commands/jobs.js.map +0 -1
- package/dist/commands/log-tip.d.ts +0 -79
- package/dist/commands/log-tip.d.ts.map +0 -1
- package/dist/commands/log-tip.js +0 -83
- package/dist/commands/log-tip.js.map +0 -1
- package/dist/commands/logs.d.ts +0 -13
- package/dist/commands/logs.d.ts.map +0 -1
- package/dist/commands/logs.js +0 -493
- package/dist/commands/logs.js.map +0 -1
- package/dist/commands/marketplace.d.ts +0 -34
- package/dist/commands/marketplace.d.ts.map +0 -1
- package/dist/commands/marketplace.js +0 -2105
- package/dist/commands/marketplace.js.map +0 -1
- package/dist/commands/mcp.d.ts +0 -32
- package/dist/commands/mcp.d.ts.map +0 -1
- package/dist/commands/mcp.js +0 -395
- package/dist/commands/mcp.js.map +0 -1
- package/dist/commands/models.d.ts +0 -18
- package/dist/commands/models.d.ts.map +0 -1
- package/dist/commands/models.js +0 -207
- package/dist/commands/models.js.map +0 -1
- package/dist/commands/persona.d.ts +0 -13
- package/dist/commands/persona.d.ts.map +0 -1
- package/dist/commands/persona.js +0 -560
- package/dist/commands/persona.js.map +0 -1
- package/dist/commands/postprocessors.d.ts +0 -13
- package/dist/commands/postprocessors.d.ts.map +0 -1
- package/dist/commands/postprocessors.js +0 -558
- package/dist/commands/postprocessors.js.map +0 -1
- package/dist/commands/preprocessors.d.ts +0 -13
- package/dist/commands/preprocessors.d.ts.map +0 -1
- package/dist/commands/preprocessors.js +0 -558
- package/dist/commands/preprocessors.js.map +0 -1
- package/dist/commands/production.d.ts +0 -13
- package/dist/commands/production.d.ts.map +0 -1
- package/dist/commands/production.js +0 -588
- package/dist/commands/production.js.map +0 -1
- package/dist/commands/push-helpers.d.ts +0 -42
- package/dist/commands/push-helpers.d.ts.map +0 -1
- package/dist/commands/push-helpers.js +0 -48
- package/dist/commands/push-helpers.js.map +0 -1
- package/dist/commands/push.d.ts +0 -31
- package/dist/commands/push.d.ts.map +0 -1
- package/dist/commands/push.js +0 -1262
- package/dist/commands/push.js.map +0 -1
- package/dist/commands/pushBackup.d.ts +0 -78
- package/dist/commands/pushBackup.d.ts.map +0 -1
- package/dist/commands/pushBackup.js +0 -274
- package/dist/commands/pushBackup.js.map +0 -1
- package/dist/commands/resources.d.ts +0 -13
- package/dist/commands/resources.d.ts.map +0 -1
- package/dist/commands/resources.js +0 -377
- package/dist/commands/resources.js.map +0 -1
- package/dist/commands/skills.d.ts +0 -13
- package/dist/commands/skills.d.ts.map +0 -1
- package/dist/commands/skills.js +0 -618
- package/dist/commands/skills.js.map +0 -1
- package/dist/commands/source.d.ts +0 -72
- package/dist/commands/source.d.ts.map +0 -1
- package/dist/commands/source.js +0 -134
- package/dist/commands/source.js.map +0 -1
- package/dist/commands/status.d.ts +0 -14
- package/dist/commands/status.d.ts.map +0 -1
- package/dist/commands/status.js +0 -731
- package/dist/commands/status.js.map +0 -1
- package/dist/commands/sync.d.ts +0 -28
- package/dist/commands/sync.d.ts.map +0 -1
- package/dist/commands/sync.js +0 -802
- package/dist/commands/sync.js.map +0 -1
- package/dist/commands/telemetry.d.ts +0 -6
- package/dist/commands/telemetry.d.ts.map +0 -1
- package/dist/commands/telemetry.js +0 -42
- package/dist/commands/telemetry.js.map +0 -1
- package/dist/commands/test-output.helpers.d.ts +0 -24
- package/dist/commands/test-output.helpers.d.ts.map +0 -1
- package/dist/commands/test-output.helpers.js +0 -62
- package/dist/commands/test-output.helpers.js.map +0 -1
- package/dist/commands/test.d.ts +0 -9
- package/dist/commands/test.d.ts.map +0 -1
- package/dist/commands/test.js +0 -787
- package/dist/commands/test.js.map +0 -1
- package/dist/commands/update.d.ts +0 -14
- package/dist/commands/update.d.ts.map +0 -1
- package/dist/commands/update.js +0 -97
- package/dist/commands/update.js.map +0 -1
- package/dist/commands/webhooks.d.ts +0 -13
- package/dist/commands/webhooks.d.ts.map +0 -1
- package/dist/commands/webhooks.js +0 -691
- package/dist/commands/webhooks.js.map +0 -1
- package/dist/compiler/agent-traverser.d.ts +0 -140
- package/dist/compiler/agent-traverser.d.ts.map +0 -1
- package/dist/compiler/agent-traverser.js +0 -420
- package/dist/compiler/agent-traverser.js.map +0 -1
- package/dist/compiler/bundler.d.ts +0 -43
- package/dist/compiler/bundler.d.ts.map +0 -1
- package/dist/compiler/bundler.js +0 -188
- package/dist/compiler/bundler.js.map +0 -1
- package/dist/compiler/compiler.d.ts +0 -208
- package/dist/compiler/compiler.d.ts.map +0 -1
- package/dist/compiler/compiler.js +0 -706
- package/dist/compiler/compiler.js.map +0 -1
- package/dist/compiler/index.d.ts +0 -38
- package/dist/compiler/index.d.ts.map +0 -1
- package/dist/compiler/index.js +0 -43
- package/dist/compiler/index.js.map +0 -1
- package/dist/compiler/plugins/agent.plugin.d.ts +0 -58
- package/dist/compiler/plugins/agent.plugin.d.ts.map +0 -1
- package/dist/compiler/plugins/agent.plugin.js +0 -161
- package/dist/compiler/plugins/agent.plugin.js.map +0 -1
- package/dist/compiler/plugins/base.d.ts +0 -334
- package/dist/compiler/plugins/base.d.ts.map +0 -1
- package/dist/compiler/plugins/base.js +0 -353
- package/dist/compiler/plugins/base.js.map +0 -1
- package/dist/compiler/plugins/device-trigger.plugin.d.ts +0 -38
- package/dist/compiler/plugins/device-trigger.plugin.d.ts.map +0 -1
- package/dist/compiler/plugins/device-trigger.plugin.js +0 -107
- package/dist/compiler/plugins/device-trigger.plugin.js.map +0 -1
- package/dist/compiler/plugins/device.plugin.d.ts +0 -39
- package/dist/compiler/plugins/device.plugin.d.ts.map +0 -1
- package/dist/compiler/plugins/device.plugin.js +0 -77
- package/dist/compiler/plugins/device.plugin.js.map +0 -1
- package/dist/compiler/plugins/job.plugin.d.ts +0 -34
- package/dist/compiler/plugins/job.plugin.d.ts.map +0 -1
- package/dist/compiler/plugins/job.plugin.js +0 -108
- package/dist/compiler/plugins/job.plugin.js.map +0 -1
- package/dist/compiler/plugins/mcp-server.plugin.d.ts +0 -38
- package/dist/compiler/plugins/mcp-server.plugin.d.ts.map +0 -1
- package/dist/compiler/plugins/mcp-server.plugin.js +0 -107
- package/dist/compiler/plugins/mcp-server.plugin.js.map +0 -1
- package/dist/compiler/plugins/postprocessor.plugin.d.ts +0 -21
- package/dist/compiler/plugins/postprocessor.plugin.d.ts.map +0 -1
- package/dist/compiler/plugins/postprocessor.plugin.js +0 -36
- package/dist/compiler/plugins/postprocessor.plugin.js.map +0 -1
- package/dist/compiler/plugins/preprocessor.plugin.d.ts +0 -21
- package/dist/compiler/plugins/preprocessor.plugin.d.ts.map +0 -1
- package/dist/compiler/plugins/preprocessor.plugin.js +0 -38
- package/dist/compiler/plugins/preprocessor.plugin.js.map +0 -1
- package/dist/compiler/plugins/processor-base.d.ts +0 -17
- package/dist/compiler/plugins/processor-base.d.ts.map +0 -1
- package/dist/compiler/plugins/processor-base.js +0 -27
- package/dist/compiler/plugins/processor-base.js.map +0 -1
- package/dist/compiler/plugins/registry.d.ts +0 -62
- package/dist/compiler/plugins/registry.d.ts.map +0 -1
- package/dist/compiler/plugins/registry.js +0 -113
- package/dist/compiler/plugins/registry.js.map +0 -1
- package/dist/compiler/plugins/skill.plugin.d.ts +0 -106
- package/dist/compiler/plugins/skill.plugin.d.ts.map +0 -1
- package/dist/compiler/plugins/skill.plugin.js +0 -316
- package/dist/compiler/plugins/skill.plugin.js.map +0 -1
- package/dist/compiler/plugins/tool.plugin.d.ts +0 -69
- package/dist/compiler/plugins/tool.plugin.d.ts.map +0 -1
- package/dist/compiler/plugins/tool.plugin.js +0 -262
- package/dist/compiler/plugins/tool.plugin.js.map +0 -1
- package/dist/compiler/plugins/webhook.plugin.d.ts +0 -38
- package/dist/compiler/plugins/webhook.plugin.d.ts.map +0 -1
- package/dist/compiler/plugins/webhook.plugin.js +0 -117
- package/dist/compiler/plugins/webhook.plugin.js.map +0 -1
- package/dist/compiler/source-writer.d.ts +0 -129
- package/dist/compiler/source-writer.d.ts.map +0 -1
- package/dist/compiler/source-writer.js +0 -329
- package/dist/compiler/source-writer.js.map +0 -1
- package/dist/compiler/types.d.ts +0 -391
- package/dist/compiler/types.d.ts.map +0 -1
- package/dist/compiler/types.js +0 -30
- package/dist/compiler/types.js.map +0 -1
- package/dist/compiler/utils/ast-helpers.d.ts +0 -106
- package/dist/compiler/utils/ast-helpers.d.ts.map +0 -1
- package/dist/compiler/utils/ast-helpers.js +0 -356
- package/dist/compiler/utils/ast-helpers.js.map +0 -1
- package/dist/compiler/utils/common.d.ts +0 -22
- package/dist/compiler/utils/common.d.ts.map +0 -1
- package/dist/compiler/utils/common.js +0 -55
- package/dist/compiler/utils/common.js.map +0 -1
- package/dist/compiler/utils/file-discovery.d.ts +0 -35
- package/dist/compiler/utils/file-discovery.d.ts.map +0 -1
- package/dist/compiler/utils/file-discovery.js +0 -60
- package/dist/compiler/utils/file-discovery.js.map +0 -1
- package/dist/compiler/utils/path-resolver.d.ts +0 -83
- package/dist/compiler/utils/path-resolver.d.ts.map +0 -1
- package/dist/compiler/utils/path-resolver.js +0 -162
- package/dist/compiler/utils/path-resolver.js.map +0 -1
- package/dist/compiler/utils/reference-resolver.d.ts +0 -196
- package/dist/compiler/utils/reference-resolver.d.ts.map +0 -1
- package/dist/compiler/utils/reference-resolver.js +0 -1026
- package/dist/compiler/utils/reference-resolver.js.map +0 -1
- package/dist/compiler/utils/schema-converter.d.ts +0 -52
- package/dist/compiler/utils/schema-converter.d.ts.map +0 -1
- package/dist/compiler/utils/schema-converter.js +0 -170
- package/dist/compiler/utils/schema-converter.js.map +0 -1
- package/dist/compiler/utils/workspace.d.ts +0 -35
- package/dist/compiler/utils/workspace.d.ts.map +0 -1
- package/dist/compiler/utils/workspace.js +0 -121
- package/dist/compiler/utils/workspace.js.map +0 -1
- package/dist/config/compile.constants.d.ts +0 -75
- package/dist/config/compile.constants.d.ts.map +0 -1
- package/dist/config/compile.constants.js +0 -95
- package/dist/config/compile.constants.js.map +0 -1
- package/dist/config/constants.d.ts +0 -49
- package/dist/config/constants.d.ts.map +0 -1
- package/dist/config/constants.js +0 -69
- package/dist/config/constants.js.map +0 -1
- package/dist/errors/auth.error.d.ts +0 -34
- package/dist/errors/auth.error.d.ts.map +0 -1
- package/dist/errors/auth.error.js +0 -29
- package/dist/errors/auth.error.js.map +0 -1
- package/dist/errors/index.d.ts +0 -5
- package/dist/errors/index.d.ts.map +0 -1
- package/dist/errors/index.js +0 -5
- package/dist/errors/index.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/instances/basket.instance.d.ts +0 -82
- package/dist/instances/basket.instance.d.ts.map +0 -1
- package/dist/instances/basket.instance.js +0 -245
- package/dist/instances/basket.instance.js.map +0 -1
- package/dist/instances/data.entry.instance.d.ts +0 -50
- package/dist/instances/data.entry.instance.d.ts.map +0 -1
- package/dist/instances/data.entry.instance.js +0 -163
- package/dist/instances/data.entry.instance.js.map +0 -1
- package/dist/instances/job.instance.d.ts +0 -133
- package/dist/instances/job.instance.d.ts.map +0 -1
- package/dist/instances/job.instance.js +0 -180
- package/dist/instances/job.instance.js.map +0 -1
- package/dist/instances/order.instance.d.ts +0 -50
- package/dist/instances/order.instance.d.ts.map +0 -1
- package/dist/instances/order.instance.js +0 -199
- package/dist/instances/order.instance.js.map +0 -1
- package/dist/instances/product.instance.d.ts +0 -43
- package/dist/instances/product.instance.d.ts.map +0 -1
- package/dist/instances/product.instance.js +0 -145
- package/dist/instances/product.instance.js.map +0 -1
- package/dist/instances/product.pagination.instance.d.ts +0 -102
- package/dist/instances/product.pagination.instance.d.ts.map +0 -1
- package/dist/instances/product.pagination.instance.js +0 -156
- package/dist/instances/product.pagination.instance.js.map +0 -1
- package/dist/instances/product.search.instance.d.ts +0 -81
- package/dist/instances/product.search.instance.d.ts.map +0 -1
- package/dist/instances/product.search.instance.js +0 -121
- package/dist/instances/product.search.instance.js.map +0 -1
- package/dist/instances/user.instance.d.ts +0 -56
- package/dist/instances/user.instance.d.ts.map +0 -1
- package/dist/instances/user.instance.js +0 -188
- package/dist/instances/user.instance.js.map +0 -1
- package/dist/interfaces/admin.d.ts +0 -64
- package/dist/interfaces/admin.d.ts.map +0 -1
- package/dist/interfaces/admin.js +0 -6
- package/dist/interfaces/admin.js.map +0 -1
- package/dist/interfaces/agent.d.ts +0 -399
- package/dist/interfaces/agent.d.ts.map +0 -1
- package/dist/interfaces/agent.js +0 -6
- package/dist/interfaces/agent.js.map +0 -1
- package/dist/interfaces/backup.d.ts +0 -17
- package/dist/interfaces/backup.d.ts.map +0 -1
- package/dist/interfaces/backup.js +0 -7
- package/dist/interfaces/backup.js.map +0 -1
- package/dist/interfaces/baskets.d.ts +0 -80
- package/dist/interfaces/baskets.d.ts.map +0 -1
- package/dist/interfaces/baskets.js +0 -20
- package/dist/interfaces/baskets.js.map +0 -1
- package/dist/interfaces/cdn.d.ts +0 -25
- package/dist/interfaces/cdn.d.ts.map +0 -1
- package/dist/interfaces/cdn.js +0 -6
- package/dist/interfaces/cdn.js.map +0 -1
- package/dist/interfaces/chat.d.ts +0 -98
- package/dist/interfaces/chat.d.ts.map +0 -1
- package/dist/interfaces/chat.js +0 -6
- package/dist/interfaces/chat.js.map +0 -1
- package/dist/interfaces/common.d.ts +0 -64
- package/dist/interfaces/common.d.ts.map +0 -1
- package/dist/interfaces/common.js +0 -9
- package/dist/interfaces/common.js.map +0 -1
- package/dist/interfaces/custom.data.d.ts +0 -83
- package/dist/interfaces/custom.data.d.ts.map +0 -1
- package/dist/interfaces/custom.data.js +0 -6
- package/dist/interfaces/custom.data.js.map +0 -1
- package/dist/interfaces/deploy.d.ts +0 -15
- package/dist/interfaces/deploy.d.ts.map +0 -1
- package/dist/interfaces/deploy.js +0 -5
- package/dist/interfaces/deploy.js.map +0 -1
- package/dist/interfaces/dev.d.ts +0 -54
- package/dist/interfaces/dev.d.ts.map +0 -1
- package/dist/interfaces/dev.js +0 -6
- package/dist/interfaces/dev.js.map +0 -1
- package/dist/interfaces/device-triggers.d.ts +0 -80
- package/dist/interfaces/device-triggers.d.ts.map +0 -1
- package/dist/interfaces/device-triggers.js +0 -6
- package/dist/interfaces/device-triggers.js.map +0 -1
- package/dist/interfaces/devices.d.ts +0 -74
- package/dist/interfaces/devices.d.ts.map +0 -1
- package/dist/interfaces/devices.js +0 -5
- package/dist/interfaces/devices.js.map +0 -1
- package/dist/interfaces/index.d.ts +0 -15
- package/dist/interfaces/index.d.ts.map +0 -1
- package/dist/interfaces/index.js +0 -8
- package/dist/interfaces/index.js.map +0 -1
- package/dist/interfaces/init.d.ts +0 -42
- package/dist/interfaces/init.d.ts.map +0 -1
- package/dist/interfaces/init.js +0 -5
- package/dist/interfaces/init.js.map +0 -1
- package/dist/interfaces/jobs.d.ts +0 -149
- package/dist/interfaces/jobs.d.ts.map +0 -1
- package/dist/interfaces/jobs.js +0 -6
- package/dist/interfaces/jobs.js.map +0 -1
- package/dist/interfaces/logs.d.ts +0 -44
- package/dist/interfaces/logs.d.ts.map +0 -1
- package/dist/interfaces/logs.js +0 -6
- package/dist/interfaces/logs.js.map +0 -1
- package/dist/interfaces/lua.d.ts +0 -37
- package/dist/interfaces/lua.d.ts.map +0 -1
- package/dist/interfaces/lua.js +0 -6
- package/dist/interfaces/lua.js.map +0 -1
- package/dist/interfaces/marketplace.d.ts +0 -171
- package/dist/interfaces/marketplace.d.ts.map +0 -1
- package/dist/interfaces/marketplace.js +0 -3
- package/dist/interfaces/marketplace.js.map +0 -1
- package/dist/interfaces/mcp.d.ts +0 -96
- package/dist/interfaces/mcp.d.ts.map +0 -1
- package/dist/interfaces/mcp.js +0 -9
- package/dist/interfaces/mcp.js.map +0 -1
- package/dist/interfaces/message.d.ts +0 -16
- package/dist/interfaces/message.d.ts.map +0 -1
- package/dist/interfaces/message.js +0 -2
- package/dist/interfaces/message.js.map +0 -1
- package/dist/interfaces/orders.d.ts +0 -68
- package/dist/interfaces/orders.d.ts.map +0 -1
- package/dist/interfaces/orders.js +0 -20
- package/dist/interfaces/orders.js.map +0 -1
- package/dist/interfaces/persona.d.ts +0 -44
- package/dist/interfaces/persona.d.ts.map +0 -1
- package/dist/interfaces/persona.js +0 -6
- package/dist/interfaces/persona.js.map +0 -1
- package/dist/interfaces/postprocessors.d.ts +0 -15
- package/dist/interfaces/postprocessors.d.ts.map +0 -1
- package/dist/interfaces/postprocessors.js +0 -5
- package/dist/interfaces/postprocessors.js.map +0 -1
- package/dist/interfaces/preprocessors.d.ts +0 -15
- package/dist/interfaces/preprocessors.d.ts.map +0 -1
- package/dist/interfaces/preprocessors.js +0 -5
- package/dist/interfaces/preprocessors.js.map +0 -1
- package/dist/interfaces/product.d.ts +0 -92
- package/dist/interfaces/product.d.ts.map +0 -1
- package/dist/interfaces/product.js +0 -6
- package/dist/interfaces/product.js.map +0 -1
- package/dist/interfaces/push.d.ts +0 -27
- package/dist/interfaces/push.d.ts.map +0 -1
- package/dist/interfaces/push.js +0 -5
- package/dist/interfaces/push.js.map +0 -1
- package/dist/interfaces/skills.d.ts +0 -137
- package/dist/interfaces/skills.d.ts.map +0 -1
- package/dist/interfaces/skills.js +0 -6
- package/dist/interfaces/skills.js.map +0 -1
- package/dist/interfaces/test.d.ts +0 -37
- package/dist/interfaces/test.d.ts.map +0 -1
- package/dist/interfaces/test.js +0 -5
- package/dist/interfaces/test.js.map +0 -1
- package/dist/interfaces/unifiedto.d.ts +0 -141
- package/dist/interfaces/unifiedto.d.ts.map +0 -1
- package/dist/interfaces/unifiedto.js +0 -6
- package/dist/interfaces/unifiedto.js.map +0 -1
- package/dist/interfaces/user.d.ts +0 -75
- package/dist/interfaces/user.d.ts.map +0 -1
- package/dist/interfaces/user.js +0 -2
- package/dist/interfaces/user.js.map +0 -1
- package/dist/interfaces/webhooks.d.ts +0 -97
- package/dist/interfaces/webhooks.d.ts.map +0 -1
- package/dist/interfaces/webhooks.js +0 -6
- package/dist/interfaces/webhooks.js.map +0 -1
- package/dist/interfaces/whatsapp-templates.d.ts +0 -105
- package/dist/interfaces/whatsapp-templates.d.ts.map +0 -1
- package/dist/interfaces/whatsapp-templates.js +0 -6
- package/dist/interfaces/whatsapp-templates.js.map +0 -1
- package/dist/primitives/agent.handler.d.ts +0 -71
- package/dist/primitives/agent.handler.d.ts.map +0 -1
- package/dist/primitives/agent.handler.js +0 -226
- package/dist/primitives/agent.handler.js.map +0 -1
- package/dist/primitives/base.handler.d.ts +0 -229
- package/dist/primitives/base.handler.d.ts.map +0 -1
- package/dist/primitives/base.handler.js +0 -620
- package/dist/primitives/base.handler.js.map +0 -1
- package/dist/primitives/device-trigger.handler.d.ts +0 -56
- package/dist/primitives/device-trigger.handler.d.ts.map +0 -1
- package/dist/primitives/device-trigger.handler.js +0 -99
- package/dist/primitives/device-trigger.handler.js.map +0 -1
- package/dist/primitives/device.handler.d.ts +0 -57
- package/dist/primitives/device.handler.d.ts.map +0 -1
- package/dist/primitives/device.handler.js +0 -103
- package/dist/primitives/device.handler.js.map +0 -1
- package/dist/primitives/index.d.ts +0 -51
- package/dist/primitives/index.d.ts.map +0 -1
- package/dist/primitives/index.js +0 -75
- package/dist/primitives/index.js.map +0 -1
- package/dist/primitives/job.handler.d.ts +0 -53
- package/dist/primitives/job.handler.d.ts.map +0 -1
- package/dist/primitives/job.handler.js +0 -110
- package/dist/primitives/job.handler.js.map +0 -1
- package/dist/primitives/mcp-server.handler.d.ts +0 -93
- package/dist/primitives/mcp-server.handler.d.ts.map +0 -1
- package/dist/primitives/mcp-server.handler.js +0 -216
- package/dist/primitives/mcp-server.handler.js.map +0 -1
- package/dist/primitives/postprocessor.handler.d.ts +0 -44
- package/dist/primitives/postprocessor.handler.d.ts.map +0 -1
- package/dist/primitives/postprocessor.handler.js +0 -71
- package/dist/primitives/postprocessor.handler.js.map +0 -1
- package/dist/primitives/preprocessor.handler.d.ts +0 -44
- package/dist/primitives/preprocessor.handler.d.ts.map +0 -1
- package/dist/primitives/preprocessor.handler.js +0 -72
- package/dist/primitives/preprocessor.handler.js.map +0 -1
- package/dist/primitives/skill.handler.d.ts +0 -47
- package/dist/primitives/skill.handler.d.ts.map +0 -1
- package/dist/primitives/skill.handler.js +0 -229
- package/dist/primitives/skill.handler.js.map +0 -1
- package/dist/primitives/types.d.ts +0 -91
- package/dist/primitives/types.d.ts.map +0 -1
- package/dist/primitives/types.js +0 -17
- package/dist/primitives/types.js.map +0 -1
- package/dist/primitives/webhook.handler.d.ts +0 -47
- package/dist/primitives/webhook.handler.d.ts.map +0 -1
- package/dist/primitives/webhook.handler.js +0 -87
- package/dist/primitives/webhook.handler.js.map +0 -1
- package/dist/services/analytics.d.ts +0 -57
- package/dist/services/analytics.d.ts.map +0 -1
- package/dist/services/analytics.js +0 -317
- package/dist/services/analytics.js.map +0 -1
- package/dist/services/auth.d.ts +0 -72
- package/dist/services/auth.d.ts.map +0 -1
- package/dist/services/auth.js +0 -173
- package/dist/services/auth.js.map +0 -1
- package/dist/services/sandbox.service.d.ts +0 -105
- package/dist/services/sandbox.service.d.ts.map +0 -1
- package/dist/services/sandbox.service.js +0 -531
- package/dist/services/sandbox.service.js.map +0 -1
- package/dist/types/api-contracts.d.ts +0 -287
- package/dist/types/api-contracts.d.ts.map +0 -1
- package/dist/types/api-contracts.js +0 -2
- package/dist/types/api-contracts.js.map +0 -1
- package/dist/types/index.d.ts +0 -28
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js +0 -30
- package/dist/types/index.js.map +0 -1
- package/dist/types/skill.d.ts +0 -1079
- package/dist/types/skill.d.ts.map +0 -1
- package/dist/types/skill.js +0 -688
- package/dist/types/skill.js.map +0 -1
- package/dist/types/tool-validation.d.ts +0 -35
- package/dist/types/tool-validation.d.ts.map +0 -1
- package/dist/types/tool-validation.js +0 -43
- package/dist/types/tool-validation.js.map +0 -1
- package/dist/types/yaml.types.d.ts +0 -91
- package/dist/types/yaml.types.d.ts.map +0 -1
- package/dist/types/yaml.types.js +0 -5
- package/dist/types/yaml.types.js.map +0 -1
- package/dist/utils/aliases.d.ts +0 -7
- package/dist/utils/aliases.d.ts.map +0 -1
- package/dist/utils/aliases.js +0 -492
- package/dist/utils/aliases.js.map +0 -1
- package/dist/utils/artifact-loader.d.ts +0 -152
- package/dist/utils/artifact-loader.d.ts.map +0 -1
- package/dist/utils/artifact-loader.js +0 -284
- package/dist/utils/artifact-loader.js.map +0 -1
- package/dist/utils/auth-flows.d.ts +0 -55
- package/dist/utils/auth-flows.d.ts.map +0 -1
- package/dist/utils/auth-flows.js +0 -246
- package/dist/utils/auth-flows.js.map +0 -1
- package/dist/utils/backup-helpers.d.ts +0 -238
- package/dist/utils/backup-helpers.d.ts.map +0 -1
- package/dist/utils/backup-helpers.js +0 -704
- package/dist/utils/backup-helpers.js.map +0 -1
- package/dist/utils/build-manifest-from-disk.d.ts +0 -8
- package/dist/utils/build-manifest-from-disk.d.ts.map +0 -1
- package/dist/utils/build-manifest-from-disk.js +0 -21
- package/dist/utils/build-manifest-from-disk.js.map +0 -1
- package/dist/utils/bundle-upload.d.ts +0 -42
- package/dist/utils/bundle-upload.d.ts.map +0 -1
- package/dist/utils/bundle-upload.js +0 -90
- package/dist/utils/bundle-upload.js.map +0 -1
- package/dist/utils/chat-attachments.d.ts +0 -15
- package/dist/utils/chat-attachments.d.ts.map +0 -1
- package/dist/utils/chat-attachments.js +0 -116
- package/dist/utils/chat-attachments.js.map +0 -1
- package/dist/utils/cli.d.ts +0 -62
- package/dist/utils/cli.d.ts.map +0 -1
- package/dist/utils/cli.js +0 -198
- package/dist/utils/cli.js.map +0 -1
- package/dist/utils/command-utils.d.ts +0 -46
- package/dist/utils/command-utils.d.ts.map +0 -1
- package/dist/utils/command-utils.js +0 -74
- package/dist/utils/command-utils.js.map +0 -1
- package/dist/utils/deploy-helpers.d.ts +0 -40
- package/dist/utils/deploy-helpers.d.ts.map +0 -1
- package/dist/utils/deploy-helpers.js +0 -76
- package/dist/utils/deploy-helpers.js.map +0 -1
- package/dist/utils/env-loader.utils.d.ts +0 -19
- package/dist/utils/env-loader.utils.d.ts.map +0 -1
- package/dist/utils/env-loader.utils.js +0 -90
- package/dist/utils/env-loader.utils.js.map +0 -1
- package/dist/utils/files.d.ts +0 -65
- package/dist/utils/files.d.ts.map +0 -1
- package/dist/utils/files.js +0 -193
- package/dist/utils/files.js.map +0 -1
- package/dist/utils/hints.d.ts +0 -81
- package/dist/utils/hints.d.ts.map +0 -1
- package/dist/utils/hints.js +0 -81
- package/dist/utils/hints.js.map +0 -1
- package/dist/utils/init-agent.d.ts +0 -86
- package/dist/utils/init-agent.d.ts.map +0 -1
- package/dist/utils/init-agent.js +0 -201
- package/dist/utils/init-agent.js.map +0 -1
- package/dist/utils/init-helpers.d.ts +0 -37
- package/dist/utils/init-helpers.d.ts.map +0 -1
- package/dist/utils/init-helpers.js +0 -78
- package/dist/utils/init-helpers.js.map +0 -1
- package/dist/utils/init-prompts.d.ts +0 -74
- package/dist/utils/init-prompts.d.ts.map +0 -1
- package/dist/utils/init-prompts.js +0 -256
- package/dist/utils/init-prompts.js.map +0 -1
- package/dist/utils/prompt-handler.d.ts +0 -17
- package/dist/utils/prompt-handler.d.ts.map +0 -1
- package/dist/utils/prompt-handler.js +0 -49
- package/dist/utils/prompt-handler.js.map +0 -1
- package/dist/utils/sandbox-storage.d.ts +0 -83
- package/dist/utils/sandbox-storage.d.ts.map +0 -1
- package/dist/utils/sandbox-storage.js +0 -211
- package/dist/utils/sandbox-storage.js.map +0 -1
- package/dist/utils/sandbox.d.ts +0 -76
- package/dist/utils/sandbox.d.ts.map +0 -1
- package/dist/utils/sandbox.js +0 -664
- package/dist/utils/sandbox.js.map +0 -1
- package/dist/utils/semver.d.ts +0 -40
- package/dist/utils/semver.d.ts.map +0 -1
- package/dist/utils/semver.js +0 -99
- package/dist/utils/semver.js.map +0 -1
- package/dist/utils/suggest.d.ts +0 -3
- package/dist/utils/suggest.d.ts.map +0 -1
- package/dist/utils/suggest.js +0 -32
- package/dist/utils/suggest.js.map +0 -1
- package/dist/utils/sync-display.d.ts +0 -28
- package/dist/utils/sync-display.d.ts.map +0 -1
- package/dist/utils/sync-display.js +0 -168
- package/dist/utils/sync-display.js.map +0 -1
- package/dist/utils/sync-fetch.d.ts +0 -108
- package/dist/utils/sync-fetch.d.ts.map +0 -1
- package/dist/utils/sync-fetch.js +0 -294
- package/dist/utils/sync-fetch.js.map +0 -1
- package/dist/utils/sync-helpers.d.ts +0 -7
- package/dist/utils/sync-helpers.d.ts.map +0 -1
- package/dist/utils/sync-helpers.js +0 -7
- package/dist/utils/sync-helpers.js.map +0 -1
- package/dist/utils/version-check.d.ts +0 -37
- package/dist/utils/version-check.d.ts.map +0 -1
- package/dist/utils/version-check.js +0 -117
- package/dist/utils/version-check.js.map +0 -1
- package/dist/utils/write-info.d.ts +0 -9
- package/dist/utils/write-info.d.ts.map +0 -1
- package/dist/utils/write-info.js +0 -11
- package/dist/utils/write-info.js.map +0 -1
- package/node_modules/@lua/shared-source-sync/dist/index.d.mts +0 -424
- package/node_modules/@lua/shared-source-sync/dist/index.d.ts +0 -424
- package/node_modules/@lua/shared-source-sync/dist/index.js +0 -536
- package/node_modules/@lua/shared-source-sync/dist/index.mjs +0 -491
- package/node_modules/@lua/shared-source-sync/package.json +0 -26
- package/node_modules/@lua/shared-source-sync/src/archive.ts +0 -98
- package/node_modules/@lua/shared-source-sync/src/filter.ts +0 -72
- package/node_modules/@lua/shared-source-sync/src/hash.ts +0 -40
- package/node_modules/@lua/shared-source-sync/src/http.ts +0 -132
- package/node_modules/@lua/shared-source-sync/src/index.ts +0 -56
- package/node_modules/@lua/shared-source-sync/src/pull.ts +0 -50
- package/node_modules/@lua/shared-source-sync/src/push.ts +0 -94
- package/node_modules/@lua/shared-source-sync/src/restore.ts +0 -83
- package/node_modules/@lua/shared-source-sync/src/skill-source.ts +0 -55
- package/node_modules/@lua/shared-source-sync/src/transfer.ts +0 -92
- package/node_modules/@lua/shared-source-sync/src/types.ts +0 -88
- package/node_modules/@lua/shared-source-sync/src/walk.ts +0 -91
- package/node_modules/@lua/shared-source-sync/tests/archive.test.ts +0 -108
- package/node_modules/@lua/shared-source-sync/tests/hash.test.ts +0 -40
- package/node_modules/@lua/shared-source-sync/tests/http.test.ts +0 -77
- package/node_modules/@lua/shared-source-sync/tests/push.test.ts +0 -162
- package/node_modules/@lua/shared-source-sync/tests/walk.test.ts +0 -84
- package/node_modules/@lua/shared-source-sync/tsconfig.json +0 -12
- package/node_modules/@lua/shared-source-sync/tsup.config.ts +0 -9
- package/node_modules/@lua/shared-source-sync/vitest.config.ts +0 -8
- package/node_modules/@lua/shared-types/dist/index.d.mts +0 -619
- package/node_modules/@lua/shared-types/dist/index.d.ts +0 -619
- package/node_modules/@lua/shared-types/dist/index.js +0 -435
- package/node_modules/@lua/shared-types/dist/index.mjs +0 -394
- package/node_modules/@lua/shared-types/package.json +0 -26
- package/node_modules/@lua/shared-types/src/agent-config.types.ts +0 -45
- package/node_modules/@lua/shared-types/src/agent-invocation.types.ts +0 -73
- package/node_modules/@lua/shared-types/src/ai-generate.types.ts +0 -74
- package/node_modules/@lua/shared-types/src/ai-generate.utils.ts +0 -16
- package/node_modules/@lua/shared-types/src/channel.type.ts +0 -23
- package/node_modules/@lua/shared-types/src/chat-history.types.ts +0 -112
- package/node_modules/@lua/shared-types/src/chat-stream.types.ts +0 -18
- package/node_modules/@lua/shared-types/src/client-tools.types.ts +0 -47
- package/node_modules/@lua/shared-types/src/device.types.ts +0 -190
- package/node_modules/@lua/shared-types/src/index.ts +0 -15
- package/node_modules/@lua/shared-types/src/model-registry.ts +0 -26
- package/node_modules/@lua/shared-types/src/persona-defaults.ts +0 -59
- package/node_modules/@lua/shared-types/src/persona-text.type.ts +0 -92
- package/node_modules/@lua/shared-types/src/sandbox-contract.ts +0 -63
- package/node_modules/@lua/shared-types/src/unstructured-types.ts +0 -58
- package/node_modules/@lua/shared-types/src/vm-execution-log.types.ts +0 -41
- package/node_modules/@lua/shared-types/tsconfig.json +0 -12
- package/node_modules/@lua/shared-types/tsup.config.ts +0 -9
- package/scripts/resolve-workspace-deps.cjs +0 -61
- /package/dist/{compiler/utils/zod-runtime.mjs ā zod-runtime.mjs} +0 -0
package/dist/commands/init.js
DELETED
|
@@ -1,992 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Init Command
|
|
3
|
-
* Orchestrates the initialization of a new Lua skill project
|
|
4
|
-
*/
|
|
5
|
-
import inquirer from 'inquirer';
|
|
6
|
-
import { checkApiKey } from '../services/auth.js';
|
|
7
|
-
import { requireAuthOrExit } from '../utils/command-utils.js';
|
|
8
|
-
import { withErrorHandling, writeProgress, writeSuccess, writeInfo, writeError, writeHintBlock } from '../utils/cli.js';
|
|
9
|
-
import { promptAgentChoice, promptOrganizationSelection, promptAgentSelection, promptMetadataCollection, promptAgentName, promptModelSelection, displayPersonaInstructions, promptDuplicateOptions, } from '../utils/init-prompts.js';
|
|
10
|
-
import { fetchAgentTypes, selectBaseAgentType, createNewAgent, fetchExistingAgentDetails, fetchApprovedModels, validateModelCode, updateAgentModel, } from '../utils/init-agent.js';
|
|
11
|
-
import { initializeProject, installDependencies, clearLinesIfNeeded } from '../utils/init-helpers.js';
|
|
12
|
-
import { readYamlConfig, updateYamlAgent, writeYamlConfig } from '../utils/files.js';
|
|
13
|
-
import BackupApi from '../api/backup.api.service.js';
|
|
14
|
-
import AgentApi from '../api/agent.api.service.js';
|
|
15
|
-
import { restoreProjectFromBackup, checkRestoreConflicts, downloadBlobsParallel, fetchBackupManifestForPull, } from '../utils/backup-helpers.js';
|
|
16
|
-
import { BASE_URLS } from '../config/constants.js';
|
|
17
|
-
import { trackEvent } from '../services/analytics.js';
|
|
18
|
-
import { agentHandler } from '../primitives/agent.handler.js';
|
|
19
|
-
import { fetchServerName, fetchServerPersona, fetchServerModel } from '../utils/sync-fetch.js';
|
|
20
|
-
/**
|
|
21
|
-
* Determines the init mode based on provided options.
|
|
22
|
-
* Validates that options are used correctly.
|
|
23
|
-
*/
|
|
24
|
-
function determineInitMode(options) {
|
|
25
|
-
const { agentId, agentName, orgId, orgName, fromAgentId } = options;
|
|
26
|
-
// --from-agent-id provided (duplicate agent)
|
|
27
|
-
if (fromAgentId) {
|
|
28
|
-
// Cannot combine with --agent-id (different mode)
|
|
29
|
-
if (agentId) {
|
|
30
|
-
return {
|
|
31
|
-
type: 'error',
|
|
32
|
-
message: '--from-agent-id cannot be combined with --agent-id',
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
// --org-id and --org-name are mutually exclusive
|
|
36
|
-
if (orgId && orgName) {
|
|
37
|
-
return {
|
|
38
|
-
type: 'error',
|
|
39
|
-
message: 'Cannot use both --org-id and --org-name together',
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
// --agent-name is reused as the new name for the duplicate (optional)
|
|
43
|
-
return {
|
|
44
|
-
type: 'duplicate-agent',
|
|
45
|
-
sourceAgentId: fromAgentId,
|
|
46
|
-
orgId,
|
|
47
|
-
orgName,
|
|
48
|
-
newName: agentName,
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
// No non-interactive flags provided
|
|
52
|
-
if (!agentId && !agentName && !orgId && !orgName) {
|
|
53
|
-
return { type: 'interactive' };
|
|
54
|
-
}
|
|
55
|
-
// --agent-id provided (use existing agent)
|
|
56
|
-
if (agentId) {
|
|
57
|
-
// Cannot combine with new agent flags
|
|
58
|
-
if (agentName || orgId || orgName) {
|
|
59
|
-
return {
|
|
60
|
-
type: 'error',
|
|
61
|
-
message: '--agent-id cannot be combined with --agent-name, --org-id, or --org-name',
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
return { type: 'existing-agent', agentId };
|
|
65
|
-
}
|
|
66
|
-
// --agent-name provided (create new agent)
|
|
67
|
-
if (agentName) {
|
|
68
|
-
// Must have either --org-id or --org-name, but not both
|
|
69
|
-
if (!orgId && !orgName) {
|
|
70
|
-
return {
|
|
71
|
-
type: 'error',
|
|
72
|
-
message: '--agent-name requires either --org-id or --org-name',
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
if (orgId && orgName) {
|
|
76
|
-
return {
|
|
77
|
-
type: 'error',
|
|
78
|
-
message: 'Cannot use both --org-id and --org-name together',
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
return { type: 'new-agent', agentName, orgId, orgName };
|
|
82
|
-
}
|
|
83
|
-
// --org-id or --org-name without --agent-name
|
|
84
|
-
if (orgId || orgName) {
|
|
85
|
-
return {
|
|
86
|
-
type: 'error',
|
|
87
|
-
message: '--org-id and --org-name require --agent-name',
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
return { type: 'interactive' };
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Shows usage help for non-interactive init
|
|
94
|
-
*/
|
|
95
|
-
function showInitUsage() {
|
|
96
|
-
console.log('\nUsage:');
|
|
97
|
-
console.log(' lua init --agent-id <id> Use existing agent');
|
|
98
|
-
console.log(' lua init --agent-name <name> --org-id <id> Create agent in existing org');
|
|
99
|
-
console.log(' lua init --agent-name <name> --org-name <name> Create agent + new org');
|
|
100
|
-
console.log(' lua init --agent-id <id> --force Override existing project');
|
|
101
|
-
console.log(' lua init --agent-id <id> --restore-sources Restore project from backup');
|
|
102
|
-
console.log(' lua init --from-agent-id <id> Duplicate an existing agent + scaffold');
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Non-interactive: Duplicates an existing agent into a new one.
|
|
106
|
-
*
|
|
107
|
-
* @param apiKey - User's API key
|
|
108
|
-
* @param userData - User data containing organizations
|
|
109
|
-
* @param mode - Duplicate mode with sourceAgentId, orgId, orgName, newName
|
|
110
|
-
* @param options - Init command options for include flags
|
|
111
|
-
* @returns Created agent, organization, and optional persona
|
|
112
|
-
*/
|
|
113
|
-
async function duplicateAgentNonInteractive(apiKey, userData, mode, options) {
|
|
114
|
-
// Find the source agent's org
|
|
115
|
-
const orgs = userData.admin?.orgs || [];
|
|
116
|
-
let sourceOrgId;
|
|
117
|
-
for (const org of orgs) {
|
|
118
|
-
const agent = org.agents?.find((a) => a.agentId === mode.sourceAgentId);
|
|
119
|
-
if (agent) {
|
|
120
|
-
sourceOrgId = org.id;
|
|
121
|
-
break;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
if (!sourceOrgId) {
|
|
125
|
-
throw new Error(`Cannot duplicate "${mode.sourceAgentId}": agent not found in any organization where you are an admin. ` +
|
|
126
|
-
`Duplicating an agent requires admin access to its org. ` +
|
|
127
|
-
`If you have non-admin access, ask an admin to perform the duplicate.`);
|
|
128
|
-
}
|
|
129
|
-
// Resolve target org ID
|
|
130
|
-
let targetOrgId;
|
|
131
|
-
if (mode.orgId) {
|
|
132
|
-
// Validate the org exists
|
|
133
|
-
const existingOrg = orgs.find((o) => o.id === mode.orgId);
|
|
134
|
-
if (!existingOrg) {
|
|
135
|
-
console.error(`ā Organization not found: ${mode.orgId}`);
|
|
136
|
-
writeInfo('\nAvailable organizations:');
|
|
137
|
-
for (const org of orgs) {
|
|
138
|
-
writeInfo(` - ${org.registeredName} (${org.id})`);
|
|
139
|
-
}
|
|
140
|
-
throw new Error('Operation failed');
|
|
141
|
-
}
|
|
142
|
-
targetOrgId = mode.orgId;
|
|
143
|
-
writeProgress(`ā
Using target organization: ${existingOrg.registeredName}`);
|
|
144
|
-
}
|
|
145
|
-
else if (mode.orgName) {
|
|
146
|
-
// Find org by name (case-insensitive)
|
|
147
|
-
const matchedOrg = orgs.find((o) => o.registeredName.toLowerCase() === mode.orgName.toLowerCase());
|
|
148
|
-
if (matchedOrg) {
|
|
149
|
-
targetOrgId = matchedOrg.id;
|
|
150
|
-
writeProgress(`ā
Found target organization: ${matchedOrg.registeredName}`);
|
|
151
|
-
}
|
|
152
|
-
else {
|
|
153
|
-
console.error(`ā Organization not found: ${mode.orgName}`);
|
|
154
|
-
writeInfo('\nAvailable organizations:');
|
|
155
|
-
for (const org of orgs) {
|
|
156
|
-
writeInfo(` - ${org.registeredName} (${org.id})`);
|
|
157
|
-
}
|
|
158
|
-
throw new Error('Operation failed');
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
else {
|
|
162
|
-
// Use source org
|
|
163
|
-
targetOrgId = sourceOrgId;
|
|
164
|
-
}
|
|
165
|
-
return runAgentDuplication({
|
|
166
|
-
apiKey,
|
|
167
|
-
sourceAgentId: mode.sourceAgentId,
|
|
168
|
-
sourceOrgId,
|
|
169
|
-
targetOrgId: targetOrgId,
|
|
170
|
-
newName: mode.newName,
|
|
171
|
-
include: {
|
|
172
|
-
resources: options.includeResources,
|
|
173
|
-
customData: options.includeCustomData,
|
|
174
|
-
inquiryForm: options.includeInquiryForm,
|
|
175
|
-
devices: options.includeDevices,
|
|
176
|
-
ecommerceCatalog: options.includeEcommerceCatalog,
|
|
177
|
-
},
|
|
178
|
-
orgs,
|
|
179
|
-
nonInteractive: true,
|
|
180
|
-
});
|
|
181
|
-
}
|
|
182
|
-
/**
|
|
183
|
-
* Shared core for both interactive and non-interactive duplicate flows:
|
|
184
|
-
* builds the request, calls the API, handles errors with telemetry,
|
|
185
|
-
* prints copied counts + warnings, fires the success event, and returns
|
|
186
|
-
* the resolved agent + org.
|
|
187
|
-
*/
|
|
188
|
-
async function runAgentDuplication(params) {
|
|
189
|
-
const { apiKey, sourceAgentId, sourceOrgId, targetOrgId, newName, include, orgs, nonInteractive } = params;
|
|
190
|
-
const body = { newName, include };
|
|
191
|
-
if (targetOrgId !== sourceOrgId) {
|
|
192
|
-
body.targetOrgId = targetOrgId;
|
|
193
|
-
}
|
|
194
|
-
const includedBuckets = [
|
|
195
|
-
include?.resources && 'resources',
|
|
196
|
-
include?.customData && 'customData',
|
|
197
|
-
include?.inquiryForm && 'inquiryForm',
|
|
198
|
-
include?.devices && 'devices',
|
|
199
|
-
include?.ecommerceCatalog && 'ecommerceCatalog',
|
|
200
|
-
].filter(Boolean);
|
|
201
|
-
const crossOrg = targetOrgId !== sourceOrgId;
|
|
202
|
-
writeProgress(`ā
Duplicating agent: ${sourceAgentId}`);
|
|
203
|
-
const agentApi = new AgentApi(BASE_URLS.API, apiKey);
|
|
204
|
-
const response = await agentApi.duplicateAgent(sourceOrgId, sourceAgentId, body);
|
|
205
|
-
if (!response.success) {
|
|
206
|
-
trackEvent('cli_init_duplicate_failed', {
|
|
207
|
-
non_interactive: nonInteractive,
|
|
208
|
-
cross_org: crossOrg,
|
|
209
|
-
included_buckets: includedBuckets,
|
|
210
|
-
status_code: response.error?.statusCode,
|
|
211
|
-
error_message: response.error?.message,
|
|
212
|
-
});
|
|
213
|
-
throw new Error(response.error?.message || 'Failed to duplicate agent');
|
|
214
|
-
}
|
|
215
|
-
const data = response.data;
|
|
216
|
-
writeSuccess(`ā
Agent duplicated successfully`);
|
|
217
|
-
writeInfo(` New Agent ID: ${data.agentId}`);
|
|
218
|
-
writeInfo(` Name: ${data.name}`);
|
|
219
|
-
writeInfo(` Org: ${data.orgId}`);
|
|
220
|
-
if (Object.keys(data.copied).length > 0) {
|
|
221
|
-
writeInfo(`\nš¦ Copied resources:`);
|
|
222
|
-
for (const [key, count] of Object.entries(data.copied)) {
|
|
223
|
-
writeInfo(` ${key}: ${count}`);
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
if (data.warnings.length > 0) {
|
|
227
|
-
writeInfo(`\nā ļø Warnings:`);
|
|
228
|
-
for (const warning of data.warnings) {
|
|
229
|
-
writeInfo(` ${warning}`);
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
trackEvent('cli_init_duplicate_completed', {
|
|
233
|
-
non_interactive: nonInteractive,
|
|
234
|
-
cross_org: crossOrg,
|
|
235
|
-
included_buckets: includedBuckets,
|
|
236
|
-
});
|
|
237
|
-
// Trust the API response for the resolved org id. Don't propagate the cached
|
|
238
|
-
// `agents` array ā it's stale (won't include the just-created agent) and
|
|
239
|
-
// downstream callers don't read it.
|
|
240
|
-
const targetOrg = orgs.find((o) => o.id === data.orgId);
|
|
241
|
-
// The just-duplicated agent already has the model copied from source.
|
|
242
|
-
// Fetch it so the caller can skip the model prompt ā no point asking the
|
|
243
|
-
// user to pick a model when the duplicate flow inherits the source's.
|
|
244
|
-
let inheritedModel;
|
|
245
|
-
try {
|
|
246
|
-
const fetched = await fetchServerModel(apiKey, data.agentId);
|
|
247
|
-
if (fetched)
|
|
248
|
-
inheritedModel = fetched;
|
|
249
|
-
}
|
|
250
|
-
catch {
|
|
251
|
-
// Non-fatal ā caller will fall back to its existing prompt/default path.
|
|
252
|
-
}
|
|
253
|
-
return {
|
|
254
|
-
agent: { agentId: data.agentId, name: data.name },
|
|
255
|
-
org: { id: data.orgId, name: targetOrg?.registeredName },
|
|
256
|
-
persona: undefined,
|
|
257
|
-
model: inheritedModel,
|
|
258
|
-
warnings: data.warnings,
|
|
259
|
-
};
|
|
260
|
-
}
|
|
261
|
-
/**
|
|
262
|
-
* Interactive: prompts the user to select a source agent + duplicate options
|
|
263
|
-
* and runs the duplication. Mirrors `duplicateAgentNonInteractive` but with
|
|
264
|
-
* inquirer prompts in place of CLI flags.
|
|
265
|
-
*
|
|
266
|
-
* Throws on cancellation so the caller can exit cleanly.
|
|
267
|
-
*/
|
|
268
|
-
async function duplicateAgentInteractive(apiKey, userData) {
|
|
269
|
-
const orgs = userData.admin?.orgs || [];
|
|
270
|
-
if (orgs.length === 0) {
|
|
271
|
-
throw new Error('No organizations found.');
|
|
272
|
-
}
|
|
273
|
-
// Pick source org + source agent ā reuse existing prompts
|
|
274
|
-
const sourceOrg = await promptOrganizationSelection(orgs);
|
|
275
|
-
const sourceAgent = await promptAgentSelection(sourceOrg);
|
|
276
|
-
// Duplicate-specific prompts (target org if cross-org-eligible, name, include flags, confirm)
|
|
277
|
-
const promptResult = await promptDuplicateOptions(sourceOrg, orgs, sourceAgent.name);
|
|
278
|
-
if (!promptResult.confirmed) {
|
|
279
|
-
writeInfo('\nā Cancelled.\n');
|
|
280
|
-
return null;
|
|
281
|
-
}
|
|
282
|
-
return runAgentDuplication({
|
|
283
|
-
apiKey,
|
|
284
|
-
sourceAgentId: sourceAgent.agentId,
|
|
285
|
-
sourceOrgId: sourceOrg.id,
|
|
286
|
-
targetOrgId: promptResult.targetOrg.id,
|
|
287
|
-
newName: promptResult.newName,
|
|
288
|
-
include: promptResult.include,
|
|
289
|
-
orgs,
|
|
290
|
-
nonInteractive: false,
|
|
291
|
-
});
|
|
292
|
-
}
|
|
293
|
-
/**
|
|
294
|
-
* Main init command - initializes a new Lua skill project.
|
|
295
|
-
*
|
|
296
|
-
* This command performs the following steps:
|
|
297
|
-
* 1. Authenticates the user
|
|
298
|
-
* 2. Prompts to select existing agent or create new one
|
|
299
|
-
* 3. For existing: Lets user select organization and agent
|
|
300
|
-
* 4. For new: Collects configuration and creates agent
|
|
301
|
-
* 5. Copies template files to current directory
|
|
302
|
-
* 6. Creates lua.skill.yaml configuration
|
|
303
|
-
* 7. Installs npm dependencies
|
|
304
|
-
*
|
|
305
|
-
* Features:
|
|
306
|
-
* - Interactive agent selection or creation
|
|
307
|
-
* - Non-interactive mode with --agent-id or --agent-name flags
|
|
308
|
-
* - Organization management
|
|
309
|
-
* - Business configuration
|
|
310
|
-
* - Agent type selection (defaults to Base Agent)
|
|
311
|
-
* - Feature configuration
|
|
312
|
-
* - Automatic project scaffolding
|
|
313
|
-
* - Dependency installation
|
|
314
|
-
* - Optional example code with --with-examples flag
|
|
315
|
-
*
|
|
316
|
-
* @param options - Command options including --with-examples and non-interactive flags
|
|
317
|
-
* @returns Promise that resolves when initialization is complete
|
|
318
|
-
*/
|
|
319
|
-
export async function initCommand(options = {}) {
|
|
320
|
-
const withExamples = options.withExamples ?? false;
|
|
321
|
-
return withErrorHandling(async () => {
|
|
322
|
-
// Step 1: Determine init mode
|
|
323
|
-
const mode = determineInitMode(options);
|
|
324
|
-
if (mode.type === 'error') {
|
|
325
|
-
console.error(`ā ${mode.message}`);
|
|
326
|
-
showInitUsage();
|
|
327
|
-
throw new Error(`${mode.message}`);
|
|
328
|
-
}
|
|
329
|
-
const isNonInteractive = mode.type !== 'interactive';
|
|
330
|
-
// Step 2: Authenticate
|
|
331
|
-
const apiKey = await requireAuthOrExit(false);
|
|
332
|
-
const userData = await checkApiKey(apiKey);
|
|
333
|
-
writeProgress('ā
Authenticated');
|
|
334
|
-
// Step 3: Check for existing YAML file
|
|
335
|
-
const existingYaml = readYamlConfig();
|
|
336
|
-
const yamlExists = existingYaml !== null;
|
|
337
|
-
if (yamlExists) {
|
|
338
|
-
const existingAgentId = existingYaml?.agent?.agentId;
|
|
339
|
-
if (existingAgentId) {
|
|
340
|
-
// Non-interactive mode: require --force to override
|
|
341
|
-
if (isNonInteractive && !options.force) {
|
|
342
|
-
writeError('\nā ļø Project already initialized with an agent');
|
|
343
|
-
writeInfo(` Current Agent ID: ${existingAgentId}`);
|
|
344
|
-
writeInfo('\nš” Use --force to override the existing configuration\n');
|
|
345
|
-
throw new Error('Operation failed');
|
|
346
|
-
}
|
|
347
|
-
// Non-interactive mode with --force: proceed with override
|
|
348
|
-
if (isNonInteractive && options.force) {
|
|
349
|
-
writeInfo('\nš Overriding existing project configuration...\n');
|
|
350
|
-
// Continue to non-interactive flow below
|
|
351
|
-
}
|
|
352
|
-
else {
|
|
353
|
-
// Interactive mode: check access and prompt
|
|
354
|
-
const hasAccess = checkUserHasAccessToAgent(userData, existingAgentId);
|
|
355
|
-
if (!hasAccess) {
|
|
356
|
-
writeError("\nā ļø You don't have access to the agent in this project");
|
|
357
|
-
writeInfo(` Agent ID: ${existingAgentId}\n`);
|
|
358
|
-
const { action } = await inquirer.prompt([
|
|
359
|
-
{
|
|
360
|
-
type: 'list',
|
|
361
|
-
name: 'action',
|
|
362
|
-
message: 'What would you like to do?',
|
|
363
|
-
choices: [
|
|
364
|
-
{ name: 'š§ Contact the agent admin to request access', value: 'contact' },
|
|
365
|
-
{ name: 'š Switch to a different agent', value: 'switch' },
|
|
366
|
-
{ name: 'ā Cancel', value: 'cancel' },
|
|
367
|
-
],
|
|
368
|
-
},
|
|
369
|
-
]);
|
|
370
|
-
if (action === 'contact') {
|
|
371
|
-
writeInfo('\nš” Please contact the agent administrator to grant you access.');
|
|
372
|
-
writeInfo(` Agent ID: ${existingAgentId}\n`);
|
|
373
|
-
process.exit(0);
|
|
374
|
-
}
|
|
375
|
-
if (action === 'cancel') {
|
|
376
|
-
writeInfo('\nā Initialization cancelled.\n');
|
|
377
|
-
process.exit(0);
|
|
378
|
-
}
|
|
379
|
-
// User chose to switch agent - update existing YAML only
|
|
380
|
-
await handleAgentSwitch(userData, apiKey, existingYaml);
|
|
381
|
-
return;
|
|
382
|
-
}
|
|
383
|
-
else {
|
|
384
|
-
// User has access - ask if they want to switch anyway
|
|
385
|
-
writeInfo('\nš Found existing project configuration');
|
|
386
|
-
writeInfo(` Current Agent ID: ${existingAgentId}\n`);
|
|
387
|
-
const { wantSwitch } = await inquirer.prompt([
|
|
388
|
-
{
|
|
389
|
-
type: 'list',
|
|
390
|
-
name: 'wantSwitch',
|
|
391
|
-
message: 'Do you want to switch this project to a different agent?',
|
|
392
|
-
choices: [
|
|
393
|
-
{ name: 'No - Keep current agent', value: false },
|
|
394
|
-
{ name: 'Yes - Switch to a different agent', value: true },
|
|
395
|
-
],
|
|
396
|
-
default: false,
|
|
397
|
-
},
|
|
398
|
-
]);
|
|
399
|
-
if (wantSwitch) {
|
|
400
|
-
// User wants to switch agent - update existing YAML only
|
|
401
|
-
await handleAgentSwitch(userData, apiKey, existingYaml);
|
|
402
|
-
return;
|
|
403
|
-
}
|
|
404
|
-
else {
|
|
405
|
-
writeInfo('\nā
Keeping current agent configuration\n');
|
|
406
|
-
process.exit(0);
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
|
-
}
|
|
411
|
-
}
|
|
412
|
-
let selectedAgent;
|
|
413
|
-
let selectedOrg;
|
|
414
|
-
let persona;
|
|
415
|
-
let serverModel;
|
|
416
|
-
let isNewAgent = false;
|
|
417
|
-
let selectedModel;
|
|
418
|
-
// Non-interactive --model flag: validate early
|
|
419
|
-
if (options.model) {
|
|
420
|
-
const models = await fetchApprovedModels(apiKey);
|
|
421
|
-
selectedModel = validateModelCode(models, options.model);
|
|
422
|
-
}
|
|
423
|
-
// Step 4: Execute based on mode ā select or create agent
|
|
424
|
-
if (mode.type === 'existing-agent') {
|
|
425
|
-
const result = await selectExistingAgentById(userData, apiKey, mode.agentId);
|
|
426
|
-
selectedAgent = result.agent;
|
|
427
|
-
selectedOrg = result.org;
|
|
428
|
-
persona = result.persona;
|
|
429
|
-
serverModel = result.model;
|
|
430
|
-
}
|
|
431
|
-
else if (mode.type === 'new-agent') {
|
|
432
|
-
const result = await createNewAgentNonInteractive(apiKey, userData, mode.agentName, mode.orgId, mode.orgName, options.promoCode, selectedModel);
|
|
433
|
-
selectedAgent = result.agent;
|
|
434
|
-
selectedOrg = result.org;
|
|
435
|
-
persona = result.persona;
|
|
436
|
-
isNewAgent = true;
|
|
437
|
-
}
|
|
438
|
-
else if (mode.type === 'duplicate-agent') {
|
|
439
|
-
const result = await duplicateAgentNonInteractive(apiKey, userData, mode, options);
|
|
440
|
-
selectedAgent = result.agent;
|
|
441
|
-
selectedOrg = result.org;
|
|
442
|
-
persona = result.persona;
|
|
443
|
-
// The duplicate inherits the source's model ā record it so the prompt
|
|
444
|
-
// block below sees a serverModel and skips the redundant LLM picker.
|
|
445
|
-
serverModel = result.model;
|
|
446
|
-
// CRITICAL: force the existing-agent + restore-sources flow so the new agent's
|
|
447
|
-
// duplicated project backup is downloaded into the local project.
|
|
448
|
-
options.restoreSources = true;
|
|
449
|
-
}
|
|
450
|
-
else {
|
|
451
|
-
// Interactive mode
|
|
452
|
-
const agentChoice = await promptAgentChoice();
|
|
453
|
-
if (agentChoice === 'existing') {
|
|
454
|
-
const result = await selectExistingAgent(userData, apiKey);
|
|
455
|
-
selectedAgent = result.agent;
|
|
456
|
-
selectedOrg = result.org;
|
|
457
|
-
persona = result.persona;
|
|
458
|
-
serverModel = result.model;
|
|
459
|
-
}
|
|
460
|
-
else if (agentChoice === 'duplicate') {
|
|
461
|
-
const result = await duplicateAgentInteractive(apiKey, userData);
|
|
462
|
-
if (!result) {
|
|
463
|
-
// User cancelled at the confirmation step ā exit cleanly
|
|
464
|
-
return;
|
|
465
|
-
}
|
|
466
|
-
selectedAgent = result.agent;
|
|
467
|
-
selectedOrg = result.org;
|
|
468
|
-
persona = result.persona;
|
|
469
|
-
serverModel = result.model;
|
|
470
|
-
// Mirror the non-interactive duplicate path: force restore-from-backup so
|
|
471
|
-
// the new agent's project bundle is downloaded into the local project.
|
|
472
|
-
options.restoreSources = true;
|
|
473
|
-
}
|
|
474
|
-
else {
|
|
475
|
-
const result = await createNewAgentFlow(apiKey, userData, options.promoCode);
|
|
476
|
-
selectedAgent = result.agent;
|
|
477
|
-
selectedOrg = result.org;
|
|
478
|
-
persona = result.persona;
|
|
479
|
-
selectedModel = result.model;
|
|
480
|
-
isNewAgent = true;
|
|
481
|
-
}
|
|
482
|
-
}
|
|
483
|
-
// Step 4.5: Check for backup restoration (existing agents only)
|
|
484
|
-
let sourcesRestored = false;
|
|
485
|
-
if (!isNewAgent && !yamlExists) {
|
|
486
|
-
sourcesRestored = await checkAndRestoreBackup(apiKey, selectedAgent.agentId, {
|
|
487
|
-
interactive: mode.type === 'interactive',
|
|
488
|
-
autoRestore: options.restoreSources === true,
|
|
489
|
-
});
|
|
490
|
-
}
|
|
491
|
-
// Step 4.6: After restoration, mirror server config (name/persona/model) into source.
|
|
492
|
-
// Fetch server state directly rather than agentHandler.checkDrift ā drift detection
|
|
493
|
-
// reads from the compilation manifest, which doesn't exist after a fresh init + restore.
|
|
494
|
-
if (sourcesRestored && !isNewAgent) {
|
|
495
|
-
try {
|
|
496
|
-
console.log('\nSyncing agent configuration from server...');
|
|
497
|
-
const [syncName, syncPersonaData, syncModel] = await Promise.all([
|
|
498
|
-
fetchServerName(apiKey, selectedAgent.agentId),
|
|
499
|
-
fetchServerPersona(apiKey, selectedAgent.agentId),
|
|
500
|
-
fetchServerModel(apiKey, selectedAgent.agentId),
|
|
501
|
-
]);
|
|
502
|
-
if (syncPersonaData?.persona) {
|
|
503
|
-
agentHandler.pullPersona(syncPersonaData.persona);
|
|
504
|
-
}
|
|
505
|
-
if (syncName) {
|
|
506
|
-
agentHandler.pullName(syncName);
|
|
507
|
-
}
|
|
508
|
-
if (syncModel) {
|
|
509
|
-
agentHandler.pullModel(syncModel);
|
|
510
|
-
}
|
|
511
|
-
writeSuccess(' ā
Agent configuration synced');
|
|
512
|
-
}
|
|
513
|
-
catch (error) {
|
|
514
|
-
writeInfo(' ā Failed to sync agent config ā run "lua sync" manually');
|
|
515
|
-
}
|
|
516
|
-
}
|
|
517
|
-
// Resolve model for existing agents (new agents already prompted above).
|
|
518
|
-
// Backup restored: server sync (Step 4.6) already handled it.
|
|
519
|
-
// Existing (no backup): use server model if present, else prompt.
|
|
520
|
-
if (!sourcesRestored && !isNewAgent && !selectedModel) {
|
|
521
|
-
if (serverModel) {
|
|
522
|
-
selectedModel = serverModel;
|
|
523
|
-
}
|
|
524
|
-
else if (mode.type === 'interactive') {
|
|
525
|
-
const models = await fetchApprovedModels(apiKey);
|
|
526
|
-
if (models.length > 0) {
|
|
527
|
-
selectedModel = await promptModelSelection(models);
|
|
528
|
-
}
|
|
529
|
-
}
|
|
530
|
-
}
|
|
531
|
-
// Show persona instructions (new agents only, after all prompts)
|
|
532
|
-
if (isNewAgent) {
|
|
533
|
-
displayPersonaInstructions();
|
|
534
|
-
}
|
|
535
|
-
// Push model to server only for existing agents where the user explicitly changed it.
|
|
536
|
-
// New agents already have the model set in the create request ā no separate PATCH needed.
|
|
537
|
-
const userChoseModel = selectedModel && selectedModel !== serverModel;
|
|
538
|
-
if (userChoseModel && !isNewAgent) {
|
|
539
|
-
try {
|
|
540
|
-
writeProgress(`š¤ Setting model: ${selectedModel}...`);
|
|
541
|
-
await updateAgentModel(apiKey, selectedAgent.agentId, selectedModel);
|
|
542
|
-
writeProgress(`ā
Model set: ${selectedModel}`);
|
|
543
|
-
}
|
|
544
|
-
catch (error) {
|
|
545
|
-
writeInfo(`ā ļø Could not set model on server ā you can push it later with \`lua push agent\``);
|
|
546
|
-
}
|
|
547
|
-
}
|
|
548
|
-
// Step 5: Initialize or update project
|
|
549
|
-
if (yamlExists) {
|
|
550
|
-
// Update existing YAML and LuaAgent in index.ts
|
|
551
|
-
writeInfo('š Updating existing lua.skill.yaml with new agent...');
|
|
552
|
-
updateYamlAgent(selectedAgent.agentId, selectedOrg.id);
|
|
553
|
-
const { updateAgentConfig } = await import('../compiler/index.js');
|
|
554
|
-
updateAgentConfig({ name: selectedAgent.name, persona, model: selectedModel }, { projectDir: process.cwd() });
|
|
555
|
-
writeSuccess('ā
lua.skill.yaml updated successfully!');
|
|
556
|
-
writeSuccess('ā
LuaAgent configuration updated!');
|
|
557
|
-
}
|
|
558
|
-
else {
|
|
559
|
-
// Full project initialization
|
|
560
|
-
// Skip template source files if sources were restored from backup
|
|
561
|
-
const currentDir = initializeProject(selectedAgent.agentId, selectedOrg.id, persona, selectedAgent.name, withExamples, sourcesRestored, // skipSourceTemplates - don't copy src/ if restored
|
|
562
|
-
selectedModel);
|
|
563
|
-
// Step 6: Install dependencies
|
|
564
|
-
await installDependencies(currentDir);
|
|
565
|
-
if (sourcesRestored) {
|
|
566
|
-
writeSuccess('ā
Project initialized with restored sources!');
|
|
567
|
-
writeInfo("š” Run 'lua compile' to rebuild from restored sources");
|
|
568
|
-
}
|
|
569
|
-
else if (withExamples) {
|
|
570
|
-
writeSuccess('ā
Lua skill project initialized with examples!');
|
|
571
|
-
writeInfo('š” Check the examples/ folder for sample skills, tools, jobs, and webhooks');
|
|
572
|
-
}
|
|
573
|
-
else {
|
|
574
|
-
writeSuccess('ā
Lua skill project initialized successfully!');
|
|
575
|
-
writeInfo('š” Tip: Use `lua init --with-examples` to include example code');
|
|
576
|
-
}
|
|
577
|
-
writeHintBlock({
|
|
578
|
-
headline: 'Project ready. Start the build loop:',
|
|
579
|
-
lines: [
|
|
580
|
-
{ label: '1. Compile:', command: 'lua compile' },
|
|
581
|
-
{ label: '2. Test locally:', command: 'lua test' },
|
|
582
|
-
{ label: '3. Chat in sandbox:', command: 'lua chat -e sandbox -m "test"' },
|
|
583
|
-
{ label: '4. Push & deploy:', command: 'lua push all --force --auto-deploy' },
|
|
584
|
-
],
|
|
585
|
-
when: 'success',
|
|
586
|
-
});
|
|
587
|
-
}
|
|
588
|
-
// Note: cli_init_duplicate_completed is fired inside runAgentDuplication for
|
|
589
|
-
// both interactive and non-interactive paths ā no separate hook needed here.
|
|
590
|
-
trackEvent('cli_init_completed', {
|
|
591
|
-
init_mode: mode.type,
|
|
592
|
-
is_new_agent: isNewAgent,
|
|
593
|
-
yaml_already_existed: yamlExists,
|
|
594
|
-
force_override: options.force || false,
|
|
595
|
-
restore_from_backup: options.restoreSources || false,
|
|
596
|
-
examples_included: withExamples,
|
|
597
|
-
sources_restored: sourcesRestored,
|
|
598
|
-
model_selected: !!selectedModel,
|
|
599
|
-
model: selectedModel,
|
|
600
|
-
});
|
|
601
|
-
}, 'initialization');
|
|
602
|
-
}
|
|
603
|
-
/**
|
|
604
|
-
* Handles the flow for selecting an existing agent.
|
|
605
|
-
* Fetches the agent details from the server to get persona.
|
|
606
|
-
*
|
|
607
|
-
* @param userData - User's data
|
|
608
|
-
* @param apiKey - User's API key
|
|
609
|
-
* @returns Selected agent, organization, and optional persona
|
|
610
|
-
*/
|
|
611
|
-
async function selectExistingAgent(userData, apiKey) {
|
|
612
|
-
// Extract organizations
|
|
613
|
-
const orgs = userData.admin.orgs;
|
|
614
|
-
if (!orgs || orgs.length === 0) {
|
|
615
|
-
throw new Error('No organizations found.');
|
|
616
|
-
}
|
|
617
|
-
// Select organization
|
|
618
|
-
const selectedOrg = await promptOrganizationSelection(orgs);
|
|
619
|
-
// Select agent from organization
|
|
620
|
-
const selectedAgent = await promptAgentSelection(selectedOrg);
|
|
621
|
-
// Fetch agent details to get persona and model
|
|
622
|
-
const agentDetails = await fetchExistingAgentDetails(apiKey, selectedAgent.agentId);
|
|
623
|
-
return {
|
|
624
|
-
agent: selectedAgent,
|
|
625
|
-
org: selectedOrg,
|
|
626
|
-
persona: agentDetails.persona,
|
|
627
|
-
model: agentDetails.model,
|
|
628
|
-
};
|
|
629
|
-
}
|
|
630
|
-
/**
|
|
631
|
-
* Non-interactive: Selects an existing agent by ID.
|
|
632
|
-
* Finds the agent across all user's organizations.
|
|
633
|
-
*
|
|
634
|
-
* @param userData - User's data
|
|
635
|
-
* @param apiKey - User's API key
|
|
636
|
-
* @param agentId - Agent ID to find
|
|
637
|
-
* @returns Selected agent, organization, and optional persona
|
|
638
|
-
*/
|
|
639
|
-
async function selectExistingAgentById(userData, apiKey, agentId) {
|
|
640
|
-
const orgs = userData.admin?.orgs || [];
|
|
641
|
-
if (orgs.length === 0) {
|
|
642
|
-
console.error('ā No organizations found.');
|
|
643
|
-
throw new Error('No organizations found.');
|
|
644
|
-
}
|
|
645
|
-
// Find agent across all organizations
|
|
646
|
-
for (const org of orgs) {
|
|
647
|
-
const agent = org.agents?.find((a) => a.agentId === agentId);
|
|
648
|
-
if (agent) {
|
|
649
|
-
writeProgress(`ā
Found agent: ${agent.name}`);
|
|
650
|
-
// Fetch agent details to get persona and model
|
|
651
|
-
const agentDetails = await fetchExistingAgentDetails(apiKey, agentId);
|
|
652
|
-
return {
|
|
653
|
-
agent: { agentId: agent.agentId, name: agent.name },
|
|
654
|
-
org: { id: org.id, name: org.registeredName, agents: org.agents },
|
|
655
|
-
persona: agentDetails.persona,
|
|
656
|
-
model: agentDetails.model,
|
|
657
|
-
};
|
|
658
|
-
}
|
|
659
|
-
}
|
|
660
|
-
// Agent not found
|
|
661
|
-
console.error(`ā Agent not found: ${agentId}`);
|
|
662
|
-
writeInfo('\nAvailable agents:');
|
|
663
|
-
for (const org of orgs) {
|
|
664
|
-
if (org.agents && org.agents.length > 0) {
|
|
665
|
-
writeInfo(` ${org.registeredName}:`);
|
|
666
|
-
for (const agent of org.agents) {
|
|
667
|
-
writeInfo(` - ${agent.name} (${agent.agentId})`);
|
|
668
|
-
}
|
|
669
|
-
}
|
|
670
|
-
}
|
|
671
|
-
throw new Error('Operation failed');
|
|
672
|
-
}
|
|
673
|
-
/**
|
|
674
|
-
* Non-interactive: Creates a new agent with provided parameters.
|
|
675
|
-
*
|
|
676
|
-
* @param apiKey - User's API key
|
|
677
|
-
* @param userData - User data containing organizations
|
|
678
|
-
* @param agentName - Name for the new agent
|
|
679
|
-
* @param orgId - Optional existing org ID
|
|
680
|
-
* @param orgName - Optional new org name
|
|
681
|
-
* @returns Created agent, organization, and optional persona
|
|
682
|
-
*/
|
|
683
|
-
async function createNewAgentNonInteractive(apiKey, userData, agentName, orgId, orgName, promoCode, model) {
|
|
684
|
-
// Fetch and select agent type
|
|
685
|
-
const agentTypes = await fetchAgentTypes(apiKey);
|
|
686
|
-
const selectedAgentType = selectBaseAgentType(agentTypes);
|
|
687
|
-
// Validate org if --org-id provided
|
|
688
|
-
if (orgId) {
|
|
689
|
-
const orgs = userData.admin?.orgs || [];
|
|
690
|
-
const existingOrg = orgs.find((o) => o.id === orgId);
|
|
691
|
-
if (!existingOrg) {
|
|
692
|
-
console.error(`ā Organization not found: ${orgId}`);
|
|
693
|
-
writeInfo('\nAvailable organizations:');
|
|
694
|
-
for (const org of orgs) {
|
|
695
|
-
writeInfo(` - ${org.registeredName} (${org.id})`);
|
|
696
|
-
}
|
|
697
|
-
throw new Error('Operation failed');
|
|
698
|
-
}
|
|
699
|
-
writeProgress(`ā
Using organization: ${existingOrg.registeredName}`);
|
|
700
|
-
}
|
|
701
|
-
else if (orgName) {
|
|
702
|
-
writeProgress(`ā
Creating new organization: ${orgName}`);
|
|
703
|
-
}
|
|
704
|
-
// Enable all features by default
|
|
705
|
-
const availableFeatures = Object.keys(selectedAgentType.features);
|
|
706
|
-
const features = availableFeatures.reduce((acc, feature) => {
|
|
707
|
-
acc[feature] = true;
|
|
708
|
-
return acc;
|
|
709
|
-
}, {});
|
|
710
|
-
writeProgress(`ā
Creating agent: ${agentName}`);
|
|
711
|
-
// Create the agent (model included in request ā no separate PATCH needed)
|
|
712
|
-
const result = await createNewAgent(apiKey, selectedAgentType, agentName, {}, // Empty metadata - base agent doesn't require any
|
|
713
|
-
features, orgId, orgName, promoCode, model);
|
|
714
|
-
return result;
|
|
715
|
-
}
|
|
716
|
-
/**
|
|
717
|
-
* Handles the flow for creating a new agent.
|
|
718
|
-
*
|
|
719
|
-
* @param apiKey - User's API key
|
|
720
|
-
* @param userData - User data containing organizations
|
|
721
|
-
* @returns Created agent, organization, and optional persona
|
|
722
|
-
*/
|
|
723
|
-
async function createNewAgentFlow(apiKey, userData, promoCode) {
|
|
724
|
-
// Fetch and select agent type
|
|
725
|
-
const agentTypes = await fetchAgentTypes(apiKey);
|
|
726
|
-
const selectedAgentType = selectBaseAgentType(agentTypes);
|
|
727
|
-
// Ask about organization selection FIRST
|
|
728
|
-
const { orgChoice } = await inquirer.prompt([
|
|
729
|
-
{
|
|
730
|
-
type: 'list',
|
|
731
|
-
name: 'orgChoice',
|
|
732
|
-
message: 'Organization:',
|
|
733
|
-
choices: [
|
|
734
|
-
{ name: 'š¢ Use existing organization', value: 'existing' },
|
|
735
|
-
{ name: 'ā Create new organization', value: 'create' },
|
|
736
|
-
],
|
|
737
|
-
},
|
|
738
|
-
]);
|
|
739
|
-
let orgId;
|
|
740
|
-
let orgName;
|
|
741
|
-
let usingExistingOrg = false;
|
|
742
|
-
if (orgChoice === 'existing') {
|
|
743
|
-
// Select from existing organizations
|
|
744
|
-
const orgs = userData.admin?.orgs || [];
|
|
745
|
-
if (orgs.length === 0) {
|
|
746
|
-
writeInfo('\nā ļø No existing organizations found. Creating new organization instead.\n');
|
|
747
|
-
}
|
|
748
|
-
else {
|
|
749
|
-
const selectedOrg = await promptOrganizationSelection(orgs);
|
|
750
|
-
orgId = selectedOrg.id;
|
|
751
|
-
usingExistingOrg = true;
|
|
752
|
-
}
|
|
753
|
-
}
|
|
754
|
-
if (!orgId) {
|
|
755
|
-
// Create new organization - ask for org name
|
|
756
|
-
const { organizationName } = await inquirer.prompt([
|
|
757
|
-
{
|
|
758
|
-
type: 'input',
|
|
759
|
-
name: 'organizationName',
|
|
760
|
-
message: 'Organization name:',
|
|
761
|
-
validate: (input) => {
|
|
762
|
-
if (!input || input.trim() === '') {
|
|
763
|
-
return 'Organization name is required';
|
|
764
|
-
}
|
|
765
|
-
return true;
|
|
766
|
-
},
|
|
767
|
-
},
|
|
768
|
-
]);
|
|
769
|
-
orgName = organizationName.trim();
|
|
770
|
-
}
|
|
771
|
-
// Collect required metadata
|
|
772
|
-
let linesToClear = 2; // orgChoice + (org selection OR org name)
|
|
773
|
-
const metadata = selectedAgentType.requiredSubAgentMetadata?.length
|
|
774
|
-
? await promptMetadataCollection(selectedAgentType.requiredSubAgentMetadata)
|
|
775
|
-
: {};
|
|
776
|
-
// Enable all features by default (skip configuration prompt)
|
|
777
|
-
const availableFeatures = Object.keys(selectedAgentType.features);
|
|
778
|
-
const features = availableFeatures.reduce((acc, feature) => {
|
|
779
|
-
acc[feature] = true;
|
|
780
|
-
return acc;
|
|
781
|
-
}, {});
|
|
782
|
-
// Collect agent name
|
|
783
|
-
const agentName = await promptAgentName();
|
|
784
|
-
linesToClear += 1; // agentName prompt
|
|
785
|
-
// Prompt for model (last config step before creation)
|
|
786
|
-
let selectedModel;
|
|
787
|
-
const models = await fetchApprovedModels(apiKey);
|
|
788
|
-
if (models.length > 0) {
|
|
789
|
-
selectedModel = await promptModelSelection(models);
|
|
790
|
-
}
|
|
791
|
-
// Clear all prompts
|
|
792
|
-
clearLinesIfNeeded(linesToClear);
|
|
793
|
-
// Create the agent (model included in request ā no separate PATCH needed)
|
|
794
|
-
const result = await createNewAgent(apiKey, selectedAgentType, agentName, metadata, features, orgId, orgName, promoCode, selectedModel);
|
|
795
|
-
return { ...result, model: selectedModel };
|
|
796
|
-
}
|
|
797
|
-
/**
|
|
798
|
-
* Check if user has access to a specific agent
|
|
799
|
-
*/
|
|
800
|
-
function checkUserHasAccessToAgent(userData, agentId) {
|
|
801
|
-
const orgs = userData.admin.orgs;
|
|
802
|
-
for (const org of orgs) {
|
|
803
|
-
const agent = org.agents.find((a) => a.agentId === agentId);
|
|
804
|
-
if (agent) {
|
|
805
|
-
return true;
|
|
806
|
-
}
|
|
807
|
-
}
|
|
808
|
-
return false;
|
|
809
|
-
}
|
|
810
|
-
/**
|
|
811
|
-
* Handle switching to a different agent
|
|
812
|
-
*/
|
|
813
|
-
async function handleAgentSwitch(userData, apiKey, existingYaml) {
|
|
814
|
-
writeInfo("\nš Let's switch to a different agent...\n");
|
|
815
|
-
const agentChoice = await promptAgentChoice();
|
|
816
|
-
let selectedAgent;
|
|
817
|
-
let selectedOrg;
|
|
818
|
-
let persona;
|
|
819
|
-
let serverModel;
|
|
820
|
-
let isNewAgent = false;
|
|
821
|
-
let selectedModel;
|
|
822
|
-
if (agentChoice === 'existing') {
|
|
823
|
-
const result = await selectExistingAgent(userData, apiKey);
|
|
824
|
-
selectedAgent = result.agent;
|
|
825
|
-
selectedOrg = result.org;
|
|
826
|
-
persona = result.persona;
|
|
827
|
-
serverModel = result.model;
|
|
828
|
-
// Use server model if present, else prompt
|
|
829
|
-
if (serverModel) {
|
|
830
|
-
selectedModel = serverModel;
|
|
831
|
-
}
|
|
832
|
-
else {
|
|
833
|
-
const models = await fetchApprovedModels(apiKey);
|
|
834
|
-
if (models.length > 0) {
|
|
835
|
-
selectedModel = await promptModelSelection(models);
|
|
836
|
-
}
|
|
837
|
-
}
|
|
838
|
-
}
|
|
839
|
-
else if (agentChoice === 'duplicate') {
|
|
840
|
-
const result = await duplicateAgentInteractive(apiKey, userData);
|
|
841
|
-
if (!result)
|
|
842
|
-
return; // user cancelled
|
|
843
|
-
selectedAgent = result.agent;
|
|
844
|
-
selectedOrg = result.org;
|
|
845
|
-
persona = result.persona;
|
|
846
|
-
selectedModel = result.model;
|
|
847
|
-
}
|
|
848
|
-
else {
|
|
849
|
-
const result = await createNewAgentFlow(apiKey, userData);
|
|
850
|
-
selectedAgent = result.agent;
|
|
851
|
-
selectedOrg = result.org;
|
|
852
|
-
persona = result.persona;
|
|
853
|
-
selectedModel = result.model;
|
|
854
|
-
isNewAgent = true;
|
|
855
|
-
displayPersonaInstructions();
|
|
856
|
-
}
|
|
857
|
-
// Ask about persona
|
|
858
|
-
const finalPersona = await promptPersonaReplacement(existingYaml, persona);
|
|
859
|
-
// Push model to server only for existing agents where the user explicitly changed it.
|
|
860
|
-
// New agents already have the model set in the create request ā no separate PATCH needed.
|
|
861
|
-
const userChoseModel = selectedModel && selectedModel !== serverModel;
|
|
862
|
-
if (userChoseModel && !isNewAgent) {
|
|
863
|
-
try {
|
|
864
|
-
writeProgress(`š¤ Setting model: ${selectedModel}...`);
|
|
865
|
-
await updateAgentModel(apiKey, selectedAgent.agentId, selectedModel);
|
|
866
|
-
writeProgress(`ā
Model set: ${selectedModel}`);
|
|
867
|
-
}
|
|
868
|
-
catch (error) {
|
|
869
|
-
writeInfo(`ā ļø Could not set model on server ā you can push it later with \`lua push agent\``);
|
|
870
|
-
}
|
|
871
|
-
}
|
|
872
|
-
// Update existing YAML file with new agent
|
|
873
|
-
writeInfo('\nš Updating lua.skill.yaml with new agent...');
|
|
874
|
-
updateYamlAgent(selectedAgent.agentId, selectedOrg.id);
|
|
875
|
-
const { updateAgentConfig } = await import('../compiler/index.js');
|
|
876
|
-
updateAgentConfig({ name: selectedAgent.name, persona: finalPersona, model: selectedModel }, { projectDir: process.cwd() });
|
|
877
|
-
writeSuccess('ā
lua.skill.yaml updated successfully!');
|
|
878
|
-
writeSuccess('ā
LuaAgent configuration updated!');
|
|
879
|
-
writeInfo("\nš” Your project now uses the new agent. Run 'lua compile' to update your skills.\n");
|
|
880
|
-
trackEvent('cli_init_agent_switched', { model_selected: !!selectedModel, model: selectedModel });
|
|
881
|
-
}
|
|
882
|
-
/**
|
|
883
|
-
* Prompt user about replacing existing persona
|
|
884
|
-
*/
|
|
885
|
-
async function promptPersonaReplacement(existingYaml, newPersona) {
|
|
886
|
-
const existingPersona = existingYaml?.agent?.persona;
|
|
887
|
-
// If no existing persona, use new one
|
|
888
|
-
if (!existingPersona) {
|
|
889
|
-
return newPersona;
|
|
890
|
-
}
|
|
891
|
-
// If no new persona, keep existing
|
|
892
|
-
if (!newPersona) {
|
|
893
|
-
return existingPersona;
|
|
894
|
-
}
|
|
895
|
-
// Both exist - ask user
|
|
896
|
-
writeInfo('\nš Persona Configuration:');
|
|
897
|
-
writeInfo(' Existing persona found in project');
|
|
898
|
-
const { replacePersona } = await inquirer.prompt([
|
|
899
|
-
{
|
|
900
|
-
type: 'confirm',
|
|
901
|
-
name: 'replacePersona',
|
|
902
|
-
message: "Replace existing persona with the new agent's persona?",
|
|
903
|
-
default: false,
|
|
904
|
-
},
|
|
905
|
-
]);
|
|
906
|
-
return replacePersona ? newPersona : existingPersona;
|
|
907
|
-
}
|
|
908
|
-
/**
|
|
909
|
-
* Check if canonical source exists for an agent and restore workspace files.
|
|
910
|
-
*
|
|
911
|
-
* @param apiKey - User's API key
|
|
912
|
-
* @param agentId - Agent ID to check source for
|
|
913
|
-
* @param options - Options for restoration (kept for interface compatibility)
|
|
914
|
-
* @param options.interactive - Unused; restore is non-interactive on fresh init
|
|
915
|
-
* @param options.autoRestore - Unused; restore always runs when source is found
|
|
916
|
-
* @returns True if sources were restored, false otherwise
|
|
917
|
-
*/
|
|
918
|
-
async function checkAndRestoreBackup(apiKey, agentId, options) {
|
|
919
|
-
const targetDir = process.cwd();
|
|
920
|
-
const { fetched: manifest } = await fetchBackupManifestForPull(apiKey, agentId);
|
|
921
|
-
if (!manifest) {
|
|
922
|
-
writeInfo(' No backup on file for this agent. Push your local sources with `lua push` to enable future restores.');
|
|
923
|
-
return false;
|
|
924
|
-
}
|
|
925
|
-
const conflicts = checkRestoreConflicts(manifest, targetDir);
|
|
926
|
-
if (!options.autoRestore && conflicts.existingFiles.length > 0) {
|
|
927
|
-
const { confirm } = await inquirer.prompt([
|
|
928
|
-
{
|
|
929
|
-
type: 'confirm',
|
|
930
|
-
name: 'confirm',
|
|
931
|
-
message: `Restoring will overwrite ${conflicts.existingFiles.length} existing file(s). Continue?`,
|
|
932
|
-
default: false,
|
|
933
|
-
},
|
|
934
|
-
]);
|
|
935
|
-
if (!confirm)
|
|
936
|
-
return false;
|
|
937
|
-
}
|
|
938
|
-
// Network/restore failures must not crash `lua init` ā keep the same
|
|
939
|
-
// graceful return-false posture the OLD restore flow had before the
|
|
940
|
-
// canonical-source pipeline was added. The user can retry, push fresh,
|
|
941
|
-
// or proceed with an empty workspace.
|
|
942
|
-
try {
|
|
943
|
-
const backupApi = new BackupApi(BASE_URLS.API, apiKey, agentId);
|
|
944
|
-
const urlsResponse = await backupApi.getBlobUrls(manifest.files.map((f) => f.hash));
|
|
945
|
-
if (!urlsResponse.success || !urlsResponse.data) {
|
|
946
|
-
writeError(`Failed to fetch download URLs: ${urlsResponse.error?.message ?? 'unknown error'}`);
|
|
947
|
-
return false;
|
|
948
|
-
}
|
|
949
|
-
const blobs = await downloadBlobsParallel(urlsResponse.data.urls);
|
|
950
|
-
restoreProjectFromBackup(manifest, blobs, targetDir, { overwrite: true });
|
|
951
|
-
}
|
|
952
|
-
catch (err) {
|
|
953
|
-
writeError(`Backup restore failed: ${err instanceof Error ? err.message : String(err)}. ` +
|
|
954
|
-
'Continuing with an empty workspace.');
|
|
955
|
-
return false;
|
|
956
|
-
}
|
|
957
|
-
// Phase 2 task 2.6: persist the restored manifest's projectHash and
|
|
958
|
-
// activeVersion into lua.skill.yaml so the next `lua push backup` (and
|
|
959
|
-
// the auto-backup hook) can detect cross-machine drift via CAS.
|
|
960
|
-
// Without this, a fresh-cloned workspace would always look "out of
|
|
961
|
-
// sync" relative to the server, and the V2 saveManifestV2 path would
|
|
962
|
-
// see no baseline activeVersion to compare against.
|
|
963
|
-
//
|
|
964
|
-
// restoreProjectFromBackup wrote `lua.skill.yaml` itself (it's part of
|
|
965
|
-
// the restored manifest), so re-read from disk before merging ā we
|
|
966
|
-
// don't want to clobber the just-restored agent block.
|
|
967
|
-
//
|
|
968
|
-
// targetDir == process.cwd() here (see top of this function); the
|
|
969
|
-
// existing read/write helpers always operate on cwd, so we don't need
|
|
970
|
-
// to thread a path through them.
|
|
971
|
-
try {
|
|
972
|
-
const restoredConfig = readYamlConfig();
|
|
973
|
-
if (restoredConfig) {
|
|
974
|
-
restoredConfig.backup = {
|
|
975
|
-
...(restoredConfig.backup ?? {}),
|
|
976
|
-
lastHash: manifest.projectHash,
|
|
977
|
-
lastPushedAt: manifest.createdAt,
|
|
978
|
-
};
|
|
979
|
-
if (typeof manifest.activeVersion === 'number') {
|
|
980
|
-
restoredConfig.backup.activeVersion = manifest.activeVersion;
|
|
981
|
-
}
|
|
982
|
-
writeYamlConfig(restoredConfig);
|
|
983
|
-
}
|
|
984
|
-
}
|
|
985
|
-
catch {
|
|
986
|
-
// Best-effort: a tracking-write failure must not undo a successful
|
|
987
|
-
// file restore. The next `lua push backup` will reconcile.
|
|
988
|
-
}
|
|
989
|
-
writeSuccess(`Restored ${manifest.files.length} files from backup`);
|
|
990
|
-
return true;
|
|
991
|
-
}
|
|
992
|
-
//# sourceMappingURL=init.js.map
|