@xynogen/pix-display 0.3.2 → 0.3.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xynogen/pix-display",
3
- "version": "0.3.2",
3
+ "version": "0.3.4",
4
4
  "description": "Pi core extension \u2014 inline chips, thinking blocks, and framed code rendering",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
@@ -39,7 +39,8 @@
39
39
  "access": "public"
40
40
  },
41
41
  "dependencies": {
42
- "@xynogen/pix-pretty": "^1.32.0"
42
+ "@xynogen/pix-pretty": "^1.34.0",
43
+ "@xynogen/pix-runtime": "^0.16.0"
43
44
  },
44
45
  "peerDependencies": {
45
46
  "@earendil-works/pi-coding-agent": "*",
package/src/index.ts CHANGED
@@ -12,12 +12,17 @@
12
12
 
13
13
  import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
14
14
  import { registerChips } from "@xynogen/pix-pretty/chips";
15
+ import { once } from "@xynogen/pix-runtime/once";
15
16
 
16
17
  import codeBlocksExtension from "./code-blocks.ts";
17
18
  import thinkingExtension from "./thinking.ts";
19
+ import workingExtension from "./working.ts";
18
20
 
19
21
  export default function pixDisplayExtension(pi: ExtensionAPI): void {
20
- registerChips(pi);
21
- thinkingExtension(pi);
22
- codeBlocksExtension(pi);
22
+ once(pi, "pix-display", () => {
23
+ registerChips(pi);
24
+ thinkingExtension(pi);
25
+ codeBlocksExtension(pi);
26
+ workingExtension(pi);
27
+ });
23
28
  }
package/src/working.ts ADDED
@@ -0,0 +1,30 @@
1
+ import type { ExtensionAPI, ExtensionContext } from "@earendil-works/pi-coding-agent";
2
+ import { formatDuration } from "@xynogen/pix-pretty/widget-format";
3
+
4
+ export default function workingExtension(pi: ExtensionAPI): void {
5
+ let timer: ReturnType<typeof setInterval> | undefined;
6
+
7
+ const stop = (_event: unknown, ctx: ExtensionContext): void => {
8
+ if (timer === undefined) return;
9
+ clearInterval(timer);
10
+ timer = undefined;
11
+ ctx.ui.setWorkingMessage();
12
+ };
13
+
14
+ pi.on("agent_start", (_event, ctx) => {
15
+ if (ctx.mode !== "tui") return;
16
+ stop(_event, ctx);
17
+ const startedAt = performance.now();
18
+ const tick = () => {
19
+ const elapsed = Math.floor((performance.now() - startedAt) / 1000) * 1000;
20
+ ctx.ui.setWorkingMessage(
21
+ `Working (${elapsed === 0 ? "0s" : formatDuration(elapsed, "btw")})`,
22
+ );
23
+ };
24
+ tick();
25
+ timer = setInterval(tick, 1000);
26
+ timer.unref();
27
+ });
28
+ pi.on("agent_end", stop);
29
+ pi.on("session_shutdown", stop);
30
+ }