@openweave/weave-graph 0.2.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 lemur bookstores
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,290 @@
1
+ # 🧠 weave-graph
2
+
3
+ > **WeaveGraph** — The knowledge graph engine at the heart of OpenWeave.
4
+
5
+ Part of the [OpenWeave](../../README.md) monorepo.
6
+
7
+ ---
8
+
9
+ ## What it does
10
+
11
+ WeaveGraph manages all memory for an OpenWeave session:
12
+
13
+ - Stores **concepts, decisions, errors and corrections** as typed graph nodes
14
+ - Connects them with **semantic edges** (relates, causes, corrects, implements, depends_on)
15
+ - **Compresses context** into the graph when the LLM window reaches 75% capacity
16
+ - **Retrieves relevant nodes** from long-term memory given a query
17
+ - **Persists everything** to disk by `chat_id`, survives across sessions
18
+
19
+ ## Node Types
20
+
21
+ | Type | Description |
22
+ |---|---|
23
+ | `CONCEPT` | A key idea or term in the project |
24
+ | `DECISION` | An architectural or implementation decision |
25
+ | `MILESTONE` | A planned deliverable |
26
+ | `ERROR` | A response flagged as incorrect by the user (suppressed) |
27
+ | `CORRECTION` | The correct version linked to an ERROR node |
28
+ | `CODE_ENTITY` | A function, class, or module created during the session |
29
+
30
+ ## Edge Types
31
+
32
+ | Relation | Meaning |
33
+ |---|---|
34
+ | `RELATES` | General semantic relationship |
35
+ | `CAUSES` | A causes B |
36
+ | `CORRECTS` | A is the correction of B (B is an ERROR node) |
37
+ | `IMPLEMENTS` | A implements B (code → decision) |
38
+ | `DEPENDS_ON` | A depends on B |
39
+ | `BLOCKS` | A blocks B |
40
+
41
+ ---
42
+
43
+ ## SynapticEngine — Conexiones Neuronales Retroactivas
44
+
45
+ El `SynapticEngine` (en desarrollo — M16) da a WeaveGraph su comportamiento neuronal.
46
+ Cada nodo nuevo que entra al grafo es comparado contra **toda la historia**,
47
+ sin importar cuándo fue creado el nodo existente.
48
+
49
+ ### Tres comportamientos (roadmap)
50
+
51
+ | Comportamiento | Módulo | Descripción |
52
+ |---|---|---|
53
+ | **Retroactive Linking** | `synaptic-engine.ts` | Al insertar un nodo, descubre y crea edges con nodos históricos relevantes |
54
+ | **Hebbian Strengthening** | `hebbian-weights.ts` | Edges cuyos nodos son recuperados juntos aumentan su peso (`+0.1`) |
55
+ | **Temporal Decay** | `hebbian-weights.ts` | Edges inactivos se debilitan gradualmente (`× 0.99` por ciclo) |
56
+
57
+ ### Estructura de módulos (v0.8.0)
58
+
59
+ ```
60
+ packages/weave-graph/src/
61
+ ├── index.ts ← ContextGraphManager (existente)
62
+ ├── node.ts ← NodeBuilder (existente)
63
+ ├── edge.ts ← EdgeBuilder (existente)
64
+ ├── compression.ts ← CompressionManager (existente)
65
+ ├── persistence.ts ← PersistenceManager (existente)
66
+ ├── synaptic-engine.ts ← Retroactive linking (M16 — en desarrollo)
67
+ └── hebbian-weights.ts ← Strengthening + decay (M17 — planificado)
68
+ ```
69
+
70
+ ### Umbrales por defecto
71
+
72
+ | Variable de entorno | Default | Descripción |
73
+ |---|---|---|
74
+ | `WEAVE_SYNAPSE_THRESHOLD` | `0.72` | Similitud mínima para crear un edge retroactivo |
75
+ | `WEAVE_SYNAPSE_MAX_CONNECTIONS` | `20` | Máximo de edges automáticos por nodo |
76
+ | `WEAVE_HEBBIAN_STRENGTH` | `0.1` | Incremento de `edge.weight` por co-activación |
77
+ | `WEAVE_DECAY_RATE` | `0.99` | Factor de decay aplicado por ciclo inactivo |
78
+ | `WEAVE_PRUNE_THRESHOLD` | `0.05` | Weight mínimo antes de eliminar el edge |
79
+
80
+ ### Uso (preview API)
81
+
82
+ ```typescript
83
+ import { SynapticEngine, ContextGraphManager, NodeBuilder } from "@openweave/weave-graph";
84
+
85
+ const graph = new ContextGraphManager("chat_abc123");
86
+ const synapse = new SynapticEngine({ threshold: 0.72, maxConnections: 20 });
87
+
88
+ // Nodo histórico (creado hace un mes, ya en el grafo)
89
+ graph.addNode(NodeBuilder.concept("TypeScript generics", "Parametric polymorphism"));
90
+
91
+ // Nodo nuevo — SynapticEngine crea automáticamente el edge retroactivo
92
+ const newNode = NodeBuilder.concept("Generic constraints en TS", "extends keyword");
93
+ const newEdges = await synapse.linkRetroactively(newNode, graph);
94
+ // → crea edge RELATES entre ambos nodos aunque el primero tenga 1 mes de antigüedad
95
+
96
+ graph.addNode(newNode);
97
+ console.log(`${newEdges.length} conexiones retroactivas creadas`);
98
+ ```
99
+
100
+ > **Estado:** `SynapticEngine` está en desarrollo activo en la rama `feature/synaptic-engine`.
101
+ > La API puede cambiar antes del release `v0.8.0`.
102
+
103
+ ---
104
+
105
+ ## Quick Start
106
+
107
+ ### TypeScript / Node.js
108
+
109
+ ```typescript
110
+ import {
111
+ ContextGraphManager,
112
+ NodeBuilder,
113
+ EdgeBuilder,
114
+ PersistenceManager,
115
+ NodeType,
116
+ EdgeType,
117
+ } from "@openweave/weave-graph";
118
+
119
+ // Initialize a graph for a session
120
+ const graph = new ContextGraphManager("chat_abc123");
121
+
122
+ // Create and add nodes
123
+ const concept = NodeBuilder.concept("TypeScript", "A typed superset of JavaScript");
124
+ const decision = NodeBuilder.decision("Use TypeScript for type safety");
125
+
126
+ graph.addNode(concept);
127
+ graph.addNode(decision);
128
+
129
+ // Connect nodes with edges
130
+ const edge = EdgeBuilder.relates(concept.id, decision.id);
131
+ graph.addEdge(edge);
132
+
133
+ // Query the graph
134
+ const results = graph.queryNodesByLabel("Type");
135
+ console.log(`Found ${results.length} nodes mentioning "Type"`);
136
+
137
+ // Get graph statistics
138
+ const stats = graph.getStats();
139
+ console.log(stats);
140
+ // {
141
+ // totalNodes: 2,
142
+ // totalEdges: 1,
143
+ // nodesByType: { CONCEPT: 1, DECISION: 1 },
144
+ // edgesByType: { RELATES: 1 },
145
+ // chatId: "chat_abc123",
146
+ // ...
147
+ // }
148
+
149
+ // Persist the graph
150
+ const persistence = new PersistenceManager("./weave-data");
151
+ await persistence.saveGraph(graph.snapshot());
152
+
153
+ // Load a previous session
154
+ const loaded = await persistence.loadOrCreateGraph("chat_abc123");
155
+ console.log(`Loaded graph with ${loaded.getAllNodes().length} nodes`);
156
+ ```
157
+
158
+ ### Available Node Types
159
+
160
+ - **CONCEPT** — A key idea or term
161
+ - **DECISION** — An architectural or implementation choice
162
+ - **MILESTONE** — A planned deliverable
163
+ - **ERROR** — A flagged incorrect response
164
+ - **CORRECTION** — The correct version of an ERROR
165
+ - **CODE_ENTITY** — A function, class, or module
166
+
167
+ ### Available Edge Types
168
+
169
+ - **RELATES** — General semantic relationship
170
+ - **CAUSES** — A causes B
171
+ - **CORRECTS** — A corrects B (A is CORRECTION, B is ERROR)
172
+ - **IMPLEMENTS** — A implements B (code → decision)
173
+ - **DEPENDS_ON** — A depends on B
174
+ - **BLOCKS** — A blocks B
175
+
176
+ ## API
177
+
178
+ ### ContextGraphManager
179
+
180
+ ```typescript
181
+ // Node operations
182
+ addNode(node: Node): Node
183
+ getNode(nodeId: string): Node | undefined
184
+ updateNode(nodeId: string, updates: Partial<Node>): Node | undefined
185
+ deleteNode(nodeId: string): boolean
186
+ getAllNodes(): Node[]
187
+
188
+ // Edge operations
189
+ addEdge(edge: Edge): Edge
190
+ getEdge(edgeId: string): Edge | undefined
191
+ updateEdge(edgeId: string, updates: Partial<Edge>): Edge | undefined
192
+ deleteEdge(edgeId: string): boolean
193
+ getAllEdges(): Edge[]
194
+ getEdgesFromNode(nodeId: string): Edge[]
195
+ getEdgesToNode(nodeId: string): Edge[]
196
+
197
+ // Queries
198
+ queryNodesByLabel(query: string): Node[]
199
+ queryNodesByType(type: NodeType): Node[]
200
+ queryEdgesByType(type: EdgeType): Edge[]
201
+
202
+ // Utilities
203
+ getStats(): GraphStats
204
+ snapshot(): GraphSnapshot
205
+ clear(): void
206
+ shouldCompress(): boolean
207
+ ```
208
+
209
+ ### PersistenceManager
210
+
211
+ ```typescript
212
+ // File I/O
213
+ async saveGraph(snapshot: GraphSnapshot): Promise<void>
214
+ async loadGraph(chatId: string): Promise<GraphSnapshot | null>
215
+ async loadOrCreateGraph(chatId: string): Promise<ContextGraphManager>
216
+
217
+ // Session management
218
+ async graphExists(chatId: string): Promise<boolean>
219
+ async deleteGraph(chatId: string): Promise<void>
220
+ async listSessions(): Promise<SessionInfo[]>
221
+
222
+ // Configuration
223
+ setDataDir(newDataDir: string): void
224
+ getDataDir(): string
225
+ ```
226
+
227
+ ## Development
228
+
229
+ ```bash
230
+ # Build
231
+ npm run build
232
+
233
+ # Test
234
+ npm run test
235
+
236
+ # Watch mode
237
+ npm run dev
238
+
239
+ # Lint
240
+ npm run lint
241
+
242
+ # Clean build artifacts
243
+ npm run clean
244
+ ```
245
+ content="Use PostgreSQL for persistence, not SQLite — project will scale",
246
+ node_type=NodeType.DECISION,
247
+ tags=["database", "architecture"]
248
+ )
249
+
250
+ # Add a concept and relate it
251
+ concept = graph.add_node(
252
+ content="Session persistence by chat_id",
253
+ node_type=NodeType.CONCEPT
254
+ )
255
+ graph.add_edge(decision.id, concept.id, EdgeType.RELATES)
256
+
257
+ # Suppress an error and record correction
258
+ graph.suppress_error_node(
259
+ node_id=bad_response_node.id,
260
+ correction_content="Use async/await, not threading — the codebase is fully async"
261
+ )
262
+
263
+ # Query relevant context before responding
264
+ relevant = graph.query_relevant_nodes("database connection pooling", top_k=5)
265
+
266
+ # Compress context when window is getting full
267
+ compressed_summary = graph.compress_context_to_graph(
268
+ context_text=long_conversation_text,
269
+ llm_extractor_fn=my_extraction_function
270
+ )
271
+ ```
272
+
273
+ ## Storage
274
+
275
+ All data is persisted to:
276
+ ```
277
+ {storage_path}/{chat_id}/
278
+ ├── context_graph.json ← Full graph (nodes + edges)
279
+ ├── roadmap.md ← Human-readable milestone status
280
+ ├── decisions.md ← Decision log
281
+ └── errors.md ← Error pattern registry
282
+ ```
283
+
284
+ ## Installation
285
+
286
+ ```bash
287
+ pip install openweave-graph
288
+ # or within the monorepo:
289
+ pnpm --filter weave-graph dev
290
+ ```
@@ -0,0 +1,94 @@
1
+ import { Node, Edge } from "./types";
2
+ /**
3
+ * CompressionStats tracks metrics about graph compression
4
+ */
5
+ export interface CompressionStats {
6
+ originalNodeCount: number;
7
+ originalEdgeCount: number;
8
+ compressedNodeCount: number;
9
+ compressedEdgeCount: number;
10
+ archivedNodeCount: number;
11
+ compressionRatio: number;
12
+ estimatedContextSize: number;
13
+ }
14
+ /**
15
+ * CompressionManager handles graph compression and context optimization
16
+ * Keeps high-value nodes in active memory, archives low-frequency nodes
17
+ */
18
+ export declare class CompressionManager {
19
+ private archivedNodes;
20
+ private archivedEdges;
21
+ /**
22
+ * Calculate approximate size of a node in bytes (for context window estimation)
23
+ */
24
+ static estimateNodeSize(node: Node): number;
25
+ /**
26
+ * Calculate approximate size of an edge in bytes
27
+ */
28
+ static estimateEdgeSize(edge: Edge): number;
29
+ /**
30
+ * Calculate total estimated context window usage
31
+ */
32
+ static calculateContextSize(nodes: Node[], edges: Edge[]): number;
33
+ /**
34
+ * Calculate context window usage as a percentage (0-1)
35
+ * Assumes ~100KB max context for graph data (typical LLM context budget)
36
+ */
37
+ static calculateContextUsagePercentage(contextSize: number): number;
38
+ /**
39
+ * Identify nodes that should be archived (low frequency, old, not critical)
40
+ * Returns nodeIds sorted by priority for archival
41
+ */
42
+ static identifyArchiveCandidates(nodes: Node[], edges: Edge[], targetReductionPercentage?: number): string[];
43
+ /**
44
+ * Archive nodes and their dependent edges
45
+ */
46
+ archiveNodes(nodeIds: string[], nodes: Map<string, Node>, edges: Map<string, Edge>): void;
47
+ /**
48
+ * Restore archived nodes back to active graph
49
+ */
50
+ restoreNodes(nodeIds: string[]): Map<string, Node>;
51
+ /**
52
+ * Get archive statistics
53
+ */
54
+ getArchiveStats(): {
55
+ archivedNodeCount: number;
56
+ archivedEdgeCount: number;
57
+ };
58
+ /**
59
+ * Clear all archives
60
+ */
61
+ clearArchives(): void;
62
+ }
63
+ /**
64
+ * ErrorSuppression handles marking errors and their corrections
65
+ */
66
+ export declare class ErrorSuppression {
67
+ /**
68
+ * Mark a node as suppressed (contains an error)
69
+ */
70
+ static suppressNode(node: Node): Node;
71
+ /**
72
+ * Check if a node is suppressed
73
+ */
74
+ static isSuppressed(node: Node): boolean;
75
+ /**
76
+ * Create a correction node linked to an error node
77
+ */
78
+ static createCorrection(errorNodeId: string, correctionLabel: string, correctionDescription?: string): {
79
+ correctionNode: Node;
80
+ correctionEdge: Edge;
81
+ };
82
+ /**
83
+ * Get all error nodes that have corrections
84
+ */
85
+ static findCorrectedErrors(nodes: Map<string, Node>, edges: Map<string, Edge>): Map<string, {
86
+ error: Node;
87
+ corrections: Node[];
88
+ }>;
89
+ /**
90
+ * Get uncorrected error nodes
91
+ */
92
+ static findUncorrectedErrors(nodes: Map<string, Node>, edges: Map<string, Edge>): Node[];
93
+ }
94
+ //# sourceMappingURL=compression.d.ts.map
@@ -0,0 +1 @@
1
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G,CAAC,MAAM,EAAE,IAAI,CAAC;IAYlD;;OAEG;IACH,eAAe,IAAI;QACjB,iBAAiB,EAAE,MAAM,CAAC;QAC1B,iBAAiB,EAAE,MAAM,CAAC;KAC3B;IAOD;;OAEG;IACH,aAAa,IAAI,IAAI;CAItB;AAED;;GAEG;AACH,qBAAa,gBAAgB;IAC3B;;OAEG;IACH,MAAM,CAAC,YAAY,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI;IAcrC;;OAEG;IACH,MAAM,CAAC,YAAY,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO;IAIxC;;OAEG;IACH,MAAM,CAAC,gBAAgB,CACrB,WAAW,EAAE,MAAM,EACnB,eAAe,EAAE,MAAM,EACvB,qBAAqB,CAAC,EAAE,MAAM,GAC7B;QAAE,cAAc,EAAE,IAAI,CAAC;QAAC,cAAc,EAAE,IAAI,CAAA;KAAE;IAUjD;;OAEG;IACH,MAAM,CAAC,mBAAmB,CACxB,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,EACxB,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,GACvB,GAAG,CAAC,MAAM,EAAE;QAAE,KAAK,EAAE,IAAI,CAAC;QAAC,WAAW,EAAE,IAAI,EAAE,CAAA;KAAE,CAAC;IAuBpD;;OAEG;IACH,MAAM,CAAC,qBAAqB,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,IAAI,EAAE;CAYzF"}
@@ -0,0 +1,210 @@
1
+ import { NodeType, EdgeType } from "./types";
2
+ import { NodeBuilder } from "./node";
3
+ import { EdgeBuilder } from "./edge";
4
+ /**
5
+ * CompressionManager handles graph compression and context optimization
6
+ * Keeps high-value nodes in active memory, archives low-frequency nodes
7
+ */
8
+ export class CompressionManager {
9
+ archivedNodes = new Map();
10
+ archivedEdges = new Map();
11
+ /**
12
+ * Calculate approximate size of a node in bytes (for context window estimation)
13
+ */
14
+ static estimateNodeSize(node) {
15
+ // Rough estimation: labels ~50 bytes + metadata ~100 bytes
16
+ const labelSize = node.label.length * 2;
17
+ const descSize = (node.description || "").length * 2;
18
+ const metadataSize = JSON.stringify(node.metadata || {}).length;
19
+ return 50 + labelSize + descSize + metadataSize;
20
+ }
21
+ /**
22
+ * Calculate approximate size of an edge in bytes
23
+ */
24
+ static estimateEdgeSize(edge) {
25
+ // Edge size: sourceId ~ 36 bytes + targetId ~ 36 bytes + type ~ 20 bytes + metadata
26
+ const metadataSize = JSON.stringify(edge.metadata || {}).length;
27
+ return 100 + metadataSize;
28
+ }
29
+ /**
30
+ * Calculate total estimated context window usage
31
+ */
32
+ static calculateContextSize(nodes, edges) {
33
+ const nodesSize = nodes.reduce((sum, node) => sum + this.estimateNodeSize(node), 0);
34
+ const edgesSize = edges.reduce((sum, edge) => sum + this.estimateEdgeSize(edge), 0);
35
+ return nodesSize + edgesSize;
36
+ }
37
+ /**
38
+ * Calculate context window usage as a percentage (0-1)
39
+ * Assumes ~100KB max context for graph data (typical LLM context budget)
40
+ */
41
+ static calculateContextUsagePercentage(contextSize) {
42
+ const MAX_CONTEXT_BYTES = 100_000; // ~100KB for graph data
43
+ return Math.min(contextSize / MAX_CONTEXT_BYTES, 1);
44
+ }
45
+ /**
46
+ * Identify nodes that should be archived (low frequency, old, not critical)
47
+ * Returns nodeIds sorted by priority for archival
48
+ */
49
+ static identifyArchiveCandidates(nodes, edges, targetReductionPercentage = 0.3) {
50
+ // Build a map of node importance
51
+ const nodeImportance = new Map();
52
+ // Initialize with frequency
53
+ for (const node of nodes) {
54
+ nodeImportance.set(node.id, node.frequency ?? 1);
55
+ }
56
+ // Increase importance of nodes with many connections
57
+ const connectionCount = new Map();
58
+ for (const edge of edges) {
59
+ connectionCount.set(edge.sourceId, (connectionCount.get(edge.sourceId) ?? 0) + 1);
60
+ connectionCount.set(edge.targetId, (connectionCount.get(edge.targetId) ?? 0) + 1);
61
+ }
62
+ for (const [nodeId, count] of connectionCount) {
63
+ const current = nodeImportance.get(nodeId) ?? 1;
64
+ nodeImportance.set(nodeId, current + count * 2);
65
+ }
66
+ // Mark ERROR nodes as candidates (they can be archived after corrections exist)
67
+ for (const node of nodes) {
68
+ if (node.type === NodeType.ERROR) {
69
+ nodeImportance.set(node.id, Math.max(0.1, (nodeImportance.get(node.id) ?? 1) - 5));
70
+ }
71
+ }
72
+ // Mark old nodes with low frequency as less important
73
+ const now = new Date();
74
+ for (const node of nodes) {
75
+ const ageHours = (now.getTime() - node.updatedAt.getTime()) / (1000 * 60 * 60);
76
+ if (ageHours > 24 && (node.frequency ?? 1) < 3) {
77
+ nodeImportance.set(node.id, (nodeImportance.get(node.id) ?? 1) * 0.5);
78
+ }
79
+ }
80
+ // Sort by importance and select bottom candidates
81
+ const sorted = Array.from(nodeImportance.entries())
82
+ .sort((a, b) => a[1] - b[1])
83
+ .map(([id]) => id);
84
+ const targetCount = Math.ceil(nodes.length * targetReductionPercentage);
85
+ return sorted.slice(0, targetCount);
86
+ }
87
+ /**
88
+ * Archive nodes and their dependent edges
89
+ */
90
+ archiveNodes(nodeIds, nodes, edges) {
91
+ const nodeIdSet = new Set(nodeIds);
92
+ // Archive nodes
93
+ for (const nodeId of nodeIds) {
94
+ const node = nodes.get(nodeId);
95
+ if (node) {
96
+ this.archivedNodes.set(nodeId, node);
97
+ }
98
+ }
99
+ // Archive edges connected to archived nodes
100
+ for (const [edgeId, edge] of edges) {
101
+ if (nodeIdSet.has(edge.sourceId) || nodeIdSet.has(edge.targetId)) {
102
+ this.archivedEdges.set(edgeId, edge);
103
+ }
104
+ }
105
+ }
106
+ /**
107
+ * Restore archived nodes back to active graph
108
+ */
109
+ restoreNodes(nodeIds) {
110
+ const restored = new Map();
111
+ for (const nodeId of nodeIds) {
112
+ const node = this.archivedNodes.get(nodeId);
113
+ if (node) {
114
+ restored.set(nodeId, node);
115
+ this.archivedNodes.delete(nodeId);
116
+ }
117
+ }
118
+ return restored;
119
+ }
120
+ /**
121
+ * Get archive statistics
122
+ */
123
+ getArchiveStats() {
124
+ return {
125
+ archivedNodeCount: this.archivedNodes.size,
126
+ archivedEdgeCount: this.archivedEdges.size,
127
+ };
128
+ }
129
+ /**
130
+ * Clear all archives
131
+ */
132
+ clearArchives() {
133
+ this.archivedNodes.clear();
134
+ this.archivedEdges.clear();
135
+ }
136
+ }
137
+ /**
138
+ * ErrorSuppression handles marking errors and their corrections
139
+ */
140
+ export class ErrorSuppression {
141
+ /**
142
+ * Mark a node as suppressed (contains an error)
143
+ */
144
+ static suppressNode(node) {
145
+ if (node.type !== NodeType.ERROR) {
146
+ throw new Error("Only ERROR type nodes can be suppressed");
147
+ }
148
+ return {
149
+ ...node,
150
+ metadata: {
151
+ ...node.metadata,
152
+ suppressed: true,
153
+ suppressedAt: new Date().toISOString(),
154
+ },
155
+ };
156
+ }
157
+ /**
158
+ * Check if a node is suppressed
159
+ */
160
+ static isSuppressed(node) {
161
+ return node.metadata?.suppressed ?? false;
162
+ }
163
+ /**
164
+ * Create a correction node linked to an error node
165
+ */
166
+ static createCorrection(errorNodeId, correctionLabel, correctionDescription) {
167
+ const correctionNode = NodeBuilder.correction(correctionLabel, correctionDescription);
168
+ const correctionEdge = EdgeBuilder.corrects(correctionNode.id, errorNodeId);
169
+ return {
170
+ correctionNode,
171
+ correctionEdge,
172
+ };
173
+ }
174
+ /**
175
+ * Get all error nodes that have corrections
176
+ */
177
+ static findCorrectedErrors(nodes, edges) {
178
+ const correctedErrors = new Map();
179
+ for (const [, edge] of edges) {
180
+ if (edge.type === EdgeType.CORRECTS) {
181
+ const correctionNode = nodes.get(edge.sourceId);
182
+ const errorNode = nodes.get(edge.targetId);
183
+ if (correctionNode && errorNode && errorNode.type === NodeType.ERROR) {
184
+ if (!correctedErrors.has(errorNode.id)) {
185
+ correctedErrors.set(errorNode.id, {
186
+ error: errorNode,
187
+ corrections: [],
188
+ });
189
+ }
190
+ correctedErrors.get(errorNode.id).corrections.push(correctionNode);
191
+ }
192
+ }
193
+ }
194
+ return correctedErrors;
195
+ }
196
+ /**
197
+ * Get uncorrected error nodes
198
+ */
199
+ static findUncorrectedErrors(nodes, edges) {
200
+ const errorNodes = Array.from(nodes.values()).filter((n) => n.type === NodeType.ERROR);
201
+ const correctedErrorIds = new Set();
202
+ for (const [, edge] of edges) {
203
+ if (edge.type === EdgeType.CORRECTS) {
204
+ correctedErrorIds.add(edge.targetId);
205
+ }
206
+ }
207
+ return errorNodes.filter((n) => !correctedErrorIds.has(n.id));
208
+ }
209
+ }
210
+ //# sourceMappingURL=compression.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compression.js","sourceRoot":"","sources":["../src/compression.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,QAAQ,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAerC;;;GAGG;AACH,MAAM,OAAO,kBAAkB;IACrB,aAAa,GAAsB,IAAI,GAAG,EAAE,CAAC;IAC7C,aAAa,GAAsB,IAAI,GAAG,EAAE,CAAC;IAErD;;OAEG;IACH,MAAM,CAAC,gBAAgB,CAAC,IAAU;QAChC,2DAA2D;QAC3D,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;QACxC,MAAM,QAAQ,GAAG,CAAC,IAAI,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;QACrD,MAAM,YAAY,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC;QAChE,OAAO,EAAE,GAAG,SAAS,GAAG,QAAQ,GAAG,YAAY,CAAC;IAClD,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,gBAAgB,CAAC,IAAU;QAChC,oFAAoF;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C,SAAS,CAAC,EAAE,CAAE,CAAC,WAAW,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;gBACtE,CAAC;YACH,CAAC;QACH,CAAC;QAED,OAAO,eAAe,CAAC;IACzB,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,qBAAqB,CAAC,KAAwB,EAAE,KAAwB;QAC7E,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,QAAQ,CAAC,KAAK,CAAC,CAAC;QACvF,MAAM,iBAAiB,GAAG,IAAI,GAAG,EAAU,CAAC;QAE5C,KAAK,MAAM,CAAC,EAAE,IAAI,CAAC,IAAI,KAAK,EAAE,CAAC;YAC7B,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ,CAAC,QAAQ,EAAE,CAAC;gBACpC,iBAAiB,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YACvC,CAAC;QACH,CAAC;QAED,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAChE,CAAC;CACF"}
package/dist/edge.d.ts ADDED
@@ -0,0 +1,43 @@
1
+ import { Edge, EdgeType } from "./types";
2
+ /**
3
+ * EdgeBuilder utility for creating and managing graph edges
4
+ */
5
+ export declare class EdgeBuilder {
6
+ /**
7
+ * Create a new edge between two nodes
8
+ */
9
+ static create(sourceId: string, targetId: string, type: EdgeType, weight?: number, metadata?: Record<string, unknown>): Edge;
10
+ /**
11
+ * Create a RELATES edge
12
+ */
13
+ static relates(sourceId: string, targetId: string, weight?: number): Edge;
14
+ /**
15
+ * Create a CAUSES edge
16
+ */
17
+ static causes(sourceId: string, targetId: string, weight?: number): Edge;
18
+ /**
19
+ * Create a CORRECTS edge (links CORRECTION to ERROR)
20
+ */
21
+ static corrects(correctionId: string, errorId: string, weight?: number): Edge;
22
+ /**
23
+ * Create an IMPLEMENTS edge (code → decision)
24
+ */
25
+ static implements(codeEntityId: string, decisionId: string, weight?: number): Edge;
26
+ /**
27
+ * Create a DEPENDS_ON edge
28
+ */
29
+ static dependsOn(sourceId: string, targetId: string, weight?: number): Edge;
30
+ /**
31
+ * Create a BLOCKS edge
32
+ */
33
+ static blocks(blockerId: string, blockedId: string, weight?: number): Edge;
34
+ /**
35
+ * Clone an edge with updated values
36
+ */
37
+ static clone(edge: Edge, updates?: Partial<Edge>): Edge;
38
+ /**
39
+ * Increase the weight (confidence) of an edge
40
+ */
41
+ static reinforceWeight(edge: Edge, factor?: number): Edge;
42
+ }
43
+ //# sourceMappingURL=edge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"edge.d.ts","sourceRoot":"","sources":["../src/edge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAGzC;;GAEG;AACH,qBAAa,WAAW;IACtB;;OAEG;IACH,MAAM,CAAC,MAAM,CACX,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,QAAQ,EACd,MAAM,CAAC,EAAE,MAAM,EACf,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACjC,IAAI;IAaP;;OAEG;IACH,MAAM,CAAC,OAAO,CACZ,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,MAAM,CAAC,EAAE,MAAM,GACd,IAAI;IAIP;;OAEG;IACH,MAAM,CAAC,MAAM,CACX,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,MAAM,CAAC,EAAE,MAAM,GACd,IAAI;IAIP;;OAEG;IACH,MAAM,CAAC,QAAQ,CACb,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,MAAM,EACf,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