@aigne/cli 1.50.0-beta.3 → 1.50.0-beta.4
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/utils/aigne-hub/model.d.ts +2 -1
- package/dist/utils/aigne-hub/model.js +21 -1
- package/dist/utils/load-aigne.d.ts +3 -2
- package/dist/utils/load-aigne.js +8 -5
- package/dist/utils/workers/run-aigne-in-child-process-worker.js +3 -0
- package/dist/utils/yargs.d.ts +4 -0
- package/dist/utils/yargs.js +17 -9
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.50.0-beta.4](https://github.com/AIGNE-io/aigne-framework/compare/cli-v1.50.0-beta.3...cli-v1.50.0-beta.4) (2025-10-01)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* **cli:** load image model base on agent definition ([#577](https://github.com/AIGNE-io/aigne-framework/issues/577)) ([f1b7205](https://github.com/AIGNE-io/aigne-framework/commit/f1b7205904ed47b0c00199964eda74581473d805))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Dependencies
|
|
12
|
+
|
|
13
|
+
* The following workspace dependencies were updated
|
|
14
|
+
* dependencies
|
|
15
|
+
* @aigne/agent-library bumped to 1.21.47-beta.3
|
|
16
|
+
* @aigne/agentic-memory bumped to 1.0.47-beta.3
|
|
17
|
+
* @aigne/aigne-hub bumped to 0.10.1-beta.3
|
|
18
|
+
* @aigne/core bumped to 1.62.0-beta.2
|
|
19
|
+
* @aigne/default-memory bumped to 1.2.10-beta.3
|
|
20
|
+
* @aigne/openai bumped to 0.16.1-beta.3
|
|
21
|
+
* devDependencies
|
|
22
|
+
* @aigne/test-utils bumped to 0.5.54-beta.3
|
|
23
|
+
|
|
3
24
|
## [1.50.0-beta.3](https://github.com/AIGNE-io/aigne-framework/compare/cli-v1.50.0-beta.2...cli-v1.50.0-beta.3) (2025-10-01)
|
|
4
25
|
|
|
5
26
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ChatModel, ChatModelInputOptions } from "@aigne/core";
|
|
1
|
+
import type { ChatModel, ChatModelInputOptions, ImageModel, ImageModelInputOptions } 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) => {
|
|
@@ -10,3 +10,4 @@ export declare const formatModelName: (model: string, inquirerPrompt: NonNullabl
|
|
|
10
10
|
model?: string;
|
|
11
11
|
}>;
|
|
12
12
|
export declare function loadChatModel(options?: ChatModelInputOptions & LoadCredentialOptions): Promise<ChatModel>;
|
|
13
|
+
export declare function loadImageModel(options?: ImageModelInputOptions & LoadCredentialOptions): Promise<ImageModel>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { readFile } from "node:fs/promises";
|
|
2
|
-
import { AIGNE_HUB_DEFAULT_MODEL, findModel } from "@aigne/aigne-hub";
|
|
2
|
+
import { AIGNE_HUB_DEFAULT_MODEL, findImageModel, findModel } from "@aigne/aigne-hub";
|
|
3
3
|
import { flat, pick } from "@aigne/core/utils/type-utils.js";
|
|
4
4
|
import chalk from "chalk";
|
|
5
5
|
import inquirer from "inquirer";
|
|
@@ -84,3 +84,23 @@ export async function loadChatModel(options) {
|
|
|
84
84
|
modelOptions: { ...params },
|
|
85
85
|
});
|
|
86
86
|
}
|
|
87
|
+
export async function loadImageModel(options) {
|
|
88
|
+
const { provider, model } = await formatModelName(options?.model || process.env.IMAGE_MODEL || "", options?.inquirerPromptFn ??
|
|
89
|
+
inquirer.prompt);
|
|
90
|
+
const params = {
|
|
91
|
+
model,
|
|
92
|
+
...pick(options ?? {}, ["preferInputFileType"]),
|
|
93
|
+
};
|
|
94
|
+
const { match, all } = findImageModel(provider);
|
|
95
|
+
if (!match) {
|
|
96
|
+
throw new Error(`Unsupported image model provider ${provider}, available providers: ${all.map((m) => m.name).join(", ")}`);
|
|
97
|
+
}
|
|
98
|
+
const credential = provider.toLowerCase().includes(AIGNE_HUB_PROVIDER)
|
|
99
|
+
? await loadAIGNEHubCredential(options)
|
|
100
|
+
: undefined;
|
|
101
|
+
return match.create({
|
|
102
|
+
...credential,
|
|
103
|
+
model: params.model,
|
|
104
|
+
modelOptions: { ...params },
|
|
105
|
+
});
|
|
106
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AIGNE, type ChatModelInputOptions } from "@aigne/core";
|
|
1
|
+
import { AIGNE, type ChatModelInputOptions, type ImageModelInputOptions } 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 {
|
|
@@ -7,8 +7,9 @@ export interface RunOptions extends AgentRunCommonOptions {
|
|
|
7
7
|
cacheDir?: string;
|
|
8
8
|
aigneHubUrl?: string;
|
|
9
9
|
}
|
|
10
|
-
export declare function loadAIGNE({ path, modelOptions, printTips, }: {
|
|
10
|
+
export declare function loadAIGNE({ path, modelOptions, imageModelOptions, printTips, }: {
|
|
11
11
|
path?: string;
|
|
12
12
|
modelOptions?: ChatModelInputOptions & LoadCredentialOptions;
|
|
13
|
+
imageModelOptions?: ImageModelInputOptions & LoadCredentialOptions;
|
|
13
14
|
printTips?: boolean;
|
|
14
15
|
}): Promise<AIGNE<import("@aigne/core").UserContext>>;
|
package/dist/utils/load-aigne.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { AIGNE } from "@aigne/core";
|
|
1
|
+
import { AIGNE, } from "@aigne/core";
|
|
2
2
|
import { isNil, omitBy } from "@aigne/core/utils/type-utils.js";
|
|
3
|
-
import { OpenAIImageModel } from "@aigne/openai";
|
|
4
3
|
import boxen from "boxen";
|
|
5
4
|
import chalk from "chalk";
|
|
6
5
|
import { availableMemories } from "../constants.js";
|
|
7
|
-
import { loadChatModel, maskApiKey } from "./aigne-hub/model.js";
|
|
6
|
+
import { loadChatModel, loadImageModel, maskApiKey } from "./aigne-hub/model.js";
|
|
8
7
|
import { getUrlOrigin } from "./get-url-origin.js";
|
|
9
8
|
let printed = false;
|
|
10
9
|
async function printChatModelInfoBox(model) {
|
|
@@ -22,7 +21,7 @@ async function printChatModelInfoBox(model) {
|
|
|
22
21
|
console.log(boxen(lines.join("\n"), { padding: 1, borderStyle: "classic", borderColor: "cyan" }));
|
|
23
22
|
console.log("");
|
|
24
23
|
}
|
|
25
|
-
export async function loadAIGNE({ path, modelOptions, printTips = true, }) {
|
|
24
|
+
export async function loadAIGNE({ path, modelOptions, imageModelOptions, printTips = true, }) {
|
|
26
25
|
let aigne;
|
|
27
26
|
if (path) {
|
|
28
27
|
aigne = await AIGNE.load(path, {
|
|
@@ -32,7 +31,11 @@ export async function loadAIGNE({ path, modelOptions, printTips = true, }) {
|
|
|
32
31
|
...omitBy(modelOptions ?? {}, (v) => isNil(v)),
|
|
33
32
|
model: modelOptions?.model || process.env.MODEL || options?.model,
|
|
34
33
|
}),
|
|
35
|
-
imageModel: () =>
|
|
34
|
+
imageModel: (options) => loadImageModel({
|
|
35
|
+
...options,
|
|
36
|
+
...omitBy(imageModelOptions ?? {}, (v) => isNil(v)),
|
|
37
|
+
model: imageModelOptions?.model || process.env.IMAGE_MODEL || options?.model,
|
|
38
|
+
}),
|
|
36
39
|
});
|
|
37
40
|
}
|
|
38
41
|
else {
|
|
@@ -53,6 +53,9 @@ export async function invokeCLIAgentFromDirInChildProcess(options) {
|
|
|
53
53
|
const aigne = await loadAIGNE({
|
|
54
54
|
path: options.dir,
|
|
55
55
|
modelOptions: options.input,
|
|
56
|
+
imageModelOptions: {
|
|
57
|
+
model: options.input.imageModel,
|
|
58
|
+
},
|
|
56
59
|
});
|
|
57
60
|
try {
|
|
58
61
|
const { chat } = aigne.cli;
|
package/dist/utils/yargs.d.ts
CHANGED
|
@@ -7,6 +7,8 @@ export declare const withRunAgentCommonOptions: (yargs: Argv) => Argv<{
|
|
|
7
7
|
chat: boolean;
|
|
8
8
|
} & {
|
|
9
9
|
model: string | undefined;
|
|
10
|
+
} & {
|
|
11
|
+
"image-model": string | undefined;
|
|
10
12
|
} & {
|
|
11
13
|
temperature: number | undefined;
|
|
12
14
|
} & {
|
|
@@ -54,6 +56,8 @@ export declare function withAgentInputSchema(yargs: Argv, agent: Pick<Agent, "in
|
|
|
54
56
|
chat: boolean;
|
|
55
57
|
} & {
|
|
56
58
|
model: string | undefined;
|
|
59
|
+
} & {
|
|
60
|
+
"image-model": string | undefined;
|
|
57
61
|
} & {
|
|
58
62
|
temperature: number | undefined;
|
|
59
63
|
} & {
|
package/dist/utils/yargs.js
CHANGED
|
@@ -3,7 +3,7 @@ import { readFile } from "node:fs/promises";
|
|
|
3
3
|
import { basename, extname } from "node:path";
|
|
4
4
|
import { isatty } from "node:tty";
|
|
5
5
|
import { promisify } from "node:util";
|
|
6
|
-
import { availableModels } from "@aigne/aigne-hub";
|
|
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
9
|
import { pick, tryOrThrow } from "@aigne/core/utils/type-utils.js";
|
|
@@ -18,14 +18,12 @@ export const withRunAgentCommonOptions = (yargs) => yargs
|
|
|
18
18
|
})
|
|
19
19
|
.option("model", {
|
|
20
20
|
group: MODEL_OPTIONS_GROUP_NAME,
|
|
21
|
-
describe: `AI model to use in format 'provider[
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
})
|
|
28
|
-
.join(", ")} (default: openai)`,
|
|
21
|
+
describe: `AI model to use in format 'provider[/model]' where model is optional. Examples: 'openai' or 'openai/gpt-4o-mini'. Available providers: ${formatModelsName(availableModels())} (default: openai)`,
|
|
22
|
+
type: "string",
|
|
23
|
+
})
|
|
24
|
+
.option("image-model", {
|
|
25
|
+
group: MODEL_OPTIONS_GROUP_NAME,
|
|
26
|
+
describe: `Image model to use in format 'provider[/model]' where model is optional. Examples: 'openai' or 'openai/gpt-image-1'. Available providers: ${formatModelsName(availableImageModels())} (default: openai)`,
|
|
29
27
|
type: "string",
|
|
30
28
|
})
|
|
31
29
|
.option("temperature", {
|
|
@@ -94,6 +92,16 @@ export const withRunAgentCommonOptions = (yargs) => yargs
|
|
|
94
92
|
describe: "Custom AIGNE Hub service URL. Used to fetch remote agent definitions or models.",
|
|
95
93
|
type: "string",
|
|
96
94
|
});
|
|
95
|
+
function formatModelsName(models) {
|
|
96
|
+
return models
|
|
97
|
+
.map((i) => {
|
|
98
|
+
if (typeof i.name === "string") {
|
|
99
|
+
return i.name.toLowerCase().replace(/ChatModel$/i, "");
|
|
100
|
+
}
|
|
101
|
+
return i.name.map((n) => n.toLowerCase().replace(/ChatModel$/i, ""));
|
|
102
|
+
})
|
|
103
|
+
.join(", ");
|
|
104
|
+
}
|
|
97
105
|
export function inferZodType(type, opts = {}) {
|
|
98
106
|
if (type instanceof ZodUnknown || type instanceof ZodAny) {
|
|
99
107
|
return { type: "string", optional: true };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aigne/cli",
|
|
3
|
-
"version": "1.50.0-beta.
|
|
3
|
+
"version": "1.50.0-beta.4",
|
|
4
4
|
"description": "Your command center for agent development",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -89,13 +89,13 @@
|
|
|
89
89
|
"yoctocolors-cjs": "^2.1.3",
|
|
90
90
|
"zod": "^3.25.67",
|
|
91
91
|
"zod-to-json-schema": "^3.24.6",
|
|
92
|
-
"@aigne/agent-library": "^1.21.47-beta.
|
|
93
|
-
"@aigne/agentic-memory": "^1.0.47-beta.
|
|
94
|
-
"@aigne/
|
|
95
|
-
"@aigne/
|
|
96
|
-
"@aigne/
|
|
92
|
+
"@aigne/agent-library": "^1.21.47-beta.3",
|
|
93
|
+
"@aigne/agentic-memory": "^1.0.47-beta.3",
|
|
94
|
+
"@aigne/aigne-hub": "^0.10.1-beta.3",
|
|
95
|
+
"@aigne/default-memory": "^1.2.10-beta.3",
|
|
96
|
+
"@aigne/core": "^1.62.0-beta.2",
|
|
97
97
|
"@aigne/observability-api": "^0.11.1-beta",
|
|
98
|
-
"@aigne/openai": "^0.16.1-beta.
|
|
98
|
+
"@aigne/openai": "^0.16.1-beta.3"
|
|
99
99
|
},
|
|
100
100
|
"devDependencies": {
|
|
101
101
|
"@inquirer/testing": "^2.1.50",
|
|
@@ -112,7 +112,7 @@
|
|
|
112
112
|
"rimraf": "^6.0.1",
|
|
113
113
|
"typescript": "^5.9.2",
|
|
114
114
|
"ufo": "^1.6.1",
|
|
115
|
-
"@aigne/test-utils": "^0.5.54-beta.
|
|
115
|
+
"@aigne/test-utils": "^0.5.54-beta.3"
|
|
116
116
|
},
|
|
117
117
|
"scripts": {
|
|
118
118
|
"lint": "tsc --noEmit",
|