theclawbay 0.3.85 → 0.3.87
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 +25 -6
- package/package.json +1 -1
package/dist/commands/setup.js
CHANGED
|
@@ -3227,6 +3227,14 @@ function buildOpenCodeModelsObject(models) {
|
|
|
3227
3227
|
}
|
|
3228
3228
|
return result;
|
|
3229
3229
|
}
|
|
3230
|
+
function buildClaudeModelSelections(modelIds) {
|
|
3231
|
+
return uniqueStrings(modelIds)
|
|
3232
|
+
.filter(Boolean)
|
|
3233
|
+
.map((modelId) => ({
|
|
3234
|
+
id: modelId,
|
|
3235
|
+
name: prettyModelId(modelId),
|
|
3236
|
+
}));
|
|
3237
|
+
}
|
|
3230
3238
|
function normalizeOpenCodeRestoreSnapshot(snapshot, fallbackConfigPath) {
|
|
3231
3239
|
if (typeof snapshot !== "object" || snapshot === null || Array.isArray(snapshot))
|
|
3232
3240
|
return null;
|
|
@@ -3355,13 +3363,17 @@ function resolveKiloConfigTargets() {
|
|
|
3355
3363
|
node_path_1.default.join(xdgConfigHomeDir(), "kilo");
|
|
3356
3364
|
return uniqueStrings([node_path_1.default.join(primaryDir, "opencode.json")]);
|
|
3357
3365
|
}
|
|
3358
|
-
function isManagedOpenCodeProvider(provider) {
|
|
3366
|
+
function isManagedOpenCodeProvider(provider, backendUrl) {
|
|
3359
3367
|
const options = objectRecordOr(provider.options, {});
|
|
3360
|
-
|
|
3368
|
+
if (isTheClawBayOpenAiCompatibleBaseUrl(options.baseURL))
|
|
3369
|
+
return true;
|
|
3370
|
+
return typeof options.baseURL === "string" && trimTrailingSlash(options.baseURL) === openAiCompatibleProxyUrl(backendUrl);
|
|
3361
3371
|
}
|
|
3362
|
-
function isManagedOpenCodeAnthropicProvider(provider) {
|
|
3372
|
+
function isManagedOpenCodeAnthropicProvider(provider, backendUrl) {
|
|
3363
3373
|
const options = objectRecordOr(provider.options, {});
|
|
3364
|
-
|
|
3374
|
+
if (isTheClawBayAnthropicCompatibleBaseUrl(options.baseURL))
|
|
3375
|
+
return true;
|
|
3376
|
+
return typeof options.baseURL === "string" && trimTrailingSlash(options.baseURL) === anthropicCompatibleProxyV1Url(backendUrl);
|
|
3365
3377
|
}
|
|
3366
3378
|
function isManagedOpenCodeModel(value, supportedModelIds) {
|
|
3367
3379
|
if (typeof value !== "string")
|
|
@@ -3415,7 +3427,7 @@ async function writeOpenCodeFamilyConfig(params) {
|
|
|
3415
3427
|
const providerRoot = objectRecordOr(doc.provider, {});
|
|
3416
3428
|
const openAiProvider = objectRecordOr(providerRoot[OPENAI_PROVIDER_ID], {});
|
|
3417
3429
|
const anthropicProvider = objectRecordOr(providerRoot[ANTHROPIC_PROVIDER_ID], {});
|
|
3418
|
-
const alreadyManaged = isManagedOpenCodeProvider(openAiProvider) && isManagedOpenCodeModel(doc.model, supportedModelIds);
|
|
3430
|
+
const alreadyManaged = isManagedOpenCodeProvider(openAiProvider, params.backendUrl) && isManagedOpenCodeModel(doc.model, supportedModelIds);
|
|
3419
3431
|
if (!alreadyManaged && !restoreHasTarget(configPath)) {
|
|
3420
3432
|
restoreState.targets.push({
|
|
3421
3433
|
configPath,
|
|
@@ -3450,17 +3462,23 @@ async function writeOpenCodeFamilyConfig(params) {
|
|
|
3450
3462
|
}
|
|
3451
3463
|
providerRoot[OPENAI_PROVIDER_ID] = managedOpenAiProvider;
|
|
3452
3464
|
if ((params.claudeModels?.length ?? 0) > 0) {
|
|
3465
|
+
const claudeSelections = buildClaudeModelSelections(params.claudeModels ?? []);
|
|
3453
3466
|
const managedAnthropicProvider = objectRecordOr(providerRoot[ANTHROPIC_PROVIDER_ID], {});
|
|
3454
3467
|
const anthropicOptions = objectRecordOr(managedAnthropicProvider.options, {});
|
|
3455
3468
|
anthropicOptions.baseURL = anthropicCompatibleProxyV1Url(params.backendUrl);
|
|
3456
3469
|
anthropicOptions.apiKey = params.apiKey;
|
|
3470
|
+
anthropicOptions.setCacheKey = true;
|
|
3457
3471
|
managedAnthropicProvider.options = anthropicOptions;
|
|
3458
|
-
managedAnthropicProvider.
|
|
3472
|
+
managedAnthropicProvider.models = buildOpenCodeModelsObject(claudeSelections);
|
|
3473
|
+
managedAnthropicProvider.whitelist = claudeSelections.map((entry) => entry.id);
|
|
3459
3474
|
if ("blacklist" in managedAnthropicProvider) {
|
|
3460
3475
|
delete managedAnthropicProvider.blacklist;
|
|
3461
3476
|
}
|
|
3462
3477
|
providerRoot[ANTHROPIC_PROVIDER_ID] = managedAnthropicProvider;
|
|
3463
3478
|
}
|
|
3479
|
+
else if (isManagedOpenCodeAnthropicProvider(anthropicProvider, params.backendUrl)) {
|
|
3480
|
+
delete providerRoot[ANTHROPIC_PROVIDER_ID];
|
|
3481
|
+
}
|
|
3464
3482
|
if (DEFAULT_PROVIDER_ID in providerRoot) {
|
|
3465
3483
|
delete providerRoot[DEFAULT_PROVIDER_ID];
|
|
3466
3484
|
}
|
|
@@ -3996,6 +4014,7 @@ class SetupCommand extends base_command_1.BaseCommand {
|
|
|
3996
4014
|
backendUrl,
|
|
3997
4015
|
model: resolved?.model ?? DEFAULT_CODEX_MODEL,
|
|
3998
4016
|
models: resolved?.models ?? [{ id: DEFAULT_CODEX_MODEL, name: modelDisplayName(DEFAULT_CODEX_MODEL) }],
|
|
4017
|
+
claudeModels: claudeAccess?.enabled ? (claudeAccess.selectedModels ?? claudeAccess.models) : [],
|
|
3999
4018
|
apiKey: authCredential,
|
|
4000
4019
|
});
|
|
4001
4020
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "theclawbay",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.87",
|
|
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": {
|