@mrclrchtr/supi-review 11.2.0 → 11.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/README.md +2 -0
- 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/child-web-tools.ts +110 -0
- package/node_modules/@mrclrchtr/supi-agent-runtime/node_modules/@mrclrchtr/supi-core/src/session.ts +11 -0
- package/node_modules/@mrclrchtr/supi-agent-runtime/package.json +2 -2
- package/node_modules/@mrclrchtr/supi-agent-runtime/src/run.ts +2 -0
- package/node_modules/@mrclrchtr/supi-agent-runtime/src/usage.ts +15 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/CHANGELOG.md +19 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/README.md +16 -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/capability/types.ts +3 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-code-runtime/src/query-result.ts +9 -0
- 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/child-web-tools.ts +110 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-core/src/session.ts +11 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/README.md +39 -2
- 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/capability/types.ts +3 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/query-result.ts +9 -0
- 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/child-web-tools.ts +110 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/session.ts +11 -0
- 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/client/client-diagnostic-collection.ts +11 -4
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostics.ts +77 -6
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/client/client-input-admission.ts +149 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/client/client-typescript-project.ts +40 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/client/client.ts +151 -44
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/diagnostics/evidence.ts +2 -2
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-workspace-symbol.ts +157 -23
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/manager/manager.ts +254 -56
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-registry.ts +19 -2
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-rename.ts +1 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/session/workspace-lsp-runtime.ts +5 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/README.md +2 -2
- 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/capability/types.ts +3 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/query-result.ts +9 -0
- 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/child-web-tools.ts +110 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/session.ts +11 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/package.json +3 -3
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/tsx/tree-sitter-tsx.wasm +0 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/tsx/tree-sitter-tsx.wasm.json +5 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/typescript/tree-sitter-typescript.wasm +0 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/typescript/tree-sitter-typescript.wasm.json +5 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/call-sites.ts +40 -25
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/callees.ts +2 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/src/worker/call-context.ts +44 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/package.json +6 -5
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/analysis/health/server-status.ts +6 -2
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/analysis/search/exclusions.ts +47 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/analysis/search/paths.ts +32 -9
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/analysis/target/anchored-structural.ts +3 -8
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/analysis/target/anchored.ts +4 -20
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/analysis/target/identity.ts +1 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/analysis/target/latex-label-container.ts +6 -6
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/analysis/target/latex-section-anchor.ts +6 -6
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/analysis/target/resolution.ts +18 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/analysis/target/symbol.ts +39 -11
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/analysis/target/types.ts +6 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/extension.ts +17 -11
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/session/graph/collect.ts +1 -10
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/session/graph-types.ts +2 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/session/graph-workflow.ts +1 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/session/inspect/collect.ts +8 -2
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/session/inspect/file-point.ts +2 -3
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/session/inspect-workflow.ts +1 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/session/orientation/collect.ts +54 -16
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/session/orientation/context-sections.ts +2 -3
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/session/orientation/facts.ts +9 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/session/orientation-types.ts +3 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/session/orientation-workflow.ts +18 -5
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/session/refactor-identity.ts +76 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/session/refactor-workflow.ts +11 -14
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/session/target-store.ts +3 -18
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/session/target-workflow.ts +33 -16
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/substrate/lsp/recovery.ts +5 -5
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_find/render.ts +8 -4
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_find/result.ts +78 -6
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_find/spec.ts +4 -3
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_find/structured.ts +25 -9
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_graph/details.ts +1 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_graph/display.ts +1 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_graph/guidance.ts +1 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_graph/markdown.ts +11 -6
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_graph/read-next.ts +38 -9
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_graph/reference-selection.ts +30 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_graph/result.ts +25 -118
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_graph/section.ts +133 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_graph/spec.ts +3 -3
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_graph/structured.ts +17 -6
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_health/display-paths.ts +92 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_health/file-scope-markdown.ts +3 -2
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_health/result.ts +4 -2
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_health/spec.ts +3 -3
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_health/structured-schema.ts +44 -44
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_inspect/spec.ts +5 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_inspect/structured.ts +1 -2
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_orientation/execute.ts +1 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_orientation/result.ts +22 -5
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_orientation/structured-schema.ts +46 -36
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_orientation/structured-workspace.ts +2 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_orientation/structured.ts +6 -12
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_orientation/workspace-format.ts +2 -5
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_orientation/workspace-sections.ts +3 -2
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_refactor_apply/result.ts +1 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_refactor_plan/result.ts +2 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_refactor_plan/structured.ts +2 -3
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_resolve/markdown.ts +6 -30
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_resolve/result.ts +24 -11
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_resolve/structured.ts +7 -9
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/result/refactor.ts +8 -5
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/result/structured.ts +8 -5
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/result/types.ts +18 -14
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/schemas.ts +5 -5
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/ui/status-command.ts +37 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/ui/status-overlay.ts +70 -51
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/ui/status-presentation.ts +108 -0
- package/node_modules/@mrclrchtr/supi-core/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-core/src/child-web-tools.ts +110 -0
- package/node_modules/@mrclrchtr/supi-core/src/session.ts +11 -0
- package/package.json +5 -4
- package/src/config.ts +11 -0
- package/src/tool/review_run/child-resources.ts +18 -10
- package/src/tool/review_run/child-session.ts +4 -0
- package/src/tool/review_run/execute.ts +4 -0
- package/src/tool/review_run/execution.ts +3 -0
- package/src/tool/review_run/planner.ts +11 -2
- package/src/tool/review_run/register.ts +1 -1
- package/src/tool/review_run/runner.ts +18 -5
- package/src/tool/review_run/schemas.ts +8 -5
- package/src/tool/review_run/system-prompt.ts +7 -1
- package/src/tool/review_run/workflow.ts +7 -0
- package/src/tui/review-command.ts +8 -0
- package/src/types.ts +5 -0
- package/src/web-access.ts +15 -0
|
@@ -3,8 +3,17 @@ export interface CodeQueryPartialMetadata {
|
|
|
3
3
|
/** Automatic path-policy evidence removed from a collected result. */
|
|
4
4
|
readonly automaticPathExclusion?: {
|
|
5
5
|
readonly excludedCount: number;
|
|
6
|
+
/** Observed policy paths, not canonical navigation paths; retain aliases when presenting exclusions. */
|
|
6
7
|
readonly examples: readonly string[];
|
|
7
8
|
};
|
|
9
|
+
/**
|
|
10
|
+
* True when automatic path-policy exclusions are the only reason the result
|
|
11
|
+
* is partial: every contributing provider branch completed and no coverage
|
|
12
|
+
* gap was observed. Excluded rows matched paths the workspace policy treats
|
|
13
|
+
* as out of automatic scope, so the retained rows are the complete in-policy
|
|
14
|
+
* answer.
|
|
15
|
+
*/
|
|
16
|
+
readonly exclusionOnly?: boolean;
|
|
8
17
|
}
|
|
9
18
|
|
|
10
19
|
/**
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
// Session-provided Web tools for SuPi child sessions (Agent Runs and Reviewer Sessions).
|
|
2
|
+
//
|
|
3
|
+
// The loaded supi-web extension answers a synchronous request on the parent event bus.
|
|
4
|
+
// Consumers never depend on supi-web; when it is absent or provides no tools, the
|
|
5
|
+
// request returns undefined and the child simply lacks Web tools.
|
|
6
|
+
|
|
7
|
+
import type { ExtensionAPI, ExtensionFactory } from "@earendil-works/pi-coding-agent";
|
|
8
|
+
|
|
9
|
+
/** Web tools that child sessions may receive when the containing session provides them. */
|
|
10
|
+
export const CHILD_WEB_TOOL_NAMES = [
|
|
11
|
+
"web_fetch_md",
|
|
12
|
+
"web_search",
|
|
13
|
+
"web_docs_search",
|
|
14
|
+
"web_docs_fetch",
|
|
15
|
+
] as const;
|
|
16
|
+
|
|
17
|
+
/** One session-provided Web tool name. */
|
|
18
|
+
export type ChildWebToolName = (typeof CHILD_WEB_TOOL_NAMES)[number];
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Web tools currently callable in the containing session plus a child-only extension
|
|
22
|
+
* factory that registers them. The factory must not capture the parent session; it may
|
|
23
|
+
* capture plain data such as the containing session's configuration directory.
|
|
24
|
+
*/
|
|
25
|
+
export interface ChildWebToolProvision {
|
|
26
|
+
readonly toolNames: readonly ChildWebToolName[];
|
|
27
|
+
/** Register the requested subset of `toolNames` in a child session. */
|
|
28
|
+
readonly createFactory: (toolNames: readonly ChildWebToolName[]) => ExtensionFactory;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** Plain containing-session data supplied with a child Web tool request. */
|
|
32
|
+
export interface ChildWebToolsRequestContext {
|
|
33
|
+
/**
|
|
34
|
+
* Working directory whose SuPi configuration governs Web settings such as Firecrawl.
|
|
35
|
+
* Children with a different cwd (for example a frozen Review Workspace) keep this policy.
|
|
36
|
+
*/
|
|
37
|
+
readonly configCwd: string;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
type EventBusLike = Pick<ExtensionAPI["events"], "on" | "emit">;
|
|
41
|
+
|
|
42
|
+
const REQUEST_CHANNEL = "supi:child-web-tools:request";
|
|
43
|
+
const RESPONSE_CHANNEL = "supi:child-web-tools:response";
|
|
44
|
+
|
|
45
|
+
interface ChildWebToolsRequest extends ChildWebToolsRequestContext {
|
|
46
|
+
readonly requestId: string;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
interface ChildWebToolsResponse {
|
|
50
|
+
readonly requestId: string;
|
|
51
|
+
readonly provision: ChildWebToolProvision;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
let nextRequestId = 0;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Answer child Web tool requests on the parent event bus. The callback must be synchronous
|
|
58
|
+
* because Pi's event bus does not await listeners. Returns an unsubscribe function.
|
|
59
|
+
*/
|
|
60
|
+
export function provideChildWebTools(
|
|
61
|
+
events: EventBusLike,
|
|
62
|
+
resolve: (context: ChildWebToolsRequestContext) => ChildWebToolProvision | undefined,
|
|
63
|
+
): () => void {
|
|
64
|
+
return events.on(REQUEST_CHANNEL, (data) => {
|
|
65
|
+
const request = data as Partial<ChildWebToolsRequest> | undefined;
|
|
66
|
+
if (typeof request?.requestId !== "string" || typeof request.configCwd !== "string") return;
|
|
67
|
+
const { requestId, configCwd } = request;
|
|
68
|
+
const provision = resolve({ configCwd });
|
|
69
|
+
if (!provision || provision.toolNames.length === 0) return;
|
|
70
|
+
events.emit(RESPONSE_CHANNEL, { requestId, provision } satisfies ChildWebToolsResponse);
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** Capture the Web tools the containing session currently provides, if any. */
|
|
75
|
+
export function requestChildWebTools(
|
|
76
|
+
events: EventBusLike,
|
|
77
|
+
context: ChildWebToolsRequestContext,
|
|
78
|
+
): ChildWebToolProvision | undefined {
|
|
79
|
+
const requestId = `child-web-${process.pid}-${++nextRequestId}`;
|
|
80
|
+
let provision: ChildWebToolProvision | undefined;
|
|
81
|
+
const unsubscribe = events.on(RESPONSE_CHANNEL, (data) => {
|
|
82
|
+
const response = data as Partial<ChildWebToolsResponse> | undefined;
|
|
83
|
+
if (response?.requestId === requestId && response.provision) provision = response.provision;
|
|
84
|
+
});
|
|
85
|
+
try {
|
|
86
|
+
events.emit(REQUEST_CHANNEL, { requestId, ...context } satisfies ChildWebToolsRequest);
|
|
87
|
+
} finally {
|
|
88
|
+
unsubscribe();
|
|
89
|
+
}
|
|
90
|
+
return provision;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Return the Web tools callable in a session under Pi's exposure rules: active `direct`
|
|
95
|
+
* tools, plus registered `codemode` and `deferred` tools. `model-only` and `hidden`
|
|
96
|
+
* tools are not callable.
|
|
97
|
+
*/
|
|
98
|
+
export function callableChildWebToolNames(
|
|
99
|
+
pi: Pick<ExtensionAPI, "getAllTools" | "getActiveTools">,
|
|
100
|
+
): ChildWebToolName[] {
|
|
101
|
+
const active = new Set(pi.getActiveTools());
|
|
102
|
+
const exposures = new Map(
|
|
103
|
+
pi.getAllTools().map((tool) => [tool.name, tool.exposure ?? "direct"] as const),
|
|
104
|
+
);
|
|
105
|
+
return CHILD_WEB_TOOL_NAMES.filter((name) => {
|
|
106
|
+
const exposure = exposures.get(name);
|
|
107
|
+
if (exposure === "direct") return active.has(name);
|
|
108
|
+
return exposure === "codemode" || exposure === "deferred";
|
|
109
|
+
});
|
|
110
|
+
}
|
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
// supi-core session domain — session utilities and registries.
|
|
2
2
|
|
|
3
|
+
export type {
|
|
4
|
+
ChildWebToolName,
|
|
5
|
+
ChildWebToolProvision,
|
|
6
|
+
ChildWebToolsRequestContext,
|
|
7
|
+
} from "./child-web-tools.ts";
|
|
8
|
+
export {
|
|
9
|
+
CHILD_WEB_TOOL_NAMES,
|
|
10
|
+
callableChildWebToolNames,
|
|
11
|
+
provideChildWebTools,
|
|
12
|
+
requestChildWebTools,
|
|
13
|
+
} from "./child-web-tools.ts";
|
|
3
14
|
export { createRegistry, createSessionStateRegistry } from "./registry-utils.ts";
|
|
4
15
|
export type {
|
|
5
16
|
SessionCapabilitySkill,
|
package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mrclrchtr/supi-lsp",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.3.0",
|
|
4
4
|
"description": "Language Server Protocol runtime for SuPi code intelligence",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
"vscode-jsonrpc": "^10.0.0",
|
|
39
39
|
"vscode-languageserver-protocol": "^3.18.5",
|
|
40
40
|
"vscode-languageserver-types": "^3.18.5",
|
|
41
|
-
"@mrclrchtr/supi-code-runtime": "11.
|
|
42
|
-
"@mrclrchtr/supi-core": "11.
|
|
41
|
+
"@mrclrchtr/supi-code-runtime": "11.3.0",
|
|
42
|
+
"@mrclrchtr/supi-core": "11.3.0"
|
|
43
43
|
},
|
|
44
44
|
"bundledDependencies": [
|
|
45
45
|
"@mrclrchtr/supi-code-runtime",
|
|
@@ -95,10 +95,17 @@ async function collectPushOnlyEvidence(
|
|
|
95
95
|
? partialCodeQuery(diagnostics, TENTATIVE_PUSH_UNAVAILABLE_REASON)
|
|
96
96
|
: unavailableCodeQuery(TENTATIVE_PUSH_UNAVAILABLE_REASON);
|
|
97
97
|
}
|
|
98
|
-
|
|
99
|
-
options.cachedDiagnostics,
|
|
100
|
-
|
|
101
|
-
|
|
98
|
+
if (push === "released") {
|
|
99
|
+
return incompleteDiagnosticResult(options.cachedDiagnostics, "released");
|
|
100
|
+
}
|
|
101
|
+
return options.cachedDiagnostics
|
|
102
|
+
? partialCodeQuery(
|
|
103
|
+
options.cachedDiagnostics,
|
|
104
|
+
`${TENTATIVE_PUSH_UNAVAILABLE_REASON} Retained cached diagnostics are partial evidence.`,
|
|
105
|
+
)
|
|
106
|
+
: unavailableCodeQuery(
|
|
107
|
+
`${TENTATIVE_PUSH_UNAVAILABLE_REASON} No current publication was observed.`,
|
|
108
|
+
);
|
|
102
109
|
}
|
|
103
110
|
|
|
104
111
|
/** Collect one request report without using an ambient push as confirmation. */
|
|
@@ -47,6 +47,7 @@ import {
|
|
|
47
47
|
} from "./client-document-state.ts";
|
|
48
48
|
import { clearTrackedDocumentState, synchronizeTrackedDocument } from "./client-document-sync.ts";
|
|
49
49
|
import { getDiagnosticFileState } from "./client-file-state.ts";
|
|
50
|
+
import { SemanticInputAdmission } from "./client-input-admission.ts";
|
|
50
51
|
import { SemanticInputRequestRetryGuard } from "./client-request-enrollment.ts";
|
|
51
52
|
import {
|
|
52
53
|
SemanticInputBarrier,
|
|
@@ -103,6 +104,7 @@ export class ClientDiagnostics {
|
|
|
103
104
|
/** URIs closed by a lifecycle operation: versioned pushes stay fail-closed. */
|
|
104
105
|
readonly #closedVersionedBarrier = new Set<string>();
|
|
105
106
|
readonly #inputBarrier: SemanticInputBarrier;
|
|
107
|
+
#inputAdmission = new SemanticInputAdmission();
|
|
106
108
|
#evidenceRevision = 0;
|
|
107
109
|
#nextSynchronizationId = 0;
|
|
108
110
|
/** One active server refresh plus one coalesced newer demand generation. */
|
|
@@ -125,6 +127,60 @@ export class ClientDiagnostics {
|
|
|
125
127
|
});
|
|
126
128
|
}
|
|
127
129
|
|
|
130
|
+
/** Keep first enrollment outside a semantic query or refactor-planning attempt. */
|
|
131
|
+
withSemanticRequest<T>(
|
|
132
|
+
run: () => Promise<T>,
|
|
133
|
+
control?: CodeRequestControl,
|
|
134
|
+
uri?: string,
|
|
135
|
+
): Promise<T> {
|
|
136
|
+
return this.#inputAdmission.request(run, control, uri);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/** Read content only after admission; tracked-document changes never wait. */
|
|
140
|
+
async openDocument(
|
|
141
|
+
filePath: string,
|
|
142
|
+
readContent: () => string,
|
|
143
|
+
control?: CodeRequestControl,
|
|
144
|
+
protectInputs = false,
|
|
145
|
+
): Promise<void> {
|
|
146
|
+
throwIfCodeRequestInterrupted(control);
|
|
147
|
+
const open = () => {
|
|
148
|
+
throwIfCodeRequestInterrupted(control);
|
|
149
|
+
if (!this.host.isOperational()) throw new Error("LSP client is not running.");
|
|
150
|
+
this.didOpen(filePath, readContent());
|
|
151
|
+
};
|
|
152
|
+
if (this.#openDocs.has(fileToUri(filePath))) {
|
|
153
|
+
open();
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
await this.#inputAdmission.enroll(fileToUri(filePath), open, control, protectInputs);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/** Restore only still-retained documents; a close or replacement wins over recovery. */
|
|
160
|
+
async restoreDocument(
|
|
161
|
+
filePath: string,
|
|
162
|
+
readContent: () => string,
|
|
163
|
+
isCurrent: () => boolean,
|
|
164
|
+
): Promise<void> {
|
|
165
|
+
const uri = fileToUri(filePath);
|
|
166
|
+
const admission = this.#inputAdmission;
|
|
167
|
+
const canRestore = () =>
|
|
168
|
+
isCurrent() &&
|
|
169
|
+
this.host.isOperational() &&
|
|
170
|
+
admission === this.#inputAdmission &&
|
|
171
|
+
!this.#closedVersionedBarrier.has(uri) &&
|
|
172
|
+
!this.#openDocs.has(uri);
|
|
173
|
+
if (!canRestore()) return;
|
|
174
|
+
try {
|
|
175
|
+
await this.openDocument(filePath, () => {
|
|
176
|
+
if (!canRestore()) throw new Error("Document restoration was superseded.");
|
|
177
|
+
return readContent();
|
|
178
|
+
});
|
|
179
|
+
} catch {
|
|
180
|
+
if (canRestore()) this.markFailedFile(filePath);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
128
184
|
/** Synchronize all open document inputs, rejoining once after a new enrollment. */
|
|
129
185
|
async synchronizeSemanticInputs(
|
|
130
186
|
control?: CodeRequestControl,
|
|
@@ -222,17 +278,22 @@ export class ClientDiagnostics {
|
|
|
222
278
|
this.#inputBarrier.forgetDocumentContent(uri);
|
|
223
279
|
}
|
|
224
280
|
|
|
225
|
-
#ensureExplicitDocumentContent(
|
|
281
|
+
async #ensureExplicitDocumentContent(
|
|
226
282
|
filePath: string,
|
|
227
283
|
content: string,
|
|
228
284
|
contentIsAuthoritative: boolean,
|
|
229
|
-
|
|
285
|
+
control?: CodeRequestControl,
|
|
286
|
+
): Promise<void> {
|
|
230
287
|
const uri = fileToUri(filePath);
|
|
231
288
|
const document = this.#openDocs.get(uri);
|
|
232
289
|
if (!document) {
|
|
233
|
-
//
|
|
234
|
-
//
|
|
235
|
-
this.
|
|
290
|
+
// A manager read can predate admission. Re-read disk after the wait;
|
|
291
|
+
// explicit authoritative content retains its existing override semantics.
|
|
292
|
+
await this.openDocument(
|
|
293
|
+
filePath,
|
|
294
|
+
() => (contentIsAuthoritative ? content : readFileSync(filePath, "utf-8")),
|
|
295
|
+
control,
|
|
296
|
+
);
|
|
236
297
|
return;
|
|
237
298
|
}
|
|
238
299
|
// Manager reads are not authoritative: an already tracked document can
|
|
@@ -260,6 +321,8 @@ export class ClientDiagnostics {
|
|
|
260
321
|
}
|
|
261
322
|
|
|
262
323
|
clear(options: { preserveFailedDocuments?: boolean } = {}): void {
|
|
324
|
+
this.#inputAdmission.dispose();
|
|
325
|
+
this.#inputAdmission = new SemanticInputAdmission();
|
|
263
326
|
if (options.preserveFailedDocuments) {
|
|
264
327
|
for (const uri of [...this.#openDocs.keys(), ...this.#diagnosticStore.keys()]) {
|
|
265
328
|
this.#failedUris.add(uri);
|
|
@@ -336,6 +399,7 @@ export class ClientDiagnostics {
|
|
|
336
399
|
|
|
337
400
|
/** Send a save after a disk change that the input barrier observed. */
|
|
338
401
|
#noteExternalDiskChange(filePath: string, content: string): void {
|
|
402
|
+
this.#inputAdmission.invalidateRequests();
|
|
339
403
|
if (!this.host.isOperational()) return;
|
|
340
404
|
const documentSync = this.host.documentSync();
|
|
341
405
|
if (!documentSync.save) return;
|
|
@@ -368,6 +432,7 @@ export class ClientDiagnostics {
|
|
|
368
432
|
|
|
369
433
|
didClose(filePath: string): void {
|
|
370
434
|
const uri = fileToUri(filePath);
|
|
435
|
+
this.#inputAdmission.close(uri);
|
|
371
436
|
const wasOpen = this.#openDocs.has(uri);
|
|
372
437
|
const hadState =
|
|
373
438
|
wasOpen ||
|
|
@@ -627,7 +692,12 @@ export class ClientDiagnostics {
|
|
|
627
692
|
throwIfCodeRequestInterrupted(control);
|
|
628
693
|
const uri = fileToUri(filePath);
|
|
629
694
|
const contentIsAuthoritative = options.contentIsAuthoritative !== false;
|
|
630
|
-
|
|
695
|
+
try {
|
|
696
|
+
await this.#ensureExplicitDocumentContent(filePath, content, contentIsAuthoritative, control);
|
|
697
|
+
} catch (error) {
|
|
698
|
+
throwIfCodeRequestInterrupted(control);
|
|
699
|
+
return unavailableAfterEnrollmentRetry(error);
|
|
700
|
+
}
|
|
631
701
|
const contentOverrides = this.#getDiagnosticContentOverrides(
|
|
632
702
|
uri,
|
|
633
703
|
content,
|
|
@@ -1044,6 +1114,7 @@ export class ClientDiagnostics {
|
|
|
1044
1114
|
changeKind: SemanticInputChangeKind = "content",
|
|
1045
1115
|
): void {
|
|
1046
1116
|
this.#inputBarrier.noteInputChange(changeKind);
|
|
1117
|
+
if (changeKind !== "enrollment") this.#inputAdmission.invalidateRequests();
|
|
1047
1118
|
if (invalidateEvidence) this.#advanceEvidenceRevision(false);
|
|
1048
1119
|
if (cancelRequests) this.#cancelAllDiagnosticRequests();
|
|
1049
1120
|
}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type CodeRequestControl,
|
|
3
|
+
CodeRequestDeadlineError,
|
|
4
|
+
throwIfCodeRequestInterrupted,
|
|
5
|
+
} from "@mrclrchtr/supi-code-runtime/api";
|
|
6
|
+
|
|
7
|
+
const MAX_PENDING_INPUT_OPERATIONS = 32;
|
|
8
|
+
|
|
9
|
+
type InputOperationKind = "request" | "enrollment" | "request-enrollment";
|
|
10
|
+
|
|
11
|
+
interface PendingInputOperation {
|
|
12
|
+
readonly uri: string | undefined;
|
|
13
|
+
readonly kind: InputOperationKind;
|
|
14
|
+
start(): void;
|
|
15
|
+
cancel(reason: unknown): void;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Admit first opens between semantic query and refactor-planning attempts on one client.
|
|
20
|
+
* Consecutive readers run concurrently; FIFO admission prevents either new
|
|
21
|
+
* readers or enrollments from overtaking a waiting operation. This is not
|
|
22
|
+
* diagnostic transport ownership: an interrupted semantic attempt can release
|
|
23
|
+
* its admission even when the server has not yet acknowledged cancellation.
|
|
24
|
+
*/
|
|
25
|
+
export class SemanticInputAdmission {
|
|
26
|
+
readonly #pending: PendingInputOperation[] = [];
|
|
27
|
+
#readers = 0;
|
|
28
|
+
#enrolling = false;
|
|
29
|
+
#disposed = false;
|
|
30
|
+
|
|
31
|
+
/** Cover one attempt's synchronization, RPCs and acceptance, never its retry. */
|
|
32
|
+
request<T>(run: () => Promise<T>, control?: CodeRequestControl, uri?: string): Promise<T> {
|
|
33
|
+
return this.#run("request", uri, run, control);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Commit a first open after earlier attempts leave. Demand with original
|
|
38
|
+
* semantic/refactor parameters opts into input invalidation while waiting.
|
|
39
|
+
*/
|
|
40
|
+
enroll(
|
|
41
|
+
uri: string,
|
|
42
|
+
run: () => void,
|
|
43
|
+
control?: CodeRequestControl,
|
|
44
|
+
protectInputs = false,
|
|
45
|
+
): Promise<void> {
|
|
46
|
+
return this.#run(protectInputs ? "request-enrollment" : "enrollment", uri, run, control);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** A close cancels queued opens and queries for that document, before dispatch. */
|
|
50
|
+
close(uri: string): void {
|
|
51
|
+
const cancelled = this.#pending.filter((pending) => pending.uri === uri);
|
|
52
|
+
for (const pending of cancelled) this.#pending.splice(this.#pending.indexOf(pending), 1);
|
|
53
|
+
for (const pending of cancelled)
|
|
54
|
+
pending.cancel(new Error("Document closed before input admission."));
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** Discard queued request parameters after a known non-enrollment input change. */
|
|
58
|
+
invalidateRequests(): void {
|
|
59
|
+
const cancelled = this.#pending.filter((pending) => pending.kind !== "enrollment");
|
|
60
|
+
for (const pending of cancelled) this.#pending.splice(this.#pending.indexOf(pending), 1);
|
|
61
|
+
for (const pending of cancelled)
|
|
62
|
+
pending.cancel(new Error("Semantic inputs changed before request admission."));
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/** Reject queued work without confusing caller completion with transport settlement. */
|
|
66
|
+
dispose(): void {
|
|
67
|
+
this.#disposed = true;
|
|
68
|
+
for (const pending of [...this.#pending]) {
|
|
69
|
+
pending.cancel(new Error("LSP client stopped before input admission."));
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
#run<T>(
|
|
74
|
+
kind: InputOperationKind,
|
|
75
|
+
uri: string | undefined,
|
|
76
|
+
run: () => T | Promise<T>,
|
|
77
|
+
control: CodeRequestControl | undefined,
|
|
78
|
+
): Promise<T> {
|
|
79
|
+
throwIfCodeRequestInterrupted(control);
|
|
80
|
+
if (this.#disposed) return Promise.reject(new Error("LSP input admission is disposed."));
|
|
81
|
+
if (this.#pending.length >= MAX_PENDING_INPUT_OPERATIONS) {
|
|
82
|
+
return Promise.reject(new Error("LSP input admission queue is full."));
|
|
83
|
+
}
|
|
84
|
+
return new Promise<T>((resolve, reject) => {
|
|
85
|
+
let timer: ReturnType<typeof setTimeout> | undefined;
|
|
86
|
+
let waiting = true;
|
|
87
|
+
const cleanup = () => {
|
|
88
|
+
if (timer !== undefined) clearTimeout(timer);
|
|
89
|
+
control?.signal?.removeEventListener("abort", abort);
|
|
90
|
+
};
|
|
91
|
+
const operation: PendingInputOperation = {
|
|
92
|
+
uri,
|
|
93
|
+
kind,
|
|
94
|
+
cancel: (reason) => {
|
|
95
|
+
if (!waiting) return;
|
|
96
|
+
waiting = false;
|
|
97
|
+
cleanup();
|
|
98
|
+
const index = this.#pending.indexOf(operation);
|
|
99
|
+
if (index !== -1) this.#pending.splice(index, 1);
|
|
100
|
+
reject(reason);
|
|
101
|
+
this.#drain();
|
|
102
|
+
},
|
|
103
|
+
start: () => {
|
|
104
|
+
waiting = false;
|
|
105
|
+
cleanup();
|
|
106
|
+
if (kind !== "request") this.#enrolling = true;
|
|
107
|
+
else this.#readers++;
|
|
108
|
+
const finish = () => {
|
|
109
|
+
if (kind !== "request") this.#enrolling = false;
|
|
110
|
+
else this.#readers--;
|
|
111
|
+
this.#drain();
|
|
112
|
+
};
|
|
113
|
+
try {
|
|
114
|
+
throwIfCodeRequestInterrupted(control);
|
|
115
|
+
Promise.resolve(run()).then(resolve, reject).finally(finish);
|
|
116
|
+
} catch (error) {
|
|
117
|
+
reject(error);
|
|
118
|
+
finish();
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
};
|
|
122
|
+
const abort = () => {
|
|
123
|
+
try {
|
|
124
|
+
throwIfCodeRequestInterrupted(control);
|
|
125
|
+
} catch (error) {
|
|
126
|
+
operation.cancel(error);
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
this.#pending.push(operation);
|
|
130
|
+
control?.signal?.addEventListener("abort", abort, { once: true });
|
|
131
|
+
if (control?.deadline !== undefined) {
|
|
132
|
+
timer = setTimeout(
|
|
133
|
+
() => operation.cancel(new CodeRequestDeadlineError()),
|
|
134
|
+
Math.max(0, control.deadline - Date.now()),
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
this.#drain();
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
#drain(): void {
|
|
142
|
+
while (!this.#disposed && !this.#enrolling && this.#pending.length > 0) {
|
|
143
|
+
const next = this.#pending[0];
|
|
144
|
+
if (next.kind !== "request" && this.#readers > 0) return;
|
|
145
|
+
this.#pending.shift();
|
|
146
|
+
next.start();
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether tsserver placed an open file in a configured project.
|
|
3
|
+
*
|
|
4
|
+
* - `configured`: a `tsconfig.json` / `jsconfig.json` program owns the file.
|
|
5
|
+
* - `inferred`: tsserver created an inferred project for the file alone, so
|
|
6
|
+
* project-wide requests such as `workspace/symbol` do not cover the
|
|
7
|
+
* configured program.
|
|
8
|
+
* - `unknown`: the route is not TypeScript or tsserver could not answer.
|
|
9
|
+
*/
|
|
10
|
+
export type ProjectMembership = "configured" | "inferred" | "unknown";
|
|
11
|
+
|
|
12
|
+
/** Build `workspace/executeCommand` params for tsserver `projectInfo`. */
|
|
13
|
+
export function typeScriptProjectInfoParams(uri: string): unknown {
|
|
14
|
+
return {
|
|
15
|
+
command: "typescript.tsserverRequest",
|
|
16
|
+
arguments: [
|
|
17
|
+
"projectInfo",
|
|
18
|
+
{ file: uri, needFileNameList: false },
|
|
19
|
+
// Semantic execution target; the project must be loaded to answer.
|
|
20
|
+
{ executionTarget: 0, expectsResult: true, isAsync: false },
|
|
21
|
+
],
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Read project membership from a tsserver `projectInfo` response.
|
|
27
|
+
* tsserver names projects without a config file `/dev/null/<kind>Project<N>*`.
|
|
28
|
+
*/
|
|
29
|
+
export function readTypeScriptProjectMembership(response: unknown): ProjectMembership {
|
|
30
|
+
if (!isRecord(response) || response.type !== "response" || response.success !== true) {
|
|
31
|
+
return "unknown";
|
|
32
|
+
}
|
|
33
|
+
const body = response.body;
|
|
34
|
+
if (!isRecord(body) || typeof body.configFileName !== "string") return "unknown";
|
|
35
|
+
return body.configFileName.startsWith("/dev/null/") ? "inferred" : "configured";
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
39
|
+
return typeof value === "object" && value !== null;
|
|
40
|
+
}
|