pi-ui-extend 0.1.4 → 0.1.5

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/dist/app/app.d.ts CHANGED
@@ -56,6 +56,7 @@ export declare class PiUiExtendApp {
56
56
  private resumeLoading;
57
57
  constructor(options: AppOptions);
58
58
  start(): Promise<void>;
59
+ private checkPixUpdateOnStartup;
59
60
  private bindCurrentSession;
60
61
  private activateRuntime;
61
62
  private createExtensionEventBus;
package/dist/app/app.js CHANGED
@@ -38,6 +38,7 @@ import { AppTabsController } from "./tabs-controller.js";
38
38
  import { TabLineRenderer } from "./tab-line-renderer.js";
39
39
  import { AppTerminalController } from "./terminal-controller.js";
40
40
  import { AppToastController } from "./toast-controller.js";
41
+ import { checkPixUpdate, formatPixStartupUpdateDialog } from "./update.js";
41
42
  import { AppVoiceController } from "./voice-controller.js";
42
43
  import { createIsolatedExtensionEventBus } from "./extension-event-bus.js";
43
44
  import { setAppIconTheme } from "./icons.js";
@@ -674,6 +675,18 @@ export class PiUiExtendApp {
674
675
  await this.sessionLifecycle.start();
675
676
  this.modelUsageController.startPolling();
676
677
  this.nerdFontController.ensureInstalledOnStartup();
678
+ void this.checkPixUpdateOnStartup();
679
+ }
680
+ async checkPixUpdateOnStartup() {
681
+ try {
682
+ const result = await checkPixUpdate();
683
+ if (result.status !== "newer")
684
+ return;
685
+ this.showToast(formatPixStartupUpdateDialog(result), "warning", { variant: "dialog" });
686
+ }
687
+ catch {
688
+ // Startup update checks should never interrupt the TUI.
689
+ }
677
690
  }
678
691
  async bindCurrentSession() {
679
692
  await this.sessionLifecycle.bindCurrentSession();
@@ -1,3 +1,4 @@
1
1
  export declare function copyTextToClipboard(text: string): void;
2
2
  export declare function clipboardSupportAvailable(env?: NodeJS.ProcessEnv): boolean;
3
3
  export declare function clipboardInstallHint(): string;
4
+ export declare function osc52ClipboardSequence(text: string, env?: NodeJS.ProcessEnv): string;
@@ -10,6 +10,8 @@ export function copyTextToClipboard(text) {
10
10
  }
11
11
  if (copyWithNativeClipboard(text))
12
12
  return;
13
+ if (copyWithOsc52(text))
14
+ return;
13
15
  throw new Error(`No clipboard command found. ${clipboardInstallHint()}`);
14
16
  }
15
17
  export function clipboardSupportAvailable(env = process.env) {
@@ -60,6 +62,20 @@ function copyWithNativeClipboard(text) {
60
62
  });
61
63
  return !result.error && result.status === 0;
62
64
  }
65
+ function copyWithOsc52(text) {
66
+ if (process.stdout.destroyed || (!process.stdout.isTTY && !process.env.TMUX && !process.env.STY))
67
+ return false;
68
+ process.stdout.write(osc52ClipboardSequence(text));
69
+ return true;
70
+ }
71
+ export function osc52ClipboardSequence(text, env = process.env) {
72
+ const sequence = `\x1b]52;c;${Buffer.from(text, "utf8").toString("base64")}\x07`;
73
+ if (env.TMUX)
74
+ return `\x1bPtmux;${sequence.replaceAll("\x1b", "\x1b\x1b")}\x1b\\`;
75
+ if (env.STY)
76
+ return `\x1bP${sequence}\x1b\\`;
77
+ return sequence;
78
+ }
63
79
  function resolveNativeClipboardEntrypoint() {
64
80
  try {
65
81
  return require.resolve("@mariozechner/clipboard");
@@ -1,3 +1,3 @@
1
- import { type AgentSessionRuntime } from "@earendil-works/pi-coding-agent";
1
+ import type { AgentSessionRuntime } from "@earendil-works/pi-coding-agent";
2
2
  export declare function createStartupInfoMessage(runtime: AgentSessionRuntime): string;
3
3
  export declare function isEmptyStartupSession(runtime: AgentSessionRuntime): boolean;
@@ -1,11 +1,12 @@
1
1
  import { homedir } from "node:os";
2
2
  import { basename, isAbsolute, relative, sep } from "node:path";
3
- import { VERSION } from "@earendil-works/pi-coding-agent";
3
+ import { getPixPackageVersion } from "./update.js";
4
4
  export function createStartupInfoMessage(runtime) {
5
5
  const sections = startupSections(runtime);
6
6
  return [
7
7
  formatModelLine(runtime),
8
- `pix · pi-sdk v${VERSION}`,
8
+ "",
9
+ `pix v${getPixPackageVersion()}`,
9
10
  "escape interrupt · ctrl+c/ctrl+d clear/exit · / commands",
10
11
  "",
11
12
  ...sections.flatMap(formatSection),
@@ -30,7 +30,9 @@ export type PixUpdateCheckOptions = {
30
30
  };
31
31
  export declare function pixUpdateUsage(): string;
32
32
  export declare function parsePixUpdateArgs(argv: readonly string[]): PixUpdateCliOptions;
33
+ export declare function getPixPackageVersion(packageRoot?: string): string;
33
34
  export declare function checkPixUpdate(options?: PixUpdateCheckOptions): Promise<PixUpdateCheckResult>;
34
35
  export declare function formatPixUpdateCheck(result: PixUpdateCheckResult): string;
36
+ export declare function formatPixStartupUpdateDialog(result: PixUpdateCheckResult): string;
35
37
  export declare function getPixSelfUpdateCommand(packageName: string, latestVersion?: string, packageRoot?: string): PixSelfUpdateCommand | undefined;
36
38
  export declare function runPixUpdateCli(argv?: readonly string[]): Promise<number>;
@@ -40,6 +40,9 @@ export function parsePixUpdateArgs(argv) {
40
40
  }
41
41
  return { checkOnly, force, help };
42
42
  }
43
+ export function getPixPackageVersion(packageRoot) {
44
+ return readPixPackageInfo(packageRoot).version;
45
+ }
43
46
  export async function checkPixUpdate(options = {}) {
44
47
  const packageInfo = readPixPackageInfo(options.packageRoot);
45
48
  const base = {
@@ -107,6 +110,19 @@ export function formatPixUpdateCheck(result) {
107
110
  lines.push("scope: Pix package, renderer extensions, bundled skills copied into ~/.agents/skills, and the pi-tools-suite payload linked into ~/.pi/agent/extensions");
108
111
  return lines.join("\n");
109
112
  }
113
+ export function formatPixStartupUpdateDialog(result) {
114
+ const lines = [
115
+ "A new Pix version is available.",
116
+ `current: ${result.packageName} v${result.currentVersion}`,
117
+ ...(result.latestVersion ? [`latest: ${result.latestVersion}`] : []),
118
+ "",
119
+ "To update:",
120
+ "1. Exit Pix.",
121
+ "2. Run `pix update` in your shell.",
122
+ "3. Start Pix again after the update completes.",
123
+ ];
124
+ return lines.join("\n");
125
+ }
110
126
  export function getPixSelfUpdateCommand(packageName, latestVersion, packageRoot = readPixPackageInfo().packageRoot) {
111
127
  if (!packageRootLooksPackageManaged(packageRoot))
112
128
  return undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-ui-extend",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "bin": {