refactor(agent): move worker runtime into application layer
cmd/archie-agent used to own worker construction, NATS lifecycle, task execution, MCP setup, and workflow wiring. It now owns process input only and invokes internal/app/agentworker, while transport-specific NATS, boot-brief, and git-safety mechanics live under infrastructure.
This commit is contained in:
1 parent
0243c13d37
commit
45345cdfb6
35 files changed
+2901
-689
No files matched your search
@@ -7,6 +7,7 @@
|
||||
package taskrun
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/samcharles93/archie-core/internal/agentexec"
|
||||
@@ -14,11 +15,6 @@ import (
|
||||
"github.com/samcharles93/archie-core/internal/store"
|
||||
)
|
||||
|
||||
// SubjectForTask returns the per-task NATS subject for a full-task handoff.
|
||||
func SubjectForTask(taskID int64) string {
|
||||
return fmt.Sprintf("archie.taskrun.%d", taskID)
|
||||
}
|
||||
|
||||
// Request carries everything archie-agent needs to run a task's entire
|
||||
// workflow itself: the task row (already claimed by archied), the repo's
|
||||
// gate/ecosystem config, a non-secret config snapshot, and LLM provider
|
||||
@@ -35,6 +31,18 @@ type Request struct {
|
||||
MCPServers []config.MCPServer `json:"mcp_servers,omitempty"`
|
||||
}
|
||||
|
||||
// Validate rejects a full-task request that cannot be correlated to a real
|
||||
// task. Transport-specific subject correlation is enforced by the adapter.
|
||||
func (r Request) Validate() error {
|
||||
if r.Task == nil {
|
||||
return errors.New("task is required")
|
||||
}
|
||||
if r.Task.ID <= 0 {
|
||||
return fmt.Errorf("task ID must be positive, got %d", r.Task.ID)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Response reports the task's final state after archie-agent runs its
|
||||
// workflow. Task carries the last-known field values for logging; the
|
||||
// authoritative state already landed in archied's store via storerpc
|
||||
|
||||
Reference in new issue
Block a user