agentic-flow 2.0.5 → 2.0.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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/reasoningbank/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,yDAAyD;AACzD,OAAO,mCAAmC,CAAC;AAE3C,gDAAgD;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAI3D,mDAAmD;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAExE,mEAAmE;AACnE,OAAO,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAG/E,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAGlD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAGpD,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAGvE,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAGjE,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC9E,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC7E,OA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M;KACvB,CAAC,CAAC;IACH,OAAO,CAAC,GAAG,CAAC,6BAA6B,WAAW,CAAC,MAAM,eAAe,CAAC,CAAC;IAC5E,IAAI,YAAY,GAAG,KAAK,CAAC;IACzB,IAAI,UAAU,EAAE,EAAE,CAAC;QACjB,OAAO,CAAC,GAAG,CAAC,0CAA0C,CAAC,CAAC;QACxD,MAAM,IAAI,EAAE,CAAC;QACb,YAAY,GAAG,IAAI,CAAC;IACtB,CAAC;IACD,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,WAAW,EAAE,YAAY,EAAE,CAAC;AACxE,CAAC;AAED,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC;AAC/B,MAAM,CAAC,MAAM,SAAS,GAAG,qCAAqC,CAAC","sourcesContent":["/**\n * ReasoningBank - Closed-loop memory system for AI agents\n * Based on arXiv:2509.25140 (Google DeepMind)\n *\n * @since v1.7.0 - Integrated AgentDB for optimal performance\n */\n\n// Apply AgentDB runtime patch before any AgentDB imports\nimport '../utils/agentdb-runtime-patch.js';\n\n// New hybrid backend (recommended for new code)\nexport { HybridReasoningBank } from './HybridBackend.js';\nexport { AdvancedMemorySystem } from './AdvancedMemory.js';\nexport type { PatternData, RetrievalOptions, CausalInsight } from './HybridBackend.js';\nexport type { FailureAnalysis, SkillComposition } from './AdvancedMemory.js';\n\n// Re-export AgentDB controllers for advanced usage\nexport { ReflexionMemory } from 'agentdb/controllers/ReflexionMemory';\nexport { SkillLibrary } from 'agentdb/controllers/SkillLibrary';\nexport { CausalMemoryGraph } from 'agentdb/controllers/CausalMemoryGraph';\nexport { CausalRecall } from 'agentdb/controllers/CausalRecall';\nexport { NightlyLearner } from 'agentdb/controllers/NightlyLearner';\nexport { EmbeddingService } from 'agentdb/controllers/EmbeddingService';\n\n// Original ReasoningBank implementations (backwards compatibility)\nexport { retrieveMemories, formatMemoriesForPrompt } from './core/retrieve.js';\nexport type { RetrievedMemory } from './core/retrieve.js';\n\nexport { judgeTrajectory } from './core/judge.js';\nexport type { Verdict } from './core/judge.js';\n\nexport { distillMemories } from './core/distill.js';\nexport type { DistilledMemory } from './core/distill.js';\n\nexport { consolidate, shouldConsolidate } from './core/consolidate.js';\nexport type { ConsolidationResult } from './core/consolidate.js';\n\nexport { mattsParallel, mattsSequential } from './core/matts.js';\nexport type { MattsResult } from './core/matts.js';\n\nexport { computeEmbedding, clearEmbeddingCache } from './utils/embeddings.js';\nexport { mmrSelection, cosineSimilarity } from './utils/mmr.js';\nexport { scrubPII, containsPII, scrubMemory } from './utils/pii-scrubber.js';\nexport { loadConfig } from './utils/config.js';\n\n// Re-export database utilities\nimport * as db from './db/queries.js';\nexport { db };\nexport type {\n ReasoningMemory,\n PatternEmbedding,\n PatternLink,\n TaskTrajectory,\n MattsRun,\n ConsolidationRun,\n Trajectory,\n TrajectoryStep\n} from './db/schema.js';\n\n// Original functions (backwards compatibility)\nimport { loadConfig } from './utils/config.js';\nimport { retrieveMemories } from './core/retrieve.js';\nimport { judgeTrajectory } from './core/judge.js';\nimport { distillMemories } from './core/distill.js';\nimport { shouldConsolidate as shouldCons, consolidate as cons } from './core/consolidate.js';\n\nexport async function initialize(): Promise<void> {\n const config = loadConfig();\n console.log('[ReasoningBank] Initializing...');\n console.log('[ReasoningBank] Enabled: true (initializing...)');\n console.log(`[ReasoningBank] Database: ${process.env.CLAUDE_FLOW_DB_PATH || '.swarm/memory.db'}`);\n console.log(`[ReasoningBank] Embeddings: ${config.embeddings.provider}`);\n console.log(`[ReasoningBank] Retrieval k: ${config.retrieve.k}`);\n\n try {\n await db.runMigrations();\n console.log(`[ReasoningBank] Database migrated successfully`);\n } catch (error) {\n console.error('[ReasoningBank] Migration error:', error);\n throw new Error('ReasoningBank initialization failed: could not run migrations');\n }\n\n try {\n const dbConn = db.getDb();\n const tables = dbConn.prepare(\"SELECT name FROM sqlite_master WHERE type='table' AND name LIKE 'pattern%'\").all();\n console.log(`[ReasoningBank] Database OK: ${tables.length} tables found`);\n } catch (error) {\n console.error('[ReasoningBank] Database error:', error);\n throw new Error('ReasoningBank initialization failed: database not accessible');\n }\n\n console.log('[ReasoningBank] Initialization complete');\n}\n\nexport async function runTask(options: {\n taskId: string;\n agentId: string;\n query: string;\n domain?: string;\n executeFn: (memories: any[]) => Promise<any>;\n}): Promise<{\n verdict: any;\n usedMemories: any[];\n newMemories: string[];\n consolidated: boolean;\n}> {\n console.log(`[ReasoningBank] Running task: ${options.taskId}`);\n const memories = await retrieveMemories(options.query, {\n domain: options.domain,\n agent: options.agentId\n });\n console.log(`[ReasoningBank] Retrieved ${memories.length} memories`);\n const trajectory = await options.executeFn(memories);\n const verdict = await judgeTrajectory(trajectory, options.query);\n console.log(`[ReasoningBank] Verdict: ${verdict.label} (${verdict.confidence})`);\n const newMemories = await distillMemories(trajectory, verdict, options.query, {\n taskId: options.taskId,\n agentId: options.agentId,\n domain: options.domain\n });\n console.log(`[ReasoningBank] Distilled ${newMemories.length} new memories`);\n let consolidated = false;\n if (shouldCons()) {\n console.log('[ReasoningBank] Running consolidation...');\n await cons();\n consolidated = true;\n }\n return { verdict, usedMemories: memories, newMemories, consolidated };\n}\n\nexport const VERSION = '1.7.1';\nexport const PAPER_URL = 'https://arxiv.org/html/2509.25140v1';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/reasoningbank/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,yDAAyD;AACzD,OAAO,mCAAmC,CAAC;AAE3C,oFAAoF;AACpF,4DAA4D;AAC5D,8DAA8D;AAC9D,0FAA0F;AAC1F,gFAAgF;AAEhF,2FAA2F;AAC3F,0EAA0E;AAC1E,yEAAyE;AACzE,mEAAmE;AACnE,6EAA6E;AAC7E,mEAAmE;AACnE,uEAAuE;AACvE,2EAA2E;AAE3E,mEAAmE;AACnE,OAAO,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAG/E,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,C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,CAAC,QAAQ,CAAC,CAAC;IACrD,MAAM,OAAO,GAAG,MAAM,eAAe,CAAC,UAAU,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;IACjE,OAAO,CAAC,GAAG,CAAC,4BAA4B,OAAO,CAAC,KAAK,KAAK,OAAO,CAAC,UAAU,GAAG,CAAC,CAAC;IACjF,MAAM,WAAW,GAAG,MAAM,eAAe,CAAC,UAAU,EAAE,OAAO,EAAE,OAAO,CAAC,KAAK,EAAE;QAC5E,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,MAAM,EAAE,OAAO,CAAC,MAAM;KACvB,CAAC,CAAC;IACH,OAAO,CAAC,GAAG,CAAC,6BAA6B,WAAW,CAAC,MAAM,eAAe,CAAC,CAAC;IAC5E,IAAI,YAAY,GAAG,KAAK,CAAC;IACzB,IAAI,UAAU,EAAE,EAAE,CAAC;QACjB,OAAO,CAAC,GAAG,CAAC,0CAA0C,CAAC,CAAC;QACxD,MAAM,IAAI,EAAE,CAAC;QACb,YAAY,GAAG,IAAI,CAAC;IACtB,CAAC;IACD,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,WAAW,EAAE,YAAY,EAAE,CAAC;AACxE,CAAC;AAED,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC;AAC/B,MAAM,CAAC,MAAM,SAAS,GAAG,qCAAqC,CAAC","sourcesContent":["/**\n * ReasoningBank - Closed-loop memory system for AI agents\n * Based on arXiv:2509.25140 (Google DeepMind)\n *\n * @since v1.7.0 - Integrated AgentDB for optimal performance\n */\n\n// Apply AgentDB runtime patch before any AgentDB imports\nimport '../utils/agentdb-runtime-patch.js';\n\n// New hybrid backend - commented out due to missing dependencies (SharedMemoryPool)\n// export { HybridReasoningBank } from './HybridBackend.js';\n// export { AdvancedMemorySystem } from './AdvancedMemory.js';\n// export type { PatternData, RetrievalOptions, CausalInsight } from './HybridBackend.js';\n// export type { FailureAnalysis, SkillComposition } from './AdvancedMemory.js';\n\n// AgentDB controllers - re-exported lazily to avoid crashes when agentdb paths don't exist\n// Users can import directly from 'agentdb' if they need these controllers\n// export { ReflexionMemory } from 'agentdb/controllers/ReflexionMemory';\n// export { SkillLibrary } from 'agentdb/controllers/SkillLibrary';\n// export { CausalMemoryGraph } from 'agentdb/controllers/CausalMemoryGraph';\n// export { CausalRecall } from 'agentdb/controllers/CausalRecall';\n// export { NightlyLearner } from 'agentdb/controllers/NightlyLearner';\n// export { EmbeddingService } from 'agentdb/controllers/EmbeddingService';\n\n// Original ReasoningBank implementations (backwards compatibility)\nexport { retrieveMemories, formatMemoriesForPrompt } from './core/retrieve.js';\nexport type { RetrievedMemory } from './core/retrieve.js';\n\nexport { judgeTrajectory } from './core/judge.js';\nexport type { Verdict } from './core/judge.js';\n\nexport { distillMemories } from './core/distill.js';\nexport type { DistilledMemory } from './core/distill.js';\n\nexport { consolidate, shouldConsolidate } from './core/consolidate.js';\nexport type { ConsolidationResult } from './core/consolidate.js';\n\nexport { mattsParallel, mattsSequential } from './core/matts.js';\nexport type { MattsResult } from './core/matts.js';\n\nexport { computeEmbedding, clearEmbeddingCache } from './utils/embeddings.js';\nexport { mmrSelection, cosineSimilarity } from './utils/mmr.js';\nexport { scrubPII, containsPII, scrubMemory } from './utils/pii-scrubber.js';\nexport { loadConfig } from './utils/config.js';\n\n// Re-export database utilities\nimport * as db from './db/queries.js';\nexport { db };\nexport type {\n ReasoningMemory,\n PatternEmbedding,\n PatternLink,\n TaskTrajectory,\n MattsRun,\n ConsolidationRun,\n Trajectory,\n TrajectoryStep\n} from './db/schema.js';\n\n// Original functions (backwards compatibility)\nimport { loadConfig } from './utils/config.js';\nimport { retrieveMemories } from './core/retrieve.js';\nimport { judgeTrajectory } from './core/judge.js';\nimport { distillMemories } from './core/distill.js';\nimport { shouldConsolidate as shouldCons, consolidate as cons } from './core/consolidate.js';\n\nexport async function initialize(): Promise<void> {\n const config = loadConfig();\n console.log('[ReasoningBank] Initializing...');\n console.log('[ReasoningBank] Enabled: true (initializing...)');\n console.log(`[ReasoningBank] Database: ${process.env.CLAUDE_FLOW_DB_PATH || '.swarm/memory.db'}`);\n console.log(`[ReasoningBank] Embeddings: ${config.embeddings.provider}`);\n console.log(`[ReasoningBank] Retrieval k: ${config.retrieve.k}`);\n\n try {\n await db.runMigrations();\n console.log(`[ReasoningBank] Database migrated successfully`);\n } catch (error) {\n console.error('[ReasoningBank] Migration error:', error);\n throw new Error('ReasoningBank initialization failed: could not run migrations');\n }\n\n try {\n const dbConn = db.getDb();\n const tables = dbConn.prepare(\"SELECT name FROM sqlite_master WHERE type='table' AND name LIKE 'pattern%'\").all();\n console.log(`[ReasoningBank] Database OK: ${tables.length} tables found`);\n } catch (error) {\n console.error('[ReasoningBank] Database error:', error);\n throw new Error('ReasoningBank initialization failed: database not accessible');\n }\n\n console.log('[ReasoningBank] Initialization complete');\n}\n\nexport async function runTask(options: {\n taskId: string;\n agentId: string;\n query: string;\n domain?: string;\n executeFn: (memories: any[]) => Promise<any>;\n}): Promise<{\n verdict: any;\n usedMemories: any[];\n newMemories: string[];\n consolidated: boolean;\n}> {\n console.log(`[ReasoningBank] Running task: ${options.taskId}`);\n const memories = await retrieveMemories(options.query, {\n domain: options.domain,\n agent: options.agentId\n });\n console.log(`[ReasoningBank] Retrieved ${memories.length} memories`);\n const trajectory = await options.executeFn(memories);\n const verdict = await judgeTrajectory(trajectory, options.query);\n console.log(`[ReasoningBank] Verdict: ${verdict.label} (${verdict.confidence})`);\n const newMemories = await distillMemories(trajectory, verdict, options.query, {\n taskId: options.taskId,\n agentId: options.agentId,\n domain: options.domain\n });\n console.log(`[ReasoningBank] Distilled ${newMemories.length} new memories`);\n let consolidated = false;\n if (shouldCons()) {\n console.log('[ReasoningBank] Running consolidation...');\n await cons();\n consolidated = true;\n }\n return { verdict, usedMemories: memories, newMemories, consolidated };\n}\n\nexport const VERSION = '1.7.1';\nexport const PAPER_URL = 'https://arxiv.org/html/2509.25140v1';\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentic-flow",
3
- "version": "2.0.5",
3
+ "version": "2.0.7",
4
4
  "description": "Production-ready AI agent orchestration platform with 66 specialized agents, 213 MCP tools, ReasoningBank learning memory, and autonomous multi-agent swarms. Built by @ruvnet with Claude Agent SDK, neural networks, memory persistence, GitHub integration, and distributed consensus protocols.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -11,6 +11,7 @@
