subagent_generate: accept JSON as arg; remove all escaping from prompt examples
This commit is contained in:
parent
35d8f03115
commit
bf91cab41c
|
|
@ -6,13 +6,22 @@ Spawn independent subagent sessions with JIT-generated identities via `echo JSON
|
|||
|
||||
**Calling convention**:
|
||||
```
|
||||
pipe: stages=[{code: "echo '{\"role\": \"ROLE\", \"shared_task\": \"TASK_DESC\"}'"}, {tool: "subagent_generate"}, {tool: "subagent_spawn", args: ["-name", "NAME", "TASK"]}]
|
||||
pipe: stages=[
|
||||
{tool: "subagent_generate", args: [{"role": "ROLE", "shared_task": "TASK_DESC"}]},
|
||||
{tool: "subagent_spawn", args: ["-name", "NAME", "TASK"]}
|
||||
]
|
||||
```
|
||||
|
||||
Parallel — issue separate pipe calls for each subagent (subagent_spawn returns immediately, so sequential dispatch is fine):
|
||||
```
|
||||
pipe: stages=[{code: "echo '{\"role\": \"ROLE_A\", \"roster\": \"a (you), b\", \"shared_task\": \"X\"}'"}, {tool: "subagent_generate"}, {tool: "subagent_spawn", args: ["-name", "a", "TASK_A"]}]
|
||||
pipe: stages=[{code: "echo '{\"role\": \"ROLE_B\", \"roster\": \"a, b (you)\", \"shared_task\": \"X\"}'"}, {tool: "subagent_generate"}, {tool: "subagent_spawn", args: ["-name", "b", "TASK_B"]}]
|
||||
pipe: stages=[
|
||||
{tool: "subagent_generate", args: [{"role": "ROLE_A", "roster": "a (you), b", "shared_task": "X"}]},
|
||||
{tool: "subagent_spawn", args: ["-name", "a", "TASK_A"]}
|
||||
]
|
||||
pipe: stages=[
|
||||
{tool: "subagent_generate", args: [{"role": "ROLE_B", "roster": "a, b (you)", "shared_task": "X"}]},
|
||||
{tool: "subagent_spawn", args: ["-name", "b", "TASK_B"]}
|
||||
]
|
||||
```
|
||||
|
||||
**Returns**: `subagent_generate` returns the agent config name. `subagent_spawn` returns the session path (e.g. `s/my-session`).
|
||||
|
|
|
|||
|
|
@ -14,7 +14,11 @@ if [ -t 0 ] && [ $# -eq 0 ]; then
|
|||
exit 0
|
||||
fi
|
||||
|
||||
cfg=$(cat) || die "failed to read stdin"
|
||||
if [ $# -gt 0 ]; then
|
||||
cfg="$1"
|
||||
else
|
||||
cfg=$(cat) || die "failed to read stdin"
|
||||
fi
|
||||
[ -z "$cfg" ] && die "empty input"
|
||||
|
||||
name=$(printf '%s' "$cfg" | python3 -c "
|
||||
|
|
|
|||
Loading…
Reference in New Issue