@mrclrchtr/supi-code-intelligence 11.1.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 +41 -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 +81 -7
- 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/node_modules/semver/LICENSE +15 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/README.md +680 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/bin/semver.js +195 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/classes/comparator.js +143 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/classes/index.js +7 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/classes/range.js +577 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/classes/semver.js +350 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/clean.js +8 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/cmp.js +54 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/coerce.js +62 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/compare-build.js +9 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/compare-loose.js +5 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/compare.js +7 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/diff.js +60 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/eq.js +5 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/gt.js +5 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/gte.js +5 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/inc.js +21 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/lt.js +5 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/lte.js +5 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/major.js +5 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/minor.js +5 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/neq.js +5 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/parse.js +18 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/patch.js +5 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/prerelease.js +8 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/rcompare.js +5 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/rsort.js +5 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/satisfies.js +12 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/sort.js +5 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/truncate.js +48 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/valid.js +8 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/index.js +93 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/internal/constants.js +37 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/internal/debug.js +11 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/internal/identifiers.js +29 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/internal/lrucache.js +42 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/internal/parse-options.js +17 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/internal/re.js +223 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/package.json +78 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/preload.js +4 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/range.bnf +17 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/ranges/gtr.js +6 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/ranges/intersects.js +9 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/ranges/ltr.js +6 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/ranges/max-satisfying.js +27 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/ranges/min-satisfying.js +26 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/ranges/min-version.js +63 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/ranges/outside.js +82 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/ranges/simplify.js +49 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/ranges/subset.js +249 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/ranges/to-comparators.js +10 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/ranges/valid.js +13 -0
- package/node_modules/@mrclrchtr/supi-lsp/package.json +5 -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 +174 -49
- package/node_modules/@mrclrchtr/supi-lsp/src/config/config.ts +53 -2
- package/node_modules/@mrclrchtr/supi-lsp/src/config/operation-support.ts +19 -4
- package/node_modules/@mrclrchtr/supi-lsp/src/config/server-config.ts +22 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/config/typescript-launch.ts +276 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/diagnostics/evidence.ts +2 -2
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-project-info.ts +22 -10
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-workspace-symbol.ts +157 -23
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager.ts +306 -75
- package/node_modules/@mrclrchtr/supi-lsp/src/provider/refactor-planning.ts +4 -3
- package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-controller.ts +2 -2
- 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/scanner.ts +27 -15
- 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/capability/capability-warnings.ts +18 -12
- package/src/analysis/health/check.ts +115 -0
- package/src/analysis/health/diagnostics.ts +3 -0
- package/src/analysis/health/file-scope.ts +2 -3
- package/src/analysis/health/semantic-state.ts +38 -0
- package/src/analysis/health/server-status.ts +14 -2
- package/src/analysis/health/signals.ts +2 -0
- package/src/analysis/health/status.ts +82 -0
- package/src/analysis/refactor/apply.ts +17 -8
- 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/health-types.ts +7 -0
- package/src/session/health-workflow.ts +8 -43
- 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 +184 -20
- package/src/session/orientation/context-facts.ts +27 -2
- package/src/session/orientation/context-sections.ts +49 -3
- package/src/session/orientation/facts.ts +132 -0
- package/src/session/orientation/gather.ts +98 -11
- package/src/session/orientation/workspace-context.ts +16 -6
- package/src/session/orientation-types.ts +8 -0
- package/src/session/orientation-workflow.ts +20 -6
- package/src/session/refactor-identity.ts +76 -0
- package/src/session/refactor-plans.ts +5 -2
- package/src/session/refactor-workflow.ts +15 -17
- 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/guidance.ts +1 -1
- 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/markdown.ts +12 -2
- package/src/tool/code_health/result.ts +18 -3
- package/src/tool/code_health/spec.ts +5 -3
- package/src/tool/code_health/structured-schema.ts +250 -0
- package/src/tool/code_health/structured.ts +256 -0
- package/src/tool/code_inspect/result.ts +11 -5
- package/src/tool/code_inspect/spec.ts +7 -1
- package/src/tool/code_inspect/structured.ts +231 -0
- package/src/tool/code_orientation/execute.ts +1 -1
- package/src/tool/code_orientation/result.ts +31 -8
- package/src/tool/code_orientation/spec.ts +2 -0
- package/src/tool/code_orientation/structured-schema.ts +617 -0
- package/src/tool/code_orientation/structured-workspace.ts +194 -0
- package/src/tool/code_orientation/structured.ts +189 -0
- package/src/tool/code_orientation/workspace-format.ts +2 -5
- package/src/tool/code_orientation/workspace-observations.ts +81 -0
- package/src/tool/code_orientation/workspace-output.ts +5 -0
- package/src/tool/code_orientation/workspace-projects.ts +16 -31
- package/src/tool/code_orientation/workspace-sections.ts +46 -32
- package/src/tool/code_refactor_apply/execute.ts +1 -1
- package/src/tool/code_refactor_apply/result.ts +14 -6
- package/src/tool/code_refactor_apply/spec.ts +2 -0
- package/src/tool/code_refactor_apply/structured.ts +49 -0
- package/src/tool/code_refactor_plan/result.ts +18 -9
- package/src/tool/code_refactor_plan/spec.ts +2 -0
- package/src/tool/code_refactor_plan/structured.ts +127 -0
- 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 +12 -6
- package/src/ui/status-command.ts +147 -322
- package/src/ui/status-overlay.ts +584 -421
- package/src/ui/status-presentation.ts +108 -0
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
import { type Static, type TSchema, Type } from "typebox";
|
|
2
|
+
import type { InspectObservation } from "../../session/inspect-types.ts";
|
|
3
|
+
import { ConfidenceSchema, EvidenceListSchema, RecoveryRangeSchema } from "../result/structured.ts";
|
|
4
|
+
import type { InspectResultAssembly } from "./result.ts";
|
|
5
|
+
|
|
6
|
+
const PositionRange = {
|
|
7
|
+
startLine: Type.Integer(),
|
|
8
|
+
startCharacter: Type.Integer(),
|
|
9
|
+
endLine: Type.Integer(),
|
|
10
|
+
endCharacter: Type.Integer(),
|
|
11
|
+
};
|
|
12
|
+
const NodeSchema = Type.Object(
|
|
13
|
+
{
|
|
14
|
+
type: Type.String(),
|
|
15
|
+
text: Type.String(),
|
|
16
|
+
...PositionRange,
|
|
17
|
+
ancestry: Type.Array(
|
|
18
|
+
Type.Object({ type: Type.String(), ...PositionRange }, { additionalProperties: false }),
|
|
19
|
+
),
|
|
20
|
+
},
|
|
21
|
+
{ additionalProperties: false },
|
|
22
|
+
);
|
|
23
|
+
const SymbolSchema = Type.Object(
|
|
24
|
+
{
|
|
25
|
+
name: Type.String(),
|
|
26
|
+
kind: Type.String(),
|
|
27
|
+
nativeKind: Type.Optional(Type.String()),
|
|
28
|
+
...PositionRange,
|
|
29
|
+
},
|
|
30
|
+
{ additionalProperties: false },
|
|
31
|
+
);
|
|
32
|
+
const DefinitionSchema = Type.Object(
|
|
33
|
+
{ file: Type.String(), line: Type.Integer(), character: Type.Integer() },
|
|
34
|
+
{ additionalProperties: false },
|
|
35
|
+
);
|
|
36
|
+
const DiagnosticSchema = Type.Object(
|
|
37
|
+
{
|
|
38
|
+
line: Type.Integer(),
|
|
39
|
+
character: Type.Integer(),
|
|
40
|
+
endLine: Type.Integer(),
|
|
41
|
+
endCharacter: Type.Integer(),
|
|
42
|
+
severity: Type.Number(),
|
|
43
|
+
message: Type.String(),
|
|
44
|
+
},
|
|
45
|
+
{ additionalProperties: false },
|
|
46
|
+
);
|
|
47
|
+
const ProvenanceSchema = Type.Object(
|
|
48
|
+
{ source: Type.Enum(["semantic", "structural"], { type: "string" }), capability: Type.String() },
|
|
49
|
+
{ additionalProperties: false },
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
function observationSchema<T extends TSchema>(data: T) {
|
|
53
|
+
return Type.Union([
|
|
54
|
+
Type.Object({ kind: Type.Literal("completed"), data }, { additionalProperties: false }),
|
|
55
|
+
Type.Object(
|
|
56
|
+
{
|
|
57
|
+
kind: Type.Literal("partial"),
|
|
58
|
+
data,
|
|
59
|
+
reason: Type.String(),
|
|
60
|
+
recovery: Type.Optional(
|
|
61
|
+
Type.Object(
|
|
62
|
+
{ file: Type.String(), errorRanges: Type.Array(RecoveryRangeSchema) },
|
|
63
|
+
{ additionalProperties: false },
|
|
64
|
+
),
|
|
65
|
+
),
|
|
66
|
+
},
|
|
67
|
+
{ additionalProperties: false },
|
|
68
|
+
),
|
|
69
|
+
Type.Object(
|
|
70
|
+
{ kind: Type.Literal("unavailable"), reason: Type.String() },
|
|
71
|
+
{ additionalProperties: false },
|
|
72
|
+
),
|
|
73
|
+
]);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** Point facts use one-based UTF-16 coordinates; syntax recovery ranges remain zero-based. */
|
|
77
|
+
export const InspectOutputSchema = Type.Union([
|
|
78
|
+
Type.Object(
|
|
79
|
+
{
|
|
80
|
+
kind: Type.Literal("completed"),
|
|
81
|
+
point: Type.Object(
|
|
82
|
+
{ file: Type.String(), line: Type.Integer(), character: Type.Integer() },
|
|
83
|
+
{ additionalProperties: false },
|
|
84
|
+
),
|
|
85
|
+
confidence: ConfidenceSchema,
|
|
86
|
+
diagnosticWindow: Type.Object(
|
|
87
|
+
{ startLine: Type.Integer(), endLine: Type.Integer() },
|
|
88
|
+
{ additionalProperties: false },
|
|
89
|
+
),
|
|
90
|
+
sections: Type.Object(
|
|
91
|
+
{
|
|
92
|
+
node: observationSchema(Type.Union([NodeSchema, Type.Null()])),
|
|
93
|
+
enclosingSymbol: observationSchema(Type.Union([SymbolSchema, Type.Null()])),
|
|
94
|
+
hover: observationSchema(Type.Union([Type.String(), Type.Null()])),
|
|
95
|
+
definition: observationSchema(Type.Array(DefinitionSchema)),
|
|
96
|
+
diagnostics: observationSchema(Type.Array(DiagnosticSchema)),
|
|
97
|
+
},
|
|
98
|
+
{ additionalProperties: false },
|
|
99
|
+
),
|
|
100
|
+
evidenceLists: Type.Array(EvidenceListSchema),
|
|
101
|
+
provenance: Type.Array(ProvenanceSchema),
|
|
102
|
+
nextQueries: Type.Array(Type.String()),
|
|
103
|
+
},
|
|
104
|
+
{ additionalProperties: false },
|
|
105
|
+
),
|
|
106
|
+
Type.Object(
|
|
107
|
+
{
|
|
108
|
+
kind: Type.Literal("invalid-input"),
|
|
109
|
+
message: Type.String(),
|
|
110
|
+
nextQueries: Type.Array(Type.String()),
|
|
111
|
+
},
|
|
112
|
+
{ additionalProperties: false },
|
|
113
|
+
),
|
|
114
|
+
]);
|
|
115
|
+
|
|
116
|
+
function observation<T, U>(value: InspectObservation<T>, project: (data: T) => U) {
|
|
117
|
+
if (value.kind === "unavailable") return { kind: value.kind, reason: value.reason };
|
|
118
|
+
if (value.kind === "completed") return { kind: value.kind, data: project(value.data) };
|
|
119
|
+
return {
|
|
120
|
+
kind: value.kind,
|
|
121
|
+
data: project(value.data),
|
|
122
|
+
reason: value.reason,
|
|
123
|
+
...(value.recovery
|
|
124
|
+
? {
|
|
125
|
+
recovery: {
|
|
126
|
+
file: value.recovery.file,
|
|
127
|
+
errorRanges: value.recovery.errorRanges.map(({ start, end }) => ({
|
|
128
|
+
start: { line: start.line, character: start.character },
|
|
129
|
+
end: { line: end.line, character: end.character },
|
|
130
|
+
})),
|
|
131
|
+
},
|
|
132
|
+
}
|
|
133
|
+
: {}),
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/** Assemble script data from the same bounded evidence as direct inspection, never UI text. */
|
|
138
|
+
export function structuredInspectResult(
|
|
139
|
+
assembly: InspectResultAssembly,
|
|
140
|
+
): Static<typeof InspectOutputSchema> {
|
|
141
|
+
const { data, assembled } = assembly;
|
|
142
|
+
return {
|
|
143
|
+
kind: "completed",
|
|
144
|
+
point: { file: data.relPath, line: data.line, character: data.character },
|
|
145
|
+
confidence: data.confidence,
|
|
146
|
+
diagnosticWindow: {
|
|
147
|
+
startLine: data.diagnosticWindow.startLine,
|
|
148
|
+
endLine: data.diagnosticWindow.endLine,
|
|
149
|
+
},
|
|
150
|
+
sections: {
|
|
151
|
+
node: observation(data.sections.node, (node) =>
|
|
152
|
+
node
|
|
153
|
+
? {
|
|
154
|
+
type: node.type,
|
|
155
|
+
text: node.text,
|
|
156
|
+
startLine: node.startLine,
|
|
157
|
+
startCharacter: node.startCharacter,
|
|
158
|
+
endLine: node.endLine,
|
|
159
|
+
endCharacter: node.endCharacter,
|
|
160
|
+
ancestry: node.ancestry.map(
|
|
161
|
+
({ type, startLine, startCharacter, endLine, endCharacter }) => ({
|
|
162
|
+
type,
|
|
163
|
+
startLine,
|
|
164
|
+
startCharacter,
|
|
165
|
+
endLine,
|
|
166
|
+
endCharacter,
|
|
167
|
+
}),
|
|
168
|
+
),
|
|
169
|
+
}
|
|
170
|
+
: null,
|
|
171
|
+
),
|
|
172
|
+
enclosingSymbol: observation(data.sections.enclosingSymbol, (symbol) =>
|
|
173
|
+
symbol
|
|
174
|
+
? {
|
|
175
|
+
name: symbol.name,
|
|
176
|
+
kind: symbol.kind,
|
|
177
|
+
...(symbol.nativeKind === undefined ? {} : { nativeKind: symbol.nativeKind }),
|
|
178
|
+
startLine: symbol.startLine,
|
|
179
|
+
startCharacter: symbol.startCharacter,
|
|
180
|
+
endLine: symbol.endLine,
|
|
181
|
+
endCharacter: symbol.endCharacter,
|
|
182
|
+
}
|
|
183
|
+
: null,
|
|
184
|
+
),
|
|
185
|
+
hover: observation(data.sections.hover, (hover) => hover),
|
|
186
|
+
definition: observation(data.sections.definition, () =>
|
|
187
|
+
assembly.displayedDefinitions.map(({ file, line, character }) => ({
|
|
188
|
+
file,
|
|
189
|
+
line,
|
|
190
|
+
character,
|
|
191
|
+
})),
|
|
192
|
+
),
|
|
193
|
+
diagnostics: observation(data.sections.diagnostics, () =>
|
|
194
|
+
assembly.displayedDiagnostics.map(
|
|
195
|
+
({ line, character, endLine, endCharacter, severity, message }) => ({
|
|
196
|
+
line,
|
|
197
|
+
character,
|
|
198
|
+
endLine,
|
|
199
|
+
endCharacter,
|
|
200
|
+
severity,
|
|
201
|
+
message,
|
|
202
|
+
}),
|
|
203
|
+
),
|
|
204
|
+
),
|
|
205
|
+
},
|
|
206
|
+
evidenceLists: assembled.evidenceLists.map(
|
|
207
|
+
({
|
|
208
|
+
key,
|
|
209
|
+
totalCount,
|
|
210
|
+
shownCount,
|
|
211
|
+
omittedCount,
|
|
212
|
+
partialReason,
|
|
213
|
+
partialMessage,
|
|
214
|
+
invalidLocationCount,
|
|
215
|
+
}) => ({
|
|
216
|
+
key,
|
|
217
|
+
totalCount,
|
|
218
|
+
shownCount,
|
|
219
|
+
omittedCount,
|
|
220
|
+
partialReason,
|
|
221
|
+
...(partialMessage === undefined ? {} : { partialMessage }),
|
|
222
|
+
...(invalidLocationCount === undefined ? {} : { invalidLocationCount }),
|
|
223
|
+
}),
|
|
224
|
+
),
|
|
225
|
+
provenance: assembled.provenance.map(({ source, capability }) => ({
|
|
226
|
+
source: source as "semantic" | "structural",
|
|
227
|
+
capability: capability ?? "",
|
|
228
|
+
})),
|
|
229
|
+
nextQueries: [...assembly.details.nextQueries],
|
|
230
|
+
};
|
|
231
|
+
}
|
|
@@ -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,
|
|
@@ -267,16 +272,20 @@ function uniqueProvenance(sections: readonly OrientationSectionData[]) {
|
|
|
267
272
|
import type { CodeIntelResult, CodeIntelToolExecCtx } from "../../types/index.ts";
|
|
268
273
|
import { contextErrorResult } from "../result/errors.ts";
|
|
269
274
|
import { renderOrientationResult } from "./markdown.ts";
|
|
275
|
+
import { structuredOrientation } from "./structured.ts";
|
|
270
276
|
import { prepareWorkspaceOutput } from "./workspace-output.ts";
|
|
271
277
|
|
|
272
278
|
type OrientationOutcome = Awaited<ReturnType<CodeIntelToolExecCtx["session"]["orient"]>>;
|
|
273
279
|
|
|
274
280
|
/** Assemble the final model-visible code_orientation result for one workflow outcome. */
|
|
275
|
-
export function finishOrientationResult(outcome: OrientationOutcome): CodeIntelResult {
|
|
281
|
+
export function finishOrientationResult(outcome: OrientationOutcome, cwd: string): CodeIntelResult {
|
|
276
282
|
if (outcome.kind === "unavailable") throw new Error(outcome.reason);
|
|
277
283
|
if (outcome.kind === "invalid-input") return invalidOrientationResult(outcome);
|
|
278
284
|
if (outcome.kind === "disambiguation" || outcome.kind === "kind-mismatch") {
|
|
279
|
-
const candidates = outcome.candidates
|
|
285
|
+
const candidates = outcome.candidates.map((candidate) => ({
|
|
286
|
+
...candidate,
|
|
287
|
+
file: toDisplayPath(cwd, candidate.file),
|
|
288
|
+
}));
|
|
280
289
|
const lines = [
|
|
281
290
|
outcome.kind === "kind-mismatch"
|
|
282
291
|
? `# No Orientation target matched provider kind \`${outcome.requestedKind}\``
|
|
@@ -312,6 +321,7 @@ export function finishOrientationResult(outcome: OrientationOutcome): CodeIntelR
|
|
|
312
321
|
});
|
|
313
322
|
return {
|
|
314
323
|
content: lines.join("\n"),
|
|
324
|
+
structuredContent: structuredOrientation({ ...outcome, candidates }),
|
|
315
325
|
details: {
|
|
316
326
|
type: "context",
|
|
317
327
|
data: details,
|
|
@@ -321,7 +331,7 @@ export function finishOrientationResult(outcome: OrientationOutcome): CodeIntelR
|
|
|
321
331
|
},
|
|
322
332
|
};
|
|
323
333
|
}
|
|
324
|
-
return finishCompletedOrientation(outcome.data);
|
|
334
|
+
return finishCompletedOrientation(outcome.data, cwd);
|
|
325
335
|
}
|
|
326
336
|
|
|
327
337
|
function invalidOrientationResult(
|
|
@@ -332,17 +342,30 @@ function invalidOrientationResult(
|
|
|
332
342
|
const message = rejection
|
|
333
343
|
? `Requested focus ${JSON.stringify(rejection.requestedPath)} traverses a symbolic link: ${JSON.stringify(rejection.blockedPath)}. Orientation does not follow symbolic links.\n\n${recovery}`
|
|
334
344
|
: outcome.message;
|
|
335
|
-
return
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
345
|
+
return {
|
|
346
|
+
...contextErrorResult(`**Error:** ${message}`, {
|
|
347
|
+
nextQueries: rejection ? [recovery] : ["Choose an existing path, module, or precise target"],
|
|
348
|
+
message,
|
|
349
|
+
}),
|
|
350
|
+
structuredContent: structuredOrientation(outcome),
|
|
351
|
+
};
|
|
339
352
|
}
|
|
340
353
|
|
|
341
|
-
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
|
+
};
|
|
342
364
|
const navigation = data.workspace ? prepareWorkspaceOutput(data) : null;
|
|
343
365
|
const assembly = assembleOrientationResult(navigation?.data ?? data);
|
|
344
366
|
return {
|
|
345
367
|
content: navigation?.content ?? renderOrientationResult(assembly),
|
|
368
|
+
structuredContent: structuredOrientation({ kind: "completed", data }, navigation?.snapshotPath),
|
|
346
369
|
details: {
|
|
347
370
|
type: "context",
|
|
348
371
|
data: assembly.details,
|
|
@@ -2,6 +2,7 @@ import { Type } from "typebox";
|
|
|
2
2
|
import type { CodeIntelToolExecCtx } from "../../types/index.ts";
|
|
3
3
|
import { MaxResultsParam, OrientationFocusParam } from "../schemas.ts";
|
|
4
4
|
import { executeOrientationTool } from "./execute.ts";
|
|
5
|
+
import { OrientationOutputSchema } from "./structured-schema.ts";
|
|
5
6
|
import { renderOrientationCall, renderOrientationResult } from "./tui.ts";
|
|
6
7
|
|
|
7
8
|
export const CODE_ORIENTATION_TOOL_NAME = "code_orientation";
|
|
@@ -11,6 +12,7 @@ export const CODE_ORIENTATION_TOOL_LABEL = "Code Orientation";
|
|
|
11
12
|
export const codeOrientationSpec = {
|
|
12
13
|
name: CODE_ORIENTATION_TOOL_NAME,
|
|
13
14
|
label: CODE_ORIENTATION_TOOL_LABEL,
|
|
15
|
+
outputSchema: OrientationOutputSchema,
|
|
14
16
|
parameters: Type.Object(
|
|
15
17
|
{
|
|
16
18
|
focus: Type.Optional(OrientationFocusParam),
|