theclawbay 0.3.34 → 0.3.35
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/logout.js +18 -0
- package/dist/commands/setup.js +36 -1
- package/package.json +1 -1
package/dist/commands/logout.js
CHANGED
|
@@ -521,6 +521,11 @@ function normalizeOpenCodeRestoreSnapshot(snapshot, fallbackConfigPath) {
|
|
|
521
521
|
: null,
|
|
522
522
|
model: typeof candidate.model === "string" ? candidate.model : null,
|
|
523
523
|
schema: typeof candidate.schema === "string" ? candidate.schema : null,
|
|
524
|
+
plugin: "plugin" in candidate
|
|
525
|
+
? Array.isArray(candidate.plugin)
|
|
526
|
+
? candidate.plugin
|
|
527
|
+
: null
|
|
528
|
+
: undefined,
|
|
524
529
|
});
|
|
525
530
|
}
|
|
526
531
|
return { version: 2, targets };
|
|
@@ -539,6 +544,7 @@ function normalizeOpenCodeRestoreSnapshot(snapshot, fallbackConfigPath) {
|
|
|
539
544
|
: null,
|
|
540
545
|
model: typeof obj.model === "string" ? obj.model : null,
|
|
541
546
|
schema: typeof obj.schema === "string" ? obj.schema : null,
|
|
547
|
+
plugin: undefined,
|
|
542
548
|
},
|
|
543
549
|
],
|
|
544
550
|
};
|
|
@@ -581,6 +587,18 @@ async function cleanupOpenCodeFamilyConfigs(params) {
|
|
|
581
587
|
delete providerRoot[DEFAULT_PROVIDER_ID];
|
|
582
588
|
changed = true;
|
|
583
589
|
}
|
|
590
|
+
if (Object.prototype.hasOwnProperty.call(target, "plugin")) {
|
|
591
|
+
if (target.plugin === null) {
|
|
592
|
+
if ("plugin" in doc) {
|
|
593
|
+
delete doc.plugin;
|
|
594
|
+
changed = true;
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
else {
|
|
598
|
+
doc.plugin = target.plugin;
|
|
599
|
+
changed = true;
|
|
600
|
+
}
|
|
601
|
+
}
|
|
584
602
|
if (target.openAiProvider) {
|
|
585
603
|
providerRoot[OPENAI_PROVIDER_ID] = target.openAiProvider;
|
|
586
604
|
}
|
package/dist/commands/setup.js
CHANGED
|
@@ -1204,6 +1204,22 @@ function openCodeConfigFileCandidates() {
|
|
|
1204
1204
|
candidates.push(node_path_1.default.join(home, ".opencode.json"));
|
|
1205
1205
|
return uniqueStrings(candidates);
|
|
1206
1206
|
}
|
|
1207
|
+
function isOpenCodeAuthPlugin(value) {
|
|
1208
|
+
if (typeof value !== "string")
|
|
1209
|
+
return false;
|
|
1210
|
+
const normalized = value.trim();
|
|
1211
|
+
if (!normalized)
|
|
1212
|
+
return false;
|
|
1213
|
+
return normalized.startsWith("opencode-openai-codex-auth");
|
|
1214
|
+
}
|
|
1215
|
+
function filteredOpenCodePlugins(value) {
|
|
1216
|
+
if (!Array.isArray(value))
|
|
1217
|
+
return { next: value, changed: false };
|
|
1218
|
+
const filtered = value.filter((entry) => !isOpenCodeAuthPlugin(entry));
|
|
1219
|
+
if (filtered.length === value.length)
|
|
1220
|
+
return { next: value, changed: false };
|
|
1221
|
+
return { next: filtered, changed: true };
|
|
1222
|
+
}
|
|
1207
1223
|
function kiloConfigFileCandidates() {
|
|
1208
1224
|
const home = node_os_1.default.homedir();
|
|
1209
1225
|
const dirs = uniqueStrings([...configDirCandidates("kilo"), node_path_1.default.join(home, ".kilo")]);
|
|
@@ -1252,6 +1268,16 @@ async function writeOpenCodeFamilyConfig(params) {
|
|
|
1252
1268
|
};
|
|
1253
1269
|
const supportedModelIds = new Set(params.models.map((entry) => entry.id).filter(Boolean));
|
|
1254
1270
|
const restoreHasTarget = (configPath) => restoreState.targets.some((entry) => entry.configPath === configPath);
|
|
1271
|
+
let restoreStateChanged = false;
|
|
1272
|
+
const ensureRestorePluginSnapshot = (configPath, plugin) => {
|
|
1273
|
+
const target = restoreState.targets.find((entry) => entry.configPath === configPath);
|
|
1274
|
+
if (!target)
|
|
1275
|
+
return;
|
|
1276
|
+
if (Object.prototype.hasOwnProperty.call(target, "plugin"))
|
|
1277
|
+
return;
|
|
1278
|
+
target.plugin = Array.isArray(plugin) ? plugin : null;
|
|
1279
|
+
restoreStateChanged = true;
|
|
1280
|
+
};
|
|
1255
1281
|
for (const configPath of normalizedConfigPaths) {
|
|
1256
1282
|
await promises_1.default.mkdir(node_path_1.default.dirname(configPath), { recursive: true });
|
|
1257
1283
|
let existed = true;
|
|
@@ -1286,7 +1312,16 @@ async function writeOpenCodeFamilyConfig(params) {
|
|
|
1286
1312
|
? doc.model
|
|
1287
1313
|
: null,
|
|
1288
1314
|
schema: typeof doc.$schema === "string" ? doc.$schema : null,
|
|
1315
|
+
plugin: Array.isArray(doc.plugin) ? doc.plugin : null,
|
|
1289
1316
|
});
|
|
1317
|
+
restoreStateChanged = true;
|
|
1318
|
+
}
|
|
1319
|
+
else if (!alreadyManaged) {
|
|
1320
|
+
ensureRestorePluginSnapshot(configPath, doc.plugin);
|
|
1321
|
+
}
|
|
1322
|
+
const pluginFilter = filteredOpenCodePlugins(doc.plugin);
|
|
1323
|
+
if (pluginFilter.changed) {
|
|
1324
|
+
doc.plugin = pluginFilter.next;
|
|
1290
1325
|
}
|
|
1291
1326
|
const managedOpenAiProvider = objectRecordOr(providerRoot[OPENAI_PROVIDER_ID], {});
|
|
1292
1327
|
const optionsRoot = objectRecordOr(managedOpenAiProvider.options, {});
|
|
@@ -1307,7 +1342,7 @@ async function writeOpenCodeFamilyConfig(params) {
|
|
|
1307
1342
|
doc.model = `${OPENAI_PROVIDER_ID}/${params.model}`;
|
|
1308
1343
|
await promises_1.default.writeFile(configPath, `${JSON.stringify(doc, null, 2)}\n`, "utf8");
|
|
1309
1344
|
}
|
|
1310
|
-
if (restoreState.targets.length > 0) {
|
|
1345
|
+
if (restoreState.targets.length > 0 && restoreStateChanged) {
|
|
1311
1346
|
await writeJsonObjectFile(params.restoreStatePath, restoreState, 0o600);
|
|
1312
1347
|
}
|
|
1313
1348
|
return normalizedConfigPaths;
|
package/package.json
CHANGED