@gloom-sh/terminal 0.19.6 → 0.20.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 (209) hide show
  1. package/LICENSE +0 -4
  2. package/package.json +6 -5
  3. package/patches/electrobun-devkit@2.0.5.patch +408 -0
  4. package/src/api-client/bond-trades.ts +59 -0
  5. package/src/api-client/crypto-markets.ts +20 -2
  6. package/src/api-client/data.ts +21 -0
  7. package/src/api-client/fund-facts.ts +23 -1
  8. package/src/api-client/index.ts +2 -0
  9. package/src/api-client/types/account.ts +86 -0
  10. package/src/api-client/types/assist.ts +32 -0
  11. package/src/api-client/types/auth.ts +63 -0
  12. package/src/api-client/types/billing.ts +54 -0
  13. package/src/api-client/types/chat.ts +180 -0
  14. package/src/api-client/types/congress.ts +107 -0
  15. package/src/api-client/types/credit.ts +110 -0
  16. package/src/api-client/types/econ.ts +158 -0
  17. package/src/api-client/types/equity-diagnostic.ts +73 -0
  18. package/src/api-client/types/filings-and-calls.ts +356 -0
  19. package/src/api-client/types/index.ts +25 -0
  20. package/src/api-client/types/jobs.ts +147 -0
  21. package/src/api-client/types/market.ts +122 -0
  22. package/src/api-client/types/news.ts +91 -0
  23. package/src/api-client/types/notes-and-theses.ts +172 -0
  24. package/src/api-client/types/quotes.ts +28 -0
  25. package/src/api-client/types/scanners.ts +125 -0
  26. package/src/api-client/types/screener.ts +65 -0
  27. package/src/api-client/types/search.ts +107 -0
  28. package/src/api-client/types/sync.ts +14 -0
  29. package/src/api-client/types/team-collections.ts +43 -0
  30. package/src/api-client/types/team-views.ts +32 -0
  31. package/src/api-client/types/teams.ts +135 -0
  32. package/src/api-client/types/ticker-data.ts +57 -0
  33. package/src/api-client/types/tweets.ts +59 -0
  34. package/src/api-client/types/world-venues.ts +23 -0
  35. package/src/app/runtime/desktop-deeplink.ts +41 -6
  36. package/src/app/runtime/plugin-seed.ts +119 -0
  37. package/src/app/runtime/startup.ts +45 -9
  38. package/src/app/star-prompt/status-line.tsx +1 -1
  39. package/src/app.tsx +2 -7
  40. package/src/architecture/ui-tokens-allowlist.json +0 -8
  41. package/src/cli/board-coins.ts +38 -5
  42. package/src/cli/commands/crypto-hints.ts +8 -1
  43. package/src/cli/commands/market.ts +29 -26
  44. package/src/cli/commands/overview.ts +13 -6
  45. package/src/cli/commands/ticker.ts +78 -18
  46. package/src/cli/company-name-hint.ts +19 -0
  47. package/src/cli/desktop-pane-shot-browser.ts +69 -3
  48. package/src/cli/entry.ts +10 -4
  49. package/src/cli/glossary.ts +25 -0
  50. package/src/cli/helpers.ts +4 -2
  51. package/src/cli/not-a-ticker.ts +26 -1
  52. package/src/cli/pane-functions/catalog.ts +3 -1
  53. package/src/cli/pane-functions/freshness.ts +45 -29
  54. package/src/cli/pane-functions/market-session.ts +14 -5
  55. package/src/cli/restore-plugins.ts +164 -51
  56. package/src/components/chart/composite/use-composite-chart-keyboard.ts +11 -2
  57. package/src/components/chart-table/header.tsx +10 -1
  58. package/src/components/chart-table/layout.ts +14 -5
  59. package/src/components/command-bar/panel/index.tsx +13 -0
  60. package/src/components/command-bar/panel/layout.ts +7 -0
  61. package/src/components/command-bar/panel/runtime.ts +1 -0
  62. package/src/components/command-bar/panel/types.ts +2 -0
  63. package/src/components/data-table/export.ts +4 -1
  64. package/src/components/layout/detached-pane-shell.tsx +10 -37
  65. package/src/components/layout/double-escape-close.ts +90 -0
  66. package/src/components/layout/header.tsx +3 -2
  67. package/src/components/layout/market-summary.ts +6 -3
  68. package/src/components/layout/pane/footer/index.tsx +2 -6
  69. package/src/components/layout/pane/footer/model.ts +6 -12
  70. package/src/components/layout/shell/active-drag.ts +53 -11
  71. package/src/components/layout/shell/drag/magnets.ts +128 -19
  72. package/src/components/layout/shell/pane/actions.ts +6 -2
  73. package/src/components/layout/shell/pane/management-shortcuts.ts +13 -51
  74. package/src/components/layout/status-bar.tsx +4 -78
  75. package/src/components/layout/status-widget-space.ts +5 -5
  76. package/src/components/onboarding/portfolio-step/positions-panel.tsx +1 -1
  77. package/src/components/ui/data-table/index.tsx +5 -1
  78. package/src/components/ui/data-table/render-cell.ts +19 -0
  79. package/src/components/ui/delayed-mark.tsx +59 -7
  80. package/src/components/ui/icon.tsx +1 -8
  81. package/src/components/ui/menu.tsx +6 -1
  82. package/src/i18n/es.ts +6 -3
  83. package/src/i18n/ja.ts +6 -3
  84. package/src/i18n/ko.ts +6 -3
  85. package/src/i18n/zh-cn.ts +6 -3
  86. package/src/i18n/zh-tw.ts +6 -3
  87. package/src/market-data/fund-facts.ts +7 -1
  88. package/src/market-data/market/change-basis.ts +20 -0
  89. package/src/market-data/market/format.ts +62 -2
  90. package/src/market-data/market/futures-week.ts +3 -1
  91. package/src/plugins/builtin/chart-composer/headless.ts +57 -17
  92. package/src/plugins/builtin/chart-composer/session-range.ts +82 -3
  93. package/src/plugins/builtin/chat/content/composer.tsx +21 -27
  94. package/src/plugins/builtin/chat/content/index.tsx +31 -3
  95. package/src/plugins/builtin/chat/content/shortcuts.ts +4 -2
  96. package/src/plugins/builtin/chat/content/snapshot.ts +0 -3
  97. package/src/plugins/builtin/cloud/auth-actions.tsx +51 -23
  98. package/src/plugins/builtin/cloud/trial-offer-status-widget.tsx +3 -3
  99. package/src/plugins/builtin/cloud/upgrade-status-widget.tsx +32 -25
  100. package/src/plugins/builtin/congress-trades/model.ts +2 -1
  101. package/src/plugins/builtin/congress-trades/pane.tsx +3 -0
  102. package/src/plugins/builtin/correlation/compute.ts +8 -2
  103. package/src/plugins/builtin/correlation/headless.ts +10 -9
  104. package/src/plugins/builtin/correlation/history.ts +30 -0
  105. package/src/plugins/builtin/correlation/matrix/model.ts +10 -10
  106. package/src/plugins/builtin/correlation/relationship/model.ts +3 -6
  107. package/src/plugins/builtin/correlation/relationship/pane.tsx +1 -2
  108. package/src/plugins/builtin/crypto-board/client.ts +6 -1
  109. package/src/plugins/builtin/crypto-board/defi-view.tsx +12 -1
  110. package/src/plugins/builtin/crypto-board/defi.ts +44 -7
  111. package/src/plugins/builtin/crypto-board/headless.ts +83 -12
  112. package/src/plugins/builtin/crypto-board/model.ts +30 -6
  113. package/src/plugins/builtin/crypto-board/pane.tsx +13 -2
  114. package/src/plugins/builtin/custom-view/index.tsx +1 -1
  115. package/src/plugins/builtin/custom-view/loader.ts +85 -8
  116. package/src/plugins/builtin/custom-view/view-spec.ts +28 -0
  117. package/src/plugins/builtin/equity-screener/criterion-editor.tsx +13 -4
  118. package/src/plugins/builtin/equity-screener/headless.ts +33 -1
  119. package/src/plugins/builtin/equity-screener/model.ts +58 -15
  120. package/src/plugins/builtin/equity-screener/pane.tsx +36 -6
  121. package/src/plugins/builtin/executives/format.ts +5 -4
  122. package/src/plugins/builtin/executives/pane.tsx +1 -1
  123. package/src/plugins/builtin/help/index.tsx +55 -1
  124. package/src/plugins/builtin/insider/model.ts +30 -2
  125. package/src/plugins/builtin/jobs/model.ts +2 -2
  126. package/src/plugins/builtin/mna/model.ts +2 -2
  127. package/src/plugins/builtin/notes/files.ts +2 -0
  128. package/src/plugins/builtin/notes/owner.tsx +20 -1
  129. package/src/plugins/builtin/notes/quick-notes-pane.tsx +22 -4
  130. package/src/plugins/builtin/notes/store.ts +6 -1
  131. package/src/plugins/builtin/perps/headless.ts +8 -2
  132. package/src/plugins/builtin/portfolio-list/header.tsx +1 -1
  133. package/src/plugins/builtin/research/corporate-actions-pane.tsx +29 -25
  134. package/src/plugins/builtin/risk-factors/index.tsx +2 -28
  135. package/src/plugins/builtin/risk-factors/lock-note.ts +58 -0
  136. package/src/plugins/builtin/risk-factors/pane.tsx +10 -3
  137. package/src/plugins/builtin/scanner/hilo-model.ts +4 -3
  138. package/src/plugins/builtin/sec/fund-facts.ts +45 -11
  139. package/src/plugins/builtin/sec/headless.ts +30 -1
  140. package/src/plugins/builtin/sec/index.tsx +26 -5
  141. package/src/plugins/builtin/series-inventory.ts +1 -0
  142. package/src/plugins/builtin/shared/earnings-report.ts +7 -2
  143. package/src/plugins/builtin/shared/pro-lock-note.ts +5 -1
  144. package/src/plugins/builtin/shared/use-quote-board.ts +85 -46
  145. package/src/plugins/builtin/short-interest/headless.ts +1 -1
  146. package/src/plugins/builtin/short-interest/model.ts +15 -6
  147. package/src/plugins/builtin/short-interest/types.ts +2 -0
  148. package/src/plugins/builtin/thirteenf/overlap-pane.tsx +3 -0
  149. package/src/plugins/builtin/thirteenf/pane.tsx +3 -0
  150. package/src/plugins/builtin/ticker-detail/overview/model.ts +19 -9
  151. package/src/plugins/builtin/ticker-detail/overview-tab.tsx +4 -4
  152. package/src/plugins/builtin/time-sales/headless.ts +23 -7
  153. package/src/plugins/builtin/time-sales/index.tsx +2 -2
  154. package/src/plugins/builtin/trace-bonds/detail.tsx +198 -0
  155. package/src/plugins/builtin/trace-bonds/headless.ts +62 -4
  156. package/src/plugins/builtin/trace-bonds/history.ts +155 -0
  157. package/src/plugins/builtin/trace-bonds/pane.tsx +64 -5
  158. package/src/plugins/extracted-plugins.ts +49 -24
  159. package/src/plugins/installer.ts +234 -32
  160. package/src/plugins/plugin-names.ts +11 -2
  161. package/src/plugins/running-installs.ts +34 -0
  162. package/src/plugins/seed-progress.ts +72 -0
  163. package/src/remote/controller.ts +9 -2
  164. package/src/remote/schema.ts +2 -1
  165. package/src/renderers/cloudflare/http-proxy.ts +67 -8
  166. package/src/renderers/cloudflare/proxy-session.ts +1 -1
  167. package/src/renderers/cloudflare/worker.ts +29 -2
  168. package/src/renderers/dom/desktop/icons.tsx +0 -2
  169. package/src/renderers/dom/styles.css +0 -3
  170. package/src/renderers/electrobun/bun/desktop/backend.ts +14 -0
  171. package/src/renderers/electrobun/bun/desktop/host-requests.ts +14 -7
  172. package/src/renderers/electrobun/bun/desktop/initialization.ts +24 -14
  173. package/src/renderers/electrobun/bun/desktop/install-records.ts +59 -0
  174. package/src/renderers/electrobun/bun/desktop/installer-folder.ts +208 -592
  175. package/src/renderers/electrobun/bun/desktop/macos-objc.ts +14 -0
  176. package/src/renderers/electrobun/bun/desktop/update.ts +1 -1
  177. package/src/renderers/electrobun/bun/index.ts +24 -13
  178. package/src/renderers/electrobun/bun/window/context-menu-thread.ts +84 -0
  179. package/src/renderers/electrobun/bun/window/create.ts +23 -3
  180. package/src/renderers/electrobun/bun/window/electrobun-window-host.ts +4 -4
  181. package/src/renderers/electrobun/bun/window/events.ts +4 -4
  182. package/src/renderers/electrobun/bun/window/frame.ts +2 -1
  183. package/src/renderers/electrobun/bun/window/native-call-thread.ts +224 -0
  184. package/src/renderers/electrobun/bun/window/native-min-size.ts +322 -0
  185. package/src/renderers/electrobun/bun/window/native-timing.ts +10 -0
  186. package/src/renderers/electrobun/bun/window/script-for-webview.ts +15 -0
  187. package/src/renderers/electrobun/bun/window/webview-script-thread.ts +82 -0
  188. package/src/renderers/electrobun/shared/protocol.ts +13 -2
  189. package/src/renderers/electrobun/view/backend-rpc.ts +8 -1
  190. package/src/renderers/electrobun/view/cli-pane-shot-frame.tsx +1 -1
  191. package/src/renderers/electrobun/view/main.tsx +4 -3
  192. package/src/renderers/opentui/start.tsx +3 -0
  193. package/src/sources/gloomberb-cloud/index.ts +5 -7
  194. package/src/sources/provider-router/batches.ts +18 -3
  195. package/src/sources/provider-router/financials.ts +18 -4
  196. package/src/telemetry/stall-reports.ts +21 -4
  197. package/src/types/data-provider.ts +14 -0
  198. package/src/types/financials.ts +15 -3
  199. package/src/types/headless.ts +2 -0
  200. package/src/utils/double-escape-close.ts +38 -16
  201. package/src/utils/format.ts +23 -3
  202. package/src/utils/main-thread-stall.ts +21 -5
  203. package/src/utils/perf-marks.ts +88 -9
  204. package/src/utils/price-earnings.ts +18 -0
  205. package/src/utils/reported-money.ts +9 -2
  206. package/src/utils/sec.ts +34 -3
  207. package/patches/electrobun@1.18.1.patch +0 -633
  208. package/src/api-client/types.ts +0 -2441
  209. package/src/plugins/seed-notice.ts +0 -20
