Skip to content
58 linesCodeBlameRaw
1import { connectorPath, connectorsFor } from "@g1t/contracts/connectors";
2import { CUSTOMIZE, type CustomizeSection, customizePath } from "@g1t/contracts/customize";
3import { FIRST_PARTY_EXTENSIONS } from "@g1t/contracts/marketplace";
4import { FOUNDATIONAL_SKILLS } from "@g1t/contracts/skills";
5
6/**
7 * Customize on the phone: Skills, Connectors and Plugins
8 * (packages/contracts/src/customize.ts). What is listed comes from the
9 * catalogs every g1t ships with; a workspace's own library, connections
10 * and installs are read on the site for now, and added here once the API
11 * serves them.
12 */
13
14export type CustomizeItem = {
15 id: string;
16 name: string;
17 description: string;
18 /** Available, Soon, or what else a listing says about itself. */
19 status: "available" | "soon" | "built-in";
20 /** A group to list it under. */
21 group: string;
22 /** The site page that sets it up, for this workspace. */
23 sitePath: string;
24};
25
26export function customizeItems(section: CustomizeSection, workspace: string): CustomizeItem[] {
27 const fallback = customizePath(section, workspace);
28 if (section === "skills") {
29 return FOUNDATIONAL_SKILLS.map((skill) => ({
30 id: skill.id,
31 name: skill.name,
32 description: skill.description,
33 status: "built-in" as const,
34 group: "In every agent",
35 sitePath: fallback,
36 }));
37 }
38 if (section === "connectors") {
39 return connectorsFor("workspace").map((connector) => ({
40 id: connector.id,
41 name: connector.name,
42 description: connector.description,
43 status: connector.status,
44 group: connector.status === "available" ? "Connect now" : "Coming",
45 sitePath: connector.href ? connectorPath(connector.href, workspace) : `${fallback}/${encodeURIComponent(connector.id)}`,
46 }));
47 }
48 return FIRST_PARTY_EXTENSIONS.map((extension) => ({
49 id: extension.id,
50 name: extension.name,
51 description: extension.tagline,
52 status: extension.status,
53 group: `${extension.publisher.name} · ${extension.category}`,
54 sitePath: `${fallback}/${encodeURIComponent(extension.id)}`,
55 }));
56}
57
58export { CUSTOMIZE, customizePath, type CustomizeSection };