@wormw/zcode-cli 4.0.0-mirror.2 → 4.0.0-mirror.3

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 CHANGED
@@ -9,7 +9,7 @@
9
9
  - 打包阶段会在不修改上游源码的前提下,对 `agent/node_modules/@zcode/tui` 的 `runTui` 入口包一层 **OSC 7501(Program Status Protocol)** 状态上报,使新版 Herdr(`herdr-core` / `herdr-app`)等终端原生感知 `idle`、`working`、`blocked`(`permission` / `question` / `auth`)、`done`、`error` 与退出 `clear`。可通过 `ZCODE_OSC7501=0` 关闭,或通过 `ZCODE_OSC7501_APP` 自定义 `app` 标识(默认 `zcode`);若未来上游原生实现 OSC 7501,打包器会自动跳过该包装。
10
10
  - 镜像打包器复用上游 `stageTuiRuntime`、`collectSeaPlaywrightAssets` 和 `stageCredentialKeyring` 构建接口,收集六个桌面/服务器目标的 TUI、Playwright 与系统钥匙串资源。缺少必需资源时构建失败。
11
11
  - CLI 运行时位于 `agent/node_modules`,不设置顶层 `node_modules`,也不依赖 npm 安装脚本。Node.js 版本要求跟随上游 `mise.toml`。
12
- - `bin/zcode` 保留 CLI 的 TTY、参数和退出码,并将 `process.argv[1]` 指向真实 Agent 入口。构建时通过上游 `buildCli({ version })` 将 Agent 与 launcher 设置为同一镜像包版本;只有单独的 `--version`/`-v` 由 launcher 直接输出,`--web` 与其他参数一样直接交给 Agent CLI,不启动 Web。
12
+ - `bin/zcode` 保留 CLI 的 TTY、参数和退出码,并将 `process.argv[1]` 指向真实 Agent 入口。构建时通过上游 `buildCli({ version })` 将 Agent 与 launcher 设置为同一镜像包版本;只有单独的 `--version`/`-v` 由 launcher 直接输出,`--web` 与其他参数一样直接交给 Agent CLI,不启动 Web。在默认内置实验性 `node:ffi` 的 Node 26+ 环境下,launcher 会自动屏蔽 `node:ffi` 使 OpenTUI 回落到随包携带的 `koffi` 后端(可通过 `ZCODE_ALLOW_NODE_FFI=1` 放开)。
13
13
  - `scripts/package-cli-release.mjs` 是唯一产物组装入口;workflow 不调用 `build:zcode`、`build:sea`,也不生成 SEA 单文件。
14
14
 
15
15
  ## 安装
package/agent/zcode.cjs CHANGED
@@ -131063,10 +131063,10 @@ var init_esm7 = __esm({
131063
131063
  }
131064
131064
  });
131065
131065
 
131066
- // node_modules/@jimp/plugin-blit/node_modules/zod/v3/helpers/util.js
131066
+ // node_modules/@jimp/plugin-color/node_modules/zod/v3/helpers/util.js
131067
131067
  var util, objectUtil, ZodParsedType, getParsedType2;
