@arhen/pi-senja 1.5.1 → 1.5.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.
package/README.md CHANGED
@@ -12,7 +12,7 @@ Forked from [pi-haiku](https://github.com/nnocte/pi-haiku) **0.2.0** by **nocte*
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
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.
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
- - **Tool activity** — An unnamed call shows `preparing…`. As soon as Pi names it, the row shows `running`, even while the model writes the script. The timer starts at the first named call update and keeps counting through execution (`running 1m 30s`). Confirmed interruptions freeze that total (`cancelled · 8s`) without counting as failures.
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.
17
17
  - **Goal notices** — a `goal-ui` status starts as one clickable row. Open it for the original notice, including its objective, usage and commands.
18
18
  - **Quiet tool text** — action labels such as `Ran` use muted teal (`#7daea3`) to distinguish tools from assistant prose. Tool names following a verb and tool output use the foreground beige (`fg0`) rather than loud accents, keeping panels calm against their tint.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arhen/pi-senja",
3
- "version": "1.5.1",
3
+ "version": "1.5.2",
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",
package/src/index.ts CHANGED
@@ -393,11 +393,6 @@ export default function (pi: ExtensionAPI) {
393
393
  cancelled.set(id, start === undefined ? undefined : performance.now() - start);
394
394
  starts.delete(id);
395
395
  }
396
- pi.on("message_update", ({ assistantMessageEvent: update }, ctx) => {
397
- if (ctx.mode !== "tui" || !("contentIndex" in update)) return;
398
- const block = update.partial.content[update.contentIndex];
399
- if (block?.type === "toolCall" && block.name && block.id) startCall(block.id);
400
- });
401
396
  pi.on("message_end", ({ message }, ctx) => {
402
397
  if (ctx.mode !== "tui" || message.role !== "assistant" || message.stopReason !== "aborted") return;
403
398
  for (const block of message.content) {
@@ -26,6 +26,7 @@ import {
26
26
  type ToolRow = Component & {
27
27
  toolName: string;
28
28
  toolCallId: string;
29
+ executionStarted?: boolean;
29
30
  args?: Record<string, unknown>;
30
31
  isPartial: boolean;
31
32
  expanded: boolean;
@@ -624,9 +625,10 @@ export function createTranscriptView(
624
625
  const [, subject] = describe(tool);
625
626
  const start = tool.isPartial ? starts?.get(tool.toolCallId) : undefined;
626
627
  const error = tool.result?.isError && (cancelled?.has(tool.toolCallId) ? "cancelled" : "failed");
627
- const state = error || (!tool.isPartial ? "" : name ? "running" : "preparing…");
628
+ const running = start !== undefined || tool.executionStarted;
629
+ const state = error || (!tool.isPartial ? "" : running ? "running" : "preparing…");
628
630
  const duration =
629
- state === "cancelled" ? (cancelled?.get(tool.toolCallId) ?? tool.result?.durationMs) : undefined;
631
+ state === "cancelled" ? (tool.result?.durationMs ?? cancelled?.get(tool.toolCallId)) : undefined;
630
632
  const elapsed = start === undefined ? "" : formatDuration(performance.now() - start);
631
633
  const regions = before.get(tool);
632
634
  const rowWidth = name === "codemode" ? width : Math.max(1, Math.floor(width * 0.6));
@@ -656,7 +658,9 @@ export function createTranscriptView(
656
658
  const icon = theme.fg("muted", open ? "▾" : "▸");
657
659
  const status = suffix.length < available ? theme.fg(state === "failed" ? "error" : "muted", suffix) : "";
658
660
  const label = theme.fg("dim", subject || summary(name));
659
- const caption = grouped ? label : !name ? " •" : subject ? `${heading()} ${label}` : heading();
661
+ const title = () =>
662
+ state === "preparing…" ? ` ${theme.fg("warning", "•")} ${theme.fg("toolTitle", summary(name))}` : heading();
663
+ const caption = grouped ? label : !name ? " •" : subject ? `${title()} ${label}` : title();
660
664
  const script = truncateToWidth(caption, Math.max(0, available - visibleWidth(status)), "…");
661
665
  const line = `${script}${status} ${icon}`;
662
666
  call.label.setText(rowWidth <= 1 ? icon : theme.fg("dim", branch) + (active ? shimmer(line, frame) : line));