@nowcrew/daemon 0.5.11 → 0.5.12

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.
@@ -18,14 +18,25 @@ export function buildCodexArgs(input) {
18
18
  }
19
19
  if (input.dangerous)
20
20
  args.push("--dangerously-bypass-approvals-and-sandbox");
21
- args.push(input.wakePrompt);
21
+ // `-` instructs codex exec to read the prompt from stdin. Keeping the complete prompt out of argv
22
+ // avoids Windows' command-line length limit when a thread carries a large wake context.
23
+ args.push("-");
22
24
  return args;
23
25
  }
24
26
  export function spawnCodex(input) {
25
- // stdio 固定 ignore/pipe/pipe,stdout/stderr 必为 Readable;cross-spawn 类型不带该细化,断言之
26
- return spawn(input.bin, buildCodexArgs(input), {
27
+ // stdio 固定 pipe/pipe/pipe;cross-spawn 类型不带该细化,断言之。
28
+ const child = spawn(input.bin, buildCodexArgs(input), {
27
29
  cwd: input.cwd,
28
30
  env: input.env,
29
- stdio: ["ignore", "pipe", "pipe"],
31
+ stdio: ["pipe", "pipe", "pipe"],
30
32
  });
33
+ // Decode at the pipe boundary so split multi-byte characters are buffered correctly before
34
+ // readline, stderr forwarding, activity reporting, and websocket JSON serialization consume them.
35
+ child.stdout.setEncoding("utf8");
36
+ child.stderr.setEncoding("utf8");
37
+ // Codex may exit before consuming a large prompt (for example on config/auth failure). In that
38
+ // case the pipe can emit EPIPE; the child exit code and stderr remain the authoritative failure.
39
+ child.stdin.on("error", () => undefined);
40
+ child.stdin.end(input.wakePrompt);
41
+ return child;
31
42
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nowcrew/daemon",
3
- "version": "0.5.11",
3
+ "version": "0.5.12",
4
4
  "type": "module",
5
5
  "description": "crew daemon — 运行在用户机器:拉起/管理 agent 进程,注入 crew CLI,归一化 runtime 事件",
6
6
  "license": "Apache-2.0",