lua-cli 3.1.0-alpha.3 → 3.1.0-alpha.5

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.
Files changed (125) hide show
  1. package/README.md +0 -4
  2. package/dist/api/cdn.api.service.d.ts +18 -0
  3. package/dist/api/cdn.api.service.js +43 -0
  4. package/dist/api/custom.data.api.service.d.ts +4 -3
  5. package/dist/api/custom.data.api.service.js +4 -3
  6. package/dist/api/developer.api.service.d.ts +54 -1
  7. package/dist/api/developer.api.service.js +89 -0
  8. package/dist/api/job.api.service.d.ts +33 -100
  9. package/dist/api/job.api.service.js +27 -11
  10. package/dist/api/lazy-instances.d.ts +16 -0
  11. package/dist/api/lazy-instances.js +32 -0
  12. package/dist/api/postprocessor.api.service.d.ts +3 -13
  13. package/dist/api/postprocessor.api.service.js +2 -4
  14. package/dist/api/preprocessor.api.service.d.ts +1 -8
  15. package/dist/api/preprocessor.api.service.js +1 -2
  16. package/dist/api/webhook.api.service.d.ts +1 -3
  17. package/dist/api/webhook.api.service.js +1 -1
  18. package/dist/api/whatsapp-templates.api.service.d.ts +40 -0
  19. package/dist/api/whatsapp-templates.api.service.js +78 -0
  20. package/dist/api-exports.d.ts +153 -6
  21. package/dist/api-exports.js +177 -21
  22. package/dist/cli/command-definitions.js +34 -7
  23. package/dist/commands/admin.js +1 -1
  24. package/dist/commands/channels.js +1 -1
  25. package/dist/commands/chat.js +2 -4
  26. package/dist/commands/compile.js +23 -4
  27. package/dist/commands/evals.d.ts +8 -0
  28. package/dist/commands/evals.js +41 -0
  29. package/dist/commands/index.d.ts +2 -0
  30. package/dist/commands/index.js +2 -0
  31. package/dist/commands/init.d.ts +10 -1
  32. package/dist/commands/init.js +23 -46
  33. package/dist/commands/jobs.js +5 -5
  34. package/dist/commands/mcp.d.ts +18 -0
  35. package/dist/commands/mcp.js +393 -0
  36. package/dist/commands/push.js +174 -23
  37. package/dist/common/data.entry.instance.d.ts +1 -1
  38. package/dist/common/data.entry.instance.js +4 -4
  39. package/dist/common/job.instance.d.ts +59 -7
  40. package/dist/common/job.instance.js +84 -19
  41. package/dist/config/constants.d.ts +1 -0
  42. package/dist/config/constants.js +1 -0
  43. package/dist/index.js +1 -0
  44. package/dist/interfaces/agent.d.ts +0 -3
  45. package/dist/interfaces/cdn.d.ts +24 -0
  46. package/dist/interfaces/cdn.js +5 -0
  47. package/dist/interfaces/compile.d.ts +1 -0
  48. package/dist/interfaces/custom.data.d.ts +3 -3
  49. package/dist/interfaces/index.d.ts +2 -1
  50. package/dist/interfaces/init.d.ts +0 -1
  51. package/dist/interfaces/jobs.d.ts +88 -132
  52. package/dist/interfaces/jobs.js +1 -1
  53. package/dist/interfaces/mcp.d.ts +64 -0
  54. package/dist/interfaces/mcp.js +5 -0
  55. package/dist/interfaces/postprocessors.d.ts +0 -3
  56. package/dist/interfaces/preprocessors.d.ts +0 -3
  57. package/dist/interfaces/webhooks.d.ts +0 -5
  58. package/dist/interfaces/whatsapp-templates.d.ts +104 -0
  59. package/dist/interfaces/whatsapp-templates.js +5 -0
  60. package/dist/types/api-contracts.d.ts +68 -14
  61. package/dist/types/compile.types.d.ts +5 -6
  62. package/dist/types/index.d.ts +2 -2
  63. package/dist/types/index.js +3 -1
  64. package/dist/types/skill.d.ts +181 -103
  65. package/dist/types/skill.js +123 -91
  66. package/dist/utils/agent-management.d.ts +3 -5
  67. package/dist/utils/agent-management.js +6 -8
  68. package/dist/utils/bundling.d.ts +4 -11
  69. package/dist/utils/bundling.js +24 -33
  70. package/dist/utils/compile.d.ts +17 -9
  71. package/dist/utils/compile.js +72 -88
  72. package/dist/utils/deployment.js +13 -7
  73. package/dist/utils/dev-api.js +1 -4
  74. package/dist/utils/dev-server.js +1 -1
  75. package/dist/utils/files.d.ts +11 -4
  76. package/dist/utils/files.js +17 -14
  77. package/dist/utils/init-agent.d.ts +1 -2
  78. package/dist/utils/init-agent.js +4 -6
  79. package/dist/utils/init-helpers.d.ts +4 -4
  80. package/dist/utils/init-helpers.js +10 -11
  81. package/dist/utils/job-management.js +0 -2
  82. package/dist/utils/mcp-server-management.d.ts +23 -0
  83. package/dist/utils/mcp-server-management.js +212 -0
  84. package/dist/utils/postprocessor-management.js +2 -4
  85. package/dist/utils/preprocessor-management.js +2 -4
  86. package/dist/utils/sandbox.d.ts +4 -2
  87. package/dist/utils/sandbox.js +38 -9
  88. package/dist/utils/webhook-management.js +1 -3
  89. package/dist/web/app.css +1505 -14
  90. package/dist/web/app.js +79 -64
  91. package/package.json +2 -6
  92. package/template/QUICKSTART.md +57 -774
  93. package/template/README.md +80 -907
  94. package/template/examples/README.md +106 -0
  95. package/template/{src → examples}/jobs/AbandonedBasketProcessorJob.ts +67 -14
  96. package/template/{src → examples}/jobs/DailyCleanupJob.ts +0 -3
  97. package/template/{src → examples}/jobs/DataMigrationJob.ts +0 -3
  98. package/template/{src → examples}/jobs/HealthCheckJob.ts +0 -3
  99. package/template/{src → examples}/postprocessors/modifyResponse.ts +3 -4
  100. package/template/examples/preprocessors/messageMatching.ts +35 -0
  101. package/template/{src → examples}/skills/basket.skill.ts +0 -1
  102. package/template/{src → examples}/skills/product.skill.ts +0 -1
  103. package/template/{src → examples}/skills/tools/GameScoreTrackerTool.ts +11 -15
  104. package/template/{src → examples}/skills/tools/OrderTool.ts +25 -0
  105. package/template/examples/skills/tools/PremiumFeatureTool.ts +98 -0
  106. package/template/{src → examples}/skills/tools/UserDataTool.ts +34 -0
  107. package/template/{src → examples}/skills/user.skill.ts +0 -1
  108. package/template/examples/webhooks/FileUploadWebhook.ts +86 -0
  109. package/template/{src → examples}/webhooks/PaymentWebhook.ts +12 -9
  110. package/template/examples/webhooks/UserEventWebhook.ts +105 -0
  111. package/template/package-lock.json +7895 -0
  112. package/template/package.json +1 -1
  113. package/template/src/index.ts +40 -22
  114. package/template/src/preprocessors/messageMatching.ts +0 -22
  115. package/template/src/webhooks/UserEventWebhook.ts +0 -77
  116. /package/template/{src → examples}/services/ApiService.ts +0 -0
  117. /package/template/{src → examples}/services/GetWeather.ts +0 -0
  118. /package/template/{src → examples}/skills/tools/BasketTool.ts +0 -0
  119. /package/template/{src → examples}/skills/tools/CreateInlineJob.ts +0 -0
  120. /package/template/{src → examples}/skills/tools/CreatePostTool.ts +0 -0
  121. /package/template/{src → examples}/skills/tools/CustomDataTool.ts +0 -0
  122. /package/template/{src → examples}/skills/tools/GetWeatherTool.ts +0 -0
  123. /package/template/{src → examples}/skills/tools/PaymentTool.ts +0 -0
  124. /package/template/{src → examples}/skills/tools/ProductsTool.ts +0 -0
  125. /package/template/{src → examples}/skills/tools/SmartBasketTool.ts +0 -0
