@ccpocket/bridge 1.75.0 → 1.77.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/README.md +3 -0
- package/dist/index.js +36 -6
- package/dist/index.js.map +1 -1
- package/dist/parser.d.ts +104 -0
- package/dist/parser.js +50 -2
- package/dist/parser.js.map +1 -1
- package/dist/upload-store.d.ts +84 -0
- package/dist/upload-store.js +559 -0
- package/dist/upload-store.js.map +1 -0
- package/dist/websocket.d.ts +9 -0
- package/dist/websocket.js +445 -61
- package/dist/websocket.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -56,6 +56,9 @@ ccpocket-bridge --version
|
|
|
56
56
|
| `BRIDGE_FILE_LIST_MAX_ENTRIES` | `5000` | Maximum file and directory entries returned to a client; non-positive or invalid values use the default |
|
|
57
57
|
| `BRIDGE_FILE_LIST_MAX_BYTES` | `524288` | Maximum serialized path bytes returned in a client file list; non-positive or invalid values use the default |
|
|
58
58
|
| `BRIDGE_FILE_DOWNLOAD_MAX_SIZE_MB` | `512` | Maximum size in MiB for a file downloaded from Explorer; non-positive or invalid values use the default |
|
|
59
|
+
| `BRIDGE_FILE_UPLOAD_MAX_SIZE_MB` | `512` | Maximum size in MiB for one file uploaded from Explorer; non-positive or invalid values use the default |
|
|
60
|
+
| `BRIDGE_FILE_UPLOAD_MAX_RESERVED_MB` | `2048` | Maximum total declared bytes reserved by pending Explorer uploads |
|
|
61
|
+
| `BRIDGE_FILE_UPLOAD_MAX_CONCURRENT` | `4` | Maximum number of Explorer upload bodies received concurrently |
|
|
59
62
|
| `BRIDGE_DELTA_BATCH_MS` | `100` | Milliseconds to batch streaming deltas per connected client; set to `0` to disable batching |
|
|
60
63
|
| `BRIDGE_DELTA_BATCH_MAX_CHARS` | `4096` | Maximum Unicode characters per batched streaming payload; non-positive or invalid values use the default |
|
|
61
64
|
| `DIFF_IMAGE_AUTO_DISPLAY_KB` | `1024` (1 MB) | Auto-display diff images up to this size, in KB |
|
package/dist/index.js
CHANGED
|
@@ -5,6 +5,7 @@ import { setupProxy } from "./proxy.js";
|
|
|
5
5
|
import { BridgeWebSocketServer } from "./websocket.js";
|
|
6
6
|
import { ImageStore } from "./image-store.js";
|
|
7
7
|
import { MediaStore } from "./media-store.js";
|
|
8
|
+
import { UploadStore } from "./upload-store.js";
|
|
8
9
|
import { GalleryStore } from "./gallery-store.js";
|
|
9
10
|
import { printStartupInfo } from "./startup-info.js";
|
|
10
11
|
import { MdnsAdvertiser, shouldAdvertiseMdns } from "./mdns.js";
|
|
@@ -23,6 +24,10 @@ import { listenForStartup } from "./server-listen.js";
|
|
|
23
24
|
function startupErrorMessage(err) {
|
|
24
25
|
return err instanceof Error ? err.message : String(err);
|
|
25
26
|
}
|
|
27
|
+
function positiveEnvInt(name, fallback) {
|
|
28
|
+
const value = Number(process.env[name]);
|
|
29
|
+
return Number.isSafeInteger(value) && value > 0 ? value : fallback;
|
|
30
|
+
}
|
|
26
31
|
export async function startServer() {
|
|
27
32
|
const PORT = parseBridgePort();
|
|
28
33
|
const HOST = process.env.BRIDGE_HOST ?? "0.0.0.0";
|
|
@@ -53,6 +58,12 @@ export async function startServer() {
|
|
|
53
58
|
}
|
|
54
59
|
const imageStore = new ImageStore();
|
|
55
60
|
const mediaStore = new MediaStore();
|
|
61
|
+
const uploadStore = new UploadStore({
|
|
62
|
+
maxReservedBytes: positiveEnvInt("BRIDGE_FILE_UPLOAD_MAX_RESERVED_MB", 2048) *
|
|
63
|
+
1024 *
|
|
64
|
+
1024,
|
|
65
|
+
maxConcurrentReceives: positiveEnvInt("BRIDGE_FILE_UPLOAD_MAX_CONCURRENT", 4),
|
|
66
|
+
});
|
|
56
67
|
const galleryStore = new GalleryStore();
|
|
57
68
|
const projectHistory = new ProjectHistory();
|
|
58
69
|
const debugTraceStore = new DebugTraceStore();
|
|
@@ -97,11 +108,18 @@ export async function startServer() {
|
|
|
97
108
|
const startedAt = Date.now();
|
|
98
109
|
let wsServer = null;
|
|
99
110
|
const httpServer = createServer((req, res) => {
|
|
111
|
+
const defaultBodyDeadline = setTimeout(() => req.destroy(), 5 * 60 * 1000);
|
|
112
|
+
defaultBodyDeadline.unref();
|
|
113
|
+
const clearDefaultBodyDeadline = () => {
|
|
114
|
+
clearTimeout(defaultBodyDeadline);
|
|
115
|
+
};
|
|
116
|
+
req.once("end", clearDefaultBodyDeadline);
|
|
117
|
+
req.once("close", clearDefaultBodyDeadline);
|
|
100
118
|
// CORS headers for Flutter Web clients
|
|
101
119
|
res.setHeader("Access-Control-Allow-Origin", "*");
|
|
102
|
-
res.setHeader("Access-Control-Allow-Methods", "GET, HEAD, POST, DELETE, OPTIONS");
|
|
103
|
-
res.setHeader("Access-Control-Allow-Headers", "Content-Type, Range");
|
|
104
|
-
res.setHeader("Access-Control-Expose-Headers", "Accept-Ranges, Content-Length, Content-Range");
|
|
120
|
+
res.setHeader("Access-Control-Allow-Methods", "GET, HEAD, POST, PUT, DELETE, OPTIONS");
|
|
121
|
+
res.setHeader("Access-Control-Allow-Headers", "Content-Type, Content-Length, Range");
|
|
122
|
+
res.setHeader("Access-Control-Expose-Headers", "Accept-Ranges, Content-Length, Content-Range, X-File-SHA256, X-Received-Bytes");
|
|
105
123
|
if (req.method === "OPTIONS") {
|
|
106
124
|
res.writeHead(204);
|
|
107
125
|
res.end();
|
|
@@ -158,6 +176,9 @@ export async function startServer() {
|
|
|
158
176
|
// Stream local media registered by an authenticated read_file request.
|
|
159
177
|
if (mediaStore.handleRequest(req, res))
|
|
160
178
|
return;
|
|
179
|
+
// Receive files through short-lived capabilities prepared over WebSocket.
|
|
180
|
+
if (uploadStore.handleRequest(req, res, clearDefaultBodyDeadline))
|
|
181
|
+
return;
|
|
161
182
|
// Serve gallery images via GalleryStore (disk-persistent)
|
|
162
183
|
if (galleryStore.handleRequest(req, res))
|
|
163
184
|
return;
|
|
@@ -173,12 +194,16 @@ export async function startServer() {
|
|
|
173
194
|
res.writeHead(404, { "Content-Type": "text/plain" });
|
|
174
195
|
res.end("Not Found");
|
|
175
196
|
});
|
|
197
|
+
// UploadStore applies its own one-hour total and one-minute idle deadlines.
|
|
198
|
+
// Other HTTP requests retain a five-minute total deadline above.
|
|
199
|
+
httpServer.requestTimeout = 60 * 60 * 1000;
|
|
176
200
|
wsServer = new BridgeWebSocketServer({
|
|
177
201
|
server: httpServer,
|
|
178
202
|
apiKey: API_KEY,
|
|
179
203
|
allowedDirs: ALLOWED_DIRS,
|
|
180
204
|
imageStore,
|
|
181
205
|
mediaStore,
|
|
206
|
+
uploadStore,
|
|
182
207
|
galleryStore,
|
|
183
208
|
projectHistory,
|
|
184
209
|
debugTraceStore,
|
|
@@ -187,10 +212,15 @@ export async function startServer() {
|
|
|
187
212
|
promptHistoryBackup,
|
|
188
213
|
promptHistoryStore,
|
|
189
214
|
});
|
|
190
|
-
|
|
215
|
+
let shuttingDown = false;
|
|
216
|
+
async function shutdown() {
|
|
217
|
+
if (shuttingDown)
|
|
218
|
+
return;
|
|
219
|
+
shuttingDown = true;
|
|
191
220
|
console.log("\n[bridge] Shutting down gracefully...");
|
|
192
221
|
mdns?.stop();
|
|
193
222
|
wsServer?.close();
|
|
223
|
+
await uploadStore.dispose();
|
|
194
224
|
httpServer.close();
|
|
195
225
|
process.exit(0);
|
|
196
226
|
}
|
|
@@ -205,8 +235,8 @@ export async function startServer() {
|
|
|
205
235
|
console.log(`[bridge] Ready. Listening on http://${HOST}:${PORT} (HTTP + WebSocket)`);
|
|
206
236
|
mdns?.start(PORT, API_KEY);
|
|
207
237
|
printStartupInfo(PORT, HOST, API_KEY);
|
|
208
|
-
process.on("SIGINT", shutdown);
|
|
209
|
-
process.on("SIGTERM", shutdown);
|
|
238
|
+
process.on("SIGINT", () => void shutdown());
|
|
239
|
+
process.on("SIGTERM", () => void shutdown());
|
|
210
240
|
}
|
|
211
241
|
// Auto-start when executed directly (node dist/index.js, tsx src/index.ts)
|
|
212
242
|
const isDirectExecution = process.argv[1] &&
|
package/dist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;IAEtC,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,KAAK,QAAQ,EAAE,CAAC,CAAC;IAC5C,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,GAAG,EAAE,CAAC,KAAK,QAAQ,EAAE,CAAC,CAAC;AAC/C,CAAC;AAED,2EAA2E;AAC3E,MAAM,iBAAiB,GACrB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IACf,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAErD,IAAI,iBAAiB,EAAE,CAAC;IACtB,UAAU,EAAE,CAAC;IACb,WAAW,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;QAC1B,OAAO,CAAC,KAAK,CAAC,6BAA6B,mBAAmB,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACvE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/dist/parser.d.ts
CHANGED
|
@@ -93,6 +93,7 @@ export type ClientMessage = {
|
|
|
93
93
|
worktreeBranch?: string;
|
|
94
94
|
existingWorktreePath?: string;
|
|
95
95
|
autoRename?: boolean;
|
|
96
|
+
requestId?: string;
|
|
96
97
|
} | {
|
|
97
98
|
type: "input";
|
|
98
99
|
text: string;
|
|
@@ -277,18 +278,37 @@ export type ClientMessage = {
|
|
|
277
278
|
projectPath: string;
|
|
278
279
|
filePath: string;
|
|
279
280
|
maxLines?: number;
|
|
281
|
+
requestId?: string;
|
|
280
282
|
} | {
|
|
281
283
|
type: "read_media_file";
|
|
282
284
|
projectPath: string;
|
|
283
285
|
filePath: string;
|
|
286
|
+
requestId?: string;
|
|
284
287
|
} | {
|
|
285
288
|
type: "prepare_file_download";
|
|
286
289
|
projectPath: string;
|
|
287
290
|
filePath: string;
|
|
288
291
|
requestId: string;
|
|
292
|
+
} | {
|
|
293
|
+
type: "prepare_file_upload";
|
|
294
|
+
projectPath: string;
|
|
295
|
+
directoryPath: string;
|
|
296
|
+
fileName: string;
|
|
297
|
+
sizeBytes: number;
|
|
298
|
+
conflictPolicy: "rename" | "overwrite" | "skip";
|
|
299
|
+
requestId: string;
|
|
300
|
+
} | {
|
|
301
|
+
type: "finalize_file_upload";
|
|
302
|
+
uploadToken: string;
|
|
303
|
+
sha256: string;
|
|
304
|
+
requestId: string;
|
|
305
|
+
} | {
|
|
306
|
+
type: "cancel_file_upload";
|
|
307
|
+
uploadToken: string;
|
|
289
308
|
} | {
|
|
290
309
|
type: "list_files";
|
|
291
310
|
projectPath: string;
|
|
311
|
+
requestId?: string;
|
|
292
312
|
} | {
|
|
293
313
|
type: "list_directory";
|
|
294
314
|
path: string;
|
|
@@ -298,11 +318,13 @@ export type ClientMessage = {
|
|
|
298
318
|
type: "get_diff";
|
|
299
319
|
projectPath: string;
|
|
300
320
|
staged?: boolean;
|
|
321
|
+
requestId?: string;
|
|
301
322
|
} | {
|
|
302
323
|
type: "get_diff_image";
|
|
303
324
|
projectPath: string;
|
|
304
325
|
filePath: string;
|
|
305
326
|
version: "old" | "new" | "both";
|
|
327
|
+
requestId?: string;
|
|
306
328
|
} | {
|
|
307
329
|
type: "interrupt";
|
|
308
330
|
sessionId?: string;
|
|
@@ -314,10 +336,12 @@ export type ClientMessage = {
|
|
|
314
336
|
} | {
|
|
315
337
|
type: "list_worktrees";
|
|
316
338
|
projectPath: string;
|
|
339
|
+
requestId?: string;
|
|
317
340
|
} | {
|
|
318
341
|
type: "remove_worktree";
|
|
319
342
|
projectPath: string;
|
|
320
343
|
worktreePath: string;
|
|
344
|
+
requestId?: string;
|
|
321
345
|
} | {
|
|
322
346
|
type: "rewind";
|
|
323
347
|
sessionId: string;
|
|
@@ -339,6 +363,7 @@ export type ClientMessage = {
|
|
|
339
363
|
windowId?: number;
|
|
340
364
|
projectPath: string;
|
|
341
365
|
sessionId?: string;
|
|
366
|
+
requestId?: string;
|
|
342
367
|
} | {
|
|
343
368
|
type: "get_debug_bundle";
|
|
344
369
|
sessionId: string;
|
|
@@ -408,10 +433,12 @@ export type ClientMessage = {
|
|
|
408
433
|
file: string;
|
|
409
434
|
hunkIndex: number;
|
|
410
435
|
}[];
|
|
436
|
+
requestId?: string;
|
|
411
437
|
} | {
|
|
412
438
|
type: "git_unstage";
|
|
413
439
|
projectPath: string;
|
|
414
440
|
files?: string[];
|
|
441
|
+
requestId?: string;
|
|
415
442
|
} | {
|
|
416
443
|
type: "git_unstage_hunks";
|
|
417
444
|
projectPath: string;
|
|
@@ -419,31 +446,38 @@ export type ClientMessage = {
|
|
|
419
446
|
file: string;
|
|
420
447
|
hunkIndex: number;
|
|
421
448
|
}[];
|
|
449
|
+
requestId?: string;
|
|
422
450
|
} | {
|
|
423
451
|
type: "git_commit";
|
|
424
452
|
projectPath: string;
|
|
425
453
|
sessionId?: string;
|
|
426
454
|
message?: string;
|
|
427
455
|
autoGenerate?: boolean;
|
|
456
|
+
requestId?: string;
|
|
428
457
|
} | {
|
|
429
458
|
type: "git_push";
|
|
430
459
|
projectPath: string;
|
|
460
|
+
requestId?: string;
|
|
431
461
|
} | {
|
|
432
462
|
type: "git_branches";
|
|
433
463
|
projectPath: string;
|
|
464
|
+
requestId?: string;
|
|
434
465
|
} | {
|
|
435
466
|
type: "git_create_branch";
|
|
436
467
|
projectPath: string;
|
|
437
468
|
name: string;
|
|
438
469
|
checkout?: boolean;
|
|
470
|
+
requestId?: string;
|
|
439
471
|
} | {
|
|
440
472
|
type: "git_checkout_branch";
|
|
441
473
|
projectPath: string;
|
|
442
474
|
branch: string;
|
|
475
|
+
requestId?: string;
|
|
443
476
|
} | {
|
|
444
477
|
type: "git_revert_file";
|
|
445
478
|
projectPath: string;
|
|
446
479
|
files: string[];
|
|
480
|
+
requestId?: string;
|
|
447
481
|
} | {
|
|
448
482
|
type: "git_revert_hunks";
|
|
449
483
|
projectPath: string;
|
|
@@ -451,20 +485,25 @@ export type ClientMessage = {
|
|
|
451
485
|
file: string;
|
|
452
486
|
hunkIndex: number;
|
|
453
487
|
}[];
|
|
488
|
+
requestId?: string;
|
|
454
489
|
} | {
|
|
455
490
|
type: "git_fetch";
|
|
456
491
|
projectPath: string;
|
|
492
|
+
requestId?: string;
|
|
457
493
|
} | {
|
|
458
494
|
type: "git_pull";
|
|
459
495
|
projectPath: string;
|
|
496
|
+
requestId?: string;
|
|
460
497
|
} | {
|
|
461
498
|
type: "git_status";
|
|
462
499
|
projectPath: string;
|
|
463
500
|
sessionId?: string;
|
|
464
501
|
includeRemote?: boolean;
|
|
502
|
+
requestId?: string;
|
|
465
503
|
} | {
|
|
466
504
|
type: "git_remote_status";
|
|
467
505
|
projectPath: string;
|
|
506
|
+
requestId?: string;
|
|
468
507
|
};
|
|
469
508
|
/** Image change detected in a git diff (binary image file). */
|
|
470
509
|
export interface ImageChange {
|
|
@@ -560,6 +599,7 @@ export type ServerMessage = {
|
|
|
560
599
|
clearContext?: boolean;
|
|
561
600
|
sourceSessionId?: string;
|
|
562
601
|
resumeRequestId?: string;
|
|
602
|
+
requestId?: string;
|
|
563
603
|
tipCode?: string;
|
|
564
604
|
codexCliJoin?: CodexCliJoinTarget;
|
|
565
605
|
} | {
|
|
@@ -670,6 +710,8 @@ export type ServerMessage = {
|
|
|
670
710
|
text: string;
|
|
671
711
|
} | {
|
|
672
712
|
type: "file_content";
|
|
713
|
+
projectPath?: string;
|
|
714
|
+
requestId?: string;
|
|
673
715
|
filePath: string;
|
|
674
716
|
kind?: "text" | "image" | "audio" | "video";
|
|
675
717
|
content: string;
|
|
@@ -683,9 +725,12 @@ export type ServerMessage = {
|
|
|
683
725
|
mediaUrl?: string;
|
|
684
726
|
} | {
|
|
685
727
|
type: "file_list";
|
|
728
|
+
projectPath?: string;
|
|
729
|
+
requestId?: string;
|
|
686
730
|
files: string[];
|
|
687
731
|
totalFiles?: number;
|
|
688
732
|
truncated?: boolean;
|
|
733
|
+
error?: string;
|
|
689
734
|
} | {
|
|
690
735
|
type: "file_download_ready";
|
|
691
736
|
requestId: string;
|
|
@@ -694,6 +739,21 @@ export type ServerMessage = {
|
|
|
694
739
|
mimeType: string;
|
|
695
740
|
sizeBytes: number;
|
|
696
741
|
downloadUrl: string;
|
|
742
|
+
} | {
|
|
743
|
+
type: "file_upload_ready";
|
|
744
|
+
requestId: string;
|
|
745
|
+
fileName: string;
|
|
746
|
+
sizeBytes: number;
|
|
747
|
+
uploadUrl: string;
|
|
748
|
+
uploadToken: string;
|
|
749
|
+
} | {
|
|
750
|
+
type: "file_upload_complete";
|
|
751
|
+
requestId: string;
|
|
752
|
+
filePath: string;
|
|
753
|
+
fileName: string;
|
|
754
|
+
sizeBytes: number;
|
|
755
|
+
sha256: string;
|
|
756
|
+
skipped: boolean;
|
|
697
757
|
} | {
|
|
698
758
|
type: "project_history";
|
|
699
759
|
projects: string[];
|
|
@@ -716,12 +776,17 @@ export type ServerMessage = {
|
|
|
716
776
|
requestId?: string;
|
|
717
777
|
} | {
|
|
718
778
|
type: "diff_result";
|
|
779
|
+
projectPath?: string;
|
|
780
|
+
requestId?: string;
|
|
781
|
+
staged?: boolean;
|
|
719
782
|
diff: string;
|
|
720
783
|
error?: string;
|
|
721
784
|
errorCode?: string;
|
|
722
785
|
imageChanges?: ImageChange[];
|
|
723
786
|
} | {
|
|
724
787
|
type: "diff_image_result";
|
|
788
|
+
projectPath?: string;
|
|
789
|
+
requestId?: string;
|
|
725
790
|
filePath: string;
|
|
726
791
|
version: "old" | "new" | "both";
|
|
727
792
|
base64?: string;
|
|
@@ -731,17 +796,24 @@ export type ServerMessage = {
|
|
|
731
796
|
newBase64?: string;
|
|
732
797
|
} | {
|
|
733
798
|
type: "worktree_list";
|
|
799
|
+
projectPath?: string;
|
|
800
|
+
requestId?: string;
|
|
734
801
|
worktrees: WorktreeInfo[];
|
|
735
802
|
mainBranch?: string;
|
|
803
|
+
error?: string;
|
|
736
804
|
} | {
|
|
737
805
|
type: "worktree_removed";
|
|
806
|
+
projectPath?: string;
|
|
807
|
+
requestId?: string;
|
|
738
808
|
worktreePath: string;
|
|
809
|
+
error?: string;
|
|
739
810
|
} | {
|
|
740
811
|
type: "tool_use_summary";
|
|
741
812
|
summary: string;
|
|
742
813
|
precedingToolUseIds: string[];
|
|
743
814
|
} | {
|
|
744
815
|
type: "rewind_preview";
|
|
816
|
+
sessionId?: string;
|
|
745
817
|
canRewind: boolean;
|
|
746
818
|
filesChanged?: string[];
|
|
747
819
|
insertions?: number;
|
|
@@ -749,6 +821,7 @@ export type ServerMessage = {
|
|
|
749
821
|
error?: string;
|
|
750
822
|
} | {
|
|
751
823
|
type: "rewind_result";
|
|
824
|
+
sessionId?: string;
|
|
752
825
|
success: boolean;
|
|
753
826
|
mode: "conversation" | "code" | "both";
|
|
754
827
|
error?: string;
|
|
@@ -767,6 +840,9 @@ export type ServerMessage = {
|
|
|
767
840
|
windows: WindowInfo[];
|
|
768
841
|
} | {
|
|
769
842
|
type: "screenshot_result";
|
|
843
|
+
projectPath?: string;
|
|
844
|
+
sessionId?: string;
|
|
845
|
+
requestId?: string;
|
|
770
846
|
success: boolean;
|
|
771
847
|
image?: GalleryImageInfo;
|
|
772
848
|
error?: string;
|
|
@@ -858,28 +934,40 @@ export type ServerMessage = {
|
|
|
858
934
|
error?: string;
|
|
859
935
|
} | {
|
|
860
936
|
type: "git_stage_result";
|
|
937
|
+
projectPath?: string;
|
|
938
|
+
requestId?: string;
|
|
861
939
|
success: boolean;
|
|
862
940
|
error?: string;
|
|
863
941
|
} | {
|
|
864
942
|
type: "git_unstage_result";
|
|
943
|
+
projectPath?: string;
|
|
944
|
+
requestId?: string;
|
|
865
945
|
success: boolean;
|
|
866
946
|
error?: string;
|
|
867
947
|
} | {
|
|
868
948
|
type: "git_unstage_hunks_result";
|
|
949
|
+
projectPath?: string;
|
|
950
|
+
requestId?: string;
|
|
869
951
|
success: boolean;
|
|
870
952
|
error?: string;
|
|
871
953
|
} | {
|
|
872
954
|
type: "git_commit_result";
|
|
955
|
+
projectPath?: string;
|
|
956
|
+
requestId?: string;
|
|
873
957
|
success: boolean;
|
|
874
958
|
commitHash?: string;
|
|
875
959
|
message?: string;
|
|
876
960
|
error?: string;
|
|
877
961
|
} | {
|
|
878
962
|
type: "git_push_result";
|
|
963
|
+
projectPath?: string;
|
|
964
|
+
requestId?: string;
|
|
879
965
|
success: boolean;
|
|
880
966
|
error?: string;
|
|
881
967
|
} | {
|
|
882
968
|
type: "git_branches_result";
|
|
969
|
+
projectPath?: string;
|
|
970
|
+
requestId?: string;
|
|
883
971
|
current: string;
|
|
884
972
|
branches: string[];
|
|
885
973
|
checkedOutBranches?: string[];
|
|
@@ -891,26 +979,38 @@ export type ServerMessage = {
|
|
|
891
979
|
error?: string;
|
|
892
980
|
} | {
|
|
893
981
|
type: "git_create_branch_result";
|
|
982
|
+
projectPath?: string;
|
|
983
|
+
requestId?: string;
|
|
894
984
|
success: boolean;
|
|
895
985
|
error?: string;
|
|
896
986
|
} | {
|
|
897
987
|
type: "git_checkout_branch_result";
|
|
988
|
+
projectPath?: string;
|
|
989
|
+
requestId?: string;
|
|
898
990
|
success: boolean;
|
|
899
991
|
error?: string;
|
|
900
992
|
} | {
|
|
901
993
|
type: "git_revert_file_result";
|
|
994
|
+
projectPath?: string;
|
|
995
|
+
requestId?: string;
|
|
902
996
|
success: boolean;
|
|
903
997
|
error?: string;
|
|
904
998
|
} | {
|
|
905
999
|
type: "git_revert_hunks_result";
|
|
1000
|
+
projectPath?: string;
|
|
1001
|
+
requestId?: string;
|
|
906
1002
|
success: boolean;
|
|
907
1003
|
error?: string;
|
|
908
1004
|
} | {
|
|
909
1005
|
type: "git_fetch_result";
|
|
1006
|
+
projectPath?: string;
|
|
1007
|
+
requestId?: string;
|
|
910
1008
|
success: boolean;
|
|
911
1009
|
error?: string;
|
|
912
1010
|
} | {
|
|
913
1011
|
type: "git_pull_result";
|
|
1012
|
+
projectPath?: string;
|
|
1013
|
+
requestId?: string;
|
|
914
1014
|
success: boolean;
|
|
915
1015
|
message?: string;
|
|
916
1016
|
error?: string;
|
|
@@ -918,6 +1018,7 @@ export type ServerMessage = {
|
|
|
918
1018
|
type: "git_status_result";
|
|
919
1019
|
sessionId?: string;
|
|
920
1020
|
projectPath: string;
|
|
1021
|
+
requestId?: string;
|
|
921
1022
|
hasUncommittedChanges: boolean;
|
|
922
1023
|
stagedCount: number;
|
|
923
1024
|
unstagedCount: number;
|
|
@@ -932,10 +1033,13 @@ export type ServerMessage = {
|
|
|
932
1033
|
error?: string;
|
|
933
1034
|
} | {
|
|
934
1035
|
type: "git_remote_status_result";
|
|
1036
|
+
projectPath?: string;
|
|
1037
|
+
requestId?: string;
|
|
935
1038
|
ahead: number;
|
|
936
1039
|
behind: number;
|
|
937
1040
|
branch: string;
|
|
938
1041
|
hasUpstream: boolean;
|
|
1042
|
+
error?: string;
|
|
939
1043
|
};
|
|
940
1044
|
export interface UsageWindowPayload {
|
|
941
1045
|
utilization: number;
|
package/dist/parser.js
CHANGED
|
@@ -106,6 +106,11 @@ export function parseClientMessage(data) {
|
|
|
106
106
|
const msg = JSON.parse(data);
|
|
107
107
|
if (!msg.type || typeof msg.type !== "string")
|
|
108
108
|
return null;
|
|
109
|
+
if (msg.requestId !== undefined &&
|
|
110
|
+
(typeof msg.requestId !== "string" ||
|
|
111
|
+
msg.requestId.trim().length === 0 ||
|
|
112
|
+
msg.requestId.length > GALLERY_MAX_REQUEST_ID_LENGTH))
|
|
113
|
+
return null;
|
|
109
114
|
const hasOnlyKeys = (allowedKeys) => {
|
|
110
115
|
const allowed = new Set(allowedKeys);
|
|
111
116
|
return Object.keys(msg).every((key) => allowed.has(key));
|
|
@@ -460,6 +465,48 @@ export function parseClientMessage(data) {
|
|
|
460
465
|
msg.requestId.length > GALLERY_MAX_REQUEST_ID_LENGTH)
|
|
461
466
|
return null;
|
|
462
467
|
break;
|
|
468
|
+
case "prepare_file_upload":
|
|
469
|
+
if (!hasOnlyKeys([
|
|
470
|
+
"type",
|
|
471
|
+
"projectPath",
|
|
472
|
+
"directoryPath",
|
|
473
|
+
"fileName",
|
|
474
|
+
"sizeBytes",
|
|
475
|
+
"conflictPolicy",
|
|
476
|
+
"requestId",
|
|
477
|
+
]) ||
|
|
478
|
+
typeof msg.projectPath !== "string" ||
|
|
479
|
+
msg.projectPath.trim().length === 0 ||
|
|
480
|
+
typeof msg.directoryPath !== "string" ||
|
|
481
|
+
typeof msg.fileName !== "string" ||
|
|
482
|
+
msg.fileName.length === 0 ||
|
|
483
|
+
msg.fileName.length > 255 ||
|
|
484
|
+
typeof msg.sizeBytes !== "number" ||
|
|
485
|
+
!Number.isSafeInteger(msg.sizeBytes) ||
|
|
486
|
+
msg.sizeBytes < 0 ||
|
|
487
|
+
!["rename", "overwrite", "skip"].includes(msg.conflictPolicy) ||
|
|
488
|
+
typeof msg.requestId !== "string" ||
|
|
489
|
+
msg.requestId.trim().length === 0 ||
|
|
490
|
+
msg.requestId.length > GALLERY_MAX_REQUEST_ID_LENGTH)
|
|
491
|
+
return null;
|
|
492
|
+
break;
|
|
493
|
+
case "finalize_file_upload":
|
|
494
|
+
if (!hasOnlyKeys(["type", "uploadToken", "sha256", "requestId"]) ||
|
|
495
|
+
typeof msg.uploadToken !== "string" ||
|
|
496
|
+
!/^[a-f0-9]{48}$/.test(msg.uploadToken) ||
|
|
497
|
+
typeof msg.sha256 !== "string" ||
|
|
498
|
+
!/^[a-f0-9]{64}$/i.test(msg.sha256) ||
|
|
499
|
+
typeof msg.requestId !== "string" ||
|
|
500
|
+
msg.requestId.trim().length === 0 ||
|
|
501
|
+
msg.requestId.length > GALLERY_MAX_REQUEST_ID_LENGTH)
|
|
502
|
+
return null;
|
|
503
|
+
break;
|
|
504
|
+
case "cancel_file_upload":
|
|
505
|
+
if (!hasOnlyKeys(["type", "uploadToken"]) ||
|
|
506
|
+
typeof msg.uploadToken !== "string" ||
|
|
507
|
+
!/^[a-f0-9]{48}$/.test(msg.uploadToken))
|
|
508
|
+
return null;
|
|
509
|
+
break;
|
|
463
510
|
case "list_files":
|
|
464
511
|
if (typeof msg.projectPath !== "string")
|
|
465
512
|
return null;
|
|
@@ -674,6 +721,7 @@ export function parseClientMessage(data) {
|
|
|
674
721
|
"sessionId",
|
|
675
722
|
"message",
|
|
676
723
|
"autoGenerate",
|
|
724
|
+
"requestId",
|
|
677
725
|
]))
|
|
678
726
|
return null;
|
|
679
727
|
if (typeof msg.projectPath !== "string")
|
|
@@ -687,13 +735,13 @@ export function parseClientMessage(data) {
|
|
|
687
735
|
return null;
|
|
688
736
|
break;
|
|
689
737
|
case "git_push":
|
|
690
|
-
if (!hasOnlyKeys(["type", "projectPath"]))
|
|
738
|
+
if (!hasOnlyKeys(["type", "projectPath", "requestId"]))
|
|
691
739
|
return null;
|
|
692
740
|
if (typeof msg.projectPath !== "string")
|
|
693
741
|
return null;
|
|
694
742
|
break;
|
|
695
743
|
case "git_branches":
|
|
696
|
-
if (!hasOnlyKeys(["type", "projectPath"]))
|
|
744
|
+
if (!hasOnlyKeys(["type", "projectPath", "requestId"]))
|
|
697
745
|
return null;
|
|
698
746
|
if (typeof msg.projectPath !== "string")
|
|
699
747
|
return null;
|