feat(subagent): implement subagent lifecycle tracking and core loop reactive wakeup
- Implement bin/subagent_tracker.py with session registry in subagent-sessions.json - Register spawned sessions automatically in super-cli.py cmd_deploy - Add check_subagents() to bin/self_main_loop.py with thread updated watermark comparison - Add 15-minute stall watchdog with automated parent alerting - Support 'box subagent spawn' top-level command alias in super-cli.py - Add symmetrical pip-opm sidechat routing in job-sidechats.json
This commit is contained in:
+18
-1
@@ -2530,6 +2530,12 @@ def cmd_deploy(args):
|
||||
session_id = res.get("session_id")
|
||||
print(c_green(f"✔ Subagent session spawned: {session_id}"))
|
||||
|
||||
try:
|
||||
import subagent_tracker
|
||||
subagent_tracker.register_session(agent, session_id, title=title, prompt=prompt)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
if prompt:
|
||||
print(f" Dispatching task prompt to subagent (waiting up to {wait}s)...")
|
||||
send_res, send_err = muse_hybrid.send_message(agent, prompt, thread_id=session_id, wait=wait)
|
||||
@@ -3404,6 +3410,15 @@ def build_parser():
|
||||
p_dep_sub.add_argument("prompt", help="Task prompt for the subagent")
|
||||
p_dep_sub.add_argument("--wait", type=int, default=30, help="Seconds to wait for subagent response")
|
||||
|
||||
# Domain: subagent (Direct alias for spawning & managing subagents)
|
||||
p_subagent = subparsers.add_parser("subagent", parents=[common], help="Spawn sub-agent session and dispatch task")
|
||||
subagent_sub = p_subagent.add_subparsers(dest="action")
|
||||
p_sub_spawn = subagent_sub.add_parser("spawn", parents=[common], help="Spawn sub-agent session and dispatch task")
|
||||
p_sub_spawn.add_argument("--agent", required=True, choices=VALID_NODES, help="Agent node to spawn subagent on")
|
||||
p_sub_spawn.add_argument("--title", default="subagent-task", help="Title for the subagent session")
|
||||
p_sub_spawn.add_argument("prompt", help="Task prompt for the subagent")
|
||||
p_sub_spawn.add_argument("--wait", type=int, default=30, help="Seconds to wait for subagent response")
|
||||
|
||||
# Domain: muse (fast headless gateway via muse-cli-node with isolated per-node Cloudflare WARP egress)
|
||||
p_muse = subparsers.add_parser("muse", parents=[common], help="Direct headless gateway client (muse-cli-node)")
|
||||
p_muse.add_argument("node", choices=VALID_NODES, help="Target agent node")
|
||||
@@ -3577,7 +3592,9 @@ def main():
|
||||
cmd_loop_strat(args)
|
||||
elif args.domain == "vars":
|
||||
cmd_loop_vars(args)
|
||||
elif args.domain == "deploy":
|
||||
elif args.domain in ("deploy", "subagent"):
|
||||
if args.domain == "subagent":
|
||||
args.action = "subagent"
|
||||
cmd_deploy(args)
|
||||
elif args.domain == "muse":
|
||||
cmd = [str(BIN_DIR / "muse-cli-node"), args.node] + (args.muse_args or [])
|
||||
|
||||
Reference in New Issue
Block a user