Skip to content

WebMCP tools, in-app Claude assistant, and seed-queue navigation - #3

Merged
OptimusPi merged 5 commits into
masterfrom
claude/epic-faraday-k57dgs
Sep 12, 2026
Merged

OptimusPi merged 5 commits into
masterfrom
claude/epic-faraday-k57dgs

Conversation

@OptimusPi

Copy link
Copy Markdown
Owner

What this adds

WebMCP. Blueprint registers its analysis and UI actions as tools on document.modelContext (spec entry point as of Chrome 150; @mcp-b/webmcp-polyfill makes it exist elsewhere). Browser agents, the Chrome DevTools WebMCP pane, and the Model Context Tool Inspector extension can call them directly:

get_app_state, analyze_seed, get_seed_overview, get_ante_details, find_items, go_to_ante, buy_item, list_purchases, clear_purchases, load_seed_list, step_seed_queue, set_view, set_options, get_jaml_filter, set_jaml_filter, remember.

The registry (src/modules/webmcp/registry.ts) is the single source of truth; tools.ts drives the zustand store and the seed analyzer, summary.ts turns SeedResultsContainer into compact per-ante JSON.

Assistant chat. A chat button in the header opens a drawer backed by @anthropic-ai/sdk running in the browser (user-supplied key, stored in localStorage, sent only to api.anthropic.com). It uses the beta tool runner over the same registry, streams text, shows each tool call, persists the transcript, and injects per-user remember notes plus a Balatro/JAML knowledge base into a cached system prompt. Model is selectable (Opus 5 default); server-side refusal fallbacks are enabled.

Seed lists. Paste any number of seeds into the sidebar (lines, commas, spaces, or CSV first column). ArrowLeft/ArrowRight step, Home/End jump; neighbouring seeds are pre-analyzed so switching is instant. Position pill in the header.

Fixes found on the way

  • The analyzer reads settings.antes, but the provider passed engineState (which has maxAnte), so every seed generated only ante 1. Now passes antes: maxAnte. The Max Ante input was wired to selectedAnte; it now sets engineState.maxAnte.
  • SeedExplorer was rendered twice in Main, duplicating the ante tabs.

Verification

  • npx vitest run: 583 passed, 2 failed. The 2 failures (ante-null.spec, spoiler_peek.spec) fail identically on master before this change.
  • npx tsc --noEmit: no errors in touched files (the repo has pre-existing errors elsewhere).
  • npx eslint on touched files: clean.
  • npx vite build: succeeds.
  • Playwright against the built app: ante tabs 0–8 after analyze (was 0–1, duplicated); document.modelContext.getTools() lists 16 tools and executeTool round-trips analyze_seed → find_items → buy_item → list_purchases → set_jaml_filter; seed list load + ArrowRight/End change the analyzed seed; assistant drawer opens with no console errors.

🤖 Generated with Claude Code

https://claude.ai/code/session_015DENTKJvFr15paqJHa7vMx


Generated by Claude Code

Blueprint now exposes its seed analysis and UI actions as tools on
document.modelContext (WebMCP, with the @mcp-b/webmcp-polyfill fallback):
analyze_seed, get_seed_overview, get_ante_details, find_items, go_to_ante,
buy_item, list/clear_purchases, load_seed_list, step_seed_queue, set_view,
set_options, get/set_jaml_filter and remember. The same registry powers a
new chat drawer (header button) that talks to the Anthropic API from the
browser with a user-supplied key, streams replies, shows tool calls, keeps
a persisted transcript and per-user notes, and carries a Balatro/JAML
knowledge system prompt.

Seed lists: paste any number of seeds into the sidebar (lines, commas, or
CSV first column) and step through them with ArrowLeft/ArrowRight and
Home/End; neighbouring seeds are pre-analyzed.

Fixes: the analyzer never received the ante count after the maxAnte rename
so only ante 1 was generated; the Max Ante input now drives engineState;
SeedExplorer was mounted twice, duplicating the ante tabs.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DENTKJvFr15paqJHa7vMx

Copy link
Copy Markdown
Owner Author

CI: the deploy check is red for a reason outside this PR.

The job in run 34715531711 completed in 2 seconds with no runner assigned and no steps executed (job runner_id: 0, empty check output), so npm ci / npm run build never ran. That is the signature of the github-pages environment protection rule rejecting a deployment from a non-master branch. The same workflow fails identically on every pull_request run in the repo's history (runs 46, 47, 48, 50 on PR #2, all 2-second failures) and passes on every push to master.

Locally on this head: npx vite build succeeds, npx vitest run is 583 passed / 2 failed (both failures pre-exist on master), and eslint/tsc are clean on the touched files.

