@swarmvaultai/engine 3.4.0 → 3.5.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/chunk-HKU2T5JX.js +25213 -0
- package/dist/hooks/codex.js +180 -0
- package/dist/index.d.ts +59 -1
- package/dist/index.js +28 -2
- package/dist/memory-K3NL5E3K.js +32 -0
- package/package.json +2 -2
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/hooks/marker-state.ts
|
|
4
|
+
import crypto from "crypto";
|
|
5
|
+
import fs from "fs/promises";
|
|
6
|
+
import os from "os";
|
|
7
|
+
import path from "path";
|
|
8
|
+
function markerState(cwd, agentKey) {
|
|
9
|
+
const hash = crypto.createHash("sha256").update(cwd).digest("hex");
|
|
10
|
+
const dir = path.join(os.tmpdir(), "swarmvault-agent-hooks", agentKey, hash);
|
|
11
|
+
return {
|
|
12
|
+
dir,
|
|
13
|
+
markerPath: path.join(dir, "report-read")
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
function isReportPath(value, cwd) {
|
|
17
|
+
if (typeof value !== "string" || value.length === 0) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
const reportSuffix = path.join("wiki", "graph", "report.md");
|
|
21
|
+
const normalized = value.replaceAll("\\", "/");
|
|
22
|
+
const reportNormalized = reportSuffix.replaceAll("\\", "/");
|
|
23
|
+
if (normalized.endsWith(reportNormalized)) {
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
return path.resolve(cwd, value) === path.resolve(cwd, reportSuffix);
|
|
27
|
+
}
|
|
28
|
+
function collectCandidatePaths(node, acc = []) {
|
|
29
|
+
if (typeof node === "string") {
|
|
30
|
+
acc.push(node);
|
|
31
|
+
return acc;
|
|
32
|
+
}
|
|
33
|
+
if (!node || typeof node !== "object") {
|
|
34
|
+
return acc;
|
|
35
|
+
}
|
|
36
|
+
if (Array.isArray(node)) {
|
|
37
|
+
for (const item of node) {
|
|
38
|
+
collectCandidatePaths(item, acc);
|
|
39
|
+
}
|
|
40
|
+
return acc;
|
|
41
|
+
}
|
|
42
|
+
for (const [key, value] of Object.entries(node)) {
|
|
43
|
+
if (["path", "filePath", "file_path", "paths", "target", "targets"].includes(key)) {
|
|
44
|
+
collectCandidatePaths(value, acc);
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
47
|
+
collectCandidatePaths(value, acc);
|
|
48
|
+
}
|
|
49
|
+
return acc;
|
|
50
|
+
}
|
|
51
|
+
function resolveInputCwd(input) {
|
|
52
|
+
const shaped = input ?? {};
|
|
53
|
+
const candidate = typeof shaped.cwd === "string" && shaped.cwd || typeof shaped.directory === "string" && shaped.directory || typeof shaped.workspace?.cwd === "string" && shaped.workspace.cwd || typeof shaped.toolInput?.cwd === "string" && shaped.toolInput.cwd || process.cwd();
|
|
54
|
+
return path.resolve(candidate);
|
|
55
|
+
}
|
|
56
|
+
function resolveToolName(input) {
|
|
57
|
+
const shaped = input ?? {};
|
|
58
|
+
return String(shaped.toolName ?? shaped.tool_name ?? shaped.tool?.name ?? shaped.name ?? "");
|
|
59
|
+
}
|
|
60
|
+
async function hasReport(cwd) {
|
|
61
|
+
try {
|
|
62
|
+
await fs.access(path.join(cwd, "wiki", "graph", "report.md"));
|
|
63
|
+
return true;
|
|
64
|
+
} catch {
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
async function markReportRead(cwd, agentKey) {
|
|
69
|
+
const state = markerState(cwd, agentKey);
|
|
70
|
+
await fs.mkdir(state.dir, { recursive: true });
|
|
71
|
+
await fs.writeFile(state.markerPath, "seen\n", "utf8");
|
|
72
|
+
}
|
|
73
|
+
async function hasSeenReport(cwd, agentKey) {
|
|
74
|
+
const state = markerState(cwd, agentKey);
|
|
75
|
+
try {
|
|
76
|
+
await fs.access(state.markerPath);
|
|
77
|
+
return true;
|
|
78
|
+
} catch {
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
async function resetSession(cwd, agentKey) {
|
|
83
|
+
const state = markerState(cwd, agentKey);
|
|
84
|
+
await fs.rm(state.dir, { recursive: true, force: true });
|
|
85
|
+
}
|
|
86
|
+
function isBroadSearchTool(toolName) {
|
|
87
|
+
return /grep|glob|search|find/i.test(toolName);
|
|
88
|
+
}
|
|
89
|
+
function collectCommandCandidates(node, acc = []) {
|
|
90
|
+
if (!node || typeof node !== "object") {
|
|
91
|
+
return acc;
|
|
92
|
+
}
|
|
93
|
+
if (Array.isArray(node)) {
|
|
94
|
+
for (const item of node) {
|
|
95
|
+
collectCommandCandidates(item, acc);
|
|
96
|
+
}
|
|
97
|
+
return acc;
|
|
98
|
+
}
|
|
99
|
+
for (const [key, value] of Object.entries(node)) {
|
|
100
|
+
if (["command", "cmd", "script", "bash", "shell"].includes(key) && typeof value === "string") {
|
|
101
|
+
acc.push(value);
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
collectCommandCandidates(value, acc);
|
|
105
|
+
}
|
|
106
|
+
return acc;
|
|
107
|
+
}
|
|
108
|
+
function commandLooksLikeBroadSearch(command) {
|
|
109
|
+
const tokens = command.replace(/[;&|()]/g, " ").split(/\s+/).map((token) => path.basename(token.replace(/^['"]|['"]$/g, ""))).filter(Boolean);
|
|
110
|
+
for (let index = 0; index < tokens.length; index += 1) {
|
|
111
|
+
const token = tokens[index];
|
|
112
|
+
if (["rg", "grep", "find", "fd", "ag", "ack"].includes(token)) {
|
|
113
|
+
return true;
|
|
114
|
+
}
|
|
115
|
+
if (token === "git" && tokens[index + 1] === "grep") {
|
|
116
|
+
return true;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return false;
|
|
120
|
+
}
|
|
121
|
+
function isBroadSearchInput(input) {
|
|
122
|
+
const toolName = resolveToolName(input);
|
|
123
|
+
if (isBroadSearchTool(toolName)) {
|
|
124
|
+
return true;
|
|
125
|
+
}
|
|
126
|
+
return collectCommandCandidates(input).some(commandLooksLikeBroadSearch);
|
|
127
|
+
}
|
|
128
|
+
async function readHookInput() {
|
|
129
|
+
let body = "";
|
|
130
|
+
for await (const chunk of process.stdin) {
|
|
131
|
+
body += chunk;
|
|
132
|
+
}
|
|
133
|
+
if (!body.trim()) {
|
|
134
|
+
return {};
|
|
135
|
+
}
|
|
136
|
+
try {
|
|
137
|
+
return JSON.parse(body);
|
|
138
|
+
} catch {
|
|
139
|
+
return {};
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
var REPORT_NOTE = "SwarmVault graph report exists at wiki/graph/report.md. Read it before broad grep/glob searching.";
|
|
143
|
+
|
|
144
|
+
// src/hooks/codex.ts
|
|
145
|
+
var AGENT_KEY = "codex";
|
|
146
|
+
function emit(value) {
|
|
147
|
+
process.stdout.write(`${JSON.stringify(value)}
|
|
148
|
+
`);
|
|
149
|
+
}
|
|
150
|
+
function note() {
|
|
151
|
+
return {
|
|
152
|
+
priority: "IMPORTANT",
|
|
153
|
+
message: REPORT_NOTE
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
async function main() {
|
|
157
|
+
const mode = process.argv[2] ?? "";
|
|
158
|
+
const input = await readHookInput();
|
|
159
|
+
const cwd = resolveInputCwd(input);
|
|
160
|
+
if (!await hasReport(cwd)) {
|
|
161
|
+
emit({});
|
|
162
|
+
process.exit(0);
|
|
163
|
+
}
|
|
164
|
+
if (mode === "session-start") {
|
|
165
|
+
await resetSession(cwd, AGENT_KEY);
|
|
166
|
+
emit(note());
|
|
167
|
+
process.exit(0);
|
|
168
|
+
}
|
|
169
|
+
if (collectCandidatePaths(input).some((value) => isReportPath(value, cwd))) {
|
|
170
|
+
await markReportRead(cwd, AGENT_KEY);
|
|
171
|
+
emit({});
|
|
172
|
+
process.exit(0);
|
|
173
|
+
}
|
|
174
|
+
if (isBroadSearchInput(input) && !await hasSeenReport(cwd, AGENT_KEY)) {
|
|
175
|
+
emit(note());
|
|
176
|
+
process.exit(0);
|
|
177
|
+
}
|
|
178
|
+
emit({});
|
|
179
|
+
}
|
|
180
|
+
await main();
|
package/dist/index.d.ts
CHANGED
|
@@ -872,6 +872,62 @@ interface GraphArtifact {
|
|
|
872
872
|
sources: SourceManifest[];
|
|
873
873
|
pages: GraphPage[];
|
|
874
874
|
}
|
|
875
|
+
interface GraphStatsResult {
|
|
876
|
+
generatedAt: string;
|
|
877
|
+
counts: {
|
|
878
|
+
sources: number;
|
|
879
|
+
pages: number;
|
|
880
|
+
nodes: number;
|
|
881
|
+
edges: number;
|
|
882
|
+
hyperedges: number;
|
|
883
|
+
communities: number;
|
|
884
|
+
};
|
|
885
|
+
nodeTypes: Partial<Record<GraphNode["type"], number>>;
|
|
886
|
+
evidenceClasses: Partial<Record<EvidenceClass, number>>;
|
|
887
|
+
sourceClasses: Record<SourceClass, {
|
|
888
|
+
sources: number;
|
|
889
|
+
pages: number;
|
|
890
|
+
nodes: number;
|
|
891
|
+
}>;
|
|
892
|
+
edgeRelations: Record<string, number>;
|
|
893
|
+
hyperedgeRelations: Record<string, number>;
|
|
894
|
+
}
|
|
895
|
+
interface GraphCommunityResult {
|
|
896
|
+
generatedAt: string;
|
|
897
|
+
id: string;
|
|
898
|
+
label: string;
|
|
899
|
+
nodeCount: number;
|
|
900
|
+
pageCount: number;
|
|
901
|
+
edgeCount: number;
|
|
902
|
+
nodes: Array<{
|
|
903
|
+
id: string;
|
|
904
|
+
type: GraphNode["type"];
|
|
905
|
+
label: string;
|
|
906
|
+
pageId?: string;
|
|
907
|
+
sourceClass?: SourceClass;
|
|
908
|
+
degree?: number;
|
|
909
|
+
bridgeScore?: number;
|
|
910
|
+
confidence?: number;
|
|
911
|
+
}>;
|
|
912
|
+
pages: Array<{
|
|
913
|
+
id: string;
|
|
914
|
+
path: string;
|
|
915
|
+
title: string;
|
|
916
|
+
kind: PageKind;
|
|
917
|
+
sourceClass?: SourceClass;
|
|
918
|
+
freshness: Freshness;
|
|
919
|
+
}>;
|
|
920
|
+
edges: Array<{
|
|
921
|
+
id: string;
|
|
922
|
+
source: string;
|
|
923
|
+
target: string;
|
|
924
|
+
sourceLabel?: string;
|
|
925
|
+
targetLabel?: string;
|
|
926
|
+
relation: string;
|
|
927
|
+
evidenceClass: EvidenceClass;
|
|
928
|
+
confidence: number;
|
|
929
|
+
}>;
|
|
930
|
+
}
|
|
875
931
|
interface GraphQueryMatch {
|
|
876
932
|
type: "node" | "page" | "hyperedge";
|
|
877
933
|
id: string;
|
|
@@ -2860,6 +2916,8 @@ declare function benchmarkVault(rootDir: string, options?: BenchmarkOptions): Pr
|
|
|
2860
2916
|
declare function pathGraphVault(rootDir: string, from: string, to: string): Promise<GraphPathResult>;
|
|
2861
2917
|
declare function explainGraphVault(rootDir: string, target: string): Promise<GraphExplainResult>;
|
|
2862
2918
|
declare function listGraphHyperedges(rootDir: string, target?: string, limit?: number): Promise<GraphHyperedge[]>;
|
|
2919
|
+
declare function graphStatsVault(rootDir: string): Promise<GraphStatsResult>;
|
|
2920
|
+
declare function getGraphCommunityVault(rootDir: string, target: string, limit?: number): Promise<GraphCommunityResult>;
|
|
2863
2921
|
declare function readGraphReport(rootDir: string): Promise<GraphReportArtifact | null>;
|
|
2864
2922
|
declare function listGodNodes(rootDir: string, limit?: number): Promise<GraphNode[]>;
|
|
2865
2923
|
declare function blastRadiusVault(rootDir: string, target: string, options?: {
|
|
@@ -2959,4 +3017,4 @@ declare function createWebSearchAdapter(id: string, config: WebSearchProviderCon
|
|
|
2959
3017
|
type WebSearchTaskId = "deepLintProvider" | "queryProvider" | "exploreProvider";
|
|
2960
3018
|
declare function getWebSearchAdapterForTask(rootDir: string, task: WebSearchTaskId): Promise<WebSearchAdapter>;
|
|
2961
3019
|
|
|
2962
|
-
export { ALL_MIGRATIONS, type AddOptions, type AddResult, type AgentMemoryDecision, type AgentMemoryNote, type AgentMemoryResumeFormat, type AgentMemoryTask, type AgentMemoryTaskResult, type AgentMemoryTaskStatus, type AgentMemoryTaskSummary, type AgentType, type AnalyzedTerm, type ApprovalBundleType, type ApprovalChangeType, type ApprovalDetail, type ApprovalDiffHunk, type ApprovalDiffLine, type ApprovalEntry, type ApprovalEntryDetail, type ApprovalEntryLabel, type ApprovalEntryStatus, type ApprovalFrontmatterChange, type ApprovalManifest, type ApprovalStructuredDiff, type ApprovalSummary, type AudioTranscriptionRequest, type AudioTranscriptionResponse, type BenchmarkArtifact, type BenchmarkByClassEntry, type BenchmarkOptions, type BenchmarkQuestionResult, type BenchmarkSummary, type BlastRadiusResult, type BuildContextPackOptions, type BuildContextPackResult, type CandidatePromotionConfig, 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 ConsolidationConfig, type ConsolidationPromotion, type ConsolidationResult, type ContextPack, type ContextPackFormat, type ContextPackItem, type ContextPackItemKind, type ContextPackOmittedItem, type ContextPackSummary, DEFAULT_CONSOLIDATION_CONFIG, DEFAULT_HALF_LIFE_DAYS, DEFAULT_HALF_LIFE_DAYS_BY_SOURCE_CLASS, DEFAULT_PROMOTION_CONFIG, DEFAULT_REDACTION_PATTERNS, DEFAULT_STALE_THRESHOLD, type DegradationOutcome, type DirectoryIngestFailure, type DirectoryIngestResult, type DirectoryIngestSkip, type EmbeddingCacheArtifact, type EmbeddingCacheEntry, type EvidenceClass, type ExploreOptions, type ExploreResult, type ExploreStepResult, type ExtractionClaim, type ExtractionKind, type ExtractionTerm, type FinishMemoryTaskOptions, type Freshness, type FreshnessConfig, type GenerationAttachment, type GenerationRequest, type GenerationResponse, type GitHookStatus, type GraphArtifact, type GraphDiffResult, type GraphEdge, type GraphExplainNeighbor, type GraphExplainResult, type GraphExportFormat, type GraphExportResult, type GraphHyperedge, type GraphNode, type GraphPage, type GraphPathResult, type GraphPushCounts, type GraphPushNeo4jOptions, type GraphPushResult, type GraphQueryMatch, type GraphQueryResult, type GraphReportArtifact, type GraphShareArtifact, type GraphShareBundleFile, type GuidedSessionMode, type GuidedSourceSessionAnswers, type GuidedSourceSessionQuestion, type GuidedSourceSessionRecord, type GuidedSourceSessionStatus, type ImageGenerationRequest, type ImageGenerationResponse, type ImageVisionExtraction, type InboxImportResult, type InboxImportSkip, type IngestOptions, type InitOptions, type InputIngestResult, type InstallAgentOptions, type InstallAgentResult, LARGE_REPO_NODE_THRESHOLD, LOCAL_WHISPER_MODEL_SIZES, type LintFinding, type LintOptions, type LocalWhisperAdapterOptions, type LocalWhisperBinaryDiscovery, LocalWhisperProviderAdapter, type LocalWhisperSetupStatus, type ManagedSourceAddOptions, type ManagedSourceAddResult, type ManagedSourceDeleteResult, type ManagedSourceKind, type ManagedSourceRecord, type ManagedSourceReloadOptions, type ManagedSourceReloadResult, type ManagedSourceStatus, type ManagedSourceSyncCounts, type ManagedSourcesArtifact, type MemoryTier, type MigrationPlan, type MigrationResult, type MigrationStep, type Neo4jGraphSinkConfig, OPENAI_COMPATIBLE_CAPABILITY_MATRIX, type OpenAiCompatiblePresetId, 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 PendingSemanticRefreshEntry, type Polarity, type PromotionDecision, type PromotionGateKind, type PromotionGateResult, type PromotionSession, type ProviderAdapter, type ProviderCapability, type ProviderConfig, type ProviderPresetCapability, type ProviderRegistrationOptions, type ProviderRegistrationResult, type ProviderRoleExecutorConfig, type ProviderType, type QueryOptions, type QueryResult, type RedactionMatchSummary, type RedactionPatternConfig, type RedactionSettings, type RedactionSummary, type RepoSyncResult, type ResolvedLargeRepoDefaults, type ResolvedPaths, type ResumeMemoryTaskOptions, type ResumeMemoryTaskResult, type RetrievalConfig, type RetrievalDoctorResult, type RetrievalManifest, type RetrievalStatus, type ReviewActionResult, type RoleExecutorConfig, type SceneElement, type SceneSpec, type ScheduleController, type ScheduleJobConfig, type ScheduleStateRecord, type ScheduleTriggerConfig, type ScheduledCompileTask, type ScheduledConsolidateTask, type ScheduledExploreTask, type ScheduledLintTask, type ScheduledQueryTask, type ScheduledRunResult, type ScheduledTaskConfig, type SearchResult, type SourceAnalysis, type SourceAttachment, type SourceCaptureType, type SourceClaim, type SourceClass, type SourceExtractionArtifact, type SourceGuideResult, type SourceKind, type SourceManifest, type SourceRationale, type SourceReviewResult, type StartMemoryTaskOptions, type SynthesizedHubEdge, type SynthesizedHubNode, type SynthesizedHyperedgeHubs, type UpdateMemoryTaskOptions, type VaultConfig, type VaultDashboardPack, type VaultDoctorAction, type VaultDoctorCheck, type VaultDoctorCounts, type VaultDoctorRecommendation, type VaultDoctorRecommendationPriority, type VaultDoctorReport, type VaultDoctorSafeAction, type VaultDoctorStatus, type VaultProfileConfig, type VaultProfilePreset, type VaultVersionRecord, type WatchConfig, type WatchController, type WatchOptions, type WatchRepoSyncResult, type WatchRunRecord, type WatchStatusResult, type WebSearchAdapter, type WebSearchProviderConfig, type WebSearchProviderType, type WebSearchResult, type WhisperRunResult, type WhisperRunner, acceptApproval, addInput, addManagedSource, addWatchedRoot, agentTypeSchema, applyDecayToPages, archiveCandidate, assertProviderCapability, autoCommitWikiChanges, benchmarkVault, blastRadius, blastRadiusVault, bootstrapDemo, buildConfiguredRedactor, buildContextPack, buildGraphShareArtifact, buildMemoryGraphElements, buildRedactor, compileVault, computeDecayScore, consolidateVault, createMcpServer, createProvider, createSupersessionEdge, createWebSearchAdapter, defaultVaultConfig, defaultVaultSchema, deleteContextPack, deleteManagedSource, detectVaultVersion, discoverLocalWhisperBinary, doctorRetrieval, doctorVault, downloadWhisperModel, ensureMemoryLedger, estimatePageTokens, estimateTokens, evaluateCandidateForPromotion, expectedModelPath, explainGraphVault, exploreVault, exportGraphFormat, exportGraphHtml, exportGraphReportHtml, exportObsidianCanvas, exportObsidianVault, finishMemoryTask, getGitHookStatus, getProviderForTask, getRetrievalStatus, getWatchStatus, getWebSearchAdapterForTask, getWorkspaceInfo, graphDiff, guideManagedSource, guideSourceScope, importInbox, ingestDirectory, ingestInput, ingestInputDetailed, initVault, initWorkspace, installAgent, installConfiguredAgents, installGitHooks, lintVault, listApprovals, listCandidates, listContextPacks, listGodNodes, listGraphHyperedges, listManagedSourceRecords, listManifests, listMemoryTasks, listPages, listSchedules, listTrackedRepoRoots, listWatchedRoots, loadMemoryTaskPages, loadVaultConfig, loadVaultSchema, loadVaultSchemas, lookupPresetCapabilities, markSuperseded, memoryTaskHashes, modelDownloadUrl, pathGraphVault, persistDecayFrontmatter, planMigration, previewCandidatePromotions, promoteCandidate, providerCapabilitySchema, providerTypeSchema, pushGraphNeo4j, queryGraphVault, queryVault, readApproval, readContextPack, readExtractedText, readGraphReport, readMemoryTask, readPage, rebuildRetrievalIndex, registerLocalWhisperProvider, rejectApproval, reloadManagedSources, removeWatchedRoot, renderContextPackLlms, renderContextPackMarkdown, renderGraphShareBundleFiles, renderGraphShareMarkdown, renderGraphSharePreviewHtml, renderGraphShareSvg, renderMemoryTaskMarkdown, resetDecay, resolveConsolidationConfig, resolveDecayConfig, resolveLargeRepoDefaults, resolvePaths, resolveRedactionPatterns, resolveRetrievalConfig, resolveWatchedRepoRoots, resumeMemoryTask, resumeSourceSession, reviewManagedSource, reviewSourceScope, runAutoPromotion, runConsolidation, runDecayPass, runMigration, runSchedule, runWatchCycle, searchVault, serveSchedules, stageGeneratedOutputPages, startGraphServer, startMcpServer, startMemoryTask, summarizeLocalWhisperSetup, syncTrackedRepos, syncTrackedReposForWatch, synthesizeHyperedgeHubs, trimToTokenBudget, uninstallGitHooks, updateMemoryTask, watchVault, webSearchProviderTypeSchema, withCapabilityFallback, writeRetrievalManifest };
|
|
3020
|
+
export { ALL_MIGRATIONS, type AddOptions, type AddResult, type AgentMemoryDecision, type AgentMemoryNote, type AgentMemoryResumeFormat, type AgentMemoryTask, type AgentMemoryTaskResult, type AgentMemoryTaskStatus, type AgentMemoryTaskSummary, type AgentType, type AnalyzedTerm, type ApprovalBundleType, type ApprovalChangeType, type ApprovalDetail, type ApprovalDiffHunk, type ApprovalDiffLine, type ApprovalEntry, type ApprovalEntryDetail, type ApprovalEntryLabel, type ApprovalEntryStatus, type ApprovalFrontmatterChange, type ApprovalManifest, type ApprovalStructuredDiff, type ApprovalSummary, type AudioTranscriptionRequest, type AudioTranscriptionResponse, type BenchmarkArtifact, type BenchmarkByClassEntry, type BenchmarkOptions, type BenchmarkQuestionResult, type BenchmarkSummary, type BlastRadiusResult, type BuildContextPackOptions, type BuildContextPackResult, type CandidatePromotionConfig, 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 ConsolidationConfig, type ConsolidationPromotion, type ConsolidationResult, type ContextPack, type ContextPackFormat, type ContextPackItem, type ContextPackItemKind, type ContextPackOmittedItem, type ContextPackSummary, DEFAULT_CONSOLIDATION_CONFIG, DEFAULT_HALF_LIFE_DAYS, DEFAULT_HALF_LIFE_DAYS_BY_SOURCE_CLASS, DEFAULT_PROMOTION_CONFIG, DEFAULT_REDACTION_PATTERNS, DEFAULT_STALE_THRESHOLD, type DegradationOutcome, type DirectoryIngestFailure, type DirectoryIngestResult, type DirectoryIngestSkip, type EmbeddingCacheArtifact, type EmbeddingCacheEntry, type EvidenceClass, type ExploreOptions, type ExploreResult, type ExploreStepResult, type ExtractionClaim, type ExtractionKind, type ExtractionTerm, type FinishMemoryTaskOptions, type Freshness, type FreshnessConfig, type GenerationAttachment, type GenerationRequest, type GenerationResponse, type GitHookStatus, type GraphArtifact, type GraphCommunityResult, type GraphDiffResult, type GraphEdge, type GraphExplainNeighbor, type GraphExplainResult, type GraphExportFormat, type GraphExportResult, type GraphHyperedge, type GraphNode, type GraphPage, type GraphPathResult, type GraphPushCounts, type GraphPushNeo4jOptions, type GraphPushResult, type GraphQueryMatch, type GraphQueryResult, type GraphReportArtifact, type GraphShareArtifact, type GraphShareBundleFile, type GraphStatsResult, type GuidedSessionMode, type GuidedSourceSessionAnswers, type GuidedSourceSessionQuestion, type GuidedSourceSessionRecord, type GuidedSourceSessionStatus, type ImageGenerationRequest, type ImageGenerationResponse, type ImageVisionExtraction, type InboxImportResult, type InboxImportSkip, type IngestOptions, type InitOptions, type InputIngestResult, type InstallAgentOptions, type InstallAgentResult, LARGE_REPO_NODE_THRESHOLD, LOCAL_WHISPER_MODEL_SIZES, type LintFinding, type LintOptions, type LocalWhisperAdapterOptions, type LocalWhisperBinaryDiscovery, LocalWhisperProviderAdapter, type LocalWhisperSetupStatus, type ManagedSourceAddOptions, type ManagedSourceAddResult, type ManagedSourceDeleteResult, type ManagedSourceKind, type ManagedSourceRecord, type ManagedSourceReloadOptions, type ManagedSourceReloadResult, type ManagedSourceStatus, type ManagedSourceSyncCounts, type ManagedSourcesArtifact, type MemoryTier, type MigrationPlan, type MigrationResult, type MigrationStep, type Neo4jGraphSinkConfig, OPENAI_COMPATIBLE_CAPABILITY_MATRIX, type OpenAiCompatiblePresetId, 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 PendingSemanticRefreshEntry, type Polarity, type PromotionDecision, type PromotionGateKind, type PromotionGateResult, type PromotionSession, type ProviderAdapter, type ProviderCapability, type ProviderConfig, type ProviderPresetCapability, type ProviderRegistrationOptions, type ProviderRegistrationResult, type ProviderRoleExecutorConfig, type ProviderType, type QueryOptions, type QueryResult, type RedactionMatchSummary, type RedactionPatternConfig, type RedactionSettings, type RedactionSummary, type RepoSyncResult, type ResolvedLargeRepoDefaults, type ResolvedPaths, type ResumeMemoryTaskOptions, type ResumeMemoryTaskResult, type RetrievalConfig, type RetrievalDoctorResult, type RetrievalManifest, type RetrievalStatus, type ReviewActionResult, type RoleExecutorConfig, type SceneElement, type SceneSpec, type ScheduleController, type ScheduleJobConfig, type ScheduleStateRecord, type ScheduleTriggerConfig, type ScheduledCompileTask, type ScheduledConsolidateTask, type ScheduledExploreTask, type ScheduledLintTask, type ScheduledQueryTask, type ScheduledRunResult, type ScheduledTaskConfig, type SearchResult, type SourceAnalysis, type SourceAttachment, type SourceCaptureType, type SourceClaim, type SourceClass, type SourceExtractionArtifact, type SourceGuideResult, type SourceKind, type SourceManifest, type SourceRationale, type SourceReviewResult, type StartMemoryTaskOptions, type SynthesizedHubEdge, type SynthesizedHubNode, type SynthesizedHyperedgeHubs, type UpdateMemoryTaskOptions, type VaultConfig, type VaultDashboardPack, type VaultDoctorAction, type VaultDoctorCheck, type VaultDoctorCounts, type VaultDoctorRecommendation, type VaultDoctorRecommendationPriority, type VaultDoctorReport, type VaultDoctorSafeAction, type VaultDoctorStatus, type VaultProfileConfig, type VaultProfilePreset, type VaultVersionRecord, type WatchConfig, type WatchController, type WatchOptions, type WatchRepoSyncResult, type WatchRunRecord, type WatchStatusResult, type WebSearchAdapter, type WebSearchProviderConfig, type WebSearchProviderType, type WebSearchResult, type WhisperRunResult, type WhisperRunner, acceptApproval, addInput, addManagedSource, addWatchedRoot, agentTypeSchema, applyDecayToPages, archiveCandidate, assertProviderCapability, autoCommitWikiChanges, benchmarkVault, blastRadius, blastRadiusVault, bootstrapDemo, buildConfiguredRedactor, buildContextPack, buildGraphShareArtifact, buildMemoryGraphElements, buildRedactor, compileVault, computeDecayScore, consolidateVault, createMcpServer, createProvider, createSupersessionEdge, createWebSearchAdapter, defaultVaultConfig, defaultVaultSchema, deleteContextPack, deleteManagedSource, detectVaultVersion, discoverLocalWhisperBinary, doctorRetrieval, doctorVault, downloadWhisperModel, ensureMemoryLedger, estimatePageTokens, estimateTokens, evaluateCandidateForPromotion, expectedModelPath, explainGraphVault, exploreVault, exportGraphFormat, exportGraphHtml, exportGraphReportHtml, exportObsidianCanvas, exportObsidianVault, finishMemoryTask, getGitHookStatus, getGraphCommunityVault, getProviderForTask, getRetrievalStatus, getWatchStatus, getWebSearchAdapterForTask, getWorkspaceInfo, graphDiff, graphStatsVault, guideManagedSource, guideSourceScope, importInbox, ingestDirectory, ingestInput, ingestInputDetailed, initVault, initWorkspace, installAgent, installConfiguredAgents, installGitHooks, lintVault, listApprovals, listCandidates, listContextPacks, listGodNodes, listGraphHyperedges, listManagedSourceRecords, listManifests, listMemoryTasks, listPages, listSchedules, listTrackedRepoRoots, listWatchedRoots, loadMemoryTaskPages, loadVaultConfig, loadVaultSchema, loadVaultSchemas, lookupPresetCapabilities, markSuperseded, memoryTaskHashes, modelDownloadUrl, pathGraphVault, persistDecayFrontmatter, planMigration, previewCandidatePromotions, promoteCandidate, providerCapabilitySchema, providerTypeSchema, pushGraphNeo4j, queryGraphVault, queryVault, readApproval, readContextPack, readExtractedText, readGraphReport, readMemoryTask, readPage, rebuildRetrievalIndex, registerLocalWhisperProvider, rejectApproval, reloadManagedSources, removeWatchedRoot, renderContextPackLlms, renderContextPackMarkdown, renderGraphShareBundleFiles, renderGraphShareMarkdown, renderGraphSharePreviewHtml, renderGraphShareSvg, renderMemoryTaskMarkdown, resetDecay, resolveConsolidationConfig, resolveDecayConfig, resolveLargeRepoDefaults, resolvePaths, resolveRedactionPatterns, resolveRetrievalConfig, resolveWatchedRepoRoots, resumeMemoryTask, resumeSourceSession, reviewManagedSource, reviewSourceScope, runAutoPromotion, runConsolidation, runDecayPass, runMigration, runSchedule, runWatchCycle, searchVault, serveSchedules, stageGeneratedOutputPages, startGraphServer, startMcpServer, startMemoryTask, summarizeLocalWhisperSetup, syncTrackedRepos, syncTrackedReposForWatch, synthesizeHyperedgeHubs, trimToTokenBudget, uninstallGitHooks, updateMemoryTask, watchVault, webSearchProviderTypeSchema, withCapabilityFallback, writeRetrievalManifest };
|
package/dist/index.js
CHANGED
|
@@ -38,11 +38,13 @@ import {
|
|
|
38
38
|
exploreVault,
|
|
39
39
|
findLatestGuidedSourceSessionByScope,
|
|
40
40
|
finishMemoryTask,
|
|
41
|
+
getGraphCommunityVault,
|
|
41
42
|
getRetrievalStatus,
|
|
42
43
|
getWebSearchAdapterForTask,
|
|
43
44
|
getWorkspaceInfo,
|
|
44
45
|
graphDiff,
|
|
45
46
|
graphHash,
|
|
47
|
+
graphStatsVault,
|
|
46
48
|
guidedSourceSessionStatePath,
|
|
47
49
|
importInbox,
|
|
48
50
|
ingestDirectory,
|
|
@@ -121,7 +123,7 @@ import {
|
|
|
121
123
|
writeGuidedSourceSession,
|
|
122
124
|
writeRetrievalManifest,
|
|
123
125
|
writeWatchStatusArtifact
|
|
124
|
-
} from "./chunk-
|
|
126
|
+
} from "./chunk-HKU2T5JX.js";
|
|
125
127
|
import {
|
|
126
128
|
LocalWhisperProviderAdapter,
|
|
127
129
|
appendJsonLine,
|
|
@@ -4062,7 +4064,7 @@ import path7 from "path";
|
|
|
4062
4064
|
import { McpServer, ResourceTemplate } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
4063
4065
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4064
4066
|
import { z } from "zod";
|
|
4065
|
-
var SERVER_VERSION = "3.
|
|
4067
|
+
var SERVER_VERSION = "3.5.0";
|
|
4066
4068
|
async function createMcpServer(rootDir) {
|
|
4067
4069
|
const server = new McpServer({
|
|
4068
4070
|
name: "swarmvault",
|
|
@@ -4191,6 +4193,15 @@ async function createMcpServer(rootDir) {
|
|
|
4191
4193
|
return asToolText(await readGraphReport(rootDir) ?? { error: "Graph report not found. Run `swarmvault compile` first." });
|
|
4192
4194
|
})
|
|
4193
4195
|
);
|
|
4196
|
+
server.registerTool(
|
|
4197
|
+
"graph_stats",
|
|
4198
|
+
{
|
|
4199
|
+
description: "Return lightweight counts for graph nodes, evidence classes, source classes, communities, pages, and edges."
|
|
4200
|
+
},
|
|
4201
|
+
safeHandler(async () => {
|
|
4202
|
+
return asToolText(await graphStatsVault(rootDir));
|
|
4203
|
+
})
|
|
4204
|
+
);
|
|
4194
4205
|
server.registerTool(
|
|
4195
4206
|
"get_node",
|
|
4196
4207
|
{
|
|
@@ -4203,6 +4214,19 @@ async function createMcpServer(rootDir) {
|
|
|
4203
4214
|
return asToolText(await explainGraphVault(rootDir, target));
|
|
4204
4215
|
})
|
|
4205
4216
|
);
|
|
4217
|
+
server.registerTool(
|
|
4218
|
+
"get_community",
|
|
4219
|
+
{
|
|
4220
|
+
description: "Return members, pages, and top evidence edges for a graph community by id or label.",
|
|
4221
|
+
inputSchema: {
|
|
4222
|
+
target: z.string().min(1).describe("Community id or label"),
|
|
4223
|
+
limit: z.number().int().min(1).max(100).optional().describe("Maximum evidence edges to return")
|
|
4224
|
+
}
|
|
4225
|
+
},
|
|
4226
|
+
safeHandler(async ({ target, limit }) => {
|
|
4227
|
+
return asToolText(await getGraphCommunityVault(rootDir, target, limit ?? 25));
|
|
4228
|
+
})
|
|
4229
|
+
);
|
|
4206
4230
|
server.registerTool(
|
|
4207
4231
|
"get_hyperedges",
|
|
4208
4232
|
{
|
|
@@ -8054,12 +8078,14 @@ export {
|
|
|
8054
8078
|
exportObsidianVault,
|
|
8055
8079
|
finishMemoryTask,
|
|
8056
8080
|
getGitHookStatus,
|
|
8081
|
+
getGraphCommunityVault,
|
|
8057
8082
|
getProviderForTask,
|
|
8058
8083
|
getRetrievalStatus,
|
|
8059
8084
|
getWatchStatus,
|
|
8060
8085
|
getWebSearchAdapterForTask,
|
|
8061
8086
|
getWorkspaceInfo,
|
|
8062
8087
|
graphDiff,
|
|
8088
|
+
graphStatsVault,
|
|
8063
8089
|
guideManagedSource,
|
|
8064
8090
|
guideSourceScope,
|
|
8065
8091
|
importInbox,
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import {
|
|
2
|
+
buildMemoryGraphElements,
|
|
3
|
+
ensureMemoryLedger,
|
|
4
|
+
estimateMemoryTaskTokens,
|
|
5
|
+
finishMemoryTask,
|
|
6
|
+
listMemoryTasks,
|
|
7
|
+
loadMemoryTaskPages,
|
|
8
|
+
memoryTaskHashes,
|
|
9
|
+
memoryTaskPageRecord,
|
|
10
|
+
readMemoryTask,
|
|
11
|
+
renderMemoryTaskMarkdown,
|
|
12
|
+
resumeMemoryTask,
|
|
13
|
+
startMemoryTask,
|
|
14
|
+
updateMemoryTask
|
|
15
|
+
} from "./chunk-HKU2T5JX.js";
|
|
16
|
+
import "./chunk-7QHDATCQ.js";
|
|
17
|
+
import "./chunk-NAIERP4C.js";
|
|
18
|
+
export {
|
|
19
|
+
buildMemoryGraphElements,
|
|
20
|
+
ensureMemoryLedger,
|
|
21
|
+
estimateMemoryTaskTokens,
|
|
22
|
+
finishMemoryTask,
|
|
23
|
+
listMemoryTasks,
|
|
24
|
+
loadMemoryTaskPages,
|
|
25
|
+
memoryTaskHashes,
|
|
26
|
+
memoryTaskPageRecord,
|
|
27
|
+
readMemoryTask,
|
|
28
|
+
renderMemoryTaskMarkdown,
|
|
29
|
+
resumeMemoryTask,
|
|
30
|
+
startMemoryTask,
|
|
31
|
+
updateMemoryTask
|
|
32
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@swarmvaultai/engine",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.5.0",
|
|
4
4
|
"description": "Core engine for SwarmVault: ingest, compile, query, lint, and provider abstractions.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"scripts": {
|
|
43
43
|
"build": "test -f ../viewer/dist/index.html || pnpm --dir ../viewer build; tsup src/index.ts --format esm --dts && tsup --config tsup.hooks.config.ts && rm -rf dist/viewer && mkdir -p dist/viewer && cp -R ../viewer/dist/. dist/viewer/",
|
|
44
44
|
"pretest": "tsup --config tsup.hooks.config.ts",
|
|
45
|
-
"test": "SWARMVAULT_ALLOW_PRIVATE_URLS=1 vitest run",
|
|
45
|
+
"test": "SWARMVAULT_ALLOW_PRIVATE_URLS=1 vitest run --testTimeout=10000",
|
|
46
46
|
"typecheck": "tsc --noEmit",
|
|
47
47
|
"prepublishOnly": "node ../../scripts/check-release-sync.mjs && node ../../scripts/check-published-manifests.mjs"
|
|
48
48
|
},
|