@mrclrchtr/supi-code-intelligence 9.1.2 → 11.0.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 (189) hide show
  1. package/README.md +99 -27
  2. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/LICENSE +21 -0
  3. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/README.md +743 -0
  4. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/index.js +17 -0
  5. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/lib/constants.js +184 -0
  6. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/lib/parse.js +1425 -0
  7. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/lib/picomatch.js +361 -0
  8. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/lib/scan.js +403 -0
  9. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/lib/utils.js +72 -0
  10. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/package.json +83 -0
  11. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/posix.js +3 -0
  12. package/node_modules/@mrclrchtr/supi-code-runtime/package.json +4 -1
  13. package/node_modules/@mrclrchtr/supi-code-runtime/src/api.ts +11 -0
  14. package/node_modules/@mrclrchtr/supi-code-runtime/src/file-associations.ts +190 -0
  15. package/node_modules/@mrclrchtr/supi-code-runtime/src/types.ts +22 -0
  16. package/node_modules/@mrclrchtr/supi-core/package.json +1 -1
  17. package/node_modules/@mrclrchtr/supi-lsp/README.md +88 -2
  18. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/LICENSE +21 -0
  19. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/README.md +743 -0
  20. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/index.js +17 -0
  21. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/lib/constants.js +184 -0
  22. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/lib/parse.js +1425 -0
  23. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/lib/picomatch.js +361 -0
  24. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/lib/scan.js +403 -0
  25. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/lib/utils.js +72 -0
  26. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/package.json +83 -0
  27. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/posix.js +3 -0
  28. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/package.json +4 -1
  29. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/api.ts +11 -0
  30. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/file-associations.ts +190 -0
  31. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/types.ts +22 -0
  32. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/package.json +1 -1
  33. package/node_modules/@mrclrchtr/supi-lsp/package.json +3 -3
  34. package/node_modules/@mrclrchtr/supi-lsp/src/api.ts +1 -0
  35. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-host.ts +3 -0
  36. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostics.ts +6 -4
  37. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-request-enrollment.ts +66 -22
  38. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-semantic-input-barrier.ts +37 -5
  39. package/node_modules/@mrclrchtr/supi-lsp/src/client/client.ts +136 -43
  40. package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager.ts +261 -22
  41. package/node_modules/@mrclrchtr/supi-lsp/src/provider/refactor-planning.ts +13 -0
  42. package/node_modules/@mrclrchtr/supi-lsp/src/provider/semantic-edit-discovery.ts +151 -0
  43. package/node_modules/@mrclrchtr/supi-lsp/src/provider/semantic-edit-normalizer.ts +97 -129
  44. package/node_modules/@mrclrchtr/supi-lsp/src/provider/semantic-edit-protocol.ts +132 -0
  45. package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-controller.ts +8 -1
  46. package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-registry.ts +7 -20
  47. package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-rename.ts +172 -0
  48. package/node_modules/@mrclrchtr/supi-lsp/src/session/workspace-lsp-runtime.ts +14 -0
  49. package/node_modules/@mrclrchtr/supi-lsp/src/utils.ts +12 -11
  50. package/node_modules/@mrclrchtr/supi-tree-sitter/README.md +63 -17
  51. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/LICENSE +21 -0
  52. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/README.md +743 -0
  53. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/index.js +17 -0
  54. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/lib/constants.js +184 -0
  55. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/lib/parse.js +1425 -0
  56. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/lib/picomatch.js +361 -0
  57. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/lib/scan.js +403 -0
  58. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/lib/utils.js +72 -0
  59. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/package.json +83 -0
  60. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/posix.js +3 -0
  61. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/package.json +4 -1
  62. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/api.ts +11 -0
  63. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/file-associations.ts +190 -0
  64. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/types.ts +22 -0
  65. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/package.json +1 -1
  66. package/node_modules/@mrclrchtr/supi-tree-sitter/package.json +3 -3
  67. package/node_modules/@mrclrchtr/supi-tree-sitter/src/language.ts +16 -10
  68. package/node_modules/@mrclrchtr/supi-tree-sitter/src/operation-support.ts +13 -6
  69. package/node_modules/@mrclrchtr/supi-tree-sitter/src/provider/tree-sitter-provider.ts +19 -1
  70. package/node_modules/@mrclrchtr/supi-tree-sitter/src/session/runtime-controller.ts +18 -4
  71. package/node_modules/@mrclrchtr/supi-tree-sitter/src/session/session.ts +10 -3
  72. package/node_modules/@mrclrchtr/supi-tree-sitter/src/session/structural-worker-client.ts +17 -2
  73. package/node_modules/@mrclrchtr/supi-tree-sitter/src/session/structural-worker-process.ts +22 -5
  74. package/node_modules/@mrclrchtr/supi-tree-sitter/src/session/structural-worker-protocol.ts +36 -1
  75. package/node_modules/@mrclrchtr/supi-tree-sitter/src/syntax-errors.ts +73 -0
  76. package/node_modules/@mrclrchtr/supi-tree-sitter/src/syntax-node.ts +4 -0
  77. package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/call-sites.ts +15 -9
  78. package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/callees.ts +24 -15
  79. package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/exports.ts +8 -1
  80. package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/imports.ts +233 -7
  81. package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/node-at.ts +7 -3
  82. package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/outline-expansion.ts +78 -0
  83. package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/outline-jvm.ts +25 -4
  84. package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/outline-nested.ts +390 -0
  85. package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/outline.ts +49 -28
  86. package/node_modules/@mrclrchtr/supi-tree-sitter/src/types.ts +16 -0
  87. package/node_modules/@mrclrchtr/supi-tree-sitter/src/worker/process-host.mjs +61 -24
  88. package/node_modules/@mrclrchtr/supi-tree-sitter/src/worker/runtime.ts +44 -10
  89. package/node_modules/@mrclrchtr/supi-tree-sitter/src/worker/service.ts +13 -9
  90. package/node_modules/@mrclrchtr/supi-tree-sitter/src/worker/worker-main.ts +15 -2
  91. package/node_modules/smol-toml/LICENSE +24 -0
  92. package/node_modules/smol-toml/README.md +605 -0
  93. package/node_modules/smol-toml/dist/date.d.ts +41 -0
  94. package/node_modules/smol-toml/dist/date.js +156 -0
  95. package/node_modules/smol-toml/dist/error.d.ts +37 -0
  96. package/node_modules/smol-toml/dist/error.js +67 -0
  97. package/node_modules/smol-toml/dist/extract.js +293 -0
  98. package/node_modules/smol-toml/dist/index.cjs +771 -0
  99. package/node_modules/smol-toml/dist/index.d.ts +44 -0
  100. package/node_modules/smol-toml/dist/index.js +34 -0
  101. package/node_modules/smol-toml/dist/parse.d.ts +73 -0
  102. package/node_modules/smol-toml/dist/parse.js +164 -0
  103. package/node_modules/smol-toml/dist/primitive.js +151 -0
  104. package/node_modules/smol-toml/dist/stringify.d.ts +32 -0
  105. package/node_modules/smol-toml/dist/stringify.js +219 -0
  106. package/node_modules/smol-toml/dist/struct.js +156 -0
  107. package/node_modules/smol-toml/dist/util.d.ts +43 -0
  108. package/node_modules/smol-toml/dist/util.js +57 -0
  109. package/node_modules/smol-toml/package.json +68 -0
  110. package/package.json +9 -5
  111. package/src/analysis/refactor/apply.ts +35 -14
  112. package/src/analysis/relations/callees.ts +9 -2
  113. package/src/analysis/relations/implementations.ts +7 -2
  114. package/src/analysis/search/pattern-analysis.ts +90 -12
  115. package/src/analysis/search/pattern.ts +1 -0
  116. package/src/analysis/target/anchored-structural.ts +1 -0
  117. package/src/analysis/target/discovery.ts +29 -0
  118. package/src/analysis/target/file.ts +19 -9
  119. package/src/analysis/target/types.ts +5 -0
  120. package/src/analysis/workspace/exclusions.ts +35 -0
  121. package/src/analysis/workspace/git.ts +130 -0
  122. package/src/analysis/workspace/go-parser.ts +330 -0
  123. package/src/analysis/workspace/go.ts +154 -0
  124. package/src/analysis/workspace/index.ts +28 -0
  125. package/src/analysis/workspace/inventory.ts +316 -0
  126. package/src/analysis/workspace/membership.ts +223 -0
  127. package/src/analysis/workspace/metadata-types.ts +56 -0
  128. package/src/analysis/workspace/metadata-utils.ts +60 -0
  129. package/src/analysis/workspace/metadata.ts +148 -0
  130. package/src/analysis/workspace/node.ts +214 -0
  131. package/src/analysis/workspace/observe.ts +161 -0
  132. package/src/analysis/workspace/paths.ts +65 -0
  133. package/src/analysis/workspace/python.ts +158 -0
  134. package/src/analysis/workspace/relationships.ts +87 -0
  135. package/src/analysis/workspace/rust.ts +238 -0
  136. package/src/analysis/workspace/safe-path.ts +20 -0
  137. package/src/analysis/workspace/types.ts +245 -0
  138. package/src/app/app.ts +1 -0
  139. package/src/config.ts +50 -11
  140. package/src/extension.ts +16 -49
  141. package/src/overview/budget.ts +23 -0
  142. package/src/overview/collect.ts +22 -0
  143. package/src/session/graph/collect.ts +2 -2
  144. package/src/session/graph-types.ts +6 -0
  145. package/src/session/inspect/collect.ts +35 -20
  146. package/src/session/inspect-types.ts +9 -2
  147. package/src/session/orientation/collect.ts +90 -18
  148. package/src/session/orientation/context-sections.ts +22 -1
  149. package/src/session/orientation/gather.ts +46 -6
  150. package/src/session/orientation/workspace-context.ts +166 -0
  151. package/src/session/orientation-types.ts +15 -2
  152. package/src/session/orientation-workflow.ts +14 -3
  153. package/src/session/refactor-plans.ts +17 -0
  154. package/src/session/refactor-workflow.ts +13 -6
  155. package/src/session/session.ts +2 -3
  156. package/src/session/target-store.ts +5 -0
  157. package/src/session/target-workflow.ts +3 -0
  158. package/src/substrate/workspace-provider-host.ts +22 -2
  159. package/src/tool/code_find/markdown.ts +17 -4
  160. package/src/tool/code_find/result.ts +17 -3
  161. package/src/tool/code_graph/details.ts +2 -0
  162. package/src/tool/code_graph/display.ts +1 -0
  163. package/src/tool/code_graph/format.ts +1 -0
  164. package/src/tool/code_graph/result.ts +32 -6
  165. package/src/tool/code_inspect/markdown.ts +15 -1
  166. package/src/tool/code_inspect/result.ts +11 -0
  167. package/src/tool/code_orientation/execute.ts +8 -1
  168. package/src/tool/code_orientation/markdown.ts +58 -8
  169. package/src/tool/code_orientation/result.ts +15 -4
  170. package/src/tool/code_orientation/workspace-format.ts +74 -0
  171. package/src/tool/code_orientation/workspace-instructions.ts +105 -0
  172. package/src/tool/code_orientation/workspace-output.ts +118 -0
  173. package/src/tool/code_orientation/workspace-projects.ts +177 -0
  174. package/src/tool/code_orientation/workspace-sections.ts +217 -0
  175. package/src/tool/code_resolve/markdown.ts +34 -14
  176. package/src/tool/code_resolve/result.ts +7 -3
  177. package/src/tool/register.ts +2 -0
  178. package/src/tool/result/types.ts +20 -2
  179. package/src/types/execution.ts +2 -0
  180. package/src/ui/tui/display.ts +2 -1
  181. package/src/overview/overview-data.ts +0 -154
  182. package/src/overview/overview.ts +0 -91
  183. package/src/overview/types.ts +0 -23
  184. /package/node_modules/{@mrclrchtr/supi-lsp/node_modules/ignore → ignore}/LICENSE-MIT +0 -0
  185. /package/node_modules/{@mrclrchtr/supi-lsp/node_modules/ignore → ignore}/README.md +0 -0
  186. /package/node_modules/{@mrclrchtr/supi-lsp/node_modules/ignore → ignore}/index.d.ts +0 -0
  187. /package/node_modules/{@mrclrchtr/supi-lsp/node_modules/ignore → ignore}/index.js +0 -0
  188. /package/node_modules/{@mrclrchtr/supi-lsp/node_modules/ignore → ignore}/legacy.js +0 -0
  189. /package/node_modules/{@mrclrchtr/supi-lsp/node_modules/ignore → ignore}/package.json +0 -0
