arisa 2.3.1 → 2.3.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/bin/arisa.js +1 -1
- package/package.json +1 -1
- package/src/shared/ai-cli.ts +17 -1
- package/src/shared/ink-shim.js +3 -1
package/bin/arisa.js
CHANGED
|
@@ -450,7 +450,7 @@ function provisionArisaUser() {
|
|
|
450
450
|
|
|
451
451
|
// 3. Write ink-shim for non-TTY execution (prevents Ink setRawMode crash)
|
|
452
452
|
const shimPath = "/home/arisa/.arisa-ink-shim.js";
|
|
453
|
-
writeFileSync(shimPath, 'if(process.stdin&&!process.stdin.
|
|
453
|
+
writeFileSync(shimPath, 'if(process.stdin&&!process.stdin.isTTY){process.stdin.setRawMode=()=>process.stdin;process.stdin.isTTY=true;}\n');
|
|
454
454
|
spawnSync("chown", ["arisa:arisa", shimPath], { stdio: "ignore" });
|
|
455
455
|
step(true, "Ink shim installed");
|
|
456
456
|
|
package/package.json
CHANGED
package/src/shared/ai-cli.ts
CHANGED
|
@@ -78,13 +78,29 @@ export function isAgentCliInstalled(cli: AgentCliName): boolean {
|
|
|
78
78
|
|
|
79
79
|
const INK_SHIM = join(dirname(new URL(import.meta.url).pathname), "ink-shim.js");
|
|
80
80
|
|
|
81
|
+
// Env vars that must survive the su - login shell reset
|
|
82
|
+
const PASSTHROUGH_VARS = [
|
|
83
|
+
"CLAUDE_CODE_OAUTH_TOKEN",
|
|
84
|
+
"ANTHROPIC_API_KEY",
|
|
85
|
+
"OPENAI_API_KEY",
|
|
86
|
+
];
|
|
87
|
+
|
|
88
|
+
function buildEnvExports(): string {
|
|
89
|
+
const exports: string[] = [];
|
|
90
|
+
for (const key of PASSTHROUGH_VARS) {
|
|
91
|
+
const val = process.env[key];
|
|
92
|
+
if (val) exports.push(`export ${key}=${shellEscape(val)}`);
|
|
93
|
+
}
|
|
94
|
+
return exports.length > 0 ? exports.join(" && ") + " && " : "";
|
|
95
|
+
}
|
|
96
|
+
|
|
81
97
|
export function buildBunWrappedAgentCliCommand(cli: AgentCliName, args: string[]): string[] {
|
|
82
98
|
if (isRunningAsRoot()) {
|
|
83
99
|
// Run as arisa user — Claude CLI refuses to run as root
|
|
84
100
|
const cliPath = resolveAgentCliPath(cli) || join(ARISA_USER_BUN, cli);
|
|
85
101
|
const shimPath = existsSync(ARISA_INK_SHIM) ? ARISA_INK_SHIM : INK_SHIM;
|
|
86
102
|
const inner = ["bun", "--preload", shimPath, cliPath, ...args].map(shellEscape).join(" ");
|
|
87
|
-
return ["su", "-", "arisa", "-c", `${ARISA_BUN_ENV} && ${inner}`];
|
|
103
|
+
return ["su", "-", "arisa", "-c", `${ARISA_BUN_ENV} && ${buildEnvExports()}${inner}`];
|
|
88
104
|
}
|
|
89
105
|
|
|
90
106
|
const cliPath = resolveAgentCliPath(cli);
|
package/src/shared/ink-shim.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
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
|
-
|
|
3
|
+
// Must patch when isTTY is false — setRawMode may exist but throw at runtime.
|
|
4
|
+
if (process.stdin && !process.stdin.isTTY) {
|
|
4
5
|
process.stdin.setRawMode = () => process.stdin;
|
|
6
|
+
process.stdin.isTTY = true;
|
|
5
7
|
}
|