@westonkd/sprint 0.5.0 → 0.7.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/README.md +16 -5
- package/agent-manifest.json +1742 -314
- package/dist/index.cjs +381 -69
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1647 -249
- package/dist/index.js +5455 -2342
- package/dist/index.js.map +1 -1
- package/dist/sprint.css +1 -1
- package/package.json +1 -1
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../src/agent/attributes.ts","../src/agent/view/truncate.ts","../src/agent/webmcp/adapter.ts","../src/agent/registry.ts","../src/agent/view/node.ts","../src/agent/view/markdown.ts","../src/agent/view/mode.ts","../src/agent/view/project.ts","../src/agent/view/AgentText.tsx","../src/agent/view/tabular.ts","../src/agent/view/text.ts","../src/agent/view/serialize.ts","../src/agent/webmcp/afterCommit.ts","../src/agent/webmcp/scope.ts","../src/agent/webmcp/useAgentTool.ts","../src/agent/webmcp/flush.ts","../src/components/Alert/tool.ts","../src/components/Alert/meta.ts","../src/components/Alert/Alert.tsx","../src/components/Button/tool.ts","../src/components/Button/meta.ts","../src/components/Button/Button.tsx","../src/components/Card/tool.ts","../src/components/Card/meta.ts","../src/components/Card/Card.tsx","../src/components/Checkbox/tool.ts","../src/components/Checkbox/meta.ts","../src/components/Checkbox/Checkbox.tsx","../src/components/CodeBlock/highlight.ts","../src/components/CodeBlock/meta.ts","../src/components/CodeBlock/CodeBlock.tsx","../src/components/DescriptionList/meta.ts","../src/components/DescriptionList/DescriptionList.tsx","../src/components/Dialog/tool.ts","../src/components/Dialog/meta.ts","../src/components/Dialog/Dialog.tsx","../src/components/Heading/meta.ts","../src/components/Heading/Heading.tsx","../src/components/Image/meta.ts","../src/components/Image/Image.tsx","../src/components/Link/tool.ts","../src/components/Link/meta.ts","../src/components/Link/Link.tsx","../src/components/List/meta.ts","../src/components/List/List.tsx","../src/components/MetaLine/meta.ts","../src/components/MetaLine/MetaLine.tsx","../src/components/Nav/meta.ts","../src/components/Nav/Nav.tsx","../src/components/NavBar/meta.ts","../src/components/NavBar/NavBar.tsx","../src/components/NavGroup/meta.ts","../src/components/NavGroup/NavGroup.tsx","../src/components/PageHeader/meta.ts","../src/components/PageHeader/PageHeader.tsx","../src/components/Panel/meta.ts","../src/components/Panel/Panel.tsx","../src/components/SecretField/meta.ts","../src/components/SecretField/SecretField.tsx","../src/components/SegmentedControl/tool.ts","../src/components/SegmentedControl/meta.ts","../src/components/SegmentedControl/SegmentedControl.tsx","../src/components/Select/tool.ts","../src/components/Select/meta.ts","../src/agent/webmcp/drive.ts","../src/components/Select/Select.tsx","../src/components/Shell/meta.ts","../src/components/Shell/Shell.tsx","../src/components/Stack/meta.ts","../src/components/Stack/Stack.tsx","../src/components/Switch/tool.ts","../src/components/Switch/meta.ts","../src/components/Switch/Switch.tsx","../src/components/Table/meta.ts","../src/components/Table/Table.tsx","../src/components/Tag/meta.ts","../src/components/Tag/Tag.tsx","../src/components/Text/meta.ts","../src/components/Text/Text.tsx","../src/components/Textarea/tool.ts","../src/components/Textarea/meta.ts","../src/components/Textarea/Textarea.tsx","../src/components/TextInput/tool.ts","../src/components/TextInput/meta.ts","../src/components/TextInput/TextInput.tsx","../src/provider/pageTools.ts","../src/provider/gloss.ts","../src/provider/SprintProvider.tsx","../src/version.ts"],"sourcesContent":["export const COMPONENT_ATTRIBUTE = \"data-sprint\";\nexport const PART_ATTRIBUTE = \"data-sprint-part\";\nexport const STATE_ATTRIBUTE_PREFIX = \"data-sprint-\";\nexport const TOOL_ATTRIBUTE = \"data-sprint-tool\";\nexport const OWNER_ATTRIBUTE = \"data-sprint-owner\";\nexport const AGENT_ATTRIBUTE = \"data-sprint-agent\";\nexport const VIEW_ATTRIBUTE = \"data-sprint-view\";\nexport const VIEW_COPY_ATTRIBUTE = \"data-sprint-view-copy\";\nexport const THEME_ATTRIBUTE = \"data-sprint-theme\";\nexport const REGION_ATTRIBUTE = \"data-sprint-region\";\n\nexport const RESERVED_STATE_KEYS: readonly string[] = [\n \"part\",\n \"tool\",\n \"owner\",\n \"agent\",\n \"view\",\n \"view-copy\",\n \"theme\",\n \"region\",\n \"ornament\",\n];\n\nexport type AgentAttributeValue = string | number | boolean | null | undefined;\n\nexport interface AgentAttributeOptions {\n part?: string;\n state?: Record<string, AgentAttributeValue>;\n}\n\nexport function agentAttributes(\n component: string,\n options: AgentAttributeOptions = {},\n): Record<string, string> {\n const attributes: Record<string, string> = {\n [COMPONENT_ATTRIBUTE]: component,\n };\n\n if (options.part) {\n attributes[PART_ATTRIBUTE] = options.part;\n }\n\n for (const [key, value] of Object.entries(options.state ?? {})) {\n if (value === null || value === undefined || value === false) continue;\n attributes[`${STATE_ATTRIBUTE_PREFIX}${key}`] = value === true ? \"\" : String(value);\n }\n\n return attributes;\n}\n\nexport function agentSelector(component: string, part?: string): string {\n const base = `[${COMPONENT_ATTRIBUTE}=\"${component}\"]`;\n return part ? `${base} [${PART_ATTRIBUTE}=\"${part}\"]` : base;\n}\n","export const TRUNCATION_MARKER = \"\\n… truncated\";\n\nexport function clamp(text: string, max: number): string {\n if (text.length <= max) return text;\n if (max <= TRUNCATION_MARKER.length) return text.slice(0, max);\n\n const budget = max - TRUNCATION_MARKER.length;\n const head = text.slice(0, budget);\n const boundary = head.lastIndexOf(\"\\n\");\n const cut = boundary > budget / 2 ? head.slice(0, boundary) : head.trimEnd();\n\n return `${cut}${TRUNCATION_MARKER}`;\n}\n\nexport function paginate(text: string, size: number): string[] {\n if (size <= 0) return [text];\n\n const lines = text.split(\"\\n\");\n const pages: string[] = [];\n let current = \"\";\n\n for (const line of lines) {\n const candidate = current === \"\" ? line : `${current}\\n${line}`;\n if (candidate.length <= size) {\n current = candidate;\n continue;\n }\n if (current !== \"\") pages.push(current);\n current = line.length <= size ? line : \"\";\n if (line.length > size) {\n for (let index = 0; index < line.length; index += size) {\n pages.push(line.slice(index, index + size));\n }\n }\n }\n\n if (current !== \"\") pages.push(current);\n return pages.length === 0 ? [\"\"] : pages;\n}\n","import { clamp } from \"@/agent/view/truncate.ts\";\nimport type {\n JsonSchemaObject,\n ModelContext,\n ToolDescriptor,\n ToolExecuteContext,\n} from \"./types.ts\";\n\nexport const TOOL_OUTPUT_LIMIT = 1500;\nexport const TOOL_DESCRIPTION_LIMIT = 500;\nexport const PARAM_DESCRIPTION_LIMIT = 150;\n\nexport function getModelContext(): ModelContext | null {\n if (typeof document === \"undefined\") return null;\n return document.modelContext ?? null;\n}\n\nexport function isModelContextAvailable(): boolean {\n return getModelContext() !== null;\n}\n\nfunction assertDescriptorLimits(descriptor: ToolDescriptor): void {\n if (descriptor.description.length > TOOL_DESCRIPTION_LIMIT) {\n throw new Error(\n `Tool \"${descriptor.name}\" description is ${descriptor.description.length} characters; the platform limit is ${TOOL_DESCRIPTION_LIMIT}.`,\n );\n }\n\n for (const [key, property] of Object.entries(descriptor.inputSchema.properties)) {\n const description = property.description ?? \"\";\n if (description.length > PARAM_DESCRIPTION_LIMIT) {\n throw new Error(\n `Tool \"${descriptor.name}\" parameter \"${key}\" description is ${description.length} characters; the platform limit is ${PARAM_DESCRIPTION_LIMIT}.`,\n );\n }\n }\n}\n\nexport function validateInputs(\n schema: JsonSchemaObject,\n inputs: Record<string, unknown>,\n): string | null {\n for (const key of schema.required ?? []) {\n if (inputs[key] === undefined) {\n const known = Object.keys(schema.properties).join(\", \");\n return `Missing required parameter \"${key}\". Expected parameters: ${known || \"none\"}.`;\n }\n }\n\n for (const [key, value] of Object.entries(inputs)) {\n if (value === undefined) continue;\n const property = schema.properties[key];\n if (property === undefined) {\n const known = Object.keys(schema.properties).join(\", \");\n return `Unknown parameter \"${key}\". Expected parameters: ${known || \"none\"}.`;\n }\n\n const actual = typeof value;\n const wantsNumber = property.type === \"number\" || property.type === \"integer\";\n const matches =\n (property.type === \"string\" && actual === \"string\") ||\n (wantsNumber && actual === \"number\") ||\n (property.type === \"boolean\" && actual === \"boolean\");\n\n if (!matches) {\n return `Parameter \"${key}\" must be a ${property.type}, received ${actual}.`;\n }\n\n if (property.enum !== undefined && !property.enum.includes(String(value))) {\n return `Parameter \"${key}\" must be one of: ${property.enum.join(\", \")}.`;\n }\n }\n\n return null;\n}\n\nfunction harden(descriptor: ToolDescriptor): ToolDescriptor {\n const execute = async (\n inputs: Record<string, unknown>,\n context: ToolExecuteContext,\n ): Promise<string | null> => {\n const invalid = validateInputs(descriptor.inputSchema, inputs ?? {});\n if (invalid !== null) return invalid;\n\n try {\n const result = await descriptor.execute(inputs ?? {}, context);\n return result === null ? null : clamp(result, TOOL_OUTPUT_LIMIT);\n } catch (error) {\n const reason = error instanceof Error ? error.message : String(error);\n return clamp(`Tool \"${descriptor.name}\" failed: ${reason}`, TOOL_OUTPUT_LIMIT);\n }\n };\n\n return { ...descriptor, execute };\n}\n\nexport function registerTool(descriptor: ToolDescriptor, signal: AbortSignal): boolean {\n assertDescriptorLimits(descriptor);\n\n const context = getModelContext();\n if (context === null) return false;\n if (signal.aborted) return false;\n\n const result = context.registerTool(harden(descriptor), { signal });\n if (result instanceof Promise) {\n result.catch((error: unknown) => {\n console.warn(`Sprint could not register tool \"${descriptor.name}\"`, error);\n });\n }\n\n return true;\n}\n","import {\n COMPONENT_ATTRIBUTE,\n OWNER_ATTRIBUTE,\n PART_ATTRIBUTE,\n REGION_ATTRIBUTE,\n STATE_ATTRIBUTE_PREFIX,\n TOOL_ATTRIBUTE,\n} from \"./attributes.ts\";\nimport type { AgentComponentMeta, AgentManifest } from \"./types.ts\";\nimport { TOOL_OUTPUT_LIMIT } from \"./webmcp/adapter.ts\";\n\nexport const TOOL_NAMING_CONVENTION = \"<scope>-<verb>-<label-slug>\";\n\nconst registry = new Map<string, AgentComponentMeta>();\n\nexport function defineAgentMeta<const T extends AgentComponentMeta>(meta: T): T {\n const existing = registry.get(meta.name);\n if (existing !== undefined && existing !== meta) {\n console.warn(\n `Agent metadata for \"${meta.name}\" was replaced. Two components sharing a name will collapse into one manifest entry.`,\n );\n }\n registry.set(meta.name, meta);\n return meta;\n}\n\nexport function getAgentMeta(name: string): AgentComponentMeta | undefined {\n return registry.get(name);\n}\n\nexport function listAgentMeta(): AgentComponentMeta[] {\n return [...registry.values()].sort((a, b) => a.name.localeCompare(b.name));\n}\n\nexport function buildAgentManifest(version: string): AgentManifest {\n return {\n library: \"sprint\",\n version,\n conventions: {\n componentAttribute: COMPONENT_ATTRIBUTE,\n partAttribute: PART_ATTRIBUTE,\n stateAttributePrefix: STATE_ATTRIBUTE_PREFIX,\n toolAttribute: TOOL_ATTRIBUTE,\n ownerAttribute: OWNER_ATTRIBUTE,\n regionAttribute: REGION_ATTRIBUTE,\n agentViewFormat: \"markdown\",\n toolNaming: TOOL_NAMING_CONVENTION,\n toolOutputLimit: TOOL_OUTPUT_LIMIT,\n },\n components: listAgentMeta(),\n };\n}\n","export type AgentStateValue = string | true;\n\nexport interface AgentPart {\n part: string;\n label?: string;\n state: Record<string, AgentStateValue>;\n tool?: string;\n}\n\nexport interface AgentNode {\n component: string;\n summary?: string;\n label?: string;\n state: Record<string, AgentStateValue>;\n parts: AgentPart[];\n tool?: string;\n owner?: string;\n region?: true;\n children: AgentNode[];\n truncated?: true;\n}\n\nexport type AgentFormatter = (nodes: readonly AgentNode[]) => string;\n\nexport function isEmptyNode(node: AgentNode): boolean {\n return (\n node.label === undefined && node.parts.length === 0 && node.children.length === 0\n );\n}\n\nexport function countNodes(nodes: readonly AgentNode[]): number {\n let total = 0;\n for (const node of nodes) {\n total += 1 + countNodes(node.children);\n }\n return total;\n}\n\nexport function collectTools(nodes: readonly AgentNode[]): string[] {\n const names: string[] = [];\n for (const node of nodes) {\n if (node.tool) names.push(node.tool);\n for (const part of node.parts) {\n if (part.tool) names.push(part.tool);\n }\n names.push(...collectTools(node.children));\n }\n return names;\n}\n","import type { AgentNode, AgentPart, AgentStateValue } from \"./node.ts\";\nimport { isEmptyNode } from \"./node.ts\";\n\nexport interface MarkdownOptions {\n includeSummary?: boolean;\n}\n\nfunction formatState(state: Record<string, AgentStateValue>): string {\n const keys = Object.keys(state).sort();\n if (keys.length === 0) return \"\";\n\n const rendered = keys.map((key) => {\n const value = state[key];\n return value === true ? key : `${key}=${value}`;\n });\n\n return ` [${rendered.join(\", \")}]`;\n}\n\nfunction formatLabel(label: string | undefined): string {\n return label === undefined ? \"\" : ` \"${label}\"`;\n}\n\nfunction formatTool(tool: string | undefined): string {\n return tool === undefined ? \"\" : ` → tool \\`${tool}\\``;\n}\n\nfunction partLine(part: AgentPart, indent: string): string {\n return `${indent}- part \\`${part.part}\\`${formatLabel(part.label)}${formatState(\n part.state,\n )}${formatTool(part.tool)}`;\n}\n\nexport function nodeLine(node: AgentNode): string {\n const suffix = isEmptyNode(node) ? \" (empty)\" : \"\";\n const owned = node.owner === undefined ? \"\" : ` (owned by \\`${node.owner}\\`)`;\n return `- **${node.component}**${formatLabel(node.label)}${formatState(\n node.state,\n )}${formatTool(node.tool)}${owned}${suffix}`;\n}\n\nfunction nodeLines(\n node: AgentNode,\n indent: string,\n options: Required<MarkdownOptions>,\n): string[] {\n const lines = [`${indent}${nodeLine(node)}`];\n\n const inner = `${indent} `;\n\n if (options.includeSummary && node.summary !== undefined) {\n for (const line of node.summary.split(\"\\n\")) {\n lines.push(`${inner}${line}`);\n }\n }\n\n for (const part of node.parts) {\n lines.push(partLine(part, inner));\n }\n\n for (const child of node.children) {\n lines.push(...nodeLines(child, inner, options));\n }\n\n if (node.truncated) {\n lines.push(`${inner}- … nested components omitted, depth limit reached`);\n }\n\n return lines;\n}\n\nexport function toMarkdown(\n input: AgentNode | readonly AgentNode[],\n options: MarkdownOptions = {},\n): string {\n const nodes = Array.isArray(input) ? input : [input as AgentNode];\n const resolved: Required<MarkdownOptions> = {\n includeSummary: options.includeSummary ?? true,\n };\n\n if (nodes.length === 0) return \"No Sprint components found.\";\n\n return nodes.flatMap((node) => nodeLines(node, \"\", resolved)).join(\"\\n\");\n}\n","import { createContext, useContext } from \"react\";\nimport { toMarkdown } from \"./markdown.ts\";\nimport type { AgentFormatter } from \"./node.ts\";\n\nexport type SprintView = \"human\" | \"agent\";\n\nexport type SprintAgentControls = \"always\" | \"never\";\n\nexport const defaultAgentFormat: AgentFormatter = (nodes) => toMarkdown(nodes);\n\nexport interface SprintViewValue {\n view: SprintView;\n setView: (view: SprintView) => void;\n controls: SprintAgentControls;\n format: AgentFormatter;\n owned: boolean;\n}\n\nconst ViewContext = createContext<SprintViewValue>({\n view: \"human\",\n setView: () => {},\n controls: \"always\",\n format: defaultAgentFormat,\n owned: false,\n});\n\nexport const SprintViewProvider = ViewContext.Provider;\n\nexport function useSprintView(): SprintView {\n return useContext(ViewContext).view;\n}\n\nexport function useSprintViewControl(): SprintViewValue {\n return useContext(ViewContext);\n}\n\nexport function useAgentControls(): SprintAgentControls {\n return useContext(ViewContext).controls;\n}\n\nexport function useAgentFormat(): AgentFormatter {\n return useContext(ViewContext).format;\n}\n\nconst DepthContext = createContext(0);\n\nexport const AgentDepthProvider = DepthContext.Provider;\n\nexport function useAgentDepth(): number {\n return useContext(DepthContext);\n}\n","import {\n AGENT_ATTRIBUTE,\n agentAttributes,\n COMPONENT_ATTRIBUTE,\n PART_ATTRIBUTE,\n TOOL_ATTRIBUTE,\n} from \"@/agent/attributes.ts\";\nimport type { AgentNode, AgentPart, AgentStateValue } from \"./node.ts\";\n\nexport interface NodeInput {\n component: string;\n label?: string | undefined;\n summary?: string | undefined;\n tool?: string | undefined;\n owner?: string | undefined;\n region?: boolean | undefined;\n state?: Record<string, AgentStateValue | false | null | undefined>;\n parts?: AgentPart[];\n}\n\nexport function buildAgentNode(input: NodeInput): AgentNode {\n const state: Record<string, AgentStateValue> = {};\n for (const [key, value] of Object.entries(input.state ?? {})) {\n if (value === false || value === null || value === undefined) continue;\n state[key] = value;\n }\n\n return {\n component: input.component,\n state,\n parts: input.parts ?? [],\n children: [],\n ...(input.label === undefined ? {} : { label: input.label }),\n ...(input.summary === undefined ? {} : { summary: input.summary }),\n ...(input.tool === undefined ? {} : { tool: input.tool }),\n ...(input.owner === undefined ? {} : { owner: input.owner }),\n ...(input.region === true ? { region: true as const } : {}),\n };\n}\n\nexport function agentAttributesFor(node: AgentNode): Record<string, string> {\n return agentAttributes(node.component, {\n state: {\n ...node.state,\n tool: node.tool,\n owner: node.owner,\n region: node.region,\n },\n });\n}\n\nexport function agentControlSelector(component: string, tool?: string): string {\n return tool === undefined\n ? `[${AGENT_ATTRIBUTE}=\"${component}\"]`\n : `[${TOOL_ATTRIBUTE}=\"${tool}\"]`;\n}\n\nexport function agentControlAttributes(node: AgentNode): Record<string, string> {\n const attributes: Record<string, string> = { [AGENT_ATTRIBUTE]: node.component };\n if (node.tool !== undefined) attributes[TOOL_ATTRIBUTE] = node.tool;\n return attributes;\n}\n\nexport function agentPartControlAttributes(\n component: string,\n part: AgentPart,\n): Record<string, string> {\n const attributes: Record<string, string> = {\n [AGENT_ATTRIBUTE]: component,\n [PART_ATTRIBUTE]: part.part,\n };\n if (part.tool !== undefined) attributes[TOOL_ATTRIBUTE] = part.tool;\n return attributes;\n}\n\nexport function agentPartAttributesFor(part: AgentPart): Record<string, string> {\n const { [COMPONENT_ATTRIBUTE]: _root, ...attributes } = agentAttributes(\"\", {\n part: part.part,\n state: { ...part.state, tool: part.tool },\n });\n return attributes;\n}\n","import {\n type ComponentPropsWithRef,\n Fragment,\n type MouseEventHandler,\n type ReactNode,\n type Ref,\n} from \"react\";\nimport { AgentDepthProvider, useAgentDepth, useAgentFormat } from \"./mode.ts\";\nimport type { AgentFormatter, AgentNode, AgentPart } from \"./node.ts\";\nimport { agentControlAttributes, agentPartControlAttributes } from \"./project.ts\";\n\nfunction format(node: AgentNode, formatter: AgentFormatter): string[] {\n return formatter([node]).split(\"\\n\");\n}\n\nexport interface AgentLineProps {\n node: AgentNode;\n children?: ReactNode;\n}\n\nexport function AgentLine(props: AgentLineProps) {\n const { node, children } = props;\n const depth = useAgentDepth();\n const formatter = useAgentFormat();\n const indent = \" \".repeat(depth);\n const lines = format(node, formatter).map((line) => `${indent}${line}`);\n\n return (\n <AgentDepthProvider value={depth + 1}>\n {`${lines.join(\"\\n\")}\\n`}\n {children}\n </AgentDepthProvider>\n );\n}\n\nexport interface AgentControlGroupProps {\n node: AgentNode;\n onActivate: (part: AgentPart, index: number) => void;\n isActionable?: (part: AgentPart, index: number) => boolean;\n children?: ReactNode;\n}\n\nexport function AgentControlGroup(props: AgentControlGroupProps) {\n const { node, onActivate, isActionable, children } = props;\n const depth = useAgentDepth();\n const formatter = useAgentFormat();\n const indent = \" \".repeat(depth);\n const lines = format(node, formatter);\n const offset = lines.length - node.parts.length;\n const head = lines.slice(0, offset).map((line) => `${indent}${line}`);\n\n return (\n <AgentDepthProvider value={depth + 1}>\n {`${head.join(\"\\n\")}\\n`}\n {node.parts.map((part, index) => {\n const line = lines[offset + index] ?? \"\";\n const body = line.trimStart();\n const lead = `${indent}${line.slice(0, line.length - body.length)}`;\n const key = `${part.part}-${part.label ?? index}`;\n\n if (isActionable !== undefined && !isActionable(part, index)) {\n return <Fragment key={key}>{`${lead}${body}\\n`}</Fragment>;\n }\n\n return (\n <Fragment key={key}>\n {lead}\n <button\n type=\"button\"\n {...agentPartControlAttributes(node.component, part)}\n onClick={() => onActivate(part, index)}\n >\n {body}\n </button>\n {\"\\n\"}\n </Fragment>\n );\n })}\n {children}\n </AgentDepthProvider>\n );\n}\n\nexport type AgentFieldControlProps = {\n node: AgentNode;\n value: string;\n onValueChange: (value: string) => void;\n multiline?: boolean;\n masked?: boolean;\n ref?: Ref<HTMLInputElement> | Ref<HTMLTextAreaElement> | undefined;\n};\n\nexport function AgentFieldControl(props: AgentFieldControlProps) {\n const { node, value, onValueChange, multiline = false, masked = false, ref } = props;\n const depth = useAgentDepth();\n const formatter = useAgentFormat();\n const indent = \" \".repeat(depth);\n const lines = format(node, formatter).map((line) => `${indent}${line}`);\n const attributes = agentControlAttributes(node);\n\n const control = multiline ? (\n <textarea\n {...attributes}\n aria-label={node.label}\n value={value}\n onChange={(event) => onValueChange(event.currentTarget.value)}\n ref={ref as Ref<HTMLTextAreaElement>}\n />\n ) : (\n <input\n {...attributes}\n aria-label={node.label}\n type={masked ? \"password\" : \"text\"}\n value={value}\n onChange={(event) => onValueChange(event.currentTarget.value)}\n ref={ref as Ref<HTMLInputElement>}\n />\n );\n\n return (\n <AgentDepthProvider value={depth + 1}>\n {`${lines.join(\"\\n\")}\\n`}\n {indent}\n {control}\n {\"\\n\"}\n </AgentDepthProvider>\n );\n}\n\nexport type AgentControlProps = Omit<\n ComponentPropsWithRef<\"button\">,\n \"children\" | \"ref\" | \"onClick\"\n> & {\n node: AgentNode;\n as?: \"button\" | \"a\" | undefined;\n href?: string | undefined;\n target?: string | undefined;\n rel?: string | undefined;\n onClick?:\n | MouseEventHandler<HTMLButtonElement>\n | MouseEventHandler<HTMLAnchorElement>\n | undefined;\n ref?: Ref<HTMLButtonElement> | Ref<HTMLAnchorElement> | undefined;\n children?: ReactNode;\n};\n\nexport function AgentControl(props: AgentControlProps) {\n const { node, as = \"button\", href, children, ref, ...rest } = props;\n const depth = useAgentDepth();\n const formatter = useAgentFormat();\n const indent = \" \".repeat(depth);\n const [head = \"\", ...rows] = format(node, formatter);\n const tail = rows.map((line) => `${indent}${line}`);\n const attributes = agentControlAttributes(node);\n\n const control =\n as === \"a\" ? (\n <a\n {...(rest as unknown as ComponentPropsWithRef<\"a\">)}\n {...attributes}\n href={href ?? \"#\"}\n ref={ref as Ref<HTMLAnchorElement>}\n >\n {head}\n </a>\n ) : (\n <button\n {...(rest as unknown as ComponentPropsWithRef<\"button\">)}\n {...attributes}\n ref={ref as Ref<HTMLButtonElement>}\n >\n {head}\n </button>\n );\n\n return (\n <AgentDepthProvider value={depth + 1}>\n {indent}\n {control}\n {tail.length === 0 ? \"\\n\" : `\\n${tail.join(\"\\n\")}\\n`}\n {children}\n </AgentDepthProvider>\n );\n}\n","import type { AgentNode, AgentPart } from \"./node.ts\";\n\nfunction isCell(part: AgentPart): boolean {\n return (\n part.part === \"cell\" &&\n typeof part.state.column === \"string\" &&\n typeof part.state.row === \"string\"\n );\n}\n\nfunction text(value: string): string {\n return value.replace(/\\|/g, \"\\\\|\").replace(/\\s*\\n\\s*/g, \" \");\n}\n\nfunction cellKey(row: string, column: string): string {\n return JSON.stringify([row, column]);\n}\n\nexport function condenseCells(node: AgentNode): AgentNode {\n if (node.parts.length === 0 || !node.parts.every(isCell)) return node;\n\n const columns: string[] = [];\n const rowIds: string[] = [];\n const cells = new Map<string, string>();\n\n for (const part of node.parts) {\n const column = String(part.state.column);\n const row = String(part.state.row);\n if (!columns.includes(column)) columns.push(column);\n if (!rowIds.includes(row)) rowIds.push(row);\n cells.set(cellKey(row, column), part.label ?? \"\");\n }\n\n const summary = [\n `| row | ${columns.map(text).join(\" | \")} |`,\n `| --- | ${columns.map(() => \"---\").join(\" | \")} |`,\n ...rowIds.map(\n (row) =>\n `| ${text(row)} | ${columns\n .map((column) => text(cells.get(cellKey(row, column)) ?? \"\"))\n .join(\" | \")} |`,\n ),\n ].join(\"\\n\");\n\n return { ...node, parts: [], summary };\n}\n","import { isValidElement, type ReactNode } from \"react\";\nimport { COMPONENT_ATTRIBUTE } from \"@/agent/attributes.ts\";\n\nfunction normalize(value: string): string {\n return value.replace(/\\s+/g, \" \").trim();\n}\n\ninterface TextualProps {\n children?: ReactNode;\n \"aria-hidden\"?: boolean | string;\n \"aria-label\"?: string;\n}\n\nfunction gatherReact(node: ReactNode, out: string[]): void {\n if (node === null || node === undefined || typeof node === \"boolean\") return;\n\n if (typeof node === \"string\" || typeof node === \"number\") {\n out.push(String(node));\n return;\n }\n\n if (Array.isArray(node)) {\n for (const child of node) gatherReact(child as ReactNode, out);\n return;\n }\n\n if (!isValidElement(node)) return;\n\n const props = node.props as TextualProps;\n if (props[\"aria-hidden\"] === true || props[\"aria-hidden\"] === \"true\") return;\n if (typeof props[\"aria-label\"] === \"string\") {\n out.push(props[\"aria-label\"]);\n return;\n }\n\n gatherReact(props.children, out);\n}\n\nexport function reactText(node: ReactNode): string | undefined {\n const parts: string[] = [];\n gatherReact(node, parts);\n const text = normalize(parts.join(\"\"));\n return text === \"\" ? undefined : text;\n}\n\nfunction isHidden(element: Element): boolean {\n return (\n element.getAttribute(\"aria-hidden\") === \"true\" || element.hasAttribute(\"hidden\")\n );\n}\n\nfunction gather(node: Node, out: string[], depth: number): void {\n if (node.nodeType === Node.TEXT_NODE) {\n out.push(node.nodeValue ?? \"\");\n return;\n }\n\n if (node.nodeType !== Node.ELEMENT_NODE) return;\n\n const element = node as Element;\n if (isHidden(element)) return;\n if (depth > 0 && element.hasAttribute(COMPONENT_ATTRIBUTE)) return;\n\n const label = element.getAttribute(\"aria-label\");\n if (depth > 0 && label !== null) {\n out.push(label);\n return;\n }\n\n for (const child of Array.from(element.childNodes)) {\n gather(child, out, depth + 1);\n }\n}\n\nexport function accessibleText(element: Element): string | undefined {\n const label = element.getAttribute(\"aria-label\");\n if (label !== null) {\n const direct = normalize(label);\n return direct === \"\" ? undefined : direct;\n }\n\n const labelledBy = element.getAttribute(\"aria-labelledby\");\n if (labelledBy !== null) {\n const root = element.ownerDocument;\n const referenced = labelledBy\n .split(/\\s+/)\n .filter((id) => id !== \"\")\n .map((id) => root.getElementById(id))\n .filter((target): target is HTMLElement => target !== null)\n .map((target) => accessibleText(target) ?? \"\")\n .filter((text) => text !== \"\");\n if (referenced.length > 0) return normalize(referenced.join(\" \"));\n }\n\n const parts: string[] = [];\n gather(element, parts, 0);\n const text = normalize(parts.join(\"\"));\n return text === \"\" ? undefined : text;\n}\n","import {\n COMPONENT_ATTRIBUTE,\n OWNER_ATTRIBUTE,\n PART_ATTRIBUTE,\n REGION_ATTRIBUTE,\n RESERVED_STATE_KEYS,\n STATE_ATTRIBUTE_PREFIX,\n TOOL_ATTRIBUTE,\n} from \"@/agent/attributes.ts\";\nimport { getAgentMeta } from \"@/agent/registry.ts\";\nimport type { AgentComponentMeta } from \"@/agent/types.ts\";\nimport type { AgentNode, AgentPart, AgentStateValue } from \"./node.ts\";\nimport { condenseCells } from \"./tabular.ts\";\nimport { accessibleText } from \"./text.ts\";\n\nconst reserved = new Set(RESERVED_STATE_KEYS);\n\nconst NATIVE_BOOLEAN_STATE: ReadonlyMap<string, string> = new Map([\n [\"disabled\", \"disabled\"],\n [\"open\", \"open\"],\n [\"readonly\", \"readonly\"],\n [\"required\", \"required\"],\n]);\n\nconst ARIA_STATE: ReadonlyMap<string, string> = new Map([\n [\"aria-disabled\", \"disabled\"],\n [\"aria-busy\", \"loading\"],\n [\"aria-expanded\", \"expanded\"],\n [\"aria-checked\", \"checked\"],\n [\"aria-selected\", \"selected\"],\n [\"aria-pressed\", \"pressed\"],\n [\"aria-invalid\", \"invalid\"],\n]);\n\nexport interface SerializeOptions {\n maxDepth?: number;\n lookupMeta?: (name: string) => AgentComponentMeta | undefined;\n}\n\nfunction readState(element: Element): Record<string, AgentStateValue> {\n const state: Record<string, AgentStateValue> = {};\n\n for (const [attribute, key] of ARIA_STATE) {\n const value = element.getAttribute(attribute);\n if (value === null || value === \"false\") continue;\n state[key] = value === \"true\" || value === \"\" ? true : value;\n }\n\n for (const [attribute, key] of NATIVE_BOOLEAN_STATE) {\n if (element.hasAttribute(attribute)) state[key] = true;\n }\n\n for (const attribute of Array.from(element.attributes)) {\n if (!attribute.name.startsWith(STATE_ATTRIBUTE_PREFIX)) continue;\n const key = attribute.name.slice(STATE_ATTRIBUTE_PREFIX.length);\n if (key === \"\" || reserved.has(key)) continue;\n state[key] = attribute.value === \"\" ? true : attribute.value;\n }\n\n return state;\n}\n\nfunction scan(root: Element): { parts: Element[]; children: Element[] } {\n const parts: Element[] = [];\n const children: Element[] = [];\n\n const walk = (element: Element): void => {\n for (const child of Array.from(element.children)) {\n if (child.hasAttribute(COMPONENT_ATTRIBUTE)) {\n children.push(child);\n continue;\n }\n if (child.hasAttribute(PART_ATTRIBUTE)) parts.push(child);\n walk(child);\n }\n };\n\n walk(root);\n return { parts, children };\n}\n\nfunction toPart(element: Element): AgentPart {\n const name = element.getAttribute(PART_ATTRIBUTE) ?? \"\";\n const label = accessibleText(element);\n const tool = element.getAttribute(TOOL_ATTRIBUTE);\n return {\n part: name,\n state: readState(element),\n ...(label === undefined ? {} : { label }),\n ...(tool === null || tool === \"\" ? {} : { tool }),\n };\n}\n\nexport function serializeElement(\n root: Element,\n options: SerializeOptions = {},\n): AgentNode | null {\n const component = root.getAttribute(COMPONENT_ATTRIBUTE);\n if (component === null) return null;\n\n const maxDepth = options.maxDepth ?? 8;\n const lookupMeta = options.lookupMeta ?? getAgentMeta;\n\n const { parts, children } = scan(root);\n const label = accessibleText(root);\n const summary = lookupMeta(component)?.summary;\n const tool = root.getAttribute(TOOL_ATTRIBUTE);\n const owner = root.getAttribute(OWNER_ATTRIBUTE);\n const exhausted = maxDepth <= 0 && children.length > 0;\n\n return condenseCells({\n component,\n state: readState(root),\n parts: parts.map(toPart),\n children: exhausted\n ? []\n : children\n .map((child) =>\n serializeElement(child, { ...options, maxDepth: maxDepth - 1 }),\n )\n .filter((node): node is AgentNode => node !== null),\n ...(summary === undefined ? {} : { summary }),\n ...(label === undefined ? {} : { label }),\n ...(tool === null || tool === \"\" ? {} : { tool }),\n ...(owner === null || owner === \"\" ? {} : { owner }),\n ...(root.hasAttribute(REGION_ATTRIBUTE) ? { region: true as const } : {}),\n ...(exhausted ? { truncated: true as const } : {}),\n });\n}\n\nexport function topLevelRoots(root: ParentNode): Element[] {\n const found: Element[] = [];\n\n const walk = (element: ParentNode): void => {\n for (const child of Array.from(element.children)) {\n if (child.hasAttribute(COMPONENT_ATTRIBUTE)) {\n found.push(child);\n continue;\n }\n walk(child);\n }\n };\n\n walk(root);\n return found;\n}\n\nfunction reattachOwned(nodes: AgentNode[]): AgentNode[] {\n const owned = nodes.filter((node) => node.owner !== undefined);\n if (owned.length === 0) return nodes;\n\n const byTool = new Map<string, AgentNode>();\n const index = (node: AgentNode): void => {\n if (node.tool) byTool.set(node.tool, node);\n for (const part of node.parts) {\n if (part.tool) byTool.set(part.tool, node);\n }\n for (const child of node.children) index(child);\n };\n for (const node of nodes) index(node);\n\n const attached = new Set<AgentNode>();\n for (const node of owned) {\n const host = node.owner === undefined ? undefined : byTool.get(node.owner);\n if (host === undefined || host === node) continue;\n host.children.push(node);\n attached.add(node);\n }\n\n return nodes.filter((node) => !attached.has(node));\n}\n\nexport function serializeWithin(\n root: ParentNode,\n options: SerializeOptions = {},\n): AgentNode[] {\n const nodes = topLevelRoots(root)\n .map((element) => serializeElement(element, options))\n .filter((node): node is AgentNode => node !== null);\n return reattachOwned(nodes);\n}\n","export function afterCommit(): Promise<void> {\n return new Promise((resolve) => {\n if (typeof requestAnimationFrame !== \"function\") {\n setTimeout(resolve, 0);\n return;\n }\n requestAnimationFrame(() => {\n requestAnimationFrame(() => resolve());\n });\n });\n}\n","import { createContext, useContext } from \"react\";\n\nexport const MAX_NAME_LENGTH = 48;\n\nexport function slug(value: string): string {\n return value\n .normalize(\"NFKD\")\n .replace(/[̀-ͯ]/g, \"\")\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, \"-\")\n .replace(/^-+|-+$/g, \"\");\n}\n\nexport function toolName(\n scope: readonly string[],\n verb: string,\n label: string,\n): string | null {\n const tail = slug(label);\n if (tail === \"\") return null;\n\n const core = [slug(verb), tail].filter((part) => part !== \"\").join(\"-\");\n const segments = scope.map(slug).filter((part) => part !== \"\");\n\n while (\n segments.length > 0 &&\n [...segments, core].join(\"-\").length > MAX_NAME_LENGTH\n ) {\n segments.shift();\n }\n\n const name = [...segments, core].join(\"-\");\n if (name.length <= MAX_NAME_LENGTH) return name;\n\n const cut = name.slice(0, MAX_NAME_LENGTH);\n const boundary = cut.lastIndexOf(\"-\");\n return boundary > 0 ? cut.slice(0, boundary) : cut;\n}\n\nexport type ClaimListener = () => void;\n\ninterface Claim {\n holders: Set<symbol>;\n listeners: Map<symbol, ClaimListener>;\n}\n\nconst claims = new Map<string, Claim>();\n\nfunction claimFor(name: string): Claim {\n const existing = claims.get(name);\n if (existing !== undefined) return existing;\n const created: Claim = { holders: new Set(), listeners: new Map() };\n claims.set(name, created);\n return created;\n}\n\nexport function claimToolName(\n name: string,\n holder: symbol,\n onChange: ClaimListener,\n): () => void {\n const claim = claimFor(name);\n claim.holders.add(holder);\n claim.listeners.set(holder, onChange);\n\n for (const [id, listener] of claim.listeners) {\n if (id !== holder) listener();\n }\n\n return () => {\n claim.holders.delete(holder);\n claim.listeners.delete(holder);\n if (claim.holders.size === 0) {\n claims.delete(name);\n return;\n }\n for (const listener of claim.listeners.values()) listener();\n };\n}\n\nexport function holdsToolName(name: string, holder: symbol): boolean {\n const claim = claims.get(name);\n if (claim === undefined) return false;\n return claim.holders.size === 1 && claim.holders.has(holder);\n}\n\nexport function toolNameHolderCount(name: string): number {\n return claims.get(name)?.holders.size ?? 0;\n}\n\nexport function __resetToolNames(): void {\n claims.clear();\n}\n\nexport interface AgentScopeValue {\n path: readonly string[];\n}\n\nconst AgentScopeContext = createContext<AgentScopeValue>({ path: [] });\n\nexport const AgentScopeProvider = AgentScopeContext.Provider;\n\nexport function useAgentScope(): readonly string[] {\n return useContext(AgentScopeContext).path;\n}\n","import { useEffect, useRef, useState } from \"react\";\nimport type { AgentToolSpec } from \"@/agent/types.ts\";\nimport { registerTool } from \"./adapter.ts\";\nimport {\n claimToolName,\n holdsToolName,\n toolName,\n toolNameHolderCount,\n useAgentScope,\n} from \"./scope.ts\";\nimport type { JsonSchemaObject, ToolExecuteContext } from \"./types.ts\";\n\nexport interface UseAgentToolOptions {\n spec: AgentToolSpec;\n label: string | undefined;\n nameOverride?: string | undefined;\n inputSchema?: JsonSchemaObject | undefined;\n enabled?: boolean;\n execute: (\n inputs: Record<string, unknown>,\n context: ToolExecuteContext,\n ) => Promise<string | null> | string | null;\n}\n\nexport function useAgentTool(options: UseAgentToolOptions): string | undefined {\n const { spec, label, nameOverride, inputSchema, enabled = true, execute } = options;\n const scope = useAgentScope();\n\n const schemaKey = `${spec.verb}|${\n inputSchema === undefined ? \"\" : JSON.stringify(inputSchema)\n }`;\n const schemaRef = useRef({ key: schemaKey, value: inputSchema ?? spec.inputSchema });\n if (schemaRef.current.key !== schemaKey) {\n schemaRef.current = { key: schemaKey, value: inputSchema ?? spec.inputSchema };\n }\n const schema = schemaRef.current.value;\n\n const holderRef = useRef<symbol | null>(null);\n if (holderRef.current === null) holderRef.current = Symbol(\"sprint-tool\");\n\n const executeRef = useRef(execute);\n useEffect(() => {\n executeRef.current = execute;\n });\n\n const resolved =\n nameOverride === undefined\n ? label === undefined\n ? null\n : toolName(scope, spec.verb, label)\n : toolName(scope, spec.verb, nameOverride);\n\n const [held, setHeld] = useState(false);\n\n useEffect(() => {\n const holder = holderRef.current;\n if (resolved === null || !enabled || holder === null) {\n setHeld(false);\n return;\n }\n\n const release = claimToolName(resolved, holder, () => {\n setHeld(holdsToolName(resolved, holder));\n });\n\n if (toolNameHolderCount(resolved) > 1) {\n console.warn(\n `Sprint tool name \"${resolved}\" is claimed by more than one component. None of them will register a tool. Set agentName on all but one, or label them distinctly.`,\n );\n }\n\n setHeld(holdsToolName(resolved, holder));\n\n return () => {\n release();\n setHeld(false);\n };\n }, [resolved, enabled]);\n\n useEffect(() => {\n if (!held || resolved === null) return;\n\n const controller = new AbortController();\n registerTool(\n {\n name: resolved,\n description: spec.description,\n inputSchema: schema,\n annotations: {\n readOnlyHint: spec.readOnly,\n untrustedContentHint: spec.untrustedContent,\n },\n execute: (inputs, context) => executeRef.current(inputs, context),\n },\n controller.signal,\n );\n\n return () => {\n controller.abort();\n };\n }, [held, resolved, spec, schema]);\n\n return held && resolved !== null ? resolved : undefined;\n}\n","import { flushSync } from \"react-dom\";\n\nexport function commitSync(action: () => void): void {\n flushSync(action);\n}\n","import type { AgentToolSpec } from \"@/agent/types.ts\";\n\nexport const DISMISS_ALERT_TOOL: AgentToolSpec = {\n verb: \"dismiss\",\n description:\n \"Dismiss this alert, exactly as a person clicking its dismiss control would. The page decides what dismissal means, usually removing the message. Returns the alert's state after the dismissal, or says the alert left the page.\",\n inputSchema: { type: \"object\", properties: {} },\n readOnly: false,\n untrustedContent: true,\n registeredWhen:\n \"The alert is mounted, has an onDismiss handler, and label or agentName provides a stable name.\",\n unregisteredWhen: \"The alert unmounts or loses its onDismiss handler.\",\n};\n","import { defineAgentMeta } from \"@/agent/registry.ts\";\nimport { DISMISS_ALERT_TOOL } from \"./tool.ts\";\n\nexport const alertMeta = defineAgentMeta({\n name: \"Alert\",\n category: \"feedback\",\n summary:\n \"A status message for the outcome of something that already happened: a notice, a warning, or a failure.\",\n whenToUse:\n 'Use to report the result of an action or a condition the person did not just cause: \"check your inbox\", \"invalid credentials\", \"this key expires soon\". Use tone=\"danger\" for failures, \"warning\" for conditions needing attention, \"info\" for neutral notices, and \"neutral\" for quiet confirmations. Pass onDismiss when the message can be acknowledged and cleared.',\n whenNotToUse:\n \"Do not use for validation on a specific field; the field's own error prop places the message where the problem is. Do not use for confirmation of an action the person is about to take; that is a Dialog.\",\n status: \"experimental\",\n props: {\n children: {\n kind: \"node\",\n description:\n \"The message. Inline content only; it is flattened to text for the agent view.\",\n required: true,\n },\n label: {\n kind: \"string\",\n description:\n \"A short uppercase title above the message. Also derives the dismiss tool name, so prefer a stable phrase.\",\n },\n tone: {\n kind: \"enum\",\n description:\n \"The message's severity. Danger and warning announce assertively; info and neutral announce politely.\",\n values: [\"neutral\", \"info\", \"warning\", \"danger\"],\n default: \"info\",\n },\n onDismiss: {\n kind: \"handler\",\n description:\n \"Called when the dismiss control is pressed. Providing it renders the control and registers the dismiss tool; the page owns removing the alert.\",\n },\n agentName: {\n kind: \"string\",\n description:\n \"Override the label used to derive the dismiss tool name. Required for a dismissible alert with no label.\",\n },\n agentTool: {\n kind: \"boolean\",\n description:\n \"Set false to render a dismissible alert without registering a tool.\",\n default: true,\n },\n },\n state: {\n tone: {\n description: \"The alert's severity.\",\n attribute: \"data-sprint-tone\",\n values: [\"neutral\", \"info\", \"warning\", \"danger\"],\n },\n dismissible: {\n description: \"Present when the alert has a dismiss control.\",\n attribute: \"data-sprint-dismissible\",\n },\n },\n tools: {\n dismiss: DISMISS_ALERT_TOOL,\n },\n agentView: {\n example: '- **Alert** \"Check your inbox\" [dismissible, tone=info]',\n },\n examples: [\n {\n title: \"A sign-in notice\",\n description: \"The default info tone for a neutral status message.\",\n code: '<Alert label=\"Check your inbox\">We sent a sign-in link to nomad@escadrille.test.</Alert>',\n },\n {\n title: \"A dismissible confirmation\",\n description:\n \"Providing onDismiss renders the dismiss control and registers the dismiss tool. Removing the alert is the page's job.\",\n code: '<Alert tone=\"neutral\" label=\"Key revoked\" onDismiss={acknowledge}>The key can no longer authenticate.</Alert>',\n },\n {\n title: \"A failure\",\n description: \"Danger announces assertively via role=alert.\",\n code: '<Alert tone=\"danger\" label=\"Sign-in failed\">Wrong callsign or access code.</Alert>',\n },\n ],\n a11y: {\n role: \"status\",\n notes:\n \"Danger and warning render role=alert and announce assertively; info and neutral render role=status. The dismiss control is a labelled button. Render the alert when the condition occurs rather than toggling its visibility, or the announcement is lost.\",\n },\n});\n","import { type ComponentPropsWithRef, useCallback, useEffect, useRef } from \"react\";\nimport { AgentControlGroup, AgentLine } from \"@/agent/view/AgentText.tsx\";\nimport { useAgentControls, useAgentFormat, useSprintView } from \"@/agent/view/mode.ts\";\nimport type { AgentPart } from \"@/agent/view/node.ts\";\nimport {\n agentAttributesFor,\n agentPartAttributesFor,\n buildAgentNode,\n} from \"@/agent/view/project.ts\";\nimport { reactText } from \"@/agent/view/text.ts\";\nimport { afterCommit } from \"@/agent/webmcp/afterCommit.ts\";\nimport { commitSync } from \"@/agent/webmcp/flush.ts\";\nimport { useAgentTool } from \"@/agent/webmcp/useAgentTool.ts\";\nimport { alertMeta } from \"./meta.ts\";\nimport { DISMISS_ALERT_TOOL } from \"./tool.ts\";\nimport \"./Alert.css\";\n\nexport type AlertTone = \"neutral\" | \"info\" | \"warning\" | \"danger\";\n\nexport interface AlertProps extends ComponentPropsWithRef<\"div\"> {\n tone?: AlertTone;\n label?: string;\n onDismiss?: () => void;\n agentName?: string;\n agentTool?: boolean;\n}\n\nexport function Alert(props: AlertProps) {\n const {\n tone = \"info\",\n label,\n onDismiss,\n agentName,\n agentTool = true,\n children,\n ...rest\n } = props;\n\n const view = useSprintView();\n const controls = useAgentControls();\n const formatter = useAgentFormat();\n\n const element = useRef<HTMLButtonElement | null>(null);\n const onDismissRef = useRef(onDismiss);\n onDismissRef.current = onDismiss;\n const formatRef = useRef(formatter);\n formatRef.current = formatter;\n const nodeRef = useRef(buildAgentNode({ component: alertMeta.name }));\n const mounted = useRef(true);\n\n useEffect(() => {\n mounted.current = true;\n return () => {\n mounted.current = false;\n };\n }, []);\n\n const dismissible = onDismiss !== undefined;\n\n const execute = useCallback(async () => {\n const target = element.current;\n if (target !== null) {\n target.click();\n } else {\n const handler = onDismissRef.current;\n if (handler === undefined) return \"This alert cannot be dismissed.\";\n commitSync(() => handler());\n }\n\n await afterCommit();\n if (!mounted.current) return \"Dismissed. The alert is gone from the page.\";\n return `Dismissed. The alert is now:\\n${formatRef.current([nodeRef.current])}`;\n }, []);\n\n const toolName = useAgentTool({\n spec: DISMISS_ALERT_TOOL,\n label: agentName ?? label,\n enabled: agentTool && dismissible,\n execute,\n });\n\n const message = reactText(children);\n\n const parts: AgentPart[] = [];\n if (message !== undefined) {\n parts.push({ part: \"message\", label: message, state: {} });\n }\n if (dismissible) {\n parts.push({\n part: \"dismiss\",\n label: \"Dismiss\",\n state: {},\n ...(toolName === undefined ? {} : { tool: toolName }),\n });\n }\n\n const node = buildAgentNode({\n component: alertMeta.name,\n label,\n state: { tone, dismissible },\n parts,\n });\n nodeRef.current = node;\n\n if (view === \"agent\") {\n if (!dismissible || controls === \"never\") return <AgentLine node={node} />;\n return (\n <AgentControlGroup\n node={node}\n isActionable={(part) => part.part === \"dismiss\"}\n onActivate={() => onDismiss?.()}\n />\n );\n }\n\n const role = tone === \"danger\" || tone === \"warning\" ? \"alert\" : \"status\";\n\n return (\n <div\n {...rest}\n {...agentAttributesFor(node)}\n role={role}\n {...(label === undefined ? {} : { \"aria-label\": label })}\n >\n {label === undefined ? null : (\n <strong {...agentPartAttributesFor({ part: \"title\", state: {} })}>\n {label}\n </strong>\n )}\n <div {...agentPartAttributesFor({ part: \"message\", state: {} })}>{children}</div>\n {dismissible ? (\n <button\n {...agentPartAttributesFor({\n part: \"dismiss\",\n state: {},\n ...(toolName === undefined ? {} : { tool: toolName }),\n })}\n type=\"button\"\n aria-label=\"Dismiss\"\n ref={element}\n onClick={() => onDismiss?.()}\n >\n ×\n </button>\n ) : null}\n </div>\n );\n}\n","import type { AgentToolSpec } from \"@/agent/types.ts\";\n\nexport const PRESS_TOOL: AgentToolSpec = {\n verb: \"press\",\n description:\n \"Press this button, exactly as a person clicking it would. Returns the button's state after the press, so a follow-up read is usually unnecessary. Any work the press starts is not waited for; if the button enters a loading state the result says so.\",\n inputSchema: { type: \"object\", properties: {} },\n readOnly: false,\n untrustedContent: true,\n registeredWhen:\n \"The button is mounted, enabled, not loading, has a resolvable label, and no other component claims the same tool name.\",\n unregisteredWhen: \"The button unmounts, becomes disabled, or starts loading.\",\n};\n","import { defineAgentMeta } from \"@/agent/registry.ts\";\nimport { PRESS_TOOL } from \"./tool.ts\";\n\nexport const buttonMeta = defineAgentMeta({\n name: \"Button\",\n category: \"action\",\n summary:\n \"A single action a person or an agent can trigger. Registers one press tool named from its own label.\",\n whenToUse:\n 'Use for any discrete action: submitting, confirming, dismissing, advancing a step. tone=\"action\" with block marks the one primary action in a view; tone=\"danger\" marks destructive actions.',\n whenNotToUse:\n \"Do not use for navigation between pages; use a link. Do not use for toggling a persistent on/off state; that needs a switch or a checkbox.\",\n status: \"experimental\",\n props: {\n children: {\n kind: \"node\",\n description:\n 'The button label. Its text also derives the WebMCP tool name, so prefer a verb phrase like \"Prepare launch\" over \"OK\".',\n required: true,\n },\n tone: {\n kind: \"enum\",\n description:\n \"Visual and semantic weight. Acid is rationed to one primary action per view.\",\n values: [\"neutral\", \"action\", \"danger\"],\n default: \"neutral\",\n },\n block: {\n kind: \"boolean\",\n description:\n 'Render as a full-width bar. Combine with tone=\"action\" for the primary action of a region.',\n default: false,\n },\n loading: {\n kind: \"boolean\",\n description:\n \"Mark work in progress. Sets aria-busy, disables the control, and unregisters the press tool until it clears.\",\n default: false,\n },\n disabled: {\n kind: \"boolean\",\n description: \"Disable the control and unregister its press tool.\",\n default: false,\n },\n agentName: {\n kind: \"string\",\n description:\n \"Override the label used to derive the tool name. Set this on icon-only buttons, when two buttons would otherwise collide, and whenever the visible label contains changing values such as a count.\",\n },\n agentTool: {\n kind: \"boolean\",\n description:\n \"Set false to render the button without registering any WebMCP tool.\",\n default: true,\n },\n onClick: {\n kind: \"handler\",\n description:\n \"Standard click handler. The press tool dispatches a real click, so this runs for agent presses too.\",\n },\n },\n state: {\n tone: {\n description: \"The button's current tone.\",\n attribute: \"data-sprint-tone\",\n values: [\"neutral\", \"action\", \"danger\"],\n },\n block: {\n description: \"Present when the button renders as a full-width bar.\",\n attribute: \"data-sprint-block\",\n },\n loading: {\n description: \"Present while the button is busy.\",\n attribute: \"data-sprint-loading\",\n },\n disabled: {\n description: \"Present when the button cannot be pressed.\",\n attribute: \"data-sprint-disabled\",\n },\n },\n tools: {\n press: PRESS_TOOL,\n },\n agentView: {\n example:\n '- **Button** \"Prepare launch\" [tone=action] → tool `press-prepare-launch`',\n },\n examples: [\n {\n title: \"Primary action\",\n description: \"The one rationed acid action bar for a view.\",\n code: '<Button tone=\"action\" block onClick={prepare}>Prepare launch</Button>',\n },\n {\n title: \"Destructive action\",\n code: '<Button tone=\"danger\" onClick={purge}>Purge vault</Button>',\n },\n {\n title: \"Busy state\",\n description:\n \"While loading the press tool is unregistered, so an agent cannot double-submit.\",\n code: \"<Button loading={saving} onClick={save}>Save loadout</Button>\",\n },\n {\n title: \"Disambiguating two identical labels\",\n description:\n \"Without agentName both buttons would claim press-save and neither would register a tool.\",\n code: '<Button agentName=\"Save billing\">Save</Button>',\n },\n {\n title: \"Keeping the tool name stable under a changing label\",\n description:\n \"A label carrying a value would otherwise rename the tool on every change, churning registration and staling any name an agent already holds.\",\n code: '<Button agentName=\"Increment\">Increment ({count})</Button>',\n },\n ],\n a11y: {\n role: \"button\",\n keyboard: [\"Enter activates\", \"Space activates\"],\n notes:\n \"Loading sets aria-busy and disables the control. Focus is an offset keyline, never a rounded ring.\",\n },\n});\n","import {\n type ComponentPropsWithRef,\n type MouseEvent as ReactMouseEvent,\n useCallback,\n useEffect,\n useLayoutEffect,\n useRef,\n useState,\n} from \"react\";\nimport { AgentControl, AgentLine } from \"@/agent/view/AgentText.tsx\";\nimport { useAgentControls, useAgentFormat, useSprintView } from \"@/agent/view/mode.ts\";\nimport { agentAttributesFor, buildAgentNode } from \"@/agent/view/project.ts\";\nimport { accessibleText } from \"@/agent/view/text.ts\";\nimport { afterCommit } from \"@/agent/webmcp/afterCommit.ts\";\nimport { commitSync } from \"@/agent/webmcp/flush.ts\";\nimport { useAgentTool } from \"@/agent/webmcp/useAgentTool.ts\";\nimport { buttonMeta } from \"./meta.ts\";\nimport { PRESS_TOOL } from \"./tool.ts\";\nimport \"./Button.css\";\n\nexport type ButtonTone = \"neutral\" | \"action\" | \"danger\";\n\nexport interface ButtonProps extends ComponentPropsWithRef<\"button\"> {\n tone?: ButtonTone;\n block?: boolean;\n loading?: boolean;\n agentName?: string;\n agentTool?: boolean;\n}\n\nfunction syntheticClick(): ReactMouseEvent<HTMLButtonElement> {\n const event = new MouseEvent(\"click\", { bubbles: true, cancelable: true });\n return event as unknown as ReactMouseEvent<HTMLButtonElement>;\n}\n\nexport function Button(props: ButtonProps) {\n const {\n tone = \"neutral\",\n block = false,\n loading = false,\n agentName,\n agentTool = true,\n disabled = false,\n type = \"button\",\n children,\n ref,\n onClick,\n ...rest\n } = props;\n\n const view = useSprintView();\n const controls = useAgentControls();\n const formatter = useAgentFormat();\n const element = useRef<HTMLButtonElement | null>(null);\n\n const setRef = useCallback(\n (target: HTMLButtonElement | null) => {\n element.current = target;\n if (typeof ref === \"function\") ref(target);\n else if (ref !== null && ref !== undefined) ref.current = target;\n },\n [ref],\n );\n\n const explicitLabel =\n agentName ?? (typeof children === \"string\" ? children : undefined);\n const [domLabel, setDomLabel] = useState<string | undefined>(undefined);\n\n useLayoutEffect(() => {\n if (explicitLabel !== undefined) return;\n const target = element.current;\n if (target === null) return;\n setDomLabel(accessibleText(target));\n });\n\n const inert = disabled || loading;\n const label = explicitLabel ?? domLabel;\n\n const onClickRef = useRef(onClick);\n onClickRef.current = onClick;\n\n const nodeRef = useRef(buildAgentNode({ component: buttonMeta.name }));\n const formatRef = useRef(formatter);\n formatRef.current = formatter;\n const mounted = useRef(true);\n\n useEffect(() => {\n mounted.current = true;\n return () => {\n mounted.current = false;\n };\n }, []);\n\n const execute = useCallback(async () => {\n const target = element.current;\n\n if (target !== null) {\n target.click();\n } else {\n const handler = onClickRef.current;\n if (handler === undefined) {\n return \"This button renders no control in the current view and has no click handler.\";\n }\n commitSync(() => handler(syntheticClick()));\n }\n\n await afterCommit();\n if (!mounted.current) return \"The press removed this button from the page.\";\n return `Pressed. The button is now:\\n${formatRef.current([nodeRef.current])}`;\n }, []);\n\n const toolName = useAgentTool({\n spec: PRESS_TOOL,\n label,\n enabled: agentTool && !inert,\n execute,\n });\n\n const node = buildAgentNode({\n component: buttonMeta.name,\n label,\n tool: toolName,\n state: { tone, block, loading, disabled: inert },\n });\n nodeRef.current = node;\n\n if (view === \"agent\") {\n if (inert || controls === \"never\") return <AgentLine node={node} />;\n return (\n <AgentControl\n node={node}\n type={type}\n ref={setRef}\n onClick={onClick}\n aria-busy={loading || undefined}\n />\n );\n }\n\n return (\n <button\n {...rest}\n {...agentAttributesFor(node)}\n type={type}\n ref={setRef}\n onClick={onClick}\n disabled={inert}\n aria-busy={loading || undefined}\n >\n {children}\n </button>\n );\n}\n","import type { AgentToolSpec } from \"@/agent/types.ts\";\n\nexport const OPEN_CARD_TOOL: AgentToolSpec = {\n verb: \"open\",\n description:\n \"Open this card, exactly as a person clicking it would. What opening does is the card's own business: it may reveal detail in place, select this item, or start a flow. Returns the card's state after the click.\",\n inputSchema: { type: \"object\", properties: {} },\n readOnly: false,\n untrustedContent: true,\n registeredWhen:\n \"The card acts rather than navigates, is mounted, enabled, has a resolvable label, and no other component claims the same tool name.\",\n unregisteredWhen:\n \"The card unmounts, becomes disabled, or turns into a link by taking an href.\",\n};\n","import { defineAgentMeta } from \"@/agent/registry.ts\";\nimport { OPEN_CARD_TOOL } from \"./tool.ts\";\n\nexport const cardMeta = defineAgentMeta({\n name: \"Card\",\n category: \"navigation\",\n summary:\n \"One entry in a catalogue: a title, a line or two of body, and the whole block clickable. Give it an href and it is a link; give it onClick and it is an action that registers an open tool.\",\n whenToUse:\n \"Use it in a grid of comparable things a person picks between: components in a catalogue, results in a list, templates to start from. The title is the accessible name, so it is also what an agent selects on.\",\n whenNotToUse:\n \"Do not use it for a static region with a header; that is Panel. Do not put separate controls inside one, because the whole card is already a single control and nesting buttons inside a link is invalid.\",\n status: \"experimental\",\n props: {\n label: {\n kind: \"string\",\n description:\n \"The card's title, and its accessible name. Also derives the tool name when the card acts.\",\n required: true,\n },\n children: {\n kind: \"node\",\n description:\n \"A line or two describing the entry. Carried in the agent view as the body part.\",\n },\n href: {\n kind: \"string\",\n description:\n \"Destination, which makes the card a link. A card that navigates registers no tool by default.\",\n },\n onClick: {\n kind: \"handler\",\n description:\n \"What clicking does. Alone it makes the card a button that registers an open tool by default. Alongside href the card stays a link and the handler rides the click, so a client-side router can intercept the navigation.\",\n },\n disabled: {\n kind: \"boolean\",\n description:\n \"Disable an acting card and unregister its tool. Has no effect on a card that navigates.\",\n default: false,\n },\n agentTool: {\n kind: \"boolean\",\n description:\n \"Override the default: on for a card that acts, off for a card that navigates, because an agent can reach an href on its own.\",\n },\n agentName: {\n kind: \"string\",\n description:\n \"Override the label used to derive the tool name, when two cards share a title.\",\n },\n },\n state: {\n href: {\n description: \"Where the card goes, when it navigates.\",\n attribute: \"data-sprint-href\",\n },\n disabled: {\n description: \"Present when the card cannot be opened.\",\n attribute: \"data-sprint-disabled\",\n },\n },\n tools: {\n open: OPEN_CARD_TOOL,\n },\n agentView: {\n example:\n '- **Card** \"Button\" [href=#/Button]\\n - part `title` \"Button\"\\n - part `body` \"A single action a person or an agent can trigger.\"',\n },\n examples: [\n {\n title: \"A catalogue entry\",\n description:\n \"A card that navigates. No tool, because the href is already public.\",\n code: '<Card label=\"Button\" href=\"#/Button\">\\n A single action a person or an agent can trigger.\\n</Card>',\n },\n {\n title: \"A card that acts\",\n description:\n \"onClick instead of href, so the card registers open-start-from-blank and an agent can take it.\",\n code: '<Card label=\"Start from blank\" onClick={create}>\\n An empty page with the provider already wired up.\\n</Card>',\n },\n ],\n a11y: {\n notes:\n \"The whole block is one control: a link when it has an href, a button when it acts. The title names it, and the body is read as its content rather than as part of the name.\",\n },\n});\n","import {\n type ComponentPropsWithRef,\n type MouseEventHandler,\n type ReactNode,\n type Ref,\n useCallback,\n useEffect,\n useRef,\n} from \"react\";\nimport { AgentControl, AgentLine } from \"@/agent/view/AgentText.tsx\";\nimport { useAgentControls, useAgentFormat, useSprintView } from \"@/agent/view/mode.ts\";\nimport type { AgentPart } from \"@/agent/view/node.ts\";\nimport {\n agentAttributesFor,\n agentPartAttributesFor,\n buildAgentNode,\n} from \"@/agent/view/project.ts\";\nimport { reactText } from \"@/agent/view/text.ts\";\nimport { afterCommit } from \"@/agent/webmcp/afterCommit.ts\";\nimport { useAgentTool } from \"@/agent/webmcp/useAgentTool.ts\";\nimport { cardMeta } from \"./meta.ts\";\nimport { OPEN_CARD_TOOL } from \"./tool.ts\";\nimport \"./Card.css\";\n\nexport interface CardProps\n extends Omit<ComponentPropsWithRef<\"button\">, \"ref\" | \"onClick\" | \"children\"> {\n label: string;\n children?: ReactNode;\n href?: string;\n onClick?: MouseEventHandler<HTMLElement>;\n disabled?: boolean;\n agentTool?: boolean;\n agentName?: string;\n ref?: Ref<HTMLButtonElement> | Ref<HTMLAnchorElement>;\n}\n\nexport function Card(props: CardProps) {\n const {\n label,\n children,\n href,\n onClick,\n disabled = false,\n agentTool,\n agentName,\n ref,\n ...rest\n } = props;\n\n const view = useSprintView();\n const controls = useAgentControls();\n const formatter = useAgentFormat();\n const navigates = href !== undefined;\n const inert = !navigates && disabled;\n const element = useRef<HTMLElement | null>(null);\n\n const setRef = useCallback(\n (target: HTMLElement | null) => {\n element.current = target;\n if (typeof ref === \"function\") {\n (ref as (value: HTMLElement | null) => void)(target);\n } else if (ref !== null && ref !== undefined) {\n (ref as { current: HTMLElement | null }).current = target;\n }\n },\n [ref],\n );\n\n const formatRef = useRef(formatter);\n formatRef.current = formatter;\n const nodeRef = useRef(buildAgentNode({ component: cardMeta.name }));\n const mounted = useRef(true);\n\n useEffect(() => {\n mounted.current = true;\n return () => {\n mounted.current = false;\n };\n }, []);\n\n const execute = useCallback(async () => {\n const target = element.current;\n if (target === null) return \"This card renders no control in the current view.\";\n\n target.click();\n await afterCommit();\n if (!mounted.current) return \"Opening removed this card from the page.\";\n return `Opened. The card is now:\\n${formatRef.current([nodeRef.current])}`;\n }, []);\n\n const toolName = useAgentTool({\n spec: OPEN_CARD_TOOL,\n label: agentName ?? label,\n enabled: (agentTool ?? !navigates) && !inert,\n execute,\n });\n\n const body = reactText(children);\n const parts: AgentPart[] = [\n { part: \"title\", label, state: {} },\n ...(body === undefined ? [] : [{ part: \"body\", label: body, state: {} }]),\n ];\n\n const node = buildAgentNode({\n component: cardMeta.name,\n label,\n tool: toolName,\n state: { href, disabled: inert },\n parts,\n });\n nodeRef.current = node;\n\n if (view === \"agent\") {\n if (inert || controls === \"never\") return <AgentLine node={node} />;\n return (\n <AgentControl\n node={node}\n as={navigates ? \"a\" : \"button\"}\n href={href}\n ref={setRef}\n onClick={onClick}\n />\n );\n }\n\n const inner = (\n <>\n <span {...agentPartAttributesFor({ part: \"title\", state: {} })}>{label}</span>\n {children === undefined ? null : (\n <span {...agentPartAttributesFor({ part: \"body\", state: {} })}>{children}</span>\n )}\n </>\n );\n\n if (navigates) {\n return (\n <a\n {...(rest as unknown as ComponentPropsWithRef<\"a\">)}\n {...agentAttributesFor(node)}\n href={href}\n aria-label={label}\n onClick={onClick}\n ref={setRef as Ref<HTMLAnchorElement>}\n >\n {inner}\n </a>\n );\n }\n\n return (\n <button\n {...rest}\n {...agentAttributesFor(node)}\n type=\"button\"\n aria-label={label}\n disabled={disabled}\n onClick={onClick}\n ref={setRef as Ref<HTMLButtonElement>}\n >\n {inner}\n </button>\n );\n}\n","import type { AgentToolSpec } from \"@/agent/types.ts\";\n\nexport const SET_CHECKBOX_TOOL: AgentToolSpec = {\n verb: \"set\",\n description:\n \"Check or uncheck this box by stating the end state, exactly as a person clicking it would. Setting the state it already has succeeds and changes nothing, so the call is safe to retry. Returns the box's state after the call, so a follow-up read is unnecessary.\",\n inputSchema: {\n type: \"object\",\n properties: {\n checked: {\n type: \"boolean\",\n description:\n \"The end state: true leaves the box checked, false leaves it unchecked.\",\n },\n },\n required: [\"checked\"],\n },\n readOnly: false,\n untrustedContent: true,\n registeredWhen:\n \"The box is mounted, enabled, has a resolvable label, and no other component claims the same tool name.\",\n unregisteredWhen: \"The box unmounts or becomes disabled.\",\n};\n","import { defineAgentMeta } from \"@/agent/registry.ts\";\nimport { SET_CHECKBOX_TOOL } from \"./tool.ts\";\n\nexport const checkboxMeta = defineAgentMeta({\n name: \"Checkbox\",\n category: \"input\",\n summary:\n \"A single on/off choice recorded as form data. It registers one set tool that takes the end state rather than toggling.\",\n whenToUse:\n \"Use it for a boolean a form will submit: accepting terms, opting in, including something in a request. The set tool takes checked as true or false, so an agent states the end state and never has to read before writing.\",\n whenNotToUse:\n \"Do not use it for a setting that takes effect the moment it changes; that is a Switch. Do not use it for choosing one of several options, which is a SegmentedControl or a Select.\",\n status: \"experimental\",\n props: {\n label: {\n kind: \"string\",\n description:\n 'What checking it means. Names the box for a screen reader and derives the tool name, so prefer a statement such as \"Accept the terms\".',\n required: true,\n },\n checked: {\n kind: \"boolean\",\n description: \"Whether the box is checked. The box is fully controlled.\",\n required: true,\n },\n onChange: {\n kind: \"handler\",\n description:\n \"Called with the new checked state. The set tool drives a real click, so this runs for agent changes too.\",\n required: true,\n },\n hint: {\n kind: \"string\",\n description:\n \"Guidance shown under the box and carried into the agent view. Replaced by error while one is set.\",\n },\n error: {\n kind: \"string\",\n description:\n \"A validation message. Marks the box invalid for people, screen readers, and agents alike.\",\n },\n name: {\n kind: \"string\",\n description: \"The native form name submitted with the surrounding form.\",\n },\n disabled: {\n kind: \"boolean\",\n description: \"Disable the box and unregister its set tool.\",\n default: false,\n },\n required: {\n kind: \"boolean\",\n description: \"Mark the box as one that must be checked.\",\n default: false,\n },\n agentName: {\n kind: \"string\",\n description:\n \"Override the label used to derive the tool name, when two boxes on a page would otherwise collide.\",\n },\n agentTool: {\n kind: \"boolean\",\n description: \"Set false to render the box without registering a set tool.\",\n default: true,\n },\n },\n state: {\n checked: {\n description: \"Present while the box is checked.\",\n attribute: \"data-sprint-checked\",\n },\n disabled: {\n description: \"Present when the box cannot be changed.\",\n attribute: \"data-sprint-disabled\",\n },\n required: {\n description: \"Present when the box must be checked.\",\n attribute: \"data-sprint-required\",\n },\n invalid: {\n description: \"Present while an error is set.\",\n attribute: \"data-sprint-invalid\",\n },\n },\n tools: {\n set: SET_CHECKBOX_TOOL,\n },\n agentView: {\n example:\n '- **Checkbox** \"Accept the terms\" [required] → tool `set-accept-the-terms`\\n - part `error` \"Required before launch\"',\n },\n examples: [\n {\n title: \"A consent box\",\n description:\n \"In agent view the box renders as one control; pressing it toggles, while the set tool states the end state.\",\n code: '<Checkbox\\n label=\"Accept the terms\"\\n checked={accepted}\\n onChange={setAccepted}\\n required\\n/>',\n },\n {\n title: \"An error on a required box\",\n description: \"The error marks the box invalid on every surface until it clears.\",\n code: '<Checkbox\\n label=\"Confirm the manifest\"\\n checked={confirmed}\\n onChange={setConfirmed}\\n required\\n error=\"Confirm before launch.\"\\n/>',\n },\n {\n title: \"A disabled box\",\n description:\n \"Disabled unregisters the tool, so an agent cannot change what a person could not.\",\n code: '<Checkbox\\n label=\"Telemetry\"\\n checked\\n disabled\\n onChange={setTelemetry}\\n/>',\n },\n ],\n a11y: {\n role: \"checkbox\",\n keyboard: [\"Space toggles\", \"Tab moves through the box\"],\n notes:\n \"A native checkbox input wrapped by its label, visually replaced by a keylined square. Focus draws an offset keyline around the square; errors set aria-invalid and link with aria-describedby.\",\n },\n});\n","import {\n type ComponentPropsWithRef,\n useCallback,\n useEffect,\n useId,\n useRef,\n} from \"react\";\nimport { AgentControl, AgentLine } from \"@/agent/view/AgentText.tsx\";\nimport { useAgentControls, useAgentFormat, useSprintView } from \"@/agent/view/mode.ts\";\nimport type { AgentPart } from \"@/agent/view/node.ts\";\nimport {\n agentAttributesFor,\n agentPartAttributesFor,\n buildAgentNode,\n} from \"@/agent/view/project.ts\";\nimport { afterCommit } from \"@/agent/webmcp/afterCommit.ts\";\nimport { commitSync } from \"@/agent/webmcp/flush.ts\";\nimport { useAgentTool } from \"@/agent/webmcp/useAgentTool.ts\";\nimport { checkboxMeta } from \"./meta.ts\";\nimport { SET_CHECKBOX_TOOL } from \"./tool.ts\";\nimport \"./Checkbox.css\";\n\nexport interface CheckboxProps extends Omit<ComponentPropsWithRef<\"div\">, \"onChange\"> {\n label: string;\n checked: boolean;\n onChange: (checked: boolean) => void;\n hint?: string;\n error?: string;\n name?: string;\n disabled?: boolean;\n required?: boolean;\n agentName?: string;\n agentTool?: boolean;\n}\n\nfunction messagePart(error: string | undefined, hint: string | undefined): AgentPart[] {\n if (error !== undefined) return [{ part: \"error\", label: error, state: {} }];\n if (hint !== undefined) return [{ part: \"hint\", label: hint, state: {} }];\n return [];\n}\n\nexport function Checkbox(props: CheckboxProps) {\n const {\n label,\n checked,\n onChange,\n hint,\n error,\n name,\n disabled = false,\n required = false,\n agentName,\n agentTool = true,\n ...rest\n } = props;\n\n const view = useSprintView();\n const controls = useAgentControls();\n const formatter = useAgentFormat();\n const id = useId();\n\n const element = useRef<HTMLElement | null>(null);\n const onChangeRef = useRef(onChange);\n onChangeRef.current = onChange;\n const checkedRef = useRef(checked);\n checkedRef.current = checked;\n const formatRef = useRef(formatter);\n formatRef.current = formatter;\n const nodeRef = useRef(buildAgentNode({ component: checkboxMeta.name }));\n const mounted = useRef(true);\n\n useEffect(() => {\n mounted.current = true;\n return () => {\n mounted.current = false;\n };\n }, []);\n\n const execute = useCallback(async (inputs: Record<string, unknown>) => {\n const desired = inputs.checked;\n if (typeof desired !== \"boolean\") {\n return 'Pass \"checked\" as true or false; it states the end state.';\n }\n\n const already = desired === checkedRef.current;\n if (!already) {\n const target = element.current;\n if (target !== null) target.click();\n else commitSync(() => onChangeRef.current(desired));\n }\n\n await afterCommit();\n if (!mounted.current) return \"The change removed this checkbox from the page.\";\n const outcome = already\n ? `Already ${desired ? \"checked\" : \"unchecked\"}`\n : desired\n ? \"Checked\"\n : \"Unchecked\";\n return `${outcome}. The checkbox is now:\\n${formatRef.current([nodeRef.current])}`;\n }, []);\n\n const toolName = useAgentTool({\n spec: SET_CHECKBOX_TOOL,\n label: agentName ?? label,\n enabled: agentTool && !disabled,\n execute,\n });\n\n const node = buildAgentNode({\n component: checkboxMeta.name,\n label,\n tool: toolName,\n state: {\n checked,\n disabled,\n required,\n invalid: error !== undefined,\n },\n parts: messagePart(error, hint),\n });\n nodeRef.current = node;\n\n if (view === \"agent\") {\n if (disabled || controls === \"never\") return <AgentLine node={node} />;\n return (\n <AgentControl\n node={node}\n ref={(target: HTMLButtonElement | null) => {\n element.current = target;\n }}\n onClick={() => onChange(!checked)}\n />\n );\n }\n\n const messageId =\n error !== undefined ? `${id}-error` : hint !== undefined ? `${id}-hint` : undefined;\n\n return (\n <div {...rest} {...agentAttributesFor(node)}>\n <label htmlFor={id}>\n <input\n id={id}\n {...agentPartAttributesFor({ part: \"input\", state: {} })}\n ref={(target) => {\n element.current = target;\n }}\n type=\"checkbox\"\n checked={checked}\n name={name}\n disabled={disabled}\n required={required}\n aria-invalid={error !== undefined || undefined}\n aria-describedby={messageId}\n onChange={(event) => onChange(event.currentTarget.checked)}\n />\n <span\n {...agentPartAttributesFor({ part: \"box\", state: {} })}\n aria-hidden=\"true\"\n />\n {label}\n </label>\n {error !== undefined ? (\n <p id={messageId} {...agentPartAttributesFor({ part: \"error\", state: {} })}>\n {error}\n </p>\n ) : hint !== undefined ? (\n <p id={messageId} {...agentPartAttributesFor({ part: \"hint\", state: {} })}>\n {hint}\n </p>\n ) : null}\n </div>\n );\n}\n","export type TokenKind =\n | \"plain\"\n | \"tag\"\n | \"attr\"\n | \"string\"\n | \"keyword\"\n | \"number\"\n | \"punct\"\n | \"comment\";\n\nexport interface Token {\n kind: TokenKind;\n text: string;\n}\n\nconst PATTERN =\n /(\\/\\/[^\\n]*)|(\"[^\"]*\"|'[^']*'|`[^`]*`)|(<\\/?[A-Za-z][\\w.-]*)|([\\w-]+(?==))|(\\b(?:const|let|var|function|return|import|export|from|await|async|new|true|false|null|undefined)\\b)|(\\b\\d+(?:\\.\\d+)?\\b)|([<>/{}()[\\];=,.]+)/g;\n\nconst KINDS: readonly TokenKind[] = [\n \"comment\",\n \"string\",\n \"tag\",\n \"attr\",\n \"keyword\",\n \"number\",\n \"punct\",\n];\n\nexport function tokenize(code: string): Token[] {\n const tokens: Token[] = [];\n let cursor = 0;\n\n for (const match of code.matchAll(PATTERN)) {\n const index = match.index;\n if (index === undefined) continue;\n\n if (index > cursor) {\n tokens.push({ kind: \"plain\", text: code.slice(cursor, index) });\n }\n\n const kind = KINDS.find((_, slot) => match[slot + 1] !== undefined) ?? \"plain\";\n tokens.push({ kind, text: match[0] });\n cursor = index + match[0].length;\n }\n\n if (cursor < code.length) {\n tokens.push({ kind: \"plain\", text: code.slice(cursor) });\n }\n\n return tokens;\n}\n","import { defineAgentMeta } from \"@/agent/registry.ts\";\n\nexport const codeBlockMeta = defineAgentMeta({\n name: \"CodeBlock\",\n category: \"display\",\n summary:\n \"A snippet of code with a caption band and a copy control. In agent view the snippet is carried verbatim as the code part, so an agent reads the source instead of the highlighting.\",\n whenToUse:\n \"Use it for any code a reader is meant to run or copy: an install snippet, an example, a generated tool descriptor. It scrolls horizontally rather than wrapping, so a long line stays a long line.\",\n whenNotToUse:\n \"Do not use it for a short inline identifier inside a sentence; use a code element inside Text. Do not use it for prose you want to look technical.\",\n status: \"experimental\",\n props: {\n code: {\n kind: \"string\",\n description:\n \"The snippet, verbatim. Newlines are preserved and this exact string is what an agent reads and what the copy control copies.\",\n required: true,\n },\n caption: {\n kind: \"string\",\n description:\n \"What the snippet is, shown in the band above it and used as the block's accessible name. Defaults to the language.\",\n },\n language: {\n kind: \"enum\",\n description: \"What the snippet is written in. Drives the caption default.\",\n values: [\"tsx\", \"json\", \"bash\", \"text\"],\n default: \"tsx\",\n },\n copyLabel: {\n kind: \"string\",\n description: \"Label for the copy control.\",\n default: \"Copy\",\n },\n },\n state: {\n language: {\n description: \"The language the snippet is in.\",\n attribute: \"data-sprint-language\",\n values: [\"tsx\", \"json\", \"bash\", \"text\"],\n },\n lines: {\n description: \"How many lines the snippet has.\",\n attribute: \"data-sprint-lines\",\n },\n copied: {\n description:\n \"Present for a moment after the copy control has put the snippet on the clipboard.\",\n attribute: \"data-sprint-copied\",\n },\n token: {\n description:\n \"On a highlight span: which token class it is. Colour comes from this, so a theme can recolour code without touching the component.\",\n attribute: \"data-sprint-token\",\n values: [\"tag\", \"attr\", \"string\", \"keyword\", \"number\", \"punct\", \"comment\"],\n },\n },\n agentView: {\n example:\n '- **CodeBlock** \"install\" [language=bash, lines=1]\\n - part `copy` \"Copy\"\\n - part `code` \"npm install sprint\"',\n },\n examples: [\n {\n title: \"An example snippet\",\n description:\n \"No caption, so the language names the block. It registers no WebMCP tool: an agent has nothing to gain from putting text on a person's clipboard, and it can already read the code.\",\n code: \"<CodeBlock code={'<Button tone=\\\"action\\\">Prepare launch</Button>'} />\",\n },\n {\n title: \"A captioned descriptor\",\n code: '<CodeBlock\\n caption=\"descriptor\"\\n language=\"json\"\\n code={JSON.stringify(descriptor, null, 2)}\\n/>',\n },\n ],\n a11y: {\n notes:\n \"The frame is a figure named by its caption. The copy control is a real button and reports back in its own label once the snippet is on the clipboard; the label swap is a polite live region, so a screen reader hears the confirmation too.\",\n },\n});\n","import { type ComponentPropsWithRef, useEffect, useState } from \"react\";\nimport { AgentLine } from \"@/agent/view/AgentText.tsx\";\nimport { useSprintView } from \"@/agent/view/mode.ts\";\nimport {\n agentAttributesFor,\n agentPartAttributesFor,\n buildAgentNode,\n} from \"@/agent/view/project.ts\";\nimport { tokenize } from \"./highlight.ts\";\nimport { codeBlockMeta } from \"./meta.ts\";\nimport \"./CodeBlock.css\";\n\nconst COPIED_FOR = 1200;\n\nexport type CodeLanguage = \"tsx\" | \"json\" | \"bash\" | \"text\";\n\nexport interface CodeBlockProps extends ComponentPropsWithRef<\"figure\"> {\n code: string;\n caption?: string;\n language?: CodeLanguage;\n copyLabel?: string;\n}\n\nexport function CodeBlock(props: CodeBlockProps) {\n const { code, caption, language = \"tsx\", copyLabel = \"Copy\", ...rest } = props;\n\n const view = useSprintView();\n const [copied, setCopied] = useState(false);\n\n useEffect(() => {\n if (!copied) return;\n const timer = setTimeout(() => setCopied(false), COPIED_FOR);\n return () => clearTimeout(timer);\n }, [copied]);\n\n const label = caption ?? language;\n const control = copied ? \"Copied\" : copyLabel;\n\n const node = buildAgentNode({\n component: codeBlockMeta.name,\n label,\n state: {\n language,\n lines: String(code.split(\"\\n\").length),\n copied,\n },\n parts: [\n { part: \"copy\", label: control, state: {} },\n { part: \"code\", label: code, state: {} },\n ],\n });\n\n if (view === \"agent\") return <AgentLine node={node} />;\n\n const copy = () => {\n const clipboard = navigator.clipboard;\n if (clipboard === undefined) return;\n clipboard.writeText(code).then(\n () => setCopied(true),\n () => setCopied(false),\n );\n };\n\n return (\n <figure {...rest} {...agentAttributesFor(node)} aria-label={label}>\n <header>\n <span>{label}</span>\n <button\n type=\"button\"\n aria-live=\"polite\"\n {...agentPartAttributesFor({ part: \"copy\", state: {} })}\n onClick={copy}\n >\n {control}\n </button>\n </header>\n <pre {...agentPartAttributesFor({ part: \"code\", state: {} })}>\n <code>\n {tokenize(code).map((token, index) => (\n <span\n key={`${index}-${token.text}`}\n data-sprint-token={token.kind === \"plain\" ? undefined : token.kind}\n >\n {token.text}\n </span>\n ))}\n </code>\n </pre>\n </figure>\n );\n}\n","import { defineAgentMeta } from \"@/agent/registry.ts\";\n\nexport const descriptionListMeta = defineAgentMeta({\n name: \"DescriptionList\",\n category: \"display\",\n summary:\n \"Labelled term–description pairs for the details of one thing: metadata, settings, profile fields.\",\n whenToUse:\n \"Use for the properties of a single entity: a token's created date and scopes, a session's device and last activity, a profile's fields. Each item pairs one term with one description.\",\n whenNotToUse:\n \"Do not use for many entities with the same fields; that is a Table. Do not put components inside term or description; both are flattened to text for the agent view, so only inline content survives. Do not use for prose sequences; that is a List.\",\n status: \"experimental\",\n props: {\n label: {\n kind: \"string\",\n description:\n \"The accessible name for the list, describing what entity it details.\",\n required: true,\n },\n items: {\n kind: \"array\",\n description:\n \"The pairs, in order. Each item is { term, description }; both are inline content flattened to text for the agent view.\",\n required: true,\n },\n emptyLabel: {\n kind: \"string\",\n description: \"Text shown when items is empty. The region keeps its frame.\",\n default: \"Empty\",\n },\n },\n state: {\n items: {\n description: \"The number of pairs.\",\n attribute: \"data-sprint-items\",\n },\n empty: {\n description: \"Present when there are no pairs.\",\n attribute: \"data-sprint-empty\",\n },\n },\n agentView: {\n example: '- **DescriptionList** \"Key sk-prod\" [items=2]',\n },\n examples: [\n {\n title: \"Token metadata\",\n code: '<DescriptionList\\n label=\"Key sk-prod\"\\n items={[\\n { term: \"Created\", description: \"2026-08-01\" },\\n { term: \"Last used\", description: \"2 hours ago\" },\\n { term: \"Scopes\", description: \"read, write\" },\\n ]}\\n/>',\n },\n {\n title: \"An empty list\",\n description: \"The region keeps its frame and states its emptiness.\",\n code: '<DescriptionList label=\"Recovery codes\" items={[]} emptyLabel=\"None generated\" />',\n },\n ],\n a11y: {\n role: \"definition list\",\n notes:\n \"Renders a native dl with an aria-label. Terms are dt elements and descriptions dd, so structure survives without styling.\",\n },\n});\n","import type { ComponentPropsWithRef, ReactNode } from \"react\";\nimport { AgentLine } from \"@/agent/view/AgentText.tsx\";\nimport { useSprintView } from \"@/agent/view/mode.ts\";\nimport type { AgentPart } from \"@/agent/view/node.ts\";\nimport {\n agentAttributesFor,\n agentPartAttributesFor,\n buildAgentNode,\n} from \"@/agent/view/project.ts\";\nimport { reactText } from \"@/agent/view/text.ts\";\nimport { descriptionListMeta } from \"./meta.ts\";\nimport \"./DescriptionList.css\";\n\nexport interface DescriptionItem {\n term: ReactNode;\n description: ReactNode;\n}\n\nexport interface DescriptionListProps extends ComponentPropsWithRef<\"dl\"> {\n label: string;\n items: readonly DescriptionItem[];\n emptyLabel?: string;\n}\n\nfunction pairText(item: DescriptionItem): string | undefined {\n const term = reactText(item.term);\n const description = reactText(item.description);\n if (term === undefined && description === undefined) return undefined;\n return `${term ?? \"\"}: ${description ?? \"\"}`;\n}\n\nexport function DescriptionList(props: DescriptionListProps) {\n const { label, items, emptyLabel = \"Empty\", ...rest } = props;\n\n const view = useSprintView();\n const empty = items.length === 0;\n\n const parts: AgentPart[] = items.map((item, index) => {\n const text = pairText(item);\n return {\n part: \"item\",\n state: { index: String(index + 1) },\n ...(text === undefined ? {} : { label: text }),\n };\n });\n\n const node = buildAgentNode({\n component: descriptionListMeta.name,\n label,\n state: { items: String(items.length), empty },\n parts,\n });\n\n if (view === \"agent\") return <AgentLine node={node} />;\n\n return (\n <dl {...rest} {...agentAttributesFor(node)} aria-label={label}>\n {empty ? (\n <div>\n <span>{emptyLabel}</span>\n </div>\n ) : (\n items.map((item, index) => (\n <div\n key={`${index}-${String(reactText(item.term))}`}\n {...agentPartAttributesFor({\n part: \"item\",\n state: { index: String(index + 1) },\n })}\n >\n <dt>{item.term}</dt>\n <dd>{item.description}</dd>\n </div>\n ))\n )}\n </dl>\n );\n}\n","import type { AgentToolSpec } from \"@/agent/types.ts\";\n\nexport const CLOSE_DIALOG_TOOL: AgentToolSpec = {\n verb: \"close\",\n description:\n \"Close this dialog without taking its action, exactly as pressing its close control or Escape would. Anything entered inside the dialog may be discarded by the page. To take the dialog's action instead, use the tools its contents register while it is open.\",\n inputSchema: { type: \"object\", properties: {} },\n readOnly: false,\n untrustedContent: true,\n registeredWhen:\n \"The dialog is open. A closed dialog renders nothing and has no tools.\",\n unregisteredWhen: \"The dialog closes or unmounts.\",\n};\n","import { defineAgentMeta } from \"@/agent/registry.ts\";\nimport { CLOSE_DIALOG_TOOL } from \"./tool.ts\";\n\nexport const dialogMeta = defineAgentMeta({\n name: \"Dialog\",\n category: \"overlay\",\n summary:\n \"A modal that interrupts the page for one decision: confirm a destructive action, complete a short step, acknowledge something before continuing.\",\n whenToUse:\n \"Use when the page must not continue until the person decides: confirming a revocation or deletion, a short focused form, a required acknowledgement. Keep one decision per dialog and put its actions inside as ordinary Buttons; tools registered inside the dialog compose their names under its label.\",\n whenNotToUse:\n \"Do not use for status messages; that is an Alert. Do not use for anything the person should be able to ignore; a modal takes the whole page hostage. Do not nest dialogs.\",\n status: \"experimental\",\n props: {\n label: {\n kind: \"string\",\n description:\n \"The dialog's title. Names the dialog for assistive tech, derives the close tool name, and scopes the names of tools registered inside.\",\n required: true,\n },\n open: {\n kind: \"boolean\",\n description:\n \"Whether the dialog is shown. A closed dialog renders nothing at all; the page owns this state.\",\n required: true,\n },\n onClose: {\n kind: \"handler\",\n description:\n \"Called when the person or an agent asks to close: the close control, Escape, or the close tool. Set open to false in response.\",\n required: true,\n },\n children: {\n kind: \"node\",\n description:\n \"The dialog's contents. Ordinary components; anything actionable registers its own tools, scoped under the dialog's label.\",\n required: true,\n },\n headingLevel: {\n kind: \"enum\",\n description:\n \"Render the title as a real heading at this level, joining the page outline.\",\n values: [\"2\", \"3\", \"4\"],\n },\n owner: {\n kind: \"string\",\n description:\n \"The tool name of the control that opened this dialog. Published as data-sprint-owner so a reading agent can attach the dialog to its opener.\",\n },\n agentName: {\n kind: \"string\",\n description: \"Override the label used to derive the close tool name.\",\n },\n agentTool: {\n kind: \"boolean\",\n description: \"Set false to render without registering the close tool.\",\n default: true,\n },\n },\n state: {\n open: {\n description:\n \"Present while the dialog is shown. A closed dialog is absent from the DOM entirely.\",\n attribute: \"data-sprint-open\",\n },\n },\n tools: {\n close: CLOSE_DIALOG_TOOL,\n },\n agentView: {\n example:\n '- **Dialog** \"Revoke key\" [open] with part `close` → tool `close-revoke-key`',\n },\n examples: [\n {\n title: \"A destructive confirmation\",\n description:\n \"The confirm Button registers its tool only while the dialog is open, and its name is scoped under the dialog's label.\",\n code: '<Dialog label=\"Revoke key\" open={confirming} onClose={() => setConfirming(false)}>\\n <Stack gap=\"tight\">\\n <Text>The key stops authenticating immediately. This cannot be undone.</Text>\\n <Button tone=\"danger\" onClick={revoke}>Revoke sk-prod</Button>\\n </Stack>\\n</Dialog>',\n },\n {\n title: \"Owned by its opener\",\n description:\n \"Passing the opener's tool name lets a reading agent attach the dialog to the control that produced it.\",\n code: '<Dialog\\n label=\"Rotate secret\"\\n open={rotating}\\n owner=\"press-rotate-secret\"\\n onClose={() => setRotating(false)}\\n>\\n <Text>The current secret keeps working for one hour.</Text>\\n</Dialog>',\n },\n ],\n a11y: {\n role: \"dialog\",\n keyboard: [\"Escape closes\", \"Tab cycles within the dialog\"],\n notes:\n \"A native dialog element shown with showModal, so focus containment, inerting the page behind, and Escape come from the browser. The title names the dialog via aria-label.\",\n },\n});\n","import {\n type ComponentPropsWithRef,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n} from \"react\";\nimport { AgentControlGroup } from \"@/agent/view/AgentText.tsx\";\nimport { useAgentControls, useSprintView } from \"@/agent/view/mode.ts\";\nimport {\n agentAttributesFor,\n agentPartAttributesFor,\n buildAgentNode,\n} from \"@/agent/view/project.ts\";\nimport { afterCommit } from \"@/agent/webmcp/afterCommit.ts\";\nimport { commitSync } from \"@/agent/webmcp/flush.ts\";\nimport { AgentScopeProvider, useAgentScope } from \"@/agent/webmcp/scope.ts\";\nimport { useAgentTool } from \"@/agent/webmcp/useAgentTool.ts\";\nimport { dialogMeta } from \"./meta.ts\";\nimport { CLOSE_DIALOG_TOOL } from \"./tool.ts\";\nimport \"./Dialog.css\";\n\nexport type DialogHeadingLevel = 2 | 3 | 4;\n\nexport interface DialogProps\n extends Omit<ComponentPropsWithRef<\"dialog\">, \"onClose\" | \"open\"> {\n label: string;\n open: boolean;\n onClose: () => void;\n headingLevel?: DialogHeadingLevel;\n owner?: string;\n agentName?: string;\n agentTool?: boolean;\n}\n\nexport function Dialog(props: DialogProps) {\n const {\n label,\n open,\n onClose,\n headingLevel,\n owner,\n agentName,\n agentTool = true,\n children,\n ref,\n ...rest\n } = props;\n\n const view = useSprintView();\n const controls = useAgentControls();\n const parentScope = useAgentScope();\n\n const element = useRef<HTMLDialogElement | null>(null);\n const closeElement = useRef<HTMLButtonElement | null>(null);\n const onCloseRef = useRef(onClose);\n onCloseRef.current = onClose;\n const openRef = useRef(open);\n openRef.current = open;\n\n const setRef = useCallback(\n (target: HTMLDialogElement | null) => {\n element.current = target;\n if (typeof ref === \"function\") ref(target);\n else if (ref !== null && ref !== undefined) ref.current = target;\n },\n [ref],\n );\n\n useEffect(() => {\n if (!open) return;\n const target = element.current;\n if (target === null) return;\n if (!target.open) {\n if (typeof target.showModal === \"function\") target.showModal();\n else target.open = true;\n }\n return () => {\n if (!target.open) return;\n if (typeof target.close === \"function\") target.close();\n else target.open = false;\n };\n }, [open]);\n\n const execute = useCallback(async () => {\n const target = closeElement.current;\n if (target !== null) target.click();\n else commitSync(() => onCloseRef.current());\n\n await afterCommit();\n if (openRef.current) return \"The page kept the dialog open.\";\n return \"Closed. The dialog is gone from the page.\";\n }, []);\n\n const toolName = useAgentTool({\n spec: CLOSE_DIALOG_TOOL,\n label: agentName ?? label,\n enabled: agentTool && open,\n execute,\n });\n\n const scopeValue = useMemo(\n () => ({ path: [...parentScope, label] }),\n [parentScope, label],\n );\n\n if (!open) return null;\n\n const node = buildAgentNode({\n component: dialogMeta.name,\n label,\n owner,\n region: true,\n state: { open: true },\n parts: [\n {\n part: \"close\",\n label: \"Close\",\n state: {},\n ...(toolName === undefined ? {} : { tool: toolName }),\n },\n ],\n });\n\n if (view === \"agent\") {\n return (\n <AgentControlGroup\n node={node}\n isActionable={() => controls !== \"never\"}\n onActivate={() => onClose()}\n >\n <AgentScopeProvider value={scopeValue}>{children}</AgentScopeProvider>\n </AgentControlGroup>\n );\n }\n\n const Label = headingLevel === undefined ? \"span\" : (`h${headingLevel}` as const);\n\n return (\n <dialog\n {...rest}\n {...agentAttributesFor(node)}\n aria-label={label}\n ref={setRef}\n onCancel={(event) => {\n event.preventDefault();\n onClose();\n }}\n >\n <header>\n <Label>{label}</Label>\n <button\n {...agentPartAttributesFor({\n part: \"close\",\n state: {},\n ...(toolName === undefined ? {} : { tool: toolName }),\n })}\n type=\"button\"\n aria-label=\"Close\"\n ref={closeElement}\n onClick={() => onClose()}\n >\n ×\n </button>\n </header>\n <div>\n <AgentScopeProvider value={scopeValue}>{children}</AgentScopeProvider>\n </div>\n </dialog>\n );\n}\n","import { defineAgentMeta } from \"@/agent/registry.ts\";\n\nexport const headingMeta = defineAgentMeta({\n name: \"Heading\",\n category: \"typography\",\n summary:\n \"A section title, rendered as a real h element at the level you pick so it joins the document outline.\",\n whenToUse:\n \"Use it for the title of a page or of a region inside one, and keep levels in document order so the outline an agent or a screen reader builds is the outline you meant.\",\n whenNotToUse:\n \"Do not use it for the label on a bordered region; Panel takes a label prop, draws its own header, and joins the outline through its headingLevel prop. Do not pick a level for its size, only for its place in the outline.\",\n status: \"experimental\",\n props: {\n children: {\n kind: \"node\",\n description: \"The title. Keep it short; long titles truncate in chrome.\",\n required: true,\n },\n level: {\n kind: \"enum\",\n description:\n \"Outline depth, rendered as the matching h element. 1 is the page title and there should be one per page.\",\n values: [\"1\", \"2\", \"3\", \"4\"],\n default: \"2\",\n },\n },\n state: {\n level: {\n description: \"The outline depth, and so the type voice in use.\",\n attribute: \"data-sprint-level\",\n values: [\"1\", \"2\", \"3\", \"4\"],\n },\n },\n agentView: {\n example: '- **Heading** \"WebMCP tools\" [level=2]',\n },\n examples: [\n {\n title: \"A page title\",\n code: \"<Heading level={1}>Button</Heading>\",\n },\n {\n title: \"A section title\",\n description: \"The default level, for a region inside a page.\",\n code: \"<Heading>Every variant</Heading>\",\n },\n ],\n});\n","import type { ComponentPropsWithRef } from \"react\";\nimport { AgentLine } from \"@/agent/view/AgentText.tsx\";\nimport { useSprintView } from \"@/agent/view/mode.ts\";\nimport { agentAttributesFor, buildAgentNode } from \"@/agent/view/project.ts\";\nimport { reactText } from \"@/agent/view/text.ts\";\nimport { headingMeta } from \"./meta.ts\";\nimport \"./Heading.css\";\n\nexport type HeadingLevel = 1 | 2 | 3 | 4;\n\nexport interface HeadingProps extends ComponentPropsWithRef<\"h2\"> {\n level?: HeadingLevel;\n}\n\nexport function Heading(props: HeadingProps) {\n const { level = 2, children, ...rest } = props;\n\n const view = useSprintView();\n\n const node = buildAgentNode({\n component: headingMeta.name,\n label: reactText(children),\n state: { level: String(level) },\n });\n\n if (view === \"agent\") return <AgentLine node={node} />;\n\n const Element = `h${level}` as const;\n\n return (\n <Element {...rest} {...agentAttributesFor(node)}>\n {children}\n </Element>\n );\n}\n","import { defineAgentMeta } from \"@/agent/registry.ts\";\n\nexport const imageMeta = defineAgentMeta({\n name: \"Image\",\n category: \"display\",\n summary:\n \"A framed picture in a slot that holds its shape. It is the one component whose content an agent cannot read, so alt is not decoration: it is the whole of what the agent gets, and the source URL is published beside it for an agent that can fetch pixels of its own.\",\n whenToUse:\n 'Use it for any picture that carries meaning: a screenshot, a diagram, a photograph, a logo in running content. Describe it in alt as if to someone on the phone. Pass alt=\"\" only for a picture that adds nothing, which then disappears from the agent view entirely.',\n whenNotToUse:\n \"Do not use it for a decorative texture; that is the ornament vocabulary, which costs no request and no description. Do not use it for an icon whose meaning is already in adjacent text.\",\n status: \"experimental\",\n props: {\n src: {\n kind: \"string\",\n description:\n \"Where the pixels are. Published as data-sprint-src so an agent that can see can fetch the file itself.\",\n required: true,\n },\n alt: {\n kind: \"string\",\n description:\n 'What the picture shows, in a sentence. This is the entire agent rendering of the image, so write it for a reader who will never see it. Empty means \"this picture carries no meaning\", and the component then renders nothing in agent view.',\n required: true,\n },\n caption: {\n kind: \"string\",\n description:\n \"A visible line under the frame, for a credit, a date, or a figure number. It is read as well as seen, so it does not repeat alt.\",\n },\n ratio: {\n kind: \"enum\",\n description:\n \"The shape the slot holds while the picture loads and if it fails. auto lets the file decide its own height once it arrives.\",\n values: [\"1:1\", \"4:3\", \"3:2\", \"16:9\", \"auto\"],\n default: \"auto\",\n },\n fit: {\n kind: \"enum\",\n description:\n \"How the picture fills a slot of a fixed ratio. cover crops it, contain letterboxes it. Ignored when ratio is auto.\",\n values: [\"cover\", \"contain\"],\n default: \"cover\",\n },\n },\n state: {\n src: {\n description: \"The image source, so an agent can fetch the file without the DOM.\",\n attribute: \"data-sprint-src\",\n },\n status: {\n description:\n \"Whether the pixels have arrived. Present only in the human rendering, because in agent view nothing is fetched and any value would be a guess.\",\n attribute: \"data-sprint-status\",\n values: [\"loading\", \"ready\", \"error\"],\n },\n ratio: {\n description: \"The shape the slot holds.\",\n attribute: \"data-sprint-ratio\",\n values: [\"1:1\", \"4:3\", \"3:2\", \"16:9\", \"auto\"],\n },\n fit: {\n description: \"Whether a fixed-ratio slot crops the picture or letterboxes it.\",\n attribute: \"data-sprint-fit\",\n values: [\"cover\", \"contain\"],\n },\n decorative: {\n description:\n \"Present when the image was declared meaningless with an empty alt and no caption. It renders nothing at all in agent view.\",\n attribute: \"data-sprint-decorative\",\n },\n },\n agentView: {\n example:\n '- **Image** \"Launch pad 39B under floodlights, gantry retracted\" [fit=cover, ratio=16:9, src=media/pad-39b.svg]\\n - part `caption` \"Pad 39B, T-minus 4h\"',\n },\n examples: [\n {\n title: \"A described picture\",\n description:\n \"The alt text is the agent rendering. It registers no WebMCP tool: there is nothing to do to a picture, and the source URL is already on the element.\",\n code: '<Image\\n src=\"media/pad-39b.svg\"\\n alt=\"Launch pad 39B under floodlights, gantry retracted\"\\n ratio=\"16:9\"\\n/>',\n },\n {\n title: \"A captioned figure\",\n description:\n \"The caption is read as well as seen, and arrives as its own part, so it can say what alt should not repeat.\",\n code: '<Image\\n src=\"media/telemetry.svg\"\\n alt=\"Line chart of chamber pressure holding flat for nine minutes, then dropping\"\\n caption=\"Static fire 04, chamber pressure\"\\n ratio=\"3:2\"\\n fit=\"contain\"\\n/>',\n },\n {\n title: \"A picture that means nothing\",\n description:\n \"An empty alt is a claim, not an omission: it says this picture carries no meaning. The component then renders nothing in agent view, the way Stack does.\",\n code: '<Image src=\"media/grain.svg\" alt=\"\" ratio=\"1:1\" />',\n },\n ],\n a11y: {\n notes:\n \"The frame is a figure named by its alt text, and the picture inside carries the same alt natively, so a fallback still reads when the file fails. A caption is a figcaption. While the picture is loading or after it has failed, the slot keeps its border and states its condition rather than collapsing; that band is aria-hidden, because on failure it shows the alt text a screen reader has already been given.\",\n },\n relatedComponents: [\"Card\", \"Panel\"],\n});\n","import { type ComponentPropsWithRef, useState } from \"react\";\nimport { AgentLine } from \"@/agent/view/AgentText.tsx\";\nimport { useSprintView } from \"@/agent/view/mode.ts\";\nimport type { AgentPart } from \"@/agent/view/node.ts\";\nimport {\n agentAttributesFor,\n agentPartAttributesFor,\n buildAgentNode,\n} from \"@/agent/view/project.ts\";\nimport { imageMeta } from \"./meta.ts\";\nimport \"./Image.css\";\n\nexport type ImageRatio = \"1:1\" | \"4:3\" | \"3:2\" | \"16:9\" | \"auto\";\nexport type ImageFit = \"cover\" | \"contain\";\nexport type ImageStatus = \"loading\" | \"ready\" | \"error\";\n\nexport interface ImageProps extends Omit<ComponentPropsWithRef<\"figure\">, \"children\"> {\n src: string;\n alt: string;\n caption?: string;\n ratio?: ImageRatio;\n fit?: ImageFit;\n}\n\nexport function Image(props: ImageProps) {\n const { src, alt, caption, ratio = \"auto\", fit = \"cover\", ...rest } = props;\n\n const view = useSprintView();\n const [status, setStatus] = useState<ImageStatus>(\"loading\");\n\n const decorative = alt === \"\" && caption === undefined;\n\n const parts: AgentPart[] =\n caption === undefined ? [] : [{ part: \"caption\", label: caption, state: {} }];\n\n const node = buildAgentNode({\n component: imageMeta.name,\n label: alt === \"\" ? undefined : alt,\n state: {\n src,\n ratio,\n fit,\n decorative,\n status: view === \"agent\" ? undefined : status,\n },\n parts,\n });\n\n if (view === \"agent\") return decorative ? null : <AgentLine node={node} />;\n\n const band =\n status === \"error\" ? (alt === \"\" ? \"Image unavailable\" : alt) : \"Loading\";\n\n return (\n <figure\n {...rest}\n {...agentAttributesFor(node)}\n aria-label={alt === \"\" ? undefined : alt}\n >\n <div>\n <img\n src={src}\n alt={alt}\n onLoad={() => setStatus(\"ready\")}\n onError={() => setStatus(\"error\")}\n />\n {status === \"ready\" ? null : (\n <span aria-hidden=\"true\">\n <span>{band}</span>\n </span>\n )}\n </div>\n {caption === undefined ? null : (\n <figcaption {...agentPartAttributesFor({ part: \"caption\", state: {} })}>\n {caption}\n </figcaption>\n )}\n </figure>\n );\n}\n","import type { AgentToolSpec } from \"@/agent/types.ts\";\n\nexport const OPEN_LINK_TOOL: AgentToolSpec = {\n verb: \"open\",\n description:\n \"Follow this link and load its destination, exactly as a person clicking it would. The current page is replaced, so anything unsaved on it is lost and any tool registered by this page stops existing.\",\n inputSchema: { type: \"object\", properties: {} },\n readOnly: false,\n untrustedContent: true,\n registeredWhen:\n \"The link opts in with agentTool, is mounted, has a resolvable label, and no other component claims the same tool name. Links register nothing by default.\",\n unregisteredWhen: \"The link unmounts or opts back out.\",\n};\n","import { defineAgentMeta } from \"@/agent/registry.ts\";\nimport { OPEN_LINK_TOOL } from \"./tool.ts\";\n\nexport const linkMeta = defineAgentMeta({\n name: \"Link\",\n category: \"navigation\",\n summary:\n \"A navigation link. It publishes its destination as state, so an agent reading the page in text learns the URL rather than having to click to find out, and it renders a real anchor in both views.\",\n whenToUse:\n \"Use it for anything that changes the address: a nav item, a cross-reference, a link out to a specification. Set active on the item matching the current route so the agent view and the human view agree about where you are. Under a client-side router, pass an onClick that prevents default and navigates; the handler rides the anchor in both views, so agent clicks and open tools go through the router too.\",\n whenNotToUse:\n \"Do not use it for an action that stays on the page; that is a Button. Do not register a tool on ordinary navigation: an agent can already reach a URL, and a page of links would flood its tool list for no gain.\",\n status: \"experimental\",\n props: {\n href: {\n kind: \"string\",\n description:\n \"The destination. Published as data-sprint-href and carried in the agent view, so the URL is readable without a click.\",\n required: true,\n },\n children: {\n kind: \"node\",\n description:\n \"The link text. It names the destination, so prefer the page's name over here or read more.\",\n required: true,\n },\n active: {\n kind: \"boolean\",\n description:\n \"Mark the link as the current location. Sets aria-current so a screen reader and an agent learn it the same way.\",\n default: false,\n },\n external: {\n kind: \"boolean\",\n description:\n \"Mark a destination outside this app. Opens in a new context and adds the usual rel protections.\",\n default: false,\n },\n agentTool: {\n kind: \"boolean\",\n description:\n \"Set true to register an open tool for this link. Off by default: navigation is reachable by URL, so a tool per link is cost without benefit.\",\n default: false,\n },\n agentName: {\n kind: \"string\",\n description:\n \"Override the label used to derive the tool name, for icon-only links or two links with the same text.\",\n },\n },\n state: {\n href: {\n description: \"Where this link goes.\",\n attribute: \"data-sprint-href\",\n },\n active: {\n description: \"Present when this link is the current location.\",\n attribute: \"data-sprint-active\",\n },\n external: {\n description: \"Present when the destination is outside this app.\",\n attribute: \"data-sprint-external\",\n },\n },\n tools: {\n open: OPEN_LINK_TOOL,\n },\n agentView: {\n example: '- **Link** \"Button\" [active, href=#/Button]',\n },\n examples: [\n {\n title: \"A nav item\",\n code: '<Link href=\"#/Button\" active={route === \"Button\"}>Button</Link>',\n },\n {\n title: \"A link out\",\n code: '<Link href=\"https://developer.chrome.com/docs/ai/webmcp\" external>\\n Chrome docs\\n</Link>',\n },\n {\n title: \"A link an agent may follow itself\",\n description:\n \"Opting in is for the one link that completes a task, not for a nav list.\",\n code: '<Link href=\"#/checkout\" agentTool>Go to checkout</Link>',\n },\n ],\n a11y: {\n role: \"link\",\n keyboard: [\"Enter follows the link\"],\n notes:\n \"active sets aria-current=page. External links open in a new context with rel=noreferrer noopener, and carry their outward mark as a pseudo-element with empty alternative text so it never reaches the accessible name or the tool name. Inside Text a link is underlined all the time, so colour is never the only thing distinguishing it from the prose around it.\",\n },\n});\n","import { type ComponentPropsWithRef, useCallback, useRef } from \"react\";\nimport { AgentControl, AgentLine } from \"@/agent/view/AgentText.tsx\";\nimport { useAgentControls, useSprintView } from \"@/agent/view/mode.ts\";\nimport { agentAttributesFor, buildAgentNode } from \"@/agent/view/project.ts\";\nimport { reactText } from \"@/agent/view/text.ts\";\nimport { useAgentTool } from \"@/agent/webmcp/useAgentTool.ts\";\nimport { linkMeta } from \"./meta.ts\";\nimport { OPEN_LINK_TOOL } from \"./tool.ts\";\nimport \"./Link.css\";\n\nexport interface LinkProps extends ComponentPropsWithRef<\"a\"> {\n href: string;\n active?: boolean;\n external?: boolean;\n agentTool?: boolean;\n agentName?: string;\n}\n\nexport function Link(props: LinkProps) {\n const {\n href,\n active = false,\n external = false,\n agentTool = false,\n agentName,\n children,\n ref,\n onClick,\n ...rest\n } = props;\n\n const view = useSprintView();\n const controls = useAgentControls();\n const element = useRef<HTMLAnchorElement | null>(null);\n\n const setRef = useCallback(\n (target: HTMLAnchorElement | null) => {\n element.current = target;\n if (typeof ref === \"function\") ref(target);\n else if (ref !== null && ref !== undefined) ref.current = target;\n },\n [ref],\n );\n\n const label = agentName ?? reactText(children);\n\n const execute = useCallback(() => {\n const target = element.current;\n if (target === null) {\n return \"This link renders no element in the current view. Navigate to its href instead.\";\n }\n target.click();\n return `Following ${target.getAttribute(\"href\") ?? href}.`;\n }, [href]);\n\n const toolName = useAgentTool({\n spec: OPEN_LINK_TOOL,\n label,\n enabled: agentTool,\n execute,\n });\n\n const node = buildAgentNode({\n component: linkMeta.name,\n label: reactText(children),\n tool: toolName,\n state: { href, active, external },\n });\n\n const outward = external\n ? { target: \"_blank\", rel: \"noreferrer noopener\" }\n : { target: undefined, rel: undefined };\n\n if (view === \"agent\") {\n if (controls === \"never\") return <AgentLine node={node} />;\n return (\n <AgentControl\n node={node}\n as=\"a\"\n href={href}\n ref={setRef}\n onClick={onClick}\n target={outward.target}\n rel={outward.rel}\n />\n );\n }\n\n return (\n <a\n {...rest}\n {...agentAttributesFor(node)}\n href={href}\n ref={setRef}\n onClick={onClick}\n aria-current={active ? \"page\" : undefined}\n target={outward.target}\n rel={outward.rel}\n >\n {children}\n </a>\n );\n}\n","import { defineAgentMeta } from \"@/agent/registry.ts\";\n\nexport const listMeta = defineAgentMeta({\n name: \"List\",\n category: \"display\",\n summary:\n \"A bulleted or numbered list built from an array of items. Each item is an addressable part carrying its position, so an agent can cite item three without counting lines.\",\n whenToUse:\n \"Use it for a short sequence of related points: rules, steps, links, caveats. Passing items as data rather than as children is what lets the agent view carry each one as its own part.\",\n whenNotToUse:\n \"Do not use it for records with fields; that is Table. Do not use it as a layout for cards or controls; that is Stack.\",\n status: \"experimental\",\n props: {\n label: {\n kind: \"string\",\n description:\n \"What the list is a list of. Names it for a screen reader and for the agent view.\",\n required: true,\n },\n items: {\n kind: \"array\",\n description:\n \"The items in order. Inline content, not components: each is flattened to text for the agent view.\",\n required: true,\n },\n ordered: {\n kind: \"boolean\",\n description:\n \"Number the items instead of bulleting them. Use it when the order is the point.\",\n default: false,\n },\n emptyLabel: {\n kind: \"string\",\n description: \"What the list says when it has no items.\",\n default: \"Empty\",\n },\n },\n state: {\n items: {\n description: \"How many items the list has.\",\n attribute: \"data-sprint-items\",\n },\n ordered: {\n description: \"Present when the items are numbered rather than bulleted.\",\n attribute: \"data-sprint-ordered\",\n },\n empty: {\n description: \"Present when the list has no items.\",\n attribute: \"data-sprint-empty\",\n },\n index: {\n description: \"On an item: its 1-based position in the list.\",\n attribute: \"data-sprint-index\",\n },\n },\n agentView: {\n example:\n '- **List** \"Tool rules\" [items=1]\\n - part `item` \"One tool, one action.\" [index=1]',\n },\n examples: [\n {\n title: \"A list of rules\",\n code: '<List\\n label=\"Tool rules\"\\n items={[\\n <>\\n <strong>One tool, one action.</strong> Overlapping tools make selection\\n harder.\\n </>,\\n ]}\\n/>',\n },\n {\n title: \"A numbered sequence\",\n code: '<List\\n ordered\\n label=\"Steps\"\\n items={[\"Register the tool.\", \"Drive the DOM.\", \"Return the new state.\"]}\\n/>',\n },\n ],\n a11y: {\n role: \"list\",\n notes:\n \"A real ul or ol named by its label, with an explicit list role because the custom markers require list-style none and Safari would otherwise drop the list semantics. The item count is announced, and the markers are drawn as pseudo-elements.\",\n },\n});\n","import type { ComponentPropsWithRef, ReactNode } from \"react\";\nimport { AgentLine } from \"@/agent/view/AgentText.tsx\";\nimport { useSprintView } from \"@/agent/view/mode.ts\";\nimport type { AgentPart } from \"@/agent/view/node.ts\";\nimport {\n agentAttributesFor,\n agentPartAttributesFor,\n buildAgentNode,\n} from \"@/agent/view/project.ts\";\nimport { reactText } from \"@/agent/view/text.ts\";\nimport { listMeta } from \"./meta.ts\";\nimport \"./List.css\";\n\nexport interface ListProps extends ComponentPropsWithRef<\"ul\"> {\n label: string;\n items: readonly ReactNode[];\n ordered?: boolean;\n emptyLabel?: string;\n}\n\nexport function List(props: ListProps) {\n const { label, items, ordered = false, emptyLabel = \"Empty\", ...rest } = props;\n\n const view = useSprintView();\n const empty = items.length === 0;\n\n const parts: AgentPart[] = items.map((item, index) => {\n const text = reactText(item);\n return {\n part: \"item\",\n state: { index: String(index + 1) },\n ...(text === undefined ? {} : { label: text }),\n };\n });\n\n const node = buildAgentNode({\n component: listMeta.name,\n label,\n state: { items: String(items.length), ordered, empty },\n parts,\n });\n\n if (view === \"agent\") return <AgentLine node={node} />;\n\n const Element = ordered ? \"ol\" : \"ul\";\n\n return (\n <Element\n {...(rest as ComponentPropsWithRef<\"ol\">)}\n {...agentAttributesFor(node)}\n role=\"list\"\n aria-label={label}\n >\n {empty ? (\n <li>{emptyLabel}</li>\n ) : (\n items.map((item, index) => (\n <li\n key={`${index}-${String(reactText(item))}`}\n {...agentPartAttributesFor({\n part: \"item\",\n state: { index: String(index + 1) },\n })}\n >\n <span>{item}</span>\n </li>\n ))\n )}\n </Element>\n );\n}\n","import { defineAgentMeta } from \"@/agent/registry.ts\";\n\nexport const metaLineMeta = defineAgentMeta({\n name: \"MetaLine\",\n category: \"display\",\n summary:\n \"A slash-separated manifest line of term–detail pairs: serials, build strings, issue dates. It is chrome, not content, and in the agent view it reads as the same single line of text a person sees.\",\n whenToUse:\n \"Use it for the compact strip of identifying metadata that belongs to a page, panel, or footer: version and build identifiers, timestamps, serial numbers, owners. Values are short and the line truncates rather than wraps.\",\n whenNotToUse:\n \"Do not use it for the details of a record a person is meant to study; that is a DescriptionList. Do not put anything interactive in it, and do not use it for prose.\",\n status: \"experimental\",\n props: {\n entries: {\n kind: \"array\",\n description:\n \"Term–detail pairs in display order: { term, detail }, both strings. Rendered as TERM: DETAIL, slash-separated, and carried as one line in the agent view. An empty array renders nothing.\",\n required: true,\n },\n },\n state: {\n entries: {\n description: \"How many term–detail pairs the line carries.\",\n attribute: \"data-sprint-entries\",\n },\n },\n agentView: {\n example:\n '- **MetaLine** \"SERIAL: NU-TYPE-CORE-A1 / ISSUED: 2744.07.22\" [entries=2]',\n },\n examples: [\n {\n title: \"A build strip\",\n description:\n \"The manifest voice: uppercase mono, slash-separated, terms muted and details in ink.\",\n code: '<MetaLine\\n entries={[\\n { term: \"Serial\", detail: \"NU-TYPE-CORE-A1\" },\\n { term: \"Issued\", detail: \"2744.07.22\" },\\n ]}\\n/>',\n },\n {\n title: \"Version chrome for a footer\",\n description: \"The line an app pins under its content or into a Shell rail.\",\n code: '<MetaLine\\n entries={[\\n { term: \"Sprint\", detail: \"v0.0.0\" },\\n { term: \"Channel\", detail: \"dev\" },\\n { term: \"WebMCP\", detail: \"chrome 149\" },\\n ]}\\n/>',\n },\n ],\n a11y: {\n role: \"paragraph\",\n notes:\n \"The separators are real text, so the accessible name is the same line the agent view carries. Nothing in the line is interactive.\",\n },\n});\n","import { type ComponentPropsWithRef, Fragment } from \"react\";\nimport { AgentLine } from \"@/agent/view/AgentText.tsx\";\nimport { useSprintView } from \"@/agent/view/mode.ts\";\nimport { agentAttributesFor, buildAgentNode } from \"@/agent/view/project.ts\";\nimport { metaLineMeta } from \"./meta.ts\";\nimport \"./MetaLine.css\";\n\nexport interface MetaLineEntry {\n term: string;\n detail: string;\n}\n\nexport interface MetaLineProps extends ComponentPropsWithRef<\"p\"> {\n entries: readonly MetaLineEntry[];\n}\n\nexport function MetaLine(props: MetaLineProps) {\n const { entries, ...rest } = props;\n\n const view = useSprintView();\n\n if (entries.length === 0) return null;\n\n const line = entries.map((entry) => `${entry.term}: ${entry.detail}`).join(\" / \");\n\n const node = buildAgentNode({\n component: metaLineMeta.name,\n label: line,\n state: { entries: String(entries.length) },\n });\n\n if (view === \"agent\") return <AgentLine node={node} />;\n\n return (\n <p {...rest} {...agentAttributesFor(node)}>\n {entries.map((entry, index) => (\n <Fragment key={`${entry.term}-${index}`}>\n {index > 0 ? \" / \" : null}\n <span>\n <span>{entry.term}: </span>\n <span>{entry.detail}</span>\n </span>\n </Fragment>\n ))}\n </p>\n );\n}\n","import { defineAgentMeta } from \"@/agent/registry.ts\";\n\nexport const navMeta = defineAgentMeta({\n name: \"Nav\",\n category: \"navigation\",\n summary:\n \"A labelled navigation landmark: the region that holds a page's links to elsewhere.\",\n whenToUse:\n \"Use it around any set of links whose job is getting around the app: a sidebar, a table of contents, a footer link block. The label names the landmark, so a person navigating by landmark, a screen reader, and an agent reading the page all know these links are wayfinding rather than content. Group related links inside it with NavGroup.\",\n whenNotToUse:\n \"Do not use it for a link that sits inside prose; a bare Link is already readable there. Do not use it for a set of actions that stay on the page; those are Buttons in a Stack.\",\n status: \"experimental\",\n props: {\n label: {\n kind: \"string\",\n description:\n \"What this navigation is for. Rendered as the landmark's accessible name, so two navs on one page stay distinguishable.\",\n required: true,\n },\n children: {\n kind: \"node\",\n description: \"Link components, or NavGroup components wrapping them.\",\n required: true,\n },\n },\n agentView: {\n example: '- **Nav** \"Workbench\"',\n },\n a11y: {\n role: \"navigation\",\n notes:\n \"The label is the landmark's accessible name via aria-label. Active links inside it carry aria-current=page, so the current location is announced without any styling cue.\",\n },\n relatedComponents: [\"NavGroup\", \"Link\", \"Shell\"],\n examples: [\n {\n title: \"A grouped sidebar nav\",\n description:\n \"Each NavGroup names a cluster of destinations. The active link carries the current-page mark in every view.\",\n code: '<Nav label=\"Docs\">\\n <NavGroup label=\"Guides\">\\n <Link href=\"#/guide/webmcp\">WebMCP</Link>\\n </NavGroup>\\n <NavGroup label=\"Components\">\\n <Link href=\"#/Button\" active>Button</Link>\\n <Link href=\"#/Table\">Table</Link>\\n </NavGroup>\\n</Nav>',\n },\n {\n title: \"A flat nav\",\n description: \"A short list of destinations needs no grouping.\",\n code: '<Nav label=\"Site\">\\n <Link href=\"#/\">Home</Link>\\n <Link href=\"#/pricing\">Pricing</Link>\\n</Nav>',\n },\n ],\n});\n","import type { ComponentPropsWithRef } from \"react\";\nimport { AgentLine } from \"@/agent/view/AgentText.tsx\";\nimport { useSprintView } from \"@/agent/view/mode.ts\";\nimport { agentAttributesFor, buildAgentNode } from \"@/agent/view/project.ts\";\nimport { navMeta } from \"./meta.ts\";\nimport \"./Nav.css\";\n\nexport interface NavProps extends ComponentPropsWithRef<\"nav\"> {\n label: string;\n}\n\nexport function Nav(props: NavProps) {\n const { label, children, ...rest } = props;\n\n const view = useSprintView();\n\n const node = buildAgentNode({ component: navMeta.name, label, region: true });\n\n if (view === \"agent\") return <AgentLine node={node}>{children}</AgentLine>;\n\n return (\n <nav {...rest} {...agentAttributesFor(node)} aria-label={label}>\n {children}\n </nav>\n );\n}\n","import { defineAgentMeta } from \"@/agent/registry.ts\";\n\nexport const navBarMeta = defineAgentMeta({\n name: \"NavBar\",\n category: \"navigation\",\n summary:\n \"A navigation landmark that renders as one line: where you are, written as a coordinate you can edit. Every destination stays in the page as an addressable part; the coordinate decides which of them a person is shown.\",\n whenToUse:\n \"Use it as an application's primary navigation when the catalogue is larger than a rail can hold, or when the layout needs its full width. Each segment of the coordinate opens its own level and filters as you type, so what a person chooses from is one level rather than the whole set. It takes destinations as data because it counts, filters and orders them.\",\n whenNotToUse:\n \"Do not use it for a handful of links that fit in a sidebar; that is Nav with NavGroup, which keeps every destination visible at once. Do not use it for links inside prose, and do not pass components in groups: each destination is a label and an href, not a node.\",\n status: \"experimental\",\n props: {\n label: {\n kind: \"string\",\n description:\n \"What this navigation is for. Rendered as the landmark's accessible name and as the root of the coordinate.\",\n required: true,\n },\n groups: {\n kind: \"array\",\n description:\n \"The destinations, as groups of { label, items }, each item { href, label, active?, external? }. Order is the order a person travels them.\",\n required: true,\n },\n emptyLabel: {\n kind: \"string\",\n description: \"What the bar says when a filter matches no destination.\",\n default: \"No match\",\n },\n trailEmptyLabel: {\n kind: \"string\",\n description: \"What the bar says when nothing has been visited through it yet.\",\n default: \"Nothing visited yet\",\n },\n open: {\n kind: \"enum\",\n description:\n \"Which segment is open, or 'closed'. Pass it to drive the bar from outside, such as from an application-level shortcut; leave it off and the bar keeps its own state.\",\n values: [\"trail\", \"group\", \"leaf\", \"closed\"],\n },\n onOpenChange: {\n kind: \"handler\",\n description:\n \"Called with the segment the bar wants open, or 'closed'. Required when open is controlled, so the bar can still close itself.\",\n },\n onNavigate: {\n kind: \"handler\",\n description:\n \"Called with the destination when one is chosen, before the browser follows the href. Use it to record the visit somewhere that outlives this component.\",\n },\n },\n state: {\n destinations: {\n description: \"How many destinations the bar holds.\",\n attribute: \"data-sprint-destinations\",\n },\n open: {\n description:\n \"Which segment of the coordinate is open: trail, group, or leaf. Absent when the bar is closed to its one line.\",\n attribute: \"data-sprint-open\",\n },\n depth: {\n description: \"How many destinations have been visited through this bar.\",\n attribute: \"data-sprint-depth\",\n },\n matches: {\n description: \"How many destinations the open segment is showing.\",\n attribute: \"data-sprint-matches\",\n },\n shown: {\n description:\n \"On a destination: present when the open segment is currently showing it to a person. Every destination stays in the page either way.\",\n attribute: \"data-sprint-shown\",\n },\n group: {\n description: \"On a destination: the group it belongs to.\",\n attribute: \"data-sprint-group\",\n },\n href: {\n description: \"On a destination: where it goes.\",\n attribute: \"data-sprint-href\",\n },\n active: {\n description: \"On a destination: present when it is the current page.\",\n attribute: \"data-sprint-active\",\n },\n },\n agentView: {\n example:\n '- **NavBar** \"Workbench\" [destinations=2, depth=0]\\n - part `destination` \"Button\" [group=action, href=#/Button]\\n - part `destination` \"Table\" [group=display, href=#/Table, active, shown]',\n },\n a11y: {\n role: \"navigation\",\n notes:\n \"The label is the landmark's accessible name. The current destination carries aria-current=page. Destinations the coordinate is not showing are hidden from the accessibility tree by CSS, so a screen reader travels one level at a time exactly as a sighted reader does, while the page itself keeps all of them. From the field, ArrowDown enters the results and ArrowUp at the top returns to it; typing anywhere in the results goes back to the field and keeps the character. Escape closes the bar, as does a press outside it, and the match count is a polite live region. ArrowUp in an empty field recalls the trail, the way a console recalls history.\",\n },\n relatedComponents: [\"Nav\", \"NavGroup\", \"Link\", \"Shell\"],\n examples: [\n {\n title: \"A coordinate bar\",\n description:\n \"One line of chrome over a grouped catalogue. Clicking a segment opens that level and filters it as you type.\",\n code: '<NavBar\\n label=\"Workbench\"\\n groups={[\\n { label: \"action\", items: [{ href: \"#/Button\", label: \"Button\" }] },\\n { label: \"display\", items: [{ href: \"#/Table\", label: \"Table\", active: true }] },\\n ]}\\n/>',\n },\n {\n title: \"Recording where a person has been\",\n description:\n \"The bar keeps a trail of the destinations chosen through it, reachable from the depth count at its head. onNavigate is how that outlives the component.\",\n code: '<NavBar\\n label=\"Docs\"\\n groups={[{ label: \"guides\", items: [{ href: \"#/guide/webmcp\", label: \"WebMCP\" }] }]}\\n onNavigate={(destination) => console.log(destination.href)}\\n/>',\n },\n ],\n});\n","import {\n type ComponentPropsWithRef,\n type CSSProperties,\n type KeyboardEvent,\n useCallback,\n useEffect,\n useRef,\n useState,\n} from \"react\";\nimport { AgentControlGroup } from \"@/agent/view/AgentText.tsx\";\nimport { useSprintView } from \"@/agent/view/mode.ts\";\nimport type { AgentPart } from \"@/agent/view/node.ts\";\nimport {\n agentAttributesFor,\n agentPartAttributesFor,\n buildAgentNode,\n} from \"@/agent/view/project.ts\";\nimport { navBarMeta } from \"./meta.ts\";\nimport \"./NavBar.css\";\n\nexport interface NavBarDestination {\n href: string;\n label: string;\n active?: boolean;\n external?: boolean;\n}\n\nexport interface NavBarGroup {\n label: string;\n items: readonly NavBarDestination[];\n}\n\nexport type NavBarSegment = \"trail\" | \"group\" | \"leaf\";\n\nexport type NavBarOpening = NavBarSegment | \"closed\";\n\nexport interface NavBarProps extends Omit<ComponentPropsWithRef<\"nav\">, \"children\"> {\n label: string;\n groups: readonly NavBarGroup[];\n emptyLabel?: string;\n trailEmptyLabel?: string;\n open?: NavBarOpening;\n onOpenChange?: (opening: NavBarOpening) => void;\n onNavigate?: (destination: NavBarDestination) => void;\n}\n\nconst TRAVEL = \"[data-sprint-shown], button\";\n\nfunction reading(opening: NavBarOpening): NavBarSegment | undefined {\n return opening === \"closed\" ? undefined : opening;\n}\n\nfunction matches(text: string, needle: string): boolean {\n return text.toLowerCase().includes(needle);\n}\n\nexport function NavBar(props: NavBarProps) {\n const {\n label,\n groups,\n emptyLabel = \"No match\",\n trailEmptyLabel = \"Nothing visited yet\",\n open: opening,\n onOpenChange,\n onNavigate,\n ref,\n ...rest\n } = props;\n\n const view = useSprintView();\n const [held, setHeld] = useState<NavBarSegment | undefined>(undefined);\n const open = opening === undefined ? held : reading(opening);\n const [query, setQuery] = useState(\"\");\n const [scope, setScope] = useState<string | undefined>(undefined);\n const [trail, setTrail] = useState<readonly string[]>([]);\n const field = useRef<HTMLInputElement>(null);\n const drawer = useRef<HTMLDivElement>(null);\n const root = useRef<HTMLElement | null>(null);\n\n const setRoot = useCallback(\n (target: HTMLElement | null) => {\n root.current = target;\n if (typeof ref === \"function\") ref(target);\n else if (ref !== null && ref !== undefined) ref.current = target;\n },\n [ref],\n );\n\n const notify = useRef(onOpenChange);\n notify.current = onOpenChange;\n\n const announce = useCallback((next: NavBarSegment | undefined) => {\n setHeld(next);\n notify.current?.(next ?? \"closed\");\n }, []);\n\n useEffect(() => {\n if (open !== undefined) field.current?.focus();\n }, [open]);\n\n useEffect(() => {\n if (open === undefined) return;\n const dismiss = (event: PointerEvent) => {\n const target = event.target;\n if (target instanceof Node && root.current?.contains(target) === true) return;\n announce(undefined);\n setQuery(\"\");\n };\n document.addEventListener(\"pointerdown\", dismiss);\n return () => document.removeEventListener(\"pointerdown\", dismiss);\n }, [open, announce]);\n\n const all = groups.flatMap((group) =>\n group.items.map((item) => ({ item, group: group.label })),\n );\n const current = all.find((entry) => entry.item.active === true);\n const here = current === undefined ? (groups[0]?.label ?? \"\") : current.group;\n const inspected = scope ?? here;\n const needle = query.trim().toLowerCase();\n const searching = needle !== \"\";\n\n const revealed: NavBarDestination[] = [];\n if (open === \"trail\") {\n for (const entry of all) {\n if (!trail.includes(entry.item.href)) continue;\n if (searching && !matches(`${entry.group} ${entry.item.label}`, needle)) continue;\n revealed.push(entry.item);\n }\n } else if (open === \"leaf\" || (open === \"group\" && searching)) {\n for (const entry of all) {\n const hit = searching\n ? matches(`${entry.group} ${entry.item.label}`, needle)\n : entry.group === inspected;\n if (hit) revealed.push(entry.item);\n }\n }\n\n const levels = open === \"group\" && !searching ? groups : [];\n\n const scoped = all.filter((entry) => entry.group === inspected).length;\n const total = searching\n ? all.length\n : open === \"trail\"\n ? trail.length\n : open === \"group\"\n ? groups.length\n : scoped;\n const shown = levels.length > 0 ? levels.length : revealed.length;\n\n const rows = all.map((entry) => {\n const part: AgentPart = {\n part: \"destination\",\n label: entry.item.label,\n state: {\n group: entry.group,\n href: entry.item.href,\n ...(entry.item.active === true ? { active: true } : {}),\n ...(entry.item.external === true ? { external: true } : {}),\n ...(revealed.includes(entry.item) ? { shown: true } : {}),\n },\n };\n return { ...entry, part };\n });\n\n const node = buildAgentNode({\n component: navBarMeta.name,\n label,\n region: true,\n state: {\n destinations: String(all.length),\n depth: String(trail.length),\n ...(open === undefined ? {} : { open, matches: String(shown) }),\n },\n parts: rows.map((row) => row.part),\n });\n\n const travel = (destination: NavBarDestination) => {\n setTrail((was) => [\n ...was.filter((href) => href !== destination.href),\n destination.href,\n ]);\n announce(undefined);\n setQuery(\"\");\n onNavigate?.(destination);\n };\n\n if (view === \"agent\") {\n return (\n <AgentControlGroup\n node={node}\n onActivate={(_part, index) => {\n const entry = all[index];\n if (entry === undefined) return;\n travel(entry.item);\n window.location.assign(entry.item.href);\n }}\n />\n );\n }\n\n const close = () => {\n announce(undefined);\n setQuery(\"\");\n };\n\n const reach = (segment: NavBarSegment) => {\n announce(open === segment ? undefined : segment);\n setQuery(\"\");\n };\n\n const recency = (members: readonly { item: NavBarDestination }[]): number => {\n if (open !== \"trail\") return 0;\n const latest = members.reduce(\n (best, member) => Math.max(best, trail.indexOf(member.item.href)),\n -1,\n );\n return -latest;\n };\n\n const travellers = (): HTMLElement[] => {\n const within = drawer.current;\n if (within === null) return [];\n return Array.from(within.querySelectorAll<HTMLElement>(TRAVEL)).filter(\n (candidate) => candidate.closest(\"[hidden]\") === null,\n );\n };\n\n const step = (from: number) => {\n const stops = travellers();\n const next = stops[from < 0 ? stops.length - 1 : from % stops.length];\n next?.focus();\n };\n\n const drive = (event: KeyboardEvent<HTMLInputElement>) => {\n if (event.key === \"Escape\") {\n close();\n return;\n }\n if (event.key === \"ArrowDown\") {\n event.preventDefault();\n step(0);\n return;\n }\n if (event.key === \"ArrowUp\" && open !== \"trail\") {\n event.preventDefault();\n reach(\"trail\");\n return;\n }\n if (event.key !== \"Enter\") return;\n event.preventDefault();\n const level = levels[0];\n if (level !== undefined) {\n setScope(level.label);\n setQuery(\"\");\n announce(\"leaf\");\n return;\n }\n const first = revealed[0];\n if (first === undefined) return;\n travel(first);\n window.location.assign(first.href);\n };\n\n const steer = (event: KeyboardEvent<HTMLDivElement>) => {\n if (event.key === \"Escape\") {\n close();\n return;\n }\n const stops = travellers();\n const at = stops.indexOf(event.target as HTMLElement);\n if (event.key === \"ArrowDown\") {\n event.preventDefault();\n step(at + 1);\n return;\n }\n if (event.key === \"ArrowUp\") {\n event.preventDefault();\n if (at <= 0) field.current?.focus();\n else step(at - 1);\n return;\n }\n if (event.key.length !== 1 || event.metaKey || event.ctrlKey || event.altKey)\n return;\n event.preventDefault();\n setQuery((was) => `${was}${event.key}`);\n field.current?.focus();\n };\n\n const segment = (name: NavBarSegment, text: string) =>\n open === name || (name === \"leaf\" && open === \"trail\") ? (\n <input\n ref={field}\n type=\"text\"\n aria-label={`Search ${label}`}\n value={query}\n placeholder={\n open === \"trail\"\n ? `Search ${trail.length} visited`\n : `Search ${all.length} destinations`\n }\n onChange={(event) => setQuery(event.target.value)}\n onKeyDown={drive}\n />\n ) : (\n <button type=\"button\" aria-expanded={false} onClick={() => reach(name)}>\n {text}\n </button>\n );\n\n const nothing = open === \"trail\" && trail.length === 0 ? trailEmptyLabel : emptyLabel;\n const count =\n open === undefined\n ? `${all.length} destinations`\n : searching\n ? `${shown} of ${all.length} match`\n : `${shown} of ${total}`;\n\n return (\n <nav {...rest} {...agentAttributesFor(node)} aria-label={label} ref={setRoot}>\n <p>\n <button\n type=\"button\"\n aria-label={`Visited, ${trail.length}`}\n aria-expanded={open === \"trail\"}\n onClick={() => reach(\"trail\")}\n >\n {String(trail.length).padStart(2, \"0\")}\n </button>\n <span>{label}</span>\n {segment(\"group\", inspected)}\n {segment(\"leaf\", current?.item.label ?? \"—\")}\n <span aria-live=\"polite\">{count}</span>\n </p>\n {/* biome-ignore lint/a11y/noStaticElementInteractions: the keys travel between the links inside, which handle their own activation */}\n <div\n ref={drawer}\n onKeyDown={steer}\n {...(open === undefined ? { hidden: true } : {})}\n >\n <div {...(levels.length === 0 ? { hidden: true } : {})}>\n <span>{label}</span>\n {levels.map((group) => (\n <button\n key={group.label}\n type=\"button\"\n onClick={() => {\n setScope(group.label);\n setQuery(\"\");\n announce(\"leaf\");\n }}\n >\n {group.label}\n </button>\n ))}\n </div>\n {groups.map((group) => {\n const members = rows.filter((row) => row.group === group.label);\n const any = members.some((row) => revealed.includes(row.item));\n return (\n <div\n key={group.label}\n style={{ \"--sprint-navbar-order\": recency(members) } as CSSProperties}\n {...(any ? {} : { hidden: true })}\n >\n <span>{`${label} / ${group.label}`}</span>\n {members.map((entry) => (\n <a\n key={entry.item.href}\n {...agentPartAttributesFor(entry.part)}\n href={entry.item.href}\n aria-current={entry.item.active === true ? \"page\" : undefined}\n target={entry.item.external === true ? \"_blank\" : undefined}\n rel={entry.item.external === true ? \"noreferrer noopener\" : undefined}\n onClick={() => travel(entry.item)}\n >\n {entry.item.label}\n </a>\n ))}\n </div>\n );\n })}\n {shown === 0 ? <p>{nothing}</p> : null}\n </div>\n </nav>\n );\n}\n","import { defineAgentMeta } from \"@/agent/registry.ts\";\n\nexport const navGroupMeta = defineAgentMeta({\n name: \"NavGroup\",\n category: \"navigation\",\n summary:\n \"A labelled cluster of links inside a Nav. The label names the group for screen readers and agents alike.\",\n whenToUse:\n \"Use it when a Nav holds more than one kind of destination: guides versus components, product versus account. The label tells every reader, including an agent scanning for the right link, what the links below it have in common.\",\n whenNotToUse:\n \"Do not use it outside a Nav; on its own it is just a heading over links, which Panel does better. Do not nest groups; one level of grouping is all a sidebar can carry.\",\n status: \"experimental\",\n props: {\n label: {\n kind: \"string\",\n description:\n \"What the links in this group have in common. Rendered as the rubric and as the group's accessible name.\",\n required: true,\n },\n children: {\n kind: \"node\",\n description: \"The Link components this group collects.\",\n required: true,\n },\n },\n agentView: {\n example: '- **NavGroup** \"Components\"',\n },\n a11y: {\n role: \"group\",\n notes:\n \"The group carries its label as an accessible name, so screen readers announce the rubric when entering the cluster rather than reading an unlabelled run of links.\",\n },\n relatedComponents: [\"Nav\", \"Link\"],\n examples: [\n {\n title: \"A labelled group of links\",\n code: '<NavGroup label=\"Reference\">\\n <Link href=\"https://developer.chrome.com/docs/ai/webmcp\" external>\\n Chrome docs\\n </Link>\\n <Link href=\"https://github.com/webmachinelearning/webmcp\" external>\\n Specification\\n </Link>\\n</NavGroup>',\n },\n ],\n});\n","import type { ComponentPropsWithRef } from \"react\";\nimport { AgentLine } from \"@/agent/view/AgentText.tsx\";\nimport { useSprintView } from \"@/agent/view/mode.ts\";\nimport { agentAttributesFor, buildAgentNode } from \"@/agent/view/project.ts\";\nimport { navGroupMeta } from \"./meta.ts\";\nimport \"./NavGroup.css\";\n\nexport interface NavGroupProps extends ComponentPropsWithRef<\"div\"> {\n label: string;\n}\n\nexport function NavGroup(props: NavGroupProps) {\n const { label, children, ...rest } = props;\n\n const view = useSprintView();\n\n const node = buildAgentNode({ component: navGroupMeta.name, label });\n\n if (view === \"agent\") return <AgentLine node={node}>{children}</AgentLine>;\n\n return (\n // biome-ignore lint/a11y/useSemanticElements: the suggested fieldset groups form controls; this groups links, and group is the ARIA role for exactly that\n <div {...rest} {...agentAttributesFor(node)} role=\"group\" aria-label={label}>\n <span>{label}</span>\n {children}\n </div>\n );\n}\n","import { defineAgentMeta } from \"@/agent/registry.ts\";\n\nexport const pageHeaderMeta = defineAgentMeta({\n name: \"PageHeader\",\n category: \"layout\",\n summary:\n \"The top of a page: its h1 title, the Tag chips that classify it, an optional page-level control, and a lede underneath.\",\n whenToUse:\n \"Use it once per page, as the first thing inside the content region. The label becomes the page's only h1, so the document outline starts here. Put status or category Tags in tags, a control that affects the whole page in actions, and the introductory sentence or two in children as Text.\",\n whenNotToUse:\n \"Do not use it for a section within a page; that is a Panel with a headingLevel. Do not put navigation in actions; the page's links belong in a Nav.\",\n status: \"experimental\",\n props: {\n label: {\n kind: \"string\",\n description: \"The page title. Rendered as the page's h1.\",\n required: true,\n },\n tags: {\n kind: \"node\",\n description:\n \"Tag components that classify the page, rendered on the title line. Keep it to two or three.\",\n },\n actions: {\n kind: \"node\",\n description:\n \"A control that acts on the whole page, rendered at the end of the title line.\",\n },\n children: {\n kind: \"node\",\n description: \"The lede: a Text or two introducing the page.\",\n },\n },\n agentView: {\n example: '- **PageHeader** \"Button\"',\n },\n a11y: {\n notes:\n \"The label renders as the page's h1, so keep to one PageHeader per page. Tags and the lede are ordinary content after it; the header element itself takes no landmark role because it sits inside main.\",\n },\n relatedComponents: [\"Panel\", \"Heading\", \"Tag\"],\n examples: [\n {\n title: \"A titled page with a lede\",\n code: '<PageHeader label=\"Reports\">\\n <Text>Everything the quarter produced, in one place.</Text>\\n</PageHeader>',\n },\n {\n title: \"Status tags and a page-level control\",\n description:\n \"Tags classify the page on the title line; the action slot holds the one control that affects the whole page.\",\n code: '<PageHeader\\n label=\"Button\"\\n tags={<Tag tone=\"warning\" filled>experimental</Tag>}\\n actions={<Button agentTool={false}>Refresh</Button>}\\n>\\n <Text>A single action a person or an agent can trigger.</Text>\\n</PageHeader>',\n },\n ],\n});\n","import { Children, type ComponentPropsWithRef, type ReactNode } from \"react\";\nimport { AgentLine } from \"@/agent/view/AgentText.tsx\";\nimport { useSprintView } from \"@/agent/view/mode.ts\";\nimport { agentAttributesFor, buildAgentNode } from \"@/agent/view/project.ts\";\nimport { pageHeaderMeta } from \"./meta.ts\";\nimport \"./PageHeader.css\";\n\nexport interface PageHeaderProps extends ComponentPropsWithRef<\"header\"> {\n label: string;\n tags?: ReactNode;\n actions?: ReactNode;\n}\n\nexport function PageHeader(props: PageHeaderProps) {\n const { label, tags, actions, children, ...rest } = props;\n\n const view = useSprintView();\n\n const node = buildAgentNode({\n component: pageHeaderMeta.name,\n label,\n region: true,\n });\n\n if (view === \"agent\") {\n return (\n <AgentLine node={node}>\n {tags}\n {actions}\n {children}\n </AgentLine>\n );\n }\n\n const lede = Children.toArray(children).length > 0;\n\n return (\n <header {...rest} {...agentAttributesFor(node)}>\n <div>\n <div>\n <h1>{label}</h1>\n {tags === undefined ? null : <span>{tags}</span>}\n </div>\n {actions === undefined ? null : <span>{actions}</span>}\n </div>\n {lede ? <div>{children}</div> : null}\n </header>\n );\n}\n","import { defineAgentMeta } from \"@/agent/registry.ts\";\n\nexport const panelMeta = defineAgentMeta({\n name: \"Panel\",\n category: \"layout\",\n summary:\n \"A labelled region with a header band and an optional slot for the controls that act on it. Everything on a Sprint page lives inside one.\",\n whenToUse:\n \"Use it for every distinct region of a page: a section of documentation, a form, a readout, a preview. The label is the region's accessible name, so a person, a screen reader, and an agent all address the region by the same words.\",\n whenNotToUse:\n \"Do not use it as a spacer or a plain box; that is Stack. Nesting reads clearly to about three deep, because each level alternates its ground and demotes its frame; past that, the depth cues repeat and the region wants a page of its own.\",\n status: \"experimental\",\n props: {\n label: {\n kind: \"string\",\n description:\n \"What this region is. Rendered in the header band and used as the region's accessible name.\",\n required: true,\n },\n children: {\n kind: \"node\",\n description:\n \"The region's content. An empty panel says it is empty rather than collapsing.\",\n },\n headingLevel: {\n kind: \"enum\",\n description:\n \"Render the label as a real heading at this outline depth, so the section is reachable when a screen reader navigates by headings. Set it on every panelled section of a page; leave it unset only for chrome such as a preview frame.\",\n values: [\"2\", \"3\", \"4\"],\n },\n actions: {\n kind: \"node\",\n description:\n \"Controls that act on this region, rendered at the end of the header band. Keep it to one or two.\",\n },\n flush: {\n kind: \"boolean\",\n description:\n \"Drop the body padding, for content that draws its own edges such as a Table or a CodeBlock.\",\n default: false,\n },\n emptyLabel: {\n kind: \"string\",\n description: \"What the panel says when it has no content.\",\n default: \"Empty\",\n },\n },\n state: {\n flush: {\n description: \"Present when the body carries no padding of its own.\",\n attribute: \"data-sprint-flush\",\n },\n empty: {\n description:\n \"Present when the panel has no content. The panel still renders its keyline and says it is empty.\",\n attribute: \"data-sprint-empty\",\n },\n },\n agentView: {\n example: '- **Panel** \"WebMCP tools\"',\n },\n a11y: {\n role: \"region\",\n notes:\n \"The section is a named landmark either way: the label is its accessible name. With headingLevel the label is also a heading element, so the page outline includes the region; without it the region is reachable only by landmark navigation.\",\n },\n examples: [\n {\n title: \"A section of a page\",\n description:\n \"headingLevel puts the label in the page outline, so a screen reader finds the section by heading as well as by landmark.\",\n code: '<Panel label=\"When to use\" headingLevel={2}>\\n <Text>Use it for any discrete action.</Text>\\n</Panel>',\n },\n {\n title: \"A panel with a control in its header\",\n description:\n \"The header slot is for controls that act on the region, not for navigation.\",\n code: '<Panel\\n label=\"Preview\"\\n actions={<Button agentName=\"Reset preview\">Reset</Button>}\\n>\\n <Button tone=\"action\">Prepare launch</Button>\\n</Panel>',\n },\n {\n title: \"A flush panel around a table\",\n description:\n \"Content that draws its own keylines sits flush, so borders do not double up.\",\n code: '<Panel label=\"Conventions\" flush>\\n <Table label=\"Conventions\" columns={columns} rows={rows} />\\n</Panel>',\n },\n {\n title: \"Nested panels\",\n description:\n \"Depth styles itself: the outermost panel carries a doubled keyline, each nested level alternates its ground, and nested headers demote to a dashed rule, so a reader ranks the levels without counting borders.\",\n code: '<Panel label=\"The shape\" headingLevel={2}>\\n <Panel label=\"Human view\" headingLevel={3}>\\n <Panel label=\"Crew\" headingLevel={4}>\\n <Text>Registration fields live here.</Text>\\n </Panel>\\n </Panel>\\n</Panel>',\n },\n {\n title: \"An empty region\",\n description:\n \"An empty panel keeps its border and states that it is empty, rather than vanishing and leaving a person or an agent unsure whether it failed to load.\",\n code: '<Panel label=\"Registered tools\" emptyLabel=\"No tools registered\" />',\n },\n ],\n});\n","import { Children, type ComponentPropsWithRef, type ReactNode } from \"react\";\nimport { AgentLine } from \"@/agent/view/AgentText.tsx\";\nimport { useSprintView } from \"@/agent/view/mode.ts\";\nimport { agentAttributesFor, buildAgentNode } from \"@/agent/view/project.ts\";\nimport { panelMeta } from \"./meta.ts\";\nimport \"./Panel.css\";\n\nexport type PanelHeadingLevel = 2 | 3 | 4;\n\nexport interface PanelProps extends ComponentPropsWithRef<\"section\"> {\n label: string;\n headingLevel?: PanelHeadingLevel;\n actions?: ReactNode;\n flush?: boolean;\n emptyLabel?: string;\n}\n\nexport function Panel(props: PanelProps) {\n const {\n label,\n headingLevel,\n actions,\n flush = false,\n emptyLabel = \"Empty\",\n children,\n ...rest\n } = props;\n\n const view = useSprintView();\n const empty = Children.toArray(children).length === 0;\n\n const node = buildAgentNode({\n component: panelMeta.name,\n label,\n region: true,\n state: { flush, empty },\n });\n\n if (view === \"agent\") {\n return (\n <AgentLine node={node}>\n {actions}\n {children}\n </AgentLine>\n );\n }\n\n const Label = headingLevel === undefined ? \"span\" : (`h${headingLevel}` as const);\n\n return (\n <section {...rest} {...agentAttributesFor(node)} aria-label={label}>\n <header>\n <Label>{label}</Label>\n {actions === undefined ? null : <span>{actions}</span>}\n </header>\n <div>{empty ? <span>{emptyLabel}</span> : children}</div>\n </section>\n );\n}\n","import { defineAgentMeta } from \"@/agent/registry.ts\";\n\nexport const secretFieldMeta = defineAgentMeta({\n name: \"SecretField\",\n category: \"display\",\n summary:\n \"A sensitive value shown once or on demand: an API key, a recovery code, a signing secret. Masked by default with reveal and copy controls, and the value never reaches any agent surface.\",\n whenToUse:\n \"Use to hand a person a secret the page holds. The mask is fixed-length so nothing leaks, and copy places the value on the clipboard without revealing it.\",\n whenNotToUse:\n \"Do not use for entering a secret; that is a TextInput with type password. Do not use for values that are safe to read; a DescriptionList or CodeBlock keeps those on the agent surface where they belong.\",\n status: \"experimental\",\n props: {\n label: {\n kind: \"string\",\n description: \"What the secret is, shown as the field's uppercase title.\",\n required: true,\n },\n value: {\n kind: \"string\",\n description:\n \"The secret. Never appears in agent attributes, the agent view, or the copyable text stream; only reveal and copy touch it.\",\n required: true,\n },\n hint: {\n kind: \"string\",\n description:\n 'Guidance below the value, e.g. \"Store it now. It is not shown again.\"',\n },\n defaultRevealed: {\n kind: \"boolean\",\n description: \"Start revealed instead of masked.\",\n default: false,\n },\n },\n state: {\n filled: {\n description: \"Present when the field holds a secret.\",\n attribute: \"data-sprint-filled\",\n },\n revealed: {\n description: \"Present while the value is shown in clear text.\",\n attribute: \"data-sprint-revealed\",\n },\n },\n agentView: {\n example: '- **SecretField** \"API key\" [filled]',\n },\n examples: [\n {\n title: \"A key shown once\",\n code: '<SecretField\\n label=\"API key\"\\n value={key}\\n hint=\"Store it now. It is not shown again.\"\\n/>',\n },\n {\n title: \"Starting revealed\",\n description: \"For a value the person is expected to transcribe immediately.\",\n code: '<SecretField label=\"Recovery code\" value={code} defaultRevealed />',\n },\n ],\n a11y: {\n notes:\n \"The reveal control is a toggle button with aria-pressed; the masked value is announced as a hidden secret rather than as bullet characters. Copy announces its success by swapping its label to Copied.\",\n },\n});\n","import { type ComponentPropsWithRef, useEffect, useState } from \"react\";\nimport { AgentLine } from \"@/agent/view/AgentText.tsx\";\nimport { useSprintView } from \"@/agent/view/mode.ts\";\nimport type { AgentPart } from \"@/agent/view/node.ts\";\nimport {\n agentAttributesFor,\n agentPartAttributesFor,\n buildAgentNode,\n} from \"@/agent/view/project.ts\";\nimport { secretFieldMeta } from \"./meta.ts\";\nimport \"./SecretField.css\";\n\nconst MASK = \"••••••••••••\";\nconst COPIED_FOR = 1200;\n\nexport interface SecretFieldProps extends ComponentPropsWithRef<\"div\"> {\n label: string;\n value: string;\n hint?: string;\n defaultRevealed?: boolean;\n}\n\nexport function SecretField(props: SecretFieldProps) {\n const { label, value, hint, defaultRevealed = false, ...rest } = props;\n\n const view = useSprintView();\n const [revealed, setRevealed] = useState(defaultRevealed);\n const [copied, setCopied] = useState(false);\n\n useEffect(() => {\n if (!copied) return;\n const timer = setTimeout(() => setCopied(false), COPIED_FOR);\n return () => clearTimeout(timer);\n }, [copied]);\n\n const copy = () => {\n const clipboard = navigator.clipboard;\n if (clipboard === undefined) return;\n clipboard.writeText(value).then(\n () => setCopied(true),\n () => setCopied(false),\n );\n };\n\n const filled = value !== \"\";\n\n const parts: AgentPart[] =\n hint === undefined ? [] : [{ part: \"hint\", label: hint, state: {} }];\n\n const node = buildAgentNode({\n component: secretFieldMeta.name,\n label,\n state: { filled, revealed },\n parts,\n });\n\n if (view === \"agent\") return <AgentLine node={node} />;\n\n return (\n <div {...rest} {...agentAttributesFor(node)}>\n <span {...agentPartAttributesFor({ part: \"label\", state: {} })}>{label}</span>\n <div {...agentPartAttributesFor({ part: \"control\", state: {} })}>\n <output\n {...agentPartAttributesFor({ part: \"value\", state: {} })}\n aria-label={revealed ? undefined : \"Hidden secret\"}\n >\n {revealed ? value : MASK}\n </output>\n <button\n {...agentPartAttributesFor({ part: \"reveal\", state: {} })}\n type=\"button\"\n aria-pressed={revealed}\n onClick={() => setRevealed((current) => !current)}\n >\n {revealed ? \"Hide\" : \"Reveal\"}\n </button>\n <button\n {...agentPartAttributesFor({\n part: \"copy\",\n state: copied ? { copied: true } : {},\n })}\n type=\"button\"\n onClick={copy}\n >\n {copied ? \"Copied\" : \"Copy\"}\n </button>\n </div>\n {hint === undefined ? null : (\n <p {...agentPartAttributesFor({ part: \"hint\", state: {} })}>{hint}</p>\n )}\n </div>\n );\n}\n","import type { AgentToolSpec } from \"@/agent/types.ts\";\n\nexport const SELECT_TOOL: AgentToolSpec = {\n verb: \"select\",\n description:\n \"Select one of this control's options by its visible label, exactly as a person clicking it would. Only one option is selected at a time, so this replaces the current one. Returns the control's state after the change, so a follow-up read is unnecessary.\",\n inputSchema: {\n type: \"object\",\n properties: {\n option: {\n type: \"string\",\n description:\n \"The visible label of the option to select, as shown on the control.\",\n },\n },\n required: [\"option\"],\n },\n readOnly: false,\n untrustedContent: true,\n registeredWhen:\n \"The control is mounted, enabled, has a resolvable label, and no other component claims the same tool name. The registered schema enumerates the current option labels.\",\n unregisteredWhen: \"The control unmounts or becomes disabled.\",\n};\n","import { defineAgentMeta } from \"@/agent/registry.ts\";\nimport { SELECT_TOOL } from \"./tool.ts\";\n\nexport const segmentedControlMeta = defineAgentMeta({\n name: \"SegmentedControl\",\n category: \"input\",\n summary:\n \"A short row of mutually exclusive options, all visible at once: a radio group that registers a single select tool whose schema enumerates the options currently on screen.\",\n whenToUse:\n \"Use it for two to four exclusive choices a person should be able to compare without opening anything: a view switch, a density setting, a filter. One tool with an enum beats one tool per option, and it keeps a page's tool count flat as options are added.\",\n whenNotToUse:\n \"Do not use it for more than about four options or for long labels; that is a select. Do not use it for an on/off setting, which is a switch, and never for navigation.\",\n status: \"experimental\",\n props: {\n label: {\n kind: \"string\",\n description:\n 'What is being chosen. Names the group for a screen reader and derives the tool name, so prefer a noun phrase such as \"Page view\".',\n required: true,\n },\n options: {\n kind: \"array\",\n description:\n \"The choices in display order: { value, label }. The label is what a person sees and what the select tool accepts, so an agent never has to know the value.\",\n required: true,\n },\n value: {\n kind: \"string\",\n description: \"The value of the selected option. The control is fully controlled.\",\n required: true,\n },\n onChange: {\n kind: \"handler\",\n description:\n \"Called with the newly selected value. The select tool drives a real click, so this runs for agent selections too.\",\n required: true,\n },\n disabled: {\n kind: \"boolean\",\n description: \"Disable every option and unregister the select tool.\",\n default: false,\n },\n agentName: {\n kind: \"string\",\n description:\n \"Override the label used to derive the tool name, when two controls on a page would otherwise collide.\",\n },\n agentTool: {\n kind: \"boolean\",\n description: \"Set false to render the control without registering a select tool.\",\n default: true,\n },\n },\n state: {\n value: {\n description: \"The value of the option currently selected.\",\n attribute: \"data-sprint-value\",\n },\n disabled: {\n description: \"Present when no option can be chosen.\",\n attribute: \"data-sprint-disabled\",\n },\n },\n tools: {\n select: SELECT_TOOL,\n },\n agentView: {\n example:\n '- **SegmentedControl** \"Page view\" [value=human] → tool `select-page-view`\\n - part `option` \"human\" [checked]\\n - part `option` \"agent\"',\n },\n examples: [\n {\n title: \"A view switch\",\n description:\n \"In agent view each option renders as its own control, so an agent driving the DOM can click one without WebMCP.\",\n code: '<SegmentedControl\\n label=\"Page view\"\\n value={view}\\n onChange={setView}\\n options={[\\n { value: \"human\", label: \"human\" },\\n { value: \"agent\", label: \"agent\" },\\n ]}\\n/>',\n },\n {\n title: \"A disabled control\",\n description:\n \"Disabled unregisters the tool, so an agent cannot select an option a person could not.\",\n code: '<SegmentedControl\\n label=\"Density\"\\n disabled\\n value=\"dense\"\\n onChange={setDensity}\\n options={[\\n { value: \"dense\", label: \"dense\" },\\n { value: \"roomy\", label: \"roomy\" },\\n ]}\\n/>',\n },\n ],\n a11y: {\n role: \"radiogroup\",\n keyboard: [\n \"Arrow keys move to the next or previous option and select it\",\n \"Home selects the first option\",\n \"End selects the last option\",\n \"Tab enters and leaves the group once\",\n ],\n notes:\n \"Roving tabindex: only the selected option is in the tab order. Selection follows focus, which is the expected behaviour for a radio group.\",\n },\n});\n","import {\n type ComponentPropsWithRef,\n type KeyboardEvent as ReactKeyboardEvent,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n} from \"react\";\nimport { AgentControlGroup, AgentLine } from \"@/agent/view/AgentText.tsx\";\nimport { useAgentControls, useAgentFormat, useSprintView } from \"@/agent/view/mode.ts\";\nimport type { AgentPart } from \"@/agent/view/node.ts\";\nimport {\n agentAttributesFor,\n agentPartAttributesFor,\n buildAgentNode,\n} from \"@/agent/view/project.ts\";\nimport { afterCommit } from \"@/agent/webmcp/afterCommit.ts\";\nimport { commitSync } from \"@/agent/webmcp/flush.ts\";\nimport type { JsonSchemaObject } from \"@/agent/webmcp/types.ts\";\nimport { useAgentTool } from \"@/agent/webmcp/useAgentTool.ts\";\nimport { segmentedControlMeta } from \"./meta.ts\";\nimport { SELECT_TOOL } from \"./tool.ts\";\nimport \"./SegmentedControl.css\";\n\nexport interface SegmentedOption {\n value: string;\n label: string;\n}\n\nexport interface SegmentedControlProps\n extends Omit<ComponentPropsWithRef<\"div\">, \"onChange\"> {\n label: string;\n options: readonly SegmentedOption[];\n value: string;\n onChange: (value: string) => void;\n disabled?: boolean;\n agentName?: string;\n agentTool?: boolean;\n}\n\nfunction optionSchema(options: readonly SegmentedOption[]): JsonSchemaObject {\n const option = SELECT_TOOL.inputSchema.properties.option;\n return {\n ...SELECT_TOOL.inputSchema,\n properties: {\n ...SELECT_TOOL.inputSchema.properties,\n ...(option === undefined\n ? {}\n : { option: { ...option, enum: options.map((entry) => entry.label) } }),\n },\n };\n}\n\nexport function SegmentedControl(props: SegmentedControlProps) {\n const {\n label,\n options,\n value,\n onChange,\n disabled = false,\n agentName,\n agentTool = true,\n ...rest\n } = props;\n\n const view = useSprintView();\n const controls = useAgentControls();\n const formatter = useAgentFormat();\n\n const elements = useRef(new Map<string, HTMLButtonElement>());\n const onChangeRef = useRef(onChange);\n onChangeRef.current = onChange;\n const optionsRef = useRef(options);\n optionsRef.current = options;\n const formatRef = useRef(formatter);\n formatRef.current = formatter;\n const nodeRef = useRef(buildAgentNode({ component: segmentedControlMeta.name }));\n const mounted = useRef(true);\n\n useEffect(() => {\n mounted.current = true;\n return () => {\n mounted.current = false;\n };\n }, []);\n\n const select = useCallback((next: string) => {\n const element = elements.current.get(next);\n if (element !== undefined) {\n element.click();\n return;\n }\n commitSync(() => onChangeRef.current(next));\n }, []);\n\n const execute = useCallback(\n async (inputs: Record<string, unknown>) => {\n const requested = typeof inputs.option === \"string\" ? inputs.option : \"\";\n const available = optionsRef.current;\n const match = available.find((entry) => entry.label === requested);\n\n if (match === undefined) {\n return `No option named \"${requested}\". This control offers: ${available\n .map((entry) => `\"${entry.label}\"`)\n .join(\", \")}.`;\n }\n\n select(match.value);\n await afterCommit();\n if (!mounted.current) return \"The selection removed this control from the page.\";\n return `Selected. The control is now:\\n${formatRef.current([nodeRef.current])}`;\n },\n [select],\n );\n\n const schema = useMemo(() => optionSchema(options), [options]);\n\n const toolName = useAgentTool({\n spec: SELECT_TOOL,\n label: agentName ?? label,\n inputSchema: schema,\n enabled: agentTool && !disabled,\n execute,\n });\n\n const parts: AgentPart[] = options.map((option) => ({\n part: \"option\",\n label: option.label,\n state: {\n ...(option.value === value ? { checked: true as const } : {}),\n ...(disabled ? { disabled: true as const } : {}),\n },\n }));\n\n const node = buildAgentNode({\n component: segmentedControlMeta.name,\n label,\n tool: toolName,\n state: { value, disabled },\n parts,\n });\n nodeRef.current = node;\n\n const move = (event: ReactKeyboardEvent<HTMLDivElement>) => {\n const keys = [\"ArrowRight\", \"ArrowDown\", \"ArrowLeft\", \"ArrowUp\", \"Home\", \"End\"];\n if (!keys.includes(event.key) || disabled) return;\n\n const current = options.findIndex((option) => option.value === value);\n const step = event.key === \"ArrowRight\" || event.key === \"ArrowDown\" ? 1 : -1;\n const next =\n event.key === \"Home\"\n ? 0\n : event.key === \"End\"\n ? options.length - 1\n : (current + step + options.length) % options.length;\n\n const target = options[next];\n if (target === undefined) return;\n\n event.preventDefault();\n elements.current.get(target.value)?.focus();\n select(target.value);\n };\n\n if (view === \"agent\") {\n if (disabled || controls === \"never\") return <AgentLine node={node} />;\n return (\n <AgentControlGroup\n node={node}\n onActivate={(_part, index) => {\n const target = options[index];\n if (target !== undefined) select(target.value);\n }}\n />\n );\n }\n\n return (\n <div\n {...rest}\n {...agentAttributesFor(node)}\n role=\"radiogroup\"\n aria-label={label}\n onKeyDown={move}\n >\n {options.map((option, index) => {\n const selected = option.value === value;\n const active = options.some((entry) => entry.value === value)\n ? selected\n : index === 0;\n return (\n <button\n key={option.value}\n type=\"button\"\n role=\"radio\"\n aria-checked={selected}\n tabIndex={active ? 0 : -1}\n disabled={disabled}\n ref={(element) => {\n if (element === null) elements.current.delete(option.value);\n else elements.current.set(option.value, element);\n }}\n {...agentPartAttributesFor(parts[index] ?? { part: \"option\", state: {} })}\n onClick={() => onChange(option.value)}\n >\n {option.label}\n </button>\n );\n })}\n </div>\n );\n}\n","import type { AgentToolSpec } from \"@/agent/types.ts\";\n\nexport const SELECT_OPTION_TOOL: AgentToolSpec = {\n verb: \"select\",\n description:\n \"Choose one of this dropdown's options by its visible label, exactly as a person opening it and clicking one would. Only one option is chosen at a time, so this replaces the current choice. Returns the dropdown's state after the change, so a follow-up read is unnecessary.\",\n inputSchema: {\n type: \"object\",\n properties: {\n option: {\n type: \"string\",\n description:\n \"The visible label of the option to choose, as a person reads it in the list.\",\n },\n },\n required: [\"option\"],\n },\n readOnly: false,\n untrustedContent: true,\n registeredWhen:\n \"The dropdown is mounted, enabled, has a resolvable label, and no other component claims the same tool name. The registered schema enumerates the current option labels.\",\n unregisteredWhen: \"The dropdown unmounts or becomes disabled.\",\n};\n","import { defineAgentMeta } from \"@/agent/registry.ts\";\nimport { SELECT_OPTION_TOOL } from \"./tool.ts\";\n\nexport const selectMeta = defineAgentMeta({\n name: \"Select\",\n category: \"input\",\n summary:\n \"A dropdown of mutually exclusive options behind a native select, carrying its own label, hint, and error. It registers a single select tool whose schema enumerates the option labels currently on offer.\",\n whenToUse:\n \"Use it when one value is chosen from a list too long to lay out flat: a region, a squad, a category. Options are data ({ value, label }), the tool accepts the visible label, and in agent view every option renders as its own control, so an agent picks one without opening anything.\",\n whenNotToUse:\n \"Do not use it for two to four short options a person should compare at a glance; that is a SegmentedControl. Do not use it for an on/off state, which is a Checkbox or a Switch, and never for navigation.\",\n status: \"experimental\",\n props: {\n label: {\n kind: \"string\",\n description:\n 'What is being chosen. Names the control for a screen reader and derives the tool name, so prefer a noun phrase such as \"Region\".',\n required: true,\n },\n options: {\n kind: \"array\",\n description:\n \"The choices in display order: { value, label }. The label is what a person sees and what the select tool accepts, so an agent never has to know the value.\",\n required: true,\n },\n value: {\n kind: \"string\",\n description:\n 'The value of the chosen option, or \"\" while nothing is chosen yet. The control is fully controlled.',\n required: true,\n },\n onChange: {\n kind: \"handler\",\n description:\n \"Called with the newly chosen value. The select tool drives a real change event, so this runs for agent selections too.\",\n required: true,\n },\n placeholder: {\n kind: \"string\",\n description:\n 'Shown while value is \"\". Rendered as a disabled option, so a person cannot choose it back.',\n },\n hint: {\n kind: \"string\",\n description:\n \"Guidance shown under the control and carried into the agent view. Replaced by error while one is set.\",\n },\n error: {\n kind: \"string\",\n description:\n \"A validation message. Marks the control invalid for people, screen readers, and agents alike.\",\n },\n name: {\n kind: \"string\",\n description: \"The native form name submitted with the surrounding form.\",\n },\n disabled: {\n kind: \"boolean\",\n description: \"Disable the control and unregister its select tool.\",\n default: false,\n },\n required: {\n kind: \"boolean\",\n description: \"Mark the control required, visually and in the agent view.\",\n default: false,\n },\n agentName: {\n kind: \"string\",\n description:\n \"Override the label used to derive the tool name, when two controls on a page would otherwise collide.\",\n },\n agentTool: {\n kind: \"boolean\",\n description: \"Set false to render the control without registering a select tool.\",\n default: true,\n },\n },\n state: {\n value: {\n description: \"The value of the option currently chosen.\",\n attribute: \"data-sprint-value\",\n },\n empty: {\n description: \"Present while no option is chosen.\",\n attribute: \"data-sprint-empty\",\n },\n disabled: {\n description: \"Present when nothing can be chosen.\",\n attribute: \"data-sprint-disabled\",\n },\n required: {\n description: \"Present when a choice must be made.\",\n attribute: \"data-sprint-required\",\n },\n invalid: {\n description: \"Present while an error is set.\",\n attribute: \"data-sprint-invalid\",\n },\n },\n tools: {\n select: SELECT_OPTION_TOOL,\n },\n agentView: {\n example:\n '- **Select** \"Region\" [value=eu-1] → tool `select-region`\\n - part `option` \"North Atlantic\"\\n - part `option` \"Northern Europe\" [checked]\\n - part `option` \"East Asia\"',\n },\n examples: [\n {\n title: \"A dropdown\",\n description:\n \"In agent view each option renders as its own control, so a DOM-driving agent chooses one directly.\",\n code: '<Select\\n label=\"Region\"\\n value={region}\\n onChange={setRegion}\\n placeholder=\"Choose a region\"\\n options={[\\n { value: \"na-1\", label: \"North Atlantic\" },\\n { value: \"eu-1\", label: \"Northern Europe\" },\\n { value: \"ap-1\", label: \"East Asia\" },\\n ]}\\n/>',\n },\n {\n title: \"A required choice with an error\",\n description:\n \"Empty plus required plus an error is how an unmade mandatory choice reads on every surface.\",\n code: '<Select\\n label=\"Launch site\"\\n value={site}\\n onChange={setSite}\\n required\\n error=\"Choose a site before continuing.\"\\n options={[\\n { value: \"ksc\", label: \"Cape Canaveral\" },\\n { value: \"vsfb\", label: \"Vandenberg\" },\\n ]}\\n/>',\n },\n {\n title: \"A disabled dropdown\",\n description:\n \"Disabled unregisters the tool, so an agent cannot choose what a person could not.\",\n code: '<Select\\n label=\"Relay\"\\n disabled\\n value=\"r-2\"\\n onChange={setRelay}\\n options={[\\n { value: \"r-1\", label: \"Relay one\" },\\n { value: \"r-2\", label: \"Relay two\" },\\n ]}\\n/>',\n },\n ],\n a11y: {\n role: \"combobox\",\n keyboard: [\n \"Arrow keys move through the options\",\n \"Enter or Space opens the list\",\n \"Escape closes it\",\n ],\n notes:\n \"A native select element, so the platform owns the listbox interaction. The label is associated via htmlFor; errors set aria-invalid and link with aria-describedby.\",\n },\n});\n","export function setFieldValue(\n element: HTMLInputElement | HTMLTextAreaElement,\n value: string,\n): void {\n const prototype =\n element instanceof HTMLTextAreaElement\n ? HTMLTextAreaElement.prototype\n : HTMLInputElement.prototype;\n const setter = Object.getOwnPropertyDescriptor(prototype, \"value\")?.set;\n if (setter === undefined) return;\n setter.call(element, value);\n element.dispatchEvent(new Event(\"input\", { bubbles: true }));\n}\n\nexport function setSelectValue(element: HTMLSelectElement, value: string): void {\n const setter = Object.getOwnPropertyDescriptor(\n HTMLSelectElement.prototype,\n \"value\",\n )?.set;\n if (setter === undefined) return;\n setter.call(element, value);\n element.dispatchEvent(new Event(\"change\", { bubbles: true }));\n}\n","import {\n type ComponentPropsWithRef,\n useCallback,\n useEffect,\n useId,\n useMemo,\n useRef,\n} from \"react\";\nimport { AgentControlGroup, AgentLine } from \"@/agent/view/AgentText.tsx\";\nimport { useAgentControls, useAgentFormat, useSprintView } from \"@/agent/view/mode.ts\";\nimport type { AgentPart } from \"@/agent/view/node.ts\";\nimport {\n agentAttributesFor,\n agentPartAttributesFor,\n buildAgentNode,\n} from \"@/agent/view/project.ts\";\nimport { afterCommit } from \"@/agent/webmcp/afterCommit.ts\";\nimport { setSelectValue } from \"@/agent/webmcp/drive.ts\";\nimport { commitSync } from \"@/agent/webmcp/flush.ts\";\nimport type { JsonSchemaObject } from \"@/agent/webmcp/types.ts\";\nimport { useAgentTool } from \"@/agent/webmcp/useAgentTool.ts\";\nimport { selectMeta } from \"./meta.ts\";\nimport { SELECT_OPTION_TOOL } from \"./tool.ts\";\nimport \"./Select.css\";\n\nexport interface SelectOption {\n value: string;\n label: string;\n}\n\nexport interface SelectProps extends Omit<ComponentPropsWithRef<\"div\">, \"onChange\"> {\n label: string;\n options: readonly SelectOption[];\n value: string;\n onChange: (value: string) => void;\n placeholder?: string;\n hint?: string;\n error?: string;\n name?: string;\n disabled?: boolean;\n required?: boolean;\n agentName?: string;\n agentTool?: boolean;\n}\n\nfunction optionSchema(options: readonly SelectOption[]): JsonSchemaObject {\n const option = SELECT_OPTION_TOOL.inputSchema.properties.option;\n return {\n ...SELECT_OPTION_TOOL.inputSchema,\n properties: {\n ...SELECT_OPTION_TOOL.inputSchema.properties,\n ...(option === undefined\n ? {}\n : { option: { ...option, enum: options.map((entry) => entry.label) } }),\n },\n };\n}\n\nfunction messagePart(error: string | undefined, hint: string | undefined): AgentPart[] {\n if (error !== undefined) return [{ part: \"error\", label: error, state: {} }];\n if (hint !== undefined) return [{ part: \"hint\", label: hint, state: {} }];\n return [];\n}\n\nexport function Select(props: SelectProps) {\n const {\n label,\n options,\n value,\n onChange,\n placeholder,\n hint,\n error,\n name,\n disabled = false,\n required = false,\n agentName,\n agentTool = true,\n ...rest\n } = props;\n\n const view = useSprintView();\n const controls = useAgentControls();\n const formatter = useAgentFormat();\n const id = useId();\n\n const element = useRef<HTMLSelectElement | null>(null);\n const onChangeRef = useRef(onChange);\n onChangeRef.current = onChange;\n const optionsRef = useRef(options);\n optionsRef.current = options;\n const formatRef = useRef(formatter);\n formatRef.current = formatter;\n const nodeRef = useRef(buildAgentNode({ component: selectMeta.name }));\n const mounted = useRef(true);\n\n useEffect(() => {\n mounted.current = true;\n return () => {\n mounted.current = false;\n };\n }, []);\n\n const choose = useCallback((next: string) => {\n const target = element.current;\n if (target !== null) {\n setSelectValue(target, next);\n return;\n }\n commitSync(() => onChangeRef.current(next));\n }, []);\n\n const execute = useCallback(\n async (inputs: Record<string, unknown>) => {\n const requested = typeof inputs.option === \"string\" ? inputs.option : \"\";\n const available = optionsRef.current;\n const match = available.find((entry) => entry.label === requested);\n\n if (match === undefined) {\n return `No option named \"${requested}\". This dropdown offers: ${available\n .map((entry) => `\"${entry.label}\"`)\n .join(\", \")}.`;\n }\n\n choose(match.value);\n await afterCommit();\n if (!mounted.current) return \"The selection removed this dropdown from the page.\";\n return `Selected. The dropdown is now:\\n${formatRef.current([nodeRef.current])}`;\n },\n [choose],\n );\n\n const schema = useMemo(() => optionSchema(options), [options]);\n\n const toolName = useAgentTool({\n spec: SELECT_OPTION_TOOL,\n label: agentName ?? label,\n inputSchema: schema,\n enabled: agentTool && !disabled,\n execute,\n });\n\n const chosen = options.find((option) => option.value === value);\n\n const optionParts: AgentPart[] = options.map((option) => ({\n part: \"option\",\n label: option.label,\n state: {\n ...(option.value === value ? { checked: true as const } : {}),\n ...(disabled ? { disabled: true as const } : {}),\n },\n }));\n\n const node = buildAgentNode({\n component: selectMeta.name,\n label,\n tool: toolName,\n state: {\n ...(chosen === undefined ? {} : { value }),\n empty: chosen === undefined,\n disabled,\n required,\n invalid: error !== undefined,\n },\n parts: [...optionParts, ...messagePart(error, hint)],\n });\n nodeRef.current = node;\n\n if (view === \"agent\") {\n if (disabled || controls === \"never\") return <AgentLine node={node} />;\n return (\n <AgentControlGroup\n node={node}\n isActionable={(part) => part.part === \"option\"}\n onActivate={(_part, index) => {\n const target = options[index];\n if (target !== undefined) choose(target.value);\n }}\n />\n );\n }\n\n const messageId =\n error !== undefined ? `${id}-error` : hint !== undefined ? `${id}-hint` : undefined;\n\n return (\n <div {...rest} {...agentAttributesFor(node)}>\n <label htmlFor={id}>{label}</label>\n <span {...agentPartAttributesFor({ part: \"control\", state: {} })}>\n <select\n id={id}\n {...agentPartAttributesFor({ part: \"input\", state: {} })}\n ref={(target) => {\n element.current = target;\n }}\n value={chosen === undefined ? \"\" : value}\n name={name}\n disabled={disabled}\n required={required}\n aria-invalid={error !== undefined || undefined}\n aria-describedby={messageId}\n onChange={(event) => onChange(event.currentTarget.value)}\n >\n {chosen === undefined ? (\n <option value=\"\" disabled>\n {placeholder ?? \"Choose\"}\n </option>\n ) : null}\n {options.map((option, index) => (\n <option\n key={option.value}\n value={option.value}\n {...agentPartAttributesFor(\n optionParts[index] ?? { part: \"option\", state: {} },\n )}\n >\n {option.label}\n </option>\n ))}\n </select>\n </span>\n {error !== undefined ? (\n <p id={messageId} {...agentPartAttributesFor({ part: \"error\", state: {} })}>\n {error}\n </p>\n ) : hint !== undefined ? (\n <p id={messageId} {...agentPartAttributesFor({ part: \"hint\", state: {} })}>\n {hint}\n </p>\n ) : null}\n </div>\n );\n}\n","import { defineAgentMeta } from \"@/agent/registry.ts\";\n\nexport const shellMeta = defineAgentMeta({\n name: \"Shell\",\n category: \"layout\",\n summary:\n \"The page-level frame: a sidebar and a main content region, with the landmark wiring done once. On a phone the sidebar becomes a drawer behind a menu button.\",\n whenToUse:\n \"Use it once, at the root of an app view. Put the brand in bar, a Nav in side, and the page in children. It renders the main and complementary landmarks, a skip-to-content control for keyboard users, and the mobile drawer behaviour, so none of that is rebuilt per app. Like Stack it is silent in agent view: its regions speak for themselves.\",\n whenNotToUse:\n \"Do not use it inside another Shell, or anywhere below the top of the page; a region within a page is a Panel. Do not use it just to put two columns next to each other; that is Stack.\",\n status: \"experimental\",\n props: {\n children: {\n kind: \"node\",\n description: \"The page content. Rendered inside the main landmark.\",\n required: true,\n },\n side: {\n kind: \"node\",\n description:\n \"The sidebar content, usually a Nav. On narrow viewports it becomes the drawer behind the menu button, and the drawer closes itself when a link inside it is followed.\",\n },\n bar: {\n kind: \"node\",\n description:\n \"What stays visible when the sidebar collapses to a top bar: typically the brand link. The menu button renders next to it automatically.\",\n },\n sideLabel: {\n kind: \"string\",\n description: \"Accessible name for the sidebar landmark.\",\n default: \"Sidebar\",\n },\n skipLabel: {\n kind: \"string\",\n description:\n \"Text of the skip control that moves focus to the main region. Visually hidden until focused.\",\n default: \"Skip to content\",\n },\n menuLabel: {\n kind: \"string\",\n description: \"Label of the drawer button while the drawer is closed.\",\n default: \"Menu\",\n },\n closeLabel: {\n kind: \"string\",\n description: \"Label of the drawer button while the drawer is open.\",\n default: \"Close\",\n },\n },\n state: {\n open: {\n description:\n \"Present while the mobile drawer is open. On wide viewports the sidebar is always visible and this state is inert.\",\n attribute: \"data-sprint-open\",\n },\n },\n a11y: {\n notes:\n \"Renders the only main element and an aside named by sideLabel, so the page has its landmarks without any consumer wiring. The first focusable element is a skip control that moves focus to main without touching the URL, which keeps it safe in hash-routed apps. The drawer button carries aria-expanded and aria-controls.\",\n },\n relatedComponents: [\"Nav\", \"Panel\", \"Stack\"],\n examples: [\n {\n title: \"A sidebar app shell\",\n description:\n \"One Shell per view. The sidebar collapses to a top bar with a drawer on narrow screens, and an agent reading the page sees the nav and the content with no frame in between.\",\n code: '<Shell\\n bar={<Link href=\"#/\">ACME</Link>}\\n side={\\n <Nav label=\"Main\">\\n <Link href=\"#/reports\" active>Reports</Link>\\n <Link href=\"#/settings\">Settings</Link>\\n </Nav>\\n }\\n>\\n <Panel label=\"Reports\" headingLevel={2}>\\n <Text>Quarterly numbers land here.</Text>\\n </Panel>\\n</Shell>',\n },\n ],\n});\n","import {\n type ComponentPropsWithRef,\n type MouseEvent,\n type ReactNode,\n useCallback,\n useId,\n useRef,\n useState,\n} from \"react\";\nimport { useSprintView } from \"@/agent/view/mode.ts\";\nimport { agentAttributesFor, buildAgentNode } from \"@/agent/view/project.ts\";\nimport { Button } from \"../Button/index.ts\";\nimport { shellMeta } from \"./meta.ts\";\nimport \"./Shell.css\";\n\nexport interface ShellProps extends ComponentPropsWithRef<\"div\"> {\n side?: ReactNode;\n bar?: ReactNode;\n sideLabel?: string;\n skipLabel?: string;\n menuLabel?: string;\n closeLabel?: string;\n}\n\nexport function Shell(props: ShellProps) {\n const {\n side,\n bar,\n sideLabel = \"Sidebar\",\n skipLabel = \"Skip to content\",\n menuLabel = \"Menu\",\n closeLabel = \"Close\",\n children,\n ...rest\n } = props;\n\n const view = useSprintView();\n const [open, setOpen] = useState(false);\n const drawerId = useId();\n const main = useRef<HTMLElement | null>(null);\n\n const closeOnNavigate = useCallback((event: MouseEvent<HTMLDivElement>) => {\n const target = event.target;\n if (target instanceof Element && target.closest(\"a\") !== null) setOpen(false);\n }, []);\n\n const node = buildAgentNode({\n component: shellMeta.name,\n region: true,\n state: { open },\n });\n\n if (view === \"agent\") {\n return (\n <>\n {bar}\n {side}\n {children}\n </>\n );\n }\n\n return (\n <div {...rest} {...agentAttributesFor(node)}>\n <button type=\"button\" onClick={() => main.current?.focus()}>\n {skipLabel}\n </button>\n <aside aria-label={sideLabel}>\n <div>\n {bar}\n <span>\n <Button\n agentTool={false}\n aria-expanded={open}\n aria-controls={drawerId}\n onClick={() => setOpen(!open)}\n >\n {open ? closeLabel : menuLabel}\n </Button>\n </span>\n </div>\n {/* biome-ignore lint/a11y/useKeyWithClickEvents: closing the drawer after a click on a link inside it; the links handle their own keyboard interaction */}\n {/* biome-ignore lint/a11y/noStaticElementInteractions: same delegation, the div itself is not a control */}\n <div id={drawerId} onClick={closeOnNavigate}>\n {side}\n </div>\n </aside>\n <main ref={main} tabIndex={-1}>\n {children}\n </main>\n </div>\n );\n}\n","import { defineAgentMeta } from \"@/agent/registry.ts\";\n\nexport const stackMeta = defineAgentMeta({\n name: \"Stack\",\n category: \"layout\",\n summary:\n \"The one-dimensional layout primitive: a row, a column, or an auto-filling grid, with spacing drawn from the space scale. It renders a plain box and nothing else.\",\n whenToUse:\n \"Use it wherever two or more things sit next to each other. Prefer it over a bare div with inline styles so spacing stays on the scale. Stack is invisible in agent view: it emits no line, because an agent does not care how a region is arranged, only what is in it.\",\n whenNotToUse:\n 'Do not use it to draw a bordered region with a header; that is Panel. Do not nest three deep to fake a grid; use direction=\"grid\".',\n status: \"experimental\",\n props: {\n children: {\n kind: \"node\",\n description: \"The items to lay out.\",\n required: true,\n },\n direction: {\n kind: \"enum\",\n description:\n 'Axis. \"grid\" fills as many equal columns as fit, each at least min wide.',\n values: [\"row\", \"column\", \"grid\"],\n default: \"column\",\n },\n gap: {\n kind: \"enum\",\n description: \"Space between items, from the space scale.\",\n values: [\"none\", \"tight\", \"normal\", \"loose\"],\n default: \"normal\",\n },\n align: {\n kind: \"enum\",\n description: \"Cross-axis alignment.\",\n values: [\"start\", \"center\", \"end\", \"stretch\", \"baseline\"],\n },\n justify: {\n kind: \"enum\",\n description: \"Main-axis distribution.\",\n values: [\"start\", \"center\", \"end\", \"between\"],\n },\n wrap: {\n kind: \"boolean\",\n description: \"Let a row wrap onto more lines instead of overflowing.\",\n default: false,\n },\n collapse: {\n kind: \"boolean\",\n description:\n \"Stack a row into a column on narrow viewports. This is how a toolbar survives a phone.\",\n default: false,\n },\n min: {\n kind: \"string\",\n description:\n 'Minimum track width for direction=\"grid\", as a CSS length. Tracks never exceed the container.',\n default: \"18rem\",\n },\n },\n state: {\n direction: {\n description: \"The axis in use.\",\n attribute: \"data-sprint-direction\",\n values: [\"row\", \"column\", \"grid\"],\n },\n gap: {\n description: \"The spacing step in use.\",\n attribute: \"data-sprint-gap\",\n values: [\"none\", \"tight\", \"normal\", \"loose\"],\n },\n align: {\n description: \"Cross-axis alignment, when one was asked for.\",\n attribute: \"data-sprint-align\",\n values: [\"start\", \"center\", \"end\", \"stretch\", \"baseline\"],\n },\n justify: {\n description: \"Main-axis distribution, when one was asked for.\",\n attribute: \"data-sprint-justify\",\n values: [\"start\", \"center\", \"end\", \"between\"],\n },\n wrap: {\n description: \"Present when a row is allowed to wrap.\",\n attribute: \"data-sprint-wrap\",\n },\n collapse: {\n description: \"Present when the row stacks into a column on narrow viewports.\",\n attribute: \"data-sprint-collapse\",\n },\n },\n examples: [\n {\n title: \"A row of actions\",\n description: \"Wrapping keeps a toolbar from overflowing on a narrow screen.\",\n code: '<Stack direction=\"row\" gap=\"tight\" wrap>\\n <Button>Cancel</Button>\\n <Button tone=\"action\">Confirm</Button>\\n</Stack>',\n },\n {\n title: \"A responsive card grid\",\n description:\n \"Tracks fill the container and never go below min, so this is one column on a phone and three on a desktop with no media query of your own.\",\n code: '<Stack direction=\"grid\" min=\"16rem\">\\n <Card label=\"Button\" href=\"#/Button\">One action.</Card>\\n <Card label=\"Table\" href=\"#/Table\">Rows and columns.</Card>\\n</Stack>',\n },\n {\n title: \"A header bar that stacks on a phone\",\n code: '<Stack direction=\"row\" justify=\"between\" align=\"center\" collapse>\\n <Heading level={1}>Button</Heading>\\n <Tag tone=\"warning\">experimental</Tag>\\n</Stack>',\n },\n ],\n});\n","import type { ComponentPropsWithRef, CSSProperties } from \"react\";\nimport { useSprintView } from \"@/agent/view/mode.ts\";\nimport { agentAttributesFor, buildAgentNode } from \"@/agent/view/project.ts\";\nimport { stackMeta } from \"./meta.ts\";\nimport \"./Stack.css\";\n\nexport type StackDirection = \"row\" | \"column\" | \"grid\";\nexport type StackGap = \"none\" | \"tight\" | \"normal\" | \"loose\";\nexport type StackAlign = \"start\" | \"center\" | \"end\" | \"stretch\" | \"baseline\";\nexport type StackJustify = \"start\" | \"center\" | \"end\" | \"between\";\n\nexport interface StackProps extends ComponentPropsWithRef<\"div\"> {\n direction?: StackDirection;\n gap?: StackGap;\n align?: StackAlign;\n justify?: StackJustify;\n wrap?: boolean;\n collapse?: boolean;\n min?: string;\n}\n\nexport function Stack(props: StackProps) {\n const {\n direction = \"column\",\n gap = \"normal\",\n align,\n justify,\n wrap = false,\n collapse = false,\n min,\n children,\n style,\n ...rest\n } = props;\n\n const view = useSprintView();\n\n const node = buildAgentNode({\n component: stackMeta.name,\n state: { direction, gap, align, justify, wrap, collapse },\n });\n\n if (view === \"agent\") return <>{children}</>;\n\n const sizing =\n min === undefined\n ? style\n : ({ ...style, \"--sprint-stack-min\": min } as CSSProperties);\n\n return (\n <div {...rest} {...agentAttributesFor(node)} style={sizing}>\n {children}\n </div>\n );\n}\n","import type { AgentToolSpec } from \"@/agent/types.ts\";\n\nexport const SET_SWITCH_TOOL: AgentToolSpec = {\n verb: \"set\",\n description:\n \"Switch this setting on or off by stating the end state, exactly as a person clicking it would. The change takes effect immediately. Setting the state it already has succeeds and changes nothing, so the call is safe to retry. Returns the switch's state after the call.\",\n inputSchema: {\n type: \"object\",\n properties: {\n on: {\n type: \"boolean\",\n description: \"The end state: true leaves the switch on, false leaves it off.\",\n },\n },\n required: [\"on\"],\n },\n readOnly: false,\n untrustedContent: true,\n registeredWhen:\n \"The switch is mounted, enabled, has a resolvable label, and no other component claims the same tool name.\",\n unregisteredWhen: \"The switch unmounts or becomes disabled.\",\n};\n","import { defineAgentMeta } from \"@/agent/registry.ts\";\nimport { SET_SWITCH_TOOL } from \"./tool.ts\";\n\nexport const switchMeta = defineAgentMeta({\n name: \"Switch\",\n category: \"input\",\n summary:\n \"An on/off setting that takes effect the moment it changes. It registers one set tool that takes the end state rather than toggling.\",\n whenToUse:\n \"Use it for a live setting: enabling telemetry, muting alerts, switching a feed. The set tool takes on as true or false, so an agent states the end state and never has to read before writing.\",\n whenNotToUse:\n \"Do not use it for a boolean a form will submit later; that is a Checkbox, and the distinction is when the change takes effect. Do not use it to choose between two named modes a person should see side by side, which is a SegmentedControl.\",\n status: \"experimental\",\n props: {\n label: {\n kind: \"string\",\n description:\n 'What the setting controls. Names the switch for a screen reader and derives the tool name, so prefer a noun phrase such as \"Live telemetry\".',\n required: true,\n },\n on: {\n kind: \"boolean\",\n description: \"Whether the setting is on. The switch is fully controlled.\",\n required: true,\n },\n onChange: {\n kind: \"handler\",\n description:\n \"Called with the new state. The set tool drives a real click, so this runs for agent changes too.\",\n required: true,\n },\n disabled: {\n kind: \"boolean\",\n description: \"Disable the switch and unregister its set tool.\",\n default: false,\n },\n agentName: {\n kind: \"string\",\n description:\n \"Override the label used to derive the tool name, when two switches on a page would otherwise collide.\",\n },\n agentTool: {\n kind: \"boolean\",\n description: \"Set false to render the switch without registering a set tool.\",\n default: true,\n },\n },\n state: {\n on: {\n description: \"Present while the setting is on.\",\n attribute: \"data-sprint-on\",\n },\n disabled: {\n description: \"Present when the switch cannot be changed.\",\n attribute: \"data-sprint-disabled\",\n },\n },\n tools: {\n set: SET_SWITCH_TOOL,\n },\n agentView: {\n example: '- **Switch** \"Live telemetry\" [on] → tool `set-live-telemetry`',\n },\n examples: [\n {\n title: \"A live setting\",\n description:\n \"In agent view the switch renders as one control; pressing it toggles, while the set tool states the end state.\",\n code: '<Switch label=\"Live telemetry\" on={telemetry} onChange={setTelemetry} />',\n },\n {\n title: \"A disabled switch\",\n description:\n \"Disabled unregisters the tool, so an agent cannot change what a person could not.\",\n code: '<Switch label=\"Ground link\" on disabled onChange={setLink} />',\n },\n ],\n a11y: {\n role: \"switch\",\n keyboard: [\"Space toggles\", \"Enter toggles\"],\n notes:\n \"A button with role switch and aria-checked, so the label and state read together. The thumb moves by a single-axis stepped translation and respects prefers-reduced-motion.\",\n },\n});\n","import { type ComponentPropsWithRef, useCallback, useEffect, useRef } from \"react\";\nimport { AgentControl, AgentLine } from \"@/agent/view/AgentText.tsx\";\nimport { useAgentControls, useAgentFormat, useSprintView } from \"@/agent/view/mode.ts\";\nimport {\n agentAttributesFor,\n agentPartAttributesFor,\n buildAgentNode,\n} from \"@/agent/view/project.ts\";\nimport { afterCommit } from \"@/agent/webmcp/afterCommit.ts\";\nimport { commitSync } from \"@/agent/webmcp/flush.ts\";\nimport { useAgentTool } from \"@/agent/webmcp/useAgentTool.ts\";\nimport { switchMeta } from \"./meta.ts\";\nimport { SET_SWITCH_TOOL } from \"./tool.ts\";\nimport \"./Switch.css\";\n\nexport interface SwitchProps\n extends Omit<ComponentPropsWithRef<\"button\">, \"onChange\" | \"children\"> {\n label: string;\n on: boolean;\n onChange: (on: boolean) => void;\n agentName?: string;\n agentTool?: boolean;\n}\n\nexport function Switch(props: SwitchProps) {\n const {\n label,\n on,\n onChange,\n disabled = false,\n agentName,\n agentTool = true,\n ref,\n ...rest\n } = props;\n\n const view = useSprintView();\n const controls = useAgentControls();\n const formatter = useAgentFormat();\n\n const element = useRef<HTMLButtonElement | null>(null);\n const setRef = useCallback(\n (target: HTMLButtonElement | null) => {\n element.current = target;\n if (typeof ref === \"function\") ref(target);\n else if (ref !== null && ref !== undefined) ref.current = target;\n },\n [ref],\n );\n\n const onChangeRef = useRef(onChange);\n onChangeRef.current = onChange;\n const onRef = useRef(on);\n onRef.current = on;\n const formatRef = useRef(formatter);\n formatRef.current = formatter;\n const nodeRef = useRef(buildAgentNode({ component: switchMeta.name }));\n const mounted = useRef(true);\n\n useEffect(() => {\n mounted.current = true;\n return () => {\n mounted.current = false;\n };\n }, []);\n\n const execute = useCallback(async (inputs: Record<string, unknown>) => {\n const desired = inputs.on;\n if (typeof desired !== \"boolean\") {\n return 'Pass \"on\" as true or false; it states the end state.';\n }\n\n const already = desired === onRef.current;\n if (!already) {\n const target = element.current;\n if (target !== null) target.click();\n else commitSync(() => onChangeRef.current(desired));\n }\n\n await afterCommit();\n if (!mounted.current) return \"The change removed this switch from the page.\";\n const outcome = already\n ? `Already ${desired ? \"on\" : \"off\"}`\n : `Switched ${desired ? \"on\" : \"off\"}`;\n return `${outcome}. The switch is now:\\n${formatRef.current([nodeRef.current])}`;\n }, []);\n\n const toolName = useAgentTool({\n spec: SET_SWITCH_TOOL,\n label: agentName ?? label,\n enabled: agentTool && !disabled,\n execute,\n });\n\n const node = buildAgentNode({\n component: switchMeta.name,\n label,\n tool: toolName,\n state: { on, disabled },\n });\n nodeRef.current = node;\n\n if (view === \"agent\") {\n if (disabled || controls === \"never\") return <AgentLine node={node} />;\n return <AgentControl node={node} ref={setRef} onClick={() => onChange(!on)} />;\n }\n\n return (\n <button\n {...rest}\n {...agentAttributesFor(node)}\n type=\"button\"\n role=\"switch\"\n aria-checked={on}\n disabled={disabled}\n ref={setRef}\n onClick={() => onChange(!on)}\n >\n <span\n {...agentPartAttributesFor({ part: \"track\", state: {} })}\n aria-hidden=\"true\"\n >\n <span {...agentPartAttributesFor({ part: \"thumb\", state: {} })} />\n </span>\n {label}\n </button>\n );\n}\n","import { defineAgentMeta } from \"@/agent/registry.ts\";\n\nexport const tableMeta = defineAgentMeta({\n name: \"Table\",\n category: \"display\",\n summary:\n \"A data grid built from columns and rows rather than from markup. In the agent stream it reads as a compact Markdown table; in the DOM each cell is addressable as a part carrying its column and row. On a narrow screen every row restacks into a labelled block instead of scrolling sideways.\",\n whenToUse:\n \"Use it for any set of records with the same shape: props, attributes, conventions, results. Passing data instead of children is what lets the agent view carry the cells and the human view restack them on a phone.\",\n whenNotToUse:\n \"Do not use it for page layout; that is Stack. Do not put components in cells: cells are flattened to text for the agent view, so a Button inside one would lose its tool.\",\n status: \"experimental\",\n props: {\n label: {\n kind: \"string\",\n description:\n \"What this table is a table of. Used as its accessible name and read back by the agent view.\",\n required: true,\n },\n columns: {\n kind: \"array\",\n description:\n \"Column definitions, in display order: { key, header, align?, width? }. The key addresses the cell in each row and appears on the cell as data-sprint-column.\",\n required: true,\n },\n rows: {\n kind: \"array\",\n description:\n \"Rows in display order: { id?, cells }, where cells maps a column key to inline content. id names the row for an agent and defaults to its 1-based position.\",\n required: true,\n },\n emptyLabel: {\n kind: \"string\",\n description: \"What the table says when it has no rows.\",\n default: \"No rows\",\n },\n },\n state: {\n columns: {\n description: \"How many columns the table has.\",\n attribute: \"data-sprint-columns\",\n },\n rows: {\n description: \"How many rows the table currently has.\",\n attribute: \"data-sprint-rows\",\n },\n empty: {\n description: \"Present when the table has no rows.\",\n attribute: \"data-sprint-empty\",\n },\n column: {\n description: \"On a cell: which column it belongs to.\",\n attribute: \"data-sprint-column\",\n },\n row: {\n description: \"On a cell: which row it belongs to.\",\n attribute: \"data-sprint-row\",\n },\n align: {\n description: \"On a cell: the alignment its column asked for, if any.\",\n attribute: \"data-sprint-align\",\n values: [\"start\", \"end\"],\n },\n },\n agentView: {\n example:\n '- **Table** \"Props\" [columns=2, rows=1]\\n | row | prop | kind |\\n | --- | --- | --- |\\n | tone | tone | enum |',\n },\n examples: [\n {\n title: \"A reference table\",\n description:\n 'Cells are addressable: [data-sprint-part=\"cell\"][data-sprint-column=\"kind\"] selects a column without knowing anything about the markup.',\n code: '<Table\\n label=\"Props\"\\n columns={[\\n { key: \"prop\", header: \"Prop\" },\\n { key: \"kind\", header: \"Kind\" },\\n ]}\\n rows={[{ id: \"tone\", cells: { prop: <code>tone</code>, kind: \"enum\" } }]}\\n/>',\n },\n {\n title: \"A table with no rows\",\n description:\n \"An empty table keeps its header and says so, rather than rendering a bare keyline.\",\n code: '<Table\\n label=\"Registered tools\"\\n emptyLabel=\"No tools registered\"\\n columns={[{ key: \"name\", header: \"Name\" }]}\\n rows={[]}\\n/>',\n },\n ],\n a11y: {\n role: \"table\",\n notes:\n \"Column headers keep scope=col in every layout. On narrow screens each cell repeats its column header visually, marked aria-hidden so the real header association is not announced twice.\",\n },\n});\n","import type { ComponentPropsWithRef, ReactNode } from \"react\";\nimport { AgentLine } from \"@/agent/view/AgentText.tsx\";\nimport { useSprintView } from \"@/agent/view/mode.ts\";\nimport type { AgentPart } from \"@/agent/view/node.ts\";\nimport {\n agentAttributesFor,\n agentPartAttributesFor,\n buildAgentNode,\n} from \"@/agent/view/project.ts\";\nimport { condenseCells } from \"@/agent/view/tabular.ts\";\nimport { reactText } from \"@/agent/view/text.ts\";\nimport { tableMeta } from \"./meta.ts\";\nimport \"./Table.css\";\n\nexport interface TableColumn {\n key: string;\n header: string;\n align?: \"start\" | \"end\";\n width?: string;\n}\n\nexport interface TableRow {\n id?: string;\n cells: Record<string, ReactNode>;\n}\n\nexport interface TableProps extends ComponentPropsWithRef<\"table\"> {\n label: string;\n columns: readonly TableColumn[];\n rows: readonly TableRow[];\n emptyLabel?: string;\n}\n\nfunction rowId(row: TableRow, index: number): string {\n return row.id ?? String(index + 1);\n}\n\nfunction cellState(column: TableColumn, row: string): Record<string, string> {\n return {\n column: column.key,\n row,\n ...(column.align === undefined ? {} : { align: column.align }),\n };\n}\n\nfunction cellParts(\n columns: readonly TableColumn[],\n rows: readonly TableRow[],\n): AgentPart[] {\n return rows.flatMap((row, index) =>\n columns.map((column) => {\n const label = reactText(row.cells[column.key]);\n return {\n part: \"cell\",\n state: cellState(column, rowId(row, index)),\n ...(label === undefined ? {} : { label }),\n };\n }),\n );\n}\n\nexport function Table(props: TableProps) {\n const { label, columns, rows, emptyLabel = \"No rows\", ...rest } = props;\n\n const view = useSprintView();\n const empty = rows.length === 0;\n\n const node = buildAgentNode({\n component: tableMeta.name,\n label,\n state: {\n columns: String(columns.length),\n rows: String(rows.length),\n empty,\n },\n parts: cellParts(columns, rows),\n });\n\n if (view === \"agent\") return <AgentLine node={condenseCells(node)} />;\n\n return (\n <table {...rest} {...agentAttributesFor(node)} role=\"table\" aria-label={label}>\n <thead role=\"rowgroup\">\n <tr role=\"row\">\n {columns.map((column) => (\n <th\n key={column.key}\n role=\"columnheader\"\n scope=\"col\"\n data-sprint-column={column.key}\n style={column.width === undefined ? undefined : { width: column.width }}\n >\n {column.header}\n </th>\n ))}\n </tr>\n </thead>\n <tbody role=\"rowgroup\">\n {empty ? (\n <tr role=\"row\">\n <td role=\"cell\" colSpan={columns.length}>\n <span>{emptyLabel}</span>\n </td>\n </tr>\n ) : (\n rows.map((row, index) => (\n <tr key={rowId(row, index)} role=\"row\">\n {columns.map((column) => (\n <td\n key={column.key}\n role=\"cell\"\n {...agentPartAttributesFor({\n part: \"cell\",\n state: cellState(column, rowId(row, index)),\n })}\n >\n <span aria-hidden=\"true\">{column.header}</span>\n <div>{row.cells[column.key]}</div>\n </td>\n ))}\n </tr>\n ))\n )}\n </tbody>\n </table>\n );\n}\n","import { defineAgentMeta } from \"@/agent/registry.ts\";\n\nexport const tagMeta = defineAgentMeta({\n name: \"Tag\",\n category: \"display\",\n summary:\n \"A small chip that classifies the thing next to it: a status, a category, a count, a build string.\",\n whenToUse:\n \"Use it for a short classification a person scans and an agent reads off the tone attribute, such as a release status, a read-only or write marker on a tool, or a version chip.\",\n whenNotToUse:\n \"Do not use it for anything clickable; a Tag is inert, and a chip that acts is a Button. Do not put a sentence in one.\",\n status: \"experimental\",\n props: {\n children: {\n kind: \"node\",\n description: \"The chip text. One or two words.\",\n required: true,\n },\n tone: {\n kind: \"enum\",\n description:\n \"What class of thing this is. Acid is rationed, so reach for info or inert before action.\",\n values: [\"neutral\", \"action\", \"danger\", \"info\", \"warning\", \"inert\"],\n default: \"neutral\",\n },\n filled: {\n kind: \"boolean\",\n description:\n \"Render as a solid field of the tone with inverted ink, instead of a keyline. Use for the one chip that must be read first.\",\n default: false,\n },\n },\n state: {\n tone: {\n description: \"The class of thing the chip marks.\",\n attribute: \"data-sprint-tone\",\n values: [\"neutral\", \"action\", \"danger\", \"info\", \"warning\", \"inert\"],\n },\n filled: {\n description: \"Present when the chip is a solid field rather than a keyline.\",\n attribute: \"data-sprint-filled\",\n },\n },\n agentView: {\n example: '- **Tag** \"experimental\" [filled, tone=warning]',\n },\n examples: [\n {\n title: \"A release status\",\n code: '<Tag tone=\"warning\" filled>experimental</Tag>',\n },\n {\n title: \"A category chip\",\n code: \"<Tag>action</Tag>\",\n },\n {\n title: \"Read-only against changes-state\",\n description:\n \"Two tones doing the work a legend would otherwise have to do in prose.\",\n code: '<Tag tone={tool.readOnly ? \"info\" : \"danger\"}>\\n {tool.readOnly ? \"read only\" : \"changes state\"}\\n</Tag>',\n },\n ],\n});\n","import type { ComponentPropsWithRef } from \"react\";\nimport { AgentLine } from \"@/agent/view/AgentText.tsx\";\nimport { useSprintView } from \"@/agent/view/mode.ts\";\nimport { agentAttributesFor, buildAgentNode } from \"@/agent/view/project.ts\";\nimport { reactText } from \"@/agent/view/text.ts\";\nimport { tagMeta } from \"./meta.ts\";\nimport \"./Tag.css\";\n\nexport type TagTone = \"neutral\" | \"action\" | \"danger\" | \"info\" | \"warning\" | \"inert\";\n\nexport interface TagProps extends ComponentPropsWithRef<\"span\"> {\n tone?: TagTone;\n filled?: boolean;\n}\n\nexport function Tag(props: TagProps) {\n const { tone = \"neutral\", filled = false, children, ...rest } = props;\n\n const view = useSprintView();\n\n const node = buildAgentNode({\n component: tagMeta.name,\n label: reactText(children),\n state: { tone, filled },\n });\n\n if (view === \"agent\") return <AgentLine node={node} />;\n\n return (\n <span {...rest} {...agentAttributesFor(node)}>\n {children}\n </span>\n );\n}\n","import { defineAgentMeta } from \"@/agent/registry.ts\";\n\nexport const textMeta = defineAgentMeta({\n name: \"Text\",\n category: \"typography\",\n summary:\n \"A run of prose, sized and toned from the semantic scale. In agent view it renders as its own text content, so an agent reads the words rather than inferring them from styling.\",\n whenToUse:\n 'Use it for every paragraph, caption, note, and inline status line, so tone carries meaning instead of an ad-hoc colour. tone=\"muted\" is the small print under a heading, tone=\"warning\" and tone=\"danger\" state that something is wrong, and tone=\"action\" confirms something is live.',\n whenNotToUse:\n \"Do not use it for a section title; that is Heading. Do not put components inside it: it flattens its children to a single string for the agent view, so a nested Button would lose its tool.\",\n status: \"experimental\",\n props: {\n children: {\n kind: \"node\",\n description:\n \"The prose. Inline markup such as code or strong is fine; components are not.\",\n required: true,\n },\n tone: {\n kind: \"enum\",\n description:\n \"What the text means, not just how it looks. Agents read this off the attribute.\",\n values: [\"default\", \"muted\", \"action\", \"info\", \"warning\", \"danger\"],\n default: \"default\",\n },\n size: {\n kind: \"enum\",\n description:\n 'Type size. \"small\" is the annotation size used for notes and captions.',\n values: [\"small\", \"normal\"],\n default: \"normal\",\n },\n as: {\n kind: \"enum\",\n description:\n \"The element to render. Use span when the text sits inside another line of text.\",\n values: [\"p\", \"span\", \"div\"],\n default: \"p\",\n },\n },\n state: {\n tone: {\n description: \"What the text is saying about the thing it describes.\",\n attribute: \"data-sprint-tone\",\n values: [\"default\", \"muted\", \"action\", \"info\", \"warning\", \"danger\"],\n },\n size: {\n description: \"The type size in use.\",\n attribute: \"data-sprint-size\",\n values: [\"small\", \"normal\"],\n },\n },\n agentView: {\n example: '- **Text** \"Tools stay registered across a view switch.\" [tone=muted]',\n },\n examples: [\n {\n title: \"A lede\",\n code: \"<Text>Every component renders normally for people and as text for agents.</Text>\",\n },\n {\n title: \"A note under a heading\",\n description: \"The small print that would otherwise be an untyped grey span.\",\n code: '<Text tone=\"muted\" size=\"small\">Registered while the button is enabled.</Text>',\n },\n {\n title: \"A live status line\",\n description:\n \"Tone is the whole message here, so an agent reading the attribute learns the same thing a person learns from the colour.\",\n code: '<Text tone={ready ? \"action\" : \"warning\"} size=\"small\">\\n {ready ? \"WebMCP is available in this browser.\" : \"WebMCP is unavailable here.\"}\\n</Text>',\n },\n ],\n});\n","import type { ComponentPropsWithRef, Ref } from \"react\";\nimport { AgentLine } from \"@/agent/view/AgentText.tsx\";\nimport { useSprintView } from \"@/agent/view/mode.ts\";\nimport { agentAttributesFor, buildAgentNode } from \"@/agent/view/project.ts\";\nimport { reactText } from \"@/agent/view/text.ts\";\nimport { textMeta } from \"./meta.ts\";\nimport \"./Text.css\";\n\nexport type TextTone = \"default\" | \"muted\" | \"action\" | \"info\" | \"warning\" | \"danger\";\n\nexport type TextSize = \"small\" | \"normal\";\n\nexport interface TextProps extends Omit<ComponentPropsWithRef<\"p\">, \"ref\"> {\n tone?: TextTone;\n size?: TextSize;\n as?: \"p\" | \"span\" | \"div\";\n ref?: Ref<HTMLParagraphElement> | Ref<HTMLSpanElement> | Ref<HTMLDivElement>;\n}\n\nexport function Text(props: TextProps) {\n const { tone = \"default\", size = \"normal\", as = \"p\", children, ...rest } = props;\n\n const view = useSprintView();\n\n const node = buildAgentNode({\n component: textMeta.name,\n label: reactText(children),\n state: { tone, size },\n });\n\n if (view === \"agent\") return <AgentLine node={node} />;\n\n const Element = as;\n\n return (\n <Element {...(rest as ComponentPropsWithRef<\"p\">)} {...agentAttributesFor(node)}>\n {children}\n </Element>\n );\n}\n","import type { AgentToolSpec } from \"@/agent/types.ts\";\n\nexport const FILL_TEXTAREA_TOOL: AgentToolSpec = {\n verb: \"fill\",\n description:\n \"Replace this text area's content with the value provided, exactly as a person typing it would. The value is the full text it ends up containing, line breaks included; pass an empty string to clear it. Returns the area's state after the change, so a follow-up read is unnecessary.\",\n inputSchema: {\n type: \"object\",\n properties: {\n value: {\n type: \"string\",\n description:\n \"The full text the area should contain afterwards, with real line breaks where line breaks belong. Replaces the current text.\",\n },\n },\n required: [\"value\"],\n },\n readOnly: false,\n untrustedContent: true,\n registeredWhen:\n \"The area is mounted, enabled, has a resolvable label, and no other component claims the same tool name.\",\n unregisteredWhen: \"The area unmounts or becomes disabled.\",\n};\n","import { defineAgentMeta } from \"@/agent/registry.ts\";\nimport { FILL_TEXTAREA_TOOL } from \"./tool.ts\";\n\nexport const textareaMeta = defineAgentMeta({\n name: \"Textarea\",\n category: \"input\",\n summary:\n \"A multi-line text area carrying its own label, hint, and error. Fully controlled, and it registers one fill tool that replaces the whole content with an explicit value, line breaks included.\",\n whenToUse:\n \"Use it for free-form text that runs longer than a line: a description, a message body, a set of notes. In the agent view the current content is part of the component's state line, so an agent reads what is written without a separate query.\",\n whenNotToUse:\n \"Do not use it for a single-line value, which is a TextInput. Do not use it for code a person should read rather than write; that is a CodeBlock. Long values make long state lines, so keep it off surfaces where the agent view must stay terse.\",\n status: \"experimental\",\n props: {\n label: {\n kind: \"string\",\n description:\n 'What the area holds. Names it for a screen reader and derives the tool name, so prefer a noun phrase such as \"Mission notes\".',\n required: true,\n },\n value: {\n kind: \"string\",\n description: \"The area's current text. The area is fully controlled.\",\n required: true,\n },\n onChange: {\n kind: \"handler\",\n description:\n \"Called with the new text on every change. The fill tool drives a real input event, so this runs for agent fills too.\",\n required: true,\n },\n rows: {\n kind: \"number\",\n description: \"The visible line count before scrolling.\",\n default: 4,\n },\n placeholder: {\n kind: \"string\",\n description: \"Ghost text shown while the area is empty.\",\n },\n hint: {\n kind: \"string\",\n description:\n \"Guidance shown under the area and carried into the agent view. Replaced by error while one is set.\",\n },\n error: {\n kind: \"string\",\n description:\n \"A validation message. Marks the area invalid for people, screen readers, and agents alike.\",\n },\n name: {\n kind: \"string\",\n description: \"The native form name submitted with the surrounding form.\",\n },\n disabled: {\n kind: \"boolean\",\n description: \"Disable the area and unregister its fill tool.\",\n default: false,\n },\n required: {\n kind: \"boolean\",\n description: \"Mark the area required, visually and in the agent view.\",\n default: false,\n },\n agentName: {\n kind: \"string\",\n description:\n \"Override the label used to derive the tool name, when two areas on a page would otherwise collide.\",\n },\n agentTool: {\n kind: \"boolean\",\n description: \"Set false to render the area without registering a fill tool.\",\n default: true,\n },\n },\n state: {\n value: {\n description: \"The area's current text.\",\n attribute: \"data-sprint-value\",\n },\n empty: {\n description: \"Present while the area holds no text.\",\n attribute: \"data-sprint-empty\",\n },\n disabled: {\n description: \"Present when the area cannot be edited.\",\n attribute: \"data-sprint-disabled\",\n },\n required: {\n description: \"Present when the area must be filled.\",\n attribute: \"data-sprint-required\",\n },\n invalid: {\n description: \"Present while an error is set.\",\n attribute: \"data-sprint-invalid\",\n },\n },\n tools: {\n fill: FILL_TEXTAREA_TOOL,\n },\n agentView: {\n example:\n '- **Textarea** \"Mission notes\" [empty] → tool `fill-mission-notes`\\n - part `hint` \"What the relief crew needs to know\"',\n },\n examples: [\n {\n title: \"A notes area\",\n description:\n \"Label, hint, and control are one component. In agent view it renders a live textarea an agent can type into.\",\n code: '<Textarea\\n label=\"Mission notes\"\\n value={notes}\\n onChange={setNotes}\\n hint=\"What the relief crew needs to know\"\\n/>',\n },\n {\n title: \"A required area with an error\",\n description:\n \"The error replaces the hint and marks the area invalid on every surface.\",\n code: '<Textarea\\n label=\"Abort reason\"\\n value={reason}\\n onChange={setReason}\\n required\\n rows={3}\\n error=\"State the reason before aborting.\"\\n/>',\n },\n ],\n a11y: {\n role: \"textbox\",\n keyboard: [\"Standard text editing\", \"Enter inserts a line break\"],\n notes:\n \"The label element is associated via htmlFor. An error sets aria-invalid and is linked with aria-describedby, as is the hint.\",\n },\n});\n","import {\n type ComponentPropsWithRef,\n useCallback,\n useEffect,\n useId,\n useRef,\n} from \"react\";\nimport { AgentFieldControl, AgentLine } from \"@/agent/view/AgentText.tsx\";\nimport { useAgentControls, useAgentFormat, useSprintView } from \"@/agent/view/mode.ts\";\nimport type { AgentPart } from \"@/agent/view/node.ts\";\nimport {\n agentAttributesFor,\n agentPartAttributesFor,\n buildAgentNode,\n} from \"@/agent/view/project.ts\";\nimport { afterCommit } from \"@/agent/webmcp/afterCommit.ts\";\nimport { setFieldValue } from \"@/agent/webmcp/drive.ts\";\nimport { commitSync } from \"@/agent/webmcp/flush.ts\";\nimport { useAgentTool } from \"@/agent/webmcp/useAgentTool.ts\";\nimport { textareaMeta } from \"./meta.ts\";\nimport { FILL_TEXTAREA_TOOL } from \"./tool.ts\";\nimport \"./Textarea.css\";\n\nexport interface TextareaProps extends Omit<ComponentPropsWithRef<\"div\">, \"onChange\"> {\n label: string;\n value: string;\n onChange: (value: string) => void;\n rows?: number;\n placeholder?: string;\n hint?: string;\n error?: string;\n name?: string;\n disabled?: boolean;\n required?: boolean;\n agentName?: string;\n agentTool?: boolean;\n}\n\nfunction messagePart(error: string | undefined, hint: string | undefined): AgentPart[] {\n if (error !== undefined) return [{ part: \"error\", label: error, state: {} }];\n if (hint !== undefined) return [{ part: \"hint\", label: hint, state: {} }];\n return [];\n}\n\nexport function Textarea(props: TextareaProps) {\n const {\n label,\n value,\n onChange,\n rows = 4,\n placeholder,\n hint,\n error,\n name,\n disabled = false,\n required = false,\n agentName,\n agentTool = true,\n ...rest\n } = props;\n\n const view = useSprintView();\n const controls = useAgentControls();\n const formatter = useAgentFormat();\n const id = useId();\n\n const element = useRef<HTMLTextAreaElement | null>(null);\n const onChangeRef = useRef(onChange);\n onChangeRef.current = onChange;\n const formatRef = useRef(formatter);\n formatRef.current = formatter;\n const nodeRef = useRef(buildAgentNode({ component: textareaMeta.name }));\n const mounted = useRef(true);\n\n useEffect(() => {\n mounted.current = true;\n return () => {\n mounted.current = false;\n };\n }, []);\n\n const execute = useCallback(async (inputs: Record<string, unknown>) => {\n const next = inputs.value;\n if (typeof next !== \"string\") {\n return 'Pass \"value\" as a string holding the full text the area should contain.';\n }\n\n const target = element.current;\n if (target !== null) setFieldValue(target, next);\n else commitSync(() => onChangeRef.current(next));\n\n await afterCommit();\n if (!mounted.current) return \"The change removed this area from the page.\";\n return `Filled. The area is now:\\n${formatRef.current([nodeRef.current])}`;\n }, []);\n\n const toolName = useAgentTool({\n spec: FILL_TEXTAREA_TOOL,\n label: agentName ?? label,\n enabled: agentTool && !disabled,\n execute,\n });\n\n const node = buildAgentNode({\n component: textareaMeta.name,\n label,\n tool: toolName,\n state: {\n ...(value === \"\" ? {} : { value }),\n empty: value === \"\",\n disabled,\n required,\n invalid: error !== undefined,\n },\n parts: messagePart(error, hint),\n });\n nodeRef.current = node;\n\n if (view === \"agent\") {\n if (disabled || controls === \"never\") return <AgentLine node={node} />;\n return (\n <AgentFieldControl\n node={node}\n value={value}\n multiline\n onValueChange={onChange}\n ref={(target: HTMLTextAreaElement | null) => {\n element.current = target;\n }}\n />\n );\n }\n\n const messageId =\n error !== undefined ? `${id}-error` : hint !== undefined ? `${id}-hint` : undefined;\n\n return (\n <div {...rest} {...agentAttributesFor(node)}>\n <label htmlFor={id}>{label}</label>\n <textarea\n id={id}\n {...agentPartAttributesFor({ part: \"input\", state: {} })}\n ref={(target) => {\n element.current = target;\n }}\n rows={rows}\n value={value}\n placeholder={placeholder}\n name={name}\n disabled={disabled}\n required={required}\n aria-invalid={error !== undefined || undefined}\n aria-describedby={messageId}\n onChange={(event) => onChange(event.currentTarget.value)}\n />\n {error !== undefined ? (\n <p id={messageId} {...agentPartAttributesFor({ part: \"error\", state: {} })}>\n {error}\n </p>\n ) : hint !== undefined ? (\n <p id={messageId} {...agentPartAttributesFor({ part: \"hint\", state: {} })}>\n {hint}\n </p>\n ) : null}\n </div>\n );\n}\n","import type { AgentToolSpec } from \"@/agent/types.ts\";\n\nexport const FILL_TOOL: AgentToolSpec = {\n verb: \"fill\",\n description:\n \"Replace this field's text with the value provided, exactly as a person typing it would. The value is the full text the field ends up containing; pass an empty string to clear it. Returns the field's state after the change, so a follow-up read is unnecessary.\",\n inputSchema: {\n type: \"object\",\n properties: {\n value: {\n type: \"string\",\n description:\n \"The full text the field should contain afterwards. Replaces the current text rather than appending to it.\",\n },\n },\n required: [\"value\"],\n },\n readOnly: false,\n untrustedContent: true,\n registeredWhen:\n \"The field is mounted, enabled, has a resolvable label, and no other component claims the same tool name.\",\n unregisteredWhen: \"The field unmounts or becomes disabled.\",\n};\n","import { defineAgentMeta } from \"@/agent/registry.ts\";\nimport { FILL_TOOL } from \"./tool.ts\";\n\nexport const textInputMeta = defineAgentMeta({\n name: \"TextInput\",\n category: \"input\",\n summary:\n \"A single-line text field carrying its own label, hint, and error. Fully controlled, and it registers one fill tool that replaces the field's text with an explicit value.\",\n whenToUse:\n \"Use it for any free-form single-line value: a name, an email address, a search term. The label is part of the component, so a form never needs a separate label element, and the error prop is how validation reaches both a person and an agent.\",\n whenNotToUse:\n \"Do not use it for multi-line text, which is a Textarea. Do not use it to pick from a known set of values; that is a Select or a SegmentedControl. Do not use it for an on/off state, which is a Checkbox or a Switch.\",\n status: \"experimental\",\n props: {\n label: {\n kind: \"string\",\n description:\n 'What the field holds. Names the field for a screen reader and derives the tool name, so prefer a noun phrase such as \"Callsign\".',\n required: true,\n },\n value: {\n kind: \"string\",\n description: \"The field's current text. The field is fully controlled.\",\n required: true,\n },\n onChange: {\n kind: \"handler\",\n description:\n \"Called with the new text on every change. The fill tool drives a real input event, so this runs for agent fills too.\",\n required: true,\n },\n type: {\n kind: \"enum\",\n description:\n 'The input type. \"password\" masks the field everywhere: the value never appears in agent attributes, the agent view, or tool results.',\n values: [\"text\", \"email\", \"url\", \"search\", \"password\"],\n default: \"text\",\n },\n placeholder: {\n kind: \"string\",\n description: \"Ghost text shown while the field is empty.\",\n },\n hint: {\n kind: \"string\",\n description:\n \"Guidance shown under the field and carried into the agent view. Replaced by error while one is set.\",\n },\n error: {\n kind: \"string\",\n description:\n \"A validation message. Marks the field invalid for people, screen readers, and agents alike.\",\n },\n name: {\n kind: \"string\",\n description: \"The native form name submitted with the surrounding form.\",\n },\n autoComplete: {\n kind: \"string\",\n description: \"The native autocomplete hint, forwarded to the input.\",\n },\n disabled: {\n kind: \"boolean\",\n description: \"Disable the field and unregister its fill tool.\",\n default: false,\n },\n required: {\n kind: \"boolean\",\n description: \"Mark the field required, visually and in the agent view.\",\n default: false,\n },\n agentName: {\n kind: \"string\",\n description:\n \"Override the label used to derive the tool name, when two fields on a page would otherwise collide.\",\n },\n agentTool: {\n kind: \"boolean\",\n description: \"Set false to render the field without registering a fill tool.\",\n default: true,\n },\n },\n state: {\n value: {\n description:\n \"The field's current text. Never present on a password field, which reflects filled instead.\",\n attribute: \"data-sprint-value\",\n },\n filled: {\n description: \"Present when a password field holds text.\",\n attribute: \"data-sprint-filled\",\n },\n empty: {\n description: \"Present while the field holds no text.\",\n attribute: \"data-sprint-empty\",\n },\n disabled: {\n description: \"Present when the field cannot be edited.\",\n attribute: \"data-sprint-disabled\",\n },\n required: {\n description: \"Present when the field must be filled.\",\n attribute: \"data-sprint-required\",\n },\n invalid: {\n description: \"Present while an error is set.\",\n attribute: \"data-sprint-invalid\",\n },\n },\n tools: {\n fill: FILL_TOOL,\n },\n agentView: {\n example:\n '- **TextInput** \"Callsign\" [empty, required] → tool `fill-callsign`\\n - part `hint` \"Uppercase, three to eight letters\"',\n },\n examples: [\n {\n title: \"A labelled field\",\n description:\n \"Label, hint, and control are one component. In agent view the hint becomes a part line and the field renders a live input an agent can type into.\",\n code: '<TextInput\\n label=\"Callsign\"\\n value={callsign}\\n onChange={setCallsign}\\n hint=\"Uppercase, three to eight letters\"\\n placeholder=\"NOMAD\"\\n/>',\n },\n {\n title: \"A validation error\",\n description:\n \"The error replaces the hint, marks the field invalid on every surface, and reads back through the fill tool's result.\",\n code: '<TextInput\\n label=\"Frequency\"\\n value={frequency}\\n onChange={setFrequency}\\n required\\n error=\"Out of band. Use 118.000 to 136.975.\"\\n/>',\n },\n {\n title: \"A password\",\n description:\n \"The value stays off every agent surface: state reflects filled or empty, and tool results never echo the text.\",\n code: '<TextInput\\n label=\"Access code\"\\n type=\"password\"\\n value={code}\\n onChange={setCode}\\n autoComplete=\"current-password\"\\n/>',\n },\n ],\n a11y: {\n role: \"textbox\",\n keyboard: [\"Standard text editing\", \"Tab moves through the field\"],\n notes:\n \"The label element is associated via htmlFor. An error sets aria-invalid and is linked with aria-describedby, as is the hint. Focus is an offset keyline, never a rounded ring.\",\n },\n});\n","import {\n type ComponentPropsWithRef,\n useCallback,\n useEffect,\n useId,\n useRef,\n} from \"react\";\nimport { AgentFieldControl, AgentLine } from \"@/agent/view/AgentText.tsx\";\nimport { useAgentControls, useAgentFormat, useSprintView } from \"@/agent/view/mode.ts\";\nimport type { AgentPart } from \"@/agent/view/node.ts\";\nimport {\n agentAttributesFor,\n agentPartAttributesFor,\n buildAgentNode,\n} from \"@/agent/view/project.ts\";\nimport { afterCommit } from \"@/agent/webmcp/afterCommit.ts\";\nimport { setFieldValue } from \"@/agent/webmcp/drive.ts\";\nimport { commitSync } from \"@/agent/webmcp/flush.ts\";\nimport { useAgentTool } from \"@/agent/webmcp/useAgentTool.ts\";\nimport { textInputMeta } from \"./meta.ts\";\nimport { FILL_TOOL } from \"./tool.ts\";\nimport \"./TextInput.css\";\n\nexport type TextInputType = \"text\" | \"email\" | \"url\" | \"search\" | \"password\";\n\nexport interface TextInputProps extends Omit<ComponentPropsWithRef<\"div\">, \"onChange\"> {\n label: string;\n value: string;\n onChange: (value: string) => void;\n type?: TextInputType;\n placeholder?: string;\n hint?: string;\n error?: string;\n name?: string;\n autoComplete?: string;\n disabled?: boolean;\n required?: boolean;\n agentName?: string;\n agentTool?: boolean;\n}\n\nfunction messagePart(error: string | undefined, hint: string | undefined): AgentPart[] {\n if (error !== undefined) return [{ part: \"error\", label: error, state: {} }];\n if (hint !== undefined) return [{ part: \"hint\", label: hint, state: {} }];\n return [];\n}\n\nexport function TextInput(props: TextInputProps) {\n const {\n label,\n value,\n onChange,\n type = \"text\",\n placeholder,\n hint,\n error,\n name,\n autoComplete,\n disabled = false,\n required = false,\n agentName,\n agentTool = true,\n ...rest\n } = props;\n\n const view = useSprintView();\n const controls = useAgentControls();\n const formatter = useAgentFormat();\n const id = useId();\n\n const element = useRef<HTMLInputElement | null>(null);\n const onChangeRef = useRef(onChange);\n onChangeRef.current = onChange;\n const formatRef = useRef(formatter);\n formatRef.current = formatter;\n const nodeRef = useRef(buildAgentNode({ component: textInputMeta.name }));\n const mounted = useRef(true);\n\n useEffect(() => {\n mounted.current = true;\n return () => {\n mounted.current = false;\n };\n }, []);\n\n const masked = type === \"password\";\n\n const execute = useCallback(async (inputs: Record<string, unknown>) => {\n const next = inputs.value;\n if (typeof next !== \"string\") {\n return 'Pass \"value\" as a string holding the full text the field should contain.';\n }\n\n const target = element.current;\n if (target !== null) setFieldValue(target, next);\n else commitSync(() => onChangeRef.current(next));\n\n await afterCommit();\n if (!mounted.current) return \"The change removed this field from the page.\";\n return `Filled. The field is now:\\n${formatRef.current([nodeRef.current])}`;\n }, []);\n\n const toolName = useAgentTool({\n spec: FILL_TOOL,\n label: agentName ?? label,\n enabled: agentTool && !disabled,\n execute,\n });\n\n const node = buildAgentNode({\n component: textInputMeta.name,\n label,\n tool: toolName,\n state: {\n ...(masked ? { filled: value !== \"\" } : value === \"\" ? {} : { value }),\n empty: value === \"\",\n disabled,\n required,\n invalid: error !== undefined,\n },\n parts: messagePart(error, hint),\n });\n nodeRef.current = node;\n\n if (view === \"agent\") {\n if (disabled || controls === \"never\") return <AgentLine node={node} />;\n return (\n <AgentFieldControl\n node={node}\n value={value}\n masked={masked}\n onValueChange={onChange}\n ref={(target: HTMLInputElement | null) => {\n element.current = target;\n }}\n />\n );\n }\n\n const messageId =\n error !== undefined ? `${id}-error` : hint !== undefined ? `${id}-hint` : undefined;\n\n return (\n <div {...rest} {...agentAttributesFor(node)}>\n <label htmlFor={id}>{label}</label>\n <input\n id={id}\n {...agentPartAttributesFor({ part: \"input\", state: {} })}\n ref={(target) => {\n element.current = target;\n }}\n type={type}\n value={value}\n placeholder={placeholder}\n name={name}\n autoComplete={autoComplete}\n disabled={disabled}\n required={required}\n aria-invalid={error !== undefined || undefined}\n aria-describedby={messageId}\n onChange={(event) => onChange(event.currentTarget.value)}\n />\n {error !== undefined ? (\n <p id={messageId} {...agentPartAttributesFor({ part: \"error\", state: {} })}>\n {error}\n </p>\n ) : hint !== undefined ? (\n <p id={messageId} {...agentPartAttributesFor({ part: \"hint\", state: {} })}>\n {hint}\n </p>\n ) : null}\n </div>\n );\n}\n","import { REGION_ATTRIBUTE } from \"@/agent/attributes.ts\";\nimport type { AgentToolSpec } from \"@/agent/types.ts\";\nimport type { SprintView } from \"@/agent/view/mode.ts\";\nimport type { AgentFormatter, AgentNode } from \"@/agent/view/node.ts\";\nimport { countNodes } from \"@/agent/view/node.ts\";\nimport {\n serializeElement,\n serializeWithin,\n topLevelRoots,\n} from \"@/agent/view/serialize.ts\";\nimport { clamp, paginate } from \"@/agent/view/truncate.ts\";\nimport { TOOL_OUTPUT_LIMIT } from \"@/agent/webmcp/adapter.ts\";\nimport { afterCommit } from \"@/agent/webmcp/afterCommit.ts\";\nimport { commitSync } from \"@/agent/webmcp/flush.ts\";\nimport { slug } from \"@/agent/webmcp/scope.ts\";\nimport { useAgentTool } from \"@/agent/webmcp/useAgentTool.ts\";\n\nconst PAGE_FOOTER_BUDGET = 40;\n\nexport interface Region {\n key: string;\n node: AgentNode;\n}\n\nexport function regionKey(node: AgentNode): string {\n const label = node.label === undefined ? \"\" : slug(node.label);\n const base = label === \"\" ? slug(node.component) : `${slug(node.component)}-${label}`;\n return base === \"\" ? \"region\" : base;\n}\n\nexport function toRegions(nodes: readonly AgentNode[]): Region[] {\n const used = new Map<string, number>();\n return nodes.map((node) => {\n const base = regionKey(node);\n const seen = used.get(base) ?? 0;\n used.set(base, seen + 1);\n return { key: seen === 0 ? base : `${base}-${seen + 1}`, node };\n });\n}\n\nfunction readRegions(): Region[] {\n if (typeof document === \"undefined\") return [];\n const body = document.body;\n const tops = new Set(topLevelRoots(body));\n const nested = Array.from(body.querySelectorAll(`[${REGION_ATTRIBUTE}]`)).filter(\n (element) => !tops.has(element),\n );\n return toRegions([\n ...serializeWithin(body),\n ...nested\n .map((element) => serializeElement(element))\n .filter((node): node is AgentNode => node !== null),\n ]);\n}\n\nexport const LIST_REGIONS_SPEC: AgentToolSpec = {\n verb: \"list\",\n description:\n \"List the Sprint component regions on this page, with a one-line state summary for each. Call this first to discover region keys, then call read-region to read one in full. Regions nest: a page-level region contains the labelled panels listed after it, so read the smallest region that covers what you need.\",\n inputSchema: { type: \"object\", properties: {} },\n readOnly: true,\n untrustedContent: true,\n registeredWhen: \"A root SprintProvider is mounted and WebMCP is available.\",\n};\n\nexport const READ_REGION_SPEC: AgentToolSpec = {\n verb: \"read\",\n description:\n \"Read one region of the page as Markdown, including every component in it, its current state, and the tools that drive it. Long regions are paginated; the response ends with the page number and total.\",\n inputSchema: {\n type: \"object\",\n properties: {\n region: {\n type: \"string\",\n description: \"A region key from list-page-regions.\",\n },\n page: {\n type: \"integer\",\n description: \"1-based page number. Defaults to 1.\",\n minimum: 1,\n },\n },\n required: [\"region\"],\n },\n readOnly: true,\n untrustedContent: true,\n registeredWhen: \"A root SprintProvider is mounted and WebMCP is available.\",\n};\n\nexport function listRegions(format: AgentFormatter): string {\n const regions = readRegions();\n if (regions.length === 0) return \"This page has no Sprint components.\";\n\n const lines = regions.map(({ key, node }) => {\n const nested = countNodes(node.children);\n const summary = format([{ ...node, children: [], parts: [] }])\n .split(\"\\n\")[0]\n ?.replace(/^-\\s*/, \"\");\n const suffix = nested === 0 ? \"\" : ` (${nested} nested)`;\n return `- \\`${key}\\` — ${summary ?? node.component}${suffix}`;\n });\n\n return [`${regions.length} region(s):`, ...lines].join(\"\\n\");\n}\n\nexport function readRegion(\n format: AgentFormatter,\n requested: unknown,\n page: unknown,\n): string {\n const regions = readRegions();\n const keys = regions.map((region) => region.key);\n const match = regions.find((region) => region.key === requested);\n\n if (match === undefined) {\n return `No region named \"${String(requested)}\". Available regions: ${\n keys.join(\", \") || \"none\"\n }.`;\n }\n\n const pages = paginate(format([match.node]), TOOL_OUTPUT_LIMIT - PAGE_FOOTER_BUDGET);\n const requestedPage = typeof page === \"number\" ? page : 1;\n\n if (requestedPage < 1 || requestedPage > pages.length) {\n return `Region \"${match.key}\" has ${pages.length} page(s); page ${requestedPage} does not exist.`;\n }\n\n return `${pages[requestedPage - 1] ?? \"\"}\\n\\n(page ${requestedPage} of ${pages.length})`;\n}\n\nexport const SET_VIEW_SPEC: AgentToolSpec = {\n verb: \"set\",\n description:\n 'Switch how this page renders. In \"agent\" view every Sprint component renders as plain Markdown text with no HTML elements, so the page can be read directly. In \"human\" view it renders normally. Tools keep working in both.',\n inputSchema: {\n type: \"object\",\n properties: {\n view: {\n type: \"string\",\n description: 'Either \"agent\" or \"human\".',\n enum: [\"agent\", \"human\"],\n },\n },\n required: [\"view\"],\n },\n readOnly: false,\n untrustedContent: true,\n registeredWhen: \"A root SprintProvider is mounted and WebMCP is available.\",\n};\n\nexport function pageText(): string {\n if (typeof document === \"undefined\") return \"\";\n return (document.body.textContent ?? \"\").replace(/\\n{3,}/g, \"\\n\\n\").trim();\n}\n\nexport interface UsePageToolsOptions {\n enabled: boolean;\n format: AgentFormatter;\n view: SprintView;\n setView: (view: SprintView) => void;\n}\n\nexport function usePageTools(options: UsePageToolsOptions): void {\n const { enabled, format, view, setView } = options;\n\n useAgentTool({\n spec: LIST_REGIONS_SPEC,\n label: \"page regions\",\n enabled,\n execute: () =>\n view === \"agent\"\n ? 'This page is in agent view and renders as one text document. Call read-region with region \"page\", or read the page text directly.'\n : listRegions(format),\n });\n\n useAgentTool({\n spec: READ_REGION_SPEC,\n label: \"region\",\n enabled,\n execute: (inputs) =>\n view === \"agent\"\n ? readTextRegion(inputs.region, inputs.page)\n : readRegion(format, inputs.region, inputs.page),\n });\n\n useAgentTool({\n spec: SET_VIEW_SPEC,\n label: \"page view\",\n enabled,\n execute: async (inputs) => {\n const next = inputs.view === \"agent\" ? \"agent\" : \"human\";\n commitSync(() => setView(next));\n await afterCommit();\n return next === \"agent\"\n ? `Page is now in agent view:\\n\\n${clamp(pageText(), TOOL_OUTPUT_LIMIT - PAGE_FOOTER_BUDGET)}`\n : \"Page is now in human view.\";\n },\n });\n}\n\nfunction readTextRegion(requested: unknown, page: unknown): string {\n if (requested !== \"page\") {\n return `No region named \"${String(requested)}\". In agent view the whole page is one region, named \"page\".`;\n }\n\n const pages = paginate(pageText(), TOOL_OUTPUT_LIMIT - PAGE_FOOTER_BUDGET);\n const requestedPage = typeof page === \"number\" ? page : 1;\n\n if (requestedPage < 1 || requestedPage > pages.length) {\n return `Region \"page\" has ${pages.length} page(s); page ${requestedPage} does not exist.`;\n }\n\n return `${pages[requestedPage - 1] ?? \"\"}\\n\\n(page ${requestedPage} of ${pages.length})`;\n}\n","import type { PointerEvent as ReactPointerEvent } from \"react\";\n\nconst GLOSS_X = \"--sprint-gloss-x\";\nconst GLOSS_FADE = \"--sprint-gloss-fade\";\nconst CAST_SHIFT = \"--sprint-cast-shift\";\nconst X_MIN = 22;\nconst X_MAX = 78;\nconst FADE_SPAN = 28;\nconst FADE_FLOOR = 0.25;\nconst CAST_TRAVEL = 10;\n\nconst clamp = (value: number, min: number, max: number) =>\n Math.min(max, Math.max(min, value));\n\nfunction stilled() {\n return (\n typeof matchMedia === \"function\" &&\n matchMedia(\"(prefers-reduced-motion: reduce)\").matches\n );\n}\n\nconst GLOSSY = new Set([\n \"Button\",\n \"Card\",\n \"Tag\",\n \"SegmentedControl\",\n \"Switch\",\n \"Shell\",\n]);\n\nconst LIT_PARTS = new Set([\"option\", \"thumb\"]);\n\nfunction litPart(node: Element, root: HTMLElement): HTMLElement | null {\n const part = node.closest<HTMLElement>(\"[data-sprint-part]\");\n if (part === null || !root.contains(part)) return null;\n const name = part.dataset.sprintPart;\n return name !== undefined && LIT_PARTS.has(name) ? part : null;\n}\n\nfunction glossTarget(node: EventTarget | null): HTMLElement | null {\n if (!(node instanceof Element)) return null;\n const root = node.closest<HTMLElement>(\"[data-sprint]\");\n if (root === null) return null;\n const name = root.dataset.sprint;\n if (name === undefined || !GLOSSY.has(name)) return null;\n return litPart(node, root) ?? root;\n}\n\nexport function trackGloss(event: ReactPointerEvent<HTMLElement>) {\n if (event.pointerType === \"touch\" || stilled()) return;\n const target = glossTarget(event.target);\n if (target === null) return;\n const box = target.getBoundingClientRect();\n if (box.width === 0 || box.height === 0) return;\n const x = clamp(((event.clientX - box.left) / box.width) * 100, X_MIN, X_MAX);\n const offset = (x - 50) / FADE_SPAN;\n target.style.setProperty(GLOSS_X, `${x.toFixed(1)}%`);\n target.style.setProperty(\n GLOSS_FADE,\n clamp(1 - Math.abs(offset), FADE_FLOOR, 1).toFixed(3),\n );\n target.style.setProperty(CAST_SHIFT, `${(offset * -CAST_TRAVEL).toFixed(1)}px`);\n}\n\nexport function releaseGloss(event: ReactPointerEvent<HTMLElement>) {\n const target = glossTarget(event.target);\n if (target === null) return;\n target.style.removeProperty(GLOSS_X);\n target.style.removeProperty(GLOSS_FADE);\n target.style.removeProperty(CAST_SHIFT);\n if (target.style.length === 0) target.removeAttribute(\"style\");\n}\n","import {\n type ReactNode,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport {\n THEME_ATTRIBUTE,\n VIEW_ATTRIBUTE,\n VIEW_COPY_ATTRIBUTE,\n} from \"@/agent/attributes.ts\";\nimport {\n defaultAgentFormat,\n type SprintAgentControls,\n type SprintView,\n SprintViewProvider,\n useSprintViewControl,\n} from \"@/agent/view/mode.ts\";\nimport type { AgentFormatter } from \"@/agent/view/node.ts\";\nimport { AgentScopeProvider, useAgentScope } from \"@/agent/webmcp/scope.ts\";\nimport { usePageTools } from \"./pageTools.ts\";\nimport \"./SprintProvider.css\";\nimport { releaseGloss, trackGloss } from \"./gloss.ts\";\n\nconst COPIED_FOR = 1200;\n\nexport type SprintTheme =\n | \"dark\"\n | \"light\"\n | \"calorie\"\n | \"calorie-dark\"\n | \"trax\"\n | \"trax-dark\";\n\nexport interface SprintProviderProps {\n children: ReactNode;\n label?: string;\n format?: AgentFormatter;\n pageTools?: boolean;\n view?: SprintView;\n defaultView?: SprintView;\n onViewChange?: (view: SprintView) => void;\n agentControls?: SprintAgentControls;\n theme?: SprintTheme;\n}\n\nexport function SprintProvider(props: SprintProviderProps) {\n const {\n children,\n label,\n format,\n pageTools = true,\n view,\n defaultView,\n onViewChange,\n agentControls,\n theme,\n } = props;\n\n const parentScope = useAgentScope();\n const inherited = useSprintViewControl();\n const root = !inherited.owned;\n\n const [ownView, setOwnView] = useState<SprintView>(defaultView ?? \"human\");\n\n const controlled = view !== undefined;\n const owns = controlled || root || defaultView !== undefined;\n const effective = controlled ? view : owns ? ownView : inherited.view;\n\n const setView = useCallback(\n (next: SprintView) => {\n if (!owns) {\n inherited.setView(next);\n return;\n }\n if (!controlled) setOwnView(next);\n onViewChange?.(next);\n },\n [owns, controlled, inherited, onViewChange],\n );\n\n const controls = agentControls ?? inherited.controls;\n const formatter = format ?? inherited.format ?? defaultAgentFormat;\n\n const viewValue = useMemo(\n () => ({ view: effective, setView, controls, format: formatter, owned: owns }),\n [effective, setView, controls, formatter, owns],\n );\n\n const scopeValue = useMemo(\n () => ({ path: label === undefined ? parentScope : [...parentScope, label] }),\n [parentScope, label],\n );\n\n usePageTools({\n enabled: root && pageTools,\n format: formatter,\n view: effective,\n setView,\n });\n\n const surface = useRef<HTMLDivElement>(null);\n const [copied, setCopied] = useState(false);\n\n useEffect(() => {\n if (!copied) return;\n const timer = setTimeout(() => setCopied(false), COPIED_FOR);\n return () => clearTimeout(timer);\n }, [copied]);\n\n const copy = () => {\n const clipboard = navigator.clipboard;\n if (clipboard === undefined) return;\n const text = (surface.current?.textContent ?? \"\").replace(/\\n{3,}/g, \"\\n\\n\").trim();\n clipboard.writeText(text).then(\n () => setCopied(true),\n () => setCopied(false),\n );\n };\n\n const copyControl = owns && effective === \"agent\" && controls !== \"never\";\n\n return (\n <SprintViewProvider value={viewValue}>\n <AgentScopeProvider value={scopeValue}>\n {copyControl ? (\n <button\n type=\"button\"\n aria-label={copied ? \"Copied\" : \"Copy agent view\"}\n {...{ [VIEW_COPY_ATTRIBUTE]: \"\" }}\n {...(copied ? { \"data-sprint-copied\": \"\" } : {})}\n onClick={copy}\n />\n ) : null}\n <div\n ref={surface}\n onPointerMove={effective === \"agent\" ? undefined : trackGloss}\n onPointerOut={effective === \"agent\" ? undefined : releaseGloss}\n {...{ [VIEW_ATTRIBUTE]: effective }}\n {...(theme === undefined ? {} : { [THEME_ATTRIBUTE]: theme })}\n >\n {children}\n </div>\n </AgentScopeProvider>\n </SprintViewProvider>\n );\n}\n\nexport interface AgentRegionProps {\n children: ReactNode;\n label: string;\n}\n\nexport function AgentRegion(props: AgentRegionProps) {\n const { children, label } = props;\n const parent = useAgentScope();\n const value = useMemo(() => ({ path: [...parent, label] }), [parent, label]);\n\n return <AgentScopeProvider value={value}>{children}</AgentScopeProvider>;\n}\n","import pkg from \"../package.json\" with { type: \"json\" };\n\nexport const version: string = pkg.version;\n"],"names":["COMPONENT_ATTRIBUTE","PART_ATTRIBUTE","STATE_ATTRIBUTE_PREFIX","TOOL_ATTRIBUTE","OWNER_ATTRIBUTE","AGENT_ATTRIBUTE","VIEW_ATTRIBUTE","VIEW_COPY_ATTRIBUTE","THEME_ATTRIBUTE","REGION_ATTRIBUTE","RESERVED_STATE_KEYS","agentAttributes","component","options","attributes","key","value","agentSelector","part","base","TRUNCATION_MARKER","clamp","text","max","budget","head","boundary","paginate","size","lines","pages","current","line","candidate","index","TOOL_OUTPUT_LIMIT","TOOL_DESCRIPTION_LIMIT","PARAM_DESCRIPTION_LIMIT","getModelContext","isModelContextAvailable","assertDescriptorLimits","descriptor","property","description","validateInputs","schema","inputs","known","actual","wantsNumber","harden","context","invalid","result","error","reason","registerTool","signal","TOOL_NAMING_CONVENTION","registry","defineAgentMeta","meta","existing","getAgentMeta","name","listAgentMeta","a","b","buildAgentManifest","version","isEmptyNode","node","countNodes","nodes","total","formatState","state","keys","formatLabel","label","formatTool","tool","partLine","indent","nodeLine","suffix","owned","nodeLines","inner","child","toMarkdown","input","resolved","defaultAgentFormat","ViewContext","createContext","SprintViewProvider","useSprintView","useContext","useSprintViewControl","useAgentControls","useAgentFormat","DepthContext","AgentDepthProvider","useAgentDepth","buildAgentNode","agentAttributesFor","agentControlAttributes","agentPartControlAttributes","agentPartAttributesFor","_root","format","formatter","AgentLine","props","children","depth","jsxs","AgentControlGroup","onActivate","isActionable","offset","body","lead","jsx","Fragment","AgentFieldControl","onValueChange","multiline","masked","ref","control","event","AgentControl","as","href","rest","rows","tail","isCell","cellKey","row","column","condenseCells","columns","rowIds","cells","summary","normalize","gatherReact","out","isValidElement","reactText","parts","isHidden","element","gather","accessibleText","direct","labelledBy","root","referenced","id","target","reserved","NATIVE_BOOLEAN_STATE","ARIA_STATE","readState","attribute","scan","walk","toPart","serializeElement","maxDepth","lookupMeta","owner","exhausted","topLevelRoots","found","reattachOwned","byTool","attached","host","serializeWithin","afterCommit","resolve","MAX_NAME_LENGTH","slug","toolName","scope","verb","core","segments","cut","claims","claimFor","created","claimToolName","holder","onChange","claim","listener","holdsToolName","toolNameHolderCount","AgentScopeContext","AgentScopeProvider","useAgentScope","useAgentTool","spec","nameOverride","inputSchema","enabled","execute","schemaKey","schemaRef","useRef","holderRef","executeRef","useEffect","held","setHeld","useState","release","controller","commitSync","action","flushSync","DISMISS_ALERT_TOOL","alertMeta","Alert","tone","onDismiss","agentName","agentTool","view","controls","onDismissRef","formatRef","nodeRef","mounted","dismissible","useCallback","handler","message","role","PRESS_TOOL","buttonMeta","syntheticClick","Button","block","loading","disabled","type","onClick","setRef","explicitLabel","domLabel","setDomLabel","useLayoutEffect","inert","onClickRef","OPEN_CARD_TOOL","cardMeta","Card","navigates","SET_CHECKBOX_TOOL","checkboxMeta","messagePart","hint","Checkbox","checked","required","useId","onChangeRef","checkedRef","desired","already","messageId","PATTERN","KINDS","tokenize","code","tokens","cursor","match","kind","_","slot","codeBlockMeta","COPIED_FOR","CodeBlock","caption","language","copyLabel","copied","setCopied","timer","copy","clipboard","token","descriptionListMeta","pairText","item","term","DescriptionList","items","emptyLabel","empty","CLOSE_DIALOG_TOOL","dialogMeta","Dialog","open","onClose","headingLevel","parentScope","closeElement","onCloseRef","openRef","scopeValue","useMemo","Label","headingMeta","Heading","level","Element","imageMeta","Image","src","alt","ratio","fit","status","setStatus","decorative","band","OPEN_LINK_TOOL","linkMeta","Link","active","external","outward","listMeta","List","ordered","metaLineMeta","MetaLine","entries","entry","navMeta","Nav","navBarMeta","TRAVEL","reading","opening","matches","needle","NavBar","groups","trailEmptyLabel","onOpenChange","onNavigate","query","setQuery","setScope","trail","setTrail","field","drawer","setRoot","notify","announce","next","dismiss","all","group","here","inspected","searching","revealed","levels","scoped","shown","travel","destination","was","_part","close","reach","segment","recency","members","best","member","travellers","within","step","from","stops","drive","first","steer","at","nothing","count","any","navGroupMeta","NavGroup","pageHeaderMeta","PageHeader","tags","actions","lede","Children","panelMeta","Panel","flush","secretFieldMeta","MASK","SecretField","defaultRevealed","setRevealed","filled","SELECT_TOOL","segmentedControlMeta","optionSchema","option","SegmentedControl","elements","optionsRef","select","requested","available","move","selected","SELECT_OPTION_TOOL","selectMeta","setFieldValue","prototype","setter","setSelectValue","Select","placeholder","choose","chosen","optionParts","shellMeta","Shell","side","bar","sideLabel","skipLabel","menuLabel","closeLabel","setOpen","drawerId","main","closeOnNavigate","stackMeta","Stack","direction","gap","align","justify","wrap","collapse","min","style","sizing","SET_SWITCH_TOOL","switchMeta","Switch","on","onRef","tableMeta","rowId","cellState","cellParts","Table","tagMeta","Tag","textMeta","Text","FILL_TEXTAREA_TOOL","textareaMeta","Textarea","FILL_TOOL","textInputMeta","TextInput","autoComplete","PAGE_FOOTER_BUDGET","regionKey","toRegions","used","seen","readRegions","tops","nested","LIST_REGIONS_SPEC","READ_REGION_SPEC","listRegions","regions","readRegion","page","region","requestedPage","SET_VIEW_SPEC","pageText","usePageTools","setView","readTextRegion","GLOSS_X","GLOSS_FADE","CAST_SHIFT","X_MIN","X_MAX","FADE_SPAN","FADE_FLOOR","stilled","GLOSSY","LIT_PARTS","litPart","glossTarget","trackGloss","box","x","releaseGloss","SprintProvider","pageTools","defaultView","onViewChange","agentControls","theme","inherited","ownView","setOwnView","controlled","owns","effective","viewValue","surface","copyControl","AgentRegion","parent","pkg"],"mappings":"gKAAaA,EAAsB,cACtBC,GAAiB,mBACjBC,GAAyB,eACzBC,GAAiB,mBACjBC,GAAkB,oBAClBC,GAAkB,oBAClBC,GAAiB,mBACjBC,GAAsB,wBACtBC,GAAkB,oBAClBC,GAAmB,qBAEnBC,GAAyC,CACpD,OACA,OACA,QACA,QACA,OACA,YACA,QACA,SACA,UACF,EASO,SAASC,GACdC,EACAC,EAAiC,GACT,CACxB,MAAMC,EAAqC,CACzC,CAACd,CAAmB,EAAGY,CAAA,EAGrBC,EAAQ,OACVC,EAAWb,EAAc,EAAIY,EAAQ,MAGvC,SAAW,CAACE,EAAKC,CAAK,IAAK,OAAO,QAAQH,EAAQ,OAAS,CAAA,CAAE,EACvDG,GAAU,MAA+BA,IAAU,KACvDF,EAAW,GAAGZ,EAAsB,GAAGa,CAAG,EAAE,EAAIC,IAAU,GAAO,GAAK,OAAOA,CAAK,GAGpF,OAAOF,CACT,CAEO,SAASG,GAAcL,EAAmBM,EAAuB,CACtE,MAAMC,EAAO,IAAInB,CAAmB,KAAKY,CAAS,KAClD,OAAOM,EAAO,GAAGC,CAAI,KAAKlB,EAAc,KAAKiB,CAAI,KAAOC,CAC1D,CCrDO,MAAMC,GAAoB;AAAA,aAE1B,SAASC,GAAMC,EAAcC,EAAqB,CACvD,GAAID,EAAK,QAAUC,EAAK,OAAOD,EAC/B,GAAIC,GAAOH,GAAkB,cAAeE,EAAK,MAAM,EAAGC,CAAG,EAE7D,MAAMC,EAASD,EAAMH,GAAkB,OACjCK,EAAOH,EAAK,MAAM,EAAGE,CAAM,EAC3BE,EAAWD,EAAK,YAAY;AAAA,CAAI,EAGtC,MAAO,GAFKC,EAAWF,EAAS,EAAIC,EAAK,MAAM,EAAGC,CAAQ,EAAID,EAAK,QAAA,CAEtD,GAAGL,EAAiB,EACnC,CA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AGmhB,EACvB,GAAIN,IAAU,OAAY,CAAA,EAAK,CAAE,CAAC3gB,EAAe,EAAG2gB,CAAA,EAEpD,SAAAha,CAAA,CAAA,CACH,CAAA,CACF,CAAA,CACF,CAEJ,CAOO,SAAS0a,GAAY3a,EAAyB,CACnD,KAAM,CAAE,SAAAC,EAAU,MAAApC,CAAA,EAAUmC,EACtB4a,EAAShV,GAAA,EACT9L,EAAQ+S,EAAAA,QAAQ,KAAO,CAAE,KAAM,CAAC,GAAG+N,EAAQ/c,CAAK,CAAA,GAAM,CAAC+c,EAAQ/c,CAAK,CAAC,EAE3E,OAAO6C,EAAAA,IAACiF,GAAA,CAAmB,MAAA7L,EAAe,SAAAmG,CAAA,CAAS,CACrD,kCC/Ja9C,GAAkB0d,GAAI"}
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../src/agent/attributes.ts","../src/agent/view/truncate.ts","../src/agent/webmcp/adapter.ts","../src/agent/registry.ts","../src/agent/view/node.ts","../src/agent/view/markdown.ts","../src/agent/view/mode.ts","../src/agent/view/project.ts","../src/agent/view/AgentText.tsx","../src/agent/view/tabular.ts","../src/agent/view/text.ts","../src/agent/view/serialize.ts","../src/agent/webmcp/afterCommit.ts","../src/agent/webmcp/scope.ts","../src/agent/webmcp/useAgentTool.ts","../src/agent/webmcp/flush.ts","../src/components/Alert/tool.ts","../src/components/Alert/meta.ts","../src/components/Alert/Alert.tsx","../src/components/Breadcrumb/tool.ts","../src/components/Breadcrumb/meta.ts","../src/components/Breadcrumb/Breadcrumb.tsx","../src/components/Button/tool.ts","../src/components/Button/meta.ts","../src/components/Button/Button.tsx","../src/components/Card/tool.ts","../src/components/Card/meta.ts","../src/components/Card/Card.tsx","../src/components/ChangeList/meta.ts","../src/components/ChangeList/ChangeList.tsx","../src/components/Checkbox/tool.ts","../src/components/Checkbox/meta.ts","../src/components/Checkbox/Checkbox.tsx","../src/components/ChoiceGrid/tool.ts","../src/components/ChoiceGrid/meta.ts","../src/components/ChoiceGrid/ChoiceGrid.tsx","../src/components/CodeBlock/highlight.ts","../src/components/CodeBlock/meta.ts","../src/components/CodeBlock/CodeBlock.tsx","../src/components/CopyField/meta.ts","../src/components/CopyField/CopyField.tsx","../src/components/DescriptionList/meta.ts","../src/components/DescriptionList/DescriptionList.tsx","../src/components/Dialog/tool.ts","../src/components/Dialog/meta.ts","../src/components/Dialog/Dialog.tsx","../src/components/Disclosure/tool.ts","../src/components/Disclosure/meta.ts","../src/components/Disclosure/Disclosure.tsx","../src/components/Divider/meta.ts","../src/components/Divider/Divider.tsx","../src/components/Link/tool.ts","../src/components/Link/meta.ts","../src/components/Link/Link.tsx","../src/components/EmptyState/meta.ts","../src/components/EmptyState/EmptyState.tsx","../src/components/Tag/meta.ts","../src/components/Tag/Tag.tsx","../src/components/EntityRow/tool.ts","../src/components/EntityRow/meta.ts","../src/components/EntityRow/EntityRow.tsx","../src/components/Heading/meta.ts","../src/components/Heading/Heading.tsx","../src/components/Image/meta.ts","../src/components/Image/Image.tsx","../src/components/List/meta.ts","../src/components/List/List.tsx","../src/components/MetaLine/meta.ts","../src/components/MetaLine/MetaLine.tsx","../src/components/Nav/meta.ts","../src/components/Nav/Nav.tsx","../src/components/NavGroup/meta.ts","../src/components/NavGroup/NavGroup.tsx","../src/components/PageHeader/meta.ts","../src/components/PageHeader/PageHeader.tsx","../src/components/Pagination/tool.ts","../src/components/Pagination/meta.ts","../src/components/Pagination/Pagination.tsx","../src/components/Panel/meta.ts","../src/components/Panel/Panel.tsx","../src/components/Pending/meta.ts","../src/components/Pending/Pending.tsx","../src/components/Progress/meta.ts","../src/components/Progress/Progress.tsx","../src/components/SearchField/tool.ts","../src/components/SearchField/meta.ts","../src/agent/webmcp/drive.ts","../src/components/SearchField/SearchField.tsx","../src/components/SecretField/meta.ts","../src/components/SecretField/SecretField.tsx","../src/components/SegmentedControl/tool.ts","../src/components/SegmentedControl/meta.ts","../src/components/SegmentedControl/SegmentedControl.tsx","../src/components/Select/tool.ts","../src/components/Select/meta.ts","../src/components/Select/Select.tsx","../src/components/Shell/meta.ts","../src/components/Shell/Shell.tsx","../src/components/Stack/meta.ts","../src/components/Stack/Stack.tsx","../src/components/Steps/meta.ts","../src/components/Steps/Steps.tsx","../src/components/Switch/tool.ts","../src/components/Switch/meta.ts","../src/components/Switch/Switch.tsx","../src/components/Table/meta.ts","../src/components/Table/Table.tsx","../src/components/Text/meta.ts","../src/components/Text/Text.tsx","../src/components/Textarea/tool.ts","../src/components/Textarea/meta.ts","../src/components/Textarea/Textarea.tsx","../src/components/TextInput/tool.ts","../src/components/TextInput/meta.ts","../src/components/TextInput/TextInput.tsx","../src/provider/pageTools.ts","../src/provider/gloss.ts","../src/provider/SprintProvider.tsx","../src/version.ts"],"sourcesContent":["export const COMPONENT_ATTRIBUTE = \"data-sprint\";\nexport const PART_ATTRIBUTE = \"data-sprint-part\";\nexport const STATE_ATTRIBUTE_PREFIX = \"data-sprint-\";\nexport const TOOL_ATTRIBUTE = \"data-sprint-tool\";\nexport const OWNER_ATTRIBUTE = \"data-sprint-owner\";\nexport const AGENT_ATTRIBUTE = \"data-sprint-agent\";\nexport const VIEW_ATTRIBUTE = \"data-sprint-view\";\nexport const VIEW_COPY_ATTRIBUTE = \"data-sprint-view-copy\";\nexport const THEME_ATTRIBUTE = \"data-sprint-theme\";\nexport const REGION_ATTRIBUTE = \"data-sprint-region\";\n\nexport const RESERVED_STATE_KEYS: readonly string[] = [\n \"part\",\n \"tool\",\n \"owner\",\n \"agent\",\n \"view\",\n \"view-copy\",\n \"theme\",\n \"region\",\n \"ornament\",\n];\n\nexport type AgentAttributeValue = string | number | boolean | null | undefined;\n\nexport interface AgentAttributeOptions {\n part?: string;\n state?: Record<string, AgentAttributeValue>;\n}\n\nexport function agentAttributes(\n component: string,\n options: AgentAttributeOptions = {},\n): Record<string, string> {\n const attributes: Record<string, string> = {\n [COMPONENT_ATTRIBUTE]: component,\n };\n\n if (options.part) {\n attributes[PART_ATTRIBUTE] = options.part;\n }\n\n for (const [key, value] of Object.entries(options.state ?? {})) {\n if (value === null || value === undefined || value === false) continue;\n attributes[`${STATE_ATTRIBUTE_PREFIX}${key}`] = value === true ? \"\" : String(value);\n }\n\n return attributes;\n}\n\nexport function agentSelector(component: string, part?: string): string {\n const base = `[${COMPONENT_ATTRIBUTE}=\"${component}\"]`;\n return part ? `${base} [${PART_ATTRIBUTE}=\"${part}\"]` : base;\n}\n","export const TRUNCATION_MARKER = \"\\n… truncated\";\n\nexport function clamp(text: string, max: number): string {\n if (text.length <= max) return text;\n if (max <= TRUNCATION_MARKER.length) return text.slice(0, max);\n\n const budget = max - TRUNCATION_MARKER.length;\n const head = text.slice(0, budget);\n const boundary = head.lastIndexOf(\"\\n\");\n const cut = boundary > budget / 2 ? head.slice(0, boundary) : head.trimEnd();\n\n return `${cut}${TRUNCATION_MARKER}`;\n}\n\nexport function paginate(text: string, size: number): string[] {\n if (size <= 0) return [text];\n\n const lines = text.split(\"\\n\");\n const pages: string[] = [];\n let current = \"\";\n\n for (const line of lines) {\n const candidate = current === \"\" ? line : `${current}\\n${line}`;\n if (candidate.length <= size) {\n current = candidate;\n continue;\n }\n if (current !== \"\") pages.push(current);\n current = line.length <= size ? line : \"\";\n if (line.length > size) {\n for (let index = 0; index < line.length; index += size) {\n pages.push(line.slice(index, index + size));\n }\n }\n }\n\n if (current !== \"\") pages.push(current);\n return pages.length === 0 ? [\"\"] : pages;\n}\n","import { clamp } from \"@/agent/view/truncate.ts\";\nimport type {\n JsonSchemaObject,\n ModelContext,\n ToolDescriptor,\n ToolExecuteContext,\n} from \"./types.ts\";\n\nexport const TOOL_OUTPUT_LIMIT = 1500;\nexport const TOOL_DESCRIPTION_LIMIT = 500;\nexport const PARAM_DESCRIPTION_LIMIT = 150;\n\nexport function getModelContext(): ModelContext | null {\n if (typeof document === \"undefined\") return null;\n return document.modelContext ?? null;\n}\n\nexport function isModelContextAvailable(): boolean {\n return getModelContext() !== null;\n}\n\nfunction assertDescriptorLimits(descriptor: ToolDescriptor): void {\n if (descriptor.description.length > TOOL_DESCRIPTION_LIMIT) {\n throw new Error(\n `Tool \"${descriptor.name}\" description is ${descriptor.description.length} characters; the platform limit is ${TOOL_DESCRIPTION_LIMIT}.`,\n );\n }\n\n for (const [key, property] of Object.entries(descriptor.inputSchema.properties)) {\n const description = property.description ?? \"\";\n if (description.length > PARAM_DESCRIPTION_LIMIT) {\n throw new Error(\n `Tool \"${descriptor.name}\" parameter \"${key}\" description is ${description.length} characters; the platform limit is ${PARAM_DESCRIPTION_LIMIT}.`,\n );\n }\n }\n}\n\nexport function validateInputs(\n schema: JsonSchemaObject,\n inputs: Record<string, unknown>,\n): string | null {\n for (const key of schema.required ?? []) {\n if (inputs[key] === undefined) {\n const known = Object.keys(schema.properties).join(\", \");\n return `Missing required parameter \"${key}\". Expected parameters: ${known || \"none\"}.`;\n }\n }\n\n for (const [key, value] of Object.entries(inputs)) {\n if (value === undefined) continue;\n const property = schema.properties[key];\n if (property === undefined) {\n const known = Object.keys(schema.properties).join(\", \");\n return `Unknown parameter \"${key}\". Expected parameters: ${known || \"none\"}.`;\n }\n\n const actual = typeof value;\n const wantsNumber = property.type === \"number\" || property.type === \"integer\";\n const matches =\n (property.type === \"string\" && actual === \"string\") ||\n (wantsNumber && actual === \"number\") ||\n (property.type === \"boolean\" && actual === \"boolean\");\n\n if (!matches) {\n return `Parameter \"${key}\" must be a ${property.type}, received ${actual}.`;\n }\n\n if (property.enum !== undefined && !property.enum.includes(String(value))) {\n return `Parameter \"${key}\" must be one of: ${property.enum.join(\", \")}.`;\n }\n\n if (typeof value === \"number\") {\n if (property.type === \"integer\" && !Number.isInteger(value)) {\n return `Parameter \"${key}\" must be a whole number, received ${value}.`;\n }\n if (property.minimum !== undefined && value < property.minimum) {\n return `Parameter \"${key}\" must be at least ${property.minimum}, received ${value}.`;\n }\n if (property.maximum !== undefined && value > property.maximum) {\n return `Parameter \"${key}\" must be at most ${property.maximum}, received ${value}.`;\n }\n }\n }\n\n return null;\n}\n\nfunction harden(descriptor: ToolDescriptor): ToolDescriptor {\n const execute = async (\n inputs: Record<string, unknown>,\n context: ToolExecuteContext,\n ): Promise<string | null> => {\n const invalid = validateInputs(descriptor.inputSchema, inputs ?? {});\n if (invalid !== null) return invalid;\n\n try {\n const result = await descriptor.execute(inputs ?? {}, context);\n return result === null ? null : clamp(result, TOOL_OUTPUT_LIMIT);\n } catch (error) {\n const reason = error instanceof Error ? error.message : String(error);\n return clamp(`Tool \"${descriptor.name}\" failed: ${reason}`, TOOL_OUTPUT_LIMIT);\n }\n };\n\n return { ...descriptor, execute };\n}\n\nexport function registerTool(descriptor: ToolDescriptor, signal: AbortSignal): boolean {\n assertDescriptorLimits(descriptor);\n\n const context = getModelContext();\n if (context === null) return false;\n if (signal.aborted) return false;\n\n const result = context.registerTool(harden(descriptor), { signal });\n if (result instanceof Promise) {\n result.catch((error: unknown) => {\n console.warn(`Sprint could not register tool \"${descriptor.name}\"`, error);\n });\n }\n\n return true;\n}\n","import {\n COMPONENT_ATTRIBUTE,\n OWNER_ATTRIBUTE,\n PART_ATTRIBUTE,\n REGION_ATTRIBUTE,\n STATE_ATTRIBUTE_PREFIX,\n TOOL_ATTRIBUTE,\n} from \"./attributes.ts\";\nimport type { AgentComponentMeta, AgentManifest } from \"./types.ts\";\nimport { TOOL_OUTPUT_LIMIT } from \"./webmcp/adapter.ts\";\n\nexport const TOOL_NAMING_CONVENTION = \"<scope>-<verb>-<label-slug>\";\n\nconst registry = new Map<string, AgentComponentMeta>();\n\nexport function defineAgentMeta<const T extends AgentComponentMeta>(meta: T): T {\n const existing = registry.get(meta.name);\n if (existing !== undefined && existing !== meta) {\n console.warn(\n `Agent metadata for \"${meta.name}\" was replaced. Two components sharing a name will collapse into one manifest entry.`,\n );\n }\n registry.set(meta.name, meta);\n return meta;\n}\n\nexport function getAgentMeta(name: string): AgentComponentMeta | undefined {\n return registry.get(name);\n}\n\nexport function listAgentMeta(): AgentComponentMeta[] {\n return [...registry.values()].sort((a, b) => a.name.localeCompare(b.name));\n}\n\nexport function buildAgentManifest(version: string): AgentManifest {\n return {\n library: \"sprint\",\n version,\n conventions: {\n componentAttribute: COMPONENT_ATTRIBUTE,\n partAttribute: PART_ATTRIBUTE,\n stateAttributePrefix: STATE_ATTRIBUTE_PREFIX,\n toolAttribute: TOOL_ATTRIBUTE,\n ownerAttribute: OWNER_ATTRIBUTE,\n regionAttribute: REGION_ATTRIBUTE,\n agentViewFormat: \"markdown\",\n toolNaming: TOOL_NAMING_CONVENTION,\n toolOutputLimit: TOOL_OUTPUT_LIMIT,\n },\n components: listAgentMeta(),\n };\n}\n","export type AgentStateValue = string | true;\n\nexport interface AgentPart {\n part: string;\n label?: string;\n state: Record<string, AgentStateValue>;\n tool?: string;\n}\n\nexport interface AgentNode {\n component: string;\n summary?: string;\n label?: string;\n state: Record<string, AgentStateValue>;\n parts: AgentPart[];\n tool?: string;\n owner?: string;\n region?: true;\n children: AgentNode[];\n truncated?: true;\n}\n\nexport type AgentFormatter = (nodes: readonly AgentNode[]) => string;\n\nexport function isEmptyNode(node: AgentNode): boolean {\n return (\n node.label === undefined && node.parts.length === 0 && node.children.length === 0\n );\n}\n\nexport function countNodes(nodes: readonly AgentNode[]): number {\n let total = 0;\n for (const node of nodes) {\n total += 1 + countNodes(node.children);\n }\n return total;\n}\n\nexport function collectTools(nodes: readonly AgentNode[]): string[] {\n const names: string[] = [];\n for (const node of nodes) {\n if (node.tool) names.push(node.tool);\n for (const part of node.parts) {\n if (part.tool) names.push(part.tool);\n }\n names.push(...collectTools(node.children));\n }\n return names;\n}\n","import type { AgentNode, AgentPart, AgentStateValue } from \"./node.ts\";\nimport { isEmptyNode } from \"./node.ts\";\n\nexport interface MarkdownOptions {\n includeSummary?: boolean;\n}\n\nfunction formatState(state: Record<string, AgentStateValue>): string {\n const keys = Object.keys(state).sort();\n if (keys.length === 0) return \"\";\n\n const rendered = keys.map((key) => {\n const value = state[key];\n return value === true ? key : `${key}=${value}`;\n });\n\n return ` [${rendered.join(\", \")}]`;\n}\n\nfunction formatLabel(label: string | undefined): string {\n return label === undefined ? \"\" : ` \"${label}\"`;\n}\n\nfunction formatTool(tool: string | undefined): string {\n return tool === undefined ? \"\" : ` → tool \\`${tool}\\``;\n}\n\nfunction partLine(part: AgentPart, indent: string): string {\n return `${indent}- part \\`${part.part}\\`${formatLabel(part.label)}${formatState(\n part.state,\n )}${formatTool(part.tool)}`;\n}\n\nexport function nodeLine(node: AgentNode): string {\n const suffix = isEmptyNode(node) ? \" (empty)\" : \"\";\n const owned = node.owner === undefined ? \"\" : ` (owned by \\`${node.owner}\\`)`;\n return `- **${node.component}**${formatLabel(node.label)}${formatState(\n node.state,\n )}${formatTool(node.tool)}${owned}${suffix}`;\n}\n\nfunction nodeLines(\n node: AgentNode,\n indent: string,\n options: Required<MarkdownOptions>,\n): string[] {\n const lines = [`${indent}${nodeLine(node)}`];\n\n const inner = `${indent} `;\n\n if (options.includeSummary && node.summary !== undefined) {\n for (const line of node.summary.split(\"\\n\")) {\n lines.push(`${inner}${line}`);\n }\n }\n\n for (const part of node.parts) {\n lines.push(partLine(part, inner));\n }\n\n for (const child of node.children) {\n lines.push(...nodeLines(child, inner, options));\n }\n\n if (node.truncated) {\n lines.push(`${inner}- … nested components omitted, depth limit reached`);\n }\n\n return lines;\n}\n\nexport function toMarkdown(\n input: AgentNode | readonly AgentNode[],\n options: MarkdownOptions = {},\n): string {\n const nodes = Array.isArray(input) ? input : [input as AgentNode];\n const resolved: Required<MarkdownOptions> = {\n includeSummary: options.includeSummary ?? true,\n };\n\n if (nodes.length === 0) return \"No Sprint components found.\";\n\n return nodes.flatMap((node) => nodeLines(node, \"\", resolved)).join(\"\\n\");\n}\n","import { createContext, useContext } from \"react\";\nimport { toMarkdown } from \"./markdown.ts\";\nimport type { AgentFormatter } from \"./node.ts\";\n\nexport type SprintView = \"human\" | \"agent\";\n\nexport type SprintAgentControls = \"always\" | \"never\";\n\nexport const defaultAgentFormat: AgentFormatter = (nodes) => toMarkdown(nodes);\n\nexport interface SprintViewValue {\n view: SprintView;\n setView: (view: SprintView) => void;\n controls: SprintAgentControls;\n format: AgentFormatter;\n owned: boolean;\n}\n\nconst ViewContext = createContext<SprintViewValue>({\n view: \"human\",\n setView: () => {},\n controls: \"always\",\n format: defaultAgentFormat,\n owned: false,\n});\n\nexport const SprintViewProvider = ViewContext.Provider;\n\nexport function useSprintView(): SprintView {\n return useContext(ViewContext).view;\n}\n\nexport function useSprintViewControl(): SprintViewValue {\n return useContext(ViewContext);\n}\n\nexport function useAgentControls(): SprintAgentControls {\n return useContext(ViewContext).controls;\n}\n\nexport function useAgentFormat(): AgentFormatter {\n return useContext(ViewContext).format;\n}\n\nconst DepthContext = createContext(0);\n\nexport const AgentDepthProvider = DepthContext.Provider;\n\nexport function useAgentDepth(): number {\n return useContext(DepthContext);\n}\n","import {\n AGENT_ATTRIBUTE,\n agentAttributes,\n COMPONENT_ATTRIBUTE,\n PART_ATTRIBUTE,\n TOOL_ATTRIBUTE,\n} from \"@/agent/attributes.ts\";\nimport type { AgentNode, AgentPart, AgentStateValue } from \"./node.ts\";\n\nexport interface NodeInput {\n component: string;\n label?: string | undefined;\n summary?: string | undefined;\n tool?: string | undefined;\n owner?: string | undefined;\n region?: boolean | undefined;\n state?: Record<string, AgentStateValue | false | null | undefined>;\n parts?: AgentPart[];\n}\n\nexport function buildAgentNode(input: NodeInput): AgentNode {\n const state: Record<string, AgentStateValue> = {};\n for (const [key, value] of Object.entries(input.state ?? {})) {\n if (value === false || value === null || value === undefined) continue;\n state[key] = value;\n }\n\n return {\n component: input.component,\n state,\n parts: input.parts ?? [],\n children: [],\n ...(input.label === undefined ? {} : { label: input.label }),\n ...(input.summary === undefined ? {} : { summary: input.summary }),\n ...(input.tool === undefined ? {} : { tool: input.tool }),\n ...(input.owner === undefined ? {} : { owner: input.owner }),\n ...(input.region === true ? { region: true as const } : {}),\n };\n}\n\nexport function agentAttributesFor(node: AgentNode): Record<string, string> {\n return agentAttributes(node.component, {\n state: {\n ...node.state,\n tool: node.tool,\n owner: node.owner,\n region: node.region,\n },\n });\n}\n\nexport function agentControlSelector(component: string, tool?: string): string {\n return tool === undefined\n ? `[${AGENT_ATTRIBUTE}=\"${component}\"]`\n : `[${TOOL_ATTRIBUTE}=\"${tool}\"]`;\n}\n\nexport function agentControlAttributes(node: AgentNode): Record<string, string> {\n const attributes: Record<string, string> = { [AGENT_ATTRIBUTE]: node.component };\n if (node.tool !== undefined) attributes[TOOL_ATTRIBUTE] = node.tool;\n return attributes;\n}\n\nexport function agentPartControlAttributes(\n component: string,\n part: AgentPart,\n): Record<string, string> {\n const attributes: Record<string, string> = {\n [AGENT_ATTRIBUTE]: component,\n [PART_ATTRIBUTE]: part.part,\n };\n if (part.tool !== undefined) attributes[TOOL_ATTRIBUTE] = part.tool;\n return attributes;\n}\n\nexport function agentPartAttributesFor(part: AgentPart): Record<string, string> {\n const { [COMPONENT_ATTRIBUTE]: _root, ...attributes } = agentAttributes(\"\", {\n part: part.part,\n state: { ...part.state, tool: part.tool },\n });\n return attributes;\n}\n","import {\n type ComponentPropsWithRef,\n Fragment,\n type MouseEventHandler,\n type ReactNode,\n type Ref,\n} from \"react\";\nimport { AgentDepthProvider, useAgentDepth, useAgentFormat } from \"./mode.ts\";\nimport type { AgentFormatter, AgentNode, AgentPart } from \"./node.ts\";\nimport { agentControlAttributes, agentPartControlAttributes } from \"./project.ts\";\n\nfunction format(node: AgentNode, formatter: AgentFormatter): string[] {\n return formatter([node]).split(\"\\n\");\n}\n\nexport interface AgentLineProps {\n node: AgentNode;\n children?: ReactNode;\n silent?: boolean;\n}\n\nexport function AgentLine(props: AgentLineProps) {\n const { node, children, silent = false } = props;\n const depth = useAgentDepth();\n const formatter = useAgentFormat();\n const indent = \" \".repeat(depth);\n const lines = format(node, formatter).map((line) => `${indent}${line}`);\n\n return (\n <AgentDepthProvider value={silent ? depth : depth + 1}>\n {silent ? null : `${lines.join(\"\\n\")}\\n`}\n {children}\n </AgentDepthProvider>\n );\n}\n\nexport interface AgentControlGroupProps {\n node: AgentNode;\n onActivate: (part: AgentPart, index: number) => void;\n isActionable?: (part: AgentPart, index: number) => boolean;\n children?: ReactNode;\n}\n\nexport function AgentControlGroup(props: AgentControlGroupProps) {\n const { node, onActivate, isActionable, children } = props;\n const depth = useAgentDepth();\n const formatter = useAgentFormat();\n const indent = \" \".repeat(depth);\n const lines = format(node, formatter);\n const offset = lines.length - node.parts.length;\n const head = lines.slice(0, offset).map((line) => `${indent}${line}`);\n\n return (\n <AgentDepthProvider value={depth + 1}>\n {`${head.join(\"\\n\")}\\n`}\n {node.parts.map((part, index) => {\n const line = lines[offset + index] ?? \"\";\n const body = line.trimStart();\n const lead = `${indent}${line.slice(0, line.length - body.length)}`;\n const key = `${part.part}-${part.label ?? index}`;\n\n if (isActionable !== undefined && !isActionable(part, index)) {\n return <Fragment key={key}>{`${lead}${body}\\n`}</Fragment>;\n }\n\n return (\n <Fragment key={key}>\n {lead}\n <button\n type=\"button\"\n {...agentPartControlAttributes(node.component, part)}\n onClick={() => onActivate(part, index)}\n >\n {body}\n </button>\n {\"\\n\"}\n </Fragment>\n );\n })}\n {children}\n </AgentDepthProvider>\n );\n}\n\nexport type AgentFieldControlProps = {\n node: AgentNode;\n value: string;\n onValueChange: (value: string) => void;\n multiline?: boolean;\n masked?: boolean;\n ref?: Ref<HTMLInputElement> | Ref<HTMLTextAreaElement> | undefined;\n};\n\nexport function AgentFieldControl(props: AgentFieldControlProps) {\n const { node, value, onValueChange, multiline = false, masked = false, ref } = props;\n const depth = useAgentDepth();\n const formatter = useAgentFormat();\n const indent = \" \".repeat(depth);\n const lines = format(node, formatter).map((line) => `${indent}${line}`);\n const attributes = agentControlAttributes(node);\n\n const control = multiline ? (\n <textarea\n {...attributes}\n aria-label={node.label}\n value={value}\n onChange={(event) => onValueChange(event.currentTarget.value)}\n ref={ref as Ref<HTMLTextAreaElement>}\n />\n ) : (\n <input\n {...attributes}\n aria-label={node.label}\n type={masked ? \"password\" : \"text\"}\n value={value}\n onChange={(event) => onValueChange(event.currentTarget.value)}\n ref={ref as Ref<HTMLInputElement>}\n />\n );\n\n return (\n <AgentDepthProvider value={depth + 1}>\n {`${lines.join(\"\\n\")}\\n`}\n {indent}\n {control}\n {\"\\n\"}\n </AgentDepthProvider>\n );\n}\n\nexport type AgentControlProps = Omit<\n ComponentPropsWithRef<\"button\">,\n \"children\" | \"ref\" | \"onClick\"\n> & {\n node: AgentNode;\n as?: \"button\" | \"a\" | undefined;\n href?: string | undefined;\n target?: string | undefined;\n rel?: string | undefined;\n onClick?:\n | MouseEventHandler<HTMLButtonElement>\n | MouseEventHandler<HTMLAnchorElement>\n | undefined;\n ref?: Ref<HTMLButtonElement> | Ref<HTMLAnchorElement> | undefined;\n children?: ReactNode;\n};\n\nexport function AgentControl(props: AgentControlProps) {\n const { node, as = \"button\", href, children, ref, ...rest } = props;\n const depth = useAgentDepth();\n const formatter = useAgentFormat();\n const indent = \" \".repeat(depth);\n const [head = \"\", ...rows] = format(node, formatter);\n const tail = rows.map((line) => `${indent}${line}`);\n const attributes = agentControlAttributes(node);\n\n const control =\n as === \"a\" ? (\n <a\n {...(rest as unknown as ComponentPropsWithRef<\"a\">)}\n {...attributes}\n href={href ?? \"#\"}\n ref={ref as Ref<HTMLAnchorElement>}\n >\n {head}\n </a>\n ) : (\n <button\n {...(rest as unknown as ComponentPropsWithRef<\"button\">)}\n {...attributes}\n ref={ref as Ref<HTMLButtonElement>}\n >\n {head}\n </button>\n );\n\n return (\n <AgentDepthProvider value={depth + 1}>\n {indent}\n {control}\n {tail.length === 0 ? \"\\n\" : `\\n${tail.join(\"\\n\")}\\n`}\n {children}\n </AgentDepthProvider>\n );\n}\n","import type { AgentNode, AgentPart } from \"./node.ts\";\n\nfunction isCell(part: AgentPart): boolean {\n return (\n part.part === \"cell\" &&\n typeof part.state.column === \"string\" &&\n typeof part.state.row === \"string\"\n );\n}\n\nfunction text(value: string): string {\n return value.replace(/\\|/g, \"\\\\|\").replace(/\\s*\\n\\s*/g, \" \");\n}\n\nfunction cellKey(row: string, column: string): string {\n return JSON.stringify([row, column]);\n}\n\nexport function condenseCells(node: AgentNode): AgentNode {\n if (node.parts.length === 0 || !node.parts.every(isCell)) return node;\n\n const columns: string[] = [];\n const rowIds: string[] = [];\n const cells = new Map<string, string>();\n\n for (const part of node.parts) {\n const column = String(part.state.column);\n const row = String(part.state.row);\n if (!columns.includes(column)) columns.push(column);\n if (!rowIds.includes(row)) rowIds.push(row);\n cells.set(cellKey(row, column), part.label ?? \"\");\n }\n\n const summary = [\n `| row | ${columns.map(text).join(\" | \")} |`,\n `| --- | ${columns.map(() => \"---\").join(\" | \")} |`,\n ...rowIds.map(\n (row) =>\n `| ${text(row)} | ${columns\n .map((column) => text(cells.get(cellKey(row, column)) ?? \"\"))\n .join(\" | \")} |`,\n ),\n ].join(\"\\n\");\n\n return { ...node, parts: [], summary };\n}\n","import { isValidElement, type ReactNode } from \"react\";\nimport { COMPONENT_ATTRIBUTE } from \"@/agent/attributes.ts\";\n\nfunction normalize(value: string): string {\n return value.replace(/\\s+/g, \" \").trim();\n}\n\ninterface TextualProps {\n children?: ReactNode;\n \"aria-hidden\"?: boolean | string;\n \"aria-label\"?: string;\n}\n\nfunction gatherReact(node: ReactNode, out: string[]): void {\n if (node === null || node === undefined || typeof node === \"boolean\") return;\n\n if (typeof node === \"string\" || typeof node === \"number\") {\n out.push(String(node));\n return;\n }\n\n if (Array.isArray(node)) {\n for (const child of node) gatherReact(child as ReactNode, out);\n return;\n }\n\n if (!isValidElement(node)) return;\n\n const props = node.props as TextualProps;\n if (props[\"aria-hidden\"] === true || props[\"aria-hidden\"] === \"true\") return;\n if (typeof props[\"aria-label\"] === \"string\") {\n out.push(props[\"aria-label\"]);\n return;\n }\n\n gatherReact(props.children, out);\n}\n\nexport function reactText(node: ReactNode): string | undefined {\n const parts: string[] = [];\n gatherReact(node, parts);\n const text = normalize(parts.join(\"\"));\n return text === \"\" ? undefined : text;\n}\n\nfunction isHidden(element: Element): boolean {\n return (\n element.getAttribute(\"aria-hidden\") === \"true\" || element.hasAttribute(\"hidden\")\n );\n}\n\nfunction gather(node: Node, out: string[], depth: number): void {\n if (node.nodeType === Node.TEXT_NODE) {\n out.push(node.nodeValue ?? \"\");\n return;\n }\n\n if (node.nodeType !== Node.ELEMENT_NODE) return;\n\n const element = node as Element;\n if (isHidden(element)) return;\n if (depth > 0 && element.hasAttribute(COMPONENT_ATTRIBUTE)) return;\n\n const label = element.getAttribute(\"aria-label\");\n if (depth > 0 && label !== null) {\n out.push(label);\n return;\n }\n\n for (const child of Array.from(element.childNodes)) {\n gather(child, out, depth + 1);\n }\n}\n\nexport function accessibleText(element: Element): string | undefined {\n const label = element.getAttribute(\"aria-label\");\n if (label !== null) {\n const direct = normalize(label);\n return direct === \"\" ? undefined : direct;\n }\n\n const labelledBy = element.getAttribute(\"aria-labelledby\");\n if (labelledBy !== null) {\n const root = element.ownerDocument;\n const referenced = labelledBy\n .split(/\\s+/)\n .filter((id) => id !== \"\")\n .map((id) => root.getElementById(id))\n .filter((target): target is HTMLElement => target !== null)\n .map((target) => accessibleText(target) ?? \"\")\n .filter((text) => text !== \"\");\n if (referenced.length > 0) return normalize(referenced.join(\" \"));\n }\n\n const parts: string[] = [];\n gather(element, parts, 0);\n const text = normalize(parts.join(\"\"));\n return text === \"\" ? undefined : text;\n}\n","import {\n COMPONENT_ATTRIBUTE,\n OWNER_ATTRIBUTE,\n PART_ATTRIBUTE,\n REGION_ATTRIBUTE,\n RESERVED_STATE_KEYS,\n STATE_ATTRIBUTE_PREFIX,\n TOOL_ATTRIBUTE,\n} from \"@/agent/attributes.ts\";\nimport { getAgentMeta } from \"@/agent/registry.ts\";\nimport type { AgentComponentMeta } from \"@/agent/types.ts\";\nimport type { AgentNode, AgentPart, AgentStateValue } from \"./node.ts\";\nimport { condenseCells } from \"./tabular.ts\";\nimport { accessibleText } from \"./text.ts\";\n\nconst reserved = new Set(RESERVED_STATE_KEYS);\n\nconst NATIVE_BOOLEAN_STATE: ReadonlyMap<string, string> = new Map([\n [\"disabled\", \"disabled\"],\n [\"open\", \"open\"],\n [\"readonly\", \"readonly\"],\n [\"required\", \"required\"],\n]);\n\nconst ARIA_STATE: ReadonlyMap<string, string> = new Map([\n [\"aria-disabled\", \"disabled\"],\n [\"aria-busy\", \"loading\"],\n [\"aria-expanded\", \"expanded\"],\n [\"aria-checked\", \"checked\"],\n [\"aria-selected\", \"selected\"],\n [\"aria-pressed\", \"pressed\"],\n [\"aria-invalid\", \"invalid\"],\n]);\n\nexport interface SerializeOptions {\n maxDepth?: number;\n lookupMeta?: (name: string) => AgentComponentMeta | undefined;\n}\n\nfunction readState(element: Element): Record<string, AgentStateValue> {\n const state: Record<string, AgentStateValue> = {};\n\n for (const [attribute, key] of ARIA_STATE) {\n const value = element.getAttribute(attribute);\n if (value === null || value === \"false\") continue;\n state[key] = value === \"true\" || value === \"\" ? true : value;\n }\n\n for (const [attribute, key] of NATIVE_BOOLEAN_STATE) {\n if (element.hasAttribute(attribute)) state[key] = true;\n }\n\n for (const attribute of Array.from(element.attributes)) {\n if (!attribute.name.startsWith(STATE_ATTRIBUTE_PREFIX)) continue;\n const key = attribute.name.slice(STATE_ATTRIBUTE_PREFIX.length);\n if (key === \"\" || reserved.has(key)) continue;\n state[key] = attribute.value === \"\" ? true : attribute.value;\n }\n\n return state;\n}\n\nfunction scan(root: Element): { parts: Element[]; children: Element[] } {\n const parts: Element[] = [];\n const children: Element[] = [];\n\n const walk = (element: Element): void => {\n for (const child of Array.from(element.children)) {\n if (child.hasAttribute(COMPONENT_ATTRIBUTE)) {\n children.push(child);\n continue;\n }\n if (child.hasAttribute(PART_ATTRIBUTE)) parts.push(child);\n walk(child);\n }\n };\n\n walk(root);\n return { parts, children };\n}\n\nfunction toPart(element: Element): AgentPart {\n const name = element.getAttribute(PART_ATTRIBUTE) ?? \"\";\n const label = accessibleText(element);\n const tool = element.getAttribute(TOOL_ATTRIBUTE);\n return {\n part: name,\n state: readState(element),\n ...(label === undefined ? {} : { label }),\n ...(tool === null || tool === \"\" ? {} : { tool }),\n };\n}\n\nexport function serializeElement(\n root: Element,\n options: SerializeOptions = {},\n): AgentNode | null {\n const component = root.getAttribute(COMPONENT_ATTRIBUTE);\n if (component === null) return null;\n\n const maxDepth = options.maxDepth ?? 8;\n const lookupMeta = options.lookupMeta ?? getAgentMeta;\n\n const { parts, children } = scan(root);\n const label = accessibleText(root);\n const summary = lookupMeta(component)?.summary;\n const tool = root.getAttribute(TOOL_ATTRIBUTE);\n const owner = root.getAttribute(OWNER_ATTRIBUTE);\n const exhausted = maxDepth <= 0 && children.length > 0;\n\n return condenseCells({\n component,\n state: readState(root),\n parts: parts.map(toPart),\n children: exhausted\n ? []\n : children\n .map((child) =>\n serializeElement(child, { ...options, maxDepth: maxDepth - 1 }),\n )\n .filter((node): node is AgentNode => node !== null),\n ...(summary === undefined ? {} : { summary }),\n ...(label === undefined ? {} : { label }),\n ...(tool === null || tool === \"\" ? {} : { tool }),\n ...(owner === null || owner === \"\" ? {} : { owner }),\n ...(root.hasAttribute(REGION_ATTRIBUTE) ? { region: true as const } : {}),\n ...(exhausted ? { truncated: true as const } : {}),\n });\n}\n\nexport function topLevelRoots(root: ParentNode): Element[] {\n const found: Element[] = [];\n\n const walk = (element: ParentNode): void => {\n for (const child of Array.from(element.children)) {\n if (child.hasAttribute(COMPONENT_ATTRIBUTE)) {\n found.push(child);\n continue;\n }\n walk(child);\n }\n };\n\n walk(root);\n return found;\n}\n\nfunction reattachOwned(nodes: AgentNode[]): AgentNode[] {\n const owned = nodes.filter((node) => node.owner !== undefined);\n if (owned.length === 0) return nodes;\n\n const byTool = new Map<string, AgentNode>();\n const index = (node: AgentNode): void => {\n if (node.tool) byTool.set(node.tool, node);\n for (const part of node.parts) {\n if (part.tool) byTool.set(part.tool, node);\n }\n for (const child of node.children) index(child);\n };\n for (const node of nodes) index(node);\n\n const attached = new Set<AgentNode>();\n for (const node of owned) {\n const host = node.owner === undefined ? undefined : byTool.get(node.owner);\n if (host === undefined || host === node) continue;\n host.children.push(node);\n attached.add(node);\n }\n\n return nodes.filter((node) => !attached.has(node));\n}\n\nexport function serializeWithin(\n root: ParentNode,\n options: SerializeOptions = {},\n): AgentNode[] {\n const nodes = topLevelRoots(root)\n .map((element) => serializeElement(element, options))\n .filter((node): node is AgentNode => node !== null);\n return reattachOwned(nodes);\n}\n","export function afterCommit(): Promise<void> {\n return new Promise((resolve) => {\n if (typeof requestAnimationFrame !== \"function\") {\n setTimeout(resolve, 0);\n return;\n }\n requestAnimationFrame(() => {\n requestAnimationFrame(() => resolve());\n });\n });\n}\n","import { createContext, useContext } from \"react\";\n\nexport const MAX_NAME_LENGTH = 48;\n\nexport function slug(value: string): string {\n return value\n .normalize(\"NFKD\")\n .replace(/[̀-ͯ]/g, \"\")\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, \"-\")\n .replace(/^-+|-+$/g, \"\");\n}\n\nexport function toolName(\n scope: readonly string[],\n verb: string,\n label: string,\n): string | null {\n const tail = slug(label);\n if (tail === \"\") return null;\n\n const core = [slug(verb), tail].filter((part) => part !== \"\").join(\"-\");\n const segments = scope.map(slug).filter((part) => part !== \"\");\n\n while (\n segments.length > 0 &&\n [...segments, core].join(\"-\").length > MAX_NAME_LENGTH\n ) {\n segments.shift();\n }\n\n const name = [...segments, core].join(\"-\");\n if (name.length <= MAX_NAME_LENGTH) return name;\n\n const cut = name.slice(0, MAX_NAME_LENGTH);\n const boundary = cut.lastIndexOf(\"-\");\n return boundary > 0 ? cut.slice(0, boundary) : cut;\n}\n\nexport type ClaimListener = () => void;\n\ninterface Claim {\n holders: Set<symbol>;\n listeners: Map<symbol, ClaimListener>;\n}\n\nconst claims = new Map<string, Claim>();\n\nfunction claimFor(name: string): Claim {\n const existing = claims.get(name);\n if (existing !== undefined) return existing;\n const created: Claim = { holders: new Set(), listeners: new Map() };\n claims.set(name, created);\n return created;\n}\n\nexport function claimToolName(\n name: string,\n holder: symbol,\n onChange: ClaimListener,\n): () => void {\n const claim = claimFor(name);\n claim.holders.add(holder);\n claim.listeners.set(holder, onChange);\n\n for (const [id, listener] of claim.listeners) {\n if (id !== holder) listener();\n }\n\n return () => {\n claim.holders.delete(holder);\n claim.listeners.delete(holder);\n if (claim.holders.size === 0) {\n claims.delete(name);\n return;\n }\n for (const listener of claim.listeners.values()) listener();\n };\n}\n\nexport function holdsToolName(name: string, holder: symbol): boolean {\n const claim = claims.get(name);\n if (claim === undefined) return false;\n return claim.holders.size === 1 && claim.holders.has(holder);\n}\n\nexport function toolNameHolderCount(name: string): number {\n return claims.get(name)?.holders.size ?? 0;\n}\n\nexport function __resetToolNames(): void {\n claims.clear();\n}\n\nexport interface AgentScopeValue {\n path: readonly string[];\n}\n\nconst AgentScopeContext = createContext<AgentScopeValue>({ path: [] });\n\nexport const AgentScopeProvider = AgentScopeContext.Provider;\n\nexport function useAgentScope(): readonly string[] {\n return useContext(AgentScopeContext).path;\n}\n","import { useEffect, useRef, useState } from \"react\";\nimport type { AgentToolSpec } from \"@/agent/types.ts\";\nimport { registerTool } from \"./adapter.ts\";\nimport {\n claimToolName,\n holdsToolName,\n toolName,\n toolNameHolderCount,\n useAgentScope,\n} from \"./scope.ts\";\nimport type { JsonSchemaObject, ToolExecuteContext } from \"./types.ts\";\n\nexport interface UseAgentToolOptions {\n spec: AgentToolSpec;\n label: string | undefined;\n nameOverride?: string | undefined;\n inputSchema?: JsonSchemaObject | undefined;\n enabled?: boolean;\n execute: (\n inputs: Record<string, unknown>,\n context: ToolExecuteContext,\n ) => Promise<string | null> | string | null;\n}\n\nexport function useAgentTool(options: UseAgentToolOptions): string | undefined {\n const { spec, label, nameOverride, inputSchema, enabled = true, execute } = options;\n const scope = useAgentScope();\n\n const schemaKey = `${spec.verb}|${\n inputSchema === undefined ? \"\" : JSON.stringify(inputSchema)\n }`;\n const schemaRef = useRef({ key: schemaKey, value: inputSchema ?? spec.inputSchema });\n if (schemaRef.current.key !== schemaKey) {\n schemaRef.current = { key: schemaKey, value: inputSchema ?? spec.inputSchema };\n }\n const schema = schemaRef.current.value;\n\n const holderRef = useRef<symbol | null>(null);\n if (holderRef.current === null) holderRef.current = Symbol(\"sprint-tool\");\n\n const executeRef = useRef(execute);\n useEffect(() => {\n executeRef.current = execute;\n });\n\n const resolved =\n nameOverride === undefined\n ? label === undefined\n ? null\n : toolName(scope, spec.verb, label)\n : toolName(scope, spec.verb, nameOverride);\n\n const [held, setHeld] = useState(false);\n\n useEffect(() => {\n const holder = holderRef.current;\n if (resolved === null || !enabled || holder === null) {\n setHeld(false);\n return;\n }\n\n const release = claimToolName(resolved, holder, () => {\n setHeld(holdsToolName(resolved, holder));\n });\n\n if (toolNameHolderCount(resolved) > 1) {\n console.warn(\n `Sprint tool name \"${resolved}\" is claimed by more than one component. None of them will register a tool. Set agentName on all but one, or label them distinctly.`,\n );\n }\n\n setHeld(holdsToolName(resolved, holder));\n\n return () => {\n release();\n setHeld(false);\n };\n }, [resolved, enabled]);\n\n useEffect(() => {\n if (!held || resolved === null) return;\n\n const controller = new AbortController();\n registerTool(\n {\n name: resolved,\n description: spec.description,\n inputSchema: schema,\n annotations: {\n readOnlyHint: spec.readOnly,\n untrustedContentHint: spec.untrustedContent,\n },\n execute: (inputs, context) => executeRef.current(inputs, context),\n },\n controller.signal,\n );\n\n return () => {\n controller.abort();\n };\n }, [held, resolved, spec, schema]);\n\n return held && resolved !== null ? resolved : undefined;\n}\n","import { flushSync } from \"react-dom\";\n\nexport function commitSync(action: () => void): void {\n flushSync(action);\n}\n","import type { AgentToolSpec } from \"@/agent/types.ts\";\n\nexport const DISMISS_ALERT_TOOL: AgentToolSpec = {\n verb: \"dismiss\",\n description:\n \"Dismiss this alert, exactly as a person clicking its dismiss control would. The page decides what dismissal means, usually removing the message. Returns the alert's state after the dismissal, or says the alert left the page.\",\n inputSchema: { type: \"object\", properties: {} },\n readOnly: false,\n untrustedContent: true,\n registeredWhen:\n \"The alert is mounted, has an onDismiss handler, and label or agentName provides a stable name.\",\n unregisteredWhen: \"The alert unmounts or loses its onDismiss handler.\",\n};\n","import { defineAgentMeta } from \"@/agent/registry.ts\";\nimport { DISMISS_ALERT_TOOL } from \"./tool.ts\";\n\nexport const alertMeta = defineAgentMeta({\n name: \"Alert\",\n category: \"feedback\",\n summary:\n \"A status message for the outcome of something that already happened: a notice, a warning, or a failure.\",\n whenToUse:\n 'Use to report the result of an action or a condition the person did not just cause: \"check your inbox\", \"invalid credentials\", \"this key expires soon\". Use tone=\"danger\" for failures, \"warning\" for conditions needing attention, \"info\" for neutral notices, and \"neutral\" for quiet confirmations. Pass onDismiss when the message can be acknowledged and cleared.',\n whenNotToUse:\n \"Do not use for validation on a specific field; the field's own error prop places the message where the problem is. Do not use for confirmation of an action the person is about to take; that is a Dialog.\",\n status: \"experimental\",\n props: {\n children: {\n kind: \"node\",\n description:\n \"The message. Inline content only; it is flattened to text for the agent view.\",\n required: true,\n },\n label: {\n kind: \"string\",\n description:\n \"A short uppercase title above the message. Also derives the dismiss tool name, so prefer a stable phrase.\",\n },\n tone: {\n kind: \"enum\",\n description:\n \"The message's severity. Danger and warning announce assertively; info and neutral announce politely.\",\n values: [\"neutral\", \"info\", \"warning\", \"danger\"],\n default: \"info\",\n },\n onDismiss: {\n kind: \"handler\",\n description:\n \"Called when the dismiss control is pressed. Providing it renders the control and registers the dismiss tool; the page owns removing the alert.\",\n },\n agentName: {\n kind: \"string\",\n description:\n \"Override the label used to derive the dismiss tool name. Required for a dismissible alert with no label.\",\n },\n agentTool: {\n kind: \"boolean\",\n description:\n \"Set false to render a dismissible alert without registering a tool.\",\n default: true,\n },\n },\n state: {\n tone: {\n description: \"The alert's severity.\",\n attribute: \"data-sprint-tone\",\n values: [\"neutral\", \"info\", \"warning\", \"danger\"],\n },\n dismissible: {\n description: \"Present when the alert has a dismiss control.\",\n attribute: \"data-sprint-dismissible\",\n },\n },\n tools: {\n dismiss: DISMISS_ALERT_TOOL,\n },\n agentView: {\n example: '- **Alert** \"Check your inbox\" [dismissible, tone=info]',\n },\n examples: [\n {\n title: \"A sign-in notice\",\n description: \"The default info tone for a neutral status message.\",\n code: '<Alert label=\"Check your inbox\">We sent a sign-in link to nomad@escadrille.test.</Alert>',\n },\n {\n title: \"A dismissible confirmation\",\n description:\n \"Providing onDismiss renders the dismiss control and registers the dismiss tool. Removing the alert is the page's job.\",\n code: '<Alert tone=\"neutral\" label=\"Key revoked\" onDismiss={acknowledge}>The key can no longer authenticate.</Alert>',\n },\n {\n title: \"A failure\",\n description: \"Danger announces assertively via role=alert.\",\n code: '<Alert tone=\"danger\" label=\"Sign-in failed\">Wrong callsign or access code.</Alert>',\n },\n ],\n a11y: {\n role: \"status\",\n notes:\n \"Danger and warning render role=alert and announce assertively; info and neutral render role=status. The dismiss control is a labelled button. Render the alert when the condition occurs rather than toggling its visibility, or the announcement is lost.\",\n },\n});\n","import { type ComponentPropsWithRef, useCallback, useEffect, useRef } from \"react\";\nimport { AgentControlGroup, AgentLine } from \"@/agent/view/AgentText.tsx\";\nimport { useAgentControls, useAgentFormat, useSprintView } from \"@/agent/view/mode.ts\";\nimport type { AgentPart } from \"@/agent/view/node.ts\";\nimport {\n agentAttributesFor,\n agentPartAttributesFor,\n buildAgentNode,\n} from \"@/agent/view/project.ts\";\nimport { reactText } from \"@/agent/view/text.ts\";\nimport { afterCommit } from \"@/agent/webmcp/afterCommit.ts\";\nimport { commitSync } from \"@/agent/webmcp/flush.ts\";\nimport { useAgentTool } from \"@/agent/webmcp/useAgentTool.ts\";\nimport { alertMeta } from \"./meta.ts\";\nimport { DISMISS_ALERT_TOOL } from \"./tool.ts\";\nimport \"./Alert.css\";\n\nexport type AlertTone = \"neutral\" | \"info\" | \"warning\" | \"danger\";\n\nexport interface AlertProps extends ComponentPropsWithRef<\"div\"> {\n tone?: AlertTone;\n label?: string;\n onDismiss?: () => void;\n agentName?: string;\n agentTool?: boolean;\n}\n\nexport function Alert(props: AlertProps) {\n const {\n tone = \"info\",\n label,\n onDismiss,\n agentName,\n agentTool = true,\n children,\n ...rest\n } = props;\n\n const view = useSprintView();\n const controls = useAgentControls();\n const formatter = useAgentFormat();\n\n const element = useRef<HTMLButtonElement | null>(null);\n const onDismissRef = useRef(onDismiss);\n onDismissRef.current = onDismiss;\n const formatRef = useRef(formatter);\n formatRef.current = formatter;\n const nodeRef = useRef(buildAgentNode({ component: alertMeta.name }));\n const mounted = useRef(true);\n\n useEffect(() => {\n mounted.current = true;\n return () => {\n mounted.current = false;\n };\n }, []);\n\n const dismissible = onDismiss !== undefined;\n\n const execute = useCallback(async () => {\n const target = element.current;\n if (target !== null) {\n target.click();\n } else {\n const handler = onDismissRef.current;\n if (handler === undefined) return \"This alert cannot be dismissed.\";\n commitSync(() => handler());\n }\n\n await afterCommit();\n if (!mounted.current) return \"Dismissed. The alert is gone from the page.\";\n return `Dismissed. The alert is now:\\n${formatRef.current([nodeRef.current])}`;\n }, []);\n\n const toolName = useAgentTool({\n spec: DISMISS_ALERT_TOOL,\n label: agentName ?? label,\n enabled: agentTool && dismissible,\n execute,\n });\n\n const message = reactText(children);\n\n const parts: AgentPart[] = [];\n if (message !== undefined) {\n parts.push({ part: \"message\", label: message, state: {} });\n }\n if (dismissible) {\n parts.push({\n part: \"dismiss\",\n label: \"Dismiss\",\n state: {},\n ...(toolName === undefined ? {} : { tool: toolName }),\n });\n }\n\n const node = buildAgentNode({\n component: alertMeta.name,\n label,\n state: { tone, dismissible },\n parts,\n });\n nodeRef.current = node;\n\n if (view === \"agent\") {\n if (!dismissible || controls === \"never\") return <AgentLine node={node} />;\n return (\n <AgentControlGroup\n node={node}\n isActionable={(part) => part.part === \"dismiss\"}\n onActivate={() => onDismiss?.()}\n />\n );\n }\n\n const role = tone === \"danger\" || tone === \"warning\" ? \"alert\" : \"status\";\n\n return (\n <div\n {...rest}\n {...agentAttributesFor(node)}\n role={role}\n {...(label === undefined ? {} : { \"aria-label\": label })}\n >\n {label === undefined ? null : (\n <strong {...agentPartAttributesFor({ part: \"title\", state: {} })}>\n {label}\n </strong>\n )}\n <div {...agentPartAttributesFor({ part: \"message\", state: {} })}>{children}</div>\n {dismissible ? (\n <button\n {...agentPartAttributesFor({\n part: \"dismiss\",\n state: {},\n ...(toolName === undefined ? {} : { tool: toolName }),\n })}\n type=\"button\"\n aria-label=\"Dismiss\"\n ref={element}\n onClick={() => onDismiss?.()}\n >\n ×\n </button>\n ) : null}\n </div>\n );\n}\n","import type { AgentToolSpec } from \"@/agent/types.ts\";\n\nexport const ACT_BREADCRUMB_TOOL: AgentToolSpec = {\n verb: \"act\",\n description:\n \"Run one of this breadcrumb's trailing actions by its visible label, exactly as a person pressing it would. Only actions that do something in the page are offered; an action that is a link is reachable by its href instead. Returns the breadcrumb's state after the action, so a follow-up read is usually unnecessary.\",\n inputSchema: {\n type: \"object\",\n properties: {\n action: {\n type: \"string\",\n description:\n \"The visible label of the action to run, as shown at the end of the bar.\",\n },\n },\n required: [\"action\"],\n },\n readOnly: false,\n untrustedContent: true,\n registeredWhen:\n \"The breadcrumb is mounted, has at least one action without an href, and no other component claims the same tool name. The registered schema enumerates those actions' labels.\",\n unregisteredWhen:\n \"The breadcrumb unmounts, or its last action without an href is removed.\",\n};\n","import { defineAgentMeta } from \"@/agent/registry.ts\";\nimport { ACT_BREADCRUMB_TOOL } from \"./tool.ts\";\n\nexport const breadcrumbMeta = defineAgentMeta({\n name: \"Breadcrumb\",\n category: \"navigation\",\n summary:\n \"A navigation landmark that renders as one line: the path to the current page, where every crumb opens the level it sits in. Every destination in the tree stays in the page as an addressable part; the crumbs decide which of them a person is shown.\",\n whenToUse:\n \"Use it as an application's primary navigation when the destinations form a tree, or when the catalogue is larger than a rail can hold. A crumb opens its siblings, a branch drills into its children, and typing in an open crumb searches the whole tree, so what a person chooses from is one level rather than the whole set. Put a page-level command or two in actions. It takes destinations as data because it counts, filters and orders them.\",\n whenNotToUse:\n \"Do not use it for a handful of links that fit in a sidebar; that is Nav with NavGroup, which keeps every destination visible at once. Do not use it for links inside prose, and do not pass components in items or actions: each destination is a label, an href and its children, not a node.\",\n status: \"experimental\",\n props: {\n label: {\n kind: \"string\",\n description:\n \"What this navigation is for. Rendered as the landmark's accessible name and as the root of the path.\",\n required: true,\n },\n href: {\n kind: \"string\",\n description:\n \"Where the root of the path leads, such as the list a detail page belongs to. Without it the root is plain text.\",\n },\n items: {\n kind: \"array\",\n description:\n \"The destinations, as a tree of { label, href?, active?, external?, children? }. The item marked active is the current page, and the crumbs are the path to it. A branch without an href is a level, not a destination.\",\n required: true,\n },\n actions: {\n kind: \"array\",\n description:\n \"Commands for the whole page, rendered at the end of the bar, as { label, href?, external?, onSelect? }. An action with an href is a link; one without runs onSelect.\",\n },\n maxCrumbs: {\n kind: \"number\",\n description:\n \"How many crumbs the bar shows before it folds the middle of the path behind an ellipsis. On a narrow screen every crumb but the last folds regardless.\",\n default: 4,\n },\n emptyLabel: {\n kind: \"string\",\n description: \"What the bar says when a filter matches no destination.\",\n default: \"No match\",\n },\n trailEmptyLabel: {\n kind: \"string\",\n description: \"What the bar says when nothing has been visited through it yet.\",\n default: \"Nothing visited yet\",\n },\n open: {\n kind: \"string\",\n description:\n \"Which crumb is open, as its depth from 0, or 'trail', or 'closed'. Pass it to drive the bar from outside, such as from an application-level shortcut; leave it off and the bar keeps its own state.\",\n },\n onOpenChange: {\n kind: \"handler\",\n description:\n \"Called with the crumb depth the bar wants open, 'trail', or 'closed'. Required when open is controlled, so the bar can still close itself.\",\n },\n defaultVisited: {\n kind: \"array\",\n description:\n \"The hrefs already visited, oldest first, to seed the trail with. Use it to restore a trail recorded through onNavigate when the bar remounts.\",\n },\n visited: {\n kind: \"array\",\n description:\n \"The trail as hrefs, oldest first, when the owner keeps it. Leave it off and the bar keeps its own trail for as long as it is mounted.\",\n },\n onNavigate: {\n kind: \"handler\",\n description:\n \"Called with the item when a destination is chosen, before the browser follows the href. Use it to record the visit somewhere that outlives this component.\",\n },\n agentName: {\n kind: \"string\",\n description: \"Overrides the label when deriving the action tool's name.\",\n },\n agentTool: {\n kind: \"boolean\",\n description: \"Whether actions without an href register a WebMCP tool.\",\n default: true,\n },\n },\n state: {\n href: {\n description:\n \"On the root: where the root of the path leads. On a destination or an action: where it goes.\",\n attribute: \"data-sprint-href\",\n },\n recency: {\n description:\n \"On a group of results while the trail is open: 1 for the group visited most recently, counting up. Orders the groups without a style attribute.\",\n attribute: \"data-sprint-recency\",\n },\n path: {\n description:\n \"The path to the current page, labels joined by ' / '. Absent when no item is active.\",\n attribute: \"data-sprint-path\",\n },\n destinations: {\n description: \"How many destinations the tree holds.\",\n attribute: \"data-sprint-destinations\",\n },\n visited: {\n description: \"How many destinations have been visited through this bar.\",\n attribute: \"data-sprint-visited\",\n },\n open: {\n description:\n \"Which crumb is open, as its depth, or trail. Absent when the bar is closed to its one line.\",\n attribute: \"data-sprint-open\",\n },\n matches: {\n description: \"How many entries the open crumb is showing.\",\n attribute: \"data-sprint-matches\",\n },\n shown: {\n description:\n \"On a destination: present when the open crumb is currently showing it to a person. Every destination stays in the page either way.\",\n attribute: \"data-sprint-shown\",\n },\n parent: {\n description:\n \"On a destination: the labels of the levels above it, joined by ' / '.\",\n attribute: \"data-sprint-parent\",\n },\n active: {\n description: \"On a destination: present when it is the current page.\",\n attribute: \"data-sprint-active\",\n },\n ancestor: {\n description:\n \"On a destination: present when it is on the path to the current page.\",\n attribute: \"data-sprint-ancestor\",\n },\n },\n tools: { act: ACT_BREADCRUMB_TOOL },\n agentView: {\n example:\n '- **Breadcrumb** \"Workbench\" [destinations=2, path=display / Table, visited=0] → tool `act-workbench`\\n - part `action` \"Copy link\"\\n - part `destination` \"Button\" [href=#/Button, parent=action]\\n - part `destination` \"Table\" [active, href=#/Table, parent=display]',\n },\n a11y: {\n role: \"navigation\",\n notes:\n \"The label is the landmark's accessible name and the crumbs are an ordered list, the current one carrying aria-current=page. Destinations the open crumb is not showing are hidden from the accessibility tree by CSS, so a screen reader travels one level at a time exactly as a sighted reader does, while the page itself keeps all of them. From the field, ArrowDown enters the results and ArrowUp at the top returns to it; typing anywhere in the results goes back to the field and keeps the character. Enter takes the first result. Escape closes the bar, as does a press outside it, and the match count is a polite live region. ArrowUp in an empty field recalls the trail, the way a console recalls history. The ellipsis that folds the middle of the path is a toggle with aria-expanded.\",\n },\n relatedComponents: [\"Nav\", \"NavGroup\", \"Link\", \"Shell\"],\n examples: [\n {\n title: \"A path you can edit\",\n description:\n \"One line of chrome over a tree. Each crumb opens the level it sits in and filters it as you type; a branch drills into its children.\",\n code: '<Breadcrumb\\n label=\"Workbench\"\\n items={[\\n { label: \"action\", children: [{ href: \"#/Button\", label: \"Button\" }] },\\n {\\n label: \"display\",\\n children: [{ href: \"#/Table\", label: \"Table\", active: true }],\\n },\\n ]}\\n/>',\n },\n {\n title: \"A deep path that folds\",\n description:\n \"Past maxCrumbs the middle of the path folds behind an ellipsis, which unfolds it again. A crumb that is open is never folded.\",\n code: '<Breadcrumb\\n label=\"Store\"\\n maxCrumbs={3}\\n items={[\\n {\\n label: \"Clothing\",\\n href: \"#/clothing\",\\n children: [\\n {\\n label: \"Outerwear\",\\n href: \"#/clothing/outerwear\",\\n children: [\\n {\\n label: \"Jackets\",\\n href: \"#/clothing/outerwear/jackets\",\\n children: [{ label: \"Rain shell\", href: \"#/rain-shell\", active: true }],\\n },\\n ],\\n },\\n ],\\n },\\n ]}\\n/>',\n },\n {\n title: \"Trailing actions\",\n description:\n \"Commands for the whole page sit at the end of the bar. A link action publishes its href; one with onSelect registers a WebMCP tool, since an agent has no URL to reach it by.\",\n code: '<Breadcrumb\\n label=\"Docs\"\\n items={[{ label: \"guides\", children: [{ href: \"#/guide/webmcp\", label: \"WebMCP\", active: true }] }]}\\n actions={[\\n { label: \"Copy link\", onSelect: () => navigator.clipboard.writeText(location.href) },\\n { label: \"Source\", href: \"https://github.com/westonkd/sprint\", external: true },\\n ]}\\n/>',\n },\n {\n title: \"A root that leads back\",\n description:\n 'Give the root an href and it becomes a link back to the list the page belongs to, the way \"People\" leads from a person back to everyone.',\n code: '<Breadcrumb\\n label=\"People\"\\n href=\"#/people\"\\n items={[\\n {\\n label: \"Admin\",\\n href: \"#/people?role=admin\",\\n children: [{ label: \"Tess Ocampo\", href: \"#/people/tess\", active: true }],\\n },\\n ]}\\n/>',\n },\n {\n title: \"Recording where a person has been\",\n description:\n \"The bar keeps a trail of the destinations chosen through it, reachable from the visited count at its head. Record visits through onNavigate and hand them back in defaultVisited, and the trail survives the bar remounting.\",\n code: '<Breadcrumb\\n label=\"Docs\"\\n items={[{ label: \"guides\", children: [{ href: \"#/guide/webmcp\", label: \"WebMCP\" }] }]}\\n defaultVisited={[\"#/guide/webmcp\"]}\\n onNavigate={(item) => console.log(item.href)}\\n/>',\n },\n ],\n});\n","import {\n type ComponentPropsWithRef,\n type KeyboardEvent,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { AgentControlGroup } from \"@/agent/view/AgentText.tsx\";\nimport { useAgentFormat, useSprintView } from \"@/agent/view/mode.ts\";\nimport type { AgentPart } from \"@/agent/view/node.ts\";\nimport {\n agentAttributesFor,\n agentPartAttributesFor,\n buildAgentNode,\n} from \"@/agent/view/project.ts\";\nimport { afterCommit } from \"@/agent/webmcp/afterCommit.ts\";\nimport { commitSync } from \"@/agent/webmcp/flush.ts\";\nimport type { JsonSchemaObject } from \"@/agent/webmcp/types.ts\";\nimport { useAgentTool } from \"@/agent/webmcp/useAgentTool.ts\";\nimport { breadcrumbMeta } from \"./meta.ts\";\nimport { ACT_BREADCRUMB_TOOL } from \"./tool.ts\";\nimport \"./Breadcrumb.css\";\n\nexport interface BreadcrumbItem {\n label: string;\n href?: string;\n active?: boolean;\n external?: boolean;\n children?: readonly BreadcrumbItem[];\n}\n\nexport interface BreadcrumbAction {\n label: string;\n href?: string;\n external?: boolean;\n onSelect?: () => void;\n}\n\nexport type BreadcrumbOpening = number | \"trail\" | \"closed\";\n\nexport interface BreadcrumbProps\n extends Omit<ComponentPropsWithRef<\"nav\">, \"children\"> {\n label: string;\n items: readonly BreadcrumbItem[];\n actions?: readonly BreadcrumbAction[];\n maxCrumbs?: number;\n emptyLabel?: string;\n trailEmptyLabel?: string;\n open?: BreadcrumbOpening;\n onOpenChange?: (opening: BreadcrumbOpening) => void;\n onNavigate?: (item: BreadcrumbItem) => void;\n href?: string;\n visited?: readonly string[];\n defaultVisited?: readonly string[];\n agentName?: string;\n agentTool?: boolean;\n}\n\ninterface Entry {\n item: BreadcrumbItem;\n id: string;\n parent: string;\n ancestors: readonly Entry[];\n}\n\ntype Held = number | \"trail\" | undefined;\n\nconst ROOT = \"\";\nconst RECENCY_STEPS = 12;\nconst TRAVEL = \"[data-sprint-shown], button:not([hidden])\";\n\nfunction flatten(\n items: readonly BreadcrumbItem[],\n ancestors: readonly Entry[] = [],\n): Entry[] {\n const parent = ancestors.at(-1)?.id ?? ROOT;\n return items.flatMap((item, index) => {\n const entry: Entry = {\n item,\n id: parent === ROOT ? String(index) : `${parent}.${index}`,\n parent,\n ancestors,\n };\n return [entry, ...flatten(item.children ?? [], [...ancestors, entry])];\n });\n}\n\nfunction lineage(entry: Entry): Entry[] {\n return [...entry.ancestors, entry];\n}\n\nfunction branches(entry: Entry): boolean {\n return (entry.item.children?.length ?? 0) > 0;\n}\n\nfunction reading(opening: BreadcrumbOpening | undefined): Held {\n return opening === \"closed\" ? undefined : opening;\n}\n\nfunction joined(entries: readonly Entry[]): string {\n return entries.map((entry) => entry.item.label).join(\" / \");\n}\n\nfunction actionSchema(labels: readonly string[]): JsonSchemaObject {\n const action = ACT_BREADCRUMB_TOOL.inputSchema.properties.action;\n return {\n ...ACT_BREADCRUMB_TOOL.inputSchema,\n properties: {\n ...ACT_BREADCRUMB_TOOL.inputSchema.properties,\n ...(action === undefined ? {} : { action: { ...action, enum: [...labels] } }),\n },\n };\n}\n\nexport function Breadcrumb(props: BreadcrumbProps) {\n const {\n label,\n items,\n actions = [],\n maxCrumbs = 4,\n emptyLabel = \"No match\",\n trailEmptyLabel = \"Nothing visited yet\",\n open: opening,\n onOpenChange,\n onNavigate,\n href: home,\n visited,\n defaultVisited = [],\n agentName,\n agentTool = true,\n ref,\n ...rest\n } = props;\n\n const view = useSprintView();\n const formatter = useAgentFormat();\n const [held, setHeld] = useState<Held>(undefined);\n const [query, setQuery] = useState(\"\");\n const [scope, setScope] = useState<string | undefined>(undefined);\n const [unfolded, setUnfolded] = useState(false);\n const [remembered, setRemembered] = useState<readonly string[]>(defaultVisited);\n const trail = visited ?? remembered;\n const field = useRef<HTMLInputElement>(null);\n const drawer = useRef<HTMLDivElement>(null);\n const root = useRef<HTMLElement | null>(null);\n const pressers = useRef(new Map<string, HTMLButtonElement>());\n const actionsRef = useRef(actions);\n actionsRef.current = actions;\n const formatRef = useRef(formatter);\n formatRef.current = formatter;\n const nodeRef = useRef(buildAgentNode({ component: breadcrumbMeta.name }));\n const mounted = useRef(true);\n\n useEffect(() => {\n mounted.current = true;\n return () => {\n mounted.current = false;\n };\n }, []);\n\n const setRoot = useCallback(\n (target: HTMLElement | null) => {\n root.current = target;\n if (typeof ref === \"function\") ref(target);\n else if (ref !== null && ref !== undefined) ref.current = target;\n },\n [ref],\n );\n\n const notify = useRef(onOpenChange);\n notify.current = onOpenChange;\n\n const announce = useCallback((next: Held) => {\n setHeld(next);\n notify.current?.(next ?? \"closed\");\n }, []);\n\n const close = useCallback(() => {\n announce(undefined);\n setQuery(\"\");\n setScope(undefined);\n }, [announce]);\n\n const all = useMemo(() => flatten(items), [items]);\n const current = all.find((entry) => entry.item.active === true);\n const path = current === undefined ? [] : lineage(current);\n const browsed = all.find((entry) => entry.id === scope);\n const route = browsed === undefined ? path : lineage(browsed);\n const last = route.at(-1);\n const tailed = last === undefined || branches(last);\n const crumbCount = route.length + (tailed ? 1 : 0);\n\n const asked = opening === undefined ? held : reading(opening);\n const open: Held =\n typeof asked === \"number\" ? Math.max(0, Math.min(asked, crumbCount - 1)) : asked;\n const fieldAt = open === \"trail\" ? crumbCount - 1 : open;\n\n useEffect(() => {\n if (open !== undefined) field.current?.focus();\n }, [open]);\n\n useEffect(() => {\n if (open === undefined) return;\n const dismiss = (event: PointerEvent) => {\n const target = event.target;\n if (target instanceof Node && root.current?.contains(target) === true) return;\n close();\n };\n document.addEventListener(\"pointerdown\", dismiss);\n return () => document.removeEventListener(\"pointerdown\", dismiss);\n }, [open, close]);\n\n const level =\n typeof open === \"number\"\n ? open === 0\n ? ROOT\n : (route[open - 1]?.id ?? ROOT)\n : ROOT;\n const needle = query.trim().toLowerCase();\n const searching = needle !== \"\";\n const browsing = typeof open === \"number\" && !searching;\n const matches = (entry: Entry) =>\n `${joined(entry.ancestors)} ${entry.item.label}`.toLowerCase().includes(needle);\n\n const revealed = new Set<Entry>();\n for (const entry of all) {\n const reachable = entry.item.href !== undefined;\n const hit =\n open === \"trail\"\n ? reachable &&\n trail.includes(entry.item.href ?? \"\") &&\n (!searching || matches(entry))\n : searching\n ? open !== undefined && reachable && matches(entry)\n : browsing && entry.parent === level;\n if (hit) revealed.add(entry);\n }\n\n const rows = [undefined, ...all.filter(branches)].map((owner) => ({\n id: owner?.id ?? ROOT,\n heading: [\n label,\n ...(owner === undefined ? [] : lineage(owner).map((entry) => entry.item.label)),\n ].join(\" / \"),\n members: all.filter((entry) => entry.parent === (owner?.id ?? ROOT)),\n }));\n\n const onPath = new Set(path);\n const destinationParts = rows.flatMap((row) =>\n row.members\n .filter((entry) => entry.item.href !== undefined)\n .map((entry) => {\n const part: AgentPart = {\n part: \"destination\",\n label: entry.item.label,\n state: {\n ...(entry.ancestors.length > 0 ? { parent: joined(entry.ancestors) } : {}),\n href: entry.item.href ?? \"\",\n ...(entry.item.active === true ? { active: true } : {}),\n ...(entry.item.active !== true && onPath.has(entry)\n ? { ancestor: true }\n : {}),\n ...(entry.item.external === true ? { external: true } : {}),\n ...(revealed.has(entry) ? { shown: true } : {}),\n },\n };\n return { entry, part };\n }),\n );\n const partOf = new Map(destinationParts.map(({ entry, part }) => [entry, part]));\n\n const actionParts: AgentPart[] = actions.map((action) => ({\n part: \"action\",\n label: action.label,\n state: {\n ...(action.href === undefined ? {} : { href: action.href }),\n ...(action.external === true ? { external: true } : {}),\n },\n }));\n\n const pressable = actions\n .filter((action) => action.href === undefined)\n .map((action) => action.label)\n .join(\"\\n\");\n const schema = useMemo(\n () => actionSchema(pressable === \"\" ? [] : pressable.split(\"\\n\")),\n [pressable],\n );\n\n const execute = useCallback(async (inputs: Record<string, unknown>) => {\n const requested = typeof inputs.action === \"string\" ? inputs.action : \"\";\n const available = actionsRef.current.filter((action) => action.href === undefined);\n const match = available.find((action) => action.label === requested);\n if (match === undefined) {\n return `No action named \"${requested}\". This breadcrumb offers: ${available\n .map((action) => `\"${action.label}\"`)\n .join(\", \")}.`;\n }\n const element = pressers.current.get(match.label);\n if (element !== undefined) element.click();\n else commitSync(() => match.onSelect?.());\n await afterCommit();\n if (!mounted.current) return \"The action removed this breadcrumb from the page.\";\n return `Done. The breadcrumb is now:\\n${formatRef.current([nodeRef.current])}`;\n }, []);\n\n const toolName = useAgentTool({\n spec: ACT_BREADCRUMB_TOOL,\n label: agentName ?? label,\n inputSchema: schema,\n enabled: agentTool && pressable !== \"\",\n execute,\n });\n\n const shown = browsing\n ? (rows.find((row) => row.id === level)?.members.length ?? 0)\n : revealed.size;\n\n const node = buildAgentNode({\n component: breadcrumbMeta.name,\n label,\n tool: toolName,\n region: true,\n state: {\n ...(home === undefined ? {} : { href: home }),\n ...(path.length > 0 ? { path: joined(path) } : {}),\n destinations: String(destinationParts.length),\n visited: String(trail.length),\n ...(open === undefined ? {} : { open: String(open), matches: String(shown) }),\n },\n parts: [...actionParts, ...destinationParts.map(({ part }) => part)],\n });\n nodeRef.current = node;\n\n const travel = (item: BreadcrumbItem) => {\n if (item.href !== undefined) {\n const href = item.href;\n setRemembered((was) => [...was.filter((seen) => seen !== href), href]);\n }\n close();\n onNavigate?.(item);\n };\n\n if (view === \"agent\") {\n return (\n <AgentControlGroup\n node={node}\n onActivate={(_part, index) => {\n const action = actions[index];\n if (action !== undefined) {\n if (action.href === undefined) action.onSelect?.();\n else window.location.assign(action.href);\n return;\n }\n const entry = destinationParts[index - actions.length]?.entry;\n if (entry?.item.href === undefined) return;\n travel(entry.item);\n window.location.assign(entry.item.href);\n }}\n />\n );\n }\n\n const reach = (depth: number) => {\n setQuery(\"\");\n announce(open === depth ? undefined : depth);\n };\n\n const drill = (entry: Entry) => {\n setScope(entry.id);\n setQuery(\"\");\n announce(lineage(entry).length);\n };\n\n const lastSeen = (members: readonly Entry[]): number =>\n members.reduce(\n (best, member) => Math.max(best, trail.indexOf(member.item.href ?? \"\")),\n -1,\n );\n\n const ranked =\n open === \"trail\"\n ? rows\n .map((row) => ({ id: row.id, seen: lastSeen(row.members) }))\n .filter((row) => row.seen >= 0)\n .sort((a, b) => b.seen - a.seen)\n .map((row) => row.id)\n : [];\n\n const recency = (id: string) => {\n const rank = ranked.indexOf(id) + 1;\n return rank > 0 && rank <= RECENCY_STEPS\n ? { \"data-sprint-recency\": String(rank) }\n : {};\n };\n\n const travellers = (): HTMLElement[] => {\n const within = drawer.current;\n if (within === null) return [];\n return Array.from(within.querySelectorAll<HTMLElement>(TRAVEL)).filter(\n (candidate) => candidate.closest(\"[hidden]\") === null,\n );\n };\n\n const step = (from: number) => {\n const stops = travellers();\n const next = stops[from < 0 ? stops.length - 1 : from % stops.length];\n next?.focus();\n };\n\n const drive = (event: KeyboardEvent<HTMLInputElement>) => {\n if (event.key === \"Escape\") {\n close();\n return;\n }\n if (event.key === \"ArrowDown\") {\n event.preventDefault();\n step(0);\n return;\n }\n if (event.key === \"ArrowUp\" && open !== \"trail\") {\n event.preventDefault();\n setQuery(\"\");\n announce(\"trail\");\n return;\n }\n if (event.key !== \"Enter\") return;\n event.preventDefault();\n travellers()[0]?.click();\n };\n\n const steer = (event: KeyboardEvent<HTMLDivElement>) => {\n if (event.key === \"Escape\") {\n close();\n return;\n }\n const stops = travellers();\n const at = stops.indexOf(event.target as HTMLElement);\n if (event.key === \"ArrowDown\") {\n event.preventDefault();\n step(at + 1);\n return;\n }\n if (event.key === \"ArrowUp\") {\n event.preventDefault();\n if (at <= 0) field.current?.focus();\n else step(at - 1);\n return;\n }\n if (event.key.length !== 1 || event.metaKey || event.ctrlKey || event.altKey)\n return;\n event.preventDefault();\n setQuery((was) => `${was}${event.key}`);\n field.current?.focus();\n };\n\n const kept = Math.max(1, maxCrumbs - 2);\n const foldable =\n !unfolded &&\n crumbCount > maxCrumbs &&\n (fieldAt === undefined || fieldAt === 0 || fieldAt >= crumbCount - kept);\n const folded = (depth: number) => foldable && depth > 0 && depth < crumbCount - kept;\n\n const crumb = (depth: number) => {\n const entry = route[depth];\n const item = entry?.item;\n const parent = depth === 0 ? label : (route[depth - 1]?.item.label ?? label);\n const separator = (\n <button\n type=\"button\"\n aria-expanded={open === depth}\n aria-label={`Browse ${parent}`}\n onClick={() => reach(depth)}\n />\n );\n if (fieldAt === depth) {\n return (\n <>\n {separator}\n <input\n ref={field}\n type=\"text\"\n aria-label={`Search ${label}`}\n value={query}\n placeholder={\n open === \"trail\"\n ? `Search ${trail.length} visited`\n : `Search ${destinationParts.length} destinations`\n }\n onChange={(event) => setQuery(event.target.value)}\n onKeyDown={drive}\n />\n </>\n );\n }\n return (\n <>\n {separator}\n {item === undefined ? null : item.href === undefined ? (\n <span>{item.label}</span>\n ) : (\n <a\n href={item.href}\n aria-current={entry === current ? \"page\" : undefined}\n target={item.external === true ? \"_blank\" : undefined}\n rel={item.external === true ? \"noreferrer noopener\" : undefined}\n onClick={() => travel(item)}\n >\n {item.label}\n </a>\n )}\n </>\n );\n };\n\n const nothing = open === \"trail\" && trail.length === 0 ? trailEmptyLabel : emptyLabel;\n const total =\n open === \"trail\" ? trail.length : searching ? destinationParts.length : shown;\n const count =\n open === undefined\n ? `${destinationParts.length} destinations`\n : searching\n ? `${shown} of ${destinationParts.length} match`\n : `${shown} of ${total}`;\n\n return (\n <nav {...rest} {...agentAttributesFor(node)} aria-label={label} ref={setRoot}>\n <div>\n <button\n type=\"button\"\n aria-label={`Visited, ${trail.length}`}\n aria-expanded={open === \"trail\"}\n onClick={() => {\n setQuery(\"\");\n announce(open === \"trail\" ? undefined : \"trail\");\n }}\n >\n {String(trail.length).padStart(2, \"0\")}\n </button>\n <ol>\n <li>\n {home === undefined ? <span>{label}</span> : <a href={home}>{label}</a>}\n </li>\n {Array.from({ length: crumbCount }, (_, depth) => [\n <li\n key={route[depth]?.id ?? \"tail\"}\n {...(folded(depth) ? { hidden: true } : {})}\n >\n {crumb(depth)}\n </li>,\n depth === 0 && crumbCount > 1 ? (\n <li key=\"fold\">\n <button\n type=\"button\"\n aria-label=\"Show the whole path\"\n aria-expanded={unfolded}\n onClick={() => setUnfolded((was) => !was)}\n >\n …\n </button>\n </li>\n ) : null,\n ])}\n </ol>\n <span aria-live=\"polite\">{count}</span>\n {actions.map((action, index) => {\n const part = actionParts[index];\n if (part === undefined) return null;\n return action.href === undefined ? (\n <button\n key={action.label}\n type=\"button\"\n {...agentPartAttributesFor(part)}\n ref={(element) => {\n if (element === null) pressers.current.delete(action.label);\n else pressers.current.set(action.label, element);\n }}\n onClick={() => action.onSelect?.()}\n >\n {action.label}\n </button>\n ) : (\n <a\n key={action.label}\n {...agentPartAttributesFor(part)}\n href={action.href}\n target={action.external === true ? \"_blank\" : undefined}\n rel={action.external === true ? \"noreferrer noopener\" : undefined}\n >\n {action.label}\n </a>\n );\n })}\n </div>\n {/* biome-ignore lint/a11y/noStaticElementInteractions: the keys travel between the links inside, which handle their own activation */}\n <div\n ref={drawer}\n onKeyDown={steer}\n {...(open === undefined ? { hidden: true } : {})}\n >\n {rows.map((row) => {\n const visible = row.members.some(\n (entry) =>\n revealed.has(entry) && (entry.item.href !== undefined || browsing),\n );\n return (\n <div\n key={row.id || \"root\"}\n {...recency(row.id)}\n {...(visible ? {} : { hidden: true })}\n >\n <span>{row.heading}</span>\n {row.members.map((entry) => {\n const part = partOf.get(entry);\n return (\n <span key={entry.id}>\n {part === undefined ? null : (\n <a\n {...agentPartAttributesFor(part)}\n href={entry.item.href}\n aria-current={entry.item.active === true ? \"page\" : undefined}\n target={entry.item.external === true ? \"_blank\" : undefined}\n rel={\n entry.item.external === true\n ? \"noreferrer noopener\"\n : undefined\n }\n onClick={() => travel(entry.item)}\n >\n {entry.item.label}\n </a>\n )}\n {branches(entry) ? (\n <button\n type=\"button\"\n aria-label={\n part === undefined ? undefined : `Inside ${entry.item.label}`\n }\n onClick={() => drill(entry)}\n {...(browsing && revealed.has(entry) ? {} : { hidden: true })}\n >\n {part === undefined ? entry.item.label : \"›\"}\n </button>\n ) : null}\n </span>\n );\n })}\n </div>\n );\n })}\n {shown === 0 ? <p>{nothing}</p> : null}\n </div>\n </nav>\n );\n}\n","import type { AgentToolSpec } from \"@/agent/types.ts\";\n\nexport const PRESS_TOOL: AgentToolSpec = {\n verb: \"press\",\n description:\n \"Press this button, exactly as a person clicking it would. Returns the button's state after the press, so a follow-up read is usually unnecessary. Any work the press starts is not waited for; if the button enters a loading state the result says so.\",\n inputSchema: { type: \"object\", properties: {} },\n readOnly: false,\n untrustedContent: true,\n registeredWhen:\n \"The button is mounted, enabled, not loading, has a resolvable label, and no other component claims the same tool name.\",\n unregisteredWhen: \"The button unmounts, becomes disabled, or starts loading.\",\n};\n","import { defineAgentMeta } from \"@/agent/registry.ts\";\nimport { PRESS_TOOL } from \"./tool.ts\";\n\nexport const buttonMeta = defineAgentMeta({\n name: \"Button\",\n category: \"action\",\n summary:\n \"A single action a person or an agent can trigger. Registers one press tool named from its own label.\",\n whenToUse:\n 'Use for any discrete action: submitting, confirming, dismissing, advancing a step. tone=\"action\" with block marks the one primary action in a view; tone=\"danger\" marks destructive actions.',\n whenNotToUse:\n \"Do not use for navigation between pages; use a link. Do not use for toggling a persistent on/off state; that needs a switch or a checkbox.\",\n status: \"experimental\",\n props: {\n children: {\n kind: \"node\",\n description:\n 'The button label. Its text also derives the WebMCP tool name, so prefer a verb phrase like \"Prepare launch\" over \"OK\".',\n required: true,\n },\n tone: {\n kind: \"enum\",\n description:\n \"Visual and semantic weight. Acid is rationed to one primary action per view.\",\n values: [\"neutral\", \"action\", \"danger\"],\n default: \"neutral\",\n },\n block: {\n kind: \"boolean\",\n description:\n 'Render as a full-width bar. Combine with tone=\"action\" for the primary action of a region.',\n default: false,\n },\n loading: {\n kind: \"boolean\",\n description:\n \"Mark work in progress. Sets aria-busy, disables the control, and unregisters the press tool until it clears.\",\n default: false,\n },\n disabled: {\n kind: \"boolean\",\n description: \"Disable the control and unregister its press tool.\",\n default: false,\n },\n agentName: {\n kind: \"string\",\n description:\n \"Override the label used to derive the tool name. Set this on icon-only buttons, when two buttons would otherwise collide, and whenever the visible label contains changing values such as a count.\",\n },\n agentTool: {\n kind: \"boolean\",\n description:\n \"Set false to render the button without registering any WebMCP tool.\",\n default: true,\n },\n onClick: {\n kind: \"handler\",\n description:\n \"Standard click handler. The press tool dispatches a real click, so this runs for agent presses too.\",\n },\n },\n state: {\n tone: {\n description: \"The button's current tone.\",\n attribute: \"data-sprint-tone\",\n values: [\"neutral\", \"action\", \"danger\"],\n },\n block: {\n description: \"Present when the button renders as a full-width bar.\",\n attribute: \"data-sprint-block\",\n },\n loading: {\n description: \"Present while the button is busy.\",\n attribute: \"data-sprint-loading\",\n },\n disabled: {\n description: \"Present when the button cannot be pressed.\",\n attribute: \"data-sprint-disabled\",\n },\n },\n tools: {\n press: PRESS_TOOL,\n },\n agentView: {\n example:\n '- **Button** \"Prepare launch\" [tone=action] → tool `press-prepare-launch`',\n },\n examples: [\n {\n title: \"Primary action\",\n description: \"The one rationed acid action bar for a view.\",\n code: '<Button tone=\"action\" block onClick={prepare}>Prepare launch</Button>',\n },\n {\n title: \"Destructive action\",\n code: '<Button tone=\"danger\" onClick={purge}>Purge vault</Button>',\n },\n {\n title: \"Busy state\",\n description:\n \"While loading the press tool is unregistered, so an agent cannot double-submit.\",\n code: \"<Button loading={saving} onClick={save}>Save loadout</Button>\",\n },\n {\n title: \"Disambiguating two identical labels\",\n description:\n \"Without agentName both buttons would claim press-save and neither would register a tool.\",\n code: '<Button agentName=\"Save billing\">Save</Button>',\n },\n {\n title: \"Keeping the tool name stable under a changing label\",\n description:\n \"A label carrying a value would otherwise rename the tool on every change, churning registration and staling any name an agent already holds.\",\n code: '<Button agentName=\"Increment\">Increment ({count})</Button>',\n },\n ],\n a11y: {\n role: \"button\",\n keyboard: [\"Enter activates\", \"Space activates\"],\n notes:\n \"Loading sets aria-busy and disables the control. Focus is an offset keyline, never a rounded ring.\",\n },\n});\n","import {\n type ComponentPropsWithRef,\n type MouseEvent as ReactMouseEvent,\n useCallback,\n useEffect,\n useLayoutEffect,\n useRef,\n useState,\n} from \"react\";\nimport { AgentControl, AgentLine } from \"@/agent/view/AgentText.tsx\";\nimport { useAgentControls, useAgentFormat, useSprintView } from \"@/agent/view/mode.ts\";\nimport { agentAttributesFor, buildAgentNode } from \"@/agent/view/project.ts\";\nimport { accessibleText } from \"@/agent/view/text.ts\";\nimport { afterCommit } from \"@/agent/webmcp/afterCommit.ts\";\nimport { commitSync } from \"@/agent/webmcp/flush.ts\";\nimport { useAgentTool } from \"@/agent/webmcp/useAgentTool.ts\";\nimport { buttonMeta } from \"./meta.ts\";\nimport { PRESS_TOOL } from \"./tool.ts\";\nimport \"./Button.css\";\n\nexport type ButtonTone = \"neutral\" | \"action\" | \"danger\";\n\nexport interface ButtonProps extends ComponentPropsWithRef<\"button\"> {\n tone?: ButtonTone;\n block?: boolean;\n loading?: boolean;\n agentName?: string;\n agentTool?: boolean;\n}\n\nfunction syntheticClick(): ReactMouseEvent<HTMLButtonElement> {\n const event = new MouseEvent(\"click\", { bubbles: true, cancelable: true });\n return event as unknown as ReactMouseEvent<HTMLButtonElement>;\n}\n\nexport function Button(props: ButtonProps) {\n const {\n tone = \"neutral\",\n block = false,\n loading = false,\n agentName,\n agentTool = true,\n disabled = false,\n type = \"button\",\n children,\n ref,\n onClick,\n ...rest\n } = props;\n\n const view = useSprintView();\n const controls = useAgentControls();\n const formatter = useAgentFormat();\n const element = useRef<HTMLButtonElement | null>(null);\n\n const setRef = useCallback(\n (target: HTMLButtonElement | null) => {\n element.current = target;\n if (typeof ref === \"function\") ref(target);\n else if (ref !== null && ref !== undefined) ref.current = target;\n },\n [ref],\n );\n\n const explicitLabel =\n agentName ?? (typeof children === \"string\" ? children : undefined);\n const [domLabel, setDomLabel] = useState<string | undefined>(undefined);\n\n useLayoutEffect(() => {\n if (explicitLabel !== undefined) return;\n const target = element.current;\n if (target === null) return;\n setDomLabel(accessibleText(target));\n });\n\n const inert = disabled || loading;\n const label = explicitLabel ?? domLabel;\n\n const onClickRef = useRef(onClick);\n onClickRef.current = onClick;\n\n const nodeRef = useRef(buildAgentNode({ component: buttonMeta.name }));\n const formatRef = useRef(formatter);\n formatRef.current = formatter;\n const mounted = useRef(true);\n\n useEffect(() => {\n mounted.current = true;\n return () => {\n mounted.current = false;\n };\n }, []);\n\n const execute = useCallback(async () => {\n const target = element.current;\n\n if (target !== null) {\n target.click();\n } else {\n const handler = onClickRef.current;\n if (handler === undefined) {\n return \"This button renders no control in the current view and has no click handler.\";\n }\n commitSync(() => handler(syntheticClick()));\n }\n\n await afterCommit();\n if (!mounted.current) return \"The press removed this button from the page.\";\n return `Pressed. The button is now:\\n${formatRef.current([nodeRef.current])}`;\n }, []);\n\n const toolName = useAgentTool({\n spec: PRESS_TOOL,\n label,\n enabled: agentTool && !inert,\n execute,\n });\n\n const node = buildAgentNode({\n component: buttonMeta.name,\n label,\n tool: toolName,\n state: { tone, block, loading, disabled: inert },\n });\n nodeRef.current = node;\n\n if (view === \"agent\") {\n if (inert || controls === \"never\") return <AgentLine node={node} />;\n return (\n <AgentControl\n node={node}\n type={type}\n ref={setRef}\n onClick={onClick}\n aria-busy={loading || undefined}\n />\n );\n }\n\n return (\n <button\n {...rest}\n {...agentAttributesFor(node)}\n type={type}\n ref={setRef}\n onClick={onClick}\n disabled={inert}\n aria-busy={loading || undefined}\n >\n {children}\n </button>\n );\n}\n","import type { AgentToolSpec } from \"@/agent/types.ts\";\n\nexport const OPEN_CARD_TOOL: AgentToolSpec = {\n verb: \"open\",\n description:\n \"Open this card, exactly as a person clicking it would. What opening does is the card's own business: it may reveal detail in place, select this item, or start a flow. Returns the card's state after the click.\",\n inputSchema: { type: \"object\", properties: {} },\n readOnly: false,\n untrustedContent: true,\n registeredWhen:\n \"The card acts rather than navigates, is mounted, enabled, has a resolvable label, and no other component claims the same tool name.\",\n unregisteredWhen:\n \"The card unmounts, becomes disabled, or turns into a link by taking an href.\",\n};\n","import { defineAgentMeta } from \"@/agent/registry.ts\";\nimport { OPEN_CARD_TOOL } from \"./tool.ts\";\n\nexport const cardMeta = defineAgentMeta({\n name: \"Card\",\n category: \"navigation\",\n summary:\n \"One entry in a catalogue: a title, a line or two of body, and the whole block clickable. Give it an href and it is a link; give it onClick and it is an action that registers an open tool.\",\n whenToUse:\n \"Use it in a grid of comparable things a person picks between: components in a catalogue, results in a list, templates to start from. The title is the accessible name, so it is also what an agent selects on.\",\n whenNotToUse:\n \"Do not use it for a static region with a header; that is Panel. Do not put separate controls inside one, because the whole card is already a single control and nesting buttons inside a link is invalid.\",\n status: \"experimental\",\n props: {\n label: {\n kind: \"string\",\n description:\n \"The card's title, and its accessible name. Also derives the tool name when the card acts.\",\n required: true,\n },\n children: {\n kind: \"node\",\n description:\n \"A line or two describing the entry. Carried in the agent view as the body part.\",\n },\n href: {\n kind: \"string\",\n description:\n \"Destination, which makes the card a link. A card that navigates registers no tool by default.\",\n },\n onClick: {\n kind: \"handler\",\n description:\n \"What clicking does. Alone it makes the card a button that registers an open tool by default. Alongside href the card stays a link and the handler rides the click, so a client-side router can intercept the navigation.\",\n },\n disabled: {\n kind: \"boolean\",\n description:\n \"Disable an acting card and unregister its tool. Has no effect on a card that navigates.\",\n default: false,\n },\n agentTool: {\n kind: \"boolean\",\n description:\n \"Override the default: on for a card that acts, off for a card that navigates, because an agent can reach an href on its own.\",\n },\n agentName: {\n kind: \"string\",\n description:\n \"Override the label used to derive the tool name, when two cards share a title.\",\n },\n },\n state: {\n href: {\n description: \"Where the card goes, when it navigates.\",\n attribute: \"data-sprint-href\",\n },\n disabled: {\n description: \"Present when the card cannot be opened.\",\n attribute: \"data-sprint-disabled\",\n },\n },\n tools: {\n open: OPEN_CARD_TOOL,\n },\n agentView: {\n example:\n '- **Card** \"Button\" [href=#/Button]\\n - part `title` \"Button\"\\n - part `body` \"A single action a person or an agent can trigger.\"',\n },\n examples: [\n {\n title: \"A catalogue entry\",\n description:\n \"A card that navigates. No tool, because the href is already public.\",\n code: '<Card label=\"Button\" href=\"#/Button\">\\n A single action a person or an agent can trigger.\\n</Card>',\n },\n {\n title: \"A card that acts\",\n description:\n \"onClick instead of href, so the card registers open-start-from-blank and an agent can take it.\",\n code: '<Card label=\"Start from blank\" onClick={create}>\\n An empty page with the provider already wired up.\\n</Card>',\n },\n ],\n a11y: {\n notes:\n \"The whole block is one control: a link when it has an href, a button when it acts. The title names it, and the body is read as its content rather than as part of the name.\",\n },\n});\n","import {\n type ComponentPropsWithRef,\n type MouseEventHandler,\n type ReactNode,\n type Ref,\n useCallback,\n useEffect,\n useRef,\n} from \"react\";\nimport { AgentControl, AgentLine } from \"@/agent/view/AgentText.tsx\";\nimport { useAgentControls, useAgentFormat, useSprintView } from \"@/agent/view/mode.ts\";\nimport type { AgentPart } from \"@/agent/view/node.ts\";\nimport {\n agentAttributesFor,\n agentPartAttributesFor,\n buildAgentNode,\n} from \"@/agent/view/project.ts\";\nimport { reactText } from \"@/agent/view/text.ts\";\nimport { afterCommit } from \"@/agent/webmcp/afterCommit.ts\";\nimport { useAgentTool } from \"@/agent/webmcp/useAgentTool.ts\";\nimport { cardMeta } from \"./meta.ts\";\nimport { OPEN_CARD_TOOL } from \"./tool.ts\";\nimport \"./Card.css\";\n\nexport interface CardProps\n extends Omit<ComponentPropsWithRef<\"button\">, \"ref\" | \"onClick\" | \"children\"> {\n label: string;\n children?: ReactNode;\n href?: string;\n onClick?: MouseEventHandler<HTMLElement>;\n disabled?: boolean;\n agentTool?: boolean;\n agentName?: string;\n ref?: Ref<HTMLButtonElement> | Ref<HTMLAnchorElement>;\n}\n\nexport function Card(props: CardProps) {\n const {\n label,\n children,\n href,\n onClick,\n disabled = false,\n agentTool,\n agentName,\n ref,\n ...rest\n } = props;\n\n const view = useSprintView();\n const controls = useAgentControls();\n const formatter = useAgentFormat();\n const navigates = href !== undefined;\n const inert = !navigates && disabled;\n const element = useRef<HTMLElement | null>(null);\n\n const setRef = useCallback(\n (target: HTMLElement | null) => {\n element.current = target;\n if (typeof ref === \"function\") {\n (ref as (value: HTMLElement | null) => void)(target);\n } else if (ref !== null && ref !== undefined) {\n (ref as { current: HTMLElement | null }).current = target;\n }\n },\n [ref],\n );\n\n const formatRef = useRef(formatter);\n formatRef.current = formatter;\n const nodeRef = useRef(buildAgentNode({ component: cardMeta.name }));\n const mounted = useRef(true);\n\n useEffect(() => {\n mounted.current = true;\n return () => {\n mounted.current = false;\n };\n }, []);\n\n const execute = useCallback(async () => {\n const target = element.current;\n if (target === null) return \"This card renders no control in the current view.\";\n\n target.click();\n await afterCommit();\n if (!mounted.current) return \"Opening removed this card from the page.\";\n return `Opened. The card is now:\\n${formatRef.current([nodeRef.current])}`;\n }, []);\n\n const toolName = useAgentTool({\n spec: OPEN_CARD_TOOL,\n label: agentName ?? label,\n enabled: (agentTool ?? !navigates) && !inert,\n execute,\n });\n\n const body = reactText(children);\n const parts: AgentPart[] = [\n { part: \"title\", label, state: {} },\n ...(body === undefined ? [] : [{ part: \"body\", label: body, state: {} }]),\n ];\n\n const node = buildAgentNode({\n component: cardMeta.name,\n label,\n tool: toolName,\n state: { href, disabled: inert },\n parts,\n });\n nodeRef.current = node;\n\n if (view === \"agent\") {\n if (inert || controls === \"never\") return <AgentLine node={node} />;\n return (\n <AgentControl\n node={node}\n as={navigates ? \"a\" : \"button\"}\n href={href}\n ref={setRef}\n onClick={onClick}\n />\n );\n }\n\n const inner = (\n <>\n <span {...agentPartAttributesFor({ part: \"title\", state: {} })}>{label}</span>\n {children === undefined ? null : (\n <span {...agentPartAttributesFor({ part: \"body\", state: {} })}>{children}</span>\n )}\n </>\n );\n\n if (navigates) {\n return (\n <a\n {...(rest as unknown as ComponentPropsWithRef<\"a\">)}\n {...agentAttributesFor(node)}\n href={href}\n aria-label={label}\n onClick={onClick}\n ref={setRef as Ref<HTMLAnchorElement>}\n >\n {inner}\n </a>\n );\n }\n\n return (\n <button\n {...rest}\n {...agentAttributesFor(node)}\n type=\"button\"\n aria-label={label}\n disabled={disabled}\n onClick={onClick}\n ref={setRef as Ref<HTMLButtonElement>}\n >\n {inner}\n </button>\n );\n}\n","import { defineAgentMeta } from \"@/agent/registry.ts\";\n\nexport const changeListMeta = defineAgentMeta({\n name: \"ChangeList\",\n category: \"display\",\n summary:\n \"A review of what will change or has changed: each row is marked added, removed or changed, and a changed row reads from → to. The kind of every row is a glyph, a tone and spoken text at once, and an agent reads it as state rather than from the glyph.\",\n whenToUse:\n \"Use it to show a diff before someone confirms it: a role change from Write to Maintain, members added to a team, settings a migration will drop. Pass the changes as data so each row is an addressable part carrying its kind, from and to. It registers no tool, because it only reports: the action is the Button that confirms the change, and the rows are already fully readable in the agent view.\",\n whenNotToUse:\n \"Do not use it for a list whose marks carry no meaning; that is List. Do not use it for a full record of fields; that is DescriptionList or Table. Do not put components in a change; label, from, to and detail are text.\",\n status: \"experimental\",\n props: {\n label: {\n kind: \"string\",\n description:\n \"What is changing. Names the list for a screen reader and for the agent view.\",\n required: true,\n },\n changes: {\n kind: \"array\",\n description:\n 'The rows in order, each { kind, label, from?, to?, detail? }. kind is \"added\", \"removed\" or \"changed\"; label is the thing that changed; from and to are its old and new values, usually on a changed row; detail is one short line of consequence beneath it.',\n required: true,\n },\n emptyLabel: {\n kind: \"string\",\n description: \"What the list says when there is nothing to change.\",\n default: \"No changes\",\n },\n },\n state: {\n changes: {\n description: \"How many rows the list has.\",\n attribute: \"data-sprint-changes\",\n },\n added: {\n description: \"How many rows are additions. Absent when there are none.\",\n attribute: \"data-sprint-added\",\n },\n removed: {\n description: \"How many rows are removals. Absent when there are none.\",\n attribute: \"data-sprint-removed\",\n },\n changed: {\n description: \"How many rows are changes of value. Absent when there are none.\",\n attribute: \"data-sprint-changed\",\n },\n empty: {\n description: \"Present when there is nothing to change.\",\n attribute: \"data-sprint-empty\",\n },\n kind: {\n description: \"On a change: whether the row was added, removed or changed.\",\n attribute: \"data-sprint-kind\",\n values: [\"added\", \"removed\", \"changed\"],\n },\n from: {\n description: \"On a change: the old value, when it has one.\",\n attribute: \"data-sprint-from\",\n },\n to: {\n description: \"On a change: the new value, when it has one.\",\n attribute: \"data-sprint-to\",\n },\n },\n agentView: {\n example:\n '- **ChangeList** \"Role changes\" [changed=1, changes=1]\\n - part `change` \"Changed: Ada Lovelace, from Write to Maintain\" [from=Write, kind=changed, to=Maintain]',\n },\n a11y: {\n role: \"list\",\n notes:\n \"A ul named by its label, with an explicit list role. The +, − and → glyphs are aria-hidden; each row instead starts with visually hidden text naming its kind, and a changed row says from and to in words, so the kind never rests on the glyph or its color alone. Old values are a del and new values an ins.\",\n },\n relatedComponents: [\"List\", \"DescriptionList\", \"Dialog\"],\n examples: [\n {\n title: \"A role change\",\n description:\n \"The one row a permission review is about: what it was, and what it becomes.\",\n code: '<ChangeList\\n label=\"Role changes\"\\n changes={[{ kind: \"changed\", label: \"Ada Lovelace\", from: \"Write\", to: \"Maintain\" }]}\\n/>',\n },\n {\n title: \"A review before confirming\",\n description:\n \"Additions, removals and changes together, each with a line of consequence where one matters.\",\n code: '<ChangeList\\n label=\"Team changes\"\\n changes={[\\n { kind: \"added\", label: \"Grace Hopper\", detail: \"Gets read access to every repository.\" },\\n { kind: \"removed\", label: \"Alan Turing\" },\\n { kind: \"changed\", label: \"Ada Lovelace\", from: \"Write\", to: \"Maintain\" },\\n ]}\\n/>',\n },\n {\n title: \"Nothing to change\",\n description: \"An empty review says so rather than rendering nothing.\",\n code: '<ChangeList label=\"Role changes\" changes={[]} emptyLabel=\"No role changes\" />',\n },\n ],\n});\n","import type { ComponentPropsWithRef } from \"react\";\nimport { AgentLine } from \"@/agent/view/AgentText.tsx\";\nimport { useSprintView } from \"@/agent/view/mode.ts\";\nimport type { AgentPart, AgentStateValue } from \"@/agent/view/node.ts\";\nimport {\n agentAttributesFor,\n agentPartAttributesFor,\n buildAgentNode,\n} from \"@/agent/view/project.ts\";\nimport { changeListMeta } from \"./meta.ts\";\nimport \"./ChangeList.css\";\n\nexport type ChangeKind = \"added\" | \"removed\" | \"changed\";\n\nexport interface Change {\n kind: ChangeKind;\n label: string;\n from?: string;\n to?: string;\n detail?: string;\n}\n\nexport interface ChangeListProps extends Omit<ComponentPropsWithRef<\"ul\">, \"children\"> {\n label: string;\n changes: readonly Change[];\n emptyLabel?: string;\n}\n\nconst SAFARI_LIST_SEMANTICS = { role: \"list\" } as const;\n\nconst KINDS: readonly ChangeKind[] = [\"added\", \"removed\", \"changed\"];\n\nconst MARKS: Record<ChangeKind, string> = {\n added: \"+\",\n removed: \"−\",\n changed: \"→\",\n};\n\nconst WORDS: Record<ChangeKind, string> = {\n added: \"Added\",\n removed: \"Removed\",\n changed: \"Changed\",\n};\n\nfunction present(value: string | undefined): value is string {\n return value !== undefined && value !== \"\";\n}\n\nfunction transitionText(change: Change): string {\n const from = present(change.from) ? ` from ${change.from}` : \"\";\n const to = present(change.to) ? ` to ${change.to}` : \"\";\n return from === \"\" && to === \"\" ? \"\" : `,${from}${to}`;\n}\n\nfunction changeText(change: Change): string {\n const detail = present(change.detail) ? `. ${change.detail}` : \"\";\n return `${WORDS[change.kind]}: ${change.label}${transitionText(change)}${detail}`;\n}\n\nfunction changeState(change: Change): Record<string, AgentStateValue> {\n return {\n kind: change.kind,\n ...(present(change.from) ? { from: change.from } : {}),\n ...(present(change.to) ? { to: change.to } : {}),\n };\n}\n\nfunction counts(changes: readonly Change[]): Record<string, string | undefined> {\n const tally: Record<string, string | undefined> = {};\n for (const kind of KINDS) {\n const total = changes.filter((change) => change.kind === kind).length;\n tally[kind] = total === 0 ? undefined : String(total);\n }\n return tally;\n}\n\nfunction Transition({ change }: { change: Change }) {\n const from = present(change.from) ? change.from : undefined;\n const to = present(change.to) ? change.to : undefined;\n if (from === undefined && to === undefined) return null;\n return (\n <>\n <span>,</span>\n {from === undefined ? null : (\n <>\n <span> from </span>\n <del>{from}</del>\n </>\n )}\n <span aria-hidden=\"true\">{MARKS.changed}</span>\n {to === undefined ? null : (\n <>\n <span> to </span>\n <ins>{to}</ins>\n </>\n )}\n </>\n );\n}\n\nfunction Row({ change }: { change: Change }) {\n return (\n <li {...agentPartAttributesFor({ part: \"change\", state: changeState(change) })}>\n <span aria-hidden=\"true\">{MARKS[change.kind]}</span>\n <p>\n <span>{WORDS[change.kind]}: </span>\n <strong>{change.label}</strong>\n <Transition change={change} />\n {present(change.detail) ? (\n <>\n <span>. </span>\n <small>{change.detail}</small>\n </>\n ) : null}\n </p>\n </li>\n );\n}\n\nexport function ChangeList(props: ChangeListProps) {\n const { label, changes, emptyLabel = \"No changes\", ...rest } = props;\n\n const view = useSprintView();\n const empty = changes.length === 0;\n\n const parts: AgentPart[] = changes.map((change) => ({\n part: \"change\",\n label: changeText(change),\n state: changeState(change),\n }));\n\n const node = buildAgentNode({\n component: changeListMeta.name,\n label,\n state: { changes: String(changes.length), ...counts(changes), empty },\n parts,\n });\n\n if (view === \"agent\") return <AgentLine node={node} />;\n\n return (\n <ul\n {...rest}\n {...agentAttributesFor(node)}\n {...SAFARI_LIST_SEMANTICS}\n aria-label={label}\n >\n {empty ? (\n <li>{emptyLabel}</li>\n ) : (\n changes.map((change, index) => (\n <Row key={`${index}-${change.kind}-${change.label}`} change={change} />\n ))\n )}\n </ul>\n );\n}\n","import type { AgentToolSpec } from \"@/agent/types.ts\";\n\nexport const SET_CHECKBOX_TOOL: AgentToolSpec = {\n verb: \"set\",\n description:\n \"Check or uncheck this box by stating the end state, exactly as a person clicking it would. Setting the state it already has succeeds and changes nothing, so the call is safe to retry. Returns the box's state after the call, so a follow-up read is unnecessary.\",\n inputSchema: {\n type: \"object\",\n properties: {\n checked: {\n type: \"boolean\",\n description:\n \"The end state: true leaves the box checked, false leaves it unchecked.\",\n },\n },\n required: [\"checked\"],\n },\n readOnly: false,\n untrustedContent: true,\n registeredWhen:\n \"The box is mounted, enabled, has a resolvable label, and no other component claims the same tool name.\",\n unregisteredWhen: \"The box unmounts or becomes disabled.\",\n};\n","import { defineAgentMeta } from \"@/agent/registry.ts\";\nimport { SET_CHECKBOX_TOOL } from \"./tool.ts\";\n\nexport const checkboxMeta = defineAgentMeta({\n name: \"Checkbox\",\n category: \"input\",\n summary:\n \"A single on/off choice recorded as form data. It registers one set tool that takes the end state rather than toggling.\",\n whenToUse:\n \"Use it for a boolean a form will submit: accepting terms, opting in, including something in a request. The set tool takes checked as true or false, so an agent states the end state and never has to read before writing.\",\n whenNotToUse:\n \"Do not use it for a setting that takes effect the moment it changes; that is a Switch. Do not use it for choosing one of several options, which is a SegmentedControl or a Select.\",\n status: \"experimental\",\n props: {\n label: {\n kind: \"string\",\n description:\n 'What checking it means. Names the box for a screen reader and derives the tool name, so prefer a statement such as \"Accept the terms\".',\n required: true,\n },\n checked: {\n kind: \"boolean\",\n description: \"Whether the box is checked. The box is fully controlled.\",\n required: true,\n },\n onChange: {\n kind: \"handler\",\n description:\n \"Called with the new checked state. The set tool drives a real click, so this runs for agent changes too.\",\n required: true,\n },\n hint: {\n kind: \"string\",\n description:\n \"Guidance shown under the box and carried into the agent view. Replaced by error while one is set.\",\n },\n error: {\n kind: \"string\",\n description:\n \"A validation message. Marks the box invalid for people, screen readers, and agents alike.\",\n },\n name: {\n kind: \"string\",\n description: \"The native form name submitted with the surrounding form.\",\n },\n disabled: {\n kind: \"boolean\",\n description: \"Disable the box and unregister its set tool.\",\n default: false,\n },\n required: {\n kind: \"boolean\",\n description: \"Mark the box as one that must be checked.\",\n default: false,\n },\n agentName: {\n kind: \"string\",\n description:\n \"Override the label used to derive the tool name, when two boxes on a page would otherwise collide.\",\n },\n agentTool: {\n kind: \"boolean\",\n description: \"Set false to render the box without registering a set tool.\",\n default: true,\n },\n },\n state: {\n checked: {\n description: \"Present while the box is checked.\",\n attribute: \"data-sprint-checked\",\n },\n disabled: {\n description: \"Present when the box cannot be changed.\",\n attribute: \"data-sprint-disabled\",\n },\n required: {\n description: \"Present when the box must be checked.\",\n attribute: \"data-sprint-required\",\n },\n invalid: {\n description: \"Present while an error is set.\",\n attribute: \"data-sprint-invalid\",\n },\n },\n tools: {\n set: SET_CHECKBOX_TOOL,\n },\n agentView: {\n example:\n '- **Checkbox** \"Accept the terms\" [required] → tool `set-accept-the-terms`\\n - part `error` \"Required before launch\"',\n },\n examples: [\n {\n title: \"A consent box\",\n description:\n \"In agent view the box renders as one control; pressing it toggles, while the set tool states the end state.\",\n code: '<Checkbox\\n label=\"Accept the terms\"\\n checked={accepted}\\n onChange={setAccepted}\\n required\\n/>',\n },\n {\n title: \"An error on a required box\",\n description: \"The error marks the box invalid on every surface until it clears.\",\n code: '<Checkbox\\n label=\"Confirm the manifest\"\\n checked={confirmed}\\n onChange={setConfirmed}\\n required\\n error=\"Confirm before launch.\"\\n/>',\n },\n {\n title: \"A disabled box\",\n description:\n \"Disabled unregisters the tool, so an agent cannot change what a person could not.\",\n code: '<Checkbox\\n label=\"Telemetry\"\\n checked\\n disabled\\n onChange={setTelemetry}\\n/>',\n },\n ],\n a11y: {\n role: \"checkbox\",\n keyboard: [\"Space toggles\", \"Tab moves through the box\"],\n notes:\n \"A native checkbox input wrapped by its label, visually replaced by a keylined square. Focus draws an offset keyline around the square; errors set aria-invalid and link with aria-describedby.\",\n },\n});\n","import {\n type ComponentPropsWithRef,\n useCallback,\n useEffect,\n useId,\n useRef,\n} from \"react\";\nimport { AgentControl, AgentLine } from \"@/agent/view/AgentText.tsx\";\nimport { useAgentControls, useAgentFormat, useSprintView } from \"@/agent/view/mode.ts\";\nimport type { AgentPart } from \"@/agent/view/node.ts\";\nimport {\n agentAttributesFor,\n agentPartAttributesFor,\n buildAgentNode,\n} from \"@/agent/view/project.ts\";\nimport { afterCommit } from \"@/agent/webmcp/afterCommit.ts\";\nimport { commitSync } from \"@/agent/webmcp/flush.ts\";\nimport { useAgentTool } from \"@/agent/webmcp/useAgentTool.ts\";\nimport { checkboxMeta } from \"./meta.ts\";\nimport { SET_CHECKBOX_TOOL } from \"./tool.ts\";\nimport \"./Checkbox.css\";\n\nexport interface CheckboxProps extends Omit<ComponentPropsWithRef<\"div\">, \"onChange\"> {\n label: string;\n checked: boolean;\n onChange: (checked: boolean) => void;\n hint?: string;\n error?: string;\n name?: string;\n disabled?: boolean;\n required?: boolean;\n agentName?: string;\n agentTool?: boolean;\n}\n\nfunction messagePart(error: string | undefined, hint: string | undefined): AgentPart[] {\n if (error !== undefined) return [{ part: \"error\", label: error, state: {} }];\n if (hint !== undefined) return [{ part: \"hint\", label: hint, state: {} }];\n return [];\n}\n\nexport function Checkbox(props: CheckboxProps) {\n const {\n label,\n checked,\n onChange,\n hint,\n error,\n name,\n disabled = false,\n required = false,\n agentName,\n agentTool = true,\n ...rest\n } = props;\n\n const view = useSprintView();\n const controls = useAgentControls();\n const formatter = useAgentFormat();\n const id = useId();\n\n const element = useRef<HTMLElement | null>(null);\n const onChangeRef = useRef(onChange);\n onChangeRef.current = onChange;\n const checkedRef = useRef(checked);\n checkedRef.current = checked;\n const formatRef = useRef(formatter);\n formatRef.current = formatter;\n const nodeRef = useRef(buildAgentNode({ component: checkboxMeta.name }));\n const mounted = useRef(true);\n\n useEffect(() => {\n mounted.current = true;\n return () => {\n mounted.current = false;\n };\n }, []);\n\n const execute = useCallback(async (inputs: Record<string, unknown>) => {\n const desired = inputs.checked;\n if (typeof desired !== \"boolean\") {\n return 'Pass \"checked\" as true or false; it states the end state.';\n }\n\n const already = desired === checkedRef.current;\n if (!already) {\n const target = element.current;\n if (target !== null) target.click();\n else commitSync(() => onChangeRef.current(desired));\n }\n\n await afterCommit();\n if (!mounted.current) return \"The change removed this checkbox from the page.\";\n const outcome = already\n ? `Already ${desired ? \"checked\" : \"unchecked\"}`\n : desired\n ? \"Checked\"\n : \"Unchecked\";\n return `${outcome}. The checkbox is now:\\n${formatRef.current([nodeRef.current])}`;\n }, []);\n\n const toolName = useAgentTool({\n spec: SET_CHECKBOX_TOOL,\n label: agentName ?? label,\n enabled: agentTool && !disabled,\n execute,\n });\n\n const node = buildAgentNode({\n component: checkboxMeta.name,\n label,\n tool: toolName,\n state: {\n checked,\n disabled,\n required,\n invalid: error !== undefined,\n },\n parts: messagePart(error, hint),\n });\n nodeRef.current = node;\n\n if (view === \"agent\") {\n if (disabled || controls === \"never\") return <AgentLine node={node} />;\n return (\n <AgentControl\n node={node}\n ref={(target: HTMLButtonElement | null) => {\n element.current = target;\n }}\n onClick={() => onChange(!checked)}\n />\n );\n }\n\n const messageId =\n error !== undefined ? `${id}-error` : hint !== undefined ? `${id}-hint` : undefined;\n\n return (\n <div {...rest} {...agentAttributesFor(node)}>\n <label htmlFor={id}>\n <input\n id={id}\n {...agentPartAttributesFor({ part: \"input\", state: {} })}\n ref={(target) => {\n element.current = target;\n }}\n type=\"checkbox\"\n checked={checked}\n name={name}\n disabled={disabled}\n required={required}\n aria-invalid={error !== undefined || undefined}\n aria-describedby={messageId}\n onChange={(event) => onChange(event.currentTarget.checked)}\n />\n <span\n {...agentPartAttributesFor({ part: \"box\", state: {} })}\n aria-hidden=\"true\"\n />\n {label}\n </label>\n {error !== undefined ? (\n <p id={messageId} {...agentPartAttributesFor({ part: \"error\", state: {} })}>\n {error}\n </p>\n ) : hint !== undefined ? (\n <p id={messageId} {...agentPartAttributesFor({ part: \"hint\", state: {} })}>\n {hint}\n </p>\n ) : null}\n </div>\n );\n}\n","import type { AgentToolSpec } from \"@/agent/types.ts\";\n\nexport const CHOOSE_TOOL: AgentToolSpec = {\n verb: \"choose\",\n description:\n \"Choose one of this grid's options by its visible label, exactly as a person pressing it would. In submit mode the choice submits the surrounding form with the option's value, so it can navigate away; in select mode it replaces the current selection. Returns the grid's state after the choice.\",\n inputSchema: {\n type: \"object\",\n properties: {\n option: {\n type: \"string\",\n description:\n \"The visible label of the option to choose, as shown under its glyph.\",\n },\n },\n required: [\"option\"],\n },\n readOnly: false,\n untrustedContent: true,\n registeredWhen:\n \"The grid is mounted, enabled, has a resolvable label, agentTool is not false, and no other component claims the same tool name. The registered schema enumerates the current option labels.\",\n unregisteredWhen: \"The grid unmounts, becomes disabled, or agentTool turns false.\",\n};\n","import { defineAgentMeta } from \"@/agent/registry.ts\";\nimport { CHOOSE_TOOL } from \"./tool.ts\";\n\nexport const choiceGridMeta = defineAgentMeta({\n name: \"ChoiceGrid\",\n category: \"input\",\n summary:\n \"A question answered by pressing one of several large, equal-sized tiles, each a glyph such as an emoji over a text label. It works in two modes: submit mode, where every tile is a real submit button carrying its value, and select mode, where the tiles are a radio group driven by value and onChange.\",\n whenToUse:\n 'Use it when one tap should answer a question and the options are few enough to show at once, ideally six to twelve: an emoji verification step at sign-in (\"pick the emoji you were sent\"), a reaction, a mood, or a category picked by icon. Submit mode needs no client state, so it suits a server-rendered form page: give it a name and no onChange, and the pressed tile submits its form with name=value. Use select mode, by passing value and onChange, when the answer is one field among several and the form is submitted by something else. A verification challenge meant for a human, such as the emoji check, should pass agentTool={false} so the page does not offer an agent a one-call way through it.',\n whenNotToUse:\n \"Do not use it for two to four short text options, which is a SegmentedControl, for long lists, which are a Select, or for choosing several at once, which is a set of Checkboxes. Do not put components in an option: label and glyph are strings, and the label is the tile's accessible name because an emoji on its own is not one.\",\n status: \"experimental\",\n props: {\n label: {\n kind: \"string\",\n description:\n 'The question the tiles answer. Rendered as the legend of the grid\\'s fieldset and used to derive the tool name, so write it as a person would read it, such as \"Which emoji were you sent?\".',\n required: true,\n },\n options: {\n kind: \"array\",\n description:\n \"The tiles in display order: { value, label, glyph? }. value is what the form receives, label is what a person reads and what the choose tool accepts, and glyph is a short string such as an emoji drawn large above the label and hidden from assistive technology.\",\n required: true,\n },\n columns: {\n kind: \"enum\",\n values: [\"2\", \"3\", \"4\"],\n description:\n \"How many columns the grid has at 40rem and wider. Narrower screens always get two, so every tile stays large enough to press.\",\n default: 3,\n },\n name: {\n kind: \"string\",\n description:\n \"The form field name. In submit mode each tile is a submit button with this name and its option's value; in select mode a hidden input carries the selected value under this name.\",\n },\n value: {\n kind: \"string\",\n description:\n \"Select mode only: the value of the selected option. Ignored in submit mode, where nothing stays selected.\",\n },\n onChange: {\n kind: \"handler\",\n description:\n \"Passing it switches the grid to select mode. Called with the chosen value; the choose tool drives a real click, so it runs for agent choices too.\",\n },\n disabled: {\n kind: \"boolean\",\n description: \"Disable every tile and unregister the choose tool.\",\n default: false,\n },\n agentName: {\n kind: \"string\",\n description:\n \"Override the label used to derive the tool name, when the question is long or two grids on a page would collide.\",\n },\n agentTool: {\n kind: \"boolean\",\n description:\n \"Set false to render the grid without registering a choose tool. Pass false for any challenge that exists to prove a human is present.\",\n default: true,\n },\n },\n state: {\n mode: {\n description:\n \"submit when pressing a tile submits the form, select when it changes a selection.\",\n attribute: \"data-sprint-mode\",\n values: [\"submit\", \"select\"],\n },\n value: {\n description: \"Select mode: the value of the option currently selected.\",\n attribute: \"data-sprint-value\",\n },\n columns: {\n description: \"The column count at 40rem and wider.\",\n attribute: \"data-sprint-columns\",\n values: [\"2\", \"3\", \"4\"],\n },\n disabled: {\n description: \"Present when no tile can be pressed.\",\n attribute: \"data-sprint-disabled\",\n },\n },\n tools: {\n choose: CHOOSE_TOOL,\n },\n agentView: {\n example:\n '- **ChoiceGrid** \"Pick a reaction\" [columns=4, mode=select, value=fire] → tool `choose-pick-a-reaction`\\n - part `choice` \"Thumbs up\" [value=up]\\n - part `choice` \"Fire\" [checked, value=fire]\\n - part `choice` \"Laughing\" [value=laugh]\\n - part `choice` \"Sad\" [value=sad]',\n },\n examples: [\n {\n title: \"An emoji verification check\",\n description:\n \"Submit mode in a plain form: each tile is a submit button named emoji, so the form posts emoji=fox with no client state. agentTool is false because the check exists to prove a person is present.\",\n code: '<form method=\"post\" action=\"verify\">\\n <ChoiceGrid\\n label=\"Which emoji were you sent?\"\\n name=\"emoji\"\\n agentTool={false}\\n options={[\\n { value: \"fox\", label: \"Fox\", glyph: \"🦊\" },\\n { value: \"rocket\", label: \"Rocket\", glyph: \"🚀\" },\\n { value: \"cactus\", label: \"Cactus\", glyph: \"🌵\" },\\n { value: \"anchor\", label: \"Anchor\", glyph: \"⚓\" },\\n { value: \"pizza\", label: \"Pizza\", glyph: \"🍕\" },\\n { value: \"comet\", label: \"Comet\", glyph: \"☄️\" },\\n ]}\\n />\\n</form>',\n },\n {\n title: \"Picking one with state\",\n description:\n \"Select mode with four columns: the tiles are a radio group, and in agent view each one renders as its own control so an agent can choose without WebMCP.\",\n code: '<ChoiceGrid\\n label=\"Pick a reaction\"\\n columns={4}\\n name=\"reaction\"\\n value={reaction}\\n onChange={setReaction}\\n options={[\\n { value: \"up\", label: \"Thumbs up\", glyph: \"👍\" },\\n { value: \"fire\", label: \"Fire\", glyph: \"🔥\" },\\n { value: \"laugh\", label: \"Laughing\", glyph: \"😂\" },\\n { value: \"sad\", label: \"Sad\", glyph: \"😢\" },\\n ]}\\n/>',\n },\n {\n title: \"A disabled grid\",\n description:\n \"Disabled unregisters the tool and renders the agent view as text only, so an agent cannot press a tile a person could not.\",\n code: '<ChoiceGrid\\n label=\"Delivery window\"\\n columns={2}\\n disabled\\n value=\"morning\"\\n onChange={setWindow}\\n options={[\\n { value: \"morning\", label: \"Morning\", glyph: \"☀\" },\\n { value: \"evening\", label: \"Evening\", glyph: \"☾\" },\\n ]}\\n/>',\n },\n ],\n a11y: {\n role: \"group, or radiogroup in select mode\",\n keyboard: [\n \"Tab reaches every tile in submit mode, and the group once in select mode\",\n \"Arrow keys move to the next or previous tile; in select mode they also select it\",\n \"Home and End move to the first and last tile\",\n \"Enter or Space presses the focused tile\",\n ],\n notes:\n \"The root is a fieldset labelled by its legend. A glyph is aria-hidden and the label is always visible text, so each tile's accessible name is its label. In select mode, selection follows focus with a roving tabindex. In agent view a hidden input stays in the form so a choice made there submits the same field a person's would.\",\n },\n relatedComponents: [\"SegmentedControl\", \"Select\", \"Button\"],\n});\n","import {\n type ComponentPropsWithRef,\n type KeyboardEvent as ReactKeyboardEvent,\n useCallback,\n useEffect,\n useId,\n useMemo,\n useRef,\n} from \"react\";\nimport { AgentControlGroup, AgentLine } from \"@/agent/view/AgentText.tsx\";\nimport { useAgentControls, useAgentFormat, useSprintView } from \"@/agent/view/mode.ts\";\nimport type { AgentPart } from \"@/agent/view/node.ts\";\nimport {\n agentAttributesFor,\n agentPartAttributesFor,\n buildAgentNode,\n} from \"@/agent/view/project.ts\";\nimport { afterCommit } from \"@/agent/webmcp/afterCommit.ts\";\nimport { commitSync } from \"@/agent/webmcp/flush.ts\";\nimport type { JsonSchemaObject } from \"@/agent/webmcp/types.ts\";\nimport { useAgentTool } from \"@/agent/webmcp/useAgentTool.ts\";\nimport { choiceGridMeta } from \"./meta.ts\";\nimport { CHOOSE_TOOL } from \"./tool.ts\";\nimport \"./ChoiceGrid.css\";\n\nexport interface ChoiceOption {\n value: string;\n label: string;\n glyph?: string;\n}\n\nexport type ChoiceGridColumns = 2 | 3 | 4;\n\ntype ChoiceGridMode = \"submit\" | \"select\";\n\nexport interface ChoiceGridProps\n extends Omit<ComponentPropsWithRef<\"fieldset\">, \"onChange\"> {\n label: string;\n options: readonly ChoiceOption[];\n columns?: ChoiceGridColumns;\n name?: string;\n value?: string;\n onChange?: (value: string) => void;\n disabled?: boolean;\n agentName?: string;\n agentTool?: boolean;\n}\n\nconst MOVE_KEYS = [\"ArrowRight\", \"ArrowDown\", \"ArrowLeft\", \"ArrowUp\", \"Home\", \"End\"];\n\nfunction optionSchema(options: readonly ChoiceOption[]): JsonSchemaObject {\n const option = CHOOSE_TOOL.inputSchema.properties.option;\n return {\n ...CHOOSE_TOOL.inputSchema,\n properties: {\n ...CHOOSE_TOOL.inputSchema.properties,\n ...(option === undefined\n ? {}\n : { option: { ...option, enum: options.map((entry) => entry.label) } }),\n },\n };\n}\n\nfunction targetIndex(key: string, current: number, count: number): number {\n if (key === \"Home\") return 0;\n if (key === \"End\") return count - 1;\n const step = key === \"ArrowRight\" || key === \"ArrowDown\" ? 1 : -1;\n return (current + step + count) % count;\n}\n\nfunction submitThrough(carrier: HTMLInputElement | null, value: string): boolean {\n const form = carrier?.form ?? null;\n if (carrier === null || form === null) return false;\n carrier.disabled = false;\n carrier.value = value;\n try {\n form.requestSubmit();\n } finally {\n carrier.disabled = true;\n carrier.value = \"\";\n }\n return true;\n}\n\nexport function ChoiceGrid(props: ChoiceGridProps) {\n const {\n label,\n options,\n columns = 3,\n name,\n value,\n onChange,\n disabled = false,\n agentName,\n agentTool = true,\n ...rest\n } = props;\n\n const mode: ChoiceGridMode = onChange === undefined ? \"submit\" : \"select\";\n const view = useSprintView();\n const controls = useAgentControls();\n const formatter = useAgentFormat();\n const legendId = useId();\n\n const elements = useRef(new Map<string, HTMLButtonElement>());\n const carrier = useRef<HTMLInputElement | null>(null);\n const onChangeRef = useRef(onChange);\n onChangeRef.current = onChange;\n const optionsRef = useRef(options);\n optionsRef.current = options;\n const modeRef = useRef(mode);\n modeRef.current = mode;\n const formatRef = useRef(formatter);\n formatRef.current = formatter;\n const nodeRef = useRef(buildAgentNode({ component: choiceGridMeta.name }));\n const mounted = useRef(true);\n\n useEffect(() => {\n mounted.current = true;\n return () => {\n mounted.current = false;\n };\n }, []);\n\n const choose = useCallback((next: string): boolean => {\n const element = elements.current.get(next);\n if (element !== undefined) {\n element.click();\n return modeRef.current === \"select\" || element.form !== null;\n }\n const handler = onChangeRef.current;\n if (modeRef.current === \"select\" && handler !== undefined) {\n commitSync(() => handler(next));\n return true;\n }\n return submitThrough(carrier.current, next);\n }, []);\n\n const execute = useCallback(\n async (inputs: Record<string, unknown>) => {\n const requested = typeof inputs.option === \"string\" ? inputs.option : \"\";\n const match = optionsRef.current.find((entry) => entry.label === requested);\n\n if (match === undefined) {\n return `No option named \"${requested}\". This grid offers: ${optionsRef.current\n .map((entry) => `\"${entry.label}\"`)\n .join(\", \")}.`;\n }\n\n const acted = choose(match.value);\n if (!acted) {\n return `No form surrounds this grid, so choosing \"${match.label}\" had nothing to submit.`;\n }\n\n await afterCommit();\n const done =\n modeRef.current === \"submit\"\n ? `Chose \"${match.label}\" and submitted the form.`\n : `Chose \"${match.label}\".`;\n if (!mounted.current) return `${done} The grid is no longer on the page.`;\n return `${done} The grid is now:\\n${formatRef.current([nodeRef.current])}`;\n },\n [choose],\n );\n\n const schema = useMemo(() => optionSchema(options), [options]);\n\n const toolName = useAgentTool({\n spec: CHOOSE_TOOL,\n label: agentName ?? label,\n inputSchema: schema,\n enabled: agentTool && !disabled,\n execute,\n });\n\n const selected = mode === \"select\" ? value : undefined;\n\n const parts: AgentPart[] = options.map((option) => ({\n part: \"choice\",\n label: option.label,\n state: {\n value: option.value,\n ...(option.value === selected ? { checked: true as const } : {}),\n ...(disabled ? { disabled: true as const } : {}),\n },\n }));\n\n const node = buildAgentNode({\n component: choiceGridMeta.name,\n label,\n tool: toolName,\n state: { mode, value: selected, columns: String(columns), disabled },\n parts,\n });\n nodeRef.current = node;\n\n const selectedField =\n mode === \"select\" && name !== undefined ? (\n <input type=\"hidden\" name={name} value={selected ?? \"\"} />\n ) : null;\n\n if (view === \"agent\") {\n if (disabled || controls === \"never\") return <AgentLine node={node} />;\n return (\n <AgentControlGroup\n node={node}\n onActivate={(_part, index) => {\n const target = options[index];\n if (target !== undefined) choose(target.value);\n }}\n >\n {mode === \"select\" ? (\n selectedField\n ) : (\n <input type=\"hidden\" name={name} disabled ref={carrier} />\n )}\n </AgentControlGroup>\n );\n }\n\n const move = (event: ReactKeyboardEvent<HTMLFieldSetElement>) => {\n if (!MOVE_KEYS.includes(event.key) || disabled || options.length === 0) return;\n const focused = options.findIndex(\n (option) => elements.current.get(option.value) === event.target,\n );\n if (focused === -1) return;\n\n const target = options[targetIndex(event.key, focused, options.length)];\n if (target === undefined) return;\n\n event.preventDefault();\n elements.current.get(target.value)?.focus();\n if (mode === \"select\") choose(target.value);\n };\n\n const hasSelection = options.some((option) => option.value === selected);\n\n return (\n <fieldset\n {...rest}\n {...agentAttributesFor(node)}\n role={mode === \"select\" ? \"radiogroup\" : undefined}\n aria-labelledby={legendId}\n disabled={disabled}\n onKeyDown={move}\n >\n <legend id={legendId}>{label}</legend>\n <div>\n {options.map((option, index) => {\n const checked = option.value === selected;\n const roving = hasSelection ? checked : index === 0;\n const radio =\n mode === \"select\"\n ? {\n type: \"button\" as const,\n role: \"radio\",\n \"aria-checked\": checked,\n tabIndex: roving ? 0 : -1,\n onClick: () => onChange?.(option.value),\n }\n : { type: \"submit\" as const, name, value: option.value };\n return (\n <button\n key={option.value}\n {...radio}\n disabled={disabled}\n ref={(element) => {\n if (element === null) elements.current.delete(option.value);\n else elements.current.set(option.value, element);\n }}\n {...agentPartAttributesFor(parts[index] ?? { part: \"choice\", state: {} })}\n >\n {option.glyph === undefined ? null : (\n <span aria-hidden=\"true\">{option.glyph}</span>\n )}\n <span>{option.label}</span>\n </button>\n );\n })}\n </div>\n {selectedField}\n </fieldset>\n );\n}\n","export type TokenKind =\n | \"plain\"\n | \"tag\"\n | \"attr\"\n | \"string\"\n | \"keyword\"\n | \"number\"\n | \"punct\"\n | \"comment\";\n\nexport interface Token {\n kind: TokenKind;\n text: string;\n}\n\nconst PATTERN =\n /(\\/\\/[^\\n]*)|(\"[^\"]*\"|'[^']*'|`[^`]*`)|(<\\/?[A-Za-z][\\w.-]*)|([\\w-]+(?==))|(\\b(?:const|let|var|function|return|import|export|from|await|async|new|true|false|null|undefined)\\b)|(\\b\\d+(?:\\.\\d+)?\\b)|([<>/{}()[\\];=,.]+)/g;\n\nconst KINDS: readonly TokenKind[] = [\n \"comment\",\n \"string\",\n \"tag\",\n \"attr\",\n \"keyword\",\n \"number\",\n \"punct\",\n];\n\nexport function tokenize(code: string): Token[] {\n const tokens: Token[] = [];\n let cursor = 0;\n\n for (const match of code.matchAll(PATTERN)) {\n const index = match.index;\n if (index === undefined) continue;\n\n if (index > cursor) {\n tokens.push({ kind: \"plain\", text: code.slice(cursor, index) });\n }\n\n const kind = KINDS.find((_, slot) => match[slot + 1] !== undefined) ?? \"plain\";\n tokens.push({ kind, text: match[0] });\n cursor = index + match[0].length;\n }\n\n if (cursor < code.length) {\n tokens.push({ kind: \"plain\", text: code.slice(cursor) });\n }\n\n return tokens;\n}\n","import { defineAgentMeta } from \"@/agent/registry.ts\";\n\nexport const codeBlockMeta = defineAgentMeta({\n name: \"CodeBlock\",\n category: \"display\",\n summary:\n \"A snippet of code with a caption band and a copy control. In agent view the snippet is carried verbatim as the code part, so an agent reads the source instead of the highlighting.\",\n whenToUse:\n \"Use it for any code a reader is meant to run or copy: an install snippet, an example, a generated tool descriptor. It scrolls horizontally rather than wrapping, so a long line stays a long line.\",\n whenNotToUse:\n \"Do not use it for a short inline identifier inside a sentence; use a code element inside Text. Do not use it for prose you want to look technical.\",\n status: \"experimental\",\n props: {\n code: {\n kind: \"string\",\n description:\n \"The snippet, verbatim. Newlines are preserved and this exact string is what an agent reads and what the copy control copies.\",\n required: true,\n },\n caption: {\n kind: \"string\",\n description:\n \"What the snippet is, shown in the band above it and used as the block's accessible name. Defaults to the language.\",\n },\n language: {\n kind: \"enum\",\n description: \"What the snippet is written in. Drives the caption default.\",\n values: [\"tsx\", \"json\", \"bash\", \"text\"],\n default: \"tsx\",\n },\n copyLabel: {\n kind: \"string\",\n description: \"Label for the copy control.\",\n default: \"Copy\",\n },\n },\n state: {\n language: {\n description: \"The language the snippet is in.\",\n attribute: \"data-sprint-language\",\n values: [\"tsx\", \"json\", \"bash\", \"text\"],\n },\n lines: {\n description: \"How many lines the snippet has.\",\n attribute: \"data-sprint-lines\",\n },\n copied: {\n description:\n \"Present for a moment after the copy control has put the snippet on the clipboard.\",\n attribute: \"data-sprint-copied\",\n },\n token: {\n description:\n \"On a highlight span: which token class it is. Colour comes from this, so a theme can recolour code without touching the component.\",\n attribute: \"data-sprint-token\",\n values: [\"tag\", \"attr\", \"string\", \"keyword\", \"number\", \"punct\", \"comment\"],\n },\n },\n agentView: {\n example:\n '- **CodeBlock** \"install\" [language=bash, lines=1]\\n - part `copy` \"Copy\"\\n - part `code` \"npm install sprint\"',\n },\n examples: [\n {\n title: \"An example snippet\",\n description:\n \"No caption, so the language names the block. It registers no WebMCP tool: an agent has nothing to gain from putting text on a person's clipboard, and it can already read the code.\",\n code: \"<CodeBlock code={'<Button tone=\\\"action\\\">Prepare launch</Button>'} />\",\n },\n {\n title: \"A captioned descriptor\",\n code: '<CodeBlock\\n caption=\"descriptor\"\\n language=\"json\"\\n code={JSON.stringify(descriptor, null, 2)}\\n/>',\n },\n ],\n a11y: {\n notes:\n \"The frame is a figure named by its caption. The copy control is a real button and reports back in its own label once the snippet is on the clipboard; the label swap is a polite live region, so a screen reader hears the confirmation too.\",\n },\n});\n","import { type ComponentPropsWithRef, useEffect, useState } from \"react\";\nimport { AgentLine } from \"@/agent/view/AgentText.tsx\";\nimport { useSprintView } from \"@/agent/view/mode.ts\";\nimport {\n agentAttributesFor,\n agentPartAttributesFor,\n buildAgentNode,\n} from \"@/agent/view/project.ts\";\nimport { tokenize } from \"./highlight.ts\";\nimport { codeBlockMeta } from \"./meta.ts\";\nimport \"./CodeBlock.css\";\n\nconst COPIED_FOR = 1200;\n\nexport type CodeLanguage = \"tsx\" | \"json\" | \"bash\" | \"text\";\n\nexport interface CodeBlockProps extends ComponentPropsWithRef<\"figure\"> {\n code: string;\n caption?: string;\n language?: CodeLanguage;\n copyLabel?: string;\n}\n\nexport function CodeBlock(props: CodeBlockProps) {\n const { code, caption, language = \"tsx\", copyLabel = \"Copy\", ...rest } = props;\n\n const view = useSprintView();\n const [copied, setCopied] = useState(false);\n\n useEffect(() => {\n if (!copied) return;\n const timer = setTimeout(() => setCopied(false), COPIED_FOR);\n return () => clearTimeout(timer);\n }, [copied]);\n\n const label = caption ?? language;\n const control = copied ? \"Copied\" : copyLabel;\n\n const node = buildAgentNode({\n component: codeBlockMeta.name,\n label,\n state: {\n language,\n lines: String(code.split(\"\\n\").length),\n copied,\n },\n parts: [\n { part: \"copy\", label: control, state: {} },\n { part: \"code\", label: code, state: {} },\n ],\n });\n\n if (view === \"agent\") return <AgentLine node={node} />;\n\n const copy = () => {\n const clipboard = navigator.clipboard;\n if (clipboard === undefined) return;\n clipboard.writeText(code).then(\n () => setCopied(true),\n () => setCopied(false),\n );\n };\n\n return (\n <figure {...rest} {...agentAttributesFor(node)} aria-label={label}>\n <header>\n <span>{label}</span>\n <button\n type=\"button\"\n aria-live=\"polite\"\n {...agentPartAttributesFor({ part: \"copy\", state: {} })}\n onClick={copy}\n >\n {control}\n </button>\n </header>\n <pre {...agentPartAttributesFor({ part: \"code\", state: {} })}>\n <code>\n {tokenize(code).map((token, index) => (\n <span\n key={`${index}-${token.text}`}\n data-sprint-token={token.kind === \"plain\" ? undefined : token.kind}\n >\n {token.text}\n </span>\n ))}\n </code>\n </pre>\n </figure>\n );\n}\n","import { defineAgentMeta } from \"@/agent/registry.ts\";\n\nexport const copyFieldMeta = defineAgentMeta({\n name: \"CopyField\",\n category: \"input\",\n summary:\n \"A labelled, read-only value with a Copy control: a setup link, an invite URL, a webhook address. The value truncates with an ellipsis on one line, stays selectable, and the control confirms with Copied for two seconds.\",\n whenToUse:\n 'Use it to hand a person a value they are meant to paste somewhere else, such as \"Copy the link\" under a device setup step. The whole value stays in the DOM and in the agent view however narrow the field is drawn, so truncation never hides it from a screen reader or an agent.',\n whenNotToUse:\n \"Do not use it for a secret; that is a SecretField, which masks the value and keeps it off every agent surface. Do not use it for a plain read-only value nobody needs to copy; that is a TextInput with readOnly, or a DescriptionList row. Do not use it for multi-line code; that is a CodeBlock.\",\n status: \"experimental\",\n props: {\n label: {\n kind: \"string\",\n description:\n 'What the value is, shown above it as the field label and used as the node\\'s label in the agent view, e.g. \"Setup link\".',\n required: true,\n },\n value: {\n kind: \"string\",\n description:\n \"The text shown and copied, verbatim. It is never masked: an agent reads it from the value part.\",\n required: true,\n },\n copyLabel: {\n kind: \"string\",\n description: \"The copy control's label while idle.\",\n default: \"Copy\",\n },\n copiedLabel: {\n kind: \"string\",\n description:\n \"The copy control's label for two seconds after the value reaches the clipboard.\",\n default: \"Copied\",\n },\n onCopy: {\n kind: \"handler\",\n description:\n \"Called with the value once it is on the clipboard. Not called when the clipboard refuses the write.\",\n },\n },\n state: {\n copied: {\n description:\n \"Present for two seconds after the copy control has put the value on the clipboard.\",\n attribute: \"data-sprint-copied\",\n },\n \"copy-failed\": {\n description:\n \"Present after the clipboard refused the write or is unavailable. The value's text is selected instead, so the person can copy it by hand.\",\n attribute: \"data-sprint-copy-failed\",\n },\n },\n agentView: {\n example:\n '- **CopyField** \"Setup link\"\\n - part `value` \"https://sprint.example/setup/7HW4\"\\n - part `copy` \"Copy\"',\n },\n examples: [\n {\n title: \"Copy the link\",\n description:\n \"The first real need: a setup link a person pastes into another device. A long URL truncates in the field and is still copied whole.\",\n code: '<CopyField\\n label=\"Setup link\"\\n value=\"https://sprint.example/setup/7HW4-XK92-QQ1D?station=KX-2209&expires=2026-10-01\"\\n/>',\n },\n {\n title: \"Custom control labels\",\n description:\n \"Relabel the control in the language of the task, and react once the value is on the clipboard.\",\n code: '<CopyField\\n label=\"Invite code\"\\n value=\"NOMAD-0042\"\\n copyLabel=\"Copy code\"\\n copiedLabel=\"Code copied\"\\n onCopy={() => setShared(true)}\\n/>',\n },\n ],\n a11y: {\n role: \"group\",\n keyboard: [\"Tab reaches the copy control\", \"Enter or Space copies\"],\n notes:\n \"The group is named by its visible label. The full value is in the DOM however it is truncated, and its title shows it on hover. The copy control is a real button whose label swap is a polite live region. If the clipboard refuses, the value's text is selected so a keyboard copy still works. No WebMCP tool is registered: the value is already readable in the agent view, and an agent gains nothing from writing it to the person's clipboard that reading it does not give.\",\n },\n relatedComponents: [\"SecretField\", \"TextInput\", \"CodeBlock\", \"DescriptionList\"],\n});\n","import { type ComponentPropsWithRef, useEffect, useId, useRef, useState } from \"react\";\nimport { AgentControlGroup, AgentLine } from \"@/agent/view/AgentText.tsx\";\nimport { useAgentControls, useSprintView } from \"@/agent/view/mode.ts\";\nimport type { AgentPart } from \"@/agent/view/node.ts\";\nimport {\n agentAttributesFor,\n agentPartAttributesFor,\n buildAgentNode,\n} from \"@/agent/view/project.ts\";\nimport { copyFieldMeta } from \"./meta.ts\";\nimport \"./CopyField.css\";\n\nexport const COPIED_FOR = 2000;\n\ntype CopyStatus = \"idle\" | \"copied\" | \"failed\";\n\nexport interface CopyFieldProps\n extends Omit<ComponentPropsWithRef<\"fieldset\">, \"children\" | \"onCopy\"> {\n label: string;\n value: string;\n copyLabel?: string;\n copiedLabel?: string;\n onCopy?: (value: string) => void;\n}\n\nfunction selectContents(element: HTMLElement | null): void {\n if (element === null) return;\n const selection = element.ownerDocument.getSelection();\n if (selection === null) return;\n selection.selectAllChildren(element);\n}\n\nexport function CopyField(props: CopyFieldProps) {\n const {\n label,\n value,\n copyLabel = \"Copy\",\n copiedLabel = \"Copied\",\n onCopy,\n ...rest\n } = props;\n\n const view = useSprintView();\n const controls = useAgentControls();\n const id = useId();\n const [status, setStatus] = useState<CopyStatus>(\"idle\");\n const valueElement = useRef<HTMLSpanElement | null>(null);\n const onCopyRef = useRef(onCopy);\n onCopyRef.current = onCopy;\n\n useEffect(() => {\n if (status !== \"copied\") return;\n const timer = setTimeout(() => setStatus(\"idle\"), COPIED_FOR);\n return () => clearTimeout(timer);\n }, [status]);\n\n const fail = () => {\n setStatus(\"failed\");\n selectContents(valueElement.current);\n };\n\n const copy = () => {\n const clipboard = navigator.clipboard;\n if (clipboard === undefined) {\n fail();\n return;\n }\n clipboard.writeText(value).then(() => {\n setStatus(\"copied\");\n onCopyRef.current?.(value);\n }, fail);\n };\n\n const copied = status === \"copied\";\n const control = copied ? copiedLabel : copyLabel;\n\n const parts: AgentPart[] = [\n { part: \"value\", ...(value === \"\" ? {} : { label: value }), state: {} },\n { part: \"copy\", label: control, state: {} },\n ];\n\n const node = buildAgentNode({\n component: copyFieldMeta.name,\n label,\n state: { copied, \"copy-failed\": status === \"failed\" },\n parts,\n });\n\n if (view === \"agent\") {\n if (controls === \"never\") return <AgentLine node={node} />;\n return (\n <AgentControlGroup\n node={node}\n isActionable={(part) => part.part === \"copy\"}\n onActivate={copy}\n />\n );\n }\n\n const labelId = `${id}-label`;\n\n return (\n <fieldset {...rest} {...agentAttributesFor(node)} aria-labelledby={labelId}>\n <legend id={labelId}>{label}</legend>\n <div>\n <span\n {...agentPartAttributesFor({ part: \"value\", state: {} })}\n ref={valueElement}\n title={value}\n >\n {value}\n </span>\n <button\n {...agentPartAttributesFor({ part: \"copy\", state: {} })}\n type=\"button\"\n aria-live=\"polite\"\n onClick={copy}\n >\n {control}\n </button>\n </div>\n </fieldset>\n );\n}\n","import { defineAgentMeta } from \"@/agent/registry.ts\";\n\nexport const descriptionListMeta = defineAgentMeta({\n name: \"DescriptionList\",\n category: \"display\",\n summary:\n \"Labelled term–description pairs for the details of one thing: metadata, settings, profile fields.\",\n whenToUse:\n \"Use for the properties of a single entity: a token's created date and scopes, a session's device and last activity, a profile's fields. Each item pairs one term with one description. It lays itself out from its own width, not the viewport's: the term sits above its value until the list is at least 32rem wide, then moves into a column of its own, so it reads the same in a sidebar as in a full-width panel.\",\n whenNotToUse:\n \"Do not use for many entities with the same fields; that is a Table. Do not put components inside term or description; both are flattened to text for the agent view, so only inline content survives. Do not use for prose sequences; that is a List.\",\n status: \"experimental\",\n props: {\n label: {\n kind: \"string\",\n description:\n \"The accessible name for the list, describing what entity it details.\",\n required: true,\n },\n items: {\n kind: \"array\",\n description:\n \"The pairs, in order. Each item is { term, description }; both are inline content flattened to text for the agent view.\",\n required: true,\n },\n emptyLabel: {\n kind: \"string\",\n description: \"Text shown when items is empty. The region keeps its frame.\",\n default: \"Empty\",\n },\n loading: {\n kind: \"boolean\",\n description:\n \"Set while the pairs are being fetched. Sets aria-busy and sweeps a bar along the top edge. Existing pairs stay visible; with none yet, the empty slot says loadingLabel instead of emptyLabel.\",\n default: false,\n },\n loadingLabel: {\n kind: \"string\",\n description: \"What the empty slot says while loading.\",\n default: \"Loading\",\n },\n },\n state: {\n items: {\n description: \"The number of pairs.\",\n attribute: \"data-sprint-items\",\n },\n empty: {\n description: \"Present when there are no pairs.\",\n attribute: \"data-sprint-empty\",\n },\n loading: {\n description:\n \"Present while the pairs are being fetched. Alongside empty it means nothing has arrived yet, not that there is nothing.\",\n attribute: \"data-sprint-loading\",\n },\n },\n agentView: {\n example: '- **DescriptionList** \"Key sk-prod\" [items=2]',\n },\n examples: [\n {\n title: \"Token metadata\",\n code: '<DescriptionList\\n label=\"Key sk-prod\"\\n items={[\\n { term: \"Created\", description: \"2026-08-01\" },\\n { term: \"Last used\", description: \"2 hours ago\" },\\n { term: \"Scopes\", description: \"read, write\" },\\n ]}\\n/>',\n },\n {\n title: \"An empty list\",\n description: \"The region keeps its frame and states its emptiness.\",\n code: '<DescriptionList label=\"Recovery codes\" items={[]} emptyLabel=\"None generated\" />',\n },\n ],\n a11y: {\n role: \"definition list\",\n notes:\n \"Renders a native dl with an aria-label. Terms are dt elements and descriptions dd, so structure survives without styling.\",\n },\n});\n","import type { ComponentPropsWithRef, ReactNode } from \"react\";\nimport { AgentLine } from \"@/agent/view/AgentText.tsx\";\nimport { useSprintView } from \"@/agent/view/mode.ts\";\nimport type { AgentPart } from \"@/agent/view/node.ts\";\nimport {\n agentAttributesFor,\n agentPartAttributesFor,\n buildAgentNode,\n} from \"@/agent/view/project.ts\";\nimport { reactText } from \"@/agent/view/text.ts\";\nimport { descriptionListMeta } from \"./meta.ts\";\nimport \"./DescriptionList.css\";\n\nexport interface DescriptionItem {\n term: ReactNode;\n description: ReactNode;\n}\n\nexport interface DescriptionListProps extends ComponentPropsWithRef<\"dl\"> {\n label: string;\n items: readonly DescriptionItem[];\n emptyLabel?: string;\n loading?: boolean;\n loadingLabel?: string;\n}\n\nfunction pairText(item: DescriptionItem): string | undefined {\n const term = reactText(item.term);\n const description = reactText(item.description);\n if (term === undefined && description === undefined) return undefined;\n return `${term ?? \"\"}: ${description ?? \"\"}`;\n}\n\nexport function DescriptionList(props: DescriptionListProps) {\n const {\n label,\n items,\n emptyLabel = \"Empty\",\n loading = false,\n loadingLabel = \"Loading\",\n ...rest\n } = props;\n\n const view = useSprintView();\n const empty = items.length === 0;\n\n const parts: AgentPart[] = items.map((item, index) => {\n const text = pairText(item);\n return {\n part: \"item\",\n state: { index: String(index + 1) },\n ...(text === undefined ? {} : { label: text }),\n };\n });\n\n const node = buildAgentNode({\n component: descriptionListMeta.name,\n label,\n state: { items: String(items.length), empty, loading },\n parts,\n });\n\n if (view === \"agent\") return <AgentLine node={node} />;\n\n return (\n <dl\n {...rest}\n {...agentAttributesFor(node)}\n aria-label={label}\n aria-busy={loading || undefined}\n >\n {empty ? (\n <div>\n <span>{loading ? loadingLabel : emptyLabel}</span>\n </div>\n ) : (\n items.map((item, index) => (\n <div\n key={`${index}-${String(reactText(item.term))}`}\n {...agentPartAttributesFor({\n part: \"item\",\n state: { index: String(index + 1) },\n })}\n >\n <dt>{item.term}</dt>\n <dd>{item.description}</dd>\n </div>\n ))\n )}\n </dl>\n );\n}\n","import type { AgentToolSpec } from \"@/agent/types.ts\";\n\nexport const CLOSE_DIALOG_TOOL: AgentToolSpec = {\n verb: \"close\",\n description:\n \"Close this dialog without taking its action, exactly as pressing its close control or Escape would. Anything entered inside the dialog may be discarded by the page. To take the dialog's action instead, use the tools its contents register while it is open.\",\n inputSchema: { type: \"object\", properties: {} },\n readOnly: false,\n untrustedContent: true,\n registeredWhen:\n \"The dialog is open. A closed dialog renders nothing and has no tools.\",\n unregisteredWhen: \"The dialog closes or unmounts.\",\n};\n","import { defineAgentMeta } from \"@/agent/registry.ts\";\nimport { CLOSE_DIALOG_TOOL } from \"./tool.ts\";\n\nexport const dialogMeta = defineAgentMeta({\n name: \"Dialog\",\n category: \"overlay\",\n summary:\n \"A modal that interrupts the page for one decision: confirm a destructive action, complete a short step, acknowledge something before continuing.\",\n whenToUse:\n \"Use when the page must not continue until the person decides: confirming a revocation or deletion, a short focused form, a required acknowledgement. Keep one decision per dialog and put its actions inside as ordinary Buttons; tools registered inside the dialog compose their names under its label.\",\n whenNotToUse:\n \"Do not use for status messages; that is an Alert. Do not use for anything the person should be able to ignore; a modal takes the whole page hostage. Do not nest dialogs.\",\n status: \"experimental\",\n props: {\n label: {\n kind: \"string\",\n description:\n \"The dialog's title. Names the dialog for assistive tech, derives the close tool name, and scopes the names of tools registered inside.\",\n required: true,\n },\n open: {\n kind: \"boolean\",\n description:\n \"Whether the dialog is shown. A closed dialog renders nothing at all; the page owns this state.\",\n required: true,\n },\n onClose: {\n kind: \"handler\",\n description:\n \"Called when the person or an agent asks to close: the close control, Escape, or the close tool. Set open to false in response.\",\n required: true,\n },\n children: {\n kind: \"node\",\n description:\n \"The dialog's contents. Ordinary components; anything actionable registers its own tools, scoped under the dialog's label.\",\n required: true,\n },\n headingLevel: {\n kind: \"enum\",\n description:\n \"Render the title as a real heading at this level, joining the page outline.\",\n values: [\"2\", \"3\", \"4\"],\n },\n owner: {\n kind: \"string\",\n description:\n \"The tool name of the control that opened this dialog. Published as data-sprint-owner so a reading agent can attach the dialog to its opener.\",\n },\n agentName: {\n kind: \"string\",\n description: \"Override the label used to derive the close tool name.\",\n },\n agentTool: {\n kind: \"boolean\",\n description: \"Set false to render without registering the close tool.\",\n default: true,\n },\n },\n state: {\n open: {\n description:\n \"Present while the dialog is shown. A closed dialog is absent from the DOM entirely.\",\n attribute: \"data-sprint-open\",\n },\n },\n tools: {\n close: CLOSE_DIALOG_TOOL,\n },\n agentView: {\n example:\n '- **Dialog** \"Revoke key\" [open] with part `close` → tool `close-revoke-key`',\n },\n examples: [\n {\n title: \"A destructive confirmation\",\n description:\n \"The confirm Button registers its tool only while the dialog is open, and its name is scoped under the dialog's label.\",\n code: '<Dialog label=\"Revoke key\" open={confirming} onClose={() => setConfirming(false)}>\\n <Stack gap=\"tight\">\\n <Text>The key stops authenticating immediately. This cannot be undone.</Text>\\n <Button tone=\"danger\" onClick={revoke}>Revoke sk-prod</Button>\\n </Stack>\\n</Dialog>',\n },\n {\n title: \"Owned by its opener\",\n description:\n \"Passing the opener's tool name lets a reading agent attach the dialog to the control that produced it.\",\n code: '<Dialog\\n label=\"Rotate secret\"\\n open={rotating}\\n owner=\"press-rotate-secret\"\\n onClose={() => setRotating(false)}\\n>\\n <Text>The current secret keeps working for one hour.</Text>\\n</Dialog>',\n },\n ],\n a11y: {\n role: \"dialog\",\n keyboard: [\"Escape closes\", \"Tab cycles within the dialog\"],\n notes:\n \"A native dialog element shown with showModal, so focus containment, inerting the page behind, and Escape come from the browser. The title names the dialog via aria-label.\",\n },\n});\n","import {\n type ComponentPropsWithRef,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n} from \"react\";\nimport { AgentControlGroup } from \"@/agent/view/AgentText.tsx\";\nimport { useAgentControls, useSprintView } from \"@/agent/view/mode.ts\";\nimport {\n agentAttributesFor,\n agentPartAttributesFor,\n buildAgentNode,\n} from \"@/agent/view/project.ts\";\nimport { afterCommit } from \"@/agent/webmcp/afterCommit.ts\";\nimport { commitSync } from \"@/agent/webmcp/flush.ts\";\nimport { AgentScopeProvider, useAgentScope } from \"@/agent/webmcp/scope.ts\";\nimport { useAgentTool } from \"@/agent/webmcp/useAgentTool.ts\";\nimport { dialogMeta } from \"./meta.ts\";\nimport { CLOSE_DIALOG_TOOL } from \"./tool.ts\";\nimport \"./Dialog.css\";\n\nexport type DialogHeadingLevel = 2 | 3 | 4;\n\nexport interface DialogProps\n extends Omit<ComponentPropsWithRef<\"dialog\">, \"onClose\" | \"open\"> {\n label: string;\n open: boolean;\n onClose: () => void;\n headingLevel?: DialogHeadingLevel;\n owner?: string;\n agentName?: string;\n agentTool?: boolean;\n}\n\nexport function Dialog(props: DialogProps) {\n const {\n label,\n open,\n onClose,\n headingLevel,\n owner,\n agentName,\n agentTool = true,\n children,\n ref,\n ...rest\n } = props;\n\n const view = useSprintView();\n const controls = useAgentControls();\n const parentScope = useAgentScope();\n\n const element = useRef<HTMLDialogElement | null>(null);\n const closeElement = useRef<HTMLButtonElement | null>(null);\n const onCloseRef = useRef(onClose);\n onCloseRef.current = onClose;\n const openRef = useRef(open);\n openRef.current = open;\n\n const setRef = useCallback(\n (target: HTMLDialogElement | null) => {\n element.current = target;\n if (typeof ref === \"function\") ref(target);\n else if (ref !== null && ref !== undefined) ref.current = target;\n },\n [ref],\n );\n\n useEffect(() => {\n if (!open) return;\n const target = element.current;\n if (target === null) return;\n if (!target.open) {\n if (typeof target.showModal === \"function\") target.showModal();\n else target.open = true;\n }\n return () => {\n if (!target.open) return;\n if (typeof target.close === \"function\") target.close();\n else target.open = false;\n };\n }, [open]);\n\n const execute = useCallback(async () => {\n const target = closeElement.current;\n if (target !== null) target.click();\n else commitSync(() => onCloseRef.current());\n\n await afterCommit();\n if (openRef.current) return \"The page kept the dialog open.\";\n return \"Closed. The dialog is gone from the page.\";\n }, []);\n\n const toolName = useAgentTool({\n spec: CLOSE_DIALOG_TOOL,\n label: agentName ?? label,\n enabled: agentTool && open,\n execute,\n });\n\n const scopeValue = useMemo(\n () => ({ path: [...parentScope, label] }),\n [parentScope, label],\n );\n\n if (!open) return null;\n\n const node = buildAgentNode({\n component: dialogMeta.name,\n label,\n owner,\n region: true,\n state: { open: true },\n parts: [\n {\n part: \"close\",\n label: \"Close\",\n state: {},\n ...(toolName === undefined ? {} : { tool: toolName }),\n },\n ],\n });\n\n if (view === \"agent\") {\n return (\n <AgentControlGroup\n node={node}\n isActionable={() => controls !== \"never\"}\n onActivate={() => onClose()}\n >\n <AgentScopeProvider value={scopeValue}>{children}</AgentScopeProvider>\n </AgentControlGroup>\n );\n }\n\n const Label = headingLevel === undefined ? \"span\" : (`h${headingLevel}` as const);\n\n return (\n <dialog\n {...rest}\n {...agentAttributesFor(node)}\n aria-label={label}\n ref={setRef}\n onCancel={(event) => {\n event.preventDefault();\n onClose();\n }}\n >\n <header>\n <Label>{label}</Label>\n <button\n {...agentPartAttributesFor({\n part: \"close\",\n state: {},\n ...(toolName === undefined ? {} : { tool: toolName }),\n })}\n type=\"button\"\n aria-label=\"Close\"\n ref={closeElement}\n onClick={() => onClose()}\n >\n ×\n </button>\n </header>\n <div>\n <AgentScopeProvider value={scopeValue}>{children}</AgentScopeProvider>\n </div>\n </dialog>\n );\n}\n","import type { AgentToolSpec } from \"@/agent/types.ts\";\n\nexport const EXPAND_DISCLOSURE_TOOL: AgentToolSpec = {\n verb: \"expand\",\n description:\n \"Expand or collapse this region for the person viewing the page, by stating the end state, exactly as a person pressing its toggle would. The content is already readable in the agent view either way, so call this only to change what a person sees. Setting the state it already has succeeds and changes nothing. Returns the region's state after the call.\",\n inputSchema: {\n type: \"object\",\n properties: {\n expanded: {\n type: \"boolean\",\n description: \"The end state: true reveals the region, false conceals it.\",\n },\n },\n required: [\"expanded\"],\n },\n readOnly: false,\n untrustedContent: true,\n registeredWhen:\n \"The disclosure is mounted, has a resolvable label, and no other component claims the same tool name.\",\n unregisteredWhen: \"The disclosure unmounts or agentTool is set false.\",\n};\n","import { defineAgentMeta } from \"@/agent/registry.ts\";\nimport { EXPAND_DISCLOSURE_TOOL } from \"./tool.ts\";\n\nexport const disclosureMeta = defineAgentMeta({\n name: \"Disclosure\",\n category: \"layout\",\n summary:\n \"A labelled region a person can show or hide with a toggle that carries its expanded state. Collapsing conceals the content from a person only: it stays in the page, and the agent view always renders it.\",\n whenToUse:\n 'Use it for secondary detail a person reads on demand beside the primary content, such as an access breakdown on a user page behind \"Show access breakdown\". It replaces a Button that swaps its own label, because the toggle publishes aria-expanded and the region it controls, and the content stays readable to an agent without a click.',\n whenNotToUse:\n \"Do not use it to hide content an agent should not read; collapsing is a human affordance and the agent view carries the content regardless. Do not use it for a region that is always visible, which is a Panel, or for content that must interrupt the page, which is a Dialog. Do not use it to switch between alternative views of the same data, which is a SegmentedControl.\",\n status: \"experimental\",\n props: {\n label: {\n kind: \"string\",\n description:\n 'What the region is, as a noun phrase such as \"Access breakdown\". It names the region for a screen reader, derives the toggle text and the tool name.',\n required: true,\n },\n children: {\n kind: \"node\",\n description:\n \"The region's content. It is always mounted: collapsing hides it from a person with CSS, so components inside keep their tools and stay in the page projection.\",\n },\n expanded: {\n kind: \"boolean\",\n description:\n \"Whether the region is revealed. Pass it with onExpandedChange to control the disclosure; leave it unset to let the disclosure keep its own state.\",\n },\n defaultExpanded: {\n kind: \"boolean\",\n description: \"The initial state when the disclosure is uncontrolled.\",\n default: false,\n },\n onExpandedChange: {\n kind: \"handler\",\n description:\n \"Called with the new state whenever the toggle is pressed, by a person, a DOM-driving agent, or the expand tool.\",\n },\n showLabel: {\n kind: \"string\",\n description: \"The toggle text while collapsed.\",\n default: '\"Show \" followed by the label',\n },\n hideLabel: {\n kind: \"string\",\n description: \"The toggle text while expanded.\",\n default: '\"Hide \" followed by the label',\n },\n agentName: {\n kind: \"string\",\n description:\n \"Override the label used to derive the tool name, when two disclosures on a page would otherwise collide.\",\n },\n agentTool: {\n kind: \"boolean\",\n description:\n \"Set false to render the disclosure without registering an expand tool.\",\n default: true,\n },\n },\n state: {\n expanded: {\n description:\n \"Present while the region is revealed to a person. Absent means collapsed: the content is still in the page, concealed by CSS rather than unmounted or marked hidden.\",\n attribute: \"data-sprint-expanded\",\n },\n },\n tools: {\n expand: EXPAND_DISCLOSURE_TOOL,\n },\n agentView: {\n example:\n '- **Disclosure** \"Access breakdown\" → tool `expand-access-breakdown`\\n - part `toggle` \"Show access breakdown\"\\n - **Text** \"Admin through the Operators group.\"',\n },\n examples: [\n {\n title: \"Secondary detail on demand\",\n description:\n \"Uncontrolled: the disclosure keeps its own state. In agent view the content renders beneath the line whether or not a person has opened it, and the toggle is one control.\",\n code: '<Disclosure label=\"Access breakdown\">\\n <Text>Admin through the Operators group.</Text>\\n</Disclosure>',\n },\n {\n title: \"A controlled disclosure\",\n description:\n \"Pass expanded and onExpandedChange when something else on the page needs to know or set whether the region is open. The expand tool drives the same toggle.\",\n code: '<Disclosure\\n label=\"Access breakdown\"\\n expanded={open}\\n onExpandedChange={setOpen}\\n>\\n <Text>Admin through the Operators group.</Text>\\n</Disclosure>',\n },\n {\n title: \"Custom toggle text\",\n description:\n \"showLabel and hideLabel replace the derived toggle text when the noun phrase does not read naturally after Show and Hide.\",\n code: '<Disclosure label=\"Audit trail\" showLabel=\"Show 12 events\" hideLabel=\"Hide events\">\\n <Text>Last change was a role grant by the on-call operator.</Text>\\n</Disclosure>',\n },\n ],\n a11y: {\n role: \"region\",\n keyboard: [\"Enter toggles\", \"Space toggles\"],\n notes:\n \"The root is a section named by the label. The toggle is a real button with aria-expanded and aria-controls pointing at the content. Collapsed content is display: none, which removes it from the accessibility tree for a person and a screen reader while leaving it in the DOM for the agent projection.\",\n },\n relatedComponents: [\"Panel\", \"Switch\"],\n});\n","import {\n type ComponentPropsWithRef,\n useCallback,\n useEffect,\n useId,\n useRef,\n useState,\n} from \"react\";\nimport { AgentControlGroup, AgentLine } from \"@/agent/view/AgentText.tsx\";\nimport { useAgentControls, useAgentFormat, useSprintView } from \"@/agent/view/mode.ts\";\nimport type { AgentPart } from \"@/agent/view/node.ts\";\nimport {\n agentAttributesFor,\n agentPartAttributesFor,\n buildAgentNode,\n} from \"@/agent/view/project.ts\";\nimport { afterCommit } from \"@/agent/webmcp/afterCommit.ts\";\nimport { commitSync } from \"@/agent/webmcp/flush.ts\";\nimport { useAgentTool } from \"@/agent/webmcp/useAgentTool.ts\";\nimport { disclosureMeta } from \"./meta.ts\";\nimport { EXPAND_DISCLOSURE_TOOL } from \"./tool.ts\";\nimport \"./Disclosure.css\";\n\nexport interface DisclosureProps extends ComponentPropsWithRef<\"section\"> {\n label: string;\n expanded?: boolean;\n defaultExpanded?: boolean;\n onExpandedChange?: (expanded: boolean) => void;\n showLabel?: string;\n hideLabel?: string;\n agentName?: string;\n agentTool?: boolean;\n}\n\nfunction inSentence(label: string): string {\n return /^[A-Z][a-z]/.test(label)\n ? `${label[0]?.toLowerCase()}${label.slice(1)}`\n : label;\n}\n\nexport function Disclosure(props: DisclosureProps) {\n const {\n label,\n expanded: controlled,\n defaultExpanded = false,\n onExpandedChange,\n showLabel = `Show ${inSentence(label)}`,\n hideLabel = `Hide ${inSentence(label)}`,\n agentName,\n agentTool = true,\n children,\n ...rest\n } = props;\n\n const view = useSprintView();\n const controls = useAgentControls();\n const formatter = useAgentFormat();\n const contentId = useId();\n\n const [uncontrolled, setUncontrolled] = useState(defaultExpanded);\n const expanded = controlled ?? uncontrolled;\n\n const toggle = useRef<HTMLButtonElement | null>(null);\n const expandedRef = useRef(expanded);\n expandedRef.current = expanded;\n const controlledRef = useRef(controlled !== undefined);\n controlledRef.current = controlled !== undefined;\n const onChangeRef = useRef(onExpandedChange);\n onChangeRef.current = onExpandedChange;\n const formatRef = useRef(formatter);\n formatRef.current = formatter;\n const nodeRef = useRef(buildAgentNode({ component: disclosureMeta.name }));\n const mounted = useRef(true);\n\n useEffect(() => {\n mounted.current = true;\n return () => {\n mounted.current = false;\n };\n }, []);\n\n const change = useCallback((next: boolean) => {\n if (!controlledRef.current) setUncontrolled(next);\n onChangeRef.current?.(next);\n }, []);\n\n const press = () => change(!expanded);\n\n const execute = useCallback(\n async (inputs: Record<string, unknown>) => {\n const desired = inputs.expanded;\n if (typeof desired !== \"boolean\") {\n return 'Pass \"expanded\" as true or false; it states the end state.';\n }\n\n const already = desired === expandedRef.current;\n if (!already) {\n const target = toggle.current;\n if (target !== null) target.click();\n else commitSync(() => change(desired));\n }\n\n await afterCommit();\n if (!mounted.current) return \"The change removed this disclosure from the page.\";\n const outcome = already\n ? `Already ${desired ? \"expanded\" : \"collapsed\"}`\n : desired\n ? \"Expanded\"\n : \"Collapsed\";\n return `${outcome}. The disclosure is now:\\n${formatRef.current([nodeRef.current])}`;\n },\n [change],\n );\n\n const toolName = useAgentTool({\n spec: EXPAND_DISCLOSURE_TOOL,\n label: agentName ?? label,\n enabled: agentTool,\n execute,\n });\n\n const part: AgentPart = {\n part: \"toggle\",\n label: expanded ? hideLabel : showLabel,\n state: expanded ? { expanded: true } : {},\n };\n\n const node = buildAgentNode({\n component: disclosureMeta.name,\n label,\n tool: toolName,\n region: true,\n state: { expanded },\n parts: [part],\n });\n nodeRef.current = node;\n\n if (view === \"agent\") {\n if (controls === \"never\") return <AgentLine node={node}>{children}</AgentLine>;\n return (\n <AgentControlGroup node={node} onActivate={press}>\n {children}\n </AgentControlGroup>\n );\n }\n\n return (\n <section {...rest} {...agentAttributesFor(node)} aria-label={label}>\n <button\n {...agentPartAttributesFor(part)}\n ref={toggle}\n type=\"button\"\n aria-expanded={expanded}\n aria-controls={contentId}\n onClick={press}\n >\n {part.label}\n </button>\n <div id={contentId}>{children}</div>\n </section>\n );\n}\n","import { defineAgentMeta } from \"@/agent/registry.ts\";\n\nexport const dividerMeta = defineAgentMeta({\n name: \"Divider\",\n category: \"layout\",\n summary:\n \"A horizontal rule that segments a page: the line between a header or a breadcrumb and the body under it, or between two runs of content. It draws in the active theme's own keyline or band, and can name the segment it opens.\",\n whenToUse:\n \"Use it where a page changes subject and nothing else marks the change: under a PageHeader or a Breadcrumb before the body starts, or between groups of panels. Give it a label when the segment that follows has a name worth reading; an unlabelled Divider is invisible in agent view, because an agent does not care where a line is drawn, only what the line announces.\",\n whenNotToUse:\n \"Do not use it to space things out; that is the gap on Stack. Do not use it to frame a region with a header; that is Panel, which draws its own keylines. Do not stack two in a row, and do not use it inside a Panel to separate a list's items; the list draws its own.\",\n status: \"experimental\",\n props: {\n label: {\n kind: \"string\",\n description:\n \"The name of the segment the divider opens, rendered small on the rule.\",\n },\n weight: {\n kind: \"enum\",\n description:\n 'How hard the break is. \"hairline\" is a keyline, \"heavy\" a thick strong keyline, \"band\" a strip of the theme\\'s own ornament for the one break that matters most on a page.',\n values: [\"hairline\", \"heavy\", \"band\"],\n default: \"hairline\",\n },\n },\n state: {\n weight: {\n description: \"How hard the break is.\",\n attribute: \"data-sprint-weight\",\n values: [\"hairline\", \"heavy\", \"band\"],\n },\n },\n agentView: {\n example: '- **Divider** \"Results\" [weight=band]',\n },\n a11y: {\n role: \"separator\",\n notes:\n \"The rule is a native hr, so assistive technology announces a separator. A label is ordinary text read just before it, the way a person reads it on the rule.\",\n },\n relatedComponents: [\"Stack\", \"PageHeader\", \"Breadcrumb\", \"Panel\"],\n examples: [\n {\n title: \"Separating the header from the body\",\n description:\n \"The plainest break: a keyline under the page's chrome, before the content starts.\",\n code: '<Stack>\\n <Breadcrumb\\n label=\"Docs\"\\n items={[{ label: \"guides\", children: [{ href: \"#/guide/webmcp\", label: \"WebMCP\", active: true }] }]}\\n />\\n <Divider />\\n <Text>The body of the page starts here.</Text>\\n</Stack>',\n },\n {\n title: \"A named segment\",\n description:\n \"A label names what follows, on the rule itself and to an agent reading the page.\",\n code: '<Divider label=\"Results\" weight=\"heavy\" />',\n },\n {\n title: \"The page's main break\",\n description:\n \"A band draws the theme's own ornament: hatching in the default register, pins in calorie, a barcode strip in trax, a row of dots in ambient. Use it once per page.\",\n code: '<Divider label=\"Body\" weight=\"band\" />',\n },\n ],\n});\n","import type { ComponentPropsWithRef } from \"react\";\nimport { AgentLine } from \"@/agent/view/AgentText.tsx\";\nimport { useSprintView } from \"@/agent/view/mode.ts\";\nimport { agentAttributesFor, buildAgentNode } from \"@/agent/view/project.ts\";\nimport { dividerMeta } from \"./meta.ts\";\nimport \"./Divider.css\";\n\nexport type DividerWeight = \"hairline\" | \"heavy\" | \"band\";\n\nexport interface DividerProps extends Omit<ComponentPropsWithRef<\"div\">, \"children\"> {\n label?: string;\n weight?: DividerWeight;\n}\n\nexport function Divider(props: DividerProps) {\n const { label, weight = \"hairline\", ...rest } = props;\n\n const view = useSprintView();\n\n const node = buildAgentNode({\n component: dividerMeta.name,\n label,\n state: { weight },\n });\n\n if (view === \"agent\") return label === undefined ? null : <AgentLine node={node} />;\n\n return (\n <div {...rest} {...agentAttributesFor(node)}>\n {label === undefined ? null : <span>{label}</span>}\n <hr />\n </div>\n );\n}\n","import type { AgentToolSpec } from \"@/agent/types.ts\";\n\nexport const OPEN_LINK_TOOL: AgentToolSpec = {\n verb: \"open\",\n description:\n \"Follow this link and load its destination, exactly as a person clicking it would. The current page is replaced, so anything unsaved on it is lost and any tool registered by this page stops existing.\",\n inputSchema: { type: \"object\", properties: {} },\n readOnly: false,\n untrustedContent: true,\n registeredWhen:\n \"The link opts in with agentTool, is mounted, has a resolvable label, and no other component claims the same tool name. Links register nothing by default.\",\n unregisteredWhen: \"The link unmounts or opts back out.\",\n};\n","import { defineAgentMeta } from \"@/agent/registry.ts\";\nimport { OPEN_LINK_TOOL } from \"./tool.ts\";\n\nexport const linkMeta = defineAgentMeta({\n name: \"Link\",\n category: \"navigation\",\n summary:\n \"A navigation link. It publishes its destination as state, so an agent reading the page in text learns the URL rather than having to click to find out, and it renders a real anchor in both views.\",\n whenToUse:\n \"Use it for anything that changes the address: a nav item, a cross-reference, a link out to a specification. Set active on the item matching the current route so the agent view and the human view agree about where you are. Under a client-side router, pass an onClick that prevents default and navigates; the handler rides the anchor in both views, so agent clicks and open tools go through the router too.\",\n whenNotToUse:\n \"Do not use it for an action that stays on the page; that is a Button. Do not register a tool on ordinary navigation: an agent can already reach a URL, and a page of links would flood its tool list for no gain.\",\n status: \"experimental\",\n props: {\n href: {\n kind: \"string\",\n description:\n \"The destination. Published as data-sprint-href and carried in the agent view, so the URL is readable without a click.\",\n required: true,\n },\n children: {\n kind: \"node\",\n description:\n \"The link text. It names the destination, so prefer the page's name over here or read more.\",\n required: true,\n },\n active: {\n kind: \"boolean\",\n description:\n \"Mark the link as the current location. Sets aria-current so a screen reader and an agent learn it the same way.\",\n default: false,\n },\n external: {\n kind: \"boolean\",\n description:\n \"Mark a destination outside this app. Opens in a new context and adds the usual rel protections.\",\n default: false,\n },\n agentTool: {\n kind: \"boolean\",\n description:\n \"Set true to register an open tool for this link. Off by default: navigation is reachable by URL, so a tool per link is cost without benefit.\",\n default: false,\n },\n agentName: {\n kind: \"string\",\n description:\n \"Override the label used to derive the tool name, for icon-only links or two links with the same text.\",\n },\n },\n state: {\n href: {\n description: \"Where this link goes.\",\n attribute: \"data-sprint-href\",\n },\n active: {\n description: \"Present when this link is the current location.\",\n attribute: \"data-sprint-active\",\n },\n external: {\n description: \"Present when the destination is outside this app.\",\n attribute: \"data-sprint-external\",\n },\n },\n tools: {\n open: OPEN_LINK_TOOL,\n },\n agentView: {\n example: '- **Link** \"Button\" [active, href=#/Button]',\n },\n examples: [\n {\n title: \"A nav item\",\n code: '<Link href=\"#/Button\" active={route === \"Button\"}>Button</Link>',\n },\n {\n title: \"A link out\",\n code: '<Link href=\"https://developer.chrome.com/docs/ai/webmcp\" external>\\n Chrome docs\\n</Link>',\n },\n {\n title: \"A link an agent may follow itself\",\n description:\n \"Opting in is for the one link that completes a task, not for a nav list.\",\n code: '<Link href=\"#/checkout\" agentTool>Go to checkout</Link>',\n },\n ],\n a11y: {\n role: \"link\",\n keyboard: [\"Enter follows the link\"],\n notes:\n \"active sets aria-current=page. External links open in a new context with rel=noreferrer noopener, and carry their outward mark as a pseudo-element with empty alternative text so it never reaches the accessible name or the tool name. Inside Text a link is underlined all the time, so colour is never the only thing distinguishing it from the prose around it.\",\n },\n});\n","import { type ComponentPropsWithRef, useCallback, useRef } from \"react\";\nimport { AgentControl, AgentLine } from \"@/agent/view/AgentText.tsx\";\nimport { useAgentControls, useSprintView } from \"@/agent/view/mode.ts\";\nimport { agentAttributesFor, buildAgentNode } from \"@/agent/view/project.ts\";\nimport { reactText } from \"@/agent/view/text.ts\";\nimport { useAgentTool } from \"@/agent/webmcp/useAgentTool.ts\";\nimport { linkMeta } from \"./meta.ts\";\nimport { OPEN_LINK_TOOL } from \"./tool.ts\";\nimport \"./Link.css\";\n\nexport interface LinkProps extends ComponentPropsWithRef<\"a\"> {\n href: string;\n active?: boolean;\n external?: boolean;\n agentTool?: boolean;\n agentName?: string;\n}\n\nexport function Link(props: LinkProps) {\n const {\n href,\n active = false,\n external = false,\n agentTool = false,\n agentName,\n children,\n ref,\n onClick,\n ...rest\n } = props;\n\n const view = useSprintView();\n const controls = useAgentControls();\n const element = useRef<HTMLAnchorElement | null>(null);\n\n const setRef = useCallback(\n (target: HTMLAnchorElement | null) => {\n element.current = target;\n if (typeof ref === \"function\") ref(target);\n else if (ref !== null && ref !== undefined) ref.current = target;\n },\n [ref],\n );\n\n const label = agentName ?? reactText(children);\n\n const execute = useCallback(() => {\n const target = element.current;\n if (target === null) {\n return \"This link renders no element in the current view. Navigate to its href instead.\";\n }\n target.click();\n return `Following ${target.getAttribute(\"href\") ?? href}.`;\n }, [href]);\n\n const toolName = useAgentTool({\n spec: OPEN_LINK_TOOL,\n label,\n enabled: agentTool,\n execute,\n });\n\n const node = buildAgentNode({\n component: linkMeta.name,\n label: reactText(children),\n tool: toolName,\n state: { href, active, external },\n });\n\n const outward = external\n ? { target: \"_blank\", rel: \"noreferrer noopener\" }\n : { target: undefined, rel: undefined };\n\n if (view === \"agent\") {\n if (controls === \"never\") return <AgentLine node={node} />;\n return (\n <AgentControl\n node={node}\n as=\"a\"\n href={href}\n ref={setRef}\n onClick={onClick}\n target={outward.target}\n rel={outward.rel}\n />\n );\n }\n\n return (\n <a\n {...rest}\n {...agentAttributesFor(node)}\n href={href}\n ref={setRef}\n onClick={onClick}\n aria-current={active ? \"page\" : undefined}\n target={outward.target}\n rel={outward.rel}\n >\n {children}\n </a>\n );\n}\n","import { defineAgentMeta } from \"@/agent/registry.ts\";\n\nexport const emptyStateMeta = defineAgentMeta({\n name: \"EmptyState\",\n category: \"feedback\",\n summary:\n \"A region that says there is nothing here, and why: a headline, an optional sentence, and an optional way out such as clearing filters or creating the first record. It marks the empty field with the register's own empty ornament.\",\n whenToUse:\n 'Use it in place of a list, grid, or set of results that has nothing to show, so the space says it is empty rather than rendering nothing. Set reason=\"filtered\" when records exist but none match, so an agent knows to relax the filters rather than conclude there is no data.',\n whenNotToUse:\n \"Do not use it for an empty Table, List, or Panel; those already carry their own emptyLabel. Do not use it for a failure; that is an Alert. Do not use it while data is still loading; that is Pending.\",\n status: \"experimental\",\n props: {\n label: {\n kind: \"string\",\n description:\n 'The headline, saying what is empty in a few words: \"No one matches these filters\". The region\\'s accessible name.',\n required: true,\n },\n description: {\n kind: \"string\",\n description:\n \"One sentence of explanation or next step. Carried as the description part.\",\n },\n action: {\n kind: \"object\",\n description:\n \"The one way out, as data: { label, onSelect?, href? }. An href renders a Link, otherwise a Button that registers its own press tool, so the action is a single control in the agent view.\",\n },\n reason: {\n kind: \"enum\",\n description:\n \"Why it is empty: nothing exists yet, or nothing matches the current filters.\",\n values: [\"empty\", \"filtered\"],\n default: \"empty\",\n },\n },\n state: {\n empty: {\n description: \"Always present, so one selector finds every empty region.\",\n attribute: \"data-sprint-empty\",\n },\n reason: {\n description: \"Why the region is empty.\",\n attribute: \"data-sprint-reason\",\n values: [\"empty\", \"filtered\"],\n },\n },\n agentView: {\n example:\n '- **EmptyState** \"No one matches these filters\" [empty, reason=filtered]\\n - part `description` \"Try a different role or clear the search.\"',\n },\n examples: [\n {\n title: \"Nothing matches\",\n description:\n \"Records exist but the filters exclude them all. The action is a Button, so it registers press-clear-filters.\",\n code: '<EmptyState\\n reason=\"filtered\"\\n label=\"No one matches these filters\"\\n description=\"Try a different role or clear the search.\"\\n action={{ label: \"Clear filters\", onSelect: clearFilters }}\\n/>',\n },\n {\n title: \"Nothing yet\",\n description: \"The first-run case, with a link to where records are made.\",\n code: '<EmptyState\\n label=\"No projects yet\"\\n description=\"Projects you create or are invited to appear here.\"\\n action={{ label: \"Create a project\", href: \"#/projects/new\" }}\\n/>',\n },\n {\n title: \"Just the headline\",\n code: '<EmptyState label=\"No notifications\" />',\n },\n ],\n a11y: {\n role: \"group\",\n notes:\n \"The headline names the group and the description describes it. The action is an ordinary Button or Link inside it, reached in normal tab order.\",\n },\n relatedComponents: [\"Pending\", \"Alert\", \"Button\", \"Link\"],\n});\n","import { type ComponentPropsWithRef, type MouseEvent, useId } from \"react\";\nimport { AgentLine } from \"@/agent/view/AgentText.tsx\";\nimport { useSprintView } from \"@/agent/view/mode.ts\";\nimport type { AgentPart } from \"@/agent/view/node.ts\";\nimport {\n agentAttributesFor,\n agentPartAttributesFor,\n buildAgentNode,\n} from \"@/agent/view/project.ts\";\nimport { Button } from \"../Button/index.ts\";\nimport { Link } from \"../Link/index.ts\";\nimport { emptyStateMeta } from \"./meta.ts\";\nimport \"./EmptyState.css\";\n\nexport type EmptyStateReason = \"empty\" | \"filtered\";\n\nexport interface EmptyStateAction {\n label: string;\n onSelect?: (event: MouseEvent<HTMLElement>) => void;\n href?: string;\n}\n\nexport interface EmptyStateProps\n extends Omit<ComponentPropsWithRef<\"div\">, \"children\"> {\n label: string;\n description?: string;\n action?: EmptyStateAction;\n reason?: EmptyStateReason;\n}\n\nfunction ActionControl(props: { action: EmptyStateAction }) {\n const { action } = props;\n if (action.href !== undefined) {\n return (\n <Link href={action.href} onClick={action.onSelect}>\n {action.label}\n </Link>\n );\n }\n return <Button onClick={action.onSelect}>{action.label}</Button>;\n}\n\nexport function EmptyState(props: EmptyStateProps) {\n const { label, description, action, reason = \"empty\", ...rest } = props;\n\n const view = useSprintView();\n const id = useId();\n\n const parts: AgentPart[] =\n description === undefined\n ? []\n : [{ part: \"description\", label: description, state: {} }];\n\n const node = buildAgentNode({\n component: emptyStateMeta.name,\n label,\n state: { empty: true, reason },\n parts,\n });\n\n const control = action === undefined ? null : <ActionControl action={action} />;\n\n if (view === \"agent\") return <AgentLine node={node}>{control}</AgentLine>;\n\n const labelId = `${id}-label`;\n const descriptionId = `${id}-description`;\n\n return (\n // biome-ignore lint/a11y/useSemanticElements: the suggested fieldset groups form controls; this groups a headline, its explanation, and a way out, and group is the ARIA role for exactly that\n <div\n {...rest}\n {...agentAttributesFor(node)}\n role=\"group\"\n aria-labelledby={labelId}\n aria-describedby={description === undefined ? undefined : descriptionId}\n >\n <div>\n <p id={labelId}>{label}</p>\n {description === undefined ? null : (\n <p\n id={descriptionId}\n {...agentPartAttributesFor({ part: \"description\", state: {} })}\n >\n {description}\n </p>\n )}\n {control}\n </div>\n </div>\n );\n}\n","import { defineAgentMeta } from \"@/agent/registry.ts\";\n\nexport const tagMeta = defineAgentMeta({\n name: \"Tag\",\n category: \"display\",\n summary:\n \"A small chip that classifies the thing next to it: a status, a category, a count, a build string.\",\n whenToUse:\n \"Use it for a short classification a person scans and an agent reads off the tone attribute, such as a release status, a read-only or write marker on a tool, or a version chip.\",\n whenNotToUse:\n \"Do not use it for anything clickable; a Tag is inert, and a chip that acts is a Button. Do not put a sentence in one.\",\n status: \"experimental\",\n props: {\n children: {\n kind: \"node\",\n description: \"The chip text. One or two words.\",\n required: true,\n },\n tone: {\n kind: \"enum\",\n description:\n \"What class of thing this is. Acid is rationed, so reach for info or inert before action.\",\n values: [\"neutral\", \"action\", \"danger\", \"info\", \"warning\", \"inert\"],\n default: \"neutral\",\n },\n filled: {\n kind: \"boolean\",\n description:\n \"Render as a solid field of the tone with inverted ink, instead of a keyline. Use for the one chip that must be read first.\",\n default: false,\n },\n },\n state: {\n tone: {\n description: \"The class of thing the chip marks.\",\n attribute: \"data-sprint-tone\",\n values: [\"neutral\", \"action\", \"danger\", \"info\", \"warning\", \"inert\"],\n },\n filled: {\n description: \"Present when the chip is a solid field rather than a keyline.\",\n attribute: \"data-sprint-filled\",\n },\n },\n agentView: {\n example: '- **Tag** \"experimental\" [filled, tone=warning]',\n },\n examples: [\n {\n title: \"A release status\",\n code: '<Tag tone=\"warning\" filled>experimental</Tag>',\n },\n {\n title: \"A category chip\",\n code: \"<Tag>action</Tag>\",\n },\n {\n title: \"Read-only against changes-state\",\n description:\n \"Two tones doing the work a legend would otherwise have to do in prose.\",\n code: '<Tag tone={tool.readOnly ? \"info\" : \"danger\"}>\\n {tool.readOnly ? \"read only\" : \"changes state\"}\\n</Tag>',\n },\n ],\n});\n","import type { ComponentPropsWithRef } from \"react\";\nimport { AgentLine } from \"@/agent/view/AgentText.tsx\";\nimport { useSprintView } from \"@/agent/view/mode.ts\";\nimport { agentAttributesFor, buildAgentNode } from \"@/agent/view/project.ts\";\nimport { reactText } from \"@/agent/view/text.ts\";\nimport { tagMeta } from \"./meta.ts\";\nimport \"./Tag.css\";\n\nexport type TagTone = \"neutral\" | \"action\" | \"danger\" | \"info\" | \"warning\" | \"inert\";\n\nexport interface TagProps extends ComponentPropsWithRef<\"span\"> {\n tone?: TagTone;\n filled?: boolean;\n}\n\nexport function Tag(props: TagProps) {\n const { tone = \"neutral\", filled = false, children, ...rest } = props;\n\n const view = useSprintView();\n\n const node = buildAgentNode({\n component: tagMeta.name,\n label: reactText(children),\n state: { tone, filled },\n });\n\n if (view === \"agent\") return <AgentLine node={node} />;\n\n return (\n <span {...rest} {...agentAttributesFor(node)}>\n {children}\n </span>\n );\n}\n","import type { AgentToolSpec } from \"@/agent/types.ts\";\n\nexport const OPEN_ENTITY_ROW_TOOL: AgentToolSpec = {\n verb: \"open\",\n description:\n \"Open this row, exactly as a person clicking it would. What opening does is the row's own business: it may select the record, reveal its detail, or start a flow. Returns the row's state after the click.\",\n inputSchema: { type: \"object\", properties: {} },\n readOnly: false,\n untrustedContent: true,\n registeredWhen:\n \"The row acts rather than navigates, is mounted, enabled, has a resolvable title, and no other component claims the same tool name.\",\n unregisteredWhen:\n \"The row unmounts, becomes disabled, or turns into a link by taking an href.\",\n};\n","import { defineAgentMeta } from \"@/agent/registry.ts\";\nimport { OPEN_ENTITY_ROW_TOOL } from \"./tool.ts\";\n\nexport const entityRowMeta = defineAgentMeta({\n name: \"EntityRow\",\n category: \"display\",\n summary:\n \"One record in a list of records, as a single clickable row: a title, a few Tags, and one line of meta. Give it an href and the whole row is a link; give it onSelect and it is an action that registers an open tool.\",\n whenToUse:\n 'Use it for a list of people, projects, or anything else a person scans and picks one of, where each entry needs a name, a classification, and a line of context such as last activity. Stack several in a Stack with gap=\"none\" and adjacent rows share their keylines. The title is the accessible name, so it is also what an agent selects on.',\n whenNotToUse:\n \"Do not use it when the entries are compared column by column; that is a Table. Do not use it for a catalogue entry with a paragraph of body; that is a Card. Do not put controls in it: the whole row is already one link or button, so tags and meta are data, not components.\",\n status: \"experimental\",\n props: {\n title: {\n kind: \"string\",\n description:\n \"The record's name, and the row's accessible name. Also derives the tool name when the row acts.\",\n required: true,\n },\n href: {\n kind: \"string\",\n description:\n \"Destination, which makes the whole row a link. A row that navigates registers no tool by default, because an agent can follow the href itself.\",\n },\n onSelect: {\n kind: \"handler\",\n description:\n \"What clicking does, called with the click event. Alone it makes the row a button that registers an open tool by default. Alongside href the row stays a link and the handler rides the click, so a router can call preventDefault.\",\n },\n tags: {\n kind: \"array\",\n description:\n \"Classifications rendered as Tags after the title: { label, tone? }, where tone is one of the Tag tones. Carried as Tag lines under the row in the agent view.\",\n },\n meta: {\n kind: \"array\",\n description:\n \"One line of context, each entry a string or { term?, detail }, joined with a middle dot. Truncates rather than wraps when the row is short of room. Carried as the meta part.\",\n },\n description: {\n kind: \"string\",\n description:\n \"An optional sentence under the row, for a record that needs more than a line of meta. Carried as the description part.\",\n },\n disabled: {\n kind: \"boolean\",\n description:\n \"Disable an acting row and unregister its tool. Has no effect on a row that navigates or does nothing.\",\n default: false,\n },\n agentTool: {\n kind: \"boolean\",\n description:\n \"Override the default: on for a row that acts, off for a row that navigates. A row with neither href nor onSelect never registers one.\",\n },\n agentName: {\n kind: \"string\",\n description:\n \"Override the title used to derive the tool name, when two rows share a title.\",\n },\n },\n state: {\n href: {\n description: \"Where the row goes, when it navigates.\",\n attribute: \"data-sprint-href\",\n },\n disabled: {\n description: \"Present when an acting row cannot be opened.\",\n attribute: \"data-sprint-disabled\",\n },\n },\n tools: {\n open: OPEN_ENTITY_ROW_TOOL,\n },\n agentView: {\n example:\n '- **EntityRow** \"Ada Lovelace\" [href=#/people/ada]\\n - part `title` \"Ada Lovelace\"\\n - part `meta` \"Last sign-in: 3 days ago · 2 apps\"\\n - **Tag** \"admin\" [tone=info]\\n - **Tag** \"billing\" [tone=neutral]',\n },\n examples: [\n {\n title: \"A person in a directory\",\n description:\n \"A row that navigates. No tool, because the href is already public; tags and meta are data.\",\n code: '<EntityRow\\n title=\"Ada Lovelace\"\\n href=\"#/people/ada\"\\n tags={[{ label: \"admin\", tone: \"info\" }, { label: \"billing\" }]}\\n meta={[{ term: \"Last sign-in\", detail: \"3 days ago\" }, \"2 apps\"]}\\n/>',\n },\n {\n title: \"A row that acts\",\n description:\n \"onSelect instead of href, so the row registers open-grace-hopper and an agent can pick it.\",\n code: '<EntityRow\\n title=\"Grace Hopper\"\\n onSelect={() => select(\"grace\")}\\n tags={[{ label: \"owner\", tone: \"warning\" }]}\\n meta={[\"Invited yesterday\"]}\\n/>',\n },\n {\n title: \"A directory of rows\",\n description:\n \"Rows stacked with no gap share their keylines, so the list reads as one ruled block.\",\n code: '<Stack gap=\"none\">\\n {people.map((person) => (\\n <EntityRow\\n key={person.id}\\n title={person.name}\\n href={person.href}\\n tags={person.roles.map((role) => ({ label: role }))}\\n meta={[{ term: \"Last sign-in\", detail: person.lastSignIn }]}\\n />\\n ))}\\n</Stack>',\n },\n {\n title: \"With a description\",\n description: \"A sentence under the row, for a record that needs one.\",\n code: '<EntityRow\\n title=\"Payments service\"\\n href=\"#/projects/payments\"\\n tags={[{ label: \"degraded\", tone: \"danger\" }]}\\n meta={[\"Updated 4 min ago\"]}\\n description=\"Card authorisations are timing out in eu-west.\"\\n/>',\n },\n ],\n a11y: {\n notes:\n \"The whole row is one control: a link with an href, a button with onSelect, or a labelled group with neither. The title is the accessible name, and the tags, meta, and description are its accessible description, so a screen reader announces the name first and the context after.\",\n },\n relatedComponents: [\"Card\", \"Tag\", \"Stack\", \"Table\"],\n});\n","import {\n type ComponentPropsWithRef,\n Fragment,\n type MouseEvent,\n type Ref,\n useCallback,\n useEffect,\n useId,\n useRef,\n} from \"react\";\nimport { AgentControl, AgentLine } from \"@/agent/view/AgentText.tsx\";\nimport { useAgentControls, useAgentFormat, useSprintView } from \"@/agent/view/mode.ts\";\nimport type { AgentPart } from \"@/agent/view/node.ts\";\nimport {\n agentAttributesFor,\n agentPartAttributesFor,\n buildAgentNode,\n} from \"@/agent/view/project.ts\";\nimport { afterCommit } from \"@/agent/webmcp/afterCommit.ts\";\nimport { useAgentTool } from \"@/agent/webmcp/useAgentTool.ts\";\nimport { Tag, type TagTone } from \"../Tag/index.ts\";\nimport { entityRowMeta } from \"./meta.ts\";\nimport { OPEN_ENTITY_ROW_TOOL } from \"./tool.ts\";\nimport \"./EntityRow.css\";\n\nexport interface EntityRowTag {\n label: string;\n tone?: TagTone;\n}\n\nexport type EntityRowDetail = string | { term?: string; detail: string };\n\nexport interface EntityRowProps\n extends Omit<\n ComponentPropsWithRef<\"button\">,\n \"ref\" | \"onSelect\" | \"children\" | \"title\"\n > {\n title: string;\n href?: string;\n onSelect?: (event: MouseEvent<HTMLElement>) => void;\n tags?: readonly EntityRowTag[];\n meta?: readonly EntityRowDetail[];\n description?: string;\n disabled?: boolean;\n agentTool?: boolean;\n agentName?: string;\n ref?: Ref<HTMLButtonElement> | Ref<HTMLAnchorElement> | Ref<HTMLDivElement>;\n}\n\nconst SEPARATOR = \" · \";\n\nfunction detailText(entry: EntityRowDetail): string {\n if (typeof entry === \"string\") return entry;\n return entry.term === undefined ? entry.detail : `${entry.term}: ${entry.detail}`;\n}\n\nfunction detailKey(entry: EntityRowDetail, index: number): string {\n return `${index}-${detailText(entry)}`;\n}\n\nexport function EntityRow(props: EntityRowProps) {\n const {\n title,\n href,\n onSelect,\n tags = [],\n meta = [],\n description,\n disabled = false,\n agentTool,\n agentName,\n ref,\n ...rest\n } = props;\n\n const view = useSprintView();\n const controls = useAgentControls();\n const formatter = useAgentFormat();\n const id = useId();\n const navigates = href !== undefined;\n const acts = !navigates && onSelect !== undefined;\n const inert = acts && disabled;\n const element = useRef<HTMLElement | null>(null);\n\n const setRef = useCallback(\n (target: HTMLElement | null) => {\n element.current = target;\n if (typeof ref === \"function\") {\n (ref as (value: HTMLElement | null) => void)(target);\n } else if (ref !== null && ref !== undefined) {\n (ref as { current: HTMLElement | null }).current = target;\n }\n },\n [ref],\n );\n\n const formatRef = useRef(formatter);\n formatRef.current = formatter;\n const nodeRef = useRef(buildAgentNode({ component: entityRowMeta.name }));\n const mounted = useRef(true);\n\n useEffect(() => {\n mounted.current = true;\n return () => {\n mounted.current = false;\n };\n }, []);\n\n const execute = useCallback(async () => {\n const target = element.current;\n if (target === null) return \"This row renders no control in the current view.\";\n\n target.click();\n await afterCommit();\n if (!mounted.current) return \"Opening removed this row from the page.\";\n return `Opened. The row is now:\\n${formatRef.current([nodeRef.current])}`;\n }, []);\n\n const toolName = useAgentTool({\n spec: OPEN_ENTITY_ROW_TOOL,\n label: agentName ?? title,\n enabled: (agentTool ?? acts) && (navigates || acts) && !inert,\n execute,\n });\n\n const metaLine = meta.length === 0 ? undefined : meta.map(detailText).join(SEPARATOR);\n const parts: AgentPart[] = [\n { part: \"title\", label: title, state: {} },\n ...(metaLine === undefined ? [] : [{ part: \"meta\", label: metaLine, state: {} }]),\n ...(description === undefined\n ? []\n : [{ part: \"description\", label: description, state: {} }]),\n ];\n\n const node = buildAgentNode({\n component: entityRowMeta.name,\n label: title,\n tool: toolName,\n state: { href, disabled: inert },\n parts,\n });\n nodeRef.current = node;\n\n const chips = tags.map((tag, index) => (\n <Tag key={`${index}-${tag.label}`} tone={tag.tone ?? \"neutral\"}>\n {tag.label}\n </Tag>\n ));\n\n if (view === \"agent\") {\n if (!(navigates || acts) || inert || controls === \"never\") {\n return <AgentLine node={node}>{chips}</AgentLine>;\n }\n return (\n <AgentControl\n node={node}\n as={navigates ? \"a\" : \"button\"}\n href={href}\n ref={setRef}\n onClick={onSelect}\n >\n {chips}\n </AgentControl>\n );\n }\n\n const titleId = `${id}-title`;\n const tagsId = `${id}-tags`;\n const metaId = `${id}-meta`;\n const descriptionId = `${id}-description`;\n const describedBy = [\n tags.length === 0 ? undefined : tagsId,\n metaLine === undefined ? undefined : metaId,\n description === undefined ? undefined : descriptionId,\n ]\n .filter((value): value is string => value !== undefined)\n .join(\" \");\n\n const naming = {\n \"aria-labelledby\": titleId,\n \"aria-describedby\": describedBy === \"\" ? undefined : describedBy,\n };\n\n const inner = (\n <>\n <span id={titleId} {...agentPartAttributesFor({ part: \"title\", state: {} })}>\n {title}\n </span>\n {tags.length === 0 ? null : <span id={tagsId}>{chips}</span>}\n {metaLine === undefined ? null : (\n <span id={metaId} {...agentPartAttributesFor({ part: \"meta\", state: {} })}>\n {meta.map((entry, index) => (\n <Fragment key={detailKey(entry, index)}>\n {index > 0 ? SEPARATOR : null}\n {typeof entry === \"string\" || entry.term === undefined ? (\n <span>{detailText(entry)}</span>\n ) : (\n <span>\n <span>{entry.term}: </span>\n <span>{entry.detail}</span>\n </span>\n )}\n </Fragment>\n ))}\n </span>\n )}\n {description === undefined ? null : (\n <span\n id={descriptionId}\n {...agentPartAttributesFor({ part: \"description\", state: {} })}\n >\n {description}\n </span>\n )}\n </>\n );\n\n if (navigates) {\n return (\n <a\n {...(rest as unknown as ComponentPropsWithRef<\"a\">)}\n {...agentAttributesFor(node)}\n {...naming}\n href={href}\n onClick={onSelect}\n ref={setRef as Ref<HTMLAnchorElement>}\n >\n {inner}\n </a>\n );\n }\n\n if (acts) {\n return (\n <button\n {...rest}\n {...agentAttributesFor(node)}\n {...naming}\n type=\"button\"\n disabled={disabled}\n onClick={onSelect}\n ref={setRef as Ref<HTMLButtonElement>}\n >\n {inner}\n </button>\n );\n }\n\n return (\n // biome-ignore lint/a11y/useSemanticElements: the suggested fieldset groups form controls; this groups a record's title and context, and group is the ARIA role for exactly that\n <div\n {...(rest as unknown as ComponentPropsWithRef<\"div\">)}\n {...agentAttributesFor(node)}\n {...naming}\n role=\"group\"\n ref={setRef as Ref<HTMLDivElement>}\n >\n {inner}\n </div>\n );\n}\n","import { defineAgentMeta } from \"@/agent/registry.ts\";\n\nexport const headingMeta = defineAgentMeta({\n name: \"Heading\",\n category: \"typography\",\n summary:\n \"A section title, rendered as a real h element at the level you pick so it joins the document outline.\",\n whenToUse:\n \"Use it for the title of a page or of a region inside one, and keep levels in document order so the outline an agent or a screen reader builds is the outline you meant.\",\n whenNotToUse:\n \"Do not use it for the label on a bordered region; Panel takes a label prop, draws its own header, and joins the outline through its headingLevel prop. Do not pick a level for its size, only for its place in the outline.\",\n status: \"experimental\",\n props: {\n children: {\n kind: \"node\",\n description: \"The title. Keep it short; long titles truncate in chrome.\",\n required: true,\n },\n level: {\n kind: \"enum\",\n description:\n \"Outline depth, rendered as the matching h element. 1 is the page title and there should be one per page.\",\n values: [\"1\", \"2\", \"3\", \"4\"],\n default: \"2\",\n },\n },\n state: {\n level: {\n description: \"The outline depth, and so the type voice in use.\",\n attribute: \"data-sprint-level\",\n values: [\"1\", \"2\", \"3\", \"4\"],\n },\n },\n agentView: {\n example: '- **Heading** \"WebMCP tools\" [level=2]',\n },\n examples: [\n {\n title: \"A page title\",\n code: \"<Heading level={1}>Button</Heading>\",\n },\n {\n title: \"A section title\",\n description: \"The default level, for a region inside a page.\",\n code: \"<Heading>Every variant</Heading>\",\n },\n ],\n});\n","import type { ComponentPropsWithRef } from \"react\";\nimport { AgentLine } from \"@/agent/view/AgentText.tsx\";\nimport { useSprintView } from \"@/agent/view/mode.ts\";\nimport { agentAttributesFor, buildAgentNode } from \"@/agent/view/project.ts\";\nimport { reactText } from \"@/agent/view/text.ts\";\nimport { headingMeta } from \"./meta.ts\";\nimport \"./Heading.css\";\n\nexport type HeadingLevel = 1 | 2 | 3 | 4;\n\nexport interface HeadingProps extends ComponentPropsWithRef<\"h2\"> {\n level?: HeadingLevel;\n}\n\nexport function Heading(props: HeadingProps) {\n const { level = 2, children, ...rest } = props;\n\n const view = useSprintView();\n\n const node = buildAgentNode({\n component: headingMeta.name,\n label: reactText(children),\n state: { level: String(level) },\n });\n\n if (view === \"agent\") return <AgentLine node={node} />;\n\n const Element = `h${level}` as const;\n\n return (\n <Element {...rest} {...agentAttributesFor(node)}>\n {children}\n </Element>\n );\n}\n","import { defineAgentMeta } from \"@/agent/registry.ts\";\n\nexport const imageMeta = defineAgentMeta({\n name: \"Image\",\n category: \"display\",\n summary:\n \"A framed picture in a slot that holds its shape. It is the one component whose content an agent cannot read, so alt is not decoration: it is the whole of what the agent gets, and the source URL is published beside it for an agent that can fetch pixels of its own.\",\n whenToUse:\n 'Use it for any picture that carries meaning: a screenshot, a diagram, a photograph, a logo in running content. Describe it in alt as if to someone on the phone. Pass alt=\"\" only for a picture that adds nothing, which then disappears from the agent view entirely.',\n whenNotToUse:\n \"Do not use it for a decorative texture; that is the ornament vocabulary, which costs no request and no description. Do not use it for an icon whose meaning is already in adjacent text.\",\n status: \"experimental\",\n props: {\n src: {\n kind: \"string\",\n description:\n \"Where the pixels are. Published as data-sprint-src so an agent that can see can fetch the file itself.\",\n required: true,\n },\n alt: {\n kind: \"string\",\n description:\n 'What the picture shows, in a sentence. This is the entire agent rendering of the image, so write it for a reader who will never see it. Empty means \"this picture carries no meaning\", and the component then renders nothing in agent view.',\n required: true,\n },\n caption: {\n kind: \"string\",\n description:\n \"A visible line under the frame, for a credit, a date, or a figure number. It is read as well as seen, so it does not repeat alt.\",\n },\n ratio: {\n kind: \"enum\",\n description:\n \"The shape the slot holds while the picture loads and if it fails. auto lets the file decide its own height once it arrives.\",\n values: [\"1:1\", \"4:3\", \"3:2\", \"16:9\", \"auto\"],\n default: \"auto\",\n },\n fit: {\n kind: \"enum\",\n description:\n \"How the picture fills a slot of a fixed ratio. cover crops it, contain letterboxes it. Ignored when ratio is auto.\",\n values: [\"cover\", \"contain\"],\n default: \"cover\",\n },\n },\n state: {\n src: {\n description: \"The image source, so an agent can fetch the file without the DOM.\",\n attribute: \"data-sprint-src\",\n },\n status: {\n description:\n \"Whether the pixels have arrived. Present only in the human rendering, because in agent view nothing is fetched and any value would be a guess.\",\n attribute: \"data-sprint-status\",\n values: [\"loading\", \"ready\", \"error\"],\n },\n ratio: {\n description: \"The shape the slot holds.\",\n attribute: \"data-sprint-ratio\",\n values: [\"1:1\", \"4:3\", \"3:2\", \"16:9\", \"auto\"],\n },\n fit: {\n description: \"Whether a fixed-ratio slot crops the picture or letterboxes it.\",\n attribute: \"data-sprint-fit\",\n values: [\"cover\", \"contain\"],\n },\n decorative: {\n description:\n \"Present when the image was declared meaningless with an empty alt and no caption. It renders nothing at all in agent view.\",\n attribute: \"data-sprint-decorative\",\n },\n },\n agentView: {\n example:\n '- **Image** \"Launch pad 39B under floodlights, gantry retracted\" [fit=cover, ratio=16:9, src=media/pad-39b.svg]\\n - part `caption` \"Pad 39B, T-minus 4h\"',\n },\n examples: [\n {\n title: \"A described picture\",\n description:\n \"The alt text is the agent rendering. It registers no WebMCP tool: there is nothing to do to a picture, and the source URL is already on the element.\",\n code: '<Image\\n src=\"media/pad-39b.svg\"\\n alt=\"Launch pad 39B under floodlights, gantry retracted\"\\n ratio=\"16:9\"\\n/>',\n },\n {\n title: \"A captioned figure\",\n description:\n \"The caption is read as well as seen, and arrives as its own part, so it can say what alt should not repeat.\",\n code: '<Image\\n src=\"media/telemetry.svg\"\\n alt=\"Line chart of chamber pressure holding flat for nine minutes, then dropping\"\\n caption=\"Static fire 04, chamber pressure\"\\n ratio=\"3:2\"\\n fit=\"contain\"\\n/>',\n },\n {\n title: \"A picture that means nothing\",\n description:\n \"An empty alt is a claim, not an omission: it says this picture carries no meaning. The component then renders nothing in agent view, the way Stack does.\",\n code: '<Image src=\"media/grain.svg\" alt=\"\" ratio=\"1:1\" />',\n },\n ],\n a11y: {\n notes:\n \"The frame is a figure named by its alt text, and the picture inside carries the same alt natively, so a fallback still reads when the file fails. A caption is a figcaption. While the picture is loading or after it has failed, the slot keeps its border and states its condition rather than collapsing; that band is aria-hidden, because on failure it shows the alt text a screen reader has already been given.\",\n },\n relatedComponents: [\"Card\", \"Panel\"],\n});\n","import { type ComponentPropsWithRef, useState } from \"react\";\nimport { AgentLine } from \"@/agent/view/AgentText.tsx\";\nimport { useSprintView } from \"@/agent/view/mode.ts\";\nimport type { AgentPart } from \"@/agent/view/node.ts\";\nimport {\n agentAttributesFor,\n agentPartAttributesFor,\n buildAgentNode,\n} from \"@/agent/view/project.ts\";\nimport { imageMeta } from \"./meta.ts\";\nimport \"./Image.css\";\n\nexport type ImageRatio = \"1:1\" | \"4:3\" | \"3:2\" | \"16:9\" | \"auto\";\nexport type ImageFit = \"cover\" | \"contain\";\nexport type ImageStatus = \"loading\" | \"ready\" | \"error\";\n\nexport interface ImageProps extends Omit<ComponentPropsWithRef<\"figure\">, \"children\"> {\n src: string;\n alt: string;\n caption?: string;\n ratio?: ImageRatio;\n fit?: ImageFit;\n}\n\nexport function Image(props: ImageProps) {\n const { src, alt, caption, ratio = \"auto\", fit = \"cover\", ...rest } = props;\n\n const view = useSprintView();\n const [status, setStatus] = useState<ImageStatus>(\"loading\");\n\n const decorative = alt === \"\" && caption === undefined;\n\n const parts: AgentPart[] =\n caption === undefined ? [] : [{ part: \"caption\", label: caption, state: {} }];\n\n const node = buildAgentNode({\n component: imageMeta.name,\n label: alt === \"\" ? undefined : alt,\n state: {\n src,\n ratio,\n fit,\n decorative,\n status: view === \"agent\" ? undefined : status,\n },\n parts,\n });\n\n if (view === \"agent\") return decorative ? null : <AgentLine node={node} />;\n\n const band =\n status === \"error\" ? (alt === \"\" ? \"Image unavailable\" : alt) : \"Loading\";\n\n return (\n <figure\n {...rest}\n {...agentAttributesFor(node)}\n aria-label={alt === \"\" ? undefined : alt}\n >\n <div>\n <img\n src={src}\n alt={alt}\n onLoad={() => setStatus(\"ready\")}\n onError={() => setStatus(\"error\")}\n />\n {status === \"ready\" ? null : (\n <span aria-hidden=\"true\">\n <span>{band}</span>\n </span>\n )}\n </div>\n {caption === undefined ? null : (\n <figcaption {...agentPartAttributesFor({ part: \"caption\", state: {} })}>\n {caption}\n </figcaption>\n )}\n </figure>\n );\n}\n","import { defineAgentMeta } from \"@/agent/registry.ts\";\n\nexport const listMeta = defineAgentMeta({\n name: \"List\",\n category: \"display\",\n summary:\n \"A bulleted or numbered list built from an array of items. Each item is an addressable part carrying its position, so an agent can cite item three without counting lines.\",\n whenToUse:\n \"Use it for a short sequence of related points: rules, steps, links, caveats. Passing items as data rather than as children is what lets the agent view carry each one as its own part.\",\n whenNotToUse:\n \"Do not use it for a diff or a review of what will change, where each mark means added or removed; that is ChangeList. Do not use it for records with fields; that is Table. Do not use it as a layout for cards or controls; that is Stack.\",\n status: \"experimental\",\n props: {\n label: {\n kind: \"string\",\n description:\n \"What the list is a list of. Names it for a screen reader and for the agent view.\",\n required: true,\n },\n items: {\n kind: \"array\",\n description:\n \"The items in order. Inline content, not components: each is flattened to text for the agent view.\",\n required: true,\n },\n ordered: {\n kind: \"boolean\",\n description:\n \"Number the items instead of bulleting them. Use it when the order is the point.\",\n default: false,\n },\n marker: {\n kind: \"enum\",\n description:\n 'The mark before each item. \"plus\" is the house bullet, \"bullet\" a plain dot for quieter prose, \"number\" counts the items and makes the list ordered, \"none\" drops the marker column for a list whose items already lead with their own mark. Defaults to \"number\" when ordered is set and \"plus\" otherwise. The marker is drawn, not read: an item whose mark means something, such as added or removed, belongs in a ChangeList.',\n values: [\"plus\", \"bullet\", \"number\", \"none\"],\n default: \"plus\",\n },\n emptyLabel: {\n kind: \"string\",\n description: \"What the list says when it has no items.\",\n default: \"Empty\",\n },\n loading: {\n kind: \"boolean\",\n description:\n \"Set while the items are being fetched. Sets aria-busy and sweeps a bar along the top edge. Existing items stay visible; with none yet, the empty slot says loadingLabel instead of emptyLabel.\",\n default: false,\n },\n loadingLabel: {\n kind: \"string\",\n description: \"What the empty slot says while loading.\",\n default: \"Loading\",\n },\n },\n state: {\n items: {\n description: \"How many items the list has.\",\n attribute: \"data-sprint-items\",\n },\n ordered: {\n description:\n \"Present when the list is a real ol: ordered is set, or the marker is number.\",\n attribute: \"data-sprint-ordered\",\n },\n marker: {\n description: \"The mark drawn before each item.\",\n attribute: \"data-sprint-marker\",\n values: [\"plus\", \"bullet\", \"number\", \"none\"],\n },\n empty: {\n description: \"Present when the list has no items.\",\n attribute: \"data-sprint-empty\",\n },\n loading: {\n description:\n \"Present while the items are being fetched. Alongside empty it means nothing has arrived yet, not that there is nothing.\",\n attribute: \"data-sprint-loading\",\n },\n index: {\n description: \"On an item: its 1-based position in the list.\",\n attribute: \"data-sprint-index\",\n },\n },\n agentView: {\n example:\n '- **List** \"Tool rules\" [items=1, marker=plus]\\n - part `item` \"One tool, one action.\" [index=1]',\n },\n examples: [\n {\n title: \"A list of rules\",\n code: '<List\\n label=\"Tool rules\"\\n items={[\\n <>\\n <strong>One tool, one action.</strong> Overlapping tools make selection\\n harder.\\n </>,\\n ]}\\n/>',\n },\n {\n title: \"A numbered sequence\",\n code: '<List\\n ordered\\n label=\"Steps\"\\n items={[\"Register the tool.\", \"Drive the DOM.\", \"Return the new state.\"]}\\n/>',\n },\n {\n title: \"Plain bullets\",\n description: \"A quieter dot for running prose, where the house plus would shout.\",\n code: '<List\\n marker=\"bullet\"\\n label=\"Caveats\"\\n items={[\"Chrome 149 only.\", \"Tools are a no-op without WebMCP.\"]}\\n/>',\n },\n {\n title: \"No marker\",\n description:\n \"For items that already lead with their own mark, such as a link or a chip.\",\n code: '<List\\n marker=\"none\"\\n label=\"Related\"\\n items={[\"Table for records.\", \"Stack for layout.\"]}\\n/>',\n },\n ],\n a11y: {\n role: \"list\",\n notes:\n \"A real ul or ol named by its label, with an explicit list role because the custom markers require list-style none and Safari would otherwise drop the list semantics. The item count is announced, and the markers are drawn as pseudo-elements, so a marker never carries meaning a screen reader would miss.\",\n },\n});\n","import type { ComponentPropsWithRef, ReactNode } from \"react\";\nimport { AgentLine } from \"@/agent/view/AgentText.tsx\";\nimport { useSprintView } from \"@/agent/view/mode.ts\";\nimport type { AgentPart } from \"@/agent/view/node.ts\";\nimport {\n agentAttributesFor,\n agentPartAttributesFor,\n buildAgentNode,\n} from \"@/agent/view/project.ts\";\nimport { reactText } from \"@/agent/view/text.ts\";\nimport { listMeta } from \"./meta.ts\";\nimport \"./List.css\";\n\nexport type ListMarker = \"plus\" | \"bullet\" | \"number\" | \"none\";\n\nexport interface ListProps extends ComponentPropsWithRef<\"ul\"> {\n label: string;\n items: readonly ReactNode[];\n ordered?: boolean;\n marker?: ListMarker;\n emptyLabel?: string;\n loading?: boolean;\n loadingLabel?: string;\n}\n\nexport function List(props: ListProps) {\n const {\n label,\n items,\n ordered: orderedProp = false,\n marker: markerProp,\n emptyLabel = \"Empty\",\n loading = false,\n loadingLabel = \"Loading\",\n ...rest\n } = props;\n\n const view = useSprintView();\n const marker = markerProp ?? (orderedProp ? \"number\" : \"plus\");\n const ordered = orderedProp || marker === \"number\";\n const empty = items.length === 0;\n\n const parts: AgentPart[] = items.map((item, index) => {\n const text = reactText(item);\n return {\n part: \"item\",\n state: { index: String(index + 1) },\n ...(text === undefined ? {} : { label: text }),\n };\n });\n\n const node = buildAgentNode({\n component: listMeta.name,\n label,\n state: { items: String(items.length), ordered, marker, empty, loading },\n parts,\n });\n\n if (view === \"agent\") return <AgentLine node={node} />;\n\n const Element = ordered ? \"ol\" : \"ul\";\n\n return (\n <Element\n {...(rest as ComponentPropsWithRef<\"ol\">)}\n {...agentAttributesFor(node)}\n role=\"list\"\n aria-label={label}\n aria-busy={loading || undefined}\n >\n {empty ? (\n <li>{loading ? loadingLabel : emptyLabel}</li>\n ) : (\n items.map((item, index) => (\n <li\n key={`${index}-${String(reactText(item))}`}\n {...agentPartAttributesFor({\n part: \"item\",\n state: { index: String(index + 1) },\n })}\n >\n <span>{item}</span>\n </li>\n ))\n )}\n </Element>\n );\n}\n","import { defineAgentMeta } from \"@/agent/registry.ts\";\n\nexport const metaLineMeta = defineAgentMeta({\n name: \"MetaLine\",\n category: \"display\",\n summary:\n \"A slash-separated manifest line of term–detail pairs: serials, build strings, issue dates. It is chrome, not content, and in the agent view it reads as the same single line of text a person sees.\",\n whenToUse:\n \"Use it for the compact strip of identifying metadata that belongs to a page, panel, or footer: version and build identifiers, timestamps, serial numbers, owners. Values are short. By default the line truncates with an ellipsis rather than wrapping; set wrap where it sits in a narrow container and every entry has to stay visible.\",\n whenNotToUse:\n \"Do not use it for the details of a record a person is meant to study; that is a DescriptionList. Do not put anything interactive in it, and do not use it for prose.\",\n status: \"experimental\",\n props: {\n entries: {\n kind: \"array\",\n description:\n \"Term–detail pairs in display order: { term, detail }, both strings. Rendered as TERM: DETAIL, slash-separated, and carried as one line in the agent view. An empty array renders nothing.\",\n required: true,\n },\n wrap: {\n kind: \"boolean\",\n description:\n \"Let entries flow onto further lines instead of truncating the line. Each entry stays whole on one line, and a separator stays at the end of the line it closes, so no line starts with a slash. An entry wider than the container is the only thing that still truncates.\",\n default: false,\n },\n },\n state: {\n entries: {\n description: \"How many term–detail pairs the line carries.\",\n attribute: \"data-sprint-entries\",\n },\n wrap: {\n description: \"Present when entries may flow onto further lines.\",\n attribute: \"data-sprint-wrap\",\n },\n },\n agentView: {\n example:\n '- **MetaLine** \"SERIAL: NU-TYPE-CORE-A1 / ISSUED: 2744.07.22\" [entries=2]',\n },\n examples: [\n {\n title: \"A build strip\",\n description:\n \"The manifest voice: uppercase mono, slash-separated, terms muted and details in ink.\",\n code: '<MetaLine\\n entries={[\\n { term: \"Serial\", detail: \"NU-TYPE-CORE-A1\" },\\n { term: \"Issued\", detail: \"2744.07.22\" },\\n ]}\\n/>',\n },\n {\n title: \"Version chrome for a footer\",\n description: \"The line an app pins under its content or into a Shell rail.\",\n code: '<MetaLine\\n entries={[\\n { term: \"Sprint\", detail: \"v0.0.0\" },\\n { term: \"Channel\", detail: \"dev\" },\\n { term: \"WebMCP\", detail: \"chrome 149\" },\\n ]}\\n/>',\n },\n {\n title: \"Wrapping in a narrow rail\",\n description:\n \"With wrap, a sidebar shows every entry on as many lines as it needs instead of cutting the later ones off.\",\n code: '<MetaLine\\n wrap\\n entries={[\\n { term: \"Sprint\", detail: \"v0.0.0\" },\\n { term: \"Channel\", detail: \"dev\" },\\n { term: \"WebMCP\", detail: \"chrome 149\" },\\n { term: \"Build\", detail: \"2744.07.22-a1\" },\\n ]}\\n/>',\n },\n ],\n a11y: {\n role: \"paragraph\",\n notes:\n \"The separators are real text, so the accessible name is the same line the agent view carries. Nothing in the line is interactive.\",\n },\n});\n","import { type ComponentPropsWithRef, Fragment } from \"react\";\nimport { AgentLine } from \"@/agent/view/AgentText.tsx\";\nimport { useSprintView } from \"@/agent/view/mode.ts\";\nimport { agentAttributesFor, buildAgentNode } from \"@/agent/view/project.ts\";\nimport { metaLineMeta } from \"./meta.ts\";\nimport \"./MetaLine.css\";\n\nexport interface MetaLineEntry {\n term: string;\n detail: string;\n}\n\nexport interface MetaLineProps extends ComponentPropsWithRef<\"p\"> {\n entries: readonly MetaLineEntry[];\n wrap?: boolean;\n}\n\nexport function MetaLine(props: MetaLineProps) {\n const { entries, wrap = false, ...rest } = props;\n\n const view = useSprintView();\n\n if (entries.length === 0) return null;\n\n const line = entries.map((entry) => `${entry.term}: ${entry.detail}`).join(\" / \");\n\n const node = buildAgentNode({\n component: metaLineMeta.name,\n label: line,\n state: { entries: String(entries.length), wrap },\n });\n\n if (view === \"agent\") return <AgentLine node={node} />;\n\n return (\n <p {...rest} {...agentAttributesFor(node)}>\n {entries.map((entry, index) => (\n <Fragment key={`${entry.term}-${index}`}>\n {index > 0 ? \" \" : null}\n <span>\n <span>{entry.term}: </span>\n <span>{entry.detail}</span>\n {index < entries.length - 1 ? <span> /</span> : null}\n </span>\n </Fragment>\n ))}\n </p>\n );\n}\n","import { defineAgentMeta } from \"@/agent/registry.ts\";\n\nexport const navMeta = defineAgentMeta({\n name: \"Nav\",\n category: \"navigation\",\n summary:\n \"A labelled navigation landmark: the region that holds a page's links to elsewhere.\",\n whenToUse:\n \"Use it around any set of links whose job is getting around the app: a sidebar, a table of contents, a footer link block. The label names the landmark, so a person navigating by landmark, a screen reader, and an agent reading the page all know these links are wayfinding rather than content. Group related links inside it with NavGroup.\",\n whenNotToUse:\n \"Do not use it for a link that sits inside prose; a bare Link is already readable there. Do not use it for a set of actions that stay on the page; those are Buttons in a Stack.\",\n status: \"experimental\",\n props: {\n label: {\n kind: \"string\",\n description:\n \"What this navigation is for. Rendered as the landmark's accessible name, so two navs on one page stay distinguishable.\",\n required: true,\n },\n children: {\n kind: \"node\",\n description: \"Link components, or NavGroup components wrapping them.\",\n required: true,\n },\n },\n agentView: {\n example: '- **Nav** \"Workbench\"',\n },\n a11y: {\n role: \"navigation\",\n notes:\n \"The label is the landmark's accessible name via aria-label. Active links inside it carry aria-current=page, so the current location is announced without any styling cue.\",\n },\n relatedComponents: [\"NavGroup\", \"Link\", \"Shell\"],\n examples: [\n {\n title: \"A grouped sidebar nav\",\n description:\n \"Each NavGroup names a cluster of destinations. The active link carries the current-page mark in every view.\",\n code: '<Nav label=\"Docs\">\\n <NavGroup label=\"Guides\">\\n <Link href=\"#/guide/webmcp\">WebMCP</Link>\\n </NavGroup>\\n <NavGroup label=\"Components\">\\n <Link href=\"#/Button\" active>Button</Link>\\n <Link href=\"#/Table\">Table</Link>\\n </NavGroup>\\n</Nav>',\n },\n {\n title: \"A flat nav\",\n description: \"A short list of destinations needs no grouping.\",\n code: '<Nav label=\"Site\">\\n <Link href=\"#/\">Home</Link>\\n <Link href=\"#/pricing\">Pricing</Link>\\n</Nav>',\n },\n ],\n});\n","import type { ComponentPropsWithRef } from \"react\";\nimport { AgentLine } from \"@/agent/view/AgentText.tsx\";\nimport { useSprintView } from \"@/agent/view/mode.ts\";\nimport { agentAttributesFor, buildAgentNode } from \"@/agent/view/project.ts\";\nimport { navMeta } from \"./meta.ts\";\nimport \"./Nav.css\";\n\nexport interface NavProps extends ComponentPropsWithRef<\"nav\"> {\n label: string;\n}\n\nexport function Nav(props: NavProps) {\n const { label, children, ...rest } = props;\n\n const view = useSprintView();\n\n const node = buildAgentNode({ component: navMeta.name, label, region: true });\n\n if (view === \"agent\") return <AgentLine node={node}>{children}</AgentLine>;\n\n return (\n <nav {...rest} {...agentAttributesFor(node)} aria-label={label}>\n {children}\n </nav>\n );\n}\n","import { defineAgentMeta } from \"@/agent/registry.ts\";\n\nexport const navGroupMeta = defineAgentMeta({\n name: \"NavGroup\",\n category: \"navigation\",\n summary:\n \"A labelled cluster of links inside a Nav. The label names the group for screen readers and agents alike.\",\n whenToUse:\n \"Use it when a Nav holds more than one kind of destination: guides versus components, product versus account. The label tells every reader, including an agent scanning for the right link, what the links below it have in common.\",\n whenNotToUse:\n \"Do not use it outside a Nav; on its own it is just a heading over links, which Panel does better. Do not nest groups; one level of grouping is all a sidebar can carry.\",\n status: \"experimental\",\n props: {\n label: {\n kind: \"string\",\n description:\n \"What the links in this group have in common. Rendered as the rubric and as the group's accessible name.\",\n required: true,\n },\n children: {\n kind: \"node\",\n description: \"The Link components this group collects.\",\n required: true,\n },\n },\n agentView: {\n example: '- **NavGroup** \"Components\"',\n },\n a11y: {\n role: \"group\",\n notes:\n \"The group carries its label as an accessible name, so screen readers announce the rubric when entering the cluster rather than reading an unlabelled run of links.\",\n },\n relatedComponents: [\"Nav\", \"Link\"],\n examples: [\n {\n title: \"A labelled group of links\",\n code: '<NavGroup label=\"Reference\">\\n <Link href=\"https://developer.chrome.com/docs/ai/webmcp\" external>\\n Chrome docs\\n </Link>\\n <Link href=\"https://github.com/webmachinelearning/webmcp\" external>\\n Specification\\n </Link>\\n</NavGroup>',\n },\n ],\n});\n","import type { ComponentPropsWithRef } from \"react\";\nimport { AgentLine } from \"@/agent/view/AgentText.tsx\";\nimport { useSprintView } from \"@/agent/view/mode.ts\";\nimport { agentAttributesFor, buildAgentNode } from \"@/agent/view/project.ts\";\nimport { navGroupMeta } from \"./meta.ts\";\nimport \"./NavGroup.css\";\n\nexport interface NavGroupProps extends ComponentPropsWithRef<\"div\"> {\n label: string;\n}\n\nexport function NavGroup(props: NavGroupProps) {\n const { label, children, ...rest } = props;\n\n const view = useSprintView();\n\n const node = buildAgentNode({ component: navGroupMeta.name, label });\n\n if (view === \"agent\") return <AgentLine node={node}>{children}</AgentLine>;\n\n return (\n // biome-ignore lint/a11y/useSemanticElements: the suggested fieldset groups form controls; this groups links, and group is the ARIA role for exactly that\n <div {...rest} {...agentAttributesFor(node)} role=\"group\" aria-label={label}>\n <span>{label}</span>\n {children}\n </div>\n );\n}\n","import { defineAgentMeta } from \"@/agent/registry.ts\";\n\nexport const pageHeaderMeta = defineAgentMeta({\n name: \"PageHeader\",\n category: \"layout\",\n summary:\n \"The top of a page: its h1 title, the Tag chips that classify it, an optional page-level control, and a lede underneath.\",\n whenToUse:\n \"Use it once per page, as the first thing inside the content region. The label becomes the page's only h1, so the document outline starts here. Put status or category Tags in tags, a control that affects the whole page in actions, and the introductory sentence or two in children as Text.\",\n whenNotToUse:\n \"Do not use it for a section within a page; that is a Panel with a headingLevel. Do not put navigation in actions; the page's links belong in a Nav.\",\n status: \"experimental\",\n props: {\n label: {\n kind: \"string\",\n description: \"The page title. Rendered as the page's h1.\",\n required: true,\n },\n tags: {\n kind: \"node\",\n description:\n \"Tag components that classify the page, rendered on the title line. Keep it to two or three.\",\n },\n actions: {\n kind: \"node\",\n description:\n \"A control that acts on the whole page, rendered at the end of the title line.\",\n },\n children: {\n kind: \"node\",\n description: \"The lede: a Text or two introducing the page.\",\n },\n },\n agentView: {\n example: '- **PageHeader** \"Button\"',\n },\n a11y: {\n notes:\n \"The label renders as the page's h1, so keep to one PageHeader per page. Tags and the lede are ordinary content after it; the header element itself takes no landmark role because it sits inside main.\",\n },\n relatedComponents: [\"Panel\", \"Heading\", \"Tag\"],\n examples: [\n {\n title: \"A titled page with a lede\",\n code: '<PageHeader label=\"Reports\">\\n <Text>Everything the quarter produced, in one place.</Text>\\n</PageHeader>',\n },\n {\n title: \"Status tags and a page-level control\",\n description:\n \"Tags classify the page on the title line; the action slot holds the one control that affects the whole page.\",\n code: '<PageHeader\\n label=\"Button\"\\n tags={<Tag tone=\"warning\" filled>experimental</Tag>}\\n actions={<Button agentTool={false}>Refresh</Button>}\\n>\\n <Text>A single action a person or an agent can trigger.</Text>\\n</PageHeader>',\n },\n ],\n});\n","import { Children, type ComponentPropsWithRef, type ReactNode } from \"react\";\nimport { AgentLine } from \"@/agent/view/AgentText.tsx\";\nimport { useSprintView } from \"@/agent/view/mode.ts\";\nimport { agentAttributesFor, buildAgentNode } from \"@/agent/view/project.ts\";\nimport { pageHeaderMeta } from \"./meta.ts\";\nimport \"./PageHeader.css\";\n\nexport interface PageHeaderProps extends ComponentPropsWithRef<\"header\"> {\n label: string;\n tags?: ReactNode;\n actions?: ReactNode;\n}\n\nexport function PageHeader(props: PageHeaderProps) {\n const { label, tags, actions, children, ...rest } = props;\n\n const view = useSprintView();\n\n const node = buildAgentNode({\n component: pageHeaderMeta.name,\n label,\n region: true,\n });\n\n if (view === \"agent\") {\n return (\n <AgentLine node={node}>\n {tags}\n {actions}\n {children}\n </AgentLine>\n );\n }\n\n const lede = Children.toArray(children).length > 0;\n\n return (\n <header {...rest} {...agentAttributesFor(node)}>\n <div>\n <div>\n <h1>{label}</h1>\n {tags === undefined ? null : <span>{tags}</span>}\n </div>\n {actions === undefined ? null : <span>{actions}</span>}\n </div>\n {lede ? <div>{children}</div> : null}\n </header>\n );\n}\n","import type { AgentToolSpec } from \"@/agent/types.ts\";\n\nexport const TURN_PAGE_TOOL: AgentToolSpec = {\n verb: \"turn\",\n description:\n \"Go to a page of this paginated set by its 1-based number, exactly as a person pressing Previous or Next until they reach it would. Any page from 1 to the page count is accepted, not just the neighbours. Returns the pagination's state after the change, including which items are now showing, so a follow-up read is unnecessary.\",\n inputSchema: {\n type: \"object\",\n properties: {\n page: {\n type: \"integer\",\n description: \"The 1-based number of the page to show.\",\n minimum: 1,\n },\n },\n required: [\"page\"],\n },\n readOnly: false,\n untrustedContent: false,\n registeredWhen:\n \"The pagination is mounted, changes page through onPageChange rather than href, has more than one page, has a resolvable label, and no other component claims the same tool name. The registered schema states the current page count.\",\n unregisteredWhen:\n \"The pagination unmounts, is given href, loses onPageChange, or shrinks to a single page.\",\n};\n","import { defineAgentMeta } from \"@/agent/registry.ts\";\nimport { TURN_PAGE_TOOL } from \"./tool.ts\";\n\nexport const paginationMeta = defineAgentMeta({\n name: \"Pagination\",\n category: \"navigation\",\n summary:\n 'A navigation landmark for a long set shown one page at a time: Previous and Next controls, a \"Page 2 of 3\" readout, and a \"Showing 26–50 of 61\" summary of which items are on screen. It takes counts rather than items, so it works the same over a local array or a server query.',\n whenToUse:\n \"Use it under or above a Table or List whose items arrive a page at a time, when the count is known. Give it onPageChange to page in place, which registers one turn tool that can jump straight to any page; give it href to make every page a URL, which needs no tool because a link is already reachable. Its state carries the page, the page count and the item range, so an agent reading the page knows how much it has not seen.\",\n whenNotToUse:\n \"Do not use it when the total is unknown or the set grows as it is read; that is a load-more Button. Do not use it for steps in a flow a person must complete in order, and do not use it to move between unrelated pages, which is Nav or Breadcrumb. Do not use it for a set that fits on one screen: it renders, but has nothing to do.\",\n status: \"experimental\",\n props: {\n label: {\n kind: \"string\",\n description:\n 'What is being paged. Names the navigation landmark and derives the tool name, so prefer a noun phrase such as \"Users pages\".',\n required: true,\n },\n page: {\n kind: \"number\",\n description:\n \"The 1-based page currently shown. The component is controlled; a value outside 1 to the page count is clamped into it.\",\n required: true,\n },\n pageSize: {\n kind: \"number\",\n description: \"How many items a full page holds. Values below 1 are treated as 1.\",\n required: true,\n },\n total: {\n kind: \"number\",\n description:\n \"How many items the whole set holds. The page count is total divided by pageSize, rounded up, and never less than 1, so an empty set is one empty page.\",\n required: true,\n },\n onPageChange: {\n kind: \"handler\",\n description:\n \"Called with the page to show. Without href the controls are buttons and the turn tool registers; with href it runs alongside the link, for routers that intercept clicks.\",\n },\n href: {\n kind: \"handler\",\n description:\n \"Given a page number, returns its URL. When present, Previous and Next render as links, each publishes its URL as data-sprint-href, and no tool registers.\",\n },\n previousLabel: {\n kind: \"string\",\n description: \"The text of the control that goes back a page.\",\n default: \"Previous\",\n },\n nextLabel: {\n kind: \"string\",\n description: \"The text of the control that goes forward a page.\",\n default: \"Next\",\n },\n agentName: {\n kind: \"string\",\n description:\n \"Override the label used to derive the tool name, when two paginations on a page would otherwise collide.\",\n },\n agentTool: {\n kind: \"boolean\",\n description: \"Set false to render the controls without registering a turn tool.\",\n default: true,\n },\n },\n state: {\n page: {\n description: \"The 1-based page shown, after clamping.\",\n attribute: \"data-sprint-page\",\n },\n pages: {\n description: \"How many pages the set spans. Never less than 1.\",\n attribute: \"data-sprint-pages\",\n },\n total: {\n description: \"How many items the whole set holds.\",\n attribute: \"data-sprint-total\",\n },\n first: {\n description:\n \"The 1-based position of the first item on this page, or 0 when the set is empty.\",\n attribute: \"data-sprint-first\",\n },\n last: {\n description:\n \"The 1-based position of the last item on this page, or 0 when the set is empty.\",\n attribute: \"data-sprint-last\",\n },\n },\n tools: {\n turn: TURN_PAGE_TOOL,\n },\n agentView: {\n example:\n '- **Pagination** \"Users pages\" [first=26, last=50, page=2, pages=3, total=61] → tool `turn-users-pages`\\n - part `previous` \"Previous\"\\n - part `next` \"Next\"',\n },\n a11y: {\n role: \"navigation\",\n keyboard: [\n \"Tab reaches Previous and Next in order\",\n \"Enter or Space on a button, Enter on a link, turns the page\",\n ],\n notes:\n \"The root is a nav landmark named by label. A control with nowhere to go is a disabled button, or a link with no href and aria-disabled, so it leaves the tab order. The item summary is a polite live region, so a screen reader hears the new range after a turn.\",\n },\n relatedComponents: [\"Table\", \"List\", \"Nav\", \"Breadcrumb\"],\n examples: [\n {\n title: \"Paging a table in place\",\n description:\n \"With onPageChange the controls are buttons and one turn tool registers, so an agent can jump to page 3 without pressing Next twice.\",\n code: '<Pagination\\n label=\"Users pages\"\\n page={page}\\n pageSize={25}\\n total={61}\\n onPageChange={setPage}\\n/>',\n },\n {\n title: \"Pages as links\",\n description:\n \"With href every page is a URL. The controls are links, nothing registers, and each link publishes where it goes.\",\n code: `<Pagination\\n label=\"Changelog pages\"\\n page={2}\\n pageSize={10}\\n total={42}\\n href={(page) => \\`#/changelog?page=\\${page}\\`}\\n/>`,\n },\n {\n title: \"The last page, relabelled\",\n description:\n \"On the last page Next is disabled and the summary shows the short final range. The labels are overridable for sets that read better as time.\",\n code: '<Pagination\\n label=\"Activity pages\"\\n page={4}\\n pageSize={8}\\n total={31}\\n previousLabel=\"Newer\"\\n nextLabel=\"Older\"\\n onPageChange={setPage}\\n/>',\n },\n {\n title: \"An empty set\",\n description:\n \"No items is one empty page. Both controls are disabled, no tool registers, and the summary still says what it is showing.\",\n code: '<Pagination\\n label=\"Search results pages\"\\n page={1}\\n pageSize={20}\\n total={0}\\n onPageChange={setPage}\\n/>',\n },\n ],\n});\n","import {\n type ComponentPropsWithRef,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n} from \"react\";\nimport { AgentControlGroup, AgentLine } from \"@/agent/view/AgentText.tsx\";\nimport { useAgentControls, useAgentFormat, useSprintView } from \"@/agent/view/mode.ts\";\nimport type { AgentPart } from \"@/agent/view/node.ts\";\nimport {\n agentAttributesFor,\n agentPartAttributesFor,\n buildAgentNode,\n} from \"@/agent/view/project.ts\";\nimport { afterCommit } from \"@/agent/webmcp/afterCommit.ts\";\nimport { commitSync } from \"@/agent/webmcp/flush.ts\";\nimport type { JsonSchemaObject } from \"@/agent/webmcp/types.ts\";\nimport { useAgentTool } from \"@/agent/webmcp/useAgentTool.ts\";\nimport { paginationMeta } from \"./meta.ts\";\nimport { TURN_PAGE_TOOL } from \"./tool.ts\";\nimport \"./Pagination.css\";\n\nexport interface PaginationProps\n extends Omit<ComponentPropsWithRef<\"nav\">, \"children\"> {\n label: string;\n page: number;\n pageSize: number;\n total: number;\n onPageChange?: (page: number) => void;\n href?: (page: number) => string;\n previousLabel?: string;\n nextLabel?: string;\n agentName?: string;\n agentTool?: boolean;\n}\n\ntype Direction = \"previous\" | \"next\";\n\ninterface PageRange {\n page: number;\n pages: number;\n total: number;\n first: number;\n last: number;\n}\n\nfunction whole(value: number, fallback: number): number {\n return Number.isFinite(value) ? Math.floor(value) : fallback;\n}\n\nfunction paginate(page: number, pageSize: number, total: number): PageRange {\n const size = Math.max(1, whole(pageSize, 1));\n const count = Math.max(0, whole(total, 0));\n const pages = Math.max(1, Math.ceil(count / size));\n const current = Math.min(pages, Math.max(1, whole(page, 1)));\n const first = count === 0 ? 0 : (current - 1) * size + 1;\n const last = Math.min(count, current * size);\n return { page: current, pages, total: count, first, last };\n}\n\nfunction showing(range: PageRange): string {\n if (range.total === 0) return \"Showing 0 of 0\";\n return `Showing ${range.first}–${range.last} of ${range.total}`;\n}\n\nfunction turnSchema(pages: number): JsonSchemaObject {\n const page = TURN_PAGE_TOOL.inputSchema.properties.page;\n return {\n ...TURN_PAGE_TOOL.inputSchema,\n properties: {\n ...TURN_PAGE_TOOL.inputSchema.properties,\n ...(page === undefined\n ? {}\n : {\n page: {\n ...page,\n maximum: pages,\n description: `${page.description ?? \"\"} This set has ${pages} pages, so 1 to ${pages}.`,\n },\n }),\n },\n };\n}\n\nexport function Pagination(props: PaginationProps) {\n const {\n label,\n page,\n pageSize,\n total,\n onPageChange,\n href,\n previousLabel = \"Previous\",\n nextLabel = \"Next\",\n agentName,\n agentTool = true,\n ...rest\n } = props;\n\n const view = useSprintView();\n const controls = useAgentControls();\n const formatter = useAgentFormat();\n\n const range = paginate(page, pageSize, total);\n const navigable = href !== undefined || onPageChange !== undefined;\n\n const targets: Record<Direction, number | null> = {\n previous: navigable && range.page > 1 ? range.page - 1 : null,\n next: navigable && range.page < range.pages ? range.page + 1 : null,\n };\n\n const elements = useRef(new Map<Direction, HTMLElement>());\n const onPageChangeRef = useRef(onPageChange);\n onPageChangeRef.current = onPageChange;\n const rangeRef = useRef(range);\n rangeRef.current = range;\n const formatRef = useRef(formatter);\n formatRef.current = formatter;\n const nodeRef = useRef(buildAgentNode({ component: paginationMeta.name }));\n const mounted = useRef(true);\n\n useEffect(() => {\n mounted.current = true;\n return () => {\n mounted.current = false;\n };\n }, []);\n\n const turn = useCallback((target: number) => {\n const current = rangeRef.current.page;\n const direction: Direction | null =\n target === current - 1 ? \"previous\" : target === current + 1 ? \"next\" : null;\n const element = direction === null ? undefined : elements.current.get(direction);\n if (element !== undefined) {\n element.click();\n return;\n }\n const handler = onPageChangeRef.current;\n if (handler !== undefined) commitSync(() => handler(target));\n }, []);\n\n const execute = useCallback(\n async (inputs: Record<string, unknown>) => {\n const requested = inputs.page;\n const { page: current, pages } = rangeRef.current;\n\n if (typeof requested !== \"number\" || !Number.isInteger(requested)) {\n return `Parameter \"page\" must be a whole page number from 1 to ${pages}.`;\n }\n if (requested < 1 || requested > pages) {\n return `There is no page ${requested}. This set has pages 1 to ${pages}.`;\n }\n if (requested === current) {\n return `Already on page ${current}. The pagination is:\\n${formatRef.current([nodeRef.current])}`;\n }\n\n turn(requested);\n await afterCommit();\n if (!mounted.current)\n return \"Turning the page removed this pagination from the page.\";\n return `Turned. The pagination is now:\\n${formatRef.current([nodeRef.current])}`;\n },\n [turn],\n );\n\n const schema = useMemo(() => turnSchema(range.pages), [range.pages]);\n\n const toolName = useAgentTool({\n spec: TURN_PAGE_TOOL,\n label: agentName ?? label,\n inputSchema: schema,\n enabled:\n agentTool && href === undefined && onPageChange !== undefined && range.pages > 1,\n execute,\n });\n\n const partFor = (direction: Direction): AgentPart => {\n const target = targets[direction];\n return {\n part: direction,\n label: direction === \"previous\" ? previousLabel : nextLabel,\n state:\n target === null\n ? { disabled: true }\n : href === undefined\n ? {}\n : { href: href(target) },\n };\n };\n\n const parts = [partFor(\"previous\"), partFor(\"next\")];\n\n const node = buildAgentNode({\n component: paginationMeta.name,\n label,\n tool: toolName,\n state: {\n page: String(range.page),\n pages: String(range.pages),\n total: String(range.total),\n first: String(range.first),\n last: String(range.last),\n },\n parts,\n });\n nodeRef.current = node;\n\n const actionable = targets.previous !== null || targets.next !== null;\n\n if (view === \"agent\") {\n if (!actionable || controls === \"never\") return <AgentLine node={node} />;\n return (\n <AgentControlGroup\n node={node}\n isActionable={(part) => part.state.disabled !== true}\n onActivate={(part) => {\n const target = targets[part.part as Direction];\n if (target === null || target === undefined) return;\n if (href === undefined) turn(target);\n else window.location.assign(href(target));\n }}\n />\n );\n }\n\n const register = (direction: Direction) => (element: HTMLElement | null) => {\n if (element === null) elements.current.delete(direction);\n else elements.current.set(direction, element);\n };\n\n const control = (direction: Direction, part: AgentPart) => {\n const target = targets[direction];\n const attributes = agentPartAttributesFor(part);\n const text = part.label;\n\n if (href !== undefined) {\n if (target === null) {\n return (\n <a {...attributes} aria-disabled=\"true\">\n {text}\n </a>\n );\n }\n return (\n <a\n {...attributes}\n href={href(target)}\n rel={direction === \"previous\" ? \"prev\" : \"next\"}\n ref={register(direction)}\n onClick={() => onPageChange?.(target)}\n >\n {text}\n </a>\n );\n }\n\n return (\n <button\n {...attributes}\n type=\"button\"\n disabled={target === null}\n ref={register(direction)}\n onClick={() => {\n if (target !== null) onPageChange?.(target);\n }}\n >\n {text}\n </button>\n );\n };\n\n return (\n <nav {...rest} {...agentAttributesFor(node)} aria-label={label}>\n <p aria-live=\"polite\">{showing(range)}</p>\n <div>\n {control(\"previous\", parts[0] ?? partFor(\"previous\"))}\n <span>\n Page {range.page} of {range.pages}\n </span>\n {control(\"next\", parts[1] ?? partFor(\"next\"))}\n </div>\n </nav>\n );\n}\n","import { defineAgentMeta } from \"@/agent/registry.ts\";\n\nexport const panelMeta = defineAgentMeta({\n name: \"Panel\",\n category: \"layout\",\n summary:\n \"A labelled region with a header band and an optional slot for the controls that act on it. Everything on a Sprint page lives inside one.\",\n whenToUse:\n \"Use it for every distinct region of a page: a section of documentation, a form, a readout, a preview. The label is the region's accessible name, so a person, a screen reader, and an agent all address the region by the same words.\",\n whenNotToUse:\n \"Do not use it as a spacer or a plain box; that is Stack. Nesting reads clearly to about three deep, because each level alternates its ground and demotes its frame; past that, the depth cues repeat and the region wants a page of its own.\",\n status: \"experimental\",\n props: {\n label: {\n kind: \"string\",\n description:\n \"What this region is. Rendered in the header band and used as the region's accessible name.\",\n required: true,\n },\n children: {\n kind: \"node\",\n description:\n \"The region's content. An empty panel says it is empty rather than collapsing.\",\n },\n headingLevel: {\n kind: \"enum\",\n description:\n \"Render the label as a real heading at this outline depth, so the section is reachable when a screen reader navigates by headings. Set it on every panelled section of a page; leave it unset only for chrome such as a preview frame.\",\n values: [\"2\", \"3\", \"4\"],\n },\n actions: {\n kind: \"node\",\n description:\n \"Controls that act on this region, rendered at the end of the header band. Keep it to one or two.\",\n },\n flush: {\n kind: \"boolean\",\n description:\n \"Drop the body padding, for content that draws its own edges such as a Table or a CodeBlock.\",\n default: false,\n },\n emptyLabel: {\n kind: \"string\",\n description: \"What the panel says when it has no content.\",\n default: \"Empty\",\n },\n loading: {\n kind: \"boolean\",\n description:\n \"Set while the content are being fetched. Sets aria-busy and sweeps a bar along the top edge. Existing content stay visible; with none yet, the empty slot says loadingLabel instead of emptyLabel.\",\n default: false,\n },\n loadingLabel: {\n kind: \"string\",\n description: \"What the empty slot says while loading.\",\n default: \"Loading\",\n },\n },\n state: {\n flush: {\n description: \"Present when the body carries no padding of its own.\",\n attribute: \"data-sprint-flush\",\n },\n empty: {\n description:\n \"Present when the panel has no content. The panel still renders its keyline and says it is empty.\",\n attribute: \"data-sprint-empty\",\n },\n loading: {\n description:\n \"Present while the content are being fetched. Alongside empty it means nothing has arrived yet, not that there is nothing.\",\n attribute: \"data-sprint-loading\",\n },\n },\n agentView: {\n example: '- **Panel** \"WebMCP tools\"',\n },\n a11y: {\n role: \"region\",\n notes:\n \"The section is a named landmark either way: the label is its accessible name. With headingLevel the label is also a heading element, so the page outline includes the region; without it the region is reachable only by landmark navigation.\",\n },\n examples: [\n {\n title: \"A section of a page\",\n description:\n \"headingLevel puts the label in the page outline, so a screen reader finds the section by heading as well as by landmark.\",\n code: '<Panel label=\"When to use\" headingLevel={2}>\\n <Text>Use it for any discrete action.</Text>\\n</Panel>',\n },\n {\n title: \"A panel with a control in its header\",\n description:\n \"The header slot is for controls that act on the region, not for navigation.\",\n code: '<Panel\\n label=\"Preview\"\\n actions={<Button agentName=\"Reset preview\">Reset</Button>}\\n>\\n <Button tone=\"action\">Prepare launch</Button>\\n</Panel>',\n },\n {\n title: \"A flush panel around a table\",\n description:\n \"Content that draws its own keylines sits flush, so borders do not double up.\",\n code: '<Panel label=\"Conventions\" flush>\\n <Table label=\"Conventions\" columns={columns} rows={rows} />\\n</Panel>',\n },\n {\n title: \"Nested panels\",\n description:\n \"Depth styles itself: the outermost panel carries a doubled keyline, each nested level alternates its ground, and nested headers demote to a dashed rule, so a reader ranks the levels without counting borders.\",\n code: '<Panel label=\"The shape\" headingLevel={2}>\\n <Panel label=\"Human view\" headingLevel={3}>\\n <Panel label=\"Crew\" headingLevel={4}>\\n <Text>Registration fields live here.</Text>\\n </Panel>\\n </Panel>\\n</Panel>',\n },\n {\n title: \"An empty region\",\n description:\n \"An empty panel keeps its border and states that it is empty, rather than vanishing and leaving a person or an agent unsure whether it failed to load.\",\n code: '<Panel label=\"Registered tools\" emptyLabel=\"No tools registered\" />',\n },\n ],\n});\n","import { Children, type ComponentPropsWithRef, type ReactNode } from \"react\";\nimport { AgentLine } from \"@/agent/view/AgentText.tsx\";\nimport { useSprintView } from \"@/agent/view/mode.ts\";\nimport { agentAttributesFor, buildAgentNode } from \"@/agent/view/project.ts\";\nimport { panelMeta } from \"./meta.ts\";\nimport \"./Panel.css\";\n\nexport type PanelHeadingLevel = 2 | 3 | 4;\n\nexport interface PanelProps extends ComponentPropsWithRef<\"section\"> {\n label: string;\n headingLevel?: PanelHeadingLevel;\n actions?: ReactNode;\n flush?: boolean;\n emptyLabel?: string;\n loading?: boolean;\n loadingLabel?: string;\n}\n\nexport function Panel(props: PanelProps) {\n const {\n label,\n headingLevel,\n actions,\n flush = false,\n emptyLabel = \"Empty\",\n loading = false,\n loadingLabel = \"Loading\",\n children,\n ...rest\n } = props;\n\n const view = useSprintView();\n const empty = Children.toArray(children).length === 0;\n\n const node = buildAgentNode({\n component: panelMeta.name,\n label,\n region: true,\n state: { flush, empty, loading },\n });\n\n if (view === \"agent\") {\n return (\n <AgentLine node={node}>\n {actions}\n {children}\n </AgentLine>\n );\n }\n\n const Label = headingLevel === undefined ? \"span\" : (`h${headingLevel}` as const);\n\n return (\n <section\n {...rest}\n {...agentAttributesFor(node)}\n aria-label={label}\n aria-busy={loading || undefined}\n >\n <header>\n <Label>{label}</Label>\n {actions === undefined ? null : <span>{actions}</span>}\n </header>\n <div>{empty ? <span>{loading ? loadingLabel : emptyLabel}</span> : children}</div>\n </section>\n );\n}\n","import { defineAgentMeta } from \"@/agent/registry.ts\";\n\nexport const pendingMeta = defineAgentMeta({\n name: \"Pending\",\n category: \"feedback\",\n summary:\n \"Marks a region whose data is being fetched. Keeps stale content visible and readable while it refreshes, and holds a labelled pending field when there is nothing to show yet.\",\n whenToUse:\n \"Wrap a region you build yourself while its data loads: a profile card, a chart, a custom summary. Pass the children only once data exists, so the first load shows the pending field and a refetch keeps the old content under a busy bar. Table, List, DescriptionList and Panel take a loading prop of their own, so reach for that first.\",\n whenNotToUse:\n \"Do not wrap a Table, List, DescriptionList or Panel; use its loading prop, which keeps the region's own label and frame. Do not use for a long job with a countable amount of work; that is a Progress. Do not use for a busy action; that is Button's loading prop.\",\n status: \"experimental\",\n props: {\n loading: {\n kind: \"boolean\",\n description:\n \"Whether the region's data is being fetched. While false the wrapper adds nothing to the agent view.\",\n required: true,\n },\n label: {\n kind: \"string\",\n description:\n 'What is loading, as a phrase a person can read in the empty field, such as \"Loading profile\".',\n required: true,\n },\n children: {\n kind: \"node\",\n description:\n \"The region's content. Omit it until data exists; while loading with children they stay visible as stale content.\",\n },\n },\n state: {\n loading: {\n description: \"Present while the region's data is being fetched.\",\n attribute: \"data-sprint-loading\",\n },\n empty: {\n description:\n \"Present while loading with no content yet, so nothing on screen is data.\",\n attribute: \"data-sprint-empty\",\n },\n },\n agentView: {\n example: '- **Pending** \"Loading profile\" [empty, loading]',\n },\n examples: [\n {\n title: \"First load\",\n description: \"No data yet, so the region holds a labelled pending field.\",\n code: '<Pending loading={isLoading} label=\"Loading profile\">\\n {profile && <ProfileSummary profile={profile} />}\\n</Pending>',\n },\n {\n title: \"Refetching stale content\",\n description:\n \"Content already on screen stays readable under a busy bar, and an agent reads it nested under a loading line.\",\n code: '<Pending loading={isFetching} label=\"Refreshing pilot\">\\n <Stack gap=\"tight\">\\n <Heading level={3}>{pilot.callsign}</Heading>\\n <Text tone=\"muted\">{pilot.status}</Text>\\n </Stack>\\n</Pending>',\n },\n ],\n a11y: {\n role: \"group\",\n notes:\n \"While loading the wrapper is a group named by its label with aria-busy set, so assistive technology knows the content may change. Idle, it is a plain element with no role.\",\n },\n});\n","import { Children, type ComponentPropsWithRef } from \"react\";\nimport { AgentLine } from \"@/agent/view/AgentText.tsx\";\nimport { useSprintView } from \"@/agent/view/mode.ts\";\nimport { agentAttributesFor, buildAgentNode } from \"@/agent/view/project.ts\";\nimport { pendingMeta } from \"./meta.ts\";\nimport \"./Pending.css\";\n\nexport interface PendingProps extends ComponentPropsWithRef<\"div\"> {\n loading: boolean;\n label: string;\n}\n\nexport function Pending(props: PendingProps) {\n const { loading, label, children, ...rest } = props;\n\n const view = useSprintView();\n const empty = Children.toArray(children).length === 0;\n\n const node = buildAgentNode({\n component: pendingMeta.name,\n label,\n state: { loading: true, empty },\n });\n\n if (view === \"agent\") {\n return (\n <AgentLine node={node} silent={!loading}>\n {children}\n </AgentLine>\n );\n }\n\n const busy = loading\n ? {\n ...agentAttributesFor(node),\n role: \"group\",\n \"aria-label\": label,\n \"aria-busy\": true,\n }\n : {};\n\n return (\n <div {...rest} {...busy}>\n {loading && empty ? <span>{label}</span> : null}\n {children}\n </div>\n );\n}\n","import { defineAgentMeta } from \"@/agent/registry.ts\";\n\nexport const progressMeta = defineAgentMeta({\n name: \"Progress\",\n category: \"feedback\",\n summary:\n \"A labelled loading indicator for work in progress. Indeterminate by default; pass value for a known fraction complete.\",\n whenToUse:\n \"Use while something the person is waiting on is still running: a page section fetching, an upload, an import, a long job. Omit value when the remaining work is unknown, and pass value with max when it can be counted. Keep the label a stable noun phrase for what is loading, not a percentage.\",\n whenNotToUse:\n \"Do not use for a busy action; Button's loading prop already marks the button itself. Do not use for the outcome of work that finished or failed; that is an Alert. Do not use for a quantity that is not progress, such as disk usage.\",\n status: \"experimental\",\n props: {\n label: {\n kind: \"string\",\n description:\n 'What is loading, such as \"Importing manifest\". It is the indicator\\'s accessible name and its agent label.',\n required: true,\n },\n value: {\n kind: \"number\",\n description:\n \"Work completed so far, in the same units as max. Omit for an indeterminate indicator. Clamped to the range 0 to max.\",\n },\n max: {\n kind: \"number\",\n description: \"The value at which the work is complete.\",\n default: 100,\n },\n },\n state: {\n loading: {\n description:\n \"Present until the work completes. An indeterminate indicator is always loading.\",\n attribute: \"data-sprint-loading\",\n },\n value: {\n description:\n \"The fraction complete as a whole percentage, such as 40%. Absent while indeterminate.\",\n attribute: \"data-sprint-value\",\n },\n },\n agentView: {\n example: '- **Progress** \"Importing manifest\" [loading, value=40%]',\n },\n examples: [\n {\n title: \"Indeterminate load\",\n description:\n \"Nothing to count yet, so the indicator only says that work is running.\",\n code: '<Progress label=\"Loading flight plan\" />',\n },\n {\n title: \"Counted progress\",\n description:\n \"With value and max the agent reads a percentage instead of guessing.\",\n code: '<Progress label=\"Importing manifest\" value={imported} max={total} />',\n },\n {\n title: \"Complete\",\n description:\n \"At max the loading state clears, so the line reads as finished rather than stalled.\",\n code: '<Progress label=\"Importing manifest\" value={240} max={240} />',\n },\n ],\n a11y: {\n role: \"progressbar\",\n notes:\n \"Renders a native progress element named by the visible label. Omitting value leaves it indeterminate, which assistive technology announces as busy. The percentage readout is hidden from assistive technology because the progressbar already carries its value.\",\n },\n});\n","import { type ComponentPropsWithRef, useId } from \"react\";\nimport { AgentLine } from \"@/agent/view/AgentText.tsx\";\nimport { useSprintView } from \"@/agent/view/mode.ts\";\nimport { agentAttributesFor, buildAgentNode } from \"@/agent/view/project.ts\";\nimport { progressMeta } from \"./meta.ts\";\nimport \"./Progress.css\";\n\nexport interface ProgressProps extends Omit<ComponentPropsWithRef<\"div\">, \"children\"> {\n label: string;\n value?: number;\n max?: number;\n}\n\nfunction percentOf(value: number, max: number): number {\n if (max <= 0) return 100;\n return Math.round((Math.min(Math.max(value, 0), max) / max) * 100);\n}\n\nexport function Progress(props: ProgressProps) {\n const { label, value, max = 100, ...rest } = props;\n\n const view = useSprintView();\n const labelId = useId();\n\n const determinate = value !== undefined && Number.isFinite(value);\n const percent = determinate ? percentOf(value, max) : undefined;\n\n const node = buildAgentNode({\n component: progressMeta.name,\n label,\n state: {\n loading: percent === undefined || percent < 100,\n value: percent === undefined ? undefined : `${percent}%`,\n },\n });\n\n if (view === \"agent\") return <AgentLine node={node} />;\n\n return (\n <div {...rest} {...agentAttributesFor(node)}>\n <span id={labelId}>{label}</span>\n {percent === undefined ? null : <span aria-hidden=\"true\">{percent}%</span>}\n <progress\n aria-labelledby={labelId}\n {...(percent === undefined ? {} : { value: percent, max: 100 })}\n />\n </div>\n );\n}\n","import type { AgentToolSpec } from \"@/agent/types.ts\";\n\nexport const SEARCH_TOOL: AgentToolSpec = {\n verb: \"search\",\n description:\n \"Search with this field: replace its text with the query, exactly as a person typing it would, then submit it as pressing Enter would. Pass an empty string to clear the search. Results usually render elsewhere on the page; this returns the field's state after the search, so read the results region next.\",\n inputSchema: {\n type: \"object\",\n properties: {\n query: {\n type: \"string\",\n description:\n \"The full search text. Replaces the current query rather than appending to it; an empty string clears the search.\",\n },\n },\n required: [\"query\"],\n },\n readOnly: false,\n untrustedContent: true,\n registeredWhen:\n \"The field is mounted, enabled, has a resolvable label, and no other component claims the same tool name.\",\n unregisteredWhen: \"The field unmounts or becomes disabled.\",\n};\n","import { defineAgentMeta } from \"@/agent/registry.ts\";\nimport { SEARCH_TOOL } from \"./tool.ts\";\n\nexport const searchFieldMeta = defineAgentMeta({\n name: \"SearchField\",\n category: \"input\",\n summary:\n \"A search box inside its own search landmark: a labelled query field with a clear control, Escape to clear, Enter to submit, and an optional page-wide key that focuses it. It registers one search tool that sets the query and submits it.\",\n whenToUse:\n \"Use it to filter or search a collection on the page, such as narrowing a users list by name. The landmark lets screen reader users jump straight to it, and the optional shortcut gives keyboard users the familiar slash-to-search.\",\n whenNotToUse:\n \"Do not use it for any other single-line value; a name, an email address, or an identifier is a TextInput. Do not use it to choose from a short known set, which is a Select or a SegmentedControl. Do not give two fields on one page the same shortcut.\",\n status: \"experimental\",\n props: {\n label: {\n kind: \"string\",\n description:\n 'What is being searched, as a noun phrase such as \"Users\". Names the landmark and the field, and derives the tool name, so \"Users\" becomes search-users.',\n required: true,\n },\n value: {\n kind: \"string\",\n description: \"The current query. The field is fully controlled.\",\n required: true,\n },\n onChange: {\n kind: \"handler\",\n description:\n \"Called with the new query on every change, including the clear control, Escape, and the search tool.\",\n required: true,\n },\n onSubmit: {\n kind: \"handler\",\n description:\n \"Called with the query when Enter is pressed or the search tool runs. Leave it off for a live filter that reacts to onChange alone.\",\n },\n placeholder: {\n kind: \"string\",\n description: 'Ghost text shown while the field is empty, e.g. \"Name or email\".',\n },\n hideLabel: {\n kind: \"boolean\",\n description:\n \"Hide the label visually while keeping it for screen readers and agents. Pair it with a placeholder so sighted people still know what the field searches.\",\n default: false,\n },\n shortcut: {\n kind: \"string\",\n description:\n 'A single key that focuses the field from anywhere on the page, shown as a key chip while the field is empty and unfocused. Ignored while focus is in another editable element or a modifier is held. Pass \"/\" for the common convention; omit or pass false for none.',\n },\n name: {\n kind: \"string\",\n description: \"The native form name of the query input.\",\n },\n disabled: {\n kind: \"boolean\",\n description: \"Disable the field, its shortcut, and its search tool.\",\n default: false,\n },\n agentName: {\n kind: \"string\",\n description:\n \"Override the label used to derive the tool name, when two search fields on a page would otherwise collide.\",\n },\n agentTool: {\n kind: \"boolean\",\n description: \"Set false to render the field without registering a search tool.\",\n default: true,\n },\n },\n state: {\n value: {\n description: \"The current query, absent while the field is empty.\",\n attribute: \"data-sprint-value\",\n },\n empty: {\n description: \"Present while the field holds no query.\",\n attribute: \"data-sprint-empty\",\n },\n shortcut: {\n description: \"The key that focuses the field from anywhere on the page.\",\n attribute: \"data-sprint-shortcut\",\n },\n disabled: {\n description: \"Present when the field cannot be edited.\",\n attribute: \"data-sprint-disabled\",\n },\n },\n tools: {\n search: SEARCH_TOOL,\n },\n agentView: {\n example: '- **SearchField** \"Users\" [empty, shortcut=/] → tool `search-users`',\n },\n examples: [\n {\n title: \"Filtering a list\",\n description:\n \"A live filter: onChange narrows the list as the person types, so there is no onSubmit. The label is hidden and the placeholder says what can be matched.\",\n code: '<SearchField\\n label=\"Users\"\\n hideLabel\\n value={query}\\n onChange={setQuery}\\n placeholder=\"Name or email\"\\n/>',\n },\n {\n title: \"A slash shortcut\",\n description:\n \"Pressing / anywhere on the page focuses the field unless focus is already in something editable. The key chip disappears once the field has focus or a query.\",\n code: '<SearchField\\n label=\"Users\"\\n value={query}\\n onChange={setQuery}\\n shortcut=\"/\"\\n placeholder=\"Name or email\"\\n/>',\n },\n {\n title: \"Submitting a query\",\n description:\n \"For a search that is too costly to run on every keystroke, onSubmit receives the query on Enter and when the search tool runs.\",\n code: '<SearchField\\n label=\"Flight logs\"\\n value={query}\\n onChange={setQuery}\\n onSubmit={runSearch}\\n placeholder=\"Callsign or tail number\"\\n/>',\n },\n ],\n a11y: {\n role: \"search\",\n keyboard: [\n \"Enter submits the query\",\n \"Escape clears a non-empty query and keeps focus; on an empty field it passes through, so an enclosing dialog can close\",\n \"The shortcut key, when set, focuses the field from anywhere on the page\",\n ],\n notes:\n \"The root is a form with role search, labelled by the field's label, so it is listed as a search landmark. The input is type search and announces its shortcut with aria-keyshortcuts; the key chip itself is hidden from assistive technology. The clear control appears only while there is a query, and returns focus to the field.\",\n },\n relatedComponents: [\"TextInput\"],\n});\n","export function setFieldValue(\n element: HTMLInputElement | HTMLTextAreaElement,\n value: string,\n): void {\n const prototype =\n element instanceof HTMLTextAreaElement\n ? HTMLTextAreaElement.prototype\n : HTMLInputElement.prototype;\n const setter = Object.getOwnPropertyDescriptor(prototype, \"value\")?.set;\n if (setter === undefined) return;\n setter.call(element, value);\n element.dispatchEvent(new Event(\"input\", { bubbles: true }));\n}\n\nexport function setSelectValue(element: HTMLSelectElement, value: string): void {\n const setter = Object.getOwnPropertyDescriptor(\n HTMLSelectElement.prototype,\n \"value\",\n )?.set;\n if (setter === undefined) return;\n setter.call(element, value);\n element.dispatchEvent(new Event(\"change\", { bubbles: true }));\n}\n","import {\n type ComponentPropsWithRef,\n type KeyboardEvent,\n useCallback,\n useEffect,\n useId,\n useRef,\n} from \"react\";\nimport { AgentFieldControl, AgentLine } from \"@/agent/view/AgentText.tsx\";\nimport { useAgentControls, useAgentFormat, useSprintView } from \"@/agent/view/mode.ts\";\nimport {\n agentAttributesFor,\n agentPartAttributesFor,\n buildAgentNode,\n} from \"@/agent/view/project.ts\";\nimport { afterCommit } from \"@/agent/webmcp/afterCommit.ts\";\nimport { setFieldValue } from \"@/agent/webmcp/drive.ts\";\nimport { commitSync } from \"@/agent/webmcp/flush.ts\";\nimport { useAgentTool } from \"@/agent/webmcp/useAgentTool.ts\";\nimport { searchFieldMeta } from \"./meta.ts\";\nimport { SEARCH_TOOL } from \"./tool.ts\";\nimport \"./SearchField.css\";\n\nconst EDITABLE =\n 'input, textarea, select, [contenteditable]:not([contenteditable=\"false\"])';\n\nexport interface SearchFieldProps\n extends Omit<ComponentPropsWithRef<\"form\">, \"onChange\" | \"onSubmit\"> {\n label: string;\n value: string;\n onChange: (value: string) => void;\n onSubmit?: (value: string) => void;\n placeholder?: string;\n hideLabel?: boolean;\n shortcut?: string | false;\n name?: string;\n disabled?: boolean;\n agentName?: string;\n agentTool?: boolean;\n}\n\nfunction isEditable(target: EventTarget | null): boolean {\n return target instanceof Element && target.closest(EDITABLE) !== null;\n}\n\nfunction useShortcut(\n key: string | undefined,\n target: { current: HTMLInputElement | null },\n): void {\n useEffect(() => {\n if (key === undefined) return;\n const listener = (event: globalThis.KeyboardEvent) => {\n if (event.key !== key || event.defaultPrevented) return;\n if (event.ctrlKey || event.metaKey || event.altKey) return;\n if (isEditable(event.target) || isEditable(document.activeElement)) return;\n const field = target.current;\n if (field === null) return;\n event.preventDefault();\n field.focus();\n };\n document.addEventListener(\"keydown\", listener);\n return () => document.removeEventListener(\"keydown\", listener);\n }, [key, target]);\n}\n\nexport function SearchField(props: SearchFieldProps) {\n const {\n label,\n value,\n onChange,\n onSubmit,\n placeholder,\n hideLabel = false,\n shortcut,\n name,\n disabled = false,\n agentName,\n agentTool = true,\n ...rest\n } = props;\n\n const view = useSprintView();\n const controls = useAgentControls();\n const formatter = useAgentFormat();\n const id = useId();\n\n const element = useRef<HTMLInputElement | null>(null);\n const onChangeRef = useRef(onChange);\n onChangeRef.current = onChange;\n const onSubmitRef = useRef(onSubmit);\n onSubmitRef.current = onSubmit;\n const formatRef = useRef(formatter);\n formatRef.current = formatter;\n const nodeRef = useRef(buildAgentNode({ component: searchFieldMeta.name }));\n const mounted = useRef(true);\n\n useEffect(() => {\n mounted.current = true;\n return () => {\n mounted.current = false;\n };\n }, []);\n\n const key =\n shortcut === undefined || shortcut === false || shortcut === \"\" || disabled\n ? undefined\n : shortcut;\n useShortcut(key, element);\n\n const execute = useCallback(async (inputs: Record<string, unknown>) => {\n const query = inputs.query;\n if (typeof query !== \"string\") {\n return 'Pass \"query\" as a string holding the full search text.';\n }\n\n const target = element.current;\n if (target !== null) setFieldValue(target, query);\n else commitSync(() => onChangeRef.current(query));\n\n const submit = onSubmitRef.current;\n if (submit !== undefined) commitSync(() => submit(query));\n\n await afterCommit();\n if (!mounted.current) return \"The search removed this field from the page.\";\n const verb = submit === undefined ? \"Filtered\" : \"Searched\";\n return `${verb}. The field is now:\\n${formatRef.current([nodeRef.current])}`;\n }, []);\n\n const toolName = useAgentTool({\n spec: SEARCH_TOOL,\n label: agentName ?? label,\n enabled: agentTool && !disabled,\n execute,\n });\n\n const empty = value === \"\";\n\n const node = buildAgentNode({\n component: searchFieldMeta.name,\n label,\n tool: toolName,\n state: {\n ...(empty ? {} : { value }),\n empty,\n shortcut: key,\n disabled,\n },\n });\n nodeRef.current = node;\n\n if (view === \"agent\") {\n if (disabled || controls === \"never\") return <AgentLine node={node} />;\n return (\n <AgentFieldControl\n node={node}\n value={value}\n onValueChange={onChange}\n ref={(target: HTMLInputElement | null) => {\n element.current = target;\n }}\n />\n );\n }\n\n const labelId = `${id}-label`;\n\n const clear = () => {\n onChange(\"\");\n element.current?.focus();\n };\n\n const onKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {\n if (event.key !== \"Escape\" || empty) return;\n event.preventDefault();\n event.stopPropagation();\n onChange(\"\");\n };\n\n return (\n // biome-ignore lint/a11y/useSemanticElements: a form carrying the search role is the landmark every screen reader recognises, and the form is what makes Enter submit\n <form\n {...rest}\n {...agentAttributesFor(node)}\n role=\"search\"\n aria-labelledby={labelId}\n noValidate\n onSubmit={(event) => {\n event.preventDefault();\n if (!disabled) onSubmit?.(value);\n }}\n >\n <label\n id={labelId}\n htmlFor={id}\n {...agentPartAttributesFor({\n part: \"label\",\n state: hideLabel ? { \"visually-hidden\": true } : {},\n })}\n >\n {label}\n </label>\n <div {...agentPartAttributesFor({ part: \"control\", state: {} })}>\n <input\n id={id}\n {...agentPartAttributesFor({ part: \"input\", state: {} })}\n ref={(target) => {\n element.current = target;\n }}\n type=\"search\"\n value={value}\n placeholder={placeholder}\n name={name}\n disabled={disabled}\n autoComplete=\"off\"\n aria-keyshortcuts={key}\n enterKeyHint=\"search\"\n onChange={(event) => onChange(event.currentTarget.value)}\n onKeyDown={onKeyDown}\n />\n {empty || disabled ? null : (\n <button\n {...agentPartAttributesFor({ part: \"clear\", state: {} })}\n type=\"button\"\n aria-label={`Clear ${label} search`}\n onClick={clear}\n >\n Clear\n </button>\n )}\n {key === undefined || !empty ? null : (\n <span\n {...agentPartAttributesFor({ part: \"shortcut\", state: {} })}\n aria-hidden=\"true\"\n >\n <kbd>{key}</kbd>\n </span>\n )}\n </div>\n </form>\n );\n}\n","import { defineAgentMeta } from \"@/agent/registry.ts\";\n\nexport const secretFieldMeta = defineAgentMeta({\n name: \"SecretField\",\n category: \"display\",\n summary:\n \"A sensitive value shown once or on demand: an API key, a recovery code, a signing secret. Masked by default with reveal and copy controls, and the value never reaches any agent surface.\",\n whenToUse:\n \"Use to hand a person a secret the page holds. The mask is fixed-length so nothing leaks, and copy places the value on the clipboard without revealing it.\",\n whenNotToUse:\n \"Do not use for entering a secret; that is a TextInput with type password. Do not use for values that are safe to read; a DescriptionList or CodeBlock keeps those on the agent surface where they belong.\",\n status: \"experimental\",\n props: {\n label: {\n kind: \"string\",\n description: \"What the secret is, shown as the field's uppercase title.\",\n required: true,\n },\n value: {\n kind: \"string\",\n description:\n \"The secret. Never appears in agent attributes, the agent view, or the copyable text stream; only reveal and copy touch it.\",\n required: true,\n },\n hint: {\n kind: \"string\",\n description:\n 'Guidance below the value, e.g. \"Store it now. It is not shown again.\"',\n },\n defaultRevealed: {\n kind: \"boolean\",\n description: \"Start revealed instead of masked.\",\n default: false,\n },\n },\n state: {\n filled: {\n description: \"Present when the field holds a secret.\",\n attribute: \"data-sprint-filled\",\n },\n revealed: {\n description: \"Present while the value is shown in clear text.\",\n attribute: \"data-sprint-revealed\",\n },\n },\n agentView: {\n example: '- **SecretField** \"API key\" [filled]',\n },\n examples: [\n {\n title: \"A key shown once\",\n code: '<SecretField\\n label=\"API key\"\\n value={key}\\n hint=\"Store it now. It is not shown again.\"\\n/>',\n },\n {\n title: \"Starting revealed\",\n description: \"For a value the person is expected to transcribe immediately.\",\n code: '<SecretField label=\"Recovery code\" value={code} defaultRevealed />',\n },\n ],\n a11y: {\n notes:\n \"The reveal control is a toggle button with aria-pressed; the masked value is announced as a hidden secret rather than as bullet characters. Copy announces its success by swapping its label to Copied.\",\n },\n});\n","import { type ComponentPropsWithRef, useEffect, useState } from \"react\";\nimport { AgentLine } from \"@/agent/view/AgentText.tsx\";\nimport { useSprintView } from \"@/agent/view/mode.ts\";\nimport type { AgentPart } from \"@/agent/view/node.ts\";\nimport {\n agentAttributesFor,\n agentPartAttributesFor,\n buildAgentNode,\n} from \"@/agent/view/project.ts\";\nimport { secretFieldMeta } from \"./meta.ts\";\nimport \"./SecretField.css\";\n\nconst MASK = \"••••••••••••\";\nconst COPIED_FOR = 1200;\n\nexport interface SecretFieldProps extends ComponentPropsWithRef<\"div\"> {\n label: string;\n value: string;\n hint?: string;\n defaultRevealed?: boolean;\n}\n\nexport function SecretField(props: SecretFieldProps) {\n const { label, value, hint, defaultRevealed = false, ...rest } = props;\n\n const view = useSprintView();\n const [revealed, setRevealed] = useState(defaultRevealed);\n const [copied, setCopied] = useState(false);\n\n useEffect(() => {\n if (!copied) return;\n const timer = setTimeout(() => setCopied(false), COPIED_FOR);\n return () => clearTimeout(timer);\n }, [copied]);\n\n const copy = () => {\n const clipboard = navigator.clipboard;\n if (clipboard === undefined) return;\n clipboard.writeText(value).then(\n () => setCopied(true),\n () => setCopied(false),\n );\n };\n\n const filled = value !== \"\";\n\n const parts: AgentPart[] =\n hint === undefined ? [] : [{ part: \"hint\", label: hint, state: {} }];\n\n const node = buildAgentNode({\n component: secretFieldMeta.name,\n label,\n state: { filled, revealed },\n parts,\n });\n\n if (view === \"agent\") return <AgentLine node={node} />;\n\n return (\n <div {...rest} {...agentAttributesFor(node)}>\n <span {...agentPartAttributesFor({ part: \"label\", state: {} })}>{label}</span>\n <div {...agentPartAttributesFor({ part: \"control\", state: {} })}>\n <output\n {...agentPartAttributesFor({ part: \"value\", state: {} })}\n aria-label={revealed ? undefined : \"Hidden secret\"}\n >\n {revealed ? value : MASK}\n </output>\n <button\n {...agentPartAttributesFor({ part: \"reveal\", state: {} })}\n type=\"button\"\n aria-pressed={revealed}\n onClick={() => setRevealed((current) => !current)}\n >\n {revealed ? \"Hide\" : \"Reveal\"}\n </button>\n <button\n {...agentPartAttributesFor({\n part: \"copy\",\n state: copied ? { copied: true } : {},\n })}\n type=\"button\"\n onClick={copy}\n >\n {copied ? \"Copied\" : \"Copy\"}\n </button>\n </div>\n {hint === undefined ? null : (\n <p {...agentPartAttributesFor({ part: \"hint\", state: {} })}>{hint}</p>\n )}\n </div>\n );\n}\n","import type { AgentToolSpec } from \"@/agent/types.ts\";\n\nexport const SELECT_TOOL: AgentToolSpec = {\n verb: \"select\",\n description:\n \"Select one of this control's options by its visible label, exactly as a person clicking it would. Only one option is selected at a time, so this replaces the current one. Returns the control's state after the change, so a follow-up read is unnecessary.\",\n inputSchema: {\n type: \"object\",\n properties: {\n option: {\n type: \"string\",\n description:\n \"The visible label of the option to select, as shown on the control.\",\n },\n },\n required: [\"option\"],\n },\n readOnly: false,\n untrustedContent: true,\n registeredWhen:\n \"The control is mounted, enabled, has a resolvable label, and no other component claims the same tool name. The registered schema enumerates the current option labels.\",\n unregisteredWhen: \"The control unmounts or becomes disabled.\",\n};\n","import { defineAgentMeta } from \"@/agent/registry.ts\";\nimport { SELECT_TOOL } from \"./tool.ts\";\n\nexport const segmentedControlMeta = defineAgentMeta({\n name: \"SegmentedControl\",\n category: \"input\",\n summary:\n \"A short row of mutually exclusive options, all visible at once: a radio group that registers a single select tool whose schema enumerates the options currently on screen.\",\n whenToUse:\n \"Use it for two to four exclusive choices a person should be able to compare without opening anything: a view switch, a density setting, a filter. One tool with an enum beats one tool per option, and it keeps a page's tool count flat as options are added.\",\n whenNotToUse:\n \"Do not use it for more than about four options or for long labels; that is a select. Do not use it for an on/off setting, which is a switch, and never for navigation.\",\n status: \"experimental\",\n props: {\n label: {\n kind: \"string\",\n description:\n 'What is being chosen. Names the group for a screen reader and derives the tool name, so prefer a noun phrase such as \"Page view\".',\n required: true,\n },\n options: {\n kind: \"array\",\n description:\n \"The choices in display order: { value, label, count? }. The label is what a person sees and what the select tool accepts, so an agent never has to know the value. count renders as a muted chip beside the label and reaches the agent view as part state, so never fold a count into the label.\",\n required: true,\n },\n value: {\n kind: \"string\",\n description: \"The value of the selected option. The control is fully controlled.\",\n required: true,\n },\n onChange: {\n kind: \"handler\",\n description:\n \"Called with the newly selected value. The select tool drives a real click, so this runs for agent selections too.\",\n required: true,\n },\n savedValue: {\n kind: \"string\",\n description:\n \"The value currently in effect, for a control that stages a change until something confirms it. While it differs from value the saved option keeps a marker and the control reports itself dirty, so both the saved and the proposed choice stay readable.\",\n },\n hint: {\n kind: \"string\",\n description:\n \"Guidance shown under the options, linked with aria-describedby and carried into the agent view. Say what a staged change does, such as when it takes effect.\",\n },\n block: {\n kind: \"boolean\",\n description:\n \"Fill the container's width, with every option taking an equal share. Without it the control stays as wide as its options, even inside a stretching column.\",\n default: false,\n },\n disabled: {\n kind: \"boolean\",\n description: \"Disable every option and unregister the select tool.\",\n default: false,\n },\n agentName: {\n kind: \"string\",\n description:\n \"Override the label used to derive the tool name, when two controls on a page would otherwise collide.\",\n },\n agentTool: {\n kind: \"boolean\",\n description: \"Set false to render the control without registering a select tool.\",\n default: true,\n },\n },\n state: {\n value: {\n description: \"The value of the option currently selected.\",\n attribute: \"data-sprint-value\",\n },\n dirty: {\n description:\n \"Present while savedValue is set and differs from value. The saved option carries data-sprint-saved.\",\n attribute: \"data-sprint-dirty\",\n },\n block: {\n description: \"Present when the control fills its container.\",\n attribute: \"data-sprint-block\",\n },\n disabled: {\n description: \"Present when no option can be chosen.\",\n attribute: \"data-sprint-disabled\",\n },\n },\n tools: {\n select: SELECT_TOOL,\n },\n agentView: {\n example:\n '- **SegmentedControl** \"Access\" [dirty, value=write] → tool `select-access`\\n - part `option` \"Read\" [count=17, saved]\\n - part `option` \"Write\" [checked, count=4]\\n - part `hint` \"Currently Read. Nothing changes until you confirm.\"',\n },\n examples: [\n {\n title: \"A view switch\",\n description:\n \"In agent view each option renders as its own control, so an agent driving the DOM can click one without WebMCP.\",\n code: '<SegmentedControl\\n label=\"Page view\"\\n value={view}\\n onChange={setView}\\n options={[\\n { value: \"human\", label: \"human\" },\\n { value: \"agent\", label: \"agent\" },\\n ]}\\n/>',\n },\n {\n title: \"Options with counts\",\n description:\n \"A count is data, not label text: it renders as a chip, joins the accessible name, and reaches agents as part state while the select tool still takes the plain label.\",\n code: '<SegmentedControl\\n label=\"Members\"\\n value={filter}\\n onChange={setFilter}\\n options={[\\n { value: \"all\", label: \"All\", count: 48 },\\n { value: \"active\", label: \"Active\", count: 18 },\\n { value: \"never\", label: \"Never signed in\", count: 30 },\\n ]}\\n/>',\n },\n {\n title: \"A staged change\",\n description:\n \"savedValue keeps the value in effect visible while another is selected, and hint says what confirming will do. The control reports itself dirty until the two agree.\",\n code: '<SegmentedControl\\n label=\"Access\"\\n value={access}\\n savedValue=\"read\"\\n onChange={setAccess}\\n hint=\"Currently Read. Nothing changes until you confirm.\"\\n options={[\\n { value: \"read\", label: \"Read\" },\\n { value: \"write\", label: \"Write\" },\\n { value: \"admin\", label: \"Admin\" },\\n ]}\\n/>',\n },\n {\n title: \"A full-width control\",\n description:\n \"block fills the container and shares the width equally between options. Without it the control keeps its own width inside a stretching Stack.\",\n code: '<SegmentedControl\\n label=\"Range\"\\n block\\n value={range}\\n onChange={setRange}\\n options={[\\n { value: \"day\", label: \"Day\" },\\n { value: \"week\", label: \"Week\" },\\n { value: \"month\", label: \"Month\" },\\n ]}\\n/>',\n },\n {\n title: \"A disabled control\",\n description:\n \"Disabled unregisters the tool, so an agent cannot select an option a person could not.\",\n code: '<SegmentedControl\\n label=\"Density\"\\n disabled\\n value=\"dense\"\\n onChange={setDensity}\\n options={[\\n { value: \"dense\", label: \"dense\" },\\n { value: \"roomy\", label: \"roomy\" },\\n ]}\\n/>',\n },\n ],\n a11y: {\n role: \"radiogroup\",\n keyboard: [\n \"Arrow keys move to the next or previous option and select it\",\n \"Home selects the first option\",\n \"End selects the last option\",\n \"Tab enters and leaves the group once\",\n ],\n notes:\n \"Roving tabindex: only the selected option is in the tab order. Selection follows focus, which is the expected behaviour for a radio group. An option with a count is named by its label and its count together; the hint is linked to the group with aria-describedby.\",\n },\n});\n","import {\n type ComponentPropsWithRef,\n type KeyboardEvent as ReactKeyboardEvent,\n useCallback,\n useEffect,\n useId,\n useMemo,\n useRef,\n} from \"react\";\nimport { AgentControlGroup, AgentLine } from \"@/agent/view/AgentText.tsx\";\nimport { useAgentControls, useAgentFormat, useSprintView } from \"@/agent/view/mode.ts\";\nimport type { AgentPart } from \"@/agent/view/node.ts\";\nimport {\n agentAttributesFor,\n agentPartAttributesFor,\n buildAgentNode,\n} from \"@/agent/view/project.ts\";\nimport { afterCommit } from \"@/agent/webmcp/afterCommit.ts\";\nimport { commitSync } from \"@/agent/webmcp/flush.ts\";\nimport type { JsonSchemaObject } from \"@/agent/webmcp/types.ts\";\nimport { useAgentTool } from \"@/agent/webmcp/useAgentTool.ts\";\nimport { segmentedControlMeta } from \"./meta.ts\";\nimport { SELECT_TOOL } from \"./tool.ts\";\nimport \"./SegmentedControl.css\";\n\nexport interface SegmentedOption {\n value: string;\n label: string;\n count?: number;\n}\n\nexport interface SegmentedControlProps\n extends Omit<ComponentPropsWithRef<\"div\">, \"onChange\"> {\n label: string;\n options: readonly SegmentedOption[];\n value: string;\n onChange: (value: string) => void;\n savedValue?: string;\n hint?: string;\n block?: boolean;\n disabled?: boolean;\n agentName?: string;\n agentTool?: boolean;\n}\n\nfunction optionSchema(options: readonly SegmentedOption[]): JsonSchemaObject {\n const option = SELECT_TOOL.inputSchema.properties.option;\n return {\n ...SELECT_TOOL.inputSchema,\n properties: {\n ...SELECT_TOOL.inputSchema.properties,\n ...(option === undefined\n ? {}\n : { option: { ...option, enum: options.map((entry) => entry.label) } }),\n },\n };\n}\n\nexport function SegmentedControl(props: SegmentedControlProps) {\n const {\n label,\n options,\n value,\n onChange,\n savedValue,\n hint,\n block = false,\n disabled = false,\n agentName,\n agentTool = true,\n ...rest\n } = props;\n\n const view = useSprintView();\n const controls = useAgentControls();\n const formatter = useAgentFormat();\n const id = useId();\n\n const elements = useRef(new Map<string, HTMLButtonElement>());\n const onChangeRef = useRef(onChange);\n onChangeRef.current = onChange;\n const optionsRef = useRef(options);\n optionsRef.current = options;\n const formatRef = useRef(formatter);\n formatRef.current = formatter;\n const nodeRef = useRef(buildAgentNode({ component: segmentedControlMeta.name }));\n const mounted = useRef(true);\n\n useEffect(() => {\n mounted.current = true;\n return () => {\n mounted.current = false;\n };\n }, []);\n\n const select = useCallback((next: string) => {\n const element = elements.current.get(next);\n if (element !== undefined) {\n element.click();\n return;\n }\n commitSync(() => onChangeRef.current(next));\n }, []);\n\n const execute = useCallback(\n async (inputs: Record<string, unknown>) => {\n const requested = typeof inputs.option === \"string\" ? inputs.option : \"\";\n const available = optionsRef.current;\n const match = available.find((entry) => entry.label === requested);\n\n if (match === undefined) {\n return `No option named \"${requested}\". This control offers: ${available\n .map((entry) => `\"${entry.label}\"`)\n .join(\", \")}.`;\n }\n\n select(match.value);\n await afterCommit();\n if (!mounted.current) return \"The selection removed this control from the page.\";\n return `Selected. The control is now:\\n${formatRef.current([nodeRef.current])}`;\n },\n [select],\n );\n\n const schema = useMemo(() => optionSchema(options), [options]);\n\n const toolName = useAgentTool({\n spec: SELECT_TOOL,\n label: agentName ?? label,\n inputSchema: schema,\n enabled: agentTool && !disabled,\n execute,\n });\n\n const dirty =\n savedValue !== undefined &&\n savedValue !== value &&\n options.some((option) => option.value === savedValue);\n\n const optionParts: AgentPart[] = options.map((option) => ({\n part: \"option\",\n label: option.label,\n state: {\n ...(option.value === value ? { checked: true as const } : {}),\n ...(option.value === savedValue ? { saved: true as const } : {}),\n ...(option.count === undefined ? {} : { count: String(option.count) }),\n ...(disabled ? { disabled: true as const } : {}),\n },\n }));\n\n const hintPart: AgentPart[] =\n hint === undefined ? [] : [{ part: \"hint\", label: hint, state: {} }];\n\n const node = buildAgentNode({\n component: segmentedControlMeta.name,\n label,\n tool: toolName,\n state: { value, dirty, block, disabled },\n parts: [...optionParts, ...hintPart],\n });\n nodeRef.current = node;\n\n const move = (event: ReactKeyboardEvent<HTMLDivElement>) => {\n const keys = [\"ArrowRight\", \"ArrowDown\", \"ArrowLeft\", \"ArrowUp\", \"Home\", \"End\"];\n if (!keys.includes(event.key) || disabled) return;\n\n const current = options.findIndex((option) => option.value === value);\n const step = event.key === \"ArrowRight\" || event.key === \"ArrowDown\" ? 1 : -1;\n const next =\n event.key === \"Home\"\n ? 0\n : event.key === \"End\"\n ? options.length - 1\n : (current + step + options.length) % options.length;\n\n const target = options[next];\n if (target === undefined) return;\n\n event.preventDefault();\n elements.current.get(target.value)?.focus();\n select(target.value);\n };\n\n if (view === \"agent\") {\n if (disabled || controls === \"never\") return <AgentLine node={node} />;\n return (\n <AgentControlGroup\n node={node}\n isActionable={(part) => part.part === \"option\"}\n onActivate={(_part, index) => {\n const target = options[index];\n if (target !== undefined) select(target.value);\n }}\n />\n );\n }\n\n const hintId = hint === undefined ? undefined : `${id}-hint`;\n\n return (\n <div\n {...rest}\n {...agentAttributesFor(node)}\n role=\"radiogroup\"\n aria-label={label}\n aria-describedby={hintId}\n onKeyDown={move}\n >\n <div>\n {options.map((option, index) => {\n const selected = option.value === value;\n const active = options.some((entry) => entry.value === value)\n ? selected\n : index === 0;\n const labelId = `${id}-${index}-label`;\n const countId = `${id}-${index}-count`;\n return (\n <button\n key={option.value}\n type=\"button\"\n role=\"radio\"\n aria-checked={selected}\n aria-labelledby={\n option.count === undefined ? undefined : `${labelId} ${countId}`\n }\n tabIndex={active ? 0 : -1}\n disabled={disabled}\n ref={(element) => {\n if (element === null) elements.current.delete(option.value);\n else elements.current.set(option.value, element);\n }}\n {...agentPartAttributesFor(\n optionParts[index] ?? { part: \"option\", state: {} },\n )}\n onClick={() => onChange(option.value)}\n >\n {option.count === undefined ? (\n option.label\n ) : (\n <>\n <span id={labelId}>{option.label}</span>\n <span id={countId} aria-hidden=\"true\">\n {option.count}\n </span>\n </>\n )}\n </button>\n );\n })}\n </div>\n {hint === undefined ? null : (\n <p id={hintId} {...agentPartAttributesFor({ part: \"hint\", state: {} })}>\n {hint}\n </p>\n )}\n </div>\n );\n}\n","import type { AgentToolSpec } from \"@/agent/types.ts\";\n\nexport const SELECT_OPTION_TOOL: AgentToolSpec = {\n verb: \"select\",\n description:\n \"Choose one of this dropdown's options by its visible label, exactly as a person opening it and clicking one would. Only one option is chosen at a time, so this replaces the current choice. Returns the dropdown's state after the change, so a follow-up read is unnecessary.\",\n inputSchema: {\n type: \"object\",\n properties: {\n option: {\n type: \"string\",\n description:\n \"The visible label of the option to choose, as a person reads it in the list.\",\n },\n },\n required: [\"option\"],\n },\n readOnly: false,\n untrustedContent: true,\n registeredWhen:\n \"The dropdown is mounted, enabled, has a resolvable label, and no other component claims the same tool name. The registered schema enumerates the current option labels.\",\n unregisteredWhen: \"The dropdown unmounts or becomes disabled.\",\n};\n","import { defineAgentMeta } from \"@/agent/registry.ts\";\nimport { SELECT_OPTION_TOOL } from \"./tool.ts\";\n\nexport const selectMeta = defineAgentMeta({\n name: \"Select\",\n category: \"input\",\n summary:\n \"A dropdown of mutually exclusive options: a select-only combobox that opens a listbox on click or keyboard, carrying its own label, hint, and error. It registers a single select tool whose schema enumerates the option labels currently on offer.\",\n whenToUse:\n \"Use it when one value is chosen from a list too long to lay out flat: a region, a squad, a category. Options are data ({ value, label }), the tool accepts the visible label, and in agent view every option renders as its own control, so an agent picks one without opening anything.\",\n whenNotToUse:\n \"Do not use it for two to four short options a person should compare at a glance; that is a SegmentedControl. Do not use it for an on/off state, which is a Checkbox or a Switch, and never for navigation.\",\n status: \"experimental\",\n props: {\n label: {\n kind: \"string\",\n description:\n 'What is being chosen. Names the control for a screen reader and derives the tool name, so prefer a noun phrase such as \"Region\".',\n required: true,\n },\n options: {\n kind: \"array\",\n description:\n \"The choices in display order: { value, label, count? }. The label is what a person sees and what the select tool accepts, so an agent never has to know the value. count renders as a muted chip beside the label and reaches the agent view as part state, so never fold a count into the label.\",\n required: true,\n },\n value: {\n kind: \"string\",\n description:\n 'The value of the chosen option, or \"\" while nothing is chosen yet. The control is fully controlled.',\n required: true,\n },\n onChange: {\n kind: \"handler\",\n description:\n \"Called with the newly chosen value. The select tool clicks the real option, so this runs for agent selections too.\",\n required: true,\n },\n placeholder: {\n kind: \"string\",\n description:\n 'Shown in the closed control while value is \"\". It is not an option, so a person cannot choose it back.',\n },\n hint: {\n kind: \"string\",\n description:\n \"Guidance shown under the control and carried into the agent view. Replaced by error while one is set.\",\n },\n error: {\n kind: \"string\",\n description:\n \"A validation message. Marks the control invalid for people, screen readers, and agents alike.\",\n },\n name: {\n kind: \"string\",\n description:\n \"The form name submitted with the surrounding form, through a hidden input carrying the value.\",\n },\n disabled: {\n kind: \"boolean\",\n description: \"Disable the control and unregister its select tool.\",\n default: false,\n },\n required: {\n kind: \"boolean\",\n description: \"Mark the control required, visually and in the agent view.\",\n default: false,\n },\n agentName: {\n kind: \"string\",\n description:\n \"Override the label used to derive the tool name, when two controls on a page would otherwise collide.\",\n },\n agentTool: {\n kind: \"boolean\",\n description: \"Set false to render the control without registering a select tool.\",\n default: true,\n },\n },\n state: {\n value: {\n description: \"The value of the option currently chosen.\",\n attribute: \"data-sprint-value\",\n },\n empty: {\n description: \"Present while no option is chosen.\",\n attribute: \"data-sprint-empty\",\n },\n disabled: {\n description: \"Present when nothing can be chosen.\",\n attribute: \"data-sprint-disabled\",\n },\n required: {\n description: \"Present when a choice must be made.\",\n attribute: \"data-sprint-required\",\n },\n invalid: {\n description: \"Present while an error is set.\",\n attribute: \"data-sprint-invalid\",\n },\n active: {\n description:\n \"On an option part, present while the list is open and that option is highlighted by the keyboard or pointer.\",\n attribute: \"data-sprint-active\",\n },\n },\n tools: {\n select: SELECT_OPTION_TOOL,\n },\n agentView: {\n example:\n '- **Select** \"Region\" [value=eu-1] → tool `select-region`\\n - part `option` \"North Atlantic\" [count=12]\\n - part `option` \"Northern Europe\" [checked, count=30]\\n - part `option` \"East Asia\" [count=7]',\n },\n examples: [\n {\n title: \"A dropdown\",\n description:\n \"In agent view each option renders as its own control, so a DOM-driving agent chooses one directly.\",\n code: '<Select\\n label=\"Region\"\\n value={region}\\n onChange={setRegion}\\n placeholder=\"Choose a region\"\\n options={[\\n { value: \"na-1\", label: \"North Atlantic\" },\\n { value: \"eu-1\", label: \"Northern Europe\" },\\n { value: \"ap-1\", label: \"East Asia\" },\\n ]}\\n/>',\n },\n {\n title: \"Options with counts\",\n description:\n \"A count is data, not label text: it renders as a chip in the list and the closed control, joins the accessible name, and reaches agents as part state while the select tool still takes the plain label.\",\n code: '<Select\\n label=\"Region\"\\n value={region}\\n onChange={setRegion}\\n placeholder=\"Choose a region\"\\n options={[\\n { value: \"na-1\", label: \"North Atlantic\", count: 12 },\\n { value: \"eu-1\", label: \"Northern Europe\", count: 30 },\\n { value: \"ap-1\", label: \"East Asia\", count: 7 },\\n ]}\\n/>',\n },\n {\n title: \"A required choice with an error\",\n description:\n \"Empty plus required plus an error is how an unmade mandatory choice reads on every surface.\",\n code: '<Select\\n label=\"Launch site\"\\n value={site}\\n onChange={setSite}\\n required\\n error=\"Choose a site before continuing.\"\\n options={[\\n { value: \"ksc\", label: \"Cape Canaveral\" },\\n { value: \"vsfb\", label: \"Vandenberg\" },\\n ]}\\n/>',\n },\n {\n title: \"A disabled dropdown\",\n description:\n \"Disabled unregisters the tool, so an agent cannot choose what a person could not.\",\n code: '<Select\\n label=\"Relay\"\\n disabled\\n value=\"r-2\"\\n onChange={setRelay}\\n options={[\\n { value: \"r-1\", label: \"Relay one\" },\\n { value: \"r-2\", label: \"Relay two\" },\\n ]}\\n/>',\n },\n ],\n a11y: {\n role: \"combobox\",\n keyboard: [\n \"Enter, Space, or an arrow key opens the list\",\n \"Arrow keys, Home, and End move through the options; typing a letter jumps to the next match\",\n \"Enter or Space chooses the highlighted option\",\n \"Escape or Tab closes the list without choosing\",\n ],\n notes:\n \"A select-only combobox: a button with role combobox that opens a listbox on a plain click, so a synthetic element.click() opens it as reliably as a pointer does, and the list renders in the page rather than in browser chrome an automated session cannot see. Focus stays on the button and aria-activedescendant tracks the highlighted option. The label is linked with aria-labelledby; errors set aria-invalid and link with aria-describedby. An option with a count is named by its label and count together.\",\n },\n});\n","import {\n type ComponentPropsWithRef,\n type FocusEvent as ReactFocusEvent,\n type KeyboardEvent as ReactKeyboardEvent,\n useCallback,\n useEffect,\n useId,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { AgentControlGroup, AgentLine } from \"@/agent/view/AgentText.tsx\";\nimport { useAgentControls, useAgentFormat, useSprintView } from \"@/agent/view/mode.ts\";\nimport type { AgentPart } from \"@/agent/view/node.ts\";\nimport {\n agentAttributesFor,\n agentPartAttributesFor,\n buildAgentNode,\n} from \"@/agent/view/project.ts\";\nimport { afterCommit } from \"@/agent/webmcp/afterCommit.ts\";\nimport { commitSync } from \"@/agent/webmcp/flush.ts\";\nimport type { JsonSchemaObject } from \"@/agent/webmcp/types.ts\";\nimport { useAgentTool } from \"@/agent/webmcp/useAgentTool.ts\";\nimport { selectMeta } from \"./meta.ts\";\nimport { SELECT_OPTION_TOOL } from \"./tool.ts\";\nimport \"./Select.css\";\n\nexport interface SelectOption {\n value: string;\n label: string;\n count?: number;\n}\n\nexport interface SelectProps extends Omit<ComponentPropsWithRef<\"div\">, \"onChange\"> {\n label: string;\n options: readonly SelectOption[];\n value: string;\n onChange: (value: string) => void;\n placeholder?: string;\n hint?: string;\n error?: string;\n name?: string;\n disabled?: boolean;\n required?: boolean;\n agentName?: string;\n agentTool?: boolean;\n}\n\nconst LISTBOX_TOP = \"--sprint-select-top\";\nconst LISTBOX_LEFT = \"--sprint-select-left\";\nconst LISTBOX_WIDTH = \"--sprint-select-width\";\n\nfunction optionSchema(options: readonly SelectOption[]): JsonSchemaObject {\n const option = SELECT_OPTION_TOOL.inputSchema.properties.option;\n return {\n ...SELECT_OPTION_TOOL.inputSchema,\n properties: {\n ...SELECT_OPTION_TOOL.inputSchema.properties,\n ...(option === undefined\n ? {}\n : { option: { ...option, enum: options.map((entry) => entry.label) } }),\n },\n };\n}\n\nfunction messagePart(error: string | undefined, hint: string | undefined): AgentPart[] {\n if (error !== undefined) return [{ part: \"error\", label: error, state: {} }];\n if (hint !== undefined) return [{ part: \"hint\", label: hint, state: {} }];\n return [];\n}\n\nfunction place(listbox: HTMLElement, anchor: HTMLElement): void {\n const rect = anchor.getBoundingClientRect();\n listbox.style.setProperty(LISTBOX_TOP, `${rect.bottom}px`);\n listbox.style.setProperty(LISTBOX_LEFT, `${rect.left}px`);\n listbox.style.setProperty(LISTBOX_WIDTH, `${rect.width}px`);\n}\n\nfunction canPopover(element: HTMLElement): boolean {\n return typeof element.showPopover === \"function\";\n}\n\nfunction showLayer(listbox: HTMLElement): void {\n if (!canPopover(listbox)) return;\n if (!listbox.matches(\":popover-open\")) listbox.showPopover();\n}\n\nfunction hideLayer(listbox: HTMLElement): void {\n if (!canPopover(listbox)) return;\n if (listbox.matches(\":popover-open\")) listbox.hidePopover();\n}\n\nexport function Select(props: SelectProps) {\n const {\n label,\n options,\n value,\n onChange,\n placeholder,\n hint,\n error,\n name,\n disabled = false,\n required = false,\n agentName,\n agentTool = true,\n ...rest\n } = props;\n\n const view = useSprintView();\n const controls = useAgentControls();\n const formatter = useAgentFormat();\n const id = useId();\n\n const [open, setOpen] = useState(false);\n const [active, setActive] = useState(-1);\n\n const root = useRef<HTMLDivElement | null>(null);\n const trigger = useRef<HTMLButtonElement | null>(null);\n const listbox = useRef<HTMLDivElement | null>(null);\n const elements = useRef(new Map<string, HTMLDivElement>());\n const onChangeRef = useRef(onChange);\n onChangeRef.current = onChange;\n const optionsRef = useRef(options);\n optionsRef.current = options;\n const formatRef = useRef(formatter);\n formatRef.current = formatter;\n const nodeRef = useRef(buildAgentNode({ component: selectMeta.name }));\n const mounted = useRef(true);\n\n useEffect(() => {\n mounted.current = true;\n return () => {\n mounted.current = false;\n };\n }, []);\n\n const chosenIndex = options.findIndex((option) => option.value === value);\n const chosen = options[chosenIndex];\n\n const show = useCallback(\n (index?: number) => {\n if (disabled) return;\n setActive(index ?? Math.max(chosenIndex, 0));\n setOpen(true);\n },\n [disabled, chosenIndex],\n );\n\n const hide = useCallback(() => {\n setOpen(false);\n setActive(-1);\n }, []);\n\n useEffect(() => {\n if (disabled) hide();\n }, [disabled, hide]);\n\n useLayoutEffect(() => {\n const list = listbox.current;\n const anchor = trigger.current;\n if (list === null || anchor === null) return;\n if (!open) {\n hideLayer(list);\n return;\n }\n\n place(list, anchor);\n showLayer(list);\n\n const reposition = () => place(list, anchor);\n const dismiss = (event: Event) => {\n const target = event.target;\n if (target instanceof Node && root.current?.contains(target)) return;\n hide();\n };\n\n window.addEventListener(\"resize\", reposition);\n window.addEventListener(\"scroll\", reposition, true);\n document.addEventListener(\"pointerdown\", dismiss, true);\n return () => {\n window.removeEventListener(\"resize\", reposition);\n window.removeEventListener(\"scroll\", reposition, true);\n document.removeEventListener(\"pointerdown\", dismiss, true);\n };\n }, [open, hide]);\n\n useEffect(() => {\n if (!open || active < 0) return;\n const target = options[active];\n const element =\n target === undefined ? undefined : elements.current.get(target.value);\n if (element !== undefined && typeof element.scrollIntoView === \"function\") {\n element.scrollIntoView({ block: \"nearest\" });\n }\n }, [open, active, options]);\n\n const commit = useCallback(\n (next: string) => {\n hide();\n onChange(next);\n },\n [hide, onChange],\n );\n\n const choose = useCallback((next: string) => {\n const element = elements.current.get(next);\n if (element !== undefined) {\n element.click();\n return;\n }\n commitSync(() => onChangeRef.current(next));\n }, []);\n\n const execute = useCallback(\n async (inputs: Record<string, unknown>) => {\n const requested = typeof inputs.option === \"string\" ? inputs.option : \"\";\n const available = optionsRef.current;\n const match = available.find((entry) => entry.label === requested);\n\n if (match === undefined) {\n return `No option named \"${requested}\". This dropdown offers: ${available\n .map((entry) => `\"${entry.label}\"`)\n .join(\", \")}.`;\n }\n\n choose(match.value);\n await afterCommit();\n if (!mounted.current) return \"The selection removed this dropdown from the page.\";\n return `Selected. The dropdown is now:\\n${formatRef.current([nodeRef.current])}`;\n },\n [choose],\n );\n\n const schema = useMemo(() => optionSchema(options), [options]);\n\n const toolName = useAgentTool({\n spec: SELECT_OPTION_TOOL,\n label: agentName ?? label,\n inputSchema: schema,\n enabled: agentTool && !disabled,\n execute,\n });\n\n const optionParts: AgentPart[] = options.map((option, index) => ({\n part: \"option\",\n label: option.label,\n state: {\n ...(option.value === value ? { checked: true as const } : {}),\n ...(open && index === active ? { active: true as const } : {}),\n ...(option.count === undefined ? {} : { count: String(option.count) }),\n ...(disabled ? { disabled: true as const } : {}),\n },\n }));\n\n const node = buildAgentNode({\n component: selectMeta.name,\n label,\n tool: toolName,\n state: {\n ...(chosen === undefined ? {} : { value }),\n empty: chosen === undefined,\n disabled,\n required,\n invalid: error !== undefined,\n },\n parts: [...optionParts, ...messagePart(error, hint)],\n });\n nodeRef.current = node;\n\n if (view === \"agent\") {\n if (disabled || controls === \"never\") return <AgentLine node={node} />;\n return (\n <AgentControlGroup\n node={node}\n isActionable={(part) => part.part === \"option\"}\n onActivate={(_part, index) => {\n const target = options[index];\n if (target !== undefined) choose(target.value);\n }}\n />\n );\n }\n\n const labelId = `${id}-label`;\n const listId = `${id}-listbox`;\n const optionId = (index: number) => `${id}-option-${index}`;\n const messageId =\n error !== undefined ? `${id}-error` : hint !== undefined ? `${id}-hint` : undefined;\n\n const typeahead = (key: string): number => {\n const start = active < 0 ? chosenIndex : active;\n const lowered = key.toLowerCase();\n for (let step = 1; step <= options.length; step += 1) {\n const index = (start + step + options.length) % options.length;\n if (options[index]?.label.toLowerCase().startsWith(lowered)) return index;\n }\n return -1;\n };\n\n const onKeyDown = (event: ReactKeyboardEvent<HTMLButtonElement>) => {\n const last = options.length - 1;\n const key = event.key;\n\n if (!open) {\n if (key === \"ArrowDown\" || key === \"ArrowUp\" || key === \"Enter\" || key === \" \") {\n event.preventDefault();\n show();\n return;\n }\n if (key === \"Home\" || key === \"End\") {\n event.preventDefault();\n show(key === \"Home\" ? 0 : last);\n return;\n }\n if (key.length === 1 && !event.altKey && !event.ctrlKey && !event.metaKey) {\n const match = typeahead(key);\n if (match >= 0) show(match);\n }\n return;\n }\n\n if (key === \"Escape\" || key === \"Tab\") {\n if (key === \"Escape\") event.preventDefault();\n hide();\n return;\n }\n if (key === \"Enter\" || key === \" \") {\n event.preventDefault();\n const target = options[active];\n if (target !== undefined) commit(target.value);\n else hide();\n return;\n }\n if (key === \"ArrowDown\" || key === \"ArrowUp\" || key === \"Home\" || key === \"End\") {\n event.preventDefault();\n const next =\n key === \"Home\"\n ? 0\n : key === \"End\"\n ? last\n : key === \"ArrowDown\"\n ? Math.min(active + 1, last)\n : Math.max(active - 1, 0);\n setActive(next);\n return;\n }\n if (key.length === 1 && !event.altKey && !event.ctrlKey && !event.metaKey) {\n const match = typeahead(key);\n if (match >= 0) setActive(match);\n }\n };\n\n const onKeyUp = (event: ReactKeyboardEvent<HTMLButtonElement>) => {\n if (event.key === \" \") event.preventDefault();\n };\n\n const onBlur = (event: ReactFocusEvent<HTMLButtonElement>) => {\n const next = event.relatedTarget;\n if (next instanceof Node && root.current?.contains(next)) return;\n hide();\n };\n\n return (\n <div\n {...rest}\n {...agentAttributesFor(node)}\n ref={(target) => {\n root.current = target;\n const forwarded = rest.ref;\n if (typeof forwarded === \"function\") forwarded(target);\n else if (forwarded !== null && forwarded !== undefined)\n forwarded.current = target;\n }}\n >\n <label id={labelId} htmlFor={id}>\n {label}\n </label>\n <span {...agentPartAttributesFor({ part: \"control\", state: {} })}>\n <button\n id={id}\n type=\"button\"\n role=\"combobox\"\n {...agentPartAttributesFor({ part: \"input\", state: {} })}\n ref={(target) => {\n trigger.current = target;\n }}\n disabled={disabled}\n aria-labelledby={labelId}\n aria-haspopup=\"listbox\"\n aria-expanded={open}\n aria-controls={listId}\n aria-activedescendant={open && active >= 0 ? optionId(active) : undefined}\n aria-required={required || undefined}\n aria-invalid={error !== undefined || undefined}\n aria-describedby={messageId}\n onClick={() => (open ? hide() : show())}\n onKeyDown={onKeyDown}\n onKeyUp={onKeyUp}\n onBlur={onBlur}\n >\n <span>{chosen === undefined ? (placeholder ?? \"Choose\") : chosen.label}</span>\n {chosen?.count === undefined ? null : (\n <span aria-hidden=\"true\">{chosen.count}</span>\n )}\n </button>\n <div\n id={listId}\n role=\"listbox\"\n aria-labelledby={labelId}\n tabIndex={-1}\n popover=\"manual\"\n hidden={!open}\n ref={listbox}\n onMouseDown={(event) => event.preventDefault()}\n >\n {options.map((option, index) => {\n const textId = `${optionId(index)}-label`;\n const countId = `${optionId(index)}-count`;\n return (\n // biome-ignore lint/a11y/useKeyWithClickEvents: focus stays on the combobox, whose keydown handler drives these options through aria-activedescendant\n <div\n key={option.value}\n id={optionId(index)}\n role=\"option\"\n tabIndex={-1}\n aria-selected={option.value === value}\n aria-labelledby={\n option.count === undefined ? undefined : `${textId} ${countId}`\n }\n ref={(element) => {\n if (element === null) elements.current.delete(option.value);\n else elements.current.set(option.value, element);\n }}\n {...agentPartAttributesFor(\n optionParts[index] ?? { part: \"option\", state: {} },\n )}\n onPointerMove={() => {\n if (index !== active) setActive(index);\n }}\n onClick={() => {\n commit(option.value);\n if (open) trigger.current?.focus();\n }}\n >\n <span id={textId}>{option.label}</span>\n {option.count === undefined ? null : (\n <span id={countId} aria-hidden=\"true\">\n {option.count}\n </span>\n )}\n </div>\n );\n })}\n </div>\n </span>\n {name === undefined ? null : (\n <input type=\"hidden\" name={name} value={chosen === undefined ? \"\" : value} />\n )}\n {error !== undefined ? (\n <p id={messageId} {...agentPartAttributesFor({ part: \"error\", state: {} })}>\n {error}\n </p>\n ) : hint !== undefined ? (\n <p id={messageId} {...agentPartAttributesFor({ part: \"hint\", state: {} })}>\n {hint}\n </p>\n ) : null}\n </div>\n );\n}\n","import { defineAgentMeta } from \"@/agent/registry.ts\";\n\nexport const shellMeta = defineAgentMeta({\n name: \"Shell\",\n category: \"layout\",\n summary:\n \"The page-level frame: a sidebar and a main content region, with the landmark wiring done once. On a phone the sidebar becomes a drawer behind a menu button.\",\n whenToUse:\n \"Use it once, at the root of an app view. Put the brand in bar, a Nav in side, and the page in children. It renders the main and complementary landmarks, a skip-to-content control for keyboard users, and the mobile drawer behaviour, so none of that is rebuilt per app. Like Stack it is silent in agent view: its regions speak for themselves.\",\n whenNotToUse:\n \"Do not use it inside another Shell, or anywhere below the top of the page; a region within a page is a Panel. Do not use it just to put two columns next to each other; that is Stack.\",\n status: \"experimental\",\n props: {\n children: {\n kind: \"node\",\n description: \"The page content. Rendered inside the main landmark.\",\n required: true,\n },\n side: {\n kind: \"node\",\n description:\n \"The sidebar content, usually a Nav. On narrow viewports it becomes the drawer behind the menu button, and the drawer closes itself when a link inside it is followed.\",\n },\n bar: {\n kind: \"node\",\n description:\n \"What stays visible when the sidebar collapses to a top bar: typically the brand link. The menu button renders next to it automatically.\",\n },\n sideLabel: {\n kind: \"string\",\n description: \"Accessible name for the sidebar landmark.\",\n default: \"Sidebar\",\n },\n skipLabel: {\n kind: \"string\",\n description:\n \"Text of the skip control that moves focus to the main region. Visually hidden until focused.\",\n default: \"Skip to content\",\n },\n menuLabel: {\n kind: \"string\",\n description: \"Label of the drawer button while the drawer is closed.\",\n default: \"Menu\",\n },\n closeLabel: {\n kind: \"string\",\n description: \"Label of the drawer button while the drawer is open.\",\n default: \"Close\",\n },\n collapsible: {\n kind: \"boolean\",\n description:\n \"Lets a person hide the sidebar on wide viewports too. A second toggle appears beside the bar there, and while collapsed the page takes the narrow layout: the bar runs across the top and the sidebar is gone until it is shown again.\",\n default: false,\n },\n collapsed: {\n kind: \"boolean\",\n description:\n \"Whether the sidebar is collapsed on wide viewports, when the owner keeps that state. Pair it with onCollapsedChange.\",\n },\n defaultCollapsed: {\n kind: \"boolean\",\n description:\n \"Whether a collapsible sidebar starts collapsed when the Shell keeps its own state.\",\n default: false,\n },\n onCollapsedChange: {\n kind: \"handler\",\n description:\n \"Called with the collapsed state the Shell wants. Use it to remember the choice across visits.\",\n },\n hideLabel: {\n kind: \"string\",\n description: \"Label of the wide-viewport toggle while the sidebar is shown.\",\n default: \"Hide menu\",\n },\n showLabel: {\n kind: \"string\",\n description: \"Label of the wide-viewport toggle while the sidebar is collapsed.\",\n default: \"Show menu\",\n },\n },\n state: {\n collapsed: {\n description:\n \"Present while a collapsible sidebar is hidden on wide viewports. Narrow viewports ignore it and keep the drawer.\",\n attribute: \"data-sprint-collapsed\",\n },\n open: {\n description:\n \"Present while the mobile drawer is open. On wide viewports the sidebar is always visible and this state is inert.\",\n attribute: \"data-sprint-open\",\n },\n },\n a11y: {\n notes:\n \"Renders the only main element and an aside named by sideLabel, so the page has its landmarks without any consumer wiring. The first focusable element is a skip control that moves focus to main without touching the URL, which keeps it safe in hash-routed apps. The drawer button carries aria-expanded and aria-controls.\",\n },\n relatedComponents: [\"Nav\", \"Panel\", \"Stack\"],\n examples: [\n {\n title: \"A sidebar app shell\",\n description:\n \"One Shell per view. The sidebar collapses to a top bar with a drawer on narrow screens, and an agent reading the page sees the nav and the content with no frame in between.\",\n code: '<Shell\\n bar={<Link href=\"#/\">ACME</Link>}\\n side={\\n <Nav label=\"Main\">\\n <Link href=\"#/reports\" active>Reports</Link>\\n <Link href=\"#/settings\">Settings</Link>\\n </Nav>\\n }\\n>\\n <Panel label=\"Reports\" headingLevel={2}>\\n <Text>Quarterly numbers land here.</Text>\\n </Panel>\\n</Shell>',\n },\n {\n title: \"A sidebar that can be hidden\",\n description:\n \"With collapsible, a person can put the sidebar away on a wide screen as well as a narrow one, and get the full width for the page.\",\n code: '<Shell\\n collapsible\\n bar={<Link href=\"#/\">ACME</Link>}\\n side={\\n <Nav label=\"Main\">\\n <Link href=\"#/reports\" active>Reports</Link>\\n <Link href=\"#/settings\">Settings</Link>\\n </Nav>\\n }\\n>\\n <Text>Quarterly numbers land here.</Text>\\n</Shell>',\n },\n ],\n});\n","import {\n type ComponentPropsWithRef,\n type MouseEvent,\n type ReactNode,\n useCallback,\n useId,\n useRef,\n useState,\n} from \"react\";\nimport { useSprintView } from \"@/agent/view/mode.ts\";\nimport { agentAttributesFor, buildAgentNode } from \"@/agent/view/project.ts\";\nimport { Button } from \"../Button/index.ts\";\nimport { shellMeta } from \"./meta.ts\";\nimport \"./Shell.css\";\n\nexport interface ShellProps extends ComponentPropsWithRef<\"div\"> {\n side?: ReactNode;\n bar?: ReactNode;\n sideLabel?: string;\n skipLabel?: string;\n menuLabel?: string;\n closeLabel?: string;\n collapsible?: boolean;\n collapsed?: boolean;\n defaultCollapsed?: boolean;\n onCollapsedChange?: (collapsed: boolean) => void;\n hideLabel?: string;\n showLabel?: string;\n}\n\nexport function Shell(props: ShellProps) {\n const {\n side,\n bar,\n sideLabel = \"Sidebar\",\n skipLabel = \"Skip to content\",\n menuLabel = \"Menu\",\n closeLabel = \"Close\",\n collapsible = false,\n collapsed: controlled,\n defaultCollapsed = false,\n onCollapsedChange,\n hideLabel = \"Hide menu\",\n showLabel = \"Show menu\",\n children,\n ...rest\n } = props;\n\n const view = useSprintView();\n const [open, setOpen] = useState(false);\n const [held, setHeld] = useState(defaultCollapsed);\n const collapsed = collapsible && (controlled ?? held);\n const drawerId = useId();\n const main = useRef<HTMLElement | null>(null);\n\n const closeOnNavigate = useCallback((event: MouseEvent<HTMLDivElement>) => {\n const target = event.target;\n if (target instanceof Element && target.closest(\"a\") !== null) setOpen(false);\n }, []);\n\n const node = buildAgentNode({\n component: shellMeta.name,\n region: true,\n state: { open, collapsed },\n });\n\n if (view === \"agent\") {\n return (\n <>\n {bar}\n {side}\n {children}\n </>\n );\n }\n\n return (\n <div {...rest} {...agentAttributesFor(node)}>\n <button type=\"button\" onClick={() => main.current?.focus()}>\n {skipLabel}\n </button>\n <aside aria-label={sideLabel}>\n <div>\n {bar}\n <span>\n <Button\n agentTool={false}\n aria-expanded={open}\n aria-controls={drawerId}\n onClick={() => setOpen(!open)}\n >\n {open ? closeLabel : menuLabel}\n </Button>\n {collapsible ? (\n <Button\n agentTool={false}\n aria-expanded={!collapsed}\n aria-controls={drawerId}\n onClick={() => {\n setHeld(!collapsed);\n onCollapsedChange?.(!collapsed);\n }}\n >\n {collapsed ? showLabel : hideLabel}\n </Button>\n ) : null}\n </span>\n </div>\n {/* biome-ignore lint/a11y/useKeyWithClickEvents: closing the drawer after a click on a link inside it; the links handle their own keyboard interaction */}\n {/* biome-ignore lint/a11y/noStaticElementInteractions: same delegation, the div itself is not a control */}\n <div id={drawerId} onClick={closeOnNavigate}>\n {side}\n </div>\n </aside>\n <main ref={main} tabIndex={-1}>\n {children}\n </main>\n </div>\n );\n}\n","import { defineAgentMeta } from \"@/agent/registry.ts\";\n\nexport const stackMeta = defineAgentMeta({\n name: \"Stack\",\n category: \"layout\",\n summary:\n \"The one-dimensional layout primitive: a row, a column, or an auto-filling grid, with spacing drawn from the space scale. It renders a plain box and nothing else.\",\n whenToUse:\n \"Use it wherever two or more things sit next to each other. Prefer it over a bare div with inline styles so spacing stays on the scale. Stack is invisible in agent view: it emits no line, because an agent does not care how a region is arranged, only what is in it.\",\n whenNotToUse:\n 'Do not use it to draw a bordered region with a header; that is Panel. Do not nest three deep to fake a grid; use direction=\"grid\".',\n status: \"experimental\",\n props: {\n children: {\n kind: \"node\",\n description: \"The items to lay out.\",\n required: true,\n },\n direction: {\n kind: \"enum\",\n description:\n 'Axis. \"grid\" fills as many equal columns as fit, each at least min wide.',\n values: [\"row\", \"column\", \"grid\"],\n default: \"column\",\n },\n gap: {\n kind: \"enum\",\n description: \"Space between items, from the space scale.\",\n values: [\"none\", \"tight\", \"normal\", \"loose\"],\n default: \"normal\",\n },\n align: {\n kind: \"enum\",\n description: \"Cross-axis alignment.\",\n values: [\"start\", \"center\", \"end\", \"stretch\", \"baseline\"],\n },\n justify: {\n kind: \"enum\",\n description: \"Main-axis distribution.\",\n values: [\"start\", \"center\", \"end\", \"between\"],\n },\n wrap: {\n kind: \"boolean\",\n description: \"Let a row wrap onto more lines instead of overflowing.\",\n default: false,\n },\n collapse: {\n kind: \"boolean\",\n description:\n \"Stack a row into a column on narrow viewports. This is how a toolbar survives a phone.\",\n default: false,\n },\n min: {\n kind: \"enum\",\n description:\n 'Minimum track width for direction=\"grid\", from a fixed scale of rem lengths. Tracks never exceed the container. Scale values are mapped in the stylesheet through data-sprint-min, so they work under a strict Content Security Policy. Any other CSS length is still accepted as an escape hatch, but it is written to an inline style attribute, which a style-src policy without unsafe-inline blocks: under such a policy an off-scale grid falls back to one column.',\n values: [\n \"10rem\",\n \"12rem\",\n \"14rem\",\n \"16rem\",\n \"18rem\",\n \"20rem\",\n \"22rem\",\n \"24rem\",\n \"28rem\",\n \"32rem\",\n ],\n default: \"18rem\",\n },\n },\n state: {\n direction: {\n description: \"The axis in use.\",\n attribute: \"data-sprint-direction\",\n values: [\"row\", \"column\", \"grid\"],\n },\n gap: {\n description: \"The spacing step in use.\",\n attribute: \"data-sprint-gap\",\n values: [\"none\", \"tight\", \"normal\", \"loose\"],\n },\n align: {\n description: \"Cross-axis alignment, when one was asked for.\",\n attribute: \"data-sprint-align\",\n values: [\"start\", \"center\", \"end\", \"stretch\", \"baseline\"],\n },\n justify: {\n description: \"Main-axis distribution, when one was asked for.\",\n attribute: \"data-sprint-justify\",\n values: [\"start\", \"center\", \"end\", \"between\"],\n },\n wrap: {\n description: \"Present when a row is allowed to wrap.\",\n attribute: \"data-sprint-wrap\",\n },\n collapse: {\n description: \"Present when the row stacks into a column on narrow viewports.\",\n attribute: \"data-sprint-collapse\",\n },\n min: {\n description:\n 'The minimum track width in use, present only when direction=\"grid\". A value off the scale is carried here too, with the length itself in an inline style.',\n attribute: \"data-sprint-min\",\n },\n },\n examples: [\n {\n title: \"A row of actions\",\n description: \"Wrapping keeps a toolbar from overflowing on a narrow screen.\",\n code: '<Stack direction=\"row\" gap=\"tight\" wrap>\\n <Button>Cancel</Button>\\n <Button tone=\"action\">Confirm</Button>\\n</Stack>',\n },\n {\n title: \"A responsive card grid\",\n description:\n \"Tracks fill the container and never go below min, so this is one column on a phone and three on a desktop with no media query of your own.\",\n code: '<Stack direction=\"grid\" min=\"16rem\">\\n <Card label=\"Button\" href=\"#/Button\">One action.</Card>\\n <Card label=\"Table\" href=\"#/Table\">Rows and columns.</Card>\\n</Stack>',\n },\n {\n title: \"A header bar that stacks on a phone\",\n code: '<Stack direction=\"row\" justify=\"between\" align=\"center\" collapse>\\n <Heading level={1}>Button</Heading>\\n <Tag tone=\"warning\">experimental</Tag>\\n</Stack>',\n },\n ],\n});\n","import type { ComponentPropsWithRef, CSSProperties } from \"react\";\nimport { useSprintView } from \"@/agent/view/mode.ts\";\nimport { agentAttributesFor, buildAgentNode } from \"@/agent/view/project.ts\";\nimport { stackMeta } from \"./meta.ts\";\nimport \"./Stack.css\";\n\nexport type StackDirection = \"row\" | \"column\" | \"grid\";\nexport type StackGap = \"none\" | \"tight\" | \"normal\" | \"loose\";\nexport type StackAlign = \"start\" | \"center\" | \"end\" | \"stretch\" | \"baseline\";\nexport type StackJustify = \"start\" | \"center\" | \"end\" | \"between\";\n\nexport const STACK_MINS = [\n \"10rem\",\n \"12rem\",\n \"14rem\",\n \"16rem\",\n \"18rem\",\n \"20rem\",\n \"22rem\",\n \"24rem\",\n \"28rem\",\n \"32rem\",\n] as const;\n\nexport type StackMin = (typeof STACK_MINS)[number];\n\nexport interface StackProps extends ComponentPropsWithRef<\"div\"> {\n direction?: StackDirection;\n gap?: StackGap;\n align?: StackAlign;\n justify?: StackJustify;\n wrap?: boolean;\n collapse?: boolean;\n min?: StackMin | (string & Record<never, never>);\n}\n\nfunction onScale(min: string): min is StackMin {\n return (STACK_MINS as readonly string[]).includes(min);\n}\n\nfunction offScaleSizing(\n min: string,\n style: CSSProperties | undefined,\n): CSSProperties | undefined {\n if (onScale(min)) return style;\n return { ...style, \"--sprint-stack-min\": min } as CSSProperties;\n}\n\nexport function Stack(props: StackProps) {\n const {\n direction = \"column\",\n gap = \"normal\",\n align,\n justify,\n wrap = false,\n collapse = false,\n min = \"18rem\",\n children,\n style,\n ...rest\n } = props;\n\n const view = useSprintView();\n const grid = direction === \"grid\";\n\n const node = buildAgentNode({\n component: stackMeta.name,\n state: {\n direction,\n gap,\n align,\n justify,\n wrap,\n collapse,\n min: grid ? min : undefined,\n },\n });\n\n if (view === \"agent\") return <>{children}</>;\n\n return (\n <div\n {...rest}\n {...agentAttributesFor(node)}\n style={grid ? offScaleSizing(min, style) : style}\n >\n {children}\n </div>\n );\n}\n","import { defineAgentMeta } from \"@/agent/registry.ts\";\n\nexport const stepsMeta = defineAgentMeta({\n name: \"Steps\",\n category: \"display\",\n summary:\n \"An ordered set of numbered steps a person works through: each one a number badge, a short title and an optional body, with a rule between them. A step can be marked done or current, so the list doubles as a record of how far someone has got.\",\n whenToUse:\n \"Use it when the order is the instruction: a handful of things to do one after another, each worth a title of its own, like the two things to send someone or the stages of a setup. Mark the step in progress as current and the finished ones as done when the page knows; leave every state off when the steps are simply instructions. Each step is an addressable part carrying its position and state, so an agent can say which step is next without counting lines.\",\n whenNotToUse:\n \"Do not use it for a plain numbered list of short points with no titles or progress; that is List with ordered. Do not use it as a wizard that moves between screens: Steps only displays where someone is, it has no actions and registers no WebMCP tool, because there is nothing to press and an agent reads every step and its state from the agent view. Pair it with a Button when the page itself advances. Do not put components or links in a step; title and body are plain strings.\",\n status: \"experimental\",\n props: {\n label: {\n kind: \"string\",\n description:\n 'What the steps achieve, as a short phrase like \"Send Tess two things\". Names the list for a screen reader and for the agent view.',\n required: true,\n },\n steps: {\n kind: \"array\",\n description:\n 'The steps in order, each { title: string; body?: string; state?: \"done\" | \"current\" }. Title is the instruction in a few words; body is an optional sentence of detail. A step with no state is upcoming. Mark at most one step current.',\n required: true,\n },\n doneLabel: {\n kind: \"string\",\n description:\n \"What a screen reader hears as the description of a finished step, since the done mark is drawn rather than written.\",\n default: \"Done\",\n },\n emptyLabel: {\n kind: \"string\",\n description: \"What the list says when it has no steps.\",\n default: \"No steps\",\n },\n },\n state: {\n steps: {\n description: \"How many steps there are.\",\n attribute: \"data-sprint-steps\",\n },\n complete: {\n description: \"Present when every step is done.\",\n attribute: \"data-sprint-complete\",\n },\n empty: {\n description: \"Present when there are no steps.\",\n attribute: \"data-sprint-empty\",\n },\n index: {\n description:\n \"On a step: its 1-based position, which is also the number in its badge.\",\n attribute: \"data-sprint-index\",\n },\n done: {\n description: \"On a step: present once the step is finished.\",\n attribute: \"data-sprint-done\",\n },\n current: {\n description: \"On a step: present on the step in progress.\",\n attribute: \"data-sprint-current\",\n },\n },\n agentView: {\n example:\n '- **Steps** \"Send Tess two things\" [steps=2]\\n - part `step` \"Copy the link\" [index=1]\\n - part `step` \"Pass on the emoji\" [index=2]',\n },\n a11y: {\n role: \"list\",\n notes:\n 'A real ol named by its label, with an explicit list role because the drawn badges require list-style none and Safari would otherwise drop the list semantics, so the position of each step is announced. The badge number is aria-hidden for the same reason. The current step carries aria-current=\"step\", and a done step is described by doneLabel. Title and body are read as one item, separated by a colon that is hidden visually.',\n },\n relatedComponents: [\"List\", \"Progress\", \"Panel\"],\n examples: [\n {\n title: \"Send Tess two things\",\n description:\n \"The plainest case: two instructions in order, with no progress to report.\",\n code: '<Steps\\n label=\"Send Tess two things\"\\n steps={[{ title: \"Copy the link\" }, { title: \"Pass on the emoji\" }]}\\n/>',\n },\n {\n title: \"Partway through\",\n description:\n \"A finished step, the one in progress, and one still to come, each with a line of detail.\",\n code: '<Steps\\n label=\"Connect a tool\"\\n steps={[\\n {\\n title: \"Register the tool\",\\n body: \"Give it a name and an input schema.\",\\n state: \"done\",\\n },\\n {\\n title: \"Drive the DOM\",\\n body: \"Click the real element rather than calling a prop.\",\\n state: \"current\",\\n },\\n { title: \"Return the new state\", body: \"Read it back from the page.\" },\\n ]}\\n/>',\n },\n {\n title: \"Every step done\",\n description: \"When all steps are done the list publishes that it is complete.\",\n code: '<Steps\\n label=\"Send Tess two things\"\\n steps={[\\n { title: \"Copy the link\", state: \"done\" },\\n { title: \"Pass on the emoji\", state: \"done\" },\\n ]}\\n/>',\n },\n ],\n});\n","import { type ComponentPropsWithRef, useId } from \"react\";\nimport { AgentLine } from \"@/agent/view/AgentText.tsx\";\nimport { useSprintView } from \"@/agent/view/mode.ts\";\nimport type { AgentPart } from \"@/agent/view/node.ts\";\nimport {\n agentAttributesFor,\n agentPartAttributesFor,\n buildAgentNode,\n} from \"@/agent/view/project.ts\";\nimport { stepsMeta } from \"./meta.ts\";\nimport \"./Steps.css\";\n\nexport type StepState = \"done\" | \"current\";\n\nexport interface Step {\n title: string;\n body?: string;\n state?: StepState;\n}\n\nexport interface StepsProps extends Omit<ComponentPropsWithRef<\"ol\">, \"children\"> {\n label: string;\n steps: readonly Step[];\n doneLabel?: string;\n emptyLabel?: string;\n}\n\nconst SAFARI_LIST_SEMANTICS = { role: \"list\" } as const;\n\nfunction stepText(step: Step): string {\n return step.body === undefined || step.body === \"\"\n ? step.title\n : `${step.title}: ${step.body}`;\n}\n\nfunction stepPart(step: Step, index: number): AgentPart {\n return {\n part: \"step\",\n label: stepText(step),\n state: {\n index: String(index + 1),\n ...(step.state === \"done\" ? { done: true as const } : {}),\n ...(step.state === \"current\" ? { current: true as const } : {}),\n },\n };\n}\n\nexport function Steps(props: StepsProps) {\n const { label, steps, doneLabel = \"Done\", emptyLabel = \"No steps\", ...rest } = props;\n\n const view = useSprintView();\n const id = useId();\n\n const empty = steps.length === 0;\n const parts = steps.map(stepPart);\n const complete = !empty && steps.every((step) => step.state === \"done\");\n\n const node = buildAgentNode({\n component: stepsMeta.name,\n label,\n state: { steps: String(steps.length), complete, empty },\n parts,\n });\n\n if (view === \"agent\") return <AgentLine node={node} />;\n\n return (\n <ol\n {...rest}\n {...agentAttributesFor(node)}\n {...SAFARI_LIST_SEMANTICS}\n aria-label={label}\n >\n {empty ? <li>{emptyLabel}</li> : null}\n {steps.map((step, index) => {\n const part = parts[index] ?? stepPart(step, index);\n const done = step.state === \"done\";\n const descriptionId = `${id}-${index}-done`;\n return (\n <li\n key={`${index}-${step.title}`}\n {...agentPartAttributesFor(part)}\n aria-current={step.state === \"current\" ? \"step\" : undefined}\n aria-describedby={done ? descriptionId : undefined}\n >\n <span aria-hidden=\"true\">{index + 1}</span>\n <div>\n <strong>{step.title}</strong>\n {step.body === undefined || step.body === \"\" ? null : (\n <>\n <span>: </span>\n <p>{step.body}</p>\n </>\n )}\n </div>\n {done ? (\n <span id={descriptionId} hidden>\n {doneLabel}\n </span>\n ) : null}\n </li>\n );\n })}\n </ol>\n );\n}\n","import type { AgentToolSpec } from \"@/agent/types.ts\";\n\nexport const SET_SWITCH_TOOL: AgentToolSpec = {\n verb: \"set\",\n description:\n \"Switch this setting on or off by stating the end state, exactly as a person clicking it would. The change takes effect immediately. Setting the state it already has succeeds and changes nothing, so the call is safe to retry. Returns the switch's state after the call.\",\n inputSchema: {\n type: \"object\",\n properties: {\n on: {\n type: \"boolean\",\n description: \"The end state: true leaves the switch on, false leaves it off.\",\n },\n },\n required: [\"on\"],\n },\n readOnly: false,\n untrustedContent: true,\n registeredWhen:\n \"The switch is mounted, enabled, has a resolvable label, and no other component claims the same tool name.\",\n unregisteredWhen: \"The switch unmounts or becomes disabled.\",\n};\n","import { defineAgentMeta } from \"@/agent/registry.ts\";\nimport { SET_SWITCH_TOOL } from \"./tool.ts\";\n\nexport const switchMeta = defineAgentMeta({\n name: \"Switch\",\n category: \"input\",\n summary:\n \"An on/off setting that takes effect the moment it changes. It registers one set tool that takes the end state rather than toggling.\",\n whenToUse:\n \"Use it for a live setting: enabling telemetry, muting alerts, switching a feed. The set tool takes on as true or false, so an agent states the end state and never has to read before writing.\",\n whenNotToUse:\n \"Do not use it for a boolean a form will submit later; that is a Checkbox, and the distinction is when the change takes effect. Do not use it to choose between two named modes a person should see side by side, which is a SegmentedControl.\",\n status: \"experimental\",\n props: {\n label: {\n kind: \"string\",\n description:\n 'What the setting controls. Names the switch for a screen reader and derives the tool name, so prefer a noun phrase such as \"Live telemetry\".',\n required: true,\n },\n on: {\n kind: \"boolean\",\n description: \"Whether the setting is on. The switch is fully controlled.\",\n required: true,\n },\n onChange: {\n kind: \"handler\",\n description:\n \"Called with the new state. The set tool drives a real click, so this runs for agent changes too.\",\n required: true,\n },\n disabled: {\n kind: \"boolean\",\n description: \"Disable the switch and unregister its set tool.\",\n default: false,\n },\n agentName: {\n kind: \"string\",\n description:\n \"Override the label used to derive the tool name, when two switches on a page would otherwise collide.\",\n },\n agentTool: {\n kind: \"boolean\",\n description: \"Set false to render the switch without registering a set tool.\",\n default: true,\n },\n },\n state: {\n on: {\n description: \"Present while the setting is on.\",\n attribute: \"data-sprint-on\",\n },\n disabled: {\n description: \"Present when the switch cannot be changed.\",\n attribute: \"data-sprint-disabled\",\n },\n },\n tools: {\n set: SET_SWITCH_TOOL,\n },\n agentView: {\n example: '- **Switch** \"Live telemetry\" [on] → tool `set-live-telemetry`',\n },\n examples: [\n {\n title: \"A live setting\",\n description:\n \"In agent view the switch renders as one control; pressing it toggles, while the set tool states the end state.\",\n code: '<Switch label=\"Live telemetry\" on={telemetry} onChange={setTelemetry} />',\n },\n {\n title: \"A disabled switch\",\n description:\n \"Disabled unregisters the tool, so an agent cannot change what a person could not.\",\n code: '<Switch label=\"Ground link\" on disabled onChange={setLink} />',\n },\n ],\n a11y: {\n role: \"switch\",\n keyboard: [\"Space toggles\", \"Enter toggles\"],\n notes:\n \"A button with role switch and aria-checked, so the label and state read together. The thumb moves by a single-axis stepped translation and respects prefers-reduced-motion.\",\n },\n});\n","import { type ComponentPropsWithRef, useCallback, useEffect, useRef } from \"react\";\nimport { AgentControl, AgentLine } from \"@/agent/view/AgentText.tsx\";\nimport { useAgentControls, useAgentFormat, useSprintView } from \"@/agent/view/mode.ts\";\nimport {\n agentAttributesFor,\n agentPartAttributesFor,\n buildAgentNode,\n} from \"@/agent/view/project.ts\";\nimport { afterCommit } from \"@/agent/webmcp/afterCommit.ts\";\nimport { commitSync } from \"@/agent/webmcp/flush.ts\";\nimport { useAgentTool } from \"@/agent/webmcp/useAgentTool.ts\";\nimport { switchMeta } from \"./meta.ts\";\nimport { SET_SWITCH_TOOL } from \"./tool.ts\";\nimport \"./Switch.css\";\n\nexport interface SwitchProps\n extends Omit<ComponentPropsWithRef<\"button\">, \"onChange\" | \"children\"> {\n label: string;\n on: boolean;\n onChange: (on: boolean) => void;\n agentName?: string;\n agentTool?: boolean;\n}\n\nexport function Switch(props: SwitchProps) {\n const {\n label,\n on,\n onChange,\n disabled = false,\n agentName,\n agentTool = true,\n ref,\n ...rest\n } = props;\n\n const view = useSprintView();\n const controls = useAgentControls();\n const formatter = useAgentFormat();\n\n const element = useRef<HTMLButtonElement | null>(null);\n const setRef = useCallback(\n (target: HTMLButtonElement | null) => {\n element.current = target;\n if (typeof ref === \"function\") ref(target);\n else if (ref !== null && ref !== undefined) ref.current = target;\n },\n [ref],\n );\n\n const onChangeRef = useRef(onChange);\n onChangeRef.current = onChange;\n const onRef = useRef(on);\n onRef.current = on;\n const formatRef = useRef(formatter);\n formatRef.current = formatter;\n const nodeRef = useRef(buildAgentNode({ component: switchMeta.name }));\n const mounted = useRef(true);\n\n useEffect(() => {\n mounted.current = true;\n return () => {\n mounted.current = false;\n };\n }, []);\n\n const execute = useCallback(async (inputs: Record<string, unknown>) => {\n const desired = inputs.on;\n if (typeof desired !== \"boolean\") {\n return 'Pass \"on\" as true or false; it states the end state.';\n }\n\n const already = desired === onRef.current;\n if (!already) {\n const target = element.current;\n if (target !== null) target.click();\n else commitSync(() => onChangeRef.current(desired));\n }\n\n await afterCommit();\n if (!mounted.current) return \"The change removed this switch from the page.\";\n const outcome = already\n ? `Already ${desired ? \"on\" : \"off\"}`\n : `Switched ${desired ? \"on\" : \"off\"}`;\n return `${outcome}. The switch is now:\\n${formatRef.current([nodeRef.current])}`;\n }, []);\n\n const toolName = useAgentTool({\n spec: SET_SWITCH_TOOL,\n label: agentName ?? label,\n enabled: agentTool && !disabled,\n execute,\n });\n\n const node = buildAgentNode({\n component: switchMeta.name,\n label,\n tool: toolName,\n state: { on, disabled },\n });\n nodeRef.current = node;\n\n if (view === \"agent\") {\n if (disabled || controls === \"never\") return <AgentLine node={node} />;\n return <AgentControl node={node} ref={setRef} onClick={() => onChange(!on)} />;\n }\n\n return (\n <button\n {...rest}\n {...agentAttributesFor(node)}\n type=\"button\"\n role=\"switch\"\n aria-checked={on}\n disabled={disabled}\n ref={setRef}\n onClick={() => onChange(!on)}\n >\n <span\n {...agentPartAttributesFor({ part: \"track\", state: {} })}\n aria-hidden=\"true\"\n >\n <span {...agentPartAttributesFor({ part: \"thumb\", state: {} })} />\n </span>\n {label}\n </button>\n );\n}\n","import { defineAgentMeta } from \"@/agent/registry.ts\";\n\nexport const tableMeta = defineAgentMeta({\n name: \"Table\",\n category: \"display\",\n summary:\n \"A data grid built from columns and rows rather than from markup. In the agent stream it reads as a compact Markdown table; in the DOM each cell is addressable as a part carrying its column and row. On a narrow screen every row restacks into a labelled block instead of scrolling sideways.\",\n whenToUse:\n \"Use it for any set of records with the same shape: props, attributes, conventions, results. Passing data instead of children is what lets the agent view carry the cells and the human view restack them on a phone.\",\n whenNotToUse:\n \"Do not use it for page layout; that is Stack. Do not put components in cells: cells are flattened to text for the agent view, so a Button inside one would lose its tool.\",\n status: \"experimental\",\n props: {\n label: {\n kind: \"string\",\n description:\n \"What this table is a table of. Used as its accessible name and read back by the agent view.\",\n required: true,\n },\n columns: {\n kind: \"array\",\n description:\n \"Column definitions, in display order: { key, header, align?, width? }. The key addresses the cell in each row and appears on the cell as data-sprint-column. width is one of 4rem, 5rem, 6rem, 7rem, 8rem, 9rem, 10rem, 12rem, 14rem, 16rem, 20rem, or 24rem, mapped in the stylesheet through data-sprint-width on the header cell so it works under a strict Content Security Policy; any other CSS length is still accepted but is written to an inline style attribute, which a style-src policy without unsafe-inline blocks.\",\n required: true,\n },\n rows: {\n kind: \"array\",\n description:\n \"Rows in display order: { id?, cells }, where cells maps a column key to inline content. id names the row for an agent and defaults to its 1-based position.\",\n required: true,\n },\n emptyLabel: {\n kind: \"string\",\n description: \"What the table says when it has no rows.\",\n default: \"No rows\",\n },\n loading: {\n kind: \"boolean\",\n description:\n \"Set while the rows are being fetched. Sets aria-busy and sweeps a bar along the top edge. Existing rows stay visible; with none yet, the empty slot says loadingLabel instead of emptyLabel.\",\n default: false,\n },\n loadingLabel: {\n kind: \"string\",\n description: \"What the empty slot says while loading.\",\n default: \"Loading\",\n },\n },\n state: {\n columns: {\n description: \"How many columns the table has.\",\n attribute: \"data-sprint-columns\",\n },\n rows: {\n description: \"How many rows the table currently has.\",\n attribute: \"data-sprint-rows\",\n },\n empty: {\n description: \"Present when the table has no rows.\",\n attribute: \"data-sprint-empty\",\n },\n loading: {\n description:\n \"Present while the rows are being fetched. Alongside empty it means nothing has arrived yet, not that there is nothing.\",\n attribute: \"data-sprint-loading\",\n },\n column: {\n description: \"On a cell: which column it belongs to.\",\n attribute: \"data-sprint-column\",\n },\n row: {\n description: \"On a cell: which row it belongs to.\",\n attribute: \"data-sprint-row\",\n },\n width: {\n description:\n \"On a column header: the width its column asked for, if any. A value off the scale is carried here too, with the length itself in an inline style.\",\n attribute: \"data-sprint-width\",\n },\n align: {\n description: \"On a cell: the alignment its column asked for, if any.\",\n attribute: \"data-sprint-align\",\n values: [\"start\", \"end\"],\n },\n },\n agentView: {\n example:\n '- **Table** \"Props\" [columns=2, rows=1]\\n | row | prop | kind |\\n | --- | --- | --- |\\n | tone | tone | enum |',\n },\n examples: [\n {\n title: \"A reference table\",\n description:\n 'Cells are addressable: [data-sprint-part=\"cell\"][data-sprint-column=\"kind\"] selects a column without knowing anything about the markup.',\n code: '<Table\\n label=\"Props\"\\n columns={[\\n { key: \"prop\", header: \"Prop\" },\\n { key: \"kind\", header: \"Kind\" },\\n ]}\\n rows={[{ id: \"tone\", cells: { prop: <code>tone</code>, kind: \"enum\" } }]}\\n/>',\n },\n {\n title: \"A table with no rows\",\n description:\n \"An empty table keeps its header and says so, rather than rendering a bare keyline.\",\n code: '<Table\\n label=\"Registered tools\"\\n emptyLabel=\"No tools registered\"\\n columns={[{ key: \"name\", header: \"Name\" }]}\\n rows={[]}\\n/>',\n },\n {\n title: \"A table while fetching\",\n description:\n \"Before the first rows arrive the table reads [empty, loading], so an agent waits rather than concluding there is nothing.\",\n code: '<Table\\n label=\"Loadouts\"\\n loading={isFetching}\\n columns={[{ key: \"name\", header: \"Name\" }]}\\n rows={loadouts ?? []}\\n/>',\n },\n ],\n a11y: {\n role: \"table\",\n notes:\n \"Column headers keep scope=col in every layout. On narrow screens each cell repeats its column header visually, marked aria-hidden so the real header association is not announced twice.\",\n },\n});\n","import type { ComponentPropsWithRef, CSSProperties, ReactNode } from \"react\";\nimport { AgentLine } from \"@/agent/view/AgentText.tsx\";\nimport { useSprintView } from \"@/agent/view/mode.ts\";\nimport type { AgentPart } from \"@/agent/view/node.ts\";\nimport {\n agentAttributesFor,\n agentPartAttributesFor,\n buildAgentNode,\n} from \"@/agent/view/project.ts\";\nimport { condenseCells } from \"@/agent/view/tabular.ts\";\nimport { reactText } from \"@/agent/view/text.ts\";\nimport { tableMeta } from \"./meta.ts\";\nimport \"./Table.css\";\n\nexport const TABLE_WIDTHS = [\n \"4rem\",\n \"5rem\",\n \"6rem\",\n \"7rem\",\n \"8rem\",\n \"9rem\",\n \"10rem\",\n \"12rem\",\n \"14rem\",\n \"16rem\",\n \"20rem\",\n \"24rem\",\n] as const;\n\nexport type TableWidth = (typeof TABLE_WIDTHS)[number];\n\nexport interface TableColumn {\n key: string;\n header: string;\n align?: \"start\" | \"end\";\n width?: TableWidth | (string & Record<never, never>);\n}\n\nexport interface TableRow {\n id?: string;\n cells: Record<string, ReactNode>;\n}\n\nexport interface TableProps extends ComponentPropsWithRef<\"table\"> {\n label: string;\n columns: readonly TableColumn[];\n rows: readonly TableRow[];\n emptyLabel?: string;\n loading?: boolean;\n loadingLabel?: string;\n}\n\nfunction onScale(width: string): width is TableWidth {\n return (TABLE_WIDTHS as readonly string[]).includes(width);\n}\n\nfunction offScaleWidth(width: string | undefined): CSSProperties | undefined {\n if (width === undefined || onScale(width)) return undefined;\n return { width };\n}\n\nfunction rowId(row: TableRow, index: number): string {\n return row.id ?? String(index + 1);\n}\n\nfunction cellState(column: TableColumn, row: string): Record<string, string> {\n return {\n column: column.key,\n row,\n ...(column.align === undefined ? {} : { align: column.align }),\n };\n}\n\nfunction cellParts(\n columns: readonly TableColumn[],\n rows: readonly TableRow[],\n): AgentPart[] {\n return rows.flatMap((row, index) =>\n columns.map((column) => {\n const label = reactText(row.cells[column.key]);\n return {\n part: \"cell\",\n state: cellState(column, rowId(row, index)),\n ...(label === undefined ? {} : { label }),\n };\n }),\n );\n}\n\nexport function Table(props: TableProps) {\n const {\n label,\n columns,\n rows,\n emptyLabel = \"No rows\",\n loading = false,\n loadingLabel = \"Loading\",\n ...rest\n } = props;\n\n const view = useSprintView();\n const empty = rows.length === 0;\n\n const node = buildAgentNode({\n component: tableMeta.name,\n label,\n state: {\n columns: String(columns.length),\n rows: String(rows.length),\n empty,\n loading,\n },\n parts: cellParts(columns, rows),\n });\n\n if (view === \"agent\") return <AgentLine node={condenseCells(node)} />;\n\n return (\n <table\n {...rest}\n {...agentAttributesFor(node)}\n role=\"table\"\n aria-label={label}\n aria-busy={loading || undefined}\n >\n <thead role=\"rowgroup\">\n <tr role=\"row\">\n {columns.map((column) => (\n <th\n key={column.key}\n role=\"columnheader\"\n scope=\"col\"\n data-sprint-column={column.key}\n data-sprint-width={column.width}\n style={offScaleWidth(column.width)}\n >\n {column.header}\n </th>\n ))}\n </tr>\n </thead>\n <tbody role=\"rowgroup\">\n {empty ? (\n <tr role=\"row\">\n <td role=\"cell\" colSpan={columns.length}>\n <span>{loading ? loadingLabel : emptyLabel}</span>\n </td>\n </tr>\n ) : (\n rows.map((row, index) => (\n <tr key={rowId(row, index)} role=\"row\">\n {columns.map((column) => (\n <td\n key={column.key}\n role=\"cell\"\n {...agentPartAttributesFor({\n part: \"cell\",\n state: cellState(column, rowId(row, index)),\n })}\n >\n <span aria-hidden=\"true\">{column.header}</span>\n <div>{row.cells[column.key]}</div>\n </td>\n ))}\n </tr>\n ))\n )}\n </tbody>\n </table>\n );\n}\n","import { defineAgentMeta } from \"@/agent/registry.ts\";\n\nexport const textMeta = defineAgentMeta({\n name: \"Text\",\n category: \"typography\",\n summary:\n \"A run of prose, sized and toned from the semantic scale. In agent view it renders as its own text content, so an agent reads the words rather than inferring them from styling.\",\n whenToUse:\n 'Use it for every paragraph, caption, note, and inline status line, so tone carries meaning instead of an ad-hoc colour. tone=\"muted\" is the small print under a heading, tone=\"warning\" and tone=\"danger\" state that something is wrong, and tone=\"action\" confirms something is live.',\n whenNotToUse:\n \"Do not use it for a section title; that is Heading. Do not put components inside it: it flattens its children to a single string for the agent view, so a nested Button would lose its tool.\",\n status: \"experimental\",\n props: {\n children: {\n kind: \"node\",\n description:\n \"The prose. Inline markup such as code or strong is fine; components are not.\",\n required: true,\n },\n tone: {\n kind: \"enum\",\n description:\n \"What the text means, not just how it looks. Agents read this off the attribute.\",\n values: [\"default\", \"muted\", \"action\", \"info\", \"warning\", \"danger\"],\n default: \"default\",\n },\n size: {\n kind: \"enum\",\n description:\n 'Type size. \"small\" is the annotation size used for notes and captions.',\n values: [\"small\", \"normal\"],\n default: \"normal\",\n },\n as: {\n kind: \"enum\",\n description:\n \"The element to render. Use span when the text sits inside another line of text.\",\n values: [\"p\", \"span\", \"div\"],\n default: \"p\",\n },\n },\n state: {\n tone: {\n description: \"What the text is saying about the thing it describes.\",\n attribute: \"data-sprint-tone\",\n values: [\"default\", \"muted\", \"action\", \"info\", \"warning\", \"danger\"],\n },\n size: {\n description: \"The type size in use.\",\n attribute: \"data-sprint-size\",\n values: [\"small\", \"normal\"],\n },\n },\n agentView: {\n example: '- **Text** \"Tools stay registered across a view switch.\" [tone=muted]',\n },\n examples: [\n {\n title: \"A lede\",\n code: \"<Text>Every component renders normally for people and as text for agents.</Text>\",\n },\n {\n title: \"A note under a heading\",\n description: \"The small print that would otherwise be an untyped grey span.\",\n code: '<Text tone=\"muted\" size=\"small\">Registered while the button is enabled.</Text>',\n },\n {\n title: \"A live status line\",\n description:\n \"Tone is the whole message here, so an agent reading the attribute learns the same thing a person learns from the colour.\",\n code: '<Text tone={ready ? \"action\" : \"warning\"} size=\"small\">\\n {ready ? \"WebMCP is available in this browser.\" : \"WebMCP is unavailable here.\"}\\n</Text>',\n },\n ],\n});\n","import type { ComponentPropsWithRef, Ref } from \"react\";\nimport { AgentLine } from \"@/agent/view/AgentText.tsx\";\nimport { useSprintView } from \"@/agent/view/mode.ts\";\nimport { agentAttributesFor, buildAgentNode } from \"@/agent/view/project.ts\";\nimport { reactText } from \"@/agent/view/text.ts\";\nimport { textMeta } from \"./meta.ts\";\nimport \"./Text.css\";\n\nexport type TextTone = \"default\" | \"muted\" | \"action\" | \"info\" | \"warning\" | \"danger\";\n\nexport type TextSize = \"small\" | \"normal\";\n\nexport interface TextProps extends Omit<ComponentPropsWithRef<\"p\">, \"ref\"> {\n tone?: TextTone;\n size?: TextSize;\n as?: \"p\" | \"span\" | \"div\";\n ref?: Ref<HTMLParagraphElement> | Ref<HTMLSpanElement> | Ref<HTMLDivElement>;\n}\n\nexport function Text(props: TextProps) {\n const { tone = \"default\", size = \"normal\", as = \"p\", children, ...rest } = props;\n\n const view = useSprintView();\n\n const node = buildAgentNode({\n component: textMeta.name,\n label: reactText(children),\n state: { tone, size },\n });\n\n if (view === \"agent\") return <AgentLine node={node} />;\n\n const Element = as;\n\n return (\n <Element {...(rest as ComponentPropsWithRef<\"p\">)} {...agentAttributesFor(node)}>\n {children}\n </Element>\n );\n}\n","import type { AgentToolSpec } from \"@/agent/types.ts\";\n\nexport const FILL_TEXTAREA_TOOL: AgentToolSpec = {\n verb: \"fill\",\n description:\n \"Replace this text area's content with the value provided, exactly as a person typing it would. The value is the full text it ends up containing, line breaks included; pass an empty string to clear it. Returns the area's state after the change, so a follow-up read is unnecessary.\",\n inputSchema: {\n type: \"object\",\n properties: {\n value: {\n type: \"string\",\n description:\n \"The full text the area should contain afterwards, with real line breaks where line breaks belong. Replaces the current text.\",\n },\n },\n required: [\"value\"],\n },\n readOnly: false,\n untrustedContent: true,\n registeredWhen:\n \"The area is mounted, enabled, has a resolvable label, and no other component claims the same tool name.\",\n unregisteredWhen: \"The area unmounts or becomes disabled.\",\n};\n","import { defineAgentMeta } from \"@/agent/registry.ts\";\nimport { FILL_TEXTAREA_TOOL } from \"./tool.ts\";\n\nexport const textareaMeta = defineAgentMeta({\n name: \"Textarea\",\n category: \"input\",\n summary:\n \"A multi-line text area carrying its own label, hint, and error. Fully controlled, and it registers one fill tool that replaces the whole content with an explicit value, line breaks included.\",\n whenToUse:\n \"Use it for free-form text that runs longer than a line: a description, a message body, a set of notes. In the agent view the current content is part of the component's state line, so an agent reads what is written without a separate query.\",\n whenNotToUse:\n \"Do not use it for a single-line value, which is a TextInput. Do not use it for code a person should read rather than write; that is a CodeBlock. Long values make long state lines, so keep it off surfaces where the agent view must stay terse.\",\n status: \"experimental\",\n props: {\n label: {\n kind: \"string\",\n description:\n 'What the area holds. Names it for a screen reader and derives the tool name, so prefer a noun phrase such as \"Mission notes\".',\n required: true,\n },\n value: {\n kind: \"string\",\n description: \"The area's current text. The area is fully controlled.\",\n required: true,\n },\n onChange: {\n kind: \"handler\",\n description:\n \"Called with the new text on every change. The fill tool drives a real input event, so this runs for agent fills too.\",\n required: true,\n },\n rows: {\n kind: \"number\",\n description: \"The visible line count before scrolling.\",\n default: 4,\n },\n placeholder: {\n kind: \"string\",\n description: \"Ghost text shown while the area is empty.\",\n },\n hint: {\n kind: \"string\",\n description:\n \"Guidance shown under the area and carried into the agent view. Replaced by error while one is set.\",\n },\n error: {\n kind: \"string\",\n description:\n \"A validation message. Marks the area invalid for people, screen readers, and agents alike.\",\n },\n name: {\n kind: \"string\",\n description: \"The native form name submitted with the surrounding form.\",\n },\n disabled: {\n kind: \"boolean\",\n description: \"Disable the area and unregister its fill tool.\",\n default: false,\n },\n required: {\n kind: \"boolean\",\n description: \"Mark the area required, visually and in the agent view.\",\n default: false,\n },\n agentName: {\n kind: \"string\",\n description:\n \"Override the label used to derive the tool name, when two areas on a page would otherwise collide.\",\n },\n agentTool: {\n kind: \"boolean\",\n description: \"Set false to render the area without registering a fill tool.\",\n default: true,\n },\n },\n state: {\n value: {\n description: \"The area's current text.\",\n attribute: \"data-sprint-value\",\n },\n empty: {\n description: \"Present while the area holds no text.\",\n attribute: \"data-sprint-empty\",\n },\n disabled: {\n description: \"Present when the area cannot be edited.\",\n attribute: \"data-sprint-disabled\",\n },\n required: {\n description: \"Present when the area must be filled.\",\n attribute: \"data-sprint-required\",\n },\n invalid: {\n description: \"Present while an error is set.\",\n attribute: \"data-sprint-invalid\",\n },\n },\n tools: {\n fill: FILL_TEXTAREA_TOOL,\n },\n agentView: {\n example:\n '- **Textarea** \"Mission notes\" [empty] → tool `fill-mission-notes`\\n - part `hint` \"What the relief crew needs to know\"',\n },\n examples: [\n {\n title: \"A notes area\",\n description:\n \"Label, hint, and control are one component. In agent view it renders a live textarea an agent can type into.\",\n code: '<Textarea\\n label=\"Mission notes\"\\n value={notes}\\n onChange={setNotes}\\n hint=\"What the relief crew needs to know\"\\n/>',\n },\n {\n title: \"A required area with an error\",\n description:\n \"The error replaces the hint and marks the area invalid on every surface.\",\n code: '<Textarea\\n label=\"Abort reason\"\\n value={reason}\\n onChange={setReason}\\n required\\n rows={3}\\n error=\"State the reason before aborting.\"\\n/>',\n },\n ],\n a11y: {\n role: \"textbox\",\n keyboard: [\"Standard text editing\", \"Enter inserts a line break\"],\n notes:\n \"The label element is associated via htmlFor. An error sets aria-invalid and is linked with aria-describedby, as is the hint.\",\n },\n});\n","import {\n type ComponentPropsWithRef,\n useCallback,\n useEffect,\n useId,\n useRef,\n} from \"react\";\nimport { AgentFieldControl, AgentLine } from \"@/agent/view/AgentText.tsx\";\nimport { useAgentControls, useAgentFormat, useSprintView } from \"@/agent/view/mode.ts\";\nimport type { AgentPart } from \"@/agent/view/node.ts\";\nimport {\n agentAttributesFor,\n agentPartAttributesFor,\n buildAgentNode,\n} from \"@/agent/view/project.ts\";\nimport { afterCommit } from \"@/agent/webmcp/afterCommit.ts\";\nimport { setFieldValue } from \"@/agent/webmcp/drive.ts\";\nimport { commitSync } from \"@/agent/webmcp/flush.ts\";\nimport { useAgentTool } from \"@/agent/webmcp/useAgentTool.ts\";\nimport { textareaMeta } from \"./meta.ts\";\nimport { FILL_TEXTAREA_TOOL } from \"./tool.ts\";\nimport \"./Textarea.css\";\n\nexport interface TextareaProps extends Omit<ComponentPropsWithRef<\"div\">, \"onChange\"> {\n label: string;\n value: string;\n onChange: (value: string) => void;\n rows?: number;\n placeholder?: string;\n hint?: string;\n error?: string;\n name?: string;\n disabled?: boolean;\n required?: boolean;\n agentName?: string;\n agentTool?: boolean;\n}\n\nfunction messagePart(error: string | undefined, hint: string | undefined): AgentPart[] {\n if (error !== undefined) return [{ part: \"error\", label: error, state: {} }];\n if (hint !== undefined) return [{ part: \"hint\", label: hint, state: {} }];\n return [];\n}\n\nexport function Textarea(props: TextareaProps) {\n const {\n label,\n value,\n onChange,\n rows = 4,\n placeholder,\n hint,\n error,\n name,\n disabled = false,\n required = false,\n agentName,\n agentTool = true,\n ...rest\n } = props;\n\n const view = useSprintView();\n const controls = useAgentControls();\n const formatter = useAgentFormat();\n const id = useId();\n\n const element = useRef<HTMLTextAreaElement | null>(null);\n const onChangeRef = useRef(onChange);\n onChangeRef.current = onChange;\n const formatRef = useRef(formatter);\n formatRef.current = formatter;\n const nodeRef = useRef(buildAgentNode({ component: textareaMeta.name }));\n const mounted = useRef(true);\n\n useEffect(() => {\n mounted.current = true;\n return () => {\n mounted.current = false;\n };\n }, []);\n\n const execute = useCallback(async (inputs: Record<string, unknown>) => {\n const next = inputs.value;\n if (typeof next !== \"string\") {\n return 'Pass \"value\" as a string holding the full text the area should contain.';\n }\n\n const target = element.current;\n if (target !== null) setFieldValue(target, next);\n else commitSync(() => onChangeRef.current(next));\n\n await afterCommit();\n if (!mounted.current) return \"The change removed this area from the page.\";\n return `Filled. The area is now:\\n${formatRef.current([nodeRef.current])}`;\n }, []);\n\n const toolName = useAgentTool({\n spec: FILL_TEXTAREA_TOOL,\n label: agentName ?? label,\n enabled: agentTool && !disabled,\n execute,\n });\n\n const node = buildAgentNode({\n component: textareaMeta.name,\n label,\n tool: toolName,\n state: {\n ...(value === \"\" ? {} : { value }),\n empty: value === \"\",\n disabled,\n required,\n invalid: error !== undefined,\n },\n parts: messagePart(error, hint),\n });\n nodeRef.current = node;\n\n if (view === \"agent\") {\n if (disabled || controls === \"never\") return <AgentLine node={node} />;\n return (\n <AgentFieldControl\n node={node}\n value={value}\n multiline\n onValueChange={onChange}\n ref={(target: HTMLTextAreaElement | null) => {\n element.current = target;\n }}\n />\n );\n }\n\n const messageId =\n error !== undefined ? `${id}-error` : hint !== undefined ? `${id}-hint` : undefined;\n\n return (\n <div {...rest} {...agentAttributesFor(node)}>\n <label htmlFor={id}>{label}</label>\n <textarea\n id={id}\n {...agentPartAttributesFor({ part: \"input\", state: {} })}\n ref={(target) => {\n element.current = target;\n }}\n rows={rows}\n value={value}\n placeholder={placeholder}\n name={name}\n disabled={disabled}\n required={required}\n aria-invalid={error !== undefined || undefined}\n aria-describedby={messageId}\n onChange={(event) => onChange(event.currentTarget.value)}\n />\n {error !== undefined ? (\n <p id={messageId} {...agentPartAttributesFor({ part: \"error\", state: {} })}>\n {error}\n </p>\n ) : hint !== undefined ? (\n <p id={messageId} {...agentPartAttributesFor({ part: \"hint\", state: {} })}>\n {hint}\n </p>\n ) : null}\n </div>\n );\n}\n","import type { AgentToolSpec } from \"@/agent/types.ts\";\n\nexport const FILL_TOOL: AgentToolSpec = {\n verb: \"fill\",\n description:\n \"Replace this field's text with the value provided, exactly as a person typing it would. The value is the full text the field ends up containing; pass an empty string to clear it. Returns the field's state after the change, so a follow-up read is unnecessary.\",\n inputSchema: {\n type: \"object\",\n properties: {\n value: {\n type: \"string\",\n description:\n \"The full text the field should contain afterwards. Replaces the current text rather than appending to it.\",\n },\n },\n required: [\"value\"],\n },\n readOnly: false,\n untrustedContent: true,\n registeredWhen:\n \"The field is mounted, enabled, editable rather than read-only, has a resolvable label, and no other component claims the same tool name.\",\n unregisteredWhen: \"The field unmounts, becomes disabled, or becomes read-only.\",\n};\n","import { defineAgentMeta } from \"@/agent/registry.ts\";\nimport { FILL_TOOL } from \"./tool.ts\";\n\nexport const textInputMeta = defineAgentMeta({\n name: \"TextInput\",\n category: \"input\",\n summary:\n \"A single-line text field carrying its own label, hint, and error. Fully controlled, and it registers one fill tool that replaces the field's text with an explicit value.\",\n whenToUse:\n \"Use it for any free-form single-line value: a name, an email address, a search term. The label is part of the component, so a form never needs a separate label element, and the error prop is how validation reaches both a person and an agent.\",\n whenNotToUse:\n \"Do not use it for multi-line text, which is a Textarea. Do not use it to pick from a known set of values; that is a Select or a SegmentedControl. Do not use it for an on/off state, which is a Checkbox or a Switch. Do not use a read-only TextInput to hand someone a value to paste elsewhere; that is a CopyField.\",\n status: \"experimental\",\n props: {\n label: {\n kind: \"string\",\n description:\n 'What the field holds. Names the field for a screen reader and derives the tool name, so prefer a noun phrase such as \"Callsign\".',\n required: true,\n },\n value: {\n kind: \"string\",\n description: \"The field's current text. The field is fully controlled.\",\n required: true,\n },\n onChange: {\n kind: \"handler\",\n description:\n \"Called with the new text on every change. The fill tool drives a real input event, so this runs for agent fills too.\",\n required: true,\n },\n type: {\n kind: \"enum\",\n description:\n 'The input type. \"password\" masks the field everywhere: the value never appears in agent attributes, the agent view, or tool results.',\n values: [\"text\", \"email\", \"url\", \"search\", \"password\"],\n default: \"text\",\n },\n placeholder: {\n kind: \"string\",\n description: \"Ghost text shown while the field is empty.\",\n },\n hint: {\n kind: \"string\",\n description:\n \"Guidance shown under the field and carried into the agent view. Replaced by error while one is set.\",\n },\n error: {\n kind: \"string\",\n description:\n \"A validation message. Marks the field invalid for people, screen readers, and agents alike.\",\n },\n name: {\n kind: \"string\",\n description: \"The native form name submitted with the surrounding form.\",\n },\n autoComplete: {\n kind: \"string\",\n description: \"The native autocomplete hint, forwarded to the input.\",\n },\n disabled: {\n kind: \"boolean\",\n description: \"Disable the field and unregister its fill tool.\",\n default: false,\n },\n readOnly: {\n kind: \"boolean\",\n description:\n \"Show the value without letting anyone change it. The field stays focusable and selectable, renders as plain text in the agent view, and registers no fill tool, because nothing can change it.\",\n default: false,\n },\n required: {\n kind: \"boolean\",\n description: \"Mark the field required, visually and in the agent view.\",\n default: false,\n },\n agentName: {\n kind: \"string\",\n description:\n \"Override the label used to derive the tool name, when two fields on a page would otherwise collide.\",\n },\n agentTool: {\n kind: \"boolean\",\n description: \"Set false to render the field without registering a fill tool.\",\n default: true,\n },\n },\n state: {\n value: {\n description:\n \"The field's current text. Never present on a password field, which reflects filled instead.\",\n attribute: \"data-sprint-value\",\n },\n filled: {\n description: \"Present when a password field holds text.\",\n attribute: \"data-sprint-filled\",\n },\n empty: {\n description: \"Present while the field holds no text.\",\n attribute: \"data-sprint-empty\",\n },\n disabled: {\n description: \"Present when the field cannot be edited.\",\n attribute: \"data-sprint-disabled\",\n },\n readonly: {\n description:\n \"Present when the field shows a value that cannot be changed. No fill tool is registered while it is set.\",\n attribute: \"data-sprint-readonly\",\n },\n required: {\n description: \"Present when the field must be filled.\",\n attribute: \"data-sprint-required\",\n },\n invalid: {\n description: \"Present while an error is set.\",\n attribute: \"data-sprint-invalid\",\n },\n },\n tools: {\n fill: FILL_TOOL,\n },\n agentView: {\n example:\n '- **TextInput** \"Callsign\" [empty, required] → tool `fill-callsign`\\n - part `hint` \"Uppercase, three to eight letters\"',\n },\n examples: [\n {\n title: \"A labelled field\",\n description:\n \"Label, hint, and control are one component. In agent view the hint becomes a part line and the field renders a live input an agent can type into.\",\n code: '<TextInput\\n label=\"Callsign\"\\n value={callsign}\\n onChange={setCallsign}\\n hint=\"Uppercase, three to eight letters\"\\n placeholder=\"NOMAD\"\\n/>',\n },\n {\n title: \"A validation error\",\n description:\n \"The error replaces the hint, marks the field invalid on every surface, and reads back through the fill tool's result.\",\n code: '<TextInput\\n label=\"Frequency\"\\n value={frequency}\\n onChange={setFrequency}\\n required\\n error=\"Out of band. Use 118.000 to 136.975.\"\\n/>',\n },\n {\n title: \"A password\",\n description:\n \"The value stays off every agent surface: state reflects filled or empty, and tool results never echo the text.\",\n code: '<TextInput\\n label=\"Access code\"\\n type=\"password\"\\n value={code}\\n onChange={setCode}\\n autoComplete=\"current-password\"\\n/>',\n },\n {\n title: \"A read-only value\",\n description:\n \"A value shown in the shape of a form field that nobody may edit. It stays focusable and selectable, reads as text in the agent view, and registers no fill tool. To hand someone a value to paste elsewhere, a CopyField adds the copy control.\",\n code: '<TextInput\\n label=\"Station ID\"\\n value=\"KX-2209-ALPHA\"\\n onChange={() => {}}\\n readOnly\\n hint=\"Assigned at registration\"\\n/>',\n },\n ],\n a11y: {\n role: \"textbox\",\n keyboard: [\"Standard text editing\", \"Tab moves through the field\"],\n notes:\n \"The label element is associated via htmlFor. An error sets aria-invalid and is linked with aria-describedby, as is the hint. Focus is an offset keyline, never a rounded ring.\",\n },\n});\n","import {\n type ComponentPropsWithRef,\n useCallback,\n useEffect,\n useId,\n useRef,\n} from \"react\";\nimport { AgentFieldControl, AgentLine } from \"@/agent/view/AgentText.tsx\";\nimport { useAgentControls, useAgentFormat, useSprintView } from \"@/agent/view/mode.ts\";\nimport type { AgentPart } from \"@/agent/view/node.ts\";\nimport {\n agentAttributesFor,\n agentPartAttributesFor,\n buildAgentNode,\n} from \"@/agent/view/project.ts\";\nimport { afterCommit } from \"@/agent/webmcp/afterCommit.ts\";\nimport { setFieldValue } from \"@/agent/webmcp/drive.ts\";\nimport { commitSync } from \"@/agent/webmcp/flush.ts\";\nimport { useAgentTool } from \"@/agent/webmcp/useAgentTool.ts\";\nimport { textInputMeta } from \"./meta.ts\";\nimport { FILL_TOOL } from \"./tool.ts\";\nimport \"./TextInput.css\";\n\nexport type TextInputType = \"text\" | \"email\" | \"url\" | \"search\" | \"password\";\n\nexport interface TextInputProps extends Omit<ComponentPropsWithRef<\"div\">, \"onChange\"> {\n label: string;\n value: string;\n onChange: (value: string) => void;\n type?: TextInputType;\n placeholder?: string;\n hint?: string;\n error?: string;\n name?: string;\n autoComplete?: string;\n disabled?: boolean;\n readOnly?: boolean;\n required?: boolean;\n agentName?: string;\n agentTool?: boolean;\n}\n\nfunction messagePart(error: string | undefined, hint: string | undefined): AgentPart[] {\n if (error !== undefined) return [{ part: \"error\", label: error, state: {} }];\n if (hint !== undefined) return [{ part: \"hint\", label: hint, state: {} }];\n return [];\n}\n\nexport function TextInput(props: TextInputProps) {\n const {\n label,\n value,\n onChange,\n type = \"text\",\n placeholder,\n hint,\n error,\n name,\n autoComplete,\n disabled = false,\n readOnly = false,\n required = false,\n agentName,\n agentTool = true,\n ...rest\n } = props;\n\n const view = useSprintView();\n const controls = useAgentControls();\n const formatter = useAgentFormat();\n const id = useId();\n\n const element = useRef<HTMLInputElement | null>(null);\n const onChangeRef = useRef(onChange);\n onChangeRef.current = onChange;\n const formatRef = useRef(formatter);\n formatRef.current = formatter;\n const nodeRef = useRef(buildAgentNode({ component: textInputMeta.name }));\n const mounted = useRef(true);\n\n useEffect(() => {\n mounted.current = true;\n return () => {\n mounted.current = false;\n };\n }, []);\n\n const masked = type === \"password\";\n\n const execute = useCallback(async (inputs: Record<string, unknown>) => {\n const next = inputs.value;\n if (typeof next !== \"string\") {\n return 'Pass \"value\" as a string holding the full text the field should contain.';\n }\n\n const target = element.current;\n if (target !== null) setFieldValue(target, next);\n else commitSync(() => onChangeRef.current(next));\n\n await afterCommit();\n if (!mounted.current) return \"The change removed this field from the page.\";\n return `Filled. The field is now:\\n${formatRef.current([nodeRef.current])}`;\n }, []);\n\n const toolName = useAgentTool({\n spec: FILL_TOOL,\n label: agentName ?? label,\n enabled: agentTool && !disabled && !readOnly,\n execute,\n });\n\n const node = buildAgentNode({\n component: textInputMeta.name,\n label,\n tool: toolName,\n state: {\n ...(masked ? { filled: value !== \"\" } : value === \"\" ? {} : { value }),\n empty: value === \"\",\n disabled,\n readonly: readOnly,\n required,\n invalid: error !== undefined,\n },\n parts: messagePart(error, hint),\n });\n nodeRef.current = node;\n\n if (view === \"agent\") {\n if (disabled || readOnly || controls === \"never\") return <AgentLine node={node} />;\n return (\n <AgentFieldControl\n node={node}\n value={value}\n masked={masked}\n onValueChange={onChange}\n ref={(target: HTMLInputElement | null) => {\n element.current = target;\n }}\n />\n );\n }\n\n const messageId =\n error !== undefined ? `${id}-error` : hint !== undefined ? `${id}-hint` : undefined;\n\n return (\n <div {...rest} {...agentAttributesFor(node)}>\n <label htmlFor={id}>{label}</label>\n <input\n id={id}\n {...agentPartAttributesFor({ part: \"input\", state: {} })}\n ref={(target) => {\n element.current = target;\n }}\n type={type}\n value={value}\n placeholder={placeholder}\n name={name}\n autoComplete={autoComplete}\n disabled={disabled}\n readOnly={readOnly}\n required={required}\n aria-invalid={error !== undefined || undefined}\n aria-describedby={messageId}\n onChange={(event) => onChange(event.currentTarget.value)}\n />\n {error !== undefined ? (\n <p id={messageId} {...agentPartAttributesFor({ part: \"error\", state: {} })}>\n {error}\n </p>\n ) : hint !== undefined ? (\n <p id={messageId} {...agentPartAttributesFor({ part: \"hint\", state: {} })}>\n {hint}\n </p>\n ) : null}\n </div>\n );\n}\n","import { REGION_ATTRIBUTE } from \"@/agent/attributes.ts\";\nimport type { AgentToolSpec } from \"@/agent/types.ts\";\nimport type { SprintView } from \"@/agent/view/mode.ts\";\nimport type { AgentFormatter, AgentNode } from \"@/agent/view/node.ts\";\nimport { countNodes } from \"@/agent/view/node.ts\";\nimport {\n serializeElement,\n serializeWithin,\n topLevelRoots,\n} from \"@/agent/view/serialize.ts\";\nimport { clamp, paginate } from \"@/agent/view/truncate.ts\";\nimport { TOOL_OUTPUT_LIMIT } from \"@/agent/webmcp/adapter.ts\";\nimport { afterCommit } from \"@/agent/webmcp/afterCommit.ts\";\nimport { commitSync } from \"@/agent/webmcp/flush.ts\";\nimport { slug } from \"@/agent/webmcp/scope.ts\";\nimport { useAgentTool } from \"@/agent/webmcp/useAgentTool.ts\";\n\nconst PAGE_FOOTER_BUDGET = 40;\n\nexport interface Region {\n key: string;\n node: AgentNode;\n}\n\nexport function regionKey(node: AgentNode): string {\n const label = node.label === undefined ? \"\" : slug(node.label);\n const base = label === \"\" ? slug(node.component) : `${slug(node.component)}-${label}`;\n return base === \"\" ? \"region\" : base;\n}\n\nexport function toRegions(nodes: readonly AgentNode[]): Region[] {\n const used = new Map<string, number>();\n return nodes.map((node) => {\n const base = regionKey(node);\n const seen = used.get(base) ?? 0;\n used.set(base, seen + 1);\n return { key: seen === 0 ? base : `${base}-${seen + 1}`, node };\n });\n}\n\nfunction readRegions(): Region[] {\n if (typeof document === \"undefined\") return [];\n const body = document.body;\n const tops = new Set(topLevelRoots(body));\n const nested = Array.from(body.querySelectorAll(`[${REGION_ATTRIBUTE}]`)).filter(\n (element) => !tops.has(element),\n );\n return toRegions([\n ...serializeWithin(body),\n ...nested\n .map((element) => serializeElement(element))\n .filter((node): node is AgentNode => node !== null),\n ]);\n}\n\nexport const LIST_REGIONS_SPEC: AgentToolSpec = {\n verb: \"list\",\n description:\n \"List the Sprint component regions on this page, with a one-line state summary for each. Call this first to discover region keys, then call read-region to read one in full. Regions nest: a page-level region contains the labelled panels listed after it, so read the smallest region that covers what you need.\",\n inputSchema: { type: \"object\", properties: {} },\n readOnly: true,\n untrustedContent: true,\n registeredWhen: \"A root SprintProvider is mounted and WebMCP is available.\",\n};\n\nexport const READ_REGION_SPEC: AgentToolSpec = {\n verb: \"read\",\n description:\n \"Read one region of the page as Markdown, including every component in it, its current state, and the tools that drive it. Long regions are paginated; the response ends with the page number and total.\",\n inputSchema: {\n type: \"object\",\n properties: {\n region: {\n type: \"string\",\n description: \"A region key from list-page-regions.\",\n },\n page: {\n type: \"integer\",\n description: \"1-based page number. Defaults to 1.\",\n minimum: 1,\n },\n },\n required: [\"region\"],\n },\n readOnly: true,\n untrustedContent: true,\n registeredWhen: \"A root SprintProvider is mounted and WebMCP is available.\",\n};\n\nexport function listRegions(format: AgentFormatter): string {\n const regions = readRegions();\n if (regions.length === 0) return \"This page has no Sprint components.\";\n\n const lines = regions.map(({ key, node }) => {\n const nested = countNodes(node.children);\n const summary = format([{ ...node, children: [], parts: [] }])\n .split(\"\\n\")[0]\n ?.replace(/^-\\s*/, \"\");\n const suffix = nested === 0 ? \"\" : ` (${nested} nested)`;\n return `- \\`${key}\\` — ${summary ?? node.component}${suffix}`;\n });\n\n return [`${regions.length} region(s):`, ...lines].join(\"\\n\");\n}\n\nexport function readRegion(\n format: AgentFormatter,\n requested: unknown,\n page: unknown,\n): string {\n const regions = readRegions();\n const keys = regions.map((region) => region.key);\n const match = regions.find((region) => region.key === requested);\n\n if (match === undefined) {\n return `No region named \"${String(requested)}\". Available regions: ${\n keys.join(\", \") || \"none\"\n }.`;\n }\n\n const pages = paginate(format([match.node]), TOOL_OUTPUT_LIMIT - PAGE_FOOTER_BUDGET);\n const requestedPage = typeof page === \"number\" ? page : 1;\n\n if (requestedPage < 1 || requestedPage > pages.length) {\n return `Region \"${match.key}\" has ${pages.length} page(s); page ${requestedPage} does not exist.`;\n }\n\n return `${pages[requestedPage - 1] ?? \"\"}\\n\\n(page ${requestedPage} of ${pages.length})`;\n}\n\nexport const SET_VIEW_SPEC: AgentToolSpec = {\n verb: \"set\",\n description:\n 'Switch how this page renders. In \"agent\" view every Sprint component renders as plain Markdown text with no HTML elements, so the page can be read directly. In \"human\" view it renders normally. Tools keep working in both.',\n inputSchema: {\n type: \"object\",\n properties: {\n view: {\n type: \"string\",\n description: 'Either \"agent\" or \"human\".',\n enum: [\"agent\", \"human\"],\n },\n },\n required: [\"view\"],\n },\n readOnly: false,\n untrustedContent: true,\n registeredWhen: \"A root SprintProvider is mounted and WebMCP is available.\",\n};\n\nexport function pageText(): string {\n if (typeof document === \"undefined\") return \"\";\n return (document.body.textContent ?? \"\").replace(/\\n{3,}/g, \"\\n\\n\").trim();\n}\n\nexport interface UsePageToolsOptions {\n enabled: boolean;\n format: AgentFormatter;\n view: SprintView;\n setView: (view: SprintView) => void;\n}\n\nexport function usePageTools(options: UsePageToolsOptions): void {\n const { enabled, format, view, setView } = options;\n\n useAgentTool({\n spec: LIST_REGIONS_SPEC,\n label: \"page regions\",\n enabled,\n execute: () =>\n view === \"agent\"\n ? 'This page is in agent view and renders as one text document. Call read-region with region \"page\", or read the page text directly.'\n : listRegions(format),\n });\n\n useAgentTool({\n spec: READ_REGION_SPEC,\n label: \"region\",\n enabled,\n execute: (inputs) =>\n view === \"agent\"\n ? readTextRegion(inputs.region, inputs.page)\n : readRegion(format, inputs.region, inputs.page),\n });\n\n useAgentTool({\n spec: SET_VIEW_SPEC,\n label: \"page view\",\n enabled,\n execute: async (inputs) => {\n const next = inputs.view === \"agent\" ? \"agent\" : \"human\";\n commitSync(() => setView(next));\n await afterCommit();\n return next === \"agent\"\n ? `Page is now in agent view:\\n\\n${clamp(pageText(), TOOL_OUTPUT_LIMIT - PAGE_FOOTER_BUDGET)}`\n : \"Page is now in human view.\";\n },\n });\n}\n\nfunction readTextRegion(requested: unknown, page: unknown): string {\n if (requested !== \"page\") {\n return `No region named \"${String(requested)}\". In agent view the whole page is one region, named \"page\".`;\n }\n\n const pages = paginate(pageText(), TOOL_OUTPUT_LIMIT - PAGE_FOOTER_BUDGET);\n const requestedPage = typeof page === \"number\" ? page : 1;\n\n if (requestedPage < 1 || requestedPage > pages.length) {\n return `Region \"page\" has ${pages.length} page(s); page ${requestedPage} does not exist.`;\n }\n\n return `${pages[requestedPage - 1] ?? \"\"}\\n\\n(page ${requestedPage} of ${pages.length})`;\n}\n","import type { PointerEvent as ReactPointerEvent } from \"react\";\n\nconst GLOSS_X = \"--sprint-gloss-x\";\nconst GLOSS_FADE = \"--sprint-gloss-fade\";\nconst CAST_SHIFT = \"--sprint-cast-shift\";\nconst X_MIN = 22;\nconst X_MAX = 78;\nconst FADE_SPAN = 28;\nconst FADE_FLOOR = 0.25;\nconst CAST_TRAVEL = 10;\n\nconst clamp = (value: number, min: number, max: number) =>\n Math.min(max, Math.max(min, value));\n\nfunction stilled() {\n return (\n typeof matchMedia === \"function\" &&\n matchMedia(\"(prefers-reduced-motion: reduce)\").matches\n );\n}\n\nconst GLOSSY = new Set([\n \"Button\",\n \"Card\",\n \"Tag\",\n \"SegmentedControl\",\n \"Switch\",\n \"Shell\",\n]);\n\nconst LIT_PARTS = new Set([\"option\", \"thumb\"]);\n\nfunction litPart(node: Element, root: HTMLElement): HTMLElement | null {\n const part = node.closest<HTMLElement>(\"[data-sprint-part]\");\n if (part === null || !root.contains(part)) return null;\n const name = part.dataset.sprintPart;\n return name !== undefined && LIT_PARTS.has(name) ? part : null;\n}\n\nfunction glossTarget(node: EventTarget | null): HTMLElement | null {\n if (!(node instanceof Element)) return null;\n const root = node.closest<HTMLElement>(\"[data-sprint]\");\n if (root === null) return null;\n const name = root.dataset.sprint;\n if (name === undefined || !GLOSSY.has(name)) return null;\n return litPart(node, root) ?? root;\n}\n\nexport function trackGloss(event: ReactPointerEvent<HTMLElement>) {\n if (event.pointerType === \"touch\" || stilled()) return;\n const target = glossTarget(event.target);\n if (target === null) return;\n const box = target.getBoundingClientRect();\n if (box.width === 0 || box.height === 0) return;\n const x = clamp(((event.clientX - box.left) / box.width) * 100, X_MIN, X_MAX);\n const offset = (x - 50) / FADE_SPAN;\n target.style.setProperty(GLOSS_X, `${x.toFixed(1)}%`);\n target.style.setProperty(\n GLOSS_FADE,\n clamp(1 - Math.abs(offset), FADE_FLOOR, 1).toFixed(3),\n );\n target.style.setProperty(CAST_SHIFT, `${(offset * -CAST_TRAVEL).toFixed(1)}px`);\n}\n\nexport function releaseGloss(event: ReactPointerEvent<HTMLElement>) {\n const target = glossTarget(event.target);\n if (target === null) return;\n target.style.removeProperty(GLOSS_X);\n target.style.removeProperty(GLOSS_FADE);\n target.style.removeProperty(CAST_SHIFT);\n if (target.style.length === 0) target.removeAttribute(\"style\");\n}\n","import {\n type ReactNode,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport {\n THEME_ATTRIBUTE,\n VIEW_ATTRIBUTE,\n VIEW_COPY_ATTRIBUTE,\n} from \"@/agent/attributes.ts\";\nimport {\n defaultAgentFormat,\n type SprintAgentControls,\n type SprintView,\n SprintViewProvider,\n useSprintViewControl,\n} from \"@/agent/view/mode.ts\";\nimport type { AgentFormatter } from \"@/agent/view/node.ts\";\nimport { AgentScopeProvider, useAgentScope } from \"@/agent/webmcp/scope.ts\";\nimport { usePageTools } from \"./pageTools.ts\";\nimport \"./SprintProvider.css\";\nimport { releaseGloss, trackGloss } from \"./gloss.ts\";\n\nconst COPIED_FOR = 1200;\n\nexport type SprintTheme =\n | \"dark\"\n | \"light\"\n | \"calorie\"\n | \"calorie-dark\"\n | \"trax\"\n | \"trax-dark\"\n | \"ambient\"\n | \"ambient-dark\";\n\nexport interface SprintProviderProps {\n children: ReactNode;\n label?: string;\n format?: AgentFormatter;\n pageTools?: boolean;\n view?: SprintView;\n defaultView?: SprintView;\n onViewChange?: (view: SprintView) => void;\n agentControls?: SprintAgentControls;\n theme?: SprintTheme;\n}\n\nexport function SprintProvider(props: SprintProviderProps) {\n const {\n children,\n label,\n format,\n pageTools = true,\n view,\n defaultView,\n onViewChange,\n agentControls,\n theme,\n } = props;\n\n const parentScope = useAgentScope();\n const inherited = useSprintViewControl();\n const root = !inherited.owned;\n\n const [ownView, setOwnView] = useState<SprintView>(defaultView ?? \"human\");\n\n const controlled = view !== undefined;\n const owns = controlled || root || defaultView !== undefined;\n const effective = controlled ? view : owns ? ownView : inherited.view;\n\n const setView = useCallback(\n (next: SprintView) => {\n if (!owns) {\n inherited.setView(next);\n return;\n }\n if (!controlled) setOwnView(next);\n onViewChange?.(next);\n },\n [owns, controlled, inherited, onViewChange],\n );\n\n const controls = agentControls ?? inherited.controls;\n const formatter = format ?? inherited.format ?? defaultAgentFormat;\n\n const viewValue = useMemo(\n () => ({ view: effective, setView, controls, format: formatter, owned: owns }),\n [effective, setView, controls, formatter, owns],\n );\n\n const scopeValue = useMemo(\n () => ({ path: label === undefined ? parentScope : [...parentScope, label] }),\n [parentScope, label],\n );\n\n usePageTools({\n enabled: root && pageTools,\n format: formatter,\n view: effective,\n setView,\n });\n\n const surface = useRef<HTMLDivElement>(null);\n const [copied, setCopied] = useState(false);\n\n useEffect(() => {\n if (!copied) return;\n const timer = setTimeout(() => setCopied(false), COPIED_FOR);\n return () => clearTimeout(timer);\n }, [copied]);\n\n const copy = () => {\n const clipboard = navigator.clipboard;\n if (clipboard === undefined) return;\n const text = (surface.current?.textContent ?? \"\").replace(/\\n{3,}/g, \"\\n\\n\").trim();\n clipboard.writeText(text).then(\n () => setCopied(true),\n () => setCopied(false),\n );\n };\n\n const copyControl = owns && effective === \"agent\" && controls !== \"never\";\n\n return (\n <SprintViewProvider value={viewValue}>\n <AgentScopeProvider value={scopeValue}>\n {copyControl ? (\n <button\n type=\"button\"\n aria-label={copied ? \"Copied\" : \"Copy agent view\"}\n {...{ [VIEW_COPY_ATTRIBUTE]: \"\" }}\n {...(copied ? { \"data-sprint-copied\": \"\" } : {})}\n onClick={copy}\n />\n ) : null}\n <div\n ref={surface}\n onPointerMove={effective === \"agent\" ? undefined : trackGloss}\n onPointerOut={effective === \"agent\" ? undefined : releaseGloss}\n {...{ [VIEW_ATTRIBUTE]: effective }}\n {...(theme === undefined ? {} : { [THEME_ATTRIBUTE]: theme })}\n >\n {children}\n </div>\n </AgentScopeProvider>\n </SprintViewProvider>\n );\n}\n\nexport interface AgentRegionProps {\n children: ReactNode;\n label: string;\n}\n\nexport function AgentRegion(props: AgentRegionProps) {\n const { children, label } = props;\n const parent = useAgentScope();\n const value = useMemo(() => ({ path: [...parent, label] }), [parent, label]);\n\n return <AgentScopeProvider value={value}>{children}</AgentScopeProvider>;\n}\n","import pkg from \"../package.json\" with { type: \"json\" };\n\nexport const version: string = pkg.version;\n"],"names":["COMPONENT_ATTRIBUTE","PART_ATTRIBUTE","STATE_ATTRIBUTE_PREFIX","TOOL_ATTRIBUTE","OWNER_ATTRIBUTE","AGENT_ATTRIBUTE","VIEW_ATTRIBUTE","VIEW_COPY_ATTRIBUTE","THEME_ATTRIBUTE","REGION_ATTRIBUTE","RESERVED_STATE_KEYS","agentAttributes","component","options","attributes","key","value","agentSelector","part","base","TRUNCATION_MARKER","clamp","text","max","budget","head","boundary","paginate","size","lines","pages","current","line","candidate","index","TOOL_OUTPUT_LIMIT","TOOL_DESCRIPTION_LIMIT","PARAM_DESCRIPTION_LIMIT","getModelContext","isModelContextAvailable","assertDescriptorLimits","descriptor","property","description","validateInputs","schema","inputs","known","actual","wantsNumber","harden","context","invalid","result","error","reason","registerTool","signal","TOOL_NAMING_CONVENTION","registry","defineAgentMeta","meta","existing","getAgentMeta","name","listAgentMeta","a","b","buildAgentManifest","version","isEmptyNode","node","countNodes","nodes","total","formatState","state","keys","formatLabel","label","formatTool","tool","partLine","indent","nodeLine","suffix","owned","nodeLines","inner","child","toMarkdown","input","resolved","defaultAgentFormat","ViewContext","createContext","SprintViewProvider","useSprintView","useContext","useSprintViewControl","useAgentControls","useAgentFormat","DepthContext","AgentDepthProvider","useAgentDepth","buildAgentNode","agentAttributesFor","agentControlAttributes","agentPartControlAttributes","agentPartAttributesFor","_root","format","formatter","AgentLine","props","children","silent","depth","AgentControlGroup","onActivate","isActionable","offset","jsxs","body","lead","jsx","Fragment","AgentFieldControl","onValueChange","multiline","masked","ref","control","event","AgentControl","as","href","rest","rows","tail","isCell","cellKey","row","column","condenseCells","columns","rowIds","cells","summary","normalize","gatherReact","out","isValidElement","reactText","parts","isHidden","element","gather","accessibleText","direct","labelledBy","root","referenced","id","target","reserved","NATIVE_BOOLEAN_STATE","ARIA_STATE","readState","attribute","scan","walk","toPart","serializeElement","maxDepth","lookupMeta","owner","exhausted","topLevelRoots","found","reattachOwned","byTool","attached","host","serializeWithin","afterCommit","resolve","MAX_NAME_LENGTH","slug","toolName","scope","verb","core","segments","cut","claims","claimFor","created","claimToolName","holder","onChange","claim","listener","holdsToolName","toolNameHolderCount","AgentScopeContext","AgentScopeProvider","useAgentScope","useAgentTool","spec","nameOverride","inputSchema","enabled","execute","schemaKey","schemaRef","useRef","holderRef","executeRef","useEffect","held","setHeld","useState","release","controller","commitSync","action","flushSync","DISMISS_ALERT_TOOL","alertMeta","Alert","tone","onDismiss","agentName","agentTool","view","controls","onDismissRef","formatRef","nodeRef","mounted","dismissible","useCallback","handler","message","role","ACT_BREADCRUMB_TOOL","breadcrumbMeta","ROOT","RECENCY_STEPS","TRAVEL","flatten","items","ancestors","parent","item","entry","lineage","branches","reading","opening","joined","entries","actionSchema","labels","Breadcrumb","actions","maxCrumbs","emptyLabel","trailEmptyLabel","onOpenChange","onNavigate","home","visited","defaultVisited","query","setQuery","setScope","unfolded","setUnfolded","remembered","setRemembered","trail","field","drawer","pressers","actionsRef","setRoot","notify","announce","next","close","all","useMemo","path","browsed","route","last","tailed","crumbCount","asked","open","fieldAt","dismiss","level","needle","searching","browsing","matches","revealed","reachable","onPath","destinationParts","partOf","actionParts","pressable","requested","available","match","shown","travel","was","seen","_part","reach","drill","lastSeen","members","best","member","ranked","recency","rank","travellers","within","step","from","stops","drive","steer","at","kept","foldable","folded","crumb","separator","nothing","count","_","visible","PRESS_TOOL","buttonMeta","syntheticClick","Button","block","loading","disabled","type","onClick","setRef","explicitLabel","domLabel","setDomLabel","useLayoutEffect","inert","onClickRef","OPEN_CARD_TOOL","cardMeta","Card","navigates","changeListMeta","SAFARI_LIST_SEMANTICS","KINDS","MARKS","WORDS","present","transitionText","change","to","changeText","detail","changeState","counts","changes","tally","kind","Transition","Row","ChangeList","empty","SET_CHECKBOX_TOOL","checkboxMeta","messagePart","hint","Checkbox","checked","required","useId","onChangeRef","checkedRef","desired","already","messageId","CHOOSE_TOOL","choiceGridMeta","MOVE_KEYS","optionSchema","option","targetIndex","submitThrough","carrier","form","ChoiceGrid","mode","legendId","elements","optionsRef","modeRef","choose","done","selected","selectedField","move","focused","hasSelection","radio","PATTERN","tokenize","code","tokens","cursor","slot","codeBlockMeta","COPIED_FOR","CodeBlock","caption","language","copyLabel","copied","setCopied","timer","copy","clipboard","token","copyFieldMeta","selectContents","selection","CopyField","copiedLabel","onCopy","status","setStatus","valueElement","onCopyRef","fail","labelId","descriptionListMeta","pairText","term","DescriptionList","loadingLabel","CLOSE_DIALOG_TOOL","dialogMeta","Dialog","onClose","headingLevel","parentScope","closeElement","onCloseRef","openRef","scopeValue","Label","EXPAND_DISCLOSURE_TOOL","disclosureMeta","inSentence","Disclosure","controlled","defaultExpanded","onExpandedChange","showLabel","hideLabel","contentId","uncontrolled","setUncontrolled","expanded","toggle","expandedRef","controlledRef","press","dividerMeta","Divider","weight","OPEN_LINK_TOOL","linkMeta","Link","active","external","outward","emptyStateMeta","ActionControl","EmptyState","descriptionId","tagMeta","Tag","filled","OPEN_ENTITY_ROW_TOOL","entityRowMeta","SEPARATOR","detailText","detailKey","EntityRow","title","onSelect","tags","acts","metaLine","chips","tag","titleId","tagsId","metaId","describedBy","naming","headingMeta","Heading","Element","imageMeta","Image","src","alt","ratio","fit","decorative","band","listMeta","List","orderedProp","markerProp","marker","ordered","metaLineMeta","MetaLine","wrap","navMeta","Nav","navGroupMeta","NavGroup","pageHeaderMeta","PageHeader","lede","Children","TURN_PAGE_TOOL","paginationMeta","whole","fallback","page","pageSize","first","showing","range","turnSchema","Pagination","onPageChange","previousLabel","nextLabel","navigable","targets","onPageChangeRef","rangeRef","turn","direction","partFor","actionable","register","panelMeta","Panel","flush","pendingMeta","Pending","busy","progressMeta","percentOf","Progress","percent","SEARCH_TOOL","searchFieldMeta","setFieldValue","prototype","setter","EDITABLE","isEditable","useShortcut","SearchField","onSubmit","placeholder","shortcut","onSubmitRef","submit","clear","onKeyDown","secretFieldMeta","MASK","SecretField","defaultRevealed","setRevealed","SELECT_TOOL","segmentedControlMeta","SegmentedControl","savedValue","select","dirty","optionParts","hintPart","hintId","countId","SELECT_OPTION_TOOL","selectMeta","LISTBOX_TOP","LISTBOX_LEFT","LISTBOX_WIDTH","place","listbox","anchor","rect","canPopover","showLayer","hideLayer","Select","setOpen","setActive","trigger","chosenIndex","chosen","show","hide","list","reposition","commit","listId","optionId","typeahead","start","lowered","onKeyUp","onBlur","forwarded","textId","shellMeta","Shell","side","bar","sideLabel","skipLabel","menuLabel","closeLabel","collapsible","defaultCollapsed","onCollapsedChange","collapsed","drawerId","main","closeOnNavigate","stackMeta","STACK_MINS","onScale","min","offScaleSizing","style","Stack","gap","align","justify","collapse","grid","stepsMeta","stepText","stepPart","Steps","steps","doneLabel","complete","SET_SWITCH_TOOL","switchMeta","Switch","on","onRef","tableMeta","TABLE_WIDTHS","width","offScaleWidth","rowId","cellState","cellParts","Table","textMeta","Text","FILL_TEXTAREA_TOOL","textareaMeta","Textarea","FILL_TOOL","textInputMeta","TextInput","autoComplete","readOnly","PAGE_FOOTER_BUDGET","regionKey","toRegions","used","readRegions","tops","nested","LIST_REGIONS_SPEC","READ_REGION_SPEC","listRegions","regions","readRegion","region","requestedPage","SET_VIEW_SPEC","pageText","usePageTools","setView","readTextRegion","GLOSS_X","GLOSS_FADE","CAST_SHIFT","X_MIN","X_MAX","FADE_SPAN","FADE_FLOOR","stilled","GLOSSY","LIT_PARTS","litPart","glossTarget","trackGloss","box","x","releaseGloss","SprintProvider","pageTools","defaultView","onViewChange","agentControls","theme","inherited","ownView","setOwnView","owns","effective","viewValue","surface","copyControl","AgentRegion","pkg"],"mappings":"gKAAaA,GAAsB,cACtBC,GAAiB,mBACjBC,GAAyB,eACzBC,GAAiB,mBACjBC,GAAkB,oBAClBC,GAAkB,oBAClBC,GAAiB,mBACjBC,GAAsB,wBACtBC,GAAkB,oBAClBC,GAAmB,qBAEnBC,GAAyC,CACpD,OACA,OACA,QACA,QACA,OACA,YACA,QACA,SACA,UACF,EASO,SAASC,GACdC,EACAC,EAAiC,GACT,CACxB,MAAMC,EAAqC,CACzC,CAACd,EAAmB,EAAGY,CAAA,EAGrBC,EAAQ,OACVC,EAAWb,EAAc,EAAIY,EAAQ,MAGvC,SAAW,CAACE,EAAKC,CAAK,IAAK,OAAO,QAAQH,EAAQ,OAAS,CAAA,CAAE,EACvDG,GAAU,MAA+BA,IAAU,KACvDF,EAAW,GAAGZ,EAAsB,GAAGa,CAAG,EAAE,EAAIC,IAAU,GAAO,GAAK,OAAOA,CAAK,GAGpF,OAAOF,CACT,CAEO,SAASG,GAAcL,EAAmBM,EAAuB,CACtE,MAAMC,EAAO,IAAInB,EAAmB,KAAKY,CAAS,KAClD,OAAOM,EAAO,G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