arisa 2.3.2 → 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/package.json +1 -1
- package/src/shared/ai-cli.ts +17 -1
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);
|