arisa 2.3.8 → 2.3.9
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 +22 -18
package/package.json
CHANGED
package/src/daemon/setup.ts
CHANGED
|
@@ -276,31 +276,35 @@ 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
|
-
|
|
281
|
-
|
|
282
|
-
.replace(/\x1b[^\x1b]{0,5}/g, "") // other ESC sequences
|
|
283
|
-
.replace(/\r/g, ""); // carriage returns
|
|
284
|
-
|
|
279
|
+
// Find token in raw output — don't rely on ANSI stripping or line parsing.
|
|
280
|
+
// Just locate "sk-ant-" and the end boundary, then keep only token chars.
|
|
281
|
+
const startIdx = output.indexOf("sk-ant-");
|
|
285
282
|
let token = "";
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
283
|
+
|
|
284
|
+
if (startIdx >= 0) {
|
|
285
|
+
// End boundary: look for known text after the token
|
|
286
|
+
let endIdx = output.indexOf("Store this token", startIdx);
|
|
287
|
+
if (endIdx < 0) endIdx = output.indexOf("Use this token", startIdx);
|
|
288
|
+
if (endIdx < 0) endIdx = startIdx + 300;
|
|
289
|
+
|
|
290
|
+
const tokenArea = output.substring(startIdx, endIdx);
|
|
291
|
+
// Strip EVERYTHING except token-valid chars: A-Z a-z 0-9 _ -
|
|
292
|
+
token = tokenArea.replace(/[^A-Za-z0-9_-]/g, "");
|
|
295
293
|
}
|
|
296
294
|
|
|
297
|
-
if (token) {
|
|
298
|
-
console.log(` [
|
|
295
|
+
if (token && token.startsWith("sk-ant-") && token.length > 50) {
|
|
296
|
+
console.log(` [token] ${token.slice(0, 20)}...${token.slice(-6)} (${token.length} chars)`);
|
|
299
297
|
vars.CLAUDE_CODE_OAUTH_TOKEN = token;
|
|
300
298
|
saveEnv(vars);
|
|
301
299
|
console.log(" ✓ claude token saved to .env");
|
|
302
300
|
} else {
|
|
303
|
-
console.log(
|
|
301
|
+
console.log(` ⚠ token extraction failed (indexOf=${startIdx}, len=${token.length})`);
|
|
302
|
+
// Dump raw bytes around expected position for debugging
|
|
303
|
+
if (startIdx >= 0) {
|
|
304
|
+
const raw = output.substring(startIdx, startIdx + 200);
|
|
305
|
+
const hex = [...raw].map(c => c.charCodeAt(0).toString(16).padStart(2, "0")).join(" ");
|
|
306
|
+
console.log(` [hex] ${hex.slice(0, 300)}`);
|
|
307
|
+
}
|
|
304
308
|
}
|
|
305
309
|
console.log(` ✓ claude login successful`);
|
|
306
310
|
return true;
|