From b2a4404bb5579035c81d9cb3fe0b8c6a5f05b33c Mon Sep 17 00:00:00 2001 From: Blake Bauman Date: Sat, 14 Nov 2026 11:36:57 -0700 Subject: [PATCH 1/8] feat(code): discover workspace context and preserve concurrent file changes --- apps/docs/src/content/guide/terminal.mdx | 24 +++ apps/tui/src/workspace.ts | 67 +++++++- apps/tui/tests/workspace.test.ts | 143 ++++++++++++++++++ packages/cowork-client/src/client-tools.ts | 24 ++- packages/cowork-client/src/fs-mount.ts | 21 ++- .../cowork-client/tests/client-tools.test.ts | 17 +++ packages/cowork-client/tests/fs-mount.test.ts | 66 +++++++- packages/felix-client/src/local-files.ts | 67 +++++++- .../felix-client/tests/local-files.test.ts | 92 +++++++++++ 9 files changed, 506 insertions(+), 15 deletions(-) diff --git a/apps/docs/src/content/guide/terminal.mdx b/apps/docs/src/content/guide/terminal.mdx index b26fc422..3c475c5c 100644 --- a/apps/docs/src/content/guide/terminal.mdx +++ b/apps/docs/src/content/guide/terminal.mdx @@ -421,6 +421,30 @@ commands for builds, tests and Git. Each command shows its full text and absolut directory for confirmation, including when `--yes` skips file-write prompts. Without `--shell`, only the existing emulated file commands are available. +The coding agent calls `local_info` to check which client and workspace it is using. +The terminal reports whether native shell execution is enabled; the browser reports +emulated commands and whether files live in a mounted directory or its virtual workspace. +This check reads no project files and runs no command. Older clients can continue using +the file tools, but do not support this capability check. + +Before editing a target file, `code` can use `local_instructions` to read the `AGENTS.md` +and `CLAUDE.md` files in its parent directories, starting at the workspace root. This +also works for new files. Results include truncation offsets when instructions exceed +the response budget; the agent must finish those reads before editing. Both tools +are available in plan mode. + +`local_edit` rechecks the original contents after terminal confirmation and before +committing a browser write. If the file changed, it reports a conflict and preserves +the newer work so the agent can reread and reconcile it. This does not lock the file +against other programs. + +Delete and rename also recheck the source after terminal confirmation. Terminal +rename creates the destination exclusively before removing the source, so it cannot +replace a file created during approval. It requires a filesystem that supports hard +links and refuses moves across filesystems. If a move fails after creating the +destination, inspect both paths: the source is retained when its removal is uncertain. +Browser rename copies before deleting and retains a source changed during that copy. + Commands start inside the project, but **are not sandboxed**: an approved command has your account's filesystem and network access. stdin is closed; interactive programs are unsupported. Output is capped at 200 kB and commands time out after four minutes. Stop cancels the process diff --git a/apps/tui/src/workspace.ts b/apps/tui/src/workspace.ts index 452bf7ca..f8b5f794 100644 --- a/apps/tui/src/workspace.ts +++ b/apps/tui/src/workspace.ts @@ -29,16 +29,16 @@ * confirmed real command. Only its initial cwd is contained; this is not an OS sandbox. */ -import { constants } from 'node:fs'; +import { constants, type Stats } from 'node:fs'; import { access, appendFile, + link, lstat, mkdir, readdir, readFile, realpath, - rename, stat, unlink, writeFile, @@ -310,6 +310,27 @@ async function refuseLink(realRoot: string, path: string): Promise { throw new Error(`${path} is a symbolic link; links are not followed here`); } +async function assertUnchanged( + root: string, + path: string, + target: string, + before: Stats, +): Promise { + await refuseLink(root, path); + if ((await resolveWithin(root, path)) !== target) + throw new Error(`${path} changed location while awaiting approval; inspect it again`); + const now = await lstat(target); + if ( + !now.isFile() || + now.dev !== before.dev || + now.ino !== before.ino || + now.size !== before.size || + now.mtimeMs !== before.mtimeMs + ) + throw new Error(`${path} changed while awaiting approval; inspect it again`); + await assertWritable(root, target); +} + /** * The working directory as the `local_*` file tools see it, under the same three rules as the * shell verbs above: every path through `resolveWithin`, every write through `assertWritable` @@ -338,11 +359,18 @@ function workingDirFs(opts: WorkspaceOptions): LocalFs { } return await readFile(target, 'utf8'); }, - write: async (path, content, { append, summary }) => { + write: async (path, content, { append, summary, expected }) => { const root = await realRoot(); const target = await resolveWithin(root, path); await assertWritable(root, target); if (!(await opts.confirm(`${summary} ${target}`))) throw new Error('refused by the user'); + // Approval may take minutes. Revalidate both the destination and the + // content used to construct an edit before replacing the file. + if ((await resolveWithin(root, path)) !== target) + throw new Error(`${path} changed location; read it again before editing`); + await assertWritable(root, target); + if (expected !== undefined && (await readFile(target, 'utf8')) !== expected) + throw new Error(`${path} changed since it was read; read it again before editing`); await mkdir(dirname(target), { recursive: true }); opts.signal?.throwIfAborted(); if (append) await appendFile(target, content, 'utf8'); @@ -358,6 +386,7 @@ function workingDirFs(opts: WorkspaceOptions): LocalFs { if (!info.isFile()) throw new Error(`${path} is not a file; only files are deleted`); await assertWritable(root, target); if (!(await opts.confirm(`${summary} ${target}`))) throw new Error('refused by the user'); + await assertUnchanged(root, path, target, info); opts.signal?.throwIfAborted(); await unlink(target); }, @@ -381,15 +410,45 @@ function workingDirFs(opts: WorkspaceOptions): LocalFs { } if (!(await opts.confirm(`${summary} ${from} → ${to}`))) throw new Error('refused by the user'); + await assertUnchanged(root, path, from, info); + await refuseLink(root, toPath); + if ((await resolveWithin(root, toPath)) !== to) + throw new Error(`${toPath} changed location while awaiting approval; inspect it again`); + await assertWritable(root, to); await mkdir(dirname(to), { recursive: true }); opts.signal?.throwIfAborted(); - await rename(from, to); + // link is exclusive: a destination created after the checks is never + // replaced. Unlink only after the new name exists and source is rechecked. + // Cross-filesystem links fail safely, leaving the source in place. + await link(from, to); + try { + await assertUnchanged(root, path, from, info); + opts.signal?.throwIfAborted(); + await unlink(from); + } catch (error) { + // Do not remove either name during uncertain concurrent changes. + throw new Error(`rename created ${toPath} but kept ${path}: ${String(error)}`); + } }, }; } async function run(req: ClientToolRequest, opts: WorkspaceOptions): Promise { try { + if (req.name === 'local_info') { + return { + content: JSON.stringify({ + client: 'terminal', + workspace: { kind: 'directory', root: await realpath(opts.root) }, + shell: { + mode: opts.shell ? 'native' : 'emulated', + ...(opts.shell + ? { interpreter: '/bin/sh', confirmation: 'always', sandboxed: false } + : { commands: ['pwd', 'ls', 'cat', 'echo', 'mkdir', 'touch', 'tree', 'help'] }), + }, + }), + }; + } if (isLocalFileTool(req.name)) return await runLocalFileTool(req, workingDirFs(opts)); if (req.name === 'local_shell') { const command = typeof req.args.command === 'string' ? req.args.command : ''; diff --git a/apps/tui/tests/workspace.test.ts b/apps/tui/tests/workspace.test.ts index 6548d871..2fdbfc18 100644 --- a/apps/tui/tests/workspace.test.ts +++ b/apps/tui/tests/workspace.test.ts @@ -8,6 +8,7 @@ import { realpathSync, statSync, symlinkSync, + unlinkSync, writeFileSync, } from 'node:fs'; import { tmpdir } from 'node:os'; @@ -50,6 +51,96 @@ const allow = async () => true; /** A workspace that would say yes — so a refusal in a test is never the prompt's. */ const permissive = () => createWorkspace({ root, confirm: allow }); +describe('local_info', () => { + it.each([false, true])('reports native execution only with shell=%s', async (shell) => { + const confirm = vi.fn(async () => true); + const workspace = createWorkspace({ root, shell, confirm }); + const result = await workspace.execute(call('local_info', {})); + expect(result.error).not.toBe(true); + const info = JSON.parse(result.content); + expect(info.client).toBe('terminal'); + expect(info.workspace).toEqual({ kind: 'directory', root }); + expect(info.shell.mode).toBe(shell ? 'native' : 'emulated'); + if (shell) { + expect(info.shell.confirmation).toBe('always'); + expect(info.shell.sandboxed).toBe(false); + expect(info.shell.interpreter).toBe('/bin/sh'); + } else { + expect(info.shell.commands).not.toContain('git'); + expect(info.shell.commands).toContain('cat'); + } + expect(confirm).not.toHaveBeenCalled(); + }); +}); + +describe('edits while confirmation is pending', () => { + it('preserves a newer edit and permits a fresh retry', async () => { + const file = join(root, 'src', 'api.ts'); + let changed = false; + const workspace = createWorkspace({ + root, + confirm: async () => { + if (!changed) { + writeFileSync(file, 'export const x = 3;\n'); + changed = true; + } + return true; + }, + }); + const stale = await workspace.execute( + call('local_edit', { path: 'src/api.ts', old_string: '1', new_string: '2' }), + ); + expect(stale.error).toBe(true); + expect(stale.content).toContain('changed since it was read'); + expect(readFileSync(file, 'utf8')).toBe('export const x = 3;\n'); + const retry = await workspace.execute( + call('local_edit', { path: 'src/api.ts', old_string: '3', new_string: '4' }), + ); + expect(retry.error).not.toBe(true); + expect(readFileSync(file, 'utf8')).toBe('export const x = 4;\n'); + }); + + it('does not recreate a file deleted while confirmation was pending', async () => { + const file = join(root, 'src', 'api.ts'); + const workspace = createWorkspace({ + root, + confirm: async () => { + await import('node:fs/promises').then((fs) => fs.unlink(file)); + return true; + }, + }); + const result = await workspace.execute( + call('local_edit', { path: 'src/api.ts', old_string: '1', new_string: '2' }), + ); + expect(result.error).toBe(true); + expect(existsSync(file)).toBe(false); + }); +}); + +describe('local_instructions', () => { + it('reads applicable instructions from the real project without confirmation', async () => { + writeFileSync(join(root, 'AGENTS.md'), 'root instructions'); + writeFileSync(join(root, 'src', 'CLAUDE.md'), 'source instructions'); + const confirm = vi.fn(async () => true); + const result = await createWorkspace({ root, confirm }).execute( + call('local_instructions', { path: 'src/new.ts' }), + ); + expect(result.error).not.toBe(true); + expect( + JSON.parse(result.content).instructions.map((file: { content: string }) => file.content), + ).toEqual(['root instructions', 'source instructions']); + expect(confirm).not.toHaveBeenCalled(); + }); + + it('refuses an instruction file symlink outside the workspace', async () => { + writeFileSync(join(outside, 'instructions.md'), 'outside instructions'); + symlinkSync(join(outside, 'instructions.md'), join(root, 'AGENTS.md')); + const result = await permissive().execute(call('local_instructions', {})); + expect(result.error).toBe(true); + expect(result.content).not.toContain('outside instructions'); + }); +}); + describe('resolveWithin', () => { it('resolves a relative path under the root', async () => { await expect(resolveWithin(root, 'src/api.ts')).resolves.toBe(join(root, 'src', 'api.ts')); @@ -326,6 +417,58 @@ describe('the local_* file tools', () => { }); describe('local_delete and local_rename on the working directory', () => { + it('never overwrites a destination created during rename confirmation', async () => { + const workspace = createWorkspace({ + root, + confirm: async () => { + writeFileSync(join(root, 'new.ts'), 'newer destination'); + return true; + }, + }); + const result = await workspace.execute( + call('local_rename', { path: 'src/api.ts', to_path: 'new.ts' }), + ); + expect(result.error).toBe(true); + expect(readFileSync(join(root, 'new.ts'), 'utf8')).toBe('newer destination'); + expect(readFileSync(join(root, 'src', 'api.ts'), 'utf8')).toBe('export const x = 1;\n'); + }); + + it.each([ + 'local_delete', + 'local_rename', + ])('preserves a changed source during %s confirmation', async (name) => { + const file = join(root, 'src', 'api.ts'); + const workspace = createWorkspace({ + root, + confirm: async () => { + writeFileSync(file, 'newer user work'); + return true; + }, + }); + const result = await workspace.execute(call(name, { path: 'src/api.ts', to_path: 'new.ts' })); + expect(result.error).toBe(true); + expect(result.content).toContain('changed while awaiting approval'); + expect(readFileSync(file, 'utf8')).toBe('newer user work'); + expect(existsSync(join(root, 'new.ts'))).toBe(false); + }); + + it('refuses a source replaced by a symlink during delete confirmation', async () => { + const file = join(root, 'src', 'api.ts'); + writeFileSync(join(outside, 'secret.ts'), 'outside'); + const workspace = createWorkspace({ + root, + confirm: async () => { + unlinkSync(file); + symlinkSync(join(outside, 'secret.ts'), file); + return true; + }, + }); + const result = await workspace.execute(call('local_delete', { path: 'src/api.ts' })); + expect(result.error).toBe(true); + expect(readFileSync(file, 'utf8')).toBe('outside'); + expect(readFileSync(join(outside, 'secret.ts'), 'utf8')).toBe('outside'); + }); + it('delete removes a file after a yes that names it absolutely, and nothing without one', async () => { writeFileSync(join(root, 'gone.md'), 'x'); const asked: string[] = []; diff --git a/packages/cowork-client/src/client-tools.ts b/packages/cowork-client/src/client-tools.ts index 34212727..6577174a 100644 --- a/packages/cowork-client/src/client-tools.ts +++ b/packages/cowork-client/src/client-tools.ts @@ -126,10 +126,14 @@ export function workspaceFs(vfs: VirtualFs, check: () => void = () => {}): Local list: async (path) => checked(() => (hasMount() ? mountList(path || '.') : vfs.list(path || '.'))), read: async (path) => checked(() => (hasMount() ? mountRead(path) : vfs.read(path))), - write: async (path, content, { append }) => { + write: async (path, content, { append, expected }) => { check(); - if (hasMount()) await mountWrite(path, content, append, check); - else vfs.write(path, content, append); + if (hasMount()) await mountWrite(path, content, append, check, expected); + else { + if (expected !== undefined && vfs.read(path) !== expected) + throw new Error(`${path} changed since it was read; read it again before editing`); + vfs.write(path, content, append); + } }, // Files only, never overwriting — the same rules the operator's pane // follows, through the same helpers, gated by the same approval rule. @@ -206,6 +210,20 @@ async function runClientTool( ): Promise { try { check(); + if (req.name === 'local_info') { + return { + content: JSON.stringify({ + client: 'browser', + workspace: hasMount() + ? { kind: 'directory', label: getMountLabel() } + : { kind: 'virtual' }, + shell: { + mode: 'emulated', + commands: ['pwd', 'ls', 'cat', 'echo', 'mkdir', 'touch', 'tree', 'help'], + }, + }), + }; + } if (isLocalFileTool(req.name)) return await runLocalFileTool(req, workspaceFs(vfs, check)); if (req.name === 'local_shell') { const command = asString(req.args.command); diff --git a/packages/cowork-client/src/fs-mount.ts b/packages/cowork-client/src/fs-mount.ts index ad339814..0b23cf02 100644 --- a/packages/cowork-client/src/fs-mount.ts +++ b/packages/cowork-client/src/fs-mount.ts @@ -23,10 +23,12 @@ async function writeAndCommit( writable: FileSystemWritableFileStream, data: string | Uint8Array, check: MutationCheck, + beforeCommit?: () => Promise, ): Promise { try { check(); await writable.write(data); + await beforeCommit?.(); check(); await writable.close(); } catch (error) { @@ -224,11 +226,12 @@ export async function mountWrite( content: string, append = false, check: MutationCheck = unchecked, + expected?: string, ): Promise { - const { parent, name } = await resolve(path, { create: true, check }); + const { parent, name } = await resolve(path, { create: expected === undefined, check }); check(); if (!name) throw new Error('not a file'); - const fileHandle = await parent.getFileHandle(name, { create: true }); + const fileHandle = await parent.getFileHandle(name, { create: expected === undefined }); check(); let next = content; if (append) { @@ -241,8 +244,14 @@ export async function mountWrite( } } check(); + const verify = async () => { + if (expected !== undefined && (await (await fileHandle.getFile()).text()) !== expected) + throw new Error(`${path} changed since it was read; read it again before editing`); + check(); + }; + await verify(); const writable = await fileHandle.createWritable(); - await writeAndCommit(writable, next, check); + await writeAndCommit(writable, next, check, verify); } export async function mountMkdir(path: string, check: MutationCheck = unchecked): Promise { @@ -388,6 +397,12 @@ export async function mountRename( const writable = await out.createWritable(); await writeAndCommit(writable, bytes, check); check(); + const latest = new Uint8Array( + await (await (await src.parent.getFileHandle(src.name)).getFile()).arrayBuffer(), + ); + check(); + if (latest.length !== bytes.length || latest.some((byte, index) => byte !== bytes[index])) + throw new Error(`rename created ${to} but kept ${from}: source changed during the move`); await src.parent.removeEntry(src.name); } diff --git a/packages/cowork-client/tests/client-tools.test.ts b/packages/cowork-client/tests/client-tools.test.ts index d786f279..befe396d 100644 --- a/packages/cowork-client/tests/client-tools.test.ts +++ b/packages/cowork-client/tests/client-tools.test.ts @@ -10,6 +10,23 @@ beforeEach(() => { }); describe('executeClientTool', () => { + it('reports virtual files and emulation without opening or reading files', async () => { + const read = vi.spyOn(vfs, 'read'); + try { + const result = await executeClientTool({ id: 'info', name: 'local_info', args: {} }, vfs); + expect(result.error).not.toBe(true); + const info = JSON.parse(result.content); + expect(info.client).toBe('browser'); + expect(info.workspace).toEqual({ kind: 'virtual' }); + expect(info.shell.mode).toBe('emulated'); + expect(info.shell.commands).toContain('cat'); + expect(info.shell.commands).not.toContain('npm'); + expect(read).not.toHaveBeenCalled(); + } finally { + read.mockRestore(); + } + }); + it('runs a shell command against the tab VFS', async () => { vfs.write('notes/todo.md', 'one\n'); const result = await executeClientTool( diff --git a/packages/cowork-client/tests/fs-mount.test.ts b/packages/cowork-client/tests/fs-mount.test.ts index ec0b8554..b16666b6 100644 --- a/packages/cowork-client/tests/fs-mount.test.ts +++ b/packages/cowork-client/tests/fs-mount.test.ts @@ -52,11 +52,15 @@ class MockFileHandle { } async createWritable() { + let staged = this.content; return { write: async (data: string) => { - this.content = data; + staged = data; }, - close: async () => {}, + close: async () => { + this.content = staged; + }, + abort: async () => {}, }; } } @@ -126,6 +130,17 @@ afterEach(() => { }); describe('mount lifecycle', () => { + it('reports mount changes without claiming native shell access', async () => { + const request = { id: 'info', name: 'local_info', args: {} }; + const vfs = getVfs('mount-info'); + const mounted = JSON.parse((await executeClientTool(request, vfs)).content); + expect(mounted.workspace).toEqual({ kind: 'directory', label: 'project' }); + expect(mounted.shell.mode).toBe('emulated'); + clearMount(); + const cleared = JSON.parse((await executeClientTool(request, vfs)).content); + expect(cleared.workspace).toEqual({ kind: 'virtual' }); + }); + it('reports the picked folder', () => { expect(hasMount()).toBe(true); expect(getMountLabel()).toBe('project'); @@ -420,6 +435,53 @@ describe('folders in the mount', () => { }); }); +it('keeps a rename source edited while the destination is being written', async () => { + const source = await root.getFileHandle('source.ts', { create: true }); + source.content = 'original'; + const getFile = root.getFileHandle.bind(root); + vi.spyOn(root, 'getFileHandle').mockImplementation(async (name, opts) => { + const file = await getFile(name, opts); + if (name === 'destination.ts' && opts?.create) { + const create = file.createWritable.bind(file); + vi.spyOn(file, 'createWritable').mockImplementation(async () => { + const stream = await create(); + source.content = 'newer source work'; + return stream; + }); + } + return file; + }); + await expect(mountRename('source.ts', 'destination.ts')).rejects.toThrow(/source changed/); + expect(await mountRead('source.ts')).toBe('newer source work'); + expect(await mountRead('destination.ts')).toBe('original'); +}); + +it('preserves a concurrent edit instead of committing a stale replacement', async () => { + const file = await root.getFileHandle('code.ts', { create: true }); + file.content = 'before'; + const original = file.createWritable.bind(file); + vi.spyOn(file, 'createWritable').mockImplementation(async () => { + const stream = await original(); + file.content = 'newer user edit'; + return stream; + }); + await expect(mountWrite('code.ts', 'replacement', false, () => {}, 'before')).rejects.toThrow( + /changed since it was read/, + ); + expect(file.content).toBe('newer user edit'); +}); + +it('refuses a stale edit before opening a writable stream', async () => { + const file = await root.getFileHandle('code.ts', { create: true }); + file.content = 'newer user edit'; + const open = vi.spyOn(file, 'createWritable'); + await expect(mountWrite('code.ts', 'replacement', false, () => {}, 'before')).rejects.toThrow( + /changed since it was read/, + ); + expect(open).not.toHaveBeenCalled(); + expect(file.content).toBe('newer user edit'); +}); + it('aborts an uncommitted write when the request is stopped', async () => { const file = await root.getFileHandle('code.ts', { create: true }); file.content = 'before'; diff --git a/packages/felix-client/src/local-files.ts b/packages/felix-client/src/local-files.ts index 29e2cbe3..6c9ab743 100644 --- a/packages/felix-client/src/local-files.ts +++ b/packages/felix-client/src/local-files.ts @@ -46,7 +46,7 @@ export function fileToolOp(toolName: string): FileToolOp | null { /** True for a client tool this module answers. */ export function isLocalFileTool(name: string): boolean { - return name.startsWith('local_') && name in OPS; + return name === 'local_instructions' || (name.startsWith('local_') && name in OPS); } export interface LocalEntry { @@ -63,8 +63,16 @@ export interface LocalFs { /** Direct entries of a directory (`''` or `.` is the root). */ list(path: string): Promise; read(path: string): Promise; - /** Create or replace a file, creating parent directories. May throw a refusal. */ - write(path: string, content: string, opts: { append: boolean; summary: string }): Promise; + /** + * Create or replace a file, creating parent directories. May throw a refusal. + * When expected is supplied, refuse if the current contents differ before + * writing (after any confirmation) or committing a staged browser write. + */ + write( + path: string, + content: string, + opts: { append: boolean; summary: string; expected?: string }, + ): Promise; /** * Delete one file — never a directory. May throw a refusal. Absent from a * filesystem that cannot, which `local_delete` then reports as an error. @@ -158,6 +166,57 @@ async function read(fs: LocalFs, args: Record): Promise return `${slice}\n[… characters ${offset}–${end} of ${text.length}; pass offset=${end} to read on]`; } +/** Read only instruction files governing a target, never unrelated subtrees. */ +async function instructions(fs: LocalFs, args: Record): Promise { + const raw = str(args.path) ?? ''; + const normalized = raw.replace(/\\/g, '/'); + if (normalized.startsWith('/') || /^[a-z]:/i.test(normalized) || normalized.includes('\0')) + throw new Error('path must be a file relative to the workspace root'); + const parts = normalized.split('/').filter((part) => part && part !== '.'); + if (parts.includes('..')) throw new Error('instruction paths cannot contain ..'); + if (parts.length > 33) throw new Error('instruction path exceeds 32 directories'); + // An omitted path asks for root instructions; otherwise path names a target file. + const parents = parts.slice(0, -1); + const found: Array<{ path: string; content: string; truncated: boolean; next_offset: number }> = + []; + let remaining = 48_000; + let directory = ''; + let entries = await fs.list(directory); + for (let depth = 0; depth <= parents.length; depth++) { + for (const name of ['AGENTS.md', 'CLAUDE.md']) { + const path = directory ? `${directory}/${name}` : name; + if (!entries.some((entry) => entry.path === path && entry.type === 'file')) continue; + // A listed but unreadable instruction is an error, not an absent instruction. + const text = await fs.read(path); + if (text.includes('\0')) throw new Error(`${path} is not a text instruction file`); + const content = text.slice(0, Math.min(16_000, remaining)); + remaining -= content.length; + found.push({ + path, + content, + truncated: content.length < text.length, + next_offset: content.length, + }); + } + const next = parents[depth]; + if (next === undefined) break; + const path = directory ? `${directory}/${next}` : next; + const entry = entries.find((candidate) => candidate.path === path); + // A new directory has no nested instructions yet; its existing ancestors still apply. + if (!entry) break; + if (entry.type !== 'dir') throw new Error(`${path} is not a directory`); + directory = path; + entries = await fs.list(directory); + } + return JSON.stringify({ + target: parts.join('/'), + instructions: found, + complete: found.every((file) => !file.truncated), + guidance: + 'Read in order. Deeper instructions govern their subtree. Use local_read with offset=next_offset for truncated files before editing.', + }); +} + /** A regular expression the model wrote, or a literal match; never throws. */ function matcher(query: string, regex: boolean): ((line: string) => boolean) | string { if (!regex) return (line) => line.includes(query); @@ -242,6 +301,7 @@ async function edit(fs: LocalFs, args: Record): Promise : text.replace(oldString, () => newString); await fs.write(path, next, { append: false, + expected: text, summary: `edit (${found} replacement${found === 1 ? '' : 's'})`, }); return JSON.stringify({ path, replacements: all ? found : 1 }); @@ -280,6 +340,7 @@ export async function runLocalFileTool( ): Promise { const args = req.args ?? {}; try { + if (req.name === 'local_instructions') return { content: await instructions(fs, args) }; let content: string; switch (fileToolOp(req.name)) { case 'list': diff --git a/packages/felix-client/tests/local-files.test.ts b/packages/felix-client/tests/local-files.test.ts index 311e3874..cbc9d06f 100644 --- a/packages/felix-client/tests/local-files.test.ts +++ b/packages/felix-client/tests/local-files.test.ts @@ -62,6 +62,98 @@ describe('fileToolOp', () => { }); }); +describe('local_instructions', () => { + it('reads root and applicable nested instructions in order without changing files', async () => { + const { fs, writes } = memoryFs({ + 'AGENTS.md': 'root', + 'CLAUDE.md': 'root commands', + 'src/AGENTS.md': 'source', + 'src/lib/AGENTS.md': 'library', + 'other/AGENTS.md': 'unrelated', + 'src/lib/code.ts': 'code', + }); + expect(isLocalFileTool('local_instructions')).toBe(true); + const result = await run(fs, 'local_instructions', { path: 'src/lib/code.ts' }); + expect(result.error).not.toBe(true); + const out = JSON.parse(result.content); + expect(out.instructions.map((file: { path: string }) => file.path)).toEqual([ + 'AGENTS.md', + 'CLAUDE.md', + 'src/AGENTS.md', + 'src/lib/AGENTS.md', + ]); + expect(out.complete).toBe(true); + expect(writes).toEqual([]); + }); + + it('finds instructions for a file in directories that do not exist yet', async () => { + const { fs } = memoryFs({ 'AGENTS.md': 'root', 'src/AGENTS.md': 'source' }); + const out = JSON.parse( + (await run(fs, 'local_instructions', { path: 'src/new/deep/file.ts' })).content, + ); + expect(out.instructions.map((file: { content: string }) => file.content)).toEqual([ + 'root', + 'source', + ]); + }); + + it('asks only for root instructions when no target is given', async () => { + const { fs } = memoryFs({ 'AGENTS.md': 'root', 'src/AGENTS.md': 'nested' }); + const out = JSON.parse((await run(fs, 'local_instructions', {})).content); + expect(out.instructions).toHaveLength(1); + expect(out.instructions[0].path).toBe('AGENTS.md'); + }); + + it('reports an empty instruction set explicitly', async () => { + const { fs } = memoryFs({ 'README.md': 'project' }); + const out = JSON.parse((await run(fs, 'local_instructions', {})).content); + expect(out.instructions).toEqual([]); + expect(out.complete).toBe(true); + }); + + it.each([ + '../secret.ts', + '/etc/file', + 'C:\\secret.ts', + 'src/../../file', + 'src\\..\\file', + `${'a/'.repeat(34)}file`, + ])('refuses unsafe or excessive paths: %s', async (path) => { + const { fs } = memoryFs({ 'AGENTS.md': 'root' }); + expect((await run(fs, 'local_instructions', { path })).error).toBe(true); + }); + + it('does not silently ignore an unreadable instruction', async () => { + const { fs } = memoryFs({ 'AGENTS.md': 'root' }); + fs.read = async () => { + throw new Error('permission denied'); + }; + const result = await run(fs, 'local_instructions', {}); + expect(result.error).toBe(true); + expect(result.content).toContain('permission denied'); + }); + + it('bounds the combined text and tells the caller where to continue every truncated file', async () => { + const { fs } = memoryFs({ + 'AGENTS.md': 'a'.repeat(20_000), + 'CLAUDE.md': 'b'.repeat(20_000), + 'src/AGENTS.md': 'c'.repeat(20_000), + 'src/CLAUDE.md': 'd'.repeat(20_000), + }); + const out = JSON.parse((await run(fs, 'local_instructions', { path: 'src/code.ts' })).content); + expect(out.complete).toBe(false); + expect(out.instructions.map((file: { next_offset: number }) => file.next_offset)).toEqual([ + 16_000, 16_000, 16_000, 0, + ]); + expect(out.instructions.every((file: { truncated: boolean }) => file.truncated)).toBe(true); + const more = await run(fs, 'local_read', { + path: out.instructions[0].path, + offset: out.instructions[0].next_offset, + }); + expect(more.content).toContain('a'.repeat(4_000)); + }); +}); + describe('local_list', () => { it('lists direct entries, directories ending in a slash', async () => { const { fs } = memoryFs({ 'README.md': '', '.github/ci.yml': '', 'src/a.ts': '' }); From adfac3da04a6f577b69a62d74107febf3a30a40c Mon Sep 17 00:00:00 2001 From: Blake Bauman Date: Sat, 14 Nov 2026 14:34:37 -0700 Subject: [PATCH 2/8] feat(tui): summarize observed coding results at turn completion --- apps/docs/src/content/guide/terminal.mdx | 8 ++ apps/tui/src/app.tsx | 1 + apps/tui/src/ui/transcript.tsx | 9 +++ apps/tui/src/ui/workspace-summary.tsx | 53 +++++++++++++ apps/tui/src/workspace-summary.ts | 59 +++++++++++++++ apps/tui/tests/transcript.test.ts | 73 ++++++++++++++++++ apps/tui/tests/workspace-summary.test.ts | 94 ++++++++++++++++++++++++ 7 files changed, 297 insertions(+) create mode 100644 apps/tui/src/ui/workspace-summary.tsx create mode 100644 apps/tui/src/workspace-summary.ts create mode 100644 apps/tui/tests/workspace-summary.test.ts diff --git a/apps/docs/src/content/guide/terminal.mdx b/apps/docs/src/content/guide/terminal.mdx index 3c475c5c..4d116f2e 100644 --- a/apps/docs/src/content/guide/terminal.mdx +++ b/apps/docs/src/content/guide/terminal.mdx @@ -449,3 +449,11 @@ Commands start inside the project, but **are not sandboxed**: an approved comman account's filesystem and network access. stdin is closed; interactive programs are unsupported. Output is capped at 200 kB and commands time out after four minutes. Stop cancels the process group. `local_open` displays text files through `$PAGER`; web URLs appear as links to open manually. + + +After a `code` turn finishes, **Workspace results** summarizes observed file operations, +completed commands, issues, unconfirmed operations, and unfinished plan steps. It uses +recorded tool results, not the agent's prose. A completed command is not a claim that tests +passed. Failed attempts remain visible even after a successful retry; partial or missing +results are marked unconfirmed. Each group shows up to six entries, with the rest available +in the tool results above. diff --git a/apps/tui/src/app.tsx b/apps/tui/src/app.tsx index 60f93f15..0109dac8 100644 --- a/apps/tui/src/app.tsx +++ b/apps/tui/src/app.tsx @@ -891,6 +891,7 @@ export function App({ ; + workspaceResults: boolean; }) { const segments = interleaveTurn(turn.content, turn.tools, turn.reasoning as ReasoningBlock[]); // Only the tail of a live turn is still being written. An earlier segment was @@ -529,6 +532,9 @@ function AssistantTurn({ pending ) : null} + {workspaceResults && !live && !turn.runStatus ? ( + + ) : null} {turn.usage ? ( {' '} @@ -589,6 +595,7 @@ function UserTurn({ turn, theme, branch }: { turn: Turn; theme: Theme; branch?: export function Transcript({ turns, streaming = false, + showWorkspaceResults = false, scrollRef, theme, greeting, @@ -596,6 +603,7 @@ export function Transcript({ }: { turns: Turn[]; streaming?: boolean; + showWorkspaceResults?: boolean; /** * Handed to `App` so the page keys can drive the box without taking focus * from the composer. The alternative — focusing the scrollbox so its own @@ -662,6 +670,7 @@ export function Transcript({ live={streaming && turn.id === turns[turns.length - 1]?.id} theme={theme} handles={handles} + workspaceResults={showWorkspaceResults} /> ), )} diff --git a/apps/tui/src/ui/workspace-summary.tsx b/apps/tui/src/ui/workspace-summary.tsx new file mode 100644 index 00000000..dc57950d --- /dev/null +++ b/apps/tui/src/ui/workspace-summary.tsx @@ -0,0 +1,53 @@ +import type { Turn } from '@felix/client'; +import { useMemo } from 'react'; +import { oneLine } from '../text.js'; +import { BOLD, DIM, type Theme } from '../theme.js'; +import { summarizeWorkspace } from '../workspace-summary.js'; + +export function WorkspaceResults({ turn, theme }: { turn: Turn; theme: Theme }) { + const summary = useMemo(() => summarizeWorkspace(turn), [turn]); + if (!summary) return null; + const groups = [ + ['File operations', summary.files, theme.ready], + ['Commands completed', summary.commands, theme.ready], + ['Issues', summary.issues, theme.failed], + ['Unconfirmed operations', summary.unconfirmed, theme.blocked], + ['Plan steps remaining', summary.remaining, theme.blocked], + ] as const; + const outcome = summary.issues.length + ? theme.failed + : summary.unconfirmed.length || summary.remaining.length + ? theme.blocked + : theme.ready; + return ( + + + Workspace results + + {groups.map(([label, entries, color]) => + entries.length ? ( + + {`${label}: ${entries.length}`} + + {entries + .slice(0, 6) + .map((entry) => ` ${oneLine(entry, 160)}`) + .join('\n')} + + {entries.length > 6 ? ( + {` … ${entries.length - 6} more; see tool results above`} + ) : null} + + ) : null, + )} + + ); +} diff --git a/apps/tui/src/workspace-summary.ts b/apps/tui/src/workspace-summary.ts new file mode 100644 index 00000000..d5db1e07 --- /dev/null +++ b/apps/tui/src/workspace-summary.ts @@ -0,0 +1,59 @@ +import { classifyToolResult, fileToolOp, plansInTurn, type Turn } from '@felix/client'; + +export interface WorkspaceSummary { + files: string[]; + commands: string[]; + issues: string[]; + unconfirmed: string[]; + remaining: string[]; +} + +/** Observed tool outcomes only: prose is never evidence that a check passed. */ +export function summarizeWorkspace(turn: Turn): WorkspaceSummary | null { + const summary: WorkspaceSummary = { + files: [], + commands: [], + issues: [], + unconfirmed: [], + remaining: [], + }; + let relevant = false; + for (const tool of turn.tools ?? []) { + const name = tool.name.replace(/^client · /, ''); + const op = fileToolOp(name); + const mutation = op === 'write' || op === 'edit' || op === 'delete' || op === 'rename'; + if (!mutation && name !== 'local_shell') continue; + relevant = true; + const args = + tool.input && typeof tool.input === 'object' ? (tool.input as Record) : {}; + const path = typeof args.path === 'string' ? args.path : '(path unavailable)'; + const command = typeof args.command === 'string' ? args.command : '(command unavailable)'; + const label = mutation + ? `${op} ${path}${op === 'rename' ? ` → ${typeof args.to_path === 'string' ? args.to_path : '(destination unavailable)'}` : ''}` + : command; + if ( + !tool.done || + typeof tool.output !== 'string' || + !tool.output.trim() || + tool.output.startsWith('[approval required]') + ) { + summary.unconfirmed.push(label); + continue; + } + // Local tools historically returned plain error text. Treat it conservatively + // even for shell calls; current clients additionally emit typed error markers. + const issue = + classifyToolResult(name, tool.output) ?? classifyToolResult('local_read', tool.output); + if (issue) summary.issues.push(`${label}: ${issue.label}`); + else if (mutation) summary.files.push(label); + else summary.commands.push(label); + } + if (!relevant) return null; + for (const plan of plansInTurn(turn.tools).latest.values()) { + for (const step of plan.steps) { + if (step.state !== 'done') + summary.remaining.push(`${step.title}${step.note ? ` · ${step.note}` : ''}`); + } + } + return summary; +} diff --git a/apps/tui/tests/transcript.test.ts b/apps/tui/tests/transcript.test.ts index 1892b2c8..27b9370e 100644 --- a/apps/tui/tests/transcript.test.ts +++ b/apps/tui/tests/transcript.test.ts @@ -3,6 +3,7 @@ import type { Turn } from '@felix/client'; import { createTextAttributes, type ScrollBoxRenderable } from '@opentui/core'; import { createElement } from 'react'; import { spinnerTicking, Transcript } from '../src/ui/transcript'; +import { WorkspaceResults } from '../src/ui/workspace-summary'; import { hasAttribute, lines, mount, shows, styleOf, testTheme } from './render'; /** @@ -33,6 +34,78 @@ const user = (content: string): Turn => ({ content, }); +describe('workspace result summary', () => { + it('integrates the summary for a completed coding turn', async () => { + const turn: Turn = { + id: 'work', + role: 'assistant', + content: '', + tools: [{ name: 'local_edit', input: { path: 'a.ts' }, output: 'edited', done: true }], + }; + const ui = await mount( + createElement(Transcript, { turns: [turn], showWorkspaceResults: true, theme: testTheme }), + { width: 60, height: 16 }, + ); + try { + expect(shows(ui.frame(), 'Workspace results')).toBe(true); + } finally { + ui.stop(); + } + }); + + it('shows observed operations and failures in a narrow terminal', async () => { + const turn: Turn = { + id: 'work', + role: 'assistant', + content: '', + tools: [ + { name: 'local_edit', input: { path: 'src/api.ts' }, output: 'edited', done: true }, + { + name: 'local_shell', + input: { command: 'npm test' }, + output: '[tool error/provider_error] exit 1', + done: true, + }, + ], + }; + const ui = await mount(createElement(WorkspaceResults, { turn, theme: testTheme }), { + width: 38, + height: 14, + }); + try { + expect(shows(ui.frame(), 'Workspace results')).toBe(true); + expect(shows(ui.frame(), 'File operations: 1')).toBe(true); + expect(shows(ui.frame(), 'Issues: 1')).toBe(true); + expect(ui.frame()).not.toContain('Commands completed'); + } finally { + ui.stop(); + } + }); + + it('waits until streaming finishes before displaying a summary', async () => { + const turn: Turn = { + id: 'work', + role: 'assistant', + content: '', + tools: [{ name: 'local_edit', input: { path: 'a.ts' }, output: 'edited', done: true }], + }; + const ui = await mount( + createElement(Transcript, { + turns: [turn], + streaming: true, + showWorkspaceResults: true, + theme: testTheme, + }), + { width: 60, height: 12 }, + ); + try { + expect(ui.frame()).not.toContain('Workspace results'); + } finally { + ui.stop(); + } + }); +}); + describe('the greeting', () => { const greeting = createElement('text', null, 'GREETING MARKER'); diff --git a/apps/tui/tests/workspace-summary.test.ts b/apps/tui/tests/workspace-summary.test.ts new file mode 100644 index 00000000..b222dc91 --- /dev/null +++ b/apps/tui/tests/workspace-summary.test.ts @@ -0,0 +1,94 @@ +import { describe, expect, it } from 'bun:test'; +import type { ToolCall, Turn } from '@felix/client'; +import { summarizeWorkspace } from '../src/workspace-summary'; + +const turn = (...tools: ToolCall[]): Turn => ({ + id: 'summary', + role: 'assistant', + content: 'All tests passed!', + tools, +}); +const call = (name: string, output: unknown, input: unknown = {}): ToolCall => ({ + name, + output, + input, + done: true, +}); + +describe('workspace results', () => { + it('does not count a pending approval as a completed write', () => { + const summary = summarizeWorkspace( + turn(call('local_write', '[approval required] request pending', { path: 'a.ts' })), + ); + expect(summary?.files).toEqual([]); + expect(summary?.unconfirmed).toEqual(['write a.ts']); + }); + + it('does not derive successful checks from model prose or read-only tools', () => { + expect(summarizeWorkspace(turn())).toBeNull(); + expect(summarizeWorkspace(turn(call('local_read', 'content', { path: 'file.ts' })))).toBeNull(); + }); + + it('separates observed mutations from commands, and includes rename destinations', () => { + const summary = summarizeWorkspace( + turn( + call('client · local_edit', '{"replacements":1}', { path: 'src/a.ts' }), + call('local_rename', '{"path":"a","to_path":"b"}', { path: 'a', to_path: 'b' }), + call('local_shell', '12 tests passed', { command: 'npm test' }), + ), + ); + expect(summary?.files).toEqual(['edit src/a.ts', 'rename a → b']); + expect(summary?.commands).toEqual(['npm test']); + }); + + it('never counts failures, denied calls or missing results as completed operations', () => { + const summary = summarizeWorkspace( + turn( + call('local_edit', 'error: file changed', { path: 'a.ts' }), + call('local_shell', '[tool error/provider_error] command exited with code 1', { + command: 'npm test', + }), + call('local_write', '[plan mode] local_write can change things', { path: 'b.ts' }), + call('local_shell', undefined, { command: 'npm run build' }), + { ...call('local_delete', undefined, { path: 'old.ts' }), done: false }, + ), + ); + expect(summary?.files).toEqual([]); + expect(summary?.commands).toEqual([]); + expect(summary?.issues).toHaveLength(3); + expect(summary?.unconfirmed).toEqual(['npm run build', 'delete old.ts']); + }); + + it('keeps failed attempts visible when a later retry succeeds', () => { + const summary = summarizeWorkspace( + turn( + call('local_shell', 'error: unsupported command', { command: 'npm test' }), + call('local_shell', 'passed', { command: 'npm test' }), + ), + ); + expect(summary?.commands).toEqual(['npm test']); + expect(summary?.issues).toHaveLength(1); + }); + + it('uses the latest observed plan state and retains blocked steps', () => { + const plan = (status: string) => + JSON.stringify({ + id: 'p', + plan: { + title: 'Build', + steps: [ + { id: '1', title: 'Implement', status }, + { id: '2', title: 'Verify', status: 'blocked', note: 'missing credentials' }, + ], + }, + }); + const summary = summarizeWorkspace( + turn( + call('plan_create', plan('pending')), + call('local_edit', 'edited', { path: 'a.ts' }), + call('plan_update_step', plan('done')), + ), + ); + expect(summary?.remaining).toEqual(['Verify · missing credentials']); + }); +}); From 9f42861707a36f7f8efe8a9c77c8a16d6eb45ebe Mon Sep 17 00:00:00 2001 From: Blake Bauman Date: Sat, 14 Nov 2026 14:54:18 -0700 Subject: [PATCH 3/8] feat(tui): report coding work across continuation turns --- apps/docs/src/content/guide/terminal.mdx | 8 +++ apps/tui/src/commands.ts | 9 +++ apps/tui/src/work-report.ts | 58 +++++++++++++++++++ apps/tui/tests/skill-commands.test.ts | 20 +++++++ apps/tui/tests/work-report.test.ts | 74 ++++++++++++++++++++++++ 5 files changed, 169 insertions(+) create mode 100644 apps/tui/src/work-report.ts create mode 100644 apps/tui/tests/work-report.test.ts diff --git a/apps/docs/src/content/guide/terminal.mdx b/apps/docs/src/content/guide/terminal.mdx index 4d116f2e..689cc105 100644 --- a/apps/docs/src/content/guide/terminal.mdx +++ b/apps/docs/src/content/guide/terminal.mdx @@ -457,3 +457,11 @@ recorded tool results, not the agent's prose. A completed command is not a claim passed. Failed attempts remain visible even after a successful retry; partial or missing results are marked unconfirmed. Each group shows up to six entries, with the rest available in the tool results above. + +Use `/work` to open a coding report for the loaded thread history in `$PAGER`. It +combines operations and command attempts across turns and uses the latest recorded +state of each plan. Failed attempts remain visible after successful retries; only the +latest unfinished plan steps are listed. The report makes no model call, runs no +command against the project, and changes no project file. The pager uses a private +temporary report file. It reports loaded history rather +than fetching a fresh Git diff or checking the current workspace. diff --git a/apps/tui/src/commands.ts b/apps/tui/src/commands.ts index 0d74af60..da5e1899 100644 --- a/apps/tui/src/commands.ts +++ b/apps/tui/src/commands.ts @@ -38,6 +38,7 @@ import { BINDINGS } from './keys.js'; import { skillReport, skillsOverview } from './skill-report.js'; import { oneLine } from './text.js'; import type { ThreadStore } from './threads.js'; +import { workReport } from './work-report.js'; const THINKING: ThinkingLevel[] = ['off', 'minimal', 'low', 'medium', 'high', 'xhigh', 'max']; @@ -64,6 +65,7 @@ const COMMANDS: ReadonlyArray<[label: string, commands: string]> = [ ['agent', '/manifest [name] /start '], ['history', '/rewind [n] /version /search /open '], ['$PAGER', '/artifact [file] · /skills /skill (read-only)'], + ['coding', '/work · recorded operations and latest plan (read-only)'], ['client', '/refresh the thread list · /quit'], ]; @@ -163,6 +165,13 @@ export function runCommand(ctx: CommandContext, line: string): void { const [name, ...rest] = line.slice(1).split(/\s+/); const arg = rest.join(' ').trim(); switch (name) { + case 'work': + if (arg) { + setNotice('usage: /work'); + return; + } + ctx.show(workReport(engine.state.turns, threadIdRef.current), 'Coding work'); + return; case 'new': newThread(); return; diff --git a/apps/tui/src/work-report.ts b/apps/tui/src/work-report.ts new file mode 100644 index 00000000..2a43d1e3 --- /dev/null +++ b/apps/tui/src/work-report.ts @@ -0,0 +1,58 @@ +import { type PlanState, plansInTurn, type Turn } from '@felix/client'; +import { oneLine } from './text.js'; +import { summarizeWorkspace } from './workspace-summary.js'; + +const MAX_ROWS = 200; + +/** A local report from loaded history; no model, repository command, or file write. */ +export function workReport(turns: readonly Turn[], threadId: string): string { + const files: string[] = []; + const commands: string[] = []; + const issues: string[] = []; + const unconfirmed: string[] = []; + const plans = new Map(); + for (const turn of turns) { + if (turn.role !== 'assistant') continue; + const summary = summarizeWorkspace(turn); + if (summary) { + files.push(...summary.files); + commands.push(...summary.commands); + issues.push(...summary.issues); + unconfirmed.push(...summary.unconfirmed); + } + for (const [id, plan] of plansInTurn(turn.tools).latest) plans.set(id, plan); + } + // Tool arguments and instruction-derived titles are data, including control bytes. + // biome-ignore lint/suspicious/noControlCharactersInRegex: Strip terminal control bytes from tool-derived labels. + const line = (text: string) => oneLine(text.replace(/[\u0000-\u001f\u007f-\u009f]/g, ' '), 400); + const lines = [ + 'Coding work · loaded thread history', + `Thread: ${line(threadId)}`, + '', + 'Recorded operations, not a live Git diff. Completed commands do not establish that tests passed.', + 'Failed or refused attempts remain in history even when a later retry succeeds.', + ]; + const section = (title: string, entries: string[]) => { + lines.push('', `${title} (${entries.length})`); + lines.push(...entries.slice(0, MAX_ROWS).map((entry) => ` ${line(entry)}`)); + if (!entries.length) lines.push(' None recorded.'); + if (entries.length > MAX_ROWS) + lines.push(` … ${entries.length - MAX_ROWS} more; see the transcript.`); + }; + section('File operations', files); + section('Commands completed', commands); + section('Failed or refused attempts', issues); + section('Unconfirmed operations', unconfirmed); + const remaining: string[] = []; + for (const plan of plans.values()) { + for (const step of plan.steps) { + if (step.state !== 'done') + remaining.push( + `${plan.title}: ${step.title} [${step.status}]${step.note ? ` · ${step.note}` : ''}`, + ); + } + } + section('Unfinished steps in latest recorded plans', remaining); + if (!plans.size) lines.push(' No saved plan was observed in loaded history.'); + return lines.join('\n'); +} diff --git a/apps/tui/tests/skill-commands.test.ts b/apps/tui/tests/skill-commands.test.ts index cef35511..d3bd7a64 100644 --- a/apps/tui/tests/skill-commands.test.ts +++ b/apps/tui/tests/skill-commands.test.ts @@ -85,6 +85,26 @@ function context(client: Partial, spills: Spill[] = []) { const settle = () => new Promise((r) => setTimeout(r, 0)); +describe('/work', () => { + it('opens a local report without contacting the harness or writing a project file', () => { + const { ctx, shown, written } = context({}); + Object.assign(ctx.engine, { state: { turns: [] } }); + runCommand(ctx, '/work'); + expect(shown).toHaveLength(1); + expect(shown[0]?.name).toBe('Coding work'); + expect(shown[0]?.body).toContain('Thread: t1'); + expect(written.size).toBe(0); + }); + + it('rejects arguments instead of treating them as an export path', () => { + const { ctx, shown, notices, written } = context({}); + runCommand(ctx, '/work output.txt'); + expect(notices).toContain('usage: /work'); + expect(shown).toEqual([]); + expect(written.size).toBe(0); + }); +}); + describe('/skills', () => { it('pages the review queue and the skills in use', async () => { const t = context({ diff --git a/apps/tui/tests/work-report.test.ts b/apps/tui/tests/work-report.test.ts new file mode 100644 index 00000000..1320e84c --- /dev/null +++ b/apps/tui/tests/work-report.test.ts @@ -0,0 +1,74 @@ +import { describe, expect, it } from 'bun:test'; +import type { ToolCall, Turn } from '@felix/client'; +import { workReport } from '../src/work-report'; + +const turn = (...tools: ToolCall[]): Turn => ({ + id: crypto.randomUUID(), + role: 'assistant', + content: 'Tests passed!', + tools, +}); +const tool = (name: string, output: unknown, input: unknown = {}): ToolCall => ({ + name, + output, + input, + done: true, +}); +const plan = (status: string) => + tool( + 'plan_get', + JSON.stringify({ + id: 'build', + plan: { + title: 'Ship fix', + steps: [ + { id: '1', title: 'Implement', status }, + { id: '2', title: 'Verify', status: 'blocked', note: 'missing dependency' }, + ], + }, + }), + ); + +describe('work report', () => { + it('combines tool history and the latest plan across continuation turns', () => { + const report = workReport( + [ + turn(plan('pending'), tool('local_edit', 'edited', { path: 'src/a.ts' })), + turn(tool('local_shell', '[tool error/provider_error] exit 1', { command: 'npm test' })), + turn(plan('done'), tool('local_shell', 'passed', { command: 'npm test' })), + ], + 'coding-thread', + ); + expect(report).toContain('File operations (1)'); + expect(report).toContain('Commands completed (1)'); + expect(report).toContain('Failed or refused attempts (1)'); + expect(report).toContain('Unfinished steps in latest recorded plans (1)'); + expect(report).toContain('Ship fix: Verify [blocked] · missing dependency'); + expect(report).not.toContain('Ship fix: Implement'); + }); + + it('does not infer checks from prose, user content or absent results', () => { + const report = workReport( + [ + { id: 'u', role: 'user', content: 'run tests' }, + turn(), + turn(tool('local_shell', undefined, { command: 'npm test' })), + ], + 't', + ); + expect(report).toContain('Commands completed (0)'); + expect(report).toContain('Unconfirmed operations (1)'); + expect(report).toContain('No saved plan was observed'); + }); + + it('bounds large histories and neutralizes terminal control characters', () => { + const tools = Array.from({ length: 205 }, (_, i) => + tool('local_write', 'wrote', { path: `file-${i}.ts` }), + ); + const report = workReport([turn(...tools)], 't\u001b[31m'); + expect(report).toContain('File operations (205)'); + expect(report).toContain('5 more; see the transcript'); + expect(report).not.toContain('\u001b'); + expect(report).not.toContain('file-204.ts'); + }); +}); From 2e16ff42d100edec15b990852a616ca86ea2fbb5 Mon Sep 17 00:00:00 2001 From: Blake Bauman Date: Sat, 14 Nov 2026 15:54:06 -0700 Subject: [PATCH 4/8] refactor(web): rename browser app and organize source modules Rename apps/chat-ui to apps/web and @felix/chat-ui to @felix/web. Update workspace scripts, CI, tooling, docs, and the terminal secrets lookup. Group app setup, API code, styles, and feature logic into dedicated folders. Keep the deployed Cloudflare Worker name. Validation: web production build and 1,676 tests pass; Tailwind, API drift, protocol parity, payload shapes, palette, and bundle budget checks pass. --- .claude/README.md | 4 +- .claude/agents/code-quality-reviewer.md | 4 +- .claude/agents/code-reviewer.md | 2 +- .claude/agents/dx-engineer.md | 2 +- .claude/agents/felix-docs-writer.md | 2 +- .claude/agents/python-harness-engineer.md | 4 +- .claude/agents/refactor-engineer.md | 4 +- .claude/agents/security-reviewer.md | 2 +- .claude/agents/test-engineer.md | 6 +- .claude/agents/ui-engineer.md | 16 ++--- .claude/agents/workers-engineer.md | 6 +- .claude/hooks/failure-hint.sh | 2 +- .claude/hooks/impact-reminder.sh | 14 ++-- .claude/hooks/session-start.sh | 2 +- .claude/hooks/stop-gate.sh | 2 +- .claude/rules/docs-terminology.md | 2 +- .claude/rules/protocol-parity.md | 14 ++-- .claude/settings.json | 12 ++-- .claude/skills/add-ui-primitive/SKILL.md | 6 +- .claude/skills/api-contract-change/SKILL.md | 12 ++-- .../references/wire-protocol.md | 4 +- .claude/skills/branch-pr-workflow/SKILL.md | 2 +- .../code-quality/references/dimensions.md | 10 +-- .claude/skills/deploy-runbook/SKILL.md | 8 +-- .claude/skills/preflight/SKILL.md | 10 +-- .claude/skills/python-harness/SKILL.md | 4 +- .../threat-review/references/checklist.md | 8 +-- .claude/skills/toolkit-authoring/SKILL.md | 2 +- .github/workflows/ci.yml | 2 +- .github/workflows/deploy.yml | 6 +- .gitignore | 4 +- .../2026-08-23T22-38-55Z__apps-chat-ui-src.md | 4 +- ...rc-components-chat-multimodal-input-tsx.md | 2 +- ...-src-components-inspector-inspector-tsx.md | 12 ++-- ...i-src-main-tsx-toaster-toast-call-sites.md | 2 +- ...i-src-main-tsx-toaster-toast-call-sites.md | 2 +- .../2026-09-26T14-01-32Z__apps-chat-ui-src.md | 2 +- .../2026-09-26T16-06-16Z__apps-chat-ui-src.md | 2 +- .../2026-09-27T14-05-51Z__apps-chat-ui-src.md | 2 +- .impeccable/design.json | 2 +- CLAUDE.md | 64 +++++++++--------- DESIGN.md | 4 +- README.md | 8 +-- SECURITY.md | 4 +- apps/docs/.impeccable/design.json | 2 +- apps/docs/.impeccable/surfaces/src.md | 2 +- apps/docs/DESIGN.md | 2 +- apps/docs/astro.config.mjs | 2 +- apps/docs/scripts/fetch-api-spec.mjs | 2 +- apps/docs/src/components/RouteIndex.astro | 2 +- .../src/content/guide/getting-started.mdx | 2 +- apps/docs/src/content/guide/terminal.mdx | 2 +- apps/tui/CLAUDE.md | 2 +- apps/tui/README.md | 2 +- apps/tui/src/config.ts | 8 +-- apps/{chat-ui => web}/.dev.vars.example | 2 +- apps/{chat-ui => web}/.gitignore | 0 .../.impeccable/surfaces/src-app-tsx.md | 6 +- apps/{chat-ui => web}/CLAUDE.md | 48 ++++++------- apps/{chat-ui => web}/README.md | 40 ++++++++--- apps/{chat-ui => web}/components.json | 2 +- apps/{chat-ui => web}/harness-openapi.json | 0 apps/{chat-ui => web}/index.html | 2 +- apps/{chat-ui => web}/package.json | 2 +- apps/{chat-ui => web}/public/_headers | 0 .../public/apple-touch-icon.png | Bin apps/{chat-ui => web}/public/favicon.ico | Bin apps/{chat-ui => web}/public/favicon.svg | 0 apps/{chat-ui => web}/public/icon-192.png | Bin apps/{chat-ui => web}/public/icon-512.png | Bin .../public/icon-maskable-512.png | Bin apps/{chat-ui => web}/public/site.webmanifest | 0 apps/{chat-ui => web}/public/sw.js | 0 .../src/api.ts => web/src/api/client.ts} | 4 +- apps/{chat-ui/src => web/src/api}/types.ts | 0 .../src => web/src/app}/app-shell.tsx | 56 +++++++-------- .../src/App.tsx => web/src/app/app.tsx} | 6 +- .../src => web/src/app}/shell-context.ts | 4 +- .../src/components/account-chip.tsx | 8 +-- .../src/components/agent-select.tsx | 2 +- .../src/components/agent/agent-sheet.tsx | 6 +- .../src/components/ai-elements/context.tsx | 0 .../src/components/ai-elements/controls.tsx | 0 .../src/components/ai-elements/file-tree.tsx | 0 .../components/ai-elements/prompt-input.tsx | 2 +- .../src/components/app-sidebar.tsx | 8 +-- .../components/approval/approval-decision.tsx | 0 .../src/components/attention-line.tsx | 8 +-- .../src/components/auth/auth-card.tsx | 0 .../src/components/auth/auth-layout.tsx | 0 .../src/components/auth/github-sign-in.tsx | 2 +- .../src/components/auth/google-sign-in.tsx | 0 .../src/components/auth/last-used-badge.tsx | 0 .../src/components/brand-mark.tsx | 0 .../src/components/chat/approval-banner.tsx | 2 +- .../src/components/chat/context-meter.tsx | 2 +- .../src/components/chat/conversation.tsx | 4 +- .../src/components/chat/denial-context.ts | 4 +- .../src/components/chat/denials-sync.tsx | 6 +- .../src/components/chat/greeting.tsx | 10 +-- .../src/components/chat/icons.tsx | 0 .../src/components/chat/install-hint.tsx | 0 .../src/components/chat/message-actions.tsx | 0 .../src/components/chat/message.tsx | 6 +- .../src/components/chat/multimodal-input.tsx | 4 +- .../src/components/chat/plan-card.tsx | 0 .../src/components/chat/push-hint.tsx | 0 .../src/components/chat/queued-messages.tsx | 0 .../src/components/chat/rate-turn.tsx | 2 +- .../src/components/chat/reasoning.tsx | 0 .../components/chat/reply-changes-line.tsx | 0 .../src/components/chat/response.tsx | 4 +- .../components/chat/rewind-files-dialog.tsx | 0 .../src/components/chat/run-status.tsx | 2 +- .../src/components/chat/side-answer.tsx | 2 +- .../src/components/chat/slash-commands.tsx | 0 .../src/components/chat/stack-trace.tsx | 0 .../src/components/chat/start-from-item.tsx | 4 +- .../src/components/chat/starter-prompts.tsx | 2 +- .../src/components/chat/subagent-calls.tsx | 2 +- .../src/components/chat/thread-list.tsx | 10 +-- .../src/components/chat/tool-run.tsx | 4 +- .../src/components/chat/tool-sources.tsx | 0 .../src/components/chat/tool-table.tsx | 0 .../src/components/chat/tool.tsx | 10 +-- .../src/components/chat/turn-checkpoint.tsx | 0 .../src/components/chat/turn-debug.tsx | 2 +- .../src/components/chat/ui-prompt-banner.tsx | 2 +- .../src/components/chat/watching-banner.tsx | 0 .../src/components/confirm-button.tsx | 0 .../src/components/cut-id.tsx | 0 .../src/components/error-boundary.tsx | 0 .../src/components/error-notice.tsx | 0 .../src/components/eval/eval-sheet.tsx | 4 +- apps/{chat-ui => web}/src/components/gate.tsx | 8 +-- .../src/components/harness-health-line.tsx | 2 +- .../components/harness/activity-ledger.tsx | 12 ++-- .../src/components/harness/activity.tsx | 6 +- .../components/harness/agent-heartbeat.tsx | 6 +- .../src/components/harness/agent-skills.tsx | 6 +- .../src/components/harness/connections.tsx | 4 +- .../src/components/harness/documents.tsx | 6 +- .../src/components/harness/github.tsx | 8 +-- .../src/components/harness/harness-agent.tsx | 2 +- .../src/components/harness/memory.tsx | 6 +- .../src/components/harness/panel.tsx | 0 .../src/components/harness/skills.tsx | 0 .../src/components/highlighted-code.tsx | 0 .../components/inspector/debug-section.tsx | 4 +- .../src/components/inspector/inspector.tsx | 8 +-- .../src/components/inspector/plan-editor.tsx | 2 +- .../src/components/inspector/primitives.tsx | 4 +- .../src/components/jobs/job-create-form.tsx | 6 +- .../src/components/jobs/job-details.tsx | 4 +- .../src/components/jobs/jobs-sheet.tsx | 14 ++-- .../src/components/jobs/repeat-job-dialog.tsx | 4 +- .../components/manifests/manifests-sheet.tsx | 4 +- .../src/components/needs-you-band.tsx | 10 +-- .../src/components/pane/edit-notice.ts | 2 +- .../src/components/pane/file-actions.tsx | 0 .../src/components/pane/file-view.tsx | 14 ++-- .../src/components/pane/files-view.tsx | 14 ++-- .../src/components/pane/pane-divider.tsx | 0 .../src/components/pane/pane-parts.tsx | 0 .../src/components/pane/pane-zone.tsx | 2 +- .../src/components/pane/save-to-workspace.tsx | 4 +- .../src/components/pane/side-pane.tsx | 4 +- .../src/components/pane/use-pane-layout.ts | 0 .../src/components/rail-presence.tsx | 0 .../src/components/skills/asset-preview.tsx | 0 .../src/components/skills/bundle-changes.tsx | 0 .../src/components/skills/bundle-compare.ts | 0 .../src/components/skills/bundle-paths.ts | 0 .../src/components/skills/code-editor.tsx | 0 .../src/components/skills/diff-view.tsx | 2 +- .../src/components/skills/edit-panel.tsx | 2 +- .../src/components/skills/evals-panel.tsx | 0 .../src/components/skills/feedback-panel.tsx | 0 .../src/components/skills/file-tree.tsx | 0 .../components/skills/frontmatter-card.tsx | 0 .../components/skills/frontmatter-form.tsx | 0 .../components/skills/frontmatter-lines.ts | 0 .../src/components/skills/gate-line.tsx | 0 .../src/components/skills/highlight.ts | 0 .../src/components/skills/library-list.tsx | 0 .../components/skills/open-skill-editor.ts | 4 +- .../src/components/skills/policy-form.tsx | 0 .../src/components/skills/preview-pane.tsx | 0 .../src/components/skills/promote-button.tsx | 0 .../src/components/skills/queries.ts | 2 +- .../src/components/skills/query-root.tsx | 2 +- .../src/components/skills/refusal.tsx | 0 .../src/components/skills/review-panel.tsx | 0 .../src/components/skills/review-queue.tsx | 0 .../src/components/skills/save-dialog.tsx | 0 .../src/components/skills/score-readout.tsx | 0 .../skills/skill-bundle-browser.tsx | 0 .../components/skills/skill-bundle-editor.tsx | 0 .../src/components/skills/skill-import.tsx | 4 +- .../src/components/skills/skill-library.tsx | 4 +- .../src/components/skills/skill-markdown.tsx | 0 .../src/components/skills/skill-page.tsx | 0 .../src/components/skills/skill-pane-view.tsx | 2 +- .../components/skills/skill-proposal-card.tsx | 2 +- .../src/components/skills/skill-status.tsx | 0 .../src/components/skills/skill-tabs.ts | 0 .../src/components/skills/skills-address.ts | 0 .../src/components/skills/use-skill-bundle.ts | 0 .../src/components/skills/use-skill-editor.ts | 4 +- .../components/skills/validation-panel.tsx | 0 .../src/components/skills/version-actions.tsx | 0 .../src/components/skills/version-diff.tsx | 0 .../src/components/skills/version-picker.tsx | 0 .../src/components/skills/versions-panel.tsx | 0 .../src/components/theme-provider.tsx | 0 .../src/components/thread-title.tsx | 2 +- .../src/components/toaster.tsx | 0 .../src/components/why-disabled.tsx | 0 .../src/components/workflows/authorship.tsx | 0 .../src/components/workflows/run-now-form.tsx | 4 +- .../src/components/workflows/step-node.tsx | 4 +- .../components/workflows/step-transcript.tsx | 4 +- .../workflows/use-workflow-draft.ts | 6 +- .../components/workflows/use-workflow-run.ts | 4 +- .../components/workflows/workflow-canvas.tsx | 6 +- .../components/workflows/workflow-editor.tsx | 8 +-- .../workflows/workflow-inspector.tsx | 6 +- .../components/workflows/workflows-page.tsx | 12 ++-- .../src/components/workspace/changes-list.tsx | 4 +- .../components/workspace/file-row-menu.tsx | 0 .../components/workspace/folder-action.tsx | 10 +-- .../components/workspace/harness-files.tsx | 8 +-- .../src/components/workspace/repo-files.tsx | 4 +- .../src/components/workspace/thread-repo.tsx | 8 +-- .../workspace/workspace-section.tsx | 10 +-- .../src/hooks/use-drawable-url.ts | 2 +- .../{chat-ui => web}/src/hooks/use-elapsed.ts | 0 .../src/hooks/use-message-queue.ts | 2 +- .../src/hooks/use-pending-approvals.ts | 6 +- apps/{chat-ui => web}/src/hooks/use-rails.ts | 0 .../src/hooks/use-recent-audit.ts | 8 +-- .../src/hooks/use-shortcuts.ts | 2 +- .../src/hooks/use-speech-recognition.ts | 0 .../src/hooks/use-visual-viewport.ts | 0 .../src/hooks/useMediaQuery.ts | 0 apps/{chat-ui => web}/src/hooks/usePoll.ts | 2 +- .../src/hooks/useSharedPoll.ts | 2 +- .../src/lib => web/src/lib/auth}/auth.ts | 2 +- .../src/lib/auth}/connect-return.ts | 0 .../lib => web/src/lib/auth}/github-login.ts | 2 +- .../src/lib/conversation}/ai-types.ts | 2 +- .../src/lib/conversation}/call-target.ts | 0 .../src/lib/conversation}/continue-run.ts | 2 +- .../src/lib/conversation}/denials.ts | 0 .../src/lib/conversation}/durable-runs.ts | 0 .../src/lib/conversation}/engine-pool.ts | 0 .../src/lib/conversation}/frame-store.ts | 0 .../src/lib/conversation}/image-upload.ts | 2 +- .../lib => web/src/lib/conversation}/leave.ts | 6 +- .../src/lib/conversation}/ledger.ts | 4 +- .../src/lib/conversation}/needs-you.ts | 6 +- .../conversation}/pending-approvals-read.ts | 2 +- .../src/lib/conversation}/presence.ts | 0 .../src/lib/conversation}/resume.ts | 0 .../src/lib/conversation}/session-lease.ts | 0 .../src/lib/conversation}/skill-calls.ts | 0 .../src/lib/conversation}/tab-thread.ts | 0 .../src/lib/conversation}/thread-index.ts | 0 .../src/lib/conversation}/threads.ts | 4 +- .../src/lib/conversation}/tool-run.ts | 0 apps/{chat-ui => web}/src/lib/error-toast.tsx | 0 apps/{chat-ui => web}/src/lib/format.ts | 0 .../src/lib/harness}/audit-outcome.ts | 0 .../lib => web/src/lib/harness}/connection.ts | 0 .../src/lib/harness}/harness-glances.ts | 6 +- .../src/lib/harness}/harness-health.ts | 0 .../src/lib/harness}/identity-state.ts | 0 .../lib => web/src/lib/harness}/job-origin.ts | 2 +- .../src/lib/harness}/job-schedule.ts | 0 .../lib => web/src/lib/harness}/manifests.ts | 0 .../src/lib/harness}/opened-identity.ts | 0 .../src/lib/markdown}/rehype-omitted.ts | 0 .../src/lib/markdown}/reply-plugins.ts | 0 .../src/lib/navigation}/shortcuts.ts | 0 .../src/lib/navigation}/side-pane.ts | 0 .../src/lib/navigation}/view-change.ts | 0 apps/{chat-ui => web}/src/lib/platform.ts | 0 apps/{chat-ui => web}/src/lib/push.ts | 4 +- .../src/lib/service-worker.ts | 0 apps/{chat-ui => web}/src/lib/utils.ts | 0 .../src/lib/workflows}/workflow-draft.ts | 4 +- .../src/lib/workflows}/workflow-layout.ts | 2 +- .../lib => web/src/lib/workspace}/changes.ts | 0 .../lib => web/src/lib/workspace}/cowork.ts | 2 +- .../src/lib => web/src/lib/workspace}/diff.ts | 0 .../src/lib/workspace}/file-preview.ts | 0 .../src/lib/workspace}/file-tree.ts | 0 .../src/lib/workspace}/mount-state.ts | 4 +- .../src/lib/workspace}/save-text.ts | 0 .../src/lib/workspace}/workspace-events.ts | 0 .../src/lib/workspace}/workspace-tools.ts | 2 +- apps/{chat-ui => web}/src/main.tsx | 4 +- .../src/routes/harness-pages.tsx | 2 +- apps/{chat-ui => web}/src/routes/harness.tsx | 14 ++-- .../{chat-ui => web}/src/routes/workbench.tsx | 12 ++-- .../src => web/src/styles}/chat-utilities.css | 0 .../{chat-ui/src => web/src/styles}/index.css | 6 +- .../tests/activity-ledger.test.tsx | 6 +- .../tests/agent-heartbeat.test.tsx | 2 +- .../tests/agent-skills.test.tsx | 6 +- .../tests/agent-work.test.tsx | 4 +- .../tests/ai-elements.test.tsx | 0 .../tests/app-stream.test.tsx | 4 +- .../tests/approval-decision.test.tsx | 0 .../{chat-ui => web}/tests/artifacts.test.tsx | 10 +-- .../tests/attention-line.test.tsx | 2 +- apps/{chat-ui => web}/tests/audit.test.ts | 2 +- .../tests/blocked-route.test.tsx | 4 +- .../tests/code-editor.test.tsx | 0 .../tests/composer-controls.test.tsx | 2 +- apps/{chat-ui => web}/tests/composer.test.tsx | 2 +- .../tests/confirm-button.test.tsx | 0 .../{chat-ui => web}/tests/connection.test.ts | 2 +- .../tests/connections-page.test.tsx | 4 +- .../tests/context-meter.test.tsx | 2 +- .../tests/continue-run.test.tsx | 6 +- .../tests/conversation.test.tsx | 4 +- .../tests/debug-mode.test.tsx | 6 +- .../tests/delete-thread.test.tsx | 4 +- apps/{chat-ui => web}/tests/denials.test.ts | 4 +- .../{chat-ui => web}/tests/diff-view.test.tsx | 2 +- .../{chat-ui => web}/tests/docs-links.test.ts | 0 .../tests/durable-rejoin.test.tsx | 4 +- .../tests/edit-message.test.tsx | 2 +- .../tests/error-notice.test.tsx | 0 .../tests/error-toast.test.tsx | 0 .../tests/eval-run-link.test.tsx | 2 +- .../tests/eval-sheet.test.tsx | 6 +- apps/{chat-ui => web}/tests/file-tree.test.ts | 2 +- .../tests/files-auto-open.test.tsx | 4 +- .../tests/finished-turns-memo.test.tsx | 2 +- .../tests/frame-store.test.ts | 2 +- apps/{chat-ui => web}/tests/gate.test.tsx | 2 +- .../tests/github-app.test.tsx | 2 +- .../tests/github-login.test.tsx | 2 +- .../tests/google-login.test.tsx | 2 +- apps/{chat-ui => web}/tests/greeting.test.tsx | 16 ++--- .../tests/harness-health.test.tsx | 8 +-- .../tests/harness-route.test.tsx | 6 +- .../tests/harness-workspace-pane.test.tsx | 10 +-- apps/{chat-ui => web}/tests/headers.test.ts | 0 .../tests/identity-switch.test.tsx | 16 ++--- .../tests/image-upload.test.tsx | 2 +- .../tests/inspector-run.test.tsx | 2 +- .../tests/install-hint.test.tsx | 0 .../tests/job-schedule.test.ts | 2 +- .../tests/jobs-sheet.test.tsx | 6 +- .../tests/kept-message.test.tsx | 0 .../tests/kept-rows-workbenches.test.tsx | 6 +- apps/{chat-ui => web}/tests/lease-server.ts | 0 .../tests/management-verbs.test.tsx | 24 +++---- .../tests/manifest-save-warnings.test.tsx | 2 +- .../tests/manifest-version-log.test.tsx | 2 +- .../tests/manifests-canary.test.tsx | 2 +- .../tests/manifests-import.test.tsx | 2 +- .../tests/memory-page.test.tsx | 12 ++-- apps/{chat-ui => web}/tests/memory.test.ts | 4 +- .../tests/message-actions.test.tsx | 0 apps/{chat-ui => web}/tests/message.test.tsx | 4 +- .../tests/nav-glances.test.ts | 6 +- apps/{chat-ui => web}/tests/needs-you.test.ts | 4 +- .../tests/one-reply-label.test.tsx | 2 +- .../tests/open-file-pane.test.tsx | 4 +- .../tests/output-styles.test.tsx | 2 +- .../tests/page-empty.test.tsx | 0 .../tests/pending-approvals-read.test.ts | 2 +- .../{chat-ui => web}/tests/plan-card.test.tsx | 2 +- .../tests/plan-editor.test.tsx | 2 +- apps/{chat-ui => web}/tests/plans.test.ts | 2 +- apps/{chat-ui => web}/tests/presence.test.ts | 2 +- apps/{chat-ui => web}/tests/push.test.tsx | 4 +- .../tests/queued-messages.test.tsx | 2 +- .../tests/rail-presence.test.tsx | 0 .../tests/refused-send-cache.test.tsx | 2 +- .../tests/repeat-job.test.tsx | 2 +- .../tests/reply-changes.test.tsx | 8 +-- apps/{chat-ui => web}/tests/resend.test.tsx | 4 +- apps/{chat-ui => web}/tests/response.test.tsx | 10 +-- apps/{chat-ui => web}/tests/resume.test.tsx | 4 +- .../tests/rewind-files.test.tsx | 2 +- apps/{chat-ui => web}/tests/routing.test.tsx | 8 +-- .../tests/run-survives-thread-switch.test.tsx | 12 ++-- .../tests/runnable-commands.test.ts | 0 .../tests/select-family.test.tsx | 0 .../send-keeps-out-of-band-turns.test.tsx | 8 +-- .../tests/session-lease-keeper.test.ts | 2 +- .../tests/session-lease-watch.test.tsx | 4 +- .../tests/session-lease.test.tsx | 2 +- apps/{chat-ui => web}/tests/setup.ts | 8 +-- .../tests/sheets-legibility.test.tsx | 4 +- .../tests/shell-pick.test.tsx | 2 +- .../{chat-ui => web}/tests/shortcuts.test.tsx | 4 +- .../{chat-ui => web}/tests/side-pane.test.tsx | 12 ++-- .../tests/side-question.test.tsx | 2 +- .../tests/skill-admin-personal.test.tsx | 0 .../tests/skill-editor-pane.test.tsx | 2 +- .../tests/skill-editor-pure.test.ts | 0 .../{chat-ui => web}/tests/skill-fixtures.tsx | 4 +- .../tests/skill-import.test.tsx | 0 .../tests/skill-library-actions.test.tsx | 2 +- .../tests/skill-library-list.test.tsx | 0 .../tests/skill-library-page.test.tsx | 0 .../tests/skill-new-form.test.tsx | 0 .../tests/skill-origins.test.tsx | 0 .../tests/skill-personal-library.test.tsx | 0 .../tests/skill-proposal-card.test.tsx | 2 +- .../tests/skill-quality-ui.test.tsx | 2 +- .../tests/skill-save-conflict.test.tsx | 2 +- .../tests/skill-untrusted-content.test.tsx | 0 apps/{chat-ui => web}/tests/sse.test.ts | 2 +- .../tests/stack-trace.test.tsx | 0 .../tests/startup-reads.test.tsx | 4 +- apps/{chat-ui => web}/tests/sw.test.ts | 0 .../tests/theme-provider.test.tsx | 0 .../tests/thread-agent.test.tsx | 4 +- .../tests/thread-list.test.tsx | 4 +- .../tests/thread-title.test.tsx | 4 +- apps/{chat-ui => web}/tests/threads.test.ts | 2 +- .../{chat-ui => web}/tests/tool-card.test.tsx | 2 +- .../tests/tool-images.test.tsx | 2 +- apps/{chat-ui => web}/tests/tool-run.test.tsx | 4 +- .../tests/tool-table.test.tsx | 2 +- .../tests/touch-affordances.test.tsx | 2 +- .../tests/touch-viewport.test.tsx | 0 .../tests/trace-code-block.test.tsx | 0 .../tests/turn-checkpoint.test.tsx | 2 +- .../tests/turn-feedback.test.tsx | 2 +- .../tests/turn-labels.test.tsx | 6 +- .../tests/turns-cache.test.ts | 4 +- .../tests/ui-prompt-banner.test.tsx | 2 +- .../tests/usage-cost.test.tsx | 0 apps/{chat-ui => web}/tests/use-poll.test.tsx | 0 .../{chat-ui => web}/tests/use-rails.test.tsx | 0 .../tests/use-shared-poll.test.tsx | 0 .../tests/use-skill-bundle.test.tsx | 0 .../tests/use-speech-recognition.test.tsx | 0 .../tests/workbench-layout.test.tsx | 6 +- apps/{chat-ui => web}/tests/worker.test.ts | 0 .../tests/workflow-authorship.test.ts | 0 .../tests/workflow-draft.test.ts | 6 +- .../tests/workflow-layout.test.ts | 4 +- .../tests/workflows-page.test.tsx | 28 ++++---- .../tests/workspace-changes.test.tsx | 6 +- .../tests/workspace-header.test.tsx | 16 ++--- apps/{chat-ui => web}/tsconfig.json | 0 apps/{chat-ui => web}/vite.config.ts | 8 +-- apps/{chat-ui => web}/vitest.config.ts | 0 apps/{chat-ui => web}/worker/index.ts | 0 apps/{chat-ui => web}/wrangler.jsonc | 0 biome.json | 4 +- package.json | 12 ++-- packages/design/scripts/sync-brand.ts | 2 +- packages/design/src/mark.ts | 2 +- packages/design/src/tokens.ts | 4 +- packages/felix-client/src/management/index.ts | 2 +- .../felix-client/tests/management.test.ts | 2 +- packages/ui/components.json | 2 +- pnpm-lock.yaml | 2 +- scripts/check-api-drift.mjs | 6 +- scripts/check-bundle-budget.mjs | 8 +-- scripts/check-payload-shapes.mjs | 8 +-- scripts/check-state-palette.mjs | 4 +- scripts/check-tailwind-sources.mjs | 4 +- scripts/sync-harness-contract.mjs | 4 +- tsconfig.json | 4 +- 475 files changed, 813 insertions(+), 789 deletions(-) rename apps/{chat-ui => web}/.dev.vars.example (68%) rename apps/{chat-ui => web}/.gitignore (100%) rename apps/{chat-ui => web}/.impeccable/surfaces/src-app-tsx.md (98%) rename apps/{chat-ui => web}/CLAUDE.md (97%) rename apps/{chat-ui => web}/README.md (86%) rename apps/{chat-ui => web}/components.json (91%) rename apps/{chat-ui => web}/harness-openapi.json (100%) rename apps/{chat-ui => web}/index.html (97%) rename apps/{chat-ui => web}/package.json (98%) rename apps/{chat-ui => web}/public/_headers (100%) rename apps/{chat-ui => web}/public/apple-touch-icon.png (100%) rename apps/{chat-ui => web}/public/favicon.ico (100%) rename apps/{chat-ui => web}/public/favicon.svg (100%) rename apps/{chat-ui => web}/public/icon-192.png (100%) rename apps/{chat-ui => web}/public/icon-512.png (100%) rename apps/{chat-ui => web}/public/icon-maskable-512.png (100%) rename apps/{chat-ui => web}/public/site.webmanifest (100%) rename apps/{chat-ui => web}/public/sw.js (100%) rename apps/{chat-ui/src/api.ts => web/src/api/client.ts} (99%) rename apps/{chat-ui/src => web/src/api}/types.ts (100%) rename apps/{chat-ui/src => web/src/app}/app-shell.tsx (99%) rename apps/{chat-ui/src/App.tsx => web/src/app/app.tsx} (96%) rename apps/{chat-ui/src => web/src/app}/shell-context.ts (99%) rename apps/{chat-ui => web}/src/components/account-chip.tsx (98%) rename apps/{chat-ui => web}/src/components/agent-select.tsx (98%) rename apps/{chat-ui => web}/src/components/agent/agent-sheet.tsx (99%) rename apps/{chat-ui => web}/src/components/ai-elements/context.tsx (100%) rename apps/{chat-ui => web}/src/components/ai-elements/controls.tsx (100%) rename apps/{chat-ui => web}/src/components/ai-elements/file-tree.tsx (100%) rename apps/{chat-ui => web}/src/components/ai-elements/prompt-input.tsx (99%) rename apps/{chat-ui => web}/src/components/app-sidebar.tsx (99%) rename apps/{chat-ui => web}/src/components/approval/approval-decision.tsx (100%) rename apps/{chat-ui => web}/src/components/attention-line.tsx (99%) rename apps/{chat-ui => web}/src/components/auth/auth-card.tsx (100%) rename apps/{chat-ui => web}/src/components/auth/auth-layout.tsx (100%) rename apps/{chat-ui => web}/src/components/auth/github-sign-in.tsx (99%) rename apps/{chat-ui => web}/src/components/auth/google-sign-in.tsx (100%) rename apps/{chat-ui => web}/src/components/auth/last-used-badge.tsx (100%) rename apps/{chat-ui => web}/src/components/brand-mark.tsx (100%) rename apps/{chat-ui => web}/src/components/chat/approval-banner.tsx (97%) rename apps/{chat-ui => web}/src/components/chat/context-meter.tsx (99%) rename apps/{chat-ui => web}/src/components/chat/conversation.tsx (99%) rename apps/{chat-ui => web}/src/components/chat/denial-context.ts (93%) rename apps/{chat-ui => web}/src/components/chat/denials-sync.tsx (95%) rename apps/{chat-ui => web}/src/components/chat/greeting.tsx (96%) rename apps/{chat-ui => web}/src/components/chat/icons.tsx (100%) rename apps/{chat-ui => web}/src/components/chat/install-hint.tsx (100%) rename apps/{chat-ui => web}/src/components/chat/message-actions.tsx (100%) rename apps/{chat-ui => web}/src/components/chat/message.tsx (99%) rename apps/{chat-ui => web}/src/components/chat/multimodal-input.tsx (99%) rename apps/{chat-ui => web}/src/components/chat/plan-card.tsx (100%) rename apps/{chat-ui => web}/src/components/chat/push-hint.tsx (100%) rename apps/{chat-ui => web}/src/components/chat/queued-messages.tsx (100%) rename apps/{chat-ui => web}/src/components/chat/rate-turn.tsx (99%) rename apps/{chat-ui => web}/src/components/chat/reasoning.tsx (100%) rename apps/{chat-ui => web}/src/components/chat/reply-changes-line.tsx (100%) rename apps/{chat-ui => web}/src/components/chat/response.tsx (99%) rename apps/{chat-ui => web}/src/components/chat/rewind-files-dialog.tsx (100%) rename apps/{chat-ui => web}/src/components/chat/run-status.tsx (98%) rename apps/{chat-ui => web}/src/components/chat/side-answer.tsx (97%) rename apps/{chat-ui => web}/src/components/chat/slash-commands.tsx (100%) rename apps/{chat-ui => web}/src/components/chat/stack-trace.tsx (100%) rename apps/{chat-ui => web}/src/components/chat/start-from-item.tsx (98%) rename apps/{chat-ui => web}/src/components/chat/starter-prompts.tsx (98%) rename apps/{chat-ui => web}/src/components/chat/subagent-calls.tsx (98%) rename apps/{chat-ui => web}/src/components/chat/thread-list.tsx (99%) rename apps/{chat-ui => web}/src/components/chat/tool-run.tsx (94%) rename apps/{chat-ui => web}/src/components/chat/tool-sources.tsx (100%) rename apps/{chat-ui => web}/src/components/chat/tool-table.tsx (100%) rename apps/{chat-ui => web}/src/components/chat/tool.tsx (99%) rename apps/{chat-ui => web}/src/components/chat/turn-checkpoint.tsx (100%) rename apps/{chat-ui => web}/src/components/chat/turn-debug.tsx (98%) rename apps/{chat-ui => web}/src/components/chat/ui-prompt-banner.tsx (99%) rename apps/{chat-ui => web}/src/components/chat/watching-banner.tsx (100%) rename apps/{chat-ui => web}/src/components/confirm-button.tsx (100%) rename apps/{chat-ui => web}/src/components/cut-id.tsx (100%) rename apps/{chat-ui => web}/src/components/error-boundary.tsx (100%) rename apps/{chat-ui => web}/src/components/error-notice.tsx (100%) rename apps/{chat-ui => web}/src/components/eval/eval-sheet.tsx (99%) rename apps/{chat-ui => web}/src/components/gate.tsx (98%) rename apps/{chat-ui => web}/src/components/harness-health-line.tsx (98%) rename apps/{chat-ui => web}/src/components/harness/activity-ledger.tsx (99%) rename apps/{chat-ui => web}/src/components/harness/activity.tsx (99%) rename apps/{chat-ui => web}/src/components/harness/agent-heartbeat.tsx (98%) rename apps/{chat-ui => web}/src/components/harness/agent-skills.tsx (98%) rename apps/{chat-ui => web}/src/components/harness/connections.tsx (99%) rename apps/{chat-ui => web}/src/components/harness/documents.tsx (99%) rename apps/{chat-ui => web}/src/components/harness/github.tsx (99%) rename apps/{chat-ui => web}/src/components/harness/harness-agent.tsx (98%) rename apps/{chat-ui => web}/src/components/harness/memory.tsx (99%) rename apps/{chat-ui => web}/src/components/harness/panel.tsx (100%) rename apps/{chat-ui => web}/src/components/harness/skills.tsx (100%) rename apps/{chat-ui => web}/src/components/highlighted-code.tsx (100%) rename apps/{chat-ui => web}/src/components/inspector/debug-section.tsx (99%) rename apps/{chat-ui => web}/src/components/inspector/inspector.tsx (99%) rename apps/{chat-ui => web}/src/components/inspector/plan-editor.tsx (99%) rename apps/{chat-ui => web}/src/components/inspector/primitives.tsx (99%) rename apps/{chat-ui => web}/src/components/jobs/job-create-form.tsx (99%) rename apps/{chat-ui => web}/src/components/jobs/job-details.tsx (99%) rename apps/{chat-ui => web}/src/components/jobs/jobs-sheet.tsx (99%) rename apps/{chat-ui => web}/src/components/jobs/repeat-job-dialog.tsx (96%) rename apps/{chat-ui => web}/src/components/manifests/manifests-sheet.tsx (99%) rename apps/{chat-ui => web}/src/components/needs-you-band.tsx (97%) rename apps/{chat-ui => web}/src/components/pane/edit-notice.ts (97%) rename apps/{chat-ui => web}/src/components/pane/file-actions.tsx (100%) rename apps/{chat-ui => web}/src/components/pane/file-view.tsx (98%) rename apps/{chat-ui => web}/src/components/pane/files-view.tsx (97%) rename apps/{chat-ui => web}/src/components/pane/pane-divider.tsx (100%) rename apps/{chat-ui => web}/src/components/pane/pane-parts.tsx (100%) rename apps/{chat-ui => web}/src/components/pane/pane-zone.tsx (98%) rename apps/{chat-ui => web}/src/components/pane/save-to-workspace.tsx (98%) rename apps/{chat-ui => web}/src/components/pane/side-pane.tsx (99%) rename apps/{chat-ui => web}/src/components/pane/use-pane-layout.ts (100%) rename apps/{chat-ui => web}/src/components/rail-presence.tsx (100%) rename apps/{chat-ui => web}/src/components/skills/asset-preview.tsx (100%) rename apps/{chat-ui => web}/src/components/skills/bundle-changes.tsx (100%) rename apps/{chat-ui => web}/src/components/skills/bundle-compare.ts (100%) rename apps/{chat-ui => web}/src/components/skills/bundle-paths.ts (100%) rename apps/{chat-ui => web}/src/components/skills/code-editor.tsx (100%) rename apps/{chat-ui => web}/src/components/skills/diff-view.tsx (98%) rename apps/{chat-ui => web}/src/components/skills/edit-panel.tsx (99%) rename apps/{chat-ui => web}/src/components/skills/evals-panel.tsx (100%) rename apps/{chat-ui => web}/src/components/skills/feedback-panel.tsx (100%) rename apps/{chat-ui => web}/src/components/skills/file-tree.tsx (100%) rename apps/{chat-ui => web}/src/components/skills/frontmatter-card.tsx (100%) rename apps/{chat-ui => web}/src/components/skills/frontmatter-form.tsx (100%) rename apps/{chat-ui => web}/src/components/skills/frontmatter-lines.ts (100%) rename apps/{chat-ui => web}/src/components/skills/gate-line.tsx (100%) rename apps/{chat-ui => web}/src/components/skills/highlight.ts (100%) rename apps/{chat-ui => web}/src/components/skills/library-list.tsx (100%) rename apps/{chat-ui => web}/src/components/skills/open-skill-editor.ts (92%) rename apps/{chat-ui => web}/src/components/skills/policy-form.tsx (100%) rename apps/{chat-ui => web}/src/components/skills/preview-pane.tsx (100%) rename apps/{chat-ui => web}/src/components/skills/promote-button.tsx (100%) rename apps/{chat-ui => web}/src/components/skills/queries.ts (99%) rename apps/{chat-ui => web}/src/components/skills/query-root.tsx (99%) rename apps/{chat-ui => web}/src/components/skills/refusal.tsx (100%) rename apps/{chat-ui => web}/src/components/skills/review-panel.tsx (100%) rename apps/{chat-ui => web}/src/components/skills/review-queue.tsx (100%) rename apps/{chat-ui => web}/src/components/skills/save-dialog.tsx (100%) rename apps/{chat-ui => web}/src/components/skills/score-readout.tsx (100%) rename apps/{chat-ui => web}/src/components/skills/skill-bundle-browser.tsx (100%) rename apps/{chat-ui => web}/src/components/skills/skill-bundle-editor.tsx (100%) rename apps/{chat-ui => web}/src/components/skills/skill-import.tsx (99%) rename apps/{chat-ui => web}/src/components/skills/skill-library.tsx (99%) rename apps/{chat-ui => web}/src/components/skills/skill-markdown.tsx (100%) rename apps/{chat-ui => web}/src/components/skills/skill-page.tsx (100%) rename apps/{chat-ui => web}/src/components/skills/skill-pane-view.tsx (97%) rename apps/{chat-ui => web}/src/components/skills/skill-proposal-card.tsx (99%) rename apps/{chat-ui => web}/src/components/skills/skill-status.tsx (100%) rename apps/{chat-ui => web}/src/components/skills/skill-tabs.ts (100%) rename apps/{chat-ui => web}/src/components/skills/skills-address.ts (100%) rename apps/{chat-ui => web}/src/components/skills/use-skill-bundle.ts (100%) rename apps/{chat-ui => web}/src/components/skills/use-skill-editor.ts (98%) rename apps/{chat-ui => web}/src/components/skills/validation-panel.tsx (100%) rename apps/{chat-ui => web}/src/components/skills/version-actions.tsx (100%) rename apps/{chat-ui => web}/src/components/skills/version-diff.tsx (100%) rename apps/{chat-ui => web}/src/components/skills/version-picker.tsx (100%) rename apps/{chat-ui => web}/src/components/skills/versions-panel.tsx (100%) rename apps/{chat-ui => web}/src/components/theme-provider.tsx (100%) rename apps/{chat-ui => web}/src/components/thread-title.tsx (99%) rename apps/{chat-ui => web}/src/components/toaster.tsx (100%) rename apps/{chat-ui => web}/src/components/why-disabled.tsx (100%) rename apps/{chat-ui => web}/src/components/workflows/authorship.tsx (100%) rename apps/{chat-ui => web}/src/components/workflows/run-now-form.tsx (98%) rename apps/{chat-ui => web}/src/components/workflows/step-node.tsx (99%) rename apps/{chat-ui => web}/src/components/workflows/step-transcript.tsx (97%) rename apps/{chat-ui => web}/src/components/workflows/use-workflow-draft.ts (98%) rename apps/{chat-ui => web}/src/components/workflows/use-workflow-run.ts (98%) rename apps/{chat-ui => web}/src/components/workflows/workflow-canvas.tsx (99%) rename apps/{chat-ui => web}/src/components/workflows/workflow-editor.tsx (99%) rename apps/{chat-ui => web}/src/components/workflows/workflow-inspector.tsx (99%) rename apps/{chat-ui => web}/src/components/workflows/workflows-page.tsx (99%) rename apps/{chat-ui => web}/src/components/workspace/changes-list.tsx (99%) rename apps/{chat-ui => web}/src/components/workspace/file-row-menu.tsx (100%) rename apps/{chat-ui => web}/src/components/workspace/folder-action.tsx (97%) rename apps/{chat-ui => web}/src/components/workspace/harness-files.tsx (96%) rename apps/{chat-ui => web}/src/components/workspace/repo-files.tsx (97%) rename apps/{chat-ui => web}/src/components/workspace/thread-repo.tsx (98%) rename apps/{chat-ui => web}/src/components/workspace/workspace-section.tsx (96%) rename apps/{chat-ui => web}/src/hooks/use-drawable-url.ts (94%) rename apps/{chat-ui => web}/src/hooks/use-elapsed.ts (100%) rename apps/{chat-ui => web}/src/hooks/use-message-queue.ts (98%) rename apps/{chat-ui => web}/src/hooks/use-pending-approvals.ts (98%) rename apps/{chat-ui => web}/src/hooks/use-rails.ts (100%) rename apps/{chat-ui => web}/src/hooks/use-recent-audit.ts (94%) rename apps/{chat-ui => web}/src/hooks/use-shortcuts.ts (97%) rename apps/{chat-ui => web}/src/hooks/use-speech-recognition.ts (100%) rename apps/{chat-ui => web}/src/hooks/use-visual-viewport.ts (100%) rename apps/{chat-ui => web}/src/hooks/useMediaQuery.ts (100%) rename apps/{chat-ui => web}/src/hooks/usePoll.ts (99%) rename apps/{chat-ui => web}/src/hooks/useSharedPoll.ts (99%) rename apps/{chat-ui/src/lib => web/src/lib/auth}/auth.ts (99%) rename apps/{chat-ui/src/lib => web/src/lib/auth}/connect-return.ts (100%) rename apps/{chat-ui/src/lib => web/src/lib/auth}/github-login.ts (99%) rename apps/{chat-ui/src/lib => web/src/lib/conversation}/ai-types.ts (86%) rename apps/{chat-ui/src/lib => web/src/lib/conversation}/call-target.ts (100%) rename apps/{chat-ui/src/lib => web/src/lib/conversation}/continue-run.ts (97%) rename apps/{chat-ui/src/lib => web/src/lib/conversation}/denials.ts (100%) rename apps/{chat-ui/src/lib => web/src/lib/conversation}/durable-runs.ts (100%) rename apps/{chat-ui/src/lib => web/src/lib/conversation}/engine-pool.ts (100%) rename apps/{chat-ui/src/lib => web/src/lib/conversation}/frame-store.ts (100%) rename apps/{chat-ui/src/lib => web/src/lib/conversation}/image-upload.ts (99%) rename apps/{chat-ui/src/lib => web/src/lib/conversation}/leave.ts (92%) rename apps/{chat-ui/src/lib => web/src/lib/conversation}/ledger.ts (99%) rename apps/{chat-ui/src/lib => web/src/lib/conversation}/needs-you.ts (96%) rename apps/{chat-ui/src/lib => web/src/lib/conversation}/pending-approvals-read.ts (96%) rename apps/{chat-ui/src/lib => web/src/lib/conversation}/presence.ts (100%) rename apps/{chat-ui/src/lib => web/src/lib/conversation}/resume.ts (100%) rename apps/{chat-ui/src/lib => web/src/lib/conversation}/session-lease.ts (100%) rename apps/{chat-ui/src/lib => web/src/lib/conversation}/skill-calls.ts (100%) rename apps/{chat-ui/src/lib => web/src/lib/conversation}/tab-thread.ts (100%) rename apps/{chat-ui/src/lib => web/src/lib/conversation}/thread-index.ts (100%) rename apps/{chat-ui/src/lib => web/src/lib/conversation}/threads.ts (99%) rename apps/{chat-ui/src/lib => web/src/lib/conversation}/tool-run.ts (100%) rename apps/{chat-ui => web}/src/lib/error-toast.tsx (100%) rename apps/{chat-ui => web}/src/lib/format.ts (100%) rename apps/{chat-ui/src/lib => web/src/lib/harness}/audit-outcome.ts (100%) rename apps/{chat-ui/src/lib => web/src/lib/harness}/connection.ts (100%) rename apps/{chat-ui/src/lib => web/src/lib/harness}/harness-glances.ts (99%) rename apps/{chat-ui/src/lib => web/src/lib/harness}/harness-health.ts (100%) rename apps/{chat-ui/src/lib => web/src/lib/harness}/identity-state.ts (100%) rename apps/{chat-ui/src/lib => web/src/lib/harness}/job-origin.ts (98%) rename apps/{chat-ui/src/lib => web/src/lib/harness}/job-schedule.ts (100%) rename apps/{chat-ui/src/lib => web/src/lib/harness}/manifests.ts (100%) rename apps/{chat-ui/src/lib => web/src/lib/harness}/opened-identity.ts (100%) rename apps/{chat-ui/src/lib => web/src/lib/markdown}/rehype-omitted.ts (100%) rename apps/{chat-ui/src/lib => web/src/lib/markdown}/reply-plugins.ts (100%) rename apps/{chat-ui/src/lib => web/src/lib/navigation}/shortcuts.ts (100%) rename apps/{chat-ui/src/lib => web/src/lib/navigation}/side-pane.ts (100%) rename apps/{chat-ui/src/lib => web/src/lib/navigation}/view-change.ts (100%) rename apps/{chat-ui => web}/src/lib/platform.ts (100%) rename apps/{chat-ui => web}/src/lib/push.ts (99%) rename apps/{chat-ui => web}/src/lib/service-worker.ts (100%) rename apps/{chat-ui => web}/src/lib/utils.ts (100%) rename apps/{chat-ui/src/lib => web/src/lib/workflows}/workflow-draft.ts (99%) rename apps/{chat-ui/src/lib => web/src/lib/workflows}/workflow-layout.ts (99%) rename apps/{chat-ui/src/lib => web/src/lib/workspace}/changes.ts (100%) rename apps/{chat-ui/src/lib => web/src/lib/workspace}/cowork.ts (98%) rename apps/{chat-ui/src/lib => web/src/lib/workspace}/diff.ts (100%) rename apps/{chat-ui/src/lib => web/src/lib/workspace}/file-preview.ts (100%) rename apps/{chat-ui/src/lib => web/src/lib/workspace}/file-tree.ts (100%) rename apps/{chat-ui/src/lib => web/src/lib/workspace}/mount-state.ts (96%) rename apps/{chat-ui/src/lib => web/src/lib/workspace}/save-text.ts (100%) rename apps/{chat-ui/src/lib => web/src/lib/workspace}/workspace-events.ts (100%) rename apps/{chat-ui/src/lib => web/src/lib/workspace}/workspace-tools.ts (96%) rename apps/{chat-ui => web}/src/main.tsx (96%) rename apps/{chat-ui => web}/src/routes/harness-pages.tsx (99%) rename apps/{chat-ui => web}/src/routes/harness.tsx (98%) rename apps/{chat-ui => web}/src/routes/workbench.tsx (98%) rename apps/{chat-ui/src => web/src/styles}/chat-utilities.css (100%) rename apps/{chat-ui/src => web/src/styles}/index.css (99%) rename apps/{chat-ui => web}/tests/activity-ledger.test.tsx (99%) rename apps/{chat-ui => web}/tests/agent-heartbeat.test.tsx (99%) rename apps/{chat-ui => web}/tests/agent-skills.test.tsx (96%) rename apps/{chat-ui => web}/tests/agent-work.test.tsx (99%) rename apps/{chat-ui => web}/tests/ai-elements.test.tsx (100%) rename apps/{chat-ui => web}/tests/app-stream.test.tsx (99%) rename apps/{chat-ui => web}/tests/approval-decision.test.tsx (100%) rename apps/{chat-ui => web}/tests/artifacts.test.tsx (95%) rename apps/{chat-ui => web}/tests/attention-line.test.tsx (99%) rename apps/{chat-ui => web}/tests/audit.test.ts (98%) rename apps/{chat-ui => web}/tests/blocked-route.test.tsx (97%) rename apps/{chat-ui => web}/tests/code-editor.test.tsx (100%) rename apps/{chat-ui => web}/tests/composer-controls.test.tsx (99%) rename apps/{chat-ui => web}/tests/composer.test.tsx (99%) rename apps/{chat-ui => web}/tests/confirm-button.test.tsx (100%) rename apps/{chat-ui => web}/tests/connection.test.ts (98%) rename apps/{chat-ui => web}/tests/connections-page.test.tsx (98%) rename apps/{chat-ui => web}/tests/context-meter.test.tsx (98%) rename apps/{chat-ui => web}/tests/continue-run.test.tsx (97%) rename apps/{chat-ui => web}/tests/conversation.test.tsx (97%) rename apps/{chat-ui => web}/tests/debug-mode.test.tsx (98%) rename apps/{chat-ui => web}/tests/delete-thread.test.tsx (98%) rename apps/{chat-ui => web}/tests/denials.test.ts (98%) rename apps/{chat-ui => web}/tests/diff-view.test.tsx (99%) rename apps/{chat-ui => web}/tests/docs-links.test.ts (100%) rename apps/{chat-ui => web}/tests/durable-rejoin.test.tsx (97%) rename apps/{chat-ui => web}/tests/edit-message.test.tsx (99%) rename apps/{chat-ui => web}/tests/error-notice.test.tsx (100%) rename apps/{chat-ui => web}/tests/error-toast.test.tsx (100%) rename apps/{chat-ui => web}/tests/eval-run-link.test.tsx (99%) rename apps/{chat-ui => web}/tests/eval-sheet.test.tsx (99%) rename apps/{chat-ui => web}/tests/file-tree.test.ts (94%) rename apps/{chat-ui => web}/tests/files-auto-open.test.tsx (98%) rename apps/{chat-ui => web}/tests/finished-turns-memo.test.tsx (99%) rename apps/{chat-ui => web}/tests/frame-store.test.ts (98%) rename apps/{chat-ui => web}/tests/gate.test.tsx (99%) rename apps/{chat-ui => web}/tests/github-app.test.tsx (99%) rename apps/{chat-ui => web}/tests/github-login.test.tsx (99%) rename apps/{chat-ui => web}/tests/google-login.test.tsx (99%) rename apps/{chat-ui => web}/tests/greeting.test.tsx (96%) rename apps/{chat-ui => web}/tests/harness-health.test.tsx (98%) rename apps/{chat-ui => web}/tests/harness-route.test.tsx (99%) rename apps/{chat-ui => web}/tests/harness-workspace-pane.test.tsx (98%) rename apps/{chat-ui => web}/tests/headers.test.ts (100%) rename apps/{chat-ui => web}/tests/identity-switch.test.tsx (96%) rename apps/{chat-ui => web}/tests/image-upload.test.tsx (99%) rename apps/{chat-ui => web}/tests/inspector-run.test.tsx (99%) rename apps/{chat-ui => web}/tests/install-hint.test.tsx (100%) rename apps/{chat-ui => web}/tests/job-schedule.test.ts (99%) rename apps/{chat-ui => web}/tests/jobs-sheet.test.tsx (99%) rename apps/{chat-ui => web}/tests/kept-message.test.tsx (100%) rename apps/{chat-ui => web}/tests/kept-rows-workbenches.test.tsx (97%) rename apps/{chat-ui => web}/tests/lease-server.ts (100%) rename apps/{chat-ui => web}/tests/management-verbs.test.tsx (91%) rename apps/{chat-ui => web}/tests/manifest-save-warnings.test.tsx (99%) rename apps/{chat-ui => web}/tests/manifest-version-log.test.tsx (98%) rename apps/{chat-ui => web}/tests/manifests-canary.test.tsx (98%) rename apps/{chat-ui => web}/tests/manifests-import.test.tsx (99%) rename apps/{chat-ui => web}/tests/memory-page.test.tsx (98%) rename apps/{chat-ui => web}/tests/memory.test.ts (98%) rename apps/{chat-ui => web}/tests/message-actions.test.tsx (100%) rename apps/{chat-ui => web}/tests/message.test.tsx (99%) rename apps/{chat-ui => web}/tests/nav-glances.test.ts (99%) rename apps/{chat-ui => web}/tests/needs-you.test.ts (97%) rename apps/{chat-ui => web}/tests/one-reply-label.test.tsx (99%) rename apps/{chat-ui => web}/tests/open-file-pane.test.tsx (97%) rename apps/{chat-ui => web}/tests/output-styles.test.tsx (99%) rename apps/{chat-ui => web}/tests/page-empty.test.tsx (100%) rename apps/{chat-ui => web}/tests/pending-approvals-read.test.ts (96%) rename apps/{chat-ui => web}/tests/plan-card.test.tsx (98%) rename apps/{chat-ui => web}/tests/plan-editor.test.tsx (98%) rename apps/{chat-ui => web}/tests/plans.test.ts (98%) rename apps/{chat-ui => web}/tests/presence.test.ts (99%) rename apps/{chat-ui => web}/tests/push.test.tsx (99%) rename apps/{chat-ui => web}/tests/queued-messages.test.tsx (99%) rename apps/{chat-ui => web}/tests/rail-presence.test.tsx (100%) rename apps/{chat-ui => web}/tests/refused-send-cache.test.tsx (98%) rename apps/{chat-ui => web}/tests/repeat-job.test.tsx (99%) rename apps/{chat-ui => web}/tests/reply-changes.test.tsx (97%) rename apps/{chat-ui => web}/tests/resend.test.tsx (99%) rename apps/{chat-ui => web}/tests/response.test.tsx (97%) rename apps/{chat-ui => web}/tests/resume.test.tsx (97%) rename apps/{chat-ui => web}/tests/rewind-files.test.tsx (99%) rename apps/{chat-ui => web}/tests/routing.test.tsx (98%) rename apps/{chat-ui => web}/tests/run-survives-thread-switch.test.tsx (97%) rename apps/{chat-ui => web}/tests/runnable-commands.test.ts (100%) rename apps/{chat-ui => web}/tests/select-family.test.tsx (100%) rename apps/{chat-ui => web}/tests/send-keeps-out-of-band-turns.test.tsx (96%) rename apps/{chat-ui => web}/tests/session-lease-keeper.test.ts (99%) rename apps/{chat-ui => web}/tests/session-lease-watch.test.tsx (99%) rename apps/{chat-ui => web}/tests/session-lease.test.tsx (99%) rename apps/{chat-ui => web}/tests/setup.ts (82%) rename apps/{chat-ui => web}/tests/sheets-legibility.test.tsx (99%) rename apps/{chat-ui => web}/tests/shell-pick.test.tsx (98%) rename apps/{chat-ui => web}/tests/shortcuts.test.tsx (99%) rename apps/{chat-ui => web}/tests/side-pane.test.tsx (98%) rename apps/{chat-ui => web}/tests/side-question.test.tsx (99%) rename apps/{chat-ui => web}/tests/skill-admin-personal.test.tsx (100%) rename apps/{chat-ui => web}/tests/skill-editor-pane.test.tsx (97%) rename apps/{chat-ui => web}/tests/skill-editor-pure.test.ts (100%) rename apps/{chat-ui => web}/tests/skill-fixtures.tsx (98%) rename apps/{chat-ui => web}/tests/skill-import.test.tsx (100%) rename apps/{chat-ui => web}/tests/skill-library-actions.test.tsx (99%) rename apps/{chat-ui => web}/tests/skill-library-list.test.tsx (100%) rename apps/{chat-ui => web}/tests/skill-library-page.test.tsx (100%) rename apps/{chat-ui => web}/tests/skill-new-form.test.tsx (100%) rename apps/{chat-ui => web}/tests/skill-origins.test.tsx (100%) rename apps/{chat-ui => web}/tests/skill-personal-library.test.tsx (100%) rename apps/{chat-ui => web}/tests/skill-proposal-card.test.tsx (99%) rename apps/{chat-ui => web}/tests/skill-quality-ui.test.tsx (99%) rename apps/{chat-ui => web}/tests/skill-save-conflict.test.tsx (99%) rename apps/{chat-ui => web}/tests/skill-untrusted-content.test.tsx (100%) rename apps/{chat-ui => web}/tests/sse.test.ts (84%) rename apps/{chat-ui => web}/tests/stack-trace.test.tsx (100%) rename apps/{chat-ui => web}/tests/startup-reads.test.tsx (97%) rename apps/{chat-ui => web}/tests/sw.test.ts (100%) rename apps/{chat-ui => web}/tests/theme-provider.test.tsx (100%) rename apps/{chat-ui => web}/tests/thread-agent.test.tsx (99%) rename apps/{chat-ui => web}/tests/thread-list.test.tsx (99%) rename apps/{chat-ui => web}/tests/thread-title.test.tsx (99%) rename apps/{chat-ui => web}/tests/threads.test.ts (98%) rename apps/{chat-ui => web}/tests/tool-card.test.tsx (99%) rename apps/{chat-ui => web}/tests/tool-images.test.tsx (97%) rename apps/{chat-ui => web}/tests/tool-run.test.tsx (98%) rename apps/{chat-ui => web}/tests/tool-table.test.tsx (98%) rename apps/{chat-ui => web}/tests/touch-affordances.test.tsx (96%) rename apps/{chat-ui => web}/tests/touch-viewport.test.tsx (100%) rename apps/{chat-ui => web}/tests/trace-code-block.test.tsx (100%) rename apps/{chat-ui => web}/tests/turn-checkpoint.test.tsx (97%) rename apps/{chat-ui => web}/tests/turn-feedback.test.tsx (99%) rename apps/{chat-ui => web}/tests/turn-labels.test.tsx (96%) rename apps/{chat-ui => web}/tests/turns-cache.test.ts (95%) rename apps/{chat-ui => web}/tests/ui-prompt-banner.test.tsx (98%) rename apps/{chat-ui => web}/tests/usage-cost.test.tsx (100%) rename apps/{chat-ui => web}/tests/use-poll.test.tsx (100%) rename apps/{chat-ui => web}/tests/use-rails.test.tsx (100%) rename apps/{chat-ui => web}/tests/use-shared-poll.test.tsx (100%) rename apps/{chat-ui => web}/tests/use-skill-bundle.test.tsx (100%) rename apps/{chat-ui => web}/tests/use-speech-recognition.test.tsx (100%) rename apps/{chat-ui => web}/tests/workbench-layout.test.tsx (99%) rename apps/{chat-ui => web}/tests/worker.test.ts (100%) rename apps/{chat-ui => web}/tests/workflow-authorship.test.ts (100%) rename apps/{chat-ui => web}/tests/workflow-draft.test.ts (97%) rename apps/{chat-ui => web}/tests/workflow-layout.test.ts (98%) rename apps/{chat-ui => web}/tests/workflows-page.test.tsx (97%) rename apps/{chat-ui => web}/tests/workspace-changes.test.tsx (99%) rename apps/{chat-ui => web}/tests/workspace-header.test.tsx (94%) rename apps/{chat-ui => web}/tsconfig.json (100%) rename apps/{chat-ui => web}/vite.config.ts (94%) rename apps/{chat-ui => web}/vitest.config.ts (100%) rename apps/{chat-ui => web}/worker/index.ts (100%) rename apps/{chat-ui => web}/wrangler.jsonc (100%) diff --git a/.claude/README.md b/.claude/README.md index 47408e37..eec92b86 100644 --- a/.claude/README.md +++ b/.claude/README.md @@ -11,7 +11,7 @@ Delegated by description; invoke explicitly by name when you want a specific one | Agent | Use it for | |---|---| | `workers-engineer` | The two proxy Workers, wrangler config, the `/api/*` contract, bindings and secrets | -| `ui-engineer` | React/Vite/Tailwind work in `apps/chat-ui`, streaming UI, `@felix/ui` | +| `ui-engineer` | React/Vite/Tailwind work in `apps/web`, streaming UI, `@felix/ui` | | `python-harness-engineer` | Python work on the harness (felix-run/felix); requires that checkout in scope | | `postgres-engineer` | Harness schema, migrations, indexing, query plans, tenant-scoped access | | `devops-engineer` | CI, turbo/pnpm pipeline, wrangler deploys, secrets, release verification | @@ -78,7 +78,7 @@ Hooks fail open — every script exits 0 unless it is deliberately blocking. Tes JSON before wiring it: ```bash -echo '{"tool_input":{"file_path":"'"$PWD"'/apps/chat-ui/src/api.ts"}}' | .claude/hooks/impact-reminder.sh +echo '{"tool_input":{"file_path":"'"$PWD"'/apps/web/src/api/client.ts"}}' | .claude/hooks/impact-reminder.sh ``` **Editing `settings.json` requires a session restart.** Skills, agents, and rules hot-reload. diff --git a/.claude/agents/code-quality-reviewer.md b/.claude/agents/code-quality-reviewer.md index 163006b3..77bc11fb 100644 --- a/.claude/agents/code-quality-reviewer.md +++ b/.claude/agents/code-quality-reviewer.md @@ -46,7 +46,7 @@ The per-dimension checklist with concrete repo targets is in the `code-quality` ## What is deliberate here — do not report it as a defect -- **The proxy contract is stated twice on purpose** — `apps/chat-ui/worker/index.ts` and the `/api` +- **The proxy contract is stated twice on purpose** — `apps/web/worker/index.ts` and the `/api` rewrite in `vite.config.ts` — because one runs in production and the other only in `vite dev` (`.claude/rules/protocol-parity.md`). Divergence between them is a finding; the duplication is not. - **`@felix/protocol` is hand-mirrored** from the Python harness in a separate repo. It looks @@ -54,7 +54,7 @@ The per-dimension checklist with concrete repo targets is in the `code-quality` - **`packages/ui` and `packages/cowork-client` ship raw `.tsx`/`.ts`** with no build step. The double wiring (exports map + tsconfig paths) is the design, not an oversight. - **`apps/docs/src/styles/theme.css` is generated** from `packages/design/src/tokens.ts`. -- **shadcn primitives** under `packages/ui/src` and `apps/chat-ui/src/components` are vendored +- **shadcn primitives** under `packages/ui/src` and `apps/web/src/components` are vendored upstream code with relaxed lint rules. Do not restyle them to match house conventions. ## Calibration diff --git a/.claude/agents/code-reviewer.md b/.claude/agents/code-reviewer.md index 721fcf23..5eb7f480 100644 --- a/.claude/agents/code-reviewer.md +++ b/.claude/agents/code-reviewer.md @@ -20,7 +20,7 @@ pre-existing code unless the diff makes it newly wrong. ## This repo's real failure modes — check these first -1. **Proxy contract divergence.** `apps/chat-ui/worker/index.ts` and the `/api` rewrite in +1. **Proxy contract divergence.** `apps/web/worker/index.ts` and the `/api` rewrite in `vite.config.ts` are two copies of the same contract. A change in one and not the other makes dev and production behave differently, and nothing reports it. 2. **Silently unhandled SSE events.** `StreamEvent` ends in an open `{ event: string; … }` arm, so a diff --git a/.claude/agents/dx-engineer.md b/.claude/agents/dx-engineer.md index ea79a52e..6adc7312 100644 --- a/.claude/agents/dx-engineer.md +++ b/.claude/agents/dx-engineer.md @@ -29,7 +29,7 @@ spec. - Test coverage reaches the VFS, the SSE reader, the proxy Workers, and a first slice of React (thread store, theme provider, `usePoll`, Gate) under happy-dom. The remaining gap is the **chat surface**: the composer and the inspector panels, which need a live harness or a lot of mocking. -- The proxy contract lives in two places — `apps/chat-ui/worker/index.ts` and the `/api` rewrite in +- The proxy contract lives in two places — `apps/web/worker/index.ts` and the `/api` rewrite in `vite.config.ts` — with no mechanical check that they agree; parity is discipline alone. - "Verified" for app code means type-check + lint + build + a manual run against a live harness. Any proposal to add an application test suite is a real change in scope — raise it, don't sneak diff --git a/.claude/agents/felix-docs-writer.md b/.claude/agents/felix-docs-writer.md index 4f09c480..90b271dd 100644 --- a/.claude/agents/felix-docs-writer.md +++ b/.claude/agents/felix-docs-writer.md @@ -23,7 +23,7 @@ current Python layout** of felix-run/felix. Do not "clean up" a reference to the You may edit files under `apps/docs/src/content/` (MDX), `CLAUDE.md`, and `.claude/skills/*/SKILL.md` / `.claude/agents/*.md` when they describe docs workflow. Never -change runtime behavior in `apps/chat-ui` unless the prompt explicitly asks. Never deploy. +change runtime behavior in `apps/web` unless the prompt explicitly asks. Never deploy. ## Scope of truth diff --git a/.claude/agents/python-harness-engineer.md b/.claude/agents/python-harness-engineer.md index f1146079..67b0e1ed 100644 --- a/.claude/agents/python-harness-engineer.md +++ b/.claude/agents/python-harness-engineer.md @@ -24,7 +24,7 @@ not in `felix-web`. Before doing anything: ## What the web clients depend on -Changes here are load-bearing for `apps/chat-ui`. Treat these as a public contract: +Changes here are load-bearing for `apps/web`. Treat these as a public contract: - **SSE framing on `POST /chat/stream`** — one event per `\n\n`, `data: ` lines, terminated by `data: [DONE]`. Clients decode with a carry buffer; a malformed or unterminated frame hangs the UI. @@ -40,7 +40,7 @@ Changes here are load-bearing for `apps/chat-ui`. Treat these as a public contra payload shape is a breaking change on both clients. Whenever you change one of these, say so explicitly in your output and name the client files that -must change with it (`packages/felix-protocol/src/types.ts`, `apps/chat-ui/src/{api,types}.ts`). +must change with it (`packages/felix-protocol/src/types.ts`, `apps/web/src/{api,types}.ts`). ## Engineering standards diff --git a/.claude/agents/refactor-engineer.md b/.claude/agents/refactor-engineer.md index aea5a662..4cfb2c5b 100644 --- a/.claude/agents/refactor-engineer.md +++ b/.claude/agents/refactor-engineer.md @@ -21,7 +21,7 @@ saying so. ## Invariants you must not break -1. **The proxy contract is stated twice on purpose.** `apps/chat-ui/worker/index.ts` runs in +1. **The proxy contract is stated twice on purpose.** `apps/web/worker/index.ts` runs in production; the `/api` rewrite in `vite.config.ts` runs only in `vite dev`. They cannot be one module (`.claude/rules/protocol-parity.md`). The correct cleanup is the opposite one: make the copies match, in the same PR. @@ -34,7 +34,7 @@ saying so. `packages/design/src/tokens.ts` via `pnpm sync:theme`; `block-generated.sh` will deny the edit. 5. **Shared dependency versions live in `pnpm-workspace.yaml` under `catalog:`.** Fixing drift means replacing a literal version with `"catalog:"`, not bumping it in the manifest. -6. **shadcn primitives are vendored.** Leave `packages/ui/src` and `apps/chat-ui/src/components` +6. **shadcn primitives are vendored.** Leave `packages/ui/src` and `apps/web/src/components` alone unless the finding is about our own code inside them. ## How to work diff --git a/.claude/agents/security-reviewer.md b/.claude/agents/security-reviewer.md index 5084cf8d..a48db6bc 100644 --- a/.claude/agents/security-reviewer.md +++ b/.claude/agents/security-reviewer.md @@ -16,7 +16,7 @@ exploitable in this architecture — describe the attack, not the category. **Browser → proxy Worker → Python harness → model → back out again.** Two of those hops carry attacker-influenceable content, and one carries credentials. -### 1. The proxy Worker (`apps/chat-ui/worker/index.ts`) +### 1. The proxy Worker (`apps/web/worker/index.ts`) - **No credential of its own.** The Worker forwards a browser's bearer untouched and attaches nothing. Any change that makes it add a credential to a request — an injected key, a service diff --git a/.claude/agents/test-engineer.md b/.claude/agents/test-engineer.md index 27783c9b..64684a2f 100644 --- a/.claude/agents/test-engineer.md +++ b/.claude/agents/test-engineer.md @@ -11,7 +11,7 @@ defect, and you say plainly what remains unverified. ## What is covered today, and what is not -Vitest 4, two configs, no root config: `apps/chat-ui/vitest.config.ts` and +Vitest 4, two configs, no root config: `apps/web/vitest.config.ts` and `packages/cowork-client/vitest.config.ts`. `pnpm test` runs both through turbo — deliberately with **no** `dependsOn`, so a failing dependency can never silently skip a package's tests. @@ -29,8 +29,8 @@ Packages with no `test` script at all: `@felix/ui`, `@felix/protocol`, `@felix/d ## Where a test belongs - **A contract that outlives its caller goes in `packages/test-kit/src/`**, exported through the - `exports` map and called from `apps/chat-ui/tests/`. The suites are parameterized on purpose — see - `apps/chat-ui/tests/sse.test.ts`: the suite takes an injected `run`, the caller supplies the + `exports` map and called from `apps/web/tests/`. The suites are parameterized on purpose — see + `apps/web/tests/sse.test.ts`: the suite takes an injected `run`, the caller supplies the implementation. That indirection is what lets the Worker and reader contracts be stated once, independently of who satisfies them. - **A component test** opens with a `/** @vitest-environment happy-dom */` docblock. The configs diff --git a/.claude/agents/ui-engineer.md b/.claude/agents/ui-engineer.md index 8df2f595..c5d35ea9 100644 --- a/.claude/agents/ui-engineer.md +++ b/.claude/agents/ui-engineer.md @@ -1,13 +1,13 @@ --- name: ui-engineer -description: React/Vite/Tailwind engineer for the chat-ui SPA. Use proactively for any component, hook, state, styling, or streaming-UI work under apps/chat-ui/src, and whenever a change touches the SSE event handling in @felix/client's engine or the shared @felix/ui primitives. +description: React/Vite/Tailwind engineer for the chat-ui SPA. Use proactively for any component, hook, state, styling, or streaming-UI work under apps/web/src, and whenever a change touches the SSE event handling in @felix/client's engine or the shared @felix/ui primitives. tools: Read, Grep, Glob, Edit, Write, Bash, WebFetch model: inherit color: cyan --- -You build the browser client in **felix-web**: `apps/chat-ui` — streaming chat, harness inspector, -and the unattended-run surface (background runs, approval polling, `src/lib/presence.ts`). +You build the browser client in **felix-web**: `apps/web` — streaming chat, harness inspector, +and the unattended-run surface (background runs, approval polling, `src/lib/conversation/presence.ts`). Stack: React 18, Vite 8, Tailwind v4 (CSS-first — there is no `tailwind.config`), shadcn/ui via `@felix/ui`, `streamdown` for markdown, `sonner` for toasts, `lucide-react` for icons. @@ -36,7 +36,7 @@ Use the `api-contract-change` skill for the full procedure. - Client state that must survive reload goes in `localStorage` under a `felix.*` key (`felix.threadId`, `felix.manifest`, …). Server state is authoritative: hydrate from `GET /chat/sessions/{id}`; the `localStorage` transcript mirror in - `src/lib/threads.ts` exists only because `GET /chat/history/{id}` rejects anonymous callers. + `src/lib/conversation/threads.ts` exists only because `GET /chat/history/{id}` rejects anonymous callers. - Each tab mints a holder id and takes an exclusive session lease. A 409 means another client drives the thread: the keeper observes (`shared`), the shell goes read-only, and the keeper retries `exclusive` once per renewal tick — never in a tight loop. Driving requests carry the @@ -54,12 +54,12 @@ Gate, the engine at the wire, and `App.tsx` end to end — **not** the composer Never say "tests pass" as if the UI you changed were covered. Verify with: ```bash -pnpm --filter @felix/chat-ui check-types -pnpm --filter @felix/chat-ui lint -pnpm --filter @felix/chat-ui build +pnpm --filter @felix/web check-types +pnpm --filter @felix/web lint +pnpm --filter @felix/web build ``` -For behavior, `pnpm chat:dev` needs the Python harness running on `:8080` +For behavior, `pnpm web:dev` needs the Python harness running on `:8080` (`make up && make migrate` in felix-run/felix). Without it the app loads and every `/api/*` call fails — say so rather than reporting a broken UI as a code bug. diff --git a/.claude/agents/workers-engineer.md b/.claude/agents/workers-engineer.md index f863bb3d..3bdbf9a4 100644 --- a/.claude/agents/workers-engineer.md +++ b/.claude/agents/workers-engineer.md @@ -1,6 +1,6 @@ --- name: workers-engineer -description: Cloudflare Workers specialist for the felix-web proxy Worker and wrangler config. Use proactively whenever apps/chat-ui/worker/index.ts, a wrangler.jsonc, an assets/SPA-fallback question, or the /api/* proxy contract is involved — including header handling, SSE pass-through, bindings, secrets, and routes. +description: Cloudflare Workers specialist for the felix-web proxy Worker and wrangler config. Use proactively whenever apps/web/worker/index.ts, a wrangler.jsonc, an assets/SPA-fallback question, or the /api/* proxy contract is involved — including header handling, SSE pass-through, bindings, secrets, and routes. tools: Read, Grep, Glob, Edit, Write, Bash, WebFetch model: inherit color: orange @@ -36,7 +36,7 @@ client possible at all. Same-origin in, HTTP out. ## Config facts -- `apps/chat-ui/wrangler.jsonc` is **tracked** and is what CI deploys to make.felix.run; it ships a `.dev.vars.example` for `wrangler dev`. Keep +- `apps/web/wrangler.jsonc` is **tracked** and is what CI deploys to make.felix.run; it ships a `.dev.vars.example` for `wrangler dev`. Keep that example in step when you change bindings or vars. `apps/docs/wrangler.jsonc` is tracked because it holds no account or resource ids. - Routes are custom domains: `make.felix.run`, `docs.felix.run`. @@ -46,7 +46,7 @@ client possible at all. Same-origin in, HTTP out. 1. Read the Worker and the `vite.config.ts` dev proxy before editing either. State in your output whether the change applies to one or both, and why. -2. Type-check with `pnpm --filter @felix/chat-ui check-types`, then run `pnpm test`: the suite in +2. Type-check with `pnpm --filter @felix/web check-types`, then run `pnpm test`: the suite in `@felix/test-kit` holds the Worker to the `/api/*` contract — the gate key never going upstream, the body streaming through untouched. It does not cover deployed behavior. 3. For runtime verification, `wrangler dev` in the app directory, against a running harness on diff --git a/.claude/hooks/failure-hint.sh b/.claude/hooks/failure-hint.sh index d4d50516..66a76341 100755 --- a/.claude/hooks/failure-hint.sh +++ b/.claude/hooks/failure-hint.sh @@ -9,6 +9,6 @@ case "$cmd" in *) exit 0;; esac -jq -cn --arg ctx "felix-web failure shortlist: (1) 'Cannot find module @felix/ui/...' or @felix/cowork-client → those packages have NO build step; the export must exist in the package's exports map AND in the tsconfig paths of apps/chat-ui (add-ui-primitive skill). (2) tsc errors on possibly-undefined index access → the workspace tsconfig sets noUncheckedIndexedAccess; handle the undefined rather than adding '!'. (3) tsc noUnusedLocals/noUnusedParameters → chat-ui enables them; delete the unused binding. (4) biome check failures → pnpm format fixes formatting; real lint errors need a code change, not a config change. (5) wrangler 'assets directory does not exist' → run the build first ('*:deploy' scripts already do). (6) wrangler cannot find wrangler.jsonc → run wrangler from the app directory (pnpm --filter @felix/ exec wrangler); both configs are tracked. (7) ECONNREFUSED / 502 on :8080 in dev → the Python harness is not running; 'make up && make migrate' in felix-run/felix. (8) 502 felix_origin_unset → vars.FELIX_ORIGIN missing in wrangler.jsonc. (9) astro 'does not exist in collection docs' or a missing page → prose lives at src/content/ (not src/content/docs/) and new pages must be registered in the sidebar in astro.config.mjs. (10) ERR_PNPM_OUTDATED_LOCKFILE → run pnpm install; never hand-edit the lockfile. (11) 'vitest not found' / 'no test specified' → only apps/chat-ui and packages/cowork-client have a test script and a vitest.config.ts; the other packages have none by design, so scope the run with pnpm --filter rather than adding a config." \ +jq -cn --arg ctx "felix-web failure shortlist: (1) 'Cannot find module @felix/ui/...' or @felix/cowork-client → those packages have NO build step; the export must exist in the package's exports map AND in the tsconfig paths of apps/web (add-ui-primitive skill). (2) tsc errors on possibly-undefined index access → the workspace tsconfig sets noUncheckedIndexedAccess; handle the undefined rather than adding '!'. (3) tsc noUnusedLocals/noUnusedParameters → chat-ui enables them; delete the unused binding. (4) biome check failures → pnpm format fixes formatting; real lint errors need a code change, not a config change. (5) wrangler 'assets directory does not exist' → run the build first ('*:deploy' scripts already do). (6) wrangler cannot find wrangler.jsonc → run wrangler from the app directory (pnpm --filter @felix/ exec wrangler); both configs are tracked. (7) ECONNREFUSED / 502 on :8080 in dev → the Python harness is not running; 'make up && make migrate' in felix-run/felix. (8) 502 felix_origin_unset → vars.FELIX_ORIGIN missing in wrangler.jsonc. (9) astro 'does not exist in collection docs' or a missing page → prose lives at src/content/ (not src/content/docs/) and new pages must be registered in the sidebar in astro.config.mjs. (10) ERR_PNPM_OUTDATED_LOCKFILE → run pnpm install; never hand-edit the lockfile. (11) 'vitest not found' / 'no test specified' → only apps/web and packages/cowork-client have a test script and a vitest.config.ts; the other packages have none by design, so scope the run with pnpm --filter rather than adding a config." \ '{hookSpecificOutput:{hookEventName:"PostToolUseFailure",additionalContext:$ctx}}' exit 0 diff --git a/.claude/hooks/impact-reminder.sh b/.claude/hooks/impact-reminder.sh index 327c6c97..9734bcd7 100755 --- a/.claude/hooks/impact-reminder.sh +++ b/.claude/hooks/impact-reminder.sh @@ -13,20 +13,20 @@ emit() { } case "$rel" in - apps/chat-ui/src/types.ts|apps/chat-ui/src/api.ts) + apps/web/src/api/types.ts|apps/web/src/api/client.ts) emit "Wire contract touched. The shared types live in packages/felix-protocol and the chat half of the HTTP surface in packages/felix-client — check whether the change belongs in one of those rather than here. If you added a StreamEvent arm, add the matching case in packages/felix-client/src/engine.ts — the union's catch-all arm means an unhandled frame type-checks and silently does nothing. See the api-contract-change skill." ;; packages/felix-client/src/engine.ts) emit "The one StreamEvent switch. Every client renders this — chat-ui today, any other surface after it — so a change here is not scoped to one app. A new arm in packages/felix-protocol/src/types.ts needs its case here or the frame silently does nothing; pnpm check-protocol-parity reads THIS file. Frames the run blocks on (tool_request, approval_required, ui_request) must be answered on every path, errors and aborts included." ;; apps/tui/src/workspace.ts) emit "Terminal client tools changed — this is the surface where the MODEL drives the user's REAL filesystem, not a VFS. Re-check resolveWithin against '..', absolute paths, encoded traversal and symlinks (it compares real paths for that reason), and confirm writes still wait on the confirmation prompt. Every path must settle with a RESULT, never a throw or a hang. Consider the threat-review skill." ;; packages/felix-client/src/transport.ts) - emit "Chat routes changed. pnpm check-api-drift reads this file alongside apps/chat-ui/src/api.ts — keep the paths as literals passed to chatFetch/rawFetch (harness-relative, no /api prefix) or the call becomes invisible to the check. Response *shapes* are guarded separately by pnpm check-payload-shapes." ;; - apps/chat-ui/worker/index.ts) - emit "Proxy Worker changed. The dev proxy in apps/chat-ui/vite.config.ts is a second copy of the same /api/* contract (prefix strip + FELIX_ORIGIN) — apply the same change there, or dev and prod diverge silently." ;; - apps/chat-ui/vite.config.ts) - emit "The dev /api proxy mirrors the production Worker (prefix strip + FELIX_ORIGIN). If you changed proxy behavior, apps/chat-ui/worker/index.ts must match, or dev and prod diverge silently." ;; + emit "Chat routes changed. pnpm check-api-drift reads this file alongside apps/web/src/api/client.ts — keep the paths as literals passed to chatFetch/rawFetch (harness-relative, no /api prefix) or the call becomes invisible to the check. Response *shapes* are guarded separately by pnpm check-payload-shapes." ;; + apps/web/worker/index.ts) + emit "Proxy Worker changed. The dev proxy in apps/web/vite.config.ts is a second copy of the same /api/* contract (prefix strip + FELIX_ORIGIN) — apply the same change there, or dev and prod diverge silently." ;; + apps/web/vite.config.ts) + emit "The dev /api proxy mirrors the production Worker (prefix strip + FELIX_ORIGIN). If you changed proxy behavior, apps/web/worker/index.ts must match, or dev and prod diverge silently." ;; packages/ui/src/*) - emit "Shared UI package changed. @felix/ui has NO build step: a new non-flat export needs an entry in packages/ui/package.json exports AND a matching paths entry in apps/chat-ui/tsconfig.json. New dependencies belong in packages/ui/package.json. See the add-ui-primitive skill." ;; + emit "Shared UI package changed. @felix/ui has NO build step: a new non-flat export needs an entry in packages/ui/package.json exports AND a matching paths entry in apps/web/tsconfig.json. New dependencies belong in packages/ui/package.json. See the add-ui-primitive skill." ;; packages/cowork-client/src/*) emit "Client-tool / VFS code changed — this is the surface where the MODEL drives the user's filesystem. Re-check path normalization against '..', absolute paths, and encoded traversal, and confirm destructive operations still require approval. chat-ui binds this package in src/lib/cowork.ts. Consider the threat-review skill." ;; packages/design/src/tokens.ts) diff --git a/.claude/hooks/session-start.sh b/.claude/hooks/session-start.sh index 06f1503c..274d2a8a 100755 --- a/.claude/hooks/session-start.sh +++ b/.claude/hooks/session-start.sh @@ -11,7 +11,7 @@ add() { out="${out}$1 # Is the Python harness up? Everything under /api/* fails in dev without it. if ! (exec 3<>/dev/tcp/127.0.0.1/8080) 2>/dev/null; then - add "- Python Felix harness is NOT listening on :8080, so every /api/* call in chat:dev will fail. Start it in the felix-run/felix repo: make up && make migrate" + add "- Python Felix harness is NOT listening on :8080, so every /api/* call in web:dev will fail. Start it in the felix-run/felix repo: make up && make migrate" fi branch=$(cd "$root" 2>/dev/null && git rev-parse --abbrev-ref HEAD 2>/dev/null) diff --git a/.claude/hooks/stop-gate.sh b/.claude/hooks/stop-gate.sh index 08c6d461..47c84b60 100755 --- a/.claude/hooks/stop-gate.sh +++ b/.claude/hooks/stop-gate.sh @@ -19,7 +19,7 @@ state="${TMPDIR:-/tmp}/felix-web-stop-$sid" # --- 1. docs drift ----------------------------------------------------------- # Surfaces a reader of the docs would notice changing. -surfaces=$(printf '%s\n' "$changed" | grep -E '^(apps/chat-ui/(src/(api|types)\.ts|worker/index\.ts)|apps/chat-ui/wrangler\.example\.jsonc|packages/design/src/tokens\.ts)$') +surfaces=$(printf '%s\n' "$changed" | grep -E '^(apps/web/(src/(api|types)\.ts|worker/index\.ts)|apps/web/wrangler\.example\.jsonc|packages/design/src/tokens\.ts)$') if [ -n "$surfaces" ]; then # Any doc-side change in the same tree counts as "docs were considered". diff --git a/.claude/rules/docs-terminology.md b/.claude/rules/docs-terminology.md index dcf3cb59..014562a2 100644 --- a/.claude/rules/docs-terminology.md +++ b/.claude/rules/docs-terminology.md @@ -15,7 +15,7 @@ context alone. Name them like this: "each Worker polls", "the Worker's `webhook_delivery` cron". - **Cloudflare Worker** is anything deployed to Cloudflare Workers: the workspace gateway (`deploy/cloudflare/workspace-gateway` in the harness checkout) and chat-ui's `/api/*` proxy - (`apps/chat-ui/worker/index.ts`). Always spell it out — "the gateway's Cloudflare Worker", "the + (`apps/web/worker/index.ts`). Always spell it out — "the gateway's Cloudflare Worker", "the chat-ui Cloudflare Worker" — never a bare "Worker", "gateway Worker" or "proxy Worker", since bare "Worker" means the compose service. diff --git a/.claude/rules/protocol-parity.md b/.claude/rules/protocol-parity.md index c02158f3..99ff3fc1 100644 --- a/.claude/rules/protocol-parity.md +++ b/.claude/rules/protocol-parity.md @@ -1,9 +1,9 @@ --- paths: - - "apps/chat-ui/src/api.ts" - - "apps/chat-ui/src/types.ts" - - "apps/chat-ui/src/App.tsx" - - "apps/chat-ui/src/lib/presence.ts" + - "apps/web/src/api/client.ts" + - "apps/web/src/api/types.ts" + - "apps/web/src/app/app.tsx" + - "apps/web/src/lib/conversation/presence.ts" - "packages/felix-client/src/*.ts" - "apps/*/worker/index.ts" - "apps/*/vite.config.ts" @@ -28,8 +28,8 @@ must be listed rather than trusted. ## 1. The `/api/*` proxy contract — two copies -`apps/chat-ui/worker/index.ts` runs in production; the `server.proxy` block in -`apps/chat-ui/vite.config.ts` runs only under `vite dev`. Both strip the `/api` prefix and forward to +`apps/web/worker/index.ts` runs in production; the `server.proxy` block in +`apps/web/vite.config.ts` runs only under `vite dev`. Both strip the `/api` prefix and forward to the harness. They cannot be one module — different runtimes, different config — so if they drift, dev and production behave differently and nothing reports it. @@ -78,7 +78,7 @@ A blocking state is supposed to arrive as an SSE frame, and does not reliably: t announce a gated tool on the stream, and a **durable** run (`POST /chat` → `202 + resume_token`) carries no frames at all — `/chat/runs/{token}` reports only its own status. So the same state is also discovered by the `/approvals` poll — `syncApprovals` in `@felix/client`, driven for as long as -a run is in flight — and announced outside the viewport through chat-ui's `src/lib/presence.ts`. +a run is in flight — and announced outside the viewport through chat-ui's `src/lib/conversation/presence.ts`. Wiring only the frame is the failure this rule exists to prevent: it looks correct in a watched tab and hangs forever in an unwatched one. diff --git a/.claude/settings.json b/.claude/settings.json index 4ed9733e..d62952e9 100644 --- a/.claude/settings.json +++ b/.claude/settings.json @@ -107,17 +107,17 @@ "Bash(pnpm format)", "Bash(pnpm check-types)", "Bash(pnpm test)", - "Bash(pnpm --filter @felix/chat-ui test)", + "Bash(pnpm --filter @felix/web test)", "Bash(pnpm --filter @felix/tui test)", "Bash(pnpm --filter @felix/cowork-client test)", "Bash(pnpm --filter @felix/client test)", "Bash(pnpm --filter @felix/skill-format test)", - "Bash(pnpm chat:build)", + "Bash(pnpm web:build)", "Bash(pnpm docs:build)", - "Bash(pnpm --filter @felix/chat-ui build)", + "Bash(pnpm --filter @felix/web build)", "Bash(pnpm --filter @felix/docs build)", "Bash(pnpm --filter @felix/tui build)", - "Bash(pnpm --filter @felix/chat-ui lint)", + "Bash(pnpm --filter @felix/web lint)", "Bash(pnpm --filter @felix/docs lint)", "Bash(pnpm --filter @felix/tui lint)", "Bash(pnpm --filter @felix/cowork-client lint)", @@ -127,7 +127,7 @@ "Bash(pnpm --filter @felix/skill-format lint)", "Bash(pnpm --filter @felix/test-kit lint)", "Bash(pnpm --filter @felix/ui lint)", - "Bash(pnpm --filter @felix/chat-ui check-types)", + "Bash(pnpm --filter @felix/web check-types)", "Bash(pnpm --filter @felix/docs check-types)", "Bash(pnpm --filter @felix/tui check-types)", "Bash(pnpm --filter @felix/cowork-client check-types)", @@ -151,7 +151,7 @@ "Bash(gh pr checks:*)" ], "ask": [ - "Bash(pnpm chat:deploy)", + "Bash(pnpm web:deploy)", "Bash(pnpm docs:deploy)", "Bash(pnpm --filter * deploy*)", "Bash(pnpm --filter * run deploy*)", diff --git a/.claude/skills/add-ui-primitive/SKILL.md b/.claude/skills/add-ui-primitive/SKILL.md index 3257a48f..b13298bc 100644 --- a/.claude/skills/add-ui-primitive/SKILL.md +++ b/.claude/skills/add-ui-primitive/SKILL.md @@ -18,7 +18,7 @@ app's tsconfig. That means adding a component is three wiring steps, not one. pnpm dlx shadcn@latest add --cwd packages/ui ``` -Config comes from `apps/chat-ui/components.json`: style `new-york`, base color `neutral`, CSS +Config comes from `apps/web/components.json`: style `new-york`, base color `neutral`, CSS variables on, `lucide` icons, `utils` aliased to `@felix/ui/lib/utils`. Files land in `packages/ui/src/`, flat — no `components/ui/` nesting. @@ -41,7 +41,7 @@ top-level `.tsx` — a subdirectory, a `.ts` helper, a hook — needs its own `e ## 3. Check the tsconfig paths -`apps/chat-ui/tsconfig.json` carries: +`apps/web/tsconfig.json` carries: ```json "@felix/ui/*": ["../../packages/ui/src/*"], @@ -70,7 +70,7 @@ Shared versions live in the `catalog:` block of `pnpm-workspace.yaml`, so: ```bash pnpm --filter @felix/ui check-types -pnpm --filter @felix/chat-ui check-types +pnpm --filter @felix/web check-types pnpm lint ``` diff --git a/.claude/skills/api-contract-change/SKILL.md b/.claude/skills/api-contract-change/SKILL.md index bddabfa4..5a7110ff 100644 --- a/.claude/skills/api-contract-change/SKILL.md +++ b/.claude/skills/api-contract-change/SKILL.md @@ -20,8 +20,8 @@ that hides missing handlers. Follow this in order. | `packages/felix-client/src/http.ts` | The credentialed `chatFetch`/`rawFetch` both halves share | | `packages/felix-client/src/transport.ts` | The chat verbs | | `packages/felix-client/src/management/*.ts` | The read-only operator reads — audit, usage, memory, plans, artifacts — types beside their fetcher | -| `apps/chat-ui/src/api.ts` | `apiFetch` + the browser-only **write** surface: eval, manifests, jobs, agent card | -| `apps/chat-ui/src/types.ts` | chat-ui-only: `Turn`, and the write-surface shapes | +| `apps/web/src/api/client.ts` | `apiFetch` + the browser-only **write** surface: eval, manifests, jobs, agent card | +| `apps/web/src/api/types.ts` | chat-ui-only: `Turn`, and the write-surface shapes | Plus the consumer: `packages/felix-client/src/engine.ts`, where the `switch` over `StreamEvent` lives — one switch for every client, and the file `check-protocol-parity` reads. @@ -60,7 +60,7 @@ catalog and the flows each frame belongs to. 3. **Add the client function**, if it is a REST call, in the file that matches who needs it. A route any client would want goes in `packages/felix-client/` — a chat verb in `transport.ts`, an operator read in `management/`, with its row type declared beside it. A browser-only write stays - in `apps/chat-ui/src/api.ts`. Match the house style: go through the area's wrapper (`chatFetch` + in `apps/web/src/api/client.ts`. Match the house style: go through the area's wrapper (`chatFetch` in the package, `apiFetch` in chat-ui — never bare `fetch`), check `res.ok`, throw `` `${route}: ${res.status} ${detail.slice(0, 200)}` `` on failure. That spelling is load-bearing: `describeError` reads the status back out of it with `/:\s*(\d{3})\b/`. @@ -80,17 +80,17 @@ catalog and the flows each frame belongs to. 5. **Decide about the unattended path.** A frame the run blocks on has to reach an operator who is not looking: a durable run carries no frames at all, so anything blocking needs a `/approvals`-style - poll and a `setPresence('blocked')` (`src/lib/presence.ts`), not just a banner. + poll and a `setPresence('blocked')` (`src/lib/conversation/presence.ts`), not just a banner. 6. **Verify.** `pnpm check-types && pnpm lint` proves nothing about the frame itself — trigger it - against a live harness (`pnpm chat:dev`) and confirm the UI reacts. Use the `preflight` skill for + against a live harness (`pnpm web:dev`) and confirm the UI reacts. Use the `preflight` skill for the full loop. For an SSE change run `pnpm check-protocol-parity`, which fails when a `StreamEvent` arm has no handler in either app — the failure mode the open union arm hides. For a REST change also run `pnpm check-api-drift`, which diffs every client call site's path and - verb against `apps/chat-ui/harness-openapi.json`. If the harness gained the route you are calling, + verb against `apps/web/harness-openapi.json`. If the harness gained the route you are calling, refresh that snapshot in the same PR — instructions are in `scripts/check-api-drift.mjs`. 7. **Document it** if the change is user-visible or operator-relevant: `apps/docs/src/content/` diff --git a/.claude/skills/api-contract-change/references/wire-protocol.md b/.claude/skills/api-contract-change/references/wire-protocol.md index bc0a5040..ca5df22e 100644 --- a/.claude/skills/api-contract-change/references/wire-protocol.md +++ b/.claude/skills/api-contract-change/references/wire-protocol.md @@ -2,7 +2,7 @@ Reference for `api-contract-change`. Source of truth is the Python harness ([felix-run/felix](https://github.com/felix-run/felix)); this file records what the browser clients -currently implement, in `apps/chat-ui/src/{api,types}.ts`. +currently implement, in `apps/web/src/{api,types}.ts`. ## Transport @@ -45,7 +45,7 @@ accepted by the compiler and ignored at runtime. - `POST /chat/rewind` — move the active leaf to an earlier event - `POST /chat/abort`, `POST /chat/steer`, `POST /chat/continue`, thinking-level set - `GET /chat/history/{thread_id}` — **rejects anonymous callers**; hence the `localStorage` mirror in - `src/lib/threads.ts` + `src/lib/conversation/threads.ts` **Inspector and management** (tenant-scoped; anonymous callers resolve to tenant `default`) - `GET /v1/models` — manifest list for the switcher diff --git a/.claude/skills/branch-pr-workflow/SKILL.md b/.claude/skills/branch-pr-workflow/SKILL.md index 10a742ff..b0133d27 100644 --- a/.claude/skills/branch-pr-workflow/SKILL.md +++ b/.claude/skills/branch-pr-workflow/SKILL.md @@ -43,7 +43,7 @@ See also [.claude/rules/git-workflow.md](../../rules/git-workflow.md). 2. **Work + verify** on the branch. This monorepo is the chat-ui and docs Workers only — the runtime is [felix-run/felix](https://github.com/felix-run/felix) (Python). Prefer the package - under change: `pnpm --filter @felix/chat-ui …` / `@felix/docs`, or root scripts + under change: `pnpm --filter @felix/web …` / `@felix/docs`, or root scripts when they apply. Docs prose lives in `apps/docs/src/content/` (MDX). Verification is `pnpm check-types`, `pnpm lint`, `pnpm test`, and `pnpm build`, plus a manual run diff --git a/.claude/skills/code-quality/references/dimensions.md b/.claude/skills/code-quality/references/dimensions.md index 5c399fc7..7cec9a40 100644 --- a/.claude/skills/code-quality/references/dimensions.md +++ b/.claude/skills/code-quality/references/dimensions.md @@ -23,12 +23,12 @@ sweep looks in the right place instead of grepping the whole tree. ## 2. Test quality and coverage -- Two configs: `apps/chat-ui/vitest.config.ts` and `packages/cowork-client/vitest.config.ts`. No +- Two configs: `apps/web/vitest.config.ts` and `packages/cowork-client/vitest.config.ts`. No root config, no coverage tool. - Contract-level behavior lives in `packages/test-kit/src/proxy-worker.ts` and - `packages/test-kit/src/sse.ts`, invoked from `apps/chat-ui/tests/`. The suites are parameterized + `packages/test-kit/src/sse.ts`, invoked from `apps/web/tests/`. The suites are parameterized on an injected implementation, which is what lets the contract be stated independently of its - caller — see `apps/chat-ui/tests/sse.test.ts`. + caller — see `apps/web/tests/sse.test.ts`. - Covered today: the VFS, the SSE reader, the proxy Worker, and chat-ui's thread store, theme provider, `usePoll`, presence, Gate, the engine, and `App.tsx`. **Uncovered: the composer, the inspector panels.** @@ -42,7 +42,7 @@ sweep looks in the right place instead of grepping the whole tree. code as a clean bill. - Strictness is not uniform, and code moving between tiers can lose a guarantee: - | Flag | root / `packages/*` | `apps/chat-ui` | + | Flag | root / `packages/*` | `apps/web` | |---|---|---| | `strict` | on | on | | `noUncheckedIndexedAccess` | **on** | **off** | @@ -56,7 +56,7 @@ sweep looks in the right place instead of grepping the whole tree. arm. A new frame type compiles with no handler and silently does nothing, so "the types pass" says nothing about SSE completeness. Cross-check the arms against the `switch` in `@felix/client`. - Widening a shared package's surface is a commitment: the `exports` map **and** the `paths` block - in `apps/chat-ui/tsconfig.json` both have to change. A helper with a single call site does not + in `apps/web/tsconfig.json` both have to change. A helper with a single call site does not belong in a shared package. ## 4. Dependency and bundle hygiene diff --git a/.claude/skills/deploy-runbook/SKILL.md b/.claude/skills/deploy-runbook/SKILL.md index d3f6a67a..fe3a7703 100644 --- a/.claude/skills/deploy-runbook/SKILL.md +++ b/.claude/skills/deploy-runbook/SKILL.md @@ -20,7 +20,7 @@ around it. | App | Script | Route | |---|---|---| -| `@felix/chat-ui` | `pnpm chat:deploy` | `make.felix.run` | +| `@felix/web` | `pnpm web:deploy` | `make.felix.run` | | `@felix/docs` | `pnpm docs:deploy` | `docs.felix.run` | Each `*:deploy` script is `pnpm build && wrangler deploy` inside that package. @@ -55,14 +55,14 @@ harness must have one on before this deploy. A Worker deployed before the shared retired still holds `CHAT_UI_KEY` and `FELIX_API_KEY`; they are ignored — delete them: ```bash -pnpm --filter @felix/chat-ui exec wrangler secret delete CHAT_UI_KEY -pnpm --filter @felix/chat-ui exec wrangler secret delete FELIX_API_KEY +pnpm --filter @felix/web exec wrangler secret delete CHAT_UI_KEY +pnpm --filter @felix/web exec wrangler secret delete FELIX_API_KEY ``` ## 3. Deploy ```bash -pnpm chat:deploy # or docs:deploy +pnpm web:deploy # or docs:deploy ``` ## 4. Verify — actually check, don't assume diff --git a/.claude/skills/preflight/SKILL.md b/.claude/skills/preflight/SKILL.md index c38584ac..9862a2a1 100644 --- a/.claude/skills/preflight/SKILL.md +++ b/.claude/skills/preflight/SKILL.md @@ -48,7 +48,7 @@ scanned. Scope to one package when the change is contained — it is much faster: ```bash -pnpm --filter @felix/chat-ui check-types +pnpm --filter @felix/web check-types pnpm --filter @felix/docs build ``` @@ -61,14 +61,14 @@ These checks pass on code that is still broken. If your change is in one of thes report that it is unverified, or exercise it manually: - **Runtime behavior of anything touching `/api/*`.** Needs the Python harness on `:8080` - (`make up && make migrate` in felix-run/felix), then `pnpm chat:dev`. + (`make up && make migrate` in felix-run/felix), then `pnpm web:dev`. - **A new SSE event with no `switch` case.** `StreamEvent` has an open catch-all arm, so this type-checks and does nothing. Verify by triggering the frame. -- **Dev/prod proxy divergence.** Nothing mechanically checks that `apps/chat-ui/worker/index.ts` - and the `/api` rewrite in `apps/chat-ui/vite.config.ts` still describe the same contract. Read +- **Dev/prod proxy divergence.** Nothing mechanically checks that `apps/web/worker/index.ts` + and the `/api` rewrite in `apps/web/vite.config.ts` still describe the same contract. Read both when you touch either. - **The unattended path.** A background run carries no SSE frames, so a blocking state reaches the - operator only through the `/approvals` poll and `src/lib/presence.ts`. Streaming green says + operator only through the `/approvals` poll and `src/lib/conversation/presence.ts`. Streaming green says nothing about it. - **The Workers themselves.** `vite build` does not exercise `worker/index.ts`. Use `wrangler dev` in the app directory. diff --git a/.claude/skills/python-harness/SKILL.md b/.claude/skills/python-harness/SKILL.md index ca05df24..09e6d45b 100644 --- a/.claude/skills/python-harness/SKILL.md +++ b/.claude/skills/python-harness/SKILL.md @@ -30,7 +30,7 @@ type checker, test layout and runner, line length, Python version. Run the proje do not invent `make test` if the repo doesn't have it. Local dev, as referenced from this repo: `make up && make migrate` brings the harness up on -`:8080`, which is what `pnpm chat:dev` proxies to. +`:8080`, which is what `pnpm web:dev` proxies to. ## The contract you must not break casually @@ -55,7 +55,7 @@ The browser clients hand-mirror the harness's wire format. These are load-bearin When you change any of these, name the felix-web files that must change with it — the shared `packages/felix-protocol` (wire types and the SSE reader, one copy for both apps), each app's own `src/api.ts`, and the engine `switch` in `@felix/client` — and use the `api-contract-change` skill to land -the client side. Route changes also want `apps/chat-ui/harness-openapi.json` refreshed, which +the client side. Route changes also want `apps/web/harness-openapi.json` refreshed, which `pnpm check-api-drift` enforces. ## Engineering rules diff --git a/.claude/skills/threat-review/references/checklist.md b/.claude/skills/threat-review/references/checklist.md index cac1707f..85489426 100644 --- a/.claude/skills/threat-review/references/checklist.md +++ b/.claude/skills/threat-review/references/checklist.md @@ -2,7 +2,7 @@ Reference for `threat-review`. -## Proxy Worker — `apps/chat-ui/worker/index.ts` +## Proxy Worker — `apps/web/worker/index.ts` - [ ] The Worker attaches no credential of its own on any upstream path - [ ] `host` and the `cf-*` headers still stripped (they are trusted signals upstream) @@ -13,10 +13,10 @@ Reference for `threat-review`. a documented, intentional pass-through mode - [ ] Streaming preserved: body passed through, `duplex: 'half'`, `redirect: 'manual'`, no buffering - [ ] Response headers not reconstructed in a way that drops or adds sensitive headers -- [ ] The dev proxy in `apps/chat-ui/vite.config.ts` changed with it — it is a second copy of the +- [ ] The dev proxy in `apps/web/vite.config.ts` changed with it — it is a second copy of the same contract, and a fix in only one leaves dev and production disagreeing -## Gate and identity — `src/lib/auth.ts`, `components/gate.tsx` +## Gate and identity — `src/lib/auth/auth.ts`, `components/gate.tsx` - [ ] The session is the only credential; no shared key or service token has come back - [ ] Stored only in `localStorage` under the known key; not sent anywhere but `/api/*` @@ -54,7 +54,7 @@ Reference for `threat-review`. - [ ] `wrangler.jsonc` `vars` contains only `FELIX_ORIGIN` - [ ] `.dev.vars` gitignored; only `.dev.vars.example` tracked, with empty values -- [ ] Both tracked `wrangler.jsonc` files (`apps/chat-ui`, `apps/docs`) stay free of account and +- [ ] Both tracked `wrangler.jsonc` files (`apps/web`, `apps/docs`) stay free of account and resource ids; CI deploys them as they are - [ ] No secret in `index.html`, in a `VITE_`-prefixed env var, or in `dist/` - [ ] No source maps published that expose more than intended diff --git a/.claude/skills/toolkit-authoring/SKILL.md b/.claude/skills/toolkit-authoring/SKILL.md index 16dbb8b5..0c46f518 100644 --- a/.claude/skills/toolkit-authoring/SKILL.md +++ b/.claude/skills/toolkit-authoring/SKILL.md @@ -69,7 +69,7 @@ Non-negotiables in this repo: - **Silent when there is nothing to say.** A hook that fires on every edit trains people to ignore it. - **Test before wiring**, by piping realistic JSON: ```bash - echo '{"tool_input":{"file_path":"apps/chat-ui/src/api.ts"},"cwd":"'"$PWD"'"}' \ + echo '{"tool_input":{"file_path":"apps/web/src/api/client.ts"},"cwd":"'"$PWD"'"}' \ | .claude/hooks/impact-reminder.sh ``` - `chmod +x` the script, use `"$CLAUDE_PROJECT_DIR"` for paths, and remember that a blocking gate diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 53612d79..5c4e4085 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -87,7 +87,7 @@ jobs: if: ${{ !cancelled() }} run: pnpm build env: - FELIX_OPENAPI_SPEC: ${{ github.workspace }}/apps/chat-ui/harness-openapi.json + FELIX_OPENAPI_SPEC: ${{ github.workspace }}/apps/web/harness-openapi.json # What chat-ui loads before it can draw anything. KaTeX and rehype-raw each # rode into it on one static import inside a dependency, and nothing above diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 02f38e13..f970c63d 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,6 +1,6 @@ name: Deploy -# Deploys the two Workers: docs.felix.run (apps/docs) and make.felix.run (apps/chat-ui). +# Deploys the two Workers: docs.felix.run (apps/docs) and make.felix.run (apps/web). # # - After CI passes on a push to main: both, from exactly the commit CI checked. # - On `felix-deployed` from felix-run/ops, sent after it rolls api.felix.run to a new @@ -28,7 +28,7 @@ on: app: description: Which Worker to deploy type: choice - options: [both, docs, chat-ui] + options: [both, docs, web] default: both permissions: @@ -49,7 +49,7 @@ jobs: ${{ fromJSON( github.event_name == 'repository_dispatch' && '["docs"]' || (github.event_name == 'workflow_dispatch' && inputs.app != 'both') && format('["{0}"]', inputs.app) || - '["docs", "chat-ui"]' + '["docs", "web"]' ) }} runs-on: ubuntu-latest timeout-minutes: 15 diff --git a/.gitignore b/.gitignore index 11973725..510388b3 100644 --- a/.gitignore +++ b/.gitignore @@ -15,7 +15,7 @@ packages/harness/src/skills/bundled.ts wrangler.jsonc # Docs + chat-ui checked-in configs use vars only (no account ids). !apps/docs/wrangler.jsonc -!apps/chat-ui/wrangler.jsonc +!apps/web/wrangler.jsonc # Astro / Starlight build cache apps/docs/.astro/ @@ -46,4 +46,4 @@ apps/docs/public/api-version.txt .impeccable/critique/ # Written and removed by scripts/check-tailwind-sources.mjs; only survives a killed run. -apps/chat-ui/src/.check-tailwind-sources.tmp.css +apps/web/src/styles/.check-tailwind-sources.tmp.css diff --git a/.impeccable/critique/2026-08-23T22-38-55Z__apps-chat-ui-src.md b/.impeccable/critique/2026-08-23T22-38-55Z__apps-chat-ui-src.md index 992dcb75..d252d759 100644 --- a/.impeccable/critique/2026-08-23T22-38-55Z__apps-chat-ui-src.md +++ b/.impeccable/critique/2026-08-23T22-38-55Z__apps-chat-ui-src.md @@ -8,7 +8,7 @@ slug: apps-chat-ui-src --- # Critique: chat-ui (whole app) -Target `apps/chat-ui/src`, inspected live against the harness on `:8080`. The previous critique scoped to the two rails; this one covers the surfaces that work never touched: composer, transcript, tool cards, greeting, and the interrupt banners. +Target `apps/web/src`, inspected live against the harness on `:8080`. The previous critique scoped to the two rails; this one covers the surfaces that work never touched: composer, transcript, tool cards, greeting, and the interrupt banners. ## Design Health Score @@ -30,7 +30,7 @@ Up from 18/40. The eight points came from the rails work; the remaining debt sit ## Anti-Patterns Verdict -**Deterministic scan:** `detect.mjs` over `apps/chat-ui/src` returns **0 findings**, as it did last time. No gradient text, no side stripes, no purple-cyan palette, no hero metrics. +**Deterministic scan:** `detect.mjs` over `apps/web/src` returns **0 findings**, as it did last time. No gradient text, no side stripes, no purple-cyan palette, no hero metrics. **LLM assessment:** one genuine tell has become systemic. `text-xs font-medium uppercase tracking-wide text-muted-foreground` now appears **13 times across 9 files**: the greeting's manifest name, both interrupt banners, the banner's Before/After labels, tool card Input/Output, the history rail's Server group, and four sheets. That recipe is the app's default answer to "this is a label", which is exactly the point at which a kicker stops being voice and becomes grammar. It is also, at 11px uppercase and tracked, the least readable text in the product. diff --git a/.impeccable/critique/2026-08-24T00-58-29Z__s-chat-ui-src-components-chat-multimodal-input-tsx.md b/.impeccable/critique/2026-08-24T00-58-29Z__s-chat-ui-src-components-chat-multimodal-input-tsx.md index 50ebaec4..693a020d 100644 --- a/.impeccable/critique/2026-08-24T00-58-29Z__s-chat-ui-src-components-chat-multimodal-input-tsx.md +++ b/.impeccable/critique/2026-08-24T00-58-29Z__s-chat-ui-src-components-chat-multimodal-input-tsx.md @@ -8,7 +8,7 @@ slug: s-chat-ui-src-components-chat-multimodal-input-tsx --- # Critique: the composer -Target `apps/chat-ui/src/components/chat/multimodal-input.tsx` (672 lines) and the `prompt-input` primitive it wraps (1,175). Driven live against the harness on `:8080`. +Target `apps/web/src/components/chat/multimodal-input.tsx` (672 lines) and the `prompt-input` primitive it wraps (1,175). Driven live against the harness on `:8080`. ## Design Health Score diff --git a/.impeccable/critique/2026-08-25T21-25-51Z__pps-chat-ui-src-components-inspector-inspector-tsx.md b/.impeccable/critique/2026-08-25T21-25-51Z__pps-chat-ui-src-components-inspector-inspector-tsx.md index bbed1880..6c382148 100644 --- a/.impeccable/critique/2026-08-25T21-25-51Z__pps-chat-ui-src-components-inspector-inspector-tsx.md +++ b/.impeccable/critique/2026-08-25T21-25-51Z__pps-chat-ui-src-components-inspector-inspector-tsx.md @@ -8,7 +8,7 @@ slug: pps-chat-ui-src-components-inspector-inspector-tsx --- # Design Critique — Inspector › Activity -**Target**: `apps/chat-ui/src/components/inspector/inspector.tsx` (lines 46–523: `ActivitySection`, `StatusDot`, `toolOf`, `summary`, `relTime`, and the `Section` / `SectionBody` shell it inherits) +**Target**: `apps/web/src/components/inspector/inspector.tsx` (lines 46–523: `ActivitySection`, `StatusDot`, `toolOf`, `summary`, `relTime`, and the `Section` / `SectionBody` shell it inherits) **Register**: product · **Assessment A**: source review against PRODUCT.md · **Assessment B**: deterministic detector ## Design Health Score @@ -59,7 +59,7 @@ Biggest opportunity: the 12-row cap can hide exactly the events the color system **Fix**: Add `summary()` arms for the three unhandled types. `guardrail_block` → rule/policy name plus blocked tool. `model_switch` → `from → to`. `plan_step` → step label plus new status. Verify payload keys against the harness. -**Suggested command**: `/impeccable clarify apps/chat-ui/src/components/inspector/inspector.tsx` +**Suggested command**: `/impeccable clarify apps/web/src/components/inspector/inspector.tsx` ### [P1] The header count and the screen-reader announcement are both the fetch cap @@ -69,7 +69,7 @@ Biggest opportunity: the 12-row cap can hide exactly the events the color system **Fix**: Make the header meta a signal — count of failed/blocked events in the window with `metaTone="attention"` when non-zero, falling back to the newest event's age when clean. Request `limit: 61` and render `60+`, or relabel the footer "Showing 12 of the last 60". Derive the live-region string from something that moves. -**Suggested command**: `/impeccable harden apps/chat-ui/src/components/inspector/inspector.tsx` +**Suggested command**: `/impeccable harden apps/web/src/components/inspector/inspector.tsx` ### [P1] Twelve rows, no filter, no drill-down — and the API already supports the filter @@ -79,7 +79,7 @@ Biggest opportunity: the 12-row cap can hide exactly the events the color system **Fix**: Failures-only toggle in the section header wired to the existing `status` parameter. Expandable rows in place (`Collapsible` is already imported) or route to the agent sheet. Raise or make the 12-row cap adjustable once the footer tells the truth. -**Suggested command**: `/impeccable layout apps/chat-ui/src/components/inspector/inspector.tsx` +**Suggested command**: `/impeccable layout apps/web/src/components/inspector/inspector.tsx` ### [P2] Status vocabulary is passed through raw, and `capitalize`d @@ -89,7 +89,7 @@ Biggest opportunity: the 12-row cap can hide exactly the events the color system **Fix**: Map raw status onto a display vocabulary — Succeeded / Failed / Denied / Running / Pending — with an explicit `running` branch painting `--state-running`; keep the raw string in a `title`. Drop `capitalize`. -**Suggested command**: `/impeccable clarify apps/chat-ui/src/components/inspector/inspector.tsx` +**Suggested command**: `/impeccable clarify apps/web/src/components/inspector/inspector.tsx` ### [P2] Four of seven help strings can never render, and the three that can need a mouse @@ -99,7 +99,7 @@ Biggest opportunity: the 12-row cap can hide exactly the events the color system **Fix**: Either surface the type on every row (quiet unbadged label for routine types, tonal badge for exceptions) so all seven strings have somewhere to live, or move help out of `title` into a real tooltip primitive with focus and touch support. Delete entries that genuinely have no place. -**Suggested command**: `/impeccable polish apps/chat-ui/src/components/inspector/inspector.tsx` +**Suggested command**: `/impeccable polish apps/web/src/components/inspector/inspector.tsx` ## Persona Red Flags diff --git a/.impeccable/critique/2026-09-01T21-30-36Z__apps-chat-ui-src-main-tsx-toaster-toast-call-sites.md b/.impeccable/critique/2026-09-01T21-30-36Z__apps-chat-ui-src-main-tsx-toaster-toast-call-sites.md index e2cd95dc..68efe432 100644 --- a/.impeccable/critique/2026-09-01T21-30-36Z__apps-chat-ui-src-main-tsx-toaster-toast-call-sites.md +++ b/.impeccable/critique/2026-09-01T21-30-36Z__apps-chat-ui-src-main-tsx-toaster-toast-call-sites.md @@ -30,7 +30,7 @@ Scoped to the notification layer (the `` in `main.tsx` and the 30 `toas The specific failure is the register clash. `approval-decision.tsx` is careful work: the comments argue about button emphasis, fold thresholds, and reading order. Three files away, the app's most attention-grabbing element is a vendor default. -**Deterministic scan.** `detect.mjs --json` over `apps/chat-ui/src` returned `[]`, exit 0. Clean, and correctly so. It is also structurally blind here: the entire visual surface of the toast lives in `node_modules/sonner/dist/styles.css`, which no repo-scoped scan will reach. This is worth naming as a pattern. The repo has four bespoke guards for contracts that fail silently (`check-api-drift`, `check-protocol-parity`, `check-payload-shapes`, `check-tailwind-sources`), and the toast layer is the same failure shape with no guard: it compiles, lints, passes every check, and renders wrong. +**Deterministic scan.** `detect.mjs --json` over `apps/web/src` returned `[]`, exit 0. Clean, and correctly so. It is also structurally blind here: the entire visual surface of the toast lives in `node_modules/sonner/dist/styles.css`, which no repo-scoped scan will reach. This is worth naming as a pattern. The repo has four bespoke guards for contracts that fail silently (`check-api-drift`, `check-protocol-parity`, `check-payload-shapes`, `check-tailwind-sources`), and the toast layer is the same failure shape with no guard: it compiles, lints, passes every check, and renders wrong. **Browser evidence.** Live measurement in Chrome against a real harness, dark theme active: diff --git a/.impeccable/critique/2026-09-02T02-57-25Z__apps-chat-ui-src-main-tsx-toaster-toast-call-sites.md b/.impeccable/critique/2026-09-02T02-57-25Z__apps-chat-ui-src-main-tsx-toaster-toast-call-sites.md index 015e9b99..1ce0ff01 100644 --- a/.impeccable/critique/2026-09-02T02-57-25Z__apps-chat-ui-src-main-tsx-toaster-toast-call-sites.md +++ b/.impeccable/critique/2026-09-02T02-57-25Z__apps-chat-ui-src-main-tsx-toaster-toast-call-sites.md @@ -28,7 +28,7 @@ Re-run after five merged PRs (#112, #113, #114, #115, #116). Same target, same s **LLM assessment.** The register clash is gone. The toast reads as part of this app: its own state tokens, its own font and radius, 200ms motion, and a surface sitting 1.29:1 above the page rather than 18.97:1. The previous verdict was that this layer was *undesigned* rather than AI-generated; it is now designed, and the reasoning is in the file rather than in a PR description. -**Deterministic scan.** `detect.mjs --json apps/chat-ui/src` returns **3 findings, all in `index.css`, and all three are false positives**: +**Deterministic scan.** `detect.mjs --json apps/web/src` returns **3 findings, all in `index.css`, and all three are false positives**: - `flat-type-hierarchy` (12/14/16px, 1.3:1) reads the token block. The product register asks for 1.125–1.2 between steps in app UI; 1.3 already exceeds it. Wrong register applied to a product surface. - `em-dash-overuse` (210) counts **CSS comments**, not copy. This file is deliberately heavy on prose comments and that is the house style. diff --git a/.impeccable/critique/2026-09-26T14-01-32Z__apps-chat-ui-src.md b/.impeccable/critique/2026-09-26T14-01-32Z__apps-chat-ui-src.md index c3eed8ee..fdaa63d2 100644 --- a/.impeccable/critique/2026-09-26T14-01-32Z__apps-chat-ui-src.md +++ b/.impeccable/critique/2026-09-26T14-01-32Z__apps-chat-ui-src.md @@ -5,7 +5,7 @@ max_score: 40 na_heuristics: p0_count: 0 p1_count: 3 -target_identity: "file:/Users/blake/Projects/felix-web/apps/chat-ui/src" +target_identity: "file:/Users/blake/Projects/felix-web/apps/web/src" timestamp: 2026-09-26T14-01-32Z slug: apps-chat-ui-src --- diff --git a/.impeccable/critique/2026-09-26T16-06-16Z__apps-chat-ui-src.md b/.impeccable/critique/2026-09-26T16-06-16Z__apps-chat-ui-src.md index a1ebd428..3a773a40 100644 --- a/.impeccable/critique/2026-09-26T16-06-16Z__apps-chat-ui-src.md +++ b/.impeccable/critique/2026-09-26T16-06-16Z__apps-chat-ui-src.md @@ -5,7 +5,7 @@ max_score: 40 na_heuristics: p0_count: 1 p1_count: 2 -target_identity: "file:/Users/blake/Projects/felix-web/apps/chat-ui/src" +target_identity: "file:/Users/blake/Projects/felix-web/apps/web/src" timestamp: 2026-09-26T16-06-16Z slug: apps-chat-ui-src --- diff --git a/.impeccable/critique/2026-09-27T14-05-51Z__apps-chat-ui-src.md b/.impeccable/critique/2026-09-27T14-05-51Z__apps-chat-ui-src.md index ef9e93e4..ce7cad72 100644 --- a/.impeccable/critique/2026-09-27T14-05-51Z__apps-chat-ui-src.md +++ b/.impeccable/critique/2026-09-27T14-05-51Z__apps-chat-ui-src.md @@ -5,7 +5,7 @@ max_score: 40 na_heuristics: p0_count: 0 p1_count: 2 -target_identity: "file:/Users/blake/Projects/felix-web/apps/chat-ui/src" +target_identity: "file:/Users/blake/Projects/felix-web/apps/web/src" timestamp: 2026-09-27T14-05-51Z slug: apps-chat-ui-src --- diff --git a/.impeccable/design.json b/.impeccable/design.json index a2c99685..c620d0c2 100644 --- a/.impeccable/design.json +++ b/.impeccable/design.json @@ -659,7 +659,7 @@ }, { "name": "The Two-Client Rule", - "body": "The ramp is authored as `oklch()` in `apps/chat-ui/src/index.css` and frozen as sRGB hex in `packages/design/src/tokens.ts`, because neither a terminal nor `RGBA.fromHex` takes `oklch()`. `pnpm check-state-palette` fails when they disagree. The stylesheet is the authored form; never edit the hex to match a change.", + "body": "The ramp is authored as `oklch()` in `apps/web/src/styles/index.css` and frozen as sRGB hex in `packages/design/src/tokens.ts`, because neither a terminal nor `RGBA.fromHex` takes `oklch()`. `pnpm check-state-palette` fails when they disagree. The stylesheet is the authored form; never edit the hex to match a change.", "section": "colors" }, { diff --git a/CLAUDE.md b/CLAUDE.md index 1da94b15..79d77250 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -11,7 +11,7 @@ in this repo beyond one thin proxy Worker. | Path | Role | |---|---| -| `apps/chat-ui` (`@felix/chat-ui`) | Full streaming chat + harness inspector (React/Vite → Worker) | +| `apps/web` (`@felix/web`) | Full streaming chat + harness inspector (React/Vite → Worker) | | `apps/tui` (`@felix/tui`) | Full-screen terminal chat client (OpenTUI → Bun) | | `apps/docs` (`@felix/docs`) | Starlight docs site → Workers static assets | | `packages/ui` (`@felix/ui`) | shadcn/ui primitives, consumed as raw `.tsx` source | @@ -27,7 +27,7 @@ in this repo beyond one thin proxy Worker. ```bash pnpm install -pnpm chat:dev # Vite :5173 — /api/* proxied to Python Felix on :8080 +pnpm web:dev # Vite :5173 — /api/* proxied to Python Felix on :8080 pnpm tui:dev # terminal client, straight to FELIX_ORIGIN (default :8080) pnpm docs:dev pnpm build # turbo run build (tsc -b && vite build; astro build) @@ -44,7 +44,7 @@ pnpm check-bundle-budget # chat-ui's first load (entry + preloads + CSS, gzip pnpm sync:harness [path] # re-record all four contract files from a harness checkout pnpm sync:diagrams [path] # re-render the harness's docs/diagrams/*.mmd into apps/docs/src/diagrams (docs theme) pnpm sync:brand # re-render favicons, touch/PWA icons, docs logo + social card (needs rsvg-convert, magick) -pnpm --filter @felix/chat-ui