@swarmvaultai/engine 0.1.32 → 0.2.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/LICENSE +21 -0
- package/README.md +23 -1
- package/dist/chunk-CWLDFLH2.js +1163 -0
- package/dist/index.d.ts +68 -2
- package/dist/index.js +1924 -505
- package/dist/registry-2REAPKPO.js +12 -0
- package/package.json +8 -7
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
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.
|
package/README.md
CHANGED
|
@@ -20,10 +20,12 @@ If you only want to use SwarmVault as a tool, install `@swarmvaultai/cli` instea
|
|
|
20
20
|
```ts
|
|
21
21
|
import {
|
|
22
22
|
addInput,
|
|
23
|
+
addManagedSource,
|
|
23
24
|
benchmarkVault,
|
|
24
25
|
compileVault,
|
|
25
26
|
createMcpServer,
|
|
26
27
|
createWebSearchAdapter,
|
|
28
|
+
deleteManagedSource,
|
|
27
29
|
defaultVaultConfig,
|
|
28
30
|
defaultVaultSchema,
|
|
29
31
|
exploreVault,
|
|
@@ -40,6 +42,7 @@ import {
|
|
|
40
42
|
getWebSearchAdapterForTask,
|
|
41
43
|
lintVault,
|
|
42
44
|
listGodNodes,
|
|
45
|
+
listManagedSourceRecords,
|
|
43
46
|
listSchedules,
|
|
44
47
|
loadVaultConfig,
|
|
45
48
|
loadVaultSchema,
|
|
@@ -48,6 +51,7 @@ import {
|
|
|
48
51
|
pushGraphNeo4j,
|
|
49
52
|
queryGraphVault,
|
|
50
53
|
queryVault,
|
|
54
|
+
reloadManagedSources,
|
|
51
55
|
runWatchCycle,
|
|
52
56
|
runSchedule,
|
|
53
57
|
searchVault,
|
|
@@ -67,6 +71,7 @@ The engine also exports the main runtime types for providers, graph artifacts, p
|
|
|
67
71
|
```ts
|
|
68
72
|
import {
|
|
69
73
|
addInput,
|
|
74
|
+
addManagedSource,
|
|
70
75
|
benchmarkVault,
|
|
71
76
|
compileVault,
|
|
72
77
|
exploreVault,
|
|
@@ -76,10 +81,12 @@ import {
|
|
|
76
81
|
importInbox,
|
|
77
82
|
initVault,
|
|
78
83
|
installGitHooks,
|
|
84
|
+
listManagedSourceRecords,
|
|
79
85
|
loadVaultSchemas,
|
|
80
86
|
pushGraphNeo4j,
|
|
81
87
|
queryGraphVault,
|
|
82
88
|
queryVault,
|
|
89
|
+
reloadManagedSources,
|
|
83
90
|
runWatchCycle,
|
|
84
91
|
watchVault
|
|
85
92
|
} from "@swarmvaultai/engine";
|
|
@@ -89,6 +96,8 @@ const rootDir = process.cwd();
|
|
|
89
96
|
await initVault(rootDir, { obsidian: true });
|
|
90
97
|
const schemas = await loadVaultSchemas(rootDir);
|
|
91
98
|
console.log(schemas.root.path);
|
|
99
|
+
const managed = await addManagedSource(rootDir, "https://github.com/karpathy/micrograd");
|
|
100
|
+
console.log(managed.source.id);
|
|
92
101
|
await addInput(rootDir, "https://arxiv.org/abs/2401.12345");
|
|
93
102
|
await importInbox(rootDir);
|
|
94
103
|
await compileVault(rootDir, {});
|
|
@@ -115,6 +124,8 @@ await pushGraphNeo4j(rootDir, {
|
|
|
115
124
|
|
|
116
125
|
await runWatchCycle(rootDir, { repo: true });
|
|
117
126
|
console.log(await getWatchStatus(rootDir));
|
|
127
|
+
console.log(await listManagedSourceRecords(rootDir));
|
|
128
|
+
await reloadManagedSources(rootDir, { all: true, compile: true });
|
|
118
129
|
await installGitHooks(rootDir);
|
|
119
130
|
|
|
120
131
|
const watcher = await watchVault(rootDir, { lint: true, repo: true });
|
|
@@ -170,15 +181,23 @@ This matters because many "OpenAI-compatible" backends only implement part of th
|
|
|
170
181
|
|
|
171
182
|
### Ingest
|
|
172
183
|
|
|
184
|
+
- `addManagedSource(rootDir, input, { compile, brief, maxPages, maxDepth })` registers and syncs a recurring source, then optionally compiles and writes a source brief
|
|
185
|
+
- `listManagedSourceRecords(rootDir)` lists registry-backed managed sources from `state/sources.json`
|
|
186
|
+
- `reloadManagedSources(rootDir, { id, all, compile, brief, maxPages, maxDepth })` re-syncs one managed source or the full registry
|
|
187
|
+
- `deleteManagedSource(rootDir, id)` removes a managed-source registry entry and transient sync state without deleting canonical vault artifacts
|
|
173
188
|
- `ingestInput(rootDir, input, { includeAssets, maxAssetSize })` ingests a local file path or URL
|
|
174
189
|
- `addInput(rootDir, input, { author, contributor })` captures supported URLs into normalized markdown before ingesting them, or falls back to generic URL ingest
|
|
175
190
|
- `ingestDirectory(rootDir, inputDir, { repoRoot, include, exclude, maxFiles, gitignore, extractClasses })` recursively ingests a local directory as a repo-aware code/content source tree
|
|
176
191
|
- `importInbox(rootDir, inputDir?)` recursively imports supported inbox files plus markdown and HTML browser-clipper style bundles
|
|
177
|
-
-
|
|
192
|
+
- managed sources support local directories, public GitHub repo root URLs, and bounded same-domain docs hubs
|
|
193
|
+
- registry data lives in `state/sources.json`, working state lives under `state/sources/<id>/`, and source briefs are written to `wiki/outputs/source-briefs/<id>.md`
|
|
194
|
+
- JavaScript, TypeScript, Python, Go, Rust, Java, C#, C, C++, PHP, Ruby, PowerShell, Kotlin, and Scala inputs are treated as code sources and compiled into both source pages and `wiki/code/` module pages
|
|
195
|
+
- `.rst` and `.rest` inputs are treated as first-class text sources with lightweight heading and directive normalization before analysis
|
|
178
196
|
- code manifests can carry `repoRelativePath`, and compile writes `state/code-index.json` so local imports can resolve across an ingested repo tree
|
|
179
197
|
- repo-aware manifests, graph nodes, and graph pages can also carry `sourceClass` so first-party, third-party, resource, and generated material can be filtered and reported separately
|
|
180
198
|
- HTML and markdown URL ingests localize remote image references into `raw/assets/<sourceId>/` by default and rewrite the stored markdown to local relative paths
|
|
181
199
|
- PDF and DOCX ingests now write extracted-text and metadata sidecars under `state/extracts/`, and image ingest keeps the same sidecar model for vision extraction
|
|
200
|
+
- Tree-sitter-backed languages now verify runtime and grammar compatibility per language; failures stay local to the affected source and surface as diagnostics instead of aborting the whole compile
|
|
182
201
|
|
|
183
202
|
### Compile + Query
|
|
184
203
|
|
|
@@ -206,6 +225,7 @@ This matters because many "OpenAI-compatible" backends only implement part of th
|
|
|
206
225
|
- `getWatchStatus(rootDir)` reads the latest watch-status artifact plus pending semantic refresh entries
|
|
207
226
|
- `syncTrackedRepos(rootDir)` refreshes previously ingested repo roots, updates changed manifests, and removes deleted repo manifests
|
|
208
227
|
- `syncTrackedReposForWatch(rootDir)` is the repo-watch sync path that defers non-code semantic refresh into `state/watch/`
|
|
228
|
+
- large ingest and compile passes emit low-noise progress on TTYs, and report presentation rolls up tiny fragmented communities without mutating the canonical graph artifact
|
|
209
229
|
- `installGitHooks(rootDir)`, `uninstallGitHooks(rootDir)`, and `getGitHookStatus(rootDir)` manage local `post-commit` and `post-checkout` hook blocks for the nearest git repository
|
|
210
230
|
- `installAgent(rootDir, agent, { hook })` writes agent instructions and returns the primary `target`, all touched `targets`, and optional merge warnings for agents such as Aider
|
|
211
231
|
- `lintVault(rootDir, options)` runs structural lint, optional deep lint, optional contradiction-only filtering through `{ conflicts: true }`, and optional web-augmented evidence gathering
|
|
@@ -245,6 +265,8 @@ Running the engine produces a local workspace with these main areas:
|
|
|
245
265
|
- `wiki/projects/`: generated project rollups over canonical pages
|
|
246
266
|
- `wiki/candidates/`: staged concept and entity pages awaiting confirmation on a later compile
|
|
247
267
|
- `state/manifests/`: source manifests
|
|
268
|
+
- `state/sources.json`: managed-source registry state
|
|
269
|
+
- `state/sources/`: managed-source working state such as GitHub checkouts and crawl metadata
|
|
248
270
|
- `state/extracts/`: extracted markdown plus JSON sidecars describing extractor kind, warnings, PDF page counts, and image-vision metadata
|
|
249
271
|
- `state/analyses/`: model analysis output
|
|
250
272
|
- `state/code-index.json`: repo-aware code module aliases and local resolution data
|