@gloom-sh/terminal 0.20.17 → 0.20.19

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 (453) hide show
  1. package/package.json +3 -1
  2. package/src/account/auth-dialog.tsx +19 -1
  3. package/src/account/billing.ts +2 -1
  4. package/src/account/heard-from-question.tsx +235 -0
  5. package/src/account/heard-from.ts +97 -0
  6. package/src/api-client/cot.ts +5 -6
  7. package/src/api-client/data.ts +14 -3
  8. package/src/api-client/heard-from.ts +72 -0
  9. package/src/api-client/index.ts +64 -6
  10. package/src/api-client/mna.ts +18 -0
  11. package/src/api-client/request.ts +162 -40
  12. package/src/api-client/supply-chain.ts +9 -0
  13. package/src/api-client/types/billing.ts +35 -1
  14. package/src/api-client/types/news.ts +45 -0
  15. package/src/api-client/types/world-venues.ts +9 -0
  16. package/src/app/global-shortcuts.ts +5 -3
  17. package/src/app/pro-welcome/keys.ts +27 -0
  18. package/src/app/pro-welcome/model.ts +158 -0
  19. package/src/app/pro-welcome/row.tsx +176 -0
  20. package/src/app/pro-welcome/use-pro-welcome.ts +156 -0
  21. package/src/app/runtime/external-profile-changes.ts +135 -0
  22. package/src/app.tsx +37 -4
  23. package/src/architecture/core-builtin-allowlist.json +1 -1
  24. package/src/architecture/floating-promise-allowlist.json +1 -2
  25. package/src/architecture/shortcut-labels-allowlist.json +1 -0
  26. package/src/cli/alert-listing.ts +98 -0
  27. package/src/cli/commands/market.ts +191 -39
  28. package/src/cli/commands/overview.ts +7 -1
  29. package/src/cli/commands/plugins.ts +3 -2
  30. package/src/cli/commands/search.ts +30 -6
  31. package/src/cli/commands/ticker.ts +13 -6
  32. package/src/cli/context.ts +24 -5
  33. package/src/cli/csv-export.ts +2 -1
  34. package/src/cli/desktop-pane-shot-browser.ts +3 -1
  35. package/src/cli/desktop-pane-shot-view.ts +0 -1
  36. package/src/cli/desktop-pane-shot.ts +276 -52
  37. package/src/cli/errors.ts +3 -9
  38. package/src/cli/exit-codes.ts +1 -1
  39. package/src/cli/glossary.ts +65 -11
  40. package/src/cli/help.ts +1 -1
  41. package/src/cli/history-demergers.ts +117 -0
  42. package/src/cli/history-rows.ts +8 -4
  43. package/src/cli/index.ts +2 -1
  44. package/src/cli/known-gaps.ts +16 -0
  45. package/src/cli/known-us-stocks.ts +18 -0
  46. package/src/cli/listing-arg.ts +192 -38
  47. package/src/cli/pane-functions/catalog-snapshot-build.ts +83 -0
  48. package/src/cli/pane-functions/catalog-snapshot.json +877 -0
  49. package/src/cli/pane-functions/catalog-snapshot.ts +62 -0
  50. package/src/cli/pane-functions/catalog.ts +50 -16
  51. package/src/cli/pane-functions/data.ts +16 -4
  52. package/src/cli/pane-functions/dom.ts +54 -8
  53. package/src/cli/pane-functions/freshness.ts +39 -4
  54. package/src/cli/pane-functions/function-help.ts +3 -3
  55. package/src/cli/pane-functions/headless.ts +9 -1
  56. package/src/cli/pane-functions/index.ts +175 -50
  57. package/src/cli/pane-functions/report-notices.ts +10 -0
  58. package/src/cli/pane-functions/resolver.ts +11 -7
  59. package/src/cli/pane-functions/screenshot-assessment.ts +38 -10
  60. package/src/cli/pane-functions/screenshot-data-evidence.ts +7 -15
  61. package/src/cli/pane-functions/screenshot-payload.ts +36 -1
  62. package/src/cli/pane-functions/screenshot-render.ts +24 -9
  63. package/src/cli/pane-functions/screenshot-types.ts +9 -0
  64. package/src/cli/quote-answer.ts +33 -17
  65. package/src/cli/registry.ts +22 -2
  66. package/src/cli/result.ts +22 -4
  67. package/src/cli/scroll-truncation.ts +7 -2
  68. package/src/cli/series-search.ts +45 -6
  69. package/src/cli/shot-temp-dir.ts +4 -9
  70. package/src/cli/ticker-resolution.ts +1 -1
  71. package/src/cli/unreachable.ts +21 -0
  72. package/src/components/chart/composite/drawing-store.ts +11 -7
  73. package/src/components/chart/composite/format.ts +1 -0
  74. package/src/components/chart/composite/legend.tsx +48 -20
  75. package/src/components/chart/composite/panel-surface/panel-cursor.tsx +3 -3
  76. package/src/components/chart/composite/panel-surface/plot-gestures.ts +9 -2
  77. package/src/components/chart/composite/panel-surface.tsx +1 -1
  78. package/src/components/chart/composite/price-axis-labels.tsx +7 -5
  79. package/src/components/chart/composite/tools.ts +164 -39
  80. package/src/components/chart-table/header.tsx +11 -2
  81. package/src/components/chart-table/layout.ts +16 -17
  82. package/src/components/command-bar/pane-templates/items.ts +17 -1
  83. package/src/components/command-bar/routes/root/provider-search.ts +10 -1
  84. package/src/components/command-bar/routes/root/results.ts +34 -2
  85. package/src/components/command-bar/routes/root/runtime.ts +19 -4
  86. package/src/components/command-bar/routes/ticker-search/results.ts +5 -0
  87. package/src/components/command-bar/routes/ticker-search/route.ts +5 -0
  88. package/src/components/command-bar/selection-runtime.ts +29 -5
  89. package/src/components/command-bar/surface/index.tsx +4 -1
  90. package/src/components/command-bar/workflow/alert.ts +32 -13
  91. package/src/components/data-table/view.tsx +15 -2
  92. package/src/components/form-modal/content.tsx +9 -4
  93. package/src/components/index.ts +1 -1
  94. package/src/components/layout/header.tsx +9 -5
  95. package/src/components/layout/pane/capture-status.ts +6 -0
  96. package/src/components/layout/pane/footer/index.tsx +2 -0
  97. package/src/components/layout/pane/footer/model.ts +123 -17
  98. package/src/components/layout/pane/header.tsx +16 -2
  99. package/src/components/layout/pane/status-footer.ts +24 -0
  100. package/src/components/market-board/index.tsx +4 -2
  101. package/src/components/onboarding/onboarding-frame.tsx +6 -2
  102. package/src/components/onboarding/onboarding-keyboard.ts +7 -1
  103. package/src/components/onboarding/onboarding-wizard.tsx +3 -1
  104. package/src/components/onboarding/portfolio-step/positions-panel.tsx +24 -15
  105. package/src/components/onboarding/setup-cards.ts +36 -0
  106. package/src/components/onboarding/use-onboarding-progress.ts +22 -1
  107. package/src/components/onboarding/wizard-account.ts +6 -1
  108. package/src/components/onboarding/wizard-model.ts +32 -6
  109. package/src/components/onboarding/wizard-positions.ts +1 -1
  110. package/src/components/price-performance.tsx +26 -8
  111. package/src/components/reader/article-reader.tsx +12 -5
  112. package/src/components/sign-in-gate.tsx +3 -1
  113. package/src/components/toggle-list.tsx +6 -8
  114. package/src/components/ui/confirm-dialog.tsx +47 -7
  115. package/src/components/ui/data-table/opentui/index.tsx +7 -0
  116. package/src/components/ui/data-table/types.ts +8 -0
  117. package/src/components/ui/display.tsx +17 -2
  118. package/src/components/ui/index.ts +1 -1
  119. package/src/components/ui/stat-grid.tsx +4 -0
  120. package/src/components/ui/status.tsx +13 -1
  121. package/src/components/ui/table-layout.ts +34 -2
  122. package/src/components/use-pane-notice-footer.tsx +16 -3
  123. package/src/data/config/store/index.ts +31 -0
  124. package/src/data/config/store/node.ts +61 -11
  125. package/src/data/config/store/normalize.ts +4 -6
  126. package/src/data/config/store/shared-file.ts +309 -0
  127. package/src/data/profile-merge.ts +299 -0
  128. package/src/data/sqlite/checkpointer.ts +11 -1
  129. package/src/data/sqlite/database.ts +1 -1
  130. package/src/data/ticker-repository.ts +134 -10
  131. package/src/data/ticker-store.ts +67 -0
  132. package/src/data/ticker-writes.ts +5 -0
  133. package/src/i18n/es.ts +27 -0
  134. package/src/i18n/ja.ts +27 -0
  135. package/src/i18n/ko.ts +27 -0
  136. package/src/i18n/zh-cn.ts +27 -0
  137. package/src/i18n/zh-tw.ts +27 -0
  138. package/src/layout-marketplace/gallery-desktop.tsx +2 -2
  139. package/src/market-data/ah-pair.ts +122 -0
  140. package/src/market-data/coordinator/entries.ts +6 -4
  141. package/src/market-data/coordinator/index.ts +14 -3
  142. package/src/market-data/depositary-pair.ts +6 -2
  143. package/src/market-data/futures-board.ts +36 -29
  144. package/src/market-data/futures-contract.ts +37 -1
  145. package/src/market-data/hooks.tsx +33 -2
  146. package/src/market-data/market/change-basis.ts +11 -1
  147. package/src/market-data/market/header-market.ts +11 -0
  148. package/src/market-data/market/status.ts +40 -4
  149. package/src/market-data/performance.ts +127 -32
  150. package/src/market-data/quotes/time.ts +5 -2
  151. package/src/market-data/split-terms.ts +28 -0
  152. package/src/news/types.ts +28 -0
  153. package/src/notifications/app-badge.ts +2 -3
  154. package/src/notifications/app-notifier.ts +5 -0
  155. package/src/plugins/builtin/account-management/footer.ts +1 -1
  156. package/src/plugins/builtin/account-management/keyboard.ts +4 -0
  157. package/src/plugins/builtin/account-management/model.ts +1 -0
  158. package/src/plugins/builtin/account-management/pane.tsx +75 -7
  159. package/src/plugins/builtin/account-management/payment-recovery-row.tsx +12 -5
  160. package/src/plugins/builtin/account-management/pro-cancel.tsx +197 -0
  161. package/src/plugins/builtin/account-management/trial-cancel.ts +1 -1
  162. package/src/plugins/builtin/alerts/cli-move.ts +2 -2
  163. package/src/plugins/builtin/alerts/cli.ts +101 -48
  164. package/src/plugins/builtin/alerts/command.ts +39 -9
  165. package/src/plugins/builtin/alerts/constants.ts +10 -0
  166. package/src/plugins/builtin/alerts/earnings-listing.ts +20 -0
  167. package/src/plugins/builtin/alerts/event-rows.ts +9 -3
  168. package/src/plugins/builtin/alerts/events-pane.tsx +16 -10
  169. package/src/plugins/builtin/alerts/format.ts +24 -8
  170. package/src/plugins/builtin/alerts/headless.ts +12 -6
  171. package/src/plugins/builtin/alerts/index.tsx +97 -16
  172. package/src/plugins/builtin/alerts/move-checks.ts +7 -0
  173. package/src/plugins/builtin/alerts/option-contract.ts +197 -0
  174. package/src/plugins/builtin/alerts/pane.tsx +1 -1
  175. package/src/plugins/builtin/alerts/price.ts +30 -5
  176. package/src/plugins/builtin/alerts/pro-rules.ts +62 -0
  177. package/src/plugins/builtin/alerts/quotes.ts +26 -2
  178. package/src/plugins/builtin/alerts/research-builder.ts +5 -10
  179. package/src/plugins/builtin/alerts/scheduled.ts +6 -1
  180. package/src/plugins/builtin/alerts/types.ts +7 -0
  181. package/src/plugins/builtin/analytics/account-returns.ts +1 -1
  182. package/src/plugins/builtin/analytics/manual-value.ts +61 -0
  183. package/src/plugins/builtin/analytics/pane-model.ts +2 -2
  184. package/src/plugins/builtin/analytics/risk-book.ts +7 -7
  185. package/src/plugins/builtin/analytics/risk-client.ts +27 -14
  186. package/src/plugins/builtin/analytics/risk-headless.ts +13 -8
  187. package/src/plugins/builtin/analytics/risk-model.ts +92 -4
  188. package/src/plugins/builtin/analytics/risk-pane.tsx +85 -38
  189. package/src/plugins/builtin/awards/pane.tsx +1 -1
  190. package/src/plugins/builtin/broker-trading/orders.tsx +2 -2
  191. package/src/plugins/builtin/buildout/company/pane.tsx +4 -14
  192. package/src/plugins/builtin/catalysts/model.ts +2 -1
  193. package/src/plugins/builtin/central-bank-rates/model.ts +8 -2
  194. package/src/plugins/builtin/central-bank-rates/pane.tsx +5 -3
  195. package/src/plugins/builtin/chart-composer/chart-spec.ts +5 -0
  196. package/src/plugins/builtin/chart-composer/cli-options.ts +9 -5
  197. package/src/plugins/builtin/chart-composer/data-catalog-pane.tsx +2 -6
  198. package/src/plugins/builtin/chart-composer/headless-schema.ts +14 -10
  199. package/src/plugins/builtin/chart-composer/headless.ts +2 -0
  200. package/src/plugins/builtin/chart-composer/index.tsx +17 -5
  201. package/src/plugins/builtin/chart-composer/pane.tsx +19 -6
  202. package/src/plugins/builtin/chart-composer/viewport-labels.ts +2 -17
  203. package/src/plugins/builtin/chat/controller/notifications.ts +1 -0
  204. package/src/plugins/builtin/chat/index.tsx +0 -1
  205. package/src/plugins/builtin/cloud/auth-actions.tsx +11 -6
  206. package/src/plugins/builtin/cloud/company-picker.tsx +5 -3
  207. package/src/plugins/builtin/cloud/upgrade-command.ts +1 -1
  208. package/src/plugins/builtin/commodities-energy/index.tsx +1 -1
  209. package/src/plugins/builtin/company-kpis/headless.ts +10 -5
  210. package/src/plugins/builtin/company-kpis/latest.ts +45 -0
  211. package/src/plugins/builtin/company-kpis/model.ts +57 -15
  212. package/src/plugins/builtin/company-kpis/pane.tsx +22 -8
  213. package/src/plugins/builtin/composite/alt-data.ts +20 -0
  214. package/src/plugins/builtin/composite/application.ts +14 -0
  215. package/src/plugins/builtin/composite/broker.ts +12 -0
  216. package/src/plugins/builtin/composite/credit.ts +33 -0
  217. package/src/plugins/builtin/composite/crypto.ts +10 -0
  218. package/src/plugins/builtin/composite/earnings.ts +12 -0
  219. package/src/plugins/builtin/composite/filings.ts +13 -0
  220. package/src/plugins/builtin/composite/futures-commodities.ts +23 -0
  221. package/src/plugins/builtin/composite/global-markets.ts +12 -0
  222. package/src/plugins/builtin/composite/options-volatility.ts +23 -0
  223. package/src/plugins/builtin/composite/ownership.ts +23 -0
  224. package/src/plugins/builtin/composite/portfolio.ts +10 -0
  225. package/src/plugins/builtin/composite/quant.ts +15 -0
  226. package/src/plugins/builtin/composite/rates-macro.ts +30 -0
  227. package/src/plugins/builtin/composite/screeners.ts +11 -0
  228. package/src/plugins/builtin/composite/shared.ts +11 -0
  229. package/src/plugins/builtin/composite/ticker-core.ts +36 -0
  230. package/src/plugins/builtin/congress-trades/headless.ts +31 -3
  231. package/src/plugins/builtin/congress-trades/model.ts +9 -5
  232. package/src/plugins/builtin/correlation/index.tsx +13 -17
  233. package/src/plugins/builtin/correlation/matrix/model.ts +18 -0
  234. package/src/plugins/builtin/cot/client.ts +2 -3
  235. package/src/plugins/builtin/cot/headless.ts +16 -16
  236. package/src/plugins/builtin/cot/index.tsx +6 -6
  237. package/src/plugins/builtin/cot/model.ts +25 -5
  238. package/src/plugins/builtin/cot/pane.tsx +11 -6
  239. package/src/plugins/builtin/cot/series.ts +11 -8
  240. package/src/plugins/builtin/cpi/model.ts +15 -4
  241. package/src/plugins/builtin/cpi/pane.tsx +29 -7
  242. package/src/plugins/builtin/dividend-yield/client.ts +57 -16
  243. package/src/plugins/builtin/dividend-yield/headless.ts +17 -11
  244. package/src/plugins/builtin/dividend-yield/model.ts +4 -3
  245. package/src/plugins/builtin/dividend-yield/pane.tsx +22 -18
  246. package/src/plugins/builtin/dividend-yield/ranking.ts +1 -1
  247. package/src/plugins/builtin/dividend-yield/types.ts +4 -0
  248. package/src/plugins/builtin/dividend-yield/view.ts +23 -12
  249. package/src/plugins/builtin/doe/model.ts +30 -0
  250. package/src/plugins/builtin/doe/pane.tsx +8 -2
  251. package/src/plugins/builtin/earnings/board-table.ts +9 -4
  252. package/src/plugins/builtin/earnings/fiscal-quarter.ts +39 -0
  253. package/src/plugins/builtin/earnings/headless.ts +16 -6
  254. package/src/plugins/builtin/earnings/history-model.ts +6 -4
  255. package/src/plugins/builtin/earnings/history-table.ts +7 -4
  256. package/src/plugins/builtin/earnings-calls/calendar.tsx +4 -3
  257. package/src/plugins/builtin/earnings-calls/pane.tsx +8 -2
  258. package/src/plugins/builtin/earnings-ripple/pane.tsx +2 -2
  259. package/src/plugins/builtin/econ/calendar-model.ts +16 -0
  260. package/src/plugins/builtin/econ/index.tsx +7 -2
  261. package/src/plugins/builtin/equity-screener/headless.ts +4 -1
  262. package/src/plugins/builtin/equity-screener/model.ts +7 -6
  263. package/src/plugins/builtin/estimate-revisions/headless.ts +1 -1
  264. package/src/plugins/builtin/exposure/model.ts +10 -0
  265. package/src/plugins/builtin/exposure/pane.tsx +10 -3
  266. package/src/plugins/builtin/futures/model.ts +14 -1
  267. package/src/plugins/builtin/futures/series.ts +1 -8
  268. package/src/plugins/builtin/fx-matrix/amount.ts +15 -1
  269. package/src/plugins/builtin/fx-matrix/headless.ts +12 -6
  270. package/src/plugins/builtin/fx-matrix/index.tsx +25 -7
  271. package/src/plugins/builtin/fx-matrix/settings.ts +9 -4
  272. package/src/plugins/builtin/insider/detail.tsx +36 -7
  273. package/src/plugins/builtin/insider/filing-stories.ts +110 -0
  274. package/src/plugins/builtin/insider/headless.ts +37 -2
  275. package/src/plugins/builtin/insider/index.tsx +79 -10
  276. package/src/plugins/builtin/insider/model.ts +43 -5
  277. package/src/plugins/builtin/ipo-calendar/client.ts +11 -1
  278. package/src/plugins/builtin/ipo-calendar/model.ts +3 -7
  279. package/src/plugins/builtin/jobs/headless.ts +2 -1
  280. package/src/plugins/builtin/jobs/model.ts +6 -0
  281. package/src/plugins/builtin/jobs/pane.tsx +8 -3
  282. package/src/plugins/builtin/kelly-sizer/pane.tsx +9 -4
  283. package/src/plugins/builtin/market-valuation/pane.tsx +22 -10
  284. package/src/plugins/builtin/mna/detail.tsx +67 -6
  285. package/src/plugins/builtin/mna/headless.ts +128 -13
  286. package/src/plugins/builtin/mna/model.ts +219 -16
  287. package/src/plugins/builtin/mna/pane.tsx +34 -6
  288. package/src/plugins/builtin/money-markets/model.ts +14 -5
  289. package/src/plugins/builtin/money-markets/pane.tsx +4 -3
  290. package/src/plugins/builtin/news/wire/news/detail-view.tsx +118 -10
  291. package/src/plugins/builtin/news/wire/news/footer.ts +3 -8
  292. package/src/plugins/builtin/news/wire/news/story-evidence.ts +178 -0
  293. package/src/plugins/builtin/options/analytics.ts +1 -1
  294. package/src/plugins/builtin/options/view.tsx +18 -11
  295. package/src/plugins/builtin/options-positioning/model.ts +11 -0
  296. package/src/plugins/builtin/options-positioning/pane.tsx +22 -1
  297. package/src/plugins/builtin/options-scenario/client.ts +49 -8
  298. package/src/plugins/builtin/options-scenario/csp-screen-pane.tsx +22 -6
  299. package/src/plugins/builtin/options-scenario/csp-screen.ts +39 -12
  300. package/src/plugins/builtin/options-scenario/headless.ts +7 -3
  301. package/src/plugins/builtin/options-scenario/model.ts +33 -2
  302. package/src/plugins/builtin/options-scenario/pane.tsx +3 -4
  303. package/src/plugins/builtin/options-scenario/strategy-screen.ts +7 -5
  304. package/src/plugins/builtin/pe-band/client.ts +13 -1
  305. package/src/plugins/builtin/pe-band/headless.ts +2 -2
  306. package/src/plugins/builtin/pe-band/model.ts +63 -10
  307. package/src/plugins/builtin/pe-band/pane.tsx +5 -5
  308. package/src/plugins/builtin/perps/cascade.ts +4 -3
  309. package/src/plugins/builtin/perps/markets-section.tsx +5 -2
  310. package/src/plugins/builtin/perps/model.ts +4 -3
  311. package/src/plugins/builtin/portfolio-list/allocation-rows.ts +26 -7
  312. package/src/plugins/builtin/portfolio-list/cli/portfolio-command.ts +66 -13
  313. package/src/plugins/builtin/portfolio-list/cli/render.ts +76 -33
  314. package/src/plugins/builtin/portfolio-list/headless.ts +69 -22
  315. package/src/plugins/builtin/portfolio-list/pane/data.ts +3 -3
  316. package/src/plugins/builtin/portfolio-list/pane/index.tsx +29 -14
  317. package/src/plugins/builtin/portfolio-list/summary/index.tsx +2 -2
  318. package/src/plugins/builtin/portfolio-list/table.tsx +3 -2
  319. package/src/plugins/builtin/relative-rotation/pane.tsx +2 -3
  320. package/src/plugins/builtin/research/corporate-actions-pane.tsx +33 -14
  321. package/src/plugins/builtin/research/event-model.ts +43 -19
  322. package/src/plugins/builtin/research/headless.ts +8 -1
  323. package/src/plugins/builtin/research/relative-valuation-pane.tsx +19 -17
  324. package/src/plugins/builtin/research-search/index.tsx +3 -1
  325. package/src/plugins/builtin/scanner/denied.tsx +16 -4
  326. package/src/plugins/builtin/scanner/flow-pane.tsx +1 -1
  327. package/src/plugins/builtin/scanner/hilo-pane.tsx +1 -1
  328. package/src/plugins/builtin/sec/filing-display.tsx +14 -2
  329. package/src/plugins/builtin/sec/headless.ts +42 -4
  330. package/src/plugins/builtin/sec/index.tsx +21 -1
  331. package/src/plugins/builtin/sectors/index.tsx +6 -9
  332. package/src/plugins/builtin/sectors/sector-model.ts +1 -1
  333. package/src/plugins/builtin/shared/cloud-upgrade.ts +1 -1
  334. package/src/plugins/builtin/shared/earnings-report.ts +49 -5
  335. package/src/plugins/builtin/shared/options-pro-copy.ts +34 -0
  336. package/src/plugins/builtin/shared/report-freshness.ts +2 -3
  337. package/src/plugins/builtin/shared/statement-currency.ts +23 -0
  338. package/src/plugins/builtin/shared/ticker-surface.ts +1 -1
  339. package/src/plugins/builtin/supply-chain/client.ts +34 -9
  340. package/src/plugins/builtin/supply-chain/evidence.ts +3 -2
  341. package/src/plugins/builtin/supply-chain/flow.tsx +4 -3
  342. package/src/plugins/builtin/supply-chain/graph-model.ts +14 -7
  343. package/src/plugins/builtin/supply-chain/graph-pane.tsx +3 -1
  344. package/src/plugins/builtin/supply-chain/graph.tsx +6 -3
  345. package/src/plugins/builtin/supply-chain/headless.ts +19 -4
  346. package/src/plugins/builtin/supply-chain/model.ts +50 -6
  347. package/src/plugins/builtin/supply-chain/pane.tsx +79 -18
  348. package/src/plugins/builtin/themes/headless.ts +4 -4
  349. package/src/plugins/builtin/themes/model.ts +11 -8
  350. package/src/plugins/builtin/themes/pane.tsx +2 -2
  351. package/src/plugins/builtin/ticker-detail/adr-pair/ah.ts +62 -0
  352. package/src/plugins/builtin/ticker-detail/adr-pair/headless.ts +119 -20
  353. package/src/plugins/builtin/ticker-detail/adr-pair/model.ts +51 -1
  354. package/src/plugins/builtin/ticker-detail/adr-pair/tab.tsx +25 -14
  355. package/src/plugins/builtin/ticker-detail/financials/model.ts +22 -32
  356. package/src/plugins/builtin/ticker-detail/financials/tab.tsx +7 -9
  357. package/src/plugins/builtin/ticker-detail/headless-schema.ts +2 -0
  358. package/src/plugins/builtin/ticker-detail/headless.ts +28 -12
  359. package/src/plugins/builtin/ticker-detail/overview/board-lot.ts +21 -0
  360. package/src/plugins/builtin/ticker-detail/overview/model.ts +28 -2
  361. package/src/plugins/builtin/ticker-detail/overview/pane.tsx +8 -0
  362. package/src/plugins/builtin/ticker-detail/overview-tab.tsx +68 -13
  363. package/src/plugins/builtin/ticker-detail/quote-monitor/card.tsx +9 -2
  364. package/src/plugins/builtin/ticker-detail/quote-monitor/index.tsx +5 -2
  365. package/src/plugins/builtin/volatility/model.ts +17 -0
  366. package/src/plugins/builtin/volatility/pane.tsx +16 -7
  367. package/src/plugins/builtin/world-indices/index.tsx +2 -0
  368. package/src/plugins/builtin/world-indices/table.tsx +15 -0
  369. package/src/plugins/builtin/world-venue-map/evidence.ts +3 -2
  370. package/src/plugins/builtin/world-venue-map/headless.ts +32 -18
  371. package/src/plugins/builtin/world-venue-map/index.ts +19 -6
  372. package/src/plugins/builtin/world-venue-map/layered-pane.tsx +9 -5
  373. package/src/plugins/builtin/world-venue-map/layers.ts +33 -11
  374. package/src/plugins/builtin/world-venue-map/map.tsx +12 -0
  375. package/src/plugins/builtin/world-venue-map/model.ts +6 -1
  376. package/src/plugins/builtin/world-venue-map/pane.tsx +35 -6
  377. package/src/plugins/builtin/world-venue-map/place.ts +119 -0
  378. package/src/plugins/builtin/world-venue-map/venue-header.tsx +5 -3
  379. package/src/plugins/catalog-browser.ts +10 -1
  380. package/src/plugins/catalog-data.ts +20 -0
  381. package/src/plugins/catalog-lazy.ts +51 -0
  382. package/src/plugins/catalog-ui.ts +16 -18
  383. package/src/plugins/host-smoke.ts +5 -2
  384. package/src/portfolio/allocation.ts +79 -19
  385. package/src/portfolio/cash-balances.ts +76 -0
  386. package/src/portfolio/mutations.ts +43 -8
  387. package/src/public/__snapshots__/public-api.test.ts.snap +1 -0
  388. package/src/renderers/browser/activity.ts +16 -0
  389. package/src/renderers/browser/app-badge-host.ts +14 -0
  390. package/src/renderers/browser/main.tsx +5 -0
  391. package/src/renderers/browser/notifications.ts +103 -0
  392. package/src/renderers/browser/ui-host.tsx +4 -0
  393. package/src/renderers/desktop/window-layouts.ts +14 -0
  394. package/src/renderers/dom/data-table/index.tsx +27 -4
  395. package/src/renderers/dom/data-table/row.tsx +2 -0
  396. package/src/renderers/dom/host/tabs.tsx +57 -8
  397. package/src/renderers/dom/styles.css +13 -5
  398. package/src/renderers/electrobun/bun/desktop/backend-requests.ts +4 -0
  399. package/src/renderers/electrobun/bun/desktop/backend.ts +22 -1
  400. package/src/renderers/electrobun/bun/window/native-min-size.ts +6 -1
  401. package/src/renderers/electrobun/shared/protocol.ts +4 -0
  402. package/src/renderers/electrobun/view/cli-pane-shot-frame.tsx +50 -12
  403. package/src/renderers/electrobun/view/http-fetch.ts +3 -2
  404. package/src/renderers/electrobun/view/remote/ticker-repository.ts +10 -0
  405. package/src/series/standalone-catalog.ts +5 -4
  406. package/src/series/standalone.ts +13 -7
  407. package/src/sources/gloomberb-cloud/index.ts +22 -9
  408. package/src/sources/gloomberb-cloud/news.ts +35 -0
  409. package/src/sources/gloomberb-cloud/perpetuals.ts +60 -3
  410. package/src/sources/provider-errors.ts +34 -7
  411. package/src/sources/provider-router/financials.ts +20 -13
  412. package/src/sources/provider-router/history.ts +32 -6
  413. package/src/sources/provider-router/index.ts +4 -0
  414. package/src/sources/provider-router/search.ts +1 -0
  415. package/src/sync/collections-contributor.ts +3 -1
  416. package/src/sync/config-merge.ts +10 -1
  417. package/src/sync/sanitize.ts +26 -2
  418. package/src/tickers/company-name-listing.ts +16 -2
  419. package/src/tickers/listing-fate.ts +12 -8
  420. package/src/tickers/renamed-listings.ts +43 -10
  421. package/src/tickers/search/home-listing.ts +28 -0
  422. package/src/tickers/search/index.ts +19 -7
  423. package/src/tickers/terminal-codes.ts +11 -1
  424. package/src/time-series/base-series.ts +39 -6
  425. package/src/time-series/chart-seed.ts +2 -2
  426. package/src/time-series/history-quality.ts +4 -1
  427. package/src/time-series/hooks.ts +2 -0
  428. package/src/time-series/price-comparison.ts +17 -23
  429. package/src/time-series/reporting.ts +1 -1
  430. package/src/time-series/resolution.ts +13 -0
  431. package/src/time-series/resolve-context.ts +6 -0
  432. package/src/time-series/resolve.ts +42 -3
  433. package/src/time-series/spec.ts +2 -2
  434. package/src/time-series/types.ts +3 -2
  435. package/src/types/data-provider.ts +11 -0
  436. package/src/types/financials.ts +48 -4
  437. package/src/types/headless.ts +1 -0
  438. package/src/types/issuer-listings.ts +2 -0
  439. package/src/types/plugin-notifications.ts +3 -0
  440. package/src/types/price-history.ts +6 -4
  441. package/src/types/ticker.ts +10 -2
  442. package/src/ui/host.tsx +2 -0
  443. package/src/utils/cli-output.ts +1 -1
  444. package/src/utils/declared-dividends.ts +13 -1
  445. package/src/utils/dividend-cash.ts +5 -1
  446. package/src/utils/exchange-announcements.ts +7 -2
  447. package/src/utils/forward-dividend.ts +4 -3
  448. package/src/utils/fundamentals.ts +40 -0
  449. package/src/utils/network-failure.ts +2 -0
  450. package/src/utils/price-history-integrity.ts +9 -1
  451. package/src/utils/remove-folder.ts +37 -0
  452. package/src/utils/trailing-dividend.ts +1 -1
  453. package/src/plugins/builtin/composite-plugins.ts +0 -285
