@stackmemoryai/stackmemory 0.4.2 → 0.5.1
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/dist/cli/commands/ralph.js +305 -0
- package/dist/cli/commands/ralph.js.map +2 -2
- package/dist/cli/streamlined-cli.js +144 -0
- package/dist/cli/streamlined-cli.js.map +7 -0
- package/dist/core/events/event-bus.js +110 -0
- package/dist/core/events/event-bus.js.map +7 -0
- package/dist/core/plugins/plugin-interface.js +87 -0
- package/dist/core/plugins/plugin-interface.js.map +7 -0
- package/dist/core/storage/simplified-storage.js +328 -0
- package/dist/core/storage/simplified-storage.js.map +7 -0
- package/dist/integrations/claude-code/agent-bridge.js +764 -0
- package/dist/integrations/claude-code/agent-bridge.js.map +7 -0
- package/dist/integrations/claude-code/task-coordinator.js +356 -0
- package/dist/integrations/claude-code/task-coordinator.js.map +7 -0
- package/dist/integrations/ralph/bridge/ralph-stackmemory-bridge.js +33 -11
- package/dist/integrations/ralph/bridge/ralph-stackmemory-bridge.js.map +2 -2
- package/dist/integrations/ralph/monitoring/swarm-registry.js +10 -1
- package/dist/integrations/ralph/monitoring/swarm-registry.js.map +2 -2
- package/dist/integrations/ralph/patterns/compounding-engineering-pattern.js +396 -0
- package/dist/integrations/ralph/patterns/compounding-engineering-pattern.js.map +7 -0
- package/dist/integrations/ralph/patterns/extended-coherence-sessions.js +469 -0
- package/dist/integrations/ralph/patterns/extended-coherence-sessions.js.map +7 -0
- package/dist/integrations/ralph/patterns/oracle-worker-pattern.js +384 -0
- package/dist/integrations/ralph/patterns/oracle-worker-pattern.js.map +7 -0
- package/dist/integrations/ralph/swarm/git-workflow-manager.js +71 -18
- package/dist/integrations/ralph/swarm/git-workflow-manager.js.map +2 -2
- package/dist/integrations/ralph/swarm/swarm-coordinator.js +243 -49
- package/dist/integrations/ralph/swarm/swarm-coordinator.js.map +2 -2
- package/dist/plugins/linear/index.js +166 -0
- package/dist/plugins/linear/index.js.map +7 -0
- package/dist/plugins/loader.js +57 -0
- package/dist/plugins/loader.js.map +7 -0
- package/dist/plugins/plugin-interface.js +67 -0
- package/dist/plugins/plugin-interface.js.map +7 -0
- package/dist/plugins/ralph/simple-ralph-plugin.js +305 -0
- package/dist/plugins/ralph/simple-ralph-plugin.js.map +7 -0
- package/dist/plugins/ralph/use-cases/code-generator.js +151 -0
- package/dist/plugins/ralph/use-cases/code-generator.js.map +7 -0
- package/dist/plugins/ralph/use-cases/test-generator.js +201 -0
- package/dist/plugins/ralph/use-cases/test-generator.js.map +7 -0
- package/package.json +1 -8
- package/scripts/simple-swarm-demo.ts +114 -0
- package/scripts/test-ralph-iterations.ts +164 -0
- package/scripts/test-swarm-fixes.ts +161 -0
- package/scripts/testing/ab-test-runner.ts +4 -2
- package/scripts/testing/collect-metrics.ts +2 -2
- package/scripts/testing/real-performance-test.js +1 -1
- package/scripts/testing/run-effectiveness-tests.sh +1 -1
- package/scripts/testing/simple-effectiveness-test.js +1 -1
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
#!/usr/bin/env tsx
|
|
2
|
+
/**
|
|
3
|
+
* Test script to verify swarm orchestration fixes
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { SwarmCoordinator } from '../src/integrations/ralph/swarm/swarm-coordinator.js';
|
|
7
|
+
import { RalphStackMemoryBridge } from '../src/integrations/ralph/bridge/ralph-stackmemory-bridge.js';
|
|
8
|
+
import { GitWorkflowManager } from '../src/integrations/ralph/swarm/git-workflow-manager.js';
|
|
9
|
+
import { Agent, SwarmTask } from '../src/integrations/ralph/types.js';
|
|
10
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
11
|
+
|
|
12
|
+
async function testDatabaseOptionalFix() {
|
|
13
|
+
console.log('\n1. Testing database optional fix...');
|
|
14
|
+
|
|
15
|
+
try {
|
|
16
|
+
// Test 1: Create bridge WITHOUT database requirement
|
|
17
|
+
const bridgeWithoutDb = new RalphStackMemoryBridge({
|
|
18
|
+
useStackMemory: false, // This should prevent database error
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
await bridgeWithoutDb.initialize({
|
|
22
|
+
task: 'Test task without database',
|
|
23
|
+
criteria: 'Test criteria',
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
console.log(
|
|
27
|
+
'✅ Bridge initialized successfully without database requirement'
|
|
28
|
+
);
|
|
29
|
+
} catch (error: any) {
|
|
30
|
+
console.error(
|
|
31
|
+
'❌ Failed to initialize bridge without database:',
|
|
32
|
+
error.message
|
|
33
|
+
);
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
async function testGitBranchConflictFix() {
|
|
41
|
+
console.log('\n2. Testing git branch conflict fix...');
|
|
42
|
+
|
|
43
|
+
const gitManager = new GitWorkflowManager({
|
|
44
|
+
enableGitWorkflow: true,
|
|
45
|
+
branchStrategy: 'agent',
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
const mockAgent: Agent = {
|
|
49
|
+
id: uuidv4(),
|
|
50
|
+
role: 'developer',
|
|
51
|
+
status: 'active',
|
|
52
|
+
capabilities: ['coding'],
|
|
53
|
+
workingDirectory: '.swarm/test',
|
|
54
|
+
currentTask: null,
|
|
55
|
+
performance: {
|
|
56
|
+
tasksCompleted: 0,
|
|
57
|
+
successRate: 1.0,
|
|
58
|
+
averageTaskTime: 0,
|
|
59
|
+
driftDetected: false,
|
|
60
|
+
lastFreshStart: Date.now(),
|
|
61
|
+
},
|
|
62
|
+
coordination: {
|
|
63
|
+
communicationStyle: 'collaborative',
|
|
64
|
+
conflictResolution: 'defer_to_expertise',
|
|
65
|
+
collaborationPreferences: [],
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const mockTask: SwarmTask = {
|
|
70
|
+
id: uuidv4(),
|
|
71
|
+
type: 'implementation',
|
|
72
|
+
title: 'implement-core-feature',
|
|
73
|
+
description: 'Test task',
|
|
74
|
+
priority: 1,
|
|
75
|
+
estimatedEffort: 'medium',
|
|
76
|
+
requiredRoles: ['developer'],
|
|
77
|
+
dependencies: [],
|
|
78
|
+
acceptanceCriteria: ['Test passes'],
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
try {
|
|
82
|
+
// Initialize workflow twice with same agent/task (should handle existing branch)
|
|
83
|
+
await gitManager.initializeAgentWorkflow(mockAgent, mockTask);
|
|
84
|
+
console.log('✅ First branch initialization successful');
|
|
85
|
+
|
|
86
|
+
// Try again with same task (should handle existing branch gracefully)
|
|
87
|
+
await gitManager.initializeAgentWorkflow(mockAgent, mockTask);
|
|
88
|
+
console.log(
|
|
89
|
+
'✅ Second branch initialization handled existing branch gracefully'
|
|
90
|
+
);
|
|
91
|
+
} catch (error: any) {
|
|
92
|
+
console.error('❌ Git branch conflict handling failed:', error.message);
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return true;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
async function testStopSwarmMethod() {
|
|
100
|
+
console.log('\n3. Testing stopSwarm method...');
|
|
101
|
+
|
|
102
|
+
const coordinator = new SwarmCoordinator({
|
|
103
|
+
maxAgents: 5,
|
|
104
|
+
coordinationInterval: 30000,
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
try {
|
|
108
|
+
// Initialize coordinator (minimal setup for testing)
|
|
109
|
+
// Note: We're just testing the method exists and runs without errors
|
|
110
|
+
|
|
111
|
+
// Verify stopSwarm method exists
|
|
112
|
+
if (typeof coordinator.stopSwarm !== 'function') {
|
|
113
|
+
console.error('❌ stopSwarm method does not exist');
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// Call stopSwarm (should handle empty state gracefully)
|
|
118
|
+
await coordinator.stopSwarm();
|
|
119
|
+
console.log('✅ stopSwarm method executed successfully');
|
|
120
|
+
} catch (error: any) {
|
|
121
|
+
console.error('❌ stopSwarm method failed:', error.message);
|
|
122
|
+
return false;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
return true;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
async function main() {
|
|
129
|
+
console.log('Testing Swarm Orchestration Fixes');
|
|
130
|
+
console.log('==================================');
|
|
131
|
+
|
|
132
|
+
let allTestsPassed = true;
|
|
133
|
+
|
|
134
|
+
// Test 1: Database optional fix
|
|
135
|
+
const test1 = await testDatabaseOptionalFix();
|
|
136
|
+
allTestsPassed = allTestsPassed && test1;
|
|
137
|
+
|
|
138
|
+
// Test 2: Git branch conflict fix
|
|
139
|
+
const test2 = await testGitBranchConflictFix();
|
|
140
|
+
allTestsPassed = allTestsPassed && test2;
|
|
141
|
+
|
|
142
|
+
// Test 3: stopSwarm method
|
|
143
|
+
const test3 = await testStopSwarmMethod();
|
|
144
|
+
allTestsPassed = allTestsPassed && test3;
|
|
145
|
+
|
|
146
|
+
// Summary
|
|
147
|
+
console.log('\n==================================');
|
|
148
|
+
if (allTestsPassed) {
|
|
149
|
+
console.log('✅ All tests passed! Fixes are working correctly.');
|
|
150
|
+
process.exit(0);
|
|
151
|
+
} else {
|
|
152
|
+
console.log('❌ Some tests failed. Please review the fixes.');
|
|
153
|
+
process.exit(1);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// Run tests
|
|
158
|
+
main().catch((error) => {
|
|
159
|
+
console.error('Test script error:', error);
|
|
160
|
+
process.exit(1);
|
|
161
|
+
});
|
|
@@ -428,11 +428,13 @@ export class ABTestRunner {
|
|
|
428
428
|
}
|
|
429
429
|
|
|
430
430
|
// Generate detailed report
|
|
431
|
-
await this.collector.generateReport(
|
|
431
|
+
await this.collector.generateReport(
|
|
432
|
+
'./scripts/testing/results/ab-test-report.md'
|
|
433
|
+
);
|
|
432
434
|
}
|
|
433
435
|
|
|
434
436
|
private async saveRun(run: TestRun): Promise<void> {
|
|
435
|
-
const outputDir = './
|
|
437
|
+
const outputDir = './scripts/testing/results/runs';
|
|
436
438
|
await fs.mkdir(outputDir, { recursive: true });
|
|
437
439
|
|
|
438
440
|
const filename = path.join(outputDir, `${run.id}.json`);
|
|
@@ -351,7 +351,7 @@ export class MetricsCollector {
|
|
|
351
351
|
|
|
352
352
|
async saveMetrics(
|
|
353
353
|
sessionId: string,
|
|
354
|
-
outputDir: string = './
|
|
354
|
+
outputDir: string = './scripts/testing/results'
|
|
355
355
|
): Promise<void> {
|
|
356
356
|
const metrics = this.metrics.get(sessionId);
|
|
357
357
|
if (!metrics) return;
|
|
@@ -362,7 +362,7 @@ export class MetricsCollector {
|
|
|
362
362
|
}
|
|
363
363
|
|
|
364
364
|
async generateReport(
|
|
365
|
-
outputPath: string = './
|
|
365
|
+
outputPath: string = './scripts/testing/results/report.md'
|
|
366
366
|
): Promise<void> {
|
|
367
367
|
const withStackMemory = Array.from(this.metrics.values()).filter(
|
|
368
368
|
(m) => m.variant === 'with_stackmemory'
|
|
@@ -365,7 +365,7 @@ class RealPerformanceTest {
|
|
|
365
365
|
}
|
|
366
366
|
|
|
367
367
|
// Save results to file
|
|
368
|
-
const resultsPath = path.join(process.cwd(), '
|
|
368
|
+
const resultsPath = path.join(process.cwd(), 'scripts', 'testing', 'results', 'real-performance-results.json');
|
|
369
369
|
const resultsDir = path.dirname(resultsPath);
|
|
370
370
|
|
|
371
371
|
if (!fs.existsSync(resultsDir)) {
|
|
@@ -7,7 +7,7 @@ set -e
|
|
|
7
7
|
|
|
8
8
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
9
9
|
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
|
10
|
-
RESULTS_DIR="$PROJECT_ROOT/
|
|
10
|
+
RESULTS_DIR="$PROJECT_ROOT/scripts/testing/results"
|
|
11
11
|
|
|
12
12
|
# Colors for output
|
|
13
13
|
GREEN='\033[0;32m'
|
|
@@ -266,7 +266,7 @@ class SimpleEffectivenessTest {
|
|
|
266
266
|
});
|
|
267
267
|
|
|
268
268
|
// Save report to file
|
|
269
|
-
const reportPath = path.join(process.cwd(), '
|
|
269
|
+
const reportPath = path.join(process.cwd(), 'scripts', 'testing', 'results', 'simple-effectiveness-report.json');
|
|
270
270
|
const reportDir = path.dirname(reportPath);
|
|
271
271
|
|
|
272
272
|
if (!fs.existsSync(reportDir)) {
|