theclawbay 0.3.80 → 0.3.82

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.
@@ -865,6 +865,8 @@ function powerShellProfilePaths() {
865
865
  }
866
866
  if (!isWslInteropRuntime())
867
867
  return [];
868
+ if (!shouldManageWindowsHostProfilesFromWsl())
869
+ return [];
868
870
  addDocumentsProfiles(resolveWindowsDocumentsDirForHost());
869
871
  addDocumentsProfiles(resolveWindowsPathForHost(node_path_1.default.join(resolveWindowsHomeDirForHost() ?? "", "Documents")));
870
872
  return [...candidates];
@@ -872,6 +874,18 @@ function powerShellProfilePaths() {
872
874
  function isWslInteropRuntime() {
873
875
  return node_os_1.default.platform() === "linux" && Boolean(process.env.WSL_DISTRO_NAME || process.env.WSL_INTEROP);
874
876
  }
877
+ function shouldManageWindowsHostProfilesFromWsl() {
878
+ const mode = (process.env.THECLAWBAY_WINDOWS_PROFILE_MODE ?? "").trim().toLowerCase();
879
+ if (mode === "always")
880
+ return true;
881
+ if (mode === "never")
882
+ return false;
883
+ const home = process.env.HOME?.trim() ?? "";
884
+ const user = process.env.USER?.trim() ?? "";
885
+ if (!home || !user)
886
+ return true;
887
+ return home === node_path_1.default.posix.join("/home", user);
888
+ }
875
889
  function readWindowsCommandStdout(command) {
876
890
  const shell = node_os_1.default.platform() === "win32" ? "powershell.exe" : isWslInteropRuntime() ? "powershell.exe" : null;
877
891
  if (!shell)
@@ -1306,6 +1306,7 @@ async function promptForSetupClients(clients) {
1306
1306
  }
1307
1307
  };
1308
1308
  (0, node_readline_1.emitKeypressEvents)(stdin);
1309
+ stdin.resume();
1309
1310
  if (stdin.isTTY)
1310
1311
  stdin.setRawMode(true);
1311
1312
  stdout.write("\x1b[?25l");
@@ -1358,6 +1359,7 @@ async function promptForCodexConversationMigration() {
1358
1359
  }
1359
1360
  finally {
1360
1361
  rl.close();
1362
+ process.stdin.resume();
1361
1363
  }
1362
1364
  }
1363
1365
  async function resolveCodexConversationMigrationSelection(params) {
@@ -1387,6 +1389,7 @@ async function resolveDeviceLabel(params) {
1387
1389
  }
1388
1390
  finally {
1389
1391
  rl.close();
1392
+ process.stdin.resume();
1390
1393
  }
1391
1394
  }
1392
1395
  async function promptForGroupedModelSelection(params) {
@@ -1548,6 +1551,7 @@ async function promptForGroupedModelSelection(params) {
1548
1551
  resolvePromise = resolve;
1549
1552
  });
1550
1553
  (0, node_readline_1.emitKeypressEvents)(stdin);
1554
+ stdin.resume();
1551
1555
  if (stdin.isTTY)
1552
1556
  stdin.setRawMode(true);
1553
1557
  stdout.write("\x1b[?25l");
@@ -1630,6 +1634,7 @@ async function promptForPrimaryModel(models, defaultModel) {
1630
1634
  resolvePromise = resolve;
1631
1635
  });
1632
1636
  (0, node_readline_1.emitKeypressEvents)(stdin);
1637
+ stdin.resume();
1633
1638
  if (stdin.isTTY)
1634
1639
  stdin.setRawMode(true);
1635
1640
  stdout.write("\x1b[?25l");
@@ -2018,7 +2023,7 @@ function isOpenAiCompatibleSetupModelId(modelId) {
2018
2023
  const trimmed = modelId.trim();
2019
2024
  if (!trimmed)
2020
2025
  return false;
2021
- return !trimmed.startsWith("claude-");
2026
+ return !trimmed.startsWith("claude-") && SUPPORTED_MODEL_IDS.includes(trimmed);
2022
2027
  }
