@qmediat.io/gemini-code-context-mcp 1.4.1 → 1.5.1
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 +100 -0
- package/README.md +26 -3
- package/dist/config.d.ts +23 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +9 -0
- package/dist/config.js.map +1 -1
- package/dist/gemini/client.d.ts.map +1 -1
- package/dist/gemini/client.js +11 -0
- package/dist/gemini/client.js.map +1 -1
- package/dist/gemini/retry.d.ts +63 -0
- package/dist/gemini/retry.d.ts.map +1 -0
- package/dist/gemini/retry.js +103 -0
- package/dist/gemini/retry.js.map +1 -0
- package/dist/indexer/globs.d.ts +106 -0
- package/dist/indexer/globs.d.ts.map +1 -1
- package/dist/indexer/globs.js +151 -11
- package/dist/indexer/globs.js.map +1 -1
- package/dist/tools/agentic/sandbox.d.ts +55 -0
- package/dist/tools/agentic/sandbox.d.ts.map +1 -0
- package/dist/tools/agentic/sandbox.js +272 -0
- package/dist/tools/agentic/sandbox.js.map +1 -0
- package/dist/tools/agentic/workspace-tools.d.ts +104 -0
- package/dist/tools/agentic/workspace-tools.d.ts.map +1 -0
- package/dist/tools/agentic/workspace-tools.js +518 -0
- package/dist/tools/agentic/workspace-tools.js.map +1 -0
- package/dist/tools/ask-agentic.tool.d.ts +85 -0
- package/dist/tools/ask-agentic.tool.d.ts.map +1 -0
- package/dist/tools/ask-agentic.tool.js +739 -0
- package/dist/tools/ask-agentic.tool.js.map +1 -0
- package/dist/tools/ask.tool.d.ts +12 -12
- package/dist/tools/ask.tool.d.ts.map +1 -1
- package/dist/tools/ask.tool.js +537 -477
- package/dist/tools/ask.tool.js.map +1 -1
- package/dist/tools/code.tool.d.ts +8 -8
- package/dist/tools/code.tool.d.ts.map +1 -1
- package/dist/tools/code.tool.js +472 -423
- package/dist/tools/code.tool.js.map +1 -1
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +2 -0
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/registry.d.ts +1 -1
- package/dist/tools/registry.d.ts.map +1 -1
- package/dist/tools/registry.js +8 -2
- package/dist/tools/registry.js.map +1 -1
- package/package.json +2 -2
package/dist/indexer/globs.js
CHANGED
|
@@ -197,6 +197,11 @@ export const DEFAULT_EXCLUDE_FILE_NAMES = [
|
|
|
197
197
|
'composer.lock',
|
|
198
198
|
'.DS_Store',
|
|
199
199
|
'Thumbs.db',
|
|
200
|
+
// Belt-and-suspenders literal match for TS incremental build cache —
|
|
201
|
+
// the extension-based `DEFAULT_EXCLUDE_EXTENSIONS` entry catches this
|
|
202
|
+
// too, but an explicit literal makes the intent obvious in error logs
|
|
203
|
+
// when users wonder why their `tsconfig.tsbuildinfo` isn't indexed.
|
|
204
|
+
'tsconfig.tsbuildinfo',
|
|
200
205
|
// Secret-bearing files (belt + suspenders on top of directory excludes).
|
|
201
206
|
'.netrc',
|
|
202
207
|
'.pypirc',
|
|
@@ -205,6 +210,46 @@ export const DEFAULT_EXCLUDE_FILE_NAMES = [
|
|
|
205
210
|
'.git-credentials',
|
|
206
211
|
'credentials', // AWS, qmediat, gcloud all use this filename in config dirs
|
|
207
212
|
];
|
|
213
|
+
/**
|
|
214
|
+
* Extensions whose files are ALWAYS excluded from indexing, regardless of
|
|
215
|
+
* caller `includeGlobs`. Checked via `filename.endsWith(ext)` in
|
|
216
|
+
* `isFileIncluded`, AFTER `excludeFileNames` and BEFORE `includeExtensions`.
|
|
217
|
+
*
|
|
218
|
+
* Kept intentionally small — each entry is a hard no-analyse call. Add only
|
|
219
|
+
* when the cost of indexing the file (token waste + misleading Gemini
|
|
220
|
+
* responses) clearly outweighs any imaginable user need.
|
|
221
|
+
*
|
|
222
|
+
* - `.tsbuildinfo` — TypeScript incremental build cache; generated,
|
|
223
|
+
* enormous (6-figure tokens on mid-size projects), zero analytical
|
|
224
|
+
* value. Empirically observed at 158k tokens on a single file in the
|
|
225
|
+
* a large workspace that triggered the v1.5.0 fix.
|
|
226
|
+
*
|
|
227
|
+
* Explicitly NOT here:
|
|
228
|
+
* - `.map` / `.min.js` / `.min.css` — in some diagnostic / legacy-bundle
|
|
229
|
+
* workflows the minified file is the ONLY available source. A global
|
|
230
|
+
* default exclude would silently erase them from Gemini's view. If
|
|
231
|
+
* you want them skipped, pass `excludeGlobs: ['*.map', '*.min.js']`.
|
|
232
|
+
* - Framework migration snapshots (Drizzle `meta/*.json`, Prisma) —
|
|
233
|
+
* each framework uses a different path shape, and some projects
|
|
234
|
+
* check migrations into source control for review. Users can opt in
|
|
235
|
+
* via `excludeGlobs: ['src/lib/db/migrations/meta']` (now that Fix A
|
|
236
|
+
* makes path-prefix patterns work as users expect).
|
|
237
|
+
*/
|
|
238
|
+
export const DEFAULT_EXCLUDE_EXTENSIONS = ['.tsbuildinfo'];
|
|
239
|
+
/**
|
|
240
|
+
* Lowercased `Set`s for O(1) case-insensitive lookup on macOS APFS and
|
|
241
|
+
* Windows NTFS — both default to case-insensitive, so a file stored as
|
|
242
|
+
* `PACKAGE-LOCK.JSON` resolves to the same inode as `package-lock.json`
|
|
243
|
+
* but used to slip past a strict-equality `.includes(base)` check.
|
|
244
|
+
*
|
|
245
|
+
* Introduced in PR #24 round-3 after three reviewers (Grok, Copilot,
|
|
246
|
+
* self-review) noted that round-2's secret-denylist lowercasing only
|
|
247
|
+
* covered `AGENTIC_SECRET_BASENAMES`; the generic exclude lists kept
|
|
248
|
+
* strict comparisons, so lockfiles / build caches with any non-canonical
|
|
249
|
+
* casing on case-insensitive FS slipped through filtering.
|
|
250
|
+
*/
|
|
251
|
+
export const DEFAULT_EXCLUDE_FILE_NAMES_LOWER = new Set(DEFAULT_EXCLUDE_FILE_NAMES.map((s) => s.toLowerCase()));
|
|
252
|
+
export const DEFAULT_EXCLUDE_DIRS_LOWER = new Set(DEFAULT_EXCLUDE_DIRS.map((s) => s.toLowerCase()));
|
|
208
253
|
/**
|
|
209
254
|
* Normalise an `includeGlobs` entry. Accepts three shapes per the tool schema:
|
|
210
255
|
* - `.ext` → literal extension suffix (matched via `endsWith`)
|
|
@@ -228,46 +273,141 @@ function normalizeIncludeGlob(pattern) {
|
|
|
228
273
|
}
|
|
229
274
|
return `.${pattern}`;
|
|
230
275
|
}
|
|
276
|
+
export function normalizeExcludeGlob(pattern) {
|
|
277
|
+
// Detect explicit dir intent BEFORE normalisation strips the signal.
|
|
278
|
+
// `dist/`, `src\\vendor/`, `.vercel/` — trailing separator means the user
|
|
279
|
+
// said "this is a directory". Without this pre-check the dot-prefix
|
|
280
|
+
// branch below would misclassify `.vercel/` as an extension (strip
|
|
281
|
+
// trailing `/` → `.vercel` → `startsWith('.')` → extension bucket),
|
|
282
|
+
// silently leaving `.vercel/`, `.next/`, `.turbo/` etc. indexable.
|
|
283
|
+
// Regression reported in PR #24 review by Gemini and Grok.
|
|
284
|
+
const hadTrailingSlash = /[\\/]+$/.test(pattern.trim());
|
|
285
|
+
// Normalise separators + strip filler so downstream heuristic sees a
|
|
286
|
+
// canonical form. Order matters:
|
|
287
|
+
// 1. Windows `\` → POSIX `/`
|
|
288
|
+
// 2. Strip leading `./` (users copy from shell prompts often have this)
|
|
289
|
+
// 3. Strip trailing `/` (a dir written as `dist/` means the dir `dist`)
|
|
290
|
+
// 4. Trim whitespace
|
|
291
|
+
const cleaned = pattern.replace(/\\/g, '/').replace(/^\.\//, '').replace(/\/+$/, '').trim();
|
|
292
|
+
if (cleaned.length === 0)
|
|
293
|
+
return null;
|
|
294
|
+
// Pre-strip dir intent wins over any subsequent heuristic. `.vercel/` →
|
|
295
|
+
// dir bucket (the prefix dot would otherwise short-circuit into extension).
|
|
296
|
+
if (hadTrailingSlash) {
|
|
297
|
+
return { kind: 'dir', value: cleaned };
|
|
298
|
+
}
|
|
299
|
+
// Extension bucket: explicit `*.ext` only. Bare `.env` / `.npmrc` /
|
|
300
|
+
// `.tsbuildinfo` used to fall here too, but that produced over-matching
|
|
301
|
+
// on `endsWith(.env)` — e.g. user `excludeGlobs: [".env"]` would also
|
|
302
|
+
// exclude `staging.env`, `config.example.env`, etc. PR #24 round-3
|
|
303
|
+
// review by Grok + self-review PARTIAL: if the user wanted the extension
|
|
304
|
+
// bucket they can write `*.env`; a bare dotfile literal is clearer as
|
|
305
|
+
// a filename (exact-match).
|
|
306
|
+
if (cleaned.startsWith('*.')) {
|
|
307
|
+
return { kind: 'extension', value: `.${cleaned.slice(2)}` };
|
|
308
|
+
}
|
|
309
|
+
// Filename bucket: no separators, no wildcards. Covers both:
|
|
310
|
+
// - classic filenames with dot (`pr27-diff.txt`, `package-lock.json`)
|
|
311
|
+
// - dot-prefixed literals (`.env`, `.npmrc`, `.tsbuildinfo`)
|
|
312
|
+
// For callers who want extension semantics on a dot-prefixed pattern,
|
|
313
|
+
// use `*.env` / `*.tsbuildinfo` — explicit and unambiguous.
|
|
314
|
+
if (!cleaned.includes('/') && !cleaned.includes('*')) {
|
|
315
|
+
// Sub-heuristic: a bare name without a dot (`Dockerfile`, `Makefile`,
|
|
316
|
+
// `LICENSE`) could be either a filename or a dir — directories called
|
|
317
|
+
// `Dockerfile` are extraordinarily rare, but pre-v1.5.0 these patterns
|
|
318
|
+
// were force-routed to `excludeDirs`. Preserve that behaviour so we
|
|
319
|
+
// don't silently break users upgrading from v1.4.x. Filename bucket
|
|
320
|
+
// requires a dot OR a leading dot (dotfile).
|
|
321
|
+
if (cleaned.includes('.') || cleaned.startsWith('.')) {
|
|
322
|
+
return { kind: 'filename', value: cleaned };
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
// Everything else → directory (bare dir name, or path-with-slash).
|
|
326
|
+
return { kind: 'dir', value: cleaned };
|
|
327
|
+
}
|
|
231
328
|
export function defaultMatchConfig(extra = {}) {
|
|
232
|
-
const
|
|
329
|
+
const extraExtsInclude = [];
|
|
330
|
+
const extraExtsExclude = [];
|
|
331
|
+
const extraFileNames = [];
|
|
233
332
|
const extraDirs = [];
|
|
234
333
|
for (const pattern of extra.includeGlobs ?? []) {
|
|
235
|
-
|
|
334
|
+
extraExtsInclude.push(normalizeIncludeGlob(pattern));
|
|
236
335
|
}
|
|
336
|
+
// Route each excludeGlob to its semantic bucket (dir / filename / ext).
|
|
337
|
+
// Pre-v1.5.0: every pattern was force-pushed to excludeDirs, silently
|
|
338
|
+
// ignoring any that weren't literal dir basenames.
|
|
237
339
|
for (const pattern of extra.excludeGlobs ?? []) {
|
|
238
|
-
|
|
340
|
+
const bucket = normalizeExcludeGlob(pattern);
|
|
341
|
+
if (!bucket)
|
|
342
|
+
continue;
|
|
343
|
+
if (bucket.kind === 'extension')
|
|
344
|
+
extraExtsExclude.push(bucket.value);
|
|
345
|
+
else if (bucket.kind === 'filename')
|
|
346
|
+
extraFileNames.push(bucket.value);
|
|
347
|
+
else
|
|
348
|
+
extraDirs.push(bucket.value);
|
|
239
349
|
}
|
|
240
350
|
return {
|
|
241
|
-
includeExtensions: [...DEFAULT_INCLUDE_EXTENSIONS, ...
|
|
351
|
+
includeExtensions: [...DEFAULT_INCLUDE_EXTENSIONS, ...extraExtsInclude],
|
|
242
352
|
excludeDirs: [...DEFAULT_EXCLUDE_DIRS, ...extraDirs],
|
|
243
|
-
|
|
353
|
+
excludeExtensions: [...DEFAULT_EXCLUDE_EXTENSIONS, ...extraExtsExclude],
|
|
354
|
+
excludeFileNames: [...DEFAULT_EXCLUDE_FILE_NAMES, ...extraFileNames],
|
|
244
355
|
};
|
|
245
356
|
}
|
|
357
|
+
/**
|
|
358
|
+
* Case-insensitive path-exclude check. APFS (macOS) and NTFS (Windows) default
|
|
359
|
+
* to case-insensitive, so `Node_Modules/foo.ts` and `node_modules/foo.ts` refer
|
|
360
|
+
* to the same inode; the match must follow suit. PR #24 round-3 applied
|
|
361
|
+
* lowercasing to the agentic sandbox path but missed this eager-path mirror —
|
|
362
|
+
* PR #24 round-4 review (Gemini P1) closed that gap.
|
|
363
|
+
*/
|
|
246
364
|
export function isPathExcluded(relpath, config) {
|
|
365
|
+
const relLower = relpath.toLowerCase();
|
|
247
366
|
for (const dir of config.excludeDirs) {
|
|
248
|
-
|
|
367
|
+
const dirLower = dir.toLowerCase();
|
|
368
|
+
if (relLower === dirLower)
|
|
249
369
|
return true;
|
|
250
|
-
if (
|
|
370
|
+
if (relLower.startsWith(`${dirLower}/`))
|
|
251
371
|
return true;
|
|
252
|
-
if (
|
|
372
|
+
if (relLower.includes(`/${dirLower}/`))
|
|
253
373
|
return true;
|
|
254
374
|
}
|
|
255
375
|
return false;
|
|
256
376
|
}
|
|
377
|
+
/**
|
|
378
|
+
* Case-insensitive file-include check. Everything (filename vs each
|
|
379
|
+
* excludeFileName / excludeExtension / includeExtension) is compared
|
|
380
|
+
* lowercase-to-lowercase, same rationale as `isPathExcluded` above.
|
|
381
|
+
* Defaults already ship lowercase; user patterns may not, so we normalise
|
|
382
|
+
* on both sides on each call.
|
|
383
|
+
*/
|
|
257
384
|
export function isFileIncluded(relpath, config) {
|
|
258
385
|
if (isPathExcluded(relpath, config))
|
|
259
386
|
return false;
|
|
260
387
|
const filename = relpath.includes('/') ? relpath.slice(relpath.lastIndexOf('/') + 1) : relpath;
|
|
388
|
+
const filenameLower = filename.toLowerCase();
|
|
261
389
|
for (const excluded of config.excludeFileNames) {
|
|
262
|
-
if (
|
|
390
|
+
if (filenameLower === excluded.toLowerCase())
|
|
391
|
+
return false;
|
|
392
|
+
}
|
|
393
|
+
// Extension-based excludes run AFTER filename excludes (which are more
|
|
394
|
+
// specific) and BEFORE the include check. This ordering matters: an
|
|
395
|
+
// extension exclude must be able to veto a file that would otherwise
|
|
396
|
+
// match `includeExtensions` (e.g. `.tsbuildinfo` would be admitted by
|
|
397
|
+
// a caller who passed `includeGlobs: ['*.tsbuildinfo']` — the exclude
|
|
398
|
+
// still wins, matching the invariant already documented on
|
|
399
|
+
// `DEFAULT_EXCLUDE_DIRS`).
|
|
400
|
+
for (const ext of config.excludeExtensions) {
|
|
401
|
+
if (filenameLower.endsWith(ext.toLowerCase()))
|
|
263
402
|
return false;
|
|
264
403
|
}
|
|
265
404
|
for (const ext of config.includeExtensions) {
|
|
405
|
+
const extLower = ext.toLowerCase();
|
|
266
406
|
if (ext.startsWith('.')) {
|
|
267
|
-
if (
|
|
407
|
+
if (filenameLower.endsWith(extLower))
|
|
268
408
|
return true;
|
|
269
409
|
}
|
|
270
|
-
else if (
|
|
410
|
+
else if (filenameLower === extLower) {
|
|
271
411
|
return true;
|
|
272
412
|
}
|
|
273
413
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"globs.js","sourceRoot":"","sources":["../../src/indexer/globs.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,yEAAyE;AACzE,MAAM,CAAC,MAAM,0BAA0B,GAAsB;IAC3D,UAAU;IACV,KAAK;IACL,MAAM;IACN,KAAK;IACL,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,OAAO;IACP,MAAM;IACN,MAAM;IACN,OAAO;IACP,OAAO;IACP,OAAO;IACP,SAAS;IACT,MAAM;IACN,QAAQ;IACR,UAAU;IACV,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,OAAO;IACP,KAAK;IACL,MAAM;IACN,QAAQ;IACR,KAAK;IACL,KAAK;IACL,QAAQ;IACR,IAAI;IACJ,KAAK;IACL,MAAM;IACN,KAAK;IACL,MAAM;IACN,IAAI;IACJ,IAAI;IACJ,MAAM;IACN,KAAK;IACL,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,OAAO;IACP,KAAK;IACL,MAAM;IACN,MAAM;IACN,MAAM;IACN,gBAAgB;IAChB,OAAO;IACP,QAAQ;IACR,OAAO;IACP,MAAM;IACN,OAAO;IACP,MAAM;IACN,cAAc;IACd,MAAM;IACN,gBAAgB;IAChB,KAAK;IACL,OAAO;IACP,MAAM;IACN,OAAO;IACP,MAAM;IACN,MAAM;IACN,MAAM;IACN,YAAY;IACZ,UAAU;IACV,KAAK;IACL,KAAK;IACL,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B,WAAW;IACX,YAAY;IACZ,cAAc;IACd,aAAa;IACb,eAAe;IACf,WAAW;IACX,WAAW;IACX,yEAAyE;IACzE,QAAQ;IACR,SAAS;IACT,QAAQ;IACR,SAAS;IACT,kBAAkB;IAClB,aAAa,EAAE,4DAA4D;CAC5E,CAAC;
|
|
1
|
+
{"version":3,"file":"globs.js","sourceRoot":"","sources":["../../src/indexer/globs.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,yEAAyE;AACzE,MAAM,CAAC,MAAM,0BAA0B,GAAsB;IAC3D,UAAU;IACV,KAAK;IACL,MAAM;IACN,KAAK;IACL,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,OAAO;IACP,MAAM;IACN,MAAM;IACN,OAAO;IACP,OAAO;IACP,OAAO;IACP,SAAS;IACT,MAAM;IACN,QAAQ;IACR,UAAU;IACV,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,OAAO;IACP,KAAK;IACL,MAAM;IACN,QAAQ;IACR,KAAK;IACL,KAAK;IACL,QAAQ;IACR,IAAI;IACJ,KAAK;IACL,MAAM;IACN,KAAK;IACL,MAAM;IACN,IAAI;IACJ,IAAI;IACJ,MAAM;IACN,KAAK;IACL,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,OAAO;IACP,KAAK;IACL,MAAM;IACN,MAAM;IACN,MAAM;IACN,gBAAgB;IAChB,OAAO;IACP,QAAQ;IACR,OAAO;IACP,MAAM;IACN,OAAO;IACP,MAAM;IACN,cAAc;IACd,MAAM;IACN,gBAAgB;IAChB,KAAK;IACL,OAAO;IACP,MAAM;IACN,OAAO;IACP,MAAM;IACN,MAAM;IACN,MAAM;IACN,YAAY;IACZ,UAAU;IACV,KAAK;IACL,KAAK;IACL,MAAM;IACN,eAAe;IACf,KAAK;IACL,MAAM;IACN,MAAM;IACN,OAAO;IACP,MAAM;IACN,MAAM;IACN,MAAM;IACN,SAA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AuE;IACvE,oEAAoE;IACpE,qEAAqE;IACrE,sEAAsE;IACtE,sEAAsE;IACtE,2DAA2D;IAC3D,2BAA2B;IAC3B,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,iBAAiB,EAAE,CAAC;QAC3C,IAAI,aAAa,CAAC,QAAQ,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC;YAAE,OAAO,KAAK,CAAC;IAC9D,CAAC;IAED,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,iBAAiB,EAAE,CAAC;QAC3C,MAAM,QAAQ,GAAG,GAAG,CAAC,WAAW,EAAE,CAAC;QACnC,IAAI,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YACxB,IAAI,aAAa,CAAC,QAAQ,CAAC,QAAQ,CAAC;gBAAE,OAAO,IAAI,CAAC;QACpD,CAAC;aAAM,IAAI,aAAa,KAAK,QAAQ,EAAE,CAAC;YACtC,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Path-safety primitives for agentic workspace tools.
|
|
3
|
+
*
|
|
4
|
+
* The `ask_agentic` path exposes Gemini function calls that read arbitrary
|
|
5
|
+
* user-supplied paths. If the model (or a prompt-injected document) smuggles
|
|
6
|
+
* `../../.ssh/id_ed25519` or a symlink pointing outside the workspace, we
|
|
7
|
+
* must reject at every step — not only at schema validation.
|
|
8
|
+
*
|
|
9
|
+
* Two classes of defence:
|
|
10
|
+
* 1. **Structural jail** via `realpath` on BOTH the root and the target.
|
|
11
|
+
* Prevents symlink escape and `..` traversal. `path.resolve +
|
|
12
|
+
* startsWith(root)` is NOT safe — a symlink inside the root that points
|
|
13
|
+
* outside the root will lexically look fine but actually escape.
|
|
14
|
+
*
|
|
15
|
+
* 2. **Content denylist** — even inside the jail, refuse known secret-
|
|
16
|
+
* bearing filenames (`.env`, `*.pem`, `.ssh/*`, `credentials`…) and
|
|
17
|
+
* path fragments that match `DEFAULT_EXCLUDE_DIRS` (already covers
|
|
18
|
+
* `.aws`, `.kube`, `.gnupg`, etc.). Belt and suspenders.
|
|
19
|
+
*
|
|
20
|
+
* Codex PR #20 review #2 flagged that `resolve+startsWith` is symlink-
|
|
21
|
+
* unsafe. This module implements `realpath + root jail` per that feedback.
|
|
22
|
+
*/
|
|
23
|
+
export type SandboxErrorCode = 'PATH_TRAVERSAL' | 'SECRET_DENYLIST' | 'EXCLUDED_DIR' | 'EXCLUDED_FILENAME' | 'NON_SOURCE_FILE' | 'NOT_A_DIRECTORY' | 'NOT_FOUND' | 'NOT_INSIDE_ROOT' | 'INVALID_INPUT';
|
|
24
|
+
export declare class SandboxError extends Error {
|
|
25
|
+
readonly code: SandboxErrorCode;
|
|
26
|
+
readonly requestedPath: string;
|
|
27
|
+
constructor(code: SandboxErrorCode, message: string, requestedPath: string);
|
|
28
|
+
}
|
|
29
|
+
/** Absolute, real (symlink-resolved) path of `rootInput`. The caller must
|
|
30
|
+
* cache this value for the life of an agentic call so we avoid repeated
|
|
31
|
+
* `realpath` calls on the same root. */
|
|
32
|
+
export declare function resolveWorkspaceRoot(rootInput: string): Promise<string>;
|
|
33
|
+
/**
|
|
34
|
+
* Resolve `relOrAbs` to a real (symlink-resolved) absolute path, or throw
|
|
35
|
+
* `SandboxError` if it escapes the workspace or matches a denylist.
|
|
36
|
+
*
|
|
37
|
+
* Returns both the resolved absolute path and the POSIX relative path —
|
|
38
|
+
* callers need the absolute for FS operations and the relative for logging
|
|
39
|
+
* and response payloads. Relative path is always forward-slash form
|
|
40
|
+
* regardless of host OS.
|
|
41
|
+
*
|
|
42
|
+
* Missing-file policy: when the target path doesn't exist on disk, we
|
|
43
|
+
* still enforce the structural jail on the PARENT of the missing leaf so
|
|
44
|
+
* a request like `read_file(".ssh/id_ed25519")` fails with `PATH_TRAVERSAL`
|
|
45
|
+
* even if that specific file is absent. Without walking to a real parent
|
|
46
|
+
* we'd leak a `NOT_FOUND` error that confirms the path shape to an
|
|
47
|
+
* attacker — indirect enumeration signal. Acceptable trade-off: the
|
|
48
|
+
* missing-file error for a valid path inside the root still surfaces as
|
|
49
|
+
* `NOT_FOUND` once the parent resolves.
|
|
50
|
+
*/
|
|
51
|
+
export declare function resolveInsideWorkspace(workspaceRoot: string, relOrAbs: string): Promise<{
|
|
52
|
+
absolutePath: string;
|
|
53
|
+
relpath: string;
|
|
54
|
+
}>;
|
|
55
|
+
//# sourceMappingURL=sandbox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sandbox.d.ts","sourceRoot":"","sources":["../../../src/tools/agentic/sandbox.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAyDH,MAAM,MAAM,gBAAgB,GACxB,gBAAgB,GAChB,iBAAiB,GACjB,cAAc,GACd,mBAAmB,GACnB,iBAAiB,GACjB,iBAAiB,GACjB,WAAW,GACX,iBAAiB,GACjB,eAAe,CAAC;AAmDpB,qBAAa,YAAa,SAAQ,KAAK;IACrC,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAC;IAChC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;gBACnB,IAAI,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM;CAM3E;AAED;;wCAEwC;AACxC,wBAAsB,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAU7E;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,sBAAsB,CAC1C,aAAa,EAAE,MAAM,EACrB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC;IAAE,YAAY,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CA6IpD"}
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Path-safety primitives for agentic workspace tools.
|
|
3
|
+
*
|
|
4
|
+
* The `ask_agentic` path exposes Gemini function calls that read arbitrary
|
|
5
|
+
* user-supplied paths. If the model (or a prompt-injected document) smuggles
|
|
6
|
+
* `../../.ssh/id_ed25519` or a symlink pointing outside the workspace, we
|
|
7
|
+
* must reject at every step — not only at schema validation.
|
|
8
|
+
*
|
|
9
|
+
* Two classes of defence:
|
|
10
|
+
* 1. **Structural jail** via `realpath` on BOTH the root and the target.
|
|
11
|
+
* Prevents symlink escape and `..` traversal. `path.resolve +
|
|
12
|
+
* startsWith(root)` is NOT safe — a symlink inside the root that points
|
|
13
|
+
* outside the root will lexically look fine but actually escape.
|
|
14
|
+
*
|
|
15
|
+
* 2. **Content denylist** — even inside the jail, refuse known secret-
|
|
16
|
+
* bearing filenames (`.env`, `*.pem`, `.ssh/*`, `credentials`…) and
|
|
17
|
+
* path fragments that match `DEFAULT_EXCLUDE_DIRS` (already covers
|
|
18
|
+
* `.aws`, `.kube`, `.gnupg`, etc.). Belt and suspenders.
|
|
19
|
+
*
|
|
20
|
+
* Codex PR #20 review #2 flagged that `resolve+startsWith` is symlink-
|
|
21
|
+
* unsafe. This module implements `realpath + root jail` per that feedback.
|
|
22
|
+
*/
|
|
23
|
+
import { realpath } from 'node:fs/promises';
|
|
24
|
+
import { basename, sep as pathSep, relative, resolve } from 'node:path';
|
|
25
|
+
import { DEFAULT_EXCLUDE_DIRS, DEFAULT_EXCLUDE_FILE_NAMES_LOWER } from '../../indexer/globs.js';
|
|
26
|
+
/** Filename-basename entries that NEVER leak through `read_file`. Even when
|
|
27
|
+
* the path resolves safely under the workspace root, any of these basenames
|
|
28
|
+
* is a hard reject — protects against secrets dropped into the project by
|
|
29
|
+
* the user (`.env.local`) or by dev tooling (`credentials`).
|
|
30
|
+
*
|
|
31
|
+
* Stored in lowercase so the lookup set works on case-insensitive
|
|
32
|
+
* filesystems (macOS APFS, Windows NTFS) where `.ENV` resolves to the same
|
|
33
|
+
* file as `.env`. The `Set` below is built at load time. */
|
|
34
|
+
const AGENTIC_SECRET_BASENAMES = [
|
|
35
|
+
'.env',
|
|
36
|
+
'.env.local',
|
|
37
|
+
'.env.development',
|
|
38
|
+
'.env.production',
|
|
39
|
+
'.env.test',
|
|
40
|
+
'.env.staging',
|
|
41
|
+
'.netrc',
|
|
42
|
+
'.npmrc',
|
|
43
|
+
'.pgpass',
|
|
44
|
+
'.git-credentials',
|
|
45
|
+
'.htpasswd',
|
|
46
|
+
'credentials',
|
|
47
|
+
'credentials.json',
|
|
48
|
+
'secrets.json',
|
|
49
|
+
'secrets.yaml',
|
|
50
|
+
'secrets.yml',
|
|
51
|
+
'service-account.json',
|
|
52
|
+
];
|
|
53
|
+
/** Lowercased `Set` for O(1) case-insensitive basename denylist lookup. */
|
|
54
|
+
const AGENTIC_SECRET_BASENAMES_LOWER = new Set(AGENTIC_SECRET_BASENAMES.map((s) => s.toLowerCase()));
|
|
55
|
+
/** Extensions that frequently carry sensitive key material. Extra gate on
|
|
56
|
+
* top of `AGENTIC_SECRET_BASENAMES`. Matched via `endsWith(lowerBase, ext)`. */
|
|
57
|
+
const AGENTIC_SECRET_EXTENSIONS = [
|
|
58
|
+
'.pem',
|
|
59
|
+
'.key',
|
|
60
|
+
'.crt',
|
|
61
|
+
'.cer',
|
|
62
|
+
'.p12',
|
|
63
|
+
'.pfx',
|
|
64
|
+
'.p8',
|
|
65
|
+
'.asc',
|
|
66
|
+
'.gpg',
|
|
67
|
+
'.keystore',
|
|
68
|
+
'.jks',
|
|
69
|
+
'.ppk',
|
|
70
|
+
'.ovpn',
|
|
71
|
+
];
|
|
72
|
+
/**
|
|
73
|
+
* Directories that carry sensitive material and should trip the
|
|
74
|
+
* `SECRET_DENYLIST` error code (not the generic `EXCLUDED_DIR`). The
|
|
75
|
+
* distinction matters for observability: a downstream audit log tracing
|
|
76
|
+
* "model tried to read secrets" vs. "model tried to read a generated
|
|
77
|
+
* dist file" can filter on the error code. Functionally both are
|
|
78
|
+
* rejected, so security posture is identical.
|
|
79
|
+
*
|
|
80
|
+
* Introduced in PR #24 round-3 self-review finding #7.
|
|
81
|
+
*/
|
|
82
|
+
const SECRET_EXCLUDE_DIRS = new Set([
|
|
83
|
+
'.ssh',
|
|
84
|
+
'.aws',
|
|
85
|
+
'.gnupg',
|
|
86
|
+
'.gpg',
|
|
87
|
+
'.kube',
|
|
88
|
+
'.docker',
|
|
89
|
+
'.1password',
|
|
90
|
+
'.pki',
|
|
91
|
+
'.gcloud',
|
|
92
|
+
'.azure',
|
|
93
|
+
'.config/gcloud',
|
|
94
|
+
'.config/azure',
|
|
95
|
+
'Keychains',
|
|
96
|
+
].map((s) => s.toLowerCase()));
|
|
97
|
+
// ---------------------------------------------------------------------------
|
|
98
|
+
// Path-compare helpers (declared at the top of the file so no function is
|
|
99
|
+
// referenced before its declaration in source order — a defensive tidy-up
|
|
100
|
+
// after PR #24 round-3 review flagged the hoisting-dependent layout. JS
|
|
101
|
+
// `function` declarations are hoisted to the enclosing scope, so the
|
|
102
|
+
// previous order worked at runtime — but a future refactor replacing
|
|
103
|
+
// `function` with `const arrow` would introduce a TDZ crash. Putting them
|
|
104
|
+
// BEFORE `resolveInsideWorkspace` removes that footgun.
|
|
105
|
+
// ---------------------------------------------------------------------------
|
|
106
|
+
function isInside(root, candidate) {
|
|
107
|
+
if (candidate === root)
|
|
108
|
+
return true;
|
|
109
|
+
// Compare with the native separator so Windows behaves correctly; the
|
|
110
|
+
// caller's relpath is converted to POSIX *after* this structural check.
|
|
111
|
+
return candidate.startsWith(`${root}${pathSep}`);
|
|
112
|
+
}
|
|
113
|
+
function toPosix(p) {
|
|
114
|
+
return pathSep === '/' ? p : p.split(pathSep).join('/');
|
|
115
|
+
}
|
|
116
|
+
export class SandboxError extends Error {
|
|
117
|
+
code;
|
|
118
|
+
requestedPath;
|
|
119
|
+
constructor(code, message, requestedPath) {
|
|
120
|
+
super(message);
|
|
121
|
+
this.name = 'SandboxError';
|
|
122
|
+
this.code = code;
|
|
123
|
+
this.requestedPath = requestedPath;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
/** Absolute, real (symlink-resolved) path of `rootInput`. The caller must
|
|
127
|
+
* cache this value for the life of an agentic call so we avoid repeated
|
|
128
|
+
* `realpath` calls on the same root. */
|
|
129
|
+
export async function resolveWorkspaceRoot(rootInput) {
|
|
130
|
+
try {
|
|
131
|
+
return await realpath(resolve(rootInput));
|
|
132
|
+
}
|
|
133
|
+
catch (err) {
|
|
134
|
+
throw new SandboxError('NOT_FOUND', `workspace root does not exist or is unreadable: ${rootInput} (${String(err)})`, rootInput);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Resolve `relOrAbs` to a real (symlink-resolved) absolute path, or throw
|
|
139
|
+
* `SandboxError` if it escapes the workspace or matches a denylist.
|
|
140
|
+
*
|
|
141
|
+
* Returns both the resolved absolute path and the POSIX relative path —
|
|
142
|
+
* callers need the absolute for FS operations and the relative for logging
|
|
143
|
+
* and response payloads. Relative path is always forward-slash form
|
|
144
|
+
* regardless of host OS.
|
|
145
|
+
*
|
|
146
|
+
* Missing-file policy: when the target path doesn't exist on disk, we
|
|
147
|
+
* still enforce the structural jail on the PARENT of the missing leaf so
|
|
148
|
+
* a request like `read_file(".ssh/id_ed25519")` fails with `PATH_TRAVERSAL`
|
|
149
|
+
* even if that specific file is absent. Without walking to a real parent
|
|
150
|
+
* we'd leak a `NOT_FOUND` error that confirms the path shape to an
|
|
151
|
+
* attacker — indirect enumeration signal. Acceptable trade-off: the
|
|
152
|
+
* missing-file error for a valid path inside the root still surfaces as
|
|
153
|
+
* `NOT_FOUND` once the parent resolves.
|
|
154
|
+
*/
|
|
155
|
+
export async function resolveInsideWorkspace(workspaceRoot, relOrAbs) {
|
|
156
|
+
if (typeof relOrAbs !== 'string' || relOrAbs.length === 0) {
|
|
157
|
+
throw new SandboxError('PATH_TRAVERSAL', 'path argument is empty', relOrAbs);
|
|
158
|
+
}
|
|
159
|
+
// Empty after normalisation (only whitespace) → reject.
|
|
160
|
+
const cleaned = relOrAbs.trim();
|
|
161
|
+
if (cleaned.length === 0) {
|
|
162
|
+
throw new SandboxError('PATH_TRAVERSAL', 'path argument is whitespace only', relOrAbs);
|
|
163
|
+
}
|
|
164
|
+
const candidate = resolve(workspaceRoot, cleaned);
|
|
165
|
+
// First pass: try to realpath the target. If it exists, we get a canonical
|
|
166
|
+
// symlink-resolved form. If not, walk up to the nearest existing parent
|
|
167
|
+
// and realpath that — so we detect escapes through symlinks that exist
|
|
168
|
+
// even if the leaf does not.
|
|
169
|
+
let resolved;
|
|
170
|
+
try {
|
|
171
|
+
resolved = await realpath(candidate);
|
|
172
|
+
}
|
|
173
|
+
catch {
|
|
174
|
+
// Target doesn't exist (yet). Walk to nearest existing ancestor so we
|
|
175
|
+
// can still assert "the parent is inside the workspace". This avoids
|
|
176
|
+
// leaking "file not found" for paths that are structurally illegal.
|
|
177
|
+
let parent = candidate;
|
|
178
|
+
let existingAncestor = null;
|
|
179
|
+
while (true) {
|
|
180
|
+
const next = resolve(parent, '..');
|
|
181
|
+
if (next === parent)
|
|
182
|
+
break; // hit filesystem root
|
|
183
|
+
parent = next;
|
|
184
|
+
try {
|
|
185
|
+
existingAncestor = await realpath(parent);
|
|
186
|
+
break;
|
|
187
|
+
}
|
|
188
|
+
catch {
|
|
189
|
+
/* keep walking */
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
if (existingAncestor === null) {
|
|
193
|
+
throw new SandboxError('NOT_FOUND', `path has no existing ancestor: ${relOrAbs}`, relOrAbs);
|
|
194
|
+
}
|
|
195
|
+
// Assert the existing ancestor is inside the jail. If YES, the missing
|
|
196
|
+
// leaf is legitimately absent inside the workspace; we return a
|
|
197
|
+
// `NOT_FOUND`. If NO, the request was trying to escape via a path
|
|
198
|
+
// whose leaf doesn't exist — treat as traversal.
|
|
199
|
+
if (!isInside(workspaceRoot, existingAncestor)) {
|
|
200
|
+
throw new SandboxError('PATH_TRAVERSAL', `path escapes workspace root: ${relOrAbs}`, relOrAbs);
|
|
201
|
+
}
|
|
202
|
+
throw new SandboxError('NOT_FOUND', `path does not exist: ${relOrAbs}`, relOrAbs);
|
|
203
|
+
}
|
|
204
|
+
// realpath succeeded — enforce jail on the RESOLVED path so symlinks are caught.
|
|
205
|
+
if (!isInside(workspaceRoot, resolved)) {
|
|
206
|
+
throw new SandboxError('PATH_TRAVERSAL', `path escapes workspace root (symlink or absolute outside): ${relOrAbs}`, relOrAbs);
|
|
207
|
+
}
|
|
208
|
+
const rel = toPosix(relative(workspaceRoot, resolved));
|
|
209
|
+
// Content denylist (Codex #4): secrets-by-basename + extension.
|
|
210
|
+
// Both checks are case-insensitive — macOS/APFS and Windows/NTFS are
|
|
211
|
+
// case-insensitive by default, so `.ENV` resolves to the same inode as
|
|
212
|
+
// `.env`. Comparing pre-lowercased protects against a file literally
|
|
213
|
+
// stored as `.ENV` (or `.Env.Local`, `CREDENTIALS`, …) bypassing the
|
|
214
|
+
// list. Extension check was already case-insensitive; basename check
|
|
215
|
+
// used to be strict-equal — bug reported in PR #24 review by Gemini.
|
|
216
|
+
const base = basename(resolved);
|
|
217
|
+
const lowerBase = base.toLowerCase();
|
|
218
|
+
if (AGENTIC_SECRET_BASENAMES_LOWER.has(lowerBase)) {
|
|
219
|
+
throw new SandboxError('SECRET_DENYLIST', `filename on secret-basename denylist: ${base}`, relOrAbs);
|
|
220
|
+
}
|
|
221
|
+
for (const ext of AGENTIC_SECRET_EXTENSIONS) {
|
|
222
|
+
if (lowerBase.endsWith(ext)) {
|
|
223
|
+
throw new SandboxError('SECRET_DENYLIST', `filename on secret-extension denylist: ${base}`, relOrAbs);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
// Excluded-dir check: if the POSIX relative path sits under any entry in
|
|
227
|
+
// `DEFAULT_EXCLUDE_DIRS`, refuse. Same semantics as `globs.ts#isPathExcluded`
|
|
228
|
+
// but we reuse the table rather than the function to skip the MatchConfig
|
|
229
|
+
// plumbing (we already know we're inside the jail, so only dir-name
|
|
230
|
+
// matching matters here).
|
|
231
|
+
//
|
|
232
|
+
// Case-insensitive matching (PR #24 round-3 #2): we compare against the
|
|
233
|
+
// lowercased relative path + lowercased dir entries so macOS APFS /
|
|
234
|
+
// Windows NTFS (case-insensitive by default) don't let a file named
|
|
235
|
+
// `NODE_MODULES/foo.js` slip past a strict-case check.
|
|
236
|
+
//
|
|
237
|
+
// `SECRET_EXCLUDE_DIRS` wins before the generic list so `.ssh/id_ed25519`
|
|
238
|
+
// yields `SECRET_DENYLIST` (not `EXCLUDED_DIR`) — distinguishes "user
|
|
239
|
+
// tried to exfiltrate" from "this dir is just boring build output" in
|
|
240
|
+
// observability. Functionally both are blocked.
|
|
241
|
+
const relLower = rel.toLowerCase();
|
|
242
|
+
for (const dir of DEFAULT_EXCLUDE_DIRS) {
|
|
243
|
+
const dirLower = dir.toLowerCase();
|
|
244
|
+
const isHit = relLower === dirLower ||
|
|
245
|
+
relLower.startsWith(`${dirLower}/`) ||
|
|
246
|
+
relLower.includes(`/${dirLower}/`);
|
|
247
|
+
if (!isHit)
|
|
248
|
+
continue;
|
|
249
|
+
const code = SECRET_EXCLUDE_DIRS.has(dirLower)
|
|
250
|
+
? 'SECRET_DENYLIST'
|
|
251
|
+
: 'EXCLUDED_DIR';
|
|
252
|
+
const detail = code === 'SECRET_DENYLIST'
|
|
253
|
+
? `path is inside a secret-bearing directory: ${dir}`
|
|
254
|
+
: relLower === dirLower
|
|
255
|
+
? `path is an excluded directory: ${dir}`
|
|
256
|
+
: `path is inside excluded directory: ${dir}`;
|
|
257
|
+
throw new SandboxError(code, detail, relOrAbs);
|
|
258
|
+
}
|
|
259
|
+
// And one more pass over DEFAULT_EXCLUDE_FILE_NAMES — lockfiles,
|
|
260
|
+
// tsconfig.tsbuildinfo, etc. — they were uninteresting even in the
|
|
261
|
+
// eager path, and definitely shouldn't cost agentic iterations.
|
|
262
|
+
// Uses the lowercased `Set` so mis-cased files (e.g. `PACKAGE-LOCK.JSON`
|
|
263
|
+
// on case-insensitive FS) still match. Uses `EXCLUDED_FILENAME`
|
|
264
|
+
// (distinct from `EXCLUDED_DIR`) so the calling model can tell
|
|
265
|
+
// "this is a blacklisted filename" from "this is a blacklisted
|
|
266
|
+
// directory" in the `functionResponse.error` payload.
|
|
267
|
+
if (DEFAULT_EXCLUDE_FILE_NAMES_LOWER.has(lowerBase)) {
|
|
268
|
+
throw new SandboxError('EXCLUDED_FILENAME', `filename on default exclude list: ${base}`, relOrAbs);
|
|
269
|
+
}
|
|
270
|
+
return { absolutePath: resolved, relpath: rel };
|
|
271
|
+
}
|
|
272
|
+
//# sourceMappingURL=sandbox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sandbox.js","sourceRoot":"","sources":["../../../src/tools/agentic/sandbox.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,GAAG,IAAI,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACxE,OAAO,EAAE,oBAAoB,EAAE,gCAAgC,EAAE,MAAM,wBAAwB,CAAC;AAEhG;;;;;;;4DAO4D;AAC5D,MAAM,wBAAwB,GAAsB;IAClD,MAAM;IACN,YAAY;IACZ,kBAAkB;IAClB,iBAAiB;IACjB,WAAW;IACX,cAAc;IACd,QAAQ;IACR,QAAQ;IACR,SAAS;IACT,kBAAkB;IAClB,WAAW;IACX,aAAa;IACb,kBAAkB;IAClB,cAAc;IACd,cAAc;IACd,aAAa;IACb,sBAAsB;CACvB,CAAC;AAEF,2EAA2E;AAC3E,MAAM,8BAA8B,GAAwB,IAAI,GAAG,CACjE,wBAAwB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CACrD,CAAC;AAEF;gFACgF;AAChF,MAAM,yBAAyB,G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