@aigne/cli 1.40.0 → 1.41.1

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,54 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.41.1](https://github.com/AIGNE-io/aigne-framework/compare/cli-v1.41.0...cli-v1.41.1) (2025-08-26)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * **cli:** reduce memory usage of AIGNE CLI ([#411](https://github.com/AIGNE-io/aigne-framework/issues/411)) ([9c36969](https://github.com/AIGNE-io/aigne-framework/commit/9c369699d966d37abf2d6a1624eac3d2fda4123b))
9
+ * **cli:** use corepack instead of npm install deps ([#413](https://github.com/AIGNE-io/aigne-framework/issues/413)) ([1b9150c](https://github.com/AIGNE-io/aigne-framework/commit/1b9150c534bfd0cfbb51f5bed51fff609da93628))
10
+ * optimize hub connect copy ([#415](https://github.com/AIGNE-io/aigne-framework/issues/415)) ([8acc4ad](https://github.com/AIGNE-io/aigne-framework/commit/8acc4adf5815afc9564235eeb40b09293c6ab00c))
11
+
12
+
13
+ ### Dependencies
14
+
15
+ * The following workspace dependencies were updated
16
+ * dependencies
17
+ * @aigne/agent-library bumped to 1.21.28
18
+ * @aigne/agentic-memory bumped to 1.0.28
19
+ * @aigne/aigne-hub bumped to 0.6.10
20
+ * @aigne/core bumped to 1.55.1
21
+ * @aigne/default-memory bumped to 1.1.10
22
+ * @aigne/observability-api bumped to 0.10.1
23
+ * @aigne/openai bumped to 0.12.4
24
+ * devDependencies
25
+ * @aigne/test-utils bumped to 0.5.36
26
+
27
+ ## [1.41.0](https://github.com/AIGNE-io/aigne-framework/compare/cli-v1.40.0...cli-v1.41.0) (2025-08-25)
28
+
29
+
30
+ ### Features
31
+
32
+ * **ux:** use standard blocklet layout in aigne runtime ([#403](https://github.com/AIGNE-io/aigne-framework/issues/403)) ([a14274d](https://github.com/AIGNE-io/aigne-framework/commit/a14274dbf970bae7fed0eff150933ecf0f65eb64))
33
+
34
+
35
+ ### Bug Fixes
36
+
37
+ * **cli:** prefer variables from process.env when loadChatModel ([#407](https://github.com/AIGNE-io/aigne-framework/issues/407)) ([d32b2db](https://github.com/AIGNE-io/aigne-framework/commit/d32b2db20435a022d944a674e90333899d881daf))
38
+
39
+
40
+ ### Dependencies
41
+
42
+ * The following workspace dependencies were updated
43
+ * dependencies
44
+ * @aigne/agent-library bumped to 1.21.27
45
+ * @aigne/agentic-memory bumped to 1.0.27
46
+ * @aigne/aigne-hub bumped to 0.6.9
47
+ * @aigne/default-memory bumped to 1.1.9
48
+ * @aigne/openai bumped to 0.12.3
49
+ * devDependencies
50
+ * @aigne/test-utils bumped to 0.5.35
51
+
3
52
  ## [1.40.0](https://github.com/AIGNE-io/aigne-framework/compare/cli-v1.39.1...cli-v1.40.0) (2025-08-22)
4
53
 
5
54
 
@@ -186,9 +186,10 @@ async function isInstallationAvailable(dir, { cacheTimeMs = NPM_PACKAGE_CACHE_TI
186
186
  }
187
187
  async function installDependencies(dir, { log } = {}) {
188
188
  await new Promise((resolve, reject) => {
189
- const child = spawn("npm", ["install", "--omit", "dev", "--verbose"], {
189
+ const child = spawn("corepack", ["npm", "install", "--omit", "dev", "--verbose"], {
190
190
  cwd: dir,
191
191
  stdio: "pipe",
192
+ shell: process.platform === "win32",
192
193
  });
193
194
  child.stdout.on("data", (data) => {
194
195
  log?.(data.toString());
@@ -80,8 +80,6 @@ export function createRunCommand({ aigneFilePath, } = {}) {
80
80
  path: dir,
81
81
  modelOptions: {
82
82
  ...options,
83
- model: options.model || process.env.MODEL,
84
- aigneHubUrl: options?.aigneHubUrl,
85
83
  inquirerPromptFn: (prompt) => {
86
84
  if (prompt.type === "input") {
87
85
  return task
@@ -12,6 +12,7 @@ import { AIGNE_HUB_CREDITS_NOT_ENOUGH_ERROR_TYPE } from "../constants.js";
12
12
  import { AIGNEListr, AIGNEListrRenderer } from "../utils/listr.js";
13
13
  import { highlightUrl } from "../utils/string-utils.js";
14
14
  import { parseDuration } from "../utils/time.js";
15
+ const CREDITS_ERROR_PROCESSED_FLAG = "$credits_error_processed";
15
16
  export class TerminalTracer {
16
17
  context;
17
18
  options;
@@ -26,7 +27,7 @@ export class TerminalTracer {
26
27
  const listr = new AIGNEListr({
27
28
  formatRequest: (options) => this.formatRequest(agent, context, input, options),
28
29
  formatResult: (result, options) => [this.formatResult(agent, context, result, options)].filter(Boolean),
29
- }, [], { concurrent: true });
30
+ }, [], { concurrent: true, exitOnError: false });
30
31
  this.listr = listr;
31
32
  const collapsedMap = new Map();
32
33
  const hideContextIds = new Set();
@@ -145,10 +146,16 @@ export class TerminalTracer {
145
146
  };
146
147
  const onError = async ({ context, agent, error, ...event }) => {
147
148
  if ("type" in error && error.type === AIGNE_HUB_CREDITS_NOT_ENOUGH_ERROR_TYPE) {
148
- const retry = await this.promptBuyCredits(error);
149
- console.log("");
150
- if (retry === "retry") {
151
- return { retry: true };
149
+ if (!Object.hasOwn(error, CREDITS_ERROR_PROCESSED_FLAG)) {
150
+ Object.defineProperty(error, CREDITS_ERROR_PROCESSED_FLAG, {
151
+ value: true,
152
+ enumerable: false,
153
+ });
154
+ const retry = await this.promptBuyCredits(error);
155
+ console.log("");
156
+ if (retry === "retry") {
157
+ return { retry: true };
158
+ }
152
159
  }
153
160
  }
154
161
  const contextId = context.id;
@@ -31,14 +31,14 @@ export const formatModelName = async (model, inquirerPrompt) => {
31
31
  const result = await inquirerPrompt({
32
32
  type: "list",
33
33
  name: "useAigneHub",
34
- message: `Seems no API Key configured for ${provider}/${name}, select your preferred way to continue:`,
34
+ message: `No API key is configured for ${provider}/${name}, How would you like to proceed?`,
35
35
  choices: [
36
36
  {
37
- name: `Connect to AIGNE Hub to use ${name} (Recommended since free credits available)`,
37
+ name: `Connect to AIGNE Hub to use ${name} (recommended includes free credits)`,
38
38
  value: true,
39
39
  },
40
40
  {
41
- name: `Exit and bring my owner API Key by set ${requireEnvs.join(", ")}`,
41
+ name: `Exit and use my own API key (set ${requireEnvs.join(" or ")})`,
42
42
  value: false,
43
43
  },
44
44
  ],
@@ -11,6 +11,7 @@ export declare class AIGNEListr extends Listr<object, typeof AIGNEListrRenderer,
11
11
  }) => string[];
12
12
  };
13
13
  private result;
14
+ private error?;
14
15
  private logs;
15
16
  private spinner;
16
17
  constructor(myOptions: {
@@ -2,11 +2,12 @@ import { EOL } from "node:os";
2
2
  import { format } from "node:util";
3
3
  import { LogLevel, logger } from "@aigne/core/utils/logger.js";
4
4
  import { mergeAgentResponseChunk } from "@aigne/core/utils/stream-utils.js";
5
- import { DefaultRenderer, Listr, ListrDefaultRendererLogLevels, ListrLogger, SimpleRenderer, Spinner, } from "@aigne/listr2";
5
+ import { color, DefaultRenderer, figures, Listr, ListrDefaultRendererLogLevels, ListrLogger, SimpleRenderer, Spinner, } from "@aigne/listr2";
6
6
  import wrap from "wrap-ansi";
7
7
  export class AIGNEListr extends Listr {
8
8
  myOptions;
9
9
  result = {};
10
+ error;
10
11
  logs = [];
11
12
  spinner;
12
13
  constructor(myOptions, ...[task, options, parentTask]) {
@@ -25,6 +26,10 @@ export class AIGNEListr extends Listr {
25
26
  collapseSubtasks: false,
26
27
  icon: {
27
28
  [ListrDefaultRendererLogLevels.PENDING]: () => this.spinner.fetch(),
29
+ [ListrDefaultRendererLogLevels.COMPLETED_WITH_FAILED_SUBTASKS]: figures.cross,
30
+ },
31
+ color: {
32
+ [ListrDefaultRendererLogLevels.COMPLETED_WITH_FAILED_SUBTASKS]: (m) => m ? color.red(m) : "",
28
33
  },
29
34
  aigne: aigneOptions,
30
35
  },
@@ -66,7 +71,11 @@ export class AIGNEListr extends Listr {
66
71
  }
67
72
  const _stream = await stream();
68
73
  this.add({ task: () => this.extractStream(_stream) });
69
- return await super.run().then(() => ({ ...this.result }));
74
+ return await super.run().then(() => {
75
+ if (this.error)
76
+ throw this.error;
77
+ return { ...this.result };
78
+ });
70
79
  }
71
80
  finally {
72
81
  logger.logMessage = originalLog;
@@ -75,11 +84,17 @@ export class AIGNEListr extends Listr {
75
84
  }
76
85
  }
77
86
  async extractStream(stream) {
78
- this.result = {};
79
- for await (const value of stream) {
80
- mergeAgentResponseChunk(this.result, value);
87
+ try {
88
+ this.result = {};
89
+ for await (const value of stream) {
90
+ mergeAgentResponseChunk(this.result, value);
91
+ }
92
+ return this.result;
93
+ }
94
+ catch (error) {
95
+ this.error = error;
96
+ throw error;
81
97
  }
82
- return this.result;
83
98
  }
84
99
  }
85
100
  export class AIGNEListrRenderer extends DefaultRenderer {
@@ -30,7 +30,11 @@ export async function loadAIGNE({ path, modelOptions, }) {
30
30
  if (path) {
31
31
  aigne = await AIGNE.load(path, {
32
32
  memories: availableMemories,
33
- model: (options) => loadChatModel({ ...options, ...omitBy(modelOptions ?? {}, (v) => isNil(v)) }),
33
+ model: (options) => loadChatModel({
34
+ ...options,
35
+ ...omitBy(modelOptions ?? {}, (v) => isNil(v)),
36
+ model: modelOptions?.model || process.env.MODEL || options?.model,
37
+ }),
34
38
  imageModel: () => new OpenAIImageModel(),
35
39
  });
36
40
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aigne/cli",
3
- "version": "1.40.0",
3
+ "version": "1.41.1",
4
4
  "description": "Your command center for agent development",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -75,13 +75,13 @@
75
75
  "yaml": "^2.8.0",
76
76
  "yargs": "^18.0.0",
77
77
  "zod": "^3.25.67",
78
- "@aigne/agent-library": "^1.21.26",
79
- "@aigne/aigne-hub": "^0.6.8",
80
- "@aigne/agentic-memory": "^1.0.26",
81
- "@aigne/core": "^1.55.0",
82
- "@aigne/default-memory": "^1.1.8",
83
- "@aigne/observability-api": "^0.10.0",
84
- "@aigne/openai": "^0.12.2"
78
+ "@aigne/agent-library": "^1.21.28",
79
+ "@aigne/agentic-memory": "^1.0.28",
80
+ "@aigne/aigne-hub": "^0.6.10",
81
+ "@aigne/default-memory": "^1.1.10",
82
+ "@aigne/openai": "^0.12.4",
83
+ "@aigne/observability-api": "^0.10.1",
84
+ "@aigne/core": "^1.55.1"
85
85
  },
86
86
  "devDependencies": {
87
87
  "@types/archiver": "^6.0.3",
@@ -96,7 +96,8 @@
96
96
  "npm-run-all": "^4.1.5",
97
97
  "rimraf": "^6.0.1",
98
98
  "typescript": "^5.8.3",
99
- "ufo": "^1.6.1"
99
+ "ufo": "^1.6.1",
100
+ "@aigne/test-utils": "^0.5.36"
100
101
  },
101
102
  "scripts": {
102
103
  "lint": "tsc --noEmit",
@@ -54,4 +54,3 @@ capabilities:
54
54
  component: true
55
55
  navigation: true
56
56
  components: []
57
-
Binary file