@bendyline/gezel-cli 1.2.4 → 1.2.5
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/bin/gezel-main.js +62 -23
- package/dist/handboek-export.js +7 -9
- package/dist/tui/index.js +33 -31
- package/package.json +10 -10
package/dist/bin/gezel-main.js
CHANGED
|
@@ -982,7 +982,7 @@ import {
|
|
|
982
982
|
formatModelAttribution,
|
|
983
983
|
isMoEFromTags,
|
|
984
984
|
isRecommendedModel,
|
|
985
|
-
|
|
985
|
+
lowBitScoreFactor,
|
|
986
986
|
pickRecommendedModel
|
|
987
987
|
} from "@bendyline/gezel";
|
|
988
988
|
var NATIVE_TOOLKIT = [
|
|
@@ -1242,8 +1242,12 @@ ${lines.join("\n")}
|
|
|
1242
1242
|
`Web search needs a Brave Search API key. Get one at ${BRAVE_KEY_URL} \u2014 Gezel keeps it in this computer's secret store.
|
|
1243
1243
|
`
|
|
1244
1244
|
);
|
|
1245
|
-
const key = (await prompter.secret(
|
|
1245
|
+
const key = (await prompter.secret(
|
|
1246
|
+
"Paste the key, then press Enter (Enter on its own stops here): ",
|
|
1247
|
+
(length) => `Key received (${length} characters, hidden). Press Enter to continue with this key. `
|
|
1248
|
+
)).trim();
|
|
1246
1249
|
if (!key) stop(gap);
|
|
1250
|
+
options.write("Checking the key with one Brave search\u2026\n");
|
|
1247
1251
|
await saveBraveKey(client, config, key, options.projectId);
|
|
1248
1252
|
options.write("Web search: Brave (test search passed)\n");
|
|
1249
1253
|
} else {
|
|
@@ -1294,44 +1298,79 @@ ${lines.join("\n")}
|
|
|
1294
1298
|
}
|
|
1295
1299
|
options.write("\n");
|
|
1296
1300
|
}
|
|
1297
|
-
function terminalPrompter() {
|
|
1298
|
-
if (!
|
|
1301
|
+
function terminalPrompter(terminal = { input: process.stdin, output: process.stderr }) {
|
|
1302
|
+
if (!terminal.input.isTTY || !terminal.output.isTTY) return null;
|
|
1299
1303
|
return {
|
|
1300
|
-
confirm: async (question) =>
|
|
1301
|
-
|
|
1304
|
+
confirm: async (question) => {
|
|
1305
|
+
for (; ; ) {
|
|
1306
|
+
const answer = (await ask(terminal, question)).trim().toLowerCase();
|
|
1307
|
+
if (answer === "y" || answer === "yes") return true;
|
|
1308
|
+
if (answer === "" || answer === "n" || answer === "no") return false;
|
|
1309
|
+
terminal.output.write("Please answer y or n.\n");
|
|
1310
|
+
}
|
|
1311
|
+
},
|
|
1312
|
+
secret: (question, filled) => ask(terminal, question, { filled })
|
|
1302
1313
|
};
|
|
1303
1314
|
}
|
|
1304
|
-
function ask(question,
|
|
1305
|
-
|
|
1306
|
-
const output = new Writable({
|
|
1307
|
-
write(chunk, encoding, callback) {
|
|
1308
|
-
if (!muted) process.stderr.write(chunk, encoding);
|
|
1309
|
-
callback();
|
|
1310
|
-
}
|
|
1311
|
-
});
|
|
1315
|
+
function ask(terminal, question, secret) {
|
|
1316
|
+
const { input, output } = terminal;
|
|
1312
1317
|
return import("readline").then(
|
|
1313
|
-
({ createInterface }) => new Promise((resolve6, reject) => {
|
|
1314
|
-
const rl = createInterface({
|
|
1318
|
+
({ clearScreenDown, createInterface, cursorTo, moveCursor }) => new Promise((resolve6, reject) => {
|
|
1319
|
+
const rl = createInterface({
|
|
1320
|
+
input,
|
|
1321
|
+
output: secret ? new Writable({ write: (_chunk, _encoding, done) => done() }) : output,
|
|
1322
|
+
terminal: true,
|
|
1323
|
+
...secret ? { historySize: 0 } : {}
|
|
1324
|
+
});
|
|
1315
1325
|
let settled = false;
|
|
1316
|
-
|
|
1326
|
+
const settle = () => {
|
|
1317
1327
|
settled = true;
|
|
1328
|
+
input.removeListener("keypress", onKeypress);
|
|
1329
|
+
};
|
|
1330
|
+
let drawn = "";
|
|
1331
|
+
let shownLength = -1;
|
|
1332
|
+
let pending = false;
|
|
1333
|
+
const draw = () => {
|
|
1334
|
+
pending = false;
|
|
1335
|
+
if (settled || !secret) return;
|
|
1336
|
+
const length = rl.line.length;
|
|
1337
|
+
if (length === shownLength) return;
|
|
1338
|
+
shownLength = length;
|
|
1339
|
+
const text = length > 0 && secret.filled ? secret.filled(length) : question;
|
|
1340
|
+
if (drawn) {
|
|
1341
|
+
const rows = Math.floor((drawn.length - 1) / (output.columns || 80));
|
|
1342
|
+
if (rows > 0) moveCursor(output, 0, -rows);
|
|
1343
|
+
cursorTo(output, 0);
|
|
1344
|
+
clearScreenDown(output);
|
|
1345
|
+
}
|
|
1346
|
+
output.write(text);
|
|
1347
|
+
drawn = text;
|
|
1348
|
+
};
|
|
1349
|
+
function onKeypress() {
|
|
1350
|
+
if (pending) return;
|
|
1351
|
+
pending = true;
|
|
1352
|
+
queueMicrotask(draw);
|
|
1353
|
+
}
|
|
1354
|
+
if (secret) input.on("keypress", onKeypress);
|
|
1355
|
+
rl.on("SIGINT", () => {
|
|
1356
|
+
settle();
|
|
1318
1357
|
rl.close();
|
|
1319
|
-
|
|
1358
|
+
output.write("\n");
|
|
1320
1359
|
reject(new CliError("Cancelled."));
|
|
1321
1360
|
});
|
|
1322
1361
|
rl.on("close", () => {
|
|
1323
1362
|
if (settled) return;
|
|
1324
|
-
|
|
1325
|
-
|
|
1363
|
+
settle();
|
|
1364
|
+
output.write("\n");
|
|
1326
1365
|
resolve6("");
|
|
1327
1366
|
});
|
|
1328
1367
|
rl.question(question, (answer) => {
|
|
1329
|
-
|
|
1368
|
+
settle();
|
|
1330
1369
|
rl.close();
|
|
1331
|
-
if (
|
|
1370
|
+
if (secret) output.write("\n");
|
|
1332
1371
|
resolve6(answer);
|
|
1333
1372
|
});
|
|
1334
|
-
|
|
1373
|
+
draw();
|
|
1335
1374
|
})
|
|
1336
1375
|
);
|
|
1337
1376
|
}
|
package/dist/handboek-export.js
CHANGED
|
@@ -292,15 +292,14 @@ function modelCatalogMarkdown(chat, images, videos) {
|
|
|
292
292
|
"",
|
|
293
293
|
`## Image models (${images.length})`,
|
|
294
294
|
"",
|
|
295
|
-
"Models your crew can use to draw pictures, icons and illustrations.",
|
|
295
|
+
"Models your crew can use to draw pictures, icons and illustrations. Gezel works out what each one needs from its files and offers only the ones your machine can run.",
|
|
296
296
|
"",
|
|
297
|
-
"| Model | Size |
|
|
298
|
-
"| --- | --- | --- | --- |
|
|
297
|
+
"| Model | Size | Commercial use | License |",
|
|
298
|
+
"| --- | --- | --- | --- |",
|
|
299
299
|
...images.map(
|
|
300
300
|
(m) => row([
|
|
301
301
|
link(m.name, m.upstream),
|
|
302
302
|
formatGB(m.approxSizeBytes),
|
|
303
|
-
m.minRamGB ? `${m.minRamGB} GB` : "",
|
|
304
303
|
yesNo(m.commercialUse),
|
|
305
304
|
cell(m.licenseShortName ?? m.license ?? "")
|
|
306
305
|
])
|
|
@@ -312,16 +311,15 @@ function modelCatalogMarkdown(chat, images, videos) {
|
|
|
312
311
|
"",
|
|
313
312
|
`## Video models (${videos.length})`,
|
|
314
313
|
"",
|
|
315
|
-
"Models that turn a prompt or a picture into a short clip.",
|
|
314
|
+
"Models that turn a prompt or a picture into a short clip. Gezel works out what each one needs from its files and offers only the ones your machine can run.",
|
|
316
315
|
"",
|
|
317
|
-
"| Model | Size | Longest clip |
|
|
318
|
-
"| --- | --- | --- | --- | --- |
|
|
316
|
+
"| Model | Size | Longest clip | Commercial use | License |",
|
|
317
|
+
"| --- | --- | --- | --- | --- |",
|
|
319
318
|
...videos.map(
|
|
320
319
|
(m) => row([
|
|
321
320
|
link(m.name, m.upstream),
|
|
322
321
|
formatGB(m.approxSizeBytes),
|
|
323
322
|
m.maxDurationSeconds ? `${m.maxDurationSeconds} s` : "",
|
|
324
|
-
m.minVramGB ? `${m.minVramGB} GB` : "",
|
|
325
323
|
yesNo(m.commercialUse),
|
|
326
324
|
cell(m.licenseShortName ?? m.license ?? "")
|
|
327
325
|
])
|
|
@@ -577,7 +575,7 @@ var BASELINE_CSS = `:root {
|
|
|
577
575
|
--hb-ink-warm: #2a2520;
|
|
578
576
|
--hb-ink-muted: #5a4f42;
|
|
579
577
|
--hb-ink-quiet: #8b7e6b;
|
|
580
|
-
--hb-sage: #
|
|
578
|
+
--hb-sage: #5c6a4a;
|
|
581
579
|
--hb-sage-forest: #3d4d3a;
|
|
582
580
|
--hb-cream-ink: #f3ede0;
|
|
583
581
|
--hb-accent: #b0724c;
|
package/dist/tui/index.js
CHANGED
|
@@ -2501,9 +2501,12 @@ import {
|
|
|
2501
2501
|
formatModelAttribution,
|
|
2502
2502
|
isMoEFromTags,
|
|
2503
2503
|
isRecommendedModel,
|
|
2504
|
-
|
|
2504
|
+
lowBitScoreFactor,
|
|
2505
2505
|
pickRecommendedModel
|
|
2506
2506
|
} from "@bendyline/gezel";
|
|
2507
|
+
function fitVerdicts(res) {
|
|
2508
|
+
return res ? new Map(res.models.map((m) => [m.id, m.verdict])) : null;
|
|
2509
|
+
}
|
|
2507
2510
|
var CHAT_MEMORY_OVERHEAD = {
|
|
2508
2511
|
"llama-cpp": 1.2,
|
|
2509
2512
|
mlx: 1.3
|
|
@@ -2540,6 +2543,7 @@ function rankChatModels(items, device, provider) {
|
|
|
2540
2543
|
// Effective score: a model the shared gate rejects (restricted license,
|
|
2541
2544
|
// no tool support) sorts as unscored rather than leading the list.
|
|
2542
2545
|
recoScore: isRecommendedModel(manifest) ? manifest.recoScore ?? 0 : 0,
|
|
2546
|
+
...source.quantization ? { quantization: source.quantization } : {},
|
|
2543
2547
|
fit,
|
|
2544
2548
|
attribution: formatModelAttribution(manifest)
|
|
2545
2549
|
});
|
|
@@ -2551,7 +2555,8 @@ function rankChatModels(items, device, provider) {
|
|
|
2551
2555
|
...model.recoScore > 0 ? { recoScore: model.recoScore } : {},
|
|
2552
2556
|
licenseClass: "open",
|
|
2553
2557
|
tags: items.find((item) => item.manifest.kind === "chat-model" && item.manifest.id === model.id)?.manifest?.tags ?? [],
|
|
2554
|
-
residentBytes: model.residentBytes
|
|
2558
|
+
residentBytes: model.residentBytes,
|
|
2559
|
+
...model.quantization ? { quantization: model.quantization } : {}
|
|
2555
2560
|
})),
|
|
2556
2561
|
device
|
|
2557
2562
|
);
|
|
@@ -2559,8 +2564,9 @@ function rankChatModels(items, device, provider) {
|
|
|
2559
2564
|
(model) => model.fit === "fits" || model.fit === "fits-offload"
|
|
2560
2565
|
);
|
|
2561
2566
|
const pool = comfortable.length > 0 ? comfortable : candidates;
|
|
2567
|
+
const ranked = (model) => model.recoScore * lowBitScoreFactor(model.quantization);
|
|
2562
2568
|
pool.sort(
|
|
2563
|
-
(a, b) => b
|
|
2569
|
+
(a, b) => ranked(b) - ranked(a) || fitOrder(a.fit) - fitOrder(b.fit) || b.residentBytes - a.residentBytes || a.name.localeCompare(b.name)
|
|
2564
2570
|
);
|
|
2565
2571
|
if (!picked) return pool;
|
|
2566
2572
|
const bestIndex = pool.findIndex((model) => model.id === picked.id);
|
|
@@ -2578,9 +2584,9 @@ function rankChatModels(items, device, provider) {
|
|
|
2578
2584
|
function bootstrapChatModelLabel(model) {
|
|
2579
2585
|
return `${model.name} (${model.attribution})`;
|
|
2580
2586
|
}
|
|
2581
|
-
function pickAccessoryModels(input
|
|
2587
|
+
function pickAccessoryModels(input) {
|
|
2582
2588
|
const output = [];
|
|
2583
|
-
const image = pickCatalogMedia(input.imageItems,
|
|
2589
|
+
const image = pickCatalogMedia(input.imageItems, input.fit.image);
|
|
2584
2590
|
if (image && !input.installed.image?.has(image.id)) {
|
|
2585
2591
|
output.push({
|
|
2586
2592
|
kind: "image",
|
|
@@ -2619,7 +2625,7 @@ function pickAccessoryModels(input, device) {
|
|
|
2619
2625
|
approxSizeBytes: tts.approxSizeBytes
|
|
2620
2626
|
});
|
|
2621
2627
|
}
|
|
2622
|
-
const video = pickCatalogMedia(input.videoItems,
|
|
2628
|
+
const video = pickCatalogMedia(input.videoItems, input.fit.video);
|
|
2623
2629
|
if (video && !input.installed.video?.has(video.id)) {
|
|
2624
2630
|
output.push({
|
|
2625
2631
|
kind: "video",
|
|
@@ -2647,14 +2653,8 @@ function fitOrder(fit) {
|
|
|
2647
2653
|
return 3;
|
|
2648
2654
|
}
|
|
2649
2655
|
}
|
|
2650
|
-
function pickCatalogMedia(items,
|
|
2651
|
-
const models = items.map((item) => item.manifest).filter((model) =>
|
|
2652
|
-
if (model.licenseClass !== "open" || !model.recoScore) return false;
|
|
2653
|
-
return mediaModelFits(
|
|
2654
|
-
device,
|
|
2655
|
-
kind === "image" ? { minRamGB: model.minRamGB } : { minVramGB: model.minVramGB }
|
|
2656
|
-
);
|
|
2657
|
-
});
|
|
2656
|
+
function pickCatalogMedia(items, verdicts) {
|
|
2657
|
+
const models = items.map((item) => item.manifest).filter((model) => isRecommendedModel(model) && verdicts?.get(model.id) === "fits");
|
|
2658
2658
|
return pickScoredOpen(models);
|
|
2659
2659
|
}
|
|
2660
2660
|
function pickScoredOpen(models, requireLicense = true) {
|
|
@@ -4734,7 +4734,9 @@ function BootstrapGate(props) {
|
|
|
4734
4734
|
installedVideo,
|
|
4735
4735
|
installedStt,
|
|
4736
4736
|
installedTts,
|
|
4737
|
-
installedRecognition
|
|
4737
|
+
installedRecognition,
|
|
4738
|
+
imageFit,
|
|
4739
|
+
videoFit
|
|
4738
4740
|
] = await Promise.all([
|
|
4739
4741
|
client.listCatalogItems("image-model").catch(() => ({ items: [] })),
|
|
4740
4742
|
client.listCatalogItems("video-model").catch(() => ({ items: [] })),
|
|
@@ -4744,7 +4746,9 @@ function BootstrapGate(props) {
|
|
|
4744
4746
|
client.listInstalledVideoModels().catch(() => ({ models: [] })),
|
|
4745
4747
|
client.listInstalledSttModels().catch(() => ({ models: [] })),
|
|
4746
4748
|
client.listInstalledTtsModels().catch(() => ({ models: [] })),
|
|
4747
|
-
client.listInstalledRecognitionModels().catch(() => ({ models: [] }))
|
|
4749
|
+
client.listInstalledRecognitionModels().catch(() => ({ models: [] })),
|
|
4750
|
+
client.getImageModelFit().catch(() => null),
|
|
4751
|
+
client.getVideoModelFit().catch(() => null)
|
|
4748
4752
|
]);
|
|
4749
4753
|
const installedIds = new Set(installedChat.models.map((model) => model.id));
|
|
4750
4754
|
const rankedChatModels = rankChatModels(
|
|
@@ -4767,22 +4771,20 @@ function BootstrapGate(props) {
|
|
|
4767
4771
|
});
|
|
4768
4772
|
return;
|
|
4769
4773
|
}
|
|
4770
|
-
const accessories = pickAccessoryModels(
|
|
4771
|
-
|
|
4772
|
-
|
|
4773
|
-
|
|
4774
|
-
|
|
4775
|
-
|
|
4776
|
-
|
|
4777
|
-
|
|
4778
|
-
|
|
4779
|
-
|
|
4780
|
-
|
|
4781
|
-
recognition: idSet(installedRecognition.models)
|
|
4782
|
-
}
|
|
4774
|
+
const accessories = pickAccessoryModels({
|
|
4775
|
+
imageItems: imageCatalog.items,
|
|
4776
|
+
videoItems: videoCatalog.items,
|
|
4777
|
+
audio: audioCatalog,
|
|
4778
|
+
recognition: recognitionCatalog.models,
|
|
4779
|
+
installed: {
|
|
4780
|
+
image: idSet(installedImage.models),
|
|
4781
|
+
video: idSet(installedVideo.models),
|
|
4782
|
+
stt: idSet(installedStt.models),
|
|
4783
|
+
tts: idSet(installedTts.models),
|
|
4784
|
+
recognition: idSet(installedRecognition.models)
|
|
4783
4785
|
},
|
|
4784
|
-
|
|
4785
|
-
);
|
|
4786
|
+
fit: { image: fitVerdicts(imageFit), video: fitVerdicts(videoFit) }
|
|
4787
|
+
});
|
|
4786
4788
|
setScreen({
|
|
4787
4789
|
kind: "model-choice",
|
|
4788
4790
|
plan: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bendyline/gezel-cli",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.5",
|
|
4
4
|
"description": "The `gezel` command-line tool.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
@@ -44,15 +44,15 @@
|
|
|
44
44
|
"!dist/**/*.map"
|
|
45
45
|
],
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@bendyline/gezel": "1.2.
|
|
48
|
-
"@bendyline/gezel-app-sdk": "1.1.
|
|
49
|
-
"@bendyline/gezel-catalog": "1.2.
|
|
50
|
-
"@bendyline/gezel-client": "1.2.
|
|
51
|
-
"@bendyline/gezel-knowledge": "1.2.
|
|
52
|
-
"@bendyline/gezel-service": "1.2.
|
|
53
|
-
"@bendyline/squisq": "2.11.
|
|
54
|
-
"@bendyline/squisq-formats": "2.6.
|
|
55
|
-
"@bendyline/squisq-react": "2.11.
|
|
47
|
+
"@bendyline/gezel": "1.2.5",
|
|
48
|
+
"@bendyline/gezel-app-sdk": "1.1.5",
|
|
49
|
+
"@bendyline/gezel-catalog": "1.2.5",
|
|
50
|
+
"@bendyline/gezel-client": "1.2.5",
|
|
51
|
+
"@bendyline/gezel-knowledge": "1.2.5",
|
|
52
|
+
"@bendyline/gezel-service": "1.2.5",
|
|
53
|
+
"@bendyline/squisq": "2.11.19",
|
|
54
|
+
"@bendyline/squisq-formats": "2.6.20",
|
|
55
|
+
"@bendyline/squisq-react": "2.11.23",
|
|
56
56
|
"commander": "^15.0.0",
|
|
57
57
|
"ink": "^7.1.1",
|
|
58
58
|
"ink-text-input": "^6.0.0",
|