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:
@@ -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. */
|
||||
|
||||
Reference in New Issue
Block a user