()
| 24 | // DOUBLE-GUARDED on the agent capability so a direct call can never hit the |
| 25 | // network in web mode even if a caller forgets to gate. |
| 26 | async function refresh(): Promise<void> { |
| 27 | const { hasAgent, hasFeature } = useControlInfo() |
| 28 | if (!hasAgent.value || !hasFeature('profiles')) { |
| 29 | baseProfileCount.value = 0 |
| 30 | ready.value = true |
| 31 | return |
| 32 | } |
| 33 | try { |
| 34 | const list = await useControlApi().listProfiles() |
| 35 | baseProfileCount.value = list.filter( |
| 36 | (p: ProfileMeta) => p.type !== 'merge' && p.type !== 'script', |
| 37 | ).length |
| 38 | } catch { |
| 39 | // Unreachable kernel / 401 / network error: treat as "no profile" but never |
| 40 | // hang the gate. A later refresh() (after an import) re-counts. |
| 41 | baseProfileCount.value = 0 |
| 42 | } finally { |
| 43 | ready.value = true |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | function probe(): void { |
| 48 | if (started) return |
no test coverage detected