mirror of
https://github.com/bitbaum/substrata.git
synced 2026-12-04 05:47:59 +01:00
Every code file the size ratchet grandfathered is now under its 300-line
ceiling, split by what it does rather than by line count:
- lib/search.ts -> entry + lib/search/{text,corpus,build,expand,score,snippets}
- lib/chat-tools.ts -> lib/chat-tools/ (one module per tool family + registry)
- lib/chat-agent.ts -> lib/chat-agent/{loop,parse,turn,prompt,stream-gate}
- lib/chat.ts -> lib/chat/{types,retrieve,models,answer}
- ResearchChat.tsx -> components/portal/chat/ (thread, turn, composer,
BYOK panel, contribute form, hooks)
- SearchBox.tsx -> components/portal/search/ (popover, page form, shared)
- profile modules, lib/bottlenecks.ts, lib/participants.ts -> build/board
and module-family files beside them
- app/page.tsx, app/markets/[slug]/page.tsx, app/policy/page.tsx -> section
components in private _home/_sections folders
globals.css (2379 -> 664 lines) keeps tokens, base and site chrome; the
feature blocks moved to app/styles/*.css, imported from the root layout in
the order they had inside globals.css so the cascade is unchanged.
Screenshots of /, /search?q=asml, /markets/asml, the EUV bottleneck, /chat,
/notes, /atlas, /policy and /talent at 390/820/1440px are pixel-identical
to main.
The config/ corpus files stay grandfathered as data; the logic that was in
them moved to lib/ (coverage-progress.ts, participants.ts, geo.ts).
Also: the desk's "Open on" select said "Last all time"; and
INFRASTRUCTURE.md now records the hourly :17 sweep timer, the everyHours
setting that decides whether a run is due, and that 005-desk.sql is applied.
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
30 lines
1.1 KiB
TypeScript
30 lines
1.1 KiB
TypeScript
/** The free models this deployment offers, and the gate that honours only those. */
|
|
import { freeChain, usableChain } from '@bitbaum/ai-kit';
|
|
|
|
export function availableModels() {
|
|
const chain = usableChain(freeChain('SUBSTRATA'), process.env);
|
|
return [
|
|
{ id: 'auto', label: 'Auto' },
|
|
...chain.map((link) => ({
|
|
id: link.model,
|
|
label: `${link.provider.id} · ${link.model}`,
|
|
})),
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Whether a model id is one this deployment actually offers.
|
|
*
|
|
* The caller supplies this string, and ai-kit treats a model it does not find
|
|
* in the chain as an instruction rather than a typo: `chainFrom()` PREPENDS it,
|
|
* so an unrecognised id is the first thing tried, against our key. The free
|
|
* chain is free only because every id in it is; `anthropic/claude-opus-4` sent
|
|
* to the same OpenRouter key is a paid call we would be billed for.
|
|
*
|
|
* So an id is honoured only when it is already in the chain we built.
|
|
*/
|
|
export function isOfferedModel(model: string): boolean {
|
|
if (model === 'auto') return true;
|
|
return usableChain(freeChain('SUBSTRATA'), process.env).some((link) => link.model === model);
|
|
}
|