agentic-flow 1.5.11 โ†’ 1.5.13

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.
@@ -0,0 +1,246 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Regression Test Suite for agentic-flow v1.5.13
4
+ *
5
+ * Tests to ensure no regressions were introduced by:
6
+ * - Backend selector implementation
7
+ * - Package exports updates
8
+ * - Documentation changes
9
+ */
10
+
11
+ import { fileURLToPath } from 'url';
12
+ import { dirname, join } from 'path';
13
+ import { existsSync } from 'fs';
14
+ import { createRequire } from 'module';
15
+
16
+ const __filename = fileURLToPath(import.meta.url);
17
+ const __dirname = dirname(__filename);
18
+ const require = createRequire(import.meta.url);
19
+
20
+ console.log('๐Ÿงช Regression Test Suite - agentic-flow v1.5.13\n');
21
+ console.log('โ”'.repeat(60) + '\n');
22
+
23
+ let passed = 0;
24
+ let failed = 0;
25
+
26
+ function test(name, fn) {
27
+ try {
28
+ fn();
29
+ console.log(`โœ… ${name}`);
30
+ passed++;
31
+ } catch (error) {
32
+ console.error(`โŒ ${name}`);
33
+ console.error(` Error: ${error.message}`);
34
+ failed++;
35
+ }
36
+ }
37
+
38
+ async function testAsync(name, fn) {
39
+ try {
40
+ await fn();
41
+ console.log(`โœ… ${name}`);
42
+ passed++;
43
+ } catch (error) {
44
+ console.error(`โŒ ${name}`);
45
+ console.error(` Error: ${error.message}`);
46
+ failed++;
47
+ }
48
+ }
49
+
50
+ // Test 1: Backend Selector Module Exports
51
+ console.log('๐Ÿ“ฆ Test Group 1: Backend Selector Module\n');
52
+
53
+ await testAsync('Import backend-selector module', async () => {
54
+ const module = await import('../dist/reasoningbank/backend-selector.js');
55
+ if (!module.getRecommendedBackend) throw new Error('Missing getRecommendedBackend');
56
+ if (!module.createOptimalReasoningBank) throw new Error('Missing createOptimalReasoningBank');
57
+ if (!module.validateEnvironment) throw new Error('Missing validateEnvironment');
58
+ });
59
+
60
+ await testAsync('getRecommendedBackend() returns valid backend', async () => {
61
+ const { getRecommendedBackend } = await import('../dist/reasoningbank/backend-selector.js');
62
+ const backend = getRecommendedBackend();
63
+ if (backend !== 'nodejs' && backend !== 'wasm') {
64
+ throw new Error(`Invalid backend: ${backend}`);
65
+ }
66
+ });
67
+
68
+ await testAsync('getBackendInfo() returns valid structure', async () => {
69
+ const { getBackendInfo } = await import('../dist/reasoningbank/backend-selector.js');
70
+ const info = getBackendInfo();
71
+ if (!info.backend) throw new Error('Missing backend field');
72
+ if (!info.environment) throw new Error('Missing environment field');
73
+ if (!info.features) throw new Error('Missing features field');
74
+ if (!info.storage) throw new Error('Missing storage field');
75
+ });
76
+
77
+ await testAsync('validateEnvironment() returns validation object', async () => {
78
+ const { validateEnvironment } = await import('../dist/reasoningbank/backend-selector.js');
79
+ const result = validateEnvironment();
80
+ if (typeof result.valid !== 'boolean') throw new Error('Missing valid field');
81
+ if (!Array.isArray(result.warnings)) throw new Error('Warnings should be array');
82
+ if (!result.backend) throw new Error('Missing backend field');
83
+ });
84
+
85
+ console.log('');
86
+
87
+ // Test 2: ReasoningBank Core Module (Node.js backend)
88
+ console.log('๐Ÿ“ฆ Test Group 2: ReasoningBank Core Module\n');
89
+
90
+ await testAsync('Import reasoningbank index module', async () => {
91
+ const module = await import('../dist/reasoningbank/index.js');
92
+ if (!module.initialize) throw new Error('Missing initialize function');
93
+ if (!module.db) throw new Error('Missing db module');
94
+ if (!module.retrieveMemories) throw new Error('Missing retrieveMemories');
95
+ });
96
+
97
+ await testAsync('db module has required functions', async () => {
98
+ const { db } = await import('../dist/reasoningbank/index.js');
99
+ if (!db.runMigrations) throw new Error('Missing runMigrations');
100
+ if (!db.getDb) throw new Error('Missing getDb');
101
+ if (!db.fetchMemoryCandidates) throw new Error('Missing fetchMemoryCandidates');
102
+ });
103
+
104
+ console.log('');
105
+
106
+ // Test 3: WASM Adapter Module
107
+ console.log('๐Ÿ“ฆ Test Group 3: WASM Adapter Module (Note: WASM requires --experimental-wasm-modules)\n');
108
+
109
+ test('WASM adapter file exists', () => {
110
+ if (!existsSync('./dist/reasoningbank/wasm-adapter.js')) {
111
+ throw new Error('wasm-adapter.js missing');
112
+ }
113
+ });
114
+
115
+ test('WASM binary exists', () => {
116
+ if (!existsSync('./wasm/reasoningbank/reasoningbank_wasm_bg.wasm')) {
117
+ throw new Error('WASM binary missing');
118
+ }
119
+ });
120
+
121
+ console.log(' โ„น๏ธ WASM import tests skipped (require --experimental-wasm-modules flag)');
122
+
123
+ console.log('');
124
+
125
+ // Test 4: Package Exports Resolution
126
+ console.log('๐Ÿ“ฆ Test Group 4: Package Exports\n');
127
+
128
+ await testAsync('Main export resolves', async () => {
129
+ try {
130
+ // This will fail without Claude Code, but should resolve
131
+ await import('../dist/index.js');
132
+ } catch (error) {
133
+ // Expected to fail in test environment, just check it resolves
134
+ if (error.code === 'ERR_MODULE_NOT_FOUND') throw error;
135
+ // Other errors are OK (e.g., missing Claude Code binary)
136
+ }
137
+ });
138
+
139
+ await testAsync('reasoningbank export resolves (Node.js)', async () => {
140
+ // In Node.js, should resolve to index.js
141
+ const module = await import('../dist/reasoningbank/index.js');
142
+ if (!module.db) throw new Error('Should have db module in Node.js');
143
+ });
144
+
145
+ await testAsync('backend-selector export resolves', async () => {
146
+ const module = await import('../dist/reasoningbank/backend-selector.js');
147
+ if (!module.createOptimalReasoningBank) throw new Error('Missing main function');
148
+ });
149
+
150
+ test('wasm-adapter export path exists', () => {
151
+ if (!existsSync('./dist/reasoningbank/wasm-adapter.js')) {
152
+ throw new Error('wasm-adapter.js not found');
153
+ }
154
+ });
155
+
156
+ console.log('');
157
+
158
+ // Test 5: Backward Compatibility
159
+ console.log('๐Ÿ“ฆ Test Group 5: Backward Compatibility\n');
160
+
161
+ await testAsync('Old import path still works', async () => {
162
+ // Old: import from dist/reasoningbank/index.js
163
+ const module = await import('../dist/reasoningbank/index.js');
164
+ if (!module.initialize) throw new Error('Old import broken');
165
+ });
166
+
167
+ await testAsync('Core functions unchanged', async () => {
168
+ const { retrieveMemories, judgeTrajectory, distillMemories, consolidate } =
169
+ await import('../dist/reasoningbank/index.js');
170
+
171
+ if (typeof retrieveMemories !== 'function') throw new Error('retrieveMemories broken');
172
+ if (typeof judgeTrajectory !== 'function') throw new Error('judgeTrajectory broken');
173
+ if (typeof distillMemories !== 'function') throw new Error('distillMemories broken');
174
+ if (typeof consolidate !== 'function') throw new Error('consolidate broken');
175
+ });
176
+
177
+ test('WASM adapter file integrity', () => {
178
+ const { readFileSync } = require('fs');
179
+ const content = readFileSync('./dist/reasoningbank/wasm-adapter.js', 'utf-8');
180
+ if (!content.includes('createReasoningBank')) {
181
+ throw new Error('createReasoningBank function missing from file');
182
+ }
183
+ if (!content.includes('ReasoningBankAdapter')) {
184
+ throw new Error('ReasoningBankAdapter class missing from file');
185
+ }
186
+ });
187
+
188
+ console.log('');
189
+
190
+ // Test 6: Router Module (should be untouched)
191
+ console.log('๐Ÿ“ฆ Test Group 6: Other Modules (Router)\n');
192
+
193
+ await testAsync('Router module still works', async () => {
194
+ const module = await import('../dist/router/router.js');
195
+ if (!module.ModelRouter) throw new Error('ModelRouter missing');
196
+ });
197
+
198
+ console.log('');
199
+
200
+ // Test 7: File Structure Integrity
201
+ console.log('๐Ÿ“ฆ Test Group 7: File Structure\n');
202
+
203
+ test('backend-selector.js exists', () => {
204
+ if (!existsSync('./dist/reasoningbank/backend-selector.js')) {
205
+ throw new Error('backend-selector.js not in dist/');
206
+ }
207
+ });
208
+
209
+ test('index.js exists', () => {
210
+ if (!existsSync('./dist/reasoningbank/index.js')) {
211
+ throw new Error('index.js not in dist/');
212
+ }
213
+ });
214
+
215
+ test('wasm-adapter.js exists', () => {
216
+ if (!existsSync('./dist/reasoningbank/wasm-adapter.js')) {
217
+ throw new Error('wasm-adapter.js not in dist/');
218
+ }
219
+ });
220
+
221
+ test('WASM files exist', () => {
222
+ if (!existsSync('./wasm/reasoningbank/reasoningbank_wasm.js')) {
223
+ throw new Error('WASM JS not found');
224
+ }
225
+ if (!existsSync('./wasm/reasoningbank/reasoningbank_wasm_bg.wasm')) {
226
+ throw new Error('WASM binary not found');
227
+ }
228
+ });
229
+
230
+ console.log('');
231
+
232
+ // Summary
233
+ console.log('โ”'.repeat(60));
234
+ console.log('๐Ÿ“Š REGRESSION TEST SUMMARY');
235
+ console.log('โ”'.repeat(60) + '\n');
236
+ console.log(`Total Tests: ${passed + failed}`);
237
+ console.log(`โœ… Passed: ${passed}`);
238
+ console.log(`โŒ Failed: ${failed}\n`);
239
+
240
+ if (failed === 0) {
241
+ console.log('๐ŸŽ‰ All regression tests passed! No regressions detected.\n');
242
+ process.exit(0);
243
+ } else {
244
+ console.log('โŒ Some regression tests failed. Review output above.\n');
245
+ process.exit(1);
246
+ }
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "name": "reasoningbank-wasm",
3
+ "type": "module",
3
4
  "collaborators": [
4
5
  "ReasoningBank Contributors"
5
6
  ],
@@ -13,11 +14,16 @@
13
14
  "files": [
14
15
  "reasoningbank_wasm_bg.wasm",
15
16
  "reasoningbank_wasm.js",
17
+ "reasoningbank_wasm_bg.js",
16
18
  "reasoningbank_wasm.d.ts"
17
19
  ],
18
20
  "main": "reasoningbank_wasm.js",
19
21
  "homepage": "https://github.com/ruvnet/agentic-flow/tree/main/reasoningbank",
20
22
  "types": "reasoningbank_wasm.d.ts",
23
+ "sideEffects": [
24
+ "./reasoningbank_wasm.js",
25
+ "./snippets/*"
26
+ ],
21
27
  "keywords": [
22
28
  "reasoning",
23
29
  "ai",