7.6 KiB
computer-use-mcp Agent Notes
Scope: services/computer-use-mcp/**
Mission
computer-use-mcp is AIRI's deterministic execution substrate.
- AIRI owns planning, chat UX, approval UX, provider integration, and MCP attachment.
computer-use-mcpowns execution primitives, workflow orchestration, terminal/browser/desktop surfaces, trace, audit, and safety checks.- Treat terminal, browser, editor, and desktop operations as one task system. Do not split them into disconnected demos.
Current Status Snapshot
Updated for the current terminal-lane-v2 workstream.
The important truth is:
execis already a real mainline surface.PTYis no longer just a loose tool set; the workflow engine now has self-acquire support.- The service-layer terminal E2Es are green.
- The AIRI chat terminal demo is now aligned with terminal lane v2 and no longer pre-creates PTY.
- The desktop shell now distinguishes
pty_sessionfromterminal_and_apps. - AIRI chat self-acquire is now part of the strict release gate set, so PTY mainline support is no longer intentionally held back.
Do not rely on compressed chat summaries to resume this work. Use this file as the handoff source of truth and update it when terminal-lane behavior changes materially.
Terminal Lane v2: What Is Already Landed
1. Terminal surface model exists
Terminal-capable workflow steps now have explicit terminal semantics instead of pure guesswork:
mode: 'exec' | 'auto' | 'pty'interaction: 'one_shot' | 'persistent'
The main implementation lives in:
src/workflows/types.tssrc/workflows/surface-resolver.tssrc/terminal/interactive-patterns.ts
2. Auto surface resolution is fixed to a small rule set
auto is intentionally narrow. It only upgrades to PTY when one of these is true:
- The current
taskId + stepIdalready has a bound PTY session. - The step explicitly declares
interaction: 'persistent'. - The command matches
KNOWN_INTERACTIVE_COMMAND_PATTERNS. - A failed/timed-out exec attempt surfaces one of
INTERACTIVE_OUTPUT_MARKERS.
This rule set is covered by:
src/workflows/surface-resolver.test.tssrc/terminal/interactive-patterns.test.ts
3. Workflow engine can self-acquire PTY
The engine already contains the v2 shape:
AcquirePtyForStepStepTerminalProgress- suspension point
before_pty_acquire - PTY step family support:
pty_send_inputpty_read_screenpty_wait_for_outputpty_destroy_session
The main implementation lives in:
src/workflows/engine.ts
The intended behavior is:
- workflow resolves the terminal surface
- if PTY is needed, workflow acquires/binds PTY itself
- workflow continues inside the same workflow
- outward terminal reroute is now secondary, not the mainline proof
4. Service-layer PTY self-acquire E2E exists and is green
The current real terminal E2E for v2 is:
src/bin/e2e-terminal-self-acquire.ts
This script now proves:
- no pre-created PTY
- workflow detects an interactive command
- engine self-acquires PTY
- command executes on PTY
- step succeeds without outward reroute
- run-state / binding / audit stay consistent
It currently uses:
workflow_validate_workspace- an interactive
checkCommandofvim --version
This is the current service-level proof for terminal lane v2.
5. AIRI chat self-acquire demo is now on the v2 path
src/bin/e2e-airi-chat-terminal-self-acquire.ts follows the same product story:
- no harness-side
pty_create - AIRI calls the real workflow
- the workflow self-acquires PTY for the interactive validation step
- AIRI finishes with a natural-language summary for demo use
The latest successful reports live under:
.computer-use-mcp/reports/airi-chat-terminal-self-acquire-*
The current package commands are:
pnpm -F @proj-airi/computer-use-mcp e2e:airi-chat-terminal-self-acquirepnpm -F @proj-airi/computer-use-mcp demo:terminal-self-acquire
6. Support matrix already reflects the new direction
Relevant entries in src/support-matrix.ts:
terminal_exec→product-supportedterminal_pty→product-supportedterminal_exec_to_pty_reroute→coveredand explicitly labeled legacy fallbackterminal_auto_surface_resolution→coveredterminal_pty_self_acquire→product-supportedterminal_pty_step_family→covered
The current strict release gates are:
pnpm -F @proj-airi/computer-use-mcp e2e:developer-workflowpnpm -F @proj-airi/computer-use-mcp e2e:terminal-execpnpm -F @proj-airi/computer-use-mcp e2e:terminal-ptypnpm -F @proj-airi/computer-use-mcp e2e:terminal-self-acquirepnpm -F @proj-airi/computer-use-mcp e2e:airi-chat-terminal-self-acquire
What Is Still Not Finished
These are the real gaps. Do not talk yourself into thinking terminal lane is fully shipped before they are closed.
1. Desktop approval semantics are improved, but still need one more explicit review
apps/stage-tamagotchi/src/renderer/App.vue now distinguishes:
terminal_and_appspty_session
and it no longer pretends a PTY approval is the same thing as a generic terminal/app grant.
The current intended behavior is:
terminal_exec/open_app/focus_appkeep the old session-scoped auto-approve behaviorpty_createstores apty_sessiongrant scopepty_createdoes not auto-approve future PTY creation requests
This is much closer to the product model, but it is still worth reviewing whenever approval UX changes again.
Where To Look First
If you are continuing terminal lane work, read these first:
src/workflows/engine.tssrc/workflows/surface-resolver.tssrc/terminal/interactive-patterns.tssrc/bin/e2e-terminal-self-acquire.tssrc/bin/e2e-airi-chat-terminal-self-acquire.tssrc/support-matrix.tsapps/stage-tamagotchi/src/renderer/App.vueapps/stage-tamagotchi/src/renderer/modules/computer-use-approval.ts
That set is enough to reconstruct the current terminal-lane-v2 state without rereading the entire repo.
Validation Commands
Use these as the baseline checks for terminal lane work:
Service-level terminal lane
pnpm -F @proj-airi/computer-use-mcp e2e:terminal-execpnpm -F @proj-airi/computer-use-mcp e2e:terminal-ptypnpm -F @proj-airi/computer-use-mcp e2e:terminal-self-acquirepnpm -F @proj-airi/computer-use-mcp e2e:airi-chat-terminal-self-acquire
Core test coverage
pnpm -F @proj-airi/computer-use-mcp exec vitest run --config ./vitest.config.ts
Typecheck
pnpm -F @proj-airi/computer-use-mcp typecheckpnpm -F @proj-airi/stage-ui typecheck
If pnpm -F @proj-airi/stage-tamagotchi typecheck behaves oddly in the current environment, run the two underlying commands directly:
pnpm -F @proj-airi/stage-tamagotchi run typecheck:nodepnpm -F @proj-airi/stage-tamagotchi run typecheck:web
Handoff Rules
If you change terminal lane behavior, update this file before stopping.
At minimum, always rewrite these four facts:
- Is PTY self-acquire the mainline, or does any path still depend on pre-created PTY?
- Is AIRI chat E2E aligned with the service-level terminal lane, or still on an older path?
- Is desktop approval using real
pty_sessionsemantics, or still oldterminal_and_appssemantics? - Which terminal capabilities are
product-supportedvs onlycoveredinsrc/support-matrix.ts?
If those four facts are stale, the next agent will lose time re-deriving context from code.
Boundary Reminder
- Keep provider-specific behavior in AIRI /
packages/stage-ui/**. - Keep OS-executor and workflow orchestration logic here.
- Do not expand this workstream into browser, native click/type/press, or VS Code productization until terminal lane is actually closed.