@nestbox-ai/cli 1.0.23 → 1.0.25

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 (61) hide show
  1. package/dist/commands/agent/apiUtils.d.ts +10 -0
  2. package/dist/commands/agent/apiUtils.js +20 -0
  3. package/dist/commands/agent/apiUtils.js.map +1 -0
  4. package/dist/commands/agent/create.d.ts +29 -0
  5. package/dist/commands/agent/create.js +88 -0
  6. package/dist/commands/agent/create.js.map +1 -0
  7. package/dist/commands/agent/createFromYaml.d.ts +2 -0
  8. package/dist/commands/agent/createFromYaml.js +172 -0
  9. package/dist/commands/agent/createFromYaml.js.map +1 -0
  10. package/dist/commands/agent/deploy.d.ts +2 -0
  11. package/dist/commands/agent/deploy.js +243 -0
  12. package/dist/commands/agent/deploy.js.map +1 -0
  13. package/dist/commands/agent/generate.d.ts +2 -0
  14. package/dist/commands/agent/generate.js +141 -0
  15. package/dist/commands/agent/generate.js.map +1 -0
  16. package/dist/commands/agent/index.d.ts +7 -0
  17. package/dist/commands/agent/index.js +21 -0
  18. package/dist/commands/agent/index.js.map +1 -0
  19. package/dist/commands/agent/list.d.ts +2 -0
  20. package/dist/commands/agent/list.js +94 -0
  21. package/dist/commands/agent/list.js.map +1 -0
  22. package/dist/commands/agent/remove.d.ts +2 -0
  23. package/dist/commands/agent/remove.js +85 -0
  24. package/dist/commands/agent/remove.js.map +1 -0
  25. package/dist/commands/agent.d.ts +4 -0
  26. package/dist/commands/agent.js +16 -731
  27. package/dist/commands/agent.js.map +1 -1
  28. package/dist/commands/compute/apiUtils.d.ts +11 -0
  29. package/dist/commands/compute/apiUtils.js +22 -0
  30. package/dist/commands/compute/apiUtils.js.map +1 -0
  31. package/dist/commands/compute/create.d.ts +2 -0
  32. package/dist/commands/compute/create.js +183 -0
  33. package/dist/commands/compute/create.js.map +1 -0
  34. package/dist/commands/compute/delete.d.ts +2 -0
  35. package/dist/commands/compute/delete.js +145 -0
  36. package/dist/commands/compute/delete.js.map +1 -0
  37. package/dist/commands/compute/index.d.ts +4 -0
  38. package/dist/commands/compute/index.js +14 -0
  39. package/dist/commands/compute/index.js.map +1 -0
  40. package/dist/commands/compute/list.d.ts +2 -0
  41. package/dist/commands/compute/list.js +128 -0
  42. package/dist/commands/compute/list.js.map +1 -0
  43. package/dist/commands/compute.d.ts +3 -0
  44. package/dist/commands/compute.js +10 -400
  45. package/dist/commands/compute.js.map +1 -1
  46. package/package.json +1 -1
  47. package/src/commands/agent/apiUtils.ts +24 -0
  48. package/src/commands/agent/create.ts +105 -0
  49. package/src/commands/agent/createFromYaml.ts +192 -0
  50. package/src/commands/agent/deploy.ts +272 -0
  51. package/src/commands/agent/generate.ts +151 -0
  52. package/src/commands/agent/index.ts +12 -0
  53. package/src/commands/agent/list.ts +104 -0
  54. package/src/commands/agent/remove.ts +103 -0
  55. package/src/commands/agent.ts +15 -909
  56. package/src/commands/compute/apiUtils.ts +28 -0
  57. package/src/commands/compute/create.ts +195 -0
  58. package/src/commands/compute/delete.ts +147 -0
  59. package/src/commands/compute/index.ts +7 -0
  60. package/src/commands/compute/list.ts +125 -0
  61. package/src/commands/compute.ts +16 -449
