pi-famulus 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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-famulus",
3
- "version": "0.2.6",
3
+ "version": "0.2.7",
4
4
  "description": "Keep your main agent's context clean: subagents on cheaper models, long bash in the background, and monitors that wake the agent. One Rust daemon runs the shells.",
5
5
  "keywords": [
6
6
  "pi-package",
@@ -54,12 +54,12 @@
54
54
  "pi-famulus": "./bin/pi-famulus.js"
55
55
  },
56
56
  "optionalDependencies": {
57
- "pi-famulus-linux-x64": "0.2.6",
58
- "pi-famulus-linux-arm64": "0.2.6",
59
- "pi-famulus-darwin-x64": "0.2.6",
60
- "pi-famulus-darwin-arm64": "0.2.6",
61
- "pi-famulus-win-x64": "0.2.6",
62
- "pi-famulus-win-arm64": "0.2.6"
57
+ "pi-famulus-linux-x64": "0.2.7",
58
+ "pi-famulus-linux-arm64": "0.2.7",
59
+ "pi-famulus-darwin-x64": "0.2.7",
60
+ "pi-famulus-darwin-arm64": "0.2.7",
61
+ "pi-famulus-win-x64": "0.2.7",
62
+ "pi-famulus-win-arm64": "0.2.7"
63
63
  },
64
64
  "pi": {
65
65
  "extensions": [
@@ -18,7 +18,7 @@ import { famulusPaths } from "./config";
18
18
  import { realClock, type Clock, type ClockTimer } from "./clock";
19
19
 
20
20
  const MAX_FRAME_BYTES = 4 * 1024 * 1024; // 4 MiB (§3.3)
21
- const EXTENSION_VERSION = "0.2.6";
21
+ const EXTENSION_VERSION = "0.2.7";
22
22
  export { EXTENSION_VERSION };
23
23
  // 6: hosted subagents. 7: the extension's messaging bridge (`intercom`
24
24
  // request plus `intercom`/`intercom_reset` events).
@@ -21,6 +21,7 @@ import { realClock, type Clock, type ClockTimer } from "../clock";
21
21
 
22
22
  import type { NotifyCenter } from "../notify";
23
23
  import { statusGlyph, toolComponent } from "../tui/tool-component";
24
+ import { truncateToWidth } from "../tui/pi-tui-load";
24
25
  import { scrubTty } from "../tui/conversation-view";
25
26
  import type { WorkIndex } from "../work-index";
26
27
  import { fill, PROMPTS } from "../prompts.generated";
@@ -732,6 +733,42 @@ export function createSubagentTool(
732
733
  promptSnippet: PROMPTS["tools.subagent.snippet"],
733
734
  promptGuidelines: [...PROMPTS["tools.subagent.rules"]],
734
735
  parameters: subagentParameters,
736
+ renderCall(args, theme, context) {
737
+ const summary: string[] = [];
738
+ if (typeof args?.action === "string" && /^[a-z]+$/.test(args.action)) summary.push(args.action);
739
+ if (Array.isArray(args?.tasks)) summary.push(`${args.tasks.length} ${args.tasks.length === 1 ? "task" : "tasks"}`);
740
+ if (Array.isArray(args?.chain)) summary.push(`chain · ${args.chain.length} ${args.chain.length === 1 ? "step" : "steps"}`);
741
+ if (typeof args?.concurrency === "number") summary.push(`concurrency ${args.concurrency}`);
742
+
743
+ const state = context.state as { callHeader?: { piExpanded: boolean; expanded: boolean } };
744
+ // When Pi changes its expansion state (e.g. Ctrl+O), drop the local override.
745
+ if (state.callHeader?.piExpanded !== context.expanded) {
746
+ state.callHeader = { piExpanded: context.expanded, expanded: context.expanded };
747
+ }
748
+ const callHeader = state.callHeader;
749
+ const expanded = callHeader.expanded;
750
+ const title = `${theme.fg("muted", expanded ? "▾" : "▸")} ${theme.fg("toolTitle", theme.bold("subagent"))}`;
751
+ const header = [title, ...summary.map((part) => theme.fg("muted", part))].join(" · ");
752
+ const body = expanded ? toolComponent(
753
+ // JSON quotes C0 controls; escape DEL and C1 controls too before sending to the terminal.
754
+ JSON.stringify(args ?? {}, null, 2).replace(/[\u007f-\u009f]/g, (ch) => `\\u${ch.charCodeAt(0).toString(16).padStart(4, "0")}`)
755
+ .split("\n").map((line) => theme.fg("muted", line)),
756
+ ) : undefined;
757
+ return {
758
+ render(width) {
759
+ return [truncateToWidth(header, width), ...(body?.render(width) ?? [])];
760
+ },
761
+ invalidate() {},
762
+ handleMouse(event) {
763
+ if (event.type !== "click" || event.button !== "left") return undefined;
764
+ // Pi's default click is gated on having a result. Consume the click
765
+ // here so it toggles only the arguments, even while the call is running.
766
+ callHeader.expanded = !expanded;
767
+ context.invalidate();
768
+ return { handled: true };
769
+ },
770
+ };
771
+ },
735
772
  renderResult(result, { expanded }, theme, context) {
736
773
  const details = result.details as { run_id?: string; status?: string } | undefined;
737
774
  const record = details?.run_id ? deps.getRegistry()?.get(details.run_id) : undefined;