@aigne/cli 1.53.1-beta.3 → 1.54.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 CHANGED
@@ -1,5 +1,50 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.54.0-beta.4](https://github.com/AIGNE-io/aigne-framework/compare/cli-v1.53.1-beta.4...cli-v1.54.0-beta.4) (2025-11-06)
4
+
5
+
6
+ ### Features
7
+
8
+ * add dynamic model options resolution with getter pattern ([#708](https://github.com/AIGNE-io/aigne-framework/issues/708)) ([5ed5085](https://github.com/AIGNE-io/aigne-framework/commit/5ed5085203763c70194853c56edc13acf56d81c6))
9
+
10
+
11
+ ### Dependencies
12
+
13
+ * The following workspace dependencies were updated
14
+ * dependencies
15
+ * @aigne/afs-system-fs bumped to 1.0.4-beta.5
16
+ * @aigne/agent-library bumped to 1.21.51-beta.4
17
+ * @aigne/agentic-memory bumped to 1.0.51-beta.4
18
+ * @aigne/aigne-hub bumped to 0.10.5-beta.4
19
+ * @aigne/core bumped to 1.66.0-beta.3
20
+ * @aigne/default-memory bumped to 1.2.14-beta.4
21
+ * @aigne/openai bumped to 0.16.5-beta.4
22
+ * devDependencies
23
+ * @aigne/test-utils bumped to 0.5.58-beta.4
24
+
25
+ ## [1.53.1-beta.4](https://github.com/AIGNE-io/aigne-framework/compare/cli-v1.53.1-beta.3...cli-v1.53.1-beta.4) (2025-11-05)
26
+
27
+
28
+ ### Bug Fixes
29
+
30
+ * **cli:** only auto-reinstall on agent loading errors ([#702](https://github.com/AIGNE-io/aigne-framework/issues/702)) ([52f61a4](https://github.com/AIGNE-io/aigne-framework/commit/52f61a47537f2be8763f7bd45b8baea94cf43e60))
31
+
32
+
33
+ ### Dependencies
34
+
35
+ * The following workspace dependencies were updated
36
+ * dependencies
37
+ * @aigne/afs-system-fs bumped to 1.0.4-beta.4
38
+ * @aigne/agent-library bumped to 1.21.51-beta.3
39
+ * @aigne/agentic-memory bumped to 1.0.51-beta.3
40
+ * @aigne/aigne-hub bumped to 0.10.5-beta.3
41
+ * @aigne/core bumped to 1.65.1-beta.3
42
+ * @aigne/default-memory bumped to 1.2.14-beta.3
43
+ * @aigne/observability-api bumped to 0.11.5-beta.2
44
+ * @aigne/openai bumped to 0.16.5-beta.3
45
+ * devDependencies
46
+ * @aigne/test-utils bumped to 0.5.58-beta.3
47
+
3
48
  ## [1.53.1-beta.3](https://github.com/AIGNE-io/aigne-framework/compare/cli-v1.53.1-beta.2...cli-v1.53.1-beta.3) (2025-11-04)
4
49
 
5
50
 
@@ -1,6 +1,8 @@
1
1
  import { homedir } from "node:os";
2
2
  import { join } from "node:path";
3
+ import { CHAT_MODEL_OPTIONS } from "@aigne/cli/constants.js";
3
4
  import { LogLevel, logger } from "@aigne/core/utils/logger.js";
5
+ import { pick } from "@aigne/core/utils/type-utils.js";
4
6
  import chalk from "chalk";
5
7
  import yargs from "yargs";
6
8
  import { hideBin } from "yargs/helpers";
@@ -27,7 +29,7 @@ export async function runAppCLI({ appName = process.env.AIGNE_APP_NAME, appPacka
27
29
  beta: appUseBetaVersion,
28
30
  dir,
29
31
  install: true,
30
- modelOptions: options,
32
+ modelOptions: pick(options, CHAT_MODEL_OPTIONS),
31
33
  imageModelOptions: { model: options.imageModel },
32
34
  skipModelLoading: (options.help || options.h || options.version || options.v) === true,
33
35
  });
@@ -1,6 +1,7 @@
1
1
  import { spawn } from "node:child_process";
2
2
  import { mkdir, readFile, rm, stat, writeFile } from "node:fs/promises";
3
3
  import { join } from "node:path";
4
+ import { LoadJsAgentError } from "@aigne/core/loader/error.js";
4
5
  import { fetch } from "@aigne/core/utils/fetch.js";
5
6
  import { Listr, PRESET_TIMER } from "@aigne/listr2";
6
7
  import { joinURL } from "ufo";
@@ -78,21 +79,22 @@ export async function loadApplication(options) {
78
79
  }
79
80
  if (!needUpdate) {
80
81
  const aigne = await loadAIGNE({
82
+ ...options,
81
83
  path: dir,
82
- skipModelLoading: options.skipModelLoading,
83
- modelOptions: options.modelOptions,
84
- imageModelOptions: options.imageModelOptions,
85
84
  metadata: {
86
85
  appName: packageName,
87
86
  appVersion: check?.version,
88
87
  },
89
88
  }).catch(async (error) => {
90
- await withSpinner("", async () => {
91
- await rm(options.dir, { recursive: true, force: true });
92
- await mkdir(options.dir, { recursive: true });
93
- });
94
- const message = `⚠️ Failed to load ${packageName}, trying to reinstall: ${error.message}`;
95
- throw beta ? new NeedReinstallBetaError(message) : new NeedReinstallError(message);
89
+ if (error instanceof LoadJsAgentError) {
90
+ await withSpinner("", async () => {
91
+ await rm(options.dir, { recursive: true, force: true });
92
+ await mkdir(options.dir, { recursive: true });
93
+ });
94
+ const message = `⚠️ Failed to load ${packageName}, trying to reinstall: ${error.message}`;
95
+ throw beta ? new NeedReinstallBetaError(message) : new NeedReinstallError(message);
96
+ }
97
+ throw error;
96
98
  });
97
99
  if (aigne) {
98
100
  return { aigne, version: check.version, isCache: true };
@@ -104,8 +106,8 @@ export async function loadApplication(options) {
104
106
  const result = await installApp({ dir, packageName, beta });
105
107
  return {
106
108
  aigne: await loadAIGNE({
109
+ ...options,
107
110
  path: dir,
108
- skipModelLoading: true,
109
111
  metadata: {
110
112
  appName: packageName,
111
113
  appVersion: result.version,
@@ -2,14 +2,17 @@ import { cp, mkdir, rm } from "node:fs/promises";
2
2
  import { homedir } from "node:os";
3
3
  import { isAbsolute, join, resolve } from "node:path";
4
4
  import { exists } from "@aigne/agent-library/utils/fs.js";
5
- import { flat, isNonNullable } from "@aigne/core/utils/type-utils.js";
5
+ import { logger } from "@aigne/core/utils/logger.js";
6
+ import { flat, isNonNullable, pick } from "@aigne/core/utils/type-utils.js";
6
7
  import { Listr, PRESET_TIMER } from "@aigne/listr2";
7
8
  import { config } from "dotenv-flow";
8
9
  import yargs from "yargs";
10
+ import { CHAT_MODEL_OPTIONS } from "../constants.js";
9
11
  import { isV1Package, toAIGNEPackage } from "../utils/agent-v1.js";
10
12
  import { downloadAndExtract } from "../utils/download.js";
11
13
  import { loadAIGNE } from "../utils/load-aigne.js";
12
14
  import { isUrl } from "../utils/url.js";
15
+ import { withRunAgentCommonOptions } from "../utils/yargs.js";
13
16
  import { agentCommandModule, cliAgentCommandModule } from "./app/agent.js";
14
17
  export function createRunCommand({ aigneFilePath, } = {}) {
15
18
  return {
@@ -37,7 +40,13 @@ export function createRunCommand({ aigneFilePath, } = {}) {
37
40
  options.path = undefined;
38
41
  }
39
42
  }
40
- const { aigne } = await loadApplication(aigneFilePath || options.path || ".");
43
+ // Parse model options for loading application
44
+ const opts = withRunAgentCommonOptions(yargs(process.argv).help(false).version(false).strict(false)).parseSync();
45
+ logger.level = opts.logLevel;
46
+ const { aigne } = await loadApplication(aigneFilePath || options.path || ".", {
47
+ modelOptions: pick(opts, CHAT_MODEL_OPTIONS),
48
+ imageModelOptions: { model: opts.imageModel },
49
+ });
41
50
  const subYargs = yargs().scriptName("").usage("aigne run <path> <agent> [...options]");
42
51
  if (aigne.cli.chat) {
43
52
  subYargs.command({
@@ -87,7 +96,7 @@ export function createRunCommand({ aigneFilePath, } = {}) {
87
96
  },
88
97
  };
89
98
  }
90
- async function loadApplication(path) {
99
+ async function loadApplication(path, options = {}) {
91
100
  const { cacheDir, dir } = prepareDirs(path);
92
101
  if (cacheDir) {
93
102
  await new Listr([
@@ -109,7 +118,7 @@ async function loadApplication(path) {
109
118
  }
110
119
  // Load env files in the aigne directory
111
120
  config({ path: dir, silent: true });
112
- const aigne = await loadAIGNE({ path: dir });
121
+ const aigne = await loadAIGNE({ ...options, path: dir });
113
122
  return { aigne, path: dir };
114
123
  }
115
124
  async function downloadPackage(url, cacheDir) {
@@ -2,3 +2,4 @@ import { DefaultMemory } from "@aigne/default-memory";
2
2
  export declare const AIGNE_CLI_VERSION: any;
3
3
  export declare const availableMemories: (typeof DefaultMemory)[];
4
4
  export declare const AIGNE_HUB_CREDITS_NOT_ENOUGH_ERROR_TYPE = "NOT_ENOUGH";
5
+ export declare const CHAT_MODEL_OPTIONS: string[];
package/dist/constants.js CHANGED
@@ -5,3 +5,15 @@ const require = createRequire(import.meta.url);
5
5
  export const AIGNE_CLI_VERSION = require("../package.json").version;
6
6
  export const availableMemories = [DefaultMemory, AgenticMemory];
7
7
  export const AIGNE_HUB_CREDITS_NOT_ENOUGH_ERROR_TYPE = "NOT_ENOUGH";
8
+ export const CHAT_MODEL_OPTIONS = [
9
+ "aigneHubUrl",
10
+ "model",
11
+ "temperature",
12
+ "topP",
13
+ "frequencyPenalty",
14
+ "presencePenalty",
15
+ "parallelToolCalls",
16
+ "modalities",
17
+ "preferInputFileType",
18
+ "reasoningEffort",
19
+ ];
@@ -1,9 +1,9 @@
1
- import type { ChatModel, ChatModelInputOptions, ImageModel, ImageModelInputOptions } from "@aigne/core";
1
+ import type { ChatModel, ChatModelInputOptionsWithGetter, ImageModel, ImageModelInputOptionsWithGetter } 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 formatModelName: (model: string, inquirerPrompt: NonNullable<LoadCredentialOptions["inquirerPromptFn"]>) => Promise<{
5
5
  provider: string;
6
6
  model?: string;
7
7
  }>;
8
- export declare function loadChatModel(options?: ChatModelInputOptions & LoadCredentialOptions): Promise<ChatModel>;
9
- export declare function loadImageModel(options?: ImageModelInputOptions & LoadCredentialOptions): Promise<ImageModel>;
8
+ export declare function loadChatModel(options?: ChatModelInputOptionsWithGetter & LoadCredentialOptions): Promise<ChatModel>;
9
+ export declare function loadImageModel(options?: ImageModelInputOptionsWithGetter & LoadCredentialOptions): Promise<ImageModel>;
@@ -61,7 +61,7 @@ export const formatModelName = async (model, inquirerPrompt) => {
61
61
  return { provider: AIGNE_HUB_PROVIDER, model: `${provider}/${name}` };
62
62
  };
63
63
  export async function loadChatModel(options) {
64
- const { provider, model } = await formatModelName(options?.model || process.env.MODEL || "", options?.inquirerPromptFn ??
64
+ const { provider, model } = await formatModelName((typeof options?.model === "string" ? options.model : undefined) || process.env.MODEL || "", options?.inquirerPromptFn ??
65
65
  inquirer.prompt);
66
66
  const { match, all } = findModel(provider);
67
67
  if (!match) {
@@ -78,7 +78,9 @@ export async function loadChatModel(options) {
78
78
  });
79
79
  }
80
80
  export async function loadImageModel(options) {
81
- const { provider, model } = await formatModelName(options?.model || process.env.IMAGE_MODEL || "", options?.inquirerPromptFn ??
81
+ const { provider, model } = await formatModelName((typeof options?.model === "string" ? options.model : undefined) ||
82
+ process.env.IMAGE_MODEL ||
83
+ "", options?.inquirerPromptFn ??
82
84
  inquirer.prompt);
83
85
  const { match, all } = findImageModel(provider);
84
86
  if (!match) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aigne/cli",
3
- "version": "1.53.1-beta.3",
3
+ "version": "1.54.0-beta.4",
4
4
  "description": "Your command center for agent development",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -89,14 +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/afs-system-fs": "^1.0.4-beta.3",
93
- "@aigne/agent-library": "^1.21.51-beta.2",
94
- "@aigne/agentic-memory": "^1.0.51-beta.2",
95
- "@aigne/core": "^1.65.1-beta.2",
96
- "@aigne/aigne-hub": "^0.10.5-beta.2",
97
- "@aigne/default-memory": "^1.2.14-beta.2",
98
- "@aigne/observability-api": "^0.11.5-beta.1",
99
- "@aigne/openai": "^0.16.5-beta.2"
92
+ "@aigne/afs-system-fs": "^1.0.4-beta.5",
93
+ "@aigne/agent-library": "^1.21.51-beta.4",
94
+ "@aigne/agentic-memory": "^1.0.51-beta.4",
95
+ "@aigne/aigne-hub": "^0.10.5-beta.4",
96
+ "@aigne/core": "^1.66.0-beta.3",
97
+ "@aigne/default-memory": "^1.2.14-beta.4",
98
+ "@aigne/observability-api": "^0.11.5-beta.2",
99
+ "@aigne/openai": "^0.16.5-beta.4"
100
100
  },
101
101
  "devDependencies": {
102
102
  "@inquirer/testing": "^2.1.50",
@@ -114,7 +114,7 @@
114
114
  "rimraf": "^6.0.1",
115
115
  "typescript": "^5.9.2",
116
116
  "ufo": "^1.6.1",
117
- "@aigne/test-utils": "^0.5.58-beta.2"
117
+ "@aigne/test-utils": "^0.5.58-beta.4"
118
118
  },
119
119
  "scripts": {
120
120
  "lint": "tsc --noEmit",