@swarmvaultai/engine 0.1.9 → 0.1.10

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.
Files changed (2) hide show
  1. package/dist/index.js +82 -84
  2. 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 z8 } from "zod";
1062
+ import { z as z7 } 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 z7 } from "zod";
1175
+ import { z as z6 } from "zod";
1176
1176
 
1177
1177
  // src/analysis.ts
1178
1178
  import path6 from "path";
@@ -1407,10 +1407,9 @@ 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 z5 } from "zod";
1410
+ import { z as z4 } from "zod";
1411
1411
 
1412
1412
  // src/findings.ts
1413
- import { z as z2 } from "zod";
1414
1413
  function normalizeFindingSeverity(value) {
1415
1414
  if (typeof value !== "string") {
1416
1415
  return "info";
@@ -1424,29 +1423,28 @@ function normalizeFindingSeverity(value) {
1424
1423
  }
1425
1424
  return "info";
1426
1425
  }
1427
- var findingSeveritySchema = z2.any().transform((value) => normalizeFindingSeverity(value));
1428
1426
 
1429
1427
  // src/orchestration.ts
1430
1428
  import { spawn } from "child_process";
1431
1429
  import path7 from "path";
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()
1430
+ import { z as z2 } from "zod";
1431
+ var orchestrationRoleResultSchema = z2.object({
1432
+ summary: z2.string().optional(),
1433
+ findings: z2.array(
1434
+ z2.object({
1435
+ severity: z2.string().optional().default("info"),
1436
+ message: z2.string().min(1),
1437
+ relatedPageIds: z2.array(z2.string()).optional(),
1438
+ relatedSourceIds: z2.array(z2.string()).optional(),
1439
+ suggestedQuery: z2.string().optional()
1442
1440
  })
1443
1441
  ).default([]),
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)
1442
+ questions: z2.array(z2.string().min(1)).default([]),
1443
+ proposals: z2.array(
1444
+ z2.object({
1445
+ path: z2.string().min(1),
1446
+ content: z2.string().min(1),
1447
+ reason: z2.string().min(1)
1450
1448
  })
1451
1449
  ).default([])
1452
1450
  });
