abb-opencode-local-rag 0.1.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.de.md +416 -0
- package/README.es.md +416 -0
- package/README.fr.md +416 -0
- package/README.md +491 -0
- package/README.pt-BR.md +416 -0
- package/README.zh-CN.md +416 -0
- package/dist/bin/install-skills.d.ts +20 -0
- package/dist/bin/install-skills.d.ts.map +1 -0
- package/dist/bin/install-skills.js +195 -0
- package/dist/bin/install-skills.js.map +1 -0
- package/dist/chunker/index.d.ts +24 -0
- package/dist/chunker/index.d.ts.map +1 -0
- package/dist/chunker/index.js +2 -0
- package/dist/chunker/index.js.map +1 -0
- package/dist/chunker/semantic-chunker.d.ts +97 -0
- package/dist/chunker/semantic-chunker.d.ts.map +1 -0
- package/dist/chunker/semantic-chunker.js +294 -0
- package/dist/chunker/semantic-chunker.js.map +1 -0
- package/dist/chunker/sentence-splitter.d.ts +28 -0
- package/dist/chunker/sentence-splitter.d.ts.map +1 -0
- package/dist/chunker/sentence-splitter.js +219 -0
- package/dist/chunker/sentence-splitter.js.map +1 -0
- package/dist/cli/common.d.ts +65 -0
- package/dist/cli/common.d.ts.map +1 -0
- package/dist/cli/common.js +138 -0
- package/dist/cli/common.js.map +1 -0
- package/dist/cli/delete.d.ts +8 -0
- package/dist/cli/delete.d.ts.map +1 -0
- package/dist/cli/delete.js +173 -0
- package/dist/cli/delete.js.map +1 -0
- package/dist/cli/file-collection.d.ts +2 -0
- package/dist/cli/file-collection.d.ts.map +1 -0
- package/dist/cli/file-collection.js +53 -0
- package/dist/cli/file-collection.js.map +1 -0
- package/dist/cli/ingest.d.ts +100 -0
- package/dist/cli/ingest.d.ts.map +1 -0
- package/dist/cli/ingest.js +363 -0
- package/dist/cli/ingest.js.map +1 -0
- package/dist/cli/list.d.ts +35 -0
- package/dist/cli/list.d.ts.map +1 -0
- package/dist/cli/list.js +210 -0
- package/dist/cli/list.js.map +1 -0
- package/dist/cli/options.d.ts +100 -0
- package/dist/cli/options.d.ts.map +1 -0
- package/dist/cli/options.js +241 -0
- package/dist/cli/options.js.map +1 -0
- package/dist/cli/query.d.ts +24 -0
- package/dist/cli/query.d.ts.map +1 -0
- package/dist/cli/query.js +191 -0
- package/dist/cli/query.js.map +1 -0
- package/dist/cli/read-neighbors.d.ts +11 -0
- package/dist/cli/read-neighbors.d.ts.map +1 -0
- package/dist/cli/read-neighbors.js +224 -0
- package/dist/cli/read-neighbors.js.map +1 -0
- package/dist/cli/status.d.ts +8 -0
- package/dist/cli/status.d.ts.map +1 -0
- package/dist/cli/status.js +80 -0
- package/dist/cli/status.js.map +1 -0
- package/dist/cli/sync.d.ts +8 -0
- package/dist/cli/sync.d.ts.map +1 -0
- package/dist/cli/sync.js +244 -0
- package/dist/cli/sync.js.map +1 -0
- package/dist/cli-main.d.ts +12 -0
- package/dist/cli-main.d.ts.map +1 -0
- package/dist/cli-main.js +63 -0
- package/dist/cli-main.js.map +1 -0
- package/dist/embedder/index.d.ts +85 -0
- package/dist/embedder/index.d.ts.map +1 -0
- package/dist/embedder/index.js +284 -0
- package/dist/embedder/index.js.map +1 -0
- package/dist/features/list.d.ts +37 -0
- package/dist/features/list.d.ts.map +1 -0
- package/dist/features/list.js +40 -0
- package/dist/features/list.js.map +1 -0
- package/dist/features/sync.d.ts +207 -0
- package/dist/features/sync.d.ts.map +1 -0
- package/dist/features/sync.js +380 -0
- package/dist/features/sync.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +53 -0
- package/dist/index.js.map +1 -0
- package/dist/ingest/compute.d.ts +86 -0
- package/dist/ingest/compute.d.ts.map +1 -0
- package/dist/ingest/compute.js +177 -0
- package/dist/ingest/compute.js.map +1 -0
- package/dist/ingest/file.d.ts +27 -0
- package/dist/ingest/file.d.ts.map +1 -0
- package/dist/ingest/file.js +67 -0
- package/dist/ingest/file.js.map +1 -0
- package/dist/ingest/visual.d.ts +45 -0
- package/dist/ingest/visual.d.ts.map +1 -0
- package/dist/ingest/visual.js +234 -0
- package/dist/ingest/visual.js.map +1 -0
- package/dist/parser/docx-parser.d.ts +12 -0
- package/dist/parser/docx-parser.d.ts.map +1 -0
- package/dist/parser/docx-parser.js +328 -0
- package/dist/parser/docx-parser.js.map +1 -0
- package/dist/parser/html-parser.d.ts +18 -0
- package/dist/parser/html-parser.d.ts.map +1 -0
- package/dist/parser/html-parser.js +102 -0
- package/dist/parser/html-parser.js.map +1 -0
- package/dist/parser/index.d.ts +214 -0
- package/dist/parser/index.d.ts.map +1 -0
- package/dist/parser/index.js +454 -0
- package/dist/parser/index.js.map +1 -0
- package/dist/parser/pdf-extract.d.ts +81 -0
- package/dist/parser/pdf-extract.d.ts.map +1 -0
- package/dist/parser/pdf-extract.js +112 -0
- package/dist/parser/pdf-extract.js.map +1 -0
- package/dist/parser/pdf-filter.d.ts +117 -0
- package/dist/parser/pdf-filter.d.ts.map +1 -0
- package/dist/parser/pdf-filter.js +528 -0
- package/dist/parser/pdf-filter.js.map +1 -0
- package/dist/parser/title-extractor.d.ts +69 -0
- package/dist/parser/title-extractor.d.ts.map +1 -0
- package/dist/parser/title-extractor.js +145 -0
- package/dist/parser/title-extractor.js.map +1 -0
- package/dist/pdf-visual/captioner.d.ts +16 -0
- package/dist/pdf-visual/captioner.d.ts.map +1 -0
- package/dist/pdf-visual/captioner.js +63 -0
- package/dist/pdf-visual/captioner.js.map +1 -0
- package/dist/pdf-visual/captioners/fast.d.ts +7 -0
- package/dist/pdf-visual/captioners/fast.d.ts.map +1 -0
- package/dist/pdf-visual/captioners/fast.js +103 -0
- package/dist/pdf-visual/captioners/fast.js.map +1 -0
- package/dist/pdf-visual/captioners/quality.d.ts +7 -0
- package/dist/pdf-visual/captioners/quality.d.ts.map +1 -0
- package/dist/pdf-visual/captioners/quality.js +127 -0
- package/dist/pdf-visual/captioners/quality.js.map +1 -0
- package/dist/pdf-visual/captioners/shared.d.ts +44 -0
- package/dist/pdf-visual/captioners/shared.d.ts.map +1 -0
- package/dist/pdf-visual/captioners/shared.js +104 -0
- package/dist/pdf-visual/captioners/shared.js.map +1 -0
- package/dist/pdf-visual/detector.d.ts +9 -0
- package/dist/pdf-visual/detector.d.ts.map +1 -0
- package/dist/pdf-visual/detector.js +234 -0
- package/dist/pdf-visual/detector.js.map +1 -0
- package/dist/pdf-visual/index.d.ts +13 -0
- package/dist/pdf-visual/index.d.ts.map +1 -0
- package/dist/pdf-visual/index.js +45 -0
- package/dist/pdf-visual/index.js.map +1 -0
- package/dist/pdf-visual/renderer.d.ts +9 -0
- package/dist/pdf-visual/renderer.d.ts.map +1 -0
- package/dist/pdf-visual/renderer.js +177 -0
- package/dist/pdf-visual/renderer.js.map +1 -0
- package/dist/pdf-visual/types.d.ts +62 -0
- package/dist/pdf-visual/types.d.ts.map +1 -0
- package/dist/pdf-visual/types.js +32 -0
- package/dist/pdf-visual/types.js.map +1 -0
- package/dist/server/error-utils.d.ts +79 -0
- package/dist/server/error-utils.d.ts.map +1 -0
- package/dist/server/error-utils.js +148 -0
- package/dist/server/error-utils.js.map +1 -0
- package/dist/server/index.d.ts +258 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/index.js +1104 -0
- package/dist/server/index.js.map +1 -0
- package/dist/server/list-scanner.d.ts +52 -0
- package/dist/server/list-scanner.d.ts.map +1 -0
- package/dist/server/list-scanner.js +72 -0
- package/dist/server/list-scanner.js.map +1 -0
- package/dist/server/tool-definitions.d.ts +8 -0
- package/dist/server/tool-definitions.d.ts.map +1 -0
- package/dist/server/tool-definitions.js +181 -0
- package/dist/server/tool-definitions.js.map +1 -0
- package/dist/server/tool-input.d.ts +37 -0
- package/dist/server/tool-input.d.ts.map +1 -0
- package/dist/server/tool-input.js +216 -0
- package/dist/server/tool-input.js.map +1 -0
- package/dist/server/types.d.ts +331 -0
- package/dist/server/types.d.ts.map +1 -0
- package/dist/server/types.js +3 -0
- package/dist/server/types.js.map +1 -0
- package/dist/server-main.d.ts +46 -0
- package/dist/server-main.d.ts.map +1 -0
- package/dist/server-main.js +242 -0
- package/dist/server-main.js.map +1 -0
- package/dist/utils/base-dirs.d.ts +212 -0
- package/dist/utils/base-dirs.d.ts.map +1 -0
- package/dist/utils/base-dirs.js +422 -0
- package/dist/utils/base-dirs.js.map +1 -0
- package/dist/utils/errors.d.ts +24 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +53 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/limits.d.ts +26 -0
- package/dist/utils/limits.d.ts.map +1 -0
- package/dist/utils/limits.js +28 -0
- package/dist/utils/limits.js.map +1 -0
- package/dist/utils/list-sources.d.ts +47 -0
- package/dist/utils/list-sources.d.ts.map +1 -0
- package/dist/utils/list-sources.js +50 -0
- package/dist/utils/list-sources.js.map +1 -0
- package/dist/utils/raw-data-utils.d.ts +131 -0
- package/dist/utils/raw-data-utils.d.ts.map +1 -0
- package/dist/utils/raw-data-utils.js +255 -0
- package/dist/utils/raw-data-utils.js.map +1 -0
- package/dist/utils/scan.d.ts +126 -0
- package/dist/utils/scan.d.ts.map +1 -0
- package/dist/utils/scan.js +221 -0
- package/dist/utils/scan.js.map +1 -0
- package/dist/utils/scope-match.d.ts +43 -0
- package/dist/utils/scope-match.d.ts.map +1 -0
- package/dist/utils/scope-match.js +87 -0
- package/dist/utils/scope-match.js.map +1 -0
- package/dist/utils/sensitive-path.d.ts +23 -0
- package/dist/utils/sensitive-path.d.ts.map +1 -0
- package/dist/utils/sensitive-path.js +91 -0
- package/dist/utils/sensitive-path.js.map +1 -0
- package/dist/utils/sync-path-key.d.ts +20 -0
- package/dist/utils/sync-path-key.d.ts.map +1 -0
- package/dist/utils/sync-path-key.js +33 -0
- package/dist/utils/sync-path-key.js.map +1 -0
- package/dist/vectordb/index.d.ts +168 -0
- package/dist/vectordb/index.d.ts.map +1 -0
- package/dist/vectordb/index.js +619 -0
- package/dist/vectordb/index.js.map +1 -0
- package/dist/vectordb/search-filters.d.ts +39 -0
- package/dist/vectordb/search-filters.d.ts.map +1 -0
- package/dist/vectordb/search-filters.js +136 -0
- package/dist/vectordb/search-filters.js.map +1 -0
- package/dist/vectordb/types.d.ts +196 -0
- package/dist/vectordb/types.d.ts.map +1 -0
- package/dist/vectordb/types.js +224 -0
- package/dist/vectordb/types.js.map +1 -0
- package/package.json +105 -0
- package/skills/mcp-local-rag/SKILL.md +308 -0
- package/skills/mcp-local-rag/references/cli-reference.md +175 -0
- package/skills/mcp-local-rag/references/html-ingestion.md +78 -0
- package/skills/mcp-local-rag/references/query-optimization.md +57 -0
- package/skills/mcp-local-rag/references/result-refinement.md +56 -0
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import type { ScanEntryKind } from '../utils/scan.js';
|
|
2
|
+
/** Path-granular facts about the regions a directory scan could not observe. */
|
|
3
|
+
export interface SyncScanCoverage {
|
|
4
|
+
unreadableDirs: {
|
|
5
|
+
dirPath: string;
|
|
6
|
+
code: string;
|
|
7
|
+
}[];
|
|
8
|
+
depthLimitedDirs: string[];
|
|
9
|
+
skippedSymlinks: string[];
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Everything one run could not observe: the scan facts plus the files whose
|
|
13
|
+
* bytes were never read because they exceed the configured size limit. Every
|
|
14
|
+
* path here is an unobserved prefix, so the rows under it are protected from
|
|
15
|
+
* prune.
|
|
16
|
+
*/
|
|
17
|
+
export interface SyncCoverage extends SyncScanCoverage {
|
|
18
|
+
/** Files skipped by `hashFile` for exceeding the configured size limit. */
|
|
19
|
+
oversizedFiles: string[];
|
|
20
|
+
}
|
|
21
|
+
/** One bounded directory scan: the supported files found plus its coverage facts. */
|
|
22
|
+
export interface SyncScanResult extends SyncScanCoverage {
|
|
23
|
+
files: string[];
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* One stored chunk row (or row group) of the database manifest. `filePath` is
|
|
27
|
+
* the verbatim stored spelling — the only value valid for deletion. A `null` or
|
|
28
|
+
* absent `contentHash` marks the row hashless, which makes its file dirty.
|
|
29
|
+
*/
|
|
30
|
+
export interface SyncManifestRow {
|
|
31
|
+
filePath: string;
|
|
32
|
+
contentHash?: string | null;
|
|
33
|
+
}
|
|
34
|
+
/** One supported file found on disk, with the hash of its current bytes. */
|
|
35
|
+
export interface SyncDiskFile {
|
|
36
|
+
filePath: string;
|
|
37
|
+
contentHash: string;
|
|
38
|
+
}
|
|
39
|
+
/** How a sync invocation was addressed, after validation and classification. */
|
|
40
|
+
export type SyncRequest = {
|
|
41
|
+
kind: 'roots';
|
|
42
|
+
} | {
|
|
43
|
+
kind: 'directory';
|
|
44
|
+
path: string;
|
|
45
|
+
} | {
|
|
46
|
+
kind: 'file';
|
|
47
|
+
path: string;
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* Result of classifying a requested path on disk. Anything other than
|
|
51
|
+
* `directory` or `file` is refused before the path is read: the union is the
|
|
52
|
+
* walker's own {@link ScanEntryKind} plus `missing`, so a path a caller names and
|
|
53
|
+
* a path the walk discovers pass the identical predicates.
|
|
54
|
+
*/
|
|
55
|
+
export type SyncPathKind = ScanEntryKind | 'missing';
|
|
56
|
+
/** Re-ingest one disk file, then drop the other stored spellings of its key. */
|
|
57
|
+
export interface SyncUpsertAction {
|
|
58
|
+
/** Verbatim disk path handed to `ingestFile`. */
|
|
59
|
+
filePath: string;
|
|
60
|
+
/** Verbatim stored spellings of the same comparison key, excluding `filePath`. */
|
|
61
|
+
staleStoredPaths: string[];
|
|
62
|
+
}
|
|
63
|
+
/** Remove every stored spelling of one comparison key that left the disk. */
|
|
64
|
+
export interface SyncPruneAction {
|
|
65
|
+
storedPaths: string[];
|
|
66
|
+
}
|
|
67
|
+
export interface SyncPlan {
|
|
68
|
+
upserts: SyncUpsertAction[];
|
|
69
|
+
/** Files whose stored content identity already matches the disk bytes. */
|
|
70
|
+
skipped: number;
|
|
71
|
+
prunes: SyncPruneAction[];
|
|
72
|
+
}
|
|
73
|
+
export interface SyncPlanInput {
|
|
74
|
+
roots: readonly string[];
|
|
75
|
+
dbPath: string;
|
|
76
|
+
/** Configured database/cache prefixes that must never be pruned. */
|
|
77
|
+
excludePaths: readonly string[];
|
|
78
|
+
platform: NodeJS.Platform;
|
|
79
|
+
request: SyncRequest;
|
|
80
|
+
diskFiles: readonly SyncDiskFile[];
|
|
81
|
+
dbRows: readonly SyncManifestRow[];
|
|
82
|
+
coverage: SyncCoverage;
|
|
83
|
+
}
|
|
84
|
+
/** The one controlled error a failed run exposes. */
|
|
85
|
+
export interface SyncError {
|
|
86
|
+
message: string;
|
|
87
|
+
/** The file, root, or requested path a failure is attributable to. */
|
|
88
|
+
filePath: string | null;
|
|
89
|
+
}
|
|
90
|
+
/** Append an attributable path only when the underlying message does not already contain it. */
|
|
91
|
+
export declare function formatSyncError({ message, filePath }: SyncError): string;
|
|
92
|
+
export interface SyncCounters {
|
|
93
|
+
upserted: number;
|
|
94
|
+
skipped: number;
|
|
95
|
+
empty: number;
|
|
96
|
+
/** Comparison keys removed from the index. Counts files, not rows, and is not part of `completed`. */
|
|
97
|
+
pruned: number;
|
|
98
|
+
}
|
|
99
|
+
/** One stored spelling per pruned comparison key, so a count of N reports N paths. */
|
|
100
|
+
interface PrunedPaths {
|
|
101
|
+
prunedPaths: string[];
|
|
102
|
+
}
|
|
103
|
+
export interface SyncExecutionResult extends SyncCounters, PrunedPaths {
|
|
104
|
+
error: SyncError | null;
|
|
105
|
+
}
|
|
106
|
+
export interface SyncResult extends SyncCounters, PrunedPaths {
|
|
107
|
+
/** Scanner facts as data. Formatting and reporting belong to the adapters. */
|
|
108
|
+
coverage: SyncCoverage;
|
|
109
|
+
error: SyncError | null;
|
|
110
|
+
}
|
|
111
|
+
/** Mutating collaborators, injected by the CLI and MCP adapters. */
|
|
112
|
+
export interface SyncExecutor {
|
|
113
|
+
/**
|
|
114
|
+
* Parse, chunk, embed, build vectors, then delete-and-insert for this one
|
|
115
|
+
* file, returning the inserted chunk count. Returning `0` must leave the
|
|
116
|
+
* store untouched: the executor relies on that to keep a zero-chunk file's
|
|
117
|
+
* prior rows and hash intact.
|
|
118
|
+
*/
|
|
119
|
+
ingestFile(filePath: string, images: boolean): Promise<number>;
|
|
120
|
+
/** Delete the rows of exactly one stored path spelling. */
|
|
121
|
+
deleteExactPath(filePath: string): Promise<number>;
|
|
122
|
+
optimize(): Promise<void>;
|
|
123
|
+
}
|
|
124
|
+
/** Everything {@link runSync} needs from the outside world. */
|
|
125
|
+
export interface SyncCollaborators extends SyncExecutor {
|
|
126
|
+
/**
|
|
127
|
+
* Canonical form of the requested path — its parent chain resolved through
|
|
128
|
+
* symbolic links, the final component verbatim — or `null` when that chain
|
|
129
|
+
* cannot be resolved. Injected because this module performs no filesystem
|
|
130
|
+
* access; both adapters supply `canonicalizeRequestedPath` from `utils/scan.ts`.
|
|
131
|
+
*/
|
|
132
|
+
canonicalizeRequestedPath(path: string): Promise<string | null>;
|
|
133
|
+
/**
|
|
134
|
+
* Classify the requested path WITHOUT reading it, applying the walker's collect
|
|
135
|
+
* predicates (`classifyRequestedPath` in `utils/scan.ts`) so both surfaces
|
|
136
|
+
* refuse the same paths.
|
|
137
|
+
*/
|
|
138
|
+
classifyPath(path: string): Promise<SyncPathKind>;
|
|
139
|
+
/**
|
|
140
|
+
* Bounded scan of one root. Deliberately takes no scope predicate: a
|
|
141
|
+
* scope-pruned directory is reported in none of the coverage arrays, so a
|
|
142
|
+
* scope filter here would make unobserved regions invisible and prune unsafe.
|
|
143
|
+
*/
|
|
144
|
+
scanDir(rootPath: string): Promise<SyncScanResult>;
|
|
145
|
+
/**
|
|
146
|
+
* Hash the file's current bytes, or return `null` to decline reading it because
|
|
147
|
+
* it exceeds the configured size limit. A declined file is left out of the disk
|
|
148
|
+
* manifest and recorded in `coverage.oversizedFiles`, which protects its stored
|
|
149
|
+
* rows from prune — omitting it without that record would make it look deleted.
|
|
150
|
+
*/
|
|
151
|
+
hashFile(filePath: string): Promise<string | null>;
|
|
152
|
+
/** Every stored chunk row's verbatim path and hash, for the whole table. */
|
|
153
|
+
loadDbManifest(): Promise<SyncManifestRow[]>;
|
|
154
|
+
}
|
|
155
|
+
export interface RunSyncInput {
|
|
156
|
+
/** Configured roots in the `resolve()`-only spelling the DB keys live in. */
|
|
157
|
+
roots: readonly string[];
|
|
158
|
+
/**
|
|
159
|
+
* The same configured roots, canonicalized (realpath'd) — the security domain
|
|
160
|
+
* the requested path's canonical form is checked against. Both adapters already
|
|
161
|
+
* hold this list: the MCP server as `baseDirs`, the CLI as
|
|
162
|
+
* `config.baseDirs.baseDirs`, each the counterpart of its `roots` entry.
|
|
163
|
+
*/
|
|
164
|
+
canonicalRoots: readonly string[];
|
|
165
|
+
dbPath: string;
|
|
166
|
+
excludePaths: readonly string[];
|
|
167
|
+
platform: NodeJS.Platform;
|
|
168
|
+
/** Omitted means "every configured root". */
|
|
169
|
+
requestedPath?: string | undefined;
|
|
170
|
+
/** `true` stores images for files already selected as new or changed. */
|
|
171
|
+
images?: boolean | undefined;
|
|
172
|
+
collaborators: SyncCollaborators;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Decide the skip, upsert, and prune actions for one sync run. Pure: all
|
|
176
|
+
* filesystem and database facts arrive pre-fetched.
|
|
177
|
+
*
|
|
178
|
+
* A prune action is emitted only when all four conditions hold for the key: it
|
|
179
|
+
* is inside the requested scope, absent from the disk manifest, outside the
|
|
180
|
+
* configured excluded and managed paths, and outside every unobserved prefix —
|
|
181
|
+
* unreadable, depth-limited, symlinked, or too large to have been read.
|
|
182
|
+
* Dropping any one of them protects the rows.
|
|
183
|
+
*/
|
|
184
|
+
export declare function planSync(input: SyncPlanInput): SyncPlan;
|
|
185
|
+
/**
|
|
186
|
+
* Apply a plan: upserts first, then prune, then a single `optimize()`.
|
|
187
|
+
*
|
|
188
|
+
* The first failure anywhere stops the run. Earlier successful mutations stay,
|
|
189
|
+
* every remaining upsert and the entire prune phase are abandoned, and exactly
|
|
190
|
+
* one error is returned. No rollback, retry, or failure classification is
|
|
191
|
+
* attempted — an interrupted run is recovered by rerunning sync.
|
|
192
|
+
*
|
|
193
|
+
* A zero-chunk ingest counts as `empty` and mutates nothing for that file, so
|
|
194
|
+
* its prior rows stay searchable and the next run plans it again.
|
|
195
|
+
*/
|
|
196
|
+
export declare function executeSyncPlan(plan: SyncPlan, executor: SyncExecutor, images?: boolean): Promise<SyncExecutionResult>;
|
|
197
|
+
/**
|
|
198
|
+
* Run one full sync: gather, plan, execute.
|
|
199
|
+
*
|
|
200
|
+
* Returned counters and coverage facts are plain data; the caller decides how to
|
|
201
|
+
* print them and what exit status or job state they imply. A run with nothing to
|
|
202
|
+
* do calls neither `ingestFile` nor `optimize`, so a true no-op never pays for
|
|
203
|
+
* loading the embedding model or compacting the table.
|
|
204
|
+
*/
|
|
205
|
+
export declare function runSync(input: RunSyncInput): Promise<SyncResult>;
|
|
206
|
+
export {};
|
|
207
|
+
//# sourceMappingURL=sync.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../src/features/sync.ts"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAQrD,gFAAgF;AAChF,MAAM,WAAW,gBAAgB;IAC/B,cAAc,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;IACnD,gBAAgB,EAAE,MAAM,EAAE,CAAA;IAC1B,eAAe,EAAE,MAAM,EAAE,CAAA;CAC1B;AAED;;;;;GAKG;AACH,MAAM,WAAW,YAAa,SAAQ,gBAAgB;IACpD,2EAA2E;IAC3E,cAAc,EAAE,MAAM,EAAE,CAAA;CACzB;AAED,qFAAqF;AACrF,MAAM,WAAW,cAAe,SAAQ,gBAAgB;IACtD,KAAK,EAAE,MAAM,EAAE,CAAA;CAChB;AAED;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B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C,CAAA;IACjD;;;;OAIG;IACH,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAAA;IAClD;;;;;OAKG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAA;IAClD,4EAA4E;IAC5E,cAAc,IAAI,OAAO,CAAC,eAAe,EAAE,CAAC,CAAA;CAC7C;AAED,MAAM,WAAW,YAAY;IAC3B,6EAA6E;IAC7E,KAAK,EAAE,SAAS,MAAM,EAAE,CAAA;IACxB;;;;;OAKG;IACH,cAAc,EAAE,SAAS,MAAM,EAAE,CAAA;IACjC,MAAM,EAAE,MAAM,CAAA;IACd,YAAY,EAAE,SAAS,MAAM,EAAE,CAAA;IAC/B,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAA;IACzB,6CAA6C;IAC7C,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAClC,yEAAyE;IACzE,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IAC5B,aAAa,EAAE,iBAAiB,CAAA;CACjC;AA4BD;;;;;;;;;GASG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,GAAG,QAAQ,CAoEvD;AAiFD;;;;;;;;;;GAUG;AACH,wBAAsB,eAAe,CACnC,IAAI,EAAE,QAAQ,EACd,QAAQ,EAAE,YAAY,EACtB,MAAM,UAAQ,GACb,OAAO,CAAC,mBAAmB,CAAC,CAsD9B;AA+GD;;;;;;;GAOG;AACH,wBAAsB,OAAO,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,UAAU,CAAC,CA2BtE"}
|
|
@@ -0,0 +1,380 @@
|
|
|
1
|
+
// Dispatch-agnostic incremental-sync planning and execution.
|
|
2
|
+
//
|
|
3
|
+
// The single core shared by the `sync` CLI subcommand and the MCP `sync_start`
|
|
4
|
+
// tool. Every collaborator is declared here as a local structural interface, so
|
|
5
|
+
// this module imports nothing from `vectordb/`, `parser/`, `chunker/`,
|
|
6
|
+
// `embedder/`, or `ingest/` — not even for types. Persistence, output
|
|
7
|
+
// formatting, exit codes, and logging belong to the adapters.
|
|
8
|
+
//
|
|
9
|
+
// Path identity: reconciliation compares generated keys
|
|
10
|
+
// (`toSyncPathKey(path, platform)`), and every containment question is answered
|
|
11
|
+
// by the unchanged `isUnderOrEqual` from `scope-match.ts`. This module defines
|
|
12
|
+
// no exact-or-descendant, separator-boundary, or trailing-separator logic of its
|
|
13
|
+
// own. Deletion, by contrast, always uses the verbatim stored `filePath`
|
|
14
|
+
// spellings, because those are what the storage predicate matches.
|
|
15
|
+
//
|
|
16
|
+
// Two spellings, one matcher: `toSyncPathKey` stays purely lexical (a key must be
|
|
17
|
+
// derivable for a file that is no longer on disk) and is what keys, prune
|
|
18
|
+
// identity, and display use, while the requested path's CONTAINMENT is decided
|
|
19
|
+
// against canonicalized values — see `isRequestedPathContained`. This is the same
|
|
20
|
+
// split `DocumentParser` already uses: canonicalize to decide the boundary, store
|
|
21
|
+
// the `resolve()` spelling. Do not collapse it by making key generation follow
|
|
22
|
+
// symbolic links.
|
|
23
|
+
//
|
|
24
|
+
// `platform` is an explicit input rather than a host-platform read, so the
|
|
25
|
+
// Windows key semantics are provable from a POSIX host.
|
|
26
|
+
import { isManagedRawDataPath } from '../utils/raw-data-utils.js';
|
|
27
|
+
import { isUnderOrEqual } from '../utils/scope-match.js';
|
|
28
|
+
import { toSyncPathKey } from '../utils/sync-path-key.js';
|
|
29
|
+
/** Append an attributable path only when the underlying message does not already contain it. */
|
|
30
|
+
export function formatSyncError({ message, filePath }) {
|
|
31
|
+
return filePath === null || message.includes(filePath) ? message : `${message} (${filePath})`;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* A comparison key is converged only when it is stored under exactly one
|
|
35
|
+
* spelling and every one of that spelling's rows carries the current disk hash.
|
|
36
|
+
* No rows, a hashless row, disagreeing rows, or a stale hash all make it dirty.
|
|
37
|
+
*
|
|
38
|
+
* The single-spelling condition matters because deletion is by exact path: on
|
|
39
|
+
* Windows, ingesting `C:\Docs\A.md` and later `c:\docs\a.md` leaves two row sets
|
|
40
|
+
* for one file, both with the correct hash. Without this condition sync would
|
|
41
|
+
* skip the key forever and searches would keep returning duplicate hits; with
|
|
42
|
+
* it, the key is re-ingested and the other spellings become stale deletions, so
|
|
43
|
+
* one run converges it back to a single spelling.
|
|
44
|
+
*/
|
|
45
|
+
function isConverged(stored, diskHash) {
|
|
46
|
+
return stored.paths.length === 1 && stored.hashes.every((hash) => hash === diskHash);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Decide the skip, upsert, and prune actions for one sync run. Pure: all
|
|
50
|
+
* filesystem and database facts arrive pre-fetched.
|
|
51
|
+
*
|
|
52
|
+
* A prune action is emitted only when all four conditions hold for the key: it
|
|
53
|
+
* is inside the requested scope, absent from the disk manifest, outside the
|
|
54
|
+
* configured excluded and managed paths, and outside every unobserved prefix —
|
|
55
|
+
* unreadable, depth-limited, symlinked, or too large to have been read.
|
|
56
|
+
* Dropping any one of them protects the rows.
|
|
57
|
+
*/
|
|
58
|
+
export function planSync(input) {
|
|
59
|
+
const keyOf = (path) => toSyncPathKey(path, input.platform);
|
|
60
|
+
const isKeyUnder = (key, prefixes) => prefixes.some((prefix) => isUnderOrEqual(key, keyOf(prefix)));
|
|
61
|
+
const request = input.request;
|
|
62
|
+
const scopePrefixes = request.kind === 'roots' ? input.roots : [request.path];
|
|
63
|
+
// A file request addresses exactly one comparison key, so its prune scope is
|
|
64
|
+
// equality rather than `isKeyUnder`'s exact-or-descendant membership: a stored
|
|
65
|
+
// row at `<requested file>/child.md` — left behind by a directory that was later
|
|
66
|
+
// replaced by a file of the same name — is a different key and must survive.
|
|
67
|
+
// Directory and roots requests keep the descendant semantics.
|
|
68
|
+
const requestedFileKey = request.kind === 'file' ? keyOf(request.path) : null;
|
|
69
|
+
const isInRequestedScope = (rowKey) => requestedFileKey === null ? isKeyUnder(rowKey, scopePrefixes) : rowKey === requestedFileKey;
|
|
70
|
+
const diskByKey = new Map();
|
|
71
|
+
for (const file of input.diskFiles) {
|
|
72
|
+
const fileKey = keyOf(file.filePath);
|
|
73
|
+
if (!diskByKey.has(fileKey))
|
|
74
|
+
diskByKey.set(fileKey, file);
|
|
75
|
+
}
|
|
76
|
+
const storedByKey = new Map();
|
|
77
|
+
for (const row of input.dbRows) {
|
|
78
|
+
const rowKey = keyOf(row.filePath);
|
|
79
|
+
let group = storedByKey.get(rowKey);
|
|
80
|
+
if (!group) {
|
|
81
|
+
group = { paths: [], hashes: [] };
|
|
82
|
+
storedByKey.set(rowKey, group);
|
|
83
|
+
}
|
|
84
|
+
if (!group.paths.includes(row.filePath))
|
|
85
|
+
group.paths.push(row.filePath);
|
|
86
|
+
group.hashes.push(row.contentHash ?? null);
|
|
87
|
+
}
|
|
88
|
+
const upserts = [];
|
|
89
|
+
let skipped = 0;
|
|
90
|
+
for (const [fileKey, file] of diskByKey) {
|
|
91
|
+
const group = storedByKey.get(fileKey);
|
|
92
|
+
if (group && isConverged(group, file.contentHash)) {
|
|
93
|
+
skipped += 1;
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
upserts.push({
|
|
97
|
+
filePath: file.filePath,
|
|
98
|
+
// `ingestFile` replaces its own spelling; any other spelling of the same
|
|
99
|
+
// key would otherwise survive as a duplicate of the same file.
|
|
100
|
+
staleStoredPaths: (group?.paths ?? []).filter((path) => path !== file.filePath),
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
const unobservedPrefixes = [
|
|
104
|
+
...input.coverage.unreadableDirs.map((dir) => dir.dirPath),
|
|
105
|
+
...input.coverage.depthLimitedDirs,
|
|
106
|
+
...input.coverage.skippedSymlinks,
|
|
107
|
+
...input.coverage.oversizedFiles,
|
|
108
|
+
];
|
|
109
|
+
const prunes = [];
|
|
110
|
+
for (const [rowKey, group] of storedByKey) {
|
|
111
|
+
if (diskByKey.has(rowKey))
|
|
112
|
+
continue;
|
|
113
|
+
if (!isInRequestedScope(rowKey))
|
|
114
|
+
continue;
|
|
115
|
+
if (isKeyUnder(rowKey, unobservedPrefixes))
|
|
116
|
+
continue;
|
|
117
|
+
if (isKeyUnder(rowKey, input.excludePaths))
|
|
118
|
+
continue;
|
|
119
|
+
if (group.paths.some((path) => isManagedRawDataPath(path, input.dbPath)))
|
|
120
|
+
continue;
|
|
121
|
+
prunes.push({ storedPaths: group.paths });
|
|
122
|
+
}
|
|
123
|
+
return { upserts, skipped, prunes };
|
|
124
|
+
}
|
|
125
|
+
// ============================================
|
|
126
|
+
// Execution (steps 5-10)
|
|
127
|
+
// ============================================
|
|
128
|
+
function toMessage(caught) {
|
|
129
|
+
return caught instanceof Error ? caught.message : String(caught);
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* The controlled error for a requested path the collect predicates refuse. One
|
|
133
|
+
* message per rejection, owned here rather than in the adapters, so the CLI and
|
|
134
|
+
* MCP surfaces refuse the same paths with the same words.
|
|
135
|
+
*
|
|
136
|
+
* The `irregular` case is also what keeps a caller from handing sync something
|
|
137
|
+
* whose read never returns (a FIFO). It fixes that trigger only: nothing here
|
|
138
|
+
* bounds a collaborator that hangs for some other reason, and the MCP mutation
|
|
139
|
+
* guard is still released solely by the job promise settling.
|
|
140
|
+
*/
|
|
141
|
+
function requestedPathRejection(kind, path) {
|
|
142
|
+
switch (kind) {
|
|
143
|
+
case 'missing':
|
|
144
|
+
return `Sync path does not exist: ${path}`;
|
|
145
|
+
case 'irregular':
|
|
146
|
+
return `Sync path is not a regular file or directory: ${path}`;
|
|
147
|
+
case 'symlink':
|
|
148
|
+
return `Sync path is a symbolic link, which sync never follows: ${path}`;
|
|
149
|
+
case 'excluded':
|
|
150
|
+
return `Sync path is inside the database or cache directory: ${path}`;
|
|
151
|
+
case 'unsupported':
|
|
152
|
+
return `Sync path is not a supported document type: ${path}`;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* The one message every out-of-root request receives. A readable target, an
|
|
157
|
+
* unreadable one, and an absent one are deliberately indistinguishable here, so
|
|
158
|
+
* the error text cannot be used to probe for the existence or readability of
|
|
159
|
+
* paths outside the configured roots. Requests that ARE inside a root keep their
|
|
160
|
+
* specific messages ({@link requestedPathRejection}): those name nothing the
|
|
161
|
+
* caller did not already supply.
|
|
162
|
+
*/
|
|
163
|
+
function outsideConfiguredRootsMessage(path) {
|
|
164
|
+
return `Sync path is outside every configured root: ${path}`;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Containment of an explicitly requested path, decided before anything reads it.
|
|
168
|
+
* Two questions, both answered by composing generated keys with the unchanged
|
|
169
|
+
* `isUnderOrEqual`:
|
|
170
|
+
*
|
|
171
|
+
* 1. Is the requested spelling under a configured root spelling? This keeps the
|
|
172
|
+
* request in the same lexical space as the stored DB keys.
|
|
173
|
+
* 2. Is its canonical form under a canonicalized root? This is the security
|
|
174
|
+
* boundary. `resolve()` cannot see that an intermediate component is a
|
|
175
|
+
* symbolic link, so question 1 alone accepts `<root>/link/secret.md` whose
|
|
176
|
+
* real location is outside every root, and the walker's own symlink skipping
|
|
177
|
+
* does not help: nothing walks an explicitly named path.
|
|
178
|
+
*
|
|
179
|
+
* A path that cannot be canonicalized fails, which is also what makes the
|
|
180
|
+
* rejection uniform.
|
|
181
|
+
*/
|
|
182
|
+
async function isRequestedPathContained(requestedPath, input) {
|
|
183
|
+
const { platform } = input;
|
|
184
|
+
const isUnderAny = (path, prefixes) => prefixes.some((prefix) => isUnderOrEqual(toSyncPathKey(path, platform), toSyncPathKey(prefix, platform)));
|
|
185
|
+
if (!isUnderAny(requestedPath, input.roots))
|
|
186
|
+
return false;
|
|
187
|
+
const canonicalPath = await input.collaborators.canonicalizeRequestedPath(requestedPath);
|
|
188
|
+
return canonicalPath !== null && isUnderAny(canonicalPath, input.canonicalRoots);
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Apply a plan: upserts first, then prune, then a single `optimize()`.
|
|
192
|
+
*
|
|
193
|
+
* The first failure anywhere stops the run. Earlier successful mutations stay,
|
|
194
|
+
* every remaining upsert and the entire prune phase are abandoned, and exactly
|
|
195
|
+
* one error is returned. No rollback, retry, or failure classification is
|
|
196
|
+
* attempted — an interrupted run is recovered by rerunning sync.
|
|
197
|
+
*
|
|
198
|
+
* A zero-chunk ingest counts as `empty` and mutates nothing for that file, so
|
|
199
|
+
* its prior rows stay searchable and the next run plans it again.
|
|
200
|
+
*/
|
|
201
|
+
export async function executeSyncPlan(plan, executor, images = false) {
|
|
202
|
+
let upserted = 0;
|
|
203
|
+
let empty = 0;
|
|
204
|
+
let pruned = 0;
|
|
205
|
+
let mutated = false;
|
|
206
|
+
let error = null;
|
|
207
|
+
const prunedPaths = [];
|
|
208
|
+
for (const action of plan.upserts) {
|
|
209
|
+
try {
|
|
210
|
+
const chunkCount = await executor.ingestFile(action.filePath, images);
|
|
211
|
+
if (chunkCount === 0) {
|
|
212
|
+
empty += 1;
|
|
213
|
+
continue;
|
|
214
|
+
}
|
|
215
|
+
upserted += 1;
|
|
216
|
+
mutated = true;
|
|
217
|
+
// After the insert, not before: a zero-chunk result must leave every
|
|
218
|
+
// stored spelling of this key untouched.
|
|
219
|
+
for (const stalePath of action.staleStoredPaths) {
|
|
220
|
+
await executor.deleteExactPath(stalePath);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
catch (caught) {
|
|
224
|
+
error = { message: toMessage(caught), filePath: action.filePath };
|
|
225
|
+
break;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
if (error === null) {
|
|
229
|
+
for (const action of plan.prunes) {
|
|
230
|
+
const [reported] = action.storedPaths;
|
|
231
|
+
try {
|
|
232
|
+
for (const storedPath of action.storedPaths) {
|
|
233
|
+
await executor.deleteExactPath(storedPath);
|
|
234
|
+
mutated = true;
|
|
235
|
+
}
|
|
236
|
+
pruned += 1;
|
|
237
|
+
if (reported !== undefined)
|
|
238
|
+
prunedPaths.push(reported);
|
|
239
|
+
}
|
|
240
|
+
catch (caught) {
|
|
241
|
+
error = { message: toMessage(caught), filePath: reported ?? null };
|
|
242
|
+
break;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
if (error === null && mutated) {
|
|
247
|
+
try {
|
|
248
|
+
await executor.optimize();
|
|
249
|
+
}
|
|
250
|
+
catch (caught) {
|
|
251
|
+
error = { message: toMessage(caught), filePath: null };
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
return { upserted, skipped: plan.skipped, empty, pruned, prunedPaths, error };
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Steps 1-3: validate and classify the requested path, scan the roots it
|
|
258
|
+
* implies, hash the supported disk files, and load the database manifest.
|
|
259
|
+
*
|
|
260
|
+
* `attributedPath` tracks what a thrown error should be blamed on, so an
|
|
261
|
+
* orchestration failure still names the file, root, or requested path involved.
|
|
262
|
+
*/
|
|
263
|
+
async function gatherSyncInputs(input) {
|
|
264
|
+
const { collaborators, platform } = input;
|
|
265
|
+
const coverage = {
|
|
266
|
+
unreadableDirs: [],
|
|
267
|
+
depthLimitedDirs: [],
|
|
268
|
+
skippedSymlinks: [],
|
|
269
|
+
oversizedFiles: [],
|
|
270
|
+
};
|
|
271
|
+
let attributedPath = null;
|
|
272
|
+
try {
|
|
273
|
+
const requestedPath = input.requestedPath;
|
|
274
|
+
let request;
|
|
275
|
+
let scanRoots;
|
|
276
|
+
if (requestedPath === undefined) {
|
|
277
|
+
request = { kind: 'roots' };
|
|
278
|
+
scanRoots = input.roots;
|
|
279
|
+
}
|
|
280
|
+
else {
|
|
281
|
+
attributedPath = requestedPath;
|
|
282
|
+
// Containment first, and against canonical values: a path that reaches
|
|
283
|
+
// outside a configured root through a symlinked ancestor must be refused
|
|
284
|
+
// before anything classifies, walks, hashes, or ingests it.
|
|
285
|
+
if (!(await isRequestedPathContained(requestedPath, input))) {
|
|
286
|
+
throw new Error(outsideConfiguredRootsMessage(requestedPath));
|
|
287
|
+
}
|
|
288
|
+
// Classification happens before any read, and only a directory or a
|
|
289
|
+
// supported regular file survives it: a link, an irregular file, an
|
|
290
|
+
// excluded path, or an unsupported extension is refused here rather than
|
|
291
|
+
// after its bytes have been read and hashed.
|
|
292
|
+
const kind = await collaborators.classifyPath(requestedPath);
|
|
293
|
+
if (kind !== 'directory' && kind !== 'file') {
|
|
294
|
+
throw new Error(requestedPathRejection(kind, requestedPath));
|
|
295
|
+
}
|
|
296
|
+
request = { kind, path: requestedPath };
|
|
297
|
+
// An explicit directory becomes its own depth-zero BFS root; an explicit
|
|
298
|
+
// file needs no directory walk and no depth evaluation at all.
|
|
299
|
+
scanRoots = kind === 'directory' ? [requestedPath] : [];
|
|
300
|
+
}
|
|
301
|
+
const scannedFiles = [];
|
|
302
|
+
for (const root of scanRoots) {
|
|
303
|
+
attributedPath = root;
|
|
304
|
+
const scan = await collaborators.scanDir(root);
|
|
305
|
+
scannedFiles.push(...scan.files);
|
|
306
|
+
coverage.unreadableDirs.push(...scan.unreadableDirs);
|
|
307
|
+
coverage.depthLimitedDirs.push(...scan.depthLimitedDirs);
|
|
308
|
+
coverage.skippedSymlinks.push(...scan.skippedSymlinks);
|
|
309
|
+
}
|
|
310
|
+
if (request.kind === 'file') {
|
|
311
|
+
scannedFiles.push(request.path);
|
|
312
|
+
}
|
|
313
|
+
// Overlapping roots can surface the same file twice; hash each comparison
|
|
314
|
+
// key once, keeping the first spelling encountered.
|
|
315
|
+
const diskByKey = new Map();
|
|
316
|
+
for (const filePath of scannedFiles) {
|
|
317
|
+
const fileKey = toSyncPathKey(filePath, platform);
|
|
318
|
+
if (!diskByKey.has(fileKey))
|
|
319
|
+
diskByKey.set(fileKey, filePath);
|
|
320
|
+
}
|
|
321
|
+
const diskFiles = [];
|
|
322
|
+
for (const filePath of diskByKey.values()) {
|
|
323
|
+
attributedPath = filePath;
|
|
324
|
+
const contentHash = await collaborators.hashFile(filePath);
|
|
325
|
+
if (contentHash === null) {
|
|
326
|
+
// Its bytes were never read, so its content identity is unknown for this
|
|
327
|
+
// run. Recording it as an unobserved region is what keeps its stored rows
|
|
328
|
+
// alive: leaving it out of the manifest alone would look like a deletion.
|
|
329
|
+
coverage.oversizedFiles.push(filePath);
|
|
330
|
+
continue;
|
|
331
|
+
}
|
|
332
|
+
diskFiles.push({ filePath, contentHash });
|
|
333
|
+
}
|
|
334
|
+
attributedPath = null;
|
|
335
|
+
const dbRows = await collaborators.loadDbManifest();
|
|
336
|
+
return { ok: true, coverage, request, diskFiles, dbRows };
|
|
337
|
+
}
|
|
338
|
+
catch (caught) {
|
|
339
|
+
return {
|
|
340
|
+
ok: false,
|
|
341
|
+
coverage,
|
|
342
|
+
error: { message: toMessage(caught), filePath: attributedPath },
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* Run one full sync: gather, plan, execute.
|
|
348
|
+
*
|
|
349
|
+
* Returned counters and coverage facts are plain data; the caller decides how to
|
|
350
|
+
* print them and what exit status or job state they imply. A run with nothing to
|
|
351
|
+
* do calls neither `ingestFile` nor `optimize`, so a true no-op never pays for
|
|
352
|
+
* loading the embedding model or compacting the table.
|
|
353
|
+
*/
|
|
354
|
+
export async function runSync(input) {
|
|
355
|
+
const gathered = await gatherSyncInputs(input);
|
|
356
|
+
if (!gathered.ok) {
|
|
357
|
+
return {
|
|
358
|
+
upserted: 0,
|
|
359
|
+
skipped: 0,
|
|
360
|
+
empty: 0,
|
|
361
|
+
pruned: 0,
|
|
362
|
+
prunedPaths: [],
|
|
363
|
+
coverage: gathered.coverage,
|
|
364
|
+
error: gathered.error,
|
|
365
|
+
};
|
|
366
|
+
}
|
|
367
|
+
const plan = planSync({
|
|
368
|
+
roots: input.roots,
|
|
369
|
+
dbPath: input.dbPath,
|
|
370
|
+
excludePaths: input.excludePaths,
|
|
371
|
+
platform: input.platform,
|
|
372
|
+
request: gathered.request,
|
|
373
|
+
diskFiles: gathered.diskFiles,
|
|
374
|
+
dbRows: gathered.dbRows,
|
|
375
|
+
coverage: gathered.coverage,
|
|
376
|
+
});
|
|
377
|
+
const execution = await executeSyncPlan(plan, input.collaborators, input.images === true);
|
|
378
|
+
return { ...execution, coverage: gathered.coverage };
|
|
379
|
+
}
|
|
380
|
+
//# sourceMappingURL=sync.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sync.js","sourceRoot":"","sources":["../../src/features/sync.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,EAAE;AACF,+EAA+E;AAC/E,gFAAgF;AAChF,uEAAuE;AACvE,sEAAsE;AACtE,8DAA8D;AAC9D,EAAE;AACF,wDAAwD;AACxD,gFAAgF;AAChF,+EAA+E;AAC/E,iFAAiF;AACjF,yEAAyE;AACzE,mEAAmE;AACnE,EAAE;AACF,kFAAkF;AAClF,0EAA0E;AAC1E,+EAA+E;AAC/E,kFAAkF;AAClF,kFAAkF;AAClF,+EAA+E;AAC/E,kBAAkB;AAClB,EAAE;AACF,2EAA2E;AAC3E,wDAAwD;AAExD,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAA;AAEjE,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAkGzD,gGAAgG;AAChG,MAAM,UAAU,eAAe,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAa;IAC9D,OAAO,QAAQ,KAAK,IAAI,IAAI,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,KAAK,QAAQ,GAAG,CAAA;AAC/F,CAAC;AAqGD;;;;;;;;;;;GAWG;AACH,SAAS,WAAW,CAAC,MAAmB,EAAE,QAAgB;IACxD,OAAO,MAAM,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC,KAAK,CAA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