opencandle 0.11.1 → 0.12.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 +20 -24
- package/dist/analysts/contracts.js +0 -1
- package/dist/analysts/orchestrator.js +0 -1
- package/dist/cli-main.js +13 -7
- package/dist/cli-options.d.ts +4 -0
- package/dist/cli-options.js +33 -0
- package/dist/cli.js +8 -3
- package/dist/config.js +0 -1
- package/dist/doctor/cli-command.js +2 -1
- package/dist/doctor/render.js +0 -1
- package/dist/doctor/report.js +40 -11
- package/dist/gui/server/ask-user-bridge.d.ts +19 -0
- package/dist/gui/server/ask-user-bridge.js +55 -0
- package/dist/gui/server/automation-heartbeat.d.ts +25 -0
- package/dist/gui/server/automation-heartbeat.js +61 -0
- package/dist/gui/server/background-quotes.d.ts +39 -0
- package/dist/gui/server/background-quotes.js +71 -0
- package/dist/gui/server/chat-event-adapter.d.ts +16 -0
- package/dist/gui/server/chat-event-adapter.js +263 -0
- package/dist/gui/server/gui-session-manager.d.ts +2 -0
- package/dist/gui/server/gui-session-manager.js +4 -0
- package/dist/gui/server/http-routes.d.ts +69 -0
- package/dist/gui/server/http-routes.js +1008 -0
- package/dist/gui/server/invoke-tool.d.ts +47 -0
- package/dist/gui/server/invoke-tool.js +373 -0
- package/dist/gui/server/live-chat-event-adapter.d.ts +19 -0
- package/dist/gui/server/live-chat-event-adapter.js +206 -0
- package/dist/gui/server/local-session-coordinator.d.ts +26 -0
- package/dist/gui/server/local-session-coordinator.js +53 -0
- package/dist/gui/server/market-state-api.d.ts +138 -0
- package/dist/gui/server/market-state-api.js +355 -0
- package/dist/gui/server/model-setup.d.ts +64 -0
- package/dist/gui/server/model-setup.js +150 -0
- package/dist/gui/server/private-api-access.d.ts +6 -0
- package/dist/gui/server/private-api-access.js +53 -0
- package/dist/gui/server/projector.d.ts +49 -0
- package/dist/gui/server/projector.js +296 -0
- package/dist/gui/server/prompt-observation.d.ts +8 -0
- package/dist/gui/server/prompt-observation.js +43 -0
- package/dist/gui/server/quote-snapshot-store.d.ts +14 -0
- package/dist/gui/server/quote-snapshot-store.js +49 -0
- package/dist/gui/server/server.d.ts +1 -0
- package/dist/gui/server/server.js +259 -0
- package/dist/gui/server/session-actions.d.ts +60 -0
- package/dist/gui/server/session-actions.js +218 -0
- package/dist/gui/server/session-entry-wait.d.ts +27 -0
- package/dist/gui/server/session-entry-wait.js +129 -0
- package/dist/gui/server/session-list.d.ts +2 -0
- package/dist/gui/server/session-list.js +11 -0
- package/dist/gui/server/shutdown.d.ts +10 -0
- package/dist/gui/server/shutdown.js +29 -0
- package/dist/gui/server/tool-invoke-ack.d.ts +17 -0
- package/dist/gui/server/tool-invoke-ack.js +26 -0
- package/dist/gui/server/tool-metadata.d.ts +93 -0
- package/dist/gui/server/tool-metadata.js +148 -0
- package/dist/gui/server/websocket.d.ts +9 -0
- package/dist/gui/server/websocket.js +124 -0
- package/dist/gui/server/writer-lock.d.ts +1 -0
- package/dist/gui/server/writer-lock.js +1 -0
- package/dist/gui/server/ws-hub.d.ts +50 -0
- package/dist/gui/server/ws-hub.js +284 -0
- package/dist/gui/shared/chat-events.d.ts +174 -0
- package/dist/gui/shared/chat-events.js +13 -0
- package/dist/gui/shared/event-reducer.d.ts +3 -0
- package/dist/gui/shared/event-reducer.js +187 -0
- package/dist/index.js +0 -1
- package/dist/infra/cache.js +0 -1
- package/dist/infra/freshness.js +0 -1
- package/dist/infra/http-client.js +1 -2
- package/dist/infra/index.js +0 -1
- package/dist/infra/market-calendar.js +0 -1
- package/dist/infra/native-dependencies.js +0 -1
- package/dist/infra/node-version.js +0 -1
- package/dist/infra/open-url.js +0 -1
- package/dist/infra/opencandle-paths.js +0 -1
- package/dist/infra/rate-limiter.js +0 -1
- package/dist/market-state/alert-conditions.js +0 -1
- package/dist/market-state/alert-runner.d.ts +1 -0
- package/dist/market-state/alert-runner.js +5 -4
- package/dist/market-state/daily-report.js +0 -1
- package/dist/market-state/local-automation-service.js +0 -1
- package/dist/market-state/notification-delivery.js +0 -1
- package/dist/market-state/resolve-for-mutation.js +0 -1
- package/dist/market-state/resolve.js +0 -1
- package/dist/market-state/service.d.ts +26 -21
- package/dist/market-state/service.js +175 -36
- package/dist/market-state/summaries.js +1 -13
- package/dist/memory/index.js +0 -1
- package/dist/memory/manager.js +0 -1
- package/dist/memory/preference-extractor.js +0 -1
- package/dist/memory/retrieval.js +0 -1
- package/dist/memory/sqlite.js +60 -11
- package/dist/memory/storage.js +0 -1
- package/dist/memory/tool-defaults.js +0 -1
- package/dist/memory/types.js +0 -1
- package/dist/monitor.js +0 -1
- package/dist/onboarding/connect.js +0 -1
- package/dist/onboarding/credential-interceptor.js +0 -1
- package/dist/onboarding/degradation-accumulator.js +0 -1
- package/dist/onboarding/prompt-user.d.ts +1 -1
- package/dist/onboarding/prompt-user.js +0 -1
- package/dist/onboarding/provider-status.js +0 -1
- package/dist/onboarding/providers.js +0 -1
- package/dist/onboarding/state.js +0 -1
- package/dist/onboarding/tool-helpers.js +0 -1
- package/dist/onboarding/tool-tags.js +0 -1
- package/dist/onboarding/validate-model-key.d.ts +17 -0
- package/dist/onboarding/validate-model-key.js +54 -0
- package/dist/onboarding/validation.js +0 -1
- package/dist/pi/opencandle-extension.js +2 -2
- package/dist/pi/session-action-dedupe.js +0 -1
- package/dist/pi/session-storage.js +0 -1
- package/dist/pi/session-writer-lock.js +0 -1
- package/dist/pi/session.js +0 -1
- package/dist/pi/setup.d.ts +2 -0
- package/dist/pi/setup.js +10 -3
- package/dist/pi/tool-adapter.js +0 -1
- package/dist/pi/tui-session-coordinator.js +0 -1
- package/dist/prompts/context-builder.js +1 -2
- package/dist/prompts/disclaimer.js +0 -1
- package/dist/prompts/policy-cards.js +0 -1
- package/dist/prompts/sections.js +0 -1
- package/dist/prompts/symbol-preflight.js +0 -1
- package/dist/prompts/workflow-prompts.js +0 -1
- package/dist/providers/alpha-vantage.js +2 -3
- package/dist/providers/coingecko.js +0 -1
- package/dist/providers/errors.js +0 -1
- package/dist/providers/exa-search.js +11 -10
- package/dist/providers/external-tool-command.js +0 -1
- package/dist/providers/external-tool-error.js +0 -1
- package/dist/providers/fear-greed.js +0 -1
- package/dist/providers/finnhub.js +0 -1
- package/dist/providers/fred.js +0 -1
- package/dist/providers/index.js +0 -1
- package/dist/providers/polymarket.js +0 -1
- package/dist/providers/provider-credential-error.js +0 -1
- package/dist/providers/reddit-cli.js +0 -1
- package/dist/providers/reddit.js +0 -1
- package/dist/providers/sec-edgar.js +0 -1
- package/dist/providers/tradingview.js +1 -2
- package/dist/providers/twitter-cli.js +0 -1
- package/dist/providers/twitter.js +0 -1
- package/dist/providers/web-search.js +15 -12
- package/dist/providers/with-fallback.js +0 -1
- package/dist/providers/wrap-provider.js +0 -1
- package/dist/providers/yahoo-finance.js +67 -4
- package/dist/routing/classify-intent.js +0 -1
- package/dist/routing/defaults.js +0 -1
- package/dist/routing/entity-extractor.js +2 -3
- package/dist/routing/fund-symbols.js +0 -1
- package/dist/routing/horizon.js +0 -1
- package/dist/routing/index.js +0 -1
- package/dist/routing/legacy-rule-router.js +0 -1
- package/dist/routing/planning.js +0 -1
- package/dist/routing/route-manifest.js +0 -1
- package/dist/routing/router-llm-client.d.ts +2 -2
- package/dist/routing/router-llm-client.js +0 -1
- package/dist/routing/router-prompt.js +0 -1
- package/dist/routing/router-types.js +0 -1
- package/dist/routing/router.js +1 -2
- package/dist/routing/slot-resolver.js +0 -1
- package/dist/routing/symbol-disambiguator.js +0 -1
- package/dist/routing/turn-context.js +0 -1
- package/dist/routing/types.js +0 -1
- package/dist/runtime/answer-contracts.js +0 -1
- package/dist/runtime/artifact-contracts.js +0 -1
- package/dist/runtime/evidence.js +0 -1
- package/dist/runtime/numeric-claims.js +0 -1
- package/dist/runtime/planning-evidence.js +0 -1
- package/dist/runtime/prompt-step.js +0 -1
- package/dist/runtime/provider-tracker.js +0 -1
- package/dist/runtime/run-context.js +0 -1
- package/dist/runtime/session-coordinator.js +0 -1
- package/dist/runtime/session-title.js +0 -1
- package/dist/runtime/tool-defaults-wrapper.js +0 -1
- package/dist/runtime/validation.js +0 -1
- package/dist/runtime/workflow-events.js +0 -1
- package/dist/runtime/workflow-runner.d.ts +1 -0
- package/dist/runtime/workflow-runner.js +8 -3
- package/dist/runtime/workflow-types.js +0 -1
- package/dist/sentiment/adapters/finnhub.js +0 -1
- package/dist/sentiment/adapters/reddit.js +0 -1
- package/dist/sentiment/adapters/twitter.js +0 -1
- package/dist/sentiment/adapters/web.js +0 -1
- package/dist/sentiment/index.js +4 -2
- package/dist/sentiment/insights.js +0 -1
- package/dist/sentiment/keywords.js +0 -1
- package/dist/sentiment/pipeline.js +0 -1
- package/dist/sentiment/scorer.js +0 -1
- package/dist/sentiment/store.js +0 -1
- package/dist/sentiment/trends.js +0 -1
- package/dist/sentiment/types.js +0 -1
- package/dist/system-prompt.js +0 -1
- package/dist/tool-kit.js +0 -1
- package/dist/tools/fundamentals/company-overview.d.ts +1 -1
- package/dist/tools/fundamentals/company-overview.js +2 -1
- package/dist/tools/fundamentals/comps.js +6 -4
- package/dist/tools/fundamentals/dcf.js +0 -1
- package/dist/tools/fundamentals/earnings.d.ts +1 -1
- package/dist/tools/fundamentals/earnings.js +2 -1
- package/dist/tools/fundamentals/financials.js +2 -1
- package/dist/tools/fundamentals/sec-filings.js +0 -1
- package/dist/tools/index.d.ts +116 -2
- package/dist/tools/index.js +0 -1
- package/dist/tools/interaction/ask-user.js +11 -1
- package/dist/tools/macro/event-probabilities.js +0 -1
- package/dist/tools/macro/fear-greed.d.ts +1 -1
- package/dist/tools/macro/fear-greed.js +0 -1
- package/dist/tools/macro/fred-data.d.ts +1 -1
- package/dist/tools/macro/fred-data.js +2 -1
- package/dist/tools/market/crypto-history.js +0 -1
- package/dist/tools/market/crypto-price.d.ts +2 -2
- package/dist/tools/market/crypto-price.js +0 -1
- package/dist/tools/market/screen-stocks.js +0 -1
- package/dist/tools/market/search-ticker.js +1 -2
- package/dist/tools/market/stock-history.js +0 -1
- package/dist/tools/market/stock-quote.d.ts +2 -2
- package/dist/tools/market/stock-quote.js +0 -1
- package/dist/tools/options/greeks.js +0 -1
- package/dist/tools/options/option-chain.d.ts +2 -2
- package/dist/tools/options/option-chain.js +0 -1
- package/dist/tools/portfolio/alerts.d.ts +2 -1
- package/dist/tools/portfolio/alerts.js +228 -2
- package/dist/tools/portfolio/correlation.js +23 -5
- package/dist/tools/portfolio/daily-report.js +0 -1
- package/dist/tools/portfolio/holdings-overlap.js +0 -1
- package/dist/tools/portfolio/notifications.js +0 -1
- package/dist/tools/portfolio/risk-analysis.d.ts +1 -1
- package/dist/tools/portfolio/risk-analysis.js +0 -1
- package/dist/tools/portfolio/tracker.d.ts +3 -1
- package/dist/tools/portfolio/tracker.js +57 -10
- package/dist/tools/portfolio/watchlist.d.ts +3 -6
- package/dist/tools/portfolio/watchlist.js +101 -110
- package/dist/tools/sentiment/insight-format.js +0 -1
- package/dist/tools/sentiment/query-match.js +0 -1
- package/dist/tools/sentiment/reddit-sentiment.js +0 -1
- package/dist/tools/sentiment/sentiment-summary.js +8 -4
- package/dist/tools/sentiment/sentiment-trend.d.ts +5 -1
- package/dist/tools/sentiment/sentiment-trend.js +6 -2
- package/dist/tools/sentiment/twitter-sentiment.js +0 -1
- package/dist/tools/sentiment/untrusted-text.js +0 -1
- package/dist/tools/sentiment/web-search.d.ts +1 -1
- package/dist/tools/sentiment/web-search.js +0 -1
- package/dist/tools/sentiment/web-sentiment.js +0 -1
- package/dist/tools/technical/backtest.js +0 -1
- package/dist/tools/technical/indicators.js +0 -1
- package/dist/types/fundamentals.js +0 -1
- package/dist/types/index.js +0 -1
- package/dist/types/macro.js +0 -1
- package/dist/types/market.d.ts +6 -0
- package/dist/types/market.js +0 -1
- package/dist/types/options.js +0 -1
- package/dist/types/portfolio.js +0 -1
- package/dist/types/prediction-markets.js +0 -1
- package/dist/types/sentiment.js +0 -1
- package/dist/workflows/compare-assets.js +0 -1
- package/dist/workflows/index.js +0 -1
- package/dist/workflows/options-screener.js +0 -1
- package/dist/workflows/portfolio-builder.js +0 -1
- package/gui/web/dist/assets/CatalogOverlay-CAc7e3Pf.js +1 -0
- package/gui/web/dist/assets/index-BOEKd9wT.css +2 -0
- package/gui/web/dist/assets/index-C-H05cQ2.js +65 -0
- package/gui/web/dist/index.html +2 -2
- package/package.json +11 -12
- package/dist/analysts/contracts.js.map +0 -1
- package/dist/analysts/orchestrator.js.map +0 -1
- package/dist/cli-main.js.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/config.js.map +0 -1
- package/dist/doctor/cli-command.js.map +0 -1
- package/dist/doctor/render.js.map +0 -1
- package/dist/doctor/report.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/infra/cache.js.map +0 -1
- package/dist/infra/freshness.js.map +0 -1
- package/dist/infra/http-client.js.map +0 -1
- package/dist/infra/index.js.map +0 -1
- package/dist/infra/market-calendar.js.map +0 -1
- package/dist/infra/native-dependencies.js.map +0 -1
- package/dist/infra/node-version.js.map +0 -1
- package/dist/infra/open-url.js.map +0 -1
- package/dist/infra/opencandle-paths.js.map +0 -1
- package/dist/infra/rate-limiter.js.map +0 -1
- package/dist/market-state/alert-conditions.js.map +0 -1
- package/dist/market-state/alert-runner.js.map +0 -1
- package/dist/market-state/daily-report.js.map +0 -1
- package/dist/market-state/local-automation-service.js.map +0 -1
- package/dist/market-state/notification-delivery.js.map +0 -1
- package/dist/market-state/resolve-for-mutation.js.map +0 -1
- package/dist/market-state/resolve.js.map +0 -1
- package/dist/market-state/service.js.map +0 -1
- package/dist/market-state/summaries.js.map +0 -1
- package/dist/memory/index.js.map +0 -1
- package/dist/memory/manager.js.map +0 -1
- package/dist/memory/preference-extractor.js.map +0 -1
- package/dist/memory/retrieval.js.map +0 -1
- package/dist/memory/sqlite.js.map +0 -1
- package/dist/memory/storage.js.map +0 -1
- package/dist/memory/tool-defaults.js.map +0 -1
- package/dist/memory/types.js.map +0 -1
- package/dist/monitor.js.map +0 -1
- package/dist/onboarding/connect.js.map +0 -1
- package/dist/onboarding/credential-interceptor.js.map +0 -1
- package/dist/onboarding/degradation-accumulator.js.map +0 -1
- package/dist/onboarding/prompt-user.js.map +0 -1
- package/dist/onboarding/provider-status.js.map +0 -1
- package/dist/onboarding/providers.js.map +0 -1
- package/dist/onboarding/state.js.map +0 -1
- package/dist/onboarding/tool-helpers.js.map +0 -1
- package/dist/onboarding/tool-tags.js.map +0 -1
- package/dist/onboarding/validation.js.map +0 -1
- package/dist/pi/opencandle-extension.js.map +0 -1
- package/dist/pi/session-action-dedupe.js.map +0 -1
- package/dist/pi/session-storage.js.map +0 -1
- package/dist/pi/session-writer-lock.js.map +0 -1
- package/dist/pi/session.js.map +0 -1
- package/dist/pi/setup.js.map +0 -1
- package/dist/pi/tool-adapter.js.map +0 -1
- package/dist/pi/tui-session-coordinator.js.map +0 -1
- package/dist/prompts/context-builder.js.map +0 -1
- package/dist/prompts/disclaimer.js.map +0 -1
- package/dist/prompts/policy-cards.js.map +0 -1
- package/dist/prompts/sections.js.map +0 -1
- package/dist/prompts/symbol-preflight.js.map +0 -1
- package/dist/prompts/workflow-prompts.js.map +0 -1
- package/dist/providers/alpha-vantage.js.map +0 -1
- package/dist/providers/coingecko.js.map +0 -1
- package/dist/providers/errors.js.map +0 -1
- package/dist/providers/exa-search.js.map +0 -1
- package/dist/providers/external-tool-command.js.map +0 -1
- package/dist/providers/external-tool-error.js.map +0 -1
- package/dist/providers/fear-greed.js.map +0 -1
- package/dist/providers/finnhub.js.map +0 -1
- package/dist/providers/fred.js.map +0 -1
- package/dist/providers/index.js.map +0 -1
- package/dist/providers/polymarket.js.map +0 -1
- package/dist/providers/provider-credential-error.js.map +0 -1
- package/dist/providers/reddit-cli.js.map +0 -1
- package/dist/providers/reddit.js.map +0 -1
- package/dist/providers/sec-edgar.js.map +0 -1
- package/dist/providers/tradingview.js.map +0 -1
- package/dist/providers/twitter-cli.js.map +0 -1
- package/dist/providers/twitter.js.map +0 -1
- package/dist/providers/web-search.js.map +0 -1
- package/dist/providers/with-fallback.js.map +0 -1
- package/dist/providers/wrap-provider.js.map +0 -1
- package/dist/providers/yahoo-finance.js.map +0 -1
- package/dist/routing/classify-intent.js.map +0 -1
- package/dist/routing/defaults.js.map +0 -1
- package/dist/routing/entity-extractor.js.map +0 -1
- package/dist/routing/fund-symbols.js.map +0 -1
- package/dist/routing/horizon.js.map +0 -1
- package/dist/routing/index.js.map +0 -1
- package/dist/routing/legacy-rule-router.js.map +0 -1
- package/dist/routing/planning.js.map +0 -1
- package/dist/routing/route-manifest.js.map +0 -1
- package/dist/routing/router-llm-client.js.map +0 -1
- package/dist/routing/router-prompt.js.map +0 -1
- package/dist/routing/router-types.js.map +0 -1
- package/dist/routing/router.js.map +0 -1
- package/dist/routing/slot-resolver.js.map +0 -1
- package/dist/routing/symbol-disambiguator.js.map +0 -1
- package/dist/routing/turn-context.js.map +0 -1
- package/dist/routing/types.js.map +0 -1
- package/dist/runtime/answer-contracts.js.map +0 -1
- package/dist/runtime/artifact-contracts.js.map +0 -1
- package/dist/runtime/evidence.js.map +0 -1
- package/dist/runtime/numeric-claims.js.map +0 -1
- package/dist/runtime/planning-evidence.js.map +0 -1
- package/dist/runtime/prompt-step.js.map +0 -1
- package/dist/runtime/provider-tracker.js.map +0 -1
- package/dist/runtime/run-context.js.map +0 -1
- package/dist/runtime/session-coordinator.js.map +0 -1
- package/dist/runtime/session-title.js.map +0 -1
- package/dist/runtime/tool-defaults-wrapper.js.map +0 -1
- package/dist/runtime/validation.js.map +0 -1
- package/dist/runtime/workflow-events.js.map +0 -1
- package/dist/runtime/workflow-runner.js.map +0 -1
- package/dist/runtime/workflow-types.js.map +0 -1
- package/dist/sentiment/adapters/finnhub.js.map +0 -1
- package/dist/sentiment/adapters/reddit.js.map +0 -1
- package/dist/sentiment/adapters/twitter.js.map +0 -1
- package/dist/sentiment/adapters/web.js.map +0 -1
- package/dist/sentiment/index.js.map +0 -1
- package/dist/sentiment/insights.js.map +0 -1
- package/dist/sentiment/keywords.js.map +0 -1
- package/dist/sentiment/pipeline.js.map +0 -1
- package/dist/sentiment/scorer.js.map +0 -1
- package/dist/sentiment/store.js.map +0 -1
- package/dist/sentiment/trends.js.map +0 -1
- package/dist/sentiment/types.js.map +0 -1
- package/dist/system-prompt.js.map +0 -1
- package/dist/tool-kit.js.map +0 -1
- package/dist/tools/fundamentals/company-overview.js.map +0 -1
- package/dist/tools/fundamentals/comps.js.map +0 -1
- package/dist/tools/fundamentals/dcf.js.map +0 -1
- package/dist/tools/fundamentals/earnings.js.map +0 -1
- package/dist/tools/fundamentals/financials.js.map +0 -1
- package/dist/tools/fundamentals/sec-filings.js.map +0 -1
- package/dist/tools/index.js.map +0 -1
- package/dist/tools/interaction/ask-user.js.map +0 -1
- package/dist/tools/macro/event-probabilities.js.map +0 -1
- package/dist/tools/macro/fear-greed.js.map +0 -1
- package/dist/tools/macro/fred-data.js.map +0 -1
- package/dist/tools/market/crypto-history.js.map +0 -1
- package/dist/tools/market/crypto-price.js.map +0 -1
- package/dist/tools/market/screen-stocks.js.map +0 -1
- package/dist/tools/market/search-ticker.js.map +0 -1
- package/dist/tools/market/stock-history.js.map +0 -1
- package/dist/tools/market/stock-quote.js.map +0 -1
- package/dist/tools/options/greeks.js.map +0 -1
- package/dist/tools/options/option-chain.js.map +0 -1
- package/dist/tools/portfolio/alerts.js.map +0 -1
- package/dist/tools/portfolio/correlation.js.map +0 -1
- package/dist/tools/portfolio/daily-report.js.map +0 -1
- package/dist/tools/portfolio/holdings-overlap.js.map +0 -1
- package/dist/tools/portfolio/notifications.js.map +0 -1
- package/dist/tools/portfolio/risk-analysis.js.map +0 -1
- package/dist/tools/portfolio/tracker.js.map +0 -1
- package/dist/tools/portfolio/watchlist.js.map +0 -1
- package/dist/tools/sentiment/insight-format.js.map +0 -1
- package/dist/tools/sentiment/query-match.js.map +0 -1
- package/dist/tools/sentiment/reddit-sentiment.js.map +0 -1
- package/dist/tools/sentiment/sentiment-summary.js.map +0 -1
- package/dist/tools/sentiment/sentiment-trend.js.map +0 -1
- package/dist/tools/sentiment/twitter-sentiment.js.map +0 -1
- package/dist/tools/sentiment/untrusted-text.js.map +0 -1
- package/dist/tools/sentiment/web-search.js.map +0 -1
- package/dist/tools/sentiment/web-sentiment.js.map +0 -1
- package/dist/tools/technical/backtest.js.map +0 -1
- package/dist/tools/technical/indicators.js.map +0 -1
- package/dist/types/fundamentals.js.map +0 -1
- package/dist/types/index.js.map +0 -1
- package/dist/types/macro.js.map +0 -1
- package/dist/types/market.js.map +0 -1
- package/dist/types/options.js.map +0 -1
- package/dist/types/portfolio.js.map +0 -1
- package/dist/types/prediction-markets.js.map +0 -1
- package/dist/types/sentiment.js.map +0 -1
- package/dist/workflows/compare-assets.js.map +0 -1
- package/dist/workflows/index.js.map +0 -1
- package/dist/workflows/options-screener.js.map +0 -1
- package/dist/workflows/portfolio-builder.js.map +0 -1
- package/gui/server/ask-user-bridge.ts +0 -89
- package/gui/server/automation-heartbeat.ts +0 -97
- package/gui/server/background-quotes.ts +0 -127
- package/gui/server/chat-event-adapter.ts +0 -294
- package/gui/server/gui-session-manager.ts +0 -5
- package/gui/server/http-routes.ts +0 -1201
- package/gui/server/invoke-tool.ts +0 -490
- package/gui/server/live-chat-event-adapter.ts +0 -243
- package/gui/server/local-session-coordinator.ts +0 -97
- package/gui/server/market-state-api.ts +0 -331
- package/gui/server/model-setup.ts +0 -254
- package/gui/server/package.json +0 -5
- package/gui/server/private-api-access.ts +0 -62
- package/gui/server/projector.ts +0 -392
- package/gui/server/prompt-observation.ts +0 -58
- package/gui/server/quote-snapshot-store.ts +0 -50
- package/gui/server/server.ts +0 -289
- package/gui/server/session-actions.ts +0 -323
- package/gui/server/session-entry-wait.ts +0 -179
- package/gui/server/shutdown.ts +0 -47
- package/gui/server/tool-invoke-ack.ts +0 -49
- package/gui/server/tool-metadata.ts +0 -167
- package/gui/server/websocket.ts +0 -138
- package/gui/server/writer-lock.ts +0 -1
- package/gui/server/ws-hub.ts +0 -403
- package/gui/shared/chat-events.ts +0 -165
- package/gui/shared/event-reducer.ts +0 -220
- package/gui/web/dist/assets/CatalogOverlay-DZ1niyQm.js +0 -1
- package/gui/web/dist/assets/index-D4F9AJnn.css +0 -2
- package/gui/web/dist/assets/index-DtqMMBTr.js +0 -65
- package/src/analysts/contracts.ts +0 -176
- package/src/analysts/orchestrator.ts +0 -244
- package/src/cli-main.ts +0 -510
- package/src/cli.ts +0 -17
- package/src/config.ts +0 -272
- package/src/doctor/cli-command.ts +0 -83
- package/src/doctor/render.ts +0 -37
- package/src/doctor/report.ts +0 -638
- package/src/index.ts +0 -5
- package/src/infra/cache.ts +0 -127
- package/src/infra/freshness.ts +0 -165
- package/src/infra/http-client.ts +0 -134
- package/src/infra/index.ts +0 -14
- package/src/infra/market-calendar.ts +0 -193
- package/src/infra/native-dependencies.ts +0 -84
- package/src/infra/node-version.ts +0 -23
- package/src/infra/open-url.ts +0 -28
- package/src/infra/opencandle-paths.ts +0 -53
- package/src/infra/rate-limiter.ts +0 -77
- package/src/market-state/alert-conditions.ts +0 -82
- package/src/market-state/alert-runner.ts +0 -863
- package/src/market-state/daily-report.ts +0 -237
- package/src/market-state/local-automation-service.ts +0 -162
- package/src/market-state/notification-delivery.ts +0 -158
- package/src/market-state/resolve-for-mutation.ts +0 -24
- package/src/market-state/resolve.ts +0 -112
- package/src/market-state/service.ts +0 -2208
- package/src/market-state/summaries.ts +0 -75
- package/src/memory/index.ts +0 -10
- package/src/memory/manager.ts +0 -190
- package/src/memory/preference-extractor.ts +0 -106
- package/src/memory/retrieval.ts +0 -71
- package/src/memory/sqlite.ts +0 -577
- package/src/memory/storage.ts +0 -195
- package/src/memory/tool-defaults.ts +0 -108
- package/src/memory/types.ts +0 -71
- package/src/monitor.ts +0 -123
- package/src/onboarding/connect.ts +0 -177
- package/src/onboarding/credential-interceptor.ts +0 -122
- package/src/onboarding/degradation-accumulator.ts +0 -77
- package/src/onboarding/prompt-user.ts +0 -85
- package/src/onboarding/provider-status.ts +0 -382
- package/src/onboarding/providers.ts +0 -442
- package/src/onboarding/state.ts +0 -216
- package/src/onboarding/tool-helpers.ts +0 -104
- package/src/onboarding/tool-tags.ts +0 -244
- package/src/onboarding/validation.ts +0 -152
- package/src/pi/opencandle-extension.ts +0 -1294
- package/src/pi/session-action-dedupe.ts +0 -155
- package/src/pi/session-storage.ts +0 -5
- package/src/pi/session-writer-lock.ts +0 -426
- package/src/pi/session.ts +0 -84
- package/src/pi/setup.ts +0 -399
- package/src/pi/tool-adapter.ts +0 -49
- package/src/pi/tui-session-coordinator.ts +0 -351
- package/src/prompts/context-builder.ts +0 -326
- package/src/prompts/disclaimer.ts +0 -9
- package/src/prompts/policy-cards.ts +0 -228
- package/src/prompts/sections.ts +0 -46
- package/src/prompts/symbol-preflight.ts +0 -80
- package/src/prompts/workflow-prompts.ts +0 -504
- package/src/providers/alpha-vantage.ts +0 -340
- package/src/providers/coingecko.ts +0 -95
- package/src/providers/errors.ts +0 -9
- package/src/providers/exa-search.ts +0 -375
- package/src/providers/external-tool-command.ts +0 -164
- package/src/providers/external-tool-error.ts +0 -20
- package/src/providers/fear-greed.ts +0 -45
- package/src/providers/finnhub.ts +0 -125
- package/src/providers/fred.ts +0 -83
- package/src/providers/index.ts +0 -17
- package/src/providers/polymarket.ts +0 -214
- package/src/providers/provider-credential-error.ts +0 -23
- package/src/providers/reddit-cli.ts +0 -286
- package/src/providers/reddit.ts +0 -106
- package/src/providers/sec-edgar.ts +0 -326
- package/src/providers/tradingview.ts +0 -399
- package/src/providers/twitter-cli.ts +0 -202
- package/src/providers/twitter.ts +0 -102
- package/src/providers/web-search.ts +0 -303
- package/src/providers/with-fallback.ts +0 -42
- package/src/providers/wrap-provider.ts +0 -105
- package/src/providers/yahoo-finance.ts +0 -984
- package/src/routing/classify-intent.ts +0 -380
- package/src/routing/defaults.ts +0 -29
- package/src/routing/entity-extractor.ts +0 -557
- package/src/routing/fund-symbols.ts +0 -58
- package/src/routing/horizon.ts +0 -7
- package/src/routing/index.ts +0 -70
- package/src/routing/legacy-rule-router.ts +0 -13
- package/src/routing/planning.ts +0 -829
- package/src/routing/route-manifest.ts +0 -308
- package/src/routing/router-llm-client.ts +0 -64
- package/src/routing/router-prompt.ts +0 -159
- package/src/routing/router-types.ts +0 -84
- package/src/routing/router.ts +0 -1332
- package/src/routing/slot-resolver.ts +0 -213
- package/src/routing/symbol-disambiguator.ts +0 -72
- package/src/routing/turn-context.ts +0 -108
- package/src/routing/types.ts +0 -77
- package/src/runtime/answer-contracts.ts +0 -693
- package/src/runtime/artifact-contracts.ts +0 -77
- package/src/runtime/evidence.ts +0 -78
- package/src/runtime/numeric-claims.ts +0 -108
- package/src/runtime/planning-evidence.ts +0 -597
- package/src/runtime/prompt-step.ts +0 -185
- package/src/runtime/provider-tracker.ts +0 -40
- package/src/runtime/run-context.ts +0 -32
- package/src/runtime/session-coordinator.ts +0 -1037
- package/src/runtime/session-title.ts +0 -60
- package/src/runtime/tool-defaults-wrapper.ts +0 -43
- package/src/runtime/validation.ts +0 -211
- package/src/runtime/workflow-events.ts +0 -77
- package/src/runtime/workflow-runner.ts +0 -182
- package/src/runtime/workflow-types.ts +0 -105
- package/src/sentiment/adapters/finnhub.ts +0 -49
- package/src/sentiment/adapters/reddit.ts +0 -65
- package/src/sentiment/adapters/twitter.ts +0 -36
- package/src/sentiment/adapters/web.ts +0 -44
- package/src/sentiment/index.ts +0 -49
- package/src/sentiment/insights.ts +0 -269
- package/src/sentiment/keywords.ts +0 -31
- package/src/sentiment/pipeline.ts +0 -91
- package/src/sentiment/scorer.ts +0 -89
- package/src/sentiment/store.ts +0 -260
- package/src/sentiment/trends.ts +0 -96
- package/src/sentiment/types.ts +0 -112
- package/src/system-prompt.ts +0 -115
- package/src/tool-kit.ts +0 -69
- package/src/tools/AGENTS.md +0 -36
- package/src/tools/fundamentals/company-overview.ts +0 -64
- package/src/tools/fundamentals/comps.ts +0 -180
- package/src/tools/fundamentals/dcf.ts +0 -447
- package/src/tools/fundamentals/earnings.ts +0 -57
- package/src/tools/fundamentals/financials.ts +0 -63
- package/src/tools/fundamentals/sec-filings.ts +0 -105
- package/src/tools/index.ts +0 -104
- package/src/tools/interaction/ask-user.ts +0 -93
- package/src/tools/macro/event-probabilities.ts +0 -141
- package/src/tools/macro/fear-greed.ts +0 -41
- package/src/tools/macro/fred-data.ts +0 -92
- package/src/tools/market/crypto-history.ts +0 -72
- package/src/tools/market/crypto-price.ts +0 -65
- package/src/tools/market/screen-stocks.ts +0 -290
- package/src/tools/market/search-ticker.ts +0 -254
- package/src/tools/market/stock-history.ts +0 -104
- package/src/tools/market/stock-quote.ts +0 -73
- package/src/tools/options/greeks.ts +0 -81
- package/src/tools/options/option-chain.ts +0 -134
- package/src/tools/portfolio/alerts.ts +0 -457
- package/src/tools/portfolio/correlation.ts +0 -189
- package/src/tools/portfolio/daily-report.ts +0 -107
- package/src/tools/portfolio/holdings-overlap.ts +0 -139
- package/src/tools/portfolio/notifications.ts +0 -45
- package/src/tools/portfolio/risk-analysis.ts +0 -173
- package/src/tools/portfolio/tracker.ts +0 -308
- package/src/tools/portfolio/watchlist.ts +0 -288
- package/src/tools/sentiment/insight-format.ts +0 -50
- package/src/tools/sentiment/query-match.ts +0 -117
- package/src/tools/sentiment/reddit-sentiment.ts +0 -403
- package/src/tools/sentiment/sentiment-summary.ts +0 -383
- package/src/tools/sentiment/sentiment-trend.ts +0 -75
- package/src/tools/sentiment/twitter-sentiment.ts +0 -287
- package/src/tools/sentiment/untrusted-text.ts +0 -21
- package/src/tools/sentiment/web-search.ts +0 -186
- package/src/tools/sentiment/web-sentiment.ts +0 -96
- package/src/tools/technical/backtest.ts +0 -336
- package/src/tools/technical/indicators.ts +0 -281
- package/src/types/fundamentals.ts +0 -47
- package/src/types/index.ts +0 -26
- package/src/types/macro.ts +0 -27
- package/src/types/market.ts +0 -46
- package/src/types/options.ts +0 -53
- package/src/types/portfolio.ts +0 -83
- package/src/types/prediction-markets.ts +0 -13
- package/src/types/sentiment.ts +0 -129
- package/src/workflows/compare-assets.ts +0 -89
- package/src/workflows/index.ts +0 -3
- package/src/workflows/options-screener.ts +0 -125
- package/src/workflows/portfolio-builder.ts +0 -63
package/src/doctor/report.ts
DELETED
|
@@ -1,638 +0,0 @@
|
|
|
1
|
-
import { accessSync, constants, existsSync, readFileSync, statSync } from "node:fs";
|
|
2
|
-
import { createRequire } from "node:module";
|
|
3
|
-
import { dirname, resolve } from "node:path";
|
|
4
|
-
import { fileURLToPath } from "node:url";
|
|
5
|
-
import { getUnsupportedNodeVersionMessage } from "../infra/node-version.js";
|
|
6
|
-
import {
|
|
7
|
-
getConfigPath,
|
|
8
|
-
getOnboardingPath,
|
|
9
|
-
getOpenCandleHomeDir,
|
|
10
|
-
getStateDbPath,
|
|
11
|
-
resolveOpenCandlePath,
|
|
12
|
-
} from "../infra/opencandle-paths.js";
|
|
13
|
-
import {
|
|
14
|
-
type CommandRunner,
|
|
15
|
-
type ProviderStatus,
|
|
16
|
-
probeAllProviderStatuses,
|
|
17
|
-
probeProviderStatus,
|
|
18
|
-
} from "../onboarding/provider-status.js";
|
|
19
|
-
import {
|
|
20
|
-
getProvider,
|
|
21
|
-
isExternalToolProvider,
|
|
22
|
-
listAllProviders,
|
|
23
|
-
type ProviderDescriptor,
|
|
24
|
-
type ProviderId,
|
|
25
|
-
} from "../onboarding/providers.js";
|
|
26
|
-
|
|
27
|
-
export const DOCTOR_REPORT_SCHEMA_VERSION = 1;
|
|
28
|
-
|
|
29
|
-
export type DoctorCheckStatus = "pass" | "warn" | "fail" | "skip" | "unknown";
|
|
30
|
-
export type DoctorCapabilityImpact = "core" | "optional";
|
|
31
|
-
export type DoctorOverallStatus = "ready" | "degraded" | "blocked";
|
|
32
|
-
|
|
33
|
-
export interface DoctorCheck {
|
|
34
|
-
readonly id: string;
|
|
35
|
-
readonly label: string;
|
|
36
|
-
readonly status: DoctorCheckStatus;
|
|
37
|
-
readonly capability: DoctorCapabilityImpact;
|
|
38
|
-
readonly summary: string;
|
|
39
|
-
readonly remediation?: string;
|
|
40
|
-
readonly metadata?: Record<string, unknown>;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export interface DoctorSection {
|
|
44
|
-
readonly id: string;
|
|
45
|
-
readonly label: string;
|
|
46
|
-
readonly status: DoctorOverallStatus;
|
|
47
|
-
readonly checks: DoctorCheck[];
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export interface DoctorModelSetupState {
|
|
51
|
-
readonly requirement: "ready" | "select_model" | "connect_auth" | "unknown";
|
|
52
|
-
readonly currentModel?: string;
|
|
53
|
-
readonly availableModels?: readonly { provider: string; id: string; label?: string }[];
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export interface DoctorGuiStatusInput {
|
|
57
|
-
readonly host: string;
|
|
58
|
-
readonly port: number;
|
|
59
|
-
readonly role?: string;
|
|
60
|
-
readonly reachable?: boolean;
|
|
61
|
-
readonly healthEndpoint?: string;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export interface BuildDoctorReportOptions {
|
|
65
|
-
readonly cwd?: string;
|
|
66
|
-
readonly agentDir?: string;
|
|
67
|
-
readonly now?: Date;
|
|
68
|
-
readonly includeSessions?: boolean;
|
|
69
|
-
readonly includeGui?: boolean;
|
|
70
|
-
readonly gui?: DoctorGuiStatusInput;
|
|
71
|
-
readonly modelSetup?: DoctorModelSetupState;
|
|
72
|
-
readonly commandRunner?: CommandRunner;
|
|
73
|
-
readonly fetchImpl?: typeof fetch;
|
|
74
|
-
readonly providerStatuses?: readonly ProviderStatus[];
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
export interface DoctorReport {
|
|
78
|
-
readonly schemaVersion: number;
|
|
79
|
-
readonly generatedAt: string;
|
|
80
|
-
readonly status: DoctorOverallStatus;
|
|
81
|
-
readonly summary: string;
|
|
82
|
-
readonly sections: DoctorSection[];
|
|
83
|
-
readonly metadata: {
|
|
84
|
-
readonly cwd: string;
|
|
85
|
-
readonly agentDir?: string;
|
|
86
|
-
readonly opencandleHome: string;
|
|
87
|
-
readonly opencandleHomeSource: "default" | "env";
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
const PACKAGE_ROOT = resolve(dirname(fileURLToPath(import.meta.url)), "..", "..");
|
|
92
|
-
const require = createRequire(import.meta.url);
|
|
93
|
-
|
|
94
|
-
interface BetterSqliteDatabase {
|
|
95
|
-
close(): void;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
type BetterSqliteConstructor = new (path: string) => BetterSqliteDatabase;
|
|
99
|
-
|
|
100
|
-
export async function buildDoctorReport(
|
|
101
|
-
options: BuildDoctorReportOptions = {},
|
|
102
|
-
): Promise<DoctorReport> {
|
|
103
|
-
const now = options.now ?? new Date();
|
|
104
|
-
const cwd = options.cwd ?? process.cwd();
|
|
105
|
-
const home = getOpenCandleHomeDir();
|
|
106
|
-
const runtimeChecks = buildRuntimeChecks(cwd);
|
|
107
|
-
const stateChecks = buildStateChecks(home, options.agentDir);
|
|
108
|
-
const providerChecks = stateChecks.some(
|
|
109
|
-
(check) => check.id === "state.config" && check.status === "fail",
|
|
110
|
-
)
|
|
111
|
-
? [providerChecksSkippedForInvalidConfig()]
|
|
112
|
-
: await buildProviderChecks(options);
|
|
113
|
-
const sections: DoctorSection[] = [
|
|
114
|
-
section("runtime", "Runtime", runtimeChecks),
|
|
115
|
-
section("state", "Local state", stateChecks),
|
|
116
|
-
section("model", "Model", [buildModelCheck(options.modelSetup)]),
|
|
117
|
-
section("providers", "Providers", providerChecks),
|
|
118
|
-
];
|
|
119
|
-
|
|
120
|
-
if (options.includeGui || options.gui) {
|
|
121
|
-
sections.push(section("gui", "GUI", await buildGuiChecks(options)));
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
const allChecks = sections.flatMap((candidate) => candidate.checks);
|
|
125
|
-
const status = deriveDoctorStatus(allChecks);
|
|
126
|
-
return {
|
|
127
|
-
schemaVersion: DOCTOR_REPORT_SCHEMA_VERSION,
|
|
128
|
-
generatedAt: now.toISOString(),
|
|
129
|
-
status,
|
|
130
|
-
summary: buildSummary(status, allChecks),
|
|
131
|
-
sections,
|
|
132
|
-
metadata: {
|
|
133
|
-
cwd,
|
|
134
|
-
agentDir: options.agentDir,
|
|
135
|
-
opencandleHome: home,
|
|
136
|
-
opencandleHomeSource: process.env.OPENCANDLE_HOME ? "env" : "default",
|
|
137
|
-
},
|
|
138
|
-
};
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
export function deriveDoctorStatus(checks: readonly DoctorCheck[]): DoctorOverallStatus {
|
|
142
|
-
if (checks.some((candidate) => candidate.capability === "core" && candidate.status === "fail")) {
|
|
143
|
-
return "blocked";
|
|
144
|
-
}
|
|
145
|
-
if (
|
|
146
|
-
checks.some(
|
|
147
|
-
(candidate) =>
|
|
148
|
-
candidate.status === "warn" ||
|
|
149
|
-
candidate.status === "unknown" ||
|
|
150
|
-
(candidate.capability === "optional" && candidate.status === "fail"),
|
|
151
|
-
)
|
|
152
|
-
) {
|
|
153
|
-
return "degraded";
|
|
154
|
-
}
|
|
155
|
-
return "ready";
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
function section(id: string, label: string, checks: DoctorCheck[]): DoctorSection {
|
|
159
|
-
return {
|
|
160
|
-
id,
|
|
161
|
-
label,
|
|
162
|
-
status: deriveDoctorStatus(checks),
|
|
163
|
-
checks,
|
|
164
|
-
};
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
function buildRuntimeChecks(cwd: string): DoctorCheck[] {
|
|
168
|
-
const packageJson = readPackageJson();
|
|
169
|
-
const nodeMessage = getUnsupportedNodeVersionMessage();
|
|
170
|
-
const sqliteLoads = canLoadBetterSqlite();
|
|
171
|
-
return [
|
|
172
|
-
{
|
|
173
|
-
id: "runtime.opencandle_version",
|
|
174
|
-
label: "OpenCandle version",
|
|
175
|
-
status: "pass",
|
|
176
|
-
capability: "core",
|
|
177
|
-
summary: packageJson.version ? `OpenCandle ${packageJson.version}` : "Version unavailable",
|
|
178
|
-
metadata: { version: packageJson.version ?? null },
|
|
179
|
-
},
|
|
180
|
-
{
|
|
181
|
-
id: "runtime.node",
|
|
182
|
-
label: "Node.js",
|
|
183
|
-
status: nodeMessage ? "fail" : "pass",
|
|
184
|
-
capability: "core",
|
|
185
|
-
summary: nodeMessage
|
|
186
|
-
? `Unsupported Node ${process.versions.node}`
|
|
187
|
-
: `Node ${process.version}`,
|
|
188
|
-
remediation: nodeMessage ?? undefined,
|
|
189
|
-
metadata: { version: process.versions.node, supportedRange: packageJson.engines?.node },
|
|
190
|
-
},
|
|
191
|
-
{
|
|
192
|
-
id: "runtime.better_sqlite3",
|
|
193
|
-
label: "better-sqlite3",
|
|
194
|
-
status: sqliteLoads ? "pass" : "fail",
|
|
195
|
-
capability: "core",
|
|
196
|
-
summary: sqliteLoads ? "Native SQLite binding loads" : "Native SQLite binding failed to load",
|
|
197
|
-
remediation: sqliteLoads
|
|
198
|
-
? undefined
|
|
199
|
-
: "Run `npm rebuild better-sqlite3` or reinstall dependencies under the active Node with `npm install`.",
|
|
200
|
-
},
|
|
201
|
-
{
|
|
202
|
-
id: "runtime.cwd",
|
|
203
|
-
label: "Working directory",
|
|
204
|
-
status: "pass",
|
|
205
|
-
capability: "core",
|
|
206
|
-
summary: cwd,
|
|
207
|
-
metadata: { cwd },
|
|
208
|
-
},
|
|
209
|
-
];
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
function buildStateChecks(home: string, agentDir: string | undefined): DoctorCheck[] {
|
|
213
|
-
return [
|
|
214
|
-
{
|
|
215
|
-
id: "state.opencandle_home",
|
|
216
|
-
label: "OpenCandle home",
|
|
217
|
-
status: directoryUsable(home) ? "pass" : existsSync(home) ? "warn" : "skip",
|
|
218
|
-
capability: "core",
|
|
219
|
-
summary: `${home} (${process.env.OPENCANDLE_HOME ? "environment override" : "default"})`,
|
|
220
|
-
remediation: existsSync(home)
|
|
221
|
-
? "Ensure the OpenCandle home directory is readable and writable."
|
|
222
|
-
: "OpenCandle will create this directory when state is first written.",
|
|
223
|
-
metadata: { path: home, source: process.env.OPENCANDLE_HOME ? "env" : "default" },
|
|
224
|
-
},
|
|
225
|
-
piAgentDirCheck(agentDir),
|
|
226
|
-
configCheck(),
|
|
227
|
-
fileStateCheck("state.onboarding", "Onboarding state", getOnboardingPath()),
|
|
228
|
-
fileStateCheck("state.sqlite", "State database", getStateDbPath()),
|
|
229
|
-
fileStateCheck(
|
|
230
|
-
"state.sentiment",
|
|
231
|
-
"Sentiment history store",
|
|
232
|
-
resolveOpenCandlePath("sentinel.db"),
|
|
233
|
-
),
|
|
234
|
-
];
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
function configCheck(): DoctorCheck {
|
|
238
|
-
const path = getConfigPath();
|
|
239
|
-
if (!existsSync(path)) {
|
|
240
|
-
return {
|
|
241
|
-
id: "state.config",
|
|
242
|
-
label: "Config file",
|
|
243
|
-
status: "skip",
|
|
244
|
-
capability: "core",
|
|
245
|
-
summary: "No config file yet",
|
|
246
|
-
remediation:
|
|
247
|
-
"No action required. OpenCandle will create config.json when settings are saved.",
|
|
248
|
-
metadata: { path },
|
|
249
|
-
};
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
try {
|
|
253
|
-
JSON.parse(readFileSync(path, "utf-8"));
|
|
254
|
-
return {
|
|
255
|
-
id: "state.config",
|
|
256
|
-
label: "Config file",
|
|
257
|
-
status: "pass",
|
|
258
|
-
capability: "core",
|
|
259
|
-
summary: "config.json parses",
|
|
260
|
-
metadata: { path },
|
|
261
|
-
};
|
|
262
|
-
} catch (error) {
|
|
263
|
-
return {
|
|
264
|
-
id: "state.config",
|
|
265
|
-
label: "Config file",
|
|
266
|
-
status: "fail",
|
|
267
|
-
capability: "core",
|
|
268
|
-
summary: "config.json is invalid JSON",
|
|
269
|
-
remediation: `Repair or remove ${path}. ${error instanceof Error ? error.message : String(error)}`,
|
|
270
|
-
metadata: { path },
|
|
271
|
-
};
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
function piAgentDirCheck(agentDir: string | undefined): DoctorCheck {
|
|
276
|
-
if (!agentDir) {
|
|
277
|
-
return {
|
|
278
|
-
id: "state.pi_agent_dir",
|
|
279
|
-
label: "Pi agent directory",
|
|
280
|
-
status: "unknown",
|
|
281
|
-
capability: "core",
|
|
282
|
-
summary: "Pi agent directory was not checked",
|
|
283
|
-
remediation: "Run doctor from an initialized OpenCandle CLI or GUI session.",
|
|
284
|
-
};
|
|
285
|
-
}
|
|
286
|
-
return {
|
|
287
|
-
id: "state.pi_agent_dir",
|
|
288
|
-
label: "Pi agent directory",
|
|
289
|
-
status: directoryUsable(agentDir) ? "pass" : existsSync(agentDir) ? "warn" : "skip",
|
|
290
|
-
capability: "core",
|
|
291
|
-
summary: agentDir,
|
|
292
|
-
remediation: existsSync(agentDir)
|
|
293
|
-
? "Ensure the Pi agent directory is readable and writable."
|
|
294
|
-
: "Pi will create this directory when model/auth state is first written.",
|
|
295
|
-
metadata: { path: agentDir },
|
|
296
|
-
};
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
function fileStateCheck(id: string, label: string, path: string): DoctorCheck {
|
|
300
|
-
if (!existsSync(path)) {
|
|
301
|
-
return {
|
|
302
|
-
id,
|
|
303
|
-
label,
|
|
304
|
-
status: "skip",
|
|
305
|
-
capability: "core",
|
|
306
|
-
summary: "Not created yet",
|
|
307
|
-
remediation: "No action required for a new install.",
|
|
308
|
-
metadata: { path },
|
|
309
|
-
};
|
|
310
|
-
}
|
|
311
|
-
return {
|
|
312
|
-
id,
|
|
313
|
-
label,
|
|
314
|
-
status: canAccess(path) ? "pass" : "warn",
|
|
315
|
-
capability: "core",
|
|
316
|
-
summary: canAccess(path) ? "Readable and writable" : "Access may be limited",
|
|
317
|
-
remediation: canAccess(path) ? undefined : `Ensure ${path} is readable and writable.`,
|
|
318
|
-
metadata: { path },
|
|
319
|
-
};
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
function buildModelCheck(modelSetup: DoctorModelSetupState | undefined): DoctorCheck {
|
|
323
|
-
const state = modelSetup ?? { requirement: "unknown" as const };
|
|
324
|
-
if (state.requirement === "ready") {
|
|
325
|
-
return {
|
|
326
|
-
id: "model.readiness",
|
|
327
|
-
label: "Model readiness",
|
|
328
|
-
status: "pass",
|
|
329
|
-
capability: "core",
|
|
330
|
-
summary: state.currentModel ? `Ready with ${state.currentModel}` : "Model is ready",
|
|
331
|
-
metadata: { currentModel: state.currentModel ?? null },
|
|
332
|
-
};
|
|
333
|
-
}
|
|
334
|
-
if (state.requirement === "select_model") {
|
|
335
|
-
return {
|
|
336
|
-
id: "model.readiness",
|
|
337
|
-
label: "Model readiness",
|
|
338
|
-
status: "fail",
|
|
339
|
-
capability: "core",
|
|
340
|
-
summary: "Model credentials exist but no active model is selected",
|
|
341
|
-
remediation:
|
|
342
|
-
"Run `/setup` in the CLI or choose an available model in the GUI model setup panel.",
|
|
343
|
-
metadata: { requirement: state.requirement, availableModels: state.availableModels ?? [] },
|
|
344
|
-
};
|
|
345
|
-
}
|
|
346
|
-
if (state.requirement === "connect_auth") {
|
|
347
|
-
return {
|
|
348
|
-
id: "model.readiness",
|
|
349
|
-
label: "Model readiness",
|
|
350
|
-
status: "fail",
|
|
351
|
-
capability: "core",
|
|
352
|
-
summary: "No usable model credentials are configured",
|
|
353
|
-
remediation: "Run `/setup` in the CLI or paste a model API key in the GUI model setup panel.",
|
|
354
|
-
metadata: { requirement: state.requirement },
|
|
355
|
-
};
|
|
356
|
-
}
|
|
357
|
-
return {
|
|
358
|
-
id: "model.readiness",
|
|
359
|
-
label: "Model readiness",
|
|
360
|
-
status: "unknown",
|
|
361
|
-
capability: "core",
|
|
362
|
-
summary: "Model readiness was not checked",
|
|
363
|
-
remediation:
|
|
364
|
-
"Run the doctor command from an initialized OpenCandle session for model setup state.",
|
|
365
|
-
metadata: { requirement: "unknown" },
|
|
366
|
-
};
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
async function buildProviderChecks(options: BuildDoctorReportOptions): Promise<DoctorCheck[]> {
|
|
370
|
-
const providers = listAllProviders();
|
|
371
|
-
const statuses =
|
|
372
|
-
options.providerStatuses ??
|
|
373
|
-
(await probeAllProviderStatuses({
|
|
374
|
-
commandRunner: options.commandRunner,
|
|
375
|
-
fetchImpl: options.fetchImpl,
|
|
376
|
-
force: true,
|
|
377
|
-
respectSkipped: true,
|
|
378
|
-
}));
|
|
379
|
-
const checks: DoctorCheck[] = statuses.map((status) => providerStatusCheck(status));
|
|
380
|
-
|
|
381
|
-
for (const provider of providers.filter(isExternalToolProvider)) {
|
|
382
|
-
const installStatus = statuses.find(
|
|
383
|
-
(status) => status.providerId === provider.id && status.kind === "external-tool",
|
|
384
|
-
);
|
|
385
|
-
if (installStatus?.state === "skipped") continue;
|
|
386
|
-
if (installStatus?.state !== "installed") continue;
|
|
387
|
-
|
|
388
|
-
if (options.includeSessions) {
|
|
389
|
-
const status = await probeProviderStatus(provider.id, {
|
|
390
|
-
mode: "session",
|
|
391
|
-
force: true,
|
|
392
|
-
respectSkipped: true,
|
|
393
|
-
commandRunner: options.commandRunner,
|
|
394
|
-
});
|
|
395
|
-
checks.push(providerStatusCheck(status, "session"));
|
|
396
|
-
} else {
|
|
397
|
-
checks.push(sessionNotCheckedCheck(provider));
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
|
|
401
|
-
return checks;
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
function providerChecksSkippedForInvalidConfig(): DoctorCheck {
|
|
405
|
-
return {
|
|
406
|
-
id: "providers.config_blocked",
|
|
407
|
-
label: "Provider checks",
|
|
408
|
-
status: "skip",
|
|
409
|
-
capability: "optional",
|
|
410
|
-
summary: "Skipped because config.json is invalid",
|
|
411
|
-
remediation: "Repair the config file, then rerun doctor to check provider readiness.",
|
|
412
|
-
};
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
function providerStatusCheck(status: ProviderStatus, modeOverride?: "session"): DoctorCheck {
|
|
416
|
-
const provider = getProvider(status.providerId);
|
|
417
|
-
const capability = provider.tier === "hard" ? "core" : "optional";
|
|
418
|
-
const metadata = {
|
|
419
|
-
providerId: status.providerId,
|
|
420
|
-
category: provider.category,
|
|
421
|
-
tier: provider.tier,
|
|
422
|
-
kind: status.kind,
|
|
423
|
-
state: status.state,
|
|
424
|
-
};
|
|
425
|
-
if (status.kind === "api-key") {
|
|
426
|
-
return {
|
|
427
|
-
id: `provider.${status.providerId}.credential`,
|
|
428
|
-
label: provider.displayName,
|
|
429
|
-
status: status.state === "configured" ? "pass" : "warn",
|
|
430
|
-
capability,
|
|
431
|
-
summary:
|
|
432
|
-
status.state === "configured"
|
|
433
|
-
? `Configured via ${status.credentialSource}`
|
|
434
|
-
: "Credential is missing",
|
|
435
|
-
remediation:
|
|
436
|
-
status.state === "configured"
|
|
437
|
-
? undefined
|
|
438
|
-
: `${provider.instructionsHint}. Run /connect ${provider.id}.`,
|
|
439
|
-
metadata: { ...metadata, credentialSource: status.credentialSource },
|
|
440
|
-
};
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
if (status.kind === "public-http") {
|
|
444
|
-
const ok = status.state === "reachable";
|
|
445
|
-
return {
|
|
446
|
-
id: `provider.${status.providerId}.reachability`,
|
|
447
|
-
label: provider.displayName,
|
|
448
|
-
status: ok ? "pass" : "fail",
|
|
449
|
-
capability,
|
|
450
|
-
summary: ok ? "Reachable" : `Not reachable (${status.state})`,
|
|
451
|
-
remediation: ok
|
|
452
|
-
? undefined
|
|
453
|
-
: `Check network connectivity and retry. OpenCandle uses ${provider.displayName} through a public HTTP endpoint.`,
|
|
454
|
-
metadata: { ...metadata, statusCode: status.statusCode ?? null },
|
|
455
|
-
};
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
if (modeOverride === "session" || status.mode === "session") {
|
|
459
|
-
const ok = status.state === "session_ok";
|
|
460
|
-
return {
|
|
461
|
-
id: `provider.${status.providerId}.session`,
|
|
462
|
-
label: `${provider.displayName} browser session`,
|
|
463
|
-
status: ok ? "pass" : "warn",
|
|
464
|
-
capability: "optional",
|
|
465
|
-
summary: ok ? "Browser session is usable" : (status.message ?? `Session ${status.state}`),
|
|
466
|
-
remediation: ok ? undefined : sessionRemediation(status.providerId, status.installCmd),
|
|
467
|
-
metadata,
|
|
468
|
-
};
|
|
469
|
-
}
|
|
470
|
-
|
|
471
|
-
const installed = status.state === "installed";
|
|
472
|
-
return {
|
|
473
|
-
id: `provider.${status.providerId}.binary`,
|
|
474
|
-
label: `${provider.displayName} CLI`,
|
|
475
|
-
status: installed
|
|
476
|
-
? "pass"
|
|
477
|
-
: status.state === "skipped"
|
|
478
|
-
? "skip"
|
|
479
|
-
: status.state === "missing"
|
|
480
|
-
? "warn"
|
|
481
|
-
: "unknown",
|
|
482
|
-
capability: "optional",
|
|
483
|
-
summary: installed ? "Installed" : (status.message ?? `CLI ${status.state}`),
|
|
484
|
-
remediation: installed
|
|
485
|
-
? undefined
|
|
486
|
-
: status.state === "skipped"
|
|
487
|
-
? `Run \`opencandle doctor --enable ${status.providerId}\` to re-enable this provider.`
|
|
488
|
-
: status.installCmd,
|
|
489
|
-
metadata,
|
|
490
|
-
};
|
|
491
|
-
}
|
|
492
|
-
|
|
493
|
-
function sessionNotCheckedCheck(provider: ProviderDescriptor): DoctorCheck {
|
|
494
|
-
return {
|
|
495
|
-
id: `provider.${provider.id}.session`,
|
|
496
|
-
label: `${provider.displayName} browser session`,
|
|
497
|
-
status: "unknown",
|
|
498
|
-
capability: "optional",
|
|
499
|
-
summary: "Not checked",
|
|
500
|
-
remediation: "Run `opencandle doctor --sessions` to check browser-cookie session readiness.",
|
|
501
|
-
metadata: { providerId: provider.id, category: provider.category, tier: provider.tier },
|
|
502
|
-
};
|
|
503
|
-
}
|
|
504
|
-
|
|
505
|
-
async function buildGuiChecks(options: BuildDoctorReportOptions): Promise<DoctorCheck[]> {
|
|
506
|
-
if (options.gui?.reachable !== undefined || options.gui?.role) {
|
|
507
|
-
const role = options.gui.role ?? "unknown";
|
|
508
|
-
const reachable = options.gui.reachable ?? true;
|
|
509
|
-
return [
|
|
510
|
-
{
|
|
511
|
-
id: "gui.server",
|
|
512
|
-
label: "GUI server",
|
|
513
|
-
status: reachable ? (role === "follower" ? "warn" : "pass") : "skip",
|
|
514
|
-
capability: "optional",
|
|
515
|
-
summary: reachable ? `GUI server is ${role}` : "GUI server is not running",
|
|
516
|
-
remediation:
|
|
517
|
-
role === "follower"
|
|
518
|
-
? "Open the writer GUI process to perform setup mutations."
|
|
519
|
-
: reachable
|
|
520
|
-
? undefined
|
|
521
|
-
: "Run `opencandle gui` to start the browser workbench.",
|
|
522
|
-
metadata: { ...options.gui },
|
|
523
|
-
},
|
|
524
|
-
];
|
|
525
|
-
}
|
|
526
|
-
|
|
527
|
-
const host = options.gui?.host ?? process.env.OPENCANDLE_GUI_HOST ?? "127.0.0.1";
|
|
528
|
-
const port = options.gui?.port ?? Number(process.env.OPENCANDLE_GUI_PORT ?? 14567);
|
|
529
|
-
const endpoint = options.gui?.healthEndpoint ?? `http://${host}:${port}/health`;
|
|
530
|
-
try {
|
|
531
|
-
const response = await (options.fetchImpl ?? fetch)(endpoint, {
|
|
532
|
-
signal: AbortSignal.timeout(1_500),
|
|
533
|
-
});
|
|
534
|
-
const body = await response.json().catch(() => null);
|
|
535
|
-
const role = isRecord(body) && typeof body.role === "string" ? body.role : "unknown";
|
|
536
|
-
const verified =
|
|
537
|
-
response.ok &&
|
|
538
|
-
isRecord(body) &&
|
|
539
|
-
body.ok === true &&
|
|
540
|
-
(role === "writer" || role === "follower");
|
|
541
|
-
return [
|
|
542
|
-
{
|
|
543
|
-
id: "gui.server",
|
|
544
|
-
label: "GUI server",
|
|
545
|
-
status: verified ? (role === "follower" ? "warn" : "pass") : "warn",
|
|
546
|
-
capability: "optional",
|
|
547
|
-
summary: verified
|
|
548
|
-
? `GUI server is ${role}`
|
|
549
|
-
: response.ok
|
|
550
|
-
? "OpenCandle GUI health payload was not verified"
|
|
551
|
-
: `GUI health returned HTTP ${response.status}`,
|
|
552
|
-
remediation:
|
|
553
|
-
verified && role === "follower"
|
|
554
|
-
? "Open the writer GUI process to perform setup mutations."
|
|
555
|
-
: undefined,
|
|
556
|
-
metadata: { host, port, role, endpoint, statusCode: response.status },
|
|
557
|
-
},
|
|
558
|
-
];
|
|
559
|
-
} catch {
|
|
560
|
-
return [
|
|
561
|
-
{
|
|
562
|
-
id: "gui.server",
|
|
563
|
-
label: "GUI server",
|
|
564
|
-
status: "skip",
|
|
565
|
-
capability: "optional",
|
|
566
|
-
summary: "GUI server is not running",
|
|
567
|
-
remediation: "Run `opencandle gui` to start the browser workbench.",
|
|
568
|
-
metadata: { host, port, endpoint },
|
|
569
|
-
},
|
|
570
|
-
];
|
|
571
|
-
}
|
|
572
|
-
}
|
|
573
|
-
|
|
574
|
-
function sessionRemediation(providerId: ProviderId, installCmd: string | undefined): string {
|
|
575
|
-
if (providerId === "reddit") return "Run `rdt login` and retry `opencandle doctor --sessions`.";
|
|
576
|
-
if (providerId === "twitter") {
|
|
577
|
-
return "Stay logged into x.com in a supported browser and retry `opencandle doctor --sessions`.";
|
|
578
|
-
}
|
|
579
|
-
return installCmd ?? "Install and authenticate the external tool.";
|
|
580
|
-
}
|
|
581
|
-
|
|
582
|
-
function buildSummary(status: DoctorOverallStatus, checks: readonly DoctorCheck[]): string {
|
|
583
|
-
if (status === "ready") return "OpenCandle core health is ready.";
|
|
584
|
-
const firstBlocking = checks.find(
|
|
585
|
-
(candidate) => candidate.capability === "core" && candidate.status === "fail",
|
|
586
|
-
);
|
|
587
|
-
if (firstBlocking) return `OpenCandle is blocked: ${firstBlocking.summary}.`;
|
|
588
|
-
const issueCount = checks.filter((candidate) =>
|
|
589
|
-
["warn", "fail", "unknown"].includes(candidate.status),
|
|
590
|
-
).length;
|
|
591
|
-
return `OpenCandle is usable with ${issueCount} degraded or unchecked ${issueCount === 1 ? "capability" : "capabilities"}.`;
|
|
592
|
-
}
|
|
593
|
-
|
|
594
|
-
function readPackageJson(): { version?: string; engines?: { node?: string } } {
|
|
595
|
-
try {
|
|
596
|
-
return JSON.parse(readFileSync(resolve(PACKAGE_ROOT, "package.json"), "utf-8")) as {
|
|
597
|
-
version?: string;
|
|
598
|
-
engines?: { node?: string };
|
|
599
|
-
};
|
|
600
|
-
} catch {
|
|
601
|
-
return {};
|
|
602
|
-
}
|
|
603
|
-
}
|
|
604
|
-
|
|
605
|
-
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
606
|
-
return typeof value === "object" && value !== null;
|
|
607
|
-
}
|
|
608
|
-
|
|
609
|
-
function canLoadBetterSqlite(): boolean {
|
|
610
|
-
try {
|
|
611
|
-
const Database = require("better-sqlite3") as BetterSqliteConstructor;
|
|
612
|
-
const db = new Database(":memory:");
|
|
613
|
-
db.close();
|
|
614
|
-
return true;
|
|
615
|
-
} catch {
|
|
616
|
-
return false;
|
|
617
|
-
}
|
|
618
|
-
}
|
|
619
|
-
|
|
620
|
-
function directoryUsable(path: string): boolean {
|
|
621
|
-
try {
|
|
622
|
-
return (
|
|
623
|
-
statSync(path).isDirectory() &&
|
|
624
|
-
canAccess(path, constants.R_OK | constants.W_OK | constants.X_OK)
|
|
625
|
-
);
|
|
626
|
-
} catch {
|
|
627
|
-
return false;
|
|
628
|
-
}
|
|
629
|
-
}
|
|
630
|
-
|
|
631
|
-
function canAccess(path: string, mode = constants.R_OK | constants.W_OK): boolean {
|
|
632
|
-
try {
|
|
633
|
-
accessSync(path, mode);
|
|
634
|
-
return true;
|
|
635
|
-
} catch {
|
|
636
|
-
return false;
|
|
637
|
-
}
|
|
638
|
-
}
|
package/src/index.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export { default as openCandleExtension } from "./pi/opencandle-extension.js";
|
|
2
|
-
export { type CreateOpenCandleSessionOptions, createOpenCandleSession } from "./pi/session.js";
|
|
3
|
-
export { agentToolToPiTool, getOpenCandleToolDefinitions } from "./pi/tool-adapter.js";
|
|
4
|
-
export { registerTools } from "./tool-kit.js";
|
|
5
|
-
export { getAllTools } from "./tools/index.js";
|