lua-cli 2.2.8-alpha.1 → 2.3.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (191) hide show
  1. package/API_REFERENCE.md +1408 -0
  2. package/CLI_REFERENCE.md +818 -0
  3. package/GETTING_STARTED.md +1040 -0
  4. package/README.md +738 -424
  5. package/TEMPLATE_GUIDE.md +1398 -0
  6. package/dist/api/agent.api.service.d.ts +45 -0
  7. package/dist/api/agent.api.service.js +57 -0
  8. package/dist/api/auth.api.service.d.ts +48 -0
  9. package/dist/api/auth.api.service.js +54 -0
  10. package/dist/api/basket.api.service.d.ts +85 -0
  11. package/dist/api/basket.api.service.js +164 -0
  12. package/dist/api/chat.api.service.d.ts +21 -0
  13. package/dist/api/chat.api.service.js +24 -0
  14. package/dist/api/credentials.d.ts +24 -0
  15. package/dist/api/credentials.js +46 -0
  16. package/dist/api/custom.data.api.service.d.ts +69 -0
  17. package/dist/api/custom.data.api.service.js +125 -0
  18. package/dist/api/lazy-instances.d.ts +49 -0
  19. package/dist/api/lazy-instances.js +95 -0
  20. package/dist/api/order.api.service.d.ts +53 -0
  21. package/dist/api/order.api.service.js +95 -0
  22. package/dist/api/products.api.service.d.ts +66 -0
  23. package/dist/api/products.api.service.js +112 -0
  24. package/dist/api/skills.api.service.d.ts +77 -0
  25. package/dist/api/skills.api.service.js +88 -0
  26. package/dist/api/tool.api.service.d.ts +52 -0
  27. package/dist/api/tool.api.service.js +73 -0
  28. package/dist/api/user.data.api.service.d.ts +33 -0
  29. package/dist/api/user.data.api.service.js +59 -0
  30. package/dist/api-exports.d.ts +271 -0
  31. package/dist/api-exports.js +372 -0
  32. package/dist/cli/command-definitions.d.ts +30 -0
  33. package/dist/cli/command-definitions.js +71 -0
  34. package/dist/commands/agents.d.ts +20 -0
  35. package/dist/commands/agents.js +24 -2
  36. package/dist/commands/apiKey.d.ts +23 -0
  37. package/dist/commands/apiKey.js +23 -0
  38. package/dist/commands/compile.d.ts +24 -0
  39. package/dist/commands/compile.js +67 -759
  40. package/dist/commands/configure.d.ts +24 -0
  41. package/dist/commands/configure.js +31 -96
  42. package/dist/commands/deploy.d.ts +31 -19
  43. package/dist/commands/deploy.js +45 -74
  44. package/dist/commands/destroy.d.ts +27 -0
  45. package/dist/commands/destroy.js +27 -1
  46. package/dist/commands/dev.d.ts +25 -62
  47. package/dist/commands/dev.js +58 -873
  48. package/dist/commands/init.d.ts +27 -0
  49. package/dist/commands/init.js +98 -260
  50. package/dist/commands/push.d.ts +24 -21
  51. package/dist/commands/push.js +39 -92
  52. package/dist/commands/test.d.ts +26 -0
  53. package/dist/commands/test.js +41 -188
  54. package/dist/common/basket.instance.d.ts +78 -0
  55. package/dist/common/basket.instance.js +132 -0
  56. package/dist/common/data.entry.instance.d.ts +39 -0
  57. package/dist/common/data.entry.instance.js +76 -0
  58. package/dist/common/http.client.d.ts +64 -0
  59. package/dist/common/http.client.js +133 -0
  60. package/dist/common/order.instance.d.ts +40 -0
  61. package/dist/common/order.instance.js +79 -0
  62. package/dist/common/product.instance.d.ts +33 -0
  63. package/dist/common/product.instance.js +63 -0
  64. package/dist/common/product.pagination.instance.d.ts +43 -0
  65. package/dist/common/product.pagination.instance.js +74 -0
  66. package/dist/common/product.search.instance.d.ts +22 -0
  67. package/dist/common/product.search.instance.js +40 -0
  68. package/dist/common/user.instance.d.ts +41 -0
  69. package/dist/common/user.instance.js +84 -0
  70. package/dist/config/auth.constants.d.ts +11 -0
  71. package/dist/config/auth.constants.js +11 -0
  72. package/dist/config/compile.constants.d.ts +67 -0
  73. package/dist/config/compile.constants.js +99 -0
  74. package/dist/config/constants.d.ts +5 -0
  75. package/dist/config/constants.js +5 -0
  76. package/dist/config/dev.constants.d.ts +65 -0
  77. package/dist/config/dev.constants.js +79 -0
  78. package/dist/config/init.constants.d.ts +23 -0
  79. package/dist/config/init.constants.js +41 -0
  80. package/dist/index.d.ts +19 -3
  81. package/dist/index.js +28 -44
  82. package/dist/interfaces/admin.d.ts +101 -0
  83. package/dist/interfaces/admin.js +5 -0
  84. package/dist/interfaces/agent.d.ts +107 -0
  85. package/dist/interfaces/agent.js +5 -0
  86. package/dist/interfaces/baskets.d.ts +135 -0
  87. package/dist/interfaces/baskets.js +19 -0
  88. package/dist/interfaces/chat.d.ts +61 -0
  89. package/dist/interfaces/chat.js +5 -0
  90. package/dist/interfaces/common.d.ts +62 -0
  91. package/dist/interfaces/common.js +8 -0
  92. package/dist/interfaces/compile.d.ts +11 -0
  93. package/dist/interfaces/compile.js +4 -0
  94. package/dist/interfaces/custom.data.d.ts +82 -0
  95. package/dist/interfaces/custom.data.js +5 -0
  96. package/dist/interfaces/deploy.d.ts +29 -0
  97. package/dist/interfaces/deploy.js +4 -0
  98. package/dist/interfaces/dev.d.ts +53 -0
  99. package/dist/interfaces/dev.js +5 -0
  100. package/dist/interfaces/init.d.ts +60 -0
  101. package/dist/interfaces/init.js +4 -0
  102. package/dist/interfaces/orders.d.ts +91 -0
  103. package/dist/interfaces/orders.js +19 -0
  104. package/dist/interfaces/product.d.ts +65 -0
  105. package/dist/interfaces/product.js +5 -0
  106. package/dist/interfaces/push.d.ts +26 -0
  107. package/dist/interfaces/push.js +4 -0
  108. package/dist/interfaces/test.d.ts +36 -0
  109. package/dist/interfaces/test.js +4 -0
  110. package/dist/services/auth.d.ts +54 -99
  111. package/dist/services/auth.js +76 -12
  112. package/dist/types/api-contracts.d.ts +211 -0
  113. package/dist/types/api-contracts.js +8 -0
  114. package/dist/types/compile.types.d.ts +76 -0
  115. package/dist/types/compile.types.js +4 -0
  116. package/dist/types/index.d.ts +23 -85
  117. package/dist/types/index.js +25 -14
  118. package/dist/types/skill.d.ts +142 -0
  119. package/dist/{skill.js → types/skill.js} +66 -19
  120. package/dist/types/tool-validation.d.ts +34 -0
  121. package/dist/types/tool-validation.js +42 -0
  122. package/dist/utils/auth-flows.d.ts +26 -0
  123. package/dist/utils/auth-flows.js +141 -0
  124. package/dist/utils/bundling.d.ts +36 -0
  125. package/dist/utils/bundling.js +137 -0
  126. package/dist/utils/compile.d.ts +37 -0
  127. package/dist/utils/compile.js +242 -0
  128. package/dist/utils/deploy-api.d.ts +26 -0
  129. package/dist/utils/deploy-api.js +53 -0
  130. package/dist/utils/deploy-helpers.d.ts +46 -0
  131. package/dist/utils/deploy-helpers.js +86 -0
  132. package/dist/utils/deployment.d.ts +25 -0
  133. package/dist/utils/deployment.js +161 -0
  134. package/dist/utils/dev-api.d.ts +61 -0
  135. package/dist/utils/dev-api.js +262 -0
  136. package/dist/utils/dev-helpers.d.ts +46 -0
  137. package/dist/utils/dev-helpers.js +83 -0
  138. package/dist/utils/dev-server.d.ts +24 -0
  139. package/dist/utils/dev-server.js +555 -0
  140. package/dist/utils/dev-watcher.d.ts +31 -0
  141. package/dist/utils/dev-watcher.js +110 -0
  142. package/dist/utils/files.js +0 -5
  143. package/dist/utils/init-agent.d.ts +34 -0
  144. package/dist/utils/init-agent.js +129 -0
  145. package/dist/utils/init-helpers.d.ts +41 -0
  146. package/dist/utils/init-helpers.js +73 -0
  147. package/dist/utils/init-prompts.d.ts +47 -0
  148. package/dist/utils/init-prompts.js +168 -0
  149. package/dist/utils/push-api.d.ts +15 -0
  150. package/dist/utils/push-api.js +48 -0
  151. package/dist/utils/push-helpers.d.ts +38 -0
  152. package/dist/utils/push-helpers.js +84 -0
  153. package/dist/utils/sandbox-storage.d.ts +27 -0
  154. package/dist/utils/sandbox-storage.js +71 -0
  155. package/dist/utils/sandbox.js +78 -118
  156. package/dist/utils/skill-management.d.ts +14 -0
  157. package/dist/utils/skill-management.js +148 -0
  158. package/dist/utils/test-helpers.d.ts +40 -0
  159. package/dist/utils/test-helpers.js +92 -0
  160. package/dist/utils/test-prompts.d.ts +23 -0
  161. package/dist/utils/test-prompts.js +186 -0
  162. package/dist/utils/tool-detection.d.ts +18 -0
  163. package/dist/utils/tool-detection.js +110 -0
  164. package/dist/web/app.css +14 -9
  165. package/package.json +11 -12
  166. package/template/QUICKSTART.md +299 -144
  167. package/template/README.md +928 -349
  168. package/template/TOOL_EXAMPLES.md +655 -0
  169. package/template/package-lock.json +3781 -0
  170. package/template/package.json +1 -1
  171. package/template/src/index.ts +81 -40
  172. package/template/src/tools/BasketTool.ts +128 -0
  173. package/template/src/tools/CustomDataTool.ts +7 -13
  174. package/template/src/tools/OrderTool.ts +54 -0
  175. package/template/src/tools/PaymentTool.ts +1 -1
  176. package/template/src/tools/ProductsTool.ts +56 -118
  177. package/template/src/tools/UserDataTool.ts +4 -27
  178. package/dist/custom-data-api.d.ts +0 -72
  179. package/dist/custom-data-api.js +0 -174
  180. package/dist/product-api.d.ts +0 -197
  181. package/dist/product-api.js +0 -152
  182. package/dist/services/api.d.ts +0 -569
  183. package/dist/services/api.js +0 -625
  184. package/dist/skill.d.ts +0 -50
  185. package/dist/types.d.ts +0 -1
  186. package/dist/types.js +0 -2
  187. package/dist/user-data-api.d.ts +0 -39
  188. package/dist/user-data-api.js +0 -50
  189. package/template/API.md +0 -604
  190. package/template/DEVELOPER.md +0 -771
  191. package/template/lua.skill.yaml +0 -16
