gloomberb 0.20.3 → 0.20.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 (154) hide show
  1. package/package.json +1 -1
  2. package/src/account/auth-dialog.tsx +17 -0
  3. package/src/api-client/data.ts +6 -0
  4. package/src/api-client/fx-interventions.ts +64 -0
  5. package/src/api-client/index.ts +1 -0
  6. package/src/api-client/release-summaries.ts +21 -0
  7. package/src/app/keybindings/actions.ts +2 -2
  8. package/src/app/pane-runtime/ticker-open-runtime.ts +245 -66
  9. package/src/cli/commands/market.ts +77 -1
  10. package/src/cli/commands/news-search.ts +1 -3
  11. package/src/cli/commands/plugins.ts +27 -5
  12. package/src/cli/commands/system.ts +19 -3
  13. package/src/cli/commands/ticker.ts +60 -19
  14. package/src/cli/index.ts +8 -8
  15. package/src/cli/pane-functions/function-help.ts +3 -3
  16. package/src/cli/report-tables.ts +18 -6
  17. package/src/cli/result.ts +15 -7
  18. package/src/cli/types.ts +2 -0
  19. package/src/components/chart/composite/axis-overlays.tsx +22 -0
  20. package/src/components/chart/composite/composite-chart.tsx +54 -13
  21. package/src/components/chart/composite/event-captions.ts +109 -0
  22. package/src/components/chart/composite/event-guides.ts +74 -0
  23. package/src/components/chart/composite/rasterizer.ts +2 -0
  24. package/src/components/chart/composite/text-renderer.ts +2 -0
  25. package/src/components/chart/composite/types.ts +31 -0
  26. package/src/components/command-bar/layout-items/focused-pane.ts +5 -5
  27. package/src/components/command-bar/routes/root/provider-search.ts +5 -4
  28. package/src/components/command-bar/routes/ticker-search/results.ts +51 -0
  29. package/src/components/command-bar/routes/ticker-search/route.ts +3 -2
  30. package/src/components/layout/detached-pane-shell.tsx +1 -1
  31. package/src/components/layout/floating-pane.tsx +5 -1
  32. package/src/components/layout/pane/footer/index.tsx +21 -14
  33. package/src/components/layout/pane/footer/model.ts +6 -0
  34. package/src/components/layout/shell/action-menu-overlay.tsx +10 -5
  35. package/src/components/layout/shell/active-drag.ts +149 -105
  36. package/src/components/layout/shell/drag/drop-zones.ts +162 -0
  37. package/src/components/layout/shell/drag/index.ts +47 -218
  38. package/src/components/layout/shell/drag/live.ts +10 -3
  39. package/src/components/layout/shell/drag/overlays.tsx +182 -5
  40. package/src/components/layout/shell/drag/runtime.ts +29 -6
  41. package/src/components/layout/shell/drag/shared-edges.ts +156 -0
  42. package/src/components/layout/shell/index.tsx +11 -6
  43. package/src/components/layout/shell/menu.ts +11 -2
  44. package/src/components/layout/shell/native/pointer-runtime.ts +25 -0
  45. package/src/components/layout/shell/native/window-state.ts +2 -2
  46. package/src/components/layout/shell/pane/layers.tsx +71 -7
  47. package/src/components/layout/shell/terminal-pointer-runtime.ts +18 -9
  48. package/src/components/layout/shell/window-mode/index.ts +8 -10
  49. package/src/components/layout/window-edit/mode.ts +39 -7
  50. package/src/components/layout/window-edit/presentation.ts +1 -1
  51. package/src/components/onboarding/onboarding-keyboard.ts +4 -0
  52. package/src/components/onboarding/onboarding-wizard.tsx +8 -3
  53. package/src/components/ui/button.tsx +2 -0
  54. package/src/components/ui/choice-dialog.tsx +1 -0
  55. package/src/components/ui/data-table/index.tsx +4 -3
  56. package/src/components/ui/list-view.tsx +7 -12
  57. package/src/components/ui/loading.tsx +10 -3
  58. package/src/components/ui/menu.tsx +6 -2
  59. package/src/components/ui/quote.ts +14 -1
  60. package/src/data/config/layout.ts +5 -2
  61. package/src/docs/snapshot.json +29 -5
  62. package/src/i18n/es.ts +9 -8
  63. package/src/i18n/ja.ts +9 -8
  64. package/src/i18n/ko.ts +9 -8
  65. package/src/i18n/zh-cn.ts +9 -8
  66. package/src/i18n/zh-tw.ts +9 -8
  67. package/src/layout/pane-manager/floating-actions.ts +17 -0
  68. package/src/layout/pane-manager/floating-stack.ts +187 -0
  69. package/src/layout/pane-manager/floating.ts +4 -2
  70. package/src/layout/pane-manager/gridlock.ts +5 -1
  71. package/src/layout/pane-manager/index.ts +11 -0
  72. package/src/layout/pane-manager/layout-state.ts +10 -3
  73. package/src/market-data/futures-board.ts +46 -1
  74. package/src/market-data/futures-contract.ts +12 -3
  75. package/src/market-data/fx-interventions.ts +270 -0
  76. package/src/news/news-model.ts +44 -2
  77. package/src/plugins/builtin/alerts/cli.ts +4 -4
  78. package/src/plugins/builtin/alerts/format.ts +1 -2
  79. package/src/plugins/builtin/alerts/headless.ts +1 -2
  80. package/src/plugins/builtin/alerts/move-checks.ts +12 -6
  81. package/src/plugins/builtin/alerts/move.ts +30 -9
  82. package/src/plugins/builtin/alerts/pane.tsx +0 -2
  83. package/src/plugins/builtin/alerts/storage.ts +4 -2
  84. package/src/plugins/builtin/alerts/types.ts +12 -0
  85. package/src/plugins/builtin/changelog/index.tsx +292 -101
  86. package/src/plugins/builtin/changelog/versions.ts +293 -0
  87. package/src/plugins/builtin/chart-composer/intervention-events.ts +105 -0
  88. package/src/plugins/builtin/chart-composer/pane.tsx +21 -7
  89. package/src/plugins/builtin/chat/message/render-state.ts +2 -5
  90. package/src/plugins/builtin/cloud/askg/attached-pane.tsx +10 -5
  91. package/src/plugins/builtin/cloud/askg/controller.ts +141 -5
  92. package/src/plugins/builtin/cloud/askg/executor.ts +113 -4
  93. package/src/plugins/builtin/cloud/askg/manifest.ts +28 -13
  94. package/src/plugins/builtin/cloud/askg/model.ts +14 -4
  95. package/src/plugins/builtin/cloud/askg/pane.tsx +70 -46
  96. package/src/plugins/builtin/cloud/askg/turn-parts.tsx +70 -0
  97. package/src/plugins/builtin/cloud/terminal-relay/engine.ts +50 -130
  98. package/src/plugins/builtin/cloud/terminal-relay/policy.ts +327 -7
  99. package/src/plugins/builtin/cloud/terminal-relay/prompts.tsx +2 -1
  100. package/src/plugins/builtin/cloud/terminal-relay/redact.ts +47 -6
  101. package/src/plugins/builtin/commodities-energy/index.tsx +1 -3
  102. package/src/plugins/builtin/commodities-energy/view-state.ts +3 -0
  103. package/src/plugins/builtin/cot/headless.ts +14 -2
  104. package/src/plugins/builtin/earnings/index.tsx +2 -2
  105. package/src/plugins/builtin/futures/index.tsx +25 -4
  106. package/src/plugins/builtin/futures/model.ts +28 -32
  107. package/src/plugins/builtin/futures/series.ts +4 -3
  108. package/src/plugins/builtin/futures/table.tsx +16 -9
  109. package/src/plugins/builtin/futures/use-board-terms.ts +3 -3
  110. package/src/plugins/builtin/help/index.tsx +3 -3
  111. package/src/plugins/builtin/help/keybindings-editor.tsx +18 -4
  112. package/src/plugins/builtin/layout-manager/index.tsx +8 -8
  113. package/src/plugins/builtin/news/headless.ts +2 -2
  114. package/src/plugins/builtin/news/index.tsx +3 -3
  115. package/src/plugins/builtin/perps/markets-section.tsx +5 -2
  116. package/src/plugins/builtin/plugin-marketplace/pane.tsx +11 -11
  117. package/src/plugins/builtin/portfolio-list/summary/index.tsx +3 -1
  118. package/src/plugins/builtin/research/event-model.ts +9 -1
  119. package/src/plugins/builtin/research/event-sources.ts +22 -0
  120. package/src/plugins/builtin/research/headless.ts +3 -3
  121. package/src/plugins/builtin/shared/cloud-upgrade.ts +27 -3
  122. package/src/plugins/builtin/ticker-detail/overview/components.tsx +54 -5
  123. package/src/plugins/builtin/ticker-detail/overview-tab.tsx +28 -13
  124. package/src/plugins/builtin/ticker-detail/pane.tsx +7 -2
  125. package/src/plugins/installer.ts +45 -0
  126. package/src/remote/resources.ts +12 -1
  127. package/src/remote/schema.ts +1 -0
  128. package/src/remote/semantic-helpers.ts +29 -1
  129. package/src/remote/semantic-tree.tsx +32 -15
  130. package/src/renderers/cloudflare/worker.ts +16 -1
  131. package/src/renderers/dom/styles.css +40 -6
  132. package/src/renderers/share/layout-view.tsx +1 -1
  133. package/src/sources/gloomberb-cloud/news.ts +35 -12
  134. package/src/state/opening-ticker-panes.ts +47 -0
  135. package/src/test-support/cli-context.ts +2 -0
  136. package/src/test-support/preload.ts +4 -1
  137. package/src/tickers/instrument-kind.ts +23 -3
  138. package/src/types/config.ts +5 -0
  139. package/src/types/context-menu.ts +2 -0
  140. package/src/types/plugin-commands.ts +140 -0
  141. package/src/types/plugin-context.ts +125 -0
  142. package/src/types/plugin-contributions.ts +55 -0
  143. package/src/types/plugin-definition.ts +234 -0
  144. package/src/types/plugin-notifications.ts +38 -0
  145. package/src/types/plugin-pane-settings.ts +114 -0
  146. package/src/types/plugin-pane-templates.ts +160 -0
  147. package/src/types/plugin-panes.ts +221 -0
  148. package/src/types/plugin-reports.ts +35 -0
  149. package/src/types/plugin-shared.ts +14 -0
  150. package/src/types/plugin-state.ts +71 -0
  151. package/src/types/plugin.ts +14 -1169
  152. package/src/ui/index.tsx +14 -3
  153. package/src/updater/github-releases.ts +23 -0
  154. package/src/utils/cli-output.ts +22 -9
