gloomberb 0.19.6 → 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. package/LICENSE +0 -4
  2. package/package.json +6 -5
  3. package/patches/electrobun-devkit@2.0.5.patch +148 -0
  4. package/src/api-client/bond-trades.ts +59 -0
  5. package/src/api-client/data.ts +21 -0
  6. package/src/api-client/index.ts +2 -0
  7. package/src/api-client/types/account.ts +86 -0
  8. package/src/api-client/types/assist.ts +32 -0
  9. package/src/api-client/types/auth.ts +63 -0
  10. package/src/api-client/types/billing.ts +54 -0
  11. package/src/api-client/types/chat.ts +180 -0
  12. package/src/api-client/types/congress.ts +107 -0
  13. package/src/api-client/types/credit.ts +110 -0
  14. package/src/api-client/types/econ.ts +158 -0
  15. package/src/api-client/types/equity-diagnostic.ts +73 -0
  16. package/src/api-client/types/filings-and-calls.ts +350 -0
  17. package/src/api-client/types/index.ts +25 -0
  18. package/src/api-client/types/jobs.ts +147 -0
  19. package/src/api-client/types/market.ts +122 -0
  20. package/src/api-client/types/news.ts +91 -0
  21. package/src/api-client/types/notes-and-theses.ts +172 -0
  22. package/src/api-client/types/quotes.ts +28 -0
  23. package/src/api-client/types/scanners.ts +125 -0
  24. package/src/api-client/types/screener.ts +65 -0
  25. package/src/api-client/types/search.ts +107 -0
  26. package/src/api-client/types/sync.ts +14 -0
  27. package/src/api-client/types/team-collections.ts +43 -0
  28. package/src/api-client/types/team-views.ts +32 -0
  29. package/src/api-client/types/teams.ts +135 -0
  30. package/src/api-client/types/ticker-data.ts +57 -0
  31. package/src/api-client/types/tweets.ts +59 -0
  32. package/src/api-client/types/world-venues.ts +23 -0
  33. package/src/app/runtime/desktop-deeplink.ts +41 -6
  34. package/src/app/star-prompt/status-line.tsx +1 -1
  35. package/src/app.tsx +1 -7
  36. package/src/architecture/ui-tokens-allowlist.json +0 -8
  37. package/src/cli/commands/ticker.ts +17 -4
  38. package/src/cli/desktop-pane-shot-browser.ts +69 -3
  39. package/src/cli/pane-functions/catalog.ts +3 -1
  40. package/src/components/chart/composite/use-composite-chart-keyboard.ts +11 -2
  41. package/src/components/data-table/export.ts +4 -1
  42. package/src/components/layout/detached-pane-shell.tsx +10 -37
  43. package/src/components/layout/double-escape-close.ts +90 -0
  44. package/src/components/layout/header.tsx +3 -2
  45. package/src/components/layout/market-summary.ts +6 -3
  46. package/src/components/layout/pane/footer/index.tsx +2 -6
  47. package/src/components/layout/pane/footer/model.ts +6 -12
  48. package/src/components/layout/shell/active-drag.ts +53 -11
  49. package/src/components/layout/shell/drag/magnets.ts +128 -19
  50. package/src/components/layout/shell/pane/actions.ts +6 -2
  51. package/src/components/layout/shell/pane/management-shortcuts.ts +13 -51
  52. package/src/components/layout/status-bar.tsx +4 -78
  53. package/src/components/layout/status-widget-space.ts +5 -5
  54. package/src/components/onboarding/portfolio-step/positions-panel.tsx +1 -1
  55. package/src/components/ui/data-table/index.tsx +5 -1
  56. package/src/components/ui/data-table/render-cell.ts +19 -0
  57. package/src/components/ui/delayed-mark.tsx +59 -7
  58. package/src/components/ui/icon.tsx +1 -8
  59. package/src/components/ui/menu.tsx +6 -1
  60. package/src/i18n/es.ts +3 -3
  61. package/src/i18n/ja.ts +3 -3
  62. package/src/i18n/ko.ts +3 -3
  63. package/src/i18n/zh-cn.ts +3 -3
  64. package/src/i18n/zh-tw.ts +3 -3
  65. package/src/plugins/builtin/chat/content/composer.tsx +21 -27
  66. package/src/plugins/builtin/chat/content/index.tsx +31 -3
  67. package/src/plugins/builtin/chat/content/shortcuts.ts +4 -2
  68. package/src/plugins/builtin/chat/content/snapshot.ts +0 -3
  69. package/src/plugins/builtin/cloud/auth-actions.tsx +51 -23
  70. package/src/plugins/builtin/cloud/trial-offer-status-widget.tsx +3 -3
  71. package/src/plugins/builtin/cloud/upgrade-status-widget.tsx +32 -25
  72. package/src/plugins/builtin/congress-trades/model.ts +2 -1
  73. package/src/plugins/builtin/congress-trades/pane.tsx +3 -0
  74. package/src/plugins/builtin/custom-view/index.tsx +1 -1
  75. package/src/plugins/builtin/custom-view/loader.ts +85 -8
  76. package/src/plugins/builtin/custom-view/view-spec.ts +28 -0
  77. package/src/plugins/builtin/equity-screener/criterion-editor.tsx +13 -4
  78. package/src/plugins/builtin/equity-screener/headless.ts +33 -1
  79. package/src/plugins/builtin/equity-screener/model.ts +58 -15
  80. package/src/plugins/builtin/equity-screener/pane.tsx +36 -6
  81. package/src/plugins/builtin/executives/format.ts +5 -4
  82. package/src/plugins/builtin/executives/pane.tsx +1 -1
  83. package/src/plugins/builtin/help/index.tsx +55 -1
  84. package/src/plugins/builtin/insider/model.ts +30 -2
  85. package/src/plugins/builtin/jobs/model.ts +2 -2
  86. package/src/plugins/builtin/mna/model.ts +2 -2
  87. package/src/plugins/builtin/notes/files.ts +2 -0
  88. package/src/plugins/builtin/notes/owner.tsx +20 -1
  89. package/src/plugins/builtin/notes/quick-notes-pane.tsx +22 -4
  90. package/src/plugins/builtin/notes/store.ts +6 -1
  91. package/src/plugins/builtin/portfolio-list/header.tsx +1 -1
  92. package/src/plugins/builtin/research/corporate-actions-pane.tsx +29 -25
  93. package/src/plugins/builtin/series-inventory.ts +1 -0
  94. package/src/plugins/builtin/shared/earnings-report.ts +7 -2
  95. package/src/plugins/builtin/shared/use-quote-board.ts +85 -46
  96. package/src/plugins/builtin/short-interest/headless.ts +1 -1
  97. package/src/plugins/builtin/short-interest/model.ts +15 -6
  98. package/src/plugins/builtin/short-interest/types.ts +2 -0
  99. package/src/plugins/builtin/thirteenf/overlap-pane.tsx +3 -0
  100. package/src/plugins/builtin/thirteenf/pane.tsx +3 -0
  101. package/src/plugins/builtin/ticker-detail/overview/model.ts +5 -3
  102. package/src/plugins/builtin/ticker-detail/overview-tab.tsx +4 -4
  103. package/src/plugins/builtin/trace-bonds/detail.tsx +198 -0
  104. package/src/plugins/builtin/trace-bonds/headless.ts +62 -4
  105. package/src/plugins/builtin/trace-bonds/history.ts +155 -0
  106. package/src/plugins/builtin/trace-bonds/pane.tsx +64 -5
  107. package/src/plugins/installer.ts +16 -3
  108. package/src/plugins/plugin-names.ts +11 -2
  109. package/src/remote/controller.ts +9 -2
  110. package/src/remote/schema.ts +2 -1
  111. package/src/renderers/cloudflare/http-proxy.ts +67 -8
  112. package/src/renderers/cloudflare/proxy-session.ts +1 -1
  113. package/src/renderers/cloudflare/worker.ts +29 -2
  114. package/src/renderers/dom/desktop/icons.tsx +0 -2
  115. package/src/renderers/dom/styles.css +0 -3
  116. package/src/renderers/electrobun/bun/desktop/install-records.ts +59 -0
  117. package/src/renderers/electrobun/bun/desktop/installer-folder.ts +208 -592
  118. package/src/renderers/electrobun/bun/desktop/macos-objc.ts +14 -0
  119. package/src/renderers/electrobun/bun/desktop/update.ts +1 -1
  120. package/src/renderers/electrobun/bun/index.ts +19 -13
  121. package/src/renderers/electrobun/bun/window/create.ts +23 -3
  122. package/src/renderers/electrobun/bun/window/electrobun-window-host.ts +4 -4
  123. package/src/renderers/electrobun/bun/window/events.ts +4 -4
  124. package/src/renderers/electrobun/bun/window/frame.ts +2 -1
  125. package/src/renderers/electrobun/bun/window/native-min-size.ts +322 -0
  126. package/src/renderers/electrobun/view/backend-rpc.ts +1 -1
  127. package/src/sources/gloomberb-cloud/index.ts +5 -7
  128. package/src/sources/provider-router/batches.ts +18 -3
  129. package/src/sources/provider-router/financials.ts +18 -4
  130. package/src/types/data-provider.ts +14 -0
  131. package/src/types/financials.ts +15 -3
  132. package/src/types/headless.ts +2 -0
  133. package/src/utils/double-escape-close.ts +38 -16
  134. package/src/utils/format.ts +23 -3
  135. package/src/utils/price-earnings.ts +18 -0
  136. package/patches/electrobun@1.18.1.patch +0 -633
  137. package/src/api-client/types.ts +0 -2441
