@agentbrain/mcp-server 1.4.34 → 1.4.35
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/index.js +10 -10
- package/dist/index.js.map +1 -1
- package/dist/tools/create-spec.d.ts +27 -76
- package/dist/tools/create-spec.d.ts.map +1 -1
- package/dist/tools/create-spec.js +45 -65
- package/dist/tools/create-spec.js.map +1 -1
- package/dist/tools/load-context.js +1 -1
- package/dist/tools/load-context.js.map +1 -1
- package/dist/tools/save-handoff.d.ts +27 -0
- package/dist/tools/save-handoff.d.ts.map +1 -1
- package/dist/tools/save-handoff.js +9 -33
- package/dist/tools/save-handoff.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6,10 +6,10 @@ import { CallToolRequestSchema, ListToolsRequestSchema, } from '@modelcontextpro
|
|
|
6
6
|
import { scanRepo, scanRepoSchema } from './tools/scan-repo.js';
|
|
7
7
|
import { loadStandards, loadStandardsSchema } from './tools/load-standards.js';
|
|
8
8
|
import { loadContext, loadContextSchema } from './tools/load-context.js';
|
|
9
|
-
import { saveHandoff, saveHandoffSchema } from './tools/save-handoff.js';
|
|
10
9
|
import { loadSpecTool, loadSpecSchema } from './tools/load-spec.js';
|
|
11
|
-
import { createSpecTool, createSpecSchema } from './tools/create-spec.js';
|
|
12
10
|
import { detectDoomLoop, detectDoomLoopSchema } from './tools/detect-doom-loop.js';
|
|
11
|
+
import { createSpecTool, createSpecSchema } from './tools/create-spec.js';
|
|
12
|
+
import { saveHandoff, saveHandoffSchema } from './tools/save-handoff.js';
|
|
13
13
|
// Create MCP server
|
|
14
14
|
const server = new Server({
|
|
15
15
|
name: 'agentbrain',
|
|
@@ -27,8 +27,8 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
27
27
|
loadStandardsSchema,
|
|
28
28
|
loadContextSchema,
|
|
29
29
|
loadSpecSchema,
|
|
30
|
-
createSpecSchema,
|
|
31
30
|
detectDoomLoopSchema,
|
|
31
|
+
createSpecSchema,
|
|
32
32
|
saveHandoffSchema,
|
|
33
33
|
],
|
|
34
34
|
};
|
|
@@ -74,24 +74,24 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
74
74
|
],
|
|
75
75
|
};
|
|
76
76
|
}
|
|
77
|
-
case '
|
|
78
|
-
const result = await
|
|
77
|
+
case 'detect_doom_loop': {
|
|
78
|
+
const result = await detectDoomLoop(args);
|
|
79
79
|
return {
|
|
80
80
|
content: [
|
|
81
81
|
{
|
|
82
82
|
type: 'text',
|
|
83
|
-
text:
|
|
83
|
+
text: JSON.stringify(result, null, 2),
|
|
84
84
|
},
|
|
85
85
|
],
|
|
86
86
|
};
|
|
87
87
|
}
|
|
88
|
-
case '
|
|
89
|
-
const result = await
|
|
88
|
+
case 'create_spec': {
|
|
89
|
+
const result = await createSpecTool(args);
|
|
90
90
|
return {
|
|
91
91
|
content: [
|
|
92
92
|
{
|
|
93
93
|
type: 'text',
|
|
94
|
-
text:
|
|
94
|
+
text: `Spec saved to ${result.specPath}\nSlug: ${result.slug}`,
|
|
95
95
|
},
|
|
96
96
|
],
|
|
97
97
|
};
|
|
@@ -102,7 +102,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
102
102
|
content: [
|
|
103
103
|
{
|
|
104
104
|
type: 'text',
|
|
105
|
-
text: `Handoff saved to ${result.filePath}
|
|
105
|
+
text: `Handoff saved to ${result.filePath}`,
|
|
106
106
|
},
|
|
107
107
|
],
|
|
108
108
|
};
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,wBAAwB;AAExB,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAA;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAA;AAChF,OAAO,EACL,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,oC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E,CAAC;QACf,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,CAAA;QACxE,OAAO;YACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,OAAO,EAAE,EAAE,CAAC;YACtD,OAAO,EAAE,IAAI;SACd,CAAA;IACH,CAAC;AACH,CAAC,CAAC,CAAA;AAEF,eAAe;AACf,KAAK,UAAU,IAAI;IACjB,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAA;IAC5C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;IAE/B,oEAAoE;IACpE,OAAO,CAAC,KAAK,CAAC,wCAAwC,CAAC,CAAA;AACzD,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,CAAA;IACpC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACjB,CAAC,CAAC,CAAA"}
|
|
@@ -1,82 +1,33 @@
|
|
|
1
|
-
|
|
1
|
+
export interface CreateSpecInput {
|
|
2
|
+
repoPath: string;
|
|
3
|
+
task: string;
|
|
4
|
+
content: string;
|
|
5
|
+
}
|
|
6
|
+
export interface CreateSpecOutput {
|
|
7
|
+
specPath: string;
|
|
8
|
+
slug: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function createSpecTool(input: CreateSpecInput): Promise<CreateSpecOutput>;
|
|
2
11
|
export declare const createSpecSchema: {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
};
|
|
20
|
-
readonly approach: {
|
|
21
|
-
readonly type: "string";
|
|
22
|
-
readonly description: "Your implementation approach or \"not sure yet\" if unknown";
|
|
23
|
-
};
|
|
24
|
-
readonly outOfScope: {
|
|
25
|
-
readonly type: "string";
|
|
26
|
-
readonly description: "What should NOT be touched or changed";
|
|
27
|
-
};
|
|
28
|
-
readonly doneCriteria: {
|
|
29
|
-
readonly type: "string";
|
|
30
|
-
readonly description: "What does \"done\" look like? (acceptance criteria)";
|
|
31
|
-
};
|
|
32
|
-
readonly risks: {
|
|
33
|
-
readonly type: "string";
|
|
34
|
-
readonly description: "Any edge cases or risks to consider";
|
|
35
|
-
};
|
|
36
|
-
readonly inject: {
|
|
37
|
-
readonly type: "boolean";
|
|
38
|
-
readonly description: "Inject spec reference into agent files (CLAUDE.md, .cursorrules, etc.) [default: true]";
|
|
12
|
+
name: string;
|
|
13
|
+
description: string;
|
|
14
|
+
inputSchema: {
|
|
15
|
+
type: string;
|
|
16
|
+
properties: {
|
|
17
|
+
repoPath: {
|
|
18
|
+
type: string;
|
|
19
|
+
description: string;
|
|
20
|
+
};
|
|
21
|
+
task: {
|
|
22
|
+
type: string;
|
|
23
|
+
description: string;
|
|
24
|
+
};
|
|
25
|
+
content: {
|
|
26
|
+
type: string;
|
|
27
|
+
description: string;
|
|
39
28
|
};
|
|
40
29
|
};
|
|
41
|
-
|
|
30
|
+
required: string[];
|
|
42
31
|
};
|
|
43
32
|
};
|
|
44
|
-
declare const inputSchema: z.ZodObject<{
|
|
45
|
-
repoPath: z.ZodString;
|
|
46
|
-
task: z.ZodString;
|
|
47
|
-
problem: z.ZodString;
|
|
48
|
-
approach: z.ZodOptional<z.ZodString>;
|
|
49
|
-
outOfScope: z.ZodOptional<z.ZodString>;
|
|
50
|
-
doneCriteria: z.ZodString;
|
|
51
|
-
risks: z.ZodOptional<z.ZodString>;
|
|
52
|
-
inject: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
53
|
-
}, "strip", z.ZodTypeAny, {
|
|
54
|
-
repoPath: string;
|
|
55
|
-
task: string;
|
|
56
|
-
problem: string;
|
|
57
|
-
doneCriteria: string;
|
|
58
|
-
inject: boolean;
|
|
59
|
-
approach?: string | undefined;
|
|
60
|
-
outOfScope?: string | undefined;
|
|
61
|
-
risks?: string | undefined;
|
|
62
|
-
}, {
|
|
63
|
-
repoPath: string;
|
|
64
|
-
task: string;
|
|
65
|
-
problem: string;
|
|
66
|
-
doneCriteria: string;
|
|
67
|
-
approach?: string | undefined;
|
|
68
|
-
outOfScope?: string | undefined;
|
|
69
|
-
risks?: string | undefined;
|
|
70
|
-
inject?: boolean | undefined;
|
|
71
|
-
}>;
|
|
72
|
-
export type CreateSpecInput = z.infer<typeof inputSchema>;
|
|
73
|
-
export declare function createSpecTool(input: CreateSpecInput): Promise<{
|
|
74
|
-
specPath: string;
|
|
75
|
-
slug: string;
|
|
76
|
-
content: string;
|
|
77
|
-
tokensUsed: number;
|
|
78
|
-
cost: number;
|
|
79
|
-
injected: boolean;
|
|
80
|
-
}>;
|
|
81
|
-
export {};
|
|
82
33
|
//# sourceMappingURL=create-spec.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-spec.d.ts","sourceRoot":"","sources":["../../src/tools/create-spec.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"create-spec.d.ts","sourceRoot":"","sources":["../../src/tools/create-spec.ts"],"names":[],"mappings":"AA2BA,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;CACb;AAED,wBAAsB,cAAc,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAoBtF;AAED,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;CAsB5B,CAAA"}
|
|
@@ -1,11 +1,46 @@
|
|
|
1
|
-
// create-spec.ts - MCP tool to
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
// create-spec.ts - MCP tool to save spec content (no AI generation)
|
|
2
|
+
import { writeFile, mkdir } from 'node:fs/promises';
|
|
3
|
+
import { existsSync } from 'node:fs';
|
|
4
|
+
import { join, resolve } from 'node:path';
|
|
5
|
+
import { homedir } from 'node:os';
|
|
6
|
+
/**
|
|
7
|
+
* Expand path: handles ~, relative paths, etc.
|
|
8
|
+
*/
|
|
9
|
+
function expandPath(path) {
|
|
10
|
+
if (path.startsWith('~/') || path === '~') {
|
|
11
|
+
return path.replace('~', homedir());
|
|
12
|
+
}
|
|
13
|
+
return resolve(path);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Convert task to slug format
|
|
17
|
+
*/
|
|
18
|
+
function slugify(text) {
|
|
19
|
+
return text
|
|
20
|
+
.toLowerCase()
|
|
21
|
+
.replace(/[^a-z0-9]+/g, '-')
|
|
22
|
+
.replace(/^-+|-+$/g, '');
|
|
23
|
+
}
|
|
24
|
+
export async function createSpecTool(input) {
|
|
25
|
+
const { repoPath, task, content } = input;
|
|
26
|
+
const expandedPath = expandPath(repoPath);
|
|
27
|
+
const slug = slugify(task);
|
|
28
|
+
// Ensure specs directory exists
|
|
29
|
+
const specsDir = join(expandedPath, '.agentbrain', 'specs');
|
|
30
|
+
if (!existsSync(specsDir)) {
|
|
31
|
+
await mkdir(specsDir, { recursive: true });
|
|
32
|
+
}
|
|
33
|
+
// Write spec file
|
|
34
|
+
const specPath = join(specsDir, `${slug}.md`);
|
|
35
|
+
await writeFile(specPath, content, 'utf-8');
|
|
36
|
+
return {
|
|
37
|
+
specPath: `.agentbrain/specs/${slug}.md`,
|
|
38
|
+
slug,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
6
41
|
export const createSpecSchema = {
|
|
7
42
|
name: 'create_spec',
|
|
8
|
-
description: '
|
|
43
|
+
description: 'Save a task specification to disk. The agent provides the spec content (already written), and this tool saves it to .agentbrain/specs/<slug>.md. No AI calls - pure file write.',
|
|
9
44
|
inputSchema: {
|
|
10
45
|
type: 'object',
|
|
11
46
|
properties: {
|
|
@@ -15,69 +50,14 @@ export const createSpecSchema = {
|
|
|
15
50
|
},
|
|
16
51
|
task: {
|
|
17
52
|
type: 'string',
|
|
18
|
-
description: '
|
|
19
|
-
},
|
|
20
|
-
problem: {
|
|
21
|
-
type: 'string',
|
|
22
|
-
description: 'What problem does this solve? (1-2 sentences)',
|
|
23
|
-
},
|
|
24
|
-
approach: {
|
|
25
|
-
type: 'string',
|
|
26
|
-
description: 'Your implementation approach or "not sure yet" if unknown',
|
|
53
|
+
description: 'Task name (will be slugified for filename)',
|
|
27
54
|
},
|
|
28
|
-
|
|
55
|
+
content: {
|
|
29
56
|
type: 'string',
|
|
30
|
-
description: '
|
|
31
|
-
},
|
|
32
|
-
doneCriteria: {
|
|
33
|
-
type: 'string',
|
|
34
|
-
description: 'What does "done" look like? (acceptance criteria)',
|
|
35
|
-
},
|
|
36
|
-
risks: {
|
|
37
|
-
type: 'string',
|
|
38
|
-
description: 'Any edge cases or risks to consider',
|
|
39
|
-
},
|
|
40
|
-
inject: {
|
|
41
|
-
type: 'boolean',
|
|
42
|
-
description: 'Inject spec reference into agent files (CLAUDE.md, .cursorrules, etc.) [default: true]',
|
|
57
|
+
description: 'Full spec content in markdown format (written by agent)',
|
|
43
58
|
},
|
|
44
59
|
},
|
|
45
|
-
required: ['repoPath', 'task', '
|
|
60
|
+
required: ['repoPath', 'task', 'content'],
|
|
46
61
|
},
|
|
47
62
|
};
|
|
48
|
-
const inputSchema = z.object({
|
|
49
|
-
repoPath: z.string(),
|
|
50
|
-
task: z.string(),
|
|
51
|
-
problem: z.string(),
|
|
52
|
-
approach: z.string().optional(),
|
|
53
|
-
outOfScope: z.string().optional(),
|
|
54
|
-
doneCriteria: z.string(),
|
|
55
|
-
risks: z.string().optional(),
|
|
56
|
-
inject: z.boolean().optional().default(true),
|
|
57
|
-
});
|
|
58
|
-
export async function createSpecTool(input) {
|
|
59
|
-
// Validate input
|
|
60
|
-
const validated = inputSchema.parse(input);
|
|
61
|
-
const repoPath = resolve(validated.repoPath);
|
|
62
|
-
// Load AI config (will use env vars or stored config)
|
|
63
|
-
const aiConfig = await loadAIConfig();
|
|
64
|
-
// Build answers object for spec generation
|
|
65
|
-
const answers = {
|
|
66
|
-
problem: validated.problem,
|
|
67
|
-
approach: validated.approach || 'not sure yet',
|
|
68
|
-
outOfScope: validated.outOfScope || 'none specified',
|
|
69
|
-
doneCriteria: validated.doneCriteria,
|
|
70
|
-
risks: validated.risks || 'none specified',
|
|
71
|
-
};
|
|
72
|
-
// Use core createSpec function (handles everything: generate, save, inject)
|
|
73
|
-
const result = await coreCreateSpec(validated.task, answers, repoPath, aiConfig);
|
|
74
|
-
return {
|
|
75
|
-
specPath: result.filePath.replace(repoPath, '').slice(1), // Relative path
|
|
76
|
-
slug: result.slug,
|
|
77
|
-
content: result.content,
|
|
78
|
-
tokensUsed: result.tokensUsed,
|
|
79
|
-
cost: result.cost,
|
|
80
|
-
injected: true, // coreCreateSpec always injects
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
63
|
//# sourceMappingURL=create-spec.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-spec.js","sourceRoot":"","sources":["../../src/tools/create-spec.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"create-spec.js","sourceRoot":"","sources":["../../src/tools/create-spec.ts"],"names":[],"mappings":"AAAA,oEAAoE;AAEpE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACzC,OAAO,EAAE,OA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,GAAG;IAC9B,IAAI,EAAE,aAAa;IACnB,WAAW,EACT,iLAAiL;IACnL,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,QAAQ,EAAE;gBACR,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,iCAAiC;aAC/C;YACD,IAAI,EAAE;gBACJ,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,4CAA4C;aAC1D;YACD,OAAO,EAAE;gBACP,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,yDAAyD;aACvE;SACF;QACD,QAAQ,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,CAAC;KAC1C;CACF,CAAA"}
|
|
@@ -96,7 +96,7 @@ export async function loadContext(input) {
|
|
|
96
96
|
}
|
|
97
97
|
export const loadContextSchema = {
|
|
98
98
|
name: 'load_context',
|
|
99
|
-
description: 'Load combined context documentation (context.md + dependency-map.md + patterns.md). Cached by git hash - repeat calls are free.',
|
|
99
|
+
description: 'Load combined context documentation (context.md + dependency-map.md + patterns.md). Reads from disk if files exist (no API key needed). Only generates new context if files missing (requires API key). Cached by git hash - repeat calls are free.',
|
|
100
100
|
inputSchema: {
|
|
101
101
|
type: 'object',
|
|
102
102
|
properties: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load-context.js","sourceRoot":"","sources":["../../src/tools/load-context.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAE9D,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EACL,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,UAAU,EACV,SAAS,EACT,oBAAoB,GAErB,MAAM,kBAAkB,CAAA;AAEzB;;GAEG;AACH,SA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Ac;IACpB,WAAW,EACT,qPAAqP;IACvP,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,SAAS,EAAE;gBACT,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,iCAAiC;aAC/C;YACD,aAAa,EAAE;gBACb,IAAI,EAAE,SAAS;gBACf,WAAW,EAAE,4DAA4D;aAC1E;SACF;QACD,QAAQ,EAAE,CAAC,WAAW,CAAC;KACxB;CACF,CAAA"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export interface SaveHandoffInput {
|
|
2
|
+
repo_path: string;
|
|
3
|
+
content: string;
|
|
4
|
+
}
|
|
5
|
+
export interface SaveHandoffOutput {
|
|
6
|
+
filePath: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function saveHandoff(input: SaveHandoffInput): Promise<SaveHandoffOutput>;
|
|
9
|
+
export declare const saveHandoffSchema: {
|
|
10
|
+
name: string;
|
|
11
|
+
description: string;
|
|
12
|
+
inputSchema: {
|
|
13
|
+
type: string;
|
|
14
|
+
properties: {
|
|
15
|
+
repo_path: {
|
|
16
|
+
type: string;
|
|
17
|
+
description: string;
|
|
18
|
+
};
|
|
19
|
+
content: {
|
|
20
|
+
type: string;
|
|
21
|
+
description: string;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
required: string[];
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=save-handoff.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"save-handoff.d.ts","sourceRoot":"","sources":["../../src/tools/save-handoff.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"save-handoff.d.ts","sourceRoot":"","sources":["../../src/tools/save-handoff.ts"],"names":[],"mappings":"AAiBA,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED,wBAAsB,WAAW,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAkBrF;AAED,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;CAkB7B,CAAA"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
// MCP tool
|
|
1
|
+
// save-handoff.ts - MCP tool to save handoff content (no AI generation)
|
|
2
2
|
import { writeFile, mkdir } from 'node:fs/promises';
|
|
3
3
|
import { existsSync } from 'node:fs';
|
|
4
4
|
import { join, resolve } from 'node:path';
|
|
5
5
|
import { homedir } from 'node:os';
|
|
6
|
-
import { loadAIConfig, generateHandoff, getPendingDoomForMCP } from '@agentbrain/core';
|
|
7
6
|
/**
|
|
8
7
|
* Expand path: handles ~, relative paths, etc.
|
|
9
8
|
*/
|
|
@@ -14,42 +13,23 @@ function expandPath(path) {
|
|
|
14
13
|
return resolve(path);
|
|
15
14
|
}
|
|
16
15
|
export async function saveHandoff(input) {
|
|
17
|
-
const { repo_path,
|
|
18
|
-
// Expand path to handle ~, relative paths, etc.
|
|
16
|
+
const { repo_path, content } = input;
|
|
19
17
|
const expandedPath = expandPath(repo_path);
|
|
20
|
-
//
|
|
21
|
-
const aiConfig = await loadAIConfig();
|
|
22
|
-
// Generate handoff
|
|
23
|
-
const result = await generateHandoff({
|
|
24
|
-
repoPath: expandedPath,
|
|
25
|
-
aiConfig,
|
|
26
|
-
goal,
|
|
27
|
-
commitCount: commit_count,
|
|
28
|
-
});
|
|
29
|
-
// Check for doom loop warnings
|
|
30
|
-
const doomWarning = await getPendingDoomForMCP(expandedPath);
|
|
31
|
-
// Append doom warning section if detected
|
|
32
|
-
let finalContent = result.doc.content;
|
|
33
|
-
if (doomWarning && doomWarning.detected) {
|
|
34
|
-
const doomSection = `\n\n## ⚠ Doom Loop Warning\n\nThe following files were modified repeatedly before this handoff. Investigate before continuing:\n${doomWarning.files.map((f) => `- ${f}`).join('\n')}\n`;
|
|
35
|
-
finalContent = result.doc.content + doomSection;
|
|
36
|
-
}
|
|
37
|
-
// Write to disk
|
|
18
|
+
// Ensure .agentbrain directory exists
|
|
38
19
|
const outputDir = join(expandedPath, '.agentbrain');
|
|
39
20
|
if (!existsSync(outputDir)) {
|
|
40
21
|
await mkdir(outputDir, { recursive: true });
|
|
41
22
|
}
|
|
23
|
+
// Write handoff file
|
|
42
24
|
const filePath = join(outputDir, 'handoff.md');
|
|
43
|
-
await writeFile(filePath,
|
|
25
|
+
await writeFile(filePath, content, 'utf-8');
|
|
44
26
|
return {
|
|
45
|
-
content: finalContent,
|
|
46
27
|
filePath: '.agentbrain/handoff.md',
|
|
47
|
-
tokensUsed: result.tokenCount,
|
|
48
28
|
};
|
|
49
29
|
}
|
|
50
30
|
export const saveHandoffSchema = {
|
|
51
31
|
name: 'save_handoff',
|
|
52
|
-
description: '
|
|
32
|
+
description: 'Save a session handoff document to disk. The agent provides the handoff content (already written), and this tool saves it to .agentbrain/handoff.md. No AI calls - pure file write.',
|
|
53
33
|
inputSchema: {
|
|
54
34
|
type: 'object',
|
|
55
35
|
properties: {
|
|
@@ -57,16 +37,12 @@ export const saveHandoffSchema = {
|
|
|
57
37
|
type: 'string',
|
|
58
38
|
description: 'Absolute path to the repository',
|
|
59
39
|
},
|
|
60
|
-
|
|
40
|
+
content: {
|
|
61
41
|
type: 'string',
|
|
62
|
-
description: '
|
|
63
|
-
},
|
|
64
|
-
commit_count: {
|
|
65
|
-
type: 'number',
|
|
66
|
-
description: 'Number of recent commits to include in the handoff (default: 5)',
|
|
42
|
+
description: 'Full handoff content in markdown format (written by agent)',
|
|
67
43
|
},
|
|
68
44
|
},
|
|
69
|
-
required: ['repo_path'],
|
|
45
|
+
required: ['repo_path', 'content'],
|
|
70
46
|
},
|
|
71
47
|
};
|
|
72
48
|
//# sourceMappingURL=save-handoff.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"save-handoff.js","sourceRoot":"","sources":["../../src/tools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