@@ -0,0 +1,245 @@
1
+ /**
2
+ * Shared, presentation-neutral workspace observation types.
3
+ *
4
+ * These facts come from bounded filesystem inventory and explicitly parsed
5
+ * project metadata. They do not describe runtime architecture, source roots,
6
+ * installed dependency resolution, or inferred project roles.
7
+ */
8
+
9
+ /** How the inventory selected files. */
10
+ export type InventorySource = "git" | "filesystem";
11
+
12
+ /** Inventory entries are regular files or symbolic links. Link targets are not followed. */
13
+ export type InventoryEntryKind = "file" | "symlink";
14
+
15
+ /** One workspace-relative inventory path. */
16
+ export interface InventoryEntry {
17
+ /** Root-relative POSIX path. */
18
+ readonly path: string;
19
+ /** Filesystem entry kind observed without following symbolic links. */
20
+ readonly kind: InventoryEntryKind;
21
+ }
22
+
23
+ /** Lower-level reason that stopped inventory traversal. */
24
+ export type InventoryStopReason = "complete" | "entry-limit" | "deadline";
25
+
26
+ /** Declared collection bounds for one observation. */
27
+ export interface CollectionLimits {
28
+ /** Maximum number of inventory entries that collection may retain. */
29
+ readonly maxEntries: number;
30
+ /** Absolute Unix-epoch deadline, or null when the caller set no deadline. */
31
+ readonly deadline: number | null;
32
+ }
33
+
34
+ /** Failure or limitation observed during collection. */
35
+ export interface WorkspaceObservationError {
36
+ /** Collection stage that produced the error. */
37
+ readonly stage: "inventory" | "metadata";
38
+ /** Root-relative path, or null when no single path applies. */
39
+ readonly path: string | null;
40
+ /** Human-readable reason. */
41
+ readonly reason: string;
42
+ }
43
+
44
+ /** Honest completeness state for one observation. */
45
+ export interface WorkspaceCollection {
46
+ /** Complete only when inventory and all eligible metadata were read without limits or errors. */
47
+ readonly status: "complete" | "partial";
48
+ /** Lower-level inventory stop reason. */
49
+ readonly stopReason: InventoryStopReason;
50
+ /** Root-relative explicit directory visited first, or null for ordinary traversal. */
51
+ readonly prioritizedDirectory: string | null;
52
+ /** Bounds applied to this observation. */
53
+ readonly limits: CollectionLimits;
54
+ /** Inventory or metadata errors that affected completeness. */
55
+ readonly errors: readonly WorkspaceObservationError[];
56
+ }
57
+
58
+ /** Explicit inclusion policy captured by one observation. */
59
+ export interface WorkspaceInclusionPolicy {
60
+ /** How the inventory selected files. */
61
+ readonly source: InventorySource;
62
+ /** Caller-supplied Gitignore-style exclusion patterns. */
63
+ readonly exclude: readonly string[];
64
+ /** Whether Git-ignored untracked paths were included for an explicit focus. */
65
+ readonly includeIgnored: boolean;
66
+ /** Symbolic links are returned as entries, never traversed or read through. */
67
+ readonly symlinks: "not-followed";
68
+ /** No directory name is excluded by convention or inferred role. */
69
+ readonly directoryNamesExcluded: false;
70
+ }
71
+
72
+ /** Parsed metadata file kinds supported by the shared observation. */
73
+ export type MetadataDocumentKind =
74
+ | "package-json"
75
+ | "pnpm-workspace"
76
+ | "pyproject"
77
+ | "cargo"
78
+ | "go-mod"
79
+ | "go-work";
80
+
81
+ /** Metadata read outcome retained for provenance. */
82
+ export interface MetadataDocument {
83
+ /** Root-relative document path. */
84
+ readonly path: string;
85
+ readonly kind: MetadataDocumentKind;
86
+ /** Parsed documents can establish declarations; skipped documents are symlinks or non-files. */
87
+ readonly status: "parsed" | "failed" | "skipped";
88
+ /** Failure or skip reason; null for parsed documents. */
89
+ readonly reason: string | null;
90
+ }
91
+
92
+ /** Kind of unsupported, dynamic, inherited, or malformed metadata fact. */
93
+ export type MetadataIssueKind =
94
+ | "malformed"
95
+ | "unreadable"
96
+ | "unsupported"
97
+ | "dynamic"
98
+ | "inherited"
99
+ | "symlink"
100
+ | "unresolved";
101
+
102
+ /** One disclosed metadata limitation with source provenance. */
103
+ export interface MetadataIssue {
104
+ /** Root-relative document path. */
105
+ readonly path: string;
106
+ /** Exact field or directive path, or null for a document-wide issue. */
107
+ readonly field: string | null;
108
+ readonly kind: MetadataIssueKind;
109
+ /** Why the declaration was not interpreted. */
110
+ readonly reason: string;
111
+ }
112
+
113
+ /** Metadata documents and limitations from one observation. */
114
+ export interface WorkspaceMetadataObservation {
115
+ readonly documents: readonly MetadataDocument[];
116
+ readonly issues: readonly MetadataIssue[];
117
+ }
118
+
119
+ /** Native project declaration kinds supported by this collector. */
120
+ export type ProjectKind = "node-package" | "python-project" | "rust-package" | "go-module";
121
+
122
+ /** How one configuration explicitly established project membership. */
123
+ export interface ProjectMembership {
124
+ /** Native workspace declaration family. */
125
+ readonly kind: "node-workspace" | "cargo-workspace" | "go-work";
126
+ /** Root-relative configuration or manifest path that declared membership. */
127
+ readonly manifestPath: string;
128
+ /** Exact declaring field or directive. */
129
+ readonly field: string;
130
+ /** Membership pattern or path exactly as declared. */
131
+ readonly value: string;
132
+ }
133
+
134
+ /** A parsed workspace declaration, including unmatched patterns and exclusions. */
135
+ export interface WorkspaceDeclaration {
136
+ readonly kind: ProjectMembership["kind"];
137
+ readonly manifestPath: string;
138
+ readonly directory: string;
139
+ /** Native field or directive for the membership values. */
140
+ readonly field: string;
141
+ readonly patterns: readonly string[];
142
+ /** Native exclusion field, or null when there is no separate exclusion field. */
143
+ readonly excludeField: string | null;
144
+ readonly excludes: readonly string[];
145
+ }
146
+
147
+ /** One path explicitly declared by project metadata. No field has entrypoint precedence. */
148
+ export interface DeclaredPath {
149
+ /** Exact source field, including nested keys such as `exports["."]`. */
150
+ readonly field: string;
151
+ /** Path text exactly as declared. */
152
+ readonly path: string;
153
+ }
154
+
155
+ /**
156
+ * One dependency-family declaration.
157
+ *
158
+ * `field` keeps separate categories separate. `name` is the declared
159
+ * dependency key or parsed requirement name. `value` is the exact parsed
160
+ * declaration value and may be a string, array, or table.
161
+ */
162
+ export interface DeclaredDependency {
163
+ readonly field: string;
164
+ readonly name: string;
165
+ readonly value: unknown;
166
+ }
167
+
168
+ /** One explicitly declared local project relationship. */
169
+ export interface ProjectRelationship {
170
+ /** Stable source project ID (its root-relative manifest path). */
171
+ readonly from: string;
172
+ /** Stable target project ID (its root-relative manifest path). */
173
+ readonly to: string;
174
+ /** Root-relative manifest that declared the relationship. */
175
+ readonly manifestPath: string;
176
+ /** Exact dependency field that declared the relationship. */
177
+ readonly field: string;
178
+ /** Exact declared dependency value. */
179
+ readonly value: unknown;
180
+ }
181
+
182
+ /** One parsed project declaration with retained native provenance. */
183
+ export interface ProjectDeclaration {
184
+ /** Stable identity: root-relative manifest path. Equal to `manifestPath`. */
185
+ readonly id: string;
186
+ /** Root-relative manifest path. */
187
+ readonly manifestPath: string;
188
+ readonly kind: ProjectKind;
189
+ /** Root-relative project directory; `.` for the observation root. */
190
+ readonly directory: string;
191
+ /** Native identity value, or null when the manifest does not declare a usable value. */
192
+ readonly name: string | null;
193
+ /** Exact field that declared `name`, or null. */
194
+ readonly nameField: string | null;
195
+ /** One-line description when explicitly declared as a string. */
196
+ readonly description: string | null;
197
+ /** Exact field that declared `description`, or null. */
198
+ readonly descriptionField: string | null;
199
+ /** Explicit workspace memberships; this is not inferred from directory adjacency. */
200
+ readonly memberships: readonly ProjectMembership[];
201
+ /** Explicitly declared paths with their source fields. */
202
+ readonly declaredPaths: readonly DeclaredPath[];
203
+ /** Explicit dependency declarations, grouped by their exact source fields. */
204
+ readonly dependencies: readonly DeclaredDependency[];
205
+ }
206
+
207
+ /** Inventory and its source policy. */
208
+ export interface WorkspaceInventory {
209
+ readonly source: InventorySource;
210
+ readonly entries: readonly InventoryEntry[];
211
+ }
212
+
213
+ /** Immutable result of one bounded workspace observation. */
214
+ export interface WorkspaceObservation {
215
+ /** Absolute requested working directory. It is never widened to an ancestor. */
216
+ readonly root: string;
217
+ readonly inventory: WorkspaceInventory;
218
+ readonly inclusion: WorkspaceInclusionPolicy;
219
+ readonly collection: WorkspaceCollection;
220
+ readonly metadata: WorkspaceMetadataObservation;
221
+ readonly projects: readonly ProjectDeclaration[];
222
+ readonly workspaces: readonly WorkspaceDeclaration[];
223
+ /** Declared local relationships between uniquely identified projects. */
224
+ readonly relationships: readonly ProjectRelationship[];
225
+ }
226
+
227
+ /** Bounded collection controls for `observeWorkspace`. */
228
+ export interface ObserveWorkspaceOptions {
229
+ /** Additional Gitignore-style exclusions, matched relative to the requested root. */
230
+ readonly exclude?: readonly string[];
231
+ /**
232
+ * Include Git-ignored untracked paths. Use this for an explicit directory
233
+ * focus whose ignored contents must remain inspectable.
234
+ */
235
+ readonly includeIgnored?: boolean;
236
+ /** Maximum retained inventory entries. Defaults to 10,000. */
237
+ readonly maxEntries?: number;
238
+ /** Explicit in-root directory to collect before spending the inventory budget elsewhere. */
239
+ readonly prioritizeDirectory?: string;
240
+ /**
241
+ * Caller cancellation and absolute deadline. Cancellation throws the abort
242
+ * reason; a reached deadline returns an honest partial observation.
243
+ */
244
+ readonly control?: import("@mrclrchtr/supi-code-runtime/api").CodeRequestControl;
245
+ }
package/src/app/app.ts CHANGED
@@ -115,6 +115,7 @@ export function createCodeIntelligenceApp(pi: ExtensionAPI): CodeIntelligenceApp
115
115
  session.reconstructInstructionState(
116
116
  branch as Parameters<typeof session.reconstructInstructionState>[0],
117
117
  );
