@yitom/acp-client 0.1.12 → 0.1.13
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 +25 -1
- package/dist/contracts/index.d.ts +27 -0
- package/dist/index.cjs +594 -77
- package/dist/index.js +590 -73
- package/dist/runtimes/codex/index.d.ts +2 -0
- package/dist/runtimes/deepseek/deepseek-provider.d.ts +50 -0
- package/dist/runtimes/deepseek/dsh-acp-bootstrap.d.ts +65 -0
- package/dist/runtimes/deepseek/index.d.ts +51 -12
- package/dist/runtimes/deepseek/quota.d.ts +24 -0
- package/dist/runtimes/index.d.ts +22 -2
- package/dist/session/quota.d.ts +9 -0
- package/dist/sidecar.cjs +509 -76
- package/dist/version.d.ts +1 -1
- package/docs/api-reference.md +137 -0
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -41,12 +41,32 @@
|
|
|
41
41
|
| `codex-acp` | ChatGPT | `~/.codex/auth.json` / 自定义供应商 API Key | 支持隔离 `CODEX_HOME` 生成 `config.toml` |
|
|
42
42
|
| `claude` | Claude | `~/.claude.json` / `ANTHROPIC_API_KEY` | 自动复用本机 Claude Code CLI 登录态 |
|
|
43
43
|
| `cursor-cli` | Cursor | `CURSOR_API_KEY` / 系统 Keychain 登录态 | 自动探测 `%LOCALAPPDATA%\cursor-agent\agent.cmd` |
|
|
44
|
-
| `deepseek` | DeepSeek | `DEEPSEEK_API_KEY` |
|
|
44
|
+
| `deepseek` | DeepSeek | `DEEPSEEK_API_KEY` 或 `~/.dsh/.credentials.yaml` | 缺凭证提前判停;`DSH_BIN` 指向稳定安装,`DSH_PACKAGE` pin 版本 |
|
|
45
45
|
| `gemini` | Gemini | `~/.gemini/oauth_creds.json` / `GEMINI_API_KEY` | 自动探测 OAuth 凭证与系统 Key |
|
|
46
46
|
| `copilot` | Copilot | `~/.copilot/config.json` / `GH_TOKEN` | 自动提取 `loggedInUsers` 凭证列表 |
|
|
47
47
|
| `opencode` | OpenCode | `$XDG_DATA_HOME/opencode/auth.json` | 遵循 XDG / `%LOCALAPPDATA%` 规范 |
|
|
48
48
|
| `agy` | agy | 官方桥接器免密直连 | `tryDirectSessionFirst` 免鉴权直通 |
|
|
49
49
|
|
|
50
|
+
### DeepSeek(dsh)在新机器上接入
|
|
51
|
+
|
|
52
|
+
不需要改任何本机 profile,三步即可复现:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
node scripts/setup-dsh-acp.mjs # 装/复用用户级运行时并自检 ACP 握手
|
|
56
|
+
export DEEPSEEK_API_KEY=sk-... # 或在 dsh/桌面版里登录(二选一)
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
如果用户本机根本没装/没登录 harness,宿主可以直接用内置的「URL + Token」表单,免环境变量:
|
|
60
|
+
|
|
61
|
+
```typescript
|
|
62
|
+
import { saveDeepseekProvider, getDeepseekProviderStatus } from '@yitom/acp-client'
|
|
63
|
+
|
|
64
|
+
getDeepseekProviderStatus() // { configured, baseUrl?, isOfficial, hasApiKey }
|
|
65
|
+
saveDeepseekProvider({ baseUrl: 'https://api.deepseek.com', apiKey: 'sk-...' }) // URL 留空即官方端点
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
SDK 会按 `DSH_BIN` → 用户级稳定安装(自动取已装最高版本)→ `DSH_PACKAGE` → `bunx` 的顺序解析启动目标,并在 spawn 时附加 `--patch` 覆盖层把会话模型修正为 `deepseek-flash`(= DeepSeek-V4.1-Flash;桌面端的 `1017` 只是 UI 徽标)。详见 [API 参考 §DeepSeek](./docs/api-reference.md)。
|
|
69
|
+
|
|
50
70
|
---
|
|
51
71
|
|
|
52
72
|
## 🚀 快速上手 (1 分钟代码)
|
|
@@ -171,3 +191,7 @@ is negotiated separately and is not implied by permissions or this fallback.
|
|
|
171
191
|
|
|
172
192
|
GitHub Actions builds and smoke-checks Linux, Windows and macOS packages and uploads a dist
|
|
173
193
|
artifact per OS. Only version-tag pushes publish to npm; branch/PR builds do not publish.
|
|
194
|
+
|
|
195
|
+
### 宿主接入的通用生命周期
|
|
196
|
+
|
|
197
|
+
`src/client/sdk-client.ts` 统一官方 SDK 流桥接、请求超时与方法类型推导;`connectSdkClient` 可传第四参 `{ name }`。`src/client/session-open.ts` 统一恢复/新建、原生扩展回退与有界工具输出恢复。`preserveMcpOnRetry: true` 保留重试时的 MCP 工具;缺省保持旧客户端的裸调回退策略。窗口、IPC、诊断日志由宿主提供,不进入协议包。
|
|
@@ -119,6 +119,11 @@ export interface AcpConfigOptionValue {
|
|
|
119
119
|
value: string;
|
|
120
120
|
name: string;
|
|
121
121
|
description?: string;
|
|
122
|
+
/**
|
|
123
|
+
* 分组名(ACP 允许 select 选项嵌套 `{group, name, options}`)。
|
|
124
|
+
* 解析时拍平为一维列表并保留分组标签,value 保持 agent 原始编码不变。
|
|
125
|
+
*/
|
|
126
|
+
group?: string;
|
|
122
127
|
}
|
|
123
128
|
export interface AcpConfigOption {
|
|
124
129
|
configId: string;
|
|
@@ -267,6 +272,28 @@ export interface AcpProxySettings {
|
|
|
267
272
|
host: string;
|
|
268
273
|
port: number;
|
|
269
274
|
}
|
|
275
|
+
/**
|
|
276
|
+
* DeepSeek(dsh)自定义端点/凭证:宿主表单「URL + Token」的落库形状。
|
|
277
|
+
* 落库后由 SDK 在 spawn 时转成 `DEEPSEEK_BASE_URL` / `DEEPSEEK_API_KEY`,
|
|
278
|
+
* 不写 harness 自己的 `$DSH_HOME/.credentials.yaml`(留在官方位置)。
|
|
279
|
+
*/
|
|
280
|
+
export interface AcpDeepseekProviderStatus {
|
|
281
|
+
configured: boolean;
|
|
282
|
+
/** 已落库的端点;未配置时不返回 */
|
|
283
|
+
baseUrl?: string;
|
|
284
|
+
/**
|
|
285
|
+
* 是否使用官方默认端点(未配置或配置值等于官方地址)。
|
|
286
|
+
* 宿主据此渲染「官方 / 自定义」二选一。
|
|
287
|
+
*/
|
|
288
|
+
isOfficial: boolean;
|
|
289
|
+
hasApiKey: boolean;
|
|
290
|
+
}
|
|
291
|
+
export interface AcpDeepseekProviderSavePayload {
|
|
292
|
+
/** 空串/未填时回落官方端点 */
|
|
293
|
+
baseUrl?: string;
|
|
294
|
+
/** 空串时保留已存的 Key(只改端点不重填 Token 的常见操作) */
|
|
295
|
+
apiKey?: string;
|
|
296
|
+
}
|
|
270
297
|
export declare const CODEX_ACP_NPM_PACKAGE: '@agentclientprotocol/codex-acp';
|
|
271
298
|
export declare const CLAUDE_ACP_NPM_PACKAGE: '@agentclientprotocol/claude-agent-acp';
|
|
272
299
|
export declare const DEEPSEEK_DSH_NPM_PACKAGE: '@deepseek-ai/dsh';
|