@polygraph/opencode-plugin 0.4.27 → 0.4.28

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.
@@ -21,13 +21,12 @@ The main agent provides these parameters in the prompt:
21
21
  | `repo` | Repository to delegate to (e.g., `org/repo-name`) |
22
22
  | `instruction` | The task instruction for the child agent |
23
23
  | `context` | (Optional) Additional context to pass to the child agent |
24
- | `taskId` | (Optional) Existing active task to route a user-approved follow-up to; omit on the first call for a new run |
25
24
 
26
25
  ## Delegating work
27
26
 
28
- Call the `spawn_agent` tool to start a child agent on the repo or to route an explicit follow-up to an active task. If the main agent supplied a `taskId` - meaning this is a user-approved follow-up turn against an already active task - forward it unchanged; otherwise omit `taskId` and a new child run is started.
27
+ Call the `spawn_agent` tool to start a child agent on the repo or to send a follow-up to an active task. Follow-up routing is automatic: if the repo already has an active child task (working or paused on input), the orchestrator delivers your `instruction` to that task as a follow-up message; otherwise it starts a new child run.
29
28
 
30
- `repo` must be a repository other than the one the parent agent is working in — never delegate into the parent's own repo. A repo has at most one active child: if it already has one, pass `taskId` to route the message to it instead of starting a new run.
29
+ `repo` must be a repository other than the one the parent agent is working in — never delegate into the parent's own repo. A repo has at most one active child: while one is active, any `spawn_agent` call for that repo is routed to it as a follow-up rather than starting a second run.
31
30
 
32
31
  **Resume/reconstruction is read-only.** If the parent asks you to resume, reconnect, restore, or reconstruct a preserved session without an explicit new change request from the user, do not call `spawn_agent` to continue work. Use `show_agent` only as needed to read status/log context, return a concise restoration summary, and stop. After resuming, wait for explicit user instructions before any child agent makes changes.
33
32
 
@@ -36,8 +35,7 @@ spawn_agent(
36
35
  sessionId: "<sessionId>",
37
36
  repo: "<repo>",
38
37
  instruction: "<instruction>",
39
- context: "<context>",
40
- taskId: "<taskId>" // optional - pass only for a user-approved follow-up to an active task
38
+ context: "<context>"
41
39
  )
42
40
  ```
43
41
 
@@ -66,8 +64,6 @@ After calling `spawn_agent`, parse the structured JSON response:
66
64
  { "taskId": "…", "message": "…", "status": "delegated" }
67
65
  ```
68
66
 
69
- Store the returned `taskId`. You will pass it back to `spawn_agent` on any follow-up turn so the orchestrator routes the message to the same active task instead of starting a new run.
70
-
71
67
  Then poll `show_agent` on a backoff cadence. **Do not pass a `tail` argument** — the tool's default is sized for status polling. Only set `tail` if you have a specific reason (e.g., the default truncated output you actually need to inspect, or you are hunting for an earlier failure that scrolled off). Never ratchet `tail` upward across polls; that is what causes the polling loop to flood your context window.
72
68
 
73
69
  For each child in the response (field: `children[]`), inspect:
@@ -84,7 +80,7 @@ State machine:
84
80
  - Read `child.inputRequiredQuestion`.
85
81
  - Surface this question verbatim to the parent/user: "The child agent in `{child.repoFullName}` needs input: {child.inputRequiredQuestion}".
86
82
  - Wait for the parent/user to supply an answer.
87
- - Call `spawn_agent` again with `instruction: <the answer>` and `taskId: <stored taskId>` so the orchestrator routes the answer to the same active task.
83
+ - Call `spawn_agent` again with the same `repo` and `instruction: <the answer>` the orchestrator routes it to the active task automatically.
88
84
  - Resume polling.
89
85
 
90
86
  3. `child.status === 'permission-required'` — child is paused waiting for a permission grant decision:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@polygraph/opencode-plugin",
