responses

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 7, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package responses owns wire-level Responses event facts, not feature policy, transport lifetimes, or execution. Unknown wire values remain representable.

Index

Constants

View Source
const (
	Created                = "response.created"
	Completed              = "response.completed"
	Failed                 = "response.failed"
	Incomplete             = "response.incomplete"
	InProgress             = "response.in_progress"
	OutputItemAdded        = "response.output_item.added"
	OutputItemDone         = "response.output_item.done"
	FunctionArgumentsDelta = "response.function_call_arguments.delta"
	FunctionArgumentsDone  = "response.function_call_arguments.done"
	CustomInputDelta       = "response.custom_tool_call_input.delta"
	CustomInputDone        = "response.custom_tool_call_input.done"
	OutputTextDelta        = "response.output_text.delta"
	OutputTextDone         = "response.output_text.done"
	ContentPartAdded       = "response.content_part.added"
	ContentPartDone        = "response.content_part.done"
	ReasoningPartAdded     = "response.reasoning_summary_part.added"
	ReasoningPartDone      = "response.reasoning_summary_part.done"
	ReasoningTextDelta     = "response.reasoning_summary_text.delta"
	ReasoningTextDone      = "response.reasoning_summary_text.done"
	Error                  = "error"
	Metadata               = "codex.response.metadata"
	RateLimits             = "codex.rate_limits"
	WebSocketTiming        = "responsesapi.websocket_timing"
	Create                 = "response.create"
	Steer                  = "response.steer"
	SteerAccepted          = "response.steer.accepted"
	SteerFailed            = "response.steer.failed"
)
View Source
const (
	Message        = "message"
	FunctionCall   = "function_call"
	CustomToolCall = "custom_tool_call"
)

Variables

This section is empty.

Functions

func TerminalStatus

func TerminalStatus(status string) bool

TerminalStatus recognizes body statuses for evidence capture, including cancellation. Transport acceptance is deliberately stricter (ObserveTerminal).

Types

type ItemKind

type ItemKind string

func (ItemKind) ToolCall

func (k ItemKind) ToolCall() bool

ToolCall identifies the two callable item encodings, not whether their arguments are complete, validated, available, or authorized for execution.

type Kind

type Kind string

func (Kind) Ancillary

func (k Kind) Ancillary() bool

Source: codex-rs/codex-api/src/endpoint/responses_websocket.rs:749:777 and sse/responses.rs:524:535.

func (Kind) EndsExchange

func (k Kind) EndsExchange() bool

func (Kind) FunctionArguments

func (k Kind) FunctionArguments() bool

FunctionArguments identifies protocol argument fragments. Recognition does not authorize evaluation; consumers still require complete, validated calls.

func (Kind) ItemEvent

func (k Kind) ItemEvent() bool

func (Kind) ResponseEvent

func (k Kind) ResponseEvent() bool

func (Kind) ResponseFamily

func (k Kind) ResponseFamily() bool

ResponseFamily is the permissive correlation prefix, including a bare response. prefix. It does not establish a valid response event or terminal.

func (Kind) Status

func (k Kind) Status() string

Status returns the response status named by an event. Callers must establish that this is a response event; unknown suffixes remain unknown wire values.

func (Kind) Steering

func (k Kind) Steering() bool

func (Kind) Terminal

func (k Kind) Terminal() bool

Terminal reports a response terminal, not successful request or delivery.

type MessageFacts

type MessageFacts struct {
	Kind   ItemKind
	Role   string
	Phase  string
	Status string
}

MessageFacts contains protocol identity only. Content eligibility, provenance, budgets, and delivery remain consumer policy.

func (MessageFacts) Assistant

func (m MessageFacts) Assistant() bool

func (MessageFacts) FinalAnswerCandidate

func (m MessageFacts) FinalAnswerCandidate() bool

type RequestKind

type RequestKind string
const (
	Turn       RequestKind = "turn"
	Prewarm    RequestKind = "prewarm"
	Compaction RequestKind = "compaction"
)

func (RequestKind) Known

func (k RequestKind) Known() bool

type TerminalState

type TerminalState uint8

TerminalState is validated response evidence. It is not request success.

const (
	TerminalUnknown TerminalState = iota
	TerminalInvalid
	TerminalPending
	TerminalCompleted
	TerminalSteered
	TerminalFailed
	TerminalInterrupted
)

func MergeTerminal

func MergeTerminal(current, observed TerminalState) TerminalState

MergeTerminal preserves sticky invalid/failure evidence across provider and transformed payloads. A later success must not erase an earlier failure.

func ObserveTerminal

func ObserveTerminal(body []byte, stream bool) TerminalState

Source: internal/router/client.go:826:899. JSON status and SSE event kind have different authority. Steered and interrupted SSE terminals are accepted, but not successful. Malformed nested incomplete details remain failures.

func (TerminalState) String

func (s TerminalState) String() string

func (TerminalState) Terminal

func (s TerminalState) Terminal() bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL