1.6 KiB
1.6 KiB
Implementation Plan: Agent Visuals & Responsive Layout
1. In-Chat Agent Visuals
Goal: Make agent persona switches (e.g., [AGENT: Security]) visually distinct in the chat history.
- Modify
flattenMessagesToBlocks(bin/opencode-ink.mjs):- Regex match
\[AGENT:\s*([^\]]+)\]. - Create a new block type
{ type: 'agent_tag', name: 'Security' }.
- Regex match
- Add Test Case (
tests/tui-components.test.mjs):- Verify
flattenMessagesToBlockscorrectly splits[AGENT: Name]strings into blocks. - Run
node --experimental-vm-modules node_modules/jest/bin/jest.js tests/to verify.
- Verify
- Modify
ViewportMessage(bin/opencode-ink.mjs):- Handle
type === 'agent_tag'. - Render:
h(Box, { borderStyle: 'round', borderColor: 'magenta', paddingX: 1, marginTop: 1 }, h(Text, { color: 'magenta', bold: true }, '🤖 Security Agent') )
- Handle
2. Hardened Responsive Layout
Goal: Prevent text wrapping/overflow when resizing the terminal.
- Audit
markdown-ink-esm.mjs: Ensure it strictly respects thewidthprop. - Audit
ViewportMessage:- Ensure
widthprop passed to<Markdown>accounts for padding/gutters (e.g.,width={width - 4}). - Check
CodeCardwidth constraints.
- Ensure
- Verify
AppLayout:calculateViewportshould already be dynamic.- Ensure
useTerminalSizeis updating correctly.
Verification
- Run chat with "Using Security Agent...".
- Verify visible badge.
- Resize window narrower -> Text should wrap, not cut off.