@gloom-sh/terminal 0.20.11 → 0.20.12

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 (242) hide show
  1. package/package.json +2 -1
  2. package/src/api-client/awards.ts +16 -0
  3. package/src/api-client/central-bank-rates.ts +5 -0
  4. package/src/api-client/data.ts +55 -2
  5. package/src/api-client/index.ts +18 -1
  6. package/src/api-client/request.ts +86 -3
  7. package/src/api-client/socket-connection.ts +12 -1
  8. package/src/api-client/socket.ts +21 -3
  9. package/src/api-client/supply-chain-graph.ts +4 -2
  10. package/src/api-client/supply-chain.ts +8 -0
  11. package/src/api-client/types/econ.ts +10 -7
  12. package/src/api-client/types/filings-and-calls.ts +8 -0
  13. package/src/app/global-shortcuts.ts +2 -1
  14. package/src/app/keybindings/actions.ts +19 -0
  15. package/src/app/pane-runtime/index.tsx +18 -3
  16. package/src/app/pane-runtime/layout-placement.ts +63 -0
  17. package/src/app/pane-runtime/ticker-open-runtime.ts +10 -2
  18. package/src/capabilities/chart-series.ts +4 -1
  19. package/src/cli/board-coins.ts +10 -1
  20. package/src/cli/commands/crypto-hints.ts +3 -2
  21. package/src/cli/commands/fred-series.ts +0 -54
  22. package/src/cli/commands/market.ts +209 -31
  23. package/src/cli/commands/overview.ts +47 -14
  24. package/src/cli/commands/search.ts +37 -8
  25. package/src/cli/commands/ticker.ts +15 -4
  26. package/src/cli/desktop-pane-shot.ts +27 -2
  27. package/src/cli/fx-quote-rate.ts +1 -1
  28. package/src/cli/glossary.ts +14 -5
  29. package/src/cli/history-catalog-series.ts +85 -0
  30. package/src/cli/index.ts +1 -1
  31. package/src/cli/list-progress.ts +45 -0
  32. package/src/cli/listing-arg.ts +71 -7
  33. package/src/cli/name-entries.ts +8 -4
  34. package/src/cli/not-a-ticker.ts +2 -2
  35. package/src/cli/pane-functions/freshness.ts +50 -3
  36. package/src/cli/pane-functions/index.ts +7 -4
  37. package/src/cli/pane-functions/market-session.ts +66 -14
  38. package/src/cli/pane-functions/options.ts +5 -0
  39. package/src/cli/pane-functions/resolver.ts +9 -2
  40. package/src/cli/pane-functions/screenshot-assessment.ts +28 -3
  41. package/src/cli/pane-functions/screenshot-types.ts +6 -0
  42. package/src/cli/quote-answer.ts +49 -10
  43. package/src/cli/quote-list-reads.ts +87 -0
  44. package/src/cli/report-tables.ts +70 -13
  45. package/src/cli/result.ts +24 -2
  46. package/src/cli/symbol-list.ts +31 -4
  47. package/src/cli/terminal-code-hints.ts +83 -0
  48. package/src/cli/ticker-resolution.ts +2 -1
  49. package/src/cli/treasury-yields.ts +5 -0
  50. package/src/components/command-bar/action-runtime.ts +2 -0
  51. package/src/components/command-bar/routing/launch-request.ts +2 -1
  52. package/src/components/command-bar/routing/navigation-state.ts +4 -2
  53. package/src/components/command-bar/workflow/types.ts +6 -0
  54. package/src/components/layout/detached-pane-shell.tsx +3 -0
  55. package/src/components/layout/double-escape-close.ts +34 -3
  56. package/src/components/layout/floating-pane.tsx +10 -4
  57. package/src/components/layout/pane/cycle-order.ts +66 -2
  58. package/src/components/layout/pane/header.tsx +140 -31
  59. package/src/components/layout/pane/sidebar.tsx +13 -5
  60. package/src/components/layout/pane/status-footer.ts +3 -1
  61. package/src/components/layout/shell/drag/runtime.ts +5 -0
  62. package/src/components/layout/shell/index.tsx +25 -0
  63. package/src/components/layout/shell/menu.ts +9 -0
  64. package/src/components/layout/shell/pane/actions.ts +36 -0
  65. package/src/components/layout/shell/pane/management-shortcuts.ts +27 -3
  66. package/src/components/layout/shell/pane-occlusion.ts +40 -0
  67. package/src/components/layout/shell/shortcuts.ts +17 -1
  68. package/src/components/layout/shell/terminal-pointer-runtime.ts +39 -6
  69. package/src/components/layout/shell/window-mode/index.ts +5 -16
  70. package/src/components/layout/shell/window-mode/overlays.tsx +3 -1
  71. package/src/components/market-board/index.tsx +14 -5
  72. package/src/components/metric-treemap/index.tsx +3 -1
  73. package/src/components/ui/button.tsx +48 -4
  74. package/src/components/ui/data-table/opentui/index.tsx +24 -9
  75. package/src/components/ui/data-table/types.ts +7 -0
  76. package/src/components/ui/inline-quick-add.tsx +19 -3
  77. package/src/components/ui/list-view.tsx +11 -5
  78. package/src/components/ui/query-bar.tsx +16 -1
  79. package/src/components/ui/selection-fill.ts +39 -0
  80. package/src/core/state/app/layout-reducer.ts +2 -1
  81. package/src/core/state/app/pane-choices.ts +68 -0
  82. package/src/core/state/app/state.ts +14 -6
  83. package/src/core/state/app/types.ts +8 -0
  84. package/src/layout/pane-manager/dock-tree.ts +19 -0
  85. package/src/layout/pane-manager/index.ts +3 -0
  86. package/src/market-data/market/freshness.ts +33 -0
  87. package/src/market-data/market/status.ts +5 -1
  88. package/src/market-data/quotes/contributions.ts +10 -0
  89. package/src/market-data/quotes/freshness.ts +19 -0
  90. package/src/market-data/quotes/live-valuation.ts +31 -4
  91. package/src/market-data/quotes/resolution.ts +4 -0
  92. package/src/market-data/quotes/time.ts +0 -14
  93. package/src/plugins/builtin/account-management/index.tsx +1 -0
  94. package/src/plugins/builtin/awards/detail.tsx +12 -4
  95. package/src/plugins/builtin/awards/headless.ts +29 -8
  96. package/src/plugins/builtin/awards/model.ts +36 -2
  97. package/src/plugins/builtin/awards/pane.tsx +7 -4
  98. package/src/plugins/builtin/broker-manager/index.tsx +1 -0
  99. package/src/plugins/builtin/broker-trading/index.tsx +1 -1
  100. package/src/plugins/builtin/central-bank-rates/headless.ts +6 -6
  101. package/src/plugins/builtin/central-bank-rates/index.tsx +1 -1
  102. package/src/plugins/builtin/central-bank-rates/model.ts +21 -3
  103. package/src/plugins/builtin/central-bank-rates/pane.tsx +15 -5
  104. package/src/plugins/builtin/chart-composer/headless.ts +5 -1
  105. package/src/plugins/builtin/chart-composer/pane.tsx +1 -0
  106. package/src/plugins/builtin/chat/content/handle-prompt.tsx +4 -0
  107. package/src/plugins/builtin/chat/controller/realtime.ts +17 -1
  108. package/src/plugins/builtin/chat/message/terminal.tsx +4 -1
  109. package/src/plugins/builtin/chat/sidebar.tsx +3 -4
  110. package/src/plugins/builtin/cloud/askg/pane.tsx +4 -0
  111. package/src/plugins/builtin/cloud/plugin.tsx +1 -0
  112. package/src/plugins/builtin/cloud/team/module.tsx +1 -0
  113. package/src/plugins/builtin/cloud/thesis/detail.tsx +9 -4
  114. package/src/plugins/builtin/commodity-balances/pane.tsx +13 -5
  115. package/src/plugins/builtin/company-kpis/model.ts +3 -3
  116. package/src/plugins/builtin/connections/index.ts +1 -0
  117. package/src/plugins/builtin/credit-boards/cdx-pane.tsx +9 -5
  118. package/src/plugins/builtin/credit-boards/client.ts +5 -0
  119. package/src/plugins/builtin/credit-boards/headless.ts +1 -6
  120. package/src/plugins/builtin/credit-boards/model.ts +0 -6
  121. package/src/plugins/builtin/credit-boards/series.ts +19 -8
  122. package/src/plugins/builtin/credit-boards/sovr-pane.tsx +9 -5
  123. package/src/plugins/builtin/crypto-etf-flows/headless.ts +23 -13
  124. package/src/plugins/builtin/crypto-etf-flows/pane.tsx +8 -3
  125. package/src/plugins/builtin/debt-maturities/headless.ts +16 -7
  126. package/src/plugins/builtin/debt-maturities/model.ts +9 -15
  127. package/src/plugins/builtin/debt-maturities/pane.tsx +9 -10
  128. package/src/plugins/builtin/earnings/board-model.ts +33 -4
  129. package/src/plugins/builtin/earnings/board.tsx +15 -3
  130. package/src/plugins/builtin/earnings/calendar.tsx +10 -6
  131. package/src/plugins/builtin/earnings/client.ts +0 -9
  132. package/src/plugins/builtin/earnings/headless.ts +10 -7
  133. package/src/plugins/builtin/earnings/history.tsx +21 -14
  134. package/src/plugins/builtin/earnings-calls/data.ts +24 -4
  135. package/src/plugins/builtin/earnings-calls/format.ts +23 -5
  136. package/src/plugins/builtin/earnings-calls/headless.ts +23 -3
  137. package/src/plugins/builtin/earnings-calls/index.tsx +1 -0
  138. package/src/plugins/builtin/earnings-calls/model.ts +11 -1
  139. package/src/plugins/builtin/earnings-calls/pane.tsx +2 -5
  140. package/src/plugins/builtin/econ/calendar-model.ts +27 -0
  141. package/src/plugins/builtin/econ/fred-catalog.ts +3 -0
  142. package/src/plugins/builtin/econ/index.tsx +9 -2
  143. package/src/plugins/builtin/econ-statistics/headless.ts +3 -1
  144. package/src/plugins/builtin/econ-statistics/index.tsx +1 -1
  145. package/src/plugins/builtin/fear-greed/headless.ts +16 -13
  146. package/src/plugins/builtin/fear-greed/pane.tsx +12 -4
  147. package/src/plugins/builtin/filing-events/index.tsx +1 -0
  148. package/src/plugins/builtin/fx-matrix/index.tsx +30 -19
  149. package/src/plugins/builtin/insider/table.tsx +10 -7
  150. package/src/plugins/builtin/insider/tickers.tsx +1 -1
  151. package/src/plugins/builtin/iv-history/headless.ts +9 -8
  152. package/src/plugins/builtin/jobs/index.tsx +1 -0
  153. package/src/plugins/builtin/macro-day/headless.ts +3 -3
  154. package/src/plugins/builtin/macro-day/model.ts +1 -1
  155. package/src/plugins/builtin/macro-day/releases.ts +25 -16
  156. package/src/plugins/builtin/market-movers/index.tsx +20 -8
  157. package/src/plugins/builtin/market-movers/model.ts +5 -0
  158. package/src/plugins/builtin/market-movers/session-body.tsx +2 -1
  159. package/src/plugins/builtin/money-markets/headless.ts +12 -2
  160. package/src/plugins/builtin/money-markets/pane.tsx +10 -1
  161. package/src/plugins/builtin/options/view.tsx +1 -0
  162. package/src/plugins/builtin/options-positioning/pane.tsx +1 -1
  163. package/src/plugins/builtin/portfolio-list/cli/bulk-symbols.ts +4 -31
  164. package/src/plugins/builtin/portfolio-list/pane/index.tsx +6 -1
  165. package/src/plugins/builtin/portfolio-list/quick-add/index.tsx +22 -8
  166. package/src/plugins/builtin/portfolio-list/summary/index.tsx +6 -8
  167. package/src/plugins/builtin/portfolio-list/table.tsx +10 -1
  168. package/src/plugins/builtin/realized-vol/headless.ts +28 -2
  169. package/src/plugins/builtin/risk-factors/index.tsx +1 -0
  170. package/src/plugins/builtin/shared/source-footer.ts +70 -0
  171. package/src/plugins/builtin/short-interest/publications-pane.tsx +5 -1
  172. package/src/plugins/builtin/short-volume/pane.tsx +5 -1
  173. package/src/plugins/builtin/social-mentions/outliers.tsx +10 -1
  174. package/src/plugins/builtin/social-mentions/pane.tsx +7 -0
  175. package/src/plugins/builtin/supply-chain/client.ts +3 -1
  176. package/src/plugins/builtin/supply-chain/flow.tsx +25 -8
  177. package/src/plugins/builtin/supply-chain/graph-client.ts +1 -1
  178. package/src/plugins/builtin/supply-chain/graph-evidence.ts +1 -1
  179. package/src/plugins/builtin/supply-chain/graph-model.ts +12 -1
  180. package/src/plugins/builtin/supply-chain/graph-pane.tsx +9 -8
  181. package/src/plugins/builtin/supply-chain/graph.tsx +12 -6
  182. package/src/plugins/builtin/supply-chain/headless.ts +13 -7
  183. package/src/plugins/builtin/supply-chain/model.ts +68 -11
  184. package/src/plugins/builtin/supply-chain/pane.tsx +9 -6
  185. package/src/plugins/builtin/supply-chain/row-evidence.tsx +5 -5
  186. package/src/plugins/builtin/ticker-detail/overview/components.tsx +14 -1
  187. package/src/plugins/builtin/ticker-detail/overview-tab.tsx +2 -0
  188. package/src/plugins/builtin/ticker-detail/pane.tsx +48 -24
  189. package/src/plugins/builtin/ticker-detail/quote-footer.ts +5 -0
  190. package/src/plugins/builtin/ticker-detail/quote-monitor/card.tsx +6 -3
  191. package/src/plugins/builtin/treasury-auctions/after.ts +50 -23
  192. package/src/plugins/builtin/treasury-auctions/cache.ts +23 -5
  193. package/src/plugins/builtin/treasury-auctions/headless.ts +226 -37
  194. package/src/plugins/builtin/treasury-auctions/hk-headless.ts +11 -5
  195. package/src/plugins/builtin/treasury-auctions/hk-view.tsx +27 -25
  196. package/src/plugins/builtin/treasury-auctions/hk.ts +60 -8
  197. package/src/plugins/builtin/treasury-auctions/index.tsx +3 -0
  198. package/src/plugins/builtin/treasury-auctions/keys.ts +27 -0
  199. package/src/plugins/builtin/treasury-auctions/like.ts +137 -0
  200. package/src/plugins/builtin/treasury-auctions/model.ts +100 -22
  201. package/src/plugins/builtin/treasury-auctions/pane.tsx +39 -11
  202. package/src/plugins/builtin/vol-surface/heat-grid.tsx +4 -2
  203. package/src/plugins/builtin/vol-surface/pane.tsx +5 -2
  204. package/src/plugins/runtime/index.tsx +1 -0
  205. package/src/plugins/runtime/state.ts +20 -0
  206. package/src/portfolio/column-values.ts +8 -2
  207. package/src/public/__snapshots__/public-api.test.ts.snap +5 -0
  208. package/src/public/react.ts +7 -0
  209. package/src/react/auto-refresh.ts +29 -0
  210. package/src/renderers/browser/deeplink-bridge.ts +24 -3
  211. package/src/renderers/dom/desktop/query-bar.tsx +229 -60
  212. package/src/renderers/dom/host/overflow-fade-px.ts +2 -0
  213. package/src/renderers/dom/host/overflow-fade.ts +1 -2
  214. package/src/renderers/dom/styles.css +25 -5
  215. package/src/renderers/electrobun/view/cli-pane-shot-entry.tsx +2 -1
  216. package/src/series/types.ts +2 -0
  217. package/src/sources/gloomberb-cloud/fred-attribution.ts +86 -0
  218. package/src/sources/gloomberb-cloud/index.ts +25 -1
  219. package/src/sources/gloomberb-cloud/normalizers.ts +22 -3
  220. package/src/sources/provider-errors.ts +64 -1
  221. package/src/sources/provider-router/batches.ts +19 -0
  222. package/src/sources/provider-router/index.ts +7 -1
  223. package/src/state/app/context/index.tsx +24 -1
  224. package/src/state/pane-unsent-work.ts +47 -0
  225. package/src/test-support/shell-pane-keys.tsx +5 -0
  226. package/src/test-support/telemetry-guard.ts +83 -0
  227. package/src/test-support/test-env.ts +12 -0
  228. package/src/theme/colors.ts +17 -1
  229. package/src/theme/ui-tokens.ts +50 -1
  230. package/src/tickers/listing-venues.ts +11 -1
  231. package/src/tickers/search/japanese-names.json +1 -0
  232. package/src/tickers/search/japanese-names.ts +152 -0
  233. package/src/tickers/terminal-codes.ts +55 -6
  234. package/src/time-series/base-series.ts +3 -0
  235. package/src/types/data-provider.ts +6 -0
  236. package/src/types/financials.ts +11 -0
  237. package/src/types/plugin-contributions.ts +7 -0
  238. package/src/types/plugin-panes.ts +7 -0
  239. package/src/ui/host.tsx +6 -0
  240. package/src/utils/double-escape-close.ts +42 -0
  241. package/src/utils/fx-status.ts +30 -7
  242. package/src/utils/network-failure.ts +23 -0
