@memoraone/mcp 0.1.4 → 0.1.6
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.cjs +797 -0
- package/dist/index.cjs +797 -0
- package/package.json +11 -12
- package/dist/cli.js +0 -5
- package/dist/client/memoraClient.js +0 -58
- package/dist/config.js +0 -68
- package/dist/configUtils.js +0 -13
- package/dist/index.js +0 -265
- package/dist/runContext.js +0 -25
- package/dist/tools/askWithMemory.js +0 -12
- package/dist/tools/handlers/askWithMemory.js +0 -43
- package/dist/tools/handlers/listProjects.js +0 -4
- package/dist/tools/handlers/logChangeSummary.js +0 -48
- package/dist/tools/handlers/logCommand.js +0 -44
- package/dist/tools/handlers/logIntent.js +0 -46
- package/dist/tools/handlers/logToolResult.js +0 -48
- package/dist/tools/handlers/postEvent.js +0 -28
- package/dist/tools/handlers/setProject.js +0 -10
- package/dist/tools/listProjects.js +0 -1
- package/dist/tools/logChangeSummary.js +0 -16
- package/dist/tools/logCommand.js +0 -11
- package/dist/tools/logIntent.js +0 -9
- package/dist/tools/logToolResult.js +0 -13
- package/dist/tools/postEvent.js +0 -8
- package/dist/tools/setProject.js +0 -4
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
//packages/mcp/src/tools/handlers/logIntent.ts
|
|
2
|
-
import { z } from 'zod/v4';
|
|
3
|
-
import { generateRunId, getCurrentProjectId, setCurrentRunId } from '../../runContext.js';
|
|
4
|
-
import { config } from '../../config.js';
|
|
5
|
-
const logIntentInputSchema = z.object({
|
|
6
|
-
intent: z.enum(['task', 'decision']),
|
|
7
|
-
message: z.string().min(1),
|
|
8
|
-
context: z.record(z.string(), z.any()).optional(),
|
|
9
|
-
intent_source: z.string().optional().default('cursor_chat'),
|
|
10
|
-
run_id: z.string().min(1).optional(),
|
|
11
|
-
});
|
|
12
|
-
export async function handleLogIntent(client, args) {
|
|
13
|
-
const parsed = logIntentInputSchema.parse(args ?? {});
|
|
14
|
-
const projectId = getCurrentProjectId();
|
|
15
|
-
if (!projectId) {
|
|
16
|
-
throw new Error('No project selected. Use memora_list_projects and memora_set_project to select a project.');
|
|
17
|
-
}
|
|
18
|
-
const intent = parsed.intent;
|
|
19
|
-
const message = parsed.message.trim();
|
|
20
|
-
if (!message) {
|
|
21
|
-
throw new Error('message cannot be empty after trimming');
|
|
22
|
-
}
|
|
23
|
-
const intent_source = parsed.intent_source ?? 'cursor_chat';
|
|
24
|
-
const context = parsed.context;
|
|
25
|
-
const purpose = intent; // 'task' | 'decision'
|
|
26
|
-
const concept = purpose === 'task' ? 'concept:task' : 'concept:decision';
|
|
27
|
-
// Determine run_id: use provided or generate new one
|
|
28
|
-
const run_id = parsed.run_id ?? generateRunId();
|
|
29
|
-
// Set current run_id when purpose is task or decision
|
|
30
|
-
setCurrentRunId(run_id);
|
|
31
|
-
const body = {
|
|
32
|
-
kind: 'note',
|
|
33
|
-
actor: { type: config.agentType, name: config.agentName },
|
|
34
|
-
concept, // MUST be TOP-LEVEL so it populates timeline_events.concept
|
|
35
|
-
message,
|
|
36
|
-
metadata: {
|
|
37
|
-
source: config.source,
|
|
38
|
-
purpose, // 'task' | 'decision'
|
|
39
|
-
intent_source: intent_source ?? 'cursor_chat',
|
|
40
|
-
run_id,
|
|
41
|
-
...(context ? { context } : {}),
|
|
42
|
-
},
|
|
43
|
-
};
|
|
44
|
-
await client.post('/timeline/events', body, { projectId });
|
|
45
|
-
return { ok: true, run_id };
|
|
46
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
//packages/mcp/src/tools/handlers/logToolResult.ts
|
|
2
|
-
import { z } from 'zod/v4';
|
|
3
|
-
import { getCurrentProjectId, resolveRunId } from '../../runContext.js';
|
|
4
|
-
import { config } from '../../config.js';
|
|
5
|
-
const logToolResultInputSchema = z.object({
|
|
6
|
-
tool: z.string().min(1),
|
|
7
|
-
status: z.enum(['ok', 'error', 'partial']),
|
|
8
|
-
summary: z.string().min(1),
|
|
9
|
-
run_id: z.string().min(1).optional(),
|
|
10
|
-
duration_ms: z.number().int().nonnegative().optional(),
|
|
11
|
-
error_code: z.string().min(1).optional(),
|
|
12
|
-
error_message: z.string().min(1).optional(),
|
|
13
|
-
error_kind: z.enum(['infra', 'logic', 'auth', 'rate_limit', 'validation', 'unknown']).optional(),
|
|
14
|
-
stats: z.record(z.string(), z.any()).optional(),
|
|
15
|
-
});
|
|
16
|
-
export async function handleLogToolResult(client, args) {
|
|
17
|
-
const parsed = logToolResultInputSchema.parse(args ?? {});
|
|
18
|
-
const projectId = getCurrentProjectId();
|
|
19
|
-
if (!projectId) {
|
|
20
|
-
throw new Error('No project selected. Use memora_list_projects and memora_set_project to select a project.');
|
|
21
|
-
}
|
|
22
|
-
const { tool, status, summary, duration_ms, error_code, error_message, error_kind, stats } = parsed;
|
|
23
|
-
const message = summary.startsWith('RESULT:')
|
|
24
|
-
? summary
|
|
25
|
-
: `RESULT: ${tool} — ${status} — ${summary}`;
|
|
26
|
-
const run_id = resolveRunId(parsed.run_id);
|
|
27
|
-
const body = {
|
|
28
|
-
kind: 'note',
|
|
29
|
-
concept: 'concept:tool_result',
|
|
30
|
-
actor: { type: config.agentType, name: config.agentName },
|
|
31
|
-
message,
|
|
32
|
-
metadata: {
|
|
33
|
-
source: config.source,
|
|
34
|
-
purpose: 'tool_result',
|
|
35
|
-
tool: 'memora_log_tool_result',
|
|
36
|
-
tool_name: tool,
|
|
37
|
-
status,
|
|
38
|
-
...(run_id ? { run_id } : {}),
|
|
39
|
-
...(duration_ms ? { duration_ms } : {}),
|
|
40
|
-
...(error_code ? { error_code } : {}),
|
|
41
|
-
...(error_message ? { error_message } : {}),
|
|
42
|
-
...(error_kind ? { error_kind } : {}),
|
|
43
|
-
...(stats ? { stats } : {}),
|
|
44
|
-
},
|
|
45
|
-
};
|
|
46
|
-
await client.post('/timeline/events', body, { projectId });
|
|
47
|
-
return { ok: true };
|
|
48
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
//packages/mcp/src/tools/handlers/postEvent.ts
|
|
2
|
-
import { z } from 'zod/v4';
|
|
3
|
-
import { config } from '../../config.js';
|
|
4
|
-
import { getCurrentProjectId } from '../../runContext.js';
|
|
5
|
-
const postEventInputSchema = z.object({
|
|
6
|
-
kind: z.string().min(1),
|
|
7
|
-
actor: z.object({ identifier: z.string().min(1) }),
|
|
8
|
-
content: z.record(z.string(), z.any()),
|
|
9
|
-
metadata: z.record(z.string(), z.any()).optional(),
|
|
10
|
-
});
|
|
11
|
-
export async function handlePostEvent(client, args) {
|
|
12
|
-
const parsed = postEventInputSchema.parse(args ?? {});
|
|
13
|
-
const projectId = getCurrentProjectId();
|
|
14
|
-
if (!projectId) {
|
|
15
|
-
throw new Error('No project selected. Use memora_list_projects and memora_set_project to select a project.');
|
|
16
|
-
}
|
|
17
|
-
const body = {
|
|
18
|
-
kind: parsed.kind,
|
|
19
|
-
actor: { type: config.agentType, identifier: parsed.actor.identifier },
|
|
20
|
-
content: parsed.content,
|
|
21
|
-
metadata: {
|
|
22
|
-
source: config.source,
|
|
23
|
-
...parsed.metadata,
|
|
24
|
-
},
|
|
25
|
-
};
|
|
26
|
-
await client.post('/timeline/events', body, { projectId });
|
|
27
|
-
return { ok: true, forwarded: true };
|
|
28
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod/v4';
|
|
2
|
-
import { setCurrentProjectId } from '../../runContext.js';
|
|
3
|
-
const setProjectInputSchema = z.object({
|
|
4
|
-
projectId: z.string().min(1),
|
|
5
|
-
});
|
|
6
|
-
export async function handleSetProject(args) {
|
|
7
|
-
const parsed = setProjectInputSchema.parse(args ?? {});
|
|
8
|
-
setCurrentProjectId(parsed.projectId);
|
|
9
|
-
return { ok: true, projectId: parsed.projectId };
|
|
10
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const listProjectsShape = {};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
//memoraone/adapters/vscode-mcp/src/tools/logChangeSummary.ts
|
|
2
|
-
import { z } from 'zod/v4';
|
|
3
|
-
export const logChangeSummaryShape = {
|
|
4
|
-
summary: z.string().min(1),
|
|
5
|
-
scope: z.string().min(1).optional(),
|
|
6
|
-
files: z.array(z.string().min(1)).optional(),
|
|
7
|
-
stats: z
|
|
8
|
-
.object({
|
|
9
|
-
files: z.number().int().nonnegative().optional(),
|
|
10
|
-
add: z.number().int().nonnegative().optional(),
|
|
11
|
-
del: z.number().int().nonnegative().optional(),
|
|
12
|
-
})
|
|
13
|
-
.optional(),
|
|
14
|
-
commit: z.string().min(1).optional(),
|
|
15
|
-
run_id: z.string().min(1).optional(),
|
|
16
|
-
};
|
package/dist/tools/logCommand.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
//memoraone/adapters/vscode-mcp/src/tools/logCommand.ts
|
|
2
|
-
import { z } from 'zod/v4';
|
|
3
|
-
export const logCommandShape = {
|
|
4
|
-
cmd: z.string().min(1),
|
|
5
|
-
summary: z.string().min(1),
|
|
6
|
-
cwd: z.string().min(1).optional(),
|
|
7
|
-
exit_code: z.number().int().optional(),
|
|
8
|
-
duration_ms: z.number().int().nonnegative().optional(),
|
|
9
|
-
run_id: z.string().min(1).optional(),
|
|
10
|
-
stats: z.record(z.string(), z.any()).optional(),
|
|
11
|
-
};
|
package/dist/tools/logIntent.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
//memoraone/adapters/vscode-mcp/src/tools/logIntent.ts
|
|
2
|
-
import { z } from 'zod/v4';
|
|
3
|
-
export const logIntentShape = {
|
|
4
|
-
intent: z.enum(['task', 'decision']),
|
|
5
|
-
message: z.string().min(1),
|
|
6
|
-
context: z.record(z.string(), z.any()).optional(),
|
|
7
|
-
intent_source: z.string().optional().default('cursor_chat'),
|
|
8
|
-
run_id: z.string().min(1).optional(),
|
|
9
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
//memoraone/adapters/vscode-mcp/src/tools/logToolResult.ts
|
|
2
|
-
import { z } from 'zod/v4';
|
|
3
|
-
export const logToolResultShape = {
|
|
4
|
-
tool: z.string().min(1),
|
|
5
|
-
status: z.enum(['ok', 'error', 'partial']),
|
|
6
|
-
summary: z.string().min(1),
|
|
7
|
-
run_id: z.string().min(1).optional(),
|
|
8
|
-
duration_ms: z.number().int().nonnegative().optional(),
|
|
9
|
-
error_code: z.string().min(1).optional(),
|
|
10
|
-
error_message: z.string().min(1).optional(),
|
|
11
|
-
error_kind: z.enum(['infra', 'logic', 'auth', 'rate_limit', 'validation', 'unknown']).optional(),
|
|
12
|
-
stats: z.record(z.string(), z.any()).optional(),
|
|
13
|
-
};
|
package/dist/tools/postEvent.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
//memoraone/adapters/vscode-mcp/src/tools/postEvent.ts
|
|
2
|
-
import { z } from 'zod/v4';
|
|
3
|
-
export const postEventShape = {
|
|
4
|
-
kind: z.string().min(1),
|
|
5
|
-
actor: z.object({ identifier: z.string().min(1) }),
|
|
6
|
-
content: z.record(z.string(), z.any()),
|
|
7
|
-
metadata: z.record(z.string(), z.any()).optional(),
|
|
8
|
-
};
|
package/dist/tools/setProject.js
DELETED