@swarmvaultai/engine 0.1.8 → 0.1.9
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 +96 -79
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1059,7 +1059,7 @@ import fs10 from "fs/promises";
|
|
|
1059
1059
|
import path14 from "path";
|
|
1060
1060
|
import { McpServer, ResourceTemplate } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
1061
1061
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
1062
|
-
import { z as
|
|
1062
|
+
import { z as z8 } from "zod";
|
|
1063
1063
|
|
|
1064
1064
|
// src/schema.ts
|
|
1065
1065
|
import fs4 from "fs/promises";
|
|
@@ -1172,7 +1172,7 @@ function buildSchemaPrompt(schema, instruction) {
|
|
|
1172
1172
|
import fs9 from "fs/promises";
|
|
1173
1173
|
import path13 from "path";
|
|
1174
1174
|
import matter7 from "gray-matter";
|
|
1175
|
-
import { z as
|
|
1175
|
+
import { z as z7 } from "zod";
|
|
1176
1176
|
|
|
1177
1177
|
// src/analysis.ts
|
|
1178
1178
|
import path6 from "path";
|
|
@@ -1407,29 +1407,46 @@ function conflictConfidence(claimA, claimB) {
|
|
|
1407
1407
|
import fs5 from "fs/promises";
|
|
1408
1408
|
import path9 from "path";
|
|
1409
1409
|
import matter2 from "gray-matter";
|
|
1410
|
-
import { z as
|
|
1410
|
+
import { z as z5 } from "zod";
|
|
1411
|
+
|
|
1412
|
+
// src/findings.ts
|
|
1413
|
+
import { z as z2 } from "zod";
|
|
1414
|
+
function normalizeFindingSeverity(value) {
|
|
1415
|
+
if (typeof value !== "string") {
|
|
1416
|
+
return "info";
|
|
1417
|
+
}
|
|
1418
|
+
const normalized = value.trim().toLowerCase();
|
|
1419
|
+
if (normalized === "error" || normalized === "critical" || normalized === "fatal" || normalized === "high" || normalized === "severe") {
|
|
1420
|
+
return "error";
|
|
1421
|
+
}
|
|
1422
|
+
if (normalized === "warning" || normalized === "warn" || normalized === "medium" || normalized === "moderate" || normalized === "caution") {
|
|
1423
|
+
return "warning";
|
|
1424
|
+
}
|
|
1425
|
+
return "info";
|
|
1426
|
+
}
|
|
1427
|
+
var findingSeveritySchema = z2.any().transform((value) => normalizeFindingSeverity(value));
|
|
1411
1428
|
|
|
1412
1429
|
// src/orchestration.ts
|
|
1413
1430
|
import { spawn } from "child_process";
|
|
1414
1431
|
import path7 from "path";
|
|
1415
|
-
import { z as
|
|
1416
|
-
var orchestrationRoleResultSchema =
|
|
1417
|
-
summary:
|
|
1418
|
-
findings:
|
|
1419
|
-
|
|
1420
|
-
severity:
|
|
1421
|
-
message:
|
|
1422
|
-
relatedPageIds:
|
|
1423
|
-
relatedSourceIds:
|
|
1424
|
-
suggestedQuery:
|
|
1432
|
+
import { z as z3 } from "zod";
|
|
1433
|
+
var orchestrationRoleResultSchema = z3.object({
|
|
1434
|
+
summary: z3.string().optional(),
|
|
1435
|
+
findings: z3.array(
|
|
1436
|
+
z3.object({
|
|
1437
|
+
severity: findingSeveritySchema,
|
|
1438
|
+
message: z3.string().min(1),
|
|
1439
|
+
relatedPageIds: z3.array(z3.string()).optional(),
|
|
1440
|
+
relatedSourceIds: z3.array(z3.string()).optional(),
|
|
1441
|
+
suggestedQuery: z3.string().optional()
|
|
1425
1442
|
})
|
|
1426
1443
|
).default([]),
|
|
1427
|
-
questions:
|
|
1428
|
-
proposals:
|
|
1429
|
-
|
|
1430
|
-
path:
|
|
1431
|
-
content:
|
|
1432
|
-
reason:
|
|
1444
|
+
questions: z3.array(z3.string().min(1)).default([]),
|
|
1445
|
+
proposals: z3.array(
|
|
1446
|
+
z3.object({
|
|
1447
|
+
path: z3.string().min(1),
|
|
1448
|
+
content: z3.string().min(1),
|
|
1449
|
+
reason: z3.string().min(1)
|
|
1433
1450
|
})
|
|
1434
1451
|
).default([])
|
|
1435
1452
|
});
|
|
@@ -1600,7 +1617,7 @@ function summarizeRoleQuestions(results) {
|
|
|
1600
1617
|
// src/web-search/registry.ts
|
|
1601
1618
|
import path8 from "path";
|
|
1602
1619
|
import { pathToFileURL } from "url";
|
|
1603
|
-
import { z as
|
|
1620
|
+
import { z as z4 } from "zod";
|
|
1604
1621
|
|
|
1605
1622
|
// src/web-search/http-json.ts
|
|
1606
1623
|
function deepGet(value, pathValue) {
|
|
@@ -1682,10 +1699,10 @@ var HttpJsonWebSearchAdapter = class {
|
|
|
1682
1699
|
};
|
|
1683
1700
|
|
|
1684
1701
|
// src/web-search/registry.ts
|
|
1685
|
-
var customWebSearchModuleSchema =
|
|
1686
|
-
createAdapter:
|
|
1687
|
-
input: [
|
|
1688
|
-
output:
|
|
1702
|
+
var customWebSearchModuleSchema = z4.object({
|
|
1703
|
+
createAdapter: z4.function({
|
|
1704
|
+
input: [z4.string(), z4.custom(), z4.string()],
|
|
1705
|
+
output: z4.promise(z4.custom())
|
|
1689
1706
|
})
|
|
1690
1707
|
});
|
|
1691
1708
|
async function createWebSearchAdapter(id, config, rootDir) {
|
|
@@ -1720,15 +1737,15 @@ async function getWebSearchAdapterForTask(rootDir, task) {
|
|
|
1720
1737
|
}
|
|
1721
1738
|
|
|
1722
1739
|
// src/deep-lint.ts
|
|
1723
|
-
var deepLintResponseSchema =
|
|
1724
|
-
findings:
|
|
1725
|
-
|
|
1726
|
-
severity:
|
|
1727
|
-
code:
|
|
1728
|
-
message:
|
|
1729
|
-
relatedSourceIds:
|
|
1730
|
-
relatedPageIds:
|
|
1731
|
-
suggestedQuery:
|
|
1740
|
+
var deepLintResponseSchema = z5.object({
|
|
1741
|
+
findings: z5.array(
|
|
1742
|
+
z5.object({
|
|
1743
|
+
severity: findingSeveritySchema,
|
|
1744
|
+
code: z5.enum(["coverage_gap", "contradiction_candidate", "missing_citation", "candidate_page", "follow_up_question"]),
|
|
1745
|
+
message: z5.string().min(1),
|
|
1746
|
+
relatedSourceIds: z5.array(z5.string()).default([]),
|
|
1747
|
+
relatedPageIds: z5.array(z5.string()).default([]),
|
|
1748
|
+
suggestedQuery: z5.string().optional()
|
|
1732
1749
|
})
|
|
1733
1750
|
).max(20)
|
|
1734
1751
|
});
|
|
@@ -2788,49 +2805,49 @@ function buildExploreHubPage(input) {
|
|
|
2788
2805
|
}
|
|
2789
2806
|
|
|
2790
2807
|
// src/output-artifacts.ts
|
|
2791
|
-
import { z as
|
|
2808
|
+
import { z as z6 } from "zod";
|
|
2792
2809
|
function escapeXml(value) {
|
|
2793
2810
|
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
2794
2811
|
}
|
|
2795
2812
|
function clampNumber(value, min, max) {
|
|
2796
2813
|
return Math.min(max, Math.max(min, value));
|
|
2797
2814
|
}
|
|
2798
|
-
var chartSpecSchema =
|
|
2799
|
-
kind:
|
|
2800
|
-
title:
|
|
2801
|
-
subtitle:
|
|
2802
|
-
xLabel:
|
|
2803
|
-
yLabel:
|
|
2804
|
-
seriesLabel:
|
|
2805
|
-
data:
|
|
2806
|
-
|
|
2807
|
-
label:
|
|
2808
|
-
value:
|
|
2815
|
+
var chartSpecSchema = z6.object({
|
|
2816
|
+
kind: z6.enum(["bar", "line"]).default("bar"),
|
|
2817
|
+
title: z6.string().min(1),
|
|
2818
|
+
subtitle: z6.string().optional(),
|
|
2819
|
+
xLabel: z6.string().optional(),
|
|
2820
|
+
yLabel: z6.string().optional(),
|
|
2821
|
+
seriesLabel: z6.string().optional(),
|
|
2822
|
+
data: z6.array(
|
|
2823
|
+
z6.object({
|
|
2824
|
+
label: z6.string().min(1),
|
|
2825
|
+
value: z6.number().finite()
|
|
2809
2826
|
})
|
|
2810
2827
|
).min(2).max(12),
|
|
2811
|
-
notes:
|
|
2828
|
+
notes: z6.array(z6.string().min(1)).max(5).optional()
|
|
2812
2829
|
});
|
|
2813
|
-
var sceneSpecSchema =
|
|
2814
|
-
title:
|
|
2815
|
-
alt:
|
|
2816
|
-
background:
|
|
2817
|
-
width:
|
|
2818
|
-
height:
|
|
2819
|
-
elements:
|
|
2820
|
-
|
|
2821
|
-
kind:
|
|
2822
|
-
shape:
|
|
2823
|
-
x:
|
|
2824
|
-
y:
|
|
2825
|
-
width:
|
|
2826
|
-
height:
|
|
2827
|
-
radius:
|
|
2828
|
-
text:
|
|
2829
|
-
fontSize:
|
|
2830
|
-
fill:
|
|
2831
|
-
stroke:
|
|
2832
|
-
strokeWidth:
|
|
2833
|
-
opacity:
|
|
2830
|
+
var sceneSpecSchema = z6.object({
|
|
2831
|
+
title: z6.string().min(1),
|
|
2832
|
+
alt: z6.string().min(1),
|
|
2833
|
+
background: z6.string().optional(),
|
|
2834
|
+
width: z6.number().int().positive().max(2400).optional(),
|
|
2835
|
+
height: z6.number().int().positive().max(2400).optional(),
|
|
2836
|
+
elements: z6.array(
|
|
2837
|
+
z6.object({
|
|
2838
|
+
kind: z6.enum(["shape", "label"]),
|
|
2839
|
+
shape: z6.enum(["rect", "circle", "line"]).optional(),
|
|
2840
|
+
x: z6.number().finite(),
|
|
2841
|
+
y: z6.number().finite(),
|
|
2842
|
+
width: z6.number().finite().optional(),
|
|
2843
|
+
height: z6.number().finite().optional(),
|
|
2844
|
+
radius: z6.number().finite().optional(),
|
|
2845
|
+
text: z6.string().optional(),
|
|
2846
|
+
fontSize: z6.number().finite().optional(),
|
|
2847
|
+
fill: z6.string().optional(),
|
|
2848
|
+
stroke: z6.string().optional(),
|
|
2849
|
+
strokeWidth: z6.number().finite().optional(),
|
|
2850
|
+
opacity: z6.number().finite().optional()
|
|
2834
2851
|
})
|
|
2835
2852
|
).min(1).max(32)
|
|
2836
2853
|
});
|
|
@@ -5316,8 +5333,8 @@ async function generateFollowUpQuestions(rootDir, question, answer) {
|
|
|
5316
5333
|
Current answer:
|
|
5317
5334
|
${answer}`
|
|
5318
5335
|
},
|
|
5319
|
-
|
|
5320
|
-
questions:
|
|
5336
|
+
z7.object({
|
|
5337
|
+
questions: z7.array(z7.string().min(1)).max(5)
|
|
5321
5338
|
})
|
|
5322
5339
|
);
|
|
5323
5340
|
return uniqueBy(response.questions, (item) => item).filter((item) => item !== question);
|
|
@@ -6514,7 +6531,7 @@ async function bootstrapDemo(rootDir, input) {
|
|
|
6514
6531
|
}
|
|
6515
6532
|
|
|
6516
6533
|
// src/mcp.ts
|
|
6517
|
-
var SERVER_VERSION = "0.1.
|
|
6534
|
+
var SERVER_VERSION = "0.1.9";
|
|
6518
6535
|
async function createMcpServer(rootDir) {
|
|
6519
6536
|
const server = new McpServer({
|
|
6520
6537
|
name: "swarmvault",
|
|
@@ -6536,8 +6553,8 @@ async function createMcpServer(rootDir) {
|
|
|
6536
6553
|
{
|
|
6537
6554
|
description: "Search compiled wiki pages using the local full-text index.",
|
|
6538
6555
|
inputSchema: {
|
|
6539
|
-
query:
|
|
6540
|
-
limit:
|
|
6556
|
+
query: z8.string().min(1).describe("Search query"),
|
|
6557
|
+
limit: z8.number().int().min(1).max(25).optional().describe("Maximum number of results")
|
|
6541
6558
|
}
|
|
6542
6559
|
},
|
|
6543
6560
|
async ({ query, limit }) => {
|
|
@@ -6550,7 +6567,7 @@ async function createMcpServer(rootDir) {
|
|
|
6550
6567
|
{
|
|
6551
6568
|
description: "Read a generated wiki page by its path relative to wiki/.",
|
|
6552
6569
|
inputSchema: {
|
|
6553
|
-
path:
|
|
6570
|
+
path: z8.string().min(1).describe("Path relative to wiki/, for example sources/example.md")
|
|
6554
6571
|
}
|
|
6555
6572
|
},
|
|
6556
6573
|
async ({ path: relativePath }) => {
|
|
@@ -6566,7 +6583,7 @@ async function createMcpServer(rootDir) {
|
|
|
6566
6583
|
{
|
|
6567
6584
|
description: "List source manifests in the current workspace.",
|
|
6568
6585
|
inputSchema: {
|
|
6569
|
-
limit:
|
|
6586
|
+
limit: z8.number().int().min(1).max(100).optional().describe("Maximum number of manifests to return")
|
|
6570
6587
|
}
|
|
6571
6588
|
},
|
|
6572
6589
|
async ({ limit }) => {
|
|
@@ -6579,9 +6596,9 @@ async function createMcpServer(rootDir) {
|
|
|
6579
6596
|
{
|
|
6580
6597
|
description: "Ask a question against the compiled vault and optionally save the answer.",
|
|
6581
6598
|
inputSchema: {
|
|
6582
|
-
question:
|
|
6583
|
-
save:
|
|
6584
|
-
format:
|
|
6599
|
+
question: z8.string().min(1).describe("Question to ask the vault"),
|
|
6600
|
+
save: z8.boolean().optional().describe("Persist the answer to wiki/outputs"),
|
|
6601
|
+
format: z8.enum(["markdown", "report", "slides", "chart", "image"]).optional().describe("Output format")
|
|
6585
6602
|
}
|
|
6586
6603
|
},
|
|
6587
6604
|
async ({ question, save, format }) => {
|
|
@@ -6598,7 +6615,7 @@ async function createMcpServer(rootDir) {
|
|
|
6598
6615
|
{
|
|
6599
6616
|
description: "Ingest a local file path or URL into the SwarmVault workspace.",
|
|
6600
6617
|
inputSchema: {
|
|
6601
|
-
input:
|
|
6618
|
+
input: z8.string().min(1).describe("Local path or URL to ingest")
|
|
6602
6619
|
}
|
|
6603
6620
|
},
|
|
6604
6621
|
async ({ input }) => {
|
|
@@ -6611,7 +6628,7 @@ async function createMcpServer(rootDir) {
|
|
|
6611
6628
|
{
|
|
6612
6629
|
description: "Compile source manifests into wiki pages, graph data, and search index.",
|
|
6613
6630
|
inputSchema: {
|
|
6614
|
-
approve:
|
|
6631
|
+
approve: z8.boolean().optional().describe("Stage a review bundle without applying active page changes")
|
|
6615
6632
|
}
|
|
6616
6633
|
},
|
|
6617
6634
|
async ({ approve }) => {
|