Skip to content

[Feature] RPC scope extension: expose orchestration control methods for remote Runtime #9814

Description

@leiyikang-tech

Summary

The Orca Runtime RPC server currently exposes a runtime scope with only CLI-level methods. This issue extends the RPC scope to include orchestration control methods, enabling a hub Orca instance to dispatch tasks and manage agents on a remote Runtime.

Current State

  • OrcaRuntimeRpcServer binds 0.0.0.0:6768 with WebSocket transport
  • RPC method scopes: mobile (252 methods), runtime (CLI-level only)
  • Current design purpose: desktop → mobile companion, not desktop → desktop
  • No orchestration control methods exposed to remote Runtimes

Gap

A hub Orca cannot instruct a remote Runtime to:

  • Create a new agent terminal
  • Send a prompt to an existing terminal
  • List running terminals and their status
  • Approve/deny permission requests
  • Query worktree state

Proposed Changes

1. New RPC Scope: orchestration

type OrchestrationRpcMethods = {
  // Terminal management
  "orchestration.createTerminal": (opts: CreateTerminalOpts) => Promise<string>
  "orchestration.listTerminals": () => Promise<TerminalInfo[]>
  "orchestration.sendPrompt": (handle: string, prompt: string) => Promise<void>
  "orchestration.closeTerminal": (handle: string) => Promise<void>
  
  // Status & monitoring
  "orchestration.getTerminalStatus": (handle: string) => Promise<AgentStatusState>
  "orchestration.getTerminalPaneKey": (handle: string) => Promise<string>
  
  // Approval
  "orchestration.approvePermission": (requestId: string) => Promise<void>
  "orchestration.denyPermission": (requestId: string) => Promise<void>
  
  // Worktree
  "orchestration.listWorktrees": () => Promise<WorktreeInfo[]>
  "orchestration.probeWorktreeDrift": (worktreeId: string) => Promise<DriftResult>
  
  // Health
  "orchestration.healthCheck": () => Promise<RuntimeHealthReport>
  "orchestration.capabilityReport": () => Promise<RuntimeCapabilityReport>
}

2. Authentication & Authorization

  • Orchestration scope requires a separate auth token (not the mobile token)
  • Hub and satellite must exchange orchestration tokens during connection handshake
  • Rate limiting: max 10 orchestration RPC calls per second per connection

3. Event Streaming

Remote Runtime pushes status change events to hub via RPC notifications:

type OrchestrationNotification = 
  | { type: "terminal.status_changed", handle: string, status: AgentStatusState }
  | { type: "terminal.created", handle: string, title: string }
  | { type: "terminal.closed", handle: string }
  | { type: "permission.requested", requestId: string, handle: string, toolName: string }
  | { type: "health.degraded", runtimeId: string }

Dependencies

  • Prerequisite for: Coordinator remote Runtime dispatch
  • Related to: Remote Runtime health check

Estimated Effort

1-2 weeks

Related Code

  • src/main/relay/ — RPC server implementation
  • src/shared/remote-runtime-client.ts — Remote Runtime client
  • src/main/runtime/orchestration/coordinator-runtime.ts — CoordinatorRuntime interface

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    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