@swarmvaultai/viewer 0.7.31 → 0.9.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/dist/index.html CHANGED
@@ -4,8 +4,8 @@
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>SwarmVault Graph</title>
7
- <script type="module" crossorigin src="/assets/index-CwkhOTfH.js"></script>
8
- <link rel="stylesheet" crossorigin href="/assets/index-DRAglPyY.css">
7
+ <script type="module" crossorigin src="/assets/index-QQ74kUX8.js"></script>
8
+ <link rel="stylesheet" crossorigin href="/assets/index-CRcCxyS8.css">
9
9
  </head>
10
10
  <body>
11
11
  <div id="root"></div>
package/dist/lib.d.ts CHANGED
@@ -225,6 +225,26 @@ type ViewerCandidateRecord = {
225
225
  sourceIds: string[];
226
226
  createdAt: string;
227
227
  updatedAt: string;
228
+ score?: number;
229
+ scoreBreakdown?: Record<string, number>;
230
+ };
231
+ type ViewerLintFinding = {
232
+ id: string;
233
+ severity: "error" | "warning" | "info";
234
+ category: string;
235
+ message: string;
236
+ pageId?: string;
237
+ pagePath?: string;
238
+ nodeId?: string;
239
+ detectedAt?: string;
240
+ };
241
+ type ViewerWorkspaceBundle = {
242
+ graph: ViewerGraphArtifact;
243
+ approvals: ViewerApprovalSummary[];
244
+ candidates: ViewerCandidateRecord[];
245
+ watchStatus: ViewerWatchStatus;
246
+ graphReport: ViewerGraphReport | null;
247
+ lintFindings: ViewerLintFinding[];
228
248
  };
