opencandle 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +164 -187
- package/dist/analysts/contracts.d.ts +1 -3
- package/dist/analysts/contracts.js +1 -11
- package/dist/analysts/contracts.js.map +1 -1
- package/dist/analysts/orchestrator.d.ts +1 -3
- package/dist/analysts/orchestrator.js +1 -26
- package/dist/analysts/orchestrator.js.map +1 -1
- package/dist/cli.js +30 -7
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +3 -3
- package/dist/config.js +12 -5
- package/dist/config.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/infra/browser.js +3 -1
- package/dist/infra/browser.js.map +1 -1
- package/dist/infra/cache.d.ts +8 -11
- package/dist/infra/cache.js +17 -15
- package/dist/infra/cache.js.map +1 -1
- package/dist/infra/http-client.d.ts +4 -1
- package/dist/infra/http-client.js +59 -6
- package/dist/infra/http-client.js.map +1 -1
- package/dist/infra/index.d.ts +3 -3
- package/dist/infra/index.js +3 -3
- package/dist/infra/index.js.map +1 -1
- package/dist/infra/native-dependencies.js +2 -2
- package/dist/infra/native-dependencies.js.map +1 -1
- package/dist/infra/node-version.js.map +1 -1
- package/dist/infra/opencandle-paths.d.ts +0 -3
- package/dist/infra/opencandle-paths.js +4 -11
- package/dist/infra/opencandle-paths.js.map +1 -1
- package/dist/infra/rate-limiter.js +12 -9
- package/dist/infra/rate-limiter.js.map +1 -1
- package/dist/market-state/alert-conditions.d.ts +34 -0
- package/dist/market-state/alert-conditions.js +23 -0
- package/dist/market-state/alert-conditions.js.map +1 -0
- package/dist/market-state/alert-runner.d.ts +55 -0
- package/dist/market-state/alert-runner.js +634 -0
- package/dist/market-state/alert-runner.js.map +1 -0
- package/dist/market-state/daily-report.d.ts +26 -0
- package/dist/market-state/daily-report.js +179 -0
- package/dist/market-state/daily-report.js.map +1 -0
- package/dist/market-state/local-automation-service.d.ts +25 -0
- package/dist/market-state/local-automation-service.js +119 -0
- package/dist/market-state/local-automation-service.js.map +1 -0
- package/dist/market-state/notification-delivery.d.ts +14 -0
- package/dist/market-state/notification-delivery.js +139 -0
- package/dist/market-state/notification-delivery.js.map +1 -0
- package/dist/market-state/resolve-for-mutation.d.ts +10 -0
- package/dist/market-state/resolve-for-mutation.js +15 -0
- package/dist/market-state/resolve-for-mutation.js.map +1 -0
- package/dist/market-state/resolve.d.ts +14 -0
- package/dist/market-state/resolve.js +89 -0
- package/dist/market-state/resolve.js.map +1 -0
- package/dist/market-state/service.d.ts +527 -0
- package/dist/market-state/service.js +1099 -0
- package/dist/market-state/service.js.map +1 -0
- package/dist/memory/index.d.ts +7 -7
- package/dist/memory/index.js +6 -6
- package/dist/memory/index.js.map +1 -1
- package/dist/memory/manager.js +11 -11
- package/dist/memory/manager.js.map +1 -1
- package/dist/memory/retrieval.js +7 -4
- package/dist/memory/retrieval.js.map +1 -1
- package/dist/memory/sqlite.js +385 -3
- package/dist/memory/sqlite.js.map +1 -1
- package/dist/memory/storage.js +1 -2
- package/dist/memory/storage.js.map +1 -1
- package/dist/memory/tool-defaults.js +64 -28
- package/dist/memory/tool-defaults.js.map +1 -1
- package/dist/memory/types.js.map +1 -1
- package/dist/monitor.d.ts +2 -0
- package/dist/monitor.js +104 -0
- package/dist/monitor.js.map +1 -0
- package/dist/onboarding/connect.js +4 -6
- package/dist/onboarding/connect.js.map +1 -1
- package/dist/onboarding/credential-interceptor.js +1 -1
- package/dist/onboarding/credential-interceptor.js.map +1 -1
- package/dist/onboarding/degradation-accumulator.js +1 -3
- package/dist/onboarding/degradation-accumulator.js.map +1 -1
- package/dist/onboarding/providers.js +3 -16
- package/dist/onboarding/providers.js.map +1 -1
- package/dist/onboarding/state.js.map +1 -1
- package/dist/onboarding/tool-helpers.js +1 -1
- package/dist/onboarding/tool-helpers.js.map +1 -1
- package/dist/onboarding/tool-tags.js +6 -4
- package/dist/onboarding/tool-tags.js.map +1 -1
- package/dist/onboarding/validation.js +1 -1
- package/dist/onboarding/validation.js.map +1 -1
- package/dist/pi/opencandle-extension.d.ts +8 -0
- package/dist/pi/opencandle-extension.js +412 -28
- package/dist/pi/opencandle-extension.js.map +1 -1
- package/dist/pi/session.d.ts +1 -1
- package/dist/pi/session.js +3 -1
- package/dist/pi/session.js.map +1 -1
- package/dist/pi/setup.js +8 -3
- package/dist/pi/setup.js.map +1 -1
- package/dist/pi/tool-adapter.js +5 -2
- package/dist/pi/tool-adapter.js.map +1 -1
- package/dist/prompts/context-builder.d.ts +1 -1
- package/dist/prompts/context-builder.js +19 -6
- package/dist/prompts/context-builder.js.map +1 -1
- package/dist/prompts/policy-cards.d.ts +1 -1
- package/dist/prompts/policy-cards.js +1 -1
- package/dist/prompts/policy-cards.js.map +1 -1
- package/dist/prompts/sections.d.ts +1 -1
- package/dist/prompts/symbol-preflight.d.ts +20 -0
- package/dist/prompts/symbol-preflight.js +49 -0
- package/dist/prompts/symbol-preflight.js.map +1 -0
- package/dist/prompts/workflow-prompts.d.ts +1 -1
- package/dist/prompts/workflow-prompts.js +54 -16
- package/dist/prompts/workflow-prompts.js.map +1 -1
- package/dist/providers/alpha-vantage.d.ts +1 -1
- package/dist/providers/alpha-vantage.js +26 -7
- package/dist/providers/alpha-vantage.js.map +1 -1
- package/dist/providers/coingecko.js +1 -1
- package/dist/providers/coingecko.js.map +1 -1
- package/dist/providers/errors.d.ts +5 -0
- package/dist/providers/errors.js +11 -0
- package/dist/providers/errors.js.map +1 -0
- package/dist/providers/exa-search.d.ts +2 -2
- package/dist/providers/exa-search.js +19 -11
- package/dist/providers/exa-search.js.map +1 -1
- package/dist/providers/fear-greed.js +1 -1
- package/dist/providers/fear-greed.js.map +1 -1
- package/dist/providers/finnhub.js +3 -5
- package/dist/providers/finnhub.js.map +1 -1
- package/dist/providers/fred.js +2 -2
- package/dist/providers/fred.js.map +1 -1
- package/dist/providers/index.d.ts +7 -6
- package/dist/providers/index.js +6 -5
- package/dist/providers/index.js.map +1 -1
- package/dist/providers/reddit.js +2 -2
- package/dist/providers/reddit.js.map +1 -1
- package/dist/providers/sec-edgar.d.ts +1 -0
- package/dist/providers/sec-edgar.js +12 -4
- package/dist/providers/sec-edgar.js.map +1 -1
- package/dist/providers/tradingview.d.ts +47 -0
- package/dist/providers/tradingview.js +275 -0
- package/dist/providers/tradingview.js.map +1 -0
- package/dist/providers/twitter.js +6 -8
- package/dist/providers/twitter.js.map +1 -1
- package/dist/providers/web-search.js +26 -12
- package/dist/providers/web-search.js.map +1 -1
- package/dist/providers/with-fallback.js +4 -2
- package/dist/providers/with-fallback.js.map +1 -1
- package/dist/providers/wrap-provider.d.ts +2 -3
- package/dist/providers/wrap-provider.js +14 -8
- package/dist/providers/wrap-provider.js.map +1 -1
- package/dist/providers/yahoo-finance.d.ts +1 -1
- package/dist/providers/yahoo-finance.js +101 -17
- package/dist/providers/yahoo-finance.js.map +1 -1
- package/dist/routing/classify-intent.d.ts +6 -0
- package/dist/routing/classify-intent.js +78 -7
- package/dist/routing/classify-intent.js.map +1 -1
- package/dist/routing/defaults.d.ts +1 -1
- package/dist/routing/entity-extractor.d.ts +1 -0
- package/dist/routing/entity-extractor.js +234 -29
- package/dist/routing/entity-extractor.js.map +1 -1
- package/dist/routing/fund-symbols.d.ts +2 -0
- package/dist/routing/fund-symbols.js +55 -0
- package/dist/routing/fund-symbols.js.map +1 -0
- package/dist/routing/horizon.d.ts +1 -0
- package/dist/routing/horizon.js +10 -0
- package/dist/routing/horizon.js.map +1 -0
- package/dist/routing/index.d.ts +10 -10
- package/dist/routing/index.js +6 -6
- package/dist/routing/index.js.map +1 -1
- package/dist/routing/planning.d.ts +1 -1
- package/dist/routing/planning.js +65 -34
- package/dist/routing/planning.js.map +1 -1
- package/dist/routing/route-manifest.d.ts +2 -2
- package/dist/routing/route-manifest.js +25 -4
- package/dist/routing/route-manifest.js.map +1 -1
- package/dist/routing/router-llm-client.js.map +1 -1
- package/dist/routing/router-prompt.js +7 -9
- package/dist/routing/router-prompt.js.map +1 -1
- package/dist/routing/router-types.d.ts +1 -0
- package/dist/routing/router.js +137 -22
- package/dist/routing/router.js.map +1 -1
- package/dist/routing/slot-resolver.d.ts +1 -1
- package/dist/routing/slot-resolver.js +2 -4
- package/dist/routing/slot-resolver.js.map +1 -1
- package/dist/routing/symbol-disambiguator.d.ts +11 -0
- package/dist/routing/symbol-disambiguator.js +52 -0
- package/dist/routing/symbol-disambiguator.js.map +1 -0
- package/dist/routing/turn-context.d.ts +1 -1
- package/dist/routing/turn-context.js +1 -1
- package/dist/routing/turn-context.js.map +1 -1
- package/dist/routing/types.d.ts +2 -0
- package/dist/runtime/answer-contracts.js +36 -8
- package/dist/runtime/answer-contracts.js.map +1 -1
- package/dist/runtime/artifact-contracts.js.map +1 -1
- package/dist/runtime/planning-evidence.js +47 -26
- package/dist/runtime/planning-evidence.js.map +1 -1
- package/dist/runtime/prompt-step.d.ts +1 -9
- package/dist/runtime/prompt-step.js +0 -10
- package/dist/runtime/prompt-step.js.map +1 -1
- package/dist/runtime/run-context.d.ts +5 -2
- package/dist/runtime/run-context.js +8 -1
- package/dist/runtime/run-context.js.map +1 -1
- package/dist/runtime/session-coordinator.d.ts +13 -5
- package/dist/runtime/session-coordinator.js +160 -20
- package/dist/runtime/session-coordinator.js.map +1 -1
- package/dist/runtime/session-title.d.ts +14 -0
- package/dist/runtime/session-title.js +50 -0
- package/dist/runtime/session-title.js.map +1 -0
- package/dist/runtime/tool-defaults-wrapper.js +1 -3
- package/dist/runtime/tool-defaults-wrapper.js.map +1 -1
- package/dist/runtime/validation.js.map +1 -1
- package/dist/runtime/workflow-events.js.map +1 -1
- package/dist/runtime/workflow-runner.d.ts +3 -3
- package/dist/runtime/workflow-runner.js +1 -1
- package/dist/runtime/workflow-runner.js.map +1 -1
- package/dist/sentiment/adapters/finnhub.d.ts +1 -1
- package/dist/sentiment/adapters/finnhub.js +6 -1
- package/dist/sentiment/adapters/finnhub.js.map +1 -1
- package/dist/sentiment/adapters/reddit.d.ts +2 -2
- package/dist/sentiment/adapters/twitter.d.ts +1 -1
- package/dist/sentiment/adapters/web.d.ts +1 -1
- package/dist/sentiment/index.d.ts +9 -11
- package/dist/sentiment/index.js +9 -20
- package/dist/sentiment/index.js.map +1 -1
- package/dist/sentiment/keywords.js +26 -4
- package/dist/sentiment/keywords.js.map +1 -1
- package/dist/sentiment/pipeline.d.ts +2 -2
- package/dist/sentiment/pipeline.js +1 -1
- package/dist/sentiment/pipeline.js.map +1 -1
- package/dist/sentiment/scorer.js +1 -1
- package/dist/sentiment/store.d.ts +1 -1
- package/dist/sentiment/store.js +1 -1
- package/dist/sentiment/store.js.map +1 -1
- package/dist/sentiment/trends.d.ts +1 -1
- package/dist/sentiment/trends.js.map +1 -1
- package/dist/sentiment/types.js.map +1 -1
- package/dist/system-prompt.js +3 -2
- package/dist/system-prompt.js.map +1 -1
- package/dist/tool-kit.d.ts +7 -7
- package/dist/tool-kit.js +4 -4
- package/dist/tool-kit.js.map +1 -1
- package/dist/tools/fundamentals/company-overview.js +11 -6
- package/dist/tools/fundamentals/company-overview.js.map +1 -1
- package/dist/tools/fundamentals/comps.js +18 -9
- package/dist/tools/fundamentals/comps.js.map +1 -1
- package/dist/tools/fundamentals/dcf.js +23 -11
- package/dist/tools/fundamentals/dcf.js.map +1 -1
- package/dist/tools/fundamentals/earnings.js +8 -3
- package/dist/tools/fundamentals/earnings.js.map +1 -1
- package/dist/tools/fundamentals/financials.js +8 -3
- package/dist/tools/fundamentals/financials.js.map +1 -1
- package/dist/tools/fundamentals/sec-filings.js +21 -6
- package/dist/tools/fundamentals/sec-filings.js.map +1 -1
- package/dist/tools/index.d.ts +23 -19
- package/dist/tools/index.js +51 -39
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/interaction/ask-user.js +15 -3
- package/dist/tools/interaction/ask-user.js.map +1 -1
- package/dist/tools/interaction/twitter-login.js +13 -3
- package/dist/tools/interaction/twitter-login.js.map +1 -1
- package/dist/tools/macro/fear-greed.js.map +1 -1
- package/dist/tools/macro/fred-data.d.ts +1 -1
- package/dist/tools/macro/fred-data.js +17 -6
- package/dist/tools/macro/fred-data.js.map +1 -1
- package/dist/tools/market/crypto-history.js +3 -1
- package/dist/tools/market/crypto-history.js.map +1 -1
- package/dist/tools/market/crypto-price.js +3 -1
- package/dist/tools/market/crypto-price.js.map +1 -1
- package/dist/tools/market/screen-stocks.d.ts +18 -0
- package/dist/tools/market/screen-stocks.js +252 -0
- package/dist/tools/market/screen-stocks.js.map +1 -0
- package/dist/tools/market/search-ticker.js +160 -8
- package/dist/tools/market/search-ticker.js.map +1 -1
- package/dist/tools/market/stock-history.d.ts +2 -2
- package/dist/tools/market/stock-history.js +26 -7
- package/dist/tools/market/stock-history.js.map +1 -1
- package/dist/tools/market/stock-quote.js +5 -3
- package/dist/tools/market/stock-quote.js.map +1 -1
- package/dist/tools/options/greeks.js +1 -1
- package/dist/tools/options/greeks.js.map +1 -1
- package/dist/tools/options/option-chain.js +19 -6
- package/dist/tools/options/option-chain.js.map +1 -1
- package/dist/tools/portfolio/alerts.d.ts +15 -0
- package/dist/tools/portfolio/alerts.js +357 -0
- package/dist/tools/portfolio/alerts.js.map +1 -0
- package/dist/tools/portfolio/correlation.d.ts +1 -1
- package/dist/tools/portfolio/correlation.js +33 -13
- package/dist/tools/portfolio/correlation.js.map +1 -1
- package/dist/tools/portfolio/daily-report.d.ts +8 -0
- package/dist/tools/portfolio/daily-report.js +83 -0
- package/dist/tools/portfolio/daily-report.js.map +1 -0
- package/dist/tools/portfolio/holdings-overlap.js +10 -3
- package/dist/tools/portfolio/holdings-overlap.js.map +1 -1
- package/dist/tools/portfolio/notifications.d.ts +7 -0
- package/dist/tools/portfolio/notifications.js +43 -0
- package/dist/tools/portfolio/notifications.js.map +1 -0
- package/dist/tools/portfolio/predictions.d.ts +12 -6
- package/dist/tools/portfolio/predictions.js +337 -87
- package/dist/tools/portfolio/predictions.js.map +1 -1
- package/dist/tools/portfolio/risk-analysis.d.ts +1 -1
- package/dist/tools/portfolio/risk-analysis.js +45 -6
- package/dist/tools/portfolio/risk-analysis.js.map +1 -1
- package/dist/tools/portfolio/tracker.d.ts +4 -3
- package/dist/tools/portfolio/tracker.js +246 -101
- package/dist/tools/portfolio/tracker.js.map +1 -1
- package/dist/tools/portfolio/watchlist.d.ts +6 -4
- package/dist/tools/portfolio/watchlist.js +208 -108
- package/dist/tools/portfolio/watchlist.js.map +1 -1
- package/dist/tools/sentiment/reddit-sentiment.js +23 -10
- package/dist/tools/sentiment/reddit-sentiment.js.map +1 -1
- package/dist/tools/sentiment/sentiment-summary.js +15 -13
- package/dist/tools/sentiment/sentiment-summary.js.map +1 -1
- package/dist/tools/sentiment/sentiment-trend.d.ts +1 -1
- package/dist/tools/sentiment/sentiment-trend.js +12 -2
- package/dist/tools/sentiment/sentiment-trend.js.map +1 -1
- package/dist/tools/sentiment/twitter-sentiment.js +12 -5
- package/dist/tools/sentiment/twitter-sentiment.js.map +1 -1
- package/dist/tools/sentiment/untrusted-text.d.ts +2 -0
- package/dist/tools/sentiment/untrusted-text.js +17 -0
- package/dist/tools/sentiment/untrusted-text.js.map +1 -0
- package/dist/tools/sentiment/web-search.js +9 -13
- package/dist/tools/sentiment/web-search.js.map +1 -1
- package/dist/tools/sentiment/web-sentiment.js +15 -3
- package/dist/tools/sentiment/web-sentiment.js.map +1 -1
- package/dist/tools/technical/backtest.d.ts +1 -1
- package/dist/tools/technical/backtest.js +27 -20
- package/dist/tools/technical/backtest.js.map +1 -1
- package/dist/tools/technical/indicators.js +23 -5
- package/dist/tools/technical/indicators.js.map +1 -1
- package/dist/types/index.d.ts +3 -3
- package/dist/types/index.js.map +1 -1
- package/dist/types/market.d.ts +1 -0
- package/dist/types/portfolio.d.ts +14 -4
- package/dist/workflows/compare-assets.d.ts +0 -3
- package/dist/workflows/compare-assets.js +20 -11
- package/dist/workflows/compare-assets.js.map +1 -1
- package/dist/workflows/index.d.ts +3 -4
- package/dist/workflows/index.js +3 -3
- package/dist/workflows/index.js.map +1 -1
- package/dist/workflows/options-screener.d.ts +0 -3
- package/dist/workflows/options-screener.js +4 -11
- package/dist/workflows/options-screener.js.map +1 -1
- package/dist/workflows/portfolio-builder.d.ts +0 -3
- package/dist/workflows/portfolio-builder.js +0 -8
- package/dist/workflows/portfolio-builder.js.map +1 -1
- package/gui/server/ask-user-bridge.ts +1 -1
- package/gui/server/automation-heartbeat.ts +97 -0
- package/gui/server/background-quotes.ts +97 -1
- package/gui/server/chat-event-adapter.ts +32 -10
- package/gui/server/chat-run-session.ts +16 -0
- package/gui/server/invoke-tool.ts +144 -1
- package/gui/server/live-chat-event-adapter.ts +21 -6
- package/gui/server/market-state-api.ts +315 -0
- package/gui/server/model-setup.ts +149 -2
- package/gui/server/private-api-access.ts +62 -0
- package/gui/server/projector.ts +12 -7
- package/gui/server/prompt-observation.ts +4 -7
- package/gui/server/quote-snapshot-store.ts +50 -0
- package/gui/server/server.ts +200 -451
- package/gui/server/session-actions.ts +186 -1
- package/gui/server/shutdown.ts +47 -0
- package/gui/server/tool-invoke-ack.ts +49 -0
- package/gui/server/tool-metadata.ts +23 -10
- package/gui/server/websocket.ts +13 -3
- package/gui/server/writer-lock.ts +6 -2
- package/gui/server/ws-hub.ts +292 -0
- package/gui/shared/chat-events.ts +16 -1
- package/gui/shared/event-reducer.ts +24 -6
- package/gui/web/dist/assets/CatalogOverlay-eJ2cBk33.js +1 -0
- package/gui/web/dist/assets/index-2KZtKBmu.css +1 -0
- package/gui/web/dist/assets/index-CveNgtDg.js +69 -0
- package/gui/web/dist/index.html +2 -2
- package/package.json +5 -1
- package/src/analysts/contracts.ts +10 -23
- package/src/analysts/orchestrator.ts +8 -43
- package/src/cli.ts +35 -12
- package/src/config.ts +17 -9
- package/src/index.ts +1 -1
- package/src/infra/browser.ts +3 -1
- package/src/infra/cache.ts +41 -30
- package/src/infra/http-client.ts +72 -6
- package/src/infra/index.ts +7 -10
- package/src/infra/native-dependencies.ts +8 -3
- package/src/infra/node-version.ts +3 -1
- package/src/infra/opencandle-paths.ts +3 -14
- package/src/infra/rate-limiter.ts +22 -19
- package/src/market-state/alert-conditions.ts +82 -0
- package/src/market-state/alert-runner.ts +863 -0
- package/src/market-state/daily-report.ts +247 -0
- package/src/market-state/local-automation-service.ts +162 -0
- package/src/market-state/notification-delivery.ts +158 -0
- package/src/market-state/resolve-for-mutation.ts +24 -0
- package/src/market-state/resolve.ts +112 -0
- package/src/market-state/service.ts +2344 -0
- package/src/memory/index.ts +7 -7
- package/src/memory/manager.ts +14 -16
- package/src/memory/retrieval.ts +8 -7
- package/src/memory/sqlite.ts +407 -6
- package/src/memory/storage.ts +5 -15
- package/src/memory/tool-defaults.ts +60 -39
- package/src/memory/types.ts +3 -3
- package/src/monitor.ts +121 -0
- package/src/onboarding/connect.ts +10 -33
- package/src/onboarding/credential-interceptor.ts +3 -15
- package/src/onboarding/degradation-accumulator.ts +1 -3
- package/src/onboarding/providers.ts +9 -40
- package/src/onboarding/state.ts +4 -15
- package/src/onboarding/tool-helpers.ts +2 -9
- package/src/onboarding/tool-tags.ts +6 -6
- package/src/onboarding/validation.ts +14 -20
- package/src/pi/opencandle-extension.ts +529 -85
- package/src/pi/session.ts +7 -5
- package/src/pi/setup.ts +61 -43
- package/src/pi/tool-adapter.ts +5 -2
- package/src/prompts/context-builder.ts +23 -12
- package/src/prompts/policy-cards.ts +2 -2
- package/src/prompts/sections.ts +1 -1
- package/src/prompts/symbol-preflight.ts +80 -0
- package/src/prompts/workflow-prompts.ts +77 -28
- package/src/providers/alpha-vantage.ts +58 -39
- package/src/providers/coingecko.ts +2 -5
- package/src/providers/errors.ts +9 -0
- package/src/providers/exa-search.ts +24 -22
- package/src/providers/fear-greed.ts +1 -1
- package/src/providers/finnhub.ts +7 -6
- package/src/providers/fred.ts +3 -3
- package/src/providers/index.ts +14 -6
- package/src/providers/reddit.ts +17 -6
- package/src/providers/sec-edgar.ts +20 -6
- package/src/providers/tradingview.ts +399 -0
- package/src/providers/twitter.ts +6 -8
- package/src/providers/web-search.ts +30 -20
- package/src/providers/with-fallback.ts +8 -7
- package/src/providers/wrap-provider.ts +15 -10
- package/src/providers/yahoo-finance.ts +140 -35
- package/src/routing/classify-intent.ts +101 -10
- package/src/routing/defaults.ts +1 -1
- package/src/routing/entity-extractor.ts +287 -38
- package/src/routing/fund-symbols.ts +58 -0
- package/src/routing/horizon.ts +7 -0
- package/src/routing/index.ts +48 -48
- package/src/routing/planning.ts +144 -53
- package/src/routing/route-manifest.ts +37 -15
- package/src/routing/router-llm-client.ts +4 -4
- package/src/routing/router-prompt.ts +15 -19
- package/src/routing/router-types.ts +2 -5
- package/src/routing/router.ts +251 -53
- package/src/routing/slot-resolver.ts +34 -11
- package/src/routing/symbol-disambiguator.ts +72 -0
- package/src/routing/turn-context.ts +6 -9
- package/src/routing/types.ts +2 -0
- package/src/runtime/answer-contracts.ts +82 -43
- package/src/runtime/artifact-contracts.ts +2 -1
- package/src/runtime/planning-evidence.ts +157 -66
- package/src/runtime/prompt-step.ts +1 -16
- package/src/runtime/run-context.ts +12 -2
- package/src/runtime/session-coordinator.ts +238 -63
- package/src/runtime/session-title.ts +60 -0
- package/src/runtime/tool-defaults-wrapper.ts +1 -3
- package/src/runtime/validation.ts +1 -4
- package/src/runtime/workflow-events.ts +7 -7
- package/src/runtime/workflow-runner.ts +5 -11
- package/src/sentiment/adapters/finnhub.ts +7 -2
- package/src/sentiment/adapters/reddit.ts +2 -2
- package/src/sentiment/adapters/twitter.ts +1 -1
- package/src/sentiment/adapters/web.ts +1 -1
- package/src/sentiment/index.ts +16 -26
- package/src/sentiment/keywords.ts +26 -4
- package/src/sentiment/pipeline.ts +15 -4
- package/src/sentiment/scorer.ts +1 -1
- package/src/sentiment/store.ts +2 -2
- package/src/sentiment/trends.ts +9 -3
- package/src/sentiment/types.ts +5 -4
- package/src/system-prompt.ts +3 -2
- package/src/tool-kit.ts +10 -9
- package/src/tools/fundamentals/company-overview.ts +19 -9
- package/src/tools/fundamentals/comps.ts +68 -55
- package/src/tools/fundamentals/dcf.ts +145 -95
- package/src/tools/fundamentals/earnings.ts +16 -6
- package/src/tools/fundamentals/financials.ts +16 -7
- package/src/tools/fundamentals/sec-filings.ts +37 -16
- package/src/tools/index.ts +51 -39
- package/src/tools/interaction/ask-user.ts +22 -10
- package/src/tools/interaction/twitter-login.ts +17 -5
- package/src/tools/macro/fear-greed.ts +1 -1
- package/src/tools/macro/fred-data.ts +58 -46
- package/src/tools/market/crypto-history.ts +8 -3
- package/src/tools/market/crypto-price.ts +6 -6
- package/src/tools/market/screen-stocks.ts +279 -0
- package/src/tools/market/search-ticker.ts +218 -17
- package/src/tools/market/stock-history.ts +37 -12
- package/src/tools/market/stock-quote.ts +10 -7
- package/src/tools/options/greeks.ts +5 -5
- package/src/tools/options/option-chain.ts +41 -17
- package/src/tools/portfolio/alerts.ts +457 -0
- package/src/tools/portfolio/correlation.ts +47 -20
- package/src/tools/portfolio/daily-report.ts +101 -0
- package/src/tools/portfolio/holdings-overlap.ts +31 -15
- package/src/tools/portfolio/notifications.ts +45 -0
- package/src/tools/portfolio/predictions.ts +406 -106
- package/src/tools/portfolio/risk-analysis.ts +46 -7
- package/src/tools/portfolio/tracker.ts +270 -109
- package/src/tools/portfolio/watchlist.ts +250 -121
- package/src/tools/sentiment/reddit-sentiment.ts +50 -24
- package/src/tools/sentiment/sentiment-summary.ts +62 -41
- package/src/tools/sentiment/sentiment-trend.ts +24 -7
- package/src/tools/sentiment/twitter-sentiment.ts +22 -15
- package/src/tools/sentiment/untrusted-text.ts +21 -0
- package/src/tools/sentiment/web-search.ts +21 -18
- package/src/tools/sentiment/web-sentiment.ts +26 -10
- package/src/tools/technical/backtest.ts +32 -22
- package/src/tools/technical/indicators.ts +39 -14
- package/src/types/index.ts +8 -3
- package/src/types/market.ts +1 -0
- package/src/types/portfolio.ts +14 -4
- package/src/types/sentiment.ts +2 -2
- package/src/workflows/compare-assets.ts +33 -21
- package/src/workflows/index.ts +3 -4
- package/src/workflows/options-screener.ts +27 -29
- package/src/workflows/portfolio-builder.ts +34 -27
- package/dist/workflows/types.d.ts +0 -4
- package/dist/workflows/types.js +0 -2
- package/dist/workflows/types.js.map +0 -1
- package/gui/web/dist/assets/CatalogOverlay-Bmp6Knu7.js +0 -1
- package/gui/web/dist/assets/index-Bxt9QpLX.css +0 -1
- package/gui/web/dist/assets/index-CZ9DHZYy.js +0 -67
- package/src/workflows/types.ts +0 -4
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import type { Api, Model } from "@earendil-works/pi-ai";
|
|
2
|
+
import { persistProviderCredential } from "../../src/onboarding/connect.js";
|
|
3
|
+
import { getCredentialSource, PROVIDERS, type ProviderId } from "../../src/onboarding/providers.js";
|
|
4
|
+
import { validateCredential } from "../../src/onboarding/validation.js";
|
|
2
5
|
|
|
3
6
|
export type ModelSetupRequirement = "ready" | "select_model" | "connect_auth";
|
|
4
7
|
|
|
@@ -24,6 +27,47 @@ export interface ModelSetupRegistry {
|
|
|
24
27
|
hasConfiguredAuth(model: Model<Api>): boolean;
|
|
25
28
|
}
|
|
26
29
|
|
|
30
|
+
interface ModelSetupAuthStorage {
|
|
31
|
+
set(provider: string, credential: { type: "api_key"; key: string }): void;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
interface MutableModelSetupRegistry extends ModelSetupRegistry {
|
|
35
|
+
authStorage: ModelSetupAuthStorage;
|
|
36
|
+
find(provider: string, modelId: string): Model<Api> | undefined;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
interface ModelSetupSession {
|
|
40
|
+
modelRegistry: MutableModelSetupRegistry;
|
|
41
|
+
model?: Model<Api>;
|
|
42
|
+
setModel(model: Model<Api>): Promise<void>;
|
|
43
|
+
settingsManager: {
|
|
44
|
+
flush(): Promise<void>;
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
interface ModelSetupSessionManager {
|
|
49
|
+
appendCustomMessageEntry(
|
|
50
|
+
customType: string,
|
|
51
|
+
content: string,
|
|
52
|
+
isActive: boolean,
|
|
53
|
+
data: Record<string, unknown>,
|
|
54
|
+
): void;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export interface ModelSetupController {
|
|
58
|
+
buildCurrentModelSetupState(): ModelSetupState;
|
|
59
|
+
handleSaveModelApiKey(providerId: string, apiKey: string): Promise<void>;
|
|
60
|
+
handleSaveProviderApiKey(providerId: string, apiKey: string): Promise<void>;
|
|
61
|
+
handleSelectModel(provider: string, modelId: string): Promise<void>;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export interface ModelSetupControllerOptions {
|
|
65
|
+
role: string;
|
|
66
|
+
getSession: () => ModelSetupSession;
|
|
67
|
+
getSessionManager: () => ModelSetupSessionManager;
|
|
68
|
+
broadcastState: () => void;
|
|
69
|
+
}
|
|
70
|
+
|
|
27
71
|
export const modelSetupProviders: ModelSetupProvider[] = [
|
|
28
72
|
{
|
|
29
73
|
id: "google",
|
|
@@ -83,8 +127,7 @@ export function findPreferredModel(
|
|
|
83
127
|
const available = sortModels(registry.getAvailable(), provider.defaultProvider);
|
|
84
128
|
return (
|
|
85
129
|
available.find(
|
|
86
|
-
(model) =>
|
|
87
|
-
model.provider === provider.defaultProvider && model.id === provider.defaultModel,
|
|
130
|
+
(model) => model.provider === provider.defaultProvider && model.id === provider.defaultModel,
|
|
88
131
|
) ?? available.find((model) => model.provider === provider.defaultProvider)
|
|
89
132
|
);
|
|
90
133
|
}
|
|
@@ -98,3 +141,107 @@ export function sortModels(models: Model<Api>[], preferredProvider?: string): Mo
|
|
|
98
141
|
return byProvider !== 0 ? byProvider : a.id.localeCompare(b.id);
|
|
99
142
|
});
|
|
100
143
|
}
|
|
144
|
+
|
|
145
|
+
export function createModelSetupController({
|
|
146
|
+
role,
|
|
147
|
+
getSession,
|
|
148
|
+
getSessionManager,
|
|
149
|
+
broadcastState,
|
|
150
|
+
}: ModelSetupControllerOptions): ModelSetupController {
|
|
151
|
+
function ensureWriter(): void {
|
|
152
|
+
if (role !== "writer") throw new Error("Read-only follower mode");
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
function buildCurrentModelSetupState(): ModelSetupState {
|
|
156
|
+
const session = getSession();
|
|
157
|
+
return buildModelSetupState(session.modelRegistry, session.model);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
async function handleSaveModelApiKey(providerId: string, apiKey: string): Promise<void> {
|
|
161
|
+
ensureWriter();
|
|
162
|
+
|
|
163
|
+
const provider = modelSetupProviders.find((candidate) => candidate.id === providerId);
|
|
164
|
+
if (!provider) throw new Error(`Unknown model provider: ${providerId}`);
|
|
165
|
+
|
|
166
|
+
const trimmed = apiKey.trim();
|
|
167
|
+
if (!trimmed) throw new Error(`Paste a ${provider.label} API key first.`);
|
|
168
|
+
|
|
169
|
+
const session = getSession();
|
|
170
|
+
session.modelRegistry.authStorage.set(provider.id, { type: "api_key", key: trimmed });
|
|
171
|
+
session.modelRegistry.refresh();
|
|
172
|
+
|
|
173
|
+
const model = findPreferredModel(session.modelRegistry, provider);
|
|
174
|
+
if (!model) {
|
|
175
|
+
throw new Error(
|
|
176
|
+
`Saved the ${provider.label} key, but no ${provider.label} models are available yet.`,
|
|
177
|
+
);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
await session.setModel(model);
|
|
181
|
+
await session.settingsManager.flush();
|
|
182
|
+
getSessionManager().appendCustomMessageEntry(
|
|
183
|
+
"opencandle-model-setup",
|
|
184
|
+
`Connected ${provider.label} and selected ${model.provider}/${model.id}.`,
|
|
185
|
+
true,
|
|
186
|
+
{ source: "gui", provider: provider.id, model: `${model.provider}/${model.id}` },
|
|
187
|
+
);
|
|
188
|
+
broadcastState();
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
async function handleSaveProviderApiKey(providerId: string, apiKey: string): Promise<void> {
|
|
192
|
+
ensureWriter();
|
|
193
|
+
|
|
194
|
+
const descriptor = PROVIDERS.find((candidate) => candidate.id === providerId);
|
|
195
|
+
if (!descriptor) throw new Error(`Unknown provider: ${providerId}`);
|
|
196
|
+
|
|
197
|
+
if (getCredentialSource(descriptor.id) === "env") {
|
|
198
|
+
throw new Error(
|
|
199
|
+
`${descriptor.displayName} is set via the ${descriptor.envVar} environment variable. Unset it to override here.`,
|
|
200
|
+
);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
const trimmed = apiKey.trim();
|
|
204
|
+
if (!trimmed) throw new Error(`Paste a ${descriptor.displayName} API key first.`);
|
|
205
|
+
|
|
206
|
+
const validation = await validateCredential(descriptor.id as ProviderId, trimmed);
|
|
207
|
+
if (validation.status === "invalid") {
|
|
208
|
+
const statusHint =
|
|
209
|
+
validation.httpStatus !== undefined ? ` (HTTP ${validation.httpStatus})` : "";
|
|
210
|
+
const messageHint = validation.message ? ` — ${validation.message}` : "";
|
|
211
|
+
throw new Error(
|
|
212
|
+
`${descriptor.displayName} rejected the key${statusHint}${messageHint}. The existing configuration was not changed.`,
|
|
213
|
+
);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
persistProviderCredential(descriptor.id as ProviderId, trimmed);
|
|
217
|
+
|
|
218
|
+
const verifiedNote =
|
|
219
|
+
validation.status === "transient"
|
|
220
|
+
? `Saved ${descriptor.displayName} key but couldn't verify it (${validation.reason}). The next request will surface any issue.`
|
|
221
|
+
: `Connected ${descriptor.displayName}. Key saved to ~/.opencandle/config.json.`;
|
|
222
|
+
|
|
223
|
+
getSessionManager().appendCustomMessageEntry("opencandle-provider-setup", verifiedNote, true, {
|
|
224
|
+
source: "gui",
|
|
225
|
+
provider: descriptor.id,
|
|
226
|
+
status: validation.status,
|
|
227
|
+
});
|
|
228
|
+
broadcastState();
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
async function handleSelectModel(provider: string, modelId: string): Promise<void> {
|
|
232
|
+
ensureWriter();
|
|
233
|
+
const session = getSession();
|
|
234
|
+
session.modelRegistry.refresh();
|
|
235
|
+
const model = session.modelRegistry.find(provider, modelId);
|
|
236
|
+
if (!model) throw new Error(`Unknown model: ${provider}/${modelId}`);
|
|
237
|
+
await session.setModel(model);
|
|
238
|
+
await session.settingsManager.flush();
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
return {
|
|
242
|
+
buildCurrentModelSetupState,
|
|
243
|
+
handleSaveModelApiKey,
|
|
244
|
+
handleSaveProviderApiKey,
|
|
245
|
+
handleSelectModel,
|
|
246
|
+
};
|
|
247
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { IncomingHttpHeaders } from "node:http";
|
|
2
|
+
|
|
3
|
+
const PRIVATE_API_COOKIE = "opencandle_gui_session";
|
|
4
|
+
|
|
5
|
+
export function isLoopbackAddress(remoteAddress: string | undefined): boolean {
|
|
6
|
+
if (remoteAddress == null || remoteAddress === "") return false;
|
|
7
|
+
return (
|
|
8
|
+
remoteAddress === "::1" ||
|
|
9
|
+
remoteAddress === "localhost" ||
|
|
10
|
+
remoteAddress.startsWith("127.") ||
|
|
11
|
+
remoteAddress.startsWith("::ffff:127.")
|
|
12
|
+
);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function isTrustedPrivateApiRequest(
|
|
16
|
+
headers: IncomingHttpHeaders,
|
|
17
|
+
sessionToken: string,
|
|
18
|
+
remoteAddress: string | undefined,
|
|
19
|
+
options: { allowRemote?: boolean } = {},
|
|
20
|
+
): boolean {
|
|
21
|
+
if (!options.allowRemote && !isLoopbackAddress(remoteAddress)) return false;
|
|
22
|
+
if (cookieValue(headers.cookie, PRIVATE_API_COOKIE) !== sessionToken) return false;
|
|
23
|
+
|
|
24
|
+
const fetchSite = headerValue(headers["sec-fetch-site"]);
|
|
25
|
+
if (fetchSite != null && fetchSite !== "same-origin" && fetchSite !== "none") return false;
|
|
26
|
+
|
|
27
|
+
const origin = headerValue(headers.origin);
|
|
28
|
+
const host = headerValue(headers.host);
|
|
29
|
+
if (origin != null && host != null) {
|
|
30
|
+
try {
|
|
31
|
+
if (new URL(origin).host !== host) return false;
|
|
32
|
+
} catch {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function privateApiCookieHeader(sessionToken: string): string {
|
|
41
|
+
return `${PRIVATE_API_COOKIE}=${encodeURIComponent(sessionToken)}; Path=/; HttpOnly; SameSite=Strict`;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function cookieValue(header: string | string[] | undefined, name: string): string | undefined {
|
|
45
|
+
const value = Array.isArray(header) ? header.join("; ") : header;
|
|
46
|
+
if (value == null) return undefined;
|
|
47
|
+
for (const part of value.split(";")) {
|
|
48
|
+
const [rawKey, ...rawValue] = part.trim().split("=");
|
|
49
|
+
if (rawKey === name) {
|
|
50
|
+
try {
|
|
51
|
+
return decodeURIComponent(rawValue.join("="));
|
|
52
|
+
} catch {
|
|
53
|
+
return undefined;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return undefined;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function headerValue(value: string | string[] | undefined): string | undefined {
|
|
61
|
+
return Array.isArray(value) ? value[0] : value;
|
|
62
|
+
}
|
package/gui/server/projector.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { SessionEntry } from "@earendil-works/pi-coding-agent";
|
|
2
1
|
import type { Message, ToolResultMessage } from "@earendil-works/pi-ai";
|
|
2
|
+
import type { SessionEntry } from "@earendil-works/pi-coding-agent";
|
|
3
3
|
|
|
4
4
|
export interface DashboardState {
|
|
5
5
|
watchlist: Array<{
|
|
@@ -199,8 +199,9 @@ function projectQuote(
|
|
|
199
199
|
function parseCredentialRequiredProviders(text: string): string[] {
|
|
200
200
|
const providers: string[] = [];
|
|
201
201
|
const re = /\[OPENCANDLE_CREDENTIAL_REQUIRED[^\]]*provider=([a-z0-9_-]+)/gi;
|
|
202
|
-
|
|
203
|
-
|
|
202
|
+
while (true) {
|
|
203
|
+
const match = re.exec(text);
|
|
204
|
+
if (!match) break;
|
|
204
205
|
providers.push(match[1]);
|
|
205
206
|
}
|
|
206
207
|
return providers;
|
|
@@ -213,14 +214,18 @@ function parseSkippedProviders(text: string): string[] {
|
|
|
213
214
|
function parseSoftGapProviders(text: string): string[] {
|
|
214
215
|
const providers: string[] = [];
|
|
215
216
|
const re = /\[OPENCANDLE_(?:SKIPPED|SOFT_DEGRADED)[^\]]*provider=([a-z0-9_-]+)/gi;
|
|
216
|
-
|
|
217
|
-
|
|
217
|
+
while (true) {
|
|
218
|
+
const match = re.exec(text);
|
|
219
|
+
if (!match) break;
|
|
218
220
|
providers.push(match[1]);
|
|
219
221
|
}
|
|
220
222
|
return providers;
|
|
221
223
|
}
|
|
222
224
|
|
|
223
|
-
function inferDirectToolGapProvider(
|
|
225
|
+
function inferDirectToolGapProvider(
|
|
226
|
+
toolName: string | undefined,
|
|
227
|
+
text: string,
|
|
228
|
+
): string | undefined {
|
|
224
229
|
if (!toolName || !/(?:⚠|unavailable|No .*data found|LOGIN_NEEDED)/i.test(text)) return undefined;
|
|
225
230
|
return DIRECT_TOOL_GAP_PROVIDERS[toolName];
|
|
226
231
|
}
|
|
@@ -233,7 +238,7 @@ function inferSymbolFromContent(content: ToolResultMessage["content"]): string |
|
|
|
233
238
|
|
|
234
239
|
function asRecord(value: unknown): Record<string, unknown> {
|
|
235
240
|
return typeof value === "object" && value !== null && !Array.isArray(value)
|
|
236
|
-
? value as Record<string, unknown>
|
|
241
|
+
? (value as Record<string, unknown>)
|
|
237
242
|
: {};
|
|
238
243
|
}
|
|
239
244
|
|
|
@@ -49,13 +49,10 @@ function messageTextFromContent(content: unknown): string {
|
|
|
49
49
|
if (typeof content === "string") return content;
|
|
50
50
|
if (!Array.isArray(content)) return "";
|
|
51
51
|
return content
|
|
52
|
-
.map((part) =>
|
|
53
|
-
typeof part === "object" &&
|
|
54
|
-
part !== null &&
|
|
55
|
-
"text" in part &&
|
|
56
|
-
typeof part.text === "string"
|
|
52
|
+
.map((part) =>
|
|
53
|
+
typeof part === "object" && part !== null && "text" in part && typeof part.text === "string"
|
|
57
54
|
? part.text
|
|
58
|
-
: ""
|
|
59
|
-
)
|
|
55
|
+
: "",
|
|
56
|
+
)
|
|
60
57
|
.join("");
|
|
61
58
|
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { MarketStateQuoteSnapshot } from "./market-state-api.js";
|
|
2
|
+
|
|
3
|
+
export class QuoteSnapshotStore {
|
|
4
|
+
private snapshot: MarketStateQuoteSnapshot | null = null;
|
|
5
|
+
private fetchedAtMs = 0;
|
|
6
|
+
private inFlight: Promise<MarketStateQuoteSnapshot> | null = null;
|
|
7
|
+
private invalidationVersion = 0;
|
|
8
|
+
|
|
9
|
+
constructor(
|
|
10
|
+
private readonly build: () => Promise<MarketStateQuoteSnapshot>,
|
|
11
|
+
private readonly maxAgeMs = 60_000,
|
|
12
|
+
private readonly now: () => number = Date.now,
|
|
13
|
+
) {}
|
|
14
|
+
|
|
15
|
+
async get(): Promise<MarketStateQuoteSnapshot> {
|
|
16
|
+
if (this.snapshot == null) return this.refresh();
|
|
17
|
+
if (this.now() - this.fetchedAtMs >= this.maxAgeMs) {
|
|
18
|
+
// Stale-while-revalidate: serve the old snapshot now, refresh in the background.
|
|
19
|
+
this.refresh().catch(() => {});
|
|
20
|
+
}
|
|
21
|
+
return this.snapshot;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
invalidate(): void {
|
|
25
|
+
this.invalidationVersion += 1;
|
|
26
|
+
this.snapshot = null;
|
|
27
|
+
this.fetchedAtMs = 0;
|
|
28
|
+
this.inFlight = null;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
private refresh(): Promise<MarketStateQuoteSnapshot> {
|
|
32
|
+
if (this.inFlight) return this.inFlight;
|
|
33
|
+
const version = this.invalidationVersion;
|
|
34
|
+
const inFlight = this.build()
|
|
35
|
+
.then((snapshot) => {
|
|
36
|
+
if (version === this.invalidationVersion) {
|
|
37
|
+
this.snapshot = snapshot;
|
|
38
|
+
this.fetchedAtMs = this.now();
|
|
39
|
+
}
|
|
40
|
+
return snapshot;
|
|
41
|
+
})
|
|
42
|
+
.finally(() => {
|
|
43
|
+
if (this.inFlight === inFlight) {
|
|
44
|
+
this.inFlight = null;
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
this.inFlight = inFlight;
|
|
48
|
+
return this.inFlight;
|
|
49
|
+
}
|
|
50
|
+
}
|