@mrclrchtr/supi-code-intelligence 5.0.0 → 6.0.1
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/README.md +4 -2
- package/node_modules/@mrclrchtr/supi-code-runtime/README.md +2 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-core/README.md +2 -0
- package/node_modules/@mrclrchtr/supi-core/package.json +2 -2
- package/node_modules/@mrclrchtr/supi-core/src/api.ts +1 -1
- package/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +0 -3
- package/node_modules/@mrclrchtr/supi-core/src/debug.ts +9 -0
- package/node_modules/@mrclrchtr/supi-core/src/index.ts +1 -1
- package/node_modules/@mrclrchtr/supi-lsp/README.md +36 -3
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/README.md +2 -0
- 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-core/README.md +2 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/package.json +2 -2
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/api.ts +1 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +0 -3
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/debug.ts +9 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/index.ts +1 -1
- package/node_modules/@mrclrchtr/supi-lsp/package.json +3 -3
- package/node_modules/@mrclrchtr/supi-lsp/src/api.ts +12 -1
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-cache.ts +67 -28
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-collection.ts +63 -6
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-evidence.ts +46 -5
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-host.ts +1 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-publication.ts +214 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-refresh.ts +278 -79
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-timing.ts +29 -8
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostics.ts +101 -19
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-document-state.ts +19 -1
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-document-sync.ts +49 -3
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client.ts +73 -15
- package/node_modules/@mrclrchtr/supi-lsp/src/client/transport.ts +1 -1
- package/node_modules/@mrclrchtr/supi-lsp/src/config/capabilities.ts +2 -2
- package/node_modules/@mrclrchtr/supi-lsp/src/config/config.ts +5 -5
- package/node_modules/@mrclrchtr/supi-lsp/src/config/server-config.ts +3 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/config/tsconfig-extends.ts +68 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/config/tsconfig-path.ts +8 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/config/tsconfig-scope.ts +176 -24
- package/node_modules/@mrclrchtr/supi-lsp/src/diagnostics/evidence.ts +4 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/diagnostics/workspace-sentinels.ts +46 -10
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-diagnostics.ts +4 -3
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-workspace-recovery.ts +65 -17
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager.ts +143 -21
- package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-diagnostic-surface.ts +2 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-diagnostics.ts +43 -1
- package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-registry.ts +31 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/README.md +2 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/README.md +2 -0
- 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-core/README.md +2 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/package.json +2 -2
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/api.ts +1 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +0 -3
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/debug.ts +9 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/index.ts +1 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.wasm +0 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.wasm.map +4 -4
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.wasm +0 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.wasm.map +4 -4
- package/node_modules/@mrclrchtr/supi-tree-sitter/package.json +3 -3
- package/package.json +5 -5
- package/src/analysis/health/diagnostics.ts +58 -126
- package/src/analysis/health/file-scope.ts +184 -0
- package/src/analysis/health/recovery.ts +8 -1
- package/src/analysis/readiness.ts +4 -0
- package/src/analysis/search/ast-scan.ts +4 -1
- package/src/analysis/search/pattern-analysis.ts +10 -3
- package/src/analysis/search/pattern.ts +6 -1
- package/src/config.ts +35 -1
- package/src/extension.ts +57 -14
- package/src/overview/overview-data.ts +9 -2
- package/src/overview/overview.ts +49 -30
- package/src/overview/types.ts +2 -0
- package/src/session/find-types.ts +2 -2
- package/src/session/find-workflow.ts +3 -2
- package/src/session/health-refresh.ts +76 -49
- package/src/session/health-types.ts +7 -1
- package/src/session/health-workflow.ts +35 -18
- package/src/session/input/workflows.ts +2 -2
- package/src/session/inspect-workflow.ts +2 -1
- package/src/session/orientation/collect.ts +2 -2
- package/src/session/orientation-types.ts +2 -0
- package/src/session/orientation-workflow.ts +8 -2
- package/src/session/refactor-workflow.ts +2 -1
- package/src/session/session.ts +25 -1
- package/src/substrate/lsp/maintenance.ts +105 -23
- package/src/substrate/lsp/recovery.ts +11 -5
- package/src/tool/code_find/execute.ts +23 -0
- package/src/tool/code_find/guidance.ts +8 -0
- package/src/tool/{find → code_find}/render.ts +1 -1
- package/src/tool/{result/find.ts → code_find/result.ts} +36 -11
- package/src/tool/code_find/spec.ts +37 -0
- package/src/tool/code_graph/execute.ts +24 -0
- package/src/tool/code_graph/guidance.ts +6 -0
- package/src/tool/{graph → code_graph}/markdown.ts +1 -1
- package/src/tool/{result/graph.ts → code_graph/result.ts} +69 -4
- package/src/tool/code_graph/spec.ts +39 -0
- package/src/tool/{health → code_health}/execute.ts +2 -18
- package/src/tool/code_health/guidance.ts +8 -0
- package/src/tool/{health → code_health}/markdown.ts +68 -18
- package/src/tool/{result/health.ts → code_health/result.ts} +29 -4
- package/src/tool/code_health/spec.ts +41 -0
- package/src/tool/code_inspect/execute.ts +20 -0
- package/src/tool/code_inspect/guidance.ts +6 -0
- package/src/tool/{inspect → code_inspect}/markdown.ts +1 -1
- package/src/tool/{result/inspect.ts → code_inspect/result.ts} +32 -3
- package/src/tool/code_inspect/spec.ts +25 -0
- package/src/tool/code_orientation/execute.ts +25 -0
- package/src/tool/code_orientation/guidance.ts +9 -0
- package/src/tool/{orientation → code_orientation}/markdown.ts +1 -1
- package/src/tool/{result/orientation.ts → code_orientation/result.ts} +67 -3
- package/src/tool/code_orientation/spec.ts +25 -0
- package/src/tool/code_refactor_apply/execute.ts +17 -0
- package/src/tool/code_refactor_apply/guidance.ts +5 -0
- package/src/tool/{refactor-apply/execute.ts → code_refactor_apply/result.ts} +5 -11
- package/src/tool/code_refactor_apply/spec.ts +26 -0
- package/src/tool/code_refactor_plan/execute.ts +27 -0
- package/src/tool/code_refactor_plan/guidance.ts +8 -0
- package/src/tool/{refactor-plan/execute.ts → code_refactor_plan/result.ts} +9 -22
- package/src/tool/code_refactor_plan/spec.ts +25 -0
- package/src/tool/code_resolve/execute.ts +19 -0
- package/src/tool/code_resolve/guidance.ts +8 -0
- package/src/tool/{resolve → code_resolve}/markdown.ts +1 -1
- package/src/tool/{result/resolve.ts → code_resolve/result.ts} +37 -24
- package/src/tool/code_resolve/spec.ts +25 -0
- package/src/tool/guidance.ts +71 -52
- package/src/tool/infra/truncate.ts +40 -0
- package/src/tool/{refactor-plan/markdown.ts → refactor-markdown.ts} +4 -7
- package/src/tool/register.ts +9 -97
- package/src/tool/result/refactor.ts +1 -4
- package/src/tool/schemas.ts +26 -157
- package/src/tool/specs.ts +40 -126
- package/src/tool/find/execute.ts +0 -43
- package/src/tool/graph/execute.ts +0 -82
- package/src/tool/inspect/execute.ts +0 -40
- package/src/tool/orientation/execute.ts +0 -80
- package/src/tool/resolve/execute.ts +0 -53
- /package/src/tool/{find → code_find}/ast-kinds.ts +0 -0
- /package/src/tool/{find → code_find}/markdown.ts +0 -0
- /package/src/tool/{find → code_find}/modes.ts +0 -0
- /package/src/tool/{find → code_find}/tui.ts +0 -0
- /package/src/tool/{graph → code_graph}/tui.ts +0 -0
- /package/src/tool/{health → code_health}/refresh-status.ts +0 -0
- /package/src/tool/{health → code_health}/semantic-state.ts +0 -0
- /package/src/tool/{health → code_health}/tui.ts +0 -0
- /package/src/tool/{inspect → code_inspect}/tui.ts +0 -0
- /package/src/tool/{orientation → code_orientation}/tui.ts +0 -0
- /package/src/tool/{refactor-apply → code_refactor_apply}/tui.ts +0 -0
- /package/src/tool/{refactor-plan → code_refactor_plan}/tui.ts +0 -0
- /package/src/tool/{resolve → code_resolve}/tui.ts +0 -0
package/src/tool/find/execute.ts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/** Thin Pi adapter for the session-owned code_find workflow. */
|
|
2
|
-
|
|
3
|
-
import type { FindMode, FindWorkflowInput } from "../../session/find-types.ts";
|
|
4
|
-
import type { CodeIntelResult, CodeIntelToolExecCtx } from "../../types/index.ts";
|
|
5
|
-
import { toWorkflowControl } from "../infra/workflow-control.ts";
|
|
6
|
-
import { searchErrorResult } from "../result/errors.ts";
|
|
7
|
-
import { assembleFindWorkflowResult } from "../result/find.ts";
|
|
8
|
-
import type { CodeFindAstKind } from "./ast-kinds.ts";
|
|
9
|
-
import { renderFindResult } from "./render.ts";
|
|
10
|
-
|
|
11
|
-
export interface CodeFindToolParams {
|
|
12
|
-
query: string;
|
|
13
|
-
scope?: string[];
|
|
14
|
-
mode: FindMode;
|
|
15
|
-
kind?: CodeFindAstKind;
|
|
16
|
-
maxResults?: number;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export async function executeFindTool(
|
|
20
|
-
params: CodeFindToolParams,
|
|
21
|
-
ctx: CodeIntelToolExecCtx,
|
|
22
|
-
): Promise<CodeIntelResult> {
|
|
23
|
-
const outcome = await ctx.session.find(params as FindWorkflowInput, toWorkflowControl(ctx));
|
|
24
|
-
if (outcome.kind === "unavailable") throw new Error(outcome.reason);
|
|
25
|
-
if (outcome.kind === "invalid-input") {
|
|
26
|
-
return searchErrorResult(`**Error:** ${outcome.message}`, {
|
|
27
|
-
scope: Array.isArray(params?.scope) ? params.scope.join(", ") : null,
|
|
28
|
-
nextQueries: ["Fix the search input and retry"],
|
|
29
|
-
message: outcome.message,
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const assembly = assembleFindWorkflowResult(outcome);
|
|
34
|
-
return {
|
|
35
|
-
content: renderFindResult(assembly),
|
|
36
|
-
details: {
|
|
37
|
-
type: "search",
|
|
38
|
-
data: assembly.details,
|
|
39
|
-
status: "completed",
|
|
40
|
-
displaySections: assembly.displaySections,
|
|
41
|
-
},
|
|
42
|
-
};
|
|
43
|
-
}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
/** Thin Pi adapter for the session-owned code_graph workflow. */
|
|
2
|
-
|
|
3
|
-
import type { GraphWorkflowInput, RequestedGraphRelation } from "../../session/graph-types.ts";
|
|
4
|
-
import type { GraphTargetInput } from "../../session/target-input.ts";
|
|
5
|
-
import type { CodeIntelResult, CodeIntelToolExecCtx } from "../../types/index.ts";
|
|
6
|
-
import { toWorkflowControl } from "../infra/workflow-control.ts";
|
|
7
|
-
import { createToolDisplaySection } from "../result/display.ts";
|
|
8
|
-
import { searchErrorResult } from "../result/errors.ts";
|
|
9
|
-
import { assembleGraphResult } from "../result/graph.ts";
|
|
10
|
-
import { renderGraphResult } from "./markdown.ts";
|
|
11
|
-
|
|
12
|
-
export type GraphRelation = RequestedGraphRelation;
|
|
13
|
-
|
|
14
|
-
export interface CodeGraphToolParams {
|
|
15
|
-
target: GraphTargetInput;
|
|
16
|
-
relations?: GraphRelation[];
|
|
17
|
-
calleeDepth?: "direct" | "deep";
|
|
18
|
-
maxResults?: number;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export async function executeGraphTool(
|
|
22
|
-
params: CodeGraphToolParams,
|
|
23
|
-
ctx: CodeIntelToolExecCtx,
|
|
24
|
-
): Promise<CodeIntelResult> {
|
|
25
|
-
const outcome = await ctx.session.graph(params as GraphWorkflowInput, toWorkflowControl(ctx));
|
|
26
|
-
|
|
27
|
-
if (outcome.kind === "unavailable") throw new Error(outcome.reason);
|
|
28
|
-
if (outcome.kind === "invalid-input") {
|
|
29
|
-
return searchErrorResult(`**Error:** ${outcome.message}`, { message: outcome.message });
|
|
30
|
-
}
|
|
31
|
-
if (outcome.kind === "disambiguation" || outcome.kind === "kind-mismatch") {
|
|
32
|
-
const lines = [
|
|
33
|
-
outcome.kind === "kind-mismatch"
|
|
34
|
-
? `**No target matched provider kind \`${outcome.requestedKind}\`. Near matches:**`
|
|
35
|
-
: "**Target is ambiguous. Choose one candidate handle:**",
|
|
36
|
-
"",
|
|
37
|
-
];
|
|
38
|
-
for (const candidate of outcome.candidates) {
|
|
39
|
-
lines.push(
|
|
40
|
-
`- \`${candidate.targetId}\` — ${candidate.name} (\`${candidate.kind ?? "unknown"}\`) at ${candidate.file}:${candidate.line}:${candidate.character}`,
|
|
41
|
-
);
|
|
42
|
-
}
|
|
43
|
-
if (outcome.kind === "kind-mismatch") {
|
|
44
|
-
lines.push(
|
|
45
|
-
"",
|
|
46
|
-
"Retry without `symbolKind`, use an observed provider kind, or choose a handle.",
|
|
47
|
-
);
|
|
48
|
-
}
|
|
49
|
-
return searchErrorResult(lines.join("\n"), {
|
|
50
|
-
message:
|
|
51
|
-
outcome.kind === "kind-mismatch"
|
|
52
|
-
? `No target matched provider kind ${outcome.requestedKind}.`
|
|
53
|
-
: "The target is ambiguous.",
|
|
54
|
-
displaySections: [
|
|
55
|
-
createToolDisplaySection({
|
|
56
|
-
key: "graph.candidates",
|
|
57
|
-
title: "Candidates",
|
|
58
|
-
items: outcome.candidates,
|
|
59
|
-
format: (candidate) =>
|
|
60
|
-
`${candidate.targetId} — ${candidate.name} (${candidate.kind ?? "unknown"}) at ${candidate.file}:${candidate.line}:${candidate.character}`,
|
|
61
|
-
}),
|
|
62
|
-
],
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
const assembly = assembleGraphResult({
|
|
67
|
-
displayName: outcome.displayName,
|
|
68
|
-
sections: outcome.sections,
|
|
69
|
-
resolvedDisplayFile: outcome.resolvedDisplayFile,
|
|
70
|
-
maxResults: outcome.maxResults,
|
|
71
|
-
cwd: ctx.cwd,
|
|
72
|
-
});
|
|
73
|
-
return {
|
|
74
|
-
content: renderGraphResult(assembly),
|
|
75
|
-
details: {
|
|
76
|
-
type: "search",
|
|
77
|
-
data: assembly.details,
|
|
78
|
-
status: "completed",
|
|
79
|
-
displaySections: assembly.displaySections,
|
|
80
|
-
},
|
|
81
|
-
};
|
|
82
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/** Thin Pi adapter for session-owned point inspection. */
|
|
2
|
-
|
|
3
|
-
import type { InspectWorkflowInput } from "../../session/inspect-types.ts";
|
|
4
|
-
import type { SourcePointInput } from "../../session/target-input.ts";
|
|
5
|
-
import type { CodeIntelResult, CodeIntelToolExecCtx } from "../../types/index.ts";
|
|
6
|
-
import { toWorkflowControl } from "../infra/workflow-control.ts";
|
|
7
|
-
import { inspectErrorResult } from "../result/errors.ts";
|
|
8
|
-
import { assembleInspectResult } from "../result/inspect.ts";
|
|
9
|
-
import { renderInspectResult } from "./markdown.ts";
|
|
10
|
-
|
|
11
|
-
export interface CodeInspectToolParams {
|
|
12
|
-
point: SourcePointInput;
|
|
13
|
-
maxResults?: number;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export async function executeInspectTool(
|
|
17
|
-
params: CodeInspectToolParams,
|
|
18
|
-
ctx: CodeIntelToolExecCtx,
|
|
19
|
-
): Promise<CodeIntelResult> {
|
|
20
|
-
const outcome = await ctx.session.inspect(params as InspectWorkflowInput, toWorkflowControl(ctx));
|
|
21
|
-
if (outcome.kind === "unavailable") throw new Error(outcome.reason);
|
|
22
|
-
if (outcome.kind === "invalid-input") {
|
|
23
|
-
return inspectErrorResult(`**Error:** ${outcome.message}`, {
|
|
24
|
-
focusTarget: "invalid input",
|
|
25
|
-
nextQueries: ["Provide an existing file and exact 1-based point"],
|
|
26
|
-
message: outcome.message,
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const assembly = assembleInspectResult(outcome.data, outcome.nextQueries);
|
|
31
|
-
return {
|
|
32
|
-
content: renderInspectResult(assembly),
|
|
33
|
-
details: {
|
|
34
|
-
type: "inspect",
|
|
35
|
-
data: assembly.details,
|
|
36
|
-
status: "completed",
|
|
37
|
-
displaySections: assembly.displaySections,
|
|
38
|
-
},
|
|
39
|
-
};
|
|
40
|
-
}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
/** Thin Pi adapter for the session-owned Orientation workflow. */
|
|
2
|
-
|
|
3
|
-
import type {
|
|
4
|
-
OrientationFocusInput,
|
|
5
|
-
OrientationWorkflowInput,
|
|
6
|
-
} from "../../session/orientation-types.ts";
|
|
7
|
-
import type { CodeIntelResult, CodeIntelToolExecCtx } from "../../types/index.ts";
|
|
8
|
-
import { toWorkflowControl } from "../infra/workflow-control.ts";
|
|
9
|
-
import { contextErrorResult } from "../result/errors.ts";
|
|
10
|
-
import {
|
|
11
|
-
assembleOrientationDetails,
|
|
12
|
-
assembleOrientationResult,
|
|
13
|
-
orientationCandidateDisplaySections,
|
|
14
|
-
} from "../result/orientation.ts";
|
|
15
|
-
import { renderOrientationResult } from "./markdown.ts";
|
|
16
|
-
|
|
17
|
-
export interface CodeOrientationToolParams {
|
|
18
|
-
focus?: OrientationFocusInput;
|
|
19
|
-
maxResults?: number;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export async function executeOrientationTool(
|
|
23
|
-
params: CodeOrientationToolParams,
|
|
24
|
-
ctx: CodeIntelToolExecCtx,
|
|
25
|
-
): Promise<CodeIntelResult> {
|
|
26
|
-
const outcome = await ctx.session.orient(
|
|
27
|
-
params as OrientationWorkflowInput,
|
|
28
|
-
toWorkflowControl(ctx),
|
|
29
|
-
);
|
|
30
|
-
if (outcome.kind === "unavailable") throw new Error(outcome.reason);
|
|
31
|
-
if (outcome.kind === "invalid-input") {
|
|
32
|
-
return contextErrorResult(`**Error:** ${outcome.message}`, {
|
|
33
|
-
nextQueries: ["Choose an existing path, module, or precise target"],
|
|
34
|
-
message: outcome.message,
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
if (outcome.kind === "disambiguation" || outcome.kind === "kind-mismatch") {
|
|
38
|
-
const candidates = outcome.candidates ?? [];
|
|
39
|
-
const lines = [
|
|
40
|
-
outcome.kind === "kind-mismatch"
|
|
41
|
-
? `# No Orientation target matched provider kind \`${outcome.requestedKind}\``
|
|
42
|
-
: "# Multiple Orientation targets",
|
|
43
|
-
"",
|
|
44
|
-
];
|
|
45
|
-
for (const candidate of candidates) {
|
|
46
|
-
lines.push(
|
|
47
|
-
`${candidate.rank}. **${candidate.name}** (\`${candidate.kind ?? "unknown"}\`) — \`${candidate.file}\`:${candidate.line}:${candidate.character} — \`${candidate.targetId}\``,
|
|
48
|
-
);
|
|
49
|
-
}
|
|
50
|
-
const nextQueries =
|
|
51
|
-
outcome.kind === "kind-mismatch"
|
|
52
|
-
? ["Retry without symbolKind, use an observed provider kind, or focus one handle"]
|
|
53
|
-
: ["Use one candidate handle as focus.target.handle"];
|
|
54
|
-
const details = assembleOrientationDetails({
|
|
55
|
-
confidence: "semantic",
|
|
56
|
-
omittedCount: outcome.omittedCount,
|
|
57
|
-
candidates,
|
|
58
|
-
nextQueries,
|
|
59
|
-
});
|
|
60
|
-
return {
|
|
61
|
-
content: lines.join("\n"),
|
|
62
|
-
details: {
|
|
63
|
-
type: "context",
|
|
64
|
-
data: details,
|
|
65
|
-
status: "completed",
|
|
66
|
-
displaySections: orientationCandidateDisplaySections(candidates, outcome.omittedCount),
|
|
67
|
-
},
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
const assembly = assembleOrientationResult(outcome.data);
|
|
71
|
-
return {
|
|
72
|
-
content: renderOrientationResult(assembly),
|
|
73
|
-
details: {
|
|
74
|
-
type: "context",
|
|
75
|
-
data: assembly.details,
|
|
76
|
-
status: "completed",
|
|
77
|
-
displaySections: assembly.displaySections,
|
|
78
|
-
},
|
|
79
|
-
};
|
|
80
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
/** Thin Pi adapter for code_resolve. */
|
|
2
|
-
|
|
3
|
-
import type { ResolveTargetInput } from "../../session/target-input.ts";
|
|
4
|
-
import type { CodeIntelResult, CodeIntelToolExecCtx } from "../../types/index.ts";
|
|
5
|
-
import { toWorkflowControl } from "../infra/workflow-control.ts";
|
|
6
|
-
import { assembleResolveResult, suggestedResolveRelations } from "../result/resolve.ts";
|
|
7
|
-
import { renderResolveResult } from "./markdown.ts";
|
|
8
|
-
|
|
9
|
-
export interface CodeResolveToolParams {
|
|
10
|
-
target: ResolveTargetInput;
|
|
11
|
-
maxResults?: number;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export async function executeResolveTool(
|
|
15
|
-
params: CodeResolveToolParams,
|
|
16
|
-
ctx: CodeIntelToolExecCtx,
|
|
17
|
-
): Promise<CodeIntelResult> {
|
|
18
|
-
const outcome = await ctx.session.resolve(params, toWorkflowControl(ctx));
|
|
19
|
-
if (outcome.kind === "unavailable") {
|
|
20
|
-
throw new Error(outcome.reason);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const assembly = assembleResolveResult(outcome, ctx.cwd);
|
|
24
|
-
let content = renderResolveResult(assembly);
|
|
25
|
-
if (outcome.kind === "resolved") {
|
|
26
|
-
const relations = suggestedResolveRelations(outcome.entry.kind);
|
|
27
|
-
content +=
|
|
28
|
-
`\n\nChain next: \`code_graph({ target: { handle: "${outcome.entry.targetId}" }, ` +
|
|
29
|
-
`relations: ${JSON.stringify(relations)} })\``;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
return {
|
|
33
|
-
content,
|
|
34
|
-
details: {
|
|
35
|
-
type: "resolve",
|
|
36
|
-
data: assembly.details,
|
|
37
|
-
status:
|
|
38
|
-
outcome.kind === "resolved" || outcome.kind === "target-group"
|
|
39
|
-
? "completed"
|
|
40
|
-
: outcome.kind === "disambiguation" || outcome.kind === "kind-mismatch"
|
|
41
|
-
? "disambiguation"
|
|
42
|
-
: "invalid-input",
|
|
43
|
-
...(outcome.kind === "invalid-input"
|
|
44
|
-
? { message: outcome.message }
|
|
45
|
-
: outcome.kind === "disambiguation"
|
|
46
|
-
? { message: "Multiple target matches require one candidate." }
|
|
47
|
-
: outcome.kind === "kind-mismatch"
|
|
48
|
-
? { message: `No target matched provider kind ${outcome.requestedKind}.` }
|
|
49
|
-
: {}),
|
|
50
|
-
displaySections: assembly.displaySections,
|
|
51
|
-
},
|
|
52
|
-
};
|
|
53
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|