2023
2028
  function formatDotEnvValue(value) {
2024
2029
  return `"${value.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}"`;
@@ -2101,7 +2106,7 @@ async function writeHermesConfig(params) {
2101
2106
  }
2102
2107
  async function resolveModels(backendUrl, apiKey) {
2103
2108
  const { ids, failure } = await fetchBackendModelIds(backendUrl, apiKey);
2104
- const filteredIds = (ids ?? []).filter(isOpenAiCompatibleSetupModelId);
2109
+ const filteredIds = uniqueStrings((ids ?? []).filter(isOpenAiCompatibleSetupModelId));
2105
2110
  const available = new Set(filteredIds);
2106
2111
  let selected = DEFAULT_CODEX_MODEL;
2107
2112
  let note;
@@ -2128,10 +2133,14 @@ async function resolveModels(backendUrl, apiKey) {
2128
2133
  unique.push(modelId);
2129
2134
  };
2130
2135
  pushUnique(selected);
2131
- for (const modelId of DEFAULT_MODELS)
2132
- pushUnique(modelId);
2133
- for (const modelId of filteredIds)
2134
- pushUnique(modelId);
2136
+ if (filteredIds.length > 0) {
2137
+ for (const modelId of filteredIds)
2138
+ pushUnique(modelId);
2139
+ }
2140
+ else {
2141
+ for (const modelId of DEFAULT_MODELS)
2142
+ pushUnique(modelId);
2143
+ }
2135
2144
  return {
2136
2145
  model: selected,
2137
2146
  models: unique.map((modelId) => ({ id: modelId, name: modelDisplayName(modelId) || prettyModelId(modelId) })),
@@ -2560,6 +2569,8 @@ function powerShellProfilePaths() {
2560
2569
  }
2561
2570
  if (!isWslInteropRuntime())
2562
2571
  return [];
2572
+ if (!shouldManageWindowsHostProfilesFromWsl())
2573
+ return [];
2563
2574
  addDocumentsProfiles(resolveWindowsDocumentsDirForHost());
2564
2575
  addDocumentsProfiles(resolveWindowsPathForHost(node_path_1.default.join(resolveWindowsHomeDirForHost() ?? "", "Documents")));
2565
2576
  return [...candidates];
@@ -2567,6 +2578,18 @@ function powerShellProfilePaths() {
2567
2578
  function isWslInteropRuntime() {
2568
2579
  return node_os_1.default.platform() === "linux" && Boolean(process.env.WSL_DISTRO_NAME || process.env.WSL_INTEROP);
2569
2580
  }
2581
+ function shouldManageWindowsHostProfilesFromWsl() {
2582
+ const mode = (process.env.THECLAWBAY_WINDOWS_PROFILE_MODE ?? "").trim().toLowerCase();
2583
+ if (mode === "always")
2584
+ return true;
2585
+ if (mode === "never")
2586
+ return false;
2587
+ const home = process.env.HOME?.trim() ?? "";
2588
+ const user = process.env.USER?.trim() ?? "";
2589
+ if (!home || !user)
2590
+ return true;
2591
+ return home === node_path_1.default.posix.join("/home", user);
2592
+ }
2570
2593
  function readWindowsCommandStdout(command) {
2571
2594
  const shell = node_os_1.default.platform() === "win32" ? "powershell.exe" : isWslInteropRuntime() ? "powershell.exe" : null;
2572
2595
  if (!shell)
@@ -3803,6 +3826,7 @@ class SetupCommand extends base_command_1.BaseCommand {
3803
3826
  this.log(` - ${modelId}${marker}`);
3804
3827
  }
3805
3828
  }
3829
+ return;
3806
3830
  }
3807
3831
  const claudeSelected = selectedSetupClients.has("claude");
3808
3832
  const claudeEnvEnabled = claudeSelected && claudeAccess.enabled;
@@ -30,6 +30,21 @@ function shellRcTargets() {
30
30
  kind: "file",
31
31
  }));
32
32
  }
33
+ function codexTargets() {
34
+ return [
35
+ ["codex-config", "Codex config", node_path_1.default.join(paths_1.codexDir, "config.toml"), "file"],
36
+ ["codex-auth", "Codex auth state", node_path_1.default.join(paths_1.codexDir, "auth.json"), "file"],
37
+ ["codex-credentials", "Codex credentials", node_path_1.default.join(paths_1.codexDir, ".credentials.json"), "file"],
38
+ ["codex-accounts", "Codex accounts directory", node_path_1.default.join(paths_1.codexDir, "accounts"), "directory"],
39
+ ["codex-managed", "Codex The Claw Bay managed state", node_path_1.default.join(paths_1.codexDir, "theclawbay.managed.json"), "file"],
40
+ ["codex-model-cache", "Codex model cache", node_path_1.default.join(paths_1.codexDir, "models_cache.json"), "file"],
41
+ ].map(([id, label, targetPath, kind]) => ({
42
+ id,
43
+ label,
44
+ targetPath,
45
+ kind: kind,
46
+ }));
47
+ }
33
48
  function editorSettingsTargets() {
34
49
  const home = node_os_1.default.homedir();
35
50
  const targets = [];
@@ -59,12 +74,6 @@ function backupTargets() {
59
74
  targetPath: paths_1.theclawbayConfigDir,
60
75
  kind: "directory",
61
76
  },
62
- {
63
- id: "codex-home",
64
- label: "Codex home directory",
65
- targetPath: paths_1.codexDir,
66
- kind: "directory",
67
- },
68
77
  {
69
78
  id: "continue-home",
70
79
  label: "Continue config directory",
@@ -127,7 +136,7 @@ function backupTargets() {
127
136
  },
128
137
  ];
129
138
  const deduped = new Map();
130
- for (const target of [...targets, ...shellRcTargets(), ...editorSettingsTargets()]) {
139
+ for (const target of [...targets, ...codexTargets(), ...shellRcTargets(), ...editorSettingsTargets()]) {
131
140
  deduped.set(target.targetPath, target);
132
141
  }
133
142
  return [...deduped.values()];
@@ -174,7 +183,13 @@ function formatBackupTimestamp(isoString) {
174
183
  }
175
184
  async function createBackup(reason) {
176
185
  const now = new Date();
177
- const id = backupIdFromDate(now);
186
+ const baseId = backupIdFromDate(now);
187
+ let id = baseId;
188
+ let suffix = 2;
189
+ while (await pathExists(node_path_1.default.join(paths_1.theclawbayBackupDir, id))) {
190
+ id = `${baseId}-${suffix}`;
191
+ suffix += 1;
192
+ }
178
193
  const backupDirectory = node_path_1.default.join(paths_1.theclawbayBackupDir, id);
179
194
  const snapshotRoot = node_path_1.default.join(backupDirectory, "files");
180
195
  await ensureCleanDirectory(snapshotRoot);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "theclawbay",
3
- "version": "0.3.80",
3
+ "version": "0.3.82",
4
4
  "description": "CLI for connecting Codex, Hermes Agent, Gemini-compatible apps, 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": {