| 1 | /** |
| 2 | * Customize: one place for what shapes how a workspace's agents work, in |
| 3 | * three parts. It is the Marketplace's successor, and what the phone app |
| 4 | * shows today; the site moves to it in its own change. |
| 5 | * |
| 6 | * - **Skills**: what agents know how to do, in the open SKILL.md format |
| 7 | * (./skill-library.ts): the foundational skills every agent has, and the |
| 8 | * workspace's library. |
| 9 | * - **Connectors**: what agents can reach: the tools a team already uses |
| 10 | * (./connectors.ts). Today's Marketplace integrations. |
| 11 | * - **Plugins**: what adds pages, cards, tools and agent roles to the |
| 12 | * workspace (./marketplace.ts's `ExtensionManifest`). Today's |
| 13 | * Marketplace extensions. |
| 14 | * |
| 15 | * A Marketplace listing (`integration:<id>`, `extension:<id>`) keeps its |
| 16 | * reference; {@link sectionOfListing} says which part shows it. No imports |
| 17 | * beyond types, so it runs anywhere: services, the site, the phone. |
| 18 | */ |
| 19 | |
| 20 | import type { ListingKind } from "./marketplace"; |
| 21 | |
| 22 | export type CustomizeSection = "skills" | "connectors" | "plugins"; |
| 23 | |
| 24 | export const CUSTOMIZE_SECTIONS: readonly CustomizeSection[] = ["skills", "connectors", "plugins"]; |
| 25 | |
| 26 | export type CustomizeSectionInfo = { |
| 27 | id: CustomizeSection; |
| 28 | title: string; |
| 29 | /** One line, for the section's row. */ |
| 30 | description: string; |
| 31 | /** Where the site manages it today, with `:workspace` to fill in. */ |
| 32 | sitePath: string; |
| 33 | }; |
| 34 | |
| 35 | export const CUSTOMIZE: Record<CustomizeSection, CustomizeSectionInfo> = { |
| 36 | skills: { |
| 37 | id: "skills", |
| 38 | title: "Skills", |
| 39 | description: "What agents know how to do: the skills every agent has, and your workspace's library.", |
| 40 | sitePath: "/:workspace/-/agents/skills", |
| 41 | }, |
| 42 | connectors: { |
| 43 | id: "connectors", |
| 44 | title: "Connectors", |
| 45 | description: "The tools your team already uses, connected so agents can work with their data.", |
| 46 | sitePath: "/:workspace/-/marketplace/integrations", |
| 47 | }, |
| 48 | plugins: { |
| 49 | id: "plugins", |
| 50 | title: "Plugins", |
| 51 | description: "Pages, cards, tools and agent roles for what your team does besides code.", |
| 52 | sitePath: "/:workspace/-/marketplace/extensions", |
| 53 | }, |
| 54 | }; |
| 55 | |
| 56 | /** The part of Customize that shows a Marketplace listing of this kind. */ |
| 57 | export function sectionOfListing(kind: ListingKind): CustomizeSection { |
| 58 | return kind === "integration" ? "connectors" : "plugins"; |
| 59 | } |
| 60 | |
| 61 | /** A section's site path with its workspace filled in. */ |
| 62 | export function customizePath(section: CustomizeSection, workspace: string): string { |
| 63 | return CUSTOMIZE[section].sitePath.replace(/:workspace\b/g, encodeURIComponent(workspace)); |
| 64 | } |