@xynogen/pix-commands 0.3.5 → 0.3.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": "@xynogen/pix-commands",
3
- "version": "0.3.5",
3
+ "version": "0.3.7",
4
4
  "description": "Pi extension — slash commands for cache clearing and isolated side questions",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
@@ -45,7 +45,7 @@
45
45
  "@earendil-works/pi-tui": "*"
46
46
  },
47
47
  "dependencies": {
48
- "@xynogen/pix-pretty": "^1.11.2",
48
+ "@xynogen/pix-pretty": "^1.13.0",
49
49
  "@xynogen/pix-runtime": "^0.5.3"
50
50
  }
51
51
  }
package/src/btw/render.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  import { getMarkdownTheme } from "@earendil-works/pi-coding-agent";
2
2
  import { Box, Markdown, Spacer, Text } from "@earendil-works/pi-tui";
3
3
  import { icon } from "@xynogen/pix-pretty/icon-catalog";
4
+ import { dotJoin } from "@xynogen/pix-pretty/utils";
5
+ import { formatDuration as fmtDuration } from "@xynogen/pix-pretty/widget-format";
4
6
 
5
7
  export interface BtwMessageDetails {
6
8
  question: string;
@@ -14,10 +16,9 @@ export interface BtwMessageDetails {
14
16
  error?: string;
15
17
  }
16
18
 
19
+ // ponytail: thin wrapper keeps old import path; canonical is formatDuration(ms,'btw') in pix-pretty
17
20
  export function formatDuration(ms: number): string {
18
- if (ms < 1_000) return `${ms}ms`;
19
- if (ms < 60_000) return `${(ms / 1_000).toFixed(ms < 10_000 ? 1 : 0)}s`;
20
- return `${Math.floor(ms / 60_000)}m ${Math.round((ms % 60_000) / 1_000)}s`;
21
+ return fmtDuration(ms, "btw");
21
22
  }
22
23
 
23
24
  export function registerBtwRenderer(
@@ -33,8 +34,12 @@ export function registerBtwRenderer(
33
34
  const statusGlyph = failed
34
35
  ? theme.fg("error", icon("status.error"))
35
36
  : theme.fg("success", icon("status.ok"));
36
- const meta = [details.model, details.thinkingLevel, formatDuration(details.durationMs)];
37
- if (details.toolUses > 0) meta.push(`${details.toolUses} tools`);
37
+ const meta = dotJoin([
38
+ details.model,
39
+ details.thinkingLevel,
40
+ formatDuration(details.durationMs),
41
+ details.toolUses > 0 && `${details.toolUses} tools`,
42
+ ]);
38
43
 
39
44
  // A custom renderer bypasses Pi's default custom-message box, so provide
40
45
  // our own card. Use selectedBg rather than the generic custom-message
@@ -44,11 +49,7 @@ export function registerBtwRenderer(
44
49
  // header text embedded inside Markdown can confuse wrapping and parsing.
45
50
  const card = new Box(1, 1, (text) => theme.bg("selectedBg", text));
46
51
  card.addChild(
47
- new Text(
48
- `${statusGlyph} ${theme.bold("BTW")} ${theme.fg("dim", `· ${meta.join(" · ")}`)}`,
49
- 0,
50
- 0,
51
- ),
52
+ new Text(`${statusGlyph} ${theme.bold("BTW")} ${theme.fg("dim", `· ${meta}`)}`, 0, 0),
52
53
  );
53
54
  card.addChild(
54
55
  new Text(`${theme.fg("accent", "▐")} ${theme.fg("muted", details.question)}`, 0, 0),
package/src/btw/widget.ts CHANGED
@@ -9,6 +9,7 @@
9
9
 
10
10
  import { truncateToWidth } from "@earendil-works/pi-tui";
11
11
  import { icon } from "@xynogen/pix-pretty/icon-catalog";
12
+ import { dotJoin } from "@xynogen/pix-pretty/utils";
12
13
  import {
13
14
  type ContextUsageLike,
14
15
  describeActivity,
@@ -73,7 +74,7 @@ function statsFor(job: BtwWidgetJob, endMs: number): string {
73
74
  const speed = formatSpeed(job.outputTokens, endMs - job.startedAt);
74
75
  if (speed) parts.push(speed);
75
76
  parts.push(formatMs(endMs - job.startedAt));
76
- return parts.join(" \u00b7 ");
77
+ return dotJoin(parts);
77
78
  }
78
79
 
79
80
  function finishedLine(job: BtwWidgetJob, theme: WidgetTheme): string {