11
11
  "exports": {
12
12
  ".": "./dist/index.js",
13
13
  "./package.json": "./package.json",
14
+ "./embeddings": "./dist/reasoningbank/utils/embeddings.js",
14
15
  "./reasoningbank": {
15
16
  "node": "./dist/reasoningbank/index.js",
16
17
  "browser": "./dist/reasoningbank/wasm-adapter.js",
@@ -148,7 +149,7 @@
148
149
  "@ruvector/edge-full": "^0.1.0",
149
150
  "@ruvector/router": "^0.1.25",
150
151
  "@ruvector/ruvllm": "^0.2.3",
151
- "@ruvector/tiny-dancer": "^0.1.15",
152
+ "@ruvector/tiny-dancer": "0.1.17",
152
153
  "@supabase/supabase-js": "^2.78.0",
153
154
  "@xenova/transformers": "^2.17.2",
154
155
  "agentdb": "^2.0.0-alpha.2.20",
@@ -195,4 +196,4 @@
195
196
  "VALIDATION-RESULTS.md",
196
197
  "CHANGELOG.md"
197
198
  ]
198
- }
199
+ }
@@ -1,41 +1,44 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
+
4
+ /**
5
+ * WASM wrapper for ReasoningBank
6
+ */
7
+ export class ReasoningBankWasm {
8
+ free(): void;
9
+ [Symbol.dispose](): void;
10
+ /**
11
+ * Find similar patterns
12
+ */
13
+ findSimilar(task_description: string, task_category: string, top_k: number): Promise<string>;
14
+ /**
15
+ * Retrieve a pattern by ID
16
+ */
17
+ getPattern(id: string): Promise<string>;
18
+ /**
19
+ * Get storage statistics
20
+ */
21
+ getStats(): Promise<string>;
22
+ /**
23
+ * Create a new ReasoningBank instance
24
+ */
25
+ constructor(db_name?: string | null);
26
+ /**
27
+ * Search patterns by category
28
+ */
29
+ searchByCategory(category: string, limit: number): Promise<string>;
30
+ /**
31
+ * Store a reasoning pattern
32
+ */
33
+ storePattern(pattern_json: string): Promise<string>;
34
+ }
35
+
3
36
  /**
4
37
  * Initialize logging for WASM
5
38
  */
