@shanepadgett/tau-agent 0.33.1 → 0.34.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 (190) hide show
  1. package/docs/context.md +29 -20
  2. package/docs/extending-tau-agent.md +63 -24
  3. package/extensions/appshot/index.ts +112 -111
  4. package/extensions/aside/README.md +7 -0
  5. package/extensions/aside/index.ts +168 -0
  6. package/extensions/aside/panel.ts +83 -0
  7. package/extensions/branch/index.ts +38 -21
  8. package/extensions/cache-diagnostics/index.ts +70 -58
  9. package/extensions/checkpoint/README.md +9 -0
  10. package/extensions/checkpoint/checkpoint-budget.ts +79 -0
  11. package/extensions/checkpoint/checkpoint.ts +277 -0
  12. package/extensions/checkpoint/index.ts +102 -0
  13. package/extensions/checkpoint/messages.ts +169 -0
  14. package/extensions/checkpoint/prompt.ts +24 -0
  15. package/extensions/checkpoint/settings.ts +27 -0
  16. package/extensions/commit/commit-effort.ts +3 -3
  17. package/extensions/context/README.md +12 -8
  18. package/extensions/context/definitions.ts +178 -55
  19. package/extensions/context/index.ts +192 -160
  20. package/extensions/context/panel.ts +57 -37
  21. package/extensions/context/sync.ts +139 -89
  22. package/extensions/context/validation.ts +37 -25
  23. package/extensions/effort/README.md +1 -1
  24. package/extensions/effort/index.ts +3 -3
  25. package/extensions/effort/state.ts +3 -18
  26. package/extensions/explore/guidance.ts +6 -47
  27. package/extensions/explore/index.ts +38 -53
  28. package/extensions/explore/{ast/read → read}/hook.ts +12 -7
  29. package/extensions/explore/{ast/tools → tools}/ast-search.ts +15 -19
  30. package/extensions/explore/{ast/tools → tools}/context.ts +16 -23
  31. package/extensions/explore/{ast/tools → tools}/deps.ts +11 -15
  32. package/extensions/explore/{ast/tools → tools}/discover.ts +15 -17
  33. package/extensions/explore/{ast/tools → tools}/impact.ts +20 -23
  34. package/extensions/explore/{ast/tools → tools}/outline.ts +21 -24
  35. package/extensions/explore/{ast/tools → tools}/relationships.ts +23 -32
  36. package/extensions/explore/{ast/tools → tools}/render.ts +1 -1
  37. package/extensions/explore/{ast/tools → tools}/reverse-deps.ts +11 -15
  38. package/extensions/explore/{ast/tools → tools}/show.ts +16 -19
  39. package/extensions/explore/tools/target-params.ts +9 -0
  40. package/extensions/footer/index.ts +75 -56
  41. package/extensions/handoff/index.ts +8 -30
  42. package/extensions/image-gen/index.ts +46 -40
  43. package/extensions/patch/executor.ts +190 -135
  44. package/extensions/patch/matcher.ts +82 -48
  45. package/extensions/patch/parser.ts +149 -105
  46. package/extensions/patch/render.ts +32 -39
  47. package/extensions/patch/summary.ts +30 -26
  48. package/extensions/ready/README.md +7 -0
  49. package/extensions/ready/index.ts +58 -0
  50. package/extensions/ready/model.ts +128 -0
  51. package/extensions/ready/packs.ts +272 -0
  52. package/extensions/ready/render.ts +445 -0
  53. package/extensions/ready/scan.ts +760 -0
  54. package/extensions/reference/panel.ts +28 -16
  55. package/extensions/review/index.ts +63 -51
  56. package/extensions/review/panel.ts +5 -34
  57. package/extensions/runtime-context/context.ts +30 -26
  58. package/extensions/script-runner/README.md +2 -2
  59. package/extensions/script-runner/index.ts +122 -82
  60. package/extensions/silent-command-runner/index.ts +38 -23
  61. package/extensions/subagent/agents/context-sync.md +185 -33
  62. package/extensions/subagent/agents/scout.md +2 -2
  63. package/extensions/subagent/agents.ts +137 -84
  64. package/extensions/subagent/cmux-dashboard.ts +39 -30
  65. package/extensions/subagent/index.ts +79 -59
  66. package/extensions/subagent/resume.ts +1 -1
  67. package/extensions/subagent/run.ts +304 -193
  68. package/extensions/subagent/runtime.ts +781 -343
  69. package/extensions/tau/index.ts +47 -38
  70. package/extensions/tau-help/help.md +14 -6
  71. package/extensions/tool-loader/README.md +4 -2
  72. package/extensions/tool-loader/index.ts +77 -52
  73. package/extensions/web/index.ts +6 -3
  74. package/extensions/web/webfetch.ts +114 -86
  75. package/package.json +3 -3
  76. package/schemas/tau.schema.json +20 -33
  77. package/shared/bounded-text-result.ts +1 -0
  78. package/shared/checkpoint-visibility.ts +9 -0
  79. package/shared/events.ts +28 -10
  80. package/shared/isolated-session.ts +71 -29
  81. package/shared/model-effort.ts +9 -19
  82. package/shared/model-fallback/index.ts +66 -41
  83. package/shared/settings/load.ts +45 -38
  84. package/shared/temporary-output-store.ts +16 -10
  85. package/{extensions/explore → src}/ast/adapter.ts +11 -2
  86. package/{extensions/explore → src}/ast/engine.ts +54 -38
  87. package/{extensions/explore → src}/ast/format/ast-search.ts +15 -6
  88. package/{extensions/explore → src}/ast/format/context.ts +3 -6
  89. package/src/ast/format/deps.ts +94 -0
  90. package/{extensions/explore → src}/ast/format/discover.ts +2 -2
  91. package/{extensions/explore → src}/ast/format/impact.ts +9 -11
  92. package/{extensions/explore → src}/ast/format/outline.ts +2 -2
  93. package/{extensions/explore → src}/ast/format/relationships.ts +11 -7
  94. package/{extensions/explore → src}/ast/format/show.ts +1 -1
  95. package/src/ast/format/targeted-result.ts +20 -0
  96. package/src/ast/grammars/c_sharp.wasm +0 -0
  97. package/{extensions/explore → src}/ast/grammars/manifest.json +9 -12
  98. package/{extensions/explore → src}/ast/grammars/manifest.ts +0 -4
  99. package/{extensions/explore → src}/ast/graph/file-graph.ts +210 -98
  100. package/{extensions/explore → src}/ast/graph/relationships.ts +285 -72
  101. package/{extensions/explore → src}/ast/ir.ts +6 -0
  102. package/src/ast/languages/csharp-file-deps.ts +90 -0
  103. package/{extensions/explore → src}/ast/languages/csharp.ts +9 -40
  104. package/src/ast/languages/dotted-index.ts +131 -0
  105. package/{extensions/explore → src}/ast/languages/file-dep-util.ts +22 -13
  106. package/src/ast/languages/fixtures/sample.cs +53 -0
  107. package/src/ast/languages/fixtures/sample.cs.expected.json +156 -0
  108. package/src/ast/languages/fixtures/sample.go +37 -0
  109. package/src/ast/languages/fixtures/sample.go.expected.json +96 -0
  110. package/src/ast/languages/fixtures/sample.java +40 -0
  111. package/src/ast/languages/fixtures/sample.java.expected.json +126 -0
  112. package/src/ast/languages/fixtures/sample.kt +31 -0
  113. package/src/ast/languages/fixtures/sample.kt.expected.json +134 -0
  114. package/src/ast/languages/fixtures/sample.md +23 -0
  115. package/src/ast/languages/fixtures/sample.md.expected.json +44 -0
  116. package/src/ast/languages/fixtures/sample.rs +54 -0
  117. package/src/ast/languages/fixtures/sample.rs.expected.json +178 -0
  118. package/src/ast/languages/fixtures/sample.swift +45 -0
  119. package/src/ast/languages/fixtures/sample.swift.expected.json +147 -0
  120. package/src/ast/languages/fixtures/sample.ts +45 -0
  121. package/src/ast/languages/fixtures/sample.ts.expected.json +141 -0
  122. package/src/ast/languages/fixtures/sample.tsx +36 -0
  123. package/src/ast/languages/fixtures/sample.tsx.expected.json +59 -0
  124. package/{extensions/explore → src}/ast/languages/go-file-deps.ts +6 -0
  125. package/{extensions/explore → src}/ast/languages/go.ts +21 -3
  126. package/{extensions/explore → src}/ast/languages/java.ts +5 -38
  127. package/src/ast/languages/jvm-file-deps.ts +135 -0
  128. package/{extensions/explore → src}/ast/languages/kotlin.ts +5 -39
  129. package/{extensions/explore → src}/ast/languages/rust-file-deps.ts +3 -3
  130. package/{extensions/explore → src}/ast/languages/rust.ts +21 -13
  131. package/{extensions/explore → src}/ast/languages/swift-file-deps.ts +22 -15
  132. package/{extensions/explore → src}/ast/languages/swift.ts +9 -39
  133. package/{extensions/explore → src}/ast/languages/tree.ts +47 -0
  134. package/{extensions/explore → src}/ast/languages/typescript-file-deps.ts +108 -0
  135. package/{extensions/explore → src}/ast/languages/typescript-package-surface.ts +4 -3
  136. package/{extensions/explore → src}/ast/languages/typescript.ts +3 -5
  137. package/{extensions/explore → src}/ast/markdown.ts +72 -47
  138. package/{extensions/explore → src}/ast/queries/ast-search.ts +164 -146
  139. package/{extensions/explore → src}/ast/queries/composite-target.ts +1 -1
  140. package/{extensions/explore → src}/ast/queries/context.ts +116 -80
  141. package/{extensions/explore → src}/ast/queries/discover.ts +154 -105
  142. package/src/ast/queries/impact.ts +291 -0
  143. package/{extensions/explore → src}/ast/queries/outline.ts +4 -2
  144. package/{extensions/explore → src}/ast/queries/show.ts +46 -42
  145. package/{extensions/explore → src}/ast/query.ts +1 -1
  146. package/{extensions/explore → src}/ast/registry.ts +1 -2
  147. package/{extensions/explore → src}/ast/scan.ts +1 -1
  148. package/src/ast/session.ts +50 -0
  149. package/{extensions/explore → src}/ast/slice.ts +8 -0
  150. package/{extensions/explore → src/ast}/traverse.ts +32 -20
  151. package/src/file-injection/index.ts +547 -0
  152. package/src/image-generation/client.ts +50 -31
  153. package/src/image-generation/index.ts +177 -134
  154. package/src/index.ts +2 -0
  155. package/src/tool-loading/index.ts +58 -0
  156. package/extensions/context/evidence.ts +0 -517
  157. package/extensions/context/projection.ts +0 -141
  158. package/extensions/context/state.ts +0 -30
  159. package/extensions/context/write-scope.ts +0 -109
  160. package/extensions/explore/ast/format/deps.ts +0 -86
  161. package/extensions/explore/ast/grammars/odin.wasm +0 -0
  162. package/extensions/explore/ast/languages/csharp-file-deps.ts +0 -189
  163. package/extensions/explore/ast/languages/fixtures/sample.cs +0 -17
  164. package/extensions/explore/ast/languages/fixtures/sample.java +0 -21
  165. package/extensions/explore/ast/languages/fixtures/sample.kt +0 -15
  166. package/extensions/explore/ast/languages/fixtures/sample.odin +0 -28
  167. package/extensions/explore/ast/languages/fixtures/sample.rs +0 -31
  168. package/extensions/explore/ast/languages/fixtures/sample.swift +0 -25
  169. package/extensions/explore/ast/languages/jvm-file-deps.ts +0 -217
  170. package/extensions/explore/ast/languages/odin-file-deps.ts +0 -175
  171. package/extensions/explore/ast/languages/odin.ts +0 -407
  172. package/extensions/explore/ast/queries/impact.ts +0 -250
  173. package/extensions/explore/outline-injection.ts +0 -151
  174. package/extensions/explore/read/autoread.ts +0 -118
  175. package/extensions/working-memory/README.md +0 -17
  176. package/extensions/working-memory/checkpoint.ts +0 -242
  177. package/extensions/working-memory/index.ts +0 -341
  178. package/extensions/working-memory/memory.ts +0 -235
  179. package/extensions/working-memory/render.ts +0 -185
  180. package/extensions/working-memory/settings.ts +0 -38
  181. package/extensions/working-memory/state.ts +0 -158
  182. package/shared/autoread.ts +0 -234
  183. package/shared/context-messages.ts +0 -19
  184. package/shared/outline-injection.ts +0 -56
  185. /package/{extensions/explore → src}/ast/format/composite.ts +0 -0
  186. /package/{extensions/explore → src}/ast/grammars/kotlin.wasm +0 -0
  187. /package/{extensions/explore → src}/ast/grammars/swift.wasm +0 -0
  188. /package/{extensions/explore → src}/ast/identity.ts +0 -0
  189. /package/{extensions/explore → src}/ast/package-surface.ts +0 -0
  190. /package/{extensions/explore/ast/read/policy.ts → src/ast/read-policy.ts} +0 -0
