generated from BlackHatMagic/Template-Bare
feat/computer: add direct AutoHotkey execution and screenshots #12
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/ahk"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
ahktool that executes AutoHotkey v2 code directly, like bash, with stdout/error capture, cancellation, process-tree termination, and timeouts.computer_screenshotfor primary-monitor/full-desktop PNG capture with native coordinate metadata.Related issues
Requested directly by the repository owner; no separate issue.
Design / security
Computer tools are disabled by default and only load on native Windows. AHK executes with full user permissions, without extra approval, as requested. Captures are sent to the selected model provider and retained in session history. Temporary scripts/captures are cleaned up. Detached apps and existing side effects are not undone by Stop.
Testing evidence
bun run check: typecheck + 54 tests pass.bun run build: production build passes.git diff --check: passes.Known validation limit
This workspace runs Linux. Native Windows AutoHotkey and real screen capture still need a Windows smoke test; process behavior is covered by deterministic helper mocks.
Checklist
Pi code review
1 new actionable finding
src/computer-extension.ts:80Reviewed the supplied changes against the pinned base, focusing on Windows tool execution, screenshot handling, session integration, and image rendering. No checks were run, and native Windows behavior could not be exercised.
Change walkthrough
README.mdsrc/computer-extension.ts,src/session.ts,src/settings-data.ts,src/settings.ts(+4 more)tests/computer-extension.test.ts,tests/chat-state.test.ts,tests/chat-view.test.ts,tests/fixtures/chat-view.ts(+1 more)Review effort: 4/5.
Static observations (not validation results)
Reviewed
d710873af42deca5b726ab1cd91c18fc453da807withproxy/glm-5.3-flash + proxy/deepseek-v4.1-flash + proxy/gpt-6.1-sol → proxy/gpt-6.1-terra. Automated advisory review; no project commands or tests were executed.@ -0,0 +77,4 @@let output = "";let failure: Error | undefined;let killer: ReturnType<typeof spawn> | undefined;const append = (chunk: Buffer): void => { output = (output + chunk.toString("utf8")).slice(-32_768); };[P2] UTF-8 output can be corrupted across pipe chunks
The runner decodes each stdout and stderr chunk independently. If a multibyte UTF-8 character is split across chunks, its bytes are replaced with replacement characters rather than reconstructed.
Trigger: An AutoHotkey script writes UTF-8 output containing a multibyte character whose bytes arrive in separate pipe chunks.
Impact: The agent and user can receive corrupted window titles, file paths, or other script results, potentially preventing the agent from correctly using those results in subsequent automation.
Evidence: In src/computer-extension.ts, the shared data handler calls chunk.toString("utf8") separately for each chunk before appending it to the output. Neither stream retains an incomplete character between data events; the mocked execution tests write output in a single chunk.
Confirmed review finding 2320 and fixed in
4ace741. Both pipes now use setEncoding("utf8"), giving stdout and stderr independent streaming decoder state. Added a regression test with interleaved incomplete UTF-8 characters across both pipes. Typecheck, all 55 tests, production build, and diff checks pass.Pi code review
0 new actionable findings
No new actionable findings. Previously reported issues, if any, are tracked below.
Earlier findings: 1 rechecked
src/computer-extension.ts:80, first reported in review #453) — src/computer-extension.ts now calls setEncoding("utf8") independently on stdout and stderr before attaching their data handlers, preserving decoder state across chunks for each stream. tests/computer-extension.test.ts adds interleaved split-byte coverage; the test was inspected but not run.Reviewed the pinned head against the supplied base across the Windows computer tools, session integration, image rendering, settings, documentation, and tests. This was a read-only static review; checks were not run, and native Windows behavior remains unverified.
Change walkthrough
src/computer-extension.ts,src/session.ts,src/chat-state.ts,src/chat-view.ts(+4 more)README.mdtests/computer-extension.test.ts,tests/chat-state.test.ts,tests/chat-view.test.ts,tests/fixtures/chat-view.ts(+1 more)Review effort: 3/5.
Static observations (not validation results)
Reviewed
4ace7412710bd5c8556d67dab838f7e2e25fc006withproxy/glm-5.3-flash + proxy/deepseek-v4.1-flash + proxy/gpt-6.1-sol → proxy/gpt-6.1-terra. Automated advisory review; no project commands or tests were executed.