From 1ef330d948067d67a94dbddcd36c7a292ee46a8b Mon Sep 17 00:00:00 2001 From: Mao Nakamoto <41178744+maonakamoto@users.noreply.github.com> Date: Fri, 4 Sep 2026 01:55:04 +0200 Subject: [PATCH] =?UTF-8?q?refactor(deps):=20ai-kit=20comes=20from=20npm?= =?UTF-8?q?=20=E2=80=94=20@bitbaum/ai-kit=20^0.6.2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The package is now published to the npm registry as @bitbaum/ai-kit (npm's typosquat guard blocked the bare name "ai-kit", hence the scope; ai-kit PR #25 documents the rename — content is identical to the github:bitbaum/ai-kit#v0.6.2 tag). The git pin is retired: the lockfile no longer records the writer's ssh transport and npm-major-specific resolution for this dependency, so the whole lockfile-writer trap class dies with it. All imports move from 'ai-kit' / 'ai-kit/grounding' to '@bitbaum/ai-kit' / '@bitbaum/ai-kit/grounding'. Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01WqKqMnHQHSmkGFfc5t7Rxn --- .husky/pre-push | 2 +- package-lock.json | 41 +++++++++++++++++---------------- package.json | 2 +- scripts/test/agent-grounding.ts | 6 ++--- scripts/test/agent-tool-loop.ts | 2 +- scripts/test/fact-budget.ts | 2 +- src/config/chat-models.ts | 4 ++-- src/config/model-registry.ts | 2 +- src/lib/agent/brief.ts | 2 +- src/lib/agent/context.ts | 4 ++-- src/lib/agent/fact-budget.ts | 2 +- src/lib/agent/groq-error.ts | 4 ++-- src/lib/agent/loop.ts | 6 ++--- src/lib/agent/sources.ts | 2 +- src/lib/agent/tools/handlers.ts | 2 +- src/lib/agent/tools/registry.ts | 2 +- src/lib/ai-budget/fair-share.ts | 4 ++-- src/lib/ai/health.ts | 4 ++-- src/lib/groq.ts | 2 +- src/lib/loki-core.ts | 6 ++--- 20 files changed, 51 insertions(+), 50 deletions(-) diff --git a/.husky/pre-push b/.husky/pre-push index 401327f5..a7d284ff 100755 --- a/.husky/pre-push +++ b/.husky/pre-push @@ -25,7 +25,7 @@ fi # --------------------------------------------------------------------------- # PRECONDITION, NOT A CHECK. # -# A stale node_modules makes tsc report "Cannot find module 'ai-kit'", which +# A stale node_modules makes tsc report "Cannot find module '@bitbaum/ai-kit'", which # reads as a type error in your change and is not one. That exact confusion cost # a day: the dependency was unresolvable after a GitHub account rename, every # push went red, and the conclusion drawn was "the hook is broken". Fail loudly diff --git a/package-lock.json b/package-lock.json index d983f756..dd728f31 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,6 +12,7 @@ ], "dependencies": { "@auth/drizzle-adapter": "^1.11.3", + "@bitbaum/ai-kit": "^0.6.2", "@dnd-kit/core": "^6.3.1", "@dnd-kit/sortable": "^10.0.0", "@dnd-kit/utilities": "^3.2.2", @@ -24,7 +25,6 @@ "@xterm/addon-fit": "^0.11.0", "@xterm/addon-web-links": "^0.12.0", "@xterm/xterm": "^6.0.0", - "ai-kit": "github:bitbaum/ai-kit#v0.6.2", "bip-kit": "^0.1.0", "bs58check": "^4.0.0", "clsx": "^2.1.1", @@ -542,6 +542,26 @@ "node": ">=6.9.0" } }, + "node_modules/@bitbaum/ai-kit": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/@bitbaum/ai-kit/-/ai-kit-0.6.2.tgz", + "integrity": "sha512-974ollQp2pugPpsUgdJY/i6r+/v3CEwa3XqmfSdi+vM7w8eMVWufSKQ3mu9QLoEm7b0Gq/mKgLKql3lSawmCfw==", + "license": "MIT", + "dependencies": { + "ai-forms": "^0.1.2" + }, + "engines": { + "node": ">=20" + }, + "peerDependencies": { + "react": ">=18" + }, + "peerDependenciesMeta": { + "react": { + "optional": true + } + } + }, "node_modules/@braintree/sanitize-url": { "version": "7.1.2", "resolved": "https://registry.npmjs.org/@braintree/sanitize-url/-/sanitize-url-7.1.2.tgz", @@ -5823,25 +5843,6 @@ } } }, - "node_modules/ai-kit": { - "version": "0.6.2", - "resolved": "git+ssh://git@github.com/bitbaum/ai-kit.git#ace11f14d817079ae2bf4cdc010b6daa9faacbec", - "license": "MIT", - "dependencies": { - "ai-forms": "^0.1.2" - }, - "engines": { - "node": ">=20" - }, - "peerDependencies": { - "react": ">=18" - }, - "peerDependenciesMeta": { - "react": { - "optional": true - } - } - }, "node_modules/ajv": { "version": "6.15.0", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.15.0.tgz", diff --git a/package.json b/package.json index e59f7373..590c2a19 100644 --- a/package.json +++ b/package.json @@ -108,6 +108,7 @@ }, "dependencies": { "@auth/drizzle-adapter": "^1.11.3", + "@bitbaum/ai-kit": "^0.6.2", "@dnd-kit/core": "^6.3.1", "@dnd-kit/sortable": "^10.0.0", "@dnd-kit/utilities": "^3.2.2", @@ -120,7 +121,6 @@ "@xterm/addon-fit": "^0.11.0", "@xterm/addon-web-links": "^0.12.0", "@xterm/xterm": "^6.0.0", - "ai-kit": "github:bitbaum/ai-kit#v0.6.2", "bip-kit": "^0.1.0", "bs58check": "^4.0.0", "clsx": "^2.1.1", diff --git a/scripts/test/agent-grounding.ts b/scripts/test/agent-grounding.ts index 92a198ac..c7e67a42 100644 --- a/scripts/test/agent-grounding.ts +++ b/scripts/test/agent-grounding.ts @@ -29,15 +29,15 @@ import { renderFacts, unrecordedFields, NOT_RECORDED, -} from "ai-kit/grounding"; +} from "@bitbaum/ai-kit/grounding"; import { buildContract, buildGroundedContext, renderDirectives, buildAssistantRules, NO_BASIS, -} from "ai-kit/grounding"; -import { verifyAnswer, buildRepairPrompt } from "ai-kit/grounding"; +} from "@bitbaum/ai-kit/grounding"; +import { verifyAnswer, buildRepairPrompt } from "@bitbaum/ai-kit/grounding"; // ── The real records, exactly as FleetCrown stores them ────────────────────── const FACTS = assignFactIds([ diff --git a/scripts/test/agent-tool-loop.ts b/scripts/test/agent-tool-loop.ts index 2b8ffd45..874fddaa 100644 --- a/scripts/test/agent-tool-loop.ts +++ b/scripts/test/agent-tool-loop.ts @@ -25,7 +25,7 @@ import { type ToolRegistry, } from "../../src/lib/agent/tools/registry"; import { runLokiTurn } from "../../src/lib/agent/loop"; -import { makeFact, assignFactIds } from "ai-kit/grounding"; +import { makeFact, assignFactIds } from "@bitbaum/ai-kit/grounding"; const NAMES = ["search_people", "list_projects", "propose_action"]; diff --git a/scripts/test/fact-budget.ts b/scripts/test/fact-budget.ts index f517e45f..6e3dfc91 100644 --- a/scripts/test/fact-budget.ts +++ b/scripts/test/fact-budget.ts @@ -15,7 +15,7 @@ import { estimateTokens, omissionNotice, } from "@/lib/agent/fact-budget"; -import type { Fact } from "ai-kit/grounding"; +import type { Fact } from "@bitbaum/ai-kit/grounding"; function assert(condition: boolean, message: string): void { if (!condition) throw new Error(message); diff --git a/src/config/chat-models.ts b/src/config/chat-models.ts index faea8138..66caef57 100644 --- a/src/config/chat-models.ts +++ b/src/config/chat-models.ts @@ -1,7 +1,7 @@ /** * SSOT for the CHAT model chain — the models that drive Loki's tool loop. * - * The chain LOGIC now lives in `ai-kit`, extracted after the lesson was paid + * The chain LOGIC now lives in `@bitbaum/ai-kit`, extracted after the lesson was paid * for twice in this repo: four pinned free models rotted out from under the * vision half, and the chat half was still pinned to one vendor whose only * degradation was a step-down to a smaller model AT THE SAME VENDOR — drawing on @@ -31,7 +31,7 @@ import { chainFrom as chainFromLinks, type Provider, type Link, -} from "ai-kit"; +} from "@bitbaum/ai-kit"; export type ChatProvider = Provider; export type ChatLink = Link; diff --git a/src/config/model-registry.ts b/src/config/model-registry.ts index 5cfbcc29..51696828 100644 --- a/src/config/model-registry.ts +++ b/src/config/model-registry.ts @@ -36,7 +36,7 @@ export type RegisteredModel = { }; /** Statically pinned ids. The Loki chat + vision chains are deliberately NOT - * here: they live in `ai-kit`, are env-overridable at runtime, and already + * here: they live in `@bitbaum/ai-kit`, are env-overridable at runtime, and already * fall through to another vendor. These are the pins with NO fallback — the * ones whose death is a hard outage. */ export const REGISTERED_MODELS: RegisteredModel[] = [ diff --git a/src/lib/agent/brief.ts b/src/lib/agent/brief.ts index 56dbe868..db0a1ea5 100644 --- a/src/lib/agent/brief.ts +++ b/src/lib/agent/brief.ts @@ -26,7 +26,7 @@ import { getStuckGoals, getGoalsDueSoon, listUpcomingCommitments } from "@/db/queries/today"; import { getEventsDueSoon } from "@/db/queries/events"; import { getTodayHabits } from "@/db/queries/habits"; -import type { Directive } from "ai-kit/grounding"; +import type { Directive } from "@bitbaum/ai-kit/grounding"; /** Days ahead treated as "imminent" for the day-planning brief. */ const IMMINENT_DAYS = 3; diff --git a/src/lib/agent/context.ts b/src/lib/agent/context.ts index 746f3d64..ddf95656 100644 --- a/src/lib/agent/context.ts +++ b/src/lib/agent/context.ts @@ -26,8 +26,8 @@ * records answers about the wrong one. Cheap deterministic facts (people, * projects) are kept whole; retrieved documents are the elastic part. */ -import { assignFactIds, renderFacts, type Fact } from "ai-kit/grounding"; -import { buildGroundedContext, type Directive } from "ai-kit/grounding"; +import { assignFactIds, renderFacts, type Fact } from "@bitbaum/ai-kit/grounding"; +import { buildGroundedContext, type Directive } from "@bitbaum/ai-kit/grounding"; import { peopleFacts, projectFacts, diff --git a/src/lib/agent/fact-budget.ts b/src/lib/agent/fact-budget.ts index 36ecb2b4..a561c2cb 100644 --- a/src/lib/agent/fact-budget.ts +++ b/src/lib/agent/fact-budget.ts @@ -1,4 +1,4 @@ -import type { Fact } from "ai-kit/grounding"; +import type { Fact } from "@bitbaum/ai-kit/grounding"; /** * Fact-budget policy for the tool loop — pure, and load-bearing. diff --git a/src/lib/agent/groq-error.ts b/src/lib/agent/groq-error.ts index 9fbe5925..a4e37fbe 100644 --- a/src/lib/agent/groq-error.ts +++ b/src/lib/agent/groq-error.ts @@ -1,5 +1,5 @@ /** - * 429 classification — now owned by `ai-kit`. + * 429 classification — now owned by `@bitbaum/ai-kit`. * * The three kinds of 429 (capacity / size / daily) and their opposite responses * were learned here the expensive way, so the knowledge was extracted rather @@ -20,4 +20,4 @@ export { retryAfterSeconds as groqRetryAfterSeconds, humanizeWait, rateLimitMessage, -} from "ai-kit"; +} from "@bitbaum/ai-kit"; diff --git a/src/lib/agent/loop.ts b/src/lib/agent/loop.ts index cc57a10f..addd40df 100644 --- a/src/lib/agent/loop.ts +++ b/src/lib/agent/loop.ts @@ -24,7 +24,7 @@ * observed failure mode, not defensive padding, and the loop always degrades to * "answer with what you have" rather than to an error. */ -import { assignFactIds, renderFacts, type Fact } from "ai-kit/grounding"; +import { assignFactIds, renderFacts, type Fact } from "@bitbaum/ai-kit/grounding"; import { trimFactsToBudget, mergeFactsWithCap, @@ -37,8 +37,8 @@ import { directiveId, NO_BASIS, type Directive, -} from "ai-kit/grounding"; -import { verifyAnswer, buildRepairPrompt, type Violation } from "ai-kit/grounding"; +} from "@bitbaum/ai-kit/grounding"; +import { verifyAnswer, buildRepairPrompt, type Violation } from "@bitbaum/ai-kit/grounding"; import { callModelWithTools, type ChatMessage, type ToolCall } from "@/lib/agent/llm"; import { renderToolCatalog, diff --git a/src/lib/agent/sources.ts b/src/lib/agent/sources.ts index e8fef272..3eaf5ddf 100644 --- a/src/lib/agent/sources.ts +++ b/src/lib/agent/sources.ts @@ -15,7 +15,7 @@ import { getPendingActions } from "@/db/queries/actions"; import { searchKnowledge, type KnowledgeHit } from "@/db/queries/knowledge-embeddings"; import { embeddingsEnabled } from "@/lib/rag/embeddings"; import { cleanDescription } from "@/lib/project-display"; -import { makeFact, type Fact } from "ai-kit/grounding"; +import { makeFact, type Fact } from "@bitbaum/ai-kit/grounding"; import { isChannelAttrKey, stripChannelPrefix } from "@/config/channels"; import { nameCandidates } from "@/lib/people-names"; import type { DevLogEntry, UserProject } from "@/db/schema/user-projects"; diff --git a/src/lib/agent/tools/handlers.ts b/src/lib/agent/tools/handlers.ts index a1a21a14..768e8d24 100644 --- a/src/lib/agent/tools/handlers.ts +++ b/src/lib/agent/tools/handlers.ts @@ -22,7 +22,7 @@ import { createHumanTask, listOpenHumanTasks } from "@/db/queries/human-tasks"; import { HUMAN_TASK_STATUS_LABEL, TASK_ACTOR, formatFee } from "@/config/crew"; import { ACTION_TYPE, type ActionType } from "@/lib/constants/statuses"; import { askGatewayAgent, isGatewayConfigured } from "@/lib/openclaw-gateway"; -import { makeFact, type Fact } from "ai-kit/grounding"; +import { makeFact, type Fact } from "@bitbaum/ai-kit/grounding"; import { peopleFacts, projectFacts, diff --git a/src/lib/agent/tools/registry.ts b/src/lib/agent/tools/registry.ts index 8547143e..0eb75e46 100644 --- a/src/lib/agent/tools/registry.ts +++ b/src/lib/agent/tools/registry.ts @@ -27,7 +27,7 @@ * a refactor. */ import { z } from "zod"; -import type { Fact } from "ai-kit/grounding"; +import type { Fact } from "@bitbaum/ai-kit/grounding"; /** Read = lookup. Propose = enqueue a draft for the operator to approve. */ export type ToolKind = "read" | "propose"; diff --git a/src/lib/ai-budget/fair-share.ts b/src/lib/ai-budget/fair-share.ts index 65dfd5c1..8ab06ebd 100644 --- a/src/lib/ai-budget/fair-share.ts +++ b/src/lib/ai-budget/fair-share.ts @@ -1,5 +1,5 @@ /** - * Fair-share rationing — now owned by `ai-kit`. + * Fair-share rationing — now owned by `@bitbaum/ai-kit`. * * The policy was always pure (no DB, no clock, no provider), which is exactly * what made it liftable: it was written here, proved here, and then extracted so @@ -20,4 +20,4 @@ export { fairShare, utcDayElapsed, utcDayKey, -} from "ai-kit"; +} from "@bitbaum/ai-kit"; diff --git a/src/lib/ai/health.ts b/src/lib/ai/health.ts index 95c547e9..0f5139ac 100644 --- a/src/lib/ai/health.ts +++ b/src/lib/ai/health.ts @@ -13,11 +13,11 @@ * This tracker is the fix: the real call sites in groq.ts, agent/llm.ts and * vision.ts record a success or failure once per top-level call, and * `/api/health` reads it back as an informational field. Mirrors the same - * `ai-kit` tracker adopted fleet-wide (aoz-housing, surf-your-life, + * `@bitbaum/ai-kit` tracker adopted fleet-wide (aoz-housing, surf-your-life, * truthseeker) — `downAfter: 3` matches their convention. */ -import { createHealthTracker } from "ai-kit"; +import { createHealthTracker } from "@bitbaum/ai-kit"; const tracker = createHealthTracker({ downAfter: 3 }); diff --git a/src/lib/groq.ts b/src/lib/groq.ts index 155d1aa6..041f12f8 100644 --- a/src/lib/groq.ts +++ b/src/lib/groq.ts @@ -4,7 +4,7 @@ * * ── Why this is no longer Groq-only ────────────────────────────────────────── * It kept the name because sixteen call sites import it, but the transport now - * walks the SAME cross-vendor chain Loki has used all along (`ai-kit` via + * walks the SAME cross-vendor chain Loki has used all along (`@bitbaum/ai-kit` via * config/chat-models). That is the whole fix for 2026-08-18: Groq retired * `llama-3.3-70b-versatile`, every direct caller here had exactly one vendor * and no fallback, and seven features went dark for eight days. Loki, which diff --git a/src/lib/loki-core.ts b/src/lib/loki-core.ts index 49de9295..52927260 100644 --- a/src/lib/loki-core.ts +++ b/src/lib/loki-core.ts @@ -14,11 +14,11 @@ import { callGroqText, GROQ_FAST_MODEL } from "@/lib/groq"; import { getUserPreferences } from "@/db/queries/user-preferences"; import { buildGroundedTurn, directiveEvidence } from "@/lib/agent/context"; import { runLokiTurn } from "@/lib/agent/loop"; -import { verifyAnswer, buildRepairPrompt, type Violation } from "ai-kit/grounding"; -import { NO_BASIS } from "ai-kit/grounding"; +import { verifyAnswer, buildRepairPrompt, type Violation } from "@bitbaum/ai-kit/grounding"; +import { NO_BASIS } from "@bitbaum/ai-kit/grounding"; import { rateLimitMessage } from "@/lib/agent/groq-error"; import { checkAiBudget, recordAiSpend } from "@/lib/ai-budget/gate"; -import type { Fact } from "ai-kit/grounding"; +import type { Fact } from "@bitbaum/ai-kit/grounding"; import { APP_NAME } from "@/config/brand"; import { HTTP_TIMEOUT_LONG_MS } from "@/lib/constants/time";