gloomberb 0.8.2 → 0.9.1

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.
Files changed (111) hide show
  1. package/README.md +9 -7
  2. package/package.json +18 -13
  3. package/patches/{@opentui%2Fcore@0.1.90.patch → @opentui%2Fcore@0.3.2.patch} +175 -90
  4. package/patches/electrobun@1.18.1.patch +85 -0
  5. package/src/app/global-shortcuts.test.tsx +66 -4
  6. package/src/app/global-shortcuts.ts +12 -6
  7. package/src/assets/gloomberb-logo-windows.ico +0 -0
  8. package/src/assets/gloomberb-logo-windows.png +0 -0
  9. package/src/assets/gloomberb-logo.ico +0 -0
  10. package/src/components/command-bar/action-runtime.ts +1 -0
  11. package/src/components/command-bar/layout-items/current-layout.test.ts +115 -0
  12. package/src/components/command-bar/layout-items/current-layout.ts +33 -0
  13. package/src/components/command-bar/list/view.tsx +3 -1
  14. package/src/components/command-bar/pane-templates/items.ts +4 -1
  15. package/src/components/command-bar/panel/body.tsx +1 -0
  16. package/src/components/command-bar/routes/root/results.ts +0 -30
  17. package/src/components/command-bar/routes/root/runtime.ts +2 -20
  18. package/src/components/command-bar/routes/ticker-search/actions.ts +42 -4
  19. package/src/components/command-bar/routes/ticker-search/route.ts +4 -1
  20. package/src/components/command-bar/routing/launch-request.ts +14 -7
  21. package/src/components/command-bar/routing/list-state.ts +1 -3
  22. package/src/components/command-bar/surface/index.test.tsx +76 -4
  23. package/src/components/command-bar/surface/index.tsx +0 -2
  24. package/src/components/command-bar/surface/pane.test.tsx +1 -0
  25. package/src/components/command-bar/surface/test-harness.tsx +1 -0
  26. package/src/components/command-bar/view-model.ts +3 -3
  27. package/src/components/layout/detached-pane-shell.tsx +8 -4
  28. package/src/components/layout/header.tsx +13 -6
  29. package/src/components/layout/shell/index.test.tsx +120 -2
  30. package/src/components/layout/shell/index.tsx +2 -0
  31. package/src/components/layout/shell/menu.ts +1 -7
  32. package/src/components/layout/shell/pane/actions.ts +8 -0
  33. package/src/components/layout/shell/pane/management-shortcuts.ts +12 -2
  34. package/src/components/layout/shell/shortcuts.ts +14 -6
  35. package/src/components/layout/shell/window-mode/index.ts +8 -3
  36. package/src/components/layout/titlebar-overlay.ts +16 -0
  37. package/src/components/layout/window-controls.tsx +90 -0
  38. package/src/components/layout/window-edit/presentation.ts +4 -4
  39. package/src/components/onboarding/onboarding-steps.tsx +3 -2
  40. package/src/components/ticker/list-table-view.tsx +6 -0
  41. package/src/components/ui/remote-image.tsx +1 -14
  42. package/src/components/ui/tabs.tsx +95 -80
  43. package/src/components/ui/ui.test.tsx +54 -0
  44. package/src/core/state/app/types.ts +12 -4
  45. package/src/plugins/builtin/chat/content/channel-navigation.ts +44 -11
  46. package/src/plugins/builtin/chat/content/index.tsx +5 -4
  47. package/src/plugins/builtin/chat/content/shortcuts.ts +7 -0
  48. package/src/plugins/builtin/chat/sidebar.test.tsx +71 -0
  49. package/src/plugins/builtin/help/components.tsx +1 -1
  50. package/src/plugins/builtin/help/index.test.tsx +105 -30
  51. package/src/plugins/builtin/help/index.tsx +324 -168
  52. package/src/plugins/builtin/help/shortcut-model.ts +5 -6
  53. package/src/plugins/builtin/portfolio-list/column-values.ts +304 -1
  54. package/src/plugins/builtin/portfolio-list/metrics.test.ts +93 -0
  55. package/src/plugins/builtin/portfolio-list/pane/data.ts +7 -0
  56. package/src/plugins/builtin/portfolio-list/pane/index.tsx +25 -2
  57. package/src/plugins/builtin/portfolio-list/pane/supplemental.ts +281 -0
  58. package/src/plugins/builtin/portfolio-list/settings.ts +27 -0
  59. package/src/plugins/builtin/portfolio-list/table.tsx +4 -2
  60. package/src/plugins/builtin/portfolio-list/use-throttled-cursor-symbol.ts +10 -68
  61. package/src/plugins/builtin/substack/api/auth.ts +185 -0
  62. package/src/plugins/builtin/substack/api/cache.ts +78 -0
  63. package/src/plugins/builtin/substack/api/loaders.ts +146 -0
  64. package/src/plugins/builtin/substack/api/store.ts +186 -0
  65. package/src/plugins/builtin/substack/api/types.ts +40 -0
  66. package/src/plugins/builtin/substack/api.test.ts +298 -0
  67. package/src/plugins/builtin/substack/article-detail.tsx +359 -0
  68. package/src/plugins/builtin/substack/article-stack.tsx +129 -0
  69. package/src/plugins/builtin/substack/content.ts +478 -0
  70. package/src/plugins/builtin/substack/feed-tabs.tsx +41 -0
  71. package/src/plugins/builtin/substack/index.tsx +49 -0
  72. package/src/plugins/builtin/substack/login-view.tsx +126 -0
  73. package/src/plugins/builtin/substack/model.test.ts +155 -0
  74. package/src/plugins/builtin/substack/normalize.ts +343 -0
  75. package/src/plugins/builtin/substack/pane-footer.ts +71 -0
  76. package/src/plugins/builtin/substack/pane-state.ts +170 -0
  77. package/src/plugins/builtin/substack/pane.tsx +500 -0
  78. package/src/plugins/builtin/substack/table.ts +111 -0
  79. package/src/plugins/builtin/substack/types.ts +71 -0
  80. package/src/plugins/builtin/substack/utils.ts +131 -0
  81. package/src/plugins/builtin/ticker-detail/index.test.tsx +16 -2
  82. package/src/plugins/builtin/ticker-detail/index.tsx +1 -0
  83. package/src/plugins/builtin/ticker-detail/pane.tsx +13 -1
  84. package/src/plugins/catalog-ui.ts +2 -0
  85. package/src/plugins/pane-manager/layout-state.ts +11 -0
  86. package/src/plugins/pane-manager.ts +1 -1
  87. package/src/react/use-throttled-commit-value.ts +116 -0
  88. package/src/renderers/electrobun/bun/application-menu/index.test.ts +12 -0
  89. package/src/renderers/electrobun/bun/application-menu/index.ts +4 -0
  90. package/src/renderers/electrobun/bun/desktop/detached-windows.ts +43 -2
  91. package/src/renderers/electrobun/bun/desktop/host-requests.ts +31 -0
  92. package/src/renderers/electrobun/bun/desktop/http-fetch.test.ts +42 -0
  93. package/src/renderers/electrobun/bun/desktop/http-fetch.ts +5 -0
  94. package/src/renderers/electrobun/bun/desktop/window-controls.test.ts +53 -0
  95. package/src/renderers/electrobun/bun/desktop/window-controls.ts +64 -0
  96. package/src/renderers/electrobun/bun/desktop/window-style.ts +5 -0
  97. package/src/renderers/electrobun/bun/desktop/windows-icons.ts +123 -0
  98. package/src/renderers/electrobun/bun/index.ts +28 -6
  99. package/src/renderers/electrobun/bun/window/frame.test.ts +7 -0
  100. package/src/renderers/electrobun/bun/window/frame.ts +5 -0
  101. package/src/renderers/electrobun/view/build-assets.ts +2 -1
  102. package/src/renderers/electrobun/view/host/text.tsx +29 -9
  103. package/src/renderers/electrobun/view/http-fetch.ts +10 -3
  104. package/src/renderers/electrobun/view/styles.css +20 -0
  105. package/src/renderers/electrobun/view/ui-host.tsx +14 -0
  106. package/src/state/app/context/index.test.tsx +16 -0
  107. package/src/tickers/search/index.ts +1 -0
  108. package/src/ui/host.tsx +2 -0
  109. package/src/updater.test.ts +47 -2
  110. package/src/updater.ts +67 -10
  111. package/src/version.ts +1 -1
