@vicary/pi-subagents 0.89.0 → 0.89.2

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.
Files changed (79) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/bundle/agents.js +3 -3
  3. package/bundle/child-tool-plan.js +2 -2
  4. package/bundle/{chunk-7W2IQFP4.js → chunk-464OJSDP.js} +4 -4
  5. package/bundle/{chunk-ETDE2VYK.js → chunk-4KQW5R6U.js} +2 -2
  6. package/bundle/{chunk-PFZZMVD5.js → chunk-4X3T5CPK.js} +12 -12
  7. package/bundle/{chunk-JRO2CU4D.js → chunk-5TXWZB73.js} +1 -1
  8. package/bundle/{chunk-CFIYO2IV.js → chunk-62OHSCQ6.js} +64 -12
  9. package/bundle/{chunk-7J4ZXMY7.js → chunk-72334PEI.js} +6 -4
  10. package/bundle/{chunk-S77ZKDLS.js → chunk-77VQEATI.js} +1 -1
  11. package/bundle/{chunk-HZDLR73C.js → chunk-AHGJSJYY.js} +4 -3
  12. package/bundle/{chunk-4ALRHKGE.js → chunk-DGLXVN3F.js} +1 -1
  13. package/bundle/{chunk-SLLZJ5EC.js → chunk-DHY5TY2Y.js} +237 -199
  14. package/bundle/{chunk-OVBUEVOT.js → chunk-DNDNLHTL.js} +11 -11
  15. package/bundle/{chunk-NQ26PJSQ.js → chunk-FF5K5HQU.js} +11 -6
  16. package/bundle/{chunk-HSHLPYCQ.js → chunk-FO2GIU5F.js} +27 -18
  17. package/bundle/{chunk-JFACGAJT.js → chunk-JEYG7CNC.js} +8 -4
  18. package/bundle/{chunk-7JLNWAMO.js → chunk-LODNNILA.js} +99 -30
  19. package/bundle/{chunk-GHJ6BH5U.js → chunk-LWH7IGI3.js} +8 -0
  20. package/bundle/{chunk-UQT2EQ4U.js → chunk-Q4VH72JI.js} +2 -2
  21. package/bundle/{chunk-443LPCRI.js → chunk-RHKIP45B.js} +6 -6
  22. package/bundle/{chunk-SWL2EITY.js → chunk-RHMU7SXN.js} +2 -2
  23. package/bundle/{chunk-WW6GQBBS.js → chunk-SRCMJY4F.js} +4 -4
  24. package/bundle/{chunk-KOLLMZ2X.js → chunk-SWGB2P5J.js} +1 -1
  25. package/bundle/{chunk-ZSCIHMUI.js → chunk-TXC7WIPL.js} +3 -2
  26. package/bundle/{chunk-6JD4XCA4.js → chunk-U753SUBC.js} +14 -6
  27. package/bundle/{chunk-A3INCQ6Z.js → chunk-UUW7P6KJ.js} +1 -1
  28. package/bundle/{chunk-MJHQIUU7.js → chunk-V4543APA.js} +33 -24
  29. package/bundle/{chunk-EPMRDKQT.js → chunk-VEEUXJDO.js} +1 -1
  30. package/bundle/{chunk-LEPIY76E.js → chunk-W7NDPDDJ.js} +8 -8
  31. package/bundle/{chunk-NONHDYXE.js → chunk-YJIU5WF4.js} +1 -1
  32. package/bundle/control-channel.js +2 -2
  33. package/bundle/index.js +1 -1
  34. package/bundle/intercom-bridge.js +2 -2
  35. package/bundle/preflight.js +12 -10
  36. package/bundle/project-panes.js +4 -4
  37. package/docs/agents.md +2 -2
  38. package/docs/observability.md +3 -1
  39. package/docs/watchdog.md +3 -2
  40. package/package.json +2 -2
  41. package/src/api/preflight.d.ts +1 -0
  42. package/src/api/preflight.js +2 -1
  43. package/src/extension/herdr-pi-bridge.js +1 -1
  44. package/src/inspectors/herdr/project-panes.d.ts +2 -0
  45. package/src/inspectors/herdr/project-panes.js +7 -1
  46. package/src/inspectors/shell-command.d.ts +2 -1
  47. package/src/inspectors/shell-command.js +7 -5
  48. package/src/runs/background/active-async-capacity.js +2 -1
  49. package/src/runs/background/active-run-index.d.ts +1 -0
  50. package/src/runs/background/active-run-index.js +3 -0
  51. package/src/runs/background/async-execution.d.ts +2 -0
  52. package/src/runs/background/async-execution.js +3 -2
  53. package/src/runs/background/async-job-tracker.js +85 -9
  54. package/src/runs/background/async-status.d.ts +2 -0
  55. package/src/runs/background/async-status.js +8 -3
  56. package/src/runs/background/process-terminal.d.ts +6 -0
  57. package/src/runs/background/process-terminal.js +34 -2
  58. package/src/runs/background/run-status.js +2 -1
  59. package/src/runs/background/stale-run-reconciler.d.ts +8 -0
  60. package/src/runs/background/stale-run-reconciler.js +38 -8
  61. package/src/runs/background/workflow-terminal-proof.d.ts +0 -1
  62. package/src/runs/background/workflow-terminal-proof.js +4 -4
  63. package/src/runs/foreground/execution.js +2 -2
  64. package/src/runs/foreground/subagent-executor.d.ts +2 -0
  65. package/src/runs/foreground/subagent-executor.js +10 -1
  66. package/src/runs/shared/herdr-machine.js +3 -1
  67. package/src/runs/shared/herdr-pane-host.js +10 -2
  68. package/src/runs/shared/mcp-config-sources.d.ts +1 -0
  69. package/src/runs/shared/mcp-config-sources.js +1 -1
  70. package/src/runs/shared/mcp-direct-tool-allowlist.js +1 -0
  71. package/src/runs/shared/subagent-prompt-runtime.js +6 -5
  72. package/src/shared/types.d.ts +2 -0
  73. package/src/shared/utils.d.ts +2 -0
  74. package/src/shared/utils.js +9 -0
  75. package/src/tui/fleet-transcript.js +21 -9
  76. package/src/watchdog/runtime.d.ts +4 -0
  77. package/src/watchdog/runtime.js +50 -12
  78. package/src/watchdog/turn-delta.d.ts +2 -0
  79. package/src/watchdog/turn-delta.js +21 -0
