@mrclrchtr/supi-code-intelligence 11.0.0 → 11.1.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/README.md +41 -4
- package/gradle-helper/README.md +48 -0
- package/gradle-helper/build.sh +73 -0
- package/gradle-helper/lib/gradle-tooling-api-9.4.0.jar +0 -0
- package/gradle-helper/lib/slf4j-api-2.0.17.jar +0 -0
- package/gradle-helper/lib/slf4j-simple-2.0.17.jar +0 -0
- package/gradle-helper/lib/supi-gradle-observation.jar +0 -0
- package/gradle-helper/licenses/DEPENDENCIES.md +11 -0
- package/gradle-helper/licenses/LICENSE-gradle-tooling-api.txt +422 -0
- package/gradle-helper/licenses/LICENSE-slf4j.txt +21 -0
- package/gradle-helper/licenses/NOTICE-gradle.txt +21 -0
- package/gradle-helper/src/GradleObservation.java +597 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-core/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +41 -1
- package/node_modules/@mrclrchtr/supi-lsp/README.md +1 -1
- 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/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +41 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/vscode-jsonrpc/README.md +5 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/vscode-jsonrpc/lib/browser/ril.js +8 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/vscode-jsonrpc/lib/common/connection.js +7 -2
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/vscode-jsonrpc/lib/common/ral.d.ts +8 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/vscode-jsonrpc/lib/node/main.d.ts +14 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/vscode-jsonrpc/lib/node/main.js +6 -4
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/vscode-jsonrpc/lib/node/ril.js +5 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/vscode-jsonrpc/package.json +4 -2
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/vscode-languageserver-protocol/package.json +4 -3
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/vscode-languageserver-types/lib/esm/main.js +2 -2
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/vscode-languageserver-types/lib/umd/main.js +2 -2
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/vscode-languageserver-types/package.json +2 -1
- package/node_modules/@mrclrchtr/supi-lsp/package.json +6 -6
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client.ts +21 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager.ts +1 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/README.md +1 -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/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +41 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/package.json +5 -3
- package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/tsx/LICENSE +21 -0
- 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 +19 -2
- package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/typescript/LICENSE +21 -0
- 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 +19 -2
- package/node_modules/ignore/README.md +95 -14
- package/node_modules/ignore/index.d.ts +56 -20
- package/node_modules/ignore/index.js +150 -120
- package/node_modules/ignore/legacy.js +159 -131
- package/node_modules/ignore/package.json +1 -1
- package/package.json +11 -6
- package/src/analysis/gradle/query.ts +273 -0
- package/src/analysis/gradle/runtime.ts +173 -0
- package/src/analysis/gradle/types.ts +65 -0
- package/src/analysis/read-next.ts +1 -4
- package/src/analysis/refactor/apply.ts +2 -2
- package/src/analysis/refactor/mutation-authority.ts +4 -1
- package/src/analysis/search/ast-scan.ts +143 -18
- package/src/analysis/workspace/safe-path.ts +14 -2
- package/src/analysis/workspace/types.ts +2 -0
- package/src/extension.ts +10 -1
- package/src/gradle/consent.ts +279 -0
- package/src/headless.ts +3 -0
- package/src/overview/collect.ts +11 -3
- package/src/session/orientation/workspace-context.ts +49 -28
- package/src/session/orientation-types.ts +11 -1
- package/src/session/orientation-workflow.ts +2 -0
- package/src/session/session.ts +8 -0
- package/src/tool/code_find/execute.ts +1 -1
- package/src/tool/code_find/markdown.ts +24 -17
- package/src/tool/code_find/result.ts +18 -5
- package/src/tool/code_find/spec.ts +2 -0
- package/src/tool/code_find/structured.ts +161 -0
- package/src/tool/code_graph/result.ts +32 -15
- package/src/tool/code_graph/spec.ts +2 -0
- package/src/tool/code_graph/structured.ts +142 -0
- package/src/tool/code_health/markdown.ts +5 -15
- package/src/tool/code_inspect/markdown.ts +19 -11
- package/src/tool/code_inspect/result.ts +1 -0
- package/src/tool/code_orientation/directory-navigation.ts +66 -0
- package/src/tool/code_orientation/gradle-sections.ts +68 -0
- package/src/tool/code_orientation/markdown.ts +19 -8
- package/src/tool/code_orientation/result.ts +89 -11
- package/src/tool/code_orientation/workspace-format.ts +2 -1
- package/src/tool/code_orientation/workspace-output.ts +40 -13
- package/src/tool/code_orientation/workspace-projects.ts +170 -50
- package/src/tool/code_orientation/workspace-sections.ts +3 -1
- package/src/tool/code_resolve/markdown.ts +4 -10
- package/src/tool/code_resolve/result.ts +2 -0
- package/src/tool/code_resolve/spec.ts +2 -0
- package/src/tool/code_resolve/structured.ts +103 -0
- package/src/tool/infra/truncate.ts +12 -4
- package/src/tool/register.ts +10 -6
- package/src/tool/result/display.ts +17 -0
- package/src/tool/result/model-budget.ts +195 -0
- package/src/tool/result/structured.ts +62 -0
- package/src/tool/result/types.ts +10 -2
- package/src/tool/specs.ts +2 -0
- package/src/types/execution.ts +5 -1
- package/src/ui/tui/display.ts +10 -4
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import type { CodeIntelResult } from "../../types/index.ts";
|
|
2
|
+
import { formatSemanticHealthState } from "../code_health/semantic-state.ts";
|
|
3
|
+
import type { HealthDetails, SearchDetails } from "./types.ts";
|
|
4
|
+
|
|
5
|
+
/** Economic inline bound (approximately 2,000 tokens), independent of Pi's safety limit. */
|
|
6
|
+
export const MODEL_OUTPUT_MAX_CHARACTERS = 8_000;
|
|
7
|
+
const NOTICE_RESERVE = 1_024;
|
|
8
|
+
const MAX_FACT_CHARACTERS = 4_000;
|
|
9
|
+
|
|
10
|
+
type Details = NonNullable<CodeIntelResult["details"]>;
|
|
11
|
+
|
|
12
|
+
/** Preserve collection state and diagnostic snippets before a bounded, explicitly incomplete excerpt. */
|
|
13
|
+
export function boundModelContent(
|
|
14
|
+
content: string,
|
|
15
|
+
details: CodeIntelResult["details"],
|
|
16
|
+
): {
|
|
17
|
+
text: string;
|
|
18
|
+
truncated: boolean;
|
|
19
|
+
} {
|
|
20
|
+
if (details?.modelBudgetManaged || content.length <= MODEL_OUTPUT_MAX_CHARACTERS) {
|
|
21
|
+
return { text: content, truncated: false };
|
|
22
|
+
}
|
|
23
|
+
const lines = [
|
|
24
|
+
"[truncated: model preview; read the saved output for full returned evidence.]",
|
|
25
|
+
"Counts describe the returned result, not this shortened preview.",
|
|
26
|
+
];
|
|
27
|
+
// Reserve diagnostic space before verbose limitations can exhaust the summary.
|
|
28
|
+
// Single-line facts also keep Pi's later line bound from discarding late sections.
|
|
29
|
+
if (details) lines.push(...diagnosticFacts(details).map((fact) => shortFact(fact, 320)));
|
|
30
|
+
const facts = details ? summary(details) : [];
|
|
31
|
+
for (let index = 0; index < facts.length; index++) {
|
|
32
|
+
const fact = shortFact(facts[index], 256);
|
|
33
|
+
if (lines.join("\n").length + fact.length > MAX_FACT_CHARACTERS) {
|
|
34
|
+
lines.push(`Additional summary lines omitted: ${facts.length - index}.`);
|
|
35
|
+
break;
|
|
36
|
+
}
|
|
37
|
+
lines.push(fact);
|
|
38
|
+
}
|
|
39
|
+
const header = `${lines.join("\n")}\n\n## Incomplete text excerpt\n`;
|
|
40
|
+
const remaining = MODEL_OUTPUT_MAX_CHARACTERS - NOTICE_RESERVE - header.length;
|
|
41
|
+
return { text: `${header}${shorten(content, remaining)}`, truncated: true };
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function shorten(value: string, limit: number): string {
|
|
45
|
+
if (value.length <= limit) return value;
|
|
46
|
+
let end = Math.max(0, limit - 15);
|
|
47
|
+
const unit = value.charCodeAt(end - 1);
|
|
48
|
+
if (unit >= 0xd800 && unit <= 0xdbff) end--;
|
|
49
|
+
return `${value.slice(0, end)}… [shortened]`;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function shortFact(value: string, limit: number): string {
|
|
53
|
+
return shorten(value.replace(/\s+/gu, " "), limit);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function diagnosticFacts(details: Details): string[] {
|
|
57
|
+
if (details.type === "inspect") {
|
|
58
|
+
return (details.data.diagnostics ?? [])
|
|
59
|
+
.slice(0, 3)
|
|
60
|
+
.map(
|
|
61
|
+
(diagnostic) =>
|
|
62
|
+
`Diagnostic L${diagnostic.line}:${diagnostic.character} (severity=${diagnostic.severity}): ${diagnostic.message}`,
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
if (details.type === "health") {
|
|
66
|
+
const snippets: string[] = [];
|
|
67
|
+
for (const entry of details.data.diagnosticObservation.entries) {
|
|
68
|
+
for (const message of entry.messages ?? []) {
|
|
69
|
+
snippets.push(`${entry.file}:${message.line} ${message.severity}: ${message.message}`);
|
|
70
|
+
if (snippets.length === 3) return snippets;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return snippets;
|
|
74
|
+
}
|
|
75
|
+
return [];
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function summary(details: Details): string[] {
|
|
79
|
+
const data = details.data;
|
|
80
|
+
return [
|
|
81
|
+
`Result status: ${details.status ?? "completed"}.`,
|
|
82
|
+
...(details.message ? [details.message] : []),
|
|
83
|
+
...("confidence" in data ? [`Confidence: ${data.confidence}.`] : []),
|
|
84
|
+
...(data.evidenceLists ?? []).map(
|
|
85
|
+
(list) =>
|
|
86
|
+
`${list.key}: returned=${list.shownCount}, total=${list.totalCount ?? "unknown"}, cap-omitted=${list.omittedCount ?? "unknown"}; partial=${list.partialReason ?? "none"}${list.invalidLocationCount ? `; invalid locations=${list.invalidLocationCount}` : ""}${list.partialMessage ? `; ${list.partialMessage}` : ""}`,
|
|
87
|
+
),
|
|
88
|
+
...sectionFacts(details),
|
|
89
|
+
];
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function sectionFacts(details: Details): string[] {
|
|
93
|
+
switch (details.type) {
|
|
94
|
+
case "inspect": {
|
|
95
|
+
const data = details.data;
|
|
96
|
+
return [
|
|
97
|
+
`Focus: ${data.focusTarget}; diagnostics window: ${data.diagnosticWindow ? `L${data.diagnosticWindow.startLine}–L${data.diagnosticWindow.endLine}` : "unavailable"}.`,
|
|
98
|
+
...data.sections.map(
|
|
99
|
+
(section) =>
|
|
100
|
+
`${section.key}: ${section.status}${section.reason ? ` — ${section.reason}` : ""}${section.recovery ? `; recovered syntax in ${section.recovery.file}` : ""}`,
|
|
101
|
+
),
|
|
102
|
+
];
|
|
103
|
+
}
|
|
104
|
+
case "graph":
|
|
105
|
+
return [
|
|
106
|
+
`Target: ${details.data.targetName} — ${details.data.targetFile}.`,
|
|
107
|
+
...details.data.sections.map(
|
|
108
|
+
(section) =>
|
|
109
|
+
`${section.rel} (${section.source}): ${section.status}; external=${section.externalCount}${section.depth ? `; depth=${section.depth}` : ""}${section.message ? `; ${section.message}` : ""}${section.recovery ? `; syntax recovery: ${section.recovery.reason}` : ""}`,
|
|
110
|
+
),
|
|
111
|
+
"Callees are written source expressions, not resolved symbol identities; direct depth excludes nested scopes.",
|
|
112
|
+
];
|
|
113
|
+
case "resolve":
|
|
114
|
+
return [
|
|
115
|
+
`${details.data.resultKind}: ${details.data.targetCount} targets; ${details.data.omittedCount} cap omissions.`,
|
|
116
|
+
...(details.data.groupPartialReason
|
|
117
|
+
? [`Partial discovery: ${details.data.groupPartialReason}`]
|
|
118
|
+
: []),
|
|
119
|
+
...details.data.targets
|
|
120
|
+
.slice(0, 3)
|
|
121
|
+
.map(
|
|
122
|
+
(target) =>
|
|
123
|
+
`${target.targetId}: ${target.name ?? "anonymous"} ${target.file}:${target.displayLine}:${target.displayCharacter}; ${target.anchorKind} anchor; confidence=${target.confidence}; provenance=${target.provenance.join("+")}`,
|
|
124
|
+
),
|
|
125
|
+
];
|
|
126
|
+
case "search":
|
|
127
|
+
return searchFacts(details.data);
|
|
128
|
+
case "health":
|
|
129
|
+
return healthFacts(details.data);
|
|
130
|
+
case "context":
|
|
131
|
+
return [
|
|
132
|
+
`Focus: ${details.data.focusTarget ?? "workspace"}.`,
|
|
133
|
+
...(details.data.sections ?? []).map(
|
|
134
|
+
(section) =>
|
|
135
|
+
`${section.title}: ${section.status}${section.reason ? ` — ${section.reason}` : ""}`,
|
|
136
|
+
),
|
|
137
|
+
];
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function searchFacts(data: SearchDetails): string[] {
|
|
142
|
+
const scan = data.scan;
|
|
143
|
+
const lines = [`Search scope: ${data.scope ?? "workspace"}.`];
|
|
144
|
+
if (scan) {
|
|
145
|
+
lines.push(
|
|
146
|
+
`AST universe: ${scan.universe}; complete=${scan.complete}; eligible=${scan.eligibleFileCount ?? "unknown"}; analyzed=${scan.analyzedFileCount}.`,
|
|
147
|
+
...scan.limitations.map(
|
|
148
|
+
(limit) =>
|
|
149
|
+
`Scan limitation: ${limit.reason}; paths=${limit.pathCount ?? "unknown"}${limit.reason === "unreadable-path" && limit.examples.length ? `; examples=${limit.examples.join(", ")}` : ""}.`,
|
|
150
|
+
),
|
|
151
|
+
...(scan.exclusions.length
|
|
152
|
+
? ["Policy skips are traversal decisions; other explicit scopes may include these paths."]
|
|
153
|
+
: []),
|
|
154
|
+
...scan.exclusions.map(
|
|
155
|
+
(exclusion) =>
|
|
156
|
+
`Policy skip: ${exclusion.reason}; paths=${exclusion.pathCount}; scope=${exclusion.scopeRoot}.`,
|
|
157
|
+
),
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
if (data.automaticPathExclusion)
|
|
161
|
+
lines.push(`Automatic path exclusions: ${data.automaticPathExclusion.excludedCount}.`);
|
|
162
|
+
if (data.structuralFailures?.length) {
|
|
163
|
+
lines.push(
|
|
164
|
+
`Structural failures: ${data.structuralFailures.length}.`,
|
|
165
|
+
...data.structuralFailures.slice(0, 3).map((failure) => `${failure.file}: ${failure.reason}`),
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
return lines;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
function healthFacts(data: HealthDetails): string[] {
|
|
172
|
+
const observation = data.diagnosticObservation;
|
|
173
|
+
const lines = [
|
|
174
|
+
`LSP: ${formatSemanticHealthState(data.semanticState)}; structural: ${data.structuralStatus ?? String(data.structuralAvailable)}.`,
|
|
175
|
+
`Server inventory is workspace-wide: ${data.serverCount}; routes: ${JSON.stringify(data.serverRouteStatusCounts)}.`,
|
|
176
|
+
`Refresh: ${data.refresh.kind}. Maintenance recovery is separate from diagnostic confirmation.`,
|
|
177
|
+
];
|
|
178
|
+
if ("reason" in data.refresh) lines.push(`Refresh reason: ${data.refresh.reason}`);
|
|
179
|
+
if (observation.kind !== "not-requested") {
|
|
180
|
+
const scope = observation.scope;
|
|
181
|
+
lines.push(
|
|
182
|
+
`Diagnostics: ${observation.kind}; ${scope.kind === "file" ? `file=${scope.path}` : `tracked-file snapshot; filter=${scope.filter ?? "none"}; not workspace-wide verification`}.`,
|
|
183
|
+
`Diagnostic coverage: requested=${observation.evidence.requested}, confirmed=${observation.evidence.confirmed}, unconfirmed=${observation.evidence.unconfirmed}, failed=${observation.evidence.failed}, removed=${observation.evidence.removed}.`,
|
|
184
|
+
);
|
|
185
|
+
if ("reason" in observation) lines.push(`Diagnostic limitation: ${observation.reason}`);
|
|
186
|
+
if (observation.scopeStatus)
|
|
187
|
+
lines.push(`File scope status: ${JSON.stringify(observation.scopeStatus)}`);
|
|
188
|
+
}
|
|
189
|
+
if (data.capabilityWarnings?.hasWarnings)
|
|
190
|
+
lines.push(
|
|
191
|
+
`Capability warnings: ${data.capabilityWarnings.warnings.length}.`,
|
|
192
|
+
...data.capabilityWarnings.warnings.slice(0, 3).map((warning) => warning.message),
|
|
193
|
+
);
|
|
194
|
+
return lines;
|
|
195
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { StringEnum } from "@earendil-works/pi-ai";
|
|
2
|
+
import { Type } from "typebox";
|
|
3
|
+
|
|
4
|
+
/** Collection confidence, independent of result completeness. */
|
|
5
|
+
export const ConfidenceSchema = StringEnum(["semantic", "structural", "heuristic", "unavailable"]);
|
|
6
|
+
|
|
7
|
+
/** Canonical evidence counts; null totals mean collection could not establish completeness. */
|
|
8
|
+
export const EvidenceListSchema = Type.Object(
|
|
9
|
+
{
|
|
10
|
+
key: Type.String(),
|
|
11
|
+
totalCount: Type.Union([Type.Integer(), Type.Null()]),
|
|
12
|
+
shownCount: Type.Integer(),
|
|
13
|
+
omittedCount: Type.Union([Type.Integer(), Type.Null()]),
|
|
14
|
+
partialReason: Type.Union([Type.String(), Type.Null()]),
|
|
15
|
+
partialMessage: Type.Optional(Type.String()),
|
|
16
|
+
invalidLocationCount: Type.Optional(Type.Integer()),
|
|
17
|
+
},
|
|
18
|
+
{ additionalProperties: false },
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
/** Provider recovery ranges use zero-based UTF-16 positions. */
|
|
22
|
+
export const RecoveryRangeSchema = Type.Object({
|
|
23
|
+
start: Type.Object({ line: Type.Integer(), character: Type.Integer() }),
|
|
24
|
+
end: Type.Object({ line: Type.Integer(), character: Type.Integer() }),
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
/** Reusable target handle with one-based UTF-16 coordinates, never a mutable store entry. */
|
|
28
|
+
export const NavigationTargetSchema = Type.Object(
|
|
29
|
+
{
|
|
30
|
+
handle: Type.String(),
|
|
31
|
+
name: Type.Union([Type.String(), Type.Null()]),
|
|
32
|
+
kind: Type.Union([Type.String(), Type.Null()]),
|
|
33
|
+
nativeKind: Type.Optional(Type.String()),
|
|
34
|
+
file: Type.String(),
|
|
35
|
+
line: Type.Integer(),
|
|
36
|
+
character: Type.Integer(),
|
|
37
|
+
anchorKind: StringEnum(["name", "declaration"]),
|
|
38
|
+
container: Type.Optional(Type.Union([Type.String(), Type.Null()])),
|
|
39
|
+
confidence: Type.Optional(ConfidenceSchema),
|
|
40
|
+
provenance: Type.Optional(Type.Array(StringEnum(["semantic", "structural"]))),
|
|
41
|
+
resolution: Type.Optional(
|
|
42
|
+
Type.Object({
|
|
43
|
+
requested: Type.Object({ line: Type.Integer(), character: Type.Integer() }),
|
|
44
|
+
resolved: Type.Object({ line: Type.Integer(), character: Type.Integer() }),
|
|
45
|
+
snapped: Type.Boolean(),
|
|
46
|
+
source: StringEnum(["semantic", "structural", "structural-identifier"]),
|
|
47
|
+
}),
|
|
48
|
+
),
|
|
49
|
+
},
|
|
50
|
+
{ additionalProperties: false },
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
/** Source ranges suggested for a subsequent read, not additional code evidence. */
|
|
54
|
+
export const ReadNextSchema = Type.Object(
|
|
55
|
+
{
|
|
56
|
+
file: Type.String(),
|
|
57
|
+
startLine: Type.Integer(),
|
|
58
|
+
endLine: Type.Integer(),
|
|
59
|
+
reason: Type.String(),
|
|
60
|
+
},
|
|
61
|
+
{ additionalProperties: false },
|
|
62
|
+
);
|
package/src/tool/result/types.ts
CHANGED
|
@@ -18,7 +18,7 @@ import type {
|
|
|
18
18
|
HealthSection,
|
|
19
19
|
SemanticHealthState,
|
|
20
20
|
} from "../../session/health-types.ts";
|
|
21
|
-
import type { InspectResultData } from "../../session/inspect-types.ts";
|
|
21
|
+
import type { InspectDiagnostic, InspectResultData } from "../../session/inspect-types.ts";
|
|
22
22
|
import type { TargetSymbolKind } from "../../session/target-input.ts";
|
|
23
23
|
import type {
|
|
24
24
|
AnchorKind,
|
|
@@ -32,7 +32,7 @@ export type ToolResultStatus = "completed" | "invalid-input" | "disambiguation"
|
|
|
32
32
|
|
|
33
33
|
/** Separate model-content and human-display bounds, with one optional continuation file. */
|
|
34
34
|
export interface ToolOutputTruncationDetails {
|
|
35
|
-
/** Model content exceeded the PI
|
|
35
|
+
/** Model content exceeded its economic budget or the PI safety limit. */
|
|
36
36
|
truncated: boolean;
|
|
37
37
|
/** The TUI omits evidence that remains in the model content. */
|
|
38
38
|
displayTruncated?: boolean;
|
|
@@ -51,6 +51,12 @@ export interface ToolDisplaySection {
|
|
|
51
51
|
partialReason: string | null;
|
|
52
52
|
/** Provider explanation for incomplete collection, when available. */
|
|
53
53
|
partialMessage?: string;
|
|
54
|
+
/** Content counts are separate from canonical evidence when rows are grouped or framed. */
|
|
55
|
+
preview?: {
|
|
56
|
+
unit: "group" | "block";
|
|
57
|
+
/** Assembly-owned canonical evidence summary, not evidence inferred from display rows. */
|
|
58
|
+
evidenceSummary?: string;
|
|
59
|
+
};
|
|
54
60
|
}
|
|
55
61
|
|
|
56
62
|
// ── Anchored coordinate resolution metadata ───────────────────────────
|
|
@@ -238,6 +244,8 @@ export interface InspectDetails {
|
|
|
238
244
|
confidence: ConfidenceMode;
|
|
239
245
|
focusTarget: string;
|
|
240
246
|
diagnosticWindow: { startLine: number; endLine: number } | null;
|
|
247
|
+
/** Bounded diagnostic facts, independent of TUI preview strings. */
|
|
248
|
+
diagnostics?: readonly InspectDiagnostic[];
|
|
241
249
|
sections: InspectSectionDetails[];
|
|
242
250
|
evidenceLists?: EvidenceListMetadata[];
|
|
243
251
|
nextQueries: string[];
|
package/src/tool/specs.ts
CHANGED
|
@@ -28,6 +28,8 @@ export interface CodeIntelligenceToolDefinitionSpec {
|
|
|
28
28
|
name: CodeIntelligenceToolName;
|
|
29
29
|
label: string;
|
|
30
30
|
parameters: TSchema;
|
|
31
|
+
/** Machine-readable success and recoverable-input outcomes for programmatic callers. */
|
|
32
|
+
outputSchema?: TSchema;
|
|
31
33
|
maxLines?: number;
|
|
32
34
|
maxBytes?: number;
|
|
33
35
|
run: (params: unknown, ctx: CodeIntelToolExecCtx) => Promise<CodeIntelResult> | CodeIntelResult;
|
package/src/types/execution.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AgentToolUpdateCallback } from "@earendil-works/pi-coding-agent";
|
|
1
|
+
import type { AgentToolResult, AgentToolUpdateCallback } from "@earendil-works/pi-coding-agent";
|
|
2
2
|
import type { WorkspaceCodeIntelligenceSession } from "../session/session.ts";
|
|
3
3
|
import type { GraphDetails } from "../tool/code_graph/details.ts";
|
|
4
4
|
import type {
|
|
@@ -51,6 +51,8 @@ export interface CodeIntelResultDetails {
|
|
|
51
51
|
message?: string;
|
|
52
52
|
displaySections?: readonly ToolDisplaySection[];
|
|
53
53
|
truncation?: ToolOutputTruncationDetails;
|
|
54
|
+
/** Workspace navigation and instruction delivery already own a separate model budget. */
|
|
55
|
+
modelBudgetManaged?: boolean;
|
|
54
56
|
/** UI/debug-only soft-budget warning; never part of model content. */
|
|
55
57
|
budgetWarning?: import("../tool/code_orientation/workspace-output.ts").WorkspaceBudgetWarning;
|
|
56
58
|
}
|
|
@@ -58,6 +60,8 @@ export interface CodeIntelResultDetails {
|
|
|
58
60
|
/** Tool result shape returned by executeAction. */
|
|
59
61
|
export interface CodeIntelResult {
|
|
60
62
|
content: string;
|
|
63
|
+
/** Caller-facing JSON for codemode; independent of UI details and model-visible text. */
|
|
64
|
+
structuredContent?: AgentToolResult<unknown>["structuredContent"];
|
|
61
65
|
details?:
|
|
62
66
|
| (CodeIntelResultDetails & { type: "context"; data: ContextDetails })
|
|
63
67
|
| (CodeIntelResultDetails & { type: "inspect"; data: InspectDetails })
|
package/src/ui/tui/display.ts
CHANGED
|
@@ -20,18 +20,24 @@ export function renderToolDisplaySections(
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
function formatDisplayBounds(section: ToolDisplaySection): string {
|
|
23
|
+
const summary = section.preview?.evidenceSummary;
|
|
24
|
+
const prefix = summary ? `${summary}; ` : "";
|
|
25
|
+
const unit = section.preview?.unit;
|
|
26
|
+
const label = (count: number) => (unit ? ` preview ${unit}${count === 1 ? "" : "s"}` : "");
|
|
23
27
|
if (section.totalCount === null) {
|
|
24
|
-
const omitted = section.omittedCount
|
|
28
|
+
const omitted = section.omittedCount
|
|
29
|
+
? `; ${section.omittedCount}${label(section.omittedCount)} collected omitted`
|
|
30
|
+
: "";
|
|
25
31
|
const reason = section.partialReason
|
|
26
32
|
? `; more may exist — ${section.partialReason}`
|
|
27
33
|
: "; partial";
|
|
28
34
|
const message = section.partialMessage ? `; ${section.partialMessage}` : "";
|
|
29
|
-
return ` (${section.shownCount}${omitted}${reason}${message})`;
|
|
35
|
+
return ` (${prefix}${section.shownCount}${label(section.shownCount)}${omitted}${reason}${message})`;
|
|
30
36
|
}
|
|
31
37
|
if (section.omittedCount && section.omittedCount > 0) {
|
|
32
|
-
return ` (${section.shownCount} of ${section.totalCount}; ${section.omittedCount} omitted)`;
|
|
38
|
+
return ` (${prefix}${section.shownCount} of ${section.totalCount}${label(section.totalCount)}; ${section.omittedCount}${label(section.omittedCount)} omitted)`;
|
|
33
39
|
}
|
|
34
|
-
return ` (${section.totalCount})`;
|
|
40
|
+
return ` (${prefix}${section.totalCount}${label(section.totalCount)})`;
|
|
35
41
|
}
|
|
36
42
|
|
|
37
43
|
/** Format one call argument for a compact human transcript row. */
|