@mnemonik/shared 7.97.1 → 7.98.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.
Files changed (130) hide show
  1. package/dist/ambientPointer.d.ts.map +1 -1
  2. package/dist/ambientPointer.js +2 -1
  3. package/dist/ambientPointer.js.map +1 -1
  4. package/dist/apiOrigin.d.ts +3 -0
  5. package/dist/apiOrigin.d.ts.map +1 -0
  6. package/dist/apiOrigin.js +5 -0
  7. package/dist/apiOrigin.js.map +1 -0
  8. package/dist/ast/astChunker.d.ts +12 -12
  9. package/dist/ast/astChunker.js +32 -32
  10. package/dist/ast/grammars.d.ts +9 -9
  11. package/dist/ast/grammars.js +15 -15
  12. package/dist/codeScanner.d.ts +56 -43
  13. package/dist/codeScanner.d.ts.map +1 -1
  14. package/dist/codeScanner.js +262 -143
  15. package/dist/codeScanner.js.map +1 -1
  16. package/dist/contextBudget.js +2 -2
  17. package/dist/contextBudget.js.map +1 -1
  18. package/dist/gitEditDetector.d.ts +6 -6
  19. package/dist/gitEditDetector.js +7 -7
  20. package/dist/hookRuntime.d.ts +35 -2
  21. package/dist/hookRuntime.d.ts.map +1 -1
  22. package/dist/hookRuntime.js +127 -33
  23. package/dist/hookRuntime.js.map +1 -1
  24. package/dist/hookTimeouts.d.ts +6 -6
  25. package/dist/hookTimeouts.js +6 -6
  26. package/dist/hostAdapter.d.ts +135 -0
  27. package/dist/hostAdapter.d.ts.map +1 -0
  28. package/dist/hostAdapter.js +323 -0
  29. package/dist/hostAdapter.js.map +1 -0
  30. package/dist/hostBinary.d.ts +29 -0
  31. package/dist/hostBinary.d.ts.map +1 -0
  32. package/dist/hostBinary.js +179 -0
  33. package/dist/hostBinary.js.map +1 -0
  34. package/dist/index.d.ts +11 -1
  35. package/dist/index.d.ts.map +1 -1
  36. package/dist/index.js +10 -1
  37. package/dist/index.js.map +1 -1
  38. package/dist/instructions.d.ts +26 -26
  39. package/dist/instructions.js +26 -26
  40. package/dist/jitDeliveryAck.d.ts.map +1 -1
  41. package/dist/jitDeliveryAck.js +2 -0
  42. package/dist/jitDeliveryAck.js.map +1 -1
  43. package/dist/projectIdentityFile.d.ts +25 -0
  44. package/dist/projectIdentityFile.d.ts.map +1 -0
  45. package/dist/projectIdentityFile.js +87 -0
  46. package/dist/projectIdentityFile.js.map +1 -0
  47. package/dist/projectSetupHandoff.d.ts +24 -0
  48. package/dist/projectSetupHandoff.d.ts.map +1 -0
  49. package/dist/projectSetupHandoff.js +249 -0
  50. package/dist/projectSetupHandoff.js.map +1 -0
  51. package/dist/protectedPaths.d.ts +9 -0
  52. package/dist/protectedPaths.d.ts.map +1 -0
  53. package/dist/protectedPaths.js +66 -0
  54. package/dist/protectedPaths.js.map +1 -0
  55. package/dist/readiness.d.ts +143 -0
  56. package/dist/readiness.d.ts.map +1 -0
  57. package/dist/readiness.js +304 -0
  58. package/dist/readiness.js.map +1 -0
  59. package/dist/repositoryFingerprint.d.ts +50 -0
  60. package/dist/repositoryFingerprint.d.ts.map +1 -0
  61. package/dist/repositoryFingerprint.js +160 -0
  62. package/dist/repositoryFingerprint.js.map +1 -0
  63. package/dist/repositoryRoot.d.ts +56 -0
  64. package/dist/repositoryRoot.d.ts.map +1 -0
  65. package/dist/repositoryRoot.js +226 -0
  66. package/dist/repositoryRoot.js.map +1 -0
  67. package/dist/runtimeReader.d.ts +102 -0
  68. package/dist/runtimeReader.d.ts.map +1 -0
  69. package/dist/runtimeReader.js +408 -0
  70. package/dist/runtimeReader.js.map +1 -0
  71. package/dist/runtimeSigners.d.ts +37 -0
  72. package/dist/runtimeSigners.d.ts.map +1 -0
  73. package/dist/runtimeSigners.js +507 -0
  74. package/dist/runtimeSigners.js.map +1 -0
  75. package/dist/scannerSupervisor.d.ts +35 -0
  76. package/dist/scannerSupervisor.d.ts.map +1 -0
  77. package/dist/scannerSupervisor.js +2 -0
  78. package/dist/scannerSupervisor.js.map +1 -0
  79. package/dist/secretPatterns.d.ts +9 -9
  80. package/dist/secretPatterns.d.ts.map +1 -1
  81. package/dist/secretPatterns.js +27 -25
  82. package/dist/secretPatterns.js.map +1 -1
  83. package/dist/testing/hostAdapterConformance.d.ts +17 -0
  84. package/dist/testing/hostAdapterConformance.d.ts.map +1 -0
  85. package/dist/testing/hostAdapterConformance.js +477 -0
  86. package/dist/testing/hostAdapterConformance.js.map +1 -0
  87. package/dist/usageGuide.d.ts +1 -1
  88. package/dist/usageGuide.d.ts.map +1 -1
  89. package/dist/usageGuide.js +4 -4
  90. package/package.json +7 -2
  91. package/queries/bash.tags.scm +1 -1
  92. package/queries/groovy.tags.scm +1 -1
  93. package/scripts/vendor-grammars.ts +13 -13
  94. package/src/ambientPointer.ts +2 -1
  95. package/src/apiOrigin.ts +4 -0
  96. package/src/ast/astChunker.ts +39 -39
  97. package/src/ast/grammars.ts +16 -16
  98. package/src/codeScanner.ts +274 -149
  99. package/src/contextBudget.ts +2 -2
  100. package/src/gitEditDetector.ts +7 -7
  101. package/src/hookRuntime.ts +162 -34
  102. package/src/hookTimeouts.ts +6 -6
  103. package/src/hostAdapter.ts +468 -0
  104. package/src/hostBinary.ts +205 -0
  105. package/src/index.ts +20 -0
  106. package/src/instructions.ts +26 -26
  107. package/src/jitDeliveryAck.ts +2 -0
  108. package/src/projectIdentityFile.ts +100 -0
  109. package/src/projectSetupHandoff.ts +275 -0
  110. package/src/protectedPaths.ts +88 -0
  111. package/src/readiness.ts +516 -0
  112. package/src/repositoryFingerprint.ts +199 -0
  113. package/src/repositoryRoot.ts +261 -0
  114. package/src/runtimeReader.ts +495 -0
  115. package/src/runtimeSigners.ts +577 -0
  116. package/src/scannerSupervisor.ts +26 -0
  117. package/src/secretPatterns.ts +27 -25
  118. package/src/testing/hostAdapterConformance.ts +538 -0
  119. package/src/usageGuide.ts +4 -4
  120. package/test-fixtures/identity/runner.d.mts +12 -0
  121. package/test-fixtures/identity/runner.mjs +282 -0
  122. package/tests/fixtures/repository-fingerprint-v1.golden.json +834 -0
  123. package/tests/projectIdentity.test.ts +56 -0
  124. package/tests/readiness.test.ts +158 -0
  125. package/tests/repositoryFingerprint.test.ts +26 -0
  126. package/tsconfig.test.json +9 -0
  127. package/wasm/bash.tags.scm +1 -1
  128. package/wasm/groovy.tags.scm +1 -1
  129. package/wasm/javascript.tags.scm +2 -2
  130. package/wasm/solidity.tags.scm +1 -1
