@ccpocket/bridge 1.78.0 → 1.79.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/dist/parser.d.ts +7 -0
- package/dist/parser.js +4 -0
- package/dist/parser.js.map +1 -1
- package/dist/session.d.ts +2 -0
- package/dist/session.js +73 -66
- package/dist/session.js.map +1 -1
- package/dist/websocket.d.ts +0 -1
- package/dist/websocket.js +51 -16
- package/dist/websocket.js.map +1 -1
- package/package.json +1 -1
package/dist/websocket.js
CHANGED
|
@@ -401,11 +401,32 @@ function normalizeNonNegativeLimit(value, fallback) {
|
|
|
401
401
|
? value
|
|
402
402
|
: fallback;
|
|
403
403
|
}
|
|
404
|
+
const FILE_PEEK_MEDIA_TYPES = {
|
|
405
|
+
".wav": { kind: "audio", mimeType: "audio/wav" },
|
|
406
|
+
".mp3": { kind: "audio", mimeType: "audio/mpeg" },
|
|
407
|
+
".m4a": { kind: "audio", mimeType: "audio/mp4" },
|
|
408
|
+
".aac": { kind: "audio", mimeType: "audio/aac" },
|
|
409
|
+
".flac": { kind: "audio", mimeType: "audio/flac" },
|
|
410
|
+
".ogg": { kind: "audio", mimeType: "audio/ogg" },
|
|
411
|
+
".opus": { kind: "audio", mimeType: "audio/ogg" },
|
|
412
|
+
".aif": { kind: "audio", mimeType: "audio/aiff" },
|
|
413
|
+
".aiff": { kind: "audio", mimeType: "audio/aiff" },
|
|
414
|
+
".aifc": { kind: "audio", mimeType: "audio/aiff" },
|
|
415
|
+
".mp4": { kind: "video", mimeType: "video/mp4" },
|
|
416
|
+
".mov": { kind: "video", mimeType: "video/quicktime" },
|
|
417
|
+
".m4v": { kind: "video", mimeType: "video/x-m4v" },
|
|
418
|
+
".webm": { kind: "video", mimeType: "video/webm" },
|
|
419
|
+
".mkv": { kind: "video", mimeType: "video/x-matroska" },
|
|
420
|
+
".avi": { kind: "video", mimeType: "video/x-msvideo" },
|
|
421
|
+
".mpg": { kind: "video", mimeType: "video/mpeg" },
|
|
422
|
+
".mpeg": { kind: "video", mimeType: "video/mpeg" },
|
|
423
|
+
};
|
|
404
424
|
export function downloadMimeType(filePath) {
|
|
405
425
|
const extension = extname(filePath).toLowerCase();
|
|
426
|
+
const mediaType = FILE_PEEK_MEDIA_TYPES[extension];
|
|
427
|
+
if (mediaType)
|
|
428
|
+
return mediaType.mimeType;
|
|
406
429
|
const mimeTypes = {
|
|
407
|
-
".aac": "audio/aac",
|
|
408
|
-
".avi": "video/x-msvideo",
|
|
409
430
|
".bmp": "image/bmp",
|
|
410
431
|
".csv": "text/csv",
|
|
411
432
|
".doc": "application/msword",
|
|
@@ -416,12 +437,7 @@ export function downloadMimeType(filePath) {
|
|
|
416
437
|
".jpeg": "image/jpeg",
|
|
417
438
|
".jpg": "image/jpeg",
|
|
418
439
|
".json": "application/json",
|
|
419
|
-
".m4a": "audio/mp4",
|
|
420
440
|
".md": "text/markdown",
|
|
421
|
-
".mov": "video/quicktime",
|
|
422
|
-
".mp3": "audio/mpeg",
|
|
423
|
-
".mp4": "video/mp4",
|
|
424
|
-
".ogg": "audio/ogg",
|
|
425
441
|
".pdf": "application/pdf",
|
|
426
442
|
".png": "image/png",
|
|
427
443
|
".ppt": "application/vnd.ms-powerpoint",
|
|
@@ -429,8 +445,6 @@ export function downloadMimeType(filePath) {
|
|
|
429
445
|
".svg": "image/svg+xml",
|
|
430
446
|
".tar": "application/x-tar",
|
|
431
447
|
".txt": "text/plain",
|
|
432
|
-
".wav": "audio/wav",
|
|
433
|
-
".webm": "video/webm",
|
|
434
448
|
".webp": "image/webp",
|
|
435
449
|
".xls": "application/vnd.ms-excel",
|
|
436
450
|
".xlsx": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
@@ -3520,6 +3534,25 @@ export class BridgeWebSocketServer {
|
|
|
3520
3534
|
}
|
|
3521
3535
|
break;
|
|
3522
3536
|
}
|
|
3537
|
+
case "get_session_context": {
|
|
3538
|
+
const context = this.sessionManager.summary(msg.sessionId);
|
|
3539
|
+
if (context) {
|
|
3540
|
+
this.send(ws, {
|
|
3541
|
+
type: "session_context",
|
|
3542
|
+
sessionId: msg.sessionId,
|
|
3543
|
+
context: { ...context },
|
|
3544
|
+
});
|
|
3545
|
+
}
|
|
3546
|
+
else {
|
|
3547
|
+
this.send(ws, {
|
|
3548
|
+
type: "error",
|
|
3549
|
+
message: `Session ${msg.sessionId} not found`,
|
|
3550
|
+
errorCode: "session_not_found",
|
|
3551
|
+
sessionId: msg.sessionId,
|
|
3552
|
+
});
|
|
3553
|
+
}
|
|
3554
|
+
break;
|
|
3555
|
+
}
|
|
3523
3556
|
case "resolve_session_link": {
|
|
3524
3557
|
const provider = msg.provider ?? "claude";
|
|
3525
3558
|
const activeSession = this.sessionManager
|
|
@@ -4398,7 +4431,7 @@ export class BridgeWebSocketServer {
|
|
|
4398
4431
|
return;
|
|
4399
4432
|
}
|
|
4400
4433
|
const ext = extname(absPath).toLowerCase();
|
|
4401
|
-
const mediaType =
|
|
4434
|
+
const mediaType = FILE_PEEK_MEDIA_TYPES[ext];
|
|
4402
4435
|
if (mediaType) {
|
|
4403
4436
|
if (!this.mediaStore) {
|
|
4404
4437
|
this.send(ws, {
|
|
@@ -6111,7 +6144,10 @@ export class BridgeWebSocketServer {
|
|
|
6111
6144
|
defaultCodexProfile: this.defaultCodexProfile,
|
|
6112
6145
|
codexAutoReviewDisabled: this.codexAutoReviewDisabled,
|
|
6113
6146
|
bridgeVersion: getPackageVersion(),
|
|
6114
|
-
protocolCapabilities: [
|
|
6147
|
+
protocolCapabilities: [
|
|
6148
|
+
"project_request_correlation_v1",
|
|
6149
|
+
"session_context_v1",
|
|
6150
|
+
],
|
|
6115
6151
|
});
|
|
6116
6152
|
}
|
|
6117
6153
|
sendPromptHistoryStatus(ws) {
|
|
@@ -6144,7 +6180,10 @@ export class BridgeWebSocketServer {
|
|
|
6144
6180
|
defaultCodexProfile: this.defaultCodexProfile,
|
|
6145
6181
|
codexAutoReviewDisabled: this.codexAutoReviewDisabled,
|
|
6146
6182
|
bridgeVersion: getPackageVersion(),
|
|
6147
|
-
protocolCapabilities: [
|
|
6183
|
+
protocolCapabilities: [
|
|
6184
|
+
"project_request_correlation_v1",
|
|
6185
|
+
"session_context_v1",
|
|
6186
|
+
],
|
|
6148
6187
|
});
|
|
6149
6188
|
}
|
|
6150
6189
|
broadcastPromptHistoryStatus() {
|
|
@@ -7168,10 +7207,6 @@ export class BridgeWebSocketServer {
|
|
|
7168
7207
|
".webp",
|
|
7169
7208
|
".svg",
|
|
7170
7209
|
]);
|
|
7171
|
-
static FILE_PEEK_MEDIA_TYPES = {
|
|
7172
|
-
".wav": { kind: "audio", mimeType: "audio/wav" },
|
|
7173
|
-
".mp4": { kind: "video", mimeType: "video/mp4" },
|
|
7174
|
-
};
|
|
7175
7210
|
// Image diff thresholds (configurable via environment variables)
|
|
7176
7211
|
// - Auto-display: images ≤ threshold are sent inline as base64
|
|
7177
7212
|
// - Max size: images ≤ max are available for on-demand loading
|