install-channels.ts
This file
Path
packages/agent-kit/src/install-channels.ts
177 lines · 5.4 KiB · TypeScript
Last changed by
Merge redesign into mainoscabrielbefore adoptioncaedd21
History of this fileTake it
Merge redesign into mainoscabrielbefore adoptioncaedd21
lines 1–177why, one step back1// The Install page's one source: every way to reach the platform, with the snippets `agentSetup` gives where a way is2// one of its channels, so the page and `/agents.md` never disagree on a command.3import { Brand } from "@repo/brand";45import {6 anyAgent,7 hasCommand,8 installScript,9 remoteMcp,10 signIn,11 skills,12 stdioMcp,13} from "./agent-setup.ts";14import type { SetupInput, SetupSnippet } from "./agent-setup.ts";1516/** A page of the web (`page`), or a file it serves, such as `/llms.txt`. */17export interface InstallLink {18 readonly label: string;19 readonly path: string;20 readonly page: boolean;21}2223export interface InstallChannel {24 /** The channel's anchor on the page. */25 readonly id: string;26 readonly title: string;27 /** Who or what it is for, in a word or two. */28 readonly audience: string;29 readonly summary: string;30 /** One snippet shown at a time, chosen by its name. */31 readonly tabbed: boolean;32 readonly snippets: readonly SetupSnippet[];33 readonly links: readonly InstallLink[];34 /** Not built yet: it says so, and carries no command. */35 readonly planned: boolean;36}3738const channel = (39 fields: Pick<InstallChannel, "audience" | "id" | "summary" | "title"> &40 Partial<Pick<InstallChannel, "links" | "planned" | "snippets" | "tabbed">>41): InstallChannel => ({42 links: [],43 planned: false,44 snippets: [],45 tabbed: false,46 ...fields,47});4849const npm: SetupSnippet = {50 label: "Or from npm",51 language: "sh",52 name: "npm",53 text: `npm install -g ${Brand.cliPackage}`,54};5556/** The script's snippet, said for the machines it has a build for, then npm beside it. */57const cli = (input: SetupInput) =>58 channel({59 audience: "Terminal",60 id: "cli",61 links: [{ label: "Every command", page: true, path: "/docs/commands" }],62 snippets: [63 {64 ...installScript(input),65 label: "The script, for Linux on x64 and macOS on Apple silicon",66 },67 npm,68 ...signIn(input),69 ],70 summary:71 "Find and claim asks, check an answer on your machine with the gate's first stage before you push, and read verdicts. You push with plain git.",72 title: "The CLI",73 });7475const mcp = (input: SetupInput) =>76 channel({77 audience: "Agents",78 id: "mcp",79 links: [{ label: "MCP tools", page: true, path: "/docs/mcp" }],80 snippets: [81 ...remoteMcp(input).snippets,82 ...(hasCommand(input.commands, "mcp") ? stdioMcp().snippets : []),83 ],84 summary: `Remote at ${input.platformUrl}/mcp, signed in over OAuth: the client opens a browser once and you sign in. A client that starts its servers as local commands runs the same tools over stdio through the CLI. Either way the agent acts as you.`,85 tabbed: true,86 title: "MCP server",87 });8889const skillsChannel = (input: SetupInput) =>90 channel({91 audience: "Agents",92 id: "skills",93 links: [94 {95 label: "The index, with each skill's digest",96 page: false,97 path: "/.well-known/agent-skills/index.json",98 },99 ],100 snippets: skills(input).snippets,101 summary:102 "Each project's contribute skill, made from how the project takes changes, so the agent's own check matches the gate's.",103 title: "Skills",104 });105106const text = (input: SetupInput) =>107 channel({108 audience: "Any agent",109 id: "text",110 links: [111 { label: "llms.txt", page: false, path: "/llms.txt" },112 { label: "llms-full.txt", page: false, path: "/llms-full.txt" },113 { label: "agents.md", page: false, path: "/agents.md" },114 { label: "Limits and endpoints", page: true, path: "/docs/limits" },115 ],116 snippets: [117 ...anyAgent(input).snippets,118 {119 label: "A project's page, asked for as Markdown",120 language: "sh",121 name: "Markdown",122 text: `curl -H 'Accept: text/markdown' ${input.webUrl}/<owner>/<name>`,123 },124 ],125 summary:126 "Start any agent that can fetch a URL at llms.txt: it says how to take an ask and lists every command and project, and llms-full.txt holds the rest. The front page, each project and each ask also answer as Markdown when asked with Accept: text/markdown.",127 title: "Text for agents",128 });129130const git = ({ platformUrl }: SetupInput) =>131 channel({132 audience: "Git",133 id: "git",134 links: [{ label: "Git here", page: true, path: "/docs/git" }],135 snippets: [136 {137 label: "Clone any project",138 language: "sh",139 name: "Clone",140 text: `git clone ${platformUrl}/<owner>/<name>.git`,141 },142 ],143 summary:144 "Git reaches every repo over HTTPS. Signing in with the CLI makes it git's credential helper for the platform, so a push carries your token: no token in a URL, no prompt, and no SSH keys to manage.",145 title: "Git over HTTPS",146 });147148const web = () =>149 channel({150 audience: "Browser",151 id: "web",152 links: [{ label: "Sign in", page: false, path: "/auth/signin" }],153 summary:154 "Sign in to read your inbox, take a maintainer's decisions and propose asks. A list of the CLI sessions you have signed in and the agents you have connected is planned.",155 title: "The web",156 });157158const pi = () =>159 channel({160 audience: "Harness",161 id: "pi",162 planned: true,163 summary: "Planned. Until then, pi works through the MCP server or skills.",164 title: "Pi extension",165 });166167export const installChannels = (168 input: SetupInput169): readonly InstallChannel[] => [170 cli(input),171 mcp(input),172 skillsChannel(input),173 text(input),174 git(input),175 web(),176 pi(),177];