Simplify codebase per audit of 8b89f14
This commit is contained in:
+5
-10
@@ -42,15 +42,10 @@ func (m *Manager) forkTool(l *live) mcp.Tool {
|
||||
"title": {"type": "string", "description": "The new task's title, naming the path it takes."},
|
||||
"prompt": {"type": "string", "description": "The forked agent's next message: tell it that it is the other side of a fork and which path to take."}
|
||||
}, "required": ["title", "prompt"]}`),
|
||||
Handler: func(ctx context.Context, raw json.RawMessage) (string, error) {
|
||||
args := struct {
|
||||
Title string `json:"title"`
|
||||
Prompt string `json:"prompt"`
|
||||
}{}
|
||||
err := json.Unmarshal(raw, &args)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("malformed fork call: %w", err)
|
||||
}
|
||||
Handler: mcp.Typed(func(ctx context.Context, args struct {
|
||||
Title string `json:"title"`
|
||||
Prompt string `json:"prompt"`
|
||||
}) (string, error) {
|
||||
if strings.TrimSpace(args.Title) == "" || strings.TrimSpace(args.Prompt) == "" {
|
||||
return "", errors.New("title and prompt are required")
|
||||
}
|
||||
@@ -88,7 +83,7 @@ func (m *Manager) forkTool(l *live) mcp.Tool {
|
||||
slog.Info("task forked by its agent", "task", src.Id, "fork", t.Id, "snapshot", snap.N)
|
||||
return fmt.Sprintf("Forked at snapshot #%d as task %s %q, branch %s, worktree %s; its agent continues from just before this call with your prompt. Carry on here with your own path.",
|
||||
snap.N, t.Id, t.Title, t.Branch, t.WorktreePath), nil
|
||||
},
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user