@swarmvaultai/viewer 0.1.18 → 0.1.21

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-sMKSYq5V.js"></script>
7
+ <script type="module" crossorigin src="/assets/index-DEETVhXx.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
@@ -29,6 +29,7 @@ type ViewerGraphEdge = {
29
29
  target: string;
30
30
  relation: string;
31
31
  status: string;
32
+ evidenceClass?: string;
32
33
  confidence?: number;
33
34
  };
34
35
  type ViewerGraphPage = {
@@ -79,6 +80,58 @@ type ViewerPagePayload = {
79
80
  content: string;
80
81
  assets: ViewerOutputAsset[];
81
82
  };
83
+ type ViewerGraphQueryResult = {
84
+ question: string;
85
+ traversal: "bfs" | "dfs";
86
+ seedNodeIds: string[];
87
+ seedPageIds: string[];
88
+ visitedNodeIds: string[];
89
+ visitedEdgeIds: string[];
90
+ pageIds: string[];
91
+ communities: string[];
92
+ summary: string;
93
+ matches: Array<{
94
+ type: "node" | "page";
95
+ id: string;
96
+ label: string;
97
+ score: number;
98
+ }>;
99
+ };
100
+ type ViewerGraphPathResult = {
101
+ from: string;
102
+ to: string;
103
+ resolvedFromNodeId?: string;
104
+ resolvedToNodeId?: string;
105
+ found: boolean;
106
+ nodeIds: string[];
107
+ edgeIds: string[];
108
+ pageIds: string[];
109
+ summary: string;
110
+ };
111
+ type ViewerGraphExplainResult = {
112
+ target: string;
113
+ node: ViewerGraphNode;
114
+ page?: {
115
+ id: string;
116
+ path: string;
117
+ title: string;
118
+ };
119
+ community?: {
120
+ id: string;
121
+ label: string;
122
+ };
123
+ neighbors: Array<{
124
+ nodeId: string;
125
+ label: string;
126
+ type: string;
127
+ pageId?: string;
128
+ relation: string;
129
+ direction: "incoming" | "outgoing";
130
+ confidence: number;
131
+ evidenceClass: string;
132
+ }>;
133
+ summary: string;
134
+ };
82
135
  type ViewerApprovalSummary = {
83
136
  approvalId: string;
84
137
  createdAt: string;
@@ -115,6 +168,39 @@ type ViewerCandidateRecord = {
115
168
  createdAt: string;
116
169
  updatedAt: string;
117
170
  };
171
+ type ViewerWatchStatus = {
172
+ generatedAt: string;
173
+ watchedRepoRoots: string[];
174
+ lastRun?: {
175
+ startedAt: string;
176
+ finishedAt: string;
177
+ durationMs: number;
178
+ inputDir: string;
179
+ reasons: string[];
180
+ importedCount: number;
181
+ scannedCount: number;
182
+ attachmentCount: number;
183
+ changedPages: string[];
184
+ repoImportedCount?: number;
185
+ repoUpdatedCount?: number;
186
+ repoRemovedCount?: number;
187
+ repoScannedCount?: number;
188
+ pendingSemanticRefreshCount?: number;
189
+ pendingSemanticRefreshPaths?: string[];
190
+ lintFindingCount?: number;
191
+ success: boolean;
192
+ error?: string;
193
+ };
194
+ pendingSemanticRefresh: Array<{
195
+ id: string;
196
+ repoRoot: string;
197
+ path: string;
198
+ changeType: "added" | "modified" | "removed";
199
+ detectedAt: string;
200
+ sourceId?: string;
201
+ sourceKind?: string;
202
+ }>;
203
+ };
118
204
  declare global {
119
205
  interface Window {
120
206
  __SWARMVAULT_EMBEDDED_DATA__?: {
@@ -132,10 +218,17 @@ type ViewerSearchOptions = {
132
218
  declare function fetchGraphArtifact(input?: string, init?: RequestInit): Promise<ViewerGraphArtifact>;
133
219
  declare function searchViewerPages(query: string, options?: ViewerSearchOptions): Promise<ViewerSearchResult[]>;
134
220
  declare function fetchViewerPage(path: string): Promise<ViewerPagePayload>;
221
+ declare function fetchGraphQuery(question: string, options?: {
222
+ traversal?: "bfs" | "dfs";
223
+ budget?: number;
224
+ }): Promise<ViewerGraphQueryResult>;
225
+ declare function fetchGraphPath(from: string, to: string): Promise<ViewerGraphPathResult>;
226
+ declare function fetchGraphExplain(target: string): Promise<ViewerGraphExplainResult>;
135
227
  declare function fetchApprovals(): Promise<ViewerApprovalSummary[]>;
136
228
  declare function fetchApprovalDetail(approvalId: string): Promise<ViewerApprovalDetail>;
137
229
  declare function applyReviewAction(approvalId: string, action: "accept" | "reject", targets?: string[]): Promise<ViewerReviewActionResult>;
138
230
  declare function fetchCandidates(): Promise<ViewerCandidateRecord[]>;
139
231
  declare function applyCandidateAction(target: string, action: "promote" | "archive"): Promise<ViewerCandidateRecord>;
232
+ declare function fetchWatchStatus(): Promise<ViewerWatchStatus>;
140
233
 
141
- export { type ViewerApprovalDetail, type ViewerApprovalEntry, type ViewerApprovalSummary, type ViewerCandidateRecord, type ViewerGraphArtifact, type ViewerGraphEdge, type ViewerGraphNode, type ViewerGraphPage, type ViewerOutputAsset, type ViewerPagePayload, type ViewerReviewActionResult, type ViewerSearchOptions, type ViewerSearchResult, applyCandidateAction, applyReviewAction, fetchApprovalDetail, fetchApprovals, fetchCandidates, fetchGraphArtifact, fetchViewerPage, searchViewerPages };
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 };
package/dist/lib.js CHANGED
@@ -94,6 +94,36 @@ async function fetchViewerPage(path) {
94
94
  }
95
95
  return response.json();
96
96
  }
97
+ async function fetchGraphQuery(question, options = {}) {
98
+ const params = new URLSearchParams({
99
+ q: question,
100
+ traversal: options.traversal ?? "bfs",
101
+ budget: String(options.budget ?? 12)
102
+ });
103
+ const response = await fetch(`/api/graph/query?${params.toString()}`);
104
+ if (!response.ok) {
105
+ throw new Error(`Failed to query graph: ${response.status} ${response.statusText}`);
106
+ }
107
+ return response.json();
108
+ }
109
+ async function fetchGraphPath(from, to) {
110
+ const params = new URLSearchParams({
111
+ from,
112
+ to
113
+ });
114
+ const response = await fetch(`/api/graph/path?${params.toString()}`);
115
+ if (!response.ok) {
116
+ throw new Error(`Failed to find graph path: ${response.status} ${response.statusText}`);
117
+ }
118
+ return response.json();
119
+ }
120
+ async function fetchGraphExplain(target) {
121
+ const response = await fetch(`/api/graph/explain?target=${encodeURIComponent(target)}`);
122
+ if (!response.ok) {
123
+ throw new Error(`Failed to explain graph target: ${response.status} ${response.statusText}`);
124
+ }
125
+ return response.json();
126
+ }
97
127
  async function fetchApprovals() {
98
128
  if (embeddedData()) {
99
129
  return [];
@@ -152,6 +182,20 @@ async function applyCandidateAction(target, action) {
152
182
  }
153
183
  return response.json();
154
184
  }
185
+ async function fetchWatchStatus() {
186
+ if (embeddedData()) {
187
+ return {
188
+ generatedAt: "",
189
+ watchedRepoRoots: [],
190
+ pendingSemanticRefresh: []
191
+ };
192
+ }
193
+ const response = await fetch("/api/watch-status");
194
+ if (!response.ok) {
195
+ throw new Error(`Failed to load watch status: ${response.status} ${response.statusText}`);
196
+ }
197
+ return response.json();
198
+ }
155
199
  export {
156
200
  applyCandidateAction,
157
201
  applyReviewAction,
@@ -159,6 +203,10 @@ export {
159
203
  fetchApprovals,
160
204
  fetchCandidates,
161
205
  fetchGraphArtifact,
206
+ fetchGraphExplain,
207
+ fetchGraphPath,
208
+ fetchGraphQuery,
162
209
  fetchViewerPage,
210
+ fetchWatchStatus,
163
211
  searchViewerPages
164
212
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swarmvaultai/viewer",
3
- "version": "0.1.18",
3
+ "version": "0.1.21",
4
4
  "description": "Graph viewer package for SwarmVault graph artifacts.",
5
5
  "type": "module",
6
6
  "main": "dist/lib.js",