Your team of AI agents, on your Mac, Windows or Linux. Agents that talk in channels, write code, review each other and use your tools, on the Claude Code, Codex, OpenCode or Pi you already have. Anything that touches the real world waits for your yes.
TypeScript agent-teamagentic-aiai-agentsai-assistantclaude-codecodexcursorelectrongrokgrok-bot-alternativelinuxlocal-firstmacosmcpmulti-agentopenclaw-alternativeopencodewindows
Sign a harness in on a server from the browser or the phone (#198)
Eduardo Machado5a021556d4cf
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 70ba16d..5ea9cf7 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -5,9 +5,14 @@ What changed in each version of Tucano. The format follows [Keep a Changelog](ht## [Unreleased]> **Em português:**+> - **Entrar na IA pelo navegador ou pelo iPhone, num Tucano em servidor.** O botão Entrar roda o login da própria IA no servidor e mostra a tela dele numa janela: a página pra abrir, o código pra digitar e um campo pra colar o código de volta. Sem SSH.>> **Correções:** um agente com o GitHub em **Ler e escrever** volta a subir a branch e abrir a PR em vez de dizer que "a sessão é só leitura" (e, se algo pede aprovação ou está desligado, diz exatamente o quê); e o cartão **Computador** mostra o que vale pra cada escolha, sem misturar a confirmação de **Este computador** com o painel do Linux.+### Added++- **Sign a harness in on a server from the browser or the phone, with no SSH.** On Tucano as a server, **Sign in** (Settings › Models and the accounts) used to show a command to run in the server's terminal. Now the server runs the harness's own login in a terminal of its own (through `script`, on Linux) and the browser shows it in a window: the screen as text, **Open the sign-in page**, the code to type there with a copy button, a field to paste a code back, and arrows, Enter and Esc for a menu. Each harness signs in the way that works with no browser on the server: Codex and Grok with a device code, Claude Code by pasting the code its page shows, Cursor by approving its page, OpenCode and Gemini in their own menus, Pi with `/login`. The window closes the login once the harness checks as signed in, and a login left open ends after 15 minutes. Tucano passes keys and shows the screen; the harness saves the login where it always does. The iPhone app shows the same window (in its next version). On a desktop, **Sign in** opens a terminal as before.+### Fixed- **An agent with GitHub on "Ler e escrever" pushes and opens the PR instead of saying the session is read-only.** On Codex, the CLI's own text about its sandbox ("`sandbox_mode` is `read-only`... Network access is restricted", "Approval policy is never") reached the model, and it answered "Estou bloqueado porque esta sessão permite apenas leitura" for a push or a PR it had every grant for. That text is left out now (in `codex exec` and the app-server), and the note an agent with the app's tools gets says Codex's sandbox doesn't limit them, that git and other commands on its computer run with `bash`, and to say exactly what was refused or waits for approval, never "read-only". On every harness, an agent with a GitHub connector gets a **GitHub** section in its instructions, made from what it really has: the tools it publishes with (`create_branch`, `push_files`, `create_or_update_file`, `create_pull_request`, by the names it sees); on **Este computador**, that `git push` also runs with your own git credentials; on **Linux isolado**, that there are none there; what your autonomy level or rules make ask first or turn off; and, with read-only access, to ask for read and write with `pedir_acesso`. Before, an agent on this computer was told only "git push only when asked", with no word about the connector.diff --git a/docs/server.md b/docs/server.mdindex 3705321..085bd1b 100644--- a/docs/server.md+++ b/docs/server.md@@ -36,14 +36,14 @@ Open that link once. The token signs the browser in, and a cookie keeps it signe### Signing the harnesses in-Sign each harness in on the server, in a terminal over SSH:+Install the harnesses on the server, in a terminal over SSH, as the user that runs Tucano:```bash-curl -fsSL https://claude.ai/install.sh | bash && claude auth login # prints a link and asks for the code+curl -fsSL https://claude.ai/install.sh | bashnpm install -g @openai/codex```-Codex is signed in from Tucano's **Settings › Models**, like on a desktop. On a server, the **Sign in** button can't open a terminal, so it shows the command to run in your SSH session.+Then sign them in from Tucano's **Settings › Models**, in the browser or the iPhone app: **Sign in** runs the harness's own login in a terminal of the server's and shows its screen in a window, with **Open the sign-in page**, the code to type there, a field to paste a code back and the arrow keys for a menu. Each harness signs in the way that works with no browser on the server: Codex and Grok with a device code (`codex login --device-auth`, `grok login --device-auth`), Claude Code with a code you paste back, Cursor on its own once you approve the page, OpenCode and Gemini in their own menus, and Pi with `/login` on its screen. Tucano passes keys and shows the screen; the login is saved where the harness always keeps it. This needs Linux (it uses `script`, from util-linux); elsewhere **Sign in** shows the command to run over SSH.### On a phonediff --git a/src/core/index.ts b/src/core/index.tsindex 10df09a..47754f1 100644--- a/src/core/index.ts+++ b/src/core/index.ts@@ -33,6 +33,7 @@ import { accountDir, accountStatus, adoptLoginShellPath, detectEngines } from '.import { detectEngine, EngineCheck, type EngineFindings } from './engine-check'import { EngineSetup, SETUP_ENGINES, type SetupEngine, type SetupState } from './engine-setup'import { codexEnv } from './engines/codex'+import { LoginTerminal, type LoginKey } from './login-terminal'import { fakeEngine } from './engines/fake'import { relocating } from './engines/relocate'import { DesktopApps, macApps, SELF } from './apps'@@ -206,6 +207,44 @@ const engineSetup = new EngineSetup({changed: () => {}})+// A harness's sign-in from the page or the phone, on a server: its login command in a terminal of the+// server's, the screen shown where the person is (login-terminal.ts). Linux only, through `script`;+// elsewhere the command is shown, to run in a terminal as before.+const loginTerminal = new LoginTerminal({+ spawn: (bin, args, env, size) => {+ if (!serverMode || osOf() !== 'linux' || !onPath('script')) return undefined+ const q = (s: string): string => `'${s.replace(/'/g, `'\\''`)}'`+ const line = `stty cols ${size.cols} rows ${size.rows} 2>/dev/null; exec ${[bin, ...args].map(q).join(' ')}`+ const p = spawn('script', ['-qfec', line, '/dev/null'], { env: { ...env, TERM: 'xterm-256color', COLUMNS: String(size.cols), LINES: String(size.rows) }, stdio: ['pipe', 'pipe', 'pipe'] })+ const exit = new Promise<number>((done) => {+ p.on('error', () => done(1))+ p.on('exit', (code) => done(code ?? 1))+ })+ p.stdin.on('error', () => {})+ return {+ write: (data) => void p.stdin.write(data),+ output: (on) => (p.stdout.on('data', (b: Buffer) => on(b.toString())), p.stderr.on('data', (b: Buffer) => on(b.toString()))),+ exit,+ kill: () => void p.kill()+ }+ },+ bin: (e) => engines[e].path ?? ENGINES[e].cli,+ env: (e, account) => {+ if (account) {+ const dir = accountDir(dataDir, account)+ return e === 'claude' ? { ...process.env, CLAUDE_CONFIG_DIR: dir, DISABLE_AUTOUPDATER: '1' } : codexEnv(dir)+ }+ return e === 'codex' ? codexEnv(codexHome) : { ...process.env, DISABLE_AUTOUPDATER: '1' }+ },+ signedIn: async (e, account) => {+ if (!account) return (await engineCheck.recheck(e)).engines[e].loggedIn+ await checkAccounts(account)+ engineCheck.setAccounts(Object.fromEntries(accountLogins))+ emit({ type: 'settings', settings: settings() })+ return accountLogins.get(account)?.loggedIn === true+ }+})+// The same steps with the test engines: no network, no CLI; the harness is "signed in" at the end.function fakeSetup(engine: SetupEngine): SetupState {if (fakeSetupState?.state === 'running') return fakeSetupState@@ -1936,7 +1975,10 @@ const api: Handlers = {// Login always happens in the CLI's own flow; the app never sees credentials.// Codex logs into the app's own home (see codexEnv), separate from the user's.- loginEngine: ({ engine }) => {+ loginEngine: ({ engine, screen }) => {+ // On a server, for a page or a phone that can show it: the sign-in in a terminal of the server's.+ const shown = screen && engines[engine].installed ? loginTerminal.start(engine) : undefined+ if (shown) return { opened: true, command: ENGINES[engine].login, screen: shown }// The sign-in happens in a terminal: check again until it lands, wherever the person is.watchEngine(engine, (s) => s.loggedIn)return openLogin(engine, engine === 'codex' ? { HOME: codexHome, CODEX_HOME: join(codexHome, '.codex') } : {})@@ -1949,6 +1991,10 @@ const api: Handlers = {if (serverMode) throw new Error(L('Num servidor, o login é feito no terminal dele.', "On a server, the sign-in happens in its terminal."))return fake ? fakeSetup(engine as SetupEngine) : engineSetup.start(engine as SetupEngine)},+ // The sign-in on the server's terminal (loginEngine with screen): how it looks now, keys to it, its end.+ loginScreen: () => loginTerminal.current(),+ loginInput: ({ id, text, key, enter }) => loginTerminal.send(id, { ...(text ? { text } : {}), ...(key ? { key: key as LoginKey } : {}), ...(enter ? { enter } : {}) }),+ stopLogin: ({ id }) => loginTerminal.stop(id),engineSetupState: () => (fake ? fakeSetupState : engineSetup.current),cancelEngineSetup: () => {if (fake) return void (fakeSetupState = fakeSetupState && { ...fakeSetupState, state: 'cancelled' })@@ -1971,9 +2017,11 @@ const api: Handlers = {emit({ type: 'settings', settings: settings() })return account},- loginAccount: ({ id }) => {+ loginAccount: ({ id, screen }) => {const a = savedAccounts().find((x) => x.id === id)if (!a) return { opened: false, command: '' }+ const shown = screen && engines[a.engine].installed ? loginTerminal.start(a.engine, a.id) : undefined+ if (shown) return { opened: true, command: ENGINES[a.engine].login, screen: shown }const dir = accountDir(dataDir, a.id)watchAccount(a.id)return openLogin(a.engine, a.engine === 'claude' ? { CLAUDE_CONFIG_DIR: dir } : { HOME: dir, CODEX_HOME: join(dir, '.codex') })diff --git a/src/core/login-terminal.ts b/src/core/login-terminal.tsnew file mode 100644index 0000000..ea4cd26--- /dev/null+++ b/src/core/login-terminal.ts@@ -0,0 +1,128 @@+// A harness's sign-in on a server, from the page or the phone: the CLI's own login command runs in+// a terminal of the server's (a pseudo-terminal, via `script`), and its screen goes to whoever asked,+// as text (vt-screen.ts), with what they type going back. The person signs in on the provider's own+// page, as in a terminal: Tucano passes keys and shows the screen, and never handles the login+// itself (the CLI saves it where it always does).+//+// Per harness, the way in that works with no browser on this machine: a device code where the CLI+// has one (Codex, Grok), a code to paste back (Claude Code, Gemini, OpenCode's providers), or a page+// the CLI watches on its own (Cursor). Pi signs in inside its own screen, with /login.+import { randomUUID } from 'node:crypto'+import { L } from '../shared/lang'+import type { EngineId, LoginKey, LoginScreen } from '../shared/types'++export type { LoginKey, LoginScreen }+import { Screen, signInHints } from './vt-screen'+++export interface Pty {+ write: (data: string) => void+ output: (on: (text: string) => void) => void+ exit: Promise<number>+ kill: () => void+}++// The command, the variables and the first hint, per harness.+export function loginCommand(engine: EngineId): { args: string[]; env: Record<string, string>; hint?: string } {+ switch (engine) {+ case 'claude':+ return { args: ['auth', 'login'], env: {} }+ case 'codex':+ return { args: ['login', '--device-auth'], env: {} }+ case 'grok':+ return { args: ['login', '--device-auth'], env: {} }+ case 'cursor':+ return { args: ['login'], env: { NO_OPEN_BROWSER: '1' } }+ case 'opencode':+ return { args: ['auth', 'login'], env: {}, hint: L('Escolha o provedor com as setas e toque em Enter.', 'Pick the provider with the arrows and tap Enter.') }+ case 'gemini':+ return { args: [], env: { NO_BROWSER: 'true' }, hint: L('Escolha "Login with Google" e toque em Enter; depois cole aqui o código que a página mostrar.', 'Pick "Login with Google" and tap Enter; then paste here the code the page shows.') }+ case 'pi':+ return { args: [], env: {}, hint: L('Escreva /login e toque em Enter (de novo, se aparecer a lista de comandos); depois escolha o provedor com as setas.', 'Type /login and tap Enter (again, if the list of commands shows up); then pick the provider with the arrows.') }+ }+}++export const KEYS: Record<LoginKey, string> = { enter: '\r', up: '\x1b[A', down: '\x1b[B', left: '\x1b[D', right: '\x1b[C', esc: '\x1b', tab: '\t', backspace: '\x7f', space: ' ' }++export const COLS = 64+export const ROWS = 24++export interface LoginDeps {+ // The CLI in a pseudo-terminal of this size; undefined when this system has none to offer.+ spawn: (bin: string, args: string[], env: NodeJS.ProcessEnv, size: { cols: number; rows: number }) => Pty | undefined+ bin: (engine: EngineId) => string+ env: (engine: EngineId, account?: string) => NodeJS.ProcessEnv // where the login goes+ signedIn: (engine: EngineId, account?: string) => Promise<boolean>+ timeoutMs?: number+ pollMs?: number+ pasteGapMs?: number+}++export class LoginTerminal {+ private screen?: Screen+ private session?: Omit<LoginScreen, 'lines' | 'url' | 'code'>+ private pty?: Pty+ private poll?: ReturnType<typeof setInterval>+ private late?: ReturnType<typeof setTimeout>++ constructor(private deps: LoginDeps) {}++ current(): LoginScreen | null {+ if (!this.session || !this.screen) return null+ return { ...this.session, lines: this.screen.lines(), ...signInHints(this.screen) }+ }++ // A new sign-in; one at a time (a second one ends the first). Undefined: no terminal here.+ start(engine: EngineId, account?: string): LoginScreen | undefined {+ this.stop()+ const cmd = loginCommand(engine)+ const screen = new Screen(COLS, ROWS)+ const pty = this.deps.spawn(this.deps.bin(engine), cmd.args, { ...this.deps.env(engine, account), ...cmd.env }, { cols: COLS, rows: ROWS })+ if (!pty) return undefined+ const id = randomUUID()+ this.screen = screen+ this.pty = pty+ this.session = { id, engine, ...(account ? { account } : {}), ...(cmd.hint ? { hint: cmd.hint } : {}), state: 'running' }+ pty.output((text) => this.session?.id === id && screen.write(text))+ // Signed in: done, whatever the CLI does next (Gemini and Pi stay open on their own screens).+ this.poll = setInterval(() => {+ void this.deps.signedIn(engine, account).then((yes) => yes && this.finish(id, 'done'), () => {})+ }, this.deps.pollMs ?? 4_000)+ this.poll.unref?.()+ this.late = setTimeout(() => this.finish(id, 'failed', L('O login passou de 15 minutos. Comece de novo.', 'The sign-in went past 15 minutes. Start again.')), this.deps.timeoutMs ?? 15 * 60_000)+ this.late.unref?.()+ void pty.exit.then(async () => {+ if (this.session?.id !== id || this.session.state !== 'running') return+ const yes = await this.deps.signedIn(engine, account).catch(() => false)+ if (yes) return this.finish(id, 'done')+ const last = screen.lines().filter(Boolean).slice(-2).join(' ').trim()+ this.finish(id, 'failed', last ? L(`O login não terminou: ${last}`, `The sign-in didn't finish: ${last}`) : L('O login não terminou.', "The sign-in didn't finish."))+ })+ return this.current()!+ }++ // What the person typed: text (a code, a /login), then Enter when asked; or one key.+ async send(id: string, input: { text?: string; key?: LoginKey; enter?: boolean }): Promise<LoginScreen | null> {+ if (this.session?.id !== id || this.session.state !== 'running' || !this.pty) return this.current()+ if (input.text) this.pty.write(input.text.replace(/[\r\n]+/g, ' ').trim())+ // Enter on its own, a moment later: a program reading keys takes text and Enter together as a paste.+ if (input.text && input.enter) await new Promise((r) => setTimeout(r, this.deps.pasteGapMs ?? 150))+ if (input.enter) this.pty?.write(KEYS.enter)+ if (input.key && KEYS[input.key]) this.pty.write(KEYS[input.key])+ return this.current()+ }++ stop(id?: string): void {+ if (!this.session || (id && this.session.id !== id)) return+ if (this.session.state === 'running') this.finish(this.session.id, 'cancelled')+ }++ private finish(id: string, state: LoginScreen['state'], error?: string): void {+ if (this.session?.id !== id || this.session.state !== 'running') return+ clearInterval(this.poll)+ clearTimeout(this.late)+ this.session = { ...this.session, state, ...(error ? { error } : {}) }+ this.pty?.kill()+ this.pty = undefined+ }+}diff --git a/src/core/policy-people.ts b/src/core/policy-people.tsindex 71cb84b..0a100e3 100644--- a/src/core/policy-people.ts+++ b/src/core/policy-people.ts@@ -202,6 +202,9 @@ export const NEEDS: Record<Method, Need> = {checkTrigger: 'admin',refreshEngines: 'admin',loginEngine: 'admin',+ loginScreen: 'admin',+ loginInput: 'admin',+ stopLogin: 'admin',addAccount: 'admin',loginAccount: 'admin',removeAccount: 'admin',diff --git a/src/core/vt-screen.ts b/src/core/vt-screen.tsnew file mode 100644index 0000000..c9c7212--- /dev/null+++ b/src/core/vt-screen.ts@@ -0,0 +1,247 @@+// A small terminal screen: what a program running in a terminal shows, as lines of text, from the+// bytes it writes (text, carriage returns, cursor moves, erases). Enough for a harness's sign-in+// (its prompts, menus and the page it asks you to open) to be shown on a page or a phone, where+// there's no terminal. Colors and styles are dropped; links (OSC 8) are kept for `links`.++// A row, and whether it goes on from the row above (the text reached the edge and wrapped).+type Row = string[] & { wrapped?: boolean }++export class Screen {+ private rows: Row[]+ private x = 0+ private y = 0+ private saved = { x: 0, y: 0 }+ private pending = '' // an escape sequence cut between two writes+ readonly links: string[] = [] // OSC 8 targets, in order++ constructor(+ readonly cols = 100,+ readonly height = 32+ ) {+ this.rows = Array.from({ length: height }, () => [])+ }++ // The screen as text, a line that wrapped at the edge joined back into one (whoever shows it wraps+ // it to their own width); trailing spaces and empty bottom lines trimmed.+ lines(): string[] {+ const out: string[] = []+ for (const r of this.rows) {+ const text = Array.from(r, (c) => c ?? ' ').join('')+ if (r.wrapped && out.length) out[out.length - 1] += text+ else out.push(text)+ }+ const trimmed = out.map((l) => l.replace(/\s+$/, ''))+ while (trimmed.length && !trimmed[trimmed.length - 1]) trimmed.pop()+ return trimmed+ }++ write(data: string): void {+ const s = this.pending + data+ this.pending = ''+ let i = 0+ while (i < s.length) {+ const c = s[i]!+ if (c === '\x1b') {+ const used = this.escape(s, i)+ if (used === 0) {+ // Not all here yet: the rest comes with the next write (a cut that never ends is dropped).+ this.pending = s.slice(i).slice(0, 4096)+ return+ }+ i += used+ continue+ }+ i += 1+ if (c === '\r') this.x = 0+ else if (c === '\n') this.lineFeed()+ else if (c === '\b') this.x = Math.max(0, this.x - 1)+ else if (c === '\t') this.x = Math.min(this.cols - 1, (Math.floor(this.x / 8) + 1) * 8)+ else if (c >= ' ' && c !== '\x7f') this.put(c)+ else if (c > '\x9f') this.put(c)+ }+ }++ private put(c: string): void {+ if (this.x >= this.cols) {+ this.x = 0+ this.lineFeed()+ const next: Row = []+ next.wrapped = true+ this.rows[this.y] = next+ }+ const row = this.rows[this.y]!+ while (row.length < this.x) row.push(' ')+ row[this.x] = c+ this.x += 1+ }++ private lineFeed(): void {+ if (this.y < this.height - 1) this.y += 1+ else {+ this.rows.shift()+ this.rows.push([])+ }+ }++ private clamp(): void {+ this.x = Math.max(0, Math.min(this.cols - 1, this.x))+ this.y = Math.max(0, Math.min(this.height - 1, this.y))+ }++ private eraseLine(mode: number): void {+ const row = this.rows[this.y]!+ if (mode === 0) row.length = Math.min(row.length, this.x)+ else if (mode === 1) for (let k = 0; k <= this.x && k < row.length; k++) row[k] = ' '+ else this.rows[this.y] = []+ }++ private eraseDisplay(mode: number): void {+ if (mode === 0) {+ this.eraseLine(0)+ for (let k = this.y + 1; k < this.height; k++) this.rows[k] = []+ } else if (mode === 1) {+ for (let k = 0; k < this.y; k++) this.rows[k] = []+ this.eraseLine(1)+ } else this.rows = Array.from({ length: this.height }, () => [])+ }++ // One escape sequence at s[i]: how many characters it took, 0 when it isn't complete yet.+ private escape(s: string, i: number): number {+ const next = s[i + 1]+ if (next === undefined) return 0+ if (next === '[') {+ let j = i + 2+ while (j < s.length && !/[\x40-\x7e]/.test(s[j]!)) j+++ if (j >= s.length) return 0+ this.csi(s.slice(i + 2, j), s[j]!)+ return j - i + 1+ }+ if (next === ']') {+ // OSC, up to BEL or ST (ESC \).+ for (let j = i + 2; j < s.length; j++) {+ if (s[j] === '\x07' || (s[j] === '\x1b' && s[j + 1] === '\\')) {+ const body = s.slice(i + 2, j)+ const link = body.match(/^8;[^;]*;(.+)$/)?.[1]+ if (link && /^https?:\/\//.test(link) && this.links[this.links.length - 1] !== link) this.links.push(link)+ return j - i + (s[j] === '\x07' ? 1 : 2)+ }+ }+ return 0+ }+ if (next === '(' || next === ')' || next === '#') return s[i + 2] === undefined ? 0 : 3 // character sets: nothing to show+ if (next === '7') this.saved = { x: this.x, y: this.y }+ else if (next === '8') ({ x: this.x, y: this.y } = this.saved)+ else if (next === 'M') this.y = Math.max(0, this.y - 1)+ else if (next === 'c') this.eraseDisplay(2)+ return 2+ }++ private csi(params: string, final: string): void {+ const priv = params.startsWith('?')+ const nums = params.replace(/^[?>=]/, '').split(';').map((n) => (n === '' ? NaN : Number(n)))+ const n = (k: number, def: number): number => (Number.isFinite(nums[k]) ? nums[k]! : def)+ if (priv) {+ // The alternate screen (a full-screen program starting or ending): a clean one.+ if ((final === 'h' || final === 'l') && [47, 1047, 1049].includes(n(0, 0))) {+ this.eraseDisplay(2)+ this.x = this.y = 0+ }+ return+ }+ switch (final) {+ case 'A':+ this.y -= n(0, 1) || 1+ break+ case 'B':+ case 'e':+ this.y += n(0, 1) || 1+ break+ case 'C':+ case 'a':+ this.x += n(0, 1) || 1+ break+ case 'D':+ this.x -= n(0, 1) || 1+ break+ case 'E':+ this.y += n(0, 1) || 1+ this.x = 0+ break+ case 'F':+ this.y -= n(0, 1) || 1+ this.x = 0+ break+ case 'G':+ case '`':+ this.x = n(0, 1) - 1+ break+ case 'd':+ this.y = n(0, 1) - 1+ break+ case 'H':+ case 'f':+ this.y = n(0, 1) - 1+ this.x = n(1, 1) - 1+ break+ case 'J':+ this.eraseDisplay(n(0, 0))+ break+ case 'K':+ this.eraseLine(n(0, 0))+ break+ case 'X': {+ const row = this.rows[this.y]!+ for (let k = this.x; k < this.x + (n(0, 1) || 1) && k < row.length; k++) row[k] = ' '+ break+ }+ case 'P': {+ this.rows[this.y]!.splice(this.x, n(0, 1) || 1)+ break+ }+ case '@': {+ const row = this.rows[this.y]!+ while (row.length < this.x) row.push(' ')+ row.splice(this.x, 0, ...Array<string>(n(0, 1) || 1).fill(' '))+ if (row.length > this.cols) row.length = this.cols+ break+ }+ case 'L': {+ const k = Math.min(n(0, 1) || 1, this.height - this.y)+ this.rows.splice(this.y, 0, ...Array.from({ length: k }, () => []))+ this.rows.length = this.height+ break+ }+ case 'M': {+ const k = Math.min(n(0, 1) || 1, this.height - this.y)+ this.rows.splice(this.y, k)+ while (this.rows.length < this.height) this.rows.push([])+ break+ }+ case 's':+ this.saved = { x: this.x, y: this.y }+ break+ case 'u':+ ;({ x: this.x, y: this.y } = this.saved)+ break+ default:+ // m (colors), r (scroll region), h/l (modes), n (reports): nothing to show+ }+ this.clamp()+ }+}++// The sign-in page and a code to type there, as shown on the screen. A link the program marked+// (OSC 8) wins; else the last https address in the text (a wrapped one is whole in lines()).+export function signInHints(screen: Screen): { url?: string; code?: string } {+ const lines = screen.lines()+ let url = screen.links[screen.links.length - 1]+ if (!url) {+ const all = lines.join('\n').match(/https:\/\/[^\s"'<>]+/g)+ url = all?.[all.length - 1]?.replace(/[).,;:]+$/, '')+ }+ // A device code: groups of capitals and digits with a dash (ABCD-EFGH, 1A2B-3C4D5).+ const code = lines+ .join('\n')+ .match(/(?:^|[^A-Za-z0-9-])([A-Z0-9]{4,5}-[A-Z0-9]{4,5})(?![A-Za-z0-9-])/)?.[1]+ return { ...(url ? { url } : {}), ...(code ? { code } : {}) }+}diff --git a/src/renderer/src/components/Dialogs.tsx b/src/renderer/src/components/Dialogs.tsxindex 7ff4fae..cbe3b93 100644--- a/src/renderer/src/components/Dialogs.tsx+++ b/src/renderer/src/components/Dialogs.tsx@@ -7,6 +7,7 @@ import { agentById, amAdmin, archiveAgent, canEditChannel, isTeam, openTuca, creimport { AgentAvatar, Icon, type IconName } from './ui'import { WorkspaceManager } from './WorkspaceManager'import { Modal } from './Modal'+import { LoginHost } from './LoginTerminal'const message = (e: unknown): string => (e instanceof Error ? e.message.replace(/^Error invoking.*?: /, '') : String(e))@@ -15,6 +16,7 @@ export function Dialogs(): ReactNode {<><DialogBody /><ConfirmHost />+ <LoginHost /></>)}diff --git a/src/renderer/src/components/LoginTerminal.tsx b/src/renderer/src/components/LoginTerminal.tsxnew file mode 100644index 0000000..eb3b54e--- /dev/null+++ b/src/renderer/src/components/LoginTerminal.tsx@@ -0,0 +1,136 @@+// A harness's sign-in on Tucano as a server, from the browser (src/core/login-terminal.ts): the CLI's+// login runs in the server's own terminal, and this window shows its screen, the page to open and+// the code to type there, and sends back what the person types (a code to paste, a menu's arrows).+import { useEffect, useRef, useState, type ReactNode } from 'react'+import { L } from '../../../shared/lang'+import { ENGINES, loginEngine, loginInput, loginScreen, openExternal, refreshEngines, showLogin, stopLogin, toast, useLoginShown, type LoginKey, type LoginScreen } from '../store'+import { Modal } from './Modal'+import { Icon } from './ui'++const copy = (text: string): void =>+ void navigator.clipboard.writeText(text).then(+ () => toast(L('Copiado', 'Copied')),+ () => toast(L('Não consegui copiar.', "I couldn't copy."))+ )++export function LoginHost(): ReactNode {+ const shown = useLoginShown()+ return shown ? <LoginWindow key={shown.id} first={shown} /> : null+}++function LoginWindow({ first }: { first: LoginScreen }): ReactNode {+ const [s, setS] = useState(first)+ const [text, setText] = useState('')+ const timer = useRef<ReturnType<typeof setInterval> | undefined>(undefined)+ const label = ENGINES[s.engine].label+ const running = s.state === 'running'++ useEffect(() => {+ if (!running) return+ timer.current = setInterval(() => {+ void loginScreen().then((now) => {+ if (!now) return+ // Another sign-in started (one at a time): this one is over.+ if (now.id !== first.id) return setS((was) => ({ ...was, state: 'cancelled', error: L('Outro login começou no lugar deste.', 'Another sign-in took its place.') }))+ setS(now)+ if (now.state === 'done') refreshEngines()+ })+ }, 800)+ return () => clearInterval(timer.current)+ }, [running, first.id])++ const send = (input: { text?: string; key?: LoginKey; enter?: boolean }): void =>+ void loginInput(s.id, input).then((now) => now && setS(now))+ const close = (): void => {+ if (running) stopLogin(s.id)+ showLogin(null)+ }+ const again = (): void => void loginEngine(s.engine)++ return (+ <Modal title={L(`Entrar no ${label}`, `Sign in to ${label}`)} onClose={close} className="login-term">+ {s.state === 'done' ? (+ <p className="note note--ok">+ <Icon name="check" size={14} /> {L(`Pronto: o ${label} está conectado.`, `Done: ${label} is connected.`)}+ </p>+ ) : (+ <>+ <p className="small modal__lead">+ {s.hint ??+ (s.code+ ? L('Abra a página, entre na sua conta e digite o código abaixo.', 'Open the page, sign in to your account and type the code below.')+ : L('Abra a página e entre na sua conta. Se ela mostrar um código no fim, cole aqui embaixo.', 'Open the page and sign in to your account. If it shows a code at the end, paste it below.'))}+ </p>+ {(s.url || s.code) && (+ <div className="login-term__go">+ {s.url && (+ <button className="btn btn--primary btn--sm" onClick={() => openExternal(s.url!)}>+ {L('Abrir a página de login', 'Open the sign-in page')}+ </button>+ )}+ {s.url && (+ <button className="btn btn--ghost btn--sm" onClick={() => copy(s.url!)}>+ <Icon name="copy" size={13} /> {L('Copiar link', 'Copy link')}+ </button>+ )}+ {s.code && (+ <button className="login-term__code" onClick={() => copy(s.code!)} title={L('Copiar o código', 'Copy the code')}>+ <span className="mono">{s.code}</span> <Icon name="copy" size={13} />+ </button>+ )}+ </div>+ )}+ </>+ )}+ <pre className="login-term__screen" aria-label={L('A tela do login', 'The sign-in screen')} aria-live="polite">+ {s.lines.join('\n') || L('Abrindo…', 'Opening…')}+ </pre>+ {running && (+ <>+ <form+ className="row login-term__type"+ onSubmit={(e) => {+ e.preventDefault()+ send({ text, enter: true })+ setText('')+ }}+ >+ <input className="grow" value={text} onChange={(e) => setText(e.target.value)} placeholder={L('Cole o código ou digite aqui', 'Paste the code or type here')} autoComplete="off" spellCheck={false} />+ <button className="btn btn--sm" type="submit">+ {L('Enviar', 'Send')}+ </button>+ </form>+ <div className="login-term__keys" aria-label={L('Teclas', 'Keys')}>+ {(+ [+ ['up', '↑', L('Para cima', 'Up')],+ ['down', '↓', L('Para baixo', 'Down')],+ ['enter', 'Enter', 'Enter'],+ ['esc', 'Esc', 'Esc']+ ] as const+ ).map(([key, face, name]) => (+ <button key={key} className="btn btn--ghost btn--sm" aria-label={name} onClick={() => send({ key })}>+ {face}+ </button>+ ))}+ </div>+ </>+ )}+ {(s.state === 'failed' || s.state === 'cancelled') && (+ <div className="row">+ <span className="small grow field__error">{s.error ?? L('O login foi interrompido.', 'The sign-in was stopped.')}</span>+ <button className="btn btn--sm btn--primary" onClick={again}>+ {L('Tentar de novo', 'Try again')}+ </button>+ </div>+ )}+ {!running && (+ <div className="row row--end">+ <button className="btn btn--sm" onClick={close}>+ {L('Fechar', 'Close')}+ </button>+ </div>+ )}+ </Modal>+ )+}diff --git a/src/renderer/src/store.ts b/src/renderer/src/store.tsindex 0c12d33..608a27a 100644--- a/src/renderer/src/store.ts+++ b/src/renderer/src/store.ts@@ -41,6 +41,8 @@ import {type Settings,type SetupEngine,type SetupState,+ type LoginKey,+ type LoginScreen,type Skill,type SkillInput,type SkillVersion,@@ -757,10 +759,35 @@ export const voiceCancelDownload = (): Promise<void> => call('voiceCancelDownloaexport const voiceRemoveModel = (model: VoiceModelId): Promise<void> => call('voiceRemoveModel', { model })export const transcribe = async (id: string, audio: string): Promise<string> => (await call('transcribe', { id, audio })).textexport const cancelTranscribe = (id: string): Promise<void> => call('cancelTranscribe', { id })-export const loginEngine = (engine: keyof Settings['engines']): Promise<{ opened: boolean; command: string }> => call('loginEngine', { engine })+// On a server, the sign-in runs in its own terminal and shows here (LoginTerminal.tsx): screen comes+// back, and the window opens. Elsewhere, a terminal of the computer's opens, as before.+export const loginEngine = async (engine: keyof Settings['engines']): Promise<{ opened: boolean; command: string }> => {+ const r = await call('loginEngine', { engine, screen: true })+ if (r.screen) showLogin(r.screen)+ return r+}// More logins of Claude Code and Codex, each signed into in a terminal.export const addAccount = (engine: AccountEngine, name: string): Promise<Account> => call('addAccount', { engine, name })-export const loginAccount = (id: string): Promise<{ opened: boolean; command: string }> => call('loginAccount', { id })+export const loginAccount = async (id: string): Promise<{ opened: boolean; command: string }> => {+ const r = await call('loginAccount', { id, screen: true })+ if (r.screen) showLogin(r.screen)+ return r+}+// The sign-in on the server's terminal being shown, if any; the window asks the core how it goes.+let loginShown: LoginScreen | null = null+const loginListeners = new Set<() => void>()+export function showLogin(s: LoginScreen | null): void {+ loginShown = s+ loginListeners.forEach((l) => l())+}+export const useLoginShown = (): LoginScreen | null =>+ useSyncExternalStore(+ (l) => (loginListeners.add(l), () => void loginListeners.delete(l)),+ () => loginShown+ )+export const loginScreen = (): Promise<LoginScreen | null> => call('loginScreen')+export const loginInput = (id: string, input: { text?: string; key?: LoginKey; enter?: boolean }): Promise<LoginScreen | null> => call('loginInput', { id, ...input })+export const stopLogin = (id: string): void => void call('stopLogin', { id }).catch(() => {})export const removeAccount = (id: string): Promise<void> => call('removeAccount', { id })export const installEngine = (engine: keyof Settings['engines']): Promise<{ opened: boolean; command: string; needsNode?: boolean }> => call('installEngine', { engine })// Codex or Claude Code with no terminal (the introduction): the CLI downloaded, then its own sign-in in the browser.diff --git a/src/renderer/src/styles.css b/src/renderer/src/styles.cssindex 6e993f0..ba867bc 100644--- a/src/renderer/src/styles.css+++ b/src/renderer/src/styles.css@@ -10701,3 +10701,12 @@ button.agent-card__now:hover {.autonomy > p { margin: 0; }.autonomy__rules > summary { cursor: pointer; font-weight: 500; padding: 4px 0; }.autonomy__rules[open] > summary { margin-bottom: 8px; }++/* A harness's sign-in in the server's terminal (LoginTerminal.tsx) */+.modal__card.login-term { width: min(620px, calc(100vw - 32px)); }+.login-term__go { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 4px 0 12px; }+.login-term__code { display: inline-flex; gap: 6px; align-items: center; padding: 5px 10px; border: 1px dashed var(--border); border-radius: 8px; background: var(--bg-2, var(--bg)); color: inherit; font-size: 15px; font-weight: 600; letter-spacing: 0.04em; cursor: pointer; }+.login-term__screen { margin: 0 0 10px; padding: 10px 12px; max-height: 44vh; overflow: auto; border-radius: 8px; background: #16150f; color: #e9e6dc; font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }+.login-term__type { gap: 8px; margin-bottom: 8px; }+.login-term__type input { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }+.login-term__keys { display: flex; gap: 6px; margin-bottom: 4px; }diff --git a/src/shared/rpc-shapes.ts b/src/shared/rpc-shapes.tsindex 4f8cbe6..c144165 100644--- a/src/shared/rpc-shapes.ts+++ b/src/shared/rpc-shapes.ts@@ -40,9 +40,12 @@ export const SHAPES: Record<Method, Record<string, string>> = {voiceRemoveModel: { model: 's' },localPath: { messageId: 's', path: 's' },openLocal: { messageId: 's', path: 's', how: '[open,reveal]' },- loginEngine: { engine: 's' },+ loginEngine: { engine: 's', screen: 'b?' },+ loginScreen: {},+ loginInput: { id: 's', text: 's?', key: '[enter,up,down,left,right,esc,tab,backspace,space]?', enter: 'b?' },+ stopLogin: { id: 's' },addAccount: { engine: 's', name: 's' },- loginAccount: { id: 's' },+ loginAccount: { id: 's', screen: 'b?' },removeAccount: { id: 's' },installEngine: { engine: 's' },setupEngine: { engine: 's' },@@ -217,7 +220,8 @@ export const LIMITS: Partial<Record<Method, Record<string, number>>> = {wikiAddLink: { url: 4_000 },wikiSaveSchema: { text: MB },wikiSearch: { q: 1_000 },- wikiRelease: { title: 200 }+ wikiRelease: { title: 200 },+ loginInput: { text: 4_000 } // a code or an API key, typed into a sign-in}export function limitError(method: Method, params: unknown): string | undefined {diff --git a/src/shared/rpc.ts b/src/shared/rpc.tsindex bfc6c3a..96c3ebf 100644--- a/src/shared/rpc.ts+++ b/src/shared/rpc.ts@@ -2,7 +2,7 @@import type { Answer } from './questions'import type { WikiChange, WikiHit, WikiPage, WikiImport, WikiPageInfo, WikiReview, WikiSource, WikiVersion } from './types'import type { AppProvider } from './connector-catalog'-import type { Os, Account, AccountEngine, ActivityEntry, Device, Inbox, Agent, BrowserInput, Approval, Artifact, ImageUpload, BrowserView, ComputerInfo, Connector, ConnectorInput, ConnectorTool, HarnessMcp, Conversation, EngineId, Invite, Memory, Person, Role, MemoryScope, Message, Routine, RoutineInput, Report, Settings, SetupState, LocalSkill, Skill, SkillInput, SkillVersion, Trigger, UsageReport, LocalInfo, VoiceModelId, VoiceStatus } from './types'+import type { Os, Account, AccountEngine, ActivityEntry, Device, Inbox, Agent, BrowserInput, Approval, Artifact, ImageUpload, BrowserView, ComputerInfo, Connector, ConnectorInput, ConnectorTool, HarnessMcp, Conversation, EngineId, Invite, Memory, Person, Role, MemoryScope, Message, Routine, RoutineInput, Report, Settings, SetupState, LoginKey, LoginScreen, LocalSkill, Skill, SkillInput, SkillVersion, Trigger, UsageReport, LocalInfo, VoiceModelId, VoiceStatus } from './types'export interface Snapshot {webhookPort?: number@@ -65,9 +65,14 @@ export interface Api {voiceRemoveModel(p: { model: VoiceModelId }): voidlocalPath(p: { messageId: string; path: string }): LocalInfo | null // what a path this agent cited can do; null: it stays textopenLocal(p: { messageId: string; path: string; how: 'open' | 'reveal' }): void- loginEngine(p: { engine: EngineId }): { opened: boolean; command: string } // not opened: no terminal to open, the person runs the command+ // not opened: no terminal to open, the person runs the command. screen: the caller can show the+ // server's own terminal (a page or a phone on Tucano as a server); then the sign-in runs there, and comes back+ loginEngine(p: { engine: EngineId; screen?: boolean }): { opened: boolean; command: string; screen?: LoginScreen }+ loginScreen(): LoginScreen | null+ loginInput(p: { id: string; text?: string; key?: LoginKey; enter?: boolean }): Promise<LoginScreen | null>+ stopLogin(p: { id: string }): voidaddAccount(p: { engine: AccountEngine; name: string }): Account- loginAccount(p: { id: string }): { opened: boolean; command: string }+ loginAccount(p: { id: string; screen?: boolean }): { opened: boolean; command: string; screen?: LoginScreen }removeAccount(p: { id: string }): voidinstallEngine(p: { engine: EngineId }): { opened: boolean; command: string; needsNode?: boolean } // needsNode: an npm install with no npm heresetupEngine(p: { engine: EngineId }): SetupState // Codex or Claude Code with no terminal: downloaded, then the CLI's own sign-in in the browserdiff --git a/src/shared/types.ts b/src/shared/types.tsindex 720c652..8013f55 100644--- a/src/shared/types.ts+++ b/src/shared/types.ts@@ -579,6 +579,21 @@ export interface SetupState {error?: string}+// A harness's sign-in in the server's own terminal (src/core/login-terminal.ts), shown on a page or a phone.+export interface LoginScreen {+ id: string+ engine: EngineId+ account?: string // another login's id (Settings › Accounts); unset: the harness's usual one+ lines: string[]+ url?: string // the page to open, as the CLI shows it+ code?: string // a code to type on that page+ hint?: string // what to do first, for a harness whose sign-in starts inside its own screen+ state: 'running' | 'done' | 'failed' | 'cancelled'+ error?: string+}+export const LOGIN_KEYS = ['enter', 'up', 'down', 'left', 'right', 'esc', 'tab', 'backspace', 'space'] as const+export type LoginKey = (typeof LOGIN_KEYS)[number]+// A harness starts picked only when it can actually run: one not installed or not// signed in yet starts off.export const startsPicked = (st: EngineStatus): boolean => !st.soon && st.loggedIndiff --git a/test/login-terminal.test.ts b/test/login-terminal.test.tsnew file mode 100644index 0000000..01a1865--- /dev/null+++ b/test/login-terminal.test.ts@@ -0,0 +1,149 @@+import { describe, expect, it } from 'vitest'+import { LoginTerminal, loginCommand, type Pty } from '../src/core/login-terminal'+import { Screen, signInHints } from '../src/core/vt-screen'++describe('Screen', () => {+ it('keeps text, carriage returns and line erases as a terminal would', () => {+ const s = new Screen(20, 5)+ s.write('hello\r\nworld\rW')+ expect(s.lines()).toEqual(['hello', 'World'])+ s.write('\x1b[2K\rgone')+ expect(s.lines()).toEqual(['hello', 'gone'])+ })++ it('redraws a menu in place with cursor moves, and drops colors', () => {+ const s = new Screen(30, 6)+ s.write('\x1b[36m●\x1b[39m One\r\n○ Two\r\n')+ s.write('\x1b[2A\r○ One\r\n\x1b[32m●\x1b[39m Two')+ expect(s.lines()).toEqual(['○ One', '● Two'])+ })++ it('wraps at the edge, joining the wrapped line back, and scrolls at the bottom', () => {+ const s = new Screen(4, 3)+ s.write('abcdefgh\r\nij')+ expect(s.lines()).toEqual(['abcdefgh', 'ij'])+ s.write('\r\nkl\r\nmn')+ expect(s.lines()).toEqual(['ij', 'kl', 'mn'])+ const t = new Screen(4, 3)+ t.write('abcd\r\nef')+ expect(t.lines()).toEqual(['abcd', 'ef']) // full to the edge, then a new line: no wrap+ })++ it('takes an escape sequence cut between two writes', () => {+ const s = new Screen(20, 3)+ s.write('ab\x1b[')+ s.write('2Dx')+ expect(s.lines()).toEqual(['xb'])+ })++ it('starts clean on the alternate screen and positions with H', () => {+ const s = new Screen(10, 4)+ s.write('old\x1b[?1049h\x1b[3;2Hhi')+ expect(s.lines()).toEqual(['', '', ' hi'])+ })+})++describe('signInHints', () => {+ it('finds the page across wrapped lines, and a device code', () => {+ const s = new Screen(30, 10)+ s.write('1. Open https://auth.example.com/device?x=1234567890\r\n2. Enter this code\r\n 6D5A-HIJNZ\r\n')+ expect(signInHints(s)).toEqual({ url: 'https://auth.example.com/device?x=1234567890', code: '6D5A-HIJNZ' })+ })++ it('prefers a link the program marked', () => {+ const s = new Screen(40, 4)+ s.write('\x1b]8;;https://marked.example.com/a\x07click here\x1b]8;;\x07 or https://other.example.com')+ expect(signInHints(s).url).toBe('https://marked.example.com/a')+ })+})++describe('loginCommand', () => {+ it('signs in with no browser on this machine', () => {+ expect(loginCommand('codex').args).toEqual(['login', '--device-auth'])+ expect(loginCommand('grok').args).toEqual(['login', '--device-auth'])+ expect(loginCommand('cursor').env).toEqual({ NO_OPEN_BROWSER: '1' })+ expect(loginCommand('gemini').env).toEqual({ NO_BROWSER: 'true' })+ expect(loginCommand('pi').hint).toMatch(/\/login/)+ })+})++function fakePty() {+ let out: (t: string) => void = () => {}+ let end: (code: number) => void = () => {}+ const written: string[] = []+ const pty: Pty & { written: string[]; print: (t: string) => void; end: (code: number) => void; killed: boolean } = {+ written,+ killed: false,+ write: (d) => void written.push(d),+ output: (on) => void (out = on),+ exit: new Promise<number>((r) => (end = r)),+ kill: () => void ((pty.killed = true), end(1)),+ print: (t) => out(t),+ end: (c) => end(c)+ }+ return pty+}++describe('LoginTerminal', () => {+ const setup = (signedIn: () => boolean) => {+ const pty = fakePty()+ const spawned: { bin: string; args: string[]; env: NodeJS.ProcessEnv }[] = []+ const t = new LoginTerminal({+ spawn: (bin, args, env) => (spawned.push({ bin, args, env }), pty),+ bin: () => '/bin/codex',+ env: (_e, account) => ({ WHERE: account ?? 'usual' }),+ signedIn: async () => signedIn(),+ pollMs: 5,+ pasteGapMs: 0+ })+ return { pty, spawned, t }+ }++ it('runs the CLI with its variables and shows its screen', () => {+ const { pty, spawned, t } = setup(() => false)+ const s = t.start('cursor', 'acc1')!+ expect(spawned[0]).toMatchObject({ bin: '/bin/codex', args: ['login'], env: { WHERE: 'acc1', NO_OPEN_BROWSER: '1' } })+ pty.print('Open https://cursor.com/login?x=1\r\n')+ expect(t.current()).toMatchObject({ id: s.id, engine: 'cursor', account: 'acc1', state: 'running', url: 'https://cursor.com/login?x=1' })+ t.stop()+ })++ it('types a code, then Enter apart, and named keys', async () => {+ const { pty, t } = setup(() => false)+ const s = t.start('claude')!+ await t.send(s.id, { text: 'abc#def\n', enter: true })+ await t.send(s.id, { key: 'down' })+ expect(pty.written).toEqual(['abc#def', '\r', '\x1b[B'])+ await t.send('someone-else', { text: 'x' })+ expect(pty.written).toHaveLength(3)+ t.stop()+ })++ it('is done once the harness is signed in, and ends the CLI', async () => {+ let yes = false+ const { pty, t } = setup(() => yes)+ t.start('gemini')+ yes = true+ await new Promise((r) => setTimeout(r, 30))+ expect(t.current()?.state).toBe('done')+ expect(pty.killed).toBe(true)+ })++ it('fails with the last lines when the CLI quits signed out', async () => {+ const { pty, t } = setup(() => false)+ t.start('codex')+ pty.print('Error: device code expired\r\n')+ pty.end(1)+ await new Promise((r) => setTimeout(r, 10))+ expect(t.current()).toMatchObject({ state: 'failed', error: expect.stringContaining('device code expired') })+ })++ it('a stop cancels; with no terminal on this system there is nothing to start', () => {+ const { t } = setup(() => false)+ const s = t.start('codex')!+ t.stop(s.id)+ expect(t.current()?.state).toBe('cancelled')+ const none = new LoginTerminal({ spawn: () => undefined, bin: () => 'x', env: () => ({}), signedIn: async () => false })+ expect(none.start('codex')).toBeUndefined()+ })+})diff --git a/test/team-fixes.test.ts b/test/team-fixes.test.tsindex a7efb95..93770aa 100644--- a/test/team-fixes.test.ts+++ b/test/team-fixes.test.ts@@ -95,8 +95,8 @@ describe("a member's read-only pages", () => {expect(helpers.get('loadReport')).toBe('report')// Screens only an admin reaches: the connectors' admin view, the introduction (the owner's; someone// invited gets GuestWelcome) and the agent builder (admins'), the activity log, adding a skill from- // the terminal and a skill's history.- const ADMIN_SCREENS = new Set(['ConnectorStore.tsx:ownApp', 'Harness.tsx:harnessMcps', 'Intro.tsx:testEngine', 'Intro.tsx:refreshEngines', 'Intro.tsx:harnessMcps', 'Intro.tsx:localSkills', 'People.tsx:activity', 'People.tsx:removedPeople', 'Skills.tsx:localSkills', 'Skills.tsx:skillVersions'])+ // the terminal, a skill's history, and a harness's sign-in on the server's terminal (opened by an admin's Sign in).+ const ADMIN_SCREENS = new Set(['LoginTerminal.tsx:loginScreen', 'LoginTerminal.tsx:refreshEngines', 'ConnectorStore.tsx:ownApp', 'Harness.tsx:harnessMcps', 'Intro.tsx:testEngine', 'Intro.tsx:refreshEngines', 'Intro.tsx:harnessMcps', 'Intro.tsx:localSkills', 'People.tsx:activity', 'People.tsx:removedPeople', 'Skills.tsx:localSkills', 'Skills.tsx:skillVersions'])const found: string[] = []for (const file of readdirSync(join(root, 'components')).filter((f) => f.endsWith('.tsx'))) {const src = readFileSync(join(root, 'components', file), 'utf8')