Documentation
¶
Index ¶
- Constants
- Variables
- func CanRetryEphemeralTurn(err error) bool
- func CitationMarkdown(entry TranscriptEntry) string
- func DefaultSocket() string
- func IsCapacityFailure(code, message string) bool
- func IsProjectNotFound(err error, projectID string) bool
- func IsThreadNotFound(err error, threadID string) bool
- func RPCErrorData(err error) (json.RawMessage, bool)
- type AccountRateLimits
- type ActivityAgent
- type ActivityBlockingRequest
- type ActivityLink
- type ActivityRecorder
- type ActivitySnapshot
- type AdditionalContextEntry
- type AsyncQuestion
- type AsyncQuestionReply
- type Attachment
- type CitationSource
- type CitationSpan
- type Client
- func (c *Client) AcknowledgeSends(ctx context.Context, threadID string, acknowledgements []SendAcknowledgement) ([]string, error)
- func (c *Client) ActivateThread(ctx context.Context, threadID string, policy ThreadPolicy) error
- func (c *Client) ActivateThreadWithSettings(ctx context.Context, threadID string, settings ThreadSettings) error
- func (c *Client) ActiveTurnID(ctx context.Context, threadID string) (string, error)
- func (c *Client) ArchiveThread(ctx context.Context, threadID string) error
- func (c *Client) BootstrapForkedHeadlessThread(ctx context.Context, threadID, cwd, sourceID, marker string) error
- func (c *Client) BootstrapHeadlessThread(ctx context.Context, threadID, cwd, projectID, marker string) error
- func (c *Client) ClearConversationAttempts(threadID, directory string) error
- func (c *Client) ClearRetiredThreadAttempts(threadID string) error
- func (c *Client) Close()
- func (c *Client) CompactAcceptedSendOptions(contextPrefix string) error
- func (c *Client) ConditionalSteer(ctx context.Context, ...) (SendReceipt, error)
- func (c *Client) ConsumeRateLimitResetCredit(ctx context.Context, key, creditID string) (ResetCreditResult, error)
- func (c *Client) ContinueFailedTurn(ctx context.Context, ...) (SendReceipt, error)
- func (c *Client) CreateProject(ctx context.Context, name, idempotencyKey string) (ProjectMetadata, error)
- func (c *Client) DeleteFreshHeadlessThread(ctx context.Context, threadID, cwd, projectID string) error
- func (c *Client) DeleteQueueEntry(ctx context.Context, threadID, id string) error
- func (c *Client) DeleteQueueEntryWithCompletion(ctx context.Context, threadID, id string, complete func() error) error
- func (c *Client) DiscardPreparedConditionalSteer(ctx context.Context, ...) error
- func (c *Client) DiscardPreparedSend(threadID, text, clientID, actionContext string) (bool, error)
- func (c *Client) DiscardPreparedSendWithOptions(threadID, text, clientID, actionContext string, options TurnOptions) (bool, error)
- func (c *Client) Ensure(ctx context.Context) error
- func (c *Client) EnsureInitialMessage(ctx context.Context, threadID, cwd, text string, allowUnmaterializedStart bool) error
- func (c *Client) EnsureInitialMessageWithOptions(ctx context.Context, threadID, cwd, text string, allowUnmaterializedStart bool, ...) error
- func (c *Client) ExportSubmissionAttempts(threadID string) (json.RawMessage, error)
- func (c *Client) ForkThread(ctx context.Context, threadID, cwd string, environment map[string]string, ...) (string, error)
- func (c *Client) ForkedHeadlessThreadMaterialized(ctx context.Context, threadID, cwd, sourceID string) (bool, error)
- func (c *Client) FreezeObserverWrites(ctx context.Context, expectedGeneration uint64) error
- func (c *Client) HasActiveGoal(ctx context.Context, threadID string) (bool, error)
- func (c *Client) HeadlessThreadMaterialized(ctx context.Context, threadID, cwd, projectID string) (bool, error)
- func (c *Client) HistoryMaterialized(ctx context.Context, threadID, cwd string) (bool, error)
- func (c *Client) Interrupt(ctx context.Context, threadID string) error
- func (c *Client) IsPreparedSendWithOptions(threadID, text, clientID, actionContext string, options TurnOptions) (bool, error)
- func (c *Client) ListCollaborationModes(ctx context.Context) ([]CollaborationMode, error)
- func (c *Client) ListModels(ctx context.Context) ([]Model, error)
- func (c *Client) ListQueue(ctx context.Context, threadID string) ([]QueueEntry, error)
- func (c *Client) ListThreads(ctx context.Context, options ThreadListOptions) ([]ThreadMetadata, *string, error)
- func (c *Client) LoadedThreadIDs(ctx context.Context) ([]string, error)
- func (c *Client) ObserverGeneration() (uint64, bool)
- func (c *Client) OpenThread(ctx context.Context, threadID, cwd string, environment map[string]string) (string, error)
- func (c *Client) OpenThreadWithSettings(ctx context.Context, threadID, cwd string, environment map[string]string, ...) (string, error)
- func (c *Client) OriginalSendOptions(threadID, text, clientID, actionContext string) (TurnOptions, bool, error)
- func (c *Client) PendingRevision(threadID string) uint64
- func (c *Client) PrepareSend(threadID, text, clientUserMessageID, context string, steered bool) error
- func (c *Client) PrepareSendWithOptions(threadID, text, clientUserMessageID, context string, steered bool, ...) error
- func (c *Client) Prompts(threadID string) []Prompt
- func (c *Client) PromptsWithItems(ctx context.Context, threadID string) ([]Prompt, error)
- func (c *Client) Queue(ctx context.Context, threadID, text, clientID string) (QueueEntry, error)
- func (c *Client) QueueWithPolicy(ctx context.Context, threadID, text, clientID string, policy ThreadPolicy) (QueueEntry, error)
- func (c *Client) ReadAccountRateLimits(ctx context.Context) (AccountRateLimits, error)
- func (c *Client) ReadActivity(ctx context.Context, threadID string) (ActivitySnapshot, error)
- func (c *Client) ReadProject(ctx context.Context, projectID string) (ProjectMetadata, error)
- func (c *Client) ReadThread(ctx context.Context, threadID string) (Transcript, error)
- func (c *Client) ReadThreadMetadata(ctx context.Context, threadID string, excludeTurns bool) (ThreadMetadata, error)
- func (c *Client) ReadThreadPage(ctx context.Context, threadID, cursor string) (TranscriptPage, error)
- func (c *Client) ReadThreadSettings(ctx context.Context, threadID string) (ThreadSettings, error)
- func (c *Client) ReadTurnContext(ctx context.Context, threadID, turnID string) (TurnContext, error)
- func (c *Client) ReadTurnState(ctx context.Context, threadID string) (TurnState, error)
- func (c *Client) ReconcileQueueDeletionsWithCompletion(ctx context.Context, threadID string, complete func(string) error) error
- func (c *Client) ReconcileSend(ctx context.Context, threadID, text, clientUserMessageID, actionContext string) (SendReceipt, bool, error)
- func (c *Client) ReconcileSendWithOptions(ctx context.Context, threadID, text, clientUserMessageID, actionContext string, ...) (SendReceipt, bool, error)
- func (c *Client) ReconcileThreadInstructions(ctx context.Context, threadID string) error
- func (c *Client) ReconcileThreadInstructionsWithPolicy(ctx context.Context, threadID string, policy ThreadPolicy) error
- func (c *Client) RecordThreadOperationAttempt(directory, threadID string) error
- func (c *Client) RefreshThreadSubscription(ctx context.Context, thread string) error
- func (c *Client) Request(ctx context.Context, method string, params any, result any) error
- func (c *Client) RequireSubmissionAttemptsKnown(ctx context.Context, threadID string) error
- func (c *Client) RequireSubmissionAttemptsKnownExceptPreparedSend(ctx context.Context, threadID, text, clientID, actionContext string, ...) error
- func (c *Client) RequireSubmissionAttemptsResolved(ctx context.Context, threadID string) error
- func (c *Client) RequireThreadIdle(ctx context.Context, threadID, cwd string) error
- func (c *Client) RequireThreadTurnsIdle(ctx context.Context, threadID string) error
- func (c *Client) RespondAnswers(ctx context.Context, id, threadID string, ...) error
- func (c *Client) RespondDecision(ctx context.Context, id, threadID, decision string) error
- func (c *Client) RespondPrompt(ctx context.Context, threadID string, response PromptResponse) error
- func (c *Client) ResumeThread(ctx context.Context, threadID, cwd string, environment map[string]string) (string, error)
- func (c *Client) ResumeThreadWithSettings(ctx context.Context, threadID, cwd string, environment map[string]string, ...) (string, error)
- func (c *Client) RunEphemeralTurn(ctx context.Context, opts EphemeralTurnOptions) (EphemeralTurnResult, error)
- func (c *Client) RunPromptedEphemeralTurn(ctx context.Context, opts EphemeralTurnOptions) (EphemeralTurnResult, error)
- func (c *Client) Send(ctx context.Context, threadID, text, clientUserMessageID, actionContext string) (SendReceipt, error)
- func (c *Client) SendAttempted(ctx context.Context, threadID, text, clientUserMessageID, context string) (bool, error)
- func (c *Client) SendAttemptedWithOptions(ctx context.Context, threadID, text, clientUserMessageID, context string, ...) (bool, error)
- func (c *Client) SendAttemptedWithOptionsResumable(ctx context.Context, threadID, text, clientID, action string, ...) (found bool, err error)
- func (c *Client) SendWithOptions(ctx context.Context, threadID, text, clientUserMessageID, actionContext string, ...) (receipt SendReceipt, err error)
- func (c *Client) SetName(ctx context.Context, threadID, name string) error
- func (c *Client) SnoozeUserInput(id, threadID string) error
- func (c *Client) StartQueue(ctx context.Context, threadID, queuedSubmissionID string) error
- func (c *Client) StartQueueWithPolicy(ctx context.Context, threadID, queuedSubmissionID string, policy ThreadPolicy) error
- func (c *Client) StartThread(ctx context.Context, cwd string, environment map[string]string) (string, error)
- func (c *Client) StartThreadWithSettings(ctx context.Context, cwd string, environment map[string]string, ...) (string, error)
- func (c *Client) Subscribe(ctx context.Context, threadID string) (<-chan struct{}, func(), error)
- func (c *Client) ThreadOperationAttempt(directory string) (string, error)
- func (c *Client) UnarchiveThread(ctx context.Context, threadID string) (ThreadMetadata, error)
- func (c *Client) UpdateThreadSettings(ctx context.Context, threadID string, update ThreadSettingsUpdate) (ThreadSettings, error)
- func (c *Client) VerifyForkedHeadlessBootstrap(ctx context.Context, threadID, cwd, sourceID, marker string) error
- func (c *Client) VerifyHeadlessBootstrap(ctx context.Context, threadID, cwd, projectID, marker string) error
- func (c *Client) VerifyThread(ctx context.Context, threadID, cwd string) error
- type ClientInfo
- type ClientOptions
- type CollaborationMode
- type CreditsSnapshot
- type DeliveryEvent
- type EphemeralTurnOptions
- type EphemeralTurnResult
- type HistoryPool
- type HistoryReader
- type LifecycleRequest
- type MessageNotSentError
- type Model
- type NonBlockingUserInputPolicy
- type ObserverEvent
- type ObserverEventKind
- type Option
- type PendingRequest
- type ProjectMetadata
- type ProjectNotFoundError
- type Prompt
- type PromptResponse
- type PromptResponseError
- type Question
- type QueueEntry
- type RateLimitResetCredit
- type RateLimitResetCredits
- type RateLimitSnapshot
- type RateLimitWindow
- type ReasoningEffortOption
- type ResetCreditResult
- type SendAcknowledgement
- type SendReceipt
- type TerminalFailure
- type ThreadListOptions
- type ThreadMCPServer
- type ThreadMetadata
- type ThreadNotFoundError
- type ThreadPolicy
- type ThreadSettings
- type ThreadSettingsUpdate
- type Transcript
- type TranscriptActivity
- type TranscriptCommunication
- type TranscriptCursorError
- type TranscriptEntry
- type TranscriptPage
- type TransportError
- type TurnContext
- type TurnMetadata
- type TurnOptions
- type TurnState
- type UnknownSendOutcomeError
Constants ¶
const EphemeralInstructionFileContent = "Preserve the current utility task and its explicit instructions.\n"
EphemeralInstructionFileContent is the exact private file content required by RunEphemeralTurn. The pinned server loads both instruction files even when explicit base instructions take precedence, and rejects empty files.
const ObserverEventLimit = 256 * 1024
ObserverEventLimit bounds a tapped frame. Larger frames invalidate observation without changing the ordinary client's decoder or transport read limit.
Variables ¶
var ( ErrEphemeralIsolation = errors.New("ephemeral utility isolation is unavailable") ErrEphemeralSettings = errors.New("ephemeral utility settings are unavailable") ErrEphemeralProtocol = errors.New("ephemeral utility protocol failed") ErrEphemeralServer = errors.New("ephemeral utility server failed") )
Errors deliberately contain no remote diagnostics, configuration or input.
var ErrObserverWritesFrozen = errors.New("Codex observer writes are frozen")
Functions ¶
func CanRetryEphemeralTurn ¶
CanRetryEphemeralTurn reports whether a failed utility call proved a transient failure, stopped execution and successful cleanup. It does not start a retry or supply a new deadline. Bare error categories do not carry this proof.
func CitationMarkdown ¶
func CitationMarkdown(entry TranscriptEntry) string
CitationMarkdown keeps the original Markdown and replaces normalized spans with ordinary links. The host must still sanitize the resulting rendered HTML.
func DefaultSocket ¶
func DefaultSocket() string
func IsCapacityFailure ¶
IsCapacityFailure recognizes the native overload discriminator and one exact wrapped capacity error emitted as "other". It does not change the raw error or establish stopped execution, retry authority or a new attempt's budget.
func IsProjectNotFound ¶
IsProjectNotFound reports the App Server's exact missing-project response.
func IsThreadNotFound ¶
IsThreadNotFound reports the App Server's exact missing-thread response for a read of the specified thread. Other RPC failures remain uncertain.
func RPCErrorData ¶
func RPCErrorData(err error) (json.RawMessage, bool)
RPCErrorData returns a detached copy of a native RPC error's structured data, including through wrapped errors. The boolean is false when data is absent or err is not an RPC error. Explicit JSON null is present data. Callers must validate the expected shape; data alone grants no retry authority.
Types ¶
type AccountRateLimits ¶
type AccountRateLimits struct {
RateLimits RateLimitSnapshot `json:"rateLimits"`
RateLimitsByLimitID map[string]RateLimitSnapshot `json:"rateLimitsByLimitId"`
AccountID *string `json:"accountId,omitempty"`
ResetCredits *RateLimitResetCredits `json:"rateLimitResetCredits,omitempty"`
}
AccountRateLimits contains the legacy allowance and any named allowance buckets. Optional account and credit fields remain absent when the backend cannot report them.
type ActivityAgent ¶
type ActivityBlockingRequest ¶
type ActivityBlockingRequest struct {
TurnID string `json:"turnId"`
ItemID string `json:"itemId"`
Method string `json:"method"`
Kind string `json:"kind"`
}
ActivityBlockingRequest identifies an observed blocking request without its content or response authority. The enclosing snapshot supplies the thread ID.
type ActivityLink ¶
type ActivityRecorder ¶
type ActivityRecorder struct {
// contains filtered or unexported fields
}
ActivityRecorder owns a private directory for one trusted App Server authority. Each thread has its own checkpoint and compact turn summaries. The authority mutex protects only the map of currently loaded threads.
func NewActivityRecorder ¶
func NewActivityRecorder(path string) (*ActivityRecorder, error)
func (*ActivityRecorder) Close ¶
func (r *ActivityRecorder) Close() error
type ActivitySnapshot ¶
type ActivitySnapshot struct {
Stale bool `json:"stale,omitempty"`
Refreshing bool `json:"refreshing,omitempty"`
ThreadID string `json:"threadId"`
CurrentTurnID string `json:"currentTurnId,omitempty"`
Messages int `json:"messages"`
ToolCalls int `json:"toolCalls"`
SentMessages int `json:"sentMessages"`
ReceivedMessages int `json:"receivedMessages"`
TotalToolCalls int `json:"totalToolCalls"`
CountsComplete bool `json:"countsComplete"`
IdleMS int64 `json:"idleMs"`
CreatedAtMS int64 `json:"createdAtMs,omitempty"`
BlockingRequests []ActivityBlockingRequest `json:"blockingRequests,omitempty"`
WaitReason string `json:"waitReason,omitempty"`
WaitUntilMS int64 `json:"waitUntilMs,omitempty"`
LatestTurnStatus string `json:"latestTurnStatus,omitempty"`
StartedAtMS int64 `json:"startedAtMs,omitempty"`
CompletedAtMS int64 `json:"completedAtMs,omitempty"`
WorkingMS int64 `json:"workingMs"`
WaitingMS int64 `json:"waitingMs"`
OpenWaitingMS int64 `json:"openWaitingMs"`
BetweenTurnsMS int64 `json:"betweenTurnsMs"`
UnclassifiedMS int64 `json:"unclassifiedMs"`
ObservedAtMS int64 `json:"observedAtMs"`
CoverageStartMS int64 `json:"coverageStartMs,omitempty"`
CoverageComplete bool `json:"coverageComplete"`
CoverageReason string `json:"coverageReason,omitempty"`
CurrentState string `json:"currentState"`
StateSinceMS int64 `json:"stateSinceMs,omitempty"`
Scope string `json:"scope"`
TimingApproximate bool `json:"timingApproximate"`
}
ActivitySnapshot describes root-thread elapsed time, not CPU or model time. WaitingMS contains closed observed waits. The open wait is separate; working time includes observation through ObservedAtMS. A UI may project an open state from ObservedAtMS, but must not persist that browser projection as coverage.
type AdditionalContextEntry ¶
AdditionalContextEntry is application-owned context for one opaque source. Codex clients send only the App Server's application kind.
type AsyncQuestion ¶
type AsyncQuestion struct {
ID string `json:"id"`
Title string `json:"title"`
Options []string `json:"options,omitempty"`
}
AsyncQuestion belongs to an agent message, rather than a pending RPC request. ID uses the native CLI's original question index, including skipped entries.
type AsyncQuestionReply ¶
type Attachment ¶
type Attachment struct {
ID string `json:"id"`
Name string `json:"name"`
Size int64 `json:"size"`
State string `json:"state"`
DownloadURL string `json:"downloadUrl,omitempty"`
DeleteURL string `json:"deleteUrl,omitempty"`
References []string `json:"references,omitempty"`
}
Attachment is application-owned presentation metadata, not an App Server input type. Files are resolved to prompt text by the embedding application.
type CitationSource ¶
type CitationSource struct {
URL string `json:"url"`
Title string `json:"title"`
Number int `json:"number"`
}
CitationSource is a validated web destination. Number is local to one message.
type CitationSpan ¶
type CitationSpan struct {
Start int `json:"start"`
End int `json:"end"`
Sources []CitationSource `json:"sources,omitempty"`
Incomplete bool `json:"incomplete,omitempty"`
// contains filtered or unexported fields
}
CitationSpan replaces [Start, End) UTF-8 bytes in Text, never code examples. Incomplete tokens are hidden only while the assistant turn is active.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewWithOptions ¶
func NewWithOptions(socket string, options ClientOptions) *Client
func (*Client) AcknowledgeSends ¶
func (c *Client) AcknowledgeSends( ctx context.Context, threadID string, acknowledgements []SendAcknowledgement, ) ([]string, error)
AcknowledgeSends releases durable attempts only after their browser-owned identities and text are also proven in the Codex transcript. An accepted receipt additionally has to match its recorded turn. This server-side proof keeps a lost acknowledgement response safely retryable after compaction.
func (*Client) ActivateThread ¶
ActivateThread loads a retained conversation with the application's policy. Loading can execute saved queues or active goals; callers must obtain explicit user intent before calling this method for a cold conversation.
func (*Client) ActivateThreadWithSettings ¶
func (c *Client) ActivateThreadWithSettings(ctx context.Context, threadID string, settings ThreadSettings) error
ActivateThreadWithSettings applies settings as part of the explicit load, without replacing the retained working directory or shell environment.
func (*Client) ActiveTurnID ¶
ActiveTurnID returns the current in-progress turn, or an empty string when the thread is idle.
func (*Client) ArchiveThread ¶
func (*Client) BootstrapForkedHeadlessThread ¶
func (*Client) BootstrapHeadlessThread ¶
func (c *Client) BootstrapHeadlessThread(ctx context.Context, threadID, cwd, projectID, marker string) error
BootstrapHeadlessThread writes a single internal, non-assignment history item. The caller must durably reserve this attempt before calling: after an uncertain response, only VerifyHeadlessBootstrap may be retried.
func (*Client) ClearConversationAttempts ¶
ClearConversationAttempts clears all durable submission and operation state for threadID after the caller has proved that the conversation is retired.
func (*Client) ClearRetiredThreadAttempts ¶
ClearRetiredThreadAttempts removes only one proven-retired thread's durable submission state. It deliberately preserves directory retirement markers, including the root session's marker during member cleanup.
func (*Client) CompactAcceptedSendOptions ¶
CompactAcceptedSendOptions discards original options for accepted sends in an application-owned context. Their digests and receipts still bind retries to the exact message and options. Callers must supply those options on retry; OriginalSendOptions cannot recover nonzero options after compaction.
func (*Client) ConditionalSteer ¶
func (c *Client) ConditionalSteer(ctx context.Context, threadID, cwd, expectedTurnID, text, clientUserMessageID, actionContext string, ) (SendReceipt, error)
ConditionalSteer delivers input only to the exact expected active turn. It never resumes a thread, starts a turn, queues input, or changes settings. The caller owns authorization and must retain the complete identity for retry. A receipt proves delivery, not that the model processed or acknowledged input.
func (*Client) ConsumeRateLimitResetCredit ¶
func (c *Client) ConsumeRateLimitResetCredit(ctx context.Context, key, creditID string) (ResetCreditResult, error)
ConsumeRateLimitResetCredit redeems one reset. Reuse the key for every retry of the same logical attempt; an empty creditID lets the backend select a credit. Applications must authorize this account-level mutation independently.
func (*Client) ContinueFailedTurn ¶
func (c *Client) ContinueFailedTurn( ctx context.Context, threadID, text, stableID, actionContext, expectedFailedTurnID string, options TurnOptions, ) (SendReceipt, error)
ContinueFailedTurn starts a new visible turn only on a loaded, quiescent thread whose latest turn is the exact expected failure. It never resumes, steers, updates policy, or starts queued work. The application must hold its shared admission fence and prove unchanged effective settings and execution authority. Bind expectedFailedTurnID and the settings digest into actionContext and retain that context, text, stableID and options unchanged for reconciliation.
func (*Client) CreateProject ¶
func (c *Client) CreateProject(ctx context.Context, name, idempotencyKey string) (ProjectMetadata, error)
CreateProject is retry-safe when the caller retains the same idempotency key.
func (*Client) DeleteFreshHeadlessThread ¶
func (c *Client) DeleteFreshHeadlessThread(ctx context.Context, threadID, cwd, projectID string) error
DeleteFreshHeadlessThread retires only a verified, empty, unmaterialized member. It is intended for replacing an unusable thread after a client disconnect, never for a thread with a user turn or uncertain submission.
func (*Client) DeleteQueueEntry ¶
func (*Client) DeleteQueueEntryWithCompletion ¶
func (c *Client) DeleteQueueEntryWithCompletion(ctx context.Context, threadID, id string, complete func() error) error
DeleteQueueEntryWithCompletion retains the existing deletion intent until the application durably records completion. The callback must be idempotent.
func (*Client) DiscardPreparedConditionalSteer ¶
func (c *Client) DiscardPreparedConditionalSteer(ctx context.Context, threadID, cwd, expectedTurnID, text, clientUserMessageID, actionContext string, ) error
DiscardPreparedConditionalSteer retires only an exact unsubmitted attempt. First durably record the terminal disposition and original identity in the owning operation, and never dispatch that terminal notice again. Recovery may repeat this discard when already absent. Accepted or uncertain input refuses.
func (*Client) DiscardPreparedSend ¶
DiscardPreparedSend retires an exact request that has not been submitted. Already absent attempts are retired. Submitting and accepted attempts are retained and return false; callers must reconcile their delivery instead.
func (*Client) DiscardPreparedSendWithOptions ¶
func (c *Client) DiscardPreparedSendWithOptions( threadID, text, clientID, actionContext string, options TurnOptions, ) (bool, error)
DiscardPreparedSendWithOptions retires a prepared attempt only when its exact turn options match the durable attempt identity.
func (*Client) EnsureInitialMessage ¶
func (*Client) EnsureInitialMessageWithOptions ¶
func (c *Client) EnsureInitialMessageWithOptions( ctx context.Context, threadID, cwd, text string, allowUnmaterializedStart bool, options TurnOptions, ) error
EnsureInitialMessageWithOptions creates the initial message only for a fresh idle thread under the caller's durable first-submission grant, including a root with persisted metadata but no turns. Existing matching history never replays optional model, effort, or application context against turn/start.
func (*Client) ExportSubmissionAttempts ¶
func (c *Client) ExportSubmissionAttempts(threadID string) (json.RawMessage, error)
ExportSubmissionAttempts returns a consistent, thread-scoped schema-3 snapshot for recovery consumers. It does not expose the physical storage format.
func (*Client) ForkThread ¶
func (*Client) ForkedHeadlessThreadMaterialized ¶
func (c *Client) ForkedHeadlessThreadMaterialized(ctx context.Context, threadID, cwd, sourceID string) (bool, error)
ForkedHeadlessThreadMaterialized binds a fork destination to its exact source.
func (*Client) FreezeObserverWrites ¶
FreezeObserverWrites irreversibly freezes this observer client, preserving its same reader. The owner must first stop and join its ordinary polling/watch work. Any pending RPC, disconnected/stale generation, or missing event tap refuses the freeze. No new coverage or connection is created. Do not call this method while holding a reducer lock or from ObserveEvent.
func (*Client) HasActiveGoal ¶
HasActiveGoal reads durable goal state without loading the conversation.
func (*Client) HeadlessThreadMaterialized ¶
func (c *Client) HeadlessThreadMaterialized(ctx context.Context, threadID, cwd, projectID string) (bool, error)
HeadlessThreadMaterialized verifies an application-owned member thread. A fresh thread has SQLite metadata but no rollout until its first history item.
func (*Client) HistoryMaterialized ¶
func (*Client) IsPreparedSendWithOptions ¶
func (c *Client) IsPreparedSendWithOptions( threadID, text, clientID, actionContext string, options TurnOptions, ) (bool, error)
IsPreparedSendWithOptions reports whether the exact durable send is prepared and has no queue attempt. It neither submits nor changes the preparation.
func (*Client) ListCollaborationModes ¶
func (c *Client) ListCollaborationModes(ctx context.Context) ([]CollaborationMode, error)
func (*Client) ListThreads ¶
func (c *Client) ListThreads( ctx context.Context, options ThreadListOptions, ) ([]ThreadMetadata, *string, error)
func (*Client) LoadedThreadIDs ¶
func (*Client) ObserverGeneration ¶
ObserverGeneration returns the current ready connection identity without connecting or writing. A frozen connection remains ready until it disconnects.
func (*Client) OpenThread ¶
func (*Client) OpenThreadWithSettings ¶
func (*Client) OriginalSendOptions ¶
func (c *Client) OriginalSendOptions(threadID, text, clientID, actionContext string) (TurnOptions, bool, error)
OriginalSendOptions retrieves the exact options reserved by a prior send. An application can use them to retry the same message after its defaults change, without submitting a turn under a different model or policy.
func (*Client) PendingRevision ¶
PendingRevision reads an in-memory invalidation token, without native RPCs or durable ledger access. The value is meaningful only within this client.
func (*Client) PrepareSend ¶
func (*Client) PrepareSendWithOptions ¶
func (c *Client) PrepareSendWithOptions( threadID, text, clientUserMessageID, context string, steered bool, options TurnOptions, ) error
PrepareSendWithOptions durably reserves an exact message identity and its turn options before a caller performs another related state transition.
func (*Client) PromptsWithItems ¶
func (*Client) QueueWithPolicy ¶
func (c *Client) QueueWithPolicy(ctx context.Context, threadID, text, clientID string, policy ThreadPolicy) (QueueEntry, error)
QueueWithPolicy prepares loaded-thread permissions before adding work, since native queue additions can execute immediately. It never loads a cold thread.
func (*Client) ReadAccountRateLimits ¶
func (c *Client) ReadAccountRateLimits(ctx context.Context) (AccountRateLimits, error)
ReadAccountRateLimits reads the connected account's current allowances. Applications decide which buckets to display and authorize account-level reads separately from the conversation handler.
func (*Client) ReadActivity ¶
ReadActivity is optional and safe on a read-only client without a recorder. All history is paginated; absent observation stays unclassified. Calling it does not subscribe, resume, answer requests or alter thread settings.
func (*Client) ReadProject ¶
func (*Client) ReadThread ¶
func (*Client) ReadThreadMetadata ¶
func (*Client) ReadThreadPage ¶
func (*Client) ReadThreadSettings ¶
func (*Client) ReadTurnContext ¶
func (*Client) ReadTurnState ¶
ReadTurnState is a bounded cold observation. It never loads a thread or derives failure state from intermediate error notifications or transcript text.
func (*Client) ReconcileQueueDeletionsWithCompletion ¶
func (c *Client) ReconcileQueueDeletionsWithCompletion(ctx context.Context, threadID string, complete func(string) error) error
ReconcileQueueDeletionsWithCompletion finishes only recorded deletions whose queue entry is already absent. It never deletes a still-present queue entry, so an application can call it under mutation authority before reading a queue.
func (*Client) ReconcileSend ¶
func (c *Client) ReconcileSend( ctx context.Context, threadID, text, clientUserMessageID, actionContext string, ) (SendReceipt, bool, error)
ReconcileSend recovers an existing accepted or submitting attempt without submitting a message. Prepared and absent attempts are left untouched.
func (*Client) ReconcileSendWithOptions ¶
func (c *Client) ReconcileSendWithOptions( ctx context.Context, threadID, text, clientUserMessageID, actionContext string, options TurnOptions, ) (SendReceipt, bool, error)
ReconcileSendWithOptions recovers an existing accepted or submitting exact attempt without submitting a message. Prepared and absent attempts remain untouched.
func (*Client) ReconcileThreadInstructions ¶
ReconcileThreadInstructions refreshes the package-owned thread instruction without interrupting or changing an active turn.
func (*Client) ReconcileThreadInstructionsWithPolicy ¶
func (c *Client) ReconcileThreadInstructionsWithPolicy(ctx context.Context, threadID string, policy ThreadPolicy) error
ReconcileThreadInstructionsWithPolicy refreshes the common instructions and an application-owned thread policy only while the thread is idle.
func (*Client) RecordThreadOperationAttempt ¶
RecordThreadOperationAttempt durably binds an operation for directory to one thread. Repeating the same binding is safe; rebinding fails closed.
func (*Client) RefreshThreadSubscription ¶
RefreshThreadSubscription rejoins an application-reopened thread on the same connection. It never adds a watch or bypasses AllowImplicitResume. Applications call it after a scoped native close/reopen, once their execution fence opens.
func (*Client) RequireSubmissionAttemptsKnown ¶
RequireSubmissionAttemptsKnown accepts exact native queue receipts as known work without loading the thread. Unlike Resolved, queued work may remain; callers must apply their own idle/empty-queue gate before retirement.
func (*Client) RequireSubmissionAttemptsKnownExceptPreparedSend ¶
func (c *Client) RequireSubmissionAttemptsKnownExceptPreparedSend( ctx context.Context, threadID, text, clientID, actionContext string, options TurnOptions, ) error
RequireSubmissionAttemptsKnownExceptPreparedSend excludes only an exact, nonqueued prepared send while checking every other submission normally. It does not authorize dispatch or any other change to the thread.
func (*Client) RequireSubmissionAttemptsResolved ¶
func (*Client) RequireThreadIdle ¶
func (*Client) RequireThreadTurnsIdle ¶
func (*Client) RespondAnswers ¶
func (*Client) RespondDecision ¶
func (*Client) RespondPrompt ¶
RespondPrompt is the token-bound alternative to the legacy response methods.
func (*Client) ResumeThread ¶
func (*Client) ResumeThreadWithSettings ¶
func (*Client) RunEphemeralTurn ¶
func (c *Client) RunEphemeralTurn(ctx context.Context, opts EphemeralTurnOptions) (EphemeralTurnResult, error)
RunEphemeralTurn runs one strict utility turn on a private connection. Its tool-isolation contract supports Codex 0.163 with the fixed immutable catalog. The caller verifies the serving executable; catalog bytes do not identify a native release. It never adopts/reconnects a thread or records a submission.
func (*Client) RunPromptedEphemeralTurn ¶
func (c *Client) RunPromptedEphemeralTurn(ctx context.Context, opts EphemeralTurnOptions) (EphemeralTurnResult, error)
RunPromptedEphemeralTurn runs one bounded naming turn on a private connection using gpt-6-luna with low or high effort and the fixed catalog with raw Codex 0.164 and 0.165. Tools may be advertised or attempted: prompt instructions are guidance, not an enforced tool-effect isolation boundary. The caller verifies the serving executable and supplies explicit naming instructions, including the prohibition on tools. Interactive requests are rejected; execution and cleanup retain the original finite deadline. Operators must pause calls before MCP reconfiguration.
func (*Client) SendAttempted ¶
func (*Client) SendAttemptedWithOptions ¶
func (c *Client) SendAttemptedWithOptions( ctx context.Context, threadID, text, clientUserMessageID, context string, options TurnOptions, ) (bool, error)
SendAttemptedWithOptions discovers a history-accepted exact attempt and records it with the supplied turn-options identity.
func (*Client) SendAttemptedWithOptionsResumable ¶
func (c *Client) SendAttemptedWithOptionsResumable( ctx context.Context, threadID, text, clientID, action string, options TurnOptions, ) (found bool, err error)
SendAttemptedWithOptionsResumable has the same final result and atomic history-receipt import as SendAttemptedWithOptions. Canceled calls retain only completed, validated proof pages for the next explicit call on this client. Incomplete proof always returns an error. This method never submits input.
func (*Client) SendWithOptions ¶
func (c *Client) SendWithOptions( ctx context.Context, threadID, text, clientUserMessageID, actionContext string, options TurnOptions, ) (receipt SendReceipt, err error)
SendWithOptions submits a client-correlated message with optional App Server turn settings. Model and ReasoningEffort are sent only when this call starts an idle turn. AdditionalContext is valid for both turn/start and turn/steer, so it accompanies the message on the active turn rather than changing that turn's model or effort.
func (*Client) SnoozeUserInput ¶
func (*Client) StartQueue ¶
func (*Client) StartQueueWithPolicy ¶
func (c *Client) StartQueueWithPolicy(ctx context.Context, threadID, queuedSubmissionID string, policy ThreadPolicy) error
StartQueueWithPolicy rebinds an application-owned member policy immediately before starting a queued turn. App Server does not retain MCP configuration across resumes, so queued member work needs the same policy as direct sends.
func (*Client) StartThread ¶
func (*Client) StartThreadWithSettings ¶
func (*Client) ThreadOperationAttempt ¶
ThreadOperationAttempt returns the thread bound to a durable operation for directory. Directory is the canonical absolute working directory used as the operation identity.
func (*Client) UnarchiveThread ¶
func (*Client) UpdateThreadSettings ¶
func (c *Client) UpdateThreadSettings( ctx context.Context, threadID string, update ThreadSettingsUpdate, ) (ThreadSettings, error)
func (*Client) VerifyForkedHeadlessBootstrap ¶
func (*Client) VerifyHeadlessBootstrap ¶
func (c *Client) VerifyHeadlessBootstrap(ctx context.Context, threadID, cwd, projectID, marker string) error
VerifyHeadlessBootstrap never sends another injection. It is safe after a lost response because it checks the exact marker in the exact thread rollout.
type ClientInfo ¶
type ClientOptions ¶
type ClientOptions struct {
// DeliveryObserver receives stage timings without input or instruction text.
DeliveryObserver func(DeliveryEvent)
// HistoryReader optionally isolates history I/O; its owner must close it.
HistoryReader HistoryReader
ClientInfo ClientInfo
DeveloperInstructions string
// PreserveThreadInstructionsOnResume omits an instruction override from
// unscoped resumes, preserving each thread's persisted policy. Explicit
// starts, resumes, sends, and reconciliation still apply their policy.
PreserveThreadInstructionsOnResume bool
RuntimeWorkspaceRoots []string
ThreadSourceKinds []string
NonBlockingUserInput *NonBlockingUserInputPolicy
// SubmissionLedgerPath selects application-owned durable retry storage.
// Empty preserves the compatibility path next to the App Server socket.
SubmissionLedgerPath string
// SubmissionDatabasePath selects indexed SQLite storage. SubmissionLedgerPath
// and LegacySubmissionLedgerPath then name import sources, not active stores.
SubmissionDatabasePath string
// LegacySubmissionLedgerPath imports an existing ledger once, under both
// ledger locks. The caller must exclude writers using the predecessor path
// after migration, including when rolling its application back.
LegacySubmissionLedgerPath string
// AllowImplicitResume gates subscription loading and watch restoration on
// every connection generation. It must use application-owned state without
// calling this client. Nil retains ordinary subscription behavior. Explicit
// activation and sends remain the caller's responsibility.
AllowImplicitResume func(threadID string) bool
// LifecycleSettings resolves application-owned provider and retained model
// settings immediately before every start, resume, fork and reconnect resume.
// An empty thread ID denotes a new thread. Explicit model/effort parameters
// take precedence; the resolved provider takes precedence over caller input.
// The resolver may perform reads, but must not issue lifecycle requests.
LifecycleSettings func(context.Context, string) (ThreadSettings, error)
// LifecycleRequestSettings additionally identifies the trusted destination
// directory, including for new threads and forks. When set it takes precedence
// over LifecycleSettings. The application must resolve and authorize this
// directory before calling the client; it is not a browser authorization API.
LifecycleRequestSettings func(context.Context, LifecycleRequest) (ThreadSettings, error)
// ObserverOnly prevents responses, unsupported-request rejections and
// thread-setting overrides. Use a dedicated client for passive monitoring.
ObserverOnly bool
// ObserveEvent opts an ObserverOnly client into ordered, detached events.
// The synchronous callback must be bounded, memory-only and never call the
// client. It runs without client locks, before ordinary wakeup coalescing.
ObserveEvent func(ObserverEvent)
ActivityRecorder *ActivityRecorder
}
type CollaborationMode ¶
type CreditsSnapshot ¶
type DeliveryEvent ¶
type DeliveryEvent struct {
ThreadID string
ClientUserMessageID string
Stage string
Duration time.Duration
Failed bool
}
DeliveryEvent describes one delivery stage without retaining input or options. Observers must return promptly and must not call the client recursively.
type EphemeralTurnOptions ¶
type EphemeralTurnOptions struct {
Directory string
InstructionFile string
// ModelCatalogFile is the immutable catalog for the selected profile,
// used by a naming-only daemon through its startup CLI override.
ModelCatalogFile string
// ModelProvider selects the trusted caller's provider for this new utility
// thread. Empty retains the native default. The lifecycle RPC validates the
// effective provider before the helper can start inference.
ModelProvider string
Model string
Effort string
Instructions string
Input string
OutputSchema json.RawMessage
}
EphemeralTurnOptions contains trusted application inputs, never browser paths or arbitrary tool/config overrides. Directory must be empty, canonical, application-owned mode 0700 outside project trees. Its parent is private too. InstructionFile is a separate canonical regular mode-0600 file containing exactly EphemeralInstructionFileContent in private state outside Directory. The caller keeps that unique file unchanged through teardown. The helper creates no files. Global user instructions remain trusted serving-instance policy.
type EphemeralTurnResult ¶
type EphemeralTurnResult struct{ Text string }
type HistoryPool ¶
type HistoryPool struct {
// contains filtered or unexported fields
}
func NewHistoryPool ¶
func NewHistoryPool(socket string) *HistoryPool
NewHistoryPool creates two passive, non-subscribing connections. Each admits one RPC at a time, so an oversized reply can only fail its own history read.
func (*HistoryPool) Close ¶
func (p *HistoryPool) Close()
type HistoryReader ¶
HistoryReader isolates potentially large reads from the connection that owns live watches and approval offers. The application owns its lifetime and may share it between interactive and observer clients for the same authority.
type LifecycleRequest ¶
LifecycleRequest describes the application-supplied lifecycle destination. ThreadID is empty for start and identifies the source thread for fork. Cwd can be empty on reconnect; applications can then resolve it from ThreadID.
type MessageNotSentError ¶
type MessageNotSentError struct {
Err error
// Retryable identifies a transient admission or connection failure. Protocol
// refusals remain unsent but require the caller to correct the request.
Retryable bool
}
MessageNotSentError proves that this send did not dispatch user input. It must never be used for an earlier attempt whose delivery remains uncertain.
func (*MessageNotSentError) Error ¶
func (e *MessageNotSentError) Error() string
func (*MessageNotSentError) Unwrap ¶
func (e *MessageNotSentError) Unwrap() error
type Model ¶
type Model struct {
ID string `json:"id"`
Model string `json:"model"`
DisplayName string `json:"displayName"`
Description string `json:"description"`
IsDefault bool `json:"isDefault"`
DefaultReasoningEffort string `json:"defaultReasoningEffort"`
SupportedReasoningEfforts []ReasoningEffortOption `json:"supportedReasoningEfforts"`
}
type NonBlockingUserInputPolicy ¶
NonBlockingUserInputPolicy opts a client into automatically answering nonblocking user-input requests after an application-defined grace period. A nil policy leaves every request pending until the application responds.
type ObserverEvent ¶
type ObserverEvent struct {
Kind ObserverEventKind
Generation, Sequence uint64
ThreadID, Method string
RequestID, Params json.RawMessage
Reason string
}
ObserverEvent is detached from the decoder and the client's mutable state. Params and RequestID belong to this invocation and may be retained or changed by its recipient. RPC result bodies are never included. Sequence increases across connections; Generation identifies one connection, not a native epoch.
type ObserverEventKind ¶
type ObserverEventKind string
ObserverEventKind identifies transport and watch boundaries as well as native notifications. Every loss of coverage is explicit; none grants new coverage.
const ( ObserverConnected ObserverEventKind = "connected" ObserverNotification ObserverEventKind = "notification" ObserverWatchEstablished ObserverEventKind = "watch-established" ObserverWatchRemoved ObserverEventKind = "watch-removed" ObserverDisconnected ObserverEventKind = "disconnected" ObserverClosed ObserverEventKind = "closed" ObserverInvalid ObserverEventKind = "invalid" )
type PendingRequest ¶
type PendingRequest struct {
ID string `json:"id"`
Method string `json:"method"`
Params json.RawMessage `json:"params"`
// contains filtered or unexported fields
}
type ProjectMetadata ¶
ProjectMetadata is the identity returned by the App Server project catalog.
type ProjectNotFoundError ¶
func (*ProjectNotFoundError) Error ¶
func (e *ProjectNotFoundError) Error() string
func (*ProjectNotFoundError) Unwrap ¶
func (e *ProjectNotFoundError) Unwrap() error
type Prompt ¶
type Prompt struct {
ID string `json:"id"`
Token string `json:"token,omitempty"`
Method string `json:"method"`
Kind string `json:"kind"`
ThreadID string `json:"threadId"`
TurnID string `json:"turnId,omitempty"`
ItemID string `json:"itemId,omitempty"`
Params map[string]any `json:"params"`
Item map[string]any `json:"item,omitempty"`
AuthorityAvailable bool `json:"authorityAvailable"`
Error string `json:"error,omitempty"`
AvailableDecisions []string `json:"availableDecisions,omitempty"`
Questions []Question `json:"questions,omitempty"`
IsBlocking bool `json:"isBlocking"`
AutoResolutionMS *uint64 `json:"autoResolutionMs,omitempty"`
AutoResolutionVisibleAtMS int64 `json:"autoResolutionVisibleAtMs,omitempty"`
AutoResolutionAtMS int64 `json:"autoResolutionAtMs,omitempty"`
AutoResolveSnoozed bool `json:"autoResolveSnoozed,omitempty"`
}
type PromptResponse ¶
type PromptResponse struct {
ID string `json:"id"`
Token string `json:"token,omitempty"`
Decision string `json:"decision,omitempty"`
Answers map[string]map[string][]string `json:"answers,omitempty"`
Snooze bool `json:"snooze,omitempty"`
}
PromptResponse binds an action to the exact offer returned by Prompts. Token is local to this client instance and never sent to the App Server.
type PromptResponseError ¶
PromptResponseError distinguishes rejection before sending from an uncertain transport outcome. NotSent is never inferred from an HTTP status or timeout.
func (*PromptResponseError) Error ¶
func (e *PromptResponseError) Error() string
func (*PromptResponseError) Unwrap ¶
func (e *PromptResponseError) Unwrap() error
type QueueEntry ¶
type QueueEntry struct {
DisplayText *string `json:"displayText,omitempty"`
Attachments []Attachment `json:"attachments,omitempty"`
ID string `json:"id"`
Text string `json:"text"`
ClientUserMessageID string `json:"clientUserMessageId"`
}
type RateLimitResetCredit ¶
type RateLimitResetCredits ¶
type RateLimitResetCredits struct {
AvailableCount int64 `json:"availableCount"`
Credits []RateLimitResetCredit `json:"credits"`
}
type RateLimitSnapshot ¶
type RateLimitSnapshot struct {
LimitID string `json:"limitId"`
Primary *RateLimitWindow `json:"primary"`
Secondary *RateLimitWindow `json:"secondary"`
Credits *CreditsSnapshot `json:"credits,omitempty"`
}
type RateLimitWindow ¶
type RateLimitWindow struct {
UsedPercent int `json:"usedPercent"`
WindowDurationMins *int64 `json:"windowDurationMins"`
ResetsAt *int64 `json:"resetsAt"`
}
RateLimitWindow describes usage over a reported duration. Primary and secondary positions do not imply a particular duration. ResetsAt is Unix time in seconds; nil duration or reset time means the server did not report it.
type ReasoningEffortOption ¶
type ResetCreditResult ¶
type ResetCreditResult struct {
Outcome string `json:"outcome"`
}
type SendAcknowledgement ¶
type SendReceipt ¶
type TerminalFailure ¶
type TerminalFailure struct {
TurnID string `json:"turnId"`
Code string `json:"code"`
Message string `json:"message"`
}
TerminalFailure describes only the latest, authoritatively failed turn. Code preserves the native string discriminator. Unknown and structured discriminators never become a known retry class through message matching.
type ThreadListOptions ¶
type ThreadListOptions struct {
Cwd string
ProjectID string
SourceKinds []string
Archived *bool
Limit int
SortDirection string
Cursor string
// ModelProviders filters saved threads by provider. Nil keeps the server's
// default provider filter; an empty non-nil slice includes every provider.
ModelProviders []string
// UseStateDBOnly skips scanning JSONL rollouts to repair thread metadata.
// False omits the option, preserving the server's scan-and-repair behavior.
UseStateDBOnly bool
}
type ThreadMCPServer ¶
type ThreadMCPServer struct {
Name string `json:"name"`
Command string `json:"command"`
Args []string `json:"args"`
Tool string `json:"tool"`
}
ThreadMCPServer binds one stdio MCP tool to a trusted thread policy. It is intentionally narrow: the application chooses the command and arguments; the model can call only Tool. Callers must enforce their own tool semantics.
type ThreadMetadata ¶
type ThreadMetadata struct {
ID string `json:"id"`
Cwd string `json:"cwd"`
ProjectID *string `json:"projectId"`
ForkedFromID string `json:"forkedFromId"`
Source any `json:"source"`
UpdatedAt int64 `json:"updatedAt"`
Path *string `json:"path"`
Preview string `json:"preview"`
Ephemeral *bool `json:"ephemeral"`
HistoryMode string `json:"historyMode"`
Status map[string]any `json:"status"`
Turns *[]map[string]any `json:"turns"`
}
ThreadMetadata is the App Server identity and persistence metadata used by applications that own thread recovery and archival policy.
type ThreadNotFoundError ¶
func (*ThreadNotFoundError) Error ¶
func (e *ThreadNotFoundError) Error() string
func (*ThreadNotFoundError) Unwrap ¶
func (e *ThreadNotFoundError) Unwrap() error
type ThreadPolicy ¶
type ThreadPolicy struct {
DeveloperInstructions string `json:"developerInstructions,omitempty"`
Sandbox string `json:"sandbox,omitempty"`
ApprovalPolicy string `json:"approvalPolicy,omitempty"`
MCPServer *ThreadMCPServer `json:"mcpServer,omitempty"`
}
ThreadPolicy supplies application-owned instructions and sandbox access for a persistent thread. The client combines DeveloperInstructions with its common lifecycle instructions whenever the policy is explicitly applied. MCPServer is a single application-owned, explicitly approved tool that must be rebound on every member resume; App Server does not retain it otherwise.
type ThreadSettings ¶
type ThreadSettings struct {
Model string `json:"model,omitempty"`
// ModelProvider is a lifecycle override, not a thread/settings/update field.
ModelProvider string `json:"modelProvider,omitempty"`
ReasoningEffort string `json:"reasoningEffort,omitempty"`
CollaborationMode string `json:"collaborationMode,omitempty"`
Policy ThreadPolicy `json:"policy,omitempty"`
ProjectID string `json:"projectId,omitempty"`
}
func ResolveForkThreadSettings ¶
func ResolveForkThreadSettings( models []Model, source ThreadSettings, requested ThreadSettings, ) (ThreadSettings, error)
func ResolveNewThreadSettings ¶
func ResolveNewThreadSettings( models []Model, requested ThreadSettings, defaults ThreadSettings, ) (ThreadSettings, error)
type ThreadSettingsUpdate ¶
type Transcript ¶
type Transcript struct {
ThreadID string `json:"threadId"`
Status string `json:"status"`
LatestTurnID string `json:"latestTurnId,omitempty"`
Model string `json:"model,omitempty"`
ReasoningEffort string `json:"reasoningEffort,omitempty"`
CollaborationMode string `json:"collaborationMode,omitempty"`
Entries []TranscriptEntry `json:"entries"`
}
type TranscriptActivity ¶
type TranscriptActivity struct {
Action string `json:"action,omitempty"`
Status string `json:"status,omitempty"`
Queries []string `json:"queries,omitempty"`
Links []ActivityLink `json:"links,omitempty"`
Agents []ActivityAgent `json:"agents,omitempty"`
AgentPath string `json:"agentPath,omitempty"`
Model string `json:"model,omitempty"`
ReasoningEffort string `json:"reasoningEffort,omitempty"`
}
TranscriptActivity is presentation data, not authorization to access child threads. Unknown protocol fields remain available in the entry's Details.
type TranscriptCommunication ¶
type TranscriptCommunication struct {
Kind string `json:"kind"`
From string `json:"from,omitempty"`
To string `json:"to,omitempty"`
}
TranscriptCommunication is an application-owned presentation hint. It does not authenticate a sender or authorize access to another conversation.
type TranscriptCursorError ¶
type TranscriptCursorError struct{ Code string }
func (*TranscriptCursorError) Error ¶
func (e *TranscriptCursorError) Error() string
type TranscriptEntry ¶
type TranscriptEntry struct {
Communication *TranscriptCommunication `json:"communication,omitempty"`
Citations []CitationSpan `json:"citations,omitempty"`
CitationsPending bool `json:"citationsPending,omitempty"`
Delivery string `json:"delivery,omitempty"`
Questions []AsyncQuestion `json:"questions,omitempty"`
QuestionReplies []AsyncQuestionReply `json:"questionReplies,omitempty"`
DisplayText *string `json:"displayText,omitempty"`
Attachments []Attachment `json:"attachments,omitempty"`
TurnID string `json:"turnId,omitempty"`
TurnStatus string `json:"turnStatus,omitempty"`
ItemID string `json:"itemId,omitempty"`
ClientUserMessageID string `json:"clientUserMessageId,omitempty"`
ClientUserMessageDigest string `json:"clientUserMessageDigest,omitempty"`
Kind string `json:"kind"`
Summary string `json:"summary,omitempty"`
Text string `json:"text,omitempty"`
HTML string `json:"html,omitempty"`
Details string `json:"details,omitempty"`
Timestamp string `json:"timestamp,omitempty"`
TimestampApproximate bool `json:"timestampApproximate,omitempty"`
Activity *TranscriptActivity `json:"activity,omitempty"`
}
type TranscriptPage ¶
type TranscriptPage struct {
Transcript
OlderCursor *string `json:"olderCursor"`
HasOlder bool `json:"hasOlder"`
MetadataPending bool `json:"metadataPending"`
}
type TransportError ¶
type TransportError struct{ Err error }
TransportError identifies a connection failure or request deadline, separate from an App Server RPC refusal or invalid response. Retrying an observation is safe; mutations still require their durable outcome reconciliation.
func (*TransportError) Error ¶
func (e *TransportError) Error() string
func (*TransportError) Unwrap ¶
func (e *TransportError) Unwrap() error
type TurnContext ¶
type TurnContext struct {
ThreadID string
TurnID string
Cwd string
Model string
ReasoningEffort string
CollaborationMode string
ApprovalPolicy json.RawMessage
SandboxPolicy json.RawMessage
ApprovalsReviewer string
PermissionProfile json.RawMessage
}
TurnContext is an exact native Codex 0.163.0 rollout projection, available only to trusted Go callers. It does not prove provider, instructions or MCP authority and never exposes arbitrary context or developer instruction text.
type TurnMetadata ¶
type TurnMetadata struct {
ID string `json:"id"`
Status string `json:"status"`
StartedAtMS int64 `json:"startedAtMs,omitempty"`
CompletedAtMS int64 `json:"completedAtMs,omitempty"`
DurationMS int64 `json:"durationMs,omitempty"`
Messages int `json:"messages"`
ReceivedMessages int `json:"receivedMessages"`
ToolCalls int `json:"toolCalls"`
CountsKnown bool `json:"countsKnown"`
HasSleep bool `json:"-"`
AutomaticWaits map[string]activityToolWait `json:"-"`
}
TurnMetadata uses server turn boundaries. Counts are distinct root-thread items, independent of transcript presentation and lifecycle notifications.
type TurnOptions ¶
type TurnOptions struct {
Model string `json:"model,omitempty"`
ReasoningEffort string `json:"reasoningEffort,omitempty"`
AdditionalContext map[string]AdditionalContextEntry `json:"additionalContext,omitempty"`
ThreadPolicy ThreadPolicy `json:"threadPolicy,omitempty"`
}
TurnOptions selects optional App Server turn settings. Empty Model and ReasoningEffort leave the corresponding App Server setting unchanged. AdditionalContext is keyed by an opaque application source identifier.
type TurnState ¶
type TurnState struct {
ThreadID string `json:"threadId"`
Status string `json:"status"`
LatestTurnID string `json:"latestTurnId"`
LatestTurnStatus string `json:"latestTurnStatus"`
TerminalFailure *TerminalFailure `json:"terminalFailure"`
}
func (TurnState) IsLoadedFailedTurn ¶
IsLoadedFailedTurn checks only the exact loaded terminal observation. Native systemError can persist after a failed turn until another turn starts. This predicate does not classify errors or prove queue, request or authority holds.
type UnknownSendOutcomeError ¶
type UnknownSendOutcomeError struct {
Err error
}
func (*UnknownSendOutcomeError) Error ¶
func (e *UnknownSendOutcomeError) Error() string
func (*UnknownSendOutcomeError) Unwrap ¶
func (e *UnknownSendOutcomeError) Unwrap() error
Source Files
¶
- activity.go
- activity_history.go
- activity_lineage.go
- activity_lineage_cache.go
- activity_recording.go
- activity_snapshot.go
- activity_store.go
- async_questions.go
- attachments.go
- capacity.go
- citation_history.go
- citations.go
- client.go
- conditional_steer.go
- context_mutex.go
- continuation.go
- delivery_trace.go
- ephemeral.go
- headless.go
- history_reader.go
- lifecycle.go
- observer.go
- observer_events.go
- page_metadata.go
- prompt_response.go
- request_policy.go
- send_delivery.go
- send_discovery.go
- submission_database.go
- submission_migration.go
- thread_page.go
- timestamps.go
- transcript_activity.go
- turn_context.go
- turn_history.go
- turn_state.go