Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .husky/pre-push
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
41 changes: 21 additions & 20 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
6 changes: 3 additions & 3 deletions scripts/test/agent-grounding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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([
Expand Down
2 changes: 1 addition & 1 deletion scripts/test/agent-tool-loop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"];

Expand Down
2 changes: 1 addition & 1 deletion scripts/test/fact-budget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions src/config/chat-models.ts
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/config/model-registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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[] = [
Expand Down
2 changes: 1 addition & 1 deletion src/lib/agent/brief.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/lib/agent/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/lib/agent/fact-budget.ts
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
4 changes: 2 additions & 2 deletions src/lib/agent/groq-error.ts
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -20,4 +20,4 @@ export {
retryAfterSeconds as groqRetryAfterSeconds,
humanizeWait,
rateLimitMessage,
} from "ai-kit";
} from "@bitbaum/ai-kit";
6 changes: 3 additions & 3 deletions src/lib/agent/loop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/lib/agent/sources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
2 changes: 1 addition & 1 deletion src/lib/agent/tools/handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/lib/agent/tools/registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
4 changes: 2 additions & 2 deletions src/lib/ai-budget/fair-share.ts
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -20,4 +20,4 @@ export {
fairShare,
utcDayElapsed,
utcDayKey,
} from "ai-kit";
} from "@bitbaum/ai-kit";
4 changes: 2 additions & 2 deletions src/lib/ai/health.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 });

Expand Down
2 changes: 1 addition & 1 deletion src/lib/groq.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/lib/loki-core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down
Loading