@ai-zen/agents-sdk 1.0.0-alpha.5 → 1.0.0-alpha.6

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,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.0.0-alpha.6] - 2026-10-13
4
+
5
+ ### 💥 Breaking Changes
6
+
7
+ - **`exec_async` renamed to `spawn`** — the tool wraps `child_process.spawn` and returns `{ success, pid, message }`, so the new name matches both the implementation and the "start a process, get its pid" contract. It also pairs cleanly with `exec`: `exec` runs and **waits** (captures output, has a `timeout`), `spawn` starts and **returns immediately**. Permission lists, skill `allowed-tools` and any prompt naming `exec_async` must switch to `spawn`. The behaviour is otherwise unchanged — still shell-parsed, still does **not** capture output (redirect to a file if you need it).
8
+ - **Built-in tool classes renamed to match their new tool names** — `ReadFileTool` → `ReadTool`, `WriteFileTool` → `WriteTool`, `ExecAsyncTool` → `SpawnTool`, with the source files renamed to match. The classes re-exported from `@ai-zen/agents-sdk` change accordingly, so consumers importing them by name must update.
9
+
3
10
  ## [1.0.0-alpha.5] - 2026-10-13
4
11
 
5
12
  ### 💥 Breaking Changes
package/README.md CHANGED
@@ -101,7 +101,7 @@ All built-in tools are classes (extending `SdkCallbackTool`), instantiated by th
101
101
  | `inspect_file` | Inspect a file's structural overview (line count, column distribution, etc.); streamed scan, not limited by the 300KB read threshold |
102
102
  | `write` | Write a file |
103
103
  | `exec` | Execute a command (supports `timeout`; oversized stdout+stderr is dumped to `stdout.log` / `stderr.log`) |
104
- | `exec_async` | Execute a command asynchronously, returns immediately without waiting |
104
+ | `spawn` | Execute a command asynchronously, returns immediately without waiting |
105
105
  | `mkdir` | Create a directory |
106
106
  | `rm` | Delete a file or directory |
107
107
  | `glob` | Scan and find files using glob patterns (oversized output dumped to `result.json`) |
package/README.zh.md CHANGED
@@ -100,7 +100,7 @@ await scope.dispose(); // 断开 MCP、释放插件资源
100
100
  | `inspect_file` | 勘察文件结构概况(行数、列数分布等),流式扫描不受 300KB 限制 |
101
101
  | `write` | 写入文件 |
102
102
  | `exec` | 执行命令(支持 `timeout` 超时参数;stdout+stderr 超限时分文件落盘 `stdout.log` / `stderr.log`) |
103
- | `exec_async` | 异步执行命令,启动后立即返回,不等待结果 |
103
+ | `spawn` | 异步执行命令,启动后立即返回,不等待结果 |
104
104
  | `mkdir` | 创建目录 |
105
105
  | `rm` | 删除文件或目录 |
106
106
  | `glob` | 使用 glob 模式扫描查找文件(输出超限落盘 `result.json`) |
package/dist/index.d.ts CHANGED
@@ -39,7 +39,7 @@ export { ContextGuardPlugin } from "./agent-plugins/ContextGuardPlugin.js";
39
39
  export type { ContextGuardOptions } from "./agent-plugins/ContextGuardPlugin.js";
40
40
  export { UnknownToolHintPlugin } from "./agent-plugins/UnknownToolHintPlugin.js";
41
41
  export { BUILTIN_TOOL_CLASSES } from "./scope/plugins/builtin/index.js";
42
- export { CwdTool, ReadFileTool, InspectFileTool, WriteFileTool, ExecTool, MkdirTool, RmTool, GlobTool, LsTool, ExistTool, FindTextTool, DownloadFileTool, RenameTool, CopyTool, BatchEditTool, EditTool, ExecAsyncTool, SleepTool, } from "./scope/plugins/builtin/index.js";
42
+ export { CwdTool, ReadTool, InspectFileTool, WriteTool, ExecTool, MkdirTool, RmTool, GlobTool, LsTool, ExistTool, FindTextTool, DownloadFileTool, RenameTool, CopyTool, BatchEditTool, EditTool, SpawnTool, SleepTool, } from "./scope/plugins/builtin/index.js";
43
43
  export { GenerateImageTool } from "./scope/plugins/builtin/GenerateImageTool.js";
