@polygraph/opencode-plugin 0.4.49 → 0.4.50
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.
|
@@ -18,19 +18,29 @@ The main agent already spawned the child via `spawn_agent` and received a delega
|
|
|
18
18
|
| `sessionId` | The Polygraph session ID |
|
|
19
19
|
| `id` | The delegation id returned by `spawn_agent` (e.g. `frontend-1`) |
|
|
20
20
|
|
|
21
|
+
## Two ways to poll
|
|
22
|
+
|
|
23
|
+
| MCP tool | CLI equivalent |
|
|
24
|
+
| ------------ | ------------------------------------------------------------------------------------- |
|
|
25
|
+
| `show_agent` | `polygraph agent show --session <sessionId> --id <id> --wait-for-transition-ms 300000` |
|
|
26
|
+
|
|
27
|
+
Prefer the MCP tool. It is not always there: the Polygraph MCP server may not be installed, and some harnesses are still starting it during your first turn, in which case `show_agent` is missing from your tool list rather than failing loudly. Check your available tools before the first poll. If `show_agent` is absent, or a call reports an unknown or unavailable tool, use the CLI for the rest of the loop and do not switch back.
|
|
28
|
+
|
|
29
|
+
The CLI takes the same two identifiers, blocks the same way, and prints the same payload as JSON on stdout: `{ "success": true, "sessionId": "…", "children": [ … ] }`. Read `children[0]` from it exactly as you would from the tool response. Everything below applies to whichever one you are using.
|
|
30
|
+
|
|
21
31
|
## Loop
|
|
22
32
|
|
|
23
|
-
Call
|
|
33
|
+
Call `show_agent` with exactly these arguments, repeatedly:
|
|
24
34
|
|
|
25
35
|
- `sessionId`: the session ID
|
|
26
36
|
- `id`: the delegation id
|
|
27
37
|
- `waitForTransitionMs`: 300000
|
|
28
38
|
|
|
29
|
-
Never pass `tail`.
|
|
39
|
+
Never pass `tail`. Apart from the CLI fallback above, never call any other tool, and never read files, transcripts, or logs.
|
|
30
40
|
|
|
31
41
|
Each call blocks up to 5 minutes, then returns the child's `status` on `children[0]`:
|
|
32
42
|
|
|
33
|
-
- `in-progress` or `created` →
|
|
43
|
+
- `in-progress` or `created` → poll again with the same arguments.
|
|
34
44
|
- `completed`, `failed`, `cancelled`, `input-required`, or `permission-required` → stop looping and exit with the message below.
|
|
35
45
|
|
|
36
46
|
If a call errors, retry it once. If it errors again, exit with the error text plus the delegation id and stop.
|
package/package.json
CHANGED