llm-switcher 1.6.20 → 1.6.22
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/CHANGELOG.md +17 -0
- package/formats.mjs +94 -36
- package/idle-compact/0008be23e0f93eb6cc3d475cc4882759932b315e47468c04f802d180f2920017.json +1 -0
- package/idle-compact/05ca6c0e540b4b2697a91b6327e90972245f88d2147ab5d9b41643182b6e0326.json +1 -0
- package/idle-compact/0b35f3338bd9e7d47087e4cba69999234488478281206c2896e79ca39fcaa8e8.json +1 -0
- package/idle-compact/0d8fac3d9d1aede92748e9191b937bbfd4539a59f5d69800060f95902e21d976.json +1 -0
- package/idle-compact/1143a32f7b81f92d5a4a182afb341f7faf4f36d804bfd0a89c8060f2e0fde80b.json +1 -0
- package/idle-compact/13f130370b5fe2818c35f62c815fad7dca289a398bd3e4e7b49cb9437146bca6.json +1 -0
- package/idle-compact/15be7831980d36c13d0b09a54af04b3782af02fd89d0c4d0d6178b5ebbadd70b.json +1 -0
- package/idle-compact/1707c45ba669cd4721da3b1337600b6face9ccdf80747a176b85f32127b71e63.json +1 -0
- package/idle-compact/17a6b84021dcd12d1e08e8c9b8a9fea85b608b75655a96edcf5a45384ec7bcc2.json +1 -0
- package/idle-compact/18145a8a71c41b21d5e664f3197c7884f8d18780999ace2660b8e16311a584e4.json +1 -0
- package/idle-compact/1ac7a3cf1fc2e97461db5b6a9ef8feacebd02105a6c770509849e41bd0637669.json +1 -0
- package/idle-compact/1bc3bcf289dacfe76992c2fb59b08b712748660a38b963c39b040ef789469168.json +1 -0
- package/idle-compact/1d20b640dac582273fe64bf69b5ae49e57772c0c15bce4670f33bb990d0a681d.json +1 -0
- package/idle-compact/1dfa9d9eb7b69909a4eeccb711843751d692b6c78af3bb12d0f1d134094ae9cf.json +1 -0
- package/idle-compact/1fcb34865344d1bee3a6c46c28b74d27f73193232891de4fe1261ae755777da3.json +1 -0
- package/idle-compact/26760530a97624a1cebde7de2f9e5141dcd9c0a11b74b961ba4bf97e21e2590e.json +1 -0
- package/idle-compact/27b24bdd86f2b69faf8d5a205ed637d5cc23edc89c98a0d3fed0e22f7370fe72.json +1 -0
- package/idle-compact/27f12e3946ca46f7a2f0e8d81b58698dd9bd7caccba9c0a56105f5e8020b523c.json +1 -0
- package/idle-compact/2b53aaee9ff1626e09fb8bfaee9ae11b37dec75703041eb392e19974ae6f49c3.json +1 -0
- package/idle-compact/2bcb182a020ff58a37a43227ebf6ebb555398d275f8cf0576d6ed7ed5e6f84a0.json +1 -0
- package/idle-compact/2cc1862361ac1edc061633c1ca6cad910246ef5756453554ba6c4ed6cfe93e28.json +1 -0
- package/idle-compact/307f82b9e15aa29d33ad8c6b53fceda696b87ac6a4371bd654ec702673761fc3.json +1 -0
- package/idle-compact/3ecb6bd0f00cf5fab577071857f1d3d2a0eeb7d73cfcfe8f4624ff7e5419f3b2.json +1 -0
- package/idle-compact/3f926d8d714141f019db15c552db3da66863d5ad3983e7654cfc970b39d6a7fb.json +1 -0
- package/idle-compact/434f7d0bcf894f6b64566a550371fe788e181ce311d5233782fe518abedf198d.json +1 -0
- package/idle-compact/4b2254ea1f682ef2ec439957e2acedf85cacaa7662943fc672b36da1c8baff5f.json +1 -0
- package/idle-compact/4b5482b73800e95c4ad461c2979f07f102a2edd6b2e96d341847a3cc6ecd6fc8.json +1 -0
- package/idle-compact/4b798fb13a71ee5145efb034d64655a76c87dc9463af80837c071b2f8b2a7419.json +1 -0
- package/idle-compact/4bf89af8c05713a8ac60f9441605de4aa998518b66c658d312db0c79078f27c9.json +1 -0
- package/idle-compact/4d8f92e4ea7679b96c718eabbef247855b35ea384c72ecd950f5675619f8200f.json +1 -0
- package/idle-compact/4d966b17b8151a91fbce6949bb7753adee6f9acd98b1670d4a6d05c6e8063b5c.json +1 -0
- package/idle-compact/51f998ed4a9661f4c718936a4af279989717703e7f5a4412f77d8f895c273846.json +1 -0
- package/idle-compact/5339cfaff7a05c277f0e1357416ccdbd3213f7bb27b0427455813ac907efbfbd.json +1 -0
- package/idle-compact/5486b3fbaa0416808413a828f3d523f48b7f47e9edebf3e28e8ffcc07dcdf340.json +1 -0
- package/idle-compact/57f322d60ccb6a8ecc11b546ad7d900fd07b2d926214e68e3fd89114e5e5ac48.json +1 -0
- package/idle-compact/596957429b5c587b24238d08ddcc883790aa5f6ebaba1392fc945efb133498bc.json +1 -0
- package/idle-compact/5a1a7d3d5d5efa379dd084a91f52bbe7f2e327ced070779ec2af44d834da567b.json +1 -0
- package/idle-compact/5ddf998ae0703ad5c012531e36e9b367dbf1feaf13ff5344a768067cff7aa385.json +1 -0
- package/idle-compact/5f681c4b37bd7ca5eb80a2ab6183fb90f939a21d056f8495893de25f9677faa3.json +1 -0
- package/idle-compact/60492eb82c4cf7d8ac4dd615cf1f2b30b0c5229301a92e9db2ffb3216fa74e93.json +1 -0
- package/idle-compact/63f84243ff15c483691e4b053c7ffa6d42604c4a54d65fb6ec0302674301c2b6.json +1 -0
- package/idle-compact/6476b1d194e34d203ab87c9a35555f17a4d5acb05e1acc4a77a6bd17bc3ae5bb.json +1 -0
- package/idle-compact/6634c6333f23509c9a0d950651fc38a665da7a2903939c03efd7fb405e09cd19.json +1 -0
- package/idle-compact/6751e1c26282a073f8f00f1e631a0f185d938d61b01a797b695eb4e0215962fc.json +1 -0
- package/idle-compact/6752a38e49abea1c9cc5c6f2199d560cc981ef31fca1d27c7bf0f29db50d90cf.json +1 -0
- package/idle-compact/67744b1689e4b1991c651942efa8253afd40bdfd4c764a2aa6aed8d071dcf297.json +1 -0
- package/idle-compact/6877d18769040bb50b4166e34794fa253f8531b30f3046b02a07fc866382f6c3.json +1 -0
- package/idle-compact/6b72d00389b8e8f41ee4d39df5f66b7aab666d52f57728ee408afd74a5cc03af.json +1 -0
- package/idle-compact/6c5575176e253bd0c5ad99cdeecbd625be114c6c6e72482899688e3f7ef399c6.json +1 -0
- package/idle-compact/6c9e68ef5bd993d70be27664636f429b5258f7709d09d8df3e0ddb3462857d27.json +1 -0
- package/idle-compact/6fa89834f573bdd9cd7655c7428220e5e4ddcc0b0dee426389a9fbd29876aae6.json +1 -0
- package/idle-compact/71c58d8b1e9e5e90a840c5274ddcdb572984d4572d0fe5b7f86984f475de318e.json +1 -0
- package/idle-compact/724199cbdfbdca099ed22e6c273cc8ae4b54b1b4bc777c1aee432a2c76728cd7.json +1 -0
- package/idle-compact/7278fde3c26725d9d7fad8b0f934d902cbdda360d1f338e4b1eac416c9d18d34.json +1 -0
- package/idle-compact/73dd6d832fb20cd1360ae2f784cbe677135d3a3c763c2d0580d4a5e3b4ff3878.json +1 -0
- package/idle-compact/7a7c9f7f848d8003f496ddce4405150d0f5a49f010c7fc9b5811be00adb18096.json +1 -0
- package/idle-compact/7c6d867d2343d0111333b99a26facbb2ff9dfe210e88bf3e304290144ef34101.json +1 -0
- package/idle-compact/80712635d9f41bc9e311665d3a66d8eac259585c2d435778dafe58b66095d9f1.json +1 -0
- package/idle-compact/881314bb7a6e34dddf39e8ccc04bcbae6c5302785ba8a23edb1e719dbd192894.json +1 -0
- package/idle-compact/8a52223a57d753c0e769a783f9bf32c58bd66061ee4af1feee2bcbc930540949.json +1 -0
- package/idle-compact/8c244f5b18b4622d0ba0f874b16f61a32bb1d357c558603bd89cd783e3cccbad.json +1 -0
- package/idle-compact/93122e606938b6ed10c12e5e5f262934ce8f4083cd953e8d8c08c238b5da99dd.json +1 -0
- package/idle-compact/93854197ae9f1ba3f3b19d440398dc6fe42999b1530c09bb72afeb8548f4532b.json +1 -0
- package/idle-compact/9ad4e6b4f3ec6739bcd9fbdd146976d20c91056bd13a4a66458d085509d39d3f.json +1 -0
- package/idle-compact/9ae8203cc357cfe7abdf2c5b6db678f1c8fa289b28db69e07995a800f253c27f.json +1 -0
- package/idle-compact/9d8117e0328f63ace93308e6e481cebe513d4a72784375ab154c2e845a81f889.json +1 -0
- package/idle-compact/a528a059c1da8f7db2bed30719f86abca204d9ad7ab12e681416f02e5d5a2ae3.json +1 -0
- package/idle-compact/a5a626298532c5ab8f5d835b8011162c131ec44aeef2e7217758884976f9f24a.json +1 -0
- package/idle-compact/a6a7569da21e59593c59f91528858497cef0af8e8537cb59d0ede7b2275b6073.json +1 -0
- package/idle-compact/a768e32bdd03147f9268b957bfe9fdea9d2ad8896a9117b4a063e1fef3a9ee18.json +1 -0
- package/idle-compact/ab658ff9f684819955c1f05df5e1b4c44fc58d1253dcb325668d73c1d18883ba.json +1 -0
- package/idle-compact/abeb4514d91401e8f2dbae786232f8200f2c8aa83e9c6ab138999392a011021c.json +1 -0
- package/idle-compact/ac30169b2c611c5ffc38d7f1d3a7aede6afdb34b6f65d76f9cd0633c13fb3ed3.json +1 -0
- package/idle-compact/ac91db2a820156a6eceb6468521b3902c2e1456044d428dea67106997d5cb98e.json +1 -0
- package/idle-compact/adc56c24384c2189aca210b54ce3590046a8f90c03f57ba31fdad8eee40d43b9.json +1 -0
- package/idle-compact/afcbe35d2ce5d7eb5c81548d902cea2f3c9458b0e0d77f7d7af4f4dc59f91942.json +1 -0
- package/idle-compact/b08216c61ca14ca89bd8fca53aad893587c9f8b445b1d92e19e5e20f0d5ebc8b.json +1 -0
- package/idle-compact/b2924b38f57617d7db763e7c41abb5a2c8fa21410373619d4476f2cbbff9dafc.json +1 -0
- package/idle-compact/b327de879ff01758c159aa79b0c7145e5a61c2420df56c3c8b19e2efedbea364.json +1 -0
- package/idle-compact/b7f20bbc5c14e1d55fab3e719f46dd3529858ab53a5aaafad21a7ccf77851aef.json +1 -0
- package/idle-compact/b8117c1ba9205978065828b9d4f3d3d8757c09287073deda0233794fbe957876.json +1 -0
- package/idle-compact/b81cab09d898b2164c8a1cf782666ee4af3931b9221249aafb214013bac74775.json +1 -0
- package/idle-compact/b841e1a1ffd97db0d08aa91150d1e7f9f8ded9b09f3e33fa45c39b3433958aa9.json +1 -0
- package/idle-compact/b980814bb8acf6cb7de5d2566a2d1a3d08510fb79551f6c4fe44307c10f92c50.json +1 -0
- package/idle-compact/ba1e95eefe8ae77610cedddd1ef9a19a3551646b8c13c890c848cc7773f9a346.json +1 -0
- package/idle-compact/bd4f83ebe46b61c60aaf6046bb112d95034eda7f23f849f4ff08937b67e4daaf.json +1 -0
- package/idle-compact/be8c42a40c1cc6aa248502c2b3723d459a39abd84072af71c67ab62a531639ed.json +1 -0
- package/idle-compact/c0c6ebe3c58c5931da4b7a4eda5ab67dba2e280aa3949aaae58b5633e2b5b4c6.json +1 -0
- package/idle-compact/c1470bfe33f4f92df6f5d62823cd1175d7ce1e9b3b81eaadd08cc16afe8b7b1c.json +1 -0
- package/idle-compact/c2092fb9b055fdd03541bd2f23d514021614d67a51f97f8e3a080f4b448e2fda.json +1 -0
- package/idle-compact/c30524d23a14bfd98277299c60c628d1250ea7fc8ce2a4927635efb9fcbbd268.json +1 -0
- package/idle-compact/c4ea8da254a9277a795024bbf8b095fac07b2ac63f6d68d0cbc062848fe12848.json +1 -0
- package/idle-compact/c80015ee525367d4bcfdc76efd899b0a1ba9d9f13154466fa37ee11cf171ea55.json +1 -0
- package/idle-compact/c8cf806fd4190822ca49cacc613d2f369a37f040c77ddae5ec58465bb240e9d5.json +1 -0
- package/idle-compact/cbf6c0c79ed3ff57fa035f0d25b2ccf7cf4f1fe2c78c0d70814d27da8eee7380.json +1 -0
- package/idle-compact/cc6ff102099ed873780acda14612362c64e2303ea950ccab7192d309a3992fd1.json +1 -0
- package/idle-compact/cd38e29b1a3bd3c52f8007bf917777152db56af72c66a396fa0ea6afb4f16d1d.json +1 -0
- package/idle-compact/ce48dbf3ab5c167425c3a3442bb81476470f784c66af27fef7ae53565628fb64.json +1 -0
- package/idle-compact/cf0004339b5a065c5a519ff145924262fa2b55b7ec301485a6cde900d1e35892.json +1 -0
- package/idle-compact/cf60b2c349602653e75353128e8581f6fc73b6a196e38516bbddfeae381a8163.json +1 -0
- package/idle-compact/d2825377ad860d451baef84919f6dba23f58137ead49ac7507c4f89e2d294bb0.json +1 -0
- package/idle-compact/d2e91eb1a8c38f735cd761ad7fcb6fb43acabf6ad00f2c1bc10f244cf9b4c30b.json +1 -0
- package/idle-compact/da84428ad4330e242c839d9d74d43ab559b250875472c0c6563cbdbcaa2d12e1.json +1 -0
- package/idle-compact/dd1e1d11cabcb569e343eaeffe275b9ebffdbd32c50a602f2050cc23759f8ff1.json +1 -0
- package/idle-compact/e2930f6e8d1bab24e0d32be3362402a3043fad2afb0aefe46a1f6cec06aac369.json +1 -0
- package/idle-compact/e6e19f9c66ddc24a17ae33dc1605ad91e3b6b2326b0c9f85f74b4ae688396699.json +1 -0
- package/idle-compact/e8d4eca0b7b4528cef85a64395710b91aa4089edb73cb0d0a3b416d9e0b67564.json +1 -0
- package/idle-compact/eddbe1dde46d6836e176239f2c3b786c17622357f6b1e2c0cb3877a483a70f0d.json +1 -0
- package/idle-compact/ee4a95e4f4408b620112ca7968e56beb6f25862f1d1c3eba25d95b5a404d571e.json +1 -0
- package/idle-compact/f0bd1e4cfc654eca1c6170d949dcfd38f70172384cbeced0196a75e70cb0e385.json +1 -0
- package/idle-compact/f1ee78177ce0d79d7987f6d5436031a0a4ab3c25022bf1deba95b751c6d1b006.json +1 -0
- package/idle-compact/f2102d06005d68b948022a3e573da6a780d8af4c48e706e88abc4c694b6dca9d.json +1 -0
- package/idle-compact/f2970e5cd16b7280a04d5c47963216db917a2b5385f733e907588f389e554ea5.json +1 -0
- package/idle-compact/f2c88cfeb5da0e19dcbeb7efbf4336d76d881355c83e59dd98e181d70e3f4bb6.json +1 -0
- package/idle-compact/f6bf657d3752dd482462a9b42b5584294d61b00225eb8eeb5270050ccecae686.json +1 -0
- package/idle-compact/f7d0faa8a8eaed5af8d9d020884d3f64d32939961b4b240db2e35b1332c94e9c.json +1 -0
- package/idle-compact/fab8b80827684c1004d5bce26a238e5c54a0efa24a6694bc25d35da0059a6e83.json +1 -0
- package/idle-compact/fbf71397f6cae638ee3a373ba44e865a696829907b9bfe9f3cdedf2ababedea8.json +1 -0
- package/idle-compact/fd364119783472b6911299f9efbf35e11e633eb1b320d5d5a951706b0591e0ae.json +1 -0
- package/idle-compact/ffa7879adf5e107c1146bcf18df9b8d0cd5e47a2c09da884a832c04ea6f338af.json +1 -0
- package/package.json +1 -1
- package/tests/formats.test.mjs +286 -6
- package/tests/tool-repair.test.mjs +112 -0
- package/toolvocab.mjs +20 -2
- package/preflight-cache.json +0 -11
package/toolvocab.mjs
CHANGED
|
@@ -159,7 +159,19 @@ function schemaMatch(key, value, keys) {
|
|
|
159
159
|
const other = normalizeKey(k);
|
|
160
160
|
return other !== shape && (other.includes(shape) || shape.includes(other));
|
|
161
161
|
});
|
|
162
|
-
return loose.length === 1 ? loose[0] : null;
|
|
162
|
+
if (loose.length) return loose.length === 1 ? loose[0] : null;
|
|
163
|
+
const short = keys.filter(k => isAbbreviation(normalizeKey(k), shape) || isAbbreviation(shape, normalizeKey(k)));
|
|
164
|
+
return short.length === 1 ? short[0] : null;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// `cmd` for `command`, `pwd` for `password`: the same first and last letter, the letters in order, and
|
|
168
|
+
// at most about half as long. Strict on purpose, so `path` is never taken for `patch`.
|
|
169
|
+
function isAbbreviation(short, long) {
|
|
170
|
+
if (short.length < 2 || short.length * 2 > long.length + 1) return false;
|
|
171
|
+
if (short[0] !== long[0] || short.at(-1) !== long.at(-1)) return false;
|
|
172
|
+
let i = 0;
|
|
173
|
+
for (const ch of long) if (ch === short[i]) i++;
|
|
174
|
+
return i === short.length;
|
|
163
175
|
}
|
|
164
176
|
|
|
165
177
|
/**
|
|
@@ -181,6 +193,11 @@ function repairArgs(args, tool) {
|
|
|
181
193
|
if (!target || Object.hasOwn(args, target)) continue; // no single fit, or the client has both
|
|
182
194
|
renames.set(key, target);
|
|
183
195
|
}
|
|
196
|
+
// Two keys that land on one schema key: either value can be the one meant, and the second rename
|
|
197
|
+
// would overwrite the first (`cd` and `command` both fit `cmd`). Neither moves.
|
|
198
|
+
const counts = new Map();
|
|
199
|
+
for (const target of renames.values()) counts.set(target, (counts.get(target) || 0) + 1);
|
|
200
|
+
for (const [key, target] of renames) if (counts.get(target) > 1) renames.delete(key);
|
|
184
201
|
if (!renames.size) return args;
|
|
185
202
|
// Rebuilt in the original order, with each renamed key standing where the old one stood: an
|
|
186
203
|
// argument list is read by people in diffs, and a reordered one hides what changed.
|
|
@@ -325,8 +342,9 @@ export function createToolVocab(declared, { allowHyphens = true, names = [] } =
|
|
|
325
342
|
}
|
|
326
343
|
|
|
327
344
|
function args(upstream, argsJson) {
|
|
345
|
+
// Key repair needs only the caller's schema, so it runs for one declared tool too; `useful`
|
|
346
|
+
// gates the choice between tool names, not the spelling of a key.
|
|
328
347
|
const fixedName = name(upstream);
|
|
329
|
-
if (!useful && !shortenedToOriginal.has(String(upstream || '')) && !needsArgsRewrite(upstream)) return argsJson;
|
|
330
348
|
const target = byName.get(fixedName);
|
|
331
349
|
if (!target) return argsJson;
|
|
332
350
|
let parsed;
|
package/preflight-cache.json
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"claude": {
|
|
3
|
-
"cacheKey": "claude-intact:zencore/space-bunny-free,zencore/muse-spark-1.3-contributor-free",
|
|
4
|
-
"time": 1792631963371,
|
|
5
|
-
"lines": [
|
|
6
|
-
"[llm-switcher] claude -> claude-intact | 127.0.0.1:20142 | zencore/space-bunny-free",
|
|
7
|
-
"[llm-switcher:preflight] ⚠️ CẢNH BÁO: Model đã setup không còn khả dụng trên provider: 'zencore/space-bunny-free' [slot sonnet], 'zencore/muse-spark-1.3-contributor-free' [slot haiku].",
|
|
8
|
-
"[llm-switcher:preflight] Gợi ý: Chạy 'switch ui' để cập nhật lại model hợp lệ."
|
|
9
|
-
]
|
|
10
|
-
}
|
|
11
|
-
}
|