@floydous/pi-agent-kernel 0.1.0 → 0.3.0

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 (35) hide show
  1. package/CHANGELOG.md +57 -0
  2. package/README.md +78 -74
  3. package/docs/testing.md +10 -9
  4. package/grammars/tree-sitter-bash.wasm +0 -0
  5. package/grammars/tree-sitter-c.wasm +0 -0
  6. package/grammars/tree-sitter-c_sharp.wasm +0 -0
  7. package/grammars/tree-sitter-cpp.wasm +0 -0
  8. package/grammars/tree-sitter-go.wasm +0 -0
  9. package/grammars/tree-sitter-java.wasm +0 -0
  10. package/grammars/tree-sitter-javascript.wasm +0 -0
  11. package/grammars/tree-sitter-php.wasm +0 -0
  12. package/grammars/tree-sitter-python.wasm +0 -0
  13. package/grammars/tree-sitter-ruby.wasm +0 -0
  14. package/grammars/tree-sitter-rust.wasm +0 -0
  15. package/grammars/tree-sitter-tsx.wasm +0 -0
  16. package/grammars/tree-sitter-typescript.wasm +0 -0
  17. package/grammars/web-tree-sitter.wasm +0 -0
  18. package/package.json +11 -9
  19. package/src/dedup/content_store.ts +365 -365
  20. package/src/index.ts +918 -852
  21. package/src/lsp/lsp_formatter.ts +3 -1
  22. package/src/lsp/lsp_registry.ts +25 -1
  23. package/src/retrieval/ast_search.ts +930 -926
  24. package/src/retrieval/repomap.ts +220 -8
  25. package/src/retrieval/search_bm25.ts +190 -190
  26. package/src/retrieval/search_chunker.ts +254 -251
  27. package/src/retrieval/search_index.ts +22 -3
  28. package/src/retrieval/symbol_reader.ts +198 -200
  29. package/src/retrieval/tree_sitter_engine.ts +799 -0
  30. package/src/safety/epistemic_guard.ts +8 -1
  31. package/src/tools/ast_search_formatter.ts +161 -0
  32. package/src/tools/ast_search_tool.ts +17 -10
  33. package/src/tools/context.ts +20 -20
  34. package/src/tools/lsp_tool.ts +18 -5
  35. package/src/ui/tui_utils.ts +278 -278
@@ -241,7 +241,9 @@ export function formatHover(hover: LspHover | null | undefined): string {
241
241
  };
242
242
 
243
243
  const rawText = extractText(hover.contents).trim();
244
- return rawText || "No hover information available.";
244
+ // Strip transient LSP loading state markers (e.g. tsserver / vtsls prefixing "(loading...) ")
245
+ const cleanText = rawText.replace(/\(loading\.\.\.\)\s*/g, "").trim();
246
+ return cleanText || "No hover information available.";
245
247
  }
246
248
 
247
249
  /**
@@ -7,7 +7,29 @@ import { getPiHomeDir, loadKernelConfig, saveGlobalKernelConfig } from "../confi
7
7
  import { kernelDebug } from "../safety/kernel_debug";
8
8
  import { writeFileSyncAtomic } from "../safety/atomic_write";
9
9
 
10
- export const PI_LSP_BIN_DIR = path.join(getPiHomeDir(), "lsp", "bin");
10
+ export function getExtensionLspBinDir(): string {
11
+ // Confined to extensions/agent-kernel/bin/lsp by default
12
+ const candidate1 = path.join(__dirname, "..", "..", "bin", "lsp");
13
+ const candidate2 = path.join(process.cwd(), "bin", "lsp");
14
+ const candidate = fs.existsSync(candidate1) ? candidate1 : fs.existsSync(candidate2) ? candidate2 : candidate1;
15
+
16
+ // Test write permission; if read-only (e.g. system-wide npm global install), fall back to ~/.pi/lsp/bin
17
+ try {
18
+ fs.mkdirSync(candidate, { recursive: true });
19
+ const probe = path.join(candidate, ".write_test");
20
+ fs.writeFileSync(probe, "");
21
+ fs.unlinkSync(probe);
22
+ return candidate;
23
+ } catch {
24
+ const userFallback = path.join(getPiHomeDir(), "lsp", "bin");
25
+ try {
26
+ fs.mkdirSync(userFallback, { recursive: true });
27
+ } catch {}
28
+ return userFallback;
29
+ }
30
+ }
31
+
32
+ export const PI_LSP_BIN_DIR = getExtensionLspBinDir();
11
33
 
12
34
  export const PI_LSP_CONFIG_FILE = path.join(
13
35
  getPiHomeDir(),
@@ -366,8 +388,10 @@ export function findExecutable(
366
388
 
367
389
  const isWindows = process.platform === "win32";
368
390
  const home = process.env.HOME || process.env.USERPROFILE || os.homedir();
391
+ const legacyUserLspBin = path.join(getPiHomeDir(), "lsp", "bin");
369
392
  const searchDirs = [
370
393
  PI_LSP_BIN_DIR,
394
+ legacyUserLspBin,
371
395
  path.join(home, ".local", "bin"),
372
396
  path.join(home, ".cargo", "bin"),
373
397
  path.join(home, "go", "bin"),