@@ -1,8 +1,8 @@
1
1
  import type { ReactNode } from "react";
2
- import { Box, Text, TextAttributes, useCommandBarShortcut, type TextareaRenderable } from "../../../../ui";
2
+ import { Box, Text, TextAttributes, type TextareaRenderable } from "../../../../ui";
3
3
  import { getMessageComposerBlockHeight, MessageComposer } from "../../../../components/ui";
4
4
  import { colors } from "../../../../theme/colors";
5
- import { t, tf } from "../../../../i18n";
5
+ import { t } from "../../../../i18n";
6
6
  import { truncateToDisplayWidth } from "../../../../utils/format";
7
7
  import type { ChatMessage } from "../../../../api-client";
8
8
  import { InlineAuthActions } from "../../cloud/auth-actions";
@@ -19,6 +19,14 @@ import type { ComposerShareLink } from "../pane-links/composer";
19
19
  import type { ChatMessagePaneLink } from "../pane-links/model";
20
20
 
21
21
  const DESKTOP_CHAT_INPUT_TOP_MARGIN_PX = 6;
22
+ /**
23
+ * The line saying why the composer is closed, a blank row, then its button,
24
+ * as a wall sets them. The desktop has no pane border under the button, so a
25
+ * row below keeps it off the pane's edge.
26
+ */
27
+ function chatAuthPromptRows(nativePaneChrome: boolean | undefined): number {
28
+ return nativePaneChrome ? 4 : 3;
29
+ }
22
30
 
