@aigne/cli 1.59.0-beta.8 → 1.59.0-beta.9

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,30 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.59.0-beta.9](https://github.com/AIGNE-io/aigne-framework/compare/cli-v1.59.0-beta.8...cli-v1.59.0-beta.9) (2025-12-26)
4
+
5
+
6
+ ### Features
7
+
8
+ * **core:** add session history support ([#858](https://github.com/AIGNE-io/aigne-framework/issues/858)) ([28a070e](https://github.com/AIGNE-io/aigne-framework/commit/28a070ed33b821d1fd344b899706d817ca992b9f))
9
+
10
+
11
+ ### Dependencies
12
+
13
+ * The following workspace dependencies were updated
14
+ * dependencies
15
+ * @aigne/afs bumped to 1.4.0-beta.4
16
+ * @aigne/afs-history bumped to 1.2.0-beta.4
17
+ * @aigne/afs-local-fs bumped to 1.4.0-beta.7
18
+ * @aigne/agent-library bumped to 1.24.0-beta.8
19
+ * @aigne/agentic-memory bumped to 1.1.6-beta.7
20
+ * @aigne/aigne-hub bumped to 0.10.16-beta.10
21
+ * @aigne/core bumped to 1.72.0-beta.7
22
+ * @aigne/default-memory bumped to 1.4.0-beta.6
23
+ * @aigne/openai bumped to 0.16.16-beta.7
24
+ * @aigne/secrets bumped to 0.1.6-beta.7
25
+ * devDependencies
26
+ * @aigne/test-utils bumped to 0.5.69-beta.7
27
+
3
28
  ## [1.59.0-beta.8](https://github.com/AIGNE-io/aigne-framework/compare/cli-v1.59.0-beta.7...cli-v1.59.0-beta.8) (2025-12-25)
4
29
 
5
30
 
@@ -1,5 +1,6 @@
1
1
  import assert from "node:assert";
2
2
  import { logger } from "@aigne/core/utils/logger.js";
3
+ import { v7 } from "@aigne/uuid";
3
4
  import { runAgentWithAIGNE } from "../../utils/run-with-aigne.js";
4
5
  import { parseAgentInput, withAgentInputSchema, } from "../../utils/yargs.js";
5
6
  import { serveMCPServerFromDir } from "../serve-mcp.js";
@@ -97,6 +98,7 @@ export async function invokeAgent(options) {
97
98
  ...options.input,
98
99
  input,
99
100
  chat: options.input.chat,
101
+ sessionId: v7(),
100
102
  });
101
103
  }
102
104
  finally {
@@ -6,6 +6,7 @@ export declare function terminalInput({ render: r, ...options }?: {
6
6
  required?: boolean;
7
7
  validate?: (input: string) => string | boolean | Promise<string | boolean>;
8
8
  render?: typeof render;
9
+ clear?: boolean;
9
10
  }): Promise<string>;
10
11
  export declare function TerminalInput(props: {
11
12
  message?: string;
@@ -12,10 +12,14 @@ export async function terminalInput({ render: r = render, ...options } = {}) {
12
12
  process.addListener("SIGINT", handleSigInt);
13
13
  const clean = () => process.removeListener("SIGINT", handleSigInt);
14
14
  const app = r(_jsx(TerminalInput, { ...options, onSubmit: (value) => {
15
+ if (options.clear)
16
+ app.clear();
15
17
  app.unmount();
16
18
  resolve(value);
17
19
  clean();
18
20
  }, onError: (error) => {
21
+ if (options.clear)
22
+ app.clear();
19
23
  app.unmount();
20
24
  reject(error);
21
25
  clean();
@@ -116,21 +116,32 @@ export class AIGNEListr extends Listr {
116
116
  for await (const value of stream) {
117
117
  mergeAgentResponseChunk(this.result, value);
118
118
  if (isAgentResponseProgress(value) && value.progress.event === "message") {
119
- const { role, message } = value.progress;
119
+ const { message } = value.progress;
120
120
  const rendered = [];
121
- for (const msg of message) {
122
- if (msg.type === "text") {
123
- rendered.push(this.marked.parse(msg.content, { async: false }).trim());
121
+ if (message.role === "user" || message.role === "agent") {
122
+ if (message.role === "agent" && message.toolCalls) {
123
+ for (const call of message.toolCalls) {
124
+ rendered.push(`${chalk.bold.gray(`[${call.function.name}]`)} ${chalk.gray(`${JSON.stringify(call.function.arguments).slice(0, 200)}...`)}`);
125
+ }
124
126
  }
125
- else if (msg.type === "thinking") {
126
- rendered.push(chalk.dim(chalk.grey(chalk.italic(`[Thinking] ${msg.thoughts}`))));
127
+ else if (typeof message.content === "string") {
128
+ rendered.push(this.marked.parse(message.content, { async: false }).trim());
127
129
  }
128
- else if (msg.type === "tool_use") {
129
- rendered.push(`${chalk.bold.gray(`[${msg.name}]`)} ${chalk.gray(`${JSON.stringify(msg.input).slice(0, 200)}...`)}`);
130
+ else if (Array.isArray(message.content)) {
131
+ for (const msg of message.content) {
132
+ if (msg.type === "text") {
133
+ if (msg.isThinking) {
134
+ rendered.push(chalk.dim(chalk.grey(chalk.italic(`[Thinking] ${msg.text}`))));
135
+ }
136
+ else {
137
+ rendered.push(this.marked.parse(msg.text, { async: false }).trim());
138
+ }
139
+ }
140
+ }
130
141
  }
131
142
  }
132
143
  if (rendered.length) {
133
- const prefix = role === "user" ? chalk.blue.bold(">") : chalk.green.bold("•");
144
+ const prefix = message.role === "user" ? chalk.blue.bold(">") : chalk.green.bold("•");
134
145
  console.log(`${prefix} ${rendered.join("\n")}\n`);
135
146
  this.needLogResult = false;
136
147
  }
@@ -1,6 +1,7 @@
1
1
  import { type Message, type UserAgent } from "@aigne/core";
2
2
  export declare const DEFAULT_CHAT_INPUT_KEY = "message";
3
3
  export interface ChatLoopOptions {
4
+ sessionId?: string;
4
5
  initialCall?: Message | string;
5
6
  welcome?: string;
6
7
  defaultQuestion?: string;
@@ -19,6 +19,7 @@ export async function runChatLoopInTerminal(userAgent, options = {}) {
19
19
  const question = await terminalInput({
20
20
  message: "💬",
21
21
  default: i === 0 ? options?.defaultQuestion : undefined,
22
+ clear: true,
22
23
  });
23
24
  if (!question?.trim())
24
25
  continue;
@@ -74,7 +75,7 @@ async function callAgent(userAgent, input, options) {
74
75
  const tracer = new TerminalTracer(userAgent.context, options);
75
76
  await tracer.run(userAgent, typeof input === "string"
76
77
  ? { ...options.input, [options.inputKey || DEFAULT_CHAT_INPUT_KEY]: input }
77
- : { ...options.input, ...input });
78
+ : { ...options.input, ...input }, { userContext: { sessionId: options.sessionId } });
78
79
  }
79
80
  const COMMANDS = {
80
81
  "/exit": () => ({ exit: true }),
@@ -15,7 +15,8 @@ export declare function runWithAIGNE(agentCreator: ((aigne: AIGNE) => PromiseOrV
15
15
  modelOptions?: ChatModelInputOptions;
16
16
  outputKey?: string;
17
17
  }): Promise<void>;
18
- export declare function runAgentWithAIGNE(aigne: AIGNE, agent: Agent, { outputKey, outputFileKey, chatLoopOptions, ...options }?: {
18
+ export declare function runAgentWithAIGNE(aigne: AIGNE, agent: Agent, { sessionId, outputKey, outputFileKey, chatLoopOptions, ...options }?: {
19
+ sessionId?: string;
19
20
  outputKey?: string;
20
21
  outputFileKey?: string;
21
22
  chatLoopOptions?: ChatLoopOptions;
@@ -84,7 +84,7 @@ export async function runWithAIGNE(agentCreator, { aigne, argv = process.argv, c
84
84
  process.exit(1);
85
85
  });
86
86
  }
87
- export async function runAgentWithAIGNE(aigne, agent, { outputKey, outputFileKey, chatLoopOptions, ...options } = {}) {
87
+ export async function runAgentWithAIGNE(aigne, agent, { sessionId, outputKey, outputFileKey, chatLoopOptions, ...options } = {}) {
88
88
  if (options.output) {
89
89
  const outputPath = isAbsolute(options.output)
90
90
  ? options.output
@@ -112,6 +112,7 @@ export async function runAgentWithAIGNE(aigne, agent, { outputKey, outputFileKey
112
112
  outputKey,
113
113
  inputFileKey: agent instanceof AIAgent ? agent.inputFileKey : undefined,
114
114
  input: options.input,
115
+ sessionId,
115
116
  });
116
117
  return;
117
118
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aigne/cli",
3
- "version": "1.59.0-beta.8",
3
+ "version": "1.59.0-beta.9",
4
4
  "description": "Your command center for agent development",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -48,6 +48,7 @@
48
48
  "@aigne/json-schema-to-zod": "^1.3.3",
49
49
  "@aigne/listr2": "^1.0.10",
50
50
  "@aigne/marked-terminal": "^7.3.2",
51
+ "@aigne/uuid": "^13.0.1",
51
52
  "@fast-csv/format": "^5.0.5",
52
53
  "@inquirer/core": "^10.2.2",
53
54
  "@inquirer/figures": "^1.0.13",
@@ -89,17 +90,17 @@
89
90
  "yoctocolors-cjs": "^2.1.3",
90
91
  "zod": "^3.25.67",
91
92
  "zod-to-json-schema": "^3.24.6",
92
- "@aigne/afs": "^1.4.0-beta.3",
93
- "@aigne/afs-history": "^1.2.0-beta.3",
94
- "@aigne/agent-library": "^1.24.0-beta.7",
95
- "@aigne/agentic-memory": "^1.1.6-beta.6",
96
- "@aigne/afs-local-fs": "^1.4.0-beta.6",
97
- "@aigne/aigne-hub": "^0.10.16-beta.9",
98
- "@aigne/default-memory": "^1.3.6-beta.6",
93
+ "@aigne/afs": "^1.4.0-beta.4",
94
+ "@aigne/afs-local-fs": "^1.4.0-beta.7",
95
+ "@aigne/afs-history": "^1.2.0-beta.4",
96
+ "@aigne/agent-library": "^1.24.0-beta.8",
97
+ "@aigne/agentic-memory": "^1.1.6-beta.7",
98
+ "@aigne/default-memory": "^1.4.0-beta.6",
99
+ "@aigne/aigne-hub": "^0.10.16-beta.10",
100
+ "@aigne/core": "^1.72.0-beta.7",
99
101
  "@aigne/observability-api": "^0.11.14-beta.1",
100
- "@aigne/openai": "^0.16.16-beta.6",
101
- "@aigne/secrets": "^0.1.6-beta.6",
102
- "@aigne/core": "^1.72.0-beta.6"
102
+ "@aigne/openai": "^0.16.16-beta.7",
103
+ "@aigne/secrets": "^0.1.6-beta.7"
103
104
  },
104
105
  "devDependencies": {
105
106
  "@inquirer/testing": "^2.1.50",
@@ -116,7 +117,7 @@
116
117
  "rimraf": "^6.0.1",
117
118
  "typescript": "^5.9.2",
118
119
  "ufo": "^1.6.1",
119
- "@aigne/test-utils": "^0.5.69-beta.6"
120
+ "@aigne/test-utils": "^0.5.69-beta.7"
120
121
  },
121
122
  "scripts": {
122
123
  "lint": "tsc --noEmit",