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
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
import { stat } from "node:fs/promises";
|
|
2
|
+
import { pathMatchesProject } from "../utils/project-scope.js";
|
|
3
|
+
import { AbstractScraper, estimateTokens, toDate } from "./base.js";
|
|
4
|
+
const SCRAPER_NAME = "opencode";
|
|
5
|
+
/**
|
|
6
|
+
* Mutation shapes the opencode scraper tolerates silently. Anything outside
|
|
7
|
+
* this whitelist that drops records must warn (or throw for required tables).
|
|
8
|
+
*/
|
|
9
|
+
export const ACCEPTED_DEGRADATIONS = {
|
|
10
|
+
/** opencode.db missing — opencode CLI not installed on this machine. */
|
|
11
|
+
missingDatabase: "opencode database absent",
|
|
12
|
+
/** better-sqlite3 native module unavailable — opt-in peer dep. */
|
|
13
|
+
missingSqliteBinding: "better-sqlite3 native module unavailable",
|
|
14
|
+
/** Sessions table empty — pristine opencode install. */
|
|
15
|
+
emptySessions: "no sessions in opencode database",
|
|
16
|
+
/** A part with no extractable text (file, snapshot, step events). */
|
|
17
|
+
nonTextPart: "part is not a text/reasoning part",
|
|
18
|
+
/** Reasoning parts on assistant messages — internal model thoughts; skipped by default. */
|
|
19
|
+
reasoningPart: "reasoning part skipped (internal thought)",
|
|
20
|
+
/** Forward-compat unknown keys alongside known fields. */
|
|
21
|
+
unknownFieldsAlongside: "extra keys alongside known opencode schema",
|
|
22
|
+
/** A message data row that fails to parse as JSON — skip with warn. */
|
|
23
|
+
malformedMessageData: "Message.data not parseable JSON",
|
|
24
|
+
/** A part data row that fails to parse as JSON — skip with warn. */
|
|
25
|
+
malformedPartData: "Part.data not parseable JSON",
|
|
26
|
+
};
|
|
27
|
+
function warnDrift(sourcePath, surprise, recordsAffected) {
|
|
28
|
+
console.warn(`[${SCRAPER_NAME}] schema-drift surprise at ${sourcePath}: ${surprise} ` +
|
|
29
|
+
`(records affected: ${recordsAffected})`);
|
|
30
|
+
}
|
|
31
|
+
export class OpenCodeScraper extends AbstractScraper {
|
|
32
|
+
opencodeDbPath;
|
|
33
|
+
projectRoot;
|
|
34
|
+
tool = "opencode";
|
|
35
|
+
constructor(opencodeDbPath, stateDir, projectRoot) {
|
|
36
|
+
super(stateDir);
|
|
37
|
+
this.opencodeDbPath = opencodeDbPath;
|
|
38
|
+
this.projectRoot = projectRoot;
|
|
39
|
+
}
|
|
40
|
+
async detect() {
|
|
41
|
+
try {
|
|
42
|
+
const target = await stat(this.opencodeDbPath);
|
|
43
|
+
return target.isFile();
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
getStorePaths() {
|
|
50
|
+
return [this.opencodeDbPath];
|
|
51
|
+
}
|
|
52
|
+
async *scrape(since) {
|
|
53
|
+
const state = await this.getLastScrapedPosition();
|
|
54
|
+
const cutoff = since ?? state.lastTimestamp;
|
|
55
|
+
yield* this.readAllSessions(cutoff);
|
|
56
|
+
}
|
|
57
|
+
async *fullSync() {
|
|
58
|
+
yield* this.readAllSessions(new Date(0));
|
|
59
|
+
}
|
|
60
|
+
async *readAllSessions(since) {
|
|
61
|
+
try {
|
|
62
|
+
const target = await stat(this.opencodeDbPath);
|
|
63
|
+
if (!target.isFile()) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
// ACCEPTED_DEGRADATIONS.missingDatabase
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
let Database;
|
|
72
|
+
try {
|
|
73
|
+
// Dynamic import so the module remains optional at startup.
|
|
74
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
75
|
+
Database = (await import("better-sqlite3")).default;
|
|
76
|
+
}
|
|
77
|
+
catch {
|
|
78
|
+
// ACCEPTED_DEGRADATIONS.missingSqliteBinding
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
if (!Database)
|
|
82
|
+
return;
|
|
83
|
+
let db;
|
|
84
|
+
try {
|
|
85
|
+
db = new Database(this.opencodeDbPath, { readonly: true, fileMustExist: true });
|
|
86
|
+
}
|
|
87
|
+
catch (err) {
|
|
88
|
+
// The file exists (checked above), so failing to open it is a broken
|
|
89
|
+
// store, not an absent one. Reporting it as absent made a corrupt
|
|
90
|
+
// database read as a pristine install in status.
|
|
91
|
+
throw new Error(`[${SCRAPER_NAME}] opencode database at ${this.opencodeDbPath} could not be opened: ${err.message}`);
|
|
92
|
+
}
|
|
93
|
+
try {
|
|
94
|
+
yield* this.readFromDb(db, since);
|
|
95
|
+
}
|
|
96
|
+
finally {
|
|
97
|
+
db.close();
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
*readFromDb(db, since) {
|
|
101
|
+
let sessions;
|
|
102
|
+
try {
|
|
103
|
+
sessions = db
|
|
104
|
+
.prepare("SELECT id, time_created, title, directory FROM session ORDER BY time_created ASC")
|
|
105
|
+
.all();
|
|
106
|
+
}
|
|
107
|
+
catch {
|
|
108
|
+
// Older opencode schemas may lack the directory column; retry without it.
|
|
109
|
+
try {
|
|
110
|
+
sessions = db
|
|
111
|
+
.prepare("SELECT id, time_created, title FROM session ORDER BY time_created ASC")
|
|
112
|
+
.all().map((row) => ({ ...row, directory: null }));
|
|
113
|
+
}
|
|
114
|
+
catch (err) {
|
|
115
|
+
const message = err.message;
|
|
116
|
+
if (/not a database|file is encrypted|malformed|corrupt/i.test(message)) {
|
|
117
|
+
// Corruption, not schema drift — surface it rather than reporting
|
|
118
|
+
// an empty store.
|
|
119
|
+
throw new Error(`[${SCRAPER_NAME}] opencode database at ${this.opencodeDbPath} is unreadable: ${message}`);
|
|
120
|
+
}
|
|
121
|
+
warnDrift(this.opencodeDbPath, `session table query failed: ${message}`, 0);
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
if (this.projectRoot) {
|
|
126
|
+
const root = this.projectRoot;
|
|
127
|
+
// Fail closed: a session with no directory cannot be attributed to a
|
|
128
|
+
// project, so scoped indexing must never include it.
|
|
129
|
+
const unattributable = sessions.filter((session) => session.directory === null).length;
|
|
130
|
+
if (unattributable > 0) {
|
|
131
|
+
warnDrift(this.opencodeDbPath, "sessions without a 'directory' value cannot be attributed to a project; skipped under project scoping", unattributable);
|
|
132
|
+
}
|
|
133
|
+
sessions = sessions.filter((session) => session.directory !== null && pathMatchesProject(session.directory, root));
|
|
134
|
+
}
|
|
135
|
+
if (sessions.length === 0) {
|
|
136
|
+
// ACCEPTED_DEGRADATIONS.emptySessions
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
let getMessages;
|
|
140
|
+
let getParts;
|
|
141
|
+
try {
|
|
142
|
+
getMessages = db.prepare("SELECT id, session_id, time_created, data FROM message WHERE session_id = ? ORDER BY time_created ASC, id ASC");
|
|
143
|
+
getParts = db.prepare("SELECT id, message_id, time_created, data FROM part WHERE message_id = ? ORDER BY time_created ASC, id ASC");
|
|
144
|
+
}
|
|
145
|
+
catch (err) {
|
|
146
|
+
warnDrift(this.opencodeDbPath, `message/part table prepare failed: ${err.message}`, sessions.length);
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
for (const session of sessions) {
|
|
150
|
+
let messages;
|
|
151
|
+
try {
|
|
152
|
+
messages = getMessages.all(session.id);
|
|
153
|
+
}
|
|
154
|
+
catch (err) {
|
|
155
|
+
warnDrift(`${this.opencodeDbPath}#session:${session.id}`, `message query failed: ${err.message}`, 0);
|
|
156
|
+
continue;
|
|
157
|
+
}
|
|
158
|
+
let messageIndex = 0;
|
|
159
|
+
for (const msg of messages) {
|
|
160
|
+
let msgData;
|
|
161
|
+
try {
|
|
162
|
+
msgData = JSON.parse(msg.data);
|
|
163
|
+
}
|
|
164
|
+
catch (err) {
|
|
165
|
+
warnDrift(`${this.opencodeDbPath}#message:${msg.id}`, `message.data not parseable JSON: ${err.message}`, 1);
|
|
166
|
+
continue;
|
|
167
|
+
}
|
|
168
|
+
if (!isRecord(msgData)) {
|
|
169
|
+
warnDrift(`${this.opencodeDbPath}#message:${msg.id}`, `message.data is not an object (got ${describeType(msgData)})`, 1);
|
|
170
|
+
continue;
|
|
171
|
+
}
|
|
172
|
+
if (!("role" in msgData)) {
|
|
173
|
+
warnDrift(`${this.opencodeDbPath}#message:${msg.id}`, "message.data missing 'role' field — likely renamed", 1);
|
|
174
|
+
continue;
|
|
175
|
+
}
|
|
176
|
+
if (typeof msgData.role !== "string") {
|
|
177
|
+
warnDrift(`${this.opencodeDbPath}#message:${msg.id}`, `expected 'role' to be a string, got ${describeType(msgData.role)}`, 1);
|
|
178
|
+
continue;
|
|
179
|
+
}
|
|
180
|
+
const role = normalizeRole(msgData.role);
|
|
181
|
+
// Timestamp: prefer msgData.time.created, fall back to msg.time_created.
|
|
182
|
+
const tsValue = msgData.time?.created ?? msg.time_created;
|
|
183
|
+
const timestamp = toDate(tsValue);
|
|
184
|
+
if (since.getTime() > 0 && timestamp <= since) {
|
|
185
|
+
messageIndex++;
|
|
186
|
+
continue;
|
|
187
|
+
}
|
|
188
|
+
let parts;
|
|
189
|
+
try {
|
|
190
|
+
parts = getParts.all(msg.id);
|
|
191
|
+
}
|
|
192
|
+
catch (err) {
|
|
193
|
+
warnDrift(`${this.opencodeDbPath}#message:${msg.id}`, `part query failed: ${err.message}`, 0);
|
|
194
|
+
messageIndex++;
|
|
195
|
+
continue;
|
|
196
|
+
}
|
|
197
|
+
const textSegments = [];
|
|
198
|
+
for (const part of parts) {
|
|
199
|
+
let partData;
|
|
200
|
+
try {
|
|
201
|
+
partData = JSON.parse(part.data);
|
|
202
|
+
}
|
|
203
|
+
catch (err) {
|
|
204
|
+
warnDrift(`${this.opencodeDbPath}#part:${part.id}`, `part.data not parseable JSON: ${err.message}`, 1);
|
|
205
|
+
continue;
|
|
206
|
+
}
|
|
207
|
+
if (!isRecord(partData)) {
|
|
208
|
+
warnDrift(`${this.opencodeDbPath}#part:${part.id}`, `part.data is not an object (got ${describeType(partData)})`, 1);
|
|
209
|
+
continue;
|
|
210
|
+
}
|
|
211
|
+
// Only text parts contribute to conversation content. Reasoning,
|
|
212
|
+
// tool-call, file, snapshot, step etc. are skipped silently.
|
|
213
|
+
if (partData.type === "text") {
|
|
214
|
+
const text = typeof partData.text === "string" ? partData.text : "";
|
|
215
|
+
if (text.length > 0) {
|
|
216
|
+
textSegments.push(text);
|
|
217
|
+
}
|
|
218
|
+
continue;
|
|
219
|
+
}
|
|
220
|
+
// ACCEPTED_DEGRADATIONS.nonTextPart / reasoningPart — silent skip.
|
|
221
|
+
}
|
|
222
|
+
const content = textSegments.join("\n").trim();
|
|
223
|
+
if (!content) {
|
|
224
|
+
messageIndex++;
|
|
225
|
+
continue;
|
|
226
|
+
}
|
|
227
|
+
const model = msgData.modelID ?? msgData.model?.modelID;
|
|
228
|
+
const providerID = msgData.providerID ?? msgData.model?.providerID;
|
|
229
|
+
yield {
|
|
230
|
+
tool: "opencode",
|
|
231
|
+
sessionId: session.id,
|
|
232
|
+
timestamp,
|
|
233
|
+
role,
|
|
234
|
+
content,
|
|
235
|
+
metadata: {
|
|
236
|
+
messageIndex,
|
|
237
|
+
tokenEstimate: estimateTokens(content),
|
|
238
|
+
referencedFiles: [],
|
|
239
|
+
agent: typeof msgData.agent === "string" ? msgData.agent : undefined,
|
|
240
|
+
model,
|
|
241
|
+
providerID,
|
|
242
|
+
},
|
|
243
|
+
};
|
|
244
|
+
messageIndex++;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
function normalizeRole(value) {
|
|
250
|
+
if (typeof value !== "string")
|
|
251
|
+
return "system";
|
|
252
|
+
switch (value.toLowerCase()) {
|
|
253
|
+
case "user":
|
|
254
|
+
case "human":
|
|
255
|
+
return "user";
|
|
256
|
+
case "assistant":
|
|
257
|
+
case "ai":
|
|
258
|
+
return "assistant";
|
|
259
|
+
case "tool":
|
|
260
|
+
return "tool";
|
|
261
|
+
case "system":
|
|
262
|
+
return "system";
|
|
263
|
+
default:
|
|
264
|
+
return "system";
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
function isRecord(value) {
|
|
268
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
269
|
+
}
|
|
270
|
+
function describeType(value) {
|
|
271
|
+
if (value === null)
|
|
272
|
+
return "null";
|
|
273
|
+
if (Array.isArray(value))
|
|
274
|
+
return "array";
|
|
275
|
+
return typeof value;
|
|
276
|
+
}
|
|
277
|
+
//# sourceMappingURL=opencode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"opencode.js","sourceRoot":"","sources":["../../../src/scrapers/opencode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAExC,OAAO,EAAE,kB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Q;QAAE,OAAO,QAAQ,CAAC;IAC/C,QAAQ,KAAK,CAAC,WAAW,EAAE,EAAE,CAAC;QAC5B,KAAK,MAAM,CAAC;QACZ,KAAK,OAAO;YACV,OAAO,MAAM,CAAC;QAChB,KAAK,WAAW,CAAC;QACjB,KAAK,IAAI;YACP,OAAO,WAAW,CAAC;QACrB,KAAK,MAAM;YACT,OAAO,MAAM,CAAC;QAChB,KAAK,QAAQ;YACX,OAAO,QAAQ,CAAC;QAClB;YACE,OAAO,QAAQ,CAAC;IACpB,CAAC;AACH,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,CAAC,KAAK,CAAC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC;AAED,SAAS,YAAY,CAAC,KAAc;IAClC,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,MAAM,CAAC;IAClC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,OAAO,CAAC;IACzC,OAAO,OAAO,KAAK,CAAC;AACtB,CAAC"}
|
|
@@ -2,6 +2,7 @@ import type { ConversationChunk, ConversationScraper } from "../types/scraper.js
|
|
|
2
2
|
export declare class ScraperRegistry {
|
|
3
3
|
private readonly scrapers;
|
|
4
4
|
register<T extends ConversationChunk>(scraper: ConversationScraper<T>): void;
|
|
5
|
+
deregister(tool: string): void;
|
|
5
6
|
get(tool: string): ConversationScraper | undefined;
|
|
6
7
|
getAll(): ConversationScraper[];
|
|
7
8
|
detectAvailable(): Promise<ConversationScraper[]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../src/scrapers/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAElF,qBAAa,eAAe;IAC1B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA0C;IAEnE,QAAQ,CAAC,CAAC,SAAS,iBAAiB,EAAE,OAAO,EAAE,mBAAmB,CAAC,CAAC,CAAC,GAAG,IAAI;IAI5E,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,mBAAmB,GAAG,SAAS;IAIlD,MAAM,IAAI,mBAAmB,EAAE;IAIzB,eAAe,IAAI,OAAO,CAAC,mBAAmB,EAAE,CAAC;CAWxD"}
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../src/scrapers/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAElF,qBAAa,eAAe;IAC1B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA0C;IAEnE,QAAQ,CAAC,CAAC,SAAS,iBAAiB,EAAE,OAAO,EAAE,mBAAmB,CAAC,CAAC,CAAC,GAAG,IAAI;IAI5E,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAI9B,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,mBAAmB,GAAG,SAAS;IAIlD,MAAM,IAAI,mBAAmB,EAAE;IAIzB,eAAe,IAAI,OAAO,CAAC,mBAAmB,EAAE,CAAC;CAWxD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../src/scrapers/registry.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,eAAe;IACT,QAAQ,GAAG,IAAI,GAAG,EAA+B,CAAC;IAEnE,QAAQ,CAA8B,OAA+B;QACnE,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,OAA8B,CAAC,CAAC;IAClE,CAAC;IAED,GAAG,CAAC,IAAY;QACd,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACjC,CAAC;IAED,MAAM;QACJ,OAAO,CA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O,SAAS,CAAC;IACnB,CAAC;CACF"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ConversationScraper } from "../types/scraper.js";
|
|
2
|
+
export type ToolId = "claude-code" | "cursor" | "codex" | "copilot" | "antigravity" | "opencode" | "copilot-cli";
|
|
3
|
+
export type HookMode = "executable" | "instruction-only" | "mcp-only";
|
|
4
|
+
export type SkillSyncMode = "native-skill" | "rule-adapter" | "instruction-adapter" | "managed-block" | "unsupported";
|
|
5
|
+
export interface ToolSkillCapability {
|
|
6
|
+
mode: SkillSyncMode;
|
|
7
|
+
targetPath?: (projectRoot: string, skillId: string) => string;
|
|
8
|
+
}
|
|
9
|
+
export interface ToolSourceDefinition {
|
|
10
|
+
id: ToolId;
|
|
11
|
+
label: string;
|
|
12
|
+
defaultStorePath: () => string;
|
|
13
|
+
createScraper: (storePath: string, stateDir: string, projectRoot?: string) => ConversationScraper;
|
|
14
|
+
memoryTargets: string[];
|
|
15
|
+
hookMode: HookMode;
|
|
16
|
+
skillSync?: ToolSkillCapability;
|
|
17
|
+
}
|
|
18
|
+
export declare const SUPPORTED_TOOLS: ToolSourceDefinition[];
|
|
19
|
+
export declare function createDefaultScrapers(stateDir: string, overrides?: Record<string, string | undefined>, projectRoot?: string): ConversationScraper[];
|
|
20
|
+
export declare function getToolDefinition(toolId: string): ToolSourceDefinition | undefined;
|
|
21
|
+
export declare function defaultClaudeProjectsDir(): string;
|
|
22
|
+
export declare function defaultCursorStorePath(): string;
|
|
23
|
+
export declare function defaultCodexSessionsPath(): string;
|
|
24
|
+
export declare function defaultCopilotHistoryPath(): string;
|
|
25
|
+
export declare function defaultAntigravityStorePath(): string;
|
|
26
|
+
export declare function defaultOpenCodeStorePath(): string;
|
|
27
|
+
export declare function defaultCopilotCliSessionPath(): string;
|
|
28
|
+
//# sourceMappingURL=sources.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sources.d.ts","sourceRoot":"","sources":["../../../src/tools/sources.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/C;AAED,wBAAgB,wBAAwB,IAAI,MAAM,CAGjD;AAED,wBAAgB,yBAAyB,IAAI,MAAM,CAalD;AAED,wBAAgB,2BAA2B,IAAI,MAAM,CAGpD;AAED,wBAAgB,wBAAwB,IAAI,MAAM,CAcjD;AAED,wBAAgB,4BAA4B,IAAI,MAAM,CAGrD"}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { join } from "node:path";
|
|
2
|
+
import { AntigravityScraper } from "../scrapers/antigravity.js";
|
|
3
|
+
import { ClaudeCodeScraper } from "../scrapers/claude-code.js";
|
|
4
|
+
import { CodexCliScraper } from "../scrapers/codex.js";
|
|
5
|
+
import { CopilotCliScraper } from "../scrapers/copilot-cli.js";
|
|
6
|
+
import { CopilotScraper } from "../scrapers/copilot.js";
|
|
7
|
+
import { CursorScraper } from "../scrapers/cursor.js";
|
|
8
|
+
import { OpenCodeScraper } from "../scrapers/opencode.js";
|
|
9
|
+
export const SUPPORTED_TOOLS = [
|
|
10
|
+
{
|
|
11
|
+
id: "claude-code",
|
|
12
|
+
label: "Claude Code",
|
|
13
|
+
defaultStorePath: defaultClaudeProjectsDir,
|
|
14
|
+
createScraper: (storePath, stateDir, projectRoot) => new ClaudeCodeScraper(storePath, stateDir, projectRoot),
|
|
15
|
+
memoryTargets: ["CLAUDE.md"],
|
|
16
|
+
hookMode: "executable",
|
|
17
|
+
skillSync: {
|
|
18
|
+
mode: "native-skill",
|
|
19
|
+
targetPath: (projectRoot, skillId) => join(projectRoot, ".claude", "skills", skillId, "SKILL.md"),
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
id: "cursor",
|
|
24
|
+
label: "Cursor",
|
|
25
|
+
defaultStorePath: defaultCursorStorePath,
|
|
26
|
+
createScraper: (storePath, stateDir, projectRoot) => new CursorScraper(storePath, stateDir, projectRoot),
|
|
27
|
+
memoryTargets: [join(".cursor", "rules", "xtctx.mdc")],
|
|
28
|
+
hookMode: "instruction-only",
|
|
29
|
+
skillSync: {
|
|
30
|
+
mode: "rule-adapter",
|
|
31
|
+
targetPath: (projectRoot, skillId) => join(projectRoot, ".cursor", "rules", "xtctx-skills", `${skillId}.mdc`),
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
id: "codex",
|
|
36
|
+
label: "Codex",
|
|
37
|
+
defaultStorePath: defaultCodexSessionsPath,
|
|
38
|
+
createScraper: (storePath, stateDir, projectRoot) => new CodexCliScraper(storePath, stateDir, projectRoot),
|
|
39
|
+
memoryTargets: ["AGENTS.md"],
|
|
40
|
+
hookMode: "instruction-only",
|
|
41
|
+
skillSync: {
|
|
42
|
+
mode: "managed-block",
|
|
43
|
+
targetPath: (projectRoot) => join(projectRoot, "AGENTS.md"),
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
id: "copilot",
|
|
48
|
+
label: "GitHub Copilot",
|
|
49
|
+
defaultStorePath: defaultCopilotHistoryPath,
|
|
50
|
+
createScraper: (storePath, stateDir, projectRoot) => new CopilotScraper(storePath, stateDir, projectRoot),
|
|
51
|
+
memoryTargets: [join(".github", "copilot-instructions.md")],
|
|
52
|
+
hookMode: "instruction-only",
|
|
53
|
+
skillSync: {
|
|
54
|
+
mode: "instruction-adapter",
|
|
55
|
+
targetPath: (projectRoot, skillId) => join(projectRoot, ".github", "instructions", `xtctx-${skillId}.instructions.md`),
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
id: "antigravity",
|
|
60
|
+
label: "Google Antigravity",
|
|
61
|
+
defaultStorePath: defaultAntigravityStorePath,
|
|
62
|
+
createScraper: (storePath, stateDir, projectRoot) => new AntigravityScraper(storePath, stateDir, projectRoot),
|
|
63
|
+
// Antigravity CLI keeps project-memory compatibility with GEMINI.md.
|
|
64
|
+
memoryTargets: ["GEMINI.md"],
|
|
65
|
+
hookMode: "instruction-only",
|
|
66
|
+
skillSync: {
|
|
67
|
+
mode: "managed-block",
|
|
68
|
+
targetPath: (projectRoot) => join(projectRoot, "GEMINI.md"),
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
id: "opencode",
|
|
73
|
+
label: "opencode",
|
|
74
|
+
defaultStorePath: defaultOpenCodeStorePath,
|
|
75
|
+
createScraper: (storePath, stateDir, projectRoot) => new OpenCodeScraper(storePath, stateDir, projectRoot),
|
|
76
|
+
memoryTargets: ["AGENTS.md"],
|
|
77
|
+
hookMode: "instruction-only",
|
|
78
|
+
skillSync: {
|
|
79
|
+
mode: "managed-block",
|
|
80
|
+
targetPath: (projectRoot) => join(projectRoot, "AGENTS.md"),
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
id: "copilot-cli",
|
|
85
|
+
label: "GitHub Copilot CLI",
|
|
86
|
+
defaultStorePath: defaultCopilotCliSessionPath,
|
|
87
|
+
createScraper: (storePath, stateDir, projectRoot) => new CopilotCliScraper(storePath, stateDir, projectRoot),
|
|
88
|
+
memoryTargets: [join(".github", "copilot-instructions.md")],
|
|
89
|
+
hookMode: "mcp-only",
|
|
90
|
+
skillSync: {
|
|
91
|
+
mode: "managed-block",
|
|
92
|
+
targetPath: (projectRoot) => join(projectRoot, ".github", "copilot-instructions.md"),
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
];
|
|
96
|
+
export function createDefaultScrapers(stateDir, overrides = {}, projectRoot) {
|
|
97
|
+
return SUPPORTED_TOOLS.map((tool) => tool.createScraper(overrides[tool.id] ?? tool.defaultStorePath(), stateDir, projectRoot));
|
|
98
|
+
}
|
|
99
|
+
export function getToolDefinition(toolId) {
|
|
100
|
+
return SUPPORTED_TOOLS.find((tool) => tool.id === toolId);
|
|
101
|
+
}
|
|
102
|
+
export function defaultClaudeProjectsDir() {
|
|
103
|
+
const home = process.env.USERPROFILE ?? process.env.HOME ?? "";
|
|
104
|
+
return join(home, ".claude", "projects");
|
|
105
|
+
}
|
|
106
|
+
export function defaultCursorStorePath() {
|
|
107
|
+
const appData = process.env.APPDATA;
|
|
108
|
+
if (appData) {
|
|
109
|
+
return join(appData, "Cursor", "User", "workspaceStorage");
|
|
110
|
+
}
|
|
111
|
+
const home = process.env.USERPROFILE ?? process.env.HOME ?? "";
|
|
112
|
+
return join(home, ".cursor", "workspaceStorage");
|
|
113
|
+
}
|
|
114
|
+
export function defaultCodexSessionsPath() {
|
|
115
|
+
const home = process.env.USERPROFILE ?? process.env.HOME ?? "";
|
|
116
|
+
return join(home, ".codex", "sessions");
|
|
117
|
+
}
|
|
118
|
+
export function defaultCopilotHistoryPath() {
|
|
119
|
+
const home = process.env.USERPROFILE ?? process.env.HOME ?? "";
|
|
120
|
+
if (process.platform === "win32") {
|
|
121
|
+
const appData = process.env.APPDATA ?? join(home, "AppData", "Roaming");
|
|
122
|
+
return join(appData, "Code", "User", "workspaceStorage");
|
|
123
|
+
}
|
|
124
|
+
if (process.platform === "linux") {
|
|
125
|
+
return join(home, ".config", "Code", "User", "workspaceStorage");
|
|
126
|
+
}
|
|
127
|
+
return join(home, "Library", "Application Support", "Code", "User", "workspaceStorage");
|
|
128
|
+
}
|
|
129
|
+
export function defaultAntigravityStorePath() {
|
|
130
|
+
const home = process.env.USERPROFILE ?? process.env.HOME ?? "";
|
|
131
|
+
return join(home, ".gemini", "antigravity");
|
|
132
|
+
}
|
|
133
|
+
export function defaultOpenCodeStorePath() {
|
|
134
|
+
const home = process.env.USERPROFILE ?? process.env.HOME ?? "";
|
|
135
|
+
if (process.platform === "win32") {
|
|
136
|
+
const appData = process.env.APPDATA ?? join(home, "AppData", "Roaming");
|
|
137
|
+
return join(appData, "opencode", "opencode.db");
|
|
138
|
+
}
|
|
139
|
+
if (process.platform === "linux") {
|
|
140
|
+
const xdgDataHome = process.env.XDG_DATA_HOME ?? join(home, ".local", "share");
|
|
141
|
+
return join(xdgDataHome, "opencode", "opencode.db");
|
|
142
|
+
}
|
|
143
|
+
return join(home, "Library", "Application Support", "opencode", "opencode.db");
|
|
144
|
+
}
|
|
145
|
+
export function defaultCopilotCliSessionPath() {
|
|
146
|
+
const home = process.env.USERPROFILE ?? process.env.HOME ?? "";
|
|
147
|
+
return join(home, ".copilot", "session-state");
|
|
148
|
+
}
|
|
149
|
+
//# sourceMappingURL=sources.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sources.js","sourceRoot":"","sources":["../../../src/tools/sources.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAuC1D,MAAM,CAAC,MAAM,eAAe,GAA2B;IACrD;QACE,EAAE,EAAE,aAAa;QACjB,KAAK,EAAE,aAAa;QACpB,gBAAgB,EAAE,wBAAwB;QAC1C,aAAa,EAAE,CAAC,SAAS,EAAE,QAAQ,EAAE,WAAW,EAAE,EAAE,CAClD,IAAI,iBAAiB,CAAC,SAAS,EAAE,QAAQ,EAAE,WAAW,CAAC;QACzD,aAAa,EAAE,CAAC,WAAW,CAAC;QAC5B,QAAQ,EAAE,YAAY;QACtB,SAAS,EAAE;YACT,IAAI,EAAE,cAAc;YACpB,UAAU,EAAE,CAAC,WAAW,EAAE,OAAO,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,CAAC;SAClG;KACF;IACD;QACE,EAAE,EAAE,QAAQ;QACZ,KAAK,EAAE,QA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AAG,CAAC,WAAW,IAAI,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC;IAE/D,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE,CAAC;QACjC,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,IAAI,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;QACxE,OAAO,IAAI,CAAC,OAAO,EAAE,UAAU,EAAE,aAAa,CAAC,CAAC;IAClD,CAAC;IAED,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE,CAAC;QACjC,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,IAAI,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;QAC/E,OAAO,IAAI,CAAC,WAAW,EAAE,UAAU,EAAE,aAAa,CAAC,CAAC;IACtD,CAAC;IAED,OAAO,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,qBAAqB,EAAE,UAAU,EAAE,aAAa,CAAC,CAAC;AACjF,CAAC;AAED,MAAM,UAAU,4BAA4B;IAC1C,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC;IAC/D,OAAO,IAAI,CAAC,IAAI,EAAE,UAAU,EAAE,eAAe,CAAC,CAAC;AACjD,CAAC"}
|
|
@@ -1,45 +1,32 @@
|
|
|
1
|
-
import type { CompactionConfig } from "./compaction.js";
|
|
2
1
|
export interface XtctxConfig {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
name: string;
|
|
6
|
-
root: string;
|
|
2
|
+
project?: {
|
|
3
|
+
root?: string;
|
|
7
4
|
};
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
excludePatterns: string[];
|
|
5
|
+
handoff?: {
|
|
6
|
+
mode?: "raw-transcript-pointer";
|
|
7
|
+
indexing?: "on-demand";
|
|
8
|
+
summaries?: false;
|
|
13
9
|
};
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
defaultDepth: "summary" | "detail" | "raw";
|
|
18
|
-
defaultLimit: number;
|
|
10
|
+
mcp?: {
|
|
11
|
+
command?: string;
|
|
12
|
+
args?: string[];
|
|
19
13
|
};
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
14
|
+
skills?: {
|
|
15
|
+
sourceDir?: string;
|
|
16
|
+
selected?: Record<string, {
|
|
17
|
+
hash?: string;
|
|
18
|
+
source?: string;
|
|
19
|
+
}>;
|
|
20
|
+
targets?: Record<string, {
|
|
21
|
+
mode?: string;
|
|
22
|
+
path?: string;
|
|
23
|
+
}>;
|
|
23
24
|
};
|
|
24
|
-
|
|
25
|
-
security: {
|
|
26
|
-
token: string | null;
|
|
27
|
-
allowedOrigins: string[];
|
|
28
|
-
allowLocalhostOrigins: boolean;
|
|
29
|
-
rateLimitWindowMs: number;
|
|
30
|
-
rateLimitMax: number;
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
export interface ScraperConfig {
|
|
35
|
-
tool: string;
|
|
36
|
-
enabled: boolean;
|
|
37
|
-
customStorePath?: string;
|
|
25
|
+
tools?: Record<string, ToolConfig>;
|
|
38
26
|
}
|
|
39
|
-
export interface
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
preferences: Record<string, unknown>;
|
|
27
|
+
export interface ToolConfig {
|
|
28
|
+
enabled?: boolean;
|
|
29
|
+
storePath?: string;
|
|
30
|
+
hook?: "executable" | "instruction-only" | "mcp-only";
|
|
44
31
|
}
|
|
45
32
|
//# sourceMappingURL=config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/types/config.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/types/config.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC1B,OAAO,CAAC,EAAE;QACR,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;IACF,OAAO,CAAC,EAAE;QACR,IAAI,CAAC,EAAE,wBAAwB,CAAC;QAChC,QAAQ,CAAC,EAAE,WAAW,CAAC;QACvB,SAAS,CAAC,EAAE,KAAK,CAAC;KACnB,CAAC;IACF,GAAG,CAAC,EAAE;QACJ,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;KACjB,CAAC;IACF,MAAM,CAAC,EAAE;QACP,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE;YAAE,IAAI,CAAC,EAAE,MAAM,CAAC;YAAC,MAAM,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;QAC9D,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE;YAAE,IAAI,CAAC,EAAE,MAAM,CAAC;YAAC,IAAI,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;KAC5D,CAAC;IACF,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;CACpC;AAED,MAAM,WAAW,UAAU;IACzB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,YAAY,GAAG,kBAAkB,GAAG,UAAU,CAAC;CACvD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC"}
|
package/dist/src/types/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC"}
|