arisa 2.3.6 → 2.3.8

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.6",
3
+ "version": "2.3.8",
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();
@@ -261,7 +261,6 @@ async function runInteractiveLogin(cli: AgentCliName, vars: Record<string, strin
261
261
  stdin: "inherit",
262
262
  stdout: "pipe",
263
263
  stderr: "inherit",
264
- env: { ...process.env, COLUMNS: "500" },
265
264
  });
266
265
 
267
266
  let output = "";
@@ -277,14 +276,31 @@ async function runInteractiveLogin(cli: AgentCliName, vars: Record<string, strin
277
276
 
278
277
  const exitCode = await proc.exited;
279
278
  if (exitCode === 0) {
280
- // Strip ANSI escape codes, then extract token
281
- // COLUMNS=500 prevents wrapping, but handle it as fallback
282
- const clean = output.replace(/\x1b\[[0-9;]*[a-zA-Z]/g, "");
283
- const tokenMatch = clean.match(/sk-ant-[A-Za-z0-9_-]+(?:\s*\n\s*[A-Za-z0-9_-]+)*/);
284
- if (tokenMatch) {
285
- vars.CLAUDE_CODE_OAUTH_TOKEN = tokenMatch[0].replace(/\s+/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;
286
300
  saveEnv(vars);
287
301
  console.log(" ✓ claude token saved to .env");
302
+ } else {
303
+ console.log(" ⚠ could not extract token from output");
288
304
  }
289
305
  console.log(` ✓ claude login successful`);
290
306
  return true;