gloomberb 0.20.0 → 0.20.2
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.
- package/README.md +16 -26
- package/README.zh-CN.md +21 -65
- package/package.json +1 -1
- package/patches/electrobun-devkit@2.0.5.patch +268 -8
- package/src/account/auth-model.ts +20 -1
- package/src/account/upgrade-dialog.tsx +8 -4
- package/src/api-client/askg.ts +7 -1
- package/src/api-client/auth.ts +27 -0
- package/src/api-client/catalysts.ts +2 -0
- package/src/api-client/company-kpis.ts +2 -1
- package/src/api-client/cot.ts +14 -2
- package/src/api-client/crypto-markets.ts +20 -2
- package/src/api-client/data.ts +3 -2
- package/src/api-client/earnings.ts +46 -3
- package/src/api-client/fund-facts.ts +23 -1
- package/src/api-client/futures-curve.ts +17 -0
- package/src/api-client/index.ts +4 -1
- package/src/api-client/one-tap-reasons.ts +42 -0
- package/src/api-client/perps.ts +2 -1
- package/src/api-client/request.ts +3 -1
- package/src/api-client/research-activity.ts +16 -3
- package/src/api-client/types/filings-and-calls.ts +9 -0
- package/src/api-client/types/search.ts +3 -0
- package/src/app/keybindings/chord.ts +153 -9
- package/src/app/keybindings/index.ts +1 -1
- package/src/app/keybindings/labels.ts +49 -6
- package/src/app/runtime/desktop-deeplink.ts +73 -8
- package/src/app/runtime/plugin-seed.ts +119 -0
- package/src/app/runtime/startup.ts +45 -9
- package/src/app.tsx +8 -1
- package/src/architecture/core-builtin-allowlist.json +1 -2
- package/src/architecture/pane-tabs-allowlist.json +2 -1
- package/src/architecture/shortcut-labels-allowlist.json +11 -0
- package/src/architecture/ui-literals-allowlist.json +8 -8
- package/src/brokers/broker-portfolio-sync.ts +1 -1
- package/src/cli/bank-section.ts +26 -12
- package/src/cli/board-coins.ts +38 -5
- package/src/cli/commands/crypto-hints.ts +8 -1
- package/src/cli/commands/market.ts +294 -100
- package/src/cli/commands/overview.ts +13 -6
- package/src/cli/commands/ticker.ts +73 -21
- package/src/cli/company-name-hint.ts +19 -0
- package/src/cli/desktop-pane-shot-browser.ts +47 -31
- package/src/cli/desktop-pane-shot.ts +15 -0
- package/src/cli/entry.ts +15 -4
- package/src/cli/export-source.ts +7 -1
- package/src/cli/freshness.ts +0 -16
- package/src/cli/fx-pair.ts +64 -12
- package/src/cli/fx-quote-rate.ts +144 -0
- package/src/cli/glossary.ts +30 -0
- package/src/cli/helpers.ts +4 -2
- package/src/cli/history-back-adjust.ts +122 -0
- package/src/cli/history-rows.ts +114 -10
- package/src/cli/index.ts +4 -1
- package/src/cli/known-gaps.ts +45 -3
- package/src/cli/listing-arg.ts +48 -4
- package/src/cli/name-entries.ts +25 -5
- package/src/cli/not-a-ticker.ts +26 -1
- package/src/cli/pane-functions/catalog.ts +12 -2
- package/src/cli/pane-functions/dom.ts +4 -2
- package/src/cli/pane-functions/freshness.ts +45 -29
- package/src/cli/pane-functions/headless.ts +8 -5
- package/src/cli/pane-functions/index.ts +3 -0
- package/src/cli/pane-functions/market-session.ts +14 -5
- package/src/cli/pane-functions/resolver.ts +4 -1
- package/src/cli/pane-functions/screenshot-assessment.ts +15 -3
- package/src/cli/pane-functions/screenshot-payload.ts +130 -66
- package/src/cli/pane-functions/screenshot-render.ts +14 -2
- package/src/cli/pane-functions/screenshot-types.ts +4 -0
- package/src/cli/restore-plugins.ts +164 -51
- package/src/cli/symbol-rows.ts +22 -2
- package/src/cli/ticker-resolution.ts +74 -17
- package/src/components/chart/composite/axis-overlays.tsx +13 -3
- package/src/components/chart/composite/composite-chart.tsx +8 -1
- package/src/components/chart/composite/format.ts +16 -1
- package/src/components/chart/composite/legend.tsx +4 -3
- package/src/components/chart/composite/panel-labels.ts +2 -1
- package/src/components/chart/composite/panel-surface.tsx +33 -4
- package/src/components/chart/composite/time-scale.ts +1 -1
- package/src/components/chart/composite/toolbar.tsx +8 -4
- package/src/components/chart/composite/types.ts +17 -1
- package/src/components/chart/composite/use-composite-chart-keyboard.ts +15 -5
- package/src/components/chart/composite/use-composite-viewport.ts +31 -8
- package/src/components/chart/static/scatter-chart-surface.tsx +25 -9
- package/src/components/chart-table/axis.ts +11 -0
- package/src/components/chart-table/header.tsx +10 -1
- package/src/components/chart-table/layout.ts +14 -5
- package/src/components/command-bar/assist/inventory.ts +3 -2
- package/src/components/command-bar/commands/collection-list.ts +3 -2
- package/src/components/command-bar/panel/index.tsx +13 -0
- package/src/components/command-bar/panel/layout.ts +15 -1
- package/src/components/command-bar/panel/prompt-width.ts +34 -0
- package/src/components/command-bar/panel/runtime.ts +1 -0
- package/src/components/command-bar/panel/state.ts +4 -0
- package/src/components/command-bar/panel/types.ts +2 -0
- package/src/components/command-bar/routes/root/search-providers.ts +3 -2
- package/src/components/command-bar/routes/root/search-report.ts +2 -2
- package/src/components/command-bar/workflow/ticker-listing-picker.ts +1 -0
- package/src/components/company-logo.tsx +2 -2
- package/src/components/data-table/view.tsx +11 -2
- package/src/components/feed-data-table/stack-view.tsx +20 -6
- package/src/components/feedback-dialog.tsx +3 -1
- package/src/components/form-modal/field-row.tsx +1 -1
- package/src/components/form-modal/routes.ts +1 -0
- package/src/components/index.ts +1 -1
- package/src/components/layout/header.tsx +12 -3
- package/src/components/layout/market-summary.ts +2 -1
- package/src/components/layout/pane/footer/index.tsx +9 -5
- package/src/components/layout/pane/footer/model.ts +26 -10
- package/src/components/layout/pane/footer/registration.tsx +60 -1
- package/src/components/layout/pane/header-tabs.tsx +17 -3
- package/src/components/layout/pane/header.tsx +5 -2
- package/src/components/layout/pane/pane-tabs.tsx +57 -3
- package/src/components/layout/shell/active-drag.ts +38 -30
- package/src/components/layout/shell/drag/index.ts +51 -21
- package/src/components/layout/shell/menu.ts +3 -5
- package/src/components/layout/shell/pane/actions.ts +4 -1
- package/src/components/layout/shell/pane/ask.ts +5 -2
- package/src/components/layout/status-bar.tsx +59 -54
- package/src/components/markdown-text.tsx +35 -10
- package/src/components/onboarding/first-run-workspace.ts +25 -23
- package/src/components/onboarding/onboarding-keyboard.ts +6 -1
- package/src/components/onboarding/onboarding-wizard.tsx +12 -2
- package/src/components/onboarding/portfolio-step/positions-panel.tsx +3 -3
- package/src/components/onboarding/use-onboarding-broker-form.ts +2 -1
- package/src/components/onboarding/use-onboarding-progress.ts +11 -4
- package/src/components/onboarding/use-onboarding-upgrade.ts +3 -2
- package/src/components/onboarding/wizard-positions.ts +8 -1
- package/src/components/pane-notice-seen.ts +125 -0
- package/src/components/pane-settings-dialog/field-dialogs.tsx +2 -1
- package/src/components/pane-settings-dialog.tsx +7 -6
- package/src/components/sign-in-code-panel.tsx +3 -2
- package/src/components/speedometer-gauge/terminal.tsx +30 -9
- package/src/components/ticker/list-table-view.tsx +39 -3
- package/src/components/ui/confirm-dialog.tsx +2 -1
- package/src/components/ui/data-table/index.tsx +4 -2
- package/src/components/ui/data-table/opentui/index.tsx +15 -5
- package/src/components/ui/data-table/types.ts +8 -0
- package/src/components/ui/external-link.tsx +4 -1
- package/src/components/ui/field-grid.tsx +1 -1
- package/src/components/ui/index.ts +2 -0
- package/src/components/ui/inline-quick-add.tsx +5 -0
- package/src/components/ui/multi-select/dialog.tsx +10 -9
- package/src/components/ui/pane-link-chip.tsx +354 -0
- package/src/components/ui/query-bar.tsx +22 -13
- package/src/components/ui/ratio-bar.tsx +24 -1
- package/src/components/ui/select-button.tsx +2 -1
- package/src/components/ui/shortcut-hint.tsx +6 -3
- package/src/components/ui/table-layout.ts +81 -0
- package/src/components/ui/tabs.tsx +45 -6
- package/src/components/use-pane-notice-footer.tsx +12 -4
- package/src/core/app-service-ports.ts +1 -1
- package/src/data/plugin-state-store.ts +44 -8
- package/src/docs/snapshot.json +53 -32
- package/src/i18n/es.ts +28 -6
- package/src/i18n/ja.ts +28 -5
- package/src/i18n/ko.ts +28 -5
- package/src/i18n/zh-cn.ts +28 -5
- package/src/i18n/zh-tw.ts +28 -5
- package/src/layout/pane-manager/gridlock-inference.ts +2 -1
- package/src/layout/pane-manager/gridlock.ts +47 -2
- package/src/layout-marketplace/api.ts +1 -0
- package/src/layout-marketplace/gallery.tsx +4 -3
- package/src/layout-marketplace/linked.ts +6 -4
- package/src/layout-marketplace/model.ts +3 -2
- package/src/market-data/fund-facts.ts +7 -1
- package/src/market-data/futures-contract.ts +77 -31
- package/src/market-data/fx-closes.ts +5 -2
- package/src/market-data/hooks.tsx +23 -0
- package/src/market-data/market/change-basis.ts +92 -14
- package/src/market-data/market/format.ts +81 -13
- package/src/market-data/market/futures-week.ts +3 -1
- package/src/market-data/market/globex-day.ts +73 -0
- package/src/market-data/market/index-level.ts +10 -1
- package/src/market-data/quotes/intraday-bar.ts +1 -1
- package/src/market-data/quotes/session-split.ts +28 -0
- package/src/plugins/builtin/account-management/pane.tsx +1 -1
- package/src/plugins/builtin/analytics/account-returns.ts +1 -1
- package/src/plugins/builtin/analytics/index.tsx +10 -3
- package/src/plugins/builtin/analytics/pane-model.ts +1 -1
- package/src/plugins/builtin/analytics/risk-client.ts +4 -1
- package/src/plugins/builtin/analytics/risk-episodes.ts +422 -0
- package/src/plugins/builtin/analytics/risk-fx.ts +1 -1
- package/src/plugins/builtin/analytics/risk-headless.ts +28 -10
- package/src/plugins/builtin/analytics/risk-math.ts +1 -1
- package/src/plugins/builtin/analytics/risk-model.ts +115 -26
- package/src/plugins/builtin/analytics/risk-pane.tsx +201 -23
- package/src/plugins/builtin/analytics/sharpe-cadence.ts +1 -1
- package/src/plugins/builtin/backtest/format.ts +14 -0
- package/src/plugins/builtin/backtest/pane.tsx +3 -3
- package/src/plugins/builtin/backtest/report.ts +5 -3
- package/src/plugins/builtin/broker-manager/add-request.ts +10 -1
- package/src/plugins/builtin/broker-trading/pane.tsx +20 -2
- package/src/plugins/builtin/buildout/company/flow.tsx +5 -5
- package/src/plugins/builtin/buildout/company/model.ts +14 -2
- package/src/plugins/builtin/catalysts/detail.tsx +2 -2
- package/src/plugins/builtin/catalysts/model.ts +7 -2
- package/src/plugins/builtin/catalysts/pane.tsx +2 -2
- package/src/plugins/builtin/chart-composer/headless.ts +57 -17
- package/src/plugins/builtin/chart-composer/session-range.ts +82 -3
- package/src/plugins/builtin/chat/message/pane-chip.tsx +36 -208
- package/src/plugins/builtin/cloud/askg/answer-follow-ups.tsx +61 -0
- package/src/plugins/builtin/cloud/askg/answer-sources.tsx +102 -0
- package/src/plugins/builtin/cloud/askg/controller.ts +7 -1
- package/src/plugins/builtin/cloud/askg/host.ts +57 -0
- package/src/plugins/builtin/cloud/askg/model.ts +45 -5
- package/src/plugins/builtin/cloud/askg/pane.tsx +304 -25
- package/src/plugins/builtin/cloud/askg/protocol.ts +26 -1
- package/src/plugins/builtin/cloud/askg/sources.ts +466 -0
- package/src/plugins/builtin/cloud/one-tap/controller.ts +309 -0
- package/src/plugins/builtin/cloud/one-tap/google-identity.ts +142 -0
- package/src/plugins/builtin/cloud/one-tap/one-tap-prompt.tsx +101 -0
- package/src/plugins/builtin/cloud/plugin.tsx +7 -1
- package/src/plugins/builtin/company-kpis/client.ts +4 -3
- package/src/plugins/builtin/company-kpis/model.ts +34 -3
- package/src/plugins/builtin/correlation/compute.ts +8 -2
- package/src/plugins/builtin/correlation/headless.ts +10 -9
- package/src/plugins/builtin/correlation/history.ts +30 -0
- package/src/plugins/builtin/correlation/index.tsx +39 -167
- package/src/plugins/builtin/correlation/matrix/grid.tsx +285 -0
- package/src/plugins/builtin/correlation/matrix/model.ts +10 -10
- package/src/plugins/builtin/correlation/relationship/model.ts +3 -6
- package/src/plugins/builtin/correlation/relationship/pane.tsx +7 -9
- package/src/plugins/builtin/correlation/relationship/view-model.ts +14 -5
- package/src/plugins/builtin/cot/client.ts +8 -3
- package/src/plugins/builtin/cot/headless.ts +65 -12
- package/src/plugins/builtin/cot/pane.tsx +11 -5
- package/src/plugins/builtin/crypto-board/client.ts +6 -1
- package/src/plugins/builtin/crypto-board/defi-view.tsx +12 -1
- package/src/plugins/builtin/crypto-board/defi.ts +44 -7
- package/src/plugins/builtin/crypto-board/headless.ts +83 -12
- package/src/plugins/builtin/crypto-board/model.ts +30 -6
- package/src/plugins/builtin/crypto-board/pane.tsx +13 -2
- package/src/plugins/builtin/earnings/client.ts +40 -6
- package/src/plugins/builtin/earnings/fiscal-quarter.ts +54 -0
- package/src/plugins/builtin/earnings/headless.ts +47 -11
- package/src/plugins/builtin/earnings/history-model.ts +136 -24
- package/src/plugins/builtin/earnings/history-table.ts +42 -10
- package/src/plugins/builtin/earnings/history.tsx +23 -8
- package/src/plugins/builtin/earnings-ripple/client.ts +5 -2
- package/src/plugins/builtin/earnings-ripple/headless.ts +8 -3
- package/src/plugins/builtin/earnings-ripple/model.ts +21 -0
- package/src/plugins/builtin/earnings-ripple/pane.tsx +2 -3
- package/src/plugins/builtin/econ/index.tsx +5 -4
- package/src/plugins/builtin/econ-statistics/stats.ts +13 -5
- package/src/plugins/builtin/equity-screener/headless.ts +2 -1
- package/src/plugins/builtin/filing-events/feed.ts +56 -18
- package/src/plugins/builtin/filing-events/pane.tsx +8 -2
- package/src/plugins/builtin/futures/index.tsx +32 -10
- package/src/plugins/builtin/futures/model.ts +93 -6
- package/src/plugins/builtin/futures/returns.ts +29 -7
- package/src/plugins/builtin/futures/table.tsx +59 -17
- package/src/plugins/builtin/futures/use-front-returns.ts +32 -6
- package/src/plugins/builtin/futures-curve/client.ts +12 -2
- package/src/plugins/builtin/futures-curve/headless.ts +58 -17
- package/src/plugins/builtin/futures-curve/model.ts +111 -15
- package/src/plugins/builtin/futures-curve/pane.tsx +11 -6
- package/src/plugins/builtin/fx-matrix/amount.ts +132 -0
- package/src/plugins/builtin/fx-matrix/headless.ts +53 -13
- package/src/plugins/builtin/fx-matrix/index.tsx +205 -42
- package/src/plugins/builtin/fx-matrix/pairs.ts +10 -8
- package/src/plugins/builtin/fx-matrix/settings.ts +22 -1
- package/src/plugins/builtin/help/index.tsx +68 -61
- package/src/plugins/builtin/holders/format.ts +7 -2
- package/src/plugins/builtin/holders/pane.tsx +11 -3
- package/src/plugins/builtin/holders/report-header.ts +5 -4
- package/src/plugins/builtin/holders/report-rows.ts +4 -1
- package/src/plugins/builtin/holders/treemap.tsx +5 -3
- package/src/plugins/builtin/insider/signals-model.ts +4 -5
- package/src/plugins/builtin/ipo-calendar/headless.ts +18 -7
- package/src/plugins/builtin/ipo-calendar/listing-ipo.ts +3 -1
- package/src/plugins/builtin/ipo-calendar/model.ts +28 -8
- package/src/plugins/builtin/ipo-calendar/pane.tsx +2 -1
- package/src/plugins/builtin/kelly-sizer/headless.ts +4 -0
- package/src/plugins/builtin/perps/headless.ts +81 -19
- package/src/plugins/builtin/perps/index.tsx +3 -1
- package/src/plugins/builtin/perps/model.ts +1 -1
- package/src/plugins/builtin/perps/pane.tsx +2 -0
- package/src/plugins/builtin/portfolio-list/cell-version.ts +1 -0
- package/src/plugins/builtin/portfolio-list/cli/bulk-symbols.ts +20 -1
- package/src/plugins/builtin/portfolio-list/cli/import-positions.ts +260 -0
- package/src/plugins/builtin/portfolio-list/cli/period-report.ts +154 -0
- package/src/plugins/builtin/portfolio-list/cli/portfolio-command.ts +64 -22
- package/src/plugins/builtin/portfolio-list/cli/render.ts +18 -7
- package/src/plugins/builtin/portfolio-list/cli/watchlist-command.ts +5 -3
- package/src/plugins/builtin/portfolio-list/grid.tsx +56 -12
- package/src/plugins/builtin/portfolio-list/headless.ts +128 -0
- package/src/plugins/builtin/portfolio-list/pane/index.tsx +42 -4
- package/src/plugins/builtin/portfolio-list/pane/period-pnl.ts +124 -0
- package/src/plugins/builtin/portfolio-list/period-pnl.ts +179 -0
- package/src/plugins/builtin/portfolio-list/positions-import/dialog.tsx +445 -0
- package/src/plugins/builtin/portfolio-list/positions-import/index.tsx +255 -0
- package/src/plugins/builtin/portfolio-list/positions-import/lookup.ts +78 -0
- package/src/plugins/builtin/portfolio-list/positions-import/read-file.ts +32 -0
- package/src/plugins/builtin/portfolio-list/quick-add/index.tsx +186 -50
- package/src/plugins/builtin/portfolio-list/quick-add/resolution.ts +118 -4
- package/src/plugins/builtin/portfolio-list/settings.ts +25 -0
- package/src/plugins/builtin/portfolio-list/summary/index.tsx +16 -1
- package/src/plugins/builtin/portfolio-list/summary/totals.ts +7 -5
- package/src/plugins/builtin/portfolio-list/table.tsx +105 -6
- package/src/plugins/builtin/power/headless.ts +47 -9
- package/src/plugins/builtin/research/relative-valuation-model.ts +8 -3
- package/src/plugins/builtin/research-search/article.ts +12 -2
- package/src/plugins/builtin/research-search/data.ts +5 -2
- package/src/plugins/builtin/research-search/document-view.tsx +1 -1
- package/src/plugins/builtin/research-search/model.ts +47 -3
- package/src/plugins/builtin/research-search/pane.tsx +3 -2
- package/src/plugins/builtin/reverse-dcf/model.ts +7 -4
- package/src/plugins/builtin/risk-factors/headless.ts +3 -2
- package/src/plugins/builtin/risk-factors/index.tsx +2 -28
- package/src/plugins/builtin/risk-factors/lock-note.ts +58 -0
- package/src/plugins/builtin/risk-factors/pane.tsx +14 -5
- package/src/plugins/builtin/scanner/flow-model.ts +17 -13
- package/src/plugins/builtin/scanner/flow-pane.tsx +8 -9
- package/src/plugins/builtin/scanner/flow-session.ts +2 -9
- package/src/plugins/builtin/scanner/hilo-model.ts +4 -3
- package/src/plugins/builtin/sec/filing-display.tsx +0 -5
- package/src/plugins/builtin/sec/forms.ts +19 -0
- package/src/plugins/builtin/sec/fund-facts.ts +45 -11
- package/src/plugins/builtin/sec/headless.ts +37 -12
- package/src/plugins/builtin/sec/index.tsx +37 -8
- package/src/plugins/builtin/shared/earnings-calendar.ts +6 -3
- package/src/plugins/builtin/shared/earnings-report.ts +1 -1
- package/src/plugins/builtin/shared/fx-rate-freshness.ts +0 -35
- package/src/plugins/builtin/shared/pro-lock-note.ts +5 -1
- package/src/plugins/builtin/shared/use-quote-board.ts +42 -27
- package/src/plugins/builtin/supply-chain/graph-model.ts +7 -1
- package/src/plugins/builtin/supply-chain/headless.ts +20 -10
- package/src/plugins/builtin/supply-chain/model.ts +117 -20
- package/src/plugins/builtin/supply-chain/pane.tsx +22 -15
- package/src/plugins/builtin/supply-chain/row-evidence.tsx +1 -1
- package/src/plugins/builtin/ticker-detail/data-panes/returns-chart-model.ts +69 -0
- package/src/plugins/builtin/ticker-detail/data-panes/returns-chart.tsx +118 -0
- package/src/plugins/builtin/ticker-detail/data-panes/returns-model.ts +1 -1
- package/src/plugins/builtin/ticker-detail/data-panes/returns-pane.tsx +103 -40
- package/src/plugins/builtin/ticker-detail/headless-schema.ts +10 -1
- package/src/plugins/builtin/ticker-detail/headless.ts +8 -1
- package/src/plugins/builtin/ticker-detail/overview/components.tsx +2 -1
- package/src/plugins/builtin/ticker-detail/overview/model.ts +18 -8
- package/src/plugins/builtin/ticker-detail/overview-tab.tsx +11 -8
- package/src/plugins/builtin/ticker-detail/pane.tsx +95 -20
- package/src/plugins/builtin/ticker-detail/research-groups.ts +89 -0
- package/src/plugins/builtin/ticker-detail/settings.ts +4 -3
- package/src/plugins/builtin/time-sales/headless.ts +23 -7
- package/src/plugins/builtin/time-sales/index.tsx +2 -2
- package/src/plugins/builtin/volatility/charts.tsx +2 -2
- package/src/plugins/extracted-plugins.ts +49 -24
- package/src/plugins/host-resolver.ts +3 -2
- package/src/plugins/installer.ts +220 -31
- package/src/plugins/running-installs.ts +34 -0
- package/src/plugins/seed-progress.ts +72 -0
- package/src/portfolio/column-values.ts +42 -8
- package/src/portfolio/futures-positions.ts +10 -2
- package/src/portfolio/mutations.ts +4 -3
- package/src/portfolio/period-pnl.ts +119 -0
- package/src/portfolio/positions-import/describe.ts +89 -0
- package/src/portfolio/positions-import/parse.ts +682 -0
- package/src/portfolio/positions-import/plan.ts +295 -0
- package/src/{plugins/builtin/analytics/metrics.ts → portfolio/return-metrics.ts} +24 -11
- package/src/public/__snapshots__/public-api.test.ts.snap +1 -0
- package/src/react/jsx-dev-fallback.ts +62 -0
- package/src/renderers/browser/cloud-transport.ts +1 -1
- package/src/renderers/browser/config-host.ts +3 -1
- package/src/renderers/browser/deeplink-bridge.ts +8 -1
- package/src/renderers/browser/http-proxy-transport.ts +9 -2
- package/src/renderers/browser/main.tsx +2 -1
- package/src/renderers/browser/research-entry.ts +12 -0
- package/src/renderers/cloudflare/http-proxy.ts +8 -2
- package/src/renderers/cloudflare/proxy-session.ts +1 -0
- package/src/renderers/cloudflare/worker.ts +12 -3
- package/src/renderers/dom/desktop/audio-player.tsx +2 -2
- package/src/renderers/dom/desktop/controls.tsx +1 -1
- package/src/renderers/dom/desktop/dialog-actions.tsx +10 -24
- package/src/renderers/dom/desktop/icons.tsx +4 -2
- package/src/renderers/dom/desktop/query-bar.tsx +23 -19
- package/src/renderers/dom/dom-host-providers.tsx +7 -2
- package/src/renderers/dom/host/box.tsx +2 -2
- package/src/renderers/dom/host/input.tsx +13 -0
- package/src/renderers/dom/key-event.ts +1 -0
- package/src/renderers/dom/styles.css +3 -0
- package/src/renderers/electrobun/bun/context-menu/click.ts +1 -0
- package/src/renderers/electrobun/bun/desktop/backend.ts +15 -0
- package/src/renderers/electrobun/bun/desktop/capability-bridge.ts +5 -4
- package/src/renderers/electrobun/bun/desktop/host-requests.ts +19 -11
- package/src/renderers/electrobun/bun/desktop/http-fetch.ts +1 -0
- package/src/renderers/electrobun/bun/desktop/http-stream.ts +1 -1
- package/src/renderers/electrobun/bun/desktop/initialization.ts +27 -15
- package/src/renderers/electrobun/bun/desktop/install-records.ts +4 -1
- package/src/renderers/electrobun/bun/desktop/installer-folder.ts +5 -2
- package/src/renderers/electrobun/bun/desktop/macos-objc.ts +3 -1
- package/src/renderers/electrobun/bun/desktop/screen-setup-file.ts +9 -4
- package/src/renderers/electrobun/bun/desktop/update.ts +27 -13
- package/src/renderers/electrobun/bun/desktop/windows-script.ts +6 -2
- package/src/renderers/electrobun/bun/index.ts +5 -0
- package/src/renderers/electrobun/bun/window/attention.ts +1 -0
- package/src/renderers/electrobun/bun/window/boot-frame.ts +1 -0
- package/src/renderers/electrobun/bun/window/context-menu-thread.ts +84 -0
- package/src/renderers/electrobun/bun/window/create.ts +1 -0
- package/src/renderers/electrobun/bun/window/electrobun-window-host.ts +13 -8
- package/src/renderers/electrobun/bun/window/native-call-thread.ts +224 -0
- package/src/renderers/electrobun/bun/window/native-min-size.ts +1 -1
- package/src/renderers/electrobun/bun/window/native-timing.ts +10 -0
- package/src/renderers/electrobun/bun/window/remembered-frame.ts +1 -0
- package/src/renderers/electrobun/bun/window/script-for-webview.ts +15 -0
- package/src/renderers/electrobun/bun/window/webview-script-thread.ts +82 -0
- package/src/renderers/electrobun/bun/window/windows-native.ts +3 -1
- package/src/renderers/electrobun/bun/window/windows-quit.ts +3 -1
- package/src/renderers/electrobun/shared/protocol.ts +13 -2
- package/src/renderers/electrobun/view/app-badge-host.ts +2 -1
- package/src/renderers/electrobun/view/backend-rpc.ts +7 -0
- package/src/renderers/electrobun/view/capability-subscription.ts +2 -1
- package/src/renderers/electrobun/view/cli-pane-shot-entry.tsx +7 -10
- package/src/renderers/electrobun/view/cli-pane-shot-frame.tsx +1 -1
- package/src/renderers/electrobun/view/cli-pane-shot-mutations.ts +36 -0
- package/src/renderers/electrobun/view/http-fetch.ts +2 -1
- package/src/renderers/electrobun/view/main.tsx +13 -7
- package/src/renderers/electrobun/view/remote/capability-invoker.ts +6 -3
- package/src/renderers/electrobun/view/remote/persistence.ts +63 -27
- package/src/renderers/electrobun/view/rpc-timeout.ts +1 -0
- package/src/renderers/electrobun/view/ui-host.tsx +3 -2
- package/src/renderers/electrobun/view/window-fullscreen.ts +3 -1
- package/src/renderers/opentui/browser-open.ts +2 -1
- package/src/renderers/opentui/dialog-host.tsx +1 -1
- package/src/renderers/opentui/interaction-performance.ts +3 -1
- package/src/renderers/opentui/start.tsx +5 -1
- package/src/renderers/opentui/terminal-media.ts +11 -6
- package/src/renderers/opentui/ui-host.tsx +5 -8
- package/src/shares/open.ts +22 -1
- package/src/shares/pane.ts +2 -1
- package/src/sources/gloomberb-cloud/normalizers.ts +3 -0
- package/src/sync/analytics-payload.ts +194 -0
- package/src/sync/baseline.ts +19 -9
- package/src/sync/broker-identity.ts +171 -0
- package/src/sync/broker-instances.ts +137 -0
- package/src/sync/collections-contributor.ts +173 -0
- package/src/sync/config-contributor.ts +100 -0
- package/src/sync/config-merge.ts +229 -0
- package/src/sync/controller.ts +139 -28
- package/src/sync/core-contributors.ts +8 -1583
- package/src/sync/history-memo.ts +32 -0
- package/src/sync/layout-merge.ts +259 -0
- package/src/sync/sanitize.ts +114 -0
- package/src/sync/ticker-merge.ts +208 -0
- package/src/sync/ticker-payload.ts +81 -0
- package/src/sync/types.ts +15 -1
- package/src/telemetry/attention-setting.ts +1 -1
- package/src/telemetry/stall-reports.ts +21 -4
- package/src/telemetry/usage-counts.ts +16 -0
- package/src/test-support/preload.ts +5 -0
- package/src/theme/color-utils.ts +10 -0
- package/src/theme/font-scale.ts +34 -3
- package/src/theme/series-colors.ts +44 -0
- package/src/theme/themes.ts +2 -1
- package/src/tickers/batched-lookups.ts +263 -6
- package/src/tickers/company-name-listing.ts +44 -2
- package/src/tickers/company-name.ts +7 -2
- package/src/tickers/search/upsert.ts +16 -1
- package/src/time-series/base-series.ts +18 -4
- package/src/time-series/studies/indicators.ts +3 -1
- package/src/time-series/studies/resolve.ts +1 -1
- package/src/time-series/types.ts +6 -0
- package/src/types/financials.ts +18 -0
- package/src/types/headless.ts +11 -0
- package/src/ui/host.tsx +26 -3
- package/src/ui/index.tsx +1 -0
- package/src/utils/concurrency.ts +6 -0
- package/src/utils/currency-pair.ts +56 -4
- package/src/utils/datetime-format.ts +11 -0
- package/src/utils/decimal-comma.ts +9 -6
- package/src/utils/exchanges.ts +32 -0
- package/src/utils/fundamentals.ts +41 -0
- package/src/utils/main-thread-stall.ts +21 -5
- package/src/utils/markdown.ts +4 -2
- package/src/utils/pasted-lines.ts +14 -0
- package/src/utils/perf-marks.ts +88 -9
- package/src/utils/price-window.ts +2 -1
- package/src/utils/reported-money.ts +9 -2
- package/src/utils/sec-filings.ts +17 -0
- package/src/utils/sec.ts +37 -25
- package/src/utils/shortcut-labels.ts +6 -30
- package/src/plugins/seed-notice.ts +0 -20
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
ScrollBox,
|
|
17
17
|
Text,
|
|
18
18
|
TextAttributes,
|
|
19
|
+
useRendererHost,
|
|
19
20
|
useUiCapabilities,
|
|
20
21
|
type BoxRenderable,
|
|
21
22
|
type ScrollBoxRenderable,
|
|
@@ -62,9 +63,32 @@ import { describePortfolioTab } from "../../analytics/portfolio-selection";
|
|
|
62
63
|
import { ASKGSessionController, type ASKGControllerManifest } from "./controller";
|
|
63
64
|
import {
|
|
64
65
|
createASKGRendererToolExecutor,
|
|
66
|
+
buildASKGSourceShare,
|
|
67
|
+
type ASKGSourceShare,
|
|
65
68
|
loadASKGClientManifest,
|
|
66
69
|
resolveToolPaneTarget,
|
|
67
70
|
} from "./host";
|
|
71
|
+
import { getSharedRegistry } from "../../../registry";
|
|
72
|
+
import {
|
|
73
|
+
answerReadNothing,
|
|
74
|
+
answerSources,
|
|
75
|
+
answerWithSourceLinks,
|
|
76
|
+
createSourceResolver,
|
|
77
|
+
formatSourceCommand,
|
|
78
|
+
linkCitations,
|
|
79
|
+
SOURCE_LINK_SCHEME,
|
|
80
|
+
sourceRefFromHref,
|
|
81
|
+
type ASKGAnswerSource,
|
|
82
|
+
type ASKGSourceTarget,
|
|
83
|
+
} from "./sources";
|
|
84
|
+
import { AnswerSources, answerSourceLabel } from "./answer-sources";
|
|
85
|
+
import { AnswerFollowUps, followUpKey } from "./answer-follow-ups";
|
|
86
|
+
import { openSharedPane } from "../../../../shares/open";
|
|
87
|
+
import { createShare, openLiveShareUrl } from "../../../../shares/api";
|
|
88
|
+
import { ApiRequestError } from "../../../../api-client/errors";
|
|
89
|
+
import { personalDataNotice } from "../../../../shares/pane-image";
|
|
90
|
+
import { readyToShare } from "../../../../shares/ready";
|
|
91
|
+
import type { PanePersonalData } from "../../../../types/plugin";
|
|
68
92
|
import {
|
|
69
93
|
askgConversationLabel,
|
|
70
94
|
askgConversationListStore,
|
|
@@ -99,6 +123,7 @@ import {
|
|
|
99
123
|
pendingConfirmation,
|
|
100
124
|
toolResultTables,
|
|
101
125
|
type ASKGConversationState,
|
|
126
|
+
type ASKGErrorState,
|
|
102
127
|
type ASKGToolRow,
|
|
103
128
|
type ASKGTurn,
|
|
104
129
|
type ASKGTurnFeedback,
|
|
@@ -150,6 +175,11 @@ function previewLines(preview: JsonValue | undefined): string[] {
|
|
|
150
175
|
/** Upgrade from a Pro-only answer, on the key every Pro prompt uses. */
|
|
151
176
|
const UPGRADE_KEY = CLOUD_PLAN_KEY;
|
|
152
177
|
|
|
178
|
+
/** A daily cap on the standard tier, which Pro's higher limit lifts. */
|
|
179
|
+
function upgradeLiftsCap(error: ASKGErrorState): boolean {
|
|
180
|
+
return error.code === "daily_turn_cap" && error.tier === "standard";
|
|
181
|
+
}
|
|
182
|
+
|
|
153
183
|
/**
|
|
154
184
|
* Three questions a first look can send with one click, worded for what the
|
|
155
185
|
* profile holds: a portfolio, a ticker on screen, a watchlist.
|
|
@@ -183,6 +213,8 @@ function askgExampleQuestions({
|
|
|
183
213
|
}
|
|
184
214
|
|
|
185
215
|
const NO_EXAMPLES: string[] = [];
|
|
216
|
+
const NO_SOURCES: readonly ASKGAnswerSource[] = [];
|
|
217
|
+
const NO_FOLLOW_UPS: readonly string[] = [];
|
|
186
218
|
|
|
187
219
|
/** Rate the answer the keyboard is on: the selected one, else the latest. */
|
|
188
220
|
const GOOD_ANSWER_KEY = "g";
|
|
@@ -313,6 +345,11 @@ function AnswerFeedback({
|
|
|
313
345
|
);
|
|
314
346
|
}
|
|
315
347
|
|
|
348
|
+
/** The answer reads its citations as links, and only them: a link the model wrote stays text. */
|
|
349
|
+
function isSourceLink(href: string): boolean {
|
|
350
|
+
return href.startsWith(SOURCE_LINK_SCHEME);
|
|
351
|
+
}
|
|
352
|
+
|
|
316
353
|
/** Rows the confirmation block reserves for the dry run preview. */
|
|
317
354
|
const MAX_PREVIEW_LINES = 4;
|
|
318
355
|
|
|
@@ -409,6 +446,11 @@ function TurnView({
|
|
|
409
446
|
catalog,
|
|
410
447
|
openTicker,
|
|
411
448
|
tools,
|
|
449
|
+
sources,
|
|
450
|
+
followUps,
|
|
451
|
+
displayContext,
|
|
452
|
+
onOpenSource,
|
|
453
|
+
onAskFollowUp,
|
|
412
454
|
onRetry,
|
|
413
455
|
onUpgrade,
|
|
414
456
|
onRate,
|
|
@@ -430,6 +472,13 @@ function TurnView({
|
|
|
430
472
|
openTicker: (symbol: string) => void;
|
|
431
473
|
/** The turn's tool timeline. */
|
|
432
474
|
tools: ReactNode;
|
|
475
|
+
/** What the answer cites, or the reads behind it when it cites none. */
|
|
476
|
+
sources: readonly ASKGAnswerSource[];
|
|
477
|
+
/** Questions to ask next: only the newest answer offers them. */
|
|
478
|
+
followUps: readonly string[];
|
|
479
|
+
displayContext: ToolDisplayContext;
|
|
480
|
+
onOpenSource: (source: ASKGAnswerSource) => void;
|
|
481
|
+
onAskFollowUp: (question: string) => void;
|
|
433
482
|
onRetry: () => void;
|
|
434
483
|
onUpgrade: () => void;
|
|
435
484
|
onRate: (rating: ASKGFeedbackRating) => void;
|
|
@@ -437,6 +486,16 @@ function TurnView({
|
|
|
437
486
|
onShare: () => void;
|
|
438
487
|
}) {
|
|
439
488
|
const colors = useThemeColors();
|
|
489
|
+
// A citation opens its source; one that opens nothing stays the text it was.
|
|
490
|
+
const answer = useMemo(() => linkCitations(turn.answer, new Set(sources.flatMap((source) => (
|
|
491
|
+
source.ref !== null && source.target.kind === "pane" ? [source.ref] : []
|
|
492
|
+
)))), [sources, turn.answer]);
|
|
493
|
+
const openLink = useCallback((href: string) => {
|
|
494
|
+
const ref = sourceRefFromHref(href);
|
|
495
|
+
const source = ref === null ? undefined : sources.find((entry) => entry.ref === ref);
|
|
496
|
+
if (source) onOpenSource(source);
|
|
497
|
+
}, [onOpenSource, sources]);
|
|
498
|
+
const finished = turn.status === "complete" && turn.answer.trim().length > 0;
|
|
440
499
|
return (
|
|
441
500
|
<Box flexDirection="column" paddingTop={1}>
|
|
442
501
|
<Prose
|
|
@@ -450,16 +509,29 @@ function TurnView({
|
|
|
450
509
|
{turn.answer ? (
|
|
451
510
|
<Box paddingTop={1}>
|
|
452
511
|
<MarkdownText
|
|
453
|
-
text={
|
|
512
|
+
text={answer}
|
|
454
513
|
lineWidth={width}
|
|
455
514
|
catalog={catalog}
|
|
456
515
|
textColor={colors.text}
|
|
457
516
|
openTicker={openTicker}
|
|
517
|
+
onOpenLink={openLink}
|
|
518
|
+
readsLink={isSourceLink}
|
|
519
|
+
linkChips
|
|
458
520
|
/>
|
|
459
521
|
</Box>
|
|
460
522
|
) : turn.status === "streaming" && turn.tools.length === 0 ? (
|
|
461
523
|
<Box paddingTop={1}><Spinner label="Gloom is thinking…" /></Box>
|
|
462
524
|
) : null}
|
|
525
|
+
{finished ? (
|
|
526
|
+
<AnswerSources
|
|
527
|
+
sources={sources}
|
|
528
|
+
readNothing={answerReadNothing(turn)}
|
|
529
|
+
width={width}
|
|
530
|
+
context={displayContext}
|
|
531
|
+
onOpen={onOpenSource}
|
|
532
|
+
/>
|
|
533
|
+
) : null}
|
|
534
|
+
{finished ? <AnswerFollowUps questions={followUps} width={width} onAsk={onAskFollowUp} /> : null}
|
|
463
535
|
{rateable ? (
|
|
464
536
|
<AnswerFeedback
|
|
465
537
|
feedback={turn.feedback}
|
|
@@ -491,7 +563,7 @@ function TurnView({
|
|
|
491
563
|
figures={false}
|
|
492
564
|
/>
|
|
493
565
|
{/* A row of its own, so the desktop draws a button rather than a bar. */}
|
|
494
|
-
{turn.error.code === "tier_required" ? (
|
|
566
|
+
{turn.error.code === "tier_required" || upgradeLiftsCap(turn.error) ? (
|
|
495
567
|
<Box flexDirection="row" paddingTop={1}>
|
|
496
568
|
<Button label="Upgrade to Pro" variant="primary" shortcut={latest ? UPGRADE_KEY : undefined} onPress={onUpgrade} />
|
|
497
569
|
</Box>
|
|
@@ -514,8 +586,9 @@ export function ASKGPane({ paneId, focused, width, height }: PaneProps) {
|
|
|
514
586
|
const config = usePaneAppConfig();
|
|
515
587
|
const activeSymbol = useAppSelector((state) => state.recentTickers[0] ?? null);
|
|
516
588
|
const { pinTicker } = usePluginTickerActions();
|
|
517
|
-
const {
|
|
589
|
+
const { openCommandBar, notify } = usePluginAppActions();
|
|
518
590
|
const dialog = useDialog();
|
|
591
|
+
const rendererHost = useRendererHost();
|
|
519
592
|
|
|
520
593
|
const configRef = useRef(config);
|
|
521
594
|
configRef.current = config;
|
|
@@ -686,7 +759,12 @@ export function ASKGPane({ paneId, focused, width, height }: PaneProps) {
|
|
|
686
759
|
}, [state]);
|
|
687
760
|
const needsUpgrade = useMemo(() => {
|
|
688
761
|
const turn = activeTurn(state);
|
|
689
|
-
return turn?.status === "error" && turn.error
|
|
762
|
+
return turn?.status === "error" && !!turn.error && (turn.error.code === "tier_required" || upgradeLiftsCap(turn.error));
|
|
763
|
+
}, [state]);
|
|
764
|
+
// What to ask next: the newest answer's suggestions, once it is finished.
|
|
765
|
+
const followUps = useMemo(() => {
|
|
766
|
+
const turn = activeTurn(state);
|
|
767
|
+
return turn?.status === "complete" && turn.followUps ? turn.followUps : NO_FOLLOW_UPS;
|
|
690
768
|
}, [state]);
|
|
691
769
|
|
|
692
770
|
const profileExamples = useMemo(() => {
|
|
@@ -1015,17 +1093,32 @@ export function ASKGPane({ paneId, focused, width, height }: PaneProps) {
|
|
|
1015
1093
|
return afterLayout(() => revealInScrollBox(scrollRef.current, selectedRowNodeRef.current));
|
|
1016
1094
|
}, [expandedToolCallId, feedbackFollowUpTurnId, openGroups, selectedId]);
|
|
1017
1095
|
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1096
|
+
// Each read as the function, ticker and options that show its data. The
|
|
1097
|
+
// functions can arrive after the pane (a plugin loading late), so the
|
|
1098
|
+
// resolver is built again when they change.
|
|
1099
|
+
const registry = getSharedRegistry() ?? null;
|
|
1100
|
+
const functionCount = registry?.paneTemplates.size ?? 0;
|
|
1101
|
+
const sourceResolver = useMemo(() => createSourceResolver(registry), [registry, functionCount]);
|
|
1102
|
+
|
|
1103
|
+
// A source is the pane share of the view it was read from, built here, and
|
|
1104
|
+
// opens the way a share link does (chat's chips), in a pane of its own.
|
|
1105
|
+
const openSourceTarget = useCallback(async (target: ASKGSourceTarget) => {
|
|
1106
|
+
if (target.kind !== "pane") return;
|
|
1107
|
+
const failed = (reason: string) => notify({ body: `Could not open ${formatSourceCommand(target.command)}: ${reason}`, type: "error" });
|
|
1108
|
+
try {
|
|
1109
|
+
const share = await buildASKGSourceShare(target.command, configRef.current);
|
|
1110
|
+
openSharedPane(share.data, () => failed("panes cannot open from here."));
|
|
1111
|
+
} catch (error) {
|
|
1112
|
+
failed(error instanceof Error ? error.message : String(error));
|
|
1026
1113
|
}
|
|
1027
|
-
|
|
1028
|
-
|
|
1114
|
+
}, [notify]);
|
|
1115
|
+
const openSource = useCallback((source: ASKGAnswerSource) => {
|
|
1116
|
+
void openSourceTarget(source.target);
|
|
1117
|
+
}, [openSourceTarget]);
|
|
1118
|
+
|
|
1119
|
+
const openPaneForTool = useCallback((row: ASKGToolRow) => {
|
|
1120
|
+
void openSourceTarget(sourceResolver.target(row));
|
|
1121
|
+
}, [openSourceTarget, sourceResolver]);
|
|
1029
1122
|
|
|
1030
1123
|
const openSymbol = useCallback((symbol: string) => {
|
|
1031
1124
|
pinTicker(symbol, { floating: true });
|
|
@@ -1132,6 +1225,133 @@ export function ASKGPane({ paneId, focused, width, height }: PaneProps) {
|
|
|
1132
1225
|
: null;
|
|
1133
1226
|
}, [feedbackFollowUpTurnId, state]);
|
|
1134
1227
|
|
|
1228
|
+
// What each answer cites, as the commands that show it.
|
|
1229
|
+
const turnSources = useMemo(
|
|
1230
|
+
() => state.turns.map((_turn, index) => answerSources(state.turns, index, sourceResolver)),
|
|
1231
|
+
[sourceResolver, state.turns],
|
|
1232
|
+
);
|
|
1233
|
+
// The answer `o` and Copy Answer with Source Links act on, as `g` and `b`
|
|
1234
|
+
// rate: the one the keyboard is on, else the newest, the one being read.
|
|
1235
|
+
// Its sources count once it is finished and shows them.
|
|
1236
|
+
const sourcesTurnIndex = useMemo(() => {
|
|
1237
|
+
if (selectedId) {
|
|
1238
|
+
const index = state.turns.findIndex((entry) => (
|
|
1239
|
+
selectedId === answerStopId(entry.id)
|
|
1240
|
+
|| selectedId === toolGroupId(entry.id)
|
|
1241
|
+
|| entry.tools.some((row) => row.toolCallId === selectedId)
|
|
1242
|
+
));
|
|
1243
|
+
if (index >= 0) return index;
|
|
1244
|
+
}
|
|
1245
|
+
return state.turns.length - 1;
|
|
1246
|
+
}, [selectedId, state.turns]);
|
|
1247
|
+
const openableSources = useMemo(() => {
|
|
1248
|
+
const turn = state.turns[sourcesTurnIndex];
|
|
1249
|
+
if (!turn || turn.status !== "complete") return [];
|
|
1250
|
+
return (turnSources[sourcesTurnIndex] ?? []).filter((source) => source.target.kind === "pane");
|
|
1251
|
+
}, [sourcesTurnIndex, state.turns, turnSources]);
|
|
1252
|
+
const chooseAnswerSource = useCallback(async () => {
|
|
1253
|
+
if (openableSources.length === 1) {
|
|
1254
|
+
openSource(openableSources[0]!);
|
|
1255
|
+
return;
|
|
1256
|
+
}
|
|
1257
|
+
if (openableSources.length === 0) return;
|
|
1258
|
+
const picked = await dialog.prompt<string>({
|
|
1259
|
+
closeOnClickOutside: true,
|
|
1260
|
+
content: (context: unknown) => (
|
|
1261
|
+
<ChoiceDialog
|
|
1262
|
+
{...(context as PromptContext<string>)}
|
|
1263
|
+
title="Sources of the answer"
|
|
1264
|
+
choices={openableSources.map((source, index) => ({
|
|
1265
|
+
id: String(index),
|
|
1266
|
+
label: answerSourceLabel(source, displayContext),
|
|
1267
|
+
description: source.target.kind === "pane" ? source.target.label : undefined,
|
|
1268
|
+
}))}
|
|
1269
|
+
/>
|
|
1270
|
+
),
|
|
1271
|
+
}).catch(logFailure("cloud.askg.pane", "The answer sources prompt failed"));
|
|
1272
|
+
const source = picked === undefined ? undefined : openableSources[Number(picked)];
|
|
1273
|
+
if (source) openSource(source);
|
|
1274
|
+
}, [dialog, displayContext, openSource, openableSources]);
|
|
1275
|
+
|
|
1276
|
+
// A source is a pane share held here; sharing the answer makes each one a
|
|
1277
|
+
// link (`createShare`), so it opens for whoever reads it. Made once per
|
|
1278
|
+
// source in this pane, by the words it opens, so copying again makes none anew.
|
|
1279
|
+
const sourceLinksRef = useRef(new Map<string, string>());
|
|
1280
|
+
const copyAnswerRef = useRef<() => void>(() => {});
|
|
1281
|
+
// One copy at a time: a second press while links are being made would make them twice.
|
|
1282
|
+
const copyingAnswerRef = useRef(false);
|
|
1283
|
+
const copyAnswerWithSourceLinks = useCallback(async () => {
|
|
1284
|
+
const turn = state.turns[sourcesTurnIndex];
|
|
1285
|
+
const sources = turnSources[sourcesTurnIndex] ?? [];
|
|
1286
|
+
if (!turn || openableSources.length === 0 || copyingAnswerRef.current) return;
|
|
1287
|
+
if (!readyToShare(notify, () => copyAnswerRef.current(), "share an answer's sources")) return;
|
|
1288
|
+
copyingAnswerRef.current = true;
|
|
1289
|
+
const links = sourceLinksRef.current;
|
|
1290
|
+
try {
|
|
1291
|
+
const pending: Array<{ key: string; share: ASKGSourceShare | null }> = [];
|
|
1292
|
+
let personal: PanePersonalData | null = null;
|
|
1293
|
+
for (const source of sources) {
|
|
1294
|
+
if (source.target.kind !== "pane") continue;
|
|
1295
|
+
const key = formatSourceCommand(source.target.command);
|
|
1296
|
+
if (links.has(key) || pending.some((entry) => entry.key === key)) continue;
|
|
1297
|
+
const share = await buildASKGSourceShare(source.target.command, configRef.current).catch((error: unknown) => {
|
|
1298
|
+
logFailure("cloud.askg.pane", "An answer source could not be shared")(error);
|
|
1299
|
+
return null;
|
|
1300
|
+
});
|
|
1301
|
+
const declared = share?.data.version === 2
|
|
1302
|
+
? registry?.panes.get(share.data.layout.layout.instances[0]?.paneId ?? "")?.personalData
|
|
1303
|
+
: undefined;
|
|
1304
|
+
if (typeof declared === "string") personal ??= declared;
|
|
1305
|
+
pending.push({ key, share });
|
|
1306
|
+
}
|
|
1307
|
+
if (personal && !await confirmDialog(dialog, {
|
|
1308
|
+
title: "Copy public links?",
|
|
1309
|
+
body: [personalDataNotice(personal), "Anyone with a link can open its pane with its settings."],
|
|
1310
|
+
confirmLabel: "Copy links",
|
|
1311
|
+
defaultAction: "cancel",
|
|
1312
|
+
})) return;
|
|
1313
|
+
// A source that cannot be shared leaves the rest linked; once the
|
|
1314
|
+
// service says the share limit is reached, the rest are not tried.
|
|
1315
|
+
let limited = false;
|
|
1316
|
+
let failure: string | null = null;
|
|
1317
|
+
for (const { key, share } of pending) {
|
|
1318
|
+
if (!share || limited) continue;
|
|
1319
|
+
try {
|
|
1320
|
+
links.set(key, openLiveShareUrl((await createShare(share)).id));
|
|
1321
|
+
} catch (error) {
|
|
1322
|
+
limited = error instanceof ApiRequestError && error.status === 429;
|
|
1323
|
+
failure ??= error instanceof Error && error.message ? error.message : "Could not share a source.";
|
|
1324
|
+
}
|
|
1325
|
+
}
|
|
1326
|
+
const linkOf = (source: ASKGAnswerSource) => (
|
|
1327
|
+
source.target.kind === "pane" ? links.get(formatSourceCommand(source.target.command)) ?? null : null
|
|
1328
|
+
);
|
|
1329
|
+
const text = answerWithSourceLinks(turn.answer, sources.map((source) => ({
|
|
1330
|
+
label: answerSourceLabel(source, displayContext),
|
|
1331
|
+
url: linkOf(source),
|
|
1332
|
+
})));
|
|
1333
|
+
await rendererHost.copyText(text);
|
|
1334
|
+
const unlinked = openableSources.filter((source) => linkOf(source) === null);
|
|
1335
|
+
if (unlinked.length === 0) {
|
|
1336
|
+
notify({ body: "Answer copied, with a link to each source", type: "success" });
|
|
1337
|
+
} else {
|
|
1338
|
+
const names = unlinked.map((source) => (
|
|
1339
|
+
source.ref !== null ? `[${source.ref}]` : source.target.kind === "pane" ? formatSourceCommand(source.target.command) : ""
|
|
1340
|
+
));
|
|
1341
|
+
const reason = limited ? "the share limit is reached for now" : failure ?? "they could not be shared";
|
|
1342
|
+
notify({
|
|
1343
|
+
body: `Answer copied without a link for ${names.join(", ")}: ${reason}`,
|
|
1344
|
+
type: unlinked.length === openableSources.length ? "error" : "info",
|
|
1345
|
+
});
|
|
1346
|
+
}
|
|
1347
|
+
} catch (error) {
|
|
1348
|
+
notify({ body: error instanceof Error && error.message ? error.message : "Could not copy this answer.", type: "error" });
|
|
1349
|
+
} finally {
|
|
1350
|
+
copyingAnswerRef.current = false;
|
|
1351
|
+
}
|
|
1352
|
+
}, [dialog, displayContext, notify, openableSources, registry, rendererHost, sourcesTurnIndex, state.turns, turnSources]);
|
|
1353
|
+
copyAnswerRef.current = () => { void copyAnswerWithSourceLinks(); };
|
|
1354
|
+
|
|
1135
1355
|
// A second thumbs down on the same answer opens or closes its reasons, so
|
|
1136
1356
|
// they are always one press away and never in the way. A thumbs down hands
|
|
1137
1357
|
// the keyboard to the answer, so its reasons answer 1 to 4 straight away.
|
|
@@ -1180,7 +1400,7 @@ export function ASKGPane({ paneId, focused, width, height }: PaneProps) {
|
|
|
1180
1400
|
const resultActive = resultFocused && !!expandedRow && detailHeight > 0 && !inputFocused && !showSidebar;
|
|
1181
1401
|
// `o` opens the pane of the result the rows belong to, else the selected row's.
|
|
1182
1402
|
const paneRow = resultActive ? expandedRow : selectedRow;
|
|
1183
|
-
const canOpenPane = !!paneRow &&
|
|
1403
|
+
const canOpenPane = !!paneRow && sourceResolver.target(paneRow).kind === "pane";
|
|
1184
1404
|
const expandTarget = resultActive ? expandedRow : selectedRow;
|
|
1185
1405
|
|
|
1186
1406
|
const toggleResult = useCallback((row: ASKGToolRow) => {
|
|
@@ -1322,6 +1542,13 @@ export function ASKGPane({ paneId, focused, width, height }: PaneProps) {
|
|
|
1322
1542
|
return;
|
|
1323
1543
|
}
|
|
1324
1544
|
}
|
|
1545
|
+
// Each suggested question asks on its key, unless a thumbs down's reasons have them.
|
|
1546
|
+
const followUp = followUps.find((_question, index) => isPlainKey(event, followUpKey(index)));
|
|
1547
|
+
if (followUp && !feedbackFollowUp && !running) {
|
|
1548
|
+
consume();
|
|
1549
|
+
askAndCompose(followUp);
|
|
1550
|
+
return;
|
|
1551
|
+
}
|
|
1325
1552
|
if (isPlainKey(event, GOOD_ANSWER_KEY, BAD_ANSWER_KEY) && feedbackTarget) {
|
|
1326
1553
|
consume();
|
|
1327
1554
|
rateAnswer(feedbackTarget, event.name === GOOD_ANSWER_KEY ? "up" : "down");
|
|
@@ -1389,6 +1616,12 @@ export function ASKGPane({ paneId, focused, width, height }: PaneProps) {
|
|
|
1389
1616
|
openPaneForTool(paneRow);
|
|
1390
1617
|
return;
|
|
1391
1618
|
}
|
|
1619
|
+
// Off a call, `o` opens what the answer cites.
|
|
1620
|
+
if (isPlainKey(event, "o") && !paneRow && openableSources.length > 0) {
|
|
1621
|
+
consume();
|
|
1622
|
+
void chooseAnswerSource();
|
|
1623
|
+
return;
|
|
1624
|
+
}
|
|
1392
1625
|
if (isPlainKey(event, UNDO_KEY) && selectedRow && canUndo(selectedRow)) {
|
|
1393
1626
|
consume();
|
|
1394
1627
|
void controller.undo(selectedRow.toolCallId);
|
|
@@ -1468,6 +1701,16 @@ export function ASKGPane({ paneId, focused, width, height }: PaneProps) {
|
|
|
1468
1701
|
});
|
|
1469
1702
|
}
|
|
1470
1703
|
if (paneRow && canOpenPane) list.push({ id: "open-pane", key: "o", label: "pen pane", onPress: () => openPaneForTool(paneRow) });
|
|
1704
|
+
else if (!paneRow && openableSources.length > 0) {
|
|
1705
|
+
const one = openableSources.length === 1;
|
|
1706
|
+
list.push({
|
|
1707
|
+
id: "open-source",
|
|
1708
|
+
key: "o",
|
|
1709
|
+
label: one ? "pen source" : "pen sources",
|
|
1710
|
+
title: one ? "Open Source" : "Open a Source",
|
|
1711
|
+
onPress: () => void chooseAnswerSource(),
|
|
1712
|
+
});
|
|
1713
|
+
}
|
|
1471
1714
|
if (selectedRow && canUndo(selectedRow)) {
|
|
1472
1715
|
list.push({ id: "undo", key: UNDO_KEY, label: " undo", title: "Undo", onPress: () => void controller.undo(selectedRow.toolCallId) });
|
|
1473
1716
|
}
|
|
@@ -1490,6 +1733,18 @@ export function ASKGPane({ paneId, focused, width, height }: PaneProps) {
|
|
|
1490
1733
|
{ id: "feedback-bad", key: BAD_ANSWER_KEY, label: "ad", title: "Bad Answer", onPress: () => rateAnswer(feedbackTarget, "down") },
|
|
1491
1734
|
);
|
|
1492
1735
|
}
|
|
1736
|
+
// `[1] [2] [3] ask next`: the keys read as one action, each its own question.
|
|
1737
|
+
if (!feedbackFollowUp && !running) {
|
|
1738
|
+
followUps.forEach((question, index) => {
|
|
1739
|
+
list.push({
|
|
1740
|
+
id: `follow-up-${index}`,
|
|
1741
|
+
key: followUpKey(index),
|
|
1742
|
+
label: index === followUps.length - 1 ? " ask next" : "",
|
|
1743
|
+
title: `Ask: ${question}`,
|
|
1744
|
+
onPress: () => askAndCompose(question),
|
|
1745
|
+
});
|
|
1746
|
+
});
|
|
1747
|
+
}
|
|
1493
1748
|
if (answerTickers.length > 0) list.push({ id: "tickers", key: "t", label: "ickers", onPress: () => void chooseAnswerTicker() });
|
|
1494
1749
|
}
|
|
1495
1750
|
if (state.turns.length > 0 && !confirmation) list.push({ id: "new", key: "n", label: "ew", title: "New Conversation", onPress: newConversation });
|
|
@@ -1498,8 +1753,10 @@ export function ASKGPane({ paneId, focused, width, height }: PaneProps) {
|
|
|
1498
1753
|
}, [
|
|
1499
1754
|
planAccess.emailVerified,
|
|
1500
1755
|
answerPaneConsent,
|
|
1756
|
+
askAndCompose,
|
|
1501
1757
|
answerTickers.length,
|
|
1502
1758
|
canOpenPane,
|
|
1759
|
+
chooseAnswerSource,
|
|
1503
1760
|
chooseAnswerTicker,
|
|
1504
1761
|
chooseFeedbackReason,
|
|
1505
1762
|
confirmation,
|
|
@@ -1510,6 +1767,7 @@ export function ASKGPane({ paneId, focused, width, height }: PaneProps) {
|
|
|
1510
1767
|
feedbackFollowUp,
|
|
1511
1768
|
feedbackTarget,
|
|
1512
1769
|
focusSidebar,
|
|
1770
|
+
followUps,
|
|
1513
1771
|
inputFocused,
|
|
1514
1772
|
leaveSidebar,
|
|
1515
1773
|
listRoom,
|
|
@@ -1517,6 +1775,7 @@ export function ASKGPane({ paneId, focused, width, height }: PaneProps) {
|
|
|
1517
1775
|
newConversation,
|
|
1518
1776
|
openGroups,
|
|
1519
1777
|
openPaneForTool,
|
|
1778
|
+
openableSources.length,
|
|
1520
1779
|
paneConsentPending,
|
|
1521
1780
|
paneRow,
|
|
1522
1781
|
rateAnswer,
|
|
@@ -1558,14 +1817,26 @@ export function ASKGPane({ paneId, focused, width, height }: PaneProps) {
|
|
|
1558
1817
|
: []),
|
|
1559
1818
|
],
|
|
1560
1819
|
hints,
|
|
1561
|
-
menu:
|
|
1562
|
-
?
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1820
|
+
menu: !planAccess.emailVerified
|
|
1821
|
+
? []
|
|
1822
|
+
: state.turns.length === 0
|
|
1823
|
+
? examples.map((question, index): ContextMenuItem => ({
|
|
1824
|
+
id: `example-${index}`,
|
|
1825
|
+
label: `Ask: ${question}`,
|
|
1826
|
+
onSelect: () => askAndCompose(question),
|
|
1827
|
+
}))
|
|
1828
|
+
// The terminal cannot press a citation inside a line: the menu opens each.
|
|
1829
|
+
: [
|
|
1830
|
+
...openableSources.map((source, index): ContextMenuItem => ({
|
|
1831
|
+
id: `source-${index}`,
|
|
1832
|
+
label: `Open ${answerSourceLabel(source, displayContext)}`,
|
|
1833
|
+
onSelect: () => openSource(source),
|
|
1834
|
+
})),
|
|
1835
|
+
...(openableSources.length > 0
|
|
1836
|
+
? [{ id: "copy-answer-sources", label: "Copy Answer with Source Links", onSelect: () => copyAnswerRef.current() }]
|
|
1837
|
+
: []),
|
|
1838
|
+
],
|
|
1839
|
+
}), [askAndCompose, confirmation, displayContext, examples, hints, openSource, openableSources, planAccess.emailVerified, quota, running, state]);
|
|
1569
1840
|
|
|
1570
1841
|
if (!planAccess.emailVerified) {
|
|
1571
1842
|
return (
|
|
@@ -1637,7 +1908,7 @@ export function ASKGPane({ paneId, focused, width, height }: PaneProps) {
|
|
|
1637
1908
|
selectedIndex={inputFocused ? null : exampleIndex}
|
|
1638
1909
|
onAsk={askAndCompose}
|
|
1639
1910
|
/>
|
|
1640
|
-
) : state.turns.map((turn) => (
|
|
1911
|
+
) : state.turns.map((turn, index) => (
|
|
1641
1912
|
<TurnView
|
|
1642
1913
|
key={turn.id}
|
|
1643
1914
|
turn={turn}
|
|
@@ -1664,6 +1935,14 @@ export function ASKGPane({ paneId, focused, width, height }: PaneProps) {
|
|
|
1664
1935
|
onUndo={(toolCallId) => void controller.undo(toolCallId)}
|
|
1665
1936
|
/>
|
|
1666
1937
|
)}
|
|
1938
|
+
sources={turnSources[index] ?? NO_SOURCES}
|
|
1939
|
+
followUps={turn.id === lastTurnId ? followUps : NO_FOLLOW_UPS}
|
|
1940
|
+
displayContext={displayContext}
|
|
1941
|
+
onOpenSource={openSource}
|
|
1942
|
+
onAskFollowUp={(question) => {
|
|
1943
|
+
leaveSidebar();
|
|
1944
|
+
askAndCompose(question);
|
|
1945
|
+
}}
|
|
1667
1946
|
onRetry={() => retryAndCompose(turn.id)}
|
|
1668
1947
|
onUpgrade={upgrade}
|
|
1669
1948
|
// The controls keep their press from the column behind them, so
|
|
@@ -1702,7 +1981,7 @@ export function ASKGPane({ paneId, focused, width, height }: PaneProps) {
|
|
|
1702
1981
|
width={nativePaneChrome ? bodyWidth : bodyWidth - 2}
|
|
1703
1982
|
height={detailHeight - 1}
|
|
1704
1983
|
focused={focused && resultActive}
|
|
1705
|
-
canOpenPane={
|
|
1984
|
+
canOpenPane={sourceResolver.target(expandedRow).kind === "pane"}
|
|
1706
1985
|
openPaneShortcut={paneRow?.toolCallId === expandedRow.toolCallId && canOpenPane ? "o" : undefined}
|
|
1707
1986
|
onOpenSymbol={openSymbol}
|
|
1708
1987
|
onOpenPane={() => openPaneForTool(expandedRow)}
|
|
@@ -39,10 +39,22 @@ export interface ASKGCapabilities {
|
|
|
39
39
|
* repeats it, and a reopened conversation says it on its own response.
|
|
40
40
|
*/
|
|
41
41
|
feedback?: 1;
|
|
42
|
+
/**
|
|
43
|
+
* 1: every read gets a source number (`ref` on its `tool-call` and
|
|
44
|
+
* `tool-executed` frames and in the stored transcript), and the answer cites
|
|
45
|
+
* it after each figure as `[n]`. Numbers run on across a conversation.
|
|
46
|
+
*/
|
|
47
|
+
sources?: 1;
|
|
48
|
+
/**
|
|
49
|
+
* 1: a finished answer is followed by a `follow-ups` frame with one to three
|
|
50
|
+
* questions to ask next. The model writes them after its answer; the server
|
|
51
|
+
* takes them out of the answer's text, so no client ever reads them there.
|
|
52
|
+
*/
|
|
53
|
+
followUps?: 1;
|
|
42
54
|
}
|
|
43
55
|
|
|
44
56
|
/** What this build offers at session start. */
|
|
45
|
-
export const ASKG_CLIENT_CAPABILITIES: ASKGCapabilities = { scripts: 1, feedback: 1 };
|
|
57
|
+
export const ASKG_CLIENT_CAPABILITIES: ASKGCapabilities = { scripts: 1, feedback: 1, sources: 1, followUps: 1 };
|
|
46
58
|
|
|
47
59
|
/** A thumbs up or down on one answer. */
|
|
48
60
|
export type ASKGFeedbackRating = "up" | "down";
|
|
@@ -262,6 +274,8 @@ export interface ASKGToolCallEvent extends ASKGEventBase {
|
|
|
262
274
|
preview: JsonValue;
|
|
263
275
|
timeoutMs: number;
|
|
264
276
|
expiresAt: string;
|
|
277
|
+
/** The number the answer cites this read by; absent on a write and from an older server. */
|
|
278
|
+
ref?: number;
|
|
265
279
|
}
|
|
266
280
|
|
|
267
281
|
/** Compact result information suitable for the tool timeline. */
|
|
@@ -301,6 +315,8 @@ interface ASKGToolExecutedEvent extends ASKGEventBase {
|
|
|
301
315
|
* arguments were empty or too large to send.
|
|
302
316
|
*/
|
|
303
317
|
args?: Record<string, JsonValue>;
|
|
318
|
+
/** The number the answer cites this read by, as on its `tool-call` frame. */
|
|
319
|
+
ref?: number;
|
|
304
320
|
}
|
|
305
321
|
|
|
306
322
|
/** Confirms that one client tool result was accepted by the turn loop. */
|
|
@@ -341,6 +357,14 @@ interface ASKGUsageEvent extends ASKGEventBase {
|
|
|
341
357
|
estimated: boolean;
|
|
342
358
|
}
|
|
343
359
|
|
|
360
|
+
/** Questions to ask next, sent once an answer is finished, before `done`. */
|
|
361
|
+
interface ASKGFollowUpsEvent extends ASKGEventBase {
|
|
362
|
+
type: "follow-ups";
|
|
363
|
+
turnId: string;
|
|
364
|
+
/** One to three, in the order to offer them. */
|
|
365
|
+
questions: string[];
|
|
366
|
+
}
|
|
367
|
+
|
|
344
368
|
/** Reason a turn stream stopped. */
|
|
345
369
|
export type ASKGDoneReason = "complete" | "cancelled" | "error" | "timeout";
|
|
346
370
|
|
|
@@ -360,6 +384,7 @@ export type ASKGSseEvent =
|
|
|
360
384
|
| ASKGToolResultAckEvent
|
|
361
385
|
| ASKGErrorEvent
|
|
362
386
|
| ASKGUsageEvent
|
|
387
|
+
| ASKGFollowUpsEvent
|
|
363
388
|
| ASKGDoneEvent;
|
|
364
389
|
|
|
365
390
|
/** Client result posted for one delegated tool call. */
|