pi-context-engine 0.5.2 → 0.5.3

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/README.md CHANGED
@@ -109,7 +109,10 @@ unchanged repo took 237 ms.
109
109
  not add a full directory scan. Periodic yields keep the check responsive.
110
110
  This prevents an accidental parent-directory
111
111
  session from starting an unrequested multi-minute workload. `/context-index`
112
- remains available as an explicit manual build.
112
+ remains available as an explicit manual build. While the pause is active,
113
+ every `context_search` result carries a stale-note and `/context-status`
114
+ leads with the pause line, so outdated results are never served silently;
115
+ all messages name the config file that raises the limit.
113
116
  - **Resume after interruption**: the manifest checkpoints completed batches,
114
117
  starting with the first batch and then at most once every five seconds. An
115
118
  interrupted build can skip completed files instead of starting from zero.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-context-engine",
3
- "version": "0.5.2",
3
+ "version": "0.5.3",
4
4
  "description": "Semantic code context for pi: tree-sitter index + hybrid vector/BM25 retrieval + cross-session memory, all local. Port of code-context-engine (MIT, elara-labs) as a native pi extension.",
5
5
  "keywords": [
6
6
  "pi-package",
package/src/extension.ts CHANGED
@@ -26,6 +26,26 @@ const CAPTURED_TOOLS = new Set(["bash", "read", "edit", "write", "grep", "find",
26
26
  const AUTO_INDEX_DELAY_MS = 2000;
27
27
 
28
28
  export default function contextEngineExtension(pi: ExtensionAPI) {
29
+ const MAX_AUTO_FILES_HINT =
30
+ "raise indexer.max_auto_files (~/.pi-context-engine/config.yaml or the project's .context-engine.yaml)";
31
+
32
+ /** One-line pause notice for /context-status and the index_status tool: the
33
+ * most likely question there is "why is my index not updating?" */
34
+ const pauseNotice = (): string | null =>
35
+ automaticIndexBlock
36
+ ? `Automatic indexing paused: workspace exceeds ${automaticIndexBlock.limit.toLocaleString()} indexable files — the index may be stale. ` +
37
+ `Run /context-index, or ${MAX_AUTO_FILES_HINT}.`
38
+ : null;
39
+
40
+ /** Bracket note appended to every context_search result while the pause is
41
+ * active and a (possibly outdated) index is served. Without it the agent
42
+ * cannot tell fresh results from stale ones. */
43
+ const staleIndexNote = (): string | null =>
44
+ automaticIndexBlock
45
+ ? `[note: automatic indexing is paused — workspace exceeds ${automaticIndexBlock.limit.toLocaleString()} indexable files; these results may be stale. ` +
46
+ `Run /context-index, or ${MAX_AUTO_FILES_HINT} to refresh]`
47
+ : null;
48
+
29
49
  let engine: ContextEngine | null = null;
30
50
  let currentCwd = process.cwd();
31
51
  let promptNumber = 0;
@@ -114,7 +134,7 @@ export default function contextEngineExtension(pi: ExtensionAPI) {
114
134
  notify?.(
115
135
  `Context index: automatic indexing${eng.config.indexerWatch ? " and watcher" : ""} paused. ` +
116
136
  `Workspace exceeds ${err.limit.toLocaleString()} indexable files. ` +
117
- "Run /context-index to index anyway, or raise indexer.max_auto_files.",
137
+ `Run /context-index to index anyway, or ${MAX_AUTO_FILES_HINT}.`,
118
138
  "warning",
119
139
  );
120
140
  };
@@ -267,7 +287,7 @@ export default function contextEngineExtension(pi: ExtensionAPI) {
267
287
  return text(
268
288
  `Automatic indexing is paused for ${eng.projectName}: the workspace exceeds ` +
269
289
  `${automaticIndexBlock.limit.toLocaleString()} indexable files. ` +
270
- "Run /context-index to index manually, or raise indexer.max_auto_files.",
290
+ `Run /context-index to index manually, or ${MAX_AUTO_FILES_HINT}.`,
271
291
  );
272
292
  }
273
293
  if (indexInFlight) {
@@ -293,6 +313,8 @@ export default function contextEngineExtension(pi: ExtensionAPI) {
293
313
  let body = result.body;
294
314
  const nudge = eng.buildNudge();
295
315
  if (nudge) body += nudge;
316
+ const stale = staleIndexNote();
317
+ if (stale) body += `\n${stale}`;
296
318
  if (result.droppedLowValue > 0) {
297
319
  body +=
298
320
  "\n[note: lower-confidence results omitted — lower retrieval.marginal_ratio or retrieval.confidence_threshold to include them]";
@@ -431,7 +453,9 @@ export default function contextEngineExtension(pi: ExtensionAPI) {
431
453
  description: "Check index health, chunk count, and token savings for this project.",
432
454
  parameters: Type.Object({}),
433
455
  async execute(_toolCallId, _params, _signal, _onUpdate, ctx) {
434
- return text(await getEngine(ctx.cwd).statusText());
456
+ const status = await getEngine(ctx.cwd).statusText();
457
+ const pause = pauseNotice();
458
+ return text(pause ? `${pause}\n${status}` : status);
435
459
  },
436
460
  });
437
461
 
@@ -488,7 +512,9 @@ export default function contextEngineExtension(pi: ExtensionAPI) {
488
512
  pi.registerCommand("context-status", {
489
513
  description: "Show index health and token savings for this project",
490
514
  handler: async (_args, ctx) => {
491
- ctx.ui.notify(await getEngine(ctx.cwd).statusText(), "info");
515
+ const status = await getEngine(ctx.cwd).statusText();
516
+ const pause = pauseNotice();
517
+ ctx.ui.notify(pause ? `${pause}\n${status}` : status, "info");
492
518
  },
493
519
  });
494
520