Skip to content

Add Lite tier alongside Pro - #8

Merged
Jaiminp007 merged 1 commit into
devfrom
feat/lite-tier
Apr 27, 2026
Merged

Jaiminp007 merged 1 commit into
devfrom
feat/lite-tier

Conversation

@Jaiminp007

Copy link
Copy Markdown
Collaborator

This pull request introduces full support for the new "Finny Lite" plan tier in both the product documentation and the CLI user interface. It updates the plan management logic and user experience to handle Lite and Pro licenses in parallel, improves the upsell dialog to offer both Lite and Pro upgrades where appropriate, and adds visual cues and controls for the new tier throughout the settings panel. Additionally, it documents the required server-side changes for the Lite tier handoff.

Major changes include:

1. Lite Plan Tier Support and Documentation

  • Added .agents/PLAN_LITE_HANDOFF.md with a detailed spec for the Lite tier, including license format, Stripe integration, webhook handling, and server-side enforcement.

2. CLI User Interface Updates for Plan Tiers

  • Updated SettingsPanelPro in settings-panel-pro.tsx to support both Lite and Pro licenses, display the active tier, allow independent removal of each license, and provide upgrade buttons for both Lite and Pro. [1] [2] [3] [4]
  • Improved the upsell dialog in dialog-pro-upsell.tsx to optionally offer both Lite and Pro upgrade paths, with appropriate button logic and messaging based on the required tier. [1] [2]

3. UI Consistency and Enhancements

  • Added color attributes to agent modes in agent.ts for improved visual distinction. [1] [2] [3]
  • Enhanced RouteHeader in route-header.tsx to support an optional right-aligned element for greater layout flexibility. [1] [2]

- Plan module: tier ladder (free/lite/pro), TIER_RANK, two-slot license
  storage (FINNY-PRO- + FINNY-LITE-), hasAtLeast/requireTier helpers,
  PlanLimitError carrying { code, current, required, feature }.
- Forward-compatible BROKER_MIN_TIER map; live brokerage gate placed at
  live/runner.ts start() so paper trading bypasses entirely.
- Per-tier caps: backtests 5/10/∞ daily, strategy save 3/10/∞,
  simultaneous live runs 1/3/∞.
- runLive catches PlanLimitError and routes to DialogProUpsell instead
  of a generic alert.