package/CHANGELOG.md CHANGED
@@ -2,6 +2,41 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [0.89.2] - 2026-11-20
6
+
7
+ ### Highlights
8
+
9
+ - Subagents in a Herdr pane (`machine: "local"`) no longer fail to start, and Herdr project panes on Windows now work in Git Bash.
10
+ - In `/subagents-fleet`, expanded tool details show a `bash` call's whole command, including multiline scripts.
11
+ - A workflow child with a `label` is named by that label in its session name, terminal title and Fleet row.
12
+ - The child watchdog no longer tells you to undo work the supervisor approved.
13
+ - Subagents can use MCP servers configured with `"openUi": false`.
14
+
15
+ ### Fixed
16
+
17
+ - A subagent placed in a Herdr pane (`machine: "local"`) no longer fails to start with `is not an active named agent`. Herdr holds a newly started agent as pending until something asks for its state, so retrying the first prompt alone never got through. pi-subagents now waits for the agent to be ready before it prompts again. Thanks to [@TheEdgeOfRage](https://github.com/TheEdgeOfRage) for #3312.
18
+ - On Windows, a Herdr project pane now starts Pi when the pane runs Git Bash or another POSIX shell. The launch command was always written for PowerShell, so a Git Bash pane failed with `syntax error near unexpected token '&'` and never started. Thanks to [@mystery4f](https://github.com/mystery4f) for #3306.
19
+ - In `/subagents-fleet`, expanding tool details (`x` or `Ctrl+O`) now shows a `bash` call's whole command, every line wrapped to the pane, while it runs and after it finishes. Before, a multiline script such as a heredoc was cut to one line. When the saved arguments were too large to keep in full, the expanded view shows what was saved and says it was truncated. Thanks to [@power22c](https://github.com/power22c) for the report (#3308).
20
+ - A subagent started from a workflow script with a short `label` (for example `runs.run("tests", { label: "Validate sanitizer tests", agent: "worker", task: "…" })`) is now named by that label: its session name and Pi terminal title read `worker: Validate sanitizer tests`, and its Fleet row reads `Validate sanitizer tests (worker)`. Before, only the workflow's own row used the label, and the subagent was named after the first words of its task, so several children of the same agent were hard to tell apart. Thanks to [@power22c](https://github.com/power22c) for the report (#3309).
21
+ - The child watchdog no longer warns that a change the supervisor approved was unauthorised. When a subagent asks its supervisor a question and follows the answer, the watchdog now always sees that question and answer, even in a long run whose earlier turns no longer fit in its review. Before, the answer could drop out, and the watchdog reported the instruction as missing and suggested undoing correct work. The watchdog is also told when earlier turns were left out, so it doesn't treat missing evidence as proof. Thanks to [@mannainsect](https://github.com/mannainsect) for the report (#3307).
22
+ - A subagent that lists `mcp:<server>` in its `tools` now starts when that server's MCP config sets `"openUi": false`. Before, it failed with `Unresolved MCP direct-tool selectors` even though the server was connected, because pi-mcp-adapter 7 counts that setting when it checks its cached tool list and pi-subagents did not (#3310). Thanks to [@carlesba](https://github.com/carlesba) for #3311.
23
+ - A workflow no longer waits forever when one of its background subagents finishes after the Pi that started it has exited, for example because Pi was restarted. Once the subagent's process is confirmed gone, the workflow treats it as finished. Thanks to [@tdslot](https://github.com/tdslot) for the report (#3304).
24
+
25
+ ## [0.89.1] - 2026-11-18
26
+
27
+ ### Highlights
28
+
29
+ - Subagents limited to a list of `tools` work again alongside extensions that keep a tool switched off on purpose, such as pi-web-access.
30
+ - A background subagent keeps showing as running when its status file can't be read, instead of being marked failed and dropped.
31
+ - Stopping a subagent in a Herdr or Rex pane now actually stops it.
32
+
33
+ ### Fixed
34
+
35
+ - A subagent limited to a list of `tools` no longer stops before its first request when an extension keeps one of those tools inactive on purpose, as pi-web-access does with `web_enable`. 0.89.0 treated that tool as replaced by another extension and failed the child with a misleading error. The check now fails the child only when a tool it can call is missing from the request, so a child whose tools pi-fabric's code mode swapped out still stops early. Thanks to [@chpock](https://github.com/chpock) for the report (#3296).
36
+ - A background subagent whose status file can't be read, for example after its permissions changed, now still counts as running. Before, a session that reopened while the subagent was working showed no active subagents and told hosts such as pi-web it was idle, and a session already open marked the subagent failed and dropped it about 10 seconds later. The run is kept until its status can be read again, then tracked normally, or dropped if it belongs to another session. Thanks to [@jordan-quan](https://github.com/jordan-quan) for the report (#3295).
37
+ - Stopping a subagent that runs in a Herdr or Rex pane now stops its current turn. Before, the stop request failed in the subagent's Pi with `api.abort is not a function`. Thanks to [@guneriu](https://github.com/guneriu) for the report (#3300).
38
+ - `machine: "local"` from a Pi running in a Herdr Core terminal (`hc`, the Herdr app's terminal server) now fails with an error that says Herdr Core is not supported. Before, the error said Pi was not running in Herdr, which was confusing inside the Herdr app. Only the herdr terminal multiplexer and Rex are supported. Thanks to [@guneriu](https://github.com/guneriu) for the report (#3300).
39
+
5
40
  ## [0.89.0] - 2026-11-16
6
41
 
7
42
  ### Highlights
package/bundle/agents.js CHANGED
@@ -2,11 +2,11 @@ import {
2
2
  RUNTIME_AGENT_REGISTER_EVENT,
3
3
  RUNTIME_AGENT_REGISTER_VERSION,
4
4
  registerAgentViaEvents
5
- } from "./chunk-JRO2CU4D.js";
5
+ } from "./chunk-5TXWZB73.js";
6
6
  import {
7
7
  registerRuntimeAgent
8
- } from "./chunk-KOLLMZ2X.js";
9
- import "./chunk-GHJ6BH5U.js";
8
+ } from "./chunk-SWGB2P5J.js";
9
+ import "./chunk-LWH7IGI3.js";
10
10
  import "./chunk-JEZOSEWG.js";
11
11
  import "./chunk-YFCK7H2S.js";
12
12
  import "./chunk-QXASAHIA.js";
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  resolvePiLaunchToolPlan
3
- } from "./chunk-HZDLR73C.js";
3
+ } from "./chunk-AHGJSJYY.js";
4
4
  import "./chunk-YARY7JWU.js";
