From 9b22ec2cb71d39e4bf0c5f2543e81c6619f64233 Mon Sep 17 00:00:00 2001 From: Neil Date: Mon, 28 Sep 2026 00:32:50 -0700 Subject: [PATCH 1/5] feat(agents): add Freebuff terminal agent support --- README.md | 1 + config/scripts/locale-translation-policy.mjs | 1 + docs/readme/README.es.md | 1 + docs/readme/README.fr.md | 1 + docs/readme/README.ja.md | 1 + docs/readme/README.ko.md | 1 + docs/readme/README.pt.md | 1 + docs/readme/README.zh-CN.md | 1 + docs/site/content/docs/agents/supported.mdx | 1 + .../components/mobile-agent-icon-assets.ts | 1 + mobile/src/tasks/mobile-tui-agents.ts | 1 + .../index-worktree-create-freebuff.test.ts | 94 ++++++++++++++++++ src/main/ipc/freebuff-detection.test.ts | 38 +++++++ .../freebuff-remote-detection.test.ts | 31 ++++++ src/renderer/src/i18n/locales/en.json | 1 + src/renderer/src/lib/agent-catalog.tsx | 7 ++ src/renderer/src/lib/agent-favicon-assets.ts | 2 + src/renderer/src/lib/agent-status.ts | 1 + src/shared/agent-icons/freebuff.png | Bin 0 -> 4433 bytes src/shared/agent-kind.ts | 1 + src/shared/freebuff-launch.test.ts | 58 +++++++++++ src/shared/freebuff-startup.test.ts | 56 +++++++++++ src/shared/skills-cli-agent-keys.ts | 1 + src/shared/telemetry-property-schemas.ts | 1 + src/shared/tui-agent-config.ts | 4 + src/shared/tui-agent-display-names.ts | 1 + src/shared/tui-agent-selection.ts | 1 + src/shared/tui-agent.ts | 1 + 28 files changed, 309 insertions(+) create mode 100644 src/cli/index-worktree-create-freebuff.test.ts create mode 100644 src/main/ipc/freebuff-detection.test.ts create mode 100644 src/main/preflight/freebuff-remote-detection.test.ts create mode 100644 src/shared/agent-icons/freebuff.png create mode 100644 src/shared/freebuff-launch.test.ts create mode 100644 src/shared/freebuff-startup.test.ts diff --git a/README.md b/README.md index 708d3311bb28..e8722108c200 100644 --- a/README.md +++ b/README.md @@ -196,6 +196,7 @@ Works with **any CLI agent** — if it runs in a terminal, it runs in Orca. Charm logo Charm   Cline logo Cline   Codebuff logo Codebuff   + Freebuff logo Freebuff   Command Code logo Command Code   Continue logo Continue   Droid logo Droid   diff --git a/config/scripts/locale-translation-policy.mjs b/config/scripts/locale-translation-policy.mjs index af88805b8c4b..75f50d15ff62 100644 --- a/config/scripts/locale-translation-policy.mjs +++ b/config/scripts/locale-translation-policy.mjs @@ -38,6 +38,7 @@ export const NEVER_TRANSLATE_VALUES = new Set([ 'Claude Agent Teams', 'Cline', 'Codebuff', + 'Freebuff', 'Codex', 'Command Code', 'Cursor', diff --git a/docs/readme/README.es.md b/docs/readme/README.es.md index 6cc98d698c58..17ec41e82949 100644 --- a/docs/readme/README.es.md +++ b/docs/readme/README.es.md @@ -194,6 +194,7 @@ Funciona con **cualquier agente CLI** — si corre en una terminal, corre en Orc Charm logo Charm   Cline logo Cline   Codebuff logo Codebuff   + Freebuff logo Freebuff   Command Code logo Command Code   Continue logo Continue   Droid logo Droid   diff --git a/docs/readme/README.fr.md b/docs/readme/README.fr.md index 69e97b984908..1c7713bffd7d 100644 --- a/docs/readme/README.fr.md +++ b/docs/readme/README.fr.md @@ -200,6 +200,7 @@ Fonctionne avec **n'importe quel agent CLI** — s'il tourne dans un terminal, i Logo Charm Charm   Logo Cline Cline   Logo Codebuff Codebuff   + Logo Freebuff Freebuff   Logo Command Code Command Code   Logo Continue Continue   Logo Droid Droid   diff --git a/docs/readme/README.ja.md b/docs/readme/README.ja.md index 975cb65d485f..ed37efa595f1 100644 --- a/docs/readme/README.ja.md +++ b/docs/readme/README.ja.md @@ -194,6 +194,7 @@ PR、Issue、プロジェクトボードをアプリ内で閲覧 — 任意の Charm logo Charm   Cline logo Cline   Codebuff logo Codebuff   + Freebuff logo Freebuff   Command Code logo Command Code   Continue logo Continue   Droid logo Droid   diff --git a/docs/readme/README.ko.md b/docs/readme/README.ko.md index 8e4ded59bff9..ab6d5c50eba6 100644 --- a/docs/readme/README.ko.md +++ b/docs/readme/README.ko.md @@ -196,6 +196,7 @@ diff의 어느 줄에든 코멘트를 남기고 에이전트에게 바로 보내 Charm logo Charm   Cline logo Cline   Codebuff logo Codebuff   + Freebuff logo Freebuff   Command Code logo Command Code   Continue logo Continue   Droid logo Droid   diff --git a/docs/readme/README.pt.md b/docs/readme/README.pt.md index 8e3a13d898db..4ade6ad6e41f 100644 --- a/docs/readme/README.pt.md +++ b/docs/readme/README.pt.md @@ -196,6 +196,7 @@ Funciona com **qualquer agente CLI** — se roda em um terminal, roda no Orca. Logotipo do Charm Charm   Logotipo do Cline Cline   Logotipo do Codebuff Codebuff   + Logotipo do Freebuff Freebuff   Logotipo do Command Code Command Code   Logotipo do Continue Continue   Logotipo do Droid Droid   diff --git a/docs/readme/README.zh-CN.md b/docs/readme/README.zh-CN.md index f7828f9e06de..54583f4777b7 100644 --- a/docs/readme/README.zh-CN.md +++ b/docs/readme/README.zh-CN.md @@ -194,6 +194,7 @@ VS Code 的编辑器,处处自动保存 — 把文件或图片直接拖入智 Charm logo Charm   Cline logo Cline   Codebuff logo Codebuff   + Freebuff logo Freebuff   Command Code logo Command Code   Continue logo Continue   Droid logo Droid   diff --git a/docs/site/content/docs/agents/supported.mdx b/docs/site/content/docs/agents/supported.mdx index 6b6a0d143a0e..0658ce6fd8c3 100644 --- a/docs/site/content/docs/agents/supported.mdx +++ b/docs/site/content/docs/agents/supported.mdx @@ -46,6 +46,7 @@ To restore prompts for one agent only, edit that agent's default arguments or en | Autohand | Auto-setup | [Autohand](https://github.com/autohandai/code-cli) | | Cline | Auto-setup | [Cline](https://docs.cline.bot/cline-cli/overview) | | Codebuff | Auto-setup | [Codebuff](https://www.codebuff.com/docs/help/quick-start) | +| Freebuff | Auto-setup | [Freebuff](https://freebuff.com/cli) | | Command Code | Auto-setup, status | [Command Code](https://commandcode.ai/docs/quickstart) | | Muse | macOS/Linux; trusts the workspace at launch | [Meta](https://dev.meta.ai/docs/muse-code) | | DeepSeek Harness | Launched through its `dsh-tui` profile; hooks, status, questions, resume | [DeepSeek](https://deepseek-harness.github.io/deepseek-harness/) | diff --git a/mobile/src/components/mobile-agent-icon-assets.ts b/mobile/src/components/mobile-agent-icon-assets.ts index 687c9d5824e6..5a80fedb6758 100644 --- a/mobile/src/components/mobile-agent-icon-assets.ts +++ b/mobile/src/components/mobile-agent-icon-assets.ts @@ -29,6 +29,7 @@ export const MOBILE_AGENT_ICON_ASSETS: Partial> autohand: 'autohand.ai', cline: 'cline.bot', codebuff: 'codebuff.com', + freebuff: 'freebuff.com', 'command-code': 'commandcode.ai', continue: 'continue.dev', cursor: 'cursor.com', diff --git a/src/cli/index-worktree-create-freebuff.test.ts b/src/cli/index-worktree-create-freebuff.test.ts new file mode 100644 index 000000000000..aab4b17c36e0 --- /dev/null +++ b/src/cli/index-worktree-create-freebuff.test.ts @@ -0,0 +1,94 @@ +import { describe, expect, it, vi } from 'vitest' + +const { + callMock, + runtimeClientConstructorMock, + serveOrcaAppMock, + getDefaultUserDataPathMock, + addEnvironmentFromPairingCodeMock, + listEnvironmentsMock, + spawnMock +} = vi.hoisted(() => ({ + callMock: vi.fn(), + runtimeClientConstructorMock: vi.fn(), + serveOrcaAppMock: vi.fn(), + getDefaultUserDataPathMock: vi.fn(() => '/tmp/orca-user-data'), + addEnvironmentFromPairingCodeMock: vi.fn(), + listEnvironmentsMock: vi.fn(), + spawnMock: vi.fn() +})) + +vi.mock('./runtime-client', async () => { + const { createRuntimeClientModuleMock } = await import('./index-test-harness.js') + return createRuntimeClientModuleMock({ + callMock, + runtimeClientConstructorMock, + serveOrcaAppMock, + getDefaultUserDataPathMock + }) +}) + +vi.mock('./runtime/environments', () => ({ + addEnvironmentFromPairingCode: addEnvironmentFromPairingCodeMock, + listEnvironments: listEnvironmentsMock, + removeEnvironment: vi.fn(), + resolveEnvironment: vi.fn() +})) + +vi.mock('child_process', async () => { + const { createChildProcessModuleMock } = await import('./index-test-harness.js') + return createChildProcessModuleMock(spawnMock) +}) + +import { main } from './index' +import { buildWorktree, okFixture, queueFixtures, worktreeListFixture } from './test-fixtures' +import { useWorktreeAwarenessEnvironment } from './index-test-harness' + +describe('Freebuff worktree creation', () => { + useWorktreeAwarenessEnvironment({ + callMock, + serveOrcaAppMock, + getDefaultUserDataPathMock, + addEnvironmentFromPairingCodeMock, + listEnvironmentsMock, + spawnMock + }) + + it('passes Freebuff and its prompt to the runtime without activating the worktree', async () => { + queueFixtures( + callMock, + worktreeListFixture([buildWorktree('/tmp/repo', 'main', 'abc', 'repo-1')]), + okFixture('req_create', { + worktree: buildWorktree('/tmp/repo/freebuff-task', 'freebuff-task', 'abc', 'repo-1') + }) + ) + vi.spyOn(console, 'log').mockImplementation(() => {}) + + await main( + [ + 'worktree', + 'create', + '--repo', + 'id:repo-1', + '--name', + 'freebuff-task', + '--agent', + 'freebuff', + '--prompt', + 'Review this workspace', + '--json' + ], + '/tmp/repo' + ) + + expect(callMock).toHaveBeenNthCalledWith( + 2, + 'worktree.create', + expect.objectContaining({ + startupAgent: 'freebuff', + startupPrompt: 'Review this workspace', + activate: false + }) + ) + }) +}) diff --git a/src/main/ipc/freebuff-detection.test.ts b/src/main/ipc/freebuff-detection.test.ts new file mode 100644 index 000000000000..6c74e6409b5f --- /dev/null +++ b/src/main/ipc/freebuff-detection.test.ts @@ -0,0 +1,38 @@ +import { describe, expect, it } from 'vitest' +import { + getTuiAgentDetectionProbeCommands, + KNOWN_TUI_AGENT_DETECTION_COMMANDS, + resolveDetectedTuiAgentIds +} from './tui-agent-detection-commands' + +describe('Freebuff detection', () => { + it.each(['darwin', 'linux', 'win32', 'wsl'] as const)( + 'detects Freebuff independently of Codebuff on %s', + (runtime) => { + expect( + getTuiAgentDetectionProbeCommands(KNOWN_TUI_AGENT_DETECTION_COMMANDS, runtime) + ).toContain('freebuff') + expect( + resolveDetectedTuiAgentIds( + KNOWN_TUI_AGENT_DETECTION_COMMANDS, + new Set(['freebuff']), + runtime + ) + ).toEqual(['freebuff']) + expect( + resolveDetectedTuiAgentIds( + KNOWN_TUI_AGENT_DETECTION_COMMANDS, + new Set(['codebuff']), + runtime + ) + ).toEqual(['codebuff']) + expect( + resolveDetectedTuiAgentIds( + KNOWN_TUI_AGENT_DETECTION_COMMANDS, + new Set(['freebuff', 'codebuff']), + runtime + ) + ).toEqual(expect.arrayContaining(['freebuff', 'codebuff'])) + } + ) +}) diff --git a/src/main/preflight/freebuff-remote-detection.test.ts b/src/main/preflight/freebuff-remote-detection.test.ts new file mode 100644 index 000000000000..de8408da088f --- /dev/null +++ b/src/main/preflight/freebuff-remote-detection.test.ts @@ -0,0 +1,31 @@ +import { afterEach, describe, expect, it, vi } from 'vitest' + +const { getActiveMultiplexerMock } = vi.hoisted(() => ({ + getActiveMultiplexerMock: vi.fn() +})) + +vi.mock('../ssh/ssh-target-registry', () => ({ + getActiveMultiplexer: getActiveMultiplexerMock +})) + +import { detectRemoteAgents } from './agent-detection' + +afterEach(() => vi.resetAllMocks()) + +describe('Freebuff SSH detection', () => { + it('asks the execution host to detect Freebuff separately from Codebuff', async () => { + const request = vi.fn().mockResolvedValue({ agents: ['freebuff'] }) + getActiveMultiplexerMock.mockReturnValue({ isDisposed: () => false, request }) + + await expect(detectRemoteAgents({ connectionId: 'ssh-freebuff' })).resolves.toEqual([ + 'freebuff' + ]) + expect(getActiveMultiplexerMock).toHaveBeenCalledWith('ssh-freebuff') + expect(request).toHaveBeenCalledWith('preflight.detectAgents', { + commands: expect.arrayContaining([ + { id: 'freebuff', cmd: 'freebuff' }, + { id: 'codebuff', cmd: 'codebuff' } + ]) + }) + }) +}) diff --git a/src/renderer/src/i18n/locales/en.json b/src/renderer/src/i18n/locales/en.json index a90c49d9bfea..ed00bfc9c727 100644 --- a/src/renderer/src/i18n/locales/en.json +++ b/src/renderer/src/i18n/locales/en.json @@ -586,6 +586,7 @@ "9e2a9bb87b": "Continue", "6f8056a565": "Command Code", "4238b771b5": "Codebuff", + "freebuff_label": "Freebuff", "cbaf0c2e0b": "Cline", "1f8a19e9ad": "Autohand Code", "5e8eff11b3": "Auggie", diff --git a/src/renderer/src/lib/agent-catalog.tsx b/src/renderer/src/lib/agent-catalog.tsx index f53dea7e3ebe..0ba7d7332cea 100644 --- a/src/renderer/src/lib/agent-catalog.tsx +++ b/src/renderer/src/lib/agent-catalog.tsx @@ -249,6 +249,13 @@ export const getAgentCatalog = createLocalizedCatalog((): AgentCatalogEntry[] => faviconDomain: 'codebuff.com', homepageUrl: 'https://www.codebuff.com/docs/help/quick-start' }, + { + id: 'freebuff', + label: translate('auto.lib.agent.catalog.freebuff_label', 'Freebuff'), + cmd: 'freebuff', + faviconDomain: 'freebuff.com', + homepageUrl: 'https://freebuff.com/cli' + }, { id: 'command-code', label: translate('auto.lib.agent.catalog.6f8056a565', 'Command Code'), diff --git a/src/renderer/src/lib/agent-favicon-assets.ts b/src/renderer/src/lib/agent-favicon-assets.ts index f7d400e18db0..8cc36a9a70e5 100644 --- a/src/renderer/src/lib/agent-favicon-assets.ts +++ b/src/renderer/src/lib/agent-favicon-assets.ts @@ -13,6 +13,7 @@ import crushUrl from '../../../shared/agent-icons/crush.png?url' import augUrl from '../../../shared/agent-icons/aug.png?url' import autohandUrl from '../../../shared/agent-icons/autohand.png?url' import clineUrl from '../../../shared/agent-icons/cline.png?url' +import freebuffUrl from '../../../shared/agent-icons/freebuff.png?url' import codebuffUrl from '../../../shared/agent-icons/codebuff.png?url' import commandCodeUrl from '../../../shared/agent-icons/command-code.png?url' import continueUrl from '../../../shared/agent-icons/continue.png?url' @@ -51,6 +52,7 @@ export const AGENT_FAVICON_ASSETS: Partial> = { autohand: autohandUrl, cline: clineUrl, codebuff: codebuffUrl, + freebuff: freebuffUrl, 'command-code': commandCodeUrl, continue: continueUrl, cursor: cursorUrl, diff --git a/src/renderer/src/lib/agent-status.ts b/src/renderer/src/lib/agent-status.ts index f4286c97bad1..9a05ff92f4f4 100644 --- a/src/renderer/src/lib/agent-status.ts +++ b/src/renderer/src/lib/agent-status.ts @@ -120,6 +120,7 @@ const ICONABLE_AGENT_TYPES: Record = { aug: true, cline: true, codebuff: true, + freebuff: true, 'command-code': true, continue: true, cursor: true, diff --git a/src/shared/agent-icons/freebuff.png b/src/shared/agent-icons/freebuff.png new file mode 100644 index 0000000000000000000000000000000000000000..acb0e0aadde1e07b8f94d492fef54e412f8ad984 GIT binary patch literal 4433 zcmb_gX;f3!7Tz}rCJaJQswg0#gRo?5)hYrnvEYa@R0Wm>L2T8hBBK(4EQ*S#C@MmNkOqs805WEJ=O)X zc!Q}105E>ZVy{mDNT^8y+Bj4_=QNA}n3^x~n!l3ssH@pAV7<4+-qt{dIm_^U(rr>I zi*e|XsS%`lG3blgpN*qG)D6Bn4sGTY2BqD#t#9Ybf*XtP&&F4LzhW>| z>Gi<9^k|arylei^xkiVtf0p&tVMY6g@p_?WYLsl(+FLo9!xx^rGs|}L#&l(GsR=k& z(9U=&p-QhZSL1mW5~+A?icd?l$3yqB+-K5}N}pWS3G>sgj+X%d2P%UjOm6(j&#n z&iu(5K1}WWfSJjYNOu%#lq$iDD=EEVYa`Yck9O%ua^ZV+i4{)C_>=XajoX8M5qyx} zx+f8o3cWq~!v~6vhC5%7&q)S#Z+2>0(#D`_O{r-4Hjk57R(-g@voe6cZn9=wv=lQE ze%0NZ^Dc$01R8ewdbv{y95o{aH*RZqQjp|nvKWqT?QqjXkpT-u@X}Sjx%7(GL|MEVF+7owj))>SPlN7~FI2&rma!a?I{=`r#HE zKh-|K@)8%Y+O^P`bt*kjM zP|m4VsIbs?cqT;`YQcQO282tE0=Exa&r5=!Q`JG2@>TKom~ciNjCrfR7N#O^R+~F? z_KL=fdZ|!2d*r?_*jY&iXWF-la^oqm`ILpB@`oxnsuBDgTXr(S=y@pKhN=(yqun|sRZ=>}KQypGA2+1ZV1KOX%%nC^ z8kvGGO!#Kt7|GXa8q9k1bQb0k9SQZDPGmi?=UQ39ERk2pJCEZ+q2551B|f5=W@!#3 zm#YJrQzAv{FxKg3ihd>x%@jTuMs3a=84g%O#W>}tS|uZ-g+#nHj<>)*Q55A4znSh~`{ zuJ(`&0JrON!^Rnt;LDHXQvm!rHeyCr6fpa|!xINat$AC_KN#{*^-NB`<-g5lsY5uHiFztKk^NWvSa z04#I^D$vwSRIniH8&ojh#xhjUVZ(G(&|v2Ox9y*|_-6csYyYSdZ*$~ag4=(<+gu|I z;b##7q2Po#XhfrElB6+zeJ%(tis`Z=Vy1G)?6E3UguD0nQ09b<*(fAJA~yug7m zfS^lw<%2iY?A^Gh@QTDzPrE(sx~qX!gp)I4%(M@wZM#L}*AB#{bqD?pbcVL`9|LuFa2)L580)BN@djR5tI2VOW z+x`8#*T5lG|J8SN=n3s*jEr(!q`e^GC(*B^;RQ)A(LiwaO7~v@hhX^Chmw#>q(4P& zB#!bLB7}dYNlOH#<7LcvybOqtDDw5M$Brc!3LZnzzCUvp>2CI`yELu3C^+$0IXNLj z=&eihMij9?{A2=B2OSac^7KCZZB+U@X>_PF)!t;WrS8Fdbys^Xp%C+zZgmm|I832yf{f*@aDT0b_)tJ`(YJd|<)8#iWaustTzgfC{u%>=Ku>60lU^)>w zOx$tVqHl^0J2!=HCyctFLp$sjcz2gmzGm|QwwWrXI` z=OM^E4)@7QEr%`s+tt?Ezz7`rRFxBC6n=h2mAHsL~qh&tYP`a#xS)jHXDW} z2`m8CS|}fCL}9hTb6K$I`?RceiNzPgl#`iDpqv5~Z-PLV5 z9cEo_exIitEVG*D2b*?RXSFFO0T?K%xK(<9lQc3>1P1(ijbiWs;zpdI;e~e`#P|Vw z&+T3nVn5Whj?8jY=KgBW&2JW_qP9`k7pDcm9oN1i3zvG_?A_08nM8w@0jXXpi1%=L z5i^G+D7EzNw-;TqZ$4*D0f&204W9)P-wNb;_b>%2>ouJ|J{CN zB=Irg-?mEhNo?Cb3i?JVz8W!-=9;ope9?Lm+_<8e@vp9kM_s#bQ2~#y6me~*mY$6m zPrvM)Ml5nNZ@zzd-4N2%Va{I7KUQNNBhfN(<_ut>cOF0ShQ@rJz3LZ*P zGOKT%118Z*np;=e8sYnwIUI#)gIl7tyLxzEwgvz-+}D z&3B!yM+bIXnm<8G#Zr7HX zD-u4Bf_#Z { + it.each(['darwin', 'linux', 'win32'] as const)( + 'delivers task text through the interactive terminal on %s', + (platform) => { + const prompt = '--help\nFix "quoted" paths and $HOME handling' + const plan = buildAgentStartupPlan({ + agent: 'freebuff', + prompt, + cmdOverrides: {}, + platform + }) + expect(plan).toMatchObject({ + launchCommand: 'freebuff', + expectedProcess: 'freebuff', + followupPrompt: prompt + }) + expect( + buildAgentDraftLaunchPlan({ + agent: 'freebuff', + draft: prompt, + cmdOverrides: {}, + platform + }) + ).toBeNull() + } + ) + + it('uses the same launch contract on SSH hosts', () => { + expect( + buildAgentStartupPlan({ + agent: 'freebuff', + prompt: 'Inspect this folder', + cmdOverrides: {}, + platform: 'linux', + isRemote: true + }) + ).toMatchObject({ launchCommand: 'freebuff', followupPrompt: 'Inspect this folder' }) + }) + + it.each(['/usr/local/bin/freebuff', 'C:\\tools\\freebuff.exe'])( + 'recognizes %s separately from Codebuff', + (processName) => { + expect(recognizeAgentProcess(processName)?.agent).toBe('freebuff') + expect(isExpectedAgentProcess(processName, 'codebuff')).toBe(false) + } + ) + + it('honors independent installation and disabled-agent preferences', () => { + expect(pickTuiAgent('freebuff', ['freebuff', 'codebuff'])).toBe('freebuff') + expect(pickTuiAgent(null, ['freebuff'])).toBe('freebuff') + expect(pickTuiAgent('freebuff', ['freebuff', 'codebuff'], ['freebuff'])).toBe('codebuff') + }) +}) diff --git a/src/shared/freebuff-startup.test.ts b/src/shared/freebuff-startup.test.ts new file mode 100644 index 000000000000..2d614c53d1a4 --- /dev/null +++ b/src/shared/freebuff-startup.test.ts @@ -0,0 +1,56 @@ +import { describe, expect, it } from 'vitest' +import { buildAgentStartupPlan } from './tui-agent-startup' + +describe('Freebuff startup', () => { + it.each([ + ['darwin', 'posix', false], + ['linux', 'posix', false], + ['win32', 'powershell', false], + ['win32', 'cmd', false], + ['linux', 'posix', true] + ] as const)('delivers prompts after launch on %s/%s (remote=%s)', (platform, shell, isRemote) => { + const prompt = 'Review "quoted paths"; $(echo task)\nThen explain the changes.' + const plan = buildAgentStartupPlan({ + agent: 'freebuff', + prompt, + cmdOverrides: { codebuff: 'codebuff --debug' }, + platform, + shell, + isRemote + }) + + expect(plan).toMatchObject({ + agent: 'freebuff', + launchCommand: 'freebuff', + expectedProcess: 'freebuff', + followupPrompt: prompt + }) + }) + + it('keeps Freebuff command overrides separate from Codebuff', () => { + const cmdOverrides = { freebuff: 'freebuff --debug' } + const freebuff = buildAgentStartupPlan({ + agent: 'freebuff', + prompt: '', + allowEmptyPromptLaunch: true, + cmdOverrides, + platform: 'linux', + isRemote: true + }) + const codebuff = buildAgentStartupPlan({ + agent: 'codebuff', + prompt: '', + allowEmptyPromptLaunch: true, + cmdOverrides, + platform: 'linux', + isRemote: true + }) + + expect(freebuff).toMatchObject({ + launchCommand: 'freebuff --debug', + expectedProcess: 'freebuff', + followupPrompt: null + }) + expect(codebuff).toMatchObject({ launchCommand: 'codebuff', expectedProcess: 'codebuff' }) + }) +}) diff --git a/src/shared/skills-cli-agent-keys.ts b/src/shared/skills-cli-agent-keys.ts index 32d417f59c6c..ea4921acfc6c 100644 --- a/src/shared/skills-cli-agent-keys.ts +++ b/src/shared/skills-cli-agent-keys.ts @@ -35,6 +35,7 @@ export const SKILLS_CLI_AGENT_KEY_BY_TUI_AGENT = { aug: 'augment', cline: 'cline', codebuff: null, + freebuff: null, 'command-code': 'command-code', continue: 'continue', cursor: 'cursor', diff --git a/src/shared/telemetry-property-schemas.ts b/src/shared/telemetry-property-schemas.ts index 6629d32bd854..39735707dffa 100644 --- a/src/shared/telemetry-property-schemas.ts +++ b/src/shared/telemetry-property-schemas.ts @@ -30,6 +30,7 @@ export const AGENT_KIND_VALUES = [ 'aug', 'cline', 'codebuff', + 'freebuff', 'command-code', 'continue', 'cursor', diff --git a/src/shared/tui-agent-config.ts b/src/shared/tui-agent-config.ts index 1a4998d705bd..9ed1751bd66d 100644 --- a/src/shared/tui-agent-config.ts +++ b/src/shared/tui-agent-config.ts @@ -236,6 +236,10 @@ const TUI_AGENT_CONFIG_SOURCE: Record = { detectCmd: 'cline', promptInjectionMode: 'stdin-after-start' }, + freebuff: { + detectCmd: 'freebuff', + promptInjectionMode: 'stdin-after-start' + }, codebuff: { detectCmd: 'codebuff', promptInjectionMode: 'stdin-after-start' diff --git a/src/shared/tui-agent-display-names.ts b/src/shared/tui-agent-display-names.ts index 463c28ecbbaf..780db6440719 100644 --- a/src/shared/tui-agent-display-names.ts +++ b/src/shared/tui-agent-display-names.ts @@ -34,6 +34,7 @@ export const TUI_AGENT_DISPLAY_NAMES: Record = { aug: 'Auggie', cline: 'Cline', codebuff: 'Codebuff', + freebuff: 'Freebuff', 'command-code': 'Command Code', continue: 'Continue', cursor: 'Cursor', diff --git a/src/shared/tui-agent-selection.ts b/src/shared/tui-agent-selection.ts index 4189a9eefb83..1a5ce8702bd9 100644 --- a/src/shared/tui-agent-selection.ts +++ b/src/shared/tui-agent-selection.ts @@ -33,6 +33,7 @@ export const TUI_AGENT_AUTO_PICK_ORDER = [ 'autohand', 'cline', 'codebuff', + 'freebuff', 'command-code', 'continue', 'cursor', diff --git a/src/shared/tui-agent.ts b/src/shared/tui-agent.ts index 5e22426c7406..7c8be4c4cf06 100644 --- a/src/shared/tui-agent.ts +++ b/src/shared/tui-agent.ts @@ -22,6 +22,7 @@ export type TuiAgent = | 'aug' // Augment/Auggie | 'cline' // Cline | 'codebuff' // Codebuff + | 'freebuff' // Freebuff | 'command-code' // Command Code | 'continue' // Continue | 'cursor' // Cursor From 7ada23931bbafe7c25d2585856293f7faa2a0522 Mon Sep 17 00:00:00 2001 From: Neil Date: Mon, 28 Sep 2026 01:18:46 -0700 Subject: [PATCH 2/5] fix(agents): publish Freebuff sidebar lifecycle status --- .../__fixtures__/freebuff-lifecycle.meta.json | 9 ++ .../__fixtures__/freebuff-lifecycle.txt | 1 + .../__fixtures__/freebuff-login.meta.json | 9 ++ .../runtime/__fixtures__/freebuff-login.txt | 1 + .../__fixtures__/freebuff-ready.meta.json | 9 ++ .../runtime/__fixtures__/freebuff-ready.txt | 11 ++ .../__fixtures__/freebuff-trust.meta.json | 9 ++ .../runtime/__fixtures__/freebuff-trust.txt | 9 ++ .../freebuff-status-transcript.test.ts | 137 ++++++++++++++++ src/main/runtime/freebuff-terminal-status.ts | 25 +++ ...me-maybe-hydrate-headless-from-renderer.ts | 23 ++- src/relay/freebuff-status-projection.test.ts | 43 +++++ src/relay/freebuff-status-projection.ts | 45 ++++++ .../pty-handler-output-streaming.test.ts | 30 ++++ src/relay/pty-handler.ts | 14 +- src/shared/freebuff-screen-status.ts | 148 ++++++++++++++++++ 16 files changed, 519 insertions(+), 4 deletions(-) create mode 100644 src/main/runtime/__fixtures__/freebuff-lifecycle.meta.json create mode 100644 src/main/runtime/__fixtures__/freebuff-lifecycle.txt create mode 100644 src/main/runtime/__fixtures__/freebuff-login.meta.json create mode 100644 src/main/runtime/__fixtures__/freebuff-login.txt create mode 100644 src/main/runtime/__fixtures__/freebuff-ready.meta.json create mode 100644 src/main/runtime/__fixtures__/freebuff-ready.txt create mode 100644 src/main/runtime/__fixtures__/freebuff-trust.meta.json create mode 100644 src/main/runtime/__fixtures__/freebuff-trust.txt create mode 100644 src/main/runtime/freebuff-status-transcript.test.ts create mode 100644 src/main/runtime/freebuff-terminal-status.ts create mode 100644 src/relay/freebuff-status-projection.test.ts create mode 100644 src/relay/freebuff-status-projection.ts create mode 100644 src/shared/freebuff-screen-status.ts diff --git a/src/main/runtime/__fixtures__/freebuff-lifecycle.meta.json b/src/main/runtime/__fixtures__/freebuff-lifecycle.meta.json new file mode 100644 index 000000000000..57f6174485f2 --- /dev/null +++ b/src/main/runtime/__fixtures__/freebuff-lifecycle.meta.json @@ -0,0 +1,9 @@ +{ + "capturedAt": "2026-09-28T07:56:49.813Z", + "platform": "darwin", + "command": ["freebuff", "--cwd", "/tmp/orca-freebuff-folder-workspace"], + "cols": 120, + "rows": 40, + "note": "Freebuff 0.1.2 authenticated free plan; choice, answer, tool, interruption, tool error", + "exitCode": 0 +} diff --git a/src/main/runtime/__fixtures__/freebuff-lifecycle.txt b/src/main/runtime/__fixtures__/freebuff-lifecycle.txt new file mode 100644 index 000000000000..0f965581bceb --- /dev/null +++ b/src/main/runtime/__fixtures__/freebuff-lifecycle.txt @@ -0,0 +1 @@ +]11;?]10;?[?2031h]10;?]11;?[>0q[?25l[?1016$p[?2027$p[?2031$p[?1004$p[?2004$p[?2026$p[?u]99;i=opentui-notifications:p=?;\]1337;Capabilities\]66;w=1; \]66;s=2; \[?1049h[>4;1m[?2027h[?2004h[?1000h[?1002h[?1003h[?1006h]4;0;?[?2026h[?25l ███████████ ██ ▄████ ▄██  ███▀▀▀▀▀▀▀▀ ██ ██ ██▀  ███ █████ ██████ ▄█████ ▄████▄ ██████▄ ██ ██ ████████████  ███ ███▀▀ ██▀ ███▄▄▄██ ██▄▄▄███ ██ ▀██ ██ ██ ██ ██  ███ ███ ███ ███▀▀▀▀▀ ██▀▀▀▀▀ ██▄ ▄██ ██▄ ██ ██ ██  ███ ██▀ ██▀ ▀█████ ▀████▀ ██████▀ ▀████▀ ██ ██   ┌──────────────────────────────────────────────────────────────────┐  │ Your first message starts the session. │  │ Some models aren't available on this connection │  └──────────────────────────────────────────────────────────────────┘                       ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮│ ││ ▍Enter a coding task or / for commands ││ │╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ GLM 5.3 Flash • max · /private/tmp/orca-freebuff-folder-workspace · /model to change · Chat: New chat  ← for history · ? for help [?2026l[?1004h[?2026h[?25l│ 1 day streak │└──────────────────────────────────────────────────────────────────┘[?2026l[?2026h[?25l100/100 Freebucks remaining │ ││✦ Refer friends → earn Freebucks:││││⎘ Copy invite link Learn More ↵│└──────────────────────────────────────────────────────────────────┘[?2026l[?2026h[?25l ███████████ ██ ▄████ ▄██  ███▀▀▀▀▀▀▀▀ ██ ██ ██▀  ███ █████ ██████ ▄█████ ▄████▄ ██████▄ ██ ██ ████████████  ███ ███▀▀ ██▀ ███▄▄▄██ ██▄▄▄███ ██ ▀██ ██ ██ ██ ██  ███ ███ ███ ███▀▀▀▀▀ ██▀▀▀▀▀ ██▄ ▄██ ██▄ ██ ██ ██  ███ ██▀ ██▀ ▀█████ ▀████▀ ██████▀ ▀████▀ ██ ██   ┌──────────────────────────────────────────────────────────────────┐  │ Your first message starts the session. │  │ 100/100 Freebucks remaining │  │ 1 day streak │  │ │  │ ✦ Refer friends → earn Freebucks: │  │ │  │ ⎘ Copy invite link Learn More ↵ │  └──────────────────────────────────────────────────────────────────┘                  ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮│ ││ ▍Enter a coding task or / for commands ││ │╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ GLM 5.3 Flash • max · /private/tmp/orca-freebuff-folder-workspace · /model to change · Chat: New chat  ← for history · ? for help [?2026l[?2026h[?25l╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮│Geo Daniela — La primera IA de remuneraciones de Chile Ad││Liquidaciones PDF, Previred CSV, LRE CSV y portal del trabajador. Demo 30 min para PYME.││ Learn more geodaniela.cl│╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯[?2026l[?2026h[?25lUse ask_user to ask me to choose blue orgreen.Waitformyreply.Donotmodifyfiles.▍[?2026l]0;Freebuff: Use ask_user to ask me to choose blue or green. W…[?2026h[?25l ┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐│Starting your model session… Your message is saved.        ││Esc: back to draft│└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘[?2026l[?2026h[?25lSession active └──────────────────────────────────────────────────────────────────┘    [12:55 AM]  Use ask_user to ask me to choose blue or green. Wait for my reply. Do not modify files. ⎘ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮│Geo Daniela — La primera IA de remuneraciones de Chile Ad││ Liquidaciones PDF, Previred CSV, LRE CSV y portal del trabajador. Demo 30 min para PYME. │ Learn more  geodaniela.cl  ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ 44m left  ✕ End session ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮│││ ▍Enter a coding task or / for commands ││ │╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ GLM 5.3 Flash • max · /private/tmp/orca-freebuff-folder-workspace · /model to change · Chat: Use ask_user to ask me to choose blue or green.Wait for my reply. Do not modify files. [?2026l[?2026h[?25lthinking... ■ Esc[?2026l[?2026h[?25lhinking...[?2026l[?2026h[?25ltinking...[?2026l[?2026h[?25lthnking...[?2026l[?2026h[?25lthiking...[?2026l[?2026h[?25lthining...[?2026l[?2026h[?25lthinkng...[?2026l[?2026h[?25l1s[?2026l[?2026h[?25lthinkig...[?2026l[?2026h[?25lthinkin...[?2026l[?2026h[?25lthinking..[?2026l[?2026h[?25lthinking..[?2026l[?2026h[?25lthinking..[?2026l[?2026h[?25lhinking...[?2026l[?2026h[?25l2[?2026l[?2026h[?25ltinking...[?2026l[?2026h[?25lthnking...[?2026l[?2026h[?25lthiking...[?2026l[?2026h[?25lthining...[?2026l[?2026h[?25lthinkng...[?2026l[?2026h[?25lthinkig...[?2026l[?2026h[?25l3[?2026l[?2026h[?25lthinkin...[?2026l[?2026h[?25lthinking..[?2026l[?2026h[?25lthinking..[?2026l[?2026h[?25lthinking..[?2026l[?2026h[?25lhinking...[?2026l[?2026h[?25ltinking...[?2026l[?2026h[?25l4[?2026l[?2026h[?25lthnking...[?2026l[?2026h[?25lthiking...[?2026l[?2026h[?25lthining...[?2026l[?2026h[?25lthinkng...[?2026l[?2026h[?25lthinkig...[?2026l[?2026h[?25lthinkin...[?2026l[?2026h[?25lthinking..[?2026l[?2026h[?25l5[?2026l[?2026h[?25lthinking..[?2026l[?2026h[?25lthinking..[?2026l[?2026h[?25lhinking...[?2026l[?2026h[?25ltinking...[?2026l[?2026h[?25lthnking...[?2026l[?2026h[?25lthiking...[?2026l[?2026h[?25l6[?2026l[?2026h[?25lthining...[?2026l[?2026h[?25lthinkng...[?2026l[?2026h[?25lworking... [?2026l[?2026h[?25l• ThinkingThe user wants me to ask them to choose between blue and green using the ask_user tool. This is straightforward — I should call ask_user with a single question offering those two options, then wait for their reply. No file modifications needed.[?2026l[?2026h[?25lworking...[?2026l[?2026h[?25lworking...[?2026l[?2026h[?25lworking...[?2026l[?2026h[?25lworking...[?2026l[?2026h[?25lworking...[?2026l[?2026h[?25l ▀▀ ██▀███▄▄▄████▄▄▄███▀███████ ██  ███ ██████▀▀▀▀▀██▀▀▀▀▀▄▄████▄██ ▀ ▀ ▀▀▀▀ ▀███▀    ┌──────────────────────────────────────────────────────────────────┐│ Session active ││100/100 Freebucks remaining││ 1 day streak │└──────────────────────────────────────────────────────────────────┘    [12:55 AM]    Use ask_user to ask me to choose blue or green. Wait for my reply. Do not modify files. ⎘ • Thinking   The user wants me to ask them to choose between blue and green using the ask_user tool. This is straightforward — I should call ask_user with a single question offering those two options, then wait for  their reply. No file modifications needed. ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮│Geo Daniela — La primera IA de remuneraciones de Chile Ad││Liquidaciones PDF, Previred CSV, LRE CSV y portal del trabajador. Demo 30 min para PYME.││ Learn more geodaniela.cl│╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯  6s ╭─────────────────────────────────────────────── Some questions for you ───────────────────────────────────────────────╮│Close ✕││ ││▼ Which color would you like to choose?   ││ ○ Blue ││ Pick blue as the color ││ ○ Green ││ ○ Custom ││ ││╭──────────╮│││ Submit │ ↑↓ navigate • Enter select││╰──────────╯│╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯[?2026l[?2026h[?25l7[?2026l[?2026h[?25l [?2026l[?2026h[?25l█████      ▄███ ▄██▀▀▀▀▀▀▀▀       ▀███████▄▄▄▄██ ████████████ ███▀▀ ██▀ ███▄▄▄██ ██▄▄▄███ ██ ▀██ ██ ██ ██ █████ ███ ███ ███▀▀▀▀▀ ██▀▀▀▀▀ ██▄ ▄██ ██▄ ██ ██ ██ ███ ██▀ ██▀ ▀█████ ▀████▀ ██████▀ ▀████▀ ██ ██    ┌──────────────────────────────────────────────────────────────────┐│ Session active ││100/100 Freebucks remaining││1 day streak│└──────────────────────────────────────────────────────────────────┘   [12:55 AM] Use ask_user to ask me to choose blue or green. Wait for my reply. Do not modify files. ⎘  • Thinking The user wants me to ask them to choose between blue and green using the ask_user tool. This is  straightforward — I should call ask_user with a single question offering those two options, then wait for    their reply. No file modifications needed.      ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮│ Geo Daniela — La primera IA de remuneraciones de Chile  Ad │ │ Liquidaciones PDF, Previred CSV, LRE CSV y portal del trabajador. Demo 30 min para PYME. │  │  Learn more  geodaniela.cl │  ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯   7s ╭─────────────────────────────────────────────── Some questions for you ───────────────────────────────────────────────╮ Close ✕ ▶ Which color would you like to choose? ↳ "Blue"╭──────────╮│Submit│╰──────────╯[?2026l[?2026h[?25l              ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮  │ Geo Daniela — La primera IA de remuneraciones de Chile  Ad │  │Liquidaciones PDF, Previred CSV, LRE CSV y portal del trabajador. Demo 30 min para PYME. │  │ Learn more geodaniela.cl│  ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯  working...  7s ■ Esc ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮│ ││ ▍Enter a coding task or / for commands ││ │╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯[?2026l[?2026h[?25l ▀ ██▀▀█████▀████▀████▀▀████▀█ ██  ┌──────────────────────────────────────────────────────────────────┐│ Session active ││ 100/100 Freebucks remaining ││ 1 day streak │└──────────────────────────────────────────────────────────────────┘  [12:55 AM]   Use ask_user to ask me to choose blue or green. Wait for my reply. Do not modify files. ⎘    • Thinking The user wants me to ask them to choose between blue and green using the ask_user tool. This is   straightforward — I should call ask_user with a single question offering those two options, then wait for   their reply. No file modifications needed.  ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮│ ││Your answer: ││││1. Which color would you like to choose?││↳ Blue│││╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯[?2026l[?2026h[?25lworking...[?2026l[?2026h[?25lworking...[?2026l[?2026h[?25lworking...[?2026l[?2026h[?25lworking...[?2026l[?2026h[?25lworking...[?2026l[?2026h[?25lworking...[?2026l[?2026h[?25l8[?2026l[?2026h[?25lworking...[?2026l[?2026h[?25lworking...[?2026l[?2026h[?25lworking...[?2026l[?2026h[?25lworking...[?2026l[?2026h[?25lworking...[?2026l[?2026h[?25lworking...[?2026l[?2026h[?25l9[?2026l[?2026h[?25lworking...[?2026l[?2026h[?25lworking...[?2026l[?2026h[?25lworking...[?2026l[?2026h[?25lworking...[?2026l[?2026h[?25lworking...[?2026l[?2026h[?25lworking...[?2026l[?2026h[?25l10[?2026l[?2026h[?25lworking...[?2026l[?2026h[?25lworking...[?2026l[?2026h[?25lworking...[?2026l[?2026h[?25l└──────────────────────────────────────────────────────────────────┘  [12:55 AM]  Use ask_user to ask me to choose blue or green. Wait for my reply. Do not modify files. ⎘    • Thinking   The user wants me to ask them to choose between blue and green using the ask_user tool. This is straightforward — I should call ask_user with a single question offering those two options, then wait for   their reply. No file modifications needed.  ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮│ ││Your answer: ││ ││1. Which color would you like to choose?││↳ Blue││ │╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯     • Thinking   The user chose Blue. They asked me to wait for their reply and not modify files. I've received their answer.   I should acknowledge it simply and not do anything else.  You chose Blue. Noted — and I haven't modified any files, as requested.[?2026l[?2026h[?25l   [12:55 AM] Use ask_user to ask me to choose blue or green. Wait for my reply. Do not modify files. ⎘    • Thinking  The user wants me to ask them to choose between blue and green using the ask_user tool. This is  straightforward —I should call ask_ur with asingle question offeringthose two ptions, then wait for  their reply. Nofile mdifition needed.     ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │ │ Your answer:   1. Which color would you like to choose?  ↳ Blue    ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯    • Thinking  The user chose Blue. They asked me to wait for their reply and not modify files. I've received their answer.  I shouldacknowledgeit simply andnt do anything els.    You chose Blue. Noted — and I haven't modified any files, as requested.█ ⎘•20s•△▽█44m left · 13.2K (1%)✕ End session[?2026l[?2026h[?25lThe user wants me to ask them to choose between blue and green using the ask_user tool. This is   straightforward — I should call ask_user with a single question offering those two options, then wait for   their reply. No file modifications needed.  ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮│ ││Your answer: ││││1. Which color would you like to choose?││ ↳ Blue │╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯     ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │Looooooong running AI agentsAd│ │ Build and run AI agents that don't time out on Trigger.dev trigger.dev ↗ │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ [?2026l[?2026h[?25lRun sleep 20 then say done. Do not modify files.▍[?2026l]0;Freebuff: Run sleep 20 then say done. Do not modify files.[?2026h[?25l  ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮│││Your answer:││ │1. Which color would you like to choose? ↳ Blue ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯     ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │Looooooong running AI agentsAd││Build and run AI agents that don't time out on Trigger.devtrigger.dev ↗│╰╯    • Thinking    The user chose Blue. They asked me to wait for their reply and not modify files. I've received their answer.  I should acknowledge it simply and not do anything else. You chose Blue. Noted — and I haven't modified any files, as requested.  ⎘•20s•△▽  [12:56 AM]  Run sleep 20 then say done. Do not modify files. ⎘     ▍Enter a coding task or / for commands [?2026l[?2026h[?25l▸ Thinking    ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮   Your answer:   1. Which color would you like to choose? ↳ Blue │ │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯    ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ Looooooong running AI agents  Ad │ Build and run AI agents that don't time out on Trigger.dev trigger.dev ↗ │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯   ▸ Thinking    You chose Blue. Noted — and I haven't modified any files, as requested.  ⎘•20s•△▽        [12:56 AM] Run sleep 20 then say done. Do not modify files. ⎘    thinking...  ■ Esc[?2026l[?2026h[?25lhinking...[?2026l[?2026h[?25ltinking...[?2026l[?2026h[?25lthnking...[?2026l[?2026h[?25lthiking...[?2026l[?2026h[?25lthining...[?2026l[?2026h[?25lthinkng...[?2026l[?2026h[?25l1s[?2026l[?2026h[?25lthinkig...[?2026l[?2026h[?25lthinkin...[?2026l[?2026h[?25lthinking..[?2026l[?2026h[?25lthinking..[?2026l[?2026h[?25lthinking..[?2026l[?2026h[?25lhinking...[?2026l[?2026h[?25l2[?2026l[?2026h[?25ltinking...[?2026l[?2026h[?25lthnking...[?2026l[?2026h[?25lthiking...[?2026l[?2026h[?25lthining...[?2026l[?2026h[?25lthinkng...[?2026l[?2026h[?25lthinkig...[?2026l[?2026h[?25l3[?2026l[?2026h[?25lthinkin...[?2026l[?2026h[?25lthinking..[?2026l[?2026h[?25lthinking..[?2026l[?2026h[?25lthinking..[?2026l[?2026h[?25lhinking...[?2026l[?2026h[?25ltinking...[?2026l[?2026h[?25l4[?2026l[?2026h[?25lthnking...[?2026l[?2026h[?25lthiking...[?2026l[?2026h[?25lthining...[?2026l[?2026h[?25lthinkng...[?2026l[?2026h[?25lthinkig...[?2026l[?2026h[?25lthinkin...[?2026l[?2026h[?25lthinking..[?2026l[?2026h[?25l5[?2026l[?2026h[?25lthinking..[?2026l[?2026h[?25lthinking..[?2026l[?2026h[?25lhinking...[?2026l[?2026h[?25ltinking...[?2026l[?2026h[?25l [?2026l[?2026h[?25lthnking...[?2026l[?2026h[?25lthiking...[?2026l[?2026h[?25l6[?2026l[?2026h[?25lthining...[?2026l[?2026h[?25lthinkng...[?2026l[?2026h[?25lthinkig...[?2026l[?2026h[?25lthinkin...[?2026l[?2026h[?25lthinking..[?2026l[?2026h[?25lthinking..[?2026l[?2026h[?25l7[?2026l[?2026h[?25lthinking..[?2026l[?2026h[?25lhinking...[?2026l[?2026h[?25lworking... [?2026l[?2026h[?25l│ Your answer:││││1. Which color would you like to choose?││ ↳ Blue │╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯     ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │Looooooong running AI agentsAd│ │ Build and run AI agents that don't time out on Trigger.dev trigger.dev ↗ │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯▸ Thinking     You chose Blue. Noted — and I haven't modified any files, as requested.   ⎘ • 20s • △▽  [12:56 AM] Run sleep 20 then say done. Do not modify files. ⎘ • Thinking     The user wants me to run `sleep 20` in the terminal and then say "done". This is a simple, harmless command —   it just waits 20 seconds. No files modified. The tool guidance says to ask permission for commands other   than the listed use cases, but this is trivially safe and the user explicitly requested it, which is explicit permission itself. Let[?2026l[?2026h[?25lworking...[?2026l[?2026h[?25lworking...[?2026l[?2026h[?25lworking...[?2026l[?2026h[?25lworking...[?2026l[?2026h[?25lworking...[?2026l[?2026h[?25l me run it with an appropriate timeout (default is[?2026l[?2026h[?25lworking...[?2026l[?2026h[?25l ↳ Blue ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯     ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │Looooooong running AI agentsAd││Build and run AI agents that don't time out on Trigger.devtrigger.dev ↗│╰╯    ▸ Thinking    You chose Blue. Noted — and I haven't modified any files, as requested. ⎘•20s•△▽  [12:56 AM]  Run sleep 20 then say done. Do not modify files. ⎘      • Thinking   The user wants me to run `sleep 20` in the terminal and then say "done". This is a simple, harmless command — it just waits 20 seconds. No files modified. The tool guidance says to ask permission for commands other  than the listed use cases, but this is trivially safe and the user explicitly requested it, which is explicit prmission itself. Let me run it withan appopriate timeout (default is 30, which is fine for a 20-second sleep).  $ sleep 20 8[?2026l[?2026h[?25lworking...[?2026l[?2026h[?25lworking...[?2026l[?2026h[?25lworking...[?2026l[?2026h[?25l       ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮  │Looooooong running AI agentsAd│ │Build and run AI agents that don't time out on Trigger.devtrigger.dev ↗│ ╰╯      ▸ Thinking      You chose Blue. Noted — and I haven't modified any files, as requested.  ⎘•20s•△▽    [12:56 AM]   Run sleep 20 then say done. Do not modify files. ⎘        • Thinking    The user wants me to run `sleep 20` in the terminal and then say "done". This is a simple, harmless command —  it just waits 20 seconds. No files modified. The tool guidance says to ask permission for commands other   than the listed use cases, but this is trivially safe and the user explicitly requested it, which is explicit  prmission itself. Let me run it withan appopriate timeout (default is 30, which is fine for a 20-second  sleep).    $ sleep 20    [response interrupted]  ⎘•△▽▄44m left · 13.2K (1%)✕ End session[?2026l[?2026h[?25l╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯▸ Thinking     You chose Blue. Noted — and I haven't modified any files, as requested.   ⎘ • 20s • △▽   [12:56 AM] Run sleep 20 then say done. Do not modify files. ⎘ • Thinking     The user wants me to run `sleep 20` in the terminal and then say "done". This is a simple, harmless command —   it just waits 20 seconds. No files modified. The tool guidance says to ask permission for commands other   than the listed use cases, but this is trivially safe and the user explicitly requested it, which is explicit permission itself. Let me run it with an appropriate timeout (default is 30s, which is fine for a 20-second  sleep).  $ sleep 20  ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮│Looooooong running AI agentsAd││Build and run AI agents that don't time out on Trigger.devtrigger.dev ↗│╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯[?2026l[?2026h[?25lRun sh -c "exit 7" and report the result. Do not modify files.▍[?2026l]0;Freebuff: Run sh -c "exit 7" and report the result. Do not …[?2026h[?25l You chose Blue. Noted — and I haven't modified any files, as requested. ⎘•20s•△▽  [12:56 AM]  Run sleep 20 then say done. Do not modify files. ⎘      • Thinking   The user wants me to run `sleep 20` in the terminal and then say "done". This is a simple, harmless command — it just waits 20 seconds. No files modified. The tool guidance says to ask permission for commands other  than the listed use cases, but this is trivially safe and the user explicitly requested it, which is explicit prmission itself. Let me run it withan appopriate timeout (default is 30, which is fine for a 20-second sleep).  $ sleep 20  ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮│ Looooooong running AI agentsAd││Build and run AI agents that don't time out on Trigger.devtrigger.dev ↗│╰╯    [response interrupted]    ⎘ • △▽   [12:56 AM]  Run sh -c "exit 7" and report the result. Do not modify files. ⎘   ▍Enter a coding task or / for commands [?2026l[?2026h[?25l│Build and run AI agents that don't time out on Trigger.devtrigger.dev ↗│ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯       ▸ Thinking     You chose Blue. Noted — and I haven't modified any files, as requested. ⎘•20s•△▽    [12:56 AM]   Run sleep 20 then say done. Do not modify files. ⎘    ▸ Thinking    $ sleep 20   ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │ Looooooong running AI agents Ad │ Build and run AI agents that don't time out on Trigger.devtrigger.dev ↗ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯   [response interrupted]  ⎘•△▽      [12:56 AM] Run sh -c "exit 7" and report the result. Do not modify files. ⎘    thinking...  ■ Esc[?2026l[?2026h[?25lhinking...[?2026l[?2026h[?25ltinking...[?2026l[?2026h[?25lthnking...[?2026l[?2026h[?25lthiking...[?2026l[?2026h[?25lthining...[?2026l[?2026h[?25lthinkng...[?2026l[?2026h[?25l1s[?2026l[?2026h[?25lthinkig...[?2026l[?2026h[?25lthinkin...[?2026l[?2026h[?25lthinking..[?2026l[?2026h[?25lthinking..[?2026l[?2026h[?25lthinking..[?2026l[?2026h[?25lhinking...[?2026l[?2026h[?25l2[?2026l[?2026h[?25ltinking...[?2026l[?2026h[?25lthnking...[?2026l[?2026h[?25lthiking...[?2026l[?2026h[?25lthining...[?2026l[?2026h[?25lthinkng...[?2026l[?2026h[?25lManaged Postgresthat keepsupwith your machins Scale your production wokloads withTigerData'smanaged, unfked PstgreSQL ndhigh-availability multi-AZ…SttFreTrial  tigerdata.com[?2026l[?2026h[?25lthinkig...[?2026l[?2026h[?25l3[?2026l[?2026h[?25lthinkin...[?2026l[?2026h[?25lthinking..[?2026l[?2026h[?25lworking.. [?2026l[?2026h[?25lYou chose Blue. Noted — and I haven't modified any files, as requested.   ⎘ • 20s • △▽  [12:56 AM] Run sleep 20 then say done. Do not modify files. ⎘ ▸ Thinking      $ sleep 20   ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮│ Looooooong running AI agentsAd││Build and run AI agents that don't time out on Trigger.devtrigger.dev ↗│╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯[response interrupted]   ⎘• △▽      [12:56 AM]  Run sh -c "exit 7" and report the result. Do not modify files. ⎘ • Thinking   The user wants me to run `sh -c "exit 7"` and report the result. This is a harmless command — it just exits   with code 7. It doesn't modify files. Let me run it with the run_terminal_command tool.  $ sh -c "exit 7"[?2026l[?2026h[?25lworking...[?2026l[?2026h[?25l  [12:56 AM]  Run sleep 20 then say done. Do not modify files. ⎘      ▸ Thinking   $ sleep 20 ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮│ Looooooong running AI agentsAd││Build and run AI agents that don't time out on Trigger.devtrigger.dev ↗│╰╯    [response interrupted]    ⎘ • △▽  [12:56 AM]  Run sh -c "exit 7" and report the result. Do not modify files. ⎘    • Thinking   The user wants me to run `sh -c "exit 7"` and report the result. This is a harmless command — it just exits with code 7. It doesn't modify files. Let me run it with the run_terminal_command tool. $ sh -c "exit 7" command: sh -c "exit 7" stdout: exitCode: 7 [?2026l[?2026h[?25lworking...[?2026l[?2026h[?25lworking...[?2026l[?2026h[?25lworking...[?2026l[?2026h[?25lworking...[?2026l[?2026h[?25lworking...[?2026l[?2026h[?25l4[?2026l[?2026h[?25lworking...[?2026l[?2026h[?25lworking...[?2026l[?2026h[?25lworking...[?2026l[?2026h[?25lworking...[?2026l[?2026h[?25lworking...[?2026l[?2026h[?25lworking...[?2026l[?2026h[?25l5[?2026l[?2026h[?25lworking...[?2026l[?2026h[?25lworking...[?2026l[?2026h[?25lworking...[?2026l[?2026h[?25lworking...[?2026l[?2026h[?25lworking...[?2026l[?2026h[?25lworking...[?2026l[?2026h[?25l6[?2026l[?2026h[?25lworking...[?2026l[?2026h[?25lworking...[?2026l[?2026h[?25lworking...[?2026l[?2026h[?25lworking...[?2026l[?2026h[?25lworking...[?2026l[?2026h[?25lworking...[?2026l[?2026h[?25l7[?2026l[?2026h[?25lworking...[?2026l[?2026h[?25lworking...[?2026l[?2026h[?25lworking...[?2026l[?2026h[?25lworking...[?2026l[?2026h[?25lworking...[?2026l[?2026h[?25lworking...[?2026l[?2026h[?25lworking...[?2026l[?2026h[?25l8[?2026l[?2026h[?25lworking...[?2026l[?2026h[?25lworking...[?2026l[?2026h[?25lworking...[?2026l[?2026h[?25lworking...[?2026l[?2026h[?25lworking...[?2026l[?2026h[?25lworking...[?2026l[?2026h[?25l9[?2026l[?2026h[?25l   [response interrupted] ⎘•△▽  [12:56 AM]  Run sh -c "exit 7" and report the result. Do not modify files. ⎘• Thinking  The user wants me to run `sh -c "exit 7"` and report the result. This is a harmless command — it just exits    with code 7. It doesn't modify files. Let me run it with the run_terminal_command tool.   $ sh -c "exit 7"command: sh -c "exit 7"stdout:    exitCode: 7   • Thinking The command `sh -c "exit 7"` was run. It exited with code 7, no stdout output. I should report the result. No  files modified. The command ran and completed with: - Exit code: 7 (as expected, since  exit 7  was explicitly called)- stdout: empty - stderr: none  No files were modified.[?2026l[?2026h[?25l[response interrupted]  ⎘•△▽      [12:56 AM] Run sh -c "exit 7" and report the result. Do not modify files. ⎘    • Thinking  The user wants me to run `sh -c "exit 7"` and report the result. This is a harmless command — it just exits  with code 7. It doesn't modify files.Letme run it withthe run_terminal_command tool.    $ sh -c "exit 7" command: sh -c "exit 7" stdout:   exitCode: 7   • Thinking  The command `sh -c "exit 7"` was run. It exited with code 7, no stdout output. I should report the result. No  files odified.    The command ran and completed with: - Exit code: 7 (s expectd, since  exit 7  was explicitly called) stdout: empty  errnone    No files were modified.  ⎘•9s•△▽▄43m left · 13.3K (1%)✕ End session[?2026l[?2026h[?25l • Thinking   The user wants me to run `sh -c "exit 7"` and report the result. This is a harmless command — it just exits   with code 7. It doesn't modify files. Let me run it with the run_terminal_command tool.  $ sh -c "exit 7"command: sh -c "exit 7"stdout:  exitCode: 7 ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮│ Your AI Agent’s Data Layer, Built on MongoDB AtlasAd││ Power your agentic workflows with MongoDB Atlas for reliable, scalable session memory and real-…mongodb.com ↗│╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯[?2026l[?2026h[?25l [?2026l \ No newline at end of file diff --git a/src/main/runtime/__fixtures__/freebuff-login.meta.json b/src/main/runtime/__fixtures__/freebuff-login.meta.json new file mode 100644 index 000000000000..390bcedba909 --- /dev/null +++ b/src/main/runtime/__fixtures__/freebuff-login.meta.json @@ -0,0 +1,9 @@ +{ + "capturedAt": "2026-09-28T07:20:19.119Z", + "platform": "darwin", + "command": ["freebuff", "--cwd", "/tmp/orca-freebuff-verify"], + "cols": 100, + "rows": 32, + "note": "Freebuff npm 0.1.2, unauthenticated, macOS arm64; no model inference", + "exitCode": 0 +} diff --git a/src/main/runtime/__fixtures__/freebuff-login.txt b/src/main/runtime/__fixtures__/freebuff-login.txt new file mode 100644 index 000000000000..d90d8905cebd --- /dev/null +++ b/src/main/runtime/__fixtures__/freebuff-login.txt @@ -0,0 +1 @@ +]11;?]10;?[?2031h]10;?]11;?[>0q[?25l[?1016$p[?2027$p[?2031$p[?1004$p[?2004$p[?2026$p[?u]99;i=opentui-notifications:p=?;\]1337;Capabilities\]66;w=1; \]66;s=2; \[?1049h[>4;1m[?2027h[?2004h[?1000h[?1002h[?1003h[?1006h]4;0;?[?2026h[?25l ███████████ ██ ▄████ ▄██  ███▀▀▀▀▀▀▀▀ ██ ██ ██▀  ███ █████ ██████ ▄█████ ▄████▄ ██████▄ ██ ██ ████████████  ███ ███▀▀ ██▀ ███▄▄▄██ ██▄▄▄███ ██ ▀██ ██ ██ ██ ██  ███ ███ ███ ███▀▀▀▀▀ ██▀▀▀▀▀ ██▄ ▄██ ██▄ ██ ██ ██  ███ ██▀ ██▀ ▀█████ ▀████▀ ██████▀ ▀████▀ ██ ██   ┌──────────────────────────────────────────────────────────────────┐  │ Your first message starts the session. │  │ Some models aren't available on this connection │  └──────────────────────────────────────────────────────────────────┘           Try one of these:  → Explain this codebase  → Find opportunities to refactor  → Improve my test coverage  ╭──────────────────────────────────────────────────────────────────────────────────────────────────╮│ ││ ▍Enter a coding task or / for commands ││ │╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ GLM 5.3 Flash • max · /private/tmp/orca-freebuff-verify · /model to change · Chat: New chat  ← for history · ? for help [?2026l[?1004h[?2026h[?25l             ███████████ ██ ▄████ ▄██  ███▀▀▀▀▀▀▀▀ ██ ██ ██▀  ███ █████ ██████ ▄█████ ▄████▄ ██████▄ ██ ██ ████████████  ███ ███▀▀ ██▀ ███▄▄▄██ ██▄▄▄███ ██ ▀██ ██ ██ ██ ██  ███ ███ ███ ███▀▀▀▀▀ ██▀▀▀▀▀ ██▄ ▄██ ██▄ ██ ██ ██  ███ ██▀ ██▀ ▀█████ ▀████▀ ██████▀ ▀████▀ ██ ██   Press ENTER to login...             [?2026l[?2026h[?25l             ███████████ ██ ▄████ ▄██  ███▀▀▀▀▀▀▀▀ ██ ██ ██▀  ███ █████ ██████ ▄█████ ▄████▄ ██████▄ ██ ██ ████████████  ███ ███▀▀ ██▀ ███▄▄▄██ ██▄▄▄███ ██ ▀██ ██ ██ ██ ██  ███ ███ ███ ███▀▀▀▀▀ ██▀▀▀▀▀ ██▄ ▄██ ██▄ ██ ██ ██  ███ ██▀ ██▀ ▀█████ ▀████▀ ██████▀ ▀████▀ ██ ██   Press ENTER to login...             [?2026l \ No newline at end of file diff --git a/src/main/runtime/__fixtures__/freebuff-ready.meta.json b/src/main/runtime/__fixtures__/freebuff-ready.meta.json new file mode 100644 index 000000000000..4555254cd8f8 --- /dev/null +++ b/src/main/runtime/__fixtures__/freebuff-ready.meta.json @@ -0,0 +1,9 @@ +{ + "capturedAt": "2026-09-28T08:15:15.356Z", + "platform": "darwin", + "command": ["freebuff", "--cwd", "/tmp/orca-freebuff-trust"], + "cols": 120, + "rows": 40, + "note": "Freebuff 0.1.2 authenticated, declined repository agent files; waiting for first message", + "exitCode": 0 +} diff --git a/src/main/runtime/__fixtures__/freebuff-ready.txt b/src/main/runtime/__fixtures__/freebuff-ready.txt new file mode 100644 index 000000000000..150521f88b99 --- /dev/null +++ b/src/main/runtime/__fixtures__/freebuff-ready.txt @@ -0,0 +1,11 @@ +]11;?]10;? +freebuff found agent files in this repository it has not run before: + + /private/tmp/orca-freebuff-trust/.agents + agents: demo.ts + +These run with your permissions and can read your environment. Only load them if you trust this repository. + +Load and run these? [y/N] n +Skipped agents and mcp.json in /private/tmp/orca-freebuff-trust/.agents for this run. Re-run and answer y to trust it, or set CODEBUFF_TRUST_AGENT_DIRS=1 (or pass --trust-agents). +[?2031h]10;?]11;?[>0q[?25l[?1016$p[?2027$p[?2031$p[?1004$p[?2004$p[?2026$p[?u]99;i=opentui-notifications:p=?;\]1337;Capabilities\]66;w=1; \]66;s=2; \[?1049h[>4;1m[?2027h[?2004h[?1000h[?1002h[?1003h[?1006h]4;0;?[?2026h[?25l ███████████ ██ ▄████ ▄██  ███▀▀▀▀▀▀▀▀ ██ ██ ██▀  ███ █████ ██████ ▄█████ ▄████▄ ██████▄ ██ ██ ████████████  ███ ███▀▀ ██▀ ███▄▄▄██ ██▄▄▄███ ██ ▀██ ██ ██ ██ ██  ███ ███ ███ ███▀▀▀▀▀ ██▀▀▀▀▀ ██▄ ▄██ ██▄ ██ ██ ██  ███ ██▀ ██▀ ▀█████ ▀████▀ ██████▀ ▀████▀ ██ ██   ┌──────────────────────────────────────────────────────────────────┐  │ Your first message starts the session. │  │ Some models aren't available on this connection │  └──────────────────────────────────────────────────────────────────┘                       ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮│ ││ ▍Enter a coding task or / for commands ││ │╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ GLM 5.3 Flash • max · /private/tmp/orca-freebuff-trust · /model to change · Chat: New chat  ← for history · ? for help [?2026l[?1004h[?2026h[?25l95/100 Freebucks remaining │ ││✦ Refer friends → earn Freebucks:││││⎘ Copy invite link Learn More ↵│└──────────────────────────────────────────────────────────────────┘[?2026l[?2026h[?25l1 day streak ✦ Refer friends → earn Freebucks: │ ⎘ Copy invite link Learn More ↵ │└──────────────────────────────────────────────────────────────────┘[?2026l[?2026h[?25l ███████████ ██ ▄████ ▄██  ███▀▀▀▀▀▀▀▀ ██ ██ ██▀  ███ █████ ██████ ▄█████ ▄████▄ ██████▄ ██ ██ ████████████  ███ ███▀▀ ██▀ ███▄▄▄██ ██▄▄▄███ ██ ▀██ ██ ██ ██ ██  ███ ███ ███ ███▀▀▀▀▀ ██▀▀▀▀▀ ██▄ ▄██ ██▄ ██ ██ ██  ███ ██▀ ██▀ ▀█████ ▀████▀ ██████▀ ▀████▀ ██ ██   ┌──────────────────────────────────────────────────────────────────┐  │ Your first message starts the session. │  │ 95/100 Freebucks remaining │  │ 1 day streak │  │ │  │ ✦ Refer friends → earn Freebucks: │  │ │  │ ⎘ Copy invite link Learn More ↵ │  └──────────────────────────────────────────────────────────────────┘                  ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮│ ││ ▍Enter a coding task or / for commands ││ │╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ GLM 5.3 Flash • max · /private/tmp/orca-freebuff-trust · /model to change · Chat: New chat  ← for history · ? for help [?2026l[?2026h[?25l╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮│MARS | A robot to build physical AI agents Ad││A mobile robot with an arm to run agents for $995. Start in simulation. Bring it to life.││ Learn more innate.bot│╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯[?2026l \ No newline at end of file diff --git a/src/main/runtime/__fixtures__/freebuff-trust.meta.json b/src/main/runtime/__fixtures__/freebuff-trust.meta.json new file mode 100644 index 000000000000..d4513cba70e3 --- /dev/null +++ b/src/main/runtime/__fixtures__/freebuff-trust.meta.json @@ -0,0 +1,9 @@ +{ + "capturedAt": "2026-09-28T08:09:19.020Z", + "platform": "darwin", + "command": ["freebuff", "--cwd", "/tmp/orca-freebuff-trust"], + "cols": 120, + "rows": 40, + "note": "Freebuff 0.1.2; harmless repository agent file trust prompt, not accepted", + "exitCode": 0 +} diff --git a/src/main/runtime/__fixtures__/freebuff-trust.txt b/src/main/runtime/__fixtures__/freebuff-trust.txt new file mode 100644 index 000000000000..48ca2e771609 --- /dev/null +++ b/src/main/runtime/__fixtures__/freebuff-trust.txt @@ -0,0 +1,9 @@ +]11;?]10;? +freebuff found agent files in this repository it has not run before: + + /private/tmp/orca-freebuff-trust/.agents + agents: demo.ts + +These run with your permissions and can read your environment. Only load them if you trust this repository. + +Load and run these? [y/N] \ No newline at end of file diff --git a/src/main/runtime/freebuff-status-transcript.test.ts b/src/main/runtime/freebuff-status-transcript.test.ts new file mode 100644 index 000000000000..f06455ce9733 --- /dev/null +++ b/src/main/runtime/freebuff-status-transcript.test.ts @@ -0,0 +1,137 @@ +import { readFileSync } from 'node:fs' +import { join } from 'node:path' +import { describe, expect, it, vi } from 'vitest' +import { createTranscriptPane, TRANSCRIPT_PANE_PTY_ID } from './agent-transcript-pane-test-harness' +import { makeAgentStatusStoreWiring } from './agent-status-store-wiring.test-fixture' + +vi.mock('electron', () => ({ + BrowserWindow: { fromId: vi.fn(() => null) }, + webContents: { fromId: vi.fn(() => null) }, + ipcMain: { on: vi.fn(), removeListener: vi.fn() }, + app: { getPath: vi.fn(() => '/tmp') } +})) + +const transcript = readFileSync( + join(import.meta.dirname, '__fixtures__/freebuff-lifecycle.txt'), + 'utf8' +) + +describe('Freebuff execution-host status', () => { + it('publishes real running, question, and settled screens into the canonical store', async () => { + const wiring = makeAgentStatusStoreWiring() + const { runtime } = await createTranscriptPane( + { + data: '', + paneTitle: 'Freebuff', + foregroundProcess: 'freebuff', + launchAgent: 'freebuff', + size: { cols: 120, rows: 40 } + }, + wiring.deps + ) + const states: string[] = [] + const questions: string[] = [] + try { + // oxlint-disable-next-line no-control-regex -- Terminal protocol delimiters contain ESC and BEL. + for (const frame of transcript.split(/(?<=\x1b\[\?2026l)/)) { + runtime.onPtyData(TRANSCRIPT_PANE_PTY_ID, frame, Date.now()) + await runtime.serializeMainTerminalBuffer(TRANSCRIPT_PANE_PTY_ID) + const row = wiring.statusStore.getStatusSnapshot()[0] + if (row && states.at(-1) !== row.state) { + states.push(row.state) + } + if (row?.interactivePrompt) { + questions.push(row.interactivePrompt) + } + } + expect(states).toContain('working') + expect(states).toContain('waiting') + expect(states.at(-1)).toBe('done') + expect(questions.join('\n')).toMatch(/blue|green/i) + } finally { + runtime.onPtyExit(TRANSCRIPT_PANE_PTY_ID, 0) + } + }) + it.each([ + { name: 'login', cols: 100, rows: 32, input: 'Sign in to Freebuff' }, + { name: 'trust', cols: 120, rows: 40, input: 'Trust repository agent files? [y/N]' } + ])('publishes captured $name startup as blocked', async ({ name, cols, rows, input }) => { + const wiring = makeAgentStatusStoreWiring() + const { runtime } = await createTranscriptPane( + { + data: '', + paneTitle: 'Freebuff', + foregroundProcess: 'freebuff', + launchAgent: 'freebuff', + size: { cols, rows } + }, + wiring.deps + ) + try { + runtime.onPtyData( + TRANSCRIPT_PANE_PTY_ID, + readFileSync(join(import.meta.dirname, `__fixtures__/freebuff-${name}.txt`), 'utf8'), + Date.now() + ) + await runtime.serializeMainTerminalBuffer(TRANSCRIPT_PANE_PTY_ID) + expect(wiring.statusStore.getStatusSnapshot()[0]).toMatchObject({ + state: 'blocked', + toolInput: input, + agentType: 'freebuff' + }) + } finally { + runtime.onPtyExit(TRANSCRIPT_PANE_PTY_ID, 0) + } + }) + + it('clears a startup block when the captured first-message composer becomes ready', async () => { + const wiring = makeAgentStatusStoreWiring() + const { runtime } = await createTranscriptPane( + { + data: '', + paneTitle: 'Freebuff', + foregroundProcess: 'freebuff', + launchAgent: 'freebuff', + size: { cols: 120, rows: 40 } + }, + wiring.deps + ) + try { + for (const name of ['trust', 'ready']) { + runtime.onPtyData( + TRANSCRIPT_PANE_PTY_ID, + readFileSync(join(import.meta.dirname, `__fixtures__/freebuff-${name}.txt`), 'utf8'), + Date.now() + ) + await runtime.serializeMainTerminalBuffer(TRANSCRIPT_PANE_PTY_ID) + expect(wiring.statusStore.getStatusSnapshot()[0]?.state).toBe( + name === 'trust' ? 'blocked' : 'done' + ) + } + expect(wiring.statusStore.getStatusSnapshot()[0]?.toolInput).toBeUndefined() + } finally { + runtime.onPtyExit(TRANSCRIPT_PANE_PTY_ID, 0) + } + }) + + it('does not infer remote status from the client screen', async () => { + const wiring = makeAgentStatusStoreWiring() + const { runtime } = await createTranscriptPane( + { + data: '', + paneTitle: 'Freebuff', + foregroundProcess: 'freebuff', + connectionId: 'ssh-test', + size: { cols: 120, rows: 40 } + }, + wiring.deps + ) + try { + runtime.onPtyData(TRANSCRIPT_PANE_PTY_ID, transcript, Date.now()) + await runtime.serializeMainTerminalBuffer(TRANSCRIPT_PANE_PTY_ID) + expect(wiring.statusStore.getStatusSnapshot()).toEqual([]) + } finally { + runtime.onPtyExit(TRANSCRIPT_PANE_PTY_ID, 0) + } + }) +}) diff --git a/src/main/runtime/freebuff-terminal-status.ts b/src/main/runtime/freebuff-terminal-status.ts new file mode 100644 index 000000000000..09ffee3d50d0 --- /dev/null +++ b/src/main/runtime/freebuff-terminal-status.ts @@ -0,0 +1,25 @@ +import { FreebuffScreenStatusTracker } from '../../shared/freebuff-screen-status' +import { recognizeAgentProcessFromCommandLine } from '../../shared/agent-process-recognition' +import type { HeadlessEmulator } from '../daemon/headless-emulator' + +const trackers = new WeakMap() + +export function observeFreebuffTerminalStatus( + emulator: HeadlessEmulator, + data: string, + startupCommand: string | undefined, + launchAgent?: string | null +) { + let tracker = trackers.get(emulator) + if (!tracker) { + const identified = + launchAgent === 'freebuff' || + recognizeAgentProcessFromCommandLine(startupCommand)?.agent === 'freebuff' + tracker = new FreebuffScreenStatusTracker(identified) + trackers.set(emulator, tracker) + } + return tracker.observe(data, () => ({ + lines: emulator.getVisibleLines(), + alternate: emulator.isAlternateScreen + })) +} diff --git a/src/main/runtime/orca-runtime-maybe-hydrate-headless-from-renderer.ts b/src/main/runtime/orca-runtime-maybe-hydrate-headless-from-renderer.ts index 63135f261b78..3e8d618e8a40 100644 --- a/src/main/runtime/orca-runtime-maybe-hydrate-headless-from-renderer.ts +++ b/src/main/runtime/orca-runtime-maybe-hydrate-headless-from-renderer.ts @@ -1,5 +1,7 @@ // @ts-nocheck -- mechanically split from OrcaRuntimeService; behavior is covered by AST equivalence and characterization tests. +import { splitFreebuffScreenUpdates } from '../../shared/freebuff-screen-status' import { OrcaRuntimeWithSerializeMainTerminalBuffer } from './orca-runtime-serialize-main-terminal-buffer' +import { observeFreebuffTerminalStatus } from './freebuff-terminal-status' import { MOBILE_SUBSCRIBE_SCROLLBACK_ROWS } from './scrollback-limits' import { detectAgentStatusFromTitle, normalizeTerminalTitle } from '../../shared/agent-detection' import { shouldModelAnswerHiddenPtyQueries } from './terminal-model-query-authority' @@ -171,7 +173,26 @@ export class OrcaRuntimeWithMaybeHydrateHeadlessFromRenderer extends OrcaRuntime // Why inside the chain: the ownership mirror must observe live bytes in // the same total order as seeds (seedOwner also runs on this chain). state.ownership.scan(data) - await state.emulator.write(data, { forwardQueryReplies }) + for (const chunk of splitFreebuffScreenUpdates(data, state.emulator.partialEscapeTailAnsi)) { + await state.emulator.write(chunk, { forwardQueryReplies }) + const pty = this.ptysById.get(ptyId) + if (pty && !pty.connectionId && this.headlessTerminals.get(ptyId) === state) { + const payload = observeFreebuffTerminalStatus( + state.emulator, + chunk, + this.terminalSpawnCommandsByPtyId.get(ptyId), + pty.launchAgent + ) + if (payload) { + pty.lastExplicitAgentStatus = { state: payload.state, updatedAt: Date.now() } + this.emitTerminalAgentStatusEvents(ptyId, { + cleanData: '', + payloads: [payload], + lastPayloadCleanOffset: null + }) + } + } + } state.outputSequence = outputSequence }) // Legacy callers remain best-effort; bounded SSH admission observes the raw receipt. diff --git a/src/relay/freebuff-status-projection.test.ts b/src/relay/freebuff-status-projection.test.ts new file mode 100644 index 000000000000..b10214ef8010 --- /dev/null +++ b/src/relay/freebuff-status-projection.test.ts @@ -0,0 +1,43 @@ +import { readFileSync } from 'node:fs' +import { join } from 'node:path' +import { describe, expect, it } from 'vitest' +import { FreebuffStatusProjection } from './freebuff-status-projection' +import { createAgentStatusOscProcessor } from '../shared/agent-status-osc' + +const transcript = readFileSync( + join(import.meta.dirname, '../main/runtime/__fixtures__/freebuff-lifecycle.txt'), + 'utf8' +) + +describe('Freebuff relay status projection', () => { + it.each([1, 137, 4096, transcript.length])( + 'publishes host-observed states with %i-character PTY chunks', + (size) => { + const projection = new FreebuffStatusProjection(120, 40) + const parse = createAgentStatusOscProcessor() + const states: string[] = [] + try { + for (let index = 0; index < transcript.length; index += size) { + const raw = transcript.slice(index, index + size) + const projected = projection.project(raw) + // oxlint-disable-next-line no-control-regex -- Terminal protocol delimiters contain ESC and BEL. + expect(projected.replace(/\x1b\]9999;[^\x07]*\x07/g, '')).toBe(raw) + for (const payload of parse(projected).payloads) { + expect(payload.agentType).toBe('freebuff') + if (states.at(-1) !== payload.state) { + states.push(payload.state) + } + } + } + expect(states).toContain('working') + expect(states).toContain('waiting') + expect(states.at(-1)).toBe('done') + projection.resize(90, 30) + projection.dispose() + expect(projection.project('later output')).toBe('later output') + } finally { + projection.dispose() + } + } + ) +}) diff --git a/src/relay/freebuff-status-projection.ts b/src/relay/freebuff-status-projection.ts new file mode 100644 index 000000000000..6e8ea7d9de32 --- /dev/null +++ b/src/relay/freebuff-status-projection.ts @@ -0,0 +1,45 @@ +import { HeadlessEmulator } from '../main/daemon/headless-emulator' +import { + FreebuffScreenStatusTracker, + splitFreebuffScreenUpdates +} from '../shared/freebuff-screen-status' + +/** Emits the existing status OSC on the execution host, preserving the PTY's raw byte credit. */ +export class FreebuffStatusProjection { + private readonly emulator: HeadlessEmulator + private readonly tracker = new FreebuffScreenStatusTracker(true) + private disposed = false + + constructor(cols: number, rows: number) { + this.emulator = new HeadlessEmulator({ cols, rows, scrollback: 0 }) + } + + project(data: string): string { + if (this.disposed) { + return data + } + return splitFreebuffScreenUpdates(data, this.emulator.partialEscapeTailAnsi) + .map((chunk) => { + if (!this.emulator.writeSync(chunk)) { + return chunk + } + const status = this.tracker.observe(chunk, () => ({ + lines: this.emulator.getVisibleLines(), + alternate: this.emulator.isAlternateScreen + })) + return status ? `${chunk}\x1b]9999;${JSON.stringify(status)}\x07` : chunk + }) + .join('') + } + + resize(cols: number, rows: number): void { + if (!this.disposed) { + this.emulator.resize(cols, rows) + } + } + + dispose(): void { + this.disposed = true + this.emulator.dispose() + } +} diff --git a/src/relay/pty-handler-output-streaming.test.ts b/src/relay/pty-handler-output-streaming.test.ts index af0a4cbdfaa5..1030d98ca42b 100644 --- a/src/relay/pty-handler-output-streaming.test.ts +++ b/src/relay/pty-handler-output-streaming.test.ts @@ -1,3 +1,5 @@ +import { readFileSync } from 'node:fs' +import { join } from 'node:path' import './mock-descendant-sweep' import { describe, expect, it, vi, beforeEach, afterEach } from 'vitest' import { PTY_STARTUP_INGRESS_VERSION } from '../shared/pty-startup-ingress' @@ -150,6 +152,34 @@ describe('PtyHandler', () => { expect(dispatcher.notify).toHaveBeenCalledWith('pty.data', { id: PTY_1, data: 'hello world' }) }) + it('publishes Freebuff host status without charging synthetic OSC bytes to the PTY', async () => { + let onData: ((data: string) => void) | undefined + mockPtySpawn.mockReturnValue({ + ...mockPtyInstance, + onData: vi.fn((callback: (data: string) => void) => { + onData = callback + }) + }) + await dispatcher.callRequest('pty.spawn', { launchAgent: 'freebuff', cols: 120, rows: 40 }) + const raw = readFileSync( + join(import.meta.dirname, '../main/runtime/__fixtures__/freebuff-trust.txt'), + 'utf8' + ) + onData!(raw) + vi.advanceTimersByTime(8) + expect(dispatcher.notify).toHaveBeenCalledWith('pty.data', { + id: PTY_1, + data: expect.stringContaining('"state":"blocked"'), + rawLength: raw.length, + seq: raw.length, + transformed: true + }) + dispatcher.notify.mockClear() + onData!('more output') + vi.advanceTimersByTime(8) + expect(dispatcher.notify).toHaveBeenCalledWith('pty.data', { id: PTY_1, data: 'more output' }) + }) + it('consumes capable startup queries before relay replay and fanout', async () => { let dataCallback: ((data: string) => void) | undefined const term = { diff --git a/src/relay/pty-handler.ts b/src/relay/pty-handler.ts index fe53e5dd2363..6f17479784fa 100644 --- a/src/relay/pty-handler.ts +++ b/src/relay/pty-handler.ts @@ -1,3 +1,4 @@ +import { FreebuffStatusProjection } from './freebuff-status-projection' /* oxlint-disable max-lines */ import type { IPty } from 'node-pty' import { killWithDescendantSweep } from '../main/pty-descendant-termination' @@ -205,6 +206,7 @@ function parseSourceRecoveryRequest(value: unknown): PtySourceRecoveryRequest | } type ManagedPty = { + freebuffStatus?: FreebuffStatusProjection id: string incarnationId: string pty: IPty @@ -971,11 +973,12 @@ export class PtyHandler { this.notifyPoolListener(this.ptyPoolActiveListener, 'pty-pool-active') const emitIngressData = (emission: PtyIngressEmission): void => { const rawLength = emission.rawEndSeq - emission.rawStartSeq - this.appendReplayBuffer(managed, emission.data) + const data = managed.freebuffStatus?.project(emission.data) ?? emission.data + this.appendReplayBuffer(managed, data) this.enqueuePtyOutput( managed.id, - emission.data, - emission.transformed || rawLength !== emission.data.length + data, + emission.transformed || rawLength !== data.length ? { rawLength, seq: emission.rawEndSeq, transformed: true } : {} ) @@ -1086,6 +1089,7 @@ export class PtyHandler { // teardown mid-proof must still deliver the held prompt before exit. managed.recoveryBarrier?.flushPending() managed.recoveryBarrier?.dispose() + managed.freebuffStatus?.dispose() } private notifyExitListener(managed: ManagedPty): void { @@ -2011,6 +2015,9 @@ export class PtyHandler { const ownerClientInstanceId = context === undefined ? null : (this.consumerIdentityResolver?.(context.clientId) ?? null) const managed: ManagedPty = { + ...(launchAgent === 'freebuff' + ? { freebuffStatus: new FreebuffStatusProjection(cols, rows) } + : {}), id, incarnationId: randomUUID(), pty: term, @@ -2257,6 +2264,7 @@ export class PtyHandler { // npm, where the patch is not applied. So the catch below stays. try { managed.pty.resize(cols, rows) + managed.freebuffStatus?.resize(cols, rows) } catch (err) { // A failed ioctl observed the handle, not the host's process table, so on // its own it is `unverifiable`. Re-probe: a now-absent pid retires the diff --git a/src/shared/freebuff-screen-status.ts b/src/shared/freebuff-screen-status.ts new file mode 100644 index 000000000000..524caefd6a18 --- /dev/null +++ b/src/shared/freebuff-screen-status.ts @@ -0,0 +1,148 @@ +import type { ParsedAgentStatusPayload } from './agent-status-types' +import { extractLastOscTitle } from './osc-title-extraction' +import { extractOscTitleScanTail } from './osc-title-scan-tail' +import { advancePartialEscapeTail } from './terminal-partial-escape-tail' + +export function splitFreebuffScreenUpdates(data: string, pendingEscape: string): string[] { + const input = pendingEscape + data + const chunks: string[] = [] + let start = 0 + // oxlint-disable-next-line no-control-regex -- Terminal protocol delimiters contain ESC and BEL. + for (const match of input.matchAll(/\x1b\[\?2026l/g)) { + const end = match.index + match[0].length - pendingEscape.length + if (end > start) { + chunks.push(data.slice(start, end)) + } + start = Math.max(start, end) + } + if (start < data.length) { + chunks.push(data.slice(start)) + } + return chunks +} + +function cleanBoxLine(line: string): string { + return line.replace(/^[│┃\s]+|[│┃\s]+$/g, '').trim() +} + +/** Reads the live composer area, never status words in the conversation above it. */ +export function readFreebuffScreenStatus( + lines: readonly string[], + alternate: boolean +): Omit | null { + const text = lines.join('\n') + if (!alternate) { + if ( + /freebuff found agent files in this repository/.test(text) && + /Load and run these\? \[y\/N\]/.test(text) + ) { + return { state: 'blocked', toolInput: 'Trust repository agent files? [y/N]' } + } + return null + } + if (/Press ENTER to login\.\.\./.test(text)) { + return { state: 'blocked', toolInput: 'Sign in to Freebuff' } + } + const footer = lines.findLastIndex((line) => /\/model\s+to change.*Chat:/.test(line)) + if (footer === -1) { + return null + } + const dialog = lines.findLastIndex((line) => /[╭─].*Some questions for you.*[─╮]/.test(line)) + if ( + dialog !== -1 && + dialog < footer && + /↑↓ navigate/.test(lines.slice(dialog, footer).join('\n')) + ) { + const body = lines.slice(dialog + 1, footer).map(cleanBoxLine) + const question = body.find((line) => /^[▼▶▸▾►]/.test(line))?.replace(/^[▼▶▸▾►]\s*/, '') + const options = body.flatMap((line) => { + const match = /^[○●]\s+(.+)$/.exec(line) + return match ? [{ label: match[1], description: '' }] : [] + }) + return { + state: 'waiting', + toolName: 'ask_user', + toolInput: question ?? 'Freebuff is waiting for an answer', + ...(question + ? { interactivePrompt: JSON.stringify({ questions: [{ question, options }] }) } + : {}) + } + } + const composerTop = lines.findLastIndex( + (line, index) => index < footer && /^\s*╭─+╮\s*$/.test(line) + ) + if (composerTop === -1 || footer - composerTop > 12) { + return null + } + const status = lines[composerTop - 1]?.trim() ?? '' + if ( + /^(?:thinking|working|connecting|retrying)\.\.\./.test(status) || + status.startsWith('high demand — in line') + ) { + return { state: 'working' } + } + if (status === '' && text.includes('Your first message starts the session.')) { + return { state: 'done' } + } + if (/^(?:\d+[hms]\s*)+left\b|^unlimited\b/.test(status) && /End session/.test(status)) { + return { state: 'done' } + } + return null +} + +/** One observation stream per execution-host terminal; recreated with its screen model. */ +export class FreebuffScreenStatusTracker { + private titleTail = '' + private frameTail = '' + private insideFrame = false + private identified: boolean + private prompt = '' + private previous: string | null = null + private worked = false + + constructor(identified = false) { + this.identified = identified + } + + observe( + data: string, + readScreen: () => { lines: readonly string[]; alternate: boolean } + ): ParsedAgentStatusPayload | null { + const titleInput = this.titleTail + data + this.titleTail = extractOscTitleScanTail(titleInput) + const title = extractLastOscTitle(titleInput) + if (title?.startsWith('Freebuff: ')) { + this.identified = true + this.prompt = title.slice('Freebuff: '.length) + } + const frameInput = this.frameTail + data + // oxlint-disable-next-line no-control-regex -- Terminal protocol delimiters contain ESC and BEL. + for (const match of frameInput.matchAll(/\x1b\[\?2026([hl])/g)) { + this.insideFrame = match[1] === 'h' + } + this.frameTail = advancePartialEscapeTail(this.frameTail, data) + if (!this.identified || this.insideFrame || this.frameTail.length > 0) { + return null + } + const { lines, alternate } = readScreen() + const result = readFreebuffScreenStatus(lines, alternate) + if (!result) { + return null + } + const payload: ParsedAgentStatusPayload = { + ...result, + agentType: 'freebuff', + prompt: this.prompt, + ...(result.state === 'done' && !this.worked ? { sessionBoundary: true } : {}) + } + if (result.state === 'working' || result.state === 'waiting') { + this.worked = true + } + const signature = JSON.stringify(payload) + if (signature === this.previous) { + return null + } + this.previous = signature + return payload + } +} From e13c1a59912b1a9d9a329c73ac51a199514643bc Mon Sep 17 00:00:00 2001 From: Neil Date: Mon, 28 Sep 2026 01:31:00 -0700 Subject: [PATCH 3/5] fix(agents): reset Freebuff status at a new session boundary --- src/main/runtime/freebuff-status-transcript.test.ts | 13 +++++++++++-- src/shared/freebuff-screen-status.ts | 6 +++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/main/runtime/freebuff-status-transcript.test.ts b/src/main/runtime/freebuff-status-transcript.test.ts index f06455ce9733..04aa1e0a2abd 100644 --- a/src/main/runtime/freebuff-status-transcript.test.ts +++ b/src/main/runtime/freebuff-status-transcript.test.ts @@ -84,7 +84,7 @@ describe('Freebuff execution-host status', () => { } }) - it('clears a startup block when the captured first-message composer becomes ready', async () => { + it('clears startup blocks and starts a fresh session after an earlier completed turn', async () => { const wiring = makeAgentStatusStoreWiring() const { runtime } = await createTranscriptPane( { @@ -97,7 +97,7 @@ describe('Freebuff execution-host status', () => { wiring.deps ) try { - for (const name of ['trust', 'ready']) { + for (const name of ['trust', 'ready', 'lifecycle', 'ready']) { runtime.onPtyData( TRANSCRIPT_PANE_PTY_ID, readFileSync(join(import.meta.dirname, `__fixtures__/freebuff-${name}.txt`), 'utf8'), @@ -107,6 +107,15 @@ describe('Freebuff execution-host status', () => { expect(wiring.statusStore.getStatusSnapshot()[0]?.state).toBe( name === 'trust' ? 'blocked' : 'done' ) + if (name === 'ready') { + expect(wiring.statusStore.getStatusSnapshot()[0]).toMatchObject({ + sessionBoundary: true, + prompt: '' + }) + } + if (name === 'lifecycle') { + expect(wiring.statusStore.getStatusSnapshot()[0]?.sessionBoundary).not.toBe(true) + } } expect(wiring.statusStore.getStatusSnapshot()[0]?.toolInput).toBeUndefined() } finally { diff --git a/src/shared/freebuff-screen-status.ts b/src/shared/freebuff-screen-status.ts index 524caefd6a18..e5f18472a7d4 100644 --- a/src/shared/freebuff-screen-status.ts +++ b/src/shared/freebuff-screen-status.ts @@ -82,7 +82,7 @@ export function readFreebuffScreenStatus( return { state: 'working' } } if (status === '' && text.includes('Your first message starts the session.')) { - return { state: 'done' } + return { state: 'done', sessionBoundary: true } } if (/^(?:\d+[hms]\s*)+left\b|^unlimited\b/.test(status) && /End session/.test(status)) { return { state: 'done' } @@ -129,6 +129,10 @@ export class FreebuffScreenStatusTracker { if (!result) { return null } + if (result.sessionBoundary) { + this.prompt = '' + this.worked = false + } const payload: ParsedAgentStatusPayload = { ...result, agentType: 'freebuff', From fa87dce5d578438e6bccad9a9158e70156e35a86 Mon Sep 17 00:00:00 2001 From: Neil Date: Mon, 28 Sep 2026 01:55:10 -0700 Subject: [PATCH 4/5] test(terminal): baseline existing Freebuff transcript replay differences --- src/main/daemon/serialize-grid-transcript-replay.test.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/daemon/serialize-grid-transcript-replay.test.ts b/src/main/daemon/serialize-grid-transcript-replay.test.ts index d8738248d3eb..d2f84ddcb698 100644 --- a/src/main/daemon/serialize-grid-transcript-replay.test.ts +++ b/src/main/daemon/serialize-grid-transcript-replay.test.ts @@ -45,7 +45,10 @@ const KNOWN_PREEXISTING_I2_FAILURES: Record = { // background that the round trip does not restore to default. Verified as upstream, not a // regression, by replaying it against the previous build // (`build-serialize-addon-at-ref.mjs --ref origin/main`): I1 and I3 both hold. - 'dsh-tui-ready-no-key': 10 + 'dsh-tui-ready-no-key': 10, + // Freebuff resize replay differences also occur at base 6835b9b4e3ea; differential I1/I3 pass. + 'freebuff-lifecycle': 12, + 'freebuff-login': 10 } type Transcript = { name: string; data: string; cols: number; rows: number } From 8bc937057564387a5b145e739cef13c74d1af7b4 Mon Sep 17 00:00:00 2001 From: Neil Date: Mon, 28 Sep 2026 02:03:05 -0700 Subject: [PATCH 5/5] test(terminal): pin exact Freebuff replay baseline checkpoints --- .../freebuff-serialize-baseline.json | 30 +++++++++++++++++++ .../serialize-grid-transcript-replay.test.ts | 24 +++++++++++---- 2 files changed, 49 insertions(+), 5 deletions(-) create mode 100644 src/main/daemon/__fixtures__/freebuff-serialize-baseline.json diff --git a/src/main/daemon/__fixtures__/freebuff-serialize-baseline.json b/src/main/daemon/__fixtures__/freebuff-serialize-baseline.json new file mode 100644 index 000000000000..1f35b2abaa05 --- /dev/null +++ b/src/main/daemon/__fixtures__/freebuff-serialize-baseline.json @@ -0,0 +1,30 @@ +{ + "freebuff-lifecycle": [ + "none/false/2/31:22f0e3d90d75ceaf6fd95853c0b772074e441596caadcea8d133b64bad5db0f6", + "none/true/2/31:22f0e3d90d75ceaf6fd95853c0b772074e441596caadcea8d133b64bad5db0f6", + "shrink/false/1/29:b5d123b659e7cdd5a3d8c6031529a032d60311b1073e46717d2cbed8d46b6ba4", + "shrink/false/2/32:c3408d293abaa4e25303a4d1acf1ea2f096a35ff685e548f98aec777355d10a5", + "shrink/false/2/34:6c1dd1d115eb1c2af110cfa30ce84649b206ff48c76bcbcdfa31877d1b918140", + "shrink/true/1/29:b5d123b659e7cdd5a3d8c6031529a032d60311b1073e46717d2cbed8d46b6ba4", + "shrink/true/2/32:c3408d293abaa4e25303a4d1acf1ea2f096a35ff685e548f98aec777355d10a5", + "shrink/true/2/34:6c1dd1d115eb1c2af110cfa30ce84649b206ff48c76bcbcdfa31877d1b918140", + "shrink-grow/false/2/33:407f38549bb5be0a2545ba448d21940a201f1cca92e8117e42f3b30907d7d486", + "shrink-grow/true/2/33:407f38549bb5be0a2545ba448d21940a201f1cca92e8117e42f3b30907d7d486", + "jitter/false/2/34:adbbc27204f00658207075d10787b1ae8d929226d70a5321e029635193dc432b", + "jitter/true/2/34:adbbc27204f00658207075d10787b1ae8d929226d70a5321e029635193dc432b" + ], + "freebuff-login": [ + "shrink-grow/false/1/21:92981723de5526414b99435b93b94ec87341b90acc7fea71b492e3ea6ae0d445", + "shrink-grow/false/1/23:92981723de5526414b99435b93b94ec87341b90acc7fea71b492e3ea6ae0d445", + "shrink-grow/false/2/33:f8c02c8afab034cc4fdcaa06b97764a32f6432d0c6d5f47b5f675fe6fd4cf67c", + "shrink-grow/true/1/21:44734d78cecaf5ae6203125b92dde9b61816b626efd6b643f78ce3f41c8b1b2d", + "shrink-grow/true/1/23:44734d78cecaf5ae6203125b92dde9b61816b626efd6b643f78ce3f41c8b1b2d", + "shrink-grow/true/2/33:f8c02c8afab034cc4fdcaa06b97764a32f6432d0c6d5f47b5f675fe6fd4cf67c", + "jitter/false/1/11:073b9a35e7a854d650d63f00dcc126f89656fab0f39951de83ff50fd564faab9", + "jitter/false/1/21:a046fe007dfe1161435083c3ed3448b4e74fa2203d692db99353b8df3c45f9a1", + "jitter/true/1/11:073b9a35e7a854d650d63f00dcc126f89656fab0f39951de83ff50fd564faab9", + "jitter/true/1/21:719241163ae1c3629c6a6e0739bb66324f620b8e285d176853d06d0ae26a6c00" + ], + "freebuff-ready": [], + "freebuff-trust": [] +} diff --git a/src/main/daemon/serialize-grid-transcript-replay.test.ts b/src/main/daemon/serialize-grid-transcript-replay.test.ts index d2f84ddcb698..0f2945a95760 100644 --- a/src/main/daemon/serialize-grid-transcript-replay.test.ts +++ b/src/main/daemon/serialize-grid-transcript-replay.test.ts @@ -1,3 +1,4 @@ +import { createHash } from 'node:crypto' import { existsSync, readdirSync, readFileSync } from 'node:fs' import { basename, join } from 'node:path' import { describe, expect, it } from 'vitest' @@ -45,12 +46,14 @@ const KNOWN_PREEXISTING_I2_FAILURES: Record = { // background that the round trip does not restore to default. Verified as upstream, not a // regression, by replaying it against the previous build // (`build-serialize-addon-at-ref.mjs --ref origin/main`): I1 and I3 both hold. - 'dsh-tui-ready-no-key': 10, - // Freebuff resize replay differences also occur at base 6835b9b4e3ea; differential I1/I3 pass. - 'freebuff-lifecycle': 12, - 'freebuff-login': 10 + 'dsh-tui-ready-no-key': 10 } +// Exact resize checkpoints and full GridDiff hashes from base 6835b9b4e3ea, not this branch. +const FREEBUFF_BASELINE: Record = JSON.parse( + readFileSync(join(__dirname, '__fixtures__/freebuff-serialize-baseline.json'), 'utf8') +) + type Transcript = { name: string; data: string; cols: number; rows: number } type Schedule = 'none' | 'shrink' | 'shrink-grow' | 'jitter' const SCHEDULES: readonly Schedule[] = ['none', 'shrink', 'shrink-grow', 'jitter'] @@ -142,6 +145,7 @@ describe('serialize round trip over captured PTY transcripts', () => { async (_name, transcript) => { const counts: Partial> = {} const blocking: string[] = [] + const failureSignatures: string[] = [] for (const schedule of SCHEDULES) { for (const conpty of [false, true]) { for (let seed = 1; seed <= SEEDS; seed++) { @@ -156,6 +160,14 @@ describe('serialize round trip over captured PTY transcripts', () => { ` ${transcript.name} ${schedule} conpty=${conpty} seed=${seed}: ${d.stage} row=${d.row} ${JSON.stringify(d.expected)?.slice(0, 160)} -> ${JSON.stringify(d.actual)?.slice(0, 160)}` ) } + if (check.gridDiff.new) { + const signature = createHash('sha256') + .update(JSON.stringify(check.gridDiff.new)) + .digest('hex') + failureSignatures.push( + `${schedule}/${conpty}/${seed}/${check.stepIndex}:${signature}` + ) + } for (const verdict of verdicts(check, serializers.length > 1)) { counts[verdict] = (counts[verdict] ?? 0) + 1 if (verdict === 'i1-bytes-differ' || verdict === 'regression') { @@ -172,7 +184,9 @@ describe('serialize round trip over captured PTY transcripts', () => { console.log(`${transcript.name} ${JSON.stringify(counts)}`) } expect(blocking).toEqual([]) - if (!OLD_ADDON_PATH && SEEDS === 2) { + if (SEEDS === 2 && transcript.name.startsWith('freebuff-')) { + expect(failureSignatures).toEqual(FREEBUFF_BASELINE[transcript.name] ?? []) + } else if (!OLD_ADDON_PATH && SEEDS === 2) { expect(counts['new-fail'] ?? 0).toBe(KNOWN_PREEXISTING_I2_FAILURES[transcript.name] ?? 0) } },