arisa 2.3.36 → 2.3.37

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.36",
3
+ "version": "2.3.37",
4
4
  "description": "Arisa - dynamic agent runtime with daemon/core architecture that evolves through user interaction",
5
5
  "keywords": [
6
6
  "tinyclaw",
@@ -140,10 +140,16 @@ export async function runSetup(): Promise<boolean> {
140
140
  console.log(`\nConfig saved to ${ENV_PATH}`);
141
141
  }
142
142
 
143
- // ─── Phase 2: CLI Installation (first run, interactive) ─────────
143
+ // ─── Phase 2: CLI Installation + Auth ───────────────────────────
144
144
 
145
- if (isFirstRun && process.stdin.isTTY) {
146
- await setupClis(inq, vars);
145
+ if (process.stdin.isTTY) {
146
+ if (isFirstRun) {
147
+ // First run: offer to install missing CLIs + login
148
+ await setupClis(inq, vars);
149
+ } else {
150
+ // Subsequent runs: check if any installed CLI needs auth, offer login
151
+ await checkCliAuth(inq, vars);
152
+ }
147
153
  }
148
154
 
149
155
  return true;
@@ -228,6 +234,59 @@ async function setupClis(inq: typeof import("@inquirer/prompts") | null, vars: R
228
234
  }
229
235
  }
230
236
 
237
+ /**
238
+ * On non-first runs, check if installed CLIs are authenticated.
239
+ * If not, offer to login interactively.
240
+ */
241
+ async function checkCliAuth(inq: typeof import("@inquirer/prompts") | null, vars: Record<string, string>) {
242
+ const clis: AgentCliName[] = [];
243
+ if (isAgentCliInstalled("claude")) clis.push("claude");
244
+ if (isAgentCliInstalled("codex")) clis.push("codex");
245
+ if (clis.length === 0) return;
246
+
247
+ for (const cli of clis) {
248
+ const authed = await isCliAuthenticated(cli);
249
+ if (authed) {
250
+ console.log(`[setup] ${cli} ✓ authenticated`);
251
+ continue;
252
+ }
253
+
254
+ console.log(`[setup] ${cli} ✗ not authenticated`);
255
+ let doLogin = true;
256
+ if (inq) {
257
+ doLogin = await inq.confirm({ message: `Log in to ${cli === "claude" ? "Claude" : "Codex"}?`, default: true });
258
+ } else {
259
+ const answer = await readLine(`\nLog in to ${cli === "claude" ? "Claude" : "Codex"}? (Y/n): `);
260
+ doLogin = answer.toLowerCase() !== "n";
261
+ }
262
+ if (doLogin) {
263
+ console.log();
264
+ await runInteractiveLogin(cli, vars);
265
+ }
266
+ }
267
+ }
268
+
269
+ /**
270
+ * Quick probe: is this CLI authenticated?
271
+ * Claude: `claude auth status` exits 0 and contains "loggedIn": true
272
+ * Codex: `codex auth status` or a quick exec check
273
+ */
274
+ async function isCliAuthenticated(cli: AgentCliName): Promise<boolean> {
275
+ try {
276
+ if (cli === "claude") {
277
+ const cmd = buildBunWrappedAgentCliCommand("claude", ["auth", "status"], { skipPreload: true });
278
+ const proc = Bun.spawn(cmd, { stdout: "pipe", stderr: "pipe" });
279
+ const stdout = await new Response(proc.stdout).text();
280
+ const exitCode = await proc.exited;
281
+ return exitCode === 0 && stdout.includes('"loggedIn": true');
282
+ }
283
+ // Codex: no simple auth check, assume OK if installed
284
+ return true;
285
+ } catch {
286
+ return false;
287
+ }
288
+ }
289
+
231
290
  async function installCli(cli: AgentCliName): Promise<boolean> {
232
291
  try {
233
292
  // Install into root's bun (arisa has read+execute access)