@@ -1,11 +1,16 @@
1
1
  import type { ExtensionAPI, ReadToolDetails } from "@earendil-works/pi-coding-agent";
2
- import { loadTauExtensionSettings } from "../../../../shared/settings/load.ts";
3
- import exploreSettings from "../../settings.ts";
4
- import { resolveExplorePath } from "../../traverse.ts";
5
- import type { ExploreEngine } from "../engine.ts";
6
- import { formatOutlineFile } from "../format/outline.ts";
7
- import { outlinePath } from "../queries/outline.ts";
8
- import { formatLargeReadOutline, readCallKind, shouldOutlineFullRead, type ExploreReadSettings } from "./policy.ts";
2
+ import { loadTauExtensionSettings } from "../../../shared/settings/load.ts";
3
+ import exploreSettings from "../settings.ts";
4
+ import { resolveExplorePath } from "../../../src/ast/traverse.ts";
5
+ import type { ExploreEngine } from "../../../src/ast/engine.ts";
6
+ import { formatOutlineFile } from "../../../src/ast/format/outline.ts";
7
+ import { outlinePath } from "../../../src/ast/queries/outline.ts";
8
+ import {
9
+ formatLargeReadOutline,
10
+ readCallKind,
11
+ shouldOutlineFullRead,
12
+ type ExploreReadSettings,
13
+ } from "../../../src/ast/read-policy.ts";
9
14
 
10
15
  type ReadOverlayResult = {
11
16
  content: Array<{ type: "text"; text: string }>;
@@ -1,37 +1,35 @@
1
1
  import { defineTool } from "@earendil-works/pi-coding-agent";
2
2
  import { Type, type Static } from "typebox";
3
- import { BoundedTextResultBuilder } from "../../../../shared/bounded-text-result.ts";
4
- import type { TemporaryOutputStore } from "../../../../shared/temporary-output-store.ts";
5
- import type { ToolRowStateStore } from "../../../../shared/tool-row-state.ts";
6
- import type { ExploreEngine } from "../engine.ts";
3
+ import { BoundedTextResultBuilder } from "../../../shared/bounded-text-result.ts";
4
+ import type { TemporaryOutputStore } from "../../../shared/temporary-output-store.ts";
5
+ import type { ToolRowStateStore } from "../../../shared/tool-row-state.ts";
6
+ import type { ExploreEngine } from "../../../src/ast/engine.ts";
7
7
  import {
8
8
  formatAstSearchEmpty,
9
9
  formatAstSearchFile,
10
10
  formatAstSearchFooters,
11
11
  groupAstSearchByFile,
12
- } from "../format/ast-search.ts";
13
- import { astSearch } from "../queries/ast-search.ts";
14
- import { formatPathForDisplay, stripLeadingAt } from "../../traverse.ts";
12
+ } from "../../../src/ast/format/ast-search.ts";
13
+ import { astSearch } from "../../../src/ast/queries/ast-search.ts";
14
+ import { formatPathForDisplay, stripLeadingAt } from "../../../src/ast/traverse.ts";
15
15
  import { ExploreCallComponent, renderExploreResult, type ExploreToolDetails } from "./render.ts";
16
16
 
17
17
  const PATTERN_MAX_BYTES = 16 * 1024;
18
18
 
19
19
  const astSearchParams = Type.Object(
20
20
  {
21
- path: Type.String({ description: "File or directory to search" }),
21
+ path: Type.String({ description: "File or directory" }),
22
22
  pattern: Type.String({
23
23
  minLength: 1,
24
24
  maxLength: PATTERN_MAX_BYTES,
25
- description:
26
- "ast-grep pattern (e.g. 'console.log($ARG)', 'foo($$$ARGS)', 'if ($COND) { $$$BODY }'). $NAME binds one node; $$$NAME binds a sibling sequence.",
25
+ description: "ast-grep pattern (max 16KiB). $NAME = node, $$$NAME = sequence, $_ = anonymous",
27
26
  }),
28
27
  language: Type.Optional(
29
28
  Type.String({
30
- description:
31
- "Engine-registered language id (typescript, tsx, go, rust, c_sharp, java, kotlin, swift, odin). Required for directories; must match file extension when both given.",
29
+ description: "Registered id: typescript, tsx, go, rust, c_sharp, java, kotlin, swift",
32
30
  }),
33
31
  ),
34
- resultLimit: Type.Integer({ minimum: 1, maximum: 100 }),
32
+ resultLimit: Type.Integer({ minimum: 1, maximum: 100, description: "Max matches (1–100)" }),
35
33
  },
36
34
  { additionalProperties: false },
37
35
  );
