MCPcopy
hub / github.com/MetaCubeX/metacubexd / refresh

Function refresh

packages/ui/composables/useProfileStatus.ts:26–45  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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.
26async 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
47function probe(): void {
48 if (started) return

Callers 1

probeFunction · 0.70

Calls 3

useControlInfoFunction · 0.90
useControlApiFunction · 0.90
hasFeatureFunction · 0.85

Tested by

no test coverage detected