Run tasks on Codex beside Claude; drop turn caps and mid-turn snapshots

This commit is contained in:
Ian Gulliver
2026-10-15 14:55:58 -07:00
parent 17898b0191
commit 74707f6398
53 changed files with 1904 additions and 1295 deletions
+18 -12
View File
@@ -56,6 +56,15 @@ type callResult struct {
IsError bool `json:"isError,omitempty"`
}
func (s *Server) Tool(name string) (Tool, bool) {
for _, t := range s.Tools {
if t.Name == name {
return t, true
}
}
return Tool{}, false
}
func (s *Server) Handle(ctx context.Context, raw json.RawMessage) (json.RawMessage, error) {
req := request{}
err := json.Unmarshal(raw, &req)
@@ -108,18 +117,15 @@ func (s *Server) call(ctx context.Context, params json.RawMessage) (any, *rpcErr
return nil, &rpcError{Code: -32602, Message: err.Error()}
}
for _, t := range s.Tools {
if t.Name != p.Name {
continue
}
text, err := t.Handler(ctx, p.Arguments)
if err != nil {
return callResult{Content: []content{{Type: "text", Text: err.Error()}}, IsError: true}, nil
}
return callResult{Content: []content{{Type: "text", Text: text}}}, nil
t, ok := s.Tool(p.Name)
if !ok {
return nil, &rpcError{Code: -32602, Message: fmt.Sprintf("unknown tool: %s", p.Name)}
}
return nil, &rpcError{Code: -32602, Message: fmt.Sprintf("unknown tool: %s", p.Name)}
text, err := t.Handler(ctx, p.Arguments)
if err != nil {
return callResult{Content: []content{{Type: "text", Text: err.Error()}}, IsError: true}, nil
}
return callResult{Content: []content{{Type: "text", Text: text}}}, nil
}