theclawbay 0.3.73 → 0.3.75

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.
@@ -29,6 +29,9 @@ const SHELL_START = "# theclawbay-shell-managed:start";
29
29
  const SHELL_END = "# theclawbay-shell-managed:end";
30
30
  const ENV_FILE = node_path_1.default.join(paths_1.theclawbayConfigDir, "env");
31
31
  const ENV_KEY_NAME = "THECLAWBAY_API_KEY";
32
+ const GEMINI_ENV_API_KEY_NAME = "GEMINI_API_KEY";
33
+ const GOOGLE_ENV_API_KEY_NAME = "GOOGLE_API_KEY";
34
+ const GOOGLE_GEMINI_BASE_URL_NAME = "GOOGLE_GEMINI_BASE_URL";
32
35
  const CLAUDE_ENV_API_KEY_NAME = "ANTHROPIC_API_KEY";
33
36
  const CLAUDE_ENV_BASE_URL_NAME = "ANTHROPIC_BASE_URL";
34
37
  const CLAUDE_ENV_SIMPLE_MODE_NAME = "CLAUDE_CODE_SIMPLE";
@@ -63,12 +66,19 @@ const HISTORY_PROVIDER_NEUTRALIZE_SOURCES = new Set([
63
66
  const HISTORY_PROVIDER_DB_MIGRATE_SOURCES = [DEFAULT_PROVIDER_ID, WAN_PROVIDER_ID];
64
67
  const LEGACY_THECLAWBAY_OPENAI_PROXY_SUFFIX = "/api/codex-auth/v1/proxy/v1";
65
68
  const CANONICAL_THECLAWBAY_OPENAI_PROXY_SUFFIX = "/v1";
69
+ const CANONICAL_CODEX_NATIVE_PROXY_SUFFIX = "/backend-api/codex";
66
70
  const THECLAWBAY_CANONICAL_API_HOST = "api.theclawbay.com";
67
71
  const THECLAWBAY_WEBSITE_HOSTS = new Set(["theclawbay.com", "www.theclawbay.com"]);
68
72
  const SUPPORTED_MODEL_IDS = new Set((0, supported_models_1.getSupportedModelIds)());
69
73
  const CONTINUE_MODEL_NAME = "The Claw Bay";
70
74
  const TRAE_PATCH_MARKER = "theclawbay-trae-patch";
71
75
  const TRAE_BUNDLE_BACKUP_SUFFIX = ".theclawbay-managed-backup";
76
+ const MANAGED_EDITOR_TERMINAL_ENV_NAMES = [
77
+ ENV_KEY_NAME,
78
+ GEMINI_ENV_API_KEY_NAME,
79
+ GOOGLE_ENV_API_KEY_NAME,
80
+ GOOGLE_GEMINI_BASE_URL_NAME,
81
+ ];
72
82
  function formatSummaryList(items) {
73
83
  return items.join(", ");
74
84
  }
@@ -133,7 +143,7 @@ function removeTopLevelProviderSelection(source) {
133
143
  filtered.push(line);
134
144
  continue;
135
145
  }
136
- if (match[1] === DEFAULT_PROVIDER_ID)
146
+ if (match[1] === DEFAULT_PROVIDER_ID || match[1] === OPENAI_PROVIDER_ID)
137
147
  continue;
138
148
  filtered.push(line);
139
149
  }
@@ -322,6 +332,21 @@ function isTheClawBayOpenAiCompatibleBaseUrl(value) {
322
332
  return false;
323
333
  }
324
334
  }
