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 { describe, expect, it } from 'vitest'
import { isCommandCodeNewTurnWhileWorking } from './command-code-turn-boundary'

describe('isCommandCodeNewTurnWhileWorking', () => {
  it('returns true when Command Code gets a new transcript prompt while still working', () => {
    expect(
      isCommandCodeNewTurnWhileWorking({
        agentType: 'command-code',
        previousState: 'working',
        incomingState: 'working',
        previousPrompt: 'first task',
        incomingPrompt: 'second task',
        hasExplicitPrompt: true
      })
    ).toBe(true)
  })

  it('returns true when the prompt interaction key changes', () => {
    expect(
      isCommandCodeNewTurnWhileWorking({
        agentType: 'command-code',
        previousState: 'working',
        incomingState: 'working',
        previousPrompt: 'same text',
        incomingPrompt: 'same text',
        hasExplicitPrompt: true,
        previousPromptInteractionKey: 'command-code-transcript-a',
        incomingPromptInteractionKey: 'command-code-transcript-b'
      })
    ).toBe(true)
  })

  it('returns false for same-turn tool pings that keep the same prompt', () => {
    expect(
      isCommandCodeNewTurnWhileWorking({
        agentType: 'command-code',
        previousState: 'working',
        incomingState: 'working',
        previousPrompt: 'run pwd',
        incomingPrompt: 'run pwd',
        hasExplicitPrompt: true
      })
    ).toBe(false)
  })

  it('returns false when main-process hooks explicitly deny prompt evidence', () => {
    expect(
      isCommandCodeNewTurnWhileWorking({
        agentType: 'command-code',
        previousState: 'working',
        incomingState: 'working',
        previousPrompt: 'first',
        incomingPrompt: 'second',
        hasExplicitPrompt: false
      })
    ).toBe(false)
  })

  it('returns false for non-Command Code agents', () => {
    expect(
      isCommandCodeNewTurnWhileWorking({
        agentType: 'codex',
        previousState: 'working',
        incomingState: 'working',
        previousPrompt: 'first',
        incomingPrompt: 'second',
        hasExplicitPrompt: true
      })
    ).toBe(false)
  })
})