theclawbay 0.3.72 → 0.3.74
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 +69 -3
- package/package.json +1 -1
package/dist/commands/setup.js
CHANGED
|
@@ -85,7 +85,7 @@ const SHELL_START = "# theclawbay-shell-managed:start";
|
|
|
85
85
|
const SHELL_END = "# theclawbay-shell-managed:end";
|
|
86
86
|
const OPENCLAW_PROVIDER_ID = DEFAULT_PROVIDER_ID;
|
|
87
87
|
const HISTORY_PROVIDER_NEUTRALIZE_SOURCES = new Set(["openai", "theclawbay-wan", DEFAULT_PROVIDER_ID]);
|
|
88
|
-
const HISTORY_PROVIDER_DB_MIGRATE_SOURCES = ["openai", "theclawbay-wan"];
|
|
88
|
+
const HISTORY_PROVIDER_DB_MIGRATE_SOURCES = ["openai", DEFAULT_PROVIDER_ID, "theclawbay-wan"];
|
|
89
89
|
const SETUP_CLIENT_IDS = ["codex", "claude", "continue", "cline", "gsd", "openclaw", "opencode", "kilo", "roo", "trae", "aider", "zo"];
|
|
90
90
|
const LEGACY_THECLAWBAY_OPENAI_PROXY_SUFFIX = "/api/codex-auth/v1/proxy/v1";
|
|
91
91
|
const CANONICAL_THECLAWBAY_OPENAI_PROXY_SUFFIX = "/v1";
|
|
@@ -516,6 +516,35 @@ function upsertTopLevelTableKey(source, tableName, key, tomlValue) {
|
|
|
516
516
|
function setTopLevelTableKey(source, tableName, key, tomlValue) {
|
|
517
517
|
return upsertTopLevelTableKey(source, tableName, key, tomlValue);
|
|
518
518
|
}
|
|
519
|
+
function getTopLevelTableKeyValue(source, tableName, key) {
|
|
520
|
+
const header = `[${tableName}]`;
|
|
521
|
+
const lines = source.split(/\r?\n/);
|
|
522
|
+
let tableStart = -1;
|
|
523
|
+
for (let i = 0; i < lines.length; i++) {
|
|
524
|
+
if ((lines[i] ?? "").trim() === header) {
|
|
525
|
+
tableStart = i;
|
|
526
|
+
break;
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
if (tableStart < 0)
|
|
530
|
+
return null;
|
|
531
|
+
let tableEnd = lines.length;
|
|
532
|
+
for (let i = tableStart + 1; i < lines.length; i++) {
|
|
533
|
+
if (/^\s*\[[^\]]+\]\s*$/.test(lines[i] ?? "")) {
|
|
534
|
+
tableEnd = i;
|
|
535
|
+
break;
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
for (let i = tableStart + 1; i < tableEnd; i++) {
|
|
539
|
+
const line = lines[i] ?? "";
|
|
540
|
+
if (/^\s*#/.test(line))
|
|
541
|
+
continue;
|
|
542
|
+
if (!new RegExp(`^\\s*${key}\\s*=`).test(line))
|
|
543
|
+
continue;
|
|
544
|
+
return parseTomlScalarValue(line);
|
|
545
|
+
}
|
|
546
|
+
return null;
|
|
547
|
+
}
|
|
519
548
|
function removeTopLevelTableKey(source, tableName, key) {
|
|
520
549
|
const header = `[${tableName}]`;
|
|
521
550
|
const lines = source.split(/\r?\n/);
|
|
@@ -576,6 +605,28 @@ async function restoreManagedCodexFeatureFlags(source) {
|
|
|
576
605
|
}
|
|
577
606
|
return next;
|
|
578
607
|
}
|
|
608
|
+
async function ensureManagedCodexFeatureFlags(source) {
|
|
609
|
+
const existingSnapshotRaw = await readFileIfExists(CODEX_FEATURE_FLAGS_STATE_PATH);
|
|
610
|
+
if (existingSnapshotRaw === null || !existingSnapshotRaw.trim()) {
|
|
611
|
+
const featuresHeader = "[features]";
|
|
612
|
+
const lines = source.split(/\r?\n/);
|
|
613
|
+
const hadFeaturesTable = lines.some((line) => (line ?? "").trim() === featuresHeader);
|
|
614
|
+
const appsPreviousValue = getTopLevelTableKeyValue(source, "features", "apps");
|
|
615
|
+
const appsMcpGatewayPreviousValue = getTopLevelTableKeyValue(source, "features", "apps_mcp_gateway");
|
|
616
|
+
const snapshot = {
|
|
617
|
+
hadFeaturesTable,
|
|
618
|
+
appsHadKey: appsPreviousValue !== null,
|
|
619
|
+
appsPreviousValue,
|
|
620
|
+
appsMcpGatewayHadKey: appsMcpGatewayPreviousValue !== null,
|
|
621
|
+
appsMcpGatewayPreviousValue,
|
|
622
|
+
};
|
|
623
|
+
await writeJsonObjectFile(CODEX_FEATURE_FLAGS_STATE_PATH, snapshot, 0o600);
|
|
624
|
+
}
|
|
625
|
+
let next = source;
|
|
626
|
+
next = setTopLevelTableKey(next, "features", "apps", "true");
|
|
627
|
+
next = setTopLevelTableKey(next, "features", "apps_mcp_gateway", "true");
|
|
628
|
+
return next;
|
|
629
|
+
}
|
|
579
630
|
function removeTopLevelKeyLineIf(source, key, shouldRemove) {
|
|
580
631
|
const lines = source.split(/\r?\n/);
|
|
581
632
|
const filtered = [];
|
|
@@ -1525,14 +1576,25 @@ async function writeCodexConfig(params) {
|
|
|
1525
1576
|
const proxyRoot = publicApiOriginForBackendUrl(params.backendUrl);
|
|
1526
1577
|
const nativeCodexBaseUrl = `${proxyRoot}${CANONICAL_CODEX_NATIVE_PROXY_SUFFIX}`;
|
|
1527
1578
|
let next = await restoreManagedCodexFeatureFlags(existing);
|
|
1579
|
+
next = await ensureManagedCodexFeatureFlags(next);
|
|
1528
1580
|
next = removeManagedBlock(next, MANAGED_START, MANAGED_END);
|
|
1529
1581
|
next = removeProviderTable(next, DEFAULT_PROVIDER_ID);
|
|
1530
|
-
next = upsertFirstKeyLine(next, "model_provider", `"${
|
|
1582
|
+
next = upsertFirstKeyLine(next, "model_provider", `"${DEFAULT_PROVIDER_ID}"`);
|
|
1531
1583
|
next = upsertFirstKeyLine(next, "model", `"${params.model}"`);
|
|
1532
1584
|
next = upsertFirstKeyLine(next, "openai_base_url", `"${nativeCodexBaseUrl}"`);
|
|
1533
1585
|
next = removeTopLevelKeyLineIf(next, "chatgpt_base_url", isTheClawBayChatgptBaseUrl);
|
|
1534
1586
|
const managedBlock = appendManagedBlock("", [
|
|
1535
1587
|
MANAGED_START,
|
|
1588
|
+
`[plugins."computer-use@openai-bundled"]`,
|
|
1589
|
+
"enabled = true",
|
|
1590
|
+
"",
|
|
1591
|
+
`[model_providers.${DEFAULT_PROVIDER_ID}]`,
|
|
1592
|
+
'name = "The Claw Bay (OpenAI compatible)"',
|
|
1593
|
+
`base_url = "${nativeCodexBaseUrl}"`,
|
|
1594
|
+
'wire_api = "responses"',
|
|
1595
|
+
"requires_openai_auth = false",
|
|
1596
|
+
"supports_websockets = false",
|
|
1597
|
+
`experimental_bearer_token = "${params.apiKey}"`,
|
|
1536
1598
|
MANAGED_END,
|
|
1537
1599
|
]);
|
|
1538
1600
|
next = appendManagedBlock(next, managedBlock.trimEnd().split("\n"));
|
|
@@ -2451,6 +2513,10 @@ function buildOpenCodeModelConfig(model) {
|
|
|
2451
2513
|
input: ["text", "image"],
|
|
2452
2514
|
output: ["text"],
|
|
2453
2515
|
},
|
|
2516
|
+
options: {
|
|
2517
|
+
include: ["reasoning.encrypted_content"],
|
|
2518
|
+
store: false,
|
|
2519
|
+
},
|
|
2454
2520
|
limit: {
|
|
2455
2521
|
context: modelContextLimit(model.id),
|
|
2456
2522
|
output: modelOutputLimit(model.id),
|
|
@@ -3089,7 +3155,7 @@ class SetupCommand extends base_command_1.BaseCommand {
|
|
|
3089
3155
|
if (migrateCodexConversations) {
|
|
3090
3156
|
stateDbMigration = await (0, codex_history_migration_1.migrateStateDbProviders)({
|
|
3091
3157
|
codexHome: paths_1.codexDir,
|
|
3092
|
-
targetProvider:
|
|
3158
|
+
targetProvider: DEFAULT_PROVIDER_ID,
|
|
3093
3159
|
sourceProviders: HISTORY_PROVIDER_DB_MIGRATE_SOURCES,
|
|
3094
3160
|
});
|
|
3095
3161
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "theclawbay",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.74",
|
|
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": {
|