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.

2.1 KB
Raw Blame
import { mkdtemp, rm } from 'node:fs/promises'
import { tmpdir } from 'node:os'
import { join } from 'node:path'
import { describe, expect, it } from 'vitest'
import { runProcess } from '@orca/process-host'
import { recognizeAgentProcessFromCommandLine } from './agent-process-recognition'

const binary = process.env.ORCA_REAL_DSH_CLI

// No model call: published profile configuration and help establish the launcher contract.
describe.skipIf(!binary)('published DSH 0.2 CLI', () => {
  it('keeps positional and explicit headless profiles outside interactive recognition', async () => {
    if (!binary) {
      throw new Error('Set ORCA_REAL_DSH_CLI to the official dsh executable')
    }
    const root = await mkdtemp(join(tmpdir(), 'orca-dsh-cli-'))
    const env = { ...process.env, DSH_HOME: root, DEEPSEEK_API_KEY: '' }
    try {
      const version = await runProcess({ program: binary, args: ['--version'], cwd: root, env })
      expect(version.code).toBe(0)
      expect(version.stdout.trim()).toMatch(/^0\.2\./)
      for (const profile of ['headless', 'sdk', 'sdk-minimal', 'acp']) {
        for (const args of [[profile], ['--profile', profile]]) {
          const result = await runProcess({
            program: binary,
            args: [...args, '--dump-default-config'],
            cwd: root,
            env,
            timeoutMs: 30_000
          })
          expect(result.code).toBe(0)
          expect(result.stdout).toContain('@deepseek-ai/dsh-')
          const command = `"${binary}" ${args.join(' ')}`
          expect(recognizeAgentProcessFromCommandLine(command)).toBeNull()
          expect(
            recognizeAgentProcessFromCommandLine(command, { includeHeadlessOneShot: true })?.agent
          ).toBe('dsh')
        }
      }
      const help = await runProcess({
        program: binary,
        args: ['headless', '--help'],
        cwd: root,
        env,
        timeoutMs: 30_000
      })
      expect(help.code).toBe(0)
      expect(help.stdout).toContain('Answer one task and exit')
    } finally {
      await rm(root, { recursive: true, force: true })
    }
  }, 120_000)
})