@mrclrchtr/supi-code-intelligence 11.2.0 → 11.4.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 (145) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/README.md +19 -9
  3. package/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
  4. package/node_modules/@mrclrchtr/supi-code-runtime/src/api.ts +2 -1
  5. package/node_modules/@mrclrchtr/supi-code-runtime/src/capability/types.ts +3 -1
  6. package/node_modules/@mrclrchtr/supi-code-runtime/src/declaration-level.ts +34 -0
  7. package/node_modules/@mrclrchtr/supi-code-runtime/src/query-result.ts +9 -0
  8. package/node_modules/@mrclrchtr/supi-code-runtime/src/types.ts +13 -5
  9. package/node_modules/@mrclrchtr/supi-core/package.json +1 -1
  10. package/node_modules/@mrclrchtr/supi-core/src/child-web-tools.ts +110 -0
  11. package/node_modules/@mrclrchtr/supi-core/src/session.ts +11 -0
  12. package/node_modules/@mrclrchtr/supi-lsp/README.md +40 -3
  13. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
  14. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/api.ts +2 -1
  15. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/capability/types.ts +3 -1
  16. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/declaration-level.ts +34 -0
  17. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/query-result.ts +9 -0
  18. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/types.ts +13 -5
  19. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/package.json +1 -1
  20. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/child-web-tools.ts +110 -0
  21. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/session.ts +11 -0
  22. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/classes/range.js +2 -2
  23. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/internal/constants.js +30 -0
  24. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/internal/trim-comparator-whitespace.js +438 -0
  25. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/package.json +1 -1
  26. package/node_modules/@mrclrchtr/supi-lsp/package.json +3 -3
  27. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-collection.ts +11 -4
  28. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostics.ts +77 -6
  29. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-input-admission.ts +149 -0
  30. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-typescript-project.ts +40 -0
  31. package/node_modules/@mrclrchtr/supi-lsp/src/client/client.ts +151 -44
  32. package/node_modules/@mrclrchtr/supi-lsp/src/config/tsconfig-scope.ts +10 -0
  33. package/node_modules/@mrclrchtr/supi-lsp/src/diagnostics/evidence.ts +2 -2
  34. package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-typescript-coverage.ts +118 -0
  35. package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-workspace-symbol.ts +157 -23
  36. package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager.ts +318 -58
  37. package/node_modules/@mrclrchtr/supi-lsp/src/manager/typescript-file-local.ts +87 -0
  38. package/node_modules/@mrclrchtr/supi-lsp/src/provider/semantic-symbol-mapper.ts +22 -17
  39. package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-registry.ts +68 -6
  40. package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-rename.ts +1 -0
  41. package/node_modules/@mrclrchtr/supi-lsp/src/session/workspace-lsp-runtime.ts +5 -1
  42. package/node_modules/@mrclrchtr/supi-tree-sitter/README.md +2 -2
  43. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
  44. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/api.ts +2 -1
  45. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/capability/types.ts +3 -1
  46. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/declaration-level.ts +34 -0
  47. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/query-result.ts +9 -0
  48. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/types.ts +13 -5
  49. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/package.json +1 -1
  50. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/child-web-tools.ts +110 -0
  51. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/session.ts +11 -0
  52. package/node_modules/@mrclrchtr/supi-tree-sitter/package.json +3 -3
  53. package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/tsx/tree-sitter-tsx.wasm +0 -0
  54. package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/tsx/tree-sitter-tsx.wasm.json +9 -1
  55. package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/typescript/tree-sitter-typescript.wasm +0 -0
  56. package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/typescript/tree-sitter-typescript.wasm.json +9 -1
  57. package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/call-sites.ts +40 -25
  58. package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/callees.ts +2 -0
  59. package/node_modules/@mrclrchtr/supi-tree-sitter/src/worker/call-context.ts +44 -0
  60. package/package.json +6 -5
  61. package/src/analysis/health/server-status.ts +6 -2
  62. package/src/analysis/helpers.ts +0 -7
  63. package/src/analysis/relations/implementations.ts +5 -0
  64. package/src/analysis/relations/references.ts +5 -0
  65. package/src/analysis/search/exclusions.ts +47 -0
  66. package/src/analysis/search/paths.ts +32 -9
  67. package/src/analysis/target/anchored-structural.ts +3 -8
  68. package/src/analysis/target/anchored.ts +4 -20
  69. package/src/analysis/target/file-merge.ts +162 -0
  70. package/src/analysis/target/file-outline-omissions.ts +146 -0
  71. package/src/analysis/target/file-refinement.ts +7 -7
  72. package/src/analysis/target/file.ts +44 -156
  73. package/src/analysis/target/identity.ts +1 -1
  74. package/src/analysis/target/latex-label-container.ts +6 -6
  75. package/src/analysis/target/latex-section-anchor.ts +6 -6
  76. package/src/analysis/target/resolution.ts +18 -0
  77. package/src/analysis/target/symbol.ts +44 -12
  78. package/src/analysis/target/types.ts +38 -7
  79. package/src/api.ts +1 -1
  80. package/src/app/app.ts +9 -3
  81. package/src/extension.ts +17 -11
  82. package/src/session/graph/collect.ts +3 -10
  83. package/src/session/graph-types.ts +5 -1
  84. package/src/session/graph-workflow.ts +6 -4
  85. package/src/session/inspect/collect.ts +8 -2
  86. package/src/session/inspect/file-point.ts +2 -3
  87. package/src/session/inspect-workflow.ts +1 -1
  88. package/src/session/orientation/collect.ts +54 -16
  89. package/src/session/orientation/context-sections.ts +2 -3
  90. package/src/session/orientation/facts.ts +9 -1
  91. package/src/session/orientation/workspace-context.ts +3 -0
  92. package/src/session/orientation-types.ts +3 -0
  93. package/src/session/orientation-workflow.ts +24 -8
  94. package/src/session/refactor-identity.ts +76 -0
  95. package/src/session/refactor-workflow.ts +14 -16
  96. package/src/session/session.ts +87 -12
  97. package/src/session/target-store.ts +3 -18
  98. package/src/session/target-workflow.ts +56 -37
  99. package/src/substrate/lsp/recovery.ts +5 -5
  100. package/src/tool/code_find/render.ts +8 -4
  101. package/src/tool/code_find/result.ts +78 -6
  102. package/src/tool/code_find/spec.ts +4 -3
  103. package/src/tool/code_find/structured.ts +25 -9
  104. package/src/tool/code_graph/details.ts +1 -0
  105. package/src/tool/code_graph/display.ts +1 -1
  106. package/src/tool/code_graph/guidance.ts +1 -1
  107. package/src/tool/code_graph/markdown.ts +11 -6
  108. package/src/tool/code_graph/read-next.ts +38 -9
  109. package/src/tool/code_graph/reference-selection.ts +30 -0
  110. package/src/tool/code_graph/result.ts +25 -118
  111. package/src/tool/code_graph/section.ts +137 -0
  112. package/src/tool/code_graph/spec.ts +3 -3
  113. package/src/tool/code_graph/structured.ts +17 -6
  114. package/src/tool/code_health/display-paths.ts +92 -0
  115. package/src/tool/code_health/file-scope-markdown.ts +3 -2
  116. package/src/tool/code_health/result.ts +4 -2
  117. package/src/tool/code_health/spec.ts +3 -3
  118. package/src/tool/code_health/structured-schema.ts +44 -44
  119. package/src/tool/code_inspect/spec.ts +5 -1
  120. package/src/tool/code_inspect/structured.ts +1 -2
  121. package/src/tool/code_orientation/directory-navigation.ts +20 -31
  122. package/src/tool/code_orientation/execute.ts +1 -1
  123. package/src/tool/code_orientation/result.ts +22 -5
  124. package/src/tool/code_orientation/structured-schema.ts +46 -36
  125. package/src/tool/code_orientation/structured-workspace.ts +2 -1
  126. package/src/tool/code_orientation/structured.ts +6 -12
  127. package/src/tool/code_orientation/workspace-format.ts +2 -5
  128. package/src/tool/code_orientation/workspace-output.ts +40 -13
  129. package/src/tool/code_orientation/workspace-sections.ts +48 -4
  130. package/src/tool/code_refactor_apply/result.ts +1 -1
  131. package/src/tool/code_refactor_plan/result.ts +2 -1
  132. package/src/tool/code_refactor_plan/structured.ts +2 -3
  133. package/src/tool/code_resolve/guidance.ts +1 -1
  134. package/src/tool/code_resolve/markdown.ts +127 -64
  135. package/src/tool/code_resolve/result.ts +41 -25
  136. package/src/tool/code_resolve/structured.ts +49 -18
  137. package/src/tool/result/model-budget.ts +2 -2
  138. package/src/tool/result/refactor.ts +8 -5
  139. package/src/tool/result/structured.ts +8 -5
  140. package/src/tool/result/types.ts +31 -24
  141. package/src/tool/schemas.ts +5 -5
  142. package/src/ui/status-command.ts +37 -1
  143. package/src/ui/status-overlay.ts +70 -51
  144. package/src/ui/status-presentation.ts +108 -0
  145. package/src/ui/tui/common.ts +10 -10
