@kage-core/kage-graph-mcp 1.4.0 → 2.0.1
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 +157 -137
- package/dist/daemon.js +78 -57
- package/dist/index.js +24 -182
- package/dist/kernel.js +1115 -274
- package/dist/structural-worker.js +17 -13
- package/package.json +7 -4
- package/viewer/console.js +164 -19
- package/viewer/index.html +133 -78
package/dist/index.js
CHANGED
|
@@ -74,7 +74,7 @@ function riskContextBlock(result) {
|
|
|
74
74
|
});
|
|
75
75
|
return `\n## Risk Signals\n${lines.join("\n")}`;
|
|
76
76
|
}
|
|
77
|
-
const server = new index_js_1.Server({ name: "kage-graph", version: "
|
|
77
|
+
const server = new index_js_1.Server({ name: "kage-graph", version: "2.0.0" }, { capabilities: { tools: {} } });
|
|
78
78
|
function listTools() {
|
|
79
79
|
return [
|
|
80
80
|
{
|
|
@@ -479,7 +479,7 @@ function listTools() {
|
|
|
479
479
|
},
|
|
480
480
|
{
|
|
481
481
|
name: "kage_pr_check",
|
|
482
|
-
description: "Check whether repo memory, code graph, memory graph, and stale-memory state are ready for merge.",
|
|
482
|
+
description: "Check whether repo memory, code graph, memory graph, and stale-memory state are ready for merge. Leads with a human summary of team memories invalidated by the current change — relay it to the developer.",
|
|
483
483
|
inputSchema: {
|
|
484
484
|
type: "object",
|
|
485
485
|
properties: {
|
|
@@ -850,107 +850,6 @@ function listTools() {
|
|
|
850
850
|
required: ["project_dir"],
|
|
851
851
|
},
|
|
852
852
|
},
|
|
853
|
-
{
|
|
854
|
-
name: "kage_marketplace",
|
|
855
|
-
description: "Build a local marketplace manifest for recommended docs, skills, and MCP packs. This never installs anything automatically.",
|
|
856
|
-
inputSchema: {
|
|
857
|
-
type: "object",
|
|
858
|
-
properties: {
|
|
859
|
-
project_dir: { type: "string" },
|
|
860
|
-
},
|
|
861
|
-
required: ["project_dir"],
|
|
862
|
-
},
|
|
863
|
-
},
|
|
864
|
-
{
|
|
865
|
-
name: "kage_org_status",
|
|
866
|
-
description: "Inspect the local org-memory inbox, approved packets, rejected packets, audit count, and registry path.",
|
|
867
|
-
inputSchema: {
|
|
868
|
-
type: "object",
|
|
869
|
-
properties: {
|
|
870
|
-
project_dir: { type: "string" },
|
|
871
|
-
org: { type: "string" },
|
|
872
|
-
},
|
|
873
|
-
required: ["project_dir", "org"],
|
|
874
|
-
},
|
|
875
|
-
},
|
|
876
|
-
{
|
|
877
|
-
name: "kage_org_upload_candidate",
|
|
878
|
-
description: "Upload an approved repo packet into the local org review inbox. This creates a candidate only; it does not approve org memory.",
|
|
879
|
-
inputSchema: {
|
|
880
|
-
type: "object",
|
|
881
|
-
properties: {
|
|
882
|
-
project_dir: { type: "string" },
|
|
883
|
-
org: { type: "string" },
|
|
884
|
-
packet_id: { type: "string" },
|
|
885
|
-
},
|
|
886
|
-
required: ["project_dir", "org", "packet_id"],
|
|
887
|
-
},
|
|
888
|
-
},
|
|
889
|
-
{
|
|
890
|
-
name: "kage_org_recall",
|
|
891
|
-
description: "Recall approved local org memory. Repo-local recall should still take priority when results conflict.",
|
|
892
|
-
inputSchema: {
|
|
893
|
-
type: "object",
|
|
894
|
-
properties: {
|
|
895
|
-
project_dir: { type: "string" },
|
|
896
|
-
org: { type: "string" },
|
|
897
|
-
query: { type: "string" },
|
|
898
|
-
limit: { type: "number" },
|
|
899
|
-
json: { type: "boolean" },
|
|
900
|
-
},
|
|
901
|
-
required: ["project_dir", "org", "query"],
|
|
902
|
-
},
|
|
903
|
-
},
|
|
904
|
-
{
|
|
905
|
-
name: "kage_layered_recall",
|
|
906
|
-
description: "Recall with Kage's priority order: branch > repo local > org > global. Org/global are included only when explicitly requested.",
|
|
907
|
-
inputSchema: {
|
|
908
|
-
type: "object",
|
|
909
|
-
properties: {
|
|
910
|
-
project_dir: { type: "string" },
|
|
911
|
-
query: { type: "string" },
|
|
912
|
-
org: { type: "string" },
|
|
913
|
-
include_global: { type: "boolean" },
|
|
914
|
-
json: { type: "boolean" },
|
|
915
|
-
},
|
|
916
|
-
required: ["project_dir", "query"],
|
|
917
|
-
},
|
|
918
|
-
},
|
|
919
|
-
{
|
|
920
|
-
name: "kage_global_build",
|
|
921
|
-
description: "Build a local static global/CDN bundle from human-promoted public candidates and the marketplace manifest. This does not upload anywhere.",
|
|
922
|
-
inputSchema: {
|
|
923
|
-
type: "object",
|
|
924
|
-
properties: {
|
|
925
|
-
project_dir: { type: "string" },
|
|
926
|
-
org: { type: "string" },
|
|
927
|
-
},
|
|
928
|
-
required: ["project_dir"],
|
|
929
|
-
},
|
|
930
|
-
},
|
|
931
|
-
{
|
|
932
|
-
name: "kage_promote_public_candidate",
|
|
933
|
-
description: "Create a sanitized local public-review candidate from an approved repo memory packet. This does not publish to the global graph.",
|
|
934
|
-
inputSchema: {
|
|
935
|
-
type: "object",
|
|
936
|
-
properties: {
|
|
937
|
-
project_dir: { type: "string" },
|
|
938
|
-
packet_id: { type: "string" },
|
|
939
|
-
},
|
|
940
|
-
required: ["project_dir", "packet_id"],
|
|
941
|
-
},
|
|
942
|
-
},
|
|
943
|
-
{
|
|
944
|
-
name: "kage_export_public_bundle",
|
|
945
|
-
description: "Export local public-review candidates as a static public bundle catalog. This still does not publish anywhere.",
|
|
946
|
-
inputSchema: {
|
|
947
|
-
type: "object",
|
|
948
|
-
properties: {
|
|
949
|
-
project_dir: { type: "string" },
|
|
950
|
-
},
|
|
951
|
-
required: ["project_dir"],
|
|
952
|
-
},
|
|
953
|
-
},
|
|
954
853
|
{
|
|
955
854
|
name: "kage_review_artifact",
|
|
956
855
|
description: "Create a Markdown review artifact summarizing pending memory packets for PR or human review.",
|
|
@@ -979,6 +878,7 @@ server.setRequestHandler(types_js_1.ListToolsRequestSchema, async () => ({
|
|
|
979
878
|
tools: listTools(),
|
|
980
879
|
}));
|
|
981
880
|
async function callTool(name, args) {
|
|
881
|
+
await (0, kernel_js_1.ensureTreeSitterLanguages)();
|
|
982
882
|
if (name === "kage_list_domains") {
|
|
983
883
|
const catalog = await fetchJSON(`${BASE_URL}/catalog.json`);
|
|
984
884
|
const lines = Object.entries(catalog.domains)
|
|
@@ -1116,6 +1016,11 @@ async function callTool(name, args) {
|
|
|
1116
1016
|
dependencyResult ? `\n## Dependency Path\n${dependencyResult.summary}${dependencyResult.path.length ? `\nPath: ${dependencyResult.path.join(" -> ")}` : ""}` : "",
|
|
1117
1017
|
reconciliation.unresolved_count ? `\n## Memory Reconciliation\n${reconciliation.agent_instruction}` : "",
|
|
1118
1018
|
`\n_${validationText}_`,
|
|
1019
|
+
// Visible receipt: surface what the harness saved today so agents relay it.
|
|
1020
|
+
(() => {
|
|
1021
|
+
const gains = (0, kernel_js_1.valueSummary)(projectDir).today;
|
|
1022
|
+
return `\n\nGains: ~${(0, kernel_js_1.formatTokenCount)(gains.tokens_saved)} tokens saved this session · stale memories withheld: ${gains.stale_withheld}`;
|
|
1023
|
+
})(),
|
|
1119
1024
|
].filter(Boolean).join("");
|
|
1120
1025
|
return {
|
|
1121
1026
|
content: [{ type: "text", text: sections }],
|
|
@@ -1352,9 +1257,13 @@ async function callTool(name, args) {
|
|
|
1352
1257
|
};
|
|
1353
1258
|
}
|
|
1354
1259
|
if (name === "kage_pr_check") {
|
|
1355
|
-
const
|
|
1260
|
+
const projectDir = String(args?.project_dir ?? "");
|
|
1261
|
+
// Lead with the stale-catch moment so agents relay "your changes
|
|
1262
|
+
// invalidated team memory" to the developer instead of burying it in JSON.
|
|
1263
|
+
const guard = (0, kernel_js_1.formatStaleCatch)((0, kernel_js_1.staleCatch)(projectDir)).join("\n");
|
|
1264
|
+
const result = (0, kernel_js_1.prCheck)(projectDir);
|
|
1356
1265
|
return {
|
|
1357
|
-
content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
|
|
1266
|
+
content: [{ type: "text", text: `${guard}\n\n${JSON.stringify(result, null, 2)}` }],
|
|
1358
1267
|
isError: !result.ok,
|
|
1359
1268
|
};
|
|
1360
1269
|
}
|
|
@@ -1586,83 +1495,6 @@ async function callTool(name, args) {
|
|
|
1586
1495
|
content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
|
|
1587
1496
|
};
|
|
1588
1497
|
}
|
|
1589
|
-
if (name === "kage_marketplace") {
|
|
1590
|
-
const result = (0, kernel_js_1.buildMarketplace)(String(args?.project_dir ?? ""));
|
|
1591
|
-
return {
|
|
1592
|
-
content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
|
|
1593
|
-
isError: !result.ok,
|
|
1594
|
-
};
|
|
1595
|
-
}
|
|
1596
|
-
if (name === "kage_org_status") {
|
|
1597
|
-
const result = (0, kernel_js_1.orgStatus)(String(args?.project_dir ?? ""), String(args?.org ?? "local"));
|
|
1598
|
-
return {
|
|
1599
|
-
content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
|
|
1600
|
-
};
|
|
1601
|
-
}
|
|
1602
|
-
if (name === "kage_org_upload_candidate") {
|
|
1603
|
-
const result = (0, kernel_js_1.orgUploadPacket)(String(args?.project_dir ?? ""), String(args?.org ?? "local"), String(args?.packet_id ?? ""));
|
|
1604
|
-
return {
|
|
1605
|
-
content: [
|
|
1606
|
-
{
|
|
1607
|
-
type: "text",
|
|
1608
|
-
text: result.ok
|
|
1609
|
-
? `Created org review candidate: ${result.path}\nApprove explicitly with: kage org review --approve`
|
|
1610
|
-
: `Org upload blocked:\n${result.errors.map((error) => `- ${error}`).join("\n")}`,
|
|
1611
|
-
},
|
|
1612
|
-
],
|
|
1613
|
-
isError: !result.ok,
|
|
1614
|
-
};
|
|
1615
|
-
}
|
|
1616
|
-
if (name === "kage_org_recall") {
|
|
1617
|
-
const result = (0, kernel_js_1.orgRecall)(String(args?.project_dir ?? ""), String(args?.org ?? "local"), String(args?.query ?? ""), Number(args?.limit ?? 5));
|
|
1618
|
-
return {
|
|
1619
|
-
content: [{ type: "text", text: args?.json ? JSON.stringify(result, null, 2) : result.context_block }],
|
|
1620
|
-
};
|
|
1621
|
-
}
|
|
1622
|
-
if (name === "kage_layered_recall") {
|
|
1623
|
-
const result = (0, kernel_js_1.layeredRecall)(String(args?.project_dir ?? ""), String(args?.query ?? ""), {
|
|
1624
|
-
org: args?.org ? String(args.org) : undefined,
|
|
1625
|
-
includeGlobal: Boolean(args?.include_global),
|
|
1626
|
-
});
|
|
1627
|
-
return {
|
|
1628
|
-
content: [{ type: "text", text: args?.json ? JSON.stringify(result, null, 2) : result.context_block }],
|
|
1629
|
-
};
|
|
1630
|
-
}
|
|
1631
|
-
if (name === "kage_global_build") {
|
|
1632
|
-
const result = (0, kernel_js_1.buildGlobalCdnBundle)(String(args?.project_dir ?? ""), String(args?.org ?? "local"));
|
|
1633
|
-
return {
|
|
1634
|
-
content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
|
|
1635
|
-
isError: !result.ok,
|
|
1636
|
-
};
|
|
1637
|
-
}
|
|
1638
|
-
if (name === "kage_promote_public_candidate") {
|
|
1639
|
-
const result = (0, kernel_js_1.createPublicCandidate)(String(args?.project_dir ?? ""), String(args?.packet_id ?? ""));
|
|
1640
|
-
return {
|
|
1641
|
-
content: [
|
|
1642
|
-
{
|
|
1643
|
-
type: "text",
|
|
1644
|
-
text: result.ok
|
|
1645
|
-
? `Created local public-review candidate: ${result.path}\nThis does not publish until a human submits it.`
|
|
1646
|
-
: `Promotion blocked:\n${result.errors.map((error) => `- ${error}`).join("\n")}`,
|
|
1647
|
-
},
|
|
1648
|
-
],
|
|
1649
|
-
isError: !result.ok,
|
|
1650
|
-
};
|
|
1651
|
-
}
|
|
1652
|
-
if (name === "kage_export_public_bundle") {
|
|
1653
|
-
const result = (0, kernel_js_1.exportPublicBundle)(String(args?.project_dir ?? ""));
|
|
1654
|
-
return {
|
|
1655
|
-
content: [
|
|
1656
|
-
{
|
|
1657
|
-
type: "text",
|
|
1658
|
-
text: result.ok
|
|
1659
|
-
? `Exported public bundle: ${result.path}\nPackets: ${result.packetCount}`
|
|
1660
|
-
: `Public bundle blocked:\n${result.errors.map((error) => `- ${error}`).join("\n")}`,
|
|
1661
|
-
},
|
|
1662
|
-
],
|
|
1663
|
-
isError: !result.ok,
|
|
1664
|
-
};
|
|
1665
|
-
}
|
|
1666
1498
|
if (name === "kage_review_artifact") {
|
|
1667
1499
|
const result = (0, kernel_js_1.createReviewArtifact)(String(args?.project_dir ?? ""));
|
|
1668
1500
|
return {
|
|
@@ -1705,5 +1537,15 @@ if (require.main === module) {
|
|
|
1705
1537
|
const result = spawnSync(process.execPath, [join(__dirname, "cli.js"), ...process.argv.slice(2)], { stdio: "inherit" });
|
|
1706
1538
|
process.exit(result.status ?? 0);
|
|
1707
1539
|
}
|
|
1540
|
+
if (process.stdin.isTTY && process.stdout.isTTY) {
|
|
1541
|
+
// A human in a terminal, not an MCP client: blocking silently on stdio here
|
|
1542
|
+
// reads as "the tool printed nothing and hung". Run the 30-second demo instead.
|
|
1543
|
+
const { spawnSync } = require("node:child_process");
|
|
1544
|
+
const { join } = require("node:path");
|
|
1545
|
+
console.log("Kage MCP server — normally launched by an MCP client (Claude Code, Codex, Cursor, ...).");
|
|
1546
|
+
console.log("You're in a terminal, so here's the 30-second demo instead:\n");
|
|
1547
|
+
const result = spawnSync(process.execPath, [join(__dirname, "cli.js"), "demo"], { stdio: "inherit" });
|
|
1548
|
+
process.exit(result.status ?? 0);
|
|
1549
|
+
}
|
|
1708
1550
|
main().catch(console.error);
|
|
1709
1551
|
}
|