Remove unused Codex protocol registries and session APIs
This commit is contained in:
@@ -41,22 +41,6 @@ type Event struct {
|
||||
Read time.Time
|
||||
}
|
||||
|
||||
func (e Event) Decode() (any, error) {
|
||||
ctor, ok := notificationParams[e.Method]
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unknown notification %q", e.Method)
|
||||
}
|
||||
if ctor == nil {
|
||||
return nil, nil
|
||||
}
|
||||
v := ctor()
|
||||
err := json.Unmarshal(e.Params, v)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("decode %s: %w", e.Method, err)
|
||||
}
|
||||
return v, nil
|
||||
}
|
||||
|
||||
type RPCError struct {
|
||||
Code int64 `json:"code"`
|
||||
Message string `json:"message"`
|
||||
@@ -92,11 +76,10 @@ type Session struct {
|
||||
pendingMu sync.Mutex
|
||||
pending map[int64]chan rpcResult
|
||||
|
||||
stateMu sync.Mutex
|
||||
threadID string
|
||||
turnID string
|
||||
model string
|
||||
userAgent string
|
||||
stateMu sync.Mutex
|
||||
threadID string
|
||||
turnID string
|
||||
model string
|
||||
|
||||
servers map[string]*mcp.Server
|
||||
reminder string
|
||||
@@ -264,10 +247,6 @@ func (s *Session) initialize(ctx context.Context) error {
|
||||
return fmt.Errorf("initialize: %w", err)
|
||||
}
|
||||
|
||||
s.stateMu.Lock()
|
||||
s.userAgent = init.UserAgent
|
||||
s.stateMu.Unlock()
|
||||
|
||||
return s.notify("initialized", nil)
|
||||
}
|
||||
|
||||
@@ -314,10 +293,6 @@ func (s *Session) Events() <-chan Event {
|
||||
return s.events
|
||||
}
|
||||
|
||||
func (s *Session) Done() <-chan struct{} {
|
||||
return s.done
|
||||
}
|
||||
|
||||
func (s *Session) Pid() int {
|
||||
return s.cmd.Process.Pid
|
||||
}
|
||||
@@ -341,18 +316,6 @@ func (s *Session) ID() string {
|
||||
return s.threadID
|
||||
}
|
||||
|
||||
func (s *Session) TurnID() string {
|
||||
s.stateMu.Lock()
|
||||
defer s.stateMu.Unlock()
|
||||
return s.turnID
|
||||
}
|
||||
|
||||
func (s *Session) UserAgent() string {
|
||||
s.stateMu.Lock()
|
||||
defer s.stateMu.Unlock()
|
||||
return s.userAgent
|
||||
}
|
||||
|
||||
func (s *Session) SetModel(model string) {
|
||||
s.stateMu.Lock()
|
||||
s.model = model
|
||||
@@ -417,10 +380,6 @@ func (s *Session) Steer(text string) (*Reply, error) {
|
||||
return s.request(context.Background(), MethodTurnSteer, params)
|
||||
}
|
||||
|
||||
func (s *Session) Compact(ctx context.Context) error {
|
||||
return s.Call(ctx, MethodThreadCompactStart, ThreadCompactStartParams{ThreadID: s.ID()}, nil)
|
||||
}
|
||||
|
||||
const rpcTimeout = time.Minute
|
||||
|
||||
type Reply struct {
|
||||
@@ -603,7 +562,7 @@ func (s *Session) handleLine(line []byte) {
|
||||
return
|
||||
}
|
||||
|
||||
if _, ok := notificationParams[m.Method]; !ok {
|
||||
if _, ok := notificationMethods[m.Method]; !ok {
|
||||
s.badLine(line, fmt.Sprintf("unrecognized method %q", m.Method))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user