5
- import "./chunk-GHJ6BH5U.js";
5
+ import "./chunk-LWH7IGI3.js";
6
6
  import "./chunk-JEZOSEWG.js";
7
7
  import "./chunk-YFCK7H2S.js";
8
8
  import "./chunk-QXASAHIA.js";
@@ -12,7 +12,7 @@ import {
12
12
  summarizeContextModes,
13
13
  utf8Tail,
14
14
  workflowPreflightLaneForRuntimeKey
15
- } from "./chunk-6JD4XCA4.js";
15
+ } from "./chunk-U753SUBC.js";
16
16
  import {
17
17
  ownsRun
18
18
  } from "./chunk-HXRB42AF.js";
@@ -34,11 +34,11 @@ import {
34
34
  updateActiveRunIndex,
35
35
  validateModelResponseAliases,
36
36
  writeAsyncResultFile
37
- } from "./chunk-SLLZJ5EC.js";
37
+ } from "./chunk-DHY5TY2Y.js";
38
38
  import {
39
39
  deliverStopRequest,
40
40
  stopInboxClosedPath
41
- } from "./chunk-A3INCQ6Z.js";
41
+ } from "./chunk-UUW7P6KJ.js";
42
42
  import {
43
43
  SUBAGENT_STOPPED_MESSAGE,
44
44
  formatDuration,
@@ -50,7 +50,7 @@ import {
50
50
  waitToolName,
51
51
  writeAtomicJson,
52
52
  writePrivateAtomicJson
53
- } from "./chunk-GHJ6BH5U.js";
53
+ } from "./chunk-LWH7IGI3.js";
54
54
  import {
55
55
  DIRS
56
56
  } from "./chunk-JEZOSEWG.js";
