@bendyline/gezel-cli 1.3.0 → 1.3.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/README.md +15 -3
- package/dist/app-author-command.js +2 -2
- package/dist/bin/gezel-main.js +232 -50
- package/dist/handboek-export.js +65 -3
- package/dist/knowledge-command.js +29 -9
- package/dist/tui/index.js +5 -2
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -65,7 +65,7 @@ Run `gezel --help`, or `--help` on any command, for every option.
|
|
|
65
65
|
| Command | What it does |
|
|
66
66
|
|---|---|
|
|
67
67
|
| `gezel` | Open the interactive terminal app for this folder's project |
|
|
68
|
-
| `gezel run [prompt…]` | One prompt, one reply, using this project's crew lead unless you pass `--gezel <id>`. A sole `-` reads the prompt from stdin |
|
|
68
|
+
| `gezel run [prompt…]` | One prompt, one reply, using this project's crew lead unless you pass `--gezel <id>`. A sole `-` reads the prompt from stdin; with a prompt, piped or redirected text is sent after it |
|
|
69
69
|
| `gezel do <craftbook…>` | Start a craftbook as a task in this folder's project: its name, then required values, `key=value` parameters, and your request. `--wait` follows it to the end |
|
|
70
70
|
| `gezel <craftbook> …` | Shorthand for `gezel do <craftbook> …`, matched exactly on the craftbook's command name; built-in commands always win |
|
|
71
71
|
| `gezel craftbook list [words…]` | List the craftbooks `gezel do` can start in this folder's project (command name, title, category); words filter by command, title, and tags. `--json` for scripts |
|
|
@@ -74,14 +74,14 @@ Run `gezel --help`, or `--help` on any command, for every option.
|
|
|
74
74
|
| `gezel task list\|show\|create` | Tasks across every project |
|
|
75
75
|
| `gezel task wait\|resume\|pause <ref>` | Follow a task to the end, retry a paused task and follow it, or pause one task. Waiting prints where the result is; `--out <dir>` copies it |
|
|
76
76
|
| `gezel task notes <ref>` | A task's notes, including pause reasons and failed checks (`--warnings` adds runtime warnings) |
|
|
77
|
-
| `gezel agent list\|create\|show\|output-limit` | Manage your crew (the command name is historical) |
|
|
77
|
+
| `gezel agent list\|create\|show\|output-limit` | Manage your crew (the command name is historical); `show` and `output-limit` take a crew member's id or name |
|
|
78
78
|
| `gezel project list\|create\|install\|indexing\|edits` | Manage projects, their npm packages, background indexing, and whether Gezel may change files in the folder (`gezel env` is the same command) |
|
|
79
79
|
| `gezel integrations list\|approve\|deny\|token` | The apps connected to this Gezel: answer one that asked to connect, or make and revoke app keys |
|
|
80
80
|
| `gezel integrations address` | Where other programs reach this Gezel's models |
|
|
81
81
|
| `gezel integrations ollama [on\|off]` | A plain-HTTP port on this computer that needs no key (`http://127.0.0.1:11434/v1`, and Ollama's own paths); off until you turn it on |
|
|
82
82
|
| `gezel skills list\|import\|convert` | Find SKILL.md skills and turn them into craftbooks |
|
|
83
83
|
| `gezel app …` | Build, install, apply, and serve AI Apps (`.gezapp`): `new`, `validate`, `pack`, `add`, `update`, `list`, `show`, `apply`, `status`, `serve`, `enable`, `disable`, `remove`, `schemas` |
|
|
84
|
-
| `gezel model list\|pull\|use\|export` | On-device chat models. `list --available` shows the catalog models that fit this machine, with sizes; `pull <id>` downloads one, plus the engine it runs on if that is missing; `use <id>` makes chats use a downloaded model (a pull does this itself when no working default is set); `export <id> [file]` writes a portable, checksum-verified `.gezmodel` |
|
|
84
|
+
| `gezel model list\|pull\|use\|export` | On-device chat models. `list` marks the one chats use and the ones another Gezel on this computer shares; `list --available` shows the catalog models that fit this machine, with sizes; `pull <id>` downloads one, plus the engine it runs on if that is missing, and downloads nothing when a shared copy is already here; `use <id>` makes chats use a downloaded model (a pull does this itself when no working default is set); `export <id> [file]` writes a portable, checksum-verified `.gezmodel` |
|
|
85
85
|
| `gezel model context\|concurrency` | A local model's context window, and how many requests a local engine serves at once |
|
|
86
86
|
| `gezel native install\|list\|status` | The native engines that run models on this computer |
|
|
87
87
|
| `gezel image status\|models\|pull\|rm` | Image-generation models |
|
|
@@ -140,6 +140,18 @@ stderr. Empty input exits with status 1 before anything starts. Without a sole
|
|
|
140
140
|
usage. Until a model is set up, `run` downloads nothing: it names the setup
|
|
141
141
|
commands and exits.
|
|
142
142
|
|
|
143
|
+
With a prompt in its arguments, `run` also sends text piped or redirected to
|
|
144
|
+
it, after the prompt and a blank line:
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
gezel run "Summarize these notes for the board" < notes.txt
|
|
148
|
+
git diff | gezel run "Write a commit message for this change"
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
A terminal is never read, and a pipe that sends nothing within a moment is
|
|
152
|
+
left unread so a script that keeps stdin open never waits on it. For a slow
|
|
153
|
+
producer, put the whole prompt in the input and use `gezel run -`.
|
|
154
|
+
|
|
143
155
|
## Provider keys
|
|
144
156
|
|
|
145
157
|
Provider keys go into the same credential store the desktop app uses, read from
|
|
@@ -336,7 +336,7 @@ The loop:
|
|
|
336
336
|
1. Edit the files under \`items/\` (schemas: \`gezel app schemas --out schemas\`).
|
|
337
337
|
2. \`gezel app validate .\`
|
|
338
338
|
3. \`gezel app pack .\`
|
|
339
|
-
4. \`gezel app add ${id}-1.0.0.gezapp --yes\` then \`gezel app apply ${id}\` in a project folder.
|
|
339
|
+
4. \`gezel app add ${id}-1.0.0.gezapp --yes\` then \`gezel app apply ${id} --yes\` in a project folder.
|
|
340
340
|
|
|
341
341
|
The keeper uses \`add_record\` to update the seeded \`data.json\` through
|
|
342
342
|
\`records-store\`. Read failures are errors; they never reset existing data.
|
|
@@ -747,7 +747,7 @@ async function runAppNew(id, opts = {}) {
|
|
|
747
747
|
console.log(" 1. Edit items/ \u2014 start with the two about.md files and the version manifest.");
|
|
748
748
|
console.log(` 2. gezel app validate ${id}`);
|
|
749
749
|
console.log(` 3. gezel app pack ${id}`);
|
|
750
|
-
console.log(` 4. gezel app add ${id}-1.0.0.gezapp --yes && gezel app apply ${id}`);
|
|
750
|
+
console.log(` 4. gezel app add ${id}-1.0.0.gezapp --yes && gezel app apply ${id} --yes`);
|
|
751
751
|
}
|
|
752
752
|
async function runAppSchemas(opts = {}) {
|
|
753
753
|
const files = renderGezappAuthoringSchemaFiles();
|
package/dist/bin/gezel-main.js
CHANGED
|
@@ -314,7 +314,14 @@ async function connectForRun(globals) {
|
|
|
314
314
|
process.env.GEZEL_SKIP_SYSTEM_BOOTSTRAP = "1";
|
|
315
315
|
}
|
|
316
316
|
const { startService } = await import("@bendyline/gezel-service");
|
|
317
|
-
const
|
|
317
|
+
const levelBeforeService = getLogLevel();
|
|
318
|
+
if (!process.env.GEZEL_LOG_LEVEL) setLogLevel("info");
|
|
319
|
+
const svc = await startService({ port: 0, role: "user", logOutput: "file" }).catch(
|
|
320
|
+
(error) => {
|
|
321
|
+
setLogLevel(levelBeforeService);
|
|
322
|
+
throw error;
|
|
323
|
+
}
|
|
324
|
+
);
|
|
318
325
|
const scheme = svc.cert ? "https" : "http";
|
|
319
326
|
const baseUrl = `${scheme}://127.0.0.1:${svc.port}`;
|
|
320
327
|
const client = new GezelClient({
|
|
@@ -328,7 +335,11 @@ async function connectForRun(globals) {
|
|
|
328
335
|
let stopPromise;
|
|
329
336
|
const stop = () => {
|
|
330
337
|
stopPromise ??= (async () => {
|
|
331
|
-
|
|
338
|
+
try {
|
|
339
|
+
await svc.stop();
|
|
340
|
+
} finally {
|
|
341
|
+
setLogLevel(levelBeforeService);
|
|
342
|
+
}
|
|
332
343
|
try {
|
|
333
344
|
const paths = gezelPaths();
|
|
334
345
|
const pid = (await readFile(paths.runtime.pid, "utf8")).trim();
|
|
@@ -1351,6 +1362,7 @@ import {
|
|
|
1351
1362
|
import { resolveOnDeviceProvider } from "@bendyline/gezel/native";
|
|
1352
1363
|
|
|
1353
1364
|
// src/model-pull.ts
|
|
1365
|
+
import { dirname as dirname2 } from "path";
|
|
1354
1366
|
async function pullChatModel(client, engine, id, writeProgress) {
|
|
1355
1367
|
let lastPct = -1;
|
|
1356
1368
|
let pullError;
|
|
@@ -1381,6 +1393,16 @@ async function pullChatModel(client, engine, id, writeProgress) {
|
|
|
1381
1393
|
else await client.installLlamaCppModel(id, onEvent);
|
|
1382
1394
|
if (pullError) throw new CliError(`download failed: ${pullError}`);
|
|
1383
1395
|
}
|
|
1396
|
+
async function findSharedModel(client, engine, id) {
|
|
1397
|
+
if (engine === "mlx") {
|
|
1398
|
+
const { models: models2 } = await client.listMlxModels();
|
|
1399
|
+
const found2 = models2.find((model2) => model2.id === id && model2.readOnly === true);
|
|
1400
|
+
return found2 ? { location: found2.modelDir, updateAvailable: found2.updateAvailable === true } : null;
|
|
1401
|
+
}
|
|
1402
|
+
const { models } = engine === "ds4" ? await client.listDs4Models() : await client.listLlamaCppModels();
|
|
1403
|
+
const found = models.find((model2) => model2.id === id && model2.readOnly === true);
|
|
1404
|
+
return found ? { location: dirname2(found.weightsPath), updateAvailable: found.updateAvailable === true } : null;
|
|
1405
|
+
}
|
|
1384
1406
|
async function waitForMlxRuntime(client, writeProgress, options = {}) {
|
|
1385
1407
|
const pollMs = options.pollMs ?? 1e3;
|
|
1386
1408
|
const now = options.now ?? Date.now;
|
|
@@ -2006,6 +2028,32 @@ async function installedChatModels(client, engine) {
|
|
|
2006
2028
|
const { models } = engine === "mlx" ? await client.listMlxModels() : engine === "ds4" ? await client.listDs4Models() : await client.listLlamaCppModels();
|
|
2007
2029
|
return models.map((model2) => model2.id);
|
|
2008
2030
|
}
|
|
2031
|
+
function chatModelInUse(config, engine, listedIds) {
|
|
2032
|
+
if (config.provider !== engine) return void 0;
|
|
2033
|
+
const external = engine === "mlx" ? config.mlxBaseUrl || config.mlxModelPath : engine === "ds4" ? config.ds4BaseUrl || config.ds4ModelPath : config.llamaCppBaseUrl || config.llamaCppModelPath;
|
|
2034
|
+
if (external) return void 0;
|
|
2035
|
+
const pinned = config.defaultModel?.[engine];
|
|
2036
|
+
if (pinned && listedIds.includes(pinned)) return pinned;
|
|
2037
|
+
if (pinned && engine === "mlx") return void 0;
|
|
2038
|
+
return listedIds[0];
|
|
2039
|
+
}
|
|
2040
|
+
function formatInstalledChatModels(engine, models, config) {
|
|
2041
|
+
if (models.length === 0) {
|
|
2042
|
+
return `(no local ${engine} models \u2014 \`gezel model list --available\` shows ones to download)`;
|
|
2043
|
+
}
|
|
2044
|
+
const inUse = chatModelInUse(
|
|
2045
|
+
config,
|
|
2046
|
+
engine,
|
|
2047
|
+
models.map((model2) => model2.id)
|
|
2048
|
+
);
|
|
2049
|
+
const width = Math.max(28, ...models.map((model2) => model2.id.length));
|
|
2050
|
+
return models.map((model2) => {
|
|
2051
|
+
const notes = [model2.readOnly ? "shared" : "", model2.id === inUse ? "in use" : ""].filter(
|
|
2052
|
+
Boolean
|
|
2053
|
+
);
|
|
2054
|
+
return `${model2.id.padEnd(width)} ${(model2.approxSizeBytes / 1e9).toFixed(2).padStart(6)} GB ${model2.name}${notes.length > 0 ? ` (${notes.join(", ")})` : ""}`;
|
|
2055
|
+
}).join("\n");
|
|
2056
|
+
}
|
|
2009
2057
|
function providerFlag(engine, platformDefault) {
|
|
2010
2058
|
return engine === platformDefault ? "" : ` --provider ${engine}`;
|
|
2011
2059
|
}
|
|
@@ -2026,17 +2074,17 @@ async function availableChatModels(client, engine) {
|
|
|
2026
2074
|
client.getConfig(),
|
|
2027
2075
|
client.getNativeEngineStatus?.().catch(() => void 0)
|
|
2028
2076
|
]);
|
|
2029
|
-
const
|
|
2077
|
+
const inUse = chatModelInUse(config, engine, installed);
|
|
2030
2078
|
const gpuUnmeasured = engine === "llama-cpp" && memory.source === "system-ram-fallback" && !!native2?.platformKey && !native2.engines.some((entry) => entry.name === "llama-server" && entry.installed);
|
|
2031
2079
|
return {
|
|
2032
2080
|
ranked: rankChatModels(catalog.items, recoDevice(memory), engine),
|
|
2033
2081
|
installed: new Set(installed),
|
|
2034
|
-
...
|
|
2082
|
+
...inUse ? { inUse } : {},
|
|
2035
2083
|
...gpuUnmeasured ? { gpuUnmeasured } : {}
|
|
2036
2084
|
};
|
|
2037
2085
|
}
|
|
2038
2086
|
function formatAvailableChatModels(input) {
|
|
2039
|
-
const { engine, ranked, installed,
|
|
2087
|
+
const { engine, ranked, installed, inUse, measured, gpuUnmeasured } = input;
|
|
2040
2088
|
if (ranked.length === 0) return `(no ${engine} chat models in the catalog for this machine)`;
|
|
2041
2089
|
const width = Math.max(...ranked.map((model2) => model2.id.length));
|
|
2042
2090
|
const measuredWidth = measured ? Math.max("not measured".length, ...ranked.map((m) => (measured.get(m.id) ?? "").length)) : 0;
|
|
@@ -2047,7 +2095,7 @@ function formatAvailableChatModels(input) {
|
|
|
2047
2095
|
const notes = [
|
|
2048
2096
|
index === 0 && !gpuUnmeasured ? "recommended" : "",
|
|
2049
2097
|
installed.has(model2.id) ? "installed" : "",
|
|
2050
|
-
model2.id ===
|
|
2098
|
+
model2.id === inUse ? "in use" : ""
|
|
2051
2099
|
].filter(Boolean);
|
|
2052
2100
|
const claim = measured ? ` ${(measured.get(model2.id) ?? "not measured").padEnd(measuredWidth)}` : "";
|
|
2053
2101
|
lines.push(
|
|
@@ -2801,6 +2849,7 @@ import {
|
|
|
2801
2849
|
paramAsksUser,
|
|
2802
2850
|
paramInputSpec,
|
|
2803
2851
|
projectManagedWorkspaceWritable as projectManagedWorkspaceWritable2,
|
|
2852
|
+
projectManagedWorkspaceWritePolicy,
|
|
2804
2853
|
stepWorkspaceDeliverableFiles
|
|
2805
2854
|
} from "@bendyline/gezel";
|
|
2806
2855
|
|
|
@@ -2951,32 +3000,37 @@ function nameFolderFiles(files) {
|
|
|
2951
3000
|
}
|
|
2952
3001
|
async function ensureProjectEdits(client, options) {
|
|
2953
3002
|
const files = craftbookFolderFiles(options.craftbook);
|
|
2954
|
-
if (files.length === 0) return;
|
|
3003
|
+
if (files.length === 0) return null;
|
|
2955
3004
|
const project = await client.getProject(options.projectId);
|
|
2956
|
-
if (projectManagedWorkspaceWritable2(project)) return;
|
|
3005
|
+
if (projectManagedWorkspaceWritable2(project)) return null;
|
|
2957
3006
|
const what = nameFolderFiles(files);
|
|
2958
3007
|
const where = project.workingDir ?? "this project";
|
|
3008
|
+
const before = projectManagedWorkspaceWritePolicy(project);
|
|
2959
3009
|
const turnOn = async () => {
|
|
2960
3010
|
await client.updateProject(options.projectId, { managedWorkspaceWritePolicy: "allow" });
|
|
3011
|
+
return async () => {
|
|
3012
|
+
await client.updateProject(options.projectId, { managedWorkspaceWritePolicy: before });
|
|
3013
|
+
};
|
|
2961
3014
|
};
|
|
2962
3015
|
if (options.allow) {
|
|
2963
|
-
await turnOn();
|
|
3016
|
+
const undo = await turnOn();
|
|
2964
3017
|
options.write(`Gezel may now change files in ${where} (--allow-edits).
|
|
2965
3018
|
`);
|
|
2966
|
-
return;
|
|
3019
|
+
return undo;
|
|
2967
3020
|
}
|
|
2968
3021
|
const saves = `${options.craftbook.name} saves ${what} into ${where}, and Gezel may not change files there yet.`;
|
|
2969
3022
|
if (options.prompter) {
|
|
2970
3023
|
if (await options.prompter.confirm(`${saves} Allow it? [y/N] `)) {
|
|
2971
|
-
await turnOn();
|
|
3024
|
+
const undo = await turnOn();
|
|
2972
3025
|
options.write("Project edits: on\n");
|
|
2973
|
-
return;
|
|
3026
|
+
return undo;
|
|
2974
3027
|
}
|
|
2975
3028
|
}
|
|
2976
3029
|
options.write(
|
|
2977
3030
|
`${saves} If it stops for that, run \`${PROJECT_EDITS_CLI_COMMAND}\` here, or start it with --allow-edits.
|
|
2978
3031
|
`
|
|
2979
3032
|
);
|
|
3033
|
+
return null;
|
|
2980
3034
|
}
|
|
2981
3035
|
function taskInputFailure(err, book, params) {
|
|
2982
3036
|
if (!(err instanceof Error) || err.name !== "GezelApiError") return null;
|
|
@@ -3435,7 +3489,7 @@ import {
|
|
|
3435
3489
|
|
|
3436
3490
|
// src/generate.ts
|
|
3437
3491
|
import { mkdir as mkdir2, readFile as readFile4, writeFile as writeFile3 } from "fs/promises";
|
|
3438
|
-
import { basename as basename2, dirname as
|
|
3492
|
+
import { basename as basename2, dirname as dirname3, resolve as resolve2 } from "path";
|
|
3439
3493
|
async function resolvePromptText(parts, file, label) {
|
|
3440
3494
|
const inline = (parts ?? []).join(" ").trim();
|
|
3441
3495
|
if (file) {
|
|
@@ -3490,7 +3544,7 @@ async function saveArtifact(client, projectId, artifactPath, output) {
|
|
|
3490
3544
|
const blob = await client.fetchProjectArtifactBlob(projectId, rel);
|
|
3491
3545
|
const bytes = Buffer.from(await blob.arrayBuffer());
|
|
3492
3546
|
const dest = output ? resolve2(output) : resolve2(process.cwd(), basename2(artifactPath));
|
|
3493
|
-
await mkdir2(
|
|
3547
|
+
await mkdir2(dirname3(dest), { recursive: true });
|
|
3494
3548
|
await writeFile3(dest, bytes);
|
|
3495
3549
|
return dest;
|
|
3496
3550
|
}
|
|
@@ -3768,7 +3822,7 @@ function registerMcpCommands(program2, connect, output = console.log) {
|
|
|
3768
3822
|
// src/model-export.ts
|
|
3769
3823
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
3770
3824
|
import { rename, rm as rm2, stat } from "fs/promises";
|
|
3771
|
-
import { basename as basename3, dirname as
|
|
3825
|
+
import { basename as basename3, dirname as dirname4, isAbsolute, resolve as resolve4 } from "path";
|
|
3772
3826
|
import {
|
|
3773
3827
|
modelBytesFromResponse,
|
|
3774
3828
|
portableGezmodelFilename,
|
|
@@ -3811,8 +3865,8 @@ async function exportModelToFile(client, id, options) {
|
|
|
3811
3865
|
if (!options.force && await isExistingFile(target)) {
|
|
3812
3866
|
throw new CliError(`${target} already exists. Pass --force to overwrite it.`);
|
|
3813
3867
|
}
|
|
3814
|
-
if (!await isExistingDirectory(
|
|
3815
|
-
throw new CliError(`${
|
|
3868
|
+
if (!await isExistingDirectory(dirname4(target))) {
|
|
3869
|
+
throw new CliError(`${dirname4(target)} does not exist.`);
|
|
3816
3870
|
}
|
|
3817
3871
|
let pulled = false;
|
|
3818
3872
|
if (!await isInstalled(client, engine, id)) {
|
|
@@ -3886,15 +3940,28 @@ function progressWriter(stream, options = {}) {
|
|
|
3886
3940
|
stream.write(text);
|
|
3887
3941
|
};
|
|
3888
3942
|
}
|
|
3889
|
-
const intervalMs = options.intervalMs ??
|
|
3943
|
+
const intervalMs = options.intervalMs ?? 6e4;
|
|
3890
3944
|
const now = options.now ?? Date.now;
|
|
3891
3945
|
let lastLine = "";
|
|
3892
3946
|
let lastAt = Number.NEGATIVE_INFINITY;
|
|
3947
|
+
let series;
|
|
3893
3948
|
return (text) => {
|
|
3894
3949
|
const finished = text.endsWith("\n");
|
|
3895
3950
|
const line = text.replace(/\r/g, "").trim();
|
|
3896
3951
|
if (!line || line === lastLine) return;
|
|
3897
|
-
if (
|
|
3952
|
+
if (finished) {
|
|
3953
|
+
series = void 0;
|
|
3954
|
+
} else {
|
|
3955
|
+
const percent = /(\d{1,3})%/.exec(line);
|
|
3956
|
+
if (percent) {
|
|
3957
|
+
const label = line.slice(0, percent.index).replace(/\d+/g, "#").trim();
|
|
3958
|
+
const quarter = Math.floor(Number(percent[1]) / 25);
|
|
3959
|
+
if (series?.label === label && (quarter <= series.quarter || quarter > 3)) return;
|
|
3960
|
+
series = { label, quarter };
|
|
3961
|
+
} else if (now() - lastAt < intervalMs) {
|
|
3962
|
+
return;
|
|
3963
|
+
}
|
|
3964
|
+
}
|
|
3898
3965
|
stream.write(`${line}
|
|
3899
3966
|
`);
|
|
3900
3967
|
lastLine = line;
|
|
@@ -3964,6 +4031,19 @@ async function resolveRunGezel(client, ref) {
|
|
|
3964
4031
|
}
|
|
3965
4032
|
throw new CliError(`No crew member matches "${ref}". Run \`gezel agent list\` to see your crew.`);
|
|
3966
4033
|
}
|
|
4034
|
+
async function resolveCrewMember(client, ref) {
|
|
4035
|
+
const wanted = ref.trim();
|
|
4036
|
+
const { gezels } = await client.listGezels();
|
|
4037
|
+
const byId = gezels.find((gezel) => gezel.id === wanted);
|
|
4038
|
+
if (byId) return byId.id;
|
|
4039
|
+
const query = wanted.toLowerCase();
|
|
4040
|
+
const sameName = gezels.filter((gezel) => gezel.name.trim().toLowerCase() === query);
|
|
4041
|
+
if (sameName.length === 1) return sameName[0].id;
|
|
4042
|
+
if (sameName.length > 1) throw ambiguous(ref, sameName);
|
|
4043
|
+
throw new CliError(
|
|
4044
|
+
`No crew member with the id or name "${ref}". Run \`gezel agent list\` to see your crew.`
|
|
4045
|
+
);
|
|
4046
|
+
}
|
|
3967
4047
|
function ambiguous(ref, candidates) {
|
|
3968
4048
|
const listed = candidates.map((gezel) => `${gezel.name} (${gezel.id})`).join(", ");
|
|
3969
4049
|
return new CliError(
|
|
@@ -4031,15 +4111,47 @@ var RunProgress = class {
|
|
|
4031
4111
|
};
|
|
4032
4112
|
|
|
4033
4113
|
// src/run-prompt.ts
|
|
4034
|
-
|
|
4114
|
+
import { fstatSync } from "fs";
|
|
4115
|
+
var PIPED_FIRST_DATA_MS = 200;
|
|
4116
|
+
var S_IFMT = 61440;
|
|
4117
|
+
var S_IFREG = 32768;
|
|
4118
|
+
var S_IFIFO = 4096;
|
|
4119
|
+
var S_IFSOCK = 49152;
|
|
4120
|
+
function detectStdinKind(stat2 = fstatSync, isTTY = process.stdin.isTTY) {
|
|
4121
|
+
if (isTTY) return "tty";
|
|
4122
|
+
let type;
|
|
4123
|
+
try {
|
|
4124
|
+
type = stat2(0).mode & S_IFMT;
|
|
4125
|
+
} catch {
|
|
4126
|
+
return "none";
|
|
4127
|
+
}
|
|
4128
|
+
if (type === S_IFREG) return "file";
|
|
4129
|
+
if (type === S_IFIFO || type === S_IFSOCK) return "pipe";
|
|
4130
|
+
return "none";
|
|
4131
|
+
}
|
|
4132
|
+
async function resolveRunPrompt(parts, input = process.stdin, options = {}) {
|
|
4035
4133
|
if (parts?.length !== 1 || parts[0] !== "-") {
|
|
4036
4134
|
const prompt2 = (parts ?? []).join(" ").trim();
|
|
4037
4135
|
if (!prompt2) throw new CliError('usage: gezel run "<prompt>" or gezel run -');
|
|
4038
|
-
|
|
4136
|
+
const kind = options.stdinKind ?? (input === process.stdin ? detectStdinKind() : input.isTTY ? "tty" : "none");
|
|
4137
|
+
if (kind !== "file" && kind !== "pipe") return prompt2;
|
|
4138
|
+
const piped = await readPiped(
|
|
4139
|
+
input,
|
|
4140
|
+
kind === "pipe" ? options.firstDataMs ?? PIPED_FIRST_DATA_MS : void 0
|
|
4141
|
+
);
|
|
4142
|
+
return piped?.trim() ? `${prompt2}
|
|
4143
|
+
|
|
4144
|
+
${piped}` : prompt2;
|
|
4039
4145
|
}
|
|
4040
4146
|
if (input.isTTY) {
|
|
4041
4147
|
throw new CliError("gezel run - requires piped input or a redirected file.");
|
|
4042
4148
|
}
|
|
4149
|
+
const prompt = await readAll(input);
|
|
4150
|
+
if (!prompt.trim())
|
|
4151
|
+
throw new CliError("gezel run - received empty input. Supply a prompt on stdin.");
|
|
4152
|
+
return prompt;
|
|
4153
|
+
}
|
|
4154
|
+
async function readAll(input) {
|
|
4043
4155
|
const chunks = [];
|
|
4044
4156
|
try {
|
|
4045
4157
|
for await (const chunk of input) {
|
|
@@ -4050,10 +4162,54 @@ async function resolveRunPrompt(parts, input = process.stdin) {
|
|
|
4050
4162
|
`Could not read prompt from stdin: ${error instanceof Error ? error.message : String(error)}`
|
|
4051
4163
|
);
|
|
4052
4164
|
}
|
|
4053
|
-
|
|
4054
|
-
|
|
4055
|
-
|
|
4056
|
-
|
|
4165
|
+
return Buffer.concat(chunks).toString("utf8");
|
|
4166
|
+
}
|
|
4167
|
+
async function readPiped(input, firstDataMs) {
|
|
4168
|
+
const iterator = input[Symbol.asyncIterator]();
|
|
4169
|
+
let first;
|
|
4170
|
+
try {
|
|
4171
|
+
if (firstDataMs === void 0) {
|
|
4172
|
+
first = await iterator.next();
|
|
4173
|
+
} else {
|
|
4174
|
+
let timer;
|
|
4175
|
+
const silent = new Promise((resolve7) => {
|
|
4176
|
+
timer = setTimeout(() => resolve7("silent"), firstDataMs);
|
|
4177
|
+
});
|
|
4178
|
+
const next = iterator.next();
|
|
4179
|
+
const result = await Promise.race([next, silent]).finally(() => clearTimeout(timer));
|
|
4180
|
+
if (result === "silent") {
|
|
4181
|
+
next.catch(() => {
|
|
4182
|
+
});
|
|
4183
|
+
letGo(input);
|
|
4184
|
+
return void 0;
|
|
4185
|
+
}
|
|
4186
|
+
first = result;
|
|
4187
|
+
}
|
|
4188
|
+
} catch (error) {
|
|
4189
|
+
throw new CliError(
|
|
4190
|
+
`Could not read the piped text from stdin: ${error instanceof Error ? error.message : String(error)}`
|
|
4191
|
+
);
|
|
4192
|
+
}
|
|
4193
|
+
if (first.done) return void 0;
|
|
4194
|
+
const chunks = [toBuffer(first.value)];
|
|
4195
|
+
try {
|
|
4196
|
+
for (let next = await iterator.next(); !next.done; next = await iterator.next()) {
|
|
4197
|
+
chunks.push(toBuffer(next.value));
|
|
4198
|
+
}
|
|
4199
|
+
} catch (error) {
|
|
4200
|
+
throw new CliError(
|
|
4201
|
+
`Could not read the piped text from stdin: ${error instanceof Error ? error.message : String(error)}`
|
|
4202
|
+
);
|
|
4203
|
+
}
|
|
4204
|
+
return Buffer.concat(chunks).toString("utf8");
|
|
4205
|
+
}
|
|
4206
|
+
function toBuffer(chunk) {
|
|
4207
|
+
return Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
|
|
4208
|
+
}
|
|
4209
|
+
function letGo(input) {
|
|
4210
|
+
const stream = input;
|
|
4211
|
+
stream.pause?.();
|
|
4212
|
+
stream.unref?.();
|
|
4057
4213
|
}
|
|
4058
4214
|
|
|
4059
4215
|
// src/run-reply.ts
|
|
@@ -4527,7 +4683,7 @@ function resolveRestoreSelection(review, opts) {
|
|
|
4527
4683
|
// src/task-output.ts
|
|
4528
4684
|
import { constants } from "fs";
|
|
4529
4685
|
import { access, mkdir as mkdir3, writeFile as writeFile4 } from "fs/promises";
|
|
4530
|
-
import { dirname as
|
|
4686
|
+
import { dirname as dirname5, isAbsolute as isAbsolute2, join as join4, relative, resolve as resolve5, sep } from "path";
|
|
4531
4687
|
import { taskDeliverableCandidates } from "@bendyline/gezel";
|
|
4532
4688
|
function madeFiles(files, artifactDir) {
|
|
4533
4689
|
const made = [];
|
|
@@ -4548,7 +4704,7 @@ async function copyTaskOutput(client, projectId, artifactDir, outDir) {
|
|
|
4548
4704
|
const target = join4(root, name);
|
|
4549
4705
|
if (relative(root, target).startsWith("..")) continue;
|
|
4550
4706
|
const blob = await client.fetchProjectArtifactBlob(projectId, path);
|
|
4551
|
-
await mkdir3(
|
|
4707
|
+
await mkdir3(dirname5(target), { recursive: true });
|
|
4552
4708
|
await writeFile4(target, Buffer.from(await blob.arrayBuffer()));
|
|
4553
4709
|
copied.push(name);
|
|
4554
4710
|
}
|
|
@@ -4748,7 +4904,7 @@ async function runWorkflow(client, projectId, workspace, file, args, log = conso
|
|
|
4748
4904
|
...params ? { params } : {},
|
|
4749
4905
|
...book?.paramSchema ? { paramSchema: book.paramSchema } : {},
|
|
4750
4906
|
prompter: terminalPrompter(),
|
|
4751
|
-
write: (
|
|
4907
|
+
write: stderrProgress()
|
|
4752
4908
|
});
|
|
4753
4909
|
return module.run({
|
|
4754
4910
|
client,
|
|
@@ -4841,7 +4997,7 @@ program.name("gezel").description("Gezel \u2014 put AI to work on your files and
|
|
|
4841
4997
|
"Use this folder as the active project (default and bare flag: cwd)."
|
|
4842
4998
|
).option(
|
|
4843
4999
|
"--download",
|
|
4844
|
-
"Download what a command needs (the on-device engine and the recommended model) without asking, printing each step. Also GEZEL_AUTO_DOWNLOAD=1."
|
|
5000
|
+
"Download what a command needs (the on-device engine and the recommended model, or DuckDB for knowledge export-parquet) without asking, printing each step. Also GEZEL_AUTO_DOWNLOAD=1."
|
|
4845
5001
|
);
|
|
4846
5002
|
var cliGlobals = () => program.opts();
|
|
4847
5003
|
var connectForInspection = (opts) => opts.start === false ? connectRunning(cliGlobals()) : connectOwned(cliGlobals());
|
|
@@ -5349,10 +5505,14 @@ program.command("run [prompt...]").description("Send a prompt to Gezel and print
|
|
|
5349
5505
|
`
|
|
5350
5506
|
Examples:
|
|
5351
5507
|
gezel run "Summarize this project"
|
|
5508
|
+
gezel run "Summarize these notes" < notes.txt
|
|
5352
5509
|
printf 'Summarize these notes:\\nThe launch is Friday.\\n' | gezel run -
|
|
5353
5510
|
gezel run - < prompt.txt
|
|
5354
5511
|
|
|
5355
5512
|
A sole - reads UTF-8 stdin to EOF. Empty input is rejected.
|
|
5513
|
+
With a prompt, text piped or redirected to stdin is sent after it,
|
|
5514
|
+
separated by a blank line. A pipe that sends nothing within a moment is
|
|
5515
|
+
left unread; use - to wait for a slow one.
|
|
5356
5516
|
Replies go to stdout; diagnostics go to stderr.
|
|
5357
5517
|
With no model set up yet, a run in a terminal first offers to download one,
|
|
5358
5518
|
then runs the prompt.`
|
|
@@ -5378,7 +5538,7 @@ then runs the prompt.`
|
|
|
5378
5538
|
const gezelId = opts.gezel ? await resolveRunGezel(client, opts.gezel) : await ensureCliProjectLead(client, projectId);
|
|
5379
5539
|
let readiness = await checkRunReadiness(client, gezelId);
|
|
5380
5540
|
if (!readiness.ready && autoDownloadRequested(cliGlobals())) {
|
|
5381
|
-
await downloadForRun(client, { gezelId, write: (
|
|
5541
|
+
await downloadForRun(client, { gezelId, write: stderrProgress() });
|
|
5382
5542
|
readiness = await checkRunReadiness(client, gezelId);
|
|
5383
5543
|
} else if (!readiness.ready && canOfferRunSetup()) {
|
|
5384
5544
|
const tuiModule = "../tui/index.js";
|
|
@@ -5552,7 +5712,7 @@ Examples:
|
|
|
5552
5712
|
return;
|
|
5553
5713
|
}
|
|
5554
5714
|
await setUp();
|
|
5555
|
-
await ensureProjectEdits(client, {
|
|
5715
|
+
const undoEdits = await ensureProjectEdits(client, {
|
|
5556
5716
|
projectId,
|
|
5557
5717
|
craftbook: craftbook2,
|
|
5558
5718
|
allow: opts.allowEdits === true,
|
|
@@ -5564,7 +5724,8 @@ Examples:
|
|
|
5564
5724
|
...craftbookDoLaunch(craftbook2, parsed),
|
|
5565
5725
|
trustScripts: !opts.strictSandbox,
|
|
5566
5726
|
roleBasedNameOnlyMode: true
|
|
5567
|
-
}).catch((err) => {
|
|
5727
|
+
}).catch(async (err) => {
|
|
5728
|
+
await undoEdits?.().catch(() => void 0);
|
|
5568
5729
|
throw taskInputFailure(err, book, parsed.params) ?? err;
|
|
5569
5730
|
});
|
|
5570
5731
|
if (opts.wait || opts.out) {
|
|
@@ -5716,13 +5877,14 @@ craftbook.command("show <command...>").description("Show what a craftbook does,
|
|
|
5716
5877
|
console.log(opts.json ? JSON.stringify(full) : describeCraftbook(book, full));
|
|
5717
5878
|
});
|
|
5718
5879
|
var agent = program.command("agent").description("Manage your crew (your AI companions)");
|
|
5719
|
-
agent.command("output-limit <
|
|
5720
|
-
"Show or set one crew member's output-token limit, including reasoning; auto clears its override"
|
|
5721
|
-
).option("--json", "Output the override as JSON").action(async (
|
|
5880
|
+
agent.command("output-limit <crew-member> [tokens]").description(
|
|
5881
|
+
"Show or set one crew member's output-token limit (by id or name), including reasoning; auto clears its override"
|
|
5882
|
+
).option("--json", "Output the override as JSON").action(async (ref, tokens, opts) => {
|
|
5722
5883
|
if (tokens !== void 0 && tokens !== "auto" && (!/^\d+$/.test(tokens) || !Number.isSafeInteger(Number(tokens)) || Number(tokens) < 1)) {
|
|
5723
5884
|
throw new CliError("Output limit must be a positive integer, or auto.");
|
|
5724
5885
|
}
|
|
5725
5886
|
const client = await connectOwned(cliGlobals());
|
|
5887
|
+
const id = await resolveCrewMember(client, ref);
|
|
5726
5888
|
const { parsed } = await client.getGezel(id);
|
|
5727
5889
|
const tuning = { ...parsed.frontmatter.tuning };
|
|
5728
5890
|
const sampling = { ...tuning.sampling };
|
|
@@ -5750,8 +5912,9 @@ agent.command("create <name>").description("Add a crew member").option("-d, --de
|
|
|
5750
5912
|
const created = await client.createGezel({ name, ...opts });
|
|
5751
5913
|
console.log(`created crew member ${created.id}`);
|
|
5752
5914
|
});
|
|
5753
|
-
agent.command("show <
|
|
5915
|
+
agent.command("show <crew-member>").description("Show one crew member, by id or name").action(async (ref) => {
|
|
5754
5916
|
const client = await connectOwned(cliGlobals());
|
|
5917
|
+
const id = await resolveCrewMember(client, ref);
|
|
5755
5918
|
const a = await client.getGezel(id).catch((err) => {
|
|
5756
5919
|
throw isNotFound(err) ? new CliError(`No crew member with id "${id}". Run \`gezel agent list\` to see your crew.`) : err;
|
|
5757
5920
|
});
|
|
@@ -5949,8 +6112,21 @@ knowledge.command("export-parquet <path>").description(
|
|
|
5949
6112
|
"DuckDB CLI to use (default: $GEZEL_DUCKDB_BIN or the one gezel installed)"
|
|
5950
6113
|
).action(async (path, opts) => {
|
|
5951
6114
|
const { runKnowledgeExportParquet } = await loadKnowledgeCommand();
|
|
5952
|
-
await runKnowledgeExportParquet(
|
|
6115
|
+
await runKnowledgeExportParquet(
|
|
6116
|
+
path,
|
|
6117
|
+
opts,
|
|
6118
|
+
autoDownloadRequested(cliGlobals()) ? { fetchDuckdb: fetchDuckdbForCli } : {}
|
|
6119
|
+
);
|
|
5953
6120
|
});
|
|
6121
|
+
async function fetchDuckdbForCli() {
|
|
6122
|
+
process.stderr.write("No DuckDB CLI found; downloading it (--download)\u2026\n");
|
|
6123
|
+
const client = await connectOwned(cliGlobals());
|
|
6124
|
+
const status = await installNativeToolkit(client, {
|
|
6125
|
+
engines: ["duckdb"],
|
|
6126
|
+
output: { writeProgress: stderrProgress() }
|
|
6127
|
+
});
|
|
6128
|
+
return status.engines.find((engine) => engine.name === "duckdb" && engine.installed)?.path;
|
|
6129
|
+
}
|
|
5954
6130
|
knowledge.command("search <path> <query>").description("Search a catalog file offline (full-text; --semantic adds vector search)").option("--semantic", "embed the query with the catalog profile (loads the model)").option("--latitude <degrees>", "radius center latitude", Number).option("--longitude <degrees>", "radius center longitude", Number).option("--radius-meters <meters>", "subject radius in meters", Number).option("--limit <n>", "maximum results", (v) => Number.parseInt(v, 10), 10).action(async (path, query, opts) => {
|
|
5955
6131
|
const { runKnowledgeSearch } = await loadKnowledgeCommand();
|
|
5956
6132
|
await runKnowledgeSearch(path, query, opts);
|
|
@@ -6434,18 +6610,11 @@ model.command("list").description("List downloaded chat models, or with --availa
|
|
|
6434
6610
|
);
|
|
6435
6611
|
return;
|
|
6436
6612
|
}
|
|
6437
|
-
const { models } =
|
|
6438
|
-
|
|
6439
|
-
|
|
6440
|
-
|
|
6441
|
-
|
|
6442
|
-
return;
|
|
6443
|
-
}
|
|
6444
|
-
for (const m of models) {
|
|
6445
|
-
console.log(
|
|
6446
|
-
`${m.id.padEnd(28)} ${(m.approxSizeBytes / 1e9).toFixed(2).padStart(6)} GB ${m.name}`
|
|
6447
|
-
);
|
|
6448
|
-
}
|
|
6613
|
+
const [{ models }, config] = await Promise.all([
|
|
6614
|
+
provider === "mlx" ? client.listMlxModels() : provider === "ds4" ? client.listDs4Models() : client.listLlamaCppModels(),
|
|
6615
|
+
client.getConfig()
|
|
6616
|
+
]);
|
|
6617
|
+
console.log(formatInstalledChatModels(provider, models, config));
|
|
6449
6618
|
});
|
|
6450
6619
|
model.command("pull <id>").description(
|
|
6451
6620
|
"Download a local chat model from the catalog (e.g. qwen3.5-2b-q4, about 1.5 GB; `gezel model list --available` shows what fits)"
|
|
@@ -6454,7 +6623,20 @@ model.command("pull <id>").description(
|
|
|
6454
6623
|
const provider = resolveModelProvider(opts.provider);
|
|
6455
6624
|
const progress = stderrProgress();
|
|
6456
6625
|
await ensureModelEngines(client, [provider], progress);
|
|
6457
|
-
await
|
|
6626
|
+
const shared = await findSharedModel(client, provider, id);
|
|
6627
|
+
if (shared) {
|
|
6628
|
+
progress(
|
|
6629
|
+
`${id} is already on this computer in a shared model store, so nothing was downloaded: ${shared.location}
|
|
6630
|
+
`
|
|
6631
|
+
);
|
|
6632
|
+
if (shared.updateAvailable) {
|
|
6633
|
+
progress(
|
|
6634
|
+
"The catalog has a newer version. The Gezel that shares this copy updates it when it updates its models.\n"
|
|
6635
|
+
);
|
|
6636
|
+
}
|
|
6637
|
+
} else {
|
|
6638
|
+
await pullChatModel(client, provider, id, progress);
|
|
6639
|
+
}
|
|
6458
6640
|
if (provider === "mlx") await waitForMlxRuntime(client, progress);
|
|
6459
6641
|
if (await pinPulledModel(client, provider, id) === "pinned") {
|
|
6460
6642
|
process.stderr.write(`${id} is now the default ${provider} model.
|
package/dist/handboek-export.js
CHANGED
|
@@ -1585,6 +1585,7 @@ import {
|
|
|
1585
1585
|
CRAFTBOOK_CATEGORY_META,
|
|
1586
1586
|
SCORECARD,
|
|
1587
1587
|
catalogGroundFor as catalogGroundFor2,
|
|
1588
|
+
docbenchRowsFor,
|
|
1588
1589
|
measuredClaim,
|
|
1589
1590
|
measuredResultFor,
|
|
1590
1591
|
measuredRowsFor,
|
|
@@ -1766,14 +1767,15 @@ function modelCatalogMarkdown(chat, images, videos, scorecard) {
|
|
|
1766
1767
|
"",
|
|
1767
1768
|
`## Chat models (${chat.length})`,
|
|
1768
1769
|
"",
|
|
1769
|
-
"The models Gezel thinks and writes with, recommended first. **Measured** is the share of tasks the model (or another build of it) passed in its most recent full [scorecard](model-scorecard) round, preferring the general set, with the machine that round ran on. Follow it to every round on the model\u2019s page. Rounds are not comparable with each other, and a number from a workstation is not a promise about a laptop.",
|
|
1770
|
+
"The models Gezel thinks and writes with, recommended first. **Measured** is the share of tasks the model (or another build of it) passed in its most recent full [scorecard](model-scorecard) round, preferring the general set, with the machine that round ran on. Follow it to every round on the model\u2019s page. Rounds are not comparable with each other, and a number from a workstation is not a promise about a laptop. **Docbench** is the build\u2019s score from 0 to 100 on DocBlocks\u2019 document work (review, writing, diagrams, slides, study aids) in its newest [docbench](docbench) round.",
|
|
1770
1771
|
"",
|
|
1771
|
-
"| Model | Measured | Size | Context | Tools | Best for | Runs on | License |",
|
|
1772
|
-
"| --- | --- | --- | --- | --- | --- | --- | --- |",
|
|
1772
|
+
"| Model | Measured | Docbench | Size | Context | Tools | Best for | Runs on | License |",
|
|
1773
|
+
"| --- | --- | --- | --- | --- | --- | --- | --- | --- |",
|
|
1773
1774
|
...chat.map(
|
|
1774
1775
|
(m) => row([
|
|
1775
1776
|
`[${cell(m.name)}](model/${m.id})`,
|
|
1776
1777
|
measuredCell(scorecard, m.id),
|
|
1778
|
+
docbenchCell(scorecard, m.id),
|
|
1777
1779
|
formatGB(m.approxSizeBytes),
|
|
1778
1780
|
formatContext(m.contextWindow),
|
|
1779
1781
|
m.supportsTools === false ? "No" : "Yes",
|
|
@@ -1829,6 +1831,64 @@ function measuredCell(scorecard, modelId) {
|
|
|
1829
1831
|
if (!measured) return "Not yet";
|
|
1830
1832
|
return `[${cell(measuredClaim(measured))}](model/${modelId}#measured-results)`;
|
|
1831
1833
|
}
|
|
1834
|
+
function docbenchCell(scorecard, modelId) {
|
|
1835
|
+
const latest = docbenchRowsFor(scorecard, modelId)[0];
|
|
1836
|
+
if (!latest) return "Not yet";
|
|
1837
|
+
return `[${Math.round(latest.docbench.score)}](model/${modelId}#docbench)`;
|
|
1838
|
+
}
|
|
1839
|
+
var DOCBENCH_FAMILY_LABELS = [
|
|
1840
|
+
["review", "Review and feedback"],
|
|
1841
|
+
["writing", "Writing new content"],
|
|
1842
|
+
["visuals", "Diagrams and illustrations"],
|
|
1843
|
+
["presentations", "Presentations"],
|
|
1844
|
+
["study", "Study aids"],
|
|
1845
|
+
["narration", "Narration cleanup"]
|
|
1846
|
+
];
|
|
1847
|
+
function docbenchResultsMarkdown(scorecard, modelId) {
|
|
1848
|
+
const rows = docbenchRowsFor(scorecard, modelId);
|
|
1849
|
+
const latest = rows[0];
|
|
1850
|
+
if (!latest) return [];
|
|
1851
|
+
const { docbench, result, run } = latest;
|
|
1852
|
+
const whole = (value) => String(Math.round(value));
|
|
1853
|
+
const range = (ci) => `${whole(ci[0])}\u2013${whole(ci[1])}`;
|
|
1854
|
+
const engine = SCORECARD_ENGINE_LABELS[result.engine] ?? result.engine;
|
|
1855
|
+
const lines = [
|
|
1856
|
+
"## Docbench",
|
|
1857
|
+
"",
|
|
1858
|
+
`How well this build does DocBlocks\u2019 document work, judged from 0 to 100 in the [docbench](docbench) ${run.scope === "subset" ? "focused re-run" : "round"} of ${run.provenance.startedAt.slice(0, 10)} on ${engine}: **${whole(docbench.score)}** (95% range ${range(docbench.ci)}, band ${docbench.band}). DocBlocks could use ${Math.round(docbench.usableRate * 100)}% of its answers.`,
|
|
1859
|
+
"",
|
|
1860
|
+
"| Group | Score | 95% range |",
|
|
1861
|
+
"| --- | --- | --- |"
|
|
1862
|
+
];
|
|
1863
|
+
const known = new Set(DOCBENCH_FAMILY_LABELS.map(([id]) => id));
|
|
1864
|
+
const families = [
|
|
1865
|
+
...DOCBENCH_FAMILY_LABELS,
|
|
1866
|
+
...Object.keys(docbench.families).filter((id) => !known.has(id)).map((id) => [id, id])
|
|
1867
|
+
];
|
|
1868
|
+
for (const [id, label] of families) {
|
|
1869
|
+
const family = docbench.families[id];
|
|
1870
|
+
if (family) lines.push(row([label, whole(family.score), range(family.ci)]));
|
|
1871
|
+
}
|
|
1872
|
+
const findings = docbench.tasks["review-general"]?.findings;
|
|
1873
|
+
if (findings) {
|
|
1874
|
+
const one = (value) => value.toFixed(1);
|
|
1875
|
+
lines.push(
|
|
1876
|
+
"",
|
|
1877
|
+
`In general review it found, per document, ${one(findings.low)} small fixes, ${one(findings.medium)} moderate changes and ${one(findings.high)} substantial ones, and added ${one(findings.trivial)} trivial and ${one(findings.wrong)} wrong suggestions.`
|
|
1878
|
+
);
|
|
1879
|
+
}
|
|
1880
|
+
if (rows.length > 1) {
|
|
1881
|
+
lines.push(
|
|
1882
|
+
"",
|
|
1883
|
+
"Earlier results for this build, measured before the one above under their own round\u2019s tests, reviewer and Gezel version:",
|
|
1884
|
+
"",
|
|
1885
|
+
...rows.slice(1).map(
|
|
1886
|
+
(earlier) => `- ${earlier.run.provenance.startedAt.slice(0, 10)}, pack ${earlier.docbench.packVersion}: ${whole(earlier.docbench.score)}`
|
|
1887
|
+
)
|
|
1888
|
+
);
|
|
1889
|
+
}
|
|
1890
|
+
return lines;
|
|
1891
|
+
}
|
|
1832
1892
|
var SCORECARD_ENGINE_LABELS = {
|
|
1833
1893
|
"llama-cpp": "llama.cpp",
|
|
1834
1894
|
mlx: "MLX",
|
|
@@ -1917,6 +1977,8 @@ function chatModelMarkdown(m, scorecard) {
|
|
|
1917
1977
|
"",
|
|
1918
1978
|
...measuredResultsMarkdown(scorecard, m.id)
|
|
1919
1979
|
];
|
|
1980
|
+
const docbench = docbenchResultsMarkdown(scorecard, m.id);
|
|
1981
|
+
if (docbench.length > 0) lines.push("", ...docbench);
|
|
1920
1982
|
const more = [
|
|
1921
1983
|
m.upstream ? `[The model\u2019s own page](${m.upstream})` : "",
|
|
1922
1984
|
"[Every model](model-catalog)",
|
|
@@ -467,9 +467,25 @@ async function manifestFor(abs) {
|
|
|
467
467
|
const info = await stat(abs).catch(() => null);
|
|
468
468
|
if (!info) throw new CliError(`no such file or directory: ${abs}`);
|
|
469
469
|
if (info.isDirectory()) {
|
|
470
|
-
|
|
470
|
+
let raw;
|
|
471
|
+
try {
|
|
472
|
+
raw = await readFile2(join2(abs, "manifest.json"), "utf8");
|
|
473
|
+
} catch {
|
|
474
|
+
throw new CliError(`${abs} has no manifest.json \u2014 not an extracted catalog`);
|
|
475
|
+
}
|
|
476
|
+
try {
|
|
477
|
+
return JSON.parse(raw);
|
|
478
|
+
} catch {
|
|
479
|
+
throw new CliError(`${join2(abs, "manifest.json")} is not valid JSON`);
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
try {
|
|
483
|
+
return await readGezkManifest(abs);
|
|
484
|
+
} catch (err) {
|
|
485
|
+
throw new CliError(
|
|
486
|
+
`${abs} is not a readable .gezk archive: ${err instanceof Error ? err.message : String(err)}`
|
|
487
|
+
);
|
|
471
488
|
}
|
|
472
|
-
return readGezkManifest(abs);
|
|
473
489
|
}
|
|
474
490
|
function excerpt(text) {
|
|
475
491
|
const flat = text.replace(/\s+/g, " ").trim();
|
|
@@ -483,7 +499,14 @@ function formatBytes(bytes) {
|
|
|
483
499
|
function contentSha256(bytes) {
|
|
484
500
|
return createHash2("sha256").update(bytes).digest("hex");
|
|
485
501
|
}
|
|
486
|
-
|
|
502
|
+
function duckdbMissingMessage(version) {
|
|
503
|
+
return [
|
|
504
|
+
"No DuckDB CLI found. To get one:",
|
|
505
|
+
` gezel native install --engine duckdb (downloads DuckDB ${version}; or run this command again with --download)`,
|
|
506
|
+
" or install DuckDB yourself (https://duckdb.org), on your PATH or named with --duckdb <binary>"
|
|
507
|
+
].join("\n");
|
|
508
|
+
}
|
|
509
|
+
async function runKnowledgeExportParquet(path, opts, deps = {}) {
|
|
487
510
|
const { DUCKDB_VERSION, duckdbInstalledBinary } = await import("@bendyline/gezel/native");
|
|
488
511
|
const { exportCatalogParquet, findDuckdbBinary } = await import("@bendyline/gezel-knowledge");
|
|
489
512
|
const resolved = resolve2(path);
|
|
@@ -492,12 +515,8 @@ async function runKnowledgeExportParquet(path, opts) {
|
|
|
492
515
|
const source = info.isDirectory() ? { rootDir: resolved } : { archivePath: resolved };
|
|
493
516
|
const outDir = opts.out ? resolve2(opts.out) : join2(dirname2(resolved), `${basename2(resolved).replace(/\.gezk$/i, "")}-parquet`);
|
|
494
517
|
const installed = duckdbInstalledBinary(process.env.GEZEL_HOME ?? join2(homedir2(), ".gezel"));
|
|
495
|
-
const binaryPath = opts.duckdb
|
|
496
|
-
if (!binaryPath)
|
|
497
|
-
throw new CliError(
|
|
498
|
-
`no DuckDB CLI found \u2014 open a data feature in gezel once (it installs DuckDB ${DUCKDB_VERSION}), install DuckDB yourself, or pass --duckdb <binary>`
|
|
499
|
-
);
|
|
500
|
-
}
|
|
518
|
+
const binaryPath = opts.duckdb || process.env.GEZEL_DUCKDB_BIN?.trim() || (await stat(installed).catch(() => null) ? installed : await findDuckdbBinary()) || await deps.fetchDuckdb?.();
|
|
519
|
+
if (!binaryPath) throw new CliError(duckdbMissingMessage(DUCKDB_VERSION));
|
|
501
520
|
const report = await exportCatalogParquet({
|
|
502
521
|
source,
|
|
503
522
|
outDir,
|
|
@@ -553,6 +572,7 @@ async function runKnowledgeNearby(path, radius, opts = {}) {
|
|
|
553
572
|
}
|
|
554
573
|
export {
|
|
555
574
|
contentSha256,
|
|
575
|
+
duckdbMissingMessage,
|
|
556
576
|
embeddingRuntimeMissingMessage,
|
|
557
577
|
runKnowledgeBuild,
|
|
558
578
|
runKnowledgeExportParquet,
|
package/dist/tui/index.js
CHANGED
|
@@ -4771,6 +4771,9 @@ import {
|
|
|
4771
4771
|
} from "@bendyline/gezel";
|
|
4772
4772
|
import { resolveOnDeviceProvider as resolveOnDeviceProvider2 } from "@bendyline/gezel/native";
|
|
4773
4773
|
|
|
4774
|
+
// src/model-pull.ts
|
|
4775
|
+
import { dirname as dirname2 } from "path";
|
|
4776
|
+
|
|
4774
4777
|
// src/native-command.ts
|
|
4775
4778
|
import {
|
|
4776
4779
|
NativeEngineNameSchema
|
|
@@ -5079,7 +5082,7 @@ function BootstrapGate(props) {
|
|
|
5079
5082
|
);
|
|
5080
5083
|
if (screen.kind === "ready") return /* @__PURE__ */ jsx6(Fragment4, { children });
|
|
5081
5084
|
if (screen.kind === "loading") {
|
|
5082
|
-
return /* @__PURE__ */ jsx6(BootstrapFrame, { title: "
|
|
5085
|
+
return /* @__PURE__ */ jsx6(BootstrapFrame, { title: "Getting Gezel ready", children: /* @__PURE__ */ jsxs7(Text7, { color: "yellow", children: [
|
|
5083
5086
|
"\u25CF ",
|
|
5084
5087
|
screen.message
|
|
5085
5088
|
] }) });
|
|
@@ -5147,7 +5150,7 @@ function BootstrapGate(props) {
|
|
|
5147
5150
|
},
|
|
5148
5151
|
...screen.plan.accessories.length > 0 ? [
|
|
5149
5152
|
{
|
|
5150
|
-
label: `Complete
|
|
5153
|
+
label: `Complete set \u2014 ${bootstrapChatModelLabel(best)} + ${screen.plan.accessories.length} ${screen.plan.accessories.length === 1 ? "helper" : "helpers"}`,
|
|
5151
5154
|
hint: `optional \xB7 ${bestInstalled ? "chat model already available \xB7 " : ""}${workshopDownloadBytes > 0 ? formatDownloadSize(workshopDownloadBytes) : "already available"}${workshopHelperLabels ? ` \xB7 includes ${workshopHelperLabels}` : ""}`,
|
|
5152
5155
|
value: "bundle"
|
|
5153
5156
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bendyline/gezel-cli",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.2",
|
|
4
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": [
|
|
@@ -44,15 +44,15 @@
|
|
|
44
44
|
"!dist/**/*.map"
|
|
45
45
|
],
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@bendyline/gezel": "1.3.
|
|
48
|
-
"@bendyline/gezel-app-sdk": "1.2.
|
|
49
|
-
"@bendyline/gezel-catalog": "1.3.
|
|
50
|
-
"@bendyline/gezel-client": "1.3.
|
|
47
|
+
"@bendyline/gezel": "1.3.2",
|
|
48
|
+
"@bendyline/gezel-app-sdk": "1.2.2",
|
|
49
|
+
"@bendyline/gezel-catalog": "1.3.2",
|
|
50
|
+
"@bendyline/gezel-client": "1.3.2",
|
|
51
51
|
"@bendyline/gezel-knowledge": "1.2.11",
|
|
52
|
-
"@bendyline/gezel-service": "1.3.
|
|
53
|
-
"@bendyline/squisq": "2.13.
|
|
54
|
-
"@bendyline/squisq-formats": "2.8.
|
|
55
|
-
"@bendyline/squisq-react": "2.12.
|
|
52
|
+
"@bendyline/gezel-service": "1.3.2",
|
|
53
|
+
"@bendyline/squisq": "2.13.16",
|
|
54
|
+
"@bendyline/squisq-formats": "2.8.18",
|
|
55
|
+
"@bendyline/squisq-react": "2.12.28",
|
|
56
56
|
"commander": "^15.0.0",
|
|
57
57
|
"ink": "^7.1.1",
|
|
58
58
|
"ink-text-input": "^6.0.0",
|