@danypops/pi-lector 0.1.8 → 0.1.9
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/extension/src/index.ts
CHANGED
|
@@ -64,7 +64,13 @@ import { createLectorRepoFetchOperations } from "./repo-fetch-operations.ts";
|
|
|
64
64
|
import { formatRepoFetchCall, formatRepoFetchResult } from "./repo-fetch-rendering.ts";
|
|
65
65
|
import { createLectorSearchOperations } from "./search-operations.ts";
|
|
66
66
|
import { formatSearchCall, formatSearchResult } from "./search-rendering.ts";
|
|
67
|
-
import {
|
|
67
|
+
import {
|
|
68
|
+
type CachePresentationState,
|
|
69
|
+
cacheContextMessage,
|
|
70
|
+
createWorkspaceCacheOperations,
|
|
71
|
+
describeCacheState,
|
|
72
|
+
monitorWorkspaceCache,
|
|
73
|
+
} from "./workspace-cache-operations.ts";
|
|
68
74
|
import { createLectorWriteOperations } from "./write-operations.ts";
|
|
69
75
|
|
|
70
76
|
function describeIntelligenceSource(provenance: IntelligenceProvenance): string {
|
|
@@ -99,13 +105,6 @@ export default function (pi: ExtensionAPI) {
|
|
|
99
105
|
let cacheState: CachePresentationState | undefined;
|
|
100
106
|
let lastInjectedCacheState: string | undefined;
|
|
101
107
|
|
|
102
|
-
function describeCacheState(state: CachePresentationState): string {
|
|
103
|
-
if (state.status === "not-cached") return `not cached (${state.reason})`;
|
|
104
|
-
if (state.status === "caching") return `caching (job ${state.jobId})`;
|
|
105
|
-
if (state.status === "finished-caching") return `finished caching (job ${state.job.id})`;
|
|
106
|
-
return "cached";
|
|
107
|
-
}
|
|
108
|
-
|
|
109
108
|
pi.on("before_agent_start", () => {
|
|
110
109
|
if (!cacheState) return;
|
|
111
110
|
const description = describeCacheState(cacheState);
|
|
@@ -114,7 +113,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
114
113
|
return {
|
|
115
114
|
message: {
|
|
116
115
|
customType: "lector-cache-status",
|
|
117
|
-
content:
|
|
116
|
+
content: cacheContextMessage(cacheState),
|
|
118
117
|
display: false,
|
|
119
118
|
},
|
|
120
119
|
};
|
|
@@ -46,6 +46,20 @@ export type CachePresentationState =
|
|
|
46
46
|
| { readonly status: "finished-caching"; readonly job: JobSnapshot<PopulateSymbolGraphResult> & { readonly status: "succeeded" } }
|
|
47
47
|
| { readonly status: "cached" };
|
|
48
48
|
|
|
49
|
+
export function describeCacheState(state: CachePresentationState): string {
|
|
50
|
+
if (state.status === "not-cached") return `not cached (${state.reason})`;
|
|
51
|
+
if (state.status === "caching") return `caching (job ${state.jobId})`;
|
|
52
|
+
if (state.status === "finished-caching") return `finished caching (job ${state.job.id})`;
|
|
53
|
+
return "cached";
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export function cacheContextMessage(state: CachePresentationState): string {
|
|
57
|
+
const prefix = `Lector workspace cache: ${describeCacheState(state)}.`;
|
|
58
|
+
if (state.status === "not-cached") return `${prefix} Live code-intelligence operations remain available.`;
|
|
59
|
+
if (state.status === "caching") return `${prefix} The cached graph is still building; use live code-intelligence operations until it is ready.`;
|
|
60
|
+
return `${prefix} The cached graph is ready.`;
|
|
61
|
+
}
|
|
62
|
+
|
|
49
63
|
export interface MonitorWorkspaceCacheOptions {
|
|
50
64
|
readonly directory: string;
|
|
51
65
|
readonly maxFiles: number;
|