@ccpocket/bridge 1.55.1 → 1.56.1
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/codex-process.d.ts +1 -0
- package/dist/codex-process.js +42 -0
- package/dist/codex-process.js.map +1 -1
- package/dist/websocket.d.ts +4 -0
- package/dist/websocket.js +49 -13
- package/dist/websocket.js.map +1 -1
- package/package.json +1 -1
package/dist/websocket.js
CHANGED
|
@@ -32,7 +32,7 @@ const CLAUDE_MODELS = [
|
|
|
32
32
|
"claude-sonnet-4-6",
|
|
33
33
|
"claude-haiku-4-6",
|
|
34
34
|
];
|
|
35
|
-
const
|
|
35
|
+
const FALLBACK_CODEX_MODELS = [
|
|
36
36
|
"gpt-5.5",
|
|
37
37
|
"gpt-5.4",
|
|
38
38
|
"gpt-5.4-mini",
|
|
@@ -308,6 +308,8 @@ export class BridgeWebSocketServer {
|
|
|
308
308
|
codexProfiles = [];
|
|
309
309
|
defaultCodexProfile;
|
|
310
310
|
codexProfilesRequest = null;
|
|
311
|
+
codexModels = FALLBACK_CODEX_MODELS;
|
|
312
|
+
codexModelsRequest = null;
|
|
311
313
|
/** FCM token → push notification locale */
|
|
312
314
|
tokenLocales = new Map();
|
|
313
315
|
tokenPrivacyMode = new Map();
|
|
@@ -924,6 +926,7 @@ export class BridgeWebSocketServer {
|
|
|
924
926
|
handleConnection(ws) {
|
|
925
927
|
// Send session list and project history on connect
|
|
926
928
|
void this.refreshCodexProfiles();
|
|
929
|
+
void this.refreshCodexModels();
|
|
927
930
|
this.sendSessionList(ws);
|
|
928
931
|
const projects = this.projectHistory?.getProjects() ?? [];
|
|
929
932
|
this.send(ws, { type: "project_history", projects });
|
|
@@ -1119,6 +1122,9 @@ export class BridgeWebSocketServer {
|
|
|
1119
1122
|
: {}),
|
|
1120
1123
|
}));
|
|
1121
1124
|
this.broadcastSessionList();
|
|
1125
|
+
if (provider === "codex") {
|
|
1126
|
+
void this.refreshCodexModels(projectPath);
|
|
1127
|
+
}
|
|
1122
1128
|
if (autoFallbackUsed) {
|
|
1123
1129
|
this.sendTip(ws, sessionId, "auto_mode_fallback_default", createdSession);
|
|
1124
1130
|
}
|
|
@@ -3982,7 +3988,7 @@ export class BridgeWebSocketServer {
|
|
|
3982
3988
|
sessions,
|
|
3983
3989
|
allowedDirs: this.allowedDirs,
|
|
3984
3990
|
claudeModels: CLAUDE_MODELS,
|
|
3985
|
-
codexModels:
|
|
3991
|
+
codexModels: this.codexModels,
|
|
3986
3992
|
codexProfiles: this.codexProfiles,
|
|
3987
3993
|
defaultCodexProfile: this.defaultCodexProfile,
|
|
3988
3994
|
bridgeVersion: getPackageVersion(),
|
|
@@ -4010,7 +4016,7 @@ export class BridgeWebSocketServer {
|
|
|
4010
4016
|
sessions,
|
|
4011
4017
|
allowedDirs: this.allowedDirs,
|
|
4012
4018
|
claudeModels: CLAUDE_MODELS,
|
|
4013
|
-
codexModels:
|
|
4019
|
+
codexModels: this.codexModels,
|
|
4014
4020
|
codexProfiles: this.codexProfiles,
|
|
4015
4021
|
defaultCodexProfile: this.defaultCodexProfile,
|
|
4016
4022
|
bridgeVersion: getPackageVersion(),
|
|
@@ -4081,6 +4087,38 @@ export class BridgeWebSocketServer {
|
|
|
4081
4087
|
archivedSessionIds: this.archiveStore.archivedIds(),
|
|
4082
4088
|
});
|
|
4083
4089
|
}
|
|
4090
|
+
async refreshCodexModels(projectPath) {
|
|
4091
|
+
if (this.codexModelsRequest)
|
|
4092
|
+
return this.codexModelsRequest;
|
|
4093
|
+
this.codexModelsRequest = this.loadCodexModels(projectPath)
|
|
4094
|
+
.then((models) => {
|
|
4095
|
+
this.codexModels =
|
|
4096
|
+
models.length > 0 ? models : FALLBACK_CODEX_MODELS;
|
|
4097
|
+
this.broadcastSessionList();
|
|
4098
|
+
})
|
|
4099
|
+
.catch((err) => {
|
|
4100
|
+
console.warn(`[ws] Failed to load Codex models: ${err}`);
|
|
4101
|
+
this.codexModels = FALLBACK_CODEX_MODELS;
|
|
4102
|
+
this.broadcastSessionList();
|
|
4103
|
+
})
|
|
4104
|
+
.finally(() => {
|
|
4105
|
+
this.codexModelsRequest = null;
|
|
4106
|
+
});
|
|
4107
|
+
return this.codexModelsRequest;
|
|
4108
|
+
}
|
|
4109
|
+
async loadCodexModels(projectPath) {
|
|
4110
|
+
const process = this.getActiveCodexProcess() ??
|
|
4111
|
+
(await this.createStandaloneCodexProcess(projectPath));
|
|
4112
|
+
const isStandalone = process !== this.getActiveCodexProcess();
|
|
4113
|
+
try {
|
|
4114
|
+
return await process.listAvailableModels();
|
|
4115
|
+
}
|
|
4116
|
+
finally {
|
|
4117
|
+
if (isStandalone) {
|
|
4118
|
+
process.stop();
|
|
4119
|
+
}
|
|
4120
|
+
}
|
|
4121
|
+
}
|
|
4084
4122
|
async refreshCodexProfiles(projectPath) {
|
|
4085
4123
|
if (this.codexProfilesRequest)
|
|
4086
4124
|
return this.codexProfilesRequest;
|
|
@@ -4444,6 +4482,10 @@ export class BridgeWebSocketServer {
|
|
|
4444
4482
|
"core.quotePath=false",
|
|
4445
4483
|
...args,
|
|
4446
4484
|
];
|
|
4485
|
+
const listUntrackedFiles = () => {
|
|
4486
|
+
const out = execFileSync("git", gitArgs("ls-files", "-z", "--others", "--exclude-standard"), { cwd, encoding: "utf-8" });
|
|
4487
|
+
return out.split("\0").filter(Boolean);
|
|
4488
|
+
};
|
|
4447
4489
|
// Staged only: git diff --cached
|
|
4448
4490
|
if (options?.staged) {
|
|
4449
4491
|
execFile("git", gitArgs("diff", "--cached", "--no-color"), execOpts, (err, stdout) => {
|
|
@@ -4460,10 +4502,7 @@ export class BridgeWebSocketServer {
|
|
|
4460
4502
|
// Collect untracked files so they appear in the diff.
|
|
4461
4503
|
let untrackedFiles = [];
|
|
4462
4504
|
try {
|
|
4463
|
-
|
|
4464
|
-
.toString()
|
|
4465
|
-
.trim();
|
|
4466
|
-
untrackedFiles = out ? out.split("\n") : [];
|
|
4505
|
+
untrackedFiles = listUntrackedFiles();
|
|
4467
4506
|
}
|
|
4468
4507
|
catch {
|
|
4469
4508
|
// Ignore errors: non-git directories are handled by git diff callback.
|
|
@@ -4471,7 +4510,7 @@ export class BridgeWebSocketServer {
|
|
|
4471
4510
|
// Temporarily stage untracked files with --intent-to-add.
|
|
4472
4511
|
if (untrackedFiles.length > 0) {
|
|
4473
4512
|
try {
|
|
4474
|
-
execFileSync("git", ["add", "--intent-to-add", ...untrackedFiles], {
|
|
4513
|
+
execFileSync("git", ["add", "--intent-to-add", "--", ...untrackedFiles], {
|
|
4475
4514
|
cwd,
|
|
4476
4515
|
});
|
|
4477
4516
|
}
|
|
@@ -4500,17 +4539,14 @@ export class BridgeWebSocketServer {
|
|
|
4500
4539
|
// All mode (no options): git diff HEAD — shows both staged and unstaged vs HEAD
|
|
4501
4540
|
let untrackedFilesAll = [];
|
|
4502
4541
|
try {
|
|
4503
|
-
|
|
4504
|
-
.toString()
|
|
4505
|
-
.trim();
|
|
4506
|
-
untrackedFilesAll = out ? out.split("\n") : [];
|
|
4542
|
+
untrackedFilesAll = listUntrackedFiles();
|
|
4507
4543
|
}
|
|
4508
4544
|
catch {
|
|
4509
4545
|
// Ignore
|
|
4510
4546
|
}
|
|
4511
4547
|
if (untrackedFilesAll.length > 0) {
|
|
4512
4548
|
try {
|
|
4513
|
-
execFileSync("git", ["add", "--intent-to-add", ...untrackedFilesAll], {
|
|
4549
|
+
execFileSync("git", ["add", "--intent-to-add", "--", ...untrackedFilesAll], {
|
|
4514
4550
|
cwd,
|
|
4515
4551
|
});
|
|
4516
4552
|
}
|