Expand description
agents spawn — in-process chunk-or-id streaming handler.
The agent input is the shared AgentSelector — a direct ref
(inline / file / python / remote), a tag, or an existing
instance. Tags resolve first: BOUND → the live hierarchy
(historic case), GROUPED → the group’s stored spec plus the tag
threaded into the conduit for the BOUND upgrade, ABSENT → error.
Stream-true (dangerous_advanced.stream = Some(true)): resolve
- lock + drive the SDK streaming WS connection inside this cli
process. The INITIAL lock (try_acquire, failure = error): historic
case → the AIH lock, un-upgraded tag case → the tag lock, plain ref
→ no initial lock. When a parent
agents messagetransferred a claim into this process, the lockfile adopts it lazily on this firsttry_acquire, so the acquisition succeeds instantly. Historic spawns load their agent params + continuation from the stored session. Mid-stream, every newly revealed hierarchy gets a best-effort AIH claim ([AgentInstanceRegistry::observe]); the first success releases the tag claim. End-of-stream: if the hierarchy has undeliveredmessage_queuerows, restart with the latest continuation — restart passes flow into the same output stream.
Stream-false (the default): re-invoke objectiveai-cli agents spawn ... as a detached subprocess with the same arguments
plus stream = true (so the resolution + locking above runs in
the child), read the first ResponseItem::Id line off the
child’s stdout, yield it, and return. The subprocess runs
orphaned to completion (Unix: kernel re-parents to init;
Windows: DETACHED_PROCESS | CREATE_NEW_PROCESS_GROUP keeps
it alive past parent exit).
params.stream on the wire is always Some(true); the
dangerous_advanced.stream setting only controls cli-side
output.