Documentation
¶
Overview ¶
Package codexgo provides a compact client for the Codex app-server.
Index ¶
- Constants
- func FindBinary() (string, error)
- func IsHttpConnectionFailed(err error) bool
- func IsInternalServerError(err error) bool
- func IsRateLimited(err error) bool
- func IsUnauthorized(err error) bool
- func StreamText(ctx context.Context, ch <-chan ThreadEvent, w io.Writer) error
- type AccountInfo
- type AccountRateLimitsUpdatedEvent
- type AccountReadResult
- type AccountUpdatedEvent
- type AppListUpdatedEvent
- type ApprovalDecision
- type ApprovalHandler
- type ApprovalMode
- type AuthMode
- type CancelLoginStatus
- type Capabilities
- type Client
- func (c *Client) AccountRead(ctx context.Context) (AccountReadResult, error)
- func (c *Client) Call(ctx context.Context, method string, params, result any) error
- func (c *Client) Close() error
- func (c *Client) CommandExec(ctx context.Context, req CommandExecRequest) (CommandExecResult, error)
- func (c *Client) CommandExecHandle(processID string) *CommandExecHandle
- func (c *Client) CommandExecResize(ctx context.Context, req CommandExecResizeRequest) error
- func (c *Client) CommandExecTerminate(ctx context.Context, req CommandExecTerminateRequest) error
- func (c *Client) CommandExecWrite(ctx context.Context, req CommandExecWriteRequest) error
- func (c *Client) ConfigBatchWrite(ctx context.Context, req ConfigBatchWriteRequest) error
- func (c *Client) ConfigRead(ctx context.Context, req ConfigReadRequest) (ConfigReadResult, error)
- func (c *Client) ConfigValueWrite(ctx context.Context, req ConfigValueWriteRequest) error
- func (c *Client) Events() *EventSubscription
- func (c *Client) ExperimentalFeatureEnablementSet(ctx context.Context, req ExperimentalFeatureEnablementSetRequest) (ExperimentalFeatureEnablementSetResult, error)
- func (c *Client) ExperimentalFeatureList(ctx context.Context, req ExperimentalFeatureListRequest) (ExperimentalFeatureListResult, error)
- func (c *Client) HooksList(ctx context.Context, req HooksListRequest) (HooksListResult, error)
- func (c *Client) Initialize(ctx context.Context, req InitializeRequest) (InitializeResult, error)
- func (c *Client) LoginAPIKey(ctx context.Context, apiKey string) error
- func (c *Client) LoginChatGPT(ctx context.Context) (*LoginHandle, error)
- func (c *Client) LoginDeviceCode(ctx context.Context) (*LoginHandle, error)
- func (c *Client) Logout(ctx context.Context) error
- func (c *Client) ModelList(ctx context.Context, includeHidden bool) ([]ModelInfo, error)
- func (c *Client) ModelProviderCapabilitiesRead(ctx context.Context) (ModelProviderCapabilities, error)
- func (c *Client) Models(ctx context.Context) ([]string, error)
- func (c *Client) Ping(ctx context.Context) error
- func (c *Client) ResumeThread(ctx context.Context, threadID string, opts ...ThreadOption) (*SessionThread, error)
- func (c *Client) ReviewStart(ctx context.Context, req ReviewStartRequest) error
- func (c *Client) SetApprovalPolicy(ctx context.Context, policy string) error
- func (c *Client) SetModel(ctx context.Context, model string) error
- func (c *Client) SetSandbox(ctx context.Context, sandbox string) error
- func (c *Client) SkillsConfigWrite(ctx context.Context, req SkillsConfigWriteRequest) (SkillsConfigWriteResult, error)
- func (c *Client) SkillsExtraRootsSet(ctx context.Context, req SkillsExtraRootsSetRequest) error
- func (c *Client) SkillsList(ctx context.Context, req SkillsListRequest) (SkillsListResult, error)
- func (c *Client) StartThread(ctx context.Context, opts ...ThreadOption) (*SessionThread, error)
- func (c *Client) ThreadApproveGuardianDeniedAction(ctx context.Context, req ThreadApproveGuardianDeniedActionRequest) error
- func (c *Client) ThreadArchive(ctx context.Context, req ThreadArchiveRequest) error
- func (c *Client) ThreadDelete(ctx context.Context, req ThreadDeleteRequest) error
- func (c *Client) ThreadFork(ctx context.Context, req ThreadForkRequest) (Thread, error)
- func (c *Client) ThreadGoalClear(ctx context.Context, req ThreadGoalClearRequest) error
- func (c *Client) ThreadGoalGet(ctx context.Context, req ThreadGoalGetRequest) (ThreadGoal, error)
- func (c *Client) ThreadGoalSet(ctx context.Context, req ThreadGoalSetRequest) (ThreadGoal, error)
- func (c *Client) ThreadInjectItems(ctx context.Context, req ThreadInjectItemsRequest) error
- func (c *Client) ThreadList(ctx context.Context, req ThreadListRequest) ([]Thread, error)
- func (c *Client) ThreadLoadedList(ctx context.Context) ([]string, error)
- func (c *Client) ThreadMetadataUpdate(ctx context.Context, req ThreadMetadataUpdateRequest) (ThreadMetadataUpdateResult, error)
- func (c *Client) ThreadRead(ctx context.Context, req ThreadReadRequest) (Thread, error)
- func (c *Client) ThreadResume(ctx context.Context, req ThreadResumeRequest) (Thread, error)
- func (c *Client) ThreadRollback(ctx context.Context, req ThreadRollbackRequest) error
- func (c *Client) ThreadSetName(ctx context.Context, req ThreadSetNameRequest) error
- func (c *Client) ThreadShellCommand(ctx context.Context, req ThreadShellCommandRequest) error
- func (c *Client) ThreadStart(ctx context.Context, req ThreadStartRequest) (Thread, error)
- func (c *Client) ThreadUnarchive(ctx context.Context, req ThreadUnarchiveRequest) error
- func (c *Client) ThreadUnsubscribe(ctx context.Context, req ThreadUnsubscribeRequest) (ThreadUnsubscribeResult, error)
- func (c *Client) TurnDiff(ctx context.Context, req TurnDiffRequest) (TurnDiffResult, error)
- func (c *Client) TurnInterrupt(ctx context.Context, req TurnInterruptRequest) error
- func (c *Client) TurnRead(ctx context.Context, threadID, turnID string) (Turn, error)
- func (c *Client) TurnStart(ctx context.Context, req TurnStartRequest) (Turn, error)
- func (c *Client) TurnSteer(ctx context.Context, req TurnSteerRequest) error
- func (c *Client) WaitForFinalAgentMessage(ctx context.Context, threadID, turnID string) (string, error)
- func (c *Client) WaitForStructuredOutput(ctx context.Context, threadID, turnID string, out any) (Turn, error)
- func (c *Client) WaitForTurn(ctx context.Context, threadID, turnID string) (Turn, error)
- type ClientInfo
- type CodexError
- type CommandExecHandle
- func (h *CommandExecHandle) CloseStdin(ctx context.Context) error
- func (h *CommandExecHandle) ProcessID() string
- func (h *CommandExecHandle) Resize(ctx context.Context, cols, rows int) error
- func (h *CommandExecHandle) Terminate(ctx context.Context) error
- func (h *CommandExecHandle) Write(ctx context.Context, deltaBase64 string) error
- type CommandExecOutputDeltaEvent
- type CommandExecRequest
- type CommandExecResizeRequest
- type CommandExecResult
- type CommandExecTerminalSize
- type CommandExecTerminateRequest
- type CommandExecWriteRequest
- type CommandExecutionApprovalRequest
- type CommandExecutionApprovalResult
- type CommandExecutionPayload
- type ConfigBatchWriteRequest
- type ConfigReadRequest
- type ConfigReadResult
- type ConfigValueWriteRequest
- type ConfigWarningEvent
- type DeprecationNoticeEvent
- type Dispatcher
- type DynamicToolCallRequest
- type DynamicToolCallResult
- type DynamicToolHandler
- type ErrorEvent
- type Event
- type EventSubscription
- type ExecApprovalHandler
- type ExperimentalFeature
- type ExperimentalFeatureEnablementSetRequest
- type ExperimentalFeatureEnablementSetResult
- type ExperimentalFeatureListRequest
- type ExperimentalFeatureListResult
- type ExternalAgentConfigImportCompletedEvent
- type ExternalAgentConfigImportProgressEvent
- type FileApprovalHandler
- type FileChangeApprovalRequest
- type FileChangeApprovalResult
- type FileChangePayload
- type FsChangedEvent
- type GuardianWarningEvent
- type HookCompletedEvent
- type HookStartedEvent
- type HooksListRequest
- type HooksListResult
- type InitializeRequest
- type InitializeResult
- type Item
- type ItemAgentMessageDeltaEvent
- type ItemAutoApprovalReviewCompletedEvent
- type ItemAutoApprovalReviewStartedEvent
- type ItemCommandExecutionOutputDeltaEvent
- type ItemCompletedEvent
- type ItemFileChangeOutputDeltaEvent
- type ItemFileChangePatchUpdatedEvent
- type ItemKind
- type ItemPlanDeltaEvent
- type ItemReasoningSummaryPartAddedEvent
- type ItemReasoningSummaryTextDeltaEvent
- type ItemReasoningTextDeltaEvent
- type ItemStartedEvent
- type ItemUpdatedEvent
- type LoginCompleted
- type LoginHandle
- type MCPApprovalHandler
- type MCPToolCallApprovalRequest
- type MCPToolCallApprovalResponse
- type McpServerOauthLoginCompletedEvent
- type McpServerStatusUpdatedEvent
- type McpToolCallProgressEvent
- type MergeStrategy
- type ModelInfo
- type ModelProviderCapabilities
- type ModelReroutedEvent
- type ModelVerificationEvent
- type Option
- func WithApprovalHandler(handler ApprovalHandler) Option
- func WithAutoLogin(apiKey string) Option
- func WithHTTPAPIKey(key string) Option
- func WithHTTPBearerToken(token string) Option
- func WithHTTPTransport(baseURL string) Option
- func WithMaxThreads(n int) Option
- func WithProcessDir(dir string) Option
- func WithProcessEnv(key, value string) Option
- func WithReconnectingHTTPTransport(baseURL string) Option
- func WithReconnectingWSTransport(ctx context.Context, url string) Option
- func WithRequestHandler(handler RequestHandler) Option
- func WithRetry(cfg transport.RetryConfig) Option
- func WithStdioProcess(binaryPath string, args ...string) Option
- func WithStdioTransport(stdin io.ReadCloser, stdout io.WriteCloser) Option
- func WithTransport(t Transport) Option
- func WithWSAPIKey(key string) Option
- func WithWSBearerToken(token string) Option
- func WithWSTransport(ctx context.Context, url string) Option
- type PermissionsApprovalRequest
- type PermissionsApprovalResult
- type PlanType
- type ProcessExitedEvent
- type ProcessOutputDeltaEvent
- type RawNotificationEvent
- type RawResponseItemCompletedEvent
- type RemoteControlStatusChangedEvent
- type RequestHandler
- type RequestHandlerFunc
- type ReviewStartRequest
- type SandboxMode
- type ServerRequest
- type ServerRequestResolvedEvent
- type ServerResponse
- type SessionThread
- func (t *SessionThread) Archive(ctx context.Context) error
- func (t *SessionThread) ClearGoal(ctx context.Context) error
- func (t *SessionThread) Close()
- func (t *SessionThread) Compact(ctx context.Context) error
- func (t *SessionThread) Fork(ctx context.Context, turnID string, opts ...ThreadOption) (*SessionThread, error)
- func (t *SessionThread) GetGoal(ctx context.Context) (ThreadGoal, error)
- func (t *SessionThread) GitDiff(ctx context.Context, turnID string) (string, error)
- func (t *SessionThread) ID() string
- func (t *SessionThread) Interrupt(ctx context.Context, turnID string) error
- func (t *SessionThread) Rollback(ctx context.Context, turnIDs []string) error
- func (t *SessionThread) Run(ctx context.Context, input string, opts ...TurnOption) (*TurnResult, error)
- func (t *SessionThread) RunStreamed(ctx context.Context, input string, opts ...TurnOption) (<-chan ThreadEvent, error)
- func (t *SessionThread) SetGoal(ctx context.Context, goal string) error
- func (t *SessionThread) SetName(ctx context.Context, name string) error
- func (t *SessionThread) Steer(ctx context.Context, turnID, input string) error
- func (t *SessionThread) SteerInputs(ctx context.Context, turnID string, inputs ...TurnInput) error
- func (t *SessionThread) Unarchive(ctx context.Context) error
- type SkillErrorInfo
- type SkillMetadata
- type SkillsChangedEvent
- type SkillsConfigWriteRequest
- type SkillsConfigWriteResult
- type SkillsExtraRootsSetRequest
- type SkillsListEntry
- type SkillsListRequest
- type SkillsListResult
- type TerminalInteractionEvent
- type Thread
- type ThreadActiveFlag
- type ThreadApproveGuardianDeniedActionRequest
- type ThreadArchiveRequest
- type ThreadArchivedEvent
- type ThreadClosedEvent
- type ThreadCompactedEvent
- type ThreadDeleteRequest
- type ThreadDeletedEvent
- type ThreadEvent
- type ThreadForkRequest
- type ThreadGoal
- type ThreadGoalClearRequest
- type ThreadGoalClearedEvent
- type ThreadGoalGetRequest
- type ThreadGoalSetRequest
- type ThreadGoalSetResult
- type ThreadGoalStatus
- type ThreadGoalUpdatedEvent
- type ThreadInjectItemsRequest
- type ThreadListRequest
- type ThreadMetadataGitInfo
- type ThreadMetadataUpdateRequest
- type ThreadMetadataUpdateResult
- type ThreadNameUpdatedEvent
- type ThreadOption
- func WithInitialInput(input string) ThreadOption
- func WithThreadApprovalMode(mode ApprovalMode) ThreadOption
- func WithThreadApprovalPolicy(policy string) ThreadOption
- func WithThreadCWD(cwd string) ThreadOption
- func WithThreadEphemeral(ephemeral bool) ThreadOption
- func WithThreadModel(model string) ThreadOption
- type ThreadReadRequest
- type ThreadRealtimeClosedEvent
- type ThreadRealtimeErrorEvent
- type ThreadRealtimeItemAddedEvent
- type ThreadRealtimeOutputAudioDeltaEvent
- type ThreadRealtimeSdpEvent
- type ThreadRealtimeStartedEvent
- type ThreadRealtimeTranscriptDeltaEvent
- type ThreadRealtimeTranscriptDoneEvent
- type ThreadResumeRequest
- type ThreadRollbackRequest
- type ThreadSetNameRequest
- type ThreadSettingsUpdatedEvent
- type ThreadShellCommandRequest
- type ThreadStartRequest
- type ThreadStartedEvent
- type ThreadStatus
- type ThreadStatusChangedEvent
- type ThreadTokenUsageUpdatedEvent
- type ThreadUnarchiveRequest
- type ThreadUnarchivedEvent
- type ThreadUnsubscribeRequest
- type ThreadUnsubscribeResult
- type ThreadUnsubscribeStatus
- type TokenUsage
- type Transport
- type Turn
- type TurnCompletedEvent
- type TurnDiffRequest
- type TurnDiffResult
- type TurnDiffUpdatedEvent
- type TurnError
- type TurnInput
- type TurnInterruptRequest
- type TurnItemsView
- type TurnModerationMetadataEvent
- type TurnOption
- func WithApprovalMode(mode ApprovalMode) TurnOption
- func WithApprovalPolicy(policy string) TurnOption
- func WithCWD(cwd string) TurnOption
- func WithEffort(effort string) TurnOption
- func WithInputs(inputs ...TurnInput) TurnOption
- func WithModel(model string) TurnOption
- func WithSandbox(sandbox string) TurnOption
- func WithSandboxMode(mode SandboxMode) TurnOption
- func WithSkill(skill string) TurnOption
- type TurnPlanUpdatedEvent
- type TurnResult
- type TurnStartRequest
- type TurnStartedEvent
- type TurnStatus
- type TurnSteerRequest
- type UserInputOption
- type UserInputQuestion
- type UserInputRequest
- type UserInputResult
- type WarningEvent
- type WindowsSandboxSetupCompletedEvent
- type WindowsWorldWritableWarningEvent
Constants ¶
const ( ApprovalDecisionAccept = "accept" ApprovalDecisionAcceptForSession = "acceptForSession" ApprovalDecisionAcceptWithExecPolicyAmendment = "acceptWithExecpolicyAmendment" ApprovalDecisionApplyNetworkPolicyAmendment = "applyNetworkPolicyAmendment" ApprovalDecisionDecline = "decline" ApprovalDecisionCancel = "cancel" FileChangeApprovalDecisionAccept = "accept" FileChangeApprovalDecisionAcceptForSession = "acceptForSession" FileChangeApprovalDecisionDecline = "decline" FileChangeApprovalDecisionCancel = "cancel" )
const ( ThreadGoalStatusActive = schematypes.ThreadGoalStatusActive ThreadGoalStatusPaused = schematypes.ThreadGoalStatusPaused ThreadGoalStatusBlocked = schematypes.ThreadGoalStatusBlocked ThreadGoalStatusUsageLimited = schematypes.ThreadGoalStatusUsageLimited ThreadGoalStatusBudgetLimited = schematypes.ThreadGoalStatusBudgetLimited ThreadGoalStatusComplete = schematypes.ThreadGoalStatusComplete )
const ( ThreadStatusNotLoaded = protocol.ThreadStatusNotLoaded ThreadStatusIdle = protocol.ThreadStatusIdle ThreadStatusSystemError = protocol.ThreadStatusSystemError ThreadStatusActive = protocol.ThreadStatusActive )
const ( ThreadActiveFlagWaitingOnApproval = protocol.ThreadActiveFlagWaitingOnApproval ThreadActiveFlagWaitingOnUserInput = protocol.ThreadActiveFlagWaitingOnUserInput )
const ( TurnStatusCompleted = protocol.TurnStatusCompleted TurnStatusInterrupted = protocol.TurnStatusInterrupted TurnStatusFailed = protocol.TurnStatusFailed TurnStatusInProgress = protocol.TurnStatusInProgress )
const ( TurnItemsViewNotLoaded = protocol.TurnItemsViewNotLoaded TurnItemsViewSummary = protocol.TurnItemsViewSummary TurnItemsViewFull = protocol.TurnItemsViewFull )
const ( ItemKindUserMessage = protocol.ItemKindUserMessage ItemKindHookPrompt = protocol.ItemKindHookPrompt ItemKindAgentMessage = protocol.ItemKindAgentMessage ItemKindPlan = protocol.ItemKindPlan ItemKindReasoning = protocol.ItemKindReasoning ItemKindCommandExecution = protocol.ItemKindCommandExecution ItemKindFileChange = protocol.ItemKindFileChange ItemKindMCPToolCall = protocol.ItemKindMCPToolCall ItemKindDynamicToolCall = protocol.ItemKindDynamicToolCall ItemKindCollabAgentToolCall = protocol.ItemKindCollabAgentToolCall ItemKindSubAgentActivity = protocol.ItemKindSubAgentActivity ItemKindWebSearch = protocol.ItemKindWebSearch ItemKindImageView = protocol.ItemKindImageView ItemKindSleep = protocol.ItemKindSleep ItemKindImageGeneration = protocol.ItemKindImageGeneration ItemKindEnteredReviewMode = protocol.ItemKindEnteredReviewMode ItemKindExitedReviewMode = protocol.ItemKindExitedReviewMode ItemKindContextCompaction = protocol.ItemKindContextCompaction )
Variables ¶
This section is empty.
Functions ¶
func FindBinary ¶
FindBinary returns the path to the codex binary, searching in order:
- CODEX_BIN env var (nharness convention)
- CODEX_CLI_PATH env var (official Python SDK convention)
- exec.LookPath("codex") in the system PATH
func IsHttpConnectionFailed ¶
IsHttpConnectionFailed reports whether err is a connection failure.
func IsInternalServerError ¶
IsInternalServerError reports whether err is an HTTP 500 from Codex.
func IsRateLimited ¶
IsRateLimited reports whether err is an HTTP 429 rate-limit error from Codex.
func IsUnauthorized ¶
IsUnauthorized reports whether err is an HTTP 401 authentication error.
func StreamText ¶
StreamText reads ThreadEvents from ch and writes agent message text deltas to w. It returns when ch is closed or ctx is done. Useful for printing streaming responses to a terminal or HTTP response writer.
Types ¶
type AccountInfo ¶
type AccountInfo struct {
Type string `json:"type"`
Email string `json:"email,omitempty"`
PlanType PlanType `json:"planType,omitempty"`
}
AccountInfo describes the currently authenticated account. The fields present depend on Type: "chatgpt" accounts carry Email and PlanType, while "apiKey" and "amazonBedrock" accounts only carry Type.
type AccountRateLimitsUpdatedEvent ¶
type AccountRateLimitsUpdatedEvent struct {
RateLimits json.RawMessage `json:"rateLimits,omitempty"`
}
type AccountReadResult ¶
type AccountReadResult struct {
Account *AccountInfo `json:"account,omitempty"`
RequiresOpenAIAuth bool `json:"requiresOpenaiAuth"`
}
AccountReadResult is the response to account/read.
type AccountUpdatedEvent ¶
type AppListUpdatedEvent ¶
type AppListUpdatedEvent struct {
Data json.RawMessage `json:"data,omitempty"`
}
type ApprovalDecision ¶
type ApprovalDecision = protocol.ApprovalDecision
type ApprovalHandler ¶
type ApprovalHandler interface {
HandleCommandExecutionApproval(context.Context, CommandExecutionApprovalRequest) (CommandExecutionApprovalResult, error)
HandleFileChangeApproval(context.Context, FileChangeApprovalRequest) (FileChangeApprovalResult, error)
HandlePermissionsApproval(context.Context, PermissionsApprovalRequest) (PermissionsApprovalResult, error)
HandleUserInputRequest(context.Context, UserInputRequest) (UserInputResult, error)
}
type ApprovalMode ¶
type ApprovalMode string
ApprovalMode is a typed approval policy for turns and threads. The string values match the wire values the app-server expects for approvalPolicy.
const ( ApprovalModeDenyAll ApprovalMode = "deny_all" ApprovalModeAutoReview ApprovalMode = "auto_review" ApprovalModeOnRequest ApprovalMode = "on-request" ApprovalModeNever ApprovalMode = "never" )
type AuthMode ¶
type AuthMode string
AuthMode is the authentication mode for OpenAI-backed providers.
type CancelLoginStatus ¶
type CancelLoginStatus string
CancelLoginStatus is the outcome of canceling an interactive login attempt.
const ( CancelLoginStatusCanceled CancelLoginStatus = "canceled" CancelLoginStatusNotFound CancelLoginStatus = "notFound" )
type Capabilities ¶
type Capabilities = schematypes.Capabilities
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) AccountRead ¶
func (c *Client) AccountRead(ctx context.Context) (AccountReadResult, error)
AccountRead returns the currently authenticated account, if any.
func (*Client) Call ¶
Call makes a raw JSON-RPC call and decodes the result into result. Exposed for integration tests that need to probe the binary's raw response format.
func (*Client) CommandExec ¶
func (c *Client) CommandExec(ctx context.Context, req CommandExecRequest) (CommandExecResult, error)
CommandExec starts an interactive command. For streaming runs subscribe to CommandExecOutputDeltaEvent via Events() before calling, then drive the process with the returned handle.
func (*Client) CommandExecHandle ¶
func (c *Client) CommandExecHandle(processID string) *CommandExecHandle
CommandExecHandle returns a handle for driving the process with the given ID.
func (*Client) CommandExecResize ¶
func (c *Client) CommandExecResize(ctx context.Context, req CommandExecResizeRequest) error
CommandExecResize resizes a running process's PTY.
func (*Client) CommandExecTerminate ¶
func (c *Client) CommandExecTerminate(ctx context.Context, req CommandExecTerminateRequest) error
CommandExecTerminate terminates a running process.
func (*Client) CommandExecWrite ¶
func (c *Client) CommandExecWrite(ctx context.Context, req CommandExecWriteRequest) error
CommandExecWrite writes stdin to (or closes stdin of) a running process.
func (*Client) ConfigBatchWrite ¶
func (c *Client) ConfigBatchWrite(ctx context.Context, req ConfigBatchWriteRequest) error
ConfigBatchWrite applies a batch of configuration edits.
func (*Client) ConfigRead ¶
func (c *Client) ConfigRead(ctx context.Context, req ConfigReadRequest) (ConfigReadResult, error)
ConfigRead returns the effective configuration. When IncludeLayers is set the per-layer breakdown and value origins are included.
func (*Client) ConfigValueWrite ¶
func (c *Client) ConfigValueWrite(ctx context.Context, req ConfigValueWriteRequest) error
ConfigValueWrite writes a single configuration value at the given key path.
func (*Client) Events ¶
func (c *Client) Events() *EventSubscription
func (*Client) ExperimentalFeatureEnablementSet ¶
func (c *Client) ExperimentalFeatureEnablementSet(ctx context.Context, req ExperimentalFeatureEnablementSetRequest) (ExperimentalFeatureEnablementSetResult, error)
ExperimentalFeatureEnablementSet enables or disables experimental features.
func (*Client) ExperimentalFeatureList ¶
func (c *Client) ExperimentalFeatureList(ctx context.Context, req ExperimentalFeatureListRequest) (ExperimentalFeatureListResult, error)
ExperimentalFeatureList returns a page of experimental features.
func (*Client) HooksList ¶
func (c *Client) HooksList(ctx context.Context, req HooksListRequest) (HooksListResult, error)
HooksList returns the configured lifecycle hooks discoverable from the given working directories.
func (*Client) Initialize ¶
func (c *Client) Initialize(ctx context.Context, req InitializeRequest) (InitializeResult, error)
func (*Client) LoginAPIKey ¶
LoginAPIKey authenticates the account with an OpenAI API key. This is a synchronous login: it completes as soon as the RPC returns successfully.
func (*Client) LoginChatGPT ¶
func (c *Client) LoginChatGPT(ctx context.Context) (*LoginHandle, error)
LoginChatGPT begins a browser-based ChatGPT OAuth login. It returns a LoginHandle whose AuthURL the caller should open in a browser; call handle.Wait to block until the login completes.
func (*Client) LoginDeviceCode ¶
func (c *Client) LoginDeviceCode(ctx context.Context) (*LoginHandle, error)
LoginDeviceCode begins a device-code ChatGPT login. It returns a LoginHandle whose VerificationURL and UserCode the caller should present to the user; call handle.Wait to block until the login completes.
func (*Client) ModelList ¶
ModelList returns the full model catalog from the server. When includeHidden is true, hidden models are included. Results are not cached.
func (*Client) ModelProviderCapabilitiesRead ¶
func (c *Client) ModelProviderCapabilitiesRead(ctx context.Context) (ModelProviderCapabilities, error)
ModelProviderCapabilitiesRead returns the capabilities the active model provider supports (namespaced tools, image generation, web search).
func (*Client) Models ¶
Models returns the sorted list of model IDs supported by the connected server. It is a convenience wrapper over ModelList that excludes hidden models and returns IDs only.
func (*Client) Ping ¶
Ping verifies the transport is responsive by listing threads with a limit of 1. Returns nil if the server responds within ctx's deadline, or an error otherwise.
func (*Client) ResumeThread ¶
func (c *Client) ResumeThread(ctx context.Context, threadID string, opts ...ThreadOption) (*SessionThread, error)
ResumeThread reconnects to an existing thread by ID and returns a stateful SessionThread.
func (*Client) ReviewStart ¶
func (c *Client) ReviewStart(ctx context.Context, req ReviewStartRequest) error
func (*Client) SetApprovalPolicy ¶
SetApprovalPolicy sends a config/update request that changes the approval policy.
func (*Client) SetSandbox ¶
SetSandbox sends a config/update request that changes the sandbox policy.
func (*Client) SkillsConfigWrite ¶
func (c *Client) SkillsConfigWrite(ctx context.Context, req SkillsConfigWriteRequest) (SkillsConfigWriteResult, error)
SkillsConfigWrite enables or disables a skill (by name or path) and returns the effective enabled state.
func (*Client) SkillsExtraRootsSet ¶
func (c *Client) SkillsExtraRootsSet(ctx context.Context, req SkillsExtraRootsSetRequest) error
SkillsExtraRootsSet sets additional filesystem roots scanned for skills.
func (*Client) SkillsList ¶
func (c *Client) SkillsList(ctx context.Context, req SkillsListRequest) (SkillsListResult, error)
SkillsList lists skills discoverable from the given working directories.
func (*Client) StartThread ¶
func (c *Client) StartThread(ctx context.Context, opts ...ThreadOption) (*SessionThread, error)
StartThread creates a new session thread on the server and returns a stateful SessionThread that can be used to run turns.
func (*Client) ThreadApproveGuardianDeniedAction ¶
func (c *Client) ThreadApproveGuardianDeniedAction(ctx context.Context, req ThreadApproveGuardianDeniedActionRequest) error
ThreadApproveGuardianDeniedAction approves a guardian-denied action.
func (*Client) ThreadArchive ¶
func (c *Client) ThreadArchive(ctx context.Context, req ThreadArchiveRequest) error
func (*Client) ThreadDelete ¶
func (c *Client) ThreadDelete(ctx context.Context, req ThreadDeleteRequest) error
ThreadDelete deletes a thread and its rollout history.
func (*Client) ThreadFork ¶
func (*Client) ThreadGoalClear ¶
func (c *Client) ThreadGoalClear(ctx context.Context, req ThreadGoalClearRequest) error
ThreadGoalClear removes the persisted goal for a thread.
func (*Client) ThreadGoalGet ¶
func (c *Client) ThreadGoalGet(ctx context.Context, req ThreadGoalGetRequest) (ThreadGoal, error)
ThreadGoalGet returns the persisted goal for a thread, or a zero ThreadGoal when none is set.
func (*Client) ThreadGoalSet ¶
func (c *Client) ThreadGoalSet(ctx context.Context, req ThreadGoalSetRequest) (ThreadGoal, error)
ThreadGoalSet creates or updates the persisted goal for a thread.
func (*Client) ThreadInjectItems ¶
func (c *Client) ThreadInjectItems(ctx context.Context, req ThreadInjectItemsRequest) error
ThreadInjectItems injects items into a thread's history.
func (*Client) ThreadList ¶
func (*Client) ThreadLoadedList ¶
ThreadLoadedList returns the IDs of threads currently loaded in the server's memory. Newly started threads appear here before they are persisted to disk.
func (*Client) ThreadMetadataUpdate ¶
func (c *Client) ThreadMetadataUpdate(ctx context.Context, req ThreadMetadataUpdateRequest) (ThreadMetadataUpdateResult, error)
ThreadMetadataUpdate patches a thread's stored metadata (e.g. Git info).
func (*Client) ThreadRead ¶
func (*Client) ThreadResume ¶
func (*Client) ThreadRollback ¶
func (c *Client) ThreadRollback(ctx context.Context, req ThreadRollbackRequest) error
func (*Client) ThreadSetName ¶
func (c *Client) ThreadSetName(ctx context.Context, req ThreadSetNameRequest) error
func (*Client) ThreadShellCommand ¶
func (c *Client) ThreadShellCommand(ctx context.Context, req ThreadShellCommandRequest) error
ThreadShellCommand runs a shell command string in the thread's shell.
func (*Client) ThreadStart ¶
func (*Client) ThreadUnarchive ¶
func (c *Client) ThreadUnarchive(ctx context.Context, req ThreadUnarchiveRequest) error
func (*Client) ThreadUnsubscribe ¶
func (c *Client) ThreadUnsubscribe(ctx context.Context, req ThreadUnsubscribeRequest) (ThreadUnsubscribeResult, error)
ThreadUnsubscribe stops event delivery for a thread on this connection.
func (*Client) TurnDiff ¶
func (c *Client) TurnDiff(ctx context.Context, req TurnDiffRequest) (TurnDiffResult, error)
func (*Client) TurnInterrupt ¶
func (c *Client) TurnInterrupt(ctx context.Context, req TurnInterruptRequest) error
func (*Client) TurnRead ¶
TurnRead returns the current state of a turn by ID. For a completed turn it includes items and usage; use WaitForFinalAgentMessage to wait until completion when the turn may still be in progress.
func (*Client) TurnSteer ¶
func (c *Client) TurnSteer(ctx context.Context, req TurnSteerRequest) error
func (*Client) WaitForFinalAgentMessage ¶
func (*Client) WaitForStructuredOutput ¶
type ClientInfo ¶
type ClientInfo = schematypes.ClientInfo
type CodexError ¶
type CodexError struct {
RPCCode int
RPCMessage string
ErrorType string // codexErrorInfo.type e.g. "HttpConnectionFailed"
HTTPStatusCode int // codexErrorInfo.httpStatusCode e.g. 429
AdditionalInfo string // additionalDetails
}
CodexError wraps an RPCError and exposes the structured codexErrorInfo payload.
func AsCodexError ¶
func AsCodexError(err error) (*CodexError, bool)
AsCodexError unwraps err into a *CodexError if the underlying cause is a transport.RPCError that carries a codexErrorInfo payload.
func (*CodexError) Error ¶
func (e *CodexError) Error() string
type CommandExecHandle ¶
type CommandExecHandle struct {
// contains filtered or unexported fields
}
CommandExecHandle is a convenience wrapper binding a processId to the write/resize/terminate operations for an interactive command.
func (*CommandExecHandle) CloseStdin ¶
func (h *CommandExecHandle) CloseStdin(ctx context.Context) error
CloseStdin closes the process's stdin.
func (*CommandExecHandle) ProcessID ¶
func (h *CommandExecHandle) ProcessID() string
ProcessID returns the bound process ID.
func (*CommandExecHandle) Resize ¶
func (h *CommandExecHandle) Resize(ctx context.Context, cols, rows int) error
Resize resizes the process's PTY.
type CommandExecOutputDeltaEvent ¶
type CommandExecOutputDeltaEvent struct {
ProcessID string `json:"processId,omitempty"`
Stream string `json:"stream,omitempty"`
DeltaBase64 string `json:"deltaBase64,omitempty"`
CapReached bool `json:"capReached,omitempty"`
}
CommandExecOutputDeltaEvent is a streaming output chunk from an interactive command/exec process (the command/exec/outputDelta notification). DeltaBase64 is the base64-encoded output for the given stream ("stdout" or "stderr").
type CommandExecRequest ¶
type CommandExecRequest struct {
Command []string `json:"command"`
CWD string `json:"cwd,omitempty"`
Env map[string]string `json:"env,omitempty"`
TTY bool `json:"tty,omitempty"`
Size *CommandExecTerminalSize `json:"size,omitempty"`
StreamStdin bool `json:"streamStdin,omitempty"`
StreamStdoutStderr bool `json:"streamStdoutStderr,omitempty"`
TimeoutMs int `json:"timeoutMs,omitempty"`
DisableTimeout bool `json:"disableTimeout,omitempty"`
OutputBytesCap int `json:"outputBytesCap,omitempty"`
DisableOutputCap bool `json:"disableOutputCap,omitempty"`
ProcessID string `json:"processId,omitempty"`
SandboxPolicy json.RawMessage `json:"sandboxPolicy,omitempty"`
}
CommandExecRequest starts an interactive command execution. Command is the argv slice. When ProcessID is empty the server assigns one (returned via the handle); pass an existing ProcessID to attach. SandboxPolicy is passed through as raw JSON.
type CommandExecResizeRequest ¶
type CommandExecResizeRequest struct {
ProcessID string `json:"processId"`
Size CommandExecTerminalSize `json:"size"`
}
CommandExecResizeRequest resizes a running process's PTY.
type CommandExecResult ¶
type CommandExecResult struct {
ExitCode int `json:"exitCode"`
Stdout string `json:"stdout"`
Stderr string `json:"stderr"`
}
CommandExecResult is the terminal result of a (non-streaming) command exec.
type CommandExecTerminalSize ¶
CommandExecTerminalSize is a PTY size in character cells.
type CommandExecTerminateRequest ¶
type CommandExecTerminateRequest struct {
ProcessID string `json:"processId"`
}
CommandExecTerminateRequest terminates a running process.
type CommandExecWriteRequest ¶
type CommandExecWriteRequest struct {
ProcessID string `json:"processId"`
DeltaBase64 string `json:"deltaBase64,omitempty"`
CloseStdin bool `json:"closeStdin,omitempty"`
}
CommandExecWriteRequest writes stdin bytes (base64) to a running process, or closes its stdin.
type CommandExecutionApprovalRequest ¶
type CommandExecutionApprovalRequest = protocol.CommandExecutionApprovalRequest
type CommandExecutionApprovalResult ¶
type CommandExecutionApprovalResult = protocol.CommandExecutionApprovalResponse
type CommandExecutionPayload ¶
type CommandExecutionPayload struct {
Command string `json:"command"`
ExitCode *int `json:"exitCode,omitempty"`
Stdout string `json:"stdout,omitempty"`
Stderr string `json:"stderr,omitempty"`
}
CommandExecutionPayload is the decoded payload for an ItemKindCommandExecution item.
func ItemAsCommandExecution ¶
func ItemAsCommandExecution(item Item) *CommandExecutionPayload
ItemAsCommandExecution attempts to decode the item payload as a CommandExecutionPayload. Returns nil if the item is not a commandExecution or decoding fails.
type ConfigBatchWriteRequest ¶
type ConfigBatchWriteRequest struct {
FilePath string `json:"filePath,omitempty"`
Edits json.RawMessage `json:"edits"`
ExpectedVersion string `json:"expectedVersion,omitempty"`
ReloadUserConfig bool `json:"reloadUserConfig,omitempty"`
}
ConfigBatchWriteRequest applies multiple edits atomically. Edits is the raw JSON array of edit objects as defined by the protocol.
type ConfigReadRequest ¶
type ConfigReadRequest struct {
CWD string `json:"cwd,omitempty"`
IncludeLayers bool `json:"includeLayers,omitempty"`
}
ConfigReadRequest reads the effective config (optionally with layer breakdown).
type ConfigReadResult ¶
type ConfigReadResult struct {
Config json.RawMessage `json:"config"`
Layers json.RawMessage `json:"layers,omitempty"`
Origins json.RawMessage `json:"origins,omitempty"`
}
ConfigReadResult holds the resolved config. The nested config, layers, and origins documents are passed through as raw JSON; decode them as needed.
type ConfigValueWriteRequest ¶
type ConfigValueWriteRequest struct {
FilePath string `json:"filePath,omitempty"`
KeyPath string `json:"keyPath"`
Value json.RawMessage `json:"value"`
MergeStrategy MergeStrategy `json:"mergeStrategy,omitempty"`
ExpectedVersion string `json:"expectedVersion,omitempty"`
}
ConfigValueWriteRequest writes a single value at a dotted key path.
type ConfigWarningEvent ¶
type ConfigWarningEvent struct {
Summary string `json:"summary"`
Details string `json:"details,omitempty"`
Path string `json:"path,omitempty"`
Range json.RawMessage `json:"range,omitempty"`
}
type DeprecationNoticeEvent ¶
type Dispatcher ¶
type Dispatcher struct {
// Exec handles "item/commandExecution/requestApproval" requests.
// If nil, such requests are denied.
Exec ExecApprovalHandler
// File handles "item/fileChange/requestApproval" requests.
// If nil, such requests are denied.
File FileApprovalHandler
// DynamicTool handles "item/tool/call" server-initiated requests.
// If nil, dynamic tool calls are answered with an empty content array.
DynamicTool DynamicToolHandler
// MCP handles "item/mcp/requestApproval" requests.
// If nil, such requests are declined.
MCP MCPApprovalHandler
// Fallback is consulted for any request method not matched by the above.
// If nil, unmatched requests return ErrUnsupportedServerRequest.
Fallback RequestHandler
}
Dispatcher routes incoming server requests to specialised handlers by method. Any method not handled by a registered handler is denied with a default response.
Dispatcher implements RequestHandler so it can be passed to WithRequestHandler.
func (*Dispatcher) HandleServerRequest ¶
func (d *Dispatcher) HandleServerRequest(ctx context.Context, req ServerRequest) (ServerResponse, error)
HandleServerRequest implements RequestHandler.
type DynamicToolCallRequest ¶
type DynamicToolCallRequest struct {
ToolName string `json:"toolName"`
ToolInput json.RawMessage `json:"input"`
ThreadID string `json:"threadId"`
TurnID string `json:"turnId"`
ItemID string `json:"itemId"`
}
DynamicToolCallRequest is the payload for an "item/tool/call" server-initiated request.
type DynamicToolCallResult ¶
type DynamicToolCallResult struct {
Content []json.RawMessage `json:"content"`
}
DynamicToolCallResult is the response to a DynamicToolCallRequest.
type DynamicToolHandler ¶
type DynamicToolHandler interface {
HandleDynamicToolCall(ctx context.Context, req DynamicToolCallRequest) (DynamicToolCallResult, error)
}
DynamicToolHandler handles dynamic tool call requests from the server.
type ErrorEvent ¶
type ErrorEvent = protocol.ErrorEvent
type Event ¶
type Event struct {
Method string
Raw json.RawMessage
Value any
}
Event is one server-push notification emitted by the app-server. Value is a concrete typed event struct when the method is recognized.
type EventSubscription ¶
type EventSubscription struct {
// contains filtered or unexported fields
}
func (*EventSubscription) C ¶
func (s *EventSubscription) C() <-chan Event
func (*EventSubscription) Close ¶
func (s *EventSubscription) Close()
type ExecApprovalHandler ¶
type ExecApprovalHandler interface {
HandleCommandExecutionApproval(context.Context, CommandExecutionApprovalRequest) (CommandExecutionApprovalResult, error)
}
ExecApprovalHandler handles command-execution approval requests.
type ExperimentalFeature ¶
type ExperimentalFeature struct {
Name string `json:"name"`
DisplayName string `json:"displayName,omitempty"`
Description string `json:"description,omitempty"`
Announcement string `json:"announcement,omitempty"`
Enabled bool `json:"enabled"`
DefaultEnabled bool `json:"defaultEnabled"`
Stage json.RawMessage `json:"stage,omitempty"`
}
ExperimentalFeature describes a single experimental feature flag.
type ExperimentalFeatureEnablementSetRequest ¶
type ExperimentalFeatureEnablementSetRequest struct {
Enablement map[string]bool `json:"enablement"`
}
ExperimentalFeatureEnablementSetRequest sets enablement for one or more features, keyed by feature name.
type ExperimentalFeatureEnablementSetResult ¶
type ExperimentalFeatureEnablementSetResult struct {
Enablement map[string]bool `json:"enablement"`
}
ExperimentalFeatureEnablementSetResult reports the resulting enablement map.
type ExperimentalFeatureListRequest ¶
type ExperimentalFeatureListRequest struct {
ThreadID string `json:"threadId,omitempty"`
Cursor string `json:"cursor,omitempty"`
Limit int `json:"limit,omitempty"`
}
ExperimentalFeatureListRequest lists experimental features. Cursor/Limit drive pagination; an empty NextCursor in the result indicates the final page.
type ExperimentalFeatureListResult ¶
type ExperimentalFeatureListResult struct {
Data []ExperimentalFeature `json:"data"`
NextCursor string `json:"nextCursor,omitempty"`
}
ExperimentalFeatureListResult is a page of experimental features.
type ExternalAgentConfigImportCompletedEvent ¶
type ExternalAgentConfigImportCompletedEvent struct {
ImportID string `json:"importId"`
ItemTypeResults json.RawMessage `json:"itemTypeResults,omitempty"`
}
type ExternalAgentConfigImportProgressEvent ¶
type ExternalAgentConfigImportProgressEvent struct {
ImportID string `json:"importId"`
ItemTypeResults json.RawMessage `json:"itemTypeResults,omitempty"`
}
type FileApprovalHandler ¶
type FileApprovalHandler interface {
HandleFileChangeApproval(context.Context, FileChangeApprovalRequest) (FileChangeApprovalResult, error)
}
FileApprovalHandler handles file-change approval requests.
type FileChangeApprovalRequest ¶
type FileChangeApprovalRequest = protocol.FileChangeApprovalRequest
type FileChangeApprovalResult ¶
type FileChangeApprovalResult = protocol.FileChangeApprovalResponse
type FileChangePayload ¶
type FileChangePayload struct {
FilePath string `json:"filePath"`
ChangeType string `json:"changeType"` // "create", "modify", "delete"
Diff string `json:"diff,omitempty"`
NewContent string `json:"newContent,omitempty"`
OldContent string `json:"oldContent,omitempty"`
}
FileChangePayload is the decoded payload for an ItemKindFileChange item.
func ItemAsFileChange ¶
func ItemAsFileChange(item Item) *FileChangePayload
ItemAsFileChange attempts to decode the item payload as a FileChangePayload. Returns nil if the item is not a fileChange or decoding fails.
type FsChangedEvent ¶
type GuardianWarningEvent ¶
type HookCompletedEvent ¶
type HookCompletedEvent struct {
ThreadID string `json:"threadId"`
TurnID string `json:"turnId,omitempty"`
Run json.RawMessage `json:"run,omitempty"`
}
type HookStartedEvent ¶
type HookStartedEvent struct {
ThreadID string `json:"threadId"`
TurnID string `json:"turnId,omitempty"`
Run json.RawMessage `json:"run,omitempty"`
}
type HooksListRequest ¶
type HooksListRequest struct {
CWDs []string `json:"cwds,omitempty"`
}
HooksListRequest lists configured lifecycle hooks for the given working directories. This is the server-side hooks/list RPC and is distinct from the client-side hook bridge (internal/hookbridge).
type HooksListResult ¶
type HooksListResult struct {
Data json.RawMessage `json:"data"`
}
HooksListResult holds the hooks listing. Data is passed through as raw JSON (an array of per-cwd hook entries) for forward compatibility.
type InitializeRequest ¶
type InitializeRequest = schematypes.InitializeRequest
type InitializeResult ¶
type InitializeResult = schematypes.InitializeResult
type ItemCompletedEvent ¶
type ItemCompletedEvent = protocol.ItemCompletedEvent
type ItemFileChangePatchUpdatedEvent ¶
type ItemFileChangePatchUpdatedEvent struct {
ThreadID string `json:"threadId,omitempty"`
TurnID string `json:"turnId,omitempty"`
ItemID string `json:"itemId,omitempty"`
Patch json.RawMessage `json:"patch,omitempty"`
}
type ItemPlanDeltaEvent ¶
type ItemReasoningSummaryPartAddedEvent ¶
type ItemReasoningSummaryPartAddedEvent struct {
ThreadID string `json:"threadId,omitempty"`
TurnID string `json:"turnId,omitempty"`
ItemID string `json:"itemId,omitempty"`
Part json.RawMessage `json:"part,omitempty"`
}
type ItemStartedEvent ¶
type ItemStartedEvent = protocol.ItemStartedEvent
type ItemUpdatedEvent ¶
type ItemUpdatedEvent = protocol.ItemUpdatedEvent
type LoginCompleted ¶
type LoginCompleted struct {
Success bool `json:"success"`
LoginID string `json:"loginId,omitempty"`
Error string `json:"error,omitempty"`
}
LoginCompleted is the payload of the account/login/completed notification.
type LoginHandle ¶
type LoginHandle struct {
// Type is the login flavor: "chatgpt" or "chatgptDeviceCode".
Type string
// LoginID identifies this attempt; it matches the loginId in the
// account/login/completed notification.
LoginID string
// AuthURL is the browser OAuth URL (chatgpt logins only).
AuthURL string
// VerificationURL is the device-code verification URL (device-code logins only).
VerificationURL string
// UserCode is the one-time code the user enters (device-code logins only).
UserCode string
// contains filtered or unexported fields
}
LoginHandle represents an in-flight interactive login attempt (ChatGPT OAuth or device code). The caller surfaces the URL/code fields to the user, then calls Wait to block until the matching account/login/completed notification arrives, or Cancel to abandon the attempt.
func (*LoginHandle) Cancel ¶
func (h *LoginHandle) Cancel(ctx context.Context) (CancelLoginStatus, error)
Cancel abandons this interactive login attempt.
func (*LoginHandle) Wait ¶
func (h *LoginHandle) Wait(ctx context.Context) (LoginCompleted, error)
Wait blocks until this login attempt completes (or ctx is done). It returns the completion payload; a failed login has Success=false and a non-empty Error.
type MCPApprovalHandler ¶
type MCPApprovalHandler interface {
HandleMCPToolCallApproval(ctx context.Context, req MCPToolCallApprovalRequest) (MCPToolCallApprovalResponse, error)
}
MCPApprovalHandler handles MCP tool call approval requests.
type MCPToolCallApprovalRequest ¶
type MCPToolCallApprovalRequest = protocol.MCPToolCallApprovalRequest
type MCPToolCallApprovalResponse ¶
type MCPToolCallApprovalResponse = protocol.MCPToolCallApprovalResponse
type MergeStrategy ¶
type MergeStrategy string
MergeStrategy controls how ConfigValueWrite merges a value into an existing key.
const ( // MergeStrategyReplace overwrites the existing value at the key path. MergeStrategyReplace MergeStrategy = "replace" // MergeStrategyUpsert merges into the existing value (e.g. table merge). MergeStrategyUpsert MergeStrategy = "upsert" )
type ModelInfo ¶
type ModelInfo struct {
ID string `json:"id"`
Model string `json:"model"`
DisplayName string `json:"displayName"`
Description string `json:"description"`
Hidden bool `json:"hidden"`
IsDefault bool `json:"isDefault"`
}
ModelInfo describes a single model entry from the server's model/list RPC.
type ModelProviderCapabilities ¶
type ModelProviderCapabilities struct {
NamespaceTools bool `json:"namespaceTools"`
ImageGeneration bool `json:"imageGeneration"`
WebSearch bool `json:"webSearch"`
}
ModelProviderCapabilities reports which provider-backed capabilities are available for the current session.
type ModelReroutedEvent ¶
type ModelVerificationEvent ¶
type ModelVerificationEvent struct {
ThreadID string `json:"threadId"`
TurnID string `json:"turnId"`
Verifications json.RawMessage `json:"verifications,omitempty"`
}
type Option ¶
type Option func(*clientConfig) error
func WithApprovalHandler ¶
func WithApprovalHandler(handler ApprovalHandler) Option
func WithAutoLogin ¶
WithAutoLogin authenticates the client with an OpenAI API key inside New(), immediately after the initialize handshake. It only takes effect when the client also performs auto-initialization (i.e. a real transport is wired up via WithTransport / WithStdioProcess / WithHTTPTransport / WithWSTransport).
func WithHTTPAPIKey ¶
WithHTTPAPIKey sets "X-API-Key: <key>" on HTTP transports constructed via WithHTTPTransport. It has no effect on a transport supplied through WithTransport.
func WithHTTPBearerToken ¶
WithHTTPBearerToken sets "Authorization: Bearer <token>" on HTTP transports constructed via WithHTTPTransport. It has no effect on a transport supplied through WithTransport.
func WithHTTPTransport ¶
WithHTTPTransport constructs an HTTP transport targeting baseURL, applying any auth configured via WithHTTPBearerToken / WithHTTPAPIKey. Any retry policy configured via WithRetry is applied in New() regardless of option ordering.
WIP: The Codex app-server speaks WebSocket only. This HTTP+SSE transport requires the ws-http-bridge sidecar (plugins/codex-server/ws-http-bridge) in front of the server; without it, requests fail with HTTP 405. Prefer WithWSTransport for direct connections until the bridge is generally deployed.
func WithMaxThreads ¶
WithMaxThreads sets the maximum number of concurrent live SessionThreads. Default is 64. Pass 0 to use the default; pass -1 for unlimited.
func WithProcessDir ¶
WithProcessDir sets the working directory for the subprocess spawned by WithStdioProcess. If empty, the current process's working directory is used.
func WithProcessEnv ¶
WithProcessEnv appends key=value to the subprocess environment. Only applies when used with WithStdioProcess. May be called multiple times; each call appends one variable.
func WithReconnectingHTTPTransport ¶
WithReconnectingHTTPTransport is like WithHTTPTransport but the SSE connection is automatically re-established if it drops. Any retry policy configured via WithRetry is applied in New() regardless of option ordering.
WIP: shares the HTTP+SSE transport that requires the ws-http-bridge sidecar. See WithHTTPTransport for details.
func WithReconnectingWSTransport ¶
WithReconnectingWSTransport is like WithWSTransport but automatically re-dials if the WebSocket connection drops. Any retry policy configured via WithRetry is applied in New() regardless of option ordering.
func WithRequestHandler ¶
func WithRequestHandler(handler RequestHandler) Option
func WithRetry ¶
func WithRetry(cfg transport.RetryConfig) Option
WithRetry records a retry policy applied when an HTTP/WS transport is constructed via WithHTTPTransport / WithWSTransport. A zero-value cfg uses DefaultRetryConfig(). Ordering relative to WithHTTPTransport / WithWSTransport does not matter; the policy is applied in New().
func WithStdioProcess ¶
WithStdioProcess spawns binaryPath with args as a managed subprocess and wires its stdin/stdout to a StdioTransport. The process is shut down (EOF → SIGTERM → SIGKILL) when the Client is closed.
func WithStdioTransport ¶
func WithStdioTransport(stdin io.ReadCloser, stdout io.WriteCloser) Option
func WithTransport ¶
func WithWSAPIKey ¶
WithWSAPIKey sets "X-API-Key: <key>" on WebSocket transports constructed via WithWSTransport. It has no effect on a transport supplied through WithTransport.
func WithWSBearerToken ¶
WithWSBearerToken sets "Authorization: Bearer <token>" on WebSocket transports constructed via WithWSTransport. It has no effect on a transport supplied through WithTransport.
type PermissionsApprovalRequest ¶
type PermissionsApprovalRequest = protocol.PermissionsApprovalRequest
type PermissionsApprovalResult ¶
type PermissionsApprovalResult = protocol.PermissionsApprovalResponse
type PlanType ¶
type PlanType string
PlanType is the ChatGPT subscription plan associated with an account.
const ( PlanTypeFree PlanType = "free" PlanTypeGo PlanType = "go" PlanTypePlus PlanType = "plus" PlanTypePro PlanType = "pro" PlanTypeProLite PlanType = "prolite" PlanTypeTeam PlanType = "team" PlanTypeSelfServeBusinessUsageBased PlanType = "self_serve_business_usage_based" PlanTypeBusiness PlanType = "business" PlanTypeEnterpriseCBPUsageBased PlanType = "enterprise_cbp_usage_based" PlanTypeEnterprise PlanType = "enterprise" PlanTypeEdu PlanType = "edu" PlanTypeUnknown PlanType = "unknown" )
type ProcessExitedEvent ¶
type ProcessExitedEvent struct {
ProcessHandle string `json:"processHandle"`
ExitCode int `json:"exitCode"`
Stdout string `json:"stdout,omitempty"`
StdoutCapReached bool `json:"stdoutCapReached,omitempty"`
Stderr string `json:"stderr,omitempty"`
StderrCapReached bool `json:"stderrCapReached,omitempty"`
}
type ProcessOutputDeltaEvent ¶
type RawNotificationEvent ¶
type RawResponseItemCompletedEvent ¶
type RawResponseItemCompletedEvent struct {
ThreadID string `json:"threadId"`
TurnID string `json:"turnId"`
Item json.RawMessage `json:"item,omitempty"`
}
type RequestHandler ¶
type RequestHandler interface {
HandleServerRequest(context.Context, ServerRequest) (ServerResponse, error)
}
type RequestHandlerFunc ¶
type RequestHandlerFunc func(context.Context, ServerRequest) (ServerResponse, error)
func (RequestHandlerFunc) HandleServerRequest ¶
func (f RequestHandlerFunc) HandleServerRequest(ctx context.Context, req ServerRequest) (ServerResponse, error)
type ReviewStartRequest ¶
type ReviewStartRequest = schematypes.ReviewStartRequest
type SandboxMode ¶
type SandboxMode string
SandboxMode is a typed sandbox policy for turns. The string values match the wire values the app-server expects for sandboxPolicy.
const ( SandboxReadOnly SandboxMode = "read-only" SandboxWorkspaceWrite SandboxMode = "workspace-write" SandboxFullAccess SandboxMode = "danger-full-access" )
type ServerRequest ¶
type ServerRequest = protocol.ServerRequest
type ServerRequestResolvedEvent ¶
type ServerRequestResolvedEvent = protocol.ServerRequestResolvedEvent
type ServerResponse ¶
type ServerResponse = protocol.ServerResponse
type SessionThread ¶
type SessionThread struct {
// contains filtered or unexported fields
}
SessionThread represents a live, stateful session on the Codex app-server. Use Client.StartThread / Client.ResumeThread to obtain one.
func (*SessionThread) Archive ¶
func (t *SessionThread) Archive(ctx context.Context) error
Archive marks this thread as archived.
func (*SessionThread) ClearGoal ¶
func (t *SessionThread) ClearGoal(ctx context.Context) error
ClearGoal removes the persisted goal for this thread.
func (*SessionThread) Close ¶
func (t *SessionThread) Close()
Close releases the semaphore slot held by this SessionThread, allowing a new thread to be started if the client is at its maxThreads limit. Close is idempotent and safe to call from multiple goroutines.
func (*SessionThread) Compact ¶
func (t *SessionThread) Compact(ctx context.Context) error
Compact sends a thread/compact request to trigger context compaction.
func (*SessionThread) Fork ¶
func (t *SessionThread) Fork(ctx context.Context, turnID string, opts ...ThreadOption) (*SessionThread, error)
Fork creates a new thread branching from this thread at the given turnID. If turnID is empty the server forks from the latest turn.
func (*SessionThread) GetGoal ¶
func (t *SessionThread) GetGoal(ctx context.Context) (ThreadGoal, error)
GetGoal returns the persisted goal for this thread, or a zero ThreadGoal when none is set.
func (*SessionThread) GitDiff ¶
GitDiff requests the diff for the latest (or specified) turn on this thread. Returns the unified diff string.
func (*SessionThread) ID ¶
func (t *SessionThread) ID() string
ID returns the thread's persistent ID.
func (*SessionThread) Interrupt ¶
func (t *SessionThread) Interrupt(ctx context.Context, turnID string) error
Interrupt sends a turn/interrupt for the given turnID.
func (*SessionThread) Rollback ¶
func (t *SessionThread) Rollback(ctx context.Context, turnIDs []string) error
Rollback removes the specified turns from this thread's history.
func (*SessionThread) Run ¶
func (t *SessionThread) Run(ctx context.Context, input string, opts ...TurnOption) (*TurnResult, error)
Run executes a prompt synchronously and returns the completed TurnResult. It blocks until the turn reaches a terminal state (completed/failed/interrupted) or ctx is cancelled.
The subscription to server events is established before TurnStart is called so that item/completed and turn/completed notifications are never missed, even on fast (mock) servers where events fire before TurnStart returns.
func (*SessionThread) RunStreamed ¶
func (t *SessionThread) RunStreamed(ctx context.Context, input string, opts ...TurnOption) (<-chan ThreadEvent, error)
RunStreamed executes a prompt and streams events over the returned channel. The channel is closed when the turn completes or errors. The caller must drain the channel to avoid blocking the event broker.
Concurrency: RunStreamed acquires an internal turn mutex that prevents two turns from running concurrently on the same SessionThread. The mutex is held for the entire stream duration and is released only when the goroutine exits — either because a terminal event (turn/completed or error) was received, or because ctx was cancelled. Callers MUST cancel the context (or fully drain the channel until it is closed) to ensure the lock is released if they stop consuming events before the stream ends.
func (*SessionThread) SetGoal ¶
func (t *SessionThread) SetGoal(ctx context.Context, goal string) error
SetGoal creates or updates the persisted goal (objective) for this thread.
func (*SessionThread) SetName ¶
func (t *SessionThread) SetName(ctx context.Context, name string) error
SetName sets the display name for this thread.
func (*SessionThread) Steer ¶
func (t *SessionThread) Steer(ctx context.Context, turnID, input string) error
Steer sends additional input to an in-progress turn (mid-turn steering). Only valid while a turn is active. Does not require the turn mutex because steering is sent to an already-running turn, not starting a new one.
func (*SessionThread) SteerInputs ¶
SteerInputs sends typed multi-part input to an in-progress turn, mirroring Steer but accepting TurnInput items instead of a plain string.
type SkillErrorInfo ¶
type SkillErrorInfo = schematypes.SkillErrorInfo
SkillErrorInfo describes a skill discovery error.
type SkillMetadata ¶
type SkillMetadata = schematypes.SkillMetadata
SkillMetadata describes a single discovered skill.
type SkillsChangedEvent ¶
type SkillsConfigWriteRequest ¶
type SkillsConfigWriteRequest = schematypes.SkillsConfigWriteParams
type SkillsConfigWriteResult ¶
type SkillsConfigWriteResult = schematypes.SkillsConfigWriteResponse
type SkillsExtraRootsSetRequest ¶
type SkillsExtraRootsSetRequest = schematypes.SkillsExtraRootsSetParams
type SkillsListEntry ¶
type SkillsListEntry = schematypes.SkillsListEntry
SkillsListEntry is the per-cwd skills listing.
type SkillsListRequest ¶
type SkillsListRequest = schematypes.SkillsListParams
type SkillsListResult ¶
type SkillsListResult = schematypes.SkillsListResponse
type ThreadActiveFlag ¶
type ThreadActiveFlag = protocol.ThreadActiveFlag
type ThreadApproveGuardianDeniedActionRequest ¶
type ThreadApproveGuardianDeniedActionRequest struct {
ThreadID string `json:"threadId"`
Event json.RawMessage `json:"event"`
}
ThreadApproveGuardianDeniedActionRequest approves an action the guardian reviewer denied. Event is the raw guardian event payload.
type ThreadArchiveRequest ¶
type ThreadArchiveRequest = schematypes.ThreadArchiveRequest
type ThreadArchivedEvent ¶
type ThreadArchivedEvent = protocol.ThreadArchivedEvent
type ThreadClosedEvent ¶
type ThreadClosedEvent = protocol.ThreadClosedEvent
type ThreadCompactedEvent ¶
type ThreadCompactedEvent struct {
ThreadID string `json:"threadId"`
TurnID string `json:"turnId"`
}
ThreadCompactedEvent is the thread/compacted (context compaction) notification.
type ThreadDeleteRequest ¶
type ThreadDeleteRequest struct {
ThreadID string `json:"threadId"`
}
ThreadDeleteRequest deletes a thread and its rollout history.
type ThreadDeletedEvent ¶
type ThreadDeletedEvent struct {
ThreadID string `json:"threadId"`
}
type ThreadEvent ¶
ThreadEvent wraps any event that can appear on the streaming channel returned by SessionThread.RunStreamed.
Kind is the JSON-RPC notification method name (e.g. "turn/started"). Raw holds the concrete typed event value (one of the *Event structs in this package); callers can type-switch on Raw to access strongly-typed fields.
type ThreadForkRequest ¶
type ThreadForkRequest = schematypes.ThreadForkRequest
type ThreadGoal ¶
type ThreadGoal = schematypes.ThreadGoal
type ThreadGoalClearRequest ¶
type ThreadGoalClearRequest = schematypes.ThreadGoalClearParams
type ThreadGoalClearedEvent ¶
type ThreadGoalClearedEvent = protocol.ThreadGoalClearedEvent
type ThreadGoalGetRequest ¶
type ThreadGoalGetRequest = schematypes.ThreadGoalGetParams
type ThreadGoalSetRequest ¶
type ThreadGoalSetRequest = schematypes.ThreadGoalSetParams
type ThreadGoalSetResult ¶
type ThreadGoalSetResult = schematypes.ThreadGoalSetResponse
type ThreadGoalStatus ¶
type ThreadGoalStatus = schematypes.ThreadGoalStatus
type ThreadGoalUpdatedEvent ¶
type ThreadGoalUpdatedEvent = protocol.ThreadGoalUpdatedEvent
type ThreadInjectItemsRequest ¶
type ThreadInjectItemsRequest struct {
ThreadID string `json:"threadId"`
Items []json.RawMessage `json:"items"`
}
ThreadInjectItemsRequest injects raw items into a thread's history. Each item is the raw JSON of a thread item as defined by the protocol.
type ThreadListRequest ¶
type ThreadListRequest = schematypes.ThreadListRequest
type ThreadMetadataGitInfo ¶
type ThreadMetadataGitInfo struct {
Branch *string `json:"branch,omitempty"`
OriginURL *string `json:"originUrl,omitempty"`
Sha *string `json:"sha,omitempty"`
}
ThreadMetadataGitInfo patches stored Git metadata for a thread. A nil field is left unchanged; set a pointer to an empty string to clear it.
type ThreadMetadataUpdateRequest ¶
type ThreadMetadataUpdateRequest struct {
ThreadID string `json:"threadId"`
GitInfo *ThreadMetadataGitInfo `json:"gitInfo,omitempty"`
}
ThreadMetadataUpdateRequest patches a thread's stored metadata.
type ThreadMetadataUpdateResult ¶
type ThreadMetadataUpdateResult struct {
Thread Thread `json:"thread"`
}
ThreadMetadataUpdateResult holds the updated thread.
type ThreadNameUpdatedEvent ¶
type ThreadOption ¶
type ThreadOption func(*threadConfig)
ThreadOption is a functional option for configuring a new or resumed thread.
func WithInitialInput ¶
func WithInitialInput(input string) ThreadOption
WithInitialInput sets a prompt to run immediately after the thread starts. If set, StartThread / ResumeThread return only after the first turn completes.
func WithThreadApprovalMode ¶
func WithThreadApprovalMode(mode ApprovalMode) ThreadOption
WithThreadApprovalMode sets a typed approval policy when starting a thread.
func WithThreadApprovalPolicy ¶
func WithThreadApprovalPolicy(policy string) ThreadOption
WithThreadApprovalPolicy sets the approval policy when starting a thread.
func WithThreadCWD ¶
func WithThreadCWD(cwd string) ThreadOption
WithThreadCWD sets the working directory when starting a thread.
func WithThreadEphemeral ¶
func WithThreadEphemeral(ephemeral bool) ThreadOption
WithThreadEphemeral marks the thread as ephemeral.
func WithThreadModel ¶
func WithThreadModel(model string) ThreadOption
WithThreadModel sets the model when starting a thread.
type ThreadReadRequest ¶
type ThreadReadRequest = schematypes.ThreadReadRequest
type ThreadRealtimeItemAddedEvent ¶
type ThreadRealtimeItemAddedEvent struct {
ThreadID string `json:"threadId"`
Item json.RawMessage `json:"item,omitempty"`
}
type ThreadRealtimeOutputAudioDeltaEvent ¶
type ThreadRealtimeOutputAudioDeltaEvent struct {
ThreadID string `json:"threadId"`
Audio json.RawMessage `json:"audio,omitempty"`
}
type ThreadRealtimeSdpEvent ¶
type ThreadResumeRequest ¶
type ThreadResumeRequest = schematypes.ThreadResumeRequest
type ThreadRollbackRequest ¶
type ThreadRollbackRequest = schematypes.ThreadRollbackRequest
type ThreadSetNameRequest ¶
type ThreadSetNameRequest = schematypes.ThreadSetNameRequest
type ThreadSettingsUpdatedEvent ¶
type ThreadSettingsUpdatedEvent struct {
ThreadID string `json:"threadId"`
ThreadSettings json.RawMessage `json:"threadSettings,omitempty"`
}
type ThreadShellCommandRequest ¶
type ThreadShellCommandRequest struct {
ThreadID string `json:"threadId"`
Command string `json:"command"`
}
ThreadShellCommandRequest runs a shell command string in the thread's shell. Unlike CommandExec this preserves shell syntax (pipes, redirects, quoting) and runs unsandboxed with full access.
type ThreadStartRequest ¶
type ThreadStartRequest = schematypes.ThreadStartRequest
type ThreadStartedEvent ¶
type ThreadStartedEvent = protocol.ThreadStartedEvent
type ThreadStatus ¶
type ThreadStatus = protocol.ThreadStatus
type ThreadStatusChangedEvent ¶
type ThreadStatusChangedEvent = protocol.ThreadStatusChangedEvent
type ThreadTokenUsageUpdatedEvent ¶
type ThreadTokenUsageUpdatedEvent = protocol.ThreadTokenUsageUpdatedEvent
type ThreadUnarchiveRequest ¶
type ThreadUnarchiveRequest = schematypes.ThreadUnarchiveRequest
type ThreadUnarchivedEvent ¶
type ThreadUnarchivedEvent = protocol.ThreadUnarchivedEvent
type ThreadUnsubscribeRequest ¶
type ThreadUnsubscribeRequest struct {
ThreadID string `json:"threadId"`
}
ThreadUnsubscribeRequest stops event delivery for a thread on this connection.
type ThreadUnsubscribeResult ¶
type ThreadUnsubscribeResult struct {
Status ThreadUnsubscribeStatus `json:"status"`
}
ThreadUnsubscribeResult reports the unsubscribe status.
type ThreadUnsubscribeStatus ¶
type ThreadUnsubscribeStatus string
ThreadUnsubscribeStatus reports the outcome of an unsubscribe request.
const ( ThreadUnsubscribeStatusNotLoaded ThreadUnsubscribeStatus = "notLoaded" ThreadUnsubscribeStatusNotSubscribed ThreadUnsubscribeStatus = "notSubscribed" ThreadUnsubscribeStatusUnsubscribed ThreadUnsubscribeStatus = "unsubscribed" )
type TokenUsage ¶
type TokenUsage = protocol.TokenUsage
type Transport ¶
type Transport interface {
Call(context.Context, string, any, any) error
Notify(context.Context, string, any) error
SetRequestHandler(RequestHandler)
Close() error
}
func NewStdioTransport ¶
func NewStdioTransport(stdin io.ReadCloser, stdout io.WriteCloser) Transport
type TurnCompletedEvent ¶
type TurnCompletedEvent = protocol.TurnCompletedEvent
type TurnDiffRequest ¶
type TurnDiffRequest = schematypes.TurnDiffRequest
type TurnDiffResult ¶
type TurnDiffResult = schematypes.TurnDiffResult
type TurnDiffUpdatedEvent ¶
type TurnDiffUpdatedEvent = protocol.TurnDiffUpdatedEvent
type TurnInput ¶
TurnInput is a single typed input item for a turn or steer request. Construct values with TextInput, ImageInput, LocalImageInput, SkillInput, or MentionInput. Each serializes to the multi-part wire shape the app-server expects.
func ImageInput ¶
ImageInput references a remote image by URL: {"type":"image","url":...}. mediaType is optional; when non-empty it is sent as "mediaType".
func LocalImageInput ¶
LocalImageInput reads the file at path synchronously, base64-encodes it, and produces an image input carrying a data: URI. The media type is inferred from the file extension, defaulting to application/octet-stream.
func MentionInput ¶
MentionInput references an @mention resource: {"type":"mention","id":...,"text":...}.
func SkillInput ¶
SkillInput references a named skill: {"type":"skill","name":...}.
type TurnInterruptRequest ¶
type TurnInterruptRequest = schematypes.TurnInterruptRequest
type TurnItemsView ¶
type TurnItemsView = protocol.TurnItemsView
type TurnModerationMetadataEvent ¶
type TurnModerationMetadataEvent struct {
ThreadID string `json:"threadId"`
TurnID string `json:"turnId"`
Metadata json.RawMessage `json:"metadata,omitempty"`
}
type TurnOption ¶
type TurnOption func(*TurnStartRequest)
TurnOption is a functional option that configures a TurnStartRequest.
func WithApprovalMode ¶
func WithApprovalMode(mode ApprovalMode) TurnOption
WithApprovalMode sets a typed approval policy for the turn.
func WithApprovalPolicy ¶
func WithApprovalPolicy(policy string) TurnOption
WithApprovalPolicy sets the approval policy for the turn.
func WithEffort ¶
func WithEffort(effort string) TurnOption
WithEffort sets the effort level for the turn.
func WithInputs ¶
func WithInputs(inputs ...TurnInput) TurnOption
WithInputs sets typed multi-part inputs for the turn, replacing any plain string input. Use TextInput, ImageInput, LocalImageInput, SkillInput, and MentionInput to construct the items.
func WithSandbox ¶
func WithSandbox(sandbox string) TurnOption
WithSandbox sets the sandbox policy for the turn.
func WithSandboxMode ¶
func WithSandboxMode(mode SandboxMode) TurnOption
WithSandboxMode sets a typed sandbox policy for the turn.
func WithSkill ¶
func WithSkill(skill string) TurnOption
WithSkill sets a specific skill to invoke for this turn.
type TurnPlanUpdatedEvent ¶
type TurnPlanUpdatedEvent = protocol.TurnPlanUpdatedEvent
type TurnResult ¶
type TurnResult struct {
// Turn is the final Turn data as returned by the server.
Turn Turn
// Items accumulates all items observed during the turn via streaming events.
Items []Item
// Usage is the token-usage snapshot from the TurnCompleted event, if present.
Usage *TokenUsage
// Error is the structured error from the TurnCompleted event, if any.
Error *TurnError
// DeltaText holds agent-message text reconstructed from streaming delta events.
// It is only set when Items carry no extractable agent text.
DeltaText string
}
TurnResult holds the outcome of a completed turn.
func (*TurnResult) FinalAgentText ¶
func (r *TurnResult) FinalAgentText() string
FinalAgentText returns the text of the last agent-message item in the result. It searches Items, Turn.Items, and finally DeltaText (reconstructed from streaming delta events). Returns "" if no agent message is found.
type TurnStartRequest ¶
type TurnStartRequest = schematypes.TurnStartRequest
type TurnStartedEvent ¶
type TurnStartedEvent = protocol.TurnStartedEvent
type TurnStatus ¶
type TurnStatus = protocol.TurnStatus
type TurnSteerRequest ¶
type TurnSteerRequest = schematypes.TurnSteerRequest
type UserInputOption ¶
type UserInputOption = protocol.UserInputOption
type UserInputQuestion ¶
type UserInputQuestion = protocol.UserInputQuestion
type UserInputRequest ¶
type UserInputRequest = protocol.UserInputRequest
type UserInputResult ¶
type UserInputResult = protocol.UserInputResult
type WarningEvent ¶
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
codex-sdk-hook-shim
command
codex-sdk-hook-shim bridges a Codex hook invocation to a hookbridge.Listener via a Unix domain socket.
|
codex-sdk-hook-shim bridges a Codex hook invocation to a hookbridge.Listener via a Unix domain socket. |
|
examples
|
|
|
simple
command
simple demonstrates basic usage of the codex-go SDK: finding the codex binary, creating a client, starting a thread, and running a prompt.
|
simple demonstrates basic usage of the codex-go SDK: finding the codex binary, creating a client, starting a thread, and running a prompt. |
|
internal
|
|
|
hookbridge
Package hookbridge implements a Unix-domain socket server that receives Codex hook callbacks (PreToolUse, PostToolUse, SessionStart) and dispatches them to a registered Go Handler.
|
Package hookbridge implements a Unix-domain socket server that receives Codex hook callbacks (PreToolUse, PostToolUse, SessionStart) and dispatches them to a registered Go Handler. |
|
jsonx
Package jsonx holds dependency-free helpers for extracting text and JSON candidates from loosely-typed payloads.
|
Package jsonx holds dependency-free helpers for extracting text and JSON candidates from loosely-typed payloads. |
|
protocol/schema
Code generated from sdk/codex-go/internal/protocol/schema/v2.schema.json.
|
Code generated from sdk/codex-go/internal/protocol/schema/v2.schema.json. |
|
testutil
Package testutil provides a lightweight mock JSON-RPC 2.0 server for use in SDK integration tests.
|
Package testutil provides a lightweight mock JSON-RPC 2.0 server for use in SDK integration tests. |