@aigne/cli 1.50.1-beta.2 → 1.51.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +156 -0
- package/dist/cli.js +4 -2
- package/dist/commands/app.d.ts +2 -1
- package/dist/commands/app.js +8 -5
- package/dist/commands/run.js +2 -2
- package/dist/ui/utils/terminal-input.js +2 -2
- package/dist/utils/aigne-hub/model.js +9 -2
- package/dist/utils/load-aigne.d.ts +2 -1
- package/dist/utils/load-aigne.js +27 -11
- package/dist/utils/workers/run-aigne-in-child-process-worker.d.ts +3 -2
- package/dist/utils/workers/run-aigne-in-child-process-worker.js +5 -5
- package/dist/utils/workers/run-aigne-in-child-process.js +13 -4
- package/dist/utils/yargs.js +2 -2
- package/package.json +10 -9
- package/dist/ui/utils/error.d.ts +0 -2
- package/dist/ui/utils/error.js +0 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,161 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.51.0-beta.10](https://github.com/AIGNE-io/aigne-framework/compare/cli-v1.51.0-beta.9...cli-v1.51.0-beta.10) (2025-10-16)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Dependencies
|
|
7
|
+
|
|
8
|
+
* The following workspace dependencies were updated
|
|
9
|
+
* dependencies
|
|
10
|
+
* @aigne/afs-system-fs bumped to 1.0.1-beta.4
|
|
11
|
+
* @aigne/agent-library bumped to 1.21.48-beta.8
|
|
12
|
+
* @aigne/agentic-memory bumped to 1.0.48-beta.8
|
|
13
|
+
* @aigne/aigne-hub bumped to 0.10.2-beta.8
|
|
14
|
+
* @aigne/core bumped to 1.63.0-beta.8
|
|
15
|
+
* @aigne/default-memory bumped to 1.2.11-beta.8
|
|
16
|
+
* @aigne/observability-api bumped to 0.11.2-beta.3
|
|
17
|
+
* @aigne/openai bumped to 0.16.2-beta.8
|
|
18
|
+
* devDependencies
|
|
19
|
+
* @aigne/test-utils bumped to 0.5.55-beta.8
|
|
20
|
+
|
|
21
|
+
## [1.51.0-beta.9](https://github.com/AIGNE-io/aigne-framework/compare/cli-v1.51.0-beta.8...cli-v1.51.0-beta.9) (2025-10-16)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
### Bug Fixes
|
|
25
|
+
|
|
26
|
+
* ensure tips are only printed once during AIGNE loading ([#628](https://github.com/AIGNE-io/aigne-framework/issues/628)) ([7d49508](https://github.com/AIGNE-io/aigne-framework/commit/7d4950882436169986eedab75c232db2c0a30732))
|
|
27
|
+
|
|
28
|
+
## [1.51.0-beta.8](https://github.com/AIGNE-io/aigne-framework/compare/cli-v1.51.0-beta.7...cli-v1.51.0-beta.8) (2025-10-15)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
### Dependencies
|
|
32
|
+
|
|
33
|
+
* The following workspace dependencies were updated
|
|
34
|
+
* dependencies
|
|
35
|
+
* @aigne/afs-system-fs bumped to 1.0.1-beta.3
|
|
36
|
+
* @aigne/agent-library bumped to 1.21.48-beta.7
|
|
37
|
+
* @aigne/agentic-memory bumped to 1.0.48-beta.7
|
|
38
|
+
* @aigne/aigne-hub bumped to 0.10.2-beta.7
|
|
39
|
+
* @aigne/core bumped to 1.63.0-beta.7
|
|
40
|
+
* @aigne/default-memory bumped to 1.2.11-beta.7
|
|
41
|
+
* @aigne/openai bumped to 0.16.2-beta.7
|
|
42
|
+
* devDependencies
|
|
43
|
+
* @aigne/test-utils bumped to 0.5.55-beta.7
|
|
44
|
+
|
|
45
|
+
## [1.51.0-beta.7](https://github.com/AIGNE-io/aigne-framework/compare/cli-v1.51.0-beta.6...cli-v1.51.0-beta.7) (2025-10-15)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
### Dependencies
|
|
49
|
+
|
|
50
|
+
* The following workspace dependencies were updated
|
|
51
|
+
* dependencies
|
|
52
|
+
* @aigne/afs-system-fs bumped to 1.0.1-beta.2
|
|
53
|
+
* @aigne/agent-library bumped to 1.21.48-beta.6
|
|
54
|
+
* @aigne/agentic-memory bumped to 1.0.48-beta.6
|
|
55
|
+
* @aigne/aigne-hub bumped to 0.10.2-beta.6
|
|
56
|
+
* @aigne/core bumped to 1.63.0-beta.6
|
|
57
|
+
* @aigne/default-memory bumped to 1.2.11-beta.6
|
|
58
|
+
* @aigne/observability-api bumped to 0.11.2-beta.2
|
|
59
|
+
* @aigne/openai bumped to 0.16.2-beta.6
|
|
60
|
+
* devDependencies
|
|
61
|
+
* @aigne/test-utils bumped to 0.5.55-beta.6
|
|
62
|
+
|
|
63
|
+
## [1.51.0-beta.6](https://github.com/AIGNE-io/aigne-framework/compare/cli-v1.51.0-beta.5...cli-v1.51.0-beta.6) (2025-10-13)
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
### Bug Fixes
|
|
67
|
+
|
|
68
|
+
* add copy and download in observability detail and optimize the detail rendering ([#610](https://github.com/AIGNE-io/aigne-framework/issues/610)) ([b1885f2](https://github.com/AIGNE-io/aigne-framework/commit/b1885f2b969d7ca28a0cb1ac2b4707e7c785308b))
|
|
69
|
+
* **cli:** suppress error message for CTRL+C ([#617](https://github.com/AIGNE-io/aigne-framework/issues/617)) ([01f0ea7](https://github.com/AIGNE-io/aigne-framework/commit/01f0ea74affa5653dd94048e68b62b7d7e649d4a))
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
### Dependencies
|
|
73
|
+
|
|
74
|
+
* The following workspace dependencies were updated
|
|
75
|
+
* dependencies
|
|
76
|
+
* @aigne/afs-system-fs bumped to 1.0.1-beta.1
|
|
77
|
+
* @aigne/agent-library bumped to 1.21.48-beta.5
|
|
78
|
+
* @aigne/agentic-memory bumped to 1.0.48-beta.5
|
|
79
|
+
* @aigne/aigne-hub bumped to 0.10.2-beta.5
|
|
80
|
+
* @aigne/core bumped to 1.63.0-beta.5
|
|
81
|
+
* @aigne/default-memory bumped to 1.2.11-beta.5
|
|
82
|
+
* @aigne/openai bumped to 0.16.2-beta.5
|
|
83
|
+
* devDependencies
|
|
84
|
+
* @aigne/test-utils bumped to 0.5.55-beta.5
|
|
85
|
+
|
|
86
|
+
## [1.51.0-beta.5](https://github.com/AIGNE-io/aigne-framework/compare/cli-v1.51.0-beta.4...cli-v1.51.0-beta.5) (2025-10-12)
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
### Bug Fixes
|
|
90
|
+
|
|
91
|
+
* correct loading aigne with AFS config for `upgrade` command ([#613](https://github.com/AIGNE-io/aigne-framework/issues/613)) ([db1db97](https://github.com/AIGNE-io/aigne-framework/commit/db1db97b6305009d302a782dbc7fa3147900af47))
|
|
92
|
+
|
|
93
|
+
## [1.51.0-beta.4](https://github.com/AIGNE-io/aigne-framework/compare/cli-v1.51.0-beta.3...cli-v1.51.0-beta.4) (2025-10-12)
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
### Dependencies
|
|
97
|
+
|
|
98
|
+
* The following workspace dependencies were updated
|
|
99
|
+
* dependencies
|
|
100
|
+
* @aigne/afs-system-fs bumped to 1.0.1-beta
|
|
101
|
+
* @aigne/agent-library bumped to 1.21.48-beta.4
|
|
102
|
+
* @aigne/agentic-memory bumped to 1.0.48-beta.4
|
|
103
|
+
* @aigne/aigne-hub bumped to 0.10.2-beta.4
|
|
104
|
+
* @aigne/core bumped to 1.63.0-beta.4
|
|
105
|
+
* @aigne/default-memory bumped to 1.2.11-beta.4
|
|
106
|
+
* @aigne/openai bumped to 0.16.2-beta.4
|
|
107
|
+
* devDependencies
|
|
108
|
+
* @aigne/test-utils bumped to 0.5.55-beta.4
|
|
109
|
+
|
|
110
|
+
## [1.51.0-beta.3](https://github.com/AIGNE-io/aigne-framework/compare/cli-v1.50.1-beta.3...cli-v1.51.0-beta.3) (2025-10-11)
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
### Features
|
|
114
|
+
|
|
115
|
+
* **afs:** add module system fs for afs ([#594](https://github.com/AIGNE-io/aigne-framework/issues/594)) ([83c7b65](https://github.com/AIGNE-io/aigne-framework/commit/83c7b6555d21c606a5005eb05f6686882fb8ffa3))
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
### Bug Fixes
|
|
119
|
+
|
|
120
|
+
* improve exit event handling for cli ([#609](https://github.com/AIGNE-io/aigne-framework/issues/609)) ([00211f8](https://github.com/AIGNE-io/aigne-framework/commit/00211f8ad4686ea673ea8e2eac5b850bcbd8c1f6))
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
### Dependencies
|
|
124
|
+
|
|
125
|
+
* The following workspace dependencies were updated
|
|
126
|
+
* dependencies
|
|
127
|
+
* @aigne/afs-system-fs bumped to 1.0.0
|
|
128
|
+
* @aigne/agent-library bumped to 1.21.48-beta.3
|
|
129
|
+
* @aigne/agentic-memory bumped to 1.0.48-beta.3
|
|
130
|
+
* @aigne/aigne-hub bumped to 0.10.2-beta.3
|
|
131
|
+
* @aigne/core bumped to 1.63.0-beta.3
|
|
132
|
+
* @aigne/default-memory bumped to 1.2.11-beta.3
|
|
133
|
+
* @aigne/observability-api bumped to 0.11.2-beta.1
|
|
134
|
+
* @aigne/openai bumped to 0.16.2-beta.3
|
|
135
|
+
* devDependencies
|
|
136
|
+
* @aigne/test-utils bumped to 0.5.55-beta.3
|
|
137
|
+
|
|
138
|
+
## [1.50.1-beta.3](https://github.com/AIGNE-io/aigne-framework/compare/cli-v1.50.1-beta.2...cli-v1.50.1-beta.3) (2025-10-09)
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
### Bug Fixes
|
|
142
|
+
|
|
143
|
+
* input schema of AI agent should includes input key and input file key ([#600](https://github.com/AIGNE-io/aigne-framework/issues/600)) ([b4ca076](https://github.com/AIGNE-io/aigne-framework/commit/b4ca076d6b4a1a1ecb8d4ebb008abd0d7561aadd))
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
### Dependencies
|
|
147
|
+
|
|
148
|
+
* The following workspace dependencies were updated
|
|
149
|
+
* dependencies
|
|
150
|
+
* @aigne/agent-library bumped to 1.21.48-beta.2
|
|
151
|
+
* @aigne/agentic-memory bumped to 1.0.48-beta.2
|
|
152
|
+
* @aigne/aigne-hub bumped to 0.10.2-beta.2
|
|
153
|
+
* @aigne/core bumped to 1.63.0-beta.2
|
|
154
|
+
* @aigne/default-memory bumped to 1.2.11-beta.2
|
|
155
|
+
* @aigne/openai bumped to 0.16.2-beta.2
|
|
156
|
+
* devDependencies
|
|
157
|
+
* @aigne/test-utils bumped to 0.5.55-beta.2
|
|
158
|
+
|
|
3
159
|
## [1.50.1-beta.2](https://github.com/AIGNE-io/aigne-framework/compare/cli-v1.50.1-beta.1...cli-v1.50.1-beta.2) (2025-10-09)
|
|
4
160
|
|
|
5
161
|
|
package/dist/cli.js
CHANGED
|
@@ -28,7 +28,9 @@ export default createAIGNECommand({ argv, aigneFilePath })
|
|
|
28
28
|
})
|
|
29
29
|
.parseAsync(argv)
|
|
30
30
|
.catch((error) => {
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
if (error.name !== "ExitPromptError") {
|
|
32
|
+
console.log(""); // Add an empty line for better readability
|
|
33
|
+
console.error(`${chalk.red("Error:")} ${highlightUrl(error.message)}`);
|
|
34
|
+
}
|
|
33
35
|
process.exit(1);
|
|
34
36
|
});
|
package/dist/commands/app.d.ts
CHANGED
|
@@ -4,9 +4,10 @@ import { type AgentRunCommonOptions } from "../utils/yargs.js";
|
|
|
4
4
|
export declare function createAppCommands({ argv }?: {
|
|
5
5
|
argv?: string[];
|
|
6
6
|
}): CommandModule[];
|
|
7
|
-
export declare const agentCommandModule: ({ dir, agent, }: {
|
|
7
|
+
export declare const agentCommandModule: ({ dir, agent, chat, }: {
|
|
8
8
|
dir: string;
|
|
9
9
|
agent: AgentInChildProcess;
|
|
10
|
+
chat?: boolean;
|
|
10
11
|
}) => CommandModule<unknown, AgentRunCommonOptions>;
|
|
11
12
|
export declare const cliAgentCommandModule: ({ dir, parent, cliAgent, }: {
|
|
12
13
|
dir: string;
|
package/dist/commands/app.js
CHANGED
|
@@ -50,7 +50,7 @@ export function createAppCommands({ argv } = {}) {
|
|
|
50
50
|
});
|
|
51
51
|
if (aigne.cli?.chat) {
|
|
52
52
|
y.command({
|
|
53
|
-
...agentCommandModule({ dir, agent: aigne.cli.chat }),
|
|
53
|
+
...agentCommandModule({ dir, agent: aigne.cli.chat, chat: true }),
|
|
54
54
|
command: "$0",
|
|
55
55
|
});
|
|
56
56
|
}
|
|
@@ -133,7 +133,7 @@ const upgradeCommandModule = ({ packageName, dir, }) => ({
|
|
|
133
133
|
console.log(`\n✅ ${packageName} is already at the latest version (${app.version})`);
|
|
134
134
|
},
|
|
135
135
|
});
|
|
136
|
-
export const agentCommandModule = ({ dir, agent, }) => {
|
|
136
|
+
export const agentCommandModule = ({ dir, agent, chat, }) => {
|
|
137
137
|
return {
|
|
138
138
|
command: agent.name,
|
|
139
139
|
aliases: agent.alias || [],
|
|
@@ -147,7 +147,7 @@ export const agentCommandModule = ({ dir, agent, }) => {
|
|
|
147
147
|
await runAIGNEInChildProcess("invokeCLIAgentFromDir", {
|
|
148
148
|
dir,
|
|
149
149
|
agent: agent.name,
|
|
150
|
-
input: options,
|
|
150
|
+
input: { ...options, chat: chat ?? options.chat },
|
|
151
151
|
});
|
|
152
152
|
process.exit(0);
|
|
153
153
|
},
|
|
@@ -193,7 +193,10 @@ export async function loadApplication(options) {
|
|
|
193
193
|
const { dir, packageName } = options;
|
|
194
194
|
const check = await checkInstallation(dir);
|
|
195
195
|
if (check && !check.expired) {
|
|
196
|
-
const aigne = await runAIGNEInChildProcess("loadAIGNE",
|
|
196
|
+
const aigne = await runAIGNEInChildProcess("loadAIGNE", {
|
|
197
|
+
path: dir,
|
|
198
|
+
skipModelLoading: true,
|
|
199
|
+
}).catch(async (error) => {
|
|
197
200
|
logger.error(`⚠️ Failed to load ${packageName}, trying to reinstall:`, error.message);
|
|
198
201
|
await withSpinner("", async () => {
|
|
199
202
|
await rm(options.dir, { recursive: true, force: true });
|
|
@@ -208,7 +211,7 @@ export async function loadApplication(options) {
|
|
|
208
211
|
return null;
|
|
209
212
|
const result = await installApp({ dir, packageName, beta: check?.version?.includes("beta") });
|
|
210
213
|
return {
|
|
211
|
-
aigne: await runAIGNEInChildProcess("loadAIGNE", dir),
|
|
214
|
+
aigne: await runAIGNEInChildProcess("loadAIGNE", { path: dir, skipModelLoading: true }),
|
|
212
215
|
version: result.version,
|
|
213
216
|
};
|
|
214
217
|
}
|
package/dist/commands/run.js
CHANGED
|
@@ -43,7 +43,7 @@ export function createRunCommand({ aigneFilePath, } = {}) {
|
|
|
43
43
|
const subYargs = yargs().scriptName("").usage("aigne run <path> <agent> [...options]");
|
|
44
44
|
if (aigne.cli.chat) {
|
|
45
45
|
subYargs.command({
|
|
46
|
-
...agentCommandModule({ dir: path, agent: serializeAgent(aigne.cli.chat) }),
|
|
46
|
+
...agentCommandModule({ dir: path, agent: serializeAgent(aigne.cli.chat), chat: true }),
|
|
47
47
|
command: "$0",
|
|
48
48
|
});
|
|
49
49
|
}
|
|
@@ -111,7 +111,7 @@ async function loadApplication(path) {
|
|
|
111
111
|
}
|
|
112
112
|
// Load env files in the aigne directory
|
|
113
113
|
config({ path: dir, silent: true });
|
|
114
|
-
const aigne = await loadAIGNE({ path: dir
|
|
114
|
+
const aigne = await loadAIGNE({ path: dir });
|
|
115
115
|
return { aigne, path: dir };
|
|
116
116
|
}
|
|
117
117
|
async function downloadPackage(url, cacheDir) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ExitPromptError } from "@inquirer/core";
|
|
2
3
|
import chalk from "chalk";
|
|
3
4
|
import { Box, render, Text, useInput } from "ink";
|
|
4
5
|
import { useState } from "react";
|
|
5
|
-
import { SIGINTError } from "./error.js";
|
|
6
6
|
import { useTextBuffer } from "./text-buffer.js";
|
|
7
7
|
export async function terminalInput(options = {}) {
|
|
8
8
|
return new Promise((resolve, reject) => {
|
|
@@ -30,7 +30,7 @@ function Input(props) {
|
|
|
30
30
|
if (character === "c" && key.ctrl) {
|
|
31
31
|
setStatus("error");
|
|
32
32
|
setTimeout(() => {
|
|
33
|
-
props.onError(new
|
|
33
|
+
props.onError(new ExitPromptError("Input aborted by user"));
|
|
34
34
|
});
|
|
35
35
|
return;
|
|
36
36
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { readFile } from "node:fs/promises";
|
|
2
|
-
import { AIGNE_HUB_DEFAULT_MODEL, findImageModel, findModel } from "@aigne/aigne-hub";
|
|
1
|
+
import { readFile, writeFile } from "node:fs/promises";
|
|
2
|
+
import { AIGNE_HUB_DEFAULT_MODEL, AIGNE_HUB_URL, findImageModel, findModel, } from "@aigne/aigne-hub";
|
|
3
3
|
import { flat, omit } from "@aigne/core/utils/type-utils.js";
|
|
4
4
|
import chalk from "chalk";
|
|
5
5
|
import inquirer from "inquirer";
|
|
@@ -56,6 +56,13 @@ export const formatModelName = async (model, inquirerPrompt) => {
|
|
|
56
56
|
console.log(chalk.yellow(`You can use command "export ${requireEnvs[0]}=xxx" to set API Key in your shell. Or you can set environment variables in .env file.`));
|
|
57
57
|
process.exit(0);
|
|
58
58
|
}
|
|
59
|
+
if (!envs.default?.AIGNE_HUB_API_URL) {
|
|
60
|
+
const host = new URL(AIGNE_HUB_URL).host;
|
|
61
|
+
const defaultEnv = envs[host]?.AIGNE_HUB_API_URL
|
|
62
|
+
? envs[host]
|
|
63
|
+
: Object.values(envs)[0] || { AIGNE_HUB_API_URL: "" };
|
|
64
|
+
await writeFile(AIGNE_ENV_FILE, stringify({ ...envs, default: { AIGNE_HUB_API_URL: defaultEnv?.AIGNE_HUB_API_URL } }));
|
|
65
|
+
}
|
|
59
66
|
return { provider: AIGNE_HUB_PROVIDER, model: `${provider}/${name}` };
|
|
60
67
|
};
|
|
61
68
|
export async function loadChatModel(options) {
|
|
@@ -7,9 +7,10 @@ export interface RunOptions extends AgentRunCommonOptions {
|
|
|
7
7
|
cacheDir?: string;
|
|
8
8
|
aigneHubUrl?: string;
|
|
9
9
|
}
|
|
10
|
-
export declare function loadAIGNE({ path, modelOptions, imageModelOptions, printTips, }: {
|
|
10
|
+
export declare function loadAIGNE({ path, modelOptions, imageModelOptions, printTips, skipModelLoading, }: {
|
|
11
11
|
path?: string;
|
|
12
12
|
modelOptions?: ChatModelInputOptions & LoadCredentialOptions;
|
|
13
13
|
imageModelOptions?: ImageModelInputOptions & LoadCredentialOptions;
|
|
14
14
|
printTips?: boolean;
|
|
15
|
+
skipModelLoading?: boolean;
|
|
15
16
|
}): Promise<AIGNE<import("@aigne/core").UserContext>>;
|
package/dist/utils/load-aigne.js
CHANGED
|
@@ -21,21 +21,37 @@ async function printChatModelInfoBox(model) {
|
|
|
21
21
|
console.log(boxen(lines.join("\n"), { padding: 1, borderStyle: "classic", borderColor: "cyan" }));
|
|
22
22
|
console.log("");
|
|
23
23
|
}
|
|
24
|
-
export async function loadAIGNE({ path, modelOptions, imageModelOptions, printTips =
|
|
24
|
+
export async function loadAIGNE({ path, modelOptions, imageModelOptions, printTips = false, skipModelLoading = false, }) {
|
|
25
25
|
let aigne;
|
|
26
26
|
if (path) {
|
|
27
27
|
aigne = await AIGNE.load(path, {
|
|
28
28
|
memories: availableMemories,
|
|
29
|
-
model: (options) =>
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
29
|
+
model: (options) => {
|
|
30
|
+
if (skipModelLoading)
|
|
31
|
+
return undefined;
|
|
32
|
+
return loadChatModel({
|
|
33
|
+
...options,
|
|
34
|
+
...omitBy(modelOptions ?? {}, (v) => isNil(v)),
|
|
35
|
+
model: modelOptions?.model || process.env.MODEL || options?.model,
|
|
36
|
+
});
|
|
37
|
+
},
|
|
38
|
+
imageModel: (options) => {
|
|
39
|
+
if (skipModelLoading)
|
|
40
|
+
return undefined;
|
|
41
|
+
return loadImageModel({
|
|
42
|
+
...options,
|
|
43
|
+
...omitBy(imageModelOptions ?? {}, (v) => isNil(v)),
|
|
44
|
+
model: imageModelOptions?.model || process.env.IMAGE_MODEL || options?.model,
|
|
45
|
+
});
|
|
46
|
+
},
|
|
47
|
+
afs: {
|
|
48
|
+
availableModules: [
|
|
49
|
+
{
|
|
50
|
+
module: "system-fs",
|
|
51
|
+
create: (options) => import("@aigne/afs-system-fs").then((m) => new m.SystemFS(options)),
|
|
52
|
+
},
|
|
53
|
+
],
|
|
54
|
+
},
|
|
39
55
|
});
|
|
40
56
|
}
|
|
41
57
|
else {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Message } from "@aigne/core";
|
|
2
|
+
import { loadAIGNE } from "../load-aigne.js";
|
|
2
3
|
import { type AgentRunCommonOptions } from "../yargs.js";
|
|
3
4
|
import { type AgentInChildProcess, type CLIAgentInChildProcess } from "./run-aigne-in-child-process.js";
|
|
4
|
-
export declare function loadAIGNEInChildProcess(
|
|
5
|
+
export declare function loadAIGNEInChildProcess(options: Parameters<typeof loadAIGNE>[0]): Promise<{
|
|
5
6
|
agents?: AgentInChildProcess[];
|
|
6
7
|
cli?: {
|
|
7
8
|
chat?: AgentInChildProcess;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import assert from "node:assert";
|
|
2
|
-
import { AIGNE } from "@aigne/core";
|
|
3
2
|
import { findCliAgent, mapCliAgent } from "@aigne/core/utils/agent-utils.js";
|
|
4
3
|
import { logger } from "@aigne/core/utils/logger.js";
|
|
5
4
|
import { loadAIGNE } from "../load-aigne.js";
|
|
@@ -30,14 +29,14 @@ process.on("message", async ({ method, args, ...options }) => {
|
|
|
30
29
|
await send({ method, result });
|
|
31
30
|
}
|
|
32
31
|
catch (error) {
|
|
33
|
-
await send({ method, error: { message: error.message } });
|
|
32
|
+
await send({ method, error: { name: error.name, message: error.message } });
|
|
34
33
|
}
|
|
35
34
|
finally {
|
|
36
35
|
process.exit(0);
|
|
37
36
|
}
|
|
38
37
|
});
|
|
39
|
-
export async function loadAIGNEInChildProcess(
|
|
40
|
-
const aigne = await
|
|
38
|
+
export async function loadAIGNEInChildProcess(options) {
|
|
39
|
+
const aigne = await loadAIGNE(options);
|
|
41
40
|
return {
|
|
42
41
|
agents: aigne.agents.map(serializeAgent),
|
|
43
42
|
cli: {
|
|
@@ -53,6 +52,7 @@ export async function invokeCLIAgentFromDirInChildProcess(options) {
|
|
|
53
52
|
const aigne = await loadAIGNE({
|
|
54
53
|
path: options.dir,
|
|
55
54
|
modelOptions: options.input,
|
|
55
|
+
printTips: true,
|
|
56
56
|
imageModelOptions: {
|
|
57
57
|
model: options.input.imageModel,
|
|
58
58
|
},
|
|
@@ -78,7 +78,7 @@ export async function invokeCLIAgentFromDirInChildProcess(options) {
|
|
|
78
78
|
await runAgentWithAIGNE(aigne, agent, {
|
|
79
79
|
...options.input,
|
|
80
80
|
input,
|
|
81
|
-
chat:
|
|
81
|
+
chat: options.input.chat,
|
|
82
82
|
});
|
|
83
83
|
}
|
|
84
84
|
finally {
|
|
@@ -14,16 +14,25 @@ export function serializeAgent(agent) {
|
|
|
14
14
|
}
|
|
15
15
|
export async function runAIGNEInChildProcess(method, ...args) {
|
|
16
16
|
return await new Promise((resolve, reject) => {
|
|
17
|
+
let completed = false;
|
|
17
18
|
const child = fork(join(dirname(fileURLToPath(import.meta.url)), "./run-aigne-in-child-process-worker.js"));
|
|
18
19
|
child.on("message", (event) => {
|
|
19
|
-
if (event.method !== method)
|
|
20
|
+
if (event.method !== method) {
|
|
20
21
|
reject(new Error(`Unknown method: ${event.method} expected: ${method}`));
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
}
|
|
23
|
+
else if (event.error) {
|
|
24
|
+
const e = new Error(event.error.message);
|
|
25
|
+
e.name = event.error.name;
|
|
26
|
+
reject(e);
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
24
29
|
resolve(event.result);
|
|
30
|
+
}
|
|
31
|
+
completed = true;
|
|
25
32
|
});
|
|
26
33
|
child.on("exit", (code) => {
|
|
34
|
+
if (!completed)
|
|
35
|
+
process.exit(code);
|
|
27
36
|
reject(new Error(`Child process exited with code ${code}`));
|
|
28
37
|
});
|
|
29
38
|
child.send({ method, args, logLevel: logger.level });
|
package/dist/utils/yargs.js
CHANGED
|
@@ -6,7 +6,7 @@ import { promisify } from "node:util";
|
|
|
6
6
|
import { availableImageModels, availableModels, } from "@aigne/aigne-hub";
|
|
7
7
|
import { AIAgent, ChatModel, DEFAULT_OUTPUT_KEY, readAllString, } from "@aigne/core";
|
|
8
8
|
import { getLevelFromEnv, LogLevel, logger } from "@aigne/core/utils/logger.js";
|
|
9
|
-
import { pick, tryOrThrow } from "@aigne/core/utils/type-utils.js";
|
|
9
|
+
import { flat, pick, tryOrThrow } from "@aigne/core/utils/type-utils.js";
|
|
10
10
|
import { parse } from "yaml";
|
|
11
11
|
import z, { ZodAny, ZodArray, ZodBoolean, ZodError, ZodNumber, ZodObject, ZodString, ZodType, ZodUnknown, } from "zod";
|
|
12
12
|
const MODEL_OPTIONS_GROUP_NAME = "Model Options";
|
|
@@ -149,7 +149,7 @@ export async function parseAgentInput(i, agent) {
|
|
|
149
149
|
})));
|
|
150
150
|
if (agent instanceof AIAgent && agent.inputFileKey) {
|
|
151
151
|
const files = [];
|
|
152
|
-
for (const file of i.inputFile ?? []) {
|
|
152
|
+
for (const file of flat(i.inputFile, i[agent.inputFileKey]) ?? []) {
|
|
153
153
|
const raw = await readFile(file.replace(/^@/, ""), "base64");
|
|
154
154
|
const filename = basename(file);
|
|
155
155
|
const mimeType = (await ChatModel.getMimeType(filename)) || "application/octet-stream";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aigne/cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.51.0-beta.10",
|
|
4
4
|
"description": "Your command center for agent development",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -89,13 +89,14 @@
|
|
|
89
89
|
"yoctocolors-cjs": "^2.1.3",
|
|
90
90
|
"zod": "^3.25.67",
|
|
91
91
|
"zod-to-json-schema": "^3.24.6",
|
|
92
|
-
"@aigne/
|
|
93
|
-
"@aigne/agent-library": "^1.21.48-beta.
|
|
94
|
-
"@aigne/aigne-hub": "^0.10.2-beta.
|
|
95
|
-
"@aigne/
|
|
96
|
-
"@aigne/core": "^1.63.0-beta.
|
|
97
|
-
"@aigne/
|
|
98
|
-
"@aigne/
|
|
92
|
+
"@aigne/afs-system-fs": "^1.0.1-beta.4",
|
|
93
|
+
"@aigne/agent-library": "^1.21.48-beta.8",
|
|
94
|
+
"@aigne/aigne-hub": "^0.10.2-beta.8",
|
|
95
|
+
"@aigne/agentic-memory": "^1.0.48-beta.8",
|
|
96
|
+
"@aigne/core": "^1.63.0-beta.8",
|
|
97
|
+
"@aigne/default-memory": "^1.2.11-beta.8",
|
|
98
|
+
"@aigne/observability-api": "^0.11.2-beta.3",
|
|
99
|
+
"@aigne/openai": "^0.16.2-beta.8"
|
|
99
100
|
},
|
|
100
101
|
"devDependencies": {
|
|
101
102
|
"@inquirer/testing": "^2.1.50",
|
|
@@ -112,7 +113,7 @@
|
|
|
112
113
|
"rimraf": "^6.0.1",
|
|
113
114
|
"typescript": "^5.9.2",
|
|
114
115
|
"ufo": "^1.6.1",
|
|
115
|
-
"@aigne/test-utils": "^0.5.55-beta.
|
|
116
|
+
"@aigne/test-utils": "^0.5.55-beta.8"
|
|
116
117
|
},
|
|
117
118
|
"scripts": {
|
|
118
119
|
"lint": "tsc --noEmit",
|
package/dist/ui/utils/error.d.ts
DELETED
package/dist/ui/utils/error.js
DELETED