@aigne/cli 1.11.6 → 1.11.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 +59 -0
- package/dist/tracer/terminal.d.ts +2 -2
- package/dist/tracer/terminal.js +12 -10
- package/dist/utils/run-chat-loop.d.ts +3 -2
- package/dist/utils/run-chat-loop.js +2 -4
- package/dist/utils/run-with-aigne.js +5 -5
- package/dist/utils/serve-mcp.js +3 -2
- package/package.json +11 -11
- package/templates/default/chat.yaml +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,64 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.11.9](https://github.com/AIGNE-io/aigne-framework/compare/cli-v1.11.8...cli-v1.11.9) (2025-06-19)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* use `inputKey` instead of implicit $message for AIAgent ([#165](https://github.com/AIGNE-io/aigne-framework/issues/165)) ([8b6e589](https://github.com/AIGNE-io/aigne-framework/commit/8b6e5896bba8209fd2eecb0f5b9263618bffdaf8))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Dependencies
|
|
12
|
+
|
|
13
|
+
* The following workspace dependencies were updated
|
|
14
|
+
* dependencies
|
|
15
|
+
* @aigne/agent-library bumped to 1.13.2
|
|
16
|
+
* @aigne/anthropic bumped to 0.3.2
|
|
17
|
+
* @aigne/bedrock bumped to 0.3.2
|
|
18
|
+
* @aigne/core bumped to 1.20.1
|
|
19
|
+
* @aigne/deepseek bumped to 0.3.2
|
|
20
|
+
* @aigne/gemini bumped to 0.3.2
|
|
21
|
+
* @aigne/ollama bumped to 0.3.2
|
|
22
|
+
* @aigne/open-router bumped to 0.3.2
|
|
23
|
+
* @aigne/openai bumped to 0.3.2
|
|
24
|
+
* @aigne/xai bumped to 0.3.2
|
|
25
|
+
|
|
26
|
+
## [1.11.8](https://github.com/AIGNE-io/aigne-framework/compare/cli-v1.11.7...cli-v1.11.8) (2025-06-17)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
### Dependencies
|
|
30
|
+
|
|
31
|
+
* The following workspace dependencies were updated
|
|
32
|
+
* dependencies
|
|
33
|
+
* @aigne/agent-library bumped to 1.13.1
|
|
34
|
+
* @aigne/anthropic bumped to 0.3.1
|
|
35
|
+
* @aigne/bedrock bumped to 0.3.1
|
|
36
|
+
* @aigne/core bumped to 1.20.0
|
|
37
|
+
* @aigne/deepseek bumped to 0.3.1
|
|
38
|
+
* @aigne/gemini bumped to 0.3.1
|
|
39
|
+
* @aigne/ollama bumped to 0.3.1
|
|
40
|
+
* @aigne/open-router bumped to 0.3.1
|
|
41
|
+
* @aigne/openai bumped to 0.3.1
|
|
42
|
+
* @aigne/xai bumped to 0.3.1
|
|
43
|
+
|
|
44
|
+
## [1.11.7](https://github.com/AIGNE-io/aigne-framework/compare/cli-v1.11.6...cli-v1.11.7) (2025-06-16)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
### Dependencies
|
|
48
|
+
|
|
49
|
+
* The following workspace dependencies were updated
|
|
50
|
+
* dependencies
|
|
51
|
+
* @aigne/agent-library bumped to 1.13.0
|
|
52
|
+
* @aigne/anthropic bumped to 0.3.0
|
|
53
|
+
* @aigne/bedrock bumped to 0.3.0
|
|
54
|
+
* @aigne/core bumped to 1.19.0
|
|
55
|
+
* @aigne/deepseek bumped to 0.3.0
|
|
56
|
+
* @aigne/gemini bumped to 0.3.0
|
|
57
|
+
* @aigne/ollama bumped to 0.3.0
|
|
58
|
+
* @aigne/open-router bumped to 0.3.0
|
|
59
|
+
* @aigne/openai bumped to 0.3.0
|
|
60
|
+
* @aigne/xai bumped to 0.3.0
|
|
61
|
+
|
|
3
62
|
## [1.11.6](https://github.com/AIGNE-io/aigne-framework/compare/cli-v1.11.5...cli-v1.11.6) (2025-06-11)
|
|
4
63
|
|
|
5
64
|
|
|
@@ -24,8 +24,8 @@ export declare class TerminalTracer {
|
|
|
24
24
|
time?: boolean;
|
|
25
25
|
}): string;
|
|
26
26
|
private marked;
|
|
27
|
-
formatRequest(_context: Context, m?: Message): string | undefined;
|
|
28
|
-
formatResult(context: Context, m?: Message): string;
|
|
27
|
+
formatRequest(agent: Agent, _context: Context, m?: Message): string | undefined;
|
|
28
|
+
formatResult(agent: Agent, context: Context, m?: Message): string;
|
|
29
29
|
}
|
|
30
30
|
type Task = ReturnType<typeof promiseWithResolvers<void>> & {
|
|
31
31
|
listr: ReturnType<typeof promiseWithResolvers<{
|
package/dist/tracer/terminal.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { EOL } from "node:os";
|
|
2
2
|
import { inspect } from "node:util";
|
|
3
|
-
import {
|
|
3
|
+
import { AIAgent, ChatModel, } from "@aigne/core";
|
|
4
4
|
import { LogLevel, logger } from "@aigne/core/utils/logger.js";
|
|
5
5
|
import { promiseWithResolvers } from "@aigne/core/utils/promise.js";
|
|
6
|
-
import {
|
|
6
|
+
import { omit } from "@aigne/core/utils/type-utils.js";
|
|
7
7
|
import { figures } from "@aigne/listr2";
|
|
8
8
|
import { markedTerminal } from "@aigne/marked-terminal";
|
|
9
9
|
import chalk from "chalk";
|
|
@@ -21,8 +21,8 @@ export class TerminalTracer {
|
|
|
21
21
|
async run(agent, input) {
|
|
22
22
|
const context = this.context.newContext({ reset: true });
|
|
23
23
|
const listr = new AIGNEListr({
|
|
24
|
-
formatRequest: () => this.options.printRequest ? this.formatRequest(context, input) : undefined,
|
|
25
|
-
formatResult: (result) => [this.formatResult(context, result)].filter(Boolean),
|
|
24
|
+
formatRequest: () => this.options.printRequest ? this.formatRequest(agent, context, input) : undefined,
|
|
25
|
+
formatResult: (result) => [this.formatResult(agent, context, result)].filter(Boolean),
|
|
26
26
|
}, [], { concurrent: true });
|
|
27
27
|
const onAgentStarted = async ({ contextId, parentContextId, agent, timestamp, }) => {
|
|
28
28
|
const task = {
|
|
@@ -122,22 +122,24 @@ export class TerminalTracer {
|
|
|
122
122
|
return title;
|
|
123
123
|
}
|
|
124
124
|
marked = new Marked().use(markedTerminal({ forceHyperLink: false }));
|
|
125
|
-
formatRequest(_context, m = {}) {
|
|
125
|
+
formatRequest(agent, _context, m = {}) {
|
|
126
126
|
if (!logger.enabled(LogLevel.INFO))
|
|
127
127
|
return;
|
|
128
128
|
const prefix = `${chalk.grey(figures.pointer)} 💬 `;
|
|
129
|
-
const
|
|
130
|
-
const
|
|
129
|
+
const inputKey = agent instanceof AIAgent ? agent.inputKey : undefined;
|
|
130
|
+
const msg = inputKey ? m[inputKey] : undefined;
|
|
131
|
+
const message = inputKey ? omit(m, inputKey) : m;
|
|
131
132
|
const text = msg && typeof msg === "string" ? this.marked.parse(msg, { async: false }).trim() : undefined;
|
|
132
133
|
const json = Object.keys(message).length > 0 ? inspect(message, { colors: true }) : undefined;
|
|
133
134
|
return [prefix, [text, json].filter(Boolean).join(EOL)].join(" ");
|
|
134
135
|
}
|
|
135
|
-
formatResult(context, m = {}) {
|
|
136
|
+
formatResult(agent, context, m = {}) {
|
|
137
|
+
const outputKey = agent instanceof AIAgent ? agent.outputKey : undefined;
|
|
136
138
|
const prefix = logger.enabled(LogLevel.INFO)
|
|
137
139
|
? `${chalk.grey(figures.tick)} 🤖 ${this.formatTokenUsage(context.usage)}`
|
|
138
140
|
: null;
|
|
139
|
-
const msg = m[
|
|
140
|
-
const message =
|
|
141
|
+
const msg = outputKey ? m[outputKey] : undefined;
|
|
142
|
+
const message = outputKey ? omit(m, outputKey) : m;
|
|
141
143
|
const text = msg && typeof msg === "string" ? this.marked.parse(msg, { async: false }).trim() : undefined;
|
|
142
144
|
const json = Object.keys(message).length > 0
|
|
143
145
|
? inspect(message, { colors: process.stdout.isTTY })
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Message, UserAgent } from "@aigne/core";
|
|
2
|
+
export declare const DEFAULT_CHAT_INPUT_KEY = "message";
|
|
2
3
|
export interface ChatLoopOptions {
|
|
3
4
|
initialCall?: Message | string;
|
|
4
5
|
welcome?: string;
|
|
@@ -6,4 +7,4 @@ export interface ChatLoopOptions {
|
|
|
6
7
|
inputKey?: string;
|
|
7
8
|
skipLoop?: boolean;
|
|
8
9
|
}
|
|
9
|
-
export declare function runChatLoopInTerminal(userAgent: UserAgent, options?: ChatLoopOptions): Promise<void>;
|
|
10
|
+
export declare function runChatLoopInTerminal(userAgent: UserAgent<any, any>, options?: ChatLoopOptions): Promise<void>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { createMessage } from "@aigne/core";
|
|
2
1
|
import inquirer from "inquirer";
|
|
3
2
|
import { TerminalTracer } from "../tracer/terminal.js";
|
|
3
|
+
export const DEFAULT_CHAT_INPUT_KEY = "message";
|
|
4
4
|
export async function runChatLoopInTerminal(userAgent, options = {}) {
|
|
5
5
|
const { initialCall = process.env.INITIAL_CALL, skipLoop = process.env.SKIP_LOOP === "true" } = options;
|
|
6
6
|
let prompt;
|
|
@@ -43,9 +43,7 @@ export async function runChatLoopInTerminal(userAgent, options = {}) {
|
|
|
43
43
|
}
|
|
44
44
|
async function callAgent(userAgent, input, options) {
|
|
45
45
|
const tracer = new TerminalTracer(userAgent.context);
|
|
46
|
-
await tracer.run(userAgent, options.inputKey
|
|
47
|
-
? { [options.inputKey]: input }
|
|
48
|
-
: createMessage(input));
|
|
46
|
+
await tracer.run(userAgent, typeof input === "string" ? { [options.inputKey || DEFAULT_CHAT_INPUT_KEY]: input } : input);
|
|
49
47
|
}
|
|
50
48
|
const COMMANDS = {
|
|
51
49
|
"/exit": () => ({ exit: true }),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { fstat } from "node:fs";
|
|
2
2
|
import { isatty } from "node:tty";
|
|
3
3
|
import { promisify } from "node:util";
|
|
4
|
-
import { AIGNE, UserAgent
|
|
4
|
+
import { AIGNE, UserAgent } from "@aigne/core";
|
|
5
5
|
import { loadModel } from "@aigne/core/loader/index.js";
|
|
6
6
|
import { LogLevel, getLevelFromEnv, logger } from "@aigne/core/utils/logger.js";
|
|
7
7
|
import { readAllString } from "@aigne/core/utils/stream-utils.js";
|
|
@@ -11,7 +11,7 @@ import PrettyError from "pretty-error";
|
|
|
11
11
|
import { ZodError, z } from "zod";
|
|
12
12
|
import { availableModels } from "../constants.js";
|
|
13
13
|
import { TerminalTracer } from "../tracer/terminal.js";
|
|
14
|
-
import { runChatLoopInTerminal } from "./run-chat-loop.js";
|
|
14
|
+
import { DEFAULT_CHAT_INPUT_KEY, runChatLoopInTerminal, } from "./run-chat-loop.js";
|
|
15
15
|
export const createRunAIGNECommand = (name = "run") => new Command(name)
|
|
16
16
|
.description("Run agent with AIGNE in terminal")
|
|
17
17
|
.option("--chat", "Run chat loop in terminal", false)
|
|
@@ -80,9 +80,9 @@ export async function runAgentWithAIGNE(aigne, agent, { chatLoopOptions, modelOp
|
|
|
80
80
|
const tracer = new TerminalTracer(aigne.newContext(), {
|
|
81
81
|
printRequest: logger.enabled(LogLevel.INFO),
|
|
82
82
|
});
|
|
83
|
-
return await tracer.run(agent,
|
|
84
|
-
? { [chatLoopOptions
|
|
85
|
-
:
|
|
83
|
+
return await tracer.run(agent, typeof input === "string"
|
|
84
|
+
? { [chatLoopOptions?.inputKey || DEFAULT_CHAT_INPUT_KEY]: input }
|
|
85
|
+
: input);
|
|
86
86
|
}
|
|
87
87
|
async function stdinHasData() {
|
|
88
88
|
const stats = await promisify(fstat)(0);
|
package/dist/utils/serve-mcp.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AIAgent } from "@aigne/core";
|
|
2
2
|
import { promiseWithResolvers } from "@aigne/core/utils/promise.js";
|
|
3
3
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
4
4
|
import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
|
|
@@ -82,7 +82,8 @@ export function createMcpServer(aigne) {
|
|
|
82
82
|
content: [
|
|
83
83
|
{
|
|
84
84
|
type: "text",
|
|
85
|
-
text:
|
|
85
|
+
text: (agent instanceof AIAgent && result[agent.outputKey]) ||
|
|
86
|
+
JSON.stringify(result),
|
|
86
87
|
},
|
|
87
88
|
],
|
|
88
89
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aigne/cli",
|
|
3
|
-
"version": "1.11.
|
|
3
|
+
"version": "1.11.9",
|
|
4
4
|
"description": "cli for AIGNE framework",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -50,16 +50,16 @@
|
|
|
50
50
|
"tar": "^7.4.3",
|
|
51
51
|
"wrap-ansi": "^9.0.0",
|
|
52
52
|
"zod": "^3.24.4",
|
|
53
|
-
"@aigne/agent-library": "^1.
|
|
54
|
-
"@aigne/bedrock": "^0.2
|
|
55
|
-
"@aigne/anthropic": "^0.2
|
|
56
|
-
"@aigne/core": "^1.
|
|
57
|
-
"@aigne/gemini": "^0.2
|
|
58
|
-
"@aigne/deepseek": "^0.2
|
|
59
|
-
"@aigne/ollama": "^0.2
|
|
60
|
-
"@aigne/open-router": "^0.2
|
|
61
|
-
"@aigne/openai": "^0.2
|
|
62
|
-
"@aigne/xai": "^0.2
|
|
53
|
+
"@aigne/agent-library": "^1.13.2",
|
|
54
|
+
"@aigne/bedrock": "^0.3.2",
|
|
55
|
+
"@aigne/anthropic": "^0.3.2",
|
|
56
|
+
"@aigne/core": "^1.20.1",
|
|
57
|
+
"@aigne/gemini": "^0.3.2",
|
|
58
|
+
"@aigne/deepseek": "^0.3.2",
|
|
59
|
+
"@aigne/ollama": "^0.3.2",
|
|
60
|
+
"@aigne/open-router": "^0.3.2",
|
|
61
|
+
"@aigne/openai": "^0.3.2",
|
|
62
|
+
"@aigne/xai": "^0.3.2"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
65
|
"@types/archiver": "^6.0.3",
|
|
@@ -3,6 +3,7 @@ description: Chat agent
|
|
|
3
3
|
instructions: |
|
|
4
4
|
You are a helpful assistant that can answer questions and provide information on a wide range of topics.
|
|
5
5
|
Your goal is to assist users in finding the information they need and to engage in friendly conversation.
|
|
6
|
+
input_key: message
|
|
6
7
|
memory: true
|
|
7
8
|
tools:
|
|
8
9
|
- sandbox.js
|