@shanepadgett/tau-agent 0.33.0 → 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 +130 -93
  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
@@ -0,0 +1,147 @@
1
+ {
2
+ "languageId": "swift",
3
+ "parseDegraded": false,
4
+ "imports": [
5
+ "Foundation"
6
+ ],
7
+ "decls": [
8
+ {
9
+ "kind": "class",
10
+ "qualifiedName": "Greeter",
11
+ "visibility": "public",
12
+ "exported": true,
13
+ "children": [
14
+ {
15
+ "kind": "property",
16
+ "qualifiedName": "Greeter.name",
17
+ "visibility": "public",
18
+ "exported": true,
19
+ "children": []
20
+ },
21
+ {
22
+ "kind": "constructor",
23
+ "qualifiedName": "Greeter.init",
24
+ "visibility": "public",
25
+ "exported": true,
26
+ "children": []
27
+ },
28
+ {
29
+ "kind": "constructor",
30
+ "qualifiedName": "Greeter.init",
31
+ "visibility": "public",
32
+ "exported": true,
33
+ "children": []
34
+ },
35
+ {
36
+ "kind": "method",
37
+ "qualifiedName": "Greeter.hello",
38
+ "visibility": "public",
39
+ "exported": true,
40
+ "children": []
41
+ },
42
+ {
43
+ "kind": "method",
44
+ "qualifiedName": "Greeter.deinit",
45
+ "visibility": "internal",
46
+ "exported": false,
47
+ "children": []
48
+ },
49
+ {
50
+ "kind": "method",
51
+ "qualifiedName": "Greeter.shout",
52
+ "visibility": "public",
53
+ "exported": true,
54
+ "children": []
55
+ }
56
+ ]
57
+ },
58
+ {
59
+ "kind": "interface",
60
+ "qualifiedName": "Named",
61
+ "visibility": "public",
62
+ "exported": true,
63
+ "children": [
64
+ {
65
+ "kind": "property",
66
+ "qualifiedName": "Named.name",
67
+ "visibility": "internal",
68
+ "exported": false,
69
+ "children": []
70
+ },
71
+ {
72
+ "kind": "method",
73
+ "qualifiedName": "Named.nameLabel",
74
+ "visibility": "internal",
75
+ "exported": false,
76
+ "children": []
77
+ }
78
+ ]
79
+ },
80
+ {
81
+ "kind": "struct",
82
+ "qualifiedName": "Box",
83
+ "visibility": "internal",
84
+ "exported": false,
85
+ "children": [
86
+ {
87
+ "kind": "property",
88
+ "qualifiedName": "Box.value",
89
+ "visibility": "internal",
90
+ "exported": false,
91
+ "children": []
92
+ }
93
+ ]
94
+ },
95
+ {
96
+ "kind": "enum",
97
+ "qualifiedName": "Color",
98
+ "visibility": "private",
99
+ "exported": false,
100
+ "children": [
101
+ {
102
+ "kind": "enumMember",
103
+ "qualifiedName": "Color.red",
104
+ "visibility": "public",
105
+ "exported": true,
106
+ "children": []
107
+ },
108
+ {
109
+ "kind": "enumMember",
110
+ "qualifiedName": "Color.green",
111
+ "visibility": "public",
112
+ "exported": true,
113
+ "children": []
114
+ }
115
+ ]
116
+ },
117
+ {
118
+ "kind": "typeAlias",
119
+ "qualifiedName": "Alias",
120
+ "visibility": "public",
121
+ "exported": true,
122
+ "children": []
123
+ },
124
+ {
125
+ "kind": "enum",
126
+ "qualifiedName": "Result",
127
+ "visibility": "public",
128
+ "exported": true,
129
+ "children": [
130
+ {
131
+ "kind": "enumMember",
132
+ "qualifiedName": "Result.ok",
133
+ "visibility": "public",
134
+ "exported": true,
135
+ "children": []
136
+ },
137
+ {
138
+ "kind": "enumMember",
139
+ "qualifiedName": "Result.err",
140
+ "visibility": "public",
141
+ "exported": true,
142
+ "children": []
143
+ }
144
+ ]
145
+ }
146
+ ]
147
+ }
@@ -0,0 +1,45 @@
1
+ import { readFile } from "node:fs/promises";
2
+ import type { Reader } from "./types.ts";
3
+
4
+ /** Priority QUEUE of pending work. */
5
+ export class Queue implements Reader {
6
+ private size = 0;
7
+
8
+ constructor(public readonly name: string) {}
9
+
10
+ enqueue(item: string): void {
11
+ void item;
12
+ this.size += 1;
13
+ }
14
+
15
+ get length(): number {
16
+ return this.size;
17
+ }
18
+ }
19
+
20
+ export abstract class BaseStore {
21
+ abstract load(): Promise<string>;
22
+ }
23
+
24
+ export interface Reader {
25
+ length: number;
26
+ }
27
+
28
+ export type OutlineRow = { depth: number; name: string };
29
+
30
+ export enum Color {
31
+ Red = "red",
32
+ Green = "green",
33
+ }
34
+
35
+ export const MAX = 10;
36
+
37
+ export function outlinePath(): void {}
38
+
39
+ export namespace Nested {
40
+ export function inner(): number {
41
+ return 1;
42
+ }
43
+ }
44
+
45
+ function hidden(): void {}
@@ -0,0 +1,141 @@
1
+ {
2
+ "languageId": "typescript",
3
+ "parseDegraded": false,
4
+ "imports": [
5
+ "node:fs/promises",
6
+ "./types.ts"
7
+ ],
8
+ "decls": [
9
+ {
10
+ "kind": "class",
11
+ "qualifiedName": "Queue",
12
+ "visibility": "public",
13
+ "exported": true,
14
+ "children": [
15
+ {
16
+ "kind": "field",
17
+ "qualifiedName": "Queue.size",
18
+ "visibility": "private",
19
+ "exported": false,
20
+ "children": []
21
+ },
22
+ {
23
+ "kind": "constructor",
24
+ "qualifiedName": "Queue.constructor",
25
+ "visibility": "public",
26
+ "exported": false,
27
+ "children": []
28
+ },
29
+ {
30
+ "kind": "method",
31
+ "qualifiedName": "Queue.enqueue",
32
+ "visibility": "public",
33
+ "exported": false,
34
+ "children": []
35
+ },
36
+ {
37
+ "kind": "method",
38
+ "qualifiedName": "Queue.length",
39
+ "visibility": "public",
40
+ "exported": false,
41
+ "children": []
42
+ }
43
+ ]
44
+ },
45
+ {
46
+ "kind": "class",
47
+ "qualifiedName": "BaseStore",
48
+ "visibility": "public",
49
+ "exported": true,
50
+ "children": [
51
+ {
52
+ "kind": "method",
53
+ "qualifiedName": "BaseStore.load",
54
+ "visibility": "public",
55
+ "exported": false,
56
+ "children": []
57
+ }
58
+ ]
59
+ },
60
+ {
61
+ "kind": "interface",
62
+ "qualifiedName": "Reader",
63
+ "visibility": "public",
64
+ "exported": true,
65
+ "children": [
66
+ {
67
+ "kind": "property",
68
+ "qualifiedName": "Reader.length",
69
+ "visibility": "public",
70
+ "exported": false,
71
+ "children": []
72
+ }
73
+ ]
74
+ },
75
+ {
76
+ "kind": "typeAlias",
77
+ "qualifiedName": "OutlineRow",
78
+ "visibility": "public",
79
+ "exported": true,
80
+ "children": []
81
+ },
82
+ {
83
+ "kind": "enum",
84
+ "qualifiedName": "Color",
85
+ "visibility": "public",
86
+ "exported": true,
87
+ "children": [
88
+ {
89
+ "kind": "enumMember",
90
+ "qualifiedName": "Color.Red",
91
+ "visibility": "public",
92
+ "exported": false,
93
+ "children": []
94
+ },
95
+ {
96
+ "kind": "enumMember",
97
+ "qualifiedName": "Color.Green",
98
+ "visibility": "public",
99
+ "exported": false,
100
+ "children": []
101
+ }
102
+ ]
103
+ },
104
+ {
105
+ "kind": "constant",
106
+ "qualifiedName": "MAX",
107
+ "visibility": "public",
108
+ "exported": true,
109
+ "children": []
110
+ },
111
+ {
112
+ "kind": "function",
113
+ "qualifiedName": "outlinePath",
114
+ "visibility": "public",
115
+ "exported": true,
116
+ "children": []
117
+ },
118
+ {
119
+ "kind": "namespace",
120
+ "qualifiedName": "Nested",
121
+ "visibility": "public",
122
+ "exported": true,
123
+ "children": [
124
+ {
125
+ "kind": "function",
126
+ "qualifiedName": "Nested.inner",
127
+ "visibility": "public",
128
+ "exported": true,
129
+ "children": []
130
+ }
131
+ ]
132
+ },
133
+ {
134
+ "kind": "function",
135
+ "qualifiedName": "hidden",
136
+ "visibility": "public",
137
+ "exported": false,
138
+ "children": []
139
+ }
140
+ ]
141
+ }
@@ -0,0 +1,36 @@
1
+ import type { ReactNode } from "react";
2
+
3
+ export type Props = {
4
+ name: string;
5
+ children?: ReactNode;
6
+ };
7
+
8
+ /** Landing page shell. */
9
+ export function CatalogLanding({ name, children }: Props) {
10
+ return (
11
+ <main className="catalog">
12
+ <h1>{name}</h1>
13
+ {children}
14
+ </main>
15
+ );
16
+ }
17
+
18
+ export const STATE: Readonly<Record<string, string>> = {
19
+ draft: "Draft",
20
+ delivery: "Delivery",
21
+ };
22
+
23
+ export const CatalogPage = define.page(async function CatalogPage({ state }) {
24
+ const catalog = await loadCatalog(state);
25
+ return <main>{catalog.name}</main>;
26
+ });
27
+
28
+ export default function DefaultPage() {
29
+ return <CatalogLanding name="home" />;
30
+ }
31
+
32
+ class PrivateWidget {
33
+ render() {
34
+ return <span />;
35
+ }
36
+ }
@@ -0,0 +1,59 @@
1
+ {
2
+ "languageId": "tsx",
3
+ "parseDegraded": false,
4
+ "imports": [
5
+ "react"
6
+ ],
7
+ "decls": [
8
+ {
9
+ "kind": "typeAlias",
10
+ "qualifiedName": "Props",
11
+ "visibility": "public",
12
+ "exported": true,
13
+ "children": []
14
+ },
15
+ {
16
+ "kind": "function",
17
+ "qualifiedName": "CatalogLanding",
18
+ "visibility": "public",
19
+ "exported": true,
20
+ "children": []
21
+ },
22
+ {
23
+ "kind": "object",
24
+ "qualifiedName": "STATE",
25
+ "visibility": "public",
26
+ "exported": true,
27
+ "children": []
28
+ },
29
+ {
30
+ "kind": "constant",
31
+ "qualifiedName": "CatalogPage",
32
+ "visibility": "public",
33
+ "exported": true,
34
+ "children": []
35
+ },
36
+ {
37
+ "kind": "function",
38
+ "qualifiedName": "DefaultPage",
39
+ "visibility": "public",
40
+ "exported": true,
41
+ "children": []
42
+ },
43
+ {
44
+ "kind": "class",
45
+ "qualifiedName": "PrivateWidget",
46
+ "visibility": "public",
47
+ "exported": false,
48
+ "children": [
49
+ {
50
+ "kind": "method",
51
+ "qualifiedName": "PrivateWidget.render",
52
+ "visibility": "public",
53
+ "exported": false,
54
+ "children": []
55
+ }
56
+ ]
57
+ }
58
+ ]
59
+ }
@@ -92,6 +92,12 @@ function firstPathElement(specifier: string): string {
92
92
  return slash === -1 ? specifier : specifier.slice(0, slash);
93
93
  }
94
94
 
95
+ /**
96
+ * Build constraints are not evaluated: a package resolves to every `.go` file in
97
+ * its directory, so mutually exclusive `//go:build` variants all appear. Every
98
+ * branch is reported on purpose — a per-configuration graph would need a build
99
+ * context this layer does not have.
100
+ */
95
101
  export const resolveGoFileDep: FileDepResolver = async (fromPath, specifier, host, signal) => {
96
102
  signal.throwIfAborted();
97
103
  const trimmed = specifier.trim().replace(/^"+|"+$/g, "");
@@ -23,6 +23,7 @@ const CAPABILITIES: LanguageCapabilities = {
23
23
  fileDeps: true,
24
24
  callEdges: true,
25
25
  packageSurface: false,
26
+ structuralImplements: true,
26
27
  };
27
28
 
28
29
  const IMPORT_NOISE = new Set([
@@ -89,6 +90,7 @@ const INTERFACE_TYPE = "interface_type";
89
90
  const FIELD_DECLARATION_LIST = "field_declaration_list";
90
91
  const FIELD_DECLARATION = "field_declaration";
91
92
  const METHOD_ELEM = "method_elem";
93
+ const TYPE_ELEM = "type_elem";
92
94
  const CALL_EXPRESSION = "call_expression";
93
95
  const COMPOSITE_LITERAL = "composite_literal";
94
96
  const SELECTOR_EXPRESSION = "selector_expression";
@@ -171,7 +173,8 @@ function goExported(name: string): boolean {
171
173
  }
172
174
 
173
175
  function visibilityFor(name: string): Visibility {
174
- return goExported(name) ? "public" : "private";
176
+ // Go has no file-private level: lowercase is package-visible, the analogue of pub(crate).
177
+ return goExported(name) ? "public" : "internal";
175
178
  }
176
179
 
177
180
  function receiverTypeName(receiver: Node): string {
@@ -257,6 +260,20 @@ function interfaceMethods(iface: Node, owner: string): Decl[] {
257
260
  return out;
258
261
  }
259
262
 
263
+ /** Embedded interface names in an interface body (`type_elem` children). */
264
+ function interfaceEmbeds(iface: Node): string[] {
265
+ const out: string[] = [];
266
+ for (const node of iface.namedChildren) {
267
+ if (node.type !== TYPE_ELEM) continue;
268
+ const text = node.text.trim();
269
+ // Type sets (`~int | string`) are constraints, not embedded interfaces.
270
+ if (text.includes("|") || text.startsWith("~")) continue;
271
+ const bare = text.includes(".") ? (text.split(".").pop() ?? text) : text;
272
+ if (/^[A-Za-z_]\w*$/u.test(bare)) out.push(bare);
273
+ }
274
+ return out;
275
+ }
276
+
260
277
  function declsFromTypeSpec(spec: Node, span: Node, doc: DocSpan | undefined): Decl[] {
261
278
  const name = nameText(field(spec, "name"));
262
279
  if (name.length === 0) return [];
@@ -292,7 +309,8 @@ function declsFromTypeSpec(spec: Node, span: Node, doc: DocSpan | undefined): De
292
309
  exported: goExported(name),
293
310
  children: interfaceMethods(typeNode, name),
294
311
  calls: [],
295
- bases: [],
312
+ // Embedded interfaces are heritage: `implementations` follows them.
313
+ bases: interfaceEmbeds(typeNode),
296
314
  },
297
315
  doc,
298
316
  );
@@ -522,7 +540,7 @@ function extractGo(tree: Tree, source: string): ExtractResult {
522
540
  for (const node of root.children) {
523
541
  if (node.isNamed || node.isError) extractFromNode(node, source, decls);
524
542
  }
525
- return { decls, imports: collectImports(root) };
543
+ return { decls, imports: collectImports(root), fileCalls: extractCalls(root) };
526
544
  }
527
545
 
528
546
  /** Bare `pkg.Call($A)` parses as type_conversion in Go; wrap as a statement call. */
@@ -3,17 +3,15 @@ import type { ExtractResult, GrammarAdapter, LanguageCapabilities } from "../ada
3
3
  import { resolveJavaFileDep } from "./jvm-file-deps.ts";
4
4
  import type { CallSite, Decl, ImportRef, Visibility } from "../ir.ts";
5
5
  import {
6
- applyDoc,
7
6
  callSite,
7
+ type DocSpan,
8
8
  docSpanBefore,
9
- endLine,
10
9
  field,
11
- finishDecl,
10
+ createLeafBuilder,
12
11
  nameText,
13
12
  qualify,
14
13
  startLine,
15
14
  walkBodyNodes,
16
- type DocSpan,
17
15
  } from "./tree.ts";
18
16
 
19
17
  const CAPABILITIES: LanguageCapabilities = {
@@ -22,6 +20,7 @@ const CAPABILITIES: LanguageCapabilities = {
22
20
  fileDeps: true,
23
21
  callEdges: true,
24
22
  packageSurface: false,
23
+ structuralImplements: false,
25
24
  };
26
25
 
27
26
  const IMPORT_NOISE = new Set([
@@ -218,39 +217,7 @@ function nameOf(node: Node): string {
218
217
  return nameText(field(node, "name"));
219
218
  }
220
219
 
221
- function leaf(
222
- node: Node,
223
- owner: string,
224
- kind: Decl["kind"],
225
- name: string,
226
- visibility: Visibility,
227
- body: Node | null,
228
- children: Decl[],
229
- doc: DocSpan | undefined,
230
- ): Decl | undefined {
231
- if (name.length === 0) return undefined;
232
- const callable = kind === "function" || kind === "method" || kind === "constructor";
233
- const typeLike = kind === "class" || kind === "interface" || kind === "enum" || kind === "struct";
234
- const decl = finishDecl(
235
- {
236
- kind,
237
- name,
238
- qualifiedName: qualify(owner, name),
239
- startLine: startLine(node),
240
- endLine: endLine(node),
241
- startOffset: node.startIndex,
242
- endOffset: node.endIndex,
243
- visibility,
244
- exported: visibility === "public",
245
- children,
246
- calls: callable ? extractCalls(body) : [],
247
- bases: typeLike ? heritageBases(node) : [],
248
- },
249
- body,
250
- );
251
- if (body === null) decl.signatureEndOffset = node.endIndex;
252
- return applyDoc(decl, doc);
253
- }
220
+ const leaf = createLeafBuilder(extractCalls, heritageBases);
254
221
 
255
222
  function declaratorNames(node: Node): string[] {
256
223
  const names: string[] = [];
@@ -396,7 +363,7 @@ function extractJava(tree: Tree, source: string): ExtractResult {
396
363
  for (const node of root.children) {
397
364
  if (node.isNamed || node.isError) decls.push(...declsFromNode(node, "", source, "internal"));
398
365
  }
399
- return { decls, imports: collectImports(root) };
366
+ return { decls, imports: collectImports(root), fileCalls: extractCalls(root) };
400
367
  }
401
368
 
402
369
  export function javaAdapter(): GrammarAdapter {