shariq-pi-extensions 0.2.6 → 0.2.7

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.
@@ -38,7 +38,7 @@ The goal extension adds persistent, branch-safe objectives, progress evidence, b
38
38
 
39
39
  The subagent extension runs flat Pi child agents with profiles, capability policies, continuation, result delivery, optional worktrees, and a dashboard. Configuration lives in `<agent-dir>/subagents.json`; trusted projects may override it through their Pi config directory. The configured concurrency ceiling is 50.
40
40
 
41
- The extension supplies tools including `spawn_agent`, `task`, `check_agent`, `list_agents`, `wait_agent`, `send_message`, `close_agent`, `reply_question`, and `apply_agent_changes`. Child settlement is handed to Pi immediately as a turn-triggering follow-up, so Pi queues it while the parent is active or starts a new parent turn when idle; status tools are for explicit inspection, not waiting.
41
+ The extension supplies tools including `spawn_agent`, `task`, `check_agent`, `list_agents`, `wait_agent`, `send_message`, `close_agent`, `reply_question`, and `apply_agent_changes`. Child settlement is handed to Pi immediately as an extension-originated user follow-up, so Pi queues it while the parent is active or starts a new parent turn when idle with the summary guaranteed in model context; status tools are for explicit inspection, not waiting.
42
42
 
43
43
  ### [Orchestration](../extensions/orchestration/README.md)
44
44
 
@@ -50,7 +50,7 @@ The model-facing `create_orchestration` tool starts planning only after an expli
50
50
 
51
51
  Managed PTYs support servers, watchers, long builds, downloads, and interactive processes. The extension tracks up to eight concurrent terminals, retains bounded output, stores full logs in restrictive temporary directories, and stops process groups during shutdown or reload.
52
52
 
53
- Its tools are `start_terminal`, `read_terminal`, `write_terminal`, `list_terminals`, and `stop_terminal`. A model-started terminal immediately hands its completion or failure to Pi as a turn-triggering follow-up, which Pi queues while the parent is active or uses to start a new parent turn when idle. Reading a terminal does not suppress that delivery; agents should inspect only for explicit progress requests or immediate interaction.
53
+ Its tools are `start_terminal`, `read_terminal`, `write_terminal`, `list_terminals`, and `stop_terminal`. A model-started terminal immediately hands its completion or failure to Pi as an extension-originated user follow-up, which Pi queues while the parent is active or uses to start a new parent turn when idle with the bounded output guaranteed in model context. Reading a terminal does not suppress that delivery; agents should inspect only for explicit progress requests or immediate interaction.
54
54
 
55
55
  ## Web access
56
56
 
@@ -10,7 +10,7 @@ Session-scoped background pseudo-terminals for Pi. The extension combines Codex-
10
10
  - `list_terminals` — list running and settled terminals.
11
11
  - `stop_terminal` — stop complete process groups with TERM-to-KILL escalation.
12
12
 
13
- Each output response carries a byte cursor. Pass it to the next read/write operation to avoid repeating output. Long or uncertain commands should use `start_terminal` instead of a large blocking `bash` timeout. Settlement is handed to Pi immediately: it queues a follow-up while the parent is active or starts a new parent turn when idle, so the parent can continue other work or end its turn rather than poll.
13
+ Each output response carries a byte cursor. Pass it to the next read/write operation to avoid repeating output. Long or uncertain commands should use `start_terminal` instead of a large blocking `bash` timeout. Settlement is handed to Pi immediately as an extension-originated user follow-up: it queues while the parent is active or starts a new parent turn when idle with bounded output guaranteed in model context, so the parent can continue other work or end its turn rather than poll.
14
14
 
15
15
  ## User interface
16
16
 
@@ -34,7 +34,7 @@ Each output response carries a byte cursor. Pass it to the next read/write opera
34
34
  - Output is sanitized before TUI or model rendering.
35
35
  - Processes run in their own PTY process group and are stopped on session shutdown, replacement, or reload.