@@ -16,6 +16,7 @@ import { fetchVersions, publishVersion, } from '../utils/deploy-api.js';
16
16
  import { BASE_URLS } from '../config/constants.js';
17
17
  import PreProcessorApi from '../api/preprocessor.api.service.js';
18
18
  import PostProcessorApi from '../api/postprocessor.api.service.js';
19
+ import DeveloperApi from '../api/developer.api.service.js';
19
20
  /**
20
21
  * Main push command - pushes a skill or persona version to the server.
21
22
  *
@@ -57,8 +58,8 @@ export async function pushCommand(type, cmdObj) {
57
58
  // Step 1: Check if type was provided as argument
58
59
  if (type) {
59
60
  // Validate the provided type
60
- if (type !== 'skill' && type !== 'persona' && type !== 'webhook' && type !== 'job' && type !== 'preprocessor' && type !== 'postprocessor') {
61
- console.error(`❌ Invalid type: "${type}". Must be "skill", "persona", "webhook", "job", "preprocessor", "postprocessor", or "all".`);
61
+ if (type !== 'skill' && type !== 'persona' && type !== 'webhook' && type !== 'job' && type !== 'preprocessor' && type !== 'postprocessor' && type !== 'mcp') {
62
+ console.error(`❌ Invalid type: "${type}". Must be "skill", "persona", "webhook", "job", "preprocessor", "postprocessor", "mcp", or "all".`);
62
63
  console.log('\nUsage:');
63
64
  console.log(' lua push - Interactive selection');
64
65
  console.log(' lua push skill - Push a skill directly');
@@ -67,6 +68,7 @@ export async function pushCommand(type, cmdObj) {
67
68
  console.log(' lua push job - Push a job directly');
68
69
  console.log(' lua push preprocessor - Push a preprocessor directly');
69
70
  console.log(' lua push postprocessor - Push a postprocessor directly');
71
+ console.log(' lua push mcp - Push an MCP server directly');
70
72
  console.log(' lua push all --force - Push all components without prompts');
71
73
  process.exit(1);
72
74
  }
@@ -85,6 +87,7 @@ export async function pushCommand(type, cmdObj) {
85
87
  { name: '⏰ Job', value: 'job' },
86
88
  { name: '📥 PreProcessor', value: 'preprocessor' },
87
89
  { name: '📤 PostProcessor', value: 'postprocessor' },
90
+ { name: '🔌 MCP Server', value: 'mcp' },
88
91
  { name: '🌙 Persona', value: 'persona' }
89
92
  ]
90
93
  }
@@ -111,6 +114,9 @@ export async function pushCommand(type, cmdObj) {
111
114
  else if (selectedType === 'postprocessor') {
112
115
  await pushPostProcessorVersion();
113
116
  }
117
+ else if (selectedType === 'mcp') {
118
+ await pushMCPServerVersion();
119
+ }
114
120
  else {
115
121
  await pushPersonaVersion();
116
122
  }
@@ -133,8 +139,9 @@ export async function pushCommand(type, cmdObj) {
133
139
  */
