arisa 2.3.5 → 2.3.7
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/daemon/setup.ts +23 -4
package/package.json
CHANGED
package/src/daemon/setup.ts
CHANGED
|
@@ -276,12 +276,31 @@ async function runInteractiveLogin(cli: AgentCliName, vars: Record<string, strin
|
|
|
276
276
|
|
|
277
277
|
const exitCode = await proc.exited;
|
|
278
278
|
if (exitCode === 0) {
|
|
279
|
-
//
|
|
280
|
-
const
|
|
281
|
-
|
|
282
|
-
|
|
279
|
+
// Strip ALL ANSI escape sequences and control chars, then extract token line-by-line
|
|
280
|
+
const clean = output
|
|
281
|
+
.replace(/\x1b\[[\x20-\x3f]*[\x40-\x7e]/g, "") // CSI sequences
|
|
282
|
+
.replace(/\x1b[^\x1b]{0,5}/g, "") // other ESC sequences
|
|
283
|
+
.replace(/\r/g, ""); // carriage returns
|
|
284
|
+
|
|
285
|
+
let token = "";
|
|
286
|
+
for (const line of clean.split("\n")) {
|
|
287
|
+
const t = line.trim();
|
|
288
|
+
if (t.startsWith("sk-ant-")) {
|
|
289
|
+
token = t;
|
|
290
|
+
} else if (token && t && /^[A-Za-z0-9_-]+$/.test(t)) {
|
|
291
|
+
token += t; // continuation line (wrapped token)
|
|
292
|
+
} else if (token) {
|
|
293
|
+
break; // end of token (empty line or text)
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
if (token) {
|
|
298
|
+
console.log(` [debug] token captured: ${token.slice(0, 20)}...${token.slice(-10)} (${token.length} chars)`);
|
|
299
|
+
vars.CLAUDE_CODE_OAUTH_TOKEN = token;
|
|
283
300
|
saveEnv(vars);
|
|
284
301
|
console.log(" ✓ claude token saved to .env");
|
|
302
|
+
} else {
|
|
303
|
+
console.log(" ⚠ could not extract token from output");
|
|
285
304
|
}
|
|
286
305
|
console.log(` ✓ claude login successful`);
|
|
287
306
|
return true;
|