gesso-vite-plugin 0.6.30 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +28 -0
- package/dist/catalog-CbeOrdxD.d.ts +305 -0
- package/dist/contracts-Dwn5pg-0.js +1299 -0
- package/dist/contracts-Dwn5pg-0.js.map +1 -0
- package/dist/gesso-channels.mjs +322 -24
- package/dist/gesso-channels.mjs.map +1 -1
- package/dist/index.d.ts +42 -114
- package/dist/index.js +317 -710
- package/dist/index.js.map +1 -1
- package/dist/library.d.ts +56 -0
- package/dist/library.js +56 -0
- package/dist/library.js.map +1 -0
- package/package.json +5 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contracts-Dwn5pg-0.js","names":[],"sources":["../src/catalog.ts","../src/source.ts","../src/contracts.ts"],"sourcesContent":["import type { ComponentSchemaOut, ContractReader } from './contracts.ts';\n\n/**\n * The project's components, as tools an AI agent designs with.\n *\n * An agent asked for a settings screen will draw one from boxes unless\n * it knows the project already has a `SettingsRow`, a `Toggle` and a\n * `PageHeader`, what each takes, and where the others are used. Those\n * are the project's own: what its designers and its agents made, not a\n * kit the framework ships. So the catalog is read from the project's\n * source, by the checker that already describes its channels, and a\n * library joins it only when the project names one.\n *\n * Three tools, from cheap to complete, so an agent reads only what it\n * needs:\n *\n * library_overview every component, one line each\n * library_search the ones a few words find\n * library_get one, with every input it takes and where it is used\n *\n * They are answered on the dev server rather than in the page, because\n * the checker runs here and a page need not be open for an agent to\n * learn what it can build with.\n */\n\n/** One component in the catalog. */\nexport interface CatalogEntry {\n readonly name: string;\n /**\n * Where to import it from: the module's path from the project root\n * without its extension (`src/ui/Picker`), or the library's name.\n */\n readonly from: string;\n /** The library it came from, when it is not the project's own. */\n readonly library?: string;\n readonly schema: ComponentSchemaOut;\n /** Project files that write it as a tag, from the root, its own file left out. */\n readonly usedIn: readonly string[];\n}\n\nexport interface CatalogLibrary {\n /** The name it is imported by, such as `gesso-components`. */\n readonly name: string;\n /** The module that exports its components: its entry, resolved. */\n readonly file: string;\n}\n\nexport interface ComponentCatalogOptions {\n /** The tsconfig whose files are the project's source. */\n readonly tsconfig: string;\n /**\n * Libraries whose components join the project's own, resolved when the\n * catalog is first read. None by default.\n */\n readonly libraries?: () => Promise<readonly CatalogLibrary[]>;\n /**\n * Folders under the root whose files are not the project's\n * components nor uses of them, from the root: generated code, say,\n * which names the same components in another framework.\n */\n readonly exclude?: readonly string[];\n}\n\n/** A tool, in the shape MCP's `tools/list` returns. */\nexport interface CatalogTool {\n readonly name: string;\n readonly title: string;\n readonly description: string;\n readonly inputSchema: Record<string, unknown>;\n readonly annotations: { readonly readOnlyHint: true; readonly openWorldHint: false };\n}\n\n/** A tool's answer, in the shape MCP's `tools/call` returns. */\nexport interface CatalogResult {\n readonly content: readonly { readonly type: 'text'; readonly text: string }[];\n readonly structuredContent?: Record<string, unknown>;\n readonly isError: boolean;\n}\n\n/** What tells an agent, when it connects, that the catalog is here and to use it. */\nexport const CATALOG_INSTRUCTIONS =\n 'This project has its own components. Before building anything, read them: library_overview lists every one, ' +\n 'library_search finds the ones that fit, and library_get gives one in full with the inputs it takes. Use them, ' +\n \"and write the theme's names from tokens_view rather than raw colours and sizes.\";\n\nconst READ_ONLY = { readOnlyHint: true, openWorldHint: false } as const;\n\nexport const CATALOG_TOOLS: readonly CatalogTool[] = [\n {\n name: 'library_overview',\n title: \"List the project's components\",\n description:\n 'Every component this project has, one line each: its name, what it is for, where to import it from and how ' +\n 'many files use it. Read it before building anything, and use what is here.',\n inputSchema: { type: 'object', properties: {}, additionalProperties: false },\n annotations: READ_ONLY\n },\n {\n name: 'library_search',\n title: 'Find components',\n description:\n 'The components whose name, purpose or inputs match a few words, such as \"date range\" or \"avatar\". ' +\n 'Best matches first.',\n inputSchema: {\n type: 'object',\n properties: { query: { type: 'string', description: 'A few words for what the component should be or do.' } },\n required: ['query'],\n additionalProperties: false\n },\n annotations: READ_ONLY\n },\n {\n name: 'library_get',\n title: 'Read a component',\n description:\n 'One component in full: what it is for, every input it takes with its type, default and meaning, examples, ' +\n 'and the files that already use it, which show how this project writes it.',\n inputSchema: {\n type: 'object',\n properties: {\n name: { type: 'string', description: 'The component, as library_overview names it.' },\n from: {\n type: 'string',\n description: 'Where it is imported from, when two components share the name.'\n }\n },\n required: ['name'],\n additionalProperties: false\n },\n annotations: READ_ONLY\n }\n];\n\nexport class ComponentCatalog {\n private cached: Promise<readonly CatalogEntry[]> | null = null;\n private readonly reader: () => Promise<ContractReader | null>;\n private readonly root: string;\n private readonly options: ComponentCatalogOptions;\n\n constructor(reader: () => Promise<ContractReader | null>, root: string, options: ComponentCatalogOptions) {\n this.reader = reader;\n this.root = root.replace(/\\/+$/, '');\n this.options = options;\n }\n\n /**\n * Something in the project changed. The whole catalog is read again\n * on the next call: a project's components read in a tenth of a\n * second, and a save can move a component between files, rename it,\n * or start using it somewhere else.\n */\n invalidate(): void {\n this.cached = null;\n }\n\n /**\n * The components, read once until something changes. A read that\n * fails (TypeScript refusing a project mid-change) is a warning and an\n * empty catalog, tried again on the next call, never a rejection left\n * for nobody to catch, which ends the dev server.\n */\n entries(): Promise<readonly CatalogEntry[]> {\n return (this.cached ??= this.read().catch((error: unknown) => {\n this.cached = null;\n console.warn(`[gesso] The component catalog could not be read: ${String((error as Error).message ?? error)}`);\n return [];\n }));\n }\n\n async call(name: string, args: Readonly<Record<string, unknown>> = {}): Promise<CatalogResult> {\n const reader = await this.reader();\n if (reader === null) {\n return failure('The catalog needs TypeScript 7, which reads the components. Add `typescript` (7 or later).');\n }\n const entries = await this.entries();\n switch (name) {\n case 'library_overview':\n return success(formatOverview(entries), { components: entries.map(summaryOf) });\n case 'library_search': {\n if (typeof args.query !== 'string' || args.query.trim() === '') {\n return failure('library_search needs query: a few words for what the component should be or do.');\n }\n const found = search(entries, args.query);\n if (found.length === 0) {\n return success(`Nothing matches \"${args.query}\". library_overview lists every component.`, {\n components: []\n });\n }\n return success(formatLines(found), { components: found.map(summaryOf) });\n }\n case 'library_get': {\n if (typeof args.name !== 'string') {\n return failure('library_get needs name: the component, as library_overview names it.');\n }\n const named = entries.filter(entry => entry.name === args.name);\n const matches = typeof args.from === 'string' ? named.filter(entry => entry.from === args.from) : named;\n if (matches.length === 0) {\n const near = search(entries, args.name).slice(0, 3);\n return failure(\n `There is no component called ${args.name}` +\n (near.length === 0 ? '.' : `. Did you mean ${near.map(entry => entry.name).join(', ')}?`)\n );\n }\n if (matches.length > 1) {\n return failure(\n `${matches.length} components are called ${args.name}; say which with from: ` +\n matches.map(entry => JSON.stringify(entry.from)).join(', ')\n );\n }\n const entry = matches[0]!;\n return success(formatEntry(entry), { ...entry, schema: entry.schema } as unknown as Record<string, unknown>);\n }\n default:\n return failure(`There is no tool called ${name}.`);\n }\n }\n\n private async read(): Promise<readonly CatalogEntry[]> {\n const reader = await this.reader();\n if (reader === null) {\n return [];\n }\n const excluded = (this.options.exclude ?? []).map(folder => `${this.root}/${folder.replace(/^\\.?\\/+|\\/+$/g, '')}/`);\n const sources = reader\n .sources(this.options.tsconfig)\n .filter(\n source =>\n source.file.startsWith(`${this.root}/`) &&\n !/\\.(?:spec|test)\\.[cm]?[jt]sx?$/.test(source.file) &&\n !excluded.some(folder => source.file.startsWith(folder))\n );\n const found: { name: string; from: string; library?: string; file?: string; schema: ComponentSchemaOut }[] = [];\n for (const source of sources) {\n if (!mayDeclareComponent(source.text)) {\n continue;\n }\n const from = source.file.slice(this.root.length + 1).replace(/\\.[cm]?[jt]sx?$/, '');\n for (const [name, schema] of reader.readComponents(source.file, this.options.tsconfig).components) {\n found.push({ name, from, file: source.file, schema });\n }\n }\n for (const library of (await this.options.libraries?.()) ?? []) {\n for (const [name, schema] of reader.readComponents(library.file).components) {\n found.push({ name, from: library.name, library: library.name, schema });\n }\n }\n return found.map(component => {\n const tag = new RegExp(`<${component.name}[\\\\s/>]`);\n const usedIn = sources\n .filter(source => source.file !== component.file && tag.test(source.text))\n .map(source => source.file.slice(this.root.length + 1));\n return {\n name: component.name,\n from: component.from,\n ...(component.library === undefined ? {} : { library: component.library }),\n schema: component.schema,\n usedIn\n };\n });\n }\n}\n\n/**\n * Whether a module could declare a component, without asking the\n * checker: it imports from `gesso-framework` and names `Inputs` or\n * `Component`. Most of a project's files are neither, and each one the\n * checker is spared is a round trip to its process.\n */\nexport function mayDeclareComponent(text: string): boolean {\n return text.includes('gesso-framework') && /\\b(?:Inputs|Component)\\b/.test(text);\n}\n\nfunction summaryOf(entry: CatalogEntry): Record<string, unknown> {\n return {\n name: entry.name,\n from: entry.from,\n ...(entry.library === undefined ? {} : { library: entry.library }),\n ...(entry.schema.summary === undefined ? {} : { summary: entry.schema.summary }),\n ...(entry.schema.deprecated === undefined ? {} : { deprecated: entry.schema.deprecated }),\n usedIn: entry.usedIn.length\n };\n}\n\nfunction formatOverview(entries: readonly CatalogEntry[]): string {\n if (entries.length === 0) {\n return (\n 'This project has no components yet: no module exports a function taking Inputs<P>, or a class extending ' +\n 'Component. Build the first ones, and they will be listed here.'\n );\n }\n const own = entries.filter(entry => entry.library === undefined);\n const lines = [\n `${own.length} component${own.length === 1 ? '' : 's'} in this project` +\n (own.length === entries.length ? '' : `, and ${entries.length - own.length} from libraries it names`) +\n '. library_get gives one in full.',\n ''\n ];\n return [...lines, formatLines(entries)].join('\\n');\n}\n\n/** One line per component, grouped under where each is imported from. */\nfunction formatLines(entries: readonly CatalogEntry[]): string {\n const groups = new Map<string, CatalogEntry[]>();\n for (const entry of entries) {\n const group = groups.get(entry.from) ?? [];\n group.push(entry);\n groups.set(entry.from, group);\n }\n const lines: string[] = [];\n for (const [from, group] of groups) {\n lines.push(group[0]!.library === undefined ? from : `${from} (library)`);\n for (const entry of group) {\n const summary = firstSentence(entry.schema.summary);\n const deprecated = entry.schema.deprecated === undefined ? '' : ' [deprecated]';\n const used = entry.usedIn.length === 0 ? '' : ` (used in ${entry.usedIn.length})`;\n lines.push(` ${entry.name}${deprecated}${summary === '' ? '' : `: ${summary}`}${used}`);\n }\n }\n return lines.join('\\n');\n}\n\ninterface InputSchema {\n readonly properties?: Record<string, Record<string, unknown>>;\n readonly required?: readonly string[];\n}\n\n/**\n * One component as an agent writing TSX wants it: the import, each\n * input as `name type = default` with its meaning under it, the shared\n * inputs folded into a line, and the files to copy its use from. The schema itself\n * goes with it as structured content, for a client that validates.\n */\nfunction formatEntry(entry: CatalogEntry): string {\n const schema = entry.schema;\n const lines = [`${entry.name}, from ${entry.from}${entry.library === undefined ? '' : ' (library)'}`];\n if (schema.deprecated !== undefined) {\n lines.push(`Deprecated${schema.deprecated === true ? '.' : `: ${schema.deprecated}`}`);\n }\n if (schema.summary !== undefined) {\n lines.push(schema.summary);\n }\n const inputs = schema.inputs as InputSchema;\n const required = new Set(inputs.required ?? []);\n const own: string[] = [];\n const shared = new Map<string, string[]>();\n for (const [name, input] of Object.entries(inputs.properties ?? {})) {\n const from = input['x-gesso-from'];\n if (typeof from === 'string') {\n shared.set(from, [...(shared.get(from) ?? []), name]);\n continue;\n }\n own.push(` ${name}${required.has(name) ? '*' : ''} ${describeInput(input)}`);\n }\n lines.push('', own.length === 0 ? 'Inputs: none of its own.' : 'Inputs (* required):', ...own);\n for (const [from, names] of shared) {\n lines.push(`Also takes the inputs of ${from}: ${names.join(', ')}.`);\n }\n if (entry.usedIn.length > 0) {\n lines.push('', `Used in: ${entry.usedIn.join(', ')}`);\n }\n if (schema.examples !== undefined) {\n lines.push('', 'Examples:', ...schema.examples.map(example => indent(example)));\n }\n // The summary is the description's first paragraph with its lines\n // joined, so a one-paragraph description would only say it again.\n if (schema.description !== undefined && schema.description.replace(/\\s+/g, ' ').trim() !== schema.summary) {\n lines.push('', 'About it:', indent(schema.description));\n }\n return lines.join('\\n');\n}\n\nfunction describeInput(input: Record<string, unknown>): string {\n const type =\n Array.isArray(input.enum) && input.enum.length > 0\n ? input.enum.map(value => JSON.stringify(value)).join(' | ')\n : String(input['x-gesso-type'] ?? 'unknown');\n const kind = input['x-gesso-callback'] === true ? ' (callback)' : input['x-gesso-child'] === true ? ' (child)' : '';\n const fallback = input.default === undefined ? '' : ` = ${JSON.stringify(input.default)}`;\n const meaning = firstParagraph(typeof input.description === 'string' ? input.description : undefined);\n return `${type}${kind}${fallback}${meaning === '' ? '' : `\\n ${meaning}`}`;\n}\n\n/**\n * The components a few words find, best first: a word in the name\n * counts most, then in the summary, then in the rest of the description\n * and the input names. A component every word misses is left out.\n */\nfunction search(entries: readonly CatalogEntry[], query: string): CatalogEntry[] {\n // Split as names are, so a near miss for a name (`StatusBadge`) still\n // finds the one it was near (`StatusPill`).\n const words = query\n .replace(/([a-z0-9])([A-Z])/g, '$1 $2')\n .toLowerCase()\n .split(/[^a-z0-9]+/)\n .filter(Boolean);\n const scored = entries.map(entry => {\n const name = spaced(entry.name);\n const summary = (entry.schema.summary ?? '').toLowerCase();\n const rest = `${entry.schema.description ?? ''} ${Object.keys(\n (entry.schema.inputs as InputSchema).properties ?? {}\n ).join(' ')}`.toLowerCase();\n let score = 0;\n for (const word of words) {\n score += name.includes(word) ? 6 : summary.includes(word) ? 3 : rest.includes(word) ? 1 : 0;\n }\n return { entry, score };\n });\n return scored\n .filter(({ score }) => score > 0)\n .sort((a, b) => b.score - a.score)\n .map(({ entry }) => entry);\n}\n\n/** `DateRangePicker` as `date range picker datarangepicker`, so both spellings find it. */\nfunction spaced(name: string): string {\n return `${name.replace(/([a-z0-9])([A-Z])/g, '$1 $2')} ${name}`.toLowerCase();\n}\n\nfunction firstSentence(text: string | undefined): string {\n if (text === undefined) {\n return '';\n }\n const flat = text.replace(/\\s+/g, ' ').trim();\n const end = flat.search(/[.!?](\\s|$)/);\n const sentence = end === -1 ? flat : flat.slice(0, end + 1);\n return sentence.length > 140 ? `${sentence.slice(0, 139)}…` : sentence;\n}\n\nfunction firstParagraph(text: string | undefined): string {\n if (text === undefined) {\n return '';\n }\n const paragraph = text\n .split(/\\n\\s*\\n/)[0]!\n .replace(/\\s+/g, ' ')\n .trim();\n return paragraph.length > 240 ? `${paragraph.slice(0, 239)}…` : paragraph;\n}\n\nfunction indent(text: string): string {\n return text\n .split('\\n')\n .map(line => ` ${line}`)\n .join('\\n');\n}\n\nfunction success(text: string, structured: Record<string, unknown>): CatalogResult {\n return { content: [{ type: 'text', text }], structuredContent: structured, isError: false };\n}\n\nfunction failure(text: string): CatalogResult {\n return { content: [{ type: 'text', text }], isError: true };\n}\n","/**\n * Just enough of a JavaScript scanner to find a call and to say which\n * module a name was imported from.\n *\n * Written here rather than taken from npm for the reason the rest of\n * this repository's tooling gives (`packages/devtools/src/sourceMap.ts`,\n * `scripts/gen-layout-fixtures.ts`): the whole of what the plugin needs\n * is \"where does `createApp(` open and close\" and \"where did `SegueApp`\n * come from\", and a parser is a dependency, a TypeScript dialect\n * question and a version to keep in step, in exchange for two\n * questions a scanner answers.\n *\n * The trick that makes it safe is `blankLiterals`: every string,\n * template and comment is replaced by spaces of the same length, so the\n * positions found in the blanked copy are positions in the original,\n * and no brace inside a string can be mistaken for code. Everything\n * below searches the blank copy and slices the original.\n *\n * What it does not do is understand scope. A `createApp` that a module\n * defined for itself would be found the same way an imported one is,\n * which is why the plugin checks the imports first and only then looks\n * for the call.\n */\n\n/** Where a call expression starts, where its arguments are, where it ends. */\nexport interface CallSite {\n /** Index of the first character of the callee name. */\n readonly start: number;\n /** Index just after the opening parenthesis. */\n readonly argsStart: number;\n /** Index of the closing parenthesis. */\n readonly argsEnd: number;\n /** Index just after the closing parenthesis. */\n readonly end: number;\n}\n\nconst IDENTIFIER = /[A-Za-z0-9_$]/;\n\n/**\n * A copy of `code` in which every string, template literal, regular\n * expression body and comment is spaces, and everything else is\n * untouched.\n *\n * Same length as the input, and newlines are kept, so an index into\n * the result is an index into the original and a line number is still\n * a line number. String and template delimiters are kept as well, so a\n * specifier can be found by its quotes here and read from there.\n */\nexport function blankLiterals(code: string): string {\n const out = code.split('');\n let index = 0;\n // What may legally precede a regular expression: an operator, an\n // opening bracket, or the start of the file. After a name, a number\n // or a closing bracket, a slash is division.\n let regexAllowed = true;\n\n const blank = (from: number, to: number): void => {\n for (let i = from; i < to; i++) {\n if (out[i] !== '\\n') {\n out[i] = ' ';\n }\n }\n };\n\n while (index < code.length) {\n const char = code[index];\n if (char === '/' && code[index + 1] === '/') {\n const end = code.indexOf('\\n', index);\n blank(index, end === -1 ? code.length : end);\n index = end === -1 ? code.length : end;\n continue;\n }\n if (char === '/' && code[index + 1] === '*') {\n const end = code.indexOf('*/', index + 2);\n const stop = end === -1 ? code.length : end + 2;\n blank(index, stop);\n index = stop;\n continue;\n }\n if (char === '\"' || char === \"'\") {\n const end = closingQuote(code, index, char);\n blank(index + 1, end);\n index = end + 1;\n regexAllowed = false;\n continue;\n }\n if (char === '`') {\n const end = closingQuote(code, index, '`');\n blank(index + 1, end);\n index = end + 1;\n regexAllowed = false;\n continue;\n }\n if (char === '/' && regexAllowed) {\n const end = closingRegex(code, index);\n if (end !== -1) {\n blank(index + 1, end);\n index = end + 1;\n regexAllowed = false;\n continue;\n }\n }\n if (!/\\s/.test(char)) {\n regexAllowed = !IDENTIFIER.test(char) && char !== ')' && char !== ']';\n }\n index++;\n }\n return out.join('');\n}\n\n/** The index of the quote that closes the one at `open`, or the end. */\nfunction closingQuote(code: string, open: number, quote: string): number {\n for (let i = open + 1; i < code.length; i++) {\n if (code[i] === '\\\\') {\n i++;\n continue;\n }\n if (code[i] === quote) {\n return i;\n }\n }\n return code.length;\n}\n\n/**\n * The index of the slash closing a regular expression, or -1 when the\n * slash was division after all.\n *\n * A newline inside means it was not a regular expression, which is the\n * cheap test that keeps `a / b` and `c / d` on one line from swallowing\n * everything between them.\n */\nfunction closingRegex(code: string, open: number): number {\n let inClass = false;\n for (let i = open + 1; i < code.length; i++) {\n const char = code[i];\n if (char === '\\\\') {\n i++;\n continue;\n }\n if (char === '\\n') {\n return -1;\n }\n if (char === '[') {\n inClass = true;\n continue;\n }\n if (char === ']') {\n inClass = false;\n continue;\n }\n if (char === '/' && !inClass) {\n return i;\n }\n }\n return -1;\n}\n\n/**\n * Every call of `name` in the module, in source order.\n *\n * A bare name has to stand alone: `renderRoot(` matches, `myRenderRoot(`\n * and `thing.renderRoot(` do not, because a method of that name on some\n * other object is not the framework's function. A name written with a\n * leading dot is the opposite and matches only the method call:\n * `.useService(` is how a builder chain reads and the only way it is\n * ever written.\n */\nexport function findCalls(code: string, name: string, blank = blankLiterals(code)): CallSite[] {\n const member = name.startsWith('.');\n const bare = member ? name.slice(1) : name;\n const sites: CallSite[] = [];\n let from = 0;\n for (;;) {\n const at = blank.indexOf(bare, from);\n if (at === -1) {\n return sites;\n }\n from = at + bare.length;\n const before = at === 0 ? '' : blank[at - 1];\n if (member ? before !== '.' : before !== '' && (IDENTIFIER.test(before) || before === '.')) {\n continue;\n }\n let cursor = from;\n while (cursor < blank.length && /\\s/.test(blank[cursor])) {\n cursor++;\n }\n if (blank[cursor] !== '(') {\n continue;\n }\n const argsEnd = matchingBracket(blank, cursor);\n if (argsEnd === -1) {\n continue;\n }\n sites.push({ start: at, argsStart: cursor + 1, argsEnd, end: argsEnd + 1 });\n from = argsEnd + 1;\n }\n}\n\n/** The first call of `name`, or null. */\nexport function findCall(code: string, name: string, blank = blankLiterals(code)): CallSite | null {\n return findCalls(code, name, blank)[0] ?? null;\n}\n\n/** The index of the bracket closing the one at `open`, or -1. */\nexport function matchingBracket(blank: string, open: number): number {\n const stack: string[] = [];\n for (let i = open; i < blank.length; i++) {\n const char = blank[i];\n if (char === '(' || char === '[' || char === '{') {\n stack.push(char);\n continue;\n }\n if (char === ')' || char === ']' || char === '}') {\n stack.pop();\n if (stack.length === 0) {\n return i;\n }\n }\n }\n return -1;\n}\n\n/**\n * The identifier a call's first argument is, or null when the argument\n * is anything more complicated than a name.\n *\n * `renderRoot(SegueApp)` is the shape every entry in this repository\n * writes and the only one that can be hot-replaced, because a\n * replacement has to be looked up by name in the module that changed.\n * `renderRoot(<App x={1} />)` is legal and gets no HMR wiring, which\n * the plugin says rather than guessing.\n */\nexport function firstArgumentName(code: string, call: CallSite, blank = blankLiterals(code)): string | null {\n const first = (splitTopLevel(blank.slice(call.argsStart, call.argsEnd))[0] ?? '').trim();\n return /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(first) ? first : null;\n}\n\n/** Splits an argument list on its top-level commas. */\nfunction splitTopLevel(text: string): string[] {\n const parts: string[] = [];\n let depth = 0;\n let start = 0;\n for (let i = 0; i < text.length; i++) {\n const char = text[i];\n if (char === '(' || char === '[' || char === '{') {\n depth++;\n } else if (char === ')' || char === ']' || char === '}') {\n depth--;\n } else if (char === ',' && depth === 0) {\n parts.push(text.slice(start, i));\n start = i + 1;\n }\n }\n parts.push(text.slice(start));\n return parts;\n}\n\n/**\n * Which module each imported name came from: local name to specifier,\n * exactly as the import wrote it.\n *\n * Default and namespace imports are recorded under their local names\n * too, so `import App from './App'` and `import * as app from './App'`\n * both answer. What the map does not carry is whether the binding is a\n * type, because `import type` is stripped before this runs in every\n * configuration that matters and a type never reaches a call.\n */\nexport function importSources(code: string, blank = blankLiterals(code)): Map<string, string> {\n const sources = new Map<string, string>();\n const statement = /\\bimport\\b([\\s\\S]*?)\\bfrom\\b\\s*(['\"])/g;\n for (;;) {\n const match = statement.exec(blank);\n if (match === null) {\n return sources;\n }\n const quote = match[2];\n const open = match.index + match[0].length;\n const close = code.indexOf(quote, open);\n if (close === -1) {\n continue;\n }\n const specifier = code.slice(open, close);\n for (const local of importedNames(match[1])) {\n sources.set(local, specifier);\n }\n statement.lastIndex = close + 1;\n }\n}\n\n/** The local names an import clause binds. */\nfunction importedNames(clause: string): string[] {\n const names: string[] = [];\n const braces = clause.indexOf('{');\n const head = (braces === -1 ? clause : clause.slice(0, braces)).replace(/\\btype\\b/g, '');\n for (const part of head.split(',')) {\n const named = /^\\s*(?:\\*\\s*as\\s*)?([A-Za-z_$][A-Za-z0-9_$]*)\\s*$/.exec(part);\n if (named !== null) {\n names.push(named[1]);\n }\n }\n if (braces !== -1) {\n const close = clause.lastIndexOf('}');\n const list = clause.slice(braces + 1, close === -1 ? clause.length : close);\n for (const part of list.split(',')) {\n const aliased = /^\\s*(?:type\\s+)?[A-Za-z_$][A-Za-z0-9_$]*\\s+as\\s+([A-Za-z_$][A-Za-z0-9_$]*)\\s*$/.exec(part);\n const plain = /^\\s*(?:type\\s+)?([A-Za-z_$][A-Za-z0-9_$]*)\\s*$/.exec(part);\n const name = aliased?.[1] ?? plain?.[1];\n if (name !== undefined) {\n names.push(name);\n }\n }\n }\n return names;\n}\n","import type * as TsApi from 'typescript/unstable/sync';\n\nimport { blankLiterals, findCalls, importSources } from './source.ts';\n\n/**\n * Channel contracts, read by the type checker and written back as JSON\n * Schema.\n *\n * A contract module already says everything an agent driving the\n * application would need to know: the view's keys and their types, each\n * command's parameters and their types, and, where the author wrote\n * them, what each one is for. All of it is types and comments, and\n * both are gone by the time the module runs. This puts them back, as a\n * `describeChannel(token, schema)` call appended to the module, so the\n * token carries its own description wherever it is imported.\n *\n * The checker rather than the syntax, because a contract names its\n * types where it likes: `ProductRow` from another file, a status union\n * behind an alias, a view written as an object literal whose type is\n * inferred. Only the checker resolves all of those the way the compiler\n * that checked the application did. TypeScript 7's checker runs in a\n * separate process behind an API its package calls unstable, so all of\n * it is in this file, and the rest of the plugin sees one function.\n *\n * What the comments carry:\n *\n * - The JSDoc on the exported token is the channel's description, on\n * a view key is that key's, and on a command is the command's.\n * - `@param name text` describes a parameter.\n * - `@destructive`, `@idempotent`, `@confirm` and `@hidden` on a\n * command are its annotations; `CommandSchema` says what each means.\n * - `@hidden` on a view key keeps that key from an agent; see\n * `ChannelSchema.hidden`. On the token, it keeps the whole channel\n * from one; see `ChannelSchema.internal`.\n *\n * And what it will not describe: a value that is not plain data, which\n * cannot cross a channel anyway. A function, a `Date`, a `Map`, a class\n * instance. Each is reported, by its path in the contract, and\n * described as `{}` so the rest of the schema still stands.\n */\n\n/** The parts of `typescript/unstable/sync` this file uses, values included. */\nexport type TypeScriptApi = typeof TsApi;\n\n/** A channel's description, in the shape `describeChannel` takes. */\nexport interface ChannelSchemaOut {\n description?: string;\n internal?: true;\n view: JsonSchema;\n hidden?: string[];\n commands: Record<string, CommandSchemaOut>;\n}\n\ninterface CommandSchemaOut {\n description?: string;\n parameters: string[];\n rest?: true;\n input: JsonSchema;\n destructive?: true;\n idempotent?: true;\n confirm?: true;\n hidden?: true;\n}\n\ntype JsonSchema = Record<string, unknown>;\n\n/**\n * A component's description: what it is for, and what each of its\n * inputs takes. The catalog an agent designing with the library reads,\n * so that it uses `Badge` rather than drawing one from boxes.\n */\nexport interface ComponentSchemaOut {\n /** The first paragraph of its JSDoc: what it is, for a list of many. */\n summary?: string;\n /** The whole JSDoc, for the one component being used. */\n description?: string;\n /**\n * Its inputs, as an object schema. Each input says its TypeScript\n * type as `x-gesso-type`, which an agent writing TSX reads more\n * readily than the schema; an input declared on a shared props type\n * (`ControlLayoutProps`) says which as `x-gesso-from`; a callback is\n * `x-gesso-callback` and a child `x-gesso-child`.\n */\n inputs: JsonSchema;\n /** The `@example` blocks, as written. */\n examples?: string[];\n /** The `@deprecated` text, or true when it gives none. */\n deprecated?: string | true;\n}\n\n/** Every component a module exports, and what could not be described. */\nexport interface ComponentReading {\n /** Export name to schema, in declaration order. */\n readonly components: ReadonlyMap<string, ComponentSchemaOut>;\n readonly warnings: readonly string[];\n}\n\n/** Every channel a module exports, and what could not be described. */\nexport interface ContractReading {\n /** Export name to schema, in declaration order. */\n readonly channels: ReadonlyMap<string, ChannelSchemaOut>;\n /** One sentence per value that could not be described, naming where it is. */\n readonly warnings: readonly string[];\n}\n\n/** The functions that declare a channel. */\nconst DECLARATIONS = ['channel', 'defineChannel'];\n\n/**\n * Whether a module declares a channel, without asking the checker.\n *\n * The checker is a process round trip per question, and every module\n * the application has passes through `transform`, so this is the gate:\n * a call to `channel` or `defineChannel` imported from\n * `gesso-framework`. A module that re-exports a token someone else\n * declared is not a contract, and the module that declared it is the\n * one described.\n */\nexport function declaresChannel(code: string): boolean {\n if (!code.includes('gesso-framework')) {\n return false;\n }\n const blank = blankLiterals(code);\n const imports = importSources(code, blank);\n // `channel<View, Commands>(...)` has type arguments between the name\n // and the parenthesis, which `findCalls` does not look past, and type\n // arguments are the form `channel` is usually written in.\n return DECLARATIONS.some(\n name =>\n imports.get(name) === 'gesso-framework' &&\n (findCalls(code, name, blank).length > 0 || new RegExp(`(?<![\\\\w$.])${name}\\\\s*<`).test(blank))\n );\n}\n\n/**\n * The code appended to a contract module.\n *\n * An import at the bottom is still hoisted, and appending rather than\n * rewriting leaves every line the author wrote where they wrote it, so\n * the module's source map needs nothing.\n */\nexport function describeCalls(channels: ReadonlyMap<string, ChannelSchemaOut>): string {\n const lines = [\"import { describeChannel as __gessoDescribeChannel } from 'gesso-framework';\"];\n for (const [name, schema] of channels) {\n lines.push(`__gessoDescribeChannel(${name}, ${JSON.stringify(schema)});`);\n }\n return `\\n${lines.join('\\n')}\\n`;\n}\n\n/**\n * A module that describes channels when it is imported, for a bundle\n * this plugin never sees.\n *\n * The plugin describes a contract by appending to it as Vite bundles\n * it. An Electrobun main process is bundled by Electrobun's own build,\n * which takes no plugins, so there the description is written ahead of\n * time instead: `gesso-channels` reads the contracts with the same\n * checker and writes this module, and the main process imports it once.\n * A token is imported from its contract, so the schema lands on the\n * same object the application serves.\n *\n * `outFile` and every `file` are absolute POSIX paths.\n */\nexport function describedModule(\n contracts: readonly { readonly file: string; readonly channels: ReadonlyMap<string, ChannelSchemaOut> }[],\n outFile: string\n): string {\n const lines = [\n '// Written by gesso-channels from the channel contracts it names below.',\n '// Run it again after changing a contract rather than editing this file.',\n \"import { describeChannel } from 'gesso-framework';\"\n ];\n const from = outFile.slice(0, outFile.lastIndexOf('/'));\n for (const contract of contracts) {\n if (contract.channels.size > 0) {\n const names = [...contract.channels.keys()].join(', ');\n lines.push(`import { ${names} } from '${importPath(from, contract.file)}';`);\n }\n }\n for (const contract of contracts) {\n for (const [name, schema] of contract.channels) {\n lines.push('', `describeChannel(${name}, ${JSON.stringify(schema, null, 2)});`);\n }\n }\n return `${lines.join('\\n')}\\n`;\n}\n\n/** `./Counter` from `/app/src/shared` to `/app/src/shared/Counter.ts`, without the extension. */\nfunction importPath(fromDir: string, file: string): string {\n const from = fromDir.split('/').filter(Boolean);\n const to = file\n .replace(/\\.[cm]?[jt]sx?$/, '')\n .split('/')\n .filter(Boolean);\n let shared = 0;\n while (shared < from.length && shared < to.length - 1 && from[shared] === to[shared]) {\n shared++;\n }\n const up = from.length - shared;\n const rest = to.slice(shared).join('/');\n return up === 0 ? `./${rest}` : `${'../'.repeat(up)}${rest}`;\n}\n\n/**\n * The checker, held open across reads.\n *\n * Spawning it and loading a project costs about a hundred\n * milliseconds; a question after that costs well under one. So one\n * reader lives as long as the dev server or the build, is told which\n * files changed between reads, and is closed at the end, because the\n * process it holds would otherwise keep the build from exiting.\n */\nexport class ContractReader {\n private api: TsApi.API | null = null;\n private readonly changed = new Set<string>();\n private readonly created = new Set<string>();\n private readonly deleted = new Set<string>();\n /** Each contract's tsconfig, found once. */\n private readonly configs = new Map<string, string>();\n\n /**\n * @param fs Callbacks the checker reads through before the disk, for\n * a spec that keeps its project in memory.\n */\n private readonly ts: TypeScriptApi;\n private readonly cwd: string;\n private readonly fs: TsApi.APIOptions['fs'];\n\n // Fields assigned by hand rather than parameter properties: the\n // plugin is loaded by Node's type stripping, which rejects those.\n constructor(ts: TypeScriptApi, cwd: string, fs?: TsApi.APIOptions['fs']) {\n this.ts = ts;\n this.cwd = cwd;\n this.fs = fs;\n }\n\n /**\n * A file changed on disk since the last read. A new or deleted one is\n * said so, because a program's list of files only changes for those:\n * a component in a new file is otherwise not in the catalog.\n */\n invalidate(file: string, event: 'update' | 'create' | 'delete' = 'update'): void {\n (event === 'create' ? this.created : event === 'delete' ? this.deleted : this.changed).add(file);\n }\n\n /**\n * A snapshot of the projects, with what changed since the last one.\n *\n * The checker keeps every project it has opened, and asked to update\n * one whose tsconfig has since been deleted it refuses the whole\n * update (\"project not found for update\"). That was a dev server gone\n * with it: a project's tsconfig removed while the server ran threw out\n * of the catalog's read and took the process down. A refused update is\n * a checker started afresh, which reads the disk as it now is and\n * opens only what is asked of it again.\n */\n private snapshot(request: NonNullable<Parameters<TsApi.API['updateSnapshot']>[0]>): TsApi.Snapshot {\n const api = (this.api ??= new this.ts.API({ cwd: this.cwd, ...(this.fs === undefined ? {} : { fs: this.fs }) }));\n try {\n return api.updateSnapshot({ ...request, fileChanges: this.takeChanges() });\n } catch {\n this.close();\n this.configs.clear();\n const fresh = (this.api = new this.ts.API({ cwd: this.cwd, ...(this.fs === undefined ? {} : { fs: this.fs }) }));\n const { fileChanges: _changes, ...rest } = request;\n return fresh.updateSnapshot(rest);\n }\n }\n\n /** What changed since the last snapshot, emptied for the next. */\n private takeChanges(): { changed: string[]; created: string[]; deleted: string[] } {\n const changes = { changed: [...this.changed], created: [...this.created], deleted: [...this.deleted] };\n this.changed.clear();\n this.created.clear();\n this.deleted.clear();\n return changes;\n }\n\n /** Every channel `file` exports, described. */\n read(file: string): ContractReading {\n const opened = this.open(file);\n if (typeof opened === 'string') {\n return { channels: new Map(), warnings: [opened] };\n }\n const { checker, exports } = opened;\n const describer = new Describer(this.ts, checker);\n const channels = new Map<string, ChannelSchemaOut>();\n for (const exported of exports) {\n const type = checker.getTypeOfSymbol(exported);\n if (type === undefined || type.getSymbol()?.name !== 'ChannelToken') {\n continue;\n }\n const [view, commands] = checker.getTypeArguments(type as TsApi.TypeReference);\n channels.set(exported.name, describer.channel(exported, view, commands));\n }\n return { channels, warnings: describer.warnings };\n }\n\n /**\n * Every component `file` exports, described: a function whose first\n * parameter is `Inputs<P>`, or a class extending `Component`, whose\n * inputs are its `InputCell` fields. A library's index re-exports its\n * components, and reading it reads all of them.\n */\n readComponents(file: string, config?: string): ComponentReading {\n const opened = this.open(file, config);\n if (typeof opened === 'string') {\n return { components: new Map(), warnings: [opened] };\n }\n const { checker, exports } = opened;\n const describer = new Describer(this.ts, checker, 'component');\n const components = new Map<string, ComponentSchemaOut>();\n for (const exported of exports) {\n const symbol = exported.flags & this.ts.SymbolFlags.Alias ? checker.getAliasedSymbol(exported) : exported;\n const type = checker.getTypeOfSymbol(symbol);\n const inputs = type === undefined ? undefined : this.inputsOf(checker, type);\n if (inputs !== undefined) {\n components.set(exported.name, describer.component(symbol, inputs));\n }\n }\n return { components, warnings: describer.warnings };\n }\n\n /**\n * The source files of the project `config` describes, with their\n * text: what the project itself wrote, so neither its dependencies\n * nor declaration files. The project's own tsconfig decides what that\n * is, which is the answer the person already gave their editor.\n */\n sources(config: string): { readonly file: string; readonly text: string }[] {\n const snapshot = this.snapshot({ openProjects: [config] });\n const program = snapshot.getProject(config)?.program;\n if (program === undefined) {\n return [];\n }\n const out: { file: string; text: string }[] = [];\n for (const file of program.getSourceFileNames()) {\n if (file.includes('/node_modules/') || /\\.d\\.[cm]?ts$/.test(file)) {\n continue;\n }\n const text = program.getSourceFile(file)?.text;\n if (text !== undefined) {\n out.push({ file, text });\n }\n }\n return out;\n }\n\n /** The inputs a component's type declares, or undefined when it is not a component. */\n private inputsOf(checker: TsApi.Checker, type: TsApi.Type): ComponentInputs | undefined {\n const { Call, Construct } = this.ts.SignatureKind;\n const [call] = checker.getSignaturesOfType(type, Call);\n const first = call?.getParameters()[0];\n if (first !== undefined) {\n const parameter = checker.getTypeOfSymbol(first);\n // A helper may take a component's inputs too (`layoutOf(inputs)`);\n // what makes a component is that it gives back something to draw.\n const returns = checker.getReturnTypeOfSignature(call!);\n if (parameter?.getAliasSymbol()?.name === 'Inputs' && returns !== undefined && this.drawable(returns)) {\n const [props] = parameter.getAliasTypeArguments();\n return props === undefined ? undefined : { kind: 'props', type: props };\n }\n return undefined;\n }\n const [construct] = checker.getSignaturesOfType(type, Construct);\n const instance = construct === undefined ? undefined : checker.getReturnTypeOfSignature(construct);\n if (instance === undefined || !this.extendsComponent(instance)) {\n return undefined;\n }\n const cells: { symbol: TsApi.Symbol; type: TsApi.Type }[] = [];\n for (const property of checker.getPropertiesOfType(instance)) {\n const propertyType = checker.getTypeOfSymbol(property);\n if (propertyType?.getSymbol()?.name === 'InputCell') {\n const [value] = checker.getTypeArguments(propertyType as TsApi.TypeReference);\n if (value !== undefined) {\n cells.push({ symbol: property, type: value });\n }\n }\n }\n return { kind: 'cells', cells };\n }\n\n /** Whether a function returning `type` returns a child: `UiChild`, an element, or a union of them. */\n private drawable(type: TsApi.Type): boolean {\n if (type.getAliasSymbol()?.name === 'UiChild') {\n return true;\n }\n const members = type.isUnionType() ? (type.getTypes() ?? []) : [type];\n return members.some(member => CHILD.has(member.getSymbol()?.name ?? ''));\n }\n\n private extendsComponent(type: TsApi.Type): boolean {\n for (let depth = 0, current: TsApi.Type | undefined = type; current !== undefined && depth < 16; depth++) {\n if (current.getSymbol()?.name === 'Component') {\n return true;\n }\n current = current.isClassOrInterface() ? current.getBaseTypes()?.[0] : undefined;\n }\n return false;\n }\n\n /**\n * The checker and the module's exports, or why there are none: read\n * in the project `preferred` names when it includes the file (the\n * catalog's own tsconfig, which may resolve its imports differently\n * from any beside it), else the project TypeScript finds for it.\n */\n private open(\n file: string,\n preferred?: string\n ): { checker: TsApi.Checker; exports: readonly TsApi.Symbol[] } | string {\n this.changed.add(file);\n let snapshot = this.snapshot(preferred === undefined ? {} : { openProjects: [preferred] });\n let config =\n preferred !== undefined && snapshot.getProject(preferred)?.program.getSourceFile(file) !== undefined\n ? preferred\n : this.configs.get(file);\n if (config === undefined) {\n // A file opened through the API is an editor's buffer: the server\n // stops reading it from disk, and an edit the next save makes is\n // never seen. So the file is opened only long enough to learn\n // which project it belongs to, and the project is what stays open.\n config = this.snapshot({ openFiles: [file] }).getDefaultProjectForFile(file)?.configFileName;\n snapshot = this.snapshot({\n ...(config === undefined ? {} : { openProjects: [config] }),\n closeFiles: [file]\n });\n if (config !== undefined) {\n this.configs.set(file, config);\n }\n }\n const project = config === undefined ? undefined : snapshot.getProject(config);\n const source = project?.program.getSourceFile(file);\n if (project === undefined || source === undefined) {\n return `TypeScript has no project that includes ${file}.`;\n }\n const checker = project.checker;\n const module = checker.getSymbolAtLocation(source);\n return { checker, exports: module === undefined ? [] : checker.getExportsOfModule(module) };\n }\n\n close(): void {\n this.api?.close();\n this.api = null;\n }\n}\n\n/**\n * Library types that are objects to the checker and not plain data to\n * a channel. They compare by reference, so `provide` rejects them on\n * their first value; describing their methods as properties would be\n * describing something that never arrives.\n */\nconst NOT_PLAIN = new Set([\n 'Date',\n 'Map',\n 'ReadonlyMap',\n 'Set',\n 'ReadonlySet',\n 'WeakMap',\n 'WeakSet',\n 'Promise',\n 'RegExp',\n 'Error',\n 'ArrayBuffer',\n 'SharedArrayBuffer',\n 'DataView',\n 'Blob',\n 'File',\n 'URL',\n 'Int8Array',\n 'Uint8Array',\n 'Uint8ClampedArray',\n 'Int16Array',\n 'Uint16Array',\n 'Int32Array',\n 'Uint32Array',\n 'Float32Array',\n 'Float64Array',\n 'BigInt64Array',\n 'BigUint64Array'\n]);\n\n/**\n * Bytes, which a command may carry and a view key may not.\n *\n * A command's argument is structured-cloned onto the owning thread, and\n * a typed array or an `ArrayBuffer` clones as itself: a file a person\n * dropped crosses as its bytes, with no encoding pass on the render\n * thread. A view key is diffed, and a differ that compares bytes by\n * reference reports a change on every emission, so there they stay\n * unplain. In a command's schema they are a base64 string, which is\n * what an agent can write, tagged with the type the command expects so\n * the agent surface can turn the string back into it.\n */\nexport const BINARY = new Set([\n 'ArrayBuffer',\n 'Int8Array',\n 'Uint8Array',\n 'Uint8ClampedArray',\n 'Int16Array',\n 'Uint16Array',\n 'Int32Array',\n 'Uint32Array',\n 'Float32Array',\n 'Float64Array',\n 'BigInt64Array',\n 'BigUint64Array'\n]);\n\n/**\n * What a component takes: a function's `P` in `Inputs<P>`, or a class's\n * `InputCell` fields with the type each holds.\n */\ntype ComponentInputs =\n | { readonly kind: 'props'; readonly type: TsApi.Type }\n | { readonly kind: 'cells'; readonly cells: readonly { symbol: TsApi.Symbol; type: TsApi.Type }[] };\n\n/**\n * The types a component takes as a child. `UiChild` is a union of\n * these and an Observable of them, and describing its members would\n * describe the element records a tag compiles to, which nobody writes.\n */\nconst CHILD = new Set(['UiElement', 'ComponentLikeElement', 'ComponentElement']);\n\n/**\n * Turns checker types into JSON Schema for one module's channels or\n * components.\n *\n * The two differ in what is allowed. A channel's values cross a thread\n * as plain data, so a function or a class instance in one is a mistake,\n * and is reported. A component's inputs stay on the render thread, where\n * a callback is how a component talks back and a child is how it is\n * composed, so there they are described for what they are and nothing\n * is reported.\n */\nclass Describer {\n readonly warnings: string[] = [];\n private readonly flags: TypeScriptApi['TypeFlags'];\n /** Describing a command's parameters, where bytes are allowed; see `BINARY`. */\n private inCommand = false;\n /** Types being described right now, to notice a type that contains itself. */\n private readonly inProgress = new Set<number>();\n /** Types found to contain themselves, which are described once in `$defs`. */\n private readonly recursive = new Set<number>();\n /** `$defs` for the schema being built. Reset per root, so each schema stands alone. */\n private defs = new Map<string, JsonSchema>();\n private readonly defNames = new Map<number, string>();\n /** In a component, each named type's `$defs` entry, or null when it is small enough to repeat. */\n private shared = new Map<number, string | null>();\n\n private readonly ts: TypeScriptApi;\n private readonly checker: TsApi.Checker;\n\n private readonly mode: 'channel' | 'component';\n\n constructor(ts: TypeScriptApi, checker: TsApi.Checker, mode: 'channel' | 'component' = 'channel') {\n this.ts = ts;\n this.checker = checker;\n this.flags = ts.TypeFlags;\n this.mode = mode;\n }\n\n component(symbol: TsApi.Symbol, inputs: ComponentInputs): ComponentSchemaOut {\n this.defs = new Map();\n this.shared = new Map();\n const checker = this.checker;\n const properties: Record<string, JsonSchema> = {};\n const required: string[] = [];\n const entries =\n inputs.kind === 'cells'\n ? inputs.cells\n : checker.getPropertiesOfType(inputs.type).map(property => ({\n symbol: property,\n type: checker.getTypeOfSymbol(property)\n }));\n const own = inputs.kind === 'props' ? (inputs.type.getAliasSymbol() ?? inputs.type.getSymbol())?.name : undefined;\n for (const { symbol: property, type: given } of entries) {\n const path = `${symbol.name}.${property.name}`;\n // `width?: UiLength` reads as `UiLength | undefined`, a union with\n // no name, and the name is what lets `UiLength` be described once.\n // Optionality is said by `required`, so the `undefined` can go.\n const type =\n given !== undefined && this.includesUndefined(given) && !this.includesNull(given)\n ? (checker.getNonNullableType(given) ?? given)\n : given;\n let schema: JsonSchema = type === undefined ? {} : this.describe(type, path);\n if (type !== undefined) {\n schema = { ...schema, 'x-gesso-type': this.typeText(type) };\n }\n const description = checker.getDocumentationCommentOfSymbol(property);\n if (description !== '') {\n schema.description = description;\n }\n const fallback = checker.getJsDocTagsOfSymbol(property).find(tag => tag.name === 'default');\n if (fallback?.text !== undefined) {\n schema.default = parseDefault(fallback.text);\n }\n const from = property.getParent()?.name;\n if (own !== undefined && from !== undefined && from !== own && !from.startsWith('__')) {\n schema['x-gesso-from'] = from;\n }\n properties[property.name] = schema;\n // A class's cells are all optional to the parent, as\n // `ComponentProps` makes them.\n const optional =\n inputs.kind === 'cells' ||\n (property.flags & this.ts.SymbolFlags.Optional) !== 0 ||\n (given !== undefined && this.includesUndefined(given));\n if (!optional) {\n required.push(property.name);\n }\n }\n const schema: JsonSchema = { type: 'object', properties, additionalProperties: false };\n if (required.length > 0) {\n schema.required = required;\n }\n if (this.defs.size > 0) {\n schema.$defs = Object.fromEntries(this.defs);\n }\n\n const out: ComponentSchemaOut = { inputs: schema };\n const description = this.componentDocumentation(symbol, inputs);\n if (description !== '') {\n out.summary = description\n .split(/\\n\\s*\\n/)[0]!\n .replace(/\\s+/g, ' ')\n .trim();\n out.description = description;\n }\n const tags = checker.getJsDocTagsOfSymbol(symbol);\n const examples = tags.filter(tag => tag.name === 'example' && tag.text !== undefined).map(tag => tag.text!);\n if (examples.length > 0) {\n out.examples = examples;\n }\n const deprecated = tags.find(tag => tag.name === 'deprecated');\n if (deprecated !== undefined) {\n out.deprecated = deprecated.text === undefined || deprecated.text.trim() === '' ? true : deprecated.text.trim();\n }\n return out;\n }\n\n /**\n * What a component is for: its own JSDoc, else its props type's. A\n * comment elsewhere in its file is not read: no rule about which one\n * describes the component holds across files, and a summary that is\n * sometimes about something else is worse to an agent than none.\n */\n private componentDocumentation(symbol: TsApi.Symbol, inputs: ComponentInputs): string {\n const own = this.checker.getDocumentationCommentOfSymbol(symbol);\n if (own !== '') {\n return own;\n }\n const props = inputs.kind === 'props' ? (inputs.type.getAliasSymbol() ?? inputs.type.getSymbol()) : undefined;\n return props === undefined ? '' : this.checker.getDocumentationCommentOfSymbol(props);\n }\n\n /** The type as TypeScript writes it, without the `undefined` an optional input carries. */\n private typeText(type: TsApi.Type): string {\n const defined = this.includesUndefined(type) ? this.checker.getNonNullableType(type) : type;\n const text = this.checker.typeToString(defined ?? type);\n // `getNonNullableType` takes `null` too, which an input may mean.\n return this.includesNull(type) && !/\\bnull\\b/.test(text) ? `${text} | null` : text;\n }\n\n private includesNull(type: TsApi.Type): boolean {\n const isNull = (member: TsApi.Type) => (member.flags & this.flags.Null) !== 0;\n return type.isUnionType() ? (type.getTypes() ?? []).some(isNull) : isNull(type);\n }\n\n channel(token: TsApi.Symbol, view: TsApi.Type, commands: TsApi.Type | undefined): ChannelSchemaOut {\n const out: ChannelSchemaOut = { view: this.root(view, `${token.name}.view`), commands: {} };\n const description = this.checker.getDocumentationCommentOfSymbol(token);\n if (description !== '') {\n out.description = description;\n }\n if (this.checker.getJsDocTagsOfSymbol(token).some(tag => tag.name === 'hidden')) {\n out.internal = true;\n }\n const hidden = this.checker\n .getPropertiesOfType(view)\n .filter(key => this.checker.getJsDocTagsOfSymbol(key).some(tag => tag.name === 'hidden'))\n .map(key => key.name);\n if (hidden.length > 0) {\n out.hidden = hidden;\n }\n if (commands !== undefined) {\n for (const command of this.checker.getPropertiesOfType(commands)) {\n const described = this.command(command, `${token.name}.commands.${command.name}`);\n if (described !== null) {\n out.commands[command.name] = described;\n }\n }\n }\n return out;\n }\n\n /** A schema that stands alone: its own `$defs`, if anything in it recurs. */\n private root(type: TsApi.Type, path: string): JsonSchema {\n this.defs = new Map();\n const schema = this.describe(type, path);\n if (this.defs.size > 0) {\n return { ...schema, $defs: Object.fromEntries(this.defs) };\n }\n return schema;\n }\n\n private command(symbol: TsApi.Symbol, path: string): CommandSchemaOut | null {\n const type = this.checker.getTypeOfSymbol(symbol);\n const signatures = type === undefined ? [] : this.checker.getSignaturesOfType(type, this.ts.SignatureKind.Call);\n if (signatures.length === 0) {\n this.warnings.push(`${path} is not a function, so it is not a command an agent can send.`);\n return null;\n }\n if (signatures.length > 1) {\n this.warnings.push(`${path} is overloaded; only its first signature is described.`);\n }\n const signature = signatures[0];\n const tags = this.checker.getJsDocTagsOfSymbol(symbol);\n const parameters = signature.getParameters();\n\n this.defs = new Map();\n const properties: Record<string, JsonSchema> = {};\n const required: string[] = [];\n this.inCommand = true;\n parameters.forEach((parameter, index) => {\n const parameterType = this.checker.getTypeOfSymbol(parameter);\n const optional = parameterType !== undefined && this.includesUndefined(parameterType);\n const schema = parameterType === undefined ? {} : this.describe(parameterType, `${path}(${parameter.name})`);\n const description = this.parameterDescription(parameter, tags);\n properties[parameter.name] = description === '' ? schema : { ...schema, description };\n const rest = signature.hasRestParameter && index === parameters.length - 1;\n if (!optional && !rest) {\n required.push(parameter.name);\n }\n });\n this.inCommand = false;\n const input: JsonSchema = { type: 'object', properties, additionalProperties: false };\n if (required.length > 0) {\n input.required = required;\n }\n if (this.defs.size > 0) {\n input.$defs = Object.fromEntries(this.defs);\n }\n\n const out: CommandSchemaOut = { parameters: parameters.map(parameter => parameter.name), input };\n const description = this.checker.getDocumentationCommentOfSymbol(symbol);\n if (description !== '') {\n out.description = description;\n }\n if (signature.hasRestParameter) {\n out.rest = true;\n }\n for (const annotation of ['destructive', 'idempotent', 'confirm', 'hidden'] as const) {\n if (tags.some(tag => tag.name === annotation)) {\n out[annotation] = true;\n }\n }\n return out;\n }\n\n /**\n * A parameter's own comment, or failing that its `@param` line.\n *\n * The checker attaches `@param` text to the parameter of a method\n * signature. A command written as a property, `move: (from: number)\n * => void`, keeps its comment on the property, so the tag is read\n * from there instead.\n */\n private parameterDescription(parameter: TsApi.Symbol, tags: readonly TsApi.JSDocTagInfo[]): string {\n const own = this.checker.getDocumentationCommentOfSymbol(parameter);\n if (own !== '') {\n return own;\n }\n for (const tag of tags) {\n const match = tag.name === 'param' ? /^\\s*(\\S+)\\s*(?:-\\s*)?([\\s\\S]*)$/.exec(tag.text ?? '') : null;\n if (match !== null && match[1] === parameter.name) {\n return match[2].trim();\n }\n }\n return '';\n }\n\n private includesUndefined(type: TsApi.Type): boolean {\n const { Undefined, Void } = this.flags;\n if (type.isUnionType()) {\n return (type.getTypes() ?? []).some(member => (member.flags & (Undefined | Void)) !== 0);\n }\n return (type.flags & (Undefined | Void)) !== 0;\n }\n\n /**\n * In a component, a named type an input uses (`UiLength`, a props\n * interface) is described once, in `$defs`, and referred to after.\n * Every control takes the same layout inputs, and spelled out at each\n * use they were most of each component's description: an agent reads\n * these, and pays for every repetition.\n */\n private describe(type: TsApi.Type, path: string): JsonSchema {\n if (this.mode !== 'component') {\n return this.describeType(type, path);\n }\n const known = this.shared.get(type.id);\n if (known !== undefined) {\n return known === null ? this.describeType(type, path) : { $ref: `#/$defs/${known}` };\n }\n const name = (type.getAliasSymbol() ?? type.getSymbol())?.name;\n if (name === undefined || name.startsWith('__') || name === 'Array' || name === 'ReadonlyArray') {\n return this.describeType(type, path);\n }\n const schema = this.describeType(type, path);\n if (schema.$ref !== undefined || isSmall(schema)) {\n this.shared.set(type.id, null);\n return schema;\n }\n const defName = this.defName(type);\n this.defs.set(defName, schema);\n this.shared.set(type.id, defName);\n return { $ref: `#/$defs/${defName}` };\n }\n\n private describeType(type: TsApi.Type, path: string): JsonSchema {\n const f = this.flags;\n const flags = type.flags;\n\n if (flags & (f.Any | f.Unknown)) {\n return {};\n }\n if (flags & f.Never) {\n this.warnings.push(\n `${path} is never, which describes no value. An empty array literal is never[] unless it says what it holds: write \\`[] as Row[]\\`.`\n );\n return { not: {} };\n }\n if (flags & (f.String | f.TemplateLiteral | f.StringMapping)) {\n return { type: 'string' };\n }\n if (flags & f.Number) {\n return { type: 'number' };\n }\n if (flags & f.Boolean) {\n return { type: 'boolean' };\n }\n if (flags & f.Null) {\n return { type: 'null' };\n }\n if (flags & (f.Undefined | f.Void)) {\n return {};\n }\n if (flags & f.BooleanLiteral) {\n return { const: (type as TsApi.IntrinsicType).intrinsicName === 'true' };\n }\n if (flags & (f.StringLiteral | f.NumberLiteral)) {\n return { const: (type as TsApi.LiteralType).value };\n }\n if (flags & (f.BigInt | f.BigIntLiteral | f.ESSymbol | f.UniqueESSymbol)) {\n return this.unplain(path, flags & f.BigIntLike ? 'a bigint' : 'a symbol');\n }\n if (type.isUnionType()) {\n return this.union(type, path);\n }\n if (flags & f.TypeParameter) {\n return {};\n }\n if (flags & (f.Object | f.Intersection)) {\n // An array is a container rather than a type that can contain\n // itself: `readonly Row[]` in a view and in `Row.children` is one\n // type, and treating it as named would put the array in `$defs`\n // instead of the row.\n if (this.checker.isArrayType(type)) {\n const [element] = this.checker.getTypeArguments(type as TsApi.TypeReference);\n return { type: 'array', items: element === undefined ? {} : this.describe(element, `${path}[]`) };\n }\n if (this.checker.isTupleType(type)) {\n return this.tuple(type as TsApi.TypeReference, path);\n }\n return this.named(type, path);\n }\n this.warnings.push(`${path} has a type this reader does not describe, so it is left open.`);\n return {};\n }\n\n /**\n * A union, with `undefined` taken out (optionality is said by\n * `required`), `true | false` folded back into `boolean`, and a union\n * of nothing but literals written as an `enum`.\n */\n private union(type: TsApi.UnionType, path: string): JsonSchema {\n const f = this.flags;\n let members = (type.getTypes() ?? []).filter(member => (member.flags & (f.Undefined | f.Void)) === 0);\n if (this.mode === 'component' && members.some(member => CHILD.has(member.getSymbol()?.name ?? ''))) {\n return { 'x-gesso-child': true };\n }\n const booleans = members.filter(member => member.flags & f.BooleanLiteral);\n const schemas: JsonSchema[] = [];\n if (booleans.length === 2) {\n members = members.filter(member => !(member.flags & f.BooleanLiteral));\n schemas.push({ type: 'boolean' });\n }\n if (\n members.length > 0 &&\n schemas.length === 0 &&\n members.every(member => member.flags & (f.StringLiteral | f.NumberLiteral))\n ) {\n return { enum: members.map(member => (member as TsApi.LiteralType).value) };\n }\n // `null` last, so `string | null` reads as a string that may be absent.\n members.sort((a, b) => Number((a.flags & f.Null) !== 0) - Number((b.flags & f.Null) !== 0));\n schemas.push(...members.map(member => this.describe(member, path)));\n return schemas.length === 1 ? schemas[0] : { anyOf: schemas };\n }\n\n /**\n * An object type, described once however often it appears, and by\n * reference when it contains itself.\n */\n private named(type: TsApi.Type, path: string): JsonSchema {\n const id = type.id;\n if (this.inProgress.has(id)) {\n this.recursive.add(id);\n return { $ref: `#/$defs/${this.defName(type)}` };\n }\n this.inProgress.add(id);\n const schema = this.object(type, path);\n this.inProgress.delete(id);\n if (this.recursive.has(id)) {\n const name = this.defName(type);\n this.defs.set(name, schema);\n return { $ref: `#/$defs/${name}` };\n }\n return schema;\n }\n\n private defName(type: TsApi.Type): string {\n let name = this.defNames.get(type.id);\n if (name === undefined) {\n const base = (type.getAliasSymbol() ?? type.getSymbol())?.name ?? 'Type';\n const taken = new Set(this.defNames.values());\n name = taken.has(base) ? `${base}${type.id}` : base;\n this.defNames.set(type.id, name);\n }\n return name;\n }\n\n private object(type: TsApi.Type, path: string): JsonSchema {\n const checker = this.checker;\n const symbolName = type.getSymbol()?.name;\n if (this.mode === 'component') {\n if (symbolName !== undefined && CHILD.has(symbolName)) {\n return { 'x-gesso-child': true };\n }\n if (checker.getSignaturesOfType(type, this.ts.SignatureKind.Call).length > 0) {\n return { 'x-gesso-callback': true };\n }\n // A generic class's instance, `Observable<string>`, is a reference\n // to the class rather than the class, so it is the symbol that\n // says what it is.\n if (\n (symbolName !== undefined && NOT_PLAIN.has(symbolName)) ||\n ((type.getSymbol()?.flags ?? 0) & this.ts.SymbolFlags.Class) !== 0\n ) {\n // Something only code can make, such as a `UiColor`: an agent\n // has the type's name to go on and nothing to fill in.\n return { 'x-gesso-type': checker.typeToString(type) };\n }\n }\n if (symbolName !== undefined && this.inCommand && BINARY.has(symbolName)) {\n return { type: 'string', contentEncoding: 'base64', 'x-gesso-binary': symbolName };\n }\n // Shared memory may sit in a view: it compares by identity, which is\n // right for a handle on memory, and an agent is shown its size (see\n // `describeSharedMemory`). A command cannot take it from an agent,\n // which has no memory to share, so there it stays unplain.\n if (symbolName === 'SharedArrayBuffer' && !this.inCommand) {\n return { type: 'string', description: 'Shared memory, shown as its size.', 'x-gesso-shared': true };\n }\n if (symbolName !== undefined && NOT_PLAIN.has(symbolName)) {\n return this.unplain(path, `a ${symbolName}`);\n }\n if ((type as TsApi.ObjectType).objectFlags & this.ts.ObjectFlags.Class) {\n return this.unplain(path, `an instance of ${symbolName ?? 'a class'}`);\n }\n if (checker.getSignaturesOfType(type, this.ts.SignatureKind.Call).length > 0) {\n return this.unplain(path, 'a function');\n }\n\n const properties: Record<string, JsonSchema> = {};\n const required: string[] = [];\n for (const property of checker.getPropertiesOfType(type)) {\n const propertyType = checker.getTypeOfSymbol(property);\n const at = `${path}.${property.name}`;\n if (propertyType === undefined) {\n properties[property.name] = {};\n continue;\n }\n const schema = this.describe(propertyType, at);\n const description = checker.getDocumentationCommentOfSymbol(property);\n properties[property.name] = description === '' ? schema : { ...schema, description };\n const optional = (property.flags & this.ts.SymbolFlags.Optional) !== 0 || this.includesUndefined(propertyType);\n if (!optional) {\n required.push(property.name);\n }\n }\n const schema: JsonSchema = { type: 'object', properties };\n if (required.length > 0) {\n schema.required = required;\n }\n const index = checker.getIndexInfosOfType(type).find(info => info.keyType.flags & this.flags.String);\n if (index !== undefined) {\n schema.additionalProperties = this.describe(index.valueType, `${path}[key]`);\n }\n return schema;\n }\n\n private tuple(type: TsApi.TypeReference, path: string): JsonSchema {\n const elements = this.checker.getTypeArguments(type);\n const elementFlags = (type.getTarget() as TsApi.TupleType).elementFlags ?? [];\n const { Required, Rest } = this.ts.ElementFlags;\n const prefixItems: JsonSchema[] = [];\n let items: JsonSchema | false = false;\n let minItems = 0;\n elements.forEach((element, index) => {\n const schema = this.describe(element, `${path}[${index}]`);\n if (elementFlags[index] & Rest) {\n items = schema;\n } else {\n prefixItems.push(schema);\n if (elementFlags[index] & Required) {\n minItems = index + 1;\n }\n }\n });\n return { type: 'array', prefixItems, items, minItems };\n }\n\n private unplain(path: string, what: string): JsonSchema {\n if (this.mode === 'component') {\n // Plain data is a channel's rule; see the class's comment.\n return {};\n }\n this.warnings.push(`${path} is ${what}, which is not plain data and cannot cross a channel.`);\n return {};\n }\n}\n\n/**\n * A `@default` tag's value: JSON when it is JSON (`99`, `'neutral'`\n * written with double quotes, `true`), a single-quoted string unquoted,\n * and otherwise the text as written.\n */\nfunction parseDefault(text: string): unknown {\n const trimmed = text.trim();\n try {\n return JSON.parse(trimmed);\n } catch {\n const quoted = /^'(.*)'$/.exec(trimmed) ?? /^`(.*)`$/.exec(trimmed);\n return quoted === null ? trimmed : quoted[1];\n }\n}\n\n/** Whether a schema is as short as a reference to it would be. */\nfunction isSmall(schema: JsonSchema): boolean {\n if (schema.enum !== undefined || schema.const !== undefined) {\n return true;\n }\n const keys = Object.keys(schema);\n return (\n keys.length === 0 || (keys.length === 1 && (typeof schema.type === 'string' || keys[0]!.startsWith('x-gesso-')))\n );\n}\n"],"mappings":";;AAgFA,MAAa,uBACX;AAIF,MAAM,YAAY;CAAE,cAAc;CAAM,eAAe;AAAM;AAE7D,MAAa,gBAAwC;CACnD;EACE,MAAM;EACN,OAAO;EACP,aACE;EAEF,aAAa;GAAE,MAAM;GAAU,YAAY,CAAC;GAAG,sBAAsB;EAAM;EAC3E,aAAa;CACf;CACA;EACE,MAAM;EACN,OAAO;EACP,aACE;EAEF,aAAa;GACX,MAAM;GACN,YAAY,EAAE,OAAO;IAAE,MAAM;IAAU,aAAa;GAAsD,EAAE;GAC5G,UAAU,CAAC,OAAO;GAClB,sBAAsB;EACxB;EACA,aAAa;CACf;CACA;EACE,MAAM;EACN,OAAO;EACP,aACE;EAEF,aAAa;GACX,MAAM;GACN,YAAY;IACV,MAAM;KAAE,MAAM;KAAU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