@arhen/pi-senja 1.5.3 → 1.5.4

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/README.md CHANGED
@@ -10,7 +10,7 @@ Forked from [pi-haiku](https://github.com/nnocte/pi-haiku) **0.2.0** by **nocte*
10
10
  - **A header** with shortcuts grouped by control, models, view, and input.
11
11
  - **A footer** with location, Git branch, session name, provider, model, thinking effort (including `max`), context bar, token usage, latest cache-hit rate, cost, OAuth subscription marker, and extension statuses.
12
12
  - **Flat tool output** — image captions, command results, and errors sit on the terminal background. Only source and diff lines get a quiet editor surface (Senja warm grey `#32302f`). Status dots and failure labels carry the state; user messages retain their own background.
13
- - **Grouped tool calls** — a single call stays on one line, e.g. `• Write example.ts ▸`. Codemode summaries can use the full pane width; all other tool summaries use at most 60% of the pane. Long titles truncate on one line, leaving room for the status and arrow. For runs longer than ten, the heading counts every call and failure, but only the latest ten calls are listed. Click **Show all** to reveal earlier calls above those ten, or **Show less** to fold history again. The control briefly brightens without scrolling through intermediate layouts (`REDUCE_MOTION=1` disables the feedback). Image reads keep Pi’s native inline image or text fallback, without a code gutter. Two or more consecutive calls to the same tool share a fixed heading, e.g. `• Ran codemode ×4 · 1 failed`. Each call occupies one tree line: `├─ script ▸` or `└─ script · failed ▸`. Click the line to open its indented native panel. The muted trailing icon changes to `▾`. Calls start collapsed by default. While running, the label has a subtle moving highlight without changing the row height (`REDUCE_MOTION=1` or `NO_COLOR=1` disables it). Click a call to open or close it at any time; partial output, success, and failure update its status without changing your choice. Expanded panels omit repeated titles and number script or file source lines (read offsets and native diff numbering are preserved). A text read opens to five wrapped lines; click its “more lines” hint to see the full read result. Image reads are not clipped. Opening a codemode row shows Pi’s native preview: at most five wrapped output lines. Click the result to see it in full; click it again to return to the preview. The row arrow closes the panel. Numbered source has a shaded row of padding above and below. Nested calls, output, and timing align with the script text, without an inner border. Pi’s tool expansion shortcut (default `Ctrl+O`) toggles all calls. Collapsed thinking is marked with a single-cell outline bulb (Nerd Font) beside `Thinking…` while streaming and `Thought` afterward. Inside a tool group, the bulb sits after the tree guide. Click the label to replace it with Pi’s thinking text without an icon, or the text to fold it back. A thinking-only turn between matching tools stays above the next call’s tree branch; elsewhere it stays in transcript order. Final replies have no marker. Parallel calls share the row once. Thinking follows its call through **Show all / Show less** and does not count toward the ten calls. A different tool or assistant prose starts a new group.
13
+ - **Grouped tool calls** — a single call stays on one line, e.g. `• Write example.ts ▸`. Titled codemode summaries can use the full pane width. Untitled script previews and other tool summaries use at most 60%. Long titles truncate on one line, leaving room for the status and arrow. For runs longer than ten, the heading counts every call and failure, but only the latest ten calls are listed. Click **Show all** to reveal earlier calls above those ten, or **Show less** to fold history again. The control briefly brightens without scrolling through intermediate layouts (`REDUCE_MOTION=1` disables the feedback). Image reads keep Pi’s native inline image or text fallback, without a code gutter. Two or more consecutive calls to the same tool share a fixed heading, e.g. `• Ran codemode ×4 · 1 failed`. Each call occupies one tree line: `├─ script ▸` or `└─ script · failed ▸`. Click the line to open its indented native panel. The muted trailing icon changes to `▾`. Calls start collapsed by default. While running, the label has a subtle moving highlight without changing the row height (`REDUCE_MOTION=1` or `NO_COLOR=1` disables it). Click a call to open or close it at any time; partial output, success, and failure update its status without changing your choice. Expanded panels omit repeated titles and number script or file source lines (read offsets and native diff numbering are preserved). A text read opens to five wrapped lines; click its “more lines” hint to see the full read result. Image reads are not clipped. Opening a codemode row shows Pi’s native preview: at most five wrapped output lines. Click the result to see it in full; click it again to return to the preview. The row arrow closes the panel. Numbered source has a shaded row of padding above and below. Nested calls, output, and timing align with the script text, without an inner border. Pi’s tool expansion shortcut (default `Ctrl+O`) toggles all calls. Collapsed thinking is marked with a single-cell outline bulb (Nerd Font) beside `Thinking…` while streaming and `Thought` afterward. Inside a tool group, the bulb sits after the tree guide. Click the label to replace it with Pi’s thinking text without an icon, or the text to fold it back. A thinking-only turn between matching tools stays above the next call’s tree branch; elsewhere it stays in transcript order. Final replies have no marker. Parallel calls share the row once. Thinking follows its call through **Show all / Show less** and does not count toward the ten calls. A different tool or assistant prose starts a new group.
14
14
  - **Shared transcript renderer** — compatible subagent views use the same renderer as the leader when Senja is enabled. Other Pi extensions can synchronously discover it via `pi.events.emit("pi:transcript-renderer", provider => { … })`. Mount with `provider.mount(chatContainer, tui, theme, starts?, cancelled?)`, render and send clicks to its `root`, and call `dispose()` when the view closes. The optional maps use tool call IDs and monotonic milliseconds (starts or frozen durations). With no provider, render the native container. This is opt-in for custom views; non-transcript panels are unchanged.
15
15
  - **Tool activity** — A call shows `preparing…` without a timer while Pi receives its arguments. Pi’s execution-start event switches the row to `running 0s`; writing the script does not count. Expanded results keep Pi’s own reported duration. Confirmed interruptions show `cancelled` before execution, or `cancelled · 8s` after it starts, without counting as failures.
16
16
  - **Codemode intent titles** — Senja asks the agent to put a short plan in a leading `// @title: Find the goal notice renderer` comment (after an optional `// @options:` line). The row displays that plan; expand it for the actual script and results. Untitled calls keep their script preview.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arhen/pi-senja",
3
- "version": "1.5.3",
3
+ "version": "1.5.4",
4
4
  "description": "Senja Gruvbox Material theme with Haiku's structured header, footer, and live timer for Pi.",
5
5
  "license": "MIT",
6
6
  "author": "arhen",
@@ -6,7 +6,7 @@ import { fileURLToPath } from "node:url";
6
6
  import { type ExtensionAPI, generateDiffString } from "@earendil-works/pi-coding-agent";
7
7
 
8
8
  export function countDiff(diff: string) {
9
- return { added: diff.match(/^\+/gm)?.length ?? 0, removed: diff.match(/^-/gm)?.length ?? 0 };
9
+ return { added: diff.match(/(?:^|\n)\+/g)?.length ?? 0, removed: diff.match(/(?:^|\n)-/g)?.length ?? 0 };
10
10
  }
11
11
 
12
12
  const lines = (s: string) => (s.match(/\n/g)?.length ?? 0) + Number(!!s && !s.endsWith("\n"));
@@ -92,7 +92,7 @@ function createShimmer(theme: Theme) {
92
92
  };
93
93
  }
