Skip to content

armgit / orca

Public Imported from GitHub
0

Orca is the place for working with a fleet of agents (e.g. Grok Bot, Claude Code). Run any coding agent with your own subscription. Available on desktop, mobile and remote runtime.

1.2 KB
Raw Blame
import type { Page } from '@stablyai/playwright-test'
import type { AgentType } from '../../../src/shared/agent-status-types'
import { waitForActivePaneHookDescriptor } from './terminal'

export async function showActivePaneAsNativeChat(
  page: Page,
  agentType: AgentType,
  title: string
): Promise<void> {
  const descriptor = await waitForActivePaneHookDescriptor(page)
  await page.evaluate(
    async ({ paneKey, worktreeId, agentType, title }) => {
      const settings = await window.api.settings.set({ experimentalNativeChat: true })
      const store = window.__store
      if (!store) {
        throw new Error('Store unavailable')
      }
      store.setState({ settings })
      const state = store.getState()
      state.setAgentStatus(paneKey, { state: 'done', agentType, prompt: '' }, title, undefined, {
        worktreeId
      })
      const [tabId] = paneKey.split(':')
      const tab = (state.unifiedTabsByWorktree[worktreeId] ?? []).find(
        (candidate) => candidate.contentType === 'terminal' && candidate.entityId === tabId
      )
      if (!tab) {
        throw new Error('Terminal tab unavailable')
      }
      state.toggleTabViewMode(tab.id)
    },
    { ...descriptor, agentType, title }
  )
}