36
36
  - Shutdown and stop operations are bounded and escalate from SIGTERM to SIGKILL.
37
- - Model-started terminals immediately hand one completion/failure follow-up to Pi; Pi queues it while the parent is active or starts the next parent turn when idle.
37
+ - Model-started terminals immediately hand one model-visible completion/failure follow-up to Pi; Pi queues it while the parent is active or starts the next parent turn when idle.
38
38
  - Reading settled output does not consume or suppress the automatic completion delivery.
39
39
  - Completion delivery is keyed by terminal id to prevent duplicate follow-ups.
40
40
 
@@ -8,7 +8,7 @@ Internal runtime utilities used by more than one extension. This directory is no
8
8
  - `child-session.ts` owns trust-aware child resources and bounded session shutdown.
9
9
  - `context-utilization.ts` formats model-context usage and capacity.
10
10
  - `dashboard-state.ts` keeps list selection stable as live rows change.
11
- - `settlement-delivery.ts` immediately hands asynchronous results to Pi as turn-triggering follow-ups.
11
+ - `settlement-delivery.ts` immediately hands asynchronous results to Pi as extension-originated user follow-ups, guaranteeing model-visible settlement context.
12
12
  - `tool-call-timeout.ts` applies cancellation-aware execution limits to registered tools.
13
13
  - `tui-dashboard.ts` provides bounded, sanitized terminal-dashboard rendering helpers.
14
14
 
@@ -3,9 +3,17 @@ import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
3
3
  type SettlementMessage = Parameters<ExtensionAPI["sendMessage"]>[0];
4
4
 
5
5
  /**
6
- * Hand settlement to Pi immediately. Pi starts a turn when idle and queues the
7
- * same message as a follow-up when the parent is still running.
6
+ * Hand settlement to Pi as an extension-originated user follow-up. A custom
7
+ * message can wake the parent yet fail to appear in the invoked model turn;
8
+ * sendUserMessage guarantees that the bounded result is model-visible. Pi
9
+ * starts a turn when idle and queues the same input while the parent is active.
8
10
  */
9
11
  export function deliverSettlement(pi: ExtensionAPI, message: SettlementMessage): void {
10
- pi.sendMessage(message, { deliverAs: "followUp", triggerTurn: true });
12
+ const content = typeof message.content === "string"
13
+ ? message.content
14
+ : message.content
15
+ .filter((part) => part.type === "text")
16
+ .map((part) => part.text)
17
+ .join("\n");
18
+ pi.sendUserMessage(content, { deliverAs: "followUp" });
11
19
  }
@@ -19,7 +19,7 @@ The system is deliberately flat. Only the main Pi thread can spawn subagents. Ch
19
19
  - `reply_question` — answer a child’s blocking `ask_parent` request
20
20
  - `task` — atomically reserve capacity for up to the configured limit (maximum 50), start the fan-out in the background, and return child ids immediately
21
21
 
22
- Child sessions receive `message_parent`, `ask_parent`, `list_peers`, and `message_peer`. Peer messages are routed through the main-thread manager and can steer a running child or continue a settled one; they cannot create agents. Child settlement is handed to Pi immediately: it queues a follow-up while the parent is active or starts a new parent turn when idle, so the main turn can continue independent work or end and remain available to the user.
22
+ Child sessions receive `message_parent`, `ask_parent`, `list_peers`, and `message_peer`. Peer messages are routed through the main-thread manager and can steer a running child or continue a settled one; they cannot create agents. Child settlement is handed to Pi immediately as an extension-originated user follow-up: it queues while the parent is active or starts a new parent turn when idle with the summary guaranteed in model context, so the main turn can continue independent work or end and remain available to the user.
23
23
 
24
24
  ## Profiles and capabilities
25
25
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shariq-pi-extensions",
3
- "version": "0.2.6",
3
+ "version": "0.2.7",
4
4
  "description": "Cross-platform extension suite for the Pi coding agent.",
