| 235 | |
| 236 | /** Fetch embedding coverage status for `/ctx-embed` via RPC. */ |
| 237 | export async function loadEmbedDetail(sessionId: string, directory: string): Promise<EmbedDetail> { |
| 238 | if (!rpcClient) return EMPTY_EMBED_DETAIL; |
| 239 | try { |
| 240 | const result = await rpcClient.call<EmbedDetail>("embed-detail", { |
| 241 | sessionId, |
| 242 | directory, |
| 243 | }); |
| 244 | if ((result as unknown as Record<string, unknown>).error) { |
| 245 | return EMPTY_EMBED_DETAIL; |
| 246 | } |
| 247 | return result; |
| 248 | } catch { |
| 249 | return EMPTY_EMBED_DETAIL; |
| 250 | } |
| 251 | } |
| 252 | |
| 253 | /** Get compartment count via RPC. */ |
| 254 | export async function getCompartmentCount(sessionId: string): Promise<number> { |