theclawbay 0.3.63 → 0.3.64
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/commands/setup.js
CHANGED
|
@@ -2986,7 +2986,7 @@ class SetupCommand extends base_command_1.BaseCommand {
|
|
|
2986
2986
|
let restoredClaudeDesktop3pConfig = false;
|
|
2987
2987
|
let claudeDesktop3pConfigPathManaged = null;
|
|
2988
2988
|
let sessionMigration = null;
|
|
2989
|
-
let
|
|
2989
|
+
let authSeedResult = null;
|
|
2990
2990
|
let stateDbMigration = null;
|
|
2991
2991
|
let modelCacheMigration = null;
|
|
2992
2992
|
let continueConfigPath = null;
|
|
@@ -3088,8 +3088,10 @@ class SetupCommand extends base_command_1.BaseCommand {
|
|
|
3088
3088
|
neutralizeSources: HISTORY_PROVIDER_NEUTRALIZE_SOURCES,
|
|
3089
3089
|
});
|
|
3090
3090
|
}
|
|
3091
|
-
|
|
3091
|
+
authSeedResult = await (0, codex_auth_seeding_1.ensureCodexApiKeyAuth)({
|
|
3092
3092
|
codexHome: paths_1.codexDir,
|
|
3093
|
+
apiKey: authCredential,
|
|
3094
|
+
replaceExistingAuth: true,
|
|
3093
3095
|
});
|
|
3094
3096
|
if (migrateCodexConversations) {
|
|
3095
3097
|
stateDbMigration = await (0, codex_history_migration_1.migrateStateDbProviders)({
|
|
@@ -3229,13 +3231,11 @@ class SetupCommand extends base_command_1.BaseCommand {
|
|
|
3229
3231
|
}
|
|
3230
3232
|
if (modelCacheMigration?.warning)
|
|
3231
3233
|
summaryNotes.add(modelCacheMigration.warning);
|
|
3232
|
-
if (
|
|
3233
|
-
summaryNotes.add(
|
|
3234
|
-
if (
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
else if (authSeedCleanup?.action === "restored_backup") {
|
|
3238
|
-
summaryNotes.add("Restored the Codex auth that existed before an older The Claw Bay auth override.");
|
|
3234
|
+
if (authSeedResult?.warning)
|
|
3235
|
+
summaryNotes.add(authSeedResult.warning);
|
|
3236
|
+
if (authSeedResult &&
|
|
3237
|
+
["seeded", "updated", "already_seeded"].includes(authSeedResult.action)) {
|
|
3238
|
+
summaryNotes.add("Codex desktop clients were pinned to local API-key auth so current VS Code and Codex app builds keep the The Claw Bay model picker instead of falling back to OpenAI's default model catalog.");
|
|
3239
3239
|
}
|
|
3240
3240
|
if (selectedSetupClients.has("codex") && !migrateCodexConversations) {
|
|
3241
3241
|
summaryNotes.add("Left existing Codex conversations untouched.");
|
|
@@ -3338,17 +3338,22 @@ class SetupCommand extends base_command_1.BaseCommand {
|
|
|
3338
3338
|
else if (modelCacheMigration) {
|
|
3339
3339
|
this.log("- Codex model cache: no change.");
|
|
3340
3340
|
}
|
|
3341
|
-
if (
|
|
3342
|
-
this.log(
|
|
3341
|
+
if (authSeedResult?.action === "seeded") {
|
|
3342
|
+
this.log(authSeedResult.replacedExistingAuth
|
|
3343
|
+
? "- Codex login state: backed up the existing Codex auth and switched local desktop auth to The Claw Bay API-key mode."
|
|
3344
|
+
: "- Codex login state: seeded local desktop auth in The Claw Bay API-key mode.");
|
|
3345
|
+
}
|
|
3346
|
+
else if (authSeedResult?.action === "updated") {
|
|
3347
|
+
this.log("- Codex login state: refreshed the local The Claw Bay API-key auth seed.");
|
|
3343
3348
|
}
|
|
3344
|
-
else if (
|
|
3345
|
-
this.log("- Codex login state:
|
|
3349
|
+
else if (authSeedResult?.action === "already_seeded") {
|
|
3350
|
+
this.log("- Codex login state: local desktop auth was already pinned to The Claw Bay API-key mode.");
|
|
3346
3351
|
}
|
|
3347
|
-
else if (
|
|
3348
|
-
this.log(`- Codex login state: ${
|
|
3352
|
+
else if (authSeedResult?.warning) {
|
|
3353
|
+
this.log(`- Codex login state: ${authSeedResult.warning}`);
|
|
3349
3354
|
}
|
|
3350
3355
|
else {
|
|
3351
|
-
this.log("- Codex login state:
|
|
3356
|
+
this.log("- Codex login state: no change.");
|
|
3352
3357
|
}
|
|
3353
3358
|
}
|
|
3354
3359
|
else if (codexDetected) {
|
|
@@ -12,10 +12,12 @@ export type CleanupCodexAuthResult = {
|
|
|
12
12
|
export declare function ensureCodexApiKeyAuth(params: {
|
|
13
13
|
codexHome: string;
|
|
14
14
|
apiKey: string;
|
|
15
|
+
replaceExistingAuth?: boolean;
|
|
15
16
|
}): Promise<EnsureCodexAuthResult>;
|
|
16
17
|
export declare function ensureCodexUsageLimitAuth(params: {
|
|
17
18
|
codexHome: string;
|
|
18
19
|
apiKey: string;
|
|
20
|
+
replaceExistingAuth?: boolean;
|
|
19
21
|
}): Promise<EnsureCodexAuthResult>;
|
|
20
22
|
export declare function cleanupSeededCodexAuth(params: {
|
|
21
23
|
codexHome: string;
|
|
@@ -236,7 +236,7 @@ async function ensureCodexApiKeyAuth(params) {
|
|
|
236
236
|
codexHome: params.codexHome,
|
|
237
237
|
apiKey: params.apiKey,
|
|
238
238
|
mode: "api-key",
|
|
239
|
-
replaceExistingAuth: false,
|
|
239
|
+
replaceExistingAuth: params.replaceExistingAuth ?? false,
|
|
240
240
|
});
|
|
241
241
|
}
|
|
242
242
|
async function ensureCodexUsageLimitAuth(params) {
|
|
@@ -265,6 +265,159 @@ function runVersionCommand(command, args) {
|
|
|
265
265
|
return null;
|
|
266
266
|
return parseCodexVersion(`${run.stdout ?? ""}\n${run.stderr ?? ""}`);
|
|
267
267
|
}
|
|
268
|
+
function compareCodexVersions(left, right) {
|
|
269
|
+
const leftParts = left.split(".").map((part) => Number.parseInt(part, 10));
|
|
270
|
+
const rightParts = right.split(".").map((part) => Number.parseInt(part, 10));
|
|
271
|
+
const maxLen = Math.max(leftParts.length, rightParts.length);
|
|
272
|
+
for (let index = 0; index < maxLen; index += 1) {
|
|
273
|
+
const leftPart = leftParts[index] ?? 0;
|
|
274
|
+
const rightPart = rightParts[index] ?? 0;
|
|
275
|
+
if (leftPart !== rightPart)
|
|
276
|
+
return leftPart - rightPart;
|
|
277
|
+
}
|
|
278
|
+
return 0;
|
|
279
|
+
}
|
|
280
|
+
function highestCodexVersion(candidates) {
|
|
281
|
+
const versions = candidates
|
|
282
|
+
.map((candidate) => (candidate ? parseCodexVersion(candidate) : null))
|
|
283
|
+
.filter((candidate) => Boolean(candidate));
|
|
284
|
+
if (versions.length === 0)
|
|
285
|
+
return null;
|
|
286
|
+
versions.sort((left, right) => compareCodexVersions(right, left));
|
|
287
|
+
return versions[0] ?? null;
|
|
288
|
+
}
|
|
289
|
+
function uniqueStrings(values) {
|
|
290
|
+
return Array.from(new Set(values.filter(Boolean)));
|
|
291
|
+
}
|
|
292
|
+
function isWslInteropRuntime() {
|
|
293
|
+
return node_os_1.default.platform() === "linux" && Boolean(process.env.WSL_DISTRO_NAME || process.env.WSL_INTEROP);
|
|
294
|
+
}
|
|
295
|
+
function readWindowsCommandStdout(command) {
|
|
296
|
+
const shell = node_os_1.default.platform() === "win32" ? "powershell.exe" : isWslInteropRuntime() ? "powershell.exe" : null;
|
|
297
|
+
if (!shell)
|
|
298
|
+
return null;
|
|
299
|
+
const result = (0, node_child_process_1.spawnSync)(shell, ["-NoProfile", "-Command", command], {
|
|
300
|
+
encoding: "utf8",
|
|
301
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
302
|
+
});
|
|
303
|
+
if (result.status !== 0)
|
|
304
|
+
return null;
|
|
305
|
+
const next = result.stdout.replace(/\r/g, "").trim();
|
|
306
|
+
return next ? next : null;
|
|
307
|
+
}
|
|
308
|
+
function resolveWindowsPathForHost(input) {
|
|
309
|
+
if (!input)
|
|
310
|
+
return null;
|
|
311
|
+
const trimmed = input.trim();
|
|
312
|
+
if (!trimmed)
|
|
313
|
+
return null;
|
|
314
|
+
if (node_os_1.default.platform() === "win32")
|
|
315
|
+
return trimmed;
|
|
316
|
+
const match = /^([A-Za-z]):\\(.*)$/.exec(trimmed);
|
|
317
|
+
if (!match)
|
|
318
|
+
return null;
|
|
319
|
+
const drive = match[1].toLowerCase();
|
|
320
|
+
const rest = match[2].replace(/\\/g, "/");
|
|
321
|
+
return node_path_1.default.posix.join("/mnt", drive, rest);
|
|
322
|
+
}
|
|
323
|
+
function resolveWindowsHomeDirForHost() {
|
|
324
|
+
const reported = readWindowsCommandStdout("$env:USERPROFILE");
|
|
325
|
+
if (reported)
|
|
326
|
+
return resolveWindowsPathForHost(reported);
|
|
327
|
+
if (node_os_1.default.platform() === "win32")
|
|
328
|
+
return node_os_1.default.homedir();
|
|
329
|
+
return null;
|
|
330
|
+
}
|
|
331
|
+
function editorExtensionDirCandidates() {
|
|
332
|
+
const home = node_os_1.default.homedir();
|
|
333
|
+
const dirs = [];
|
|
334
|
+
if (node_os_1.default.platform() === "darwin") {
|
|
335
|
+
dirs.push(node_path_1.default.join(home, ".vscode", "extensions"), node_path_1.default.join(home, ".vscode-insiders", "extensions"), node_path_1.default.join(home, ".cursor", "extensions"), node_path_1.default.join(home, ".windsurf", "extensions"), node_path_1.default.join(home, ".vscode-oss", "extensions"));
|
|
336
|
+
return uniqueStrings(dirs);
|
|
337
|
+
}
|
|
338
|
+
if (node_os_1.default.platform() === "win32") {
|
|
339
|
+
const homeDir = process.env.USERPROFILE?.trim() || home;
|
|
340
|
+
dirs.push(node_path_1.default.join(homeDir, ".vscode", "extensions"), node_path_1.default.join(homeDir, ".vscode-insiders", "extensions"), node_path_1.default.join(homeDir, ".cursor", "extensions"), node_path_1.default.join(homeDir, ".windsurf", "extensions"), node_path_1.default.join(homeDir, ".vscode-oss", "extensions"));
|
|
341
|
+
return uniqueStrings(dirs);
|
|
342
|
+
}
|
|
343
|
+
dirs.push(node_path_1.default.join(home, ".vscode", "extensions"), node_path_1.default.join(home, ".vscode-insiders", "extensions"), node_path_1.default.join(home, ".cursor", "extensions"), node_path_1.default.join(home, ".windsurf", "extensions"), node_path_1.default.join(home, ".vscode-oss", "extensions"));
|
|
344
|
+
if (isWslInteropRuntime()) {
|
|
345
|
+
const windowsHome = resolveWindowsHomeDirForHost();
|
|
346
|
+
if (windowsHome) {
|
|
347
|
+
dirs.push(node_path_1.default.join(windowsHome, ".vscode", "extensions"), node_path_1.default.join(windowsHome, ".vscode-insiders", "extensions"), node_path_1.default.join(windowsHome, ".cursor", "extensions"), node_path_1.default.join(windowsHome, ".windsurf", "extensions"), node_path_1.default.join(windowsHome, ".vscode-oss", "extensions"));
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
return uniqueStrings(dirs);
|
|
351
|
+
}
|
|
352
|
+
async function pathExists(filePath) {
|
|
353
|
+
try {
|
|
354
|
+
await promises_1.default.access(filePath);
|
|
355
|
+
return true;
|
|
356
|
+
}
|
|
357
|
+
catch {
|
|
358
|
+
return false;
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
function codexBinaryCandidatesForBinRoot(binRoot) {
|
|
362
|
+
const runtimePreferred = node_os_1.default.platform() === "win32"
|
|
363
|
+
? [
|
|
364
|
+
node_path_1.default.join(binRoot, "windows-x86_64", "codex.exe"),
|
|
365
|
+
node_path_1.default.join(binRoot, "windows-arm64", "codex.exe"),
|
|
366
|
+
]
|
|
367
|
+
: node_os_1.default.platform() === "darwin"
|
|
368
|
+
? [
|
|
369
|
+
node_path_1.default.join(binRoot, "darwin-aarch64", "codex"),
|
|
370
|
+
node_path_1.default.join(binRoot, "darwin-arm64", "codex"),
|
|
371
|
+
node_path_1.default.join(binRoot, "darwin-x86_64", "codex"),
|
|
372
|
+
]
|
|
373
|
+
: [
|
|
374
|
+
node_path_1.default.join(binRoot, "linux-x86_64", "codex"),
|
|
375
|
+
node_path_1.default.join(binRoot, "linux-arm64", "codex"),
|
|
376
|
+
];
|
|
377
|
+
return uniqueStrings([
|
|
378
|
+
...runtimePreferred,
|
|
379
|
+
node_path_1.default.join(binRoot, "codex"),
|
|
380
|
+
node_path_1.default.join(binRoot, "codex.exe"),
|
|
381
|
+
]);
|
|
382
|
+
}
|
|
383
|
+
async function inferCodexClientVersionsFromInstalledExtensions() {
|
|
384
|
+
const versions = new Set();
|
|
385
|
+
for (const extensionDir of editorExtensionDirCandidates()) {
|
|
386
|
+
let entries = [];
|
|
387
|
+
try {
|
|
388
|
+
entries = await promises_1.default.readdir(extensionDir, { withFileTypes: true });
|
|
389
|
+
}
|
|
390
|
+
catch (error) {
|
|
391
|
+
const err = error;
|
|
392
|
+
if (err.code === "ENOENT")
|
|
393
|
+
continue;
|
|
394
|
+
throw error;
|
|
395
|
+
}
|
|
396
|
+
for (const entry of entries) {
|
|
397
|
+
if (!entry.isDirectory())
|
|
398
|
+
continue;
|
|
399
|
+
if (!entry.name.toLowerCase().startsWith("openai.chatgpt-"))
|
|
400
|
+
continue;
|
|
401
|
+
const binRoot = node_path_1.default.join(extensionDir, entry.name, "bin");
|
|
402
|
+
for (const candidate of codexBinaryCandidatesForBinRoot(binRoot)) {
|
|
403
|
+
if (!(await pathExists(candidate)))
|
|
404
|
+
continue;
|
|
405
|
+
const parsed = runVersionCommand(candidate, ["--version"]);
|
|
406
|
+
if (parsed)
|
|
407
|
+
versions.add(parsed);
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
return [...versions];
|
|
412
|
+
}
|
|
413
|
+
async function inferCodexClientVersionFromVersionJson(codexHome) {
|
|
414
|
+
const parsed = await readJsonIfExists(node_path_1.default.join(codexHome, "version.json"));
|
|
415
|
+
const obj = objectRecordOr(parsed);
|
|
416
|
+
if (!obj)
|
|
417
|
+
return null;
|
|
418
|
+
const latestVersion = typeof obj.latest_version === "string" ? obj.latest_version : "";
|
|
419
|
+
return latestVersion ? parseCodexVersion(latestVersion) : null;
|
|
420
|
+
}
|
|
268
421
|
function resolvePythonCommand() {
|
|
269
422
|
const candidates = [
|
|
270
423
|
{ command: "python3", args: ["-c", "import sqlite3"] },
|
|
@@ -355,20 +508,29 @@ async function inferCodexClientVersionFromStateDb(codexHome) {
|
|
|
355
508
|
return null;
|
|
356
509
|
}
|
|
357
510
|
async function inferCodexClientVersion(codexHome) {
|
|
511
|
+
const versions = [];
|
|
358
512
|
if (node_os_1.default.platform() === "win32") {
|
|
359
513
|
for (const commandLine of ["codex --version", "codex-cli --version", "codex.cmd --version", "codex-cli.cmd --version"]) {
|
|
360
514
|
const parsed = runVersionCommand("cmd.exe", ["/d", "/s", "/c", commandLine]);
|
|
361
515
|
if (parsed)
|
|
362
|
-
|
|
516
|
+
versions.push(parsed);
|
|
363
517
|
}
|
|
364
|
-
return await inferCodexClientVersionFromStateDb(codexHome);
|
|
365
518
|
}
|
|
366
|
-
|
|
367
|
-
const
|
|
368
|
-
|
|
369
|
-
|
|
519
|
+
else {
|
|
520
|
+
for (const command of ["codex", "codex-cli"]) {
|
|
521
|
+
const parsed = runVersionCommand(command, ["--version"]);
|
|
522
|
+
if (parsed)
|
|
523
|
+
versions.push(parsed);
|
|
524
|
+
}
|
|
370
525
|
}
|
|
371
|
-
|
|
526
|
+
versions.push(...await inferCodexClientVersionsFromInstalledExtensions());
|
|
527
|
+
const versionJsonVersion = await inferCodexClientVersionFromVersionJson(codexHome);
|
|
528
|
+
if (versionJsonVersion)
|
|
529
|
+
versions.push(versionJsonVersion);
|
|
530
|
+
const stateDbVersion = await inferCodexClientVersionFromStateDb(codexHome);
|
|
531
|
+
if (stateDbVersion)
|
|
532
|
+
versions.push(stateDbVersion);
|
|
533
|
+
return highestCodexVersion(versions);
|
|
372
534
|
}
|
|
373
535
|
function normalizeCacheDocument(value) {
|
|
374
536
|
const doc = objectRecordOr(value);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "theclawbay",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.64",
|
|
4
4
|
"description": "CLI for connecting Codex, Continue, Cline, GSD, OpenClaw, OpenCode, Kilo, Roo Code, Aider, experimental Trae, and experimental Zo to The Claw Bay.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|