arisa 2.3.30 → 2.3.31
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
CHANGED
|
@@ -131,7 +131,7 @@ async function runClaudeSetupToken(): Promise<void> {
|
|
|
131
131
|
|
|
132
132
|
let proc: ReturnType<typeof Bun.spawn>;
|
|
133
133
|
try {
|
|
134
|
-
proc = Bun.spawn(buildBunWrappedAgentCliCommand("claude", ["setup-token"]), {
|
|
134
|
+
proc = Bun.spawn(buildBunWrappedAgentCliCommand("claude", ["setup-token"], { skipPreload: true }), {
|
|
135
135
|
cwd: config.projectDir,
|
|
136
136
|
stdin: "pipe",
|
|
137
137
|
stdout: "pipe",
|
|
@@ -106,7 +106,7 @@ async function runCodexDeviceAuth(): Promise<void> {
|
|
|
106
106
|
|
|
107
107
|
let proc: ReturnType<typeof Bun.spawn>;
|
|
108
108
|
try {
|
|
109
|
-
proc = Bun.spawn(buildBunWrappedAgentCliCommand("codex", ["login", "--device-auth"]), {
|
|
109
|
+
proc = Bun.spawn(buildBunWrappedAgentCliCommand("codex", ["login", "--device-auth"], { skipPreload: true }), {
|
|
110
110
|
cwd: config.projectDir,
|
|
111
111
|
stdin: "inherit",
|
|
112
112
|
stdout: "pipe",
|
package/src/daemon/setup.ts
CHANGED
|
@@ -282,7 +282,7 @@ async function runInteractiveLogin(cli: AgentCliName, vars: Record<string, strin
|
|
|
282
282
|
try {
|
|
283
283
|
// For claude: capture stdout to extract OAuth token while still showing output
|
|
284
284
|
if (cli === "claude") {
|
|
285
|
-
const proc = Bun.spawn(buildBunWrappedAgentCliCommand(cli, args), {
|
|
285
|
+
const proc = Bun.spawn(buildBunWrappedAgentCliCommand(cli, args, { skipPreload: true }), {
|
|
286
286
|
stdin: "inherit",
|
|
287
287
|
stdout: "pipe",
|
|
288
288
|
stderr: "inherit",
|
|
@@ -390,7 +390,7 @@ async function runInteractiveLogin(cli: AgentCliName, vars: Record<string, strin
|
|
|
390
390
|
}
|
|
391
391
|
|
|
392
392
|
// For codex and others: inherit all stdio
|
|
393
|
-
const proc = Bun.spawn(buildBunWrappedAgentCliCommand(cli, args), {
|
|
393
|
+
const proc = Bun.spawn(buildBunWrappedAgentCliCommand(cli, args, { skipPreload: true }), {
|
|
394
394
|
stdin: "inherit",
|
|
395
395
|
stdout: "inherit",
|
|
396
396
|
stderr: "inherit",
|
package/src/shared/ai-cli.ts
CHANGED
|
@@ -96,12 +96,20 @@ function buildEnvExports(): string {
|
|
|
96
96
|
return exports.length > 0 ? exports.join(" && ") + " && " : "";
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
export
|
|
99
|
+
export interface AgentCliOptions {
|
|
100
|
+
/** Skip the ink-shim preload (useful for interactive login flows). Default: false */
|
|
101
|
+
skipPreload?: boolean;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export function buildBunWrappedAgentCliCommand(cli: AgentCliName, args: string[], options?: AgentCliOptions): string[] {
|
|
105
|
+
const usePreload = !options?.skipPreload;
|
|
106
|
+
const preloadArgs = usePreload ? ["--preload", INK_SHIM] : [];
|
|
107
|
+
|
|
100
108
|
if (isRunningAsRoot()) {
|
|
101
109
|
// Run as arisa user — Claude CLI refuses to run as root.
|
|
102
110
|
// This path is used by Daemon fallback calls; Core runs as arisa directly.
|
|
103
111
|
const cliPath = resolveAgentCliPath(cli) || join(ROOT_BUN_BIN, cli);
|
|
104
|
-
const inner = ["bun", "--bun",
|
|
112
|
+
const inner = ["bun", "--bun", ...preloadArgs, cliPath, ...args].map(shellEscape).join(" ");
|
|
105
113
|
// su without "-" preserves parent env (tokens, keys); explicit HOME/PATH for arisa
|
|
106
114
|
return ["su", "arisa", "-s", "/bin/bash", "-c", `${ARISA_BUN_ENV} && ${buildEnvExports()}${inner}`];
|
|
107
115
|
}
|
|
@@ -112,5 +120,5 @@ export function buildBunWrappedAgentCliCommand(cli: AgentCliName, args: string[]
|
|
|
112
120
|
}
|
|
113
121
|
// Preload shim that patches process.stdin.setRawMode to prevent Ink crash
|
|
114
122
|
// when running without a TTY (systemd, su -c, etc.)
|
|
115
|
-
return ["bun", "--bun",
|
|
123
|
+
return ["bun", "--bun", ...preloadArgs, cliPath, ...args];
|
|
116
124
|
}
|