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 { CommandHandler } from '../../dispatch'
import { printResult } from '../../format'
import { RuntimeClientError } from '../../runtime-client'
import type { ResetRemovedWork } from '../../../shared/orchestration-removed-work'
import { callOrchestrationMutation } from './mutation-request'
import { formatResetResult } from './removed-work-format'

export const ORCHESTRATION_RESET_HANDLER: Record<string, CommandHandler> = {
  'orchestration reset': async ({ flags, client, json }) => {
    const scopeCount = [flags.has('all'), flags.has('tasks'), flags.has('messages')].filter(
      Boolean
    ).length
    if (scopeCount !== 1) {
      throw new RuntimeClientError(
        'invalid_argument',
        'Choose exactly one reset scope: --all, --tasks, or --messages.'
      )
    }
    const result = await callOrchestrationMutation<{ reset: string; removed?: ResetRemovedWork }>(
      client,
      flags,
      'orchestration.reset',
      {
        all: flags.has('all') ? true : undefined,
        tasks: flags.has('tasks') ? true : undefined,
        messages: flags.has('messages') ? true : undefined
      }
    )
    printResult(result, json, formatResetResult)
  }
}