@bman654/clodex 2.18.1 → 2.18.2
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/cli.js +38 -15
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -346,7 +346,7 @@ import { join } from "path";
|
|
|
346
346
|
// package.json
|
|
347
347
|
var package_default = {
|
|
348
348
|
name: "@bman654/clodex",
|
|
349
|
-
version: "2.18.
|
|
349
|
+
version: "2.18.2",
|
|
350
350
|
publishConfig: {
|
|
351
351
|
access: "public"
|
|
352
352
|
},
|
|
@@ -3438,7 +3438,7 @@ function savedStopsAfter(current, assignments) {
|
|
|
3438
3438
|
}
|
|
3439
3439
|
|
|
3440
3440
|
// src/patch-transforms.ts
|
|
3441
|
-
var PATCH_TRANSFORMS_VERSION =
|
|
3441
|
+
var PATCH_TRANSFORMS_VERSION = 14;
|
|
3442
3442
|
var NATIVE_EFFORT_LEVELS = ["low", "medium", "high", "xhigh", "max"];
|
|
3443
3443
|
var BASE_EFFORT_LEVELS = ["low", "medium", "high"];
|
|
3444
3444
|
function projectNativeEffort(effort) {
|
|
@@ -3616,15 +3616,10 @@ function applyClodexPatches(source, config) {
|
|
|
3616
3616
|
);
|
|
3617
3617
|
}
|
|
3618
3618
|
}
|
|
3619
|
+
const pickerRow = (a) => "{value:" + q(a) + ",label:" + q(a.charAt(0).toUpperCase() + a.slice(1)) + ",description:" + q(displayFor(a, ALIAS_TO_ID[a])) + "}";
|
|
3619
3620
|
{
|
|
3620
3621
|
const missing = ALIASES.filter((a) => !new RegExp("value:" + reEsc(q(a))).test(js));
|
|
3621
|
-
const entries = missing.map(
|
|
3622
|
-
// value = the alias (the name the user types and the binary sends);
|
|
3623
|
-
// description = the real model label, e.g. "GPT-5.6 Sol (OpenAI (ChatGPT))".
|
|
3624
|
-
// (tweakcc's writeContent round-trips utf8 faithfully — verified — so the
|
|
3625
|
-
// old adhoc-patch ASCII-only constraint no longer applies.)
|
|
3626
|
-
(a) => "{value:" + q(a) + ",label:" + q(a.charAt(0).toUpperCase() + a.slice(1)) + ",description:" + q(displayFor(a, ALIAS_TO_ID[a])) + "}"
|
|
3627
|
-
).join(",");
|
|
3622
|
+
const entries = missing.map(pickerRow).join(",");
|
|
3628
3623
|
const injectInto = (options) => missing.length ? "[" + entries + "].forEach(function(_o){if(!" + options + ".some(function(_i){return _i.value===_o.value}))" + options + ".push(_o)});" : "";
|
|
3629
3624
|
const pickerSite = "PATCH 5: model picker options";
|
|
3630
3625
|
const modelSelections = [...js.matchAll(/\(([\w$]+)==="opus"\|\|\1==="sonnet"\)/g)];
|
|
@@ -3641,6 +3636,25 @@ function applyClodexPatches(source, config) {
|
|
|
3641
3636
|
);
|
|
3642
3637
|
}
|
|
3643
3638
|
}
|
|
3639
|
+
{
|
|
3640
|
+
const catalogSite = "PATCH 11: catalog picker options";
|
|
3641
|
+
const catalogMarker = "/*ccpatch:picker*/";
|
|
3642
|
+
const catalogAnchor = /function [\w$]+\(([\w$]+),([\w$]+)\)\{let ([\w$]+)=[\w$]+\(\1,\2\),([\w$]+)=\3\?\?[\w$]+\(\1\)(?=[,;])(?=[\s\S]{0,400}ANTHROPIC_CUSTOM_MODEL_OPTION)/;
|
|
3643
|
+
const entryPoints = source.match(new RegExp(catalogAnchor.source, "g"))?.length ?? 0;
|
|
3644
|
+
const rows = ALIASES.map(pickerRow).join(",");
|
|
3645
|
+
if (ALIASES.length === 0) {
|
|
3646
|
+
log13("SKIP", catalogSite, "no aliases configured");
|
|
3647
|
+
} else if (entryPoints !== 1 && !js.includes(catalogMarker)) {
|
|
3648
|
+
log13("FAIL", catalogSite, entryPoints === 0 ? "anchor not found" : "anchor matched " + entryPoints + " times (expected 1)");
|
|
3649
|
+
} else {
|
|
3650
|
+
applyOnce(
|
|
3651
|
+
catalogSite,
|
|
3652
|
+
catalogAnchor,
|
|
3653
|
+
(m, _first, _second, _catalog, options) => m + ",_ccpick=" + catalogMarker + "[" + rows + "].forEach(function(_o){if(!" + options + ".some(function(_i){return _i.value===_o.value}))" + options + ".push(_o)})",
|
|
3654
|
+
{ marker: catalogMarker, required: false }
|
|
3655
|
+
);
|
|
3656
|
+
}
|
|
3657
|
+
}
|
|
3644
3658
|
{
|
|
3645
3659
|
const safe = (s) => String(s).replace(/`/g, "'").replace(/\$\{/g, "(");
|
|
3646
3660
|
const listing = IDENTITIES.map(function(i) {
|
|
@@ -4147,14 +4161,14 @@ function uniqueMatch(source, name, pattern) {
|
|
|
4147
4161
|
}
|
|
4148
4162
|
return match[0];
|
|
4149
4163
|
}
|
|
4150
|
-
function captureNeedle(source, name, needle) {
|
|
4151
|
-
if (countExactOccurrences(source, needle) !==
|
|
4164
|
+
function captureNeedle(source, name, needle, expected = 1) {
|
|
4165
|
+
if (countExactOccurrences(source, needle) !== expected) {
|
|
4152
4166
|
throw new Error(`clodex patch: could not capture built-in postcondition: ${name}`);
|
|
4153
4167
|
}
|
|
4154
4168
|
return {
|
|
4155
4169
|
name,
|
|
4156
4170
|
protectedText: needle,
|
|
4157
|
-
occurrences:
|
|
4171
|
+
occurrences: expected
|
|
4158
4172
|
};
|
|
4159
4173
|
}
|
|
4160
4174
|
function capturePattern(source, name, pattern) {
|
|
@@ -4214,16 +4228,25 @@ function captureBuiltInPatchProofs(source, config, results) {
|
|
|
4214
4228
|
));
|
|
4215
4229
|
}
|
|
4216
4230
|
}
|
|
4217
|
-
|
|
4231
|
+
const pickerSites = [
|
|
4232
|
+
"PATCH 5: model picker options",
|
|
4233
|
+
"PATCH 11: catalog picker options"
|
|
4234
|
+
].filter((name) => protectsResult(results, name));
|
|
4235
|
+
if (pickerSites.length > 0) {
|
|
4218
4236
|
for (const { alias, id, display } of aliases) {
|
|
4219
4237
|
const entry = "{value:" + JSON.stringify(alias) + ",label:" + JSON.stringify(alias.charAt(0).toUpperCase() + alias.slice(1)) + ",description:" + JSON.stringify(display ?? `Custom model (${id})`) + "}";
|
|
4220
4238
|
proofs.push(captureNeedle(
|
|
4221
4239
|
source,
|
|
4222
|
-
`
|
|
4223
|
-
entry
|
|
4240
|
+
`model picker options (${alias})`,
|
|
4241
|
+
entry,
|
|
4242
|
+
pickerSites.length
|
|
4224
4243
|
));
|
|
4225
4244
|
}
|
|
4226
4245
|
}
|
|
4246
|
+
addPattern(
|
|
4247
|
+
"PATCH 11: catalog picker options",
|
|
4248
|
+
/,_ccpick=\/\*ccpatch:picker\*\/\[[\s\S]*?\]\.forEach\(function\(_o\)\{if\(![\w$]+\.some\(function\(_i\)\{return _i\.value===_o\.value\}\)\)[\w$]+\.push\(_o\)\}\)/
|
|
4249
|
+
);
|
|
4227
4250
|
addPattern(
|
|
4228
4251
|
"PATCH 7: per-model context window",
|
|
4229
4252
|
/\/\*ccpatch:ctx\*\/var _ccw=\(\{[^{}]*\}\)\[[^\]]*\];if\(_ccw!==void 0\)return _ccw;/
|