Repository navigation
Discord news integration: finny_discord_read tool + community link - #15
Merged
Merged
Conversation
Add finny_discord_read tool so Finny can read MonitoRSS-mirrored news from a curated set of Discord channels (trump, options-flow, dark-pool, china-us-news, market-news, congressional-trades, fed-fomc, fed-speakers) and ground answers in current events when sketching algos. Why: scraping Truth Social / SCMP / Fed press pages directly is brittle and rate-limited. MonitoRSS already aggregates these feeds into a single channel surface; reading them via Discord's REST API gives Finny clean, structured headline+excerpt+url triples plus timestamps. Notes: - Tool reads from process.env, falling back to ~/.finny/discord.env so the secret stays outside the repo and survives different launch cwds. - Channel IDs are validated as Discord snowflakes before any HTTP call, and the bot token is redacted from any error message echoed back. - Swap the TUI sidebar's Feedback button to point at the Discord invite (the community is now the support surface). - Add .npmignore + files allowlist on @finny-ai/integrations so .env can't ride into a tarball even if private:true is ever flipped off. - Drop the unmaintained non-English READMEs.
spandanniroula
pushed a commit
to spandanniroula/finny
that referenced
this pull request
Jun 12, 2026
Fixes all 17 Copilot comments: Telemetry opt-out (polarline-markets#1, polarline-markets#2, polarline-markets#3, polarline-markets#9, polarline-markets#16): - tracker.ts now reads FINNY_TELEMETRY=0 / OPENCODE_TELEMETRY=0 at module load, so the opt-out applies in every entrypoint (TUI worker, server, CLI), not just the bootstrap path. - Email dialog auto-prompt and /subscribe slash command also gated on Analytics.isEnabled() — email POST goes to the same Convex deployment. Tracker correctness (polarline-markets#5, polarline-markets#14, polarline-markets#17): - drain() now also waits for the DeviceProfile.userId() resolution promise, not just the post-send promise. - worker rpc.shutdown() and main-thread thread.ts both call Analytics.drain() before tearing down — neither beforeExit nor SIGTERM fire on worker.terminate() / process.exit(0). - beforeExit handler runs at most once per process, preventing an infinite drain loop when a hung telemetry request later resolves and re-empties the loop. Privacy (polarline-markets#10, polarline-markets#11, polarline-markets#12): - Drop process.argv from tui.worker.booted (could include --prompt text and project paths). - error.surfaced now sends only error.name; error messages frequently embed user prompt content and local file paths. - Don't persist the submitted email address to local KV (no reader, just unnecessary PII retention). Email dialog state machine (polarline-markets#4, polarline-markets#6, polarline-markets#8): - Wait for kv.ready before evaluating the prompt gate so we don't re-show the dialog to users who already submitted/skipped. - Conditional dismiss handler — only marks "skipped" when no terminal status has been set, so a successful submit isn't overwritten by the dismiss callback that fires on dialog.clear() and isn't suppressed by another dialog replacing this one. Server-side validation (polarline-markets#15): - subscribe mutation now rejects empty / oversized / regex-failing emails with a ConvexError, so the public Convex client can't bypass the TUI regex. Command coverage (polarline-markets#13): - Hook Analytics.track() in DialogCommand.trigger() instead of the bus event handler. trigger() is the central activation point for palette, slash, keybind, plugin, and bus paths — single hook, full coverage, no double-counting. Comment wording (polarline-markets#7): - bootstrap.ts: "opt-in by default" → "enabled by default" (correct description of opt-out semantics). Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
finny_discord_read, a native OpenCode tool that fetches the latest N posts from a curated Finny Discord news channel and returns clean{title, excerpt, url, timestamp}triples Finny can reason over. Eight channels wired up:trump,options-flow,dark-pool,china-us-news,market-news,congressional-trades,fed-fomc,fed-speakers.@finny-ai/integrationspackaging so a stray.envcan't ride into a tarball, and removes 21 unmaintained non-English READMEs.Why
When asked something like "check on Trump's recent movements and sketch an algo," Finny was scraping Truth Social directly via WebFetch and failing. MonitoRSS already mirrors curated RSS feeds into our Discord channels in a structured form — reading them via Discord's REST API gives Finny grounded, dated context with source links it can cite.
What's in the diff
Tool runtime (
packages/opencode/src/tool/discord.ts) — aTool.define-style implementation registered inregistry.ts. Parses both legacyembeds(Politico, SCMP, Fed press releases) and Discord's new Components V2 layout (MonitoRSS Trump posts use this). PullsDISCORD_BOT_TOKENandDISCORD_CHANNEL_*fromprocess.env, falling back to~/.finny/discord.envso the secret stays out of the repo and survives different launch cwds.TUI sidebar (
packages/opencode/src/cli/cmd/tui/component/sidebar-nav.tsx) — bottom-left "Feedback" item becomes "Discord", opens https://discord.gg/Y68pqQju8 viaopen().Packaging (
packages/finny-integrations/) — adds.npmignoreexcluding.env*,*.pem,*.key,*.p12, plus afilesallowlist inpackage.jsonthat ships onlysrc/and.env.example. Verified withbun pm pack --dry-run— no.envin the tarball.Cleanup — drops 21 stale
README.<locale>.mdfiles (no internal links pointed at them).Security notes
DISCORD_BOT_TOKENonly ever lives in env /~/.finny/discord.env(mode 600, gitignored). Never committed, never logged, never echoed in errors (HTTP error path explicitly redacts the token if Discord ever returns it in a body).Test plan
Out of scope (intentional)