xtctx 0.3.2 → 0.11.3
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/CHANGELOG.md +317 -122
- package/LICENSE +21 -21
- package/README.md +154 -121
- package/dist/src/cli/disconnect.d.ts +8 -0
- package/dist/src/cli/disconnect.d.ts.map +1 -0
- package/dist/src/cli/disconnect.js +42 -0
- package/dist/src/cli/disconnect.js.map +1 -0
- package/dist/src/cli/hook.d.ts +7 -0
- package/dist/src/cli/hook.d.ts.map +1 -0
- package/dist/src/cli/hook.js +32 -0
- package/dist/src/cli/hook.js.map +1 -0
- package/dist/src/cli/index.d.ts.map +1 -1
- package/dist/src/cli/index.js +86 -33
- package/dist/src/cli/index.js.map +1 -1
- package/dist/src/cli/setup.d.ts +8 -0
- package/dist/src/cli/setup.d.ts.map +1 -0
- package/dist/src/cli/setup.js +76 -0
- package/dist/src/cli/setup.js.map +1 -0
- package/dist/src/cli/status.d.ts +7 -0
- package/dist/src/cli/status.d.ts.map +1 -0
- package/dist/src/cli/status.js +133 -0
- package/dist/src/cli/status.js.map +1 -0
- package/dist/src/config/disconnect.d.ts +34 -0
- package/dist/src/config/disconnect.d.ts.map +1 -0
- package/dist/src/config/disconnect.js +386 -0
- package/dist/src/config/disconnect.js.map +1 -0
- package/dist/src/config/managed-block.d.ts +29 -0
- package/dist/src/config/managed-block.d.ts.map +1 -0
- package/dist/src/config/managed-block.js +67 -0
- package/dist/src/config/managed-block.js.map +1 -0
- package/dist/src/config/mcp-config.d.ts +93 -0
- package/dist/src/config/mcp-config.d.ts.map +1 -0
- package/dist/src/config/mcp-config.js +556 -0
- package/dist/src/config/mcp-config.js.map +1 -0
- package/dist/src/config/setup.d.ts +39 -0
- package/dist/src/config/setup.d.ts.map +1 -0
- package/dist/src/config/setup.js +379 -0
- package/dist/src/config/setup.js.map +1 -0
- package/dist/src/config/skills.d.ts +73 -0
- package/dist/src/config/skills.d.ts.map +1 -0
- package/dist/src/config/skills.js +427 -0
- package/dist/src/config/skills.js.map +1 -0
- package/dist/src/handoff/embeddings.d.ts +26 -0
- package/dist/src/handoff/embeddings.d.ts.map +1 -0
- package/dist/src/handoff/embeddings.js +132 -0
- package/dist/src/handoff/embeddings.js.map +1 -0
- package/dist/src/handoff/sqlite-index.d.ts +52 -0
- package/dist/src/handoff/sqlite-index.d.ts.map +1 -0
- package/dist/src/handoff/sqlite-index.js +905 -0
- package/dist/src/handoff/sqlite-index.js.map +1 -0
- package/dist/src/handoff/types.d.ts +63 -0
- package/dist/src/handoff/types.d.ts.map +1 -0
- package/dist/src/handoff/types.js +2 -0
- package/dist/src/handoff/types.js.map +1 -0
- package/dist/src/handoff/vector.d.ts +4 -0
- package/dist/src/handoff/vector.d.ts.map +1 -0
- package/dist/src/handoff/vector.js +31 -0
- package/dist/src/handoff/vector.js.map +1 -0
- package/dist/src/mcp/server.d.ts +3 -20
- package/dist/src/mcp/server.d.ts.map +1 -1
- package/dist/src/mcp/server.js +90 -205
- package/dist/src/mcp/server.js.map +1 -1
- package/dist/src/mcp/tools/continuity.d.ts +21 -0
- package/dist/src/mcp/tools/continuity.d.ts.map +1 -0
- package/dist/src/mcp/tools/continuity.js +55 -0
- package/dist/src/mcp/tools/continuity.js.map +1 -0
- package/dist/src/mcp/tools/manifest.d.ts +40 -0
- package/dist/src/mcp/tools/manifest.d.ts.map +1 -0
- package/dist/src/mcp/tools/manifest.js +105 -0
- package/dist/src/mcp/tools/manifest.js.map +1 -0
- package/dist/src/mcp/tools/sessions.d.ts +18 -31
- package/dist/src/mcp/tools/sessions.d.ts.map +1 -1
- package/dist/src/mcp/tools/sessions.js +109 -16
- package/dist/src/mcp/tools/sessions.js.map +1 -1
- package/dist/src/runtime/services.d.ts +11 -38
- package/dist/src/runtime/services.d.ts.map +1 -1
- package/dist/src/runtime/services.js +61 -200
- package/dist/src/runtime/services.js.map +1 -1
- package/dist/src/scrapers/antigravity.d.ts +52 -0
- package/dist/src/scrapers/antigravity.d.ts.map +1 -0
- package/dist/src/scrapers/antigravity.js +869 -0
- package/dist/src/scrapers/antigravity.js.map +1 -0
- package/dist/src/scrapers/base.d.ts +53 -1
- package/dist/src/scrapers/base.d.ts.map +1 -1
- package/dist/src/scrapers/base.js +93 -4
- package/dist/src/scrapers/base.js.map +1 -1
- package/dist/src/scrapers/claude-code.d.ts +37 -6
- package/dist/src/scrapers/claude-code.d.ts.map +1 -1
- package/dist/src/scrapers/claude-code.js +214 -40
- package/dist/src/scrapers/claude-code.js.map +1 -1
- package/dist/src/scrapers/codex.d.ts +36 -6
- package/dist/src/scrapers/codex.d.ts.map +1 -1
- package/dist/src/scrapers/codex.js +283 -60
- package/dist/src/scrapers/codex.js.map +1 -1
- package/dist/src/scrapers/copilot-cli.d.ts +34 -0
- package/dist/src/scrapers/copilot-cli.d.ts.map +1 -0
- package/dist/src/scrapers/copilot-cli.js +342 -0
- package/dist/src/scrapers/copilot-cli.js.map +1 -0
- package/dist/src/scrapers/copilot.d.ts +41 -8
- package/dist/src/scrapers/copilot.d.ts.map +1 -1
- package/dist/src/scrapers/copilot.js +256 -118
- package/dist/src/scrapers/copilot.js.map +1 -1
- package/dist/src/scrapers/cursor.d.ts +24 -9
- package/dist/src/scrapers/cursor.d.ts.map +1 -1
- package/dist/src/scrapers/cursor.js +259 -152
- package/dist/src/scrapers/cursor.js.map +1 -1
- package/dist/src/scrapers/index.d.ts +23 -0
- package/dist/src/scrapers/index.d.ts.map +1 -0
- package/dist/src/scrapers/index.js +22 -0
- package/dist/src/scrapers/index.js.map +1 -0
- package/dist/src/scrapers/opencode.d.ts +37 -0
- package/dist/src/scrapers/opencode.d.ts.map +1 -0
- package/dist/src/scrapers/opencode.js +277 -0
- package/dist/src/scrapers/opencode.js.map +1 -0
- package/dist/src/scrapers/registry.d.ts +1 -0
- package/dist/src/scrapers/registry.d.ts.map +1 -1
- package/dist/src/scrapers/registry.js +3 -0
- package/dist/src/scrapers/registry.js.map +1 -1
- package/dist/src/tools/sources.d.ts +28 -0
- package/dist/src/tools/sources.d.ts.map +1 -0
- package/dist/src/tools/sources.js +149 -0
- package/dist/src/tools/sources.js.map +1 -0
- package/dist/src/types/config.d.ts +24 -37
- package/dist/src/types/config.d.ts.map +1 -1
- package/dist/src/types/index.d.ts +0 -2
- package/dist/src/types/index.d.ts.map +1 -1
- package/dist/src/types/index.js +0 -2
- package/dist/src/types/index.js.map +1 -1
- package/dist/src/types/scraper.d.ts +34 -5
- package/dist/src/types/scraper.d.ts.map +1 -1
- package/dist/src/utils/atomic-file.d.ts +8 -0
- package/dist/src/utils/atomic-file.d.ts.map +1 -0
- package/dist/src/utils/atomic-file.js +15 -0
- package/dist/src/utils/atomic-file.js.map +1 -0
- package/dist/src/utils/errors.d.ts +7 -0
- package/dist/src/utils/errors.d.ts.map +1 -0
- package/dist/src/utils/errors.js +16 -0
- package/dist/src/utils/errors.js.map +1 -0
- package/dist/src/utils/package-info.d.ts +11 -0
- package/dist/src/utils/package-info.d.ts.map +1 -0
- package/dist/src/utils/package-info.js +30 -0
- package/dist/src/utils/package-info.js.map +1 -0
- package/dist/src/utils/project-scope.d.ts +19 -0
- package/dist/src/utils/project-scope.d.ts.map +1 -0
- package/dist/src/utils/project-scope.js +61 -0
- package/dist/src/utils/project-scope.js.map +1 -0
- package/package.json +70 -66
- package/dist/src/api/routes/config.d.ts +0 -4
- package/dist/src/api/routes/config.d.ts.map +0 -1
- package/dist/src/api/routes/config.js +0 -61
- package/dist/src/api/routes/config.js.map +0 -1
- package/dist/src/api/routes/knowledge.d.ts +0 -4
- package/dist/src/api/routes/knowledge.d.ts.map +0 -1
- package/dist/src/api/routes/knowledge.js +0 -40
- package/dist/src/api/routes/knowledge.js.map +0 -1
- package/dist/src/api/routes/search.d.ts +0 -7
- package/dist/src/api/routes/search.d.ts.map +0 -1
- package/dist/src/api/routes/search.js +0 -108
- package/dist/src/api/routes/search.js.map +0 -1
- package/dist/src/api/routes/sources.d.ts +0 -12
- package/dist/src/api/routes/sources.d.ts.map +0 -1
- package/dist/src/api/routes/sources.js +0 -70
- package/dist/src/api/routes/sources.js.map +0 -1
- package/dist/src/api/server.d.ts +0 -26
- package/dist/src/api/server.d.ts.map +0 -1
- package/dist/src/api/server.js +0 -312
- package/dist/src/api/server.js.map +0 -1
- package/dist/src/cli/ingest.d.ts +0 -6
- package/dist/src/cli/ingest.d.ts.map +0 -1
- package/dist/src/cli/ingest.js +0 -11
- package/dist/src/cli/ingest.js.map +0 -1
- package/dist/src/cli/init.d.ts +0 -6
- package/dist/src/cli/init.d.ts.map +0 -1
- package/dist/src/cli/init.js +0 -105
- package/dist/src/cli/init.js.map +0 -1
- package/dist/src/cli/serve.d.ts +0 -7
- package/dist/src/cli/serve.d.ts.map +0 -1
- package/dist/src/cli/serve.js +0 -100
- package/dist/src/cli/serve.js.map +0 -1
- package/dist/src/cli/sync.d.ts +0 -5
- package/dist/src/cli/sync.d.ts.map +0 -1
- package/dist/src/cli/sync.js +0 -13
- package/dist/src/cli/sync.js.map +0 -1
- package/dist/src/compaction/pipeline.d.ts +0 -19
- package/dist/src/compaction/pipeline.d.ts.map +0 -1
- package/dist/src/compaction/pipeline.js +0 -37
- package/dist/src/compaction/pipeline.js.map +0 -1
- package/dist/src/compaction/providers/cli.d.ts +0 -13
- package/dist/src/compaction/providers/cli.d.ts.map +0 -1
- package/dist/src/compaction/providers/cli.js +0 -60
- package/dist/src/compaction/providers/cli.js.map +0 -1
- package/dist/src/compaction/rule-based.d.ts +0 -8
- package/dist/src/compaction/rule-based.d.ts.map +0 -1
- package/dist/src/compaction/rule-based.js +0 -120
- package/dist/src/compaction/rule-based.js.map +0 -1
- package/dist/src/config/loader.d.ts +0 -12
- package/dist/src/config/loader.d.ts.map +0 -1
- package/dist/src/config/loader.js +0 -76
- package/dist/src/config/loader.js.map +0 -1
- package/dist/src/config/mappings/claude-code.d.ts +0 -3
- package/dist/src/config/mappings/claude-code.d.ts.map +0 -1
- package/dist/src/config/mappings/claude-code.js +0 -31
- package/dist/src/config/mappings/claude-code.js.map +0 -1
- package/dist/src/config/mappings/codex.d.ts +0 -3
- package/dist/src/config/mappings/codex.d.ts.map +0 -1
- package/dist/src/config/mappings/codex.js +0 -31
- package/dist/src/config/mappings/codex.js.map +0 -1
- package/dist/src/config/mappings/copilot.d.ts +0 -3
- package/dist/src/config/mappings/copilot.d.ts.map +0 -1
- package/dist/src/config/mappings/copilot.js +0 -33
- package/dist/src/config/mappings/copilot.js.map +0 -1
- package/dist/src/config/mappings/cursor.d.ts +0 -3
- package/dist/src/config/mappings/cursor.d.ts.map +0 -1
- package/dist/src/config/mappings/cursor.js +0 -29
- package/dist/src/config/mappings/cursor.js.map +0 -1
- package/dist/src/config/sync.d.ts +0 -13
- package/dist/src/config/sync.d.ts.map +0 -1
- package/dist/src/config/sync.js +0 -96
- package/dist/src/config/sync.js.map +0 -1
- package/dist/src/ingestion/coordinator.d.ts +0 -37
- package/dist/src/ingestion/coordinator.d.ts.map +0 -1
- package/dist/src/ingestion/coordinator.js +0 -127
- package/dist/src/ingestion/coordinator.js.map +0 -1
- package/dist/src/ingestion/daemon.d.ts +0 -17
- package/dist/src/ingestion/daemon.d.ts.map +0 -1
- package/dist/src/ingestion/daemon.js +0 -35
- package/dist/src/ingestion/daemon.js.map +0 -1
- package/dist/src/ingestion/watcher.d.ts +0 -19
- package/dist/src/ingestion/watcher.d.ts.map +0 -1
- package/dist/src/ingestion/watcher.js +0 -70
- package/dist/src/ingestion/watcher.js.map +0 -1
- package/dist/src/knowledge/autotag.d.ts +0 -3
- package/dist/src/knowledge/autotag.d.ts.map +0 -1
- package/dist/src/knowledge/autotag.js +0 -24
- package/dist/src/knowledge/autotag.js.map +0 -1
- package/dist/src/knowledge/dedup.d.ts +0 -7
- package/dist/src/knowledge/dedup.d.ts.map +0 -1
- package/dist/src/knowledge/dedup.js +0 -15
- package/dist/src/knowledge/dedup.js.map +0 -1
- package/dist/src/knowledge/repository.d.ts +0 -12
- package/dist/src/knowledge/repository.d.ts.map +0 -1
- package/dist/src/knowledge/repository.js +0 -74
- package/dist/src/knowledge/repository.js.map +0 -1
- package/dist/src/mcp/tools/config.d.ts +0 -36
- package/dist/src/mcp/tools/config.d.ts.map +0 -1
- package/dist/src/mcp/tools/config.js +0 -54
- package/dist/src/mcp/tools/config.js.map +0 -1
- package/dist/src/mcp/tools/knowledge.d.ts +0 -17
- package/dist/src/mcp/tools/knowledge.d.ts.map +0 -1
- package/dist/src/mcp/tools/knowledge.js +0 -46
- package/dist/src/mcp/tools/knowledge.js.map +0 -1
- package/dist/src/mcp/tools/search.d.ts +0 -22
- package/dist/src/mcp/tools/search.d.ts.map +0 -1
- package/dist/src/mcp/tools/search.js +0 -30
- package/dist/src/mcp/tools/search.js.map +0 -1
- package/dist/src/mcp/tools/write.d.ts +0 -38
- package/dist/src/mcp/tools/write.d.ts.map +0 -1
- package/dist/src/mcp/tools/write.js +0 -97
- package/dist/src/mcp/tools/write.js.map +0 -1
- package/dist/src/runtime/ingestion.d.ts +0 -17
- package/dist/src/runtime/ingestion.d.ts.map +0 -1
- package/dist/src/runtime/ingestion.js +0 -106
- package/dist/src/runtime/ingestion.js.map +0 -1
- package/dist/src/scrapers/gemini.d.ts +0 -17
- package/dist/src/scrapers/gemini.d.ts.map +0 -1
- package/dist/src/scrapers/gemini.js +0 -245
- package/dist/src/scrapers/gemini.js.map +0 -1
- package/dist/src/store/embeddings.d.ts +0 -9
- package/dist/src/store/embeddings.d.ts.map +0 -1
- package/dist/src/store/embeddings.js +0 -28
- package/dist/src/store/embeddings.js.map +0 -1
- package/dist/src/store/lance.d.ts +0 -25
- package/dist/src/store/lance.d.ts.map +0 -1
- package/dist/src/store/lance.js +0 -74
- package/dist/src/store/lance.js.map +0 -1
- package/dist/src/store/search.d.ts +0 -18
- package/dist/src/store/search.d.ts.map +0 -1
- package/dist/src/store/search.js +0 -55
- package/dist/src/store/search.js.map +0 -1
- package/dist/src/types/compaction.d.ts +0 -29
- package/dist/src/types/compaction.d.ts.map +0 -1
- package/dist/src/types/compaction.js +0 -2
- package/dist/src/types/compaction.js.map +0 -1
- package/dist/src/types/context.d.ts +0 -33
- package/dist/src/types/context.d.ts.map +0 -1
- package/dist/src/types/context.js +0 -18
- package/dist/src/types/context.js.map +0 -1
- package/dist/src/utils/retry.d.ts +0 -11
- package/dist/src/utils/retry.d.ts.map +0 -1
- package/dist/src/utils/retry.js +0 -46
- package/dist/src/utils/retry.js.map +0 -1
- package/dist/src/utils/shutdown.d.ts +0 -25
- package/dist/src/utils/shutdown.d.ts.map +0 -1
- package/dist/src/utils/shutdown.js +0 -56
- package/dist/src/utils/shutdown.js.map +0 -1
- package/dist/web/apple-touch-icon.png +0 -0
- package/dist/web/assets/index-Nuadr5ox.css +0 -1
- package/dist/web/assets/index-aA0u8eXA.js +0 -3504
- package/dist/web/assets/primeicons-C6QP2o4f.woff2 +0 -0
- package/dist/web/assets/primeicons-DMOk5skT.eot +0 -0
- package/dist/web/assets/primeicons-Dr5RGzOO.svg +0 -345
- package/dist/web/assets/primeicons-MpK4pl85.ttf +0 -0
- package/dist/web/assets/primeicons-WjwUDZjB.woff +0 -0
- package/dist/web/favicon.ico +0 -0
- package/dist/web/favicon.svg +0 -21
- package/dist/web/index.html +0 -21
- package/dist/web/site.webmanifest +0 -19
- package/dist/web/vite.svg +0 -1
|
@@ -1,227 +1,88 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { readFile, realpath } from "node:fs/promises";
|
|
2
|
+
import { join, resolve } from "node:path";
|
|
3
3
|
import { parse as parseYaml } from "yaml";
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
for (const configType of types) {
|
|
22
|
-
const dir = join(this.configRoot, `${configType}s`);
|
|
23
|
-
let files;
|
|
24
|
-
try {
|
|
25
|
-
files = await readdir(dir);
|
|
26
|
-
}
|
|
27
|
-
catch {
|
|
28
|
-
continue;
|
|
29
|
-
}
|
|
30
|
-
for (const file of files) {
|
|
31
|
-
const parsed = await this.parseFile(join(dir, file), configType);
|
|
32
|
-
if (parsed) {
|
|
33
|
-
all.push(parsed);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
return all;
|
|
38
|
-
}
|
|
39
|
-
async get(type, name) {
|
|
40
|
-
const items = await this.list(type);
|
|
41
|
-
return items.find((item) => item.name === name) ?? null;
|
|
42
|
-
}
|
|
43
|
-
async toolPreferences(tool) {
|
|
44
|
-
const filePath = join(this.configRoot, "shared.yaml");
|
|
45
|
-
try {
|
|
46
|
-
const raw = await readFile(filePath, "utf-8");
|
|
47
|
-
const parsed = parseYaml(raw);
|
|
48
|
-
const prefs = parsed.toolPreferences;
|
|
49
|
-
if (prefs && typeof prefs === "object" && !Array.isArray(prefs)) {
|
|
50
|
-
const toolPrefs = prefs[tool];
|
|
51
|
-
if (toolPrefs && typeof toolPrefs === "object" && !Array.isArray(toolPrefs)) {
|
|
52
|
-
return toolPrefs;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
catch {
|
|
57
|
-
// fall through
|
|
58
|
-
}
|
|
59
|
-
return {};
|
|
4
|
+
import { SqliteHandoffIndex } from "../handoff/sqlite-index.js";
|
|
5
|
+
import { createDefaultScrapers } from "../tools/sources.js";
|
|
6
|
+
/**
|
|
7
|
+
* Resolve a project root through any symlinks.
|
|
8
|
+
*
|
|
9
|
+
* Every scraper attributes a session by comparing a path another tool
|
|
10
|
+
* recorded — and those tools record `process.cwd()`, which the OS reports
|
|
11
|
+
* canonically. On macOS the temp directory and plenty of ordinary home
|
|
12
|
+
* layouts are symlinks (`/var` -> `/private/var`), so a root given as the
|
|
13
|
+
* symlinked path matches nothing any tool ever wrote, and the project
|
|
14
|
+
* silently scrapes zero sessions. Falls back to the lexical path when the
|
|
15
|
+
* directory does not exist yet.
|
|
16
|
+
*/
|
|
17
|
+
async function canonicalProjectRoot(projectPath) {
|
|
18
|
+
const resolved = resolve(projectPath);
|
|
19
|
+
try {
|
|
20
|
+
return await realpath(resolved);
|
|
60
21
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
const raw = await readFile(filePath, "utf-8");
|
|
64
|
-
const name = filePath
|
|
65
|
-
.split(/[\\/]/)
|
|
66
|
-
.pop()
|
|
67
|
-
?.replace(/\.(json|ya?ml|md|txt)$/i, "");
|
|
68
|
-
if (!name) {
|
|
69
|
-
return null;
|
|
70
|
-
}
|
|
71
|
-
const extension = extname(filePath).toLowerCase();
|
|
72
|
-
if (extension === ".json") {
|
|
73
|
-
return { type, name, content: JSON.parse(raw) };
|
|
74
|
-
}
|
|
75
|
-
if (extension === ".yaml" || extension === ".yml") {
|
|
76
|
-
const parsed = parseYaml(raw);
|
|
77
|
-
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
78
|
-
return { type, name, content: parsed };
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
return { type, name, content: { text: raw } };
|
|
82
|
-
}
|
|
83
|
-
catch {
|
|
84
|
-
return null;
|
|
85
|
-
}
|
|
22
|
+
catch {
|
|
23
|
+
return resolved;
|
|
86
24
|
}
|
|
87
25
|
}
|
|
88
26
|
export async function createProjectServices(projectPath) {
|
|
89
|
-
const projectRoot =
|
|
27
|
+
const projectRoot = await canonicalProjectRoot(projectPath ?? process.cwd());
|
|
90
28
|
const xtctxDir = join(projectRoot, ".xtctx");
|
|
91
|
-
const storeDir = join(xtctxDir, ".store");
|
|
92
|
-
const knowledgeDir = join(xtctxDir, "knowledge");
|
|
93
|
-
const configRoot = join(xtctxDir, "tool-config");
|
|
94
29
|
const stateDir = join(xtctxDir, "state");
|
|
95
|
-
const
|
|
96
|
-
const
|
|
97
|
-
const
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
|
|
30
|
+
const dbPath = join(stateDir, "xtctx.db");
|
|
31
|
+
const configPath = join(xtctxDir, "config.yaml");
|
|
32
|
+
const config = await loadProjectConfig(configPath);
|
|
33
|
+
const overrides = Object.fromEntries(Object.entries(config.tools)
|
|
34
|
+
.filter(([, value]) => value.enabled !== false)
|
|
35
|
+
.map(([tool, value]) => [tool, value.storePath]));
|
|
36
|
+
const scrapers = createDefaultScrapers(stateDir, overrides, projectRoot).filter((scraper) => {
|
|
37
|
+
const toolConfig = config.tools[scraper.tool];
|
|
38
|
+
return toolConfig?.enabled !== false;
|
|
39
|
+
});
|
|
40
|
+
const sessions = new SqliteHandoffIndex(dbPath, projectRoot, scrapers.map((scraper) => ({ tool: scraper.tool, scraper })));
|
|
101
41
|
return {
|
|
102
42
|
projectRoot,
|
|
103
43
|
xtctxDir,
|
|
104
|
-
storeDir,
|
|
105
|
-
knowledgeDir,
|
|
106
|
-
configRoot,
|
|
107
44
|
stateDir,
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
sessions: new EmptySessionService(),
|
|
113
|
-
configs: new FileConfigStore(configRoot),
|
|
45
|
+
dbPath,
|
|
46
|
+
configPath,
|
|
47
|
+
config,
|
|
48
|
+
sessions,
|
|
114
49
|
};
|
|
115
50
|
}
|
|
116
|
-
async function loadProjectConfig(
|
|
117
|
-
const configPath = join(xtctxDir, "config.yaml");
|
|
51
|
+
export async function loadProjectConfig(configPath) {
|
|
118
52
|
try {
|
|
119
53
|
const raw = await readFile(configPath, "utf-8");
|
|
120
54
|
const parsed = parseYaml(raw);
|
|
121
55
|
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
122
|
-
|
|
56
|
+
const root = parsed;
|
|
57
|
+
return {
|
|
58
|
+
tools: normalizeTools(root.tools),
|
|
59
|
+
};
|
|
123
60
|
}
|
|
124
61
|
}
|
|
125
62
|
catch {
|
|
126
|
-
//
|
|
127
|
-
}
|
|
128
|
-
return {};
|
|
129
|
-
}
|
|
130
|
-
function parseWebPort(config) {
|
|
131
|
-
const web = config.web;
|
|
132
|
-
if (web && typeof web === "object" && !Array.isArray(web)) {
|
|
133
|
-
const port = Number(web.port);
|
|
134
|
-
if (Number.isFinite(port) && port > 0 && port < 65536) {
|
|
135
|
-
return port;
|
|
136
|
-
}
|
|
63
|
+
// Missing config is valid: setup owns writing it, MCP can still run.
|
|
137
64
|
}
|
|
138
|
-
return
|
|
65
|
+
return { tools: {} };
|
|
139
66
|
}
|
|
140
|
-
function
|
|
141
|
-
|
|
142
|
-
if (!api || typeof api !== "object" || Array.isArray(api)) {
|
|
67
|
+
function normalizeTools(input) {
|
|
68
|
+
if (!input || typeof input !== "object" || Array.isArray(input)) {
|
|
143
69
|
return {};
|
|
144
70
|
}
|
|
145
|
-
const
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
parsed.allowedOrigins = value.allowedOrigins.filter((item) => typeof item === "string" && item.length > 0);
|
|
160
|
-
}
|
|
161
|
-
if (typeof value.allowLocalhostOrigins === "boolean") {
|
|
162
|
-
parsed.allowLocalhostOrigins = value.allowLocalhostOrigins;
|
|
163
|
-
}
|
|
164
|
-
const rateLimitWindowMs = Number(value.rateLimitWindowMs);
|
|
165
|
-
if (Number.isFinite(rateLimitWindowMs) && rateLimitWindowMs > 0) {
|
|
166
|
-
parsed.rateLimitWindowMs = Math.floor(rateLimitWindowMs);
|
|
167
|
-
}
|
|
168
|
-
const rateLimitMax = Number(value.rateLimitMax);
|
|
169
|
-
if (Number.isFinite(rateLimitMax) && rateLimitMax > 0) {
|
|
170
|
-
parsed.rateLimitMax = Math.floor(rateLimitMax);
|
|
171
|
-
}
|
|
172
|
-
return parsed;
|
|
173
|
-
}
|
|
174
|
-
function parseIngestionConfig(config, projectRoot) {
|
|
175
|
-
const ingestion = config.ingestion;
|
|
176
|
-
const defaults = {
|
|
177
|
-
scrapers: [],
|
|
178
|
-
watchPaths: [projectRoot],
|
|
179
|
-
pollIntervalMs: 30_000,
|
|
180
|
-
excludePatterns: ["node_modules/**", "dist/**"],
|
|
181
|
-
};
|
|
182
|
-
if (!ingestion || typeof ingestion !== "object" || Array.isArray(ingestion)) {
|
|
183
|
-
return defaults;
|
|
71
|
+
const tools = {};
|
|
72
|
+
for (const [tool, rawConfig] of Object.entries(input)) {
|
|
73
|
+
if (!rawConfig || typeof rawConfig !== "object" || Array.isArray(rawConfig)) {
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
const value = rawConfig;
|
|
77
|
+
const config = {};
|
|
78
|
+
if (typeof value.enabled === "boolean") {
|
|
79
|
+
config.enabled = value.enabled;
|
|
80
|
+
}
|
|
81
|
+
if (typeof value.storePath === "string" && value.storePath.trim().length > 0) {
|
|
82
|
+
config.storePath = resolve(value.storePath);
|
|
83
|
+
}
|
|
84
|
+
tools[tool] = config;
|
|
184
85
|
}
|
|
185
|
-
|
|
186
|
-
const watchPaths = Array.isArray(value.watchPaths)
|
|
187
|
-
? value.watchPaths
|
|
188
|
-
.filter((item) => typeof item === "string" && item.length > 0)
|
|
189
|
-
.map((item) => resolve(projectRoot, item))
|
|
190
|
-
: defaults.watchPaths;
|
|
191
|
-
const pollIntervalMs = Number(value.pollIntervalMs);
|
|
192
|
-
const excludePatterns = Array.isArray(value.excludePatterns)
|
|
193
|
-
? value.excludePatterns.filter((item) => typeof item === "string" && item.length > 0)
|
|
194
|
-
: defaults.excludePatterns;
|
|
195
|
-
const scrapers = Array.isArray(value.scrapers)
|
|
196
|
-
? value.scrapers
|
|
197
|
-
.map((item) => {
|
|
198
|
-
if (!item || typeof item !== "object" || Array.isArray(item)) {
|
|
199
|
-
return null;
|
|
200
|
-
}
|
|
201
|
-
const scraper = item;
|
|
202
|
-
const tool = typeof scraper.tool === "string" ? scraper.tool : "";
|
|
203
|
-
if (!tool) {
|
|
204
|
-
return null;
|
|
205
|
-
}
|
|
206
|
-
const enabled = scraper.enabled !== false;
|
|
207
|
-
if (typeof scraper.customStorePath === "string") {
|
|
208
|
-
return {
|
|
209
|
-
tool,
|
|
210
|
-
enabled,
|
|
211
|
-
customStorePath: resolve(projectRoot, scraper.customStorePath),
|
|
212
|
-
};
|
|
213
|
-
}
|
|
214
|
-
return { tool, enabled };
|
|
215
|
-
})
|
|
216
|
-
.filter((item) => item !== null)
|
|
217
|
-
: defaults.scrapers;
|
|
218
|
-
return {
|
|
219
|
-
scrapers,
|
|
220
|
-
watchPaths: watchPaths.length > 0 ? watchPaths : defaults.watchPaths,
|
|
221
|
-
pollIntervalMs: Number.isFinite(pollIntervalMs) && pollIntervalMs > 0
|
|
222
|
-
? Math.floor(pollIntervalMs)
|
|
223
|
-
: defaults.pollIntervalMs,
|
|
224
|
-
excludePatterns,
|
|
225
|
-
};
|
|
86
|
+
return tools;
|
|
226
87
|
}
|
|
227
88
|
//# sourceMappingURL=services.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"services.js","sourceRoot":"","sources":["../../../src/runtime/services.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"services.js","sourceRoot":"","sources":["../../../src/runtime/services.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,MAAM,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAEhE,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAgB5D;;;;;;;;;;GAUG;AACH,KAAK,UAAU,oBAAoB,CAAC,WAAmB;IACrD,MAAM,QAAQ,G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C,SAAS,IAAI,OAAO,SAAS,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC;YAC5E,SAAS;QACX,CAAC;QAED,MAAM,KAAK,GAAG,SAAoC,CAAC;QACnD,MAAM,MAAM,GAA8C,EAAE,CAAC;QAC7D,IAAI,OAAO,KAAK,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;YACvC,MAAM,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;QACjC,CAAC;QACD,IAAI,OAAO,KAAK,CAAC,SAAS,KAAK,QAAQ,IAAI,KAAK,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC7E,MAAM,CAAC,SAAS,GAAG,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QAC9C,CAAC;QACD,KAAK,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;IACvB,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { AntigravityChunk } from "../types/scraper.js";
|
|
2
|
+
import { AbstractScraper } from "./base.js";
|
|
3
|
+
export interface AntigravityRuntimeMessage {
|
|
4
|
+
sessionId: string;
|
|
5
|
+
timestamp: Date;
|
|
6
|
+
role: AntigravityChunk["role"];
|
|
7
|
+
content: string;
|
|
8
|
+
referencedFiles: string[];
|
|
9
|
+
sourcePath?: string;
|
|
10
|
+
stepType?: string;
|
|
11
|
+
toolName?: string;
|
|
12
|
+
model?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface AntigravityRuntimeConversation {
|
|
15
|
+
sessionId: string;
|
|
16
|
+
title?: string;
|
|
17
|
+
createdAt?: Date;
|
|
18
|
+
workspaces: string[];
|
|
19
|
+
messages: AntigravityRuntimeMessage[];
|
|
20
|
+
}
|
|
21
|
+
export interface AntigravityRuntimeClient {
|
|
22
|
+
listConversations(conversationsDir: string): Promise<AntigravityRuntimeConversation[]>;
|
|
23
|
+
}
|
|
24
|
+
export declare class AntigravityScraper extends AbstractScraper<AntigravityChunk> {
|
|
25
|
+
private readonly antigravityRoot;
|
|
26
|
+
private readonly projectRoot?;
|
|
27
|
+
private readonly runtimeClient;
|
|
28
|
+
readonly tool = "antigravity";
|
|
29
|
+
constructor(antigravityRoot: string, stateDir: string, projectRoot?: string | undefined, runtimeClient?: AntigravityRuntimeClient);
|
|
30
|
+
detect(): Promise<boolean>;
|
|
31
|
+
getStorePaths(): string[];
|
|
32
|
+
scrape(since?: Date): AsyncIterable<AntigravityChunk>;
|
|
33
|
+
fullSync(): AsyncIterable<AntigravityChunk>;
|
|
34
|
+
parseRaw(raw: unknown): AntigravityChunk;
|
|
35
|
+
private readArtifacts;
|
|
36
|
+
private readSessionArtifacts;
|
|
37
|
+
private readRuntimeChunks;
|
|
38
|
+
private safeListRuntimeConversations;
|
|
39
|
+
}
|
|
40
|
+
export declare function parseAntigravityRuntimeSteps(sessionId: string, steps: unknown[], summary: Record<string, unknown>): AntigravityRuntimeMessage[];
|
|
41
|
+
/**
|
|
42
|
+
* Extract the ports a specific PID is listening on from `netstat -ano`.
|
|
43
|
+
*
|
|
44
|
+
* The PID is the last whitespace-separated column. Matching it with
|
|
45
|
+
* `endsWith` treats PID 2140 as a match for PID 140, which would attribute
|
|
46
|
+
* an unrelated process's port to the language server — and the CSRF token
|
|
47
|
+
* is POSTed to whatever answers there. The column is compared exactly.
|
|
48
|
+
*/
|
|
49
|
+
export declare function parseWindowsListeningPorts(netstatOutput: string, pid: number): number[];
|
|
50
|
+
/** Extract listening ports from `lsof -Pan -p <pid> -iTCP -sTCP:LISTEN`. */
|
|
51
|
+
export declare function parsePosixListeningPorts(lsofOutput: string): number[];
|
|
52
|
+
//# sourceMappingURL=antigravity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"antigravity.d.ts","sourceRoot":"","sources":["../../../src/scrapers/antigravity.ts"],"names":[],"mappings":"AAKA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