@@ -49,11 +49,6 @@ function updatePackageJson(srcPath, destPath) {
49
49
  }
50
50
  catch (error) {
51
51
  // If we can't read any package.json, use the fallback version
52
- // console.log(`Using fallback CLI version: ${currentCliVersion}`);
53
- }
54
- // Update the lua-cli dependency version
55
- if (templatePackageJson.dependencies && templatePackageJson.dependencies['lua-cli']) {
56
- // templatePackageJson.dependencies['lua-cli'] = `^${currentCliVersion}`;
57
52
  }
58
53
  // Write the updated package.json
59
54
  fs.writeFileSync(destPath, JSON.stringify(templatePackageJson, null, 2) + '\n');
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Init Agent Management Utilities
3
+ * Handles agent type selection, creation, and retrieval
4
+ */
5
+ import { AgentType } from '../interfaces/agent.js';
6
+ import { AgentCreationResult, BusinessConfig } from '../interfaces/init.js';
7
+ /**
8
+ * Fetches available agent types from the API.
9
+ *
10
+ * @param apiKey - User's API key
11
+ * @returns Array of available agent types
12
+ */
13
+ export declare function fetchAgentTypes(apiKey: string): Promise<AgentType[]>;
14
+ /**
15
+ * Selects the Base Agent type from available types.
16
+ * Falls back to first available type if Base Agent is not found.
17
+ *
18
+ * @param agentTypes - Array of available agent types
19
+ * @returns Selected agent type
20
+ * @throws Error if no agent types are available
21
+ */
22
+ export declare function selectBaseAgentType(agentTypes: AgentType[]): AgentType;
23
+ /**
24
+ * Creates a new agent with the provided configuration.
25
+ *
26
+ * @param apiKey - User's API key
27
+ * @param agentType - Selected agent type
28
+ * @param businessConfig - Business configuration
29
+ * @param metadata - Agent metadata
30
+ * @param features - Feature configuration
31
+ * @returns Agent creation result with agent and org details
32
+ * @throws Error if agent creation fails
33
+ */
34
+ export declare function createNewAgent(apiKey: string, agentType: AgentType, businessConfig: BusinessConfig, metadata: Record<string, any>, features: Record<string, boolean>): Promise<AgentCreationResult>;
@@ -0,0 +1,129 @@
1
+ /**
2
+ * Init Agent Management Utilities
3
+ * Handles agent type selection, creation, and retrieval
4
+ */
5
+ import AgentApi from '../api/agent.api.service.js';
6
+ import { BASE_URLS } from '../config/constants.js';
7
+ import { writeProgress } from './cli.js';
8
+ import { AGENT_READY_WAIT_TIME, PREFERRED_AGENT_TYPES, } from '../config/init.constants.js';
9
+ /**
10
+ * Fetches available agent types from the API.
11
+ *
12
+ * @param apiKey - User's API key
13
+ * @returns Array of available agent types
14
+ */
15
+ export async function fetchAgentTypes(apiKey) {
16
+ writeProgress("🔄 Fetching agent types...");
17
+ const agentApi = new AgentApi(BASE_URLS.API, apiKey);
18
+ const agentTypesResult = await agentApi.getAgentTypes();
19
+ const agentTypes = agentTypesResult.success ? agentTypesResult.data || [] : [];
20
+ writeProgress("✅ Agent types loaded");
21
+ return agentTypes;
22
+ }
23
+ /**
24
+ * Selects the Base Agent type from available types.
25
+ * Falls back to first available type if Base Agent is not found.
26
+ *
27
+ * @param agentTypes - Array of available agent types
28
+ * @returns Selected agent type
29
+ * @throws Error if no agent types are available
30
+ */
31
+ export function selectBaseAgentType(agentTypes) {
32
+ // Try to find Base Agent by preferred names
33
+ let selectedAgentType = agentTypes.find((type) => PREFERRED_AGENT_TYPES.some(name => type.name === name || type.name.toLowerCase().includes(name.toLowerCase())));
34
+ // If not found, use the first available type
35
+ if (!selectedAgentType && agentTypes.length > 0) {
36
+ selectedAgentType = agentTypes[0];
37
+ writeProgress(`⚠️ baseAgent not found, using ${selectedAgentType.name} instead`);
38
+ }
39
+ if (!selectedAgentType) {
40
+ throw new Error("No agent types available. Please contact support.");
41
+ }
42
+ writeProgress(`✅ Using agent type: ${selectedAgentType.name}`);
43
+ return selectedAgentType;
44
+ }
45
+ /**
46
+ * Creates a new agent with the provided configuration.
47
+ *
48
+ * @param apiKey - User's API key
49
+ * @param agentType - Selected agent type
50
+ * @param businessConfig - Business configuration
51
+ * @param metadata - Agent metadata
52
+ * @param features - Feature configuration
53
+ * @returns Agent creation result with agent and org details
54
+ * @throws Error if agent creation fails
55
+ */
56
+ export async function createNewAgent(apiKey, agentType, businessConfig, metadata, features) {
57
+ writeProgress("🔄 Creating agent...");
58
+ const agentData = {
59
+ id: `agent_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
60
+ type: agentType.id,
61
+ metadata,
62
+ persona: {
63
+ agentName: businessConfig.agentName,
64
+ businessType: businessConfig.businessType,
65
+ brandPersonality: businessConfig.brandPersonality,
66
+ brandTraits: businessConfig.brandTraits
67
+ },
68
+ features,
69
+ channels: [],
70
+ org: {
71
+ registeredName: businessConfig.businessName
72
+ }
73
+ };
74
+ const agentApi = new AgentApi(BASE_URLS.API, apiKey);
75
+ const createAgentResult = await agentApi.createAgent(agentData);
76
+ if (!createAgentResult.success || !createAgentResult.data) {
77
+ throw new Error(createAgentResult.error?.message || "Failed to create agent");
78
+ }
79
+ writeProgress("✅ Agent created successfully!");
80
+ // Wait for agent to be ready
81
+ await waitForAgentReady();
82
+ // Validate required fields from API response
83
+ const agentId = createAgentResult.data?.data?.agentId;
84
+ const agentName = createAgentResult.data?.data?.name;
85
+ const orgId = createAgentResult.data?.data?.org?.id;
86
+ if (!agentId || !agentName || !orgId) {
87
+ throw new Error("Failed to create agent: Missing required fields in API response");
88
+ }
89
+ // Fetch agent details
90
+ const agentDetails = await fetchAgentDetails(agentApi, agentId);
91
+ return {
92
+ agent: {
93
+ agentId,
94
+ name: agentName
95
+ },
96
+ org: {
97
+ id: orgId
98
+ },
99
+ persona: agentDetails.persona,
100
+ welcomeMessage: agentDetails.welcomeMessage
101
+ };
102
+ }
103
+ /**
104
+ * Waits for the agent to be ready after creation.
105
+ */
106
+ async function waitForAgentReady() {
107
+ writeProgress("⏳ Waiting for agent to be ready...");
108
+ await new Promise(resolve => setTimeout(resolve, AGENT_READY_WAIT_TIME));
109
+ }
110
+ /**
111
+ * Fetches detailed agent information.
112
+ *
113
+ * @param agentApi - Agent API instance
114
+ * @param agentId - Agent ID to fetch
115
+ * @returns Agent details including persona and welcome message
116
+ * @throws Error if fetch fails
117
+ */
118
+ async function fetchAgentDetails(agentApi, agentId) {
119
+ writeProgress("🔄 Fetching agent details...");
120
+ const agentDetailsResult = await agentApi.getAgent(agentId);
121
+ if (!agentDetailsResult.success || !agentDetailsResult.data) {
122
+ throw new Error(agentDetailsResult.error?.message || "Failed to fetch agent details");
123
+ }
124
+ writeProgress("✅ Agent details loaded");
125
+ return {
126
+ persona: agentDetailsResult.data.persona,
127
+ welcomeMessage: agentDetailsResult.data.welcomeMessage
128
+ };
129
+ }
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Init Helper Utilities
3
+ * Helper functions for initialization process
4
+ */
5
+ /**
6
+ * Gets the template directory path.
7
+ *
8
+ * @returns Absolute path to template directory
9
+ */
10
+ export declare function getTemplateDir(): string;
11
+ /**
12
+ * Initializes the project by copying template files and creating YAML.
13
+ *
14
+ * @param agentId - Agent ID for configuration
15
+ * @param orgId - Organization ID for configuration
16
+ * @param persona - Optional persona configuration
17
+ * @param welcomeMessage - Optional welcome message
18
+ * @returns Current working directory
19
+ */
20
+ export declare function initializeProject(agentId: string, orgId: string, persona?: string, welcomeMessage?: string): string;
21
+ /**
22
+ * Installs npm dependencies for the project.
23
+ *
24
+ * @param projectDir - Directory to install dependencies in
25
+ */
26
+ export declare function installDependencies(projectDir: string): Promise<void>;
27
+ /**
28
+ * Counts total prompt lines to clear.
29
+ * This is a helper for managing terminal output cleanup.
30
+ *
31
+ * @param baseCount - Base number of lines
32
+ * @param additionalLines - Additional lines to add
33
+ * @returns Total line count
34
+ */
35
+ export declare function calculatePromptLines(baseCount: number, additionalLines: number): number;
36
+ /**
37
+ * Clears terminal lines if count is greater than zero.
38
+ *
39
+ * @param lineCount - Number of lines to clear
40
+ */
41
+ export declare function clearLinesIfNeeded(lineCount: number): void;
@@ -0,0 +1,73 @@
1
+ /**
2
+ * Init Helper Utilities
3
+ * Helper functions for initialization process
4
+ */
5
+ import { fileURLToPath } from "url";
6
+ import path from "path";
7
+ import { copyTemplateFiles, createSkillYaml } from "./files.js";
8
+ import { clearPromptLines, writeProgress } from "./cli.js";
9
+ import { execSync } from 'child_process';
10
+ /**
11
+ * Gets the template directory path.
12
+ *
13
+ * @returns Absolute path to template directory
14
+ */
15
+ export function getTemplateDir() {
16
+ const __filename = fileURLToPath(import.meta.url);
17
+ const __dirname = path.dirname(__filename);
18
+ return path.join(__dirname, "..", "..", "template");
19
+ }
20
+ /**
21
+ * Initializes the project by copying template files and creating YAML.
22
+ *
23
+ * @param agentId - Agent ID for configuration
24
+ * @param orgId - Organization ID for configuration
25
+ * @param persona - Optional persona configuration
26
+ * @param welcomeMessage - Optional welcome message
27
+ * @returns Current working directory
28
+ */
29
+ export function initializeProject(agentId, orgId, persona, welcomeMessage) {
30
+ const templateDir = getTemplateDir();
31
+ const currentDir = process.cwd();
32
+ copyTemplateFiles(templateDir, currentDir);
33
+ createSkillYaml(agentId, orgId, undefined, undefined, persona, welcomeMessage);
34
+ writeProgress("✅ Created lua.skill.yaml");
35
+ writeProgress("✅ Copied template files");
36
+ return currentDir;
37
+ }
38
+ /**
39
+ * Installs npm dependencies for the project.
40
+ *
41
+ * @param projectDir - Directory to install dependencies in
42
+ */
43
+ export async function installDependencies(projectDir) {
44
+ writeProgress("📦 Installing dependencies...");
45
+ try {
46
+ execSync('npm install --force', { stdio: 'inherit', cwd: projectDir });
47
+ writeProgress("✅ Dependencies installed successfully");
48
+ }
49
+ catch (error) {
50
+ writeProgress("⚠️ Warning: Failed to install dependencies automatically. Please run 'npm install' manually.");
51
+ }
52
+ }
53
+ /**
54
+ * Counts total prompt lines to clear.
55
+ * This is a helper for managing terminal output cleanup.
56
+ *
57
+ * @param baseCount - Base number of lines
58
+ * @param additionalLines - Additional lines to add
59
+ * @returns Total line count
60
+ */
61
+ export function calculatePromptLines(baseCount, additionalLines) {
62
+ return baseCount + additionalLines;
63
+ }
64
+ /**
65
+ * Clears terminal lines if count is greater than zero.
66
+ *
67
+ * @param lineCount - Number of lines to clear
68
+ */
69
+ export function clearLinesIfNeeded(lineCount) {
70
+ if (lineCount > 0) {
71
+ clearPromptLines(lineCount);
72
+ }
73
+ }
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Init Command Prompt Utilities
3
+ * Handles all interactive prompts for agent initialization
4
+ */
5
+ import { AgentChoiceType, SelectedAgent, SelectedOrg, OrganizationData, BusinessConfig } from '../interfaces/init.js';
6
+ import { AgentType } from '../interfaces/agent.js';
7
+ /**
8
+ * Prompts user to choose between existing or new agent.
9
+ *
10
+ * @returns Selected choice ('existing' or 'create')
11
+ */
12
+ export declare function promptAgentChoice(): Promise<AgentChoiceType>;
13
+ /**
14
+ * Prompts user to select an organization from available options.
15
+ *
16
+ * @param orgs - Array of organizations to choose from
17
+ * @returns Selected organization
18
+ */
19
+ export declare function promptOrganizationSelection(orgs: OrganizationData[]): Promise<SelectedOrg>;
20
+ /**
21
+ * Prompts user to select an agent from an organization.
22
+ *
23
+ * @param org - Organization containing agents
24
+ * @returns Selected agent
25
+ */
26
+ export declare function promptAgentSelection(org: SelectedOrg): Promise<SelectedAgent>;
27
+ /**
28
+ * Prompts for metadata fields required by the agent type.
29
+ *
30
+ * @param requiredFields - Array of required metadata field names
31
+ * @returns Object containing collected metadata
32
+ */
33
+ export declare function promptMetadataCollection(requiredFields: string[]): Promise<Record<string, any>>;
34
+ /**
35
+ * Prompts for feature configuration.
36
+ *
37
+ * @param agentType - Agent type containing available features
38
+ * @returns Object containing feature enable/disable status
39
+ */
40
+ export declare function promptFeatureConfiguration(agentType: AgentType): Promise<Record<string, boolean>>;
41
+ /**
42
+ * Prompts for business and agent configuration.
43
+ * Collects business name, agent name, type, personality, and traits.
44
+ *
45
+ * @returns Complete business configuration
46
+ */
47
+ export declare function promptBusinessConfiguration(): Promise<BusinessConfig>;
@@ -0,0 +1,168 @@
1
+ /**
2
+ * Init Command Prompt Utilities
3
+ * Handles all interactive prompts for agent initialization
4
+ */
5
+ import inquirer from "inquirer";
6
+ import { BUSINESS_TYPES, BRAND_PERSONALITIES, DEFAULT_BUSINESS_NAME, } from '../config/init.constants.js';
7
+ /**
8
+ * Prompts user to choose between existing or new agent.
9
+ *
10
+ * @returns Selected choice ('existing' or 'create')
11
+ */
12
+ export async function promptAgentChoice() {
13
+ const { agentChoice } = await inquirer.prompt([
14
+ {
15
+ type: "list",
16
+ name: "agentChoice",
17
+ message: "What would you like to do?",
18
+ choices: [
19
+ { name: "Select existing agent", value: "existing" },
20
+ { name: "Create new agent", value: "create" }
21
+ ]
22
+ }
23
+ ]);
24
+ return agentChoice;
25
+ }
26
+ /**
27
+ * Prompts user to select an organization from available options.
28
+ *
29
+ * @param orgs - Array of organizations to choose from
30
+ * @returns Selected organization
31
+ */
32
+ export async function promptOrganizationSelection(orgs) {
33
+ const orgChoices = orgs.map((org) => ({
34
+ name: org.registeredName || org.name || 'Unknown Organization',
35
+ value: org
36
+ }));
37
+ const { selectedOrg } = await inquirer.prompt([
38
+ {
39
+ type: "list",
40
+ name: "selectedOrg",
41
+ message: "Select an organization:",
42
+ choices: orgChoices
43
+ }
44
+ ]);
45
+ return selectedOrg;
46
+ }
47
+ /**
48
+ * Prompts user to select an agent from an organization.
49
+ *
50
+ * @param org - Organization containing agents
51
+ * @returns Selected agent
52
+ */
53
+ export async function promptAgentSelection(org) {
54
+ if (!org.agents || org.agents.length === 0) {
55
+ throw new Error("No agents found in the selected organization.");
56
+ }
57
+ const agentChoices = org.agents.map((agent) => ({
58
+ name: agent.name,
59
+ value: agent
60
+ }));
61
+ const { selectedAgent } = await inquirer.prompt([
62
+ {
63
+ type: "list",
64
+ name: "selectedAgent",
65
+ message: "Select an agent:",
66
+ choices: agentChoices
67
+ }
68
+ ]);
69
+ return selectedAgent;
70
+ }
71
+ /**
72
+ * Prompts for metadata fields required by the agent type.
73
+ *
74
+ * @param requiredFields - Array of required metadata field names
75
+ * @returns Object containing collected metadata
76
+ */
77
+ export async function promptMetadataCollection(requiredFields) {
78
+ const metadata = {};
79
+ for (const field of requiredFields) {
80
+ const { [field]: value } = await inquirer.prompt([
81
+ {
82
+ type: "input",
83
+ name: field,
84
+ message: `Enter ${field}:`,
85
+ validate: (input) => input.trim().length > 0 || `${field} is required`
86
+ }
87
+ ]);
88
+ metadata[field] = value;
89
+ }
90
+ return metadata;
91
+ }
92
+ /**
93
+ * Prompts for feature configuration.
94
+ *
95
+ * @param agentType - Agent type containing available features
96
+ * @returns Object containing feature enable/disable status
97
+ */
98
+ export async function promptFeatureConfiguration(agentType) {
99
+ const features = {};
100
+ const availableFeatures = Object.keys(agentType.features);
101
+ for (const feature of availableFeatures) {
102
+ const { [feature]: enabled } = await inquirer.prompt([
103
+ {
104
+ type: "confirm",
105
+ name: feature,
106
+ message: `Enable ${feature} feature?`,
107
+ default: agentType.features[feature]?.active || false
108
+ }
109
+ ]);
110
+ features[feature] = enabled;
111
+ }
112
+ return features;
113
+ }
114
+ /**
115
+ * Prompts for business and agent configuration.
116
+ * Collects business name, agent name, type, personality, and traits.
117
+ *
118
+ * @returns Complete business configuration
119
+ */
120
+ export async function promptBusinessConfiguration() {
121
+ const { businessName } = await inquirer.prompt([
122
+ {
123
+ type: "input",
124
+ name: "businessName",
125
+ message: "Enter business name:",
126
+ default: DEFAULT_BUSINESS_NAME
127
+ }
128
+ ]);
129
+ const { agentName } = await inquirer.prompt([
130
+ {
131
+ type: "input",
132
+ name: "agentName",
133
+ message: "Enter agent name:",
134
+ validate: (input) => input.trim().length > 0 || "Agent name is required"
135
+ }
136
+ ]);
137
+ const { businessType } = await inquirer.prompt([
138
+ {
139
+ type: "list",
140
+ name: "businessType",
141
+ message: "Select business type:",
142
+ choices: BUSINESS_TYPES
143
+ }
144
+ ]);
145
+ const { brandPersonality } = await inquirer.prompt([
146
+ {
147
+ type: "list",
148
+ name: "brandPersonality",
149
+ message: "Select brand personality:",
150
+ choices: BRAND_PERSONALITIES
151
+ }
152
+ ]);
153
+ const { brandTraits } = await inquirer.prompt([
154
+ {
155
+ type: "input",
156
+ name: "brandTraits",
157
+ message: "Enter brand traits (any traits the agent might have):",
158
+ default: ""
159
+ }
160
+ ]);
161
+ return {
162
+ businessName,
163
+ agentName,
164
+ businessType,
165
+ brandPersonality,
166
+ brandTraits
167
+ };
168
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Push API Utilities
3
+ * Handles API calls for pushing skill versions
4
+ */
5
+ import { PushVersionResponse } from '../interfaces/push.js';
6
+ /**
7
+ * Pushes a skill version to the server.
8
+ *
9
+ * @param apiKey - User's API key
10
+ * @param agentId - Agent ID
11
+ * @param skillId - Skill ID
12
+ * @param versionData - Version data to push
13
+ * @returns Push version response
14
+ */
15
+ export declare function pushVersion(apiKey: string, agentId: string, skillId: string, versionData: any): Promise<PushVersionResponse>;
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Push API Utilities
3
+ * Handles API calls for pushing skill versions
4
+ */
5
+ import SkillApi from '../api/skills.api.service.js';
6
+ import { BASE_URLS } from '../config/constants.js';
7
+ /**
8
+ * Pushes a skill version to the server.
9
+ *
10
+ * @param apiKey - User's API key
11
+ * @param agentId - Agent ID
12
+ * @param skillId - Skill ID
13
+ * @param versionData - Version data to push
14
+ * @returns Push version response
15
+ */
16
+ export async function pushVersion(apiKey, agentId, skillId, versionData) {
17
+ try {
18
+ const skillApi = new SkillApi(BASE_URLS.API, apiKey, agentId);
19
+ const response = await skillApi.pushSkill(skillId, versionData);
20
+ if (response.success) {
21
+ return {
22
+ success: true,
23
+ data: response.data
24
+ };
25
+ }
26
+ else {
27
+ return {
28
+ success: false,
29
+ error: {
30
+ message: response.error?.message || 'Unknown error',
31
+ error: response.error?.message || 'Unknown error',
32
+ statusCode: response.error?.statusCode || 500
33
+ }
34
+ };
35
+ }
36
+ }
37
+ catch (error) {
38
+ console.error("❌ Error pushing version:", error);
39
+ return {
40
+ success: false,
41
+ error: {
42
+ message: "Network error",
43
+ error: "Failed to connect to server",
44
+ statusCode: 500
45
+ }
46
+ };
47
+ }
48
+ }
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Push Helper Utilities
3
+ * Helper functions for the push command
4
+ */
5
+ /**
6
+ * Reads the version from skill configuration.
7
+ *
8
+ * @returns Version string or null if not found
9
+ */
10
+ export declare function readConfigVersion(): string | null;
11
+ /**
12
+ * Reads and parses deploy.json file.
13
+ *
14
+ * @returns Parsed deploy data or null if not found
15
+ */
16
+ export declare function readDeployJson(): any | null;
17
+ /**
18
+ * Prompts user to confirm version push.
19
+ *
20
+ * @param version - Version to push
21
+ * @returns True if confirmed, false otherwise
22
+ */
23
+ export declare function confirmVersionPush(version: string): Promise<boolean>;
24
+ /**
25
+ * Validates that configuration has required fields for push.
26
+ *
27
+ * @param config - Skill configuration
28
+ * @throws Error if configuration is invalid
29
+ */
30
+ export declare function validatePushConfig(config: any): void;
31
+ /**
32
+ * Validates that deploy data matches configuration.
33
+ *
34
+ * @param deployData - Deploy data from deploy.json
35
+ * @param configVersion - Version from configuration
36
+ * @throws Error if deploy data is invalid or version mismatch
37
+ */
38
+ export declare function validateDeployData(deployData: any, configVersion: string): void;