118
+ session.restoreOverviewInjection(false);
118
119
  for (const entry of branch as Array<{ type?: string; customType?: string }>) {
119
120
  if (entry.type === "custom_message" && entry.customType === OVERVIEW_CUSTOM_TYPE) {
120
121
  session.restoreOverviewInjection();
package/src/config.ts CHANGED
@@ -2,9 +2,15 @@
2
2
 
3
3
  import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
4
4
  import {
5
+ type CFamilyFileAssociationResolver,
6
+ createCFamilyFileAssociationResolver,
7
+ } from "@mrclrchtr/supi-code-runtime/api";
8
+ import {
9
+ getSupiConfigPath,
5
10
  loadAutomaticExclusionPatterns,
6
11
  loadSupiConfig,
7
12
  loadSupiConfigForScope,
13
+ loadSupiConfigSectionForScope,
8
14
  } from "@mrclrchtr/supi-core/config";
9
15
  import {
10
16
  defineConfigSettings,
@@ -18,9 +24,9 @@ const CODE_INTELLIGENCE_SECTION = "code-intelligence";
18
24
  export interface CodeIntelligenceConfig extends Record<string, unknown> {
19
25
  /** Ordered directory-local instruction file names to surface during directory orientation. */
20
26
  instructionFileNames: string[];
21
- /** Inject the hidden first-turn workspace architecture overview when enabled. */
27
+ /** Inject the hidden first-turn workspace overview when enabled. */
22
28
  overviewEnabled: boolean;
23
- /** Gitignore-style paths excluded from automatic LSP and broad AST work. */
29
+ /** Gitignore-style paths excluded from automatic navigation, LSP, and broad AST work. */
24
30
  exclude: string[];
25
31
  }
26
32
 
@@ -46,16 +52,49 @@ export function loadCodeIntelligenceConfig(
46
52
  return loaded;
47
53
  }
48
54
 
55
+ /**
56
+ * Load C-family associations from trusted project configuration only.
57
+ *
58
+ * `fileAssociations` is an ordered array of `{ pattern, language }` rules.
59
+ * Patterns are case-sensitive globs. Use `*`, `?`, `**`, character classes,
60
+ * and brace alternatives. Patterns
61
+ * match POSIX-style paths relative to the workspace root. The first match
62
+ * wins. A rule accepts
63
+ * only `c` or `cpp` and only changes an existing C-family suffix. Global
64
+ * values do not apply. An untrusted project returns the default mapping
65
+ * without reading its configuration. The workspace host keeps this resolver
66
+ * until its last provider lease ends.
67
+ *
68
+ * @throws If a trusted project rule is invalid.
69
+ */
70
+ export function loadProjectFileAssociations(
71
+ cwd: string,
72
+ projectTrusted: boolean,
73
+ ): CFamilyFileAssociationResolver {
74
+ if (!projectTrusted) return createCFamilyFileAssociationResolver(cwd);
75
+ const section = loadSupiConfigSectionForScope("code-intelligence", cwd, {
76
+ scope: "project",
77
+ });
78
+ if (!section || !Object.hasOwn(section, "fileAssociations")) {
79
+ return createCFamilyFileAssociationResolver(cwd);
80
+ }
81
+ try {
82
+ return createCFamilyFileAssociationResolver(cwd, section.fileAssociations);
83
+ } catch (error) {
84
+ const detail = error instanceof Error ? error.message : String(error);
85
+ throw new Error(
86
+ `Invalid trusted project configuration in ${getSupiConfigPath("project", cwd)}: ${detail}`,
87
+ { cause: error },
88
+ );
89
+ }
90
+ }
91
+
49
92
  /**
50
93
  * Resolve the overview setting for one session boundary.
51
94
  *
52
- * Project-scoped values apply only when the project is trusted (ADR 0002's
53
- * global/trusted-project scope precedence). Only a strict boolean `true`
54
- * enables injection; any other value, including malformed non-boolean
55
- * values, fails closed. Unreadable or invalid config files and non-object
56
- * sections fall back to defaults through the shared supi-core loader, the
57
- * same semantics every other SuPi setting uses; fail-closed covers values
58
- * inside a well-formed section.
95
+ * Project-scoped values apply only when the project is trusted. Only a strict
96
+ * boolean `true` enables injection; malformed values fail closed. Unreadable
97
+ * files and non-object sections use the shared config-loader defaults.
59
98
  */
60
99
  export function resolveOverviewEnabled(
61
100
  cwd: string,
@@ -84,14 +123,14 @@ export function registerCodeIntelligenceSettings(pi: ExtensionAPI, homeDir?: str
84
123
  kind: "boolean" as const,
85
124
  key: "overviewEnabled",
86
125
  label: "Overview Enabled",
87
- description: "Inject the hidden first-turn workspace architecture overview",
126
+ description: "Inject the hidden first-turn workspace overview",
88
127
  },
89
128
  {
90
129
  kind: "stringList" as const,
91
130
  key: "exclude",
92
131
  label: "Automatic Exclusions",
93
132
  description:
94
- "Gitignore-style patterns for automatic LSP and broad AST work. Edit the project or global config, then reload or restart Pi; exact requests stay available.",
133
+ "Gitignore-style patterns for automatic navigation, LSP, and broad AST work. Reload or restart Pi for runtime scans; exact requests stay available.",
95
134
  },
96
135
  ],
97
136
  ...(homeDir ? { homeDir } : {}),
package/src/extension.ts CHANGED
@@ -1,20 +1,11 @@
1
1
  // Code Intelligence extension entry point — registers the focused code-intelligence tools,
2
2
  // shared provider lifecycle, settings, UI, and the unified /supi-ci-status command.
3
3
 
4
- import type {
5
- BeforeAgentStartEventResult,
6
- ExtensionAPI,
7
- ExtensionContext,
8
- } from "@earendil-works/pi-coding-agent";
9
- import {
10
- recordDebugEvent,
11
- truncateDebugIdentity as truncateIdentity,
12
- } from "@mrclrchtr/supi-core/debug";
13
- import { buildArchitectureModel } from "./analysis/architecture/discovery.ts";
4
+ import type { BeforeAgentStartEventResult, ExtensionAPI } from "@earendil-works/pi-coding-agent";
14
5
  import { createCodeIntelligenceApp } from "./app/app.ts";
15
6
  import { registerCodeIntelligenceSettings, resolveOverviewEnabled } from "./config.ts";
16
- import { estimateTokens, OVERVIEW_TOKEN_BUDGET, renderOverview } from "./overview/overview.ts";
17
- import { buildOverviewData } from "./overview/overview-data.ts";
7
+ import { reportWorkspaceBudget } from "./overview/budget.ts";
8
+ import { collectOverview } from "./overview/collect.ts";
18
9
  import type { WorkspaceCodeIntelligenceSession } from "./session/session.ts";
19
10
  import { registerLspSessionLifecycle } from "./substrate/lsp/lifecycle.ts";
20
11
  import { registerWorkspaceRecoveryHandler } from "./substrate/lsp/recovery.ts";
@@ -26,27 +17,6 @@ import { registerCiStatusCommand } from "./ui/status-command.ts";
26
17
 
27
18
  const OVERVIEW_CUSTOM_TYPE = "code-intelligence-overview";
28
19
 
29
- /**
30
- * Warn about an over-budget overview without capping it.
31
- *
32
- * The injected overview is never truncated; the debug record exists in every
33
- * mode, and the visible notification needs a UI.
34
- */
35
- function warnOverviewBudget(ctx: ExtensionContext, estimatedTokens: number): void {
36
- const message = `Code Intelligence overview exceeds soft token budget: ${estimatedTokens} tokens (budget: ${OVERVIEW_TOKEN_BUDGET})`;
37
- recordDebugEvent({
38
- source: "code-intelligence",
39
- level: "warning",
40
- category: "overview",
41
- message,
42
- cwd: truncateIdentity(ctx.cwd),
43
- data: { estimatedTokens, budget: OVERVIEW_TOKEN_BUDGET },
44
- });
45
- if (ctx.hasUI) {
46
- ctx.ui.notify(message, "warning");
47
- }
48
- }
49
-
50
20
  /** Register the full interactive Code Intelligence profile. */
51
21
  export default function codeIntelligenceExtension(
52
22
  pi: ExtensionAPI,
@@ -129,23 +99,20 @@ export default function codeIntelligenceExtension(
129
99
  }
130
100
  if (!session.claimOverviewInjection()) return;
131
101
 
132
- const model = await buildArchitectureModel(ctx.cwd);
133
- if (model.modules.length === 0) return;
134
-
135
- const data = buildOverviewData(model);
136
- if (!data) return;
137
-
138
- const overview = renderOverview(data);
139
- if (!overview) return;
140
-
141
- const estimatedTokens = estimateTokens(overview);
142
- if (estimatedTokens > OVERVIEW_TOKEN_BUDGET) {
143
- warnOverviewBudget(ctx, estimatedTokens);
102
+ try {
103
+ const overview = await collectOverview(ctx.cwd, ctx.isProjectTrusted(), homeDir);
104
+ if (!overview) {
105
+ session.restoreOverviewInjection(false);
106
+ return;
107
+ }
108
+ reportWorkspaceBudget(ctx, overview.warning);
109
+ return {
110
+ message: { customType: OVERVIEW_CUSTOM_TYPE, display: false, content: overview.content },
111
+ };
112
+ } catch (error) {
113
+ session.restoreOverviewInjection(false);
114
+ throw error;
144
115
  }
145
-
146
- return {
147
- message: { customType: OVERVIEW_CUSTOM_TYPE, display: false, content: overview },
148
- };
149
116
  },
150
117
  );
151
118
  }
@@ -0,0 +1,23 @@
1
+ import type { ExtensionContext } from "@earendil-works/pi-coding-agent";
2
+ import { recordDebugEvent, truncateDebugIdentity } from "@mrclrchtr/supi-core/debug";
3
+ import type { WorkspaceBudgetWarning } from "../tool/code_orientation/workspace-output.ts";
4
+
5
+ /** Keep soft-limit notices out of model content in every execution mode. */
6
+ export function reportWorkspaceBudget(
7
+ ctx: ExtensionContext,
8
+ warning: WorkspaceBudgetWarning | undefined,
9
+ operationId?: string,
10
+ ): void {
11
+ if (!warning) return;
12
+ const message = `Code Intelligence ${warning.surface} exceeds soft token budget: ${warning.estimatedTokens} estimated tokens (budget: ${warning.threshold})`;
13
+ recordDebugEvent({
14
+ source: "code-intelligence",
15
+ level: "warning",
16
+ category: warning.surface,
17
+ cwd: truncateDebugIdentity(ctx.cwd),
18
+ message,
19
+ operationId,
20
+ data: { estimatedTokens: warning.estimatedTokens, budget: warning.threshold },
21
+ });
22
+ if (ctx.hasUI) ctx.ui.notify(message, "warning");
23
+ }
@@ -0,0 +1,22 @@
1
+ import { statSync } from "node:fs";
2
+ import { loadAutomaticExclusionPatterns } from "@mrclrchtr/supi-core/config";
3
+ import { observeWorkspace } from "../analysis/workspace/observe.ts";
4
+ import { workspaceOrientationData } from "../session/orientation/workspace-context.ts";
5
+ import { prepareWorkspaceOutput } from "../tool/code_orientation/workspace-output.ts";
6
+
7
+ /** Capture a first-turn map without requiring any project metadata or provider. */
8
+ export async function collectOverview(cwd: string, projectTrusted: boolean, homeDir?: string) {
9
+ try {
10
+ if (!statSync(cwd).isDirectory()) return null;
11
+ } catch {
12
+ return null;
13
+ }
14
+ const exclude = loadAutomaticExclusionPatterns(cwd, { projectTrusted, homeDir });
15
+ const observation = await observeWorkspace(cwd, {
16
+ exclude,
17
+ control: { deadline: Date.now() + 10_000 },
18
+ });
19
+ return prepareWorkspaceOutput(
20
+ workspaceOrientationData({ observation, cwd, focus: null, maxResults: 10, overview: true }),
21
+ );
22
+ }
@@ -156,7 +156,7 @@ async function collectCalleesRelation(options: CollectRelationOptions): Promise<
156
156
  return {
157
157
  kind: "ok",
158
158
  rel: "callees",
159
- data: { enclosingScope, calls, depth: result.depth },
159
+ data: { enclosingScope, calls, depth: result.depth, recovery: result.partial },
160
160
  readNext: [
161
161
  readNextEnclosingScope(
162
162
  toDisplayPath(options.cwd, options.file),
@@ -187,7 +187,7 @@ async function collectImplementationsRelation(
187
187
  },
188
188
  });
189
189
  if (result.confidence === "unavailable") {
190
- return { kind: "unavailable", rel: "implements", message: "Implementations unavailable" };
190
+ return { kind: "unavailable", rel: "implements", message: result.message };
191
191
  }
192
192
 
193
193
  return {
@@ -1,3 +1,4 @@
1
+ import type { SourceRange } from "@mrclrchtr/supi-code-runtime/api";
1
2
  import type { ReadNextItem } from "../analysis/read-next.ts";
2
3
  import type { RelationLocationPartialReason } from "../analysis/relations/provider-locations.ts";
3
4
  import type {
@@ -42,6 +43,11 @@ export type GraphSection =
42
43
  readonly enclosingScope: CalleeScope;
43
44
  readonly calls: readonly CallEntry[];
44
45
  readonly depth: "direct" | "deep";
46
+ readonly recovery: {
47
+ readonly file: string;
48
+ readonly reason: string;
49
+ readonly errorRanges: readonly SourceRange[];
50
+ } | null;
45
51
  };
46
52
  readonly readNext: readonly ReadNextItem[];
47
53
  }
@@ -59,19 +59,26 @@ async function collectNode(
59
59
  input.character,
60
60
  input.requestControl,
61
61
  );
62
- if (result.kind !== "success") return unavailableCodeQuery(result.message);
63
- return {
64
- kind: "completed",
65
- data: {
66
- type: result.data.type,
67
- text: result.data.text,
68
- startLine: result.data.startLine,
69
- startCharacter: result.data.startCharacter,
70
- endLine: result.data.endLine,
71
- endCharacter: result.data.endCharacter,
72
- ancestry: result.data.ancestry ?? [],
73
- },
62
+ if (result.kind !== "success" && result.kind !== "partial") {
63
+ return unavailableCodeQuery(result.message);
64
+ }
65
+ const data: InspectNode = {
66
+ type: result.data.type,
67
+ text: result.data.text,
68
+ startLine: result.data.startLine,
69
+ startCharacter: result.data.startCharacter,
70
+ endLine: result.data.endLine,
71
+ endCharacter: result.data.endCharacter,
72
+ ancestry: result.data.ancestry ?? [],
74
73
  };
74
+ return result.kind === "partial"
75
+ ? {
76
+ kind: "partial",
77
+ data,
78
+ reason: result.reason,
79
+ recovery: { file: result.file, errorRanges: result.errorRanges },
80
+ }
81
+ : { kind: "completed", data };
75
82
  } catch (error) {
76
83
  if (isCodeRequestInterruption(error, input.requestControl)) throw error;
77
84
  return unavailableCodeQuery(failureReason("Structural node lookup", error));
@@ -84,14 +91,21 @@ async function collectEnclosingSymbol(
84
91
  if (!input.structural) return unavailableCodeQuery("No structural outline provider is active.");
85
92
  try {
86
93
  const result = await input.structural.outline(input.file, input.requestControl);
87
- if (result.kind !== "success") return unavailableCodeQuery(result.message);
88
- return {
89
- kind: "completed",
90
- data: narrowestEnclosingSymbol(result.data, {
91
- line: input.line,
92
- character: input.character,
93
- }),
94
- };
94
+ if (result.kind !== "success" && result.kind !== "partial") {
95
+ return unavailableCodeQuery(result.message);
96
+ }
97
+ const symbol = narrowestEnclosingSymbol(result.data, {
98
+ line: input.line,
99
+ character: input.character,
100
+ });
101
+ return result.kind === "partial"
102
+ ? {
103
+ kind: "partial",
104
+ data: symbol,
105
+ reason: result.reason,
106
+ recovery: { file: result.file, errorRanges: result.errorRanges },
107
+ }
108
+ : { kind: "completed", data: symbol };
95
109
  } catch (error) {
96
110
  if (isCodeRequestInterruption(error, input.requestControl)) throw error;
97
111
  return unavailableCodeQuery(failureReason("Structural outline lookup", error));
@@ -209,6 +223,7 @@ function flattenOutline(
209
223
  const candidate: OutlineCandidate = {
210
224
  name: item.name,
211
225
  kind: item.kind,
226
+ ...(item.nativeKind ? { nativeKind: item.nativeKind } : {}),
212
227
  startLine: item.startLine,
213
228
  startCharacter: item.startCharacter,
214
229
  endLine: item.endLine,
@@ -1,4 +1,8 @@
1
- import type { CodeQueryResult, ConfidenceMode } from "@mrclrchtr/supi-code-runtime/api";
1
+ import type {
2
+ CodeQueryResult,
3
+ ConfidenceMode,
4
+ SourceRange,
5
+ } from "@mrclrchtr/supi-code-runtime/api";
2
6
  import type { SourcePointInput } from "./target-input.ts";
3
7
 
4
8
  /** Canonical code_inspect workflow input. */
@@ -7,7 +11,9 @@ export interface InspectWorkflowInput {
7
11
  readonly maxResults?: number;
8
12
  }
9
13
 
10
- export type InspectObservation<T> = CodeQueryResult<T>;
14
+ export type InspectObservation<T> = CodeQueryResult<T> & {
15
+ readonly recovery?: { readonly file: string; readonly errorRanges: readonly SourceRange[] };
16
+ };
11
17
 
12
18
  export interface InspectNode {
13
19
  readonly type: string;
@@ -28,6 +34,7 @@ export interface InspectNode {
28
34
  export interface InspectEnclosingSymbol {
29
35
  readonly name: string;
30
36
  readonly kind: string;
37
+ readonly nativeKind?: string;
31
38
  readonly startLine: number;
32
39
  readonly startCharacter: number;
33
40
  readonly endLine: number;