@pocketcoder/shared 0.0.2
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 +53 -0
- package/dist/constants/__tests__/limits.test.d.ts +2 -0
- package/dist/constants/__tests__/limits.test.d.ts.map +1 -0
- package/dist/constants/__tests__/limits.test.js +68 -0
- package/dist/constants/__tests__/limits.test.js.map +1 -0
- package/dist/constants/errors.d.ts +48 -0
- package/dist/constants/errors.d.ts.map +1 -0
- package/dist/constants/errors.js +61 -0
- package/dist/constants/errors.js.map +1 -0
- package/dist/constants/index.d.ts +3 -0
- package/dist/constants/index.d.ts.map +1 -0
- package/dist/constants/index.js +4 -0
- package/dist/constants/index.js.map +1 -0
- package/dist/constants/limits.d.ts +41 -0
- package/dist/constants/limits.d.ts.map +1 -0
- package/dist/constants/limits.js +46 -0
- package/dist/constants/limits.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/types/__tests__/auth-messages.test.d.ts +2 -0
- package/dist/types/__tests__/auth-messages.test.d.ts.map +1 -0
- package/dist/types/__tests__/auth-messages.test.js +94 -0
- package/dist/types/__tests__/auth-messages.test.js.map +1 -0
- package/dist/types/__tests__/messages.test.d.ts +2 -0
- package/dist/types/__tests__/messages.test.d.ts.map +1 -0
- package/dist/types/__tests__/messages.test.js +329 -0
- package/dist/types/__tests__/messages.test.js.map +1 -0
- package/dist/types/__tests__/relay-types.test.d.ts +2 -0
- package/dist/types/__tests__/relay-types.test.d.ts.map +1 -0
- package/dist/types/__tests__/relay-types.test.js +69 -0
- package/dist/types/__tests__/relay-types.test.js.map +1 -0
- package/dist/types/auth-messages.d.ts +49 -0
- package/dist/types/auth-messages.d.ts.map +1 -0
- package/dist/types/auth-messages.js +9 -0
- package/dist/types/auth-messages.js.map +1 -0
- package/dist/types/database.d.ts +259 -0
- package/dist/types/database.d.ts.map +1 -0
- package/dist/types/database.js +6 -0
- package/dist/types/database.js.map +1 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +6 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/messages.d.ts +821 -0
- package/dist/types/messages.d.ts.map +1 -0
- package/dist/types/messages.js +122 -0
- package/dist/types/messages.js.map +1 -0
- package/dist/types/relay.d.ts +62 -0
- package/dist/types/relay.d.ts.map +1 -0
- package/dist/types/relay.js +8 -0
- package/dist/types/relay.js.map +1 -0
- package/package.json +49 -0
- package/src/constants/__tests__/limits.test.ts +93 -0
- package/src/constants/errors.ts +71 -0
- package/src/constants/index.ts +3 -0
- package/src/constants/limits.ts +53 -0
- package/src/index.ts +3 -0
- package/src/types/__tests__/auth-messages.test.ts +108 -0
- package/src/types/__tests__/messages.test.ts +382 -0
- package/src/types/__tests__/relay-types.test.ts +82 -0
- package/src/types/auth-messages.ts +66 -0
- package/src/types/database.ts +320 -0
- package/src/types/index.ts +5 -0
- package/src/types/messages.ts +1310 -0
- package/src/types/relay.ts +79 -0
|
@@ -0,0 +1,821 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WebSocket message types for communication between daemon, relay, and client.
|
|
3
|
+
* All types match the PRD exactly.
|
|
4
|
+
*/
|
|
5
|
+
/** All known message type strings */
|
|
6
|
+
export type MessageType = "fs_list" | "fs_list_response" | "fs_read" | "fs_read_response" | "fs_write" | "fs_write_response" | "fs_create" | "fs_create_response" | "fs_delete" | "fs_delete_response" | "fs_search" | "fs_search_response" | "fs_replace" | "fs_replace_response" | "fs_changed" | "git_status" | "git_status_response" | "git_branches" | "git_branches_response" | "git_branch_create" | "git_branch_create_response" | "git_checkout" | "git_checkout_response" | "git_stage" | "git_stage_response" | "git_unstage" | "git_unstage_response" | "git_commit" | "git_commit_response" | "git_push" | "git_push_response" | "git_pull" | "git_pull_response" | "git_file_base" | "git_file_base_response" | "git_discard" | "git_discard_response" | "git_diff" | "git_diff_response" | "command_exec" | "command_output" | "command_exit" | "command_cancel" | "terminal_create" | "terminal_create_response" | "terminal_stdin" | "terminal_stdout" | "terminal_resize" | "terminal_kill" | "terminal_exit" | "agent_sessions_list" | "agent_sessions_list_response" | "agent_session_new" | "agent_session_new_response" | "agent_message" | "agent_message_response" | "agent_event" | "agent_cancel" | "agent_prompt_response" | "daemon_register" | "project_added" | "project_removed" | "machines_list" | "machines_list_response" | "projects_list" | "projects_list_response" | "project_create" | "project_create_response" | "project_delete" | "project_delete_response" | "credential_prompt" | "credential_response" | "sse_event" | "permission_reply" | "permission_reply_response" | "error";
|
|
7
|
+
export interface MessageError {
|
|
8
|
+
code: string;
|
|
9
|
+
message: string;
|
|
10
|
+
details?: Record<string, unknown>;
|
|
11
|
+
}
|
|
12
|
+
export interface FsNode {
|
|
13
|
+
name: string;
|
|
14
|
+
path: string;
|
|
15
|
+
type: "file" | "dir";
|
|
16
|
+
size?: number;
|
|
17
|
+
mtime?: string;
|
|
18
|
+
children?: FsNode[];
|
|
19
|
+
expanded?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export interface FsChange {
|
|
22
|
+
kind: "create" | "modify" | "delete";
|
|
23
|
+
path: string;
|
|
24
|
+
}
|
|
25
|
+
export interface FsListRequest {
|
|
26
|
+
type: "fs_list";
|
|
27
|
+
requestId: string;
|
|
28
|
+
sessionId: string;
|
|
29
|
+
payload: {
|
|
30
|
+
path: string;
|
|
31
|
+
depth?: number;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
export interface FsListResponse {
|
|
35
|
+
type: "fs_list_response";
|
|
36
|
+
requestId: string;
|
|
37
|
+
sessionId: string;
|
|
38
|
+
payload?: {
|
|
39
|
+
path: string;
|
|
40
|
+
children: FsNode[];
|
|
41
|
+
seq: number;
|
|
42
|
+
};
|
|
43
|
+
error?: MessageError;
|
|
44
|
+
}
|
|
45
|
+
export interface FsReadRequest {
|
|
46
|
+
type: "fs_read";
|
|
47
|
+
requestId: string;
|
|
48
|
+
sessionId: string;
|
|
49
|
+
payload: {
|
|
50
|
+
path: string;
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
export interface FsReadResponse {
|
|
54
|
+
type: "fs_read_response";
|
|
55
|
+
requestId: string;
|
|
56
|
+
payload?: {
|
|
57
|
+
path: string;
|
|
58
|
+
content: string;
|
|
59
|
+
encoding: string;
|
|
60
|
+
size: number;
|
|
61
|
+
mtime: string;
|
|
62
|
+
};
|
|
63
|
+
error?: MessageError;
|
|
64
|
+
}
|
|
65
|
+
export interface FsWriteRequest {
|
|
66
|
+
type: "fs_write";
|
|
67
|
+
requestId: string;
|
|
68
|
+
sessionId: string;
|
|
69
|
+
payload: {
|
|
70
|
+
path: string;
|
|
71
|
+
content: string;
|
|
72
|
+
createDirs?: boolean;
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
export interface FsWriteResponse {
|
|
76
|
+
type: "fs_write_response";
|
|
77
|
+
requestId: string;
|
|
78
|
+
payload?: {
|
|
79
|
+
path: string;
|
|
80
|
+
size: number;
|
|
81
|
+
mtime: string;
|
|
82
|
+
};
|
|
83
|
+
error?: MessageError;
|
|
84
|
+
}
|
|
85
|
+
export interface FsCreateRequest {
|
|
86
|
+
type: "fs_create";
|
|
87
|
+
requestId: string;
|
|
88
|
+
sessionId: string;
|
|
89
|
+
payload: {
|
|
90
|
+
path: string;
|
|
91
|
+
itemType: "file" | "directory";
|
|
92
|
+
createDirs?: boolean;
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
export interface FsCreateResponse {
|
|
96
|
+
type: "fs_create_response";
|
|
97
|
+
requestId: string;
|
|
98
|
+
payload?: {
|
|
99
|
+
path: string;
|
|
100
|
+
itemType: "file" | "directory";
|
|
101
|
+
};
|
|
102
|
+
error?: MessageError;
|
|
103
|
+
}
|
|
104
|
+
export interface FsDeleteRequest {
|
|
105
|
+
type: "fs_delete";
|
|
106
|
+
requestId: string;
|
|
107
|
+
sessionId: string;
|
|
108
|
+
payload: {
|
|
109
|
+
path: string;
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
export interface FsDeleteResponse {
|
|
113
|
+
type: "fs_delete_response";
|
|
114
|
+
requestId: string;
|
|
115
|
+
payload?: {
|
|
116
|
+
path: string;
|
|
117
|
+
};
|
|
118
|
+
error?: MessageError;
|
|
119
|
+
}
|
|
120
|
+
export interface FsSearchMatch {
|
|
121
|
+
line: number;
|
|
122
|
+
content: string;
|
|
123
|
+
column?: number;
|
|
124
|
+
}
|
|
125
|
+
export interface FsSearchFileResult {
|
|
126
|
+
path: string;
|
|
127
|
+
matches: FsSearchMatch[];
|
|
128
|
+
}
|
|
129
|
+
export interface FsSearchRequest {
|
|
130
|
+
type: "fs_search";
|
|
131
|
+
requestId: string;
|
|
132
|
+
sessionId: string;
|
|
133
|
+
payload: {
|
|
134
|
+
query: string;
|
|
135
|
+
glob?: string;
|
|
136
|
+
caseSensitive?: boolean;
|
|
137
|
+
regex?: boolean;
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
export interface FsSearchResponse {
|
|
141
|
+
type: "fs_search_response";
|
|
142
|
+
requestId: string;
|
|
143
|
+
payload?: {
|
|
144
|
+
query: string;
|
|
145
|
+
totalMatches: number;
|
|
146
|
+
truncated: boolean;
|
|
147
|
+
files: FsSearchFileResult[];
|
|
148
|
+
};
|
|
149
|
+
error?: MessageError;
|
|
150
|
+
}
|
|
151
|
+
export interface FsReplaceFileResult {
|
|
152
|
+
path: string;
|
|
153
|
+
replacements: number;
|
|
154
|
+
}
|
|
155
|
+
export interface FsReplaceRequest {
|
|
156
|
+
type: "fs_replace";
|
|
157
|
+
requestId: string;
|
|
158
|
+
sessionId: string;
|
|
159
|
+
payload: {
|
|
160
|
+
find: string;
|
|
161
|
+
replace: string;
|
|
162
|
+
glob?: string;
|
|
163
|
+
caseSensitive?: boolean;
|
|
164
|
+
regex?: boolean;
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
export interface FsReplaceResponse {
|
|
168
|
+
type: "fs_replace_response";
|
|
169
|
+
requestId: string;
|
|
170
|
+
payload?: {
|
|
171
|
+
totalReplacements: number;
|
|
172
|
+
filesModified: FsReplaceFileResult[];
|
|
173
|
+
};
|
|
174
|
+
error?: MessageError;
|
|
175
|
+
}
|
|
176
|
+
export interface FsChangedEvent {
|
|
177
|
+
type: "fs_changed";
|
|
178
|
+
sessionId: string;
|
|
179
|
+
payload: {
|
|
180
|
+
seq: number;
|
|
181
|
+
changes: FsChange[];
|
|
182
|
+
changesTruncated?: boolean;
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
export interface GitFileStatus {
|
|
186
|
+
path: string;
|
|
187
|
+
status: string;
|
|
188
|
+
}
|
|
189
|
+
export interface GitBranch {
|
|
190
|
+
name: string;
|
|
191
|
+
remote: string | null;
|
|
192
|
+
ahead: number;
|
|
193
|
+
behind: number;
|
|
194
|
+
}
|
|
195
|
+
export interface GitStatusRequest {
|
|
196
|
+
type: "git_status";
|
|
197
|
+
requestId: string;
|
|
198
|
+
sessionId: string;
|
|
199
|
+
payload: Record<string, never>;
|
|
200
|
+
}
|
|
201
|
+
export interface GitStatusResponse {
|
|
202
|
+
type: "git_status_response";
|
|
203
|
+
requestId: string;
|
|
204
|
+
payload?: {
|
|
205
|
+
branch: string;
|
|
206
|
+
clean: boolean;
|
|
207
|
+
staged: GitFileStatus[];
|
|
208
|
+
unstaged: GitFileStatus[];
|
|
209
|
+
conflicts: GitFileStatus[];
|
|
210
|
+
};
|
|
211
|
+
error?: MessageError;
|
|
212
|
+
}
|
|
213
|
+
export interface GitBranchesRequest {
|
|
214
|
+
type: "git_branches";
|
|
215
|
+
requestId: string;
|
|
216
|
+
sessionId: string;
|
|
217
|
+
payload: Record<string, never>;
|
|
218
|
+
}
|
|
219
|
+
export interface GitBranchesResponse {
|
|
220
|
+
type: "git_branches_response";
|
|
221
|
+
requestId: string;
|
|
222
|
+
payload?: {
|
|
223
|
+
current: string;
|
|
224
|
+
branches: GitBranch[];
|
|
225
|
+
};
|
|
226
|
+
error?: MessageError;
|
|
227
|
+
}
|
|
228
|
+
export interface GitBranchCreateRequest {
|
|
229
|
+
type: "git_branch_create";
|
|
230
|
+
requestId: string;
|
|
231
|
+
sessionId: string;
|
|
232
|
+
payload: {
|
|
233
|
+
name: string;
|
|
234
|
+
startPoint?: string;
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
export interface GitBranchCreateResponse {
|
|
238
|
+
type: "git_branch_create_response";
|
|
239
|
+
requestId: string;
|
|
240
|
+
payload?: {
|
|
241
|
+
name: string;
|
|
242
|
+
created: boolean;
|
|
243
|
+
};
|
|
244
|
+
error?: MessageError;
|
|
245
|
+
}
|
|
246
|
+
export interface GitCheckoutRequest {
|
|
247
|
+
type: "git_checkout";
|
|
248
|
+
requestId: string;
|
|
249
|
+
sessionId: string;
|
|
250
|
+
payload: {
|
|
251
|
+
ref: string;
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
export interface GitCheckoutResponse {
|
|
255
|
+
type: "git_checkout_response";
|
|
256
|
+
requestId: string;
|
|
257
|
+
payload?: {
|
|
258
|
+
ref: string;
|
|
259
|
+
switched: boolean;
|
|
260
|
+
};
|
|
261
|
+
error?: MessageError;
|
|
262
|
+
}
|
|
263
|
+
export interface GitStageRequest {
|
|
264
|
+
type: "git_stage";
|
|
265
|
+
requestId: string;
|
|
266
|
+
sessionId: string;
|
|
267
|
+
payload: {
|
|
268
|
+
paths: string[];
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
export interface GitStageResponse {
|
|
272
|
+
type: "git_stage_response";
|
|
273
|
+
requestId: string;
|
|
274
|
+
payload?: {
|
|
275
|
+
staged: string[];
|
|
276
|
+
};
|
|
277
|
+
error?: MessageError;
|
|
278
|
+
}
|
|
279
|
+
export interface GitUnstageRequest {
|
|
280
|
+
type: "git_unstage";
|
|
281
|
+
requestId: string;
|
|
282
|
+
sessionId: string;
|
|
283
|
+
payload: {
|
|
284
|
+
paths: string[];
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
export interface GitUnstageResponse {
|
|
288
|
+
type: "git_unstage_response";
|
|
289
|
+
requestId: string;
|
|
290
|
+
payload?: {
|
|
291
|
+
unstaged: string[];
|
|
292
|
+
};
|
|
293
|
+
error?: MessageError;
|
|
294
|
+
}
|
|
295
|
+
export interface GitCommitRequest {
|
|
296
|
+
type: "git_commit";
|
|
297
|
+
requestId: string;
|
|
298
|
+
sessionId: string;
|
|
299
|
+
payload: {
|
|
300
|
+
message: string;
|
|
301
|
+
};
|
|
302
|
+
}
|
|
303
|
+
export interface GitCommitResponse {
|
|
304
|
+
type: "git_commit_response";
|
|
305
|
+
requestId: string;
|
|
306
|
+
payload?: {
|
|
307
|
+
sha: string;
|
|
308
|
+
message: string;
|
|
309
|
+
};
|
|
310
|
+
error?: MessageError;
|
|
311
|
+
}
|
|
312
|
+
export interface GitPushRequest {
|
|
313
|
+
type: "git_push";
|
|
314
|
+
requestId: string;
|
|
315
|
+
sessionId: string;
|
|
316
|
+
payload: {
|
|
317
|
+
remote?: string;
|
|
318
|
+
branch?: string;
|
|
319
|
+
force?: boolean;
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
export interface GitPushResponse {
|
|
323
|
+
type: "git_push_response";
|
|
324
|
+
requestId: string;
|
|
325
|
+
payload?: {
|
|
326
|
+
remote: string;
|
|
327
|
+
branch: string;
|
|
328
|
+
pushed: boolean;
|
|
329
|
+
};
|
|
330
|
+
error?: MessageError;
|
|
331
|
+
}
|
|
332
|
+
export interface GitPullRequest {
|
|
333
|
+
type: "git_pull";
|
|
334
|
+
requestId: string;
|
|
335
|
+
sessionId: string;
|
|
336
|
+
payload: {
|
|
337
|
+
remote?: string;
|
|
338
|
+
branch?: string;
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
export interface GitPullResponse {
|
|
342
|
+
type: "git_pull_response";
|
|
343
|
+
requestId: string;
|
|
344
|
+
payload?: {
|
|
345
|
+
remote: string;
|
|
346
|
+
branch: string;
|
|
347
|
+
pulled: boolean;
|
|
348
|
+
conflicts?: string[];
|
|
349
|
+
};
|
|
350
|
+
error?: MessageError;
|
|
351
|
+
}
|
|
352
|
+
export interface GitFileBaseRequest {
|
|
353
|
+
type: "git_file_base";
|
|
354
|
+
requestId: string;
|
|
355
|
+
sessionId: string;
|
|
356
|
+
payload: {
|
|
357
|
+
path: string;
|
|
358
|
+
ref?: string;
|
|
359
|
+
};
|
|
360
|
+
}
|
|
361
|
+
export interface GitFileBaseResponse {
|
|
362
|
+
type: "git_file_base_response";
|
|
363
|
+
requestId: string;
|
|
364
|
+
payload?: {
|
|
365
|
+
path: string;
|
|
366
|
+
ref: string;
|
|
367
|
+
content: string | null;
|
|
368
|
+
};
|
|
369
|
+
error?: MessageError;
|
|
370
|
+
}
|
|
371
|
+
export interface GitDiscardRequest {
|
|
372
|
+
type: "git_discard";
|
|
373
|
+
requestId: string;
|
|
374
|
+
sessionId: string;
|
|
375
|
+
payload: {
|
|
376
|
+
paths?: string[];
|
|
377
|
+
all?: boolean;
|
|
378
|
+
};
|
|
379
|
+
}
|
|
380
|
+
export interface GitDiscardResponse {
|
|
381
|
+
type: "git_discard_response";
|
|
382
|
+
requestId: string;
|
|
383
|
+
payload?: {
|
|
384
|
+
discarded: number;
|
|
385
|
+
};
|
|
386
|
+
error?: MessageError;
|
|
387
|
+
}
|
|
388
|
+
export interface GitDiffRequest {
|
|
389
|
+
type: "git_diff";
|
|
390
|
+
requestId: string;
|
|
391
|
+
sessionId: string;
|
|
392
|
+
payload: {
|
|
393
|
+
path?: string;
|
|
394
|
+
staged?: boolean;
|
|
395
|
+
};
|
|
396
|
+
}
|
|
397
|
+
export interface GitDiffFileResult {
|
|
398
|
+
path: string;
|
|
399
|
+
status: string;
|
|
400
|
+
additions: number;
|
|
401
|
+
deletions: number;
|
|
402
|
+
diff: string;
|
|
403
|
+
}
|
|
404
|
+
export interface GitDiffResponse {
|
|
405
|
+
type: "git_diff_response";
|
|
406
|
+
requestId: string;
|
|
407
|
+
payload?: {
|
|
408
|
+
files: GitDiffFileResult[];
|
|
409
|
+
};
|
|
410
|
+
error?: MessageError;
|
|
411
|
+
}
|
|
412
|
+
export type CredentialPromptType = "password" | "passphrase" | "username" | "pin";
|
|
413
|
+
export interface CredentialPromptEvent {
|
|
414
|
+
type: "credential_prompt";
|
|
415
|
+
requestId: string;
|
|
416
|
+
payload: {
|
|
417
|
+
promptType: CredentialPromptType;
|
|
418
|
+
prompt: string;
|
|
419
|
+
};
|
|
420
|
+
}
|
|
421
|
+
export interface CredentialResponseRequest {
|
|
422
|
+
type: "credential_response";
|
|
423
|
+
requestId: string;
|
|
424
|
+
payload: {
|
|
425
|
+
value: string;
|
|
426
|
+
cancelled: boolean;
|
|
427
|
+
};
|
|
428
|
+
}
|
|
429
|
+
export interface SseEventMessage {
|
|
430
|
+
type: "sse_event";
|
|
431
|
+
payload: {
|
|
432
|
+
event: string;
|
|
433
|
+
data: string;
|
|
434
|
+
sessionId?: string;
|
|
435
|
+
};
|
|
436
|
+
}
|
|
437
|
+
export type PermissionReplyValue = "once" | "always" | "reject";
|
|
438
|
+
export interface PermissionReplyRequest {
|
|
439
|
+
type: "permission_reply";
|
|
440
|
+
requestId: string;
|
|
441
|
+
sessionId: string;
|
|
442
|
+
payload: {
|
|
443
|
+
permissionId: string;
|
|
444
|
+
reply: PermissionReplyValue;
|
|
445
|
+
};
|
|
446
|
+
}
|
|
447
|
+
export interface PermissionReplyResponse {
|
|
448
|
+
type: "permission_reply_response";
|
|
449
|
+
requestId: string;
|
|
450
|
+
payload?: {
|
|
451
|
+
status: number;
|
|
452
|
+
body?: unknown;
|
|
453
|
+
};
|
|
454
|
+
error?: MessageError;
|
|
455
|
+
}
|
|
456
|
+
export interface CommandExecRequest {
|
|
457
|
+
type: "command_exec";
|
|
458
|
+
requestId: string;
|
|
459
|
+
sessionId: string;
|
|
460
|
+
payload: {
|
|
461
|
+
command: string;
|
|
462
|
+
};
|
|
463
|
+
}
|
|
464
|
+
export interface CommandOutputEvent {
|
|
465
|
+
type: "command_output";
|
|
466
|
+
requestId: string;
|
|
467
|
+
payload: {
|
|
468
|
+
stdoutChunk?: string;
|
|
469
|
+
stderrChunk?: string;
|
|
470
|
+
};
|
|
471
|
+
}
|
|
472
|
+
export interface CommandExitEvent {
|
|
473
|
+
type: "command_exit";
|
|
474
|
+
requestId: string;
|
|
475
|
+
payload: {
|
|
476
|
+
exitCode: number | null;
|
|
477
|
+
signal?: string;
|
|
478
|
+
durationMs: number;
|
|
479
|
+
};
|
|
480
|
+
}
|
|
481
|
+
export interface CommandCancelRequest {
|
|
482
|
+
type: "command_cancel";
|
|
483
|
+
requestId: string;
|
|
484
|
+
sessionId: string;
|
|
485
|
+
payload: {
|
|
486
|
+
requestId: string;
|
|
487
|
+
};
|
|
488
|
+
}
|
|
489
|
+
export interface TerminalCreateRequest {
|
|
490
|
+
type: "terminal_create";
|
|
491
|
+
requestId: string;
|
|
492
|
+
sessionId: string;
|
|
493
|
+
payload: {
|
|
494
|
+
cols?: number;
|
|
495
|
+
rows?: number;
|
|
496
|
+
};
|
|
497
|
+
}
|
|
498
|
+
export interface TerminalCreateResponse {
|
|
499
|
+
type: "terminal_create_response";
|
|
500
|
+
requestId: string;
|
|
501
|
+
payload: {
|
|
502
|
+
terminalId: string;
|
|
503
|
+
};
|
|
504
|
+
error?: MessageError;
|
|
505
|
+
}
|
|
506
|
+
export interface TerminalStdinRequest {
|
|
507
|
+
type: "terminal_stdin";
|
|
508
|
+
requestId: string;
|
|
509
|
+
sessionId: string;
|
|
510
|
+
payload: {
|
|
511
|
+
terminalId: string;
|
|
512
|
+
data: string;
|
|
513
|
+
};
|
|
514
|
+
}
|
|
515
|
+
export interface TerminalStdoutEvent {
|
|
516
|
+
type: "terminal_stdout";
|
|
517
|
+
payload: {
|
|
518
|
+
terminalId: string;
|
|
519
|
+
data: string;
|
|
520
|
+
};
|
|
521
|
+
}
|
|
522
|
+
export interface TerminalResizeRequest {
|
|
523
|
+
type: "terminal_resize";
|
|
524
|
+
requestId: string;
|
|
525
|
+
sessionId: string;
|
|
526
|
+
payload: {
|
|
527
|
+
terminalId: string;
|
|
528
|
+
cols: number;
|
|
529
|
+
rows: number;
|
|
530
|
+
};
|
|
531
|
+
}
|
|
532
|
+
export interface TerminalKillRequest {
|
|
533
|
+
type: "terminal_kill";
|
|
534
|
+
requestId: string;
|
|
535
|
+
sessionId: string;
|
|
536
|
+
payload: {
|
|
537
|
+
terminalId: string;
|
|
538
|
+
};
|
|
539
|
+
}
|
|
540
|
+
export interface TerminalExitEvent {
|
|
541
|
+
type: "terminal_exit";
|
|
542
|
+
payload: {
|
|
543
|
+
terminalId: string;
|
|
544
|
+
exitCode: number;
|
|
545
|
+
signal?: number;
|
|
546
|
+
};
|
|
547
|
+
}
|
|
548
|
+
export type AgentEvent = {
|
|
549
|
+
type: "init";
|
|
550
|
+
sessionId: string;
|
|
551
|
+
tools: string[];
|
|
552
|
+
model: string;
|
|
553
|
+
} | {
|
|
554
|
+
type: "thinking";
|
|
555
|
+
content: string;
|
|
556
|
+
} | {
|
|
557
|
+
type: "text";
|
|
558
|
+
content: string;
|
|
559
|
+
} | {
|
|
560
|
+
type: "tool_use";
|
|
561
|
+
tool: string;
|
|
562
|
+
input: Record<string, unknown>;
|
|
563
|
+
} | {
|
|
564
|
+
type: "tool_complete";
|
|
565
|
+
toolUseId: string;
|
|
566
|
+
} | {
|
|
567
|
+
type: "file_edit";
|
|
568
|
+
path: string;
|
|
569
|
+
diff?: string;
|
|
570
|
+
} | {
|
|
571
|
+
type: "file_create";
|
|
572
|
+
path: string;
|
|
573
|
+
} | {
|
|
574
|
+
type: "file_delete";
|
|
575
|
+
path: string;
|
|
576
|
+
} | {
|
|
577
|
+
type: "prompt";
|
|
578
|
+
questions: Array<{
|
|
579
|
+
question: string;
|
|
580
|
+
header: string;
|
|
581
|
+
options: Array<{
|
|
582
|
+
label: string;
|
|
583
|
+
description: string;
|
|
584
|
+
}>;
|
|
585
|
+
multiSelect: boolean;
|
|
586
|
+
}>;
|
|
587
|
+
} | {
|
|
588
|
+
type: "done";
|
|
589
|
+
usage?: {
|
|
590
|
+
input_tokens: number;
|
|
591
|
+
output_tokens: number;
|
|
592
|
+
};
|
|
593
|
+
cancelled?: boolean;
|
|
594
|
+
error?: string;
|
|
595
|
+
};
|
|
596
|
+
export interface AgentSessionInfo {
|
|
597
|
+
agentSessionId: string;
|
|
598
|
+
lastUsedAt: string;
|
|
599
|
+
title: string | null;
|
|
600
|
+
}
|
|
601
|
+
export interface AgentSessionsListRequest {
|
|
602
|
+
type: "agent_sessions_list";
|
|
603
|
+
requestId: string;
|
|
604
|
+
sessionId: string;
|
|
605
|
+
payload: Record<string, never>;
|
|
606
|
+
}
|
|
607
|
+
export interface AgentSessionsListResponse {
|
|
608
|
+
type: "agent_sessions_list_response";
|
|
609
|
+
requestId: string;
|
|
610
|
+
payload?: {
|
|
611
|
+
sessions: AgentSessionInfo[];
|
|
612
|
+
};
|
|
613
|
+
error?: MessageError;
|
|
614
|
+
}
|
|
615
|
+
export interface AgentSessionNewRequest {
|
|
616
|
+
type: "agent_session_new";
|
|
617
|
+
requestId: string;
|
|
618
|
+
sessionId: string;
|
|
619
|
+
payload: {
|
|
620
|
+
content: string;
|
|
621
|
+
};
|
|
622
|
+
}
|
|
623
|
+
export interface AgentSessionNewResponse {
|
|
624
|
+
type: "agent_session_new_response";
|
|
625
|
+
requestId: string;
|
|
626
|
+
payload?: {
|
|
627
|
+
agentSessionId: string;
|
|
628
|
+
};
|
|
629
|
+
error?: MessageError;
|
|
630
|
+
}
|
|
631
|
+
export interface AgentMessageRequest {
|
|
632
|
+
type: "agent_message";
|
|
633
|
+
requestId: string;
|
|
634
|
+
sessionId: string;
|
|
635
|
+
payload: {
|
|
636
|
+
agentSessionId: string;
|
|
637
|
+
content: string;
|
|
638
|
+
};
|
|
639
|
+
}
|
|
640
|
+
export interface AgentMessageResponse {
|
|
641
|
+
type: "agent_message_response";
|
|
642
|
+
requestId: string;
|
|
643
|
+
payload?: {
|
|
644
|
+
queued?: boolean;
|
|
645
|
+
started?: boolean;
|
|
646
|
+
};
|
|
647
|
+
error?: MessageError;
|
|
648
|
+
}
|
|
649
|
+
export interface AgentEventMessage {
|
|
650
|
+
type: "agent_event";
|
|
651
|
+
sessionId: string;
|
|
652
|
+
payload: {
|
|
653
|
+
agentSessionId: string;
|
|
654
|
+
event: AgentEvent;
|
|
655
|
+
};
|
|
656
|
+
}
|
|
657
|
+
export interface AgentCancelRequest {
|
|
658
|
+
type: "agent_cancel";
|
|
659
|
+
requestId: string;
|
|
660
|
+
sessionId: string;
|
|
661
|
+
payload: {
|
|
662
|
+
agentSessionId: string;
|
|
663
|
+
};
|
|
664
|
+
}
|
|
665
|
+
export interface AgentPromptResponseRequest {
|
|
666
|
+
type: "agent_prompt_response";
|
|
667
|
+
requestId: string;
|
|
668
|
+
sessionId: string;
|
|
669
|
+
payload: {
|
|
670
|
+
agentSessionId: string;
|
|
671
|
+
response: string;
|
|
672
|
+
};
|
|
673
|
+
}
|
|
674
|
+
export interface MachineMetadata {
|
|
675
|
+
os: "darwin" | "linux" | "win32";
|
|
676
|
+
osVersion: string;
|
|
677
|
+
hostname: string;
|
|
678
|
+
username: string;
|
|
679
|
+
label: string | null;
|
|
680
|
+
}
|
|
681
|
+
export interface RegisterProject {
|
|
682
|
+
projectId: string;
|
|
683
|
+
name: string;
|
|
684
|
+
path?: string;
|
|
685
|
+
}
|
|
686
|
+
export interface DaemonRegisterMessage {
|
|
687
|
+
type: "daemon_register";
|
|
688
|
+
payload: {
|
|
689
|
+
machineKey: string;
|
|
690
|
+
token: string;
|
|
691
|
+
machine: MachineMetadata;
|
|
692
|
+
projects: RegisterProject[];
|
|
693
|
+
};
|
|
694
|
+
}
|
|
695
|
+
export interface ProjectAddedMessage {
|
|
696
|
+
type: "project_added";
|
|
697
|
+
payload: {
|
|
698
|
+
projectId: string;
|
|
699
|
+
name: string;
|
|
700
|
+
path: string;
|
|
701
|
+
};
|
|
702
|
+
}
|
|
703
|
+
export interface ProjectRemovedMessage {
|
|
704
|
+
type: "project_removed";
|
|
705
|
+
payload: {
|
|
706
|
+
projectId: string;
|
|
707
|
+
};
|
|
708
|
+
}
|
|
709
|
+
export interface MachinesListRequest {
|
|
710
|
+
type: "machines_list";
|
|
711
|
+
requestId: string;
|
|
712
|
+
payload: Record<string, never>;
|
|
713
|
+
}
|
|
714
|
+
export interface MachineInfo {
|
|
715
|
+
machineKey: string;
|
|
716
|
+
label: string;
|
|
717
|
+
os: string;
|
|
718
|
+
osVersion: string;
|
|
719
|
+
username: string;
|
|
720
|
+
online: boolean;
|
|
721
|
+
lastSeen: string;
|
|
722
|
+
projectCount: number;
|
|
723
|
+
}
|
|
724
|
+
export interface MachinesListResponse {
|
|
725
|
+
type: "machines_list_response";
|
|
726
|
+
requestId: string;
|
|
727
|
+
payload?: {
|
|
728
|
+
machines: MachineInfo[];
|
|
729
|
+
};
|
|
730
|
+
error?: MessageError;
|
|
731
|
+
}
|
|
732
|
+
export interface ProjectsListRequest {
|
|
733
|
+
type: "projects_list";
|
|
734
|
+
requestId: string;
|
|
735
|
+
payload: {
|
|
736
|
+
machineKey: string;
|
|
737
|
+
};
|
|
738
|
+
}
|
|
739
|
+
export interface ProjectInfo {
|
|
740
|
+
projectId: string;
|
|
741
|
+
name: string;
|
|
742
|
+
path: string;
|
|
743
|
+
hasActiveSession: boolean;
|
|
744
|
+
lastAccessed: string;
|
|
745
|
+
}
|
|
746
|
+
export interface ProjectsListResponse {
|
|
747
|
+
type: "projects_list_response";
|
|
748
|
+
requestId: string;
|
|
749
|
+
payload?: {
|
|
750
|
+
projects: ProjectInfo[];
|
|
751
|
+
};
|
|
752
|
+
error?: MessageError;
|
|
753
|
+
}
|
|
754
|
+
export interface ProjectCreateRequest {
|
|
755
|
+
type: "project_create";
|
|
756
|
+
requestId: string;
|
|
757
|
+
payload: {
|
|
758
|
+
path: string;
|
|
759
|
+
};
|
|
760
|
+
}
|
|
761
|
+
export interface ProjectCreateResponse {
|
|
762
|
+
type: "project_create_response";
|
|
763
|
+
requestId: string;
|
|
764
|
+
payload?: {
|
|
765
|
+
project: {
|
|
766
|
+
projectId: string;
|
|
767
|
+
name: string;
|
|
768
|
+
path: string;
|
|
769
|
+
};
|
|
770
|
+
};
|
|
771
|
+
error?: MessageError;
|
|
772
|
+
}
|
|
773
|
+
export interface ProjectDeleteRequest {
|
|
774
|
+
type: "project_delete";
|
|
775
|
+
requestId: string;
|
|
776
|
+
payload: {
|
|
777
|
+
projectId: string;
|
|
778
|
+
};
|
|
779
|
+
}
|
|
780
|
+
export interface ProjectDeleteResponse {
|
|
781
|
+
type: "project_delete_response";
|
|
782
|
+
requestId: string;
|
|
783
|
+
payload?: {
|
|
784
|
+
success: boolean;
|
|
785
|
+
};
|
|
786
|
+
error?: MessageError;
|
|
787
|
+
}
|
|
788
|
+
export interface ErrorResponse {
|
|
789
|
+
type: "error";
|
|
790
|
+
requestId: string;
|
|
791
|
+
error: MessageError;
|
|
792
|
+
}
|
|
793
|
+
export type RequestMessage = FsListRequest | FsReadRequest | FsWriteRequest | FsCreateRequest | FsDeleteRequest | FsSearchRequest | FsReplaceRequest | GitStatusRequest | GitBranchesRequest | GitBranchCreateRequest | GitCheckoutRequest | GitStageRequest | GitUnstageRequest | GitCommitRequest | GitPushRequest | GitPullRequest | GitFileBaseRequest | GitDiscardRequest | GitDiffRequest | CommandExecRequest | CommandCancelRequest | TerminalCreateRequest | TerminalStdinRequest | TerminalResizeRequest | TerminalKillRequest | AgentSessionsListRequest | AgentSessionNewRequest | AgentMessageRequest | AgentCancelRequest | AgentPromptResponseRequest | MachinesListRequest | ProjectsListRequest | ProjectCreateRequest | ProjectDeleteRequest | CredentialResponseRequest | PermissionReplyRequest;
|
|
794
|
+
export type ResponseMessage = FsListResponse | FsReadResponse | FsWriteResponse | FsCreateResponse | FsDeleteResponse | FsSearchResponse | FsReplaceResponse | GitStatusResponse | GitBranchesResponse | GitBranchCreateResponse | GitCheckoutResponse | GitStageResponse | GitUnstageResponse | GitCommitResponse | GitPushResponse | GitPullResponse | GitFileBaseResponse | GitDiscardResponse | GitDiffResponse | AgentSessionsListResponse | AgentSessionNewResponse | AgentMessageResponse | MachinesListResponse | ProjectsListResponse | ProjectCreateResponse | ProjectDeleteResponse | TerminalCreateResponse | PermissionReplyResponse | ErrorResponse;
|
|
795
|
+
export type EventMessage = FsChangedEvent | CommandOutputEvent | TerminalStdoutEvent | TerminalExitEvent | CommandExitEvent | AgentEventMessage | CredentialPromptEvent | SseEventMessage;
|
|
796
|
+
export type Message = RequestMessage | ResponseMessage | EventMessage | DaemonRegisterMessage | ProjectAddedMessage | ProjectRemovedMessage;
|
|
797
|
+
/** Validate that value looks like an fs_list request */
|
|
798
|
+
export declare function isFsListRequest(value: unknown): value is FsListRequest;
|
|
799
|
+
/** Validate that value looks like an fs_read request */
|
|
800
|
+
export declare function isFsReadRequest(value: unknown): value is FsReadRequest;
|
|
801
|
+
/** Validate that value looks like a git_status request */
|
|
802
|
+
export declare function isGitStatusRequest(value: unknown): value is GitStatusRequest;
|
|
803
|
+
/** Validate that value looks like an agent_message request */
|
|
804
|
+
export declare function isAgentMessageRequest(value: unknown): value is AgentMessageRequest;
|
|
805
|
+
/** Validate that value looks like an error response */
|
|
806
|
+
export declare function isErrorResponse(value: unknown): value is ErrorResponse;
|
|
807
|
+
/** Validate that value is a valid message (has at least a type field) */
|
|
808
|
+
export declare function isMessage(value: unknown): value is Message;
|
|
809
|
+
/** Validate that value is a request message (has type, requestId, and usually sessionId) */
|
|
810
|
+
export declare function isRequestMessage(value: unknown): value is RequestMessage;
|
|
811
|
+
/** Validate that value is an AgentEvent with type 'init' */
|
|
812
|
+
export declare function isAgentInitEvent(value: unknown): value is Extract<AgentEvent, {
|
|
813
|
+
type: "init";
|
|
814
|
+
}>;
|
|
815
|
+
/** Validate that value is an AgentEvent with type 'done' */
|
|
816
|
+
export declare function isAgentDoneEvent(value: unknown): value is Extract<AgentEvent, {
|
|
817
|
+
type: "done";
|
|
818
|
+
}>;
|
|
819
|
+
/** Validate that value is any valid AgentEvent (has a recognized type) */
|
|
820
|
+
export declare function isAgentEvent(value: unknown): value is AgentEvent;
|
|
821
|
+
//# sourceMappingURL=messages.d.ts.map
|