Documentation
¶
Index ¶
- Variables
- func SessionIDFromContext(ctx context.Context) string
- type AppServerProxyHandler
- type ChatKitAdapter
- type ChatKitAdapterOptions
- type Client
- type ExecuteApprovalHTTPHandler
- type ExecuteApprovalManager
- type NotebookMCPBridge
- type PendingExecuteApproval
- type ProcessManager
- func (p *ProcessManager) CallRaw(ctx context.Context, method string, params any, ...) (json.RawMessage, error)
- func (p *ProcessManager) ConfigureSession(ctx context.Context, cfg SessionConfig) error
- func (p *ProcessManager) EnsureStarted(ctx context.Context) error
- func (p *ProcessManager) InitializeResult() json.RawMessage
- func (p *ProcessManager) Interrupt(ctx context.Context, sessionID, threadID string) error
- func (p *ProcessManager) MarshalSessionConfig(cfg SessionConfig) ([]byte, error)
- func (p *ProcessManager) RunTurn(ctx context.Context, req TurnRequest) (*TurnResponse, error)
- func (p *ProcessManager) StdIO() (io.WriteCloser, io.ReadCloser, io.ReadCloser, error)
- func (p *ProcessManager) Stop(ctx context.Context) error
- type SessionConfig
- type SessionTokenManager
- type StreamableMCPHandler
- type ToolBridge
- type TurnEvent
- type TurnRequest
- type TurnResponse
Constants ¶
This section is empty.
Variables ¶
var ( ErrBridgeClosed = errors.New("codex bridge websocket closed") )
Functions ¶
func SessionIDFromContext ¶
SessionIDFromContext returns the session id authenticated for an MCP HTTP request.
Types ¶
type AppServerProxyHandler ¶
type AppServerProxyHandler struct {
// contains filtered or unexported fields
}
func NewAppServerProxyHandler ¶
func NewAppServerProxyHandler(processManager proxyProcessManager, tokenManager proxyTokenManager, auth *iam.AuthContext) (*AppServerProxyHandler, error)
func (*AppServerProxyHandler) ServeHTTP ¶
func (h *AppServerProxyHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
type ChatKitAdapter ¶
type ChatKitAdapter struct {
// contains filtered or unexported fields
}
func NewChatKitAdapter ¶
func NewChatKitAdapter(opts ChatKitAdapterOptions) *ChatKitAdapter
func (*ChatKitAdapter) Handle ¶
func (h *ChatKitAdapter) Handle(w http.ResponseWriter, r *http.Request)
func (*ChatKitAdapter) PrepareSessionToken ¶
PrepareSessionToken returns the long-lived MCP token used by the managed codex app-server.
type ChatKitAdapterOptions ¶
type ChatKitAdapterOptions struct {
Fallback http.Handler
ProcessManager codexProcessManager
TokenManager *SessionTokenManager
}
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a minimal JSON-RPC 2.0 client over io.Reader/io.Writer. It serializes calls to preserve request/response ordering on plain stdio streams.
type ExecuteApprovalHTTPHandler ¶
type ExecuteApprovalHTTPHandler struct {
// contains filtered or unexported fields
}
func NewExecuteApprovalHTTPHandler ¶
func NewExecuteApprovalHTTPHandler(manager *ExecuteApprovalManager) *ExecuteApprovalHTTPHandler
func (*ExecuteApprovalHTTPHandler) ServeHTTP ¶
func (h *ExecuteApprovalHTTPHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
type ExecuteApprovalManager ¶
type ExecuteApprovalManager struct {
// contains filtered or unexported fields
}
func NewExecuteApprovalManager ¶
func NewExecuteApprovalManager(ttl time.Duration) *ExecuteApprovalManager
func (*ExecuteApprovalManager) Approve ¶
func (m *ExecuteApprovalManager) Approve(sessionID string, refIDs []string) error
func (*ExecuteApprovalManager) ListPending ¶
func (m *ExecuteApprovalManager) ListPending(sessionID string) []PendingExecuteApproval
func (*ExecuteApprovalManager) RequireApproval ¶
func (m *ExecuteApprovalManager) RequireApproval(sessionID string, refIDs []string) error
type NotebookMCPBridge ¶
type NotebookMCPBridge struct {
// contains filtered or unexported fields
}
func NewNotebookMCPBridge ¶
func NewNotebookMCPBridge(bridge bridgeCaller) *NotebookMCPBridge
func (*NotebookMCPBridge) NewServer ¶
func (b *NotebookMCPBridge) NewServer() *mcpserver.MCPServer
func (*NotebookMCPBridge) SetCallTimeout ¶
func (b *NotebookMCPBridge) SetCallTimeout(timeout time.Duration)
func (*NotebookMCPBridge) SetExecuteApprover ¶
func (b *NotebookMCPBridge) SetExecuteApprover(approver executeApprover)
type PendingExecuteApproval ¶
type ProcessManager ¶
type ProcessManager struct {
// contains filtered or unexported fields
}
func NewProcessManager ¶
func NewProcessManager(command string, args []string, env []string) *ProcessManager
func (*ProcessManager) CallRaw ¶
func (p *ProcessManager) CallRaw( ctx context.Context, method string, params any, onNotification func(jsonRPCNotification) error, ) (json.RawMessage, error)
func (*ProcessManager) ConfigureSession ¶
func (p *ProcessManager) ConfigureSession(ctx context.Context, cfg SessionConfig) error
func (*ProcessManager) EnsureStarted ¶
func (p *ProcessManager) EnsureStarted(ctx context.Context) error
func (*ProcessManager) InitializeResult ¶
func (p *ProcessManager) InitializeResult() json.RawMessage
func (*ProcessManager) Interrupt ¶
func (p *ProcessManager) Interrupt(ctx context.Context, sessionID, threadID string) error
func (*ProcessManager) MarshalSessionConfig ¶
func (p *ProcessManager) MarshalSessionConfig(cfg SessionConfig) ([]byte, error)
func (*ProcessManager) RunTurn ¶
func (p *ProcessManager) RunTurn(ctx context.Context, req TurnRequest) (*TurnResponse, error)
func (*ProcessManager) StdIO ¶
func (p *ProcessManager) StdIO() (io.WriteCloser, io.ReadCloser, io.ReadCloser, error)
type SessionConfig ¶
type SessionTokenManager ¶
type SessionTokenManager struct {
// contains filtered or unexported fields
}
SessionTokenManager mints and validates MCP bearer tokens for a codex app-server instance. The same token is reused across requests so Codex does not need token refresh or per-thread auth state.
func NewSessionTokenManager ¶
func NewSessionTokenManager(ttl time.Duration) *SessionTokenManager
func (*SessionTokenManager) Issue ¶
func (m *SessionTokenManager) Issue() (string, error)
type StreamableMCPHandler ¶
type StreamableMCPHandler struct {
// contains filtered or unexported fields
}
func NewStreamableMCPHandler ¶
func NewStreamableMCPHandler(bridge *ToolBridge, tokens *SessionTokenManager, approvals *ExecuteApprovalManager) (*StreamableMCPHandler, error)
func (*StreamableMCPHandler) ServeHTTP ¶
func (h *StreamableMCPHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
type ToolBridge ¶
type ToolBridge struct {
// contains filtered or unexported fields
}
func NewToolBridge ¶
func NewToolBridge(auth *iam.AuthContext) *ToolBridge
func (*ToolBridge) Call ¶
func (b *ToolBridge) Call(ctx context.Context, input *toolsv1.ToolCallInput) (*toolsv1.ToolCallOutput, error)
Call dispatches a notebook tool call request over the active websocket and waits for the response.
func (*ToolBridge) HandleWebsocket ¶
func (b *ToolBridge) HandleWebsocket(w http.ResponseWriter, r *http.Request)
HandleWebsocket upgrades and handles the singleton codex bridge websocket.
func (*ToolBridge) Shutdown ¶
func (b *ToolBridge) Shutdown()
Shutdown closes the active websocket connection and fails all pending tool calls.
type TurnRequest ¶
type TurnRequest struct {
SessionID string
ThreadID string
PreviousResponseID string
Input *chatkit.UserMessageInput
ToolOutput *toolsv1.ToolCallOutput
}