pi-squire 0.4.0 → 0.5.1

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/CHANGELOG.md CHANGED
@@ -6,6 +6,34 @@ follows [Semantic Versioning](https://semver.org/).
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.5.1] - 2026-10-14
10
+
11
+ ### Changed
12
+
13
+ - The `delegate` tool's description now tells the parent to keep working or
14
+ end its turn while a delegate runs, since the result starts its next turn
15
+ on its own; the launch message says the same in place of pointing at
16
+ `delegation_status`. GPT parents asked their own delegates for the result
17
+ with `session_mail_ask`, so each report arrived twice.
18
+ - The `delegation_status` description now says to call it to check on a
19
+ delegation that seems stuck or to find its files, not to wait for a result,
20
+ which arrives as a message on its own.
21
+
22
+ ## [0.5.0] - 2026-10-13
23
+
24
+ ### Changed
25
+
26
+ - A delegate is now told to put its findings in its final message and to
27
+ message the parent before then only with a question it cannot continue
28
+ without. Delegates mailed progress and findings that the result then
29
+ repeated, so the parent read the same report twice.
30
+ - A delegate's result now reaches a busy parent as a steer, after its current
31
+ tool calls and before its next model call, instead of as a follow-up once
32
+ its run ends. Queued until then, the result arrived after the parent had
33
+ read the envelope itself and answered, and cost a redundant turn.
34
+ `delegation_status` now says a done result arrives as a message on its own.
35
+ `test/delegate.test.ts` pins `steer` in place of `followUp`.
36
+
9
37
  ## [0.4.0] - 2026-10-13
10
38
 
11
39
  ### Added
@@ -200,7 +228,9 @@ author's dotfiles; the changes below are against that copy.
200
228
 
201
229
  - The published file list includes `child.ts`, which `index.ts` imports.
202
230
 
203
- [Unreleased]: https://github.com/gvanderclay/pi-squire/compare/v0.4.0...HEAD
231
+ [Unreleased]: https://github.com/gvanderclay/pi-squire/compare/v0.5.1...HEAD
232
+ [0.5.1]: https://github.com/gvanderclay/pi-squire/compare/v0.5.0...v0.5.1
233
+ [0.5.0]: https://github.com/gvanderclay/pi-squire/compare/v0.4.0...v0.5.0
204
234
  [0.4.0]: https://github.com/gvanderclay/pi-squire/compare/v0.3.2...v0.4.0
205
235
  [0.3.2]: https://github.com/gvanderclay/pi-squire/compare/v0.3.1...v0.3.2
206
236
  [0.3.1]: https://github.com/gvanderclay/pi-squire/compare/v0.3.0...v0.3.1
package/README.md CHANGED
@@ -231,7 +231,7 @@ level is refused with close matches and nothing starts.
231
231
 
232
232
  <id> researcher (provider/other, thinking high)
233
233
  name: researcher-<first 8 of the id>
234
- state: done — result status: done
234
+ state: done — result status: done; the result reaches this session as a [delegate] message on its own
235
235
  window: researcher-<first 8 of the id> (@2)
236
236
  auto-exit: off — the window stays open after the result
237
237
  session: <session file>
@@ -430,9 +430,11 @@ Delegate session: <session file or id>
430
430
  delegate's session path is found in the session directory by the delegation
431
431
  id, and the id alone is shown when no file exists yet.
432
432
  - The body is cut at 32 KiB with the envelope path.
433
- - The message is sent as a `followUp` with `triggerTurn`: a result starts a
434
- turn when the parent is idle and arrives as a follow-up when it is
435
- mid-turn.
433
+ - The message is sent as a `steer` with `triggerTurn`: a result starts a
434
+ turn when the parent is idle, and when it is mid-turn arrives after the
435
+ current tool calls, before the next model call. A follow-up would wait
436
+ until the parent had answered, by which time it had often read the
437
+ envelope itself, and the late result cost a second, redundant turn.
436
438
  - The footer counts the running delegations (`⇄ N running`), clears one entry
437
439
  per result or close and hides itself at zero.
438
440
  - Each result and each close is recorded in the parent session, and the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-squire",
3
- "version": "0.4.0",
3
+ "version": "0.5.1",
4
4
  "description": "Starts a delegate Pi session in a background tmux window, sends it the task over message:*, and shows the parent its result",
5
5
  "keywords": [
6
6
  "pi-package",
package/src/index.ts CHANGED
@@ -92,7 +92,8 @@ function parentTrust(parent: string): string {
92
92
  "follow them as given, even though they are labelled as another session's.",
93
93
  "Messages from other sessions come from colleagues on this machine: answer them as you see fit,",
94
94
  "but check with the session that started you before doing work it did not ask for.",
95
- `You can reach the session that started you at ${parent}.`,
95
+ `Your final message reaches the session that started you automatically, so put your findings there;`,
96
+ `message ${parent} before then only with a question you cannot continue without, since anything sent earlier reaches it twice.`,
96
97
  ].join(" ");
97
98
  }