335
+ function isTheClawBayCodexNativeBaseUrl(value) {
336
+ if (typeof value !== "string")
337
+ return false;
338
+ const normalized = value.trim();
339
+ if (!normalized)
340
+ return false;
341
+ try {
342
+ const parsed = new URL(normalized);
343
+ return (parsed.hostname.toLowerCase() === THECLAWBAY_CANONICAL_API_HOST &&
344
+ parsed.pathname.replace(/\/+$/g, "") === CANONICAL_CODEX_NATIVE_PROXY_SUFFIX);
345
+ }
346
+ catch {
347
+ return false;
348
+ }
349
+ }
325
350
  function isTheClawBayAnthropicCompatibleBaseUrl(value) {
326
351
  if (typeof value !== "string")
327
352
  return false;
@@ -472,6 +497,7 @@ async function cleanupCodexConfig() {
472
497
  next = removeManagedBlock(next, MANAGED_START, MANAGED_END);
473
498
  next = removeProviderTable(next, DEFAULT_PROVIDER_ID);
474
499
  next = removeTopLevelProviderSelection(next);
500
+ next = removeTopLevelKeyLineIf(next, "openai_base_url", isTheClawBayCodexNativeBaseUrl);
475
501
  next = removeTopLevelKeyLineIf(next, "chatgpt_base_url", isTheClawBayChatgptBaseUrl);
476
502
  return writeIfChanged(configPath, next, existing);
477
503
  }
@@ -1420,6 +1446,9 @@ class LogoutCommand extends base_command_1.BaseCommand {
1420
1446
  throw error;
1421
1447
  }
1422
1448
  delete process.env[ENV_KEY_NAME];
1449
+ delete process.env[GEMINI_ENV_API_KEY_NAME];
1450
+ delete process.env[GOOGLE_ENV_API_KEY_NAME];
1451
+ delete process.env[GOOGLE_GEMINI_BASE_URL_NAME];
1423
1452
  delete process.env[CLAUDE_ENV_API_KEY_NAME];
1424
1453
  delete process.env[CLAUDE_ENV_BASE_URL_NAME];
1425
1454
  delete process.env[CLAUDE_ENV_SIMPLE_MODE_NAME];
@@ -39,6 +39,9 @@ const DEFAULT_ZO_MODEL = DEFAULT_CODEX_MODEL;
39
39
  const DEFAULT_MODELS = [...SUPPORTED_MODEL_IDS];
40
40
  const PREFERRED_MODELS = [...SUPPORTED_MODEL_IDS];
41
41
  const ENV_KEY_NAME = "THECLAWBAY_API_KEY";
42
+ const GEMINI_ENV_API_KEY_NAME = "GEMINI_API_KEY";
43
+ const GOOGLE_ENV_API_KEY_NAME = "GOOGLE_API_KEY";
44
+ const GOOGLE_GEMINI_BASE_URL_NAME = "GOOGLE_GEMINI_BASE_URL";
42
45
  const CLAUDE_ENV_API_KEY_NAME = "ANTHROPIC_API_KEY";
43
46
  const CLAUDE_ENV_BASE_URL_NAME = "ANTHROPIC_BASE_URL";
44
47
  const CLAUDE_ENV_SIMPLE_MODE_NAME = "CLAUDE_CODE_SIMPLE";
@@ -49,6 +52,9 @@ const CLAUDE_CODE_EDITOR_DISABLE_LOGIN_PROMPT_SETTING = "claudeCode.disableLogin
49
52
  const ANTHROPIC_PROVIDER_ID = "anthropic";
50
53
  const MANAGED_EDITOR_TERMINAL_ENV_NAMES = [
51
54
  ENV_KEY_NAME,
55
+ GEMINI_ENV_API_KEY_NAME,
56
+ GOOGLE_ENV_API_KEY_NAME,
57
+ GOOGLE_GEMINI_BASE_URL_NAME,
52
58
  ];
53
59
  const MANAGED_CLAUDE_ENV_NAMES = [
54
60
  CLAUDE_ENV_API_KEY_NAME,
@@ -516,6 +522,35 @@ function upsertTopLevelTableKey(source, tableName, key, tomlValue) {
516
522
  function setTopLevelTableKey(source, tableName, key, tomlValue) {
517
523
  return upsertTopLevelTableKey(source, tableName, key, tomlValue);
518
524
  }
525
+ function getTopLevelTableKeyValue(source, tableName, key) {
526
+ const header = `[${tableName}]`;
527
+ const lines = source.split(/\r?\n/);
528
+ let tableStart = -1;
529
+ for (let i = 0; i < lines.length; i++) {
530
+ if ((lines[i] ?? "").trim() === header) {
531
+ tableStart = i;
532
+ break;
533
+ }
534
+ }
535
+ if (tableStart < 0)
536
+ return null;
537
+ let tableEnd = lines.length;
538
+ for (let i = tableStart + 1; i < lines.length; i++) {
539
+ if (/^\s*\[[^\]]+\]\s*$/.test(lines[i] ?? "")) {
540
+ tableEnd = i;
541
+ break;
542
+ }
543
+ }
544
+ for (let i = tableStart + 1; i < tableEnd; i++) {
545
+ const line = lines[i] ?? "";
546
+ if (/^\s*#/.test(line))
547
+ continue;
548
+ if (!new RegExp(`^\\s*${key}\\s*=`).test(line))
549
+ continue;
550
+ return parseTomlScalarValue(line);
551
+ }
552
+ return null;
553
+ }
519
554
  function removeTopLevelTableKey(source, tableName, key) {
520
555
  const header = `[${tableName}]`;
521
556
  const lines = source.split(/\r?\n/);
@@ -576,6 +611,28 @@ async function restoreManagedCodexFeatureFlags(source) {
576
611
  }
577
612
  return next;
578
613
  }
614
+ async function ensureManagedCodexFeatureFlags(source) {
615
+ const existingSnapshotRaw = await readFileIfExists(CODEX_FEATURE_FLAGS_STATE_PATH);
616
+ if (existingSnapshotRaw === null || !existingSnapshotRaw.trim()) {
617
+ const featuresHeader = "[features]";
618
+ const lines = source.split(/\r?\n/);
619
+ const hadFeaturesTable = lines.some((line) => (line ?? "").trim() === featuresHeader);
620
+ const appsPreviousValue = getTopLevelTableKeyValue(source, "features", "apps");
621
+ const appsMcpGatewayPreviousValue = getTopLevelTableKeyValue(source, "features", "apps_mcp_gateway");
622
+ const snapshot = {
623
+ hadFeaturesTable,
624
+ appsHadKey: appsPreviousValue !== null,
625
+ appsPreviousValue,
626
+ appsMcpGatewayHadKey: appsMcpGatewayPreviousValue !== null,
627
+ appsMcpGatewayPreviousValue,
628
+ };
629
+ await writeJsonObjectFile(CODEX_FEATURE_FLAGS_STATE_PATH, snapshot, 0o600);
630
+ }
631
+ let next = source;
632
+ next = setTopLevelTableKey(next, "features", "apps", "true");
633
+ next = setTopLevelTableKey(next, "features", "apps_mcp_gateway", "true");
634
+ return next;
635
+ }
579
636
  function removeTopLevelKeyLineIf(source, key, shouldRemove) {
580
637
  const lines = source.split(/\r?\n/);
581
638
  const filtered = [];
@@ -646,6 +703,9 @@ function isTheClawBayChatgptBaseUrl(value) {
646
703
  function openAiCompatibleProxyUrl(backendUrl) {
647
704
  return `${publicApiOriginForBackendUrl(backendUrl)}${CANONICAL_THECLAWBAY_OPENAI_PROXY_SUFFIX}`;
648
705
  }
706
+ function geminiCompatibleProxyBaseUrl(backendUrl) {
707
+ return publicApiOriginForBackendUrl(backendUrl);
708
+ }
649
709
  function anthropicCompatibleProxyUrl(backendUrl) {
650
710
  return `${publicApiOriginForBackendUrl(backendUrl)}/anthropic`;
651
711
  }
@@ -1525,6 +1585,7 @@ async function writeCodexConfig(params) {
1525
1585
  const proxyRoot = publicApiOriginForBackendUrl(params.backendUrl);
1526
1586
  const nativeCodexBaseUrl = `${proxyRoot}${CANONICAL_CODEX_NATIVE_PROXY_SUFFIX}`;
1527
1587
  let next = await restoreManagedCodexFeatureFlags(existing);
1588
+ next = await ensureManagedCodexFeatureFlags(next);
1528
1589
  next = removeManagedBlock(next, MANAGED_START, MANAGED_END);
1529
1590
  next = removeProviderTable(next, DEFAULT_PROVIDER_ID);
1530
1591
  next = upsertFirstKeyLine(next, "model_provider", `"${DEFAULT_PROVIDER_ID}"`);
@@ -1789,6 +1850,11 @@ async function persistApiKeyEnv(params) {
1789
1850
  const envLines = [
1790
1851
  "# Generated by theclawbay setup",
1791
1852
  `export ${ENV_KEY_NAME}=${shellQuote(params.apiKey)}`,
1853
+ "",
1854
+ "# Gemini-compatible applications",
1855
+ `export ${GEMINI_ENV_API_KEY_NAME}=${shellQuote(params.apiKey)}`,
1856
+ `export ${GOOGLE_ENV_API_KEY_NAME}=${shellQuote(params.apiKey)}`,
1857
+ `export ${GOOGLE_GEMINI_BASE_URL_NAME}=${shellQuote(geminiCompatibleProxyBaseUrl(params.backendUrl))}`,
1792
1858
  ];
1793
1859
  if (params.claudeEnabled) {
1794
1860
  envLines.push("", "# Official Claude Code CLI", `export ${CLAUDE_ENV_API_KEY_NAME}=${shellQuote(params.apiKey)}`, `export ${CLAUDE_ENV_BASE_URL_NAME}=${shellQuote(anthropicCompatibleProxyUrl(params.backendUrl))}`);
@@ -1823,6 +1889,9 @@ async function persistApiKeyEnv(params) {
1823
1889
  updated.push(rcPath);
1824
1890
  }
1825
1891
  process.env[ENV_KEY_NAME] = params.apiKey;
1892
+ process.env[GEMINI_ENV_API_KEY_NAME] = params.apiKey;
1893
+ process.env[GOOGLE_ENV_API_KEY_NAME] = params.apiKey;
1894
+ process.env[GOOGLE_GEMINI_BASE_URL_NAME] = geminiCompatibleProxyBaseUrl(params.backendUrl);
1826
1895
  if (params.claudeEnabled) {
1827
1896
  process.env[CLAUDE_ENV_API_KEY_NAME] = params.apiKey;
1828
1897
  process.env[CLAUDE_ENV_BASE_URL_NAME] = anthropicCompatibleProxyUrl(params.backendUrl);
@@ -1839,6 +1908,11 @@ async function persistFishEnv(params) {
1839
1908
  const lines = [
1840
1909
  "# Generated by theclawbay setup",
1841
1910
  `set -gx ${ENV_KEY_NAME} ${shellQuote(params.apiKey)}`,
1911
+ "",
1912
+ "# Gemini-compatible applications",
1913
+ `set -gx ${GEMINI_ENV_API_KEY_NAME} ${shellQuote(params.apiKey)}`,
1914
+ `set -gx ${GOOGLE_ENV_API_KEY_NAME} ${shellQuote(params.apiKey)}`,
1915
+ `set -gx ${GOOGLE_GEMINI_BASE_URL_NAME} ${shellQuote(geminiCompatibleProxyBaseUrl(params.backendUrl))}`,
1842
1916
  ];
1843
1917
  if (params.claudeEnabled) {
1844
1918
  lines.push("", "# Official Claude Code CLI", `set -gx ${CLAUDE_ENV_API_KEY_NAME} ${shellQuote(params.apiKey)}`, `set -gx ${CLAUDE_ENV_BASE_URL_NAME} ${shellQuote(anthropicCompatibleProxyUrl(params.backendUrl))}`);
@@ -1922,6 +1996,9 @@ async function persistPowerShellEnv(params) {
1922
1996
  const lines = [
1923
1997
  SHELL_START,
1924
1998
  `$env:${ENV_KEY_NAME} = ${powerShellQuote(params.apiKey)}`,
1999
+ `$env:${GEMINI_ENV_API_KEY_NAME} = ${powerShellQuote(params.apiKey)}`,
2000
+ `$env:${GOOGLE_ENV_API_KEY_NAME} = ${powerShellQuote(params.apiKey)}`,
2001
+ `$env:${GOOGLE_GEMINI_BASE_URL_NAME} = ${powerShellQuote(geminiCompatibleProxyBaseUrl(params.backendUrl))}`,
1925
2002
  ];
1926
2003
  if (params.claudeEnabled) {
1927
2004
  lines.push(`$env:${CLAUDE_ENV_API_KEY_NAME} = ${powerShellQuote(params.apiKey)}`, `$env:${CLAUDE_ENV_BASE_URL_NAME} = ${powerShellQuote(anthropicCompatibleProxyUrl(params.backendUrl))}`);
@@ -1971,6 +2048,9 @@ function terminalIntegratedEnvSettingsKey() {
1971
2048
  function buildManagedEditorTerminalEnv(params) {
1972
2049
  return {
1973
2050
  [ENV_KEY_NAME]: params.apiKey,
2051
+ [GEMINI_ENV_API_KEY_NAME]: params.apiKey,
2052
+ [GOOGLE_ENV_API_KEY_NAME]: params.apiKey,
2053
+ [GOOGLE_GEMINI_BASE_URL_NAME]: geminiCompatibleProxyBaseUrl(params.backendUrl),
1974
2054
  };
1975
2055
  }
1976
2056
  function buildManagedClaudeEditorEnv(params) {
@@ -2461,10 +2541,6 @@ function buildOpenCodeModelConfig(model) {
2461
2541
  input: ["text", "image"],
2462
2542
  output: ["text"],
2463
2543
  },
2464
- options: {
2465
- include: ["reasoning.encrypted_content"],
2466
- store: false,
2467
- },
2468
2544
  limit: {
2469
2545
  context: modelContextLimit(model.id),
2470
2546
  output: modelOutputLimit(model.id),
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "theclawbay",
3
- "version": "0.3.73",
4
- "description": "CLI for connecting Codex, Continue, Cline, GSD, OpenClaw, OpenCode, Kilo, Roo Code, Aider, experimental Trae, and experimental Zo to The Claw Bay.",
3
+ "version": "0.3.75",
4
+ "description": "CLI for connecting Codex, 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": {
7
7
  "type": "git",
8
- "url": "https://github.com/RCRTCBHAL900/TheClawBay"
8
+ "url": "git+https://github.com/RCRTCBHAL900/TheClawBay.git"
9
9
  },
10
10
  "bin": {
11
11
  "theclawbay": "dist/index.js"
@@ -33,6 +33,7 @@
33
33
  ],
34
34
  "keywords": [
35
35
  "codex",
36
+ "gemini",
36
37
  "claw-bay",
37
38
  "cli",
38
39
  "setup",
@@ -53,6 +53,15 @@
53
53
  "cachedInputPer1M": 0.175,
54
54
  "outputPer1M": 14.0
55
55
  },
56
+ {
57
+ "id": "codex-auto-review",
58
+ "label": "Codex Auto Review",
59
+ "note": "Compatibility alias for Codex IDE auto-review flows.",
60
+ "tone": "ink",
61
+ "inputPer1M": 1.75,
62
+ "cachedInputPer1M": 0.175,
63
+ "outputPer1M": 14.0
64
+ },
56
65
  {
57
66
  "id": "gpt-5.2-codex",
58
67
  "label": "GPT-5.2 Codex",
@@ -88,5 +97,59 @@
88
97
  "inputPer1M": 0.25,
89
98
  "cachedInputPer1M": 0.025,
90
99
  "outputPer1M": 2.0
100
+ },
101
+ {
102
+ "id": "gemini-2.5-pro",
103
+ "label": "Gemini 2.5 Pro",
104
+ "note": "Google's flagship coding and reasoning model through CliRelay.",
105
+ "tone": "coral",
106
+ "inputPer1M": 1.25,
107
+ "cachedInputPer1M": 0.125,
108
+ "outputPer1M": 10.0
109
+ },
110
+ {
111
+ "id": "gemini-2.5-flash",
112
+ "label": "Gemini 2.5 Flash",
113
+ "note": "Balanced Gemini path for fast multimodal and agentic work.",
114
+ "tone": "ink",
115
+ "inputPer1M": 0.3,
116
+ "cachedInputPer1M": 0.03,
117
+ "outputPer1M": 2.5
118
+ },
119
+ {
120
+ "id": "gemini-2.5-flash-lite",
121
+ "label": "Gemini 2.5 Flash Lite",
122
+ "note": "Lowest-cost Gemini path for lightweight coding and tooling loops.",
123
+ "tone": "sea",
124
+ "inputPer1M": 0.1,
125
+ "cachedInputPer1M": 0.01,
126
+ "outputPer1M": 0.4
127
+ },
128
+ {
129
+ "id": "gemini-3-pro-preview",
130
+ "label": "Gemini 3 Pro Preview",
131
+ "note": "Preview Gemini model for heavier multimodal and coding sessions.",
132
+ "tone": "coral",
133
+ "inputPer1M": 2.0,
134
+ "cachedInputPer1M": 0.2,
135
+ "outputPer1M": 12.0
136
+ },
137
+ {
138
+ "id": "gemini-3.1-pro-preview",
139
+ "label": "Gemini 3.1 Pro Preview",
140
+ "note": "Newest Gemini Pro preview with stronger agentic and coding behavior.",
141
+ "tone": "coral",
142
+ "inputPer1M": 2.0,
143
+ "cachedInputPer1M": 0.2,
144
+ "outputPer1M": 12.0
145
+ },
146
+ {
147
+ "id": "gemini-3-flash-preview",
148
+ "label": "Gemini 3 Flash Preview",
149
+ "note": "Faster Gemini preview tuned for responsive high-volume tasks.",
150
+ "tone": "ink",
151
+ "inputPer1M": 0.5,
152
+ "cachedInputPer1M": 0.05,
153
+ "outputPer1M": 3.0
91
154
  }
92
155
  ]