@henryqw/pi-session-recall 4.0.2 → 4.0.4

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
@@ -90,7 +90,7 @@ Available inventory includes this provenance:
90
90
  }
91
91
  ```
92
92
 
93
- It also sets `worktreeVerified:false`. Staged adds, changes, and deletes affect the snapshot. Unstaged changes, deletions, mode changes, symlinks, and untracked files do not. Inspect current candidate files before assigning ownership; abstain if targeted current-file checks cannot be done safely.
93
+ It also sets `worktreeVerified:false`. Staged adds, changes, and deletes affect the Git-index collections. Unstaged changes, deletions, mode changes, symlinks, and untracked files do not affect those collections. Skills come from Pi's effective registry and can include untracked files. Inspect current candidate files before assigning ownership; abstain if targeted current-file checks cannot be done safely.
94
94
 
95
95
  ## Flow
96
96
 
@@ -100,6 +100,7 @@ Search makes no model calls.
100
100
 
101
101
  ### Query and index
102
102
 
103
+ - Discovery trims the query, then truncates it to 512 characters before matching; text beyond that cap is ignored.
103
104
  - Prefer distinctive identifiers, package names, issue numbers, or uncommon terms. Use quoted phrases only when exact wording is known.
104
105
  - The FTS5 trigram index uses AND for multiple words by default. Use `OR` for breadth, quoted phrases for exact matches, and `NOT` to exclude. Wildcards help only stems at least three characters long.
105
106
  - Only user and assistant text is indexed. Thinking blocks and tool output are not searchable.
@@ -140,7 +141,7 @@ Session files over 32 MiB are excluded from indexing and hydration, so discovery
140
141
 
141
142
  Pattern preparation runs one sync pass. A positive backlog or incomplete walk limits the sample and sets `sync.complete:false`. A total sync or required repository-inventory failure returns an explicit tool error.
142
143
 
143
- Repository scope fails outside Git or when repository inventory fails. All scope still returns its corpus in both cases. Outside Git, all scope sets `inventory.available:false` with `reason:"not-a-git-repository"`. On a repository inventory error, it uses `reason:"inventory-failed"`. Cancellation always aborts the call instead of returning unavailable inventory.
144
+ Repository scope fails outside Git or when repository inventory fails. All scope still returns its corpus when Git-root lookup exits nonzero (`inventory.available:false`, `reason:"not-a-git-repository"`) or inventory fails after the root is resolved (`reason:"inventory-failed"`). If the working directory cannot be resolved, Git cannot start, root lookup overflows or produces invalid output or unexpected stderr, or the call is cancelled, preparation fails even with all scope; these failures do not return unavailable inventory.
144
145
 
145
146
  Preparation rejects `query`, session cursors, or `window` in the same call. It also rejects `scope` without the operation.
146
147
 
@@ -315,10 +315,6 @@ function parseSessionFile(filePath: string, maxBytes: number): ParsedFile {
315
315
  return parsed;
316
316
  }
317
317
 
318
- function isJunkEncodedDir(relSegments: string[]): boolean {
319
- return relSegments.some((seg) => seg.startsWith("--tmp-") || seg.startsWith("--private-tmp-"));
320
- }
321
-
322
318
  /** Walk result. `complete: false` means the tree could not be fully read
323
319
  * (missing root, readdir/stat failure) — callers must not treat unseen
324
320
  * indexed paths as deleted. */
@@ -329,11 +325,10 @@ interface WalkResult {
329
325
 
330
326
  function walkJsonlFiles(sessionsDir: string): WalkResult {
331
327
  const files = new Map<string, fs.Stats>();
332
- if (!fs.existsSync(sessionsDir)) return { files, complete: false };
333
- const stack: { dir: string; rel: string[] }[] = [{ dir: sessionsDir, rel: [] }];
328
+ const stack = [sessionsDir];
334
329
  let complete = true;
335
330
  while (stack.length > 0) {
336
- const { dir, rel } = stack.pop()!;;
331
+ const dir = stack.pop()!;
337
332
  let entries: fs.Dirent[];
338
333
  try {
339
334
  entries = fs.readdirSync(dir, { withFileTypes: true });
@@ -346,8 +341,8 @@ function walkJsonlFiles(sessionsDir: string): WalkResult {
346
341
  if (ent.isDirectory()) {
347
342
  // Junk dirs are pruned before descent so a large ignored tree never
348
343
  // costs a walk + per-file stats on every sync pass.
349
- if (isJunkEncodedDir([...rel, ent.name])) continue;
350
- stack.push({ dir: full, rel: [...rel, ent.name] });
344
+ if (ent.name.startsWith("--tmp-") || ent.name.startsWith("--private-tmp-")) continue;
345
+ stack.push(full);
351
346
  } else if (ent.isFile() && ent.name.endsWith(".jsonl")) {
352
347
  try {
353
348
  files.set(full, fs.statSync(full));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@henryqw/pi-session-recall",
3
- "version": "4.0.2",
3
+ "version": "4.0.4",
4
4
  "description": "Local FTS5 search over past Pi sessions plus a skill for turning recurring work into deterministic automation.",
5
5
  "keywords": [
6
6
  "pi-package",