@mrclrchtr/supi-code-intelligence 6.2.0 → 6.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/README.md +2 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-core/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-lsp/README.md +2 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/ignore/README.md +52 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/ignore/index.js +785 -129
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/ignore/legacy.js +660 -98
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/ignore/package.json +10 -4
- package/node_modules/@mrclrchtr/supi-lsp/package.json +3 -3
- package/node_modules/@mrclrchtr/supi-lsp/src/api.ts +6 -2
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-process-crash-report.ts +106 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-workspace-recovery.ts +4 -4
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager.ts +348 -99
- package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-diagnostics.ts +43 -15
- package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-registry.ts +23 -32
- package/node_modules/@mrclrchtr/supi-lsp/src/session/workspace-lsp-runtime.ts +4 -4
- package/node_modules/@mrclrchtr/supi-lsp/src/summary.ts +1 -1
- package/node_modules/@mrclrchtr/supi-lsp/src/workspace-path-policy.ts +18 -9
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/README.md +29 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.cjs +99 -19
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.cjs.map +4 -4
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.js +94 -18
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.js.map +4 -4
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.wasm +0 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.wasm.map +14 -14
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/package.json +13 -8
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.cjs +97 -19
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.cjs.map +4 -4
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.d.cts +28 -8
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.d.cts.map +1 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.d.ts +28 -8
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.d.ts.map +1 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.js +92 -18
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.js.map +4 -4
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.wasm +0 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.wasm.map +17 -17
- package/node_modules/@mrclrchtr/supi-tree-sitter/package.json +7 -4
- package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/kotlin/tree-sitter-kotlin.wasm +0 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/kotlin/tree-sitter-kotlin.wasm.json +2 -2
- package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/sql/tree-sitter-sql.wasm +0 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/sql/tree-sitter-sql.wasm.json +2 -2
- package/package.json +5 -5
- package/src/session/health-refresh.ts +4 -2
- package/src/session/health-types.ts +3 -3
- package/src/substrate/lsp/settings.ts +2 -1
- package/src/tool/code_health/refresh-outcome.ts +37 -7
- package/src/tool/code_health/refresh-status.ts +58 -12
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mrclrchtr/supi-tree-sitter",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.3.0",
|
|
4
4
|
"description": "Structural AST analysis for SuPi code intelligence",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -30,13 +30,14 @@
|
|
|
30
30
|
"src/**/*.mjs",
|
|
31
31
|
"src/**/*.json",
|
|
32
32
|
"resources",
|
|
33
|
+
"!resources/**/.supi-wasm-*",
|
|
33
34
|
"!__tests__"
|
|
34
35
|
],
|
|
35
36
|
"dependencies": {
|
|
36
37
|
"jiti": "^2.7.0",
|
|
37
|
-
"web-tree-sitter": "^0.
|
|
38
|
-
"@mrclrchtr/supi-code-runtime": "6.
|
|
39
|
-
"@mrclrchtr/supi-core": "6.
|
|
38
|
+
"web-tree-sitter": "^0.27.0",
|
|
39
|
+
"@mrclrchtr/supi-code-runtime": "6.3.0",
|
|
40
|
+
"@mrclrchtr/supi-core": "6.3.0"
|
|
40
41
|
},
|
|
41
42
|
"bundledDependencies": [
|
|
42
43
|
"@mrclrchtr/supi-code-runtime",
|
|
@@ -53,6 +54,8 @@
|
|
|
53
54
|
"bench:structural": "vitest bench __tests__/benchmark/structural-baseline.bench.ts --run",
|
|
54
55
|
"vendor:wasm": "node scripts/vendor-wasm.mjs",
|
|
55
56
|
"check:wasm": "node scripts/vendor-wasm.mjs --check",
|
|
57
|
+
"check:all-wasm": "node scripts/check-all-wasm.mjs",
|
|
58
|
+
"generate:all-wasm": "node scripts/generate-all-wasm.mjs",
|
|
56
59
|
"generate:kotlin-wasm": "node scripts/generate-kotlin-wasm.mjs",
|
|
57
60
|
"check:kotlin-wasm": "node scripts/generate-kotlin-wasm.mjs --check",
|
|
58
61
|
"generate:sql-wasm": "node scripts/generate-sql-wasm.mjs",
|
package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/kotlin/tree-sitter-kotlin.wasm
CHANGED
|
Binary file
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"releaseAsset": "https://github.com/fwcd/tree-sitter-kotlin/releases/download/0.3.8/tree-sitter-kotlin.wasm"
|
|
7
7
|
},
|
|
8
8
|
"generatedWith": {
|
|
9
|
-
"treeSitterCli": "0.
|
|
9
|
+
"treeSitterCli": "0.27.0"
|
|
10
10
|
},
|
|
11
|
-
"sha256": "
|
|
11
|
+
"sha256": "7f522f2e3ef633735b3e2bdea165071b5ad0a99d6201e84acab49017590f812a"
|
|
12
12
|
}
|
package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/sql/tree-sitter-sql.wasm
CHANGED
|
Binary file
|
package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/sql/tree-sitter-sql.wasm.json
CHANGED
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
"repository": "https://github.com/derekstride/tree-sitter-sql"
|
|
6
6
|
},
|
|
7
7
|
"generatedWith": {
|
|
8
|
-
"treeSitterCli": "0.
|
|
8
|
+
"treeSitterCli": "0.27.0"
|
|
9
9
|
},
|
|
10
|
-
"sha256": "
|
|
10
|
+
"sha256": "e03fb5079e88cfe0807056c284fd2b0589cee35df9bbb3d07e72f2f4178de8de",
|
|
11
11
|
"trust": {
|
|
12
12
|
"note": "The @derekstride/tree-sitter-sql npm package is a devDependency only. It is never resolved at runtime; the vendored WASM above is the sole runtime artifact. This workspace explicitly disables the package's npx-based install script via pnpm allowBuilds. The WASM was built locally from the installed package source. See scripts/generate-sql-wasm.mjs for the rebuild procedure.",
|
|
13
13
|
"alternativesConsidered": [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mrclrchtr/supi-code-intelligence",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.3.0",
|
|
4
4
|
"description": "LSP and AST navigation, search, diagnostics, and refactoring",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -35,10 +35,10 @@
|
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"yaml": "^2.9.0",
|
|
38
|
-
"@mrclrchtr/supi-code-runtime": "6.
|
|
39
|
-
"@mrclrchtr/supi-
|
|
40
|
-
"@mrclrchtr/supi-
|
|
41
|
-
"@mrclrchtr/supi-
|
|
38
|
+
"@mrclrchtr/supi-code-runtime": "6.3.0",
|
|
39
|
+
"@mrclrchtr/supi-core": "6.3.0",
|
|
40
|
+
"@mrclrchtr/supi-tree-sitter": "6.3.0",
|
|
41
|
+
"@mrclrchtr/supi-lsp": "6.3.0"
|
|
42
42
|
},
|
|
43
43
|
"bundledDependencies": [
|
|
44
44
|
"@mrclrchtr/supi-code-runtime",
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
isCodeRequestInterruption,
|
|
4
4
|
} from "@mrclrchtr/supi-code-runtime/api";
|
|
5
5
|
import {
|
|
6
|
-
|
|
6
|
+
emptyProcessCrashRecoveryReport,
|
|
7
7
|
type WorkspaceDiagnosticReport,
|
|
8
8
|
type WorkspaceLspRuntime,
|
|
9
9
|
} from "@mrclrchtr/supi-lsp/api";
|
|
@@ -71,7 +71,7 @@ async function collectFileRefreshAttempt(
|
|
|
71
71
|
attemptedActiveClients: readiness.kind === "ready" ? 1 : 0,
|
|
72
72
|
fileReadiness,
|
|
73
73
|
restartedClients: 0,
|
|
74
|
-
processCrashRecovery: readiness.processCrashRecovery ??
|
|
74
|
+
processCrashRecovery: readiness.processCrashRecovery ?? emptyProcessCrashRecoveryReport(),
|
|
75
75
|
staleAssessment: {
|
|
76
76
|
scope: "file",
|
|
77
77
|
suspected: null,
|
|
@@ -107,6 +107,7 @@ async function collectWorkspaceRefreshAttempt(
|
|
|
107
107
|
requestedDiagnosticScope: options.diagnosticsScope,
|
|
108
108
|
operationScope: "workspace-runtime",
|
|
109
109
|
diagnosticEvidence: maintenance.diagnosticEvidence,
|
|
110
|
+
processCrashRecovery: emptyProcessCrashRecoveryReport(),
|
|
110
111
|
reason: maintenance.failureReason,
|
|
111
112
|
},
|
|
112
113
|
};
|
|
@@ -185,6 +186,7 @@ async function collectWorkspaceRefreshAttempt(
|
|
|
185
186
|
requestedDiagnosticScope: options.diagnosticsScope,
|
|
186
187
|
operationScope: "workspace-runtime",
|
|
187
188
|
diagnosticEvidence: maintenance.diagnosticEvidence,
|
|
189
|
+
processCrashRecovery: emptyProcessCrashRecoveryReport(),
|
|
188
190
|
reason: errorMessage(error),
|
|
189
191
|
},
|
|
190
192
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type {
|
|
2
2
|
DiagnosticEvidenceSummary,
|
|
3
3
|
FileScopeDecision,
|
|
4
|
-
|
|
4
|
+
ProcessCrashRecoveryReport,
|
|
5
5
|
ProjectServerInfo,
|
|
6
6
|
ProjectServerStatusReason,
|
|
7
7
|
} from "@mrclrchtr/supi-lsp/api";
|
|
@@ -112,7 +112,7 @@ interface CompletedHealthRefreshAttempt {
|
|
|
112
112
|
/** Clients restarted by stale-diagnostic recovery. */
|
|
113
113
|
readonly restartedClients: number;
|
|
114
114
|
/** Separate outcome for process-crash route recovery. */
|
|
115
|
-
readonly processCrashRecovery:
|
|
115
|
+
readonly processCrashRecovery: ProcessCrashRecoveryReport;
|
|
116
116
|
readonly staleAssessment: HealthStaleAssessment;
|
|
117
117
|
}
|
|
118
118
|
|
|
@@ -143,7 +143,7 @@ export type HealthRefreshAttempt =
|
|
|
143
143
|
/** Evidence collected before the operation failed, when available. */
|
|
144
144
|
readonly diagnosticEvidence?: DiagnosticEvidenceSummary;
|
|
145
145
|
/** Process-crash outcome, when the recovery pass returned one. */
|
|
146
|
-
readonly processCrashRecovery?:
|
|
146
|
+
readonly processCrashRecovery?: ProcessCrashRecoveryReport;
|
|
147
147
|
/** File readiness outcome, when a file-scoped attempt failed. */
|
|
148
148
|
readonly fileReadiness?: HealthFileReadiness;
|
|
149
149
|
readonly reason: string;
|
|
@@ -150,7 +150,8 @@ export function registerLspSettings(pi: ExtensionAPI): void {
|
|
|
150
150
|
kind: "stringList" as const,
|
|
151
151
|
key: "exclude",
|
|
152
152
|
label: "Exclude Patterns",
|
|
153
|
-
description:
|
|
153
|
+
description:
|
|
154
|
+
"Comma-separated gitignore patterns for automatic LSP workspace work. Exact file requests stay available.",
|
|
154
155
|
},
|
|
155
156
|
{
|
|
156
157
|
kind: "custom" as const,
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {
|
|
2
|
+
ProcessCrashRecoveryEntry,
|
|
3
|
+
ProcessCrashRecoveryReport,
|
|
4
|
+
} from "@mrclrchtr/supi-lsp/api";
|
|
2
5
|
import type { SemanticHealthState } from "../../session/health-types.ts";
|
|
3
6
|
|
|
4
7
|
/** Report whether a file health result is waiting for semantic readiness. */
|
|
@@ -21,17 +24,44 @@ export function formatStaleDiagnosticRestarts(restartedClients: number): string
|
|
|
21
24
|
return `stale diagnostic restarts: ${restartedClients} client${plural(restartedClients)} restarted`;
|
|
22
25
|
}
|
|
23
26
|
|
|
24
|
-
/** Format
|
|
25
|
-
export function
|
|
26
|
-
|
|
27
|
+
/** Format process-crash counts for the compact health view. */
|
|
28
|
+
export function formatCompactProcessCrashRecovery(
|
|
29
|
+
report: ProcessCrashRecoveryReport | null | undefined,
|
|
27
30
|
): string | null {
|
|
28
31
|
if (
|
|
29
|
-
!
|
|
30
|
-
(
|
|
32
|
+
!report ||
|
|
33
|
+
(report.recoveredRoutes === 0 &&
|
|
34
|
+
report.skippedRoutes === 0 &&
|
|
35
|
+
report.failedRoutes === 0 &&
|
|
36
|
+
report.exhaustedRoutes === 0)
|
|
31
37
|
) {
|
|
32
38
|
return null;
|
|
33
39
|
}
|
|
34
|
-
return `process-crash recovery: ${
|
|
40
|
+
return `process-crash recovery: ${report.recoveredRoutes} route${plural(report.recoveredRoutes)} recovered (${report.skippedRoutes} skipped, ${report.failedRoutes} failed, ${report.exhaustedRoutes} exhausted)`;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** Format process-crash counts and bounded route entries for detailed health output. */
|
|
44
|
+
export function formatProcessCrashRecovery(
|
|
45
|
+
report: ProcessCrashRecoveryReport | null | undefined,
|
|
46
|
+
): string | null {
|
|
47
|
+
const summary = formatCompactProcessCrashRecovery(report);
|
|
48
|
+
if (!summary || !report) return summary;
|
|
49
|
+
const entries = report.entries.map(formatProcessCrashRecoveryEntry);
|
|
50
|
+
const omitted =
|
|
51
|
+
report.omittedEntries > 0
|
|
52
|
+
? `${report.omittedEntries} more route${plural(report.omittedEntries)}`
|
|
53
|
+
: null;
|
|
54
|
+
const details = [...entries, omitted]
|
|
55
|
+
.filter((value): value is string => value !== null)
|
|
56
|
+
.join("; ");
|
|
57
|
+
return details ? `${summary}; ${details}` : summary;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function formatProcessCrashRecoveryEntry(entry: ProcessCrashRecoveryEntry): string {
|
|
61
|
+
const outcome = entry.outcome.replaceAll("-", " ");
|
|
62
|
+
const action = entry.nextAction ? `; next: ${entry.nextAction.replaceAll("-", " ")}` : "";
|
|
63
|
+
const failure = entry.failureMessage ? `; ${entry.failureMessage}` : "";
|
|
64
|
+
return `${entry.name} @ ${entry.root}: ${outcome}${action}${failure}`;
|
|
35
65
|
}
|
|
36
66
|
|
|
37
67
|
/** Format the age of a retained refresh attempt for a status line. */
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
import type { ProcessCrashRecoverySummary } from "@mrclrchtr/supi-lsp/api";
|
|
2
1
|
import {
|
|
2
|
+
MAX_PROCESS_CRASH_RECOVERY_ENTRIES,
|
|
3
|
+
type ProcessCrashRecoveryEntry,
|
|
4
|
+
type ProcessCrashRecoveryOutcome,
|
|
5
|
+
type ProcessCrashRecoveryReport,
|
|
6
|
+
} from "@mrclrchtr/supi-lsp/api";
|
|
7
|
+
import {
|
|
8
|
+
formatCompactProcessCrashRecovery,
|
|
3
9
|
formatProcessCrashRecovery,
|
|
4
10
|
formatStaleDiagnosticRestarts,
|
|
5
11
|
isFileReadinessPending,
|
|
@@ -82,7 +88,7 @@ export function readCompactRefreshStatus(data: Record<string, unknown> | null):
|
|
|
82
88
|
const refresh = readRecord(data?.refresh);
|
|
83
89
|
if (!refresh || (refresh.kind !== "completed" && refresh.kind !== "failed")) return null;
|
|
84
90
|
|
|
85
|
-
const processCrashRecovery =
|
|
91
|
+
const processCrashRecovery = formatCompactProcessCrashRecovery(
|
|
86
92
|
readProcessCrashRecovery(refresh.processCrashRecovery),
|
|
87
93
|
);
|
|
88
94
|
if (refresh.kind === "failed") {
|
|
@@ -117,7 +123,7 @@ export function readPreviousRefreshStatus(data: Record<string, unknown> | null):
|
|
|
117
123
|
const attempt = readRecord(refresh.lastAttempt);
|
|
118
124
|
if (!attempt) return null;
|
|
119
125
|
const evidence = formatCompactDiagnosticEvidence(readRecord(attempt.diagnosticEvidence));
|
|
120
|
-
const processCrashRecovery =
|
|
126
|
+
const processCrashRecovery = formatCompactProcessCrashRecovery(
|
|
121
127
|
readProcessCrashRecovery(attempt.processCrashRecovery),
|
|
122
128
|
);
|
|
123
129
|
const staleRestart = formatStaleDiagnosticRestartsForRecord(attempt);
|
|
@@ -207,20 +213,60 @@ export function isPendingFileReadiness(data: Record<string, unknown> | null): bo
|
|
|
207
213
|
return isFileReadinessPending(attempt, readSemanticHealthState(data?.semanticState));
|
|
208
214
|
}
|
|
209
215
|
|
|
210
|
-
function readProcessCrashRecovery(value: unknown):
|
|
211
|
-
const
|
|
212
|
-
if (!
|
|
213
|
-
const
|
|
214
|
-
const
|
|
215
|
-
const failedRoutes =
|
|
216
|
+
function readProcessCrashRecovery(value: unknown): ProcessCrashRecoveryReport | null {
|
|
217
|
+
const report = readRecord(value);
|
|
218
|
+
if (!report) return null;
|
|
219
|
+
const recoveredRoutes = report.recoveredRoutes;
|
|
220
|
+
const skippedRoutes = report.skippedRoutes;
|
|
221
|
+
const failedRoutes = report.failedRoutes;
|
|
222
|
+
const exhaustedRoutes = report.exhaustedRoutes;
|
|
223
|
+
const omittedEntries = report.omittedEntries;
|
|
216
224
|
if (
|
|
217
|
-
!isEvidenceCount(attemptedRoutes) ||
|
|
218
225
|
!isEvidenceCount(recoveredRoutes) ||
|
|
219
|
-
!isEvidenceCount(
|
|
226
|
+
!isEvidenceCount(skippedRoutes) ||
|
|
227
|
+
!isEvidenceCount(failedRoutes) ||
|
|
228
|
+
!isEvidenceCount(exhaustedRoutes) ||
|
|
229
|
+
!isEvidenceCount(omittedEntries) ||
|
|
230
|
+
!Array.isArray(report.entries) ||
|
|
231
|
+
report.entries.length > MAX_PROCESS_CRASH_RECOVERY_ENTRIES
|
|
232
|
+
) {
|
|
233
|
+
return null;
|
|
234
|
+
}
|
|
235
|
+
const entries = report.entries
|
|
236
|
+
.map(readProcessCrashRecoveryEntry)
|
|
237
|
+
.filter((entry): entry is ProcessCrashRecoveryEntry => entry !== null);
|
|
238
|
+
if (entries.length !== report.entries.length) return null;
|
|
239
|
+
return { recoveredRoutes, skippedRoutes, failedRoutes, exhaustedRoutes, entries, omittedEntries };
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
function readProcessCrashRecoveryEntry(value: unknown): ProcessCrashRecoveryEntry | null {
|
|
243
|
+
const entry = readRecord(value);
|
|
244
|
+
if (!entry || typeof entry.name !== "string" || typeof entry.root !== "string") return null;
|
|
245
|
+
if (!isProcessCrashRecoveryOutcome(entry.outcome)) return null;
|
|
246
|
+
if (
|
|
247
|
+
entry.nextAction !== undefined &&
|
|
248
|
+
entry.nextAction !== "use-exact-file" &&
|
|
249
|
+
entry.nextAction !== "reload-workspace"
|
|
220
250
|
) {
|
|
221
251
|
return null;
|
|
222
252
|
}
|
|
223
|
-
|
|
253
|
+
if (entry.failureMessage !== undefined && typeof entry.failureMessage !== "string") return null;
|
|
254
|
+
return {
|
|
255
|
+
name: entry.name,
|
|
256
|
+
root: entry.root,
|
|
257
|
+
outcome: entry.outcome,
|
|
258
|
+
...(entry.nextAction !== undefined ? { nextAction: entry.nextAction } : {}),
|
|
259
|
+
...(entry.failureMessage !== undefined ? { failureMessage: entry.failureMessage } : {}),
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
function isProcessCrashRecoveryOutcome(value: unknown): value is ProcessCrashRecoveryOutcome {
|
|
264
|
+
return (
|
|
265
|
+
value === "recovered" ||
|
|
266
|
+
value === "skipped-no-retained-file" ||
|
|
267
|
+
value === "recovery-failed" ||
|
|
268
|
+
value === "recovery-exhausted"
|
|
269
|
+
);
|
|
224
270
|
}
|
|
225
271
|
|
|
226
272
|
function readEvidenceCounts(evidence: Record<string, unknown> | null): number[] | null {
|