zcode-app-cli 3.8.1-15 → 3.9.1-16
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/bin/zcode.js +92 -47
- package/package.json +2 -2
- package/vendor/extraction.json +131 -5
- package/vendor/node_modules/@zcode/tui/dist/index.js +35 -4
- package/vendor/packages/browser-use-plugin/.zcode-plugin/plugin.json +1 -1
- package/vendor/packages/browser-use-plugin/dist/mcp/server.js +12880 -10408
- package/vendor/packages/browser-use-plugin/package.json +1 -1
- package/vendor/packages/document-skills-plugin/.mcp.json +13 -0
- package/vendor/packages/document-skills-plugin/.zcode-plugin/plugin.json +19 -6
- package/vendor/packages/document-skills-plugin/package.json +3 -3
- package/vendor/packages/document-skills-plugin/skills/docx/SKILL.md +6 -2
- package/vendor/packages/document-skills-plugin/skills/docx/env_setup/env_check.sh +0 -0
- package/vendor/packages/document-skills-plugin/skills/docx/env_setup/setup_mac_linux.sh +0 -0
- package/vendor/packages/document-skills-plugin/skills/docx/setup.sh +0 -0
- package/vendor/packages/document-skills-plugin/skills/pdf/SKILL.md +39 -20
- package/vendor/packages/document-skills-plugin/skills/pdf/briefs/academic.md +39 -47
- package/vendor/packages/document-skills-plugin/skills/pdf/briefs/creative.md +11 -3
- package/vendor/packages/document-skills-plugin/skills/pdf/briefs/poster.md +3 -0
- package/vendor/packages/document-skills-plugin/skills/pdf/briefs/process.md +3 -0
- package/vendor/packages/document-skills-plugin/skills/pdf/briefs/report.md +41 -62
- package/vendor/packages/document-skills-plugin/skills/pdf/env_setup/env_check.sh +23 -15
- package/vendor/packages/document-skills-plugin/skills/pdf/env_setup/setup.md +37 -19
- package/vendor/packages/document-skills-plugin/skills/pdf/env_setup/setup_mac_linux.sh +0 -0
- package/vendor/packages/document-skills-plugin/skills/pdf/env_setup/setup_windows.ps1 +17 -19
- package/vendor/packages/document-skills-plugin/skills/pdf/scripts/cover_render.py +487 -0
- package/vendor/packages/document-skills-plugin/skills/pdf/scripts/html2poster.js +43 -11
- package/vendor/packages/document-skills-plugin/skills/pdf/scripts/pdf.py +145 -50
- package/vendor/packages/document-skills-plugin/skills/pdf/scripts/setup.sh +23 -21
- package/vendor/packages/document-skills-plugin/skills/pdf/typesetting/cover-backgrounds.md +1 -1
- package/vendor/packages/document-skills-plugin/skills/pdf/typesetting/cover.md +139 -1347
- package/vendor/packages/document-skills-plugin/skills/pptx/LICENSE.txt +13 -0
- package/vendor/packages/document-skills-plugin/skills/pptx/SKILL.md +146 -179
- package/vendor/packages/document-skills-plugin/skills/xlsx/SKILL.md +6 -2
- package/vendor/packages/document-skills-plugin/skills/xlsx/env_setup/env_check.sh +0 -0
- package/vendor/packages/document-skills-plugin/skills/xlsx/env_setup/setup_mac_linux.sh +0 -0
- package/vendor/packages/document-skills-plugin/skills/xlsx/setup.sh +0 -0
- package/vendor/packages/zcode-cua-plugin/.zcode-plugin/plugin.json +19 -0
- package/vendor/packages/zcode-cua-plugin/dist/mcp/server.js +68498 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/@img/colour/color.cjs +1596 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/@img/colour/index.cjs +1 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/@img/colour/package.json +58 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/@img/sharp-libvips-linux-x64/lib/glib-2.0/include/glibconfig.h +221 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/@img/sharp-libvips-linux-x64/lib/index.js +1 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/@img/sharp-libvips-linux-x64/lib/libvips-cpp.so.8.17.3 +0 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/@img/sharp-libvips-linux-x64/package.json +42 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/@img/sharp-libvips-linux-x64/versions.json +30 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/@img/sharp-linux-x64/LICENSE +191 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/@img/sharp-linux-x64/lib/sharp-linux-x64.node +0 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/@img/sharp-linux-x64/package.json +46 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/detect-libc/LICENSE +201 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/detect-libc/lib/detect-libc.js +313 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/detect-libc/lib/elf.js +39 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/detect-libc/lib/filesystem.js +51 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/detect-libc/lib/process.js +24 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/detect-libc/package.json +44 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/LICENSE +15 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/bin/semver.js +191 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/classes/comparator.js +143 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/classes/index.js +7 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/classes/range.js +557 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/classes/semver.js +333 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/clean.js +8 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/cmp.js +54 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/coerce.js +62 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/compare-build.js +9 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/compare-loose.js +5 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/compare.js +7 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/diff.js +60 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/eq.js +5 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/gt.js +5 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/gte.js +5 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/inc.js +21 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/lt.js +5 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/lte.js +5 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/major.js +5 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/minor.js +5 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/neq.js +5 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/parse.js +18 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/patch.js +5 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/prerelease.js +8 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/rcompare.js +5 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/rsort.js +5 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/satisfies.js +12 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/sort.js +5 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/functions/valid.js +8 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/index.js +91 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/internal/constants.js +37 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/internal/debug.js +11 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/internal/identifiers.js +29 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/internal/lrucache.js +42 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/internal/parse-options.js +17 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/internal/re.js +223 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/package.json +78 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/preload.js +4 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/range.bnf +16 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/ranges/gtr.js +6 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/ranges/intersects.js +9 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/ranges/ltr.js +6 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/ranges/max-satisfying.js +27 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/ranges/min-satisfying.js +26 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/ranges/min-version.js +63 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/ranges/outside.js +82 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/ranges/simplify.js +49 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/ranges/subset.js +249 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/ranges/to-comparators.js +10 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/semver/ranges/valid.js +13 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/sharp/LICENSE +191 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/sharp/install/build.js +38 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/sharp/install/check.js +14 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/sharp/lib/channel.js +177 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/sharp/lib/colour.js +195 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/sharp/lib/composite.js +212 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/sharp/lib/constructor.js +499 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/sharp/lib/index.js +16 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/sharp/lib/input.js +809 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/sharp/lib/is.js +143 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/sharp/lib/libvips.js +207 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/sharp/lib/operation.js +1016 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/sharp/lib/output.js +1666 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/sharp/lib/resize.js +595 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/sharp/lib/sharp.js +121 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/sharp/lib/utility.js +291 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/sharp/package.json +202 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/sharp/src/binding.gyp +298 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/sharp/src/common.cc +1130 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/sharp/src/common.h +402 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/sharp/src/metadata.cc +346 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/sharp/src/metadata.h +90 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/sharp/src/operations.cc +499 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/sharp/src/operations.h +137 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/sharp/src/pipeline.cc +1814 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/sharp/src/pipeline.h +408 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/sharp/src/sharp.cc +43 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/sharp/src/stats.cc +186 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/sharp/src/stats.h +62 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/sharp/src/utilities.cc +288 -0
- package/vendor/packages/zcode-cua-plugin/node_modules/sharp/src/utilities.h +22 -0
- package/vendor/packages/zcode-cua-plugin/package.json +31 -0
- package/vendor/packages/zcode-cua-plugin/scripts/build-mcp.mjs +58 -0
- package/vendor/packages/zcode-cua-plugin/scripts/bump-zcode-cua-producer.mjs +291 -0
- package/vendor/packages/zcode-cua-plugin/scripts/check-cua-baseline.mjs +155 -0
- package/vendor/packages/zcode-cua-plugin/scripts/check-version-coherence.mjs +478 -0
- package/vendor/packages/zcode-cua-plugin/scripts/sync-cache.mjs +100 -0
- package/vendor/packages/zcode-cua-plugin/scripts/sync-skill-from-zcode-cua.mjs +115 -0
- package/vendor/packages/zcode-cua-plugin/skills/zcode-computer-use/SKILL.md +129 -0
- package/vendor/zcode.cjs +752 -743
- package/zcode-runtime.lock.json +3 -3
- package/vendor/packages/document-skills-plugin/skills/pptx/assets/font_list.txt +0 -80
- package/vendor/packages/document-skills-plugin/skills/pptx/scripts/general_judge.py +0 -529
package/bin/zcode.js
CHANGED
|
@@ -854,7 +854,7 @@ function managedAction(args) {
|
|
|
854
854
|
if ((!action || action.startsWith("-")) && args.includes("--help")) return "help";
|
|
855
855
|
return action && managedActions.has(action) ? action : void 0;
|
|
856
856
|
}
|
|
857
|
-
function isRecord(value) {
|
|
857
|
+
function isRecord$1(value) {
|
|
858
858
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
859
859
|
}
|
|
860
860
|
function text(value) {
|
|
@@ -952,22 +952,22 @@ function writeJson(output, value) {
|
|
|
952
952
|
output.write(`${JSON.stringify(value, null, 2)}\n`);
|
|
953
953
|
}
|
|
954
954
|
function diagnostics(value) {
|
|
955
|
-
if (!isRecord(value) || !Array.isArray(value.diagnostics)) return [];
|
|
955
|
+
if (!isRecord$1(value) || !Array.isArray(value.diagnostics)) return [];
|
|
956
956
|
return value.diagnostics.flatMap((entry) => {
|
|
957
|
-
if (!isRecord(entry)) return [];
|
|
957
|
+
if (!isRecord$1(entry)) return [];
|
|
958
958
|
const message = text(entry.message);
|
|
959
959
|
return message ? [`${printable(text(entry.severity) ?? "warning")}: ${printable(message)}`] : [];
|
|
960
960
|
});
|
|
961
961
|
}
|
|
962
962
|
function hasErrorDiagnostics(value) {
|
|
963
|
-
return isRecord(value) && Array.isArray(value.diagnostics) && value.diagnostics.some((entry) => isRecord(entry) && entry.severity === "error");
|
|
963
|
+
return isRecord$1(value) && Array.isArray(value.diagnostics) && value.diagnostics.some((entry) => isRecord$1(entry) && entry.severity === "error");
|
|
964
964
|
}
|
|
965
965
|
function resultFailed(value) {
|
|
966
|
-
return hasErrorDiagnostics(value) || isRecord(value) && value.ok === false;
|
|
966
|
+
return hasErrorDiagnostics(value) || isRecord$1(value) && value.ok === false;
|
|
967
967
|
}
|
|
968
968
|
function listSection(output, title, values, format) {
|
|
969
969
|
output.write(`${title}:\n`);
|
|
970
|
-
const items = Array.isArray(values) ? values.filter(isRecord) : [];
|
|
970
|
+
const items = Array.isArray(values) ? values.filter(isRecord$1) : [];
|
|
971
971
|
if (items.length === 0) {
|
|
972
972
|
output.write(" (none)\n");
|
|
973
973
|
return;
|
|
@@ -975,7 +975,7 @@ function listSection(output, title, values, format) {
|
|
|
975
975
|
for (const item of items) output.write(` - ${format(item)}\n`);
|
|
976
976
|
}
|
|
977
977
|
function renderOverview(output, result, marketplacesOnly = false) {
|
|
978
|
-
const overview = isRecord(result) ? result : {};
|
|
978
|
+
const overview = isRecord$1(result) ? result : {};
|
|
979
979
|
listSection(output, "Marketplaces", overview.marketplaces, (item) => {
|
|
980
980
|
const count = typeof item.pluginCount === "number" ? ` (${item.pluginCount} plugins)` : "";
|
|
981
981
|
return `${printable(item.id)}${count}${item.isOfficial === true ? " [official]" : ""}`;
|
|
@@ -990,23 +990,23 @@ function renderOverview(output, result, marketplacesOnly = false) {
|
|
|
990
990
|
for (const diagnostic of diagnostics(overview)) output.write(`Diagnostic: ${diagnostic}\n`);
|
|
991
991
|
}
|
|
992
992
|
function componentSummary(result) {
|
|
993
|
-
if (!isRecord(result) || !Array.isArray(result.components)) return [];
|
|
993
|
+
if (!isRecord$1(result) || !Array.isArray(result.components)) return [];
|
|
994
994
|
return result.components.flatMap((component) => {
|
|
995
|
-
if (!isRecord(component) || !text(component.kind) || !Array.isArray(component.items)) return [];
|
|
996
|
-
const names = component.items.flatMap((item) => isRecord(item) && text(item.name) ? [printable(item.name)] : []);
|
|
995
|
+
if (!isRecord$1(component) || !text(component.kind) || !Array.isArray(component.items)) return [];
|
|
996
|
+
const names = component.items.flatMap((item) => isRecord$1(item) && text(item.name) ? [printable(item.name)] : []);
|
|
997
997
|
return names.length > 0 ? [`${printable(component.kind)}: ${names.join(", ")}`] : [];
|
|
998
998
|
});
|
|
999
999
|
}
|
|
1000
1000
|
function renderInstallPreview(output, coordinate, description, plan) {
|
|
1001
1001
|
output.write(`Plugin: ${coordinate.pluginName}@${coordinate.marketplace}\n`);
|
|
1002
|
-
if (isRecord(description) && isRecord(description.metadata)) {
|
|
1002
|
+
if (isRecord$1(description) && isRecord$1(description.metadata)) {
|
|
1003
1003
|
const metadata = description.metadata;
|
|
1004
1004
|
const details = [text(metadata.version) && `v${printable(metadata.version)}`, text(metadata.author) && printable(metadata.author)].filter(Boolean);
|
|
1005
1005
|
if (details.length > 0) output.write(`Metadata: ${details.join(" | ")}\n`);
|
|
1006
1006
|
}
|
|
1007
1007
|
const components = componentSummary(description);
|
|
1008
1008
|
output.write(`Components: ${components.length > 0 ? components.join("; ") : "none declared"}\n`);
|
|
1009
|
-
if (isRecord(plan) && Array.isArray(plan.dependencyClosure)) {
|
|
1009
|
+
if (isRecord$1(plan) && Array.isArray(plan.dependencyClosure)) {
|
|
1010
1010
|
const closure = plan.dependencyClosure.map(printable);
|
|
1011
1011
|
output.write(`Dependencies: ${closure.length > 0 ? closure.join(", ") : "none"}\n`);
|
|
1012
1012
|
}
|
|
@@ -1015,10 +1015,10 @@ function renderInstallPreview(output, coordinate, description, plan) {
|
|
|
1015
1015
|
function renderMutation(output, result, labels, changesApply = true) {
|
|
1016
1016
|
const failed = resultFailed(result);
|
|
1017
1017
|
output.write(`${failed ? labels.failure : labels.success}\n`);
|
|
1018
|
-
if (isRecord(result)) {
|
|
1019
|
-
const installed = Array.isArray(result.installedPlugins) ? result.installedPlugins.filter(isRecord) : [];
|
|
1018
|
+
if (isRecord$1(result)) {
|
|
1019
|
+
const installed = Array.isArray(result.installedPlugins) ? result.installedPlugins.filter(isRecord$1) : [];
|
|
1020
1020
|
for (const plugin of installed) output.write(` - ${printable(plugin.id)}\n`);
|
|
1021
|
-
if (isRecord(result.marketplace)) output.write(` - ${printable(result.marketplace.id)}\n`);
|
|
1021
|
+
if (isRecord$1(result.marketplace)) output.write(` - ${printable(result.marketplace.id)}\n`);
|
|
1022
1022
|
if (text(result.pluginId)) output.write(` - ${printable(result.pluginId)}\n`);
|
|
1023
1023
|
}
|
|
1024
1024
|
for (const diagnostic of diagnostics(result)) output.write(`Diagnostic: ${diagnostic}\n`);
|
|
@@ -1039,7 +1039,7 @@ async function defaultConfirm(question, input, output, signal) {
|
|
|
1039
1039
|
}
|
|
1040
1040
|
async function readOptionsFile(path) {
|
|
1041
1041
|
const parsed = JSON.parse(await readFile(path, "utf8"));
|
|
1042
|
-
if (!isRecord(parsed)) throw new Error("Plugin options file must contain a JSON object.");
|
|
1042
|
+
if (!isRecord$1(parsed)) throw new Error("Plugin options file must contain a JSON object.");
|
|
1043
1043
|
return parsed;
|
|
1044
1044
|
}
|
|
1045
1045
|
async function runPluginCommand(args, options) {
|
|
@@ -1271,12 +1271,40 @@ async function runPluginCommand(args, options) {
|
|
|
1271
1271
|
}
|
|
1272
1272
|
}
|
|
1273
1273
|
//#endregion
|
|
1274
|
+
//#region src/runtime-capabilities.ts
|
|
1275
|
+
function isRecord(value) {
|
|
1276
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1277
|
+
}
|
|
1278
|
+
function parseRuntimeCapabilities(value) {
|
|
1279
|
+
if (!isRecord(value) || value.schemaVersion !== 1 || !isRecord(value.cli)) return void 0;
|
|
1280
|
+
const rawOptions = value.cli.globalOptions;
|
|
1281
|
+
if (!isRecord(rawOptions)) return void 0;
|
|
1282
|
+
const globalOptions = {};
|
|
1283
|
+
for (const [name, rawOption] of Object.entries(rawOptions)) {
|
|
1284
|
+
if (!name || name.startsWith("-") || !isRecord(rawOption)) return void 0;
|
|
1285
|
+
if (rawOption.type !== "boolean" && rawOption.type !== "string") return void 0;
|
|
1286
|
+
if (rawOption.multiple !== void 0 && typeof rawOption.multiple !== "boolean") return void 0;
|
|
1287
|
+
globalOptions[name] = {
|
|
1288
|
+
type: rawOption.type,
|
|
1289
|
+
...rawOption.multiple === true ? { multiple: true } : {}
|
|
1290
|
+
};
|
|
1291
|
+
}
|
|
1292
|
+
return {
|
|
1293
|
+
schemaVersion: 1,
|
|
1294
|
+
cli: { globalOptions }
|
|
1295
|
+
};
|
|
1296
|
+
}
|
|
1297
|
+
function capabilitiesFromExtractionMetadata(value) {
|
|
1298
|
+
return isRecord(value) ? parseRuntimeCapabilities(value.runtimeCapabilities) : void 0;
|
|
1299
|
+
}
|
|
1300
|
+
//#endregion
|
|
1274
1301
|
//#region src/launcher.ts
|
|
1275
1302
|
const packageRoot = join(dirname(fileURLToPath(import.meta.url)), "..");
|
|
1276
1303
|
const packageManifestPath = join(packageRoot, "package.json");
|
|
1277
1304
|
const extractionMetadataPath = join(packageRoot, "vendor", "extraction.json");
|
|
1278
1305
|
const runtimePath = join(packageRoot, "vendor", "zcode.cjs");
|
|
1279
1306
|
const launcherPath = join(packageRoot, "bin", "zcode.js");
|
|
1307
|
+
const defaultZCodeBaseUrl = "https://zcode.z.ai";
|
|
1280
1308
|
const defaultModelRetryMaxRetries = "5";
|
|
1281
1309
|
const defaultBrowserUseArgument = "--browser-use=headless";
|
|
1282
1310
|
const tuiRuntimeLogLimitBytes = 2 * 1024 * 1024;
|
|
@@ -1285,34 +1313,37 @@ const versionArguments = /* @__PURE__ */ new Set([
|
|
|
1285
1313
|
"--version",
|
|
1286
1314
|
"-v"
|
|
1287
1315
|
]);
|
|
1288
|
-
const runtimeBooleanOptions = /* @__PURE__ */ new Set([
|
|
1289
|
-
"--allow-main-worktree-yolo",
|
|
1290
|
-
"--continue",
|
|
1291
|
-
"--force",
|
|
1292
|
-
"--force-mcs",
|
|
1293
|
-
"--json",
|
|
1294
|
-
"--no-browser",
|
|
1295
|
-
"--no-color",
|
|
1296
|
-
"--stdio",
|
|
1297
|
-
"--target-replace",
|
|
1298
|
-
"--verbose"
|
|
1299
|
-
]);
|
|
1300
|
-
const runtimeValueOptions = /* @__PURE__ */ new Set([
|
|
1301
|
-
"--allowed-tools",
|
|
1302
|
-
"--attach",
|
|
1303
|
-
"--browser-executable",
|
|
1304
|
-
"--cwd",
|
|
1305
|
-
"--locale",
|
|
1306
|
-
"--max-turns",
|
|
1307
|
-
"--mode",
|
|
1308
|
-
"--permission-mode",
|
|
1309
|
-
"--resume",
|
|
1310
|
-
"--settings"
|
|
1311
|
-
]);
|
|
1312
1316
|
const runtimeVariadicOptions = /* @__PURE__ */ new Set(["--disallowedTools", "--disallowed-tools"]);
|
|
1317
|
+
const fallbackRuntimeOptionTypes = {
|
|
1318
|
+
attach: "string",
|
|
1319
|
+
"browser-executable": "string",
|
|
1320
|
+
"browser-use": "string",
|
|
1321
|
+
continue: "boolean",
|
|
1322
|
+
cwd: "string",
|
|
1323
|
+
force: "boolean",
|
|
1324
|
+
"force-mcs": "boolean",
|
|
1325
|
+
help: "boolean",
|
|
1326
|
+
json: "boolean",
|
|
1327
|
+
locale: "string",
|
|
1328
|
+
mode: "string",
|
|
1329
|
+
"no-browser": "boolean",
|
|
1330
|
+
"no-color": "boolean",
|
|
1331
|
+
"output-format": "string",
|
|
1332
|
+
prompt: "string",
|
|
1333
|
+
resume: "string",
|
|
1334
|
+
stdio: "boolean",
|
|
1335
|
+
surface: "string",
|
|
1336
|
+
target: "string",
|
|
1337
|
+
"target-replace": "boolean",
|
|
1338
|
+
verbose: "boolean",
|
|
1339
|
+
version: "boolean"
|
|
1340
|
+
};
|
|
1313
1341
|
function resolveModelRetryMaxRetries(env) {
|
|
1314
1342
|
return env.ZCODE_MODEL_RETRY_MAX_RETRIES?.trim() || defaultModelRetryMaxRetries;
|
|
1315
1343
|
}
|
|
1344
|
+
function resolveZCodeBaseUrl(env) {
|
|
1345
|
+
return env.ZCODE_BASE_URL?.trim() || defaultZCodeBaseUrl;
|
|
1346
|
+
}
|
|
1316
1347
|
function resolveNodeExecutable() {
|
|
1317
1348
|
return process.env.ZCODE_NODE?.trim() || process.execPath;
|
|
1318
1349
|
}
|
|
@@ -1327,6 +1358,15 @@ function readJsonVersion(path, key) {
|
|
|
1327
1358
|
return;
|
|
1328
1359
|
}
|
|
1329
1360
|
}
|
|
1361
|
+
function readRuntimeCliOptionTypes(metadataPath = extractionMetadataPath) {
|
|
1362
|
+
try {
|
|
1363
|
+
const capabilities = capabilitiesFromExtractionMetadata(JSON.parse(readFileSync(metadataPath, "utf8")));
|
|
1364
|
+
if (!capabilities) return fallbackRuntimeOptionTypes;
|
|
1365
|
+
return Object.fromEntries(Object.entries(capabilities.cli.globalOptions).map(([name, option]) => [name, option.type]));
|
|
1366
|
+
} catch {
|
|
1367
|
+
return fallbackRuntimeOptionTypes;
|
|
1368
|
+
}
|
|
1369
|
+
}
|
|
1330
1370
|
function readDistributionVersion(manifestPath = packageManifestPath) {
|
|
1331
1371
|
return readJsonVersion(manifestPath, "version");
|
|
1332
1372
|
}
|
|
@@ -1357,12 +1397,13 @@ function longOptionName(argument) {
|
|
|
1357
1397
|
const separator = argument.indexOf("=");
|
|
1358
1398
|
return separator < 0 ? argument : argument.slice(0, separator);
|
|
1359
1399
|
}
|
|
1360
|
-
function inspectRuntimeInvocation(args) {
|
|
1400
|
+
function inspectRuntimeInvocation(args, runtimeOptionTypes) {
|
|
1361
1401
|
let agentInvocation = false;
|
|
1362
1402
|
let command;
|
|
1363
1403
|
let explicitBrowserUse = false;
|
|
1364
1404
|
let invalid = false;
|
|
1365
1405
|
let passthrough = false;
|
|
1406
|
+
let presentationSurface = false;
|
|
1366
1407
|
for (let index = 0; index < args.length; index += 1) {
|
|
1367
1408
|
const argument = args[index];
|
|
1368
1409
|
if (argument === "--") {
|
|
@@ -1401,12 +1442,14 @@ function inspectRuntimeInvocation(args) {
|
|
|
1401
1442
|
}
|
|
1402
1443
|
continue;
|
|
1403
1444
|
}
|
|
1404
|
-
|
|
1445
|
+
const runtimeOptionType = runtimeOptionTypes[option.slice(2)];
|
|
1446
|
+
if (runtimeOptionType === "string") {
|
|
1447
|
+
presentationSurface ||= option === "--surface";
|
|
1405
1448
|
if (!inlineValue) if (index + 1 >= args.length || args[index + 1].startsWith("-")) invalid = true;
|
|
1406
1449
|
else index += 1;
|
|
1407
1450
|
continue;
|
|
1408
1451
|
}
|
|
1409
|
-
if (
|
|
1452
|
+
if (runtimeOptionType === "boolean" && !inlineValue) continue;
|
|
1410
1453
|
invalid = true;
|
|
1411
1454
|
continue;
|
|
1412
1455
|
}
|
|
@@ -1427,6 +1470,7 @@ function inspectRuntimeInvocation(args) {
|
|
|
1427
1470
|
}
|
|
1428
1471
|
command ??= argument;
|
|
1429
1472
|
}
|
|
1473
|
+
if (presentationSurface && !agentInvocation && command !== "app-server" && command !== "agent-server") invalid = true;
|
|
1430
1474
|
return {
|
|
1431
1475
|
agentInvocation,
|
|
1432
1476
|
command,
|
|
@@ -1435,13 +1479,13 @@ function inspectRuntimeInvocation(args) {
|
|
|
1435
1479
|
passthrough
|
|
1436
1480
|
};
|
|
1437
1481
|
}
|
|
1438
|
-
function withDefaultBrowserUse(args) {
|
|
1439
|
-
const invocation = inspectRuntimeInvocation(args);
|
|
1482
|
+
function withDefaultBrowserUse(args, runtimeOptionTypes = readRuntimeCliOptionTypes()) {
|
|
1483
|
+
const invocation = inspectRuntimeInvocation(args, runtimeOptionTypes);
|
|
1440
1484
|
if (invocation.explicitBrowserUse || invocation.passthrough || invocation.invalid || !invocation.agentInvocation && invocation.command !== void 0 && invocation.command !== "tui") return args;
|
|
1441
1485
|
return [defaultBrowserUseArgument, ...args];
|
|
1442
1486
|
}
|
|
1443
|
-
function isTuiRuntimeInvocation(args) {
|
|
1444
|
-
const invocation = inspectRuntimeInvocation(args);
|
|
1487
|
+
function isTuiRuntimeInvocation(args, runtimeOptionTypes = readRuntimeCliOptionTypes()) {
|
|
1488
|
+
const invocation = inspectRuntimeInvocation(args, runtimeOptionTypes);
|
|
1445
1489
|
return !invocation.agentInvocation && !invocation.invalid && !invocation.passthrough && (invocation.command === void 0 || invocation.command === "tui");
|
|
1446
1490
|
}
|
|
1447
1491
|
function firstRunSetupEnv(setupPending, args) {
|
|
@@ -1458,6 +1502,7 @@ function runtimeEnvironment(extra = {}) {
|
|
|
1458
1502
|
};
|
|
1459
1503
|
const merged = {
|
|
1460
1504
|
...inherited,
|
|
1505
|
+
ZCODE_BASE_URL: resolveZCodeBaseUrl(inherited),
|
|
1461
1506
|
ZCODE_MODEL_RETRY_MAX_RETRIES: resolveModelRetryMaxRetries(inherited),
|
|
1462
1507
|
ZCODE_APP_CLI_EXECUTABLE: process.execPath,
|
|
1463
1508
|
ZCODE_APP_CLI_ENTRY: launcherPath,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zcode-app-cli",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.9.1-16",
|
|
4
4
|
"description": "Unofficial terminal client for the ZCode agent runtime",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agent",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"sync:local": "bun run build && bun scripts/sync-runtime.ts --app /Applications/ZCode.app",
|
|
50
50
|
"check": "bun run build && bun scripts/check-runtime.ts",
|
|
51
51
|
"check:oauth-callback": "bun scripts/smoke-oauth-callback.ts",
|
|
52
|
-
"check:tui": "bun scripts/smoke-tui.ts && bun scripts/smoke-tui-features.ts && bun scripts/smoke-tui-clear.ts && bun scripts/smoke-tui-pressure.ts && bun scripts/smoke-tui-widths.ts",
|
|
52
|
+
"check:tui": "bun scripts/smoke-tui.ts && bun scripts/smoke-tui-features.ts && bun scripts/smoke-tui-clear.ts && bun scripts/smoke-tui-session-title.ts && bun scripts/smoke-tui-pressure.ts && bun scripts/smoke-tui-widths.ts",
|
|
53
53
|
"test": "bun test",
|
|
54
54
|
"typecheck": "tsc --noEmit",
|
|
55
55
|
"verify:tui-perf": "bun scripts/verify-tui-perf.ts",
|
package/vendor/extraction.json
CHANGED
|
@@ -1,9 +1,135 @@
|
|
|
1
1
|
{
|
|
2
|
-
"appVersion": "3.
|
|
3
|
-
"cliVersion": "0.16.
|
|
4
|
-
"extractedAt": "2026-08-
|
|
5
|
-
"sha512": "
|
|
6
|
-
"source": "https://cdn-zcode.z.ai/zcode/electron/releases/3.
|
|
2
|
+
"appVersion": "3.9.1",
|
|
3
|
+
"cliVersion": "0.16.5",
|
|
4
|
+
"extractedAt": "2026-08-26T08:31:36.432Z",
|
|
5
|
+
"sha512": "fLaABx0pWDK2ZrrTD8akdFYv9mAO2ZqMw4ozp0pUcIHE4LsJZ1tSZT4EXkda9M1MxA7wnz1m4fdqDbSuiP+HWw==",
|
|
6
|
+
"source": "https://cdn-zcode.z.ai/zcode/electron/releases/3.9.1/linux-x64/ZCode-3.9.1-linux-x64.deb",
|
|
7
|
+
"runtimeCapabilities": {
|
|
8
|
+
"schemaVersion": 1,
|
|
9
|
+
"cli": {
|
|
10
|
+
"globalOptions": {
|
|
11
|
+
"help": {
|
|
12
|
+
"type": "boolean"
|
|
13
|
+
},
|
|
14
|
+
"json": {
|
|
15
|
+
"type": "boolean"
|
|
16
|
+
},
|
|
17
|
+
"output-format": {
|
|
18
|
+
"type": "string"
|
|
19
|
+
},
|
|
20
|
+
"no-color": {
|
|
21
|
+
"type": "boolean"
|
|
22
|
+
},
|
|
23
|
+
"no-browser": {
|
|
24
|
+
"type": "boolean"
|
|
25
|
+
},
|
|
26
|
+
"browser-use": {
|
|
27
|
+
"type": "string"
|
|
28
|
+
},
|
|
29
|
+
"browser-executable": {
|
|
30
|
+
"type": "string"
|
|
31
|
+
},
|
|
32
|
+
"prompt": {
|
|
33
|
+
"type": "string"
|
|
34
|
+
},
|
|
35
|
+
"attach": {
|
|
36
|
+
"type": "string",
|
|
37
|
+
"multiple": true
|
|
38
|
+
},
|
|
39
|
+
"cwd": {
|
|
40
|
+
"type": "string"
|
|
41
|
+
},
|
|
42
|
+
"locale": {
|
|
43
|
+
"type": "string"
|
|
44
|
+
},
|
|
45
|
+
"resume": {
|
|
46
|
+
"type": "string"
|
|
47
|
+
},
|
|
48
|
+
"target": {
|
|
49
|
+
"type": "string"
|
|
50
|
+
},
|
|
51
|
+
"target-replace": {
|
|
52
|
+
"type": "boolean"
|
|
53
|
+
},
|
|
54
|
+
"continue": {
|
|
55
|
+
"type": "boolean"
|
|
56
|
+
},
|
|
57
|
+
"force": {
|
|
58
|
+
"type": "boolean"
|
|
59
|
+
},
|
|
60
|
+
"force-mcs": {
|
|
61
|
+
"type": "boolean"
|
|
62
|
+
},
|
|
63
|
+
"mode": {
|
|
64
|
+
"type": "string"
|
|
65
|
+
},
|
|
66
|
+
"verbose": {
|
|
67
|
+
"type": "boolean"
|
|
68
|
+
},
|
|
69
|
+
"version": {
|
|
70
|
+
"type": "boolean"
|
|
71
|
+
},
|
|
72
|
+
"stdio": {
|
|
73
|
+
"type": "boolean"
|
|
74
|
+
},
|
|
75
|
+
"surface": {
|
|
76
|
+
"type": "string"
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
"runtimePatches": [
|
|
82
|
+
{
|
|
83
|
+
"id": "tui-bridge",
|
|
84
|
+
"requirement": "required",
|
|
85
|
+
"status": "applied"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"id": "goal-failure-pause",
|
|
89
|
+
"requirement": "optional",
|
|
90
|
+
"status": "applied"
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"id": "terminal-tool-projection",
|
|
94
|
+
"requirement": "optional",
|
|
95
|
+
"status": "applied"
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"id": "detached-agent-lifecycle",
|
|
99
|
+
"requirement": "optional",
|
|
100
|
+
"status": "applied"
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"id": "agent-auto-background",
|
|
104
|
+
"requirement": "optional",
|
|
105
|
+
"status": "applied"
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
"id": "http-no-content",
|
|
109
|
+
"requirement": "required",
|
|
110
|
+
"status": "applied"
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
"id": "oauth-http-errors",
|
|
114
|
+
"requirement": "optional",
|
|
115
|
+
"status": "applied"
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
"id": "desktop-oauth",
|
|
119
|
+
"requirement": "required",
|
|
120
|
+
"status": "applied"
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
"id": "login-model-defaults",
|
|
124
|
+
"requirement": "required",
|
|
125
|
+
"status": "applied"
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
"id": "cli-help-contract",
|
|
129
|
+
"requirement": "required",
|
|
130
|
+
"status": "applied"
|
|
131
|
+
}
|
|
132
|
+
],
|
|
7
133
|
"tui": {
|
|
8
134
|
"implementation": "@zcode/tui",
|
|
9
135
|
"foundation": "@earendil-works/pi-tui"
|
|
@@ -162788,6 +162788,33 @@ function normalizeRuntimeProjection(value) {
|
|
|
162788
162788
|
} : void 0
|
|
162789
162789
|
};
|
|
162790
162790
|
}
|
|
162791
|
+
/** Enrich the stable local projection from persisted messages, without runtime internals. */
|
|
162792
|
+
function mergeProjectionContextCache(projection, messages) {
|
|
162793
|
+
const usage = projection?.contextUsage;
|
|
162794
|
+
if (!projection || !usage) return projection;
|
|
162795
|
+
const trend = extractContextCacheTrend(messages);
|
|
162796
|
+
if (trend.wholeTree.requests === 0) return projection;
|
|
162797
|
+
const latest = trend.turns.findLast((turn) => turn.inputTokens !== void 0);
|
|
162798
|
+
const summary = trend.wholeTree;
|
|
162799
|
+
return {
|
|
162800
|
+
...projection,
|
|
162801
|
+
contextUsage: {
|
|
162802
|
+
...usage,
|
|
162803
|
+
cache: {
|
|
162804
|
+
...usage.cache,
|
|
162805
|
+
inputTokens: latest?.inputTokens ?? usage.cache?.inputTokens,
|
|
162806
|
+
cacheReadTokens: latest?.cacheReadTokens ?? usage.cache?.cacheReadTokens,
|
|
162807
|
+
cacheWriteTokens: latest?.cacheWriteTokens ?? usage.cache?.cacheWriteTokens,
|
|
162808
|
+
latestHitRate: latest?.hitRate ?? usage.cache?.latestHitRate,
|
|
162809
|
+
hitRate: summary.hitRate ?? usage.cache?.hitRate,
|
|
162810
|
+
hitRateRequestCount: summary.requests,
|
|
162811
|
+
totalInputTokens: summary.inputTokens,
|
|
162812
|
+
totalCacheReadTokens: summary.cacheReadTokens,
|
|
162813
|
+
totalCacheWriteTokens: summary.cacheWriteTokens
|
|
162814
|
+
}
|
|
162815
|
+
}
|
|
162816
|
+
};
|
|
162817
|
+
}
|
|
162791
162818
|
function isActiveRuntimeTool(tool) {
|
|
162792
162819
|
return tool.status === "pending" || tool.status === "running";
|
|
162793
162820
|
}
|
|
@@ -162974,7 +163001,7 @@ function sessionTitleFromFirstMessage(message) {
|
|
|
162974
163001
|
if (!normalized) return null;
|
|
162975
163002
|
const characters = Array.from(normalized);
|
|
162976
163003
|
if (characters.length <= 50) return normalized;
|
|
162977
|
-
return `${characters.slice(0,
|
|
163004
|
+
return `${characters.slice(0, 49).join("")}…`;
|
|
162978
163005
|
}
|
|
162979
163006
|
function emitSessionTerminalTitle(stream, title) {
|
|
162980
163007
|
if (!stream?.isTTY) return;
|
|
@@ -166129,7 +166156,6 @@ var ZCodeTui = class {
|
|
|
166129
166156
|
finishPrimaryTurnSubmission(turnEpoch, abortController, unfinishedToolState) {
|
|
166130
166157
|
this.activeSubmissions = Math.max(0, this.activeSubmissions - 1);
|
|
166131
166158
|
if (this.activeTurnEpoch !== turnEpoch) return void 0;
|
|
166132
|
-
this.refreshSessionTerminalTitle();
|
|
166133
166159
|
const turnFinishState = abortController.signal.aborted ? "cancelled" : unfinishedToolState;
|
|
166134
166160
|
const recoveryReason = turnFinishState === "cancelled" ? "turn_cancelled" : turnFinishState === "failed" ? "turn_failed" : "turn_ended";
|
|
166135
166161
|
const targetTurnId = this.activeTurnId;
|
|
@@ -169005,14 +169031,19 @@ var ZCodeTui = class {
|
|
|
169005
169031
|
try {
|
|
169006
169032
|
do {
|
|
169007
169033
|
this.runtimeRefreshPending = false;
|
|
169008
|
-
const [projectionResult, todosResult] = await Promise.allSettled([
|
|
169034
|
+
const [projectionResult, todosResult, contextMessagesResult] = await Promise.allSettled([
|
|
169035
|
+
this.options.readRuntimeProjection?.(),
|
|
169036
|
+
this.options.readTodos?.(),
|
|
169037
|
+
this.options.readRuntimeProjection && this.options.loadSessionContextMessages ? this.options.loadSessionContextMessages() : Promise.resolve(void 0)
|
|
169038
|
+
]);
|
|
169009
169039
|
const next = {
|
|
169010
169040
|
projection: this.runtimeProjection,
|
|
169011
169041
|
todos: this.todos,
|
|
169012
169042
|
todoGroups: this.todoGroups
|
|
169013
169043
|
};
|
|
169014
169044
|
if (projectionResult.status === "fulfilled" && projectionResult.value !== void 0) {
|
|
169015
|
-
|
|
169045
|
+
const projection = normalizeRuntimeProjection(projectionResult.value);
|
|
169046
|
+
next.projection = contextMessagesResult.status === "fulfilled" && contextMessagesResult.value !== void 0 ? mergeProjectionContextCache(projection, contextMessagesResult.value) ?? next.projection : projection ?? next.projection;
|
|
169016
169047
|
if (isRecord(projectionResult.value) && Array.isArray(projectionResult.value.todoGroups)) next.todoGroups = normalizeTodoGroups(projectionResult.value);
|
|
169017
169048
|
}
|
|
169018
169049
|
if (todosResult.status === "fulfilled" && todosResult.value !== void 0) next.todos = normalizeTodos(todosResult.value);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "browser-use",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Built-in browser automation runtime and guidance for Desktop IAB and explicitly enabled CLI-managed headless CDP: open, navigate, inspect, click, type, screenshot, record workspace WebM videos, and verify web pages and local dev targets.",
|
|
5
5
|
"author": { "name": "Z.ai" },
|
|
6
6
|
"license": "MIT",
|