3
- "version": "0.4.27",
3
+ "version": "0.4.28",
4
4
  "description": "AI agent skills and subagents for Polygraph multi-repo coordination",
5
5
  "license": "UNLICENSED",
6
6
  "private": false,
@@ -20,23 +20,25 @@ Polygraph functionality is available via both MCP tools and CLI commands. Use wh
20
20
  | --- | --- | --- |
21
21
  | `list_repos` | `polygraph repo list` | Discover candidate repositories with descriptions and graph relationships |
22
22
  | `start_session` | `polygraph session start --repo <ids>` | Initialize a Polygraph session with selected repositories |
23
- | `spawn_agent` | — | Start a new child task or send an explicit follow-up to an active task in another repository. Input: `{ sessionId, repo, instruction, context?, taskId? }`. Output: `{ taskId, message, status: 'delegated' }`. Pass the `taskId` returned by a prior call to route a follow-up message to a specific active task; omit to start a new child run. A repo has at most one active child at a time: while a task is active in a repo, pass `taskId` to follow up — never start a second concurrent run in the same repo. A session resume or reconstruction is read-only context restoration; after resuming, do not use `spawn_agent` to continue changes unless the user explicitly asks for changes. |
24
- | `show_agent` | — | Poll flat per-child status for the session. Output: `{ children: PolygraphChildStatusItem[] }` where each item exposes `repositoryId`, `repoFullName`, `status`, `lastOutputLines`, `durationMs`, `instruction`, `agentType?`, `inputRequiredQuestion?`. `status` is an AcpRunStatus: `'created' \| 'in-progress' \| 'input-required' \| 'completed' \| 'failed' \| 'cancelled'` (British double-L on `'cancelled'`). `inputRequiredQuestion` is populated only when `status === 'input-required'`. |
23
+ | `spawn_agent` | — | Start a new child task or send a follow-up to an active task in another repository. Input: `{ sessionId, repo, instruction, context? }`. Output: `{ taskId, message, status: 'delegated' }`. Follow-up routing is automatic: if the repo already has an active child task, the instruction is delivered to it as a follow-up message; otherwise a new child run starts. A repo has at most one active child at a time. A session resume or reconstruction is read-only context restoration; after resuming, do not use `spawn_agent` to continue changes unless the user explicitly asks for changes. |
24
+ | `show_agent` | — | Poll flat per-child status for the session. Output: `{ children: PolygraphChildStatusItem[] }` where each item exposes `repositoryId`, `repoFullName`, `status`, `lastOutputLines`, `durationMs`, `instruction`, `agentType?`, `inputRequiredQuestion?`. `status` is an AcpRunStatus: `'created' \| 'in-progress' \| 'input-required' \| 'permission-required' \| 'completed' \| 'failed' \| 'cancelled'` (British double-L on `'cancelled'`). `inputRequiredQuestion` is populated only when `status === 'input-required'`. |
25
25
  | `stop_agent` | — | Cancel an in-progress child. Output: `{ taskId, state: 'cancelled', sessionPreserved: true, output, message }`. Because `sessionPreserved: true`, the preserved agent session can be restored later for context, but resume must wait for explicit user instructions before making changes. |
26
26
  | `push_branch` | — | Push a local git branch to the remote repository. For the repo you are in, this pushes from your current checkout. Requires a session description. |
27
27
  | `create_pr` | — | Create draft PRs with session metadata linking related PRs |
28
28
  | `show_session` | `polygraph session show <id> [--details]` | Query status of the current session. Use details when session summary, repo IDs, PR URLs, and PR descriptions are needed. |
29
- | `update_session_description` | `polygraph session update-description` | Set the current session description from a synthesized progress summary or user-provided text. This updates session metadata only; it does not require PR creation or mark-ready. |
29
+ | `update_session` | `polygraph session update --session <id> [--title] [--description]` | Update the session title and/or description (at least one required). Set the description from a synthesized progress summary or user-provided text. This updates session metadata only; it does not require PR creation or mark-ready. |
30
30
  | `link_reference` | — | Link an external reference to a session. |