229
249
  type ViewerWatchStatus = {
230
250
  generatedAt: string;
@@ -353,5 +373,16 @@ declare function applyReviewAction(approvalId: string, action: "accept" | "rejec
353
373
  declare function fetchCandidates(): Promise<ViewerCandidateRecord[]>;
354
374
  declare function applyCandidateAction(target: string, action: "promote" | "archive"): Promise<ViewerCandidateRecord>;
355
375
  declare function fetchWatchStatus(): Promise<ViewerWatchStatus>;
376
+ declare function fetchLintFindings(): Promise<ViewerLintFinding[]>;
377
+ declare function fetchWorkspaceBundle(): Promise<ViewerWorkspaceBundle | null>;
378
+ type SubgraphExportPayload = {
379
+ generatedAt: string;
380
+ rootNodeId?: string;
381
+ nodes: ViewerGraphNode[];
382
+ edges: ViewerGraphEdge[];
383
+ };
384
+ declare function buildSubgraphExport(graph: ViewerGraphArtifact, nodeIds: string[]): SubgraphExportPayload;
385
+ declare function downloadDataUrl(filename: string, dataUrl: string): void;
386
+ declare function downloadText(filename: string, text: string, mime?: string): void;
356
387
 
357
- export { type ViewerApprovalDetail, type ViewerApprovalDiffHunk, type ViewerApprovalDiffLine, type ViewerApprovalEntry, type ViewerApprovalFrontmatterChange, type ViewerApprovalStructuredDiff, type ViewerApprovalSummary, type ViewerCandidateRecord, type ViewerGraphArtifact, type ViewerGraphEdge, type ViewerGraphExplainResult, type ViewerGraphHyperedge, type ViewerGraphNode, type ViewerGraphPage, type ViewerGraphPathResult, type ViewerGraphQueryResult, type ViewerGraphReport, type ViewerOutputAsset, type ViewerPagePayload, type ViewerReviewActionResult, type ViewerSearchOptions, type ViewerSearchResult, type ViewerWatchStatus, applyCandidateAction, applyReviewAction, fetchApprovalDetail, fetchApprovals, fetchCandidates, fetchGraphArtifact, fetchGraphExplain, fetchGraphPath, fetchGraphQuery, fetchGraphReport, fetchViewerPage, fetchWatchStatus, searchViewerPages };
388
+ export { type SubgraphExportPayload, type ViewerApprovalDetail, type ViewerApprovalDiffHunk, type ViewerApprovalDiffLine, type ViewerApprovalEntry, type ViewerApprovalFrontmatterChange, type ViewerApprovalStructuredDiff, type ViewerApprovalSummary, type ViewerCandidateRecord, type ViewerGraphArtifact, type ViewerGraphEdge, type ViewerGraphExplainResult, type ViewerGraphHyperedge, type ViewerGraphNode, type ViewerGraphPage, type ViewerGraphPathResult, type ViewerGraphQueryResult, type ViewerGraphReport, type ViewerLintFinding, type ViewerOutputAsset, type ViewerPagePayload, type ViewerReviewActionResult, type ViewerSearchOptions, type ViewerSearchResult, type ViewerWatchStatus, type ViewerWorkspaceBundle, applyCandidateAction, applyReviewAction, buildSubgraphExport, downloadDataUrl, downloadText, fetchApprovalDetail, fetchApprovals, fetchCandidates, fetchGraphArtifact, fetchGraphExplain, fetchGraphPath, fetchGraphQuery, fetchGraphReport, fetchLintFindings, fetchViewerPage, fetchWatchStatus, fetchWorkspaceBundle, searchViewerPages };
package/dist/lib.js CHANGED
@@ -537,9 +537,62 @@ async function fetchWatchStatus() {
537
537
  }
538
538
  return response.json();
539
539
  }
540
+ async function fetchLintFindings() {
541
+ if (embeddedData()) {
542
+ return [];
543
+ }
544
+ const response = await fetch("/api/lint");
545
+ if (response.status === 404) {
546
+ return [];
547
+ }
548
+ if (!response.ok) {
549
+ throw new Error(`Failed to load lint findings: ${response.status} ${response.statusText}`);
550
+ }
551
+ return response.json();
552
+ }
553
+ async function fetchWorkspaceBundle() {
554
+ if (embeddedData()) {
555
+ return null;
556
+ }
557
+ const response = await fetch("/api/workspace");
558
+ if (response.status === 404) return null;
559
+ if (!response.ok) {
560
+ throw new Error(`Failed to load workspace bundle: ${response.status} ${response.statusText}`);
561
+ }
562
+ return response.json();
563
+ }
564
+ function buildSubgraphExport(graph, nodeIds) {
565
+ const nodeSet = new Set(nodeIds);
566
+ const nodes = graph.nodes.filter((node) => nodeSet.has(node.id));
567
+ const edges = graph.edges.filter((edge) => nodeSet.has(edge.source) && nodeSet.has(edge.target));
568
+ return {
569
+ generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
570
+ rootNodeId: nodeIds[0],
571
+ nodes,
572
+ edges
573
+ };
574
+ }
575
+ function downloadDataUrl(filename, dataUrl) {
576
+ if (typeof document === "undefined") return;
577
+ const link = document.createElement("a");
578
+ link.href = dataUrl;
579
+ link.download = filename;
580
+ document.body.appendChild(link);
581
+ link.click();
582
+ document.body.removeChild(link);
583
+ }
584
+ function downloadText(filename, text, mime = "text/plain") {
585
+ const blob = new Blob([text], { type: mime });
586
+ const url = URL.createObjectURL(blob);
587
+ downloadDataUrl(filename, url);
588
+ setTimeout(() => URL.revokeObjectURL(url), 1500);
589
+ }
540
590
  export {
541
591
  applyCandidateAction,
542
592
  applyReviewAction,
593
+ buildSubgraphExport,
594
+ downloadDataUrl,
595
+ downloadText,
543
596
  fetchApprovalDetail,
544
597
  fetchApprovals,
545
598
  fetchCandidates,
@@ -548,7 +601,9 @@ export {
548
601
  fetchGraphPath,
549
602
  fetchGraphQuery,
550
603
  fetchGraphReport,
604
+ fetchLintFindings,
551
605
  fetchViewerPage,
552
606
  fetchWatchStatus,
607
+ fetchWorkspaceBundle,
553
608
  searchViewerPages
554
609
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swarmvaultai/viewer",
3
- "version": "0.7.31",
3
+ "version": "0.9.0",
4
4
  "description": "Graph viewer package for SwarmVault graph artifacts.",
5
5
  "type": "module",
6
6
  "main": "dist/lib.js",
@@ -37,20 +37,21 @@
37
37
  "engines": {
38
38
  "node": ">=24.0.0"
39
39
  },
40
- "scripts": {
41
- "build": "pnpm run build:lib && pnpm run build:app",
42
- "build:lib": "tsup src/lib.ts --format esm --dts --out-dir dist --clean",
43
- "build:app": "vite build",
44
- "test": "vitest run",
45
- "typecheck": "tsc --noEmit",
46
- "prepublishOnly": "node ../../scripts/check-release-sync.mjs && node ../../scripts/check-published-manifests.mjs"
47
- },
48
40
  "dependencies": {
49
41
  "cytoscape": "^3.33.1",
42
+ "highlight.js": "^11.10.0",
50
43
  "react": "^19.1.1",
51
- "react-dom": "^19.1.1"
44
+ "react-dom": "^19.1.1",
45
+ "react-markdown": "^9.0.1",
46
+ "rehype-highlight": "^7.0.0",
47
+ "rehype-slug": "^6.0.0",
48
+ "remark-gfm": "^4.0.0"
52
49
  },
53
50
  "devDependencies": {
51
+ "@testing-library/dom": "^10.4.0",
52
+ "@testing-library/jest-dom": "^6.5.0",
53
+ "@testing-library/react": "^16.0.1",
54
+ "@testing-library/user-event": "^14.5.2",
54
55
  "@types/node": "^24.6.0",
55
56
  "@types/react": "^19.1.13",
56
57
  "@types/react-dom": "^19.1.9",
@@ -60,5 +61,12 @@
60
61
  "typescript": "^5.9.2",
61
62
  "vite": "^7.1.7",
62
63
  "vitest": "^3.2.4"
64
+ },
65
+ "scripts": {
66
+ "build": "pnpm run build:lib && pnpm run build:app",
67
+ "build:lib": "tsup src/lib.ts --format esm --dts --out-dir dist --clean",
68
+ "build:app": "vite build",
69
+ "test": "vitest run",
70
+ "typecheck": "tsc --noEmit"
63
71
  }
64
- }
72
+ }