- Sidebar shows FINNY LITE (#00cab4) / FINNY PRO (#5fa5fa); upgrade
  nav item hidden for Lite + Pro.
- Settings: "Pro" tab renamed to "Plan"; Model + Providers tabs removed.
- Settings panel: three-state Free/Lite/Pro UI with single license
  input that auto-routes by prefix.
- Upsell dialog: tier-aware (offers Lite when sufficient, escalates to
  Pro when Lite users hit a Pro-only feature).
- Portfolio: disclaimer moved into RouteHeader's right slot; accounts
  card sized to content.
- Distinct agent colors: build #f97316, research #a78bfa, chat #22c55e.
- Tests: 28 unit tests for tier helpers, license parsing, gating shape,
  and broker tier map.
- Off-repo handoff doc for finnyai.tech (Stripe Lite product, signing
  service for FINNY-LITE- codes, customer portal).

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Copilot AI review requested due to automatic review settings April 27, 2026 21:15
@Jaiminp007
Jaiminp007 merged commit 41e0b2e into dev Apr 27, 2026
2 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds full client-side support for a new Finny Lite plan tier (alongside Free and Pro), including license storage/validation, tier-based feature gating, and updated TUI upgrade/activation experiences. Also introduces a server-side handoff spec for implementing Lite in the finnyai.tech licensing/Stripe flow.

Changes:

  • Introduce tier model (free/lite/pro) with structured gating (getTier, requireTier, PlanLimitError) and per-broker minimum-tier enforcement.
  • Update TUI plan surfaces (settings panel, upsell dialog, sidebar branding) and apply tier-based caps for saves, backtests, and live runs.
  • Add Bun tests for tier ranking, license tier detection/storage behavior, and broker-tier gating; add server-side implementation handoff doc for Lite.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
packages/opencode/test/plan/plan.test.ts Adds coverage for tier ranking, tier detection, license slot behavior, PlanLimitError, and broker gating.
packages/opencode/src/tool/algorithm-save.ts Applies tier-based caps to saved algorithms (free=3, lite=10, pro=∞) with updated upgrade messaging.
packages/opencode/src/plan/index.ts Introduces tier system, dual license slots (lite/pro), tier detection, and structured gating via PlanLimitError.
packages/opencode/src/plan/brokers.ts Adds per-broker minimum tier map and requireBrokerTier helper.
packages/opencode/src/live/runner.ts Enforces tier-based simultaneous live run caps and broker-tier gating for live trading.
packages/opencode/src/cli/cmd/tui/routes/settings.tsx Renames “Pro” tab to “Plan” and updates settings header/subtitle.
packages/opencode/src/cli/cmd/tui/routes/portfolio.tsx Adds a right-aligned disclaimer panel in the header and adjusts layout of accounts card actions.
packages/opencode/src/cli/cmd/tui/routes/algorithms.tsx Updates live/backtest flows to use tier logic and show Lite/Pro-appropriate upsells and errors.
packages/opencode/src/cli/cmd/tui/component/sidebar-nav.tsx Displays active tier badge (LITE/PRO) and shows upgrade entry only for free tier.
packages/opencode/src/cli/cmd/tui/component/settings-panel-pro.tsx Reworks settings panel to support Lite+Pro activation/removal and tier ladder with upgrade CTAs.
packages/opencode/src/cli/cmd/tui/component/route-header.tsx Adds optional right slot for right-aligned header content.
packages/opencode/src/cli/cmd/tui/component/dialog-pro-upsell.tsx Supports Lite-or-Pro upsell mode depending on required tier; adds multi-button navigation.
packages/opencode/src/agent/agent.ts Adds color metadata to built-in agent modes for improved visual distinction.
.agents/PLAN_LITE_HANDOFF.md Documents expected Lite server-side Stripe + licensing changes and lifecycle behaviors.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +60 to +62
function prefixFor(tier: Exclude<Tier, "free">): string {
return tier === "pro" ? PRO_KEY_PREFIX : LITE_KEY_PREFIX
}

Copilot AI Apr 27, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prefixFor() is currently unused within this module, which adds dead code and can confuse future changes around prefix handling. Please remove it or start using it in the relevant places (e.g., detectTier / verifySignature call sites) to keep the implementation consistent.

Copilot uses AI. Check for mistakes.
Comment on lines 12 to 16
export type DialogProUpsellProps = {
message: string
requiredTier?: Plan.Tier
onClose?: () => void
}

Copilot AI Apr 27, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

requiredTier is typed as Plan.Tier, which includes "free", but this dialog only makes sense for paid gating (Lite/Pro). Consider changing the type to Exclude<Plan.Tier, "free"> (and same for DialogProUpsell.show(...)) so call sites can’t accidentally pass "free" and end up with confusing copy/button behavior.

Copilot uses AI. Check for mistakes.
Comment on lines +13 to +14
in `~/.opencode/auth.json` under provider id `finny-lite` (Pro stays in
`finny-pro`). Both can coexist; the CLI uses the highest-tier one.

Copilot AI Apr 27, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doc says the CLI stores auth data in ~/.opencode/auth.json, but the code writes to path.join(Global.Path.data, "auth.json") where Global.Path.data is xdgData/finny (commonly ~/.local/share/finny/auth.json on Linux). Please update the handoff doc to reference the XDG data dir (or Global.Path.data/auth.json) so server-side implementers aren’t misled.

Suggested change
in `~/.opencode/auth.json` under provider id `finny-lite` (Pro stays in
`finny-pro`). Both can coexist; the CLI uses the highest-tier one.
in `Global.Path.data/auth.json` (for example, `~/.local/share/finny/auth.json`
on Linux) under provider id `finny-lite` (Pro stays in `finny-pro`). Both
can coexist; the CLI uses the highest-tier one.

Copilot uses AI. Check for mistakes.
Comment on lines 17 to 23
const TABS: { id: SettingsTab; label: string }[] = [
{ id: "appearance", label: "Appearance" },
{ id: "model", label: "Model" },
{ id: "providers", label: "Providers" },
{ id: "paper-trading", label: "Paper Trading" },
{ id: "mcp", label: "MCP" },
{ id: "skills", label: "Skills" },
{ id: "pro", label: "Pro" },
{ id: "pro", label: "Plan" },
]

Copilot AI Apr 27, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SettingsTab still includes model, providers, and agents (and this file still has COPY + dialog wiring for them), but they were removed from the TABS array. This makes those settings panels unreachable from the Settings UI and leaves dead code paths in this component. Either re-add those tabs to TABS (and restore the subtitle accordingly) or remove the corresponding tab types / COPY / dialog routing if they’re intentionally being retired.

Copilot uses AI. Check for mistakes.
Comment on lines +104 to +106
/** Get the active license key for a given tier slot, masked for display. */
export async function getLicenseKey(tier: Exclude<Tier, "free"> = "pro"): Promise<string | null> {
return readSlot(tier)

Copilot AI Apr 27, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The JSDoc for getLicenseKey says it returns a key "masked for display", but the implementation returns the raw stored key. Either update the comment to reflect reality or change the function to return a masked value (and add a separate API for retrieving the raw key if needed).

Suggested change
/** Get the active license key for a given tier slot, masked for display. */
export async function getLicenseKey(tier: Exclude<Tier, "free"> = "pro"): Promise<string | null> {
return readSlot(tier)
/** Get the active raw license key for a given tier slot. */
export async function getRawLicenseKey(
tier: Exclude<Tier, "free"> = "pro",
): Promise<string | null> {
return readSlot(tier)
}
/** Get the active license key for a given tier slot, masked for display. */
export async function getLicenseKey(tier: Exclude<Tier, "free"> = "pro"): Promise<string | null> {
const key = await getRawLicenseKey(tier)
return key ? maskKey(key) : null

Copilot uses AI. Check for mistakes.
Jaiminp007 pushed a commit that referenced this pull request May 2, 2026
Fixes all 17 Copilot comments:

Telemetry opt-out (#1, #2, #3, #9, #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 (#5, #14, #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 (#10, #11, #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 (#4, #6, #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 (#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 (#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 (#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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants