CHUNK #9: AI session storage layer (AgentController, AIStore, builders)

- Add packages/ai: AgentController (streaming + budget), SuggestionBuilder,
  NoteBuilder, AIStore (Dexie/IndexedDB), SuggestionMutation
- Fix createUlid to use monotonicFactory for reliable listSessions sort tiebreaker
- Extend outline system prompt with setting + characters context
- Add dexie dependency to packages/ai
- 188 tests passing (core 47, ui 5, editor 30, ai 71, exporters 22, web 13)
This commit is contained in:
Schwitzz
2026-10-29 07:31:25 -05:00
parent 4c4b83bb68
commit 1e16b0d5d2
15 changed files with 1859 additions and 3 deletions
+7 -2
View File
@@ -1,10 +1,15 @@
import { ulid } from "ulid";
import { monotonicFactory } from "ulid";
const ULID_REGEX = /^[0-7][0-9A-HJKMNP-TV-Z]{25}$/;
// Monotonic factory: guarantees that successive calls produce ULIDs that sort
// in creation order even within the same millisecond. This is important for
// tiebreakers that rely on ULID ordering (e.g. reverse-chronological lists).
const monotonicUlid = monotonicFactory();
/** Generate a monotonic ULID. */
export function createUlid(): string {
return ulid();
return monotonicUlid();
}
/** Validate a ULID string. */