11 Commits
Author SHA1 Message Date
CatoandClaude Fable 5.1 bade0a1b8e chore: rename FleetCrown to Loki (#197)
The product was renamed on 2026-09-14: bitbaum/loki, loki.orangecat.ch,
LOKI_* env keys, loki-* units. This repo referenced the old name in
15 files changed, 29 insertions(+), 29 deletions(-).
Email addresses at the old sending domain stay until the new domain is
verified in Resend.


Claude-Session: https://claude.ai/code/session_016YJVAanfj8keVSXyZnTemh

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-13 16:23:24 -07:00
93d6ed067b fix(db): our tables are not in orangecat's schema — tell every client (#138)
/api/health has returned 503 because `public.consultations` does not exist. It
never did. Botsmann shares one self-hosted Supabase database with orangecat,
which owns `public` and its 128 tables; ours were nowhere, because all eleven
migrations were unapplied.

The schema half is fixed in the deploy pipeline (fleetcrown#398): botsmann now
declares `supabase:botsmann` and its migrations apply into a schema of its own,
exactly as printcraft's do. That has run — all 11 tags are recorded and the 12
tables exist.

This is the other half. A Supabase client that is not told the schema queries
`public`, so it would still get PGRST205. Measured against production just now:

  GET /rest/v1/consultations                      -> 404 PGRST205
  GET /rest/v1/consultations  Accept-Profile: botsmann -> 200 []

`db: { schema }` is what sends that header, and it was missing from all four
client factories — anon, service-role, browser and route-handler.

The schema name is one constant in lib/constants.ts, not four literals. The
second copy is how the first goes stale, and this repo has just spent a day
proving what duplicated configuration costs.

Two things this also removes:

  * `scripts/run-migration.ts` and `scripts/migrate-via-api.ts` applied SQL
    through the service-role client with no schema set. They are from the era
    when migrations were run by hand; now they would create our tables inside
    orangecat's `public`. Schema is the pipeline's job, and a second way to do
    it is a second way to do it wrong. Nothing references them.
  * The bare `SupabaseClient` type hardcodes `'public'`, so annotating with it
    silently asserts we query orangecat's tables — and rejects the client we
    actually build. The type is now derived from the factory, which keeps the
    two in step and survives supabase-js reordering its generics.

New test pins it per file, by count: every `createClient` call in a client file
must set the schema, from the shared constant, with comments stripped first so
the guard cannot be fooled by prose. Adding a fifth unscoped factory fails the
test instead of production. Mutation-checked: unscoping the browser client
fails it.

verify green: 237 tests, lint, typecheck, build.


Claude-Session: https://claude.ai/code/session_01HVwg8DKHQktxJuHeLM3xpG

Co-authored-by: Mao Nakamoto <41178744+maonakamoto@users.noreply.github.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-27 19:57:39 +00:00
GandClaude Opus 5 198e54d38d fix(llm): take model ids from ai-kit, and try more than one (#137)
Both ids in `API_CONFIG` have been retired by their vendors:
`llama-3.1-8b-instant` at Groq and `openai/gpt-oss-20b:free` at OpenRouter. With
a valid key, this app's chatbot was answering 404.

Nothing was neglected here. The constant carried the correct instruction —
"free catalogues rot; when it does, replace it with another `:free` id" — and
that is precisely the maintenance that did not happen, because nothing tells a
constant when it has stopped being true. So the ids leave this repo. `ai-kit`
holds one list for the fleet, re-probes it against the live catalogues, and
dotfiles' daily audit asks both vendors whether those ids still exist.

One id was also not enough on its own. `generateWithBestProvider` picks ONE
provider and calls it exactly once, so a retirement had nothing between it and
a dead chatbot. Each vendor's call now walks that vendor's list: a 404 (retired)
or a 429 (busy or spent) steps to the next model instead of surfacing.

This is model-level fallback, not vendor-level — provider selection is untouched.
That is the smaller half of the protection, since a spent daily budget is
org-wide and kills every model at a vendor together. It is also the half that
covers rot, which is what actually happened here, twice.

An explicit caller override is still honoured as-is and alone. If someone names
a model, quietly answering from a different one is worse than failing.

The cost rule that lived in the deleted comment survives, and got stronger.
`free-fallback.test.ts` used to regex ONE constant; it now runs `modelCost` over
every OpenRouter id this app could send, using the same function the rest of the
fleet prices models with. OpenRouter is only reached when Groq's free tier is
spent — when nobody is watching — so a paid id there turns an outage into a bill.

The old tests deserve a note, because they passed throughout the outage: they
mocked `llama-3.1-8b-instant` and asserted it back, agreeing with production
about an id production was refusing. Worse, the OpenRouter test asserted
`anthropic/claude-sonnet-5` — a paid model on the free-tier fallback path, the
exact thing the fleet rule forbids, green the whole time. They now assert
against the chain, plus two new cases: a retired first model falls through to a
different one, and exhausting the list names the whole list.

`jest.config.js` transforms `ai-kit`, which is ESM-only. The comment there says
what does NOT belong in that list, since a transitive entry would mean a package
leaking a dependency through a re-export — a bug to fix at the source.

verify: format, lint, typecheck, 232 tests, build.

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-26 22:07:23 +00:00
G 7a4d2f20d1 fix(ai): the OpenRouter fallback was a premium paid model (#135)
OPENROUTER_DEFAULT_MODEL was `anthropic/claude-sonnet-5`. OpenRouter is the
FALLBACK here — it is reached when Groq's free tier is spent — so the failure
mode of 'the free tier ran out' was not a degraded answer or an honest refusal.
It was a bill, on a premium model, produced by the one code path nobody watches
because it only runs when something else has already broken.

A fallback is a reliability mechanism; paying is a business decision. Wiring the
second to the first lets an outage make the decision at the worst moment,
without anyone choosing it. It also broke the standing fleet rule that Anthropic
is never a primary or fallback provider.

Now `openai/gpt-oss-20b:free`, which reports pricing.prompt = 0 in OpenRouter's
own catalogue (checked 2026-08-16) and was probed live for tool support on
2026-08-15.

Guarded by a test, because this path is invisible in normal operation: the
default must end in `:free` and must never be an Anthropic id. The rule mirrors
`modelCost` in the shared ai-ration package — a routed id is free ONLY with the
`:free` suffix, which is the entire difference between free routing and a
per-call charge for identical weights.

The same mistake was found in three apps on the same day (also kivvi and evig).
2026-08-16 12:43:31 +00:00
GandClaude Fable 5 e9f0193937 fix(ai): replace retired Claude model defaults (#123)
- providers.py: claude-sonnet-4-20250514 (deprecated, retires Jun 2026) -> claude-sonnet-5
- constants.ts: anthropic/claude-3.5-sonnet (retired Oct 2025 on OpenRouter) -> anthropic/claude-sonnet-5 (verified against OpenRouter's live model list)
- test fixtures updated to match

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-28 16:38:13 +02:00
g-butandClaude Opus 4.6 be1f76ea9e refactor: fix DRY/SSOT violations and Tailwind build bug
- Fix dynamic Tailwind classes in ProfessionalDemo.tsx that were purged
  at build time by replacing string interpolation with static lookups
- Deduplicate LLM config by importing GROQ/OpenRouter constants from
  API_CONFIG instead of defining them locally in llm-client.ts
- Remove duplicate input type interfaces from types/ that duplicated
  Zod-inferred types in lib/validations/, re-export from SSOT
- Extract shared navigation config (AUTH_NAV_ITEMS) and icon components
  used by both AuthNav and MobileNav into lib/config/navigation.ts

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 23:15:08 +01:00
g-butandClaude Opus 4.5 6c25dc8dfe refactor: comprehensive code quality improvements (DRY, SSOT, SoC)
## Broken Links Fixed
- Fix /projects/governance/build link to /contact in HeroSection.tsx

## Console Statements Removed (production code)
- Remove console.log/error from client components
- Replace with silent error handling or UI feedback
- Files: documents/page.tsx, try/page.tsx, settings/page.tsx,
  ConversationList.tsx, ProfessionalDemo.tsx, and more

## Inline Styles Converted to Tailwind
- Replace animation-delay inline styles with Tailwind arbitrary values
- Files: DemoMessage.tsx, DemoChat.tsx, ProfessionalDemo.tsx,
  QuickChat.tsx, demo/page.tsx, HeroSection.tsx

## Governance Types Consolidated (SSOT)
- Create app/projects/governance/types.ts as single source of truth
- Create app/projects/governance/utils.ts for formatting functions
- Remove duplicate EnhancedTransaction from TransactionWithTraceability.tsx
- Update component type files to re-export from SSOT

## Colors Config Extended
- Extend COLOR_CLASSES to support all 16 accent colors
- Fix type mismatch in custom bot pages

## Magic Numbers Extracted
- Add formatBytes utility to lib/format.ts (DRY)
- Add DEMO_MAX_FILE_SIZE to VALIDATION constants
- Update try/page.tsx to use centralized constants

## Minor Fixes
- Fix unused variable warning in CollaborationForm.tsx

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 00:24:27 +01:00
g-butandClaude Opus 4.5 6da1c37668 refactor: extract document status to constants and shared component (SSOT)
- Added DOCUMENT_STATUS constant to lib/constants.ts
- Added DocumentStatusType derived from constant
- Added DOCUMENT_STATUS_CONFIG for display (labels, colors)
- Created DocumentStatusBadge shared component
- Updated types/document.ts to use DocumentStatusType
- Updated app/documents/page.tsx to use shared component and constants

Changes to add a new status now require only 1 file (lib/constants.ts).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23 18:45:37 +01:00
g-butandClaude Opus 4.5 1c7abeebac docs(claude): add global standards reference and update date
- Add @~/.claude/CLAUDE.md import for global engineering standards
- Update Last Updated date to 2026-01-23

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23 15:22:36 +01:00
g-butandClaude Opus 4.5 4929569807 chore: Remove obsolete pre-launch waitlist code
The waitlist feature was from the pre-launch phase when collecting
early signups. Now that Botsmann is live, this code is no longer needed.

Removed:
- app/api/waitlist/route.ts
- lib/models/waitlist.ts
- lib/schemas/waitlist.ts
- supabase/migrations/010_waitlist.sql (was just created in error)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23 11:32:53 +01:00
g-butandClaude Sonnet 4.5 9aa417e273 refactor: clean up API routes and components, add shared utilities
Refactored multiple API routes and components to improve code organization and reduce duplication:
- Simplified API route implementations across chat, documents, consultations, and other endpoints
- Reorganized navigation components for better maintainability
- Added shared utility functions and hooks
- Created reusable Avatar and Logo components
- Added validation schemas and API utilities
- Improved type definitions and constants management

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-16 11:04:19 +01:00