opencandle 0.3.0 → 0.5.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/LICENSE +1 -1
- package/README.md +106 -14
- package/assets/logo.svg +187 -0
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +40 -3
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +25 -0
- package/dist/config.js +72 -0
- package/dist/config.js.map +1 -1
- package/dist/infra/browser.d.ts +11 -3
- package/dist/infra/browser.js +2 -1
- package/dist/infra/browser.js.map +1 -1
- package/dist/infra/native-dependencies.d.ts +1 -0
- package/dist/infra/native-dependencies.js +10 -0
- package/dist/infra/native-dependencies.js.map +1 -0
- package/dist/infra/node-version.d.ts +2 -0
- package/dist/infra/node-version.js +23 -0
- package/dist/infra/node-version.js.map +1 -0
- package/dist/infra/rate-limiter.d.ts +4 -0
- package/dist/infra/rate-limiter.js +5 -1
- package/dist/infra/rate-limiter.js.map +1 -1
- package/dist/memory/index.d.ts +2 -0
- package/dist/memory/index.js +1 -0
- package/dist/memory/index.js.map +1 -1
- package/dist/memory/manager.d.ts +9 -0
- package/dist/memory/manager.js +28 -11
- package/dist/memory/manager.js.map +1 -1
- package/dist/memory/sqlite.js +42 -4
- package/dist/memory/sqlite.js.map +1 -1
- package/dist/memory/storage.d.ts +7 -0
- package/dist/memory/storage.js +3 -3
- package/dist/memory/storage.js.map +1 -1
- package/dist/memory/tool-defaults.d.ts +8 -0
- package/dist/memory/tool-defaults.js +59 -0
- package/dist/memory/tool-defaults.js.map +1 -0
- package/dist/memory/types.js +4 -0
- package/dist/memory/types.js.map +1 -1
- package/dist/onboarding/connect.d.ts +13 -1
- package/dist/onboarding/connect.js +21 -10
- package/dist/onboarding/connect.js.map +1 -1
- package/dist/onboarding/prompt-user.d.ts +1 -1
- package/dist/onboarding/providers.d.ts +7 -0
- package/dist/onboarding/providers.js +6 -3
- package/dist/onboarding/providers.js.map +1 -1
- package/dist/onboarding/tool-helpers.d.ts +1 -1
- package/dist/pi/opencandle-extension.d.ts +7 -1
- package/dist/pi/opencandle-extension.js +391 -21
- package/dist/pi/opencandle-extension.js.map +1 -1
- package/dist/pi/session-storage.d.ts +2 -0
- package/dist/pi/session-storage.js +5 -0
- package/dist/pi/session-storage.js.map +1 -0
- package/dist/pi/session.d.ts +4 -1
- package/dist/pi/session.js +25 -3
- package/dist/pi/session.js.map +1 -1
- package/dist/pi/setup.d.ts +1 -1
- package/dist/pi/setup.js +11 -1
- package/dist/pi/setup.js.map +1 -1
- package/dist/pi/tool-adapter.d.ts +2 -2
- package/dist/pi/tool-adapter.js +14 -1
- package/dist/pi/tool-adapter.js.map +1 -1
- package/dist/prompts/context-builder.d.ts +40 -3
- package/dist/prompts/context-builder.js +140 -19
- package/dist/prompts/context-builder.js.map +1 -1
- package/dist/prompts/disclaimer.d.ts +6 -0
- package/dist/prompts/disclaimer.js +9 -0
- package/dist/prompts/disclaimer.js.map +1 -0
- package/dist/prompts/policy-cards.d.ts +13 -0
- package/dist/prompts/policy-cards.js +197 -0
- package/dist/prompts/policy-cards.js.map +1 -0
- package/dist/prompts/sections.js +3 -3
- package/dist/prompts/sections.js.map +1 -1
- package/dist/prompts/workflow-prompts.d.ts +8 -0
- package/dist/prompts/workflow-prompts.js +208 -22
- package/dist/prompts/workflow-prompts.js.map +1 -1
- package/dist/providers/alpha-vantage.js +23 -1
- package/dist/providers/alpha-vantage.js.map +1 -1
- package/dist/providers/sec-edgar.d.ts +8 -1
- package/dist/providers/sec-edgar.js +172 -5
- package/dist/providers/sec-edgar.js.map +1 -1
- package/dist/providers/yahoo-finance.d.ts +2 -0
- package/dist/providers/yahoo-finance.js +203 -35
- package/dist/providers/yahoo-finance.js.map +1 -1
- package/dist/routing/classify-intent.d.ts +3 -0
- package/dist/routing/classify-intent.js +82 -3
- package/dist/routing/classify-intent.js.map +1 -1
- package/dist/routing/defaults.js +4 -4
- package/dist/routing/defaults.js.map +1 -1
- package/dist/routing/entity-extractor.d.ts +1 -0
- package/dist/routing/entity-extractor.js +158 -12
- package/dist/routing/entity-extractor.js.map +1 -1
- package/dist/routing/index.d.ts +10 -0
- package/dist/routing/index.js +7 -0
- package/dist/routing/index.js.map +1 -1
- package/dist/routing/legacy-rule-router.d.ts +9 -0
- package/dist/routing/legacy-rule-router.js +12 -0
- package/dist/routing/legacy-rule-router.js.map +1 -0
- package/dist/routing/planning.d.ts +54 -0
- package/dist/routing/planning.js +531 -0
- package/dist/routing/planning.js.map +1 -0
- package/dist/routing/route-manifest.d.ts +35 -0
- package/dist/routing/route-manifest.js +221 -0
- package/dist/routing/route-manifest.js.map +1 -0
- package/dist/routing/router-llm-client.d.ts +11 -0
- package/dist/routing/router-llm-client.js +42 -0
- package/dist/routing/router-llm-client.js.map +1 -0
- package/dist/routing/router-prompt.d.ts +2 -0
- package/dist/routing/router-prompt.js +141 -0
- package/dist/routing/router-prompt.js.map +1 -0
- package/dist/routing/router-types.d.ts +71 -0
- package/dist/routing/router-types.js +2 -0
- package/dist/routing/router-types.js.map +1 -0
- package/dist/routing/router.d.ts +11 -0
- package/dist/routing/router.js +638 -0
- package/dist/routing/router.js.map +1 -0
- package/dist/routing/slot-resolver.js +46 -6
- package/dist/routing/slot-resolver.js.map +1 -1
- package/dist/routing/turn-context.d.ts +44 -0
- package/dist/routing/turn-context.js +45 -0
- package/dist/routing/turn-context.js.map +1 -0
- package/dist/routing/types.d.ts +13 -1
- package/dist/runtime/answer-contracts.d.ts +82 -0
- package/dist/runtime/answer-contracts.js +414 -0
- package/dist/runtime/answer-contracts.js.map +1 -0
- package/dist/runtime/artifact-contracts.d.ts +14 -0
- package/dist/runtime/artifact-contracts.js +57 -0
- package/dist/runtime/artifact-contracts.js.map +1 -0
- package/dist/runtime/planning-evidence.d.ts +99 -0
- package/dist/runtime/planning-evidence.js +445 -0
- package/dist/runtime/planning-evidence.js.map +1 -0
- package/dist/runtime/session-coordinator.d.ts +81 -3
- package/dist/runtime/session-coordinator.js +201 -17
- package/dist/runtime/session-coordinator.js.map +1 -1
- package/dist/runtime/tool-defaults-wrapper.d.ts +3 -0
- package/dist/runtime/tool-defaults-wrapper.js +25 -0
- package/dist/runtime/tool-defaults-wrapper.js.map +1 -0
- package/dist/sentiment/store.js +5 -0
- package/dist/sentiment/store.js.map +1 -1
- package/dist/system-prompt.js +23 -12
- package/dist/system-prompt.js.map +1 -1
- package/dist/tool-kit.d.ts +4 -4
- package/dist/tools/fundamentals/company-overview.d.ts +1 -1
- package/dist/tools/fundamentals/company-overview.js +1 -1
- package/dist/tools/fundamentals/company-overview.js.map +1 -1
- package/dist/tools/fundamentals/comps.d.ts +1 -1
- package/dist/tools/fundamentals/comps.js +1 -1
- package/dist/tools/fundamentals/comps.js.map +1 -1
- package/dist/tools/fundamentals/dcf.d.ts +1 -1
- package/dist/tools/fundamentals/dcf.js +1 -1
- package/dist/tools/fundamentals/dcf.js.map +1 -1
- package/dist/tools/fundamentals/earnings.d.ts +1 -1
- package/dist/tools/fundamentals/earnings.js +1 -1
- package/dist/tools/fundamentals/earnings.js.map +1 -1
- package/dist/tools/fundamentals/financials.d.ts +1 -1
- package/dist/tools/fundamentals/financials.js +1 -1
- package/dist/tools/fundamentals/financials.js.map +1 -1
- package/dist/tools/fundamentals/sec-filings.d.ts +2 -1
- package/dist/tools/fundamentals/sec-filings.js +19 -2
- package/dist/tools/fundamentals/sec-filings.js.map +1 -1
- package/dist/tools/index.d.ts +29 -1
- package/dist/tools/index.js +30 -0
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/interaction/ask-user.d.ts +1 -1
- package/dist/tools/interaction/twitter-login.d.ts +1 -1
- package/dist/tools/macro/fear-greed.d.ts +1 -1
- package/dist/tools/macro/fear-greed.js +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 +29 -5
- package/dist/tools/macro/fred-data.js.map +1 -1
- package/dist/tools/market/crypto-history.d.ts +1 -1
- package/dist/tools/market/crypto-history.js +18 -2
- package/dist/tools/market/crypto-history.js.map +1 -1
- package/dist/tools/market/crypto-price.d.ts +1 -1
- package/dist/tools/market/crypto-price.js +1 -1
- package/dist/tools/market/crypto-price.js.map +1 -1
- package/dist/tools/market/search-ticker.d.ts +1 -1
- package/dist/tools/market/search-ticker.js +1 -1
- package/dist/tools/market/search-ticker.js.map +1 -1
- package/dist/tools/market/stock-history.d.ts +1 -1
- package/dist/tools/market/stock-history.js +1 -1
- package/dist/tools/market/stock-history.js.map +1 -1
- package/dist/tools/market/stock-quote.d.ts +1 -1
- package/dist/tools/market/stock-quote.js +1 -1
- package/dist/tools/market/stock-quote.js.map +1 -1
- package/dist/tools/options/greeks.js +0 -1
- package/dist/tools/options/greeks.js.map +1 -1
- package/dist/tools/options/option-chain.d.ts +1 -1
- package/dist/tools/options/option-chain.js +13 -5
- package/dist/tools/options/option-chain.js.map +1 -1
- package/dist/tools/portfolio/correlation.d.ts +1 -1
- package/dist/tools/portfolio/correlation.js +1 -1
- package/dist/tools/portfolio/correlation.js.map +1 -1
- package/dist/tools/portfolio/holdings-overlap.d.ts +8 -0
- package/dist/tools/portfolio/holdings-overlap.js +105 -0
- package/dist/tools/portfolio/holdings-overlap.js.map +1 -0
- package/dist/tools/portfolio/predictions.d.ts +1 -1
- package/dist/tools/portfolio/predictions.js +1 -1
- 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 +1 -1
- package/dist/tools/portfolio/risk-analysis.js.map +1 -1
- package/dist/tools/portfolio/tracker.d.ts +1 -1
- package/dist/tools/portfolio/tracker.js +1 -1
- package/dist/tools/portfolio/tracker.js.map +1 -1
- package/dist/tools/portfolio/watchlist.d.ts +1 -1
- package/dist/tools/portfolio/watchlist.js +12 -4
- package/dist/tools/portfolio/watchlist.js.map +1 -1
- package/dist/tools/sentiment/reddit-sentiment.d.ts +1 -1
- package/dist/tools/sentiment/reddit-sentiment.js +1 -1
- package/dist/tools/sentiment/reddit-sentiment.js.map +1 -1
- package/dist/tools/sentiment/sentiment-summary.d.ts +1 -1
- package/dist/tools/sentiment/sentiment-summary.js +57 -2
- package/dist/tools/sentiment/sentiment-summary.js.map +1 -1
- package/dist/tools/sentiment/sentiment-trend.d.ts +1 -1
- package/dist/tools/sentiment/twitter-sentiment.d.ts +1 -1
- package/dist/tools/sentiment/twitter-sentiment.js +1 -1
- package/dist/tools/sentiment/twitter-sentiment.js.map +1 -1
- package/dist/tools/sentiment/web-search.d.ts +1 -1
- package/dist/tools/sentiment/web-search.js +32 -3
- package/dist/tools/sentiment/web-search.js.map +1 -1
- package/dist/tools/sentiment/web-sentiment.d.ts +1 -1
- package/dist/tools/sentiment/web-sentiment.js +1 -1
- package/dist/tools/sentiment/web-sentiment.js.map +1 -1
- package/dist/tools/technical/backtest.d.ts +3 -3
- package/dist/tools/technical/backtest.js +41 -27
- package/dist/tools/technical/backtest.js.map +1 -1
- package/dist/tools/technical/indicators.d.ts +1 -1
- package/dist/tools/technical/indicators.js +8 -4
- package/dist/tools/technical/indicators.js.map +1 -1
- package/dist/types/options.d.ts +10 -0
- package/dist/types/portfolio.d.ts +27 -0
- package/dist/workflows/compare-assets.js +38 -2
- package/dist/workflows/compare-assets.js.map +1 -1
- package/dist/workflows/options-screener.js +94 -8
- package/dist/workflows/options-screener.js.map +1 -1
- package/dist/workflows/portfolio-builder.js +9 -5
- package/dist/workflows/portfolio-builder.js.map +1 -1
- package/gui/server/ask-user-bridge.ts +82 -0
- package/gui/server/background-quotes.ts +31 -0
- package/gui/server/chat-event-adapter.ts +142 -0
- package/gui/server/gui-session-manager.ts +5 -0
- package/gui/server/invoke-tool.ts +89 -0
- package/gui/server/live-chat-event-adapter.ts +181 -0
- package/gui/server/model-setup.ts +100 -0
- package/gui/server/package.json +5 -0
- package/gui/server/projector.ts +254 -0
- package/gui/server/prompt-observation.ts +61 -0
- package/gui/server/server.ts +703 -0
- package/gui/server/session-actions.ts +31 -0
- package/gui/server/session-entry-wait.ts +81 -0
- package/gui/server/tool-metadata.ts +88 -0
- package/gui/server/websocket.ts +128 -0
- package/gui/server/writer-lock.ts +118 -0
- package/gui/shared/chat-events.ts +118 -0
- package/gui/shared/event-reducer.ts +186 -0
- package/gui/web/dist/assets/CatalogOverlay-Bmp6Knu7.js +1 -0
- package/gui/web/dist/assets/index-Bxt9QpLX.css +1 -0
- package/gui/web/dist/assets/index-CZ9DHZYy.js +67 -0
- package/gui/web/dist/assets/logo-CWpt6Y2a.svg +187 -0
- package/gui/web/dist/index.html +17 -0
- package/package.json +50 -18
- package/src/analysts/contracts.ts +189 -0
- package/src/analysts/orchestrator.ts +300 -0
- package/src/cli.ts +206 -0
- package/src/config.ts +245 -0
- package/src/index.ts +5 -0
- package/src/infra/browser.ts +111 -0
- package/src/infra/cache.ts +103 -0
- package/src/infra/http-client.ts +68 -0
- package/src/infra/index.ts +18 -0
- package/src/infra/native-dependencies.ts +12 -0
- package/src/infra/node-version.ts +24 -0
- package/src/infra/open-url.ts +28 -0
- package/src/infra/opencandle-paths.ts +64 -0
- package/src/infra/rate-limiter.ts +73 -0
- package/src/memory/index.ts +10 -0
- package/src/memory/manager.ts +192 -0
- package/src/memory/preference-extractor.ts +106 -0
- package/src/memory/retrieval.ts +70 -0
- package/src/memory/sqlite.ts +172 -0
- package/src/memory/storage.ts +205 -0
- package/src/memory/tool-defaults.ts +87 -0
- package/src/memory/types.ts +71 -0
- package/src/onboarding/connect.ts +184 -0
- package/src/onboarding/credential-interceptor.ts +134 -0
- package/src/onboarding/degradation-accumulator.ts +79 -0
- package/src/onboarding/prompt-user.ts +85 -0
- package/src/onboarding/providers.ts +315 -0
- package/src/onboarding/state.ts +218 -0
- package/src/onboarding/tool-helpers.ts +111 -0
- package/src/onboarding/tool-tags.ts +201 -0
- package/src/onboarding/validation.ts +158 -0
- package/src/pi/opencandle-extension.ts +955 -0
- package/src/pi/session-storage.ts +5 -0
- package/src/pi/session.ts +81 -0
- package/src/pi/setup.ts +381 -0
- package/src/pi/tool-adapter.ts +36 -0
- package/src/prompts/context-builder.ts +315 -0
- package/src/prompts/disclaimer.ts +9 -0
- package/src/prompts/policy-cards.ts +220 -0
- package/src/prompts/sections.ts +46 -0
- package/src/prompts/workflow-prompts.ts +433 -0
- package/src/providers/alpha-vantage.ts +315 -0
- package/src/providers/coingecko.ts +96 -0
- package/src/providers/exa-search.ts +373 -0
- package/src/providers/fear-greed.ts +45 -0
- package/src/providers/finnhub.ts +124 -0
- package/src/providers/fred.ts +83 -0
- package/src/providers/index.ts +9 -0
- package/src/providers/provider-credential-error.ts +23 -0
- package/src/providers/reddit.ts +151 -0
- package/src/providers/sec-edgar.ts +312 -0
- package/src/providers/twitter.ts +173 -0
- package/src/providers/web-search.ts +293 -0
- package/src/providers/with-fallback.ts +41 -0
- package/src/providers/wrap-provider.ts +64 -0
- package/src/providers/yahoo-finance.ts +534 -0
- package/src/routing/classify-intent.ts +285 -0
- package/src/routing/defaults.ts +29 -0
- package/src/routing/entity-extractor.ts +291 -0
- package/src/routing/index.ts +70 -0
- package/src/routing/legacy-rule-router.ts +13 -0
- package/src/routing/planning.ts +732 -0
- package/src/routing/route-manifest.ts +287 -0
- package/src/routing/router-llm-client.ts +51 -0
- package/src/routing/router-prompt.ts +163 -0
- package/src/routing/router-types.ts +87 -0
- package/src/routing/router.ts +712 -0
- package/src/routing/slot-resolver.ts +190 -0
- package/src/routing/turn-context.ts +111 -0
- package/src/routing/types.ts +75 -0
- package/src/runtime/answer-contracts.ts +633 -0
- package/src/runtime/artifact-contracts.ts +76 -0
- package/src/runtime/evidence.ts +77 -0
- package/src/runtime/planning-evidence.ts +591 -0
- package/src/runtime/prompt-step.ts +75 -0
- package/src/runtime/provider-tracker.ts +40 -0
- package/src/runtime/run-context.ts +22 -0
- package/src/runtime/session-coordinator.ts +472 -0
- package/src/runtime/tool-defaults-wrapper.ts +35 -0
- package/src/runtime/validation.ts +214 -0
- package/src/runtime/workflow-events.ts +75 -0
- package/src/runtime/workflow-runner.ts +188 -0
- package/src/runtime/workflow-types.ts +102 -0
- package/src/sentiment/adapters/finnhub.ts +44 -0
- package/src/sentiment/adapters/reddit.ts +65 -0
- package/src/sentiment/adapters/twitter.ts +36 -0
- package/src/sentiment/adapters/web.ts +44 -0
- package/src/sentiment/index.ts +58 -0
- package/src/sentiment/keywords.ts +9 -0
- package/src/sentiment/pipeline.ts +68 -0
- package/src/sentiment/scorer.ts +78 -0
- package/src/sentiment/store.ts +260 -0
- package/src/sentiment/trends.ts +90 -0
- package/src/sentiment/types.ts +108 -0
- package/src/system-prompt.ts +118 -0
- package/src/tool-kit.ts +68 -0
- package/src/tools/AGENTS.md +36 -0
- package/src/tools/fundamentals/company-overview.ts +54 -0
- package/src/tools/fundamentals/comps.ts +156 -0
- package/src/tools/fundamentals/dcf.ts +267 -0
- package/src/tools/fundamentals/earnings.ts +47 -0
- package/src/tools/fundamentals/financials.ts +54 -0
- package/src/tools/fundamentals/sec-filings.ts +84 -0
- package/src/tools/index.ts +91 -0
- package/src/tools/interaction/ask-user.ts +81 -0
- package/src/tools/interaction/twitter-login.ts +93 -0
- package/src/tools/macro/fear-greed.ts +41 -0
- package/src/tools/macro/fred-data.ts +80 -0
- package/src/tools/market/crypto-history.ts +67 -0
- package/src/tools/market/crypto-price.ts +53 -0
- package/src/tools/market/search-ticker.ts +53 -0
- package/src/tools/market/stock-history.ts +79 -0
- package/src/tools/market/stock-quote.ts +64 -0
- package/src/tools/options/greeks.ts +81 -0
- package/src/tools/options/option-chain.ts +96 -0
- package/src/tools/portfolio/correlation.ts +162 -0
- package/src/tools/portfolio/holdings-overlap.ts +123 -0
- package/src/tools/portfolio/predictions.ts +253 -0
- package/src/tools/portfolio/risk-analysis.ts +134 -0
- package/src/tools/portfolio/tracker.ts +147 -0
- package/src/tools/portfolio/watchlist.ts +159 -0
- package/src/tools/sentiment/reddit-sentiment.ts +164 -0
- package/src/tools/sentiment/sentiment-summary.ts +316 -0
- package/src/tools/sentiment/sentiment-trend.ts +58 -0
- package/src/tools/sentiment/twitter-sentiment.ts +96 -0
- package/src/tools/sentiment/web-search.ts +183 -0
- package/src/tools/sentiment/web-sentiment.ts +76 -0
- package/src/tools/technical/backtest.ts +267 -0
- package/src/tools/technical/indicators.ts +256 -0
- package/src/types/fundamentals.ts +46 -0
- package/src/types/index.ts +20 -0
- package/src/types/macro.ts +27 -0
- package/src/types/market.ts +43 -0
- package/src/types/options.ts +52 -0
- package/src/types/portfolio.ts +73 -0
- package/src/types/sentiment.ts +70 -0
- package/src/workflows/compare-assets.ts +75 -0
- package/src/workflows/index.ts +4 -0
- package/src/workflows/options-screener.ts +127 -0
- package/src/workflows/portfolio-builder.ts +56 -0
- package/src/workflows/types.ts +4 -0
- package/dist/runtime/index.d.ts +0 -16
- package/dist/runtime/index.js +0 -10
- package/dist/runtime/index.js.map +0 -1
- package/dist/runtime/provider-ids.d.ts +0 -14
- package/dist/runtime/provider-ids.js +0 -14
- package/dist/runtime/provider-ids.js.map +0 -1
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,27 +1,40 @@
|
|
|
1
1
|
# OpenCandle
|
|
2
2
|
|
|
3
|
-
OpenCandle is
|
|
3
|
+
OpenCandle is an open source financial investigator built with TypeScript and Pi. Pi is the bundled local agent runtime that provides the terminal UI, model auth, session storage, slash commands, and extension hooks. OpenCandle adds finance research on top: it understands what kind of financial question you asked, gathers market, macro, options, fundamentals, filings, sentiment, and portfolio evidence from real sources, then turns that evidence into a risk-aware answer.
|
|
4
4
|
|
|
5
|
-
This repository is useful in
|
|
5
|
+
This repository is useful in three ways:
|
|
6
6
|
|
|
7
7
|
- Run `opencandle` as an interactive CLI for market research
|
|
8
|
+
- Open the local GUI for chat, tool discovery, provider status, and session history
|
|
8
9
|
- Extend OpenCandle with new tools, providers, or Pi-compatible add-on packages
|
|
9
10
|
|
|
11
|
+

