@orquentra/codebuddy 0.0.0-stage → 2.4.1

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.
Files changed (82) hide show
  1. package/ARCHITECTURE.md +269 -0
  2. package/CLAUDE_CODEX.md +433 -0
  3. package/LICENSE +21 -0
  4. package/README.md +55 -2
  5. package/WORKFLOW.md +152 -0
  6. package/dist/chunk-3ZELDCR3.js +204 -0
  7. package/dist/chunk-3ZELDCR3.js.map +1 -0
  8. package/dist/chunk-5OWZVZSO.js +476 -0
  9. package/dist/chunk-5OWZVZSO.js.map +1 -0
  10. package/dist/chunk-DSN5CEHO.js +175 -0
  11. package/dist/chunk-DSN5CEHO.js.map +1 -0
  12. package/dist/chunk-GDJH7XJC.js +119 -0
  13. package/dist/chunk-GDJH7XJC.js.map +1 -0
  14. package/dist/chunk-IBMJYIEP.js +1578 -0
  15. package/dist/chunk-IBMJYIEP.js.map +1 -0
  16. package/dist/chunk-IE2OUO54.js +199 -0
  17. package/dist/chunk-IE2OUO54.js.map +1 -0
  18. package/dist/chunk-IHQM2ZDV.js +19 -0
  19. package/dist/chunk-IHQM2ZDV.js.map +1 -0
  20. package/dist/chunk-ITGRANYW.js +63 -0
  21. package/dist/chunk-ITGRANYW.js.map +1 -0
  22. package/dist/chunk-K63EOA4B.js +416 -0
  23. package/dist/chunk-K63EOA4B.js.map +1 -0
  24. package/dist/chunk-OLFCOR4U.js +8580 -0
  25. package/dist/chunk-OLFCOR4U.js.map +1 -0
  26. package/dist/chunk-PQK3GKZH.js +98 -0
  27. package/dist/chunk-PQK3GKZH.js.map +1 -0
  28. package/dist/chunk-PYLH4MH5.js +34 -0
  29. package/dist/chunk-PYLH4MH5.js.map +1 -0
  30. package/dist/chunk-PZ5AY32C.js +10 -0
  31. package/dist/chunk-PZ5AY32C.js.map +1 -0
  32. package/dist/chunk-TI5TQD6D.js +324 -0
  33. package/dist/chunk-TI5TQD6D.js.map +1 -0
  34. package/dist/chunk-WHZSVY2L.js +144 -0
  35. package/dist/chunk-WHZSVY2L.js.map +1 -0
  36. package/dist/cli/index.d.ts +1 -0
  37. package/dist/cli/index.js +15 -0
  38. package/dist/cli/index.js.map +1 -0
  39. package/dist/codebuddy-D2xJ6hFk.d.ts +841 -0
  40. package/dist/config-S2TULOMK.js +11 -0
  41. package/dist/config-S2TULOMK.js.map +1 -0
  42. package/dist/index.d.ts +2527 -0
  43. package/dist/index.js +116 -0
  44. package/dist/index.js.map +1 -0
  45. package/dist/langgraph/index.d.ts +53 -0
  46. package/dist/langgraph/index.js +143 -0
  47. package/dist/langgraph/index.js.map +1 -0
  48. package/dist/lean-command-D6TZJEFX.js +13 -0
  49. package/dist/lean-command-D6TZJEFX.js.map +1 -0
  50. package/dist/main-BFDVQHKO.js +4575 -0
  51. package/dist/main-BFDVQHKO.js.map +1 -0
  52. package/dist/memory-NIBFAMY4.js +57 -0
  53. package/dist/memory-NIBFAMY4.js.map +1 -0
  54. package/dist/pretool-command-MQQ2UNQM.js +10 -0
  55. package/dist/pretool-command-MQQ2UNQM.js.map +1 -0
  56. package/dist/rerank-Q7MIFNKA.js +60 -0
  57. package/dist/rerank-Q7MIFNKA.js.map +1 -0
  58. package/dist/summaries-TSE44KUQ.js +18 -0
  59. package/dist/summaries-TSE44KUQ.js.map +1 -0
  60. package/dist/zvec-F27AR357.js +23 -0
  61. package/dist/zvec-F27AR357.js.map +1 -0
  62. package/docker-compose.yml +20 -0
  63. package/examples/claude-code/README.md +67 -0
  64. package/examples/claude-desktop/README.md +54 -0
  65. package/examples/claude-desktop/claude_desktop_config.json +13 -0
  66. package/examples/langgraph-agent/README.md +32 -0
  67. package/examples/langgraph-agent/index.ts +71 -0
  68. package/examples/multi-agent-handoff/README.md +35 -0
  69. package/examples/multi-agent-handoff/index.ts +68 -0
  70. package/package.json +108 -4
  71. package/src/db/migrations/0000_cultured_satana.sql +144 -0
  72. package/src/db/migrations/0001_embedding_lease.sql +3 -0
  73. package/src/db/migrations/0002_embedding_lease_token.sql +1 -0
  74. package/src/db/migrations/0003_embedding_space.sql +9 -0
  75. package/src/db/migrations/0004_markdown_reconcile.sql +5 -0
  76. package/src/db/migrations/0005_fact_propositions.sql +1 -0
  77. package/src/db/migrations/meta/0000_snapshot.json +1169 -0
  78. package/src/db/migrations/meta/0002_snapshot.json +1181 -0
  79. package/src/db/migrations/meta/0003_snapshot.json +1214 -0
  80. package/src/db/migrations/meta/0004_snapshot.json +1225 -0
  81. package/src/db/migrations/meta/0005_snapshot.json +1231 -0
  82. package/src/db/migrations/meta/_journal.json +48 -0
