Commit Graph
3 Commits
Author SHA1 Message Date
CatoandClaude Fable 5.1 7be4d2dd1e feat(chat): the answer feedback loop — thumbs, transcript export, nightly review (#1398)
* feat(chat): the answer feedback loop — thumbs, transcript export, nightly review

Under every Cat answer, chatkit 0.14's thumb up and thumb down (one shape in
every fleet product): a thumb down asks why in one tap and takes a few words,
and the app posts it to POST /api/chat/feedback, stored in the new
chat_feedback table beside the conversation (RLS: insert by the owner, no
read through the API keys). A thumb on an answer still on screen resolves to
the conversation's newest stored answer, since the thread never learns the
row id of a live turn.

GET /api/chat/review-export serves the day's conversations to the fleet's
nightly reviewer (Loki) as chatkit's ChatTranscript[]: bearer
CHAT_REVIEW_TOKEN compared in constant time (401 wrong, 503 unset), never a
temporary chat, newest first, at most 50, 30 turns each, 4000 chars a turn,
the tool steps Cat took, a failed flag on a turn that died, and the thumbs —
with no name, email, user or actor id. The scope sentence is derived from
Cat's own system prompt and tool list, never typed twice.

- @bitbaum/chatkit ^0.14.0
- .env.example names CHAT_REVIEW_TOKEN; docs/reference/api/chat.md has the loop
- the export's bare {product, scope, transcripts} is a fleet wire format, so
  the envelope lint rule carves it out like LNURL
- unit tests for the token check, the export shape and the feedback schema

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

* chore(deps): next 16.4.2 — the audit's critical and high advisories

The dependency audit failed on this PR's head with two Next.js advisories
(>=16.0.0 <=16.4.0: unauthenticated RCE, App Router DoS), published after
main last went green. Not this PR's change; the fix is upstream, so it
rides here. `pnpm audit --audit-level=high --prod` is clean again.

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-23 14:19:26 +02:00
2e897c5bfc fix Cat Credits metering and refresh AI model registry (#395)
* fix(cat): meter Cat Credits from OpenRouter's real usage.cost

Prefer OpenRouter's provider-reported per-request cost (usage.cost, USD→BTC)
for Cat Credits debits, falling back to the registry token-price estimate when
the field is absent. Ledger metadata now records pricingSource
(provider_reported | registry_estimate). Free models always meter to 0.

Pinned by regression tests for the metering preference and the OpenRouter cost
plumbing (buffered + streamed), guarding the prior "$0 for unknown model" leak.

Co-authored-by: Cursor <cursoragent@cursor.com>

* chore(ai): refresh 2026 model roster and consolidate registry SSOT

Update AI_MODEL_REGISTRY to the Q1-2026-verified roster and pricing (free,
economy, standard, premium tiers), with boundary-safe resolution of
provider-returned snapshot ids. model-registry.ts is now a generated projection
of ai-models.ts rather than a drifted duplicate list.

Refresh docs to match reality: rewrite MODEL_SYSTEM.md (provider chain,
Cat Credits metering, current roster) and chat.md (authenticated /api/cat/chat
contract), retiring references to the removed UnifiedAIClient/ModelStatusBadge
and public /api/chat endpoint. Mark completed items in the research handoff.

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Georgy Butaev <41178744+g-but@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-08 22:02:03 +02:00
Georgy ButaevandClaude Opus 4.8 ae55dc1f80 docs: consolidate taxonomy from ~40 dirs into ~13 coherent areas
The docs tree had sprawled into ~40 overlapping/singleton/empty directories.
Consolidated (history preserved via git rename detection; links rewritten so
no previously-working link broke):

- architecture/ ← adr/, database/, + loose *_ARCHITECTURE / my-cat specs
- development/  ← standards, contributing, guides, examples, templates, components, ai
- operations/   ← devops (+runbooks), deployment, supabase
- design-system/← design, UX, ux-improvements, branding
- reference/    ← api, changelog, content, misc
- forward-looking/ ← planning, improvements, implementation
- archive/2026-h1/ ← point-in-time reports/plans that were loose at docs/ root
- removed empty docs/analysis/; rewrote docs/README.md as a current index

Verified: non-README relative-link health 81→83 OK (0 regressions, same 64
pre-existing-rot broken); all new README links resolve; external refs in
.claude/ + root repointed to moved targets.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-15 11:34:28 +02:00