@swarmvaultai/viewer 0.1.22 → 0.1.24

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,7 +4,7 @@
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-DEETVhXx.js"></script>
7
+ <script type="module" crossorigin src="/assets/index-CmEm2Pd_.js"></script>
8
8
  <link rel="stylesheet" crossorigin href="/assets/index-mRA-6D-Z.css">
9
9
  </head>
10
10
  <body>
package/dist/lib.d.ts CHANGED
@@ -31,6 +31,17 @@ type ViewerGraphEdge = {
31
31
  status: string;
32
32
  evidenceClass?: string;
33
33
  confidence?: number;
34
+ similarityReasons?: string[];
35
+ };
36
+ type ViewerGraphHyperedge = {
37
+ id: string;
38
+ label: string;
39
+ relation: string;
40
+ nodeIds: string[];
41
+ evidenceClass: string;
42
+ confidence: number;
43
+ sourcePageIds: string[];
44
+ why: string;
34
45
  };
35
46
  type ViewerGraphPage = {
36
47
  pageId: string;
@@ -38,6 +49,7 @@ type ViewerGraphPage = {
38
49
  title: string;
39
50
  kind: string;
40
51
  status: string;
52
+ sourceType?: string;
41
53
  projectIds: string[];
42
54
  content: string;
43
55
  assets: ViewerOutputAsset[];
@@ -46,6 +58,7 @@ type ViewerGraphArtifact = {
46
58
  generatedAt: string;
47
59
  nodes: ViewerGraphNode[];
48
60
  edges: ViewerGraphEdge[];
61
+ hyperedges: ViewerGraphHyperedge[];
49
62
  communities?: Array<{
50
63
  id: string;
51
64
  label: string;
@@ -57,6 +70,7 @@ type ViewerGraphArtifact = {
57
70
  title: string;
58
71
  kind: string;
59
72
  status: string;
73
+ sourceType?: string;
60
74
  projectIds: string[];
61
75
  nodeIds: string[];
62
76
  backlinks: string[];
@@ -72,6 +86,7 @@ type ViewerSearchResult = {
72
86
  kind?: string;
73
87
  status?: string;
74
88
  projectIds: string[];
89
+ sourceType?: string;
75
90
  };
76
91
  type ViewerPagePayload = {
77
92
  path: string;
@@ -87,11 +102,12 @@ type ViewerGraphQueryResult = {
87
102
  seedPageIds: string[];
88
103
  visitedNodeIds: string[];
89
104
  visitedEdgeIds: string[];
105
+ hyperedgeIds: string[];
90
106
  pageIds: string[];
91
107
  communities: string[];
92
108
  summary: string;
93
109
  matches: Array<{
94
- type: "node" | "page";
110
+ type: "node" | "page" | "hyperedge";
95
111
  id: string;
96
112
  label: string;
97
113
  score: number;
@@ -130,6 +146,7 @@ type ViewerGraphExplainResult = {
130
146
  confidence: number;
131
147
  evidenceClass: string;
132
148
  }>;
149
+ hyperedges: ViewerGraphHyperedge[];
133
150
  summary: string;
134
151
  };
135
152
  type ViewerApprovalSummary = {
@@ -201,11 +218,61 @@ type ViewerWatchStatus = {
201
218
  sourceKind?: string;
202
219
  }>;
203
220
  };
221
+ type ViewerGraphReport = {
222
+ generatedAt: string;
223
+ graphHash: string;
224
+ overview: {
225
+ nodes: number;
226
+ edges: number;
227
+ pages: number;
228
+ communities: number;
229
+ };
230
+ benchmark?: {
231
+ generatedAt: string;
232
+ stale: boolean;
233
+ summary: {
234
+ questionCount: number;
235
+ uniqueVisitedNodes: number;
236
+ finalContextTokens: number;
237
+ naiveCorpusTokens: number;
238
+ avgReduction: number;
239
+ reductionRatio: number;
240
+ };
241
+ questionCount: number;
242
+ };
243
+ surprisingConnections: Array<{
244
+ id: string;
245
+ sourceNodeId: string;
246
+ sourceLabel: string;
247
+ targetNodeId: string;
248
+ targetLabel: string;
249
+ relation: string;
250
+ evidenceClass: string;
251
+ confidence: number;
252
+ pathNodeIds: string[];
253
+ pathEdgeIds: string[];
254
+ pathRelations: string[];
255
+ pathEvidenceClasses: string[];
256
+ pathSummary: string;
257
+ why: string;
258
+ explanation: string;
259
+ }>;
260
+ groupPatterns: ViewerGraphHyperedge[];
261
+ suggestedQuestions: string[];
262
+ recentResearchSources: Array<{
263
+ pageId: string;
264
+ path: string;
265
+ title: string;
266
+ sourceType: string;
267
+ updatedAt: string;
268
+ }>;
269
+ };
204
270
  declare global {
205
271
  interface Window {
206
272
  __SWARMVAULT_EMBEDDED_DATA__?: {
207
273
  graph: ViewerGraphArtifact;
208
274
  pages: ViewerGraphPage[];
275
+ report?: ViewerGraphReport;
209
276
  };
210
277
  }
211
278
  }
@@ -214,6 +281,7 @@ type ViewerSearchOptions = {
214
281
  kind?: string;
215
282
  status?: string;
216
283
  project?: string;
284
+ sourceType?: string;
217
285
  };
218
286
  declare function fetchGraphArtifact(input?: string, init?: RequestInit): Promise<ViewerGraphArtifact>;
219
287
  declare function searchViewerPages(query: string, options?: ViewerSearchOptions): Promise<ViewerSearchResult[]>;
@@ -222,6 +290,7 @@ declare function fetchGraphQuery(question: string, options?: {
222
290
  traversal?: "bfs" | "dfs";
223
291
  budget?: number;
224
292
  }): Promise<ViewerGraphQueryResult>;
293
+ declare function fetchGraphReport(): Promise<ViewerGraphReport | null>;
225
294
  declare function fetchGraphPath(from: string, to: string): Promise<ViewerGraphPathResult>;
226
295
  declare function fetchGraphExplain(target: string): Promise<ViewerGraphExplainResult>;
227
296
  declare function fetchApprovals(): Promise<ViewerApprovalSummary[]>;
@@ -231,4 +300,4 @@ declare function fetchCandidates(): Promise<ViewerCandidateRecord[]>;
231
300
  declare function applyCandidateAction(target: string, action: "promote" | "archive"): Promise<ViewerCandidateRecord>;
232
301
  declare function fetchWatchStatus(): Promise<ViewerWatchStatus>;
233
302
 
234
- export { type ViewerApprovalDetail, type ViewerApprovalEntry, type ViewerApprovalSummary, type ViewerCandidateRecord, type ViewerGraphArtifact, type ViewerGraphEdge, type ViewerGraphExplainResult, type ViewerGraphNode, type ViewerGraphPage, type ViewerGraphPathResult, type ViewerGraphQueryResult, type ViewerOutputAsset, type ViewerPagePayload, type ViewerReviewActionResult, type ViewerSearchOptions, type ViewerSearchResult, type ViewerWatchStatus, applyCandidateAction, applyReviewAction, fetchApprovalDetail, fetchApprovals, fetchCandidates, fetchGraphArtifact, fetchGraphExplain, fetchGraphPath, fetchGraphQuery, fetchViewerPage, fetchWatchStatus, searchViewerPages };
303
+ export { type ViewerApprovalDetail, type ViewerApprovalEntry, 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 };
package/dist/lib.js CHANGED
@@ -32,6 +32,7 @@ async function searchViewerPages(query, options = {}) {
32
32
  const kind = options.kind ?? "all";
33
33
  const status = options.status ?? "all";
34
34
  const project = options.project ?? "all";
35
+ const sourceType = options.sourceType ?? "all";
35
36
  if (embedded) {
36
37
  const normalizedQuery = query.trim().toLowerCase();
37
38
  if (!normalizedQuery) {
@@ -39,7 +40,7 @@ async function searchViewerPages(query, options = {}) {
39
40
  }
40
41
  return embedded.pages.filter((page) => kind === "all" ? true : page.kind === kind).filter((page) => status === "all" ? true : page.status === status).filter(
41
42
  (page) => project === "all" ? true : project === "unassigned" ? page.projectIds.length === 0 : page.projectIds.includes(project)
42
- ).map((page) => {
43
+ ).filter((page) => sourceType === "all" ? true : (page.sourceType ?? "") === sourceType).map((page) => {
43
44
  const haystack = `${page.title}
44
45
  ${page.content}`.toLowerCase();
45
46
  const score = haystack.includes(normalizedQuery) ? haystack.indexOf(normalizedQuery) : Number.POSITIVE_INFINITY;
@@ -51,7 +52,8 @@ ${page.content}`.toLowerCase();
51
52
  rank: score,
52
53
  kind: page.kind,
53
54
  status: page.status,
54
- projectIds: page.projectIds
55
+ projectIds: page.projectIds,
56
+ sourceType: page.sourceType
55
57
  };
56
58
  }).filter((page) => Number.isFinite(page.rank)).sort((left, right) => left.rank - right.rank || left.title.localeCompare(right.title)).slice(0, limit);
57
59
  }
@@ -60,7 +62,8 @@ ${page.content}`.toLowerCase();
60
62
  limit: String(limit),
61
63
  kind,
62
64
  status,
63
- project
65
+ project,
66
+ sourceType
64
67
  });
65
68
  const response = await fetch(`/api/search?${params.toString()}`);
66
69
  if (!response.ok) {
@@ -82,7 +85,8 @@ async function fetchViewerPage(path) {
82
85
  page_id: page.pageId,
83
86
  kind: page.kind,
84
87
  status: page.status,
85
- project_ids: page.projectIds
88
+ project_ids: page.projectIds,
89
+ source_type: page.sourceType
86
90
  },
87
91
  content: page.content,
88
92
  assets: page.assets ?? []
@@ -106,6 +110,20 @@ async function fetchGraphQuery(question, options = {}) {
106
110
  }
107
111
  return response.json();
108
112
  }
113
+ async function fetchGraphReport() {
114
+ const embedded = embeddedData();
115
+ if (embedded) {
116
+ return embedded.report ?? null;
117
+ }
118
+ const response = await fetch("/api/graph-report");
119
+ if (response.status === 404) {
120
+ return null;
121
+ }
122
+ if (!response.ok) {
123
+ throw new Error(`Failed to load graph report: ${response.status} ${response.statusText}`);
124
+ }
125
+ return response.json();
126
+ }
109
127
  async function fetchGraphPath(from, to) {
110
128
  const params = new URLSearchParams({
111
129
  from,
@@ -206,6 +224,7 @@ export {
206
224
  fetchGraphExplain,
207
225
  fetchGraphPath,
208
226
  fetchGraphQuery,
227
+ fetchGraphReport,
209
228
  fetchViewerPage,
210
229
  fetchWatchStatus,
211
230
  searchViewerPages
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swarmvaultai/viewer",
3
- "version": "0.1.22",
3
+ "version": "0.1.24",
4
4
  "description": "Graph viewer package for SwarmVault graph artifacts.",
5
5
  "type": "module",
6
6
  "main": "dist/lib.js",
@@ -37,6 +37,13 @@
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": "node -e \"process.exit(0)\"",
45
+ "typecheck": "tsc --noEmit"
46
+ },
40
47
  "dependencies": {
41
48
  "cytoscape": "^3.33.1",
42
49
  "react": "^19.1.1",
@@ -50,12 +57,5 @@
50
57
  "tsup": "^8.5.0",
51
58
  "typescript": "^5.9.2",
52
59
  "vite": "^7.1.7"
53
- },
54
- "scripts": {
55
- "build": "pnpm run build:lib && pnpm run build:app",
56
- "build:lib": "tsup src/lib.ts --format esm --dts --out-dir dist --clean",
57
- "build:app": "vite build",
58
- "test": "node -e \"process.exit(0)\"",
59
- "typecheck": "tsc --noEmit"
60
60
  }
61
- }
61
+ }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 SwarmVault
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.