No fix for this exists in the repo yet. Proposed patch for .github/workflows/main.yml so PRs get a real build check while only master pushes deploy (not included here to keep this PR to its feature scope):

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with: { node-version: 20, cache: npm }
      - run: npm ci
      - run: npm run build
        env: { BASE_PATH: /Blueprint/ }
      - uses: actions/upload-pages-artifact@v3
        with: { path: ./dist }

  deploy:
    if: github.event_name != 'pull_request'
    needs: build
    environment:
      name: github-pages
      url: ${{ steps.deployment.outputs.page_url }}
    runs-on: ubuntu-latest
    steps:
      - uses: actions/configure-pages@v4
      - id: deployment
        uses: actions/deploy-pages@v4

I'm re-running the job once to confirm it is deterministic, and will keep watching the PR.


Generated by Claude Code

@greptile-apps

greptile-apps Bot commented Sep 12, 2026 •

Copy link
Copy Markdown

Greptile Summary

Adds browser-accessible WebMCP tools, an Anthropic-powered in-app assistant, seed-queue navigation and prefetching, and supporting state and analysis utilities. The latest revision associates JAML search statistics with the filter that produced them, preventing edited filters from displaying stale measured rarity data.

  • Registers analysis and UI actions through a shared WebMCP tool registry.
  • Adds a persistent assistant drawer that invokes the same tools.
  • Adds seed-list parsing, navigation controls, keyboard shortcuts, and neighboring-seed prefetching.
  • Corrects max-ante propagation and duplicate seed-explorer rendering.
  • Resolves the prior JAML rarity issue by using measured statistics only when the current filter matches the searched filter.

Confidence Score: 5/5

The PR appears safe to merge; the latest changes fully address the remaining stale JAML rarity finding, and no new actionable failures were identified.

The JAML Calculus panel now uses measured hit statistics only when searchedJaml matches the current filter and otherwise falls back to the edited filter’s estimate. All earlier findings are resolved, and no blocking repository-rule or correctness issue remains.

Important Files Changed

Filename Overview
src/components/blueprint/jamlView/JamlView.tsx Tracks the JAML filter used for each search and avoids applying stale measured statistics after the filter is edited.
src/modules/webmcp/tools.ts Implements shared read and mutation tools over application state and seed analysis.
src/modules/state/analysisResultProvider.tsx Centralizes cached analysis and constructs seed-specific options for out-of-band analysis and queue prefetching.
src/components/AssistantDrawer.tsx Adds persistent streaming assistant chat backed by the shared tool registry.
src/components/SeedQueue.tsx Adds seed-list controls, global navigation hotkeys, and neighboring-seed prefetching.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
    User[User or browser agent] --> Assistant[Assistant drawer]
    User --> WebMCP[document.modelContext]
    Assistant --> Registry[Shared tool registry]
    WebMCP --> Registry
    Registry --> Store[Zustand application state]
    Registry --> Analyzer[Seed analyzer and result cache]
    Queue[Seed queue navigation] --> Store
    Queue --> Analyzer
    Analyzer --> Results[Seed and ante summaries]
Loading

Reviews (4): Last reviewed commit: "Calculus panel: only treat hits as measu..." | Re-trigger Greptile

Comment thread src/modules/webmcp/tools.ts
Comment thread src/modules/webmcp/summary.ts Outdated
Comment thread src/modules/state/store.ts Outdated
Comment thread src/modules/webmcp/register.ts Outdated
Comment thread src/components/AssistantDrawer.tsx
Comment thread src/components/SeedQueue.tsx
- Out-of-band reads (get_seed_overview/get_ante_details/find_items with a
  seed other than the loaded one) and queue prefetches now analyze with
  empty purchases and that seed's own starting deck, so the loaded seed's
  buys no longer alter their RNG and prefetch keys match what the store
  holds after a jump. setSeed/setDeck share the same startingDeckCards.
- Summaries and item searches include ante 0.
- Seed lists: comma/semicolon/tab separated seeds on one line are all
  kept; only all-numeric trailing fields are treated as CSV tally columns,
  and a "seed" header row is skipped.
- WebMCP annotations mark every non-read-only tool consequential.
- The assistant drops an empty pending bubble when a request is stopped
  or fails before any output.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DENTKJvFr15paqJHa7vMx
Rarity is hits ÷ seeds checked once a search has hits, otherwise jaml-ui's
filter estimate (labelled ±10x). From p: expected wait 1/p, coin-flip
point ln 2/p, 95% point ln 20/p, each with an ETA at the measured rig
speed via estimateEtaSeconds/formatEta.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DENTKJvFr15paqJHa7vMx
Comment thread src/components/blueprint/jamlView/JamlView.tsx
…earched

Editing the JAML after a search falls back to the estimate for the edited
filter and says the retained stats belong to the previous one.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DENTKJvFr15paqJHa7vMx
@OptimusPi
OptimusPi merged commit fb25401 into master Sep 12, 2026
1 of 2 checks passed
@OptimusPi
OptimusPi deleted the claude/epic-faraday-k57dgs branch September 12, 2026 20:45

This branch had an error being deployed

1 failed deployment
github-pages — a64e80c0 Deployed Sep 12, 2026 by OptimusPi via deploy #56
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