@@ -11,13 +11,13 @@ import {
11
11
  validateAuthorityPolicy,
12
12
  validateMissionStoreConfig,
13
13
  validateModelResponseAliases
14
- } from "./chunk-SLLZJ5EC.js";
14
+ } from "./chunk-DHY5TY2Y.js";
15
15
  import {
16
16
  getAgentDir,
17
17
  readStatus,
18
18
  validatePermissionConfig,
19
19
  writePrivateAtomicJson
20
- } from "./chunk-GHJ6BH5U.js";
20
+ } from "./chunk-LWH7IGI3.js";
21
21
  import {
22
22
  FLEET_KEYBINDING_ACTIONS,
23
23
  RUNNER_LAUNCHER_NAME_PATTERN,
@@ -1,32 +1,32 @@
1
1
  import {
2
2
  rewriteSubagentPrompt
3
- } from "./chunk-LEPIY76E.js";
3
+ } from "./chunk-W7NDPDDJ.js";
4
4
  import {
5
5
  package_default
6
- } from "./chunk-4ALRHKGE.js";
6
+ } from "./chunk-DGLXVN3F.js";
7
7
  import {
8
8
  WATCHDOG_DIFF_TOOL_NAME,
9
9
  captureWatchdogDiffBaseline,
10
10
  createWatchdogDiffTool
11
- } from "./chunk-CFIYO2IV.js";
12
- import "./chunk-6JD4XCA4.js";
13
- import "./chunk-EPMRDKQT.js";
11
+ } from "./chunk-62OHSCQ6.js";
12
+ import "./chunk-U753SUBC.js";
13
+ import "./chunk-VEEUXJDO.js";
14
14
  import {
15
15
  MODEL_ONLY_TOOL
16
16
  } from "./chunk-HXRB42AF.js";
17
17
  import "./chunk-W2BZS6UC.js";
18
18
  import {
19
19
  appendAgentRefinementOverlay
20
- } from "./chunk-UQT2EQ4U.js";
21
- import "./chunk-SLLZJ5EC.js";
20
+ } from "./chunk-Q4VH72JI.js";
21
+ import "./chunk-DHY5TY2Y.js";
22
22
  import "./chunk-NIXWDZZV.js";
23
- import "./chunk-NONHDYXE.js";
23
+ import "./chunk-YJIU5WF4.js";
24
24
  import "./chunk-7F6RKT6W.js";
25
25
  import {
26
26
  assertNoToolModifierEntries
27
- } from "./chunk-HZDLR73C.js";
27
+ } from "./chunk-AHGJSJYY.js";
28
28
  import "./chunk-YARY7JWU.js";
29
- import "./chunk-S77ZKDLS.js";
29
+ import "./chunk-77VQEATI.js";
30
30
  import {
31
31
  HERDR_PI_MAX_ACCEPTANCE_PROMPT_BYTES,
32
32
  HERDR_PI_MAX_FRAME_BYTES,
@@ -44,7 +44,7 @@ import {
44
44
  discoverAgents,
45
45
  resolveExistingReadPaths,
46
46
  resolveSkills
47
- } from "./chunk-GHJ6BH5U.js";
47
+ } from "./chunk-LWH7IGI3.js";
48
48
  import "./chunk-JEZOSEWG.js";
49
49
  import "./chunk-YFCK7H2S.js";
50
50
  import "./chunk-QXASAHIA.js";
@@ -188,7 +188,7 @@ ${answer}` }], details };
188
188
  api.sendUserMessage(request.text ?? "");
189
189
  } else if (request.operation === "steer") api.sendUserMessage(request.text ?? "", { deliverAs: "steer" });
190
190
  else if (request.operation === "follow-up") api.sendUserMessage(request.text ?? "", { deliverAs: "followUp" });
191
- else if (request.operation === "abort") api.abort();
191
+ else if (request.operation === "abort") ctx.abort();
192
192
  else {
193
193
  const entry = request.supervisorId ? supervisor.get(request.supervisorId) : void 0;
194
194
  if (!entry) throw new Error("Unknown supervisor request.");
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  registerRuntimeAgent
3
- } from "./chunk-KOLLMZ2X.js";
3
+ } from "./chunk-SWGB2P5J.js";
4
4
 
5
5
  // src/agents/runtime-agent-events.ts
6
6
  var RUNTIME_AGENT_REGISTER_EVENT = "pi-subagents:runtime-agent-register:v1";
@@ -8,7 +8,7 @@ import {
8
8
  projectTimeoutRecovery,
9
9
  readAsyncRecoveryDescriptor,
10
10
  utf8Tail
11
- } from "./chunk-6JD4XCA4.js";
11
+ } from "./chunk-U753SUBC.js";
12
12
  import {
13
13
  MAX_ARGS_BYTES,
14
14
  MAX_ARGS_DEPTH,
@@ -21,10 +21,10 @@ import {
21
21
  resultFilePath,
22
22
  resultPayloadMatchesSessionRun,
23
23
  resultPayloadPathForSessionRun
24
- } from "./chunk-SLLZJ5EC.js";
24
+ } from "./chunk-DHY5TY2Y.js";
25
25
  import {
26
26
  PROJECT_SUBAGENTS_RELATIVE_DIR
27
- } from "./chunk-S77ZKDLS.js";
27
+ } from "./chunk-77VQEATI.js";
28
28
  import {
29
29
  listBackgroundWorkWakeChannels,
30
30
  snapshotBackgroundWork
@@ -50,7 +50,7 @@ import {
50
50
  waitToolName,
51
51
  withSettingsFileLease,
52
52
  writePrivateAtomicJson
53
- } from "./chunk-GHJ6BH5U.js";
53
+ } from "./chunk-LWH7IGI3.js";
54
54
  import {
55
55
  DIRS,
56
56
  INTERCOM_DETACH_REQUEST_EVENT,
@@ -3364,12 +3364,30 @@ function formatWatchdogOrchestrationActivity(event) {
3364
3364
  }
3365
3365
  return sections.join("\n\n");
3366
3366
  }
3367
+ function formatWatchdogSupervisorReplies(event) {
3368
+ const turn = event;
3369
+ if (turn?.type !== "turn_end" || !Array.isArray(turn.message?.content) || !Array.isArray(turn.toolResults)) return [];
3370
+ const entries = [];
3371
+ for (const call of turn.message.content) {
3372
+ if (call?.type !== "toolCall" || call.name !== "contact_supervisor" || typeof call.id !== "string") continue;
3373
+ const args2 = call.arguments;
3374
+ if (!args2 || typeof args2 !== "object" || !["need_decision", "interview_request"].includes(args2.reason)) continue;
3375
+ const result2 = turn.toolResults.find((value) => {
3376
+ const result3 = value;
3377
+ return result3?.role === "toolResult" && result3.toolCallId === call.id && result3.toolName === call.name && result3.isError !== true && !result3.error;
3378
+ });
3379
+ if (result2) entries.push([formatToolCall(call.name, args2), formatWatchdogReviewMessage(result2) ?? ""].join("\n\n"));
3380
+ }
3381
+ return entries;
3382
+ }
3367
3383
 
3368
3384
  // src/watchdog/runtime.ts
3369
3385
  var DEFAULT_REVIEW = () => ({ warnings: [] });
3370
3386
  var MAX_REVIEW_INPUT_CHARS = 24e3;
3371
3387
  var REVIEW_INPUT_HEAD_CHARS = 6e3;
3372
3388
  var REVIEW_DELTA_SEPARATOR = "\n\n---\n\n";
3389
+ var MAX_SUPERVISOR_REPLY_CHARS = 3e3;
3390
+ var MAX_SUPERVISOR_REPLIES_CHARS = 6e3;
3373
3391
  function boundWatchdogReviewText(text, cap = MAX_REVIEW_INPUT_CHARS) {
3374
3392
  if (text.length <= cap) return text;
3375
3393
  const head = Math.min(REVIEW_INPUT_HEAD_CHARS, Math.floor(cap / 4));
@@ -3380,6 +3398,11 @@ function boundWatchdogReviewText(text, cap = MAX_REVIEW_INPUT_CHARS) {
3380
3398
  `;
