@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
package/README.md CHANGED
@@ -83,6 +83,42 @@ Important tool rules:
83
83
 
84
84
  `code_health({ refresh: true })` retries failed startup and exhausted process-crash routes in scope, with at most one attempt per route per call. It collects fresh diagnostic evidence and reports recovery separately from diagnostic confirmation. A broad maintenance attempt can include active tracked files outside a requested directory, but the diagnostic result keeps the requested directory and tracked-file boundary. The report labels maintenance evidence separately from result coverage. A later refresh can retry a failed route. Reports show up to 16 route entries per recovery list and disclose omitted entries. Use an exact file scope when a route reports `use-exact-file`.
85
85
 
86
+ ### Structured codemode results
87
+
88
+ All eight tools declare native output schemas and return JSON-serializable `structuredContent`. Direct calls retain readable `content`; Pi's default codemode route resolves to native data instead of Markdown. `details` remains a separate UI/state contract, not the script API. Text, script data, and UI details project the same collected facts; no representation is recovered by parsing another.
89
+
90
+ | Tool | Native data |
91
+ |---|---|
92
+ | Resolve | `targets` with reusable `handle` values, candidate selection, and evidence counts |
93
+ | Inspect | `point`, independently completed/partial/unavailable `sections` with `data`, recovery, bounded definitions/diagnostics, provenance, and next queries |
94
+ | Orientation | `focusKind`, named section `facts`, selected `workspace` inventories/declarations/relationships and Gradle observations when applicable, instructions, limitations, and optional captured `snapshot` |
95
+ | Graph | Per-relation `sections` with bounded `items` and evidence |
96
+ | Find | Bounded `matches`; AST scan policy, exclusions, limitations, and failures |
97
+ | Health | Requested `includedSections` and `level`, actual `diagnostics` with scope and confirmation evidence, all collected `servers`, workspace inventory scope, capability state, warnings, and separate `refresh` outcomes |
98
+ | Refactor Plan | `planId`, operation, safe target facts, every exact edit in `edits`, file/edit counts, provenance, and `nextAction` |
99
+ | Refactor Apply | Explicit `kind: "applied"`, changed `files` with per-file counts, and total file/edit counts |
100
+
101
+ Check `kind` before consuming evidence. Invalid input and candidate selection remain corrective returned outcomes; real execution/capability failures and cancellation throw. Internal providers, target records, fingerprints, mutation authority, and session state are not exposed. Apply recovery continues to consume `details.data.changedFiles` independently of script data.
102
+
103
+ Limits belong to their representation. Inspect retains its evidence limits. Orientation native records retain the focus, ordering, `maxResults`, and collection limits even when text budgets hide descriptions or navigation rows. A captured snapshot describes the same observation; reading it does not refresh facts. Health returns all collected diagnostic-file/server entries, with at most three error/warning messages per file in detailed mode; neither a complete returned list nor successful maintenance proves workspace-wide diagnostic completeness. Plan returns every edit even when text previews only five. Text-preview omission counts do not describe these complete native lists. Evidence metadata preserves exact versus unknown totals and partial reasons.
104
+
105
+ Source points, target positions, Inspect source coordinates, and Orientation source-item coordinates use one-based lines and UTF-16 columns. Refactor edit ranges and Orientation provider ranges (hover, definitions, diagnostics), like syntax-recovery ranges, use zero-based lines and UTF-16 columns; range ends are exclusive. Health messages use one-based lines.
106
+
107
+ Registered-tool tests validate results against the registered output schemas and JSON round-tripping; Pi does not validate output schemas at runtime. Separate deterministic integration tests execute all five migrated tools through Pi's real default codemode route, including fixture mutation by Apply. These tests use controlled providers, not live language-server qualification.
108
+
109
+ Example codemode script that returns counts rather than every reference:
110
+
111
+ ```javascript
112
+ const graph = await tools.code_graph({
113
+ target: { symbol: { query: "PaymentProvider", scope: "packages/api" } },
114
+ relations: ["references"],
115
+ });
116
+ return graph.kind === "completed"
117
+ ? graph.sections.map(({ relation, source, status, evidence, message }) =>
118
+ ({ relation, source, status, evidence, message }))
119
+ : graph;
120
+ ```
121
+
86
122
  ### Workspace and directory observations
87
123
 
88
124
  Automatic collection stays within the session working directory. Ancestor Git roots and workspace manifests do not expand that boundary. An explicit directory focus can select a different root. Each tool call makes a new observation; its output does not depend on an earlier overview.
@@ -92,12 +128,27 @@ Automatic collection stays within the session working directory. Ancestor Git ro
92
128
  - Symbolic links are recorded, not followed. An explicit ignored or excluded directory can be observed separately. This does not change automatic inclusion elsewhere.
93
129
  - Metadata readers cover Node `package.json` and workspace declarations, Python `[project]` in `pyproject.toml`, Rust `Cargo.toml`, and Go `go.mod` / `go.work`. They do not run build tools or project code.
94
130
  - Unsupported, dynamic, inherited, malformed, and unresolved declarations are disclosed. Go replacement directives and unsupported quoted-string escapes are not interpreted. Native project kinds remain separate; nearby Python or Rust projects do not become Node workspace members.
95
- - Directory diagrams retain separate dependency categories and declared values. Unique declared-name matches do not prove installed dependency resolution or runtime architecture.
131
+ - Project declaration groups share their observed kind and project-relative identity source. Identical membership declarations share their native kind, source field, and value. List limits and omission counts still apply to individual declarations and memberships, not groups. A membership group refers to listed projects only when their identities match exactly; otherwise it lists member paths.
132
+ - Explicit directory results keep project identity, direct directories/files, applicable instructions, and collection problems inline. Complete ancillary sections (extension counts, nested declarations, memberships, declared paths, and dependency topology) move to captured details with an omission summary. Incomplete ancillary observations remain inline. Root-focused Orientation also keeps project declarations and memberships inline for workspace navigation.
133
+ - Captured directory diagrams retain separate dependency categories and declared values. Unique declared-name matches do not prove installed dependency resolution or runtime architecture.
96
134
  - The inventory retains at most 10,000 entries. An explicit in-root directory is collected before unrelated paths use that budget. External directory focus uses its own observation. Metadata files have a 1 MiB read limit. The first-turn collector has a 10-second deadline; tool calls use their request control. Results disclose incomplete collection.
97
135
 
98
- Estimated tokens are `ceil(characters / 4)`. The overview warns above 1,000 and has a 2,000-token hard cap. Workspace and directory navigation warn above 2,000 and have a 4,000-token hard cap. Warnings go to UI and debug only. `maxResults` can reduce a list, but cannot bypass the total cap.
136
+ Estimated tokens are `ceil(characters / 4)`. The overview warns above 1,000 and has a 2,000-token hard cap. Workspace and directory navigation warn above 2,000 and have a 4,000-token hard cap. Warnings go to UI and debug only. `maxResults` can reduce a list, but cannot bypass the text cap. Native records retain their caller-limited selection independently of that text budget.
137
+
138
+ The overview links captured details only when navigation rows or descriptions are omitted. Explicit workspace/directory Orientation also preserves raw inventory evidence. Captured-result files contain the complete collected observation, not just the selected rows. Reading them does not refresh facts or establish that every possible fact was collected. Instruction snippets have a separate budget and still respect Pi's final output safety limit. Unread instruction text is identified and is not recorded as supplied. File- and symbol-focused navigation retain their existing output.
139
+
140
+ ### Consent-gated Gradle observations
141
+
142
+ Overview and workspace/directory Orientation can add a **Gradle model observation** for one selected Gradle 9 build. Overview selects the session working directory; an explicit directory focus selects that exact directory. A regular `settings.gradle` or `settings.gradle.kts` is required there. No ancestors or independent nested builds are queried automatically. File, module, and symbol focuses do not select additional builds.
99
143
 
100
- Captured-result files contain the complete collected observation, not just the selected rows. Reading them does not refresh facts or establish that every possible fact was collected. Instruction snippets have a separate budget and still respect Pi's final output safety limit. Unread instruction text is identified and is not recorded as supplied. File- and symbol-focused navigation retain their existing output.
144
+ - Permission is project-only: `code-intelligence.gradleObservation` is `"allow"`, `"deny"`, or absent in `.pi/supi/config.json`. Global values are ignored. Eligible interactive startup asks when unset; Cancel does not persist. Without UI, unset never executes.
145
+ - Allow also requires Pi's actual project-trust gate: a trusted startup with protected project resources, or a saved Pi trust approval. Pi implicitly trusts directories without protected resources, so a bare SuPi config containing Allow is insufficient. Use `/trust` and reload in that case. Explicit external roots require their own saved trust approval; permission remains owned by the session project.
146
+ - `/supi-settings` → Code Intelligence → Gradle observations changes the next query. Reset removes the project value and restores asking at the next eligible startup. Deny/reset request cancellation of owned in-flight helpers. Cancellation cannot undo side effects or stop unrelated Gradle daemons.
147
+ - **Execution risk:** Gradle initializes settings and plugins. They may execute arbitrary code, download distributions/dependencies, write caches, and access files/services outside the reporting root. Reporting bounds are not a sandbox. Only `BuildEnvironment` and `GradleBuild` / `BasicGradleProject` models are requested; SuPi schedules no build/test tasks and requests no dependency, task, source-set, or IDE models.
148
+ - Wrapper properties select their declared distribution, never the Tooling API client's version. Conventional `gradle-9.x[-qualifier]-(bin|all).zip` URLs are required to establish the major before querying; unidentifiable/custom archive names fail closed. Relative file URLs resolve against the wrapper properties. When properties are absent, the first executable Gradle on PATH must resolve through symlinks to an installation with `bin/gradle` and a single `lib/gradle-launcher-9.*.jar`. SDKMAN-style symlinks and direct version-manager installation paths work; opaque mise/asdf shims are not executed. Put the selected installation's `bin` directory on PATH. Unsupported wrappers and unresolved installations are disclosed without fallback.
149
+ - Java is selected from existing `JAVA_HOME/bin/java`, then PATH. Java 17–24 is the conservative compatible range for Gradle 9; no JDK is installed. The helper pins the model request to its own Java home. Actual qualification is narrower; see the [helper qualification and dependency notices](gradle-helper/README.md).
150
+ - Projects retain build-root identity plus logical path, name, parent path, and Gradle-reported actual directory. Duplicate names remain distinct. Included builds are references only, not recursively expanded trees. External directories are attributed references; inventory never expands to them. No declaration fields/ranges, source ownership, dependency resolution, or architecture are inferred.
151
+ - The existing 10-second Overview deadline, request cancellation/deadlines, navigation budgets, captures, and untrusted-evidence handling still apply. Helper output is capped at 1 MiB and 10,000 projects. Missing prerequisites, unsupported versions, initialization failure, cancellation, expiry, and oversized results are explicit limitations, never “no projects.” There are no automatic retries, console-report fallback, or stale-model reuse.
101
152
 
102
153
  ### Transcript failures
103
154
 
@@ -109,6 +160,8 @@ Candidate selection for Graph, Resolve, and Orientation uses one structured tran
109
160
 
110
161
  The planner accepts one target handle or anchor and one operation: `rename_symbol`, `extract_function`, `extract_variable`, `update_imports`, or `delete_dead_code`. Rename, import updates, and dead-code removal depend on the language server and validated edits. Function and variable extraction are currently unavailable for all languages: standard LSP code actions do not provide a safe exact extraction-name contract. Unsupported operations do not fall back to text edits.
111
162
 
163
+ `delete_dead_code` accepts precise `source.removeUnused` or `source.removeUnusedImports` actions (including dotted descendants), not title-based guesses or `source.fixAll`. Native TypeScript 7.0.2 is qualified for unused-import removal only; it does not imply removal of arbitrary unused declarations or TLS/native parity. An imports-only advertisement appears as limited SuPi support with the reason in `code_health`. Different matching edit plans remain ambiguous rather than selecting an action automatically.
164
+
112
165
  Rename can discover affected files and repeat the request once after validated same-route enrollment, with a limit of 64 files. A null server document version for an open file is accepted only with a verified request snapshot of synchronized content. Plans retain its content fingerprint and client version; unknown or mismatched state remains unavailable.
113
166
 
114
167
  Plans are held in memory for the current session. Apply accepts only the returned `planId`; it does not create or regenerate a plan. It checks SHA-256 file fingerprints, provider-authorized roots, document versions when available, edit ranges, and overlaps before writing. Changed files require a new plan. A successful apply removes the plan.
@@ -175,10 +228,12 @@ Developers run `pnpm test:language-baseline:acceptance` with the pinned prerequi
175
228
  ### Search and output limits
176
229
 
177
230
  - An AST search has a 5,000 eligible-file limit and a 10-second deadline shared by file enumeration and analysis. These are not tool-call settings.
178
- - Below directory roots, AST search excludes hidden entries, dependency/build/cache directories, symlinks, non-regular files, configured `code-intelligence.exclude` paths, and files unsupported by the requested operation. It does **not** read `.gitignore`. Explicit roots are resolved and honored, including excluded paths and symlink roots. See the [scan policy](src/analysis/search/ast-scan.ts) for the exact directory list.
231
+ - Below directory roots, AST search excludes hidden entries, dependency/build/cache directories, symlinks, non-regular files, configured `code-intelligence.exclude` paths, paths ignored by `.gitignore`, and files unsupported by the requested operation. It reads regular, non-symlink workspace-root and nested `.gitignore` files, with directory-relative rules and negation; it does not use global Git ignores or `.git/info/exclude`. Explicit roots are resolved and honored, including ignored paths and symlink roots. An explicitly selected ignored directory overrides ancestor ignore rules, but still applies its own and nested `.gitignore` files. See the [scan policy](src/analysis/search/ast-scan.ts) for the exact directory list.
232
+ - AST scan details report `policy.ignoreFiles: true` and ignored-path counts/examples under the `gitignore` exclusion reason. Each exclusion summary includes `scopeRoot`, the canonical requested root displayed relative to cwd when inside it. Counts describe encountered traversal skips per scope and reason, not distinct files absent from the combined result: another explicit scope may include a skipped path. An excluded directory counts as one skip, not as a count of its unvisited descendants. Ignore-file read failures make the scan incomplete; the warning includes bounded examples of unreadable paths.
179
233
  - An exact file that does not support the requested AST operation is invalid. Results disclose policy exclusions, interrupted scans, provider limits, and omitted matches. No matches do not mean that unsupported files were searched.
180
234
  - Syntax recovery retains usable evidence as partial and reports the affected file and available error ranges. Scan limits separate recovered syntax from provider failures, with counts and file examples for each. Partial scans have unknown match totals. A recovered parse does not establish complete absence.
181
- - Tool text is truncated at Pi's default 2,000 lines or 50 KB. When this occurs, the full text is written to a temporary file and its path is returned. Result-list limits still apply to that full text.
235
+ - Tool text has an economic inline budget of 8,000 characters (approximately 2,000 tokens). Oversized results prioritize status, evidence counts, limitations, and diagnostic snippets before an explicitly incomplete text excerpt. The complete returned text is saved to a temporary file, linked before the excerpt. Counts describe the returned result, not the shortened preview. UI details and structured codemode evidence are not truncated by this budget.
236
+ - Workspace/directory navigation and instruction delivery retain their separate budgets above. Pi's default 2,000-line / 50 KB safety limit still applies to every tool. Result-list limits also apply to saved text: a spill file does not recover evidence omitted by `maxResults`.
182
237
 
183
238
  ## Status and settings
184
239
 
@@ -188,7 +243,13 @@ In interactive Pi, open the status overlay:
188
243
  /supi-ci-status
189
244
  ```
190
245
 
191
- It shows server routes and roots, missing or running servers, diagnostics, and capability warnings. The terminal must be at least 60 columns wide. Use Up/Down to select a diagnostic file, Enter or Space to expand it, `r` to reload the displayed snapshot, `a` to collapse it, and Escape to close. The extension also adds LSP status to the footer. Use `code_health` for health reports outside the interactive terminal.
246
+ The inspector shows semantic and structural readiness, error and warning counts, diagnostic confirmation evidence, server routes and roots, negotiated operation support, capability warnings, and active code tools. The **Diagnostic files** list includes tracked filenames even when clean; unconfirmed, failed, removed, skipped, and unavailable files are labeled separately. Diagnostic counts describe tracked files, not a workspace-wide check; stale, incomplete, and unavailable observations remain explicit. Ready servers do not establish file coverage. An empty snapshot without confirmed files is not reported as clean.
247
+
248
+ Use Up/Down (or `j`/`k`) to scroll the entire inspector, Page Up/Page Down to scroll by page, and Home/End to jump to the beginning/end. Use Tab/Shift+Tab to select the next/previous diagnostic file and Enter or Space to expand it. Press `c` or F5 to **Check diagnostics**: discover automatically eligible source files and request diagnostics for up to 32 files under one 30-second deadline. The result reports the selected range, remaining files in the pass, and discovery or time limits. Check again to continue the next batch; after the final batch, another check starts a new pass. This is bounded file coverage, not a whole-project guarantee. Closing the inspector cancels its wait and prevents further file requests; already-dispatched shared LSP work can settle independently.
249
+
250
+ Press `r` to reload the passive snapshot, `a` to collapse details, and Escape to close. Opening and reloading do not enroll files, retry servers, or request fresh diagnostics; use Check diagnostics for enrollment and file checks, or `code_health` with `refresh: true` for explicit recovery and diagnostic refresh. Scrolling, Tab, confirmation, and cancel actions honor Pi's configured keybindings. Configured actions take priority over `c` and F5; the inspector advertises an available check shortcut. The viewport adjusts to terminal size, with controls kept visible.
251
+
252
+ The inspector does not replace the footer or add editor widgets. The extension's separate LSP footer contribution remains active. Outside the interactive terminal, use `code_health`.
192
253
 
193
254
  The package registers **Code Intelligence** and **LSP** settings. If `@mrclrchtr/supi-settings` is installed, use `/supi-settings` to edit them. A standalone Code Intelligence install does not include that settings UI.
194
255
 
@@ -203,6 +264,7 @@ Project values override global values, which override defaults. Project configur
203
264
  |---|---|---|
204
265
  | `code-intelligence.overviewEnabled` | `true` | Add the hidden overview; the choice is fixed for the session |
205
266
  | `code-intelligence.instructionFileNames` | `["CLAUDE.md", "AGENTS.md"]` | Ordered plain filenames for directory instruction discovery |
267
+ | `code-intelligence.gradleObservation` | unset | Project-only `"allow"` / `"deny"`; actual Pi project trust also required; changes apply to the next query |
206
268
  | `code-intelligence.exclude` | `[]` | Gitignore-style patterns for automatic workspace navigation, LSP work, and broad AST searches; not an access control |
207
269
  | `code-intelligence.fileAssociations` | `[]` | Ordered C/C++ language rules in trusted project configuration only; edit the JSON file directly |
208
270
  | `lsp.servers.<language>.enabled` | Enabled unless `false` | Disable a language server |
@@ -0,0 +1,48 @@
1
+ # Gradle workspace observation helper
2
+
3
+ This standalone Java 17 process uses the pinned Gradle Tooling API 9.4.0. It accepts four arguments:
4
+
5
+ ```text
6
+ GradleObservation <selected-root> <distribution|installation> <URI|installation-path> <deadline-epoch-milliseconds>
7
+ ```
8
+
9
+ The parent chooses the Gradle runtime, performs consent/trust policy, and passes the runtime in. The helper does not resolve a wrapper or make policy decisions. `distribution` passes the given URI to `GradleConnector.useDistribution`; `installation` passes the given directory to `useInstallation`. The helper pins the Tooling API request JVM to its current `java.home`.
10
+
11
+ The helper requests `BuildEnvironment` first and accepts only Gradle 9 before asking for `GradleBuild`. It traverses the root build's `BasicGradleProject` children and reports only included-build root references. It does not query task, dependency, or IDE models. Output is one UTF-8 JSON object on stdout, limited to 1 MiB and 10,000 root-build projects. Gradle and process logs are redirected to stderr through a 64 KiB cap. Failure objects have one of these statuses: `unavailable`, `unsupported`, `failed`, `interrupted`, `timeout`, or `oversized`.
12
+
13
+ Build/settings failures use `failed`; connection failures use `unavailable`. Failure reasons retain a deduplicated cause chain, deepest available cause first, limited to eight causes and 500 characters of single-line text; an ellipsis marks truncated messages. They do not include stack traces or raw process logs. Failure objects also retain `gradleVersion` when `BuildEnvironment` reported it before failure; the declared distribution version is not substituted.
14
+
15
+ Helper failures include `stage: "prerequisites" | "query"`, recorded before any Tooling API model request and when the first request is attempted, respectively. A missing settings file detected inside the helper remains a prerequisite failure. The parent preserves this stage, records authorization failures itself, and treats an expired deadline before helper launch as a prerequisite failure. Authorization and prerequisite results use configuration provenance and explicitly state that the model query was not run. Confirmed attempted queries use runtime provenance; a failed query is not a returned project model. If the helper starts but exits, is interrupted, exceeds output bounds, or times out without returning a stage, the parent records `unknown` and explicitly discloses that model-query execution is unknown. A JVM launch alone does not establish a Tooling API request. Orientation renders the reason once as single-line literal code, using backtick delimiters longer than any embedded run so links, images, emphasis, and HTML remain diagnostic text. Captures retain the collected diagnostic.
16
+
17
+ A line containing `cancel` on stdin requests Tooling API cancellation and produces an `interrupted` result. The deadline is an absolute Unix epoch timestamp in milliseconds; its watchdog requests token cancellation and produces `timeout`. Cancellation terminates this helper process after writing its JSON response so a parent process can use its own kill-after-grace policy if Tooling API shutdown stalls.
18
+
19
+ Build the reproducible helper and verify/download its pinned dependencies with:
20
+
21
+ ```bash
22
+ ./packages/supi-code-intelligence/gradle-helper/build.sh
23
+ ```
24
+
25
+ The resulting helper JAR is `lib/supi-gradle-observation.jar`; the standalone Maven Tooling API and SLF4J artifacts remain adjacent in `lib/`. Fixed JAR entry ordering and timestamps make the helper artifact reproducible for a fixed Java compiler. Artifact URLs, SHA-256 values, and license notices are in `licenses/DEPENDENCIES.md`.
26
+
27
+ ## Qualification
28
+
29
+ | Gradle distribution | Helper/client | Installed JVM | Platform | Verified cases |
30
+ | --- | --- | --- | --- | --- |
31
+ | 9.4.0 (`all`, pinned wrapper URL and SHA-256) | Tooling API 9.4.0, Java 17 bytecode | Eclipse Temurin 21.0.13+9 LTS | macOS arm64 | Groovy distribution selection; Kotlin installation selection; nested paths, renamed projects, duplicate leaf names, custom directories, external included reference; initialization failure, cancellation, expired deadline |
32
+ | 9.4.0 (`all`, same pin) | Same bundled helper | Amazon Corretto 21.0.9.10.1 | macOS arm64 | Same cases |
33
+
34
+ The TypeScript process adapter was also exercised against the real Groovy fixture: 8 projects and 1 included reference. Ordinary Vitest coverage controls the process boundary for missing Java, oversized output, active deadline expiry, trust/consent, live revocation, selection, result/capture consistency, and output budgets. These combinations do not establish qualification for every Gradle 9/JVM/platform combination. Java 17–24 is the conservative runtime-family intersection; actual qualification is limited to the rows above. Linux, Windows, other JVMs, and other Gradle 9 releases have not been qualified by this record.
35
+
36
+ The pinned fixtures contain no wrapper executable: the Tooling API selects the declared archive itself. `test-fixtures.py` copies both the build and its included sibling into temporary directories, exercises distribution mode first (which may download/cache the archive), then uses the resulting 9.4.0 installation. No independent included-build query is launched.
37
+
38
+ ## Packaging and verification
39
+
40
+ The package's `files` list explicitly includes the helper JAR, standalone Maven Tooling API, SLF4J API/provider, source, rebuild script, and licenses. Runtime users need Java, not `javac` or a build step. `scripts/verify-tarball.mjs` checks these assets in both direct and transitively bundled Code Intelligence packages during `pnpm verify:ai`. The helper is compiled with `javac --release 17`; rebuilding requires an installed JDK and `curl`. Dependencies are checksum-verified, with no runtime dependency fetch by the helper launcher. Gradle itself may download its selected distribution or plugins after authorization.
41
+
42
+ Tooling API's standalone archive shades additional classes (Guava, Error Prone/JSpecify/JSR-305 annotations, `javax.inject`, Apache Commons, and ASM). The upstream complete Gradle LICENSE and NOTICE are retained alongside SLF4J's MIT license; not every component in the distribution-wide notice is used by this helper. See [dependency coordinates and checksums](licenses/DEPENDENCIES.md). No JVM or Gradle engine distribution is shipped.
43
+
44
+ Run the real pinned Groovy/Kotlin fixture acceptance test with:
45
+
46
+ ```bash
47
+ python3 scripts/gradle-observation/test-fixtures.py
48
+ ```
@@ -0,0 +1,73 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
5
+ LIB_DIR="$HERE/lib"
6
+ SOURCE="$HERE/src/GradleObservation.java"
7
+ mkdir -p "$LIB_DIR"
8
+
9
+ sha256() {
10
+ if command -v sha256sum >/dev/null 2>&1; then
11
+ sha256sum "$1" | awk '{print $1}'
12
+ else
13
+ shasum -a 256 "$1" | awk '{print $1}'
14
+ fi
15
+ }
16
+
17
+ download_verified() {
18
+ local filename="$1" expected="$2" url="$3" destination="$LIB_DIR/$1"
19
+ local current temporary actual
20
+ if [[ -f "$destination" ]]; then
21
+ current="$(sha256 "$destination")"
22
+ if [[ "$current" == "$expected" ]]; then
23
+ chmod 644 "$destination"
24
+ return
25
+ fi
26
+ printf 'Checksum mismatch for cached %s; downloading a fresh copy.\n' "$filename" >&2
27
+ fi
28
+ temporary="$(mktemp "$LIB_DIR/.${filename}.XXXXXX")"
29
+ trap 'rm -f "$temporary"' RETURN
30
+ curl --fail --location --silent --show-error "$url" --output "$temporary"
31
+ actual="$(sha256 "$temporary")"
32
+ if [[ "$actual" != "$expected" ]]; then
33
+ printf 'SHA-256 mismatch for %s: expected %s, got %s\n' "$filename" "$expected" "$actual" >&2
34
+ return 1
35
+ fi
36
+ chmod 644 "$temporary"
37
+ mv "$temporary" "$destination"
38
+ trap - RETURN
39
+ }
40
+
41
+ REPOSITORY=https://repo.gradle.org/gradle/libs-releases
42
+ download_verified \
43
+ gradle-tooling-api-9.4.0.jar \
44
+ 18e900ab3fcdf77a8076ccee1897b89789f1eac654585ec33b308619b9d3f1ef \
45
+ "$REPOSITORY/org/gradle/gradle-tooling-api/9.4.0/gradle-tooling-api-9.4.0.jar"
46
+ download_verified \
47
+ slf4j-api-2.0.17.jar \
48
+ 7b751d952061954d5abfed7181c1f645d336091b679891591d63329c622eb832 \
49
+ "$REPOSITORY/org/slf4j/slf4j-api/2.0.17/slf4j-api-2.0.17.jar"
50
+ download_verified \
51
+ slf4j-simple-2.0.17.jar \
52
+ ddfea59ac074c6d3e24ac2c38622d2d963895e17f70b38ed4bdae4d780be6964 \
53
+ "$REPOSITORY/org/slf4j/slf4j-simple/2.0.17/slf4j-simple-2.0.17.jar"
54
+
55
+ BUILD_DIR="$(mktemp -d "$HERE/.build.XXXXXX")"
56
+ trap 'rm -rf "$BUILD_DIR"' EXIT
57
+ mkdir -p "$BUILD_DIR/classes"
58
+ javac --release 17 -encoding UTF-8 -classpath "$LIB_DIR/*" -d "$BUILD_DIR/classes" "$SOURCE"
59
+ printf 'Manifest-Version: 1.0\nMain-Class: GradleObservation\n\n' > "$BUILD_DIR/MANIFEST.MF"
60
+
61
+ set --
62
+ while IFS= read -r class_file; do
63
+ set -- "$@" -C "$BUILD_DIR/classes" "${class_file#./}"
64
+ done < <(cd "$BUILD_DIR/classes" && find . -type f -print | LC_ALL=C sort)
65
+ jar --create \
66
+ --file "$BUILD_DIR/supi-gradle-observation.jar" \
67
+ --date=2020-01-01T00:00:00Z \
68
+ --manifest "$BUILD_DIR/MANIFEST.MF" \
69
+ "$@"
70
+ chmod 644 "$BUILD_DIR/supi-gradle-observation.jar"
71
+ mv "$BUILD_DIR/supi-gradle-observation.jar" "$LIB_DIR/supi-gradle-observation.jar"
72
+ printf 'Built Java 17 helper: %s\n' "$LIB_DIR/supi-gradle-observation.jar"
73
+ printf 'SHA-256: %s\n' "$(sha256 "$LIB_DIR/supi-gradle-observation.jar")"
@@ -0,0 +1,11 @@
1
+ # Bundled JVM dependency notices
2
+
3
+ | Artifact | Source | SHA-256 | License |
4
+ | --- | --- | --- | --- |
5
+ | `org.gradle:gradle-tooling-api:9.4.0` | [repo.gradle.org](https://repo.gradle.org/gradle/libs-releases/org/gradle/gradle-tooling-api/9.4.0/gradle-tooling-api-9.4.0.jar) | `18e900ab3fcdf77a8076ccee1897b89789f1eac654585ec33b308619b9d3f1ef` | Apache-2.0; see [LICENSE-gradle-tooling-api.txt](LICENSE-gradle-tooling-api.txt) |
6
+ | `org.slf4j:slf4j-api:2.0.17` | [repo.gradle.org](https://repo.gradle.org/gradle/libs-releases/org/slf4j/slf4j-api/2.0.17/slf4j-api-2.0.17.jar) | `7b751d952061954d5abfed7181c1f645d336091b679891591d63329c622eb832` | MIT; see [LICENSE-slf4j.txt](LICENSE-slf4j.txt) |
7
+ | `org.slf4j:slf4j-simple:2.0.17` | [repo.gradle.org](https://repo.gradle.org/gradle/libs-releases/org/slf4j/slf4j-simple/2.0.17/slf4j-simple-2.0.17.jar) | `ddfea59ac074c6d3e24ac2c38622d2d963895e17f70b38ed4bdae4d780be6964` | MIT; see [LICENSE-slf4j.txt](LICENSE-slf4j.txt) |
8
+
9
+ The Tooling API archive shades additional dependencies. [The upstream complete Gradle LICENSE](LICENSE-gradle-tooling-api.txt) and [NOTICE](NOTICE-gradle.txt) retain their notices, including ASM's BSD terms and the distribution's JSR-305 attribution. These distribution-wide files also mention components not shipped here.
10
+
11
+ The Gradle Tooling API POM declares `slf4j-api` 2.0.17. `slf4j-simple` 2.0.17 supplies the SLF4J provider, with `slf4j-api` included explicitly as its runtime dependency. No Gradle distribution-internal Tooling API JAR is bundled: the Maven artifact above is the standalone 3 MB-class artifact.