mirror of
https://github.com/RuoJi6/ARTEX.git
synced 2026-11-28 10:41:50 +08:00
feat(agent): support reopening and steering tasks via resume_task, set_task_goals, and add_task_intent
- Add resume_task, set_task_goals, and add_task_intent orchestration tools bound to auto (and resume_task also bound to mainagent with task-context scoping) plus one-shot DB binding/prompt migrations.
- Wire task ID, NotifyGoal, and reviveTask into delegateToTask so set_task_goals and add_task_intent revive done/paused tasks in place while preserving graph/findings.
- Add shared resumeOrReopenTask and POST /api/tasks/{id}/resume (also wired into MCP resume_task) to reopen terminal tasks with open goals/intents and refuse closed tasks with no remaining work.
- Update auto and mainagent default prompts to prefer in-place resume/steering over spawning duplicate tasks.
Fixes #196
This commit is contained in:
1 parent
253a8eeac3
commit
f7bf75f535
9 files changed
+726
-17
No files matched your search
@@ -910,6 +910,7 @@ func (s *Server) Handler() http.Handler {
|
||||
mux.HandleFunc("PATCH /api/tasks/{id}/constraints/{cid}", s.editConstraint) // 约束管理:修改约束
|
||||
mux.HandleFunc("DELETE /api/tasks/{id}/constraints/{cid}", s.deleteConstraint) // 约束管理:删除约束
|
||||
mux.HandleFunc("POST /api/tasks/{id}/control", s.control)
|
||||
mux.HandleFunc("POST /api/tasks/{id}/resume", s.resumeTask)
|
||||
mux.HandleFunc("PUT /api/tasks/{id}/llm", s.updateTaskLLMProfiles)
|
||||
mux.HandleFunc("GET /api/tasks/{id}/llm/resolution", s.taskLLMResolutionHandler)
|
||||
mux.HandleFunc("POST /api/tasks/{id}/intents/{iid}/control", s.controlIntent)
|
||||
@@ -1389,6 +1390,22 @@ func (s *Server) control(w http.ResponseWriter, r *http.Request) {
|
||||
writeJSON(w, 200, result)
|
||||
}
|
||||
|
||||
// resumeTask resumes a paused task or reopens a terminal task (done/failed/timeout)
|
||||
// in place when it still has open goals or open intents.
|
||||
func (s *Server) resumeTask(w http.ResponseWriter, r *http.Request) {
|
||||
t, ok := s.lookupTask(r.PathValue("id"))
|
||||
if !ok {
|
||||
writeErr(w, 404, "task not found")
|
||||
return
|
||||
}
|
||||
result, err := s.resumeOrReopenTask(t, agent.AbortPausedByUser)
|
||||
if err != nil {
|
||||
writeErr(w, 409, err.Error())
|
||||
return
|
||||
}
|
||||
writeJSON(w, 200, result)
|
||||
}
|
||||
|
||||
// controlIntent pauses, resumes, or cancels one local worker intent. A running
|
||||
// worker is always stopped before state mutation/cleanup, preventing tool output
|
||||
// that arrives after the user action from recreating deleted blackboard records.
|
||||
|
||||
Reference in new issue
Block a user