3381
3399
  return `${text.slice(0, head)}${marker}${text.slice(text.length - (cap - head - marker.length))}`;
3382
3400
  }
3401
+ function omittedDeltaNote(chars) {
3402
+ return `[Parts of this run's turn delta omitted: about ${chars} characters are not shown, to fit the review input limit. Do not report an instruction, authorization, or action as absent unless the supplied evidence shows it; it may be in an omitted part.]`;
3403
+ }
3404
+ var OMITTED_NOTE_RESERVE = omittedDeltaNote(Number.MAX_SAFE_INTEGER).length + 2;
3405
+ var MAX_RETAINED_DELTA_CHARS = MAX_REVIEW_INPUT_CHARS - OMITTED_NOTE_RESERVE;
3383
3406
  function errorMessage2(error) {
3384
3407
  return error instanceof Error ? error.message : String(error);
3385
3408
  }
@@ -3411,6 +3434,7 @@ var MainWatchdogRuntime = class {
3411
3434
  status = "idle";
3412
3435
  pendingDeltas = [];
3413
3436
  pendingDeltaChars = 0;
3437
+ omittedDeltaChars = 0;
3414
3438
  guard = new WatchdogEmissionGuard();
3415
3439
  guardMaxWarnings = null;
3416
3440
  epoch = 0;
@@ -3449,6 +3473,7 @@ var MainWatchdogRuntime = class {
3449
3473
  activityTail = "";
3450
3474
  activityPending = false;
3451
3475
  activityReviewUsed = false;
3476
+ supervisorReplies = [];
3452
3477
  constructor(options = {}) {
3453
3478
  this.cwd = options.cwd ?? process.cwd();
3454
3479
  this.resolveConfig = options.resolveConfig ?? resolveWatchdogConfig;
@@ -3551,7 +3576,10 @@ var MainWatchdogRuntime = class {
3551
3576
  this.lspLedger.reset();
3552
3577
  this.lastLspSnapshot = void 0;
3553
3578
  }
3554
- if (options.clearScope) this.scope.reset();
3579
+ if (options.clearScope) {
3580
+ this.scope.reset();
3581
+ this.supervisorReplies = [];
3582
+ }
3555
3583
  if (options.clearScope || options.clearActivity) this.clearActivity();
3556
3584
  if (options.clearReviewInputSignature) this.lastReviewInputSignature = void 0;
3557
3585
  if (options.resetChangeSignature) this.resetRepoChangeBaseline({ reviewed: true });
@@ -3575,6 +3603,7 @@ var MainWatchdogRuntime = class {
3575
3603
  this.lastLspSnapshot = void 0;
3576
3604
  this.lspLedger.reset();
3577
3605
  this.scope.reset();
3606
+ this.supervisorReplies = [];
3578
3607
  this.observedRepoEditThisTurn = false;
3579
3608
  this.toolResultsThisRun = 0;
3580
3609
  this.midRunReviewing = false;
@@ -3609,6 +3638,7 @@ var MainWatchdogRuntime = class {
3609
3638
  this.activityPending = true;
3610
3639
  }
3611
3640
  }
3641
+ this.retainSupervisorReplies(event);
3612
3642
  this.observedRepoEditThisTurn ||= eventIndicatesRepoEdit(event);
3613
3643
  const delta = formatWatchdogTurnDelta({
3614
3644
  includeUserPrompt: this.includeUserPromptInNextDelta,
@@ -4056,37 +4086,59 @@ var MainWatchdogRuntime = class {
4056
4086
  appendBoundedDelta(delta) {
4057
4087
  let entry = delta.trim();
4058
4088
  if (!entry) return;
4059
- if (entry.length > MAX_REVIEW_INPUT_CHARS) entry = boundWatchdogReviewText(entry);
4089
+ if (entry.length > MAX_RETAINED_DELTA_CHARS) {
4090
+ this.omittedDeltaChars += entry.length - MAX_RETAINED_DELTA_CHARS;
4091
+ entry = boundWatchdogReviewText(entry, MAX_RETAINED_DELTA_CHARS);
4092
+ }
4060
4093
  this.pendingDeltas.push(entry);
4061
4094
  this.pendingDeltaChars += entry.length;
4062
- while (this.pendingDeltas.length > 1 && this.pendingDeltaChars + (this.pendingDeltas.length - 1) * REVIEW_DELTA_SEPARATOR.length > MAX_REVIEW_INPUT_CHARS) {
4095
+ while (this.pendingDeltas.length > 1 && this.pendingDeltaChars + (this.pendingDeltas.length - 1) * REVIEW_DELTA_SEPARATOR.length > MAX_RETAINED_DELTA_CHARS) {
4063
4096
  const removed = this.pendingDeltas.shift();
4064
- if (removed) this.pendingDeltaChars -= removed.length;
4097
+ if (removed) {
4098
+ this.pendingDeltaChars -= removed.length;
4099
+ this.omittedDeltaChars += removed.length;
4100
+ }
4065
4101
  }
4066
4102
  }
4103
+ // Kept outside the rolling delta so a long run cannot push the supervisor's instruction out of the review input.
4104
+ retainSupervisorReplies(event) {
4105
+ for (const reply of formatWatchdogSupervisorReplies(event)) this.supervisorReplies.push(boundWatchdogReviewText(reply, MAX_SUPERVISOR_REPLY_CHARS));
4106
+ let total = this.supervisorReplies.reduce((sum, reply) => sum + reply.length, 0);
4107
+ while (this.supervisorReplies.length > 1 && total > MAX_SUPERVISOR_REPLIES_CHARS) total -= this.supervisorReplies.shift().length;
4108
+ }
4067
4109
  buildReviewInput(changeSignature, lspBlock = "") {
4068
4110
  const input = this.pendingDeltas.join(REVIEW_DELTA_SEPARATOR);
4069
4111
  const scopeBlock = this.scopeBlock();
4070
4112
  const changes = changeSignature?.changedPaths.length ? ["Changed repo paths: every dirty path in the working tree. Authorship is not verified; a path may predate this session or come from another session.", ...changeSignature.changedPaths.slice(0, 200).map((file) => `- ${file}`)].join("\n") : "";
4071
4113
  const activity = this.activityTail ? `Recent delivered orchestration activity (oldest first; bounded observations, not a task board; waits/holds are not evidence of neglect):
4072
4114
  ${this.activityTail}` : "";
4115
+ const supervisor = this.configResult.config.scope.enabled && this.supervisorReplies.length ? `Supervisor replies this agent received through contact_supervisor (oldest first; the orchestrator's answers to this agent's questions, which can authorize or redirect its work):
4116
+ ${this.supervisorReplies.join(REVIEW_DELTA_SEPARATOR)}` : "";
4073
4117
  const contextPieces = [scopeBlock, changes, lspBlock, activity].filter(Boolean);
4074
- if (!contextPieces.length) return boundWatchdogReviewText(input);
4118
+ if (!contextPieces.length && !supervisor) return this.boundDeltaInput(input, MAX_REVIEW_INPUT_CHARS);
4075
4119
  const maxContextLength = Math.floor(MAX_REVIEW_INPUT_CHARS / 2);
4076
4120
  const maxPieceLength = Math.max(1e3, Math.floor(maxContextLength / contextPieces.length));
4077
- const boundedContext = contextPieces.map((piece) => piece.length > maxPieceLength ? piece === activity ? boundWatchdogReviewText(piece, maxPieceLength) : `${piece.slice(0, maxPieceLength - 6)}
4078
- - ...` : piece).join(REVIEW_DELTA_SEPARATOR);
4121
+ const boundedContext = [...contextPieces.map((piece) => piece.length > maxPieceLength ? piece === activity ? boundWatchdogReviewText(piece, maxPieceLength) : `${piece.slice(0, maxPieceLength - 6)}
4122
+ - ...` : piece), supervisor].filter(Boolean).join(REVIEW_DELTA_SEPARATOR);
4079
4123
  const separatorLength = input ? REVIEW_DELTA_SEPARATOR.length : 0;
4080
4124
  const inputBudget = MAX_REVIEW_INPUT_CHARS - boundedContext.length - separatorLength;
4081
- const boundedInput = inputBudget <= 0 ? "" : boundWatchdogReviewText(input, inputBudget);
4125
+ const boundedInput = inputBudget <= 0 ? "" : this.boundDeltaInput(input, inputBudget);
4082
4126
  return [boundedContext, boundedInput].filter(Boolean).join(REVIEW_DELTA_SEPARATOR);
4083
4127
  }
4128
+ boundDeltaInput(input, cap) {
4129
+ if (!input || this.omittedDeltaChars === 0 && input.length <= cap) return input;
4130
+ const bodyCap = cap - OMITTED_NOTE_RESERVE;
4131
+ return `${omittedDeltaNote(this.omittedDeltaChars + Math.max(0, input.length - bodyCap))}
4132
+
4133
+ ${boundWatchdogReviewText(input, bodyCap)}`;
4134
+ }
4084
4135
  scopeBlock() {
4085
4136
  return this.configResult.config.scope.enabled ? this.scope.render() : "";
4086
4137
  }
4087
4138
  clearPendingDeltas() {
4088
4139
  this.pendingDeltas = [];
4089
4140
  this.pendingDeltaChars = 0;
4141
+ this.omittedDeltaChars = 0;
4090
4142
  }
4091
4143
  clearActivity() {
4092
4144
  if (!this.activityTail) return;
@@ -6,10 +6,12 @@ function shellQuote(value, platform) {
6
6
  function isBareExecutable(value) {
7
7
  return /^[\w./@:-]+$/.test(value);
8
8
  }
9
- function formatShellCommand(exe, args, platform = process.platform) {
10
- const quotedArgs = args.map((arg) => shellQuote(arg, platform));
11
- if (platform === "win32") return `& ${[shellQuote(exe, platform), ...quotedArgs].join(" ")}`;
12
- const invocation = isBareExecutable(exe) ? exe : `sh -c 'exec "$0" "$@"' ${shellQuote(exe, platform)}`;
9
+ function formatShellCommand(exe, args, platform = process.platform, flavor = "auto") {
10
+ const posix = flavor === "posix" || flavor === "auto" && platform !== "win32";
11
+ const quotePlatform = posix ? "linux" : platform;
12
+ const quotedArgs = args.map((arg) => shellQuote(arg, quotePlatform));
13
+ if (!posix) return `& ${[shellQuote(exe, quotePlatform), ...quotedArgs].join(" ")}`;
14
+ const invocation = isBareExecutable(exe) ? exe : `sh -c 'exec "$0" "$@"' ${shellQuote(exe, quotePlatform)}`;
13
15
  return [invocation, ...quotedArgs].join(" ");
14
16
  }
15
17
 
@@ -2,7 +2,7 @@ import {
2
2
  createAtomicJsonWriter,
3
3
  getAgentDir,
4
4
  readStatus
5
- } from "./chunk-GHJ6BH5U.js";
5
+ } from "./chunk-LWH7IGI3.js";
6
6
  import {
7
7
  DIRS,
8
8
  TEMP_ARTIFACTS_DIR,
@@ -7,7 +7,7 @@ import {
7
7
  getAgentDir,
8
8
  getConfigDirName,
9
9
  getProjectConfigDir
10
- } from "./chunk-GHJ6BH5U.js";
10
+ } from "./chunk-LWH7IGI3.js";
11
11
  import {
12
12
  TEMP_ROOT_DIR
13
13
  } from "./chunk-JEZOSEWG.js";
@@ -51,7 +51,7 @@ function isMcpServerDefinition(value) {
51
51
  for (const field of ["env", "headers"]) {
52
52
  if (value[field] !== void 0 && !isStringRecord(value[field])) return false;
53
53
  }
54
- for (const field of ["exposeResources", "literalEnv", "inheritEnv"]) {
54
+ for (const field of ["exposeResources", "literalEnv", "inheritEnv", "openUi"]) {
55
55
  if (value[field] !== void 0 && typeof value[field] !== "boolean") return false;
56
56
  }
57
57
  if (value.requestHeadersCommand !== void 0 && !isRequestHeadersCommand(value.requestHeadersCommand)) return false;
@@ -802,7 +802,8 @@ function computeMcpServerHash(definition) {
802
802
  exposeResources: definition.exposeResources,
803
803
  includeTools: definition.includeTools,
804
804
  excludeTools: definition.excludeTools,
805
- protocolVersion: definition.protocolVersion
805
+ protocolVersion: definition.protocolVersion,
806
+ ...definition.openUi === false ? { openUi: false } : {}
806
807
  };
807
808
  return createHash("sha256").update(stableStringify(identity)).digest("hex");
808
809
  }
@@ -1,7 +1,7 @@
1
1
  // package.json
2
2
  var package_default = {
3
3
  name: "pi-subagents",
4
- version: "0.89.0",
4
+ version: "0.89.2",
5
5
  private: true,
6
6
  description: "Pi extension for single-agent delegation and scripted multi-agent workflows",
7
7
  author: "Nico Bailon",