@@ -64,13 +62,11 @@ export function createAstSearchTool(
64
62
  name: "ast_search",
65
63
  label: "ast_search",
66
64
  description:
67
- "Find code shapes with ast-grep patterns in one file or a tree. Use $NAME for one node and $$$NAME for sibling sequences (e.g. console.log($ARG), foo($$$ARGS)). Search only — no writes. Prefer over grep when structure matters.",
68
- promptSnippet: "Structural pattern search with ast-grep metavariables",
65
+ "ast-grep structural search on one file or a directory. $NAME = node, $$$NAME = sequence, $_ = anonymous. Directory targets require language. Search only.",
66
+ promptSnippet: "ast-grep structural pattern search",
69
67
  promptGuidelines: [
70
- "Use ast_search for code shapes; harness grep for literal text.",
71
- "Pass language for directory targets (required). On a file, language is optional when the extension maps to a registered search language.",
72
- "Patterns follow ast-grep rules: $NAME one node, $$$NAME sequence, $_ anonymous. Keep resultLimit tight.",
73
- "No rewrite/write path — edits go through harness patch/edit/write.",
68
+ "Shapes here; literal text with harness grep.",
69
+ "language required for directories; on a file, omit when extension maps the language.",
74
70
  ],
75
71
  parameters: astSearchParams,
76
72
  async execute(_toolCallId, params, signal, _onUpdate, ctx) {
@@ -1,27 +1,25 @@
1
1
  import { defineTool } from "@earendil-works/pi-coding-agent";
2
2
  import { Type } from "typebox";
3
- import { BoundedTextResultBuilder } from "../../../../shared/bounded-text-result.ts";
4
- import { loadTauExtensionSettings } from "../../../../shared/settings/load.ts";
5
- import type { TemporaryOutputStore } from "../../../../shared/temporary-output-store.ts";
6
- import type { ToolRowStateStore } from "../../../../shared/tool-row-state.ts";
7
- import exploreSettings from "../../settings.ts";
8
- import type { ExploreEngine } from "../engine.ts";
9
- import { contextSectionBlocks, formatContextResult } from "../format/context.ts";
10
- import type { ExploreFileGraph } from "../graph/file-graph.ts";
11
- import { queryContext } from "../queries/context.ts";
12
- import { stripLeadingAt } from "../../traverse.ts";
3
+ import { BoundedTextResultBuilder } from "../../../shared/bounded-text-result.ts";
4
+ import { loadTauExtensionSettings } from "../../../shared/settings/load.ts";
5
+ import type { TemporaryOutputStore } from "../../../shared/temporary-output-store.ts";
6
+ import type { ToolRowStateStore } from "../../../shared/tool-row-state.ts";
7
+ import exploreSettings from "../settings.ts";
8
+ import type { ExploreEngine } from "../../../src/ast/engine.ts";
9
+ import { contextSectionBlocks, formatContextResult } from "../../../src/ast/format/context.ts";
10
+ import type { ExploreFileGraph } from "../../../src/ast/graph/file-graph.ts";
11
+ import { queryContext } from "../../../src/ast/queries/context.ts";
12
+ import { stripLeadingAt } from "../../../src/ast/traverse.ts";
13
13
  import { ExploreCallComponent, renderExploreResult, type ExploreToolDetails } from "./render.ts";
14
+ import { targetParams } from "./target-params.ts";
14
15
 
15
16
  const contextParams = Type.Object(
16
17
  {
17
- path: Type.String({ description: "Directory scope (repo/package/subtree)" }),
18
- targetPath: Type.Optional(Type.String({ description: "Defining file when known" })),
19
- name: Type.String({ minLength: 1, description: "Declaration name; may be dotted (Type.method)" }),
20
- line: Type.Optional(Type.Integer({ minimum: 1, description: "1-indexed line to pin one candidate" })),
18
+ ...targetParams,
21
19
  budget: Type.Optional(
22
20
  Type.Integer({
23
21
  minimum: 1,
24
- description: "Token pack budget (default from explore.context.defaultBudgetTokens)",
22
+ description: "Token budget (default from settings)",
25
23
  }),
26
24
  ),
27
25
  },
@@ -38,14 +36,9 @@ export function createContextTool(
38
36
  name: "context",
39
37
  label: "context",
40
38
  description:
41
- "Budgeted pack to understand one symbol in one call: target body, nearby callees/callers or type members/implementors. Raise budget if truncated. Use impact for full blast radius.",
42
- promptSnippet: "Budgeted read pack for one symbol",
43
- promptGuidelines: [
44
- "Use when you need bodies/signatures around one symbol under a token budget.",
45
- "Raise budget if entries are signature-only or truncated.",
46
- "Use impact for full dependents list; context is a sample pack.",
47
- "Callable and type targets only.",
48
- ],
39
+ "Budgeted pack for one callable/type: target body/signature plus nearby related decls. Default budget explore.context.defaultBudgetTokens (8000) when omitted. Sample, not full dependents — use impact for that. Soft-errors as text.",
40
+ promptSnippet: "Budgeted pack around one symbol",
41
+ promptGuidelines: ["Raise budget if entries are signature-only or footer says truncated."],
49
42
  parameters: contextParams,
50
43
  async execute(_toolCallId, params, signal, _onUpdate, ctx) {
51
44
  const engine = engineFor(ctx.cwd);
@@ -1,18 +1,18 @@
1
1
  import { defineTool } from "@earendil-works/pi-coding-agent";
2
2
  import { Type } from "typebox";
3
- import { truncateBoundedHead } from "../../../../shared/bounded-text-result.ts";
4
- import type { ToolRowStateStore } from "../../../../shared/tool-row-state.ts";
5
- import type { ExploreEngine } from "../engine.ts";
6
- import { formatDepsEmpty, formatDepsResult } from "../format/deps.ts";
7
- import type { ExploreFileGraph } from "../graph/file-graph.ts";
8
- import { stripLeadingAt } from "../../traverse.ts";
3
+ import { truncateBoundedHead } from "../../../shared/bounded-text-result.ts";
4
+ import type { ToolRowStateStore } from "../../../shared/tool-row-state.ts";
5
+ import type { ExploreEngine } from "../../../src/ast/engine.ts";
6
+ import { formatDepsEmpty, formatDepsResult } from "../../../src/ast/format/deps.ts";
7
+ import type { ExploreFileGraph } from "../../../src/ast/graph/file-graph.ts";
8
+ import { stripLeadingAt } from "../../../src/ast/traverse.ts";
9
9
  import { ExploreCallComponent, renderExploreResult, type ExploreToolDetails } from "./render.ts";
10
10
 
11
11
  const depsParams = Type.Object(
12
12
  {
13
13
  path: Type.String({ description: "Source file" }),
14
- depth: Type.Optional(Type.Integer({ minimum: 1, description: "Traversal depth (default 1)" })),
15
- resultLimit: Type.Integer({ minimum: 1, maximum: 100, description: "Max dependent entries to return" }),
14
+ depth: Type.Optional(Type.Integer({ minimum: 1, description: "BFS depth (default 1)" })),
15
+ resultLimit: Type.Integer({ minimum: 1, maximum: 100, description: "Max entries (1–100)" }),
16
16
  },
17
17
  { additionalProperties: false },
18
18
  );
@@ -26,13 +26,9 @@ export function createDepsTool(
26
26
  name: "deps",
27
27
  label: "deps",
28
28
  description:
29
- "File-level: what this file imports/depends on. Depth > 1 walks the internal import graph (BFS). External packages are listed last.",
30
- promptSnippet: "List file imports and dependencies",
31
- promptGuidelines: [
32
- "Use for file-level dependency orientation, not symbol callees.",
33
- "Increase depth only when transitive internal imports matter.",
34
- "Tighten resultLimit when output is large.",
35
- ],
29
+ "File-level imports for one source file. depth>1 = BFS through internal imports. External packages listed last. Not symbol callees.",
30
+ promptSnippet: "File imports / dependency graph",
31
+ promptGuidelines: ["Raise depth only for transitive internal imports; tighten resultLimit if noisy."],
36
32
  parameters: depsParams,
37
33
  async execute(_toolCallId, params, signal, _onUpdate, ctx) {
38
34
  const engine = engineFor(ctx.cwd);
@@ -1,19 +1,19 @@
1
1
  import { StringEnum } from "@earendil-works/pi-ai";
2
2
  import { defineTool } from "@earendil-works/pi-coding-agent";
3
3
  import { Type, type Static } from "typebox";
4
- import { BoundedTextResultBuilder } from "../../../../shared/bounded-text-result.ts";
5
- import type { TemporaryOutputStore } from "../../../../shared/temporary-output-store.ts";
6
- import type { ToolRowStateStore } from "../../../../shared/tool-row-state.ts";
7
- import type { DeclKind } from "../ir.ts";
4
+ import { BoundedTextResultBuilder } from "../../../shared/bounded-text-result.ts";
5
+ import type { TemporaryOutputStore } from "../../../shared/temporary-output-store.ts";
6
+ import type { ToolRowStateStore } from "../../../shared/tool-row-state.ts";
7
+ import type { DeclKind } from "../../../src/ast/ir.ts";
8
8
  import {
9
9
  formatDiscoverEmpty,
10
10
  formatDiscoverFile,
11
11
  formatDiscoverFooters,
12
12
  groupDiscoverByFile,
13
- } from "../format/discover.ts";
14
- import { discover, type DiscoverQuery, type DiscoverSurface } from "../queries/discover.ts";
15
- import type { ExploreEngine } from "../engine.ts";
16
- import { formatPathForDisplay, stripLeadingAt } from "../../traverse.ts";
13
+ } from "../../../src/ast/format/discover.ts";
14
+ import { discover, type DiscoverQuery, type DiscoverSurface } from "../../../src/ast/queries/discover.ts";
15
+ import type { ExploreEngine } from "../../../src/ast/engine.ts";
16
+ import { formatPathForDisplay, stripLeadingAt } from "../../../src/ast/traverse.ts";
17
17
  import { ExploreCallComponent, renderExploreResult, shrinkingListVariants, type ExploreToolDetails } from "./render.ts";
18
18
 
19
19
  const declarationKinds = [
@@ -43,7 +43,7 @@ const declarationKinds = [
43
43
 
44
44
  const discoverParams = Type.Object(
45
45
  {
46
- path: Type.String({ description: "Repository, package, or subtree directory" }),
46
+ path: Type.String({ description: "Directory scope" }),
47
47
  query: Type.Union([
48
48
  Type.Object(
49
49
  { kind: Type.Literal("exactName"), name: Type.String({ minLength: 1 }) },
@@ -84,9 +84,9 @@ const discoverParams = Type.Object(
84
84
  ),
85
85
  ]),
86
86
  surface: StringEnum(["all", "public", "private", "sourceExport", "packageSurface"] as const, {
87
- description: "Declaration or export surface to search",
87
+ description: "all | public | private | sourceExport | packageSurface",
88
88
  }),
89
- resultLimit: Type.Integer({ minimum: 1, maximum: 100 }),
89
+ resultLimit: Type.Integer({ minimum: 1, maximum: 100, description: "Max candidates (1–100)" }),
90
90
  },
91
91
  { additionalProperties: false },
92
92
  );
@@ -134,13 +134,11 @@ export function createDiscoverTool(
134
134
  name: "discover",
135
135
  label: "discover",
136
136
  description:
137
- "Find reusable declarations across a repository, package, or subtree by name, kind, or documentation. Signatures only — no bodies. Prefer package/public surfaces when looking for imports.",
138
- promptSnippet: "Find reusable declarations across a repo/package/subtree when path is unknown",
137
+ "Find decls by name/kind/docs when path is unknown. Signatures only. One query kind per call. surface selects visibility/export set; packageSurface needs a language with that capability (TS/TSX here) and a nearby package.",
138
+ promptSnippet: "Find decls by name/kind/docs across a tree",
139
139
  promptGuidelines: [
140
- "Use discover when reuse intent is known but the declaration path or exact name is not.",
141
- "Choose exactly one query kind. Keep fuzzy or documentation work limits narrow.",
142
- "Use packageSurface when the caller needs a supported public import path (languages with packageSurface capability).",
143
- "Follow up with show using path+name(+line) when a candidate needs closer inspection.",
140
+ "Prefer public/packageSurface when looking for imports; follow hits with show.",
141
+ "Keep fuzzyName / documentation maxCandidates and maxWork tight.",
144
142
  ],
145
143
  parameters: discoverParams,
146
144
  async execute(_toolCallId, params, signal, _onUpdate, ctx) {
@@ -1,32 +1,35 @@
1
1
  import { StringEnum } from "@earendil-works/pi-ai";
2
2
  import { defineTool } from "@earendil-works/pi-coding-agent";
3
3
  import { Type } from "typebox";
4
- import { BoundedTextResultBuilder } from "../../../../shared/bounded-text-result.ts";
5
- import type { TemporaryOutputStore } from "../../../../shared/temporary-output-store.ts";
6
- import type { ToolRowStateStore } from "../../../../shared/tool-row-state.ts";
7
- import type { ExploreEngine } from "../engine.ts";
8
- import { formatImpactResult, impactSectionBlocks } from "../format/impact.ts";
9
- import type { ExploreFileGraph } from "../graph/file-graph.ts";
10
- import { IMPACT_DEPTH_DEFAULT, IMPACT_DEPTH_MAX, queryImpact, type ImpactMode } from "../queries/impact.ts";
11
- import { stripLeadingAt } from "../../traverse.ts";
4
+ import { BoundedTextResultBuilder } from "../../../shared/bounded-text-result.ts";
5
+ import type { TemporaryOutputStore } from "../../../shared/temporary-output-store.ts";
6
+ import type { ToolRowStateStore } from "../../../shared/tool-row-state.ts";
7
+ import type { ExploreEngine } from "../../../src/ast/engine.ts";
8
+ import { formatImpactResult, impactSectionBlocks } from "../../../src/ast/format/impact.ts";
9
+ import type { ExploreFileGraph } from "../../../src/ast/graph/file-graph.ts";
10
+ import {
11
+ IMPACT_DEPTH_DEFAULT,
12
+ IMPACT_DEPTH_MAX,
13
+ queryImpact,
14
+ type ImpactMode,
15
+ } from "../../../src/ast/queries/impact.ts";
16
+ import { stripLeadingAt } from "../../../src/ast/traverse.ts";
12
17
  import { ExploreCallComponent, renderExploreResult, type ExploreToolDetails } from "./render.ts";
18
+ import { targetParams } from "./target-params.ts";
13
19
 
14
20
  const impactParams = Type.Object(
15
21
  {
16
- path: Type.String({ description: "Directory scope (repo/package/subtree)" }),
17
- targetPath: Type.Optional(Type.String({ description: "Defining file when known" })),
18
- name: Type.String({ minLength: 1, description: "Declaration name; may be dotted (Type.method)" }),
19
- line: Type.Optional(Type.Integer({ minimum: 1, description: "1-indexed line to pin one candidate" })),
22
+ ...targetParams,
20
23
  depth: Type.Optional(
21
24
  Type.Integer({
22
25
  minimum: 1,
23
26
  maximum: IMPACT_DEPTH_MAX,
24
- description: `File-transitive reverse depth (default ${IMPACT_DEPTH_DEFAULT}, max ${IMPACT_DEPTH_MAX}). Symbol hops are always 1.`,
27
+ description: `Reverse file BFS depth (default ${IMPACT_DEPTH_DEFAULT}, max ${IMPACT_DEPTH_MAX})`,
25
28
  }),
26
29
  ),
27
30
  mode: Type.Optional(
28
31
  StringEnum(["all", "deps", "dependents"] as const, {
29
- description: "all = both sides; deps = callees+imports; dependents = callers+importers+transitive",
32
+ description: "all | deps | dependents",
30
33
  }),
31
34
  ),
32
35
  },
@@ -43,15 +46,9 @@ export function createImpactTool(
43
46
  name: "impact",
44
47
  label: "impact",
45
48
  description:
46
- "One-call blast radius for a symbol: callees, callers, file imports, file importers, transitive file dependents. Narrow path scope. depth is file-transitive only.",
47
- promptSnippet: "Blast radius before a non-trivial edit",
48
- promptGuidelines: [
49
- "Use before a non-trivial edit to see symbol and nearby file dependents.",
50
- "Narrow path scope — whole-repo impact is not the goal.",
51
- "depth applies only to reverse file dependents (not multi-hop symbol callers).",
52
- "mode=deps for outbound only; mode=dependents for inbound only.",
53
- "Callable and type targets only.",
54
- ],
49
+ "Blast radius for one callable/type: callees, callers, file imports/importers, transitive file dependents. path is narrow directory scope. depth (default 2, max 5) is file reverse-BFS only; symbol hops stay 1. mode=all|deps|dependents. Soft-errors and notes as text.",
50
+ promptSnippet: "Symbol + file blast radius",
51
+ promptGuidelines: ["Run before non-trivial edits; keep path narrow — not whole-repo."],
55
52
  parameters: impactParams,
56
53
  async execute(_toolCallId, params, signal, _onUpdate, ctx) {
57
54
  const engine = engineFor(ctx.cwd);
@@ -1,34 +1,33 @@
1
1
  import { defineTool } from "@earendil-works/pi-coding-agent";
2
2
  import { Type, type Static } from "typebox";
3
- import { BoundedTextResultBuilder } from "../../../../shared/bounded-text-result.ts";
4
- import type { TemporaryOutputStore } from "../../../../shared/temporary-output-store.ts";
5
- import type { ToolRowStateStore } from "../../../../shared/tool-row-state.ts";
6
- import type { ExploreEngine } from "../engine.ts";
7
- import { formatOutlineBudgetFooter, formatOutlineEmpty, formatOutlineFile } from "../format/outline.ts";
8
- import { outlinePath, outlineRecursive, type OutlineFileView, type OutlineOptions } from "../queries/outline.ts";
9
- import { formatPathForDisplay, stripLeadingAt } from "../../traverse.ts";
3
+ import { BoundedTextResultBuilder } from "../../../shared/bounded-text-result.ts";
4
+ import type { TemporaryOutputStore } from "../../../shared/temporary-output-store.ts";
5
+ import type { ToolRowStateStore } from "../../../shared/tool-row-state.ts";
6
+ import type { ExploreEngine } from "../../../src/ast/engine.ts";
7
+ import { formatOutlineBudgetFooter, formatOutlineEmpty, formatOutlineFile } from "../../../src/ast/format/outline.ts";
8
+ import {
9
+ outlinePath,
10
+ outlineRecursive,
11
+ type OutlineFileView,
12
+ type OutlineOptions,
13
+ } from "../../../src/ast/queries/outline.ts";
14
+ import { formatPathForDisplay, stripLeadingAt } from "../../../src/ast/traverse.ts";
10
15
  import { ExploreCallComponent, renderExploreResult, shrinkingListVariants, type ExploreToolDetails } from "./render.ts";
11
16
 
12
17
  const outlineParams = Type.Object(
13
18
  {
14
19
  path: Type.String({
15
- description: "Supported source file, package directory, or subtree",
20
+ description: "File, package dir, or subtree",
16
21
  }),
17
- includePrivate: Type.Optional(
18
- Type.Boolean({ description: "Include private declarations and members (default false)" }),
19
- ),
20
- includeDocs: Type.Optional(
21
- Type.Boolean({ description: "Include attached documentation comments (default false)" }),
22
- ),
22
+ includePrivate: Type.Optional(Type.Boolean({ description: "Include non-public decls (default false)" })),
23
+ includeDocs: Type.Optional(Type.Boolean({ description: "Include attached docs (default false)" })),
23
24
  names: Type.Optional(
24
25
  Type.Array(Type.String({ minLength: 1 }), {
25
26
  minItems: 1,
26
- description: "Exact declaration name or qualifiedName filters",
27
+ description: "Exact name / qualifiedName filter",
27
28
  }),
28
29
  ),
29
- recursive: Type.Optional(
30
- Type.Boolean({ description: "Recursively outline every supported source file below a directory" }),
31
- ),
30
+ recursive: Type.Optional(Type.Boolean({ description: "Walk whole subtree" })),
32
31
  },
33
32
  { additionalProperties: false },
34
33
  );
@@ -100,13 +99,11 @@ export function createOutlineTool(
100
99
  name: "outline",
101
100
  label: "outline",
102
101
  description:
103
- "Inspect declarations in one supported source file, one non-recursive package directory, or a recursive mixed-language subtree without returning implementation bodies. Line ranges support follow-up show or ranged read.",
104
- promptSnippet: "Inspect declarations and structure without reading implementation bodies",
102
+ "Declaration map for one file, one package dir, or a recursive subtree. Signatures and ranges only — no bodies. Private/docs off by default. Recursive walks every supported language under path.",
103
+ promptSnippet: "Declaration map without bodies",
105
104
  promptGuidelines: [
106
- "Set recursive=true to orient an unfamiliar repository or subtree across supported languages.",
107
- "Leave includePrivate off for surface discovery; enable it only for targeted internal implementation work.",
108
- "Leave includeDocs off when names and signatures answer the question; enable it only when documentation comments matter.",
109
- "Use show with path+name (and optional line) when exact signature or declaration source is needed.",
105
+ "recursive=true for unfamiliar trees; single path otherwise.",
106
+ "includePrivate / includeDocs only when surface names are not enough.",
110
107
  ],
111
108
  parameters: outlineParams,
112
109
  async execute(_toolCallId, params, signal, _onUpdate, ctx) {
@@ -1,21 +1,19 @@
1
1
  import { defineTool } from "@earendil-works/pi-coding-agent";
2
2
  import { Type } from "typebox";
3
- import { truncateBoundedHead } from "../../../../shared/bounded-text-result.ts";
4
- import type { ToolRowStateStore } from "../../../../shared/tool-row-state.ts";
5
- import type { ExploreEngine } from "../engine.ts";
6
- import { formatRelationshipResult } from "../format/relationships.ts";
7
- import type { ExploreFileGraph } from "../graph/file-graph.ts";
8
- import { queryRelationships, type RelationshipOp } from "../graph/relationships.ts";
9
- import { stripLeadingAt } from "../../traverse.ts";
3
+ import { truncateBoundedHead } from "../../../shared/bounded-text-result.ts";
4
+ import type { ToolRowStateStore } from "../../../shared/tool-row-state.ts";
5
+ import type { ExploreEngine } from "../../../src/ast/engine.ts";
6
+ import { formatRelationshipResult } from "../../../src/ast/format/relationships.ts";
7
+ import type { ExploreFileGraph } from "../../../src/ast/graph/file-graph.ts";
8
+ import { queryRelationships, type RelationshipOp } from "../../../src/ast/graph/relationships.ts";
9
+ import { stripLeadingAt } from "../../../src/ast/traverse.ts";
10
10
  import { ExploreCallComponent, renderExploreResult, type ExploreToolDetails } from "./render.ts";
11
+ import { targetParams } from "./target-params.ts";
11
12
 
12
13
  const relationshipParams = Type.Object(
13
14
  {
14
- path: Type.String({ description: "Directory scope (repo/package/subtree)" }),
15
- targetPath: Type.Optional(Type.String({ description: "Defining file when known" })),
16
- name: Type.String({ minLength: 1, description: "Declaration name; may be dotted (Type.method)" }),
17
- line: Type.Optional(Type.Integer({ minimum: 1, description: "1-indexed line to pin one candidate" })),
18
- resultLimit: Type.Integer({ minimum: 1, maximum: 100, description: "Max sites to return" }),
15
+ ...targetParams,
16
+ resultLimit: Type.Integer({ minimum: 1, maximum: 100, description: "Max sites (1–100)" }),
19
17
  },
20
18
  { additionalProperties: false },
21
19
  );
@@ -92,12 +90,11 @@ export function createCallersTool(
92
90
  ) {
93
91
  return createRelationshipTool(
94
92
  "callers",
95
- "Syntactic call sites of a declaration. For types: constructions and implementors.",
96
- "Find callers of a symbol",
93
+ "Inbound syntactic sites for one decl (calls/constructs/implementors for types). Scope is a directory. Ambiguous name → candidate list, not sites. Soft-errors return as text.",
94
+ "Inbound call/construct sites",
97
95
  [
98
- "Use after selecting a change target when inbound uses affect the plan.",
99
- "Disambiguate with targetPath or line when the name is common.",
100
- "Treat ambiguous sites as non-actionable until tightened.",
96
+ "Disambiguate with targetPath or line before acting on hits.",
97
+ "Respect certainty: exact silent; inferred/ambiguous labeled; ambiguous not actionable.",
101
98
  ],
102
99
  rowState,
103
100
  engineFor,
@@ -112,9 +109,9 @@ export function createCalleesTool(
112
109
  ) {
113
110
  return createRelationshipTool(
114
111
  "callees",
115
- "Direct callees inside a declaration body. For types: ancestor types from heritage.",
116
- "Find callees of a symbol",
117
- ["Direct only — no depth parameter.", "Use to skim outbound dependencies before editing a body."],
112
+ "Direct outbound sites inside one decl body (heritage ancestors for types). One hop only. Same resolve/soft-error protocol as callers.",
113
+ "Direct callees / heritage",
114
+ [],
118
115
  rowState,
119
116
  engineFor,
120
117
  graphFor,
@@ -128,12 +125,9 @@ export function createReferencesTool(
128
125
  ) {
129
126
  return createRelationshipTool(
130
127
  "references",
131
- "Direct references: calls, constructions, imports, and heritage mentions of a declaration.",
132
- "Find references to a symbol",
133
- [
134
- "Includes import and re-export-style bindings when classified.",
135
- "Not a full IDE rename set — respect certainty labels.",
136
- ],
128
+ "Direct references: calls, constructs, imports/re-exports, heritage mentions. Not a full rename set. Same resolve/soft-error protocol as callers.",
129
+ "Direct references to a symbol",
130
+ ["Certainty labels are incomplete for rename — verify before bulk edit."],
137
131
  rowState,
138
132
  engineFor,
139
133
  graphFor,
@@ -147,12 +141,9 @@ export function createImplementationsTool(
147
141
  ) {
148
142
  return createRelationshipTool(
149
143
  "implementations",
150
- "Syntactic inheritance/implementation sites and conservative same-name overrides.",
151
- "Find implementations of a type or method",
152
- [
153
- "For types: heritage clauses naming the target.",
154
- "For methods: same-name methods on types that extend/implement the owner (conservative).",
155
- ],
144
+ "Heritage implementors of a type, or same-name methods on extending types (conservative). Same resolve/soft-error protocol as callers.",
145
+ "Implementors / overrides",
146
+ ["Method matches are name-based on subtype owners — not semantic override resolution."],
156
147
  rowState,
157
148
  engineFor,
158
149
  graphFor,
@@ -1,6 +1,6 @@
1
1
  import { formatSize, keyHint, type Theme } from "@earendil-works/pi-coding-agent";
2
2
  import { Text, truncateToWidth, visibleWidth, type Component } from "@earendil-works/pi-tui";
3
- import { formatToolRowTitle, type ToolRowStateStore } from "../../../../shared/tool-row-state.ts";
3
+ import { formatToolRowTitle, type ToolRowStateStore } from "../../../shared/tool-row-state.ts";
4
4
 
5
5
  export type ExploreToolDetails = {
6
6
  declarationCount: number;
@@ -1,18 +1,18 @@
1
1
  import { defineTool } from "@earendil-works/pi-coding-agent";
2
2
  import { Type } from "typebox";
3
- import { truncateBoundedHead } from "../../../../shared/bounded-text-result.ts";
4
- import type { ToolRowStateStore } from "../../../../shared/tool-row-state.ts";
5
- import type { ExploreEngine } from "../engine.ts";
6
- import { formatDepsResult, formatReverseDepsEmpty } from "../format/deps.ts";
7
- import type { ExploreFileGraph } from "../graph/file-graph.ts";
8
- import { stripLeadingAt } from "../../traverse.ts";
3
+ import { truncateBoundedHead } from "../../../shared/bounded-text-result.ts";
4
+ import type { ToolRowStateStore } from "../../../shared/tool-row-state.ts";
5
+ import type { ExploreEngine } from "../../../src/ast/engine.ts";
6
+ import { formatDepsResult, formatReverseDepsEmpty } from "../../../src/ast/format/deps.ts";
7
+ import type { ExploreFileGraph } from "../../../src/ast/graph/file-graph.ts";
8
+ import { stripLeadingAt } from "../../../src/ast/traverse.ts";
9
9
  import { ExploreCallComponent, renderExploreResult, type ExploreToolDetails } from "./render.ts";
10
10
 
11
11
  const reverseDepsParams = Type.Object(
12
12
  {
13
13
  path: Type.String({ description: "Source file" }),
14
- depth: Type.Optional(Type.Integer({ minimum: 1, description: "Traversal depth (default 1)" })),
15
- resultLimit: Type.Integer({ minimum: 1, maximum: 100, description: "Max importer entries to return" }),
14
+ depth: Type.Optional(Type.Integer({ minimum: 1, description: "BFS depth (default 1)" })),
15
+ resultLimit: Type.Integer({ minimum: 1, maximum: 100, description: "Max importers (1–100)" }),
16
16
  },
17
17
  { additionalProperties: false },
18
18
  );
@@ -26,13 +26,9 @@ export function createReverseDepsTool(
26
26
  name: "reverse_deps",
27
27
  label: "reverse_deps",
28
28
  description:
29
- "File-level: who imports this file within the inferred project scope. Depth > 1 walks transitive importers (BFS).",
30
- promptSnippet: "List files that import this file",
31
- promptGuidelines: [
32
- "Use for file-level reverse dependencies, not symbol callers.",
33
- "Scope is session cwd when the file is under it, else nearest git root.",
34
- "Tighten resultLimit on large packages.",
35
- ],
29
+ "File-level importers of one source file in project scope (cwd if under it, else nearest git root). depth>1 = transitive BFS. Not symbol callers.",
30
+ promptSnippet: "Who imports this file",
31
+ promptGuidelines: ["Tighten resultLimit on large packages."],
36
32
  parameters: reverseDepsParams,
37
33
  async execute(_toolCallId, params, signal, _onUpdate, ctx) {
38
34
  const engine = engineFor(ctx.cwd);