@@ -1,14 +1,30 @@
1
1
  import { metricFormInput, metricShortcut, parseMetricAlert } from "./metric-command";
2
2
  import { isRelativeMetric, type AlertMetric } from "./metric-model";
3
3
  import type { AlertCondition } from "./types";
4
- import { isPenceLevel, readAlertLevel, readAlertPrice } from "./price";
4
+ import { isPenceLevel, parseAlertPrice, readAlertLevel, readAlertPrice } from "./price";
5
5
  import { normalizeAlertSymbol } from "./quotes";
6
6
  import { moveCondition, parseMovePercent } from "./move";
7
+ import type { WizardStep } from "../../../types/plugin";
8
+
9
+ /** Add Alert's kind for a move from the previous close, beside a price level. */
10
+ export const MOVE_KIND_CHOICE = { value: "move", label: "Move from previous close" };
11
+
12
+ /** The move kind's fields: which way, and how far in percent, as `alerts add QQQ moves 5%` names them. */
13
+ export const moveWizardFields: WizardStep[] = [
14
+ { key: "move:condition", label: "Direction", type: "select", defaultValue: "crosses", dependsOn: { key: "kind", value: "move" },
15
+ options: [{ label: "Either way", value: "crosses" }, { label: "Up", value: "above" }, { label: "Down", value: "below" }] },
16
+ { key: "move:percent", label: "Move (%)", type: "number", placeholder: "3", dependsOn: { key: "kind", value: "move" } },
17
+ ];
18
+
19
+ const MOVE_PERCENT_RULE = "A move is a percent from the previous close, above 0 and up to 100";
7
20
 