@@ -5,14 +5,16 @@ import { usePaneRefreshKey } from "../../../components/data-table/table-pane";
5
5
  import { useThemeColors } from "../../../theme/theme-context";
6
6
  import { Box, ScrollBox, Text, useRendererHost, useUiCapabilities, type ScrollBoxRenderable } from "../../../ui";
7
7
  import { fetchAward, loadAward } from "./client";
8
- import { awardPeriod, awardTypeLabel, money } from "./model";
8
+ import { amountWithheld, awardPeriod, awardTypeLabel, money, statementText, WITHHELD_AMOUNT } from "./model";
9
9
  import { UpgradeLabel } from "../shared/locked-rows";
10
10
 
11
- export function AwardDetail({ row, accessKey, width, height, focused, openAward, openChildren, openUpgrade, attribution }: {
11
+ export function AwardDetail({ row, accessKey, width, height, focused, openAward, openChildren, openUpgrade, attribution: boardAttribution, amountNotice: boardAmountNotice }: {
12
12
  row: AwardRow; accessKey: string; width: number; height: number; focused: boolean; openAward: (id: string) => void;
13
13
  openChildren: (type: "subaward" | "modification") => void; openUpgrade: () => void;
14
14
  /** The statement the award's source licence asks for wherever its data is shown. */
15
15
  attribution?: string;
16
+ /** How the award's source's amounts read, when it withholds some (GeBIZ). */
17
+ amountNotice?: string;
16
18
  }) {
17
19
  const colors = useThemeColors();
18
20
  const host = useRendererHost();
@@ -30,6 +32,11 @@ export function AwardDetail({ row, accessKey, width, height, focused, openAward,
30
32
  usePaneRefreshKey(resource.reload, { focused });
31
33
  const loaded = resource.pages[0], detail = loaded?.payload;
32
34
  const current = detail?.row ?? row;
35
+ // The board's statements, else the ones the award's own read carries.
36
+ const attribution = statementText(boardAttribution) || statementText(detail?.attribution);
37
+ const amountNotice = statementText(boardAmountNotice) || statementText(detail?.amountNotice);
38
+ // Withheld by the award's own reason (GeBIZ's "under S$6,000"); an amount never printed stays unreported.
39
+ const withheld = amountWithheld(current);
33
40
  const scrollRef = useRef<ScrollBoxRenderable | null>(null);
34
41
  const loadMore = useTableLoadMore(scrollRef, resource.hasMore, resource.loadMore);
35
42
  usePaneStatusFooter({ registrationId: "awards:detail", loading: resource.loading || resource.loadingMore, error: resource.error?.message ?? resource.moreError?.message, stale: loaded?.stale });
@@ -37,10 +44,11 @@ export function AwardDetail({ row, accessKey, width, height, focused, openAward,
37
44
  const labelWidth = width < 85 ? 18 : 23;
38
45
  return <ScrollBox ref={scrollRef} scrollY width={width} height={desktop ? undefined : height} flexGrow={1} flexBasis={0} contentOptions={{ paddingX: 1 }} onMouseScroll={loadMore}>
39
46
  <StatGrid width={Math.max(1, width - 2)} items={[
40
- { id: "value", label: `Value (${current.currency})`, value: money(current.awardAmount), detail: current.fieldAsOf?.awardAmount ? `as of ${current.fieldAsOf.awardAmount.slice(0, 10)}` : undefined },
47
+ { id: "value", label: `Value (${current.currency})`, value: withheld ? WITHHELD_AMOUNT : money(current.awardAmount), detail: withheld ?? (current.fieldAsOf?.awardAmount ? `as of ${current.fieldAsOf.awardAmount.slice(0, 10)}` : undefined) },
41
48
  { id: "obligated", label: `Obligated (${current.currency})`, value: money(current.obligatedAmount), detail: current.fieldAsOf?.obligatedAmount ? `as of ${current.fieldAsOf.obligatedAmount.slice(0, 10)}` : undefined },
42
49
  { id: "ceiling", label: `Ceiling (${current.currency})`, value: money(current.ceilingAmount), detail: current.fieldAsOf?.ceilingAmount ? `as of ${current.fieldAsOf.ceilingAmount.slice(0, 10)}` : undefined },
43
50
  ]} />
51
+ {withheld && amountNotice ? <Text fg={colors.textDim} width={width - 2} wrapMode="word" wrapText>{amountNotice}</Text> : null}
44
52
  <Section title="Contract" width={width - 2}>
45
53
  <KeyValueRow label="Awardee" value={current.recipient.name} labelWidth={labelWidth} />
46
54
  <KeyValueRow label={current.entity?.parentName && current.entity.parentName !== current.recipient.name ? "Listed parent" : "Listed company"} value={current.entity ? `${current.entity.ticker} · ${current.entity.parentName ?? current.entity.legalName}` : "Unresolved"} labelWidth={labelWidth} />
@@ -85,7 +93,7 @@ export function AwardDetail({ row, accessKey, width, height, focused, openAward,
85
93
  <KeyValueRow label="Record" value={revision.id} detail={revision.supersedes ? `Supersedes ${revision.supersedes}` : "Original observation"} labelWidth={labelWidth} />
86
94
  <KeyValueRow label="Awardee" value={revision.award.recipient.name} labelWidth={labelWidth} />
87
95
  <KeyValueRow label="Agency" value={revision.award.agency.name} labelWidth={labelWidth} />
88
- <KeyValueRow label="Award date / value" value={`${revision.award.awardDate} · ${revision.award.currency} ${money(revision.award.awardAmount)}`} labelWidth={labelWidth} />
96
+ <KeyValueRow label="Award date / value" value={`${revision.award.awardDate} · ${amountWithheld(revision.award) ? WITHHELD_AMOUNT : `${revision.award.currency} ${money(revision.award.awardAmount)}`}`} labelWidth={labelWidth} />
89
97
  <KeyValueRow label="Performance period" value={`${revision.award.periodStart ?? "--"} / ${revision.award.periodEnd ?? "--"}`} labelWidth={labelWidth} />
90
98
  <Text fg={colors.textDim} width={width - 2} wrapMode="word" wrapText>{revision.award.title}</Text>
91
99
  {revision.award.evidenceQuote ? <Text fg={colors.text} width={width - 2} wrapMode="word" wrapText>{revision.award.evidenceQuote}</Text> : null}
@@ -4,7 +4,8 @@ import type { HeadlessBundleSection, HeadlessPaneColumn, HeadlessPaneContext, He
4
4
  import { DATE_OPTION_EXAMPLES, isoDateOption } from "../../../utils/calendar-date";
5
5
  import { resolveHeadlessInstrument } from "../shared/headless-market-data";
6
6
  import { fetchAward, fetchAwards } from "./client";
7
- import { AWARD_TABS, awardsAttributions, awardScope, awardsCoverageNotes, awardsEmptyReason, awardsPreviewNote, awardTypeLabel, futureAwardDatesNote, money } from "./model";
7
+ import { AWARD_TABS, amountWithheld, awardsAmountNotices, awardsAttributions, awardScope, awardsCoverageNotes, awardsEmptyReason, awardsPreviewNote, awardTypeLabel,
8
+ futureAwardDatesNote, money, statementText, WITHHELD_AMOUNT } from "./model";
8
9
  import { REPORT_PAGE, REPORT_ROWS } from "../shared/headless-options";
9
10
 
10
11
  /**
@@ -23,7 +24,15 @@ async function notATicker(ticker: string, ctx: HeadlessPaneContext): Promise<str
23
24
  }
24
25
  }
25
26
 
27
+ /** Marks a value its source withholds (GeBIZ's "under S$6,000"), with why; never an unreported one. */
28
+ const withheldFields = (row: Pick<AwardRow, "awardAmount" | "amountWithheld">) => {
29
+ const why = amountWithheld(row);
30
+ return why ? { valueWithheld: true, amountWithheld: why } : {};
31
+ };
32
+
33
+ /** An award as a report row; `valueWithheld` marks a value its source withholds (GeBIZ), never an unreported one. */
26
34
  const awardRecord = (row: AwardRow) => ({ id: row.id, date: row.awardDate, dateBasis: row.dateBasis ?? "award", dataBasis: row.dataBasis ?? null,
35
+ ...withheldFields(row),
27
36
  fieldAsOf: row.fieldAsOf ?? null, fieldSourceUrls: row.fieldSourceUrls ?? null, recipient: row.recipient.name, ticker: row.entity?.ticker ?? null,
28
37
  classifications: row.classifications ?? [],
29
38
  agency: row.agency.name, jurisdiction: row.jurisdiction, type: row.awardType, currency: row.currency,
@@ -52,7 +61,7 @@ const dateBasis = (value: unknown) => value === "period-start" ? "Period start"
52
61
  const comparison = (row: HeadlessPaneRow) => row.revenueComparison as { awardAmount?: string; annualRevenue?: string; basis?: string; periodEnd?: string } | null;
53
62
  const FEED_COLUMNS: HeadlessPaneColumn[] = [
54
63
  { key: "date", header: "Date" }, { key: "recipient", header: "Awardee" }, { key: "ticker", header: "Ticker" }, { key: "currency", header: "CCY" },
55
- amount("value", "Value"), amount("obligated", "Obligated"), amount("ceiling", "Ceiling"), { key: "agency", header: "Agency" }, { key: "jurisdiction", header: "Country" },
64
+ { ...amount("value", "Value"), textFormat: (value, row) => value == null && row.valueWithheld ? WITHHELD_AMOUNT : money(value as string | null) }, amount("obligated", "Obligated"), amount("ceiling", "Ceiling"), { key: "agency", header: "Agency" }, { key: "jurisdiction", header: "Country" },
56
65
  { key: "performancePeriod", header: "Performance period", format: period }, { key: "title", header: "Contract" }, { key: "dateBasis", header: "Date basis", format: dateBasis },
57
66
  ];
58
67
  const EVENT_COLUMNS: HeadlessPaneColumn[] = [
@@ -71,7 +80,9 @@ const aggregateColumns = (label: string): HeadlessPaneColumn[] => [{ key: "label
71
80
  const LEADER_COLUMNS: HeadlessPaneColumn[] = [{ key: "label", header: "Company" }, { key: "ticker", header: "Ticker" }, { key: "currency", header: "CCY" }, share,
72
81
  amount("awardAmount", "Value"), amount("obligatedAmount", "Obligated"), count, { key: "sector", header: "Sector" }, amount("ceilingAmount", "Ceiling"), scope];
73
82
  const REVISION_COLUMNS: HeadlessPaneColumn[] = [{ key: "observedAt", header: "Observed" }, { key: "sourceUpdatedAt", header: "Source updated" }, { key: "supersedes", header: "Supersedes" },
74
- nested((row) => (row.award as AwardRow | undefined)?.awardAmount, "awardAmount", "Value"), nested((row) => (row.award as AwardRow | undefined)?.obligatedAmount, "obligatedAmount", "Obligated"),
83
+ { ...nested((row) => (row.award as AwardRow | undefined)?.awardAmount, "awardAmount", "Value"),
84
+ textFormat: (_value, row) => row.valueWithheld ? WITHHELD_AMOUNT : money((row.award as AwardRow | undefined)?.awardAmount ?? null) },
85
+ nested((row) => (row.award as AwardRow | undefined)?.obligatedAmount, "obligatedAmount", "Obligated"),
75
86
  { key: "award", header: "Contract", format: (value) => text((value as AwardRow | undefined)?.title) }];
76
87
  const EDGE_COLUMNS: HeadlessPaneColumn[] = [{ key: "kind", header: "Kind" }, { key: "from", header: "From", format: (value) => text((value as { name?: string } | null)?.name) },
77
88
  { key: "to", header: "To", format: (value) => text((value as { name?: string } | null)?.name) }, { key: "currency", header: "CCY" }, amount("amount", "Amount"), { key: "awardId", header: "Award" }];
@@ -101,10 +112,15 @@ export const awardsHeadless: HeadlessPaneDefinition<"bundle"> = {
101
112
  async load(args, ctx) {
102
113
  if (args.options.award) {
103
114
  const detail = await fetchAward(String(args.options.award), ctx.apiClient, ctx.signal, args.options.revisionsCursor ? String(args.options.revisionsCursor) : undefined);
115
+ // The award's source's statements: its licence's, and how its amounts read when one it prints is withheld.
116
+ const withheld = [detail.row, ...detail.revisions.map((revision) => revision.award), ...detail.subawards, ...detail.modifications]
117
+ .some((row) => row && amountWithheld(row));
118
+ const notes = [statementText(detail.attribution), withheld ? statementText(detail.amountNotice) : ""].filter(Boolean);
104
119
  return { complete: !detail.locked && !detail.nextRevisionsCursor && !Object.values(detail.truncated ?? {}).some(Boolean), sections: [{ title: "Award", columns: FEED_COLUMNS, rows: detail.row ? [awardRecord(detail.row)] : [] },
105
- { title: "Revisions", columns: REVISION_COLUMNS, rows: detail.revisions.map((row) => ({ ...row })) },
120
+ { title: "Revisions", columns: REVISION_COLUMNS, rows: detail.revisions.map((row) => ({ ...row, ...withheldFields(row.award) })) },
106
121
  { title: "Subawards", columns: FEED_COLUMNS, rows: detail.subawards.map(awardRecord) }, { title: "Modifications", columns: FEED_COLUMNS, rows: detail.modifications.map(awardRecord) },
107
- { title: "Relationships", columns: EDGE_COLUMNS, rows: detail.edges.map((row) => ({ ...row })) }], metadata: { access: detail.access, locked: detail.locked, nextRevisionsCursor: detail.nextRevisionsCursor, truncated: detail.truncated } };
122
+ { title: "Relationships", columns: EDGE_COLUMNS, rows: detail.edges.map((row) => ({ ...row })) }], ...(notes.length ? { notes } : {}),
123
+ metadata: { access: detail.access, locked: detail.locked, nextRevisionsCursor: detail.nextRevisionsCursor, truncated: detail.truncated } };
108
124
  }
109
125
  const filter: AwardFilter = { ticker: args.rawArgument.trim().toUpperCase() || undefined, awardType: args.options.type as AwardFilter["awardType"], limit: Number(args.options.limit ?? 100) };
110
126
  for (const key of [...FILTER_KEYS, "cursor"] as const) if (args.options[key]) filter[key] = String(args.options[key]);
@@ -118,15 +134,20 @@ export const awardsHeadless: HeadlessPaneDefinition<"bundle"> = {
118
134
  const printed = [...(["feed", "company", "all"].includes(tab) ? data.rows : []), ...(["company", "all"].includes(tab) ? data.history : []),
119
135
  ...(["agencies", "all"].includes(tab) ? data.agencies : []), ...(["sectors", "all"].includes(tab) ? [...(data.leaders ?? []), ...data.sectors] : []),
120
136
  ...(["events", "all"].includes(tab) ? data.alerts : [])];
121
- const notes = [...awardsCoverageNotes(data), ...(futureDates ? [futureDates] : []), ...awardsAttributions(data, printed.map((row) => row.source))];
137
+ const record = awardRecord;
138
+ // How a withheld value reads, under the awards that print one.
139
+ const withheld = [...(["feed", "company", "all"].includes(tab) ? data.rows : []), ...(["events", "all"].includes(tab) ? data.alerts : [])]
140
+ .filter((row) => amountWithheld(row)).map((row) => row.source);
141
+ const notes = [...awardsCoverageNotes(data), ...(futureDates ? [futureDates] : []), ...awardsAttributions(data, printed.map((row) => row.source)),
142
+ ...awardsAmountNotices(data, withheld)];
122
143
  const empty = awardsEmptyReason(data);
123
144
  const sections: HeadlessBundleSection[] = [];
124
- if (tab === "feed" || tab === "company" || tab === "all") sections.push({ title: "Awards", columns: FEED_COLUMNS, rows: data.rows.map(awardRecord) });
145
+ if (tab === "feed" || tab === "company" || tab === "all") sections.push({ title: "Awards", columns: FEED_COLUMNS, rows: data.rows.map(record) });
125
146
  if (tab === "company" || tab === "all") sections.push({ title: "Award cohorts by month and currency", columns: COHORT_COLUMNS, rows: data.history.map((row) => ({ ...row })) });
126
147
  if (tab === "agencies" || tab === "all") sections.push({ title: "Agency concentration", columns: aggregateColumns("Agency"), rows: data.agencies.map((row) => ({ ...row })) });
127
148
  if (tab === "sectors" || tab === "all") sections.push({ title: "Sector company leaders", columns: LEADER_COLUMNS, rows: (data.leaders ?? []).map((row) => ({ ...row })) },
128
149
  { title: "Sector totals", columns: aggregateColumns("Sector"), rows: data.sectors.map((row) => ({ ...row })) });
129
- if (tab === "events" || tab === "all") sections.push({ title: "Awards relative to annual revenue", columns: EVENT_COLUMNS, rows: data.alerts.map(awardRecord) });
150
+ if (tab === "events" || tab === "all") sections.push({ title: "Awards relative to annual revenue", columns: EVENT_COLUMNS, rows: data.alerts.map(record) });
130
151
  return { complete: !data.locked && !data.nextCursor && data.status === "available" && !Object.values(data.truncated ?? {}).some(Boolean), sections,
131
152
  // Collection health is what the awards may be missing, a coverage note; only a failure is an error.
132
153
  ...(notes.length ? { notes } : {}),
@@ -91,9 +91,43 @@ export function awardsCoverageNotes(data: Pick<AwardsPayload, "gaps">): string[]
91
91
  * award's detail and `fn AWARDS` print them under the awards they cover.
92
92
  */
93
93
  export function awardsAttributions(data: Pick<AwardsPayload, "sources"> | undefined, shown: Iterable<string>): string[] {
94
+ return sourceStatements(data, shown, "attribution");
95
+ }
96
+
97
+ /**
98
+ * How the amounts of the sources shown read, each once: GeBIZ's says it
99
+ * withholds an amount under S$6,000 or one that several suppliers of a tender
100
+ * print alike. The award's detail and `fn AWARDS` print them beside a
101
+ * withheld value.
102
+ */
103
+ export function awardsAmountNotices(data: Pick<AwardsPayload, "sources"> | undefined, shown: Iterable<string>): string[] {
104
+ return sourceStatements(data, shown, "amountNotice");
105
+ }
106
+
107
+ function sourceStatements(data: Pick<AwardsPayload, "sources"> | undefined, shown: Iterable<string>, key: "attribution" | "amountNotice"): string[] {
94
108
  const sources = new Set(shown);
95
- return [...new Set((data?.sources ?? []).flatMap((source) =>
96
- sources.has(source.source) && typeof source.attribution === "string" && source.attribution.trim() ? [source.attribution.trim()] : []))];
109
+ return [...new Set((data?.sources ?? []).flatMap((source) => {
110
+ const statement = source[key];
111
+ return sources.has(source.source) && typeof statement === "string" && statement.trim() ? [statement.trim()] : [];
112
+ }))];
113
+ }
114
+
115
+ /** What an award's value reads when its source withholds it, never 0 and never the unreported mark. */
116
+ export const WITHHELD_AMOUNT = "withheld";
117
+
118
+ /**
119
+ * Why an award's value is withheld by its source rather than unreported, or
120
+ * null: the award's own reason (GeBIZ's "under S$6,000"), never its source's,
121
+ * so an amount the source never printed still reads unreported.
122
+ */
123
+ export function amountWithheld(row: Pick<AwardRow, "awardAmount" | "amountWithheld">): string | null {
124
+ const why = row.amountWithheld;
125
+ return row.awardAmount == null && typeof why === "string" && why.trim() ? why.trim() : null;
126
+ }
127
+
128
+ /** A source's statement as served, or nothing: an older or malformed answer's non-string is never read as one. */
129
+ export function statementText(value: unknown): string {
130
+ return typeof value === "string" ? value.trim() : "";
97
131
  }
98
132
 
99
133
  /** Award dates after the response's own date are the source's, not a mapping slip; they say so instead of passing as past awards. */
@@ -25,8 +25,8 @@ import { AwardDetail } from "./detail";
25
25
  import { useAwardAlerts } from "./alerts";
26
26
  import { AWARDS_UNAVAILABLE, fetchAwards, loadAward, loadAwards, validateAwards } from "./client";
27
27
  import { useAwardsEvidence } from "./evidence";
28
- import { AWARD_TABS, aggregateId, awardHistorySeries, awardPercent, awardPeriod, awardsAttributions, awardScope, awardsCoverageNotes, awardsPreviewNote, awardTab, awardTypeLabel,
29
- futureAwardDatesNote, money, rankedAggregates } from "./model";
28
+ import { AWARD_TABS, aggregateId, amountWithheld, awardHistorySeries, awardPercent, awardPeriod, awardsAmountNotices, awardsAttributions, awardScope, awardsCoverageNotes, awardsPreviewNote,
29
+ awardTab, awardTypeLabel, futureAwardDatesNote, money, rankedAggregates, WITHHELD_AMOUNT } from "./model";
30
30
  import { logFailure } from "../../../utils/log-failure";
31
31
 
32
32
  type Item = { kind: "award"; row: AwardRow } | { kind: "aggregate"; row: AwardAggregate } | { kind: "leader"; row: AwardCompanyLeader } | { kind: "locked"; id: string }
@@ -202,6 +202,7 @@ function AwardsView({ width, height, focused, symbol }: PaneProps & { symbol: st
202
202
  const attribution = awardsAttributions(data, shown.flatMap((item) => item.kind === "award" || item.kind === "aggregate" || item.kind === "leader" ? [item.row.source] : [])).join(" ");
203
203
  const attributionRows = attribution ? wrapTextLines(attribution, Math.max(1, width - 2)).length : 0;
204
204
  const openAttribution = openRow ? awardsAttributions(data, [openRow.source]).join(" ") : "";
205
+ const openAmountNotice = openRow ? awardsAmountNotices(data, [openRow.source]).join(" ") : "";
205
206
  const { strip, rows: tabRows } = usePaneTabs(!denied ? { tabs: [...AWARD_TABS], activeValue: tab, onSelect: (value) => { setTab(value); setOpen(null); }, focused, dense: true } : null);
206
207
  const bodyHeight = Math.max(3, height - tabRows);
207
208
  const filters: QueryBarFilter[] = [
@@ -231,7 +232,7 @@ function AwardsView({ width, height, focused, symbol }: PaneProps & { symbol: st
231
232
  return <Box width={width} height={height} flexDirection="column">
232
233
  {strip}
233
234
  <PageStackView focused={focused} detailOpen={!!openId} onBack={() => setOpen(null)} detailTitle={openRow ? truncateToDisplayWidth(openRow.title, Math.max(20, width - 16)) : "Award evidence"}
234
- detailContent={openRow ? <AwardDetail key={openRow.id} row={openRow} accessKey={accessKey} width={width} height={bodyHeight - 1} focused={focused} openAward={setOpen} openUpgrade={openUpgrade} attribution={openAttribution}
235
+ detailContent={openRow ? <AwardDetail key={openRow.id} row={openRow} accessKey={accessKey} width={width} height={bodyHeight - 1} focused={focused} openAward={setOpen} openUpgrade={openUpgrade} attribution={openAttribution} amountNotice={openAmountNotice}
235
236
  openChildren={(type) => { setParentId(openRow.id); setTicker(""); setSource(""); setQuery(""); setAgency(""); setSector(""); setCurrency(""); setJurisdiction(""); setRange("all"); setType(type); setOpen(null); setTab("feed"); }} />
236
237
  : <PaneStatusBody loading={detail.loading} error={detail.error} empty={!detail.loading && !detail.error} emptyTitle="Award no longer available." subject="award evidence" />}
237
238
  rootContent={<DataTableView<Item> columns={columns} items={tab === "company" && !ticker ? [] : items} rootWidth={width} rootHeight={bodyHeight}
@@ -261,7 +262,9 @@ function AwardsView({ width, height, focused, symbol }: PaneProps & { symbol: st
261
262
  if (column.id === "currency") return { text: row.currency, color: colors.textDim };
262
263
  if (["value", "obligated", "ceiling"].includes(column.id)) {
263
264
  const value = column.id === "value" ? tab === "events" && item.kind === "award" ? item.row.revenueComparison?.awardAmount : row.awardAmount : column.id === "obligated" ? row.obligatedAmount : row.ceilingAmount;
264
- return value == null ? missingCell(colors) : { text: money(value), value, color: column.id === "obligated" || column.id === "value" ? colors.textBright : colors.text };
265
+ if (value == null) return column.id === "value" && item.kind === "award" && tab !== "events" && amountWithheld(item.row)
266
+ ? { text: WITHHELD_AMOUNT, value: null, color: colors.textMuted } : missingCell(colors);
267
+ return { text: money(value), value, color: column.id === "obligated" || column.id === "value" ? colors.textBright : colors.text };
265
268
  }
266
269
  if (item.kind === "aggregate" || item.kind === "leader") {
267
270
  if (column.id === "label") return { text: item.row.label, color: colors.textBright };
@@ -369,6 +369,7 @@ export const brokerManagerModule: PluginModule = {
369
369
  reportFreshness: { status: "not-a-feed", basis: "broker connections", local: true },
370
370
  defaultPosition: "right",
371
371
  defaultMode: "floating",
372
+ utilityWindow: true,
372
373
  defaultFloatingSize: { width: 92, height: 24 },
373
374
  portableShare: {
374
375
  private: { title: true, params: true, settings: true, state: true },
@@ -19,7 +19,7 @@ const INSTRUMENT_CATEGORY: Record<string, string> = { option: "OPT", future: "FU
19
19
  export const brokerTradingModule: PluginModule = {
20
20
  panes: [{
21
21
  id: "broker-orders", name: "Orders", personalData: "account", icon: "O", component: BrokerOrdersPane,
22
- defaultPosition: "right", defaultMode: "floating",
22
+ defaultPosition: "right", defaultMode: "floating", utilityWindow: true,
23
23
  defaultFloatingSize: { width: 100, height: 30 }, headless: brokerOrdersHeadless,
24
24
  portableShare: { private: { title: true, params: true, settings: true, state: true } },
25
25
  }],
@@ -2,7 +2,8 @@ import type { HeadlessPaneColumn, HeadlessPaneDefinition } from "../../../types/
2
2
  import { CENTRAL_BANKS, centralBankNames } from "../../../utils/central-banks";
3
3
  import { fetchCentralBankRates } from "./client";
4
4
  import {
5
- hasNoPolicyRate, policyExportRow, policyLastDecisionText, policyNextMeetingText, policyNotices, policyRate, policyUnlistedNote,
5
+ hasNoPolicyRate, policyExportRow, policyLastDecisionText, policyNextMeetingText, policyNotices, policyObservations, policyRate,
6
+ policyUnlistedNote,
6
7
  } from "./model";
7
8
 
8
9
  /**
@@ -43,17 +44,16 @@ export const centralBankRatesHeadless: HeadlessPaneDefinition<"bundle"> = {
43
44
  "Next meetings come from each bank's published calendar; SAMA publishes none, and China's date is the monthly LPR fixing."] },
44
45
  shape: "bundle",
45
46
  options: [{ key: "history", shot: { reportOnly: "adds each row's one-year history to the JSON report" }, type: "boolean", defaultValue: false, description: "Add each row's one-year daily history to the JSON metadata." }],
46
- argument: { kind: "none" }, describe: "Policy rates of the G20, SNB, Norges Bank, Riksbank and RBNZ",
47
+ argument: { kind: "none" }, describe: "Policy rates of the G20, SNB, Norges Bank, Riksbank, RBNZ, Egypt and Nigeria",
47
48
  // Each row is dated apart (BIS reports weekly, some banks weeks late), so exports cite the oldest as well.
48
- freshness: { source: "BIS and FRED", publisher: "each row's central_bank, via BIS and FRED", status: "not-a-feed",
49
+ freshness: { source: "BIS, FRED and central banks", publisher: "each row's central_bank, via BIS, FRED or its own published decisions", status: "not-a-feed",
49
50
  basis: "published policy rates", citeOldest: true },
50
51
  async load(args, ctx) {
51
52
  const data = await fetchCentralBankRates(ctx.apiClient);
52
53
  const errors = policyNotices(data);
53
54
  const complete = data.status === "available" && errors.length === 0;
54
- // A row says "stale" in its status, not in a `stale` flag: hand the report its rows' staleness so its status line and a capture count them.
55
- const observations = data.rows.filter((row) => row.status !== "unavailable")
56
- .map((row) => ({ asOf: row.asOf, stale: row.status === "stale" }));
55
+ // Hand the report its rows' staleness so its status line and a capture count them.
56
+ const observations = policyObservations(data);
57
57
  // Members with no policy rate stay off the board, as the pane keeps them, so every output counts the same rows; a note says why.
58
58
  const listed = data.rows.filter((row) => !hasNoPolicyRate(row));
59
59
  const exported = listed.map(policyExportRow);
@@ -10,7 +10,7 @@ export const centralBankRatesModule: PluginModule = {
10
10
  tableExport: true, headless: centralBankRatesHeadless }],
11
11
  paneTemplates: [{
12
12
  id: "central-bank-rates-cbr", paneId: "central-bank-rates", label: "Central Bank Rates",
13
- description: "Policy rates of the G20, SNB, Norges Bank, Riksbank and RBNZ, last observed changes and dated historical context.",
13
+ description: "Policy rates of the G20, SNB, Norges Bank, Riksbank, RBNZ, Egypt and Nigeria, last observed changes and dated historical context.",
14
14
  keywords: ["central", "bank", "policy", "rates", "g20", "cbr", "cbrt"], shortcut: { prefix: "CBR", aliases: ["CBRT"] },
15
15
  headless: centralBankRatesHeadless,
16
16
  }],
@@ -16,6 +16,14 @@ export const policyChangeDate = (row: CentralBankRow) => row.lastDecision?.date
16
16
  /** Members with no policy rate to publish, kept out of the board and the notices; docs/research-data.md explains them. */
17
17
  export const hasNoPolicyRate = (row: CentralBankRow) => row.status === "unavailable"
18
18
  && (row.unavailableReason === "no-policy-rate" || row.unavailableReason === "no-unified-rate");
19
+ /**
20
+ * Each listed row's date, and whether it is stale, as the report and the pane's footer date the board: a row says
21
+ * "stale" in its status, not in a `stale` flag.
22
+ */
23
+ export function policyObservations(data: CentralBankRatesPayload): { asOf: string | null; stale: boolean }[] {
24
+ return data.rows.filter((row) => row.status !== "unavailable").map((row) => ({ asOf: row.asOf, stale: row.status === "stale" }));
25
+ }
26
+
19
27
  export function policyNotices(data: CentralBankRatesPayload): string[] {
20
28
  return data.rows.filter((row) => !hasNoPolicyRate(row)).flatMap((row) => row.status === "stale" ? [`${row.label}: stale, latest observation ${row.asOf ?? "unknown"}${row.lagDays == null ? "" : ` (${row.lagDays} days old)`}.`]
21
29
  : row.status === "unavailable" ? [`${row.label}: ${(row.unavailableReason ?? "unavailable").replaceAll("-", " ")}.`] : []);
@@ -36,8 +44,14 @@ export function policyBoardRow(row: CentralBankRow): PolicyBoardRow {
36
44
 
37
45
  const SOURCE_LABELS = { bis: "BIS", fred: "FRED" } as const;
38
46
 
39
- /** Where the row's series is read from: `BIS` or `FRED`. */
40
- const policySource = (row: CentralBankRow) => row.source ? SOURCE_LABELS[row.source] : null;
47
+ /**
48
+ * A bank neither BIS nor FRED reports (Egypt's, Nigeria's): its level is read
49
+ * from its own published decisions, on the page `sourceUrl` names.
50
+ */
51
+ const ownPublication = (row: CentralBankRow) => row.source == null && row.sourceUrl != null && row.centralBank != null;
52
+
53
+ /** Where the row's series is read from: `BIS`, `FRED`, or the bank itself. */
54
+ export const policySource = (row: CentralBankRow) => row.source ? SOURCE_LABELS[row.source] : ownPublication(row) ? row.centralBank : null;
41
55
 
42
56
  /** Each series' own page: one per FRED series (both bounds of the US range), the country's for BIS. */
43
57
  function policySeriesUrls(row: CentralBankRow): string[] {
@@ -47,6 +61,7 @@ function policySeriesUrls(row: CentralBankRow): string[] {
47
61
 
48
62
  /** `BIS series D.GB (url)`; a two-series range cites each bound: `FRED series DFEDTARL (lower bound, url) and DFEDTARU (upper bound, url)`. */
49
63
  function seriesCitation(row: CentralBankRow): string | null {
64
+ if (ownPublication(row)) return `${row.centralBank}'s published decisions (${row.sourceUrl})`;
50
65
  const source = policySource(row);
51
66
  const ids = row.sourceSeriesIds;
52
67
  const urls = policySeriesUrls(row);
@@ -67,7 +82,9 @@ export function policyCitation(row: CentralBankRow): string {
67
82
  : `${row.instrument}: no current observation (${(row.unavailableReason ?? "unavailable").replaceAll("-", " ")})`;
68
83
  return series ? `${missing}, ${series}` : missing;
69
84
  }
70
- const confirmed = row.confirmedAt && row.confirmationSourceUrl ? `; confirmed at ${row.confirmationSourceUrl} on ${row.confirmedAt.slice(0, 10)}` : "";
85
+ // A bank's own page is its source; it is not cited again as confirming itself.
86
+ const confirmed = row.confirmedAt && row.confirmationSourceUrl && row.confirmationSourceUrl !== row.sourceUrl
87
+ ? `; confirmed at ${row.confirmationSourceUrl} on ${row.confirmedAt.slice(0, 10)}` : "";
71
88
  return `${row.instrument} ${policyLevel(row)}${series ? `, ${series}` : ""}, as of ${row.asOf}${confirmed}`;
72
89
  }
73
90
 
@@ -155,6 +172,7 @@ export function policyUnlistedNote(row: CentralBankRow): string {
155
172
 
156
173
  /** Who a chart of the row's series cites: `FRED series ECBDFR`, published by the European Central Bank. */
157
174
  export function policySeriesAttribution(row: CentralBankRow): { source: string; publisher?: string } | null {
175
+ if (ownPublication(row)) return { source: `${row.centralBank}'s published decisions`, publisher: row.centralBank! };
158
176
  const source = policySource(row);
159
177
  if (!source || row.sourceSeriesIds.length === 0) return null;
160
178
  return { source: `${source} series ${row.sourceSeriesIds.join(" and ")}`, ...(row.centralBank ? { publisher: row.centralBank } : {}) };
@@ -13,7 +13,12 @@ import { formatPercentileRank } from "../../../utils/format";
13
13
  import { usePaneRefreshKey } from "../../../components/data-table/table-pane";
14
14
  import { useResearchCloudSession } from "../shared/research-cloud-session";
15
15
  import { getCachedCentralBankRates, loadCentralBankRates } from "./client";
16
- import { hasNoPolicyRate, policyBoardRow, policyChange, policyChangeDate, policyHistory, policyLevel, policyNotices, policyRate } from "./model";
16
+ import { centralBankRatesHeadless } from "./headless";
17
+ import { reportFooterSegment } from "../shared/source-footer";
18
+ import {
19
+ hasNoPolicyRate, policyBoardRow, policyChange, policyChangeDate, policyHistory, policyLevel, policyNotices, policyObservations, policyRate,
20
+ policySource,
21
+ } from "./model";
17
22
 
18
23
  const PANELS = [{ id: "main" }];
19
24
 
@@ -22,12 +27,15 @@ function PolicyDetail({ row, width, height, focused }: { row: CentralBankRow; wi
22
27
  const series = useMemo(() => [staticSeries(history.map((point) => ({ date: new Date(point.date), observedAt: new Date(point.date), value: point.value })),
23
28
  { id: row.id, label: row.instrument, color: colors.positive, calendarSpaced: true, style: "step" })], [row, history]);
24
29
  const p = row.percentile;
30
+ // A bank whose terms ask it: the figures computed from its rates say so (the CBE's).
31
+ const computed = row.computedFrom ? `computed from ${row.computedFrom}` : null;
25
32
  // The chart shows the rank window, so the range carries no window or sample
26
33
  // count; short details keep the figures several to a row.
27
34
  const items: StatItem[] = [
28
35
  { id: "level", label: row.range ? "Target range" : "Policy rate", value: policyLevel(row),
29
- detail: formatPercentileRank(p.value, "1Y") },
30
- { id: "move", label: "Last change", value: policyChange(row), detail: policyChangeDate(row) ?? undefined },
36
+ detail: [formatPercentileRank(p.value, "1Y"), computed].filter(Boolean).join(" · ") },
37
+ { id: "move", label: "Last change", value: policyChange(row),
38
+ detail: [policyChangeDate(row), computed].filter(Boolean).join(" · ") || undefined },
31
39
  // A target range ranks and charts its midpoint, which the band's range would not say.
32
40
  { id: "range", label: "1Y range", value: `${policyRate(p.min)} to ${policyRate(p.max)}`, detail: row.range ? "midpoint" : undefined },
33
41
  { id: "asOf", label: "As of", value: row.asOf ?? "--", tone: row.status === "stale" ? "warning" : undefined,
@@ -38,7 +46,7 @@ function PolicyDetail({ row, width, height, focused }: { row: CentralBankRow; wi
38
46
  ...row.latestDecision === undefined ? [] : [{ id: "decided", label: row.latestDecision?.kind === "fixing" ? "Last fixing" : "Last decision",
39
47
  value: row.latestDecision?.date ?? "--" }],
40
48
  { id: "meeting", label: row.nextMeeting?.kind === "fixing" ? "Next fixing" : "Next meeting", value: row.nextMeeting?.date ?? "--" },
41
- { id: "source", label: "Source", value: row.source?.toUpperCase() ?? "--", detail: row.sourceSeriesIds.join(", ") || undefined },
49
+ { id: "source", label: "Source", value: policySource(row) ?? "--", detail: row.sourceSeriesIds.join(", ") || undefined },
42
50
  { id: "instrument", label: "Instrument", value: row.instrument, detail: row.centralBank ?? undefined, wide: true },
43
51
  ];
44
52
  return <StatChartDetail items={items} width={width} height={height} empty={!history.some((point) => point.value != null)}
@@ -63,7 +71,9 @@ export function CentralBankRatesPane({ width, height, focused }: PaneProps) {
63
71
  notices: [...(data ? policyNotices(data) : []), ...(resource.data?.refreshError ? [resource.data.refreshError] : [])] });
64
72
  usePaneStatusLinkFooter({ registrationId: "central-bank-rates", focused, loading: resource.loading, error: resource.error,
65
73
  url: selected?.observation.sourceUrl ?? null, showOpenHint: true,
66
- info: data && updatedAgo ? [ageFooterSegment(updatedAgo)] : [],
74
+ // Its sources and the rows' dates, as `fn CBR` ends; how long ago it loaded goes first on a narrow row.
75
+ info: data ? [reportFooterSegment(centralBankRatesHeadless, { sections: [], freshness: { observations: policyObservations(data) } }),
76
+ ...(updatedAgo ? [ageFooterSegment(updatedAgo)] : [])] : [],
67
77
  stale: !!data && resource.data?.stale,
68
78
  });
69
79
  return <Box width={width} height={height} flexDirection="column">
@@ -346,13 +346,17 @@ function releaseDay(value: unknown): string | null {
346
346
  * Who a chart cites when each of its series names its own dataset (CBR's
347
347
  * policy rates: `FRED series ECBDFR`); nothing, so Gloom Cloud, otherwise.
348
348
  */
349
- function seriesAttribution(series: readonly HeadlessSeries[]): Pick<HeadlessPaneFreshness, "source" | "publisher"> {
349
+ function seriesAttribution(series: readonly HeadlessSeries[]): Pick<HeadlessPaneFreshness, "source" | "publisher" | "publishedAt"> {
350
350
  const cited = series.map((entry) => (entry as HeadlessSeries & Pick<ResolvedSeries, "attribution">).attribution);
351
351
  if (!cited.length || cited.some((attribution) => !attribution)) return {};
352
352
  const publishers = [...new Set(cited.map((attribution) => attribution!.publisher))];
353
+ // The chart was published with its last series: the newest publication, when every series says when.
354
+ const published = cited.map((attribution) => attribution!.publishedAt);
355
+ const publishedAt = published.every(Boolean) ? (published as string[]).sort().at(-1) : undefined;
353
356
  return {
354
357
  source: [...new Set(cited.map((attribution) => attribution!.source))].join(", "),
355
358
  ...(publishers.every(Boolean) ? { publisher: publishers.join(", ") } : {}),
359
+ ...(publishedAt ? { publishedAt } : {}),
356
360
  };
357
361
  }
358
362
 
@@ -1313,6 +1313,7 @@ function ChartComposerSurface({
1313
1313
  ...totalReturnFilters,
1314
1314
  ]}
1315
1315
  view={resolutionOptions.length > 1 ? {
1316
+ label: "Interval",
1316
1317
  value: spec.viewport.resolution,
1317
1318
  options: resolutionOptions,
1318
1319
  onChange: (value: string) => setResolution(value as ChartResolution),
@@ -8,6 +8,7 @@ import { useShortcut } from "../../../../react/input";
8
8
  import { blendHex, colors } from "../../../../theme/colors";
9
9
  import { Box, Text, TextAttributes, type InputRenderable } from "../../../../ui";
10
10
  import { countEscapeTowardClose } from "../../../../utils/double-escape-close";
11
+ import { usePaneUnsentWork } from "../../../../state/pane-unsent-work";
11
12
  import { displayWidth } from "../../../../utils/format";
12
13
  import { truncateWithEllipsis } from "../../../../utils/text-wrap";
13
14
  import {
@@ -213,6 +214,9 @@ export function ChatHandlePrompt({
213
214
  menu: [{ id: "handle-not-now", label: t("Hide Handle Prompt"), onSelect: onDismiss }],
214
215
  } : null), [onDismiss, onFocusField, prompt.saving, prompt.visible]);
215
216
 
217
+ // A handle typed and not saved goes with the pane: Esc never closes it over one.
218
+ usePaneUnsentWork(prompt.visible && !prompt.saving && normalizeHandleInput(prompt.value).length > 0);
219
+
216
220
  useShortcut((event) => {
217
221
  if (event.name !== "escape") return;
218
222
  event.preventDefault?.();
@@ -27,7 +27,17 @@ interface ChatControllerRealtimeOptions {
27
27
  invalidateMentionCandidates: () => void;
28
28
  }
29
29
 
30
+ /**
31
+ * After a drop, the full-page reads wait a random moment up to this long. A
32
+ * server restart reconnects every client within about two seconds and each
33
+ * reads a page per channel it shows; spread out, they reach the server as a
34
+ * trickle. Only reactions, edits and removals made during the drop wait for
35
+ * it: the catch-up reads new messages as soon as the socket is back.
36
+ */
37
+ const CHAT_RESYNC_SPREAD_MS = 3_000;
38
+
30
39
  export class ChatControllerRealtime {
40
+ private resyncTimer: ReturnType<typeof setTimeout> | null = null;
31
41
  private verificationPollTimer: ReturnType<typeof setInterval> | null = null;
32
42
  private sessionRetryTimer: ReturnType<typeof setTimeout> | null = null;
33
43
  private safetyRefreshTimer: ReturnType<typeof setInterval> | null = null;
@@ -114,12 +124,18 @@ export class ChatControllerRealtime {
114
124
  }
115
125
  if (!dropped) return;
116
126
  dropped = false;
117
- this.options.resyncChannels();
127
+ if (this.resyncTimer) return;
128
+ this.resyncTimer = setTimeout(() => {
129
+ this.resyncTimer = null;
130
+ this.options.resyncChannels();
131
+ }, Math.random() * CHAT_RESYNC_SPREAD_MS);
118
132
  });
119
133
  }
120
134
  }
121
135
 
122
136
  stopRealtimeSubscriptions(): void {
137
+ if (this.resyncTimer) clearTimeout(this.resyncTimer);
138
+ this.resyncTimer = null;
123
139
  this.mentionCandidatesUnsubscribe?.();
124
140
  this.mentionCandidatesUnsubscribe = null;
125
141
  this.socketConnectionUnsubscribe?.();
@@ -8,6 +8,7 @@ import { ChatBotIcon } from "./person-icons";
8
8
  import { CHAT_PERSON_ICON_WIDTH } from "../people";
9
9
  import { ChatMessageActions, ChatMessageHeader } from "./header";
10
10
  import { Button } from "../../../../components/ui";
11
+ import { useSelectionFill } from "../../../../components/ui/selection-fill";
11
12
  import { canReactToMessage } from "../reactions";
12
13
  import { TerminalChatReactions } from "./reactions";
13
14
  import { TerminalChatMessageRow } from "./inline-tokens";
@@ -54,6 +55,7 @@ export function TerminalChatMessage({
54
55
  }: TerminalChatMessageProps) {
55
56
  const rendererHost = useRendererHost();
56
57
  const slowSend = useSlowPendingSend(msg);
58
+ const selectionFill = useSelectionFill();
57
59
  const canReact = reactionsEnabled && canReactToMessage(msg);
58
60
  const state = getChatMessageRenderState({
59
61
  msg,
@@ -92,7 +94,8 @@ export function TerminalChatMessage({
92
94
  const clearHovered = () => setHoveredIdx((current) => (current === index ? null : current));
93
95
  const messageRowProps = {
94
96
  width: contentWidth,
95
- backgroundColor: state.bgColor,
97
+ // The chosen message is quieter while the chat pane does not have the keys.
98
+ backgroundColor: state.isSelected ? selectionFill.bg : state.bgColor,
96
99
  onMouseOver: setHovered,
97
100
  onMouseOut: clearHovered,
98
101
  };
@@ -11,7 +11,7 @@ import {
11
11
  import { usePaneSidebarReveal } from "../../../components/layout/pane/sidebar";
12
12
  import { Box, Span, Text, useUiCapabilities, type BoxRenderable } from "../../../ui";
13
13
  import { TextAttributes } from "../../../ui";
14
- import { blendHex, colors } from "../../../theme/colors";
14
+ import { colors } from "../../../theme/colors";
15
15
  import { t } from "../../../i18n";
16
16
  import type { ChatChannel } from "../../../api-client";
17
17
  import { truncateWithEllipsis } from "../../../utils/text-wrap";
@@ -199,9 +199,8 @@ export function ChannelSidebar({
199
199
  onResizeEnd: (nextWidth) => chatSidebarStore.commitWidth(nextWidth),
200
200
  } : undefined}
201
201
  >
202
- {({ backgroundColor: sidebarBg, listWidth: sidebarWidth }) => {
203
- // The fill a keyboard-focused sidebar gives the row under its cursor.
204
- const cursorBackground = blendHex(colors.selected, colors.borderFocused, 0.32);
202
+ {({ backgroundColor: sidebarBg, listWidth: sidebarWidth, activeBackgroundColor: cursorBackground }) => {
203
+ // A heading under the cursor takes the fill the sidebar's own rows take there.
205
204
  // Every section reads the same: a caret, a label, and an optional
206
205
  // trailing action, so their channels can all share one indent.
207
206
  const sectionHeader = (listWidth: number, { key, label, fg, unread, expanded, onToggle, action }: {
@@ -44,6 +44,7 @@ import {
44
44
  usePaneAppConfig,
45
45
  } from "../../../../state/app/context";
46
46
  import { usePaneSession, usePaneSessionState } from "../../../../state/pane-session";
47
+ import { usePaneUnsentWork } from "../../../../state/pane-unsent-work";
47
48
  import { useInlineTickers } from "../../../../state/hooks/inline-tickers";
48
49
  import { useRemoteControlHandler } from "../../../../remote/app-host";
49
50
  import { RemoteUiScope } from "../../../../remote/semantic-tree";
@@ -694,6 +695,9 @@ export function ASKGPane({ paneId, focused, width, height }: PaneProps) {
694
695
  : getPaneSidebarWidth(width, !!nativePaneChrome, conversations.width);
695
696
 
696
697
  const running = isTurnRunning(state);
698
+ // The draft lives only as long as the pane does, and an answer coming in
699
+ // would be cut off: Esc never closes the pane over either.
700
+ usePaneUnsentWork(running || inputValue.trim().length > 0, paneId);
697
701
  const confirmation = pendingConfirmation(state);
698
702
  // A tool's approval goes first; the pane's question waits behind it.
699
703
  const paneConsentPending = attached?.consent === "pending" && !confirmation;
@@ -105,6 +105,7 @@ const askgModule: PluginModule = {
105
105
  component: ASKGPane,
106
106
  defaultPosition: "right",
107
107
  defaultMode: "floating",
108
+ utilityWindow: true,
108
109
  defaultFloatingSize: { width: 96, height: 32 },
109
110
  portableShare: {
110
111
  // A conversation and the panes it read are personal to the account.
@@ -31,6 +31,7 @@ export const teamModule: PluginModule = {
31
31
  component: TeamPane,
32
32
  defaultPosition: "right",
33
33
  defaultMode: "floating",
34
+ utilityWindow: true,
34
35
  defaultFloatingSize: { width: 84, height: 30 },
35
36
  portableShare: {
36
37
  private: { title: true, params: true, settings: true, state: true },