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.8 KB
Raw Blame
import { expect, test } from 'vitest'
import { EnsureAgentSessionParams } from '../../../src/shared/rpc-contract/agent-session-params'
import { normalizeAgentStatusPayload } from '../../../src/shared/agent-status-types'
import { importReleaseCheckoutModule, materializeReleaseCheckout } from './release-checkout'

test.each(['v1.4.205', 'v1.4.211'])(
  'release %s preserves new provider status tags but refuses unsupported resume',
  async (ref) => {
    const checkout = await materializeReleaseCheckout(ref)
    const baselineStatus = await importReleaseCheckoutModule(
      checkout,
      'src/shared/agent-status-types.ts'
    )
    const normalize = baselineStatus.normalizeAgentStatusPayload
    if (typeof normalize !== 'function') {
      throw new Error('Pinned release has no status normalizer')
    }
    const baselineResume = await importReleaseCheckoutModule(
      checkout,
      'src/shared/rpc-contract/agent-session-params.ts'
    )
    const schema = baselineResume.EnsureAgentSessionParams
    if (
      !schema ||
      typeof schema !== 'object' ||
      !('safeParse' in schema) ||
      typeof schema.safeParse !== 'function'
    ) {
      throw new Error('Pinned release has no resume request parser')
    }
    for (const agent of ['qoder-cn', 'qwen-code'] as const) {
      const status = { state: 'working', agentType: agent }
      expect(normalize(status)).toMatchObject(status)
      expect(normalizeAgentStatusPayload(status)).toMatchObject(status)
      const request = {
        kind: 'explicit',
        worktree: 'folder:/task-owned/folder',
        agent,
        providerSession: { key: 'session_id', id: 'test-session' }
      }
      expect(EnsureAgentSessionParams.safeParse(request).success).toBe(true)
      expect(schema.safeParse(request)).toHaveProperty('success', false)
    }
  },
  120_000
)