@aigne/cli 1.48.4-beta.1 → 1.48.4-beta.2
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 +21 -0
- package/dist/tracer/terminal.d.ts +2 -2
- package/dist/tracer/terminal.js +7 -7
- package/dist/utils/aigne-hub/model.d.ts +2 -2
- package/dist/utils/load-aigne.d.ts +2 -2
- package/dist/utils/run-chat-loop.d.ts +1 -1
- package/dist/utils/run-chat-loop.js +6 -6
- package/dist/utils/run-with-aigne.d.ts +4 -4
- package/dist/utils/run-with-aigne.js +3 -3
- package/dist/utils/yargs.js +2 -2
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.48.4-beta.2](https://github.com/AIGNE-io/aigne-framework/compare/cli-v1.48.4-beta.1...cli-v1.48.4-beta.2) (2025-09-23)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* standardize file parameter naming across models ([#534](https://github.com/AIGNE-io/aigne-framework/issues/534)) ([f159a9d](https://github.com/AIGNE-io/aigne-framework/commit/f159a9d6af21ec0e99641996b150560929845845))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Dependencies
|
|
12
|
+
|
|
13
|
+
* The following workspace dependencies were updated
|
|
14
|
+
* dependencies
|
|
15
|
+
* @aigne/agent-library bumped to 1.21.46-beta.2
|
|
16
|
+
* @aigne/agentic-memory bumped to 1.0.46-beta.2
|
|
17
|
+
* @aigne/aigne-hub bumped to 0.10.0-beta.2
|
|
18
|
+
* @aigne/core bumped to 1.61.0-beta.1
|
|
19
|
+
* @aigne/default-memory bumped to 1.2.9-beta.2
|
|
20
|
+
* @aigne/openai bumped to 0.16.0-beta.2
|
|
21
|
+
* devDependencies
|
|
22
|
+
* @aigne/test-utils bumped to 0.5.53-beta.1
|
|
23
|
+
|
|
3
24
|
## [1.48.4-beta.1](https://github.com/AIGNE-io/aigne-framework/compare/cli-v1.48.4-beta...cli-v1.48.4-beta.1) (2025-09-23)
|
|
4
25
|
|
|
5
26
|
|
|
@@ -5,7 +5,7 @@ import { type Listr } from "@aigne/listr2";
|
|
|
5
5
|
import { type AIGNEListrTaskWrapper } from "../utils/listr.js";
|
|
6
6
|
export interface TerminalTracerOptions {
|
|
7
7
|
outputKey?: string;
|
|
8
|
-
|
|
8
|
+
outputFileKey?: string;
|
|
9
9
|
}
|
|
10
10
|
export declare class TerminalTracer {
|
|
11
11
|
readonly context: Context;
|
|
@@ -32,7 +32,7 @@ export declare class TerminalTracer {
|
|
|
32
32
|
}): Promise<string>;
|
|
33
33
|
private marked;
|
|
34
34
|
get outputKey(): string;
|
|
35
|
-
get
|
|
35
|
+
get outputFileKey(): string;
|
|
36
36
|
formatRequest(agent: Agent, _context: Context, m?: Message, { running }?: {
|
|
37
37
|
running?: boolean | undefined;
|
|
38
38
|
}): string | undefined;
|
package/dist/tracer/terminal.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EOL } from "node:os";
|
|
2
2
|
import { inspect } from "node:util";
|
|
3
|
-
import { AIAgent, ChatModel,
|
|
3
|
+
import { AIAgent, ChatModel, DEFAULT_OUTPUT_FILE_KEY, DEFAULT_OUTPUT_KEY, mergeContextUsage, newEmptyContextUsage, UserAgent, } from "@aigne/core";
|
|
4
4
|
import { promiseWithResolvers } from "@aigne/core/utils/promise.js";
|
|
5
5
|
import { flat, omit } from "@aigne/core/utils/type-utils.js";
|
|
6
6
|
import { figures } from "@aigne/listr2";
|
|
@@ -287,8 +287,8 @@ export class TerminalTracer {
|
|
|
287
287
|
get outputKey() {
|
|
288
288
|
return this.options.outputKey || DEFAULT_OUTPUT_KEY;
|
|
289
289
|
}
|
|
290
|
-
get
|
|
291
|
-
return this.options.
|
|
290
|
+
get outputFileKey() {
|
|
291
|
+
return this.options.outputFileKey || DEFAULT_OUTPUT_FILE_KEY;
|
|
292
292
|
}
|
|
293
293
|
formatRequest(agent, _context, m = {}, { running = false } = {}) {
|
|
294
294
|
const prefix = `${chalk.grey(figures.pointer)} 💬 `;
|
|
@@ -309,7 +309,7 @@ export class TerminalTracer {
|
|
|
309
309
|
const outputKey = this.outputKey || (agent instanceof AIAgent ? agent.outputKey : undefined);
|
|
310
310
|
const prefix = `${chalk.grey(figures.tick)} 🤖 ${this.formatTokenUsage(context.usage)}`;
|
|
311
311
|
const msg = outputKey ? m[outputKey] : undefined;
|
|
312
|
-
const message = outputKey ? omit(m, outputKey, this.
|
|
312
|
+
const message = outputKey ? omit(m, outputKey, this.outputFileKey) : m;
|
|
313
313
|
const text = msg && typeof msg === "string"
|
|
314
314
|
? isTTY
|
|
315
315
|
? this.marked.parse(msg, { async: false }).trim()
|
|
@@ -326,13 +326,13 @@ export class TerminalTracer {
|
|
|
326
326
|
return [prefix, text, json].filter(Boolean).join(EOL.repeat(2));
|
|
327
327
|
}
|
|
328
328
|
async formatResultData(output) {
|
|
329
|
-
const
|
|
330
|
-
if (!Array.isArray(
|
|
329
|
+
const files = output[this.outputFileKey];
|
|
330
|
+
if (!Array.isArray(files))
|
|
331
331
|
return;
|
|
332
332
|
const options = {
|
|
333
333
|
height: 30,
|
|
334
334
|
};
|
|
335
|
-
return (await Promise.all(
|
|
335
|
+
return (await Promise.all(files.map(async (item) => {
|
|
336
336
|
const image = item.type === "local"
|
|
337
337
|
? await terminalImage.file(item.path, options)
|
|
338
338
|
: item.type === "file"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ChatModel,
|
|
1
|
+
import type { ChatModel, ChatModelInputOptions } from "@aigne/core";
|
|
2
2
|
import type { LoadCredentialOptions } from "./type.js";
|
|
3
3
|
export declare function maskApiKey(apiKey?: string): string | undefined;
|
|
4
4
|
export declare const parseModelOption: (model: string) => {
|
|
@@ -9,4 +9,4 @@ export declare const formatModelName: (model: string, inquirerPrompt: NonNullabl
|
|
|
9
9
|
provider: string;
|
|
10
10
|
model?: string;
|
|
11
11
|
}>;
|
|
12
|
-
export declare function loadChatModel(options?:
|
|
12
|
+
export declare function loadChatModel(options?: ChatModelInputOptions & LoadCredentialOptions): Promise<ChatModel>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AIGNE, type
|
|
1
|
+
import { AIGNE, type ChatModelInputOptions } from "@aigne/core";
|
|
2
2
|
import type { LoadCredentialOptions } from "./aigne-hub/type.js";
|
|
3
3
|
import type { AgentRunCommonOptions } from "./yargs.js";
|
|
4
4
|
export interface RunOptions extends AgentRunCommonOptions {
|
|
@@ -9,5 +9,5 @@ export interface RunOptions extends AgentRunCommonOptions {
|
|
|
9
9
|
}
|
|
10
10
|
export declare function loadAIGNE({ path, modelOptions, }: {
|
|
11
11
|
path?: string;
|
|
12
|
-
modelOptions?:
|
|
12
|
+
modelOptions?: ChatModelInputOptions & LoadCredentialOptions;
|
|
13
13
|
}): Promise<AIGNE<import("@aigne/core").UserContext>>;
|
|
@@ -12,8 +12,8 @@ export async function runChatLoopInTerminal(userAgent, options = {}) {
|
|
|
12
12
|
console.log(options.welcome);
|
|
13
13
|
if (initialCall) {
|
|
14
14
|
await callAgent(userAgent, initialCall, options);
|
|
15
|
-
if (options.input && options.
|
|
16
|
-
options.input = omit(options.input, options.
|
|
15
|
+
if (options.input && options.inputFileKey) {
|
|
16
|
+
options.input = omit(options.input, options.inputFileKey);
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
for (let i = 0;; i++) {
|
|
@@ -44,17 +44,17 @@ export async function runChatLoopInTerminal(userAgent, options = {}) {
|
|
|
44
44
|
continue;
|
|
45
45
|
}
|
|
46
46
|
const input = {};
|
|
47
|
-
if (options.
|
|
47
|
+
if (options.inputFileKey) {
|
|
48
48
|
const { message, files } = await extractFilesFromQuestion(question);
|
|
49
49
|
input[options.inputKey || DEFAULT_CHAT_INPUT_KEY] = message;
|
|
50
|
-
input[options.
|
|
50
|
+
input[options.inputFileKey] = files;
|
|
51
51
|
}
|
|
52
52
|
else {
|
|
53
53
|
input[options.inputKey || DEFAULT_CHAT_INPUT_KEY] = question;
|
|
54
54
|
}
|
|
55
55
|
await callAgent(userAgent, input, options);
|
|
56
|
-
if (options.input && options.
|
|
57
|
-
options.input = omit(options.input, options.
|
|
56
|
+
if (options.input && options.inputFileKey) {
|
|
57
|
+
options.input = omit(options.input, options.inputFileKey);
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Agent, type AIGNE, type
|
|
1
|
+
import { type Agent, type AIGNE, type ChatModelInputOptions, type Message } from "@aigne/core";
|
|
2
2
|
import { type PromiseOrValue } from "@aigne/core/utils/type-utils.js";
|
|
3
3
|
import { type ChatLoopOptions } from "./run-chat-loop.js";
|
|
4
4
|
import { type AgentRunCommonOptions } from "./yargs.js";
|
|
@@ -10,12 +10,12 @@ export declare function parseAgentInputByCommander(agent: Agent, options?: Agent
|
|
|
10
10
|
export declare function runWithAIGNE(agentCreator: ((aigne: AIGNE) => PromiseOrValue<Agent>) | Agent, { argv, chatLoopOptions, modelOptions, outputKey, }?: {
|
|
11
11
|
argv?: typeof process.argv;
|
|
12
12
|
chatLoopOptions?: ChatLoopOptions;
|
|
13
|
-
modelOptions?:
|
|
13
|
+
modelOptions?: ChatModelInputOptions;
|
|
14
14
|
outputKey?: string;
|
|
15
15
|
}): Promise<void>;
|
|
16
|
-
export declare function runAgentWithAIGNE(aigne: AIGNE, agent: Agent, { outputKey,
|
|
16
|
+
export declare function runAgentWithAIGNE(aigne: AIGNE, agent: Agent, { outputKey, outputFileKey, chatLoopOptions, ...options }?: {
|
|
17
17
|
outputKey?: string;
|
|
18
|
-
|
|
18
|
+
outputFileKey?: string;
|
|
19
19
|
chatLoopOptions?: ChatLoopOptions;
|
|
20
20
|
input?: Message;
|
|
21
21
|
} & Omit<AgentRunCommonOptions, "input">): Promise<{
|
|
@@ -74,7 +74,7 @@ export async function runWithAIGNE(agentCreator, { argv = process.argv, chatLoop
|
|
|
74
74
|
process.exit(1);
|
|
75
75
|
});
|
|
76
76
|
}
|
|
77
|
-
export async function runAgentWithAIGNE(aigne, agent, { outputKey,
|
|
77
|
+
export async function runAgentWithAIGNE(aigne, agent, { outputKey, outputFileKey, chatLoopOptions, ...options } = {}) {
|
|
78
78
|
if (options.output) {
|
|
79
79
|
const outputPath = isAbsolute(options.output)
|
|
80
80
|
? options.output
|
|
@@ -100,12 +100,12 @@ export async function runAgentWithAIGNE(aigne, agent, { outputKey, fileOutputKey
|
|
|
100
100
|
await runChatLoopInTerminal(userAgent, {
|
|
101
101
|
...chatLoopOptions,
|
|
102
102
|
outputKey,
|
|
103
|
-
|
|
103
|
+
inputFileKey: agent instanceof AIAgent ? agent.inputFileKey : undefined,
|
|
104
104
|
input: options.input,
|
|
105
105
|
});
|
|
106
106
|
return;
|
|
107
107
|
}
|
|
108
|
-
const tracer = new TerminalTracer(aigne.newContext(), { outputKey,
|
|
108
|
+
const tracer = new TerminalTracer(aigne.newContext(), { outputKey, outputFileKey });
|
|
109
109
|
const { result } = await tracer.run(agent, options.input ?? {});
|
|
110
110
|
if (options.output) {
|
|
111
111
|
const message = result[outputKey || DEFAULT_OUTPUT_KEY];
|
package/dist/utils/yargs.js
CHANGED
|
@@ -139,7 +139,7 @@ export async function parseAgentInput(i, agent) {
|
|
|
139
139
|
}
|
|
140
140
|
return [key, val];
|
|
141
141
|
})));
|
|
142
|
-
if (agent instanceof AIAgent && agent.
|
|
142
|
+
if (agent instanceof AIAgent && agent.inputFileKey) {
|
|
143
143
|
const files = [];
|
|
144
144
|
for (const file of i.inputFile ?? []) {
|
|
145
145
|
const raw = await readFile(file.replace(/^@/, ""), "base64");
|
|
@@ -147,7 +147,7 @@ export async function parseAgentInput(i, agent) {
|
|
|
147
147
|
const mimeType = ChatModel.getMimeType(filename) || "application/octet-stream";
|
|
148
148
|
files.push({ type: "file", data: raw, filename, mimeType });
|
|
149
149
|
}
|
|
150
|
-
Object.assign(input, { [agent.
|
|
150
|
+
Object.assign(input, { [agent.inputFileKey]: files });
|
|
151
151
|
}
|
|
152
152
|
const rawInput = i.input ||
|
|
153
153
|
(isatty(process.stdin.fd) || !(await stdinHasData())
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aigne/cli",
|
|
3
|
-
"version": "1.48.4-beta.
|
|
3
|
+
"version": "1.48.4-beta.2",
|
|
4
4
|
"description": "Your command center for agent development",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -81,13 +81,13 @@
|
|
|
81
81
|
"yargs": "^18.0.0",
|
|
82
82
|
"yoctocolors-cjs": "^2.1.3",
|
|
83
83
|
"zod": "^3.25.67",
|
|
84
|
-
"@aigne/
|
|
85
|
-
"@aigne/
|
|
86
|
-
"@aigne/
|
|
87
|
-
"@aigne/
|
|
88
|
-
"@aigne/
|
|
84
|
+
"@aigne/agent-library": "^1.21.46-beta.2",
|
|
85
|
+
"@aigne/core": "^1.61.0-beta.1",
|
|
86
|
+
"@aigne/agentic-memory": "^1.0.46-beta.2",
|
|
87
|
+
"@aigne/aigne-hub": "^0.10.0-beta.2",
|
|
88
|
+
"@aigne/default-memory": "^1.2.9-beta.2",
|
|
89
89
|
"@aigne/observability-api": "^0.10.4",
|
|
90
|
-
"@aigne/openai": "^0.16.0-beta.
|
|
90
|
+
"@aigne/openai": "^0.16.0-beta.2"
|
|
91
91
|
},
|
|
92
92
|
"devDependencies": {
|
|
93
93
|
"@inquirer/testing": "^2.1.50",
|
|
@@ -104,7 +104,7 @@
|
|
|
104
104
|
"rimraf": "^6.0.1",
|
|
105
105
|
"typescript": "^5.9.2",
|
|
106
106
|
"ufo": "^1.6.1",
|
|
107
|
-
"@aigne/test-utils": "^0.5.53-beta"
|
|
107
|
+
"@aigne/test-utils": "^0.5.53-beta.1"
|
|
108
108
|
},
|
|
109
109
|
"scripts": {
|
|
110
110
|
"lint": "tsc --noEmit",
|