agentdb 1.1.5 → 1.1.7

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.
@@ -18,11 +18,6 @@ import { SkillLibrary } from '../controllers/SkillLibrary.js';
18
18
  import { EmbeddingService } from '../controllers/EmbeddingService.js';
19
19
  import * as fs from 'fs';
20
20
  import * as path from 'path';
21
- import { fileURLToPath } from 'url';
22
-
23
- // ESM equivalent of __dirname
24
- const __filename = fileURLToPath(import.meta.url);
25
- const __dirname = path.dirname(__filename);
26
21
  // Color codes for terminal output
27
22
  const colors = {
28
23
  reset: '\x1b[0m',
@@ -56,22 +51,15 @@ class AgentDBCLI {
56
51
  this.db.pragma('journal_mode = WAL');
57
52
  this.db.pragma('synchronous = NORMAL');
58
53
  this.db.pragma('cache_size = -64000');
59
- // Load schemas (base + frontier)
60
- const baseSchemaPath = path.join(__dirname, '../schemas/schema.sql');
61
- const frontierSchemaPath = path.join(__dirname, '../schemas/frontier-schema.sql');
62
-
63
- if (fs.existsSync(baseSchemaPath)) {
64
- const baseSchema = fs.readFileSync(baseSchemaPath, 'utf-8');
65
- this.db.exec(baseSchema);
66
- }
67
-
68
- if (fs.existsSync(frontierSchemaPath)) {
69
- const frontierSchema = fs.readFileSync(frontierSchemaPath, 'utf-8');
70
- this.db.exec(frontierSchema);
54
+ // Load schema if needed
55
+ const schemaPath = path.join(__dirname, '../schemas/frontier-schema.sql');
56
+ if (fs.existsSync(schemaPath)) {
57
+ const schema = fs.readFileSync(schemaPath, 'utf-8');
58
+ this.db.exec(schema);
71
59
  }
72
60
  // Initialize embedding service
73
61
  this.embedder = new EmbeddingService({
74
- model: 'Xenova/all-MiniLM-L6-v2',
62
+ model: 'all-MiniLM-L6-v2',
75
63
  dimension: 384,
76
64
  provider: 'transformers'
77
65
  });
@@ -94,12 +82,9 @@ class AgentDBCLI {
94
82
  log.info(`Cause: ${params.cause}`);
95
83
  log.info(`Effect: ${params.effect}`);
96
84
  log.info(`Uplift: ${params.uplift}`);
97
- const edgeId = this.causalGraph.addCausalEdge({
98
- fromMemoryId: 0,
99
- fromMemoryType: params.cause,
100
- toMemoryId: 0,
101
- toMemoryType: params.effect,
102
- similarity: 0,
85
+ const edgeId = this.causalGraph.addEdge({
86
+ cause: params.cause,
87
+ effect: params.effect,
103
88
  uplift: params.uplift,
104
89
  confidence: params.confidence || 0.95,
105
90
  sampleSize: params.sampleSize || 0,
@@ -725,15 +710,9 @@ ${colors.bright}EXAMPLES:${colors.reset}
725
710
  agentdb db stats
726
711
  `);
727
712
  }
728
- // ESM entry point - run when executed directly
729
- if (import.meta.url.startsWith('file:')) {
730
- const modulePath = import.meta.url.slice(7); // Remove 'file://'
731
- const scriptPath = process.argv[1];
732
-
733
- // Run if this file is being executed (handles both direct execution and npx/global bin)
734
- if (modulePath.includes('agentdb-cli.js') || scriptPath?.includes('agentdb')) {
735
- main().catch(console.error);
736
- }
713
+ // ESM entry point check
714
+ if (import.meta.url === `file://${process.argv[1]}`) {
715
+ main().catch(console.error);
737
716
  }
738
717
  export { AgentDBCLI };
739
718
  //# sourceMappingURL=agentdb-cli.js.map
@@ -23,7 +23,7 @@ export class EmbeddingService {
23
23
  this.pipeline = await pipeline('feature-extraction', this.config.model);
24
24
  }
25
25
  catch (error) {
26
- // Silently fall back to mock embeddings (transformers.js is optional for basic CLI commands)
26
+ console.warn('Transformers.js not available, falling back to mock embeddings');
27
27
  this.pipeline = null;
28
28
  }
29
29
  }
@@ -37,10 +37,10 @@ CREATE TABLE IF NOT EXISTS causal_edges (
37
37
  updated_at INTEGER NOT NULL DEFAULT (strftime('%s', 'now')),
38
38
  last_validated_at INTEGER,
39
39
 
40
- metadata JSON,
40
+ metadata JSON
41
41
 
42
- FOREIGN KEY(from_memory_id) REFERENCES episodes(id) ON DELETE CASCADE,
43
- FOREIGN KEY(to_memory_id) REFERENCES episodes(id) ON DELETE CASCADE
42
+ -- Note: Foreign keys removed to allow flexible causal edges between any concepts
43
+ -- from_memory_id and to_memory_id can be 0 for abstract causal relationships
44
44
  );
45
45
 
46
46
  CREATE INDEX IF NOT EXISTS idx_causal_edges_from ON causal_edges(from_memory_id, from_memory_type);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentdb",
3
- "version": "1.1.5",
3
+ "version": "1.1.7",
4
4
  "description": "AgentDB - Frontier Memory Features: Causal reasoning, reflexion memory, skill library, explainable recall, and automated learning for AI agents. 150x faster vector search with HNSW indexing.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -55,16 +55,16 @@
55
55
  },
56
56
  "homepage": "https://agentdb.ruv.io",
57
57
  "dependencies": {
58
+ "@xenova/transformers": "^2.17.2",
58
59
  "better-sqlite3": "^11.7.0",
59
- "commander": "^12.1.0",
60
60
  "chalk": "^5.3.0",
61
- "@xenova/transformers": "^2.17.2"
61
+ "commander": "^12.1.0"
62
62
  },
63
63
  "devDependencies": {
64
64
  "@types/better-sqlite3": "^7.6.11",
65
65
  "@types/node": "^22.10.2",
66
- "typescript": "^5.7.2",
67
66
  "tsx": "^4.19.2",
67
+ "typescript": "^5.7.2",
68
68
  "vitest": "^2.1.8"
69
69
  },
70
70
  "engines": {
@@ -37,10 +37,10 @@ CREATE TABLE IF NOT EXISTS causal_edges (
37
37
  updated_at INTEGER NOT NULL DEFAULT (strftime('%s', 'now')),
38
38
  last_validated_at INTEGER,
39
39
 
40
- metadata JSON,
40
+ metadata JSON
41
41
 
42
- FOREIGN KEY(from_memory_id) REFERENCES episodes(id) ON DELETE CASCADE,
43
- FOREIGN KEY(to_memory_id) REFERENCES episodes(id) ON DELETE CASCADE
42
+ -- Note: Foreign keys removed to allow flexible causal edges between any concepts
43
+ -- from_memory_id and to_memory_id can be 0 for abstract causal relationships
44
44
  );
45
45
 
46
46
  CREATE INDEX IF NOT EXISTS idx_causal_edges_from ON causal_edges(from_memory_id, from_memory_type);