Let Compact continue on another model or vendor

This commit is contained in:
Ian Gulliver
2026-10-18 00:43:00 -07:00
parent 0a1f58cafa
commit 17f09ecb7c
11 changed files with 314 additions and 236 deletions
+13 -2
View File
@@ -325,13 +325,24 @@ func (m *Manager) leadTools(l *live) []mcp.Tool {
return "Interrupted.", nil
}),
tool("compact_task", "Have a task's idle agent write a handoff and continue in a fresh session.", taskOnly,
tool("compact_task", "Have a task's idle agent write a handoff and continue in a fresh session.",
`{"type": "object", "properties": {
"task_id": {"type": "string"},
"model": {"type": "string", "description": "Start the fresh session on this model, on either vendor; the current agent still writes the handoff. Defaults to the current model."}
}, "required": ["task_id"]}`,
func(ctx context.Context, user api.User, raw json.RawMessage) (string, error) {
args := struct {
Model string `json:"model"`
}{}
err := json.Unmarshal(raw, &args)
if err != nil {
return "", err
}
sess, err := m.taskSessionArg(ctx, raw)
if err != nil {
return "", err
}
_, err = m.Compact(ctx, sess.Id)
_, err = m.Compact(ctx, sess.Id, args.Model)
if err != nil {
return "", err
}