package/src/ui/index.tsx CHANGED
@@ -2,7 +2,7 @@ import { createElement, forwardRef, memo, useCallback, useRef, type ComponentPro
2
2
  import { useForwardedScrollBoxRef, useRegisterPaneScrollBox } from "../state/pane-scroll-registry";
3
3
  import { useUiHost, type UiHost } from "./host";
4
4
  import { scrollBoxScrollsVertically } from "./scroll-box-axis";
5
- import { useRemoteUiNode } from "../remote/semantic-tree";
5
+ import { useRemoteUiNode, useRemoteUiScope } from "../remote/semantic-tree";
6
6
  import { markPure, samePureProps } from "./same-props";
7
7
  import { assignRef } from "../react/assign-ref";
8
8
  import {
@@ -62,14 +62,22 @@ export type {
62
62
  TextareaRenderable,
63
63
  } from "./host";
64
64
 
65
- export const Box = markPure(memo(forwardRef<any, ComponentProps<UiHost["Box"]>>((props, ref) => {
65
+ export const Box = markPure(memo(forwardRef<any, ComponentProps<UiHost["Box"]> & { "data-gloom-remote-hidden"?: boolean }>(({
66
+ "data-gloom-remote-hidden": remoteHidden,
67
+ ...props
68
+ }, ref) => {
66
69
  const { Box: HostBox } = useUiHost();
67
70
  const rawProps = props as Record<string, unknown>;
68
71
  const onMouseDown = rawProps.onMouseDown as ((event?: unknown) => unknown) | undefined;
69
72
  const onMouseUp = rawProps.onMouseUp as ((event?: unknown) => unknown) | undefined;
70
73
  const onContextMenu = rawProps.onContextMenu as ((event?: unknown) => unknown) | undefined;
74
+ // A prompt's scope reaches every control drawn in it, so no assistant's UI
75
+ // call acts on one (terminal-relay/policy.ts).
76
+ const scope = useRemoteUiScope();
77
+ // An owner that registers the control itself (a kit Button) hides this
78
+ // node, which would be the same control again without its label.
71
79
  const remoteNodeId = useRemoteUiNode(
72
- onMouseDown || onMouseUp || onContextMenu
80
+ !remoteHidden && (onMouseDown || onMouseUp || onContextMenu)
73
81
  ? {
74
82
  role: remotePropRole(rawProps, "box"),
75
83
  label: remotePropLabel(rawProps),
@@ -81,6 +89,7 @@ export const Box = markPure(memo(forwardRef<any, ComponentProps<UiHost["Box"]>>(
81
89
  metadata: {
82
90
  width: rawProps.width,
83
91
  height: rawProps.height,
92
+ ...(scope ? { scope } : {}),
84
93
  },
85
94
  }
86
95
  : null,
@@ -93,6 +102,7 @@ export const Text = markPure(memo(forwardRef<any, ComponentProps<UiHost["Text"]>
93
102
  const { Text: HostText } = useUiHost();
94
103
  const rawProps = props as Record<string, unknown>;
95
104
  const onMouseDown = rawProps.onMouseDown as ((event?: unknown) => unknown) | undefined;
105
+ const scope = useRemoteUiScope();
96
106
  const remoteNodeId = useRemoteUiNode(
97
107
  onMouseDown
98
108
  ? {
@@ -103,6 +113,7 @@ export const Text = markPure(memo(forwardRef<any, ComponentProps<UiHost["Text"]>
103
113
  actions: {
104
114
  press: (input) => onMouseDown(remoteEvent(input)),
105
115
  },
116
+ ...(scope ? { metadata: { scope } } : {}),
106
117
  }
107
118
  : null,
108
119
  );
@@ -140,3 +140,26 @@ export async function fetchChangelogReleases(
140
140
 
141
141
  return releases.slice(0, wanted);
142
142
  }
143
+
144
+ /**
145
+ * The repository's CHANGELOG.md: the title and highlights of each minor
146
+ * version, written by hand at release time (the Changelog's version rows).
147
+ * Through the API rather than raw.githubusercontent.com, which the web
148
+ * app's content policy does not reach.
149
+ */
150
+ const CHANGELOG_SUMMARIES_API_URL = `https://api.github.com/repos/${GLOOMBERB_REPO}/contents/CHANGELOG.md`;
151
+
152
+ /**
153
+ * CHANGELOG.md read from GitHub itself, as written, or null when the
154
+ * repository has none: the Changelog's second source, after Gloom Cloud
155
+ * (src/api-client/release-summaries.ts).
156
+ */
157
+ export async function fetchChangelogSummaries(signal?: AbortSignal): Promise<string | null> {
158
+ const response = await fetch(CHANGELOG_SUMMARIES_API_URL, {
159
+ signal,
160
+ headers: { Accept: "application/vnd.github.raw+json" },
161
+ });
162
+ if (response.status === 404) return null;
163
+ if (!response.ok) throw new Error(`GitHub returned ${response.status}`);
164
+ return response.text();
165
+ }
@@ -704,25 +704,31 @@ function renderTableLayout(
704
704
  const renderBelow = (index: number) => (options.below?.[index] ?? []).flatMap((line) => (
705
705
  available == null ? [line] : options.cutBelow ? [truncateDisplay(line, belowWidth)] : wrapText(line, belowWidth)
706
706
  )).map((line) => `${belowIndent}${cliStyles.muted(line)}`.trimEnd());
707
+ // A moved column every row has the same value in (one currency, one feed) prints once under the table, not under each row.
708
+ const shared = rows.length > 1 ? stacked.filter(({ index }) => {
709
+ const first = rows[0]![index] ?? "";
710
+ return !EMPTY_CELL.test(stripAnsi(first).trim()) && rows.every((row) => (row[index] ?? "") === first);
711
+ }) : [];
712
+ const ownStacked = stacked.filter((entry) => !shared.includes(entry));
707
713
  // Columns moved under the rows print there as `Header value`, as many to a line as fit.
708
- const renderStacked = (cells: string[], rowIndex: number): string[] => {
714
+ const renderStacked = (entries: readonly TableEntry[], cells: string[], rowIndex: number, lineIndent: string, width: number): string[] => {
709
715
  const lines: string[] = [];
710
716
  let line = "";
711
- for (const { column, index } of stacked) {
717
+ for (const { column, index } of entries) {
712
718
  const value = cells[index] ?? "";
713
719
  if (rowIndex >= (column.stackRows ?? Infinity) || EMPTY_CELL.test(stripAnsi(value).trim())) continue;
714
720
  const piece = `${cliStyles.muted(column.header)} ${value}`;
715
- if (line && visibleLength(line) + COLUMN_GAP + visibleLength(piece) <= belowWidth) {
721
+ if (line && visibleLength(line) + COLUMN_GAP + visibleLength(piece) <= width) {
716
722
  line += `${" ".repeat(COLUMN_GAP)}${piece}`;
717
723
  continue;
718
724
  }
719
725
  if (line) lines.push(line);
720
726
  line = piece;
721
- if (visibleLength(piece) <= belowWidth) continue;
727
+ if (visibleLength(piece) <= width) continue;
722
728
  // Too long for one line: the value wraps under itself, or under its header when the header is long too.
723
- const hangs = visibleLength(column.header) + 1 <= belowWidth / 2;
729
+ const hangs = visibleLength(column.header) + 1 <= width / 2;
724
730
  const valueIndent = " ".repeat(hangs ? visibleLength(column.header) + 1 : COLUMN_GAP);
725
- const [first = "", ...rest] = wrapText(value, Math.max(1, belowWidth - valueIndent.length));
731
+ const [first = "", ...rest] = wrapText(value, Math.max(1, width - valueIndent.length));
726
732
  lines.push(
727
733
  ...hangs ? [`${cliStyles.muted(column.header)} ${first}`] : [cliStyles.muted(column.header), `${valueIndent}${first}`],
728
734
  ...rest.map((part) => `${valueIndent}${part}`),
@@ -730,16 +736,23 @@ function renderTableLayout(
730
736
  line = "";
731
737
  }
732
738
  if (line) lines.push(line);
733
- return lines.map((text) => `${belowIndent}${text}`.trimEnd());
739
+ return lines.map((text) => `${lineIndent}${text}`.trimEnd());
734
740
  };
735
- return [header, ...divider, ...rows.flatMap((row, index) => [renderRow(row), ...renderStacked(row, index), ...renderBelow(index)])].join("\n");
741
+ const sharedLines = shared.length > 0 ? renderStacked(shared, rows[0]!, 0, indent, Math.max(1, available ?? 0)) : [];
742
+ return [
743
+ header,
744
+ ...divider,
745
+ ...rows.flatMap((row, index) => [renderRow(row), ...renderStacked(ownStacked, row, index, belowIndent, belowWidth), ...renderBelow(index)]),
746
+ ...sharedLines,
747
+ ].join("\n");
736
748
  }
737
749
 
738
750
  /**
739
751
  * A table fitted to the terminal (or `--width`), or whole when output is
740
752
  * piped. A table too wide never cuts a cell short, unless its column is free
741
753
  * text marked `shrink: true`: text wraps in its cell and columns move under
742
- * their rows, each value whole after its header. Of the ways that fit, the
754
+ * their rows, each value whole after its header, or once under the table when
755
+ * every row has the same one (a currency, a feed). Of the ways that fit, the
743
756
  * one with the fewest lines prints, the one that moves fewer columns on a tie.
744
757
  * Plain output (`setCliPlainOverride`) has no rule under the header, words
745
758
  * for arrows and "—" in every empty cell.