6
39
  export function init(): void;
40
+
7
41
  /**
8
42
  * Log a message to the browser console
9
43
  */
10
44
  export function log(message: string): void;
11
- /**
12
- * WASM wrapper for ReasoningBank
13
- */
14
- export class ReasoningBankWasm {
15
- free(): void;
16
- [Symbol.dispose](): void;
17
- /**
18
- * Create a new ReasoningBank instance
19
- */
20
- constructor(db_name?: string | null);
21
- /**
22
- * Store a reasoning pattern
23
- */
24
- storePattern(pattern_json: string): Promise<string>;
25
- /**
26
- * Retrieve a pattern by ID
27
- */
28
- getPattern(id: string): Promise<string>;
29
- /**
30
- * Search patterns by category
31
- */
32
- searchByCategory(category: string, limit: number): Promise<string>;
33
- /**
34
- * Find similar patterns
35
- */
36
- findSimilar(task_description: string, task_category: string, top_k: number): Promise<string>;
37
- /**
38
- * Get storage statistics
39
- */
40
- getStats(): Promise<string>;
41
- }
@@ -1,5 +1,9 @@
1
+ /* @ts-self-types="./reasoningbank_wasm.d.ts" */
2
+
1
3
  import * as wasm from "./reasoningbank_wasm_bg.wasm";
2
- export * from "./reasoningbank_wasm_bg.js";
3
4
  import { __wbg_set_wasm } from "./reasoningbank_wasm_bg.js";
4
5
  __wbg_set_wasm(wasm);
5
6
  wasm.__wbindgen_start();
7
+ export {
8
+ ReasoningBankWasm, init, log
9
+ } from "./reasoningbank_wasm_bg.js";