@@ -1,4 +1,3 @@
1
- import { StringEnum } from "@earendil-works/pi-ai";
2
1
  import { Type } from "typebox";
3
2
  import type { CodeIntelToolExecCtx } from "../../types/index.ts";
4
3
  import { ScopeParam } from "../schemas.ts";
@@ -23,13 +22,14 @@ export const codeHealthSpec = {
23
22
  }),
24
23
  ),
25
24
  include: Type.Optional(
26
- Type.Array(StringEnum(["diagnostics", "servers"]), {
25
+ Type.Array(Type.Enum(["diagnostics", "servers"], { type: "string" }), {
27
26
  description: "Requested health-signal sections.",
28
27
  uniqueItems: true,
29
28
  }),
30
29
  ),
31
30
  level: Type.Optional(
32
- StringEnum(["summary", "detailed"], {
31
+ Type.Enum(["summary", "detailed"], {
32
+ type: "string",
33
33
  description: "Detail level for the health report.",
34
34
  }),
35
35
  ),
@@ -1,4 +1,3 @@
1
- import { StringEnum } from "@earendil-works/pi-ai";
2
1
  import { Type } from "typebox";
3
2
  import { HEALTH_DIAGNOSTIC_MESSAGE_LIMIT } from "../../session/health-types.ts";
4
3
 
@@ -18,21 +17,24 @@ const evidence = object({
18
17
  documents: Type.Array(
19
18
  object({
20
19
  file: Type.String(),
21
- status: StringEnum(["confirmed", "unconfirmed", "failed", "removed"]),
20
+ status: Type.Enum(["confirmed", "unconfirmed", "failed", "removed"], { type: "string" }),
22
21
  }),
23
22
  ),
24
23
  });
25
24
  const scopeStatus = object({
26
- status: StringEnum(["included", "excluded", "no-config", "out-of-tree"]),
25
+ status: Type.Enum(["included", "excluded", "no-config", "out-of-tree"], { type: "string" }),
27
26
  basis: Type.Union([
28
- StringEnum([
29
- "fileNames",
30
- "explicit",
31
- "include-pattern",
32
- "default-include",
33
- "exclude-pattern",
34
- "extension",
35
- ]),
27
+ Type.Enum(
28
+ [
29
+ "fileNames",
30
+ "explicit",
31
+ "include-pattern",
32
+ "default-include",
33
+ "exclude-pattern",
34
+ "extension",
35
+ ],
36
+ { type: "string" },
37
+ ),
36
38
  Type.Null(),
37
39
  ]),
38
40
  configPath: nullableString,
@@ -46,7 +48,7 @@ const diagnosticEntry = object({
46
48
  Type.Array(
47
49
  object({
48
50
  line: Type.Integer({ description: "1-based line." }),
49
- severity: StringEnum(["error", "warning"]),
51
+ severity: Type.Enum(["error", "warning"], { type: "string" }),
50
52
  message: Type.String(),
51
53
  source: Type.Optional(Type.String()),
52
54
  }),
@@ -63,7 +65,7 @@ const diagnostics = Type.Union([
63
65
  scopeStatus: Type.Optional(scopeStatus),
64
66
  }),
65
67
  object({
66
- kind: StringEnum(["partial", "unavailable"]),
68
+ kind: Type.Enum(["partial", "unavailable"], { type: "string" }),
67
69
  scope,
68
70
  entries: Type.Array(diagnosticEntry),
69
71
  evidence,
@@ -72,8 +74,8 @@ const diagnostics = Type.Union([
72
74
  }),
73
75
  ]);
74
76
  const operation = object({
75
- server: StringEnum(["advertised", "not-advertised", "unknown"]),
76
- supi: StringEnum(["supported", "limited", "unsupported"]),
77
+ server: Type.Enum(["advertised", "not-advertised", "unknown"], { type: "string" }),
78
+ supi: Type.Enum(["supported", "limited", "unsupported"], { type: "string" }),
77
79
  reason: Type.Optional(Type.String()),
78
80
  });
79
81
  const support = object({
@@ -89,13 +91,12 @@ const server = object({
89
91
  name: Type.String(),
90
92
  root: Type.String(),
91
93
  fileTypes: Type.Array(Type.String()),
92
- status: StringEnum(["running", "error", "unavailable"]),
94
+ status: Type.Enum(["running", "error", "unavailable"], { type: "string" }),
93
95
  statusReason: Type.Optional(
94
- StringEnum([
95
- "process-crashed",
96
- "process-crash-recovery-pending",
97
- "process-crash-recovery-exhausted",
98
- ]),
96
+ Type.Enum(
97
+ ["process-crashed", "process-crash-recovery-pending", "process-crash-recovery-exhausted"],
98
+ { type: "string" },
99
+ ),
99
100
  ),
100
101
  ready: Type.Boolean(),
101
102
  operationSupport: Type.Optional(support),
@@ -110,7 +111,7 @@ const server = object({
110
111
  failureMessage: Type.Optional(Type.String()),
111
112
  });
112
113
  const stale = object({
113
- scope: StringEnum(["file", "workspace"]),
114
+ scope: Type.Enum(["file", "workspace"], { type: "string" }),
114
115
  suspected: Type.Union([Type.Boolean(), Type.Null()]),
115
116
  matchedFileCount: Type.Integer(),
116
117
  warning: nullableString,
@@ -118,13 +119,11 @@ const stale = object({
118
119
  const recoveryEntry = object({
119
120
  name: Type.String(),
120
121
  root: Type.String(),
121
- outcome: StringEnum([
122
- "recovered",
123
- "skipped-no-retained-file",
124
- "recovery-failed",
125
- "recovery-exhausted",
126
- ]),
127
- nextAction: Type.Optional(StringEnum(["use-exact-file", "refresh"])),
122
+ outcome: Type.Enum(
123
+ ["recovered", "skipped-no-retained-file", "recovery-failed", "recovery-exhausted"],
124
+ { type: "string" },
125
+ ),
126
+ nextAction: Type.Optional(Type.Enum(["use-exact-file", "refresh"], { type: "string" })),
128
127
  failureMessage: Type.Optional(Type.String()),
129
128
  });
130
129
  const crashRecovery = object({
@@ -142,7 +141,7 @@ const startupRetry = object({
142
141
  object({
143
142
  name: Type.String(),
144
143
  root: Type.String(),
145
- outcome: StringEnum(["recovered", "retry-failed"]),
144
+ outcome: Type.Enum(["recovered", "retry-failed"], { type: "string" }),
146
145
  nextAction: Type.Optional(Type.Literal("refresh")),
147
146
  failureMessage: Type.Optional(Type.String()),
148
147
  }),
@@ -150,8 +149,11 @@ const startupRetry = object({
150
149
  omittedEntries: Type.Integer(),
151
150
  });
152
151
  const tracking = object({
153
- status: StringEnum(["complete", "limited"]),
154
- reason: Type.Union([StringEnum(["file-limit", "filesystem-error"]), Type.Null()]),
152
+ status: Type.Enum(["complete", "limited"], { type: "string" }),
153
+ reason: Type.Union([
154
+ Type.Enum(["file-limit", "filesystem-error"], { type: "string" }),
155
+ Type.Null(),
156
+ ]),
155
157
  observedFileCount: Type.Integer(),
156
158
  discovered: Type.Array(Type.String()),
157
159
  tracked: Type.Array(Type.String()),
@@ -163,10 +165,10 @@ const attemptFields = {
163
165
  attemptedAt: Type.Number(),
164
166
  elapsedMs: Type.Number(),
165
167
  requestedDiagnosticScope: scope,
166
- operationScope: StringEnum(["file-runtime", "workspace-runtime"]),
168
+ operationScope: Type.Enum(["file-runtime", "workspace-runtime"], { type: "string" }),
167
169
  attemptedActiveClients: Type.Optional(Type.Integer()),
168
170
  restartedClients: Type.Optional(Type.Integer()),
169
- fileReadiness: Type.Optional(StringEnum(["ready", "pending", "unavailable"])),
171
+ fileReadiness: Type.Optional(Type.Enum(["ready", "pending", "unavailable"], { type: "string" })),
170
172
  staleAssessment: Type.Optional(stale),
171
173
  diagnosticEvidence: Type.Optional(evidence),
172
174
  processCrashRecovery: Type.Optional(crashRecovery),
@@ -197,7 +199,7 @@ const attempt = Type.Union([
197
199
  const refresh = Type.Union([
198
200
  attempt,
199
201
  object({
200
- kind: StringEnum(["not-requested", "not-attempted"]),
202
+ kind: Type.Enum(["not-requested", "not-attempted"], { type: "string" }),
201
203
  reason: Type.String(),
202
204
  lastAttempt: Type.Union([attempt, Type.Null()]),
203
205
  }),
@@ -206,12 +208,10 @@ const warningReport = object({
206
208
  hasWarnings: Type.Boolean(),
207
209
  warnings: Type.Array(
208
210
  object({
209
- type: StringEnum([
210
- "language-disabled",
211
- "missing-server",
212
- "structural-unavailable",
213
- "configuration-error",
214
- ]),
211
+ type: Type.Enum(
212
+ ["language-disabled", "missing-server", "structural-unavailable", "configuration-error"],
213
+ { type: "string" },
214
+ ),
215
215
  message: Type.String(),
216
216
  language: Type.Optional(Type.String()),
217
217
  detail: Type.Optional(Type.String()),
@@ -224,12 +224,12 @@ export const HealthOutputSchema = Type.Union([
224
224
  object({ kind: Type.Literal("invalid-input"), message: Type.String() }),
225
225
  object({
226
226
  kind: Type.Literal("completed"),
227
- level: StringEnum(["summary", "detailed"]),
228
- includedSections: Type.Array(StringEnum(["diagnostics", "servers"])),
227
+ level: Type.Enum(["summary", "detailed"], { type: "string" }),
228
+ includedSections: Type.Array(Type.Enum(["diagnostics", "servers"], { type: "string" })),
229
229
  semanticState: Type.Union([
230
230
  object({ kind: Type.Literal("ready") }),
231
231
  object({
232
- kind: StringEnum(["pending", "inactive", "disabled", "unavailable"]),
232
+ kind: Type.Enum(["pending", "inactive", "disabled", "unavailable"], { type: "string" }),
233
233
  reason: Type.String(),
234
234
  }),
235
235
  Type.Null(),
@@ -16,7 +16,11 @@ export const codeInspectSpec = {
16
16
  parameters: Type.Object(
17
17
  {
18
18
  point: SourcePointParam,
19
- maxResults: Type.Optional(MaxResultsParam),
19
+ maxResults: Type.Optional({
20
+ ...MaxResultsParam,
21
+ description:
22
+ "Maximum entries per definition or diagnostic list; does not limit syntax or hover text.",
23
+ }),
20
24
  },
21
25
  { additionalProperties: false },
22
26
  ),
@@ -1,4 +1,3 @@
1
- import { StringEnum } from "@earendil-works/pi-ai";
2
1
  import { type Static, type TSchema, Type } from "typebox";
3
2
  import type { InspectObservation } from "../../session/inspect-types.ts";
4
3
  import { ConfidenceSchema, EvidenceListSchema, RecoveryRangeSchema } from "../result/structured.ts";
@@ -46,7 +45,7 @@ const DiagnosticSchema = Type.Object(
46
45
  { additionalProperties: false },
47
46
  );
48
47
  const ProvenanceSchema = Type.Object(
49
- { source: StringEnum(["semantic", "structural"]), capability: Type.String() },
48
+ { source: Type.Enum(["semantic", "structural"], { type: "string" }), capability: Type.String() },
50
49
  { additionalProperties: false },
51
50
  );
52
51
 
@@ -10,12 +10,16 @@ const INLINE_SECTIONS = new Set([
10
10
  "workspace.issues",
11
11
  ]);
12
12
 
13
- /** Keep the immediate directory map and all collection problems inline; defer ancillary facts. */
13
+ /**
14
+ * Keep the immediate directory map, manifest-declared entry paths, and all collection problems
15
+ * inline; defer ancillary facts to the captured result and name them in one note.
16
+ */
14
17
  export function selectDirectoryNavigation(data: OrientationResultData): OrientationResultData {
15
18
  if (!data.workspace?.focus || data.workspace.overview) return data;
16
19
  const workspaceRoot = data.workspace.focus === data.workspace.observation.root;
17
20
  const inline = (section: OrientationSectionData): boolean =>
18
21
  INLINE_SECTIONS.has(section.key) ||
22
+ section.key.endsWith(".paths") ||
19
23
  section.key.startsWith("gradle.") ||
20
24
  (workspaceRoot &&
21
25
  (section.key === "workspace.projects" || section.key === "workspace.memberships")) ||
@@ -28,39 +32,24 @@ export function selectDirectoryNavigation(data: OrientationResultData): Orientat
28
32
  sum + section.evidenceLists.reduce((count, list) => count + (list.totalCount ?? 0), 0),
29
33
  0,
30
34
  );
31
- if (total > 0) {
32
- sections.push({
33
- key: "workspace.captured",
34
- title: "Captured navigation",
35
- status: "complete",
36
- reason: null,
37
- confidence: "unavailable",
38
- provenance: [],
39
- evidenceLists: [
40
- {
41
- key: "workspace.captured",
42
- totalCount: total,
43
- shownCount: 0,
44
- omittedCount: total,
45
- partialReason: null,
46
- },
47
- ],
48
- items: [
49
- {
50
- kind: "paragraph",
51
- text: `Ancillary sections are in the captured details: ${deferred.map((section) => section.title).join("; ")}.`,
52
- },
53
- ],
54
- });
55
- }
35
+ const notes =
36
+ total > 0
37
+ ? [
38
+ ...data.notes,
39
+ `Deferred to captured details: ${deferred.map((section) => section.title).join("; ")}.`,
40
+ ]
41
+ : data.notes;
56
42
  return {
57
43
  ...data,
44
+ notes,
58
45
  sections,
59
46
  renderedSections: sections.map((section) => section.key),
60
- omittedCount: sections.reduce(
61
- (sum, section) =>
62
- sum + section.evidenceLists.reduce((count, list) => count + (list.omittedCount ?? 0), 0),
63
- 0,
64
- ),
47
+ omittedCount:
48
+ total +
49
+ sections.reduce(
50
+ (sum, section) =>
51
+ sum + section.evidenceLists.reduce((count, list) => count + (list.omittedCount ?? 0), 0),
52
+ 0,
53
+ ),
65
54
  };
66
55
  }
@@ -21,7 +21,7 @@ export async function executeOrientationTool(
21
21
  params as OrientationWorkflowInput,
22
22
  toWorkflowControl(ctx),
23
23
  );
24
- const result = finishOrientationResult(outcome);
24
+ const result = finishOrientationResult(outcome, ctx.cwd);
25
25
  if (result.details?.type === "context") {
26
26
  const supplied = result.details.data.instructions?.files ?? [];
27
27
  ctx.session.markInstructionDirsSurfaced(
@@ -4,6 +4,7 @@ import {
4
4
  renderEvidenceListMetadataDisclosure,
5
5
  } from "../../analysis/evidence.ts";
6
6
  import type { ReadNextItem } from "../../analysis/read-next.ts";
7
+ import { toDisplayPath } from "../../analysis/search/paths.ts";
7
8
  import type {
8
9
  OrientationCandidate,
9
10
  OrientationItem,
@@ -42,6 +43,8 @@ export interface OrientationDetailsInput {
42
43
  readonly nextQueries: readonly string[];
43
44
  readonly readNext?: readonly ReadNextItem[];
44
45
  readonly target?: Readonly<TargetStoreEntry>;
46
+ /** Current anchored focus observation; never read from the target store. */
47
+ readonly resolution?: OrientationResultData["resolution"];
45
48
  readonly candidates?: readonly OrientationCandidate[];
46
49
  readonly instructions?: OrientationResultData["instructions"];
47
50
  }
@@ -95,6 +98,7 @@ export function assembleOrientationResult(data: OrientationResultData): Orientat
95
98
  nextQueries: assembledNextQueries(assembled),
96
99
  readNext: assembledReadNext(assembled),
97
100
  target: assembled.data.target,
101
+ resolution: assembled.data.resolution,
98
102
  instructions: assembled.data.instructions,
99
103
  });
100
104
 
@@ -119,6 +123,7 @@ export function assembleOrientationDetails(input: OrientationDetailsInput): Cont
119
123
  nextQueries: [...input.nextQueries],
120
124
  readNext: input.readNext ? [...input.readNext] : undefined,
121
125
  target: input.target ? { ...input.target } : undefined,
126
+ ...(input.resolution ? { resolution: input.resolution } : {}),
122
127
  instructions: input.instructions,
123
128
  candidates: input.candidates?.map((candidate) => ({
124
129
  targetId: candidate.targetId,
@@ -273,11 +278,14 @@ import { prepareWorkspaceOutput } from "./workspace-output.ts";
273
278
  type OrientationOutcome = Awaited<ReturnType<CodeIntelToolExecCtx["session"]["orient"]>>;
274
279
 
275
280
  /** Assemble the final model-visible code_orientation result for one workflow outcome. */
276
- export function finishOrientationResult(outcome: OrientationOutcome): CodeIntelResult {
281
+ export function finishOrientationResult(outcome: OrientationOutcome, cwd: string): CodeIntelResult {
277
282
  if (outcome.kind === "unavailable") throw new Error(outcome.reason);
278
283
  if (outcome.kind === "invalid-input") return invalidOrientationResult(outcome);
279
284
  if (outcome.kind === "disambiguation" || outcome.kind === "kind-mismatch") {
280
- const candidates = outcome.candidates;
285
+ const candidates = outcome.candidates.map((candidate) => ({
286
+ ...candidate,
287
+ file: toDisplayPath(cwd, candidate.file),
288
+ }));
281
289
  const lines = [
282
290
  outcome.kind === "kind-mismatch"
283
291
  ? `# No Orientation target matched provider kind \`${outcome.requestedKind}\``
@@ -313,7 +321,7 @@ export function finishOrientationResult(outcome: OrientationOutcome): CodeIntelR
313
321
  });
314
322
  return {
315
323
  content: lines.join("\n"),
316
- structuredContent: structuredOrientation(outcome),
324
+ structuredContent: structuredOrientation({ ...outcome, candidates }),
317
325
  details: {
318
326
  type: "context",
319
327
  data: details,
@@ -323,7 +331,7 @@ export function finishOrientationResult(outcome: OrientationOutcome): CodeIntelR
323
331
  },
324
332
  };
325
333
  }
326
- return finishCompletedOrientation(outcome.data);
334
+ return finishCompletedOrientation(outcome.data, cwd);
327
335
  }
328
336
 
329
337
  function invalidOrientationResult(
@@ -343,7 +351,16 @@ function invalidOrientationResult(
343
351
  };
344
352
  }
345
353
 
346
- function finishCompletedOrientation(data: OrientationResultData): CodeIntelResult {
354
+ function finishCompletedOrientation(input: OrientationResultData, cwd: string): CodeIntelResult {
355
+ const data = {
356
+ ...input,
357
+ ...(input.target
358
+ ? { target: { ...input.target, file: toDisplayPath(cwd, input.target.file) } }
359
+ : {}),
360
+ ...((input.workspace || input.focusKind === "file") && input.focusTarget !== null
361
+ ? { focusTarget: toDisplayPath(cwd, input.focusTarget) }
362
+ : {}),
363
+ };
347
364
  const navigation = data.workspace ? prepareWorkspaceOutput(data) : null;
348
365
  const assembly = assembleOrientationResult(navigation?.data ?? data);
349
366
  return {
@@ -1,5 +1,4 @@
1
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
2
  import { Type } from "typebox";
4
3
  import {
5
4
  ConfidenceSchema,
@@ -24,7 +23,9 @@ const Project = Type.Object(
24
23
  {
25
24
  id: Type.String(),
26
25
  manifestPath: Type.String(),
27
- kind: StringEnum(["node-package", "python-project", "rust-package", "go-module"]),
26
+ kind: Type.Enum(["node-package", "python-project", "rust-package", "go-module"], {
27
+ type: "string",
28
+ }),
28
29
  directory: Type.String(),
29
30
  name: nullableString,
30
31
  nameField: nullableString,
@@ -45,21 +46,17 @@ const Relationship = Type.Object(
45
46
  );
46
47
  const Provenance = Type.Object(
47
48
  {
48
- source: StringEnum([
49
- "semantic",
50
- "structural",
51
- "filesystem",
52
- "manifest",
53
- "configuration",
54
- "runtime",
55
- ]),
49
+ source: Type.Enum(
50
+ ["semantic", "structural", "filesystem", "manifest", "configuration", "runtime"],
51
+ { type: "string" },
52
+ ),
56
53
  capability: Type.Optional(Type.String()),
57
54
  detail: Type.Optional(Type.String()),
58
55
  },
59
56
  { additionalProperties: false },
60
57
  );
61
58
  const SourceListFields = {
62
- status: StringEnum(["complete", "partial", "unavailable"]),
59
+ status: Type.Enum(["complete", "partial", "unavailable"], { type: "string" }),
63
60
  reason: nullableString,
64
61
  collectedCount: Type.Integer(),
65
62
  omittedCount: Type.Integer(),
@@ -70,16 +67,34 @@ const Observation = Type.Union([
70
67
  { additionalProperties: false },
71
68
  ),
72
69
  Type.Object(
73
- { status: StringEnum(["partial", "unavailable", "withheld"]), reason: Type.String() },
70
+ {
71
+ status: Type.Enum(["partial", "unavailable", "withheld"], { type: "string" }),
72
+ reason: Type.String(),
73
+ },
74
74
  { additionalProperties: false },
75
75
  ),
76
76
  ]);
77
77
  const ContextDefinitionEntries = {
78
78
  entries: Type.Array(
79
- Type.Object(
80
- { uri: Type.String(), range: RecoveryRangeSchema },
81
- { additionalProperties: false },
82
- ),
79
+ Type.Union([
80
+ Type.Object(
81
+ { file: Type.String(), range: RecoveryRangeSchema },
82
+ { additionalProperties: false },
83
+ ),
84
+ Type.Object(
85
+ {
86
+ uri: Type.String(),
87
+ range: RecoveryRangeSchema,
88
+ navigation: Type.Literal("unavailable"),
89
+ reason: Type.String(),
90
+ },
91
+ {
92
+ additionalProperties: false,
93
+ description:
94
+ "Retained provider observation; this URI is not a local filesystem navigation target.",
95
+ },
96
+ ),
97
+ ]),
83
98
  ),
84
99
  collectedCount: Type.Integer({
85
100
  description: "Collected locations; a partial observation may have an unknown remainder.",
@@ -98,7 +113,7 @@ const ContextDefinitions = Type.Union([
98
113
  { additionalProperties: false },
99
114
  ),
100
115
  Type.Object(
101
- { status: StringEnum(["unavailable", "withheld"]), reason: Type.String() },
116
+ { status: Type.Enum(["unavailable", "withheld"], { type: "string" }), reason: Type.String() },
102
117
  { additionalProperties: false },
103
118
  ),
104
119
  ]);
@@ -305,7 +320,7 @@ const Facts = Type.Object(
305
320
  const Section = Type.Object(
306
321
  {
307
322
  key: Type.String(),
308
- status: StringEnum(["complete", "partial", "unavailable"]),
323
+ status: Type.Enum(["complete", "partial", "unavailable"], { type: "string" }),
309
324
  reason: nullableString,
310
325
  confidence: ConfidenceSchema,
311
326
  provenance: Type.Array(Provenance),
@@ -331,7 +346,7 @@ const GradleBase = {
331
346
  runtime: Type.Optional(
332
347
  Type.Object(
333
348
  {
334
- kind: StringEnum(["distribution", "installation"]),
349
+ kind: Type.Enum(["distribution", "installation"], { type: "string" }),
335
350
  source: Type.String(),
336
351
  version: Type.String(),
337
352
  },
@@ -367,17 +382,12 @@ const Gradle = Type.Union([
367
382
  Type.Object(
368
383
  {
369
384
  ...GradleBase,
370
- status: StringEnum([
371
- "blocked",
372
- "unavailable",
373
- "unsupported",
374
- "failed",
375
- "interrupted",
376
- "timeout",
377
- "oversized",
378
- ]),
385
+ status: Type.Enum(
386
+ ["blocked", "unavailable", "unsupported", "failed", "interrupted", "timeout", "oversized"],
387
+ { type: "string" },
388
+ ),
379
389
  gradleVersion: Type.Optional(Type.String()),
380
- stage: StringEnum(["authorization", "prerequisites", "query", "unknown"]),
390
+ stage: Type.Enum(["authorization", "prerequisites", "query", "unknown"], { type: "string" }),
381
391
  reason: Type.String(),
382
392
  },
383
393
  { additionalProperties: false },
@@ -389,7 +399,7 @@ const Workspace = Type.Object(
389
399
  focus: Type.String(),
390
400
  directFiles: Type.Array(
391
401
  Type.Object(
392
- { path: Type.String(), kind: StringEnum(["file", "symlink"]) },
402
+ { path: Type.String(), kind: Type.Enum(["file", "symlink"], { type: "string" }) },
393
403
  { additionalProperties: false },
394
404
  ),
395
405
  ),
@@ -463,7 +473,7 @@ const Workspace = Type.Object(
463
473
  {
464
474
  fileCount: Type.Integer(),
465
475
  symlinkCount: Type.Integer(),
466
- source: StringEnum(["git", "filesystem"]),
476
+ source: Type.Enum(["git", "filesystem"], { type: "string" }),
467
477
  exclude: Type.Array(Type.String()),
468
478
  includeIgnored: Type.Boolean(),
469
479
  symlinks: Type.Literal("not-followed"),
@@ -476,8 +486,8 @@ const Workspace = Type.Object(
476
486
  ),
477
487
  collection: Type.Object(
478
488
  {
479
- status: StringEnum(["complete", "partial"]),
480
- stopReason: StringEnum(["complete", "entry-limit", "deadline"]),
489
+ status: Type.Enum(["complete", "partial"], { type: "string" }),
490
+ stopReason: Type.Enum(["complete", "entry-limit", "deadline"], { type: "string" }),
481
491
  prioritizedDirectory: nullableString,
482
492
  limits: Type.Object(
483
493
  { maxEntries: Type.Integer(), deadline: Type.Union([Type.Number(), Type.Null()]) },
@@ -544,7 +554,7 @@ const Common = {
544
554
  line: Type.Integer(),
545
555
  character: Type.Integer(),
546
556
  rank: Type.Integer(),
547
- anchorKind: Type.Optional(StringEnum(["name", "declaration"])),
557
+ anchorKind: Type.Optional(Type.Enum(["name", "declaration"], { type: "string" })),
548
558
  },
549
559
  { additionalProperties: false, description: "One-based line and UTF-16 character." },
550
560
  ),
@@ -569,7 +579,7 @@ export const OrientationOutputSchema = Type.Union([
569
579
  {
570
580
  ...Common,
571
581
  kind: Type.Literal("completed"),
572
- focusKind: StringEnum(["workspace", "directory", "module"]),
582
+ focusKind: Type.Enum(["workspace", "directory", "module"], { type: "string" }),
573
583
  focus: Type.Union([Type.String(), Type.Null()]),
574
584
  workspace: Workspace,
575
585
  snapshot: Type.Optional(Snapshot),
@@ -580,7 +590,7 @@ export const OrientationOutputSchema = Type.Union([
580
590
  {
581
591
  ...Common,
582
592
  kind: Type.Literal("completed"),
583
- focusKind: StringEnum(["file", "symbol"]),
593
+ focusKind: Type.Enum(["file", "symbol"], { type: "string" }),
584
594
  focus: Type.Union([Type.String(), Type.Null()]),
585
595
  },
586
596
  { additionalProperties: false },
@@ -1,4 +1,5 @@
1
1
  import * as path from "node:path";
2
+ import { toDisplayPath } from "../../analysis/search/paths.ts";
2
3
  import type { ProjectDeclaration } from "../../analysis/workspace/types.ts";
3
4
  import { within } from "../../session/orientation/workspace-context.ts";
4
5
  import type { OrientationResultData } from "../../session/orientation-types.ts";
@@ -61,7 +62,7 @@ export function workspaceFacts(data: OrientationResultData) {
61
62
  });
62
63
  return {
63
64
  root: observation.root,
64
- focus: root,
65
+ focus: toDisplayPath(facts.cwd, root),
65
66
  directFiles: inventory.directFiles.slice(0, limit),
66
67
  directories: inventory.directories.slice(0, limit),
67
68
  extensions: inventory.extensions.slice(0, limit),
@@ -81,7 +81,7 @@ function orientationProjection(
81
81
  };
82
82
  const data = outcome.data;
83
83
  const selected = data.workspace ? workspaceSections(data, data.workspace.maxResults, true) : data;
84
- const target = data.target;
84
+ const { target, resolution } = data;
85
85
  return {
86
86
  ...base,
87
87
  kind: outcome.kind,
@@ -125,19 +125,13 @@ function orientationProjection(
125
125
  container: target.container,
126
126
  confidence: target.confidence,
127
127
  provenance: [...target.provenance],
128
- ...(target.resolution
128
+ ...(resolution
129
129
  ? {
130
130
  resolution: {
131
- requested: {
132
- line: target.resolution.requested.line,
133
- character: target.resolution.requested.character,
134
- },
135
- resolved: {
136
- line: target.resolution.resolved.line,
137
- character: target.resolution.resolved.character,
138
- },
139
- snapped: target.resolution.snapped,
140
- source: target.resolution.source,
131
+ requested: { ...resolution.requested },
132
+ resolved: { ...resolution.resolved },
133
+ snapped: resolution.snapped,
134
+ source: resolution.source,
141
135
  },
142
136
  }
143
137
  : {}),
@@ -1,4 +1,5 @@
1
1
  import * as path from "node:path";
2
+ import { toDisplayPath } from "../../analysis/search/paths.ts";
2
3
  import type { WorkspaceOrientationFacts } from "../../session/orientation/workspace-context.ts";
3
4
  import type { OrientationSectionData } from "../../session/orientation-types.ts";
4
5
 
@@ -29,11 +30,7 @@ export function code(value: string): string {
29
30
 
30
31
  /** Return paths that remain usable from the session working directory for explicit outside focuses. */
31
32
  export function sourcePath(facts: WorkspaceOrientationFacts, relative: string): string {
32
- return (
33
- path
34
- .relative(facts.cwd, path.resolve(facts.observation.root, relative))
35
- .replaceAll(path.sep, "/") || "."
36
- );
33
+ return toDisplayPath(facts.cwd, path.resolve(facts.observation.root, relative));
37
34
  }
38
35
 
39
36
  /** One list cap applies to evidence rows, not to table framing. */