Files
loki/package.json
T
CatoandClaude Opus 5 b95ef434b9 feat(ai): a third vendor Loki does not share with anything — Gemini (#714)
Loki's free chain had two vendors and both are SHARED. Groq's daily token pool
is org-wide and OpenRouter's 50 requests a day are account-wide, and on bitbaum
the same OpenRouter key serves ten apps — so those two links do not just run out,
they run out TOGETHER, for everyone. A Google project is per-app.

That is the property being bought here, not the model. ai-kit 1.8.0 adds Google
to `freeChain()`, so this is a dependency bump and nothing else — the chain comes
out of the package already ordered:

    groq -> google -> openrouter

    google models: models/gemini-flash-latest,
                   models/gemini-flash-lite-latest,
                   models/gemma-4-31b-it
    google keyEnv: GEMINI_API_KEY
    day capacity (all keyed): 250000

OpenRouter stays LAST on purpose: its unpaid tier is the scarcest pool in the
chain, so every other pool is drained before one of those 50 requests is spent.

Every id was verified with a real key on 2026-09-15 — 200 on the catalogue, a
NATIVE tool_call from each of the three, and a non-empty completion with
finish=stop. The `models/` prefix is deliberate: the catalogue lists all 56 ids
prefixed with no bare form anywhere, while /chat/completions accepts both, so a
bare id would serve perfectly AND be reported missing by the rot check forever.

ONE TEST HAD TO CHANGE, and it is the interesting part.

`ai-budget-gate.ts` set exactly GROQ_API_KEY and OPENROUTER_API_KEY, then
asserted capacity equalled the sum over EVERY provider in CHAT_CHAIN. That is
the same statement only while the chain has exactly two vendors; with three it
went red at 200000 vs 250000. The assertion was about capacity but was WRITTEN
as an assumption about how many vendors exist.

It now derives its keys from the chain, so a fourth vendor cannot silently turn
"all keyed" back into "some keyed". And it gains the case that was impossible
before: an UNKEYED vendor contributes nothing to the total — with two vendors,
"all keyed" and "some keyed" were the same set, so the subset could not be
stated at all.

(The identical bug existed independently in ai-kit's own chain.test.js and was
fixed there in the same release. Two repos reached the same wrong shape from the
same true premise.)

GEMINI_API_KEY is already installed in /opt/loki/app/.env, and the unit reads
that file (EnvironmentFile=/opt/loki/app/.env), so this takes effect on deploy.

Worth stating for whoever weighs it later: Google's FREE tier says content is
used to improve its products; the paid tier says the opposite. This is the
second-to-last link, reached only once the pools above it are spent.

Verified: pnpm run verify clean, 171/171 unit test files.


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

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-14 20:57:30 -07:00

178 lines
9.6 KiB
JSON

{
"name": "loki",
"version": "0.1.0",
"engines": {
"node": ">=20"
},
"private": true,
"scripts": {
"dev": "next dev",
"prebuild": "npx tsx scripts/generate-bash-state-vocab.ts && npx tsx scripts/generate-widget-theme.ts && pnpm run build:widget",
"build:widget": "esbuild widget/main.ts --bundle --minify --format=iife --outfile=public/widget.js --log-level=warning",
"build": "next build",
"postbuild": "bash scripts/record-build-ref.sh && bash scripts/deploy-local.sh",
"start": "next start",
"install-app": "bash scripts/install-loki-app.sh",
"db:push": "drizzle-kit push",
"db:generate": "drizzle-kit generate",
"check:schema": "npx tsx scripts/check-schema-drift.ts",
"lint": "eslint --cache --cache-location node_modules/.cache/eslint src/ home/ widget/",
"check:design": "bash scripts/check-design-system.sh",
"check:desktop": "bash scripts/check-desktop.sh",
"verify": "pnpm run format:check && pnpm run check:deploy-ready && pnpm run check:client-ledger && pnpm run check:no-experiment-litter && pnpm run check:telegram-registry && tsc --noEmit && pnpm run lint && pnpm run check:design && pnpm run check:desktop && pnpm run test:unit && pnpm run test:home && pnpm run test:deploy-ref-gate && pnpm run test:not-behind-gate && pnpm run test:deploy-ready-gate && pnpm run test:client-ledger-gate && pnpm run test:experiment-litter-gate && pnpm run test:ops",
"check:telegram-registry": "bash scripts/ci/check-telegram-registry.sh",
"smoke": "bash scripts/smoke.sh",
"test:home": "bash scripts/test-home.sh",
"test:ops": "bash scripts/hetzner/test-host-alerts.sh && bash scripts/hetzner/test-security-check.sh && bash scripts/hetzner/test-disk-gc.sh && bash scripts/hetzner/test-agent-work-watch.sh && bash scripts/hetzner/test-ai-provider-check.sh && bash scripts/hetzner/test-builder-auth-check.sh && bash scripts/hetzner/test-cron-runner.sh && bash scripts/hetzner/test-ci-gate.sh && bash scripts/hetzner/test-apply-schema.sh && bash scripts/hetzner/test-uptime-sweep.sh && bash scripts/hetzner/test-launch-template.sh && bash scripts/hetzner/test-site-template.sh && bash scripts/hetzner/test-port-alloc.sh && bash scripts/hetzner/test-unit-template.sh && bash scripts/hetzner/test-register-reality.sh && bash scripts/hetzner/test-register-site.sh && bash scripts/hetzner/test-retire-site.sh && bash scripts/hetzner/test-no-retired-name.sh",
"test:executor": "npx tsx scripts/test/executor.ts",
"test:sandbox-executor": "npx tsx scripts/test/sandbox-executor.ts",
"test:control-presenter": "npx tsx scripts/test/control-presenter.ts",
"test:agent-resolution": "npx tsx scripts/test/agent-resolution.ts",
"test:auto-reroute": "npx tsx scripts/test/auto-reroute.ts",
"test:dod-gate": "npx tsx scripts/test/dod-gate.ts",
"test:project-session": "npx tsx scripts/test/project-session.ts",
"test:autopilot-defaults": "npx tsx scripts/test/autopilot-defaults.ts",
"test:fleet-kick": "npx tsx scripts/test/fleet-kick.ts",
"test:push-notifications": "npx tsx scripts/test/push-notifications.ts",
"test:onboarding": "npx tsx scripts/test/onboarding.ts",
"test:onboarding-heal": "npx tsx scripts/test/onboarding-heal.ts",
"test:db-url": "npx tsx scripts/test/db-url.ts",
"test:brand-sync": "npx tsx scripts/test/brand-sync.ts",
"test:orchestration-summary": "npx tsx scripts/test/orchestration-summary.ts",
"test:dispatch-gates": "npx tsx scripts/test/dispatch-gates.ts",
"test:notify-close": "npx tsx scripts/test/notify-close.ts",
"test:fact-budget": "npx tsx scripts/test/fact-budget.ts",
"test:fair-share": "npx tsx scripts/test/fair-share.ts",
"test:ai-budget-gate": "npx tsx scripts/test/ai-budget-gate.ts",
"test:deploy-ref-gate": "bash scripts/test/deploy-ref-gate.sh",
"test:not-behind-gate": "bash scripts/test/not-behind-gate.sh",
"test:approval-cues": "npx tsx scripts/test/approval-cues.ts",
"test:groq-error": "npx tsx scripts/test/groq-error.ts",
"test:chat-chain": "npx tsx scripts/test/chat-chain.ts",
"test:ai-health": "npx tsx scripts/test/ai-health.ts",
"test:health-route": "npx tsx scripts/test/health-route.ts",
"test:answering-prompt": "npx tsx scripts/test/answering-prompt.ts",
"test:prompt-history": "npx tsx scripts/test/prompt-history.ts",
"test:desktop-command-validator": "npx tsx scripts/test/desktop-command-validator.ts",
"test:tab-match": "npx tsx scripts/test/tab-match.ts",
"test:agent-comms": "npx tsx scripts/test/agent-comms.ts",
"test:unit": "npx tsx scripts/test-unit.ts",
"test:ai-forms": "tsx scripts/verify-ai-forms.ts",
"test:activity-ssot": "node scripts/activity-ssot-check.mjs",
"dogfood:loki": "node scripts/loki-dogfood.mjs",
"dogfood:loki:ci": "LOKI_SESSION_TOKEN=$(npx tsx scripts/test/print-session-token.ts) HEADLESS=1 node scripts/loki-dogfood.mjs",
"dogfood:ui-flows:ci": "LOKI_SESSION_TOKEN=$(npx tsx scripts/test/print-session-token.ts) HEADLESS=1 node scripts/ui-flow-dogfood.mjs",
"dogfood:machine:ci": "LOKI_SESSION_TOKEN=$(npx tsx scripts/test/print-session-token.ts) HEADLESS=1 node scripts/machine-dogfood.mjs",
"dogfood:self": "node scripts/loki-self-dogfood.mjs",
"test:e2e:loki": "tsx scripts/test/loki-loop-e2e.ts",
"test:e2e:loki:dispatch": "tsx scripts/test/loki-loop-e2e.ts --dispatch",
"test:dispatch-status": "npx tsx scripts/test/dispatch-status.ts",
"test:fleet-context": "npx tsx scripts/test/fleet-context.ts",
"test:execution-access": "npx tsx scripts/test/execution-access.ts",
"test:workspace-access": "npx tsx scripts/test/workspace-access.ts",
"test:authenticated-smoke": "npx tsx scripts/test/authenticated-smoke.ts",
"test:pre-push-prod-dogfood": "bash scripts/test/pre-push-prod-dogfood.sh",
"test:loop-ssot": "npx tsx scripts/test/loop-ssot.ts",
"test:auth-a11y": "npx tsx scripts/test/auth-a11y.ts",
"test:loki-prefetch": "npx tsx scripts/test/loki-prefetch.ts",
"test:digest": "npx tsx scripts/test/digest.ts",
"test:auth": "npx tsx scripts/test/auth.ts",
"test:orangecat-integration": "npx tsx scripts/test/orangecat-integration.ts",
"test:orangecat-entitlement-e2e": "npx tsx scripts/test/orangecat-entitlement-e2e.ts",
"generate:brand": "npx tsx scripts/generate-brand.mjs",
"generate:agent-prompts": "npx tsx scripts/generate-agent-prompts.ts",
"ingest:history": "npx tsx scripts/ingest-claude-code-history.ts",
"desktop:dev": "cd desktop && pnpm run dev",
"desktop:build": "cd desktop && pnpm run build",
"desktop:preview": "cd desktop && pnpm run preview",
"db:dump": "bash scripts/db/dump.sh",
"db:restore": "bash scripts/db/restore.sh",
"db:apply-box": "bash scripts/db/apply-box.sh",
"deploy": "bash scripts/deploy-hetzner.sh",
"deploy:status": "bash scripts/deploy-status.sh",
"doctor": "bash scripts/doctor.sh",
"git:prune": "bash scripts/git/prune-merged.sh",
"ship": "git push origin main",
"prepare": "husky",
"probe:models": "tsx scripts/probe-models.ts",
"check:models": "tsx scripts/check-model-ids.ts",
"check:telemetry": "tsx scripts/check-telemetry.ts",
"audit:responsive": "node scripts/test/responsive-audit.mjs",
"audit:mobile": "node scripts/test/mobile-interaction-audit.mjs",
"audit:contrast": "node scripts/test/contrast-audit.mjs",
"check:deploy-ready": "bash scripts/ci/check-deploy-ready.sh",
"test:deploy-ready-gate": "bash scripts/test/deploy-ready-gate.sh",
"check:client-ledger": "bash scripts/ci/check-client-ledger.sh",
"test:client-ledger-gate": "bash scripts/test/client-ledger-gate.sh",
"format": "prettier --write .",
"format:check": "prettier --check .",
"check:no-experiment-litter": "bash scripts/ci/check-no-experiment-litter.sh",
"test:experiment-litter-gate": "bash scripts/test/experiment-litter-gate.sh"
},
"dependencies": {
"@auth/core": "0.41.3",
"@auth/drizzle-adapter": "^1.11.3",
"@bitbaum/ai-kit": "^1.8.0",
"@bitbaum/mail-kit": "^0.1.0",
"@dnd-kit/core": "^6.3.1",
"@dnd-kit/sortable": "^10.0.0",
"@dnd-kit/utilities": "^3.2.2",
"@fleet/ai-forms": "npm:ai-forms@^0.1.2",
"@noble/hashes": "^2.4.0",
"@noble/secp256k1": "^3.2.0",
"@orangecat/sdk": "file:vendor/orangecat-sdk-0.2.0.tgz",
"@sentry/nextjs": "^10.73.0",
"@types/ws": "^8.18.1",
"@xterm/addon-fit": "^0.11.0",
"@xterm/addon-web-links": "^0.12.0",
"@xterm/xterm": "^6.0.0",
"bip-kit": "^0.2.7",
"bs58check": "^4.0.0",
"clsx": "^2.1.1",
"date-fns": "^4.4.0",
"drizzle-orm": "^0.45.2",
"geist": "^1.7.2",
"limitkit": "^0.2.0",
"listkit": "github:bitbaum/listkit#v0.1.0",
"lucide-react": "^1.41.0",
"mermaid": "^11.17.2",
"next": "16.3.4",
"next-auth": "^5.0.0-beta.32",
"next-themes": "^0.4.6",
"node-pty": "^1.1.0",
"postgres": "^3.4.9",
"react": "19.2.8",
"react-dom": "19.2.8",
"shadcn": "^4.21.0",
"shiki": "^4.4.3",
"tailwind-merge": "^3.6.0",
"tw-animate-css": "^1.4.0",
"web-push": "^3.6.7",
"ws": "^8.21.3",
"zod": "^4.5.4"
},
"devDependencies": {
"@bitbaum/design-tokens": "1.1.0",
"@tailwindcss/postcss": "^4",
"@types/better-sqlite3": "^9.6.0",
"@types/node": "^26",
"@types/react": "^19",
"@types/react-dom": "^19",
"@types/web-push": "^3.6.4",
"better-sqlite3": "^13.0.3",
"dotenv": "^17.4.2",
"drizzle-kit": "^0.31.10",
"esbuild": "^0.28.2",
"eslint": "^10",
"eslint-config-next": "16.3.4",
"husky": "^9.1.7",
"playwright": "^1.63.0",
"prettier": "3.9.6",
"sharp": "^0.35.4",
"tailwindcss": "^4",
"tsx": "^4.23.13",
"typescript": "^6.0.3"
},
"packageManager": "pnpm@11.25.0"
}