@dotdotgod/context 0.3.11 → 0.3.12

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dotdotgod/context",
3
- "version": "0.3.11",
3
+ "version": "0.3.12",
4
4
  "description": "Local-first MCP execution, indexing, and retrieval runtime for dotdotgod adapters.",
5
5
  "type": "module",
6
6
  "license": "Elastic-2.0",
@@ -28,7 +28,7 @@
28
28
  "dependencies": {
29
29
  "@modelcontextprotocol/sdk": "^1.25.2",
30
30
  "zod": "^3.25.76",
31
- "@dotdotgod/cli": "0.3.11"
31
+ "@dotdotgod/cli": "0.3.12"
32
32
  },
33
33
  "engines": {
34
34
  "node": ">=22.5.0"
package/src/server.mjs CHANGED
@@ -60,7 +60,7 @@ register('index', 'Index a local text file or bounded directory into the project
60
60
  includeExtensions: z.array(z.string()).max(100).optional(), excludePaths: z.array(z.string()).max(500).optional(), followFileSymlinks: z.boolean().optional(),
61
61
  maxDepth: z.number().int().nonnegative().optional(), maxVisitedEntries: z.number().int().nonnegative().optional(), maxFiles: z.number().int().nonnegative().optional(), maxAggregateBytes: z.number().int().nonnegative().optional(),
62
62
  }, (input, extra) => ({ ok: true, ...indexFile(getStore(), { ...input, root }, sessionId, extra.signal) }), { readOnlyHint: true });
63
- register('search', 'Search indexed command, file, and fetched content and return bounded excerpts.', {
63
+ register('search', 'Search indexed content for bounded excerpts. For failure diagnostics try fail OR error OR reason. Query * browses bounded excerpts with the same source/scope/session filters and limit; neither no matches nor partial excerpts prove diagnostics are absent.', {
64
64
  query: z.string().min(1), scope: scopeSchema, source: z.string().optional(), limit: z.number().int().min(1).max(50).optional(), sessionOnly: z.boolean().optional(),
65
65
  }, (input) => ({
66
66
  ok: true,
package/src/store.mjs CHANGED
@@ -246,7 +246,13 @@ export class ContextStore {
246
246
  if (source) { filters.push('(s.id = ? OR s.label LIKE ?)'); filterParams.push(source, `%${source}%`); }
247
247
  const filterSql = filters.length ? ` AND ${filters.join(' AND ')}` : '';
248
248
  const select = 'SELECT c.source_id, c.ordinal, c.body, s.label, s.kind, s.scope, s.metadata';
249
- const porterRows = this.db.prepare(`
249
+ const wildcard = String(query ?? '').trim() === '*';
250
+ const porterRows = wildcard ? this.db.prepare(`
251
+ ${select}, 0 AS rank
252
+ FROM chunks c JOIN sources s ON s.id = c.source_id
253
+ WHERE 1 = 1${filterSql}
254
+ ORDER BY s.created_at DESC, s.id, c.ordinal LIMIT ?
255
+ `).all(...filterParams, candidateLimit) : this.db.prepare(`
250
256
  ${select}, bm25(chunks) AS rank
251
257
  FROM chunks c JOIN sources s ON s.id = c.source_id
252
258
  WHERE chunks MATCH ?${filterSql}
@@ -265,7 +271,7 @@ export class ContextStore {
265
271
  `).all(...labelParams, ...filterParams, candidateLimit);
266
272
  const typoWindow = Math.min(500, candidateLimit * 5);
267
273
  const typoHalf = Math.max(1, Math.floor(typoWindow / 2));
268
- const trigramRows = this.db.prepare(`
274
+ const trigramRows = wildcard ? [] : this.db.prepare(`
269
275
  SELECT * FROM (
270
276
  SELECT ${select.replace('SELECT ', '')}, 0 AS rank
271
277
  FROM chunks c JOIN sources s ON s.id = c.source_id
@@ -290,7 +296,7 @@ export class ContextStore {
290
296
  return { sourceId: row.source_id, ordinal: Number(row.ordinal), body: row.body, label: row.label, kind: row.kind, scope: row.scope, rank: row.rank, metadata: readProvenanceMetadata(storedMetadata) };
291
297
  };
292
298
  const fused = reciprocalRankFusion([
293
- { name: 'porter-bm25', candidates: porterRows.map(toCandidate) },
299
+ { name: wildcard ? 'bounded-browse' : 'porter-bm25', candidates: porterRows.map(toCandidate) },
294
300
  { name: 'label-path', candidates: labelRows.map(toCandidate) },
295
301
  { name: 'trigram-v1', candidates: trigramRows.map(toCandidate) },
296
302
  ], { limit: candidateLimit });
@@ -303,7 +309,7 @@ export class ContextStore {
303
309
  scope: row.scope,
304
310
  ordinal: row.ordinal,
305
311
  rank: row.rank,
306
- text: excerpt(row.body, query),
312
+ text: excerpt(row.body, wildcard ? '' : query),
307
313
  metadata: row.metadata,
308
314
  trust: row.metadata.trust,
309
315
  sourceType: row.metadata.sourceType,