gloomberb 0.19.3 → 0.19.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.
Files changed (104) hide show
  1. package/package.json +2 -2
  2. package/src/api-client/errors.ts +8 -0
  3. package/src/api-client/index.ts +18 -0
  4. package/src/api-client/request.ts +295 -42
  5. package/src/api-client/socket.ts +95 -0
  6. package/src/app/keybindings/actions.ts +1 -1
  7. package/src/app/pane-runtime/index.tsx +1 -1
  8. package/src/app/pane-runtime/ticker-inspector-runtime.ts +1 -1
  9. package/src/app/pane-runtime/ticker-open-runtime.ts +1 -1
  10. package/src/app/pane-runtime/ticker-open-target.ts +12 -2
  11. package/src/cli/desktop-pane-shot-api-policy.ts +10 -2
  12. package/src/cli/desktop-pane-shot.ts +2 -1
  13. package/src/components/command-bar/action-runtime.ts +2 -0
  14. package/src/components/command-bar/commands/direct/runtime.ts +3 -3
  15. package/src/components/command-bar/helpers.ts +2 -0
  16. package/src/components/command-bar/list/model.ts +9 -0
  17. package/src/components/command-bar/pane-actions.ts +46 -35
  18. package/src/components/command-bar/pane-templates/workflow.ts +6 -0
  19. package/src/components/command-bar/panel/index.tsx +30 -3
  20. package/src/components/command-bar/panel/types.ts +7 -0
  21. package/src/components/command-bar/routes/root/results.ts +4 -4
  22. package/src/components/command-bar/routes/root/selection.ts +3 -2
  23. package/src/components/command-bar/routes/ticker-search/actions.ts +21 -16
  24. package/src/components/command-bar/routing/launch-request.ts +3 -2
  25. package/src/components/command-bar/routing/list-state.ts +4 -1
  26. package/src/components/command-bar/surface/index.tsx +15 -1
  27. package/src/components/layout/floating-pane.tsx +10 -0
  28. package/src/components/layout/pane/frame.tsx +6 -0
  29. package/src/components/layout/pane/header.tsx +244 -42
  30. package/src/components/layout/pane/index.tsx +20 -2
  31. package/src/components/layout/shell/active-drag.ts +128 -27
  32. package/src/components/layout/shell/drag/index.ts +99 -96
  33. package/src/components/layout/shell/drag/live.ts +3 -17
  34. package/src/components/layout/shell/drag/magnets.ts +198 -0
  35. package/src/components/layout/shell/drag/overlays.tsx +77 -75
  36. package/src/components/layout/shell/drag/runtime.ts +12 -7
  37. package/src/components/layout/shell/index.tsx +66 -32
  38. package/src/components/layout/shell/native/pointer-runtime.ts +7 -2
  39. package/src/components/layout/shell/native/surfaces.ts +1 -9
  40. package/src/components/layout/shell/native/window-state.ts +21 -25
  41. package/src/components/layout/shell/pane/layers.tsx +153 -24
  42. package/src/components/layout/shell/shortcuts.ts +4 -1
  43. package/src/components/layout/shell/terminal-pointer-runtime.ts +24 -1
  44. package/src/components/layout/shell/window-mode/overlays.tsx +14 -6
  45. package/src/components/layout/status-bar.tsx +75 -6
  46. package/src/core/app-runtime.ts +4 -1
  47. package/src/core/connection-health.ts +76 -1
  48. package/src/core/state/app/command-bar-launch.ts +12 -0
  49. package/src/core/state/app/layout.ts +4 -3
  50. package/src/core/state/app/types.ts +4 -1
  51. package/src/data/config/layout.ts +2 -2
  52. package/src/data/config/store/fold-panes.ts +6 -1
  53. package/src/i18n/es.ts +8 -1
  54. package/src/i18n/ja.ts +8 -1
  55. package/src/i18n/ko.ts +8 -1
  56. package/src/i18n/zh-cn.ts +8 -1
  57. package/src/i18n/zh-tw.ts +8 -1
  58. package/src/layout/pane-follow.ts +3 -2
  59. package/src/layout/pane-layout-move.ts +2 -1
  60. package/src/layout/pane-manager/dock-stack.ts +38 -0
  61. package/src/layout/pane-manager/dock-tree.ts +76 -15
  62. package/src/layout/pane-manager/docking.ts +48 -6
  63. package/src/layout/pane-manager/floating-actions.ts +12 -3
  64. package/src/layout/pane-manager/floating-placement.ts +189 -0
  65. package/src/layout/pane-manager/floating.ts +23 -4
  66. package/src/layout/pane-manager/gridlock.ts +16 -4
  67. package/src/layout/pane-manager/hidden-panes.ts +30 -1
  68. package/src/layout/pane-manager/index.ts +2 -0
  69. package/src/layout/pane-manager/layout-state.ts +17 -0
  70. package/src/layout/pane-manager/types.ts +4 -1
  71. package/src/layout/ticker-retarget.ts +88 -0
  72. package/src/layout-marketplace/cloud.ts +9 -1
  73. package/src/market-data/connection-follow.ts +68 -0
  74. package/src/market-data/coordinator/entries.ts +15 -3
  75. package/src/market-data/coordinator/financials.ts +20 -7
  76. package/src/market-data/coordinator/index.ts +217 -4
  77. package/src/market-data/coordinator/quotes.ts +10 -0
  78. package/src/market-data/hooks.tsx +31 -0
  79. package/src/news/aggregator.ts +12 -1
  80. package/src/plugins/builtin/buildout/company/pane.tsx +2 -1
  81. package/src/plugins/builtin/buildout/model/index.ts +6 -0
  82. package/src/plugins/builtin/buildout/pane/index.tsx +2 -1
  83. package/src/plugins/builtin/chart-composer/index.tsx +13 -0
  84. package/src/plugins/builtin/chat/controller/index.ts +10 -3
  85. package/src/plugins/builtin/chat/controller/session-runtime.ts +9 -2
  86. package/src/plugins/builtin/chat/status-widget.tsx +3 -1
  87. package/src/plugins/builtin/help/index.tsx +1 -1
  88. package/src/plugins/builtin/sectors/client.ts +18 -8
  89. package/src/plugins/builtin/sectors/index.tsx +19 -5
  90. package/src/plugins/builtin/ticker-detail/overview/pane.tsx +4 -1
  91. package/src/plugins/builtin/ticker-detail/overview-tab.tsx +25 -2
  92. package/src/react/async-resource.ts +12 -0
  93. package/src/remote/controller.ts +3 -1
  94. package/src/renderers/browser/app-services.ts +8 -1
  95. package/src/renderers/browser/cloud-transport.ts +6 -1
  96. package/src/renderers/cloudflare/worker.ts +24 -2
  97. package/src/renderers/dom/styles.css +32 -0
  98. package/src/shares/portable-layout.ts +99 -2
  99. package/src/sources/provider-router/index.ts +2 -2
  100. package/src/sources/provider-router/sources.ts +26 -1
  101. package/src/sync/core-contributors.ts +18 -4
  102. package/src/time-series/resolve.ts +12 -0
  103. package/src/types/config.ts +17 -1
  104. package/src/types/plugin.ts +6 -0
