@cleocode/core 2026.4.30 → 2026.4.31
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/dist/bootstrap.d.ts +35 -0
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/code/index.d.ts +8 -4
- package/dist/code/index.d.ts.map +1 -1
- package/dist/code/parser.d.ts +22 -9
- package/dist/code/parser.d.ts.map +1 -1
- package/dist/hooks/handlers/session-hooks.d.ts +11 -4
- package/dist/hooks/handlers/session-hooks.d.ts.map +1 -1
- package/dist/hooks/payload-schemas.d.ts +6 -6
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3859 -3008
- package/dist/index.js.map +4 -4
- package/dist/internal.d.ts +10 -7
- package/dist/internal.d.ts.map +1 -1
- package/dist/lib/tree-sitter-languages.d.ts +11 -7
- package/dist/lib/tree-sitter-languages.d.ts.map +1 -1
- package/dist/memory/auto-extract.d.ts +27 -15
- package/dist/memory/auto-extract.d.ts.map +1 -1
- package/dist/memory/brain-backfill.d.ts +59 -0
- package/dist/memory/brain-backfill.d.ts.map +1 -0
- package/dist/memory/brain-purge.d.ts +51 -0
- package/dist/memory/brain-purge.d.ts.map +1 -0
- package/dist/memory/brain-retrieval.d.ts.map +1 -1
- package/dist/memory/brain-search.d.ts.map +1 -1
- package/dist/memory/decisions.d.ts.map +1 -1
- package/dist/memory/engine-compat.d.ts +71 -0
- package/dist/memory/engine-compat.d.ts.map +1 -1
- package/dist/memory/graph-auto-populate.d.ts +65 -0
- package/dist/memory/graph-auto-populate.d.ts.map +1 -0
- package/dist/memory/graph-queries.d.ts +127 -0
- package/dist/memory/graph-queries.d.ts.map +1 -0
- package/dist/memory/learnings.d.ts +2 -0
- package/dist/memory/learnings.d.ts.map +1 -1
- package/dist/memory/patterns.d.ts +2 -0
- package/dist/memory/patterns.d.ts.map +1 -1
- package/dist/memory/quality-scoring.d.ts +90 -0
- package/dist/memory/quality-scoring.d.ts.map +1 -0
- package/dist/sessions/session-memory-bridge.d.ts +16 -10
- package/dist/sessions/session-memory-bridge.d.ts.map +1 -1
- package/dist/store/brain-accessor.d.ts +7 -0
- package/dist/store/brain-accessor.d.ts.map +1 -1
- package/dist/store/brain-schema.d.ts +185 -11
- package/dist/store/brain-schema.d.ts.map +1 -1
- package/dist/store/brain-sqlite.d.ts.map +1 -1
- package/dist/store/nexus-schema.d.ts +480 -2
- package/dist/store/nexus-schema.d.ts.map +1 -1
- package/dist/store/tasks-schema.d.ts +9 -9
- package/dist/store/validation-schemas.d.ts +44 -28
- package/dist/store/validation-schemas.d.ts.map +1 -1
- package/dist/system/dependencies.d.ts +43 -0
- package/dist/system/dependencies.d.ts.map +1 -0
- package/dist/system/health.d.ts +3 -0
- package/dist/system/health.d.ts.map +1 -1
- package/dist/tasks/complete.d.ts.map +1 -1
- package/package.json +19 -19
- package/src/bootstrap.ts +124 -0
- package/src/code/index.ts +20 -4
- package/src/code/parser.ts +310 -110
- package/src/hooks/handlers/__tests__/hook-automation-e2e.test.ts +19 -45
- package/src/hooks/handlers/__tests__/session-hooks.test.ts +42 -54
- package/src/hooks/handlers/session-hooks.ts +11 -33
- package/src/index.ts +14 -0
- package/src/internal.ts +37 -7
- package/src/lib/tree-sitter-languages.ts +11 -7
- package/src/memory/__tests__/auto-extract.test.ts +20 -82
- package/src/memory/__tests__/embedding-pipeline.test.ts +389 -0
- package/src/memory/auto-extract.ts +34 -120
- package/src/memory/brain-backfill.ts +471 -0
- package/src/memory/brain-purge.ts +315 -0
- package/src/memory/brain-retrieval.ts +43 -2
- package/src/memory/brain-search.ts +23 -6
- package/src/memory/decisions.ts +76 -3
- package/src/memory/engine-compat.ts +168 -0
- package/src/memory/graph-auto-populate.ts +173 -0
- package/src/memory/graph-queries.ts +424 -0
- package/src/memory/learnings.ts +55 -7
- package/src/memory/patterns.ts +66 -13
- package/src/memory/quality-scoring.ts +173 -0
- package/src/sessions/__tests__/session-memory-bridge.test.ts +27 -49
- package/src/sessions/session-memory-bridge.ts +19 -47
- package/src/store/__tests__/brain-accessor-pageindex.test.ts +93 -22
- package/src/store/brain-accessor.ts +48 -2
- package/src/store/brain-schema.ts +165 -13
- package/src/store/brain-sqlite.ts +35 -0
- package/src/store/nexus-schema.ts +257 -3
- package/src/system/dependencies.ts +534 -0
- package/src/system/health.ts +126 -22
- package/src/tasks/complete.ts +40 -0
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Brain graph traversal queries using recursive CTEs and native SQLite.
|
|
3
|
+
*
|
|
4
|
+
* Implements BFS traversal, typed neighbor lookup, 360-degree context view,
|
|
5
|
+
* and aggregate statistics for the brain_page_nodes / brain_page_edges graph
|
|
6
|
+
* populated by T528 + T530.
|
|
7
|
+
*
|
|
8
|
+
* Uses getBrainNativeDb() (DatabaseSync) for recursive CTEs that Drizzle's
|
|
9
|
+
* ORM layer cannot express directly.
|
|
10
|
+
*
|
|
11
|
+
* @task T535
|
|
12
|
+
* @epic T523
|
|
13
|
+
*/
|
|
14
|
+
import type { BrainEdgeType, BrainPageEdgeRow, BrainPageNodeRow } from '../store/brain-schema.js';
|
|
15
|
+
/** A node returned from a BFS traversal, annotated with its discovery depth. */
|
|
16
|
+
export interface TraceNode extends BrainPageNodeRow {
|
|
17
|
+
/** Distance from the seed node (0 = seed itself). */
|
|
18
|
+
depth: number;
|
|
19
|
+
}
|
|
20
|
+
/** A neighbor node with the edge that connects it to the queried node. */
|
|
21
|
+
export interface RelatedNode {
|
|
22
|
+
/** The neighbour node. */
|
|
23
|
+
node: BrainPageNodeRow;
|
|
24
|
+
/** Edge relationship type. */
|
|
25
|
+
edgeType: BrainEdgeType;
|
|
26
|
+
/** Direction: 'out' (queried node is from_id) or 'in' (queried node is to_id). */
|
|
27
|
+
direction: 'out' | 'in';
|
|
28
|
+
/** Edge weight/confidence 0.0–1.0. */
|
|
29
|
+
weight: number;
|
|
30
|
+
}
|
|
31
|
+
/** Full context for a single node: itself, incoming edges, outgoing edges, and neighbour nodes. */
|
|
32
|
+
export interface NodeContext {
|
|
33
|
+
/** The node itself. */
|
|
34
|
+
node: BrainPageNodeRow;
|
|
35
|
+
/** Edges where this node is the target (in-edges). */
|
|
36
|
+
inEdges: BrainPageEdgeRow[];
|
|
37
|
+
/** Edges where this node is the source (out-edges). */
|
|
38
|
+
outEdges: BrainPageEdgeRow[];
|
|
39
|
+
/** All neighbour nodes reachable via in- or out-edges, deduplicated. */
|
|
40
|
+
neighbors: RelatedNode[];
|
|
41
|
+
}
|
|
42
|
+
/** Aggregate statistics for the graph. */
|
|
43
|
+
export interface GraphStats {
|
|
44
|
+
/** Node counts grouped by node_type. */
|
|
45
|
+
nodesByType: Array<{
|
|
46
|
+
nodeType: string;
|
|
47
|
+
count: number;
|
|
48
|
+
}>;
|
|
49
|
+
/** Edge counts grouped by edge_type. */
|
|
50
|
+
edgesByType: Array<{
|
|
51
|
+
edgeType: string;
|
|
52
|
+
count: number;
|
|
53
|
+
}>;
|
|
54
|
+
/** Total node count. */
|
|
55
|
+
totalNodes: number;
|
|
56
|
+
/** Total edge count. */
|
|
57
|
+
totalEdges: number;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Traverse the brain knowledge graph using BFS from a seed node.
|
|
61
|
+
*
|
|
62
|
+
* Uses a recursive CTE that follows edges in both directions. Nodes are
|
|
63
|
+
* returned in ascending depth order, then descending quality_score. The seed
|
|
64
|
+
* node itself is returned at depth 0.
|
|
65
|
+
*
|
|
66
|
+
* @param projectRoot - Absolute path to the project root (locates brain.db)
|
|
67
|
+
* @param nodeId - Starting node ID (format: '<type>:<source-id>')
|
|
68
|
+
* @param maxDepth - Maximum traversal depth (default 3)
|
|
69
|
+
* @returns Array of nodes annotated with their discovery depth
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```typescript
|
|
73
|
+
* const nodes = await traceBrainGraph('/project', 'decision:D-abc123', 2);
|
|
74
|
+
* for (const n of nodes) console.log(n.depth, n.id, n.label);
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
77
|
+
export declare function traceBrainGraph(projectRoot: string, nodeId: string, maxDepth?: number): Promise<TraceNode[]>;
|
|
78
|
+
/**
|
|
79
|
+
* Return the immediate (1-hop) neighbours of a node, including edge metadata.
|
|
80
|
+
*
|
|
81
|
+
* Follows edges in both directions. Results are sorted by edge weight
|
|
82
|
+
* descending, then quality_score descending.
|
|
83
|
+
*
|
|
84
|
+
* @param projectRoot - Absolute path to the project root
|
|
85
|
+
* @param nodeId - Node to inspect (format: '<type>:<source-id>')
|
|
86
|
+
* @param edgeType - Optional edge type filter (e.g. 'applies_to')
|
|
87
|
+
* @returns Array of neighbour nodes with edge relationship info
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* ```typescript
|
|
91
|
+
* const related = await relatedBrainNodes('/project', 'decision:D-abc123', 'applies_to');
|
|
92
|
+
* ```
|
|
93
|
+
*/
|
|
94
|
+
export declare function relatedBrainNodes(projectRoot: string, nodeId: string, edgeType?: string): Promise<RelatedNode[]>;
|
|
95
|
+
/**
|
|
96
|
+
* Return a 360-degree view of a single graph node.
|
|
97
|
+
*
|
|
98
|
+
* Provides the node itself, all incoming edges, all outgoing edges, and the
|
|
99
|
+
* full set of neighbour nodes with their edge relationships.
|
|
100
|
+
*
|
|
101
|
+
* @param projectRoot - Absolute path to the project root
|
|
102
|
+
* @param nodeId - Node to inspect (format: '<type>:<source-id>')
|
|
103
|
+
* @returns Full context record, or null if the node does not exist
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
* ```typescript
|
|
107
|
+
* const ctx = await contextBrainNode('/project', 'decision:D-abc123');
|
|
108
|
+
* if (ctx) {
|
|
109
|
+
* console.log(ctx.node.label, ctx.outEdges.length, 'outgoing edges');
|
|
110
|
+
* }
|
|
111
|
+
* ```
|
|
112
|
+
*/
|
|
113
|
+
export declare function contextBrainNode(projectRoot: string, nodeId: string): Promise<NodeContext | null>;
|
|
114
|
+
/**
|
|
115
|
+
* Return aggregate counts for brain_page_nodes and brain_page_edges by type.
|
|
116
|
+
*
|
|
117
|
+
* @param projectRoot - Absolute path to the project root
|
|
118
|
+
* @returns Counts by node type and edge type, plus totals
|
|
119
|
+
*
|
|
120
|
+
* @example
|
|
121
|
+
* ```typescript
|
|
122
|
+
* const stats = await graphStats('/project');
|
|
123
|
+
* console.log(stats.totalNodes, stats.totalEdges);
|
|
124
|
+
* ```
|
|
125
|
+
*/
|
|
126
|
+
export declare function graphStats(projectRoot: string): Promise<GraphStats>;
|
|
127
|
+
//# sourceMappingURL=graph-queries.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph-queries.d.ts","sourceRoot":"","sources":["../../src/memory/graph-queries.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAOlG,gFAAgF;AAChF,MAAM,WAAW,SAAU,SAAQ,gBAAgB;IACjD,qDAAqD;IACrD,KAAK,EAAE,MAAM,CAAC;CACf;AAED,0EAA0E;AAC1E,MAAM,WAAW,WAAW;IAC1B,0BAA0B;IAC1B,IAAI,EAAE,gBAAgB,CAAC;IACvB,8BAA8B;IAC9B,QAAQ,EAAE,aAAa,CAAC;IACxB,kFAAkF;IAClF,SAAS,EAAE,KAAK,GAAG,IAAI,CAAC;IACxB,sCAAsC;IACtC,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,mGAAmG;AACnG,MAAM,WAAW,WAAW;IAC1B,uBAAuB;IACvB,IAAI,EAAE,gBAAgB,CAAC;IACvB,sDAAsD;IACtD,OAAO,EAAE,gBAAgB,EAAE,CAAC;IAC5B,uDAAuD;IACvD,QAAQ,EAAE,gBAAgB,EAAE,CAAC;IAC7B,wEAAwE;IACxE,SAAS,EAAE,WAAW,EAAE,CAAC;CAC1B;AAED,0CAA0C;AAC1C,MAAM,WAAW,UAAU;IACzB,wCAAwC;IACxC,WAAW,EAAE,KAAK,CAAC;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACxD,wCAAwC;IACxC,WAAW,EAAE,KAAK,CAAC;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACxD,wBAAwB;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,wBAAwB;IACxB,UAAU,EAAE,MAAM,CAAC;CACpB;AA0DD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,eAAe,CACnC,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,MAAM,EACd,QAAQ,SAAI,GACX,OAAO,CAAC,SAAS,EAAE,CAAC,CAgDtB;AAMD;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,iBAAiB,CACrC,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,MAAM,EACd,QAAQ,CAAC,EAAE,MAAM,GAChB,OAAO,CAAC,WAAW,EAAE,CAAC,CA+CxB;AAMD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,gBAAgB,CACpC,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,CAqF7B;AAMD;;;;;;;;;;;GAWG;AACH,wBAAsB,UAAU,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CA+BzE"}
|
|
@@ -34,6 +34,7 @@ export declare function storeLearning(projectRoot: string, params: StoreLearning
|
|
|
34
34
|
applicableTypes: any;
|
|
35
35
|
id: string;
|
|
36
36
|
confidence: number;
|
|
37
|
+
qualityScore: number | null;
|
|
37
38
|
createdAt: string;
|
|
38
39
|
updatedAt: string | null;
|
|
39
40
|
insight: string;
|
|
@@ -51,6 +52,7 @@ export declare function searchLearnings(projectRoot: string, params?: SearchLear
|
|
|
51
52
|
applicableTypes: any;
|
|
52
53
|
id: string;
|
|
53
54
|
confidence: number;
|
|
55
|
+
qualityScore: number | null;
|
|
54
56
|
createdAt: string;
|
|
55
57
|
updatedAt: string | null;
|
|
56
58
|
insight: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"learnings.d.ts","sourceRoot":"","sources":["../../src/memory/learnings.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;
|
|
1
|
+
{"version":3,"file":"learnings.d.ts","sourceRoot":"","sources":["../../src/memory/learnings.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAOH,6CAA6C;AAC7C,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;CAC5B;AAED,0CAA0C;AAC1C,MAAM,WAAW,oBAAoB;IACnC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AASD;;;GAGG;AACH,wBAAsB,aAAa,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,mBAAmB;;;;;;;;;;;;GAuFnF;AAED;;;;GAIG;AACH,wBAAsB,eAAe,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,GAAE,oBAAyB;;;;;;;;;;;;KAiC3F;AAED;;;GAGG;AACH,wBAAsB,aAAa,CAAC,WAAW,EAAE,MAAM;;;;;;;GA2BtD"}
|
|
@@ -43,6 +43,7 @@ export declare function storePattern(projectRoot: string, params: StorePatternPa
|
|
|
43
43
|
type: "success" | "failure" | "workflow" | "blocker" | "optimization";
|
|
44
44
|
pattern: string;
|
|
45
45
|
id: string;
|
|
46
|
+
qualityScore: number | null;
|
|
46
47
|
updatedAt: string | null;
|
|
47
48
|
context: string;
|
|
48
49
|
successRate: number | null;
|
|
@@ -62,6 +63,7 @@ export declare function searchPatterns(projectRoot: string, params?: SearchPatte
|
|
|
62
63
|
type: "success" | "failure" | "workflow" | "blocker" | "optimization";
|
|
63
64
|
pattern: string;
|
|
64
65
|
id: string;
|
|
66
|
+
qualityScore: number | null;
|
|
65
67
|
updatedAt: string | null;
|
|
66
68
|
context: string;
|
|
67
69
|
successRate: number | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"patterns.d.ts","sourceRoot":"","sources":["../../src/memory/patterns.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;
|
|
1
|
+
{"version":3,"file":"patterns.d.ts","sourceRoot":"","sources":["../../src/memory/patterns.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAOH,kCAAkC;AAClC,MAAM,MAAM,WAAW,GAAG,UAAU,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,cAAc,CAAC;AAE1F,oBAAoB;AACpB,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;AAEtD,4CAA4C;AAC5C,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,WAAW,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,yCAAyC;AACzC,MAAM,WAAW,mBAAmB;IAClC,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AASD;;;;GAIG;AACH,wBAAsB,YAAY,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,kBAAkB;;;;;;;;;;;;;;;GAoGjF;AAED;;;GAGG;AACH,wBAAsB,cAAc,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,GAAE,mBAAwB;;;;;;;;;;;;;;;KA0BzF;AAED;;;GAGG;AACH,wBAAsB,YAAY,CAAC,WAAW,EAAE,MAAM;;;;;iBAa5B,MAAM;mBAAa,MAAM;;GAgBlD"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Quality scoring for CLEO BRAIN memory entries.
|
|
3
|
+
*
|
|
4
|
+
* Computes a 0.0–1.0 quality score at insert time for each typed brain table entry.
|
|
5
|
+
* Entries with a score below the minimum threshold are excluded from search results.
|
|
6
|
+
*
|
|
7
|
+
* Score formula per CA1 spec Section 3: source reliability * content richness * recency signals.
|
|
8
|
+
* Each helper clamps the result to [0.0, 1.0].
|
|
9
|
+
*
|
|
10
|
+
* Exported for use in backfill (T530) and future scoring hooks.
|
|
11
|
+
*
|
|
12
|
+
* @task T531
|
|
13
|
+
* @epic T523
|
|
14
|
+
*/
|
|
15
|
+
/** Minimum quality score for inclusion in search results. */
|
|
16
|
+
export declare const QUALITY_SCORE_THRESHOLD = 0.3;
|
|
17
|
+
/** Input shape for pattern quality computation — mirrors StorePatternParams. */
|
|
18
|
+
export interface PatternQualityInput {
|
|
19
|
+
type: string;
|
|
20
|
+
pattern: string;
|
|
21
|
+
context?: string | null;
|
|
22
|
+
examples_json?: string | null;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Compute quality score for a brain_patterns row.
|
|
26
|
+
*
|
|
27
|
+
* Base: 0.4 (auto-generated patterns start lower).
|
|
28
|
+
* Bonuses:
|
|
29
|
+
* +0.10 for 'workflow' type (structured operational knowledge)
|
|
30
|
+
* +0.05 for 'success' type (validated positive pattern)
|
|
31
|
+
* +0.10 if pattern text exceeds 100 chars (richer description)
|
|
32
|
+
* +0.10 if context exceeds 50 chars (contextual detail present)
|
|
33
|
+
* +0.10 if examples_json contains more than 3 items (empirically validated)
|
|
34
|
+
*
|
|
35
|
+
* Result clamped to [0.0, 1.0].
|
|
36
|
+
*/
|
|
37
|
+
export declare function computePatternQuality(params: PatternQualityInput): number;
|
|
38
|
+
/** Input shape for learning quality computation — mirrors StoreLearningParams. */
|
|
39
|
+
export interface LearningQualityInput {
|
|
40
|
+
confidence: number;
|
|
41
|
+
actionable?: boolean | null;
|
|
42
|
+
insight: string;
|
|
43
|
+
application?: string | null;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Compute quality score for a brain_learnings row.
|
|
47
|
+
*
|
|
48
|
+
* Base: confidence value (already 0.0–1.0, caller-provided).
|
|
49
|
+
* Bonuses:
|
|
50
|
+
* +0.10 if actionable (directly applicable guidance)
|
|
51
|
+
* +0.10 if insight text exceeds 100 chars (detailed insight)
|
|
52
|
+
* +0.10 if application exceeds 20 chars (concrete application context)
|
|
53
|
+
*
|
|
54
|
+
* Result clamped to [0.0, 1.0].
|
|
55
|
+
*/
|
|
56
|
+
export declare function computeLearningQuality(params: LearningQualityInput): number;
|
|
57
|
+
/** Input shape for decision quality computation — mirrors StoreDecisionParams. */
|
|
58
|
+
export interface DecisionQualityInput {
|
|
59
|
+
confidence: 'low' | 'medium' | 'high';
|
|
60
|
+
rationale?: string | null;
|
|
61
|
+
contextTaskId?: string | null;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Compute quality score for a brain_decisions row.
|
|
65
|
+
*
|
|
66
|
+
* Base: mapped from confidence level (high=0.9, medium=0.7, low=0.5).
|
|
67
|
+
* Bonuses:
|
|
68
|
+
* +0.10 if rationale exceeds 50 chars (substantiated reasoning)
|
|
69
|
+
* +0.05 if linked to a specific task (anchored in real work)
|
|
70
|
+
*
|
|
71
|
+
* Result clamped to [0.0, 1.0].
|
|
72
|
+
*/
|
|
73
|
+
export declare function computeDecisionQuality(params: DecisionQualityInput): number;
|
|
74
|
+
/** Input shape for observation quality computation — mirrors ObserveBrainParams. */
|
|
75
|
+
export interface ObservationQualityInput {
|
|
76
|
+
text: string;
|
|
77
|
+
title?: string | null;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Compute quality score for a brain_observations row.
|
|
81
|
+
*
|
|
82
|
+
* Base: 0.6 (manual observations start higher than auto-extracted entries).
|
|
83
|
+
* Bonuses:
|
|
84
|
+
* +0.10 if text exceeds 200 chars (rich narrative)
|
|
85
|
+
* +0.05 if title exceeds 10 chars (meaningful label)
|
|
86
|
+
*
|
|
87
|
+
* Result clamped to [0.0, 1.0].
|
|
88
|
+
*/
|
|
89
|
+
export declare function computeObservationQuality(params: ObservationQualityInput): number;
|
|
90
|
+
//# sourceMappingURL=quality-scoring.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quality-scoring.d.ts","sourceRoot":"","sources":["../../src/memory/quality-scoring.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,6DAA6D;AAC7D,eAAO,MAAM,uBAAuB,MAAM,CAAC;AAM3C,gFAAgF;AAChF,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,mBAAmB,GAAG,MAAM,CAmBzE;AAMD,kFAAkF;AAClF,MAAM,WAAW,oBAAoB;IACnC,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,oBAAoB,GAAG,MAAM,CAQ3E;AAMD,kFAAkF;AAClF,MAAM,WAAW,oBAAoB;IACnC,UAAU,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;IACtC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B;AASD;;;;;;;;;GASG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,oBAAoB,GAAG,MAAM,CAO3E;AAMD,oFAAoF;AACpF,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB;AAED;;;;;;;;;GASG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,uBAAuB,GAAG,MAAM,CAOjF"}
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Memory-session bridge —
|
|
2
|
+
* Memory-session bridge — no-op placeholder retained for call-site compatibility.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* Previously this function wrote a session summary observation to brain.db and
|
|
5
|
+
* triggered auto-extraction of structured memory. Both were removed in T527
|
|
6
|
+
* because session data already lives in the sessions table; duplicating it to
|
|
7
|
+
* brain_observations was pure noise.
|
|
8
|
+
*
|
|
9
|
+
* The function is kept (as a no-op) so callers in sessions/index.ts do not need
|
|
10
|
+
* to be updated in this task.
|
|
7
11
|
*
|
|
8
12
|
* @task T5392
|
|
9
13
|
* @epic T5149
|
|
14
|
+
* @see T527 — removal of duplicate session observation writes
|
|
10
15
|
*/
|
|
11
16
|
/** Session data needed to create a memory bridge observation. */
|
|
12
17
|
export interface SessionBridgeData {
|
|
@@ -16,13 +21,14 @@ export interface SessionBridgeData {
|
|
|
16
21
|
duration: number;
|
|
17
22
|
}
|
|
18
23
|
/**
|
|
19
|
-
* Bridge session end data
|
|
24
|
+
* Bridge session end data — currently a no-op.
|
|
20
25
|
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
26
|
+
* Retained for call-site compatibility. Previously wrote a duplicate summary
|
|
27
|
+
* observation to brain.db and triggered extractSessionEndMemory; both were
|
|
28
|
+
* removed in T527 to reduce brain.db noise.
|
|
23
29
|
*
|
|
24
|
-
* @param
|
|
25
|
-
* @param
|
|
30
|
+
* @param _projectRoot - Project root directory (unused)
|
|
31
|
+
* @param _sessionData - Session metadata (unused)
|
|
26
32
|
*/
|
|
27
|
-
export declare function bridgeSessionToMemory(
|
|
33
|
+
export declare function bridgeSessionToMemory(_projectRoot: string, _sessionData: SessionBridgeData): Promise<void>;
|
|
28
34
|
//# sourceMappingURL=session-memory-bridge.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-memory-bridge.d.ts","sourceRoot":"","sources":["../../src/sessions/session-memory-bridge.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"session-memory-bridge.d.ts","sourceRoot":"","sources":["../../src/sessions/session-memory-bridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,iEAAiE;AACjE,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;GASG;AACH,wBAAsB,qBAAqB,CACzC,YAAY,EAAE,MAAM,EACpB,YAAY,EAAE,iBAAiB,GAC9B,OAAO,CAAC,IAAI,CAAC,CAGf"}
|
|
@@ -71,10 +71,17 @@ export declare class BrainDataAccessor {
|
|
|
71
71
|
getPageNode(id: string): Promise<BrainPageNodeRow | null>;
|
|
72
72
|
findPageNodes(params?: {
|
|
73
73
|
nodeType?: (typeof brainSchema.BRAIN_NODE_TYPES)[number];
|
|
74
|
+
minQualityScore?: number;
|
|
74
75
|
limit?: number;
|
|
75
76
|
}): Promise<BrainPageNodeRow[]>;
|
|
77
|
+
updatePageNode(id: string, updates: Partial<NewBrainPageNodeRow>): Promise<void>;
|
|
76
78
|
removePageNode(id: string): Promise<void>;
|
|
77
79
|
addPageEdge(edge: NewBrainPageEdgeRow): Promise<BrainPageEdgeRow>;
|
|
80
|
+
findPageEdges(params?: {
|
|
81
|
+
edgeType?: (typeof brainSchema.BRAIN_EDGE_TYPES)[number];
|
|
82
|
+
provenance?: string;
|
|
83
|
+
limit?: number;
|
|
84
|
+
}): Promise<BrainPageEdgeRow[]>;
|
|
78
85
|
getPageEdges(nodeId: string, direction?: 'in' | 'out' | 'both'): Promise<BrainPageEdgeRow[]>;
|
|
79
86
|
getNeighbors(nodeId: string, edgeType?: (typeof brainSchema.BRAIN_EDGE_TYPES)[number]): Promise<BrainPageNodeRow[]>;
|
|
80
87
|
removePageEdge(fromId: string, toId: string, edgeType: (typeof brainSchema.BRAIN_EDGE_TYPES)[number]): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"brain-accessor.d.ts","sourceRoot":"","sources":["../../src/store/brain-accessor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,KAAK,EACV,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,sBAAsB,EACtB,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EAClB,qBAAqB,EACtB,MAAM,mBAAm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AO,CAAC,mBAAmB,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAOhF,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAezC,WAAW,CAAC,IAAI,EAAE,mBAAmB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAejE,aAAa,CACjB,MAAM,GAAE;QACN,QAAQ,CAAC,EAAE,CAAC,OAAO,WAAW,CAAC,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;QACzD,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,KAAK,CAAC,EAAE,MAAM,CAAC;KACX,GACL,OAAO,CAAC,gBAAgB,EAAE,CAAC;IA0BxB,YAAY,CAChB,MAAM,EAAE,MAAM,EACd,SAAS,GAAE,IAAI,GAAG,KAAK,GAAG,MAAe,GACxC,OAAO,CAAC,gBAAgB,EAAE,CAAC;IA4BxB,YAAY,CAChB,MAAM,EAAE,MAAM,EACd,QAAQ,CAAC,EAAE,CAAC,OAAO,WAAW,CAAC,gBAAgB,CAAC,CAAC,MAAM,CAAC,GACvD,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAuBxB,cAAc,CAClB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,CAAC,OAAO,WAAW,CAAC,gBAAgB,CAAC,CAAC,MAAM,CAAC,GACtD,OAAO,CAAC,IAAI,CAAC;CAWjB;AAED;;GAEG;AACH,wBAAsB,gBAAgB,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAG/E"}
|
|
@@ -196,6 +196,22 @@ export declare const brainDecisions: import("drizzle-orm/sqlite-core").SQLiteTab
|
|
|
196
196
|
identity: undefined;
|
|
197
197
|
generated: undefined;
|
|
198
198
|
}, {}>;
|
|
199
|
+
qualityScore: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
200
|
+
name: string;
|
|
201
|
+
tableName: "brain_decisions";
|
|
202
|
+
dataType: "number double";
|
|
203
|
+
data: number;
|
|
204
|
+
driverParam: number;
|
|
205
|
+
notNull: false;
|
|
206
|
+
hasDefault: false;
|
|
207
|
+
isPrimaryKey: false;
|
|
208
|
+
isAutoincrement: false;
|
|
209
|
+
hasRuntimeDefault: false;
|
|
210
|
+
enumValues: undefined;
|
|
211
|
+
baseColumn: never;
|
|
212
|
+
identity: undefined;
|
|
213
|
+
generated: undefined;
|
|
214
|
+
}, {}>;
|
|
199
215
|
createdAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
200
216
|
name: string;
|
|
201
217
|
tableName: "brain_decisions";
|
|
@@ -427,6 +443,22 @@ export declare const brainPatterns: import("drizzle-orm/sqlite-core").SQLiteTabl
|
|
|
427
443
|
identity: undefined;
|
|
428
444
|
generated: undefined;
|
|
429
445
|
}, {}>;
|
|
446
|
+
qualityScore: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
447
|
+
name: string;
|
|
448
|
+
tableName: "brain_patterns";
|
|
449
|
+
dataType: "number double";
|
|
450
|
+
data: number;
|
|
451
|
+
driverParam: number;
|
|
452
|
+
notNull: false;
|
|
453
|
+
hasDefault: false;
|
|
454
|
+
isPrimaryKey: false;
|
|
455
|
+
isAutoincrement: false;
|
|
456
|
+
hasRuntimeDefault: false;
|
|
457
|
+
enumValues: undefined;
|
|
458
|
+
baseColumn: never;
|
|
459
|
+
identity: undefined;
|
|
460
|
+
generated: undefined;
|
|
461
|
+
}, {}>;
|
|
430
462
|
};
|
|
431
463
|
dialect: "sqlite";
|
|
432
464
|
}>;
|
|
@@ -578,6 +610,22 @@ export declare const brainLearnings: import("drizzle-orm/sqlite-core").SQLiteTab
|
|
|
578
610
|
identity: undefined;
|
|
579
611
|
generated: undefined;
|
|
580
612
|
}, {}>;
|
|
613
|
+
qualityScore: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
614
|
+
name: string;
|
|
615
|
+
tableName: "brain_learnings";
|
|
616
|
+
dataType: "number double";
|
|
617
|
+
data: number;
|
|
618
|
+
driverParam: number;
|
|
619
|
+
notNull: false;
|
|
620
|
+
hasDefault: false;
|
|
621
|
+
isPrimaryKey: false;
|
|
622
|
+
isAutoincrement: false;
|
|
623
|
+
hasRuntimeDefault: false;
|
|
624
|
+
enumValues: undefined;
|
|
625
|
+
baseColumn: never;
|
|
626
|
+
identity: undefined;
|
|
627
|
+
generated: undefined;
|
|
628
|
+
}, {}>;
|
|
581
629
|
};
|
|
582
630
|
dialect: "sqlite";
|
|
583
631
|
}>;
|
|
@@ -826,6 +874,22 @@ export declare const brainObservations: import("drizzle-orm/sqlite-core").SQLite
|
|
|
826
874
|
identity: undefined;
|
|
827
875
|
generated: undefined;
|
|
828
876
|
}, {}>;
|
|
877
|
+
qualityScore: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
878
|
+
name: string;
|
|
879
|
+
tableName: "brain_observations";
|
|
880
|
+
dataType: "number double";
|
|
881
|
+
data: number;
|
|
882
|
+
driverParam: number;
|
|
883
|
+
notNull: false;
|
|
884
|
+
hasDefault: false;
|
|
885
|
+
isPrimaryKey: false;
|
|
886
|
+
isAutoincrement: false;
|
|
887
|
+
hasRuntimeDefault: false;
|
|
888
|
+
enumValues: undefined;
|
|
889
|
+
baseColumn: never;
|
|
890
|
+
identity: undefined;
|
|
891
|
+
generated: undefined;
|
|
892
|
+
}, {}>;
|
|
829
893
|
createdAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
830
894
|
name: string;
|
|
831
895
|
tableName: "brain_observations";
|
|
@@ -1156,11 +1220,35 @@ export declare const brainSchemaMeta: import("drizzle-orm/sqlite-core").SQLiteTa
|
|
|
1156
1220
|
};
|
|
1157
1221
|
dialect: "sqlite";
|
|
1158
1222
|
}>;
|
|
1159
|
-
/**
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1223
|
+
/**
|
|
1224
|
+
* Node types for the graph-native memory model.
|
|
1225
|
+
* Mirrors typed tables (decision, pattern, learning, observation, sticky),
|
|
1226
|
+
* adds task provenance (task, session, epic), codebase bridging (file, symbol),
|
|
1227
|
+
* and abstract/synthesized types (concept, summary).
|
|
1228
|
+
*/
|
|
1229
|
+
export declare const BRAIN_NODE_TYPES: readonly ["decision", "pattern", "learning", "observation", "sticky", "task", "session", "epic", "file", "symbol", "concept", "summary"];
|
|
1230
|
+
/** Discriminated union of all supported brain graph node types. */
|
|
1231
|
+
export type BrainNodeType = (typeof BRAIN_NODE_TYPES)[number];
|
|
1232
|
+
/**
|
|
1233
|
+
* Edge types for the graph-native memory model.
|
|
1234
|
+
* Covers provenance/derivation, semantic relationships, structural links,
|
|
1235
|
+
* and graph bridging between memory entities and codebase nodes.
|
|
1236
|
+
*/
|
|
1237
|
+
export declare const BRAIN_EDGE_TYPES: readonly ["derived_from", "produced_by", "informed_by", "supports", "contradicts", "supersedes", "applies_to", "documents", "summarizes", "part_of", "references", "modified_by"];
|
|
1238
|
+
/** Discriminated union of all supported brain graph edge types. */
|
|
1239
|
+
export type BrainEdgeType = (typeof BRAIN_EDGE_TYPES)[number];
|
|
1240
|
+
/**
|
|
1241
|
+
* Graph nodes table — the traversable knowledge graph layer.
|
|
1242
|
+
*
|
|
1243
|
+
* Every entity row in a typed table (decisions, patterns, learnings,
|
|
1244
|
+
* observations) gets a corresponding node here. The typed table row is
|
|
1245
|
+
* the source of truth; the graph node is the index entry for traversal
|
|
1246
|
+
* and cross-entity reasoning.
|
|
1247
|
+
*
|
|
1248
|
+
* Node ID convention: '<type>:<source-id>'
|
|
1249
|
+
* Examples: 'decision:D-abc123', 'observation:O-mntphoj6-0',
|
|
1250
|
+
* 'task:T523', 'symbol:src/store/brain-schema.ts::brainPageNodes'
|
|
1251
|
+
*/
|
|
1164
1252
|
export declare const brainPageNodes: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
|
|
1165
1253
|
name: "brain_page_nodes";
|
|
1166
1254
|
schema: undefined;
|
|
@@ -1185,14 +1273,14 @@ export declare const brainPageNodes: import("drizzle-orm/sqlite-core").SQLiteTab
|
|
|
1185
1273
|
name: string;
|
|
1186
1274
|
tableName: "brain_page_nodes";
|
|
1187
1275
|
dataType: "string enum";
|
|
1188
|
-
data: "file" | "task" | "
|
|
1276
|
+
data: "symbol" | "file" | "decision" | "pattern" | "learning" | "observation" | "sticky" | "task" | "session" | "epic" | "concept" | "summary";
|
|
1189
1277
|
driverParam: string;
|
|
1190
1278
|
notNull: true;
|
|
1191
1279
|
hasDefault: false;
|
|
1192
1280
|
isPrimaryKey: false;
|
|
1193
1281
|
isAutoincrement: false;
|
|
1194
1282
|
hasRuntimeDefault: false;
|
|
1195
|
-
enumValues: ["task", "
|
|
1283
|
+
enumValues: ["decision", "pattern", "learning", "observation", "sticky", "task", "session", "epic", "file", "symbol", "concept", "summary"];
|
|
1196
1284
|
baseColumn: never;
|
|
1197
1285
|
identity: undefined;
|
|
1198
1286
|
generated: undefined;
|
|
@@ -1213,6 +1301,54 @@ export declare const brainPageNodes: import("drizzle-orm/sqlite-core").SQLiteTab
|
|
|
1213
1301
|
identity: undefined;
|
|
1214
1302
|
generated: undefined;
|
|
1215
1303
|
}, {}>;
|
|
1304
|
+
qualityScore: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
1305
|
+
name: string;
|
|
1306
|
+
tableName: "brain_page_nodes";
|
|
1307
|
+
dataType: "number double";
|
|
1308
|
+
data: number;
|
|
1309
|
+
driverParam: number;
|
|
1310
|
+
notNull: true;
|
|
1311
|
+
hasDefault: true;
|
|
1312
|
+
isPrimaryKey: false;
|
|
1313
|
+
isAutoincrement: false;
|
|
1314
|
+
hasRuntimeDefault: false;
|
|
1315
|
+
enumValues: undefined;
|
|
1316
|
+
baseColumn: never;
|
|
1317
|
+
identity: undefined;
|
|
1318
|
+
generated: undefined;
|
|
1319
|
+
}, {}>;
|
|
1320
|
+
contentHash: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
1321
|
+
name: string;
|
|
1322
|
+
tableName: "brain_page_nodes";
|
|
1323
|
+
dataType: "string";
|
|
1324
|
+
data: string;
|
|
1325
|
+
driverParam: string;
|
|
1326
|
+
notNull: false;
|
|
1327
|
+
hasDefault: false;
|
|
1328
|
+
isPrimaryKey: false;
|
|
1329
|
+
isAutoincrement: false;
|
|
1330
|
+
hasRuntimeDefault: false;
|
|
1331
|
+
enumValues: [string, ...string[]];
|
|
1332
|
+
baseColumn: never;
|
|
1333
|
+
identity: undefined;
|
|
1334
|
+
generated: undefined;
|
|
1335
|
+
}, {}>;
|
|
1336
|
+
lastActivityAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
1337
|
+
name: string;
|
|
1338
|
+
tableName: "brain_page_nodes";
|
|
1339
|
+
dataType: "string";
|
|
1340
|
+
data: string;
|
|
1341
|
+
driverParam: string;
|
|
1342
|
+
notNull: true;
|
|
1343
|
+
hasDefault: true;
|
|
1344
|
+
isPrimaryKey: false;
|
|
1345
|
+
isAutoincrement: false;
|
|
1346
|
+
hasRuntimeDefault: false;
|
|
1347
|
+
enumValues: [string, ...string[]];
|
|
1348
|
+
baseColumn: never;
|
|
1349
|
+
identity: undefined;
|
|
1350
|
+
generated: undefined;
|
|
1351
|
+
}, {}>;
|
|
1216
1352
|
metadataJson: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
1217
1353
|
name: string;
|
|
1218
1354
|
tableName: "brain_page_nodes";
|
|
@@ -1245,10 +1381,32 @@ export declare const brainPageNodes: import("drizzle-orm/sqlite-core").SQLiteTab
|
|
|
1245
1381
|
identity: undefined;
|
|
1246
1382
|
generated: undefined;
|
|
1247
1383
|
}, {}>;
|
|
1384
|
+
updatedAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
1385
|
+
name: string;
|
|
1386
|
+
tableName: "brain_page_nodes";
|
|
1387
|
+
dataType: "string";
|
|
1388
|
+
data: string;
|
|
1389
|
+
driverParam: string;
|
|
1390
|
+
notNull: false;
|
|
1391
|
+
hasDefault: false;
|
|
1392
|
+
isPrimaryKey: false;
|
|
1393
|
+
isAutoincrement: false;
|
|
1394
|
+
hasRuntimeDefault: false;
|
|
1395
|
+
enumValues: [string, ...string[]];
|
|
1396
|
+
baseColumn: never;
|
|
1397
|
+
identity: undefined;
|
|
1398
|
+
generated: undefined;
|
|
1399
|
+
}, {}>;
|
|
1248
1400
|
};
|
|
1249
1401
|
dialect: "sqlite";
|
|
1250
1402
|
}>;
|
|
1251
|
-
/**
|
|
1403
|
+
/**
|
|
1404
|
+
* Graph edges table — directed, typed, weighted, provenance-aware links
|
|
1405
|
+
* between brain_page_nodes entries (or external nexus node IDs).
|
|
1406
|
+
*
|
|
1407
|
+
* The composite primary key (fromId, toId, edgeType) prevents duplicate
|
|
1408
|
+
* edges of the same type between the same pair of nodes.
|
|
1409
|
+
*/
|
|
1252
1410
|
export declare const brainPageEdges: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
|
|
1253
1411
|
name: "brain_page_edges";
|
|
1254
1412
|
schema: undefined;
|
|
@@ -1289,14 +1447,14 @@ export declare const brainPageEdges: import("drizzle-orm/sqlite-core").SQLiteTab
|
|
|
1289
1447
|
name: string;
|
|
1290
1448
|
tableName: "brain_page_edges";
|
|
1291
1449
|
dataType: "string enum";
|
|
1292
|
-
data: "
|
|
1450
|
+
data: "produced_by" | "applies_to" | "informed_by" | "contradicts" | "derived_from" | "supports" | "supersedes" | "documents" | "summarizes" | "part_of" | "references" | "modified_by";
|
|
1293
1451
|
driverParam: string;
|
|
1294
1452
|
notNull: true;
|
|
1295
1453
|
hasDefault: false;
|
|
1296
1454
|
isPrimaryKey: false;
|
|
1297
1455
|
isAutoincrement: false;
|
|
1298
1456
|
hasRuntimeDefault: false;
|
|
1299
|
-
enumValues: ["
|
|
1457
|
+
enumValues: ["derived_from", "produced_by", "informed_by", "supports", "contradicts", "supersedes", "applies_to", "documents", "summarizes", "part_of", "references", "modified_by"];
|
|
1300
1458
|
baseColumn: never;
|
|
1301
1459
|
identity: undefined;
|
|
1302
1460
|
generated: undefined;
|
|
@@ -1307,7 +1465,7 @@ export declare const brainPageEdges: import("drizzle-orm/sqlite-core").SQLiteTab
|
|
|
1307
1465
|
dataType: "number double";
|
|
1308
1466
|
data: number;
|
|
1309
1467
|
driverParam: number;
|
|
1310
|
-
notNull:
|
|
1468
|
+
notNull: true;
|
|
1311
1469
|
hasDefault: true;
|
|
1312
1470
|
isPrimaryKey: false;
|
|
1313
1471
|
isAutoincrement: false;
|
|
@@ -1317,6 +1475,22 @@ export declare const brainPageEdges: import("drizzle-orm/sqlite-core").SQLiteTab
|
|
|
1317
1475
|
identity: undefined;
|
|
1318
1476
|
generated: undefined;
|
|
1319
1477
|
}, {}>;
|
|
1478
|
+
provenance: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
1479
|
+
name: string;
|
|
1480
|
+
tableName: "brain_page_edges";
|
|
1481
|
+
dataType: "string";
|
|
1482
|
+
data: string;
|
|
1483
|
+
driverParam: string;
|
|
1484
|
+
notNull: false;
|
|
1485
|
+
hasDefault: false;
|
|
1486
|
+
isPrimaryKey: false;
|
|
1487
|
+
isAutoincrement: false;
|
|
1488
|
+
hasRuntimeDefault: false;
|
|
1489
|
+
enumValues: [string, ...string[]];
|
|
1490
|
+
baseColumn: never;
|
|
1491
|
+
identity: undefined;
|
|
1492
|
+
generated: undefined;
|
|
1493
|
+
}, {}>;
|
|
1320
1494
|
createdAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
1321
1495
|
name: string;
|
|
1322
1496
|
tableName: "brain_page_edges";
|