@mrclrchtr/supi-review 7.3.1 → 8.0.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 +4 -0
- package/node_modules/@mrclrchtr/supi-agent-runtime/README.md +11 -1
- package/node_modules/@mrclrchtr/supi-agent-runtime/node_modules/@mrclrchtr/supi-core/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-agent-runtime/node_modules/@mrclrchtr/supi-core/src/config/config.ts +110 -0
- package/node_modules/@mrclrchtr/supi-agent-runtime/node_modules/@mrclrchtr/supi-core/src/config.ts +6 -1
- package/node_modules/@mrclrchtr/supi-agent-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-schema.ts +2 -1
- package/node_modules/@mrclrchtr/supi-agent-runtime/package.json +7 -3
- package/node_modules/@mrclrchtr/supi-agent-runtime/src/api.ts +37 -1
- package/node_modules/@mrclrchtr/supi-agent-runtime/src/lifecycle-trace.ts +5 -2
- package/node_modules/@mrclrchtr/supi-agent-runtime/src/run.ts +237 -35
- package/node_modules/@mrclrchtr/supi-agent-runtime/src/session/agent-run-registry-types.ts +95 -0
- package/node_modules/@mrclrchtr/supi-agent-runtime/src/session/agent-run-registry.ts +372 -0
- package/node_modules/@mrclrchtr/supi-agent-runtime/src/session/transcript-format.ts +184 -0
- package/node_modules/@mrclrchtr/supi-agent-runtime/src/session/transcript-store.ts +284 -0
- package/node_modules/@mrclrchtr/supi-agent-runtime/src/types.ts +30 -4
- package/node_modules/@mrclrchtr/supi-agent-runtime/src/ui/agents-command.ts +206 -0
- package/node_modules/@mrclrchtr/supi-agent-runtime/src/ui/agents-overlay-data.ts +100 -0
- package/node_modules/@mrclrchtr/supi-agent-runtime/src/ui/agents-overlay-render.ts +167 -0
- package/node_modules/@mrclrchtr/supi-agent-runtime/src/ui/agents-overlay.ts +398 -0
- package/node_modules/@mrclrchtr/supi-agent-runtime/src/ui/agents-run-list.ts +95 -0
- package/node_modules/@mrclrchtr/supi-agent-runtime/src/ui/agents-run-switcher.ts +29 -0
- package/node_modules/@mrclrchtr/supi-agent-runtime/src/ui/agents-run-viewer-input.ts +69 -0
- package/node_modules/@mrclrchtr/supi-agent-runtime/src/ui/agents-run-viewer-render.ts +246 -0
- package/node_modules/@mrclrchtr/supi-agent-runtime/src/ui/agents-run-viewer.ts +400 -0
- package/node_modules/@mrclrchtr/supi-agent-runtime/src/ui/agents-run-viewport.ts +112 -0
- package/node_modules/@mrclrchtr/supi-agent-runtime/src/ui/agents-steering-input.ts +50 -0
- package/node_modules/@mrclrchtr/supi-agent-runtime/src/ui/agents-transcript-context.ts +56 -0
- package/node_modules/@mrclrchtr/supi-agent-runtime/src/ui/agents-transcript-pane.ts +386 -0
- package/node_modules/@mrclrchtr/supi-agent-runtime/src/ui/agents-transcript-payload.ts +66 -0
- package/node_modules/@mrclrchtr/supi-agent-runtime/src/ui/agents-transcript.ts +380 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/README.md +6 -6
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-code-runtime/src/api.ts +1 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-code-runtime/src/query-result.ts +22 -4
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-core/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-core/src/config/config.ts +110 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-core/src/config.ts +6 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-core/src/settings/settings-schema.ts +2 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/README.md +29 -6
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/api.ts +1 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/query-result.ts +22 -4
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/config/config.ts +110 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/config.ts +6 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/settings/settings-schema.ts +2 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/package.json +3 -3
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/api.ts +25 -3
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-host.ts +2 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-refresh.ts +5 -2
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostics.ts +39 -6
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/client/client-document-sync.ts +82 -12
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/client/client-semantic-input-barrier.ts +28 -5
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/client/client.ts +606 -30
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/config/capabilities.ts +9 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/config/config.ts +69 -8
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/config/operation-support.ts +196 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/config/server-config.ts +15 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/config/types.ts +9 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-project-info.ts +2 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-workspace-symbol.ts +31 -2
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/manager/manager.ts +72 -2
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/provider/lsp-refactor-provider.ts +9 -43
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/provider/refactor-planning.ts +102 -50
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/provider/semantic-edit-normalizer.ts +49 -3
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-controller.ts +78 -18
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-registry.ts +46 -2
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/session/workspace-lsp-runtime.ts +14 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/workspace-path-policy.ts +30 -4
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/api.ts +1 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/query-result.ts +22 -4
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/config/config.ts +110 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/config.ts +6 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/settings/settings-schema.ts +2 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/package.json +3 -3
- package/node_modules/@mrclrchtr/supi-code-intelligence/package.json +5 -5
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/analysis/capability/capability-warnings.ts +64 -25
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/analysis/health/server-status.ts +23 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/analysis/health/signals.ts +1 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/analysis/search/ast-scan.ts +42 -8
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/analysis/search/pattern.ts +4 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/config.ts +64 -34
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/extension.ts +29 -10
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/headless.ts +1 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/session/find-types.ts +2 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/session/find-workflow.ts +5 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/session/health-types.ts +3 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/session/health-workflow.ts +10 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/session/session.ts +34 -2
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/substrate/lsp/lifecycle.ts +2 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/substrate/lsp/recovery.ts +3 -3
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/substrate/lsp/settings.ts +191 -108
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/substrate/workspace-provider-host.ts +50 -12
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_find/markdown.ts +12 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_find/render.ts +20 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_find/result.ts +3 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_health/markdown.ts +3 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_health/result.ts +3 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/result/types.ts +3 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/ui/status-command.ts +54 -6
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/ui/status-overlay.ts +5 -0
- package/node_modules/@mrclrchtr/supi-core/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-core/src/config/config.ts +110 -0
- package/node_modules/@mrclrchtr/supi-core/src/config.ts +6 -1
- package/node_modules/@mrclrchtr/supi-core/src/settings/settings-schema.ts +2 -1
- package/package.json +4 -4
- package/src/review.ts +5 -2
- package/src/tool/review_run/child-session.ts +29 -7
- package/src/tool/review_run/execute.ts +6 -1
- package/src/tool/review_run/execution.ts +6 -0
- package/src/tool/review_run/register.ts +3 -1
- package/src/tool/review_run/runner.ts +40 -0
- package/src/tool/review_run/spec.ts +2 -0
- package/src/tool/review_run/workflow.ts +7 -1
- package/src/tui/review-command.ts +74 -3
- package/src/types.ts +5 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/config/lsp-settings.ts +0 -22
|
@@ -0,0 +1,380 @@
|
|
|
1
|
+
import type { AssistantMessage } from "@earendil-works/pi-ai";
|
|
2
|
+
import {
|
|
3
|
+
AssistantMessageComponent,
|
|
4
|
+
getMarkdownTheme,
|
|
5
|
+
type Theme,
|
|
6
|
+
ToolExecutionComponent,
|
|
7
|
+
UserMessageComponent,
|
|
8
|
+
} from "@earendil-works/pi-coding-agent";
|
|
9
|
+
import { type Component, Image, Text } from "@earendil-works/pi-tui";
|
|
10
|
+
import type { AgentRunMessage, AgentRunToolRenderer } from "@mrclrchtr/supi-agent-runtime/api";
|
|
11
|
+
import type { AgentRunTranscriptDocument } from "../session/transcript-store.ts";
|
|
12
|
+
import type { AgentRunBlock } from "./agents-run-viewport.ts";
|
|
13
|
+
import { renderSystemPrompt, renderTranscriptMetadata } from "./agents-transcript-context.ts";
|
|
14
|
+
import { formatTranscriptValue, RawToolPayload } from "./agents-transcript-payload.ts";
|
|
15
|
+
|
|
16
|
+
export interface AgentTranscriptInteractiveTarget {
|
|
17
|
+
readonly start: number;
|
|
18
|
+
readonly height: number;
|
|
19
|
+
readonly component: Component;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface AgentTranscriptRenderItem {
|
|
23
|
+
readonly key: number;
|
|
24
|
+
readonly component: Component;
|
|
25
|
+
readonly interactive: boolean;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface AgentTranscriptRenderResult {
|
|
29
|
+
readonly items: readonly AgentTranscriptRenderItem[];
|
|
30
|
+
readonly assistantMessages: readonly AssistantMessageComponent[];
|
|
31
|
+
readonly toolCalls: readonly ToolExecutionComponent[];
|
|
32
|
+
readonly rawPayloads: readonly RawToolPayload[];
|
|
33
|
+
readonly assistantByIndex: ReadonlyMap<number, AssistantMessageComponent>;
|
|
34
|
+
readonly toolCallsById: ReadonlyMap<string, ToolExecutionComponent>;
|
|
35
|
+
readonly rawPayloadsById: ReadonlyMap<string, RawToolPayload>;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** Options for one full Agent Run transcript render. */
|
|
39
|
+
export interface RenderAgentRunTranscriptOptions {
|
|
40
|
+
readonly document: AgentRunTranscriptDocument;
|
|
41
|
+
readonly toolRenderers: readonly AgentRunToolRenderer[];
|
|
42
|
+
readonly theme: Theme;
|
|
43
|
+
readonly tui: { requestRender: () => void };
|
|
44
|
+
readonly expanded: boolean;
|
|
45
|
+
readonly thinkingHidden: boolean;
|
|
46
|
+
readonly view: "conversation" | "details";
|
|
47
|
+
readonly previous?: AgentTranscriptRenderResult;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
interface TranscriptRenderContext extends RenderAgentRunTranscriptOptions {
|
|
51
|
+
readonly items: AgentTranscriptRenderItem[];
|
|
52
|
+
readonly assistantMessages: AssistantMessageComponent[];
|
|
53
|
+
readonly toolCalls: ToolExecutionComponent[];
|
|
54
|
+
readonly rawPayloads: RawToolPayload[];
|
|
55
|
+
readonly assistantByIndex: Map<number, AssistantMessageComponent>;
|
|
56
|
+
readonly toolCallsById: Map<string, ToolExecutionComponent>;
|
|
57
|
+
readonly rawPayloadsById: Map<string, RawToolPayload>;
|
|
58
|
+
readonly renderers: Map<string, AgentRunToolRenderer>;
|
|
59
|
+
readonly results: Map<string, AgentRunMessage>;
|
|
60
|
+
readonly renderedResults: Set<string>;
|
|
61
|
+
nextKey: number;
|
|
62
|
+
messageIndex: number;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/** Render a full human transcript with Pi's message and tool components. */
|
|
66
|
+
export function renderAgentRunTranscript(
|
|
67
|
+
options: RenderAgentRunTranscriptOptions,
|
|
68
|
+
): AgentTranscriptRenderResult {
|
|
69
|
+
const context = createRenderContext(options);
|
|
70
|
+
if (options.view === "details") {
|
|
71
|
+
addItem(context, renderTranscriptMetadata(options.document, options.theme));
|
|
72
|
+
for (const prompt of options.document.systemPromptHistory) {
|
|
73
|
+
addItem(context, renderSystemPrompt(prompt, options.theme));
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
for (const message of options.document.messages) {
|
|
77
|
+
appendMessage(context, message, context.messageIndex++, options.view === "details");
|
|
78
|
+
}
|
|
79
|
+
return {
|
|
80
|
+
items: context.items,
|
|
81
|
+
assistantMessages: context.assistantMessages,
|
|
82
|
+
toolCalls: context.toolCalls,
|
|
83
|
+
rawPayloads: context.rawPayloads,
|
|
84
|
+
assistantByIndex: context.assistantByIndex,
|
|
85
|
+
toolCallsById: context.toolCallsById,
|
|
86
|
+
rawPayloadsById: context.rawPayloadsById,
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export function layoutAgentRunTranscript(
|
|
91
|
+
transcript: AgentTranscriptRenderResult,
|
|
92
|
+
width: number,
|
|
93
|
+
): { blocks: readonly AgentRunBlock[]; targets: readonly AgentTranscriptInteractiveTarget[] } {
|
|
94
|
+
const blocks: AgentRunBlock[] = [];
|
|
95
|
+
const targets: AgentTranscriptInteractiveTarget[] = [];
|
|
96
|
+
let nextRow = 0;
|
|
97
|
+
for (const item of transcript.items) {
|
|
98
|
+
const lines = item.component.render(width);
|
|
99
|
+
blocks.push({ key: item.key, lines });
|
|
100
|
+
if (item.interactive && lines.length > 0) {
|
|
101
|
+
targets.push({ start: nextRow, height: lines.length, component: item.component });
|
|
102
|
+
}
|
|
103
|
+
nextRow += lines.length;
|
|
104
|
+
}
|
|
105
|
+
return { blocks, targets };
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function createRenderContext(options: RenderAgentRunTranscriptOptions): TranscriptRenderContext {
|
|
109
|
+
const results = new Map<string, AgentRunMessage>();
|
|
110
|
+
for (const message of options.document.messages) {
|
|
111
|
+
if (message.role === "toolResult" && typeof message.toolCallId === "string") {
|
|
112
|
+
results.set(message.toolCallId, message);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return {
|
|
116
|
+
...options,
|
|
117
|
+
items: [],
|
|
118
|
+
assistantMessages: [],
|
|
119
|
+
toolCalls: [],
|
|
120
|
+
rawPayloads: [],
|
|
121
|
+
assistantByIndex: new Map(),
|
|
122
|
+
toolCallsById: new Map(),
|
|
123
|
+
rawPayloadsById: new Map(),
|
|
124
|
+
renderers: new Map(options.toolRenderers.map((renderer) => [renderer.name, renderer])),
|
|
125
|
+
results,
|
|
126
|
+
renderedResults: new Set(),
|
|
127
|
+
nextKey: 0,
|
|
128
|
+
messageIndex: 0,
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
function appendMessage(
|
|
133
|
+
context: TranscriptRenderContext,
|
|
134
|
+
message: AgentRunMessage,
|
|
135
|
+
messageIndex: number,
|
|
136
|
+
showTechnicalDetails: boolean,
|
|
137
|
+
): void {
|
|
138
|
+
const pairedToolResult =
|
|
139
|
+
message.role === "toolResult" &&
|
|
140
|
+
typeof message.toolCallId === "string" &&
|
|
141
|
+
context.renderedResults.has(message.toolCallId);
|
|
142
|
+
if (showTechnicalDetails && !pairedToolResult) addMessageHeader(context, message);
|
|
143
|
+
if (message.role === "assistant") {
|
|
144
|
+
appendAssistantMessage(context, message, messageIndex, showTechnicalDetails);
|
|
145
|
+
} else if (message.role === "user") {
|
|
146
|
+
appendUserMessage(context, message);
|
|
147
|
+
} else if (message.role === "toolResult") {
|
|
148
|
+
appendToolResult(context, message, showTechnicalDetails);
|
|
149
|
+
} else {
|
|
150
|
+
addItem(context, new Text(formatMessage(message), 1, 0));
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
function addMessageHeader(context: TranscriptRenderContext, message: AgentRunMessage): void {
|
|
155
|
+
const timestamp =
|
|
156
|
+
typeof message.timestamp === "number" && Number.isFinite(message.timestamp)
|
|
157
|
+
? ` · ${new Date(message.timestamp).toLocaleTimeString()}`
|
|
158
|
+
: "";
|
|
159
|
+
addItem(context, new Text(context.theme.fg("dim", `${message.role}${timestamp}`), 0, 0));
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
function appendAssistantMessage(
|
|
163
|
+
context: TranscriptRenderContext,
|
|
164
|
+
message: AgentRunMessage,
|
|
165
|
+
messageIndex: number,
|
|
166
|
+
showTechnicalDetails: boolean,
|
|
167
|
+
): void {
|
|
168
|
+
if (!Array.isArray(message.content)) {
|
|
169
|
+
addItem(context, new Text(formatMessage(message), 1, 0));
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
const existing = context.previous?.assistantByIndex.get(messageIndex);
|
|
173
|
+
const assistant =
|
|
174
|
+
existing ??
|
|
175
|
+
new AssistantMessageComponent(
|
|
176
|
+
message as unknown as AssistantMessage,
|
|
177
|
+
context.thinkingHidden,
|
|
178
|
+
getMarkdownTheme(),
|
|
179
|
+
"Thinking is hidden · press i to show",
|
|
180
|
+
1,
|
|
181
|
+
);
|
|
182
|
+
if (existing) assistant.updateContent(message as unknown as AssistantMessage, false);
|
|
183
|
+
context.assistantByIndex.set(messageIndex, assistant);
|
|
184
|
+
context.assistantMessages.push(assistant);
|
|
185
|
+
addItem(context, assistant, true);
|
|
186
|
+
for (const part of message.content) {
|
|
187
|
+
if (isToolCall(part)) appendToolCall(context, part, showTechnicalDetails);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
function appendToolCall(
|
|
192
|
+
context: TranscriptRenderContext,
|
|
193
|
+
part: { type: "toolCall"; id: string; name: string; arguments: unknown },
|
|
194
|
+
showTechnicalDetails: boolean,
|
|
195
|
+
): void {
|
|
196
|
+
const result = context.results.get(part.id);
|
|
197
|
+
if (result) context.renderedResults.add(part.id);
|
|
198
|
+
if (showTechnicalDetails && result) addMessageHeader(context, result);
|
|
199
|
+
const existing = context.previous?.toolCallsById.get(part.id);
|
|
200
|
+
const tool =
|
|
201
|
+
existing ??
|
|
202
|
+
createToolComponent({
|
|
203
|
+
name: part.name,
|
|
204
|
+
id: part.id,
|
|
205
|
+
args: part.arguments,
|
|
206
|
+
result,
|
|
207
|
+
renderer: context.renderers.get(part.name),
|
|
208
|
+
tui: context.tui,
|
|
209
|
+
cwd: context.document.metadata.cwd,
|
|
210
|
+
expanded: context.expanded,
|
|
211
|
+
});
|
|
212
|
+
if (existing && result) tool.updateResult(toolResultPayload(result), false);
|
|
213
|
+
context.toolCallsById.set(part.id, tool);
|
|
214
|
+
context.toolCalls.push(tool);
|
|
215
|
+
addItem(context, tool, true);
|
|
216
|
+
const rawKey = `tool:${part.id}`;
|
|
217
|
+
const raw = context.previous?.rawPayloadsById.get(rawKey);
|
|
218
|
+
if (raw) {
|
|
219
|
+
raw.update({ input: part.arguments, result });
|
|
220
|
+
context.rawPayloadsById.set(rawKey, raw);
|
|
221
|
+
} else {
|
|
222
|
+
const payload = new RawToolPayload({ input: part.arguments, result }, context.theme);
|
|
223
|
+
payload.setExpanded(context.expanded);
|
|
224
|
+
context.rawPayloadsById.set(rawKey, payload);
|
|
225
|
+
}
|
|
226
|
+
const activeRaw = context.rawPayloadsById.get(rawKey);
|
|
227
|
+
if (!activeRaw) throw new Error("Raw tool payload was not created.");
|
|
228
|
+
context.rawPayloads.push(activeRaw);
|
|
229
|
+
if (showTechnicalDetails) addItem(context, activeRaw, true);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
function appendUserMessage(context: TranscriptRenderContext, message: AgentRunMessage): void {
|
|
233
|
+
addItem(context, new UserMessageComponent(textContent(message.content), getMarkdownTheme(), 1));
|
|
234
|
+
for (const image of imageContent(message.content)) {
|
|
235
|
+
addItem(
|
|
236
|
+
context,
|
|
237
|
+
new Image(
|
|
238
|
+
image.data,
|
|
239
|
+
image.mimeType,
|
|
240
|
+
{ fallbackColor: (text) => context.theme.fg("muted", text) },
|
|
241
|
+
{ maxWidthCells: 80, maxHeightCells: 24 },
|
|
242
|
+
),
|
|
243
|
+
);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
function appendToolResult(
|
|
248
|
+
context: TranscriptRenderContext,
|
|
249
|
+
message: AgentRunMessage,
|
|
250
|
+
showTechnicalDetails: boolean,
|
|
251
|
+
): void {
|
|
252
|
+
if (typeof message.toolCallId !== "string" || context.renderedResults.has(message.toolCallId)) {
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
const name = typeof message.toolName === "string" ? message.toolName : "tool";
|
|
256
|
+
const existing = context.previous?.toolCallsById.get(message.toolCallId);
|
|
257
|
+
const tool =
|
|
258
|
+
existing ??
|
|
259
|
+
createToolComponent({
|
|
260
|
+
name,
|
|
261
|
+
id: message.toolCallId,
|
|
262
|
+
result: message,
|
|
263
|
+
renderer: context.renderers.get(name),
|
|
264
|
+
tui: context.tui,
|
|
265
|
+
cwd: context.document.metadata.cwd,
|
|
266
|
+
expanded: context.expanded,
|
|
267
|
+
});
|
|
268
|
+
if (existing) tool.updateResult(toolResultPayload(message), false);
|
|
269
|
+
context.toolCallsById.set(message.toolCallId, tool);
|
|
270
|
+
context.toolCalls.push(tool);
|
|
271
|
+
addItem(context, tool, true);
|
|
272
|
+
const rawKey = `result:${message.toolCallId}`;
|
|
273
|
+
const raw = context.previous?.rawPayloadsById.get(rawKey);
|
|
274
|
+
if (raw) {
|
|
275
|
+
raw.update({ result: message });
|
|
276
|
+
context.rawPayloadsById.set(rawKey, raw);
|
|
277
|
+
} else {
|
|
278
|
+
const payload = new RawToolPayload({ result: message }, context.theme);
|
|
279
|
+
payload.setExpanded(context.expanded);
|
|
280
|
+
context.rawPayloadsById.set(rawKey, payload);
|
|
281
|
+
}
|
|
282
|
+
const activeRaw = context.rawPayloadsById.get(rawKey);
|
|
283
|
+
if (!activeRaw) throw new Error("Raw tool payload was not created.");
|
|
284
|
+
context.rawPayloads.push(activeRaw);
|
|
285
|
+
if (showTechnicalDetails) addItem(context, activeRaw, true);
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
function addItem(
|
|
289
|
+
context: TranscriptRenderContext,
|
|
290
|
+
component: Component,
|
|
291
|
+
interactive = false,
|
|
292
|
+
): void {
|
|
293
|
+
context.items.push({ key: context.nextKey++, component, interactive });
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
interface ToolComponentOptions {
|
|
297
|
+
readonly name: string;
|
|
298
|
+
readonly id: string;
|
|
299
|
+
readonly args?: unknown;
|
|
300
|
+
readonly result?: AgentRunMessage;
|
|
301
|
+
readonly renderer?: AgentRunToolRenderer;
|
|
302
|
+
readonly tui: { requestRender: () => void };
|
|
303
|
+
readonly cwd: string;
|
|
304
|
+
readonly expanded: boolean;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
function toolResultPayload(message: AgentRunMessage): {
|
|
308
|
+
content: never[];
|
|
309
|
+
details: unknown;
|
|
310
|
+
isError: boolean;
|
|
311
|
+
} {
|
|
312
|
+
return {
|
|
313
|
+
content: Array.isArray(message.content) ? (message.content as never[]) : [],
|
|
314
|
+
details: message.details,
|
|
315
|
+
isError: message.isError === true,
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
function createToolComponent(options: ToolComponentOptions): ToolExecutionComponent {
|
|
320
|
+
const component = new ToolExecutionComponent(
|
|
321
|
+
options.name,
|
|
322
|
+
options.id,
|
|
323
|
+
options.args,
|
|
324
|
+
{ showImages: true },
|
|
325
|
+
options.renderer,
|
|
326
|
+
options.tui as never,
|
|
327
|
+
options.cwd,
|
|
328
|
+
);
|
|
329
|
+
component.setArgsComplete();
|
|
330
|
+
component.markExecutionStarted();
|
|
331
|
+
if (options.result) {
|
|
332
|
+
component.updateResult(toolResultPayload(options.result), false);
|
|
333
|
+
}
|
|
334
|
+
component.setExpanded(options.expanded);
|
|
335
|
+
return component;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
function isToolCall(
|
|
339
|
+
value: unknown,
|
|
340
|
+
): value is { type: "toolCall"; id: string; name: string; arguments: unknown } {
|
|
341
|
+
if (!value || typeof value !== "object") return false;
|
|
342
|
+
const candidate = value as Record<string, unknown>;
|
|
343
|
+
return (
|
|
344
|
+
candidate.type === "toolCall" &&
|
|
345
|
+
typeof candidate.id === "string" &&
|
|
346
|
+
typeof candidate.name === "string"
|
|
347
|
+
);
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
function textContent(content: unknown): string {
|
|
351
|
+
if (typeof content === "string") return content;
|
|
352
|
+
if (!Array.isArray(content)) return formatTranscriptValue(content);
|
|
353
|
+
return content
|
|
354
|
+
.map((part) => {
|
|
355
|
+
if (!part || typeof part !== "object") return "";
|
|
356
|
+
const item = part as Record<string, unknown>;
|
|
357
|
+
if (item.type === "text" && typeof item.text === "string") return item.text;
|
|
358
|
+
return item.type === "image" ? "" : formatTranscriptValue(item);
|
|
359
|
+
})
|
|
360
|
+
.filter(Boolean)
|
|
361
|
+
.join("\n");
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
function imageContent(content: unknown): Array<{ data: string; mimeType: string }> {
|
|
365
|
+
if (!Array.isArray(content)) return [];
|
|
366
|
+
return content.flatMap((part) => {
|
|
367
|
+
if (!part || typeof part !== "object") return [];
|
|
368
|
+
const item = part as Record<string, unknown>;
|
|
369
|
+
return item.type === "image" &&
|
|
370
|
+
typeof item.data === "string" &&
|
|
371
|
+
typeof item.mimeType === "string"
|
|
372
|
+
? [{ data: item.data, mimeType: item.mimeType }]
|
|
373
|
+
: [];
|
|
374
|
+
});
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
function formatMessage(message: AgentRunMessage): string {
|
|
378
|
+
const content = message.content;
|
|
379
|
+
return typeof content === "string" ? content : formatTranscriptValue(message);
|
|
380
|
+
}
|
|
@@ -121,7 +121,7 @@ Operation support is narrower than grammar support. AST import and export search
|
|
|
121
121
|
### Search and output limits
|
|
122
122
|
|
|
123
123
|
- An AST search has a 5,000 eligible-file limit and a 10-second deadline shared by file enumeration and analysis. These are not tool-call settings.
|
|
124
|
-
- Below directory roots, AST search excludes hidden entries, dependency/build/cache directories, symlinks, non-regular files, and files unsupported by the requested operation. It does **not** read `.gitignore`. Explicit roots are resolved and honored, including symlink roots. See the [scan policy](src/analysis/search/ast-scan.ts) for the exact directory list.
|
|
124
|
+
- Below directory roots, AST search excludes hidden entries, dependency/build/cache directories, symlinks, non-regular files, configured `code-intelligence.exclude` paths, and files unsupported by the requested operation. It does **not** read `.gitignore`. Explicit roots are resolved and honored, including excluded paths and symlink roots. See the [scan policy](src/analysis/search/ast-scan.ts) for the exact directory list.
|
|
125
125
|
- An exact file that does not support the requested AST operation is invalid. Results disclose policy exclusions, interrupted scans, provider limits, and omitted matches. No matches do not mean that unsupported files were searched.
|
|
126
126
|
- Tool text is truncated at Pi's default 2,000 lines or 50 KB. When this occurs, the full text is written to a temporary file and its path is returned. Result-list limits still apply to that full text.
|
|
127
127
|
|
|
@@ -148,7 +148,7 @@ Project values override global values, which override defaults. Project configur
|
|
|
148
148
|
|---|---|---|
|
|
149
149
|
| `code-intelligence.overviewEnabled` | `true` | Add the hidden overview; the choice is fixed for the session |
|
|
150
150
|
| `code-intelligence.instructionFileNames` | `["CLAUDE.md", "AGENTS.md"]` | Ordered plain filenames for directory instruction discovery |
|
|
151
|
-
| `
|
|
151
|
+
| `code-intelligence.exclude` | `[]` | Gitignore-style patterns for automatic LSP and broad AST work, not exact requests |
|
|
152
152
|
| `lsp.servers.<language>.enabled` | Enabled unless `false` | Disable a language server |
|
|
153
153
|
|
|
154
154
|
Example `.pi/supi/config.json`:
|
|
@@ -157,10 +157,10 @@ Example `.pi/supi/config.json`:
|
|
|
157
157
|
{
|
|
158
158
|
"code-intelligence": {
|
|
159
159
|
"overviewEnabled": false,
|
|
160
|
-
"instructionFileNames": ["AGENTS.md", "CLAUDE.md"]
|
|
160
|
+
"instructionFileNames": ["AGENTS.md", "CLAUDE.md"],
|
|
161
|
+
"exclude": ["generated/**"]
|
|
161
162
|
},
|
|
162
163
|
"lsp": {
|
|
163
|
-
"exclude": ["generated/**"],
|
|
164
164
|
"servers": {
|
|
165
165
|
"python": { "enabled": false }
|
|
166
166
|
}
|
|
@@ -168,13 +168,13 @@ Example `.pi/supi/config.json`:
|
|
|
168
168
|
}
|
|
169
169
|
```
|
|
170
170
|
|
|
171
|
-
Use `typescript`, `python`, `rust`, `go`, `c`, `ruby`, `java`, `kotlin`, `bash`, `html`, `sql`, or `r` for built-in server keys (`cpp` aliases `c`). Server command and routing overrides are defined in the [LSP configuration reference](../supi-lsp/README.md#custom-server-configuration). `.pi-lsp.json` is not read.
|
|
171
|
+
Use `typescript`, `python`, `rust`, `go`, `c`, `ruby`, `java`, `kotlin`, `bash`, `html`, `sql`, or `r` for built-in server keys (`cpp` aliases `c`). Server command and routing overrides are defined in the [LSP configuration reference](../supi-lsp/README.md#custom-server-configuration). `.pi-lsp.json` is not read. Only the boolean `true` enables the overview; non-boolean values do not enable it. The shared exclusion list uses gitignore syntax and project-over-global replacement. An explicit project `[]` clears configured patterns. `/supi-settings` shows the config path and says to reload or restart Pi after saving. Saved exclusions apply after reload or restart; exact file and explicitly selected directory requests remain available. An old `lsp.exclude` value reports a migration error and is not used.
|
|
172
172
|
|
|
173
173
|
Directory orientation checks the path from the workspace root to the focused directory. It selects the first valid configured instruction file per directory, skips files already loaded by Pi or shown on the active branch, and shows at most 200 lines per file. Resolved instruction paths must stay inside the workspace. These snippets are tool output, not additions to Pi's system prompt.
|
|
174
174
|
|
|
175
175
|
## Privacy and security
|
|
176
176
|
|
|
177
|
-
Pi extensions run with your system permissions; this package is not a sandbox. Language servers run as local processes and receive source files. Review server commands and project configuration before trusting a project. `
|
|
177
|
+
Pi extensions run with your system permissions; this package is not a sandbox. Language servers run as local processes and receive source files. Review server commands and project configuration before trusting a project. `code-intelligence.exclude` and AST scan exclusions are not access controls.
|
|
178
178
|
|
|
179
179
|
Tool results and the hidden overview enter Pi's model context and can be saved in session history. They can contain source text, paths, manifest data, diagnostics, and instruction-file contents. Truncated tool results and graph display overflow also leave full returned text in local temporary files. These files are not durable session storage and can be removed by system cleanup. “Hidden” means not displayed in the transcript, not hidden from the model.
|
|
180
180
|
|
|
@@ -14,7 +14,7 @@ export type {
|
|
|
14
14
|
StructuralProvider,
|
|
15
15
|
StructuralResult,
|
|
16
16
|
} from "./capability/types.ts";
|
|
17
|
-
export type { CodeQueryResult } from "./query-result.ts";
|
|
17
|
+
export type { CodeQueryPartialMetadata, CodeQueryResult } from "./query-result.ts";
|
|
18
18
|
// Shared query-result constructors and contract
|
|
19
19
|
export {
|
|
20
20
|
completedCodeQuery,
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/** Structured metadata for a partial query result. */
|
|
2
|
+
export interface CodeQueryPartialMetadata {
|
|
3
|
+
/** Automatic path-policy evidence removed from a collected result. */
|
|
4
|
+
readonly automaticPathExclusion?: {
|
|
5
|
+
readonly excludedCount: number;
|
|
6
|
+
readonly examples: readonly string[];
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
|
|
1
10
|
/**
|
|
2
11
|
* Result of a read-only code-provider query.
|
|
3
12
|
*
|
|
@@ -8,7 +17,12 @@
|
|
|
8
17
|
*/
|
|
9
18
|
export type CodeQueryResult<T> =
|
|
10
19
|
| { readonly kind: "completed"; readonly data: T }
|
|
11
|
-
| {
|
|
20
|
+
| {
|
|
21
|
+
readonly kind: "partial";
|
|
22
|
+
readonly data: T;
|
|
23
|
+
readonly reason: string;
|
|
24
|
+
readonly metadata?: CodeQueryPartialMetadata;
|
|
25
|
+
}
|
|
12
26
|
| { readonly kind: "unavailable"; readonly reason: string };
|
|
13
27
|
|
|
14
28
|
/** Construct a successfully completed code-query result, including empty data. */
|
|
@@ -17,8 +31,12 @@ export function completedCodeQuery<T>(data: T): CodeQueryResult<T> {
|
|
|
17
31
|
}
|
|
18
32
|
|
|
19
33
|
/** Construct a usable but incomplete code-query result. */
|
|
20
|
-
export function partialCodeQuery<T>(
|
|
21
|
-
|
|
34
|
+
export function partialCodeQuery<T>(
|
|
35
|
+
data: T,
|
|
36
|
+
reason: string,
|
|
37
|
+
metadata?: CodeQueryPartialMetadata,
|
|
38
|
+
): CodeQueryResult<T> {
|
|
39
|
+
return { kind: "partial", data, reason, ...(metadata ? { metadata } : {}) };
|
|
22
40
|
}
|
|
23
41
|
|
|
24
42
|
/** Construct a code-query result that could not be established. */
|
|
@@ -35,7 +53,7 @@ export function mapCodeQueryResult<T, U>(
|
|
|
35
53
|
case "completed":
|
|
36
54
|
return completedCodeQuery(map(result.data));
|
|
37
55
|
case "partial":
|
|
38
|
-
return partialCodeQuery(map(result.data), result.reason);
|
|
56
|
+
return partialCodeQuery(map(result.data), result.reason, result.metadata);
|
|
39
57
|
case "unavailable":
|
|
40
58
|
return unavailableCodeQuery(result.reason);
|
|
41
59
|
}
|
|
@@ -70,6 +70,116 @@ export interface SupiConfigOptions {
|
|
|
70
70
|
homeDir?: string;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
+
/** Options for loading automatic code-intelligence exclusions. */
|
|
74
|
+
export interface AutomaticExclusionOptions extends SupiConfigOptions {
|
|
75
|
+
/** Whether the project config is trusted and can apply. Defaults to true. */
|
|
76
|
+
projectTrusted?: boolean;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Load the one configured exclusion list shared by automatic LSP work and
|
|
81
|
+
* broad AST searches.
|
|
82
|
+
*
|
|
83
|
+
* Project values replace global values. An explicit empty project list clears
|
|
84
|
+
* the global list. The old `lsp.exclude` key is rejected in every applicable
|
|
85
|
+
* scope so automatic work cannot start without its former protection.
|
|
86
|
+
*/
|
|
87
|
+
export function loadAutomaticExclusionPatterns(
|
|
88
|
+
cwd: string,
|
|
89
|
+
options: AutomaticExclusionOptions = {},
|
|
90
|
+
): readonly string[] {
|
|
91
|
+
const projectTrusted = options.projectTrusted !== false;
|
|
92
|
+
const globalCodeIntelligence = loadSupiConfigSectionForScope("code-intelligence", cwd, {
|
|
93
|
+
scope: "global",
|
|
94
|
+
homeDir: options.homeDir,
|
|
95
|
+
});
|
|
96
|
+
const projectCodeIntelligence = projectTrusted
|
|
97
|
+
? loadSupiConfigSectionForScope("code-intelligence", cwd, { scope: "project" })
|
|
98
|
+
: null;
|
|
99
|
+
const globalLsp = loadSupiConfigSectionForScope("lsp", cwd, {
|
|
100
|
+
scope: "global",
|
|
101
|
+
homeDir: options.homeDir,
|
|
102
|
+
});
|
|
103
|
+
const projectLsp = projectTrusted
|
|
104
|
+
? loadSupiConfigSectionForScope("lsp", cwd, { scope: "project" })
|
|
105
|
+
: null;
|
|
106
|
+
|
|
107
|
+
const legacyPath = findLegacyExclusionPath(cwd, options, globalLsp, projectLsp);
|
|
108
|
+
if (legacyPath) {
|
|
109
|
+
throw new Error(
|
|
110
|
+
`Unsupported ${legacyPath.scope} configuration at ${legacyPath.path}: "lsp.exclude" was removed. Move its value to "code-intelligence.exclude". Automatic LSP and broad AST work did not start; reload after migration.`,
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
const source = findExclusionSource(cwd, options, {
|
|
115
|
+
projectTrusted,
|
|
116
|
+
globalCodeIntelligence,
|
|
117
|
+
projectCodeIntelligence,
|
|
118
|
+
});
|
|
119
|
+
return validateExclusionSource(source);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
interface ExclusionSource {
|
|
123
|
+
value: unknown;
|
|
124
|
+
path: string;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
interface LegacyExclusionPath {
|
|
128
|
+
scope: "global" | "project";
|
|
129
|
+
path: string;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
function findLegacyExclusionPath(
|
|
133
|
+
cwd: string,
|
|
134
|
+
options: AutomaticExclusionOptions,
|
|
135
|
+
globalLsp: Record<string, unknown> | null,
|
|
136
|
+
projectLsp: Record<string, unknown> | null,
|
|
137
|
+
): LegacyExclusionPath | null {
|
|
138
|
+
if (globalLsp && Object.hasOwn(globalLsp, "exclude")) {
|
|
139
|
+
return { scope: "global", path: getSupiConfigPath("global", cwd, options) };
|
|
140
|
+
}
|
|
141
|
+
if (projectLsp && Object.hasOwn(projectLsp, "exclude")) {
|
|
142
|
+
return { scope: "project", path: getSupiConfigPath("project", cwd) };
|
|
143
|
+
}
|
|
144
|
+
return null;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
function findExclusionSource(
|
|
148
|
+
cwd: string,
|
|
149
|
+
options: AutomaticExclusionOptions,
|
|
150
|
+
sections: {
|
|
151
|
+
projectTrusted: boolean;
|
|
152
|
+
globalCodeIntelligence: Record<string, unknown> | null;
|
|
153
|
+
projectCodeIntelligence: Record<string, unknown> | null;
|
|
154
|
+
},
|
|
155
|
+
): ExclusionSource | null {
|
|
156
|
+
const { projectTrusted, globalCodeIntelligence, projectCodeIntelligence } = sections;
|
|
157
|
+
if (
|
|
158
|
+
projectTrusted &&
|
|
159
|
+
projectCodeIntelligence &&
|
|
160
|
+
Object.hasOwn(projectCodeIntelligence, "exclude")
|
|
161
|
+
) {
|
|
162
|
+
return { value: projectCodeIntelligence.exclude, path: getSupiConfigPath("project", cwd) };
|
|
163
|
+
}
|
|
164
|
+
if (globalCodeIntelligence && Object.hasOwn(globalCodeIntelligence, "exclude")) {
|
|
165
|
+
return {
|
|
166
|
+
value: globalCodeIntelligence.exclude,
|
|
167
|
+
path: getSupiConfigPath("global", cwd, options),
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
return null;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
function validateExclusionSource(source: ExclusionSource | null): readonly string[] {
|
|
174
|
+
if (!source) return Object.freeze([]);
|
|
175
|
+
if (!Array.isArray(source.value) || !source.value.every((entry) => typeof entry === "string")) {
|
|
176
|
+
throw new Error(
|
|
177
|
+
`Invalid "code-intelligence.exclude" in ${source.path}: expected an array of gitignore-style strings. Automatic LSP and broad AST work did not start.`,
|
|
178
|
+
);
|
|
179
|
+
}
|
|
180
|
+
return Object.freeze([...source.value]);
|
|
181
|
+
}
|
|
182
|
+
|
|
73
183
|
/**
|
|
74
184
|
* Load and merge config for a given extension section.
|
|
75
185
|
*
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
// supi-core config domain — config loading.
|
|
2
|
-
export type {
|
|
2
|
+
export type {
|
|
3
|
+
AutomaticExclusionOptions,
|
|
4
|
+
SupiConfigLocation,
|
|
5
|
+
SupiConfigOptions,
|
|
6
|
+
} from "./config/config.ts";
|
|
3
7
|
export {
|
|
4
8
|
getSupiConfigPath,
|
|
9
|
+
loadAutomaticExclusionPatterns,
|
|
5
10
|
loadSupiConfig,
|
|
6
11
|
loadSupiConfigForScope,
|
|
7
12
|
loadSupiConfigSectionForScope,
|
|
@@ -151,6 +151,7 @@ export interface CustomField extends BaseField {
|
|
|
151
151
|
cwd: string,
|
|
152
152
|
action: SettingsAction,
|
|
153
153
|
helpers: ConfigHelpers,
|
|
154
|
+
ctx?: ExtensionContext,
|
|
154
155
|
) => void | Promise<void>;
|
|
155
156
|
}
|
|
156
157
|
|
|
@@ -404,7 +405,7 @@ async function applyConfigAction(
|
|
|
404
405
|
const helpers = createConfigHelpers(options.section, scope, cwd, options.homeDir);
|
|
405
406
|
let storedValue: unknown;
|
|
406
407
|
if (field.kind === "custom") {
|
|
407
|
-
await field.persist(scope, cwd, action, helpers);
|
|
408
|
+
await field.persist(scope, cwd, action, helpers, ctx);
|
|
408
409
|
storedValue = action.kind === "set" ? action.value : undefined;
|
|
409
410
|
} else if (action.kind === "set") {
|
|
410
411
|
storedValue = parseTypedValue(action.value, field);
|