31
31
  | `mark_pr_ready` | — | Mark draft PRs as ready for review |
32
32
  | `associate_pr` | — | Associate an existing PR with a session |
33
33
  | `add_repo` | — | Add repositories to a running Polygraph session. For explicit refs, pass the refs directly and skip `list_repos`. |
34
34
  | `archive_session` | `polygraph session archive <id>` | Archive a session, hiding it from active lists (it can still be resumed) |
35
35
  | `get_ci_logs` | — | Retrieve full plain-text log for a specific CI job |
36
- | | `polygraph auth login [--token]` | Authenticate with Polygraph (use `--token` for headless/CI) |
37
- | | `polygraph session list` | List all sessions |
38
- | | `polygraph account list` / `polygraph account select` | Organization management |
39
- | | `polygraph whoami` | Show current auth status and org |
36
+ | `login` | `polygraph auth login [--token]` | Authenticate with Polygraph (use `--token` for headless/CI) |
37
+ | `logout` | `polygraph auth logout` | Log out of Polygraph |
38
+ | `list_sessions` | `polygraph session list` | List sessions. By default only active sessions created by the current git user; pass `recommendedFilters: false` for all sessions. |
39
+ | `list_accounts` | `polygraph account list` | List available organizations |
40
+ | `select_account` | `polygraph account select` | Select the organization that future commands run against |
41
+ | `whoami` | `polygraph whoami` | Show current auth status and org |
40
42
 
41
43
  **Delegation rules:** `list_repos` and `start_session` MUST be called via the `polygraph-init-subagent` as described in step 0. Direct `add_repo` is allowed only when the user provides exact repo refs for an existing session. `spawn_agent` and `show_agent` MUST ALWAYS be called via `@polygraph-delegate-subagent` as described in the delegation sections below — NEVER call them directly in the main conversation.
42
44
 
@@ -69,7 +71,7 @@ The delegate/monitor/stop steps apply only when working across repos. A single-r
69
71
  4. **Monitor child agents** - Use `show_agent` to poll progress and read the flat `children[]` array for each child's `status` and `lastOutputLines`.
70
72
  5. **Stop child agents** (if needed) - Use `stop_agent` to cancel an in-progress child agent. The underlying agent session is preserved for later read-only context restoration; after a resume, wait for explicit user instructions before making changes.
71
73
  6. **Push branches** - Use `push_branch` after making commits. A required `description` must follow the Session Description Policy.
72
- 7. **Update session description** - Use `update_session_description` to update the session description; must follow the Session Description Policy. Independent of PR creation or mark-ready.
74
+ 7. **Update session description** - Use `update_session` to update the session description; must follow the Session Description Policy. Independent of PR creation or mark-ready.
73
75
  8. **Create draft PRs** - Use `create_pr` to create linked draft PRs. Always pass `description` following the Session Description Policy.
74
76
  9. **Associate existing PRs** (optional) - Use `associate_pr` to link PRs created outside Polygraph.
75
77
  10. **Query PR status** - Use `show_session` to check progress.
@@ -190,11 +192,9 @@ Use this pattern when the child may need clarification, the task is exploratory,
190
192
  { "taskId": "…", "message": "…", "status": "delegated" }
