Return the currently-running index job, or null. Used by the * SPA on mount to resume polling after a page reload (Fix #14). * Returns null if the agent doesn't implement the endpoint * (older agents that pre-date Fix #14).
()
| 200 | * Returns null if the agent doesn't implement the endpoint |
| 201 | * (older agents that pre-date Fix #14). */ |
| 202 | async getActiveIndexJob(): Promise<IndexProgress | null> { |
| 203 | try { |
| 204 | return await this.get<IndexProgress | null>('/api/index-active'); |
| 205 | } catch (err) { |
| 206 | // 404 / 405 from an older agent: just behave as if there's no |
| 207 | // active job. The user will only miss "resume polling on |
| 208 | // reload" — everything else still works. |
| 209 | if (err instanceof Error && /404|405/.test(err.message)) return null; |
| 210 | throw err; |
| 211 | } |
| 212 | } |
| 213 | |
| 214 | async fetchGraph(query?: string, hops?: number): Promise<GraphData> { |
| 215 | const params: Record<string, string> = {}; |