Repository navigation
feat(chat): answer Chat's model menu with each model's multiplier and tone, never a price (W4-01) - #2030
Merged
Conversation
…3-DB, 00457–00459) Chat's Wave 3 tables in one PR (one DB PR per wave), behind CHAT_AGENTIC: nothing reads or writes them while the flag is off. Tables, types, tests and the demo's coverage only; the code that uses them comes in W3-01, W3-06 and W3-11. Every new table has row level security on; members only ever read, anon gets nothing, and every write is the server's. - 00457: chat_schedules (CHAT-12): once, recurring or a follow-up check; run at / ready by, due and next run, the RRULE and time zone; title, prompt or skill, the brand fixed at creation, the creator it acts as and its own chat; delivery to chat and/or email, recipients only people of the workspace (a trigger checks), change-only with the last fingerprint; mode, model, effort; on/off with the reason, failures in a row, the one retry; a follow-up check's target, metric and who set it (card or full_auto, the latter only for follow-up checks). A job whose brand or creator is deleted turns off (missing_source, owner_role) instead of running on without them. chat_schedule_runs: slot and attempt (unique, so a slot never runs twice), Run now, the Chat run and answer, status, parts done, fingerprint, usage as a share, email outcome. chat_conversations.schedule_id with origin 'schedule' (one live chat per job; it stays the creator's), prompt_improve_usage.schedule_id, and reserve_chat_ai_usage taking p_schedule_id (default null, old calls still match): the row is named by the chat's job, a job that isn't the chat's is refused. Creator and Admins read a job, within their brands. - 00458: chat_skills (CHAT-13): name unique in the workspace in the format's rules, body up to 50 KB, licenses MIT, Apache-2.0, BSD-2-Clause, BSD-3-Clause, ISC (an import needs one), source user or import with the pinned commit and checksum, scan and removed parts, review status (only an approved skill can be on), private or workspace. Private or unapproved: creator and Admins; approved workspace skills: every member. chat_settings.disabled_skills for library skills. - 00459: chat_memory_items (CHAT-14): Me, brand and workspace lines, 1–300 characters, at most 4,000 a scope (a trigger under a lock per scope, deleted lines left out), one profile line a person, deleted_at for Undo; brand lines go with the brand, Me lines with the account and when the person leaves the workspace (trigger on profiles). Me: only its person; brand lines: brand access; workspace lines: every member. chat_settings.memory_enabled and chat_user_prefs.memory_enabled, both on. web/src/types/supabase.ts carries the new tables and columns; schema.test.ts checks the Wave 3 policies, limits, vocabularies, triggers and the hold's signature from the SQL; brand-access-policies.test.js lists the new tables; the demo coverage skips chat_schedules and chat_memory_items. Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts: # server/src/lib/brand-access-policies.test.js # web/src/types/supabase.ts
…brary, agent calls and outside e-mails (W4-DB, 00462–00467) - 00462: the price catalog's supported_parameters and context_length, and prompt_improve_usage.units for image rows. - 00463: content_drafts.origin and conversation_id; drafts with an action become action_center without touching updated_at; a member may say editor or chat and name only a chat of their own. - 00464: chat_whats_new_reads, a person's own rows. - 00465: chat_skills source library, library_ref and update_checked_at; 00458's unnamed pin rule named and widened. - 00466: chat_agent_versions.can_call and agent-called runs, one level deep, at most 3 a run. - 00467: chat_schedules.external_recipients and chat_outbound_emails, each sent only with a click. Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts: # server/src/lib/brand-access-policies.test.js # supabase/schema.sql # web/src/lib/chat/schema.test.ts # web/src/types/supabase.ts
… tone, never a price (W4-01) - The daily price sync keeps each model's supported parameters and context length (00462). - The API server answers GET /api/internal/chat/models with the offered models' multiplier labels, a tone (green under 1x, amber from 3x), whether the price moves by the hour, whether the catalog dropped a model, the count of chat models that can call tools and the last sync. CRON_SECRET only, not counted by the per-IP limiter. - The web offers Claude's three tested models (lib/chat/models.ts, Wave 4 decision 1 B) and answers GET /api/chat/models, with "Your key" on the own key's models; it still lists them when the API server doesn't answer. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…un, Opus 5.5 hidden for now (W4-01) Each model Chat may run is listed with `tested`; only tested ones are offered in the menu, asked of the price catalog, or accepted by the engine, and a chat or agent that picked one not tested runs Auto. At launch that is Haiku 5.5 and Sonnet 5.5; Opus 5.5 waits for its run of the test set (owner, 2026-11-02). Co-Authored-By: Claude Opus 5.5 <[email protected]>
…their own mounts (W4-01) Co-Authored-By: Claude Opus 5.5 <[email protected]>
8 of 13 tasks
…ature/chat-model-catalog Co-Authored-By: Claude Opus 5.5 <[email protected]>
…talog, keeping the branch's tree The squash's tree equals feature/chat-wave4-db's final head, merged just before. Co-Authored-By: Claude Opus 5.5 <[email protected]>
gkhngyk
approved these changes
Nov 3, 2026
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
The data behind Chat's model menu (CHAT-16 §A–B, Wave 4 plan W4-01). The menu itself comes in W4-02 and the engine running the pick in W4-03; all three merge together. Nothing in the app reads this yet.
API server
The daily price sync (
model-prices.js) also keeps each model'ssupported_parametersandcontext_length(00462, in feat(db): add Chat Wave 4's tables for models, drafts, What's new, Library, agent calls and outside e-mails (W4-DB, 00462–00467) #2006).New
lib/model-menu.js. For the models the web offers it returns:2.3x,<0.1x);lowunder 1x (green),highfrom 3x (amber);It also returns the count of chat models that can call tools (text in and out,
tools, not:batch) and the last sync.qsearches that catalog, for when the menu opens to more models (decision 1 C); the web doesn't use it yet. No price is ever returned.GET /api/internal/chat/models?ids=&selected=&q=: CRON_SECRET with a constant-time compare, Zod-checked query, at most 20 ids. Like the budget calls, it isn't counted by the per-IP limiter.Web
lib/chat/models.ts: the models Chat may run, each withtested. Only tested ones are offered in the menu, asked of the catalog or run by the engine, and a pick of one not tested runs Auto. At launch that is Claude Haiku 5.5 and Sonnet 5.5, which Auto already runs; Opus 5.5 is listed withtested: falseuntil a real run of Chat's test set passes (Wave 4 decision 1 B; owner, 2026-11-02). Each has its catalog id and API id.lib/chat/model-menu.tsandGET /api/chat/models?selected=: the menu for the signed-in person's workspace, with Your key on the models the workspace's own key runs (ownChatKeyProviderinkey.ts, the rulechatRunsOnOwnKeyalready used). When the API server doesn't answer, the offered models still show, without multipliers. 404 while Chat is off.Stacked on #2006 (W4-DB). Merged in, not rebased.
Related issue
None. Chat Wave 4 plan, W4-01.
Type of change
feat— New featurefix— Bug fixchore— Maintenance / dependenciesdocs— Documentation onlyrefactor— Code change that neither fixes a bug nor adds a featuretest— Adding or updating testsHow to test
cd server && npx vitest run src/lib/model-menu.test.js src/routes/internal-chat-models.test.js src/lib/model-prices.test.js src/middleware/rate-limiter.test.jscd web && yarn vitest run src/lib/chat/model-menu.test.ts src/app/api/chat/models src/lib/chat/key.test.tsGET /api/chat/models(signed in) answers Auto at 1x and Haiku 5.5 and Sonnet 5.5 with their labels; no Opus 5.5. There are no dollar figures in the body.Needs migration on prod: 00462 (in #2006), before the API server deploys. Until then the sync's upsert fails on the new columns and keeps the last prices.
No new environment variables.
Checklist
yarn lintpassesyarn typecheckpassesyarn format:checkpasseshelp/(or no user-visible change)CI passed on this branch (291fbef), run on the fork (https://github.com/cihan-gyk/ansvisor/actions/runs/41525027721): schema is up to date; web
format:check, lint, typecheck, all tests andyarn buildpass; server lint,format:checkand all tests pass.🤖 Generated with Claude Code