@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.
- package/docs/context.md +29 -20
- package/docs/extending-tau-agent.md +63 -24
- package/extensions/appshot/index.ts +112 -111
- package/extensions/aside/README.md +7 -0
- package/extensions/aside/index.ts +168 -0
- package/extensions/aside/panel.ts +83 -0
- package/extensions/branch/index.ts +38 -21
- package/extensions/cache-diagnostics/index.ts +70 -58
- package/extensions/checkpoint/README.md +9 -0
- package/extensions/checkpoint/checkpoint-budget.ts +79 -0
- package/extensions/checkpoint/checkpoint.ts +277 -0
- package/extensions/checkpoint/index.ts +102 -0
- package/extensions/checkpoint/messages.ts +169 -0
- package/extensions/checkpoint/prompt.ts +24 -0
- package/extensions/checkpoint/settings.ts +27 -0
- package/extensions/commit/commit-effort.ts +3 -3
- package/extensions/context/README.md +12 -8
- package/extensions/context/definitions.ts +178 -55
- package/extensions/context/index.ts +192 -160
- package/extensions/context/panel.ts +57 -37
- package/extensions/context/sync.ts +139 -89
- package/extensions/context/validation.ts +37 -25
- package/extensions/effort/README.md +1 -1
- package/extensions/effort/index.ts +3 -3
- package/extensions/effort/state.ts +3 -18
- package/extensions/explore/guidance.ts +6 -47
- package/extensions/explore/index.ts +38 -53
- package/extensions/explore/{ast/read → read}/hook.ts +12 -7
- package/extensions/explore/{ast/tools → tools}/ast-search.ts +15 -19
- package/extensions/explore/{ast/tools → tools}/context.ts +16 -23
- package/extensions/explore/{ast/tools → tools}/deps.ts +11 -15
- package/extensions/explore/{ast/tools → tools}/discover.ts +15 -17
- package/extensions/explore/{ast/tools → tools}/impact.ts +20 -23
- package/extensions/explore/{ast/tools → tools}/outline.ts +21 -24
- package/extensions/explore/{ast/tools → tools}/relationships.ts +23 -32
- package/extensions/explore/{ast/tools → tools}/render.ts +1 -1
- package/extensions/explore/{ast/tools → tools}/reverse-deps.ts +11 -15
- package/extensions/explore/{ast/tools → tools}/show.ts +16 -19
- package/extensions/explore/tools/target-params.ts +9 -0
- package/extensions/footer/index.ts +75 -56
- package/extensions/handoff/index.ts +8 -30
- package/extensions/image-gen/index.ts +46 -40
- package/extensions/patch/executor.ts +190 -135
- package/extensions/patch/matcher.ts +82 -48
- package/extensions/patch/parser.ts +149 -105
- package/extensions/patch/render.ts +32 -39
- package/extensions/patch/summary.ts +30 -26
- package/extensions/ready/README.md +7 -0
- package/extensions/ready/index.ts +58 -0
- package/extensions/ready/model.ts +128 -0
- package/extensions/ready/packs.ts +272 -0
- package/extensions/ready/render.ts +445 -0
- package/extensions/ready/scan.ts +760 -0
- package/extensions/reference/panel.ts +28 -16
- package/extensions/review/index.ts +63 -51
- package/extensions/review/panel.ts +5 -34
- package/extensions/runtime-context/context.ts +30 -26
- package/extensions/script-runner/README.md +2 -2
- package/extensions/script-runner/index.ts +122 -82
- package/extensions/silent-command-runner/index.ts +38 -23
- package/extensions/subagent/agents/context-sync.md +185 -33
- package/extensions/subagent/agents/scout.md +2 -2
- package/extensions/subagent/agents.ts +137 -84
- package/extensions/subagent/cmux-dashboard.ts +39 -30
- package/extensions/subagent/index.ts +79 -59
- package/extensions/subagent/resume.ts +1 -1
- package/extensions/subagent/run.ts +304 -193
- package/extensions/subagent/runtime.ts +781 -343
- package/extensions/tau/index.ts +47 -38
- package/extensions/tau-help/help.md +14 -6
- package/extensions/tool-loader/README.md +4 -2
- package/extensions/tool-loader/index.ts +77 -52
- package/extensions/web/index.ts +6 -3
- package/extensions/web/webfetch.ts +114 -86
- package/package.json +3 -3
- package/schemas/tau.schema.json +20 -33
- package/shared/bounded-text-result.ts +1 -0
- package/shared/checkpoint-visibility.ts +9 -0
- package/shared/events.ts +28 -10
- package/shared/isolated-session.ts +71 -29
- package/shared/model-effort.ts +9 -19
- package/shared/model-fallback/index.ts +66 -41
- package/shared/settings/load.ts +45 -38
- package/shared/temporary-output-store.ts +16 -10
- package/{extensions/explore → src}/ast/adapter.ts +11 -2
- package/{extensions/explore → src}/ast/engine.ts +54 -38
- package/{extensions/explore → src}/ast/format/ast-search.ts +15 -6
- package/{extensions/explore → src}/ast/format/context.ts +3 -6
- package/src/ast/format/deps.ts +94 -0
- package/{extensions/explore → src}/ast/format/discover.ts +2 -2
- package/{extensions/explore → src}/ast/format/impact.ts +9 -11
- package/{extensions/explore → src}/ast/format/outline.ts +2 -2
- package/{extensions/explore → src}/ast/format/relationships.ts +11 -7
- package/{extensions/explore → src}/ast/format/show.ts +1 -1
- package/src/ast/format/targeted-result.ts +20 -0
- package/src/ast/grammars/c_sharp.wasm +0 -0
- package/{extensions/explore → src}/ast/grammars/manifest.json +9 -12
- package/{extensions/explore → src}/ast/grammars/manifest.ts +0 -4
- package/{extensions/explore → src}/ast/graph/file-graph.ts +210 -98
- package/{extensions/explore → src}/ast/graph/relationships.ts +285 -72
- package/{extensions/explore → src}/ast/ir.ts +6 -0
- package/src/ast/languages/csharp-file-deps.ts +90 -0
- package/{extensions/explore → src}/ast/languages/csharp.ts +9 -40
- package/src/ast/languages/dotted-index.ts +131 -0
- package/{extensions/explore → src}/ast/languages/file-dep-util.ts +22 -13
- package/src/ast/languages/fixtures/sample.cs +53 -0
- package/src/ast/languages/fixtures/sample.cs.expected.json +156 -0
- package/src/ast/languages/fixtures/sample.go +37 -0
- package/src/ast/languages/fixtures/sample.go.expected.json +96 -0
- package/src/ast/languages/fixtures/sample.java +40 -0
- package/src/ast/languages/fixtures/sample.java.expected.json +126 -0
- package/src/ast/languages/fixtures/sample.kt +31 -0
- package/src/ast/languages/fixtures/sample.kt.expected.json +134 -0
- package/src/ast/languages/fixtures/sample.md +23 -0
- package/src/ast/languages/fixtures/sample.md.expected.json +44 -0
- package/src/ast/languages/fixtures/sample.rs +54 -0
- package/src/ast/languages/fixtures/sample.rs.expected.json +178 -0
- package/src/ast/languages/fixtures/sample.swift +45 -0
- package/src/ast/languages/fixtures/sample.swift.expected.json +147 -0
- package/src/ast/languages/fixtures/sample.ts +45 -0
- package/src/ast/languages/fixtures/sample.ts.expected.json +141 -0
- package/src/ast/languages/fixtures/sample.tsx +36 -0
- package/src/ast/languages/fixtures/sample.tsx.expected.json +59 -0
- package/{extensions/explore → src}/ast/languages/go-file-deps.ts +6 -0
- package/{extensions/explore → src}/ast/languages/go.ts +21 -3
- package/{extensions/explore → src}/ast/languages/java.ts +5 -38
- package/src/ast/languages/jvm-file-deps.ts +135 -0
- package/{extensions/explore → src}/ast/languages/kotlin.ts +5 -39
- package/{extensions/explore → src}/ast/languages/rust-file-deps.ts +3 -3
- package/{extensions/explore → src}/ast/languages/rust.ts +21 -13
- package/{extensions/explore → src}/ast/languages/swift-file-deps.ts +22 -15
- package/{extensions/explore → src}/ast/languages/swift.ts +9 -39
- package/{extensions/explore → src}/ast/languages/tree.ts +47 -0
- package/{extensions/explore → src}/ast/languages/typescript-file-deps.ts +108 -0
- package/{extensions/explore → src}/ast/languages/typescript-package-surface.ts +4 -3
- package/{extensions/explore → src}/ast/languages/typescript.ts +3 -5
- package/{extensions/explore → src}/ast/markdown.ts +72 -47
- package/{extensions/explore → src}/ast/queries/ast-search.ts +164 -146
- package/{extensions/explore → src}/ast/queries/composite-target.ts +1 -1
- package/{extensions/explore → src}/ast/queries/context.ts +116 -80
- package/{extensions/explore → src}/ast/queries/discover.ts +154 -105
- package/src/ast/queries/impact.ts +291 -0
- package/{extensions/explore → src}/ast/queries/outline.ts +4 -2
- package/{extensions/explore → src}/ast/queries/show.ts +46 -42
- package/{extensions/explore → src}/ast/query.ts +1 -1
- package/{extensions/explore → src}/ast/registry.ts +1 -2
- package/{extensions/explore → src}/ast/scan.ts +1 -1
- package/src/ast/session.ts +50 -0
- package/{extensions/explore → src}/ast/slice.ts +8 -0
- package/{extensions/explore → src/ast}/traverse.ts +32 -20
- package/src/file-injection/index.ts +547 -0
- package/src/image-generation/client.ts +50 -31
- package/src/image-generation/index.ts +177 -134
- package/src/index.ts +2 -0
- package/src/tool-loading/index.ts +58 -0
- package/extensions/context/evidence.ts +0 -517
- package/extensions/context/projection.ts +0 -141
- package/extensions/context/state.ts +0 -30
- package/extensions/context/write-scope.ts +0 -109
- package/extensions/explore/ast/format/deps.ts +0 -86
- package/extensions/explore/ast/grammars/odin.wasm +0 -0
- package/extensions/explore/ast/languages/csharp-file-deps.ts +0 -189
- package/extensions/explore/ast/languages/fixtures/sample.cs +0 -17
- package/extensions/explore/ast/languages/fixtures/sample.java +0 -21
- package/extensions/explore/ast/languages/fixtures/sample.kt +0 -15
- package/extensions/explore/ast/languages/fixtures/sample.odin +0 -28
- package/extensions/explore/ast/languages/fixtures/sample.rs +0 -31
- package/extensions/explore/ast/languages/fixtures/sample.swift +0 -25
- package/extensions/explore/ast/languages/jvm-file-deps.ts +0 -217
- package/extensions/explore/ast/languages/odin-file-deps.ts +0 -175
- package/extensions/explore/ast/languages/odin.ts +0 -407
- package/extensions/explore/ast/queries/impact.ts +0 -250
- package/extensions/explore/outline-injection.ts +0 -151
- package/extensions/explore/read/autoread.ts +0 -118
- package/extensions/working-memory/README.md +0 -17
- package/extensions/working-memory/checkpoint.ts +0 -242
- package/extensions/working-memory/index.ts +0 -341
- package/extensions/working-memory/memory.ts +0 -235
- package/extensions/working-memory/render.ts +0 -185
- package/extensions/working-memory/settings.ts +0 -38
- package/extensions/working-memory/state.ts +0 -158
- package/shared/autoread.ts +0 -234
- package/shared/context-messages.ts +0 -19
- package/shared/outline-injection.ts +0 -56
- /package/{extensions/explore → src}/ast/format/composite.ts +0 -0
- /package/{extensions/explore → src}/ast/grammars/kotlin.wasm +0 -0
- /package/{extensions/explore → src}/ast/grammars/swift.wasm +0 -0
- /package/{extensions/explore → src}/ast/identity.ts +0 -0
- /package/{extensions/explore → src}/ast/package-surface.ts +0 -0
- /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 "
|
|
3
|
-
import exploreSettings from "
|
|
4
|
-
import { resolveExplorePath } from "
|
|
5
|
-
import type { ExploreEngine } from "
|
|
6
|
-
import { formatOutlineFile } from "
|
|
7
|
-
import { outlinePath } from "
|
|
8
|
-
import {
|
|
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 "
|
|
4
|
-
import type { TemporaryOutputStore } from "
|
|
5
|
-
import type { ToolRowStateStore } from "
|
|
6
|
-
import type { ExploreEngine } from "
|
|
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 "
|
|
13
|
-
import { astSearch } from "
|
|
14
|
-
import { formatPathForDisplay, stripLeadingAt } from "
|
|
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
|
|
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
|
-
"
|
|
68
|
-
promptSnippet: "
|
|
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
|
-
"
|
|
71
|
-
"
|
|
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 "
|
|
4
|
-
import { loadTauExtensionSettings } from "
|
|
5
|
-
import type { TemporaryOutputStore } from "
|
|
6
|
-
import type { ToolRowStateStore } from "
|
|
7
|
-
import exploreSettings from "
|
|
8
|
-
import type { ExploreEngine } from "
|
|
9
|
-
import { contextSectionBlocks, formatContextResult } from "
|
|
10
|
-
import type { ExploreFileGraph } from "
|
|
11
|
-
import { queryContext } from "
|
|
12
|
-
import { stripLeadingAt } from "
|
|
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
|
-
|
|
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
|
|
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
|
|
42
|
-
promptSnippet: "Budgeted
|
|
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 "
|
|
4
|
-
import type { ToolRowStateStore } from "
|
|
5
|
-
import type { ExploreEngine } from "
|
|
6
|
-
import { formatDepsEmpty, formatDepsResult } from "
|
|
7
|
-
import type { ExploreFileGraph } from "
|
|
8
|
-
import { stripLeadingAt } from "
|
|
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: "
|
|
15
|
-
resultLimit: Type.Integer({ minimum: 1, maximum: 100, description: "Max
|
|
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
|
|
30
|
-
promptSnippet: "
|
|
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 "
|
|
5
|
-
import type { TemporaryOutputStore } from "
|
|
6
|
-
import type { ToolRowStateStore } from "
|
|
7
|
-
import type { DeclKind } from "
|
|
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 "
|
|
14
|
-
import { discover, type DiscoverQuery, type DiscoverSurface } from "
|
|
15
|
-
import type { ExploreEngine } from "
|
|
16
|
-
import { formatPathForDisplay, stripLeadingAt } from "
|
|
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: "
|
|
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: "
|
|
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
|
|
138
|
-
promptSnippet: "Find
|
|
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
|
-
"
|
|
141
|
-
"
|
|
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 "
|
|
5
|
-
import type { TemporaryOutputStore } from "
|
|
6
|
-
import type { ToolRowStateStore } from "
|
|
7
|
-
import type { ExploreEngine } from "
|
|
8
|
-
import { formatImpactResult, impactSectionBlocks } from "
|
|
9
|
-
import type { ExploreFileGraph } from "
|
|
10
|
-
import {
|
|
11
|
-
|
|
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
|
-
|
|
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: `
|
|
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
|
|
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
|
-
"
|
|
47
|
-
promptSnippet: "
|
|
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 "
|
|
4
|
-
import type { TemporaryOutputStore } from "
|
|
5
|
-
import type { ToolRowStateStore } from "
|
|
6
|
-
import type { ExploreEngine } from "
|
|
7
|
-
import { formatOutlineBudgetFooter, formatOutlineEmpty, formatOutlineFile } from "
|
|
8
|
-
import {
|
|
9
|
-
|
|
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: "
|
|
20
|
+
description: "File, package dir, or subtree",
|
|
16
21
|
}),
|
|
17
|
-
includePrivate: Type.Optional(
|
|
18
|
-
|
|
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
|
|
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
|
-
"
|
|
104
|
-
promptSnippet: "
|
|
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
|
-
"
|
|
107
|
-
"
|
|
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 "
|
|
4
|
-
import type { ToolRowStateStore } from "
|
|
5
|
-
import type { ExploreEngine } from "
|
|
6
|
-
import { formatRelationshipResult } from "
|
|
7
|
-
import type { ExploreFileGraph } from "
|
|
8
|
-
import { queryRelationships, type RelationshipOp } from "
|
|
9
|
-
import { stripLeadingAt } from "
|
|
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
|
-
|
|
15
|
-
|
|
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
|
-
"
|
|
96
|
-
"
|
|
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
|
-
"
|
|
99
|
-
"
|
|
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
|
|
116
|
-
"
|
|
117
|
-
[
|
|
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,
|
|
132
|
-
"
|
|
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
|
-
"
|
|
151
|
-
"
|
|
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 "
|
|
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 "
|
|
4
|
-
import type { ToolRowStateStore } from "
|
|
5
|
-
import type { ExploreEngine } from "
|
|
6
|
-
import { formatDepsResult, formatReverseDepsEmpty } from "
|
|
7
|
-
import type { ExploreFileGraph } from "
|
|
8
|
-
import { stripLeadingAt } from "
|
|
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: "
|
|
15
|
-
resultLimit: Type.Integer({ minimum: 1, maximum: 100, description: "Max
|
|
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
|
|
30
|
-
promptSnippet: "
|
|
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);
|