Publish Claude Code Binaries / Stage and publish binaries (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-arm64 (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build linux-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build windows-amd64 (push) Canceled after 0s
Sync Tutti Agent Skills / sync (push) Canceled after 0s
Windows Agent Adapters / Test Windows agent adapters (push) Canceled after 0s
Windows Daemon Adapters / Test Windows daemon adapters (push) Canceled after 0s
Publish Tutti App Runtime / Publish runtime catalog (push) Canceled after 0s
244 lines
9.5 KiB
Go
244 lines
9.5 KiB
Go
// Code generated by runtime/codexproto/internal/codegen. DO NOT EDIT.
|
|
// Source codex commit: 6d2168f06ae275d5e1f73cabf935d2bcc8549998
|
|
|
|
package codexproto
|
|
|
|
import (
|
|
"context"
|
|
"encoding/json"
|
|
"fmt"
|
|
)
|
|
|
|
// ServerRequestHandler handles requests initiated by the app-server.
|
|
type ServerRequestHandler interface {
|
|
AccountChatgptAuthTokensRefresh(ctx context.Context, params ChatgptAuthTokensRefreshParams) (*ChatgptAuthTokensRefreshResponse, error)
|
|
ApplyPatchApproval(ctx context.Context, params ApplyPatchApprovalParams) (*ApplyPatchApprovalResponse, error)
|
|
AttestationGenerate(ctx context.Context, params AttestationGenerateParams) (*AttestationGenerateResponse, error)
|
|
ExecCommandApproval(ctx context.Context, params ExecCommandApprovalParams) (*ExecCommandApprovalResponse, error)
|
|
ItemCommandExecutionRequestApproval(ctx context.Context, params CommandExecutionRequestApprovalParams) (*CommandExecutionRequestApprovalResponse, error)
|
|
ItemFileChangeRequestApproval(ctx context.Context, params FileChangeRequestApprovalParams) (*FileChangeRequestApprovalResponse, error)
|
|
ItemPermissionsRequestApproval(ctx context.Context, params PermissionsRequestApprovalParams) (*PermissionsRequestApprovalResponse, error)
|
|
ItemToolCall(ctx context.Context, params DynamicToolCallParams) (*DynamicToolCallResponse, error)
|
|
ItemToolRequestUserInput(ctx context.Context, params ToolRequestUserInputParams) (*ToolRequestUserInputResponse, error)
|
|
McpServerElicitationRequest(ctx context.Context, params McpServerElicitationRequestParams) (*McpServerElicitationRequestResponse, error)
|
|
}
|
|
|
|
// ParsedServerRequest represents a typed server request envelope.
|
|
type ParsedServerRequest struct {
|
|
Method string
|
|
Params any
|
|
Raw json.RawMessage
|
|
}
|
|
|
|
type serverRequestParser func(json.RawMessage) (ParsedServerRequest, error)
|
|
|
|
var serverRequestParsers = map[string]serverRequestParser{
|
|
"account/chatgptAuthTokens/refresh": func(params json.RawMessage) (ParsedServerRequest, error) {
|
|
var payload ChatgptAuthTokensRefreshParams
|
|
if len(params) > 0 {
|
|
if err := json.Unmarshal(params, &payload); err != nil {
|
|
return ParsedServerRequest{Method: "account/chatgptAuthTokens/refresh", Raw: params}, err
|
|
}
|
|
}
|
|
return ParsedServerRequest{Method: "account/chatgptAuthTokens/refresh", Params: payload, Raw: params}, nil
|
|
},
|
|
"applyPatchApproval": func(params json.RawMessage) (ParsedServerRequest, error) {
|
|
var payload ApplyPatchApprovalParams
|
|
if len(params) > 0 {
|
|
if err := json.Unmarshal(params, &payload); err != nil {
|
|
return ParsedServerRequest{Method: "applyPatchApproval", Raw: params}, err
|
|
}
|
|
}
|
|
return ParsedServerRequest{Method: "applyPatchApproval", Params: payload, Raw: params}, nil
|
|
},
|
|
"attestation/generate": func(params json.RawMessage) (ParsedServerRequest, error) {
|
|
var payload AttestationGenerateParams
|
|
if len(params) > 0 {
|
|
if err := json.Unmarshal(params, &payload); err != nil {
|
|
return ParsedServerRequest{Method: "attestation/generate", Raw: params}, err
|
|
}
|
|
}
|
|
return ParsedServerRequest{Method: "attestation/generate", Params: payload, Raw: params}, nil
|
|
},
|
|
"execCommandApproval": func(params json.RawMessage) (ParsedServerRequest, error) {
|
|
var payload ExecCommandApprovalParams
|
|
if len(params) > 0 {
|
|
if err := json.Unmarshal(params, &payload); err != nil {
|
|
return ParsedServerRequest{Method: "execCommandApproval", Raw: params}, err
|
|
}
|
|
}
|
|
return ParsedServerRequest{Method: "execCommandApproval", Params: payload, Raw: params}, nil
|
|
},
|
|
"item/commandExecution/requestApproval": func(params json.RawMessage) (ParsedServerRequest, error) {
|
|
var payload CommandExecutionRequestApprovalParams
|
|
if len(params) > 0 {
|
|
if err := json.Unmarshal(params, &payload); err != nil {
|
|
return ParsedServerRequest{Method: "item/commandExecution/requestApproval", Raw: params}, err
|
|
}
|
|
}
|
|
return ParsedServerRequest{Method: "item/commandExecution/requestApproval", Params: payload, Raw: params}, nil
|
|
},
|
|
"item/fileChange/requestApproval": func(params json.RawMessage) (ParsedServerRequest, error) {
|
|
var payload FileChangeRequestApprovalParams
|
|
if len(params) > 0 {
|
|
if err := json.Unmarshal(params, &payload); err != nil {
|
|
return ParsedServerRequest{Method: "item/fileChange/requestApproval", Raw: params}, err
|
|
}
|
|
}
|
|
return ParsedServerRequest{Method: "item/fileChange/requestApproval", Params: payload, Raw: params}, nil
|
|
},
|
|
"item/permissions/requestApproval": func(params json.RawMessage) (ParsedServerRequest, error) {
|
|
var payload PermissionsRequestApprovalParams
|
|
if len(params) > 0 {
|
|
if err := json.Unmarshal(params, &payload); err != nil {
|
|
return ParsedServerRequest{Method: "item/permissions/requestApproval", Raw: params}, err
|
|
}
|
|
}
|
|
return ParsedServerRequest{Method: "item/permissions/requestApproval", Params: payload, Raw: params}, nil
|
|
},
|
|
"item/tool/call": func(params json.RawMessage) (ParsedServerRequest, error) {
|
|
var payload DynamicToolCallParams
|
|
if len(params) > 0 {
|
|
if err := json.Unmarshal(params, &payload); err != nil {
|
|
return ParsedServerRequest{Method: "item/tool/call", Raw: params}, err
|
|
}
|
|
}
|
|
return ParsedServerRequest{Method: "item/tool/call", Params: payload, Raw: params}, nil
|
|
},
|
|
"item/tool/requestUserInput": func(params json.RawMessage) (ParsedServerRequest, error) {
|
|
var payload ToolRequestUserInputParams
|
|
if len(params) > 0 {
|
|
if err := json.Unmarshal(params, &payload); err != nil {
|
|
return ParsedServerRequest{Method: "item/tool/requestUserInput", Raw: params}, err
|
|
}
|
|
}
|
|
return ParsedServerRequest{Method: "item/tool/requestUserInput", Params: payload, Raw: params}, nil
|
|
},
|
|
"mcpServer/elicitation/request": func(params json.RawMessage) (ParsedServerRequest, error) {
|
|
var payload McpServerElicitationRequestParams
|
|
if len(params) > 0 {
|
|
if err := json.Unmarshal(params, &payload); err != nil {
|
|
return ParsedServerRequest{Method: "mcpServer/elicitation/request", Raw: params}, err
|
|
}
|
|
}
|
|
return ParsedServerRequest{Method: "mcpServer/elicitation/request", Params: payload, Raw: params}, nil
|
|
},
|
|
}
|
|
|
|
// ParseServerRequest parses a server request by method.
|
|
func ParseServerRequest(method string, params json.RawMessage) (ParsedServerRequest, error) {
|
|
if parser, ok := serverRequestParsers[method]; ok {
|
|
return parser(params)
|
|
}
|
|
return ParsedServerRequest{Method: method, Raw: params}, nil
|
|
}
|
|
|
|
// IsKnownServerRequestMethod reports whether method is in the generated server request surface.
|
|
func IsKnownServerRequestMethod(method string) bool {
|
|
_, ok := serverRequestParsers[method]
|
|
return ok
|
|
}
|
|
|
|
// ServerRequestMethods returns the generated server request surface in stable order.
|
|
func ServerRequestMethods() []string {
|
|
return []string{
|
|
"account/chatgptAuthTokens/refresh",
|
|
"applyPatchApproval",
|
|
"attestation/generate",
|
|
"execCommandApproval",
|
|
"item/commandExecution/requestApproval",
|
|
"item/fileChange/requestApproval",
|
|
"item/permissions/requestApproval",
|
|
"item/tool/call",
|
|
"item/tool/requestUserInput",
|
|
"mcpServer/elicitation/request",
|
|
}
|
|
}
|
|
|
|
func dispatchServerRequest(ctx context.Context, handler ServerRequestHandler, req JSONRPCRequest) (any, error) {
|
|
switch req.Method {
|
|
case "account/chatgptAuthTokens/refresh":
|
|
var params ChatgptAuthTokensRefreshParams
|
|
if len(req.Params) > 0 {
|
|
if err := json.Unmarshal(req.Params, ¶ms); err != nil {
|
|
return nil, err
|
|
}
|
|
}
|
|
return handler.AccountChatgptAuthTokensRefresh(ctx, params)
|
|
case "applyPatchApproval":
|
|
var params ApplyPatchApprovalParams
|
|
if len(req.Params) > 0 {
|
|
if err := json.Unmarshal(req.Params, ¶ms); err != nil {
|
|
return nil, err
|
|
}
|
|
}
|
|
return handler.ApplyPatchApproval(ctx, params)
|
|
case "attestation/generate":
|
|
var params AttestationGenerateParams
|
|
if len(req.Params) > 0 {
|
|
if err := json.Unmarshal(req.Params, ¶ms); err != nil {
|
|
return nil, err
|
|
}
|
|
}
|
|
return handler.AttestationGenerate(ctx, params)
|
|
case "execCommandApproval":
|
|
var params ExecCommandApprovalParams
|
|
if len(req.Params) > 0 {
|
|
if err := json.Unmarshal(req.Params, ¶ms); err != nil {
|
|
return nil, err
|
|
}
|
|
}
|
|
return handler.ExecCommandApproval(ctx, params)
|
|
case "item/commandExecution/requestApproval":
|
|
var params CommandExecutionRequestApprovalParams
|
|
if len(req.Params) > 0 {
|
|
if err := json.Unmarshal(req.Params, ¶ms); err != nil {
|
|
return nil, err
|
|
}
|
|
}
|
|
return handler.ItemCommandExecutionRequestApproval(ctx, params)
|
|
case "item/fileChange/requestApproval":
|
|
var params FileChangeRequestApprovalParams
|
|
if len(req.Params) > 0 {
|
|
if err := json.Unmarshal(req.Params, ¶ms); err != nil {
|
|
return nil, err
|
|
}
|
|
}
|
|
return handler.ItemFileChangeRequestApproval(ctx, params)
|
|
case "item/permissions/requestApproval":
|
|
var params PermissionsRequestApprovalParams
|
|
if len(req.Params) > 0 {
|
|
if err := json.Unmarshal(req.Params, ¶ms); err != nil {
|
|
return nil, err
|
|
}
|
|
}
|
|
return handler.ItemPermissionsRequestApproval(ctx, params)
|
|
case "item/tool/call":
|
|
var params DynamicToolCallParams
|
|
if len(req.Params) > 0 {
|
|
if err := json.Unmarshal(req.Params, ¶ms); err != nil {
|
|
return nil, err
|
|
}
|
|
}
|
|
return handler.ItemToolCall(ctx, params)
|
|
case "item/tool/requestUserInput":
|
|
var params ToolRequestUserInputParams
|
|
if len(req.Params) > 0 {
|
|
if err := json.Unmarshal(req.Params, ¶ms); err != nil {
|
|
return nil, err
|
|
}
|
|
}
|
|
return handler.ItemToolRequestUserInput(ctx, params)
|
|
case "mcpServer/elicitation/request":
|
|
var params McpServerElicitationRequestParams
|
|
if len(req.Params) > 0 {
|
|
if err := json.Unmarshal(req.Params, ¶ms); err != nil {
|
|
return nil, err
|
|
}
|
|
}
|
|
return handler.McpServerElicitationRequest(ctx, params)
|
|
default:
|
|
return nil, fmt.Errorf("unsupported server request %q", req.Method)
|
|
}
|
|
}
|