forked from CopilotKit/CopilotKit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathregistry.ts
More file actions
87 lines (73 loc) · 2.03 KB
/
Copy pathregistry.ts
File metadata and controls
87 lines (73 loc) · 2.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
import registryData from "@/data/registry.json";
export interface Feature {
id: string;
name: string;
category: string;
description: string;
}
export interface FeatureCategory {
id: string;
name: string;
}
export interface Demo {
id: string;
name: string;
description: string;
tags: string[];
route: string;
animated_preview_url?: string | null;
}
export interface Integration {
name: string;
slug: string;
category: string;
language: string;
logo?: string;
description: string;
partner_docs: string | null;
repo: string;
copilotkit_version: string;
backend_url: string;
deployed: boolean;
sort_order?: number;
features: string[];
demos: Demo[];
}
export interface Registry {
feature_registry: {
version: string;
categories: FeatureCategory[];
features: Feature[];
};
integrations: Integration[];
}
const registry = registryData as Registry;
// Hide registry entries with no dojo route. Kept in the registry so
// harness/parity/dashboard still see them.
const HIDDEN_DOJO_FEATURE_IDS = new Set<string>(["cli-start"]);
function withVisibleDemos(integration: Integration): Integration {
const visible = integration.demos.filter(
(d) => !HIDDEN_DOJO_FEATURE_IDS.has(d.id),
);
if (visible.length === integration.demos.length) return integration;
return { ...integration, demos: visible };
}
export function getRegistry(): Registry {
return registry;
}
export function getIntegrations(): Integration[] {
return registry.integrations.map(withVisibleDemos);
}
export function getIntegration(slug: string): Integration | undefined {
const found = registry.integrations.find((i) => i.slug === slug);
return found ? withVisibleDemos(found) : undefined;
}
export function getFeatures(): Feature[] {
return registry.feature_registry.features;
}
export function getFeature(id: string): Feature | undefined {
return registry.feature_registry.features.find((f) => f.id === id);
}
export function getFeatureCategories(): FeatureCategory[] {
return registry.feature_registry.categories;
}