@mrclrchtr/supi-code-intelligence 9.1.2 → 11.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 +99 -27
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/LICENSE +21 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/README.md +743 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/index.js +17 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/lib/constants.js +184 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/lib/parse.js +1425 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/lib/picomatch.js +361 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/lib/scan.js +403 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/lib/utils.js +72 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/package.json +83 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/posix.js +3 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/package.json +4 -1
- package/node_modules/@mrclrchtr/supi-code-runtime/src/api.ts +11 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/src/file-associations.ts +190 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/src/types.ts +22 -0
- package/node_modules/@mrclrchtr/supi-core/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-lsp/README.md +88 -2
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/LICENSE +21 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/README.md +743 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/index.js +17 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/lib/constants.js +184 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/lib/parse.js +1425 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/lib/picomatch.js +361 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/lib/scan.js +403 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/lib/utils.js +72 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/package.json +83 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/posix.js +3 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/package.json +4 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/api.ts +11 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/file-associations.ts +190 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/types.ts +22 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-lsp/package.json +3 -3
- package/node_modules/@mrclrchtr/supi-lsp/src/api.ts +1 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-host.ts +3 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostics.ts +6 -4
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-request-enrollment.ts +66 -22
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-semantic-input-barrier.ts +37 -5
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client.ts +136 -43
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager.ts +261 -22
- package/node_modules/@mrclrchtr/supi-lsp/src/provider/refactor-planning.ts +13 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/provider/semantic-edit-discovery.ts +151 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/provider/semantic-edit-normalizer.ts +97 -129
- package/node_modules/@mrclrchtr/supi-lsp/src/provider/semantic-edit-protocol.ts +132 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-controller.ts +8 -1
- package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-registry.ts +7 -20
- package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-rename.ts +172 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/session/workspace-lsp-runtime.ts +14 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/utils.ts +12 -11
- package/node_modules/@mrclrchtr/supi-tree-sitter/README.md +63 -17
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/LICENSE +21 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/README.md +743 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/index.js +17 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/lib/constants.js +184 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/lib/parse.js +1425 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/lib/picomatch.js +361 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/lib/scan.js +403 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/lib/utils.js +72 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/package.json +83 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/posix.js +3 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/package.json +4 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/api.ts +11 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/file-associations.ts +190 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/types.ts +22 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/package.json +3 -3
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/language.ts +16 -10
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/operation-support.ts +13 -6
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/provider/tree-sitter-provider.ts +19 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/session/runtime-controller.ts +18 -4
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/session/session.ts +10 -3
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/session/structural-worker-client.ts +17 -2
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/session/structural-worker-process.ts +22 -5
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/session/structural-worker-protocol.ts +36 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/syntax-errors.ts +73 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/syntax-node.ts +4 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/call-sites.ts +15 -9
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/callees.ts +24 -15
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/exports.ts +8 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/imports.ts +233 -7
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/node-at.ts +7 -3
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/outline-expansion.ts +78 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/outline-jvm.ts +25 -4
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/outline-nested.ts +390 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/outline.ts +49 -28
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/types.ts +16 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/worker/process-host.mjs +61 -24
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/worker/runtime.ts +44 -10
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/worker/service.ts +13 -9
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/worker/worker-main.ts +15 -2
- package/node_modules/smol-toml/LICENSE +24 -0
- package/node_modules/smol-toml/README.md +605 -0
- package/node_modules/smol-toml/dist/date.d.ts +41 -0
- package/node_modules/smol-toml/dist/date.js +156 -0
- package/node_modules/smol-toml/dist/error.d.ts +37 -0
- package/node_modules/smol-toml/dist/error.js +67 -0
- package/node_modules/smol-toml/dist/extract.js +293 -0
- package/node_modules/smol-toml/dist/index.cjs +771 -0
- package/node_modules/smol-toml/dist/index.d.ts +44 -0
- package/node_modules/smol-toml/dist/index.js +34 -0
- package/node_modules/smol-toml/dist/parse.d.ts +73 -0
- package/node_modules/smol-toml/dist/parse.js +164 -0
- package/node_modules/smol-toml/dist/primitive.js +151 -0
- package/node_modules/smol-toml/dist/stringify.d.ts +32 -0
- package/node_modules/smol-toml/dist/stringify.js +219 -0
- package/node_modules/smol-toml/dist/struct.js +156 -0
- package/node_modules/smol-toml/dist/util.d.ts +43 -0
- package/node_modules/smol-toml/dist/util.js +57 -0
- package/node_modules/smol-toml/package.json +68 -0
- package/package.json +9 -5
- package/src/analysis/refactor/apply.ts +35 -14
- package/src/analysis/relations/callees.ts +9 -2
- package/src/analysis/relations/implementations.ts +7 -2
- package/src/analysis/search/pattern-analysis.ts +90 -12
- package/src/analysis/search/pattern.ts +1 -0
- package/src/analysis/target/anchored-structural.ts +1 -0
- package/src/analysis/target/discovery.ts +29 -0
- package/src/analysis/target/file.ts +19 -9
- package/src/analysis/target/types.ts +5 -0
- package/src/analysis/workspace/exclusions.ts +35 -0
- package/src/analysis/workspace/git.ts +130 -0
- package/src/analysis/workspace/go-parser.ts +330 -0
- package/src/analysis/workspace/go.ts +154 -0
- package/src/analysis/workspace/index.ts +28 -0
- package/src/analysis/workspace/inventory.ts +316 -0
- package/src/analysis/workspace/membership.ts +223 -0
- package/src/analysis/workspace/metadata-types.ts +56 -0
- package/src/analysis/workspace/metadata-utils.ts +60 -0
- package/src/analysis/workspace/metadata.ts +148 -0
- package/src/analysis/workspace/node.ts +214 -0
- package/src/analysis/workspace/observe.ts +161 -0
- package/src/analysis/workspace/paths.ts +65 -0
- package/src/analysis/workspace/python.ts +158 -0
- package/src/analysis/workspace/relationships.ts +87 -0
- package/src/analysis/workspace/rust.ts +238 -0
- package/src/analysis/workspace/safe-path.ts +20 -0
- package/src/analysis/workspace/types.ts +245 -0
- package/src/app/app.ts +1 -0
- package/src/config.ts +50 -11
- package/src/extension.ts +16 -49
- package/src/overview/budget.ts +23 -0
- package/src/overview/collect.ts +22 -0
- package/src/session/graph/collect.ts +2 -2
- package/src/session/graph-types.ts +6 -0
- package/src/session/inspect/collect.ts +35 -20
- package/src/session/inspect-types.ts +9 -2
- package/src/session/orientation/collect.ts +90 -18
- package/src/session/orientation/context-sections.ts +22 -1
- package/src/session/orientation/gather.ts +46 -6
- package/src/session/orientation/workspace-context.ts +166 -0
- package/src/session/orientation-types.ts +15 -2
- package/src/session/orientation-workflow.ts +14 -3
- package/src/session/refactor-plans.ts +17 -0
- package/src/session/refactor-workflow.ts +13 -6
- package/src/session/session.ts +2 -3
- package/src/session/target-store.ts +5 -0
- package/src/session/target-workflow.ts +3 -0
- package/src/substrate/workspace-provider-host.ts +22 -2
- package/src/tool/code_find/markdown.ts +17 -4
- package/src/tool/code_find/result.ts +17 -3
- package/src/tool/code_graph/details.ts +2 -0
- package/src/tool/code_graph/display.ts +1 -0
- package/src/tool/code_graph/format.ts +1 -0
- package/src/tool/code_graph/result.ts +32 -6
- package/src/tool/code_inspect/markdown.ts +15 -1
- package/src/tool/code_inspect/result.ts +11 -0
- package/src/tool/code_orientation/execute.ts +8 -1
- package/src/tool/code_orientation/markdown.ts +58 -8
- package/src/tool/code_orientation/result.ts +15 -4
- package/src/tool/code_orientation/workspace-format.ts +74 -0
- package/src/tool/code_orientation/workspace-instructions.ts +105 -0
- package/src/tool/code_orientation/workspace-output.ts +118 -0
- package/src/tool/code_orientation/workspace-projects.ts +177 -0
- package/src/tool/code_orientation/workspace-sections.ts +217 -0
- package/src/tool/code_resolve/markdown.ts +34 -14
- package/src/tool/code_resolve/result.ts +7 -3
- package/src/tool/register.ts +2 -0
- package/src/tool/result/types.ts +20 -2
- package/src/types/execution.ts +2 -0
- package/src/ui/tui/display.ts +2 -1
- package/src/overview/overview-data.ts +0 -154
- package/src/overview/overview.ts +0 -91
- package/src/overview/types.ts +0 -23
- /package/node_modules/{@mrclrchtr/supi-lsp/node_modules/ignore → ignore}/LICENSE-MIT +0 -0
- /package/node_modules/{@mrclrchtr/supi-lsp/node_modules/ignore → ignore}/README.md +0 -0
- /package/node_modules/{@mrclrchtr/supi-lsp/node_modules/ignore → ignore}/index.d.ts +0 -0
- /package/node_modules/{@mrclrchtr/supi-lsp/node_modules/ignore → ignore}/index.js +0 -0
- /package/node_modules/{@mrclrchtr/supi-lsp/node_modules/ignore → ignore}/legacy.js +0 -0
- /package/node_modules/{@mrclrchtr/supi-lsp/node_modules/ignore → ignore}/package.json +0 -0
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Structural callee lookup — finds direct calls in the enclosing scope at a target position.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import type { CodeRequestControl } from "@mrclrchtr/supi-code-runtime/api";
|
|
5
|
+
import type { CodeRequestControl, SourceRange } from "@mrclrchtr/supi-code-runtime/api";
|
|
6
6
|
import type { CalleeEntry, CalleeScope, RelationsServiceDeps } from "./types.ts";
|
|
7
7
|
|
|
8
8
|
export interface CalleesResult {
|
|
@@ -14,6 +14,8 @@ export interface CalleesResult {
|
|
|
14
14
|
/** Original provider reason when callee evidence is unavailable. */
|
|
15
15
|
message: string | null;
|
|
16
16
|
depth: "direct" | "deep";
|
|
17
|
+
/** Syntax recovery that may hide call sites in the analyzed file. */
|
|
18
|
+
partial: { file: string; reason: string; errorRanges: readonly SourceRange[] } | null;
|
|
17
19
|
}
|
|
18
20
|
|
|
19
21
|
/**
|
|
@@ -42,7 +44,7 @@ export async function collectCallees(
|
|
|
42
44
|
targetCharacter,
|
|
43
45
|
depthOrOptions,
|
|
44
46
|
);
|
|
45
|
-
if (result.kind !== "success") {
|
|
47
|
+
if (result.kind !== "success" && result.kind !== "partial") {
|
|
46
48
|
return unavailableCallees(targetName, result.message, depth);
|
|
47
49
|
}
|
|
48
50
|
|
|
@@ -69,6 +71,10 @@ export async function collectCallees(
|
|
|
69
71
|
confidence: "structural",
|
|
70
72
|
message: null,
|
|
71
73
|
depth: result.data.depth ?? depth,
|
|
74
|
+
partial:
|
|
75
|
+
result.kind === "partial"
|
|
76
|
+
? { file: result.file, reason: result.reason, errorRanges: result.errorRanges }
|
|
77
|
+
: null,
|
|
72
78
|
};
|
|
73
79
|
}
|
|
74
80
|
|
|
@@ -85,6 +91,7 @@ function unavailableCallees(
|
|
|
85
91
|
confidence: "unavailable",
|
|
86
92
|
message,
|
|
87
93
|
depth,
|
|
94
|
+
partial: null,
|
|
88
95
|
};
|
|
89
96
|
}
|
|
90
97
|
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
} from "./provider-locations.ts";
|
|
11
11
|
import type { ImplementationEntry, RelationsServiceDeps } from "./types.ts";
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
interface ImplementationsResultBase {
|
|
14
14
|
kind: "implementations";
|
|
15
15
|
targetName: string;
|
|
16
16
|
implementations: ImplementationEntry[];
|
|
@@ -18,9 +18,12 @@ export interface ImplementationsResult {
|
|
|
18
18
|
/** Provider locations omitted because their URI or position was unusable. */
|
|
19
19
|
invalidLocationCount: number;
|
|
20
20
|
partialReason: RelationLocationPartialReason | null;
|
|
21
|
-
confidence: "semantic" | "unavailable";
|
|
22
21
|
}
|
|
23
22
|
|
|
23
|
+
/** An implementation lookup result with a reason on every unavailable outcome. */
|
|
24
|
+
export type ImplementationsResult = ImplementationsResultBase &
|
|
25
|
+
({ confidence: "semantic" } | { confidence: "unavailable"; message: string });
|
|
26
|
+
|
|
24
27
|
/**
|
|
25
28
|
* Collect implementations for a target file/position using semantic provider.
|
|
26
29
|
*/
|
|
@@ -41,6 +44,7 @@ export async function collectImplementations(
|
|
|
41
44
|
invalidLocationCount: 0,
|
|
42
45
|
partialReason: null,
|
|
43
46
|
confidence: "unavailable",
|
|
47
|
+
message: "No semantic implementations provider",
|
|
44
48
|
};
|
|
45
49
|
}
|
|
46
50
|
|
|
@@ -54,6 +58,7 @@ export async function collectImplementations(
|
|
|
54
58
|
invalidLocationCount: 0,
|
|
55
59
|
partialReason: null,
|
|
56
60
|
confidence: "unavailable",
|
|
61
|
+
message: result.reason,
|
|
57
62
|
};
|
|
58
63
|
}
|
|
59
64
|
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
isCodeRequestDeadlineError,
|
|
5
5
|
isCodeRequestInterruption,
|
|
6
6
|
type OutlineData,
|
|
7
|
+
type SourceRange,
|
|
7
8
|
type StructuralProvider as StructuralSubstrate,
|
|
8
9
|
} from "@mrclrchtr/supi-code-runtime/api";
|
|
9
10
|
import type { CodeFindAstKind } from "../../tool/code_find/ast-kinds.ts";
|
|
@@ -20,8 +21,14 @@ export interface StructuredPatternParams {
|
|
|
20
21
|
export interface StructuredMatch {
|
|
21
22
|
readonly file: string;
|
|
22
23
|
readonly name: string;
|
|
24
|
+
/** Display kind: native kind when available, otherwise common structural kind. */
|
|
23
25
|
readonly kind: string;
|
|
24
26
|
readonly line: number;
|
|
27
|
+
readonly startCharacter: number;
|
|
28
|
+
readonly endLine: number;
|
|
29
|
+
readonly endCharacter: number;
|
|
30
|
+
readonly commonKind?: string;
|
|
31
|
+
readonly nativeKind?: string;
|
|
25
32
|
}
|
|
26
33
|
|
|
27
34
|
export type StructuredFailureKind = Exclude<CodeResult<never>, { kind: "success" }>["kind"];
|
|
@@ -30,9 +37,13 @@ export interface StructuredFailure {
|
|
|
30
37
|
readonly file: string;
|
|
31
38
|
readonly kind: StructuredFailureKind;
|
|
32
39
|
readonly reason: string;
|
|
40
|
+
readonly errorRanges?: readonly SourceRange[];
|
|
33
41
|
}
|
|
34
42
|
|
|
35
|
-
export type StructuredScanLimitation =
|
|
43
|
+
export type StructuredScanLimitation =
|
|
44
|
+
| AstScanLimitation
|
|
45
|
+
| ProviderScanLimitation
|
|
46
|
+
| SyntaxRecoveryScanLimitation;
|
|
36
47
|
|
|
37
48
|
export interface ProviderScanLimitation {
|
|
38
49
|
readonly reason: "provider-failure";
|
|
@@ -40,6 +51,13 @@ export interface ProviderScanLimitation {
|
|
|
40
51
|
readonly examples: readonly string[];
|
|
41
52
|
}
|
|
42
53
|
|
|
54
|
+
/** Recovered syntax files that limit the scan without losing collected matches. */
|
|
55
|
+
export interface SyntaxRecoveryScanLimitation {
|
|
56
|
+
readonly reason: "syntax-recovery";
|
|
57
|
+
readonly pathCount: number;
|
|
58
|
+
readonly examples: readonly string[];
|
|
59
|
+
}
|
|
60
|
+
|
|
43
61
|
export interface StructuredFileAnalysis {
|
|
44
62
|
readonly matches: StructuredMatch[];
|
|
45
63
|
readonly failures: StructuredFailure[];
|
|
@@ -125,11 +143,20 @@ export async function analyzeStructuredFiles(
|
|
|
125
143
|
if (fileFailures.length === 0) analyzedFileCount += 1;
|
|
126
144
|
}
|
|
127
145
|
|
|
128
|
-
|
|
146
|
+
const recoveredFiles = failures.filter((failure) => failure.kind === "partial");
|
|
147
|
+
if (recoveredFiles.length > 0) {
|
|
148
|
+
limitations.push({
|
|
149
|
+
reason: "syntax-recovery",
|
|
150
|
+
pathCount: recoveredFiles.length,
|
|
151
|
+
examples: recoveredFiles.slice(0, 5).map((failure) => failure.file),
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
const failedFiles = failures.filter((failure) => failure.kind !== "partial");
|
|
155
|
+
if (failedFiles.length > 0) {
|
|
129
156
|
limitations.push({
|
|
130
157
|
reason: "provider-failure",
|
|
131
|
-
pathCount:
|
|
132
|
-
examples:
|
|
158
|
+
pathCount: failedFiles.length,
|
|
159
|
+
examples: failedFiles.slice(0, 5).map((failure) => failure.file),
|
|
133
160
|
});
|
|
134
161
|
}
|
|
135
162
|
return { matches, failures, limitations, analyzedFileCount };
|
|
@@ -159,8 +186,17 @@ async function collectMatchesForFile(
|
|
|
159
186
|
matcher: (value: string) => boolean,
|
|
160
187
|
requestControl: CodeRequestControl,
|
|
161
188
|
): Promise<void> {
|
|
162
|
-
const recordFailure = (
|
|
163
|
-
|
|
189
|
+
const recordFailure = (
|
|
190
|
+
failureKind: StructuredFailureKind,
|
|
191
|
+
reason: string,
|
|
192
|
+
errorRanges?: readonly SourceRange[],
|
|
193
|
+
) => {
|
|
194
|
+
failures.push({
|
|
195
|
+
file: relFile,
|
|
196
|
+
kind: failureKind,
|
|
197
|
+
reason,
|
|
198
|
+
...(errorRanges ? { errorRanges } : {}),
|
|
199
|
+
});
|
|
164
200
|
};
|
|
165
201
|
|
|
166
202
|
if (kind === "definition") {
|
|
@@ -168,7 +204,7 @@ async function collectMatchesForFile(
|
|
|
168
204
|
if (!handleStructuralResult(outline, recordFailure)) return;
|
|
169
205
|
for (const item of flattenOutlineItems(outline.data)) {
|
|
170
206
|
if (!matcher(item.name)) continue;
|
|
171
|
-
matches.push(
|
|
207
|
+
matches.push(outlineMatch(relFile, item));
|
|
172
208
|
}
|
|
173
209
|
return;
|
|
174
210
|
}
|
|
@@ -178,7 +214,15 @@ async function collectMatchesForFile(
|
|
|
178
214
|
if (!handleStructuralResult(exportsResult, recordFailure)) return;
|
|
179
215
|
for (const item of exportsResult.data) {
|
|
180
216
|
if (!matcher(item.name)) continue;
|
|
181
|
-
matches.push({
|
|
217
|
+
matches.push({
|
|
218
|
+
file: relFile,
|
|
219
|
+
name: item.name,
|
|
220
|
+
kind: item.kind,
|
|
221
|
+
line: item.startLine,
|
|
222
|
+
startCharacter: item.startCharacter,
|
|
223
|
+
endLine: item.endLine,
|
|
224
|
+
endCharacter: item.endCharacter,
|
|
225
|
+
});
|
|
182
226
|
}
|
|
183
227
|
return;
|
|
184
228
|
}
|
|
@@ -193,6 +237,9 @@ async function collectMatchesForFile(
|
|
|
193
237
|
name: item.moduleSpecifier,
|
|
194
238
|
kind: "import",
|
|
195
239
|
line: item.startLine,
|
|
240
|
+
startCharacter: item.startCharacter,
|
|
241
|
+
endLine: item.endLine,
|
|
242
|
+
endCharacter: item.endCharacter,
|
|
196
243
|
});
|
|
197
244
|
}
|
|
198
245
|
return;
|
|
@@ -203,7 +250,15 @@ async function collectMatchesForFile(
|
|
|
203
250
|
if (!handleStructuralResult(callResult, recordFailure)) return;
|
|
204
251
|
for (const call of callResult.data) {
|
|
205
252
|
if (!matcher(callableExpressionForMatching(call.name))) continue;
|
|
206
|
-
matches.push({
|
|
253
|
+
matches.push({
|
|
254
|
+
file: relFile,
|
|
255
|
+
name: call.name,
|
|
256
|
+
kind: "call",
|
|
257
|
+
line: call.startLine,
|
|
258
|
+
startCharacter: call.startCharacter,
|
|
259
|
+
endLine: call.endLine,
|
|
260
|
+
endCharacter: call.endCharacter,
|
|
261
|
+
});
|
|
207
262
|
}
|
|
208
263
|
return;
|
|
209
264
|
}
|
|
@@ -217,20 +272,43 @@ async function collectMatchesForFile(
|
|
|
217
272
|
if (kind === "method" && item.kind.toLowerCase() !== "method") continue;
|
|
218
273
|
if (kind === "enum" && item.kind.toLowerCase() !== "enum") continue;
|
|
219
274
|
if (!matcher(item.name)) continue;
|
|
220
|
-
matches.push(
|
|
275
|
+
matches.push(outlineMatch(relFile, item));
|
|
221
276
|
}
|
|
222
277
|
}
|
|
223
278
|
|
|
224
279
|
/** Flatten provider outlines so nested class/interface/enum declarations remain searchable. */
|
|
280
|
+
function outlineMatch(file: string, item: OutlineData): StructuredMatch {
|
|
281
|
+
return {
|
|
282
|
+
file,
|
|
283
|
+
name: item.name,
|
|
284
|
+
kind: item.nativeKind ?? item.kind,
|
|
285
|
+
...(item.nativeKind ? { commonKind: item.kind, nativeKind: item.nativeKind } : {}),
|
|
286
|
+
line: item.startLine,
|
|
287
|
+
startCharacter: item.startCharacter,
|
|
288
|
+
endLine: item.endLine,
|
|
289
|
+
endCharacter: item.endCharacter,
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
|
|
225
293
|
function flattenOutlineItems(items: readonly OutlineData[]): OutlineData[] {
|
|
226
294
|
return items.flatMap((item) => [item, ...flattenOutlineItems(item.children ?? [])]);
|
|
227
295
|
}
|
|
228
296
|
|
|
297
|
+
type StructuralDataResult<T> = Extract<CodeResult<T>, { kind: "success" | "partial" }>;
|
|
298
|
+
|
|
229
299
|
function handleStructuralResult<T>(
|
|
230
300
|
result: CodeResult<T>,
|
|
231
|
-
recordFailure: (
|
|
232
|
-
|
|
301
|
+
recordFailure: (
|
|
302
|
+
kind: StructuredFailureKind,
|
|
303
|
+
reason: string,
|
|
304
|
+
errorRanges?: readonly SourceRange[],
|
|
305
|
+
) => void,
|
|
306
|
+
): result is StructuralDataResult<T> {
|
|
233
307
|
if (result.kind === "success") return true;
|
|
308
|
+
if (result.kind === "partial") {
|
|
309
|
+
recordFailure("partial", result.reason, result.errorRanges);
|
|
310
|
+
return true;
|
|
311
|
+
}
|
|
234
312
|
recordFailure(result.kind, result.message);
|
|
235
313
|
return false;
|
|
236
314
|
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { SourceRange } from "@mrclrchtr/supi-code-runtime/api";
|
|
2
|
+
|
|
3
|
+
export interface TargetDiscoveryResult<T> {
|
|
4
|
+
readonly available: boolean;
|
|
5
|
+
readonly targets: readonly T[];
|
|
6
|
+
readonly partial?: { readonly reason: string; readonly errorRanges: readonly SourceRange[] };
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/** Combine provider recovery without discarding structurally usable targets. */
|
|
10
|
+
export function mergeDiscoveryPartial(
|
|
11
|
+
semantic: TargetDiscoveryResult<unknown>,
|
|
12
|
+
structural: TargetDiscoveryResult<unknown>,
|
|
13
|
+
): { partial?: { reason: string; errorRanges: readonly SourceRange[] } } {
|
|
14
|
+
const partials = [semantic.partial, structural.partial].filter(
|
|
15
|
+
(partial): partial is NonNullable<TargetDiscoveryResult<unknown>["partial"]> =>
|
|
16
|
+
partial !== undefined,
|
|
17
|
+
);
|
|
18
|
+
if (partials.length === 0) return {};
|
|
19
|
+
const ranges = new Map<string, SourceRange>();
|
|
20
|
+
for (const partial of partials) {
|
|
21
|
+
for (const range of partial.errorRanges) ranges.set(JSON.stringify(range), range);
|
|
22
|
+
}
|
|
23
|
+
return {
|
|
24
|
+
partial: {
|
|
25
|
+
reason: partials.map((partial) => partial.reason).join(" "),
|
|
26
|
+
errorRanges: [...ranges.values()],
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
}
|
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
} from "@mrclrchtr/supi-code-runtime/api";
|
|
21
21
|
import type { AnchorKind } from "../../session/target-store.ts";
|
|
22
22
|
import { normalizePath } from "../search/paths.ts";
|
|
23
|
+
import { mergeDiscoveryPartial, type TargetDiscoveryResult } from "./discovery.ts";
|
|
23
24
|
import {
|
|
24
25
|
reconcileContainer,
|
|
25
26
|
reconcileNesting,
|
|
@@ -61,16 +62,13 @@ const BINARY_EXTENSIONS = new Set([
|
|
|
61
62
|
".node",
|
|
62
63
|
]);
|
|
63
64
|
|
|
65
|
+
type DiscoveryResult = TargetDiscoveryResult<DiscoveredTargetData>;
|
|
66
|
+
|
|
64
67
|
export interface DiscoveredTargetData extends ResolvedTargetData {
|
|
65
68
|
/** Provider-backed hierarchy used only for file-result presentation ranking. */
|
|
66
69
|
readonly nesting: DeclarationNesting;
|
|
67
70
|
}
|
|
68
71
|
|
|
69
|
-
interface DiscoveryResult {
|
|
70
|
-
readonly available: boolean;
|
|
71
|
-
readonly targets: DiscoveredTargetData[];
|
|
72
|
-
}
|
|
73
|
-
|
|
74
72
|
/** Validated file-discovery input with its normalized absolute path. */
|
|
75
73
|
export type FileDiscoveryValidation =
|
|
76
74
|
| { kind: "valid"; file: string }
|
|
@@ -130,6 +128,7 @@ export async function resolveFileTargetGroup(
|
|
|
130
128
|
discoveryProvenance,
|
|
131
129
|
confidence: targetGroupConfidence(targets, discoveryProvenance),
|
|
132
130
|
unknownNestingCount,
|
|
131
|
+
...mergeDiscoveryPartial(semantic, structural),
|
|
133
132
|
},
|
|
134
133
|
};
|
|
135
134
|
}
|
|
@@ -166,7 +165,7 @@ async function discoverSemantic(
|
|
|
166
165
|
): Promise<DiscoveryResult> {
|
|
167
166
|
if (!semantic) return { available: false, targets: [] };
|
|
168
167
|
try {
|
|
169
|
-
const result = await semantic.documentSymbols(file);
|
|
168
|
+
const result = await semantic.documentSymbols(file, control);
|
|
170
169
|
if (result.kind === "unavailable") return { available: false, targets: [] };
|
|
171
170
|
return {
|
|
172
171
|
available: true,
|
|
@@ -177,6 +176,7 @@ async function discoverSemantic(
|
|
|
177
176
|
return { ...refined, nesting: target.nesting };
|
|
178
177
|
}),
|
|
179
178
|
),
|
|
179
|
+
...(result.kind === "partial" ? { partial: { reason: result.reason, errorRanges: [] } } : {}),
|
|
180
180
|
};
|
|
181
181
|
} catch (error) {
|
|
182
182
|
if (isCodeRequestInterruption(error, control)) throw error;
|
|
@@ -218,9 +218,17 @@ async function discoverStructural(
|
|
|
218
218
|
): Promise<DiscoveryResult> {
|
|
219
219
|
if (!structural) return { available: false, targets: [] };
|
|
220
220
|
try {
|
|
221
|
-
const result = await structural.outline(file);
|
|
222
|
-
if (result.kind !== "success"
|
|
223
|
-
|
|
221
|
+
const result = await structural.outline(file, control);
|
|
222
|
+
if (result.kind !== "success" && result.kind !== "partial") {
|
|
223
|
+
return { available: false, targets: [] };
|
|
224
|
+
}
|
|
225
|
+
return {
|
|
226
|
+
available: true,
|
|
227
|
+
targets: flattenOutline(file, result.data),
|
|
228
|
+
...(result.kind === "partial"
|
|
229
|
+
? { partial: { reason: result.reason, errorRanges: result.errorRanges } }
|
|
230
|
+
: {}),
|
|
231
|
+
};
|
|
224
232
|
} catch (error) {
|
|
225
233
|
if (isCodeRequestInterruption(error, control)) throw error;
|
|
226
234
|
return { available: false, targets: [] };
|
|
@@ -247,6 +255,7 @@ function flattenOutline(
|
|
|
247
255
|
declarationOccurrence: 0,
|
|
248
256
|
name: item.name,
|
|
249
257
|
kind: item.kind,
|
|
258
|
+
...(item.nativeKind ? { nativeKind: item.nativeKind } : {}),
|
|
250
259
|
identityKind:
|
|
251
260
|
canonicalFileDeclarationKind(file, item.kind, item.name) ??
|
|
252
261
|
canonicalDeclarationKind(item.kind),
|
|
@@ -279,6 +288,7 @@ function mergeDiscoveries(
|
|
|
279
288
|
{
|
|
280
289
|
...refinedSemantic,
|
|
281
290
|
provenance: ["semantic", "structural"] as const,
|
|
291
|
+
nativeKind: structuralTarget.nativeKind ?? semanticTarget.nativeKind,
|
|
282
292
|
container: reconcileContainer(semanticTarget, structuralTarget),
|
|
283
293
|
nesting: reconcileNesting(semanticTarget.nesting, structuralTarget.nesting),
|
|
284
294
|
},
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
import type {
|
|
10
10
|
SemanticProvider as SemanticSubstrate,
|
|
11
|
+
SourceRange,
|
|
11
12
|
StructuralProvider as StructuralSubstrate,
|
|
12
13
|
} from "@mrclrchtr/supi-code-runtime/api";
|
|
13
14
|
import type { TargetSymbolKind } from "../../session/target-input.ts";
|
|
@@ -81,6 +82,8 @@ export interface ResolvedTargetData {
|
|
|
81
82
|
declarationOccurrence: number;
|
|
82
83
|
name: string | null;
|
|
83
84
|
kind: string | null;
|
|
85
|
+
/** Structural source-language declaration kind, separate from common identity kind. */
|
|
86
|
+
nativeKind?: string;
|
|
84
87
|
/** Evidence-backed provider-independent kind used for matching and handle identity. */
|
|
85
88
|
identityKind?: string;
|
|
86
89
|
confidence: "semantic" | "structural" | "heuristic" | "unavailable";
|
|
@@ -111,6 +114,8 @@ export interface ResolvedTargetGroupData {
|
|
|
111
114
|
confidence: "semantic" | "structural" | "heuristic" | "unavailable";
|
|
112
115
|
/** Complete-group declarations whose provider observations could not establish hierarchy. */
|
|
113
116
|
unknownNestingCount: number;
|
|
117
|
+
/** Partial provider collection; targets remain usable and exact absence is not claimed. */
|
|
118
|
+
partial?: { reason: string; errorRanges: readonly SourceRange[] };
|
|
114
119
|
}
|
|
115
120
|
|
|
116
121
|
/**
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/** Gitignore-style exclusion matching for workspace observation. */
|
|
2
|
+
|
|
3
|
+
import ignore from "ignore";
|
|
4
|
+
import { errorMessage } from "./paths.ts";
|
|
5
|
+
import type { WorkspaceObservationError } from "./types.ts";
|
|
6
|
+
|
|
7
|
+
/** Compiled caller exclusions. Matching is case-sensitive and root-relative. */
|
|
8
|
+
export interface ExclusionMatcher {
|
|
9
|
+
matches(relativePath: string, directory: boolean): boolean;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/** Compile caller patterns one at a time so one invalid pattern cannot erase valid exclusions. */
|
|
13
|
+
export function createExclusionMatcher(
|
|
14
|
+
patterns: readonly string[],
|
|
15
|
+
errors: WorkspaceObservationError[],
|
|
16
|
+
): ExclusionMatcher {
|
|
17
|
+
const matcher = ignore({ ignorecase: false });
|
|
18
|
+
for (const pattern of patterns) {
|
|
19
|
+
try {
|
|
20
|
+
matcher.add(pattern);
|
|
21
|
+
} catch (error) {
|
|
22
|
+
errors.push({
|
|
23
|
+
stage: "inventory",
|
|
24
|
+
path: null,
|
|
25
|
+
reason: `Invalid exclude pattern \`${pattern}\`: ${errorMessage(error)}`,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return {
|
|
30
|
+
matches(relativePath, directory) {
|
|
31
|
+
if (relativePath === ".") return false;
|
|
32
|
+
return matcher.ignores(directory ? `${relativePath}/` : relativePath);
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/** Git inventory command boundary. This module never interprets project metadata. */
|
|
2
|
+
|
|
3
|
+
import { execFile } from "node:child_process";
|
|
4
|
+
import * as path from "node:path";
|
|
5
|
+
import { promisify } from "node:util";
|
|
6
|
+
import type { CodeRequestControl } from "@mrclrchtr/supi-code-runtime/api";
|
|
7
|
+
import { errorMessage } from "./paths.ts";
|
|
8
|
+
|
|
9
|
+
const execFileAsync = promisify(execFile);
|
|
10
|
+
const MAX_GIT_OUTPUT_BYTES = 64 * 1024 * 1024;
|
|
11
|
+
|
|
12
|
+
/** Git path list outcome before filesystem classification and exclusions. */
|
|
13
|
+
export type GitPathResult =
|
|
14
|
+
| { readonly kind: "git"; readonly paths: readonly string[] }
|
|
15
|
+
| { readonly kind: "not-git" }
|
|
16
|
+
| { readonly kind: "deadline" }
|
|
17
|
+
| { readonly kind: "unavailable"; readonly reason: string }
|
|
18
|
+
| { readonly kind: "missing-command"; readonly reason: string };
|
|
19
|
+
|
|
20
|
+
type GitCommandResult =
|
|
21
|
+
| { readonly kind: "ok"; readonly stdout: string }
|
|
22
|
+
| { readonly kind: "deadline" }
|
|
23
|
+
| { readonly kind: "error"; readonly reason: string; readonly missing?: boolean };
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Read tracked and untracked paths under `root`.
|
|
27
|
+
*
|
|
28
|
+
* `git ls-files` runs from the requested root, so paths stay inside that root
|
|
29
|
+
* even when it is a repository subdirectory. Without `--exclude-standard`,
|
|
30
|
+
* ignored untracked paths stay visible for explicit focus inspection.
|
|
31
|
+
*/
|
|
32
|
+
export async function readGitPaths(
|
|
33
|
+
root: string,
|
|
34
|
+
includeIgnored: boolean,
|
|
35
|
+
control: CodeRequestControl | undefined,
|
|
36
|
+
): Promise<GitPathResult> {
|
|
37
|
+
const inside = await runGit(root, ["rev-parse", "--is-inside-work-tree"], control);
|
|
38
|
+
if (inside.kind === "deadline") return inside;
|
|
39
|
+
if (inside.kind === "error") {
|
|
40
|
+
if (inside.missing) return { kind: "missing-command", reason: inside.reason };
|
|
41
|
+
if (isNotRepository(inside.reason)) return { kind: "not-git" };
|
|
42
|
+
return { kind: "unavailable", reason: inside.reason };
|
|
43
|
+
}
|
|
44
|
+
if (inside.stdout.trim() !== "true") return { kind: "not-git" };
|
|
45
|
+
|
|
46
|
+
const args = ["ls-files", "-z", "--cached", "--others"];
|
|
47
|
+
if (!includeIgnored) args.push("--exclude-standard");
|
|
48
|
+
args.push("--", ".");
|
|
49
|
+
const listed = await runGit(root, args, control);
|
|
50
|
+
if (listed.kind === "deadline") return listed;
|
|
51
|
+
if (listed.kind === "error") {
|
|
52
|
+
if (isNotRepository(listed.reason)) return { kind: "not-git" };
|
|
53
|
+
return { kind: "unavailable", reason: listed.reason };
|
|
54
|
+
}
|
|
55
|
+
return {
|
|
56
|
+
kind: "git",
|
|
57
|
+
paths: [...new Set(listed.stdout.split("\0").filter((path) => path.length > 0))],
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** Check the explicit directory against Git's own ignore rules, without name heuristics. */
|
|
62
|
+
export async function isGitIgnoredDirectory(
|
|
63
|
+
directory: string,
|
|
64
|
+
control?: CodeRequestControl,
|
|
65
|
+
): Promise<boolean> {
|
|
66
|
+
const result = await runGit(
|
|
67
|
+
path.dirname(directory),
|
|
68
|
+
["check-ignore", "--no-index", "-q", "--", path.basename(directory)],
|
|
69
|
+
control,
|
|
70
|
+
);
|
|
71
|
+
return result.kind === "ok";
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function isNotRepository(reason: string): boolean {
|
|
75
|
+
return /not a git repository|not a git work tree|not a work tree/i.test(reason);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
async function runGit(
|
|
79
|
+
root: string,
|
|
80
|
+
args: readonly string[],
|
|
81
|
+
control: CodeRequestControl | undefined,
|
|
82
|
+
): Promise<GitCommandResult> {
|
|
83
|
+
control?.signal?.throwIfAborted();
|
|
84
|
+
const deadline = finiteDeadline(control);
|
|
85
|
+
if (deadline !== null && Date.now() >= deadline) return { kind: "deadline" };
|
|
86
|
+
|
|
87
|
+
const controller = new AbortController();
|
|
88
|
+
const forwardAbort = () => controller.abort(control?.signal?.reason);
|
|
89
|
+
control?.signal?.addEventListener("abort", forwardAbort, { once: true });
|
|
90
|
+
const timer =
|
|
91
|
+
deadline === null
|
|
92
|
+
? null
|
|
93
|
+
: setTimeout(() => controller.abort(), Math.max(0, deadline - Date.now()));
|
|
94
|
+
|
|
95
|
+
try {
|
|
96
|
+
const { stdout } = await execFileAsync("git", ["-c", "core.fsmonitor=false", ...args], {
|
|
97
|
+
env: {
|
|
98
|
+
...process.env,
|
|
99
|
+
LC_ALL: "C",
|
|
100
|
+
GIT_OPTIONAL_LOCKS: "0",
|
|
101
|
+
GIT_DIR: undefined,
|
|
102
|
+
GIT_WORK_TREE: undefined,
|
|
103
|
+
GIT_INDEX_FILE: undefined,
|
|
104
|
+
},
|
|
105
|
+
cwd: root,
|
|
106
|
+
encoding: "utf8",
|
|
107
|
+
maxBuffer: MAX_GIT_OUTPUT_BYTES,
|
|
108
|
+
signal: controller.signal,
|
|
109
|
+
});
|
|
110
|
+
if (deadline !== null && Date.now() >= deadline) return { kind: "deadline" };
|
|
111
|
+
return { kind: "ok", stdout };
|
|
112
|
+
} catch (error) {
|
|
113
|
+
control?.signal?.throwIfAborted();
|
|
114
|
+
if (deadline !== null && Date.now() >= deadline) return { kind: "deadline" };
|
|
115
|
+
return {
|
|
116
|
+
kind: "error",
|
|
117
|
+
reason: errorMessage(error),
|
|
118
|
+
missing:
|
|
119
|
+
typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT",
|
|
120
|
+
};
|
|
121
|
+
} finally {
|
|
122
|
+
if (timer) clearTimeout(timer);
|
|
123
|
+
control?.signal?.removeEventListener("abort", forwardAbort);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function finiteDeadline(control: CodeRequestControl | undefined): number | null {
|
|
128
|
+
const deadline = control?.deadline;
|
|
129
|
+
return typeof deadline === "number" && Number.isFinite(deadline) ? deadline : null;
|
|
130
|
+
}
|