@mrclrchtr/supi-code-intelligence 11.2.0 → 11.3.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.
- package/CHANGELOG.md +19 -0
- package/README.md +16 -6
- package/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-code-runtime/src/capability/types.ts +3 -1
- package/node_modules/@mrclrchtr/supi-code-runtime/src/query-result.ts +9 -0
- package/node_modules/@mrclrchtr/supi-core/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-core/src/child-web-tools.ts +110 -0
- package/node_modules/@mrclrchtr/supi-core/src/session.ts +11 -0
- package/node_modules/@mrclrchtr/supi-lsp/README.md +39 -2
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/capability/types.ts +3 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/query-result.ts +9 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/child-web-tools.ts +110 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/session.ts +11 -0
- package/node_modules/@mrclrchtr/supi-lsp/package.json +3 -3
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-collection.ts +11 -4
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostics.ts +77 -6
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-input-admission.ts +149 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-typescript-project.ts +40 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client.ts +151 -44
- package/node_modules/@mrclrchtr/supi-lsp/src/diagnostics/evidence.ts +2 -2
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-workspace-symbol.ts +157 -23
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager.ts +254 -56
- package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-registry.ts +19 -2
- package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-rename.ts +1 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/session/workspace-lsp-runtime.ts +5 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/README.md +2 -2
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/capability/types.ts +3 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/query-result.ts +9 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/child-web-tools.ts +110 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/session.ts +11 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/package.json +3 -3
- package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/tsx/tree-sitter-tsx.wasm +0 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/tsx/tree-sitter-tsx.wasm.json +5 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/typescript/tree-sitter-typescript.wasm +0 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/typescript/tree-sitter-typescript.wasm.json +5 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/call-sites.ts +40 -25
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/callees.ts +2 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/worker/call-context.ts +44 -0
- package/package.json +6 -5
- package/src/analysis/health/server-status.ts +6 -2
- package/src/analysis/search/exclusions.ts +47 -0
- package/src/analysis/search/paths.ts +32 -9
- package/src/analysis/target/anchored-structural.ts +3 -8
- package/src/analysis/target/anchored.ts +4 -20
- package/src/analysis/target/identity.ts +1 -1
- package/src/analysis/target/latex-label-container.ts +6 -6
- package/src/analysis/target/latex-section-anchor.ts +6 -6
- package/src/analysis/target/resolution.ts +18 -0
- package/src/analysis/target/symbol.ts +39 -11
- package/src/analysis/target/types.ts +6 -1
- package/src/extension.ts +17 -11
- package/src/session/graph/collect.ts +1 -10
- package/src/session/graph-types.ts +2 -0
- package/src/session/graph-workflow.ts +1 -0
- package/src/session/inspect/collect.ts +8 -2
- package/src/session/inspect/file-point.ts +2 -3
- package/src/session/inspect-workflow.ts +1 -1
- package/src/session/orientation/collect.ts +54 -16
- package/src/session/orientation/context-sections.ts +2 -3
- package/src/session/orientation/facts.ts +9 -1
- package/src/session/orientation-types.ts +3 -0
- package/src/session/orientation-workflow.ts +18 -5
- package/src/session/refactor-identity.ts +76 -0
- package/src/session/refactor-workflow.ts +11 -14
- package/src/session/target-store.ts +3 -18
- package/src/session/target-workflow.ts +33 -16
- package/src/substrate/lsp/recovery.ts +5 -5
- package/src/tool/code_find/render.ts +8 -4
- package/src/tool/code_find/result.ts +78 -6
- package/src/tool/code_find/spec.ts +4 -3
- package/src/tool/code_find/structured.ts +25 -9
- package/src/tool/code_graph/details.ts +1 -0
- package/src/tool/code_graph/display.ts +1 -1
- package/src/tool/code_graph/guidance.ts +1 -1
- package/src/tool/code_graph/markdown.ts +11 -6
- package/src/tool/code_graph/read-next.ts +38 -9
- package/src/tool/code_graph/reference-selection.ts +30 -0
- package/src/tool/code_graph/result.ts +25 -118
- package/src/tool/code_graph/section.ts +133 -0
- package/src/tool/code_graph/spec.ts +3 -3
- package/src/tool/code_graph/structured.ts +17 -6
- package/src/tool/code_health/display-paths.ts +92 -0
- package/src/tool/code_health/file-scope-markdown.ts +3 -2
- package/src/tool/code_health/result.ts +4 -2
- package/src/tool/code_health/spec.ts +3 -3
- package/src/tool/code_health/structured-schema.ts +44 -44
- package/src/tool/code_inspect/spec.ts +5 -1
- package/src/tool/code_inspect/structured.ts +1 -2
- package/src/tool/code_orientation/execute.ts +1 -1
- package/src/tool/code_orientation/result.ts +22 -5
- package/src/tool/code_orientation/structured-schema.ts +46 -36
- package/src/tool/code_orientation/structured-workspace.ts +2 -1
- package/src/tool/code_orientation/structured.ts +6 -12
- package/src/tool/code_orientation/workspace-format.ts +2 -5
- package/src/tool/code_orientation/workspace-sections.ts +3 -2
- package/src/tool/code_refactor_apply/result.ts +1 -1
- package/src/tool/code_refactor_plan/result.ts +2 -1
- package/src/tool/code_refactor_plan/structured.ts +2 -3
- package/src/tool/code_resolve/markdown.ts +6 -30
- package/src/tool/code_resolve/result.ts +24 -11
- package/src/tool/code_resolve/structured.ts +7 -9
- package/src/tool/result/refactor.ts +8 -5
- package/src/tool/result/structured.ts +8 -5
- package/src/tool/result/types.ts +18 -14
- package/src/tool/schemas.ts +5 -5
- package/src/ui/status-command.ts +37 -1
- package/src/ui/status-overlay.ts +70 -51
- package/src/ui/status-presentation.ts +108 -0
|
@@ -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(
|
|
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
|
-
|
|
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:
|
|
20
|
+
status: Type.Enum(["confirmed", "unconfirmed", "failed", "removed"], { type: "string" }),
|
|
22
21
|
}),
|
|
23
22
|
),
|
|
24
23
|
});
|
|
25
24
|
const scopeStatus = object({
|
|
26
|
-
status:
|
|
25
|
+
status: Type.Enum(["included", "excluded", "no-config", "out-of-tree"], { type: "string" }),
|
|
27
26
|
basis: Type.Union([
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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:
|
|
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:
|
|
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:
|
|
76
|
-
supi:
|
|
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:
|
|
94
|
+
status: Type.Enum(["running", "error", "unavailable"], { type: "string" }),
|
|
93
95
|
statusReason: Type.Optional(
|
|
94
|
-
|
|
95
|
-
"process-crashed",
|
|
96
|
-
"
|
|
97
|
-
|
|
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:
|
|
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:
|
|
122
|
-
"recovered",
|
|
123
|
-
"
|
|
124
|
-
|
|
125
|
-
|
|
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:
|
|
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:
|
|
154
|
-
reason: Type.Union([
|
|
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:
|
|
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(
|
|
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:
|
|
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:
|
|
210
|
-
"language-disabled",
|
|
211
|
-
"
|
|
212
|
-
|
|
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:
|
|
228
|
-
includedSections: Type.Array(
|
|
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:
|
|
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(
|
|
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:
|
|
48
|
+
{ source: Type.Enum(["semantic", "structural"], { type: "string" }), capability: Type.String() },
|
|
50
49
|
{ additionalProperties: false },
|
|
51
50
|
);
|
|
52
51
|
|
|
@@ -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(
|
|
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:
|
|
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:
|
|
49
|
-
"semantic",
|
|
50
|
-
"
|
|
51
|
-
|
|
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:
|
|
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
|
-
{
|
|
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.
|
|
80
|
-
|
|
81
|
-
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
371
|
-
"blocked",
|
|
372
|
-
"
|
|
373
|
-
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
480
|
-
stopReason:
|
|
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(
|
|
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:
|
|
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:
|
|
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
|
|
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
|
-
...(
|
|
128
|
+
...(resolution
|
|
129
129
|
? {
|
|
130
130
|
resolution: {
|
|
131
|
-
requested: {
|
|
132
|
-
|
|
133
|
-
|
|
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. */
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as path from "node:path";
|
|
2
|
+
import { toDisplayPath } from "../../analysis/search/paths.ts";
|
|
2
3
|
import type { InventoryEntry, WorkspaceObservation } from "../../analysis/workspace/types.ts";
|
|
3
4
|
import {
|
|
4
5
|
type WorkspaceOrientationFacts,
|
|
@@ -13,7 +14,7 @@ import { code, plain, sourcePath, tableSection } from "./workspace-format.ts";
|
|
|
13
14
|
import { workspaceCollectionStatus } from "./workspace-observations.ts";
|
|
14
15
|
import { projectSections } from "./workspace-projects.ts";
|
|
15
16
|
|
|
16
|
-
/**
|
|
17
|
+
/** Project one captured observation without collecting new workspace facts. */
|
|
17
18
|
export function workspaceSections(
|
|
18
19
|
data: OrientationResultData,
|
|
19
20
|
limit: number,
|
|
@@ -228,5 +229,5 @@ function inventorySections(
|
|
|
228
229
|
}
|
|
229
230
|
|
|
230
231
|
export function display(cwd: string, target: string): string {
|
|
231
|
-
return
|
|
232
|
+
return toDisplayPath(cwd, target);
|
|
232
233
|
}
|
|
@@ -24,7 +24,7 @@ export function finishRefactorApplyResult(
|
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
const assembly = assembleRefactorApplyDetails(outcome.result, outcome.plan);
|
|
27
|
+
const assembly = assembleRefactorApplyDetails(outcome.result, outcome.plan, cwd);
|
|
28
28
|
return {
|
|
29
29
|
content: renderRefactorApplyResult(assembly),
|
|
30
30
|
structuredContent: structuredRefactorApply(outcome, cwd),
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/** Result assembly for code_refactor_plan. */
|
|
2
2
|
|
|
3
|
+
import { toDisplayPath } from "../../analysis/search/paths.ts";
|
|
3
4
|
import type { CodeIntelResult, CodeIntelToolExecCtx } from "../../types/index.ts";
|
|
4
5
|
import { renderRefactorPlanResult } from "../refactor-markdown.ts";
|
|
5
6
|
import { searchErrorResult } from "../result/errors.ts";
|
|
@@ -27,7 +28,7 @@ export function finishRefactorPlanResult(
|
|
|
27
28
|
const candidates = outcome.candidates
|
|
28
29
|
.map(
|
|
29
30
|
(candidate, index) =>
|
|
30
|
-
`${index + 1}. ${candidate.description} (${candidate.file}:${candidate.line})`,
|
|
31
|
+
`${index + 1}. ${candidate.description} (${candidate.file === undefined ? candidate.file : toDisplayPath(cwd, candidate.file)}:${candidate.line})`,
|
|
31
32
|
)
|
|
32
33
|
.join("\n");
|
|
33
34
|
return {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { StringEnum } from "@earendil-works/pi-ai";
|
|
2
1
|
import { type Static, Type } from "typebox";
|
|
3
2
|
import { toDisplayPath } from "../../analysis/search/paths.ts";
|
|
4
3
|
import {
|
|
@@ -44,7 +43,7 @@ export const RefactorPlanOutputSchema = Type.Union([
|
|
|
44
43
|
{
|
|
45
44
|
kind: Type.Literal("completed"),
|
|
46
45
|
planId: Type.String(),
|
|
47
|
-
operation:
|
|
46
|
+
operation: Type.Enum([...PUBLIC_REFACTOR_OPERATION_NAMES], { type: "string" }),
|
|
48
47
|
target: Type.Object(
|
|
49
48
|
{ file: Type.String(), line: Type.Integer(), character: Type.Integer() },
|
|
50
49
|
{ additionalProperties: false, description: "One-based line and UTF-16 character." },
|
|
@@ -54,7 +53,7 @@ export const RefactorPlanOutputSchema = Type.Union([
|
|
|
54
53
|
edits: Type.Array(Edit),
|
|
55
54
|
fileCount: Type.Integer({ minimum: 0 }),
|
|
56
55
|
editCount: Type.Integer({ minimum: 0 }),
|
|
57
|
-
provenance:
|
|
56
|
+
provenance: Type.Enum(["semantic", "structural"], { type: "string" }),
|
|
58
57
|
nextAction: Type.Object(
|
|
59
58
|
{ tool: Type.Literal("code_refactor_apply"), planId: Type.String() },
|
|
60
59
|
{ additionalProperties: false },
|