191
193
  ```
192
194
 
193
- Store the returned `taskId`. You will pass it back on any follow-up turn so the orchestrator routes the message to the same active task instead of starting a new run.
194
-
195
195
  2. Poll `show_agent`. The response shape is `{ children: PolygraphChildStatusItem[] }`. For each child, inspect:
196
196
 
197
- - `child.status` — one of `'created'`, `'in-progress'`, `'input-required'`, `'completed'`, `'failed'`, `'cancelled'` (British double-L on `'cancelled'`).
197
+ - `child.status` — one of `'created'`, `'in-progress'`, `'input-required'`, `'permission-required'`, `'completed'`, `'failed'`, `'cancelled'` (British double-L on `'cancelled'`).
198
198
  - `child.inputRequiredQuestion` — populated only when `child.status === 'input-required'`.
199
199
  - `child.lastOutputLines` — recent log tail.
200
200
  - `child.repoFullName` — which repo is talking.
@@ -202,10 +202,11 @@ Use this pattern when the child may need clarification, the task is exploratory,
202
202
  Drive the state machine:
203
203
 
204
204
  - `child.status === 'in-progress'` or `'created'` — continue polling.
205
- - `child.status === 'input-required'` — read `child.inputRequiredQuestion`, surface it to the user verbatim (e.g. "The child agent in `{child.repoFullName}` needs input: {child.inputRequiredQuestion}"), get the answer, then call `spawn_agent` again with `taskId: <stored taskId>` and `instruction: <answer>`. Continue polling.
205
+ - `child.status === 'input-required'` — read `child.inputRequiredQuestion`, surface it to the user verbatim (e.g. "The child agent in `{child.repoFullName}` needs input: {child.inputRequiredQuestion}"), get the answer, then call `spawn_agent` again with the same `repo` and `instruction: <answer>` — it is routed to the active task automatically. Continue polling.
206
206
  - `child.status === 'completed'` — read `child.lastOutputLines`, proceed to `push_branch` + `create_pr`.
207
207
  - `child.status === 'failed'` — read `child.lastOutputLines`, surface the failure.
208
208
  - `child.status === 'cancelled'` — the child was stopped via `stop_agent`; see below.
209
+ - `child.status === 'permission-required'` — the child is waiting on a permission decision; see "Handling permission requests" below.
209
210
 
210
211
  3. To abort mid-flight, call `stop_agent` with `{ sessionId, repo }`. The response is:
211
212
 
@@ -301,7 +302,7 @@ push_branch(
301
302
 
302
303
  `description` is user-facing Polygraph session context.
303
304
 
304
- `description` is required for `push_branch`, `create_pr`, `associate_pr`, and `update_session_description`. (`mark_pr_ready` does not take a description.) Use the canonical structured format:
305
+ `description` is required for `push_branch`, `create_pr`, and `associate_pr`, and is the primary input to `update_session` (which takes `title` and/or `description`). (`mark_pr_ready` does not take a description.) Use the canonical structured format:
305
306
 
306
307
  ```text
307
308
  Goal: <what the session is trying to accomplish>
@@ -637,7 +638,7 @@ Before writing:
637
638
  - If appending a new item, read the current/latest description first and write the full replacement description with the existing items plus the new item.
638
639
  - If updating or replacing the existing last item, write the resulting state directly.
639
640
 
640
- Write the description using the canonical structured format in the Session Description Policy. Then call `update_session_description` with the resulting summary.
641
+ Write the description using the canonical structured format in the Session Description Policy. Then call `update_session` with the resulting summary as `description`.
641
642
 
642
643
  ### Print Polygraph Session Details
643
644
 
@@ -670,7 +671,7 @@ If the session has a description timeline, also display:
670
671
  1. **Poll child status before proceeding** — Always verify child agents have reached a terminal `child.status` (`'completed'`, `'failed'`, or `'cancelled'`) via `show_agent` before pushing branches or creating PRs
671
672
  1. **Link PRs in descriptions** - Reference related PRs in each PR body
672
673
  1. **Keep PRs as drafts** until all repos are ready
673
- 1. **Always pass `description`** when calling `create_pr`, `associate_pr`, or `update_session_description` — it is required and must follow the Session Description Policy
674
+ 1. **Always pass `description`** when calling `create_pr`, `associate_pr`, or `update_session` — it is required and must follow the Session Description Policy
674
675
  1. **Test integration** before marking PRs ready
675
676
  1. **Coordinate merge order** if there are deployment dependencies
676
677