Skip to content

refactor(runtime): extract computer-use wire codec and contract types from computer-use-tools.ts #1405

Closed

Description

@Astro-Han

Part of #1084 (second-pass sink-file and boundary governance). Scope re-verified against current main (computer-use-tools.ts, 1836 lines).

Scope

  • Extract the wire-protocol codec into computer-use-codec.ts, mirroring the existing openai-computer-codec.ts pattern: the computerParams zod discriminated union (~L230+), snapshotComputerParams (~L469), adaptToCuAction (~L496), and summarize (~L590) if its call surface allows.
  • Move the contract types into computer-use-types.ts so adapters stop importing the implementation file: CuRunResult, CuDispatchBackend, CuDispatchOutcome, CuDispatchEvidence, CuScreenshot, CuObservation, CuSemanticAction, CuRunContext, and the overlay hooks.
  • buildComputerUseTools stays in computer-use-tools.ts.

Invariants

Same as #1084: behavior-neutral; keep @maka/runtime public exports stable via re-exports; no reverse imports from new leaf files; flat PR off main.

Verification

Typecheck/build + existing computer-use tests.

Activity

  1. added
    enhancement
    good first issue
    on Jul 23, 2026
  2. chinawch007 commented on Jul 25, 2026

    @chinawch007
    Contributor

    I'd like to claim this task.

    My plan is: split computer-use-tools.ts along the seam the issue describes — computer-use-types.ts (the 13 Cu* contract types + overlay hooks, pure leaf), computer-use-codec.ts (the computerParams zod union + snapshotComputerParams + adaptToCuAction + summarize and its helpers, depending only on types), and retain buildComputerUseTools in computer-use-tools.ts.

    A few implementation notes: computerParams and summarize are currently module-private — they'll become exports on the codec so buildComputerUseTools can import them back. The shared coordinate/text zod helpers move with computerParams to the codec; computerWireParams (stays in tools) imports them back (one-way). summarizeEvidence is also called directly at L907 inside buildComputerUseTools, so it'll be exported from the codec too. index.ts re-exports will point at the new locations so @maka/runtime's public surface is unchanged, and openai-computer-loop.ts keeps working via tools.ts re-exports. Behavior-neutral; verifying with typecheck/build + the existing computer-use test suite.

  3. chinawch007 commented on Jul 26, 2026

    @chinawch007
    Contributor

    Implemented in PR #1507 : split computer-use-tools.ts into computer-use-types.ts (13 pure contract types, zero-dep leaf) + computer-use-codec.ts (computerParams zod union, adaptToCuAction, summarize, mirroring the openai-computer-codec.ts pattern) + retained buildComputerUseTools in tools.ts. Behavior-neutral; @maka/runtime public surface unchanged via re-exports. Verified with typecheck/build + 2554 runtime tests (0 fail).

  4. Astro-Han commented on Aug 2, 2026

    @Astro-Han
    ContributorAuthor

    Extracted in #1507. computer-use-codec.ts and the contract types are on main, and @maka/runtime keeps its public exports through re-export.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementgood first issue

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions