@mrclrchtr/supi-code-intelligence 11.0.1 → 11.2.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 (200) hide show
  1. package/README.md +68 -6
  2. package/gradle-helper/README.md +48 -0
  3. package/gradle-helper/build.sh +73 -0
  4. package/gradle-helper/lib/gradle-tooling-api-9.4.0.jar +0 -0
  5. package/gradle-helper/lib/slf4j-api-2.0.17.jar +0 -0
  6. package/gradle-helper/lib/slf4j-simple-2.0.17.jar +0 -0
  7. package/gradle-helper/lib/supi-gradle-observation.jar +0 -0
  8. package/gradle-helper/licenses/DEPENDENCIES.md +11 -0
  9. package/gradle-helper/licenses/LICENSE-gradle-tooling-api.txt +422 -0
  10. package/gradle-helper/licenses/LICENSE-slf4j.txt +21 -0
  11. package/gradle-helper/licenses/NOTICE-gradle.txt +21 -0
  12. package/gradle-helper/src/GradleObservation.java +597 -0
  13. package/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
  14. package/node_modules/@mrclrchtr/supi-core/package.json +1 -1
  15. package/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +41 -1
  16. package/node_modules/@mrclrchtr/supi-lsp/README.md +43 -6
  17. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
  18. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/package.json +1 -1
  19. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +41 -1
  20. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/LICENSE +15 -0
  21. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/README.md +680 -0
  22. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/bin/semver.js +195 -0
  23. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/classes/comparator.js +143 -0
  24. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/classes/index.js +7 -0
  25. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/classes/range.js +577 -0
  26. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/classes/semver.js +350 -0
  27. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/clean.js +8 -0
  28. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/cmp.js +54 -0
  29. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/coerce.js +62 -0
  30. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/compare-build.js +9 -0
  31. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/compare-loose.js +5 -0
  32. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/compare.js +7 -0
  33. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/diff.js +60 -0
  34. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/eq.js +5 -0
  35. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/gt.js +5 -0
  36. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/gte.js +5 -0
  37. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/inc.js +21 -0
  38. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/lt.js +5 -0
  39. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/lte.js +5 -0
  40. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/major.js +5 -0
  41. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/minor.js +5 -0
  42. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/neq.js +5 -0
  43. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/parse.js +18 -0
  44. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/patch.js +5 -0
  45. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/prerelease.js +8 -0
  46. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/rcompare.js +5 -0
  47. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/rsort.js +5 -0
  48. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/satisfies.js +12 -0
  49. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/sort.js +5 -0
  50. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/truncate.js +48 -0
  51. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/valid.js +8 -0
  52. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/index.js +93 -0
  53. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/internal/constants.js +37 -0
  54. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/internal/debug.js +11 -0
  55. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/internal/identifiers.js +29 -0
  56. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/internal/lrucache.js +42 -0
  57. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/internal/parse-options.js +17 -0
  58. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/internal/re.js +223 -0
  59. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/package.json +78 -0
  60. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/preload.js +4 -0
  61. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/range.bnf +17 -0
  62. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/ranges/gtr.js +6 -0
  63. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/ranges/intersects.js +9 -0
  64. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/ranges/ltr.js +6 -0
  65. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/ranges/max-satisfying.js +27 -0
  66. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/ranges/min-satisfying.js +26 -0
  67. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/ranges/min-version.js +63 -0
  68. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/ranges/outside.js +82 -0
  69. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/ranges/simplify.js +49 -0
  70. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/ranges/subset.js +249 -0
  71. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/ranges/to-comparators.js +10 -0
  72. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/ranges/valid.js +13 -0
  73. package/node_modules/@mrclrchtr/supi-lsp/node_modules/vscode-jsonrpc/README.md +5 -0
  74. package/node_modules/@mrclrchtr/supi-lsp/node_modules/vscode-jsonrpc/lib/browser/ril.js +8 -0
  75. package/node_modules/@mrclrchtr/supi-lsp/node_modules/vscode-jsonrpc/lib/common/connection.js +7 -2
  76. package/node_modules/@mrclrchtr/supi-lsp/node_modules/vscode-jsonrpc/lib/common/ral.d.ts +8 -0
  77. package/node_modules/@mrclrchtr/supi-lsp/node_modules/vscode-jsonrpc/lib/node/main.d.ts +14 -0
  78. package/node_modules/@mrclrchtr/supi-lsp/node_modules/vscode-jsonrpc/lib/node/main.js +6 -4
  79. package/node_modules/@mrclrchtr/supi-lsp/node_modules/vscode-jsonrpc/lib/node/ril.js +5 -1
  80. package/node_modules/@mrclrchtr/supi-lsp/node_modules/vscode-jsonrpc/package.json +4 -2
  81. package/node_modules/@mrclrchtr/supi-lsp/node_modules/vscode-languageserver-protocol/package.json +4 -3
  82. package/node_modules/@mrclrchtr/supi-lsp/node_modules/vscode-languageserver-types/lib/esm/main.js +2 -2
  83. package/node_modules/@mrclrchtr/supi-lsp/node_modules/vscode-languageserver-types/lib/umd/main.js +2 -2
  84. package/node_modules/@mrclrchtr/supi-lsp/node_modules/vscode-languageserver-types/package.json +2 -1
  85. package/node_modules/@mrclrchtr/supi-lsp/package.json +8 -6
  86. package/node_modules/@mrclrchtr/supi-lsp/src/client/client.ts +44 -5
  87. package/node_modules/@mrclrchtr/supi-lsp/src/config/config.ts +53 -2
  88. package/node_modules/@mrclrchtr/supi-lsp/src/config/operation-support.ts +19 -4
  89. package/node_modules/@mrclrchtr/supi-lsp/src/config/server-config.ts +22 -0
  90. package/node_modules/@mrclrchtr/supi-lsp/src/config/typescript-launch.ts +276 -0
  91. package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-project-info.ts +22 -10
  92. package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager.ts +53 -20
  93. package/node_modules/@mrclrchtr/supi-lsp/src/provider/refactor-planning.ts +4 -3
  94. package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-controller.ts +2 -2
  95. package/node_modules/@mrclrchtr/supi-lsp/src/session/scanner.ts +27 -15
  96. package/node_modules/@mrclrchtr/supi-tree-sitter/README.md +1 -0
  97. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
  98. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/package.json +1 -1
  99. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +41 -1
  100. package/node_modules/@mrclrchtr/supi-tree-sitter/package.json +5 -3
  101. package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/tsx/LICENSE +21 -0
  102. package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/tsx/tree-sitter-tsx.wasm +0 -0
  103. package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/tsx/tree-sitter-tsx.wasm.json +19 -2
  104. package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/typescript/LICENSE +21 -0
  105. package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/typescript/tree-sitter-typescript.wasm +0 -0
  106. package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/typescript/tree-sitter-typescript.wasm.json +19 -2
  107. package/node_modules/ignore/README.md +36 -10
  108. package/node_modules/ignore/index.d.ts +3 -2
  109. package/node_modules/ignore/index.js +57 -53
  110. package/node_modules/ignore/legacy.js +50 -46
  111. package/node_modules/ignore/package.json +1 -1
  112. package/package.json +11 -6
  113. package/src/analysis/capability/capability-warnings.ts +18 -12
  114. package/src/analysis/gradle/query.ts +273 -0
  115. package/src/analysis/gradle/runtime.ts +173 -0
  116. package/src/analysis/gradle/types.ts +65 -0
  117. package/src/analysis/health/check.ts +115 -0
  118. package/src/analysis/health/diagnostics.ts +3 -0
  119. package/src/analysis/health/file-scope.ts +2 -3
  120. package/src/analysis/health/semantic-state.ts +38 -0
  121. package/src/analysis/health/server-status.ts +8 -0
  122. package/src/analysis/health/signals.ts +2 -0
  123. package/src/analysis/health/status.ts +82 -0
  124. package/src/analysis/read-next.ts +1 -4
  125. package/src/analysis/refactor/apply.ts +19 -10
  126. package/src/analysis/refactor/mutation-authority.ts +4 -1
  127. package/src/analysis/search/ast-scan.ts +143 -18
  128. package/src/analysis/workspace/safe-path.ts +14 -2
  129. package/src/analysis/workspace/types.ts +2 -0
  130. package/src/extension.ts +10 -1
  131. package/src/gradle/consent.ts +279 -0
  132. package/src/headless.ts +3 -0
  133. package/src/overview/collect.ts +11 -3
  134. package/src/session/health-types.ts +7 -0
  135. package/src/session/health-workflow.ts +8 -43
  136. package/src/session/orientation/collect.ts +138 -12
  137. package/src/session/orientation/context-facts.ts +27 -2
  138. package/src/session/orientation/context-sections.ts +47 -0
  139. package/src/session/orientation/facts.ts +124 -0
  140. package/src/session/orientation/gather.ts +98 -11
  141. package/src/session/orientation/workspace-context.ts +59 -28
  142. package/src/session/orientation-types.ts +16 -1
  143. package/src/session/orientation-workflow.ts +5 -2
  144. package/src/session/refactor-plans.ts +5 -2
  145. package/src/session/refactor-workflow.ts +4 -3
  146. package/src/session/session.ts +8 -0
  147. package/src/tool/code_find/execute.ts +1 -1
  148. package/src/tool/code_find/guidance.ts +1 -1
  149. package/src/tool/code_find/markdown.ts +24 -17
  150. package/src/tool/code_find/result.ts +18 -5
  151. package/src/tool/code_find/spec.ts +2 -0
  152. package/src/tool/code_find/structured.ts +161 -0
  153. package/src/tool/code_graph/result.ts +32 -15
  154. package/src/tool/code_graph/spec.ts +2 -0
  155. package/src/tool/code_graph/structured.ts +142 -0
  156. package/src/tool/code_health/markdown.ts +17 -17
  157. package/src/tool/code_health/result.ts +15 -2
  158. package/src/tool/code_health/spec.ts +2 -0
  159. package/src/tool/code_health/structured-schema.ts +250 -0
  160. package/src/tool/code_health/structured.ts +256 -0
  161. package/src/tool/code_inspect/markdown.ts +19 -11
  162. package/src/tool/code_inspect/result.ts +12 -5
  163. package/src/tool/code_inspect/spec.ts +2 -0
  164. package/src/tool/code_inspect/structured.ts +232 -0
  165. package/src/tool/code_orientation/directory-navigation.ts +66 -0
  166. package/src/tool/code_orientation/gradle-sections.ts +68 -0
  167. package/src/tool/code_orientation/markdown.ts +19 -8
  168. package/src/tool/code_orientation/result.ts +95 -11
  169. package/src/tool/code_orientation/spec.ts +2 -0
  170. package/src/tool/code_orientation/structured-schema.ts +607 -0
  171. package/src/tool/code_orientation/structured-workspace.ts +193 -0
  172. package/src/tool/code_orientation/structured.ts +195 -0
  173. package/src/tool/code_orientation/workspace-format.ts +2 -1
  174. package/src/tool/code_orientation/workspace-observations.ts +81 -0
  175. package/src/tool/code_orientation/workspace-output.ts +45 -13
  176. package/src/tool/code_orientation/workspace-projects.ts +180 -75
  177. package/src/tool/code_orientation/workspace-sections.ts +46 -31
  178. package/src/tool/code_refactor_apply/execute.ts +1 -1
  179. package/src/tool/code_refactor_apply/result.ts +13 -5
  180. package/src/tool/code_refactor_apply/spec.ts +2 -0
  181. package/src/tool/code_refactor_apply/structured.ts +49 -0
  182. package/src/tool/code_refactor_plan/result.ts +16 -8
  183. package/src/tool/code_refactor_plan/spec.ts +2 -0
  184. package/src/tool/code_refactor_plan/structured.ts +128 -0
  185. package/src/tool/code_resolve/markdown.ts +4 -10
  186. package/src/tool/code_resolve/result.ts +2 -0
  187. package/src/tool/code_resolve/spec.ts +2 -0
  188. package/src/tool/code_resolve/structured.ts +103 -0
  189. package/src/tool/infra/truncate.ts +12 -4
  190. package/src/tool/register.ts +10 -6
  191. package/src/tool/result/display.ts +17 -0
  192. package/src/tool/result/model-budget.ts +195 -0
  193. package/src/tool/result/structured.ts +62 -0
  194. package/src/tool/result/types.ts +10 -2
  195. package/src/tool/schemas.ts +7 -1
  196. package/src/tool/specs.ts +2 -0
  197. package/src/types/execution.ts +5 -1
  198. package/src/ui/status-command.ts +110 -321
  199. package/src/ui/status-overlay.ts +564 -420
  200. package/src/ui/tui/display.ts +10 -4
@@ -0,0 +1,607 @@
1
+ // biome-ignore-all lint/style/noExcessiveLinesPerFile: the complete native contract is declared together for auditing
2
+ import { StringEnum } from "@earendil-works/pi-ai";
3
+ import { Type } from "typebox";
4
+ import {
5
+ ConfidenceSchema,
6
+ EvidenceListSchema,
7
+ NavigationTargetSchema,
8
+ ReadNextSchema,
9
+ RecoveryRangeSchema,
10
+ } from "../result/structured.ts";
11
+
12
+ const nullableString = Type.Union([Type.String(), Type.Null()]);
13
+ const coordinate = { description: "One-based line and UTF-16 character; end is exclusive." };
14
+ const SourceItem = Type.Object(
15
+ {
16
+ startLine: Type.Integer(),
17
+ startCharacter: Type.Integer(),
18
+ endLine: Type.Integer(),
19
+ endCharacter: Type.Integer(),
20
+ },
21
+ coordinate,
22
+ );
23
+ const Project = Type.Object(
24
+ {
25
+ id: Type.String(),
26
+ manifestPath: Type.String(),
27
+ kind: StringEnum(["node-package", "python-project", "rust-package", "go-module"]),
28
+ directory: Type.String(),
29
+ name: nullableString,
30
+ nameField: nullableString,
31
+ description: nullableString,
32
+ descriptionField: nullableString,
33
+ },
34
+ { additionalProperties: false },
35
+ );
36
+ const Relationship = Type.Object(
37
+ {
38
+ from: Type.String(),
39
+ to: Type.String(),
40
+ manifestPath: Type.String(),
41
+ field: Type.String(),
42
+ value: Type.Unknown(),
43
+ },
44
+ { additionalProperties: false },
45
+ );
46
+ const Provenance = Type.Object(
47
+ {
48
+ source: StringEnum([
49
+ "semantic",
50
+ "structural",
51
+ "filesystem",
52
+ "manifest",
53
+ "configuration",
54
+ "runtime",
55
+ ]),
56
+ capability: Type.Optional(Type.String()),
57
+ detail: Type.Optional(Type.String()),
58
+ },
59
+ { additionalProperties: false },
60
+ );
61
+ const SourceListFields = {
62
+ status: StringEnum(["complete", "partial", "unavailable"]),
63
+ reason: nullableString,
64
+ collectedCount: Type.Integer(),
65
+ omittedCount: Type.Integer(),
66
+ };
67
+ const Observation = Type.Union([
68
+ Type.Object(
69
+ { status: Type.Literal("complete"), reason: Type.Null() },
70
+ { additionalProperties: false },
71
+ ),
72
+ Type.Object(
73
+ { status: StringEnum(["partial", "unavailable", "withheld"]), reason: Type.String() },
74
+ { additionalProperties: false },
75
+ ),
76
+ ]);
77
+ const ContextDefinitionEntries = {
78
+ entries: Type.Array(
79
+ Type.Object(
80
+ { uri: Type.String(), range: RecoveryRangeSchema },
81
+ { additionalProperties: false },
82
+ ),
83
+ ),
84
+ collectedCount: Type.Integer({
85
+ description: "Collected locations; a partial observation may have an unknown remainder.",
86
+ }),
87
+ omittedCount: Type.Integer({
88
+ description: "Collected locations omitted by the requested selection limit.",
89
+ }),
90
+ };
91
+ const ContextDefinitions = Type.Union([
92
+ Type.Object(
93
+ { status: Type.Literal("complete"), reason: Type.Null(), ...ContextDefinitionEntries },
94
+ { additionalProperties: false },
95
+ ),
96
+ Type.Object(
97
+ { status: Type.Literal("partial"), reason: Type.String(), ...ContextDefinitionEntries },
98
+ { additionalProperties: false },
99
+ ),
100
+ Type.Object(
101
+ { status: StringEnum(["unavailable", "withheld"]), reason: Type.String() },
102
+ { additionalProperties: false },
103
+ ),
104
+ ]);
105
+ const Facts = Type.Object(
106
+ {
107
+ fileSizeBytes: Type.Optional(Type.Integer()),
108
+ package: Type.Optional(
109
+ Type.Object(
110
+ {
111
+ name: nullableString,
112
+ description: nullableString,
113
+ manifestPath: Type.String(),
114
+ directory: Type.String(),
115
+ },
116
+ { additionalProperties: false },
117
+ ),
118
+ ),
119
+ manifestFields: Type.Optional(
120
+ Type.Array(
121
+ Type.Object(
122
+ { field: Type.String(), value: Type.Unknown() },
123
+ { additionalProperties: false },
124
+ ),
125
+ ),
126
+ ),
127
+ dependencies: Type.Optional(
128
+ Type.Array(
129
+ Type.Object(
130
+ { field: Type.String(), name: Type.String(), value: Type.Unknown() },
131
+ { additionalProperties: false },
132
+ ),
133
+ ),
134
+ ),
135
+ relationships: Type.Optional(Type.Array(Relationship)),
136
+ outline: Type.Optional(
137
+ Type.Array(
138
+ Type.Object(
139
+ { ...SourceItem.properties, name: Type.String(), kind: Type.String() },
140
+ { additionalProperties: false, ...coordinate },
141
+ ),
142
+ ),
143
+ ),
144
+ imports: Type.Optional(
145
+ Type.Array(
146
+ Type.Object(
147
+ { ...SourceItem.properties, moduleSpecifier: Type.String() },
148
+ { additionalProperties: false, ...coordinate },
149
+ ),
150
+ ),
151
+ ),
152
+ exports: Type.Optional(
153
+ Type.Array(
154
+ Type.Object(
155
+ {
156
+ ...SourceItem.properties,
157
+ name: Type.String(),
158
+ kind: Type.String(),
159
+ moduleSpecifier: Type.Optional(Type.String()),
160
+ },
161
+ { additionalProperties: false, ...coordinate },
162
+ ),
163
+ ),
164
+ ),
165
+ diagnosticSnapshot: Type.Optional(
166
+ Type.Array(
167
+ Type.Object(
168
+ {
169
+ file: Type.String(),
170
+ total: Type.Integer(),
171
+ errors: Type.Integer(),
172
+ warnings: Type.Integer(),
173
+ },
174
+ { additionalProperties: false },
175
+ ),
176
+ ),
177
+ ),
178
+ snapshotCurrent: Type.Optional(Type.Boolean()),
179
+ node: Type.Optional(
180
+ Type.Union([
181
+ Type.Null(),
182
+ Type.Object(
183
+ {
184
+ type: Type.String(),
185
+ text: Type.String(),
186
+ startLine: Type.Integer(),
187
+ startCharacter: Type.Integer(),
188
+ endLine: Type.Integer(),
189
+ endCharacter: Type.Integer(),
190
+ ancestry: Type.Array(
191
+ Type.Object(
192
+ { ...SourceItem.properties, type: Type.String() },
193
+ { additionalProperties: false, ...coordinate },
194
+ ),
195
+ ),
196
+ },
197
+ { additionalProperties: false, ...coordinate },
198
+ ),
199
+ ]),
200
+ ),
201
+ nodeObservation: Type.Optional(Observation),
202
+ hoverObservation: Type.Optional(Observation),
203
+ hover: Type.Optional(
204
+ Type.Union([
205
+ Type.Null(),
206
+ Type.Object(
207
+ { contents: Type.String(), range: Type.Optional(RecoveryRangeSchema) },
208
+ { additionalProperties: false },
209
+ ),
210
+ ]),
211
+ ),
212
+ definitions: Type.Optional(
213
+ Type.Array(
214
+ Type.Object(
215
+ { file: Type.String(), range: RecoveryRangeSchema },
216
+ { additionalProperties: false },
217
+ ),
218
+ ),
219
+ ),
220
+ contextDefinitions: Type.Optional(ContextDefinitions),
221
+ recovery: Type.Optional(
222
+ Type.Array(
223
+ Type.Object(
224
+ {
225
+ operation: Type.String(),
226
+ file: Type.String(),
227
+ reason: Type.String(),
228
+ errorRanges: Type.Array(RecoveryRangeSchema),
229
+ },
230
+ { additionalProperties: false },
231
+ ),
232
+ ),
233
+ ),
234
+ sourceContext: Type.Optional(
235
+ Type.Object(
236
+ {
237
+ outline: Type.Object(
238
+ {
239
+ ...SourceListFields,
240
+ entries: Type.Array(
241
+ Type.Object(
242
+ {
243
+ name: Type.String(),
244
+ kind: Type.String(),
245
+ startLine: Type.Integer(),
246
+ endLine: Type.Integer(),
247
+ },
248
+ { additionalProperties: false },
249
+ ),
250
+ ),
251
+ },
252
+ { additionalProperties: false },
253
+ ),
254
+ imports: Type.Object(
255
+ {
256
+ ...SourceListFields,
257
+ entries: Type.Array(
258
+ Type.Object({ moduleSpecifier: Type.String() }, { additionalProperties: false }),
259
+ ),
260
+ },
261
+ { additionalProperties: false },
262
+ ),
263
+ exports: Type.Object(
264
+ {
265
+ ...SourceListFields,
266
+ entries: Type.Array(
267
+ Type.Object(
268
+ { name: Type.String(), kind: Type.String() },
269
+ { additionalProperties: false },
270
+ ),
271
+ ),
272
+ },
273
+ { additionalProperties: false },
274
+ ),
275
+ },
276
+ {
277
+ additionalProperties: false,
278
+ description:
279
+ "Best-effort source lists; collectedCount is not a completeness claim when status is partial or unavailable.",
280
+ },
281
+ ),
282
+ ),
283
+ documentation: Type.Optional(Type.Array(Type.String())),
284
+ diagnostics: Type.Optional(
285
+ Type.Array(
286
+ Type.Object(
287
+ {
288
+ range: RecoveryRangeSchema,
289
+ severity: Type.Union([Type.Integer(), Type.Null()]),
290
+ message: Type.String(),
291
+ source: nullableString,
292
+ code: Type.Union([Type.String(), Type.Number(), Type.Null()]),
293
+ },
294
+ { additionalProperties: false },
295
+ ),
296
+ ),
297
+ ),
298
+ },
299
+ {
300
+ additionalProperties: false,
301
+ description:
302
+ "Named observations, not rendered text. Ranges use zero-based UTF-16 positions; source-item coordinates are one-based.",
303
+ },
304
+ );
305
+ const Section = Type.Object(
306
+ {
307
+ key: Type.String(),
308
+ status: StringEnum(["complete", "partial", "unavailable"]),
309
+ reason: nullableString,
310
+ confidence: ConfidenceSchema,
311
+ provenance: Type.Array(Provenance),
312
+ evidenceLists: Type.Array(EvidenceListSchema),
313
+ errorRanges: Type.Optional(Type.Array(RecoveryRangeSchema)),
314
+ facts: Type.Optional(Facts),
315
+ },
316
+ { additionalProperties: false },
317
+ );
318
+ const Instruction = Type.Object(
319
+ {
320
+ path: Type.String(),
321
+ shownLines: Type.Integer(),
322
+ totalLines: Type.Integer(),
323
+ truncated: Type.Boolean(),
324
+ content: Type.String(),
325
+ },
326
+ { additionalProperties: false },
327
+ );
328
+ const GradleBase = {
329
+ selectedRoot: Type.String(),
330
+ query: Type.Literal("GradleBuild/BasicGradleProject"),
331
+ runtime: Type.Optional(
332
+ Type.Object(
333
+ {
334
+ kind: StringEnum(["distribution", "installation"]),
335
+ source: Type.String(),
336
+ version: Type.String(),
337
+ },
338
+ { additionalProperties: false },
339
+ ),
340
+ ),
341
+ };
342
+ const Gradle = Type.Union([
343
+ Type.Object(
344
+ {
345
+ ...GradleBase,
346
+ status: Type.Literal("complete"),
347
+ gradleVersion: Type.String(),
348
+ buildRoot: Type.String(),
349
+ projects: Type.Array(
350
+ Type.Object(
351
+ {
352
+ buildRoot: Type.String(),
353
+ path: Type.String(),
354
+ name: Type.String(),
355
+ directory: Type.String(),
356
+ parentPath: nullableString,
357
+ },
358
+ { additionalProperties: false },
359
+ ),
360
+ ),
361
+ includedBuilds: Type.Array(
362
+ Type.Object({ buildRoot: Type.String() }, { additionalProperties: false }),
363
+ ),
364
+ },
365
+ { additionalProperties: false },
366
+ ),
367
+ Type.Object(
368
+ {
369
+ ...GradleBase,
370
+ status: StringEnum([
371
+ "blocked",
372
+ "unavailable",
373
+ "unsupported",
374
+ "failed",
375
+ "interrupted",
376
+ "timeout",
377
+ "oversized",
378
+ ]),
379
+ gradleVersion: Type.Optional(Type.String()),
380
+ stage: StringEnum(["authorization", "prerequisites", "query", "unknown"]),
381
+ reason: Type.String(),
382
+ },
383
+ { additionalProperties: false },
384
+ ),
385
+ ]);
386
+ const Workspace = Type.Object(
387
+ {
388
+ root: Type.String(),
389
+ focus: Type.String(),
390
+ directFiles: Type.Array(
391
+ Type.Object(
392
+ { path: Type.String(), kind: StringEnum(["file", "symlink"]) },
393
+ { additionalProperties: false },
394
+ ),
395
+ ),
396
+ directories: Type.Array(
397
+ Type.Object(
398
+ { path: Type.String(), entryCount: Type.Integer() },
399
+ { additionalProperties: false },
400
+ ),
401
+ ),
402
+ extensions: Type.Array(
403
+ Type.Object(
404
+ { extension: Type.String(), fileCount: Type.Integer() },
405
+ { additionalProperties: false },
406
+ ),
407
+ ),
408
+ containingProjects: Type.Array(Project),
409
+ projects: Type.Array(Project),
410
+ memberships: Type.Array(
411
+ Type.Object(
412
+ {
413
+ projectId: Type.String(),
414
+ kind: Type.String(),
415
+ manifestPath: Type.String(),
416
+ field: Type.String(),
417
+ value: Type.String(),
418
+ },
419
+ { additionalProperties: false },
420
+ ),
421
+ ),
422
+ declaredPaths: Type.Array(
423
+ Type.Object(
424
+ {
425
+ projectId: Type.String(),
426
+ paths: Type.Array(
427
+ Type.Object(
428
+ { path: Type.String(), fields: Type.Array(Type.String()) },
429
+ { additionalProperties: false },
430
+ ),
431
+ ),
432
+ },
433
+ { additionalProperties: false },
434
+ ),
435
+ ),
436
+ relationships: Type.Array(Relationship),
437
+ dependencies: Type.Array(
438
+ Type.Object(
439
+ {
440
+ projectId: Type.String(),
441
+ field: Type.String(),
442
+ name: Type.String(),
443
+ value: Type.Unknown(),
444
+ },
445
+ { additionalProperties: false },
446
+ ),
447
+ ),
448
+ workspaceDeclarations: Type.Array(
449
+ Type.Object(
450
+ {
451
+ kind: Type.String(),
452
+ manifestPath: Type.String(),
453
+ directory: Type.String(),
454
+ field: Type.String(),
455
+ patterns: Type.Array(Type.String()),
456
+ excludeField: nullableString,
457
+ excludes: Type.Array(Type.String()),
458
+ },
459
+ { additionalProperties: false },
460
+ ),
461
+ ),
462
+ inventory: Type.Object(
463
+ {
464
+ fileCount: Type.Integer(),
465
+ symlinkCount: Type.Integer(),
466
+ source: StringEnum(["git", "filesystem"]),
467
+ exclude: Type.Array(Type.String()),
468
+ includeIgnored: Type.Boolean(),
469
+ symlinks: Type.Literal("not-followed"),
470
+ directoryNamesExcluded: Type.Literal(false),
471
+ },
472
+ {
473
+ additionalProperties: false,
474
+ description: "Counts refer to the collected inventory, which may be incomplete.",
475
+ },
476
+ ),
477
+ collection: Type.Object(
478
+ {
479
+ status: StringEnum(["complete", "partial"]),
480
+ stopReason: StringEnum(["complete", "entry-limit", "deadline"]),
481
+ prioritizedDirectory: nullableString,
482
+ limits: Type.Object(
483
+ { maxEntries: Type.Integer(), deadline: Type.Union([Type.Number(), Type.Null()]) },
484
+ { additionalProperties: false },
485
+ ),
486
+ errors: Type.Array(
487
+ Type.Object(
488
+ { stage: Type.String(), path: nullableString, reason: Type.String() },
489
+ { additionalProperties: false },
490
+ ),
491
+ ),
492
+ },
493
+ { additionalProperties: false },
494
+ ),
495
+ metadata: Type.Object(
496
+ {
497
+ documents: Type.Array(
498
+ Type.Object(
499
+ {
500
+ path: Type.String(),
501
+ kind: Type.String(),
502
+ status: Type.String(),
503
+ reason: nullableString,
504
+ },
505
+ { additionalProperties: false },
506
+ ),
507
+ ),
508
+ issues: Type.Array(
509
+ Type.Object(
510
+ {
511
+ path: Type.String(),
512
+ field: nullableString,
513
+ kind: Type.String(),
514
+ reason: Type.String(),
515
+ },
516
+ { additionalProperties: false },
517
+ ),
518
+ ),
519
+ },
520
+ { additionalProperties: false },
521
+ ),
522
+ gradle: Type.Optional(Gradle),
523
+ selections: Type.Array(EvidenceListSchema),
524
+ },
525
+ {
526
+ additionalProperties: false,
527
+ description:
528
+ "root and focus are absolute. Direct inventory paths are relative to focus; project and metadata paths are relative to root. Selection counts exclude text-budget reductions.",
529
+ },
530
+ );
531
+
532
+ const Common = {
533
+ confidence: ConfidenceSchema,
534
+ sections: Type.Array(Section),
535
+ targets: Type.Array(NavigationTargetSchema),
536
+ candidates: Type.Array(
537
+ Type.Object(
538
+ {
539
+ handle: Type.String(),
540
+ name: Type.String(),
541
+ kind: nullableString,
542
+ container: nullableString,
543
+ file: Type.String(),
544
+ line: Type.Integer(),
545
+ character: Type.Integer(),
546
+ rank: Type.Integer(),
547
+ anchorKind: Type.Optional(StringEnum(["name", "declaration"])),
548
+ },
549
+ { additionalProperties: false, description: "One-based line and UTF-16 character." },
550
+ ),
551
+ ),
552
+ evidenceLists: Type.Array(EvidenceListSchema),
553
+ nextQueries: Type.Array(Type.String()),
554
+ readNext: Type.Array(ReadNextSchema),
555
+ instructions: Type.Array(Instruction),
556
+ observationLimitations: Type.Array(Type.String()),
557
+ };
558
+ const Snapshot = Type.Object(
559
+ {
560
+ path: Type.String(),
561
+ limitation: Type.Literal("Reading this snapshot does not refresh the captured observation."),
562
+ },
563
+ { additionalProperties: false },
564
+ );
565
+
566
+ /** Native orientation data. Snapshot paths refer to captured facts, never a fresh observation. */
567
+ export const OrientationOutputSchema = Type.Union([
568
+ Type.Object(
569
+ {
570
+ ...Common,
571
+ kind: Type.Literal("completed"),
572
+ focusKind: StringEnum(["workspace", "directory", "module"]),
573
+ focus: Type.Union([Type.String(), Type.Null()]),
574
+ workspace: Workspace,
575
+ snapshot: Type.Optional(Snapshot),
576
+ },
577
+ { additionalProperties: false },
578
+ ),
579
+ Type.Object(
580
+ {
581
+ ...Common,
582
+ kind: Type.Literal("completed"),
583
+ focusKind: StringEnum(["file", "symbol"]),
584
+ focus: Type.Union([Type.String(), Type.Null()]),
585
+ },
586
+ { additionalProperties: false },
587
+ ),
588
+ Type.Object({ ...Common, kind: Type.Literal("disambiguation") }, { additionalProperties: false }),
589
+ Type.Object(
590
+ { ...Common, kind: Type.Literal("kind-mismatch"), requestedKind: Type.String() },
591
+ { additionalProperties: false },
592
+ ),
593
+ Type.Object(
594
+ {
595
+ ...Common,
596
+ kind: Type.Literal("invalid-input"),
597
+ message: Type.String(),
598
+ symlinkRejection: Type.Optional(
599
+ Type.Object(
600
+ { requestedPath: Type.String(), blockedPath: Type.String() },
601
+ { additionalProperties: false },
602
+ ),
603
+ ),
604
+ },
605
+ { additionalProperties: false },
606
+ ),
607
+ ]);