Skip to content

V2: revisit tool plugin APIs and execute integration architecture #35364

Description

@opencode-agent

Summary

Revisit the V2 tool APIs introduced to integrate CodeMode execute, and restructure the integration so it follows V2's intended plugin, registry, runner, and event patterns.

The current implementation works, but parts of the integration are intentionally expedient. Before treating it as the long-term pattern, we should review the public/internal tool APIs and remove special-case or synthetic wiring we do not want other tools to copy.

Review scope

  • audit the tool APIs and seams added for feat(core): expose deferred tools through execute #35361
  • decide whether execute should be a normal tool plugin, a registry/materialization adapter, or another explicit abstraction
  • align deferred-tool discovery with the supported plugin API
  • remove special-case Core/MCP wiring where a general mechanism should exist
  • verify permission propagation, child-call identity, progress, cancellation, errors, metadata, and attachments
  • keep nested execution observable without leaking CodeMode-specific concerns into the generic tool API
  • define which APIs are public for plugins versus internal implementation details
  • add focused architecture and integration tests around the chosen shape

Acceptance criteria

  • the team agrees on the long-term V2 tool/plugin API shape used by execute
  • execute is implemented through that shape without one-off registry/runner hooks
  • Core tools, MCP tools, and external plugin tools follow consistent discovery and execution rules
  • progress support composes with the separate progressive-tool-update design
  • current CodeMode behavior remains covered by tests

Related

Source: https://discord.com/channels/1391832426048651334/1520962938733723720/1523078773669367919

Activity

added
coreAnything pertaining to core functionality of the application (opencode server stuff)
on Jul 4, 2026

Dante-dan commented on Sep 26, 2026

@Dante-dan

I traced the current V2 path at f0ed4f6: built-ins, plugin tools, and MCP tools already register through Tool.Service.transform. Tool.snapshot filters that set for the request, then derives the CodeMode catalog and execute. The direction recorded in #36196—ordinary tools are canonical and their authors need not know CodeMode exists—supports keeping this boundary.

I suggest treating execute as a request-scoped projection of the filtered tool set, while keeping normal tools on the common plugin registration path. The remaining narrow refactor is to route the generated execute entry through the same snapshot dispatch used for direct tools, then cover permission visibility and late calls, nested call identity/progress, interruption and errors, and metadata/file forwarding in focused tests. This avoids adding a second public tool type or a CodeMode requirement to plugin authors. Broader plugin capabilities in #34957 and the attachment/cancellation behavior in #47458 can keep their separate scopes.

Could the core team confirm that this is the intended long-term API boundary for #35364?

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    2.0coreAnything pertaining to core functionality of the application (opencode server stuff)

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions