agent-working-memory 0.6.0 → 0.7.0
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 +19 -9
- package/dist/adapters/claude-code.d.ts +4 -0
- package/dist/adapters/claude-code.d.ts.map +1 -0
- package/dist/adapters/claude-code.js +218 -0
- package/dist/adapters/claude-code.js.map +1 -0
- package/dist/adapters/codex.d.ts +4 -0
- package/dist/adapters/codex.d.ts.map +1 -0
- package/dist/adapters/codex.js +226 -0
- package/dist/adapters/codex.js.map +1 -0
- package/dist/adapters/common.d.ts +34 -0
- package/dist/adapters/common.d.ts.map +1 -0
- package/dist/adapters/common.js +145 -0
- package/dist/adapters/common.js.map +1 -0
- package/dist/adapters/cursor.d.ts +4 -0
- package/dist/adapters/cursor.d.ts.map +1 -0
- package/dist/adapters/cursor.js +138 -0
- package/dist/adapters/cursor.js.map +1 -0
- package/dist/adapters/http.d.ts +4 -0
- package/dist/adapters/http.d.ts.map +1 -0
- package/dist/adapters/http.js +88 -0
- package/dist/adapters/http.js.map +1 -0
- package/dist/adapters/index.d.ts +7 -0
- package/dist/adapters/index.d.ts.map +1 -0
- package/dist/adapters/index.js +21 -0
- package/dist/adapters/index.js.map +1 -0
- package/dist/adapters/types.d.ts +65 -0
- package/dist/adapters/types.d.ts.map +1 -0
- package/dist/adapters/types.js +4 -0
- package/dist/adapters/types.js.map +1 -0
- package/dist/api/routes.d.ts.map +1 -1
- package/dist/api/routes.js +1 -0
- package/dist/api/routes.js.map +1 -1
- package/dist/cli.js +104 -230
- package/dist/cli.js.map +1 -1
- package/dist/coordination/events.d.ts +59 -0
- package/dist/coordination/events.d.ts.map +1 -0
- package/dist/coordination/events.js +28 -0
- package/dist/coordination/events.js.map +1 -0
- package/dist/coordination/index.d.ts +10 -1
- package/dist/coordination/index.d.ts.map +1 -1
- package/dist/coordination/index.js +87 -3
- package/dist/coordination/index.js.map +1 -1
- package/dist/coordination/peer-decisions.d.ts +40 -0
- package/dist/coordination/peer-decisions.d.ts.map +1 -0
- package/dist/coordination/peer-decisions.js +82 -0
- package/dist/coordination/peer-decisions.js.map +1 -0
- package/dist/coordination/plugin-loader.d.ts +18 -0
- package/dist/coordination/plugin-loader.d.ts.map +1 -0
- package/dist/coordination/plugin-loader.js +55 -0
- package/dist/coordination/plugin-loader.js.map +1 -0
- package/dist/coordination/plugin.d.ts +40 -0
- package/dist/coordination/plugin.d.ts.map +1 -0
- package/dist/coordination/plugin.js +22 -0
- package/dist/coordination/plugin.js.map +1 -0
- package/dist/coordination/routes.d.ts +2 -1
- package/dist/coordination/routes.d.ts.map +1 -1
- package/dist/coordination/routes.js +899 -76
- package/dist/coordination/routes.js.map +1 -1
- package/dist/coordination/schema.d.ts.map +1 -1
- package/dist/coordination/schema.js +72 -14
- package/dist/coordination/schema.js.map +1 -1
- package/dist/coordination/schemas.d.ts +84 -3
- package/dist/coordination/schemas.d.ts.map +1 -1
- package/dist/coordination/schemas.js +71 -1
- package/dist/coordination/schemas.js.map +1 -1
- package/dist/coordination/stale.d.ts.map +1 -1
- package/dist/coordination/stale.js +2 -1
- package/dist/coordination/stale.js.map +1 -1
- package/dist/coordination/types.d.ts +252 -0
- package/dist/coordination/types.d.ts.map +1 -0
- package/dist/coordination/types.js +8 -0
- package/dist/coordination/types.js.map +1 -0
- package/dist/coordination/write-mutex.d.ts +26 -0
- package/dist/coordination/write-mutex.d.ts.map +1 -0
- package/dist/coordination/write-mutex.js +63 -0
- package/dist/coordination/write-mutex.js.map +1 -0
- package/dist/core/embeddings.d.ts +2 -0
- package/dist/core/embeddings.d.ts.map +1 -1
- package/dist/core/embeddings.js +4 -0
- package/dist/core/embeddings.js.map +1 -1
- package/dist/core/hebbian.d.ts +25 -1
- package/dist/core/hebbian.d.ts.map +1 -1
- package/dist/core/hebbian.js +71 -3
- package/dist/core/hebbian.js.map +1 -1
- package/dist/engine/activation.d.ts +22 -4
- package/dist/engine/activation.d.ts.map +1 -1
- package/dist/engine/activation.js +152 -76
- package/dist/engine/activation.js.map +1 -1
- package/dist/engine/consolidation.d.ts.map +1 -1
- package/dist/engine/consolidation.js +15 -6
- package/dist/engine/consolidation.js.map +1 -1
- package/dist/engine/retraction.d.ts +3 -1
- package/dist/engine/retraction.d.ts.map +1 -1
- package/dist/engine/retraction.js +19 -6
- package/dist/engine/retraction.js.map +1 -1
- package/dist/index.js +6 -18
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +61 -4
- package/dist/mcp.js.map +1 -1
- package/dist/storage/sqlite.d.ts +23 -1
- package/dist/storage/sqlite.d.ts.map +1 -1
- package/dist/storage/sqlite.js +112 -3
- package/dist/storage/sqlite.js.map +1 -1
- package/dist/types/engram.d.ts +1 -0
- package/dist/types/engram.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/adapters/claude-code.ts +234 -0
- package/src/adapters/codex.ts +262 -0
- package/src/adapters/common.ts +172 -0
- package/src/adapters/cursor.ts +150 -0
- package/src/adapters/http.ts +100 -0
- package/src/adapters/index.ts +31 -0
- package/src/adapters/types.ts +75 -0
- package/src/api/routes.ts +2 -0
- package/src/cli.ts +107 -238
- package/src/coordination/events.ts +90 -0
- package/src/coordination/index.ts +102 -3
- package/src/coordination/peer-decisions.ts +105 -0
- package/src/coordination/plugin-loader.ts +60 -0
- package/src/coordination/plugin.ts +44 -0
- package/src/coordination/routes.ts +1176 -105
- package/src/coordination/schema.ts +67 -14
- package/src/coordination/schemas.ts +85 -1
- package/src/coordination/stale.ts +3 -2
- package/src/coordination/types.ts +311 -0
- package/src/coordination/write-mutex.ts +69 -0
- package/src/core/embeddings.ts +5 -0
- package/src/core/hebbian.ts +84 -3
- package/src/engine/activation.ts +149 -73
- package/src/engine/consolidation.ts +15 -6
- package/src/engine/retraction.ts +22 -6
- package/src/index.ts +6 -15
- package/src/mcp.ts +77 -4
- package/src/storage/sqlite.ts +116 -3
- package/src/types/engram.ts +1 -0
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
// Copyright 2026 Robert Winter / Complete Ideas
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Cursor adapter — writes .cursor/mcp.json and .cursorrules.
|
|
6
|
+
*
|
|
7
|
+
* Cursor uses the same MCP config format as Claude Code (JSON with mcpServers).
|
|
8
|
+
* Instructions go in .cursorrules (project) or ~/.cursor/rules (global).
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { readFileSync, writeFileSync, mkdirSync, existsSync } from 'node:fs';
|
|
12
|
+
import { join, dirname, basename } from 'node:path';
|
|
13
|
+
import type { CLIAdapter, SetupContext, DiagnosticResult } from './types.js';
|
|
14
|
+
import { resolveMcpCommand, homedir, AWM_INSTRUCTION_CONTENT } from './common.js';
|
|
15
|
+
|
|
16
|
+
const adapter: CLIAdapter = {
|
|
17
|
+
id: 'cursor',
|
|
18
|
+
name: 'Cursor',
|
|
19
|
+
supportsProjectScope: true,
|
|
20
|
+
supportsGlobalScope: true,
|
|
21
|
+
|
|
22
|
+
writeMcpConfig(ctx: SetupContext): string {
|
|
23
|
+
const mcpCmd = resolveMcpCommand(ctx);
|
|
24
|
+
const mcpConfig = { ...mcpCmd, env: ctx.envVars };
|
|
25
|
+
|
|
26
|
+
const mcpJsonPath = ctx.isGlobal
|
|
27
|
+
? join(homedir(), '.cursor', 'mcp.json')
|
|
28
|
+
: join(ctx.cwd, '.cursor', 'mcp.json');
|
|
29
|
+
|
|
30
|
+
const mcpDir = dirname(mcpJsonPath);
|
|
31
|
+
if (!existsSync(mcpDir)) {
|
|
32
|
+
mkdirSync(mcpDir, { recursive: true });
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
let existing: any = { mcpServers: {} };
|
|
36
|
+
if (existsSync(mcpJsonPath)) {
|
|
37
|
+
try {
|
|
38
|
+
existing = JSON.parse(readFileSync(mcpJsonPath, 'utf-8'));
|
|
39
|
+
if (!existing.mcpServers) existing.mcpServers = {};
|
|
40
|
+
} catch {
|
|
41
|
+
existing = { mcpServers: {} };
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
existing.mcpServers['agent-working-memory'] = mcpConfig;
|
|
46
|
+
writeFileSync(mcpJsonPath, JSON.stringify(existing, null, 2) + '\n');
|
|
47
|
+
return `MCP config: ${mcpJsonPath}`;
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
writeInstructions(ctx: SetupContext, skip: boolean): string {
|
|
51
|
+
const rulesPath = ctx.isGlobal
|
|
52
|
+
? join(homedir(), '.cursor', 'rules')
|
|
53
|
+
: join(ctx.cwd, '.cursorrules');
|
|
54
|
+
|
|
55
|
+
if (skip) return '.cursorrules: skipped (--no-instructions)';
|
|
56
|
+
|
|
57
|
+
const dir = dirname(rulesPath);
|
|
58
|
+
if (!existsSync(dir)) {
|
|
59
|
+
mkdirSync(dir, { recursive: true });
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (existsSync(rulesPath)) {
|
|
63
|
+
const content = readFileSync(rulesPath, 'utf-8');
|
|
64
|
+
if (content.includes('## Memory (AWM)')) {
|
|
65
|
+
return '.cursorrules: already has AWM section (skipped)';
|
|
66
|
+
}
|
|
67
|
+
writeFileSync(rulesPath, content.trimEnd() + '\n\n' + AWM_INSTRUCTION_CONTENT);
|
|
68
|
+
return '.cursorrules: appended AWM workflow section';
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
writeFileSync(rulesPath, AWM_INSTRUCTION_CONTENT);
|
|
72
|
+
return '.cursorrules: created with AWM workflow section';
|
|
73
|
+
},
|
|
74
|
+
|
|
75
|
+
writeHooks(_ctx: SetupContext, _skip: boolean): string {
|
|
76
|
+
return 'Hooks: not supported by Cursor (auto-checkpoint unavailable)';
|
|
77
|
+
},
|
|
78
|
+
|
|
79
|
+
diagnose(ctx: SetupContext): DiagnosticResult[] {
|
|
80
|
+
const results: DiagnosticResult[] = [];
|
|
81
|
+
|
|
82
|
+
// Check MCP config
|
|
83
|
+
const mcpJsonPath = ctx.isGlobal
|
|
84
|
+
? join(homedir(), '.cursor', 'mcp.json')
|
|
85
|
+
: join(ctx.cwd, '.cursor', 'mcp.json');
|
|
86
|
+
|
|
87
|
+
if (!existsSync(mcpJsonPath)) {
|
|
88
|
+
results.push({
|
|
89
|
+
check: 'MCP config',
|
|
90
|
+
status: 'fail',
|
|
91
|
+
message: `${mcpJsonPath} not found`,
|
|
92
|
+
fix: `Run: awm setup cursor${ctx.isGlobal ? ' --global' : ''}`,
|
|
93
|
+
});
|
|
94
|
+
} else {
|
|
95
|
+
try {
|
|
96
|
+
const config = JSON.parse(readFileSync(mcpJsonPath, 'utf-8'));
|
|
97
|
+
if (config.mcpServers?.['agent-working-memory']) {
|
|
98
|
+
results.push({ check: 'MCP config', status: 'ok', message: `AWM registered in ${mcpJsonPath}` });
|
|
99
|
+
} else {
|
|
100
|
+
results.push({
|
|
101
|
+
check: 'MCP config',
|
|
102
|
+
status: 'fail',
|
|
103
|
+
message: `${mcpJsonPath} exists but missing agent-working-memory entry`,
|
|
104
|
+
fix: `Run: awm setup cursor${ctx.isGlobal ? ' --global' : ''}`,
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
} catch {
|
|
108
|
+
results.push({ check: 'MCP config', status: 'fail', message: `${mcpJsonPath} is not valid JSON` });
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// Check entrypoint
|
|
113
|
+
if (ctx.hasDist) {
|
|
114
|
+
results.push({ check: 'MCP entrypoint', status: 'ok', message: 'dist/mcp.js exists' });
|
|
115
|
+
} else {
|
|
116
|
+
results.push({
|
|
117
|
+
check: 'MCP entrypoint',
|
|
118
|
+
status: 'warn',
|
|
119
|
+
message: 'dist/mcp.js not found — using dev mode',
|
|
120
|
+
fix: 'Run: npm run build',
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// Check database
|
|
125
|
+
if (existsSync(ctx.dbPath)) {
|
|
126
|
+
results.push({ check: 'Database', status: 'ok', message: ctx.dbPath });
|
|
127
|
+
} else {
|
|
128
|
+
results.push({ check: 'Database', status: 'warn', message: `${ctx.dbPath} not found` });
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// Check instructions
|
|
132
|
+
const rulesPath = ctx.isGlobal
|
|
133
|
+
? join(homedir(), '.cursor', 'rules')
|
|
134
|
+
: join(ctx.cwd, '.cursorrules');
|
|
135
|
+
if (existsSync(rulesPath)) {
|
|
136
|
+
const content = readFileSync(rulesPath, 'utf-8');
|
|
137
|
+
if (content.includes('## Memory (AWM)')) {
|
|
138
|
+
results.push({ check: 'Instructions', status: 'ok', message: '.cursorrules has AWM section' });
|
|
139
|
+
} else {
|
|
140
|
+
results.push({ check: 'Instructions', status: 'warn', message: '.cursorrules exists but missing AWM section' });
|
|
141
|
+
}
|
|
142
|
+
} else {
|
|
143
|
+
results.push({ check: 'Instructions', status: 'warn', message: '.cursorrules not found' });
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
return results;
|
|
147
|
+
},
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
export default adapter;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
// Copyright 2026 Robert Winter / Complete Ideas
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* HTTP adapter — generic fallback for any tool that can make REST calls.
|
|
6
|
+
*
|
|
7
|
+
* Doesn't write MCP config. Prints connection instructions for the HTTP API.
|
|
8
|
+
* Optionally writes an instruction file.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { readFileSync, writeFileSync, existsSync } from 'node:fs';
|
|
12
|
+
import { join } from 'node:path';
|
|
13
|
+
import type { CLIAdapter, SetupContext, DiagnosticResult } from './types.js';
|
|
14
|
+
import { AWM_INSTRUCTION_CONTENT } from './common.js';
|
|
15
|
+
|
|
16
|
+
const HTTP_ADDENDUM = `
|
|
17
|
+
### HTTP API (for tools without MCP support)
|
|
18
|
+
|
|
19
|
+
If your tool doesn't support MCP, use the HTTP API directly:
|
|
20
|
+
|
|
21
|
+
**Base URL:** \`http://127.0.0.1:8400\`
|
|
22
|
+
|
|
23
|
+
| Method | Endpoint | Purpose |
|
|
24
|
+
|--------|----------|---------|
|
|
25
|
+
| GET | /memory/restore/:agentId | Restore context from prior sessions |
|
|
26
|
+
| POST | /memory/activate | Cognitive recall (use \`context\` field) |
|
|
27
|
+
| POST | /memory/write | Write a memory |
|
|
28
|
+
| POST | /memory/feedback | Report if memory was useful |
|
|
29
|
+
| POST | /memory/retract | Invalidate a wrong memory |
|
|
30
|
+
| POST | /memory/checkpoint | Save execution state |
|
|
31
|
+
| POST | /task/create | Create a task |
|
|
32
|
+
| POST | /task/update | Update task status |
|
|
33
|
+
| GET | /task/list/:agentId | List tasks |
|
|
34
|
+
| GET | /task/next/:agentId | Get next actionable task |
|
|
35
|
+
| GET | /health | Health check |
|
|
36
|
+
|
|
37
|
+
Start the server with: \`awm serve\`
|
|
38
|
+
`;
|
|
39
|
+
|
|
40
|
+
const adapter: CLIAdapter = {
|
|
41
|
+
id: 'http',
|
|
42
|
+
name: 'HTTP (generic)',
|
|
43
|
+
supportsProjectScope: true,
|
|
44
|
+
supportsGlobalScope: false,
|
|
45
|
+
|
|
46
|
+
writeMcpConfig(ctx: SetupContext): string {
|
|
47
|
+
const port = process.env.AWM_PORT ?? '8400';
|
|
48
|
+
return `MCP config: N/A (HTTP mode)\n Start server: awm serve --port ${port}\n Base URL: http://127.0.0.1:${port}`;
|
|
49
|
+
},
|
|
50
|
+
|
|
51
|
+
writeInstructions(ctx: SetupContext, skip: boolean): string {
|
|
52
|
+
const instrPath = join(ctx.cwd, 'AWM-INSTRUCTIONS.md');
|
|
53
|
+
|
|
54
|
+
if (skip) return 'AWM-INSTRUCTIONS.md: skipped (--no-instructions)';
|
|
55
|
+
|
|
56
|
+
if (existsSync(instrPath)) {
|
|
57
|
+
const content = readFileSync(instrPath, 'utf-8');
|
|
58
|
+
if (content.includes('## Memory (AWM)')) {
|
|
59
|
+
return 'AWM-INSTRUCTIONS.md: already has AWM section (skipped)';
|
|
60
|
+
}
|
|
61
|
+
writeFileSync(instrPath, content.trimEnd() + '\n\n' + AWM_INSTRUCTION_CONTENT + HTTP_ADDENDUM);
|
|
62
|
+
return 'AWM-INSTRUCTIONS.md: appended AWM + HTTP API section';
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
writeFileSync(instrPath, `# Agent Working Memory\n\n${AWM_INSTRUCTION_CONTENT}${HTTP_ADDENDUM}`);
|
|
66
|
+
return 'AWM-INSTRUCTIONS.md: created with AWM + HTTP API section';
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
writeHooks(_ctx: SetupContext, _skip: boolean): string {
|
|
70
|
+
return 'Hooks: N/A (HTTP mode)';
|
|
71
|
+
},
|
|
72
|
+
|
|
73
|
+
diagnose(ctx: SetupContext): DiagnosticResult[] {
|
|
74
|
+
const results: DiagnosticResult[] = [];
|
|
75
|
+
|
|
76
|
+
// Check database
|
|
77
|
+
if (existsSync(ctx.dbPath)) {
|
|
78
|
+
results.push({ check: 'Database', status: 'ok', message: ctx.dbPath });
|
|
79
|
+
} else {
|
|
80
|
+
results.push({ check: 'Database', status: 'warn', message: `${ctx.dbPath} not found` });
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// Check if HTTP server is reachable
|
|
84
|
+
// (can't do async in diagnose, so just check if the entrypoint exists)
|
|
85
|
+
if (ctx.hasDist) {
|
|
86
|
+
results.push({ check: 'Server entrypoint', status: 'ok', message: 'dist/index.js exists' });
|
|
87
|
+
} else {
|
|
88
|
+
results.push({
|
|
89
|
+
check: 'Server entrypoint',
|
|
90
|
+
status: 'warn',
|
|
91
|
+
message: 'dist/index.js not found — use: npx tsx src/index.ts',
|
|
92
|
+
fix: 'Run: npm run build',
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return results;
|
|
97
|
+
},
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
export default adapter;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// Copyright 2026 Robert Winter / Complete Ideas
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Adapter registry — lazy-loads adapters by ID.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type { CLIAdapter } from './types.js';
|
|
9
|
+
|
|
10
|
+
const adapters = new Map<string, () => Promise<CLIAdapter>>();
|
|
11
|
+
|
|
12
|
+
adapters.set('claude-code', () => import('./claude-code.js').then(m => m.default));
|
|
13
|
+
adapters.set('codex', () => import('./codex.js').then(m => m.default));
|
|
14
|
+
adapters.set('cursor', () => import('./cursor.js').then(m => m.default));
|
|
15
|
+
adapters.set('http', () => import('./http.js').then(m => m.default));
|
|
16
|
+
|
|
17
|
+
// Aliases
|
|
18
|
+
adapters.set('claude', () => import('./claude-code.js').then(m => m.default));
|
|
19
|
+
|
|
20
|
+
export function listAdapters(): string[] {
|
|
21
|
+
return ['claude-code', 'codex', 'cursor', 'http'];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export async function getAdapter(id: string): Promise<CLIAdapter> {
|
|
25
|
+
const factory = adapters.get(id);
|
|
26
|
+
if (!factory) {
|
|
27
|
+
const valid = listAdapters().join(', ');
|
|
28
|
+
throw new Error(`Unknown target: "${id}". Valid targets: ${valid}`);
|
|
29
|
+
}
|
|
30
|
+
return factory();
|
|
31
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// Copyright 2026 Robert Winter / Complete Ideas
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Shared types for CLI adapters.
|
|
6
|
+
*
|
|
7
|
+
* Each AI CLI tool (Claude Code, Codex, Cursor, etc.) gets its own adapter
|
|
8
|
+
* that implements CLIAdapter. The setup orchestrator in cli.ts delegates to
|
|
9
|
+
* the selected adapter.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
export interface SetupContext {
|
|
13
|
+
/** Current working directory */
|
|
14
|
+
cwd: string;
|
|
15
|
+
/** Lowercase project name derived from cwd */
|
|
16
|
+
projectName: string;
|
|
17
|
+
/** Agent identifier for AWM */
|
|
18
|
+
agentId: string;
|
|
19
|
+
/** Absolute path to the SQLite database */
|
|
20
|
+
dbPath: string;
|
|
21
|
+
/** Absolute path to the AWM package root */
|
|
22
|
+
packageRoot: string;
|
|
23
|
+
/** Absolute path to dist/mcp.js (compiled entrypoint) */
|
|
24
|
+
mcpDist: string;
|
|
25
|
+
/** Absolute path to src/mcp.ts (dev entrypoint) */
|
|
26
|
+
mcpScript: string;
|
|
27
|
+
/** Whether dist/mcp.js exists (determines command strategy) */
|
|
28
|
+
hasDist: boolean;
|
|
29
|
+
/** Hook sidecar secret token */
|
|
30
|
+
hookSecret: string;
|
|
31
|
+
/** Hook sidecar port */
|
|
32
|
+
hookPort: string;
|
|
33
|
+
/** Whether to use global scope */
|
|
34
|
+
isGlobal: boolean;
|
|
35
|
+
/** Windows platform */
|
|
36
|
+
isWindows: boolean;
|
|
37
|
+
/** Pre-built environment variables for the MCP server */
|
|
38
|
+
envVars: Record<string, string>;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface SetupResult {
|
|
42
|
+
configAction: string;
|
|
43
|
+
instructionsAction: string;
|
|
44
|
+
hooksAction: string;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export interface DiagnosticResult {
|
|
48
|
+
check: string;
|
|
49
|
+
status: 'ok' | 'warn' | 'fail';
|
|
50
|
+
message: string;
|
|
51
|
+
fix?: string;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export interface CLIAdapter {
|
|
55
|
+
/** Short identifier: 'claude-code', 'codex', 'cursor', 'http' */
|
|
56
|
+
id: string;
|
|
57
|
+
/** Display name for output */
|
|
58
|
+
name: string;
|
|
59
|
+
/** Does this adapter support project-level scope? */
|
|
60
|
+
supportsProjectScope: boolean;
|
|
61
|
+
/** Does this adapter support global scope? */
|
|
62
|
+
supportsGlobalScope: boolean;
|
|
63
|
+
|
|
64
|
+
/** Write the MCP server config for this CLI. Returns action summary. */
|
|
65
|
+
writeMcpConfig(ctx: SetupContext): string;
|
|
66
|
+
|
|
67
|
+
/** Write/append instruction content. Returns action summary. */
|
|
68
|
+
writeInstructions(ctx: SetupContext, skip: boolean): string;
|
|
69
|
+
|
|
70
|
+
/** Configure hooks (if supported). Returns action summary. */
|
|
71
|
+
writeHooks(ctx: SetupContext, skip: boolean): string;
|
|
72
|
+
|
|
73
|
+
/** Validate that the setup is healthy. */
|
|
74
|
+
diagnose(ctx: SetupContext): DiagnosticResult[];
|
|
75
|
+
}
|
package/src/api/routes.ts
CHANGED
|
@@ -170,6 +170,7 @@ export function registerRoutes(app: FastifyInstance, deps: MemoryDeps): void {
|
|
|
170
170
|
useReranker?: boolean;
|
|
171
171
|
useExpansion?: boolean;
|
|
172
172
|
abstentionThreshold?: number;
|
|
173
|
+
workspace?: string;
|
|
173
174
|
};
|
|
174
175
|
|
|
175
176
|
const results = await activationEngine.activate({
|
|
@@ -181,6 +182,7 @@ export function registerRoutes(app: FastifyInstance, deps: MemoryDeps): void {
|
|
|
181
182
|
useReranker: body.useReranker,
|
|
182
183
|
useExpansion: body.useExpansion,
|
|
183
184
|
abstentionThreshold: body.abstentionThreshold,
|
|
185
|
+
workspace: body.workspace,
|
|
184
186
|
});
|
|
185
187
|
|
|
186
188
|
// Auto-checkpoint: track recall for consolidation scheduling
|