@swarmvaultai/engine 0.1.18 → 0.1.19

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/README.md CHANGED
@@ -26,16 +26,20 @@ import {
26
26
  defaultVaultSchema,
27
27
  exploreVault,
28
28
  exportGraphHtml,
29
+ explainGraphVault,
29
30
  importInbox,
30
31
  ingestInput,
31
32
  initVault,
32
33
  installAgent,
33
34
  getWebSearchAdapterForTask,
34
35
  lintVault,
36
+ listGodNodes,
35
37
  listSchedules,
36
38
  loadVaultConfig,
37
39
  loadVaultSchema,
38
40
  loadVaultSchemas,
41
+ pathGraphVault,
42
+ queryGraphVault,
39
43
  queryVault,
40
44
  runSchedule,
41
45
  searchVault,
@@ -64,6 +68,9 @@ await compileVault(rootDir, {});
64
68
  const saved = await queryVault(rootDir, { question: "What changed most recently?" });
65
69
  console.log(saved.savedPath);
66
70
 
71
+ const graphQuery = await queryGraphVault(rootDir, "Which nodes bridge the biggest communities?");
72
+ console.log(graphQuery.summary);
73
+
67
74
  const exploration = await exploreVault(rootDir, { question: "What should I investigate next?", steps: 3, format: "report" });
68
75
  console.log(exploration.hubPath);
69
76
 
@@ -132,9 +139,14 @@ This matters because many "OpenAI-compatible" backends only implement part of th
132
139
  ### Compile + Query
133
140
 
134
141
  - `compileVault(rootDir, { approve })` writes wiki pages, graph data, and search state using the vault schema as guidance, or stages a review bundle
142
+ - compile also writes graph orientation pages such as `wiki/graph/report.md` and `wiki/graph/communities/<community>.md`
135
143
  - `queryVault(rootDir, { question, save, format, review })` answers against the compiled vault using the same schema layer and saves by default
136
144
  - `exploreVault(rootDir, { question, steps, format, review })` runs a save-first multi-step exploration loop and writes a hub page plus step outputs
137
145
  - `searchVault(rootDir, query, limit)` searches compiled pages directly
146
+ - `queryGraphVault(rootDir, question, { traversal, budget })` runs deterministic local graph search without a model provider
147
+ - `pathGraphVault(rootDir, from, to)` returns the shortest graph path between two targets
148
+ - `explainGraphVault(rootDir, target)` returns node, community, neighbor, and provenance details
149
+ - `listGodNodes(rootDir, limit)` returns the most connected bridge-heavy graph nodes
138
150
  - project-aware compile also builds `wiki/projects/index.md` plus `wiki/projects/<project>/index.md` rollups without duplicating page trees
139
151
  - human-authored insight pages in `wiki/insights/` are indexed into search and available to query without being rewritten by compile
140
152
  - `chart` and `image` formats save wrapper markdown pages plus local output assets under `wiki/outputs/assets/<slug>/`
@@ -159,7 +171,7 @@ This matters because many "OpenAI-compatible" backends only implement part of th
159
171
  - `startMcpServer(rootDir)` runs the MCP server over stdio
160
172
  - `exportGraphHtml(rootDir, outputPath)` exports the graph workspace as a standalone HTML file
161
173
 
162
- The MCP surface includes tools for workspace info, page search, page reads, source listing, querying, ingestion, compile, and lint, along with resources for config, graph, manifests, schema, page content, and session artifacts.
174
+ The MCP surface includes tools for workspace info, page search, page reads, source listing, querying, ingestion, compile, lint, and graph-native read operations such as graph query, node explain, neighbor lookup, shortest path, and god-node listing, along with resources for config, graph, manifests, schema, page content, and session artifacts.
163
175
 
164
176
  ## Artifacts
165
177
 
@@ -170,6 +182,7 @@ Running the engine produces a local workspace with these main areas:
170
182
  - `raw/sources/`: immutable source copies
171
183
  - `raw/assets/`: copied attachments referenced by ingested markdown bundles and remote URL ingests
172
184
  - `wiki/`: generated markdown pages, the append-only `log.md` activity trail, staged candidates, saved query outputs, exploration hub pages, and a human-only `insights/` area
185
+ - `wiki/graph/`: generated graph report pages and per-community summaries derived from `state/graph.json`
173
186
  - `wiki/outputs/assets/`: local chart/image artifacts and JSON manifests for saved visual outputs
174
187
  - `wiki/code/`: generated module pages for ingested code sources
175
188
  - `wiki/projects/`: generated project rollups over canonical pages
@@ -186,7 +199,7 @@ Running the engine produces a local workspace with these main areas:
186
199
  - `state/jobs.ndjson`: watch-mode automation logs
187
200
 
188
201
  Saved outputs are indexed immediately into the graph page registry and search index, then linked back into compiled source, concept, and entity pages immediately through the lightweight artifact sync path. New concept and entity pages stage into `wiki/candidates/` first and promote to active pages on the next matching compile. Insight pages are indexed into search and page reads, but compile does not mutate them. Project-scoped pages receive `project_ids`, project tags, and layered root-plus-project schema hashes when all contributing sources resolve to the same configured project.
189
- Code sources also emit module and symbol nodes into `state/graph.json`, so local imports, exports, inheritance, and same-module call edges are queryable through the same viewer and search pipeline.
202
+ Code sources also emit module, symbol, and parser-backed rationale nodes into `state/graph.json`, so local imports, exports, inheritance, same-module call edges, and rationale links are queryable through the same viewer and search pipeline.
190
203
  Ingest, inbox import, compile, query, lint, review, and candidate operations also append human-readable entries to `wiki/log.md`.
191
204
 
192
205
  ## Notes
package/dist/index.d.ts CHANGED
@@ -39,9 +39,10 @@ declare const agentTypeSchema: z.ZodEnum<{
39
39
  opencode: "opencode";
40
40
  }>;
41
41
  type AgentType = z.infer<typeof agentTypeSchema>;
42
- type PageKind = "index" | "source" | "module" | "concept" | "entity" | "output" | "insight";
42
+ type PageKind = "index" | "source" | "module" | "concept" | "entity" | "output" | "insight" | "graph_report" | "community_summary";
43
43
  type Freshness = "fresh" | "stale";
44
44
  type ClaimStatus = "extracted" | "inferred" | "conflicted" | "stale";
45
+ type EvidenceClass = "extracted" | "inferred" | "ambiguous";
45
46
  type Polarity = "positive" | "negative" | "neutral";
46
47
  type OutputOrigin = "query" | "explore";
47
48
  type OutputFormat = "markdown" | "report" | "slides" | "chart" | "image";
@@ -292,6 +293,13 @@ interface CodeAnalysis {
292
293
  exports: string[];
293
294
  diagnostics: CodeDiagnostic[];
294
295
  }
296
+ interface SourceRationale {
297
+ id: string;
298
+ text: string;
299
+ citation: string;
300
+ kind: "docstring" | "comment" | "marker";
301
+ symbolName?: string;
302
+ }
295
303
  interface CodeIndexEntry {
296
304
  sourceId: string;
297
305
  moduleId: string;
@@ -317,12 +325,13 @@ interface SourceAnalysis {
317
325
  entities: AnalyzedTerm[];
318
326
  claims: SourceClaim[];
319
327
  questions: string[];
328
+ rationales: SourceRationale[];
320
329
  code?: CodeAnalysis;
321
330
  producedAt: string;
322
331
  }
323
332
  interface GraphNode {
324
333
  id: string;
325
- type: "source" | "concept" | "entity" | "module" | "symbol";
334
+ type: "source" | "concept" | "entity" | "module" | "symbol" | "rationale";
326
335
  label: string;
327
336
  pageId?: string;
328
337
  freshness?: Freshness;
@@ -343,6 +352,7 @@ interface GraphEdge {
343
352
  target: string;
344
353
  relation: string;
345
354
  status: ClaimStatus;
355
+ evidenceClass: EvidenceClass;
346
356
  confidence: number;
347
357
  provenance: string[];
348
358
  }
@@ -384,6 +394,56 @@ interface GraphArtifact {
384
394
  sources: SourceManifest[];
385
395
  pages: GraphPage[];
386
396
  }
397
+ interface GraphQueryMatch {
398
+ type: "node" | "page";
399
+ id: string;
400
+ label: string;
401
+ score: number;
402
+ }
403
+ interface GraphQueryResult {
404
+ question: string;
405
+ traversal: "bfs" | "dfs";
406
+ seedNodeIds: string[];
407
+ seedPageIds: string[];
408
+ visitedNodeIds: string[];
409
+ visitedEdgeIds: string[];
410
+ pageIds: string[];
411
+ communities: string[];
412
+ summary: string;
413
+ matches: GraphQueryMatch[];
414
+ }
415
+ interface GraphPathResult {
416
+ from: string;
417
+ to: string;
418
+ resolvedFromNodeId?: string;
419
+ resolvedToNodeId?: string;
420
+ found: boolean;
421
+ nodeIds: string[];
422
+ edgeIds: string[];
423
+ pageIds: string[];
424
+ summary: string;
425
+ }
426
+ interface GraphExplainNeighbor {
427
+ nodeId: string;
428
+ label: string;
429
+ type: GraphNode["type"];
430
+ pageId?: string;
431
+ relation: string;
432
+ direction: "incoming" | "outgoing";
433
+ confidence: number;
434
+ evidenceClass: EvidenceClass;
435
+ }
436
+ interface GraphExplainResult {
437
+ target: string;
438
+ node: GraphNode;
439
+ page?: GraphPage;
440
+ community?: {
441
+ id: string;
442
+ label: string;
443
+ };
444
+ neighbors: GraphExplainNeighbor[];
445
+ summary: string;
446
+ }
387
447
  interface ApprovalEntry {
388
448
  pageId: string;
389
449
  title: string;
@@ -778,6 +838,13 @@ declare function compileVault(rootDir: string, options?: CompileOptions): Promis
778
838
  declare function queryVault(rootDir: string, options: QueryOptions): Promise<QueryResult>;
779
839
  declare function exploreVault(rootDir: string, options: ExploreOptions): Promise<ExploreResult>;
780
840
  declare function searchVault(rootDir: string, query: string, limit?: number): Promise<SearchResult[]>;
841
+ declare function queryGraphVault(rootDir: string, question: string, options?: {
842
+ traversal?: "bfs" | "dfs";
843
+ budget?: number;
844
+ }): Promise<GraphQueryResult>;
845
+ declare function pathGraphVault(rootDir: string, from: string, to: string): Promise<GraphPathResult>;
846
+ declare function explainGraphVault(rootDir: string, target: string): Promise<GraphExplainResult>;
847
+ declare function listGodNodes(rootDir: string, limit?: number): Promise<GraphNode[]>;
781
848
  declare function listPages(rootDir: string): Promise<GraphPage[]>;
782
849
  declare function readPage(rootDir: string, relativePath: string): Promise<{
783
850
  path: string;
@@ -814,4 +881,4 @@ declare function watchVault(rootDir: string, options?: WatchOptions): Promise<Wa
814
881
  declare function createWebSearchAdapter(id: string, config: WebSearchProviderConfig, rootDir: string): Promise<WebSearchAdapter>;
815
882
  declare function getWebSearchAdapterForTask(rootDir: string, task: "deepLintProvider"): Promise<WebSearchAdapter>;
816
883
 
817
- export { type AgentType, type AnalyzedTerm, type ApprovalChangeType, type ApprovalDetail, type ApprovalEntry, type ApprovalEntryDetail, type ApprovalEntryStatus, type ApprovalManifest, type ApprovalSummary, type CandidateRecord, type ChartDatum, type ChartSpec, type ClaimStatus, type CodeAnalysis, type CodeDiagnostic, type CodeImport, type CodeIndexArtifact, type CodeIndexEntry, type CodeLanguage, type CodeSymbol, type CodeSymbolKind, type CommandRoleExecutorConfig, type CompileOptions, type CompileResult, type CompileState, type DirectoryIngestResult, type DirectoryIngestSkip, type ExploreOptions, type ExploreResult, type ExploreStepResult, type Freshness, type GenerationAttachment, type GenerationRequest, type GenerationResponse, type GraphArtifact, type GraphEdge, type GraphNode, type GraphPage, type ImageGenerationRequest, type ImageGenerationResponse, type InboxImportResult, type InboxImportSkip, type IngestOptions, type InitOptions, type LintFinding, type LintOptions, type OrchestrationConfig, type OrchestrationFinding, type OrchestrationProposal, type OrchestrationRole, type OrchestrationRoleConfig, type OrchestrationRoleResult, type OutputAsset, type OutputAssetRole, type OutputFormat, type OutputOrigin, type PageKind, type PageManager, type PageStatus, type Polarity, type ProviderAdapter, type ProviderCapability, type ProviderConfig, type ProviderRoleExecutorConfig, type ProviderType, type QueryOptions, type QueryResult, type ResolvedPaths, type ReviewActionResult, type RoleExecutorConfig, type SceneElement, type SceneSpec, type ScheduleController, type ScheduleJobConfig, type ScheduleStateRecord, type ScheduleTriggerConfig, type ScheduledCompileTask, type ScheduledExploreTask, type ScheduledLintTask, type ScheduledQueryTask, type ScheduledRunResult, type ScheduledTaskConfig, type SearchResult, type SourceAnalysis, type SourceAttachment, type SourceClaim, type SourceKind, type SourceManifest, type VaultConfig, type WatchController, type WatchOptions, type WatchRunRecord, type WebSearchAdapter, type WebSearchProviderConfig, type WebSearchProviderType, type WebSearchResult, acceptApproval, agentTypeSchema, archiveCandidate, assertProviderCapability, bootstrapDemo, compileVault, createMcpServer, createProvider, createWebSearchAdapter, defaultVaultConfig, defaultVaultSchema, exploreVault, exportGraphHtml, getProviderForTask, getWebSearchAdapterForTask, getWorkspaceInfo, importInbox, ingestDirectory, ingestInput, initVault, initWorkspace, installAgent, installConfiguredAgents, lintVault, listApprovals, listCandidates, listManifests, listPages, listSchedules, loadVaultConfig, loadVaultSchema, loadVaultSchemas, promoteCandidate, providerCapabilitySchema, providerTypeSchema, queryVault, readApproval, readExtractedText, readPage, rejectApproval, resolvePaths, runSchedule, searchVault, serveSchedules, startGraphServer, startMcpServer, watchVault, webSearchProviderTypeSchema };
884
+ export { type AgentType, type AnalyzedTerm, type ApprovalChangeType, type ApprovalDetail, type ApprovalEntry, type ApprovalEntryDetail, type ApprovalEntryStatus, type ApprovalManifest, type ApprovalSummary, type CandidateRecord, type ChartDatum, type ChartSpec, type ClaimStatus, type CodeAnalysis, type CodeDiagnostic, type CodeImport, type CodeIndexArtifact, type CodeIndexEntry, type CodeLanguage, type CodeSymbol, type CodeSymbolKind, type CommandRoleExecutorConfig, type CompileOptions, type CompileResult, type CompileState, type DirectoryIngestResult, type DirectoryIngestSkip, type EvidenceClass, type ExploreOptions, type ExploreResult, type ExploreStepResult, type Freshness, type GenerationAttachment, type GenerationRequest, type GenerationResponse, type GraphArtifact, type GraphEdge, type GraphExplainNeighbor, type GraphExplainResult, type GraphNode, type GraphPage, type GraphPathResult, type GraphQueryMatch, type GraphQueryResult, type ImageGenerationRequest, type ImageGenerationResponse, type InboxImportResult, type InboxImportSkip, type IngestOptions, type InitOptions, type LintFinding, type LintOptions, type OrchestrationConfig, type OrchestrationFinding, type OrchestrationProposal, type OrchestrationRole, type OrchestrationRoleConfig, type OrchestrationRoleResult, type OutputAsset, type OutputAssetRole, type OutputFormat, type OutputOrigin, type PageKind, type PageManager, type PageStatus, type Polarity, type ProviderAdapter, type ProviderCapability, type ProviderConfig, type ProviderRoleExecutorConfig, type ProviderType, type QueryOptions, type QueryResult, type ResolvedPaths, type ReviewActionResult, type RoleExecutorConfig, type SceneElement, type SceneSpec, type ScheduleController, type ScheduleJobConfig, type ScheduleStateRecord, type ScheduleTriggerConfig, type ScheduledCompileTask, type ScheduledExploreTask, type ScheduledLintTask, type ScheduledQueryTask, type ScheduledRunResult, type ScheduledTaskConfig, type SearchResult, type SourceAnalysis, type SourceAttachment, type SourceClaim, type SourceKind, type SourceManifest, type SourceRationale, type VaultConfig, type WatchController, type WatchOptions, type WatchRunRecord, type WebSearchAdapter, type WebSearchProviderConfig, type WebSearchProviderType, type WebSearchResult, acceptApproval, agentTypeSchema, archiveCandidate, assertProviderCapability, bootstrapDemo, compileVault, createMcpServer, createProvider, createWebSearchAdapter, defaultVaultConfig, defaultVaultSchema, explainGraphVault, exploreVault, exportGraphHtml, getProviderForTask, getWebSearchAdapterForTask, getWorkspaceInfo, importInbox, ingestDirectory, ingestInput, initVault, initWorkspace, installAgent, installConfiguredAgents, lintVault, listApprovals, listCandidates, listGodNodes, listManifests, listPages, listSchedules, loadVaultConfig, loadVaultSchema, loadVaultSchemas, pathGraphVault, promoteCandidate, providerCapabilitySchema, providerTypeSchema, queryGraphVault, queryVault, readApproval, readExtractedText, readPage, rejectApproval, resolvePaths, runSchedule, searchVault, serveSchedules, startGraphServer, startMcpServer, watchVault, webSearchProviderTypeSchema };