@@ -0,0 +1,10 @@
1
+ import { MachineAgentApi, MachineInstancesApi, ProjectsApi } from "@nestbox-ai/admin";
2
+ export interface ApiInstances {
3
+ agentsApi: MachineAgentApi;
4
+ projectsApi: ProjectsApi;
5
+ instanceApi: MachineInstancesApi;
6
+ }
7
+ /**
8
+ * Create API instances with current authentication using setupAuthAndConfig
9
+ */
10
+ export declare function createApis(): ApiInstances;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createApis = createApis;
4
+ const admin_1 = require("@nestbox-ai/admin");
5
+ const api_1 = require("../../utils/api");
6
+ /**
7
+ * Create API instances with current authentication using setupAuthAndConfig
8
+ */
9
+ function createApis() {
10
+ const authResult = (0, api_1.setupAuthAndConfig)();
11
+ if (!authResult) {
12
+ throw new Error('No authentication token found. Please log in first.');
13
+ }
14
+ return {
15
+ agentsApi: new admin_1.MachineAgentApi(authResult.configuration),
16
+ projectsApi: new admin_1.ProjectsApi(authResult.configuration),
17
+ instanceApi: new admin_1.MachineInstancesApi(authResult.configuration)
18
+ };
19
+ }
20
+ //# sourceMappingURL=apiUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apiUtils.js","sourceRoot":"","sources":["../../../src/commands/agent/apiUtils.ts"],"names":[],"mappings":";;AAYA,gCAWC;AAvBD,6CAAqG;AACrG,yCAAsE;AAQtE;;GAEG;AACH,SAAgB,UAAU;IACxB,MAAM,UAAU,GAAG,IAAA,wBAAkB,GAAE,CAAC;IACxC,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAC;IACzE,CAAC;IAED,OAAO;QACL,SAAS,EAAE,IAAI,uBAAe,CAAC,UAAU,CAAC,aAAa,CAAC;QACxD,WAAW,EAAE,IAAI,mBAAW,CAAC,UAAU,CAAC,aAAa,CAAC;QACtD,WAAW,EAAE,IAAI,2BAAmB,CAAC,UAAU,CAAC,aAAa,CAAC;KAC/D,CAAC;AACJ,CAAC"}
@@ -0,0 +1,29 @@
1
+ import { MachineAgentApi, ProjectsApi } from "@nestbox-ai/admin";
2
+ export interface CreateAgentOptions {
3
+ lang?: string;
4
+ template?: string;
5
+ project?: string;
6
+ instanceName?: string;
7
+ machineManifestId?: string;
8
+ type?: string;
9
+ goal?: string;
10
+ modelBaseId?: string;
11
+ machineName?: string;
12
+ machineInstanceId?: number;
13
+ instanceIP?: string;
14
+ userId?: number;
15
+ parameters?: Array<{
16
+ name: string;
17
+ description: string;
18
+ default: any;
19
+ }>;
20
+ }
21
+ /**
22
+ * Create a new agent in the Nestbox platform
23
+ *
24
+ * @param agentName The name of the agent
25
+ * @param options Options including lang, template, and project
26
+ * @param agentsApi The MachineAgentApi instance
27
+ * @param projectsApi The ProjectsApi instance
28
+ */
29
+ export declare function createAgent(agentName: string, options: CreateAgentOptions, agentsApi?: MachineAgentApi, projectsApi?: ProjectsApi): Promise<any>;
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.createAgent = createAgent;
13
+ const admin_1 = require("@nestbox-ai/admin");
14
+ const auth_1 = require("../../utils/auth");
15
+ const project_1 = require("../../utils/project");
16
+ /**
17
+ * Create a new agent in the Nestbox platform
18
+ *
19
+ * @param agentName The name of the agent
20
+ * @param options Options including lang, template, and project
21
+ * @param agentsApi The MachineAgentApi instance
22
+ * @param projectsApi The ProjectsApi instance
23
+ */
24
+ function createAgent(agentName, options, agentsApi, projectsApi) {
25
+ return __awaiter(this, void 0, void 0, function* () {
26
+ var _a, _b, _c;
27
+ const authToken = (0, auth_1.getAuthToken)();
28
+ if (!authToken) {
29
+ throw new Error("No authentication token found. Please login first.");
30
+ }
31
+ // Create API instances if not provided
32
+ if (!agentsApi || !projectsApi) {
33
+ const configuration = new admin_1.Configuration({
34
+ basePath: authToken === null || authToken === void 0 ? void 0 : authToken.serverUrl,
35
+ baseOptions: {
36
+ headers: {
37
+ Authorization: authToken === null || authToken === void 0 ? void 0 : authToken.token,
38
+ },
39
+ },
40
+ });
41
+ agentsApi = agentsApi || new admin_1.MachineAgentApi(configuration);
42
+ projectsApi = projectsApi || new admin_1.ProjectsApi(configuration);
43
+ }
44
+ // Resolve project - convert options to match CommandOptions interface
45
+ const projectData = yield (0, project_1.resolveProject)(projectsApi, Object.assign({ project: options.project, instance: options.instanceName || '' }, options));
46
+ // Prepare agent creation payload
47
+ // Determine the correct type value based on options.type
48
+ const agentTypeValue = ((_a = options.type) === null || _a === void 0 ? void 0 : _a.includes("AGENT")) ? "REGULAR" : options.type || "CHAT";
49
+ const payload = {
50
+ agentName,
51
+ goal: options.goal || `AI agent for ${agentName}`,
52
+ modelBaseId: options.modelBaseId || "",
53
+ machineName: options.machineName,
54
+ machineInstanceId: options.machineInstanceId,
55
+ instanceIP: options.instanceIP,
56
+ machineManifestId: options.machineManifestId,
57
+ parameters: ((_b = options.parameters) === null || _b === void 0 ? void 0 : _b.map((param) => ({
58
+ name: param.name,
59
+ description: param.description,
60
+ default_value: param.default || "",
61
+ isUserParam: param.isUserParam !== undefined ? param.isUserParam : true
62
+ }))) || [],
63
+ projectId: projectData.id,
64
+ type: agentTypeValue,
65
+ userId: options.userId || 0,
66
+ };
67
+ // Determine the type of resource (Agent or Chat)
68
+ const agentType = options.type || "CHAT";
69
+ const resourceType = agentType === "AGENT" || agentType === "REGULAR" ? "Agent" : "Chatbot";
70
+ // Create the agent
71
+ try {
72
+ const response = yield agentsApi.machineAgentControllerCreateMachineAgent(projectData.id, payload);
73
+ return response.data;
74
+ }
75
+ catch (error) {
76
+ if (error.response && error.response.status === 401) {
77
+ throw new Error('Authentication token has expired. Please login again using "nestbox login <domain>".');
78
+ }
79
+ else if (error.response) {
80
+ throw new Error(`API Error (${error.response.status}): ${((_c = error.response.data) === null || _c === void 0 ? void 0 : _c.message) || "Unknown error"}`);
81
+ }
82
+ else {
83
+ throw new Error(error.message || "Unknown error");
84
+ }
85
+ }
86
+ });
87
+ }
88
+ //# sourceMappingURL=create.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create.js","sourceRoot":"","sources":["../../../src/commands/agent/create.ts"],"names":[],"mappings":";;;;;;;;;;;AA4BA,kCA4EC;AAxGD,6CAAgF;AA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AI,KAAK,CAAC,QAAQ,EAAE,CAAC;gBAC1B,MAAM,IAAI,KAAK,CAAC,cAAc,KAAK,CAAC,QAAQ,CAAC,MAAM,MAAM,CAAA,MAAA,KAAK,CAAC,QAAQ,CAAC,IAAI,0CAAE,OAAO,KAAI,eAAe,EAAE,CAAC,CAAC;YAC9G,CAAC;iBAAM,CAAC;gBACN,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,OAAO,IAAI,eAAe,CAAC,CAAC;YACpD,CAAC;QACH,CAAC;IACH,CAAC;CAAA"}
@@ -0,0 +1,2 @@
1
+ import { Command } from "commander";
2
+ export declare function registerCreateFromYamlCommand(agentCommand: Command): void;
@@ -0,0 +1,172 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.registerCreateFromYamlCommand = registerCreateFromYamlCommand;
16
+ const error_1 = require("../../utils/error");
17
+ const chalk_1 = __importDefault(require("chalk"));
18
+ const ora_1 = __importDefault(require("ora"));
19
+ const cli_table3_1 = __importDefault(require("cli-table3"));
20
+ const fs_1 = __importDefault(require("fs"));
21
+ const js_yaml_1 = __importDefault(require("js-yaml"));
22
+ const user_1 = require("../../utils/user");
23
+ const create_1 = require("./create");
24
+ const apiUtils_1 = require("./apiUtils");
25
+ function registerCreateFromYamlCommand(agentCommand) {
26
+ agentCommand
27
+ .command("create [firstArg] [secondArg]")
28
+ .description("Create multiple agents from a YAML configuration file")
29
+ .option("--project <projectId>", "Project ID (defaults to the current project)")
30
+ .action((firstArg, secondArg, options) => __awaiter(this, void 0, void 0, function* () {
31
+ try {
32
+ let apis = (0, apiUtils_1.createApis)();
33
+ // Determine which argument is the YAML file path
34
+ let yamlFilePath;
35
+ if (firstArg === 'file' && secondArg) {
36
+ yamlFilePath = secondArg;
37
+ }
38
+ else if (firstArg) {
39
+ yamlFilePath = firstArg;
40
+ if (typeof secondArg === 'object' && !options) {
41
+ options = secondArg;
42
+ }
43
+ }
44
+ else {
45
+ console.error(chalk_1.default.red("Missing YAML file path. Usage: nestbox agent create <yamlFile> OR nestbox agent create file <yamlFile>"));
46
+ return;
47
+ }
48
+ // Check if file exists
49
+ if (!fs_1.default.existsSync(yamlFilePath)) {
50
+ console.error(chalk_1.default.red(`YAML file not found: ${yamlFilePath}`));
51
+ return;
52
+ }
53
+ // Read and parse the YAML file
54
+ const spinner = (0, ora_1.default)(`Reading agents configuration from ${yamlFilePath}...`).start();
55
+ try {
56
+ const fileContents = fs_1.default.readFileSync(yamlFilePath, 'utf8');
57
+ const config = js_yaml_1.default.load(fileContents);
58
+ if (!config || !config.agents || !Array.isArray(config.agents)) {
59
+ spinner.fail("Invalid YAML configuration: Missing 'agents' array");
60
+ console.error(chalk_1.default.red("The YAML file should contain an 'agents' array with agent configurations"));
61
+ return;
62
+ }
63
+ spinner.succeed(`Found ${config.agents.length} agents in configuration file`);
64
+ // Process each agent with token refresh support
65
+ const results = {
66
+ success: 0,
67
+ failed: 0,
68
+ agents: []
69
+ };
70
+ // Get user data once
71
+ const user = yield (0, user_1.userData)();
72
+ for (const agent of config.agents) {
73
+ if (!agent.name) {
74
+ console.log(chalk_1.default.yellow("Skipping agent with no name defined"));
75
+ results.failed++;
76
+ results.agents.push({
77
+ name: "unnamed",
78
+ success: false,
79
+ message: "Name is required"
80
+ });
81
+ continue;
82
+ }
83
+ let agentType = agent.type || "CHAT";
84
+ const resourceType = agentType === "AGENT" ? "Agent" : "Chatbot";
85
+ const agentSpinner = (0, ora_1.default)(`Creating ${resourceType.toLowerCase()} '${agent.name}'...`).start();
86
+ try {
87
+ // Create agent with token refresh support
88
+ yield (0, error_1.withTokenRefresh)(() => __awaiter(this, void 0, void 0, function* () {
89
+ // Map YAML config to createAgent options
90
+ const createOptions = Object.assign(Object.assign({}, options), { goal: agent.goal || "No goal specified", modelBaseId: agent.modelBaseId || "", instanceIP: agent.instanceIP || "localhost", machineInstanceId: agent.machineInstanceId || 1, machineManifestId: agent.machineManifestId || "default", machineName: agent.machineName || `agent-${agent.name.toLowerCase()}`, type: agentType, userId: user.id, parameters: agent.parameters ? agent.parameters.map((p) => {
91
+ return {
92
+ name: p.name || "unnamed",
93
+ description: p.description || "",
94
+ default: p.default || "",
95
+ isUserParam: p.isUserParam !== undefined ? p.isUserParam : true
96
+ };
97
+ }) : [] });
98
+ yield (0, create_1.createAgent)(agent.name, createOptions, apis.agentsApi, apis.projectsApi);
99
+ }), () => {
100
+ apis = (0, apiUtils_1.createApis)();
101
+ });
102
+ agentSpinner.stop();
103
+ results.success++;
104
+ results.agents.push({
105
+ name: agent.name,
106
+ success: true,
107
+ message: `Created successfully`
108
+ });
109
+ }
110
+ catch (error) {
111
+ agentSpinner.fail(`Failed to create ${resourceType.toLowerCase()} '${agent.name}'`);
112
+ console.error(chalk_1.default.red(`Error: ${error.message}`));
113
+ results.failed++;
114
+ results.agents.push({
115
+ name: agent.name,
116
+ success: false,
117
+ message: error.message
118
+ });
119
+ }
120
+ }
121
+ // Final summary
122
+ console.log(chalk_1.default.blue("\nResource creation summary:"));
123
+ const table = new cli_table3_1.default({
124
+ head: [
125
+ chalk_1.default.white.bold("Name"),
126
+ chalk_1.default.white.bold("Type"),
127
+ chalk_1.default.white.bold("Status"),
128
+ chalk_1.default.white.bold("Message"),
129
+ ],
130
+ style: {
131
+ head: [],
132
+ border: [],
133
+ },
134
+ });
135
+ results.agents.forEach((agent, index) => {
136
+ const agentConfig = config.agents.find(a => a.name === agent.name) || config.agents[index];
137
+ const agentType = (agentConfig === null || agentConfig === void 0 ? void 0 : agentConfig.type) || "CHAT";
138
+ const resourceType = agentType === "AGENT" ? "Agent" : "Chatbot";
139
+ table.push([
140
+ agent.name,
141
+ resourceType,
142
+ agent.success ? chalk_1.default.green("Success") : chalk_1.default.red("Failed"),
143
+ agent.message
144
+ ]);
145
+ });
146
+ console.log(table.toString());
147
+ console.log(`\nTotal: ${results.success + results.failed}, Successful: ${results.success}, Failed: ${results.failed}`);
148
+ }
149
+ catch (error) {
150
+ spinner.fail("Failed to process YAML file");
151
+ if (error.code === 'ENOENT') {
152
+ console.error(chalk_1.default.red(`File not found: ${yamlFilePath}`));
153
+ }
154
+ else if (error.name === 'YAMLException') {
155
+ console.error(chalk_1.default.red(`Invalid YAML format: ${error.message}`));
156
+ }
157
+ else {
158
+ console.error(chalk_1.default.red("Error:"), error.message || "Unknown error");
159
+ }
160
+ }
161
+ }
162
+ catch (error) {
163
+ if (error.message && error.message.includes('Authentication')) {
164
+ console.error(chalk_1.default.red(error.message));
165
+ }
166
+ else {
167
+ console.error(chalk_1.default.red("Error:"), error instanceof Error ? error.message : "Unknown error");
168
+ }
169
+ }
170
+ }));
171
+ }
172
+ //# sourceMappingURL=createFromYaml.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createFromYaml.js","sourceRoot":"","sources":["../../../src/commands/agent/createFromYaml.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAYA,sEAmLC;AA9LD,6CAAqD;AACrD,kDAA0B;AAC1B,8CAAsB;AACtB,4DAA+B;AAC/B,4CAAoB;AACpB,sDAA2B;AAE3B,2CAA4C;AAC5C,qCAAuC;AACvC,yCAAwC;AAExC,SAAgB,6BAA6B,CAAC,YAAqB;IACjE,YAAY;SACT,OAAO,CAAC,+BAA+B,CAAC;SACxC,WAAW,CAAC,uDAAuD,CAAC;SACpE,MAAM,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,KAAK,CACX,eAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,EACnB,KAAK,CAAC,OAAO,IAAI,eAAe,CACjC,CAAC;gBACJ,CAAC;YACH,CAAC;QACH,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,IAAI,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,CAAC;gBAC9D,OAAO,CAAC,KAAK,CAAC,eAAK,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;YAC1C,CAAC;iBAAM,CAAC;gBACN,OAAO,CAAC,KAAK,CACX,eAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,EACnB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,CACzD,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC,CAAA,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { Command } from "commander";
2
+ export declare function registerDeployCommand(agentCommand: Command): void;
@@ -0,0 +1,243 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
36
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
37
+ return new (P || (P = Promise))(function (resolve, reject) {
38
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
39
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
40
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
41
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
42
+ });
43
+ };
44
+ var __importDefault = (this && this.__importDefault) || function (mod) {
45
+ return (mod && mod.__esModule) ? mod : { "default": mod };
46
+ };
47
+ Object.defineProperty(exports, "__esModule", { value: true });
48
+ exports.registerDeployCommand = registerDeployCommand;
49
+ const error_1 = require("../../utils/error");
50
+ const chalk_1 = __importDefault(require("chalk"));
51
+ const ora_1 = __importDefault(require("ora"));
52
+ const project_1 = require("../../utils/project");
53
+ const fs_1 = __importDefault(require("fs"));
54
+ const agent_1 = require("../../utils/agent");
55
+ const axios_1 = __importDefault(require("axios"));
56
+ const agentType_1 = require("../../types/agentType");
57
+ const path_1 = __importDefault(require("path"));
58
+ const auth_1 = require("../../utils/auth");
59
+ const apiUtils_1 = require("./apiUtils");
60
+ function registerDeployCommand(agentCommand) {
61
+ agentCommand
62
+ .command("deploy")
63
+ .description("Deploy an AI agent to the Nestbox platform")
64
+ .option("--agent <agentName>", "Agent name to deploy")
65
+ .option("--chatbot <chatbotName>", "Chatbot name to deploy")
66
+ .requiredOption("--instance <instanceName>", "Instance name")
67
+ .option("--zip <zipFileOrDirPath>", "Path to the zip file or directory to upload")
68
+ .option("--project <projectName>", "Project name (defaults to the current project)")
69
+ .option("--entry <entryFunction>", "Entry function name")
70
+ .option("--log", "Show detailed logs during deployment")
71
+ .action((options) => __awaiter(this, void 0, void 0, function* () {
72
+ var _a;
73
+ try {
74
+ const { agent: agentName, chatbot: chatbotName, instance: instanceName, zip: customZipPath, entry, log, } = options;
75
+ // Ensure either agent or chatbot is provided, but not both
76
+ if ((!agentName && !chatbotName) || (agentName && chatbotName)) {
77
+ console.error(chalk_1.default.red("Please provide either --agent OR --chatbot option, but not both."));
78
+ return;
79
+ }
80
+ let apis = (0, apiUtils_1.createApis)();
81
+ // Find project root
82
+ const projectRoot = yield (0, agent_1.findProjectRoot)();
83
+ console.log(chalk_1.default.blue(`Project root detected at: ${projectRoot}`));
84
+ // Main deployment logic with token refresh
85
+ yield (0, error_1.withTokenRefresh)(() => __awaiter(this, void 0, void 0, function* () {
86
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
87
+ // Resolve project
88
+ const projectData = yield (0, project_1.resolveProject)(apis.projectsApi, options);
89
+ // Determine if we're deploying an agent or chatbot
90
+ const isAgent = !!agentName;
91
+ const resourceName = isAgent ? agentName : chatbotName;
92
+ const resourceType = isAgent ? "Agent" : "Chatbot";
93
+ const agentType = isAgent ? agentType_1.AgentType.REGULAR : "CHAT";
94
+ // Get agents data and find agent/chatbot by name
95
+ const agentsData = yield apis.agentsApi.machineAgentControllerGetMachineAgentByProjectId(projectData.id, 0, 10, agentType);
96
+ const targetAgent = agentsData.data.machineAgents.find((agent) => agent.agentName === resourceName);
97
+ if (!targetAgent) {
98
+ console.error(chalk_1.default.red(`${resourceType} with name "${resourceName}" not found in project "${projectData.name}".`));
99
+ console.log(chalk_1.default.yellow(`Available ${resourceType.toLowerCase()}s:`));
100
+ agentsData.data.machineAgents.forEach((agent) => {
101
+ console.log(chalk_1.default.yellow(` - ${agent.agentName} (ID: ${agent.id})`));
102
+ });
103
+ return;
104
+ }
105
+ // Get instance data and find instance by name
106
+ const instanceData = yield apis.instanceApi.machineInstancesControllerGetMachineInstanceByUserId(projectData.id, 0, 10);
107
+ const targetInstance = instanceData.data.machineInstances.find((instance) => instance.instanceName === instanceName);
108
+ if (!targetInstance) {
109
+ console.error(chalk_1.default.red(`Instance with name "${instanceName}" not found in project "${projectData.name}".`));
110
+ console.log(chalk_1.default.yellow("Available instances:"));
111
+ instanceData.data.machineInstances.forEach((instance) => {
112
+ console.log(chalk_1.default.yellow(` - ${instance.instanceName} (ID: ${instance.id})`));
113
+ });
114
+ return;
115
+ }
116
+ // Extract IDs
117
+ const agentId = targetAgent.id;
118
+ const resolvedEntry = entry || targetAgent.entryFunctionName || "main";
119
+ const instanceId = targetInstance.id;
120
+ // Load nestbox.config.json
121
+ const config = (0, agent_1.loadNestboxConfig)(projectRoot);
122
+ // Start the deployment process
123
+ const spinner = (0, ora_1.default)(`Preparing to deploy ${resourceType.toLowerCase()} ${agentId} to instance ${instanceId}...`).start();
124
+ try {
125
+ let zipFilePath;
126
+ if (customZipPath) {
127
+ // Process custom zip path
128
+ if (!fs_1.default.existsSync(customZipPath)) {
129
+ spinner.fail(`Path not found: ${customZipPath}`);
130
+ return;
131
+ }
132
+ const stats = fs_1.default.statSync(customZipPath);
133
+ if (stats.isFile()) {
134
+ if (!customZipPath.toLowerCase().endsWith(".zip")) {
135
+ spinner.fail(`File is not a zip archive: ${customZipPath}`);
136
+ return;
137
+ }
138
+ spinner.text = `Using provided zip file: ${customZipPath}`;
139
+ zipFilePath = customZipPath;
140
+ }
141
+ else if (stats.isDirectory()) {
142
+ // Process directory
143
+ spinner.text = `Processing directory: ${customZipPath}`;
144
+ const isTypeScript = (0, agent_1.isTypeScriptProject)(customZipPath);
145
+ if (isTypeScript && (((_a = config === null || config === void 0 ? void 0 : config.agent) === null || _a === void 0 ? void 0 : _a.predeploy) || ((_b = config === null || config === void 0 ? void 0 : config.agents) === null || _b === void 0 ? void 0 : _b.predeploy))) {
146
+ const predeployScripts = ((_c = config === null || config === void 0 ? void 0 : config.agent) === null || _c === void 0 ? void 0 : _c.predeploy) || ((_d = config === null || config === void 0 ? void 0 : config.agents) === null || _d === void 0 ? void 0 : _d.predeploy);
147
+ spinner.text = `Running predeploy scripts on target directory...`;
148
+ yield (0, agent_1.runPredeployScripts)(predeployScripts, customZipPath);
149
+ }
150
+ spinner.text = `Creating zip archive from directory ${customZipPath}...`;
151
+ zipFilePath = (0, agent_1.createZipFromDirectory)(customZipPath);
152
+ spinner.text = `Directory zipped successfully to ${zipFilePath}`;
153
+ }
154
+ }
155
+ else {
156
+ // Use project root
157
+ spinner.text = `Using project root: ${projectRoot}`;
158
+ const isTypeScript = (0, agent_1.isTypeScriptProject)(projectRoot);
159
+ if (isTypeScript && (((_e = config === null || config === void 0 ? void 0 : config.agent) === null || _e === void 0 ? void 0 : _e.predeploy) || ((_f = config === null || config === void 0 ? void 0 : config.agents) === null || _f === void 0 ? void 0 : _f.predeploy))) {
160
+ const predeployScripts = ((_g = config === null || config === void 0 ? void 0 : config.agent) === null || _g === void 0 ? void 0 : _g.predeploy) || ((_h = config === null || config === void 0 ? void 0 : config.agents) === null || _h === void 0 ? void 0 : _h.predeploy);
161
+ spinner.text = `Running predeploy scripts on project root...`;
162
+ yield (0, agent_1.runPredeployScripts)(predeployScripts, projectRoot);
163
+ }
164
+ spinner.text = `Creating zip archive from project root ${projectRoot}...`;
165
+ zipFilePath = (0, agent_1.createZipFromDirectory)(projectRoot);
166
+ spinner.text = `Directory zipped successfully to ${zipFilePath}`;
167
+ }
168
+ spinner.text = `Deploying ${resourceType.toLowerCase()} ${agentId} to instance ${instanceId}...`;
169
+ // Prepare deployment
170
+ const authToken = (0, auth_1.getAuthToken)();
171
+ const baseUrl = ((_j = authToken === null || authToken === void 0 ? void 0 : authToken.serverUrl) === null || _j === void 0 ? void 0 : _j.endsWith("/"))
172
+ ? authToken.serverUrl.slice(0, -1)
173
+ : authToken === null || authToken === void 0 ? void 0 : authToken.serverUrl;
174
+ const { default: FormData } = yield Promise.resolve().then(() => __importStar(require("form-data")));
175
+ const form = new FormData();
176
+ form.append("file", fs_1.default.createReadStream(zipFilePath));
177
+ form.append("machineAgentId", agentId.toString());
178
+ form.append("instanceId", instanceId.toString());
179
+ form.append("entryFunctionName", resolvedEntry);
180
+ form.append("isSourceCodeUpdate", "true");
181
+ form.append("projectId", projectData.id);
182
+ if (log) {
183
+ console.log(chalk_1.default.blue("Form Details "));
184
+ console.log(chalk_1.default.blue(` - File: ${path_1.default.basename(zipFilePath)}`));
185
+ console.log(chalk_1.default.blue(` - Agent ID: ${agentId}`));
186
+ console.log(chalk_1.default.blue(` - Instance ID: ${instanceId}`));
187
+ console.log(chalk_1.default.blue(` - Entry Function: ${resolvedEntry}`));
188
+ console.log(chalk_1.default.blue(` - Project ID: ${projectData.id}`));
189
+ }
190
+ const axiosInstance = axios_1.default.create({
191
+ baseURL: baseUrl,
192
+ headers: Object.assign(Object.assign({}, form.getHeaders()), { Authorization: authToken === null || authToken === void 0 ? void 0 : authToken.token }),
193
+ });
194
+ const endpoint = `/projects/${projectData.id}/agents/${agentId}`;
195
+ spinner.text = `Sending API request to deploy ${resourceType.toLowerCase()}...`;
196
+ const res = yield axiosInstance.patch(endpoint, form);
197
+ if (!customZipPath && zipFilePath && fs_1.default.existsSync(zipFilePath)) {
198
+ fs_1.default.unlinkSync(zipFilePath);
199
+ }
200
+ if (log) {
201
+ console.log(chalk_1.default.blue("\nDeployment request:"));
202
+ console.log(chalk_1.default.blue(` URL: ${baseUrl}${endpoint}`));
203
+ console.log(chalk_1.default.blue(` Method: PATCH`));
204
+ console.log(chalk_1.default.blue(` File: ${path_1.default.basename(zipFilePath)}`));
205
+ console.log(chalk_1.default.blue(` Response status: ${res.status} ${res.statusText}`));
206
+ const lines = res.data.logEntries || [];
207
+ console.log(chalk_1.default.blue(` Deployment log entries (${lines.length} lines):`));
208
+ lines.forEach((line) => {
209
+ console.log(chalk_1.default.blue(` - [${line.type} ${line.timestamp}] ${line.message} `));
210
+ });
211
+ }
212
+ spinner.succeed("Successfully deployed");
213
+ console.log(chalk_1.default.green(`${resourceType} deployed successfully!`));
214
+ console.log(chalk_1.default.cyan(`📍 Instance: ${instanceName}`));
215
+ console.log(chalk_1.default.cyan(`🤖 Agent: ${agentName} (${agentId})`));
216
+ console.log(chalk_1.default.cyan(`⚙️ Entry: ${resolvedEntry}`));
217
+ console.log(chalk_1.default.cyan(`🔄 Process: ${res.data.processName}`));
218
+ }
219
+ catch (error) {
220
+ spinner.fail(`Failed to deploy ${resourceType.toLowerCase()}`);
221
+ throw error;
222
+ }
223
+ }), () => {
224
+ apis = (0, apiUtils_1.createApis)();
225
+ });
226
+ }
227
+ catch (error) {
228
+ if (error.message && error.message.includes('Authentication')) {
229
+ console.error(chalk_1.default.red(error.message));
230
+ }
231
+ else if (error.response) {
232
+ console.error(chalk_1.default.red(`API Error (${error.response.status}): ${((_a = error.response.data) === null || _a === void 0 ? void 0 : _a.message) || "Unknown error"}`));
233
+ if (error.response.data) {
234
+ console.error(chalk_1.default.red(`Error Data: ${JSON.stringify(error.response.data, null, 2)}`));
235
+ }
236
+ }
237
+ else {
238
+ console.error(chalk_1.default.red("Error:"), error.message || "Unknown error");
239
+ }
240
+ }
241
+ }));
242
+ }
243
+ //# sourceMappingURL=deploy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deploy.js","sourceRoot":"","sources":["../../../src/commands/agent/deploy.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmBA,sDA4PC;AA9QD,6CAAqD;AACrD,kDAA0B;AAC1B,8CAAsB;AACtB,iDAAqD;AACrD,4CAAoB;AACpB,6CAM2B;AAC3B,kDAA0B;AAC1B,qDAAkD;AAClD,gDAAwB;AACxB,2CAAgD;AAChD,yCAAwC;AAExC,SAAgB,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