arisa 2.3.10 → 2.3.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.
- package/package.json +1 -1
- package/src/core/processor.ts +1 -1
- package/src/daemon/auto-install.ts +10 -2
- package/src/daemon/setup.ts +22 -1
package/package.json
CHANGED
package/src/core/processor.ts
CHANGED
|
@@ -134,7 +134,7 @@ async function runClaude(message: string, chatId: string): Promise<string> {
|
|
|
134
134
|
const historyCount = historyContext ? historyContext.split("\nUser: ").length - 1 : 0;
|
|
135
135
|
log.info(`Model: ${model.model} (${model.reason}) | History: ${historyCount} exchanges`);
|
|
136
136
|
|
|
137
|
-
const args = ["--dangerously-skip-permissions"];
|
|
137
|
+
const args = ["--dangerously-skip-permissions", "--output-format", "text"];
|
|
138
138
|
|
|
139
139
|
args.push("--model", model.model);
|
|
140
140
|
args.push("-p", prompt);
|
|
@@ -108,12 +108,20 @@ export async function probeCliAuth(): Promise<void> {
|
|
|
108
108
|
if (!isAgentCliInstalled(cli)) continue;
|
|
109
109
|
|
|
110
110
|
log.info(`Auth probe: testing ${cli}...`);
|
|
111
|
+
if (cli === "claude") {
|
|
112
|
+
const hasToken = !!process.env.CLAUDE_CODE_OAUTH_TOKEN;
|
|
113
|
+
const tokenPreview = hasToken ? `${process.env.CLAUDE_CODE_OAUTH_TOKEN!.slice(0, 15)}...` : "NOT SET";
|
|
114
|
+
log.info(`Auth probe: CLAUDE_CODE_OAUTH_TOKEN=${tokenPreview}`);
|
|
115
|
+
}
|
|
111
116
|
try {
|
|
112
117
|
const args = cli === "claude"
|
|
113
|
-
? ["-p", "say ok", "--model", "haiku", "--dangerously-skip-permissions"]
|
|
118
|
+
? ["-p", "say ok", "--model", "haiku", "--output-format", "text", "--dangerously-skip-permissions"]
|
|
114
119
|
: ["exec", "--dangerously-bypass-approvals-and-sandbox", "echo ok"];
|
|
115
120
|
|
|
116
|
-
const
|
|
121
|
+
const cmd = buildBunWrappedAgentCliCommand(cli, args);
|
|
122
|
+
log.info(`Auth probe cmd: ${cmd.map(c => c.length > 80 ? c.slice(0, 80) + "..." : c).join(" ")}`);
|
|
123
|
+
|
|
124
|
+
const proc = Bun.spawn(cmd, {
|
|
117
125
|
stdout: "pipe",
|
|
118
126
|
stderr: "pipe",
|
|
119
127
|
env: { ...process.env },
|
package/src/daemon/setup.ts
CHANGED
|
@@ -300,11 +300,32 @@ async function runInteractiveLogin(cli: AgentCliName, vars: Record<string, strin
|
|
|
300
300
|
if (token && token.startsWith("sk-ant-") && token.length > 50 && token.length < 150) {
|
|
301
301
|
console.log(` [token] ${token.slice(0, 20)}...${token.slice(-6)} (${token.length} chars)`);
|
|
302
302
|
vars.CLAUDE_CODE_OAUTH_TOKEN = token;
|
|
303
|
+
process.env.CLAUDE_CODE_OAUTH_TOKEN = token;
|
|
303
304
|
saveEnv(vars);
|
|
304
305
|
console.log(" ✓ claude token saved to .env");
|
|
306
|
+
|
|
307
|
+
// Also write credentials file for arisa user (belt + suspenders)
|
|
308
|
+
const claudeDir = isRunningAsRoot() ? "/home/arisa/.claude" : join(process.env.HOME || "~", ".claude");
|
|
309
|
+
try {
|
|
310
|
+
if (!existsSync(claudeDir)) mkdirSync(claudeDir, { recursive: true });
|
|
311
|
+
const credsPath = join(claudeDir, ".credentials.json");
|
|
312
|
+
const creds = {
|
|
313
|
+
claudeAiOauth: {
|
|
314
|
+
accessToken: token,
|
|
315
|
+
expiresAt: Date.now() + 365 * 24 * 60 * 60 * 1000,
|
|
316
|
+
scopes: ["user:inference", "user:profile"],
|
|
317
|
+
},
|
|
318
|
+
};
|
|
319
|
+
writeFileSync(credsPath, JSON.stringify(creds, null, 2) + "\n");
|
|
320
|
+
if (isRunningAsRoot()) {
|
|
321
|
+
Bun.spawnSync(["chown", "-R", "arisa:arisa", claudeDir]);
|
|
322
|
+
}
|
|
323
|
+
console.log(` ✓ credentials written to ${credsPath}`);
|
|
324
|
+
} catch (e) {
|
|
325
|
+
console.log(` ⚠ could not write credentials file: ${e}`);
|
|
326
|
+
}
|
|
305
327
|
} else {
|
|
306
328
|
console.log(` ⚠ token extraction failed (indexOf=${startIdx}, len=${token.length})`);
|
|
307
|
-
// Show what the cleaned text looks like around the token
|
|
308
329
|
if (startIdx >= 0) {
|
|
309
330
|
console.log(` [clean] ${clean.substring(startIdx, startIdx + 150).replace(/\n/g, "\\n")}`);
|
|
310
331
|
}
|