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.

4.3 KB
Raw Blame
export type AgentPromptInjectionMode =
  | 'argv'
  | 'flag-prompt'
  | 'flag-prompt-interactive'
  | 'flag-interactive'
  | 'hermes-query'
  | 'stdin-after-start'

/** Signals a single marker settles; draft paste and the serializer read only these. */
export type DraftPasteMarkerSignal =
  | 'render-quiet-after-bracketed-paste'
  | 'codex-composer-prompt'
  | 'render-cursor-after-bracketed-paste'
  | 'grok-composer-prompt'
  | 'dsh-composer-prompt'
  | 'claude-composer-prompt'
  | 'zcode-composer-prompt'

/** Submit signals may also ask for a grace (`readyAfterMs`); only the paste waiters honour it. */
export type DraftPasteReadySignal = DraftPasteMarkerSignal | 'opencode-agent-row'

export type TuiAgentDetectionRuntime = NodeJS.Platform | 'wsl'

export type TuiAgentConfig = {
  detectCmd: string
  /** Additional executable names that identify the same agent on PATH. */
  detectCmdAliases?: readonly string[]
  /** Other commands that must also be present before this agent counts as installed. Distro CLIs only: a WSL-host launch refuses Windows-only ones. */
  detectRequiredCommands?: readonly string[]
  /** Detection runtimes where this launch mode is not available as a detected agent. */
  detectUnsupportedRuntimes?: readonly TuiAgentDetectionRuntime[]
  launchCmd: string
  /** Platform-specific launch command when the public binary name differs. */
  launchCmdByPlatform?: Partial<Record<NodeJS.Platform, string>>
  expectedProcess: string
  promptInjectionMode: AgentPromptInjectionMode
  /** Option terminator required before positional prompts that may look like CLI syntax. */
  argvPromptSeparator?: '--'
  /** Native CLI flag that seeds the input without submitting (e.g. Claude's `--prefill <text>`); preferred over the paste-after-ready path. */
  draftPromptFlag?: string
  /** Startup env var that seeds the input without submitting, for agents with no `--prefill`-style flag (e.g. pi); avoids the paste-after-ready race. */
  draftPromptEnvVar?: string
  /** Claude Code follows pasted text only where the user's typed words ask, so dispatch briefs need a typed lead line. */
  pasteNeedsTypedRequest?: boolean
  /** Trust Orca pre-writes at PTY spawn (agent-workspace-trust.ts) so the agent's first-launch "trust this folder?" menu doesn't consume the bracketed paste. */
  preflightTrust?:
    | 'claude'
    | 'cursor'
    | 'copilot'
    | 'codex'
    | 'antigravity'
    | 'qoder'
    | 'qoder-cn'
    | 'kimi'
  /** Agent-specific signal that the composer is ready for paste, stronger than the default quiet-render window. */
  draftPasteReadySignal?: DraftPasteMarkerSignal
  /** Signal before a paste that Enter follows, for agents that show their composer before it can submit; defaults to `draftPasteReadySignal`. */
  submitPasteReadySignal?: DraftPasteReadySignal
  /** A worker start also answers on the composer marker, for an agent whose rest title the user can turn off. */
  workerStartReadsComposerMarker?: true
  /** Hard deadline for the agent's composer readiness signal. */
  draftPasteReadyTimeoutMs?: number
  /** Captured boots proving the composer marker used for fresh worker dispatch (the submit signal where set). */
  composerReadyCaptures?: readonly string[]
  /** Delay before one extra blind submit Enter, for agents that render their composer before Enter is live (codex); a no-op if the first Enter landed. */
  submitRetryDelayMs?: number
  /** How long an agent-prompt send keeps re-pressing Enter at `submitRetryDelayMs` while its composer holds the prompt, for TUIs that paint it before their session can submit (dsh). */
  submitRetryBudgetMs?: number
  /** Extra ms per logical prompt line before Enter, for TUIs that expand multiline paste slowly (antigravity). */
  submitLineSettleMsPerLine?: number
  /** Windows Shift+Enter encoding override; omitted agents keep the legacy Esc+CR path. */
  windowsShiftEnterEncoding?: 'csi-u'
  /** Paste newlines for TUIs that read Windows console input records instead of VT paste frames. */
  windowsInputRecordPasteNewline?: 'alt-enter' | 'csi-u'
  /** Ctrl+Enter encoding for agents that consume CSI-u without active kitty flags. */
  ctrlEnterEncoding?: 'csi-u'
}

/** Authoring form: `launchCmd` and `expectedProcess` default to `detectCmd` (true for most agents). */
export type TuiAgentConfigSource = Omit<TuiAgentConfig, 'launchCmd' | 'expectedProcess'> & {
  launchCmd?: string
  expectedProcess?: string
}