@@ -1,17 +1,18 @@
1
1
  /**
2
2
  * Code Scanner - Parse and chunk source files for embedding
3
3
  */
4
+ import { type Stats } from 'fs';
4
5
  /**
5
6
  * The one file-size ceiling in Mnemonik. A file at or below this is scanned,
6
7
  * chunked, AND pushed verbatim; a file above it is uniformly outside the
7
- * system — not scanned, not chunked, not citable. "Scanned ⟺ verifiable".
8
+ * system - not scanned, not chunked, not citable. "Scanned ⟺ verifiable".
8
9
  *
9
10
  * This is deliberately a single exported constant rather than a number
10
11
  * repeated per layer. Three ceilings previously existed and had drifted:
11
12
  * the scan ceiling here (10 MB), a 5 MB whole-file push cap in the scanner
12
13
  * daemon, and a 5 MB `content` cap in the server's scanPushSchema. Files
13
14
  * between 5 and 10 MB were therefore indexed as chunks whose source content
14
- * the server never received — chunks that could be retrieved but never
15
+ * the server never received - chunks that could be retrieved but never
15
16
  * verified against, a silent fidelity split. Every consumer now imports this:
16
17
  *
17
18
  * - `CodeScanner.MAX_FILE_SIZE` / `collectAuthorityFilesWithStatus` (this file)
@@ -22,6 +23,8 @@
22
23
  * one site alone.
23
24
  */