@@ -55,6 +55,8 @@ import {
55
55
  usePublishStatusWidgetRoom,
56
56
  } from "./status-widget-space";
57
57
  import { StarPromptStatusLine } from "../../app/star-prompt/status-line";
58
+ import { connectionHealth as sharedConnectionHealth, GLOOM_CLOUD_HTTP_CONNECTION_ID } from "../../core/connection-health";
59
+ import { DATA_SERVICE_UNREACHABLE_MESSAGE } from "../../utils/network-failure";
58
60
 
59
61
  type StatusBarEvent = { stopPropagation?: () => void; preventDefault?: () => void };
60
62
  type HoveredControl = string | null;
@@ -66,6 +68,14 @@ type SetHoveredControl = (updater: (current: HoveredControl) => HoveredControl)
66
68
  */
67
69
  const DESKTOP_DOWNLOAD_URL = "https://gloom.sh/download/desktop";
68
70
 
71
+ /**
72
+ * The note while the data service gives no answer at all, and its short form
73
+ * for a narrow terminal. Every pane's own failure says why; this says once,
74
+ * for the whole app, that it is the connection, and goes when it answers.
75
+ */
76
+ const CONNECTION_NOTE = "Can't reach the data service";
77
+ const CONNECTION_NOTE_SHORT = "Offline";
78
+
69
79
  type LayoutTabItem = {
70
80
  label: string;
71
81
  value: string;
@@ -88,6 +98,9 @@ type StatusBarViewProps = {
88
98
  openChangelog?: (event?: StatusBarEvent) => void;
89
99
  openLayoutContextMenu: (index: number, event: any) => void | Promise<unknown>;
90
100
  rightAvailableWidth: number;
101
+ /** The connection note to show (CONNECTION_NOTE or its short form), or null while the data service answers. */
102
+ connectionNote: string | null;
103
+ openConnections: () => void;
91
104
  setHoveredControl: SetHoveredControl;
92
105
  showTidyWindows: boolean;
93
106
  };
@@ -397,6 +410,17 @@ export function StatusBar({ onOpenChangelog }: { onOpenChangelog?: (version: str
397
410
  onContextMenu: handleLayoutTabContextMenu,
398
411
  }));
399
412
 
413
+ // Unreachable from the first request that got no answer until anything answers again.
414
+ const health = registry?.connectionHealth ?? sharedConnectionHealth;
415
+ const subscribeHealth = useCallback((onChange: () => void) => health.subscribe(onChange), [health]);
416
+ const dataServiceUnreachable = useSyncExternalStore(
417
+ subscribeHealth,
418
+ () => health.unreachableSince(GLOOM_CLOUD_HTTP_CONNECTION_ID) != null,
419
+ );
420
+ const openConnections = () => {
421
+ registry?.showPane("connections");
422
+ };
423
+
400
424
  const claimedWidgetColumns = useClaimedStatusWidgetColumns();
401
425
  const tidyWindowsKey = actionKey("tidy-windows");
402
426
  const controlsWidth = (TERMINAL_NEW_LAYOUT_LABEL.length + 1)
@@ -413,6 +437,15 @@ export function StatusBar({ onOpenChangelog }: { onOpenChangelog?: (version: str
413
437
 
414
438
  if (!statusBarVisible) return null;
415
439
 
440
+ // Feedback keeps the bottom-right corner; the connection note comes before
441
+ // the version chip, which gives way first, also to a widget that claimed
442
+ // more than the usual room. A narrow terminal shortens the note.
443
+ const rightWidth = Math.max(0, termWidth - leftWidth - STATUS_WIDGET_COLUMNS - claimedWidgetColumns - feedbackWidth);
444
+ const connectionNote = !dataServiceUnreachable ? null
445
+ : nativePaneChrome || rightWidth >= displayWidth(t(CONNECTION_NOTE)) + 1 ? CONNECTION_NOTE
446
+ : rightWidth >= displayWidth(t(CONNECTION_NOTE_SHORT)) + 1 ? CONNECTION_NOTE_SHORT : null;
447
+ const connectionNoteWidth = connectionNote && !nativePaneChrome ? displayWidth(t(connectionNote)) + 1 : 0;
448
+
416
449
  const viewProps: StatusBarViewProps = {
417
450
  activeLayoutIdx,
418
451
  activeLayoutValue,
@@ -425,9 +458,9 @@ export function StatusBar({ onOpenChangelog }: { onOpenChangelog?: (version: str
425
458
  layoutTabsWidth: tabsWidth,
426
459
  openChangelog: onOpenChangelog ? openChangelog : undefined,
427
460
  openLayoutContextMenu,
428
- // Feedback keeps the bottom-right corner; the version chip gives way first,
429
- // also to a widget that claimed more than the usual room.
430
- rightAvailableWidth: Math.max(0, termWidth - leftWidth - STATUS_WIDGET_COLUMNS - claimedWidgetColumns - feedbackWidth),
461
+ rightAvailableWidth: Math.max(0, rightWidth - connectionNoteWidth),
462
+ connectionNote,
463
+ openConnections,
431
464
  setHoveredControl,
432
465
  showTidyWindows,
433
466
  tidyWindowsKey,
@@ -464,6 +497,7 @@ function NativeStatusBar({
464
497
  <NativeNewLayout />
465
498
  {showTidyWindows && <NativeTidyWindows {...props} />}
466
499
  <Box flexGrow={1} minWidth={0} />
500
+ <StatusBarConnectionNote nativePaneChrome {...props} />
467
501
  <StatusBarSummary nativePaneChrome {...props} />
468
502
  {/* Widgets keep their width; the layout tabs give way instead. */}
469
503
  <Box flexShrink={0} flexDirection="row" alignItems="center" data-gloom-role="status-widgets">
@@ -496,6 +530,7 @@ function TerminalStatusBar({
496
530
  <TerminalNewLayout {...props} />
497
531
  {showTidyWindows && <TerminalTidyWindows {...props} />}
498
532
  <Box flexGrow={1} minWidth={0} />
533
+ <StatusBarConnectionNote nativePaneChrome={false} {...props} />
499
534
  <StatusBarSummary nativePaneChrome={false} {...props} />
500
535
  <StarPromptStatusLine />
501
536
  <PluginSlot name="status:widget" />
@@ -599,6 +634,33 @@ function StatusBarSummary({
599
634
  );
600
635
  }
601
636
 
637
+ /**
638
+ * Says the data service is unreachable while it is, in the warning tone a
639
+ * pane footer gives a failure; it opens Connections, which has the detail.
640
+ */
641
+ function StatusBarConnectionNote({
642
+ connectionNote,
643
+ hoveredControl,
644
+ nativePaneChrome,
645
+ openConnections,
646
+ setHoveredControl,
647
+ }: Pick<StatusBarViewProps, "connectionNote" | "hoveredControl" | "openConnections" | "setHoveredControl"> & { nativePaneChrome: boolean }) {
648
+ if (!connectionNote) return null;
649
+ return (
650
+ <StatusBarChip
651
+ hoveredControl={hoveredControl}
652
+ id="connection"
653
+ label={t(connectionNote)}
654
+ nativePaneChrome={nativePaneChrome}
655
+ onPress={openConnections}
656
+ role="button"
657
+ setHoveredControl={setHoveredControl}
658
+ title={`${t(DATA_SERVICE_UNREACHABLE_MESSAGE)}. ${t("Open Connections")} (CONN)`}
659
+ tone="warning"
660
+ />
661
+ );
662
+ }
663
+
602
664
  /** Opens Send Feedback from the bottom-right corner, on every renderer. */
603
665
  function StatusBarFeedback({
604
666
  hoveredControl,
@@ -619,7 +681,10 @@ function StatusBarFeedback({
619
681
  );
620
682
  }
621
683
 
622
- /** Dim text at the row's right edge that lights up when it can be pressed. */
684
+ /**
685
+ * Dim text at the row's right edge that lights up when it can be pressed; a
686
+ * `warning` one keeps the warning tone, as a footer's failure does.
687
+ */
623
688
  function StatusBarChip({
624
689
  hoveredControl,
625
690
  id,
@@ -629,6 +694,7 @@ function StatusBarChip({
629
694
  role,
630
695
  setHoveredControl,
631
696
  title,
697
+ tone,
632
698
  }: Pick<StatusBarViewProps, "hoveredControl" | "setHoveredControl"> & {
633
699
  id: string;
634
700
  label: string;
@@ -636,13 +702,16 @@ function StatusBarChip({
636
702
  onPress?: (event?: StatusBarEvent) => void;
637
703
  role: "button" | "link";
638
704
  title?: string;
705
+ tone?: "warning";
639
706
  }) {
640
707
  const colors = useThemeColors();
641
708
  const hovered = hoveredControl === id;
642
709
  if (nativePaneChrome && onPress) {
643
710
  return (
644
711
  <Box paddingRight={1} flexShrink={0}>
645
- <Button variant="plain" compact label={title ?? label} displayLabel={label} title={title} onPress={() => onPress()} />
712
+ <Button variant="plain" compact label={title ?? label} displayLabel={tone ? undefined : label} title={title} onPress={() => onPress()}>
713
+ {tone ? <Text fg={colors[tone]}>{label}</Text> : undefined}
714
+ </Button>
646
715
  </Box>
647
716
  );
648
717
  }
@@ -656,7 +725,7 @@ function StatusBarChip({
656
725
  return (
657
726
  <Box paddingRight={1} flexShrink={0}>
658
727
  <Text
659
- fg={hovered && press ? colors.text : colors.textDim}
728
+ fg={tone ? colors[tone] : hovered && press ? colors.text : colors.textDim}
660
729
  {...(!nativePaneChrome ? { bg: hovered && press ? hoverBg(colors) : undefined } : {})}
661
730
  title={press ? title : undefined}
662
731
  aria-label={press ? title : undefined}
@@ -1,4 +1,5 @@
1
1
  import { MarketDataCoordinator, getSharedMarketDataCoordinator, setSharedMarketDataCoordinator } from "../market-data/coordinator";
2
+ import { followDataServiceHealth } from "../market-data/connection-follow";
2
3
  import { NewsService, type NewsServiceOptions } from "../news/aggregator";
3
4
  import { cloudNewsSession } from "../news/cloud-session";
4
5
  import { getSharedNewsService, setSharedNewsService } from "../news/hooks";
@@ -59,6 +60,8 @@ export function createAppRuntime({
59
60
  // Usage counts keep a mnemonic for these; a plugin installed later is not one of them.
60
61
  rememberBuiltinPlugins(plugins.filter((plugin) => !externalPlugins?.some((entry) => entry.plugin === plugin)));
61
62
  const marketData = new MarketDataCoordinator(dataProvider);
63
+ // What an outage failed loads again once the data service answers; prices read stale while their stream is down.
64
+ const stopFollowingHealth = followDataServiceHealth(pluginRegistry.connectionHealth, marketData);
62
65
  const newsService = new NewsService({
63
66
  connectionHealth: pluginRegistry.connectionHealth,
64
67
  pollIntervalMs: () => Math.max(1, config.refreshIntervalMinutes) * 60_000,
@@ -95,7 +98,7 @@ export function createAppRuntime({
95
98
  if (getSharedMarketDataCoordinator() === marketData) setSharedMarketDataCoordinator(null);
96
99
  if (getSharedNewsService() === newsService) setSharedNewsService(null);
97
100
  dispose(
98
- disposeReady, () => newsService.stop(), () => marketData.destroy(),
101
+ disposeReady, () => newsService.stop(), stopFollowingHealth, () => marketData.destroy(),
99
102
  // An async setup may still use persistence or contribute panes. Dispose it
100
103
  // after setup settles, so it cannot write into a closed store or leak late contributions.
101
104
  registering ? undefined : disposePlugins,
@@ -1,4 +1,5 @@
1
1
  import { errorMessage } from "../utils/errors";
2
+ import { logFailure } from "../utils/log-failure";
2
3
 
3
4
  type ConnectionHealthKind = "asset-data" | "news" | "api" | "websocket" | "capability";
4
5
  export type ConnectionHealthStatus = "idle" | "connecting" | "connected" | "disconnected" | "error";
@@ -33,6 +34,12 @@ export interface ConnectionHealthState extends ConnectionHealthSource {
33
34
  socketState: ConnectionSocketState | null;
34
35
  lastTransitionAt: number | null;
35
36
  currentDetail: string | null;
37
+ /**
38
+ * Since when the service behind the source gave no answer at all (a refused
39
+ * connection, or one that hung with nothing back), while nothing it sent has
40
+ * come back since; null while it answers. See `reportReachability`.
41
+ */
42
+ unreachableSince: number | null;
36
43
  }
37
44
 
38
45
  export interface ConnectionHealthSnapshot {
@@ -60,6 +67,7 @@ export const GLOOM_CLOUD_FRED_CONNECTION_ID = "gloom-cloud-fred";
60
67
 
61
68
  const MAX_RECENT_REQUESTS = 20;
62
69
  const DEFAULT_REQUEST_STATUS_TTL_MS = 60_000;
70
+ const logRecoveryListenerFailure = logFailure("core.connection-health", "A recovery listener failed");
63
71
 
64
72
  function socketStatus(state: ConnectionSocketState): ConnectionHealthStatus {
65
73
  if (state === "open") return "connected";
@@ -82,6 +90,7 @@ export class ConnectionHealthRegistry {
82
90
  private readonly sources = new Map<string, ConnectionHealthState>();
83
91
  private readonly registrations = new Map<string, symbol>();
84
92
  private readonly listeners = new Set<() => void>();
93
+ private readonly recoveryListeners = new Set<(sourceId: string) => void>();
85
94
  private readonly external = new Map<string, ConnectionHealthState[]>();
86
95
  private readonly now: () => number;
87
96
  private readonly clock: () => number;
@@ -110,6 +119,7 @@ export class ConnectionHealthRegistry {
110
119
  socketState: source.kind === "websocket" ? "idle" : null,
111
120
  lastTransitionAt: null,
112
121
  currentDetail: source.detail ?? null,
122
+ unreachableSince: null,
113
123
  });
114
124
 
115
125
  this.emit();
@@ -156,6 +166,63 @@ export class ConnectionHealthRegistry {
156
166
  this.emit();
157
167
  }
158
168
 
169
+ /**
170
+ * Whether the service behind a source answers at all. A request refused, or
171
+ * hung with nothing back, makes it unreachable; the first answer of any kind
172
+ * after that makes it reachable again, and `subscribeRecovery` listeners
173
+ * hear of it, so what failed during the outage can be asked again.
174
+ */
175
+ reportReachability(sourceId: string, reachable: boolean): void {
176
+ const source = this.sources.get(sourceId);
177
+ if (!source || (source.unreachableSince === null) === reachable) return;
178
+ this.sources.set(sourceId, { ...source, unreachableSince: reachable ? null : this.now() });
179
+ this.emit();
180
+ if (reachable) this.emitRecovery(sourceId);
181
+ }
182
+
183
+ /**
184
+ * Tells recovery listeners the source answers again. They run inside the
185
+ * request that brought the answer: one that throws must fail neither that
186
+ * request nor the listeners after it.
187
+ */
188
+ private emitRecovery(sourceId: string): void {
189
+ for (const listener of [...this.recoveryListeners]) {
190
+ try {
191
+ listener(sourceId);
192
+ } catch (error) {
193
+ logRecoveryListenerFailure(error);
194
+ }
195
+ }
196
+ }
197
+
198
+ /** Since when the source's service gave no answer at all, or null while it answers (`reportReachability`). */
199
+ unreachableSince(sourceId: string): number | null {
200
+ return this.peek(sourceId)?.unreachableSince ?? null;
201
+ }
202
+
203
+ /** A websocket source's state as last reported, or null for another kind of source or one not registered. */
204
+ socketState(sourceId: string): ConnectionSocketState | null {
205
+ return this.peek(sourceId)?.socketState ?? null;
206
+ }
207
+
208
+ /**
209
+ * The source's state as `getSnapshot` shows it, without a copy: another
210
+ * process's (`replaceExternalSnapshot`) over this one's own.
211
+ */
212
+ private peek(sourceId: string): ConnectionHealthState | null {
213
+ for (const external of this.external.values()) {
214
+ const source = external.find((entry) => entry.id === sourceId);
215
+ if (source) return source;
216
+ }
217
+ return this.sources.get(sourceId) ?? null;
218
+ }
219
+
220
+ /** Called with the source's id each time its service answers again after it went unanswered. */
221
+ subscribeRecovery(listener: (sourceId: string) => void): () => void {
222
+ this.recoveryListeners.add(listener);
223
+ return () => this.recoveryListeners.delete(listener);
224
+ }
225
+
159
226
  subscribe(listener: () => void): () => void {
160
227
  this.listeners.add(listener);
161
228
  return () => this.listeners.delete(listener);
@@ -182,8 +249,16 @@ export class ConnectionHealthRegistry {
182
249
  }
183
250
 
184
251
  replaceExternalSnapshot(namespace: string, snapshot: ConnectionHealthSnapshot): void {
185
- this.external.set(namespace, snapshot.sources.map(cloneState));
252
+ const previous = this.external.get(namespace) ?? [];
253
+ const next = snapshot.sources.map(cloneState);
254
+ this.external.set(namespace, next);
186
255
  this.emit();
256
+ // Another process's service answering again is a recovery here too (the desktop app's data requests run in its backend).
257
+ for (const source of next) {
258
+ if (source.unreachableSince != null) continue;
259
+ if (previous.find((entry) => entry.id === source.id)?.unreachableSince == null) continue;
260
+ this.emitRecovery(source.id);
261
+ }
187
262
  }
188
263
 
189
264
  clearExternalSnapshot(namespace: string): void {
@@ -0,0 +1,12 @@
1
+ /**
2
+ * What a ticker search's rows do, carried by its route (and by a launch request that opens one).
3
+ * Without one, Enter changes the focused pane's ticker (`layout/ticker-retarget.ts`).
4
+ */
5
+ export type TickerSearchPayload = Readonly<Record<string, unknown>>;
6
+
7
+ /**
8
+ * The ticker search DES opens: its rows open DES. So does every search that opens on a ticker
9
+ * rather than on a pane: plain `DES`, the listings of an ambiguous open, remote control's ticker
10
+ * mode. Only the backtick and a pane header's ticker search for the focused pane.
11
+ */
12
+ export const SECURITY_DESCRIPTION_SEARCH: TickerSearchPayload = { action: "security-description" };
@@ -1,4 +1,4 @@
1
- import { compactFloatingZ, getDockLeafLayouts, getDockedPaneIds } from "../../../layout/pane-manager";
1
+ import { compactFloatingZ, getDockLeafLayouts, getDockedPaneIds, showDockTab } from "../../../layout/pane-manager";
2
2
  import { pinFollowingPane } from "../../../layout/pane-follow";
3
3
  import {
4
4
  cloneLayout,
@@ -538,7 +538,8 @@ export function materializeDetachedLayouts(config: AppConfig): AppConfig {
538
538
  }
539
539
 
540
540
  export function focusPaneState(state: AppState, paneId: string): AppState {
541
- const layout = bringFloatingToFront(state.config.layout, paneId);
541
+ // A tab of a stack is shown when it takes focus.
542
+ const layout = showDockTab(bringFloatingToFront(state.config.layout, paneId), paneId);
542
543
  const config = layout !== state.config.layout ? { ...state.config, layout } : state.config;
543
544
  const recentTickers = nextRecentTickers(
544
545
  state.recentTickers,
@@ -586,7 +587,7 @@ export function withFocusedPane(
586
587
  ? (options.focusedPaneId ?? null)
587
588
  : state.focusedPaneId;
588
589
  const focusedPaneId = resolveFocusedPaneId(nextConfig.layout, requestedFocusedPaneId);
589
- const focusedLayout = focusedPaneId ? bringFloatingToFront(nextConfig.layout, focusedPaneId) : nextConfig.layout;
590
+ const focusedLayout = focusedPaneId ? showDockTab(bringFloatingToFront(nextConfig.layout, focusedPaneId), focusedPaneId) : nextConfig.layout;
590
591
  const focusedConfig = focusedLayout === nextConfig.layout ? nextConfig : { ...nextConfig, layout: focusedLayout };
591
592
  const syncedConfig = syncConfigActiveLayoutState(focusedConfig, nextPaneState, focusedPaneId);
592
593
  return {
@@ -4,6 +4,7 @@ import type { DesktopSharedStateSnapshot } from "../../../types/desktop-window";
4
4
  import type { Quote, TickerFinancials } from "../../../types/financials";
5
5
  import type { TickerRecord } from "../../../types/ticker";
6
6
  import type { ReleaseInfo, UpdateProgress } from "../../../updater";
7
+ import type { TickerSearchPayload } from "./command-bar-launch";
7
8
 
8
9
  export interface PaneRuntimeState {
9
10
  cursorSymbol?: string | null;
@@ -33,6 +34,8 @@ interface CommandBarLaunchRequestBase {
33
34
  interface CommandBarTickerSearchLaunchRequest extends CommandBarLaunchRequestBase {
34
35
  kind: "ticker-search";
35
36
  query?: string;
37
+ /** The search route's payload: `SECURITY_DESCRIPTION_SEARCH` opens DES rather than changing the focused pane. */
38
+ payload?: TickerSearchPayload;
36
39
  }
37
40
 
38
41
  /**
@@ -54,7 +57,7 @@ interface CommandBarAddListingLaunchRequest extends CommandBarLaunchRequestBase
54
57
 
55
58
  /** Forms open in their own modal (`openFormModal`), so the bar launches only its own screens. */
56
59
  type CommandBarLaunch =
57
- | { kind: "ticker-search"; query?: string }
60
+ | { kind: "ticker-search"; query?: string; payload?: TickerSearchPayload }
58
61
  | { kind: "run-query"; query: string }
59
62
  | { kind: "add-listing"; collectionId: string; collectionKind: "watchlist" | "portfolio" };
60
63
 
@@ -106,8 +106,8 @@ function sanitizeDockedPlacementMemory(raw: unknown): DockedPlacementMemory | un
106
106
  const anchorInstanceId = typeof (raw as { anchorInstanceId?: unknown }).anchorInstanceId === "string"
107
107
  ? (raw as { anchorInstanceId: string }).anchorInstanceId
108
108
  : undefined;
109
- const position = ["left", "right", "above", "below"].includes(String((raw as { position?: unknown }).position))
110
- ? (raw as { position: "left" | "right" | "above" | "below" }).position
109
+ const position = ["left", "right", "above", "below", "tab"].includes(String((raw as { position?: unknown }).position))
110
+ ? (raw as { position: NonNullable<DockedPlacementMemory["position"]> }).position
111
111
  : undefined;
112
112
  if (!path && !anchorInstanceId && !position) return undefined;
113
113
  return {
@@ -94,7 +94,12 @@ function interestInstanceId(instanceId: string): string {
94
94
  function mapNode(node: DockLayoutNode | null, idMap: Map<string, string>): DockLayoutNode | null {
95
95
  if (!node) return null;
96
96
  if (node.kind === "pane") return { ...node, instanceId: idMap.get(node.instanceId) ?? node.instanceId };
97
- return { ...node, first: mapNode(node.first, idMap)!, second: mapNode(node.second, idMap)! };
97
+ return {
98
+ ...node,
99
+ first: mapNode(node.first, idMap)!,
100
+ second: mapNode(node.second, idMap)!,
101
+ ...(node.tabs ? { tabs: { active: idMap.get(node.tabs.active) ?? node.tabs.active } } : {}),
102
+ };
98
103
  }
99
104
 
100
105
  /** Daily short volume becomes the short interest pane's volume tab, and sovereign CDS the index board's Sovereign tab. */
package/src/i18n/es.ts CHANGED
@@ -174,6 +174,9 @@ export const es: Record<string, string> = {
174
174
  "Reset Layout": "Restablecer diseño",
175
175
  "Reset Current Layout": "Restablecer diseño actual",
176
176
  "Security Description": "Descripción del valor",
177
+ "Change ticker": "Cambiar ticker",
178
+ "Change ticker · {pane}": "Cambiar ticker · {pane}",
179
+ "New pane": "Nuevo panel",
177
180
 
178
181
  // ── Core command descriptions ────────────────────────────────
179
182
  "Show or hide the keyboard shortcuts bar": "Mostrar u ocultar la barra de atajos",
@@ -219,6 +222,7 @@ export const es: Record<string, string> = {
219
222
  "Create or update a manual position without leaving the command bar.": "Crea o actualiza una posición manual sin salir de la barra de comandos.",
220
223
  "Organize panes and saved layouts.": "Organiza paneles y diseños guardados.",
221
224
  "Resolve a ticker, then open its Ticker Research pane.": "Resuelve un ticker y abre su panel de análisis.",
225
+ "Resolve a ticker for the focused pane, or open it in a new pane.": "Resuelve un ticker para el panel activo o ábrelo en un panel nuevo.",
222
226
  "Toggle optional plugins without leaving the command bar.": "Alterna plugins opcionales sin salir de la barra de comandos.",
223
227
 
224
228
  // ── Layout actions ───────────────────────────────────────────
@@ -246,6 +250,8 @@ export const es: Record<string, string> = {
246
250
  "Share Pane": "Compartir panel",
247
251
  "Pop Out": "Abrir en ventana",
248
252
  "Move Window...": "Mover ventana...",
253
+ "Change Ticker...": "Cambiar ticker...",
254
+ "Change Ticker": "Cambiar ticker",
249
255
  "Resize Window...": "Redimensionar ventana...",
250
256
  "Move Window": "Mover ventana",
251
257
  "Resize Window": "Redimensionar ventana",
@@ -552,7 +558,8 @@ export const es: Record<string, string> = {
552
558
  "Cycle windows or resize handles.": "Alternar ventanas o controles de tamaño.",
553
559
  "Commit pending changes or exit window mode.": "Confirmar cambios pendientes o salir del modo ventana.",
554
560
  "Open command mode for actions, pane commands, and typed prefixes.": "Abrir el modo comando para acciones, comandos de panel y prefijos.",
555
- "Open ticker search directly.": "Abrir directamente la búsqueda de tickers.",
561
+ "Change the focused pane's ticker.": "Cambia el ticker del panel activo.",
562
+ "Ticker search: Enter changes the focused pane's ticker and the panes linked to it, as a click on the ticker in a pane's title does on the desktop and the web. Shift+Enter opens a new pane. From a pane with no ticker it opens DES.": "Búsqueda de tickers: Enter cambia el ticker del panel activo y de los paneles vinculados a él, como un clic en el ticker del título de un panel en el escritorio y la web. Shift+Enter abre un panel nuevo. Desde un panel sin ticker abre DES.",
556
563
  "Open security details for a specific ticker.": "Abrir los detalles de un ticker específico.",
557
564
  "Move through command bar results.": "Moverse por los resultados de la barra de comandos.",
558
565
  "Run the selected result or its secondary action.": "Ejecutar el resultado seleccionado o su acción secundaria.",
package/src/i18n/ja.ts CHANGED
@@ -175,6 +175,9 @@ export const ja: Record<string, string> = {
175
175
  "Reset Layout": "レイアウトをリセット",
176
176
  "Reset Current Layout": "現在のレイアウトをリセット",
177
177
  "Security Description": "銘柄詳細",
178
+ "Change ticker": "銘柄を変更",
179
+ "Change ticker · {pane}": "銘柄を変更 · {pane}",
180
+ "New pane": "新しいペイン",
178
181
 
179
182
  // ── Core command descriptions ────────────────────────────────
180
183
  "Show or hide the keyboard shortcuts bar": "キーボードショートカットバーを表示/非表示",
@@ -220,6 +223,7 @@ export const ja: Record<string, string> = {
220
223
  "Create or update a manual position without leaving the command bar.": "コマンドバー内で手動ポジションを作成または更新します。",
221
224
  "Organize panes and saved layouts.": "ペインと保存されたレイアウトを整理します。",
222
225
  "Resolve a ticker, then open its Ticker Research pane.": "銘柄コードを確認して銘柄リサーチを開きます。",
226
+ "Resolve a ticker for the focused pane, or open it in a new pane.": "選択中のペインの銘柄コードを確認するか、新しいペインで開きます。",
223
227
  "Toggle optional plugins without leaving the command bar.": "コマンド バーを離れることなく、オプションのプラグインを切り替えます。",
224
228
 
225
229
  // ── Layout actions ───────────────────────────────────────────
@@ -247,6 +251,8 @@ export const ja: Record<string, string> = {
247
251
  "Share Pane": "ペインを共有",
248
252
  "Pop Out": "別ウィンドウで表示",
249
253
  "Move Window...": "ウィンドウを移動...",
254
+ "Change Ticker...": "銘柄を変更...",
255
+ "Change Ticker": "銘柄を変更",
250
256
  "Resize Window...": "ウィンドウのサイズを変更...",
251
257
  "Move Window": "ウィンドウを移動",
252
258
  "Resize Window": "ウィンドウのサイズを変更",
@@ -553,7 +559,8 @@ export const ja: Record<string, string> = {
553
559
  "Cycle windows or resize handles.": "ウィンドウを循環させるか、ハンドルのサイズを変更します。",
554
560
  "Commit pending changes or exit window mode.": "保留中の変更をコミットするか、ウィンドウ モードを終了します。",
555
561
  "Open command mode for actions, pane commands, and typed prefixes.": "アクション、ペイン コマンド、および入力されたプレフィックスのコマンド モードを開きます。",
556
- "Open ticker search directly.": "銘柄検索を直接開きます。",
562
+ "Change the focused pane's ticker.": "選択中のペインの銘柄を変更します。",
563
+ "Ticker search: Enter changes the focused pane's ticker and the panes linked to it, as a click on the ticker in a pane's title does on the desktop and the web. Shift+Enter opens a new pane. From a pane with no ticker it opens DES.": "銘柄検索: Enter で選択中のペインとリンクされたペインの銘柄を変更します。デスクトップと Web ではペインのタイトルの銘柄をクリックしても同じです。Shift+Enter で新しいペインを開きます。銘柄のないペインからは DES を開きます。",
557
564
  "Open security details for a specific ticker.": "指定した銘柄の詳細を開きます。",
558
565
  "Move through command bar results.": "コマンド バーの結果を移動します。",
559
566
  "Run the selected result or its secondary action.": "選択した結果またはその二次アクションを実行します。",
package/src/i18n/ko.ts CHANGED
@@ -173,6 +173,9 @@ export const ko: Record<string, string> = {
173
173
  "Reset Layout": "레이아웃 재설정",
174
174
  "Reset Current Layout": "현재 레이아웃 재설정",
175
175
  "Security Description": "종목 상세",
176
+ "Change ticker": "종목 변경",
177
+ "Change ticker · {pane}": "종목 변경 · {pane}",
178
+ "New pane": "새 패널",
176
179
 
177
180
  // ── Core command descriptions ────────────────────────────────
178
181
  "Show or hide the keyboard shortcuts bar": "키보드 단축키 표시줄 표시 또는 숨기기",
@@ -218,6 +221,7 @@ export const ko: Record<string, string> = {
218
221
  "Create or update a manual position without leaving the command bar.": "명령 팔레트에서 수동 포지션을 만들거나 업데이트합니다.",
219
222
  "Organize panes and saved layouts.": "패널과 저장된 레이아웃을 관리합니다.",
220
223
  "Resolve a ticker, then open its Ticker Research pane.": "종목코드를 확인한 뒤 종목 리서치 패널을 엽니다.",
224
+ "Resolve a ticker for the focused pane, or open it in a new pane.": "포커스 패널의 종목코드를 확인하거나 새 패널에서 엽니다.",
221
225
  "Toggle optional plugins without leaving the command bar.": "명령 팔레트에서 선택 플러그인을 켜거나 끕니다.",
222
226
 
223
227
  // ── Layout actions ───────────────────────────────────────────
@@ -245,6 +249,8 @@ export const ko: Record<string, string> = {
245
249
  "Share Pane": "창 공유",
246
250
  "Pop Out": "별도 창으로 열기",
247
251
  "Move Window...": "창 이동...",
252
+ "Change Ticker...": "종목 변경...",
253
+ "Change Ticker": "종목 변경",
248
254
  "Resize Window...": "창 크기 조정...",
249
255
  "Move Window": "창 이동",
250
256
  "Resize Window": "창 크기 조정",
@@ -551,7 +557,8 @@ export const ko: Record<string, string> = {
551
557
  "Cycle windows or resize handles.": "창 또는 크기 조절점을 순환합니다.",
552
558
  "Commit pending changes or exit window mode.": "변경 사항을 적용하거나 창 모드를 종료합니다.",
553
559
  "Open command mode for actions, pane commands, and typed prefixes.": "작업, 패널 명령 및 접두사를 위한 명령 모드를 엽니다.",
554
- "Open ticker search directly.": "종목 검색을 바로 엽니다.",
560
+ "Change the focused pane's ticker.": "포커스 패널의 종목을 변경합니다.",
561
+ "Ticker search: Enter changes the focused pane's ticker and the panes linked to it, as a click on the ticker in a pane's title does on the desktop and the web. Shift+Enter opens a new pane. From a pane with no ticker it opens DES.": "종목 검색: Enter는 포커스 패널과 연결된 패널의 종목을 변경합니다. 데스크톱과 웹에서는 패널 제목의 종목을 클릭해도 같습니다. Shift+Enter는 새 패널을 엽니다. 종목이 없는 패널에서는 DES를 엽니다.",
555
562
  "Open security details for a specific ticker.": "특정 종목의 상세 정보를 엽니다.",
556
563
  "Move through command bar results.": "명령 팔레트 결과 사이를 이동합니다.",
557
564
  "Run the selected result or its secondary action.": "선택한 결과 또는 해당 보조 작업을 실행합니다.",
package/src/i18n/zh-cn.ts CHANGED
@@ -175,6 +175,9 @@ export const zhCN: Record<string, string> = {
175
175
  "Reset Layout": "重置布局",
176
176
  "Reset Current Layout": "重置当前布局",
177
177
  "Security Description": "证券详情",
178
+ "Change ticker": "更改股票代码",
179
+ "Change ticker · {pane}": "更改股票代码 · {pane}",
180
+ "New pane": "新面板",
178
181
 
179
182
  // ── Core command descriptions ────────────────────────────────
180
183
  "Show or hide the keyboard shortcuts bar": "显示或隐藏快捷键状态栏",
@@ -220,6 +223,7 @@ export const zhCN: Record<string, string> = {
220
223
  "Create or update a manual position without leaving the command bar.": "在命令栏内直接创建或更新手动持仓。",
221
224
  "Organize panes and saved layouts.": "管理面板与已存布局。",
222
225
  "Resolve a ticker, then open its Ticker Research pane.": "解析股票代码并打开其研究面板。",
226
+ "Resolve a ticker for the focused pane, or open it in a new pane.": "为当前面板解析股票代码,或在新面板中打开。",
223
227
  "Toggle optional plugins without leaving the command bar.": "在命令栏内直接启停可选插件。",
224
228
 
225
229
  // ── Layout actions ───────────────────────────────────────────
@@ -247,6 +251,8 @@ export const zhCN: Record<string, string> = {
247
251
  "Share Pane": "分享窗格",
248
252
  "Pop Out": "弹出窗口",
249
253
  "Move Window...": "移动窗口...",
254
+ "Change Ticker...": "更改股票代码...",
255
+ "Change Ticker": "更改股票代码",
250
256
  "Resize Window...": "调整窗口大小...",
251
257
  "Move Window": "移动窗口",
252
258
  "Resize Window": "调整窗口大小",
@@ -553,7 +559,8 @@ export const zhCN: Record<string, string> = {
553
559
  "Cycle windows or resize handles.": "循环切换窗口或缩放控制点。",
554
560
  "Commit pending changes or exit window mode.": "提交更改或退出窗口模式。",
555
561
  "Open command mode for actions, pane commands, and typed prefixes.": "打开命令模式:操作、面板命令与前缀输入。",
556
- "Open ticker search directly.": "直接打开股票搜索。",
562
+ "Change the focused pane's ticker.": "更改当前面板的股票代码。",
563
+ "Ticker search: Enter changes the focused pane's ticker and the panes linked to it, as a click on the ticker in a pane's title does on the desktop and the web. Shift+Enter opens a new pane. From a pane with no ticker it opens DES.": "股票搜索:Enter 更改当前面板及其链接面板的股票代码,与在桌面版和网页版中点击面板标题中的代码相同。Shift+Enter 在新面板中打开。在没有代码的面板中则打开 DES。",
557
564
  "Open security details for a specific ticker.": "打开指定股票的证券详情。",
558
565
  "Move through command bar results.": "在命令栏结果间移动。",
559
566
  "Run the selected result or its secondary action.": "执行所选结果或其次要操作。",
package/src/i18n/zh-tw.ts CHANGED
@@ -175,6 +175,9 @@ export const zhTW: Record<string, string> = {
175
175
  "Reset Layout": "重置版面設定",
176
176
  "Reset Current Layout": "重置目前版面設定",
177
177
  "Security Description": "證券詳情",
178
+ "Change ticker": "變更股票代號",
179
+ "Change ticker · {pane}": "變更股票代號 · {pane}",
180
+ "New pane": "新面板",
178
181
 
179
182
  // ── Core command descriptions ────────────────────────────────
180
183
  "Show or hide the keyboard shortcuts bar": "顯示或隱藏快速鍵狀態列",
@@ -220,6 +223,7 @@ export const zhTW: Record<string, string> = {
220
223
  "Create or update a manual position without leaving the command bar.": "直接在命令列建立或更新手動部位。",
221
224
  "Organize panes and saved layouts.": "管理面板與已儲存的版面設定。",
222
225
  "Resolve a ticker, then open its Ticker Research pane.": "解析股票代號並開啟其研究面板。",
226
+ "Resolve a ticker for the focused pane, or open it in a new pane.": "為目前面板解析股票代號,或在新面板中開啟。",
223
227
  "Toggle optional plugins without leaving the command bar.": "在命令列內直接啟停可選外掛。",
224
228
 
225
229
  // ── Layout actions ───────────────────────────────────────────
@@ -247,6 +251,8 @@ export const zhTW: Record<string, string> = {
247
251
  "Share Pane": "分享窗格",
248
252
  "Pop Out": "彈出視窗",
249
253
  "Move Window...": "移動視窗...",
254
+ "Change Ticker...": "變更股票代號...",
255
+ "Change Ticker": "變更股票代號",
250
256
  "Resize Window...": "調整視窗大小...",
251
257
  "Move Window": "移動視窗",
252
258
  "Resize Window": "調整視窗大小",
@@ -553,7 +559,8 @@ export const zhTW: Record<string, string> = {
553
559
  "Cycle windows or resize handles.": "循環切換視窗或縮放控制點。",
554
560
  "Commit pending changes or exit window mode.": "確認待處理的變更或結束視窗模式。",
555
561
  "Open command mode for actions, pane commands, and typed prefixes.": "開啟命令模式:操作、面板命令與字首輸入。",
556
- "Open ticker search directly.": "直接開啟股票搜尋。",
562
+ "Change the focused pane's ticker.": "變更目前面板的股票代號。",
563
+ "Ticker search: Enter changes the focused pane's ticker and the panes linked to it, as a click on the ticker in a pane's title does on the desktop and the web. Shift+Enter opens a new pane. From a pane with no ticker it opens DES.": "股票搜尋:Enter 變更目前面板及其連結面板的股票代號,與在桌面版和網頁版中點擊面板標題中的代號相同。Shift+Enter 在新面板中開啟。在沒有代號的面板中則開啟 DES。",
557
564
  "Open security details for a specific ticker.": "開啟指定股票的證券詳情。",
558
565
  "Move through command bar results.": "在命令列結果間移動。",
559
566
  "Run the selected result or its secondary action.": "執行所選結果或其次要操作。",
@@ -13,9 +13,10 @@ export function paneTitleMnemonic(title: string | undefined): string | null {
13
13
  /**
14
14
  * The title a pin gives a follower: a pane linked from its menu keeps only its command ("OMON"),
15
15
  * and one linked some other way still names the ticker it opened on ("OMON AAPL"); both name the
16
- * pinned ticker ("OMON MSFT"). Any other title is the user's or the pane's own and stays.
16
+ * pinned ticker ("OMON MSFT"). Any other title is the user's or the pane's own and stays. Ticker
17
+ * search changing a pane's ticker (`retargetTickerPane`) names the new one the same way.
17
18
  */
18
- function pinnedTitle(instance: PaneInstanceConfig, pinned: string): string | null {
19
+ export function pinnedTitle(instance: PaneInstanceConfig, pinned: string): string | null {
19
20
  if (instance.paneId === TICKER_RESEARCH_PANE_ID) return null;
20
21
  const title = instance.title?.trim();
21
22
  const mnemonic = paneTitleMnemonic(title);
@@ -15,7 +15,7 @@ import { pinFollowingPane } from "./pane-follow";
15
15
  import { findDockLeaf, getNodeAtPath, getRepresentativeLeafId } from "./pane-manager/dock-tree";
16
16
  import { dockPane, insertAtRootEdge, resizeSplitAtPath } from "./pane-manager/docking";
17
17
  import { floatAtRect } from "./pane-manager/floating-actions";
18
- import { finalizeLayout, removePane } from "./pane-manager/layout-state";
18
+ import { finalizeLayout, removePane, stackTabMemory } from "./pane-manager/layout-state";
19
19
 
20
20
  let nextSavedLayoutSeq = 0;
21
21
 
@@ -92,6 +92,7 @@ function pinOrphanedFollowers(
92
92
  function dockedPlacement(layout: LayoutConfig, paneId: string): PaneMovedFrom["docked"] {
93
93
  const leaf = findDockLeaf(layout, paneId);
94
94
  if (!leaf) return { path: [] };
95
+ if (leaf.stackPath) return { path: [...leaf.path], ...stackTabMemory(layout.dockRoot, leaf.stackPath, paneId) };
95
96
  if (leaf.path.length === 0) return { path: [] };
96
97
  const parent = getNodeAtPath(layout.dockRoot, leaf.path.slice(0, -1));
97
98
  if (!parent || parent.kind !== "split") return { path: [...leaf.path] };