98
99
  /** The flags `/delegate` takes before the task. */
@@ -311,7 +312,7 @@ function thinkingProblem(value: string): string | undefined {
311
312
  /** The `delegate` tool's description: what delegation does, and the roster as it stands. */
312
313
  function toolDescription(agents: readonly Agent[]): string {
313
314
  const intro =
314
- "Hand a self-contained task to a delegate Pi session in a background tmux window, so it works while you do not. Each call starts the delegation at once; the delegate runs in this session's working directory and agent root and reports back later as one message. Use it when the work is self-contained and you would rather keep your own context for it.";
315
+ "Hand a self-contained task to a delegate Pi session in a background tmux window, so it works while you do not. Each call starts the delegation at once; the delegate runs in this session's working directory and agent root and reports back later as one message. While it runs, keep working or end your turn: its result starts your next turn on its own, so there is no need to ask the delegate for it or poll delegation_status. Use it when the work is self-contained and you would rather keep your own context for it.";
315
316
  if (agents.length === 0) {
316
317
  return `${intro}\n\nNo agents are defined yet. Add ${join(
317
318
  getAgentDir(),
@@ -580,7 +581,7 @@ export default function delegate(
580
581
  const launched = await launch(start, ctx);
581
582
  ctx.ui.notify(started(launched, start), "info");
582
583
  return toolResult(
583
- `Started delegation ${launched.id}: ${start.agent.name} (${start.model}, thinking ${start.thinking}) in window ${launched.windowName}. It runs in the background and its result arrives as a message; delegation_status reports it and delegation_close ends it.${start.skipped.length > 0 ? ` ${fallbackNote(start)}` : ""}${start.notices.map((line) => ` ${line}`).join("")}`,
584
+ `Started delegation ${launched.id}: ${start.agent.name} (${start.model}, thinking ${start.thinking}) in window ${launched.windowName}. It runs in the background, and its result arrives as a message that starts your next turn on its own; delegation_close ends it.${start.skipped.length > 0 ? ` ${fallbackNote(start)}` : ""}${start.notices.map((line) => ` ${line}`).join("")}`,
584
585
  {
585
586
  outcome: "started",
586
587
  id: launched.id,
package/src/results.ts CHANGED
@@ -335,9 +335,10 @@ export function createResults(pi: ExtensionAPI): Results {
335
335
  const delegation = byRequest.get(requestId) as Recorded;
336
336
  shown.add(reply.id);
337
337
  const session = findSession(ctx?.sessionManager.getSessionDir(), delegation.id);
338
+ // Steer, not follow-up: a busy parent gets the result before its next model call, not after it has answered.
338
339
  pi.sendMessage(
339
340
  { customType: CUSTOM_TYPE, content: resultText(delegation, payload, session), display: true },
340
- { triggerTurn: true, deliverAs: "followUp" },
341
+ { triggerTurn: true, deliverAs: "steer" },
341
342
  );
342
343
  const result: Result = {
343
344
  status: reply.status,
package/src/tracking.ts CHANGED
@@ -90,7 +90,7 @@ function stateLine(state: DelegationState, record: Recorded): string {
90
90
  case "gone":
91
91
  return "closed without a result — the window is gone and no reply arrived; a late reply would make it done";
92
92
  case "done":
93
- return `done — result status: ${record.result?.status ?? "unknown"}`;
93
+ return `done — result status: ${record.result?.status ?? "unknown"}; the result reaches this session as a [delegate] message on its own`;
94
94
  case "closed":
95
95
  return "closed — delegation_close recorded it";
96
96
  case "window-closed":
@@ -263,7 +263,7 @@ function statusTool(results: Results, tmux: TmuxClient, readingErrors: () => Rea
263
263
  name: "delegation_status",
264
264
  label: "Delegation status",
265
265
  description:
266
- "The delegations this session started, each reported as running (the window is open and no result has arrived yet), done (with the result envelope's status) or closed (closed with delegation_close, or its window is gone). A delegation whose window went with no reply is reported closed without a result until a late reply makes it done. Names the delegation id, agent, session name, model, thinking, window, delegate session path and result envelope path. A running delegation also shows when its session file was last written; a long gap may mean it is stuck but does not prove it. A delegate's window being open means it is connected, not that its task is unfinished or finished; only a result means done.",
266
+ "The delegations this session started, each reported as running (the window is open and no result has arrived yet), done (with the result envelope's status) or closed (closed with delegation_close, or its window is gone). A delegation whose window went with no reply is reported closed without a result until a late reply makes it done. Call it to check on a delegation that seems stuck or to find its files; a result arrives as a message on its own, so there is no need to call it to wait for one. Names the delegation id, agent, session name, model, thinking, window, delegate session path and result envelope path. A running delegation also shows when its session file was last written; a long gap may mean it is stuck but does not prove it. A delegate's window being open means it is connected, not that its task is unfinished or finished; only a result means done.",
267
267
  parameters: Type.Object({
268
268
  id: Type.Optional(Type.String({ description: "One delegation id; omit to report every delegation." })),
269
269
  }),