arisa 2.3.7 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arisa",
3
- "version": "2.3.7",
3
+ "version": "2.3.9",
4
4
  "description": "Arisa - dynamic agent runtime with daemon/core architecture that evolves through user interaction",
5
5
  "preferGlobal": true,
6
6
  "bin": {
@@ -12,6 +12,12 @@
12
12
  * @effects Network (Telegram, HTTP servers), spawns Core process
13
13
  */
14
14
 
15
+ // Log version at startup
16
+ import { readFileSync } from "fs";
17
+ import { join, dirname } from "path";
18
+ const pkgPath = join(dirname(new URL(import.meta.url).pathname), "..", "package.json");
19
+ try { const pkg = JSON.parse(readFileSync(pkgPath, "utf8")); console.log(`Arisa v${pkg.version}`); } catch {}
20
+
15
21
  // Setup runs first — no config dependency, writes .env if needed
16
22
  import { runSetup } from "./setup";
17
23
  const ready = await runSetup();
@@ -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
- // 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
-
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
- 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
- }
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(` [debug] token captured: ${token.slice(0, 20)}...${token.slice(-10)} (${token.length} chars)`);
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("could not extract token from output");
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;