package/src/i18n/zh-tw.ts CHANGED
@@ -286,6 +286,8 @@ export const zhTW: Record<string, string> = {
286
286
 
287
287
  // ── Context menu ─────────────────────────────────────────────
288
288
  "Start Here": "從這裡開始",
289
+ "About": "關於",
290
+ "What's new in v{version}": "v{version} 新功能",
289
291
  "Research a company: the overview, then tabs for the chart, financials, news, filings and earnings calls.": "研究一家公司:先看概覽,再切換到圖表、財務、新聞、文件和法說會標籤。",
290
292
  "Add what you own. Alerts and emails then follow your portfolio.": "新增你的持股。之後提醒和郵件都會圍繞你的投資組合。",
291
293
  "Your portfolio and watchlists.": "你的投資組合和自選清單。",
@@ -687,7 +689,7 @@ export const zhTW: Record<string, string> = {
687
689
  "{delay} delayed · try Pro live": "延遲 {delay} · 試用 Pro 即時資料",
688
690
  "Pro trial {days}d": "Pro 試用 {days} 天",
689
691
  "Pro trial — ends {date}": "Pro 試用 — {date} 結束",
690
- "delayed data · upgrade": "資料延遲 · 升級",
692
+ "delayed": "延遲",
691
693
  "upgrade": "升級",
692
694
  "real-time news": "即時新聞",
693
695
  "AI command bar": "AI 命令列",
@@ -852,7 +854,6 @@ export const zhTW: Record<string, string> = {
852
854
  "Start group chat": "開始群組聊天",
853
855
  "Use @username, or multiple usernames for a group chat": "使用 @username,或輸入多個使用者名稱開始群組聊天",
854
856
  "Type DM @username to start one": "輸入 DM @username 開始私訊",
855
- "Read-only chat. Log in or sign up to send.": "聊天目前為唯讀模式。登入或註冊後即可傳送訊息。",
856
857
  "Saved login found. Log in again to send.": "發現已儲存的登入資訊。請重新登入後傳送訊息。",
857
858
  "Verify your email to send messages.": "驗證電子郵件後才能傳送訊息。",
858
859
  // The first-chat prompt for an account still on its signup handle.
@@ -876,7 +877,6 @@ export const zhTW: Record<string, string> = {
876
877
  "ask questions about anything on screen": "針對畫面上的任何內容提問",
877
878
  "Free with a verified Gloom account.": "使用已驗證的 Gloom 帳戶即可免費使用。",
878
879
  "search X": "搜尋 X",
879
- "{shortcut}, then Resend Verification Email": "按 {shortcut},然後選擇「重新發送驗證郵件」",
880
880
  "editing": "編輯中",
881
881
  "replying to": "回覆",
882
882
  "Reply": "回覆",
@@ -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 });
@@ -3,7 +3,7 @@ import { CUSTOM_VIEW_PANE_ID, CUSTOM_VIEW_SPEC_SETTING, CustomViewPane } from ".
3
3
  import { parseViewSpec, serializeViewSpec, type ViewSpec } from "./view-spec";
4
4
 
5
5
  export { CUSTOM_VIEW_PANE_ID } from "./pane";
6
- export { setViewRefResolver, trialLoadViewSource } from "./loader";
6
+ export { setViewRefResolver, trialLoadViewSource, UnknownViewKeysError } from "./loader";
7
7
  export * from "./view-spec";
8
8
 
9
9
  export const CUSTOM_VIEW_TEMPLATE_ID = "custom-view-pane";
@@ -5,7 +5,7 @@ import type { AppConfig } from "../../../types/config";
5
5
  import { getSharedRegistry, type PluginRegistry } from "../../registry";
6
6
  import { marketContextFromRegistry } from "../cloud/askg/host";
7
7
  import { notViewSourceMessage, unknownViewSourceMessage } from "./sources";
8
- import type { ViewRow, ViewSource, ViewSpec } from "./view-spec";
8
+ import { applyViewProjection, unknownViewKeys, type UnknownViewKey, type ViewKeyPlace, type ViewRow, type ViewSource, type ViewSpec } from "./view-spec";
9
9
 
10
10
  export interface LoadedView {
11
11
  rows: ViewRow[];
@@ -113,14 +113,93 @@ export async function loadViewSource(
113
113
 
114
114
  /** How long a trial load waits; under the 10 s a remote tool call is given. */
115
115
  const VIEW_TRIAL_TIMEOUT_MS = 8_000;
116
+ /** Source keys a refusal lists at most. */
117
+ const LISTED_SOURCE_KEYS = 60;
118
+
119
+ /** The spec names keys the source's rows never carry; nothing is kept. */
120
+ export class UnknownViewKeysError extends Error {
121
+ override name = "UnknownViewKeysError";
122
+ }
123
+
124
+ const PLACE_NAMES: Record<ViewKeyPlace, [one: string, many: string]> = {
125
+ column: ["column", "columns"],
126
+ filter: ["filter key", "filter keys"],
127
+ sort: ["sort key", "sort keys"],
128
+ symbolKey: ["symbol key", "symbol keys"],
129
+ };
130
+
131
+ /** `columns change1d, low30d; sort key vol` */
132
+ function describeUnknownKeys(unknown: readonly UnknownViewKey[]): string {
133
+ const byPlace = new Map<ViewKeyPlace, string[]>();
134
+ for (const { key, place } of unknown) byPlace.set(place, [...(byPlace.get(place) ?? []), key]);
135
+ return [...byPlace].map(([place, keys]) => `${PLACE_NAMES[place][keys.length === 1 ? 0 : 1]} ${keys.join(", ")}`).join("; ");
136
+ }
137
+
138
+ function comparable(text: string): string {
139
+ return text.toLowerCase().replace(/[^a-z0-9]/g, "");
140
+ }
141
+
142
+ /** The source's keys, its listed columns first with their header where it says more than the key: `title (Market)`. */
143
+ function describeSourceKeys(columns: readonly HeadlessPaneColumn[], rowKeys: Iterable<string>): string {
144
+ const entries = new Map<string, string>();
145
+ for (const column of columns) {
146
+ if (entries.has(column.key)) continue;
147
+ const header = column.header?.trim();
148
+ entries.set(column.key, header && comparable(header) !== comparable(column.key) ? `${column.key} (${header})` : column.key);
149
+ }
150
+ for (const key of rowKeys) if (!entries.has(key)) entries.set(key, key);
151
+ const listed = [...entries.values()];
152
+ const more = listed.length - LISTED_SOURCE_KEYS;
153
+ return more > 0 ? `${listed.slice(0, LISTED_SOURCE_KEYS).join(", ")} and ${more} more` : listed.join(", ");
154
+ }
155
+
156
+ /**
157
+ * What a trial load says about the spec. Names the spec uses that none of the
158
+ * loaded rows carry throw `UnknownViewKeysError` with the keys they do carry,
159
+ * so a view never opens on columns that stay blank or filters that drop every
160
+ * row. With no rows to read, the source's listed columns are all there is to
161
+ * check against and they need not list every key, so a mismatch only warns.
162
+ */
163
+ function checkLoadedView(spec: ViewSpec, loaded: LoadedView): string[] {
164
+ const notes = loaded.errors.slice(0, 2);
165
+ const listed = new Set(loaded.columns.map((column) => column.key));
166
+ if (loaded.rows.length === 0) {
167
+ const unlisted = listed.size > 0 ? unknownViewKeys(spec, listed) : [];
168
+ return [
169
+ "The source loaded no rows.",
170
+ ...notes,
171
+ ...(unlisted.length > 0
172
+ ? [`With no rows to check, these are not among the ${loaded.sourceLabel} columns: ${describeUnknownKeys(unlisted)}. Its columns: ${describeSourceKeys(loaded.columns, [])}.`]
173
+ : []),
174
+ ];
175
+ }
176
+ const rowKeys = new Set<string>();
177
+ for (const row of loaded.rows) for (const key of Object.keys(row)) rowKeys.add(key);
178
+ const unknown = unknownViewKeys(spec, new Set([...listed, ...rowKeys]));
179
+ if (unknown.length > 0) {
180
+ throw new UnknownViewKeysError(
181
+ `Not in the ${loaded.sourceLabel} rows: ${describeUnknownKeys(unknown)}. `
182
+ + `Its rows carry: ${describeSourceKeys(loaded.columns, rowKeys)}. `
183
+ + "Use only those keys, and say which of the asked-for columns this source does not have.",
184
+ );
185
+ }
186
+ const { filters } = spec.projection;
187
+ if (filters.length > 0 && applyViewProjection(loaded.rows, { columns: [], filters }, null).length === 0) {
188
+ const count = loaded.rows.length;
189
+ const none = count === 1 ? "The one row the source loaded does not pass" : `None of the ${count} rows the source loaded pass`;
190
+ return [`${none} the view's filters, so the view shows no rows.`, ...notes];
191
+ }
192
+ return notes;
193
+ }
116
194
 
117
195
  /**
118
196
  * Loads the spec's source once through `loadViewSource`, the path its pane
119
197
  * takes, before the spec is kept. Throws what the source throws (an unknown
120
- * function with the valid ones, a usage or option error, a failed read), so
121
- * nothing broken is saved. Resolves with what to tell the person: notes the
122
- * source carried, an empty result, or that it had not answered in time, which
123
- * is not a failure: a slow source still opens.
198
+ * function with the valid ones, a usage or option error, a failed read), or
199
+ * `UnknownViewKeysError` for keys its rows never carry, so nothing broken is
200
+ * saved. Resolves with what to tell the person: notes the source carried, an
201
+ * empty result, or that it had not answered in time, which is not a failure:
202
+ * a slow source still opens.
124
203
  */
125
204
  export async function trialLoadViewSource(
126
205
  spec: ViewSpec,
@@ -148,9 +227,7 @@ export async function trialLoadViewSource(
148
227
  if (outcome === "timeout") {
149
228
  return [`The source had not answered after ${Math.max(1, Math.round(timeoutMs / 1_000))} s, so it was not checked. The view opens and keeps loading.`];
150
229
  }
151
- return outcome.rows.length === 0
152
- ? ["The source loaded no rows.", ...outcome.errors.slice(0, 2)]
153
- : outcome.errors.slice(0, 2);
230
+ return checkLoadedView(spec, outcome);
154
231
  } finally {
155
232
  clearTimeout(timer);
156
233
  signal?.removeEventListener("abort", abort);