23
31
  interface MutableRef<T> {
24
32
  current: T;
@@ -36,7 +44,6 @@ interface ChatComposerAreaProps {
36
44
  contentWidth: number;
37
45
  focused: boolean;
38
46
  focusComposer: () => void;
39
- hasSavedSession: boolean;
40
47
  inputFocused: boolean;
41
48
  inputPlaceholder: string;
42
49
  inputRef: MutableRef<TextareaRenderable | null>;
@@ -115,7 +122,6 @@ export function ChatComposerArea({
115
122
  contentWidth,
116
123
  focused,
117
124
  focusComposer,
118
- hasSavedSession,
119
125
  inputFocused,
120
126
  inputPlaceholder,
121
127
  inputRef,
@@ -141,31 +147,19 @@ export function ChatComposerArea({
141
147
  onRemoveDraftLink,
142
148
  attachPickerRef,
143
149
  }: ChatComposerAreaProps) {
144
- const commandBarShortcut = useCommandBarShortcut();
145
150
  if (!canSend) {
146
- const fitText = (value: string) => truncateToDisplayWidth(value, contentWidth);
147
- const fitLine = (value: string) => fitText(t(value));
151
+ // Signed out the pane shows the sign-in wall instead; what reaches here is
152
+ // a saved login to finish or an address to confirm. The line and its
153
+ // button sit as a wall's do, a row apart.
148
154
  return (
149
155
  // Inset like the transcript above it, so the prompt lines up with the messages.
150
- <Box width={contentWidth + 2} paddingX={1} height={2} flexDirection="column">
151
- {!user && !hasSavedSession ? (
152
- <>
153
- <Text fg={colors.textDim}>{fitLine("Read-only chat. Log in or sign up to send.")}</Text>
154
- <InlineAuthActions />
155
- </>
156
- ) : !user ? (
157
- <>
158
- <Text fg={colors.positive}>{fitLine("Saved login found. Log in again to send.")}</Text>
159
- <InlineAuthActions showSignup={false} />
160
- </>
161
- ) : (
162
- <>
163
- <Text fg={colors.positive}>{fitLine("Verify your email to send messages.")}</Text>
164
- <Text fg={colors.textDim}>
165
- {fitText(tf("{shortcut}, then Resend Verification Email", { shortcut: commandBarShortcut }))}
166
- </Text>
167
- </>
168
- )}
156
+ <Box width={contentWidth + 2} paddingX={1} height={chatAuthPromptRows(nativePaneChrome)} flexDirection="column">
157
+ <Text fg={colors.positive}>
158
+ {truncateToDisplayWidth(user ? t("Verify your email to send messages.") : t("Saved login found. Log in again to send."), contentWidth)}
159
+ </Text>
160
+ <Box marginTop={1}>
161
+ <InlineAuthActions showSignup={false} needsVerification={!!user} />
162
+ </Box>
169
163
  </Box>
170
164
  );
171
165
  }
@@ -301,7 +295,7 @@ export function getChatComposerAreaHeight({
301
295
  /** Terminal rows the handle prompt above the composer takes. */
302
296
  promptRows?: number;
303
297
  }) {
304
- if (!canSend) return 2;
298
+ if (!canSend) return chatAuthPromptRows(nativePaneChrome);
305
299
  return promptRows + getMessageComposerBlockHeight({ height: composerHeight, nativePaneChrome })
306
300
  + (editingMessage || replyTo ? 1 : 0)
307
301
  + Math.max(0, mentionSuggestionCount ?? 0)
@@ -75,6 +75,7 @@ import {
75
75
  import { applyCommandSuggestion, detectChatCommandTrigger, filterCommandSuggestions } from "./command-suggestions";
76
76
  import { getComposerCursorOffset } from "./composer-cursor";
77
77
  import { ChatHandlePrompt, chatHandlePromptRows, handleSavedMessage, useChatHandlePrompt } from "./handle-prompt";
78
+ import { SignInWall } from "../../cloud/auth-actions";
78
79
 
79
80
  interface ChatContentProps {
80
81
  width: number;
@@ -88,7 +89,36 @@ interface ChatContentProps {
88
89
  onTargetMessageHandled?: () => void;
89
90
  }
90
91
 
91
- export function ChatContent({
92
+ /** No account and no saved login to finish: the chat shows nothing. */
93
+ function isSignedOut(snapshot: { user: unknown; hasSavedSession: boolean }): boolean {
94
+ return !snapshot.user && !snapshot.hasSavedSession;
95
+ }
96
+
97
+ /** A check the app made this recently (the status bar's, on launch) answers for the pane. */
98
+ const RECENT_SESSION_CHECK_MS = 30_000;
99
+
100
+ /**
101
+ * Chat sits behind the wall every account-gated pane shows: signed out there
102
+ * is no transcript, no channel list and nothing to read, only the wall. A
103
+ * saved login, or an account still confirming its email, reads the chat and
104
+ * is asked at the composer to finish signing in.
105
+ */
106
+ export function ChatContent(props: ChatContentProps) {
107
+ const controller = props.controller ?? chatController;
108
+ const [signedOut, setSignedOut] = useState(() => isSignedOut(controller.getSnapshot()));
109
+ useEffect(() => controller.subscribe((snapshot) => setSignedOut(isSignedOut(snapshot))), [controller]);
110
+ // Nothing behind the wall asks for the session, so a sign-in made elsewhere
111
+ // (the web app's cookie) is picked up here.
112
+ useEffect(() => {
113
+ if (isSignedOut(controller.getSnapshot())) void controller.refreshSession({ reuseCheckWithinMs: RECENT_SESSION_CHECK_MS }).catch(() => {});
114
+ }, [controller]);
115
+ if (signedOut) {
116
+ return <SignInWall placement="chat-signin" action="chat" width={props.width} height={props.height} />;
117
+ }
118
+ return <ChatConversation {...props} />;
119
+ }
120
+
121
+ function ChatConversation({
92
122
  width,
93
123
  height,
94
124
  focused,
@@ -188,7 +218,6 @@ export function ChatContent({
188
218
  conversationActivity,
189
219
  draftAttachments,
190
220
  hasOlderMessages,
191
- hasSavedSession,
192
221
  loading,
193
222
  loadingOlderMessages,
194
223
  messages,
@@ -1211,7 +1240,6 @@ export function ChatContent({
1211
1240
  contentWidth={contentWidth}
1212
1241
  focused={focused}
1213
1242
  focusComposer={focusComposer}
1214
- hasSavedSession={hasSavedSession}
1215
1243
  inputFocused={inputFocused}
1216
1244
  inputPlaceholder={inputPlaceholder}
1217
1245
  inputRef={inputRef}
@@ -2,7 +2,7 @@ import { useState, type MutableRefObject } from "react";
2
2
  import { useShortcut } from "../../../../react/input";
3
3
  import type { ScrollBoxRenderable } from "../../../../ui";
4
4
  import type { ChatMessage } from "../../../../api-client";
5
- import { countEscapeTowardClose } from "../../../../utils/double-escape-close";
5
+ import { countEscapeTowardClose, keepEscapeFromClosing } from "../../../../utils/double-escape-close";
6
6
  import { isPlainKey } from "../../../../utils/keyboard";
7
7
  import { createOneShot } from "../../../../utils/one-shot";
8
8
  import { scrollToBottom } from "../layout";
@@ -290,11 +290,13 @@ export function useChatContentShortcuts({
290
290
  return;
291
291
  }
292
292
 
293
- // An Esc with nothing to back out of is left to the pane's double-Esc close.
293
+ // Clearing a selection counts toward the pane's double-Esc close; closing
294
+ // the profile popover does not.
294
295
  if (event.name === "escape" && (profilePopoverOpen || selectedIdx >= 0)) {
295
296
  event.preventDefault?.();
296
297
  event.stopPropagation?.();
297
298
  if (profilePopoverOpen) {
299
+ keepEscapeFromClosing(event);
298
300
  closeProfilePopover();
299
301
  return;
300
302
  }
@@ -103,7 +103,6 @@ export function useChatSnapshotState({
103
103
  const [messages, setMessages] = useState<ChatMessage[]>(initialSnapshot.messages);
104
104
  const [channelStates, setChannelStates] = useState(initialSnapshot.channelStates);
105
105
  const [conversationActivity, setConversationActivity] = useState(initialSnapshot.conversationActivity);
106
- const [hasSavedSession, setHasSavedSession] = useState(initialSnapshot.hasSavedSession);
107
106
  const [user, setUser] = useState<{ id: string; username: string; emailVerified: boolean } | null>(initialSnapshot.user);
108
107
  const [loading, setLoading] = useState(initialSnapshot.loading);
109
108
  const [messagesError, setMessagesError] = useState(initialSnapshot.messagesError);
@@ -138,7 +137,6 @@ export function useChatSnapshotState({
138
137
  setChannelStates(snapshot.channelStates);
139
138
  setConversationActivity(snapshot.conversationActivity);
140
139
  setChannelsLoading(snapshot.channelsLoading);
141
- setHasSavedSession(snapshot.hasSavedSession);
142
140
  setUser(snapshot.user);
143
141
  setLoading(snapshot.loading);
144
142
  setMessagesError(snapshot.messagesError);
@@ -189,7 +187,6 @@ export function useChatSnapshotState({
189
187
  conversationActivity,
190
188
  draftAttachments,
191
189
  hasOlderMessages,
192
- hasSavedSession,
193
190
  loading,
194
191
  loadingOlderMessages,
195
192
  messages,
@@ -5,8 +5,9 @@
5
5
  * the account is right: same headline grammar, same explanation slot, same two
6
6
  * actions, wherever it appears. A pane only supplies the phrase that finishes
7
7
  * "Sign in to ...", so the copy stays in one voice instead of drifting per pane.
8
- * `InlineAuthActions` is the other shape: a row of actions sitting inside a
9
- * surface that still works signed out, such as the chat composer.
8
+ * `InlineAuthActions` is the other shape: the same actions, drawn the same
9
+ * way, in a surface that still shows something without them, such as the
10
+ * chat composer of a saved login or an unverified account.
10
11
  * `ProWall` is the signed-in counterpart for a pane body that needs Pro.
11
12
  */
12
13
  import { useId } from "react";
@@ -31,26 +32,56 @@ function openAuth(
31
32
  }
32
33
  }
33
34
 
35
+ const RESEND_VERIFICATION = "Resend Verification Email";
36
+
37
+ /**
38
+ * The account actions as buttons: Log in and Sign up free, or the resend for
39
+ * an unconfirmed address. One look for the wall and for the inline copy, so
40
+ * the same action never reads as two different controls.
41
+ */
42
+ function AuthButtons({ showSignup, needsVerification, onAuth, onResend, stopPropagation = false }: {
43
+ showSignup: boolean;
44
+ needsVerification: boolean;
45
+ onAuth: (mode: AccountMode) => void;
46
+ onResend: () => void;
47
+ /** Inside a surface with its own pointer handling (the chat), a press stays on the button. */
48
+ stopPropagation?: boolean;
49
+ }) {
50
+ if (needsVerification) return <Button label={t(RESEND_VERIFICATION)} stopPropagation={stopPropagation} onPress={onResend} />;
51
+ return (
52
+ <>
53
+ <Button label={t("Log in")} variant="primary" stopPropagation={stopPropagation} onPress={() => onAuth("login")} />
54
+ {showSignup && <Button label={t("Sign up free")} variant="secondary" stopPropagation={stopPropagation} onPress={() => onAuth("signup")} />}
55
+ </>
56
+ );
57
+ }
58
+
34
59
  export interface InlineAuthActionsProps {
35
60
  showSignup?: boolean;
61
+ /** The session exists but the address is unconfirmed: the resend replaces the sign-in buttons. */
62
+ needsVerification?: boolean;
36
63
  /**
37
- * `buttons` is the wall's pair of compact buttons, for a surface such as
64
+ * `buttons` is the wall's buttons in the wall's row, for a surface such as
38
65
  * the chat composer where the actions must read as controls. `plain` is
39
66
  * clickable text, for chrome that is itself a row of text (a status bar).
40
67
  */
41
68
  variant?: "buttons" | "plain";
42
69
  }
43
70
 
44
- export function InlineAuthActions({ showSignup = true, variant = "buttons" }: InlineAuthActionsProps) {
71
+ export function InlineAuthActions({ showSignup = true, needsVerification = false, variant = "buttons" }: InlineAuthActionsProps) {
45
72
  const { openCommandBar } = usePluginAppActions();
46
- const logIn = () => openAuth(openCommandBar, "login");
47
- const signUp = () => openAuth(openCommandBar, "signup");
73
+ const authenticate = (mode: AccountMode) => openAuth(openCommandBar, mode);
74
+ const logIn = () => authenticate("login");
75
+ const signUp = () => authenticate("signup");
76
+ const resend = () => openCommandBar(RESEND_VERIFICATION);
48
77
  // Inside a pane (the chat composer) the pane menu lists them, so they need
49
78
  // no mouse; the status bar copy has the Log In command instead.
50
- usePaneMenuItems(`inline-auth:${useId()}`, () => [
51
- { id: "log-in", label: t("Log in"), onSelect: logIn },
52
- ...(showSignup ? [{ id: "sign-up", label: t("Sign up free"), onSelect: signUp }] : []),
53
- ], [openCommandBar, showSignup]);
79
+ usePaneMenuItems(`inline-auth:${useId()}`, () => needsVerification
80
+ ? [{ id: "resend-verification", label: t(RESEND_VERIFICATION), onSelect: resend }]
81
+ : [
82
+ { id: "log-in", label: t("Log in"), onSelect: logIn },
83
+ ...(showSignup ? [{ id: "sign-up", label: t("Sign up free"), onSelect: signUp }] : []),
84
+ ], [openCommandBar, needsVerification, showSignup]);
54
85
  if (variant === "plain") {
55
86
  return (
56
87
  <Box flexDirection="row">
@@ -62,10 +93,10 @@ export function InlineAuthActions({ showSignup = true, variant = "buttons" }: In
62
93
  </Box>
63
94
  );
64
95
  }
96
+ // The row a wall's actions sit in (EmptyState), wrapping in a narrow pane.
65
97
  return (
66
- <Box flexDirection="row" gap={1}>
67
- <Button label={t("Log in")} variant="primary" compact stopPropagation onPress={logIn} />
68
- {showSignup && <Button label={t("Sign up free")} variant="secondary" compact stopPropagation onPress={signUp} />}
98
+ <Box flexDirection="row" flexWrap="wrap" gap={1}>
99
+ <AuthButtons showSignup={showSignup} needsVerification={needsVerification} onAuth={authenticate} onResend={resend} stopPropagation />
69
100
  </Box>
70
101
  );
71
102
  }
@@ -95,7 +126,7 @@ export function SignInWall({ placement, action, needsVerification = false, hint,
95
126
  const title = needsVerification
96
127
  ? tf("Verify your email to {action}.", { action: t(action) })
97
128
  : tf("Sign in to {action}.", { action: t(action) });
98
- const authenticate = (mode: "login" | "signup") => {
129
+ const authenticate = (mode: AccountMode) => {
99
130
  recordWallCtaClicked(placement, mode);
100
131
  openAuth(openCommandBar, mode);
101
132
  };
@@ -107,16 +138,13 @@ export function SignInWall({ placement, action, needsVerification = false, hint,
107
138
  <EmptyState
108
139
  title={title}
109
140
  hint={hint}
110
- actions={needsVerification ? (
111
- <Button
112
- label={t("Resend Verification Email")}
113
- onPress={() => openCommandBar("Resend Verification Email")}
141
+ actions={(
142
+ <AuthButtons
143
+ showSignup
144
+ needsVerification={needsVerification}
145
+ onAuth={authenticate}
146
+ onResend={() => openCommandBar(RESEND_VERIFICATION)}
114
147
  />
115
- ) : (
116
- <>
117
- <Button label={t("Log in")} variant="primary" onPress={() => authenticate("login")} />
118
- <Button label={t("Sign up free")} variant="secondary" onPress={() => authenticate("signup")} />
119
- </>
120
148
  )}
121
149
  />
122
150
  </Box>
@@ -7,8 +7,8 @@
7
7
  *
8
8
  * The arm is asked for when the offer would show, in both arms, and that is
9
9
  * the exposure (`exposeWebExperiment`); the control shows nothing. The line
10
- * sits beside the signed-out Log in, where signed-in free accounts see
11
- * "delayed data · upgrade", and never covers the terminal. Like the other
10
+ * sits beside the signed-out Log in and the delayed mark, which then stands
11
+ * without its "delayed", and never covers the terminal. Like the other
12
12
  * status bar chips it takes no keyboard focus: its tooltip names UPGRADE, and
13
13
  * the Hide Pro Trial Offer command hides it. Hiding keeps it away for 14 days.
14
14
  * Where the status bar has no room for it, as on a phone, it never shows and
@@ -161,7 +161,7 @@ function WebTrialOffer({ expose = exposeWebExperiment, delayMs = TRIAL_OFFER_DEL
161
161
  }, [delayMs, expose, fits, onScreen, signedOut, state]);
162
162
 
163
163
  const showing = state === "shown" && signedOut && !isTrialOfferSnoozed(dismissedAt) && copy !== null;
164
- // The version chip and the desktop link give way to the line.
164
+ // The connection note gives way to the line.
165
165
  useStatusWidgetClaim("trial-offer", showing && copy ? copy.columns : 0);
166
166
  const hide = useCallback(() => {
167
167
  setDismissedAt(Date.now());
@@ -3,8 +3,9 @@ import { apiClient } from "../../../api-client";
3
3
  import { t, tf } from "../../../i18n";
4
4
  import { useAppLanguage } from "../../../i18n/react";
5
5
  import { Button } from "../../../components/ui/button";
6
- import { DelayedMark, delayedMarkWidth } from "../../../components/ui/delayed-mark";
7
- import { Box, useCommandBarShortcut, useUiCapabilities } from "../../../ui";
6
+ import { DelayedMark, delayedMarkWidth, useStateQuoteDelay } from "../../../components/ui/delayed-mark";
7
+ import { Box, Text, useCommandBarShortcut, useUiCapabilities } from "../../../ui";
8
+ import { useThemeColors } from "../../../theme/theme-context";
8
9
  import { chatController, type ChatController } from "../chat/controller";
9
10
  import { useCloudPlanAction, useCloudUpgradeAction } from "../shared/cloud-upgrade";
10
11
  import { CLOUD_QUOTE_DELAY_MINUTES, resolvePlanAccess } from "../../../api-client/plan-access";
@@ -25,12 +26,15 @@ interface CloudUpgradeStatusWidgetProps {
25
26
 
26
27
  /**
27
28
  * Global entitlement status: the trial countdown while Pro is on loan, or,
28
- * signed out or on the free plan, the delayed mark the app's prices carry and
29
- * the upgrade. While the trial offer line already pitches Pro, the mark stands
30
- * alone. Pro accounts have nothing to report.
29
+ * signed out or on the free plan, the one place that says the app's prices
30
+ * are late (`◷ 15m delayed`), pressed for the upgrade. Said here, a price
31
+ * outside a pane footer leaves its own mark out. While the trial offer line
32
+ * already pitches Pro, the mark stands alone. Pro accounts have nothing to
33
+ * report.
31
34
  */
32
35
  export function CloudUpgradeStatusWidget({ controller = chatController }: CloudUpgradeStatusWidgetProps) {
33
36
  useAppLanguage();
37
+ const colors = useThemeColors();
34
38
  const openUpgrade = useCloudUpgradeAction("status-widget");
35
39
  const openPlan = useCloudPlanAction();
36
40
  const offerShowing = useTrialOfferShowing();
@@ -38,22 +42,20 @@ export function CloudUpgradeStatusWidget({ controller = chatController }: CloudU
38
42
  // The status bar takes no keyboard focus; the chip names the command instead.
39
43
  const commandBarKey = useCommandBarShortcut();
40
44
  const [access, setAccess] = useState(() => resolvePlanAccess(apiClient.getCurrentUser()));
45
+ const delayed = !access.isTrialActive && !access.hasProAccess;
41
46
  // The bar holds back its usual columns for the widgets' own text, which
42
- // this one shares with the chat's sign-in: half of them are its own. The
43
- // label never shrinks into Feedback beside it: "delayed data · upgrade"
44
- // where the row has room for what the mark and "upgrade" draw past that
45
- // half and the words before it, else "upgrade". What it draws past the
46
- // usual columns is claimed, so the version chip gives way to it.
47
+ // this one shares with the account chip beside it: half of them are its
48
+ // own. The note says "delayed" where the row has room for what it draws
49
+ // past that half, and claims it, else it is the mark alone.
47
50
  const room = useStatusWidgetRoom();
48
51
  const othersClaimed = useOtherStatusWidgetClaims(CLAIM_ID);
49
- const free = !access.isTrialActive && !access.hasProAccess && !offerShowing;
50
- const longLabel = t("delayed data · upgrade");
51
- const shortLabel = t("upgrade");
52
- const overflow = Math.max(0, delayedMarkWidth(CLOUD_QUOTE_DELAY_MINUTES, false) + 1 + displayWidth(shortLabel) + 1
53
- - STATUS_WIDGET_COLUMNS / 2);
54
- const extra = displayWidth(longLabel) - displayWidth(shortLabel);
55
- const long = nativePaneChrome || room - STATUS_WIDGET_COLUMNS - othersClaimed >= overflow + extra;
56
- useStatusWidgetClaim(CLAIM_ID, free && !nativePaneChrome ? long ? extra : overflow : 0);
52
+ const word = t("delayed");
53
+ // The mark, the space before the word, the word and the space after the note.
54
+ const noteColumns = delayedMarkWidth(CLOUD_QUOTE_DELAY_MINUTES, false) + 1 + displayWidth(word) + 1;
55
+ const overflow = Math.max(0, noteColumns - STATUS_WIDGET_COLUMNS / 2);
56
+ const spelled = !offerShowing && (nativePaneChrome || room - STATUS_WIDGET_COLUMNS - othersClaimed >= overflow);
57
+ useStatusWidgetClaim(CLAIM_ID, delayed && spelled && !nativePaneChrome ? overflow : 0);
58
+ useStateQuoteDelay(delayed);
57
59
 
58
60
  useEffect(
59
61
  // The chat widget already drives session refreshes; this only follows them.
@@ -76,19 +78,24 @@ export function CloudUpgradeStatusWidget({ controller = chatController }: CloudU
76
78
  if (access.hasProAccess) return null;
77
79
 
78
80
  const mark = <DelayedMark minutes={CLOUD_QUOTE_DELAY_MINUTES} />;
81
+ const detail = tf("{delay} delayed", { delay: `${CLOUD_QUOTE_DELAY_MINUTES}m` });
79
82
  return (
80
- <Box flexDirection="row" alignItems="center" gap={1} flexShrink={0} paddingRight={offerShowing || !nativePaneChrome ? 1 : 0} data-gloom-role="delayed-status">
81
- {mark}
82
- {offerShowing ? null : (
83
+ <Box flexDirection="row" alignItems="center" flexShrink={0} paddingRight={1} data-gloom-role="delayed-status">
84
+ {spelled ? (
83
85
  <Button
84
- label={long ? longLabel : shortLabel}
85
- title={tf("Upgrade to Pro ({key}, then {command})", { key: commandBarKey, command: "UPGRADE" })}
86
+ label={detail}
87
+ title={`${detail}. ${tf("Upgrade to Pro ({key}, then {command})", { key: commandBarKey, command: "UPGRADE" })}`}
86
88
  variant="plain"
87
89
  compact
88
90
  stopPropagation
89
91
  onPress={openUpgrade}
90
- />
91
- )}
92
+ >
93
+ <Box flexDirection="row" alignItems="center" gap={1}>
94
+ {mark}
95
+ <Text fg={colors.textDim} selectable={false}>{word}</Text>
96
+ </Box>
97
+ </Button>
98
+ ) : mark}
92
99
  </Box>
93
100
  );
94
101
  }
@@ -96,9 +96,10 @@ export function formatLag(value: number | null): string {
96
96
  return value == null ? "--" : `${value}d`;
97
97
  }
98
98
 
99
+ /** A disclosure bracket's bound, as the filing's range names it ($1k-15k): a label, short even in a table column. */
99
100
  function formatMoneyShort(value: number | null): string {
100
101
  if (value == null) return "--";
101
- return `$${formatCompact(value)}`;
102
+ return `$${formatCompact(value, { fixedDecimals: false })}`;
102
103
  }
103
104
 
104
105
  export function formatAmountRange(low: number | null, high: number | null, raw?: string): string {
@@ -19,6 +19,7 @@ const CONGRESS_TABS = [
19
19
  import { useDebouncedPluginPaneState, usePluginPaneState } from "../../runtime";
20
20
  import { useShortcut } from "../../../react/input";
21
21
  import { isDetailBackNavigationKey } from "../../../utils/back-navigation";
22
+ import { countEscapeTowardClose } from "../../../utils/double-escape-close";
22
23
  import { nextHeaderSort, type SortDirection } from "../../../utils/sort-values";
23
24
  import { useAutoRefresh } from "../../../react/auto-refresh";
24
25
  import { useInlineTickerOpener } from "../../../state/hooks/inline-tickers";
@@ -221,6 +222,8 @@ export function CongressTradesPane({ focused, width, height, tickerFilter }: Pan
221
222
  useShortcut((event) => {
222
223
  if (!focused || event.targetEditable) return;
223
224
  if (tickerFilter && detailMode && isDetailBackNavigationKey(event)) {
225
+ // Ahead of the shell's own Esc handler when restored with it, so it counts the Esc itself.
226
+ countEscapeTowardClose(event);
224
227
  event.preventDefault?.(); event.stopPropagation?.(); setDetailMode(null); return;
225
228
  }
226
229
  if (!payload) handleRefreshKey(event, refresh, { stopPropagation: true });
@@ -1,5 +1,6 @@
1
1
  import type { PricePoint } from "../../../types/financials";
2
2
  import { getPricePointTimestamp } from "../../../utils/price-history";
3
+ import { pricePointIntegrity } from "../../../utils/price-history-integrity";
3
4
 
4
5
  export interface CorrelationResult {
5
6
  correlation: number | null;
@@ -21,12 +22,17 @@ export interface DailyClose {
21
22
  */
22
23
  export type ChangeBasis = "return" | "difference";
23
24
 
24
- /** Keep the final valid close for each UTC trading date, in chronological order. */
25
+ /**
26
+ * Keep the final valid close for each UTC trading date, in chronological order.
27
+ * A bar whose prices contradict each other (a high under its open) is left out,
28
+ * as `history` leaves it blank: the series has a gap there, and the next return
29
+ * runs from the close before it, as across a holiday.
30
+ */
25
31
  export function dailyCloses(points: readonly PricePoint[]): DailyClose[] {
26
32
  const byDate = new Map<string, number>();
27
33
  for (const point of [...points].sort(comparePricePointsByDate)) {
28
34
  const dateKey = toDateKey(point);
29
- if (!dateKey || !Number.isFinite(point.close) || point.close <= 0) continue;
35
+ if (!dateKey || !Number.isFinite(point.close) || point.close <= 0 || pricePointIntegrity(point)) continue;
30
36
  byDate.set(dateKey, point.close);
31
37
  }
32
38
  return [...byDate].map(([dateKey, close]) => ({ dateKey, close }));
@@ -8,7 +8,7 @@ import { buildCorrelationMatrix, buildCorrelationSeries, buildGeoCorrelationSeri
8
8
  import { geoSeriesToken, loadGeoCorrelationHistory } from "./geo";
9
9
  import { buildRelationshipAnalysis, DEFAULT_RELATIONSHIP_SECOND_SYMBOL } from "./relationship/model";
10
10
  import { paneSchemas } from "./headless-schema";
11
- import { CORRELATION_RETURN_BASIS, GEO_CORRELATION_CHANGE_BASIS, loadCorrelationHistory, unfinishedBarFreshness } from "./history";
11
+ import { CORRELATION_RETURN_BASIS, GEO_CORRELATION_CHANGE_BASIS, loadCorrelationHistory, thinCorrelationNote, unfinishedBarFreshness } from "./history";
12
12
  import type { HeadlessPaneContext } from "../../../types/headless";
13
13
  import type { PricePoint } from "../../../types/financials";
14
14
  import { newestReportTime } from "../../../utils/utc-time";
@@ -70,9 +70,7 @@ export const correlationHeadless: HeadlessPaneDefinition<"rows"> = {
70
70
  if (!unavailableSymbols.length && rows.every((row) => row.correlation == null)) unavailableSymbols.push(...symbols);
71
71
  const unavailablePairs = rows.filter((row) => row.correlation == null).map((row) => ({
72
72
  left: row.left, right: row.right, sampleSize: row.sampleSize,
73
- reason: bySymbol.get(row.left as string)?.status === "invalid" || bySymbol.get(row.right as string)?.status === "invalid"
74
- ? "Inconsistent OHLC history"
75
- : row.sampleSize < 5 ? "Insufficient shared return observations" : "Zero return variance",
73
+ reason: row.sampleSize < 5 ? "Insufficient shared return observations" : "Zero return variance",
76
74
  }));
77
75
  const asOf = newestReportTime(symbols.map((symbol) => bySymbol.get(symbol)?.prices.at(-1)?.dateKey));
78
76
  return {
@@ -80,7 +78,13 @@ export const correlationHeadless: HeadlessPaneDefinition<"rows"> = {
80
78
  rows, unavailableSymbols,
81
79
  errors: [
82
80
  ...loaded.errors,
83
- ...unavailablePairs.map((pair) => `${pair.left}/${pair.right}: ${pair.reason} (${pair.sampleSize} shared observations).`),
81
+ // A thin pair says which side is short of daily bars; a pair with enough returns and no value has no variance.
82
+ ...rows.flatMap((row) => {
83
+ const closes = (symbol: string) => ({ label: symbol, closes: bySymbol.get(symbol)?.prices.length ?? 0 });
84
+ const thin = thinCorrelationNote(closes(row.left), closes(row.right), row.sampleSize, range);
85
+ if (thin) return [`${row.left}/${row.right}: ${thin}.`];
86
+ return row.correlation == null ? [`${row.left}/${row.right}: Zero return variance (${row.sampleSize} shared observations).`] : [];
87
+ }),
84
88
  ],
85
89
  metadata: {
86
90
  range,
@@ -116,8 +120,6 @@ export const relationshipHeadless: HeadlessPaneDefinition<"series"> = {
116
120
  const unavailableSymbols = symbols.filter((symbol) => (histories.get(symbol) ?? []).filter((point) => (
117
121
  Number.isFinite(point.close) && point.close > 0 && Number.isFinite(new Date(point.date).getTime())
118
122
  )).length < 2);
119
- if (analysis.integrity?.left.length) unavailableSymbols.push(symbols[0]!);
120
- if (analysis.integrity?.right.length) unavailableSymbols.push(symbols[1]!);
121
123
  if (!unavailableSymbols.length && !analysis.returns.length) unavailableSymbols.push(...symbols);
122
124
  const correlations = new Map(analysis.correlationPoints.map(({ date, close }) => [date.getTime(), close]));
123
125
  const regression = `${symbols[0]} on ${symbols[1]}`;
@@ -142,8 +144,7 @@ export const relationshipHeadless: HeadlessPaneDefinition<"series"> = {
142
144
  ],
143
145
  freshness: unfinishedBarFreshness([...histories.values()], analysis.aligned.at(-1)?.dateKey) ?? {},
144
146
  unavailableSymbols: [...new Set(unavailableSymbols)],
145
- errors: [...loaded.errors, ...(analysis.unavailableReason ? [analysis.unavailableReason] : []),
146
- ...(analysis.correlationUnavailableReason ? [analysis.correlationUnavailableReason] : [])],
147
+ errors: [...loaded.errors, ...(analysis.correlationUnavailableReason ? [analysis.correlationUnavailableReason] : [])],
147
148
  metadata: {
148
149
  left: symbols[0], right: symbols[1], range, correlationWindow,
149
150
  returnAlignment: CORRELATION_RETURN_BASIS,
@@ -38,6 +38,36 @@ export function unfinishedBarFreshness(
38
38
  return null;
39
39
  }
40
40
 
41
+ /** Below this many shared daily returns a correlation says why it has so few. */
42
+ const CORRELATION_EXPLAINED_RETURNS = 20;
43
+
44
+ interface CorrelationSide {
45
+ label: string;
46
+ /** Daily closes the side has in the range, contradictory bars left out. */
47
+ closes: number;
48
+ }
49
+
50
+ /**
51
+ * Why a pair has fewer than CORRELATION_EXPLAINED_RETURNS shared daily
52
+ * returns: the side with no daily bars in the range, or, when both have bars,
53
+ * how many each has. Null when there are enough.
54
+ */
55
+ export function thinCorrelationNote(left: CorrelationSide, right: CorrelationSide, returns: number, range: string): string | null {
56
+ if (returns >= CORRELATION_EXPLAINED_RETURNS) return null;
57
+ const empty = [...new Set([left, right].filter((side) => side.closes === 0).map((side) => side.label))];
58
+ if (empty.length > 0) return `${empty.join(" and ")} ${empty.length === 1 ? "has" : "have"} no daily bars in the ${range} range`;
59
+ const bars = (count: number) => `${count} daily ${count === 1 ? "bar" : "bars"}`;
60
+ const sides = left.label === right.label ? `${left.label} has ${bars(left.closes)}`
61
+ : `${left.label} has ${bars(left.closes)} and ${right.label} ${bars(right.closes)}`;
62
+ return `${sides} in the ${range} range; ${returns === 0 ? "no" : returns} daily ${returns === 1 ? "return falls" : "returns fall"} between dates both have`;
63
+ }
64
+
65
+ /** "3046:HKEX: 8 of 245 bars have contradictory prices in the source data; left out, as history leaves them blank", or null. */
66
+ export function contradictoryBarsNote(label: string, left: number, total: number): string | null {
67
+ if (left <= 0) return null;
68
+ return `${label}: ${left} of ${total} ${left === 1 && total === 1 ? "bar" : "bars"} ${left === 1 ? "has" : "have"} contradictory prices in the source data; left out, as history leaves them blank`;
69
+ }
70
+
41
71
  export const CORRELATION_RETURN_BASIS = "Local-price close-to-close returns between shared UTC dates; cash distributions and FX conversion are excluded, and exchange closing times may differ.";
42
72
 
43
73
  export const GEO_CORRELATION_CHANGE_BASIS = "Map series (GEO:) use the change in daily value between the same shared UTC dates, because counts such as transits can be zero.";