131068
131068
  var init_util3 = __esm({
131069
- "node_modules/@jimp/plugin-blit/node_modules/zod/v3/helpers/util.js"() {
131069
+ "node_modules/@jimp/plugin-color/node_modules/zod/v3/helpers/util.js"() {
131070
131070
  (function(util3) {
131071
131071
  util3.assertEqual = (_2) => {
131072
131072
  };
@@ -131200,10 +131200,10 @@ var init_util3 = __esm({
131200
131200
  }
131201
131201
  });
131202
131202
 
131203
- // node_modules/@jimp/plugin-blit/node_modules/zod/v3/ZodError.js
131203
+ // node_modules/@jimp/plugin-color/node_modules/zod/v3/ZodError.js
131204
131204
  var ZodIssueCode2, quotelessJson, ZodError2;
131205
131205
  var init_ZodError = __esm({
131206
- "node_modules/@jimp/plugin-blit/node_modules/zod/v3/ZodError.js"() {
131206
+ "node_modules/@jimp/plugin-color/node_modules/zod/v3/ZodError.js"() {
131207
131207
  init_util3();
131208
131208
  ZodIssueCode2 = util.arrayToEnum([
131209
131209
  "invalid_type",
@@ -131324,10 +131324,10 @@ var init_ZodError = __esm({
131324
131324
  }
131325
131325
  });
131326
131326
 
131327
- // node_modules/@jimp/plugin-blit/node_modules/zod/v3/locales/en.js
131327
+ // node_modules/@jimp/plugin-color/node_modules/zod/v3/locales/en.js
131328
131328
  var errorMap, en_default2;
131329
131329
  var init_en2 = __esm({
131330
- "node_modules/@jimp/plugin-blit/node_modules/zod/v3/locales/en.js"() {
131330
+ "node_modules/@jimp/plugin-color/node_modules/zod/v3/locales/en.js"() {
131331
131331
  init_ZodError();
131332
131332
  init_util3();
131333
131333
  errorMap = (issue3, _ctx) => {
@@ -131434,7 +131434,7 @@ var init_en2 = __esm({
131434
131434
  }
131435
131435
  });
131436
131436
 
131437
- // node_modules/@jimp/plugin-blit/node_modules/zod/v3/errors.js
131437
+ // node_modules/@jimp/plugin-color/node_modules/zod/v3/errors.js
131438
131438
  function setErrorMap2(map2) {
131439
131439
  overrideErrorMap = map2;
131440
131440
  }
@@ -131443,13 +131443,13 @@ function getErrorMap2() {
131443
131443
  }
131444
131444
  var overrideErrorMap;
131445
131445
  var init_errors6 = __esm({
131446
- "node_modules/@jimp/plugin-blit/node_modules/zod/v3/errors.js"() {
131446
+ "node_modules/@jimp/plugin-color/node_modules/zod/v3/errors.js"() {
131447
131447
  init_en2();
131448
131448
  overrideErrorMap = en_default2;
131449
131449
  }
131450
131450
  });
131451
131451
 
131452
- // node_modules/@jimp/plugin-blit/node_modules/zod/v3/helpers/parseUtil.js
131452
+ // node_modules/@jimp/plugin-color/node_modules/zod/v3/helpers/parseUtil.js
131453
131453
  function addIssueToContext(ctx, issueData) {
131454
131454
  const overrideMap = getErrorMap2();
131455
131455
  const issue3 = makeIssue({
@@ -131471,7 +131471,7 @@ function addIssueToContext(ctx, issueData) {
131471
131471
  }
131472
131472
  var makeIssue, EMPTY_PATH, ParseStatus, INVALID2, DIRTY, OK, isAborted, isDirty, isValid2, isAsync;
131473
131473
  var init_parseUtil = __esm({
131474
- "node_modules/@jimp/plugin-blit/node_modules/zod/v3/helpers/parseUtil.js"() {
131474
+ "node_modules/@jimp/plugin-color/node_modules/zod/v3/helpers/parseUtil.js"() {
131475
131475
  init_errors6();
131476
131476
  init_en2();
131477
131477
  makeIssue = (params) => {
@@ -131566,16 +131566,16 @@ var init_parseUtil = __esm({
131566
131566
  }
131567
131567
  });
131568
131568
 
131569
- // node_modules/@jimp/plugin-blit/node_modules/zod/v3/helpers/typeAliases.js
131569
+ // node_modules/@jimp/plugin-color/node_modules/zod/v3/helpers/typeAliases.js
131570
131570
  var init_typeAliases = __esm({
131571
- "node_modules/@jimp/plugin-blit/node_modules/zod/v3/helpers/typeAliases.js"() {
131571
+ "node_modules/@jimp/plugin-color/node_modules/zod/v3/helpers/typeAliases.js"() {
131572
131572
  }
131573
131573
  });
131574
131574
 
131575
- // node_modules/@jimp/plugin-blit/node_modules/zod/v3/helpers/errorUtil.js
131575
+ // node_modules/@jimp/plugin-color/node_modules/zod/v3/helpers/errorUtil.js
131576
131576
  var errorUtil;
131577
131577
  var init_errorUtil = __esm({
131578
- "node_modules/@jimp/plugin-blit/node_modules/zod/v3/helpers/errorUtil.js"() {
131578
+ "node_modules/@jimp/plugin-color/node_modules/zod/v3/helpers/errorUtil.js"() {
131579
131579
  (function(errorUtil3) {
131580
131580
  errorUtil3.errToObj = (message) => typeof message === "string" ? { message } : message || {};
131581
131581
  errorUtil3.toString = (message) => typeof message === "string" ? message : message?.message;
@@ -131583,7 +131583,7 @@ var init_errorUtil = __esm({
131583
131583
  }
131584
131584
  });
131585
131585
 
131586
- // node_modules/@jimp/plugin-blit/node_modules/zod/v3/types.js
131586
+ // node_modules/@jimp/plugin-color/node_modules/zod/v3/types.js
131587
131587
  function processCreateParams(params) {
131588
131588
  if (!params)
131589
131589
  return {};
@@ -131777,7 +131777,7 @@ function custom2(check3, _params = {}, fatal) {
131777
131777
  }
131778
131778
  var ParseInputLazyPath, handleResult, ZodType2, cuidRegex, cuid2Regex, ulidRegex, uuidRegex, nanoidRegex, jwtRegex, durationRegex, emailRegex, _emojiRegex, emojiRegex, ipv4Regex, ipv4CidrRegex, ipv6Regex, ipv6CidrRegex, base64Regex, base64urlRegex, dateRegexSource, dateRegex, ZodString2, ZodNumber2, ZodBigInt2, ZodBoolean2, ZodDate2, ZodSymbol2, ZodUndefined2, ZodNull2, ZodAny2, ZodUnknown2, ZodNever2, ZodVoid2, ZodArray2, ZodObject2, ZodUnion2, getDiscriminator, ZodDiscriminatedUnion2, ZodIntersection2, ZodTuple2, ZodRecord2, ZodMap2, ZodSet2, ZodFunction2, ZodLazy2, ZodLiteral2, ZodEnum2, ZodNativeEnum, ZodPromise2, ZodEffects, ZodOptional2, ZodNullable2, ZodDefault2, ZodCatch2, ZodNaN2, BRAND, ZodBranded, ZodPipeline, ZodReadonly2, late, ZodFirstPartyTypeKind2, instanceOfType, stringType, numberType, nanType, bigIntType, booleanType, dateType, symbolType, undefinedType, nullType, anyType, unknownType, neverType, voidType, arrayType, objectType, strictObjectType, unionType, discriminatedUnionType, intersectionType, tupleType, recordType, mapType, setType, functionType, lazyType, literalType, enumType, nativeEnumType, promiseType, effectsType, optionalType, nullableType, preprocessType, pipelineType, ostring, onumber, oboolean, coerce, NEVER2;
131779
131779
  var init_types3 = __esm({
131780
- "node_modules/@jimp/plugin-blit/node_modules/zod/v3/types.js"() {
131780
+ "node_modules/@jimp/plugin-color/node_modules/zod/v3/types.js"() {
131781
131781
  init_ZodError();
131782
131782
  init_errors6();
131783
131783
  init_errorUtil();
@@ -135039,7 +135039,7 @@ var init_types3 = __esm({
135039
135039
  }
135040
135040
  });
135041
135041
 
135042
- // node_modules/@jimp/plugin-blit/node_modules/zod/v3/external.js
135042
+ // node_modules/@jimp/plugin-color/node_modules/zod/v3/external.js
135043
135043
  var external_exports2 = {};
135044
135044
  __export(external_exports2, {
135045
135045
  BRAND: () => BRAND,
@@ -135151,7 +135151,7 @@ __export(external_exports2, {
135151
135151
  void: () => voidType
135152
135152
  });
135153
135153
  var init_external2 = __esm({
135154
- "node_modules/@jimp/plugin-blit/node_modules/zod/v3/external.js"() {
135154
+ "node_modules/@jimp/plugin-color/node_modules/zod/v3/external.js"() {
135155
135155
  init_errors6();
135156
135156
  init_parseUtil();
135157
135157
  init_typeAliases();
@@ -135161,10 +135161,10 @@ var init_external2 = __esm({
135161
135161
  }
135162
135162
  });
135163
135163
 
135164
- // node_modules/@jimp/plugin-blit/node_modules/zod/index.js
135164
+ // node_modules/@jimp/plugin-color/node_modules/zod/index.js
135165
135165
  var zod_default;
135166
135166
  var init_zod2 = __esm({
135167
- "node_modules/@jimp/plugin-blit/node_modules/zod/index.js"() {
135167
+ "node_modules/@jimp/plugin-color/node_modules/zod/index.js"() {
135168
135168
  init_external2();
135169
135169
  init_external2();
135170
135170
  zod_default = external_exports2;
@@ -653365,7 +653365,7 @@ async function ensureSeaPlaywrightRuntime(sea) {
653365
653365
  const manifest = readManifest3(sea);
653366
653366
  const cacheDirectory = (0, import_node_path174.join)(
653367
653367
  cacheBaseDirectory(),
653368
- "4.0.0-mirror.2",
653368
+ "4.0.0-mirror.3",
653369
653369
  manifest.target,
653370
653370
  `playwright-${manifest.packageVersion}-${manifest.hash}`
653371
653371
  );
@@ -655997,7 +655997,7 @@ var init_tui_runtime_loader = __esm({
655997
655997
  const manifest = readManifest4(sea);
655998
655998
  const cacheDirectory = (0, import_node_path177.join)(
655999
655999
  cacheBaseDirectory2(),
656000
- "4.0.0-mirror.2",
656000
+ "4.0.0-mirror.3",
656001
656001
  manifest.target,
656002
656002
  manifest.hash
656003
656003
  );
@@ -656515,7 +656515,7 @@ var init_run = __esm({
656515
656515
  init_tui_command();
656516
656516
  init_browser_state_option();
656517
656517
  init_workflow_mode();
656518
- version3 = true ? "4.0.0-mirror.2" : "0.0.0";
656518
+ version3 = true ? "4.0.0-mirror.3" : "0.0.0";
656519
656519
  EMPTY_TARGET_ERROR = "--target requires non-empty text.";
656520
656520
  DEFAULT_HEADLESS_PROMPT_MODE = "yolo";
656521
656521
  FORCE_MCS_SCOPE_ERROR = "--force-mcs can only be used with --prompt, --target, or tui.";
package/bin/zcode.mjs CHANGED
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { readFile } from "node:fs/promises";
3
+ import Module from "node:module";
3
4
  import { dirname, resolve } from "node:path";
4
5
  import { fileURLToPath, pathToFileURL } from "node:url";
5
6
 
@@ -11,6 +12,35 @@ const args = process.argv.slice(2);
11
12
  if (args.length === 1 && ["--version", "-v"].includes(args[0])) {
12
13
  console.log(version);
13
14
  } else {
15
+ // Node 26 默认内置实验性 node:ffi,但 @mbears/opentui-core 的 node:ffi 后端尚不支持 usize;
16
+ // 屏蔽 node:ffi 使其自动回落到已打包的 koffi 后端,需要时可用 ZCODE_ALLOW_NODE_FFI=1 放开。
17
+ if (
18
+ process.env.ZCODE_ALLOW_NODE_FFI !== "1" &&
19
+ (Module.builtinModules.includes("node:ffi") || Module.builtinModules.includes("ffi"))
20
+ ) {
21
+ if (typeof Module.registerHooks === "function") {
22
+ Module.registerHooks({
23
+ resolve(specifier, context, nextResolve) {
24
+ if (specifier === "node:ffi" || specifier === "ffi") {
25
+ const err = new Error(`Disabled experimental ${specifier} for OpenTUI koffi fallback`);
26
+ err.code = "ERR_UNKNOWN_BUILTIN_MODULE";
27
+ throw err;
28
+ }
29
+ return nextResolve(specifier, context);
30
+ },
31
+ });
32
+ } else if (typeof Module._load === "function") {
33
+ const originalLoad = Module._load;
34
+ Module._load = function (request, parent, isMain) {
35
+ if (request === "node:ffi" || request === "ffi") {
36
+ const err = new Error(`Disabled experimental ${request} for OpenTUI koffi fallback`);
37
+ err.code = "ERR_UNKNOWN_BUILTIN_MODULE";
38
+ throw err;
39
+ }
40
+ return originalLoad.call(this, request, parent, isMain);
41
+ };
42
+ }
43
+ }
14
44
  // CLI 自启动子进程依赖真实 Agent 路径;其他参数(包括 --web)不由镜像 launcher 解释。
15
45
  process.argv[1] = agentEntry;
16
46
  await import(pathToFileURL(agentEntry).href);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wormw/zcode-cli",
3
- "version": "4.0.0-mirror.2",
3
+ "version": "4.0.0-mirror.3",
4
4
  "private": false,
5
5
  "description": "Unofficial CLI-only build of the official ZCode Agent CLI",
6
6
  "license": "Apache-2.0",