@stackmemoryai/stackmemory 0.5.64 → 0.5.66
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/README.md +68 -345
- package/bin/claude-sm +1 -1
- package/bin/claude-smd +1 -1
- package/bin/codex-smd +1 -1
- package/dist/src/cli/commands/skills.js +104 -0
- package/dist/src/cli/commands/skills.js.map +2 -2
- package/dist/src/cli/index.js +304 -1
- package/dist/src/cli/index.js.map +2 -2
- package/dist/src/integrations/mcp/pending-utils.js +33 -0
- package/dist/src/integrations/mcp/pending-utils.js.map +7 -0
- package/dist/src/integrations/mcp/server.js +565 -1
- package/dist/src/integrations/mcp/server.js.map +2 -2
- package/dist/src/orchestrators/multimodal/constants.js +17 -0
- package/dist/src/orchestrators/multimodal/constants.js.map +7 -0
- package/dist/src/orchestrators/multimodal/harness.js +293 -0
- package/dist/src/orchestrators/multimodal/harness.js.map +7 -0
- package/dist/src/orchestrators/multimodal/providers.js +85 -0
- package/dist/src/orchestrators/multimodal/providers.js.map +7 -0
- package/dist/src/orchestrators/multimodal/types.js +5 -0
- package/dist/src/orchestrators/multimodal/types.js.map +7 -0
- package/dist/src/orchestrators/multimodal/utils.js +25 -0
- package/dist/src/orchestrators/multimodal/utils.js.map +7 -0
- package/package.json +12 -9
- package/scripts/claude-code-wrapper.sh +18 -30
- package/scripts/demos/ralph-integration-demo.ts +14 -13
- package/scripts/demos/trace-demo.ts +7 -21
- package/scripts/demos/trace-test.ts +20 -8
- package/scripts/verify-dist.cjs +83 -0
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import { RalphStackMemoryBridge } from './bridge/ralph-stackmemory-bridge.js';
|
|
8
|
-
import { logger } from '../../core/monitoring/logger.js';
|
|
9
8
|
import { RalphStackMemoryConfig } from './types.js';
|
|
10
9
|
|
|
11
10
|
class RalphIntegrationDemo {
|
|
@@ -60,9 +59,12 @@ class RalphIntegrationDemo {
|
|
|
60
59
|
await this.demonstrateMetrics();
|
|
61
60
|
|
|
62
61
|
console.log('\n✅ Demo completed successfully!\n');
|
|
63
|
-
} catch (
|
|
64
|
-
console.error(
|
|
65
|
-
|
|
62
|
+
} catch (err: unknown) {
|
|
63
|
+
console.error(
|
|
64
|
+
'\n❌ Demo failed:',
|
|
65
|
+
err instanceof Error ? err.message : err
|
|
66
|
+
);
|
|
67
|
+
throw err;
|
|
66
68
|
} finally {
|
|
67
69
|
await this.cleanup();
|
|
68
70
|
}
|
|
@@ -158,9 +160,6 @@ class RalphIntegrationDemo {
|
|
|
158
160
|
console.log('\n🚑 Phase 3: Crash Recovery');
|
|
159
161
|
console.log('===========================');
|
|
160
162
|
|
|
161
|
-
// Simulate getting session ID
|
|
162
|
-
const sessionId = 'demo-session-123';
|
|
163
|
-
|
|
164
163
|
try {
|
|
165
164
|
console.log('🔄 Simulating session rehydration...');
|
|
166
165
|
|
|
@@ -177,8 +176,10 @@ class RalphIntegrationDemo {
|
|
|
177
176
|
console.log(' - State reconciled: 0.3s');
|
|
178
177
|
console.log(' - Memory usage: 45MB');
|
|
179
178
|
console.log(' - Cache hit rate: 78%');
|
|
180
|
-
} catch (
|
|
181
|
-
console.log(
|
|
179
|
+
} catch (err: unknown) {
|
|
180
|
+
console.log(
|
|
181
|
+
`⚠️ Recovery simulation: ${err instanceof Error ? err.message : err}`
|
|
182
|
+
);
|
|
182
183
|
}
|
|
183
184
|
}
|
|
184
185
|
|
|
@@ -227,10 +228,10 @@ async function main() {
|
|
|
227
228
|
|
|
228
229
|
try {
|
|
229
230
|
await demo.run();
|
|
230
|
-
} catch (
|
|
231
|
-
console.error('Demo failed:',
|
|
232
|
-
if (process.env.DEBUG) {
|
|
233
|
-
console.error(
|
|
231
|
+
} catch (err: unknown) {
|
|
232
|
+
console.error('Demo failed:', err instanceof Error ? err.message : err);
|
|
233
|
+
if (process.env.DEBUG && err instanceof Error) {
|
|
234
|
+
console.error(err.stack);
|
|
234
235
|
}
|
|
235
236
|
process.exit(1);
|
|
236
237
|
}
|
|
@@ -6,33 +6,17 @@
|
|
|
6
6
|
|
|
7
7
|
import {
|
|
8
8
|
trace,
|
|
9
|
-
Trace,
|
|
10
|
-
TraceClass,
|
|
11
9
|
enableVerboseTracing,
|
|
12
10
|
createTracedDatabase,
|
|
13
11
|
traceStep,
|
|
14
12
|
} from './index.js';
|
|
15
|
-
import { logger } from '../monitoring/logger.js';
|
|
16
|
-
// Type-safe environment variable access
|
|
17
|
-
function getEnv(key: string, defaultValue?: string): string {
|
|
18
|
-
const value = process.env[key];
|
|
19
|
-
if (value === undefined) {
|
|
20
|
-
if (defaultValue !== undefined) return defaultValue;
|
|
21
|
-
throw new Error(`Environment variable ${key} is required`);
|
|
22
|
-
}
|
|
23
|
-
return value;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
function getOptionalEnv(key: string): string | undefined {
|
|
27
|
-
return process.env[key];
|
|
28
|
-
}
|
|
29
13
|
|
|
30
14
|
// Example class with tracing
|
|
31
15
|
// @TraceClass() - decorators not enabled in tsconfig
|
|
32
16
|
class ExampleService {
|
|
33
|
-
private data: Map<string,
|
|
17
|
+
private data: Map<string, unknown> = new Map();
|
|
34
18
|
|
|
35
|
-
async fetchData(id: string): Promise<
|
|
19
|
+
async fetchData(id: string): Promise<Record<string, unknown>> {
|
|
36
20
|
// Simulate API call
|
|
37
21
|
await this.delay(50);
|
|
38
22
|
|
|
@@ -43,7 +27,9 @@ class ExampleService {
|
|
|
43
27
|
return { id, value: Math.random() };
|
|
44
28
|
}
|
|
45
29
|
|
|
46
|
-
async processData(
|
|
30
|
+
async processData(
|
|
31
|
+
data: Record<string, unknown>
|
|
32
|
+
): Promise<Record<string, unknown>> {
|
|
47
33
|
return traceStep('Data validation', async () => {
|
|
48
34
|
await this.delay(20);
|
|
49
35
|
|
|
@@ -62,7 +48,7 @@ class ExampleService {
|
|
|
62
48
|
});
|
|
63
49
|
}
|
|
64
50
|
|
|
65
|
-
cacheData(key: string, value:
|
|
51
|
+
cacheData(key: string, value: unknown): void {
|
|
66
52
|
trace.traceSync('function', 'cacheData', { key, value }, () => {
|
|
67
53
|
this.data.set(key, value);
|
|
68
54
|
});
|
|
@@ -161,7 +147,7 @@ async function runDemo() {
|
|
|
161
147
|
|
|
162
148
|
try {
|
|
163
149
|
await service.fetchData('error');
|
|
164
|
-
} catch
|
|
150
|
+
} catch {
|
|
165
151
|
console.log('Error properly traced and handled\n');
|
|
166
152
|
}
|
|
167
153
|
});
|
|
@@ -3,19 +3,31 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import LocalStackMemoryMCP from './server';
|
|
6
|
-
|
|
6
|
+
|
|
7
|
+
// Type for accessing private members in tests
|
|
8
|
+
interface MCPTestInstance {
|
|
9
|
+
traceDetector: {
|
|
10
|
+
addToolCall: (call: {
|
|
11
|
+
id: string;
|
|
12
|
+
tool: string;
|
|
13
|
+
timestamp: number;
|
|
14
|
+
arguments: Record<string, unknown>;
|
|
15
|
+
}) => void;
|
|
16
|
+
flush: () => void;
|
|
17
|
+
};
|
|
18
|
+
handleGetTraceStatistics: (
|
|
19
|
+
args: Record<string, unknown>
|
|
20
|
+
) => Promise<{ content: Array<{ text: string }> }>;
|
|
21
|
+
handleGetTraces: (args: {
|
|
22
|
+
limit: number;
|
|
23
|
+
}) => Promise<{ content: Array<{ text: string }> }>;
|
|
24
|
+
}
|
|
7
25
|
|
|
8
26
|
async function testTraceIntegration() {
|
|
9
27
|
console.log('🧪 Testing Trace Detection in MCP Server\n');
|
|
10
28
|
|
|
11
|
-
// Mock minimal server setup
|
|
12
|
-
const mockServer = {
|
|
13
|
-
setRequestHandler: () => {},
|
|
14
|
-
connect: () => Promise.resolve(),
|
|
15
|
-
} as any;
|
|
16
|
-
|
|
17
29
|
// Access the private methods through prototype
|
|
18
|
-
const MCPClass = LocalStackMemoryMCP as
|
|
30
|
+
const MCPClass = LocalStackMemoryMCP as unknown as new () => MCPTestInstance;
|
|
19
31
|
const mcp = new MCPClass();
|
|
20
32
|
|
|
21
33
|
// Simulate tool calls directly on the trace detector
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Verifies expected dist artifacts and bin launchers point to correct paths.
|
|
3
|
+
// Exits non-zero with actionable messages on mismatch.
|
|
4
|
+
|
|
5
|
+
const { readFileSync, existsSync } = require('fs');
|
|
6
|
+
const { join } = require('path');
|
|
7
|
+
|
|
8
|
+
function fail(msg) {
|
|
9
|
+
console.error(`ERROR: ${msg}`);
|
|
10
|
+
process.exitCode = 1;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function checkFile(path) {
|
|
14
|
+
if (!existsSync(path)) {
|
|
15
|
+
fail(`Missing built file: ${path}`);
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function fileContains(path, substr) {
|
|
22
|
+
try {
|
|
23
|
+
const c = readFileSync(path, 'utf8');
|
|
24
|
+
if (!c.includes(substr)) {
|
|
25
|
+
fail(`Expected reference not found in ${path}: ${substr}`);
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
return true;
|
|
29
|
+
} catch (e) {
|
|
30
|
+
fail(`Unable to read ${path}: ${e.message}`);
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function main() {
|
|
36
|
+
const dist = 'dist/src';
|
|
37
|
+
|
|
38
|
+
// 1) Core CLI and MCP server artifacts
|
|
39
|
+
const requiredFiles = [
|
|
40
|
+
join(dist, 'integrations/mcp/server.js'),
|
|
41
|
+
join(dist, 'cli/index.js'),
|
|
42
|
+
join(dist, 'cli/codex-sm.js'),
|
|
43
|
+
join(dist, 'cli/codex-sm-danger.js'),
|
|
44
|
+
join(dist, 'cli/claude-sm.js'),
|
|
45
|
+
join(dist, 'cli/claude-sm-danger.js'),
|
|
46
|
+
];
|
|
47
|
+
requiredFiles.forEach(checkFile);
|
|
48
|
+
|
|
49
|
+
// 2) Bin launchers reference dist/src/* (ESM dynamic import)
|
|
50
|
+
fileContains('bin/codex-sm', "import('../dist/src/cli/codex-sm.js')");
|
|
51
|
+
fileContains('bin/codex-smd', "import('../dist/src/cli/codex-sm-danger.js')");
|
|
52
|
+
fileContains('bin/claude-sm', "import('../dist/src/cli/claude-sm.js')");
|
|
53
|
+
fileContains('bin/claude-smd', "import('../dist/src/cli/claude-sm-danger.js')");
|
|
54
|
+
|
|
55
|
+
// 3) package.json scripts point to correct paths
|
|
56
|
+
try {
|
|
57
|
+
const pkg = JSON.parse(readFileSync('package.json', 'utf8'));
|
|
58
|
+
const scripts = pkg.scripts || {};
|
|
59
|
+
const expectations = [
|
|
60
|
+
['start', 'dist/src/integrations/mcp/server.js'],
|
|
61
|
+
['start:full', 'dist/src/integrations/mcp/server.js'],
|
|
62
|
+
['mcp:start', 'dist/src/integrations/mcp/server.js'],
|
|
63
|
+
];
|
|
64
|
+
for (const [key, needle] of expectations) {
|
|
65
|
+
const val = scripts[key] || '';
|
|
66
|
+
if (!val.includes(needle)) {
|
|
67
|
+
fail(`scripts.${key} should reference ${needle}, found: ${val}`);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
} catch (e) {
|
|
71
|
+
fail(`Failed to validate package.json scripts: ${e.message}`);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (process.exitCode) {
|
|
75
|
+
console.error('\nOne or more checks failed. Run: npm run build');
|
|
76
|
+
console.error('Then re-run: npm run verify:dist');
|
|
77
|
+
} else {
|
|
78
|
+
console.log('verify-dist: OK');
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
main();
|
|
83
|
+
|