Soul-driven AI agent with permission-hardened tools, token budgets, and multi-channel access. Runs 24/7 from CLI, Telegram or More.
test(attach): fix main CI: picker test outside Ink CI mode, fake client saves the mode
Salman Qureshi0daa0cdeddff
diff --git a/src/ui/attach-live-render.test.tsx b/src/ui/attach-live-render.test.tsxindex 2a75125b..96481297 100644--- a/src/ui/attach-live-render.test.tsx+++ b/src/ui/attach-live-render.test.tsx@@ -27,6 +27,7 @@ describe('attach TUI live rendering', () => {currentModel: async () => ({ name: 'anthropic', model: 'x' }),budget: async () => null,permissionMode: async () => 'ask-me',+ setPermissionMode: async () => true,createThread: async () => ({ id: 't1', shortId: 't1', alias: 'new', title: 'New' }),streamEvents: async (id: string, onEvent: (e: { type: string; data: Record<string, unknown> }) => void) => { streamedIds.push(id); emit = onEvent; await new Promise(() => {}); },send: async () => ({ ok: true }),diff --git a/src/ui/attach-pick.test.tsx b/src/ui/attach-pick.test.tsxindex 90b2bc05..1b6c8e47 100644--- a/src/ui/attach-pick.test.tsx+++ b/src/ui/attach-pick.test.tsx@@ -3,7 +3,6 @@ import { describe, expect, it } from 'vitest';import React from 'react';import { EventEmitter } from 'node:events';import { VtScreen } from './vt-screen.js';-import { LAUNCH_WORDMARK, LAUNCH_WORDMARK_WIDTH, launchPadRows } from './launch-pad.js';class FakeStdout extends EventEmitter { isTTY = true; constructor(public screen: VtScreen) { super(); } get columns() { return this.screen.columns; } get rows() { return this.screen.rows; } write(c: string) { this.screen.write(c); return true; } }class FakeStdin extends EventEmitter { isTTY = true; private q: string[] = []; setEncoding() {} setRawMode() {} resume() {} pause() {} ref() {} unref() {} read() { return this.q.shift() ?? null; } push(c: string) { this.q.push(c); this.emit('readable'); } }@@ -40,7 +39,10 @@ async function renderPick(cols: number, rows: number) {* session" is the first, default row.*/describe('attach TUI session picker', () => {- it('counts the launch pad rows the way it renders them', () => {+ // Imported inside the tests, after CI=0 is set: a static import would load+ // Ink first, and Ink in CI mode only draws the final frame (an empty screen).+ it('counts the launch pad rows the way it renders them', async () => {+ const { LAUNCH_WORDMARK, LAUNCH_WORDMARK_WIDTH, launchPadRows } = await import('./launch-pad.js');expect(launchPadRows(100, 'a tip')).toBe(1 + LAUNCH_WORDMARK.length + 1 + 1 + 5 + 1 + 1 + 1 + 2);expect(launchPadRows(100, null)).toBe(launchPadRows(100, 'a tip') - 2);// Below the wordmark's width the header is two plain lines.diff --git a/src/ui/attach-tui.tsx b/src/ui/attach-tui.tsxindex 11812ae1..508c7d00 100644--- a/src/ui/attach-tui.tsx+++ b/src/ui/attach-tui.tsx@@ -411,7 +411,7 @@ export function AttachTui({ client, pid, version, onExit, onHandoff }: { client:setPrompt(null);if (active.id === LOCAL_PERMISSION_MODE_PROMPT) {if (value === 'allow-all' || value === 'ask-me') {- const ok = await client.setPermissionMode(value);+ const ok = typeof client.setPermissionMode === 'function' ? await client.setPermissionMode(value) : false;// Saved: the status row shows the mode from now on, so no extra line// above the input saying the same thing. Only a failure is announced.if (ok) setRuntimeStatus((st) => ({ mode: st?.mode ?? 'off', permission: value, desktop: st?.desktop ?? '' }));