Skip to content

[Migration] Phase 5: Remove OpenCode Dependency #24

@aWN4Y25pa2EK

Description

@aWN4Y25pa2EK

Overview

Replace @opencode-ai/sdk dependency with native OpenRouter extended thinking via AI SDK.

Parent Epic: #19
Depends on: #21

Acceptance Criteria

  • opencode-client.ts removed or replaced with AI SDK wrapper
  • opencode_reason tool uses AI SDK with :thinking model variant
  • SSE streaming preserved for real-time reasoning output
  • @opencode-ai/sdk removed from package.json
  • OpenCode config section removed from config.ts

Files to Modify

  • src/tools/opencode-client.ts → DELETE or refactor
  • src/holons/adk/tools.ts - Update openCodeReasonTool
  • src/config.ts - Remove opencode section
  • package.json - Remove @opencode-ai/sdk

Technical Notes

Extended thinking via OpenRouter:

import { streamText } from 'ai';
import { openrouter } from '@openrouter/ai-sdk-provider';

const result = await streamText({
  model: openrouter('anthropic/claude-opus-4.5:thinking'),
  prompt: problem,
  providerOptions: {
    openrouter: {
      reasoning: { effort: 'high' }
    }
  }
});

// Access reasoning tokens
const reasoning = result.reasoning;
const usage = result.usage; // includes reasoningTokens

Migration Path

  1. Create new src/tools/extended-reasoning.ts using AI SDK
  2. Update openCodeReasonTool to use new implementation
  3. Verify reasoning output matches previous quality
  4. Remove old OpenCode client and dependency

Testing

  • Test extended reasoning on complex decomposition tasks
  • Verify reasoning tokens tracked in usage
  • Check SSE streaming works for real-time output
  • Compare output with OpenCode baseline

Part of Hybrid ADK + AI SDK Migration

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions