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.4 KB
Raw Blame
import { describe, expect, it } from 'vitest'
import {
  classifyMobileNativeChatSend,
  getMobileNativeChatCommands
} from './mobile-native-chat-send-classification'

describe('classifyMobileNativeChatSend', () => {
  it('recognizes OMP selectors and context commands without claiming generic help', () => {
    expect(classifyMobileNativeChatSend('omp', '/switch')).toBe('command')
    expect(classifyMobileNativeChatSend('omp', '/compact focus on tests')).toBe('command')
    expect(classifyMobileNativeChatSend('omp', '/help')).toBe('unknown-token')
    expect(classifyMobileNativeChatSend('omp', '/smol')).toBe('unknown-token')
  })

  it('classifies catalog commands per agent', () => {
    expect(classifyMobileNativeChatSend('claude', '/clear')).toBe('command')
    expect(classifyMobileNativeChatSend('claude', '/compact')).toBe('command')
    expect(classifyMobileNativeChatSend('codex', '/model')).toBe('command')
    expect(classifyMobileNativeChatSend('codex', '/permissions')).toBe('command')
  })

  it('treats slash tokens outside the agent catalog as unknown, never chat', () => {
    expect(classifyMobileNativeChatSend('claude', '/model sonnet')).toBe('unknown-token')
    expect(classifyMobileNativeChatSend('claude', '/cost')).toBe('unknown-token')
    expect(classifyMobileNativeChatSend('claude', '/diff')).toBe('unknown-token')
  })

  it('leaves /context off mobile, which has no way to show its answer', () => {
    for (const agent of ['openclaude', 'omp']) {
      expect(classifyMobileNativeChatSend(agent, '/context')).toBe('unknown-token')
      expect(classifyMobileNativeChatSend(agent, '/compact')).toBe('command')
      expect(getMobileNativeChatCommands(agent).map(({ name }) => name)).not.toContain('context')
    }
  })

  it('keeps prose as chat, including leading-whitespace slash text', () => {
    expect(classifyMobileNativeChatSend('claude', 'hello there')).toBe('chat')
    expect(classifyMobileNativeChatSend('claude', ' /clear is a command')).toBe('chat')
    expect(classifyMobileNativeChatSend('claude', '/usr/bin/python is missing')).toBe(
      'unknown-token'
    )
  })

  it('treats $ tokens as skill grammar only for Codex', () => {
    expect(classifyMobileNativeChatSend('codex', '$deploy now')).toBe('unknown-token')
    expect(classifyMobileNativeChatSend('claude', '$PATH is empty')).toBe('chat')
  })

  it('defaults to chat when no agent is resolved', () => {
    expect(classifyMobileNativeChatSend(null, '/clear')).toBe('chat')
  })
})