@kage-core/kage-graph-mcp 1.1.37 → 1.1.38
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.js +22 -0
- package/dist/daemon.js +31 -1
- package/dist/index.js +53 -0
- package/dist/kernel.js +527 -4
- package/package.json +1 -1
- package/viewer/app.js +216 -63
- package/viewer/data.html +6 -6
- package/viewer/graph.html +6 -6
- package/viewer/index.html +18 -7
- package/viewer/intel.html +6 -6
- package/viewer/memory.html +6 -6
- package/viewer/owners.html +6 -6
- package/viewer/review.html +7 -7
- package/viewer/styles.css +149 -1
package/dist/cli.js
CHANGED
|
@@ -47,6 +47,7 @@ Usage:
|
|
|
47
47
|
kage supersede --project <dir> --packet <old-id> --replacement <new-id> [--reason <text>] [--json]
|
|
48
48
|
kage contributors --project <dir> [--json]
|
|
49
49
|
kage profile --project <dir> [--json]
|
|
50
|
+
kage xray --project <dir> [--json]
|
|
50
51
|
kage capabilities --project <dir> [--json]
|
|
51
52
|
kage decisions --project <dir> [--json]
|
|
52
53
|
kage module-health --project <dir> [--json]
|
|
@@ -692,6 +693,27 @@ async function main() {
|
|
|
692
693
|
console.log(`Warnings:\n${result.warnings.map((warning) => ` - ${warning}`).join("\n")}`);
|
|
693
694
|
return;
|
|
694
695
|
}
|
|
696
|
+
if (command === "xray" || command === "repo-xray") {
|
|
697
|
+
const result = (0, kernel_js_1.kageRepoXray)(projectArg(args));
|
|
698
|
+
if (args.includes("--json")) {
|
|
699
|
+
console.log(JSON.stringify(result, null, 2));
|
|
700
|
+
return;
|
|
701
|
+
}
|
|
702
|
+
console.log(`Kage Repo X-Ray: ${result.summary}`);
|
|
703
|
+
for (const line of result.first_use_script)
|
|
704
|
+
console.log(`- ${line}`);
|
|
705
|
+
for (const layer of result.layers) {
|
|
706
|
+
console.log(`\n${layer.title}: ${layer.summary}`);
|
|
707
|
+
for (const item of layer.items.slice(0, 5)) {
|
|
708
|
+
console.log(`- ${item.path}: ${item.evidence.slice(0, 2).join("; ")}`);
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
if (result.next_actions.length)
|
|
712
|
+
console.log(`\nNext: ${result.next_actions[0]}`);
|
|
713
|
+
if (result.warnings.length)
|
|
714
|
+
console.log(`Warnings:\n${result.warnings.map((warning) => ` - ${warning}`).join("\n")}`);
|
|
715
|
+
return;
|
|
716
|
+
}
|
|
695
717
|
if (command === "decisions") {
|
|
696
718
|
const result = (0, kernel_js_1.kageDecisionIntelligence)(projectArg(args));
|
|
697
719
|
if (args.includes("--json")) {
|
package/dist/daemon.js
CHANGED
|
@@ -212,9 +212,22 @@ function daemonContextReport(projectDir, body) {
|
|
|
212
212
|
sessionId: typeof body.session_id === "string" ? body.session_id : undefined,
|
|
213
213
|
limit: 5,
|
|
214
214
|
});
|
|
215
|
+
const teammateBrief = (0, kernel_js_1.kageTeammateBrief)(projectDir, {
|
|
216
|
+
query,
|
|
217
|
+
targets: explicitTargets,
|
|
218
|
+
changedFiles,
|
|
219
|
+
recallResult,
|
|
220
|
+
riskResult,
|
|
221
|
+
reconciliation,
|
|
222
|
+
});
|
|
223
|
+
const learningLedger = typeof body.session_id === "string" && body.session_id.trim()
|
|
224
|
+
? (0, kernel_js_1.kageSessionLearningLedger)(projectDir, { sessionId: body.session_id, limit: 20 })
|
|
225
|
+
: null;
|
|
215
226
|
const validationText = validation.ok ? "Memory healthy." : `Warnings: ${validation.warnings.join("; ")}`;
|
|
216
227
|
const contextBlock = [
|
|
217
228
|
recallResult.context_block,
|
|
229
|
+
teammateBrief.context_block,
|
|
230
|
+
learningLedger ? learningLedger.context_block : "",
|
|
218
231
|
graphResult.context_block ? `\n## Graph Facts\n${graphResult.context_block}` : "",
|
|
219
232
|
riskResult ? riskContextBlock(riskResult) : "",
|
|
220
233
|
dependencyResult ? `\n## Dependency Path\n${dependencyResult.summary}${dependencyResult.path.length ? `\nPath: ${dependencyResult.path.join(" -> ")}` : ""}` : "",
|
|
@@ -225,6 +238,8 @@ function daemonContextReport(projectDir, body) {
|
|
|
225
238
|
context_block: contextBlock,
|
|
226
239
|
recall: recallResult,
|
|
227
240
|
graph: graphResult,
|
|
241
|
+
teammate_brief: teammateBrief,
|
|
242
|
+
learning_ledger: learningLedger,
|
|
228
243
|
risk: riskResult,
|
|
229
244
|
dependency_path: dependencyResult,
|
|
230
245
|
validation,
|
|
@@ -267,9 +282,11 @@ function daemonDoctor(projectDir) {
|
|
|
267
282
|
`POST http://${DEFAULT_HOST}:${restPort}/kage/feedback`,
|
|
268
283
|
`POST http://${DEFAULT_HOST}:${restPort}/kage/observe`,
|
|
269
284
|
`POST http://${DEFAULT_HOST}:${restPort}/kage/distill`,
|
|
285
|
+
`GET http://${DEFAULT_HOST}:${restPort}/kage/learning-ledger`,
|
|
270
286
|
`GET http://${DEFAULT_HOST}:${restPort}/kage/replay`,
|
|
271
287
|
`GET http://${DEFAULT_HOST}:${restPort}/kage/setup-doctor`,
|
|
272
288
|
`GET http://${DEFAULT_HOST}:${restPort}/kage/profile`,
|
|
289
|
+
`GET http://${DEFAULT_HOST}:${restPort}/kage/xray`,
|
|
273
290
|
`GET http://${DEFAULT_HOST}:${restPort}/kage/capabilities`,
|
|
274
291
|
`GET http://${DEFAULT_HOST}:${restPort}/kage/context-slots`,
|
|
275
292
|
`POST http://${DEFAULT_HOST}:${restPort}/kage/context-slots`,
|
|
@@ -369,6 +386,10 @@ async function startDaemon(projectDir, options = {}) {
|
|
|
369
386
|
json(res, 200, (0, kernel_js_1.kageProjectProfile)(projectDir));
|
|
370
387
|
return;
|
|
371
388
|
}
|
|
389
|
+
if (req.method === "GET" && url.pathname === "/kage/xray") {
|
|
390
|
+
json(res, 200, (0, kernel_js_1.kageRepoXray)(projectDir));
|
|
391
|
+
return;
|
|
392
|
+
}
|
|
372
393
|
if (req.method === "GET" && url.pathname === "/kage/capabilities") {
|
|
373
394
|
json(res, 200, (0, kernel_js_1.kageCapabilityAudit)(projectDir));
|
|
374
395
|
return;
|
|
@@ -380,6 +401,13 @@ async function startDaemon(projectDir, options = {}) {
|
|
|
380
401
|
}));
|
|
381
402
|
return;
|
|
382
403
|
}
|
|
404
|
+
if (req.method === "GET" && url.pathname === "/kage/learning-ledger") {
|
|
405
|
+
json(res, 200, (0, kernel_js_1.kageSessionLearningLedger)(projectDir, {
|
|
406
|
+
sessionId: url.searchParams.get("session") ?? undefined,
|
|
407
|
+
limit: Number(url.searchParams.get("limit") ?? 50),
|
|
408
|
+
}));
|
|
409
|
+
return;
|
|
410
|
+
}
|
|
383
411
|
if (req.method === "GET" && url.pathname === "/kage/context-slots") {
|
|
384
412
|
json(res, 200, (0, kernel_js_1.kageContextSlots)(projectDir));
|
|
385
413
|
return;
|
|
@@ -528,6 +556,7 @@ async function startViewer(projectDir, options = {}) {
|
|
|
528
556
|
const benchmarkPath = (0, node_path_1.join)(reportsDir, "benchmark.json");
|
|
529
557
|
const contributorsPath = (0, node_path_1.join)(reportsDir, "contributors.json");
|
|
530
558
|
const profilePath = (0, node_path_1.join)(reportsDir, "profile.json");
|
|
559
|
+
const xrayPath = (0, node_path_1.join)(reportsDir, "xray.json");
|
|
531
560
|
const capabilitiesPath = (0, node_path_1.join)(reportsDir, "capabilities.json");
|
|
532
561
|
const slotsPath = (0, node_path_1.join)(reportsDir, "context-slots.json");
|
|
533
562
|
const decisionsPath = (0, node_path_1.join)(reportsDir, "decisions.json");
|
|
@@ -555,6 +584,7 @@ async function startViewer(projectDir, options = {}) {
|
|
|
555
584
|
(0, node_fs_1.writeFileSync)(benchmarkPath, JSON.stringify(viewerBenchmarkReport(projectDir), null, 2));
|
|
556
585
|
(0, node_fs_1.writeFileSync)(contributorsPath, JSON.stringify((0, kernel_js_1.kageContributors)(projectDir), null, 2));
|
|
557
586
|
(0, node_fs_1.writeFileSync)(profilePath, JSON.stringify((0, kernel_js_1.kageProjectProfile)(projectDir), null, 2));
|
|
587
|
+
(0, node_fs_1.writeFileSync)(xrayPath, JSON.stringify((0, kernel_js_1.kageRepoXray)(projectDir), null, 2));
|
|
558
588
|
(0, node_fs_1.writeFileSync)(capabilitiesPath, JSON.stringify((0, kernel_js_1.kageCapabilityAudit)(projectDir), null, 2));
|
|
559
589
|
(0, node_fs_1.writeFileSync)(slotsPath, JSON.stringify((0, kernel_js_1.kageContextSlots)(projectDir), null, 2));
|
|
560
590
|
(0, node_fs_1.writeFileSync)(decisionsPath, JSON.stringify((0, kernel_js_1.kageDecisionIntelligence)(projectDir), null, 2));
|
|
@@ -575,7 +605,7 @@ async function startViewer(projectDir, options = {}) {
|
|
|
575
605
|
catch {
|
|
576
606
|
// non-fatal: viewer will show 404 for reports if generation fails
|
|
577
607
|
}
|
|
578
|
-
const url = `http://${host}:${port}/viewer/index.html?graph=${encodeURIComponent(graphPath)}&code=${encodeURIComponent(codePath)}&metrics=${encodeURIComponent(metricsPath)}&inbox=${encodeURIComponent(inboxPath)}&review=${encodeURIComponent(reviewPath)}&pending=${encodeURIComponent(pendingDir)}&quality=${encodeURIComponent(qualityPath)}&benchmark=${encodeURIComponent(benchmarkPath)}&contributors=${encodeURIComponent(contributorsPath)}&profile=${encodeURIComponent(profilePath)}&capabilities=${encodeURIComponent(capabilitiesPath)}&slots=${encodeURIComponent(slotsPath)}&decisions=${encodeURIComponent(decisionsPath)}&risk=${encodeURIComponent(riskPath)}&moduleHealth=${encodeURIComponent(moduleHealthPath)}&graphInsights=${encodeURIComponent(graphInsightsPath)}&workspace=${encodeURIComponent(workspacePath)}&sessions=${encodeURIComponent(sessionsPath)}&replay=${encodeURIComponent(replayPath)}&memoryAccess=${encodeURIComponent(memoryAccessPath)}&memoryAudit=${encodeURIComponent(memoryAuditPath)}&handoff=${encodeURIComponent(handoffPath)}&lifecycle=${encodeURIComponent(lifecyclePath)}&timeline=${encodeURIComponent(timelinePath)}&lineage=${encodeURIComponent(lineagePath)}&setup=${encodeURIComponent(setupPath)}&view=code`;
|
|
608
|
+
const url = `http://${host}:${port}/viewer/index.html?graph=${encodeURIComponent(graphPath)}&code=${encodeURIComponent(codePath)}&metrics=${encodeURIComponent(metricsPath)}&inbox=${encodeURIComponent(inboxPath)}&review=${encodeURIComponent(reviewPath)}&pending=${encodeURIComponent(pendingDir)}&quality=${encodeURIComponent(qualityPath)}&benchmark=${encodeURIComponent(benchmarkPath)}&contributors=${encodeURIComponent(contributorsPath)}&profile=${encodeURIComponent(profilePath)}&xray=${encodeURIComponent(xrayPath)}&capabilities=${encodeURIComponent(capabilitiesPath)}&slots=${encodeURIComponent(slotsPath)}&decisions=${encodeURIComponent(decisionsPath)}&risk=${encodeURIComponent(riskPath)}&moduleHealth=${encodeURIComponent(moduleHealthPath)}&graphInsights=${encodeURIComponent(graphInsightsPath)}&workspace=${encodeURIComponent(workspacePath)}&sessions=${encodeURIComponent(sessionsPath)}&replay=${encodeURIComponent(replayPath)}&memoryAccess=${encodeURIComponent(memoryAccessPath)}&memoryAudit=${encodeURIComponent(memoryAuditPath)}&handoff=${encodeURIComponent(handoffPath)}&lifecycle=${encodeURIComponent(lifecyclePath)}&timeline=${encodeURIComponent(timelinePath)}&lineage=${encodeURIComponent(lineagePath)}&setup=${encodeURIComponent(setupPath)}&view=code`;
|
|
579
609
|
const server = (0, node_http_1.createServer)((req, res) => {
|
|
580
610
|
const requestUrl = new URL(req.url ?? "/", `http://${host}:${port}`);
|
|
581
611
|
let filePath = null;
|
package/dist/index.js
CHANGED
|
@@ -267,6 +267,17 @@ function listTools() {
|
|
|
267
267
|
required: ["project_dir"],
|
|
268
268
|
},
|
|
269
269
|
},
|
|
270
|
+
{
|
|
271
|
+
name: "kage_xray",
|
|
272
|
+
description: "Return a first-use Repo X-Ray: code structure layers for entry points, core files, risk, tests, memory overlay, and knowledge gaps.",
|
|
273
|
+
inputSchema: {
|
|
274
|
+
type: "object",
|
|
275
|
+
properties: {
|
|
276
|
+
project_dir: { type: "string" },
|
|
277
|
+
},
|
|
278
|
+
required: ["project_dir"],
|
|
279
|
+
},
|
|
280
|
+
},
|
|
270
281
|
{
|
|
271
282
|
name: "kage_capabilities",
|
|
272
283
|
description: "Return an evidence-backed Kage memory-system capability audit across repo memory, collaboration/session proof, benchmarks, and dashboard/viewer readiness.",
|
|
@@ -737,6 +748,19 @@ function listTools() {
|
|
|
737
748
|
required: ["project_dir"],
|
|
738
749
|
},
|
|
739
750
|
},
|
|
751
|
+
{
|
|
752
|
+
name: "kage_learning_ledger",
|
|
753
|
+
description: "Return an agent-facing ledger that classifies observed session events into save, ignore, needs-evidence, or already-distilled memory decisions.",
|
|
754
|
+
inputSchema: {
|
|
755
|
+
type: "object",
|
|
756
|
+
properties: {
|
|
757
|
+
project_dir: { type: "string" },
|
|
758
|
+
session_id: { type: "string" },
|
|
759
|
+
limit: { type: "number" },
|
|
760
|
+
},
|
|
761
|
+
required: ["project_dir"],
|
|
762
|
+
},
|
|
763
|
+
},
|
|
740
764
|
{
|
|
741
765
|
name: "kage_session_replay",
|
|
742
766
|
description: "Return a privacy-preserving replay digest for observed agent sessions: timeline, touched paths, commands, durable candidates, and distill actions without raw transcript text.",
|
|
@@ -1042,8 +1066,21 @@ async function callTool(name, args) {
|
|
|
1042
1066
|
sessionId: typeof args?.session_id === "string" ? args.session_id : undefined,
|
|
1043
1067
|
limit: 5,
|
|
1044
1068
|
});
|
|
1069
|
+
const teammateBrief = (0, kernel_js_1.kageTeammateBrief)(projectDir, {
|
|
1070
|
+
query,
|
|
1071
|
+
targets: explicitTargets,
|
|
1072
|
+
changedFiles,
|
|
1073
|
+
recallResult,
|
|
1074
|
+
riskResult,
|
|
1075
|
+
reconciliation,
|
|
1076
|
+
});
|
|
1077
|
+
const learningLedger = typeof args?.session_id === "string" && args.session_id.trim()
|
|
1078
|
+
? (0, kernel_js_1.kageSessionLearningLedger)(projectDir, { sessionId: args.session_id, limit: 20 })
|
|
1079
|
+
: null;
|
|
1045
1080
|
const sections = [
|
|
1046
1081
|
recallResult.context_block,
|
|
1082
|
+
teammateBrief.context_block,
|
|
1083
|
+
learningLedger ? learningLedger.context_block : "",
|
|
1047
1084
|
graphResult.context_block ? `\n## Graph Facts\n${graphResult.context_block}` : "",
|
|
1048
1085
|
riskResult ? riskContextBlock(riskResult) : "",
|
|
1049
1086
|
dependencyResult ? `\n## Dependency Path\n${dependencyResult.summary}${dependencyResult.path.length ? `\nPath: ${dependencyResult.path.join(" -> ")}` : ""}` : "",
|
|
@@ -1125,6 +1162,12 @@ async function callTool(name, args) {
|
|
|
1125
1162
|
content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
|
|
1126
1163
|
};
|
|
1127
1164
|
}
|
|
1165
|
+
if (name === "kage_xray") {
|
|
1166
|
+
const result = (0, kernel_js_1.kageRepoXray)(String(args?.project_dir ?? ""));
|
|
1167
|
+
return {
|
|
1168
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
|
|
1169
|
+
};
|
|
1170
|
+
}
|
|
1128
1171
|
if (name === "kage_capabilities") {
|
|
1129
1172
|
const result = (0, kernel_js_1.kageCapabilityAudit)(String(args?.project_dir ?? ""));
|
|
1130
1173
|
return {
|
|
@@ -1420,6 +1463,16 @@ async function callTool(name, args) {
|
|
|
1420
1463
|
isError: false,
|
|
1421
1464
|
};
|
|
1422
1465
|
}
|
|
1466
|
+
if (name === "kage_learning_ledger") {
|
|
1467
|
+
const result = (0, kernel_js_1.kageSessionLearningLedger)(String(args?.project_dir ?? ""), {
|
|
1468
|
+
sessionId: args?.session_id ? String(args.session_id) : undefined,
|
|
1469
|
+
limit: typeof args?.limit === "number" ? args.limit : undefined,
|
|
1470
|
+
});
|
|
1471
|
+
return {
|
|
1472
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
|
|
1473
|
+
isError: false,
|
|
1474
|
+
};
|
|
1475
|
+
}
|
|
1423
1476
|
if (name === "kage_session_replay") {
|
|
1424
1477
|
const result = (0, kernel_js_1.kageSessionReplay)(String(args?.project_dir ?? ""), {
|
|
1425
1478
|
sessionId: args?.session_id ? String(args.session_id) : undefined,
|