pi-knowledge 0.16.0 → 0.16.1

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/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [0.16.1] - 2026-11-21
6
+
7
+ ### Fixed
8
+ - Removed the fixed five-minute asynchronous directory-scan deadline so progressing large plan/add/update, diagnostics, and watcher traversals can complete; operators can opt into an explicit limit with `PI_KNOWLEDGE_SCAN_TIMEOUT_MS` (#26).
9
+ - Fixed Windows profile startup by passing ACL-hardening paths to PowerShell outside `-Command` argv, preserving clean JSON output, surfacing bounded stderr diagnostics, and handling expected atomic manifest and shutdown-file races without weakening ACL checks (#27).
10
+
5
11
  ## [0.16.0] - 2026-11-19
6
12
 
7
13
  ### Added
package/README.md CHANGED
@@ -350,7 +350,7 @@ Full configuration details are in [docs/configuration.md](docs/configuration.md)
350
350
  | MCP HTTP | `PI_KNOWLEDGE_MCP_HTTP_TOKEN` |
351
351
  | Reranker provider | `PI_KNOWLEDGE_RERANKER`, `PI_KNOWLEDGE_RERANKER_REVISION`, `PI_KNOWLEDGE_RERANKER_DTYPE`, `PI_KNOWLEDGE_RERANKER_REMOTE_HOST`, `PI_KNOWLEDGE_RERANKER_REMOTE_PATH_TEMPLATE`, `PI_KNOWLEDGE_RERANKER_RAW_LOGITS`, `PI_KNOWLEDGE_RERANKER_API_ENDPOINT`, `PI_KNOWLEDGE_RERANKER_API_BASE_URL`, `PI_KNOWLEDGE_RERANKER_API_KEY`, `PI_KNOWLEDGE_RERANKER_API_FORMAT`, `PI_KNOWLEDGE_RERANKER_API_TIMEOUT_MS`, `PI_KNOWLEDGE_RERANKER_MAX_DOC_CHARS`, `PI_KNOWLEDGE_RERANKER_API_RESULTS_PATH`, `PI_KNOWLEDGE_RERANKER_API_INDEX_FIELD`, `PI_KNOWLEDGE_RERANKER_API_SCORE_FIELD`, `PI_KNOWLEDGE_RERANKER_API_SCORE_DIRECTION` |
352
352
  | Native lifecycle | `PI_KNOWLEDGE_ENABLE_NATIVE_IDLE_DISPOSE`, `PI_KNOWLEDGE_EMBEDDING_IDLE_MS` |
353
- | Runtime features | `PI_KNOWLEDGE_WATCH`, `PI_KNOWLEDGE_AUTO_INJECT`, `PI_KNOWLEDGE_STALE_INDEXING_MS`, `PI_KNOWLEDGE_OFFLINE`, `PI_KNOWLEDGE_SEARCH_PROFILE`, `PI_KNOWLEDGE_SEARCH_DEFAULT_LIMIT`, `PI_KNOWLEDGE_SNIPPET_MAX_LENGTH`, `PI_KNOWLEDGE_MIN_HYBRID_SCORE`, `PI_KNOWLEDGE_SEARCH_CANDIDATE_MIN`, `PI_KNOWLEDGE_SEARCH_CANDIDATE_MULTIPLIER`, `PI_KNOWLEDGE_ADAPTIVE_CONTEXT_LINES`, `PI_KNOWLEDGE_ADAPTIVE_MAX_CHARS`, `PI_KNOWLEDGE_ADAPTIVE_NEIGHBOR_TARGET`, `PI_KNOWLEDGE_DEEP_RERANK_CANDIDATES`, `PI_KNOWLEDGE_DEEP_RERANK_TOPK_MULTIPLIER` |
353
+ | Runtime features | `PI_KNOWLEDGE_WATCH`, `PI_KNOWLEDGE_AUTO_INJECT`, `PI_KNOWLEDGE_STALE_INDEXING_MS`, `PI_KNOWLEDGE_SCAN_TIMEOUT_MS`, `PI_KNOWLEDGE_OFFLINE`, `PI_KNOWLEDGE_SEARCH_PROFILE`, `PI_KNOWLEDGE_SEARCH_DEFAULT_LIMIT`, `PI_KNOWLEDGE_SNIPPET_MAX_LENGTH`, `PI_KNOWLEDGE_MIN_HYBRID_SCORE`, `PI_KNOWLEDGE_SEARCH_CANDIDATE_MIN`, `PI_KNOWLEDGE_SEARCH_CANDIDATE_MULTIPLIER`, `PI_KNOWLEDGE_ADAPTIVE_CONTEXT_LINES`, `PI_KNOWLEDGE_ADAPTIVE_MAX_CHARS`, `PI_KNOWLEDGE_ADAPTIVE_NEIGHBOR_TARGET`, `PI_KNOWLEDGE_DEEP_RERANK_CANDIDATES`, `PI_KNOWLEDGE_DEEP_RERANK_TOPK_MULTIPLIER` |
354
354
  | Release fixtures | `PI_KNOWLEDGE_E2E_PDF`, `PI_KNOWLEDGE_E2E_DOCX` |
355
355
 
356
356
  For Hugging Face Text Embeddings Inference rerankers, use `PI_KNOWLEDGE_RERANKER=api:<model>`, `PI_KNOWLEDGE_RERANKER_API_FORMAT=tei`, and `PI_KNOWLEDGE_RERANKER_API_ENDPOINT=http://127.0.0.1:8080/rerank`; TEI exposes OpenAI-compatible embeddings under `/v1`, but reranking uses `/rerank`.
@@ -366,6 +366,7 @@ OMP compatibility covers packaged entry loading, native SQLite dependency resolu
366
366
  ## Large Project Indexing
367
367
 
368
368
  Indexing is designed as a stable long-running operation, not a quick background trick. `knowledge_add`, `knowledge_update`, and `knowledge_import` scan directories incrementally, embed and store chunks in hard-capped batches, stream vector files to disk, and report progress with file/chunk counts, chunks/sec, skipped file counts, elapsed time, and file ETA where available. Directory indexing starts with a metadata-only planning scan so large repositories can show total scannable files and skipped counts before expensive embedding starts.
369
+ Directory scans have no wall-clock timeout by default; entry-count, total-byte, depth, file-size, access, and cancellation bounds remain enforced. Operators who need an absolute limit for unusually slow or remote filesystems can set `PI_KNOWLEDGE_SCAN_TIMEOUT_MS` to a positive integer in milliseconds, or `0` to keep the default unbounded-duration policy. Restart the selected profile daemon after changing this runtime setting.
369
370
 
370
371
  Directory indexing separates technical skips from user-confirmable suggestions. `knowledge_plan` inspects a source without writing a KB, so agents can show scannable files, suggested exclusions, and technical skips before asking the user to confirm scope. Unsupported binary/non-text files, oversized files, unreadable files, inaccessible paths, and documents that cannot be extracted are skipped for stability. Text files that may be private or low-signal, such as `.env`, credential-named files, generated reports, lockfiles, vendor text, build output text, and runtime/cache text, are suggested exclusions by default rather than permanent blocks. Agents should explain the privacy and search-precision tradeoff, ask the user when the choice is ambiguous, and then use `include_suggested_text` or focused `include_paths` when the user confirms those text files belong in the KB. Ordinary project configuration files such as `settings.json` or `appsettings.json` remain indexable because they often describe real system behavior.
371
372
 
@@ -60,7 +60,7 @@ export function readDaemonManifest(profile) {
60
60
  return manifest;
61
61
  }
62
62
  catch (error) {
63
- if (error.code === "ENOENT")
63
+ if (!existsSync(path) || error.code === "ENOENT")
64
64
  return undefined;
65
65
  throw error;
66
66
  }
@@ -76,7 +76,7 @@ export function readDaemonOwner(profile) {
76
76
  return owner;
77
77
  }
78
78
  catch (error) {
79
- if (error.code === "ENOENT")
79
+ if (!existsSync(path) || error.code === "ENOENT")
80
80
  return undefined;
81
81
  throw error;
82
82
  }
@@ -5,6 +5,7 @@ export interface ScanOptions {
5
5
  includePaths?: string[];
6
6
  excludePaths?: string[];
7
7
  accessPolicy?: FilesystemAccessPolicy;
8
+ timeoutMs?: number;
8
9
  }
9
10
  export interface ScannedFile {
10
11
  path: string;
@@ -41,6 +42,7 @@ export declare function addSkippedScanEntry(skipped: ScanResult["skipped"], entr
41
42
  export declare function summarizeSkippedScan(skipped: ScanResult["skipped"]): string;
42
43
  export declare function isSupportedDocumentFile(filePath: string): boolean;
43
44
  export declare function iterateScannableFileVisits(dirPath: string, skipped?: ScanResult["skipped"], options?: ScanOptions): Generator<ScannableFile | undefined>;
45
+ export declare function resolveDirectoryScanTimeoutMs(env?: NodeJS.ProcessEnv): number;
44
46
  export declare function iterateScannableFileVisitsAsync(dirPath: string, skipped?: ScanResult["skipped"], options?: ScanOptions, signal?: AbortSignal): AsyncGenerator<ScannableFile | undefined>;
45
47
  export declare function iterateScannableFiles(dirPath: string, skipped?: ScanResult["skipped"], options?: ScanOptions): Generator<ScannableFile>;
46
48
  export declare function iterateScannableFilesAsync(dirPath: string, skipped?: ScanResult["skipped"], options?: ScanOptions, signal?: AbortSignal): AsyncGenerator<ScannableFile>;
@@ -301,7 +301,28 @@ const MAX_GITIGNORE_BYTES = 1024 * 1024;
301
301
  const MAX_SCAN_ENTRIES = 1_000_000;
302
302
  const MAX_SCAN_TOTAL_BYTES = 64 * 1024 * 1024 * 1024;
303
303
  const MAX_SCAN_DEPTH = 128;
304
- const MAX_SCAN_DURATION_MS = 5 * 60_000;
304
+ const DIRECTORY_SCAN_TIMEOUT_ENV = "PI_KNOWLEDGE_SCAN_TIMEOUT_MS";
305
+ export function resolveDirectoryScanTimeoutMs(env = process.env) {
306
+ const raw = env[DIRECTORY_SCAN_TIMEOUT_ENV]?.trim();
307
+ if (!raw)
308
+ return 0;
309
+ if (!/^(0|[1-9]\d*)$/.test(raw)) {
310
+ throw new Error(`${DIRECTORY_SCAN_TIMEOUT_ENV} must be 0 or a positive integer`);
311
+ }
312
+ const timeoutMs = Number(raw);
313
+ if (!Number.isSafeInteger(timeoutMs)) {
314
+ throw new Error(`${DIRECTORY_SCAN_TIMEOUT_ENV} must be a safe integer`);
315
+ }
316
+ return timeoutMs;
317
+ }
318
+ function directoryScanTimeoutMs(options) {
319
+ if (options.timeoutMs === undefined)
320
+ return resolveDirectoryScanTimeoutMs();
321
+ if (!Number.isSafeInteger(options.timeoutMs) || options.timeoutMs < 0) {
322
+ throw new Error("Directory scan timeout must be 0 or a positive safe integer");
323
+ }
324
+ return options.timeoutMs;
325
+ }
305
326
  function scanPathIsWithin(path, root) {
306
327
  const rel = relative(root, path);
307
328
  return rel === "" || (rel !== ".." && !rel.startsWith(`..${sep}`) && !isAbsolute(rel));
@@ -370,6 +391,8 @@ async function isBinaryFileAsync(filePath, expected) {
370
391
  }
371
392
  }
372
393
  export async function* iterateScannableFileVisitsAsync(dirPath, skipped = createSkippedScanStats(), options = {}, signal) {
394
+ const timeoutMs = directoryScanTimeoutMs(options);
395
+ const startedAt = timeoutMs === 0 ? 0 : Date.now();
373
396
  const authorizedRoot = authorizeExistingPath(dirPath, options.accessPolicy);
374
397
  const initialRootInfo = await lstatFile(authorizedRoot);
375
398
  if (initialRootInfo.isSymbolicLink() || !initialRootInfo.isDirectory()) {
@@ -394,14 +417,14 @@ export async function* iterateScannableFileVisitsAsync(dirPath, skipped = create
394
417
  const includePaths = normalizeScanPaths(options.includePaths);
395
418
  const excludePaths = normalizeScanPaths(options.excludePaths);
396
419
  const includeSuggestedText = options.includeSuggestedText === true;
397
- const deadline = Date.now() + MAX_SCAN_DURATION_MS;
398
420
  let visitedEntries = 0;
399
421
  let totalBytes = 0;
400
422
  const assertScanActive = () => {
401
423
  if (signal?.aborted)
402
424
  throw new Error("Cancelled");
403
- if (Date.now() > deadline)
404
- throw new Error(`Directory scan exceeded ${MAX_SCAN_DURATION_MS}ms`);
425
+ if (timeoutMs > 0 && Date.now() - startedAt > timeoutMs) {
426
+ throw new Error(`Directory scan exceeded the configured ${timeoutMs}ms timeout; increase ${DIRECTORY_SCAN_TIMEOUT_ENV} or set it to 0 to disable the wall-clock limit`);
427
+ }
405
428
  };
406
429
  async function* walk(dir, depth) {
407
430
  assertScanActive();
@@ -110,13 +110,12 @@ export function hardenPrivateFile(path, label) {
110
110
  }
111
111
  export function readPrivateJson(path, label) {
112
112
  assertOwnedDirectory(dirname(path));
113
+ if (process.platform === "win32")
114
+ assertWindowsPathPrivate(path);
113
115
  const direct = lstatSync(path);
114
116
  if (direct.isSymbolicLink() || !direct.isFile())
115
117
  throw new Error(`Invalid ${label}: ${path}`);
116
- if (process.platform === "win32") {
117
- assertWindowsPathPrivate(path);
118
- }
119
- else {
118
+ if (process.platform !== "win32") {
120
119
  if (typeof process.getuid === "function" && direct.uid !== process.getuid()) {
121
120
  throw new Error(`${label} is not owned by the current user: ${path}`);
122
121
  }
@@ -7,24 +7,44 @@ function powershellPath() {
7
7
  throw new Error("Windows system root must be an absolute path");
8
8
  return join(systemRoot, "System32", "WindowsPowerShell", "v1.0", "powershell.exe");
9
9
  }
10
+ const POWERSHELL_PATH_ENV = "PI_KNOWLEDGE_POWERSHELL_PATH";
11
+ const MAX_POWERSHELL_ERROR_CHARS = 2_048;
12
+ function powerShellErrorDetail(error) {
13
+ if (typeof error !== "object" || error === null || !("stderr" in error))
14
+ return undefined;
15
+ const stderr = error.stderr;
16
+ const text = typeof stderr === "string" ? stderr : Buffer.isBuffer(stderr) ? stderr.toString("utf8") : "";
17
+ const compact = text.replace(/\s+/g, " ").trim();
18
+ return compact ? compact.slice(0, MAX_POWERSHELL_ERROR_CHARS) : undefined;
19
+ }
10
20
  function runPowerShell(script, path) {
11
- return execFileSync(powershellPath(), ["-NoLogo", "-NoProfile", "-NonInteractive", "-Command", script, path], {
12
- encoding: "utf8",
13
- stdio: ["ignore", "pipe", "ignore"],
14
- timeout: 10_000,
15
- windowsHide: true,
16
- }).trim();
21
+ const command = `$ErrorActionPreference='Stop'; $p=$env:${POWERSHELL_PATH_ENV}; if([string]::IsNullOrWhiteSpace($p)){throw 'Missing Windows security path'}; ${script}`;
22
+ try {
23
+ return execFileSync(powershellPath(), ["-NoLogo", "-NoProfile", "-NonInteractive", "-Command", command], {
24
+ encoding: "utf8",
25
+ env: { ...process.env, [POWERSHELL_PATH_ENV]: path },
26
+ stdio: ["ignore", "pipe", "pipe"],
27
+ timeout: 10_000,
28
+ windowsHide: true,
29
+ }).trim();
30
+ }
31
+ catch (error) {
32
+ const detail = powerShellErrorDetail(error);
33
+ throw new Error(detail ? `Windows security command failed: ${detail}` : "Windows security command failed", {
34
+ cause: error,
35
+ });
36
+ }
17
37
  }
18
38
  export function hardenWindowsPath(path, directory) {
19
39
  if (process.platform !== "win32")
20
40
  return;
21
41
  const inheritance = directory ? "ContainerInherit, ObjectInherit" : "None";
22
- runPowerShell(`$ErrorActionPreference='Stop'; $p=$args[0]; $me=[Security.Principal.WindowsIdentity]::GetCurrent(); $acl=Get-Acl -LiteralPath $p; $acl.SetAccessRuleProtection($true,$false); foreach($rule in @($acl.Access)){[void]$acl.RemoveAccessRuleSpecific($rule)}; $acl.SetOwner($me.User); $inherit=[Security.AccessControl.InheritanceFlags]'${inheritance}'; $prop=[Security.AccessControl.PropagationFlags]::None; $allow=[Security.AccessControl.AccessControlType]::Allow; foreach($sid in @($me.User,(New-Object Security.Principal.SecurityIdentifier('S-1-5-18')),(New-Object Security.Principal.SecurityIdentifier('S-1-5-32-544')))){ $rule=New-Object Security.AccessControl.FileSystemAccessRule($sid,[Security.AccessControl.FileSystemRights]::FullControl,$inherit,$prop,$allow); $acl.AddAccessRule($rule) }; Set-Acl -LiteralPath $p -AclObject $acl`, path);
42
+ runPowerShell(`$me=[Security.Principal.WindowsIdentity]::GetCurrent(); $acl=Get-Acl -LiteralPath $p; $acl.SetAccessRuleProtection($true,$false); foreach($rule in @($acl.Access)){[void]$acl.RemoveAccessRuleSpecific($rule)}; $acl.SetOwner($me.User); $inherit=[Security.AccessControl.InheritanceFlags]'${inheritance}'; $prop=[Security.AccessControl.PropagationFlags]::None; $allow=[Security.AccessControl.AccessControlType]::Allow; foreach($sid in @($me.User,(New-Object Security.Principal.SecurityIdentifier('S-1-5-18')),(New-Object Security.Principal.SecurityIdentifier('S-1-5-32-544')))){ $rule=New-Object Security.AccessControl.FileSystemAccessRule($sid,[Security.AccessControl.FileSystemRights]::FullControl,$inherit,$prop,$allow); $acl.AddAccessRule($rule) }; Set-Acl -LiteralPath $p -AclObject $acl`, path);
23
43
  }
24
44
  export function assertWindowsPathPrivate(path) {
25
45
  if (process.platform !== "win32")
26
46
  return;
27
- const output = runPowerShell(`$ErrorActionPreference='Stop'; $p=$args[0]; $me=[Security.Principal.WindowsIdentity]::GetCurrent().User.Value; $trusted=@($me,'S-1-5-18','S-1-5-32-544'); $acl=Get-Acl -LiteralPath $p; $owner=(New-Object Security.Principal.NTAccount($acl.Owner)).Translate([Security.Principal.SecurityIdentifier]).Value; $unsafe=0; foreach($rule in @($acl.Access)){ if($rule.AccessControlType -eq [Security.AccessControl.AccessControlType]::Allow){ $sid=$rule.IdentityReference.Translate([Security.Principal.SecurityIdentifier]).Value; if($trusted -notcontains $sid){$unsafe++} } }; [pscustomobject]@{owner=$owner;current=$me;unsafe=$unsafe}|ConvertTo-Json -Compress`, path);
47
+ const output = runPowerShell(`$me=[Security.Principal.WindowsIdentity]::GetCurrent().User.Value; $trusted=@($me,'S-1-5-18','S-1-5-32-544'); $acl=Get-Acl -LiteralPath $p; $owner=(New-Object Security.Principal.NTAccount($acl.Owner)).Translate([Security.Principal.SecurityIdentifier]).Value; $unsafe=0; foreach($rule in @($acl.Access)){ if($rule.AccessControlType -eq [Security.AccessControl.AccessControlType]::Allow){ $sid=$rule.IdentityReference.Translate([Security.Principal.SecurityIdentifier]).Value; if($trusted -notcontains $sid){$unsafe++} } }; [pscustomobject]@{owner=$owner;current=$me;unsafe=$unsafe}|ConvertTo-Json -Compress`, path);
28
48
  const parsed = JSON.parse(output);
29
49
  if (!isObjectRecord(parsed) ||
30
50
  parsed.owner !== parsed.current ||
@@ -36,7 +56,7 @@ export function assertWindowsPathPrivate(path) {
36
56
  export function assertWindowsPathAncestorsTrusted(path) {
37
57
  if (process.platform !== "win32")
38
58
  return;
39
- const output = runPowerShell(`$ErrorActionPreference='Stop'; $p=$args[0]; $me=[Security.Principal.WindowsIdentity]::GetCurrent().User.Value; $trusted=@($me,'S-1-5-18','S-1-5-32-544','S-1-5-80-956008885-3418522649-1831038044-1853292631-2271478464'); $danger=[Security.AccessControl.FileSystemRights]::Write -bor [Security.AccessControl.FileSystemRights]::Modify -bor [Security.AccessControl.FileSystemRights]::FullControl -bor [Security.AccessControl.FileSystemRights]::ChangePermissions -bor [Security.AccessControl.FileSystemRights]::TakeOwnership -bor [Security.AccessControl.FileSystemRights]::Delete -bor [Security.AccessControl.FileSystemRights]::DeleteSubdirectoriesAndFiles -bor [Security.AccessControl.FileSystemRights]::CreateFiles -bor [Security.AccessControl.FileSystemRights]::CreateDirectories; $unsafe=0; $item=Get-Item -LiteralPath $p -Force; while($null -ne $item){ $acl=Get-Acl -LiteralPath $item.FullName; $owner=(New-Object Security.Principal.NTAccount($acl.Owner)).Translate([Security.Principal.SecurityIdentifier]).Value; if($trusted -notcontains $owner){$unsafe++}; foreach($rule in @($acl.Access)){ if($rule.AccessControlType -eq [Security.AccessControl.AccessControlType]::Allow -and (($rule.FileSystemRights -band $danger) -ne 0)){ $sid=$rule.IdentityReference.Translate([Security.Principal.SecurityIdentifier]).Value; if($trusted -notcontains $sid){$unsafe++} } }; if($item.PSIsContainer){$item=$item.Parent}else{$item=$item.Directory} }; [pscustomobject]@{unsafe=$unsafe}|ConvertTo-Json -Compress`, path);
59
+ const output = runPowerShell(`$me=[Security.Principal.WindowsIdentity]::GetCurrent().User.Value; $trusted=@($me,'S-1-5-18','S-1-5-32-544','S-1-5-80-956008885-3418522649-1831038044-1853292631-2271478464'); $danger=[Security.AccessControl.FileSystemRights]::ChangePermissions -bor [Security.AccessControl.FileSystemRights]::TakeOwnership -bor [Security.AccessControl.FileSystemRights]::Delete -bor [Security.AccessControl.FileSystemRights]::DeleteSubdirectoriesAndFiles; $unsafe=0; $item=Get-Item -LiteralPath $p -Force; while($null -ne $item){ $acl=Get-Acl -LiteralPath $item.FullName; $owner=(New-Object Security.Principal.NTAccount($acl.Owner)).Translate([Security.Principal.SecurityIdentifier]).Value; if($trusted -notcontains $owner){$unsafe++}; foreach($rule in @($acl.Access)){ if($rule.AccessControlType -eq [Security.AccessControl.AccessControlType]::Allow -and (($rule.FileSystemRights -band $danger) -ne 0)){ $sid=$rule.IdentityReference.Translate([Security.Principal.SecurityIdentifier]).Value; if($trusted -notcontains $sid){$unsafe++} } }; if($item.PSIsContainer){$item=$item.Parent}else{$item=$item.Directory} }; [pscustomobject]@{unsafe=$unsafe}|ConvertTo-Json -Compress`, path);
40
60
  const parsed = JSON.parse(output);
41
61
  if (!isObjectRecord(parsed) || typeof parsed.unsafe !== "number" || parsed.unsafe !== 0) {
42
62
  throw new Error(`Windows path or ancestor is controlled by an untrusted principal: ${path}`);
@@ -79,6 +79,7 @@ API embedding failures intentionally surface by default. Silent fallback can hid
79
79
  | `PI_KNOWLEDGE_WATCH` | unset | Set to `true` to start file watchers for directory KBs. The polling fallback remains available when native `fs.watch` fails. |
80
80
  | `PI_KNOWLEDGE_AUTO_INJECT` | unset | Set to `true` to auto-search KB context before model calls. This is opt-in. |
81
81
  | `PI_KNOWLEDGE_STALE_INDEXING_MS` | built-in stale threshold | Override the stale indexing threshold used by diagnostics and `knowledge_doctor`. |
82
+ | `PI_KNOWLEDGE_SCAN_TIMEOUT_MS` | `0` (disabled) | Optional wall-clock limit in milliseconds for each asynchronous directory traversal used by plan/add/update, live diagnostics, and watcher snapshots. `0` allows progressing large scans to run without an elapsed-time failure while existing entry-count, byte, depth, file-size, access, and cancellation bounds remain active. Restart the selected profile daemon after changing this setting. |
82
83
  | `PI_KNOWLEDGE_SEARCH_PROFILE` | `auto` | Select the default search tuning profile. Values: `auto`, `balanced`, `low_token`, `precision`, `recall`, `long_context`, `code`, `docs`. Tool `profile` parameters override this. |
83
84
  | `PI_KNOWLEDGE_SEARCH_DEFAULT_LIMIT` | profile default | Override the result limit used only when `knowledge_search` does not pass `limit`. Clamped to 1-50. |
84
85
  | `PI_KNOWLEDGE_SNIPPET_MAX_LENGTH` | profile default | Override returned snippet length. Clamped to 80-4000 characters. |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-knowledge",
3
- "version": "0.16.0",
3
+ "version": "0.16.1",
4
4
  "description": "Local-first RAG knowledge server for Pi, OMP, and MCP agents with hybrid code/doc search, reranking, diagnostics, and large-project indexing",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",