feat(subagent): add session-owned task messaging and cancellation (#5985)
let's go!
This commit is contained in:
1 parent
f75470e72f
commit
6ff96f2a8f
93 files changed
+5632
-1156
No files matched your search
@@ -1,11 +1,24 @@
|
||||
"""Session-worker completion helpers for integration tests."""
|
||||
|
||||
import asyncio
|
||||
import time
|
||||
|
||||
from nanobot.agent.loop import AgentLoop
|
||||
from nanobot.agent.subagent_status import SubagentStatus
|
||||
from nanobot.bus.events import InboundMessage
|
||||
|
||||
|
||||
def save_completed_subagent(loop: AgentLoop, task_id: str, owner: str) -> None:
|
||||
"""Persist the child that owns a synthetic completion notification."""
|
||||
assert loop.subagents.sessions is not None
|
||||
now = time.monotonic()
|
||||
loop.subagents.sessions.create(SubagentStatus(
|
||||
task_id=task_id, label=task_id, task_description="Background work",
|
||||
owner=owner, started_at=now, finished_at=now, completed_at=time.time(),
|
||||
state="done", phase="done",
|
||||
))
|
||||
|
||||
|
||||
async def run_session(loop: AgentLoop, msg: InboundMessage) -> None:
|
||||
"""Submit input and wait for its session worker to finish."""
|
||||
loop._enqueue_session_message(msg)
|
||||
|
||||
Reference in new issue
Block a user