|
|
12
|
+
|
|
13
|
+
## Why OpenCandle?
|
|
14
|
+
|
|
15
|
+
Financial research gets messy when evidence is scattered across quote pages, filings, macro dashboards, sentiment feeds, and ad hoc spreadsheets. OpenCandle gives the agent explicit tools, provider boundaries, and local state so research stays inspectable: gather the data first, show the gaps, then synthesize without pretending uncertainty disappeared.
|
|
16
|
+
|
|
17
|
+
OpenCandle is strongest when the answer depends on live or inspectable financial evidence: quotes, histories, options chains, filings, macro series, sentiment, local portfolio state, and source-gap disclosure. It can also answer educational questions without forcing unnecessary data lookups. OpenCandle's job is to make financial research auditable and useful without pretending uncertainty disappeared.
|
|
18
|
+
|
|
10
19
|
## What You Can Use It For
|
|
11
20
|
|
|
12
21
|
- Quote and history lookups for stocks and crypto
|
|
13
22
|
- Options chains with locally computed Greeks
|
|
14
23
|
- Company fundamentals, earnings, and SEC filings
|
|
15
|
-
- FRED macro series and Fear & Greed
|
|
24
|
+
- FRED macro series and the alternative.me crypto Fear & Greed index
|
|
16
25
|
- Reddit-based sentiment and discussion lookups
|
|
17
26
|
- Portfolio tracking, watchlists, correlation, and risk analysis
|
|
18
27
|
- Multi-step workflows such as `/analyze NVDA`
|
|
28
|
+
- Clarifying follow-ups when a ticker, goal, horizon, or risk profile is ambiguous
|
|
29
|
+
- Source-gap and stale-data warnings when a provider is missing, delayed, or unavailable
|
|
19
30
|
|
|
20
31
|
OpenCandle is designed to fetch and format data. The model handles synthesis. Tool code should not invent financial conclusions or hardcode market numbers.
|
|
21
32
|
|
|
33
|
+
OpenCandle is read-only research software. It does not place trades, route orders, or provide financial advice.
|
|
34
|
+
|
|
22
35
|
## Install And Run
|
|
23
36
|
|
|
24
|
-
Requires Node.js 20
|
|
37
|
+
Requires Node.js `^20.19.0`, `^22.12.0`, or `>=24.0.0 <27`.
|
|
25
38
|
|
|
26
39
|
### CLI
|
|
27
40
|
|
|
@@ -41,11 +54,15 @@ cp .env.example .env
|
|
|
41
54
|
npm start
|
|
42
55
|
```
|
|
43
56
|
|
|
57
|
+
On Windows Command Prompt, use `copy .env.example .env` instead of `cp .env.example .env`.
|
|
58
|
+
|
|
44
59
|
On first run, OpenCandle walks you through model setup. You can rerun that flow later with `/setup`.
|
|
45
60
|
|
|
61
|
+
For a step-by-step happy path, see [docs/first-run.md](./docs/first-run.md).
|
|
62
|
+
|
|
46
63
|
## Configuration
|
|
47
64
|
|
|
48
|
-
Model access comes from Pi. Market data providers are optional and additive.
|
|
65
|
+
Model access comes from Pi. Market data providers are optional and additive. A `.env` file in the current working directory is loaded at startup, and env values override values from `~/.opencandle/config.json`. If the same key is both exported in your shell and present in `.env`, the `.env` value wins.
|
|
49
66
|
|
|
50
67
|
| Key | Required | Used For |
|
|
51
68
|
| --- | --- | --- |
|
|
@@ -54,8 +71,17 @@ Model access comes from Pi. Market data providers are optional and additive.
|
|
|
54
71
|
| `ANTHROPIC_API_KEY` | No | Anthropic models through Pi |
|
|
55
72
|
| `ALPHA_VANTAGE_API_KEY` | No | Fundamentals, earnings, financial statements |
|
|
56
73
|
| `FRED_API_KEY` | No | Macro series such as rates, CPI, GDP, unemployment |
|
|
57
|
-
|
|
58
|
-
|
|
74
|
+
| `BRAVE_API_KEY` | No | Brave web search fallback |
|
|
75
|
+
| `EXA_API_KEY` | No | Exa web search |
|
|
76
|
+
| `FINNHUB_API_KEY` | No | Finnhub company news for sentiment summaries |
|
|
77
|
+
| `OPENCANDLE_HOME` | No | Override OpenCandle state directory |
|
|
78
|
+
| `OPENCANDLE_ROUTER_MODE` | No | Advanced request-understanding mode; keep the default unless debugging |
|
|
79
|
+
| `OPENCANDLE_TOOL_SCOPE_MODE` | No | `observe` by default; set `enforce` to apply route-selected active tools |
|
|
80
|
+
| `OPENCANDLE_DEBATE` | No | Set `false` or `0` to disable bull/bear debate |
|
|
81
|
+
| `OPENCANDLE_GUI_HOST` | No | GUI bind host, default `127.0.0.1` |
|
|
82
|
+
| `OPENCANDLE_GUI_PORT` | No | GUI port, default `14567` |
|
|
83
|
+
|
|
84
|
+
Yahoo Finance, CoinGecko, Reddit, SEC EDGAR, DuckDuckGo search, and the alternative.me crypto Fear & Greed index do not require keys.
|
|
59
85
|
|
|
60
86
|
OpenCandle stores its own user state in `~/.opencandle/` by default. Pi configuration stays in `.pi/` and `~/.pi/agent/`. The CLI should not depend on repo-local `.pi/extensions/`.
|
|
61
87
|
|
|
@@ -69,6 +95,15 @@ Provider keys can also be stored in `~/.opencandle/config.json`:
|
|
|
69
95
|
},
|
|
70
96
|
"fred": {
|
|
71
97
|
"apiKey": "..."
|
|
98
|
+
},
|
|
99
|
+
"brave": {
|
|
100
|
+
"apiKey": "..."
|
|
101
|
+
},
|
|
102
|
+
"exa": {
|
|
103
|
+
"apiKey": "..."
|
|
104
|
+
},
|
|
105
|
+
"finnhub": {
|
|
106
|
+
"apiKey": "..."
|
|
72
107
|
}
|
|
73
108
|
}
|
|
74
109
|
}
|
|
@@ -76,9 +111,13 @@ Provider keys can also be stored in `~/.opencandle/config.json`:
|
|
|
76
111
|
|
|
77
112
|
Environment variables override values from `~/.opencandle/config.json`. Set `OPENCANDLE_HOME` if you want OpenCandle state somewhere other than `~/.opencandle/`.
|
|
78
113
|
|
|
114
|
+
See [docs/configuration.md](./docs/configuration.md) for the full env var, file config, state file, and GUI runtime reference.
|
|
115
|
+
|
|
79
116
|
## Basic Usage
|
|
80
117
|
|
|
81
|
-
OpenCandle runs inside Pi's interactive terminal UI.
|
|
118
|
+
OpenCandle runs inside Pi's interactive terminal UI. The local GUI can be started with `opencandle gui` from an installed package or `npm run gui` from a checkout.
|
|
119
|
+
|
|
120
|
+
See [docs/tui.md](./docs/tui.md) for terminal usage, sessions, and slash-command behavior.
|
|
82
121
|
|
|
83
122
|
Useful commands:
|
|
84
123
|
|
|
@@ -86,6 +125,7 @@ Useful commands:
|
|
|
86
125
|
/setup
|
|
87
126
|
/login
|
|
88
127
|
/model
|
|
128
|
+
/connect
|
|
89
129
|
/analyze AAPL
|
|
90
130
|
```
|
|
91
131
|
|
|
@@ -93,22 +133,41 @@ Example prompts:
|
|
|
93
133
|
|
|
94
134
|
```text
|
|
95
135
|
What is AAPL trading at?
|
|
96
|
-
Get the options chain for TSLA expiring
|
|
136
|
+
Get the options chain for TSLA expiring next month
|
|
97
137
|
Show me MSFT puts with Greeks
|
|
98
138
|
Get the fed funds rate from FRED
|
|
99
139
|
Add 100 shares of NVDA at 120 to my portfolio, then show my portfolio
|
|
100
140
|
Run risk analysis on SPY
|
|
101
141
|
```
|
|
102
142
|
|
|
143
|
+
## Local GUI
|
|
144
|
+
|
|
145
|
+
The GUI is a local browser workbench for chat, session history, tool discovery, provider setup, and richer financial result cards.
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
opencandle gui
|
|
149
|
+
# or from a checkout
|
|
150
|
+
npm run gui
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Then open `http://127.0.0.1:14567`.
|
|
154
|
+
|
|
155
|
+