@@ -8,9 +8,20 @@ import {
8
8
  type TextProps,
9
9
  } from "../../../../ui/host";
10
10
  import { renderAsciiText } from "../../../../ui/ascii-font";
11
+ import { WEB_CELL_WIDTH } from "../input-host";
11
12
  import { hasDirectMouseHandler, mouseHandlers } from "./mouse";
12
13
  import { cleanDomProps, commonStyle, textStyle } from "./style";
13
14
 
15
+ const WEB_GLOOMBERB_WORDMARK = [
16
+ " ____ _ _ _ ",
17
+ " / ___| | ___ ___ _ __ ___ | |__ ___ _ __| |__ ",
18
+ "| | _| |/ _ \\ / _ \\| '_ ` _ \\| '_ \\ / _ \\ '__| '_ \\ ",
19
+ "| |_| | | (_) | (_) | | | | | | |_) | __/ | | |_) |",
20
+ " \\____|_|\\___/ \\___/|_| |_| |_|_.__/ \\___|_| |_.__/ ",
21
+ ];
22
+
23
+ const WEB_WORDMARK_CHAR_WIDTH_PX = Math.max(10, WEB_CELL_WIDTH);
24
+
14
25
  function isStyledTextContent(value: unknown): value is { chunks: StyledTextChunk[] } {
15
26
  return value instanceof StyledText
16
27
  || (!!value && typeof value === "object" && Array.isArray((value as { chunks?: unknown }).chunks));
@@ -91,31 +102,40 @@ export function WebAsciiText({
91
102
  selectable = false,
92
103
  ...props
93
104
  }: AsciiTextProps) {
94
- const lines = renderAsciiText(text, font);
105
+ const isWordmark = font === "wordmark";
106
+ const lines = isWordmark && text.trim().toLowerCase() === "gloomberb"
107
+ ? WEB_GLOOMBERB_WORDMARK
108
+ : renderAsciiText(text, font);
95
109
  const resolvedColor = color ?? fg;
96
110
  const resolvedBackground = bg ?? backgroundColor;
111
+ const lineHeightPx = isWordmark ? 16 : 12;
112
+ const wordmarkWidthPx = isWordmark
113
+ ? Math.max(...lines.map((line) => line.length)) * WEB_WORDMARK_CHAR_WIDTH_PX
114
+ : undefined;
97
115
  return (
98
116
  <div
99
117
  {...cleanDomProps(props)}
100
118
  data-gloom-role={(props["data-gloom-role"] as string | undefined) ?? "ascii-text"}
101
119
  style={{
102
120
  ...commonStyle({ ...props, fg: resolvedColor, bg: resolvedBackground }),
103
- display: "flex",
104
- flexDirection: "column",
121
+ display: "block",
105
122
  flexShrink: 0,
123
+ ...(wordmarkWidthPx != null && props.width == null
124
+ ? { width: `${wordmarkWidthPx}px`, minWidth: `${wordmarkWidthPx}px` }
125
+ : {}),
106
126
  color: resolvedColor,
107
127
  backgroundColor: resolvedBackground,
108
- lineHeight: "12px",
128
+ fontFamily: isWordmark ? "\"Cascadia Mono\", Consolas, \"Courier New\", monospace" : undefined,
129
+ fontSize: isWordmark ? "16px" : undefined,
130
+ fontVariantLigatures: "none",
131
+ lineHeight: `${lineHeightPx}px`,
109
132
  whiteSpace: "pre",
133
+ letterSpacing: 0,
110
134
  userSelect: selectable ? "text" : "none",
111
135
  ...(props.style as CSSProperties | undefined),
112
136
  }}
113
137
  >
114
- {lines.map((line, index) => (
115
- <span key={index} style={{ display: "block", height: "12px", lineHeight: "12px" }}>
116
- {line}
117
- </span>
118
- ))}
138
+ {lines.join("\n")}
119
139
  </div>
120
140
  );
121
141
  }
@@ -61,12 +61,18 @@ async function electrobunHttpFetch(url: string, init?: RequestInit): Promise<Res
61
61
  const requestPromise = requestBackendHttpFetch(url, init);
62
62
 
63
63
  const response = await withAbort(requestPromise, init?.signal);
64
-
65
- return new Response(response.body, {
64
+ const headers = createResponseHeaders(response.headers, response.setCookie);
65
+ const fetchResponse = new Response(response.body, {
66
66
  status: response.status,
67
67
  statusText: response.statusText,
68
- headers: response.headers,
68
+ headers,
69
+ });
70
+
71
+ Object.defineProperty(fetchResponse, "headers", {
72
+ value: headers,
73
+ configurable: true,
69
74
  });
75
+ return fetchResponse;
70
76
  }
71
77
 
72
78
  async function requestBackendHttpFetch(url: string, init?: RequestInit): Promise<ElectrobunHttpFetchResponse> {
@@ -76,6 +82,7 @@ async function requestBackendHttpFetch(url: string, init?: RequestInit): Promise
76
82
  method: init?.method,
77
83
  headers: normalizeHeaders(init?.headers),
78
84
  body: await serializeBody(init?.body),
85
+ redirect: init?.redirect,
79
86
  },
80
87
  });
