Documentation
¶
Overview ¶
Package oplog publishes per-call operation records from codex-app-gateway to agentserver's /internal/operations POST endpoint. Submit is async and fire-and-forget; tool calls never block on log delivery.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func TryHandleOperationsList ¶
func TryHandleOperationsList( ctx context.Context, lc *ListClient, workspaceID string, frame []byte, ) ([]byte, bool)
TryHandleOperationsList inspects a client→server frame. If it's an `operations/list` JSON-RPC request, it forwards the filters to agentserver via the ListClient and returns a complete JSON-RPC response frame to send back to the client (ok=true). For any other frame, returns (nil, false) — caller forwards the frame normally.
Designed to be called from the gateway's outbound proxy path so the request never reaches the codex app-server (which has no operations/list method).
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client posts Operations to agentserver. Submit is non-blocking; one background goroutine drains a bounded channel and POSTs each one.
func NewClient ¶
NewClient starts the background drainer immediately. Capacity bounds how many Operations can queue before Submit starts dropping.
func (*Client) Close ¶
func (c *Client) Close()
Close stops the drainer. Already-queued ops are abandoned.
type Config ¶
type Config struct {
Source string // "sdk" | "tui"
WorkspaceID string // pinned from the ws Identity
ArgsMaxBytes int // 0 -> 64 KiB
ResultMaxBytes int // 0 -> 4 KiB
}
Config tunes the Interceptor at construction.
type Interceptor ¶
type Interceptor struct {
// contains filtered or unexported fields
}
Interceptor parses JSON-RPC frames as they cross the ws bridge. On a matched request+response for mcpServer/tool/call, it emits one Operation to the Submitter.
func NewInterceptor ¶
func NewInterceptor(s Submitter, cfg Config) *Interceptor
func (*Interceptor) OnClientFrame ¶
func (i *Interceptor) OnClientFrame(frame []byte)
OnClientFrame is called on every client->server frame BEFORE it's forwarded. Never blocks. Errors are silent — parsing failures are not Interceptor's problem; the underlying pump still forwards the bytes.
func (*Interceptor) OnServerFrame ¶
func (i *Interceptor) OnServerFrame(frame []byte)
OnServerFrame is called on every server->client frame. If it pairs with a pending request, emits an Operation.
type ListClient ¶
type ListClient struct {
// contains filtered or unexported fields
}
ListClient is the synchronous read-side: used by the gateway's operations/list RPC interceptor.
func NewListClient ¶
func NewListClient(url, secret string) *ListClient
func (*ListClient) List ¶
func (c *ListClient) List(ctx context.Context, params map[string]string) (json.RawMessage, error)
List forwards filter params to agentserver and returns the raw JSON body.
type Operation ¶
type Operation struct {
ID string `json:"id"`
WorkspaceID string `json:"workspace_id"`
UserID *string `json:"user_id,omitempty"`
Source string `json:"source"`
ThreadID *string `json:"thread_id,omitempty"`
RequestID *string `json:"request_id,omitempty"`
EnvID string `json:"env_id"`
Tool string `json:"tool"`
Arguments json.RawMessage `json:"arguments,omitempty"`
ArgumentsMeta json.RawMessage `json:"arguments_meta,omitempty"`
IsError bool `json:"is_error"`
ResultSummary *string `json:"result_summary,omitempty"`
ResultMeta json.RawMessage `json:"result_meta,omitempty"`
StartedAt time.Time `json:"started_at"`
CompletedAt time.Time `json:"completed_at"`
DurationMs int32 `json:"duration_ms"`
}
Operation is what we POST to agentserver /internal/operations. Field shapes match internal/server/operations.go's request struct.