134
140
  async function pushSkillVersion() {
135
141
  // Step 1: Validate configuration
136
- const config = readSkillConfig();
137
- validatePushConfig(config);
142
+ const yamlConfig = readSkillConfig();
143
+ validatePushConfig(yamlConfig);
144
+ const config = yamlConfig;
138
145
  // Step 2: Get available skills and prompt for selection
139
146
  const availableSkills = getAvailableSkills(config);
140
147
  if (availableSkills.length === 0) {
@@ -434,7 +441,6 @@ async function pushWebhookVersion() {
434
441
  name: selectedWebhook.name,
435
442
  version: versionToPush,
436
443
  description: bundledWebhookData.description || selectedWebhook.description || `Webhook: ${selectedWebhook.name}`,
437
- context: bundledWebhookData.context || selectedWebhook.context || '',
438
444
  webhookId: selectedWebhook.webhookId,
439
445
  querySchema: bundledWebhookData.querySchema,
440
446
  headerSchema: bundledWebhookData.headerSchema,
@@ -459,7 +465,8 @@ async function pushWebhookVersion() {
459
465
  }
460
466
  const result = await response.json();
461
467
  writeSuccess(`\n✅ Successfully pushed ${selectedWebhook.name} v${versionToPush}\n`);
462
- writeInfo(`📦 Webhook URL: ${BASE_URLS.WEBHOOK}/${config.agent.agentId}/${selectedWebhook.webhookId}`);
468
+ writeInfo(`📦 Webhook URL (id): ${BASE_URLS.WEBHOOK}/${config.agent.agentId}/${selectedWebhook.webhookId}`);
469
+ writeInfo(`🔗 Webhook URL (name): ${BASE_URLS.WEBHOOK}/${config.agent.agentId}/${selectedWebhook.name}`);
463
470
  // Step 8: Ask if user wants to deploy now
464
471
  const deployAnswer = await safePrompt([
465
472
  {
@@ -633,7 +640,6 @@ async function pushJobVersion() {
633
640
  name: selectedJob.name,
634
641
  version: versionToPush,
635
642
  description: bundledJobData.description || selectedJob.description || `Job: ${selectedJob.name}`,
636
- context: bundledJobData.context || selectedJob.context || '',
637
643
  jobId: selectedJob.jobId,
638
644
  schedule: bundledJobData.schedule || selectedJob.schedule,
639
645
  timeout: bundledJobData.timeout,
@@ -780,7 +786,6 @@ async function pushPreProcessorVersion() {
780
786
  name: selected.name,
781
787
  version: confirmedVersion,
782
788
  description: bundledData.description || selected.description,
783
- context: bundledData.context || selected.context,
784
789
  preprocessorId: selected.preprocessorId,
785
790
  code: bundledData.code,
786
791
  executeFunction: bundledData.executeFunction,
@@ -912,11 +917,9 @@ async function pushPostProcessorVersion() {
912
917
  name: selected.name,
913
918
  version: confirmedVersion,
914
919
  description: bundledData.description || selected.description,
915
- context: bundledData.context || selected.context,
916
920
  postprocessorId: selected.postprocessorId,
917
921
  code: bundledData.code,
918
- executeFunction: bundledData.executeFunction,
919
- async: Boolean(bundledData.async ?? false) // Ensure boolean type
922
+ executeFunction: bundledData.executeFunction
920
923
  };
921
924
  writeProgress(`\n🚀 Pushing ${selected.name} v${confirmedVersion}...`);
922
925
  const api = new PostProcessorApi(BASE_URLS.API, apiKey, config.agent.agentId);
@@ -1004,6 +1007,120 @@ function updateProcessorVersionInYaml(processorType, processorName, newVersion)
1004
1007
  console.warn('⚠️ Could not update processor version in YAML:', error);
1005
1008
  }
1006
1009
  }
1010
+ /**
1011
+ * Push MCP Server to the server
1012
+ */
1013
+ async function pushMCPServerVersion() {
1014
+ try {
1015
+ // Step 1: Run compilation
1016
+ writeProgress("📦 Compiling project...");
1017
+ await compileCommand();
1018
+ writeSuccess("✅ Compilation complete");
1019
+ // Step 2: Authenticate
1020
+ const apiKey = await loadApiKey();
1021
+ if (!apiKey) {
1022
+ console.error("❌ No API key found. Please run 'lua auth configure' to set up your API key.");
1023
+ process.exit(1);
1024
+ }
1025
+ await checkApiKey(apiKey);
1026
+ writeSuccess("✅ Authentication verified");
1027
+ // Step 3: Read configuration
1028
+ const config = readSkillConfig();
1029
+ if (!config?.agent?.agentId) {
1030
+ console.error("❌ No agent ID found in lua.skill.yaml. Please run 'lua init' first.");
1031
+ process.exit(1);
1032
+ }
1033
+ const mcpServers = config.mcpServers || [];
1034
+ if (mcpServers.length === 0) {
1035
+ console.error("❌ No MCP servers found in lua.skill.yaml.");
1036
+ console.log("💡 Make sure you have defined MCP servers in your LuaAgent configuration.");
1037
+ process.exit(1);
1038
+ }
1039
+ // Step 4: Load bundled MCP server data first (has full config)
1040
+ const bundledServersPath = path.join(process.cwd(), 'dist', 'mcp-servers.json');
1041
+ let bundledServers = [];
1042
+ if (fs.existsSync(bundledServersPath)) {
1043
+ bundledServers = JSON.parse(fs.readFileSync(bundledServersPath, 'utf8'));
1044
+ }
1045
+ else {
1046
+ console.error('❌ Bundled MCP server data not found.');
1047
+ console.log("💡 Please ensure your MCP servers are properly compiled.");
1048
+ process.exit(1);
1049
+ }
1050
+ // Step 5: Select MCP server to push (use bundled data for display, YAML for ID tracking)
1051
+ const serverAnswer = await safePrompt([
1052
+ {
1053
+ type: 'list',
1054
+ name: 'selectedServer',
1055
+ message: 'Select an MCP server to push:',
1056
+ choices: bundledServers.map((server) => {
1057
+ const yamlEntry = mcpServers.find((s) => s.name === server.name);
1058
+ return {
1059
+ name: `${server.name} (${server.transport})`,
1060
+ value: { ...server, mcpServerId: yamlEntry?.mcpServerId }
1061
+ };
1062
+ })
1063
+ }
1064
+ ]);
1065
+ if (!serverAnswer) {
1066
+ console.log("Push cancelled.");
1067
+ return;
1068
+ }
1069
+ const selectedServer = serverAnswer.selectedServer;
1070
+ const bundledServerData = selectedServer;
1071
+ // Step 6: Prepare server data for push
1072
+ const serverData = {
1073
+ name: bundledServerData.name,
1074
+ transport: bundledServerData.transport,
1075
+ timeout: bundledServerData.timeout,
1076
+ ...(bundledServerData.transport === 'stdio' ? {
1077
+ command: bundledServerData.command,
1078
+ args: bundledServerData.args,
1079
+ env: bundledServerData.env
1080
+ } : {
1081
+ url: bundledServerData.url,
1082
+ headers: bundledServerData.headers
1083
+ })
1084
+ };
1085
+ // Step 7: Push to server (upsert)
1086
+ writeProgress(`\n🚀 Pushing MCP server "${selectedServer.name}" to server...`);
1087
+ const developerApi = new DeveloperApi(BASE_URLS.API, apiKey, config.agent.agentId);
1088
+ const result = await developerApi.upsertMCPServer(serverData);
1089
+ if (result.success && result.data) {
1090
+ writeSuccess(`\n✅ MCP server "${selectedServer.name}" pushed successfully\n`);
1091
+ // Ask if user wants to activate now
1092
+ const activateAnswer = await safePrompt([
1093
+ {
1094
+ type: 'confirm',
1095
+ name: 'activateNow',
1096
+ message: 'Would you like to activate this MCP server now?',
1097
+ default: false
1098
+ }
1099
+ ]);
1100
+ if (activateAnswer && activateAnswer.activateNow) {
1101
+ writeProgress("🔄 Activating MCP server...");
1102
+ const activateResult = await developerApi.activateMCPServer(result.data.id);
1103
+ if (activateResult.success) {
1104
+ writeSuccess(`\n✅ MCP server "${selectedServer.name}" activated successfully\n`);
1105
+ writeInfo("💡 The server's tools are now available to your agent.");
1106
+ }
1107
+ else {
1108
+ console.error(`❌ Failed to activate: ${activateResult.error?.message}`);
1109
+ }
1110
+ }
1111
+ else {
1112
+ writeInfo("💡 You can activate this server later using: lua mcp activate");
1113
+ }
1114
+ }
1115
+ else {
1116
+ console.error(`❌ Failed to push: ${result.error?.message}`);
1117
+ }
1118
+ }
1119
+ catch (error) {
1120
+ console.error('❌ Error pushing MCP server:', error);
1121
+ process.exit(1);
1122
+ }
1123
+ }
1007
1124
  /**
1008
1125
  * Deploy a version immediately after pushing
1009
1126
  */
@@ -1192,8 +1309,7 @@ async function pushAllCommand(options) {
1192
1309
  const pushData = {
1193
1310
  name: webhookConfig.name,
1194
1311
  version: newVersion,
1195
- description: webhookData.description || webhookConfig.description || '',
1196
- context: webhookData.context || webhookConfig.context || '',
1312
+ description: webhookData.description || '',
1197
1313
  webhookId: webhookConfig.webhookId,
1198
1314
  querySchema: webhookData.querySchema,
1199
1315
  headerSchema: webhookData.headerSchema,
@@ -1253,15 +1369,14 @@ async function pushAllCommand(options) {
1253
1369
  const pushData = {
1254
1370
  name: jobConfig.name,
1255
1371
  version: newVersion,
1256
- description: jobData.description || jobConfig.description || '',
1257
- context: jobData.context || jobConfig.context || '',
1372
+ description: jobData.description || '',
1258
1373
  jobId: jobConfig.jobId,
1259
1374
  schedule: jobData.schedule || jobConfig.schedule,
1260
1375
  timeout: jobData.timeout,
1261
1376
  retry: jobData.retry,
1262
1377
  code: jobData.code,
1263
1378
  executeFunction: jobData.executeFunction,
1264
- metadata: jobData.metadata || jobConfig.metadata
1379
+ metadata: jobData.metadata
1265
1380
  };
1266
1381
  // Push version using fetch
1267
1382
  const response = await fetch(`${BASE_URLS.API}/developer/jobs/${agentId}/${jobConfig.jobId}/version`, {
@@ -1318,8 +1433,7 @@ async function pushAllCommand(options) {
1318
1433
  const versionData = {
1319
1434
  name: processorConfig.name,
1320
1435
  version: newVersion,
1321
- description: processorData.description || processorConfig.description || '',
1322
- context: processorData.context || processorConfig.context || '',
1436
+ description: processorData.description || '',
1323
1437
  preprocessorId: preprocessorId,
1324
1438
  code: processorData.code,
1325
1439
  executeFunction: processorData.executeFunction,
@@ -1373,12 +1487,10 @@ async function pushAllCommand(options) {
1373
1487
  const versionData = {
1374
1488
  name: processorConfig.name,
1375
1489
  version: newVersion,
1376
- description: processorData.description || processorConfig.description || '',
1377
- context: processorData.context || processorConfig.context || '',
1490
+ description: processorData.description || '',
1378
1491
  postprocessorId: postprocessorId,
1379
1492
  code: processorData.code,
1380
- executeFunction: processorData.executeFunction,
1381
- async: Boolean(processorData.async ?? false)
1493
+ executeFunction: processorData.executeFunction
1382
1494
  };
1383
1495
  // Push version
1384
1496
  const result = await postprocessorService.pushPostProcessor(postprocessorId, versionData);
@@ -1399,7 +1511,46 @@ async function pushAllCommand(options) {
1399
1511
  }
1400
1512
  }
1401
1513
  }
1402
- // Step 9: Deploy all components if autoDeploy is enabled
1514
+ // Step 9: Push MCP server configurations
1515
+ const mcpServersJsonPath = path.join(process.cwd(), 'dist', 'mcp-servers.json');
1516
+ if (fs.existsSync(mcpServersJsonPath)) {
1517
+ const mcpServers = JSON.parse(fs.readFileSync(mcpServersJsonPath, 'utf8'));
1518
+ if (mcpServers.length > 0) {
1519
+ writeProgress(`\n🔌 Pushing ${mcpServers.length} MCP server(s)...`);
1520
+ try {
1521
+ const DeveloperApi = (await import('../api/developer.api.service.js')).default;
1522
+ const developerApi = new DeveloperApi(BASE_URLS.API, apiKey, agentId);
1523
+ for (const serverConfig of mcpServers) {
1524
+ try {
1525
+ // Upsert the MCP server (create or update by name)
1526
+ const result = await developerApi.upsertMCPServer(serverConfig);
1527
+ if (result.success && result.data) {
1528
+ const mcpServerId = result.data.id;
1529
+ const isActive = result.data.active;
1530
+ writeSuccess(` ✅ ${serverConfig.name} (${serverConfig.transport}) - ${isActive ? 'active' : 'inactive'}`);
1531
+ // Auto-activate if autoDeploy is enabled
1532
+ if (options.autoDeploy && !isActive) {
1533
+ const activateResult = await developerApi.activateMCPServer(mcpServerId);
1534
+ if (activateResult.success) {
1535
+ writeSuccess(` 🔌 Auto-activated`);
1536
+ }
1537
+ }
1538
+ }
1539
+ else {
1540
+ console.error(` ❌ Failed to push ${serverConfig.name}:`, result.error?.message);
1541
+ }
1542
+ }
1543
+ catch (error) {
1544
+ console.error(` ❌ Failed to push ${serverConfig.name}:`, error.message);
1545
+ }
1546
+ }
1547
+ }
1548
+ catch (error) {
1549
+ console.error(` ❌ Failed to push MCP servers:`, error.message);
1550
+ }
1551
+ }
1552
+ }
1553
+ // Step 10: Deploy all components if autoDeploy is enabled
1403
1554
  if (options.autoDeploy && (toDeploySkills.length > 0 || toDeployWebhooks.length > 0 || toDeployJobs.length > 0 || toDeployPreprocessors.length > 0 || toDeployPostprocessors.length > 0)) {
1404
1555
  writeProgress('\n🚀 Deploying all pushed versions to production...');
1405
1556
  writeInfo('⏱️ Waiting for server to process versions (5 seconds)...\n');
@@ -32,7 +32,7 @@ export default class DataEntryInstance {
32
32
  * @returns Promise resolving to the updated data
33
33
  * @throws Error if the update fails
34
34
  */
35
- update(data: Record<string, any>, searchText?: string): Promise<any>;
35
+ update(data: Record<string, any>, searchText?: string): Promise<Record<string, any>>;
36
36
  /**
37
37
  * Deletes the custom data entry
38
38
  * @returns Promise resolving to true if deletion was successful
@@ -122,12 +122,12 @@ export default class DataEntryInstance {
122
122
  */
123
123
  async update(data, searchText) {
124
124
  try {
125
- const response = await this.customDataAPI.update(this.collectionName, this.id, { data, searchText });
125
+ await this.customDataAPI.update(this.collectionName, this.id, data, searchText);
126
126
  this.data = { ...this.data, ...data };
127
127
  return this.data;
128
128
  }
129
129
  catch (error) {
130
- throw new Error('Failed to update user data');
130
+ throw new Error('Failed to update custom data entry');
131
131
  }
132
132
  }
133
133
  /**
@@ -141,7 +141,7 @@ export default class DataEntryInstance {
141
141
  return true;
142
142
  }
143
143
  catch (error) {
144
- throw new Error('Failed to clear user data');
144
+ throw new Error('Failed to delete custom data entry');
145
145
  }
146
146
  }
147
147
  /**
@@ -152,7 +152,7 @@ export default class DataEntryInstance {
152
152
  */
153
153
  async save(searchText) {
154
154
  try {
155
- await this.customDataAPI.update(this.collectionName, this.id, { data: this.data, searchText: searchText });
155
+ await this.customDataAPI.update(this.collectionName, this.id, this.data, searchText);
156
156
  return true;
157
157
  }
158
158
  catch (error) {
@@ -4,6 +4,7 @@
4
4
  */
5
5
  import JobApi from '../api/job.api.service.js';
6
6
  import UserDataInstance from './user.instance.js';
7
+ import { Job, JobVersion, JobExecution } from '../interfaces/jobs.js';
7
8
  /**
8
9
  * Job Instance class.
9
10
  * Represents a single job with helper methods for common operations.
@@ -36,15 +37,15 @@ export declare class JobInstance {
36
37
  private _data;
37
38
  readonly id: string;
38
39
  readonly name: string;
39
- readonly jobId: string;
40
- readonly schedule: any;
40
+ /** The active version of the job (if one exists) */
41
+ readonly activeVersion?: JobVersion;
41
42
  metadata: Record<string, any>;
42
- private userApi;
43
- constructor(jobApi: JobApi, jobData: any);
43
+ private userApi?;
44
+ constructor(jobApi: JobApi, jobData: Job);
44
45
  /**
45
46
  * Gets the full job data.
46
47
  */
47
- get data(): any;
48
+ get data(): Job;
48
49
  /**
49
50
  * Updates the job's metadata.
50
51
  *
@@ -61,7 +62,7 @@ export declare class JobInstance {
61
62
  */
62
63
  updateMetadata(metadata: Record<string, any>): Promise<void>;
63
64
  /**
64
- * Deletes the job from the backend.
65
+ * Deletes the job from the backend (or deactivates if it has versions).
65
66
  *
66
67
  * @returns Promise resolving when deletion is complete
67
68
  *
@@ -72,9 +73,60 @@ export declare class JobInstance {
72
73
  * ```
73
74
  */
74
75
  delete(): Promise<void>;
76
+ /**
77
+ * Gets the user data associated with this job's agent.
78
+ * Provides access to user information and custom data storage.
79
+ *
80
+ * @returns Promise resolving to UserDataInstance with user information
81
+ *
82
+ * @example
83
+ * ```typescript
84
+ * const user = await job.user();
85
+ * console.log('User email:', user.email);
86
+ * console.log('User data:', user.data);
87
+ * ```
88
+ */
75
89
  user(): Promise<UserDataInstance>;
90
+ /**
91
+ * Manually triggers the job execution (ignores schedule).
92
+ * Uses activeVersion by default.
93
+ *
94
+ * @param versionId - Optional version to execute (defaults to activeVersion)
95
+ * @returns Promise resolving to execution result
96
+ *
97
+ * @example
98
+ * ```typescript
99
+ * const result = await job.trigger();
100
+ * console.log('Execution result:', result);
101
+ * ```
102
+ */
103
+ trigger(versionId?: string): Promise<JobExecution>;
104
+ /**
105
+ * Activates the job, enabling it to run on schedule.
106
+ *
107
+ * @returns Promise resolving to updated JobInstance
108
+ *
109
+ * @example
110
+ * ```typescript
111
+ * await job.activate();
112
+ * console.log('Job is now active');
113
+ * ```
114
+ */
115
+ activate(): Promise<JobInstance>;
116
+ /**
117
+ * Deactivates the job, preventing it from running on schedule.
118
+ *
119
+ * @returns Promise resolving to updated JobInstance
120
+ *
121
+ * @example
122
+ * ```typescript
123
+ * await job.deactivate();
124
+ * console.log('Job is now inactive');
125
+ * ```
126
+ */
127
+ deactivate(): Promise<JobInstance>;
76
128
  /**
77
129
  * Converts the job instance to JSON.
78
130
  */
79
- toJSON(): any;
131
+ toJSON(): Job;
80
132
  }
@@ -35,12 +35,13 @@ export class JobInstance {
35
35
  constructor(jobApi, jobData) {
36
36
  this.jobApi = jobApi;
37
37
  this._data = jobData;
38
- this.id = jobData.id || jobData.jobId;
39
- this.jobId = jobData.id || jobData.jobId;
38
+ this.id = jobData.id;
40
39
  this.name = jobData.name;
41
- this.schedule = jobData.schedule;
40
+ this.activeVersion = jobData.activeVersion;
42
41
  this.metadata = jobData.metadata || {};
43
- this.userApi = new UserDataApi(BASE_URLS.API, jobApi.apiKey, jobApi.agentId);
42
+ if (jobData.userId && jobData.agentId) {
43
+ this.userApi = new UserDataApi(BASE_URLS.API, jobApi.apiKey, jobApi.agentId);
44
+ }
44
45
  }
45
46
  /**
46
47
  * Gets the full job data.
@@ -64,19 +65,13 @@ export class JobInstance {
64
65
  */
65
66
  async updateMetadata(metadata) {
66
67
  this.metadata = { ...this.metadata, ...metadata };
67
- const result = await this.jobApi.updateMetadata(this.jobId, this.metadata);
68
+ const result = await this.jobApi.updateMetadata(this.id, this.metadata);
68
69
  if (!result.success) {
69
70
  throw new Error(result.error?.message || 'Failed to update job metadata');
70
71
  }
71
- return result.data;
72
- // Update metadata on the server if the job has versions
73
- // Note: Metadata updates may require updating the active version
74
- // For now, we just update the local instance
75
- // In the future, this could call an API endpoint to update job metadata
76
- console.warn('Note: Job metadata updates are stored locally. Deploy a new version to persist changes.');
77
72
  }
78
73
  /**
79
- * Deletes the job from the backend.
74
+ * Deletes the job from the backend (or deactivates if it has versions).
80
75
  *
81
76
  * @returns Promise resolving when deletion is complete
82
77
  *
@@ -87,28 +82,98 @@ export class JobInstance {
87
82
  * ```
88
83
  */
89
84
  async delete() {
90
- const result = await this.jobApi.deleteJob(this.jobId);
85
+ const result = await this.jobApi.deleteJob(this.id);
91
86
  if (!result.success) {
92
87
  throw new Error(result.error?.message || 'Failed to delete job');
93
88
  }
94
- if (result.data?.deactivated) {
95
- console.warn(`Job "${this.name}" has versions and was deactivated instead of deleted.`);
96
- }
97
89
  }
90
+ /**
91
+ * Gets the user data associated with this job's agent.
92
+ * Provides access to user information and custom data storage.
93
+ *
94
+ * @returns Promise resolving to UserDataInstance with user information
95
+ *
96
+ * @example
97
+ * ```typescript
98
+ * const user = await job.user();
99
+ * console.log('User email:', user.email);
100
+ * console.log('User data:', user.data);
101
+ * ```
102
+ */
98
103
  async user() {
104
+ if (!this.userApi) {
105
+ throw new Error('User API not initialized');
106
+ }
99
107
  return await this.userApi.get();
100
108
  }
109
+ /**
110
+ * Manually triggers the job execution (ignores schedule).
111
+ * Uses activeVersion by default.
112
+ *
113
+ * @param versionId - Optional version to execute (defaults to activeVersion)
114
+ * @returns Promise resolving to execution result
115
+ *
116
+ * @example
117
+ * ```typescript
118
+ * const result = await job.trigger();
119
+ * console.log('Execution result:', result);
120
+ * ```
121
+ */
122
+ async trigger(versionId) {
123
+ const result = await this.jobApi.triggerJob(this.id, versionId || this.activeVersion?.id);
124
+ if (!result.success || !result.data) {
125
+ throw new Error(result.error?.message || 'Failed to trigger job');
126
+ }
127
+ return result.data;
128
+ }
129
+ /**
130
+ * Activates the job, enabling it to run on schedule.
131
+ *
132
+ * @returns Promise resolving to updated JobInstance
133
+ *
134
+ * @example
135
+ * ```typescript
136
+ * await job.activate();
137
+ * console.log('Job is now active');
138
+ * ```
139
+ */
140
+ async activate() {
141
+ const result = await this.jobApi.activateJob(this.id);
142
+ if (!result.success || !result.data) {
143
+ throw new Error(result.error?.message || 'Failed to activate job');
144
+ }
145
+ this._data = result.data;
146
+ return this;
147
+ }
148
+ /**
149
+ * Deactivates the job, preventing it from running on schedule.
150
+ *
151
+ * @returns Promise resolving to updated JobInstance
152
+ *
153
+ * @example
154
+ * ```typescript
155
+ * await job.deactivate();
156
+ * console.log('Job is now inactive');
157
+ * ```
158
+ */
159
+ async deactivate() {
160
+ const result = await this.jobApi.deactivateJob(this.id);
161
+ if (!result.success || !result.data) {
162
+ throw new Error(result.error?.message || 'Failed to deactivate job');
163
+ }
164
+ this._data = result.data;
165
+ return this;
166
+ }
101
167
  /**
102
168
  * Converts the job instance to JSON.
103
169
  */
104
170
  toJSON() {
105
171
  return {
172
+ ...this._data,
106
173
  id: this.id,
107
- jobId: this.jobId,
108
174
  name: this.name,
109
- schedule: this.schedule,
175
+ activeVersion: this.activeVersion,
110
176
  metadata: this.metadata,
111
- ...this._data
112
177
  };
113
178
  }
114
179
  }
@@ -9,4 +9,5 @@ export declare const BASE_URLS: {
9
9
  readonly AUTH: "https://auth.heylua.ai";
10
10
  readonly CHAT: "https://api.heylua.ai";
11
11
  readonly WEBHOOK: "https://webhook.heylua.ai";
12
+ readonly CDN: "https://cdn.heylua.ai";
12
13
  };
@@ -15,4 +15,5 @@ export const BASE_URLS = {
15
15
  AUTH: 'https://auth.heylua.ai',
16
16
  CHAT: 'https://api.heylua.ai',
17
17
  WEBHOOK: 'https://webhook.heylua.ai',
18
+ CDN: 'https://cdn.heylua.ai',
18
19
  };
package/dist/index.js CHANGED
@@ -61,6 +61,7 @@ Examples:
61
61
  $ lua skills production ⚙️ Manage production skills directly
62
62
  $ lua features 🎯 Manage agent features
63
63
  $ lua admin 🔧 Open admin dashboard
64
+ $ lua evals 📊 Open evaluations dashboard
64
65
  $ lua docs 📖 Open documentation
65
66
  $ lua completion 🎯 Enable shell autocomplete
66
67
  $ lua marketplace 🛍️ Interact with the Lua Marketplace
@@ -10,7 +10,6 @@ export interface Agent {
10
10
  id: string;
11
11
  name: string;
12
12
  persona?: string;
13
- welcomeMessage?: string;
14
13
  featuresOverride?: Record<string, any>;
15
14
  }
16
15
  /**
@@ -52,7 +51,6 @@ export interface CreateAgentResponse {
52
51
  baseAgentId: string;
53
52
  persona: string;
54
53
  createdAt: string;
55
- welcomeMessage: string;
56
54
  featuresOverride: Record<string, any>;
57
55
  _id: string;
58
56
  updatedAt: string;
@@ -78,7 +76,6 @@ export interface AgentDetailsResponse {
78
76
  baseAgentId: string;
79
77
  persona: string;
80
78
  createdAt: string;
81
- welcomeMessage: string;
82
79
  featuresOverride: Record<string, any>;
83
80
  updatedAt: string;
84
81
  __v: number;