laminark 2.21.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +15 -0
- package/README.md +182 -0
- package/package.json +63 -0
- package/plugin/.claude-plugin/plugin.json +13 -0
- package/plugin/.mcp.json +12 -0
- package/plugin/dist/analysis/worker.d.ts +1 -0
- package/plugin/dist/analysis/worker.js +233 -0
- package/plugin/dist/analysis/worker.js.map +1 -0
- package/plugin/dist/config-t8LZeB-u.mjs +90 -0
- package/plugin/dist/config-t8LZeB-u.mjs.map +1 -0
- package/plugin/dist/hooks/handler.d.ts +284 -0
- package/plugin/dist/hooks/handler.d.ts.map +1 -0
- package/plugin/dist/hooks/handler.js +2125 -0
- package/plugin/dist/hooks/handler.js.map +1 -0
- package/plugin/dist/index.d.ts +445 -0
- package/plugin/dist/index.d.ts.map +1 -0
- package/plugin/dist/index.js +5831 -0
- package/plugin/dist/index.js.map +1 -0
- package/plugin/dist/observations-Ch0nc47i.d.mts +170 -0
- package/plugin/dist/observations-Ch0nc47i.d.mts.map +1 -0
- package/plugin/dist/tool-registry-CZ3mJ4iR.mjs +2655 -0
- package/plugin/dist/tool-registry-CZ3mJ4iR.mjs.map +1 -0
- package/plugin/hooks/hooks.json +78 -0
- package/plugin/scripts/README.md +47 -0
- package/plugin/scripts/bump-version.sh +44 -0
- package/plugin/scripts/ensure-deps.sh +12 -0
- package/plugin/scripts/install.sh +63 -0
- package/plugin/scripts/local-install.sh +103 -0
- package/plugin/scripts/setup-tmpdir.sh +65 -0
- package/plugin/scripts/uninstall.sh +95 -0
- package/plugin/scripts/update.sh +88 -0
- package/plugin/scripts/verify-install.sh +43 -0
- package/plugin/ui/activity.js +185 -0
- package/plugin/ui/app.js +1642 -0
- package/plugin/ui/graph.js +2333 -0
- package/plugin/ui/help.js +228 -0
- package/plugin/ui/index.html +492 -0
- package/plugin/ui/settings.js +650 -0
- package/plugin/ui/styles.css +2910 -0
- package/plugin/ui/timeline.js +652 -0
|
@@ -0,0 +1,445 @@
|
|
|
1
|
+
import { a as SearchResult, i as ObservationInsert, n as DatabaseConfig, o as Session, r as Observation, t as ObservationRepository } from "./observations-Ch0nc47i.mjs";
|
|
2
|
+
import Database from "better-sqlite3";
|
|
3
|
+
|
|
4
|
+
//#region src/storage/database.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Wrapper around a configured better-sqlite3 database instance.
|
|
7
|
+
* Provides lifecycle methods (close, checkpoint) and tracks whether
|
|
8
|
+
* the sqlite-vec extension loaded successfully.
|
|
9
|
+
*/
|
|
10
|
+
interface LaminarkDatabase {
|
|
11
|
+
db: Database.Database;
|
|
12
|
+
hasVectorSupport: boolean;
|
|
13
|
+
close(): void;
|
|
14
|
+
checkpoint(): void;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Opens a SQLite database with WAL mode, correct PRAGMA order,
|
|
18
|
+
* optional sqlite-vec extension loading, and schema migrations.
|
|
19
|
+
*
|
|
20
|
+
* Single connection per process by design -- better-sqlite3 is synchronous,
|
|
21
|
+
* so connection pooling adds zero benefit.
|
|
22
|
+
*
|
|
23
|
+
* @param config - Database path and busy timeout configuration
|
|
24
|
+
* @returns A configured LaminarkDatabase instance
|
|
25
|
+
*/
|
|
26
|
+
declare function openDatabase(config: DatabaseConfig): LaminarkDatabase;
|
|
27
|
+
//#endregion
|
|
28
|
+
//#region src/storage/migrations.d.ts
|
|
29
|
+
/**
|
|
30
|
+
* A versioned schema migration.
|
|
31
|
+
* Migrations are applied in order and tracked in the _migrations table.
|
|
32
|
+
*/
|
|
33
|
+
interface Migration {
|
|
34
|
+
version: number;
|
|
35
|
+
name: string;
|
|
36
|
+
up: string | ((db: Database.Database) => void);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* All schema migrations in order.
|
|
40
|
+
*
|
|
41
|
+
* Migration 001: Observations table with INTEGER PRIMARY KEY AUTOINCREMENT
|
|
42
|
+
* (critical for FTS5 content_rowid stability across VACUUM).
|
|
43
|
+
* Migration 002: Sessions table for session lifecycle tracking.
|
|
44
|
+
* Migration 003: FTS5 external content table with porter+unicode61 tokenizer
|
|
45
|
+
* and three sync triggers (INSERT, UPDATE, DELETE).
|
|
46
|
+
* Migration 004: sqlite-vec vec0 table for 384-dim embeddings (conditional).
|
|
47
|
+
* Migration 005: Add title column to observations and rebuild FTS5 with
|
|
48
|
+
* title+content dual-column indexing.
|
|
49
|
+
* Migration 006: Recreate vec0 table with cosine distance metric (conditional).
|
|
50
|
+
* Migration 007: Context stashes table for topic detection thread snapshots.
|
|
51
|
+
* Migration 008: Threshold history table for EWMA adaptive threshold seeding.
|
|
52
|
+
* Migration 009: Shift decisions table for topic shift decision logging.
|
|
53
|
+
* Migration 010: Project metadata table for project selector UI.
|
|
54
|
+
* Migration 011: Add project_hash to graph tables and backfill from observations.
|
|
55
|
+
* Migration 012: Add classification and classified_at columns for LLM-based observation classification.
|
|
56
|
+
* Migration 013: Research buffer table for exploration tool event buffering.
|
|
57
|
+
* Migration 014: Add kind column to observations with backfill from source field.
|
|
58
|
+
* Migration 015: Update graph taxonomy -- remove Tool/Person nodes, tighten CHECK constraints.
|
|
59
|
+
* Migration 016: Tool registry table for discovered tools with scope-aware uniqueness.
|
|
60
|
+
* Migration 017: Tool usage events table for per-event temporal tracking.
|
|
61
|
+
* Migration 018: Tool registry FTS5 + vec0 tables for hybrid search on tool descriptions.
|
|
62
|
+
* Migration 019: Add status column (active/stale/demoted) to tool_registry for staleness management.
|
|
63
|
+
* Migration 020: Debug path tables (debug_paths + path_waypoints) for resolution path tracking.
|
|
64
|
+
*/
|
|
65
|
+
declare const MIGRATIONS: Migration[];
|
|
66
|
+
/**
|
|
67
|
+
* Applies unapplied schema migrations in order.
|
|
68
|
+
*
|
|
69
|
+
* Creates a _migrations tracking table if it does not exist, then applies
|
|
70
|
+
* each migration whose version exceeds the current max applied version.
|
|
71
|
+
* Each migration runs inside a transaction for atomicity.
|
|
72
|
+
*
|
|
73
|
+
* Migrations 004 and 006 (vec0 tables) are only applied when hasVectorSupport
|
|
74
|
+
* is true. If sqlite-vec is not available, they are silently skipped and will
|
|
75
|
+
* be applied on a future run when the extension becomes available.
|
|
76
|
+
*
|
|
77
|
+
* @param db - An open better-sqlite3 database connection
|
|
78
|
+
* @param hasVectorSupport - Whether sqlite-vec loaded successfully
|
|
79
|
+
*/
|
|
80
|
+
declare function runMigrations(db: Database.Database, hasVectorSupport: boolean): void;
|
|
81
|
+
//#endregion
|
|
82
|
+
//#region src/storage/sessions.d.ts
|
|
83
|
+
/**
|
|
84
|
+
* Repository for session lifecycle management.
|
|
85
|
+
*
|
|
86
|
+
* Every query is scoped to the projectHash provided at construction time.
|
|
87
|
+
* All SQL statements are prepared once in the constructor.
|
|
88
|
+
*/
|
|
89
|
+
declare class SessionRepository {
|
|
90
|
+
private readonly db;
|
|
91
|
+
private readonly projectHash;
|
|
92
|
+
private readonly stmtCreate;
|
|
93
|
+
private readonly stmtGetById;
|
|
94
|
+
private readonly stmtGetActive;
|
|
95
|
+
constructor(db: Database.Database, projectHash: string);
|
|
96
|
+
/**
|
|
97
|
+
* Creates a new session with the given ID, scoped to this project.
|
|
98
|
+
*/
|
|
99
|
+
create(id: string): Session;
|
|
100
|
+
/**
|
|
101
|
+
* Ends a session by setting ended_at and optionally a summary.
|
|
102
|
+
* Returns the updated session or null if not found.
|
|
103
|
+
*/
|
|
104
|
+
end(id: string, summary?: string): Session | null;
|
|
105
|
+
/**
|
|
106
|
+
* Gets a session by ID, scoped to this project.
|
|
107
|
+
*/
|
|
108
|
+
getById(id: string): Session | null;
|
|
109
|
+
/**
|
|
110
|
+
* Gets the most recent sessions for this project, ordered by started_at DESC.
|
|
111
|
+
*/
|
|
112
|
+
getLatest(limit?: number): Session[];
|
|
113
|
+
/**
|
|
114
|
+
* Gets the currently active (not ended) session for this project.
|
|
115
|
+
* Returns the most recently started active session, or null if none.
|
|
116
|
+
*/
|
|
117
|
+
getActive(): Session | null;
|
|
118
|
+
/**
|
|
119
|
+
* Updates the summary column on an existing session row.
|
|
120
|
+
* Sets updated_at (via ended_at preservation) to track when the summary was written.
|
|
121
|
+
*
|
|
122
|
+
* Used by the curation module after compressing session observations.
|
|
123
|
+
*/
|
|
124
|
+
updateSessionSummary(sessionId: string, summary: string): void;
|
|
125
|
+
}
|
|
126
|
+
//#endregion
|
|
127
|
+
//#region src/storage/search.d.ts
|
|
128
|
+
/**
|
|
129
|
+
* FTS5 search engine with BM25 ranking, snippet extraction, and strict project scoping.
|
|
130
|
+
*
|
|
131
|
+
* All queries are scoped to the projectHash provided at construction time.
|
|
132
|
+
* Queries are sanitized to prevent FTS5 syntax errors and injection.
|
|
133
|
+
*/
|
|
134
|
+
declare class SearchEngine {
|
|
135
|
+
private readonly db;
|
|
136
|
+
private readonly projectHash;
|
|
137
|
+
constructor(db: Database.Database, projectHash: string);
|
|
138
|
+
/**
|
|
139
|
+
* Full-text search with BM25 ranking and snippet extraction.
|
|
140
|
+
*
|
|
141
|
+
* bm25() returns NEGATIVE values where more negative = more relevant.
|
|
142
|
+
* ORDER BY rank (ascending) puts best matches first.
|
|
143
|
+
*
|
|
144
|
+
* @param query - User's search query (sanitized for FTS5 safety)
|
|
145
|
+
* @param options - Optional limit and sessionId filter
|
|
146
|
+
* @returns SearchResult[] ordered by relevance (best match first)
|
|
147
|
+
*/
|
|
148
|
+
searchKeyword(query: string, options?: {
|
|
149
|
+
limit?: number;
|
|
150
|
+
sessionId?: string;
|
|
151
|
+
}): SearchResult[];
|
|
152
|
+
/**
|
|
153
|
+
* Prefix search for autocomplete-style matching.
|
|
154
|
+
* Appends `*` to each word for prefix matching.
|
|
155
|
+
*/
|
|
156
|
+
searchByPrefix(prefix: string, limit?: number): SearchResult[];
|
|
157
|
+
/**
|
|
158
|
+
* Rebuild the FTS5 index if it gets out of sync.
|
|
159
|
+
*/
|
|
160
|
+
rebuildIndex(): void;
|
|
161
|
+
/**
|
|
162
|
+
* Sanitizes a user query for safe FTS5 MATCH usage.
|
|
163
|
+
* Removes FTS5 operators and special characters.
|
|
164
|
+
* Returns null if the query is empty after sanitization.
|
|
165
|
+
*/
|
|
166
|
+
private sanitizeQuery;
|
|
167
|
+
/**
|
|
168
|
+
* Sanitizes a single word for FTS5 safety.
|
|
169
|
+
* Removes quotes, parentheses, asterisks, and FTS5 operator keywords.
|
|
170
|
+
*/
|
|
171
|
+
private sanitizeWord;
|
|
172
|
+
}
|
|
173
|
+
//#endregion
|
|
174
|
+
//#region src/storage/embeddings.d.ts
|
|
175
|
+
/** A single search result with observation ID and cosine distance. */
|
|
176
|
+
interface EmbeddingSearchResult {
|
|
177
|
+
observationId: string;
|
|
178
|
+
distance: number;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Data layer for vector insert/query against the cosine-distance vec0 table.
|
|
182
|
+
*
|
|
183
|
+
* All methods catch errors internally and return empty/default values for
|
|
184
|
+
* graceful degradation (DQ-03). Uses debug('embed', ...) logging.
|
|
185
|
+
*/
|
|
186
|
+
declare class EmbeddingStore {
|
|
187
|
+
private db;
|
|
188
|
+
private projectHash;
|
|
189
|
+
private stmtInsert;
|
|
190
|
+
private stmtSearch;
|
|
191
|
+
private stmtDelete;
|
|
192
|
+
private stmtExists;
|
|
193
|
+
private stmtFindUnembedded;
|
|
194
|
+
constructor(db: Database.Database, projectHash: string);
|
|
195
|
+
/**
|
|
196
|
+
* Stores an embedding for an observation.
|
|
197
|
+
*
|
|
198
|
+
* Uses INSERT OR REPLACE so re-embedding an observation overwrites
|
|
199
|
+
* the old vector.
|
|
200
|
+
*/
|
|
201
|
+
store(observationId: string, embedding: Float32Array): void;
|
|
202
|
+
/**
|
|
203
|
+
* Project-scoped KNN search using cosine distance.
|
|
204
|
+
*
|
|
205
|
+
* Returns the nearest observations ordered by distance (ascending).
|
|
206
|
+
* Only returns observations belonging to this store's project that
|
|
207
|
+
* have not been soft-deleted.
|
|
208
|
+
*/
|
|
209
|
+
search(queryEmbedding: Float32Array, limit?: number): EmbeddingSearchResult[];
|
|
210
|
+
/**
|
|
211
|
+
* Removes the embedding for a deleted observation.
|
|
212
|
+
*/
|
|
213
|
+
delete(observationId: string): void;
|
|
214
|
+
/**
|
|
215
|
+
* Checks if an observation has an embedding stored.
|
|
216
|
+
*/
|
|
217
|
+
has(observationId: string): boolean;
|
|
218
|
+
/**
|
|
219
|
+
* Finds observation IDs that need embeddings generated.
|
|
220
|
+
*
|
|
221
|
+
* Returns IDs of observations belonging to this project that are
|
|
222
|
+
* not soft-deleted and have no entry in the embeddings table.
|
|
223
|
+
*/
|
|
224
|
+
findUnembedded(limit?: number): string[];
|
|
225
|
+
}
|
|
226
|
+
//#endregion
|
|
227
|
+
//#region src/types/stash.d.ts
|
|
228
|
+
/**
|
|
229
|
+
* Type definitions for context stashing.
|
|
230
|
+
*
|
|
231
|
+
* Context stashing is the persistence mechanism for topic detection (Phase 6).
|
|
232
|
+
* When a topic shift is detected, the current thread's observations and summary
|
|
233
|
+
* are snapshotted into a stash record so the user can resume later.
|
|
234
|
+
*/
|
|
235
|
+
/**
|
|
236
|
+
* A snapshot of a single observation stored within a stash.
|
|
237
|
+
* Captures the observation's content at the time of stashing so the stash
|
|
238
|
+
* remains self-contained even if the original observation is later modified.
|
|
239
|
+
*/
|
|
240
|
+
interface StashObservation {
|
|
241
|
+
id: string;
|
|
242
|
+
content: string;
|
|
243
|
+
type: string;
|
|
244
|
+
timestamp: string;
|
|
245
|
+
embedding: number[] | null;
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* A stashed context thread -- a frozen snapshot of observations and their
|
|
249
|
+
* summary at the moment a topic shift was detected.
|
|
250
|
+
*/
|
|
251
|
+
interface ContextStash {
|
|
252
|
+
id: string;
|
|
253
|
+
projectId: string;
|
|
254
|
+
sessionId: string;
|
|
255
|
+
topicLabel: string;
|
|
256
|
+
summary: string;
|
|
257
|
+
observationIds: string[];
|
|
258
|
+
observationSnapshots: StashObservation[];
|
|
259
|
+
createdAt: string;
|
|
260
|
+
resumedAt: string | null;
|
|
261
|
+
status: 'stashed' | 'resumed' | 'expired';
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Input for creating a new stash record.
|
|
265
|
+
* Omits generated fields (id, createdAt, resumedAt, status, observationIds)
|
|
266
|
+
* since those are derived during creation.
|
|
267
|
+
*/
|
|
268
|
+
interface CreateStashInput {
|
|
269
|
+
projectId: string;
|
|
270
|
+
sessionId: string;
|
|
271
|
+
topicLabel: string;
|
|
272
|
+
summary: string;
|
|
273
|
+
observations: StashObservation[];
|
|
274
|
+
}
|
|
275
|
+
//#endregion
|
|
276
|
+
//#region src/storage/stash-manager.d.ts
|
|
277
|
+
/**
|
|
278
|
+
* Repository for context stash CRUD operations.
|
|
279
|
+
*
|
|
280
|
+
* Manages the lifecycle of stashed context threads: creating snapshots
|
|
281
|
+
* when topic shifts are detected, listing available stashes, retrieving
|
|
282
|
+
* full stash records, resuming stashes, and deleting them.
|
|
283
|
+
*
|
|
284
|
+
* All SQL statements are prepared once in the constructor and reused
|
|
285
|
+
* for every call (better-sqlite3 performance best practice).
|
|
286
|
+
*/
|
|
287
|
+
declare class StashManager {
|
|
288
|
+
private readonly db;
|
|
289
|
+
private readonly stmtInsert;
|
|
290
|
+
private readonly stmtGetById;
|
|
291
|
+
private readonly stmtResume;
|
|
292
|
+
private readonly stmtDelete;
|
|
293
|
+
constructor(db: Database.Database);
|
|
294
|
+
/**
|
|
295
|
+
* Creates a new stash record from a context thread snapshot.
|
|
296
|
+
* JSON-serializes observation snapshots and IDs for TEXT column storage.
|
|
297
|
+
* Uses randomBytes(16) hex for ID generation (matches ObservationRepository pattern).
|
|
298
|
+
*/
|
|
299
|
+
createStash(input: CreateStashInput): ContextStash;
|
|
300
|
+
/**
|
|
301
|
+
* Lists stashes for a project, ordered by created_at DESC.
|
|
302
|
+
* Supports optional filtering by session_id and status.
|
|
303
|
+
*/
|
|
304
|
+
listStashes(projectId: string, options?: {
|
|
305
|
+
sessionId?: string;
|
|
306
|
+
status?: string;
|
|
307
|
+
limit?: number;
|
|
308
|
+
}): ContextStash[];
|
|
309
|
+
/**
|
|
310
|
+
* Retrieves a single stash by ID with full observation snapshot data.
|
|
311
|
+
* Returns null for nonexistent IDs.
|
|
312
|
+
*/
|
|
313
|
+
getStash(id: string): ContextStash | null;
|
|
314
|
+
/**
|
|
315
|
+
* Marks a stash as resumed and sets resumed_at timestamp.
|
|
316
|
+
* Returns the updated record.
|
|
317
|
+
* Throws if the stash does not exist.
|
|
318
|
+
*/
|
|
319
|
+
resumeStash(id: string): ContextStash;
|
|
320
|
+
/**
|
|
321
|
+
* Hard-deletes a stash record.
|
|
322
|
+
*/
|
|
323
|
+
deleteStash(id: string): void;
|
|
324
|
+
/**
|
|
325
|
+
* Returns stashes with status='stashed' (excludes resumed) for a project,
|
|
326
|
+
* ordered by created_at DESC.
|
|
327
|
+
*/
|
|
328
|
+
getRecentStashes(projectId: string, limit?: number): ContextStash[];
|
|
329
|
+
}
|
|
330
|
+
//#endregion
|
|
331
|
+
//#region src/intelligence/adaptive-threshold.d.ts
|
|
332
|
+
/**
|
|
333
|
+
* Internal state of the adaptive threshold computation.
|
|
334
|
+
*/
|
|
335
|
+
interface ThresholdState {
|
|
336
|
+
/** Exponentially weighted moving average of observed distances */
|
|
337
|
+
ewmaDistance: number;
|
|
338
|
+
/** Exponentially weighted variance of observed distances */
|
|
339
|
+
ewmaVariance: number;
|
|
340
|
+
/** Decay factor for EWMA (0 < alpha <= 1) */
|
|
341
|
+
alpha: number;
|
|
342
|
+
/** Standard deviations above the mean for threshold */
|
|
343
|
+
sensitivityMultiplier: number;
|
|
344
|
+
/** Number of distance observations processed */
|
|
345
|
+
observationCount: number;
|
|
346
|
+
}
|
|
347
|
+
//#endregion
|
|
348
|
+
//#region src/storage/threshold-store.d.ts
|
|
349
|
+
/**
|
|
350
|
+
* Result of loading historical seed data for cold start.
|
|
351
|
+
*/
|
|
352
|
+
interface HistoricalSeed {
|
|
353
|
+
/** Average EWMA distance across recent sessions */
|
|
354
|
+
averageDistance: number;
|
|
355
|
+
/** Average EWMA variance across recent sessions */
|
|
356
|
+
averageVariance: number;
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* Persists and loads EWMA threshold history for session seeding.
|
|
360
|
+
*
|
|
361
|
+
* At the end of each session, the final EWMA state is saved via
|
|
362
|
+
* saveSessionThreshold(). When a new session starts, loadHistoricalSeed()
|
|
363
|
+
* computes averages from the last 10 sessions to bootstrap the EWMA
|
|
364
|
+
* without cold-start problems.
|
|
365
|
+
*
|
|
366
|
+
* All SQL statements are prepared once in the constructor and reused
|
|
367
|
+
* for every call (better-sqlite3 performance best practice).
|
|
368
|
+
*/
|
|
369
|
+
declare class ThresholdStore {
|
|
370
|
+
private readonly db;
|
|
371
|
+
private readonly stmtInsert;
|
|
372
|
+
private readonly stmtLoadSeed;
|
|
373
|
+
constructor(db: Database.Database);
|
|
374
|
+
/**
|
|
375
|
+
* Persist the final EWMA state of a session for future seeding.
|
|
376
|
+
*/
|
|
377
|
+
saveSessionThreshold(projectId: string, sessionId: string, state: ThresholdState): void;
|
|
378
|
+
/**
|
|
379
|
+
* Load historical seed by averaging the last 10 sessions for a project.
|
|
380
|
+
*
|
|
381
|
+
* Returns null if no history exists for this project.
|
|
382
|
+
*/
|
|
383
|
+
loadHistoricalSeed(projectId: string): HistoricalSeed | null;
|
|
384
|
+
}
|
|
385
|
+
//#endregion
|
|
386
|
+
//#region src/shared/config.d.ts
|
|
387
|
+
/**
|
|
388
|
+
* Returns whether debug logging is enabled for this process.
|
|
389
|
+
*
|
|
390
|
+
* Resolution order:
|
|
391
|
+
* 1. `LAMINARK_DEBUG` env var -- `"1"` or `"true"` enables debug mode
|
|
392
|
+
* 2. `~/.laminark/config.json` -- `{ "debug": true }` enables debug mode
|
|
393
|
+
* 3. Default: disabled
|
|
394
|
+
*
|
|
395
|
+
* The result is cached after the first call.
|
|
396
|
+
*/
|
|
397
|
+
declare function isDebugEnabled(): boolean;
|
|
398
|
+
/**
|
|
399
|
+
* Returns the path to the single Laminark database file.
|
|
400
|
+
* Single database at ~/.claude/plugins/cache/laminark/data/data.db for ALL projects.
|
|
401
|
+
*/
|
|
402
|
+
declare function getDbPath(): string;
|
|
403
|
+
/**
|
|
404
|
+
* Creates a deterministic SHA-256 hash of a project directory path.
|
|
405
|
+
* Uses realpathSync to canonicalize (resolves symlinks) to prevent
|
|
406
|
+
* multiple hashes for the same directory via different paths.
|
|
407
|
+
*
|
|
408
|
+
* @param projectDir - The project directory path to hash
|
|
409
|
+
* @returns First 16 hex characters of the SHA-256 hash
|
|
410
|
+
*/
|
|
411
|
+
declare function getProjectHash(projectDir: string): string;
|
|
412
|
+
/**
|
|
413
|
+
* Returns the default database configuration.
|
|
414
|
+
*/
|
|
415
|
+
declare function getDatabaseConfig(): DatabaseConfig;
|
|
416
|
+
//#endregion
|
|
417
|
+
//#region src/shared/debug.d.ts
|
|
418
|
+
/**
|
|
419
|
+
* Logs a debug message to stderr when debug mode is active.
|
|
420
|
+
*
|
|
421
|
+
* When debug is disabled (the default), this is a near-zero-cost no-op after the
|
|
422
|
+
* first call -- the cached flag short-circuits immediately.
|
|
423
|
+
*
|
|
424
|
+
* Format: `[ISO_TIMESTAMP] [LAMINARK:category] message {json_data}`
|
|
425
|
+
*
|
|
426
|
+
* @param category - Debug category (e.g., 'db', 'obs', 'search', 'session')
|
|
427
|
+
* @param message - Human-readable log message
|
|
428
|
+
* @param data - Optional structured data to include (keep lightweight -- no large payloads)
|
|
429
|
+
*/
|
|
430
|
+
declare function debug(category: string, message: string, data?: Record<string, unknown>): void;
|
|
431
|
+
/**
|
|
432
|
+
* Wraps a synchronous function with timing instrumentation.
|
|
433
|
+
*
|
|
434
|
+
* When debug is disabled, calls `fn()` directly with zero overhead --
|
|
435
|
+
* no timing measurement, no wrapping.
|
|
436
|
+
*
|
|
437
|
+
* @param category - Debug category for the log line
|
|
438
|
+
* @param message - Description of the operation being timed
|
|
439
|
+
* @param fn - Synchronous function to execute and time
|
|
440
|
+
* @returns The return value of `fn()`
|
|
441
|
+
*/
|
|
442
|
+
declare function debugTimed<T>(category: string, message: string, fn: () => T): T;
|
|
443
|
+
//#endregion
|
|
444
|
+
export { type DatabaseConfig, type EmbeddingSearchResult, EmbeddingStore, type HistoricalSeed, type LaminarkDatabase, MIGRATIONS, type Migration, type Observation, type ObservationInsert, ObservationRepository, SearchEngine, type SearchResult, type Session, SessionRepository, StashManager, ThresholdStore, debug, debugTimed, getDatabaseConfig, getDbPath, getProjectHash, isDebugEnabled, openDatabase, runMigrations };
|
|
445
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/storage/database.ts","../../src/storage/migrations.ts","../../src/storage/sessions.ts","../../src/storage/search.ts","../../src/storage/embeddings.ts","../../src/types/stash.ts","../../src/storage/stash-manager.ts","../../src/intelligence/adaptive-threshold.ts","../../src/storage/threshold-store.ts","../../src/shared/config.ts","../../src/shared/debug.ts"],"mappings":";;;;;;AAcA;;;UAAiB,gBAAA;EACf,EAAA,EAAI,QAAA,CAAS,QAAA;EACb,gBAAA;EACA,KAAA;EACA,UAAA;AAAA;;;;AAaF;;;;;;;iBAAgB,YAAA,CAAa,MAAA,EAAQ,cAAA,GAAiB,gBAAA;;;;;;AAjBtD;UCRiB,SAAA;EACf,OAAA;EACA,IAAA;EACA,EAAA,aAAe,EAAA,EAAI,QAAA,CAAc,QAAA;AAAA;;;;;;;ADsBnC;;;;;;;;;;;;ACzBA;;;;;;;;;cAiCa,UAAA,EAAY,SAAA;;;AAAzB;;;;;AAyiBA;;;;;;;iBAAgB,aAAA,CACd,EAAA,EAAI,QAAA,CAAc,QAAA,EAClB,gBAAA;;;;;ADpkBF;;;;cEqBa,iBAAA;EAAA,iBACM,EAAA;EAAA,iBACA,WAAA;EAAA,iBAGA,UAAA;EAAA,iBACA,WAAA;EAAA,iBACA,aAAA;cAEL,EAAA,EAAI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