24
25
  export declare const MAX_SCANNED_FILE_BYTES: number;
26
+ /** Transport ceiling; ordinary chunking may exceed maxChunkSize but never this bound. */
27
+ export declare const MAX_PUSH_CHUNK_CONTENT_LENGTH = 500000;
25
28
  export interface CodeChunk {
26
29
  content: string;
27
30
  filePath: string;
@@ -53,14 +56,16 @@ export interface ScanOptions {
53
56
  * mock.
54
57
  */
55
58
  maxAstParseBytes?: number;
59
+ /** Additional protected paths for isolated homes/tests; defaults can only be extended. */
60
+ protectedPaths?: readonly string[];
56
61
  }
57
62
  /**
58
- * Directory basenames the scanner never indexes, across every ecosystem —
63
+ * Directory basenames the scanner never indexes, across every ecosystem -
59
64
  * generated output, package-manager/build caches, and vendored deps. SINGLE
60
65
  * SOURCE OF TRUTH: the scanner package's discovery + watch walks import this
61
66
  * (`packages/scanner/src/{discovery,watcher}.ts`) and `src/core/utils.ts`
62
67
  * derives from it, so every ignore surface agrees instead of drifting (the
63
- * pre-2026-07 state had four divergent copies). Add only UNAMBIGUOUS names —
68
+ * pre-2026-07 state had four divergent copies). Add only UNAMBIGUOUS names -
64
69
  * a project's own `.gitignore` / `.mnemonikignore` covers the ambiguous,
65
70
  * project-specific cases (`vendor/`, custom dirs) hierarchically.
66
71
  */
@@ -80,7 +85,7 @@ export declare function isSecretFile(relPath: string): boolean;
80
85
  * Exported because this list IS the product's language coverage: a project
81
86
  * written in something absent from it indexes zero code, and `code_search`
82
87
  * reports that as "no indexed matches" rather than "I do not read this
83
- * language" — invisible to the developer and to us. Coverage is a separate
88
+ * language" - invisible to the developer and to us. Coverage is a separate
84
89
  * dial from parse quality: a language with no structured extractor falls
85
90
  * through to `chunkRaw`, which is what Go, Java and C already get in
86
91
  * production, and crude chunks beat no chunks by an enormous margin.
@@ -88,7 +93,7 @@ export declare function isSecretFile(relPath: string): boolean;
88
93
  * Data formats (`.json`, `.yaml`, `.toml`, `.lock`) are deliberately absent:
89
94
  * the ones that carry meaning are already collected verbatim by
90
95
  * `AUTHORITY_FILE_MATCHERS`, and blanket-indexing the extension would pull in
91
- * lockfiles and generated output. `.tfvars` is absent for a different reason —
96
+ * lockfiles and generated output. `.tfvars` is absent for a different reason -
92
97
  * `terraform.tfvars` is a conventional home for provider credentials and
93
98
  * `isSecretFile` now excludes it outright.
94
99
  */
@@ -102,7 +107,7 @@ export declare const DEFAULT_INCLUDE_EXTENSIONS: readonly string[];
102
107
  export declare function languageForExtension(filePathOrExt: string): string;
103
108
  /**
104
109
  * True when `relPath` is collected verbatim as authority content and must not
105
- * additionally be chunked. Accepts OS-native or POSIX separators.
110
+ * also be chunked. Accepts OS-native or POSIX separators.
106
111
  */
107
112
  export declare function isAuthorityOnlyPath(relPath: string): boolean;
108
113
  /**
@@ -112,7 +117,7 @@ export declare function isAuthorityOnlyPath(relPath: string): boolean;
112
117
  */
113
118
  export declare const AUTHORITY_FILE_MATCHERS: Array<(relPath: string) => boolean>;
114
119
  /**
115
- * Segment-anchored match for the `tests/fixtures/` ignore pattern above —
120
+ * Segment-anchored match for the `tests/fixtures/` ignore pattern above -
116
121
  * matches at the path root or immediately after a `/`, mirroring exactly
117
122
  * what `shouldIgnore` compiles `'/tests/fixtures/*'` to. Exported so
118
123
  * server-side consumers (e.g. the `/scan/push` route) and query-time
@@ -127,7 +132,7 @@ export declare function isFixturePath(path: string): boolean;
127
132
  * (segment-exact) with a project's uploaded .gitignore/.mnemonikignore patterns
128
133
  * (gitignore syntax via the `ignore` package). Built once per request and reused
129
134
  * across all pushed paths (root-relative, forward-slash). This does NOT replace
130
- * the daemon's precise hierarchical walk — it backstops it so a buggy, stale, or
135
+ * the daemon's precise hierarchical walk - it backstops it so a buggy, stale, or
131
136
  * malicious client cannot index a path the project ignores, making .mnemonikignore
132
137
  * a hard guarantee rather than best-effort.
133
138
  */
@@ -137,7 +142,7 @@ export declare function makeIgnoreMatcher(extraPatterns?: readonly string[]): (r
137
142
  * being scanned: it carries its own `.git` entry. A `.git` FILE marks a
138
143
  * linked git worktree (wherever the user keeps them) or a submodule
139
144
  * checkout; a `.git` DIRECTORY marks a nested clone. Files under such a
140
- * boundary belong to that repository's own project identity — scanning them
145
+ * boundary belong to that repository's own project identity - scanning them
141
146
  * into the parent project is wrong attribution for any codebase, so the
142
147
  * walkers skip these subtrees. Convention-free: this is git's own marker,
143
148
  * not a host/tool path layout. The scan ROOT is exempt by construction
@@ -145,7 +150,7 @@ export declare function makeIgnoreMatcher(extraPatterns?: readonly string[]): (r
145
150
  */
146
151
  export declare function isGitBoundary(dirPath: string): Promise<boolean>;
147
152
  /**
148
- * Log which grammars this install ships — ONCE per process, at daemon start,
153
+ * Log which grammars this install ships - ONCE per process, at daemon start,
149
154
  * never per file.
150
155
  *
151
156
  * A missing grammar silently degrades every file of that language to the
@@ -156,8 +161,8 @@ export declare function isGitBoundary(dirPath: string): Promise<boolean>;
156
161
  *
157
162
  * Deliberately a `statSync` of the artifacts (`astArtifactReport`) and not a
158
163
  * load of them (`astCapabilityReport`). Loading all 18 to print this line costs
159
- * ~690 ms and ~75 MB of RSS that is never returned — web-tree-sitter exposes no
160
- * `Language.delete` — which is a permanent tax on a daemon watching a pure
164
+ * ~690 ms and ~75 MB of RSS that is never returned - web-tree-sitter exposes no
165
+ * `Language.delete` - which is a permanent tax on a daemon watching a pure
161
166
  * TypeScript repo, paid to pre-answer a question about seventeen languages it
162
167
  * will never see. Grammars load lazily instead, on the first file of a language,
163
168
  * and the two failure modes only a load can detect (`wasm_load_failed`,
@@ -169,15 +174,23 @@ export declare function isGitBoundary(dirPath: string): Promise<boolean>;
169
174
  export declare function logAstCapabilityOnce(): Promise<void>;
170
175
  export declare class CodeScanner {
171
176
  private options;
177
+ private readonly protectedPaths;
178
+ /** Cumulative observations since this scanner started, including repeated walks. */
179
+ readonly skipReasons: {
180
+ symlink_skipped: number;
181
+ };
182
+ private skipSymlink;
172
183
  /**
173
184
  * `includeExtensions` folded to lowercase for matching. The gate used to
174
185
  * compare `extname()` verbatim while `detectLanguage` lowercased, so a
175
- * project spelling its files the canonical way — `.R` for R, `.SQL`/`.PS1`
176
- * on Windows, `.C`/`.H` in older C trees — indexed zero of them and nothing
186
+ * project spelling its files the canonical way - `.R` for R, `.SQL`/`.PS1`
187
+ * on Windows, `.C`/`.H` in older C trees - indexed zero of them and nothing
177
188
  * said why.
178
189
  */
179
190
  private readonly includeExtensionSet;
180
191
  constructor(options?: ScanOptions);
192
+ private isProtected;
193
+ private isProtectedRead;
181
194
  /**
182
195
  * The chunkable-file gate, shared by every walker and by the explicit
183
196
  * file-list path so all three agree on what exists. `relPath` is the path
@@ -186,7 +199,7 @@ export declare class CodeScanner {
186
199
  private isChunkable;
187
200
  /**
188
201
  * Read `.gitignore` + `.mnemonikignore` in `absDir` and compile them into one
189
- * ignore layer (the two files are unioned — `.mnemonikignore` is just an
202
+ * ignore layer (the two files are unioned - `.mnemonikignore` is just an
190
203
  * additional gitignore-syntax exclusion list). Returns null when neither file
191
204
  * exists. FAIL-CLOSED: a non-ENOENT read error (EISDIR, EACCES, timeout)
192
205
  * latches `walk.complete = false` so callers deriving *removals* from the walk
@@ -202,7 +215,7 @@ export declare class CodeScanner {
202
215
  */
203
216
  private ignoredByStack;
204
217
  /**
205
- * Reconstruct the root→parent ignore-layer stack for a single file, for the
218
+ * Reconstruct the root->parent ignore-layer stack for a single file, for the
206
219
  * incremental `scanFiles` path (which has a flat file list, not a recursive
207
220
  * walk). Layers are memoized per directory in `cache` across a batch.
208
221
  */
@@ -210,7 +223,7 @@ export declare class CodeScanner {
210
223
  /**
211
224
  * True when any directory strictly between `rootPath` and `filePath`
212
225
  * carries its own `.git` entry (see isGitBoundary). Paths that don't
213
- * resolve under `rootPath` are not judged here (return false) — the
226
+ * resolve under `rootPath` are not judged here (return false) - the
214
227
  * server's path validation handles escapes.
215
228
  */
216
229
  private insideNestedGitBoundary;
@@ -219,14 +232,14 @@ export declare class CodeScanner {
219
232
  * Prevents runaway recursion on deep/symlinked structures
220
233
  */
221
234
  private static readonly MAX_DEPTH;
222
- /**
223
- * Symlink confinement shared by every walker (traverseDirectory,
224
- * traversePaths, collectAuthorityFiles): true when the symlink at
225
- * `fullPath` resolves inside `rootPath` and may be followed, false when
226
- * it escapes the project root. A dangling link (realpath ENOENT) throws
227
- * to the caller's per-entry handler.
228
- */
235
+ private canonicalRoots;
236
+ private canonicalRoot;
237
+ static containsCanonical(candidate: string, root: string, paths?: {
238
+ sep: "/" | "\\";
239
+ resolve: (...paths: string[]) => string;
240
+ }, caseInsensitive?: boolean): boolean;
229
241
  private confineSymlink;
242
+ readConfined(fullPath: string, canonicalRoot: string, enumerated?: Stats): Promise<string>;
230
243
  /**
231
244
  * Scan a directory recursively and extract code chunks
232
245
  * Added max depth (10) to prevent infinite recursion
@@ -235,7 +248,7 @@ export declare class CodeScanner {
235
248
  /**
236
249
  * Completeness-aware variant of `scanDirectory`. `complete === false`
237
250
  * means at least one fs error was swallowed during the walk, so the
238
- * chunk set may be missing files that still exist on disk — callers
251
+ * chunk set may be missing files that still exist on disk - callers
239
252
  * deriving removals from the result must not trust it as an inventory.
240
253
  * Chunks are secret-scrubbed before returning (same daemon-side
241
254
  * redaction guarantee as `scanFiles`).
@@ -248,7 +261,7 @@ export declare class CodeScanner {
248
261
  * Enumerate scan-eligible relative file paths under `rootPath` without
249
262
  * reading or chunking content. Same walk + ignorePatterns + extension
250
263
  * filter as `scanDirectory`, but bounded to O(file count) directory ops
251
- * — cheap enough to call on every periodic reconcile tick.
264
+ * - cheap enough to call on every periodic reconcile tick.
252
265
  *
253
266
  * Returns relative paths normalized against `rootPath`, matching the
254
267
  * shape the server stores in `memories.metadata->>'filePath'`. Use this
@@ -263,7 +276,7 @@ export declare class CodeScanner {
263
276
  listFiles(rootPath: string): Promise<string[]>;
264
277
  /**
265
278
  * Completeness-aware variant of `listFiles`. `complete === false` means
266
- * an fs error truncated part of the walk — the returned paths may be
279
+ * an fs error truncated part of the walk - the returned paths may be
267
280
  * missing files that still exist on disk. The daemon's reconcile channel
268
281
  * MUST NOT derive removedFiles from an incomplete inventory (a truncated
269
282
  * walk otherwise reads as mass deletion and deprecates live memories).
@@ -305,7 +318,7 @@ export declare class CodeScanner {
305
318
  private shouldIgnore;
306
319
  /**
307
320
  * Parse a file and extract code chunks.
308
- * Size limit is the shared `MAX_SCANNED_FILE_BYTES` ceiling — the same
321
+ * Size limit is the shared `MAX_SCANNED_FILE_BYTES` ceiling - the same
309
322
  * number the daemon and the server's scanPushSchema enforce, so anything
310
323
  * chunked here can always be shipped and stored verbatim.
311
324
  */
@@ -319,8 +332,8 @@ export declare class CodeScanner {
319
332
  * chunk that came from a definition is exactly as big as the definition, and a
320
333
  * span that is one enormous line is left whole on purpose. Both used to reach
321
334
  * the wire verbatim, where `scanChunkSchema` caps content at 500,000 chars and
322
- * rejects the WHOLE push if any chunk is over — so one generated file stopped
323
- * all scanning for that push — and where anything past 8191 tokens is only
335
+ * rejects the WHOLE push if any chunk is over - so one generated file stopped
336
+ * all scanning for that push - and where anything past 8191 tokens is only
324
337
  * partially embedded.
325
338
  *
326
339
  * The invariants, all of which the split preserves:
@@ -328,8 +341,8 @@ export declare class CodeScanner {
328
341
  * joined by '\n', never a join of disjoint regions and never an elision;
329
342
  * - total coverage is unchanged: the pieces tile the original range, in order,
330
343
  * with no gap and no overlap;
331
- * - the definition's identity rides on the piece that carries its signature —
332
- * the first one — and the continuations are plain `raw` spans, because a
344
+ * - the definition's identity rides on the piece that carries its signature -
345
+ * the first one - and the continuations are plain `raw` spans, because a
333
346
  * continuation is not the definition and must not claim its name.
334
347
  *
335
348
  * `null` (the caller degrades the whole file to the heuristic chunker) is
@@ -365,13 +378,9 @@ export declare class CodeScanner {
365
378
  /**
366
379
  * Raw chunking with overlap, bounded by character count (not line count).
367
380
  *
368
- * The previous implementation took `floor(maxChunkSize / 80)` lines per
369
- * chunk on the assumption of ~80 chars/line. Long-line files (minified
370
- * JS, JSON blobs, generated code) produced chunks many times larger than
371
- * `maxChunkSize`, which then exceeded OpenAI's 8191-token embedding
372
- * limit and surfaced as 400s on /scan/push (Sentry MNEMONIK-58).
373
- *
374
- * Now: walk lines and accumulate character length; emit when the next
381
+ * Line-count estimates do not bound long-line files such as minified JS,
382
+ * JSON blobs and generated code. Walk lines and accumulate character
383
+ * length; emit when the next
375
384
  * line would push the running total past `maxChunkSize`. Single lines
376
385
  * longer than `maxChunkSize` are force-split into char-based segments.
377
386
  * 10% overlap is carried by character count from the tail of the
@@ -385,7 +394,7 @@ export declare class CodeScanner {
385
394
  /**
386
395
  * Walk the project for authority manifest/config/CI files and return their
387
396
  * verbatim content. Reuses ignorePatterns; matches AUTHORITY_FILE_MATCHERS
388
- * (not includeExtensions). Content-only — no chunking, no embeddings.
397
+ * (not includeExtensions). Content-only - no chunking, no embeddings.
389
398
  */
390
399
  collectAuthorityFiles(projectRoot: string): Promise<Array<{
391
400
  path: string;
@@ -395,11 +404,15 @@ export declare class CodeScanner {
395
404
  /**
396
405
  * Completeness-aware variant of `collectAuthorityFiles`. `complete ===
397
406
  * false` means an fs error hid part of the walk, so authority paths may
398
- * be missing — the daemon folds this into the same removal gate as
407
+ * be missing - the daemon folds this into the same removal gate as
399
408
  * `listFilesWithStatus` (a partial authority walk would likewise drop
400
409
  * inventory entries and read as deletion).
401
410
  */
402
- collectAuthorityFilesWithStatus(projectRoot: string): Promise<{
411
+ collectAuthorityFilesWithStatus(projectRoot: string, onFile?: (file: {
412
+ path: string;
413
+ content: string;
414
+ hash: string;
415
+ }) => Promise<void>): Promise<{
403
416
  files: Array<{
404
417
  path: string;
405
418
  content: string;
@@ -1 +1 @@
1
- {"version":3,"file":"codeScanner.d.ts","sourceRoot":"","sources":["../src/codeScanner.ts"],"names":[],"mappings":"AAAA;;GAEG;AAiBH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,sBAAsB,QAAmB,CAAC;AAEvD,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,UAAU,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;IACnD,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE;QACR,QAAQ,EAAE,MAAM,CAAC;QACjB,SAAS,EAAE,MAAM,CAAC;QAClB,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,UAAU,CAAC,EAAE,MAAM,CAAC;QAKpB,UA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