5
5
  "license": "MIT",
6
6
  "author": "Shariq Riaz",
@@ -24,9 +24,9 @@ Provide:
24
24
  - the working directory when it differs from the current directory;
25
25
  - an initial wait only when startup output is needed for the next decision.
26
26
 
27
- After startup, continue only genuinely useful independent work. If none remains, end the turn immediately. Ending the turn is the waiting mechanism: terminal settlement is handed to Pi immediately, queued as a follow-up if the parent is still active, and otherwise starts the next parent turn with the final status and bounded output. Do not keep the current turn alive to wait, invent monitoring work, or call terminal tools merely to see whether the process finished.
27
+ After startup, continue only genuinely useful independent work. If none remains, end the turn immediately. Ending the turn is the waiting mechanism: terminal settlement is handed to Pi immediately as an extension-originated user follow-up, queued if the parent is still active, and otherwise starts the next parent turn with the final status and bounded output visible in model context. Do not keep the current turn alive to wait, invent monitoring work, or call terminal tools merely to see whether the process finished.
28
28
 
29
- When that completion follow-up invokes the next turn, treat its attached output as the terminal result and continue the original task immediately. Do not wait for another user message, announce that you are still waiting, or call `read_terminal` to retrieve the same result again. If `start_terminal` itself returns a settled result, the output is already synchronous and no second completion notice is needed.
29
+ When that completion follow-up invokes the next turn, treat its model-visible output as the terminal result and continue the original task immediately. Do not wait for another user message, announce that you are still waiting, or call `read_terminal` to retrieve the same result again. If `start_terminal` itself returns a settled result, the output is already synchronous and no second completion notice is needed.
30
30
 
31
31
  ## Inspect and interact only when necessary
32
32
 
@@ -24,14 +24,14 @@ This skill governs temporary Pi child agents. The `codex-thread-orchestrator` sk
24
24
 
25
25
  ## Wait by notification; inspect progress only when justified
26
26
 
27
- A successful `spawn_agent` or `task` call starts asynchronous work and returns control to the parent. When a child finishes, its settlement is handed to Pi immediately, queued as a follow-up if the parent is still active, and otherwise starts the next main-agent turn. The parent does not need to remain active or check once before ending its turn.
27
+ A successful `spawn_agent` or `task` call starts asynchronous work and returns control to the parent. When a child finishes, its settlement is handed to Pi immediately as an extension-originated user follow-up, queued if the parent is still active, and otherwise starts the next main-agent turn with the summary visible in model context. The parent does not need to remain active or check once before ending its turn.
28
28
 
29
29
  After dispatch:
30
30
 
31
31
  1. Continue only parent work that is independently useful to the requested result.
32
32
  2. If no such work remains, end the turn immediately. A short progress note is enough when the user needs one.
33
33
  3. Do not call `wait_agent`, `list_agents`, or `check_agent` in the same turn merely because the child was just launched. Ending the turn is the waiting mechanism.
34
- 4. When a child completion notice invokes the main agent, treat the attached summary as the child result and continue the original task immediately. Reconcile completed results, launch any intentionally queued work if capacity requires waves, and otherwise keep waiting through notifications. Do not wait for the user to prompt you again or call a status tool to retrieve the same result.
34
+ 4. When a child completion notice invokes the main agent, treat its model-visible summary as the child result and continue the original task immediately. Reconcile completed results, launch any intentionally queued work if capacity requires waves, and otherwise keep waiting through notifications. Do not wait for the user to prompt you again or call a status tool to retrieve the same result.
35
35
 
36
36
  A progress check is reasonable when the user asks for status, a child has run materially longer than expected for its task and model, an interruption left its state unclear, or current status will change an immediate coordination decision. Prefer `check_agent` for one known child and `list_agents` for a batch overview. Use `wait_agent` to collect results already expected to be available, not as a running-status probe.
37
37