|
|
156
|
+
|
|
157
|
+
From the GUI you can ask normal chat questions, launch workflows from the catalog, run one tool directly, answer clarification cards, inspect tool output, connect provider keys, and reopen prior sessions. Workflow catalog entries become structured chat prompts, so the result still appears in the same transcript with tool cards and source warnings.
|
|
158
|
+
|
|
159
|
+
The GUI reports whether it is the session `writer` or a read-only `follower` at `/health`. See [docs/gui-quickstart.md](./docs/gui-quickstart.md).
|
|
160
|
+
|
|
103
161
|
## Data Sources And Tool Coverage
|
|
104
162
|
|
|
105
163
|
| Area | Examples | Source |
|
|
106
164
|
| --- | --- | --- |
|
|
107
|
-
| Market data | quotes, history, ticker search, crypto price/history | Yahoo Finance, CoinGecko |
|
|
165
|
+
| Market data | quotes, history, ticker search, crypto price/history | Yahoo Finance, Alpha Vantage fallback when configured, CoinGecko |
|
|
108
166
|
| Options | chains, open interest, IV, Greeks | Yahoo Finance plus local calculations |
|
|
109
167
|
| Fundamentals | overview, financials, earnings, DCF, company comparison | Alpha Vantage |
|
|
110
|
-
| Macro | economic series, Fear & Greed | FRED, alternative.me |
|
|
111
|
-
|
|
|
168
|
+
| Macro | economic series, crypto Fear & Greed | FRED, alternative.me |
|
|
169
|
+
| Technical | indicators, strategy backtests | Local calculations over market history |
|
|
170
|
+
| Sentiment | Reddit, Twitter/X, Finnhub news, and web sentiment with cross-source pipeline | Reddit JSON API, Twitter/X local browser session, Finnhub, Exa, Brave, DuckDuckGo |
|
|
112
171
|
| Filings | SEC filing search | SEC EDGAR |
|
|
113
172
|
| Portfolio | watchlist, prediction tracking, correlation, risk | Local state plus market data |
|
|
114
173
|
|
|
@@ -121,7 +180,7 @@ src/
|
|
|
121
180
|
├── providers/ API clients
|
|
122
181
|
├── tools/ Tool implementations by domain
|
|
123
182
|
├── infra/ Cache, rate limiter, HTTP, browser, paths
|
|
124
|
-
├── routing/
|
|
183
|
+
├── routing/ Request understanding, entity extraction, and slot resolution
|
|
125
184
|
├── workflows/ Multi-step workflow builders
|
|
126
185
|
├── memory/ SQLite-backed state and retrieval
|
|
127
186
|
├── analysts/ Multi-analyst orchestration
|
|
@@ -133,15 +192,22 @@ src/
|
|
|
133
192
|
|
|
134
193
|
```bash
|
|
135
194
|
npm start
|
|
195
|
+
npm run gui
|
|
196
|
+
npm run docs:site:build
|
|
136
197
|
npm test
|
|
137
198
|
npm run test:watch
|
|
138
199
|
npm run test:e2e
|
|
139
200
|
npm run test:e2e:cli
|
|
140
201
|
npm run test:e2e:providers
|
|
202
|
+
npm run test:evals
|
|
203
|
+
npm run test:evals:product
|
|
204
|
+
npm run test:evals:competitive
|
|
141
205
|
```
|
|
142
206
|
|
|
143
207
|
`npm test` is the required baseline check after changes.
|
|
144
208
|
|
|
209
|
+
The e2e, provider, and eval commands can hit live APIs, live model providers, or local agent CLIs. Run them intentionally; see [docs/testing-and-evals.md](./docs/testing-and-evals.md).
|
|
210
|
+
|
|
145
211
|
### Repository Rules That Matter
|
|
146
212
|
|
|
147
213
|
- TDD is mandatory for behavior changes
|
|
@@ -159,6 +225,8 @@ Besides the CLI, the package exposes pieces for engineers building on top of Ope
|
|
|
159
225
|
- `opencandle/infra`
|
|
160
226
|
- `opencandle/types`
|
|
161
227
|
- `opencandle/providers`
|
|
228
|
+
- `opencandle/tools`
|
|
229
|
+
- `opencandle/workflows`
|
|
162
230
|
|
|
163
231
|
If you want to add a new tool or publish an add-on package, start with [docs/build-a-tool.md](./docs/build-a-tool.md).
|
|
164
232
|
|
|
@@ -167,16 +235,40 @@ If you want to add a new tool or publish an add-on package, start with [docs/bui
|
|
|
167
235
|
For end-to-end agent driving with file-based IPC:
|
|
168
236
|
|
|
169
237
|
```bash
|
|
170
|
-
npx tsx tests/harness/
|
|
238
|
+
npx tsx tests/harness/cli.ts run --prompt "What is AAPL trading at?" --ipc /tmp/opencandle-ipc &
|
|
239
|
+
npx tsx tests/harness/cli.ts wait --ipc /tmp/opencandle-ipc
|
|
240
|
+
npx tsx tests/harness/cli.ts trace --ipc /tmp/opencandle-ipc
|
|
171
241
|
```
|
|
172
242
|
|
|
173
243
|
The harness writes status and trace files into the IPC directory. See [tests/harness/README.md](./tests/harness/README.md) for the full flow.
|
|
174
244
|
|
|
175
245
|
## Project Docs
|
|
176
246
|
|
|
247
|
+
- [docs/index.md](./docs/index.md)
|
|
248
|
+
- [docs/getting-started.md](./docs/getting-started.md)
|
|
249
|
+
- [docs/first-run.md](./docs/first-run.md)
|
|
250
|
+
- [docs/tui.md](./docs/tui.md)
|
|
251
|
+
- [docs/investigation-recipes.md](./docs/investigation-recipes.md)
|
|
252
|
+
- [docs/data-sources.md](./docs/data-sources.md)
|
|
253
|
+
- [docs/configuration.md](./docs/configuration.md)
|
|
254
|
+
- [docs/system-architecture.md](./docs/system-architecture.md)
|
|
255
|
+
- [docs/gui-quickstart.md](./docs/gui-quickstart.md)
|
|
256
|
+
- [docs/testing-and-evals.md](./docs/testing-and-evals.md)
|
|
257
|
+
- [docs/benchmarking.md](./docs/benchmarking.md)
|
|
177
258
|
- [CONTRIBUTING.md](./CONTRIBUTING.md)
|
|
178
259
|
- [docs/build-a-tool.md](./docs/build-a-tool.md)
|
|
179
260
|
- [tests/harness/README.md](./tests/harness/README.md)
|
|
180
261
|
- [CHANGELOG.md](./CHANGELOG.md)
|
|
181
262
|
- [SECURITY.md](./SECURITY.md)
|
|
182
263
|
- [LICENSE](./LICENSE)
|
|
264
|
+
|
|
265
|
+
## Website
|
|
266
|
+
|
|
267
|
+
The static website lives in [website/](./website/). It builds a product landing page plus the public Markdown docs into `website/dist/`.
|
|
268
|
+
|
|
269
|
+
```bash
|
|
270
|
+
npm run docs:site:build
|
|
271
|
+
npm run docs:site:serve
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
GitHub Pages can publish the generated artifact through the included Pages workflow.
|
package/assets/logo.svg
ADDED
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:v="https://svgstorm.com"
|
|
2
|
+
viewBox = "0 0 1009 1008"
|
|
3
|
+
width="1009"
|
|
4
|
+
height="1008">
|
|
5
|
+
<g fill="None" fill-opacity="0.0" stroke="#34474E" stroke-opacity="0.00" stroke-width="0.3"><path d="
|
|
6
|
+
M 0.00 1008.00
|
|
7
|
+
L 1009.00 1008.00
|
|
8
|
+
L 1009.00 0.00
|
|
9
|
+
L 0.00 0.00
|
|
10
|
+
L 0.00 1008.00
|
|
11
|
+
M 893.00 7.00
|
|
12
|
+
C 912.65 7.48 933.31 16.27 951.00 28.00
|
|
13
|
+
C 960.90 34.53 969.82 43.54 977.00 53.00
|
|
14
|
+
C 987.75 70.16 998.47 88.32 1000.00 109.00
|
|
15
|
+
C 1004.61 172.94 1000.71 239.89 1002.00 305.00 C 1002.00 437.00 1002.00 569.00 1002.00 701.00 C 1000.71 766.09 1004.61 833.14 1000.00 897.00
|
|
16
|
+
C 997.20 915.93 990.73 934.49 979.00 950.00
|
|
17
|
+
C 971.95 960.06 962.97 968.87 953.00 976.00
|
|
18
|
+
C 936.25 987.24 917.87 994.87 898.00 998.00
|
|
19
|
+
C 848.40 1002.63 795.77 998.69 745.00 1000.00 C 537.83 999.33 329.35 1001.34 123.00 999.00
|
|
20
|
+
C 113.93 999.28 105.34 997.59 97.00 995.00
|
|
21
|
+
C 87.29 992.63 76.80 989.30 69.00 983.00
|
|
22
|
+
C 68.57 982.83 68.00 983.00 68.00 983.00
|
|
23
|
+
C 55.21 976.65 44.68 965.81 35.00 955.00
|
|
24
|
+
C -7.40 902.87 14.27 828.97 9.00 765.00 C 9.00 548.67 9.00 332.33 9.00 116.00 C 11.95 60.04 61.08 10.55 117.00 7.00
|
|
25
|
+
C 374.60 5.33 635.47 5.33 893.00 7.00 Z"/>
|
|
26
|
+
</g>
|
|
27
|
+
<g fill="None" fill-opacity="0.0" stroke="#87A188" stroke-opacity="1.00" stroke-width="0.3"><path d="
|
|
28
|
+
M 117.00 7.00
|
|
29
|
+
C 375.67 7.00 634.33 7.00 893.00 7.00
|
|
30
|
+
C 635.47 5.33 374.60 5.33 117.00 7.00 Z"/>
|
|
31
|
+
</g>
|
|
32
|
+
<g fill="None" fill-opacity="0.0" stroke="#34474E" stroke-opacity="1.00" stroke-width="0.3"><path d="
|
|
33
|
+
M 893.00 7.00
|
|
34
|
+
C 634.33 7.00 375.67 7.00 117.00 7.00
|
|
35
|
+
C 61.08 10.55 11.95 60.04 9.00 116.00 C 9.00 332.33 9.00 548.67 9.00 765.00 C 14.27 828.97 -7.40 902.87 35.00 955.00
|
|
36
|
+
C 45.51 965.18 56.26 975.41 68.00 983.00
|
|
37
|
+
C 68.00 983.00 68.57 982.83 69.00 983.00
|
|
38
|
+
C 77.85 988.23 88.00 991.10 97.00 995.00
|
|
39
|
+
C 105.34 997.59 113.93 999.28 123.00 999.00
|
|
40
|
+
C 381.25 998.34 640.16 1000.33 898.00 998.00
|
|
41
|
+
C 917.87 994.87 936.25 987.24 953.00 976.00
|
|
42
|
+
C 961.89 967.94 970.70 958.59 979.00 950.00
|
|
43
|
+
C 990.73 934.49 997.20 915.93 1000.00 897.00
|
|
44
|
+
C 1001.66 634.92 1001.67 371.08 1000.00 109.00
|
|
45
|
+
C 998.47 88.32 987.75 70.16 977.00 53.00
|
|
46
|
+
C 968.92 44.28 959.99 35.47 951.00 28.00
|
|
47
|
+
C 933.31 16.27 912.65 7.48 893.00 7.00
|
|
48
|
+
M 515.00 304.00
|
|
49
|
+
C 539.00 304.00 563.00 304.00 587.00 304.00 C 615.29 302.32 605.38 337.85 607.00 356.00 C 607.00 452.00 607.00 548.00 607.00 644.00 C 605.19 661.97 615.63 698.38 587.00 696.00 C 563.00 696.00 539.00 696.00 515.00 696.00
|
|
50
|
+
C 515.00 728.00 515.00 760.00 515.00 792.00 C 512.34 804.03 522.39 828.07 505.00 830.00 C 487.59 827.79 497.67 804.11 495.00 792.00 C 495.00 760.00 495.00 728.00 495.00 696.00
|
|
51
|
+
C 471.33 696.00 447.67 696.00 424.00 696.00 C 394.53 699.12 406.18 662.06 404.00 644.00 C 404.00 548.33 404.00 452.67 404.00 357.00 C 406.52 338.80 394.21 302.66 423.00 304.00 C 447.00 304.00 471.00 304.00 495.00 304.00
|
|
52
|
+
C 495.00 272.00 495.00 240.00 495.00 208.00 C 497.32 195.66 488.16 173.46 505.01 170.01 C 521.85 173.62 512.68 195.59 515.00 208.00 C 515.00 240.00 515.00 272.00 515.00 304.00 Z"/>
|
|
53
|
+
</g>
|
|
54
|
+
<g fill="None" fill-opacity="0.0" stroke="#87A188" stroke-opacity="0.91" stroke-width="0.3"><path d="
|
|
55
|
+
M 977.00 53.00
|
|
56
|
+
C 969.82 43.54 960.90 34.53 951.00 28.00
|
|
57
|
+
C 959.99 35.47 968.92 44.28 977.00 53.00 Z"/>
|
|
58
|
+
</g>
|
|
59
|
+
<g fill="None" fill-opacity="0.0" stroke="#87A188" stroke-opacity="1.00" stroke-width="0.3"><path d="
|
|
60
|
+
M 1000.00 897.00
|
|
61
|
+
C 1004.61 833.14 1000.71 766.09 1002.00 701.00 C 1002.00 569.00 1002.00 437.00 1002.00 305.00 C 1000.71 239.89 1004.61 172.94 1000.00 109.00
|
|
62
|
+
C 1001.67 371.08 1001.66 634.92 1000.00 897.00 Z"/>
|
|
63
|
+
</g>
|
|
64
|
+
<g fill="None" fill-opacity="0.0" stroke="#87A188" stroke-opacity="1.00" stroke-width="0.3"><path d="
|
|
65
|
+
M 515.00 304.00
|
|
66
|
+
C 515.00 272.00 515.00 240.00 515.00 208.00 C 512.68 195.59 521.85 173.62 505.01 170.01 C 488.16 173.46 497.32 195.66 495.00 208.00 C 495.00 240.00 495.00 272.00 495.00 304.00
|
|
67
|
+
C 471.00 304.00 447.00 304.00 423.00 304.00 C 394.21 302.66 406.52 338.80 404.00 357.00 C 404.00 452.67 404.00 548.33 404.00 644.00 C 406.18 662.06 394.53 699.12 424.00 696.00 C 447.67 696.00 471.33 696.00 495.00 696.00
|
|
68
|
+
C 495.00 728.00 495.00 760.00 495.00 792.00 C 497.67 804.11 487.59 827.79 505.00 830.00 C 522.39 828.07 512.34 804.03 515.00 792.00 C 515.00 760.00 515.00 728.00 515.00 696.00
|
|
69
|
+
C 539.00 696.00 563.00 696.00 587.00 696.00 C 615.63 698.38 605.19 661.97 607.00 644.00 C 607.00 548.00 607.00 452.00 607.00 356.00 C 605.38 337.85 615.29 302.32 587.00 304.00 C 563.00 304.00 539.00 304.00 515.00 304.00 Z"/>
|
|
70
|
+
</g>
|
|
71
|
+
<g fill="None" fill-opacity="0.0" stroke="#87A188" stroke-opacity="0.78" stroke-width="0.3"><path d="
|
|
72
|
+
M 953.00 976.00
|
|
73
|
+
C 962.97 968.87 971.95 960.06 979.00 950.00
|
|
74
|
+
C 970.70 958.59 961.89 967.94 953.00 976.00 Z"/>
|
|
75
|
+
</g>
|
|
76
|
+
<g fill="None" fill-opacity="0.0" stroke="#87A188" stroke-opacity="0.85" stroke-width="0.3"><path d="
|
|
77
|
+
M 68.00 983.00
|
|
78
|
+
C 56.26 975.41 45.51 965.18 35.00 955.00
|
|
79
|
+
C 44.68 965.81 55.21 976.65 68.00 983.00 Z"/>
|
|
80
|
+
</g>
|
|
81
|
+
<g fill="None" fill-opacity="0.0" stroke="#87A188" stroke-opacity="0.79" stroke-width="0.3"><path d="
|
|
82
|
+
M 97.00 995.00
|
|
83
|
+
C 88.00 991.10 77.85 988.23 69.00 983.00
|
|
84
|
+
C 76.80 989.30 87.29 992.63 97.00 995.00 Z"/>
|
|
85
|
+
</g>
|
|
86
|
+
<g fill="None" fill-opacity="0.0" stroke="#87A188" stroke-opacity="0.53" stroke-width="0.3"><path d="
|
|
87
|
+
M 123.00 999.00
|
|
88
|
+
C 329.35 1001.34 537.83 999.33 745.00 1000.00 C 795.77 998.69 848.40 1002.63 898.00 998.00
|
|
89
|
+
C 640.16 1000.33 381.25 998.34 123.00 999.00 Z"/>
|
|
90
|
+
</g>
|
|
91
|
+
<g fill="#34474E" fill-opacity="0.00" stroke="None">
|
|
92
|
+
<path d="
|
|
93
|
+
M 0.00 1008.00
|
|
94
|
+
L 1009.00 1008.00
|
|
95
|
+
L 1009.00 0.00
|
|
96
|
+
L 0.00 0.00
|
|
97
|
+
L 0.00 1008.00
|
|
98
|
+
M 893.00 7.00
|
|
99
|
+
C 912.65 7.48 933.31 16.27 951.00 28.00
|
|
100
|
+
C 960.90 34.53 969.82 43.54 977.00 53.00
|
|
101
|
+
C 987.75 70.16 998.47 88.32 1000.00 109.00
|
|
102
|
+
C 1004.61 172.94 1000.71 239.89 1002.00 305.00 C 1002.00 437.00 1002.00 569.00 1002.00 701.00 C 1000.71 766.09 1004.61 833.14 1000.00 897.00
|
|
103
|
+
C 997.20 915.93 990.73 934.49 979.00 950.00
|
|
104
|
+
C 971.95 960.06 962.97 968.87 953.00 976.00
|
|
105
|
+
C 936.25 987.24 917.87 994.87 898.00 998.00
|
|
106
|
+
C 848.40 1002.63 795.77 998.69 745.00 1000.00 C 537.83 999.33 329.35 1001.34 123.00 999.00
|
|
107
|
+
C 113.93 999.28 105.34 997.59 97.00 995.00
|
|
108
|
+
C 87.29 992.63 76.80 989.30 69.00 983.00
|
|
109
|
+
C 68.57 982.83 68.00 983.00 68.00 983.00
|
|
110
|
+
C 55.21 976.65 44.68 965.81 35.00 955.00
|
|
111
|
+
C -7.40 902.87 14.27 828.97 9.00 765.00 C 9.00 548.67 9.00 332.33 9.00 116.00 C 11.95 60.04 61.08 10.55 117.00 7.00
|
|
112
|
+
C 374.60 5.33 635.47 5.33 893.00 7.00 Z"/>
|
|
113
|
+
</g>
|
|
114
|
+
<g fill="#87A188" fill-opacity="1.00" stroke="None">
|
|
115
|
+
<path d="
|
|
116
|
+
M 117.00 7.00
|
|
117
|
+
C 375.67 7.00 634.33 7.00 893.00 7.00
|
|
118
|
+
C 635.47 5.33 374.60 5.33 117.00 7.00 Z"/>
|
|
119
|
+
</g>
|
|
120
|
+
<g fill="#34474E" fill-opacity="1.00" stroke="None">
|
|
121
|
+
<path d="
|
|
122
|
+
M 893.00 7.00
|
|
123
|
+
C 634.33 7.00 375.67 7.00 117.00 7.00
|
|
124
|
+
C 61.08 10.55 11.95 60.04 9.00 116.00 C 9.00 332.33 9.00 548.67 9.00 765.00 C 14.27 828.97 -7.40 902.87 35.00 955.00
|
|
125
|
+
C 45.51 965.18 56.26 975.41 68.00 983.00
|
|
126
|
+
C 68.00 983.00 68.57 982.83 69.00 983.00
|
|
127
|
+
C 77.85 988.23 88.00 991.10 97.00 995.00
|
|
128
|
+
C 105.34 997.59 113.93 999.28 123.00 999.00
|
|
129
|
+
C 381.25 998.34 640.16 1000.33 898.00 998.00
|
|
130
|
+
C 917.87 994.87 936.25 987.24 953.00 976.00
|
|
131
|
+
C 961.89 967.94 970.70 958.59 979.00 950.00
|
|
132
|
+
C 990.73 934.49 997.20 915.93 1000.00 897.00
|
|
133
|
+
C 1001.66 634.92 1001.67 371.08 1000.00 109.00
|
|
134
|
+
C 998.47 88.32 987.75 70.16 977.00 53.00
|
|
135
|
+
C 968.92 44.28 959.99 35.47 951.00 28.00
|
|
136
|
+
C 933.31 16.27 912.65 7.48 893.00 7.00
|
|
137
|
+
M 515.00 304.00
|
|
138
|
+
C 539.00 304.00 563.00 304.00 587.00 304.00 C 615.29 302.32 605.38 337.85 607.00 356.00 C 607.00 452.00 607.00 548.00 607.00 644.00 C 605.19 661.97 615.63 698.38 587.00 696.00 C 563.00 696.00 539.00 696.00 515.00 696.00
|
|
139
|
+
C 515.00 728.00 515.00 760.00 515.00 792.00 C 512.34 804.03 522.39 828.07 505.00 830.00 C 487.59 827.79 497.67 804.11 495.00 792.00 C 495.00 760.00 495.00 728.00 495.00 696.00
|
|
140
|
+
C 471.33 696.00 447.67 696.00 424.00 696.00 C 394.53 699.12 406.18 662.06 404.00 644.00 C 404.00 548.33 404.00 452.67 404.00 357.00 C 406.52 338.80 394.21 302.66 423.00 304.00 C 447.00 304.00 471.00 304.00 495.00 304.00
|
|
141
|
+
C 495.00 272.00 495.00 240.00 495.00 208.00 C 497.32 195.66 488.16 173.46 505.01 170.01 C 521.85 173.62 512.68 195.59 515.00 208.00 C 515.00 240.00 515.00 272.00 515.00 304.00 Z"/>
|
|
142
|
+
</g>
|
|
143
|
+
<g fill="#87A188" fill-opacity="0.91" stroke="None">
|
|
144
|
+
<path d="
|
|
145
|
+
M 977.00 53.00
|
|
146
|
+
C 969.82 43.54 960.90 34.53 951.00 28.00
|
|
147
|
+
C 959.99 35.47 968.92 44.28 977.00 53.00 Z"/>
|
|
148
|
+
</g>
|
|
149
|
+
<g fill="#87A188" fill-opacity="1.00" stroke="None">
|
|
150
|
+
<path d="
|
|
151
|
+
M 1000.00 897.00
|
|
152
|
+
C 1004.61 833.14 1000.71 766.09 1002.00 701.00 C 1002.00 569.00 1002.00 437.00 1002.00 305.00 C 1000.71 239.89 1004.61 172.94 1000.00 109.00
|
|
153
|
+
C 1001.67 371.08 1001.66 634.92 1000.00 897.00 Z"/>
|
|
154
|
+
</g>
|
|
155
|
+
<g fill="#87A188" fill-opacity="1.00" stroke="None">
|
|
156
|
+
<path d="
|
|
157
|
+
M 515.00 304.00
|
|
158
|
+
C 515.00 272.00 515.00 240.00 515.00 208.00 C 512.68 195.59 521.85 173.62 505.01 170.01 C 488.16 173.46 497.32 195.66 495.00 208.00 C 495.00 240.00 495.00 272.00 495.00 304.00
|
|
159
|
+
C 471.00 304.00 447.00 304.00 423.00 304.00 C 394.21 302.66 406.52 338.80 404.00 357.00 C 404.00 452.67 404.00 548.33 404.00 644.00 C 406.18 662.06 394.53 699.12 424.00 696.00 C 447.67 696.00 471.33 696.00 495.00 696.00
|
|
160
|
+
C 495.00 728.00 495.00 760.00 495.00 792.00 C 497.67 804.11 487.59 827.79 505.00 830.00 C 522.39 828.07 512.34 804.03 515.00 792.00 C 515.00 760.00 515.00 728.00 515.00 696.00
|
|
161
|
+
C 539.00 696.00 563.00 696.00 587.00 696.00 C 615.63 698.38 605.19 661.97 607.00 644.00 C 607.00 548.00 607.00 452.00 607.00 356.00 C 605.38 337.85 615.29 302.32 587.00 304.00 C 563.00 304.00 539.00 304.00 515.00 304.00 Z"/>
|
|
162
|
+
</g>
|
|
163
|
+
<g fill="#87A188" fill-opacity="0.78" stroke="None">
|
|
164
|
+
<path d="
|
|
165
|
+
M 953.00 976.00
|
|
166
|
+
C 962.97 968.87 971.95 960.06 979.00 950.00
|
|
167
|
+
C 970.70 958.59 961.89 967.94 953.00 976.00 Z"/>
|
|
168
|
+
</g>
|
|
169
|
+
<g fill="#87A188" fill-opacity="0.85" stroke="None">
|
|
170
|
+
<path d="
|
|
171
|
+
M 68.00 983.00
|
|
172
|
+
C 56.26 975.41 45.51 965.18 35.00 955.00
|
|
173
|
+
C 44.68 965.81 55.21 976.65 68.00 983.00 Z"/>
|
|
174
|
+
</g>
|
|
175
|
+
<g fill="#87A188" fill-opacity="0.79" stroke="None">
|
|
176
|
+
<path d="
|
|
177
|
+
M 97.00 995.00
|
|
178
|
+
C 88.00 991.10 77.85 988.23 69.00 983.00
|
|
179
|
+
C 76.80 989.30 87.29 992.63 97.00 995.00 Z"/>
|
|
180
|
+
</g>
|
|
181
|
+
<g fill="#87A188" fill-opacity="0.53" stroke="None">
|
|
182
|
+
<path d="
|
|
183
|
+
M 123.00 999.00
|
|
184
|
+
C 329.35 1001.34 537.83 999.33 745.00 1000.00 C 795.77 998.69 848.40 1002.63 898.00 998.00
|
|
185
|
+
C 640.16 1000.33 381.25 998.34 123.00 999.00 Z"/>
|
|
186
|
+
</g>
|
|
187
|
+
</svg>
|
package/dist/cli.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
2
|
+
import "./infra/node-version.js";
|
package/dist/cli.js
CHANGED
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import "./infra/node-version.js";
|
|
3
|
+
import { spawn } from "node:child_process";
|
|
4
|
+
import { createRequire } from "node:module";
|
|
5
|
+
import { dirname, resolve } from "node:path";
|
|
2
6
|
import { parseArgs } from "node:util";
|
|
3
|
-
import {
|
|
7
|
+
import { fileURLToPath } from "node:url";
|
|
8
|
+
import { AuthStorage, DefaultPackageManager, InteractiveMode, ModelRegistry, SettingsManager, createAgentSessionRuntime, createAgentSessionServices, getAgentDir, initTheme, } from "@earendil-works/pi-coding-agent";
|
|
4
9
|
import { createOpenCandleSession } from "./pi/session.js";
|
|
10
|
+
import { continueOpenCandleSession } from "./pi/session-storage.js";
|
|
5
11
|
import { loadEnv } from "./config.js";
|
|
12
|
+
const require = createRequire(import.meta.url);
|
|
13
|
+
const packageRoot = resolve(dirname(fileURLToPath(import.meta.url)), "..");
|
|
6
14
|
async function handlePackageCommand(args, cwd, agentDir) {
|
|
7
15
|
const [command, ...rest] = args;
|
|
8
16
|
if (!command ||
|
|
@@ -86,11 +94,38 @@ async function handlePackageCommand(args, cwd, agentDir) {
|
|
|
86
94
|
}
|
|
87
95
|
return false;
|
|
88
96
|
}
|
|
97
|
+
async function handleGuiCommand(args, cwd) {
|
|
98
|
+
if (args[0] !== "gui")
|
|
99
|
+
return false;
|
|
100
|
+
const tsxCli = require.resolve("tsx/cli");
|
|
101
|
+
const serverPath = resolve(packageRoot, "gui/server/server.ts");
|
|
102
|
+
const child = spawn(process.execPath, [tsxCli, serverPath, ...args.slice(1)], {
|
|
103
|
+
cwd,
|
|
104
|
+
env: process.env,
|
|
105
|
+
stdio: "inherit",
|
|
106
|
+
});
|
|
107
|
+
const exitCode = await new Promise((resolveExit) => {
|
|
108
|
+
child.on("close", (code, signal) => {
|
|
109
|
+
if (signal) {
|
|
110
|
+
resolveExit(1);
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
resolveExit(code ?? 0);
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
});
|
|
117
|
+
process.exitCode = exitCode;
|
|
118
|
+
return true;
|
|
119
|
+
}
|
|
89
120
|
async function main() {
|
|
121
|
+
const rawArgs = process.argv.slice(2);
|
|
90
122
|
const { positionals } = parseArgs({ allowPositionals: true, strict: false });
|
|
91
123
|
const cwd = process.cwd();
|
|
92
124
|
const agentDir = getAgentDir();
|
|
93
|
-
if (await
|
|
125
|
+
if (await handleGuiCommand(positionals, cwd)) {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
if (await handlePackageCommand(rawArgs, cwd, agentDir)) {
|
|
94
129
|
return;
|
|
95
130
|
}
|
|
96
131
|
// Default: start the OpenCandle interactive agent
|
|
@@ -100,7 +135,7 @@ async function main() {
|
|
|
100
135
|
const modelRegistry = ModelRegistry.create(authStorage);
|
|
101
136
|
const shouldSuppressFallbackMessage = modelRegistry.getAvailable().length === 0;
|
|
102
137
|
initTheme(settingsManager.getTheme(), true);
|
|
103
|
-
const sessionManager =
|
|
138
|
+
const sessionManager = continueOpenCandleSession(cwd);
|
|
104
139
|
const runtime = await createAgentSessionRuntime(async (opts) => {
|
|
105
140
|
const services = await createAgentSessionServices({
|
|
106
141
|
cwd: opts.cwd,
|
|
@@ -111,10 +146,12 @@ async function main() {
|
|
|
111
146
|
});
|
|
112
147
|
const result = await createOpenCandleSession({
|
|
113
148
|
cwd: opts.cwd,
|
|
149
|
+
agentDir: opts.agentDir,
|
|
114
150
|
settingsManager,
|
|
115
151
|
authStorage,
|
|
116
152
|
modelRegistry,
|
|
117
153
|
sessionManager: opts.sessionManager,
|
|
154
|
+
bindExtensions: false,
|
|
118
155
|
});
|
|
119
156
|
return {
|
|
120
157
|
...result,
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EACL,WAAW,EACX,qBAAqB,EACrB,eAAe,EACf,aAAa,EACb,eAAe,EACf,
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,yBAAyB,CAAC;AACjC,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EACL,WAAW,EACX,qBAAqB,EACrB,eAAe,EACf,aAAa,EACb,eAAe,EACf,yBAAyB,EACzB,0BAA0B,EAC1B,WAAW,EACX,SAAS,GACV,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC/C,MAAM,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,I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,QAAQ;YACvB,eAAe;YACf,WAAW;YACX,aAAa;YACb,cAAc,EAAE,IAAI,CAAC,cAAc;YACnC,cAAc,EAAE,KAAK;SACtB,CAAC,CAAC;QACH,OAAO;YACL,GAAG,MAAM;YACT,QAAQ;YACR,WAAW,EAAE,QAAQ,CAAC,WAAW;SAClC,CAAC;IACJ,CAAC,EACD,EAAE,GAAG,EAAE,QAAQ,EAAE,cAAc,EAAE,CAClC,CAAC;IAEF,IAAI,CAAC;QACH,MAAM,eAAe,GAAG,IAAI,eAAe,CAAC,OAAO,EAAE;YACnD,oBAAoB,EAAE,6BAA6B;gBACjD,CAAC,CAAC,SAAS;gBACX,CAAC,CAAC,OAAO,CAAC,oBAAoB;SACjC,CAAC,CAAC;QACH,MAAM,eAAe,CAAC,GAAG,EAAE,CAAC;IAC9B,CAAC;YAAS,CAAC;QACT,MAAM,OAAO,CAAC,OAAO,EAAE,CAAC;IAC1B,CAAC;AACH,CAAC;AAED,MAAM,IAAI,EAAE,CAAC"}
|
package/dist/config.d.ts
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
|
+
import type { PlanningBehaviorMode, TaskFamily } from "./routing/planning.js";
|
|
1
2
|
export interface SentimentConfig {
|
|
2
3
|
retentionDays: number;
|
|
3
4
|
defaultSubreddits: string[];
|
|
4
5
|
commentsPerPost: number;
|
|
5
6
|
divergenceThreshold: number;
|
|
6
7
|
}
|
|
8
|
+
export type RouterMode = "rules" | "llm";
|
|
9
|
+
export type ToolScopeMode = "observe" | "enforce";
|
|
10
|
+
export type PlanningMigrationStatuses = Partial<Record<TaskFamily, PlanningBehaviorMode>>;
|
|
7
11
|
export interface Config {
|
|
8
12
|
alphaVantageApiKey?: string;
|
|
9
13
|
fredApiKey?: string;
|
|
@@ -12,6 +16,25 @@ export interface Config {
|
|
|
12
16
|
finnhubApiKey?: string;
|
|
13
17
|
/** Enable adversarial bull/bear debate in comprehensive analysis. Default: true. */
|
|
14
18
|
debate?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Intent-router mode. `"llm"` (default) runs the LLM router ahead of prompt
|
|
21
|
+
* assembly. `"rules"` is the explicit legacy rule-router rollback path
|
|
22
|
+
* (`classifyIntent` + `extractPreferences`). Controlled by
|
|
23
|
+
* `OPENCANDLE_ROUTER_MODE`.
|
|
24
|
+
*/
|
|
25
|
+
routerMode: RouterMode;
|
|
26
|
+
/**
|
|
27
|
+
* Route-selected tool scope mode. `"observe"` (default) records selected
|
|
28
|
+
* bundles and active-tool candidates. `"enforce"` applies Pi active tools
|
|
29
|
+
* for the turn via `pi.setActiveTools`.
|
|
30
|
+
*/
|
|
31
|
+
toolScopeMode: ToolScopeMode;
|
|
32
|
+
/**
|
|
33
|
+
* Per-task planning behavior rollback/activation overrides. Controlled by
|
|
34
|
+
* `OPENCANDLE_PLANNING_MIGRATION_STATUSES`, e.g.
|
|
35
|
+
* `asset_compare=dual_run,single_asset_decision=observe_only`.
|
|
36
|
+
*/
|
|
37
|
+
planningMigrationStatuses?: PlanningMigrationStatuses;
|
|
15
38
|
sentiment?: SentimentConfig;
|
|
16
39
|
}
|
|
17
40
|
export interface OpenCandleFileConfig {
|
|
@@ -46,3 +69,5 @@ export declare function loadFileConfig(path?: string): OpenCandleFileConfig;
|
|
|
46
69
|
export declare function saveFileConfig(config: OpenCandleFileConfig, path?: string): void;
|
|
47
70
|
export declare function loadConfig(): Config;
|
|
48
71
|
export declare function getConfig(): Config;
|
|
72
|
+
/** Test-only: clear the memoized config so the next `getConfig()` re-reads env. */
|
|
73
|
+
export declare function resetConfigCache(): void;
|