@gwdn/nexus-mcp 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/.github/workflows/ci.yml +38 -0
- package/.github/workflows/release.yml +57 -0
- package/README.md +89 -0
- package/dist/auth.d.ts +39 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.js +47 -0
- package/dist/auth.js.map +1 -0
- package/dist/nexus-api.d.ts +35 -0
- package/dist/nexus-api.d.ts.map +1 -0
- package/dist/nexus-api.js +90 -0
- package/dist/nexus-api.js.map +1 -0
- package/dist/server.d.ts +67 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +189 -0
- package/dist/server.js.map +1 -0
- package/dist/tools/add-task-note.d.ts +34 -0
- package/dist/tools/add-task-note.d.ts.map +1 -0
- package/dist/tools/add-task-note.js +39 -0
- package/dist/tools/add-task-note.js.map +1 -0
- package/dist/tools/append-session-entry.d.ts +53 -0
- package/dist/tools/append-session-entry.d.ts.map +1 -0
- package/dist/tools/append-session-entry.js +68 -0
- package/dist/tools/append-session-entry.js.map +1 -0
- package/dist/tools/create-task.d.ts +52 -0
- package/dist/tools/create-task.d.ts.map +1 -0
- package/dist/tools/create-task.js +51 -0
- package/dist/tools/create-task.js.map +1 -0
- package/dist/tools/decision-comments.d.ts +54 -0
- package/dist/tools/decision-comments.d.ts.map +1 -0
- package/dist/tools/decision-comments.js +81 -0
- package/dist/tools/decision-comments.js.map +1 -0
- package/dist/tools/get-document.d.ts +47 -0
- package/dist/tools/get-document.d.ts.map +1 -0
- package/dist/tools/get-document.js +68 -0
- package/dist/tools/get-document.js.map +1 -0
- package/dist/tools/get-project-memory.d.ts +47 -0
- package/dist/tools/get-project-memory.d.ts.map +1 -0
- package/dist/tools/get-project-memory.js +53 -0
- package/dist/tools/get-project-memory.js.map +1 -0
- package/dist/tools/get-related-entities.d.ts +44 -0
- package/dist/tools/get-related-entities.d.ts.map +1 -0
- package/dist/tools/get-related-entities.js +60 -0
- package/dist/tools/get-related-entities.js.map +1 -0
- package/dist/tools/governance.d.ts +90 -0
- package/dist/tools/governance.d.ts.map +1 -0
- package/dist/tools/governance.js +127 -0
- package/dist/tools/governance.js.map +1 -0
- package/dist/tools/ingest-document.d.ts +40 -0
- package/dist/tools/ingest-document.d.ts.map +1 -0
- package/dist/tools/ingest-document.js +49 -0
- package/dist/tools/ingest-document.js.map +1 -0
- package/dist/tools/letter-inbox.d.ts +80 -0
- package/dist/tools/letter-inbox.d.ts.map +1 -0
- package/dist/tools/letter-inbox.js +118 -0
- package/dist/tools/letter-inbox.js.map +1 -0
- package/dist/tools/letters.d.ts +91 -0
- package/dist/tools/letters.d.ts.map +1 -0
- package/dist/tools/letters.js +112 -0
- package/dist/tools/letters.js.map +1 -0
- package/dist/tools/list-documents.d.ts +33 -0
- package/dist/tools/list-documents.d.ts.map +1 -0
- package/dist/tools/list-documents.js +47 -0
- package/dist/tools/list-documents.js.map +1 -0
- package/dist/tools/list-tasks.d.ts +39 -0
- package/dist/tools/list-tasks.d.ts.map +1 -0
- package/dist/tools/list-tasks.js +46 -0
- package/dist/tools/list-tasks.js.map +1 -0
- package/dist/tools/project-list.d.ts +28 -0
- package/dist/tools/project-list.d.ts.map +1 -0
- package/dist/tools/project-list.js +43 -0
- package/dist/tools/project-list.js.map +1 -0
- package/dist/tools/reviews.d.ts +145 -0
- package/dist/tools/reviews.d.ts.map +1 -0
- package/dist/tools/reviews.js +220 -0
- package/dist/tools/reviews.js.map +1 -0
- package/dist/tools/search-knowledge.d.ts +48 -0
- package/dist/tools/search-knowledge.d.ts.map +1 -0
- package/dist/tools/search-knowledge.js +54 -0
- package/dist/tools/search-knowledge.js.map +1 -0
- package/dist/tools/sessions.d.ts +81 -0
- package/dist/tools/sessions.d.ts.map +1 -0
- package/dist/tools/sessions.js +123 -0
- package/dist/tools/sessions.js.map +1 -0
- package/dist/tools/skill-assign.d.ts +77 -0
- package/dist/tools/skill-assign.d.ts.map +1 -0
- package/dist/tools/skill-assign.js +108 -0
- package/dist/tools/skill-assign.js.map +1 -0
- package/dist/tools/skills.d.ts +138 -0
- package/dist/tools/skills.d.ts.map +1 -0
- package/dist/tools/skills.js +195 -0
- package/dist/tools/skills.js.map +1 -0
- package/dist/tools/update-task-status.d.ts +48 -0
- package/dist/tools/update-task-status.d.ts.map +1 -0
- package/dist/tools/update-task-status.js +51 -0
- package/dist/tools/update-task-status.js.map +1 -0
- package/package.json +30 -0
- package/src/__tests__/auth.test.ts +162 -0
- package/src/__tests__/decision-comments.test.ts +173 -0
- package/src/__tests__/e2e-integration.test.ts +443 -0
- package/src/__tests__/helpers.ts +58 -0
- package/src/__tests__/layer1-knowledge.test.ts +302 -0
- package/src/__tests__/layer2-coordination.test.ts +842 -0
- package/src/__tests__/layer3-governance.test.ts +205 -0
- package/src/__tests__/project-list-and-skill-assign.test.ts +282 -0
- package/src/__tests__/reviews.test.ts +420 -0
- package/src/__tests__/server.test.ts +250 -0
- package/src/__tests__/setup.ts +15 -0
- package/src/__tests__/task-list-and-doc-list.test.ts +226 -0
- package/src/auth.ts +81 -0
- package/src/nexus-api.ts +127 -0
- package/src/server.ts +520 -0
- package/src/tools/add-task-note.ts +50 -0
- package/src/tools/append-session-entry.ts +84 -0
- package/src/tools/create-task.ts +66 -0
- package/src/tools/decision-comments.ts +103 -0
- package/src/tools/get-document.ts +80 -0
- package/src/tools/get-project-memory.ts +65 -0
- package/src/tools/get-related-entities.ts +73 -0
- package/src/tools/governance.ts +165 -0
- package/src/tools/ingest-document.ts +65 -0
- package/src/tools/letter-inbox.ts +157 -0
- package/src/tools/letters.ts +144 -0
- package/src/tools/list-documents.ts +58 -0
- package/src/tools/list-tasks.ts +57 -0
- package/src/tools/project-list.ts +52 -0
- package/src/tools/reviews.ts +281 -0
- package/src/tools/search-knowledge.ts +68 -0
- package/src/tools/sessions.ts +157 -0
- package/src/tools/skill-assign.ts +142 -0
- package/src/tools/skills.ts +255 -0
- package/src/tools/update-task-status.ts +64 -0
- package/tsconfig.json +20 -0
- package/vitest.config.ts +8 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Decision comment tools -- Layer 2 Coordination
|
|
3
|
+
*
|
|
4
|
+
* Provides append-only comment threads for ADR decisions.
|
|
5
|
+
* Delegates to POST /api/mcp/governance (actions: dc_add, dc_list).
|
|
6
|
+
*/
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
import { nexusPost } from '../nexus-api.js';
|
|
9
|
+
// ---------------------------------------------------------------------------
|
|
10
|
+
// add_decision_comment -> dc_add
|
|
11
|
+
// ---------------------------------------------------------------------------
|
|
12
|
+
export const addDecisionCommentSchema = {
|
|
13
|
+
decision_id: z.string().uuid().describe('Decision UUID to comment on'),
|
|
14
|
+
body: z.string().max(100_000).describe('Comment body (markdown supported)'),
|
|
15
|
+
agent_id: z
|
|
16
|
+
.string()
|
|
17
|
+
.max(200)
|
|
18
|
+
.optional()
|
|
19
|
+
.describe('Agent identifier if comment is posted by an agent'),
|
|
20
|
+
};
|
|
21
|
+
export async function addDecisionComment(args) {
|
|
22
|
+
const result = await nexusPost('/api/mcp/governance', {
|
|
23
|
+
action: 'dc_add',
|
|
24
|
+
decision_id: args.decision_id,
|
|
25
|
+
body: args.body,
|
|
26
|
+
agent_id: args.agent_id,
|
|
27
|
+
});
|
|
28
|
+
if (!result.ok) {
|
|
29
|
+
return {
|
|
30
|
+
content: [
|
|
31
|
+
{
|
|
32
|
+
type: 'text',
|
|
33
|
+
text: JSON.stringify({ error: result.error }, null, 2),
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
isError: true,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
return {
|
|
40
|
+
content: [
|
|
41
|
+
{ type: 'text', text: JSON.stringify(result.data, null, 2) },
|
|
42
|
+
],
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
// ---------------------------------------------------------------------------
|
|
46
|
+
// list_decision_comments -> dc_list
|
|
47
|
+
// ---------------------------------------------------------------------------
|
|
48
|
+
export const listDecisionCommentsSchema = {
|
|
49
|
+
decision_id: z.string().uuid().describe('Decision UUID'),
|
|
50
|
+
limit: z
|
|
51
|
+
.number()
|
|
52
|
+
.int()
|
|
53
|
+
.min(1)
|
|
54
|
+
.max(100)
|
|
55
|
+
.default(50)
|
|
56
|
+
.describe('Maximum comments to return'),
|
|
57
|
+
};
|
|
58
|
+
export async function listDecisionComments(args) {
|
|
59
|
+
const result = await nexusPost('/api/mcp/governance', {
|
|
60
|
+
action: 'dc_list',
|
|
61
|
+
decision_id: args.decision_id,
|
|
62
|
+
limit: args.limit ?? 50,
|
|
63
|
+
});
|
|
64
|
+
if (!result.ok) {
|
|
65
|
+
return {
|
|
66
|
+
content: [
|
|
67
|
+
{
|
|
68
|
+
type: 'text',
|
|
69
|
+
text: JSON.stringify({ error: result.error }, null, 2),
|
|
70
|
+
},
|
|
71
|
+
],
|
|
72
|
+
isError: true,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
return {
|
|
76
|
+
content: [
|
|
77
|
+
{ type: 'text', text: JSON.stringify(result.data, null, 2) },
|
|
78
|
+
],
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=decision-comments.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decision-comments.js","sourceRoot":"","sources":["../../src/tools/decision-comments.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAE3C,8EAA8E;AAC9E,iCAAiC;AACjC,8EAA8E;AAE9E,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,6BAA6B,CAAC;IACtE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG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AAQ,CAAC,4BAA4B,CAAC;CAC1C,CAAA;AAOD,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,IAA8B;IACvE,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,qBAAqB,EAAE;QACpD,MAAM,EAAE,SAAS;QACjB,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,KAAK,EAAE,IAAI,CAAC,KAAK,IAAI,EAAE;KACxB,CAAC,CAAA;IAEF,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;iBACvD;aACF;YACD,OAAO,EAAE,IAAI;SACd,CAAA;IACH,CAAC;IAED,OAAO;QACL,OAAO,EAAE;YACP,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE;SACtE;KACF,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* kb_get -- Layer 1 Knowledge Access
|
|
3
|
+
*
|
|
4
|
+
* Fetches a single knowledge object in canonical form.
|
|
5
|
+
* Returns metadata, current version, body, and linked references.
|
|
6
|
+
* Delegates to POST /api/mcp/documents (action: kb_get).
|
|
7
|
+
*
|
|
8
|
+
* ADR-0001 spec: kb_get(entity_type, entity_id, render_mode)
|
|
9
|
+
*/
|
|
10
|
+
import { z } from 'zod';
|
|
11
|
+
export declare const getDocumentSchema: {
|
|
12
|
+
entity_type: z.ZodEnum<{
|
|
13
|
+
session: "session";
|
|
14
|
+
decision: "decision";
|
|
15
|
+
letter: "letter";
|
|
16
|
+
task: "task";
|
|
17
|
+
research_note: "research_note";
|
|
18
|
+
planning_item: "planning_item";
|
|
19
|
+
ingest_item: "ingest_item";
|
|
20
|
+
}>;
|
|
21
|
+
entity_id: z.ZodString;
|
|
22
|
+
render_mode: z.ZodDefault<z.ZodEnum<{
|
|
23
|
+
structured: "structured";
|
|
24
|
+
markdown: "markdown";
|
|
25
|
+
summary: "summary";
|
|
26
|
+
}>>;
|
|
27
|
+
};
|
|
28
|
+
type GetDocumentArgs = {
|
|
29
|
+
entity_type: string;
|
|
30
|
+
entity_id: string;
|
|
31
|
+
render_mode?: string;
|
|
32
|
+
};
|
|
33
|
+
export declare function getDocument(args: GetDocumentArgs): Promise<{
|
|
34
|
+
content: {
|
|
35
|
+
type: "text";
|
|
36
|
+
text: string;
|
|
37
|
+
}[];
|
|
38
|
+
isError: boolean;
|
|
39
|
+
} | {
|
|
40
|
+
content: {
|
|
41
|
+
type: "text";
|
|
42
|
+
text: string;
|
|
43
|
+
}[];
|
|
44
|
+
isError?: undefined;
|
|
45
|
+
}>;
|
|
46
|
+
export {};
|
|
47
|
+
//# sourceMappingURL=get-document.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-document.d.ts","sourceRoot":"","sources":["../../src/tools/get-document.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;CAiB7B,CAAA;AAED,KAAK,eAAe,GAAG;IACrB,WAAW,EAAE,MAAM,CAAA;IACnB,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,CAAA;AAED,wBAAsB,WAAW,CAAC,IAAI,EAAE,eAAe;;;;;;;;;;;;GAyCtD"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* kb_get -- Layer 1 Knowledge Access
|
|
3
|
+
*
|
|
4
|
+
* Fetches a single knowledge object in canonical form.
|
|
5
|
+
* Returns metadata, current version, body, and linked references.
|
|
6
|
+
* Delegates to POST /api/mcp/documents (action: kb_get).
|
|
7
|
+
*
|
|
8
|
+
* ADR-0001 spec: kb_get(entity_type, entity_id, render_mode)
|
|
9
|
+
*/
|
|
10
|
+
import { z } from 'zod';
|
|
11
|
+
import { nexusPost } from '../nexus-api.js';
|
|
12
|
+
export const getDocumentSchema = {
|
|
13
|
+
entity_type: z
|
|
14
|
+
.enum([
|
|
15
|
+
'session',
|
|
16
|
+
'decision',
|
|
17
|
+
'letter',
|
|
18
|
+
'task',
|
|
19
|
+
'research_note',
|
|
20
|
+
'planning_item',
|
|
21
|
+
'ingest_item',
|
|
22
|
+
])
|
|
23
|
+
.describe('Type of the knowledge object'),
|
|
24
|
+
entity_id: z.string().uuid().describe('UUID of the entity'),
|
|
25
|
+
render_mode: z
|
|
26
|
+
.enum(['structured', 'markdown', 'summary'])
|
|
27
|
+
.default('structured')
|
|
28
|
+
.describe('Output format: structured JSON, markdown, or summary'),
|
|
29
|
+
};
|
|
30
|
+
export async function getDocument(args) {
|
|
31
|
+
const result = await nexusPost('/api/mcp/documents', {
|
|
32
|
+
action: 'kb_get',
|
|
33
|
+
entity_type: args.entity_type,
|
|
34
|
+
entity_id: args.entity_id,
|
|
35
|
+
render_mode: args.render_mode ?? 'structured',
|
|
36
|
+
});
|
|
37
|
+
if (!result.ok) {
|
|
38
|
+
return {
|
|
39
|
+
content: [
|
|
40
|
+
{
|
|
41
|
+
type: 'text',
|
|
42
|
+
text: JSON.stringify({ error: result.error }, null, 2),
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
isError: true,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
// For markdown and summary modes, the API returns { content: "..." }
|
|
49
|
+
// For structured mode, the API returns the full object
|
|
50
|
+
const data = result.data;
|
|
51
|
+
const renderMode = args.render_mode ?? 'structured';
|
|
52
|
+
if (renderMode === 'markdown' || renderMode === 'summary') {
|
|
53
|
+
return {
|
|
54
|
+
content: [
|
|
55
|
+
{
|
|
56
|
+
type: 'text',
|
|
57
|
+
text: data.content ?? JSON.stringify(data, null, 2),
|
|
58
|
+
},
|
|
59
|
+
],
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
return {
|
|
63
|
+
content: [
|
|
64
|
+
{ type: 'text', text: JSON.stringify(data, null, 2) },
|
|
65
|
+
],
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=get-document.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-document.js","sourceRoot":"","sources":["../../src/tools/get-document.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAE3C,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,WAAW,EAAE,CAAC;SACX,IAAI,CAAC;QACJ,SAAS;QACT,UAAU;QACV,QAAQ;QACR,MAAM;QACN,eAAe;QACf,eAAe;QACf,aAAa;KACd,CAAC;SACD,QAAQ,CAAC,8BAA8B,CAAC;IAC3C,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,oBAAoB,CAAC;IAC3D,WAAW,EAAE,CAAC;SACX,IAAI,CAAC,CAAC,YAAY,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC;SAC3C,OAAO,CAAC,YAAY,CAAC;SACrB,QAAQ,CAAC,sDAAsD,CAAC;CACpE,CAAA;AAQD,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,IAAqB;IACrD,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,oBAAoB,EAAE;QACnD,MAAM,EAAE,QAAQ;QAChB,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,SAAS,EAAE,IAAI,CAAC,SAAS;QACzB,WAAW,EAAE,IAAI,CAAC,WAAW,IAAI,YAAY;KAC9C,CAAC,CAAA;IAEF,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;iBACvD;aACF;YACD,OAAO,EAAE,IAAI;SACd,CAAA;IACH,CAAC;IAED,qEAAqE;IACrE,uDAAuD;IACvD,MAAM,IAAI,GAAG,MAAM,CAAC,IAA+B,CAAA;IACnD,MAAM,UAAU,GAAG,IAAI,CAAC,WAAW,IAAI,YAAY,CAAA;IAEnD,IAAI,UAAU,KAAK,UAAU,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;QAC1D,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAG,IAAI,CAAC,OAAkB,IAAI,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;iBAChE;aACF;SACF,CAAA;IACH,CAAC;IAED,OAAO;QACL,OAAO,EAAE;YACP,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE;SAC/D;KACF,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* kb_memory -- Layer 1 Knowledge Access
|
|
3
|
+
*
|
|
4
|
+
* Returns curated project context for agent bootstrapping.
|
|
5
|
+
* Includes ADRs, active tasks, recent sessions, open letters, etc.
|
|
6
|
+
* Delegates to POST /api/mcp/memory.
|
|
7
|
+
*
|
|
8
|
+
* ADR-0001 spec: kb_memory(project_id, include[], depth)
|
|
9
|
+
*/
|
|
10
|
+
import { z } from 'zod';
|
|
11
|
+
export declare const getProjectMemorySchema: {
|
|
12
|
+
project_id: z.ZodString;
|
|
13
|
+
include: z.ZodArray<z.ZodEnum<{
|
|
14
|
+
adrs: "adrs";
|
|
15
|
+
rules: "rules";
|
|
16
|
+
active_tasks: "active_tasks";
|
|
17
|
+
recent_sessions: "recent_sessions";
|
|
18
|
+
open_letters: "open_letters";
|
|
19
|
+
planning: "planning";
|
|
20
|
+
research: "research";
|
|
21
|
+
}>>;
|
|
22
|
+
depth: z.ZodDefault<z.ZodEnum<{
|
|
23
|
+
light: "light";
|
|
24
|
+
standard: "standard";
|
|
25
|
+
deep: "deep";
|
|
26
|
+
}>>;
|
|
27
|
+
};
|
|
28
|
+
type GetProjectMemoryArgs = {
|
|
29
|
+
project_id: string;
|
|
30
|
+
include: string[];
|
|
31
|
+
depth?: string;
|
|
32
|
+
};
|
|
33
|
+
export declare function getProjectMemory(args: GetProjectMemoryArgs): Promise<{
|
|
34
|
+
content: {
|
|
35
|
+
type: "text";
|
|
36
|
+
text: string;
|
|
37
|
+
}[];
|
|
38
|
+
isError: boolean;
|
|
39
|
+
} | {
|
|
40
|
+
content: {
|
|
41
|
+
type: "text";
|
|
42
|
+
text: string;
|
|
43
|
+
}[];
|
|
44
|
+
isError?: undefined;
|
|
45
|
+
}>;
|
|
46
|
+
export {};
|
|
47
|
+
//# sourceMappingURL=get-project-memory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-project-memory.d.ts","sourceRoot":"","sources":["../../src/tools/get-project-memory.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;CAmBlC,CAAA;AAED,KAAK,oBAAoB,GAAG;IAC1B,UAAU,EAAE,MAAM,CAAA;IAClB,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA;AAED,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,oBAAoB;;;;;;;;;;;;GAwBhE"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* kb_memory -- Layer 1 Knowledge Access
|
|
3
|
+
*
|
|
4
|
+
* Returns curated project context for agent bootstrapping.
|
|
5
|
+
* Includes ADRs, active tasks, recent sessions, open letters, etc.
|
|
6
|
+
* Delegates to POST /api/mcp/memory.
|
|
7
|
+
*
|
|
8
|
+
* ADR-0001 spec: kb_memory(project_id, include[], depth)
|
|
9
|
+
*/
|
|
10
|
+
import { z } from 'zod';
|
|
11
|
+
import { nexusPost } from '../nexus-api.js';
|
|
12
|
+
export const getProjectMemorySchema = {
|
|
13
|
+
project_id: z.string().uuid().describe('Project UUID'),
|
|
14
|
+
include: z
|
|
15
|
+
.array(z.enum([
|
|
16
|
+
'adrs',
|
|
17
|
+
'rules',
|
|
18
|
+
'active_tasks',
|
|
19
|
+
'recent_sessions',
|
|
20
|
+
'open_letters',
|
|
21
|
+
'planning',
|
|
22
|
+
'research',
|
|
23
|
+
]))
|
|
24
|
+
.describe('Categories of knowledge to include'),
|
|
25
|
+
depth: z
|
|
26
|
+
.enum(['light', 'standard', 'deep'])
|
|
27
|
+
.default('standard')
|
|
28
|
+
.describe('Detail level: light (summaries), standard, deep (full bodies)'),
|
|
29
|
+
};
|
|
30
|
+
export async function getProjectMemory(args) {
|
|
31
|
+
const result = await nexusPost('/api/mcp/memory', {
|
|
32
|
+
project_id: args.project_id,
|
|
33
|
+
include: args.include,
|
|
34
|
+
depth: args.depth ?? 'standard',
|
|
35
|
+
});
|
|
36
|
+
if (!result.ok) {
|
|
37
|
+
return {
|
|
38
|
+
content: [
|
|
39
|
+
{
|
|
40
|
+
type: 'text',
|
|
41
|
+
text: JSON.stringify({ error: result.error }, null, 2),
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
isError: true,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
return {
|
|
48
|
+
content: [
|
|
49
|
+
{ type: 'text', text: JSON.stringify(result.data, null, 2) },
|
|
50
|
+
],
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=get-project-memory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-project-memory.js","sourceRoot":"","sources":["../../src/tools/get-project-memory.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAE3C,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,cAAc,CAAC;IACtD,OAAO,EAAE,CAAC;SACP,KAAK,CACJ,CAAC,CAAC,IAAI,CAAC;QACL,MAAM;QACN,OAAO;QACP,cAAc;QACd,iBAAiB;QACjB,cAAc;QACd,UAAU;QACV,UAAU;KACX,CAAC,CACH;SACA,QAAQ,CAAC,oCAAoC,CAAC;IACjD,KAAK,EAAE,CAAC;SACL,IAAI,CAAC,CAAC,OAAO,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;SACnC,OAAO,CAAC,UAAU,CAAC;SACnB,QAAQ,CAAC,+DAA+D,CAAC;CAC7E,CAAA;AAQD,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,IAA0B;IAC/D,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,iBAAiB,EAAE;QAChD,UAAU,EAAE,IAAI,CAAC,UAAU;QAC3B,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,KAAK,EAAE,IAAI,CAAC,KAAK,IAAI,UAAU;KAChC,CAAC,CAAA;IAEF,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;iBACvD;aACF;YACD,OAAO,EAAE,IAAI;SACd,CAAA;IACH,CAAC;IAED,OAAO;QACL,OAAO,EAAE;YACP,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE;SACtE;KACF,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* kb_related -- Layer 1 Knowledge Access
|
|
3
|
+
*
|
|
4
|
+
* Returns graph-neighbor entities related to a given entity.
|
|
5
|
+
* Delegates to POST /api/mcp/related.
|
|
6
|
+
*
|
|
7
|
+
* ADR-0001 spec: kb_related(entity_type, entity_id, relation_types[], limit)
|
|
8
|
+
*/
|
|
9
|
+
import { z } from 'zod';
|
|
10
|
+
export declare const getRelatedEntitiesSchema: {
|
|
11
|
+
entity_type: z.ZodEnum<{
|
|
12
|
+
session: "session";
|
|
13
|
+
decision: "decision";
|
|
14
|
+
letter: "letter";
|
|
15
|
+
task: "task";
|
|
16
|
+
research_note: "research_note";
|
|
17
|
+
planning_item: "planning_item";
|
|
18
|
+
ingest_item: "ingest_item";
|
|
19
|
+
}>;
|
|
20
|
+
entity_id: z.ZodString;
|
|
21
|
+
relation_types: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
22
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
23
|
+
};
|
|
24
|
+
type GetRelatedEntitiesArgs = {
|
|
25
|
+
entity_type: string;
|
|
26
|
+
entity_id: string;
|
|
27
|
+
relation_types?: string[];
|
|
28
|
+
limit?: number;
|
|
29
|
+
};
|
|
30
|
+
export declare function getRelatedEntities(args: GetRelatedEntitiesArgs): Promise<{
|
|
31
|
+
content: {
|
|
32
|
+
type: "text";
|
|
33
|
+
text: string;
|
|
34
|
+
}[];
|
|
35
|
+
isError: boolean;
|
|
36
|
+
} | {
|
|
37
|
+
content: {
|
|
38
|
+
type: "text";
|
|
39
|
+
text: string;
|
|
40
|
+
}[];
|
|
41
|
+
isError?: undefined;
|
|
42
|
+
}>;
|
|
43
|
+
export {};
|
|
44
|
+
//# sourceMappingURL=get-related-entities.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-related-entities.d.ts","sourceRoot":"","sources":["../../src/tools/get-related-entities.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;CA0BpC,CAAA;AAED,KAAK,sBAAsB,GAAG;IAC5B,WAAW,EAAE,MAAM,CAAA;IACnB,SAAS,EAAE,MAAM,CAAA;IACjB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAA;IACzB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA;AAED,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,sBAAsB;;;;;;;;;;;;GAyBpE"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* kb_related -- Layer 1 Knowledge Access
|
|
3
|
+
*
|
|
4
|
+
* Returns graph-neighbor entities related to a given entity.
|
|
5
|
+
* Delegates to POST /api/mcp/related.
|
|
6
|
+
*
|
|
7
|
+
* ADR-0001 spec: kb_related(entity_type, entity_id, relation_types[], limit)
|
|
8
|
+
*/
|
|
9
|
+
import { z } from 'zod';
|
|
10
|
+
import { nexusPost } from '../nexus-api.js';
|
|
11
|
+
export const getRelatedEntitiesSchema = {
|
|
12
|
+
entity_type: z
|
|
13
|
+
.enum([
|
|
14
|
+
'session',
|
|
15
|
+
'decision',
|
|
16
|
+
'letter',
|
|
17
|
+
'task',
|
|
18
|
+
'research_note',
|
|
19
|
+
'planning_item',
|
|
20
|
+
'ingest_item',
|
|
21
|
+
])
|
|
22
|
+
.describe('Type of the source entity'),
|
|
23
|
+
entity_id: z.string().uuid().describe('UUID of the source entity'),
|
|
24
|
+
relation_types: z
|
|
25
|
+
.array(z.string().max(50))
|
|
26
|
+
.optional()
|
|
27
|
+
.describe('Filter by specific relation types (e.g., "references", "created_in", "supersedes")'),
|
|
28
|
+
limit: z
|
|
29
|
+
.number()
|
|
30
|
+
.int()
|
|
31
|
+
.min(1)
|
|
32
|
+
.max(50)
|
|
33
|
+
.default(20)
|
|
34
|
+
.describe('Maximum related entities to return'),
|
|
35
|
+
};
|
|
36
|
+
export async function getRelatedEntities(args) {
|
|
37
|
+
const result = await nexusPost('/api/mcp/related', {
|
|
38
|
+
entity_type: args.entity_type,
|
|
39
|
+
entity_id: args.entity_id,
|
|
40
|
+
relation_types: args.relation_types,
|
|
41
|
+
limit: args.limit ?? 20,
|
|
42
|
+
});
|
|
43
|
+
if (!result.ok) {
|
|
44
|
+
return {
|
|
45
|
+
content: [
|
|
46
|
+
{
|
|
47
|
+
type: 'text',
|
|
48
|
+
text: JSON.stringify({ error: result.error }, null, 2),
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
isError: true,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
return {
|
|
55
|
+
content: [
|
|
56
|
+
{ type: 'text', text: JSON.stringify(result.data, null, 2) },
|
|
57
|
+
],
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=get-related-entities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-related-entities.js","sourceRoot":"","sources":["../../src/tools/get-related-entities.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAE3C,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,WAAW,EAAE,CAAC;SACX,IAAI,CAAC;QACJ,SAAS;QACT,UAAU;QACV,QAAQ;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;SACtE;KACF,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ADR Governance tools -- Layer 3
|
|
3
|
+
*
|
|
4
|
+
* Manages the ADR lifecycle:
|
|
5
|
+
* draft -> under_review -> accepted | rejected -> superseded -> archived
|
|
6
|
+
*
|
|
7
|
+
* Delegates to POST /api/mcp/governance.
|
|
8
|
+
*/
|
|
9
|
+
import { z } from 'zod';
|
|
10
|
+
export declare const createAdrDraftSchema: {
|
|
11
|
+
project_id: z.ZodString;
|
|
12
|
+
title: z.ZodString;
|
|
13
|
+
context: z.ZodString;
|
|
14
|
+
decision: z.ZodString;
|
|
15
|
+
consequences: z.ZodOptional<z.ZodString>;
|
|
16
|
+
supersedes: z.ZodOptional<z.ZodString>;
|
|
17
|
+
agent_id: z.ZodOptional<z.ZodString>;
|
|
18
|
+
};
|
|
19
|
+
type CreateAdrDraftArgs = {
|
|
20
|
+
project_id: string;
|
|
21
|
+
title: string;
|
|
22
|
+
context: string;
|
|
23
|
+
decision: string;
|
|
24
|
+
consequences?: string;
|
|
25
|
+
supersedes?: string;
|
|
26
|
+
user_id: string;
|
|
27
|
+
agent_id?: string;
|
|
28
|
+
};
|
|
29
|
+
export declare function createAdrDraft(args: CreateAdrDraftArgs): Promise<{
|
|
30
|
+
content: {
|
|
31
|
+
type: "text";
|
|
32
|
+
text: string;
|
|
33
|
+
}[];
|
|
34
|
+
isError: boolean;
|
|
35
|
+
} | {
|
|
36
|
+
content: {
|
|
37
|
+
type: "text";
|
|
38
|
+
text: string;
|
|
39
|
+
}[];
|
|
40
|
+
isError?: undefined;
|
|
41
|
+
}>;
|
|
42
|
+
export declare const submitAdrReviewSchema: {
|
|
43
|
+
adr_id: z.ZodString;
|
|
44
|
+
};
|
|
45
|
+
type SubmitAdrReviewArgs = {
|
|
46
|
+
adr_id: string;
|
|
47
|
+
user_id: string;
|
|
48
|
+
};
|
|
49
|
+
export declare function submitAdrReview(args: SubmitAdrReviewArgs): Promise<{
|
|
50
|
+
content: {
|
|
51
|
+
type: "text";
|
|
52
|
+
text: string;
|
|
53
|
+
}[];
|
|
54
|
+
isError: boolean;
|
|
55
|
+
} | {
|
|
56
|
+
content: {
|
|
57
|
+
type: "text";
|
|
58
|
+
text: string;
|
|
59
|
+
}[];
|
|
60
|
+
isError?: undefined;
|
|
61
|
+
}>;
|
|
62
|
+
export declare const recordAdrDecisionSchema: {
|
|
63
|
+
adr_id: z.ZodString;
|
|
64
|
+
decision: z.ZodEnum<{
|
|
65
|
+
accepted: "accepted";
|
|
66
|
+
rejected: "rejected";
|
|
67
|
+
}>;
|
|
68
|
+
rationale: z.ZodOptional<z.ZodString>;
|
|
69
|
+
};
|
|
70
|
+
type RecordAdrDecisionArgs = {
|
|
71
|
+
adr_id: string;
|
|
72
|
+
decision: string;
|
|
73
|
+
rationale?: string;
|
|
74
|
+
user_id: string;
|
|
75
|
+
};
|
|
76
|
+
export declare function recordAdrDecision(args: RecordAdrDecisionArgs): Promise<{
|
|
77
|
+
content: {
|
|
78
|
+
type: "text";
|
|
79
|
+
text: string;
|
|
80
|
+
}[];
|
|
81
|
+
isError: boolean;
|
|
82
|
+
} | {
|
|
83
|
+
content: {
|
|
84
|
+
type: "text";
|
|
85
|
+
text: string;
|
|
86
|
+
}[];
|
|
87
|
+
isError?: undefined;
|
|
88
|
+
}>;
|
|
89
|
+
export {};
|
|
90
|
+
//# sourceMappingURL=governance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"governance.d.ts","sourceRoot":"","sources":["../../src/tools/governance.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAOvB,eAAO,MAAM,oBAAoB;;;;;;;;CAmBhC,CAAA;AAED,KAAK,kBAAkB,GAAG;IACxB,UAAU,EAAE,MAAM,CAAA;IAClB,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,MAAM,CAAA;IAChB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,wBAAsB,cAAc,CAAC,IAAI,EAAE,kBAAkB;;;;;;;;;;;;GA4B5D;AAMD,eAAO,MAAM,qBAAqB;;CAEjC,CAAA;AAED,KAAK,mBAAmB,GAAG;IACzB,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,wBAAsB,eAAe,CAAC,IAAI,EAAE,mBAAmB;;;;;;;;;;;;GAuB9D;AAMD,eAAO,MAAM,uBAAuB;;;;;;;CAUnC,CAAA;AAED,KAAK,qBAAqB,GAAG;IAC3B,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,qBAAqB;;;;;;;;;;;;GAyBlE"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ADR Governance tools -- Layer 3
|
|
3
|
+
*
|
|
4
|
+
* Manages the ADR lifecycle:
|
|
5
|
+
* draft -> under_review -> accepted | rejected -> superseded -> archived
|
|
6
|
+
*
|
|
7
|
+
* Delegates to POST /api/mcp/governance.
|
|
8
|
+
*/
|
|
9
|
+
import { z } from 'zod';
|
|
10
|
+
import { nexusPost } from '../nexus-api.js';
|
|
11
|
+
// ---------------------------------------------------------------------------
|
|
12
|
+
// create_adr_draft -> adr_create
|
|
13
|
+
// ---------------------------------------------------------------------------
|
|
14
|
+
export const createAdrDraftSchema = {
|
|
15
|
+
project_id: z.string().uuid().describe('Project UUID'),
|
|
16
|
+
title: z.string().max(500).describe('ADR title'),
|
|
17
|
+
context: z
|
|
18
|
+
.string()
|
|
19
|
+
.max(100_000)
|
|
20
|
+
.describe('Context / motivation for the decision (markdown)'),
|
|
21
|
+
decision: z.string().max(100_000).describe('The decision content (markdown)'),
|
|
22
|
+
consequences: z
|
|
23
|
+
.string()
|
|
24
|
+
.max(100_000)
|
|
25
|
+
.optional()
|
|
26
|
+
.describe('Expected consequences of the decision (markdown)'),
|
|
27
|
+
supersedes: z
|
|
28
|
+
.string()
|
|
29
|
+
.uuid()
|
|
30
|
+
.optional()
|
|
31
|
+
.describe('UUID of the ADR this one supersedes'),
|
|
32
|
+
agent_id: z.string().max(200).optional().describe('Agent identifier if applicable'),
|
|
33
|
+
};
|
|
34
|
+
export async function createAdrDraft(args) {
|
|
35
|
+
const result = await nexusPost('/api/mcp/governance', {
|
|
36
|
+
action: 'adr_create',
|
|
37
|
+
project_id: args.project_id,
|
|
38
|
+
title: args.title,
|
|
39
|
+
context: args.context,
|
|
40
|
+
decision: args.decision,
|
|
41
|
+
consequences: args.consequences,
|
|
42
|
+
supersedes: args.supersedes,
|
|
43
|
+
});
|
|
44
|
+
if (!result.ok) {
|
|
45
|
+
return {
|
|
46
|
+
content: [
|
|
47
|
+
{
|
|
48
|
+
type: 'text',
|
|
49
|
+
text: JSON.stringify({ error: result.error }, null, 2),
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
isError: true,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
return {
|
|
56
|
+
content: [
|
|
57
|
+
{ type: 'text', text: JSON.stringify(result.data, null, 2) },
|
|
58
|
+
],
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
// ---------------------------------------------------------------------------
|
|
62
|
+
// submit_adr_review -> adr_submit
|
|
63
|
+
// ---------------------------------------------------------------------------
|
|
64
|
+
export const submitAdrReviewSchema = {
|
|
65
|
+
adr_id: z.string().uuid().describe('ADR UUID to submit for review'),
|
|
66
|
+
};
|
|
67
|
+
export async function submitAdrReview(args) {
|
|
68
|
+
const result = await nexusPost('/api/mcp/governance', {
|
|
69
|
+
action: 'adr_submit',
|
|
70
|
+
adr_id: args.adr_id,
|
|
71
|
+
});
|
|
72
|
+
if (!result.ok) {
|
|
73
|
+
return {
|
|
74
|
+
content: [
|
|
75
|
+
{
|
|
76
|
+
type: 'text',
|
|
77
|
+
text: JSON.stringify({ error: result.error }, null, 2),
|
|
78
|
+
},
|
|
79
|
+
],
|
|
80
|
+
isError: true,
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
return {
|
|
84
|
+
content: [
|
|
85
|
+
{ type: 'text', text: JSON.stringify(result.data, null, 2) },
|
|
86
|
+
],
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
// ---------------------------------------------------------------------------
|
|
90
|
+
// record_adr_decision -> adr_decide
|
|
91
|
+
// ---------------------------------------------------------------------------
|
|
92
|
+
export const recordAdrDecisionSchema = {
|
|
93
|
+
adr_id: z.string().uuid().describe('ADR UUID'),
|
|
94
|
+
decision: z
|
|
95
|
+
.enum(['accepted', 'rejected'])
|
|
96
|
+
.describe('Decision outcome: accept or reject'),
|
|
97
|
+
rationale: z
|
|
98
|
+
.string()
|
|
99
|
+
.max(10_000)
|
|
100
|
+
.optional()
|
|
101
|
+
.describe('Optional rationale for the decision'),
|
|
102
|
+
};
|
|
103
|
+
export async function recordAdrDecision(args) {
|
|
104
|
+
const result = await nexusPost('/api/mcp/governance', {
|
|
105
|
+
action: 'adr_decide',
|
|
106
|
+
adr_id: args.adr_id,
|
|
107
|
+
decision: args.decision,
|
|
108
|
+
rationale: args.rationale,
|
|
109
|
+
});
|
|
110
|
+
if (!result.ok) {
|
|
111
|
+
return {
|
|
112
|
+
content: [
|
|
113
|
+
{
|
|
114
|
+
type: 'text',
|
|
115
|
+
text: JSON.stringify({ error: result.error }, null, 2),
|
|
116
|
+
},
|
|
117
|
+
],
|
|
118
|
+
isError: true,
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
return {
|
|
122
|
+
content: [
|
|
123
|
+
{ type: 'text', text: JSON.stringify(result.data, null, 2) },
|
|
124
|
+
],
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
//# sourceMappingURL=governance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"governance.js","sourceRoot":"","sources":["../../src/tools/governance.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAE3C,8EAA8E;AAC9E,iCAAiC;AACjC,8EAA8E;AAE9E,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,cAAc,CAAC;IACtD,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC;IAChD,OAAO,EAAE,CAAC;SACP,MAAM,EAAE;SACR,GAAG,CAAC,OAAO,CAAC;SACZ,QAAQ,CAAC,kDAAkD,CAAC;IAC/D,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,iCAAiC,CAAC;IAC7E,YAAY,EAAE,CAAC;SACZ,MAAM,EAAE;SACR,GAAG,CAAC,OAAO,CAAC;SACZ,QAAQ,EAAE;SACV,QAAQ,CAAC,kDAAkD,CAAC;IAC/D,UAAU,EAAE,CAAC;SACV,MAAM,EAAE;SACR,IAAI,EAAE;SACN,QAAQ,EAAE;SACV,QAAQ,CAAC,qCAAqC,CAAC;IAClD,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,gCAAgC,CAAC;CACpF,CAAA;AAaD,MAAM,CAAC,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