@@ -0,0 +1,2527 @@
1
+ import { a as CodeBuddyConfig, M as MemoryRepository, b as MemoryFileStore, C as CodeBuddy, N as NamespaceSummary, A as AgentWriteBreakdown, L as ListedFact, c as ModelProvider, d as ContextPolicy, e as PlanInput, P as PlannedContext, f as ProviderDiagnosticsHook, E as EmbeddingRequest, g as EmbeddingResponse, T as TextGenerationRequest, h as TextGenerationResponse } from './codebuddy-D2xJ6hFk.js';
2
+ export { i as CodeBuddyDependencies, j as CodeBuddyStatus, k as ConflictMode, l as EmbeddingSpace, m as EmbeddingWorker, F as FACT_CATEGORIES, n as FactCategory, o as FactFile, p as FactFileWrite, q as ForgetResult, I as INCIDENT_SEVERITIES, r as IncidentFactFile, s as IncidentSeverity, t as MemoryWriteType, u as PlannedMessage, v as PlannerStats, Q as QueryEmbedding, R as RecallInput, w as RecallResult, x as RememberBatchItem, y as RememberInput, z as RememberResult, S as ShareInput, B as ShareResult, D as SkipReason, G as SummaryFile, H as SummaryFileWrite, J as TraceSpan, K as Tracer, U as UnshareInput, O as UnshareResult, W as WorkerConfig, V as WorkerState, X as createTracer, Y as isLangSmithTracingEnabled } from './codebuddy-D2xJ6hFk.js';
3
+ import { z } from 'zod';
4
+ import * as drizzle_orm_postgres_js from 'drizzle-orm/postgres-js';
5
+ import postgres from 'postgres';
6
+ import * as drizzle_orm_pg_core from 'drizzle-orm/pg-core';
7
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
8
+ import { HfInference } from '@huggingface/inference';
9
+
10
+ /**
11
+ * Plan policy controls how strongly CodeBuddy nudges agents toward writing
12
+ * a plan before substantive work:
13
+ * - off: plans are never suggested or required.
14
+ * - suggest: agents are reminded to plan, but small tasks stay lightweight (default).
15
+ * - required: agents should refuse substantive changes without an active plan.
16
+ */
17
+ declare const PLAN_POLICIES: readonly ["off", "suggest", "required"];
18
+ type PlanPolicy = (typeof PLAN_POLICIES)[number];
19
+ type ConfigPermissionReport = {
20
+ path: string;
21
+ exists: boolean;
22
+ mode: string | null;
23
+ ok: boolean;
24
+ warning?: string;
25
+ };
26
+ type ProjectScaffoldReport = {
27
+ codebuddyDir: {
28
+ path: string;
29
+ exists: boolean;
30
+ ok: boolean;
31
+ warning?: string;
32
+ };
33
+ memoryFactsDir: {
34
+ path: string;
35
+ exists: boolean;
36
+ ok: boolean;
37
+ warning?: string;
38
+ };
39
+ memorySummariesDir: {
40
+ path: string;
41
+ exists: boolean;
42
+ ok: boolean;
43
+ warning?: string;
44
+ };
45
+ plansDir: {
46
+ path: string;
47
+ exists: boolean;
48
+ ok: boolean;
49
+ warning?: string;
50
+ };
51
+ gitignore: {
52
+ path: string;
53
+ exists: boolean;
54
+ ok: boolean;
55
+ warning?: string;
56
+ };
57
+ policies: {
58
+ path: string;
59
+ exists: boolean;
60
+ ok: boolean;
61
+ warning?: string;
62
+ };
63
+ };
64
+ declare function configPath(cwd?: string): string;
65
+ declare function initProjectScaffold(cwd?: string): Promise<{
66
+ codebuddyDir: string;
67
+ gitignorePath: string;
68
+ policyPath: string;
69
+ }>;
70
+ declare function initConfigFile(cwd?: string): Promise<{
71
+ path: string;
72
+ created: boolean;
73
+ }>;
74
+ /**
75
+ * `requireDatabase: false` (the MCP server) returns an empty `postgresUrl`
76
+ * instead of throwing, so file-based tools still run without PostgreSQL;
77
+ * `createRuntime` rejects the empty URL with the same message.
78
+ */
79
+ declare function loadRuntimeConfig(cwd?: string, options?: {
80
+ requireDatabase?: boolean;
81
+ }): Promise<CodeBuddyConfig>;
82
+ declare function checkConfigPermissions(cwd?: string): Promise<ConfigPermissionReport>;
83
+ declare function checkProjectScaffold(cwd?: string): Promise<ProjectScaffoldReport>;
84
+ /** Read the plan policy, honoring CODEBUDDY_PLAN_POLICY then the config file. */
85
+ declare function loadPlanPolicy(cwd?: string): Promise<PlanPolicy>;
86
+ /** Persist the plan policy into `.codebuddy/config.json`, creating it if needed. */
87
+ declare function setPlanPolicy(policy: PlanPolicy, cwd?: string): Promise<void>;
88
+ declare function redactSecrets(value: unknown): unknown;
89
+
90
+ type MigrationConflict = {
91
+ kind: "fact" | "summary";
92
+ id: string;
93
+ databaseChecksum: string;
94
+ fileChecksum: string;
95
+ };
96
+ type MigrationFailure = {
97
+ kind: "fact" | "summary";
98
+ id: string;
99
+ error: string;
100
+ };
101
+ type MigrationPreview = {
102
+ namespace: string;
103
+ dryRun: boolean;
104
+ facts: {
105
+ found: number;
106
+ existing: number;
107
+ toWrite: number;
108
+ conflicts: number;
109
+ written: number;
110
+ };
111
+ summaries: {
112
+ found: number;
113
+ existing: number;
114
+ toWrite: number;
115
+ conflicts: number;
116
+ written: number;
117
+ };
118
+ conflicts: MigrationConflict[];
119
+ failures: MigrationFailure[];
120
+ };
121
+ declare function migrateMemoryToFiles(input: {
122
+ repository: MemoryRepository;
123
+ store: MemoryFileStore;
124
+ namespace: string;
125
+ write: boolean;
126
+ }): Promise<MigrationPreview>;
127
+
128
+ type RuntimeHandle = {
129
+ memory: CodeBuddy;
130
+ repository: MemoryRepository;
131
+ close(): Promise<void>;
132
+ };
133
+ type CreateRuntimeOptions = {
134
+ /**
135
+ * When true (default for `serve`), enable pgvector and apply any pending
136
+ * SQL migrations before the SDK initialises. Safe to run repeatedly —
137
+ * Drizzle skips migrations it has already applied.
138
+ */
139
+ autoBootstrap?: boolean;
140
+ repositoryRoot?: string;
141
+ };
142
+ declare function createRuntime(config?: CodeBuddyConfig, options?: CreateRuntimeOptions): Promise<RuntimeHandle>;
143
+ declare function encodeFactCursor(fact: {
144
+ createdAt: Date;
145
+ id: string;
146
+ }): string;
147
+ declare function decodeFactCursor(cursor: string): {
148
+ createdAt: Date;
149
+ id: string;
150
+ };
151
+ declare function listFactsPage(memory: CodeBuddy, repository: MemoryRepository, input: {
152
+ subject?: string;
153
+ limit?: number;
154
+ cursor?: string;
155
+ }): Promise<{
156
+ nextCursor?: string;
157
+ facts: ListedFact[];
158
+ }>;
159
+ declare function inspectNamespace(repository: MemoryRepository, namespace?: string): Promise<{
160
+ namespaces: NamespaceSummary[];
161
+ agents: AgentWriteBreakdown[];
162
+ namespace?: never;
163
+ exists?: never;
164
+ facts?: never;
165
+ } | {
166
+ namespace: string;
167
+ exists: boolean;
168
+ facts: ListedFact[];
169
+ agents: AgentWriteBreakdown[];
170
+ namespaces?: never;
171
+ }>;
172
+ type DoctorReport = {
173
+ db: {
174
+ ok: boolean;
175
+ error?: string;
176
+ canConnect?: boolean;
177
+ postgresUrlSource?: string;
178
+ };
179
+ pgvector: {
180
+ ok: boolean;
181
+ error?: string;
182
+ };
183
+ vectors: {
184
+ count: number;
185
+ index: string | null;
186
+ needsTuning: boolean;
187
+ };
188
+ models: {
189
+ id: string;
190
+ reachable: boolean;
191
+ status: "unknown" | "warm" | "cold" | "gated" | "failed";
192
+ error?: string;
193
+ }[];
194
+ usage: {
195
+ last60s: number;
196
+ lastHour: number;
197
+ last24h: number;
198
+ estimatedDailyCapRemaining: number;
199
+ warning80Percent: boolean;
200
+ };
201
+ scaffold: Awaited<ReturnType<typeof checkProjectScaffold>>;
202
+ config: Awaited<ReturnType<typeof checkConfigPermissions>>;
203
+ namespace: {
204
+ expectedDefault: string;
205
+ configured: string | null;
206
+ runtime: string | null;
207
+ ok: boolean;
208
+ warning?: string;
209
+ };
210
+ };
211
+ declare function runDoctor(options?: {
212
+ config?: CodeBuddyConfig;
213
+ repository?: MemoryRepository;
214
+ provider?: ModelProvider;
215
+ skipModelCheck?: boolean;
216
+ }): Promise<DoctorReport>;
217
+
218
+ /**
219
+ * Plans are durable Markdown artifacts under `.codebuddy/plans/`. Git is
220
+ * the version history; PostgreSQL (when present) is a derived index, never
221
+ * the source of truth. This store owns the on-disk representation:
222
+ * schema, round-trip serialization, atomic writes, and the locks that keep
223
+ * concurrent CLI/MCP clients from corrupting a plan or approving two active
224
+ * plans in one namespace.
225
+ */
226
+ declare const PLAN_STATUSES: readonly ["draft", "approved", "executing", "complete", "abandoned"];
227
+ type PlanStatus = (typeof PLAN_STATUSES)[number];
228
+ /** A plan is "active" while approved or executing — at most one per namespace. */
229
+ declare const ACTIVE_PLAN_STATUSES: readonly PlanStatus[];
230
+ declare const plannedFileSchema: z.ZodObject<{
231
+ path: z.ZodString;
232
+ action: z.ZodEnum<{
233
+ delete: "delete";
234
+ create: "create";
235
+ edit: "edit";
236
+ }>;
237
+ notes: z.ZodDefault<z.ZodString>;
238
+ }, z.core.$strip>;
239
+ declare const plannedTestSchema: z.ZodObject<{
240
+ path: z.ZodString;
241
+ description: z.ZodDefault<z.ZodString>;
242
+ }, z.core.$strip>;
243
+ declare const planFrontMatterSchema: z.ZodObject<{
244
+ schemaVersion: z.ZodLiteral<1>;
245
+ id: z.ZodString;
246
+ namespace: z.ZodString;
247
+ type: z.ZodLiteral<"plan">;
248
+ title: z.ZodString;
249
+ status: z.ZodEnum<{
250
+ draft: "draft";
251
+ approved: "approved";
252
+ executing: "executing";
253
+ complete: "complete";
254
+ abandoned: "abandoned";
255
+ }>;
256
+ brief: z.ZodString;
257
+ filesToTouch: z.ZodDefault<z.ZodArray<z.ZodObject<{
258
+ path: z.ZodString;
259
+ action: z.ZodEnum<{
260
+ delete: "delete";
261
+ create: "create";
262
+ edit: "edit";
263
+ }>;
264
+ notes: z.ZodDefault<z.ZodString>;
265
+ }, z.core.$strip>>>;
266
+ testsToAdd: z.ZodDefault<z.ZodArray<z.ZodObject<{
267
+ path: z.ZodString;
268
+ description: z.ZodDefault<z.ZodString>;
269
+ }, z.core.$strip>>>;
270
+ outOfScope: z.ZodDefault<z.ZodArray<z.ZodString>>;
271
+ risks: z.ZodDefault<z.ZodArray<z.ZodString>>;
272
+ createdAt: z.ZodPreprocess<z.ZodString, unknown>;
273
+ createdByAgent: z.ZodNullable<z.ZodString>;
274
+ approvedAt: z.ZodNullable<z.ZodPreprocess<z.ZodNullable<z.ZodString>, unknown>>;
275
+ executingAt: z.ZodNullable<z.ZodPreprocess<z.ZodNullable<z.ZodString>, unknown>>;
276
+ completedAt: z.ZodNullable<z.ZodPreprocess<z.ZodNullable<z.ZodString>, unknown>>;
277
+ abandonedAt: z.ZodNullable<z.ZodPreprocess<z.ZodNullable<z.ZodString>, unknown>>;
278
+ commitSha: z.ZodNullable<z.ZodString>;
279
+ abandonReason: z.ZodNullable<z.ZodString>;
280
+ }, z.core.$strip>;
281
+ type PlannedFile = z.infer<typeof plannedFileSchema>;
282
+ type PlannedTest = z.infer<typeof plannedTestSchema>;
283
+ type PlanFrontMatter = z.infer<typeof planFrontMatterSchema>;
284
+ /** A fully materialized plan: front matter + Markdown body + on-disk path. */
285
+ type PlanSpec = PlanFrontMatter & {
286
+ body: string;
287
+ path: string;
288
+ };
289
+ /** Shape accepted by `writePlan` — path/schemaVersion/type are managed here. */
290
+ type PlanWrite = Omit<PlanFrontMatter, "schemaVersion" | "type"> & {
291
+ body: string;
292
+ };
293
+ type PlanLockOptions = {
294
+ /** Max time to wait for the lock before failing. */
295
+ timeoutMs?: number;
296
+ /** A lock older than this is considered abandoned and stolen. */
297
+ staleMs?: number;
298
+ /** Poll interval while waiting. */
299
+ pollMs?: number;
300
+ };
301
+ declare class PlanLockError extends Error {
302
+ constructor(resource: string);
303
+ }
304
+ declare class PlanValidationError extends Error {
305
+ constructor(path: string, issues: string[]);
306
+ }
307
+ declare class PlanFileStore {
308
+ readonly repositoryRoot: string;
309
+ readonly plansDirectory: string;
310
+ readonly locksDirectory: string;
311
+ constructor(repositoryRoot?: string);
312
+ writePlan(input: PlanWrite): Promise<string>;
313
+ readPlan(pathOrId: string): Promise<PlanSpec>;
314
+ listPlans(): Promise<PlanSpec[]>;
315
+ deletePlan(id: string): Promise<void>;
316
+ /**
317
+ * The single approved-or-executing plan in `namespace`, or null. If the
318
+ * filesystem somehow holds more than one (a hand edit, a crash mid-
319
+ * transition), the earliest-created wins and the situation is the
320
+ * caller's to reconcile.
321
+ */
322
+ findActivePlan(namespace: string): Promise<PlanSpec | null>;
323
+ /** Serialize amendments to a single plan. */
324
+ withPlanLock<T>(id: string, fn: () => Promise<T>, options?: PlanLockOptions): Promise<T>;
325
+ /**
326
+ * Serialize lifecycle transitions across an entire namespace so two
327
+ * clients cannot both promote a plan to active. Hold this around the
328
+ * read-active-then-write window.
329
+ */
330
+ withNamespaceLock<T>(namespace: string, fn: () => Promise<T>, options?: PlanLockOptions): Promise<T>;
331
+ private withLock;
332
+ private tryStealStaleLock;
333
+ private planPath;
334
+ private assertPlanId;
335
+ private safePath;
336
+ private prepareDirectory;
337
+ }
338
+
339
+ declare class PlanTransitionError extends Error {
340
+ constructor(from: PlanStatus, to: PlanStatus);
341
+ }
342
+ declare class PlanNotFoundError extends Error {
343
+ constructor(id: string);
344
+ }
345
+ declare class ActivePlanExistsError extends Error {
346
+ readonly activePlanId: string;
347
+ constructor(namespace: string, activePlanId: string);
348
+ }
349
+ type CreatePlanInput = {
350
+ namespace: string;
351
+ title: string;
352
+ brief: string;
353
+ body?: string;
354
+ filesToTouch?: PlannedFile[];
355
+ testsToAdd?: PlannedTest[];
356
+ outOfScope?: string[];
357
+ risks?: string[];
358
+ createdByAgent?: string | null;
359
+ now?: string;
360
+ };
361
+ type AmendPlanPatch = {
362
+ title?: string;
363
+ brief?: string;
364
+ body?: string;
365
+ filesToTouch?: PlannedFile[];
366
+ testsToAdd?: PlannedTest[];
367
+ outOfScope?: string[];
368
+ risks?: string[];
369
+ };
370
+ type CompleteOptions = {
371
+ commitSha?: string;
372
+ notes?: string;
373
+ };
374
+ type AbandonOptions = {
375
+ reason?: string;
376
+ };
377
+ declare class PlanLifecycle {
378
+ private readonly store;
379
+ constructor(store: PlanFileStore);
380
+ create(input: CreatePlanInput): Promise<PlanSpec>;
381
+ approve(id: string, now?: string): Promise<PlanSpec>;
382
+ start(id: string, now?: string): Promise<PlanSpec>;
383
+ complete(id: string, options?: CompleteOptions, now?: string): Promise<PlanSpec>;
384
+ abandon(id: string, options?: AbandonOptions, now?: string): Promise<PlanSpec>;
385
+ amend(id: string, patch: AmendPlanPatch): Promise<PlanSpec>;
386
+ current(namespace: string): Promise<PlanSpec | null>;
387
+ private assertTransition;
388
+ private require;
389
+ /** Rewrite the plan file with a partial set of changed fields. */
390
+ private rewrite;
391
+ }
392
+
393
+ declare const VECTOR_DIMENSIONS = 384;
394
+ declare const HNSW_M = 16;
395
+ declare const HNSW_EF_CONSTRUCTION = 64;
396
+ declare const memoryTypeEnum: drizzle_orm_pg_core.PgEnum<["interaction", "fact", "summary"]>;
397
+ declare const interactionRoleEnum: drizzle_orm_pg_core.PgEnum<["user", "assistant", "system"]>;
398
+ declare const embeddingOwnerTypeEnum: drizzle_orm_pg_core.PgEnum<["interaction", "fact", "summary"]>;
399
+ declare const embeddingStatusEnum: drizzle_orm_pg_core.PgEnum<["pending", "processing", "ready", "failed"]>;
400
+ declare const shareModeEnum: drizzle_orm_pg_core.PgEnum<["reference", "snapshot"]>;
401
+ declare const modelCallTypeEnum: drizzle_orm_pg_core.PgEnum<["embedding", "llm"]>;
402
+ declare const modelCallStatusEnum: drizzle_orm_pg_core.PgEnum<["success", "failed", "timeout", "rate_limited", "gated", "fallback"]>;
403
+ declare const auditActionEnum: drizzle_orm_pg_core.PgEnum<["remember", "remember_batch", "share", "forget", "config"]>;
404
+ declare const namespaces: drizzle_orm_pg_core.PgTableWithColumns<{
405
+ name: "namespaces";
406
+ schema: undefined;
407
+ columns: {
408
+ id: drizzle_orm_pg_core.PgColumn<{
409
+ name: "id";
410
+ tableName: "namespaces";
411
+ dataType: "string";
412
+ columnType: "PgText";
413
+ data: string;
414
+ driverParam: string;
415
+ notNull: true;
416
+ hasDefault: false;
417
+ isPrimaryKey: true;
418
+ isAutoincrement: false;
419
+ hasRuntimeDefault: false;
420
+ enumValues: [string, ...string[]];
421
+ baseColumn: never;
422
+ identity: undefined;
423
+ generated: undefined;
424
+ }, {}, {}>;
425
+ name: drizzle_orm_pg_core.PgColumn<{
426
+ name: "name";
427
+ tableName: "namespaces";
428
+ dataType: "string";
429
+ columnType: "PgText";
430
+ data: string;
431
+ driverParam: string;
432
+ notNull: true;
433
+ hasDefault: false;
434
+ isPrimaryKey: false;
435
+ isAutoincrement: false;
436
+ hasRuntimeDefault: false;
437
+ enumValues: [string, ...string[]];
438
+ baseColumn: never;
439
+ identity: undefined;
440
+ generated: undefined;
441
+ }, {}, {}>;
442
+ createdAt: drizzle_orm_pg_core.PgColumn<{
443
+ name: "created_at";
444
+ tableName: "namespaces";
445
+ dataType: "date";
446
+ columnType: "PgTimestamp";
447
+ data: Date;
448
+ driverParam: string;
449
+ notNull: true;
450
+ hasDefault: true;
451
+ isPrimaryKey: false;
452
+ isAutoincrement: false;
453
+ hasRuntimeDefault: false;
454
+ enumValues: undefined;
455
+ baseColumn: never;
456
+ identity: undefined;
457
+ generated: undefined;
458
+ }, {}, {}>;
459
+ updatedAt: drizzle_orm_pg_core.PgColumn<{
460
+ name: "updated_at";
461
+ tableName: "namespaces";
462
+ dataType: "date";
463
+ columnType: "PgTimestamp";
464
+ data: Date;
465
+ driverParam: string;
466
+ notNull: true;
467
+ hasDefault: true;
468
+ isPrimaryKey: false;
469
+ isAutoincrement: false;
470
+ hasRuntimeDefault: false;
471
+ enumValues: undefined;
472
+ baseColumn: never;
473
+ identity: undefined;
474
+ generated: undefined;
475
+ }, {}, {}>;
476
+ };
477
+ dialect: "pg";
478
+ }>;
479
+ declare const interactions: drizzle_orm_pg_core.PgTableWithColumns<{
480
+ name: "interactions";
481
+ schema: undefined;
482
+ columns: {
483
+ id: drizzle_orm_pg_core.PgColumn<{
484
+ name: "id";
485
+ tableName: "interactions";
486
+ dataType: "string";
487
+ columnType: "PgText";
488
+ data: string;
489
+ driverParam: string;
490
+ notNull: true;
491
+ hasDefault: false;
492
+ isPrimaryKey: true;
493
+ isAutoincrement: false;
494
+ hasRuntimeDefault: false;
495
+ enumValues: [string, ...string[]];
496
+ baseColumn: never;
497
+ identity: undefined;
498
+ generated: undefined;
499
+ }, {}, {}>;
500
+ namespaceId: drizzle_orm_pg_core.PgColumn<{
501
+ name: "namespace_id";
502
+ tableName: "interactions";
503
+ dataType: "string";
504
+ columnType: "PgText";
505
+ data: string;
506
+ driverParam: string;
507
+ notNull: true;
508
+ hasDefault: false;
509
+ isPrimaryKey: false;
510
+ isAutoincrement: false;
511
+ hasRuntimeDefault: false;
512
+ enumValues: [string, ...string[]];
513
+ baseColumn: never;
514
+ identity: undefined;
515
+ generated: undefined;
516
+ }, {}, {}>;
517
+ sessionId: drizzle_orm_pg_core.PgColumn<{
518
+ name: "session_id";
519
+ tableName: "interactions";
520
+ dataType: "string";
521
+ columnType: "PgText";
522
+ data: string;
523
+ driverParam: string;
524
+ notNull: true;
525
+ hasDefault: false;
526
+ isPrimaryKey: false;
527
+ isAutoincrement: false;
528
+ hasRuntimeDefault: false;
529
+ enumValues: [string, ...string[]];
530
+ baseColumn: never;
531
+ identity: undefined;
532
+ generated: undefined;
533
+ }, {}, {}>;
534
+ role: drizzle_orm_pg_core.PgColumn<{
535
+ name: "role";
536
+ tableName: "interactions";
537
+ dataType: "string";
538
+ columnType: "PgEnumColumn";
539
+ data: "user" | "assistant" | "system";
540
+ driverParam: string;
541
+ notNull: true;
542
+ hasDefault: true;
543
+ isPrimaryKey: false;
544
+ isAutoincrement: false;
545
+ hasRuntimeDefault: false;
546
+ enumValues: ["user", "assistant", "system"];
547
+ baseColumn: never;
548
+ identity: undefined;
549
+ generated: undefined;
550
+ }, {}, {}>;
551
+ content: drizzle_orm_pg_core.PgColumn<{
552
+ name: "content";
553
+ tableName: "interactions";
554
+ dataType: "string";
555
+ columnType: "PgText";
556
+ data: string;
557
+ driverParam: string;
558
+ notNull: true;
559
+ hasDefault: false;
560
+ isPrimaryKey: false;
561
+ isAutoincrement: false;
562
+ hasRuntimeDefault: false;
563
+ enumValues: [string, ...string[]];
564
+ baseColumn: never;
565
+ identity: undefined;
566
+ generated: undefined;
567
+ }, {}, {}>;
568
+ contentHash: drizzle_orm_pg_core.PgColumn<{
569
+ name: "content_hash";
570
+ tableName: "interactions";
571
+ dataType: "string";
572
+ columnType: "PgText";
573
+ data: string;
574
+ driverParam: string;
575
+ notNull: true;
576
+ hasDefault: false;
577
+ isPrimaryKey: false;
578
+ isAutoincrement: false;
579
+ hasRuntimeDefault: false;
580
+ enumValues: [string, ...string[]];
581
+ baseColumn: never;
582
+ identity: undefined;
583
+ generated: undefined;
584
+ }, {}, {}>;
585
+ tokenCount: drizzle_orm_pg_core.PgColumn<{
586
+ name: "token_count";
587
+ tableName: "interactions";
588
+ dataType: "number";
589
+ columnType: "PgInteger";
590
+ data: number;
591
+ driverParam: string | number;
592
+ notNull: true;
593
+ hasDefault: true;
594
+ isPrimaryKey: false;
595
+ isAutoincrement: false;
596
+ hasRuntimeDefault: false;
597
+ enumValues: undefined;
598
+ baseColumn: never;
599
+ identity: undefined;
600
+ generated: undefined;
601
+ }, {}, {}>;
602
+ createdByAgent: drizzle_orm_pg_core.PgColumn<{
603
+ name: "created_by_agent";
604
+ tableName: "interactions";
605
+ dataType: "string";
606
+ columnType: "PgText";
607
+ data: string;
608
+ driverParam: string;
609
+ notNull: false;
610
+ hasDefault: false;
611
+ isPrimaryKey: false;
612
+ isAutoincrement: false;
613
+ hasRuntimeDefault: false;
614
+ enumValues: [string, ...string[]];
615
+ baseColumn: never;
616
+ identity: undefined;
617
+ generated: undefined;
618
+ }, {}, {}>;
619
+ createdAt: drizzle_orm_pg_core.PgColumn<{
620
+ name: "created_at";
621
+ tableName: "interactions";
622
+ dataType: "date";
623
+ columnType: "PgTimestamp";
624
+ data: Date;
625
+ driverParam: string;
626
+ notNull: true;
627
+ hasDefault: true;
628
+ isPrimaryKey: false;
629
+ isAutoincrement: false;
630
+ hasRuntimeDefault: false;
631
+ enumValues: undefined;
632
+ baseColumn: never;
633
+ identity: undefined;
634
+ generated: undefined;
635
+ }, {}, {}>;
636
+ };
637
+ dialect: "pg";
638
+ }>;
639
+ declare const sessionSummaries: drizzle_orm_pg_core.PgTableWithColumns<{
640
+ name: "session_summaries";
641
+ schema: undefined;
642
+ columns: {
643
+ id: drizzle_orm_pg_core.PgColumn<{
644
+ name: "id";
645
+ tableName: "session_summaries";
646
+ dataType: "string";
647
+ columnType: "PgText";
648
+ data: string;
649
+ driverParam: string;
650
+ notNull: true;
651
+ hasDefault: false;
652
+ isPrimaryKey: true;
653
+ isAutoincrement: false;
654
+ hasRuntimeDefault: false;
655
+ enumValues: [string, ...string[]];
656
+ baseColumn: never;
657
+ identity: undefined;
658
+ generated: undefined;
659
+ }, {}, {}>;
660
+ namespaceId: drizzle_orm_pg_core.PgColumn<{
661
+ name: "namespace_id";
662
+ tableName: "session_summaries";
663
+ dataType: "string";
664
+ columnType: "PgText";
665
+ data: string;
666
+ driverParam: string;
667
+ notNull: true;
668
+ hasDefault: false;
669
+ isPrimaryKey: false;
670
+ isAutoincrement: false;
671
+ hasRuntimeDefault: false;
672
+ enumValues: [string, ...string[]];
673
+ baseColumn: never;
674
+ identity: undefined;
675
+ generated: undefined;
676
+ }, {}, {}>;
677
+ sessionId: drizzle_orm_pg_core.PgColumn<{
678
+ name: "session_id";
679
+ tableName: "session_summaries";
680
+ dataType: "string";
681
+ columnType: "PgText";
682
+ data: string;
683
+ driverParam: string;
684
+ notNull: true;
685
+ hasDefault: false;
686
+ isPrimaryKey: false;
687
+ isAutoincrement: false;
688
+ hasRuntimeDefault: false;
689
+ enumValues: [string, ...string[]];
690
+ baseColumn: never;
691
+ identity: undefined;
692
+ generated: undefined;
693
+ }, {}, {}>;
694
+ content: drizzle_orm_pg_core.PgColumn<{
695
+ name: "content";
696
+ tableName: "session_summaries";
697
+ dataType: "string";
698
+ columnType: "PgText";
699
+ data: string;
700
+ driverParam: string;
701
+ notNull: true;
702
+ hasDefault: false;
703
+ isPrimaryKey: false;
704
+ isAutoincrement: false;
705
+ hasRuntimeDefault: false;
706
+ enumValues: [string, ...string[]];
707
+ baseColumn: never;
708
+ identity: undefined;
709
+ generated: undefined;
710
+ }, {}, {}>;
711
+ version: drizzle_orm_pg_core.PgColumn<{
712
+ name: "version";
713
+ tableName: "session_summaries";
714
+ dataType: "number";
715
+ columnType: "PgInteger";
716
+ data: number;
717
+ driverParam: string | number;
718
+ notNull: true;
719
+ hasDefault: true;
720
+ isPrimaryKey: false;
721
+ isAutoincrement: false;
722
+ hasRuntimeDefault: false;
723
+ enumValues: undefined;
724
+ baseColumn: never;
725
+ identity: undefined;
726
+ generated: undefined;
727
+ }, {}, {}>;
728
+ tokenCount: drizzle_orm_pg_core.PgColumn<{
729
+ name: "token_count";
730
+ tableName: "session_summaries";
731
+ dataType: "number";
732
+ columnType: "PgInteger";
733
+ data: number;
734
+ driverParam: string | number;
735
+ notNull: true;
736
+ hasDefault: true;
737
+ isPrimaryKey: false;
738
+ isAutoincrement: false;
739
+ hasRuntimeDefault: false;
740
+ enumValues: undefined;
741
+ baseColumn: never;
742
+ identity: undefined;
743
+ generated: undefined;
744
+ }, {}, {}>;
745
+ createdByAgent: drizzle_orm_pg_core.PgColumn<{
746
+ name: "created_by_agent";
747
+ tableName: "session_summaries";
748
+ dataType: "string";
749
+ columnType: "PgText";
750
+ data: string;
751
+ driverParam: string;
752
+ notNull: false;
753
+ hasDefault: false;
754
+ isPrimaryKey: false;
755
+ isAutoincrement: false;
756
+ hasRuntimeDefault: false;
757
+ enumValues: [string, ...string[]];
758
+ baseColumn: never;
759
+ identity: undefined;
760
+ generated: undefined;
761
+ }, {}, {}>;
762
+ fileBacked: drizzle_orm_pg_core.PgColumn<{
763
+ name: "file_backed";
764
+ tableName: "session_summaries";
765
+ dataType: "boolean";
766
+ columnType: "PgBoolean";
767
+ data: boolean;
768
+ driverParam: boolean;
769
+ notNull: true;
770
+ hasDefault: true;
771
+ isPrimaryKey: false;
772
+ isAutoincrement: false;
773
+ hasRuntimeDefault: false;
774
+ enumValues: undefined;
775
+ baseColumn: never;
776
+ identity: undefined;
777
+ generated: undefined;
778
+ }, {}, {}>;
779
+ createdAt: drizzle_orm_pg_core.PgColumn<{
780
+ name: "created_at";
781
+ tableName: "session_summaries";
782
+ dataType: "date";
783
+ columnType: "PgTimestamp";
784
+ data: Date;
785
+ driverParam: string;
786
+ notNull: true;
787
+ hasDefault: true;
788
+ isPrimaryKey: false;
789
+ isAutoincrement: false;
790
+ hasRuntimeDefault: false;
791
+ enumValues: undefined;
792
+ baseColumn: never;
793
+ identity: undefined;
794
+ generated: undefined;
795
+ }, {}, {}>;
796
+ };
797
+ dialect: "pg";
798
+ }>;
799
+ declare const facts: drizzle_orm_pg_core.PgTableWithColumns<{
800
+ name: "facts";
801
+ schema: undefined;
802
+ columns: {
803
+ id: drizzle_orm_pg_core.PgColumn<{
804
+ name: "id";
805
+ tableName: "facts";
806
+ dataType: "string";
807
+ columnType: "PgText";
808
+ data: string;
809
+ driverParam: string;
810
+ notNull: true;
811
+ hasDefault: false;
812
+ isPrimaryKey: true;
813
+ isAutoincrement: false;
814
+ hasRuntimeDefault: false;
815
+ enumValues: [string, ...string[]];
816
+ baseColumn: never;
817
+ identity: undefined;
818
+ generated: undefined;
819
+ }, {}, {}>;
820
+ namespaceId: drizzle_orm_pg_core.PgColumn<{
821
+ name: "namespace_id";
822
+ tableName: "facts";
823
+ dataType: "string";
824
+ columnType: "PgText";
825
+ data: string;
826
+ driverParam: string;
827
+ notNull: true;
828
+ hasDefault: false;
829
+ isPrimaryKey: false;
830
+ isAutoincrement: false;
831
+ hasRuntimeDefault: false;
832
+ enumValues: [string, ...string[]];
833
+ baseColumn: never;
834
+ identity: undefined;
835
+ generated: undefined;
836
+ }, {}, {}>;
837
+ subject: drizzle_orm_pg_core.PgColumn<{
838
+ name: "subject";
839
+ tableName: "facts";
840
+ dataType: "string";
841
+ columnType: "PgText";
842
+ data: string;
843
+ driverParam: string;
844
+ notNull: true;
845
+ hasDefault: false;
846
+ isPrimaryKey: false;
847
+ isAutoincrement: false;
848
+ hasRuntimeDefault: false;
849
+ enumValues: [string, ...string[]];
850
+ baseColumn: never;
851
+ identity: undefined;
852
+ generated: undefined;
853
+ }, {}, {}>;
854
+ predicate: drizzle_orm_pg_core.PgColumn<{
855
+ name: "predicate";
856
+ tableName: "facts";
857
+ dataType: "string";
858
+ columnType: "PgText";
859
+ data: string;
860
+ driverParam: string;
861
+ notNull: true;
862
+ hasDefault: false;
863
+ isPrimaryKey: false;
864
+ isAutoincrement: false;
865
+ hasRuntimeDefault: false;
866
+ enumValues: [string, ...string[]];
867
+ baseColumn: never;
868
+ identity: undefined;
869
+ generated: undefined;
870
+ }, {}, {}>;
871
+ object: drizzle_orm_pg_core.PgColumn<{
872
+ name: "object";
873
+ tableName: "facts";
874
+ dataType: "string";
875
+ columnType: "PgText";
876
+ data: string;
877
+ driverParam: string;
878
+ notNull: true;
879
+ hasDefault: false;
880
+ isPrimaryKey: false;
881
+ isAutoincrement: false;
882
+ hasRuntimeDefault: false;
883
+ enumValues: [string, ...string[]];
884
+ baseColumn: never;
885
+ identity: undefined;
886
+ generated: undefined;
887
+ }, {}, {}>;
888
+ propositionKey: drizzle_orm_pg_core.PgColumn<{
889
+ name: "proposition_key";
890
+ tableName: "facts";
891
+ dataType: "string";
892
+ columnType: "PgText";
893
+ data: string;
894
+ driverParam: string;
895
+ notNull: false;
896
+ hasDefault: false;
897
+ isPrimaryKey: false;
898
+ isAutoincrement: false;
899
+ hasRuntimeDefault: false;
900
+ enumValues: [string, ...string[]];
901
+ baseColumn: never;
902
+ identity: undefined;
903
+ generated: undefined;
904
+ }, {}, {}>;
905
+ content: drizzle_orm_pg_core.PgColumn<{
906
+ name: "content";
907
+ tableName: "facts";
908
+ dataType: "string";
909
+ columnType: "PgText";
910
+ data: string;
911
+ driverParam: string;
912
+ notNull: true;
913
+ hasDefault: false;
914
+ isPrimaryKey: false;
915
+ isAutoincrement: false;
916
+ hasRuntimeDefault: false;
917
+ enumValues: [string, ...string[]];
918
+ baseColumn: never;
919
+ identity: undefined;
920
+ generated: undefined;
921
+ }, {}, {}>;
922
+ contentHash: drizzle_orm_pg_core.PgColumn<{
923
+ name: "content_hash";
924
+ tableName: "facts";
925
+ dataType: "string";
926
+ columnType: "PgText";
927
+ data: string;
928
+ driverParam: string;
929
+ notNull: true;
930
+ hasDefault: false;
931
+ isPrimaryKey: false;
932
+ isAutoincrement: false;
933
+ hasRuntimeDefault: false;
934
+ enumValues: [string, ...string[]];
935
+ baseColumn: never;
936
+ identity: undefined;
937
+ generated: undefined;
938
+ }, {}, {}>;
939
+ confidence: drizzle_orm_pg_core.PgColumn<{
940
+ name: "confidence";
941
+ tableName: "facts";
942
+ dataType: "string";
943
+ columnType: "PgNumeric";
944
+ data: string;
945
+ driverParam: string;
946
+ notNull: true;
947
+ hasDefault: true;
948
+ isPrimaryKey: false;
949
+ isAutoincrement: false;
950
+ hasRuntimeDefault: false;
951
+ enumValues: undefined;
952
+ baseColumn: never;
953
+ identity: undefined;
954
+ generated: undefined;
955
+ }, {}, {}>;
956
+ sourceInteractionId: drizzle_orm_pg_core.PgColumn<{
957
+ name: "source_interaction_id";
958
+ tableName: "facts";
959
+ dataType: "string";
960
+ columnType: "PgText";
961
+ data: string;
962
+ driverParam: string;
963
+ notNull: false;
964
+ hasDefault: false;
965
+ isPrimaryKey: false;
966
+ isAutoincrement: false;
967
+ hasRuntimeDefault: false;
968
+ enumValues: [string, ...string[]];
969
+ baseColumn: never;
970
+ identity: undefined;
971
+ generated: undefined;
972
+ }, {}, {}>;
973
+ sourceDeleted: drizzle_orm_pg_core.PgColumn<{
974
+ name: "source_deleted";
975
+ tableName: "facts";
976
+ dataType: "boolean";
977
+ columnType: "PgBoolean";
978
+ data: boolean;
979
+ driverParam: boolean;
980
+ notNull: true;
981
+ hasDefault: true;
982
+ isPrimaryKey: false;
983
+ isAutoincrement: false;
984
+ hasRuntimeDefault: false;
985
+ enumValues: undefined;
986
+ baseColumn: never;
987
+ identity: undefined;
988
+ generated: undefined;
989
+ }, {}, {}>;
990
+ supersededBy: drizzle_orm_pg_core.PgColumn<{
991
+ name: "superseded_by";
992
+ tableName: "facts";
993
+ dataType: "string";
994
+ columnType: "PgText";
995
+ data: string;
996
+ driverParam: string;
997
+ notNull: false;
998
+ hasDefault: false;
999
+ isPrimaryKey: false;
1000
+ isAutoincrement: false;
1001
+ hasRuntimeDefault: false;
1002
+ enumValues: [string, ...string[]];
1003
+ baseColumn: never;
1004
+ identity: undefined;
1005
+ generated: undefined;
1006
+ }, {}, {}>;
1007
+ fileBacked: drizzle_orm_pg_core.PgColumn<{
1008
+ name: "file_backed";
1009
+ tableName: "facts";
1010
+ dataType: "boolean";
1011
+ columnType: "PgBoolean";
1012
+ data: boolean;
1013
+ driverParam: boolean;
1014
+ notNull: true;
1015
+ hasDefault: true;
1016
+ isPrimaryKey: false;
1017
+ isAutoincrement: false;
1018
+ hasRuntimeDefault: false;
1019
+ enumValues: undefined;
1020
+ baseColumn: never;
1021
+ identity: undefined;
1022
+ generated: undefined;
1023
+ }, {}, {}>;
1024
+ embeddingModel: drizzle_orm_pg_core.PgColumn<{
1025
+ name: "embedding_model";
1026
+ tableName: "facts";
1027
+ dataType: "string";
1028
+ columnType: "PgText";
1029
+ data: string;
1030
+ driverParam: string;
1031
+ notNull: false;
1032
+ hasDefault: false;
1033
+ isPrimaryKey: false;
1034
+ isAutoincrement: false;
1035
+ hasRuntimeDefault: false;
1036
+ enumValues: [string, ...string[]];
1037
+ baseColumn: never;
1038
+ identity: undefined;
1039
+ generated: undefined;
1040
+ }, {}, {}>;
1041
+ createdByAgent: drizzle_orm_pg_core.PgColumn<{
1042
+ name: "created_by_agent";
1043
+ tableName: "facts";
1044
+ dataType: "string";
1045
+ columnType: "PgText";
1046
+ data: string;
1047
+ driverParam: string;
1048
+ notNull: false;
1049
+ hasDefault: false;
1050
+ isPrimaryKey: false;
1051
+ isAutoincrement: false;
1052
+ hasRuntimeDefault: false;
1053
+ enumValues: [string, ...string[]];
1054
+ baseColumn: never;
1055
+ identity: undefined;
1056
+ generated: undefined;
1057
+ }, {}, {}>;
1058
+ createdAt: drizzle_orm_pg_core.PgColumn<{
1059
+ name: "created_at";
1060
+ tableName: "facts";
1061
+ dataType: "date";
1062
+ columnType: "PgTimestamp";
1063
+ data: Date;
1064
+ driverParam: string;
1065
+ notNull: true;
1066
+ hasDefault: true;
1067
+ isPrimaryKey: false;
1068
+ isAutoincrement: false;
1069
+ hasRuntimeDefault: false;
1070
+ enumValues: undefined;
1071
+ baseColumn: never;
1072
+ identity: undefined;
1073
+ generated: undefined;
1074
+ }, {}, {}>;
1075
+ updatedAt: drizzle_orm_pg_core.PgColumn<{
1076
+ name: "updated_at";
1077
+ tableName: "facts";
1078
+ dataType: "date";
1079
+ columnType: "PgTimestamp";
1080
+ data: Date;
1081
+ driverParam: string;
1082
+ notNull: true;
1083
+ hasDefault: true;
1084
+ isPrimaryKey: false;
1085
+ isAutoincrement: false;
1086
+ hasRuntimeDefault: false;
1087
+ enumValues: undefined;
1088
+ baseColumn: never;
1089
+ identity: undefined;
1090
+ generated: undefined;
1091
+ }, {}, {}>;
1092
+ };
1093
+ dialect: "pg";
1094
+ }>;
1095
+ declare const embeddings: drizzle_orm_pg_core.PgTableWithColumns<{
1096
+ name: "embeddings";
1097
+ schema: undefined;
1098
+ columns: {
1099
+ id: drizzle_orm_pg_core.PgColumn<{
1100
+ name: "id";
1101
+ tableName: "embeddings";
1102
+ dataType: "string";
1103
+ columnType: "PgText";
1104
+ data: string;
1105
+ driverParam: string;
1106
+ notNull: true;
1107
+ hasDefault: false;
1108
+ isPrimaryKey: true;
1109
+ isAutoincrement: false;
1110
+ hasRuntimeDefault: false;
1111
+ enumValues: [string, ...string[]];
1112
+ baseColumn: never;
1113
+ identity: undefined;
1114
+ generated: undefined;
1115
+ }, {}, {}>;
1116
+ namespaceId: drizzle_orm_pg_core.PgColumn<{
1117
+ name: "namespace_id";
1118
+ tableName: "embeddings";
1119
+ dataType: "string";
1120
+ columnType: "PgText";
1121
+ data: string;
1122
+ driverParam: string;
1123
+ notNull: true;
1124
+ hasDefault: false;
1125
+ isPrimaryKey: false;
1126
+ isAutoincrement: false;
1127
+ hasRuntimeDefault: false;
1128
+ enumValues: [string, ...string[]];
1129
+ baseColumn: never;
1130
+ identity: undefined;
1131
+ generated: undefined;
1132
+ }, {}, {}>;
1133
+ ownerType: drizzle_orm_pg_core.PgColumn<{
1134
+ name: "owner_type";
1135
+ tableName: "embeddings";
1136
+ dataType: "string";
1137
+ columnType: "PgEnumColumn";
1138
+ data: "interaction" | "fact" | "summary";
1139
+ driverParam: string;
1140
+ notNull: true;
1141
+ hasDefault: false;
1142
+ isPrimaryKey: false;
1143
+ isAutoincrement: false;
1144
+ hasRuntimeDefault: false;
1145
+ enumValues: ["interaction", "fact", "summary"];
1146
+ baseColumn: never;
1147
+ identity: undefined;
1148
+ generated: undefined;
1149
+ }, {}, {}>;
1150
+ ownerId: drizzle_orm_pg_core.PgColumn<{
1151
+ name: "owner_id";
1152
+ tableName: "embeddings";
1153
+ dataType: "string";
1154
+ columnType: "PgText";
1155
+ data: string;
1156
+ driverParam: string;
1157
+ notNull: true;
1158
+ hasDefault: false;
1159
+ isPrimaryKey: false;
1160
+ isAutoincrement: false;
1161
+ hasRuntimeDefault: false;
1162
+ enumValues: [string, ...string[]];
1163
+ baseColumn: never;
1164
+ identity: undefined;
1165
+ generated: undefined;
1166
+ }, {}, {}>;
1167
+ vector: drizzle_orm_pg_core.PgColumn<{
1168
+ name: "vector";
1169
+ tableName: "embeddings";
1170
+ dataType: "custom";
1171
+ columnType: "PgCustomColumn";
1172
+ data: string;
1173
+ driverParam: string;
1174
+ notNull: true;
1175
+ hasDefault: false;
1176
+ isPrimaryKey: false;
1177
+ isAutoincrement: false;
1178
+ hasRuntimeDefault: false;
1179
+ enumValues: undefined;
1180
+ baseColumn: never;
1181
+ identity: undefined;
1182
+ generated: undefined;
1183
+ }, {}, {
1184
+ pgColumnBuilderBrand: "PgCustomColumnBuilderBrand";
1185
+ }>;
1186
+ embeddingModel: drizzle_orm_pg_core.PgColumn<{
1187
+ name: "embedding_model";
1188
+ tableName: "embeddings";
1189
+ dataType: "string";
1190
+ columnType: "PgText";
1191
+ data: string;
1192
+ driverParam: string;
1193
+ notNull: true;
1194
+ hasDefault: false;
1195
+ isPrimaryKey: false;
1196
+ isAutoincrement: false;
1197
+ hasRuntimeDefault: false;
1198
+ enumValues: [string, ...string[]];
1199
+ baseColumn: never;
1200
+ identity: undefined;
1201
+ generated: undefined;
1202
+ }, {}, {}>;
1203
+ embeddingSpace: drizzle_orm_pg_core.PgColumn<{
1204
+ name: "embedding_space";
1205
+ tableName: "embeddings";
1206
+ dataType: "string";
1207
+ columnType: "PgText";
1208
+ data: string;
1209
+ driverParam: string;
1210
+ notNull: false;
1211
+ hasDefault: false;
1212
+ isPrimaryKey: false;
1213
+ isAutoincrement: false;
1214
+ hasRuntimeDefault: false;
1215
+ enumValues: [string, ...string[]];
1216
+ baseColumn: never;
1217
+ identity: undefined;
1218
+ generated: undefined;
1219
+ }, {}, {}>;
1220
+ status: drizzle_orm_pg_core.PgColumn<{
1221
+ name: "status";
1222
+ tableName: "embeddings";
1223
+ dataType: "string";
1224
+ columnType: "PgEnumColumn";
1225
+ data: "pending" | "processing" | "ready" | "failed";
1226
+ driverParam: string;
1227
+ notNull: true;
1228
+ hasDefault: true;
1229
+ isPrimaryKey: false;
1230
+ isAutoincrement: false;
1231
+ hasRuntimeDefault: false;
1232
+ enumValues: ["pending", "processing", "ready", "failed"];
1233
+ baseColumn: never;
1234
+ identity: undefined;
1235
+ generated: undefined;
1236
+ }, {}, {}>;
1237
+ attempts: drizzle_orm_pg_core.PgColumn<{
1238
+ name: "attempts";
1239
+ tableName: "embeddings";
1240
+ dataType: "number";
1241
+ columnType: "PgInteger";
1242
+ data: number;
1243
+ driverParam: string | number;
1244
+ notNull: true;
1245
+ hasDefault: true;
1246
+ isPrimaryKey: false;
1247
+ isAutoincrement: false;
1248
+ hasRuntimeDefault: false;
1249
+ enumValues: undefined;
1250
+ baseColumn: never;
1251
+ identity: undefined;
1252
+ generated: undefined;
1253
+ }, {}, {}>;
1254
+ lastError: drizzle_orm_pg_core.PgColumn<{
1255
+ name: "last_error";
1256
+ tableName: "embeddings";
1257
+ dataType: "string";
1258
+ columnType: "PgText";
1259
+ data: string;
1260
+ driverParam: string;
1261
+ notNull: false;
1262
+ hasDefault: false;
1263
+ isPrimaryKey: false;
1264
+ isAutoincrement: false;
1265
+ hasRuntimeDefault: false;
1266
+ enumValues: [string, ...string[]];
1267
+ baseColumn: never;
1268
+ identity: undefined;
1269
+ generated: undefined;
1270
+ }, {}, {}>;
1271
+ leaseUntil: drizzle_orm_pg_core.PgColumn<{
1272
+ name: "lease_until";
1273
+ tableName: "embeddings";
1274
+ dataType: "date";
1275
+ columnType: "PgTimestamp";
1276
+ data: Date;
1277
+ driverParam: string;
1278
+ notNull: false;
1279
+ hasDefault: false;
1280
+ isPrimaryKey: false;
1281
+ isAutoincrement: false;
1282
+ hasRuntimeDefault: false;
1283
+ enumValues: undefined;
1284
+ baseColumn: never;
1285
+ identity: undefined;
1286
+ generated: undefined;
1287
+ }, {}, {}>;
1288
+ leaseToken: drizzle_orm_pg_core.PgColumn<{
1289
+ name: "lease_token";
1290
+ tableName: "embeddings";
1291
+ dataType: "string";
1292
+ columnType: "PgText";
1293
+ data: string;
1294
+ driverParam: string;
1295
+ notNull: false;
1296
+ hasDefault: false;
1297
+ isPrimaryKey: false;
1298
+ isAutoincrement: false;
1299
+ hasRuntimeDefault: false;
1300
+ enumValues: [string, ...string[]];
1301
+ baseColumn: never;
1302
+ identity: undefined;
1303
+ generated: undefined;
1304
+ }, {}, {}>;
1305
+ createdAt: drizzle_orm_pg_core.PgColumn<{
1306
+ name: "created_at";
1307
+ tableName: "embeddings";
1308
+ dataType: "date";
1309
+ columnType: "PgTimestamp";
1310
+ data: Date;
1311
+ driverParam: string;
1312
+ notNull: true;
1313
+ hasDefault: true;
1314
+ isPrimaryKey: false;
1315
+ isAutoincrement: false;
1316
+ hasRuntimeDefault: false;
1317
+ enumValues: undefined;
1318
+ baseColumn: never;
1319
+ identity: undefined;
1320
+ generated: undefined;
1321
+ }, {}, {}>;
1322
+ updatedAt: drizzle_orm_pg_core.PgColumn<{
1323
+ name: "updated_at";
1324
+ tableName: "embeddings";
1325
+ dataType: "date";
1326
+ columnType: "PgTimestamp";
1327
+ data: Date;
1328
+ driverParam: string;
1329
+ notNull: true;
1330
+ hasDefault: true;
1331
+ isPrimaryKey: false;
1332
+ isAutoincrement: false;
1333
+ hasRuntimeDefault: false;
1334
+ enumValues: undefined;
1335
+ baseColumn: never;
1336
+ identity: undefined;
1337
+ generated: undefined;
1338
+ }, {}, {}>;
1339
+ };
1340
+ dialect: "pg";
1341
+ }>;
1342
+ declare const shares: drizzle_orm_pg_core.PgTableWithColumns<{
1343
+ name: "shares";
1344
+ schema: undefined;
1345
+ columns: {
1346
+ id: drizzle_orm_pg_core.PgColumn<{
1347
+ name: "id";
1348
+ tableName: "shares";
1349
+ dataType: "string";
1350
+ columnType: "PgText";
1351
+ data: string;
1352
+ driverParam: string;
1353
+ notNull: true;
1354
+ hasDefault: false;
1355
+ isPrimaryKey: true;
1356
+ isAutoincrement: false;
1357
+ hasRuntimeDefault: false;
1358
+ enumValues: [string, ...string[]];
1359
+ baseColumn: never;
1360
+ identity: undefined;
1361
+ generated: undefined;
1362
+ }, {}, {}>;
1363
+ fromNamespaceId: drizzle_orm_pg_core.PgColumn<{
1364
+ name: "from_namespace_id";
1365
+ tableName: "shares";
1366
+ dataType: "string";
1367
+ columnType: "PgText";
1368
+ data: string;
1369
+ driverParam: string;
1370
+ notNull: true;
1371
+ hasDefault: false;
1372
+ isPrimaryKey: false;
1373
+ isAutoincrement: false;
1374
+ hasRuntimeDefault: false;
1375
+ enumValues: [string, ...string[]];
1376
+ baseColumn: never;
1377
+ identity: undefined;
1378
+ generated: undefined;
1379
+ }, {}, {}>;
1380
+ toNamespaceId: drizzle_orm_pg_core.PgColumn<{
1381
+ name: "to_namespace_id";
1382
+ tableName: "shares";
1383
+ dataType: "string";
1384
+ columnType: "PgText";
1385
+ data: string;
1386
+ driverParam: string;
1387
+ notNull: true;
1388
+ hasDefault: false;
1389
+ isPrimaryKey: false;
1390
+ isAutoincrement: false;
1391
+ hasRuntimeDefault: false;
1392
+ enumValues: [string, ...string[]];
1393
+ baseColumn: never;
1394
+ identity: undefined;
1395
+ generated: undefined;
1396
+ }, {}, {}>;
1397
+ sourceFactId: drizzle_orm_pg_core.PgColumn<{
1398
+ name: "source_fact_id";
1399
+ tableName: "shares";
1400
+ dataType: "string";
1401
+ columnType: "PgText";
1402
+ data: string;
1403
+ driverParam: string;
1404
+ notNull: true;
1405
+ hasDefault: false;
1406
+ isPrimaryKey: false;
1407
+ isAutoincrement: false;
1408
+ hasRuntimeDefault: false;
1409
+ enumValues: [string, ...string[]];
1410
+ baseColumn: never;
1411
+ identity: undefined;
1412
+ generated: undefined;
1413
+ }, {}, {}>;
1414
+ snapshotFactId: drizzle_orm_pg_core.PgColumn<{
1415
+ name: "snapshot_fact_id";
1416
+ tableName: "shares";
1417
+ dataType: "string";
1418
+ columnType: "PgText";
1419
+ data: string;
1420
+ driverParam: string;
1421
+ notNull: false;
1422
+ hasDefault: false;
1423
+ isPrimaryKey: false;
1424
+ isAutoincrement: false;
1425
+ hasRuntimeDefault: false;
1426
+ enumValues: [string, ...string[]];
1427
+ baseColumn: never;
1428
+ identity: undefined;
1429
+ generated: undefined;
1430
+ }, {}, {}>;
1431
+ mode: drizzle_orm_pg_core.PgColumn<{
1432
+ name: "mode";
1433
+ tableName: "shares";
1434
+ dataType: "string";
1435
+ columnType: "PgEnumColumn";
1436
+ data: "reference" | "snapshot";
1437
+ driverParam: string;
1438
+ notNull: true;
1439
+ hasDefault: true;
1440
+ isPrimaryKey: false;
1441
+ isAutoincrement: false;
1442
+ hasRuntimeDefault: false;
1443
+ enumValues: ["reference", "snapshot"];
1444
+ baseColumn: never;
1445
+ identity: undefined;
1446
+ generated: undefined;
1447
+ }, {}, {}>;
1448
+ tombstoned: drizzle_orm_pg_core.PgColumn<{
1449
+ name: "tombstoned";
1450
+ tableName: "shares";
1451
+ dataType: "boolean";
1452
+ columnType: "PgBoolean";
1453
+ data: boolean;
1454
+ driverParam: boolean;
1455
+ notNull: true;
1456
+ hasDefault: true;
1457
+ isPrimaryKey: false;
1458
+ isAutoincrement: false;
1459
+ hasRuntimeDefault: false;
1460
+ enumValues: undefined;
1461
+ baseColumn: never;
1462
+ identity: undefined;
1463
+ generated: undefined;
1464
+ }, {}, {}>;
1465
+ createdByAgent: drizzle_orm_pg_core.PgColumn<{
1466
+ name: "created_by_agent";
1467
+ tableName: "shares";
1468
+ dataType: "string";
1469
+ columnType: "PgText";
1470
+ data: string;
1471
+ driverParam: string;
1472
+ notNull: false;
1473
+ hasDefault: false;
1474
+ isPrimaryKey: false;
1475
+ isAutoincrement: false;
1476
+ hasRuntimeDefault: false;
1477
+ enumValues: [string, ...string[]];
1478
+ baseColumn: never;
1479
+ identity: undefined;
1480
+ generated: undefined;
1481
+ }, {}, {}>;
1482
+ createdAt: drizzle_orm_pg_core.PgColumn<{
1483
+ name: "created_at";
1484
+ tableName: "shares";
1485
+ dataType: "date";
1486
+ columnType: "PgTimestamp";
1487
+ data: Date;
1488
+ driverParam: string;
1489
+ notNull: true;
1490
+ hasDefault: true;
1491
+ isPrimaryKey: false;
1492
+ isAutoincrement: false;
1493
+ hasRuntimeDefault: false;
1494
+ enumValues: undefined;
1495
+ baseColumn: never;
1496
+ identity: undefined;
1497
+ generated: undefined;
1498
+ }, {}, {}>;
1499
+ };
1500
+ dialect: "pg";
1501
+ }>;
1502
+ declare const checkpoints: drizzle_orm_pg_core.PgTableWithColumns<{
1503
+ name: "checkpoints";
1504
+ schema: undefined;
1505
+ columns: {
1506
+ id: drizzle_orm_pg_core.PgColumn<{
1507
+ name: "id";
1508
+ tableName: "checkpoints";
1509
+ dataType: "string";
1510
+ columnType: "PgText";
1511
+ data: string;
1512
+ driverParam: string;
1513
+ notNull: true;
1514
+ hasDefault: false;
1515
+ isPrimaryKey: true;
1516
+ isAutoincrement: false;
1517
+ hasRuntimeDefault: false;
1518
+ enumValues: [string, ...string[]];
1519
+ baseColumn: never;
1520
+ identity: undefined;
1521
+ generated: undefined;
1522
+ }, {}, {}>;
1523
+ namespaceId: drizzle_orm_pg_core.PgColumn<{
1524
+ name: "namespace_id";
1525
+ tableName: "checkpoints";
1526
+ dataType: "string";
1527
+ columnType: "PgText";
1528
+ data: string;
1529
+ driverParam: string;
1530
+ notNull: true;
1531
+ hasDefault: false;
1532
+ isPrimaryKey: false;
1533
+ isAutoincrement: false;
1534
+ hasRuntimeDefault: false;
1535
+ enumValues: [string, ...string[]];
1536
+ baseColumn: never;
1537
+ identity: undefined;
1538
+ generated: undefined;
1539
+ }, {}, {}>;
1540
+ threadId: drizzle_orm_pg_core.PgColumn<{
1541
+ name: "thread_id";
1542
+ tableName: "checkpoints";
1543
+ dataType: "string";
1544
+ columnType: "PgText";
1545
+ data: string;
1546
+ driverParam: string;
1547
+ notNull: true;
1548
+ hasDefault: false;
1549
+ isPrimaryKey: false;
1550
+ isAutoincrement: false;
1551
+ hasRuntimeDefault: false;
1552
+ enumValues: [string, ...string[]];
1553
+ baseColumn: never;
1554
+ identity: undefined;
1555
+ generated: undefined;
1556
+ }, {}, {}>;
1557
+ checkpointId: drizzle_orm_pg_core.PgColumn<{
1558
+ name: "checkpoint_id";
1559
+ tableName: "checkpoints";
1560
+ dataType: "string";
1561
+ columnType: "PgText";
1562
+ data: string;
1563
+ driverParam: string;
1564
+ notNull: true;
1565
+ hasDefault: false;
1566
+ isPrimaryKey: false;
1567
+ isAutoincrement: false;
1568
+ hasRuntimeDefault: false;
1569
+ enumValues: [string, ...string[]];
1570
+ baseColumn: never;
1571
+ identity: undefined;
1572
+ generated: undefined;
1573
+ }, {}, {}>;
1574
+ parentId: drizzle_orm_pg_core.PgColumn<{
1575
+ name: "parent_id";
1576
+ tableName: "checkpoints";
1577
+ dataType: "string";
1578
+ columnType: "PgText";
1579
+ data: string;
1580
+ driverParam: string;
1581
+ notNull: false;
1582
+ hasDefault: false;
1583
+ isPrimaryKey: false;
1584
+ isAutoincrement: false;
1585
+ hasRuntimeDefault: false;
1586
+ enumValues: [string, ...string[]];
1587
+ baseColumn: never;
1588
+ identity: undefined;
1589
+ generated: undefined;
1590
+ }, {}, {}>;
1591
+ channelValues: drizzle_orm_pg_core.PgColumn<{
1592
+ name: "channel_values";
1593
+ tableName: "checkpoints";
1594
+ dataType: "json";
1595
+ columnType: "PgJsonb";
1596
+ data: unknown;
1597
+ driverParam: unknown;
1598
+ notNull: true;
1599
+ hasDefault: true;
1600
+ isPrimaryKey: false;
1601
+ isAutoincrement: false;
1602
+ hasRuntimeDefault: false;
1603
+ enumValues: undefined;
1604
+ baseColumn: never;
1605
+ identity: undefined;
1606
+ generated: undefined;
1607
+ }, {}, {}>;
1608
+ metadata: drizzle_orm_pg_core.PgColumn<{
1609
+ name: "metadata";
1610
+ tableName: "checkpoints";
1611
+ dataType: "json";
1612
+ columnType: "PgJsonb";
1613
+ data: unknown;
1614
+ driverParam: unknown;
1615
+ notNull: true;
1616
+ hasDefault: true;
1617
+ isPrimaryKey: false;
1618
+ isAutoincrement: false;
1619
+ hasRuntimeDefault: false;
1620
+ enumValues: undefined;
1621
+ baseColumn: never;
1622
+ identity: undefined;
1623
+ generated: undefined;
1624
+ }, {}, {}>;
1625
+ createdAt: drizzle_orm_pg_core.PgColumn<{
1626
+ name: "created_at";
1627
+ tableName: "checkpoints";
1628
+ dataType: "date";
1629
+ columnType: "PgTimestamp";
1630
+ data: Date;
1631
+ driverParam: string;
1632
+ notNull: true;
1633
+ hasDefault: true;
1634
+ isPrimaryKey: false;
1635
+ isAutoincrement: false;
1636
+ hasRuntimeDefault: false;
1637
+ enumValues: undefined;
1638
+ baseColumn: never;
1639
+ identity: undefined;
1640
+ generated: undefined;
1641
+ }, {}, {}>;
1642
+ };
1643
+ dialect: "pg";
1644
+ }>;
1645
+ declare const modelCalls: drizzle_orm_pg_core.PgTableWithColumns<{
1646
+ name: "model_calls";
1647
+ schema: undefined;
1648
+ columns: {
1649
+ id: drizzle_orm_pg_core.PgColumn<{
1650
+ name: "id";
1651
+ tableName: "model_calls";
1652
+ dataType: "string";
1653
+ columnType: "PgText";
1654
+ data: string;
1655
+ driverParam: string;
1656
+ notNull: true;
1657
+ hasDefault: false;
1658
+ isPrimaryKey: true;
1659
+ isAutoincrement: false;
1660
+ hasRuntimeDefault: false;
1661
+ enumValues: [string, ...string[]];
1662
+ baseColumn: never;
1663
+ identity: undefined;
1664
+ generated: undefined;
1665
+ }, {}, {}>;
1666
+ namespaceId: drizzle_orm_pg_core.PgColumn<{
1667
+ name: "namespace_id";
1668
+ tableName: "model_calls";
1669
+ dataType: "string";
1670
+ columnType: "PgText";
1671
+ data: string;
1672
+ driverParam: string;
1673
+ notNull: false;
1674
+ hasDefault: false;
1675
+ isPrimaryKey: false;
1676
+ isAutoincrement: false;
1677
+ hasRuntimeDefault: false;
1678
+ enumValues: [string, ...string[]];
1679
+ baseColumn: never;
1680
+ identity: undefined;
1681
+ generated: undefined;
1682
+ }, {}, {}>;
1683
+ model: drizzle_orm_pg_core.PgColumn<{
1684
+ name: "model";
1685
+ tableName: "model_calls";
1686
+ dataType: "string";
1687
+ columnType: "PgText";
1688
+ data: string;
1689
+ driverParam: string;
1690
+ notNull: true;
1691
+ hasDefault: false;
1692
+ isPrimaryKey: false;
1693
+ isAutoincrement: false;
1694
+ hasRuntimeDefault: false;
1695
+ enumValues: [string, ...string[]];
1696
+ baseColumn: never;
1697
+ identity: undefined;
1698
+ generated: undefined;
1699
+ }, {}, {}>;
1700
+ type: drizzle_orm_pg_core.PgColumn<{
1701
+ name: "type";
1702
+ tableName: "model_calls";
1703
+ dataType: "string";
1704
+ columnType: "PgEnumColumn";
1705
+ data: "embedding" | "llm";
1706
+ driverParam: string;
1707
+ notNull: true;
1708
+ hasDefault: false;
1709
+ isPrimaryKey: false;
1710
+ isAutoincrement: false;
1711
+ hasRuntimeDefault: false;
1712
+ enumValues: ["embedding", "llm"];
1713
+ baseColumn: never;
1714
+ identity: undefined;
1715
+ generated: undefined;
1716
+ }, {}, {}>;
1717
+ latencyMs: drizzle_orm_pg_core.PgColumn<{
1718
+ name: "latency_ms";
1719
+ tableName: "model_calls";
1720
+ dataType: "number";
1721
+ columnType: "PgInteger";
1722
+ data: number;
1723
+ driverParam: string | number;
1724
+ notNull: false;
1725
+ hasDefault: false;
1726
+ isPrimaryKey: false;
1727
+ isAutoincrement: false;
1728
+ hasRuntimeDefault: false;
1729
+ enumValues: undefined;
1730
+ baseColumn: never;
1731
+ identity: undefined;
1732
+ generated: undefined;
1733
+ }, {}, {}>;
1734
+ tokens: drizzle_orm_pg_core.PgColumn<{
1735
+ name: "tokens";
1736
+ tableName: "model_calls";
1737
+ dataType: "number";
1738
+ columnType: "PgInteger";
1739
+ data: number;
1740
+ driverParam: string | number;
1741
+ notNull: false;
1742
+ hasDefault: false;
1743
+ isPrimaryKey: false;
1744
+ isAutoincrement: false;
1745
+ hasRuntimeDefault: false;
1746
+ enumValues: undefined;
1747
+ baseColumn: never;
1748
+ identity: undefined;
1749
+ generated: undefined;
1750
+ }, {}, {}>;
1751
+ status: drizzle_orm_pg_core.PgColumn<{
1752
+ name: "status";
1753
+ tableName: "model_calls";
1754
+ dataType: "string";
1755
+ columnType: "PgEnumColumn";
1756
+ data: "fallback" | "failed" | "success" | "timeout" | "rate_limited" | "gated";
1757
+ driverParam: string;
1758
+ notNull: true;
1759
+ hasDefault: false;
1760
+ isPrimaryKey: false;
1761
+ isAutoincrement: false;
1762
+ hasRuntimeDefault: false;
1763
+ enumValues: ["success", "failed", "timeout", "rate_limited", "gated", "fallback"];
1764
+ baseColumn: never;
1765
+ identity: undefined;
1766
+ generated: undefined;
1767
+ }, {}, {}>;
1768
+ error: drizzle_orm_pg_core.PgColumn<{
1769
+ name: "error";
1770
+ tableName: "model_calls";
1771
+ dataType: "string";
1772
+ columnType: "PgText";
1773
+ data: string;
1774
+ driverParam: string;
1775
+ notNull: false;
1776
+ hasDefault: false;
1777
+ isPrimaryKey: false;
1778
+ isAutoincrement: false;
1779
+ hasRuntimeDefault: false;
1780
+ enumValues: [string, ...string[]];
1781
+ baseColumn: never;
1782
+ identity: undefined;
1783
+ generated: undefined;
1784
+ }, {}, {}>;
1785
+ metadata: drizzle_orm_pg_core.PgColumn<{
1786
+ name: "metadata";
1787
+ tableName: "model_calls";
1788
+ dataType: "json";
1789
+ columnType: "PgJsonb";
1790
+ data: unknown;
1791
+ driverParam: unknown;
1792
+ notNull: true;
1793
+ hasDefault: true;
1794
+ isPrimaryKey: false;
1795
+ isAutoincrement: false;
1796
+ hasRuntimeDefault: false;
1797
+ enumValues: undefined;
1798
+ baseColumn: never;
1799
+ identity: undefined;
1800
+ generated: undefined;
1801
+ }, {}, {}>;
1802
+ createdAt: drizzle_orm_pg_core.PgColumn<{
1803
+ name: "created_at";
1804
+ tableName: "model_calls";
1805
+ dataType: "date";
1806
+ columnType: "PgTimestamp";
1807
+ data: Date;
1808
+ driverParam: string;
1809
+ notNull: true;
1810
+ hasDefault: true;
1811
+ isPrimaryKey: false;
1812
+ isAutoincrement: false;
1813
+ hasRuntimeDefault: false;
1814
+ enumValues: undefined;
1815
+ baseColumn: never;
1816
+ identity: undefined;
1817
+ generated: undefined;
1818
+ }, {}, {}>;
1819
+ };
1820
+ dialect: "pg";
1821
+ }>;
1822
+ declare const auditLog: drizzle_orm_pg_core.PgTableWithColumns<{
1823
+ name: "audit_log";
1824
+ schema: undefined;
1825
+ columns: {
1826
+ id: drizzle_orm_pg_core.PgColumn<{
1827
+ name: "id";
1828
+ tableName: "audit_log";
1829
+ dataType: "string";
1830
+ columnType: "PgText";
1831
+ data: string;
1832
+ driverParam: string;
1833
+ notNull: true;
1834
+ hasDefault: false;
1835
+ isPrimaryKey: true;
1836
+ isAutoincrement: false;
1837
+ hasRuntimeDefault: false;
1838
+ enumValues: [string, ...string[]];
1839
+ baseColumn: never;
1840
+ identity: undefined;
1841
+ generated: undefined;
1842
+ }, {}, {}>;
1843
+ namespaceId: drizzle_orm_pg_core.PgColumn<{
1844
+ name: "namespace_id";
1845
+ tableName: "audit_log";
1846
+ dataType: "string";
1847
+ columnType: "PgText";
1848
+ data: string;
1849
+ driverParam: string;
1850
+ notNull: false;
1851
+ hasDefault: false;
1852
+ isPrimaryKey: false;
1853
+ isAutoincrement: false;
1854
+ hasRuntimeDefault: false;
1855
+ enumValues: [string, ...string[]];
1856
+ baseColumn: never;
1857
+ identity: undefined;
1858
+ generated: undefined;
1859
+ }, {}, {}>;
1860
+ action: drizzle_orm_pg_core.PgColumn<{
1861
+ name: "action";
1862
+ tableName: "audit_log";
1863
+ dataType: "string";
1864
+ columnType: "PgEnumColumn";
1865
+ data: "config" | "remember" | "remember_batch" | "share" | "forget";
1866
+ driverParam: string;
1867
+ notNull: true;
1868
+ hasDefault: false;
1869
+ isPrimaryKey: false;
1870
+ isAutoincrement: false;
1871
+ hasRuntimeDefault: false;
1872
+ enumValues: ["remember", "remember_batch", "share", "forget", "config"];
1873
+ baseColumn: never;
1874
+ identity: undefined;
1875
+ generated: undefined;
1876
+ }, {}, {}>;
1877
+ entityType: drizzle_orm_pg_core.PgColumn<{
1878
+ name: "entity_type";
1879
+ tableName: "audit_log";
1880
+ dataType: "string";
1881
+ columnType: "PgText";
1882
+ data: string;
1883
+ driverParam: string;
1884
+ notNull: true;
1885
+ hasDefault: false;
1886
+ isPrimaryKey: false;
1887
+ isAutoincrement: false;
1888
+ hasRuntimeDefault: false;
1889
+ enumValues: [string, ...string[]];
1890
+ baseColumn: never;
1891
+ identity: undefined;
1892
+ generated: undefined;
1893
+ }, {}, {}>;
1894
+ entityId: drizzle_orm_pg_core.PgColumn<{
1895
+ name: "entity_id";
1896
+ tableName: "audit_log";
1897
+ dataType: "string";
1898
+ columnType: "PgText";
1899
+ data: string;
1900
+ driverParam: string;
1901
+ notNull: false;
1902
+ hasDefault: false;
1903
+ isPrimaryKey: false;
1904
+ isAutoincrement: false;
1905
+ hasRuntimeDefault: false;
1906
+ enumValues: [string, ...string[]];
1907
+ baseColumn: never;
1908
+ identity: undefined;
1909
+ generated: undefined;
1910
+ }, {}, {}>;
1911
+ createdByAgent: drizzle_orm_pg_core.PgColumn<{
1912
+ name: "created_by_agent";
1913
+ tableName: "audit_log";
1914
+ dataType: "string";
1915
+ columnType: "PgText";
1916
+ data: string;
1917
+ driverParam: string;
1918
+ notNull: false;
1919
+ hasDefault: false;
1920
+ isPrimaryKey: false;
1921
+ isAutoincrement: false;
1922
+ hasRuntimeDefault: false;
1923
+ enumValues: [string, ...string[]];
1924
+ baseColumn: never;
1925
+ identity: undefined;
1926
+ generated: undefined;
1927
+ }, {}, {}>;
1928
+ metadata: drizzle_orm_pg_core.PgColumn<{
1929
+ name: "metadata";
1930
+ tableName: "audit_log";
1931
+ dataType: "json";
1932
+ columnType: "PgJsonb";
1933
+ data: unknown;
1934
+ driverParam: unknown;
1935
+ notNull: true;
1936
+ hasDefault: true;
1937
+ isPrimaryKey: false;
1938
+ isAutoincrement: false;
1939
+ hasRuntimeDefault: false;
1940
+ enumValues: undefined;
1941
+ baseColumn: never;
1942
+ identity: undefined;
1943
+ generated: undefined;
1944
+ }, {}, {}>;
1945
+ createdAt: drizzle_orm_pg_core.PgColumn<{
1946
+ name: "created_at";
1947
+ tableName: "audit_log";
1948
+ dataType: "date";
1949
+ columnType: "PgTimestamp";
1950
+ data: Date;
1951
+ driverParam: string;
1952
+ notNull: true;
1953
+ hasDefault: true;
1954
+ isPrimaryKey: false;
1955
+ isAutoincrement: false;
1956
+ hasRuntimeDefault: false;
1957
+ enumValues: undefined;
1958
+ baseColumn: never;
1959
+ identity: undefined;
1960
+ generated: undefined;
1961
+ }, {}, {}>;
1962
+ };
1963
+ dialect: "pg";
1964
+ }>;
1965
+
1966
+ declare const schema_HNSW_EF_CONSTRUCTION: typeof HNSW_EF_CONSTRUCTION;
1967
+ declare const schema_HNSW_M: typeof HNSW_M;
1968
+ declare const schema_VECTOR_DIMENSIONS: typeof VECTOR_DIMENSIONS;
1969
+ declare const schema_auditActionEnum: typeof auditActionEnum;
1970
+ declare const schema_auditLog: typeof auditLog;
1971
+ declare const schema_checkpoints: typeof checkpoints;
1972
+ declare const schema_embeddingOwnerTypeEnum: typeof embeddingOwnerTypeEnum;
1973
+ declare const schema_embeddingStatusEnum: typeof embeddingStatusEnum;
1974
+ declare const schema_embeddings: typeof embeddings;
1975
+ declare const schema_facts: typeof facts;
1976
+ declare const schema_interactionRoleEnum: typeof interactionRoleEnum;
1977
+ declare const schema_interactions: typeof interactions;
1978
+ declare const schema_memoryTypeEnum: typeof memoryTypeEnum;
1979
+ declare const schema_modelCallStatusEnum: typeof modelCallStatusEnum;
1980
+ declare const schema_modelCallTypeEnum: typeof modelCallTypeEnum;
1981
+ declare const schema_modelCalls: typeof modelCalls;
1982
+ declare const schema_namespaces: typeof namespaces;
1983
+ declare const schema_sessionSummaries: typeof sessionSummaries;
1984
+ declare const schema_shareModeEnum: typeof shareModeEnum;
1985
+ declare const schema_shares: typeof shares;
1986
+ declare namespace schema {
1987
+ export { schema_HNSW_EF_CONSTRUCTION as HNSW_EF_CONSTRUCTION, schema_HNSW_M as HNSW_M, schema_VECTOR_DIMENSIONS as VECTOR_DIMENSIONS, schema_auditActionEnum as auditActionEnum, schema_auditLog as auditLog, schema_checkpoints as checkpoints, schema_embeddingOwnerTypeEnum as embeddingOwnerTypeEnum, schema_embeddingStatusEnum as embeddingStatusEnum, schema_embeddings as embeddings, schema_facts as facts, schema_interactionRoleEnum as interactionRoleEnum, schema_interactions as interactions, schema_memoryTypeEnum as memoryTypeEnum, schema_modelCallStatusEnum as modelCallStatusEnum, schema_modelCallTypeEnum as modelCallTypeEnum, schema_modelCalls as modelCalls, schema_namespaces as namespaces, schema_sessionSummaries as sessionSummaries, schema_shareModeEnum as shareModeEnum, schema_shares as shares };
1988
+ }
1989
+
1990
+ type DatabaseClientConfig = {
1991
+ postgresUrl: string;
1992
+ maxConnections?: number;
1993
+ };
1994
+ type DatabaseClient = ReturnType<typeof createDatabaseClient>;
1995
+ declare function createDatabaseClient(config: DatabaseClientConfig): {
1996
+ sql: postgres.Sql<{}>;
1997
+ db: drizzle_orm_postgres_js.PostgresJsDatabase<typeof schema> & {
1998
+ $client: postgres.Sql<{}>;
1999
+ };
2000
+ close(): Promise<void>;
2001
+ };
2002
+
2003
+ declare function createPostgresRepository(client: DatabaseClient): MemoryRepository;
2004
+
2005
+ type ModuleNode = {
2006
+ path: string;
2007
+ language: "ts" | "js";
2008
+ imports: string[];
2009
+ };
2010
+ type ModuleEdge = {
2011
+ from: string;
2012
+ to: string;
2013
+ kind: "import" | "dynamic_import";
2014
+ /**
2015
+ * Names the dependant uses from the dependency, when the source graph knows
2016
+ * them. The regex import map does not, so this is absent there.
2017
+ */
2018
+ symbols?: string[];
2019
+ };
2020
+ type ArchitectureMap = {
2021
+ modules: ModuleNode[];
2022
+ edges: ModuleEdge[];
2023
+ /** The sources combined for this request; absent on raw cached/imported maps. */
2024
+ source?: "imports" | "graphify+imports";
2025
+ };
2026
+ type MapQuery = {
2027
+ from?: string;
2028
+ to?: string;
2029
+ limit?: number;
2030
+ };
2031
+
2032
+ declare function buildArchitectureMap(repositoryRoot?: string): Promise<ArchitectureMap>;
2033
+ declare function queryMap(map: ArchitectureMap, query: MapQuery): ModuleEdge[];
2034
+ declare function neighbours(map: ArchitectureMap, modulePath: string, direction?: "in" | "out" | "both"): {
2035
+ modules: ModuleNode[];
2036
+ edges: ModuleEdge[];
2037
+ };
2038
+
2039
+ type StartMcpServerOptions = {
2040
+ config?: CodeBuddyConfig;
2041
+ };
2042
+ declare function startMcpServer(options?: StartMcpServerOptions): Promise<void>;
2043
+
2044
+ type DatabaseServices = {
2045
+ memory: CodeBuddy;
2046
+ repository: MemoryRepository;
2047
+ };
2048
+ type DatabaseStatus = {
2049
+ available: boolean;
2050
+ state: "idle" | "connecting" | "ready" | "unavailable";
2051
+ error?: string;
2052
+ retryInMs?: number;
2053
+ };
2054
+ type LazyDatabase = {
2055
+ /** Resolve the runtime, connecting (or retrying after the cooldown) on demand. */
2056
+ get(): Promise<DatabaseServices>;
2057
+ status(): DatabaseStatus;
2058
+ close(): Promise<void>;
2059
+ };
2060
+
2061
+ declare const mcpToolInputSchemas: {
2062
+ readonly remember: z.ZodObject<{
2063
+ sessionId: z.ZodOptional<z.ZodString>;
2064
+ content: z.ZodString;
2065
+ type: z.ZodOptional<z.ZodEnum<{
2066
+ interaction: "interaction";
2067
+ fact: "fact";
2068
+ summary: "summary";
2069
+ }>>;
2070
+ idempotencyKey: z.ZodOptional<z.ZodString>;
2071
+ agentId: z.ZodOptional<z.ZodString>;
2072
+ }, z.core.$strip>;
2073
+ readonly remember_batch: z.ZodObject<{
2074
+ items: z.ZodArray<z.ZodObject<{
2075
+ sessionId: z.ZodOptional<z.ZodString>;
2076
+ content: z.ZodString;
2077
+ type: z.ZodOptional<z.ZodEnum<{
2078
+ interaction: "interaction";
2079
+ fact: "fact";
2080
+ summary: "summary";
2081
+ }>>;
2082
+ idempotencyKey: z.ZodOptional<z.ZodString>;
2083
+ agentId: z.ZodOptional<z.ZodString>;
2084
+ }, z.core.$strip>>;
2085
+ }, z.core.$strip>;
2086
+ readonly recall: z.ZodObject<{
2087
+ sessionId: z.ZodString;
2088
+ query: z.ZodString;
2089
+ budget: z.ZodOptional<z.ZodNumber>;
2090
+ callerModel: z.ZodOptional<z.ZodString>;
2091
+ conflictMode: z.ZodOptional<z.ZodEnum<{
2092
+ all: "all";
2093
+ latest: "latest";
2094
+ highest_confidence: "highest_confidence";
2095
+ }>>;
2096
+ }, z.core.$strip>;
2097
+ readonly list_facts: z.ZodObject<{
2098
+ subject: z.ZodOptional<z.ZodString>;
2099
+ limit: z.ZodDefault<z.ZodNumber>;
2100
+ cursor: z.ZodOptional<z.ZodString>;
2101
+ }, z.core.$strip>;
2102
+ readonly list_namespaces: z.ZodObject<{}, z.core.$strip>;
2103
+ readonly forget: z.ZodObject<{
2104
+ id: z.ZodString;
2105
+ }, z.core.$strip>;
2106
+ readonly share: z.ZodObject<{
2107
+ from: z.ZodOptional<z.ZodString>;
2108
+ to_namespace: z.ZodString;
2109
+ factIds: z.ZodArray<z.ZodString>;
2110
+ mode: z.ZodOptional<z.ZodEnum<{
2111
+ reference: "reference";
2112
+ snapshot: "snapshot";
2113
+ }>>;
2114
+ to_project_root: z.ZodOptional<z.ZodString>;
2115
+ agentId: z.ZodOptional<z.ZodString>;
2116
+ }, z.core.$strip>;
2117
+ readonly unshare: z.ZodObject<{
2118
+ to_namespace: z.ZodString;
2119
+ factIds: z.ZodArray<z.ZodString>;
2120
+ agentId: z.ZodOptional<z.ZodString>;
2121
+ }, z.core.$strip>;
2122
+ readonly plan_current: z.ZodObject<{}, z.core.$strip>;
2123
+ readonly plan_create: z.ZodObject<{
2124
+ title: z.ZodString;
2125
+ brief: z.ZodString;
2126
+ body: z.ZodOptional<z.ZodString>;
2127
+ filesToTouch: z.ZodOptional<z.ZodArray<z.ZodObject<{
2128
+ path: z.ZodString;
2129
+ action: z.ZodEnum<{
2130
+ delete: "delete";
2131
+ create: "create";
2132
+ edit: "edit";
2133
+ }>;
2134
+ notes: z.ZodOptional<z.ZodString>;
2135
+ }, z.core.$strip>>>;
2136
+ testsToAdd: z.ZodOptional<z.ZodArray<z.ZodObject<{
2137
+ path: z.ZodString;
2138
+ description: z.ZodOptional<z.ZodString>;
2139
+ }, z.core.$strip>>>;
2140
+ outOfScope: z.ZodOptional<z.ZodArray<z.ZodString>>;
2141
+ risks: z.ZodOptional<z.ZodArray<z.ZodString>>;
2142
+ agentId: z.ZodOptional<z.ZodString>;
2143
+ }, z.core.$strip>;
2144
+ readonly plan_amend: z.ZodObject<{
2145
+ id: z.ZodString;
2146
+ patch: z.ZodObject<{
2147
+ title: z.ZodOptional<z.ZodString>;
2148
+ brief: z.ZodOptional<z.ZodString>;
2149
+ body: z.ZodOptional<z.ZodString>;
2150
+ filesToTouch: z.ZodOptional<z.ZodArray<z.ZodObject<{
2151
+ path: z.ZodString;
2152
+ action: z.ZodEnum<{
2153
+ delete: "delete";
2154
+ create: "create";
2155
+ edit: "edit";
2156
+ }>;
2157
+ notes: z.ZodOptional<z.ZodString>;
2158
+ }, z.core.$strip>>>;
2159
+ testsToAdd: z.ZodOptional<z.ZodArray<z.ZodObject<{
2160
+ path: z.ZodString;
2161
+ description: z.ZodOptional<z.ZodString>;
2162
+ }, z.core.$strip>>>;
2163
+ outOfScope: z.ZodOptional<z.ZodArray<z.ZodString>>;
2164
+ risks: z.ZodOptional<z.ZodArray<z.ZodString>>;
2165
+ }, z.core.$strip>;
2166
+ }, z.core.$strip>;
2167
+ readonly plan_status: z.ZodObject<{
2168
+ id: z.ZodString;
2169
+ status: z.ZodEnum<{
2170
+ approved: "approved";
2171
+ executing: "executing";
2172
+ complete: "complete";
2173
+ abandoned: "abandoned";
2174
+ }>;
2175
+ commitSha: z.ZodOptional<z.ZodString>;
2176
+ notes: z.ZodOptional<z.ZodString>;
2177
+ reason: z.ZodOptional<z.ZodString>;
2178
+ }, z.core.$strip>;
2179
+ readonly risk_assess: z.ZodObject<{
2180
+ planId: z.ZodOptional<z.ZodString>;
2181
+ paths: z.ZodOptional<z.ZodArray<z.ZodString>>;
2182
+ evidence: z.ZodOptional<z.ZodEnum<{
2183
+ source: "source";
2184
+ overview: "overview";
2185
+ }>>;
2186
+ useGit: z.ZodOptional<z.ZodBoolean>;
2187
+ limit: z.ZodOptional<z.ZodNumber>;
2188
+ }, z.core.$strip>;
2189
+ readonly map_query: z.ZodObject<{
2190
+ from: z.ZodOptional<z.ZodString>;
2191
+ to: z.ZodOptional<z.ZodString>;
2192
+ limit: z.ZodOptional<z.ZodNumber>;
2193
+ }, z.core.$strip>;
2194
+ readonly map_neighbours: z.ZodObject<{
2195
+ module: z.ZodString;
2196
+ direction: z.ZodDefault<z.ZodEnum<{
2197
+ in: "in";
2198
+ out: "out";
2199
+ both: "both";
2200
+ }>>;
2201
+ }, z.core.$strip>;
2202
+ readonly context_bootstrap: z.ZodObject<{
2203
+ sessionId: z.ZodOptional<z.ZodString>;
2204
+ ack: z.ZodOptional<z.ZodString>;
2205
+ full: z.ZodOptional<z.ZodBoolean>;
2206
+ }, z.core.$strip>;
2207
+ readonly context_before_edit: z.ZodObject<{
2208
+ sessionId: z.ZodOptional<z.ZodString>;
2209
+ ack: z.ZodOptional<z.ZodString>;
2210
+ full: z.ZodOptional<z.ZodBoolean>;
2211
+ task: z.ZodOptional<z.ZodString>;
2212
+ paths: z.ZodOptional<z.ZodArray<z.ZodString>>;
2213
+ planId: z.ZodOptional<z.ZodString>;
2214
+ evidence: z.ZodOptional<z.ZodEnum<{
2215
+ source: "source";
2216
+ overview: "overview";
2217
+ }>>;
2218
+ useGit: z.ZodOptional<z.ZodBoolean>;
2219
+ tokenBudget: z.ZodOptional<z.ZodNumber>;
2220
+ }, z.core.$strip>;
2221
+ readonly context_pack: z.ZodObject<{
2222
+ sessionId: z.ZodOptional<z.ZodString>;
2223
+ ack: z.ZodOptional<z.ZodString>;
2224
+ full: z.ZodOptional<z.ZodBoolean>;
2225
+ task: z.ZodString;
2226
+ paths: z.ZodOptional<z.ZodArray<z.ZodString>>;
2227
+ planId: z.ZodOptional<z.ZodString>;
2228
+ evidence: z.ZodOptional<z.ZodEnum<{
2229
+ source: "source";
2230
+ overview: "overview";
2231
+ }>>;
2232
+ useGit: z.ZodOptional<z.ZodBoolean>;
2233
+ tokenBudget: z.ZodOptional<z.ZodNumber>;
2234
+ }, z.core.$strip>;
2235
+ readonly context_after_turn: z.ZodObject<{
2236
+ summary: z.ZodString;
2237
+ changedFiles: z.ZodOptional<z.ZodArray<z.ZodString>>;
2238
+ planId: z.ZodOptional<z.ZodString>;
2239
+ taskType: z.ZodOptional<z.ZodString>;
2240
+ agentId: z.ZodOptional<z.ZodString>;
2241
+ sessionId: z.ZodOptional<z.ZodString>;
2242
+ verification: z.ZodOptional<z.ZodArray<z.ZodString>>;
2243
+ commitSha: z.ZodOptional<z.ZodString>;
2244
+ }, z.core.$strip>;
2245
+ readonly code_suggestions: z.ZodObject<{
2246
+ paths: z.ZodOptional<z.ZodArray<z.ZodString>>;
2247
+ planId: z.ZodOptional<z.ZodString>;
2248
+ evidence: z.ZodOptional<z.ZodEnum<{
2249
+ source: "source";
2250
+ overview: "overview";
2251
+ }>>;
2252
+ useGit: z.ZodOptional<z.ZodBoolean>;
2253
+ limit: z.ZodOptional<z.ZodNumber>;
2254
+ }, z.core.$strip>;
2255
+ readonly health: z.ZodObject<{}, z.core.$strip>;
2256
+ };
2257
+ /**
2258
+ * Client tool profiles (#45). `full` (default) lists every tool; `core` lists
2259
+ * only the automatic context workflow, so a client pays a fraction of the
2260
+ * tool-schema tokens per session. Set `CODEBUDDY_TOOL_PROFILE=core` in the
2261
+ * client's MCP server environment.
2262
+ */
2263
+ type ToolProfile = "core" | "full";
2264
+ type RegisterCodeBuddyToolsOptions = {
2265
+ memory: CodeBuddy;
2266
+ repository: MemoryRepository;
2267
+ } | {
2268
+ /** File-based tools read only namespace/projectRoot/tokenBudget from this. */
2269
+ config: Pick<CodeBuddyConfig, "namespace"> & {
2270
+ projectRoot?: string | undefined;
2271
+ tokenBudget?: number | undefined;
2272
+ };
2273
+ /** Optional PostgreSQL services; database tools degrade while it is unavailable. */
2274
+ database: Pick<LazyDatabase, "get" | "status">;
2275
+ };
2276
+ declare function registerCodeBuddyTools(server: McpServer, options: RegisterCodeBuddyToolsOptions, profile?: ToolProfile): void;
2277
+
2278
+ /**
2279
+ * Exact cl100k token count. A context request tokenizes nearly the same JSON
2280
+ * several times (stats, stages, budget fixed point, delivery), so BPE results
2281
+ * are memoized per pre-tokenized piece; the sum equals `encode(text).length`.
2282
+ */
2283
+ declare function countTokens(text: string): number;
2284
+ type BudgetClampResult = {
2285
+ budget: number;
2286
+ clamped: boolean;
2287
+ reason?: string;
2288
+ };
2289
+ declare function clampBudgetForCallerModel(requestedBudget: number, callerModel: string | undefined): BudgetClampResult;
2290
+
2291
+ type DefaultPolicyOptions = {
2292
+ recencyFloorSize?: number;
2293
+ embeddingCandidateLimit?: number;
2294
+ minVectorScore?: number;
2295
+ };
2296
+ declare class DefaultPolicy implements ContextPolicy {
2297
+ private readonly recencyFloorSize;
2298
+ private readonly embeddingCandidateLimit;
2299
+ private readonly minVectorScore;
2300
+ constructor(options?: DefaultPolicyOptions);
2301
+ plan(input: PlanInput): Promise<PlannedContext>;
2302
+ private hydrateScored;
2303
+ private applyRecencyFloor;
2304
+ private buildFallbackCandidates;
2305
+ /**
2306
+ * Resolve rival assertions of the same explicit proposition key. Facts without
2307
+ * a key are treated as multi-valued and never grouped, so identical or
2308
+ * different surface text alone never merges or splits claims.
2309
+ */
2310
+ private applyConflictMode;
2311
+ }
2312
+
2313
+ type ModelRole = "primary" | "fallback" | "last_resort";
2314
+ type ModelKind = "embedding" | "llm";
2315
+ type ModelDefinition = {
2316
+ id: string;
2317
+ role: ModelRole;
2318
+ kind: ModelKind;
2319
+ dimensions?: number;
2320
+ /** Actual deployment revision metadata; this does not pin Hugging Face requests. */
2321
+ revision?: string;
2322
+ schema?: string;
2323
+ contextWindow?: number;
2324
+ dailyCallBudget?: number;
2325
+ supportsBatch?: boolean;
2326
+ };
2327
+
2328
+ type ResilienceOptions = {
2329
+ retries: number;
2330
+ concurrency: number;
2331
+ rateLimitPerMinute: number;
2332
+ timeoutMs: number;
2333
+ warmCacheTtlMs: number;
2334
+ coldStartBufferMs: number;
2335
+ jitterMs: number;
2336
+ minRetryTimeoutMs: number;
2337
+ maxRetryTimeoutMs: number;
2338
+ };
2339
+
2340
+ type HuggingFaceProviderOptions = {
2341
+ apiKey?: string;
2342
+ client?: Pick<HfInference, "featureExtraction" | "textGeneration">;
2343
+ embeddingModels?: ModelDefinition[];
2344
+ llmModels?: ModelDefinition[];
2345
+ resilience?: Partial<ResilienceOptions>;
2346
+ onDiagnostic?: ProviderDiagnosticsHook;
2347
+ };
2348
+ declare class HuggingFaceProvider implements ModelProvider {
2349
+ private readonly client;
2350
+ private readonly embeddingModels;
2351
+ private readonly llmModels;
2352
+ private readonly resilience;
2353
+ private readonly onDiagnostic;
2354
+ constructor(options?: HuggingFaceProviderOptions);
2355
+ embed(request: EmbeddingRequest): Promise<EmbeddingResponse>;
2356
+ generateText(request: TextGenerationRequest): Promise<TextGenerationResponse>;
2357
+ }
2358
+
2359
+ /**
2360
+ * Risk model (Proposal 03.1). A risk assessment is a deterministic,
2361
+ * evidence-backed ranking of the files in a pending change set. Every score
2362
+ * traces to one or more signals, and every signal cites its evidence — a risk
2363
+ * that cannot be explained is noise, not risk. No LLM judgement enters here.
2364
+ */
2365
+ type RiskCategory = "blast_radius" | "churn" | "incident" | "type_failure" | "policy";
2366
+ type Evidence = {
2367
+ kind: "dependent_module";
2368
+ path: string;
2369
+ depth: number;
2370
+ } | {
2371
+ kind: "git_commit";
2372
+ sha: string;
2373
+ message: string;
2374
+ ts: string;
2375
+ } | {
2376
+ kind: "memory_fact";
2377
+ factId: string;
2378
+ content: string;
2379
+ createdAt: string;
2380
+ } | {
2381
+ kind: "ci_failure";
2382
+ runId: string;
2383
+ conclusion: string;
2384
+ ts: string;
2385
+ } | {
2386
+ kind: "policy_rule";
2387
+ ruleId: string;
2388
+ pattern: string;
2389
+ };
2390
+ /** One signal's verdict on one path. */
2391
+ type SignalContribution = {
2392
+ path: string;
2393
+ /** 0–100 within this signal's own scale. */
2394
+ weight: number;
2395
+ reason: string;
2396
+ evidence: Evidence[];
2397
+ };
2398
+ type AssessmentInput = {
2399
+ /** Repo-relative paths in the change set. */
2400
+ paths: string[];
2401
+ /** Repository root, for signals that read the filesystem or git. */
2402
+ repositoryRoot: string;
2403
+ namespace: string;
2404
+ };
2405
+ type Signal = {
2406
+ id: string;
2407
+ category: RiskCategory;
2408
+ /** Disabled signals are skipped entirely. */
2409
+ enabled: boolean;
2410
+ /** Relative importance when folding contributions into a score. */
2411
+ coefficient: number;
2412
+ assess(input: AssessmentInput): Promise<SignalContribution[]>;
2413
+ };
2414
+ type RiskItem = {
2415
+ path: string;
2416
+ /** 0–100 aggregate. */
2417
+ score: number;
2418
+ /** The category of the signal that contributed the most weight. */
2419
+ category: RiskCategory;
2420
+ /** The dominant signal's reason, for a one-line summary. */
2421
+ reason: string;
2422
+ /** Ids of every signal that contributed to this path. */
2423
+ contributingSignals: string[];
2424
+ evidence: Evidence[];
2425
+ };
2426
+ type SignalStat = {
2427
+ id: string;
2428
+ category: RiskCategory;
2429
+ contributions: number;
2430
+ totalWeight: number;
2431
+ };
2432
+ type AssessmentStats = {
2433
+ pathsConsidered: number;
2434
+ itemsProduced: number;
2435
+ signalsRun: number;
2436
+ perSignal: SignalStat[];
2437
+ };
2438
+ type Assessment = {
2439
+ items: RiskItem[];
2440
+ stats: AssessmentStats;
2441
+ };
2442
+
2443
+ type AssessorOptions = {
2444
+ /** Items scoring below this are dropped from the result. Default 0. */
2445
+ minScore?: number;
2446
+ };
2447
+ /**
2448
+ * Runs every enabled signal in parallel and folds their per-path
2449
+ * contributions into a single ranked list. Scoring is deterministic: the
2450
+ * same inputs and the same cache state always produce the same output, with
2451
+ * stable tie-breaking.
2452
+ */
2453
+ declare class RiskAssessor {
2454
+ private readonly signals;
2455
+ private readonly minScore;
2456
+ constructor(signals: Signal[], options?: AssessorOptions);
2457
+ assess(input: AssessmentInput): Promise<Assessment>;
2458
+ /** Fold all contributions for one path into a single RiskItem. */
2459
+ private fold;
2460
+ }
2461
+
2462
+ type RiskAssessRequest = {
2463
+ repositoryRoot?: string;
2464
+ namespace: string;
2465
+ paths?: string[];
2466
+ planId?: string;
2467
+ useGit?: boolean;
2468
+ limit?: number;
2469
+ signals?: Signal[];
2470
+ };
2471
+ declare function assessRisk(input: RiskAssessRequest): Promise<Assessment>;
2472
+ declare function resolveRiskPaths(input: {
2473
+ repositoryRoot: string;
2474
+ paths?: string[];
2475
+ planId?: string;
2476
+ useGit?: boolean;
2477
+ }): Promise<string[]>;
2478
+
2479
+ type ChurnSignalOptions = {
2480
+ repositoryRoot: string;
2481
+ enabled?: boolean;
2482
+ coefficient?: number;
2483
+ since?: string;
2484
+ };
2485
+ declare function createChurnSignal(options: ChurnSignalOptions): Signal;
2486
+
2487
+ type IncidentSignalOptions = {
2488
+ store: MemoryFileStore;
2489
+ enabled?: boolean;
2490
+ coefficient?: number;
2491
+ includeResolved?: boolean;
2492
+ };
2493
+ /**
2494
+ * Historical incident signal (Proposal 03.2/03.5 foundation). It reads
2495
+ * structured incident metadata from Markdown facts and produces one
2496
+ * evidence-backed contribution per affected path.
2497
+ */
2498
+ declare function createIncidentSignal(options: IncidentSignalOptions): Signal;
2499
+
2500
+ declare const policyRuleSchema: z.ZodObject<{
2501
+ id: z.ZodString;
2502
+ pattern: z.ZodString;
2503
+ message: z.ZodOptional<z.ZodString>;
2504
+ reason: z.ZodOptional<z.ZodString>;
2505
+ weight: z.ZodDefault<z.ZodNumber>;
2506
+ }, z.core.$strip>;
2507
+ declare const policyFileSchema: z.ZodObject<{
2508
+ rules: z.ZodDefault<z.ZodArray<z.ZodObject<{
2509
+ id: z.ZodString;
2510
+ pattern: z.ZodString;
2511
+ message: z.ZodOptional<z.ZodString>;
2512
+ reason: z.ZodOptional<z.ZodString>;
2513
+ weight: z.ZodDefault<z.ZodNumber>;
2514
+ }, z.core.$strip>>>;
2515
+ }, z.core.$strip>;
2516
+ type PolicyRule = z.infer<typeof policyRuleSchema>;
2517
+ type PolicyFile = z.infer<typeof policyFileSchema>;
2518
+ type PolicySignalOptions = {
2519
+ repositoryRoot: string;
2520
+ enabled?: boolean;
2521
+ coefficient?: number;
2522
+ policyPath?: string;
2523
+ };
2524
+ declare function createPolicySignal(options: PolicySignalOptions): Signal;
2525
+ declare function readPolicyFile(path: string): Promise<PolicyFile>;
2526
+
2527
+ export { ACTIVE_PLAN_STATUSES, type AbandonOptions, ActivePlanExistsError, type AmendPlanPatch, type ArchitectureMap, type Assessment, type AssessmentInput, type AssessmentStats, type AssessorOptions, type BudgetClampResult, type ChurnSignalOptions, CodeBuddy, CodeBuddyConfig, type CompleteOptions, ContextPolicy, type CreatePlanInput, DefaultPolicy, type DefaultPolicyOptions, EmbeddingRequest, EmbeddingResponse, type Evidence, HuggingFaceProvider, type HuggingFaceProviderOptions, type IncidentSignalOptions, type MapQuery, MemoryFileStore, MemoryRepository, type MigrationPreview, ModelProvider, type ModuleEdge, type ModuleNode, PLAN_POLICIES, PLAN_STATUSES, PlanFileStore, type PlanFrontMatter, PlanInput, PlanLifecycle, PlanLockError, type PlanLockOptions, PlanNotFoundError, type PlanPolicy, type PlanSpec, type PlanStatus, PlanTransitionError, PlanValidationError, type PlanWrite, PlannedContext, type PlannedFile, type PlannedTest, type PolicyFile, type PolicyRule, type PolicySignalOptions, type RiskAssessRequest, RiskAssessor, type RiskCategory, type RiskItem, type Signal, type SignalContribution, type SignalStat, assessRisk, buildArchitectureMap, checkConfigPermissions, clampBudgetForCallerModel, configPath, countTokens, createChurnSignal, createIncidentSignal, createPolicySignal, createPostgresRepository, createRuntime, decodeFactCursor, encodeFactCursor, initConfigFile, initProjectScaffold, inspectNamespace, listFactsPage, loadPlanPolicy, loadRuntimeConfig, mcpToolInputSchemas, migrateMemoryToFiles, neighbours, queryMap, readPolicyFile, redactSecrets, registerCodeBuddyTools, resolveRiskPaths, runDoctor, setPlanPolicy, startMcpServer };