44
44
  export { ViewImageTool } from "./scope/plugins/builtin/ViewImageTool.js";
45
45
  export { createLoadSkillTool, createCallSkillSubAgentTool } from "./scope/plugins/skills/skillTools.js";
package/dist/index.js CHANGED
@@ -34,7 +34,7 @@ export { ContextGuardPlugin } from "./agent-plugins/ContextGuardPlugin.js";
34
34
  export { UnknownToolHintPlugin } from "./agent-plugins/UnknownToolHintPlugin.js";
35
35
  // 工具 — 内置工具类 + 动态工具工厂
36
36
  export { BUILTIN_TOOL_CLASSES } from "./scope/plugins/builtin/index.js";
37
- export { CwdTool, ReadFileTool, InspectFileTool, WriteFileTool, ExecTool, MkdirTool, RmTool, GlobTool, LsTool, ExistTool, FindTextTool, DownloadFileTool, RenameTool, CopyTool, BatchEditTool, EditTool, ExecAsyncTool, SleepTool, } from "./scope/plugins/builtin/index.js";
37
+ export { CwdTool, ReadTool, InspectFileTool, WriteTool, ExecTool, MkdirTool, RmTool, GlobTool, LsTool, ExistTool, FindTextTool, DownloadFileTool, RenameTool, CopyTool, BatchEditTool, EditTool, SpawnTool, SleepTool, } from "./scope/plugins/builtin/index.js";
38
38
  export { GenerateImageTool } from "./scope/plugins/builtin/GenerateImageTool.js";
39
39
  export { ViewImageTool } from "./scope/plugins/builtin/ViewImageTool.js";
40
40
  export { createLoadSkillTool, createCallSkillSubAgentTool } from "./scope/plugins/skills/skillTools.js";
@@ -14,7 +14,7 @@ export class ExecTool extends SdkCallbackTool {
14
14
  },
15
15
  timeout: {
16
16
  type: "number",
17
- description: "超时时间(毫秒),必填。超时后会终止进程;超过该时长仍未完成即视为超时并终止。建议长时间运行的命令使用 exec_async 异步执行。",
17
+ description: "超时时间(毫秒),必填。超时后会终止进程;超过该时长仍未完成即视为超时并终止。建议长时间运行的命令使用 spawn 异步执行。",
18
18
  },
19
19
  },
20
20
  required: ["command", "timeout"],
@@ -4,7 +4,7 @@ import { SdkCallbackTool } from "./SdkCallbackTool.js";
4
4
  import { DEFAULT_MAX_TOOL_OUTPUT, guardOutput, headPreview } from "./outputGuard.js";
5
5
  /** 默认总匹配数上限 */
6
6
  const DEFAULT_MAX_MATCHES = 200;
7
- /** 默认文件大小上限(字节,与 ReadFileTool 的 300KB 口径一致) */
7
+ /** 默认文件大小上限(字节,与 ReadTool 的 300KB 口径一致) */
8
8
  const DEFAULT_MAX_FILE_SIZE = 300 * 1024;
9
9
  /** 默认行内容/匹配子串截断长度 */
10
10
  const DEFAULT_MAX_LINE_LENGTH = 200;
