@floydous/pi-agent-kernel 0.4.3 → 0.5.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 (59) hide show
  1. package/AGENT_KERNEL_SYS_PROMPT.md +1 -7
  2. package/CHANGELOG.md +36 -0
  3. package/README.md +6 -53
  4. package/config.example.toml +0 -8
  5. package/docs/README.md +1 -2
  6. package/docs/architecture.md +2 -3
  7. package/docs/configuration.md +10 -9
  8. package/docs/editing-and-verification.md +1 -3
  9. package/docs/retrieval.md +6 -11
  10. package/docs/testing.md +3 -3
  11. package/package.json +4 -2
  12. package/src/config/agent_kernel_command.ts +8 -39
  13. package/src/config/kernel_config.ts +30 -68
  14. package/src/config/toml.ts +6 -1
  15. package/src/editing/auto_heal.ts +1 -1
  16. package/src/editing/patch.ts +27 -16
  17. package/src/editing/post_edit_verification.ts +12 -10
  18. package/src/editing/smart_anchor.ts +7 -5
  19. package/src/editing/syntax-verify.ts +9 -5
  20. package/src/index.ts +15 -257
  21. package/src/retrieval/search_bm25.ts +4 -2
  22. package/src/retrieval/search_chunker.ts +1 -1
  23. package/src/retrieval/search_config.ts +4 -6
  24. package/src/retrieval/search_embedder.ts +3 -2
  25. package/src/retrieval/search_index.ts +82 -35
  26. package/src/retrieval/search_modal.ts +7 -8
  27. package/src/retrieval/{repomap.ts → tag_extractor.ts} +5 -292
  28. package/src/retrieval/tree_sitter_engine.ts +70 -34
  29. package/src/retrieval/workspace_walker.ts +6 -2
  30. package/src/safety/atomic_write.ts +1 -1
  31. package/src/safety/epistemic_guard.ts +105 -31
  32. package/src/safety/output_clamper.ts +14 -8
  33. package/src/tools/code_search_output.ts +2 -1
  34. package/src/tools/code_search_tool.ts +2 -5
  35. package/src/tools/context.ts +0 -14
  36. package/src/tools/edit_tool.ts +82 -115
  37. package/src/tools/read_tool.ts +42 -178
  38. package/src/ui/footer.ts +7 -7
  39. package/docs/lsp.md +0 -31
  40. package/src/lsp/adapters/base.ts +0 -42
  41. package/src/lsp/adapters/index.ts +0 -21
  42. package/src/lsp/adapters/python.ts +0 -37
  43. package/src/lsp/adapters/rust.ts +0 -35
  44. package/src/lsp/adapters/typescript.ts +0 -40
  45. package/src/lsp/index.ts +0 -13
  46. package/src/lsp/lsp_client.ts +0 -765
  47. package/src/lsp/lsp_detector.ts +0 -52
  48. package/src/lsp/lsp_formatter.ts +0 -323
  49. package/src/lsp/lsp_installer.ts +0 -320
  50. package/src/lsp/lsp_manager.ts +0 -202
  51. package/src/lsp/lsp_modal.ts +0 -675
  52. package/src/lsp/lsp_registry.ts +0 -600
  53. package/src/lsp/lsp_types.ts +0 -143
  54. package/src/retrieval/ast_search.ts +0 -999
  55. package/src/retrieval/symbol_reader.ts +0 -228
  56. package/src/tools/ast_search_formatter.ts +0 -161
  57. package/src/tools/ast_search_tool.ts +0 -146
  58. package/src/tools/lsp_tool.ts +0 -794
  59. package/src/tools/repo_map_tool.ts +0 -56
@@ -1,56 +0,0 @@
1
- import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
2
- import { Type } from "typebox";
3
- import { Text, makeOutputText } from "../ui/tui_utils";
4
- import { computeRepoMap } from "../retrieval/repomap";
5
- import { loadKernelConfig } from "../config";
6
-
7
- /** Extracted from index.ts — registers the `repo_map` tool. */
8
- export function registerRepoMapTool(pi: ExtensionAPI): void {
9
- // 4. Tool: `get_repo_map` (Tree-sitter PageRank Map)
10
- pi.registerTool({
11
- name: "get_repo_map",
12
- label: "Get Repository Map",
13
- description: "Get PageRank-ranked AST map of symbols across repository.",
14
- promptSnippet: "Inspect repository AST symbol graph and signatures",
15
- renderShell: "default",
16
- parameters: Type.Object({
17
- budget_tokens: Type.Optional(
18
- Type.Number({ description: "Target token budget (default: 1024)" }),
19
- ),
20
- }),
21
- async execute(
22
- _toolCallId: string,
23
- params: any,
24
- _signal: any,
25
- _onUpdate: any,
26
- ctx: any,
27
- ) {
28
- const configuredBudget = loadKernelConfig(ctx.cwd).retrieval.repo_map_budget;
29
- const budget = params.budget_tokens ?? configuredBudget;
30
- const repoMap = computeRepoMap(ctx.cwd, budget);
31
- return {
32
- content: [{ type: "text", text: repoMap }],
33
- details: { budget, length: repoMap.length },
34
- };
35
- },
36
- renderCall(args: any, theme: any, _context: any) {
37
- return makeOutputText(
38
- `${theme.fg("toolTitle", theme.bold("get_repo_map"))} (budget: ${args?.budget_tokens ?? 1024})`,
39
- );
40
- },
41
- renderResult(result: any, options: any, theme: any, context: any) {
42
- if (context.isError) {
43
- const errMsg =
44
- result.content?.find((c: any) => c.type === "text")?.text ||
45
- "Repo map failed";
46
- return makeOutputText(`\n${theme.fg("error", errMsg)}`);
47
- }
48
- if (!options.expanded) {
49
- return new Text("", 0, 0);
50
- }
51
- const output =
52
- result.content?.find((c: any) => c.type === "text")?.text || "";
53
- return makeOutputText(`\n${theme.fg("toolOutput", output)}`);
54
- },
55
- });
56
- }