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.0 KB
Raw Blame
// A tool run remains live until a later row from the same agent speaks or acts beyond it.

import { isToolCallBlock, type NativeChatMessage } from '../native-chat-types'
import { deriveNativeChatRowContent } from '../native-chat-row-content'
import type { NativeChatResolvedPrompt } from '../native-chat-resolution-receipt'

/** Whether a row moves its agent past the run above it. An approval's receipt
 *  decides a call of that run, which then runs, so it does not. */
export function nativeChatRowSpeaksOrActs(
  message: NativeChatMessage,
  rendersProse: boolean,
  receipts: ReadonlyMap<string, NativeChatResolvedPrompt>
): boolean {
  return (
    !message.agentStart &&
    message.role !== 'user' &&
    message.role !== 'reasoning' &&
    receipts.get(message.id)?.kind !== 'approval' &&
    (rendersProse || message.blocks.some(isToolCallBlock))
  )
}

export function nativeChatRowRendersProse(message: NativeChatMessage): boolean {
  const content = deriveNativeChatRowContent(message.blocks)
  return content.markdown.length > 0 || content.hasImages
}