gpui-bridge 0.4.2 → 0.6.0

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.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { type ClientMessage, type ErrorCode, type HostMessage, type MenuItem, type NodeEvents, type NodeId, type NodeProps, type NodeType, type ThemeSet, type WindowEventName, type WindowId, type WindowTheme } from "./protocol.js";
1
+ import { type AppIdentity, type ClientMessage, type ErrorCode, type HostMessage, type MenuItem, type NodeEvents, type NodeId, type NodeProps, type NodeType, type ThemeSet, type WindowEventName, type WindowId, type WindowTheme } from "./protocol.js";
2
2
  import { Tree } from "./tree.js";
3
3
  export interface HostExit {
4
4
  code: number | null;
@@ -373,6 +373,11 @@ export declare class App {
373
373
  private request;
374
374
  /** App-wide keyboard shortcuts (`ctrl-s`, `f5`…), applied on the next commit; replaces the list. */
375
375
  shortcuts(keys: string[]): this;
376
+ /**
377
+ * Registers SVG icons (name → SVG text) on the next commit, for `Icon` and every `icon` prop
378
+ * (PROTOCOL.md section 29). Register a name before the nodes that use it; again to replace it.
379
+ */
380
+ icons(icons: Record<string, string>): this;
376
381
  /** Shows or updates the system tray icon on the next commit. */
377
382
  tray(options: TrayOptions): this;
378
383
  /** Removes the tray icon on the next commit; with no window open, the host then exits. */
@@ -395,5 +400,5 @@ export declare class App {
395
400
  * Starts the host through `start` and completes the handshake. Rejects with a
396
401
  * clear message if the host cannot start.
397
402
  */
398
- export declare function connect(hostPath: string, start: (events: HostEvents) => HostTransport): Promise<App>;
403
+ export declare function connect(hostPath: string, start: (events: HostEvents) => HostTransport, identity?: AppIdentity): Promise<App>;
399
404
  export {};
package/dist/app.js CHANGED
@@ -544,6 +544,14 @@ export class App {
544
544
  this.wire.queue({ op: "shortcuts", keys });
545
545
  return this;
546
546
  }
547
+ /**
548
+ * Registers SVG icons (name → SVG text) on the next commit, for `Icon` and every `icon` prop
549
+ * (PROTOCOL.md section 29). Register a name before the nodes that use it; again to replace it.
550
+ */
551
+ icons(icons) {
552
+ this.wire.queue({ op: "icons", icons });
553
+ return this;
554
+ }
547
555
  /** Shows or updates the system tray icon on the next commit. */
548
556
  tray(options) {
549
557
  this.wire.queue({ op: "tray", ...options });
@@ -689,7 +697,7 @@ export class App {
689
697
  * Starts the host through `start` and completes the handshake. Rejects with a
690
698
  * clear message if the host cannot start.
691
699
  */
692
- export function connect(hostPath, start) {
700
+ export function connect(hostPath, start, identity) {
693
701
  return new Promise((resolve, reject) => {
694
702
  let app;
695
703
  let ready = false;
@@ -722,6 +730,7 @@ export function connect(hostPath, start) {
722
730
  },
723
731
  });
724
732
  app = new App(host, hostPath);
725
- host.send({ op: "hello", protocol: PROTOCOL_VERSION });
733
+ // JSON leaves out an undefined `app`, so the default hello stays `{"op":"hello","protocol":1}`.
734
+ host.send({ op: "hello", protocol: PROTOCOL_VERSION, app: identity });
726
735
  });
727
736
  }
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { type App } from "./app.js";
2
+ import type { AppIdentity } from "./protocol.js";
2
3
  export * from "./app.js";
3
4
  export * from "./protocol.js";
4
5
  export interface AppOptions {
@@ -8,6 +9,8 @@ export interface AppOptions {
8
9
  debug?: boolean;
9
10
  /** Run the host without a window (`--no-window`), e.g. for tests. */
10
11
  headless?: boolean;
12
+ /** Names the app for the system (`hello`): Windows shows it on system notifications. Default: `gpui-bridge`. */
13
+ app?: AppIdentity;
11
14
  }
12
15
  /** The host to run: `$GPUI_BRIDGE_HOST`, then the packaged one, then a build in this repository. */
13
16
  export declare function defaultHostPath(): string;
package/dist/index.js CHANGED
@@ -54,5 +54,5 @@ export function defaultHostPath() {
54
54
  export function createApp(options = {}) {
55
55
  const path = options.hostPath ?? defaultHostPath();
56
56
  const args = options.headless ? ["--no-window"] : [];
57
- return connect(path, (events) => new HostProcess({ path, args, debug: options.debug ?? false, ...events }));
57
+ return connect(path, (events) => new HostProcess({ path, args, debug: options.debug ?? false, ...events }), options.app);
58
58
  }
@@ -25,10 +25,19 @@ export interface ThemeConfig {
25
25
  }
26
26
  /** Node props on the wire. In `setProps`, a `null` value removes the prop. */
27
27
  export type Props = Record<string, unknown>;
28
+ /** The app's own name for the system (`hello`): Windows shows `name` and `icon` on system notifications. */
29
+ export interface AppIdentity {
30
+ /** Windows AppUserModelID: up to 128 characters, no spaces or `\`, e.g. `"Acme.Notes"`. */
31
+ id: string;
32
+ name: string;
33
+ /** Image file shown on the app's system notifications (PNG, ICO…). */
34
+ icon?: string;
35
+ }
28
36
  /** Messages from the client (host stdin). */
29
37
  export type ClientMessage = {
30
38
  op: "hello";
31
39
  protocol: number;
40
+ app?: AppIdentity;
32
41
  } | {
33
42
  op: "window";
34
43
  id?: WindowId;
@@ -87,6 +96,9 @@ export type ClientMessage = {
87
96
  menu?: MenuItem[];
88
97
  } | {
89
98
  op: "removeTray";
99
+ } | {
100
+ op: "icons";
101
+ icons: Record<string, string>;
90
102
  } | {
91
103
  op: "shortcuts";
92
104
  keys: string[];
@@ -273,6 +285,8 @@ export interface TextProps {
273
285
  }
274
286
  export interface ButtonProps {
275
287
  label?: string;
288
+ /** An icon before the label; without a label, give a `tooltip` (it also names the button). */
289
+ icon?: string;
276
290
  variant?: "primary" | "secondary" | "ghost" | "danger";
277
291
  disabled?: boolean;
278
292
  tooltip?: string;
package/dist/txiki.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { type App } from "./app.js";
2
+ import type { AppIdentity } from "./protocol.js";
2
3
  export * from "./app.js";
3
4
  export * from "./protocol.js";
4
5
  export interface TxikiAppOptions {
@@ -6,5 +7,7 @@ export interface TxikiAppOptions {
6
7
  hostPath?: string;
7
8
  debug?: boolean;
8
9
  headless?: boolean;
10
+ /** Names the app for the system (`hello`): Windows shows it on system notifications. Default: `gpui-bridge`. */
11
+ app?: AppIdentity;
9
12
  }
10
13
  export declare function createTxikiApp(options?: TxikiAppOptions): Promise<App>;
package/dist/txiki.js CHANGED
@@ -86,5 +86,5 @@ function defaultHostPath() {
86
86
  export function createTxikiApp(options = {}) {
87
87
  const path = options.hostPath ?? defaultHostPath();
88
88
  const args = options.headless ? ["--no-window"] : [];
89
- return connect(path, (events) => new TxikiHost(path, args, options.debug ?? false, events));
89
+ return connect(path, (events) => new TxikiHost(path, args, options.debug ?? false, events), options.app);
90
90
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gpui-bridge",
3
- "version": "0.4.2",
3
+ "version": "0.6.0",
4
4
  "description": "Node.js client for the gpui-bridge native UI host",
5
5
  "license": "MIT",
6
6
  "author": "gpui-bridge contributors",
@@ -29,9 +29,9 @@
29
29
  "node": ">=22.6"
30
30
  },
31
31
  "optionalDependencies": {
32
- "@indios/gpui-bridge-darwin-arm64": "0.4.2",
33
- "@indios/gpui-bridge-linux-x64": "0.4.2",
34
- "@indios/gpui-bridge-win32-x64": "0.4.2"
32
+ "@indios/gpui-bridge-darwin-arm64": "0.6.0",
33
+ "@indios/gpui-bridge-linux-x64": "0.6.0",
34
+ "@indios/gpui-bridge-win32-x64": "0.6.0"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@types/node": "^26.6.5",