8
21
  export interface AlertCommandInput {
9
22
  symbol: string;
10
23
  condition: AlertCondition;
24
+ /** The level, or for a move (`move`) the percent from the previous close. */
11
25
  price: number;
26
+ /** A move from the previous close (`QQQ moves 5%`): `condition` is either way (crosses), up (above) or down (below). */
27
+ move?: true;
12
28
  /** Typed in pence (`70p`): `price` is in pounds, for a London line quoted in pence. */
13
29
  pence?: true;
14
30
  metric?: AlertMetric;
@@ -47,7 +63,9 @@ export function parseAlertShortcutValues(
47
63
  const activeTicker = normalizeAlertSymbol(context?.activeTicker);
48
64
  return activeTicker ? { symbol: activeTicker } : {};
49
65
  }
50
- if (parts.length > 3) {
66
+ // The price is the rest of the line, as one: `$ 757.75`, `1 000.50` and `757.75 USD` read as `alerts add` reads them quoted.
67
+ const priceText = parts.slice(2).join(" ");
68
+ if (parts.length > 3 && !isPenceLevel(priceText) && parseAlertPrice(priceText).kind === "invalid") {
51
69
  throw new Error("Use SA SYMBOL above|below|crosses PRICE.");
52
70
  }
53
71
 
@@ -57,9 +75,12 @@ export function parseAlertShortcutValues(
57
75
 
58
76
  if (parts[1]) {
59
77
  const condition = parseAlertCondition(parts[1]);
60
- // A move from the previous close is added where its delivery can be said: `alerts add`.
61
- if (!condition && moveCondition(parts[1])) {
62
- throw new Error(`Add a move alert with gloom alerts add ${values.symbol} ${parts[1].toLowerCase()} ${parts[2] ?? "0.5%"}.`);
78
+ // A move from the previous close, as `alerts add` takes it: `QQQ moves 5%`, `QQQ up 3`, `QQQ down 2%`.
79
+ const move = condition ? null : moveCondition(parts[1]);
80
+ if (move) {
81
+ const typed = parts.slice(2).join(" ");
82
+ if (typed && parseMovePercent(typed) == null) throw new Error(`${MOVE_PERCENT_RULE}, not "${typed}".`);
83
+ return { ...values, kind: "move", "move:condition": move, ...typed ? { "move:percent": String(parseMovePercent(typed)) } : {} };
63
84
  }
64
85
  if (!condition) {
65
86
  throw new Error("Use above, below, crosses, >, <, or x.");
@@ -67,9 +88,9 @@ export function parseAlertShortcutValues(
67
88
  values.condition = condition;
68
89
  }
69
90
 
70
- // The price reads as `alerts add` reads it: 81k is 81000, 81,000 asks which was meant, and text that is no number says what to type.
71
- // `70p`, pence on a London line, stays as typed for the add to hold to its line.
72
- if (parts[2]) values.price = isPenceLevel(parts[2]) ? (readAlertLevel(parts[2]), parts[2].trim()) : String(readAlertPrice(parts[2].replace(/^\$/, "")));
91
+ // The price reads as `alerts add` reads it: 81k is 81000, 81,000 asks which was meant ($81,000 does not), and text that is no
92
+ // number says what to type. `70p`, pence on a London line, stays as typed for the add to hold to its line.
93
+ if (priceText) values.price = isPenceLevel(priceText) ? (readAlertLevel(priceText), priceText.trim()) : String(readAlertPrice(priceText));
73
94
 
74
95
  return values;
75
96
  }
@@ -86,13 +107,22 @@ export function parseAlertCommandValues(
86
107
  };
87
108
  }
88
109
 
110
+ if (values?.kind === "move") {
111
+ const symbol = values.symbol?.trim().toUpperCase();
112
+ const condition = parseAlertCondition(values["move:condition"]) ?? "crosses";
113
+ const typed = values["move:percent"]?.trim();
114
+ if (!symbol || !typed) return null;
115
+ const percent = parseMovePercent(typed);
116
+ if (percent == null) throw new Error(`${MOVE_PERCENT_RULE}, not "${typed}".`);
117
+ return { symbol, condition, price: percent, move: true };
118
+ }
89
119
  const metric = values ? metricFormInput(values) : null;
90
120
  if (metric) return metric;
91
121
  const symbol = values?.symbol?.trim().toUpperCase();
92
122
  const condition = parseAlertCondition(values?.condition);
93
123
  const priceStr = values?.price?.trim();
94
124
  if (!symbol || !condition || !priceStr) return null;
95
- return { symbol, condition, ...readAlertLevel(priceStr.replace(/^\$/, "")) };
125
+ return { symbol, condition, ...readAlertLevel(priceStr) };
96
126
  }
97
127
 
98
128
  /** A move rule's edit read: `GBPUSD=X moves 0.5%`, `HSBA:LSE down 3`, as `alerts add` takes it. Null for another form. */
@@ -10,3 +10,13 @@ export const ALERT_TABS = [
10
10
  /** Fallback cadence when the pane's Check interval setting is unset. */
11
11
  export const POLL_INTERVAL_MS = 30_000;
12
12
  export const POLL_SECONDS_KEY = "pollSeconds";
13
+
14
+ /**
15
+ * What delivers a price alert, as docs/usage.md states it: the app checks it on
16
+ * every tick while it runs. Signed in with Cloud sync on, Gloom Cloud also
17
+ * pushes the trigger to a registered phone, and emails it once no app has
18
+ * synced the account for a while, so a rule the app has synced reaches you
19
+ * with the app closed. Signed out, only the running app does. `alerts add`
20
+ * and Add Alert both say it.
21
+ */
22
+ export const PRICE_DELIVERY = "the app alerts while it is running; sign in with Cloud sync for email or phone alerts when it is closed";
@@ -0,0 +1,20 @@
1
+ import { resolveAlertListing, type AlertListingOptions } from "../../../cli/alert-listing";
2
+ import type { ListingDeps } from "../../../cli/listing-arg";
3
+ import { canonicalExchange, isUsListingExchange } from "../../../utils/exchanges";
4
+
5
+ /**
6
+ * The venue of a bare symbol an earnings alert is asked for, read as every
7
+ * alert reads its symbol (`resolveAlertListing`): D05 and "Singtel" are on
8
+ * SGX, which earnings alerts do not follow, so they get the line any listing
9
+ * outside the US gets. A US listing comes back without a venue, as typed.
10
+ * Throws `AlertListingRefusal` for a symbol no alert can follow.
11
+ */
12
+ export async function earningsListingVenue(
13
+ typed: string,
14
+ deps: ListingDeps,
15
+ options: AlertListingOptions = {},
16
+ ): Promise<{ symbol: string; exchange: string | null; notes: string[] }> {
17
+ const { listing, quote, notes } = await resolveAlertListing(typed, null, deps, options);
18
+ const venue = canonicalExchange(listing.exchange || quote.listingExchangeName || quote.exchangeName || "");
19
+ return { symbol: listing.symbol, exchange: venue && !isUsListingExchange(venue) ? venue : null, notes };
20
+ }
@@ -1,6 +1,7 @@
1
1
  import { eventAlertTarget, releaseTimeOn, type EventAlertRule } from "./events";
2
2
  import { timeZoneCity, zonedClock } from "../../../utils/utc-time";
3
3
  import { readScheduledRule, scheduledAlertStatus, scheduledToday } from "./scheduled";
4
+ import { checkedOnlyWithPro } from "./pro-rules";
4
5
 
5
6
  /**
6
7
  * Earnings, macro and calendar event rules name the event day they wait for,
@@ -40,16 +41,21 @@ export function needsSignInNote(count: number): string {
40
41
  + "Open the app (gloom) and log in or sign up free from the command bar (Ctrl+P, Log In or Sign Up).";
41
42
  }
42
43
 
44
+ /** The words a rule's state is written in on the Events tab. */
45
+ export type RuleState = "Active" | "Paused" | "Alerted" | "Needs sign-in" | "Needs Pro";
46
+
43
47
  /**
44
48
  * The state word the Events tab shows: a scheduled rule is Alerted once it has gone off for its coming
45
- * event, an IV level once its level was reached, until it is re-armed. Signed out, a waiting rule only a
46
- * signed-in account gets checked needs sign-in.
49
+ * event, an IV level once its level was reached, until it is re-armed. A waiting Pro rule (options flow, an
50
+ * IV spike) needs Pro without an account that has it (`pro`), signed out too: a free sign-in would not
51
+ * arm it. Signed out, any other waiting rule only a signed-in account gets checked needs sign-in.
47
52
  */
48
- export function ruleState(rule: EventAlertRule, now: number = Date.now(), signedIn = true): "Active" | "Paused" | "Alerted" | "Needs sign-in" {
53
+ export function ruleState(rule: EventAlertRule, now: number = Date.now(), signedIn = true, pro = signedIn): RuleState {
49
54
  const scheduled = readScheduledRule(rule);
50
55
  const status = scheduled ? scheduledAlertStatus(rule, scheduled.leadDays, scheduledToday(scheduled.target, now), scheduled.trigger)
51
56
  : rule.status === "active" && rule.kind === "iv_level" && rule.triggeredAt ? "triggered" : rule.status;
52
57
  if (status === "paused") return "Paused";
53
58
  if (status === "triggered") return "Alerted";
59
+ if (!pro && checkedOnlyWithPro(rule)) return "Needs Pro";
54
60
  return !signedIn && checkedWhenSignedIn(rule) ? "Needs sign-in" : "Active";
55
61
  }
@@ -26,7 +26,8 @@ import {
26
26
  updateEventAlerts,
27
27
  type EventAlertRule,
28
28
  } from "./events";
29
- import { ruleState, ruleTarget } from "./event-rows";
29
+ import { ruleState, ruleTarget, type RuleState } from "./event-rows";
30
+ import { checksProRules, proRuleStatus } from "./pro-rules";
30
31
  import { relativeTime } from "./format";
31
32
  import { alertKindLabel, fetchAlertHistory, ruleStateText } from "./history";
32
33
  import { isResearchAlertKind } from "./research-rules";
@@ -42,14 +43,14 @@ import { alertTarget, alertViewHints, eventRuleSubject, useOpenAlertTarget } fro
42
43
  import { FIRED_LOG_KEY } from "./fired-log";
43
44
  import { withAlertChange } from "./alert-log";
44
45
 
45
- const columnsFor = (width: number, lastCheck: boolean, needsSignIn: boolean): DataTableColumn[] => [
46
+ const columnsFor = (width: number, lastCheck: boolean, waiting: RuleState | null): DataTableColumn[] => [
46
47
  { id: "kind", label: "Event", width: 15, align: "left" },
47
48
  { id: "target", label: "Following", width: 28, flexGrow: 1, align: "left" },
48
49
  ...(lastCheck && width >= 96
49
50
  ? [{ id: "last", label: "Last check", width: 34, align: "left" as const }]
50
51
  : []),
51
- // Wide enough to say "Needs sign-in" only when a row does.
52
- { id: "status", label: "State", width: needsSignIn ? 13 : 8, align: "left" },
52
+ // Wide enough to say "Needs sign-in" or "Needs Pro" only when a row does.
53
+ { id: "status", label: "State", width: Math.max(8, waiting?.length ?? 0), align: "left" },
53
54
  { id: "created", label: "Since", width: 10, align: "left" },
54
55
  ];
55
56
 
@@ -108,7 +109,10 @@ export function EventAlertsPane({ focused, width, height }: PaneProps) {
108
109
  const access = usePlanAccess();
109
110
  // A saved session counts before its account has loaded, so a signed-in start does not flash "Needs sign-in".
110
111
  const signedIn = access.signedIn || !!apiClient.getSessionToken();
111
- const needsSignIn = !signedIn && rules.some((rule) => ruleState(rule, now, false) === "Needs sign-in");
112
+ // Options flow and an IV spike are checked only with Pro: a free account, signed in or not, waits on Pro.
113
+ const pro = checksProRules(signedIn, apiClient.getCurrentUser());
114
+ const shownStates = new Set(rules.map((rule) => ruleState(rule, now, signedIn, pro)));
115
+ const waiting: RuleState | null = shownStates.has("Needs sign-in") ? "Needs sign-in" : shownStates.has("Needs Pro") ? "Needs Pro" : null;
112
116
  const openTarget = useOpenAlertTarget();
113
117
  const selectedTarget = useMemo(() => selectedRule ? alertTarget(eventRuleSubject(selectedRule)) : null, [selectedRule]);
114
118
  const session = useResearchCloudSession();
@@ -120,7 +124,7 @@ export function EventAlertsPane({ focused, width, height }: PaneProps) {
120
124
  [history.data],
121
125
  );
122
126
  // An IV level is read by this app, so its last reading needs no session.
123
- const columns = columnsFor(width, (hasResearch && !!history.data) || rules.some((rule) => rule.kind === "iv_level"), needsSignIn);
127
+ const columns = columnsFor(width, (hasResearch && !!history.data) || rules.some((rule) => rule.kind === "iv_level"), waiting);
124
128
  const add = useCallback(
125
129
  () => openPluginCommandWorkflow("set-event-alert"),
126
130
  [openPluginCommandWorkflow],
@@ -167,6 +171,8 @@ export function EventAlertsPane({ focused, width, height }: PaneProps) {
167
171
  const status =
168
172
  error ??
169
173
  (selectedRule?.kind === "catalyst" ? catalystStatus : null) ??
174
+ // A Pro rule nothing checks says so while it is selected, and what is free beside it.
175
+ (selectedRule && ruleState(selectedRule, now, signedIn, pro) === "Needs Pro" ? proRuleStatus(selectedRule) : null) ??
170
176
  sync.error ??
171
177
  (sync.phase === "disabled"
172
178
  ? "Cloud sync disabled"
@@ -227,9 +233,9 @@ export function EventAlertsPane({ focused, width, height }: PaneProps) {
227
233
  // An IV level that could not be read says so on its own row: No data in State, the reason in Last check.
228
234
  const check = rule.kind === "iv_level" ? checks[rule.id] : undefined;
229
235
  const unread = rule.kind === "iv_level" && rule.status === "active" && !rule.triggeredAt && check?.value === null;
230
- const state = ruleState(rule, now, signedIn);
231
- // A rule nothing checks while signed out says so in its State, in the warning tone.
232
- const waiting = state === "Needs sign-in" && column.id === "status";
236
+ const state = ruleState(rule, now, signedIn, pro);
237
+ // A rule nothing checks while signed out, or without Pro, says so in its State, in the warning tone.
238
+ const waits = (state === "Needs sign-in" || state === "Needs Pro") && column.id === "status";
233
239
  return {
234
240
  text:
235
241
  column.id === "kind"
@@ -249,7 +255,7 @@ export function EventAlertsPane({ focused, width, height }: PaneProps) {
249
255
  ? colors.selectedText
250
256
  : unread && (column.id === "status" || column.id === "last")
251
257
  ? colors.negative
252
- : waiting
258
+ : waits
253
259
  ? colors.warning
254
260
  : rule.status === "paused"
255
261
  ? colors.textMuted
@@ -2,6 +2,8 @@ import { MISSING_VALUE } from "../../../utils/format";
2
2
  import { closeBasis, metricName, metricReadingText, rotationQuadrant } from "./metric-model";
3
3
  import { moveBasisText, movePercentText, moveTargetText, moveTriggerLabel } from "./move";
4
4
  import { formatMarketPrice } from "../../../market-data/market/format";
5
+ import { EXTENDED_PRINT_WORDS } from "../../../market-data/market/change-basis";
6
+ import { EXTENDED_SESSION_MARKS } from "../../../market-data/market/status";
5
7
  import { formatShortDate } from "../../../utils/datetime-format";
6
8
  import { formatQuoteAgeWithSource } from "../../../market-data/quotes/time";
7
9
  import { alertListingKey, alertPriceText } from "./price-text";
@@ -27,7 +29,12 @@ export function relativeTime(ts: number): string {
27
29
  /** A price ratio to four decimals, as GR states the latest ratio. */
28
30
  const formatRatio = (value: number) => value.toFixed(Math.abs(value) >= 100 ? 2 : 4);
29
31
 
30
- export function formatCurrentPrice(alert: AlertRule, maxWidth = 9): string {
32
+ /**
33
+ * The current reading in a cell: an after-hours, pre-market or overnight
34
+ * print marked before it as the portfolio marks a price (AH 158.78), or in
35
+ * words after it where there is room to say it (`words`: 158.78 after hours).
36
+ */
37
+ export function formatCurrentPrice(alert: AlertRule, maxWidth = 9, { words = false }: { words?: boolean } = {}): string {
31
38
  if (alert.lastCheckError) return !alert.metric ? "No quote"
32
39
  : /US listing|US equities|calendar/.test(alert.lastCheckError) ? "US only"
33
40
  : /missing|bars|history|weekly closes/i.test(alert.lastCheckError) ? "Bar gap" : "No data";
@@ -35,10 +42,19 @@ export function formatCurrentPrice(alert: AlertRule, maxWidth = 9): string {
35
42
  if (alert.metric?.kind === "rrg") return rotationQuadrant(alert.lastCheckedPrice, alert.lastCheckedTarget) ?? MISSING_VALUE;
36
43
  if (alert.metric?.kind === "rs_ratio" && alert.lastCheckedPrice != null) return formatRatio(alert.lastCheckedPrice);
37
44
  if (alert.lastCheckedPrice == null) return MISSING_VALUE;
38
- // A move rule reads the day's move: -0.38%.
39
- if (alert.move) return movePercentText(alert.lastCheckedPrice);
40
- // A price at its instrument's precision (1.34032 on GBP/USD, 117.35p on a London line), as `quote` prints it.
41
- return alert.metric ? formatMarketPrice(alert.lastCheckedPrice, { maxWidth, minimumFractionDigits: 2 }) : alertPriceText(alert, alert.lastCheckedPrice, maxWidth);
45
+ const session = alert.metric ? undefined : alert.lastQuoteSession;
46
+ const mark = session && !words ? `${EXTENDED_SESSION_MARKS[session]} ` : "";
47
+ // A move rule reads the day's move: -0.38%. A price at its instrument's precision (1.34032 on GBP/USD, 117.35p
48
+ // on a London line), as `quote` prints it.
49
+ const figure = alert.move ? movePercentText(alert.lastCheckedPrice)
50
+ : alert.metric ? formatMarketPrice(alert.lastCheckedPrice, { maxWidth, minimumFractionDigits: 2 })
51
+ : alertPriceText(alert, alert.lastCheckedPrice, Math.max(1, maxWidth - mark.length));
52
+ return session && words ? `${figure} ${EXTENDED_PRINT_WORDS[session]}` : `${mark}${figure}`;
53
+ }
54
+
55
+ /** " after hours" after a reading that is an extended session's print; nothing for the regular session's. */
56
+ export function readingSessionWords(alert: Pick<AlertRule, "lastQuoteSession" | "metric">): string {
57
+ return alert.lastQuoteSession && !alert.metric ? ` ${EXTENDED_PRINT_WORDS[alert.lastQuoteSession]}` : "";
42
58
  }
43
59
 
44
60
  export function formatAlertTargetPrice(alert: AlertRule, maxWidth = 9): string {
@@ -135,7 +151,7 @@ export function alertReadingText(alert: AlertRule): string {
135
151
  // A move, with the close it is measured from: `-0.38% vs Thu 5 Nov close as of 2026-11-06T08:47Z`.
136
152
  if (alert.move) {
137
153
  const at = alertReadingAt(alert);
138
- const figure = `${movePercentText(value)} ${moveBasisText(alert.lastMoveBasis)}`;
154
+ const figure = `${movePercentText(value)}${readingSessionWords(alert)} ${moveBasisText(alert.lastMoveBasis)}`;
139
155
  return at ? `${figure} as of ${isoUtc(at).replace(/:\d{2}Z$/, "Z")}` : figure;
140
156
  }
141
157
  const unit = readingUnit(alert);
@@ -144,8 +160,8 @@ export function alertReadingText(alert: AlertRule): string {
144
160
  const price = !alert.metric ? alertPriceText(alert, value) : null;
145
161
  const figure = alert.metric?.kind === "rrg" ? metricReadingText(alert.metric, { value, target: alert.lastCheckedTarget ?? Number.NaN })
146
162
  : alert.metric?.kind === "rs_ratio" ? formatRatio(value)
147
- : price?.endsWith("p") ? price
148
- : `${price ?? value.toFixed(2)}${unit === "x" ? "x" : unit ? ` ${unit}` : ""}`;
163
+ : price?.endsWith("p") ? `${price}${readingSessionWords(alert)}`
164
+ : `${price ?? value.toFixed(2)}${unit === "x" ? "x" : unit ? ` ${unit}` : ""}${readingSessionWords(alert)}`;
149
165
  const basis = alert.metric ? closeBasis(alert.metric) : null;
150
166
  if (basis && alert.lastDailyClose) return `${figure} on the ${alert.lastDailyClose} ${basis === "weekly close" ? "weekly close" : "close"}`;
151
167
  const at = alertReadingAt(alert);
@@ -13,6 +13,7 @@ import type { PaneLock } from "../../../types/plugin";
13
13
  import { refusedLock } from "../shared/cloud-denied";
14
14
  import { ALERT_TABS, ALERTS_PLUGIN_ID } from "./constants";
15
15
  import { eventWhen, needsSignInNote, ruleState } from "./event-rows";
16
+ import { checkedOnlyWithPro, checksProRules, needsProNote } from "./pro-rules";
16
17
  import { readerTimeZone } from "../../../utils/utc-time";
17
18
  import { eventAlertTarget, type EventAlertRule } from "./events";
18
19
  import {
@@ -149,7 +150,7 @@ function pricesResult(alerts: readonly AlertRule[], error: string | null, events
149
150
  }
150
151
 
151
152
  /** An event alert as the Events table lists it: a scheduled one with its event date and lead time apart. */
152
- function eventRow(rule: EventAlertRule, now: number, checks: Record<string, IvLevelCheck>, signedIn: boolean, readerZone: string | null = null): HeadlessPaneRow {
153
+ function eventRow(rule: EventAlertRule, now: number, checks: Record<string, IvLevelCheck>, signedIn: boolean, pro: boolean, readerZone: string | null = null): HeadlessPaneRow {
153
154
  const scheduled = readScheduledRule(rule);
154
155
  return {
155
156
  id: rule.id,
@@ -160,7 +161,7 @@ function eventRow(rule: EventAlertRule, now: number, checks: Record<string, IvLe
160
161
  eventDate: scheduled && rule.eventDate ? eventWhen(rule, readerZone) : null,
161
162
  leadDays: scheduled?.leadDays ?? null,
162
163
  ...(scheduled?.trigger === "results" ? { when: "results" } : {}),
163
- state: ruleState(rule, now, signedIn),
164
+ state: ruleState(rule, now, signedIn, pro),
164
165
  since: new Date(rule.createdAt).toISOString().slice(0, 10),
165
166
  // An IV level's last reading, or why there was none, on its own row.
166
167
  ...rule.kind === "iv_level" ? { lastCheck: ivLevelCheckText(rule, checks[rule.id]) } : {},
@@ -168,20 +169,25 @@ function eventRow(rule: EventAlertRule, now: number, checks: Record<string, IvLe
168
169
  }
169
170
 
170
171
  function eventsResult(
171
- rules: readonly EventAlertRule[], error: string | null, checks: Record<string, IvLevelCheck>, signedIn: boolean, readerZone: string | null = null,
172
+ rules: readonly EventAlertRule[], error: string | null, checks: Record<string, IvLevelCheck>, signedIn: boolean, pro: boolean,
173
+ readerZone: string | null = null,
172
174
  ): HeadlessRowsResult {
173
175
  const now = Date.now();
174
176
  const checked = rules.some((rule) => rule.kind === "iv_level");
175
- const rows = [...rules].sort((a, b) => b.createdAt - a.createdAt).map((rule) => eventRow(rule, now, checks, signedIn, readerZone));
177
+ const rows = [...rules].sort((a, b) => b.createdAt - a.createdAt).map((rule) => eventRow(rule, now, checks, signedIn, pro, readerZone));
176
178
  // Signed out, the rules only a signed-in account gets checked say so on their rows, and once what to do.
177
179
  const waiting = rows.filter((row) => row.state === "Needs sign-in").length;
180
+ // Options flow and IV spikes are checked only with Pro, which their rows say without it; the list says it once either way.
181
+ const proRules = rules.filter(checkedOnlyWithPro);
182
+ const notes = [...waiting ? [needsSignInNote(waiting)] : [],
183
+ ...proRules.length ? [needsProNote(proRules, rows.filter((row) => row.state === "Needs Pro").length)] : []];
178
184
  return {
179
185
  // A Last check column only when an IV level rule has a reading to show.
180
186
  columns: checked ? [...EVENT_COLUMNS.slice(0, -2), { key: "lastCheck", header: "Last check" }, ...EVENT_COLUMNS.slice(-2)] : EVENT_COLUMNS,
181
187
  rows,
182
188
  empty: "No event alerts. Add one with gloom alerts add CRWV earnings --days 3, gloom alerts add CPI --days 1 or gloom alerts add CN PMI.",
183
189
  ...(error ? { errors: [error], complete: false } : {}),
184
- ...(waiting ? { notes: [needsSignInNote(waiting)] } : {}),
190
+ ...(notes.length ? { notes } : {}),
185
191
  };
186
192
  }
187
193
 
@@ -276,7 +282,7 @@ export const alertsHeadless: HeadlessPaneDefinition<"rows"> = {
276
282
  const { alerts, alertsError, events } = readAlertStores(ctx.config);
277
283
  return tab === "events"
278
284
  ? eventsResult(events.rules, events.error, readIvLevelChecks(ctx.readDeviceState?.(ALERTS_PLUGIN_ID, IV_LEVEL_CHECKS_KEY)), !!ctx.apiClient.getSessionToken?.(),
279
- readerTimeZone(ctx.config.timezone))
285
+ checksProRules(!!ctx.apiClient.getSessionToken?.(), ctx.apiClient.getCurrentUser?.()), readerTimeZone(ctx.config.timezone))
280
286
  // A move rule with this device's last reading of it, and whether it went off this session.
281
287
  : pricesResult(withMoveChecks(alerts, readMoveChecks(ctx.readDeviceState?.(ALERTS_PLUGIN_ID, MOVE_CHECKS_KEY))), alertsError, events.rules.length);
282
288
  },
@@ -9,10 +9,14 @@ import { alertChangeEntry, createFiredAlertRecorder, firedAlertTime, quoteSource
9
9
  import { checkIvLevelAlertsNow, startIvLevelAlerts } from "./iv-level";
10
10
  import { logFailure } from "../../../utils/log-failure";
11
11
  import { RESEARCH_FORM_KINDS, RESEARCH_LABELS, researchWizardFields, createResearchAlert } from "./research-builder";
12
+ import { checkedOnlyWithPro, checksProRules, savedWithoutProNote } from "./pro-rules";
13
+ import { OCC_CONTRACT, parseLooseOptionContract, resolveLooseOptionContract } from "./option-contract";
14
+ import { apiClient } from "../../../api-client";
12
15
  import { newYorkToday } from "../earnings/board-model";
13
16
  import { checkScheduledEventAlertsNow, startScheduledEventAlerts } from "./scheduled-check";
14
17
  import { scheduledEventSources } from "./scheduled-sources";
15
18
  import {
19
+ earningsUsOnlyMessage,
16
20
  eventDateUnavailableMessage,
17
21
  lookupScheduledDates,
18
22
  noUpcomingEventMessage,
@@ -22,7 +26,8 @@ import {
22
26
  } from "./scheduled";
23
27
  import { isResearchAlertKind, MAX_LEAD_DAYS } from "./research-rules";
24
28
  import { EVENT_ALERT_TEMPLATES, MAX_EVENT_ALERTS, createEventAlert, eventAlertStoreKey, readEventAlertStores, updateEventAlerts } from "./events";
25
- import { settleTypedListingKey } from "../../../tickers/listing-venues";
29
+ import { AlertListingRefusal, resolveAlertListing } from "../../../cli/alert-listing";
30
+ import { earningsListingVenue } from "./earnings-listing";
26
31
  import { parseListingArg } from "../../../cli/listing-arg";
27
32
  import { notATickerSymbol } from "../../../sources/provider-errors";
28
33
  import type { Quote } from "../../../types/financials";
@@ -35,19 +40,23 @@ import {
35
40
  sameLevelRule,
36
41
  } from "./alert-engine";
37
42
  import {
43
+ MOVE_KIND_CHOICE,
44
+ moveWizardFields,
38
45
  parseAlertCommandValues,
39
46
  parseAlertShortcutValues,
40
47
  } from "./command";
41
- import { ALERTS_PLUGIN_ID, POLL_INTERVAL_MS, POLL_SECONDS_KEY } from "./constants";
48
+ import { ALERTS_PLUGIN_ID, POLL_INTERVAL_MS, POLL_SECONDS_KEY, PRICE_DELIVERY } from "./constants";
42
49
  import { alertHistoryLockNote, alertsHeadless } from "./headless";
43
50
  import { alertsCliCommand } from "./cli";
44
51
  import {
52
+ commodityFutureNote,
45
53
  createQuoteErrorMessage,
46
54
  farTargetMessage,
47
55
  levelInQuoteUnit,
48
56
  moveQuoteFields,
49
57
  quoteAlertFields,
50
58
  quoteErrorAlertFields,
59
+ alertQuote,
51
60
  resolveAlertQuote,
52
61
  resolveAlertQuotes,
53
62
  } from "./quotes";
@@ -59,8 +68,9 @@ import {
59
68
  import { createAlertQuoteStream, readStreamedAlertQuote, type AlertQuoteStream } from "./live";
60
69
  import { alertPriceText } from "./price-text";
61
70
  import { isPenceQuotedLine } from "../../../market-data/market/format";
62
- import { judgeMove, moveBasisText, moveFiredText } from "./move";
63
- import { alertListing } from "./format";
71
+ import { judgeMove, moveBasisText, moveFiredText, MOVE_DELIVERY } from "./move";
72
+ import { MOVE_REARM, moveNowText, planMoveAlerts } from "./cli-move";
73
+ import { alertListing, readingSessionWords } from "./format";
64
74
  import type { AlertRule } from "./types";
65
75
 
66
76
  let catalystAlertsStop: (() => void) | null = null;
@@ -223,8 +233,8 @@ export const alertsPlugin: GloomPlugin = {
223
233
  ctx.registerCommand({
224
234
  id: "set-alert",
225
235
  label: "Add Alert",
226
- description: "Create a price, valuation or daily technical alert",
227
- keywords: ["add", "set", "alert", "pe", "ps", "rsi", "moving average", "valuation", "price", "trigger", "notify", "alarm", "watch"],
236
+ description: "Create a price, move, valuation or daily technical alert",
237
+ keywords: ["add", "set", "alert", "move", "previous close", "pe", "ps", "rsi", "moving average", "valuation", "price", "trigger", "notify", "alarm", "watch"],
228
238
  category: "data",
229
239
  shortcut: "SA",
230
240
  shortcutArg: {
@@ -234,7 +244,8 @@ export const alertsPlugin: GloomPlugin = {
234
244
  },
235
245
  wizardLayout: "form",
236
246
  wizard: [
237
- { key: "kind", label: "Kind", type: "select", defaultValue: "price", options: METRIC_CHOICES },
247
+ // A move from the previous close sits beside a price level: both are checked on the listing's quotes.
248
+ { key: "kind", label: "Kind", type: "select", defaultValue: "price", options: [METRIC_CHOICES[0]!, MOVE_KIND_CHOICE, ...METRIC_CHOICES.slice(1)] },
238
249
  {
239
250
  key: "symbol",
240
251
  label: "Symbol",
@@ -259,15 +270,24 @@ export const alertsPlugin: GloomPlugin = {
259
270
  placeholder: "200.00",
260
271
  type: "number",
261
272
  },
273
+ ...moveWizardFields,
262
274
  ...metricWizardFields,
263
275
  ],
264
276
  async execute(values) {
265
277
  let input = parseAlertCommandValues(values);
266
278
  if (!input) throw new Error("Use a symbol, condition, and target price.");
267
- // 7203:TSE, typed or from a link, is the venue its symbol trades on, as `alerts add` reads it.
279
+ // Read as `alerts add` and `quote` read it (`resolveAlertListing`): 7203:TSE is the venue its symbol trades on,
280
+ // "Singtel" is Z74:SGX, a listing that stopped trading is refused, and FB says Meta trades as META.
281
+ const notes: string[] = [];
268
282
  const quoteFor = async (typed: string) => {
269
- const key = (await settleTypedListingKey(typed, { store: ctx.tickerRepository, dataProvider: ctx.marketData })).toUpperCase();
270
- return { key, quote: await resolveAlertQuote(ctx.marketData, key) };
283
+ const found = await resolveAlertListing(typed, null, { store: ctx.tickerRepository, dataProvider: ctx.marketData })
284
+ .catch((error: unknown) => {
285
+ if (error instanceof AlertListingRefusal) throw new Error(error.details ? `${error.message} ${error.details}` : error.message);
286
+ throw error;
287
+ });
288
+ notes.push(...found.notes);
289
+ const key = found.listing.key.toUpperCase();
290
+ return { key, exchange: found.listing.exchange, quote: alertQuote(found.quote, key) };
271
291
  };
272
292
  let resolved: Awaited<ReturnType<typeof quoteFor>>;
273
293
  try {
@@ -275,13 +295,41 @@ export const alertsPlugin: GloomPlugin = {
275
295
  } catch (error) {
276
296
  // XLK/SPY is a listing first; only one the service says is no ticker is the ratio of the two, as `alerts add` reads it.
277
297
  // A timeout stays a timeout, and BTC/USD, BRK/B or EUR/USD, one listing written with a slash, keeps its own answer.
278
- const pair = !input.metric && /^[^/\s]+\/[^/\s]+$/.test(input.symbol) && notATickerSymbol(error instanceof Error ? error.message : String(error))
298
+ const pair = !input.metric && !input.move && /^[^/\s]+\/[^/\s]+$/.test(input.symbol) && notATickerSymbol(error instanceof Error ? error.message : String(error))
279
299
  && !slashSpellsListing(input.symbol) ? parseMetricAlert(`${input.symbol} ratio ${input.condition} ${input.price}`) : null;
280
300
  if (!pair) throw error;
281
301
  input = pair;
282
302
  resolved = await quoteFor(pair.symbol);
283
303
  }
284
304
  const { key: symbol, quote } = resolved;
305
+ // A move from the previous close is made as `alerts add` makes one: its first reading is the quote it was read on.
306
+ if (input.move) {
307
+ const now = Date.now();
308
+ const exchange = resolved.exchange ? canonicalExchange(resolved.exchange) : canonicalExchange(quote.listingExchangeName || quote.exchangeName);
309
+ const saved = loadJudgedAlerts();
310
+ const plan = planMoveAlerts({ kind: "move", symbols: [input.symbol], condition: input.condition, percent: input.price },
311
+ [{ input: input.symbol, listing: { symbol, ...exchange ? { exchange } : {} }, quote }], saved, now);
312
+ const existing = plan.existing[0]?.alert;
313
+ if (existing) {
314
+ throw new Error(`${formatAlertDescription(existing)} already exists (alert ${existing.id})${existing.status === "triggered"
315
+ ? "; it went off this session and arms again in the next" : ""}. Nothing was added.`);
316
+ }
317
+ const alert = plan.added[0];
318
+ if (!alert) throw new Error(plan.failed[0]?.error ?? "No move alert was added.");
319
+ const alerts = [...saved, alert];
320
+ await saveAlerts(ctx, alerts, "price");
321
+ // Its readings stay on this device, beside the rules, as the checks keep them.
322
+ saveMoveChecks(alerts);
323
+ recordFired(alertChangeEntry("created", alertLogRule(alert)));
324
+ alertStream?.sync();
325
+ const reading = moveNowText(alert, now);
326
+ ctx.notify({
327
+ body: [`Alert set: ${formatAlertDescription(alert)} (${MOVE_REARM})${reading ? `, ${reading}` : ""}.`, MOVE_DELIVERY,
328
+ ...notes.map((note) => /[.?!]$/.test(note) ? note : `${note}.`)].join(" "),
329
+ type: "success",
330
+ });
331
+ return;
332
+ }
285
333
  let metric = input.metric;
286
334
  if (metric && isRelativeMetric(metric)) {
287
335
  const reference = (await quoteFor(benchmarkKey(metric))).quote;
@@ -296,7 +344,9 @@ export const alertsPlugin: GloomPlugin = {
296
344
  // A London line's level is in the pence its quote shows: 70p, or 70 where 70 in pounds is far off.
297
345
  if (!input.metric) input = { ...input, price: levelInQuoteUnit(input, quote, symbol).price };
298
346
  // A target ten times away is a slip or another instrument's price, such as bitcoin's on the BTC fund.
299
- const far = farTargetMessage(symbol, input.price, quote.price, symbol.includes(":") ? null : notTheCoinNote(symbol, quote), isPenceQuotedLine(quote));
347
+ // GOLD is Gold.com: a target at gold's price names the future, as `alerts add` does.
348
+ const named = input.symbol.includes(":");
349
+ const far = farTargetMessage(symbol, input.price, quote.price, named ? null : notTheCoinNote(input.symbol.toUpperCase(), quote) ?? commodityFutureNote(input.symbol, quote), isPenceQuotedLine(quote));
300
350
  if (!input.metric && far) throw new Error(far);
301
351
 
302
352
  const alert: AlertRule = {
@@ -334,8 +384,13 @@ export const alertsPlugin: GloomPlugin = {
334
384
  // A level the price is already past goes off at the next check, as `alerts add` says.
335
385
  const met = !input.metric && levelAlreadyMet(alert.condition, quote.price, alert.targetPrice)
336
386
  ? `, already ${alert.condition}, so it goes off at the next check` : "";
387
+ // What delivers it and what became of the symbol, as `alerts add` says them.
337
388
  ctx.notify({
338
- body: `Alert set: ${formatAlertDescription(alert)}${input.metric ? firstCheck ? `, ${firstCheck}` : "" : ` (current ${alertPriceText(alert, quote.price)}${met})`}`,
389
+ body: [
390
+ `Alert set: ${formatAlertDescription(alert)}${input.metric ? firstCheck ? `, ${firstCheck}` : "" : ` (current ${alertPriceText(alert, quote.price)}${readingSessionWords(alert)}${met})`}.`,
391
+ `${PRICE_DELIVERY.charAt(0).toUpperCase()}${PRICE_DELIVERY.slice(1)}.`,
392
+ ...notes.map((note) => /[.?!]$/.test(note) ? note : `${note}.`),
393
+ ].join(" "),
339
394
  type: "success",
340
395
  });
341
396
  },
@@ -358,8 +413,11 @@ export const alertsPlugin: GloomPlugin = {
358
413
  key: "event",
359
414
  label: "Event",
360
415
  type: "select",
361
- defaultValue: "congress-watched",
362
- options: [...RESEARCH_FORM_KINDS.map((value) => ({ value, label: RESEARCH_LABELS[value] })), ...EVENT_ALERT_TEMPLATES.map((entry) => ({ label: entry.label, value: entry.id }))],
416
+ // Earnings first, as the command describes itself: an alert anyone can add for any US listing.
417
+ defaultValue: "earnings_date",
418
+ // Options flow and IV spikes are checked only with Pro, and say so before one is chosen.
419
+ options: [...RESEARCH_FORM_KINDS.map((value) => ({ value, label: checkedOnlyWithPro({ kind: value }) ? `${RESEARCH_LABELS[value]} (Pro)` : RESEARCH_LABELS[value] })),
420
+ ...EVENT_ALERT_TEMPLATES.map((entry) => ({ label: entry.label, value: entry.id }))],
363
421
  },
364
422
  ...EVENT_ALERT_TEMPLATES.filter((entry) => entry.field != null).map((entry) => ({
365
423
  key: entry.id,
@@ -383,6 +441,26 @@ export const alertsPlugin: GloomPlugin = {
383
441
  const awaitsResults = event === "earnings_date" && values["earnings_date:when"] === "results";
384
442
  if (scheduled && !awaitsResults && parseLeadDays(values[`${event}:leadDays`]) == null)
385
443
  throw new Error(`Days before must be a whole number from 1 to ${MAX_LEAD_DAYS}.`);
444
+ // A bare symbol is read as every alert reads it: D05 is on SGX, which earnings alerts do not follow, as `alerts add` says.
445
+ const earningsSymbol = event === "earnings_date" ? String(values["earnings_date:symbol"] ?? "").trim() : "";
446
+ if (earningsSymbol && (values["earnings_date:exchange"] ?? "US") === "US" && !parseListingArg(earningsSymbol).exchange) {
447
+ const abroad = await earningsListingVenue(earningsSymbol, { store: ctx.tickerRepository, dataProvider: ctx.marketData }).catch((error: unknown) => {
448
+ if (error instanceof AlertListingRefusal) throw new Error(error.details ? `${error.message} ${error.details}` : error.message);
449
+ throw error;
450
+ });
451
+ if (abroad.exchange) throw new Error(earningsUsOnlyMessage(`${abroad.symbol}:${abroad.exchange}`));
452
+ }
453
+ // A contract typed loosely (`SPY 680C 11/19`) is the one listed contract it names, as `alerts add` reads it.
454
+ const typedContract = event === "iv_spike" ? String(values["iv_spike:contract"] ?? "").trim() : "";
455
+ const looseContract = typedContract && !OCC_CONTRACT.test(typedContract) ? parseLooseOptionContract(typedContract) : null;
456
+ const notes: string[] = [];
457
+ if (looseContract) {
458
+ const getChain = ctx.marketData.getOptionsChain?.bind(ctx.marketData);
459
+ if (!getChain) throw new Error(`Option chains cannot be read here to find ${typedContract}.`);
460
+ const resolved = await resolveLooseOptionContract(typedContract, looseContract, (expiration) => getChain(looseContract.root, "", expiration), Date.now());
461
+ values = { ...values, "iv_spike:contract": resolved.contract };
462
+ if (resolved.readAs) notes.push(resolved.readAs);
463
+ }
386
464
  let rule = isResearchAlertKind(event) ? createResearchAlert(event, values) : createEventAlert(event, values?.[event] || "");
387
465
  const target = scheduled ? readScheduledRule(rule)?.target : null;
388
466
  if (target) {
@@ -408,7 +486,10 @@ export const alertsPlugin: GloomPlugin = {
408
486
  const key = eventAlertStoreKey(rule);
409
487
  await ctx.configState.set(key, updateEventAlerts(ctx.configState.get<string>(key), (rules) => [...rules, rule]));
410
488
  recordFired(alertChangeEntry("created", alertLogRule(rule)));
411
- ctx.notify({ body: "Event alert saved.", type: "success" });
489
+ // Saved without Pro, a Pro rule waits on it, as its form said and its row reads (Needs Pro).
490
+ const signedIn = !!apiClient.getSessionToken() || !!apiClient.getCurrentUser();
491
+ const waitsOnPro = checkedOnlyWithPro(rule) && !checksProRules(signedIn, apiClient.getCurrentUser());
492
+ ctx.notify({ body: [`Event alert saved.${waitsOnPro ? savedWithoutProNote(rule) : ""}`, ...notes].join(" "), type: "success" });
412
493
  if (scheduled) checkScheduledEventAlertsNow();
413
494
  if (rule.kind === "iv_level") checkIvLevelAlertsNow();
414
495
  },