@anycon/protocol 0.1.0
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/LICENSE +176 -0
- package/README.md +146 -0
- package/README.zh-CN.md +118 -0
- package/dist/constants.d.ts +151 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +159 -0
- package/dist/constants.js.map +1 -0
- package/dist/crypto.d.ts +202 -0
- package/dist/crypto.d.ts.map +1 -0
- package/dist/crypto.js +218 -0
- package/dist/crypto.js.map +1 -0
- package/dist/envelope.d.ts +105 -0
- package/dist/envelope.d.ts.map +1 -0
- package/dist/envelope.js +390 -0
- package/dist/envelope.js.map +1 -0
- package/dist/errors.d.ts +5 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +5 -0
- package/dist/errors.js.map +1 -0
- package/dist/generated.d.ts +2007 -0
- package/dist/generated.d.ts.map +1 -0
- package/dist/generated.js +4 -0
- package/dist/generated.js.map +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -0
- package/dist/method-types.d.ts +293 -0
- package/dist/method-types.d.ts.map +1 -0
- package/dist/method-types.js +2 -0
- package/dist/method-types.js.map +1 -0
- package/dist/rpc.d.ts +70 -0
- package/dist/rpc.d.ts.map +1 -0
- package/dist/rpc.js +310 -0
- package/dist/rpc.js.map +1 -0
- package/package.json +62 -0
- package/src/constants.ts +173 -0
- package/src/crypto.ts +427 -0
- package/src/envelope.ts +469 -0
- package/src/errors.ts +4 -0
- package/src/generated.ts +2094 -0
- package/src/index.ts +18 -0
- package/src/method-types.ts +183 -0
- package/src/rpc.ts +377 -0
- package/wasm/THIRD-PARTY-LICENSES.txt +1957 -0
- package/wasm/anycon_crypto.d.ts +248 -0
- package/wasm/anycon_crypto.js +1250 -0
- package/wasm/anycon_crypto_bg.wasm +0 -0
- package/wasm/anycon_crypto_bg.wasm.d.ts +48 -0
|
@@ -0,0 +1,2007 @@
|
|
|
1
|
+
export type ModeRisk = "normal" | "safe" | "dangerous";
|
|
2
|
+
export type ConfigOptionKind = "bool" | "select" | "text";
|
|
3
|
+
export type AgentStatus = ("ready" | "disabled" | "not_installed" | "not_authenticated" | "unsupported_version" | "error") | "loading";
|
|
4
|
+
/**
|
|
5
|
+
* 一个目录为什么不能关联为项目(ADR-33 修订,daemon.md § 10)。
|
|
6
|
+
*/
|
|
7
|
+
export type LinkBlock = "hidden" | "sensitive" | "workspace" | "data_dir" | "filesystem_root";
|
|
8
|
+
export type DeviceKind = "daemon" | "web" | "cli" | "sdk";
|
|
9
|
+
/**
|
|
10
|
+
* 控制消息集合。方向见注释:D = 设备,H = hub。
|
|
11
|
+
*/
|
|
12
|
+
export type Control = {
|
|
13
|
+
client: ClientInfo;
|
|
14
|
+
device_token?: string | null;
|
|
15
|
+
protocol_version: number;
|
|
16
|
+
type: "auth";
|
|
17
|
+
} | {
|
|
18
|
+
device_id: string;
|
|
19
|
+
/**
|
|
20
|
+
* 已配对且当前在线的对端。
|
|
21
|
+
*/
|
|
22
|
+
peers_online: string[];
|
|
23
|
+
quota?: Quota | null;
|
|
24
|
+
server_time_ms: number;
|
|
25
|
+
type: "auth_ok";
|
|
26
|
+
} | {
|
|
27
|
+
reason: AuthFailReason;
|
|
28
|
+
type: "auth_fail";
|
|
29
|
+
} | {
|
|
30
|
+
match_id: string;
|
|
31
|
+
type: "pair_begin";
|
|
32
|
+
} | {
|
|
33
|
+
expires_at_ms: number;
|
|
34
|
+
type: "pair_registered";
|
|
35
|
+
} | {
|
|
36
|
+
match_id: string;
|
|
37
|
+
type: "pair_join";
|
|
38
|
+
} | {
|
|
39
|
+
peer: string;
|
|
40
|
+
role: PairRole;
|
|
41
|
+
type: "pair_matched";
|
|
42
|
+
} | {
|
|
43
|
+
peer: string;
|
|
44
|
+
type: "pair_confirm";
|
|
45
|
+
} | {
|
|
46
|
+
device_id?: string | null;
|
|
47
|
+
device_token?: string | null;
|
|
48
|
+
peer: string;
|
|
49
|
+
type: "pair_done";
|
|
50
|
+
} | {
|
|
51
|
+
reason: PairFailReason;
|
|
52
|
+
type: "pair_failed";
|
|
53
|
+
} | {
|
|
54
|
+
node: string;
|
|
55
|
+
type: "enroll_begin";
|
|
56
|
+
} | {
|
|
57
|
+
enroll_id: string;
|
|
58
|
+
expires_at_ms: number;
|
|
59
|
+
node: string;
|
|
60
|
+
type: "enroll_started";
|
|
61
|
+
} | {
|
|
62
|
+
enroll_id: string;
|
|
63
|
+
expires_at_ms: number;
|
|
64
|
+
peer: string;
|
|
65
|
+
type: "enroll_request";
|
|
66
|
+
} | {
|
|
67
|
+
enroll_id: string;
|
|
68
|
+
type: "enroll_cancel";
|
|
69
|
+
} | {
|
|
70
|
+
enroll_id?: string | null;
|
|
71
|
+
reason: EnrollFailReason;
|
|
72
|
+
type: "enroll_failed";
|
|
73
|
+
} | {
|
|
74
|
+
device: string;
|
|
75
|
+
type: "revoke";
|
|
76
|
+
} | {
|
|
77
|
+
device: string;
|
|
78
|
+
type: "peer_online";
|
|
79
|
+
} | {
|
|
80
|
+
device: string;
|
|
81
|
+
type: "peer_offline";
|
|
82
|
+
} | {
|
|
83
|
+
seq: number;
|
|
84
|
+
to: string;
|
|
85
|
+
type: "undeliverable";
|
|
86
|
+
} | {
|
|
87
|
+
dropped_seqs: number[];
|
|
88
|
+
to: string;
|
|
89
|
+
type: "queue_overflow";
|
|
90
|
+
} | {
|
|
91
|
+
seq: number;
|
|
92
|
+
type: "queue_drop";
|
|
93
|
+
} | {
|
|
94
|
+
seq: number;
|
|
95
|
+
to: string;
|
|
96
|
+
type: "backpressure";
|
|
97
|
+
} | {
|
|
98
|
+
reason: DropReason;
|
|
99
|
+
seq: number;
|
|
100
|
+
type: "dropped";
|
|
101
|
+
} | {
|
|
102
|
+
retry_after_ms: number;
|
|
103
|
+
type: "rate_limited";
|
|
104
|
+
} | {
|
|
105
|
+
quota: Quota;
|
|
106
|
+
type: "quota_update";
|
|
107
|
+
} | {
|
|
108
|
+
type: "rotate_token";
|
|
109
|
+
} | {
|
|
110
|
+
device_token: string;
|
|
111
|
+
type: "token_rotated";
|
|
112
|
+
};
|
|
113
|
+
export type AuthFailReason = "invalid" | "revoked" | "version" | "quota" | "protocol";
|
|
114
|
+
/**
|
|
115
|
+
* 配对中的角色:daemon(或已配对设备代发)是 `host`,新设备是 `joiner`。
|
|
116
|
+
* Noise XXpsk3 由 **joiner 发起**(initiator),host 是 responder。
|
|
117
|
+
*/
|
|
118
|
+
export type PairRole = "host" | "joiner";
|
|
119
|
+
export type PairFailReason = "not_found" | "timeout" | "peer_gone" | "rate_limited" | "quota" | "forbidden";
|
|
120
|
+
/**
|
|
121
|
+
* `enroll_failed.reason`(ADR-36,protocol.md § 4.4)。
|
|
122
|
+
*/
|
|
123
|
+
export type EnrollFailReason = "forbidden" | "not_found" | "offline" | "rate_limited" | "quota" | "busy" | "timeout" | "peer_gone" | "cancelled";
|
|
124
|
+
export type DropReason = "too_large" | "not_paired" | "rate_limited";
|
|
125
|
+
/**
|
|
126
|
+
* `session.diff` 比较的起点。
|
|
127
|
+
*/
|
|
128
|
+
export type DiffAgainst = "base" | "uncommitted";
|
|
129
|
+
export type DiffFileStatus = "added" | "modified" | "deleted" | "renamed";
|
|
130
|
+
/**
|
|
131
|
+
* 接入期间 `handshake` 信封的 body。N = 新设备(initiator),D = daemon(responder)。
|
|
132
|
+
*/
|
|
133
|
+
export type EnrollFrame = {
|
|
134
|
+
/**
|
|
135
|
+
* 仅 `code`:`true` = 请求已配对设备批准;`false` = 用「添加设备」主动生成的码。
|
|
136
|
+
*/
|
|
137
|
+
approval?: boolean;
|
|
138
|
+
hint: EnrollHint;
|
|
139
|
+
method: EnrollMethod;
|
|
140
|
+
/**
|
|
141
|
+
* 16 字节随机数,hex。CPace 的 sid = N 的 nonce ‖ D 的 nonce。
|
|
142
|
+
*/
|
|
143
|
+
nonce: string;
|
|
144
|
+
type: "hello";
|
|
145
|
+
v: number;
|
|
146
|
+
} | {
|
|
147
|
+
attempts_left?: number | null;
|
|
148
|
+
/**
|
|
149
|
+
* `code` / `password`:D 的 CPace 份额(32 字节,hex)。
|
|
150
|
+
*/
|
|
151
|
+
cpace?: string | null;
|
|
152
|
+
/**
|
|
153
|
+
* D 的 16 字节随机数,hex。每条 `ready` 都带(和 N 本轮 `hello` 的 nonce 组成 sid)。
|
|
154
|
+
*/
|
|
155
|
+
nonce?: string | null;
|
|
156
|
+
reason?: EnrollRejectReason | null;
|
|
157
|
+
retry_after_ms?: number | null;
|
|
158
|
+
/**
|
|
159
|
+
* 仅 `password`:节点盐(16 字节,hex)。
|
|
160
|
+
*/
|
|
161
|
+
salt?: string | null;
|
|
162
|
+
status: EnrollReplyStatus;
|
|
163
|
+
type: "reply";
|
|
164
|
+
} | {
|
|
165
|
+
share: string;
|
|
166
|
+
type: "cpace";
|
|
167
|
+
} | {
|
|
168
|
+
msg: string;
|
|
169
|
+
type: "noise";
|
|
170
|
+
};
|
|
171
|
+
/**
|
|
172
|
+
* 接入方法。
|
|
173
|
+
*/
|
|
174
|
+
export type EnrollMethod = "scan" | "code" | "password";
|
|
175
|
+
/**
|
|
176
|
+
* `EnrollReply.reason`(`status = rejected` 时)。
|
|
177
|
+
*/
|
|
178
|
+
export type EnrollRejectReason = "method_disabled" | "password_not_set" | "backoff" | "locked" | "no_code" | "busy" | "denied" | "wrong_secret" | "expired" | "invalid";
|
|
179
|
+
/**
|
|
180
|
+
* `EnrollReply.status`。
|
|
181
|
+
*/
|
|
182
|
+
export type EnrollReplyStatus = "wait_approval" | "ready" | "rejected";
|
|
183
|
+
/**
|
|
184
|
+
* 进行中的接入会话的状态(daemon 视角)。
|
|
185
|
+
*/
|
|
186
|
+
export type EnrollSessionStatus = "waiting_hello" | "wait_approval" | "ready";
|
|
187
|
+
/**
|
|
188
|
+
* 节点口令解锁的状态。
|
|
189
|
+
*/
|
|
190
|
+
export type EnrollPasswordState = "enabled" | "disabled" | "locked";
|
|
191
|
+
/**
|
|
192
|
+
* `node.enroll_resolved.result`。
|
|
193
|
+
*/
|
|
194
|
+
export type EnrollResult = "approved" | "denied" | "completed" | "failed" | "expired";
|
|
195
|
+
export type ErrorCode = ("exists" | "not_found" | "internal") | "invalid" | "invalid_settings" | "agent_unavailable" | "node_busy" | "busy" | "already_resolved" | "forbidden" | "unsupported" | "protocol_mismatch";
|
|
196
|
+
/**
|
|
197
|
+
* 会话事件。adapter 把各 agent 的原生事件翻译成这个集合(docs/spec/daemon.md § 8)。
|
|
198
|
+
*/
|
|
199
|
+
export type Event = {
|
|
200
|
+
attachments?: AttachmentRef[];
|
|
201
|
+
by_device: string;
|
|
202
|
+
content: string;
|
|
203
|
+
message_id: string;
|
|
204
|
+
type: "user_message";
|
|
205
|
+
} | {
|
|
206
|
+
message_id: string;
|
|
207
|
+
turn_id: number;
|
|
208
|
+
type: "turn_start";
|
|
209
|
+
} | {
|
|
210
|
+
text: string;
|
|
211
|
+
type: "text_delta";
|
|
212
|
+
} | {
|
|
213
|
+
type: "text_done";
|
|
214
|
+
} | {
|
|
215
|
+
text: string;
|
|
216
|
+
type: "thinking_delta";
|
|
217
|
+
} | {
|
|
218
|
+
duration_ms: number;
|
|
219
|
+
type: "thinking_done";
|
|
220
|
+
} | {
|
|
221
|
+
category: ToolCategory;
|
|
222
|
+
detail?: ToolCallDetail | null;
|
|
223
|
+
id: string;
|
|
224
|
+
input?: unknown;
|
|
225
|
+
name: string;
|
|
226
|
+
title: string;
|
|
227
|
+
type: "tool_call";
|
|
228
|
+
} | {
|
|
229
|
+
id: string;
|
|
230
|
+
text: string;
|
|
231
|
+
type: "tool_output_delta";
|
|
232
|
+
} | {
|
|
233
|
+
detail?: ToolResultDetail | null;
|
|
234
|
+
id: string;
|
|
235
|
+
is_error?: boolean;
|
|
236
|
+
output?: unknown;
|
|
237
|
+
type: "tool_result";
|
|
238
|
+
} | {
|
|
239
|
+
kind: FileChangeKind;
|
|
240
|
+
path: string;
|
|
241
|
+
type: "file_changed";
|
|
242
|
+
} | {
|
|
243
|
+
entries: PlanEntry[];
|
|
244
|
+
type: "plan";
|
|
245
|
+
} | {
|
|
246
|
+
detail: PermissionDetail;
|
|
247
|
+
expires_at_ms?: number | null;
|
|
248
|
+
kind: PermissionKind;
|
|
249
|
+
options: PermissionOption[];
|
|
250
|
+
request_id: string;
|
|
251
|
+
title: string;
|
|
252
|
+
type: "permission";
|
|
253
|
+
} | {
|
|
254
|
+
by_device: string;
|
|
255
|
+
option_id?: string | null;
|
|
256
|
+
request_id: string;
|
|
257
|
+
type: "permission_resolved";
|
|
258
|
+
} | {
|
|
259
|
+
reason: TurnDoneReason;
|
|
260
|
+
turn_id: number;
|
|
261
|
+
type: "turn_done";
|
|
262
|
+
usage?: Usage | null;
|
|
263
|
+
} | {
|
|
264
|
+
position?: number | null;
|
|
265
|
+
queued_messages?: number | null;
|
|
266
|
+
state: SessionStatus;
|
|
267
|
+
type: "status";
|
|
268
|
+
} | {
|
|
269
|
+
settings: SessionSettings;
|
|
270
|
+
type: "settings_changed";
|
|
271
|
+
} | {
|
|
272
|
+
title: string;
|
|
273
|
+
type: "title_changed";
|
|
274
|
+
} | {
|
|
275
|
+
action: GitAction;
|
|
276
|
+
/**
|
|
277
|
+
* `sync_*` 和 `worktree_created` 时给 base。
|
|
278
|
+
*/
|
|
279
|
+
base?: string | null;
|
|
280
|
+
/**
|
|
281
|
+
* 会话 worktree 的分支。
|
|
282
|
+
*/
|
|
283
|
+
branch: string;
|
|
284
|
+
/**
|
|
285
|
+
* `sync_merged`:合进来的提交数;`worktree_created` / `worktree_restored`:从 `.worktreeinclude` 复制的文件数。
|
|
286
|
+
*/
|
|
287
|
+
count?: number | null;
|
|
288
|
+
/**
|
|
289
|
+
* `sync_conflicts`:冲突的文件(最多 50 个)。
|
|
290
|
+
*/
|
|
291
|
+
files?: string[];
|
|
292
|
+
/**
|
|
293
|
+
* `worktree_removed` 时是稳定取值:`branch_deleted`(分支一起删了,或者本来就不在了)/ `branch_kept`。
|
|
294
|
+
* 其他动作是补充说明(英文,调试用;比如 `worktree_failed` 的原因、`.worktreeinclude` 超过上限没复制完)。
|
|
295
|
+
*/
|
|
296
|
+
note?: string | null;
|
|
297
|
+
type: "git";
|
|
298
|
+
} | {
|
|
299
|
+
code: string;
|
|
300
|
+
message: string;
|
|
301
|
+
recoverable: boolean;
|
|
302
|
+
type: "error";
|
|
303
|
+
};
|
|
304
|
+
export type ToolCategory = "shell" | "file_edit" | "file_read" | "search" | "web" | "subagent" | "mcp" | "other";
|
|
305
|
+
export type EditKind = "edit" | "write" | "delete" | "move";
|
|
306
|
+
export type FileChangeKind = "created" | "modified" | "deleted";
|
|
307
|
+
export type PlanStatus = "pending" | "in_progress" | "completed";
|
|
308
|
+
export type PermissionKind = "tool" | "plan" | "question" | "mode_change" | "other";
|
|
309
|
+
/**
|
|
310
|
+
* 借用 ACP 的枚举,客户端据此选图标和颜色。
|
|
311
|
+
*/
|
|
312
|
+
export type PermissionOptionKind = "allow_once" | "allow_always" | "reject_once" | "reject_always";
|
|
313
|
+
export type TurnDoneReason = "completed" | "cancelled" | "error" | "max_turns" | "budget";
|
|
314
|
+
export type SessionStatus = ("starting" | "running" | "waiting_permission" | "idle" | "ended" | "error") | "queued" | "interrupted";
|
|
315
|
+
/**
|
|
316
|
+
* `Event::Git` 的动作。
|
|
317
|
+
*/
|
|
318
|
+
export type GitAction = ("sync_up_to_date" | "sync_merged" | "sync_conflicts" | "sync_aborted") | "worktree_created" | "worktree_failed" | "worktree_removed" | "worktree_kept" | "worktree_restored" | "worktree_missing";
|
|
319
|
+
/**
|
|
320
|
+
* 信封种类。hub 对每种的处理见 docs/protocol.md § 3。
|
|
321
|
+
*/
|
|
322
|
+
export type Kind = "handshake" | "data" | "notify" | "control";
|
|
323
|
+
/**
|
|
324
|
+
* 节点配置 `worktree.default` 的取值,也是 `SessionWorkspace` 的两种模式。
|
|
325
|
+
*/
|
|
326
|
+
export type SessionWorkspaceMode = "local" | "worktree";
|
|
327
|
+
/**
|
|
328
|
+
* `node.security_event.kind`。
|
|
329
|
+
*/
|
|
330
|
+
export type SecurityEventKind = "device_enrolled" | "password_failures" | "password_locked" | "password_changed" | "settings_changed";
|
|
331
|
+
export type NotifyCategory = ("permission_requested" | "turn_finished" | "error" | "session_idle") | "enroll_requested" | "security";
|
|
332
|
+
/**
|
|
333
|
+
* 项目从哪来。
|
|
334
|
+
*/
|
|
335
|
+
export type ProjectKind = "folder" | "linked";
|
|
336
|
+
export type PullRequestState = "open" | "draft" | "merged" | "closed";
|
|
337
|
+
/**
|
|
338
|
+
* 一条内层消息。解码时按字段判别:有 `method` 且有 `id` 是请求,有 `method` 无 `id` 是通知,否则是响应。
|
|
339
|
+
*/
|
|
340
|
+
export type RpcMessage = RpcRequest | RpcNotification | RpcResponse;
|
|
341
|
+
export type RpcId = number | string;
|
|
342
|
+
/**
|
|
343
|
+
* 归档 / 删除会话时怎么处理它的 worktree。
|
|
344
|
+
*/
|
|
345
|
+
export type WorktreeDisposal = "auto" | "keep" | "remove";
|
|
346
|
+
/**
|
|
347
|
+
* anycon 建的 worktree 现在的状态。
|
|
348
|
+
*/
|
|
349
|
+
export type WorktreeState = "creating" | "active" | "kept" | "removed" | "missing" | "failed";
|
|
350
|
+
/**
|
|
351
|
+
* 会话在哪里工作。`session.create` 不带时是 `local`(线路上不猜默认值;客户端按节点的
|
|
352
|
+
* `worktree.default` 和用户上次的选择决定要不要带 `worktree`)。
|
|
353
|
+
*/
|
|
354
|
+
export type SessionWorkspace = {
|
|
355
|
+
mode: "local";
|
|
356
|
+
} | {
|
|
357
|
+
/**
|
|
358
|
+
* 从哪个 ref 开分支:本地分支名、`origin/main` 这样的远端跟踪分支、标签,或提交 SHA。daemon 把分支 / 标签写法
|
|
359
|
+
* 规范成完整引用名记下(`refs/heads/main`、`refs/remotes/origin/main`、`refs/tags/v1.0`;展示时去掉前缀),其他能解析成提交的
|
|
360
|
+
* 写法(`HEAD`、`HEAD~1`…)只记解析出的提交,不再按名字重新解析。缺省 = `workspace.branches` 的 `default_base`。
|
|
361
|
+
*/
|
|
362
|
+
base?: string | null;
|
|
363
|
+
/**
|
|
364
|
+
* 新分支的完整名字,必须是还不存在的分支。缺省 = `<worktree.branch_prefix>/<slug>`,
|
|
365
|
+
* slug 由 daemon 从第一条消息里的英文单词生成,取不到就随机两个词。
|
|
366
|
+
*/
|
|
367
|
+
branch?: string | null;
|
|
368
|
+
mode: "worktree";
|
|
369
|
+
};
|
|
370
|
+
/**
|
|
371
|
+
* `session.set_settings` 里可以被「清除」的字段。`SessionSettings` 的 `Option` 字段在线路上
|
|
372
|
+
* 缺省和 `null` 等价、都表示「保持不变」,所以要清掉一个值得在 `clear` 里点名;`options` 不在
|
|
373
|
+
* 这里:它的键值为 `null` 就是删键。
|
|
374
|
+
*/
|
|
375
|
+
export type ClearableSetting = ("thinking" | "mode" | "system_prompt_append" | "max_turns" | "max_budget_usd") | "model" | "env";
|
|
376
|
+
export type SyncOutcome = "up_to_date" | "merged" | "conflicts" | "aborted";
|
|
377
|
+
/**
|
|
378
|
+
* 仅用于导出 schema,不在线上传输。字段名即 TS / Python 的类型名。
|
|
379
|
+
*/
|
|
380
|
+
export interface ProtocolSchema {
|
|
381
|
+
agent_diagnose_params: AgentDiagnoseParams;
|
|
382
|
+
agent_diagnose_result: AgentDiagnoseResult;
|
|
383
|
+
agent_info: AgentInfo;
|
|
384
|
+
agent_list_params: AgentListParams;
|
|
385
|
+
agent_list_result: AgentListResult;
|
|
386
|
+
attachment_ref: AttachmentRef;
|
|
387
|
+
blob_get_params: BlobGetParams;
|
|
388
|
+
blob_get_result: BlobGetResult;
|
|
389
|
+
blob_id_params: BlobIdParams;
|
|
390
|
+
blob_put_begin_params: BlobPutBeginParams;
|
|
391
|
+
blob_put_begin_result: BlobPutBeginResult;
|
|
392
|
+
blob_put_chunk_params: BlobPutChunkParams;
|
|
393
|
+
browse_entry: BrowseEntry;
|
|
394
|
+
client_info: ClientInfo;
|
|
395
|
+
control: Control;
|
|
396
|
+
diff_against: DiffAgainst;
|
|
397
|
+
diff_file: DiffFile;
|
|
398
|
+
diff_file_status: DiffFileStatus;
|
|
399
|
+
empty: Empty;
|
|
400
|
+
enroll_fail_reason: EnrollFailReason;
|
|
401
|
+
enroll_frame: EnrollFrame;
|
|
402
|
+
enroll_hint: EnrollHint;
|
|
403
|
+
enroll_info: EnrollInfo;
|
|
404
|
+
enroll_method: EnrollMethod;
|
|
405
|
+
enroll_password_state: EnrollPasswordState;
|
|
406
|
+
enroll_password_status: EnrollPasswordStatus;
|
|
407
|
+
enroll_reject_reason: EnrollRejectReason;
|
|
408
|
+
enroll_reply_status: EnrollReplyStatus;
|
|
409
|
+
enroll_result: EnrollResult;
|
|
410
|
+
enroll_session_status: EnrollSessionStatus;
|
|
411
|
+
error_code: ErrorCode;
|
|
412
|
+
event: Event;
|
|
413
|
+
fs_list_params: FsListParams;
|
|
414
|
+
fs_list_result: FsListResult;
|
|
415
|
+
fs_read_params: FsReadParams;
|
|
416
|
+
fs_read_result: FsReadResult;
|
|
417
|
+
git_action: GitAction;
|
|
418
|
+
job_cancel_params: JobCancelParams;
|
|
419
|
+
job_done: JobDone;
|
|
420
|
+
job_progress: JobProgress;
|
|
421
|
+
job_started: JobStarted;
|
|
422
|
+
kind: Kind;
|
|
423
|
+
link_block: LinkBlock;
|
|
424
|
+
node_audit_params: NodeAuditParams;
|
|
425
|
+
node_audit_result: NodeAuditResult;
|
|
426
|
+
node_devices_result: NodeDevicesResult;
|
|
427
|
+
node_doctor_result: NodeDoctorResult;
|
|
428
|
+
node_enroll_approve_params: NodeEnrollApproveParams;
|
|
429
|
+
node_enroll_approve_result: NodeEnrollApproveResult;
|
|
430
|
+
node_enroll_code_result: NodeEnrollCodeResult;
|
|
431
|
+
node_enroll_id_params: NodeEnrollIdParams;
|
|
432
|
+
node_enroll_list_result: NodeEnrollListResult;
|
|
433
|
+
node_enroll_resolved: NodeEnrollResolved;
|
|
434
|
+
node_enroll_status_result: NodeEnrollStatusResult;
|
|
435
|
+
node_info: NodeInfo;
|
|
436
|
+
node_pair_begin_params: NodePairBeginParams;
|
|
437
|
+
node_pair_begin_result: NodePairBeginResult;
|
|
438
|
+
node_revoke_device_params: NodeRevokeDeviceParams;
|
|
439
|
+
node_security_event: NodeSecurityEvent;
|
|
440
|
+
node_set_agent_defaults_params: NodeSetAgentDefaultsParams;
|
|
441
|
+
node_set_enroll_enabled_params: NodeSetEnrollEnabledParams;
|
|
442
|
+
node_set_enroll_password_params: NodeSetEnrollPasswordParams;
|
|
443
|
+
node_stats: NodeStats;
|
|
444
|
+
node_worktree_settings: NodeWorktreeSettings;
|
|
445
|
+
notify_body: NotifyBody;
|
|
446
|
+
notify_detail: NotifyDetail;
|
|
447
|
+
pair_ack: PairAck;
|
|
448
|
+
permission_list_params: PermissionListParams;
|
|
449
|
+
permission_list_result: PermissionListResult;
|
|
450
|
+
permission_request: PermissionRequest;
|
|
451
|
+
permission_resolved: PermissionResolved;
|
|
452
|
+
permission_respond_params: PermissionRespondParams;
|
|
453
|
+
project: Project;
|
|
454
|
+
project_kind: ProjectKind;
|
|
455
|
+
pull_request_info: PullRequestInfo;
|
|
456
|
+
pull_request_state: PullRequestState;
|
|
457
|
+
quota: Quota;
|
|
458
|
+
rpc_error: RpcError;
|
|
459
|
+
rpc_message: RpcMessage;
|
|
460
|
+
security_event_kind: SecurityEventKind;
|
|
461
|
+
session_archive_params: SessionArchiveParams;
|
|
462
|
+
session_changed: SessionChanged;
|
|
463
|
+
session_create_params: SessionCreateParams;
|
|
464
|
+
session_delete_params: SessionDeleteParams;
|
|
465
|
+
session_diff_params: SessionDiffParams;
|
|
466
|
+
session_diff_result: SessionDiffResult;
|
|
467
|
+
session_event: SessionEvent;
|
|
468
|
+
session_git_status: SessionGitStatus;
|
|
469
|
+
session_git_status_params: SessionGitStatusParams;
|
|
470
|
+
session_history_params: SessionHistoryParams;
|
|
471
|
+
session_history_result: SessionHistoryResult;
|
|
472
|
+
session_id_params: SessionIdParams;
|
|
473
|
+
session_list_params: SessionListParams;
|
|
474
|
+
session_list_result: SessionListResult;
|
|
475
|
+
session_promote_params: SessionPromoteParams;
|
|
476
|
+
session_rename_params: SessionRenameParams;
|
|
477
|
+
session_search_params: SessionSearchParams;
|
|
478
|
+
session_search_result: SessionSearchResult;
|
|
479
|
+
session_send_params: SessionSendParams;
|
|
480
|
+
session_send_result: SessionSendResult;
|
|
481
|
+
session_set_settings_params: SessionSetSettingsParams;
|
|
482
|
+
session_set_settings_result: SessionSetSettingsResult;
|
|
483
|
+
session_settings: SessionSettings;
|
|
484
|
+
session_summary: SessionSummary;
|
|
485
|
+
session_sync_base_params: SessionSyncBaseParams;
|
|
486
|
+
session_sync_base_result: SessionSyncBaseResult;
|
|
487
|
+
session_workspace: SessionWorkspace;
|
|
488
|
+
session_workspace_mode: SessionWorkspaceMode;
|
|
489
|
+
session_worktree: SessionWorktree;
|
|
490
|
+
sync_outcome: SyncOutcome;
|
|
491
|
+
trash_entry: TrashEntry;
|
|
492
|
+
workspace_branches_params: WorkspaceBranchesParams;
|
|
493
|
+
workspace_branches_result: WorkspaceBranchesResult;
|
|
494
|
+
workspace_browse_params: WorkspaceBrowseParams;
|
|
495
|
+
workspace_browse_result: WorkspaceBrowseResult;
|
|
496
|
+
workspace_changed: WorkspaceChanged;
|
|
497
|
+
workspace_clone_params: WorkspaceCloneParams;
|
|
498
|
+
workspace_create_params: WorkspaceCreateParams;
|
|
499
|
+
workspace_link_params: WorkspaceLinkParams;
|
|
500
|
+
workspace_list_result: WorkspaceListResult;
|
|
501
|
+
workspace_name_params: WorkspaceNameParams;
|
|
502
|
+
workspace_remove_worktree_params: WorkspaceRemoveWorktreeParams;
|
|
503
|
+
workspace_rename_params: WorkspaceRenameParams;
|
|
504
|
+
workspace_trash_id_params: WorkspaceTrashIdParams;
|
|
505
|
+
workspace_trash_list_result: WorkspaceTrashListResult;
|
|
506
|
+
workspace_worktrees_params: WorkspaceWorktreesParams;
|
|
507
|
+
workspace_worktrees_result: WorkspaceWorktreesResult;
|
|
508
|
+
worktree_disposal: WorktreeDisposal;
|
|
509
|
+
worktree_info: WorktreeInfo;
|
|
510
|
+
worktree_state: WorktreeState;
|
|
511
|
+
}
|
|
512
|
+
export interface AgentDiagnoseParams {
|
|
513
|
+
id: string;
|
|
514
|
+
}
|
|
515
|
+
export interface AgentDiagnoseResult {
|
|
516
|
+
/**
|
|
517
|
+
* 结构化:命令来源、daemon PATH、shell、which -a、解析路径、版本、认证、模型数、状态。
|
|
518
|
+
*/
|
|
519
|
+
fields: DiagnosticField[];
|
|
520
|
+
id: string;
|
|
521
|
+
/**
|
|
522
|
+
* 人类可读全文(`anycon doctor` 直接打印)。
|
|
523
|
+
*/
|
|
524
|
+
text: string;
|
|
525
|
+
}
|
|
526
|
+
export interface DiagnosticField {
|
|
527
|
+
label: string;
|
|
528
|
+
value: string;
|
|
529
|
+
}
|
|
530
|
+
export interface AgentInfo {
|
|
531
|
+
allow_custom_model?: boolean;
|
|
532
|
+
capabilities?: AgentCapabilities;
|
|
533
|
+
/**
|
|
534
|
+
* `claude-stream-json` | `codex-app-server` | `acp` | `sdk` | `mock`
|
|
535
|
+
*/
|
|
536
|
+
driver: string;
|
|
537
|
+
enabled: boolean;
|
|
538
|
+
/**
|
|
539
|
+
* adapter id:`claude-code`、`codex`、`mock`、ACP agent 用自己的名字。
|
|
540
|
+
*/
|
|
541
|
+
id: string;
|
|
542
|
+
issue?: AgentIssue | null;
|
|
543
|
+
label: string;
|
|
544
|
+
models?: ModelInfo[];
|
|
545
|
+
modes?: ModeInfo[];
|
|
546
|
+
options?: ConfigOption[];
|
|
547
|
+
path?: string | null;
|
|
548
|
+
probed_at_ms: number;
|
|
549
|
+
status: AgentStatus;
|
|
550
|
+
version?: string | null;
|
|
551
|
+
}
|
|
552
|
+
export interface AgentCapabilities {
|
|
553
|
+
/**
|
|
554
|
+
* 可接受的附件 mime,如 `image/png`。
|
|
555
|
+
*/
|
|
556
|
+
attachments?: string[];
|
|
557
|
+
/**
|
|
558
|
+
* 支持每会话 env。
|
|
559
|
+
*/
|
|
560
|
+
env: boolean;
|
|
561
|
+
/**
|
|
562
|
+
* turn 进行中能否插话。
|
|
563
|
+
*/
|
|
564
|
+
interject: boolean;
|
|
565
|
+
interrupt: boolean;
|
|
566
|
+
/**
|
|
567
|
+
* 进程退出后能否续接。
|
|
568
|
+
*/
|
|
569
|
+
resume: boolean;
|
|
570
|
+
rewind: boolean;
|
|
571
|
+
structured_output: boolean;
|
|
572
|
+
/**
|
|
573
|
+
* 会不会发 `thinking_delta`。
|
|
574
|
+
*/
|
|
575
|
+
thinking_stream: boolean;
|
|
576
|
+
/**
|
|
577
|
+
* `turn_done` 带不带 usage。
|
|
578
|
+
*/
|
|
579
|
+
usage: boolean;
|
|
580
|
+
}
|
|
581
|
+
export interface AgentIssue {
|
|
582
|
+
/**
|
|
583
|
+
* 稳定码,如 `binary_not_found`、`login_required`、`version_too_old`、`probe_timeout`。
|
|
584
|
+
*/
|
|
585
|
+
code: string;
|
|
586
|
+
/**
|
|
587
|
+
* 修复建议,通常是一条可复制的命令。
|
|
588
|
+
*/
|
|
589
|
+
hint?: string | null;
|
|
590
|
+
message: string;
|
|
591
|
+
}
|
|
592
|
+
export interface ModelInfo {
|
|
593
|
+
default?: boolean;
|
|
594
|
+
description?: string | null;
|
|
595
|
+
/**
|
|
596
|
+
* 原样传给 agent 的字符串。
|
|
597
|
+
*/
|
|
598
|
+
id: string;
|
|
599
|
+
label: string;
|
|
600
|
+
/**
|
|
601
|
+
* 如 `1m`。
|
|
602
|
+
*/
|
|
603
|
+
tags?: string[];
|
|
604
|
+
thinking?: ThinkingOptions | null;
|
|
605
|
+
}
|
|
606
|
+
/**
|
|
607
|
+
* 某个模型支持的思考等级。**挂在模型上**,不同模型不同。
|
|
608
|
+
*/
|
|
609
|
+
export interface ThinkingOptions {
|
|
610
|
+
default?: string | null;
|
|
611
|
+
options: Choice[];
|
|
612
|
+
}
|
|
613
|
+
export interface Choice {
|
|
614
|
+
description?: string | null;
|
|
615
|
+
id: string;
|
|
616
|
+
label: string;
|
|
617
|
+
}
|
|
618
|
+
/**
|
|
619
|
+
* 权限模式。id 是 agent 自己的(Claude Code 的 `acceptEdits`、Codex 的 `workspace`…),不翻译不归一。
|
|
620
|
+
*/
|
|
621
|
+
export interface ModeInfo {
|
|
622
|
+
default?: boolean;
|
|
623
|
+
description?: string | null;
|
|
624
|
+
id: string;
|
|
625
|
+
label: string;
|
|
626
|
+
risk: ModeRisk;
|
|
627
|
+
}
|
|
628
|
+
/**
|
|
629
|
+
* agent 特定的其他选项(Codex fast mode、ACP 自定义 configOptions…)。客户端用通用控件渲染。
|
|
630
|
+
*/
|
|
631
|
+
export interface ConfigOption {
|
|
632
|
+
choices?: Choice[];
|
|
633
|
+
default?: unknown;
|
|
634
|
+
description?: string | null;
|
|
635
|
+
id: string;
|
|
636
|
+
kind: ConfigOptionKind;
|
|
637
|
+
label: string;
|
|
638
|
+
}
|
|
639
|
+
export interface AgentListParams {
|
|
640
|
+
/**
|
|
641
|
+
* 等于当前 etag 时返回 `not_modified = true` 且 `agents` 为空。
|
|
642
|
+
*/
|
|
643
|
+
if_none_match?: string | null;
|
|
644
|
+
/**
|
|
645
|
+
* 强制重探(含模型列表那一步)。
|
|
646
|
+
*/
|
|
647
|
+
refresh?: boolean;
|
|
648
|
+
}
|
|
649
|
+
export interface AgentListResult {
|
|
650
|
+
agents: AgentInfo[];
|
|
651
|
+
etag: string;
|
|
652
|
+
not_modified?: boolean;
|
|
653
|
+
}
|
|
654
|
+
/**
|
|
655
|
+
* 消息里的一个附件(ADR-35):指向 daemon 上已经传完的 blob。客户端从 `blob.put_end` 拿到它、原样放进
|
|
656
|
+
* `session.send` / `session.create`;daemon 以自己记录的元数据为准写进 `user_message` 事件。
|
|
657
|
+
*/
|
|
658
|
+
export interface AttachmentRef {
|
|
659
|
+
blob_id: string;
|
|
660
|
+
bytes: number;
|
|
661
|
+
height?: number | null;
|
|
662
|
+
mime: string;
|
|
663
|
+
name: string;
|
|
664
|
+
/**
|
|
665
|
+
* 图片像素宽高(daemon 读文件头得出;读不出来时省略)。客户端用来在下载前占好位置。
|
|
666
|
+
*/
|
|
667
|
+
width?: number | null;
|
|
668
|
+
}
|
|
669
|
+
/**
|
|
670
|
+
* `blob.get`:按偏移读一段。
|
|
671
|
+
*/
|
|
672
|
+
export interface BlobGetParams {
|
|
673
|
+
blob_id: string;
|
|
674
|
+
/**
|
|
675
|
+
* 缺省和上限都是 512 KiB。
|
|
676
|
+
*/
|
|
677
|
+
max_bytes?: number | null;
|
|
678
|
+
offset?: number;
|
|
679
|
+
}
|
|
680
|
+
export interface BlobGetResult {
|
|
681
|
+
/**
|
|
682
|
+
* daemon 记录的元数据(和 `user_message.attachments` 里的一致)。
|
|
683
|
+
*/
|
|
684
|
+
blob: AttachmentRef;
|
|
685
|
+
/**
|
|
686
|
+
* 标准 base64(带 padding)。
|
|
687
|
+
*/
|
|
688
|
+
data: string;
|
|
689
|
+
/**
|
|
690
|
+
* 这一段读到了文件末尾。
|
|
691
|
+
*/
|
|
692
|
+
eof: boolean;
|
|
693
|
+
offset: number;
|
|
694
|
+
}
|
|
695
|
+
export interface BlobIdParams {
|
|
696
|
+
blob_id: string;
|
|
697
|
+
}
|
|
698
|
+
/**
|
|
699
|
+
* `blob.put_begin`:开始一次上传。
|
|
700
|
+
*/
|
|
701
|
+
export interface BlobPutBeginParams {
|
|
702
|
+
/**
|
|
703
|
+
* 只接受 `image/png` `image/jpeg` `image/gif` `image/webp`,其它 → `unsupported`。
|
|
704
|
+
*/
|
|
705
|
+
mime: string;
|
|
706
|
+
/**
|
|
707
|
+
* 展示用的文件名(1–255 字节,不能含 `/` `\` 和控制字符)。daemon 不用它拼路径。
|
|
708
|
+
*/
|
|
709
|
+
name: string;
|
|
710
|
+
/**
|
|
711
|
+
* 整个文件的 SHA-256,64 位小写 hex;`put_end` 校验。
|
|
712
|
+
*/
|
|
713
|
+
sha256: string;
|
|
714
|
+
/**
|
|
715
|
+
* 总字节数,`1 ..= sessions.max_attachment_bytes`。
|
|
716
|
+
*/
|
|
717
|
+
size: number;
|
|
718
|
+
}
|
|
719
|
+
export interface BlobPutBeginResult {
|
|
720
|
+
/**
|
|
721
|
+
* 32 位小写 hex。
|
|
722
|
+
*/
|
|
723
|
+
blob_id: string;
|
|
724
|
+
/**
|
|
725
|
+
* 分块字节数(目前 512 KiB)。除最后一块外每块恰好这么大;块数 = `ceil(size / chunk_size)`。
|
|
726
|
+
*/
|
|
727
|
+
chunk_size: number;
|
|
728
|
+
/**
|
|
729
|
+
* 这次上传在此之前没有 `put_end` 就作废(已收的分块丢弃)。每收到一块顺延。
|
|
730
|
+
*/
|
|
731
|
+
expires_at_ms: number;
|
|
732
|
+
}
|
|
733
|
+
/**
|
|
734
|
+
* `blob.put_chunk`:一块数据。偏移 = `index * chunk_size`。同一块重发是幂等的。
|
|
735
|
+
*/
|
|
736
|
+
export interface BlobPutChunkParams {
|
|
737
|
+
blob_id: string;
|
|
738
|
+
/**
|
|
739
|
+
* 标准 base64(带 padding)。解码后的长度必须正好是这一块应有的长度。
|
|
740
|
+
*/
|
|
741
|
+
data: string;
|
|
742
|
+
index: number;
|
|
743
|
+
}
|
|
744
|
+
export interface BrowseEntry {
|
|
745
|
+
/**
|
|
746
|
+
* 不能关联的原因(已经是项目时为空,看 `project`)。
|
|
747
|
+
*/
|
|
748
|
+
blocked?: LinkBlock | null;
|
|
749
|
+
/**
|
|
750
|
+
* 目录下有 `.git`。
|
|
751
|
+
*/
|
|
752
|
+
git?: boolean;
|
|
753
|
+
/**
|
|
754
|
+
* 能不能关联:不是项目,并且 `blocked` 为空。
|
|
755
|
+
*/
|
|
756
|
+
linkable: boolean;
|
|
757
|
+
name: string;
|
|
758
|
+
/**
|
|
759
|
+
* 绝对路径,可以直接传给 `workspace.browse` / `workspace.link`。
|
|
760
|
+
*/
|
|
761
|
+
path: string;
|
|
762
|
+
/**
|
|
763
|
+
* 已经是项目(根目录下的或已关联的)时给出项目名。
|
|
764
|
+
*/
|
|
765
|
+
project?: string | null;
|
|
766
|
+
}
|
|
767
|
+
/**
|
|
768
|
+
* 设备自报信息。配对和每次 `auth` 都带。
|
|
769
|
+
*/
|
|
770
|
+
export interface ClientInfo {
|
|
771
|
+
kind: DeviceKind;
|
|
772
|
+
/**
|
|
773
|
+
* 显示名,如 "mac-mini"、"Chrome · macOS · hub.example.com"。
|
|
774
|
+
*/
|
|
775
|
+
name: string;
|
|
776
|
+
/**
|
|
777
|
+
* 仅 web:访问 hub 的 origin,用于区分局域网 / 公网两份设备。
|
|
778
|
+
*/
|
|
779
|
+
origin?: string | null;
|
|
780
|
+
/**
|
|
781
|
+
* 如 "macos-aarch64"、"linux-x86_64"、"browser"。
|
|
782
|
+
*/
|
|
783
|
+
platform: string;
|
|
784
|
+
/**
|
|
785
|
+
* 客户端版本。
|
|
786
|
+
*/
|
|
787
|
+
version: string;
|
|
788
|
+
}
|
|
789
|
+
export interface Quota {
|
|
790
|
+
connections: number;
|
|
791
|
+
connections_max?: number | null;
|
|
792
|
+
daemons: number;
|
|
793
|
+
daemons_max?: number | null;
|
|
794
|
+
devices: number;
|
|
795
|
+
devices_max?: number | null;
|
|
796
|
+
}
|
|
797
|
+
export interface DiffFile {
|
|
798
|
+
additions: number;
|
|
799
|
+
binary?: boolean;
|
|
800
|
+
deletions: number;
|
|
801
|
+
/**
|
|
802
|
+
* 改名前的路径(`status = renamed`)。
|
|
803
|
+
*/
|
|
804
|
+
old_path?: string | null;
|
|
805
|
+
/**
|
|
806
|
+
* 只在请求带 `path` 时给:这个文件的 unified diff(含 `diff --git` 头),最多 256 KiB。
|
|
807
|
+
*/
|
|
808
|
+
patch?: string | null;
|
|
809
|
+
/**
|
|
810
|
+
* `patch` 被截断了。
|
|
811
|
+
*/
|
|
812
|
+
patch_truncated?: boolean;
|
|
813
|
+
/**
|
|
814
|
+
* 仓库内的相对路径(`/` 分隔)。
|
|
815
|
+
*/
|
|
816
|
+
path: string;
|
|
817
|
+
status: DiffFileStatus;
|
|
818
|
+
/**
|
|
819
|
+
* 未跟踪的新文件(`status = added`)。
|
|
820
|
+
*/
|
|
821
|
+
untracked?: boolean;
|
|
822
|
+
}
|
|
823
|
+
/**
|
|
824
|
+
* 空参数 / 空结果。
|
|
825
|
+
*/
|
|
826
|
+
export interface Empty {
|
|
827
|
+
}
|
|
828
|
+
/**
|
|
829
|
+
* 新设备自报的提示信息。**未经认证**(hub 能改),只用于批准界面;认证过的 `ClientInfo` 以 XXpsk3 第 3 条为准。
|
|
830
|
+
*/
|
|
831
|
+
export interface EnrollHint {
|
|
832
|
+
kind: DeviceKind;
|
|
833
|
+
name: string;
|
|
834
|
+
platform: string;
|
|
835
|
+
}
|
|
836
|
+
/**
|
|
837
|
+
* 一条进行中的接入(`node.enroll_list` 的元素、`node.enroll_requested` 的参数)。
|
|
838
|
+
*/
|
|
839
|
+
export interface EnrollInfo {
|
|
840
|
+
approval?: boolean;
|
|
841
|
+
created_at_ms: number;
|
|
842
|
+
enroll_id: string;
|
|
843
|
+
expires_at_ms: number;
|
|
844
|
+
/**
|
|
845
|
+
* 新设备自报,未经认证。还没收到 `hello` 时为空。
|
|
846
|
+
*/
|
|
847
|
+
hint?: EnrollHint | null;
|
|
848
|
+
/**
|
|
849
|
+
* 还没收到 `hello` 时为空。
|
|
850
|
+
*/
|
|
851
|
+
method?: EnrollMethod | null;
|
|
852
|
+
status: EnrollSessionStatus;
|
|
853
|
+
}
|
|
854
|
+
export interface EnrollPasswordStatus {
|
|
855
|
+
/**
|
|
856
|
+
* 连续失败次数。
|
|
857
|
+
*/
|
|
858
|
+
failures: number;
|
|
859
|
+
/**
|
|
860
|
+
* 退避中:还要等多久才接受下一次尝试。
|
|
861
|
+
*/
|
|
862
|
+
retry_after_ms?: number | null;
|
|
863
|
+
/**
|
|
864
|
+
* 是否设了口令。
|
|
865
|
+
*/
|
|
866
|
+
set: boolean;
|
|
867
|
+
set_at_ms?: number | null;
|
|
868
|
+
/**
|
|
869
|
+
* 设置者:设备 id,本机 CLI 设置的是 `"local"`。
|
|
870
|
+
*/
|
|
871
|
+
set_by?: string | null;
|
|
872
|
+
state: EnrollPasswordState;
|
|
873
|
+
}
|
|
874
|
+
/**
|
|
875
|
+
* 按 category 归一化的渲染字段。全部可选;`input` 仍原样保留。
|
|
876
|
+
*/
|
|
877
|
+
export interface ToolCallDetail {
|
|
878
|
+
command?: string | null;
|
|
879
|
+
cwd?: string | null;
|
|
880
|
+
description?: string | null;
|
|
881
|
+
edit_kind?: EditKind | null;
|
|
882
|
+
path?: string | null;
|
|
883
|
+
query?: string | null;
|
|
884
|
+
server?: string | null;
|
|
885
|
+
tool?: string | null;
|
|
886
|
+
url?: string | null;
|
|
887
|
+
}
|
|
888
|
+
export interface ToolResultDetail {
|
|
889
|
+
exit_code?: number | null;
|
|
890
|
+
/**
|
|
891
|
+
* 这次调用的流式 `tool_output_delta` 累计超过上限、后续 delta 没有转发;最终 `output` 仍是
|
|
892
|
+
* 头尾截断的完整输出。
|
|
893
|
+
*/
|
|
894
|
+
live_output_truncated?: boolean | null;
|
|
895
|
+
match_count?: number | null;
|
|
896
|
+
/**
|
|
897
|
+
* daemon 对 `output` 做头尾截断时丢掉的字节数(spec/daemon.md § 12);没截断就缺省。
|
|
898
|
+
*/
|
|
899
|
+
output_truncated_bytes?: number | null;
|
|
900
|
+
unified_diff?: string | null;
|
|
901
|
+
}
|
|
902
|
+
export interface PlanEntry {
|
|
903
|
+
content: string;
|
|
904
|
+
status: PlanStatus;
|
|
905
|
+
}
|
|
906
|
+
export interface PermissionDetail {
|
|
907
|
+
/**
|
|
908
|
+
* kind = mode_change:目标模式 id。
|
|
909
|
+
*/
|
|
910
|
+
mode?: string | null;
|
|
911
|
+
/**
|
|
912
|
+
* kind = question
|
|
913
|
+
*/
|
|
914
|
+
questions?: Question[];
|
|
915
|
+
/**
|
|
916
|
+
* kind = plan:计划全文(Markdown)。kind = other:说明。
|
|
917
|
+
*/
|
|
918
|
+
text?: string | null;
|
|
919
|
+
/**
|
|
920
|
+
* kind = tool
|
|
921
|
+
*/
|
|
922
|
+
tool?: ToolPermissionDetail | null;
|
|
923
|
+
}
|
|
924
|
+
export interface Question {
|
|
925
|
+
choices?: QuestionChoice[];
|
|
926
|
+
free_text?: boolean;
|
|
927
|
+
id: string;
|
|
928
|
+
multi?: boolean;
|
|
929
|
+
text: string;
|
|
930
|
+
}
|
|
931
|
+
export interface QuestionChoice {
|
|
932
|
+
id: string;
|
|
933
|
+
label: string;
|
|
934
|
+
}
|
|
935
|
+
/**
|
|
936
|
+
* `kind = tool` 的详情:和 `tool_call` 同一套字段。
|
|
937
|
+
*/
|
|
938
|
+
export interface ToolPermissionDetail {
|
|
939
|
+
category: ToolCategory;
|
|
940
|
+
cwd?: string | null;
|
|
941
|
+
detail?: ToolCallDetail | null;
|
|
942
|
+
input?: unknown;
|
|
943
|
+
tool: string;
|
|
944
|
+
}
|
|
945
|
+
export interface PermissionOption {
|
|
946
|
+
/**
|
|
947
|
+
* adapter 定义;Claude Code 固定 `allow` / `allow_session` / `deny`,ACP 透传 optionId。
|
|
948
|
+
*/
|
|
949
|
+
id: string;
|
|
950
|
+
kind: PermissionOptionKind;
|
|
951
|
+
label: string;
|
|
952
|
+
/**
|
|
953
|
+
* 可附一句话给 agent(通常 reject 类)。
|
|
954
|
+
*/
|
|
955
|
+
needs_message?: boolean;
|
|
956
|
+
}
|
|
957
|
+
export interface Usage {
|
|
958
|
+
cache_read_tokens?: number | null;
|
|
959
|
+
cache_write_tokens?: number | null;
|
|
960
|
+
cost_usd?: number | null;
|
|
961
|
+
duration_ms: number;
|
|
962
|
+
input_tokens?: number | null;
|
|
963
|
+
model?: string | null;
|
|
964
|
+
output_tokens?: number | null;
|
|
965
|
+
}
|
|
966
|
+
/**
|
|
967
|
+
* 会话设置。`session.create` 和 `session.set_settings` 都收它;值来自 `AgentInfo`。
|
|
968
|
+
*/
|
|
969
|
+
export interface SessionSettings {
|
|
970
|
+
env?: {
|
|
971
|
+
[k: string]: string;
|
|
972
|
+
};
|
|
973
|
+
max_budget_usd?: number | null;
|
|
974
|
+
max_turns?: number | null;
|
|
975
|
+
/**
|
|
976
|
+
* `AgentInfo.modes[].id`。
|
|
977
|
+
*/
|
|
978
|
+
mode?: string | null;
|
|
979
|
+
model?: string | null;
|
|
980
|
+
/**
|
|
981
|
+
* `AgentInfo.options[]` 里的,按 id。
|
|
982
|
+
*/
|
|
983
|
+
options?: {
|
|
984
|
+
[k: string]: unknown;
|
|
985
|
+
};
|
|
986
|
+
system_prompt_append?: string | null;
|
|
987
|
+
/**
|
|
988
|
+
* 所选模型的 `thinking.options[].id`。
|
|
989
|
+
*/
|
|
990
|
+
thinking?: string | null;
|
|
991
|
+
}
|
|
992
|
+
export interface FsListParams {
|
|
993
|
+
/**
|
|
994
|
+
* `<项目名>/<项目内的相对路径>`,如 `my-app/src`。第一段是关联项目的名字时,其余部分相对那个目录解析,
|
|
995
|
+
* 并且不能走出它;否则相对 workspace 根解析(`""` 列根目录本身,不含关联项目)。
|
|
996
|
+
*/
|
|
997
|
+
path: string;
|
|
998
|
+
}
|
|
999
|
+
export interface FsListResult {
|
|
1000
|
+
entries: FsEntry[];
|
|
1001
|
+
}
|
|
1002
|
+
export interface FsEntry {
|
|
1003
|
+
bytes: number;
|
|
1004
|
+
is_dir: boolean;
|
|
1005
|
+
modified_at_ms: number;
|
|
1006
|
+
name: string;
|
|
1007
|
+
}
|
|
1008
|
+
export interface FsReadParams {
|
|
1009
|
+
/**
|
|
1010
|
+
* 默认 1 MiB,上限 10 MiB。
|
|
1011
|
+
*/
|
|
1012
|
+
max_bytes?: number | null;
|
|
1013
|
+
/**
|
|
1014
|
+
* 解析规则同 `FsListParams.path`。
|
|
1015
|
+
*/
|
|
1016
|
+
path: string;
|
|
1017
|
+
}
|
|
1018
|
+
export interface FsReadResult {
|
|
1019
|
+
binary: boolean;
|
|
1020
|
+
bytes: number;
|
|
1021
|
+
/**
|
|
1022
|
+
* UTF-8 文本;二进制文件 `text` 为空且 `binary = true`。
|
|
1023
|
+
*/
|
|
1024
|
+
text: string;
|
|
1025
|
+
truncated: boolean;
|
|
1026
|
+
}
|
|
1027
|
+
export interface JobCancelParams {
|
|
1028
|
+
job_id: string;
|
|
1029
|
+
}
|
|
1030
|
+
export interface JobDone {
|
|
1031
|
+
error?: string | null;
|
|
1032
|
+
job_id: string;
|
|
1033
|
+
ok: boolean;
|
|
1034
|
+
}
|
|
1035
|
+
export interface JobProgress {
|
|
1036
|
+
job_id: string;
|
|
1037
|
+
log_line?: string | null;
|
|
1038
|
+
percent?: number | null;
|
|
1039
|
+
stage: string;
|
|
1040
|
+
}
|
|
1041
|
+
export interface JobStarted {
|
|
1042
|
+
job_id: string;
|
|
1043
|
+
}
|
|
1044
|
+
export interface NodeAuditParams {
|
|
1045
|
+
device_id?: string | null;
|
|
1046
|
+
limit?: number | null;
|
|
1047
|
+
since_ms?: number | null;
|
|
1048
|
+
}
|
|
1049
|
+
export interface NodeAuditResult {
|
|
1050
|
+
entries: AuditEntry[];
|
|
1051
|
+
}
|
|
1052
|
+
export interface AuditEntry {
|
|
1053
|
+
action: string;
|
|
1054
|
+
detail?: unknown;
|
|
1055
|
+
device_id: string;
|
|
1056
|
+
device_name: string;
|
|
1057
|
+
target?: string | null;
|
|
1058
|
+
ts_ms: number;
|
|
1059
|
+
}
|
|
1060
|
+
export interface NodeDevicesResult {
|
|
1061
|
+
devices: PeerDevice[];
|
|
1062
|
+
}
|
|
1063
|
+
/**
|
|
1064
|
+
* 已配对的客户端设备(daemon 视角)。
|
|
1065
|
+
*/
|
|
1066
|
+
export interface PeerDevice {
|
|
1067
|
+
device_id: string;
|
|
1068
|
+
/**
|
|
1069
|
+
* Noise 静态公钥的指纹(短 hex)。
|
|
1070
|
+
*/
|
|
1071
|
+
fingerprint: string;
|
|
1072
|
+
kind: DeviceKind;
|
|
1073
|
+
last_seen_ms?: number | null;
|
|
1074
|
+
name: string;
|
|
1075
|
+
online: boolean;
|
|
1076
|
+
paired_at_ms: number;
|
|
1077
|
+
}
|
|
1078
|
+
export interface NodeDoctorResult {
|
|
1079
|
+
checks: DoctorCheck[];
|
|
1080
|
+
}
|
|
1081
|
+
export interface DoctorCheck {
|
|
1082
|
+
detail: string;
|
|
1083
|
+
fix?: string | null;
|
|
1084
|
+
id: string;
|
|
1085
|
+
ok: boolean;
|
|
1086
|
+
}
|
|
1087
|
+
/**
|
|
1088
|
+
* `node.enroll_approve` 参数。
|
|
1089
|
+
*/
|
|
1090
|
+
export interface NodeEnrollApproveParams {
|
|
1091
|
+
enroll_id: string;
|
|
1092
|
+
/**
|
|
1093
|
+
* `scan` 必填:二维码里的 32 字节密钥(hex)。`code` 不带。
|
|
1094
|
+
*/
|
|
1095
|
+
secret?: string | null;
|
|
1096
|
+
}
|
|
1097
|
+
/**
|
|
1098
|
+
* `node.enroll_approve` 结果。`code` 请求返回 6 位码(只给批准的这一台);`scan` 两个字段都为空。
|
|
1099
|
+
*/
|
|
1100
|
+
export interface NodeEnrollApproveResult {
|
|
1101
|
+
code?: string | null;
|
|
1102
|
+
expires_at_ms?: number | null;
|
|
1103
|
+
}
|
|
1104
|
+
/**
|
|
1105
|
+
* `node.enroll_code` 结果:主动生成的 6 位接入码。
|
|
1106
|
+
*/
|
|
1107
|
+
export interface NodeEnrollCodeResult {
|
|
1108
|
+
code: string;
|
|
1109
|
+
expires_at_ms: number;
|
|
1110
|
+
}
|
|
1111
|
+
/**
|
|
1112
|
+
* `node.enroll_deny` 参数。
|
|
1113
|
+
*/
|
|
1114
|
+
export interface NodeEnrollIdParams {
|
|
1115
|
+
enroll_id: string;
|
|
1116
|
+
}
|
|
1117
|
+
/**
|
|
1118
|
+
* `node.enroll_list` 结果。
|
|
1119
|
+
*/
|
|
1120
|
+
export interface NodeEnrollListResult {
|
|
1121
|
+
enrolls: EnrollInfo[];
|
|
1122
|
+
}
|
|
1123
|
+
/**
|
|
1124
|
+
* D→C notification `node.enroll_resolved`:发给所有在线的已配对设备,让别的设备收起批准卡片。
|
|
1125
|
+
*/
|
|
1126
|
+
export interface NodeEnrollResolved {
|
|
1127
|
+
/**
|
|
1128
|
+
* 批准 / 拒绝的设备;daemon 自己判定的(过期、失败、完成)为空。
|
|
1129
|
+
*/
|
|
1130
|
+
by_device?: string | null;
|
|
1131
|
+
enroll_id: string;
|
|
1132
|
+
result: EnrollResult;
|
|
1133
|
+
}
|
|
1134
|
+
/**
|
|
1135
|
+
* `node.enroll_status` 结果。
|
|
1136
|
+
*/
|
|
1137
|
+
export interface NodeEnrollStatusResult {
|
|
1138
|
+
/**
|
|
1139
|
+
* `enroll.approval`:是否接受扫码批准和接入码。
|
|
1140
|
+
*/
|
|
1141
|
+
approval: boolean;
|
|
1142
|
+
password: EnrollPasswordStatus;
|
|
1143
|
+
}
|
|
1144
|
+
/**
|
|
1145
|
+
* `node.info` 结果。
|
|
1146
|
+
*/
|
|
1147
|
+
export interface NodeInfo {
|
|
1148
|
+
capabilities: NodeCapabilities;
|
|
1149
|
+
name: string;
|
|
1150
|
+
node_id: string;
|
|
1151
|
+
platform: string;
|
|
1152
|
+
protocol_version: number;
|
|
1153
|
+
started_at_ms: number;
|
|
1154
|
+
version: string;
|
|
1155
|
+
workspace_root?: string | null;
|
|
1156
|
+
/**
|
|
1157
|
+
* `capabilities.worktree` 为 true 时给出。
|
|
1158
|
+
*/
|
|
1159
|
+
worktree?: NodeWorktreeSettings | null;
|
|
1160
|
+
}
|
|
1161
|
+
export interface NodeCapabilities {
|
|
1162
|
+
audit: boolean;
|
|
1163
|
+
blobs: boolean;
|
|
1164
|
+
fs: boolean;
|
|
1165
|
+
search: boolean;
|
|
1166
|
+
/**
|
|
1167
|
+
* 有 workspace(文件夹即项目)。SDK 节点可能没有。
|
|
1168
|
+
*/
|
|
1169
|
+
workspace: boolean;
|
|
1170
|
+
/**
|
|
1171
|
+
* 支持每会话 worktree、`session.git_status` / `diff` / `sync_base`(ADR-34)。daemon 找不到 `git` 时为 false。
|
|
1172
|
+
*/
|
|
1173
|
+
worktree?: boolean;
|
|
1174
|
+
}
|
|
1175
|
+
/**
|
|
1176
|
+
* 节点的 worktree 配置(`config.toml` 的 `[worktree]`),客户端据此决定新建会话的初始选择和分支名预览。
|
|
1177
|
+
*/
|
|
1178
|
+
export interface NodeWorktreeSettings {
|
|
1179
|
+
/**
|
|
1180
|
+
* 新分支名的前缀(`anycon` → `anycon/<slug>`);空串 = 不加前缀。
|
|
1181
|
+
*/
|
|
1182
|
+
branch_prefix: string;
|
|
1183
|
+
/**
|
|
1184
|
+
* git 项目里新会话默认在哪里工作。
|
|
1185
|
+
*/
|
|
1186
|
+
default_mode: SessionWorkspaceMode;
|
|
1187
|
+
}
|
|
1188
|
+
export interface NodePairBeginParams {
|
|
1189
|
+
/**
|
|
1190
|
+
* `true`(缺省)= 16 位短码(约 79 bit;链接、二维码、默认都是它);`false` = 8 位(约 40 bit),
|
|
1191
|
+
* 只适合在自建 hub 上手输(ADR-29 修订:拿到 match_id 的恶意 hub 可以离线穷举 8 位短码)。
|
|
1192
|
+
*/
|
|
1193
|
+
long?: boolean;
|
|
1194
|
+
}
|
|
1195
|
+
/**
|
|
1196
|
+
* `node.pair_begin` 结果。短码由 daemon 本地生成,hub 只拿到 match id。
|
|
1197
|
+
*/
|
|
1198
|
+
export interface NodePairBeginResult {
|
|
1199
|
+
/**
|
|
1200
|
+
* `XXXX-XXXX` 或 `XXXX-XXXX-XXXX-XXXX`。
|
|
1201
|
+
*/
|
|
1202
|
+
code: string;
|
|
1203
|
+
expires_at_ms: number;
|
|
1204
|
+
/**
|
|
1205
|
+
* `${hub_public_url}/pair#code=XXXX-XXXX`。短码放在 URL fragment 里,浏览器不会把它发给 hub。
|
|
1206
|
+
*/
|
|
1207
|
+
link: string;
|
|
1208
|
+
}
|
|
1209
|
+
export interface NodeRevokeDeviceParams {
|
|
1210
|
+
device_id: string;
|
|
1211
|
+
}
|
|
1212
|
+
/**
|
|
1213
|
+
* D→C notification `node.security_event`(同时发 `notify { category: security }`)。
|
|
1214
|
+
*/
|
|
1215
|
+
export interface NodeSecurityEvent {
|
|
1216
|
+
/**
|
|
1217
|
+
* 触发的已配对设备(改口令、改设置);本机 CLI 为 `"local"`;接入、失败为空。
|
|
1218
|
+
*/
|
|
1219
|
+
by_device?: string | null;
|
|
1220
|
+
/**
|
|
1221
|
+
* `device_enrolled`:新设备(认证过的)名称和 id。
|
|
1222
|
+
*/
|
|
1223
|
+
device_id?: string | null;
|
|
1224
|
+
device_name?: string | null;
|
|
1225
|
+
/**
|
|
1226
|
+
* `password_failures` / `password_locked`:当时的连续失败次数。
|
|
1227
|
+
*/
|
|
1228
|
+
failures?: number | null;
|
|
1229
|
+
kind: SecurityEventKind;
|
|
1230
|
+
method?: EnrollMethod | null;
|
|
1231
|
+
/**
|
|
1232
|
+
* `password_changed`:`true` = 设置 / 修改,`false` = 清除。
|
|
1233
|
+
*/
|
|
1234
|
+
password_set?: boolean | null;
|
|
1235
|
+
ts_ms: number;
|
|
1236
|
+
}
|
|
1237
|
+
/**
|
|
1238
|
+
* `node.set_agent_defaults`:写 `config.agents.<id>.default_*`。
|
|
1239
|
+
*/
|
|
1240
|
+
export interface NodeSetAgentDefaultsParams {
|
|
1241
|
+
agent: string;
|
|
1242
|
+
mode?: string | null;
|
|
1243
|
+
model?: string | null;
|
|
1244
|
+
options?: {
|
|
1245
|
+
[k: string]: unknown;
|
|
1246
|
+
} | null;
|
|
1247
|
+
thinking?: string | null;
|
|
1248
|
+
}
|
|
1249
|
+
/**
|
|
1250
|
+
* `node.set_enroll_enabled` 参数:写 `[enroll]` 配置。`password: true` 同时解除锁定、失败计数清零。
|
|
1251
|
+
*/
|
|
1252
|
+
export interface NodeSetEnrollEnabledParams {
|
|
1253
|
+
approval?: boolean | null;
|
|
1254
|
+
password?: boolean | null;
|
|
1255
|
+
}
|
|
1256
|
+
/**
|
|
1257
|
+
* `node.set_enroll_password` 参数。`password` 省略 = 清除。至少 8 个字符(按 Unicode 字符计,NFC 之后)。
|
|
1258
|
+
*/
|
|
1259
|
+
export interface NodeSetEnrollPasswordParams {
|
|
1260
|
+
password?: string | null;
|
|
1261
|
+
}
|
|
1262
|
+
export interface NodeStats {
|
|
1263
|
+
agent_processes: number;
|
|
1264
|
+
db_bytes: number;
|
|
1265
|
+
disk_free_bytes: number;
|
|
1266
|
+
hub_connected: boolean;
|
|
1267
|
+
peers_online: number;
|
|
1268
|
+
sessions: SessionCounts;
|
|
1269
|
+
uptime_ms: number;
|
|
1270
|
+
}
|
|
1271
|
+
export interface SessionCounts {
|
|
1272
|
+
ended: number;
|
|
1273
|
+
error: number;
|
|
1274
|
+
idle: number;
|
|
1275
|
+
queued: number;
|
|
1276
|
+
running: number;
|
|
1277
|
+
waiting_permission: number;
|
|
1278
|
+
}
|
|
1279
|
+
/**
|
|
1280
|
+
* `kind = notify` 的 body(msgpack)。`category` 是外层唯一有语义的明文字段。
|
|
1281
|
+
*/
|
|
1282
|
+
export interface NotifyBody {
|
|
1283
|
+
category: NotifyCategory;
|
|
1284
|
+
/**
|
|
1285
|
+
* Noise 密文详情,base64。客户端解密后得到 [`crate::NotifyDetail`]。
|
|
1286
|
+
*/
|
|
1287
|
+
detail?: string | null;
|
|
1288
|
+
/**
|
|
1289
|
+
* 会话 id,明文。随机不透明串,只用于客户端点开通知后直达。
|
|
1290
|
+
*/
|
|
1291
|
+
session_id?: string | null;
|
|
1292
|
+
}
|
|
1293
|
+
/**
|
|
1294
|
+
* 通知的密文详情(JSON,解密后)。
|
|
1295
|
+
*/
|
|
1296
|
+
export interface NotifyDetail {
|
|
1297
|
+
body: string;
|
|
1298
|
+
session_id: string;
|
|
1299
|
+
title: string;
|
|
1300
|
+
}
|
|
1301
|
+
/**
|
|
1302
|
+
* `pair.ack`:握手完成且 `PairDone` 之后,daemon 经新建立的 Noise 传输发给 joiner 的第一条通知。
|
|
1303
|
+
* joiner 校验 `peer_id == 自己的正式 id`、`node_id == PairDone.peer` 后才落盘节点。
|
|
1304
|
+
*/
|
|
1305
|
+
export interface PairAck {
|
|
1306
|
+
/**
|
|
1307
|
+
* daemon 静态公钥指纹(joiner 可与握手得到的对比)。
|
|
1308
|
+
*/
|
|
1309
|
+
fingerprint: string;
|
|
1310
|
+
name: string;
|
|
1311
|
+
/**
|
|
1312
|
+
* daemon 的正式 device id。
|
|
1313
|
+
*/
|
|
1314
|
+
node_id: string;
|
|
1315
|
+
/**
|
|
1316
|
+
* hub 告诉 daemon 的 joiner 正式 id。
|
|
1317
|
+
*/
|
|
1318
|
+
peer_id: string;
|
|
1319
|
+
version: string;
|
|
1320
|
+
}
|
|
1321
|
+
export interface PermissionListParams {
|
|
1322
|
+
session_id?: string | null;
|
|
1323
|
+
}
|
|
1324
|
+
export interface PermissionListResult {
|
|
1325
|
+
requests: PermissionRequest[];
|
|
1326
|
+
}
|
|
1327
|
+
/**
|
|
1328
|
+
* `permission.request` 通知 / `permission.list` 的元素。
|
|
1329
|
+
*/
|
|
1330
|
+
export interface PermissionRequest {
|
|
1331
|
+
created_at_ms: number;
|
|
1332
|
+
detail: PermissionDetail;
|
|
1333
|
+
expires_at_ms?: number | null;
|
|
1334
|
+
kind: PermissionKind;
|
|
1335
|
+
options: PermissionOption[];
|
|
1336
|
+
request_id: string;
|
|
1337
|
+
session_id: string;
|
|
1338
|
+
title: string;
|
|
1339
|
+
}
|
|
1340
|
+
export interface PermissionResolved {
|
|
1341
|
+
by_device: string;
|
|
1342
|
+
option_id?: string | null;
|
|
1343
|
+
request_id: string;
|
|
1344
|
+
session_id: string;
|
|
1345
|
+
}
|
|
1346
|
+
export interface PermissionRespondParams {
|
|
1347
|
+
/**
|
|
1348
|
+
* kind = question:`{ [question_id]: value }`,value 是字符串或字符串数组。
|
|
1349
|
+
*/
|
|
1350
|
+
answers?: {
|
|
1351
|
+
[k: string]: unknown;
|
|
1352
|
+
} | null;
|
|
1353
|
+
message?: string | null;
|
|
1354
|
+
/**
|
|
1355
|
+
* kind = question 时可空。
|
|
1356
|
+
*/
|
|
1357
|
+
option_id?: string | null;
|
|
1358
|
+
request_id: string;
|
|
1359
|
+
}
|
|
1360
|
+
/**
|
|
1361
|
+
* 一个项目 = workspace 根目录下的一个一级子文件夹,或一个关联的本机目录(`kind = linked`)。
|
|
1362
|
+
* 元数据全部推导;只有「关联了哪些目录」存在 daemon 的库里。
|
|
1363
|
+
*/
|
|
1364
|
+
export interface Project {
|
|
1365
|
+
active_sessions: number;
|
|
1366
|
+
git?: GitMeta | null;
|
|
1367
|
+
/**
|
|
1368
|
+
* git 元数据还在算(daemon 冷缓存时前台等待超时):这时 `git` 为空,**不代表不是 git 项目**。
|
|
1369
|
+
* 算完之后 daemon 发 `workspace.changed { updated }`,客户端重新 `workspace.list`。
|
|
1370
|
+
*/
|
|
1371
|
+
git_pending?: boolean;
|
|
1372
|
+
/**
|
|
1373
|
+
* 缺省 `folder`。
|
|
1374
|
+
*/
|
|
1375
|
+
kind?: ProjectKind & string;
|
|
1376
|
+
/**
|
|
1377
|
+
* 关联的目录已经不在了(被移走、删除,或外接盘没挂上)。只有 `linked` 会是 true;
|
|
1378
|
+
* 这时 `git` 为空、`modified_at_ms` 为 0,不能在里面新建会话,客户端应提供「解除关联」。
|
|
1379
|
+
*/
|
|
1380
|
+
missing?: boolean;
|
|
1381
|
+
modified_at_ms: number;
|
|
1382
|
+
/**
|
|
1383
|
+
* 项目名。根目录下的项目和关联的项目共用一个命名空间,客户端的所有操作都用它。
|
|
1384
|
+
*/
|
|
1385
|
+
name: string;
|
|
1386
|
+
/**
|
|
1387
|
+
* 绝对路径,仅展示用。
|
|
1388
|
+
*/
|
|
1389
|
+
path: string;
|
|
1390
|
+
}
|
|
1391
|
+
export interface GitMeta {
|
|
1392
|
+
branch?: string | null;
|
|
1393
|
+
dirty: boolean;
|
|
1394
|
+
remote?: string | null;
|
|
1395
|
+
/**
|
|
1396
|
+
* 能给这个项目的会话开 worktree:项目目录就是仓库顶层(不是仓库里的子目录),并且至少有一个提交
|
|
1397
|
+
* (ADR-34)。为 false 时客户端不提供「新 worktree」。
|
|
1398
|
+
*/
|
|
1399
|
+
worktree_ready?: boolean;
|
|
1400
|
+
}
|
|
1401
|
+
/**
|
|
1402
|
+
* `gh pr view` 的摘要。
|
|
1403
|
+
*/
|
|
1404
|
+
export interface PullRequestInfo {
|
|
1405
|
+
/**
|
|
1406
|
+
* PR 的目标分支。
|
|
1407
|
+
*/
|
|
1408
|
+
base_branch: string;
|
|
1409
|
+
checks_failed: number;
|
|
1410
|
+
/**
|
|
1411
|
+
* CI 检查:通过 / 失败 / 进行中的数量。
|
|
1412
|
+
*/
|
|
1413
|
+
checks_passed: number;
|
|
1414
|
+
checks_pending: number;
|
|
1415
|
+
number: number;
|
|
1416
|
+
state: PullRequestState;
|
|
1417
|
+
title: string;
|
|
1418
|
+
url: string;
|
|
1419
|
+
}
|
|
1420
|
+
export interface RpcError {
|
|
1421
|
+
code: number;
|
|
1422
|
+
data?: RpcErrorData | null;
|
|
1423
|
+
message: string;
|
|
1424
|
+
}
|
|
1425
|
+
export interface RpcErrorData {
|
|
1426
|
+
code: ErrorCode;
|
|
1427
|
+
/**
|
|
1428
|
+
* `invalid_settings` 时的字段名等补充信息。
|
|
1429
|
+
*/
|
|
1430
|
+
field?: string | null;
|
|
1431
|
+
reason?: string | null;
|
|
1432
|
+
retry_after_ms?: number | null;
|
|
1433
|
+
}
|
|
1434
|
+
export interface RpcRequest {
|
|
1435
|
+
id: RpcId;
|
|
1436
|
+
jsonrpc: string;
|
|
1437
|
+
method: string;
|
|
1438
|
+
params?: unknown;
|
|
1439
|
+
}
|
|
1440
|
+
export interface RpcNotification {
|
|
1441
|
+
jsonrpc: string;
|
|
1442
|
+
method: string;
|
|
1443
|
+
params?: unknown;
|
|
1444
|
+
}
|
|
1445
|
+
export interface RpcResponse {
|
|
1446
|
+
error?: RpcError | null;
|
|
1447
|
+
id: RpcId;
|
|
1448
|
+
jsonrpc: string;
|
|
1449
|
+
result?: unknown;
|
|
1450
|
+
}
|
|
1451
|
+
/**
|
|
1452
|
+
* `session.archive`。没有 worktree 的会话只看 `session_id`。
|
|
1453
|
+
*/
|
|
1454
|
+
export interface SessionArchiveParams {
|
|
1455
|
+
session_id: string;
|
|
1456
|
+
worktree?: WorktreeDisposal & string;
|
|
1457
|
+
}
|
|
1458
|
+
/**
|
|
1459
|
+
* `session.changed` 通知:列表级变化,发给所有在线客户端。
|
|
1460
|
+
*/
|
|
1461
|
+
export interface SessionChanged {
|
|
1462
|
+
archived?: boolean;
|
|
1463
|
+
/**
|
|
1464
|
+
* 会话被删除。
|
|
1465
|
+
*/
|
|
1466
|
+
deleted?: boolean;
|
|
1467
|
+
last_seq: number;
|
|
1468
|
+
pending_permissions: number;
|
|
1469
|
+
session_id: string;
|
|
1470
|
+
status: SessionStatus;
|
|
1471
|
+
title: string;
|
|
1472
|
+
updated_at_ms: number;
|
|
1473
|
+
/**
|
|
1474
|
+
* worktree 的当前状态(会话有 worktree 时)。
|
|
1475
|
+
*/
|
|
1476
|
+
worktree?: SessionWorktree | null;
|
|
1477
|
+
}
|
|
1478
|
+
/**
|
|
1479
|
+
* 会话所在的 worktree。
|
|
1480
|
+
*/
|
|
1481
|
+
export interface SessionWorktree {
|
|
1482
|
+
/**
|
|
1483
|
+
* base 的展示名:分支 / 远端跟踪分支 / 标签写法是短名字(`main`、`origin/main`、`v1.0`),
|
|
1484
|
+
* 其他写法(`HEAD`、`HEAD~1`…)是解析出的提交的前 12 位。daemon 内部按规范化的引用名或完整 SHA 计算。
|
|
1485
|
+
*/
|
|
1486
|
+
base: string;
|
|
1487
|
+
/**
|
|
1488
|
+
* 创建时 base 解析到的提交。
|
|
1489
|
+
*/
|
|
1490
|
+
base_sha: string;
|
|
1491
|
+
/**
|
|
1492
|
+
* 如 `anycon/fix-login`。
|
|
1493
|
+
*/
|
|
1494
|
+
branch: string;
|
|
1495
|
+
/**
|
|
1496
|
+
* `WorktreeInfo.id`。
|
|
1497
|
+
*/
|
|
1498
|
+
id: string;
|
|
1499
|
+
/**
|
|
1500
|
+
* 相对项目目录的路径,如 `.anycon/worktrees/fix-login`。
|
|
1501
|
+
*/
|
|
1502
|
+
path: string;
|
|
1503
|
+
state: WorktreeState;
|
|
1504
|
+
}
|
|
1505
|
+
export interface SessionCreateParams {
|
|
1506
|
+
agent: string;
|
|
1507
|
+
/**
|
|
1508
|
+
* 第一条消息的附件(`blob.put_end` 的结果)。agent 的 `capabilities.attachments` 不含其 mime → `unsupported`。
|
|
1509
|
+
*/
|
|
1510
|
+
attachments?: AttachmentRef[];
|
|
1511
|
+
/**
|
|
1512
|
+
* 第一条消息的客户端 id(幂等),有 `prompt` 或 `attachments` 时必填。
|
|
1513
|
+
*/
|
|
1514
|
+
message_id?: string | null;
|
|
1515
|
+
/**
|
|
1516
|
+
* 空 = scratch。
|
|
1517
|
+
*/
|
|
1518
|
+
project?: string | null;
|
|
1519
|
+
/**
|
|
1520
|
+
* 有则创建后立即发送第一条消息(`prompt` 为空但带了 `attachments` 时也发,内容为空串)。
|
|
1521
|
+
*/
|
|
1522
|
+
prompt?: string | null;
|
|
1523
|
+
settings?: SessionSettings;
|
|
1524
|
+
/**
|
|
1525
|
+
* 在哪里工作;缺省 = `local`(ADR-34)。
|
|
1526
|
+
*/
|
|
1527
|
+
workspace?: SessionWorkspace | null;
|
|
1528
|
+
}
|
|
1529
|
+
/**
|
|
1530
|
+
* `session.delete`。
|
|
1531
|
+
*/
|
|
1532
|
+
export interface SessionDeleteParams {
|
|
1533
|
+
/**
|
|
1534
|
+
* 同时删掉 worktree 的分支(`git branch -D`),分支上没合并的提交会丢。只有 worktree 也被删掉时才生效。
|
|
1535
|
+
*/
|
|
1536
|
+
delete_branch?: boolean;
|
|
1537
|
+
session_id: string;
|
|
1538
|
+
worktree?: WorktreeDisposal & string;
|
|
1539
|
+
}
|
|
1540
|
+
/**
|
|
1541
|
+
* `session.diff`:只读。不带 `path` 时只给文件列表和行数;带 `path` 时只给那一个文件,附 unified diff。
|
|
1542
|
+
*/
|
|
1543
|
+
export interface SessionDiffParams {
|
|
1544
|
+
against?: DiffAgainst & string;
|
|
1545
|
+
/**
|
|
1546
|
+
* 仓库内的相对路径(`DiffFile.path`)。
|
|
1547
|
+
*/
|
|
1548
|
+
path?: string | null;
|
|
1549
|
+
session_id: string;
|
|
1550
|
+
}
|
|
1551
|
+
export interface SessionDiffResult {
|
|
1552
|
+
files: DiffFile[];
|
|
1553
|
+
/**
|
|
1554
|
+
* 比较的起点提交(merge-base 或 HEAD)。
|
|
1555
|
+
*/
|
|
1556
|
+
from_sha: string;
|
|
1557
|
+
/**
|
|
1558
|
+
* 改动的文件超过 1000 个时只给前 1000 个。
|
|
1559
|
+
*/
|
|
1560
|
+
truncated?: boolean;
|
|
1561
|
+
}
|
|
1562
|
+
export interface SessionEvent {
|
|
1563
|
+
event: Event;
|
|
1564
|
+
/**
|
|
1565
|
+
* 会话内单调递增,持久化,用于增量拉取。
|
|
1566
|
+
*/
|
|
1567
|
+
seq: number;
|
|
1568
|
+
session_id: string;
|
|
1569
|
+
ts_ms: number;
|
|
1570
|
+
turn_id?: number | null;
|
|
1571
|
+
}
|
|
1572
|
+
/**
|
|
1573
|
+
* 会话工作目录的 git 状态。worktree 会话相对 base;在项目目录里工作的会话没有 base 相关字段。
|
|
1574
|
+
*/
|
|
1575
|
+
export interface SessionGitStatus {
|
|
1576
|
+
/**
|
|
1577
|
+
* 本分支有、base 没有的提交数。
|
|
1578
|
+
*/
|
|
1579
|
+
ahead?: number | null;
|
|
1580
|
+
/**
|
|
1581
|
+
* worktree 会话的 base(同 `SessionWorktree.base`)。
|
|
1582
|
+
*/
|
|
1583
|
+
base?: string | null;
|
|
1584
|
+
/**
|
|
1585
|
+
* base 现在解析到的提交;base 已经不存在时退回创建时的提交。
|
|
1586
|
+
*/
|
|
1587
|
+
base_sha?: string | null;
|
|
1588
|
+
/**
|
|
1589
|
+
* base 有、本分支还没有的提交数。
|
|
1590
|
+
*/
|
|
1591
|
+
behind?: number | null;
|
|
1592
|
+
/**
|
|
1593
|
+
* 当前分支;detached 时为空。
|
|
1594
|
+
*/
|
|
1595
|
+
branch?: string | null;
|
|
1596
|
+
/**
|
|
1597
|
+
* 有冲突、还没解决的文件数。
|
|
1598
|
+
*/
|
|
1599
|
+
conflicts: number;
|
|
1600
|
+
head_sha: string;
|
|
1601
|
+
/**
|
|
1602
|
+
* 正在合并(`MERGE_HEAD` 存在)。
|
|
1603
|
+
*/
|
|
1604
|
+
merging?: boolean;
|
|
1605
|
+
pr?: PullRequestInfo | null;
|
|
1606
|
+
/**
|
|
1607
|
+
* 要了 PR 但拿不到时的原因:`gh_not_installed` / `gh_not_authenticated` / `no_remote` / `no_pr` / `error`。
|
|
1608
|
+
*/
|
|
1609
|
+
pr_error?: string | null;
|
|
1610
|
+
/**
|
|
1611
|
+
* 未提交的文件数(已暂存 + 未暂存 + 未跟踪)。
|
|
1612
|
+
*/
|
|
1613
|
+
uncommitted: number;
|
|
1614
|
+
/**
|
|
1615
|
+
* 有上游时,本地还没推送的提交数。
|
|
1616
|
+
*/
|
|
1617
|
+
unpushed?: number | null;
|
|
1618
|
+
/**
|
|
1619
|
+
* 上游分支(`origin/anycon/fix-login`);没推送过为空。
|
|
1620
|
+
*/
|
|
1621
|
+
upstream?: string | null;
|
|
1622
|
+
}
|
|
1623
|
+
/**
|
|
1624
|
+
* `session.git_status`。
|
|
1625
|
+
*/
|
|
1626
|
+
export interface SessionGitStatusParams {
|
|
1627
|
+
/**
|
|
1628
|
+
* 同时用 `gh` 查这条分支的 PR(要联网,约 1–3 秒)。没装 / 没登录 `gh`、没有远端时 `pr` 为空、`pr_error` 说明原因。
|
|
1629
|
+
*/
|
|
1630
|
+
include_pr?: boolean;
|
|
1631
|
+
session_id: string;
|
|
1632
|
+
}
|
|
1633
|
+
export interface SessionHistoryParams {
|
|
1634
|
+
/**
|
|
1635
|
+
* 返回 seq > after_seq 的事件。
|
|
1636
|
+
*/
|
|
1637
|
+
after_seq?: number;
|
|
1638
|
+
/**
|
|
1639
|
+
* 为 true 时返回 seq < before_seq 的最近 limit 条(向上翻页)。
|
|
1640
|
+
*/
|
|
1641
|
+
before_seq?: number | null;
|
|
1642
|
+
/**
|
|
1643
|
+
* 默认 200,上限 1000。
|
|
1644
|
+
*/
|
|
1645
|
+
limit?: number | null;
|
|
1646
|
+
session_id: string;
|
|
1647
|
+
}
|
|
1648
|
+
export interface SessionHistoryResult {
|
|
1649
|
+
events: SessionEvent[];
|
|
1650
|
+
has_more: boolean;
|
|
1651
|
+
}
|
|
1652
|
+
export interface SessionIdParams {
|
|
1653
|
+
session_id: string;
|
|
1654
|
+
}
|
|
1655
|
+
export interface SessionListParams {
|
|
1656
|
+
include_archived?: boolean;
|
|
1657
|
+
limit?: number | null;
|
|
1658
|
+
project?: string | null;
|
|
1659
|
+
}
|
|
1660
|
+
export interface SessionListResult {
|
|
1661
|
+
sessions: SessionSummary[];
|
|
1662
|
+
}
|
|
1663
|
+
export interface SessionSummary {
|
|
1664
|
+
agent: string;
|
|
1665
|
+
/**
|
|
1666
|
+
* agent 自己的会话 id(Claude Code session_id 等),诊断用。
|
|
1667
|
+
*/
|
|
1668
|
+
agent_session_id?: string | null;
|
|
1669
|
+
archived?: boolean;
|
|
1670
|
+
created_at_ms: number;
|
|
1671
|
+
id: string;
|
|
1672
|
+
/**
|
|
1673
|
+
* 最后一个事件的 seq;客户端据此决定要不要拉增量。
|
|
1674
|
+
*/
|
|
1675
|
+
last_seq: number;
|
|
1676
|
+
pending_permissions: number;
|
|
1677
|
+
/**
|
|
1678
|
+
* 最后一条消息摘要(列表展示)。
|
|
1679
|
+
*/
|
|
1680
|
+
preview?: string | null;
|
|
1681
|
+
/**
|
|
1682
|
+
* 空 = scratch 会话。
|
|
1683
|
+
*/
|
|
1684
|
+
project?: string | null;
|
|
1685
|
+
/**
|
|
1686
|
+
* 排队位置(status = queued 时)。
|
|
1687
|
+
*/
|
|
1688
|
+
queue_position?: number | null;
|
|
1689
|
+
settings: SessionSettings;
|
|
1690
|
+
status: SessionStatus;
|
|
1691
|
+
title: string;
|
|
1692
|
+
updated_at_ms: number;
|
|
1693
|
+
usage?: UsageTotals;
|
|
1694
|
+
/**
|
|
1695
|
+
* 会话在 anycon 建的 worktree 里工作时给出(ADR-34);在项目目录本身工作时为空。
|
|
1696
|
+
*/
|
|
1697
|
+
worktree?: SessionWorktree | null;
|
|
1698
|
+
}
|
|
1699
|
+
export interface UsageTotals {
|
|
1700
|
+
cache_read_tokens: number;
|
|
1701
|
+
cache_write_tokens: number;
|
|
1702
|
+
cost_usd?: number | null;
|
|
1703
|
+
input_tokens: number;
|
|
1704
|
+
output_tokens: number;
|
|
1705
|
+
turns: number;
|
|
1706
|
+
}
|
|
1707
|
+
export interface SessionPromoteParams {
|
|
1708
|
+
/**
|
|
1709
|
+
* 新项目名。
|
|
1710
|
+
*/
|
|
1711
|
+
name: string;
|
|
1712
|
+
session_id: string;
|
|
1713
|
+
}
|
|
1714
|
+
export interface SessionRenameParams {
|
|
1715
|
+
session_id: string;
|
|
1716
|
+
title: string;
|
|
1717
|
+
}
|
|
1718
|
+
export interface SessionSearchParams {
|
|
1719
|
+
limit?: number | null;
|
|
1720
|
+
project?: string | null;
|
|
1721
|
+
query: string;
|
|
1722
|
+
}
|
|
1723
|
+
export interface SessionSearchResult {
|
|
1724
|
+
hits: SearchHit[];
|
|
1725
|
+
}
|
|
1726
|
+
export interface SearchHit {
|
|
1727
|
+
seq: number;
|
|
1728
|
+
session_id: string;
|
|
1729
|
+
/**
|
|
1730
|
+
* 带 `<mark>` 的片段。
|
|
1731
|
+
*/
|
|
1732
|
+
snippet: string;
|
|
1733
|
+
title: string;
|
|
1734
|
+
ts_ms: number;
|
|
1735
|
+
}
|
|
1736
|
+
export interface SessionSendParams {
|
|
1737
|
+
/**
|
|
1738
|
+
* `blob.put_end` 的结果,每条至多 20 个。agent 的 `capabilities.attachments` 不含其 mime → `unsupported`。
|
|
1739
|
+
*/
|
|
1740
|
+
attachments?: AttachmentRef[];
|
|
1741
|
+
/**
|
|
1742
|
+
* 带了附件时可以为空串。
|
|
1743
|
+
*/
|
|
1744
|
+
content: string;
|
|
1745
|
+
/**
|
|
1746
|
+
* 客户端生成(uuid),重发不重复。
|
|
1747
|
+
*/
|
|
1748
|
+
message_id: string;
|
|
1749
|
+
session_id: string;
|
|
1750
|
+
}
|
|
1751
|
+
export interface SessionSendResult {
|
|
1752
|
+
/**
|
|
1753
|
+
* 幂等命中:这条 message_id 之前已收到。
|
|
1754
|
+
*/
|
|
1755
|
+
duplicate?: boolean;
|
|
1756
|
+
queued: boolean;
|
|
1757
|
+
/**
|
|
1758
|
+
* 立即开始的 turn id;进入队列(turn 进行中且 agent 不支持插话)时为空。
|
|
1759
|
+
*/
|
|
1760
|
+
turn_id?: number | null;
|
|
1761
|
+
}
|
|
1762
|
+
export interface SessionSetSettingsParams {
|
|
1763
|
+
/**
|
|
1764
|
+
* 要清除(恢复为未设置)的字段,在 `settings` 合并之后生效;两边都出现时以 `clear` 为准。
|
|
1765
|
+
*/
|
|
1766
|
+
clear?: ClearableSetting[];
|
|
1767
|
+
session_id: string;
|
|
1768
|
+
/**
|
|
1769
|
+
* 增量:只带要改的字段;缺省 / `null` 表示保持(`options` 里值为 `null` 表示删键)。
|
|
1770
|
+
*/
|
|
1771
|
+
settings: SessionSettings;
|
|
1772
|
+
}
|
|
1773
|
+
export interface SessionSetSettingsResult {
|
|
1774
|
+
/**
|
|
1775
|
+
* 实际生效的完整设置(thinking 可能已按新模型回落)。
|
|
1776
|
+
*/
|
|
1777
|
+
settings: SessionSettings;
|
|
1778
|
+
}
|
|
1779
|
+
/**
|
|
1780
|
+
* `session.sync_base`:把 base 的最新提交合并进 worktree 的分支(base 是远端跟踪分支时先 fetch)。
|
|
1781
|
+
*/
|
|
1782
|
+
export interface SessionSyncBaseParams {
|
|
1783
|
+
/**
|
|
1784
|
+
* 放弃一次有冲突的合并(`git merge --abort`)。
|
|
1785
|
+
*/
|
|
1786
|
+
abort?: boolean;
|
|
1787
|
+
session_id: string;
|
|
1788
|
+
}
|
|
1789
|
+
export interface SessionSyncBaseResult {
|
|
1790
|
+
/**
|
|
1791
|
+
* 合进来的 base 提交数。
|
|
1792
|
+
*/
|
|
1793
|
+
commits: number;
|
|
1794
|
+
/**
|
|
1795
|
+
* 冲突的文件(最多 200 个)。
|
|
1796
|
+
*/
|
|
1797
|
+
conflicts?: string[];
|
|
1798
|
+
outcome: SyncOutcome;
|
|
1799
|
+
}
|
|
1800
|
+
export interface TrashEntry {
|
|
1801
|
+
bytes: number;
|
|
1802
|
+
/**
|
|
1803
|
+
* `.trash/` 下的目录名,如 `my-app-20261011T120000Z`。
|
|
1804
|
+
*/
|
|
1805
|
+
id: string;
|
|
1806
|
+
original_name: string;
|
|
1807
|
+
trashed_at_ms: number;
|
|
1808
|
+
}
|
|
1809
|
+
/**
|
|
1810
|
+
* `workspace.branches`:给新建会话的「基于哪个分支」下拉框列分支。
|
|
1811
|
+
*/
|
|
1812
|
+
export interface WorkspaceBranchesParams {
|
|
1813
|
+
project: string;
|
|
1814
|
+
}
|
|
1815
|
+
export interface WorkspaceBranchesResult {
|
|
1816
|
+
/**
|
|
1817
|
+
* 项目目录当前检出的分支;HEAD 是 detached 时为空。
|
|
1818
|
+
*/
|
|
1819
|
+
current?: string | null;
|
|
1820
|
+
/**
|
|
1821
|
+
* 新会话默认的 base:当前分支有上游(`origin/main`)时是上游,否则是当前分支;detached 时是 HEAD 的提交。
|
|
1822
|
+
*/
|
|
1823
|
+
default_base: string;
|
|
1824
|
+
/**
|
|
1825
|
+
* 本地分支,按最近提交时间倒序,最多 200 个。不含 anycon 自己建的 worktree 分支(`<branch_prefix>/…`)。
|
|
1826
|
+
*/
|
|
1827
|
+
local: string[];
|
|
1828
|
+
/**
|
|
1829
|
+
* 远端跟踪分支(`origin/main`),同样排序和上限,不含 `* /HEAD`。
|
|
1830
|
+
*/
|
|
1831
|
+
remote: string[];
|
|
1832
|
+
/**
|
|
1833
|
+
* 任何一组被截断时为 true。
|
|
1834
|
+
*/
|
|
1835
|
+
truncated?: boolean;
|
|
1836
|
+
}
|
|
1837
|
+
/**
|
|
1838
|
+
* `workspace.browse`:给「关联已有目录」的选择器列本机目录。只列目录,只在 `workspace.link_roots` 之内。
|
|
1839
|
+
*/
|
|
1840
|
+
export interface WorkspaceBrowseParams {
|
|
1841
|
+
/**
|
|
1842
|
+
* 要列的目录(绝对路径或 `~/…`)。缺省 = `roots` 的第一项。
|
|
1843
|
+
*/
|
|
1844
|
+
path?: string | null;
|
|
1845
|
+
/**
|
|
1846
|
+
* 也列出以 `.` 开头的目录。默认 false。
|
|
1847
|
+
*/
|
|
1848
|
+
show_hidden?: boolean;
|
|
1849
|
+
}
|
|
1850
|
+
export interface WorkspaceBrowseResult {
|
|
1851
|
+
/**
|
|
1852
|
+
* `path` 本身不能关联、又不是因为已经是项目时,给出原因(规则同 `BrowseEntry.blocked`)。
|
|
1853
|
+
*/
|
|
1854
|
+
blocked?: LinkBlock | null;
|
|
1855
|
+
/**
|
|
1856
|
+
* 子目录,按名字排序。跟随符号链接;解析后落在 `roots` 之外的不列。
|
|
1857
|
+
*/
|
|
1858
|
+
entries: BrowseEntry[];
|
|
1859
|
+
/**
|
|
1860
|
+
* `path` 本身能不能直接关联(规则同 `BrowseEntry.linkable`)。
|
|
1861
|
+
*/
|
|
1862
|
+
linkable: boolean;
|
|
1863
|
+
/**
|
|
1864
|
+
* 上一级的绝对路径;`path` 已经是某个 root 时为空(不能再往上)。
|
|
1865
|
+
*/
|
|
1866
|
+
parent?: string | null;
|
|
1867
|
+
/**
|
|
1868
|
+
* canonicalize 之后的绝对路径。
|
|
1869
|
+
*/
|
|
1870
|
+
path: string;
|
|
1871
|
+
/**
|
|
1872
|
+
* `path` 本身已经是项目时给出项目名。
|
|
1873
|
+
*/
|
|
1874
|
+
project?: string | null;
|
|
1875
|
+
/**
|
|
1876
|
+
* 可浏览、可关联的范围:`workspace.link_roots` 展开并 canonicalize 后的绝对路径。
|
|
1877
|
+
*/
|
|
1878
|
+
roots: string[];
|
|
1879
|
+
/**
|
|
1880
|
+
* 子目录超过 1000 个时只给前 1000 个。
|
|
1881
|
+
*/
|
|
1882
|
+
truncated?: boolean;
|
|
1883
|
+
}
|
|
1884
|
+
/**
|
|
1885
|
+
* `workspace.changed` 通知。
|
|
1886
|
+
*/
|
|
1887
|
+
export interface WorkspaceChanged {
|
|
1888
|
+
added?: string[];
|
|
1889
|
+
removed?: string[];
|
|
1890
|
+
renamed?: RenamedProject[];
|
|
1891
|
+
/**
|
|
1892
|
+
* 这些项目推导出来的元数据(`git`)有了或变了——比如 daemon 重启后冷缓存里第一次算完(ADR-34)。
|
|
1893
|
+
* 客户端重新 `workspace.list`。
|
|
1894
|
+
*/
|
|
1895
|
+
updated?: string[];
|
|
1896
|
+
}
|
|
1897
|
+
export interface RenamedProject {
|
|
1898
|
+
from: string;
|
|
1899
|
+
to: string;
|
|
1900
|
+
}
|
|
1901
|
+
export interface WorkspaceCloneParams {
|
|
1902
|
+
name?: string | null;
|
|
1903
|
+
/**
|
|
1904
|
+
* 只允许 `https://`、`ssh://`、`git@host:path` 三种形式。
|
|
1905
|
+
*/
|
|
1906
|
+
url: string;
|
|
1907
|
+
}
|
|
1908
|
+
export interface WorkspaceCreateParams {
|
|
1909
|
+
git_init?: boolean;
|
|
1910
|
+
name: string;
|
|
1911
|
+
}
|
|
1912
|
+
/**
|
|
1913
|
+
* `workspace.link`:把本机一个已有目录关联为项目。
|
|
1914
|
+
*/
|
|
1915
|
+
export interface WorkspaceLinkParams {
|
|
1916
|
+
/**
|
|
1917
|
+
* 项目名;缺省取目录名。规则同 `workspace.create`,不能和已有项目(根目录下的或关联的)重名。
|
|
1918
|
+
*/
|
|
1919
|
+
name?: string | null;
|
|
1920
|
+
/**
|
|
1921
|
+
* 本机绝对路径;`~` / `~/…` 按 daemon 用户的 HOME 展开。必须是已存在的目录,
|
|
1922
|
+
* canonicalize 之后要在 `workspace.link_roots` 之内。
|
|
1923
|
+
*/
|
|
1924
|
+
path: string;
|
|
1925
|
+
}
|
|
1926
|
+
export interface WorkspaceListResult {
|
|
1927
|
+
projects: Project[];
|
|
1928
|
+
root: string;
|
|
1929
|
+
}
|
|
1930
|
+
export interface WorkspaceNameParams {
|
|
1931
|
+
name: string;
|
|
1932
|
+
}
|
|
1933
|
+
/**
|
|
1934
|
+
* `workspace.remove_worktree`:删掉一个已保留或没有会话的 worktree。会话还没归档时返回 `busy`。
|
|
1935
|
+
*/
|
|
1936
|
+
export interface WorkspaceRemoveWorktreeParams {
|
|
1937
|
+
/**
|
|
1938
|
+
* 同时删掉分支(`git branch -D`)。分支上有没合并的提交也会丢。
|
|
1939
|
+
*/
|
|
1940
|
+
delete_branch?: boolean;
|
|
1941
|
+
/**
|
|
1942
|
+
* 有未提交的改动也删(丢弃这些改动)。为 false 而有改动时返回 `invalid`,`data.reason = "uncommitted_changes"`。
|
|
1943
|
+
*/
|
|
1944
|
+
force?: boolean;
|
|
1945
|
+
id: string;
|
|
1946
|
+
}
|
|
1947
|
+
export interface WorkspaceRenameParams {
|
|
1948
|
+
from: string;
|
|
1949
|
+
to: string;
|
|
1950
|
+
}
|
|
1951
|
+
export interface WorkspaceTrashIdParams {
|
|
1952
|
+
id: string;
|
|
1953
|
+
}
|
|
1954
|
+
export interface WorkspaceTrashListResult {
|
|
1955
|
+
entries: TrashEntry[];
|
|
1956
|
+
}
|
|
1957
|
+
/**
|
|
1958
|
+
* `workspace.worktrees`。
|
|
1959
|
+
*/
|
|
1960
|
+
export interface WorkspaceWorktreesParams {
|
|
1961
|
+
/**
|
|
1962
|
+
* 只列这个项目的;缺省 = 全部项目。
|
|
1963
|
+
*/
|
|
1964
|
+
project?: string | null;
|
|
1965
|
+
}
|
|
1966
|
+
export interface WorkspaceWorktreesResult {
|
|
1967
|
+
worktrees: WorktreeInfo[];
|
|
1968
|
+
}
|
|
1969
|
+
/**
|
|
1970
|
+
* 一个由 anycon 建的 worktree。
|
|
1971
|
+
*/
|
|
1972
|
+
export interface WorktreeInfo {
|
|
1973
|
+
/**
|
|
1974
|
+
* 分支上 base 之后自己的提交数。
|
|
1975
|
+
*/
|
|
1976
|
+
ahead: number;
|
|
1977
|
+
/**
|
|
1978
|
+
* base 的展示名,规则同 `SessionWorktree.base`(短引用名,或提交的前 12 位)。
|
|
1979
|
+
*/
|
|
1980
|
+
base: string;
|
|
1981
|
+
branch: string;
|
|
1982
|
+
/**
|
|
1983
|
+
* 磁盘占用;统计超过时间预算时为空。
|
|
1984
|
+
*/
|
|
1985
|
+
bytes?: number | null;
|
|
1986
|
+
created_at_ms: number;
|
|
1987
|
+
/**
|
|
1988
|
+
* daemon 生成的 id(`wt_` + 22 位 base62)。
|
|
1989
|
+
*/
|
|
1990
|
+
id: string;
|
|
1991
|
+
/**
|
|
1992
|
+
* 相对项目目录的路径,如 `.anycon/worktrees/fix-login`。
|
|
1993
|
+
*/
|
|
1994
|
+
path: string;
|
|
1995
|
+
project: string;
|
|
1996
|
+
/**
|
|
1997
|
+
* 所属会话;会话删掉之后为空(「没有会话的 worktree」)。
|
|
1998
|
+
*/
|
|
1999
|
+
session_id?: string | null;
|
|
2000
|
+
session_title?: string | null;
|
|
2001
|
+
state: WorktreeState;
|
|
2002
|
+
/**
|
|
2003
|
+
* 未提交的文件数(含未跟踪的);目录不在时为 0。
|
|
2004
|
+
*/
|
|
2005
|
+
uncommitted: number;
|
|
2006
|
+
}
|
|
2007
|
+
//# sourceMappingURL=generated.d.ts.map
|