Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@gbasin/agentboard",
"version": "0.4.0",
"version": "0.4.1",
"type": "module",
"description": "Web GUI for tmux optimized for AI agent TUIs",
"author": "gbasin",
Expand All @@ -20,10 +20,10 @@
"bun": ">=1.3.14"
},
"optionalDependencies": {
"@gbasin/agentboard-darwin-arm64": "0.4.0",
"@gbasin/agentboard-darwin-x64": "0.4.0",
"@gbasin/agentboard-linux-x64": "0.4.0",
"@gbasin/agentboard-linux-arm64": "0.4.0"
"@gbasin/agentboard-darwin-arm64": "0.4.1",
"@gbasin/agentboard-darwin-x64": "0.4.1",
"@gbasin/agentboard-linux-x64": "0.4.1",
"@gbasin/agentboard-linux-arm64": "0.4.1"
},
"scripts": {
"dev": "concurrently -k \"bun run dev:server\" \"bun run dev:client\"",
Expand Down
17 changes: 13 additions & 4 deletions src/client/__tests__/useTerminal.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,14 @@ interface ListenerEntry {
capture: boolean
}

type MockTextarea = HTMLTextAreaElement & { focusCalls: number }

function createContainerMock() {
const textareaListeners = new Map<string, EventListener>()
const textareaState = { focusCalls: 0 }
const textarea = {
get focusCalls() { return textareaState.focusCalls },
set focusCalls(value: number) { textareaState.focusCalls = value },
addEventListener: (event: string, handler: EventListener) => {
textareaListeners.set(event, handler)
},
Expand All @@ -182,8 +187,10 @@ function createContainerMock() {
},
setAttribute: () => {},
removeAttribute: () => {},
focus: () => {},
} as unknown as HTMLTextAreaElement
focus: () => {
textareaState.focusCalls += 1
},
} as unknown as MockTextarea

// Store multiple listeners per event to support both bubble and capture phase
const listenerEntries = new Map<string, ListenerEntry[]>()
Expand Down Expand Up @@ -1782,7 +1789,7 @@ describe('useTerminal', () => {

const sendCalls: Array<Record<string, unknown>> = []
const listeners: Array<(message: ServerMessage) => void> = []
const { container, dispatchEvent } = createContainerMock()
const { container, dispatchEvent, textarea } = createContainerMock()
let preventDefaultCalls = 0
let stopPropagationCalls = 0

Expand Down Expand Up @@ -1838,6 +1845,7 @@ describe('useTerminal', () => {
sessionId: 'session-1',
data: '\x1b[<0;3;3M\x1b[<0;3;3m',
}])
expect((textarea as HTMLTextAreaElement & { focusCalls: number }).focusCalls).toBe(1)
expect(preventDefaultCalls).toBe(1)
expect(stopPropagationCalls).toBe(1)

Expand Down Expand Up @@ -1977,7 +1985,7 @@ describe('useTerminal', () => {

const sendCalls: Array<Record<string, unknown>> = []
const listeners: Array<(message: ServerMessage) => void> = []
const { container, dispatchEvent } = createContainerMock()
const { container, dispatchEvent, textarea } = createContainerMock()

let renderer!: TestRenderer.ReactTestRenderer
await act(async () => {
Expand Down Expand Up @@ -2027,6 +2035,7 @@ describe('useTerminal', () => {
})

expect(sendCalls.some((call) => call.type === 'terminal-input')).toBe(false)
expect((textarea as HTMLTextAreaElement & { focusCalls: number }).focusCalls).toBe(1)

act(() => {
renderer.unmount()
Expand Down
1 change: 1 addition & 0 deletions src/client/components/Terminal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -909,6 +909,7 @@ export default function Terminal({
if (appMouseRef.current) {
const touch = e.changedTouches[0]
if (touch && sendTapClickToApp(touch)) {
focusTerminalInput()
e.preventDefault()
e.stopPropagation()
return
Expand Down
Loading