@sanity-labs/nuum 0.5.4 → 0.5.5

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 (2) hide show
  1. package/dist/index.js +28 -19
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -23485,26 +23485,33 @@ function createLTMStorage(db) {
23485
23485
  }
23486
23486
  return matches.sort((a, b) => (b.score ?? 0) - (a.score ?? 0));
23487
23487
  },
23488
- async searchFTS(query, limit = 20) {
23488
+ async searchFTS(query, options = {}) {
23489
+ const { limit = 20, pathPrefix } = options;
23489
23490
  const words = query.split(/\s+/).filter((w) => w.length > 0).map((w) => `"${w.replace(/"/g, '""')}"`).join(" OR ");
23490
23491
  if (!words) {
23491
23492
  return [];
23492
23493
  }
23494
+ const pathFilter = pathPrefix ? `AND e.path LIKE ? || '%'` : "";
23495
+ const params = pathPrefix ? [words, pathPrefix, limit] : [words, limit];
23493
23496
  const results = await db._rawDb.prepare(`
23494
23497
  SELECT
23495
- slug,
23496
- title,
23498
+ fts.slug,
23499
+ fts.title,
23500
+ e.path,
23497
23501
  snippet(ltm_entries_fts, 2, '>>>', '<<<', '...', 32) as snippet,
23498
- rank
23499
- FROM ltm_entries_fts
23502
+ fts.rank
23503
+ FROM ltm_entries_fts fts
23504
+ JOIN ltm_entries e ON e.slug = fts.slug
23500
23505
  WHERE ltm_entries_fts MATCH ?
23501
- AND slug IN (SELECT slug FROM ltm_entries WHERE archived_at IS NULL)
23502
- ORDER BY rank
23506
+ AND e.archived_at IS NULL
23507
+ ${pathFilter}
23508
+ ORDER BY fts.rank
23503
23509
  LIMIT ?
23504
- `).all(words, limit);
23510
+ `).all(...params);
23505
23511
  return results.map((r) => ({
23506
23512
  slug: r.slug,
23507
23513
  title: r.title,
23514
+ path: r.path,
23508
23515
  snippet: r.snippet,
23509
23516
  rank: r.rank
23510
23517
  }));
@@ -35844,7 +35851,7 @@ async function runAgentLoop(options) {
35844
35851
  if (hadInvalidCalls) {
35845
35852
  messages.push({
35846
35853
  role: "user",
35847
- content: "[SYSTEM: Your previous output was truncated because it exceeded the output token limit. " + "Your tool call was incomplete \u2014 parameters were cut off mid-generation. " + "To fix this: break large content into smaller chunks, or use bash with echo/cat to write files incrementally. " + "Do NOT retry the same large tool call \u2014 it will truncate again.]"
35854
+ content: "[SYSTEM: Your previous output was truncated because it exceeded the output token limit. " + "Your tool call was incomplete \u2014 parameters were cut off mid-generation. " + "To fix this: break large content into multiple smaller write calls, or use bash to write incrementally. " + "Do NOT retry the same large tool call \u2014 it will truncate again.]"
35848
35855
  });
35849
35856
  }
35850
35857
  }
@@ -45404,8 +45411,8 @@ var Mcp;
45404
45411
  })(Mcp ||= {});
45405
45412
 
45406
45413
  // src/version.ts
45407
- var VERSION = "0.5.4";
45408
- var GIT_HASH = "e1f89a6";
45414
+ var VERSION = "0.5.5";
45415
+ var GIT_HASH = "9c9c471";
45409
45416
  var VERSION_STRING = `nuum v${VERSION} (${GIT_HASH})`;
45410
45417
 
45411
45418
  // src/tool/mcp-status.ts
@@ -45610,24 +45617,26 @@ Returns: [{ slug, title, path, snippet }, ...] ranked by relevance`,
45610
45617
  async execute(args, ctx) {
45611
45618
  const { ltm } = ctx.extra;
45612
45619
  const { query, path: path9, limit } = args;
45613
- const results = await ltm.search(query, path9);
45614
- const limited = results.slice(0, limit ?? 10);
45620
+ const results = await ltm.searchFTS(query, {
45621
+ limit: limit ?? 10,
45622
+ pathPrefix: path9
45623
+ });
45615
45624
  ctx.metadata({
45616
45625
  title: `ltm_search("${query}")`,
45617
45626
  metadata: { operation: "search" }
45618
45627
  });
45619
- if (limited.length === 0) {
45628
+ if (results.length === 0) {
45620
45629
  return {
45621
45630
  title: `ltm_search("${query}")`,
45622
45631
  metadata: { operation: "search" },
45623
45632
  output: `No entries found matching "${query}"`
45624
45633
  };
45625
45634
  }
45626
- const formatted = limited.map((r) => ({
45627
- slug: r.entry.slug,
45628
- title: r.entry.title,
45629
- path: r.entry.path,
45630
- snippet: r.entry.body.slice(0, 150) + (r.entry.body.length > 150 ? "..." : "")
45635
+ const formatted = results.map((r) => ({
45636
+ slug: r.slug,
45637
+ title: r.title,
45638
+ path: r.path,
45639
+ snippet: r.snippet
45631
45640
  }));
45632
45641
  return {
45633
45642
  title: `ltm_search("${query}")`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity-labs/nuum",
3
- "version": "0.5.4",
3
+ "version": "0.5.5",
4
4
  "description": "AI coding agent with continuous memory - infinite context across sessions",
5
5
  "type": "module",
6
6
  "bin": {