Skip to content

feat: add Jev decisions to DebateLab - #60

Merged
Programcode merged 9 commits into
mainfrom
t3code/assess-jev-usage
Sep 21, 2026
Merged

Programcode merged 9 commits into
mainfrom
t3code/assess-jev-usage

Conversation

@Programcode

@Programcode Programcode commented Sep 21, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • add OpenRouter Jev decisions for Crossfire coaching signals, semantic source ranking/retention, and case source-use tracking
  • add Auto Fast for Basic and Pro users, normally routing to GLM 5.3 Flash, plus Pro-only Auto Pro for stronger models
  • rank the Sources menu by case use, importance, and strength with localized English, Spanish, and Hungarian labels
  • keep Crossfire replies independent of optional Jev work, with signed replay-bounded sidecars and complete usage accounting

Verification

  • npm run verify
    • 1,232 unit tests passed
    • 10 collaboration tests passed
    • 236 Edge tests passed
    • production build passed
    • 219 browser tests passed; 1 unrelated navigation timing test recovered as flaky; 2 intentional skips
  • live OpenRouter Jev smoke passed against typesafe/jev-1.13 (returned typesafe/jev-1.13-20260917, 330 input / 33 output tokens)
  • exact-head review approved with no Critical or Important findings

Notes

  • uses the existing OPENROUTER_API_KEY; no new secret or dependency
  • no database migration
  • merge is intentionally left to Adam

Summary by CodeRabbit

  • New Features

    • Added Auto Fast and Auto Pro model options with automatic routing and subscription-aware access.
    • Added live Crossfire coaching signals for answer quality, concessions, and follow-up opportunities.
    • Added semantic source assessments, including case usage, importance, relevance, and evidence strength.
    • Added Smart, usage, importance, and evidence-strength sorting to the source library.
    • Added localized support for English, Spanish, and Hungarian interfaces.
  • Documentation

    • Added guidance for the new model routing, source assessments, and Crossfire coaching features.

Copilot AI lite review requested due to automatic review settings September 21, 2026 18:03
@vercel

vercel Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
debate-navigator Ready Ready Preview Sep 21, 2026 6:03pm UTC

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

Review Change StackReview Change Stack

Understand this PR’s impact

Explore downstream dependencies and potential security impact with Blast Radius.

Preview blast radius → · Advanced feature

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Free

Run ID: 9455395c-605a-40fb-83cb-2172bfe7ece5

📥 Commits

Reviewing files that changed from the base of the PR and between 8a938e1 and 249648d.

📒 Files selected for processing (53)
  • docs/architecture.md
  • docs/superpowers/plans/2026-09-21-jev-decisions.md
  • docs/superpowers/specs/2026-09-21-jev-decisions-design.md
  • docs/testing.md
  • e2e/crossfire.spec.ts
  • package.json
  • scripts/smoke-jev.d.mts
  • scripts/smoke-jev.mjs
  • src/components/ModelSelector.tsx
  • src/components/features/shared/SourceQualityList.tsx
  • src/lib/ai/client.ts
  • src/lib/ai/providers/types.ts
  • src/lib/ai/schemas/generate.ts
  • src/lib/ai/streaming.ts
  • src/lib/crossfire/reducer.ts
  • src/lib/crossfire/schemas.ts
  • src/lib/stores/session-store.ts
  • src/lib/stores/settings-store.ts
  • src/locales/en.json
  • src/locales/es.json
  • src/locales/hu.json
  • src/pages/CrossfirePage.tsx
  • src/pages/LibraryPage.tsx
  • src/test/ai/client-analytics.test.ts
  • src/test/ai/client-branches.test.ts
  • src/test/ai/crossfire-client.test.ts
  • src/test/ai/streaming-integration.test.ts
  • src/test/components/ModelSelector.test.tsx
  • src/test/components/SourceQualityList.test.tsx
  • src/test/crossfire/reducer.test.ts
  • src/test/crossfire/schemas.test.ts
  • src/test/crossfire/storage.test.ts
  • src/test/pages/CrossfirePage.test.tsx
  • src/test/pages/LibraryPage.test.tsx
  • src/test/scripts/smoke-jev.test.ts
  • src/test/security-hardening.test.ts
  • src/test/session-store.test.ts
  • src/test/settings-store.test.ts
  • supabase/README.md
  • supabase/functions/_shared/auto-model-router.test.ts
  • supabase/functions/_shared/auto-model-router.ts
  • supabase/functions/_shared/crossfire-signals.test.ts
  • supabase/functions/_shared/crossfire-signals.ts
  • supabase/functions/_shared/jev.test.ts
  • supabase/functions/_shared/jev.ts
  • supabase/functions/_shared/model-catalog.ts
  • supabase/functions/_shared/research.ts
  • supabase/functions/_shared/source-decisions.test.ts
  • supabase/functions/_shared/source-decisions.ts
  • supabase/functions/ai-stream/handler_test.ts
  • supabase/functions/ai-stream/index.ts
  • supabase/functions/ai/handler-research.test.ts
  • supabase/functions/ai/index.ts

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

