feat(agentic): add dispatch console command
Co-Authored-By: Virgil <virgil@lethean.io>
This commit is contained in:
parent
f4ce83d194
commit
49e13613d2
2 changed files with 21 additions and 2 deletions
|
|
@ -19,6 +19,7 @@ func (s *PrepSubsystem) registerCommands(ctx context.Context) {
|
|||
c := s.Core()
|
||||
c.Command("run/task", core.Command{Description: "Run a single task end-to-end", Action: s.cmdRunTask})
|
||||
c.Command("run/orchestrator", core.Command{Description: "Run the queue orchestrator (standalone, no MCP)", Action: s.cmdOrchestrator})
|
||||
c.Command("dispatch", core.Command{Description: "Dispatch queued agents", Action: s.cmdDispatch})
|
||||
c.Command("prep", core.Command{Description: "Prepare a workspace: clone repo, build prompt", Action: s.cmdPrep})
|
||||
c.Command("prep-workspace", core.Command{Description: "Prepare a workspace: clone repo, build prompt", Action: s.cmdPrep})
|
||||
c.Command("generate", core.Command{Description: "Generate content from a prompt using the platform content pipeline", Action: s.cmdGenerate})
|
||||
|
|
@ -101,13 +102,21 @@ func (s *PrepSubsystem) runTask(ctx context.Context, options core.Options) core.
|
|||
}
|
||||
|
||||
func (s *PrepSubsystem) cmdOrchestrator(_ core.Options) core.Result {
|
||||
return s.runDispatchLoop("orchestrator")
|
||||
}
|
||||
|
||||
func (s *PrepSubsystem) cmdDispatch(_ core.Options) core.Result {
|
||||
return s.runDispatchLoop("dispatch")
|
||||
}
|
||||
|
||||
func (s *PrepSubsystem) runDispatchLoop(label string) core.Result {
|
||||
ctx := s.commandContext()
|
||||
core.Print(nil, "core-agent orchestrator running (pid %s)", core.Env("PID"))
|
||||
core.Print(nil, "core-agent %s running (pid %s)", label, core.Env("PID"))
|
||||
core.Print(nil, " workspace: %s", WorkspaceRoot())
|
||||
core.Print(nil, " watching queue, draining on 30s tick + completion poke")
|
||||
|
||||
<-ctx.Done()
|
||||
core.Print(nil, "orchestrator shutting down")
|
||||
core.Print(nil, "%s shutting down", label)
|
||||
return core.Result{OK: true}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1137,6 +1137,15 @@ func TestCommands_CmdOrchestrator_Good_CancelledCtx(t *testing.T) {
|
|||
assert.True(t, r.OK)
|
||||
}
|
||||
|
||||
func TestCommands_CmdDispatch_Good_CancelledCtx(t *testing.T) {
|
||||
s, _ := testPrepWithCore(t, nil)
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
cancel()
|
||||
s.startupContext = ctx
|
||||
r := s.cmdDispatch(core.NewOptions())
|
||||
assert.True(t, r.OK)
|
||||
}
|
||||
|
||||
func TestCommands_ParseIntStr_Good(t *testing.T) {
|
||||
assert.Equal(t, 42, parseIntString("42"))
|
||||
assert.Equal(t, 123, parseIntString("issue-123"))
|
||||
|
|
@ -1156,6 +1165,7 @@ func TestCommands_RegisterCommands_Good_AllRegistered(t *testing.T) {
|
|||
cmds := c.Commands()
|
||||
assert.Contains(t, cmds, "run/task")
|
||||
assert.Contains(t, cmds, "run/orchestrator")
|
||||
assert.Contains(t, cmds, "dispatch")
|
||||
assert.Contains(t, cmds, "prep")
|
||||
assert.Contains(t, cmds, "complete")
|
||||
assert.Contains(t, cmds, "scan")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue