@stackmemoryai/stackmemory 0.3.26 → 0.4.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 +125 -188
- package/dist/cli/commands/ralph.js.map +2 -2
- package/dist/features/tui/simple-monitor.js +112 -0
- package/dist/features/tui/simple-monitor.js.map +7 -0
- package/dist/features/tui/swarm-monitor.js +644 -0
- package/dist/features/tui/swarm-monitor.js.map +7 -0
- package/dist/integrations/ralph/bridge/ralph-stackmemory-bridge.js +254 -43
- package/dist/integrations/ralph/bridge/ralph-stackmemory-bridge.js.map +3 -3
- package/dist/integrations/ralph/coordination/enhanced-coordination.js +406 -0
- package/dist/integrations/ralph/coordination/enhanced-coordination.js.map +7 -0
- package/dist/integrations/ralph/monitoring/swarm-dashboard.js +290 -0
- package/dist/integrations/ralph/monitoring/swarm-dashboard.js.map +7 -0
- package/dist/integrations/ralph/monitoring/swarm-registry.js +95 -0
- package/dist/integrations/ralph/monitoring/swarm-registry.js.map +7 -0
- package/dist/integrations/ralph/recovery/crash-recovery.js +458 -0
- package/dist/integrations/ralph/recovery/crash-recovery.js.map +7 -0
- package/dist/integrations/ralph/swarm/git-workflow-manager.js +6 -67
- package/dist/integrations/ralph/swarm/git-workflow-manager.js.map +2 -2
- package/dist/integrations/ralph/swarm/swarm-coordinator.js +5 -139
- package/dist/integrations/ralph/swarm/swarm-coordinator.js.map +2 -2
- package/package.json +2 -1
- package/scripts/test-ralph-iteration-fix.ts +118 -0
- package/scripts/test-simple-ralph-state-sync.ts +178 -0
- package/scripts/test-swarm-tui.ts +34 -0
- package/scripts/test-tui-shortcuts.ts +66 -0
- package/scripts/validate-tui-shortcuts.ts +83 -0
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { SwarmRegistry } from "../../integrations/ralph/monitoring/swarm-registry.js";
|
|
2
|
+
import { execSync } from "child_process";
|
|
3
|
+
class SimpleSwarmMonitor {
|
|
4
|
+
refreshInterval = null;
|
|
5
|
+
/**
|
|
6
|
+
* Start simple text-based monitoring
|
|
7
|
+
*/
|
|
8
|
+
start() {
|
|
9
|
+
console.log("\u{1F9BE} Ralph Swarm Monitor (Text Mode)");
|
|
10
|
+
console.log("=====================================");
|
|
11
|
+
console.log("");
|
|
12
|
+
console.log("Press Ctrl+C to quit");
|
|
13
|
+
console.log("");
|
|
14
|
+
this.displayStatus();
|
|
15
|
+
this.refreshInterval = setInterval(() => {
|
|
16
|
+
this.displayStatus();
|
|
17
|
+
}, 5e3);
|
|
18
|
+
process.on("SIGINT", () => {
|
|
19
|
+
this.stop();
|
|
20
|
+
process.exit(0);
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Stop monitoring
|
|
25
|
+
*/
|
|
26
|
+
stop() {
|
|
27
|
+
if (this.refreshInterval) {
|
|
28
|
+
clearInterval(this.refreshInterval);
|
|
29
|
+
}
|
|
30
|
+
console.log("\n\u{1F44B} Swarm monitoring stopped");
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Display current status
|
|
34
|
+
*/
|
|
35
|
+
displayStatus() {
|
|
36
|
+
const timestamp = (/* @__PURE__ */ new Date()).toLocaleTimeString();
|
|
37
|
+
console.log(`
|
|
38
|
+
\u23F0 ${timestamp} - Swarm Status Update`);
|
|
39
|
+
console.log("\u2500".repeat(50));
|
|
40
|
+
try {
|
|
41
|
+
const registry = SwarmRegistry.getInstance();
|
|
42
|
+
const activeSwarms = registry.listActiveSwarms();
|
|
43
|
+
const stats = registry.getStatistics();
|
|
44
|
+
console.log(
|
|
45
|
+
`\u{1F4CA} Registry Stats: ${stats.activeSwarms} active, ${stats.totalSwarms} total`
|
|
46
|
+
);
|
|
47
|
+
if (activeSwarms.length > 0) {
|
|
48
|
+
console.log("\n\u{1F9BE} Active Swarms:");
|
|
49
|
+
for (const swarm of activeSwarms) {
|
|
50
|
+
const uptime = this.formatDuration(Date.now() - swarm.startTime);
|
|
51
|
+
console.log(
|
|
52
|
+
` \u2022 ${swarm.id.substring(0, 8)}: ${swarm.status} (${uptime})`
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
} else {
|
|
56
|
+
console.log("\u274C No active swarms in registry");
|
|
57
|
+
}
|
|
58
|
+
try {
|
|
59
|
+
const ralphProcesses = execSync(
|
|
60
|
+
'ps aux | grep "ralph" | grep -v grep',
|
|
61
|
+
{ encoding: "utf8" }
|
|
62
|
+
);
|
|
63
|
+
if (ralphProcesses.trim()) {
|
|
64
|
+
console.log("\n\u{1F50D} External Ralph Processes:");
|
|
65
|
+
const processLines = ralphProcesses.split("\n").filter((line) => line.trim());
|
|
66
|
+
processLines.slice(0, 3).forEach((line) => {
|
|
67
|
+
const parts = line.split(/\s+/);
|
|
68
|
+
console.log(
|
|
69
|
+
` PID ${parts[1]}: ${parts.slice(10).join(" ").slice(0, 50)}...`
|
|
70
|
+
);
|
|
71
|
+
});
|
|
72
|
+
if (processLines.length > 3) {
|
|
73
|
+
console.log(` ... and ${processLines.length - 3} more processes`);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
} catch {
|
|
77
|
+
}
|
|
78
|
+
try {
|
|
79
|
+
const recentCommits = execSync(
|
|
80
|
+
'git log --oneline --since="1 hour ago" --pretty=format:"%h %an %s" | head -3',
|
|
81
|
+
{ encoding: "utf8", cwd: process.cwd() }
|
|
82
|
+
);
|
|
83
|
+
if (recentCommits.trim()) {
|
|
84
|
+
console.log("\n\u{1F4DD} Recent Commits:");
|
|
85
|
+
recentCommits.split("\n").filter((line) => line.trim()).forEach((line) => {
|
|
86
|
+
console.log(` ${line}`);
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
} catch {
|
|
90
|
+
}
|
|
91
|
+
} catch (error) {
|
|
92
|
+
console.log(`\u274C Status error: ${error.message}`);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Format duration string
|
|
97
|
+
*/
|
|
98
|
+
formatDuration(ms) {
|
|
99
|
+
const seconds = Math.floor(ms / 1e3);
|
|
100
|
+
const minutes = Math.floor(seconds / 60);
|
|
101
|
+
const hours = Math.floor(minutes / 60);
|
|
102
|
+
if (hours > 0) return `${hours}h ${minutes % 60}m`;
|
|
103
|
+
if (minutes > 0) return `${minutes}m ${seconds % 60}s`;
|
|
104
|
+
return `${seconds}s`;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
var simple_monitor_default = SimpleSwarmMonitor;
|
|
108
|
+
export {
|
|
109
|
+
SimpleSwarmMonitor,
|
|
110
|
+
simple_monitor_default as default
|
|
111
|
+
};
|
|
112
|
+
//# sourceMappingURL=simple-monitor.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/features/tui/simple-monitor.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Simple text-based swarm monitor for terminal compatibility\n * Fallback for terminals that can't handle blessed TUI\n */\n\nimport { SwarmRegistry } from '../../integrations/ralph/monitoring/swarm-registry.js';\nimport { execSync } from 'child_process';\n// Simple monitor for terminal compatibility\n\nexport class SimpleSwarmMonitor {\n private refreshInterval: NodeJS.Timeout | null = null;\n\n /**\n * Start simple text-based monitoring\n */\n start(): void {\n console.log('\uD83E\uDDBE Ralph Swarm Monitor (Text Mode)');\n console.log('=====================================');\n console.log('');\n console.log('Press Ctrl+C to quit');\n console.log('');\n\n // Show initial status\n this.displayStatus();\n\n // Set up refresh interval\n this.refreshInterval = setInterval(() => {\n this.displayStatus();\n }, 5000);\n\n // Handle graceful shutdown\n process.on('SIGINT', () => {\n this.stop();\n process.exit(0);\n });\n }\n\n /**\n * Stop monitoring\n */\n stop(): void {\n if (this.refreshInterval) {\n clearInterval(this.refreshInterval);\n }\n console.log('\\n\uD83D\uDC4B Swarm monitoring stopped');\n }\n\n /**\n * Display current status\n */\n private displayStatus(): void {\n const timestamp = new Date().toLocaleTimeString();\n\n console.log(`\\n\u23F0 ${timestamp} - Swarm Status Update`);\n console.log('\u2500'.repeat(50));\n\n try {\n // Check registry\n const registry = SwarmRegistry.getInstance();\n const activeSwarms = registry.listActiveSwarms();\n const stats = registry.getStatistics();\n\n console.log(\n `\uD83D\uDCCA Registry Stats: ${stats.activeSwarms} active, ${stats.totalSwarms} total`\n );\n\n if (activeSwarms.length > 0) {\n console.log('\\n\uD83E\uDDBE Active Swarms:');\n for (const swarm of activeSwarms) {\n const uptime = this.formatDuration(Date.now() - swarm.startTime);\n console.log(\n ` \u2022 ${swarm.id.substring(0, 8)}: ${swarm.status} (${uptime})`\n );\n }\n } else {\n console.log('\u274C No active swarms in registry');\n }\n\n // Check for external processes\n try {\n const ralphProcesses = execSync(\n 'ps aux | grep \"ralph\" | grep -v grep',\n { encoding: 'utf8' }\n );\n if (ralphProcesses.trim()) {\n console.log('\\n\uD83D\uDD0D External Ralph Processes:');\n const processLines = ralphProcesses\n .split('\\n')\n .filter((line) => line.trim());\n processLines.slice(0, 3).forEach((line) => {\n const parts = line.split(/\\s+/);\n console.log(\n ` PID ${parts[1]}: ${parts.slice(10).join(' ').slice(0, 50)}...`\n );\n });\n if (processLines.length > 3) {\n console.log(` ... and ${processLines.length - 3} more processes`);\n }\n }\n } catch {\n // No external processes\n }\n\n // Show recent commits\n try {\n const recentCommits = execSync(\n 'git log --oneline --since=\"1 hour ago\" --pretty=format:\"%h %an %s\" | head -3',\n { encoding: 'utf8', cwd: process.cwd() }\n );\n\n if (recentCommits.trim()) {\n console.log('\\n\uD83D\uDCDD Recent Commits:');\n recentCommits\n .split('\\n')\n .filter((line) => line.trim())\n .forEach((line) => {\n console.log(` ${line}`);\n });\n }\n } catch {\n // No git or commits\n }\n } catch (error: unknown) {\n console.log(`\u274C Status error: ${(error as Error).message}`);\n }\n }\n\n /**\n * Format duration string\n */\n private formatDuration(ms: number): string {\n const seconds = Math.floor(ms / 1000);\n const minutes = Math.floor(seconds / 60);\n const hours = Math.floor(minutes / 60);\n\n if (hours >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