Add detach ctl command for agent
Allows user to background the current foreground tool process by writing 'detach' to the agent ctl file. The agent can then continue working without waiting for the tool to complete.
This commit is contained in:
parent
67edfdf58b
commit
39ccfe8aa3
|
|
@ -946,6 +946,16 @@ func buildAgentChildren(a *agent.Agent, s *session.Session) []virtfs.FsNodeDecl
|
|||
a.Interrupt(agent.ErrInterrupted)
|
||||
return []byte("ok\n"), nil
|
||||
},
|
||||
"detach": func(_ []string) ([]byte, error) {
|
||||
ts := a.ToolServer()
|
||||
if ts == nil {
|
||||
return nil, fmt.Errorf("no tool server")
|
||||
}
|
||||
if !ts.Detach() {
|
||||
return nil, fmt.Errorf("no foreground process to detach")
|
||||
}
|
||||
return []byte("ok\n"), nil
|
||||
},
|
||||
"compact": func(_ []string) ([]byte, error) {
|
||||
if err := a.Compact(s.Ctx); err != nil {
|
||||
return nil, err
|
||||
|
|
@ -1185,7 +1195,7 @@ func buildAgentChildren(a *agent.Agent, s *session.Session) []virtfs.FsNodeDecl
|
|||
},
|
||||
"stats": stats,
|
||||
"help": func(_ []string) ([]byte, error) {
|
||||
return []byte("stop compact clear inject agent model models tools tool_load tool_unload cwd proc name backend systemprompt peeradd peerdel peers stats help\n"), nil
|
||||
return []byte("stop detach compact clear inject agent model models tools tool_load tool_unload cwd proc name backend systemprompt peeradd peerdel peers stats help\n"), nil
|
||||
},
|
||||
}, data)
|
||||
}),
|
||||
|
|
|
|||
Loading…
Reference in New Issue