@cad0p/pi-napkin 0.7.1 → 0.7.2

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.
@@ -188,9 +188,17 @@ function getOverview(n: Napkin): { text: string; root: string } | null {
188
188
  const overview = n.overview();
189
189
  if (!overview) return null;
190
190
 
191
- let text = overview.context || "";
191
+ // The tags delimit the injected blocks so the provider's merge of
192
+ // consecutive user-role turns keeps vault context distinguishable from
193
+ // the user's actual message. Constant tag text keeps the prompt-cache
194
+ // prefix stable.
195
+ const blocks: string[] = [];
196
+ const context = overview.context?.trim();
197
+ if (context) {
198
+ blocks.push(`<napkin-context>\n${context}\n</napkin-context>`);
199
+ }
192
200
  if (overview.overview && overview.overview.length > 0) {
193
- text += "\n\n";
201
+ let listing = "";
194
202
  for (const folder of overview.overview) {
195
203
  const collapsed = folder.collapsedFolders
196
204
  ? ` (+${folder.collapsedFolders} similar subfolders)`
@@ -198,19 +206,22 @@ function getOverview(n: Napkin): { text: string; root: string } | null {
198
206
  // The SDK reports the vault root as "/"; the CLI renders it as
199
207
  // "./". Mirror that here — "//" looked like a broken path.
200
208
  const path = folder.path === "/" ? "." : folder.path;
201
- text += `${path}/${collapsed}\n`;
209
+ listing += `${path}/${collapsed}\n`;
202
210
  if (folder.keywords && folder.keywords.length > 0) {
203
- text += ` keywords: ${folder.keywords.join(", ")}\n`;
211
+ listing += ` keywords: ${folder.keywords.join(", ")}\n`;
204
212
  }
205
- text += ` notes: ${folder.notes}\n`;
213
+ listing += ` notes: ${folder.notes}\n`;
206
214
  }
207
215
  if (overview.truncated) {
208
216
  // maxRows cap in the SDK dropped the tail of the sorted listing;
209
217
  // tell the agent the vault is bigger than what's shown.
210
- text += `\n… ${overview.truncated.rows} more folders (${overview.truncated.notes} notes) — use kb_search to find specific content\n`;
218
+ listing += `\n… ${overview.truncated.rows} more folders (${overview.truncated.notes} notes) — use kb_search to find specific content\n`;
211
219
  }
220
+ blocks.push(
221
+ `<napkin-overview>\n${listing.trimEnd()}\n</napkin-overview>`,
222
+ );
212
223
  }
213
- const body = text.trim();
224
+ const body = blocks.join("\n\n").trim();
214
225
  if (!body) return null;
215
226
  return { text: body, root: overview.root };
216
227
  } catch {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cad0p/pi-napkin",
3
- "version": "0.7.1",
3
+ "version": "0.7.2",
4
4
  "description": "📜 Napkin integration for pi — vault context, knowledge tools, and automatic distillation with git-worktree concurrency safety",
5
5
  "type": "module",
6
6
  "exports": {