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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arisa",
3
- "version": "2.3.5",
3
+ "version": "2.3.7",
4
4
  "description": "Arisa - dynamic agent runtime with daemon/core architecture that evolves through user interaction",
5
5
  "preferGlobal": true,
6
6
  "bin": {
@@ -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
- // Extract token (sk-ant-oat01-...) may span multiple lines due to terminal wrapping
280
- const tokenMatch = output.match(/sk-ant-[A-Za-z0-9_-]+(?:\n[A-Za-z0-9_-]+)*/);
281
- if (tokenMatch) {
282
- vars.CLAUDE_CODE_OAUTH_TOKEN = tokenMatch[0].replace(/\n/g, "");
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;