arisa 2.3.33 → 2.3.34
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/package.json +1 -1
- package/src/core/processor.ts +3 -2
- package/src/daemon/agent-cli.ts +2 -1
- package/src/shared/ai-cli.ts +5 -1
- package/src/shared/ink-shim.js +11 -4
package/package.json
CHANGED
package/src/core/processor.ts
CHANGED
|
@@ -16,7 +16,7 @@ import { getRecentHistory } from "./history";
|
|
|
16
16
|
import { shouldContinue } from "./context";
|
|
17
17
|
import { config } from "../shared/config";
|
|
18
18
|
import { createLogger } from "../shared/logger";
|
|
19
|
-
import { buildBunWrappedAgentCliCommand } from "../shared/ai-cli";
|
|
19
|
+
import { buildBunWrappedAgentCliCommand, CLI_SPAWN_ENV } from "../shared/ai-cli";
|
|
20
20
|
import { existsSync, mkdirSync, readFileSync, appendFileSync } from "fs";
|
|
21
21
|
import { join } from "path";
|
|
22
22
|
|
|
@@ -151,7 +151,7 @@ async function runClaude(message: string, chatId: string): Promise<string> {
|
|
|
151
151
|
stdin: "pipe",
|
|
152
152
|
stdout: "pipe",
|
|
153
153
|
stderr: "pipe",
|
|
154
|
-
env: { ...process.env },
|
|
154
|
+
env: { ...process.env, ...CLI_SPAWN_ENV },
|
|
155
155
|
});
|
|
156
156
|
proc.stdin.end();
|
|
157
157
|
|
|
@@ -221,6 +221,7 @@ export async function processWithCodex(message: string): Promise<string> {
|
|
|
221
221
|
cwd: config.projectDir,
|
|
222
222
|
stdout: "pipe",
|
|
223
223
|
stderr: "pipe",
|
|
224
|
+
env: { ...process.env, ...CLI_SPAWN_ENV },
|
|
224
225
|
});
|
|
225
226
|
|
|
226
227
|
const timeout = setTimeout(() => {
|
package/src/daemon/agent-cli.ts
CHANGED
|
@@ -14,6 +14,7 @@ import { createLogger } from "../shared/logger";
|
|
|
14
14
|
import {
|
|
15
15
|
buildBunWrappedAgentCliCommand,
|
|
16
16
|
resolveAgentCliPath,
|
|
17
|
+
CLI_SPAWN_ENV,
|
|
17
18
|
type AgentCliName,
|
|
18
19
|
} from "../shared/ai-cli";
|
|
19
20
|
|
|
@@ -71,7 +72,7 @@ async function runSingleCli(
|
|
|
71
72
|
cwd: config.projectDir,
|
|
72
73
|
stdout: "pipe",
|
|
73
74
|
stderr: "pipe",
|
|
74
|
-
env: { ...process.env },
|
|
75
|
+
env: { ...process.env, ...CLI_SPAWN_ENV },
|
|
75
76
|
});
|
|
76
77
|
|
|
77
78
|
const timeout = setTimeout(() => proc.kill(), timeoutMs);
|
package/src/shared/ai-cli.ts
CHANGED
|
@@ -101,6 +101,9 @@ export interface AgentCliOptions {
|
|
|
101
101
|
skipPreload?: boolean;
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
+
/** Env vars to suppress Ink/TTY in non-interactive CLI spawns. Merge into Bun.spawn env. */
|
|
105
|
+
export const CLI_SPAWN_ENV: Record<string, string> = { CI: "true", TERM: "dumb" };
|
|
106
|
+
|
|
104
107
|
/**
|
|
105
108
|
* Detect native executables (Mach-O, ELF) by reading magic bytes.
|
|
106
109
|
* Claude Code CLI v2+ ships as a native binary, not a JS script.
|
|
@@ -139,11 +142,12 @@ export function buildBunWrappedAgentCliCommand(cli: AgentCliName, args: string[]
|
|
|
139
142
|
|
|
140
143
|
if (isRunningAsRoot()) {
|
|
141
144
|
// Run as arisa user — Claude CLI refuses to run as root.
|
|
145
|
+
const ciEnv = options?.skipPreload ? "" : "export CI=true && export TERM=dumb && ";
|
|
142
146
|
const inner = native
|
|
143
147
|
? [cliPath, ...args].map(shellEscape).join(" ")
|
|
144
148
|
: ["bun", "--bun", ...(!options?.skipPreload ? ["--preload", INK_SHIM] : []), cliPath, ...args].map(shellEscape).join(" ");
|
|
145
149
|
// su without "-" preserves parent env (tokens, keys); explicit HOME/PATH for arisa
|
|
146
|
-
return ["su", "arisa", "-s", "/bin/bash", "-c", `${ARISA_BUN_ENV} && ${buildEnvExports()}${inner}`];
|
|
150
|
+
return ["su", "arisa", "-s", "/bin/bash", "-c", `${ARISA_BUN_ENV} && ${ciEnv}${buildEnvExports()}${inner}`];
|
|
147
151
|
}
|
|
148
152
|
|
|
149
153
|
if (native) {
|
package/src/shared/ink-shim.js
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
// Shim for running CLI tools that use Ink without a TTY.
|
|
2
2
|
// Prevents "Raw mode is not supported" crash by providing a no-op setRawMode.
|
|
3
|
-
//
|
|
4
|
-
if (process.stdin
|
|
5
|
-
process.stdin.
|
|
6
|
-
|
|
3
|
+
// Uses Object.defineProperty for robustness (Bun may make stdin props non-writable).
|
|
4
|
+
if (process.stdin) {
|
|
5
|
+
if (!process.stdin.isTTY) {
|
|
6
|
+
try { Object.defineProperty(process.stdin, "isTTY", { value: true, writable: true, configurable: true }); }
|
|
7
|
+
catch { process.stdin.isTTY = true; }
|
|
8
|
+
}
|
|
9
|
+
if (typeof process.stdin.setRawMode !== "function") {
|
|
10
|
+
const noop = function () { return process.stdin; };
|
|
11
|
+
try { Object.defineProperty(process.stdin, "setRawMode", { value: noop, writable: true, configurable: true }); }
|
|
12
|
+
catch { process.stdin.setRawMode = noop; }
|
|
13
|
+
}
|
|
7
14
|
}
|