Skip to content
Français

ObservationEvent

import type { ObservationEvent } from "@elie-laloum/outpost";

The fields below cover all variants; the signature specifies their allowed combinations.

  • kindRequired
    "model-route" | "subagent" | "message-usage" | "stderr" | "stopped" | "steer" | "reasoning" | "file-change" | "model-request" | "model-response" | "model-retry" | "model-error" | "hook" | "instructions-loaded" | "skills-loaded" | "tool-output" | "phase" | "summary" | "warning" | "text" | "text-delta" | "result" | "prompt" | "tool" | "tool-result" | "step" | "tool-denied" | "stop-prevented" | "compaction" | "conversation" | "usage" | "failure" | "quota" | "fallback" | "finished" | "raw" | "workspace-commits" | "workspace-commits" | "decision" | "decision-request" | "decision-response" | "operation" | "dispatch-start" | "workflow" | "dispatch-finished" | "command-output" | "candidate" | "queue"
    Discriminant selecting the observed payload: agent and harness events, decision summaries and verbose payloads, workflows, operations, dispatches, workspace commits, commands, candidates or queues.
  • stepVariant-dependent
    number
    Harness step for which this effective model was selected.
  • choiceVariant-dependent
    string
    Effective candidate key after confidence and availability fallback rules.
  • modelVariant-dependent
    AgentModel | string
    On model-route, the effective AgentModel and its settings. On decision, the named decision-service model, with the actual response model on success.
  • reasonVariant-dependent
    "unavailable" | "selected" | "confidence" | "completion" | "idle-timeout" | "deadline" | "aborted" | "oversized-event" | "steered" | string
    On tool-denied, why the call was refused. On stopped, why Outpost ended the process: completion, idle-timeout, deadline, aborted, oversized-event or steered. On model-route, selected, confidence or unavailable explains the effective selection.
  • confidenceVariant-dependent
    number | undefined
    Native decision confidence, present only when a valid choice response was received.
  • subagentIdVariant-dependent
    string | undefined
    Identifier of the built-in child that emitted the event; absent for the root harness. Lifecycle events link that identifier to the delegating tool call.
  • idVariant-dependent
    string
    Operation, conversation, subagent or queued job identifier, according to kind.
  • callIdVariant-dependent
    string | string | undefined | string | string | undefined | string | string
    Tool call identifier linking the tool, tool-result, tool-output, tool-denied, file-change and subagent events of one call. CLI adapters copy the native identifier when the protocol has one.
  • nameVariant-dependent
    string
    Operation, phase, tool or delegating tool name, according to kind.
  • statusVariant-dependent
    "started" | "finished" | "failed" | number | "started" | "finished" | "failed" | "started" | "finished" | "failed" | "failed" | "done" | "cancelled" | "validated" | "accepted" | "rejected" | "cleanup" | "failed" | "enqueued" | "polled" | "completed"
    Operation lifecycle state, dispatch outcome, candidate selection result or queue transition according to kind; agent summaries retain numeric exit status.
  • conversationVariant-dependent
    string | undefined
    Persisted child conversation identifier when the child enables transcript storage.
  • tokensVariant-dependent
    Usage
    Token counts: an increment on usage, the pass total on summary, one message’s usage on message-usage.
  • messageIdVariant-dependent
    string | undefined
    Claude Code identifier of the message whose usage a message-usage event reports.
  • parentCallIdVariant-dependent
    string | undefined
    Parent tool call supplied by a CLI for a nested agent message or tool event.
  • textVariant-dependent
    string
    Text of the event according to kind: agent text, streamed fragment, final answer, rendered prompt, steering instruction, reasoning, stderr line or tool output chunk.
  • truncatedVariant-dependent
    boolean | undefined
    On decision, reported input truncation; absence does not prove complete input. On stderr or raw, a bounded text fragment or preview.
  • modeVariant-dependent
    SteeringMode
    How a steer event reached the agent: injected into the running turn, or resumed in a new turn of the same conversation.
  • changesVariant-dependent
    unknown
    File changes as Codex reports them, passed through unmodified.
  • requestVariant-dependent
    unknown
    Full model or decision request, emitted only for verbose observation; decision requests contain state and declared questions.
  • responseVariant-dependent
    unknown
    Full model or normalized decision result, emitted only for verbose observation; decision results retain native metadata.
  • attemptVariant-dependent
    number
    Retry attempt explicitly reported by a model provider; Outpost does not infer hidden retries.
  • messageVariant-dependent
    string | undefined | string | string | string | string | string | string
    Message of a warning, failure, quota, fallback, model-retry or model-error event, or the message a stop hook sent back to the model on stop-prevented.
  • phaseVariant-dependent
    string
    Harness hook phase that completed.
  • changedVariant-dependent
    boolean
    Whether a hook returned a decision or changed its observable input.
  • countVariant-dependent
    number
    Number of nonempty instruction sources resolved for this harness turn.
  • namesVariant-dependent
    readonly string[]
    Skills newly loaded into the conversation and available to subsequent model steps.
  • channelVariant-dependent
    "stdout" | "stderr"
    stdout or stderr stream for command-task and tool output events.
  • agentVariant-dependent
    string | undefined
    Name of the agent running the pass, on phase events: claude, codex, antigravity, copilot or kimi, custom for a built-in harness agent, replay for a replay agent.
  • branchVariant-dependent
    string | undefined
    Name of the work branch used or observed during execution.
  • directoryVariant-dependent
    string | undefined
    Host workspace directory used for this execution.
  • durationMsVariant-dependent
    number | number | undefined | number | undefined
    Elapsed milliseconds for the decision, operation, workflow task, candidate or dispatch indicated by kind; agent summaries aggregate all turns of the pass.
  • inputVariant-dependent
    unknown
    Raw arguments supplied to the tool named by this tool event.
  • isErrorVariant-dependent
    boolean
    Whether the tool call failed or reported an error.
  • previewVariant-dependent
    string
    First 2000 characters of the tool result.
  • charactersVariant-dependent
    number
    Full length of the tool result before any truncation.
  • indexVariant-dependent
    number
    One-based step number within a built-in harness turn.
  • strategyVariant-dependent
    string
    Name of the context strategy that rewrote the history.
  • messagesVariant-dependent
    number
    Number of messages in the history after compaction.
  • cumulativeVariant-dependent
    boolean | undefined
    True when an adapter reports a running total for the native session instead of an increment. Outpost subtracts the session baseline and the usage already counted, so observers always receive usage events with increments and no cumulative flag.
  • resetAtVariant-dependent
    string | undefined
    ISO timestamp at which a quota or fallback event says the usage or rate limit resets; present only when reported in structured form.
  • fromVariant-dependent
    FallbackCandidate
    Candidate that stopped in a fallback event: its position, adapter name and model name when one was selected.
  • toVariant-dependent
    FallbackCandidate
    Candidate that takes over in a fallback event: its position, adapter name and model name when one was selected.
  • failureVariant-dependent
    FallbackTrigger
    Category that ended the previous candidate in a fallback event: quota or unavailable.
  • valueVariant-dependent
    unknown
    Raw protocol line as the agent printed it; for an oversized line, only its first 2000 characters.
  • bytesVariant-dependent
    number | undefined
    Observed UTF-8 byte size of an oversized protocol line or buffered prefix before termination.
  • baselineVariant-dependent
    RecordedRevision | RecordedRevision | undefined
    Commit and tree the sandbox dispatch started from, for workspace-commits.
  • commitsVariant-dependent
    readonly RecordedCommit[] | readonly Commit[] | undefined
    Commits of the dispatch on dispatch-finished: from the result on success, from the error’s recovery on failure.
  • unavailableVariant-dependent
    string
    Reason the workspace commits could not be recorded for replay, for workspace-commits.
  • providerVariant-dependent
    string
    Decision provider name; no credentials are included.
  • usageVariant-dependent
    Usage | undefined | Usage
    Accumulated dispatch usage, including usage observed before failure. Decision events include normalized router usage when available.
  • codeVariant-dependent
    string | undefined
    Outpost fault code on a failed evaluation, when the error has one.
  • eventVariant-dependent
    WorkflowEvent
    Original workflow lifecycle event when kind is workflow.
  • completedVariant-dependent
    boolean
    Whether the dispatch satisfied its completion marker or structured response contract.
  • errorVariant-dependent
    { readonly code?: string; readonly message: string; } | undefined
    Code and message of the error that failed or cancelled the dispatch, for dispatch-finished.
export type ObservationEvent =
  | DecisionEvent
  | {
      readonly kind: "decision-request";
      readonly request: unknown;
    }
  | {
      readonly kind: "decision-response";
      readonly response: unknown;
    }
  | AgentEvent
  | OperationEvent
  | {
      readonly kind: "dispatch-start";
    }
  | {
      readonly kind: "workflow";
      readonly event: WorkflowEvent;
    }
  | {
      readonly kind: "dispatch-finished";
      readonly status: "done" | "failed" | "cancelled";
      readonly completed: boolean;
      readonly branch?: string;
      readonly commits?: readonly Commit[];
      readonly usage: Usage;
      readonly error?: {
        readonly code?: string;
        readonly message: string;
      };
    }
  | WorkspaceCommitsEvent
  | {
      readonly kind: "command-output";
      readonly channel: "stdout" | "stderr";
      readonly text: string;
    }
  | {
      readonly kind: "candidate";
      readonly status: "validated" | "accepted" | "rejected" | "cleanup";
    }
  | {
      readonly kind: "queue";
      readonly id: string;
      readonly status: "enqueued" | "polled" | "completed" | "failed";
    };