81
88
  }
@@ -58,6 +58,26 @@ button, [data-gloom-interactive="true"] { cursor: pointer; }
58
58
  -webkit-app-region: no-drag;
59
59
  app-region: no-drag;
60
60
  }
61
+ [data-gloom-role="window-controls"] {
62
+ height: 100%;
63
+ color: var(--gloom-header-text, #f2f2f2);
64
+ }
65
+ [data-gloom-role="window-control"] {
66
+ color: color-mix(in srgb, var(--gloom-header-text, #f2f2f2) 86%, transparent);
67
+ transition: background-color 90ms linear, color 90ms linear;
68
+ }
69
+ [data-gloom-role="window-control"] svg {
70
+ display: block;
71
+ pointer-events: none;
72
+ }
73
+ [data-gloom-role="window-control"]:hover {
74
+ background: color-mix(in srgb, var(--gloom-header-text, #f2f2f2) 13%, transparent);
75
+ color: var(--gloom-header-text, #f2f2f2);
76
+ }
77
+ [data-gloom-role="window-control"][data-window-control-action="close"]:hover {
78
+ background: #c42b1c;
79
+ color: #ffffff;
80
+ }
61
81
  [data-gloom-role="pane-window"][data-floating="true"] {
62
82
  border: 0;
63
83
  border-radius: 6px;
@@ -27,6 +27,16 @@ import { cleanDomProps, commonStyle } from "./host/style";
27
27
  import { WebAsciiText, WebSpan, WebStrong, WebText, WebUnderline } from "./host/text";
28
28
  import { WebTabs } from "./host/tabs";
29
29
 
30
+ function currentDesktopPlatform(): string {
31
+ const navigatorWithUserAgentData = navigator as Navigator & {
32
+ userAgentData?: { platform?: string };
33
+ };
34
+ return navigatorWithUserAgentData.userAgentData?.platform ?? navigator.platform ?? "";
35
+ }
36
+
37
+ const DESKTOP_PLATFORM = currentDesktopPlatform();
38
+ const USES_WINDOWS_CONTROLS = /win/i.test(DESKTOP_PLATFORM);
39
+
30
40
  export const webUiHost: UiHost = {
31
41
  kind: "desktop-web",
32
42
  capabilities: {
@@ -39,6 +49,7 @@ export const webUiHost: UiHost = {
39
49
  pixelRatio: Math.min(window.devicePixelRatio || 1, 2),
40
50
  canvasCharts: true,
41
51
  nativeContextMenu: NATIVE_CONTEXT_MENU_SUPPORTED,
52
+ windowControls: USES_WINDOWS_CONTROLS ? "windows" : undefined,
42
53
  },
43
54
  Box: WebBox,
44
55
  Text: WebText,
@@ -115,6 +126,9 @@ export const webRendererHost: RendererHost = {
115
126
  startWindowDrag() {
116
127
  startElectrobunWindowDrag();
117
128
  },
129
+ async controlWindow(action) {
130
+ await backendRequest("host.windowControl", { action });
131
+ },
118
132
  async openExternal(url) {
119
133
  await backendRequest("host.openExternal", { url });
120
134
  },
@@ -46,6 +46,22 @@ describe("appReducer command bar state", () => {
46
46
  expect(closed.commandBarLaunchRequest).toBeNull();
47
47
  });
48
48
 
49
+ test("stores ticker search command bar launch requests", () => {
50
+ const initial = createInitialState(createDefaultConfig("/tmp/gloomberb-test"));
51
+ const opened = appReducer(initial, {
52
+ type: "SET_COMMAND_BAR",
53
+ open: true,
54
+ launch: { kind: "ticker-search", query: "" },
55
+ });
56
+
57
+ expect(opened.commandBarOpen).toBe(true);
58
+ expect(opened.commandBarLaunchRequest).toEqual({
59
+ kind: "ticker-search",
60
+ query: "",
61
+ sequence: 1,
62
+ });
63
+ });
64
+
49
65
  test("toggle opens blank and clears on close", () => {
50
66
  const initial = createInitialState(createDefaultConfig("/tmp/gloomberb-test"));
51
67
  const opened = appReducer(initial, { type: "TOGGLE_COMMAND_BAR" });
@@ -22,6 +22,7 @@ import {
22
22
  export type {
23
23
  ResolvedTickerSearch,
24
24
  TickerSearchCandidate,
25
+ TickerSearchInstrumentClass,
25
26
  } from "./types";
26
27
  export {
27
28
  findExactTickerSearchMatch,
package/src/ui/host.tsx CHANGED
@@ -260,6 +260,7 @@ export interface UiHost {
260
260
  canvasCharts?: boolean;
261
261
  nativeCharts?: boolean;
262
262
  nativeContextMenu?: boolean;
263
+ windowControls?: "windows";
263
264
  };
264
265
  Box: ComponentType<BoxProps>;
265
266
  Text: ComponentType<TextProps>;
@@ -289,6 +290,7 @@ export interface UiHost {
289
290
  export interface RendererHost {
290
291
  requestExit(): void;
291
292
  startWindowDrag?(): Promise<void> | void;
293
+ controlWindow?(action: "minimize" | "toggle-maximize" | "close"): Promise<void> | void;
292
294
  openExternal(url: string): Promise<void>;
293
295
  copyText(text: string): Promise<void>;
294
296
  copyPngImage?(pngBase64: string): Promise<void>;
@@ -8,6 +8,7 @@ import {
8
8
  checkForUpdate,
9
9
  checkForUpdateDetailed,
10
10
  detectUpdateAction,
11
+ getAssetBaseNameForRuntime,
11
12
  performUpdate,
12
13
  resolveSelfUpdateTargetPath,
13
14
  setUpdateHost,
@@ -23,11 +24,21 @@ afterEach(() => {
23
24
  });
24
25
 
25
26
  function expectedAssetName(compressed = false): string {
26
- const os = process.platform === "darwin" ? "darwin" : "linux";
27
+ const os = process.platform === "darwin" ? "darwin" : process.platform === "win32" ? "windows" : "linux";
27
28
  const arch = os === "darwin" || process.arch === "arm64" ? "arm64" : "x64";
28
- return compressed ? `gloomberb-${os}-${arch}.gz` : `gloomberb-${os}-${arch}`;
29
+ const extension = os === "windows" ? ".exe" : "";
30
+ return compressed ? `gloomberb-${os}-${arch}${extension}.gz` : `gloomberb-${os}-${arch}${extension}`;
29
31
  }
30
32
 
33
+ describe("getAssetBaseNameForRuntime", () => {
34
+ test("uses the Windows executable release asset name on win32", () => {
35
+ expect(getAssetBaseNameForRuntime({
36
+ platform: "win32",
37
+ arch: "x64",
38
+ })).toBe("gloomberb-windows-x64.exe");
39
+ });
40
+ });
41
+
31
42
  describe("detectUpdateAction", () => {
32
43
  test("uses self-update for standalone binaries", () => {
33
44
  expect(detectUpdateAction(
@@ -46,6 +57,16 @@ describe("detectUpdateAction", () => {
46
57
  });
47
58
  });
48
59
 
60
+ test("uses manual bun updates for Windows bun-managed installs", () => {
61
+ expect(detectUpdateAction(
62
+ "C:\\Program Files\\Bun\\bun.exe",
63
+ ["C:\\Program Files\\Bun\\bun.exe", "C:\\Users\\vince\\.bun\\install\\global\\node_modules\\gloomberb\\bin\\gloomberb"],
64
+ )).toEqual({
65
+ kind: "manual",
66
+ command: "bun install -g gloomberb@latest",
67
+ });
68
+ });
69
+
49
70
  test("uses manual npm updates for node-managed installs", () => {
50
71
  expect(detectUpdateAction(
51
72
  "/opt/homebrew/bin/node",
@@ -56,6 +77,13 @@ describe("detectUpdateAction", () => {
56
77
  });
57
78
  });
58
79
 
80
+ test("does not offer self-update for standalone Windows executables", () => {
81
+ expect(detectUpdateAction(
82
+ "C:\\Users\\vince\\Downloads\\gloomberb.exe",
83
+ ["C:\\Users\\vince\\Downloads\\gloomberb.exe"],
84
+ )).toBeNull();
85
+ });
86
+
59
87
  test("skips updates when launched from source under bun", () => {
60
88
  expect(detectUpdateAction(
61
89
  "/opt/homebrew/bin/bun",
@@ -76,6 +104,16 @@ describe("detectUpdateAction", () => {
76
104
  ["/Applications/Gloomberb.app/Contents/MacOS/bun", "/Applications/Gloomberb.app/Contents/Resources/gloomberb-tui/tui-entry.js"],
77
105
  )).toBeNull();
78
106
  });
107
+
108
+ test("does not suggest Bun-managed updates for the bundled Windows app TUI runtime", () => {
109
+ expect(detectUpdateAction(
110
+ "C:\\Users\\vince\\AppData\\Local\\Programs\\Gloomberb\\bin\\bun.exe",
111
+ [
112
+ "C:\\Users\\vince\\AppData\\Local\\Programs\\Gloomberb\\bin\\bun.exe",
113
+ "C:\\Users\\vince\\AppData\\Local\\Programs\\Gloomberb\\Resources\\gloomberb-tui\\tui-entry.js",
114
+ ],
115
+ )).toBeNull();
116
+ });
79
117
  });
80
118
 
81
119
  describe("resolveSelfUpdateTargetPath", () => {
@@ -93,6 +131,13 @@ describe("resolveSelfUpdateTargetPath", () => {
93
131
  )).toBeNull();
94
132
  });
95
133
 
134
+ it("rejects Windows Bun runtime paths", () => {
135
+ expect(resolveSelfUpdateTargetPath(
136
+ "C:\\Program Files\\Bun\\bun.exe",
137
+ ["C:\\Program Files\\Bun\\bun.exe", "dist\\index.js"],
138
+ )).toBeNull();
139
+ });
140
+
96
141
  it("accepts packaged gloomberb binaries", () => {
97
142
  expect(resolveSelfUpdateTargetPath(
98
143
  "/Applications/gloomberb",
package/src/updater.ts CHANGED
@@ -52,12 +52,22 @@ function compareSemver(a: string, b: string): number {
52
52
  return 0;
53
53
  }
54
54
 
55
- function getAssetBaseName(): string {
56
- const runtimeProcess = getRuntimeProcess();
57
- const os = runtimeProcess?.platform === "darwin" ? "darwin" : "linux";
55
+ export function getAssetBaseNameForRuntime(
56
+ runtimeProcess: Pick<NodeJS.Process, "platform" | "arch"> | null = getRuntimeProcess(),
57
+ ): string {
58
+ const os = runtimeProcess?.platform === "darwin"
59
+ ? "darwin"
60
+ : runtimeProcess?.platform === "win32"
61
+ ? "windows"
62
+ : "linux";
58
63
  // macOS x64 uses arm64 binary (runs via Rosetta 2)
59
64
  const arch = os === "darwin" || runtimeProcess?.arch === "arm64" ? "arm64" : "x64";
60
- return `gloomberb-${os}-${arch}`;
65
+ const extension = os === "windows" ? ".exe" : "";
66
+ return `gloomberb-${os}-${arch}${extension}`;
67
+ }
68
+
69
+ function getAssetBaseName(): string {
70
+ return getAssetBaseNameForRuntime();
61
71
  }
62
72
 
63
73
  function resolveReleaseAsset(
@@ -90,6 +100,29 @@ function basename(value: string): string {
90
100
  return normalized.slice(normalized.lastIndexOf("/") + 1);
91
101
  }
92
102
 
103
+ const runtimeExecutables = new Set([
104
+ "bun",
105
+ "bun.exe",
106
+ "bunx",
107
+ "bunx.exe",
108
+ "node",
109
+ "node.exe",
110
+ "nodejs",
111
+ "nodejs.exe",
112
+ "npm",
113
+ "npm.cmd",
114
+ "npm.exe",
115
+ "npx",
116
+ "npx.cmd",
117
+ "npx.exe",
118
+ "pnpm",
119
+ "pnpm.cmd",
120
+ "pnpm.exe",
121
+ "yarn",
122
+ "yarn.cmd",
123
+ "yarn.exe",
124
+ ]);
125
+
93
126
  function resolveEntrypointPath(argv = process.argv): string {
94
127
  return tryRealpath(argv[1] ?? "");
95
128
  }
@@ -104,6 +137,15 @@ function isMacAppBundleExecutable(execPath: string): boolean {
104
137
  return normalizePath(execPath).includes(".app/contents/macos/");
105
138
  }
106
139
 
140
+ function isBundledDesktopTuiRuntime(execPath: string, argv: string[]): boolean {
141
+ const normalizedExecPath = normalizePath(tryRealpath(execPath));
142
+ const entrypoint = normalizePath(resolveEntrypointPath(argv));
143
+ if (!entrypoint.endsWith("/resources/gloomberb-tui/tui-entry.js")) return false;
144
+ return normalizedExecPath.endsWith("/contents/macos/bun")
145
+ || normalizedExecPath.endsWith("/bin/bun")
146
+ || normalizedExecPath.endsWith("/bin/bun.exe");
147
+ }
148
+
107
149
  export function resolveSelfUpdateTargetPath(
108
150
  execPath = getRuntimeProcess()?.execPath ?? "",
109
151
  argv = getRuntimeProcess()?.argv ?? [],
@@ -113,7 +155,6 @@ export function resolveSelfUpdateTargetPath(
113
155
  if (isMacAppBundleExecutable(resolvedExecPath)) return null;
114
156
 
115
157
  const execBase = basename(normalizedExecPath);
116
- const runtimeExecutables = new Set(["bun", "bunx", "node", "nodejs", "npm", "npx", "pnpm", "yarn"]);
117
158
  if (runtimeExecutables.has(execBase)) return null;
118
159
  if (normalizedExecPath.includes("/.bun/bin/")) return null;
119
160
 
@@ -128,20 +169,24 @@ export function detectUpdateAction(
128
169
  argv = getRuntimeProcess()?.argv ?? [],
129
170
  ): UpdateAction | null {
130
171
  if (isMacAppBundleExecutable(execPath)) return null;
131
-
132
- if (resolveSelfUpdateTargetPath(execPath, argv)) {
133
- return { kind: "self" };
134
- }
172
+ if (isBundledDesktopTuiRuntime(execPath, argv)) return null;
135
173
 
136
174
  const normalizedExecPath = normalizePath(tryRealpath(execPath));
137
175
  const execBase = basename(normalizedExecPath);
138
176
  const entrypoint = normalizePath(resolveEntrypointPath(argv));
177
+ if (execBase === "gloomberb.exe") return null;
178
+
179
+ if (resolveSelfUpdateTargetPath(execPath, argv)) {
180
+ return { kind: "self" };
181
+ }
139
182
 
140
183
  if (!entrypoint || isSourceEntrypoint(entrypoint)) return null;
141
184
 
142
185
  if (
143
186
  execBase === "bun"
187
+ || execBase === "bun.exe"
144
188
  || execBase === "bunx"
189
+ || execBase === "bunx.exe"
145
190
  || normalizedExecPath.includes("/.bun/bin/")
146
191
  || entrypoint.includes("/.bun/install/")
147
192
  || entrypoint.includes("/install/global/")
@@ -151,11 +196,21 @@ export function detectUpdateAction(
151
196
 
152
197
  if (
153
198
  execBase === "node"
199
+ || execBase === "node.exe"
154
200
  || execBase === "nodejs"
201
+ || execBase === "nodejs.exe"
155
202
  || execBase === "npm"
203
+ || execBase === "npm.cmd"
204
+ || execBase === "npm.exe"
156
205
  || execBase === "npx"
206
+ || execBase === "npx.cmd"
207
+ || execBase === "npx.exe"
157
208
  || execBase === "pnpm"
209
+ || execBase === "pnpm.cmd"
210
+ || execBase === "pnpm.exe"
158
211
  || execBase === "yarn"
212
+ || execBase === "yarn.cmd"
213
+ || execBase === "yarn.exe"
159
214
  || entrypoint.includes("/lib/node_modules/")
160
215
  || entrypoint.includes("/node_modules/")
161
216
  ) {
@@ -283,6 +338,7 @@ export async function performUpdate(
283
338
 
284
339
  const updatePath = execPath + ".update";
285
340
  const oldPath = execPath + ".old";
341
+ let unlinkUpdatePath: ((path: string) => void) | null = null;
286
342
 
287
343
  try {
288
344
  const fsModulePath = "fs";
@@ -293,6 +349,7 @@ export async function performUpdate(
293
349
  unlinkSync,
294
350
  chmodSync,
295
351
  } = await import(fsModulePath) as typeof import("fs");
352
+ unlinkUpdatePath = unlinkSync;
296
353
  const { gunzipSync } = await import(zlibModulePath) as typeof import("zlib");
297
354
 
298
355
  onProgress({ phase: "downloading", percent: 0 });
@@ -343,7 +400,7 @@ export async function performUpdate(
343
400
  } catch (err: unknown) {
344
401
  // Clean up temp file on failure
345
402
  try {
346
- unlinkSync(updatePath);
403
+ unlinkUpdatePath?.(updatePath);
347
404
  } catch {}
348
405
  onProgress({
349
406
  phase: "error",
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = "0.8.2";
1
+ export const VERSION = "0.9.1";