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.3 KB
Raw Blame
// Share transcript preparation across desktop/mobile so neither drops turns the other renders.

import type { AgentType } from '../../agent-status-types'
import { getVerifiedNativeChatCommands } from '../../native-chat-agent-profiles'
import { surfaceSkillInvocationUserTurns } from '../native-chat-command-envelope'
import { surfaceNativeChatCommandOutputs } from '../tools/native-chat-command-output'
import { normalizeImageTranscriptMessages } from './native-chat-image-transcript-markers'
import type { NativeChatMessage } from '../../native-chat-types'

/** Surface skill invocation text and reporting-command output before noise filtering hides their harness envelopes. */
export function surfaceNativeChatHarnessTurns(
  messages: readonly NativeChatMessage[],
  agent: AgentType
): NativeChatMessage[] {
  const commandNames = new Set(getVerifiedNativeChatCommands(agent).map((command) => command.name))
  return surfaceNativeChatCommandOutputs(
    surfaceSkillInvocationUserTurns(messages, commandNames),
    agent
  )
}

/** The harness turns surfaced, then image marker turns folded into the prompt they belong to. */
export function prepareNativeChatMessages(
  messages: readonly NativeChatMessage[],
  agent: AgentType
): NativeChatMessage[] {
  return normalizeImageTranscriptMessages(surfaceNativeChatHarnessTurns(messages, agent))
}