94
94
 
95
- function describe(tool: ToolRow): [string, string] {
95
+ function describe(tool: ToolRow): [verb: string, subject: string, hasTitle?: boolean] {
96
96
  const a = tool.args ?? {};
97
97
  switch (tool.toolName) {
98
98
  case "read": {
@@ -119,7 +119,8 @@ function describe(tool: ToolRow): [string, string] {
119
119
  typeof code === "string"
120
120
  ? /^(?:\/\/ @options:[^\n]*\n)?\/\/ @title:[ \t]*([^\r\n]+)/.exec(code.slice(0, 2048))
121
121
  : undefined;
122
- return ["Ran", summary(title?.[1]) || summary(code)];
122
+ const plan = summary(title?.[1]);
123
+ return ["Ran", plan || summary(code), !!plan];
123
124
  }
124
125
  default:
125
126
  return ["Called", summary(a.path ?? a.query)];
@@ -625,7 +626,7 @@ export function createTranscriptView(
625
626
  if (tool.toolName === "read" ? !tool.expanded : tool.expanded) previews.delete(tool);
626
627
  const open = tool.expanded || previews.has(tool);
627
628
  const last = i === run.length - 1;
628
- const [, subject] = describe(tool);
629
+ const [, subject, hasTitle] = describe(tool);
629
630
  const start = tool.isPartial ? starts?.get(tool.toolCallId) : undefined;
630
631
  const error = tool.result?.isError && (cancelled?.has(tool.toolCallId) ? "cancelled" : "failed");
631
632
  const running = start !== undefined || tool.executionStarted;
@@ -634,7 +635,7 @@ export function createTranscriptView(
634
635
  state === "cancelled" ? (tool.result?.durationMs ?? cancelled?.get(tool.toolCallId)) : undefined;
635
636
  const elapsed = start === undefined ? "" : formatDuration(performance.now() - start);
636
637
  const regions = before.get(tool);
637
- const rowWidth = name === "codemode" ? width : Math.max(1, Math.floor(width * 0.6));
638
+ const rowWidth = hasTitle ? width : Math.max(1, Math.floor(width * 0.6));
638
639
  const branch = grouped && rowWidth >= 9 ? (last ? " └─ " : " ├─ ") : "";
639
640
  const guide = width < 8 ? "" : !grouped ? " " : last ? " " : " │ ";
640
641
  if (regions) {
@@ -652,7 +653,7 @@ export function createTranscriptView(
652
653
  counts = editCounts.get(result) ?? countDiff(result.details.diff);
653
654
  editCounts.set(result, counts);
654
655
  }
655
- const labelKey = `${counts?.added}:${counts?.removed}:${revision}:${width}:${grouped}:${last}:${open}:${state}:${elapsed}:${duration ?? ""}:${active ? frame : 0}:${subject}`;
656
+ const labelKey = `${counts?.added}:${counts?.removed}:${revision}:${rowWidth}:${grouped}:${last}:${open}:${state}:${elapsed}:${duration ?? ""}:${active ? frame : 0}:${subject}`;
656
657
  if (labelKey !== call.labelKey) {
657
658
  call.labelKey = labelKey;
658
659
  const available = rowWidth - branch.length - 2;