theclawbay 0.3.3 → 0.3.4
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.
|
@@ -12,6 +12,8 @@ const node_child_process_1 = require("node:child_process");
|
|
|
12
12
|
const MODELS_CACHE_FILE = "models_cache.json";
|
|
13
13
|
const MODELS_CACHE_STATE_FILE = "theclawbay.models-cache.json";
|
|
14
14
|
const TARGET_MODEL_ID = "gpt-5.4";
|
|
15
|
+
const SEED_MARKER_KEY = "_theclawbay_seeded";
|
|
16
|
+
const SEED_MARKER_VALUE = "gpt-5.4";
|
|
15
17
|
const TEMPLATE_MODEL_IDS = [
|
|
16
18
|
"gpt-5.3-codex",
|
|
17
19
|
"gpt-5.3-codex-spark",
|
|
@@ -119,8 +121,16 @@ async function writePatchState(statePath, fingerprint) {
|
|
|
119
121
|
function findModel(models, slug) {
|
|
120
122
|
return models.find((entry) => entry.slug === slug) ?? null;
|
|
121
123
|
}
|
|
124
|
+
function hasSeedMarker(model) {
|
|
125
|
+
return model[SEED_MARKER_KEY] === SEED_MARKER_VALUE;
|
|
126
|
+
}
|
|
127
|
+
function applySeedMarker(model) {
|
|
128
|
+
const next = cloneJson(model);
|
|
129
|
+
next[SEED_MARKER_KEY] = SEED_MARKER_VALUE;
|
|
130
|
+
return next;
|
|
131
|
+
}
|
|
122
132
|
function normalizeSeedModel(template) {
|
|
123
|
-
const seed =
|
|
133
|
+
const seed = applySeedMarker(template ?? {});
|
|
124
134
|
seed.slug = TARGET_MODEL_ID;
|
|
125
135
|
seed.display_name = TARGET_MODEL_ID;
|
|
126
136
|
seed.description = "Latest frontier agentic coding model.";
|
|
@@ -244,6 +254,19 @@ async function ensureCodexModelCacheHasGpt54(params) {
|
|
|
244
254
|
const existingModel = findModel(doc.models, TARGET_MODEL_ID);
|
|
245
255
|
if (existingModel) {
|
|
246
256
|
const currentFingerprint = fingerprintModel(existingModel);
|
|
257
|
+
if (existingState && existingState.fingerprint === currentFingerprint && !hasSeedMarker(existingModel)) {
|
|
258
|
+
const seededModel = applySeedMarker(existingModel);
|
|
259
|
+
doc.models = doc.models.map((entry) => (entry.slug === TARGET_MODEL_ID ? seededModel : entry));
|
|
260
|
+
await promises_1.default.writeFile(cachePath, `${JSON.stringify(doc, null, 2)}\n`, "utf8");
|
|
261
|
+
await writePatchState(statePath, fingerprintModel(seededModel));
|
|
262
|
+
return { action: "seeded" };
|
|
263
|
+
}
|
|
264
|
+
if (hasSeedMarker(existingModel)) {
|
|
265
|
+
if (!existingState || existingState.fingerprint !== currentFingerprint) {
|
|
266
|
+
await writePatchState(statePath, currentFingerprint);
|
|
267
|
+
}
|
|
268
|
+
return { action: "already_seeded" };
|
|
269
|
+
}
|
|
247
270
|
if (existingState && existingState.fingerprint !== currentFingerprint) {
|
|
248
271
|
await removeFileIfExists(statePath);
|
|
249
272
|
}
|
|
@@ -291,10 +314,17 @@ async function cleanupSeededCodexModelCache(params) {
|
|
|
291
314
|
return { action: "none" };
|
|
292
315
|
}
|
|
293
316
|
const currentFingerprint = fingerprintModel(existingModel);
|
|
294
|
-
if (
|
|
317
|
+
if (!hasSeedMarker(existingModel)) {
|
|
295
318
|
await removeFileIfExists(statePath);
|
|
296
319
|
return { action: "preserved" };
|
|
297
320
|
}
|
|
321
|
+
if (currentFingerprint !== state.fingerprint) {
|
|
322
|
+
await writePatchState(statePath, currentFingerprint);
|
|
323
|
+
doc.models = doc.models.filter((entry) => entry.slug !== TARGET_MODEL_ID);
|
|
324
|
+
await promises_1.default.writeFile(cachePath, `${JSON.stringify(doc, null, 2)}\n`, "utf8");
|
|
325
|
+
await removeFileIfExists(statePath);
|
|
326
|
+
return { action: "removed" };
|
|
327
|
+
}
|
|
298
328
|
doc.models = doc.models.filter((entry) => entry.slug !== TARGET_MODEL_ID);
|
|
299
329
|
await promises_1.default.writeFile(cachePath, `${JSON.stringify(doc, null, 2)}\n`, "utf8");
|
|
300
330
|
await removeFileIfExists(statePath);
|