@bendyline/gezel-cli 1.2.5 → 1.2.6
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/README.md +312 -309
- package/dist/app-author-command.js +4 -2
- package/dist/app-command.js +4 -2
- package/dist/bin/gezel-main.js +713 -60
- package/dist/knowledge-command.js +4 -2
- package/dist/tui/index.js +63 -28
- package/package.json +11 -11
|
@@ -35,9 +35,11 @@ import { chmod, mkdir, readFile, realpath, rm, writeFile } from "fs/promises";
|
|
|
35
35
|
import { homedir } from "os";
|
|
36
36
|
import { basename, dirname, join, resolve } from "path";
|
|
37
37
|
import {
|
|
38
|
+
evaluateApiCompat,
|
|
38
39
|
getLogLevel,
|
|
39
40
|
getLogOutput,
|
|
40
|
-
|
|
41
|
+
gezelNamesInUse,
|
|
42
|
+
pickUnusedGezelName,
|
|
41
43
|
projectLeadGezelId,
|
|
42
44
|
setLogLevel,
|
|
43
45
|
setLogOutput
|
|
@@ -63,7 +65,7 @@ import {
|
|
|
63
65
|
stopOwnedDaemon,
|
|
64
66
|
systemSharedAssetsDir
|
|
65
67
|
} from "@bendyline/gezel-client/node";
|
|
66
|
-
import { gezelPaths } from "@bendyline/gezel/paths";
|
|
68
|
+
import { gezelHome, gezelPaths, nativePayloadVerificationPath } from "@bendyline/gezel/paths";
|
|
67
69
|
var CliError = class extends Error {
|
|
68
70
|
constructor(message) {
|
|
69
71
|
super(message);
|
package/dist/tui/index.js
CHANGED
|
@@ -5,7 +5,8 @@ import { render } from "ink";
|
|
|
5
5
|
|
|
6
6
|
// src/tui/App.tsx
|
|
7
7
|
import {
|
|
8
|
-
|
|
8
|
+
gezelNamesInUse as gezelNamesInUse2,
|
|
9
|
+
pickUnusedGezelName as pickUnusedGezelName2
|
|
9
10
|
} from "@bendyline/gezel";
|
|
10
11
|
import { Box as Box6, Text as Text6, useApp, useInput as useInput4, useStdout } from "ink";
|
|
11
12
|
import { useCallback as useCallback2, useEffect as useEffect4, useMemo, useRef as useRef3, useState as useState5 } from "react";
|
|
@@ -16,9 +17,11 @@ import { chmod, mkdir, readFile, realpath, rm, writeFile } from "fs/promises";
|
|
|
16
17
|
import { homedir } from "os";
|
|
17
18
|
import { basename, dirname, join, resolve } from "path";
|
|
18
19
|
import {
|
|
20
|
+
evaluateApiCompat,
|
|
19
21
|
getLogLevel,
|
|
20
22
|
getLogOutput,
|
|
21
|
-
|
|
23
|
+
gezelNamesInUse,
|
|
24
|
+
pickUnusedGezelName,
|
|
22
25
|
projectLeadGezelId,
|
|
23
26
|
setLogLevel,
|
|
24
27
|
setLogOutput
|
|
@@ -44,7 +47,7 @@ import {
|
|
|
44
47
|
stopOwnedDaemon,
|
|
45
48
|
systemSharedAssetsDir
|
|
46
49
|
} from "@bendyline/gezel-client/node";
|
|
47
|
-
import { gezelPaths } from "@bendyline/gezel/paths";
|
|
50
|
+
import { gezelHome, gezelPaths, nativePayloadVerificationPath } from "@bendyline/gezel/paths";
|
|
48
51
|
var CliError = class extends Error {
|
|
49
52
|
constructor(message) {
|
|
50
53
|
super(message);
|
|
@@ -69,7 +72,7 @@ async function ensureCliProjectLead(client, projectId) {
|
|
|
69
72
|
(gezel) => gezel.templateId === "builder" || gezel.role?.trim().toLowerCase() === "builder"
|
|
70
73
|
);
|
|
71
74
|
if (!builder) {
|
|
72
|
-
const { name, gender } =
|
|
75
|
+
const { name, gender } = pickUnusedGezelName(gezelNamesInUse(gezels2));
|
|
73
76
|
builder = await client.createGezelFromTemplate("builder", { name, gender });
|
|
74
77
|
}
|
|
75
78
|
const updated2 = await client.updateProject(projectId, { voormanGezelId: builder.id });
|
|
@@ -84,7 +87,7 @@ async function ensureCliProjectLead(client, projectId) {
|
|
|
84
87
|
(gezel) => gezel.templateId === "voorman" || gezel.role?.trim().toLowerCase() === "voorman"
|
|
85
88
|
);
|
|
86
89
|
if (!voorman) {
|
|
87
|
-
const { name, gender } =
|
|
90
|
+
const { name, gender } = pickUnusedGezelName(gezelNamesInUse(gezels));
|
|
88
91
|
voorman = await client.createGezelFromTemplate("voorman", { name, gender });
|
|
89
92
|
}
|
|
90
93
|
const updated = await client.updateProject(projectId, { voormanGezelId: voorman.id });
|
|
@@ -2517,7 +2520,17 @@ var NATIVE_TOOLKIT = [
|
|
|
2517
2520
|
"whisper-server",
|
|
2518
2521
|
"llama-server"
|
|
2519
2522
|
];
|
|
2520
|
-
function
|
|
2523
|
+
function recoDevice(memory) {
|
|
2524
|
+
return {
|
|
2525
|
+
platform: memory.platform,
|
|
2526
|
+
gpuVramBytes: memory.gpuVramBytes,
|
|
2527
|
+
...memory.gpuMemoryKind ? { gpuMemoryKind: memory.gpuMemoryKind } : {},
|
|
2528
|
+
totalRamBytes: memory.totalRamBytes,
|
|
2529
|
+
usableBytes: memory.usableBytes,
|
|
2530
|
+
...memory.budgetBytes !== void 0 ? { budgetBytes: memory.budgetBytes } : {}
|
|
2531
|
+
};
|
|
2532
|
+
}
|
|
2533
|
+
function chatModelCandidates(items, device, provider) {
|
|
2521
2534
|
const candidates = [];
|
|
2522
2535
|
for (const item of items) {
|
|
2523
2536
|
if (item.manifest.kind !== "chat-model") continue;
|
|
@@ -2548,6 +2561,24 @@ function rankChatModels(items, device, provider) {
|
|
|
2548
2561
|
attribution: formatModelAttribution(manifest)
|
|
2549
2562
|
});
|
|
2550
2563
|
}
|
|
2564
|
+
return candidates;
|
|
2565
|
+
}
|
|
2566
|
+
function orderInstalledChatModels(installed, ranked, candidates) {
|
|
2567
|
+
const fit = new Map(candidates.map((model) => [model.id, model.fit]));
|
|
2568
|
+
const position = (id) => {
|
|
2569
|
+
const index = ranked.findIndex((model) => model.id === id);
|
|
2570
|
+
return index < 0 ? Number.POSITIVE_INFINITY : index;
|
|
2571
|
+
};
|
|
2572
|
+
const cannotRun = (id) => fit.get(id) === "too-big" ? 1 : 0;
|
|
2573
|
+
return [...installed].sort(
|
|
2574
|
+
(a, b) => cannotRun(a.id) - cannotRun(b.id) || position(a.id) - position(b.id)
|
|
2575
|
+
);
|
|
2576
|
+
}
|
|
2577
|
+
function runsHere(id, candidates) {
|
|
2578
|
+
return candidates.find((model) => model.id === id)?.fit !== "too-big";
|
|
2579
|
+
}
|
|
2580
|
+
function rankChatModels(items, device, provider) {
|
|
2581
|
+
const candidates = chatModelCandidates(items, device, provider);
|
|
2551
2582
|
if (candidates.length === 0) return [];
|
|
2552
2583
|
const picked = pickRecommendedModel(
|
|
2553
2584
|
candidates.map((model) => ({
|
|
@@ -2592,7 +2623,7 @@ function pickAccessoryModels(input) {
|
|
|
2592
2623
|
kind: "image",
|
|
2593
2624
|
id: image.id,
|
|
2594
2625
|
name: image.name,
|
|
2595
|
-
approxSizeBytes: image.approxSizeBytes + (image.auxiliaryFiles ?? []).reduce((sum, file) => sum + (file.
|
|
2626
|
+
approxSizeBytes: image.approxSizeBytes + (image.auxiliaryFiles ?? []).reduce((sum, file) => sum + (file.approxSizeBytes ?? 0), 0),
|
|
2596
2627
|
requiredEngine: "sd-server"
|
|
2597
2628
|
});
|
|
2598
2629
|
}
|
|
@@ -3251,7 +3282,8 @@ function App(props) {
|
|
|
3251
3282
|
async (templateId) => {
|
|
3252
3283
|
note(`recruiting ${templateId}\u2026`);
|
|
3253
3284
|
try {
|
|
3254
|
-
const {
|
|
3285
|
+
const { gezels: roster } = await client.listGezels();
|
|
3286
|
+
const { name, gender } = pickUnusedGezelName2(gezelNamesInUse2(roster));
|
|
3255
3287
|
const gezel = await client.createGezelFromTemplate(templateId, { name, gender });
|
|
3256
3288
|
await refreshGezels();
|
|
3257
3289
|
note(`${gezel.name} joined the project as ${gezel.role ?? templateId}.`);
|
|
@@ -4684,6 +4716,7 @@ import { Box as Box7, Text as Text7, useApp as useApp2, useInput as useInput5 }
|
|
|
4684
4716
|
import { useCallback as useCallback3, useEffect as useEffect5, useState as useState6 } from "react";
|
|
4685
4717
|
|
|
4686
4718
|
// src/run-readiness.ts
|
|
4719
|
+
import { resolveOnDeviceProvider as resolveOnDeviceProvider2 } from "@bendyline/gezel/native";
|
|
4687
4720
|
async function settledFirstRunConfig(client, options = {}) {
|
|
4688
4721
|
const attempts = options.attempts ?? 12;
|
|
4689
4722
|
const delayMs = options.delayMs ?? 250;
|
|
@@ -4751,12 +4784,19 @@ function BootstrapGate(props) {
|
|
|
4751
4784
|
client.getVideoModelFit().catch(() => null)
|
|
4752
4785
|
]);
|
|
4753
4786
|
const installedIds = new Set(installedChat.models.map((model) => model.id));
|
|
4787
|
+
const candidates = chatModelCandidates(context.chatCatalog, context.device, context.provider);
|
|
4754
4788
|
const rankedChatModels = rankChatModels(
|
|
4755
4789
|
context.chatCatalog,
|
|
4756
4790
|
context.device,
|
|
4757
4791
|
context.provider
|
|
4758
4792
|
);
|
|
4759
4793
|
const recommendedChatModel = rankedChatModels[0];
|
|
4794
|
+
const installedInOrder = orderInstalledChatModels(
|
|
4795
|
+
installedChat.models,
|
|
4796
|
+
rankedChatModels,
|
|
4797
|
+
candidates
|
|
4798
|
+
);
|
|
4799
|
+
const leadInstalled = installedInOrder.find((model) => runsHere(model.id, candidates));
|
|
4760
4800
|
const chatModels = rankedChatModels.filter((model) => !installedIds.has(model.id));
|
|
4761
4801
|
const catalogAttributions = new Map(
|
|
4762
4802
|
context.chatCatalog.flatMap(
|
|
@@ -4789,11 +4829,12 @@ function BootstrapGate(props) {
|
|
|
4789
4829
|
kind: "model-choice",
|
|
4790
4830
|
plan: {
|
|
4791
4831
|
context,
|
|
4792
|
-
installedChatModels:
|
|
4832
|
+
installedChatModels: installedInOrder.map((model) => {
|
|
4793
4833
|
const attribution = catalogAttributions.get(model.id);
|
|
4794
4834
|
return { ...model, ...attribution ? { attribution } : {} };
|
|
4795
4835
|
}),
|
|
4796
4836
|
...recommendedChatModel ? { recommendedChatModel } : {},
|
|
4837
|
+
...leadInstalled ? { leadInstalledId: leadInstalled.id } : {},
|
|
4797
4838
|
chatModels,
|
|
4798
4839
|
accessories
|
|
4799
4840
|
}
|
|
@@ -5016,7 +5057,7 @@ function BootstrapGate(props) {
|
|
|
5016
5057
|
);
|
|
5017
5058
|
const workshopDownloadBytes = accessoryBytes + (best && !bestInstalled ? best.approxSizeBytes : 0);
|
|
5018
5059
|
const workshopHelperLabels = screen.plan.accessories.map(accessoryKindLabel).join(", ");
|
|
5019
|
-
const
|
|
5060
|
+
const recommendedOptions = [
|
|
5020
5061
|
...best ? [
|
|
5021
5062
|
{
|
|
5022
5063
|
label: `Recommended \u2014 ${bestInstalled ? "Use" : "Download"} ${bootstrapChatModelLabel(best)}`,
|
|
@@ -5030,12 +5071,16 @@ function BootstrapGate(props) {
|
|
|
5030
5071
|
value: "bundle"
|
|
5031
5072
|
}
|
|
5032
5073
|
] : []
|
|
5033
|
-
] : []
|
|
5034
|
-
|
|
5035
|
-
|
|
5036
|
-
|
|
5037
|
-
|
|
5038
|
-
}
|
|
5074
|
+
] : []
|
|
5075
|
+
];
|
|
5076
|
+
const installedOptions = screen.plan.installedChatModels.filter((model) => model.id !== best?.id).map((model) => ({
|
|
5077
|
+
label: `Use ${model.name ?? model.id}${model.attribution ? ` (${model.attribution})` : ""}`,
|
|
5078
|
+
hint: `${model.id === screen.plan.leadInstalledId ? "already on this machine, no download" : "already available on this machine"}${model.approxSizeBytes ? ` \xB7 ${formatDownloadSize(model.approxSizeBytes)}` : ""}`,
|
|
5079
|
+
value: `installed:${model.id}`
|
|
5080
|
+
}));
|
|
5081
|
+
const leadIsInstalled = screen.plan.leadInstalledId !== void 0 && screen.plan.leadInstalledId !== best?.id;
|
|
5082
|
+
const options = [
|
|
5083
|
+
...leadIsInstalled ? [...installedOptions, ...recommendedOptions] : [...recommendedOptions, ...installedOptions],
|
|
5039
5084
|
...screen.plan.chatModels.filter((model) => model.id !== best?.id).slice(0, MAX_ALTERNATIVE_MODELS).map((model) => ({
|
|
5040
5085
|
label: `Download ${bootstrapChatModelLabel(model)} only`,
|
|
5041
5086
|
hint: `${formatDownloadSize(model.approxSizeBytes)} \xB7 ${fitLabel(model.fit)}`,
|
|
@@ -5112,16 +5157,6 @@ function BootstrapFrame(props) {
|
|
|
5112
5157
|
/* @__PURE__ */ jsx6(Text7, { dimColor: true, children: "Ctrl+C exit" })
|
|
5113
5158
|
] });
|
|
5114
5159
|
}
|
|
5115
|
-
function recoDevice(memory) {
|
|
5116
|
-
return {
|
|
5117
|
-
platform: memory.platform,
|
|
5118
|
-
gpuVramBytes: memory.gpuVramBytes,
|
|
5119
|
-
...memory.gpuMemoryKind ? { gpuMemoryKind: memory.gpuMemoryKind } : {},
|
|
5120
|
-
totalRamBytes: memory.totalRamBytes,
|
|
5121
|
-
usableBytes: memory.usableBytes,
|
|
5122
|
-
...memory.budgetBytes !== void 0 ? { budgetBytes: memory.budgetBytes } : {}
|
|
5123
|
-
};
|
|
5124
|
-
}
|
|
5125
5160
|
function BootstrapChoiceList(props) {
|
|
5126
5161
|
const [index, setIndex] = useState6(0);
|
|
5127
5162
|
const options = props.options;
|
|
@@ -5325,7 +5360,7 @@ import { appendFile, mkdir as mkdir2 } from "fs/promises";
|
|
|
5325
5360
|
import { join as join2 } from "path";
|
|
5326
5361
|
import { performance } from "perf_hooks";
|
|
5327
5362
|
import { getHeapStatistics } from "v8";
|
|
5328
|
-
import { gezelHome, gezelPaths as gezelPaths2 } from "@bendyline/gezel/paths";
|
|
5363
|
+
import { gezelHome as gezelHome2, gezelPaths as gezelPaths2 } from "@bendyline/gezel/paths";
|
|
5329
5364
|
var DEFAULT_SAMPLE_INTERVAL_MS = 15e3;
|
|
5330
5365
|
var DEFAULT_MEASURE_LIMIT = 2e3;
|
|
5331
5366
|
var DEFAULT_PRESSURE_HEAP_BYTES = 256 * 1024 * 1024;
|
|
@@ -5338,7 +5373,7 @@ function clearRetainedPerformanceMeasures(timeline = performance, limit = DEFAUL
|
|
|
5338
5373
|
return count;
|
|
5339
5374
|
}
|
|
5340
5375
|
function startTuiRuntimeDiagnostics(options = {}) {
|
|
5341
|
-
const home = options.home ??
|
|
5376
|
+
const home = options.home ?? gezelHome2();
|
|
5342
5377
|
const logsDir = gezelPaths2(home).logs;
|
|
5343
5378
|
const timeline = options.timeline ?? performance;
|
|
5344
5379
|
const measureLimit = options.performanceMeasureLimit ?? DEFAULT_MEASURE_LIMIT;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bendyline/gezel-cli",
|
|
3
|
-
"version": "1.2.
|
|
4
|
-
"description": "The
|
|
3
|
+
"version": "1.2.6",
|
|
4
|
+
"description": "The gezel command-line tool: chat with your gezels, run craftbooks, and manage local models from the terminal.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"gezel",
|
|
@@ -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.6",
|
|
48
|
+
"@bendyline/gezel-app-sdk": "1.1.6",
|
|
49
|
+
"@bendyline/gezel-catalog": "1.2.6",
|
|
50
|
+
"@bendyline/gezel-client": "1.2.6",
|
|
51
|
+
"@bendyline/gezel-knowledge": "1.2.6",
|
|
52
|
+
"@bendyline/gezel-service": "1.2.6",
|
|
53
|
+
"@bendyline/squisq": "2.11.20",
|
|
54
|
+
"@bendyline/squisq-formats": "2.6.21",
|
|
55
|
+
"@bendyline/squisq-react": "2.11.25",
|
|
56
56
|
"commander": "^15.0.0",
|
|
57
57
|
"ink": "^7.1.1",
|
|
58
58
|
"ink-text-input": "^6.0.0",
|