Skip to content
Français

CliAgent

import type { CliAgent } from "@elie-laloum/outpost";
  • kindRequired
    "cli"
    Execution discriminator: cli.
  • harnessRequired
    CliHarness
    CLI preset the agent was composed with, such as createClaudeHarness() or createCodexHarness().
  • modelOptional
    AgentModel | undefined
    Normalized frozen AgentModel bound to the CLI command; absent when the native CLI default is kept.
  • forkOptional
    ((id: string, invoke: (command: Command) => Promise<CommandResult>) => Promise<string>) | undefined
    Native fork step: receives the parent conversation ID and a command runner in the borrowed sandbox, and returns a distinct child ID that the turn then continues. Adapters whose CLI forks through a request flag omit it.
  • credentialsOptional
    ((variables: Variables) => CredentialPlan) | undefined
    Plan the credentials of this CLI from the resolved workflow variables, without disk access: variables to forward, host files to copy into the private sandbox home, generated files and login commands. Called once per adapter and sandbox; the local provider receives only the variables.
  • configurationOptional
    ((variables: Variables) => AgentConfiguration) | undefined
    Plan CLI configuration from the resolved variables, without disk access: files to merge and host files to copy into the agent home once per sandbox, after authentication. Throw when a referenced variable is missing.
  • requestRequired
    (input: AgentInput) => Command
    Build the executable, arguments and environment for the supplied agent input.
  • eventsRequired
    (line: string) => readonly AgentEvent[]
    Decode one native CLI output line into normalized agent events.
  • quotaOptional
    ((text: string) => boolean) | undefined
    Recognize a terminal usage-limit or rate-limit message in a failure event or stderr line. When the process then fails, the turn rejects with OutpostError code quota instead of process; transient retry notices must not match.
  • unavailableOptional
    ((text: string) => boolean) | undefined
    Recognize a terminal service outage or connection failure in a failure event or stderr line. When the process then fails without a quota signal, the turn keeps code process and records details.unavailable, read by unavailableFault(); retry notices must not match.
  • usageCommandOptional
    ((conversation: string) => Command | undefined) | undefined
    Build a bounded read-only command to collect counters for this conversation inside the borrowed sandbox; return undefined for an unsupported identifier.
  • usageResultOptional
    ((text: string) => Usage | undefined) | undefined
    Decode the successful usage command’s stdout into session totals. Return undefined when unreadable, or complete: false for partial totals; do not return transcript content.
  • liveInputOptional
    AgentLiveInput | undefined
    Protocol for adding user messages to a running turn over stdin, used when the lease supports live input: Claude Code stream-json and Codex app-server. Otherwise steering stops the turn and resumes its conversation.
  • nameRequired
    string
    Native agent identifier used in execution events and diagnostics.
  • bootstrapOptional
    string | undefined
    Built-in agent whose pinned CLI Outpost installs on a remote sandbox when the executable is missing: an npm package, or a SHA-512-verified archive for antigravity. An unknown name fails.
  • requiresFinishedEventOptional
    boolean | undefined
    Require the native final event: without it, completion markers do not match and the turn fails with code process, even when the process exits with 0.
  • usageOptional
    "events" | "session" | "unavailable" | undefined
    How token usage is measured: events reads it from the output stream, session reads the session after the process exits, unavailable records none. Missing counters then mark usage incomplete; omitted, reported events are counted without that check.
  • variablesOptional
    Readonly<Record<string, string>> | undefined
    Environment variables added to every command of this agent, over the values from .outpost/.env. A name also set by the sandbox provider fails with code configuration.
  • storageOptional
    ConversationStore | undefined
    Conversation store that captures, locates and restores this agent’s sessions; absent when its conversations are not portable.
  • captureOptional
    boolean | undefined
    Save the conversation to storage after each turn; false skips it. Omitted, a turn is saved whenever storage is present.
  • resumableOptional
    boolean | undefined
    Whether the CLI can continue a conversation; true on every built-in adapter. False rejects continuation and fork before allocation; when unset, response repair also requires a conversation store.
  • forkableOptional
    boolean | undefined
    False rejects a fork before allocation, as on Copilot CLI and Antigravity. Unset or true allows it, through the fork hook or the CLI’s own fork request.
  • transcriptUsageOptional
    ((text: string) => Usage | undefined) | undefined
    Read token usage from the transcript captured after the turn; a result replaces the usage reported by events, undefined keeps it.
export interface CliAgent extends AgentAdapter {
  readonly kind: "cli";
  readonly harness: CliHarness;
  readonly model?: AgentModel;
}