From c67d677f50a9e30f54dcb7618be3048133aec6bc Mon Sep 17 00:00:00 2001 From: yushen Date: Tue, 3 Feb 2026 18:04:40 +0800 Subject: [PATCH] docs: align subagent call order --- docs/subagent-architecture.html | 44 ++++++++++++++++----------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/docs/subagent-architecture.html b/docs/subagent-architecture.html index a7936589..6e12c449 100644 --- a/docs/subagent-architecture.html +++ b/docs/subagent-architecture.html @@ -498,7 +498,16 @@
hub.ts → createSubagent()
-
+
+
Write task to child (non-blocking)
+
+ childAgent.write(task) enqueues the task to the serial queue. + This happens before registration so waitForIdle() observes queued work. +
+
async-agent.ts → write() (enqueues to serial queue)
+
+ +
Register run in registry
registerSubagentRun() saves record to in-memory Map + JSON file. @@ -507,26 +516,17 @@
registry.ts → registerSubagentRun()
-
-
Start lifecycle watcher
+
+
Start lifecycle watcher & return to parent
watchChildAgent() sets startedAt. Attaches childAgent.waitForIdle() (promise resolves when task queue drained) and childAgent.onClose() callback. Optionally sets timeout timer. + Tool returns { status: "accepted", childSessionId, runId } immediately.
registry.ts → watchChildAgent() → AsyncAgent.waitForIdle() + onClose()
-
-
Write task to child & return to parent
-
- childAgent.write(task) enqueues the task (non-blocking). - Tool returns { status: "accepted", childSessionId, runId } immediately. - Parent agent continues working. -
-
async-agent.ts → write() (enqueues to serial queue)
-
-
Child agent processes task autonomously
@@ -615,17 +615,17 @@ new AsyncAgent({ isSubagent: true }) - - - registerSubagentRun(params) + + + childAgent.write(task) - - - waitForIdle() + onClose() + + + registerSubagentRun(params) - - - childAgent.write(task) + + + waitForIdle() + onClose()