@hheei/pi-subagents 0.5.3 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/domain.d.ts +10 -1
- package/dist/manager.js +5 -10
- package/dist/tool-presentation.js +1 -1
- package/dist/tools.js +4 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@ children and `/subagents stop [id]` to stop one without conflicting with other e
|
|
|
16
16
|
| Tool | Purpose |
|
|
17
17
|
| --- | --- |
|
|
18
18
|
| `agent_spawn({ task, agent, cwd?, title? })` | Spawn an independent background subagent task. Runs in a new Herdr tab (or cmux surface) targeting the parent's workspace when a host is available, and headless in the background otherwise. **Prefer reusing existing subagents** via `agent_send` for related/follow-up work to maintain context and maximize prompt cache and memory efficiency. Tool description lists available agent names and roles, excluding disabled or hidden definitions. Deferred by default; discover via `tool_search({ query: "agent" })`. Do not poll for completion; results return automatically. |
|
|
19
|
-
| `agent_send({ id, message, mode? })` | Send `steer
|
|
19
|
+
| `agent_send({ id, message, mode? })` | Send input to a specific child. `mode: "steer"` (the default) enters the current turn once its tool calls are in, before the next model request; `mode: "follow_up"` waits until the child has no tool calls or steering left, then continues as a new turn. **Primary tool for assigning follow-up or functionally related tasks** to existing subagents: idle, blocked, done, or errored children resume their existing session automatically with historical context intact. A child whose runtime has ended is resumed the same way; spawn a new child only for new work. Stop first only when send says the previous process is still running. Deferred by default; discover via `tool_search({ query: "agent" })`. |
|
|
20
20
|
| `agent_get({ id, keys? })` | Inspect one subagent by id. `keys` is a comma-separated selection of `status` (default), `progress` (default), and `diagnostic`; unknown keys fail. The view never returns the child's task parameters or terminal result, which arrive automatically as reports. From the second successful inspection of the same child in this parent runtime, the result adds a short reminder that results return automatically and must not be polled. Deferred by default; discover via `tool_search({ query: "agent" })`. |
|
|
21
21
|
| `agent_stop({ id })` | Stop one subagent's runtime by id. The child keeps its session, so a later `agent_send` can resume it. Deferred by default; discover via `tool_search({ query: "agent" })`. |
|
|
22
22
|
|
package/dist/domain.d.ts
CHANGED
|
@@ -8,7 +8,16 @@ export declare function normalizeSubagentState(value: unknown): SubagentState |
|
|
|
8
8
|
* is created, because it decides who holds the process for the rest of the child's life.
|
|
9
9
|
*/
|
|
10
10
|
export type Presentation = "panel" | "background";
|
|
11
|
-
|
|
11
|
+
/**
|
|
12
|
+
* How `agent_send` hands its message to a child.
|
|
13
|
+
*
|
|
14
|
+
* `steer` enters the current assistant turn once its tool calls are in, before the next model
|
|
15
|
+
* request, so it redirects work already in flight. `follow_up` waits until the child's run has no
|
|
16
|
+
* tool calls or steering left, then continues as a new turn in the same run. There is no "auto":
|
|
17
|
+
* the two queues already are the two situations, so the caller picks instead of guessing from the
|
|
18
|
+
* child's state.
|
|
19
|
+
*/
|
|
20
|
+
export type SendMode = "steer" | "follow_up";
|
|
12
21
|
export type VisualSubagentState = SubagentState;
|
|
13
22
|
export declare function toVisualSubagentState(state: SubagentState, interrupted?: string): VisualSubagentState;
|
|
14
23
|
export declare const VISUAL_SUBAGENT_GLYPH: Record<VisualSubagentState, string>;
|
package/dist/manager.js
CHANGED
|
@@ -923,7 +923,7 @@ export class SubagentManager {
|
|
|
923
923
|
return failed;
|
|
924
924
|
}
|
|
925
925
|
}
|
|
926
|
-
send(id, rawMessage, mode = "
|
|
926
|
+
send(id, rawMessage, mode = "steer", signal) {
|
|
927
927
|
const message = stripHindsightContent(rawMessage);
|
|
928
928
|
this.#bumpActivity(id);
|
|
929
929
|
this.#clearSettledPanelClose(id);
|
|
@@ -994,15 +994,10 @@ export class SubagentManager {
|
|
|
994
994
|
}
|
|
995
995
|
}
|
|
996
996
|
const state = isResumed ? "running" : record.state;
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
? "steer"
|
|
1002
|
-
: "follow_up"
|
|
1003
|
-
: mode;
|
|
1004
|
-
if (operation === undefined)
|
|
1005
|
-
return failure("send", "Cannot infer send mode from unknown state", id, state);
|
|
997
|
+
// A resume already starts a fresh run, so the mode has nothing to decide: the message is
|
|
998
|
+
// that run's prompt. Otherwise the caller's mode is the request, with no state guessing:
|
|
999
|
+
// a running child steers at its next model step, an idle one simply starts a run.
|
|
1000
|
+
const operation = isResumed ? "prompt" : mode;
|
|
1006
1001
|
if (signal?.aborted)
|
|
1007
1002
|
return failure("send", "Send was cancelled", id, state);
|
|
1008
1003
|
this.#clearSettledPanelClose(id);
|
|
@@ -55,7 +55,7 @@ function spawnPresentation(args, result) {
|
|
|
55
55
|
function sendPresentation(args, result) {
|
|
56
56
|
const record = isRecord(args) ? args : undefined;
|
|
57
57
|
const id = stringField(record, "id") ?? "agent";
|
|
58
|
-
const mode = stringField(record, "mode") ?? "
|
|
58
|
+
const mode = stringField(record, "mode") ?? "steer";
|
|
59
59
|
const message = stringField(record, "message");
|
|
60
60
|
const confirmation = result === undefined ? undefined : agentResultText(result);
|
|
61
61
|
const copy = message === undefined
|
package/dist/tools.js
CHANGED
|
@@ -18,7 +18,9 @@ const spawnSchema = Type.Object({
|
|
|
18
18
|
const sendSchema = Type.Object({
|
|
19
19
|
id: Type.String({ minLength: 1, description: "Subagent id, e.g. agent-1" }),
|
|
20
20
|
message: Type.String({ minLength: 1 }),
|
|
21
|
-
mode: Type.Optional(Type.Union([Type.Literal("steer"), Type.Literal("follow_up"),
|
|
21
|
+
mode: Type.Optional(Type.Union([Type.Literal("steer"), Type.Literal("follow_up")], {
|
|
22
|
+
description: "steer (the default) enters the child's current turn once its tool calls are in, before the next model request, so it redirects work already in flight; an idle child just starts a run. follow_up waits until the child has no tool calls or steering left, then continues as a new turn. Use follow_up for work that must not interrupt what the child is doing now.",
|
|
23
|
+
})),
|
|
22
24
|
});
|
|
23
25
|
const idSchema = Type.Object({
|
|
24
26
|
id: Type.String({ minLength: 1, description: "Subagent id, e.g. agent-1" }),
|
|
@@ -66,7 +68,7 @@ function getSpawnDescription(agents) {
|
|
|
66
68
|
formatAvailableAgents(agents),
|
|
67
69
|
].join("\n");
|
|
68
70
|
}
|
|
69
|
-
const SEND_DESCRIPTION = "Send input
|
|
71
|
+
const SEND_DESCRIPTION = "Send input to an existing subagent (e.g. 'agent-1'), resuming its session when it is idle, blocked, done, or errored. A child whose runtime has ended is resumed the same way: send to that id, do not spawn a replacement. Stop it first only when send reports the previous process is still running. Results are returned automatically when the task finishes; do not poll agent_get. Related subagent tools: agent_spawn, agent_get, agent_stop.";
|
|
70
72
|
const GET_DESCRIPTION = "Inspect one subagent's status, progress, or diagnostic details by id (e.g. 'agent-1'). Use keys to choose fields; defaults to 'status,progress'. Results are returned automatically; use this for inspection, not completion polling. Related subagent tools: agent_spawn, agent_send, agent_stop.";
|
|
71
73
|
const STOP_DESCRIPTION = "Stop a subagent's runtime by id (e.g. 'agent-1'). The child keeps its session, so a later agent_send can resume it. Related subagent tools: agent_spawn, agent_send, agent_get.";
|
|
72
74
|
const CONTACT_DESCRIPTION = "Notify the parent session when you are BLOCKED and cannot continue without parent decision or intervention. Do NOT call this on success or task completion: simply output your final answer directly as normal text in your response, and the harness will automatically capture and report your result to the parent.";
|