Changes

The pull request integrates TypeSafe Jev through OpenRouter for automatic model routing, semantic source decisions, and Crossfire coaching signals. It adds validation, usage tracking, persistence, UI updates, localized text, tests, and a live smoke command.

Jev client and routing

Layer / File(s) Summary
Shared Jev client and contracts
supabase/functions/_shared/jev.ts, supabase/functions/_shared/model-catalog.ts, supabase/functions/_shared/jev.test.ts
Adds typed Jev requests and responses, strict validation, bounded response handling, timeout and abort support, and normalized usage data.
Automatic model routing
supabase/functions/_shared/auto-model-router.ts, supabase/functions/ai/index.ts, supabase/functions/ai-stream/index.ts, src/components/ModelSelector.tsx
Adds auto-fast and auto-pro, resolves them to concrete models through Jev, preserves requested and resolved model metadata, and applies entitlement and fallback rules. Tests cover routing, streaming, persistence, and access control.

Semantic source decisions

Layer / File(s) Summary
Source assessment and persistence
supabase/functions/_shared/source-decisions.ts, supabase/functions/ai/index.ts, src/lib/stores/session-store.ts, src/lib/ai/client.ts
Adds bounded source ranking, case-use classification, semantic metadata validation, assessment persistence, provenance preservation, and weak-source retention rules.
Source library presentation
src/pages/LibraryPage.tsx, src/components/features/shared/SourceQualityList.tsx, src/locales/*.json
Adds semantic badges, Smart and metadata-based sorting, source detail fields, and localized source-quality labels.

Crossfire signals

Layer / File(s) Summary
Signal evaluation and attachment
supabase/functions/_shared/crossfire-signals.ts, supabase/functions/ai/index.ts, src/lib/crossfire/schemas.ts, src/lib/crossfire/reducer.ts
Adds signed signal tokens, newest-exchange evaluation, Jev-backed answer signals, validation, replay prevention, and reducer attachment to answer turns.
Asynchronous Crossfire UI
src/pages/CrossfirePage.tsx, src/lib/ai/client.ts, e2e/crossfire.spec.ts, src/locales/*.json
Requests signals after the main answer, aborts obsolete requests, renders quality and follow-up badges, and covers retry and delayed-signal behavior.

Smoke verification and documentation

Layer / File(s) Summary
Live Jev smoke command
scripts/smoke-jev.mjs, scripts/smoke-jev.d.mts, package.json, src/test/scripts/smoke-jev.test.ts
Adds a credentialed smoke command that sends a fixed typed request, validates the response, limits output, and reports latency and normalized usage.
Architecture and verification documentation
docs/architecture.md, docs/testing.md, supabase/README.md, docs/superpowers/*
Documents the Jev client, routing, source decisions, Crossfire sidecar flow, smoke verification, constraints, and release checks.

Estimated code review effort: 5 (Critical) | ~120 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant AIEndpoint
  participant JevClient
  participant OpenRouter
  participant SessionStore
  Client->>AIEndpoint: send model, sources, or Crossfire request
  AIEndpoint->>JevClient: evaluate bounded decision
  JevClient->>OpenRouter: POST typed Jev request
  OpenRouter-->>JevClient: return validated decision and usage
  JevClient-->>AIEndpoint: return decision
  AIEndpoint->>SessionStore: persist metadata or signal state
  AIEndpoint-->>Client: return response and metadata
Loading

Note

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Essentials by visiting https://app.coderabbit.ai/settings/billing.

Comment @coderabbitai help to get the list of available commands.

@Programcode

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@Programcode

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@Programcode
Programcode merged commit f49bc6c into main Sep 21, 2026
11 checks passed
@Programcode
Programcode deleted the t3code/assess-jev-usage branch September 21, 2026 18:49

This branch was successfully deployed

1 active deployment
Preview — 249648dd Deployed Sep 21, 2026 by vercel[bot]
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