@lark-codem/codem-cli 0.1.178 → 0.1.179-windows-daemon-host-design.202608210555.0.g508ad99

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/codem.js CHANGED
@@ -18,6 +18,8 @@ import { createRequire } from "node:module";
18
18
  import path from "node:path";
19
19
  import { fileURLToPath, pathToFileURL } from "node:url";
20
20
 
21
+ import { applyHostedWindowsChildOptions } from "./platform-child-process.js";
22
+
21
23
  const require = createRequire(import.meta.url);
22
24
  const LAUNCHER_DIR = path.dirname(fileURLToPath(import.meta.url));
23
25
  const PACKAGE_ROOT = path.resolve(LAUNCHER_DIR, "..");
@@ -51,7 +53,7 @@ function resolvePlatformBinary() {
51
53
  // spawn 的失败有两条互斥出口:只有 EACCES / EAGAIN / EMFILE / ENFILE / ENOENT
52
54
  // 会被 Node 降级成异步 `error` 事件,其余 errno(ENOEXEC / ENOTDIR / EPERM,以及
53
55
  // Windows 上杀软 / EDR 拦截 CreateProcessW 时 libuv 报的 UNKNOWN=-4094)在
54
- // `child_process.spawn()` 里直接 `throw new ErrnoException(err, 'spawn')`。
56
+ // `child_process.spawn` 里直接 `throw new ErrnoException(err, 'spawn')`。
55
57
  // 两条出口必须汇到同一个 reporter:只挂 child.on("error") 的话,后一类失败会以
56
58
  // 一段指向 node:internal/child_process 的裸栈抛给用户——codem-cli 的平台二进制是
57
59
  // bun --compile 出来的未签名可执行文件,Windows 上被拦截是真实可达路径。
@@ -79,7 +81,11 @@ const binaryPath = resolvePlatformBinary();
79
81
  if (binaryPath) {
80
82
  let child;
81
83
  try {
82
- child = spawn(binaryPath, process.argv.slice(2), { stdio: "inherit" });
84
+ child = spawn(
85
+ binaryPath,
86
+ process.argv.slice(2),
87
+ applyHostedWindowsChildOptions({ stdio: "inherit" })
88
+ );
83
89
  } catch (error) {
84
90
  reportSpawnFailure(binaryPath, error);
85
91
  }
@@ -0,0 +1,23 @@
1
+ // The dedicated Windows daemon Host owns the top-level console policy. Every
2
+ // child it can reach must stay hidden, and a local spawn option must not be able
3
+ // to undo that invariant. Interactive and non-Windows launches keep their
4
+ // options object untouched.
5
+ export function applyHostedWindowsChildOptions(
6
+ options = {},
7
+ {
8
+ // Hosted mode belongs to the current daemon process, not to the child env
9
+ // object supplied by an individual caller. Otherwise a caller could omit
10
+ // or replace `options.env` and accidentally bypass the console invariant.
11
+ env = process.env,
12
+ platform = process.platform
13
+ } = {}
14
+ ) {
15
+ if (platform !== "win32" || env?.CODEM_DAEMON_HOSTED_WINDOWS !== "1") {
16
+ return options;
17
+ }
18
+
19
+ return {
20
+ ...options,
21
+ windowsHide: true
22
+ };
23
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lark-codem/codem-cli",
3
- "version": "0.1.178",
3
+ "version": "0.1.179-windows-daemon-host-design.202608210555.0.g508ad99",
4
4
  "type": "module",
5
5
  "description": "CodeM local CLI for Feishu-driven coding sessions",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -26,15 +26,12 @@
26
26
  "access": "public"
27
27
  },
28
28
  "dependencies": {
29
- "@lark-codem/codem-core": "latest"
29
+ "@lark-codem/codem-core": "0.8.8-windows-daemon-host-design.202608210555.0.g1ff50c2"
30
30
  },
31
31
  "optionalDependencies": {
32
- "@lark-codem/codem-cli-darwin-arm64": "0.1.178",
33
- "@lark-codem/codem-cli-darwin-x64": "0.1.178",
34
- "@lark-codem/codem-cli-linux-arm64": "0.1.178",
35
- "@lark-codem/codem-cli-linux-x64": "0.1.178",
36
- "@lark-codem/codem-cli-win32-arm64": "0.1.178",
37
- "@lark-codem/codem-cli-win32-x64": "0.1.178"
32
+ "@lark-codem/codem-cli-darwin-arm64": "0.1.179-windows-daemon-host-design.202608210555.0.g508ad99",
33
+ "@lark-codem/codem-cli-linux-arm64": "0.1.179-windows-daemon-host-design.202608210555.0.g508ad99",
34
+ "@lark-codem/codem-cli-linux-x64": "0.1.179-windows-daemon-host-design.202608210555.0.g508ad99"
38
35
  },
39
36
  "engines": {
40
37
  "node": ">=18"