@aiti-ai/aiti-acp-agent 0.3.9 → 0.3.10
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/README.md +14 -22
- package/README.zh-CN.md +31 -0
- package/acp-registry.test.mjs +8 -0
- package/client/src/acp-manage.tsx +10 -10
- package/client/src/entry.tsx +32 -25
- package/dev-pack.mjs +16 -3
- package/dist/acp-manage-DBsgBEqc.js +831 -0
- package/dist/acp-manager.mjs +1 -1
- package/dist/entry-De5iU21x.js +818 -0
- package/index.ts +455 -131
- package/model-catalog.test.mjs +58 -1
- package/model-catalog.ts +39 -3
- package/package.json +4 -4
- package/set-model.test.mjs +92 -0
- package/skills/acp-agent-add/SKILL.md +2 -0
- package/skills/acp-agent-diagnose/SKILL.md +2 -0
- package/tools/build-client.mjs +2 -1
- package/dist/acp-manage-Lc4mynXq.js +0 -709
- package/dist/entry-CyjRZEKm.js +0 -689
package/README.md
CHANGED
|
@@ -1,38 +1,30 @@
|
|
|
1
1
|
# @aiti-ai/aiti-acp-agent
|
|
2
2
|
|
|
3
|
-
>
|
|
3
|
+
> A universal ACP driver — one adapter connects all Agent Client Protocol agents (25 built-in with auto-detection + custom backend panel + permission cards/queue/model catalog)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
English · [简体中文](./README.zh-CN.md)
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## About aiti
|
|
8
8
|
|
|
9
9
|
This package is part of the **aiti** ecosystem — a personal AI development workbench powered by [pi](https://pi.dev): **aiti-agent** (a self-hosted web workbench built on the open-source [pi-web](https://github.com/aiti-ai/pi-web)) plus debug injection into mainstream dev tools (aiti-devtools) and a rich extension system.
|
|
10
10
|
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
11
|
+
- Workbench (aiti-agent, built on pi-web): <https://github.com/aiti-ai/pi-web>
|
|
12
|
+
- Ecosystem monorepo: <https://github.com/aiti-ai/aiti-ai>
|
|
13
|
+
- Site: <https://aiti.pw>
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
Category: Multi-agent backends · Tags: `acp` · `agent-client-protocol` · `session` · `multi-agent`
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
## Install
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
Bundled with **aiti-agent** (`@aiti-ai/pi-web`) — enable it from the in-app extension manager (ExtMan / App Center).
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
Manual install: place this package at `~/.pi/web/extensions/aiti-acp-agent/` and reload pi-web.
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
## Documentation
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
# 部署到 ~/.pi/web/extensions/aiti-acp-agent/ 后 reload
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
## 文档 · Documentation
|
|
32
|
-
|
|
33
|
-
- 中文完整文档(aiti-docs): <https://aiti.pw/extensions/aiti-acp-agent.html>
|
|
34
|
-
- English docs: <https://aiti.pw/en/extensions/aiti-acp-agent.html>
|
|
35
|
-
- 扩展注册表 / registry: <https://aiti.pw/extensions.html> · machine-readable <https://aiti.pw/extensions.json>
|
|
25
|
+
- Documentation (English): <https://aiti.pw/en/extensions/aiti-acp-agent.html>
|
|
26
|
+
- 文档(中文): <https://aiti.pw/extensions/aiti-acp-agent.html>
|
|
27
|
+
- Extension registry: <https://aiti.pw/extensions.html> · machine-readable <https://aiti.pw/extensions.json>
|
|
36
28
|
|
|
37
29
|
## License
|
|
38
30
|
|
package/README.zh-CN.md
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# @aiti-ai/aiti-acp-agent
|
|
2
|
+
|
|
3
|
+
> 泛用 ACP 驱动 —— 一个适配器接所有 Agent Client Protocol agent(25 家内置自动探测 + 自定义后端面板 + 授权卡/队列/模型目录)
|
|
4
|
+
|
|
5
|
+
[English](./README.md) · 简体中文
|
|
6
|
+
|
|
7
|
+
## 关于 aiti
|
|
8
|
+
|
|
9
|
+
本包是 **aiti** 生态的组成部分——以 [pi](https://pi.dev) 为引擎的个人 AI 开发工作台与本地调试注入生态:**aiti-agent**(自托管 Web 工作台,基于开源项目 [pi-web](https://github.com/aiti-ai/pi-web) 构建,浏览器为主操作面)+ 各开发工具内的调试注入(aiti-devtools)+ 丰富的扩展体系。
|
|
10
|
+
|
|
11
|
+
- 工作台(aiti-agent,基于 pi-web): <https://github.com/aiti-ai/pi-web>
|
|
12
|
+
- 生态仓库: <https://github.com/aiti-ai/aiti-ai>
|
|
13
|
+
- 官网: <https://aiti.pw>
|
|
14
|
+
|
|
15
|
+
分类: 多 agent 后端 · tags: `acp` · `agent-client-protocol` · `session` · `multi-agent`
|
|
16
|
+
|
|
17
|
+
## 安装
|
|
18
|
+
|
|
19
|
+
随 **aiti-agent**(`@aiti-ai/pi-web`)捆绑发行——在工作台内的扩展管理器(ExtMan / 应用中心)启用即可。
|
|
20
|
+
|
|
21
|
+
手动安装:把本包放到 `~/.pi/web/extensions/aiti-acp-agent/` 后 reload。
|
|
22
|
+
|
|
23
|
+
## 文档
|
|
24
|
+
|
|
25
|
+
- 中文文档: <https://aiti.pw/extensions/aiti-acp-agent.html>
|
|
26
|
+
- Documentation (English): <https://aiti.pw/en/extensions/aiti-acp-agent.html>
|
|
27
|
+
- 扩展注册表: <https://aiti.pw/extensions.html> · machine-readable <https://aiti.pw/extensions.json>
|
|
28
|
+
|
|
29
|
+
## 许可证
|
|
30
|
+
|
|
31
|
+
MIT
|
package/acp-registry.test.mjs
CHANGED
|
@@ -49,6 +49,14 @@ test("注册表含 codex + cursor 条目(2026-11-08 接入)", () => {
|
|
|
49
49
|
assert.equal(cursor.agentKey, "cursor");
|
|
50
50
|
});
|
|
51
51
|
|
|
52
|
+
test("pi 不 claim 原生 pi 的 agentKey(ACP 无 steer,接管会丢 steer/fork)", () => {
|
|
53
|
+
const pi = ACP_AGENTS.find((a) => a.name === "pi");
|
|
54
|
+
assert.ok(pi, "pi 后端存在");
|
|
55
|
+
assert.equal(pi.bin, "pi-acp");
|
|
56
|
+
assert.notEqual(pi.agentKey, "pi", "agentKey 必须避开原生 aiti-pi-agent 的 pi");
|
|
57
|
+
assert.equal(pi.agentKey, "pi-acp");
|
|
58
|
+
});
|
|
59
|
+
|
|
52
60
|
test("注册表卫生:name 唯一,每条有 resolve 或 bin", () => {
|
|
53
61
|
const names = ACP_AGENTS.map((a) => a.name);
|
|
54
62
|
assert.equal(new Set(names).size, names.length, "name 不重复");
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import { useState, useEffect } from "react";
|
|
14
|
-
import { apiUrl } from "./host-shim";
|
|
14
|
+
import { apiUrl, t } from "./host-shim";
|
|
15
15
|
import { ACP_KEY, PlugIcon, setDialogOpen } from "./common";
|
|
16
16
|
// dock v3(P2 批):弹窗显隐收口展示状态机(左栏列表驻留,不接右栏);渲染门控 usePresent
|
|
17
17
|
import { usePresent, DockBody, isSidebarDockState, sidebarZoneOf } from "../../../_shared/ext-float-dock";
|
|
@@ -109,9 +109,9 @@ function renderAcpDialog(face?: string) {
|
|
|
109
109
|
{floating && (
|
|
110
110
|
<div style={{ display: "flex", alignItems: "center", gap: 8, padding: "10px 14px", borderBottom: "1px solid var(--border)", cursor: "grab", userSelect: "none" }}>
|
|
111
111
|
<span style={{ color: "var(--text-muted)", display: "flex" }}><PlugIcon size={15} /></span>
|
|
112
|
-
<span style={{ fontSize: 13, fontWeight: 600, flex: 1 }}>
|
|
112
|
+
<span style={{ fontSize: 13, fontWeight: 600, flex: 1 }}>{t("acp.manage.dialog.label")}</span>
|
|
113
113
|
<button
|
|
114
|
-
title="
|
|
114
|
+
title={t("acp.manage.close")} aria-label="Close"
|
|
115
115
|
onClick={() => setDialogOpen(false)}
|
|
116
116
|
style={{ background: "none", border: "none", color: "var(--text-muted)", cursor: "pointer", fontSize: 15, lineHeight: 1, padding: "2px 4px" }}
|
|
117
117
|
>✕</button>
|
|
@@ -122,7 +122,7 @@ function renderAcpDialog(face?: string) {
|
|
|
122
122
|
{!loaded ? (
|
|
123
123
|
<div style={{ padding: "16px 0", color: "var(--text-dim)", fontSize: 12, textAlign: "center" }}>…</div>
|
|
124
124
|
) : agents.length === 0 ? (
|
|
125
|
-
<div style={{ padding: "16px 0", color: "var(--text-dim)", fontSize: 12, textAlign: "center" }}>
|
|
125
|
+
<div style={{ padding: "16px 0", color: "var(--text-dim)", fontSize: 12, textAlign: "center" }}>{t("acp.manage.empty")}</div>
|
|
126
126
|
) : agents.map((a) => (
|
|
127
127
|
<div key={a.name} style={{ display: "flex", alignItems: "center", gap: 6, padding: "6px 0", borderBottom: "1px solid var(--border)", fontSize: 12 }}>
|
|
128
128
|
<span style={{ width: 7, height: 7, borderRadius: "50%", background: a.registered ? "var(--ok, #22c55e)" : "#ef444455", flexShrink: 0 }} />
|
|
@@ -136,7 +136,7 @@ function renderAcpDialog(face?: string) {
|
|
|
136
136
|
{!builtinSet.has(a.name) && (
|
|
137
137
|
<button
|
|
138
138
|
onClick={() => void doRemove(a.name)}
|
|
139
|
-
title={
|
|
139
|
+
title={t("acp.manage.remove", { name: a.name })} aria-label={t("acp.manage.remove", { name: a.name })}
|
|
140
140
|
style={{ background: "none", border: "none", color: "var(--danger, #ef4444)", cursor: "pointer", fontSize: 13, padding: "0 2px" }}
|
|
141
141
|
>✕</button>
|
|
142
142
|
)}
|
|
@@ -154,11 +154,11 @@ function renderAcpDialog(face?: string) {
|
|
|
154
154
|
style={{ width: 80, padding: "4px 7px", border: "1px solid var(--border)", borderRadius: 5, background: "var(--bg)", color: "var(--text)", fontSize: 11 }} />
|
|
155
155
|
<button onClick={() => void doAdd()} disabled={busy}
|
|
156
156
|
style={{ padding: "4px 12px", border: "none", borderRadius: 5, background: "var(--accent)", color: "#fff", cursor: "pointer", fontSize: 11, fontWeight: 600 }}>
|
|
157
|
-
{busy ? "…" : "
|
|
157
|
+
{busy ? "…" : t("acp.manage.add")}
|
|
158
158
|
</button>
|
|
159
159
|
</div>
|
|
160
160
|
<div style={{ marginTop: 5, fontSize: 10, color: "var(--text-dim)" }}>
|
|
161
|
-
|
|
161
|
+
{t("acp.manage.reloadHint")}
|
|
162
162
|
</div>
|
|
163
163
|
</div>
|
|
164
164
|
</>
|
|
@@ -198,17 +198,17 @@ function renderAcpDialog(face?: string) {
|
|
|
198
198
|
// 右栏 tab face(chrome="tab":无头行)
|
|
199
199
|
if (face === "right") {
|
|
200
200
|
return (
|
|
201
|
-
<DockBody itemKey={ACP_KEY} zone="right-panel" title="
|
|
201
|
+
<DockBody itemKey={ACP_KEY} zone="right-panel" title={t("acp.manage.dialog.label")} chrome="tab"
|
|
202
202
|
zones={acpZones} defaultZone={sidebarZoneOf(ACP_KEY)}>{acpInner}</DockBody>
|
|
203
203
|
);
|
|
204
204
|
}
|
|
205
205
|
// 左栏区块 face:统一头行(标题 + 业务按钮 + ⇱ detach + ⋮);zone 用规范值 sidebar:<key>
|
|
206
206
|
const acpCount = typeof hs.count === "number" ? hs.count : 0;
|
|
207
207
|
const actions: DockHeaderAction[] = [
|
|
208
|
-
{ id: "refresh", title: "
|
|
208
|
+
{ id: "refresh", title: t("acp.manage.refresh"), icon: (<svg width={12} height={12} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={2} strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8" /><path d="M3 3v5h5" /></svg>), visibility: "always", onClick: () => { requestDockCommand(ACP_KEY, "refresh"); } },
|
|
209
209
|
];
|
|
210
210
|
return (
|
|
211
|
-
<DockBody itemKey={ACP_KEY} title="
|
|
211
|
+
<DockBody itemKey={ACP_KEY} title={t("acp.manage.dialog.label")} icon="plug" chrome="section" kind="dockable"
|
|
212
212
|
count={acpCount > 0 ? acpCount : undefined}
|
|
213
213
|
zones={acpZones} defaultZone={sidebarZoneOf(ACP_KEY)}
|
|
214
214
|
headerActions={actions}>
|
package/client/src/entry.tsx
CHANGED
|
@@ -12,9 +12,10 @@
|
|
|
12
12
|
* 构建:node tools/build-client.mjs 部署:tools/deploy.mjs(先构建再整目录同步)
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
import { __setCtx } from "./host-shim";
|
|
15
|
+
import { __setCtx, t } from "./host-shim";
|
|
16
16
|
import { ACP_KEY, setDialogOpen, acpDefaultZone } from "./common";
|
|
17
17
|
import { usePresent, isSidebarDockState, seedDockDefault, declareDockZones } from "../../../_shared/ext-float-dock-lite";
|
|
18
|
+
import { dockIconDecl } from "../../../_shared/dock-icons";
|
|
18
19
|
import { lazyExtView, createLazyModule } from "../../../_shared/ext-lazy";
|
|
19
20
|
|
|
20
21
|
// 重模块单例:面板三面(float/right/left)与命令式入口共享一次 import
|
|
@@ -35,40 +36,46 @@ export function AcpDockLeftSlot() {
|
|
|
35
36
|
return lazyExtView({ active: isSidebarDockState(st), load: acpManageRef, pick: "AcpDockLeft" });
|
|
36
37
|
}
|
|
37
38
|
|
|
39
|
+
let localeListener: (() => void) | null = null;
|
|
40
|
+
|
|
38
41
|
// 新会话欢迎页 Backend 下拉的扩展选项(不是后端条目:选中即打开管理弹窗,
|
|
39
42
|
// 下拉值由宿主复位)——不再在 Backend 选择器外渲染按钮。
|
|
40
43
|
export default function register(ctx: Record<string, unknown>) {
|
|
41
44
|
// 重要:必须在任何 JSX 组件渲染前调用(host-shim 模块级持 ctx)
|
|
42
45
|
__setCtx(ctx);
|
|
43
46
|
|
|
44
|
-
//
|
|
45
|
-
//
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
47
|
+
// Declarative item labels are captured at registration time; re-register on the
|
|
48
|
+
// host locale-change event so the dropdown option follows the active language.
|
|
49
|
+
const registerEntries = () => {
|
|
50
|
+
ctx.registerItems?.("toolbar", [{
|
|
51
|
+
id: "aiti-acp-manage-open",
|
|
52
|
+
meta: { label: "ACP", title: t("acp.manage.title"), icon: "icons/plug.svg", onClick: () => setDialogOpen(true), open: () => setDialogOpen(true) },
|
|
53
|
+
feature: "behavior.showAcpManager",
|
|
54
|
+
}]);
|
|
55
|
+
ctx.registerItems?.("newSessionBackendOptions", [{
|
|
56
|
+
id: "acp-manage-option",
|
|
57
|
+
meta: { label: t("acp.manage.option.label"), title: t("acp.manage.title"), onClick: () => setDialogOpen(true) },
|
|
58
|
+
}]);
|
|
59
|
+
ctx.registerItems?.("dialogs", [{
|
|
60
|
+
id: "acp-manage-dialog",
|
|
61
|
+
render: AcpDialogSlot,
|
|
62
|
+
meta: {
|
|
63
|
+
label: t("acp.manage.dialog.label"),
|
|
64
|
+
open: () => setDialogOpen(true),
|
|
65
|
+
},
|
|
66
|
+
}]);
|
|
67
|
+
};
|
|
68
|
+
registerEntries();
|
|
69
|
+
if (typeof window !== "undefined") {
|
|
70
|
+
if (localeListener) window.removeEventListener("pi-web:locale-changed", localeListener);
|
|
71
|
+
localeListener = registerEntries;
|
|
72
|
+
window.addEventListener("pi-web:locale-changed", registerEntries);
|
|
73
|
+
}
|
|
67
74
|
// aiti-float dock v3(P2 批):后端列表默认左栏(状态灯列表窄条)
|
|
68
75
|
// zone 规范值 sidebar:<key>(v4;旧 sidebar-explorer 兼容读)
|
|
69
76
|
seedDockDefault(ACP_KEY, acpDefaultZone());
|
|
70
77
|
declareDockZones(ACP_KEY, [acpDefaultZone(), "right-panel"], acpDefaultZone());
|
|
71
|
-
ctx.registerItems?.("rightFileDock", [{ id: "manage", render: AcpDockRightSlot, meta: { title: "ACP" } }]);
|
|
78
|
+
ctx.registerItems?.("rightFileDock", [{ id: "manage", render: AcpDockRightSlot, meta: { title: "ACP", icon: dockIconDecl("plug") } }]);
|
|
72
79
|
ctx.registerItems?.("sidebarExplorerDock", [{ id: "manage", render: AcpDockLeftSlot, meta: { title: "ACP", priority: 3 } }]);
|
|
73
80
|
|
|
74
81
|
console.log("[aiti-acp-agent] client 已注册(薄壳 + 懒弹窗 chunk)");
|
package/dev-pack.mjs
CHANGED
|
@@ -77,7 +77,7 @@ export function agentsMdTemplate(extId) {
|
|
|
77
77
|
|
|
78
78
|
/** 默认 tools/build.mjs(esbuild 单包零配置;扩展自带 tools/build.mjs 则不走到这里)。 */
|
|
79
79
|
function buildMjsTemplate(extId, extRoot, clientOut, entryRel) {
|
|
80
|
-
|
|
80
|
+
// No hardcoded checkout path: candidates are resolved at run time (see repoCandidates below).
|
|
81
81
|
return `/**
|
|
82
82
|
* ${extId} · 现场构建入口(dev-pack 默认模板,esbuild 单包零配置)
|
|
83
83
|
* 用法:node tools/build.mjs
|
|
@@ -96,12 +96,25 @@ const entryRel = ${JSON.stringify(entryRel || "")};
|
|
|
96
96
|
|
|
97
97
|
// esbuild 解析:部署目录 node_modules → 源码仓 node_modules(本机开发场景)→ PATH 上的 esbuild → npm exec 现拉。
|
|
98
98
|
// 注意:node_modules/esbuild/bin/esbuild 是原生二进制(ELF/Mach-O),必须直接执行(不能当 JS 跑)。
|
|
99
|
+
// Checkout roots are discovered by walking up from the extension dir (a root has node_modules/),
|
|
100
|
+
// plus AITI_REPO_ROOT when set — no machine-specific absolute paths baked into generated files.
|
|
101
|
+
function repoCandidates() {
|
|
102
|
+
const out = [];
|
|
103
|
+
if (process.env.AITI_REPO_ROOT) out.push(process.env.AITI_REPO_ROOT.split(pathSep).join("/") + "/node_modules/esbuild/bin/esbuild");
|
|
104
|
+
let d = extRoot;
|
|
105
|
+
for (let i = 0; i < 8; i++) {
|
|
106
|
+
out.push(d.split(pathSep).join("/") + "/node_modules/esbuild/bin/esbuild");
|
|
107
|
+
const up = dirname(d);
|
|
108
|
+
if (up === d) break;
|
|
109
|
+
d = up;
|
|
110
|
+
}
|
|
111
|
+
return out;
|
|
112
|
+
}
|
|
99
113
|
function findEsbuild() {
|
|
100
114
|
const home = (process.env.HOME || process.env.USERPROFILE || "").split(pathSep).join("/");
|
|
101
115
|
const candidates = [
|
|
102
116
|
extRoot + "/node_modules/esbuild/bin/esbuild",
|
|
103
|
-
|
|
104
|
-
"D:/workspace/pi-work/node_modules/esbuild/bin/esbuild", // 155 win(源码在 D 盘)
|
|
117
|
+
...repoCandidates(),
|
|
105
118
|
];
|
|
106
119
|
for (const c of candidates) {
|
|
107
120
|
if (!existsSync(c)) continue;
|