@@ -1514,7 +1512,7 @@ async function runProviderRole(rootDir, role, roleConfig, input) {
1514
1512
  return {
1515
1513
  role,
1516
1514
  summary: result.summary,
1517
- findings: result.findings.map((finding) => ({ role, ...finding })),
1515
+ findings: result.findings.map((finding) => ({ role, ...finding, severity: normalizeFindingSeverity(finding.severity) })),
1518
1516
  questions: result.questions,
1519
1517
  proposals: result.proposals
1520
1518
  };
@@ -1566,7 +1564,7 @@ async function runCommandRole(rootDir, role, executor, input) {
1566
1564
  return {
1567
1565
  role,
1568
1566
  summary: parsed.summary,
1569
- findings: parsed.findings.map((finding) => ({ role, ...finding })),
1567
+ findings: parsed.findings.map((finding) => ({ role, ...finding, severity: normalizeFindingSeverity(finding.severity) })),
1570
1568
  questions: parsed.questions,
1571
1569
  proposals: parsed.proposals
1572
1570
  };
@@ -1617,7 +1615,7 @@ function summarizeRoleQuestions(results) {
1617
1615
  // src/web-search/registry.ts
1618
1616
  import path8 from "path";
1619
1617
  import { pathToFileURL } from "url";
1620
- import { z as z4 } from "zod";
1618
+ import { z as z3 } from "zod";
1621
1619
 
1622
1620
  // src/web-search/http-json.ts
1623
1621
  function deepGet(value, pathValue) {
@@ -1699,10 +1697,10 @@ var HttpJsonWebSearchAdapter = class {
1699
1697
  };
1700
1698
 
1701
1699
  // src/web-search/registry.ts
1702
- var customWebSearchModuleSchema = z4.object({
1703
- createAdapter: z4.function({
1704
- input: [z4.string(), z4.custom(), z4.string()],
1705
- output: z4.promise(z4.custom())
1700
+ var customWebSearchModuleSchema = z3.object({
1701
+ createAdapter: z3.function({
1702
+ input: [z3.string(), z3.custom(), z3.string()],
1703
+ output: z3.promise(z3.custom())
1706
1704
  })
1707
1705
  });
1708
1706
  async function createWebSearchAdapter(id, config, rootDir) {
@@ -1737,15 +1735,15 @@ async function getWebSearchAdapterForTask(rootDir, task) {
1737
1735
  }
1738
1736
 
1739
1737
  // src/deep-lint.ts
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()
1738
+ var deepLintResponseSchema = z4.object({
1739
+ findings: z4.array(
1740
+ z4.object({
1741
+ severity: z4.string().optional().default("info"),
1742
+ code: z4.enum(["coverage_gap", "contradiction_candidate", "missing_citation", "candidate_page", "follow_up_question"]),
1743
+ message: z4.string().min(1),
1744
+ relatedSourceIds: z4.array(z4.string()).default([]),
1745
+ relatedPageIds: z4.array(z4.string()).default([]),
1746
+ suggestedQuery: z4.string().optional()
1749
1747
  })
1750
1748
  ).max(20)
1751
1749
  });
@@ -1912,7 +1910,7 @@ async function runDeepLint(rootDir, structuralFindings, options = {}) {
1912
1910
  deepLintResponseSchema
1913
1911
  );
1914
1912
  findings = response.findings.map((item) => ({
1915
- severity: item.severity,
1913
+ severity: normalizeFindingSeverity(item.severity),
1916
1914
  code: item.code,
1917
1915
  message: item.message,
1918
1916
  relatedSourceIds: item.relatedSourceIds,
@@ -2805,49 +2803,49 @@ function buildExploreHubPage(input) {
2805
2803
  }
2806
2804
 
2807
2805
  // src/output-artifacts.ts
2808
- import { z as z6 } from "zod";
2806
+ import { z as z5 } from "zod";
2809
2807
  function escapeXml(value) {
2810
2808
  return value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&apos;");
2811
2809
  }
2812
2810
  function clampNumber(value, min, max) {
2813
2811
  return Math.min(max, Math.max(min, value));
2814
2812
  }
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()
2813
+ var chartSpecSchema = z5.object({
2814
+ kind: z5.enum(["bar", "line"]).default("bar"),
2815
+ title: z5.string().min(1),
2816
+ subtitle: z5.string().optional(),
2817
+ xLabel: z5.string().optional(),
2818
+ yLabel: z5.string().optional(),
2819
+ seriesLabel: z5.string().optional(),
2820
+ data: z5.array(
2821
+ z5.object({
2822
+ label: z5.string().min(1),
2823
+ value: z5.number().finite()
2826
2824
  })
2827
2825
  ).min(2).max(12),
2828
- notes: z6.array(z6.string().min(1)).max(5).optional()
2826
+ notes: z5.array(z5.string().min(1)).max(5).optional()
2829
2827
  });
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()
2828
+ var sceneSpecSchema = z5.object({
2829
+ title: z5.string().min(1),
2830
+ alt: z5.string().min(1),
2831
+ background: z5.string().optional(),
2832
+ width: z5.number().int().positive().max(2400).optional(),
2833
+ height: z5.number().int().positive().max(2400).optional(),
2834
+ elements: z5.array(
2835
+ z5.object({
2836
+ kind: z5.enum(["shape", "label"]),
2837
+ shape: z5.enum(["rect", "circle", "line"]).optional(),
2838
+ x: z5.number().finite(),
2839
+ y: z5.number().finite(),
2840
+ width: z5.number().finite().optional(),
2841
+ height: z5.number().finite().optional(),
2842
+ radius: z5.number().finite().optional(),
2843
+ text: z5.string().optional(),
2844
+ fontSize: z5.number().finite().optional(),
2845
+ fill: z5.string().optional(),
2846
+ stroke: z5.string().optional(),
2847
+ strokeWidth: z5.number().finite().optional(),
2848
+ opacity: z5.number().finite().optional()
2851
2849
  })
2852
2850
  ).min(1).max(32)
2853
2851
  });
@@ -5333,8 +5331,8 @@ async function generateFollowUpQuestions(rootDir, question, answer) {
5333
5331
  Current answer:
5334
5332
  ${answer}`
5335
5333
  },
5336
- z7.object({
5337
- questions: z7.array(z7.string().min(1)).max(5)
5334
+ z6.object({
5335
+ questions: z6.array(z6.string().min(1)).max(5)
5338
5336
  })
5339
5337
  );
5340
5338
  return uniqueBy(response.questions, (item) => item).filter((item) => item !== question);
@@ -6531,7 +6529,7 @@ async function bootstrapDemo(rootDir, input) {
6531
6529
  }
6532
6530
 
6533
6531
  // src/mcp.ts
6534
- var SERVER_VERSION = "0.1.9";
6532
+ var SERVER_VERSION = "0.1.10";
6535
6533
  async function createMcpServer(rootDir) {
6536
6534
  const server = new McpServer({
6537
6535
  name: "swarmvault",
@@ -6553,8 +6551,8 @@ async function createMcpServer(rootDir) {
6553
6551
  {
6554
6552
  description: "Search compiled wiki pages using the local full-text index.",
6555
6553
  inputSchema: {
6556
- query: z8.string().min(1).describe("Search query"),
6557
- limit: z8.number().int().min(1).max(25).optional().describe("Maximum number of results")
6554
+ query: z7.string().min(1).describe("Search query"),
6555
+ limit: z7.number().int().min(1).max(25).optional().describe("Maximum number of results")
6558
6556
  }
6559
6557
  },
6560
6558
  async ({ query, limit }) => {
@@ -6567,7 +6565,7 @@ async function createMcpServer(rootDir) {
6567
6565
  {
6568
6566
  description: "Read a generated wiki page by its path relative to wiki/.",
6569
6567
  inputSchema: {
6570
- path: z8.string().min(1).describe("Path relative to wiki/, for example sources/example.md")
6568
+ path: z7.string().min(1).describe("Path relative to wiki/, for example sources/example.md")
6571
6569
  }
6572
6570
  },
6573
6571
  async ({ path: relativePath }) => {
@@ -6583,7 +6581,7 @@ async function createMcpServer(rootDir) {
6583
6581
  {
6584
6582
  description: "List source manifests in the current workspace.",
6585
6583
  inputSchema: {
6586
- limit: z8.number().int().min(1).max(100).optional().describe("Maximum number of manifests to return")
6584
+ limit: z7.number().int().min(1).max(100).optional().describe("Maximum number of manifests to return")
6587
6585
  }
6588
6586
  },
6589
6587
  async ({ limit }) => {
@@ -6596,9 +6594,9 @@ async function createMcpServer(rootDir) {
6596
6594
  {
6597
6595
  description: "Ask a question against the compiled vault and optionally save the answer.",
6598
6596
  inputSchema: {
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")
6597
+ question: z7.string().min(1).describe("Question to ask the vault"),
6598
+ save: z7.boolean().optional().describe("Persist the answer to wiki/outputs"),
6599
+ format: z7.enum(["markdown", "report", "slides", "chart", "image"]).optional().describe("Output format")
6602
6600
  }
6603
6601
  },
6604
6602
  async ({ question, save, format }) => {
@@ -6615,7 +6613,7 @@ async function createMcpServer(rootDir) {
6615
6613
  {
6616
6614
  description: "Ingest a local file path or URL into the SwarmVault workspace.",
6617
6615
  inputSchema: {
6618
- input: z8.string().min(1).describe("Local path or URL to ingest")
6616
+ input: z7.string().min(1).describe("Local path or URL to ingest")
6619
6617
  }
6620
6618
  },
6621
6619
  async ({ input }) => {
@@ -6628,7 +6626,7 @@ async function createMcpServer(rootDir) {
6628
6626
  {
6629
6627
  description: "Compile source manifests into wiki pages, graph data, and search index.",
6630
6628
  inputSchema: {
6631
- approve: z8.boolean().optional().describe("Stage a review bundle without applying active page changes")
6629
+ approve: z7.boolean().optional().describe("Stage a review bundle without applying active page changes")
6632
6630
  }
6633
6631
  },
6634
6632
  async ({ approve }) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swarmvaultai/engine",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "description": "Core engine for SwarmVault: ingest, compile, query, lint, and provider abstractions.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",