@@ -89,7 +89,7 @@ export class FindTextTool extends SdkCallbackTool {
89
89
  break; // 中断:stat 后再次检查
90
90
  if (!stats.isFile())
91
91
  continue;
92
- // 文件过大则跳过(避免撑爆上下文;与 ReadFileTool 300KB 口径一致,但此处为跳过而非报错)
92
+ // 文件过大则跳过(避免撑爆上下文;与 ReadTool 300KB 口径一致,但此处为跳过而非报错)
93
93
  if (stats.size > maxFileSize)
94
94
  continue;
95
95
  const content = await fsp.readFile(fullPath, "utf-8");
@@ -1,7 +1,7 @@
1
1
  import { SdkCallbackTool } from "./SdkCallbackTool.js";
2
2
  import type { ToolEnv } from "../../../types/index.js";
3
3
  import type { AgentNS } from "@ai-zen/agents-core";
4
- export declare class ReadFileTool extends SdkCallbackTool {
4
+ export declare class ReadTool extends SdkCallbackTool {
5
5
  function: AgentNS.FunctionDefine;
6
6
  constructor(env: ToolEnv);
7
7
  call(input: {
@@ -1,7 +1,7 @@
1
1
  import * as fsp from "fs/promises";
2
2
  import { SdkCallbackTool } from "./SdkCallbackTool.js";
3
3
  import { DEFAULT_MAX_TOOL_OUTPUT, guardOutput } from "./outputGuard.js";
4
- export class ReadFileTool extends SdkCallbackTool {
4
+ export class ReadTool extends SdkCallbackTool {
5
5
  function = {
6
6
  name: "read",
7
7
  description: "读取文件",
@@ -1,7 +1,7 @@
1
1
  import { SdkCallbackTool } from "./SdkCallbackTool.js";
2
2
  import type { ToolEnv } from "../../../types/index.js";
3
3
  import type { AgentNS } from "@ai-zen/agents-core";
4
- export declare class ExecAsyncTool extends SdkCallbackTool {
4
+ export declare class SpawnTool extends SdkCallbackTool {
5
5
  function: AgentNS.FunctionDefine;
6
6
  constructor(env: ToolEnv);
7
7
  call(input: {
@@ -1,8 +1,8 @@
1
1
  import { spawn } from "child_process";
2
2
  import { SdkCallbackTool } from "./SdkCallbackTool.js";
3
- export class ExecAsyncTool extends SdkCallbackTool {
3
+ export class SpawnTool extends SdkCallbackTool {
4
4
  function = {
5
- name: "exec_async",
5
+ name: "spawn",
6
6
  description: "异步执行命令,启动程序后立即返回,不等待执行结果。适用于启动长期运行的进程(如服务器、监听程序、GUI应用等)或不需要等待结果的命令。注意:该工具本身不捕获命令的输出;若需获取/留存输出,可在命令中使用 shell 重定向写入文件(如 `> /path/file`,支持 `>>` 追加、`|` 管道)。命令经 shell 解析执行。",
7
7
  parameters: {
8
8
  type: "object",
@@ -1,7 +1,7 @@
1
1
  import { SdkCallbackTool } from "./SdkCallbackTool.js";
2
2
  import type { ToolEnv } from "../../../types/index.js";
3
3
  import type { AgentNS } from "@ai-zen/agents-core";
4
- export declare class WriteFileTool extends SdkCallbackTool {
4
+ export declare class WriteTool extends SdkCallbackTool {
5
5
  function: AgentNS.FunctionDefine;
6
6
  constructor(env: ToolEnv);
7
7
  call(input: {
@@ -1,7 +1,7 @@
1
1
  import * as fsp from "fs/promises";
2
2
  import * as path from "path";
3
3
  import { SdkCallbackTool } from "./SdkCallbackTool.js";
4
- export class WriteFileTool extends SdkCallbackTool {
4
+ export class WriteTool extends SdkCallbackTool {
5
5
  function = {
6
6
  name: "write",
7
7
  description: "写入文件",
@@ -1,9 +1,9 @@
1
1
  import type { SdkCallbackTool } from "./SdkCallbackTool.js";
2
2
  import type { ToolEnv } from "../../../types/index.js";
3
3
  import { CwdTool } from "./CwdTool.js";
4
- import { ReadFileTool } from "./ReadFileTool.js";
4
+ import { ReadTool } from "./ReadTool.js";
5
5
  import { InspectFileTool } from "./InspectFileTool.js";
6
- import { WriteFileTool } from "./WriteFileTool.js";
6
+ import { WriteTool } from "./WriteTool.js";
7
7
  import { ExecTool } from "./ExecTool.js";
8
8
  import { MkdirTool } from "./MkdirTool.js";
9
9
  import { RmTool } from "./RmTool.js";
@@ -16,7 +16,7 @@ import { RenameTool } from "./RenameTool.js";
16
16
  import { CopyTool } from "./CopyTool.js";
17
17
  import { BatchEditTool } from "./BatchEditTool.js";
18
18
  import { EditTool } from "./EditTool.js";
19
- import { ExecAsyncTool } from "./ExecAsyncTool.js";
19
+ import { SpawnTool } from "./SpawnTool.js";
20
20
  import { SleepTool } from "./SleepTool.js";
21
21
  import { ViewImageTool } from "./ViewImageTool.js";
22
22
  import { GenerateImageTool } from "./GenerateImageTool.js";
@@ -29,4 +29,4 @@ import { GenerateImageTool } from "./GenerateImageTool.js";
29
29
  * 如 GenerateImageTool 依赖 defaultImageModel、ViewImageTool 仅视觉模型可用。
30
30
  */
31
31
  export declare const BUILTIN_TOOL_CLASSES: Array<new (env: ToolEnv) => SdkCallbackTool>;
32
- export { CwdTool, ReadFileTool, InspectFileTool, WriteFileTool, ExecTool, MkdirTool, RmTool, GlobTool, LsTool, ExistTool, FindTextTool, DownloadFileTool, RenameTool, CopyTool, BatchEditTool, EditTool, ExecAsyncTool, SleepTool, ViewImageTool, GenerateImageTool, };
32
+ export { CwdTool, ReadTool, InspectFileTool, WriteTool, ExecTool, MkdirTool, RmTool, GlobTool, LsTool, ExistTool, FindTextTool, DownloadFileTool, RenameTool, CopyTool, BatchEditTool, EditTool, SpawnTool, SleepTool, ViewImageTool, GenerateImageTool, };
@@ -1,7 +1,7 @@
1
1
  import { CwdTool } from "./CwdTool.js";
2
- import { ReadFileTool } from "./ReadFileTool.js";
2
+ import { ReadTool } from "./ReadTool.js";
3
3
  import { InspectFileTool } from "./InspectFileTool.js";
4
- import { WriteFileTool } from "./WriteFileTool.js";
4
+ import { WriteTool } from "./WriteTool.js";
5
5
  import { ExecTool } from "./ExecTool.js";
6
6
  import { MkdirTool } from "./MkdirTool.js";
7
7
  import { RmTool } from "./RmTool.js";
@@ -14,7 +14,7 @@ import { RenameTool } from "./RenameTool.js";
14
14
  import { CopyTool } from "./CopyTool.js";
15
15
  import { BatchEditTool } from "./BatchEditTool.js";
16
16
  import { EditTool } from "./EditTool.js";
17
- import { ExecAsyncTool } from "./ExecAsyncTool.js";
17
+ import { SpawnTool } from "./SpawnTool.js";
18
18
  import { SleepTool } from "./SleepTool.js";
19
19
  import { ViewImageTool } from "./ViewImageTool.js";
20
20
  import { GenerateImageTool } from "./GenerateImageTool.js";
@@ -28,9 +28,9 @@ import { GenerateImageTool } from "./GenerateImageTool.js";
28
28
  */
29
29
  export const BUILTIN_TOOL_CLASSES = [
30
30
  CwdTool,
31
- ReadFileTool,
31
+ ReadTool,
32
32
  InspectFileTool,
33
- WriteFileTool,
33
+ WriteTool,
34
34
  ExecTool,
35
35
  MkdirTool,
36
36
  RmTool,
@@ -43,9 +43,9 @@ export const BUILTIN_TOOL_CLASSES = [
43
43
  CopyTool,
44
44
  BatchEditTool,
45
45
  EditTool,
46
- ExecAsyncTool,
46
+ SpawnTool,
47
47
  SleepTool,
48
48
  ViewImageTool,
49
49
  GenerateImageTool,
50
50
  ];
51
- export { CwdTool, ReadFileTool, InspectFileTool, WriteFileTool, ExecTool, MkdirTool, RmTool, GlobTool, LsTool, ExistTool, FindTextTool, DownloadFileTool, RenameTool, CopyTool, BatchEditTool, EditTool, ExecAsyncTool, SleepTool, ViewImageTool, GenerateImageTool, };
51
+ export { CwdTool, ReadTool, InspectFileTool, WriteTool, ExecTool, MkdirTool, RmTool, GlobTool, LsTool, ExistTool, FindTextTool, DownloadFileTool, RenameTool, CopyTool, BatchEditTool, EditTool, SpawnTool, SleepTool, ViewImageTool, GenerateImageTool, };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-zen/agents-sdk",
3
- "version": "1.0.0-alpha.5",
3
+ "version": "1.0.0-alpha.6",
4
4
  "description": "AI-Zen Agents SDK — shared business logic for CLI and Desktop",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",