agentic-flow 1.5.1 → 1.5.3
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/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,29 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [1.5.3] - 2025-10-11
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
- **Critical:** Fixed path resolution for prompt template loading when running via npx
|
|
12
|
+
- Updated judge.ts, distill.ts, and matts.ts to use `__dirname` instead of `process.cwd()`
|
|
13
|
+
- Resolves "ENOENT: no such file or directory" errors when loading prompt JSON files
|
|
14
|
+
- Demo and all ReasoningBank CLI commands now work correctly when installed globally
|
|
15
|
+
- Files load correctly from npm package structure
|
|
16
|
+
|
|
17
|
+
### Technical Details
|
|
18
|
+
- Added proper ES module path resolution: `fileURLToPath(import.meta.url)` and `dirname()`
|
|
19
|
+
- Changed prompt paths from `join(process.cwd(), 'src', 'reasoningbank', 'prompts', ...)`
|
|
20
|
+
to `join(__dirname, '../prompts', ...)`
|
|
21
|
+
- Ensures prompts load from installed npm package location, not current working directory
|
|
22
|
+
|
|
23
|
+
## [1.5.2] - 2025-10-11
|
|
24
|
+
|
|
25
|
+
### Fixed
|
|
26
|
+
- **Critical:** Fixed Float32Array buffer parsing in database queries
|
|
27
|
+
- Properly convert binary blob to Float32Array (buffer.length / 4 bytes per float)
|
|
28
|
+
- Resolves "Vector dimension mismatch: 1024 vs 4096" error
|
|
29
|
+
- Demo and all ReasoningBank features now work correctly
|
|
30
|
+
|
|
8
31
|
## [1.5.1] - 2025-10-11
|
|
9
32
|
|
|
10
33
|
### Fixed
|
|
@@ -3,12 +3,15 @@
|
|
|
3
3
|
* Algorithm 3 from ReasoningBank paper
|
|
4
4
|
*/
|
|
5
5
|
import { readFileSync } from 'fs';
|
|
6
|
-
import { join } from 'path';
|
|
6
|
+
import { join, dirname } from 'path';
|
|
7
|
+
import { fileURLToPath } from 'url';
|
|
7
8
|
import { ulid } from 'ulid';
|
|
8
9
|
import { loadConfig } from '../utils/config.js';
|
|
9
10
|
import { scrubMemory } from '../utils/pii-scrubber.js';
|
|
10
11
|
import { computeEmbedding } from '../utils/embeddings.js';
|
|
11
12
|
import * as db from '../db/queries.js';
|
|
13
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
14
|
+
const __dirname = dirname(__filename);
|
|
12
15
|
/**
|
|
13
16
|
* Distill memories from a trajectory
|
|
14
17
|
*/
|
|
@@ -18,7 +21,7 @@ export async function distillMemories(trajectory, verdict, query, options = {})
|
|
|
18
21
|
console.log(`[INFO] Distilling memories from ${verdict.label} trajectory`);
|
|
19
22
|
// Select appropriate prompt template
|
|
20
23
|
const templateName = verdict.label === 'Success' ? 'distill-success.json' : 'distill-failure.json';
|
|
21
|
-
const promptPath = join(
|
|
24
|
+
const promptPath = join(__dirname, '../prompts', templateName);
|
|
22
25
|
const promptTemplate = JSON.parse(readFileSync(promptPath, 'utf-8'));
|
|
23
26
|
const maxItems = verdict.label === 'Success'
|
|
24
27
|
? config.distill.max_items_success
|
|
@@ -3,8 +3,11 @@
|
|
|
3
3
|
* Algorithm 2 from ReasoningBank paper
|
|
4
4
|
*/
|
|
5
5
|
import { readFileSync } from 'fs';
|
|
6
|
-
import { join } from 'path';
|
|
6
|
+
import { join, dirname } from 'path';
|
|
7
|
+
import { fileURLToPath } from 'url';
|
|
7
8
|
import { loadConfig } from '../utils/config.js';
|
|
9
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
10
|
+
const __dirname = dirname(__filename);
|
|
8
11
|
/**
|
|
9
12
|
* Judge a task trajectory using LLM evaluation
|
|
10
13
|
*/
|
|
@@ -12,8 +15,8 @@ export async function judgeTrajectory(trajectory, query, options = {}) {
|
|
|
12
15
|
const config = loadConfig();
|
|
13
16
|
const startTime = Date.now();
|
|
14
17
|
console.log(`[INFO] Judging trajectory for query: ${query.substring(0, 100)}...`);
|
|
15
|
-
// Load judge prompt template
|
|
16
|
-
const promptPath = join(
|
|
18
|
+
// Load judge prompt template (relative to this file)
|
|
19
|
+
const promptPath = join(__dirname, '../prompts/judge.json');
|
|
17
20
|
const promptTemplate = JSON.parse(readFileSync(promptPath, 'utf-8'));
|
|
18
21
|
// Format trajectory for judgment
|
|
19
22
|
const trajectoryText = formatTrajectory(trajectory);
|
|
@@ -7,13 +7,16 @@
|
|
|
7
7
|
* - Sequential: r iterative refinements with check-and-correct
|
|
8
8
|
*/
|
|
9
9
|
import { readFileSync } from 'fs';
|
|
10
|
-
import { join } from 'path';
|
|
10
|
+
import { join, dirname } from 'path';
|
|
11
|
+
import { fileURLToPath } from 'url';
|
|
11
12
|
import { ulid } from 'ulid';
|
|
12
13
|
import { loadConfig } from '../utils/config.js';
|
|
13
14
|
import { retrieveMemories } from './retrieve.js';
|
|
14
15
|
import { judgeTrajectory } from './judge.js';
|
|
15
16
|
import { distillMemories } from './distill.js';
|
|
16
17
|
import * as db from '../db/queries.js';
|
|
18
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
19
|
+
const __dirname = dirname(__filename);
|
|
17
20
|
/**
|
|
18
21
|
* Run MaTTS in parallel mode
|
|
19
22
|
* Execute k independent rollouts and aggregate via self-contrast
|
|
@@ -164,7 +167,7 @@ export async function mattsSequential(taskFn, query, options = {}) {
|
|
|
164
167
|
async function aggregateMemories(trajectories, query, options) {
|
|
165
168
|
console.log('[INFO] Aggregating memories via self-contrast');
|
|
166
169
|
// Load aggregation prompt
|
|
167
|
-
const promptPath = join(
|
|
170
|
+
const promptPath = join(__dirname, '../prompts', 'matts-aggregate.json');
|
|
168
171
|
const promptTemplate = JSON.parse(readFileSync(promptPath, 'utf-8'));
|
|
169
172
|
// Format trajectories for comparison
|
|
170
173
|
const trajectoryTexts = trajectories.map((t, i) => ({
|
|
@@ -148,11 +148,16 @@ export function fetchMemoryCandidates(options) {
|
|
|
148
148
|
query += ` ORDER BY p.confidence DESC, p.usage_count DESC`;
|
|
149
149
|
const stmt = db.prepare(query);
|
|
150
150
|
const rows = stmt.all(...params);
|
|
151
|
-
return rows.map((row) =>
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
151
|
+
return rows.map((row) => {
|
|
152
|
+
const buffer = Buffer.from(row.embedding);
|
|
153
|
+
// Create Float32Array from buffer - buffer length / 4 bytes per float
|
|
154
|
+
const float32Array = new Float32Array(buffer.buffer, buffer.byteOffset, buffer.length / 4);
|
|
155
|
+
return {
|
|
156
|
+
...row,
|
|
157
|
+
pattern_data: JSON.parse(row.pattern_data),
|
|
158
|
+
embedding: float32Array
|
|
159
|
+
};
|
|
160
|
+
});
|
|
156
161
|
}
|
|
157
162
|
/**
|
|
158
163
|
* Store a new reasoning memory
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agentic-flow",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.3",
|
|
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",
|